From d0badecd2a504327f974b6282490463d82201aa5 Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Thu, 5 Nov 2026 07:19:59 +0000 Subject: [PATCH] Switch tests to use the rendered form of diagnostics (#8070) Historically, we disabled the rendered form in tests outside of `toolchain/diagnostics`. The idea was to keep tests shorter and avoid very long chains of autoupdate before stabilizing due to all the line numbers and other artifacts in the rendered form. This PR adds `--diagnostic-line-numbers=[all|first]` and defaults to `first` in tests. This keeps the rendered form so that we can easily code review that form and the visual cues it does or doesn't provide. But it removes all but the first location's line numbers to provide significantly more stability in tests. By default, tests get the full unicode line-drawing form of diagnostics so we can ensure all of the artifacts there make sense with the specific case being diagnosed, but we do retain some focused ASCII-rendering tests to ensure that fallback remains usable. There are some issues here that will be fixed in subsequent PRs. Notably, we try to keep the frame together in the check lines, and so force some parts to use the first location. This largely works, but fails in some edge cases, causing the entire frame to be located incorrectly. There is a TODO about this that we need to fix, and it only occurs 6 times across the test suite, so it didn't seem worth front-loading a fix for here. Assisted-by: Claude Code --- toolchain/check/testdata/alias/basics.carbon | 106 +- .../check/testdata/alias/export_name.carbon | 8 +- .../check/testdata/alias/import_access.carbon | 17 +- .../check/testdata/alias/in_namespace.carbon | 13 +- .../alias/preserve_in_type_printing.carbon | 49 +- toolchain/check/testdata/alias/var.carbon | 7 +- toolchain/check/testdata/array/basics.carbon | 46 +- .../check/testdata/array/bound_values.carbon | 26 +- .../testdata/array/element_mismatches.carbon | 58 +- .../testdata/array/index_not_literal.carbon | 7 +- .../array/init_dependent_bound.carbon | 23 +- .../testdata/as/adapter_conversion.carbon | 24 +- toolchain/check/testdata/as/basics.carbon | 24 +- toolchain/check/testdata/as/const.carbon | 24 +- .../check/testdata/as/maybe_unformed.carbon | 152 +- toolchain/check/testdata/as/partial.carbon | 36 +- toolchain/check/testdata/as/unsafe_as.carbon | 11 +- .../check/testdata/basics/multi_error.carbon | 14 +- .../check/testdata/basics/name_lookup.carbon | 13 +- .../testdata/builtins/array/make_type.carbon | 20 +- .../testdata/builtins/char_literal/add.carbon | 44 +- .../builtins/char_literal/convert_char.carbon | 51 +- .../builtins/char_literal/convert_int.carbon | 19 +- .../builtins/char_literal/sub_int.carbon | 16 +- .../cpp/std/initializer_list/make.carbon | 68 +- .../check/testdata/builtins/float/add.carbon | 21 +- .../testdata/builtins/float/add_assign.carbon | 21 +- .../builtins/float/convert_checked.carbon | 89 +- .../builtins/float/convert_int.carbon | 526 +++--- .../check/testdata/builtins/float/div.carbon | 28 +- .../testdata/builtins/float/div_assign.carbon | 21 +- .../check/testdata/builtins/float/eq.carbon | 14 +- .../testdata/builtins/float/less_eq.carbon | 7 +- .../testdata/builtins/float/make_type.carbon | 14 +- .../check/testdata/builtins/float/mul.carbon | 28 +- .../testdata/builtins/float/mul_assign.carbon | 21 +- .../testdata/builtins/float/negate.carbon | 21 +- .../check/testdata/builtins/float/neq.carbon | 7 +- .../check/testdata/builtins/float/sub.carbon | 21 +- .../testdata/builtins/float/sub_assign.carbon | 21 +- .../builtins/float_literal/add.carbon | 8 +- .../builtins/float_literal/sub.carbon | 10 +- .../builtins/int/add_char_literal.carbon | 32 +- .../check/testdata/builtins/int/and.carbon | 80 +- .../testdata/builtins/int/and_assign.carbon | 21 +- .../testdata/builtins/int/complement.carbon | 13 +- .../testdata/builtins/int/convert.carbon | 26 +- .../builtins/int/convert_char_literal.carbon | 24 +- .../builtins/int/convert_checked.carbon | 112 +- .../builtins/int/convert_float.carbon | 16 +- .../builtins/int/convert_float_checked.carbon | 14 +- .../check/testdata/builtins/int/eq.carbon | 46 +- .../int/fail_convert_oversized_type.carbon | 56 +- .../testdata/builtins/int/left_shift.carbon | 133 +- .../builtins/int/left_shift_assign.carbon | 14 +- .../testdata/builtins/int/less_eq.carbon | 39 +- .../builtins/int/make_type_signed.carbon | 22 +- .../builtins/int/make_type_unsigned.carbon | 22 +- .../testdata/builtins/int/or_assign.carbon | 21 +- .../testdata/builtins/int/right_shift.carbon | 45 +- .../builtins/int/right_shift_assign.carbon | 14 +- .../check/testdata/builtins/int/sadd.carbon | 82 +- .../testdata/builtins/int/sadd_assign.carbon | 21 +- .../check/testdata/builtins/int/sdiv.carbon | 33 +- .../testdata/builtins/int/sdiv_assign.carbon | 21 +- .../check/testdata/builtins/int/smod.carbon | 19 +- .../testdata/builtins/int/smod_assign.carbon | 21 +- .../check/testdata/builtins/int/smul.carbon | 7 +- .../testdata/builtins/int/smul_assign.carbon | 21 +- .../testdata/builtins/int/snegate.carbon | 62 +- .../check/testdata/builtins/int/ssub.carbon | 7 +- .../testdata/builtins/int/ssub_assign.carbon | 21 +- .../check/testdata/builtins/int/uadd.carbon | 55 +- .../testdata/builtins/int/uadd_assign.carbon | 21 +- .../check/testdata/builtins/int/udiv.carbon | 12 +- .../testdata/builtins/int/udiv_assign.carbon | 21 +- .../check/testdata/builtins/int/umod.carbon | 12 +- .../testdata/builtins/int/umod_assign.carbon | 21 +- .../testdata/builtins/int/umul_assign.carbon | 21 +- .../testdata/builtins/int/unegate.carbon | 55 +- .../testdata/builtins/int/usub_assign.carbon | 21 +- .../testdata/builtins/int/xor_assign.carbon | 21 +- .../builtins/maybe_unformed/make_type.carbon | 14 +- .../check/testdata/builtins/no_op.carbon | 7 +- .../testdata/builtins/pointer/is_null.carbon | 35 +- .../builtins/pointer/make_null.carbon | 21 +- .../check/testdata/builtins/type/and.carbon | 61 +- toolchain/check/testdata/choice/basic.carbon | 8 +- toolchain/check/testdata/choice/params.carbon | 32 +- .../testdata/class/abstract/abstract.carbon | 186 ++- .../abstract/fail_abstract_in_struct.carbon | 99 +- .../abstract/fail_abstract_in_tuple.carbon | 125 +- .../class/access/access_modifiers.carbon | 109 +- .../check/testdata/class/access/friend.carbon | 40 +- .../class/access/import_access.carbon | 39 +- .../class/access/inheritance_access.carbon | 144 +- .../class/access/method_access.carbon | 8 +- .../check/testdata/class/adapter/adapt.carbon | 21 +- .../testdata/class/adapter/adapt_copy.carbon | 309 ++-- .../class/adapter/convert_incomplete.carbon | 12 +- .../class/adapter/extend_adapt.carbon | 57 +- .../class/adapter/fail_adapt_bad_decl.carbon | 74 +- .../class/adapter/fail_adapt_bad_type.carbon | 12 +- .../class/adapter/fail_adapt_modifiers.carbon | 43 +- .../class/adapter/fail_adapt_with_base.carbon | 12 +- .../adapter/fail_adapt_with_subobjects.carbon | 87 +- .../testdata/class/adapter/init_adapt.carbon | 72 +- .../class/cross_package_import.carbon | 86 +- toolchain/check/testdata/class/extern.carbon | 229 ++- .../testdata/class/extern_library.carbon | 6 +- .../class/fail_compound_type_mismatch.carbon | 10 +- .../class/fail_convert_to_invalid.carbon | 6 +- .../testdata/class/fail_error_recovery.carbon | 7 +- .../testdata/class/fail_import_misuses.carbon | 28 +- .../testdata/class/fail_incomplete.carbon | 166 +- .../check/testdata/class/fail_init.carbon | 21 +- .../class/fail_memaccess_category.carbon | 22 +- .../testdata/class/fail_member_of_let.carbon | 14 +- .../testdata/class/fail_modifiers.carbon | 96 +- .../class/fail_redeclaration_scope.carbon | 6 +- .../testdata/class/fail_redefinition.carbon | 30 +- .../check/testdata/class/fail_scope.carbon | 6 +- .../testdata/class/fail_unknown_member.carbon | 7 +- .../testdata/class/fail_var_param.carbon | 9 +- .../class/field/comp_time_field.carbon | 59 +- .../class/field/fail_field_modifiers.carbon | 28 +- .../class/field/fail_unbound_field.carbon | 24 +- .../class/field/field_initializer.carbon | 27 +- .../check/testdata/class/field/static.carbon | 12 +- .../check/testdata/class/generic/adapt.carbon | 32 +- .../class/generic/base_is_generic.carbon | 12 +- .../check/testdata/class/generic/call.carbon | 44 +- .../generic/complete_in_conversion.carbon | 26 +- .../class/generic/generic_vs_params.carbon | 66 +- .../testdata/class/generic/import.carbon | 108 +- .../class/generic/member_inline.carbon | 16 +- .../class/generic/member_lookup.carbon | 21 +- .../class/generic/member_out_of_line.carbon | 54 +- .../testdata/class/generic/redeclare.carbon | 232 +-- .../testdata/class/generic/stringify.carbon | 186 ++- .../testdata/class/implicit_import.carbon | 43 +- .../testdata/class/inheritance/base.carbon | 7 +- .../fail_base_as_declared_name.carbon | 8 +- .../inheritance/fail_base_bad_type.carbon | 143 +- .../fail_base_method_define.carbon | 13 +- .../inheritance/fail_base_misplaced.carbon | 21 +- .../inheritance/fail_base_modifiers.carbon | 36 +- .../inheritance/fail_base_no_extend.carbon | 6 +- .../inheritance/fail_base_repeated.carbon | 26 +- .../inheritance/fail_base_unbound.carbon | 7 +- .../inheritance/fail_derived_to_base.carbon | 28 +- .../inheritance/fail_extend_cycle.carbon | 17 +- .../inheritance/fail_init_missing_base.carbon | 7 +- .../class/method/bound_method_value.carbon | 43 +- .../fail_call_without_method_syntax.carbon | 41 +- .../class/method/fail_generic_method.carbon | 29 +- .../testdata/class/method/fail_method.carbon | 24 +- .../class/method/fail_method_modifiers.carbon | 50 +- .../method/fail_method_redefinition.carbon | 11 +- .../class/method/fail_out_of_line_decl.carbon | 7 +- .../testdata/class/method/virtual.carbon | 129 +- .../testdata/class/name_poisoning.carbon | 163 +- .../class/no_definition_in_impl_file.carbon | 38 +- .../testdata/class/partial/access.carbon | 12 +- .../testdata/class/partial/qualifier.carbon | 106 +- .../testdata/class/self/fail_ref_self.carbon | 53 +- .../testdata/class/self/fail_self.carbon | 226 ++- .../class/self/fail_self_param.carbon | 33 +- .../class/self/fail_self_type_member.carbon | 15 +- .../testdata/class/self/generic_self.carbon | 13 +- .../check/testdata/class/self/self.carbon | 71 +- .../testdata/class/syntactic_merge.carbon | 263 +-- .../class/syntactic_merge_literal.carbon | 47 +- toolchain/check/testdata/const/access.carbon | 12 +- toolchain/check/testdata/const/basics.carbon | 110 +- toolchain/check/testdata/deduce/array.carbon | 74 +- .../testdata/deduce/binding_pattern.carbon | 23 +- .../testdata/deduce/symbolic_facets.carbon | 28 +- toolchain/check/testdata/deduce/tuple.carbon | 13 +- .../testdata/deduce/type_operator.carbon | 13 +- .../value_with_type_through_access.carbon | 288 ++-- toolchain/check/testdata/deduce/where.carbon | 13 +- .../check/testdata/eval/aggregates.carbon | 120 +- toolchain/check/testdata/eval/binding.carbon | 28 +- toolchain/check/testdata/eval/branch.carbon | 9 +- toolchain/check/testdata/eval/call.carbon | 77 +- toolchain/check/testdata/eval/symbolic.carbon | 101 +- .../testdata/eval/unexpected_runtime.carbon | 46 +- toolchain/check/testdata/facet/access.carbon | 80 +- .../facet/aggregate_through_access.carbon | 27 +- toolchain/check/testdata/facet/combine.carbon | 60 +- ..._value_to_generic_facet_value_value.carbon | 50 +- .../convert_facet_type_to_facet_value.carbon | 42 +- .../check/testdata/facet/early_impls.carbon | 24 +- .../testdata/facet/early_rewrites.carbon | 263 ++- .../testdata/facet/facet_assoc_const.carbon | 298 +++- ...t_class_type_to_generic_facet_value.carbon | 14 +- ...convert_facet_value_to_missing_impl.carbon | 67 +- ...l_convert_type_erased_type_to_facet.carbon | 9 +- ...uction_uses_runtime_type_conversion.carbon | 47 +- .../testdata/facet/fail_namespace_type.carbon | 17 +- .../testdata/facet/named_constant.carbon | 63 +- .../testdata/facet/nested_facet_types.carbon | 206 ++- .../facet/nested_facet_types_from_eval.carbon | 139 +- .../facet/partially_identified.carbon | 28 +- .../check/testdata/facet/period_self.carbon | 246 ++- .../testdata/facet/require_import.carbon | 8 +- .../testdata/facet/require_invalid.carbon | 99 +- .../check/testdata/facet/runtime_value.carbon | 68 +- .../tuple_and_struct_type_literal.carbon | 54 +- .../facet/tuple_and_struct_type_value.carbon | 36 +- .../facet/validate_impl_constraints.carbon | 126 +- .../facet/validate_rewrite_constraints.carbon | 503 +++++- toolchain/check/testdata/for/basic.carbon | 8 +- toolchain/check/testdata/for/pattern.carbon | 10 +- .../function/builtin/adapted_type.carbon | 13 +- .../function/builtin/fail_redefined.carbon | 129 +- .../function/builtin/fail_unknown.carbon | 8 +- .../function/builtin/positional.carbon | 30 +- .../function/call/default_values.carbon | 36 +- .../function/call/eval_musteval.carbon | 26 +- .../function/call/fail_not_callable.carbon | 7 +- .../function/call/fail_param_count.carbon | 96 +- .../function/call/fail_param_type.carbon | 19 +- .../call/fail_return_type_mismatch.carbon | 24 +- .../call/fail_runtime_implicit_param.carbon | 7 +- .../check/testdata/function/call/form.carbon | 142 +- .../check/testdata/function/call/ref.carbon | 44 +- .../function/capture/uncaptured_locals.carbon | 12 +- .../declaration/default_values.carbon | 98 +- .../function/declaration/eval_musteval.carbon | 129 +- .../function/declaration/extern.carbon | 53 +- .../declaration/extern_library.carbon | 103 +- .../extern_library_for_default.carbon | 15 +- .../extern_library_from_default.carbon | 15 +- .../fail_import_incomplete_return.carbon | 116 +- .../declaration/fail_modifiers.carbon | 97 +- .../declaration/fail_param_in_type.carbon | 13 +- .../declaration/fail_param_redecl.carbon | 31 +- .../function/declaration/fail_redecl.carbon | 126 +- .../declaration/fail_todo_no_params.carbon | 49 +- .../declaration/implicit_import.carbon | 33 +- .../function/declaration/import.carbon | 452 +++-- .../declaration/name_poisoning.carbon | 133 +- .../no_definition_in_impl_file.carbon | 38 +- .../testdata/function/declaration/ref.carbon | 7 +- .../declaration/val_var_return.carbon | 13 +- .../deduced_return/fail_member.carbon | 44 +- .../deduced_return/fail_redecl.carbon | 135 +- .../deduced_return/fail_return.carbon | 89 +- .../function/deduced_return/form.carbon | 61 +- .../function/deduced_return/generic.carbon | 26 +- .../deduced_return/generic_form.carbon | 42 +- .../deduced_return/returned_var.carbon | 30 +- .../function/deduced_return/template.carbon | 32 +- .../deduced_return/use_before_deduced.carbon | 27 +- .../function/definition/basics.carbon | 12 +- .../function/definition/default_values.carbon | 41 +- .../function/definition/extern.carbon | 75 +- .../function/definition/extern_library.carbon | 49 +- .../fail_decl_param_mismatch.carbon | 216 ++- .../definition/fail_local_decl.carbon | 35 +- .../function/definition/fail_redef.carbon | 17 +- .../definition/implicit_import.carbon | 69 +- .../function/definition/import.carbon | 87 +- .../function/definition/import_access.carbon | 75 +- .../definition/syntactic_merge.carbon | 190 ++- .../testdata/function/definition/terse.carbon | 178 +- .../testdata/function/generic/deduce.carbon | 101 +- .../fail_deduce_imported_function.carbon | 39 +- .../generic/fail_type_param_mismatch.carbon | 12 +- .../function/generic/redeclare.carbon | 321 ++-- .../function/generic/resolve_used.carbon | 19 +- .../function/generic/undefined.carbon | 13 +- .../testdata/generic/complete_type.carbon | 62 +- .../generic/dot_self_symbolic_type.carbon | 30 +- .../generic/extend_type_completion.carbon | 53 +- .../testdata/generic/fail_generic_copy.carbon | 19 +- .../identify_specific_facet_type.carbon | 89 +- .../check/testdata/generic/import.carbon | 14 +- toolchain/check/testdata/generic/local.carbon | 27 +- .../testdata/generic/template/argument.carbon | 26 +- .../testdata/generic/template/call.carbon | 26 +- .../testdata/generic/template/convert.carbon | 49 +- .../generic/template/member_access.carbon | 28 +- .../template/member_out_of_line.carbon | 332 ++-- .../generic/template/unimplemented.carbon | 66 +- toolchain/check/testdata/if/basics.carbon | 27 +- .../if_expr/fail_not_in_function.carbon | 63 +- .../if_expr/fail_partial_constant.carbon | 95 +- toolchain/check/testdata/impl/access.carbon | 48 +- .../testdata/impl/assoc_const_self.carbon | 123 +- toolchain/check/testdata/impl/basic.carbon | 66 +- toolchain/check/testdata/impl/compound.carbon | 42 +- .../impl/custom_witness/destroy.carbon | 7 +- ...odo_require_impls_for_impl_in_class.carbon | 8 +- .../impl/custom_witness/float_fits_in.carbon | 30 +- .../impl/custom_witness/int_fits_in.carbon | 105 +- .../check/testdata/impl/error_recovery.carbon | 126 +- .../check/testdata/impl/eval_musteval.carbon | 79 +- .../check/testdata/impl/extend_final.carbon | 16 +- .../check/testdata/impl/extend_impl.carbon | 31 +- .../check/testdata/impl/fail_alias.carbon | 13 +- .../testdata/impl/fail_call_invalid.carbon | 30 +- .../impl/fail_extend_impl_forall.carbon | 70 +- .../impl/fail_extend_impl_scope.carbon | 67 +- .../impl/fail_extend_impl_type_as.carbon | 39 +- .../impl/fail_extend_non_interface.carbon | 6 +- ..._extend_partially_defined_interface.carbon | 23 +- .../fail_extend_undefined_interface.carbon | 22 +- .../testdata/impl/fail_impl_as_scope.carbon | 110 +- .../impl/fail_impl_bad_assoc_const.carbon | 21 +- .../impl/fail_impl_bad_assoc_fn.carbon | 701 ++++---- .../impl/fail_impl_bad_interface.carbon | 80 +- .../testdata/impl/fail_impl_bad_type.carbon | 15 +- .../testdata/impl/fail_redefinition.carbon | 13 +- .../impl/fail_self_type_mismatch.carbon | 42 +- .../check/testdata/impl/forward_decls.carbon | 180 +- .../impl/generic_redeclaration.carbon | 155 +- .../impl/impl_as_named_constraint.carbon | 96 +- .../testdata/impl/impl_assoc_const.carbon | 464 ++++-- .../impl/impl_assoc_const_with_prelude.carbon | 137 +- .../check/testdata/impl/impl_forall.carbon | 26 +- .../check/testdata/impl/impl_self_as.carbon | 104 +- .../check/testdata/impl/impl_thunk.carbon | 186 ++- .../impl/impl_thunk_min_prelude.carbon | 10 +- .../testdata/impl/impl_where_redecl.carbon | 46 +- .../testdata/impl/import_compound.carbon | 42 +- .../check/testdata/impl/import_generic.carbon | 692 ++++---- .../impl/import_impl_with_no_interface.carbon | 6 +- .../impl/import_interface_assoc_const.carbon | 478 +++--- .../testdata/impl/import_use_generic.carbon | 42 +- .../check/testdata/impl/incomplete.carbon | 233 ++- .../check/testdata/impl/interface_args.carbon | 45 +- .../check/testdata/impl/lookup/access.carbon | 8 +- .../lookup/fail_alias_impl_not_found.carbon | 22 +- .../impl/lookup/fail_function_types.carbon | 35 +- .../lookup/fail_poison_custom_witness.carbon | 16 +- .../lookup/fail_todo_undefined_impl.carbon | 22 +- .../check/testdata/impl/lookup/generic.carbon | 107 +- .../testdata/impl/lookup/impl_cycle.carbon | 189 ++- .../testdata/impl/lookup/impl_overlap.carbon | 183 +- .../lookup/impl_overlap_wrapped_types.carbon | 45 +- .../check/testdata/impl/lookup/import.carbon | 11 +- .../testdata/impl/lookup/import_error.carbon | 20 +- .../impl/lookup/specialization.carbon | 24 +- .../impl/lookup/specialization_poison.carbon | 110 +- ...pecialization_with_symbolic_rewrite.carbon | 52 +- .../impl/lookup/unused_generic_binding.carbon | 28 +- .../testdata/impl/multiple_extend.carbon | 40 +- .../check/testdata/impl/name_poisoning.carbon | 19 +- .../impl/no_definition_in_impl_file.carbon | 112 +- toolchain/check/testdata/impl/orphan.carbon | 74 +- .../check/testdata/impl/redeclaration.carbon | 195 ++- .../check/testdata/impl/reenter_scopes.carbon | 96 +- .../require_satisified_in_interface.carbon | 64 +- ...uire_satisified_in_named_constraint.carbon | 36 +- toolchain/check/testdata/impl/rewrites.carbon | 32 +- .../testdata/impl/use_assoc_entity.carbon | 115 +- .../impl/using_invalid_interface.carbon | 103 +- .../index/fail_array_large_index.carbon | 84 +- .../index/fail_array_non_int_indexing.carbon | 30 +- .../fail_array_out_of_bound_access.carbon | 38 +- .../testdata/index/fail_expr_category.carbon | 292 ++-- .../testdata/index/fail_invalid_base.carbon | 63 +- .../testdata/index/fail_name_not_found.carbon | 18 +- .../index/fail_negative_indexing.carbon | 46 +- .../index/fail_non_tuple_access.carbon | 9 +- .../interface/compound_member_access.carbon | 252 +-- .../fail_add_member_outside_definition.carbon | 52 +- .../interface/fail_assoc_const_alias.carbon | 16 +- .../fail_assoc_const_bad_default.carbon | 14 +- .../fail_assoc_fn_invalid_use.carbon | 21 +- .../interface/fail_definition_imported.carbon | 12 +- .../testdata/interface/fail_duplicate.carbon | 140 +- .../fail_generic_redeclaration.carbon | 176 +- ...bobject_destroy_method_declarations.carbon | 96 +- .../interface/fail_lookup_in_type_type.carbon | 40 +- .../interface/fail_lookup_undefined.carbon | 45 +- .../interface/fail_member_lookup.carbon | 58 +- .../testdata/interface/fail_modifiers.carbon | 102 +- .../interface/fail_redeclare_member.carbon | 13 +- .../fail_todo_assoc_const_default.carbon | 30 +- .../interface/fail_type_as_facet.carbon | 12 +- .../check/testdata/interface/generic.carbon | 35 +- .../interface/generic_vs_params.carbon | 54 +- .../testdata/interface/import_access.carbon | 64 +- .../interface/import_interface_decl.carbon | 10 +- .../testdata/interface/incomplete.carbon | 103 +- .../testdata/interface/member_lookup.carbon | 54 +- .../check/testdata/interface/modifiers.carbon | 54 +- .../testdata/interface/name_poisoning.carbon | 140 +- .../no_definition_in_impl_file.carbon | 38 +- .../check/testdata/interface/observe.carbon | 236 ++- .../check/testdata/interface/require.carbon | 160 +- .../require_invalid_modifiers.carbon | 83 +- .../testdata/interface/syntactic_merge.carbon | 435 +++-- .../interop/cpp/basics/cpp_diagnostics.carbon | 370 +++-- .../cpp/basics/fail_import_fix_its.carbon | 80 +- .../cpp/basics/import/bad_import.carbon | 80 +- .../cpp/basics/import/bad_import_empty.carbon | 6 +- .../import/bad_import_nested_quotes.carbon | 25 +- .../basics/import/bad_import_not_found.carbon | 6 +- .../cpp/basics/import/cpp_namespace.carbon | 30 +- .../cpp/basics/import/fail_fuzzing.carbon | 6 +- .../interop/cpp/basics/import/import.carbon | 15 +- .../interop/cpp/basics/import/indirect.carbon | 16 +- .../interop/cpp/basics/inline/decl.carbon | 72 +- .../interop/cpp/basics/inline/modules.carbon | 111 +- .../interop/cpp/basics/share_ast.carbon | 30 +- .../cpp/basics/unsupported_decl_type.carbon | 17 +- .../interop/cpp/basics/unused_internal.carbon | 12 +- .../interop/cpp/class/export/access.carbon | 62 +- .../interop/cpp/class/export/base.carbon | 130 +- .../interop/cpp/class/export/class.carbon | 43 +- .../interop/cpp/class/export/field.carbon | 68 +- .../interop/cpp/class/export/generic.carbon | 35 +- .../interop/cpp/class/export/method.carbon | 28 +- .../interop/cpp/class/export/override.carbon | 8 +- .../interop/cpp/class/export/static.carbon | 14 +- .../interop/cpp/class/import/abstract.carbon | 15 +- .../interop/cpp/class/import/access.carbon | 1317 ++++++++++++--- .../interop/cpp/class/import/base.carbon | 240 ++- .../interop/cpp/class/import/class.carbon | 41 +- .../cpp/class/import/constructor.carbon | 59 +- .../interop/cpp/class/import/field.carbon | 56 +- .../interop/cpp/class/import/invalid.carbon | 6 +- .../interop/cpp/class/import/method.carbon | 123 +- .../class/import/non_aggregate_init.carbon | 10 +- .../interop/cpp/class/import/override.carbon | 128 +- .../interop/cpp/class/import/template.carbon | 45 +- .../interop/cpp/class/import/union.carbon | 16 +- .../testdata/interop/cpp/const/access.carbon | 24 +- .../testdata/interop/cpp/enum/convert.carbon | 52 +- .../check/testdata/interop/cpp/enum/eq.carbon | 14 +- .../interop/cpp/enum/incomplete.carbon | 40 +- .../testdata/interop/cpp/enum/invalid.carbon | 7 +- .../testdata/interop/cpp/enum/scoped.carbon | 7 +- .../testdata/interop/cpp/enum/unscoped.carbon | 31 +- .../testdata/interop/cpp/enum/using.carbon | 64 +- .../interop/cpp/function/export/array.carbon | 71 +- .../cpp/function/export/constructor.carbon | 160 +- .../cpp/function/export/function.carbon | 13 +- .../cpp/function/export/generic.carbon | 56 +- .../import/arithmetic_types_bridged.carbon | 95 +- .../import/arithmetic_types_direct.carbon | 54 +- .../interop/cpp/function/import/class.carbon | 267 ++- .../cpp/function/import/constexpr.carbon | 111 +- .../cpp/function/import/decayed_param.carbon | 608 +++---- .../cpp/function/import/default_arg.carbon | 187 ++- .../cpp/function/import/function.carbon | 53 +- .../cpp/function/import/function_ptr.carbon | 62 +- .../interop/cpp/function/import/inline.carbon | 27 +- .../cpp/function/import/method_ptr.carbon | 106 +- .../import/multiple_too_few_args_calls.carbon | 32 +- .../cpp/function/import/overloads.carbon | 566 ++++++- .../function/import/param_unsupported.carbon | 35 +- .../cpp/function/import/pointer.carbon | 33 +- .../cpp/function/import/reference.carbon | 402 +++-- .../interop/cpp/function/import/return.carbon | 7 +- .../interop/cpp/function/import/struct.carbon | 178 +- .../cpp/function/import/template.carbon | 18 +- .../interop/cpp/function/import/union.carbon | 149 +- .../testdata/interop/cpp/impls/as.carbon | 49 +- .../testdata/interop/cpp/impls/copy.carbon | 90 +- .../cpp/impls/cpp_range_for_iterate.carbon | 246 ++- .../testdata/interop/cpp/impls/destroy.carbon | 281 +++- .../interop/cpp/impls/implicit_as.carbon | 501 ++++-- .../interop/cpp/macros/invalid.carbon | 23 +- .../testdata/interop/cpp/macros/macros.carbon | 324 +++- .../interop/cpp/namespace/export.carbon | 14 +- .../interop/cpp/namespace/import.carbon | 98 +- .../cpp/namespace/lookup_after_failure.carbon | 97 +- .../interop/cpp/namespace/roundtrip.carbon | 21 +- .../cpp/operators/builtin_candidates.carbon | 323 +++- .../interop/cpp/operators/deref.carbon | 24 +- .../interop/cpp/operators/eq_with.carbon | 265 ++- .../interop/cpp/operators/operators.carbon | 457 ++++- .../interop/cpp/operators/ordered_with.carbon | 263 ++- .../interop/cpp/operators/spaceship.carbon | 105 +- .../cpp/primitive_types/arithmetic.carbon | 41 +- .../interop/cpp/primitive_types/array.carbon | 19 +- ...fail_todo_arithmetic_types_unmapped.carbon | 8 +- .../long_and_long_long.darwin.carbon | 86 +- .../long_and_long_long.llp64.carbon | 150 +- .../long_and_long_long.lp64.carbon | 114 +- .../interop/cpp/primitive_types/void.carbon | 44 +- .../cpp/primitive_types/void_pointer.carbon | 52 +- .../testdata/interop/cpp/range_for.carbon | 1465 ++++++++++------- .../cpp/template/argument_count.carbon | 64 +- ..._todo_bidirectional_intorp_too_deep.carbon | 8 +- .../cpp/template/non_type_param.carbon | 36 +- .../template/template_template_param.carbon | 49 +- .../interop/cpp/template/type_param.carbon | 20 +- .../interop/cpp/var/export/var.carbon | 14 +- .../interop/cpp/var/import/global.carbon | 35 +- toolchain/check/testdata/lambda/lambda.carbon | 237 ++- .../testdata/let/compile_time_bindings.carbon | 273 ++- toolchain/check/testdata/let/convert.carbon | 18 +- .../testdata/let/fail_duplicate_decl.carbon | 32 +- .../check/testdata/let/fail_generic.carbon | 9 +- .../testdata/let/fail_generic_import.carbon | 19 +- .../testdata/let/fail_missing_value.carbon | 17 +- .../check/testdata/let/fail_modifiers.carbon | 250 +-- .../testdata/let/fail_use_in_init.carbon | 16 +- toolchain/check/testdata/let/form.carbon | 18 +- toolchain/check/testdata/let/generic.carbon | 18 +- .../check/testdata/let/generic_import.carbon | 33 +- .../check/testdata/let/import_access.carbon | 25 +- toolchain/check/testdata/let/local.carbon | 9 +- toolchain/check/testdata/let/ref.carbon | 16 +- .../main_run/fail_mismatch_params.carbon | 24 +- .../main_run/fail_mismatch_return.carbon | 8 +- .../main_run/fail_mismatch_return_auto.carbon | 8 +- .../check/testdata/match_first/basic.carbon | 180 +- .../match_first/prioritization.carbon | 56 +- .../testdata/named_constraint/basic.carbon | 24 +- .../extend_name_lookup.carbon | 19 +- .../testdata/named_constraint/generic.carbon | 54 +- .../import_constraint_decl.carbon | 16 +- .../named_constraint/incomplete.carbon | 66 +- .../named_constraint/invalid_members.carbon | 26 +- .../testdata/named_constraint/require.carbon | 250 ++- .../require_invalid_modifiers.carbon | 83 +- .../fail_conflict_after_merge.carbon | 40 +- ...l_conflict_imported_namespace_first.carbon | 13 +- ..._conflict_imported_namespace_nested.carbon | 25 +- ..._conflict_imported_namespace_second.carbon | 29 +- ...conflict_in_imports_namespace_first.carbon | 17 +- ...onflict_in_imports_namespace_second.carbon | 17 +- .../namespace/fail_decl_in_alias.carbon | 26 +- .../testdata/namespace/fail_duplicate.carbon | 17 +- .../testdata/namespace/fail_modifiers.carbon | 68 +- .../namespace/fail_not_top_level.carbon | 49 +- .../testdata/namespace/fail_params.carbon | 111 +- .../namespace/fail_unresolved_scope.carbon | 6 +- .../namespace/imported_indirect.carbon | 46 +- .../testdata/namespace/name_poisoning.carbon | 127 +- .../testdata/operators/builtin/bit_and.carbon | 36 +- .../fail_and_or_not_in_function.carbon | 71 +- .../fail_and_or_partial_constant.carbon | 192 ++- .../builtin/fail_assignment_to_error.carbon | 20 +- .../fail_assignment_to_non_assignable.carbon | 384 +++-- .../fail_redundant_compound_access.carbon | 42 +- .../builtin/fail_type_mismatch.carbon | 30 +- .../fail_type_mismatch_assignment.carbon | 14 +- .../builtin/fail_type_mismatch_once.carbon | 11 +- .../builtin/fail_unimplemented_op.carbon | 11 +- .../testdata/operators/builtin/ref.carbon | 23 +- .../testdata/operators/overloaded/eq.carbon | 32 +- .../overloaded/fail_assign_non_ref.carbon | 27 +- .../overloaded/fail_error_recovery.carbon | 12 +- .../operators/overloaded/fail_no_impl.carbon | 72 +- .../overloaded/fail_no_impl_for_arg.carbon | 16 +- .../operators/overloaded/index.carbon | 49 +- .../overloaded/index_with_prelude.carbon | 18 +- .../overloaded/indirect_index_with.carbon | 8 +- .../operators/overloaded/ordered.carbon | 32 +- .../overloaded/string_indexing.carbon | 44 +- .../testdata/package_expr/not_found.carbon | 14 +- .../packages/core_name_poisoning.carbon | 22 +- .../packages/cross_package_export.carbon | 72 +- .../packages/cross_package_import.carbon | 126 +- .../testdata/packages/export_import.carbon | 31 +- .../testdata/packages/export_mixed.carbon | 10 +- .../testdata/packages/export_name.carbon | 69 +- .../packages/fail_api_not_found.carbon | 20 +- .../fail_conflict_no_namespaces.carbon | 23 +- .../check/testdata/packages/fail_cycle.carbon | 35 +- .../packages/fail_duplicate_api.carbon | 21 +- .../packages/fail_export_name_member.carbon | 14 +- .../packages/fail_export_name_params.carbon | 11 +- .../testdata/packages/fail_extension.carbon | 61 +- .../packages/fail_import_default.carbon | 28 +- .../fail_import_inline_not_cpp.carbon | 7 +- .../packages/fail_import_invalid.carbon | 61 +- .../packages/fail_import_repeat.carbon | 44 +- .../packages/fail_import_type_error.carbon | 38 +- .../testdata/packages/fail_modifiers.carbon | 116 +- .../fail_name_with_import_failure.carbon | 13 +- .../packages/implicit_imports_entities.carbon | 34 +- .../testdata/packages/missing_prelude.carbon | 225 ++- .../check/testdata/packages/raw_core.carbon | 14 +- .../packages/restricted_package_names.carbon | 49 +- .../check/testdata/patterns/expression.carbon | 81 +- .../check/testdata/patterns/struct.carbon | 156 +- .../check/testdata/patterns/underscore.carbon | 50 +- .../check/testdata/patterns/unused.carbon | 216 ++- .../patterns/unused_underscore.carbon | 14 +- .../pointer/convert_qualifiers.carbon | 78 +- .../pointer/fail_address_of_error.carbon | 28 +- .../pointer/fail_address_of_value.carbon | 86 +- .../testdata/pointer/fail_deref_error.carbon | 24 +- .../pointer/fail_deref_function.carbon | 22 +- .../pointer/fail_deref_namespace.carbon | 20 +- .../pointer/fail_deref_not_pointer.carbon | 88 +- .../testdata/pointer/fail_deref_type.carbon | 25 +- .../pointer/fail_type_mismatch.carbon | 14 +- .../primitives/float_conversions.carbon | 61 +- .../primitives/int_conversions.carbon | 264 ++- .../primitives/numeric_literals.carbon | 68 +- .../primitives/string_literals.carbon | 32 +- .../testdata/primitives/type_literals.carbon | 309 +++- .../testdata/return/fail_call_in_type.carbon | 11 +- .../testdata/return/fail_error_in_type.carbon | 6 +- .../testdata/return/fail_let_in_type.carbon | 58 +- .../return/fail_missing_return.carbon | 7 +- .../fail_missing_return_empty_tuple.carbon | 7 +- .../testdata/return/fail_ref_return.carbon | 7 +- .../fail_return_var_no_returned_var.carbon | 7 +- .../fail_return_with_returned_var.carbon | 84 +- .../return/fail_returned_var_form.carbon | 13 +- .../fail_returned_var_no_return_type.carbon | 83 +- .../return/fail_returned_var_shadow.carbon | 168 +- .../return/fail_returned_var_type.carbon | 39 +- .../testdata/return/fail_type_mismatch.carbon | 14 +- .../return/fail_value_disallowed.carbon | 12 +- .../testdata/return/fail_value_missing.carbon | 11 +- .../testdata/return/fail_var_in_type.carbon | 9 +- .../struct/fail_access_into_invalid.carbon | 6 +- .../testdata/struct/fail_assign_empty.carbon | 12 +- .../testdata/struct/fail_assign_nested.carbon | 17 +- .../struct/fail_assign_to_empty.carbon | 15 +- .../struct/fail_duplicate_name.carbon | 91 +- .../struct/fail_field_name_mismatch.carbon | 62 +- .../struct/fail_field_type_mismatch.carbon | 11 +- .../testdata/struct/fail_keyword_name.carbon | 24 +- .../struct/fail_member_access_type.carbon | 7 +- .../struct/fail_member_of_function.carbon | 7 +- .../struct/fail_nested_incomplete.carbon | 23 +- .../struct/fail_non_member_access.carbon | 9 +- .../struct/fail_too_few_values.carbon | 28 +- .../testdata/struct/fail_type_assign.carbon | 14 +- .../testdata/struct/fail_value_as_type.carbon | 16 +- toolchain/check/testdata/struct/import.carbon | 26 +- .../check/testdata/tuple/class_tuples.carbon | 48 +- .../testdata/tuple/element_access.carbon | 95 +- toolchain/check/testdata/tuple/import.carbon | 27 +- .../check/testdata/tuple/size_mismatch.carbon | 32 +- .../check/testdata/tuple/tuple_pattern.carbon | 21 +- toolchain/check/testdata/typeof/basics.carbon | 28 +- .../testdata/var/fail_duplicate_decl.carbon | 48 +- .../check/testdata/var/fail_generic.carbon | 15 +- .../var/fail_init_type_mismatch.carbon | 20 +- .../testdata/var/fail_init_with_self.carbon | 34 +- .../var/fail_lookup_outside_scope.carbon | 6 +- .../check/testdata/var/fail_modifiers.carbon | 38 +- .../var/fail_namespace_conflict.carbon | 24 +- .../testdata/var/fail_not_copyable.carbon | 10 +- .../var/fail_storage_is_literal.carbon | 18 +- .../var/fail_todo_control_flow_init.carbon | 90 +- .../check/testdata/var/import_access.carbon | 25 +- .../check/testdata/var/initialization.carbon | 8 +- .../check/testdata/var/var_pattern.carbon | 44 +- .../testdata/variadics/pack_expansion.carbon | 12 +- .../testdata/where_expr/constraints.carbon | 147 +- .../testdata/where_expr/designator.carbon | 210 ++- .../testdata/where_expr/dot_self_impls.carbon | 93 +- .../testdata/where_expr/equal_rewrite.carbon | 119 +- .../testdata/where_expr/fail_not_facet.carbon | 20 +- toolchain/check/testdata/while/while.carbon | 34 +- toolchain/diagnostics/renderer.cpp | 49 +- toolchain/diagnostics/renderer.h | 26 +- toolchain/diagnostics/renderer_fuzzer.cpp | 13 +- toolchain/diagnostics/renderer_test.cpp | 128 +- toolchain/diagnostics/stream_consumer.h | 3 + .../testdata/fail_rendering.carbon | 7 +- toolchain/docs/diagnostics_rendering.md | 27 +- toolchain/driver/driver.cpp | 31 +- .../testdata/fail_errors_in_two_files.carbon | 18 +- .../driver/testdata/fail_errors_sorted.carbon | 18 +- .../testdata/fail_errors_streamed.carbon | 18 +- .../driver/testdata/fail_flush_errors.carbon | 26 +- .../basics/fail_invalid_comment.carbon | 7 +- toolchain/lex/testdata/char_literals.carbon | 114 +- .../lex/testdata/dollar_int_literals.carbon | 82 +- .../lex/testdata/dump_sem_ir_range.carbon | 43 +- .../fail_bad_comment_introducers.carbon | 38 +- ...introducers_mid_block_indent_change.carbon | 21 +- .../testdata/fail_bad_raw_identifier.carbon | 56 +- .../fail_block_string_second_line.carbon | 20 +- .../fail_char_literals_bad_encoding.carbon | 84 +- .../testdata/fail_malformed_escapes.carbon | 32 +- .../testdata/fail_mismatched_brackets.carbon | 218 ++- ...ismatched_brackets_at_start_of_file.carbon | 23 +- ...ail_mismatched_brackets_close_brace.carbon | 48 +- .../fail_mismatched_brackets_line_end.carbon | 12 +- toolchain/lex/testdata/fail_multifile.carbon | 12 +- .../fail_multiline_string_introducer.carbon | 18 +- .../testdata/multiline_string_literals.carbon | 19 +- .../lex/testdata/numeric_literals.carbon | 53 +- toolchain/lex/testdata/string_literals.carbon | 66 +- .../basics/fail_before_lowering.carbon | 13 +- .../parse/testdata/alias/fail_syntax.carbon | 74 +- .../parse/testdata/array/fail_syntax.carbon | 134 +- .../basics/fail_bracket_recovery.carbon | 40 +- .../basics/fail_invalid_designators.carbon | 15 +- .../fail_missing_token_locations.carbon | 26 +- .../basics/fail_modifiers_before_semi.carbon | 7 +- .../basics/fail_no_intro_with_semi.carbon | 6 +- .../basics/fail_no_intro_without_semi.carbon | 6 +- .../basics/fail_paren_match_regression.carbon | 19 +- .../testdata/basics/form_literals.carbon | 75 +- .../basics/multiline_string_recovery.carbon | 7 +- .../testdata/basics/multiline_token.carbon | 6 +- ...il_alternative_with_implicit_params.carbon | 6 +- ...fail_invalid_alternative_identifier.carbon | 13 +- .../choice/fail_invalid_braces.carbon | 13 +- .../fail_keyword_alternative_name.carbon | 8 +- .../choice/fail_missing_definition.carbon | 7 +- ...il_missing_definition_parameterized.carbon | 7 +- .../fail_qualified_alternative_name.carbon | 6 +- toolchain/parse/testdata/class/adapt.carbon | 24 +- .../parse/testdata/class/fail_base.carbon | 32 +- .../testdata/class/fail_modifiers.carbon | 21 +- .../parse/testdata/class/fail_var_name.carbon | 50 +- toolchain/parse/testdata/class/friend.carbon | 43 +- .../parse/testdata/dump_format/pretty.carbon | 7 +- .../dump_format/yaml_postorder.carbon | 7 +- .../testdata/dump_format/yaml_preorder.carbon | 7 +- .../for/fail_colon_instead_of_in.carbon | 7 +- .../testdata/for/fail_missing_cond.carbon | 30 +- .../parse/testdata/for/fail_missing_in.carbon | 6 +- .../testdata/for/fail_returned_var.carbon | 6 +- .../testdata/for/fail_square_brackets.carbon | 30 +- .../testdata/function/declaration.carbon | 107 +- .../parse/testdata/function/definition.carbon | 27 +- .../parse/testdata/function/extern.carbon | 23 +- .../function/fail_template_form_param.carbon | 7 +- .../fail_template_no_param.carbon | 22 +- .../generics/generic_params/self.carbon | 14 +- .../generics/generic_params/template.carbon | 20 +- .../testdata/generics/impl/fail_impl.carbon | 101 +- .../impl/fail_out_of_line_member.carbon | 12 +- .../testdata/generics/impl/match_first.carbon | 14 +- .../fail_associated_constants.carbon | 64 +- .../interface/fail_missing_name.carbon | 7 +- .../interface/fail_missing_open_curly.carbon | 16 +- .../interface/fail_self_param_syntax.carbon | 6 +- .../generics/interface/require.carbon | 20 +- .../named_constraint/fail_incomplete.carbon | 14 +- .../template_constraint.carbon | 12 +- .../fail_redundant_phase_keyword.carbon | 39 +- .../fail_unused_after_phase_keyword.carbon | 21 +- .../testdata/if/fail_else_unbraced.carbon | 24 +- .../parse/testdata/if/fail_errors.carbon | 32 +- .../testdata/if/fail_missing_cond.carbon | 6 +- .../testdata/if/fail_square_brackets.carbon | 24 +- .../parse/testdata/if/fail_unbraced.carbon | 18 +- .../if_expr/fail_condition_missing.carbon | 6 +- .../if_expr/fail_else_expr_missing.carbon | 6 +- .../testdata/if_expr/fail_else_missing.carbon | 7 +- .../if_expr/fail_then_expr_missing.carbon | 6 +- .../testdata/if_expr/fail_then_missing.carbon | 7 +- .../testdata/if_expr/fail_top_level_if.carbon | 18 +- .../testdata/index/fail_empty_expr.carbon | 6 +- .../testdata/index/fail_malformed_expr.carbon | 8 +- toolchain/parse/testdata/lambda/lambda.carbon | 53 +- .../let/expression_pattern_precedence.carbon | 19 +- .../parse/testdata/let/fail_bad_name.carbon | 6 +- .../parse/testdata/let/fail_empty.carbon | 6 +- .../testdata/let/fail_generic_ref.carbon | 7 +- .../fail_let_struct_identifier_only.carbon | 7 +- .../testdata/let/fail_missing_name.carbon | 12 +- .../parse/testdata/let/fail_no_semi.carbon | 12 +- .../match/fail_cases_after_default.carbon | 21 +- .../match/fail_missing_case_arrow.carbon | 14 +- .../match/fail_missing_case_pattern.carbon | 6 +- .../fail_missing_case_statements_block.carbon | 6 +- .../testdata/match/fail_missing_cases.carbon | 6 +- .../match/fail_missing_cases_block.carbon | 7 +- .../match/fail_missing_default_arrow.carbon | 7 +- ...il_missing_default_statements_block.carbon | 6 +- .../fail_missing_guard_close_paren.carbon | 18 +- .../fail_missing_guard_open_paren.carbon | 11 +- ...sing_guard_parens_only_parse_errors.carbon | 14 +- .../match/fail_missing_matched_expr.carbon | 6 +- ...il_unexpected_tokens_in_cases_block.carbon | 42 +- .../member_access/fail_keyword.carbon | 48 +- .../testdata/namespace/fail_arrow.carbon | 8 +- .../testdata/namespace/fail_incomplete.carbon | 42 +- .../namespace/fail_incomplete_name.carbon | 7 +- .../testdata/namespace/fail_modifiers.carbon | 7 +- .../testdata/namespace/fail_no_name.carbon | 7 +- .../observe/fail_invalid_operator.carbon | 7 +- .../testdata/observe/fail_missing_expr.carbon | 19 +- .../operators/fail_chained_assign.carbon | 7 +- .../fail_infix_uneven_space_after.carbon | 7 +- .../fail_infix_uneven_space_before.carbon | 7 +- .../operators/fail_invalid_infix.carbon | 24 +- .../operators/fail_postfix_space.carbon | 8 +- .../fail_postfix_space_before_comma.carbon | 8 +- .../fail_postfix_space_in_call.carbon | 8 +- .../fail_postfix_space_surrounding.carbon | 8 +- .../operators/fail_postincrement.carbon | 12 +- .../operators/fail_precedence_and_or.carbon | 8 +- .../operators/fail_precedence_as.carbon | 54 +- .../operators/fail_precedence_assign.carbon | 34 +- .../operators/fail_precedence_or_and.carbon | 8 +- .../operators/fail_precedence_where.carbon | 66 +- .../operators/fail_prefix_repeat.carbon | 8 +- .../operators/fail_prefix_space.carbon | 7 +- ...ail_prefix_uneven_space_with_assign.carbon | 7 +- .../testdata/operators/fail_star_minus.carbon | 7 +- .../testdata/operators/fail_star_star.carbon | 7 +- .../operators/fail_star_star_no_space.carbon | 7 +- .../testdata/operators/fail_variety.carbon | 42 +- .../parse/testdata/operators/modifier.carbon | 41 +- toolchain/parse/testdata/operators/ref.carbon | 8 +- .../parse/testdata/operators/unary.carbon | 7 +- .../testdata/package_expr/fail_in_name.carbon | 38 +- .../package_expr/fail_standalone.carbon | 7 +- .../parse/testdata/packages/export.carbon | 75 +- .../packages/import/cpp_inline.carbon | 81 +- .../testdata/packages/import/export.carbon | 32 +- .../packages/import/fail_after_decl.carbon | 13 +- .../import/fail_after_decl_repeated.carbon | 38 +- .../packages/import/fail_extra_string.carbon | 7 +- .../import/fail_in_nested_scope.carbon | 26 +- .../import/fail_inline_cpp_no_semi.carbon | 6 +- .../import/fail_library_is_identifier.carbon | 8 +- .../import/fail_name_is_keyword.carbon | 8 +- .../packages/import/fail_no_name.carbon | 7 +- .../packages/import/fail_no_semi.carbon | 7 +- .../import/fail_omit_library_keyword.carbon | 6 +- .../testdata/packages/import/fail_type.carbon | 7 +- .../library/fail_in_nested_scope.carbon | 48 +- .../packages/library/fail_invalid_name.carbon | 46 +- .../packages/library/fail_semi_before.carbon | 12 +- .../packages/library/fail_too_late.carbon | 12 +- .../packages/package/fail_after_decl.carbon | 12 +- .../packages/package/fail_after_import.carbon | 12 +- .../package/fail_after_package.carbon | 12 +- .../packages/package/fail_extra_string.carbon | 7 +- .../package/fail_in_nested_scope.carbon | 43 +- .../package/fail_library_is_identifier.carbon | 8 +- .../package/fail_library_skips_name.carbon | 7 +- .../package/fail_name_is_keyword.carbon | 8 +- .../packages/package/fail_no_name.carbon | 7 +- .../packages/package/fail_no_semi.carbon | 7 +- .../package/fail_omit_library_keyword.carbon | 6 +- .../packages/package/fail_semi_before.carbon | 12 +- .../package/fail_trailing_impl.carbon | 7 +- .../pointer/fail_pointer_type_in_expr.carbon | 8 +- ...e_instead_of_compound_member_access.carbon | 48 +- .../testdata/return/fail_expr_no_semi.carbon | 7 +- .../parse/testdata/return/fail_no_semi.carbon | 13 +- .../return/fail_returned_no_var.carbon | 6 +- .../testdata/return/fail_var_no_semi.carbon | 7 +- .../testdata/struct/fail_comma_only.carbon | 7 +- .../struct/fail_comma_repeat_in_type.carbon | 7 +- .../struct/fail_comma_repeat_in_value.carbon | 7 +- .../struct/fail_extra_token_in_type.carbon | 6 +- .../struct/fail_extra_token_in_value.carbon | 7 +- .../struct/fail_identifier_colon.carbon | 7 +- .../struct/fail_identifier_equals.carbon | 7 +- .../struct/fail_identifier_only.carbon | 7 +- .../fail_invalid_struct_designator.carbon | 7 +- .../testdata/struct/fail_missing_type.carbon | 6 +- .../testdata/struct/fail_missing_value.carbon | 6 +- .../struct/fail_mix_type_and_value.carbon | 7 +- .../struct/fail_mix_value_and_type.carbon | 7 +- .../struct/fail_mix_with_unknown.carbon | 28 +- .../struct/fail_no_colon_or_equals.carbon | 7 +- .../testdata/struct/fail_period_only.carbon | 7 +- .../testdata/struct/fail_period_paren.carbon | 7 +- .../struct/fail_period_string_colon.carbon | 7 +- .../struct/fail_period_string_equals.carbon | 7 +- .../struct/fail_type_no_designator.carbon | 7 +- .../testdata/struct/struct_pattern.carbon | 216 ++- toolchain/parse/testdata/typeof/basic.carbon | 69 +- .../parse/testdata/var/fail_bad_name.carbon | 22 +- .../parse/testdata/var/fail_empty.carbon | 6 +- .../testdata/var/fail_in_interface.carbon | 26 +- .../parse/testdata/var/fail_no_semi.carbon | 12 +- toolchain/parse/testdata/var/fail_ref.carbon | 6 +- .../parse/testdata/var/fail_runtime.carbon | 33 +- toolchain/parse/testdata/var/unused.carbon | 26 +- .../parse/testdata/var/var_pattern.carbon | 7 +- .../parse/testdata/variadics/expand.carbon | 15 +- .../variadics/pack_expansion_statement.carbon | 12 +- .../testdata/where_expr/designators.carbon | 43 +- .../testdata/where_expr/fail_rewrite.carbon | 67 +- .../testdata/where_expr/where_and.carbon | 21 +- .../testdata/while/fail_missing_cond.carbon | 6 +- .../parse/testdata/while/fail_no_semi.carbon | 14 +- .../parse/testdata/while/fail_unbraced.carbon | 6 +- toolchain/testing/file_test.cpp | 75 +- 888 files changed, 39731 insertions(+), 12799 deletions(-) diff --git a/toolchain/check/testdata/alias/basics.carbon b/toolchain/check/testdata/alias/basics.carbon index 88ec3cb73e18..09f904ed2e34 100644 --- a/toolchain/check/testdata/alias/basics.carbon +++ b/toolchain/check/testdata/alias/basics.carbon @@ -51,9 +51,23 @@ let v: a = {} as A({}); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_control_flow.carbon:[[@LINE+4]]:11-17: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_control_flow.carbon:[[@LINE+18]]:11 +// CHECK:STDERR: -> │ alias a = true or false; +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: semantics TODO: +// CHECK:STDERR: · ┃ `Control flow expressions are currently only supported inside functions.` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_control_flow.carbon:[[@LINE+2]]:11-23: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_control_flow.carbon:[[@LINE+9]]:11 +// CHECK:STDERR: -> │ alias a = true or false; +// CHECK:STDERR: · ━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: semantics TODO: +// CHECK:STDERR: · ┃ `Control flow expressions are currently only supported inside functions.` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: alias a = true or false; @@ -64,14 +78,30 @@ library "[[@TEST_NAME]]"; class C {} alias a = C; -// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE+3]]:5: error: duplicate name `a` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE-2]]:7: note: name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╭─┤ fail_name_conflict.carbon:[[@LINE+11]]:5 +// CHECK:STDERR: │ alias a = C; +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ var a: C = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `a` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var a: C = {}; var b: C = {}; -// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE+3]]:7: error: duplicate name `b` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE-2]]:5-8: note: name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╭─┤ fail_name_conflict.carbon:[[@LINE+11]]:7 +// CHECK:STDERR: │ var b: C = {}; +// CHECK:STDERR: · ──┬─ +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ alias b = C; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `b` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ╰──── // CHECK:STDERR: alias b = C; @@ -82,7 +112,12 @@ library "[[@TEST_NAME]]"; var a: () = (); var b: ()* = &a; -// CHECK:STDERR: fail_not_constant.carbon:[[@LINE+2]]:11-12: error: alias refers to a runtime value [AliasRequiresConstantValue] +// CHECK:STDERR: ╭─┤ fail_not_constant.carbon:[[@LINE+7]]:11 +// CHECK:STDERR: -> │ alias c = *b; +// CHECK:STDERR: · ━┳ +// CHECK:STDERR: · ┗━━┫ error: alias refers to a runtime value +// CHECK:STDERR: · ┃ [AliasRequiresConstantValue] +// CHECK:STDERR: ╰──── // CHECK:STDERR: alias c = *b; @@ -90,7 +125,12 @@ alias c = *b; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_params.carbon:[[@LINE+2]]:8-16: error: `alias` declaration cannot have parameters [UnexpectedDeclNameParams] +// CHECK:STDERR: ╭─┤ fail_params.carbon:[[@LINE+7]]:8 +// CHECK:STDERR: -> │ alias A(T: type) = T*; +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: `alias` declaration cannot have parameters +// CHECK:STDERR: · ┃ [UnexpectedDeclNameParams] +// CHECK:STDERR: ╰──── // CHECK:STDERR: alias A(T: type) = T*; @@ -100,24 +140,56 @@ library "[[@TEST_NAME]]"; class Class {} -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+11]]:10-13: error: `base` not allowed on declaration with `abstract` [ModifierNotAllowedWith] -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+10]]:1-8: note: `abstract` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+33]]:10 +// CHECK:STDERR: -> │ abstract base default final alias A = Class; +// CHECK:STDERR: · ────┬─── ━━┳━ +// CHECK:STDERR: · │ ┗━━┫ error: `base` not allowed on declaration with `abstract` +// CHECK:STDERR: · │ ┃ [ModifierNotAllowedWith] +// CHECK:STDERR: · ╰───────────┤ `abstract` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+8]]:15-21: error: `default` not allowed on declaration with `abstract` [ModifierNotAllowedWith] -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+7]]:1-8: note: `abstract` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+25]]:15 +// CHECK:STDERR: -> │ abstract base default final alias A = Class; +// CHECK:STDERR: · ────┬─── ━━┳━━━━ +// CHECK:STDERR: · │ ┗━━┫ error: `default` not allowed on declaration with `abstract` +// CHECK:STDERR: · │ ┃ [ModifierNotAllowedWith] +// CHECK:STDERR: · ╰────────────────┤ `abstract` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+5]]:23-27: error: `final` not allowed on declaration with `abstract` [ModifierNotAllowedWith] -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1-8: note: `abstract` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+17]]:23 +// CHECK:STDERR: -> │ abstract base default final alias A = Class; +// CHECK:STDERR: · ────┬─── ┳━━━━ +// CHECK:STDERR: · │ ┗━━┫ error: `final` not allowed on declaration with +// CHECK:STDERR: · │ ┃ `abstract` +// CHECK:STDERR: · │ ┃ [ModifierNotAllowedWith] +// CHECK:STDERR: · ╰──────────────────────┤ `abstract` previously appeared here +// CHECK:STDERR: · │ [ModifierPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-8: error: `abstract` not allowed on `alias` declaration [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ abstract base default final alias A = Class; +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: `abstract` not allowed on `alias` declaration +// CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╰──── // CHECK:STDERR: abstract base default final alias A = Class; -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-4: error: `impl` not allowed on `alias` declaration [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ impl alias B = Class; +// CHECK:STDERR: · ━━┳━ +// CHECK:STDERR: · ┗━━┫ error: `impl` not allowed on `alias` declaration +// CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl alias B = Class; -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-6: error: `extern` not allowed on `alias` declaration [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ extern alias C = Class; +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: `extern` not allowed on `alias` declaration +// CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╰──── // CHECK:STDERR: extern alias C = Class; diff --git a/toolchain/check/testdata/alias/export_name.carbon b/toolchain/check/testdata/alias/export_name.carbon index 69120d730c1f..c18741e48320 100644 --- a/toolchain/check/testdata/alias/export_name.carbon +++ b/toolchain/check/testdata/alias/export_name.carbon @@ -56,7 +56,11 @@ library "[[@TEST_NAME]]"; import library "export"; -// CHECK:STDERR: fail_orig_name_not_in_export.carbon:[[@LINE+2]]:8: error: name `C` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_orig_name_not_in_export.carbon:[[@LINE+6]]:8 +// CHECK:STDERR: -> │ var c: C = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: name `C` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var c: C = {}; @@ -275,7 +279,7 @@ var d: D* = &c; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc12: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] // CHECK:STDOUT: assign file.%c.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/alias/import_access.carbon b/toolchain/check/testdata/alias/import_access.carbon index aad5a1cb1e59..c8a37063def2 100644 --- a/toolchain/check/testdata/alias/import_access.carbon +++ b/toolchain/check/testdata/alias/import_access.carbon @@ -38,7 +38,11 @@ package Test library "[[@TEST_NAME]]"; import library "def"; -// CHECK:STDERR: fail_local_def.carbon:[[@LINE+2]]:11: error: name `A` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_local_def.carbon:[[@LINE+6]]:11 +// CHECK:STDERR: -> │ var inst: A = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: name `A` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var inst: A = {}; @@ -48,7 +52,12 @@ package Other library "[[@TEST_NAME]]"; import Test library "def"; -// CHECK:STDERR: fail_other_def.carbon:[[@LINE+2]]:11-16: error: member name `A` not found in `Test` [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╭─┤ fail_other_def.carbon:[[@LINE+7]]:11 +// CHECK:STDERR: -> │ var inst: Test.A = {}; +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: member name `A` not found in `Test` +// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var inst: Test.A = {}; @@ -163,7 +172,7 @@ var inst: Test.A = {}; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc12: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] // CHECK:STDOUT: assign file.%inst.var, // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -203,7 +212,7 @@ var inst: Test.A = {}; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc13: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] // CHECK:STDOUT: assign file.%inst.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/alias/in_namespace.carbon b/toolchain/check/testdata/alias/in_namespace.carbon index c04a4324fc82..acdf2c4116f3 100644 --- a/toolchain/check/testdata/alias/in_namespace.carbon +++ b/toolchain/check/testdata/alias/in_namespace.carbon @@ -34,10 +34,19 @@ library "[[@TEST_NAME]]"; namespace NS; fn F() -> {} { - // CHECK:STDERR: fail_local_in_namespace.carbon:[[@LINE+2]]:9-10: error: name `NS` not found [NameNotFound] + // CHECK:STDERR: ╭─┤ fail_local_in_namespace.carbon:[[@LINE+6]]:9 + // CHECK:STDERR: -> │ alias NS.a = {}; + // CHECK:STDERR: · ━┳ + // CHECK:STDERR: · ┗━━┫ error: name `NS` not found [NameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: alias NS.a = {}; - // CHECK:STDERR: fail_local_in_namespace.carbon:[[@LINE+2]]:10-13: error: member name `a` not found in `NS` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╭─┤ fail_local_in_namespace.carbon:[[@LINE+7]]:10 + // CHECK:STDERR: -> │ return NS.a; + // CHECK:STDERR: · ━━┳━ + // CHECK:STDERR: · ┗━━┫ error: member name `a` not found in `NS` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return NS.a; } diff --git a/toolchain/check/testdata/alias/preserve_in_type_printing.carbon b/toolchain/check/testdata/alias/preserve_in_type_printing.carbon index 659f498485ed..214d7ca8794c 100644 --- a/toolchain/check/testdata/alias/preserve_in_type_printing.carbon +++ b/toolchain/check/testdata/alias/preserve_in_type_printing.carbon @@ -19,21 +19,41 @@ alias A = C; // The diagnostics below should refer to `A`, not `C`. -// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+3]]:15-21: error: missing return value [ReturnStatementMissingExpr] -// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+2]]:11: note: return type of function is `A` [ReturnTypeHereNote] +// CHECK:STDERR: ╭─┤ fail_alias_nested_in_type.carbon:[[@LINE+7]]:15 +// CHECK:STDERR: -> │ fn F() -> A { return; } +// CHECK:STDERR: · ┬ ━━━┳━━━ +// CHECK:STDERR: · │ ┗━━┫ error: missing return value [ReturnStatementMissingExpr] +// CHECK:STDERR: · ╰───────────┤ return type of function is `A` [ReturnTypeHereNote] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F() -> A { return; } -// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+3]]:16-22: error: missing return value [ReturnStatementMissingExpr] -// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+2]]:11-12: note: return type of function is `A*` [ReturnTypeHereNote] +// CHECK:STDERR: ╭─┤ fail_alias_nested_in_type.carbon:[[@LINE+7]]:16 +// CHECK:STDERR: -> │ fn G() -> A* { return; } +// CHECK:STDERR: · ─┬ ━━━┳━━━ +// CHECK:STDERR: · │ ┗━━┫ error: missing return value [ReturnStatementMissingExpr] +// CHECK:STDERR: · ╰───────────┤ return type of function is `A*` [ReturnTypeHereNote] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn G() -> A* { return; } -// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+3]]:22-28: error: missing return value [ReturnStatementMissingExpr] -// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+2]]:11-18: note: return type of function is `const A*` [ReturnTypeHereNote] +// CHECK:STDERR: ╭─┤ fail_alias_nested_in_type.carbon:[[@LINE+9]]:22 +// CHECK:STDERR: -> │ fn H() -> const A* { return; } +// CHECK:STDERR: · ────┬─── ━━━┳━━━ +// CHECK:STDERR: · │ ┗━━┫ error: missing return value +// CHECK:STDERR: · │ ┃ [ReturnStatementMissingExpr] +// CHECK:STDERR: · ╰──────────────┤ return type of function is `const A*` +// CHECK:STDERR: · │ [ReturnTypeHereNote] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn H() -> const A* { return; } // TODO: Preserve type sugar in generic arguments, such as for `Core.Array`. -// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+3]]:26-32: error: missing return value [ReturnStatementMissingExpr] -// CHECK:STDERR: fail_alias_nested_in_type.carbon:[[@LINE+2]]:11-22: note: return type of function is `array(C, 42)` [ReturnTypeHereNote] +// CHECK:STDERR: ╭─┤ fail_alias_nested_in_type.carbon:[[@LINE+9]]:26 +// CHECK:STDERR: -> │ fn I() -> array(A, 42) { return; } +// CHECK:STDERR: · ──────┬───── ━━━┳━━━ +// CHECK:STDERR: · │ ┗━━┫ error: missing return value +// CHECK:STDERR: · │ ┃ [ReturnStatementMissingExpr] +// CHECK:STDERR: · ╰────────────────┤ return type of function is `array(C, 42)` +// CHECK:STDERR: · │ [ReturnTypeHereNote] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn I() -> array(A, 42) { return; } @@ -51,12 +71,21 @@ fn MakePtr() -> A*; fn F() { // The type of a call is the declared return type of the callee. - // CHECK:STDERR: fail_alias_in_type_of_expr.carbon:[[@LINE+2]]:3-19: error: type `A*` does not support qualified expressions [QualifiedExprUnsupported] + // CHECK:STDERR: ╭─┤ fail_alias_in_type_of_expr.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ MakePtr().missing; + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: type `A*` does not support qualified expressions + // CHECK:STDERR: · ┃ [QualifiedExprUnsupported] + // CHECK:STDERR: ╰──── // CHECK:STDERR: MakePtr().missing; // The type of a dereference is the pointee type of the pointer's type. - // CHECK:STDERR: fail_alias_in_type_of_expr.carbon:[[@LINE+2]]:3-16: error: value of type `A` is not callable [CallToNonCallable] + // CHECK:STDERR: ╭─┤ fail_alias_in_type_of_expr.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ (*MakePtr())(); + // CHECK:STDERR: · ━━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: value of type `A` is not callable [CallToNonCallable] + // CHECK:STDERR: ╰──── // CHECK:STDERR: (*MakePtr())(); } diff --git a/toolchain/check/testdata/alias/var.carbon b/toolchain/check/testdata/alias/var.carbon index 3654acfafa2d..18c3432281fc 100644 --- a/toolchain/check/testdata/alias/var.carbon +++ b/toolchain/check/testdata/alias/var.carbon @@ -34,7 +34,12 @@ library "[[@TEST_NAME]]"; fn F() -> () { var a: () = (); //@dump-sem-ir-begin - // CHECK:STDERR: fail_local.carbon:[[@LINE+2]]:13: error: alias refers to a runtime value [AliasRequiresConstantValue] + // CHECK:STDERR: ╭─┤ fail_local.carbon:[[@LINE+7]]:13 + // CHECK:STDERR: -> │ alias b = a; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: alias refers to a runtime value + // CHECK:STDERR: · ┃ [AliasRequiresConstantValue] + // CHECK:STDERR: ╰──── // CHECK:STDERR: alias b = a; //@dump-sem-ir-end diff --git a/toolchain/check/testdata/array/basics.carbon b/toolchain/check/testdata/array/basics.carbon index 70dcaa34486d..dae6548eb363 100644 --- a/toolchain/check/testdata/array/basics.carbon +++ b/toolchain/check/testdata/array/basics.carbon @@ -81,12 +81,36 @@ library "[[@TEST_NAME]]"; class Incomplete; -// CHECK:STDERR: fail_incomplete_element.carbon:[[@LINE+7]]:8-27: error: binding pattern has incomplete type `array(Incomplete, 1)` in name binding declaration [IncompleteTypeInBindingDecl] -// CHECK:STDERR: min_prelude/parts/array.carbon:13:3-24: note: `` evaluates to incomplete type `` [IncompleteTypeInMonomorphization] -// CHECK:STDERR: fail_incomplete_element.carbon:[[@LINE-4]]:1-17: note: class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: ╭─┤ fail_incomplete_element.carbon:[[@LINE+31]]:8 +// CHECK:STDERR: │ class Incomplete; +// CHECK:STDERR: · ────────┬──────── +// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ var a: array(Incomplete, 1); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: binding pattern has incomplete type `array(Incomplete, 1)` in +// CHECK:STDERR: · ┃ name binding declaration +// CHECK:STDERR: · ┃ [IncompleteTypeInBindingDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ min_prelude/parts/array.carbon +// CHECK:STDERR: │ adapt MakeArray(T, N); +// CHECK:STDERR: · ┬───────────────────── +// CHECK:STDERR: · ╰──┤ `` evaluates to incomplete type +// CHECK:STDERR: · │ `` +// CHECK:STDERR: · │ [IncompleteTypeInMonomorphization] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_incomplete_element.carbon:[[@LINE+3]]:8-27: error: binding pattern has incomplete type `array(Incomplete, 1)` in name binding declaration [IncompleteTypeInBindingDecl] -// CHECK:STDERR: fail_incomplete_element.carbon:[[@LINE-7]]:1-17: note: class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: ╭─┤ fail_incomplete_element.carbon:[[@LINE+12]]:8 +// CHECK:STDERR: │ class Incomplete; +// CHECK:STDERR: · ────────┬──────── +// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ var a: array(Incomplete, 1); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: binding pattern has incomplete type `array(Incomplete, 1)` in +// CHECK:STDERR: · ┃ name binding declaration +// CHECK:STDERR: · ┃ [IncompleteTypeInBindingDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var a: array(Incomplete, 1); @@ -96,8 +120,16 @@ var p: Incomplete* = &a[0]; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_invalid_element.carbon:[[@LINE+3]]:14: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet] -// CHECK:STDERR: fail_invalid_element.carbon:[[@LINE+2]]:14: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_invalid_element.carbon:[[@LINE+11]]:14 +// CHECK:STDERR: -> │ var a: array(1, 1); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert non-type value of type +// CHECK:STDERR: · │ ┃ `Core.IntLiteral` to `type` +// CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet] +// CHECK:STDERR: · ╰────┤ type `Core.IntLiteral` does not implement interface +// CHECK:STDERR: · │ `Core.ImplicitAs(type)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var a: array(1, 1); diff --git a/toolchain/check/testdata/array/bound_values.carbon b/toolchain/check/testdata/array/bound_values.carbon index 9eade93d879c..934799f09147 100644 --- a/toolchain/check/testdata/array/bound_values.carbon +++ b/toolchain/check/testdata/array/bound_values.carbon @@ -36,7 +36,12 @@ let b: array(i32, 3)* = &a; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_negative.carbon:[[@LINE+2]]:19-20: error: array bound of -1 is negative [ArrayBoundNegative] +// CHECK:STDERR: ╭─┤ fail_negative.carbon:[[@LINE+7]]:19 +// CHECK:STDERR: -> │ var a: array(i32, -1); +// CHECK:STDERR: · ━┳ +// CHECK:STDERR: · ┗━━┫ error: array bound of -1 is negative +// CHECK:STDERR: · ┃ [ArrayBoundNegative] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var a: array(i32, -1); @@ -44,7 +49,12 @@ var a: array(i32, -1); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:19-38: error: array bound of 39999999999999999993 is too large [ArrayBoundTooLarge] +// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+7]]:19 +// CHECK:STDERR: -> │ var a: array(i32, 39999999999999999993); +// CHECK:STDERR: · ━━┳━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: array bound of 39999999999999999993 is too large +// CHECK:STDERR: · ┃ [ArrayBoundTooLarge] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var a: array(i32, 39999999999999999993); @@ -52,8 +62,16 @@ var a: array(i32, 39999999999999999993); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_invalid_type_with_overflow.carbon:[[@LINE+3]]:14: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet] -// CHECK:STDERR: fail_invalid_type_with_overflow.carbon:[[@LINE+2]]:14: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_invalid_type_with_overflow.carbon:[[@LINE+11]]:14 +// CHECK:STDERR: -> │ var b: array(1, 39999999999999999993); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert non-type value of type +// CHECK:STDERR: · │ ┃ `Core.IntLiteral` to `type` +// CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet] +// CHECK:STDERR: · ╰────┤ type `Core.IntLiteral` does not implement interface +// CHECK:STDERR: · │ `Core.ImplicitAs(type)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var b: array(1, 39999999999999999993); diff --git a/toolchain/check/testdata/array/element_mismatches.carbon b/toolchain/check/testdata/array/element_mismatches.carbon index 3a6d9e9cd423..74edbb60212c 100644 --- a/toolchain/check/testdata/array/element_mismatches.carbon +++ b/toolchain/check/testdata/array/element_mismatches.carbon @@ -16,8 +16,16 @@ library "[[@TEST_NAME]]"; class C {} -// CHECK:STDERR: fail_arg_wrong_type.carbon:[[@LINE+3]]:22-35: error: cannot implicitly convert expression of type `()` to `C` [ConversionFailure] -// CHECK:STDERR: fail_arg_wrong_type.carbon:[[@LINE+2]]:22-35: note: type `()` does not implement interface `Core.ImplicitAs(C)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_arg_wrong_type.carbon:[[@LINE+11]]:22 +// CHECK:STDERR: -> │ var a: array(C, 3) = ({}, (), true); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type +// CHECK:STDERR: · │ ┃ `()` to `C` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╰────┤ type `()` does not implement interface +// CHECK:STDERR: · │ `Core.ImplicitAs(C)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var a: array(C, 3) = ({}, (), true); @@ -29,14 +37,28 @@ class C {} class D {} var a: (D, C, D); -// CHECK:STDERR: fail_var_wrong_type.carbon:[[@LINE+3]]:22: error: cannot implicitly convert expression of type `D` to `C` [ConversionFailure] -// CHECK:STDERR: fail_var_wrong_type.carbon:[[@LINE+2]]:22: note: type `D` does not implement interface `Core.ImplicitAs(C)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_var_wrong_type.carbon:[[@LINE+11]]:22 +// CHECK:STDERR: -> │ var b: array(C, 3) = a; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type +// CHECK:STDERR: · │ ┃ `D` to `C` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╰────┤ type `D` does not implement interface +// CHECK:STDERR: · │ `Core.ImplicitAs(C)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var b: array(C, 3) = a; var c: (C, D, D); -// CHECK:STDERR: fail_var_wrong_type.carbon:[[@LINE+3]]:22: error: cannot copy value of type `C` [CopyOfUncopyableType] -// CHECK:STDERR: fail_var_wrong_type.carbon:[[@LINE+2]]:22: note: type `C` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_var_wrong_type.carbon:[[@LINE+9]]:22 +// CHECK:STDERR: -> │ var d: array(C, 3) = c; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: cannot copy value of type `C` +// CHECK:STDERR: · │ ┃ [CopyOfUncopyableType] +// CHECK:STDERR: · ╰────┤ type `C` does not implement interface `Core.Copy` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var d: array(C, 3) = c; @@ -46,7 +68,13 @@ library "[[@TEST_NAME]]"; class C {} -// CHECK:STDERR: fail_arg_too_short.carbon:[[@LINE+2]]:22-29: error: cannot initialize array of 3 elements from 2 initializers [ArrayInitFromLiteralArgCountMismatch] +// CHECK:STDERR: ╭─┤ fail_arg_too_short.carbon:[[@LINE+8]]:22 +// CHECK:STDERR: -> │ var a: array(C, 3) = ({}, {}); +// CHECK:STDERR: · ┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot initialize array of 3 elements from 2 +// CHECK:STDERR: · ┃ initializers +// CHECK:STDERR: · ┃ [ArrayInitFromLiteralArgCountMismatch] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var a: array(C, 3) = ({}, {}); @@ -57,12 +85,24 @@ library "[[@TEST_NAME]]"; class C {} var a: (C, C); -// CHECK:STDERR: fail_var_too_short.carbon:[[@LINE+2]]:22: error: cannot initialize array of 3 elements from tuple with 2 elements [ArrayInitFromExprArgCountMismatch] +// CHECK:STDERR: ╭─┤ fail_var_too_short.carbon:[[@LINE+8]]:22 +// CHECK:STDERR: -> │ var b: array(C, 3) = a; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: cannot initialize array of 3 elements from +// CHECK:STDERR: · ┃ tuple with 2 elements +// CHECK:STDERR: · ┃ [ArrayInitFromExprArgCountMismatch] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var b: array(C, 3) = a; // --- fail_arg_too_long.carbon -// CHECK:STDERR: fail_arg_too_long.carbon:[[@LINE+2]]:23-34: error: cannot initialize array of 1 element from 3 initializers [ArrayInitFromLiteralArgCountMismatch] +// CHECK:STDERR: ╭─┤ fail_arg_too_long.carbon:[[@LINE+8]]:23 +// CHECK:STDERR: -> │ var a: array((), 1) = ((), (), ()); +// CHECK:STDERR: · ┳━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot initialize array of 1 element from 3 +// CHECK:STDERR: · ┃ initializers +// CHECK:STDERR: · ┃ [ArrayInitFromLiteralArgCountMismatch] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var a: array((), 1) = ((), (), ()); diff --git a/toolchain/check/testdata/array/index_not_literal.carbon b/toolchain/check/testdata/array/index_not_literal.carbon index b5d20526de56..60a777542837 100644 --- a/toolchain/check/testdata/array/index_not_literal.carbon +++ b/toolchain/check/testdata/array/index_not_literal.carbon @@ -39,7 +39,12 @@ fn F(a: array({}, 3)) -> {} { library "[[@TEST_NAME]]"; fn F(a: array({}, 3)) -> {} { - // CHECK:STDERR: fail_out_of_bound_non_literal.carbon:[[@LINE+2]]:12-29: error: array index `3` is past the end of type `array({}, 3)` [ArrayIndexOutOfBounds] + // CHECK:STDERR: ╭─┤ fail_out_of_bound_non_literal.carbon:[[@LINE+7]]:12 + // CHECK:STDERR: -> │ return a[{.index = 3}.index]; + // CHECK:STDERR: · ━━━┳━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: array index `3` is past the end of type `array({}, 3)` + // CHECK:STDERR: · ┃ [ArrayIndexOutOfBounds] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return a[{.index = 3}.index]; } diff --git a/toolchain/check/testdata/array/init_dependent_bound.carbon b/toolchain/check/testdata/array/init_dependent_bound.carbon index 1fd93f065c2b..eccb00bee877 100644 --- a/toolchain/check/testdata/array/init_dependent_bound.carbon +++ b/toolchain/check/testdata/array/init_dependent_bound.carbon @@ -32,7 +32,14 @@ fn H() { library "[[@TEST_NAME]]"; fn F(generic N: i32) { - // CHECK:STDERR: fail_init_dependent_bound.carbon:[[@LINE+2]]:35-43: error: cannot initialize array with dependent bound from a list of initializers [ArrayInitDependentBound] + // CHECK:STDERR: ╭─┤ fail_init_dependent_bound.carbon:[[@LINE+9]]:35 + // CHECK:STDERR: -> │ var unused arr: array(i32, N) = (1, 2, 3); + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot initialize array with + // CHECK:STDERR: · ┃ dependent bound from a list of + // CHECK:STDERR: · ┃ initializers + // CHECK:STDERR: · ┃ [ArrayInitDependentBound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused arr: array(i32, N) = (1, 2, 3); } @@ -45,8 +52,18 @@ interface Y(T: type, U: T) {} constraint Z(N: i32) { // Forming the specific of `Y` uses constant values which are canonical and // have no location. The error should still point somewhere reasonable. - // CHECK:STDERR: fail_init_dependent_bound_in_constant.carbon:[[@LINE+3]]:24-42: error: cannot initialize array with dependent bound from a list of initializers [ArrayInitDependentBound] - // CHECK:STDERR: fail_init_dependent_bound_in_constant.carbon:[[@LINE-6]]:1-28: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_init_dependent_bound_in_constant.carbon:[[@LINE+13]]:24 + // CHECK:STDERR: │ interface Y(T: type, U: T) {} + // CHECK:STDERR: · ──────────────┬───────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ extend require impls Y(array((), N), ()); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot initialize array with dependent bound + // CHECK:STDERR: · ┃ from a list of initializers + // CHECK:STDERR: · ┃ [ArrayInitDependentBound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend require impls Y(array((), N), ()); } diff --git a/toolchain/check/testdata/as/adapter_conversion.carbon b/toolchain/check/testdata/as/adapter_conversion.carbon index d5da2ced3a8e..23a99c9c398a 100644 --- a/toolchain/check/testdata/as/adapter_conversion.carbon +++ b/toolchain/check/testdata/as/adapter_conversion.carbon @@ -133,9 +133,16 @@ fn F(a: A) { // a copy to perform initialization. It's not clear whether that is the right // behavior. - // CHECK:STDERR: fail_init_tuple_variable.carbon:[[@LINE+4]]:3-22: error: cannot copy value of type `Noncopyable` [CopyOfUncopyableType] - // CHECK:STDERR: fail_init_tuple_variable.carbon:[[@LINE+3]]:3-22: note: type `Noncopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: fail_init_tuple_variable.carbon:[[@LINE+2]]:26-54: note: in copy of `A` [InCopy] + // CHECK:STDERR: ╭─┤ fail_init_tuple_variable.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: -> │ var unused a_init: A = (a as ({}, Noncopyable)) as A; + // CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━ ┬──────────────────────────── + // CHECK:STDERR: · ┗━━━━━━━━━━━━━━━┫ error: cannot copy value of type `Noncopyable` + // CHECK:STDERR: · │ │ ┃ [CopyOfUncopyableType] + // CHECK:STDERR: · ╰─────────────────┤ type `Noncopyable` does not implement interface + // CHECK:STDERR: · │ │ `Core.Copy` + // CHECK:STDERR: · │ │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: · ╰──────┤ in copy of `A` [InCopy] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused a_init: A = (a as ({}, Noncopyable)) as A; } @@ -155,8 +162,15 @@ class B { // We do not try to implicitly convert from the first operand of `as` to the // adapted type of the second operand. -// CHECK:STDERR: fail_adapt_init_from_struct.carbon:[[@LINE+3]]:12-25: error: cannot convert expression of type `{.x: ()}` to `B` with `as` [ConversionFailure] -// CHECK:STDERR: fail_adapt_init_from_struct.carbon:[[@LINE+2]]:12-25: note: type `{.x: ()}` does not implement interface `Core.As(B)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_adapt_init_from_struct.carbon:[[@LINE+10]]:12 +// CHECK:STDERR: -> │ var b: B = {.x = ()} as B; +// CHECK:STDERR: · ┳━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `{.x: ()}` to `B` with +// CHECK:STDERR: · │ ┃ `as` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╰────┤ type `{.x: ()}` does not implement interface `Core.As(B)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var b: B = {.x = ()} as B; diff --git a/toolchain/check/testdata/as/basics.carbon b/toolchain/check/testdata/as/basics.carbon index 23b8b993c3ff..dcf08621a55e 100644 --- a/toolchain/check/testdata/as/basics.carbon +++ b/toolchain/check/testdata/as/basics.carbon @@ -106,8 +106,16 @@ let n: Y = ({.x = ()} as X) as Y; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+3]]:13-19: error: cannot convert expression of type `Core.IntLiteral` to `{}` with `as` [ConversionFailure] -// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+2]]:13-19: note: type `Core.IntLiteral` does not implement interface `Core.As({})` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_no_conversion.carbon:[[@LINE+11]]:13 +// CHECK:STDERR: -> │ let a: {} = 1 as {}; +// CHECK:STDERR: · ┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `Core.IntLiteral` to +// CHECK:STDERR: · │ ┃ `{}` with `as` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╰────┤ type `Core.IntLiteral` does not implement interface +// CHECK:STDERR: · │ `Core.As({})` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let a: {} = 1 as {}; @@ -115,8 +123,16 @@ let a: {} = 1 as {}; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_not_type.carbon:[[@LINE+3]]:32-40: error: cannot implicitly convert non-type value of type `{.x: ()}` to `type` [ConversionFailureNonTypeToFacet] -// CHECK:STDERR: fail_not_type.carbon:[[@LINE+2]]:32-40: note: type `{.x: ()}` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_not_type.carbon:[[@LINE+11]]:32 +// CHECK:STDERR: -> │ let n: {.x: ()} = {.x = ()} as {.x = ()}; +// CHECK:STDERR: · ┳━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert non-type +// CHECK:STDERR: · │ ┃ value of type `{.x: ()}` to `type` +// CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet] +// CHECK:STDERR: · ╰────┤ type `{.x: ()}` does not implement +// CHECK:STDERR: · │ interface `Core.ImplicitAs(type)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let n: {.x: ()} = {.x = ()} as {.x = ()}; diff --git a/toolchain/check/testdata/as/const.carbon b/toolchain/check/testdata/as/const.carbon index b1bbd3c316bf..ee9be1f479a6 100644 --- a/toolchain/check/testdata/as/const.carbon +++ b/toolchain/check/testdata/as/const.carbon @@ -58,12 +58,28 @@ var reference: const X; let ptr: const X* = &reference; fn Use() { - // CHECK:STDERR: fail_cannot_remove_const.carbon:[[@LINE+3]]:24-37: error: cannot convert expression of type `const X` to `X` with `as` [ConversionFailure] - // CHECK:STDERR: fail_cannot_remove_const.carbon:[[@LINE+2]]:24-37: note: type `const X` does not implement interface `Core.As(X)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_cannot_remove_const.carbon:[[@LINE+11]]:24 + // CHECK:STDERR: -> │ let unused a: X* = &(reference as X); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `const X` + // CHECK:STDERR: · │ ┃ to `X` with `as` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `const X` does not implement interface + // CHECK:STDERR: · │ `Core.As(X)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused a: X* = &(reference as X); - // CHECK:STDERR: fail_cannot_remove_const.carbon:[[@LINE+3]]:22-30: error: cannot convert expression of type `const X*` to `X*` with `as` [ConversionFailure] - // CHECK:STDERR: fail_cannot_remove_const.carbon:[[@LINE+2]]:22-30: note: type `const X*` does not implement interface `Core.As(X*)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_cannot_remove_const.carbon:[[@LINE+11]]:22 + // CHECK:STDERR: -> │ let unused b: X* = ptr as X*; + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `const X*` to + // CHECK:STDERR: · │ ┃ `X*` with `as` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `const X*` does not implement interface + // CHECK:STDERR: · │ `Core.As(X*)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused b: X* = ptr as X*; } diff --git a/toolchain/check/testdata/as/maybe_unformed.carbon b/toolchain/check/testdata/as/maybe_unformed.carbon index efe301eb6d42..99b41351b29f 100644 --- a/toolchain/check/testdata/as/maybe_unformed.carbon +++ b/toolchain/check/testdata/as/maybe_unformed.carbon @@ -39,12 +39,34 @@ let value: X = Init(); fn Use() { // TODO: These should probably be valid. //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_add_unformed_nonref.carbon:[[@LINE+3]]:41-71: error: cannot convert expression of type `X` to `Core.MaybeUnformed(X)` with `as` [ConversionFailure] - // CHECK:STDERR: fail_todo_add_unformed_nonref.carbon:[[@LINE+2]]:41-71: note: type `X` does not implement interface `Core.As(Core.MaybeUnformed(X))` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_todo_add_unformed_nonref.carbon:[[@LINE+14]]:41 + // CHECK:STDERR: -> │ var unused i: Core.MaybeUnformed(X) = Init() as Core.MaybeUnformed(X); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert expression of + // CHECK:STDERR: · │ ┃ type `X` to + // CHECK:STDERR: · │ ┃ `Core.MaybeUnformed(X)` with + // CHECK:STDERR: · │ ┃ `as` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `X` does not implement + // CHECK:STDERR: · │ interface + // CHECK:STDERR: · │ `Core.As(Core.MaybeUnformed(X))` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused i: Core.MaybeUnformed(X) = Init() as Core.MaybeUnformed(X); - // CHECK:STDERR: fail_todo_add_unformed_nonref.carbon:[[@LINE+3]]:41-70: error: cannot convert expression of type `X` to `Core.MaybeUnformed(X)` with `as` [ConversionFailure] - // CHECK:STDERR: fail_todo_add_unformed_nonref.carbon:[[@LINE+2]]:41-70: note: type `X` does not implement interface `Core.As(Core.MaybeUnformed(X))` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_todo_add_unformed_nonref.carbon:[[@LINE+14]]:41 + // CHECK:STDERR: -> │ let unused v: Core.MaybeUnformed(X) = value as Core.MaybeUnformed(X); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert expression of + // CHECK:STDERR: · │ ┃ type `X` to + // CHECK:STDERR: · │ ┃ `Core.MaybeUnformed(X)` with + // CHECK:STDERR: · │ ┃ `as` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `X` does not implement + // CHECK:STDERR: · │ interface + // CHECK:STDERR: · │ `Core.As(Core.MaybeUnformed(X))` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused v: Core.MaybeUnformed(X) = value as Core.MaybeUnformed(X); //@dump-sem-ir-end @@ -62,26 +84,66 @@ var reference: Core.MaybeUnformed(X); let ptr: Core.MaybeUnformed(X)* = &reference; fn Use() { - // CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+3]]:21-31: error: cannot convert expression of type `Core.MaybeUnformed(X)` to `X` with `as` [ConversionFailure] - // CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+2]]:21-31: note: type `Core.MaybeUnformed(X)` does not implement interface `Core.As(X)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_cannot_remove_unformed.carbon:[[@LINE+11]]:21 + // CHECK:STDERR: -> │ var unused i: X = Init() as X; + // CHECK:STDERR: · ┳━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type + // CHECK:STDERR: · │ ┃ `Core.MaybeUnformed(X)` to `X` with `as` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Core.MaybeUnformed(X)` does not implement + // CHECK:STDERR: · │ interface `Core.As(X)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused i: X = Init() as X; // TODO: The diagnostic should explain that the reason we can't perform this // conversion is due to the expression category. - // CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+3]]:21-38: error: cannot convert expression of type `Core.MaybeUnformed(X)` to `X` with `unsafe as` [ConversionFailure] - // CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+2]]:21-38: note: type `Core.MaybeUnformed(X)` does not implement interface `Core.UnsafeAs(X)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_cannot_remove_unformed.carbon:[[@LINE+11]]:21 + // CHECK:STDERR: -> │ var unused j: X = Init() unsafe as X; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type + // CHECK:STDERR: · │ ┃ `Core.MaybeUnformed(X)` to `X` with `unsafe as` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Core.MaybeUnformed(X)` does not implement + // CHECK:STDERR: · │ interface `Core.UnsafeAs(X)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused j: X = Init() unsafe as X; - // CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+3]]:21-30: error: cannot convert expression of type `Core.MaybeUnformed(X)` to `X` with `as` [ConversionFailure] - // CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+2]]:21-30: note: type `Core.MaybeUnformed(X)` does not implement interface `Core.As(X)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_cannot_remove_unformed.carbon:[[@LINE+11]]:21 + // CHECK:STDERR: -> │ let unused v: X = value as X; + // CHECK:STDERR: · ┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type + // CHECK:STDERR: · │ ┃ `Core.MaybeUnformed(X)` to `X` with `as` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Core.MaybeUnformed(X)` does not implement + // CHECK:STDERR: · │ interface `Core.As(X)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused v: X = value as X; - // CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+3]]:24-37: error: cannot convert expression of type `Core.MaybeUnformed(X)` to `X` with `as` [ConversionFailure] - // CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+2]]:24-37: note: type `Core.MaybeUnformed(X)` does not implement interface `Core.As(X)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_cannot_remove_unformed.carbon:[[@LINE+11]]:24 + // CHECK:STDERR: -> │ let unused a: X* = &(reference as X); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type + // CHECK:STDERR: · │ ┃ `Core.MaybeUnformed(X)` to `X` with `as` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Core.MaybeUnformed(X)` does not implement + // CHECK:STDERR: · │ interface `Core.As(X)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused a: X* = &(reference as X); - // CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+3]]:22-30: error: cannot convert expression of type `Core.MaybeUnformed(X)*` to `X*` with `as` [ConversionFailure] - // CHECK:STDERR: fail_cannot_remove_unformed.carbon:[[@LINE+2]]:22-30: note: type `Core.MaybeUnformed(X)*` does not implement interface `Core.As(X*)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_cannot_remove_unformed.carbon:[[@LINE+11]]:22 + // CHECK:STDERR: -> │ let unused b: X* = ptr as X*; + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type + // CHECK:STDERR: · │ ┃ `Core.MaybeUnformed(X)*` to `X*` with `as` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Core.MaybeUnformed(X)*` does not implement + // CHECK:STDERR: · │ interface `Core.As(X*)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused b: X* = ptr as X*; } @@ -208,7 +270,7 @@ fn Use() { // CHECK:STDOUT: %T.09f: %SubobjectDestroy.type = symbolic_binding T, 0 [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.type.dea: type = fn_type @T.as_type.as.DestroyImpl.impl.Op, @T.as_type.as.DestroyImpl.impl(%T.09f) [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.6e5: %T.as_type.as.DestroyImpl.impl.Op.type.dea = struct_value () [symbolic] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.4: type = fn_type @SubobjectDestroy.WithSelf.Op.loc15_3.4 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.4: type = fn_type @SubobjectDestroy.WithSelf.Op.loc26_3.4 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.4: %SubobjectDestroy.WithSelf.Op.type.6870fd.4 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80ef6.4: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.4), @SubobjectDestroy [concrete] // CHECK:STDOUT: %SubobjectDestroy.facet.4df: %SubobjectDestroy.type = facet_value %MaybeUnformed.67f, (%custom_witness.b80ef6.4) [concrete] @@ -235,19 +297,19 @@ fn Use() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %i.var: ref %MaybeUnformed.67f = var_storage %i.var_patt // CHECK:STDOUT: %Init.ref: %Init.type = name_ref Init, file.%Init.decl [concrete = constants.%Init] -// CHECK:STDOUT: %.loc15_46: ref %X = temporary_storage -// CHECK:STDOUT: %Init.call: init %X to %.loc15_46 = call %Init.ref() -// CHECK:STDOUT: %Core.ref.loc15_51: = name_ref Core, imports.%Core [concrete = imports.%Core] -// CHECK:STDOUT: %MaybeUnformed.ref.loc15_55: %MaybeUnformed.type = name_ref MaybeUnformed, imports.%Core.MaybeUnformed [concrete = constants.%MaybeUnformed.generic] -// CHECK:STDOUT: %X.ref.loc15_70: type = name_ref X, file.%X.decl [concrete = constants.%X] -// CHECK:STDOUT: %MaybeUnformed.loc15_71: type = class_type @MaybeUnformed, @MaybeUnformed(constants.%X) [concrete = constants.%MaybeUnformed.67f] -// CHECK:STDOUT: %.loc15_48: %MaybeUnformed.67f = converted %Init.call, [concrete = ] +// CHECK:STDOUT: %.loc26_46: ref %X = temporary_storage +// CHECK:STDOUT: %Init.call: init %X to %.loc26_46 = call %Init.ref() +// CHECK:STDOUT: %Core.ref.loc26_51: = name_ref Core, imports.%Core [concrete = imports.%Core] +// CHECK:STDOUT: %MaybeUnformed.ref.loc26_55: %MaybeUnformed.type = name_ref MaybeUnformed, imports.%Core.MaybeUnformed [concrete = constants.%MaybeUnformed.generic] +// CHECK:STDOUT: %X.ref.loc26_70: type = name_ref X, file.%X.decl [concrete = constants.%X] +// CHECK:STDOUT: %MaybeUnformed.loc26_71: type = class_type @MaybeUnformed, @MaybeUnformed(constants.%X) [concrete = constants.%MaybeUnformed.67f] +// CHECK:STDOUT: %.loc26_48: %MaybeUnformed.67f = converted %Init.call, [concrete = ] // CHECK:STDOUT: assign %i.var, -// CHECK:STDOUT: %.loc15_37: type = splice_block %MaybeUnformed.loc15_37 [concrete = constants.%MaybeUnformed.67f] { -// CHECK:STDOUT: %Core.ref.loc15_17: = name_ref Core, imports.%Core [concrete = imports.%Core] -// CHECK:STDOUT: %MaybeUnformed.ref.loc15_21: %MaybeUnformed.type = name_ref MaybeUnformed, imports.%Core.MaybeUnformed [concrete = constants.%MaybeUnformed.generic] -// CHECK:STDOUT: %X.ref.loc15_36: type = name_ref X, file.%X.decl [concrete = constants.%X] -// CHECK:STDOUT: %MaybeUnformed.loc15_37: type = class_type @MaybeUnformed, @MaybeUnformed(constants.%X) [concrete = constants.%MaybeUnformed.67f] +// CHECK:STDOUT: %.loc26_37: type = splice_block %MaybeUnformed.loc26_37 [concrete = constants.%MaybeUnformed.67f] { +// CHECK:STDOUT: %Core.ref.loc26_17: = name_ref Core, imports.%Core [concrete = imports.%Core] +// CHECK:STDOUT: %MaybeUnformed.ref.loc26_21: %MaybeUnformed.type = name_ref MaybeUnformed, imports.%Core.MaybeUnformed [concrete = constants.%MaybeUnformed.generic] +// CHECK:STDOUT: %X.ref.loc26_36: type = name_ref X, file.%X.decl [concrete = constants.%X] +// CHECK:STDOUT: %MaybeUnformed.loc26_37: type = class_type @MaybeUnformed, @MaybeUnformed(constants.%X) [concrete = constants.%MaybeUnformed.67f] // CHECK:STDOUT: } // CHECK:STDOUT: %i: ref %MaybeUnformed.67f = wrapper_binding i, %i.var // CHECK:STDOUT: name_binding_decl { @@ -255,40 +317,40 @@ fn Use() { // CHECK:STDOUT: %i.var_patt: %pattern_type.55d = var_pattern %i.patt [concrete = constants.%i.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %value.ref: %X = name_ref value, file.%value -// CHECK:STDOUT: %Core.ref.loc19_50: = name_ref Core, imports.%Core [concrete = imports.%Core] -// CHECK:STDOUT: %MaybeUnformed.ref.loc19_54: %MaybeUnformed.type = name_ref MaybeUnformed, imports.%Core.MaybeUnformed [concrete = constants.%MaybeUnformed.generic] -// CHECK:STDOUT: %X.ref.loc19_69: type = name_ref X, file.%X.decl [concrete = constants.%X] -// CHECK:STDOUT: %MaybeUnformed.loc19_70: type = class_type @MaybeUnformed, @MaybeUnformed(constants.%X) [concrete = constants.%MaybeUnformed.67f] -// CHECK:STDOUT: %.loc19_47: %MaybeUnformed.67f = converted %value.ref, [concrete = ] -// CHECK:STDOUT: %.loc19_37: type = splice_block %MaybeUnformed.loc19_37 [concrete = constants.%MaybeUnformed.67f] { -// CHECK:STDOUT: %Core.ref.loc19_17: = name_ref Core, imports.%Core [concrete = imports.%Core] -// CHECK:STDOUT: %MaybeUnformed.ref.loc19_21: %MaybeUnformed.type = name_ref MaybeUnformed, imports.%Core.MaybeUnformed [concrete = constants.%MaybeUnformed.generic] -// CHECK:STDOUT: %X.ref.loc19_36: type = name_ref X, file.%X.decl [concrete = constants.%X] -// CHECK:STDOUT: %MaybeUnformed.loc19_37: type = class_type @MaybeUnformed, @MaybeUnformed(constants.%X) [concrete = constants.%MaybeUnformed.67f] +// CHECK:STDOUT: %Core.ref.loc41_50: = name_ref Core, imports.%Core [concrete = imports.%Core] +// CHECK:STDOUT: %MaybeUnformed.ref.loc41_54: %MaybeUnformed.type = name_ref MaybeUnformed, imports.%Core.MaybeUnformed [concrete = constants.%MaybeUnformed.generic] +// CHECK:STDOUT: %X.ref.loc41_69: type = name_ref X, file.%X.decl [concrete = constants.%X] +// CHECK:STDOUT: %MaybeUnformed.loc41_70: type = class_type @MaybeUnformed, @MaybeUnformed(constants.%X) [concrete = constants.%MaybeUnformed.67f] +// CHECK:STDOUT: %.loc41_47: %MaybeUnformed.67f = converted %value.ref, [concrete = ] +// CHECK:STDOUT: %.loc41_37: type = splice_block %MaybeUnformed.loc41_37 [concrete = constants.%MaybeUnformed.67f] { +// CHECK:STDOUT: %Core.ref.loc41_17: = name_ref Core, imports.%Core [concrete = imports.%Core] +// CHECK:STDOUT: %MaybeUnformed.ref.loc41_21: %MaybeUnformed.type = name_ref MaybeUnformed, imports.%Core.MaybeUnformed [concrete = constants.%MaybeUnformed.generic] +// CHECK:STDOUT: %X.ref.loc41_36: type = name_ref X, file.%X.decl [concrete = constants.%X] +// CHECK:STDOUT: %MaybeUnformed.loc41_37: type = class_type @MaybeUnformed, @MaybeUnformed(constants.%X) [concrete = constants.%MaybeUnformed.67f] // CHECK:STDOUT: } // CHECK:STDOUT: %v: %MaybeUnformed.67f = wrapper_binding v, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %v.patt: %pattern_type.55d = value_binding_pattern v [concrete = constants.%v.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.facet.loc15_3.1: %Destroy.type = facet_value constants.%MaybeUnformed.67f, (constants.%DestroyImpl.impl_witness.8e6, constants.%custom_witness.b80ef6.4) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc15_3.1: %Destroy.type = converted constants.%MaybeUnformed.67f, %Destroy.facet.loc15_3.1 [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %Destroy.facet.loc15_3.2: %Destroy.type = facet_value constants.%MaybeUnformed.67f, (constants.%DestroyImpl.impl_witness.8e6, constants.%custom_witness.b80ef6.4) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc15_3.2: %Destroy.type = converted constants.%MaybeUnformed.67f, %Destroy.facet.loc15_3.2 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %Destroy.facet.loc26_3.1: %Destroy.type = facet_value constants.%MaybeUnformed.67f, (constants.%DestroyImpl.impl_witness.8e6, constants.%custom_witness.b80ef6.4) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc26_3.1: %Destroy.type = converted constants.%MaybeUnformed.67f, %Destroy.facet.loc26_3.1 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %Destroy.facet.loc26_3.2: %Destroy.type = facet_value constants.%MaybeUnformed.67f, (constants.%DestroyImpl.impl_witness.8e6, constants.%custom_witness.b80ef6.4) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc26_3.2: %Destroy.type = converted constants.%MaybeUnformed.67f, %Destroy.facet.loc26_3.2 [concrete = constants.%Destroy.facet] // CHECK:STDOUT: // CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%i.var) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc15_3.1(%self.param: ref %empty_struct_type) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc26_3.1(%self.param: ref %empty_struct_type) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc15_3.2(%self.param: ref %X) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc26_3.2(%self.param: ref %X) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc15_3.3(%self.param: ref %.f01) { +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc26_3.3(%self.param: ref %.f01) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc15_3.4(%self.param: ref %MaybeUnformed.67f) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc26_3.4(%self.param: ref %MaybeUnformed.67f) = "no_op"; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: diff --git a/toolchain/check/testdata/as/partial.carbon b/toolchain/check/testdata/as/partial.carbon index cdf302e9dd4d..5b372a0e0928 100644 --- a/toolchain/check/testdata/as/partial.carbon +++ b/toolchain/check/testdata/as/partial.carbon @@ -60,16 +60,40 @@ var reference: partial X; let ptr: partial X* = &reference; fn Use() { - // CHECK:STDERR: fail_cannot_remove_partial.carbon:[[@LINE+3]]:21-30: error: cannot convert expression of type `partial X` to `X` with `as` [ConversionFailure] - // CHECK:STDERR: fail_cannot_remove_partial.carbon:[[@LINE+2]]:21-30: note: type `partial X` does not implement interface `Core.As(X)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_cannot_remove_partial.carbon:[[@LINE+11]]:21 + // CHECK:STDERR: -> │ let unused v: X = value as X; + // CHECK:STDERR: · ┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `partial X` to + // CHECK:STDERR: · │ ┃ `X` with `as` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `partial X` does not implement interface + // CHECK:STDERR: · │ `Core.As(X)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused v: X = value as X; - // CHECK:STDERR: fail_cannot_remove_partial.carbon:[[@LINE+3]]:24-37: error: cannot convert expression of type `partial X` to `X` with `as` [ConversionFailure] - // CHECK:STDERR: fail_cannot_remove_partial.carbon:[[@LINE+2]]:24-37: note: type `partial X` does not implement interface `Core.As(X)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_cannot_remove_partial.carbon:[[@LINE+11]]:24 + // CHECK:STDERR: -> │ let unused a: X* = &(reference as X); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `partial X` + // CHECK:STDERR: · │ ┃ to `X` with `as` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `partial X` does not implement interface + // CHECK:STDERR: · │ `Core.As(X)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused a: X* = &(reference as X); - // CHECK:STDERR: fail_cannot_remove_partial.carbon:[[@LINE+3]]:22-30: error: cannot convert expression of type `partial X*` to `X*` with `as` [ConversionFailure] - // CHECK:STDERR: fail_cannot_remove_partial.carbon:[[@LINE+2]]:22-30: note: type `partial X*` does not implement interface `Core.As(X*)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_cannot_remove_partial.carbon:[[@LINE+11]]:22 + // CHECK:STDERR: -> │ let unused b: X* = ptr as X*; + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `partial X*` + // CHECK:STDERR: · │ ┃ to `X*` with `as` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `partial X*` does not implement interface + // CHECK:STDERR: · │ `Core.As(X*)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused b: X* = ptr as X*; } diff --git a/toolchain/check/testdata/as/unsafe_as.carbon b/toolchain/check/testdata/as/unsafe_as.carbon index 3e948599a4d9..b4bf5262b974 100644 --- a/toolchain/check/testdata/as/unsafe_as.carbon +++ b/toolchain/check/testdata/as/unsafe_as.carbon @@ -18,8 +18,15 @@ class A {}; class B {}; fn Convert(a: A) -> B { - // CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+3]]:10-22: error: cannot convert expression of type `A` to `B` with `unsafe as` [ConversionFailure] - // CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+2]]:10-22: note: type `A` does not implement interface `Core.UnsafeAs(B)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_no_conversion.carbon:[[@LINE+10]]:10 + // CHECK:STDERR: -> │ return a unsafe as B; + // CHECK:STDERR: · ┳━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `A` to `B` with + // CHECK:STDERR: · │ ┃ `unsafe as` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `A` does not implement interface `Core.UnsafeAs(B)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return a unsafe as B; } diff --git a/toolchain/check/testdata/basics/multi_error.carbon b/toolchain/check/testdata/basics/multi_error.carbon index 4162225db8e2..5027bfa187e3 100644 --- a/toolchain/check/testdata/basics/multi_error.carbon +++ b/toolchain/check/testdata/basics/multi_error.carbon @@ -17,10 +17,20 @@ // This regression test ensures that reuse of `` in different scopes // works. -// CHECK:STDERR: fail_multi_error.carbon:[[@LINE+2]]:8-20: error: implicit parameters of functions must be constant [ImplictParamMustBeConstant] +// CHECK:STDERR: ╭─┤ fail_multi_error.carbon:[[@LINE+7]]:8 +// CHECK:STDERR: -> │ fn Foo[runtime a: ()](); +// CHECK:STDERR: · ━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: implicit parameters of functions must be constant +// CHECK:STDERR: · ┃ [ImplictParamMustBeConstant] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Foo[runtime a: ()](); -// CHECK:STDERR: fail_multi_error.carbon:[[@LINE+2]]:8-20: error: implicit parameters of functions must be constant [ImplictParamMustBeConstant] +// CHECK:STDERR: ╭─┤ fail_multi_error.carbon:[[@LINE+7]]:8 +// CHECK:STDERR: -> │ fn Boo[runtime a: ()]() {} +// CHECK:STDERR: · ━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: implicit parameters of functions must be constant +// CHECK:STDERR: · ┃ [ImplictParamMustBeConstant] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Boo[runtime a: ()]() {} diff --git a/toolchain/check/testdata/basics/name_lookup.carbon b/toolchain/check/testdata/basics/name_lookup.carbon index 0b0f4d0f44e5..34a867c3b1e5 100644 --- a/toolchain/check/testdata/basics/name_lookup.carbon +++ b/toolchain/check/testdata/basics/name_lookup.carbon @@ -16,7 +16,11 @@ library "[[@TEST_NAME]]"; fn Main() { //@dump-sem-ir-begin - // CHECK:STDERR: fail_not_found.carbon:[[@LINE+2]]:3: error: name `x` not found [NameNotFound] + // CHECK:STDERR: ╭─┤ fail_not_found.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ x; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: name `x` not found [NameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: x; //@dump-sem-ir-end @@ -28,7 +32,12 @@ library "[[@TEST_NAME]]"; fn F() { //@dump-sem-ir-begin - // CHECK:STDERR: fail_qualififier_unsupported.carbon:[[@LINE+2]]:3-8: error: type `bool` does not support qualified expressions [QualifiedExprUnsupported] + // CHECK:STDERR: ╭─┤ fail_qualififier_unsupported.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ true.b; + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: type `bool` does not support qualified expressions + // CHECK:STDERR: · ┃ [QualifiedExprUnsupported] + // CHECK:STDERR: ╰──── // CHECK:STDERR: true.b; //@dump-sem-ir-end diff --git a/toolchain/check/testdata/builtins/array/make_type.carbon b/toolchain/check/testdata/builtins/array/make_type.carbon index 4ac98232cca3..ef8beca43acb 100644 --- a/toolchain/check/testdata/builtins/array/make_type.carbon +++ b/toolchain/check/testdata/builtins/array/make_type.carbon @@ -63,7 +63,11 @@ library "[[@TEST_NAME]]"; import library "types"; -// CHECK:STDERR: fail_negative_bound.carbon:[[@LINE+2]]:8-25: error: array bound of -1 is negative [ArrayBoundNegative] +// CHECK:STDERR: ╭─┤ fail_negative_bound.carbon:[[@LINE+6]]:8 +// CHECK:STDERR: -> │ var n: MakeArray(i32, -1); +// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: array bound of -1 is negative [ArrayBoundNegative] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var n: MakeArray(i32, -1); @@ -73,7 +77,12 @@ library "[[@TEST_NAME]]"; import library "types"; -// CHECK:STDERR: fail_bound_too_large.carbon:[[@LINE+2]]:8-46: error: array bound of 18446744073709551616 is too large [ArrayBoundTooLarge] +// CHECK:STDERR: ╭─┤ fail_bound_too_large.carbon:[[@LINE+7]]:8 +// CHECK:STDERR: -> │ var n: MakeArray(i32, 0x1_0000_0000_0000_0000); +// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: array bound of 18446744073709551616 is too large +// CHECK:STDERR: · ┃ [ArrayBoundTooLarge] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var n: MakeArray(i32, 0x1_0000_0000_0000_0000); @@ -84,7 +93,12 @@ library "[[@TEST_NAME]]"; import library "types"; fn F(n: Core.IntLiteral) { - // CHECK:STDERR: fail_dyn_bound.carbon:[[@LINE+2]]:17-33: error: cannot evaluate type expression [TypeExprEvaluationFailure] + // CHECK:STDERR: ╭─┤ fail_dyn_bound.carbon:[[@LINE+7]]:17 + // CHECK:STDERR: -> │ var unused a: MakeArray(i32, n); + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot evaluate type expression + // CHECK:STDERR: · ┃ [TypeExprEvaluationFailure] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused a: MakeArray(i32, n); } diff --git a/toolchain/check/testdata/builtins/char_literal/add.carbon b/toolchain/check/testdata/builtins/char_literal/add.carbon index 7cb00f9d7bb3..e053cef6de34 100644 --- a/toolchain/check/testdata/builtins/char_literal/add.carbon +++ b/toolchain/check/testdata/builtins/char_literal/add.carbon @@ -41,22 +41,54 @@ alias IntLiteral = MakeIntLiteral(); fn AddCharInt(c: CharLiteral, n: IntLiteral) -> CharLiteral = "char_literal.add"; fn Negate(n: IntLiteral) -> IntLiteral = "int.snegate"; -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:22-54: error: character arithmetic result 4503599627370593 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult] +// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+8]]:22 +// CHECK:STDERR: -> │ let a: CharLiteral = AddCharInt('a', 0x10000000000000); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: character arithmetic result 4503599627370593 is +// CHECK:STDERR: · ┃ not a valid Unicode code point +// CHECK:STDERR: · ┃ [InvalidCharLiteralArithmeticResult] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let a: CharLiteral = AddCharInt('a', 0x10000000000000); -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+5]]:5: error: duplicate name `a` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: fail_overflow.carbon:[[@LINE-3]]:5-18: note: name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+19]]:5 +// CHECK:STDERR: │ let a: CharLiteral = AddCharInt('a', 0x10000000000000); +// CHECK:STDERR: · ───────┬────── +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ let a: CharLiteral = AddCharInt('\u{10FFFF}', 1); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `a` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:22-48: error: character arithmetic result 1114112 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult] +// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+8]]:22 +// CHECK:STDERR: -> │ let a: CharLiteral = AddCharInt('\u{10FFFF}', 1); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: character arithmetic result 1114112 is not a +// CHECK:STDERR: · ┃ valid Unicode code point +// CHECK:STDERR: · ┃ [InvalidCharLiteralArithmeticResult] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let a: CharLiteral = AddCharInt('\u{10FFFF}', 1); -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:22-46: error: character arithmetic result 55296 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult] +// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+8]]:22 +// CHECK:STDERR: -> │ let b: CharLiteral = AddCharInt('\u{D7FF}', 1); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: character arithmetic result 55296 is not a +// CHECK:STDERR: · ┃ valid Unicode code point +// CHECK:STDERR: · ┃ [InvalidCharLiteralArithmeticResult] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let b: CharLiteral = AddCharInt('\u{D7FF}', 1); -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:22-48: error: character arithmetic result -1 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult] +// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+8]]:22 +// CHECK:STDERR: -> │ let c: CharLiteral = AddCharInt('a', Negate(98)); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: character arithmetic result -1 is not a valid +// CHECK:STDERR: · ┃ Unicode code point +// CHECK:STDERR: · ┃ [InvalidCharLiteralArithmeticResult] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let c: CharLiteral = AddCharInt('a', Negate(98)); diff --git a/toolchain/check/testdata/builtins/char_literal/convert_char.carbon b/toolchain/check/testdata/builtins/char_literal/convert_char.carbon index 260baa8425bc..46aac5b89ec8 100644 --- a/toolchain/check/testdata/builtins/char_literal/convert_char.carbon +++ b/toolchain/check/testdata/builtins/char_literal/convert_char.carbon @@ -26,15 +26,30 @@ fn ToChar(c: CharLiteral) -> UInt(8) = "char_literal.convert_char"; library "[[@TEST_NAME]]"; import library "builtin"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-51: error: invalid signature for builtin function "char_literal.convert_char" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn ToCharBarResultU16(c: CharLiteral) -> UInt(16) = "char_literal.convert_char"; +// CHECK:STDERR: · ━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "char_literal.convert_char" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn ToCharBarResultU16(c: CharLiteral) -> UInt(16) = "char_literal.convert_char"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-49: error: invalid signature for builtin function "char_literal.convert_char" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn ToCharBadResultU9(c: CharLiteral) -> UInt(9) = "char_literal.convert_char"; +// CHECK:STDERR: · ━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "char_literal.convert_char" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn ToCharBadResultU9(c: CharLiteral) -> UInt(9) = "char_literal.convert_char"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-31: error: invalid signature for builtin function "char_literal.convert_char" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn ToCharNoParam() -> UInt(8) = "char_literal.convert_char"; +// CHECK:STDERR: · ━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "char_literal.convert_char" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn ToCharNoParam() -> UInt(8) = "char_literal.convert_char"; @@ -44,8 +59,18 @@ library "[[@TEST_NAME]]"; import library "builtin"; let c: CharLiteral = 'a'; -// CHECK:STDERR: fail_runtime_call.carbon:[[@LINE+3]]:18-26: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] -// CHECK:STDERR: builtin.carbon:10:1-38: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] +// CHECK:STDERR: ╭─┤ fail_runtime_call.carbon:[[@LINE+13]]:18 +// CHECK:STDERR: -> │ let d: UInt(8) = ToChar(c); +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: non-constant call to compile-time-only function +// CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ builtin.carbon +// CHECK:STDERR: │ fn ToChar(c: CharLiteral) -> UInt(8) = "char_literal.convert_char"; +// CHECK:STDERR: · ───────────────────┬────────────────── +// CHECK:STDERR: · ╰──┤ compile-time-only function declared here +// CHECK:STDERR: · │ [CompTimeOnlyFunctionHere] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let d: UInt(8) = ToChar(c); @@ -65,7 +90,13 @@ let c: UInt(8) = ToChar('\u{7F}'); library "[[@TEST_NAME]]"; import library "builtin"; -// CHECK:STDERR: fail_size_small.carbon:[[@LINE+2]]:18-33: error: character value U+0080 too large for type `` [CharTooLargeForType] +// CHECK:STDERR: ╭─┤ fail_size_small.carbon:[[@LINE+8]]:18 +// CHECK:STDERR: -> │ let c: UInt(8) = ToChar('\u{80}'); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: character value U+0080 too large for type +// CHECK:STDERR: · ┃ `` +// CHECK:STDERR: · ┃ [CharTooLargeForType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let c: UInt(8) = ToChar('\u{80}'); @@ -74,7 +105,13 @@ let c: UInt(8) = ToChar('\u{80}'); library "[[@TEST_NAME]]"; import library "builtin"; -// CHECK:STDERR: fail_size_multi_byte.carbon:[[@LINE+2]]:18-35: error: character value U+1E15 too large for type `` [CharTooLargeForType] +// CHECK:STDERR: ╭─┤ fail_size_multi_byte.carbon:[[@LINE+8]]:18 +// CHECK:STDERR: -> │ let c: UInt(8) = ToChar('\u{1E15}'); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: character value U+1E15 too large for type +// CHECK:STDERR: · ┃ `` +// CHECK:STDERR: · ┃ [CharTooLargeForType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let c: UInt(8) = ToChar('\u{1E15}'); diff --git a/toolchain/check/testdata/builtins/char_literal/convert_int.carbon b/toolchain/check/testdata/builtins/char_literal/convert_int.carbon index a4165f733274..f623d19dea4a 100644 --- a/toolchain/check/testdata/builtins/char_literal/convert_int.carbon +++ b/toolchain/check/testdata/builtins/char_literal/convert_int.carbon @@ -45,10 +45,23 @@ fn UInt(n: IntLiteral) -> type = "int.make_type_unsigned"; fn ConvertToU8(c: CharLiteral) -> UInt(8) = "char_literal.convert_int"; -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+5]]:13-34: error: character value U+0100 too large for type `` [CharTooLargeForType] +// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+18]]:13 +// CHECK:STDERR: -> │ let g: u8 = ConvertToU8('\u{100}'); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: character value U+0100 too large for type `` +// CHECK:STDERR: · ┃ [CharTooLargeForType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+3]]:13-34: error: cannot implicitly convert expression of type `` to `u8` [ConversionFailure] -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:13-34: note: type `` does not implement interface `Core.ImplicitAs(u8)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+11]]:13 +// CHECK:STDERR: -> │ let g: u8 = ConvertToU8('\u{100}'); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type +// CHECK:STDERR: · │ ┃ `` to `u8` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╰────┤ type `` does not implement interface +// CHECK:STDERR: · │ `Core.ImplicitAs(u8)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let g: u8 = ConvertToU8('\u{100}'); diff --git a/toolchain/check/testdata/builtins/char_literal/sub_int.carbon b/toolchain/check/testdata/builtins/char_literal/sub_int.carbon index ccc3da192723..76bda00b51a8 100644 --- a/toolchain/check/testdata/builtins/char_literal/sub_int.carbon +++ b/toolchain/check/testdata/builtins/char_literal/sub_int.carbon @@ -42,11 +42,23 @@ alias IntLiteral = MakeIntLiteral(); fn SubCharInt(c: CharLiteral, n: IntLiteral) -> CharLiteral = "char_literal.sub_int"; fn Negate(n: IntLiteral) -> IntLiteral = "int.snegate"; -// CHECK:STDERR: fail_invalid_result.carbon:[[@LINE+2]]:22-46: error: character arithmetic result -1 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult] +// CHECK:STDERR: ╭─┤ fail_invalid_result.carbon:[[@LINE+8]]:22 +// CHECK:STDERR: -> │ let a: CharLiteral = SubCharInt('\u{0000}', 1); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: character arithmetic result -1 is not a valid +// CHECK:STDERR: · ┃ Unicode code point +// CHECK:STDERR: · ┃ [InvalidCharLiteralArithmeticResult] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let a: CharLiteral = SubCharInt('\u{0000}', 1); -// CHECK:STDERR: fail_invalid_result.carbon:[[@LINE+2]]:22-56: error: character arithmetic result 1114112 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult] +// CHECK:STDERR: ╭─┤ fail_invalid_result.carbon:[[@LINE+8]]:22 +// CHECK:STDERR: -> │ let b: CharLiteral = SubCharInt('\u{10FFFF}', Negate(1)); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: character arithmetic result 1114112 is not a +// CHECK:STDERR: · ┃ valid Unicode code point +// CHECK:STDERR: · ┃ [InvalidCharLiteralArithmeticResult] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let b: CharLiteral = SubCharInt('\u{10FFFF}', Negate(1)); diff --git a/toolchain/check/testdata/builtins/cpp/std/initializer_list/make.carbon b/toolchain/check/testdata/builtins/cpp/std/initializer_list/make.carbon index fbf742e49e96..2c440f1d6240 100644 --- a/toolchain/check/testdata/builtins/cpp/std/initializer_list/make.carbon +++ b/toolchain/check/testdata/builtins/cpp/std/initializer_list/make.carbon @@ -58,10 +58,24 @@ library "[[@TEST_NAME]]"; class FailIncomplete; -// CHECK:STDERR: fail_incomplete.carbon:[[@LINE+5]]:17-33: error: function returns incomplete type `FailIncomplete` [IncompleteTypeInFunctionReturnType] -// CHECK:STDERR: fail_incomplete.carbon:[[@LINE-3]]:1-21: note: class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: ╭─┤ fail_incomplete.carbon:[[@LINE+19]]:17 +// CHECK:STDERR: │ class FailIncomplete; +// CHECK:STDERR: · ──────────┬────────── +// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn Make(n: i32) -> FailIncomplete = "cpp.std.initializer_list.make"; +// CHECK:STDERR: · ━━━┳━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: function returns incomplete type `FailIncomplete` +// CHECK:STDERR: · ┃ [IncompleteTypeInFunctionReturnType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_incomplete.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "cpp.std.initializer_list.make" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_incomplete.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ fn Make(n: i32) -> FailIncomplete = "cpp.std.initializer_list.make"; +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function +// CHECK:STDERR: · ┃ "cpp.std.initializer_list.make" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Make(n: i32) -> FailIncomplete = "cpp.std.initializer_list.make"; @@ -74,7 +88,13 @@ class FailWrongArg { var end: i32*; } -// CHECK:STDERR: fail_wrong_arg.carbon:[[@LINE+2]]:1-33: error: invalid signature for builtin function "cpp.std.initializer_list.make" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_wrong_arg.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ fn Make(n: i32) -> FailWrongArg = "cpp.std.initializer_list.make"; +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function +// CHECK:STDERR: · ┃ "cpp.std.initializer_list.make" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Make(n: i32) -> FailWrongArg = "cpp.std.initializer_list.make"; @@ -87,7 +107,13 @@ class FailWrongArgCount { var end: i32*; } -// CHECK:STDERR: fail_wrong_arg_count.carbon:[[@LINE+2]]:1-58: error: invalid signature for builtin function "cpp.std.initializer_list.make" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_wrong_arg_count.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ fn Make(arr: array(i32, 3), n: i32) -> FailWrongArgCount = "cpp.std.initia... +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function +// CHECK:STDERR: · ┃ "cpp.std.initializer_list.make" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Make(arr: array(i32, 3), n: i32) -> FailWrongArgCount = "cpp.std.initializer_list.make"; @@ -95,7 +121,13 @@ fn Make(arr: array(i32, 3), n: i32) -> FailWrongArgCount = "cpp.std.initializer_ library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_not_a_class.carbon:[[@LINE+2]]:1-36: error: invalid signature for builtin function "cpp.std.initializer_list.make" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_not_a_class.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ fn Make(arr: array(i32, 3)) -> i32 = "cpp.std.initializer_list.make"; +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function +// CHECK:STDERR: · ┃ "cpp.std.initializer_list.make" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Make(arr: array(i32, 3)) -> i32 = "cpp.std.initializer_list.make"; @@ -107,7 +139,13 @@ class FailWrongFieldCount { var start: i32*; } -// CHECK:STDERR: fail_wrong_field_count.carbon:[[@LINE+2]]:1-52: error: invalid signature for builtin function "cpp.std.initializer_list.make" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_wrong_field_count.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ fn Make(arr: array(i32, 3)) -> FailWrongFieldCount = "cpp.std.initializer_... +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function +// CHECK:STDERR: · ┃ "cpp.std.initializer_list.make" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Make(arr: array(i32, 3)) -> FailWrongFieldCount = "cpp.std.initializer_list.make"; @@ -120,7 +158,13 @@ class FailWrongFirstField { var end: i32; } -// CHECK:STDERR: fail_wrong_first_field.carbon:[[@LINE+2]]:1-52: error: invalid signature for builtin function "cpp.std.initializer_list.make" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_wrong_first_field.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ fn Make(arr: array(i32, 3)) -> FailWrongFirstField = "cpp.std.initializer_... +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function +// CHECK:STDERR: · ┃ "cpp.std.initializer_list.make" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Make(arr: array(i32, 3)) -> FailWrongFirstField = "cpp.std.initializer_list.make"; @@ -133,6 +177,12 @@ class FailWrongSecondField { var end: {.a: i32}; } -// CHECK:STDERR: fail_wrong_second_field.carbon:[[@LINE+2]]:1-53: error: invalid signature for builtin function "cpp.std.initializer_list.make" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_wrong_second_field.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ fn Make(arr: array(i32, 3)) -> FailWrongSecondField = "cpp.std.initializer... +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function +// CHECK:STDERR: · ┃ "cpp.std.initializer_list.make" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Make(arr: array(i32, 3)) -> FailWrongSecondField = "cpp.std.initializer_list.make"; diff --git a/toolchain/check/testdata/builtins/float/add.carbon b/toolchain/check/testdata/builtins/float/add.carbon index a5f46e6d84f1..7d7493a55652 100644 --- a/toolchain/check/testdata/builtins/float/add.carbon +++ b/toolchain/check/testdata/builtins/float/add.carbon @@ -28,13 +28,28 @@ var x: f64 = Add(2.2, 2.3); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-26: error: invalid signature for builtin function "float.add" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn TooFew(a: f64) -> f64 = "float.add"; +// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.add" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn TooFew(a: f64) -> f64 = "float.add"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-43: error: invalid signature for builtin function "float.add" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.add"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.add" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.add"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-42: error: invalid signature for builtin function "float.add" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn BadReturnType(a: f64, b: f64) -> bool = "float.add"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.add" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn BadReturnType(a: f64, b: f64) -> bool = "float.add"; fn JustRight(a: f64, b: f64) -> f64 = "float.add"; diff --git a/toolchain/check/testdata/builtins/float/add_assign.carbon b/toolchain/check/testdata/builtins/float/add_assign.carbon index 7c211b362d2c..a084fb3d521f 100644 --- a/toolchain/check/testdata/builtins/float/add_assign.carbon +++ b/toolchain/check/testdata/builtins/float/add_assign.carbon @@ -24,11 +24,21 @@ fn Call(ref a: f64, b: f64) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "float.add_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn NotRef(a: f64, b: f64) = "float.add_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.add_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn NotRef(a: f64, b: f64) = "float.add_assign"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "float.add_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn MixedTypes(ref a: f64, b: f32) = "float.add_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.add_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn MixedTypes(ref a: f64, b: f32) = "float.add_assign"; @@ -37,6 +47,11 @@ fn MixedTypes(ref a: f64, b: f32) = "float.add_assign"; library "[[@TEST_NAME]]"; fn Literal() -> type = "float_literal.make_type"; -// CHECK:STDERR: fail_literal.carbon:[[@LINE+2]]:1-51: error: invalid signature for builtin function "float.add_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_literal.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn LiteralRuntime(ref a: Literal(), b: Literal()) = "float.add_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.add_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn LiteralRuntime(ref a: Literal(), b: Literal()) = "float.add_assign"; diff --git a/toolchain/check/testdata/builtins/float/convert_checked.carbon b/toolchain/check/testdata/builtins/float/convert_checked.carbon index 36bf018f65bb..09db74ef959a 100644 --- a/toolchain/check/testdata/builtins/float/convert_checked.carbon +++ b/toolchain/check/testdata/builtins/float/convert_checked.carbon @@ -110,13 +110,29 @@ import library "f32"; import library "f64"; //@dump-sem-ir-begin -// CHECK:STDERR: fail_truncate_overflow.carbon:[[@LINE+2]]:14-37: error: value 9.9999999999999994E+38 too large for floating-point type `f32` [FloatTooLargeForType] +// CHECK:STDERR: ╭─┤ fail_truncate_overflow.carbon:[[@LINE+8]]:14 +// CHECK:STDERR: -> │ let a: f32 = Float64ToFloat32(1.0e39); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: value 9.9999999999999994E+38 too large for +// CHECK:STDERR: · ┃ floating-point type `f32` +// CHECK:STDERR: · ┃ [FloatTooLargeForType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let a: f32 = Float64ToFloat32(1.0e39); -// CHECK:STDERR: fail_truncate_overflow.carbon:[[@LINE+2]]:14-42: error: value 10*10^38 too large for floating-point type `f32` [FloatLiteralTooLargeForType] +// CHECK:STDERR: ╭─┤ fail_truncate_overflow.carbon:[[@LINE+7]]:14 +// CHECK:STDERR: -> │ let b: f32 = FloatLiteralToFloat32(1.0e39); +// CHECK:STDERR: · ━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: value 10*10^38 too large for floating-point type `f32` +// CHECK:STDERR: · ┃ [FloatLiteralTooLargeForType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let b: f32 = FloatLiteralToFloat32(1.0e39); -// CHECK:STDERR: fail_truncate_overflow.carbon:[[@LINE+2]]:14-43: error: value 10*10^308 too large for floating-point type `f64` [FloatLiteralTooLargeForType] +// CHECK:STDERR: ╭─┤ fail_truncate_overflow.carbon:[[@LINE+7]]:14 +// CHECK:STDERR: -> │ let c: f64 = FloatLiteralToFloat64(1.0e309); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: value 10*10^308 too large for floating-point type `f64` +// CHECK:STDERR: · ┃ [FloatLiteralTooLargeForType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let c: f64 = FloatLiteralToFloat64(1.0e309); //@dump-sem-ir-end @@ -138,8 +154,19 @@ import library "f64"; //@dump-sem-ir-begin let not_constant_64: f64 = 0.0; -// CHECK:STDERR: fail_not_constant.carbon:[[@LINE+3]]:33-65: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] -// CHECK:STDERR: f64.carbon:5:1-36: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] +// CHECK:STDERR: ╭─┤ fail_not_constant.carbon:[[@LINE+14]]:33 +// CHECK:STDERR: -> │ let convert_not_constant: f64 = Float64ToFloat64(not_constant_64); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: non-constant call to +// CHECK:STDERR: · ┃ compile-time-only function +// CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ f64.carbon +// CHECK:STDERR: │ fn Float64ToFloat64(a: f64) -> f64 = "float.convert_checked"; +// CHECK:STDERR: · ──────────────────┬───────────────── +// CHECK:STDERR: · ╰──┤ compile-time-only function declared here +// CHECK:STDERR: · │ [CompTimeOnlyFunctionHere] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let convert_not_constant: f64 = Float64ToFloat64(not_constant_64); //@dump-sem-ir-end @@ -614,24 +641,24 @@ let convert_not_constant: f64 = Float64ToFloat64(not_constant_64); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { -// CHECK:STDOUT: %.loc9_37.1: %f32.3bc = value_of_initializer @__global_init.%Float64ToFloat32.call [concrete = ] -// CHECK:STDOUT: %.loc9_37.2: %f32.3bc = converted @__global_init.%Float64ToFloat32.call, %.loc9_37.1 [concrete = ] -// CHECK:STDOUT: %f32.loc9: type = type_literal constants.%f32.3bc [concrete = constants.%f32.3bc] -// CHECK:STDOUT: %a: %f32.3bc = wrapper_binding a, %.loc9_37.2 [concrete = ] +// CHECK:STDOUT: %.loc15_37.1: %f32.3bc = value_of_initializer @__global_init.%Float64ToFloat32.call [concrete = ] +// CHECK:STDOUT: %.loc15_37.2: %f32.3bc = converted @__global_init.%Float64ToFloat32.call, %.loc15_37.1 [concrete = ] +// CHECK:STDOUT: %f32.loc15: type = type_literal constants.%f32.3bc [concrete = constants.%f32.3bc] +// CHECK:STDOUT: %a: %f32.3bc = wrapper_binding a, %.loc15_37.2 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %a.patt: %pattern_type.239 = value_binding_pattern a [concrete = constants.%a.patt.56d] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc12_42.1: %f32.3bc = value_of_initializer @__global_init.%FloatLiteralToFloat32.call [concrete = ] -// CHECK:STDOUT: %.loc12_42.2: %f32.3bc = converted @__global_init.%FloatLiteralToFloat32.call, %.loc12_42.1 [concrete = ] -// CHECK:STDOUT: %f32.loc12: type = type_literal constants.%f32.3bc [concrete = constants.%f32.3bc] -// CHECK:STDOUT: %b: %f32.3bc = wrapper_binding b, %.loc12_42.2 [concrete = ] +// CHECK:STDOUT: %.loc23_42.1: %f32.3bc = value_of_initializer @__global_init.%FloatLiteralToFloat32.call [concrete = ] +// CHECK:STDOUT: %.loc23_42.2: %f32.3bc = converted @__global_init.%FloatLiteralToFloat32.call, %.loc23_42.1 [concrete = ] +// CHECK:STDOUT: %f32.loc23: type = type_literal constants.%f32.3bc [concrete = constants.%f32.3bc] +// CHECK:STDOUT: %b: %f32.3bc = wrapper_binding b, %.loc23_42.2 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %b.patt: %pattern_type.239 = value_binding_pattern b [concrete = constants.%b.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc15_43.1: %f64.761 = value_of_initializer @__global_init.%FloatLiteralToFloat64.call [concrete = ] -// CHECK:STDOUT: %.loc15_43.2: %f64.761 = converted @__global_init.%FloatLiteralToFloat64.call, %.loc15_43.1 [concrete = ] +// CHECK:STDOUT: %.loc31_43.1: %f64.761 = value_of_initializer @__global_init.%FloatLiteralToFloat64.call [concrete = ] +// CHECK:STDOUT: %.loc31_43.2: %f64.761 = converted @__global_init.%FloatLiteralToFloat64.call, %.loc31_43.1 [concrete = ] // CHECK:STDOUT: %f64: type = type_literal constants.%f64.761 [concrete = constants.%f64.761] -// CHECK:STDOUT: %c: %f64.761 = wrapper_binding c, %.loc15_43.2 [concrete = ] +// CHECK:STDOUT: %c: %f64.761 = wrapper_binding c, %.loc31_43.2 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %c.patt: %pattern_type.667 = value_binding_pattern c [concrete = constants.%c.patt] // CHECK:STDOUT: } @@ -640,21 +667,21 @@ let convert_not_constant: f64 = Float64ToFloat64(not_constant_64); // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Float64ToFloat32.ref: %Float64ToFloat32.type = name_ref Float64ToFloat32, imports.%Main.Float64ToFloat32 [concrete = constants.%Float64ToFloat32] -// CHECK:STDOUT: %float.loc9: Core.FloatLiteral = float_literal_value 10e38 [concrete = constants.%float.cfcfd2.1] +// CHECK:STDOUT: %float.loc15: Core.FloatLiteral = float_literal_value 10e38 [concrete = constants.%float.cfcfd2.1] // CHECK:STDOUT: %impl.elem0: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0] -// CHECK:STDOUT: %bound_method.loc9_31.1: = bound_method %float.loc9, %impl.elem0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %bound_method.loc15_31.1: = bound_method %float.loc15, %impl.elem0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound] // CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc9_31.2: = bound_method %float.loc9, %specific_fn [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call: init %f64.761 = call %bound_method.loc9_31.2(%float.loc9) [concrete = constants.%float.8d8] -// CHECK:STDOUT: %.loc9_31.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%float.8d8] -// CHECK:STDOUT: %.loc9_31.2: %f64.761 = converted %float.loc9, %.loc9_31.1 [concrete = constants.%float.8d8] -// CHECK:STDOUT: %Float64ToFloat32.call: init %f32.3bc = call %Float64ToFloat32.ref(%.loc9_31.2) [concrete = ] +// CHECK:STDOUT: %bound_method.loc15_31.2: = bound_method %float.loc15, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call: init %f64.761 = call %bound_method.loc15_31.2(%float.loc15) [concrete = constants.%float.8d8] +// CHECK:STDOUT: %.loc15_31.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%float.8d8] +// CHECK:STDOUT: %.loc15_31.2: %f64.761 = converted %float.loc15, %.loc15_31.1 [concrete = constants.%float.8d8] +// CHECK:STDOUT: %Float64ToFloat32.call: init %f32.3bc = call %Float64ToFloat32.ref(%.loc15_31.2) [concrete = ] // CHECK:STDOUT: %FloatLiteralToFloat32.ref: %FloatLiteralToFloat32.type = name_ref FloatLiteralToFloat32, imports.%Main.FloatLiteralToFloat32 [concrete = constants.%FloatLiteralToFloat32] -// CHECK:STDOUT: %float.loc12: Core.FloatLiteral = float_literal_value 10e38 [concrete = constants.%float.cfcfd2.2] -// CHECK:STDOUT: %FloatLiteralToFloat32.call: init %f32.3bc = call %FloatLiteralToFloat32.ref(%float.loc12) [concrete = ] +// CHECK:STDOUT: %float.loc23: Core.FloatLiteral = float_literal_value 10e38 [concrete = constants.%float.cfcfd2.2] +// CHECK:STDOUT: %FloatLiteralToFloat32.call: init %f32.3bc = call %FloatLiteralToFloat32.ref(%float.loc23) [concrete = ] // CHECK:STDOUT: %FloatLiteralToFloat64.ref: %FloatLiteralToFloat64.type = name_ref FloatLiteralToFloat64, imports.%Main.FloatLiteralToFloat64 [concrete = constants.%FloatLiteralToFloat64] -// CHECK:STDOUT: %float.loc15: Core.FloatLiteral = float_literal_value 10e308 [concrete = constants.%float.82f] -// CHECK:STDOUT: %FloatLiteralToFloat64.call: init %f64.761 = call %FloatLiteralToFloat64.ref(%float.loc15) [concrete = ] +// CHECK:STDOUT: %float.loc31: Core.FloatLiteral = float_literal_value 10e308 [concrete = constants.%float.82f] +// CHECK:STDOUT: %FloatLiteralToFloat64.call: init %f64.761 = call %FloatLiteralToFloat64.ref(%float.loc31) [concrete = ] // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: @@ -789,10 +816,10 @@ let convert_not_constant: f64 = Float64ToFloat64(not_constant_64); // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %not_constant_64.patt: %pattern_type.667 = value_binding_pattern not_constant_64 [concrete = constants.%not_constant_64.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc10_65.1: %f64.761 = value_of_initializer @__global_init.%Float64ToFloat64.call -// CHECK:STDOUT: %.loc10_65.2: %f64.761 = converted @__global_init.%Float64ToFloat64.call, %.loc10_65.1 -// CHECK:STDOUT: %f64.loc10: type = type_literal constants.%f64.761 [concrete = constants.%f64.761] -// CHECK:STDOUT: %convert_not_constant: %f64.761 = wrapper_binding convert_not_constant, %.loc10_65.2 +// CHECK:STDOUT: %.loc21_65.1: %f64.761 = value_of_initializer @__global_init.%Float64ToFloat64.call +// CHECK:STDOUT: %.loc21_65.2: %f64.761 = converted @__global_init.%Float64ToFloat64.call, %.loc21_65.1 +// CHECK:STDOUT: %f64.loc21: type = type_literal constants.%f64.761 [concrete = constants.%f64.761] +// CHECK:STDOUT: %convert_not_constant: %f64.761 = wrapper_binding convert_not_constant, %.loc21_65.2 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %convert_not_constant.patt: %pattern_type.667 = value_binding_pattern convert_not_constant [concrete = constants.%convert_not_constant.patt] // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/builtins/float/convert_int.carbon b/toolchain/check/testdata/builtins/float/convert_int.carbon index faa7b45bc4be..0e432eb01ce7 100644 --- a/toolchain/check/testdata/builtins/float/convert_int.carbon +++ b/toolchain/check/testdata/builtins/float/convert_int.carbon @@ -96,74 +96,178 @@ library "[[@TEST_NAME]]"; import library "float_to_int"; //@dump-sem-ir-begin -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:21-49: error: floating-point value 2147483648 too large for integer type `i32` [FloatTooLargeForIntType] +// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+8]]:21 +// CHECK:STDERR: -> │ let overflow: i32 = ConvertF64ToI32(2147483648.0); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: floating-point value 2147483648 too large for +// CHECK:STDERR: · ┃ integer type `i32` +// CHECK:STDERR: · ┃ [FloatTooLargeForIntType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let overflow: i32 = ConvertF64ToI32(2147483648.0); -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:22-58: error: floating-point value -2147483649 too large for integer type `i32` [FloatTooLargeForIntType] +// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+8]]:22 +// CHECK:STDERR: -> │ let underflow: i32 = ConvertF64ToI32(Negate(2147483649.0)); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: floating-point value -2147483649 too large for +// CHECK:STDERR: · ┃ integer type `i32` +// CHECK:STDERR: · ┃ [FloatTooLargeForIntType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let underflow: i32 = ConvertF64ToI32(Negate(2147483649.0)); -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:25-52: error: floating-point value -1 too large for integer type `u32` [FloatTooLargeForIntType] +// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+8]]:25 +// CHECK:STDERR: -> │ let unsigned_neg: u32 = ConvertF64ToU32(Negate(1.0)); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: floating-point value -1 too large for +// CHECK:STDERR: · ┃ integer type `u32` +// CHECK:STDERR: · ┃ [FloatTooLargeForIntType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let unsigned_neg: u32 = ConvertF64ToU32(Negate(1.0)); -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:29-66: error: floating-point value 21474836480*10^-1 too large for integer type `i32` [RealLiteralTooLargeForIntType] +// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+8]]:29 +// CHECK:STDERR: -> │ let literal_overflow: i32 = ConvertFloatLiteralToI32(2147483648.0); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: floating-point value 21474836480*10^-1 +// CHECK:STDERR: · ┃ too large for integer type `i32` +// CHECK:STDERR: · ┃ [RealLiteralTooLargeForIntType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let literal_overflow: i32 = ConvertFloatLiteralToI32(2147483648.0); -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:35-71: error: floating-point value 10*10^999999 too large for integer type `i32` [RealLiteralTooLargeForIntType] +// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+8]]:35 +// CHECK:STDERR: -> │ let giant_literal_overflow: i32 = ConvertFloatLiteralToI32(1.0e1000000); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: floating-point value 10*10^999999 +// CHECK:STDERR: · ┃ too large for integer type `i32` +// CHECK:STDERR: · ┃ [RealLiteralTooLargeForIntType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let giant_literal_overflow: i32 = ConvertFloatLiteralToI32(1.0e1000000); // -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:62-106: error: floating-point value 10*10^9999999 too large to convert: result would be an integer whose width is greater than the maximum supported width of 8388608 [RealLiteralTooLargeForUnsizedInt] +// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+11]]:62 +// CHECK:STDERR: -> │ ...overflow: Core.IntLiteral = ConvertFloatLiteralToIntLiteral(1.0e10000000); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: floating-point value 10*10^9999999 +// CHECK:STDERR: · ┃ too large to convert: result would be +// CHECK:STDERR: · ┃ an integer whose width is greater +// CHECK:STDERR: · ┃ than the maximum supported width of +// CHECK:STDERR: · ┃ 8388608 +// CHECK:STDERR: · ┃ [RealLiteralTooLargeForUnsizedInt] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let giant_literal_to_int_literal_overflow: Core.IntLiteral = ConvertFloatLiteralToIntLiteral(1.0e10000000); // -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:44-107: error: floating-point value 10*10^999999999999999999999999999999999 too large for integer type `i32` [RealLiteralTooLargeForIntType] +// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+9]]:44 +// CHECK:STDERR: -> │ ...l_overflow: i32 = ConvertFloatLiteralToI32(1.0e100000000000000000000000000... +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: floating-point value +// CHECK:STDERR: · ┃ 10*10^999999999999999999999999999999999 too +// CHECK:STDERR: · ┃ large for integer type `i32` +// CHECK:STDERR: · ┃ [RealLiteralTooLargeForIntType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let giant_exponent_literal_overflow: i32 = ConvertFloatLiteralToI32(1.0e1000000000000000000000000000000000); // // -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:71-141: error: floating-point value 10*10^999999999999999999999999999999999 too large to convert: result would be an integer whose width is greater than the maximum supported width of 8388608 [RealLiteralTooLargeForUnsizedInt] +// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+11]]:71 +// CHECK:STDERR: -> │ ...Core.IntLiteral = ConvertFloatLiteralToIntLiteral(1.0e10000000000000000000... +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: floating-point value +// CHECK:STDERR: · ┃ 10*10^999999999999999999999999999999999 too +// CHECK:STDERR: · ┃ large to convert: result would be an integer +// CHECK:STDERR: · ┃ whose width is greater than the maximum +// CHECK:STDERR: · ┃ supported width of 8388608 +// CHECK:STDERR: · ┃ [RealLiteralTooLargeForUnsizedInt] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let giant_exponent_literal_to_int_literal_overflow: Core.IntLiteral = ConvertFloatLiteralToIntLiteral(1.0e1000000000000000000000000000000000); // -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:44-82: error: floating-point value 2147483648*10^0 too large for integer type `i32` [RealLiteralTooLargeForIntType] +// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+9]]:44 +// CHECK:STDERR: -> │ ...al_overflow_large_mantissa: i32 = ConvertFloatLiteralToI32(214748364.8e1); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: floating-point value +// CHECK:STDERR: · ┃ 2147483648*10^0 too large for +// CHECK:STDERR: · ┃ integer type `i32` +// CHECK:STDERR: · ┃ [RealLiteralTooLargeForIntType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let literal_overflow_large_mantissa: i32 = ConvertFloatLiteralToI32(214748364.8e1); // -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:42-80: error: floating-point value 2147483648*10^0 too large for integer type `i32` [RealLiteralTooLargeForIntType] +// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+9]]:42 +// CHECK:STDERR: -> │ ...eral_overflow_med_mantissa: i32 = ConvertFloatLiteralToI32(21474.83648e5); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: floating-point value +// CHECK:STDERR: · ┃ 2147483648*10^0 too large for +// CHECK:STDERR: · ┃ integer type `i32` +// CHECK:STDERR: · ┃ [RealLiteralTooLargeForIntType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let literal_overflow_med_mantissa: i32 = ConvertFloatLiteralToI32(21474.83648e5); // -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:46-85: error: floating-point value 2147483648*2^0 too large for integer type `i32` [RealLiteralTooLargeForIntType] +// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+9]]:46 +// CHECK:STDERR: -> │ ...overflow_hex_med_mantissa: i32 = ConvertFloatLiteralToI32(0x8000.0000p16); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: floating-point value +// CHECK:STDERR: · ┃ 2147483648*2^0 too large for +// CHECK:STDERR: · ┃ integer type `i32` +// CHECK:STDERR: · ┃ [RealLiteralTooLargeForIntType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let literal_overflow_hex_med_mantissa: i32 = ConvertFloatLiteralToI32(0x8000.0000p16); // -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:44-75: error: floating-point value 10*10^9 too large for integer type `i32` [RealLiteralTooLargeForIntType] +// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+9]]:44 +// CHECK:STDERR: -> │ let literal_overflow_small_mantissa: i32 = ConvertFloatLiteralToI32(1.0e10); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: floating-point value +// CHECK:STDERR: · ┃ 10*10^9 too large for +// CHECK:STDERR: · ┃ integer type `i32` +// CHECK:STDERR: · ┃ [RealLiteralTooLargeForIntType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let literal_overflow_small_mantissa: i32 = ConvertFloatLiteralToI32(1.0e10); // -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:48-81: error: floating-point value 16*2^27 too large for integer type `i32` [RealLiteralTooLargeForIntType] +// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+9]]:48 +// CHECK:STDERR: -> │ ...ral_overflow_bin_small_mantissa: i32 = ConvertFloatLiteralToI32(0x1.0p31); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: floating-point value +// CHECK:STDERR: · ┃ 16*2^27 too large for +// CHECK:STDERR: · ┃ integer type `i32` +// CHECK:STDERR: · ┃ [RealLiteralTooLargeForIntType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let literal_overflow_bin_small_mantissa: i32 = ConvertFloatLiteralToI32(0x1.0p31); // -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:42-72: error: floating-point value 50*10^8 too large for integer type `u32` [RealLiteralTooLargeForIntType] +// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+9]]:42 +// CHECK:STDERR: -> │ let literal_overflow_unsigned_neg: u32 = ConvertFloatLiteralToU32(5.0e9); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: floating-point value +// CHECK:STDERR: · ┃ 50*10^8 too large for +// CHECK:STDERR: · ┃ integer type `u32` +// CHECK:STDERR: · ┃ [RealLiteralTooLargeForIntType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let literal_overflow_unsigned_neg: u32 = ConvertFloatLiteralToU32(5.0e9); // -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:46-79: error: floating-point value 16*2^28 too large for integer type `u32` [RealLiteralTooLargeForIntType] +// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+9]]:46 +// CHECK:STDERR: -> │ let literal_overflow_bin_unsigned_neg: u32 = ConvertFloatLiteralToU32(0x1.0p32); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: floating-point value +// CHECK:STDERR: · ┃ 16*2^28 too large for +// CHECK:STDERR: · ┃ integer type `u32` +// CHECK:STDERR: · ┃ [RealLiteralTooLargeForIntType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let literal_overflow_bin_unsigned_neg: u32 = ConvertFloatLiteralToU32(0x1.0p32); //@dump-sem-ir-end @@ -173,11 +277,21 @@ library "[[@TEST_NAME]]"; import library "float_to_int"; //@dump-sem-ir-begin -// CHECK:STDERR: fail_nan_inf.carbon:[[@LINE+2]]:20-49: error: cannot convert NaN to integer type `i32` [FloatNaNConvertedToInt] +// CHECK:STDERR: ╭─┤ fail_nan_inf.carbon:[[@LINE+7]]:20 +// CHECK:STDERR: -> │ let nan_val: i32 = ConvertF64ToI32(Div(0.0, 0.0)); +// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot convert NaN to integer type `i32` +// CHECK:STDERR: · ┃ [FloatNaNConvertedToInt] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let nan_val: i32 = ConvertF64ToI32(Div(0.0, 0.0)); -// CHECK:STDERR: fail_nan_inf.carbon:[[@LINE+2]]:20-49: error: cannot convert infinity to integer type `i32` [FloatInfinityConvertedToInt] +// CHECK:STDERR: ╭─┤ fail_nan_inf.carbon:[[@LINE+7]]:20 +// CHECK:STDERR: -> │ let inf_val: i32 = ConvertF64ToI32(Div(1.0, 0.0)); +// CHECK:STDERR: · ━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot convert infinity to integer type `i32` +// CHECK:STDERR: · ┃ [FloatInfinityConvertedToInt] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let inf_val: i32 = ConvertF64ToI32(Div(1.0, 0.0)); //@dump-sem-ir-end @@ -290,114 +404,114 @@ let inf_val: i32 = ConvertF64ToI32(Div(1.0, 0.0)); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { -// CHECK:STDOUT: %.loc7_49.1: %i32 = value_of_initializer @__global_init.%ConvertF64ToI32.call.loc7 [concrete = ] -// CHECK:STDOUT: %.loc7_49.2: %i32 = converted @__global_init.%ConvertF64ToI32.call.loc7, %.loc7_49.1 [concrete = ] -// CHECK:STDOUT: %i32.loc7: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %overflow: %i32 = wrapper_binding overflow, %.loc7_49.2 [concrete = ] +// CHECK:STDOUT: %.loc13_49.1: %i32 = value_of_initializer @__global_init.%ConvertF64ToI32.call.loc13 [concrete = ] +// CHECK:STDOUT: %.loc13_49.2: %i32 = converted @__global_init.%ConvertF64ToI32.call.loc13, %.loc13_49.1 [concrete = ] +// CHECK:STDOUT: %i32.loc13: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %overflow: %i32 = wrapper_binding overflow, %.loc13_49.2 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %overflow.patt: %pattern_type.d94 = value_binding_pattern overflow [concrete = constants.%overflow.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc11_58.1: %i32 = value_of_initializer @__global_init.%ConvertF64ToI32.call.loc11 [concrete = ] -// CHECK:STDOUT: %.loc11_58.2: %i32 = converted @__global_init.%ConvertF64ToI32.call.loc11, %.loc11_58.1 [concrete = ] -// CHECK:STDOUT: %i32.loc11: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %underflow: %i32 = wrapper_binding underflow, %.loc11_58.2 [concrete = ] +// CHECK:STDOUT: %.loc23_58.1: %i32 = value_of_initializer @__global_init.%ConvertF64ToI32.call.loc23 [concrete = ] +// CHECK:STDOUT: %.loc23_58.2: %i32 = converted @__global_init.%ConvertF64ToI32.call.loc23, %.loc23_58.1 [concrete = ] +// CHECK:STDOUT: %i32.loc23: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %underflow: %i32 = wrapper_binding underflow, %.loc23_58.2 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %underflow.patt: %pattern_type.d94 = value_binding_pattern underflow [concrete = constants.%underflow.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc15_52.1: %u32 = value_of_initializer @__global_init.%ConvertF64ToU32.call [concrete = ] -// CHECK:STDOUT: %.loc15_52.2: %u32 = converted @__global_init.%ConvertF64ToU32.call, %.loc15_52.1 [concrete = ] -// CHECK:STDOUT: %u32.loc15: type = type_literal constants.%u32 [concrete = constants.%u32] -// CHECK:STDOUT: %unsigned_neg: %u32 = wrapper_binding unsigned_neg, %.loc15_52.2 [concrete = ] +// CHECK:STDOUT: %.loc33_52.1: %u32 = value_of_initializer @__global_init.%ConvertF64ToU32.call [concrete = ] +// CHECK:STDOUT: %.loc33_52.2: %u32 = converted @__global_init.%ConvertF64ToU32.call, %.loc33_52.1 [concrete = ] +// CHECK:STDOUT: %u32.loc33: type = type_literal constants.%u32 [concrete = constants.%u32] +// CHECK:STDOUT: %unsigned_neg: %u32 = wrapper_binding unsigned_neg, %.loc33_52.2 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %unsigned_neg.patt: %pattern_type.129 = value_binding_pattern unsigned_neg [concrete = constants.%unsigned_neg.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc19_66.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc19 [concrete = ] -// CHECK:STDOUT: %.loc19_66.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc19, %.loc19_66.1 [concrete = ] -// CHECK:STDOUT: %i32.loc19: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %literal_overflow: %i32 = wrapper_binding literal_overflow, %.loc19_66.2 [concrete = ] +// CHECK:STDOUT: %.loc43_66.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc43 [concrete = ] +// CHECK:STDOUT: %.loc43_66.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc43, %.loc43_66.1 [concrete = ] +// CHECK:STDOUT: %i32.loc43: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %literal_overflow: %i32 = wrapper_binding literal_overflow, %.loc43_66.2 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %literal_overflow.patt: %pattern_type.d94 = value_binding_pattern literal_overflow [concrete = constants.%literal_overflow.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc23_71.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc23 [concrete = ] -// CHECK:STDOUT: %.loc23_71.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc23, %.loc23_71.1 [concrete = ] -// CHECK:STDOUT: %i32.loc23: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %giant_literal_overflow: %i32 = wrapper_binding giant_literal_overflow, %.loc23_71.2 [concrete = ] +// CHECK:STDOUT: %.loc53_71.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc53 [concrete = ] +// CHECK:STDOUT: %.loc53_71.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc53, %.loc53_71.1 [concrete = ] +// CHECK:STDOUT: %i32.loc53: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %giant_literal_overflow: %i32 = wrapper_binding giant_literal_overflow, %.loc53_71.2 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %giant_literal_overflow.patt: %pattern_type.d94 = value_binding_pattern giant_literal_overflow [concrete = constants.%giant_literal_overflow.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc28_106.1: Core.IntLiteral = value_of_initializer @__global_init.%ConvertFloatLiteralToIntLiteral.call.loc28 [concrete = ] -// CHECK:STDOUT: %.loc28_106.2: Core.IntLiteral = converted @__global_init.%ConvertFloatLiteralToIntLiteral.call.loc28, %.loc28_106.1 [concrete = ] -// CHECK:STDOUT: %.loc28_48: type = splice_block %IntLiteral.ref.loc28 [concrete = Core.IntLiteral] { -// CHECK:STDOUT: %Core.ref.loc28: = name_ref Core, imports.%Core.048aa3.1 [concrete = imports.%Core.048aa3.1] -// CHECK:STDOUT: %IntLiteral.ref.loc28: type = name_ref IntLiteral, imports.%Core.IntLiteral [concrete = Core.IntLiteral] +// CHECK:STDOUT: %.loc67_106.1: Core.IntLiteral = value_of_initializer @__global_init.%ConvertFloatLiteralToIntLiteral.call.loc67 [concrete = ] +// CHECK:STDOUT: %.loc67_106.2: Core.IntLiteral = converted @__global_init.%ConvertFloatLiteralToIntLiteral.call.loc67, %.loc67_106.1 [concrete = ] +// CHECK:STDOUT: %.loc67_48: type = splice_block %IntLiteral.ref.loc67 [concrete = Core.IntLiteral] { +// CHECK:STDOUT: %Core.ref.loc67: = name_ref Core, imports.%Core.048aa3.1 [concrete = imports.%Core.048aa3.1] +// CHECK:STDOUT: %IntLiteral.ref.loc67: type = name_ref IntLiteral, imports.%Core.IntLiteral [concrete = Core.IntLiteral] // CHECK:STDOUT: } -// CHECK:STDOUT: %giant_literal_to_int_literal_overflow: Core.IntLiteral = wrapper_binding giant_literal_to_int_literal_overflow, %.loc28_106.2 [concrete = ] +// CHECK:STDOUT: %giant_literal_to_int_literal_overflow: Core.IntLiteral = wrapper_binding giant_literal_to_int_literal_overflow, %.loc67_106.2 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %giant_literal_to_int_literal_overflow.patt: %pattern_type.dc0 = value_binding_pattern giant_literal_to_int_literal_overflow [concrete = constants.%giant_literal_to_int_literal_overflow.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc33_107.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc33 [concrete = ] -// CHECK:STDOUT: %.loc33_107.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc33, %.loc33_107.1 [concrete = ] -// CHECK:STDOUT: %i32.loc33: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %giant_exponent_literal_overflow: %i32 = wrapper_binding giant_exponent_literal_overflow, %.loc33_107.2 [concrete = ] +// CHECK:STDOUT: %.loc79_107.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc79 [concrete = ] +// CHECK:STDOUT: %.loc79_107.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc79, %.loc79_107.1 [concrete = ] +// CHECK:STDOUT: %i32.loc79: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %giant_exponent_literal_overflow: %i32 = wrapper_binding giant_exponent_literal_overflow, %.loc79_107.2 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %giant_exponent_literal_overflow.patt: %pattern_type.d94 = value_binding_pattern giant_exponent_literal_overflow [concrete = constants.%giant_exponent_literal_overflow.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc39_141.1: Core.IntLiteral = value_of_initializer @__global_init.%ConvertFloatLiteralToIntLiteral.call.loc39 [concrete = ] -// CHECK:STDOUT: %.loc39_141.2: Core.IntLiteral = converted @__global_init.%ConvertFloatLiteralToIntLiteral.call.loc39, %.loc39_141.1 [concrete = ] -// CHECK:STDOUT: %.loc39_57: type = splice_block %IntLiteral.ref.loc39 [concrete = Core.IntLiteral] { -// CHECK:STDOUT: %Core.ref.loc39: = name_ref Core, imports.%Core.048aa3.1 [concrete = imports.%Core.048aa3.1] -// CHECK:STDOUT: %IntLiteral.ref.loc39: type = name_ref IntLiteral, imports.%Core.IntLiteral [concrete = Core.IntLiteral] +// CHECK:STDOUT: %.loc94_141.1: Core.IntLiteral = value_of_initializer @__global_init.%ConvertFloatLiteralToIntLiteral.call.loc94 [concrete = ] +// CHECK:STDOUT: %.loc94_141.2: Core.IntLiteral = converted @__global_init.%ConvertFloatLiteralToIntLiteral.call.loc94, %.loc94_141.1 [concrete = ] +// CHECK:STDOUT: %.loc94_57: type = splice_block %IntLiteral.ref.loc94 [concrete = Core.IntLiteral] { +// CHECK:STDOUT: %Core.ref.loc94: = name_ref Core, imports.%Core.048aa3.1 [concrete = imports.%Core.048aa3.1] +// CHECK:STDOUT: %IntLiteral.ref.loc94: type = name_ref IntLiteral, imports.%Core.IntLiteral [concrete = Core.IntLiteral] // CHECK:STDOUT: } -// CHECK:STDOUT: %giant_exponent_literal_to_int_literal_overflow: Core.IntLiteral = wrapper_binding giant_exponent_literal_to_int_literal_overflow, %.loc39_141.2 [concrete = ] +// CHECK:STDOUT: %giant_exponent_literal_to_int_literal_overflow: Core.IntLiteral = wrapper_binding giant_exponent_literal_to_int_literal_overflow, %.loc94_141.2 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %giant_exponent_literal_to_int_literal_overflow.patt: %pattern_type.dc0 = value_binding_pattern giant_exponent_literal_to_int_literal_overflow [concrete = constants.%giant_exponent_literal_to_int_literal_overflow.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc44_82.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc44 [concrete = ] -// CHECK:STDOUT: %.loc44_82.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc44, %.loc44_82.1 [concrete = ] -// CHECK:STDOUT: %i32.loc44: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %literal_overflow_large_mantissa: %i32 = wrapper_binding literal_overflow_large_mantissa, %.loc44_82.2 [concrete = ] +// CHECK:STDOUT: %.loc106_82.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc106 [concrete = ] +// CHECK:STDOUT: %.loc106_82.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc106, %.loc106_82.1 [concrete = ] +// CHECK:STDOUT: %i32.loc106: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %literal_overflow_large_mantissa: %i32 = wrapper_binding literal_overflow_large_mantissa, %.loc106_82.2 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %literal_overflow_large_mantissa.patt: %pattern_type.d94 = value_binding_pattern literal_overflow_large_mantissa [concrete = constants.%literal_overflow_large_mantissa.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc49_80.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc49 [concrete = ] -// CHECK:STDOUT: %.loc49_80.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc49, %.loc49_80.1 [concrete = ] -// CHECK:STDOUT: %i32.loc49: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %literal_overflow_med_mantissa: %i32 = wrapper_binding literal_overflow_med_mantissa, %.loc49_80.2 [concrete = ] +// CHECK:STDOUT: %.loc118_80.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc118 [concrete = ] +// CHECK:STDOUT: %.loc118_80.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc118, %.loc118_80.1 [concrete = ] +// CHECK:STDOUT: %i32.loc118: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %literal_overflow_med_mantissa: %i32 = wrapper_binding literal_overflow_med_mantissa, %.loc118_80.2 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %literal_overflow_med_mantissa.patt: %pattern_type.d94 = value_binding_pattern literal_overflow_med_mantissa [concrete = constants.%literal_overflow_med_mantissa.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc54_85.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc54 [concrete = ] -// CHECK:STDOUT: %.loc54_85.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc54, %.loc54_85.1 [concrete = ] -// CHECK:STDOUT: %i32.loc54: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %literal_overflow_hex_med_mantissa: %i32 = wrapper_binding literal_overflow_hex_med_mantissa, %.loc54_85.2 [concrete = ] +// CHECK:STDOUT: %.loc130_85.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc130 [concrete = ] +// CHECK:STDOUT: %.loc130_85.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc130, %.loc130_85.1 [concrete = ] +// CHECK:STDOUT: %i32.loc130: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %literal_overflow_hex_med_mantissa: %i32 = wrapper_binding literal_overflow_hex_med_mantissa, %.loc130_85.2 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %literal_overflow_hex_med_mantissa.patt: %pattern_type.d94 = value_binding_pattern literal_overflow_hex_med_mantissa [concrete = constants.%literal_overflow_hex_med_mantissa.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc59_75.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc59 [concrete = ] -// CHECK:STDOUT: %.loc59_75.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc59, %.loc59_75.1 [concrete = ] -// CHECK:STDOUT: %i32.loc59: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %literal_overflow_small_mantissa: %i32 = wrapper_binding literal_overflow_small_mantissa, %.loc59_75.2 [concrete = ] +// CHECK:STDOUT: %.loc142_75.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc142 [concrete = ] +// CHECK:STDOUT: %.loc142_75.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc142, %.loc142_75.1 [concrete = ] +// CHECK:STDOUT: %i32.loc142: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %literal_overflow_small_mantissa: %i32 = wrapper_binding literal_overflow_small_mantissa, %.loc142_75.2 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %literal_overflow_small_mantissa.patt: %pattern_type.d94 = value_binding_pattern literal_overflow_small_mantissa [concrete = constants.%literal_overflow_small_mantissa.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc64_81.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc64 [concrete = ] -// CHECK:STDOUT: %.loc64_81.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc64, %.loc64_81.1 [concrete = ] -// CHECK:STDOUT: %i32.loc64: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %literal_overflow_bin_small_mantissa: %i32 = wrapper_binding literal_overflow_bin_small_mantissa, %.loc64_81.2 [concrete = ] +// CHECK:STDOUT: %.loc154_81.1: %i32 = value_of_initializer @__global_init.%ConvertFloatLiteralToI32.call.loc154 [concrete = ] +// CHECK:STDOUT: %.loc154_81.2: %i32 = converted @__global_init.%ConvertFloatLiteralToI32.call.loc154, %.loc154_81.1 [concrete = ] +// CHECK:STDOUT: %i32.loc154: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %literal_overflow_bin_small_mantissa: %i32 = wrapper_binding literal_overflow_bin_small_mantissa, %.loc154_81.2 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %literal_overflow_bin_small_mantissa.patt: %pattern_type.d94 = value_binding_pattern literal_overflow_bin_small_mantissa [concrete = constants.%literal_overflow_bin_small_mantissa.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc69_72.1: %u32 = value_of_initializer @__global_init.%ConvertFloatLiteralToU32.call.loc69 [concrete = ] -// CHECK:STDOUT: %.loc69_72.2: %u32 = converted @__global_init.%ConvertFloatLiteralToU32.call.loc69, %.loc69_72.1 [concrete = ] -// CHECK:STDOUT: %u32.loc69: type = type_literal constants.%u32 [concrete = constants.%u32] -// CHECK:STDOUT: %literal_overflow_unsigned_neg: %u32 = wrapper_binding literal_overflow_unsigned_neg, %.loc69_72.2 [concrete = ] +// CHECK:STDOUT: %.loc166_72.1: %u32 = value_of_initializer @__global_init.%ConvertFloatLiteralToU32.call.loc166 [concrete = ] +// CHECK:STDOUT: %.loc166_72.2: %u32 = converted @__global_init.%ConvertFloatLiteralToU32.call.loc166, %.loc166_72.1 [concrete = ] +// CHECK:STDOUT: %u32.loc166: type = type_literal constants.%u32 [concrete = constants.%u32] +// CHECK:STDOUT: %literal_overflow_unsigned_neg: %u32 = wrapper_binding literal_overflow_unsigned_neg, %.loc166_72.2 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %literal_overflow_unsigned_neg.patt: %pattern_type.129 = value_binding_pattern literal_overflow_unsigned_neg [concrete = constants.%literal_overflow_unsigned_neg.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc74_79.1: %u32 = value_of_initializer @__global_init.%ConvertFloatLiteralToU32.call.loc74 [concrete = ] -// CHECK:STDOUT: %.loc74_79.2: %u32 = converted @__global_init.%ConvertFloatLiteralToU32.call.loc74, %.loc74_79.1 [concrete = ] -// CHECK:STDOUT: %u32.loc74: type = type_literal constants.%u32 [concrete = constants.%u32] -// CHECK:STDOUT: %literal_overflow_bin_unsigned_neg: %u32 = wrapper_binding literal_overflow_bin_unsigned_neg, %.loc74_79.2 [concrete = ] +// CHECK:STDOUT: %.loc178_79.1: %u32 = value_of_initializer @__global_init.%ConvertFloatLiteralToU32.call.loc178 [concrete = ] +// CHECK:STDOUT: %.loc178_79.2: %u32 = converted @__global_init.%ConvertFloatLiteralToU32.call.loc178, %.loc178_79.1 [concrete = ] +// CHECK:STDOUT: %u32.loc178: type = type_literal constants.%u32 [concrete = constants.%u32] +// CHECK:STDOUT: %literal_overflow_bin_unsigned_neg: %u32 = wrapper_binding literal_overflow_bin_unsigned_neg, %.loc178_79.2 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %literal_overflow_bin_unsigned_neg.patt: %pattern_type.129 = value_binding_pattern literal_overflow_bin_unsigned_neg [concrete = constants.%literal_overflow_bin_unsigned_neg.patt] // CHECK:STDOUT: } @@ -405,80 +519,80 @@ let inf_val: i32 = ConvertF64ToI32(Div(1.0, 0.0)); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %ConvertF64ToI32.ref.loc7: %ConvertF64ToI32.type = name_ref ConvertF64ToI32, imports.%Main.ConvertF64ToI32 [concrete = constants.%ConvertF64ToI32] -// CHECK:STDOUT: %float.loc7: Core.FloatLiteral = float_literal_value 21474836480e-1 [concrete = constants.%float.bab60c.1] -// CHECK:STDOUT: %impl.elem0.loc7: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0] -// CHECK:STDOUT: %bound_method.loc7_37.1: = bound_method %float.loc7, %impl.elem0.loc7 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.9eb] -// CHECK:STDOUT: %specific_fn.loc7: = specific_function %impl.elem0.loc7, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc7_37.2: = bound_method %float.loc7, %specific_fn.loc7 [concrete = constants.%bound_method.847] -// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc7: init %f64.761 = call %bound_method.loc7_37.2(%float.loc7) [concrete = constants.%float.ab7] -// CHECK:STDOUT: %.loc7_37.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc7 [concrete = constants.%float.ab7] -// CHECK:STDOUT: %.loc7_37.2: %f64.761 = converted %float.loc7, %.loc7_37.1 [concrete = constants.%float.ab7] -// CHECK:STDOUT: %ConvertF64ToI32.call.loc7: init %i32 = call %ConvertF64ToI32.ref.loc7(%.loc7_37.2) [concrete = ] -// CHECK:STDOUT: %ConvertF64ToI32.ref.loc11: %ConvertF64ToI32.type = name_ref ConvertF64ToI32, imports.%Main.ConvertF64ToI32 [concrete = constants.%ConvertF64ToI32] -// CHECK:STDOUT: %Negate.ref.loc11: %Negate.type = name_ref Negate, imports.%Main.Negate [concrete = constants.%Negate] -// CHECK:STDOUT: %float.loc11: Core.FloatLiteral = float_literal_value 21474836490e-1 [concrete = constants.%float.449] -// CHECK:STDOUT: %impl.elem0.loc11: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0] -// CHECK:STDOUT: %bound_method.loc11_45.1: = bound_method %float.loc11, %impl.elem0.loc11 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.00d] -// CHECK:STDOUT: %specific_fn.loc11: = specific_function %impl.elem0.loc11, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc11_45.2: = bound_method %float.loc11, %specific_fn.loc11 [concrete = constants.%bound_method.a16] -// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc11: init %f64.761 = call %bound_method.loc11_45.2(%float.loc11) [concrete = constants.%float.8e0] -// CHECK:STDOUT: %.loc11_45.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc11 [concrete = constants.%float.8e0] -// CHECK:STDOUT: %.loc11_45.2: %f64.761 = converted %float.loc11, %.loc11_45.1 [concrete = constants.%float.8e0] -// CHECK:STDOUT: %Negate.call.loc11: init %f64.761 = call %Negate.ref.loc11(%.loc11_45.2) [concrete = constants.%float.5e1] -// CHECK:STDOUT: %.loc11_57.1: %f64.761 = value_of_initializer %Negate.call.loc11 [concrete = constants.%float.5e1] -// CHECK:STDOUT: %.loc11_57.2: %f64.761 = converted %Negate.call.loc11, %.loc11_57.1 [concrete = constants.%float.5e1] -// CHECK:STDOUT: %ConvertF64ToI32.call.loc11: init %i32 = call %ConvertF64ToI32.ref.loc11(%.loc11_57.2) [concrete = ] +// CHECK:STDOUT: %ConvertF64ToI32.ref.loc13: %ConvertF64ToI32.type = name_ref ConvertF64ToI32, imports.%Main.ConvertF64ToI32 [concrete = constants.%ConvertF64ToI32] +// CHECK:STDOUT: %float.loc13: Core.FloatLiteral = float_literal_value 21474836480e-1 [concrete = constants.%float.bab60c.1] +// CHECK:STDOUT: %impl.elem0.loc13: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0] +// CHECK:STDOUT: %bound_method.loc13_37.1: = bound_method %float.loc13, %impl.elem0.loc13 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.9eb] +// CHECK:STDOUT: %specific_fn.loc13: = specific_function %impl.elem0.loc13, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc13_37.2: = bound_method %float.loc13, %specific_fn.loc13 [concrete = constants.%bound_method.847] +// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc13: init %f64.761 = call %bound_method.loc13_37.2(%float.loc13) [concrete = constants.%float.ab7] +// CHECK:STDOUT: %.loc13_37.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc13 [concrete = constants.%float.ab7] +// CHECK:STDOUT: %.loc13_37.2: %f64.761 = converted %float.loc13, %.loc13_37.1 [concrete = constants.%float.ab7] +// CHECK:STDOUT: %ConvertF64ToI32.call.loc13: init %i32 = call %ConvertF64ToI32.ref.loc13(%.loc13_37.2) [concrete = ] +// CHECK:STDOUT: %ConvertF64ToI32.ref.loc23: %ConvertF64ToI32.type = name_ref ConvertF64ToI32, imports.%Main.ConvertF64ToI32 [concrete = constants.%ConvertF64ToI32] +// CHECK:STDOUT: %Negate.ref.loc23: %Negate.type = name_ref Negate, imports.%Main.Negate [concrete = constants.%Negate] +// CHECK:STDOUT: %float.loc23: Core.FloatLiteral = float_literal_value 21474836490e-1 [concrete = constants.%float.449] +// CHECK:STDOUT: %impl.elem0.loc23: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0] +// CHECK:STDOUT: %bound_method.loc23_45.1: = bound_method %float.loc23, %impl.elem0.loc23 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.00d] +// CHECK:STDOUT: %specific_fn.loc23: = specific_function %impl.elem0.loc23, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc23_45.2: = bound_method %float.loc23, %specific_fn.loc23 [concrete = constants.%bound_method.a16] +// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc23: init %f64.761 = call %bound_method.loc23_45.2(%float.loc23) [concrete = constants.%float.8e0] +// CHECK:STDOUT: %.loc23_45.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc23 [concrete = constants.%float.8e0] +// CHECK:STDOUT: %.loc23_45.2: %f64.761 = converted %float.loc23, %.loc23_45.1 [concrete = constants.%float.8e0] +// CHECK:STDOUT: %Negate.call.loc23: init %f64.761 = call %Negate.ref.loc23(%.loc23_45.2) [concrete = constants.%float.5e1] +// CHECK:STDOUT: %.loc23_57.1: %f64.761 = value_of_initializer %Negate.call.loc23 [concrete = constants.%float.5e1] +// CHECK:STDOUT: %.loc23_57.2: %f64.761 = converted %Negate.call.loc23, %.loc23_57.1 [concrete = constants.%float.5e1] +// CHECK:STDOUT: %ConvertF64ToI32.call.loc23: init %i32 = call %ConvertF64ToI32.ref.loc23(%.loc23_57.2) [concrete = ] // CHECK:STDOUT: %ConvertF64ToU32.ref: %ConvertF64ToU32.type = name_ref ConvertF64ToU32, imports.%Main.ConvertF64ToU32 [concrete = constants.%ConvertF64ToU32] -// CHECK:STDOUT: %Negate.ref.loc15: %Negate.type = name_ref Negate, imports.%Main.Negate [concrete = constants.%Negate] -// CHECK:STDOUT: %float.loc15: Core.FloatLiteral = float_literal_value 10e-1 [concrete = constants.%float.6da] -// CHECK:STDOUT: %impl.elem0.loc15: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0] -// CHECK:STDOUT: %bound_method.loc15_48.1: = bound_method %float.loc15, %impl.elem0.loc15 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.1a9] -// CHECK:STDOUT: %specific_fn.loc15: = specific_function %impl.elem0.loc15, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc15_48.2: = bound_method %float.loc15, %specific_fn.loc15 [concrete = constants.%bound_method.04a] -// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc15: init %f64.761 = call %bound_method.loc15_48.2(%float.loc15) [concrete = constants.%float.a71] -// CHECK:STDOUT: %.loc15_48.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc15 [concrete = constants.%float.a71] -// CHECK:STDOUT: %.loc15_48.2: %f64.761 = converted %float.loc15, %.loc15_48.1 [concrete = constants.%float.a71] -// CHECK:STDOUT: %Negate.call.loc15: init %f64.761 = call %Negate.ref.loc15(%.loc15_48.2) [concrete = constants.%float.c4b] -// CHECK:STDOUT: %.loc15_51.1: %f64.761 = value_of_initializer %Negate.call.loc15 [concrete = constants.%float.c4b] -// CHECK:STDOUT: %.loc15_51.2: %f64.761 = converted %Negate.call.loc15, %.loc15_51.1 [concrete = constants.%float.c4b] -// CHECK:STDOUT: %ConvertF64ToU32.call: init %u32 = call %ConvertF64ToU32.ref(%.loc15_51.2) [concrete = ] -// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc19: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32] -// CHECK:STDOUT: %float.loc19: Core.FloatLiteral = float_literal_value 21474836480e-1 [concrete = constants.%float.bab60c.2] -// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc19: init %i32 = call %ConvertFloatLiteralToI32.ref.loc19(%float.loc19) [concrete = ] -// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc23: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32] -// CHECK:STDOUT: %float.loc23: Core.FloatLiteral = float_literal_value 10e999999 [concrete = constants.%float.53d] -// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc23: init %i32 = call %ConvertFloatLiteralToI32.ref.loc23(%float.loc23) [concrete = ] -// CHECK:STDOUT: %ConvertFloatLiteralToIntLiteral.ref.loc28: %ConvertFloatLiteralToIntLiteral.type = name_ref ConvertFloatLiteralToIntLiteral, imports.%Main.ConvertFloatLiteralToIntLiteral [concrete = constants.%ConvertFloatLiteralToIntLiteral] -// CHECK:STDOUT: %float.loc28: Core.FloatLiteral = float_literal_value 10e9999999 [concrete = constants.%float.ef09] -// CHECK:STDOUT: %ConvertFloatLiteralToIntLiteral.call.loc28: init Core.IntLiteral = call %ConvertFloatLiteralToIntLiteral.ref.loc28(%float.loc28) [concrete = ] -// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc33: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32] -// CHECK:STDOUT: %float.loc33: Core.FloatLiteral = float_literal_value 10e999999999999999999999999999999999 [concrete = constants.%float.f461ee.1] -// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc33: init %i32 = call %ConvertFloatLiteralToI32.ref.loc33(%float.loc33) [concrete = ] -// CHECK:STDOUT: %ConvertFloatLiteralToIntLiteral.ref.loc39: %ConvertFloatLiteralToIntLiteral.type = name_ref ConvertFloatLiteralToIntLiteral, imports.%Main.ConvertFloatLiteralToIntLiteral [concrete = constants.%ConvertFloatLiteralToIntLiteral] -// CHECK:STDOUT: %float.loc39: Core.FloatLiteral = float_literal_value 10e999999999999999999999999999999999 [concrete = constants.%float.f461ee.2] -// CHECK:STDOUT: %ConvertFloatLiteralToIntLiteral.call.loc39: init Core.IntLiteral = call %ConvertFloatLiteralToIntLiteral.ref.loc39(%float.loc39) [concrete = ] -// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc44: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32] -// CHECK:STDOUT: %float.loc44: Core.FloatLiteral = float_literal_value 2147483648e0 [concrete = constants.%float.e12922.1] -// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc44: init %i32 = call %ConvertFloatLiteralToI32.ref.loc44(%float.loc44) [concrete = ] -// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc49: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32] -// CHECK:STDOUT: %float.loc49: Core.FloatLiteral = float_literal_value 2147483648e0 [concrete = constants.%float.e12922.2] -// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc49: init %i32 = call %ConvertFloatLiteralToI32.ref.loc49(%float.loc49) [concrete = ] -// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc54: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32] -// CHECK:STDOUT: %float.loc54: Core.FloatLiteral = float_literal_value 2147483648p0 [concrete = constants.%float.ef03] -// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc54: init %i32 = call %ConvertFloatLiteralToI32.ref.loc54(%float.loc54) [concrete = ] -// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc59: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32] -// CHECK:STDOUT: %float.loc59: Core.FloatLiteral = float_literal_value 10e9 [concrete = constants.%float.9d5] -// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc59: init %i32 = call %ConvertFloatLiteralToI32.ref.loc59(%float.loc59) [concrete = ] -// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc64: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32] -// CHECK:STDOUT: %float.loc64: Core.FloatLiteral = float_literal_value 16p27 [concrete = constants.%float.c0c] -// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc64: init %i32 = call %ConvertFloatLiteralToI32.ref.loc64(%float.loc64) [concrete = ] -// CHECK:STDOUT: %ConvertFloatLiteralToU32.ref.loc69: %ConvertFloatLiteralToU32.type = name_ref ConvertFloatLiteralToU32, imports.%Main.ConvertFloatLiteralToU32 [concrete = constants.%ConvertFloatLiteralToU32] -// CHECK:STDOUT: %float.loc69: Core.FloatLiteral = float_literal_value 50e8 [concrete = constants.%float.4f4] -// CHECK:STDOUT: %ConvertFloatLiteralToU32.call.loc69: init %u32 = call %ConvertFloatLiteralToU32.ref.loc69(%float.loc69) [concrete = ] -// CHECK:STDOUT: %ConvertFloatLiteralToU32.ref.loc74: %ConvertFloatLiteralToU32.type = name_ref ConvertFloatLiteralToU32, imports.%Main.ConvertFloatLiteralToU32 [concrete = constants.%ConvertFloatLiteralToU32] -// CHECK:STDOUT: %float.loc74: Core.FloatLiteral = float_literal_value 16p28 [concrete = constants.%float.97b] -// CHECK:STDOUT: %ConvertFloatLiteralToU32.call.loc74: init %u32 = call %ConvertFloatLiteralToU32.ref.loc74(%float.loc74) [concrete = ] +// CHECK:STDOUT: %Negate.ref.loc33: %Negate.type = name_ref Negate, imports.%Main.Negate [concrete = constants.%Negate] +// CHECK:STDOUT: %float.loc33: Core.FloatLiteral = float_literal_value 10e-1 [concrete = constants.%float.6da] +// CHECK:STDOUT: %impl.elem0.loc33: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0] +// CHECK:STDOUT: %bound_method.loc33_48.1: = bound_method %float.loc33, %impl.elem0.loc33 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.1a9] +// CHECK:STDOUT: %specific_fn.loc33: = specific_function %impl.elem0.loc33, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc33_48.2: = bound_method %float.loc33, %specific_fn.loc33 [concrete = constants.%bound_method.04a] +// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc33: init %f64.761 = call %bound_method.loc33_48.2(%float.loc33) [concrete = constants.%float.a71] +// CHECK:STDOUT: %.loc33_48.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc33 [concrete = constants.%float.a71] +// CHECK:STDOUT: %.loc33_48.2: %f64.761 = converted %float.loc33, %.loc33_48.1 [concrete = constants.%float.a71] +// CHECK:STDOUT: %Negate.call.loc33: init %f64.761 = call %Negate.ref.loc33(%.loc33_48.2) [concrete = constants.%float.c4b] +// CHECK:STDOUT: %.loc33_51.1: %f64.761 = value_of_initializer %Negate.call.loc33 [concrete = constants.%float.c4b] +// CHECK:STDOUT: %.loc33_51.2: %f64.761 = converted %Negate.call.loc33, %.loc33_51.1 [concrete = constants.%float.c4b] +// CHECK:STDOUT: %ConvertF64ToU32.call: init %u32 = call %ConvertF64ToU32.ref(%.loc33_51.2) [concrete = ] +// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc43: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32] +// CHECK:STDOUT: %float.loc43: Core.FloatLiteral = float_literal_value 21474836480e-1 [concrete = constants.%float.bab60c.2] +// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc43: init %i32 = call %ConvertFloatLiteralToI32.ref.loc43(%float.loc43) [concrete = ] +// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc53: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32] +// CHECK:STDOUT: %float.loc53: Core.FloatLiteral = float_literal_value 10e999999 [concrete = constants.%float.53d] +// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc53: init %i32 = call %ConvertFloatLiteralToI32.ref.loc53(%float.loc53) [concrete = ] +// CHECK:STDOUT: %ConvertFloatLiteralToIntLiteral.ref.loc67: %ConvertFloatLiteralToIntLiteral.type = name_ref ConvertFloatLiteralToIntLiteral, imports.%Main.ConvertFloatLiteralToIntLiteral [concrete = constants.%ConvertFloatLiteralToIntLiteral] +// CHECK:STDOUT: %float.loc67: Core.FloatLiteral = float_literal_value 10e9999999 [concrete = constants.%float.ef09] +// CHECK:STDOUT: %ConvertFloatLiteralToIntLiteral.call.loc67: init Core.IntLiteral = call %ConvertFloatLiteralToIntLiteral.ref.loc67(%float.loc67) [concrete = ] +// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc79: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32] +// CHECK:STDOUT: %float.loc79: Core.FloatLiteral = float_literal_value 10e999999999999999999999999999999999 [concrete = constants.%float.f461ee.1] +// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc79: init %i32 = call %ConvertFloatLiteralToI32.ref.loc79(%float.loc79) [concrete = ] +// CHECK:STDOUT: %ConvertFloatLiteralToIntLiteral.ref.loc94: %ConvertFloatLiteralToIntLiteral.type = name_ref ConvertFloatLiteralToIntLiteral, imports.%Main.ConvertFloatLiteralToIntLiteral [concrete = constants.%ConvertFloatLiteralToIntLiteral] +// CHECK:STDOUT: %float.loc94: Core.FloatLiteral = float_literal_value 10e999999999999999999999999999999999 [concrete = constants.%float.f461ee.2] +// CHECK:STDOUT: %ConvertFloatLiteralToIntLiteral.call.loc94: init Core.IntLiteral = call %ConvertFloatLiteralToIntLiteral.ref.loc94(%float.loc94) [concrete = ] +// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc106: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32] +// CHECK:STDOUT: %float.loc106: Core.FloatLiteral = float_literal_value 2147483648e0 [concrete = constants.%float.e12922.1] +// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc106: init %i32 = call %ConvertFloatLiteralToI32.ref.loc106(%float.loc106) [concrete = ] +// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc118: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32] +// CHECK:STDOUT: %float.loc118: Core.FloatLiteral = float_literal_value 2147483648e0 [concrete = constants.%float.e12922.2] +// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc118: init %i32 = call %ConvertFloatLiteralToI32.ref.loc118(%float.loc118) [concrete = ] +// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc130: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32] +// CHECK:STDOUT: %float.loc130: Core.FloatLiteral = float_literal_value 2147483648p0 [concrete = constants.%float.ef03] +// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc130: init %i32 = call %ConvertFloatLiteralToI32.ref.loc130(%float.loc130) [concrete = ] +// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc142: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32] +// CHECK:STDOUT: %float.loc142: Core.FloatLiteral = float_literal_value 10e9 [concrete = constants.%float.9d5] +// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc142: init %i32 = call %ConvertFloatLiteralToI32.ref.loc142(%float.loc142) [concrete = ] +// CHECK:STDOUT: %ConvertFloatLiteralToI32.ref.loc154: %ConvertFloatLiteralToI32.type = name_ref ConvertFloatLiteralToI32, imports.%Main.ConvertFloatLiteralToI32 [concrete = constants.%ConvertFloatLiteralToI32] +// CHECK:STDOUT: %float.loc154: Core.FloatLiteral = float_literal_value 16p27 [concrete = constants.%float.c0c] +// CHECK:STDOUT: %ConvertFloatLiteralToI32.call.loc154: init %i32 = call %ConvertFloatLiteralToI32.ref.loc154(%float.loc154) [concrete = ] +// CHECK:STDOUT: %ConvertFloatLiteralToU32.ref.loc166: %ConvertFloatLiteralToU32.type = name_ref ConvertFloatLiteralToU32, imports.%Main.ConvertFloatLiteralToU32 [concrete = constants.%ConvertFloatLiteralToU32] +// CHECK:STDOUT: %float.loc166: Core.FloatLiteral = float_literal_value 50e8 [concrete = constants.%float.4f4] +// CHECK:STDOUT: %ConvertFloatLiteralToU32.call.loc166: init %u32 = call %ConvertFloatLiteralToU32.ref.loc166(%float.loc166) [concrete = ] +// CHECK:STDOUT: %ConvertFloatLiteralToU32.ref.loc178: %ConvertFloatLiteralToU32.type = name_ref ConvertFloatLiteralToU32, imports.%Main.ConvertFloatLiteralToU32 [concrete = constants.%ConvertFloatLiteralToU32] +// CHECK:STDOUT: %float.loc178: Core.FloatLiteral = float_literal_value 16p28 [concrete = constants.%float.97b] +// CHECK:STDOUT: %ConvertFloatLiteralToU32.call.loc178: init %u32 = call %ConvertFloatLiteralToU32.ref.loc178(%float.loc178) [concrete = ] // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: @@ -534,17 +648,17 @@ let inf_val: i32 = ConvertF64ToI32(Div(1.0, 0.0)); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { -// CHECK:STDOUT: %.loc7_49.1: %i32 = value_of_initializer @__global_init.%ConvertF64ToI32.call.loc7 [concrete = ] -// CHECK:STDOUT: %.loc7_49.2: %i32 = converted @__global_init.%ConvertF64ToI32.call.loc7, %.loc7_49.1 [concrete = ] -// CHECK:STDOUT: %i32.loc7: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %nan_val: %i32 = wrapper_binding nan_val, %.loc7_49.2 [concrete = ] +// CHECK:STDOUT: %.loc12_49.1: %i32 = value_of_initializer @__global_init.%ConvertF64ToI32.call.loc12 [concrete = ] +// CHECK:STDOUT: %.loc12_49.2: %i32 = converted @__global_init.%ConvertF64ToI32.call.loc12, %.loc12_49.1 [concrete = ] +// CHECK:STDOUT: %i32.loc12: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %nan_val: %i32 = wrapper_binding nan_val, %.loc12_49.2 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %nan_val.patt: %pattern_type.d94 = value_binding_pattern nan_val [concrete = constants.%nan_val.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc11_49.1: %i32 = value_of_initializer @__global_init.%ConvertF64ToI32.call.loc11 [concrete = ] -// CHECK:STDOUT: %.loc11_49.2: %i32 = converted @__global_init.%ConvertF64ToI32.call.loc11, %.loc11_49.1 [concrete = ] -// CHECK:STDOUT: %i32.loc11: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %inf_val: %i32 = wrapper_binding inf_val, %.loc11_49.2 [concrete = ] +// CHECK:STDOUT: %.loc21_49.1: %i32 = value_of_initializer @__global_init.%ConvertF64ToI32.call.loc21 [concrete = ] +// CHECK:STDOUT: %.loc21_49.2: %i32 = converted @__global_init.%ConvertF64ToI32.call.loc21, %.loc21_49.1 [concrete = ] +// CHECK:STDOUT: %i32.loc21: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %inf_val: %i32 = wrapper_binding inf_val, %.loc21_49.2 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %inf_val.patt: %pattern_type.d94 = value_binding_pattern inf_val [concrete = constants.%inf_val.patt] // CHECK:STDOUT: } @@ -552,50 +666,50 @@ let inf_val: i32 = ConvertF64ToI32(Div(1.0, 0.0)); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %ConvertF64ToI32.ref.loc7: %ConvertF64ToI32.type = name_ref ConvertF64ToI32, imports.%Main.ConvertF64ToI32 [concrete = constants.%ConvertF64ToI32] -// CHECK:STDOUT: %Div.ref.loc7: %Div.type = name_ref Div, imports.%Main.Div [concrete = constants.%Div] -// CHECK:STDOUT: %float.loc7_40: Core.FloatLiteral = float_literal_value 0e-1 [concrete = constants.%float.1f75e4.1] -// CHECK:STDOUT: %float.loc7_45: Core.FloatLiteral = float_literal_value 0e-1 [concrete = constants.%float.1f75e4.2] -// CHECK:STDOUT: %impl.elem0.loc7_40: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0] -// CHECK:STDOUT: %bound_method.loc7_40.1: = bound_method %float.loc7_40, %impl.elem0.loc7_40 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.7c43ce.1] -// CHECK:STDOUT: %specific_fn.loc7_40: = specific_function %impl.elem0.loc7_40, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc7_40.2: = bound_method %float.loc7_40, %specific_fn.loc7_40 [concrete = constants.%bound_method.49396d.1] -// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc7_40: init %f64.761 = call %bound_method.loc7_40.2(%float.loc7_40) [concrete = constants.%float.73e] -// CHECK:STDOUT: %.loc7_40.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc7_40 [concrete = constants.%float.73e] -// CHECK:STDOUT: %.loc7_40.2: %f64.761 = converted %float.loc7_40, %.loc7_40.1 [concrete = constants.%float.73e] -// CHECK:STDOUT: %impl.elem0.loc7_45: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0] -// CHECK:STDOUT: %bound_method.loc7_45.1: = bound_method %float.loc7_45, %impl.elem0.loc7_45 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.7c43ce.2] -// CHECK:STDOUT: %specific_fn.loc7_45: = specific_function %impl.elem0.loc7_45, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc7_45.2: = bound_method %float.loc7_45, %specific_fn.loc7_45 [concrete = constants.%bound_method.49396d.2] -// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc7_45: init %f64.761 = call %bound_method.loc7_45.2(%float.loc7_45) [concrete = constants.%float.73e] -// CHECK:STDOUT: %.loc7_45.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc7_45 [concrete = constants.%float.73e] -// CHECK:STDOUT: %.loc7_45.2: %f64.761 = converted %float.loc7_45, %.loc7_45.1 [concrete = constants.%float.73e] -// CHECK:STDOUT: %Div.call.loc7: init %f64.761 = call %Div.ref.loc7(%.loc7_40.2, %.loc7_45.2) [concrete = constants.%float.61c] -// CHECK:STDOUT: %.loc7_48.1: %f64.761 = value_of_initializer %Div.call.loc7 [concrete = constants.%float.61c] -// CHECK:STDOUT: %.loc7_48.2: %f64.761 = converted %Div.call.loc7, %.loc7_48.1 [concrete = constants.%float.61c] -// CHECK:STDOUT: %ConvertF64ToI32.call.loc7: init %i32 = call %ConvertF64ToI32.ref.loc7(%.loc7_48.2) [concrete = ] -// CHECK:STDOUT: %ConvertF64ToI32.ref.loc11: %ConvertF64ToI32.type = name_ref ConvertF64ToI32, imports.%Main.ConvertF64ToI32 [concrete = constants.%ConvertF64ToI32] -// CHECK:STDOUT: %Div.ref.loc11: %Div.type = name_ref Div, imports.%Main.Div [concrete = constants.%Div] -// CHECK:STDOUT: %float.loc11_40: Core.FloatLiteral = float_literal_value 10e-1 [concrete = constants.%float.6da] -// CHECK:STDOUT: %float.loc11_45: Core.FloatLiteral = float_literal_value 0e-1 [concrete = constants.%float.1f75e4.3] -// CHECK:STDOUT: %impl.elem0.loc11_40: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0] -// CHECK:STDOUT: %bound_method.loc11_40.1: = bound_method %float.loc11_40, %impl.elem0.loc11_40 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.1a9] -// CHECK:STDOUT: %specific_fn.loc11_40: = specific_function %impl.elem0.loc11_40, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc11_40.2: = bound_method %float.loc11_40, %specific_fn.loc11_40 [concrete = constants.%bound_method.04a] -// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc11_40: init %f64.761 = call %bound_method.loc11_40.2(%float.loc11_40) [concrete = constants.%float.a71] -// CHECK:STDOUT: %.loc11_40.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc11_40 [concrete = constants.%float.a71] -// CHECK:STDOUT: %.loc11_40.2: %f64.761 = converted %float.loc11_40, %.loc11_40.1 [concrete = constants.%float.a71] -// CHECK:STDOUT: %impl.elem0.loc11_45: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0] -// CHECK:STDOUT: %bound_method.loc11_45.1: = bound_method %float.loc11_45, %impl.elem0.loc11_45 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.7c43ce.3] -// CHECK:STDOUT: %specific_fn.loc11_45: = specific_function %impl.elem0.loc11_45, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc11_45.2: = bound_method %float.loc11_45, %specific_fn.loc11_45 [concrete = constants.%bound_method.49396d.3] -// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc11_45: init %f64.761 = call %bound_method.loc11_45.2(%float.loc11_45) [concrete = constants.%float.73e] -// CHECK:STDOUT: %.loc11_45.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc11_45 [concrete = constants.%float.73e] -// CHECK:STDOUT: %.loc11_45.2: %f64.761 = converted %float.loc11_45, %.loc11_45.1 [concrete = constants.%float.73e] -// CHECK:STDOUT: %Div.call.loc11: init %f64.761 = call %Div.ref.loc11(%.loc11_40.2, %.loc11_45.2) [concrete = constants.%float.62c] -// CHECK:STDOUT: %.loc11_48.1: %f64.761 = value_of_initializer %Div.call.loc11 [concrete = constants.%float.62c] -// CHECK:STDOUT: %.loc11_48.2: %f64.761 = converted %Div.call.loc11, %.loc11_48.1 [concrete = constants.%float.62c] -// CHECK:STDOUT: %ConvertF64ToI32.call.loc11: init %i32 = call %ConvertF64ToI32.ref.loc11(%.loc11_48.2) [concrete = ] +// CHECK:STDOUT: %ConvertF64ToI32.ref.loc12: %ConvertF64ToI32.type = name_ref ConvertF64ToI32, imports.%Main.ConvertF64ToI32 [concrete = constants.%ConvertF64ToI32] +// CHECK:STDOUT: %Div.ref.loc12: %Div.type = name_ref Div, imports.%Main.Div [concrete = constants.%Div] +// CHECK:STDOUT: %float.loc12_40: Core.FloatLiteral = float_literal_value 0e-1 [concrete = constants.%float.1f75e4.1] +// CHECK:STDOUT: %float.loc12_45: Core.FloatLiteral = float_literal_value 0e-1 [concrete = constants.%float.1f75e4.2] +// CHECK:STDOUT: %impl.elem0.loc12_40: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0] +// CHECK:STDOUT: %bound_method.loc12_40.1: = bound_method %float.loc12_40, %impl.elem0.loc12_40 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.7c43ce.1] +// CHECK:STDOUT: %specific_fn.loc12_40: = specific_function %impl.elem0.loc12_40, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc12_40.2: = bound_method %float.loc12_40, %specific_fn.loc12_40 [concrete = constants.%bound_method.49396d.1] +// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc12_40: init %f64.761 = call %bound_method.loc12_40.2(%float.loc12_40) [concrete = constants.%float.73e] +// CHECK:STDOUT: %.loc12_40.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc12_40 [concrete = constants.%float.73e] +// CHECK:STDOUT: %.loc12_40.2: %f64.761 = converted %float.loc12_40, %.loc12_40.1 [concrete = constants.%float.73e] +// CHECK:STDOUT: %impl.elem0.loc12_45: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0] +// CHECK:STDOUT: %bound_method.loc12_45.1: = bound_method %float.loc12_45, %impl.elem0.loc12_45 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.7c43ce.2] +// CHECK:STDOUT: %specific_fn.loc12_45: = specific_function %impl.elem0.loc12_45, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc12_45.2: = bound_method %float.loc12_45, %specific_fn.loc12_45 [concrete = constants.%bound_method.49396d.2] +// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc12_45: init %f64.761 = call %bound_method.loc12_45.2(%float.loc12_45) [concrete = constants.%float.73e] +// CHECK:STDOUT: %.loc12_45.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc12_45 [concrete = constants.%float.73e] +// CHECK:STDOUT: %.loc12_45.2: %f64.761 = converted %float.loc12_45, %.loc12_45.1 [concrete = constants.%float.73e] +// CHECK:STDOUT: %Div.call.loc12: init %f64.761 = call %Div.ref.loc12(%.loc12_40.2, %.loc12_45.2) [concrete = constants.%float.61c] +// CHECK:STDOUT: %.loc12_48.1: %f64.761 = value_of_initializer %Div.call.loc12 [concrete = constants.%float.61c] +// CHECK:STDOUT: %.loc12_48.2: %f64.761 = converted %Div.call.loc12, %.loc12_48.1 [concrete = constants.%float.61c] +// CHECK:STDOUT: %ConvertF64ToI32.call.loc12: init %i32 = call %ConvertF64ToI32.ref.loc12(%.loc12_48.2) [concrete = ] +// CHECK:STDOUT: %ConvertF64ToI32.ref.loc21: %ConvertF64ToI32.type = name_ref ConvertF64ToI32, imports.%Main.ConvertF64ToI32 [concrete = constants.%ConvertF64ToI32] +// CHECK:STDOUT: %Div.ref.loc21: %Div.type = name_ref Div, imports.%Main.Div [concrete = constants.%Div] +// CHECK:STDOUT: %float.loc21_40: Core.FloatLiteral = float_literal_value 10e-1 [concrete = constants.%float.6da] +// CHECK:STDOUT: %float.loc21_45: Core.FloatLiteral = float_literal_value 0e-1 [concrete = constants.%float.1f75e4.3] +// CHECK:STDOUT: %impl.elem0.loc21_40: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0] +// CHECK:STDOUT: %bound_method.loc21_40.1: = bound_method %float.loc21_40, %impl.elem0.loc21_40 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.1a9] +// CHECK:STDOUT: %specific_fn.loc21_40: = specific_function %impl.elem0.loc21_40, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc21_40.2: = bound_method %float.loc21_40, %specific_fn.loc21_40 [concrete = constants.%bound_method.04a] +// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc21_40: init %f64.761 = call %bound_method.loc21_40.2(%float.loc21_40) [concrete = constants.%float.a71] +// CHECK:STDOUT: %.loc21_40.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc21_40 [concrete = constants.%float.a71] +// CHECK:STDOUT: %.loc21_40.2: %f64.761 = converted %float.loc21_40, %.loc21_40.1 [concrete = constants.%float.a71] +// CHECK:STDOUT: %impl.elem0.loc21_45: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0] +// CHECK:STDOUT: %bound_method.loc21_45.1: = bound_method %float.loc21_45, %impl.elem0.loc21_45 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound.7c43ce.3] +// CHECK:STDOUT: %specific_fn.loc21_45: = specific_function %impl.elem0.loc21_45, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc21_45.2: = bound_method %float.loc21_45, %specific_fn.loc21_45 [concrete = constants.%bound_method.49396d.3] +// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc21_45: init %f64.761 = call %bound_method.loc21_45.2(%float.loc21_45) [concrete = constants.%float.73e] +// CHECK:STDOUT: %.loc21_45.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call.loc21_45 [concrete = constants.%float.73e] +// CHECK:STDOUT: %.loc21_45.2: %f64.761 = converted %float.loc21_45, %.loc21_45.1 [concrete = constants.%float.73e] +// CHECK:STDOUT: %Div.call.loc21: init %f64.761 = call %Div.ref.loc21(%.loc21_40.2, %.loc21_45.2) [concrete = constants.%float.62c] +// CHECK:STDOUT: %.loc21_48.1: %f64.761 = value_of_initializer %Div.call.loc21 [concrete = constants.%float.62c] +// CHECK:STDOUT: %.loc21_48.2: %f64.761 = converted %Div.call.loc21, %.loc21_48.1 [concrete = constants.%float.62c] +// CHECK:STDOUT: %ConvertF64ToI32.call.loc21: init %i32 = call %ConvertF64ToI32.ref.loc21(%.loc21_48.2) [concrete = ] // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/builtins/float/div.carbon b/toolchain/check/testdata/builtins/float/div.carbon index ffe79ec3e327..9dc5f22b3b5c 100644 --- a/toolchain/check/testdata/builtins/float/div.carbon +++ b/toolchain/check/testdata/builtins/float/div.carbon @@ -30,7 +30,12 @@ let c: f64 = Div(0.0, 0.0); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_too_few.carbon:[[@LINE+2]]:1-26: error: invalid signature for builtin function "float.div" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_too_few.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn TooFew(a: f64) -> f64 = "float.div"; +// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.div" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn TooFew(a: f64) -> f64 = "float.div"; @@ -42,7 +47,12 @@ fn RuntimeCallIsValidTooFew(a: f64) -> f64 { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_too_many.carbon:[[@LINE+2]]:1-43: error: invalid signature for builtin function "float.div" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_too_many.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.div"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.div" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.div"; @@ -54,7 +64,12 @@ fn RuntimeCallIsValidTooMany(a: f64, b: f64, c: f64) -> f64 { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+2]]:1-42: error: invalid signature for builtin function "float.div" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_return_type.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn BadReturnType(a: f64, b: f64) -> bool = "float.div"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.div" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn BadReturnType(a: f64, b: f64) -> bool = "float.div"; @@ -67,7 +82,12 @@ fn RuntimeCallIsValidBadReturnType(a: f64, b: f64) -> bool { library "[[@TEST_NAME]]"; fn Literal() -> type = "float_literal.make_type"; -// CHECK:STDERR: fail_literal.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "float.div" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_literal.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn DivLiteral(a: Literal(), b: Literal()) -> Literal() = "float.div"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.div" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn DivLiteral(a: Literal(), b: Literal()) -> Literal() = "float.div"; diff --git a/toolchain/check/testdata/builtins/float/div_assign.carbon b/toolchain/check/testdata/builtins/float/div_assign.carbon index 1afae97933d4..e0a2b136991a 100644 --- a/toolchain/check/testdata/builtins/float/div_assign.carbon +++ b/toolchain/check/testdata/builtins/float/div_assign.carbon @@ -24,11 +24,21 @@ fn Call(ref a: f64, b: f64) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "float.div_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn NotRef(a: f64, b: f64) = "float.div_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.div_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn NotRef(a: f64, b: f64) = "float.div_assign"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "float.div_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn MixedTypes(ref a: f64, b: f32) = "float.div_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.div_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn MixedTypes(ref a: f64, b: f32) = "float.div_assign"; @@ -37,6 +47,11 @@ fn MixedTypes(ref a: f64, b: f32) = "float.div_assign"; library "[[@TEST_NAME]]"; fn Literal() -> type = "float_literal.make_type"; -// CHECK:STDERR: fail_literal.carbon:[[@LINE+2]]:1-51: error: invalid signature for builtin function "float.div_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_literal.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn LiteralRuntime(ref a: Literal(), b: Literal()) = "float.div_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.div_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn LiteralRuntime(ref a: Literal(), b: Literal()) = "float.div_assign"; diff --git a/toolchain/check/testdata/builtins/float/eq.carbon b/toolchain/check/testdata/builtins/float/eq.carbon index 87cfc51a2ca2..5e857e036c65 100644 --- a/toolchain/check/testdata/builtins/float/eq.carbon +++ b/toolchain/check/testdata/builtins/float/eq.carbon @@ -32,7 +32,12 @@ fn RuntimeCallIsValid(a: f64, b: f64) -> bool { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-39: error: invalid signature for builtin function "float.eq" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn WrongResult(a: f64, b: f64) -> f64 = "float.eq"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.eq" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn WrongResult(a: f64, b: f64) -> f64 = "float.eq"; @@ -40,7 +45,12 @@ fn WrongResult(a: f64, b: f64) -> f64 = "float.eq"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_literal.carbon:[[@LINE+2]]:1-59: error: invalid signature for builtin function "float.eq" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_literal.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn Eq(a: Core.FloatLiteral, b: Core.FloatLiteral) -> bool = "float.eq"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.eq" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Eq(a: Core.FloatLiteral, b: Core.FloatLiteral) -> bool = "float.eq"; diff --git a/toolchain/check/testdata/builtins/float/less_eq.carbon b/toolchain/check/testdata/builtins/float/less_eq.carbon index 39854afd6573..f792db3bcd74 100644 --- a/toolchain/check/testdata/builtins/float/less_eq.carbon +++ b/toolchain/check/testdata/builtins/float/less_eq.carbon @@ -36,7 +36,12 @@ fn RuntimeCallIsValid(a: f64, b: f64) -> bool { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_literal.carbon:[[@LINE+2]]:1-63: error: invalid signature for builtin function "float.less_eq" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_literal.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn LessEq(a: Core.FloatLiteral, b: Core.FloatLiteral) -> bool = "float.less_eq"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.less_eq" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn LessEq(a: Core.FloatLiteral, b: Core.FloatLiteral) -> bool = "float.less_eq"; diff --git a/toolchain/check/testdata/builtins/float/make_type.carbon b/toolchain/check/testdata/builtins/float/make_type.carbon index 529217e998fe..76520710e6f1 100644 --- a/toolchain/check/testdata/builtins/float/make_type.carbon +++ b/toolchain/check/testdata/builtins/float/make_type.carbon @@ -39,7 +39,12 @@ library "[[@TEST_NAME]]"; import library "types"; -// CHECK:STDERR: fail_invalid_size.carbon:[[@LINE+2]]:20-29: error: unsupported floating-point bit width 931 [CompileTimeFloatBitWidth] +// CHECK:STDERR: ╭─┤ fail_invalid_size.carbon:[[@LINE+7]]:20 +// CHECK:STDERR: -> │ var invalid_float: Float(931); +// CHECK:STDERR: · ━━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: unsupported floating-point bit width 931 +// CHECK:STDERR: · ┃ [CompileTimeFloatBitWidth] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var invalid_float: Float(931); @@ -50,7 +55,12 @@ library "[[@TEST_NAME]]"; import library "types"; var dyn_size: i32 = 64; -// CHECK:STDERR: fail_dyn_size.carbon:[[@LINE+2]]:10-24: error: cannot evaluate type expression [TypeExprEvaluationFailure] +// CHECK:STDERR: ╭─┤ fail_dyn_size.carbon:[[@LINE+7]]:10 +// CHECK:STDERR: -> │ var dyn: Float(dyn_size); +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot evaluate type expression +// CHECK:STDERR: · ┃ [TypeExprEvaluationFailure] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var dyn: Float(dyn_size); diff --git a/toolchain/check/testdata/builtins/float/mul.carbon b/toolchain/check/testdata/builtins/float/mul.carbon index b165f571b681..6bd45028df32 100644 --- a/toolchain/check/testdata/builtins/float/mul.carbon +++ b/toolchain/check/testdata/builtins/float/mul.carbon @@ -28,7 +28,12 @@ var x: f64 = Mul(2.0, 0.5); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_too_few.carbon:[[@LINE+2]]:1-26: error: invalid signature for builtin function "float.mul" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_too_few.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn TooFew(a: f64) -> f64 = "float.mul"; +// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.mul" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn TooFew(a: f64) -> f64 = "float.mul"; @@ -40,7 +45,12 @@ fn RuntimeCallIsValidTooFew(a: f64) -> f64 { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_too_many.carbon:[[@LINE+2]]:1-43: error: invalid signature for builtin function "float.mul" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_too_many.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.mul"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.mul" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.mul"; @@ -52,7 +62,12 @@ fn RuntimeCallIsValidTooMany(a: f64, b: f64, c: f64) -> f64 { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+2]]:1-42: error: invalid signature for builtin function "float.mul" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_return_type.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn BadReturnType(a: f64, b: f64) -> bool = "float.mul"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.mul" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn BadReturnType(a: f64, b: f64) -> bool = "float.mul"; @@ -65,7 +80,12 @@ fn RuntimeCallIsValidBadReturnType(a: f64, b: f64) -> bool { library "[[@TEST_NAME]]"; fn Literal() -> type = "float_literal.make_type"; -// CHECK:STDERR: fail_literal.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "float.mul" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_literal.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn MulLiteral(a: Literal(), b: Literal()) -> Literal() = "float.mul"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.mul" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn MulLiteral(a: Literal(), b: Literal()) -> Literal() = "float.mul"; diff --git a/toolchain/check/testdata/builtins/float/mul_assign.carbon b/toolchain/check/testdata/builtins/float/mul_assign.carbon index 90bb200a79f4..ab1abbc06373 100644 --- a/toolchain/check/testdata/builtins/float/mul_assign.carbon +++ b/toolchain/check/testdata/builtins/float/mul_assign.carbon @@ -24,11 +24,21 @@ fn Call(ref a: f64, b: f64) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "float.mul_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn NotRef(a: f64, b: f64) = "float.mul_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.mul_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn NotRef(a: f64, b: f64) = "float.mul_assign"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "float.mul_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn MixedTypes(ref a: f64, b: f32) = "float.mul_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.mul_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn MixedTypes(ref a: f64, b: f32) = "float.mul_assign"; @@ -37,6 +47,11 @@ fn MixedTypes(ref a: f64, b: f32) = "float.mul_assign"; library "[[@TEST_NAME]]"; fn Literal() -> type = "float_literal.make_type"; -// CHECK:STDERR: fail_literal.carbon:[[@LINE+2]]:1-51: error: invalid signature for builtin function "float.mul_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_literal.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn LiteralRuntime(ref a: Literal(), b: Literal()) = "float.mul_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.mul_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn LiteralRuntime(ref a: Literal(), b: Literal()) = "float.mul_assign"; diff --git a/toolchain/check/testdata/builtins/float/negate.carbon b/toolchain/check/testdata/builtins/float/negate.carbon index 58b6fb152a05..98ce1a852f0c 100644 --- a/toolchain/check/testdata/builtins/float/negate.carbon +++ b/toolchain/check/testdata/builtins/float/negate.carbon @@ -28,7 +28,12 @@ let a: f64 = Negate(1.5); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_too_few.carbon:[[@LINE+2]]:1-20: error: invalid signature for builtin function "float.negate" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_too_few.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn TooFew() -> f64 = "float.negate"; +// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.negate" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn TooFew() -> f64 = "float.negate"; @@ -40,7 +45,12 @@ fn RuntimeCallIsValidTooFew() -> f64 { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_too_many.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "float.negate" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_too_many.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn TooMany(a: f64, b: f64) -> f64 = "float.negate"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.negate" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn TooMany(a: f64, b: f64) -> f64 = "float.negate"; @@ -52,7 +62,12 @@ fn RuntimeCallIsValidTooMany(a: f64, b: f64) -> f64 { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+2]]:1-34: error: invalid signature for builtin function "float.negate" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_return_type.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn BadReturnType(a: f64) -> bool = "float.negate"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.negate" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn BadReturnType(a: f64) -> bool = "float.negate"; diff --git a/toolchain/check/testdata/builtins/float/neq.carbon b/toolchain/check/testdata/builtins/float/neq.carbon index 65ef93002512..0bf1ceb97494 100644 --- a/toolchain/check/testdata/builtins/float/neq.carbon +++ b/toolchain/check/testdata/builtins/float/neq.carbon @@ -34,7 +34,12 @@ fn RuntimeCallIsValid(a: f64, b: f64) -> bool { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-39: error: invalid signature for builtin function "float.neq" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn WrongResult(a: f64, b: f64) -> f64 = "float.neq"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.neq" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn WrongResult(a: f64, b: f64) -> f64 = "float.neq"; diff --git a/toolchain/check/testdata/builtins/float/sub.carbon b/toolchain/check/testdata/builtins/float/sub.carbon index f88545deda2a..99766824ab05 100644 --- a/toolchain/check/testdata/builtins/float/sub.carbon +++ b/toolchain/check/testdata/builtins/float/sub.carbon @@ -28,7 +28,12 @@ var x: f64 = Sub(2.0, 0.5); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_too_few.carbon:[[@LINE+2]]:1-26: error: invalid signature for builtin function "float.sub" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_too_few.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn TooFew(a: f64) -> f64 = "float.sub"; +// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.sub" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn TooFew(a: f64) -> f64 = "float.sub"; @@ -40,7 +45,12 @@ fn RuntimeCallIsValidTooFew(a: f64) -> f64 { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_too_many.carbon:[[@LINE+2]]:1-43: error: invalid signature for builtin function "float.sub" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_too_many.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.sub"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.sub" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn TooMany(a: f64, b: f64, c: f64) -> f64 = "float.sub"; @@ -52,7 +62,12 @@ fn RuntimeCallIsValidTooMany(a: f64, b: f64, c: f64) -> f64 { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+2]]:1-42: error: invalid signature for builtin function "float.sub" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_return_type.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn BadReturnType(a: f64, b: f64) -> bool = "float.sub"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.sub" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn BadReturnType(a: f64, b: f64) -> bool = "float.sub"; diff --git a/toolchain/check/testdata/builtins/float/sub_assign.carbon b/toolchain/check/testdata/builtins/float/sub_assign.carbon index 1d10fa0fb02d..386662c4f43a 100644 --- a/toolchain/check/testdata/builtins/float/sub_assign.carbon +++ b/toolchain/check/testdata/builtins/float/sub_assign.carbon @@ -24,11 +24,21 @@ fn Call(ref a: f64, b: f64) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "float.sub_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn NotRef(a: f64, b: f64) = "float.sub_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.sub_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn NotRef(a: f64, b: f64) = "float.sub_assign"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "float.sub_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn MixedTypes(ref a: f64, b: f32) = "float.sub_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.sub_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn MixedTypes(ref a: f64, b: f32) = "float.sub_assign"; @@ -37,6 +47,11 @@ fn MixedTypes(ref a: f64, b: f32) = "float.sub_assign"; library "[[@TEST_NAME]]"; fn Literal() -> type = "float_literal.make_type"; -// CHECK:STDERR: fail_literal.carbon:[[@LINE+2]]:1-51: error: invalid signature for builtin function "float.sub_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_literal.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn LiteralRuntime(ref a: Literal(), b: Literal()) = "float.sub_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "float.sub_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn LiteralRuntime(ref a: Literal(), b: Literal()) = "float.sub_assign"; diff --git a/toolchain/check/testdata/builtins/float_literal/add.carbon b/toolchain/check/testdata/builtins/float_literal/add.carbon index 8b306d1ffa28..15eae3496c51 100644 --- a/toolchain/check/testdata/builtins/float_literal/add.carbon +++ b/toolchain/check/testdata/builtins/float_literal/add.carbon @@ -42,7 +42,13 @@ library "[[@TEST_NAME]]"; fn Add(a: Core.FloatLiteral, b: Core.FloatLiteral) -> Core.FloatLiteral = "float.add"; fn F(){ - // CHECK:STDERR: fail_too_large.carbon:[[@LINE+2]]:6-52: error: binary calculation `16*2^1023999999996 + 1*10^-19` would exceed the maximum supported integer width of 8388608 [CompileTimeFloatLiteralBinaryOperationOutOfRange] + // CHECK:STDERR: ╭─┤ fail_too_large.carbon:[[@LINE+8]]:6 + // CHECK:STDERR: -> │ Add(0x1.0p1024000000000, 0.0000000000000000001); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: binary calculation `16*2^1023999999996 + 1*10^-19` would exceed + // CHECK:STDERR: · ┃ the maximum supported integer width of 8388608 + // CHECK:STDERR: · ┃ [CompileTimeFloatLiteralBinaryOperationOutOfRange] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Add(0x1.0p1024000000000, 0.0000000000000000001); } diff --git a/toolchain/check/testdata/builtins/float_literal/sub.carbon b/toolchain/check/testdata/builtins/float_literal/sub.carbon index 598bdfe223b6..4ead0f182193 100644 --- a/toolchain/check/testdata/builtins/float_literal/sub.carbon +++ b/toolchain/check/testdata/builtins/float_literal/sub.carbon @@ -44,7 +44,15 @@ library "[[@TEST_NAME]]"; fn Sub(a: Core.FloatLiteral, b: Core.FloatLiteral) -> Core.FloatLiteral = "float.sub"; -// CHECK:STDERR: fail_too_large.carbon:[[@LINE+2]]:29-75: error: binary calculation `16*2^1023999999996 - 1*10^-19` would exceed the maximum supported integer width of 8388608 [CompileTimeFloatLiteralBinaryOperationOutOfRange] +// CHECK:STDERR: ╭─┤ fail_too_large.carbon:[[@LINE+10]]:29 +// CHECK:STDERR: -> │ let v1: Core.FloatLiteral = Sub(0x1.0p1024000000000, 0.0000000000000000001); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: binary calculation +// CHECK:STDERR: · ┃ `16*2^1023999999996 - 1*10^-19` would +// CHECK:STDERR: · ┃ exceed the maximum supported integer +// CHECK:STDERR: · ┃ width of 8388608 +// CHECK:STDERR: · ┃ [CompileTimeFloatLiteralBinaryOperationOutOfRange] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let v1: Core.FloatLiteral = Sub(0x1.0p1024000000000, 0.0000000000000000001); diff --git a/toolchain/check/testdata/builtins/int/add_char_literal.carbon b/toolchain/check/testdata/builtins/int/add_char_literal.carbon index 9d820d174d27..e0ecff1e758f 100644 --- a/toolchain/check/testdata/builtins/int/add_char_literal.carbon +++ b/toolchain/check/testdata/builtins/int/add_char_literal.carbon @@ -36,7 +36,13 @@ alias IntLiteral = MakeIntLiteral(); fn AddIntChar(n: IntLiteral, c: CharLiteral) -> CharLiteral = "int.add_char_literal"; -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:22-54: error: character arithmetic result 4503599627370593 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult] +// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+8]]:22 +// CHECK:STDERR: -> │ let a: CharLiteral = AddIntChar(0x10000000000000, 'a'); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: character arithmetic result 4503599627370593 is +// CHECK:STDERR: · ┃ not a valid Unicode code point +// CHECK:STDERR: · ┃ [InvalidCharLiteralArithmeticResult] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let a: CharLiteral = AddIntChar(0x10000000000000, 'a'); @@ -52,15 +58,33 @@ alias IntLiteral = MakeIntLiteral(); fn AddIntChar(n: IntLiteral, c: CharLiteral) -> CharLiteral = "int.add_char_literal"; fn Negate(n: IntLiteral) -> IntLiteral = "int.snegate"; -// CHECK:STDERR: fail_invalid_result.carbon:[[@LINE+2]]:22-48: error: character arithmetic result 1114112 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult] +// CHECK:STDERR: ╭─┤ fail_invalid_result.carbon:[[@LINE+8]]:22 +// CHECK:STDERR: -> │ let a: CharLiteral = AddIntChar(1, '\u{10FFFF}'); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: character arithmetic result 1114112 is not a +// CHECK:STDERR: · ┃ valid Unicode code point +// CHECK:STDERR: · ┃ [InvalidCharLiteralArithmeticResult] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let a: CharLiteral = AddIntChar(1, '\u{10FFFF}'); -// CHECK:STDERR: fail_invalid_result.carbon:[[@LINE+2]]:22-46: error: character arithmetic result 55296 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult] +// CHECK:STDERR: ╭─┤ fail_invalid_result.carbon:[[@LINE+8]]:22 +// CHECK:STDERR: -> │ let b: CharLiteral = AddIntChar(1, '\u{D7FF}'); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: character arithmetic result 55296 is not a +// CHECK:STDERR: · ┃ valid Unicode code point +// CHECK:STDERR: · ┃ [InvalidCharLiteralArithmeticResult] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let b: CharLiteral = AddIntChar(1, '\u{D7FF}'); -// CHECK:STDERR: fail_invalid_result.carbon:[[@LINE+2]]:22-48: error: character arithmetic result -1 is not a valid Unicode code point [InvalidCharLiteralArithmeticResult] +// CHECK:STDERR: ╭─┤ fail_invalid_result.carbon:[[@LINE+8]]:22 +// CHECK:STDERR: -> │ let c: CharLiteral = AddIntChar(Negate(98), 'a'); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: character arithmetic result -1 is not a valid +// CHECK:STDERR: · ┃ Unicode code point +// CHECK:STDERR: · ┃ [InvalidCharLiteralArithmeticResult] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let c: CharLiteral = AddIntChar(Negate(98), 'a'); diff --git a/toolchain/check/testdata/builtins/int/and.carbon b/toolchain/check/testdata/builtins/int/and.carbon index b92e6c028e88..7c0b1c161410 100644 --- a/toolchain/check/testdata/builtins/int/and.carbon +++ b/toolchain/check/testdata/builtins/int/and.carbon @@ -52,8 +52,17 @@ library "[[@TEST_NAME]]"; fn AndLit(a: Core.IntLiteral, b: Core.IntLiteral) -> Core.IntLiteral = "int.and"; fn F(a: Core.IntLiteral) -> Core.IntLiteral { - // CHECK:STDERR: fail_literal_runtime.carbon:[[@LINE+3]]:10-21: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] - // CHECK:STDERR: fail_literal_runtime.carbon:[[@LINE-4]]:1-70: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] + // CHECK:STDERR: ╭─┤ fail_literal_runtime.carbon:[[@LINE+12]]:10 + // CHECK:STDERR: │ fn AndLit(a: Core.IntLiteral, b: Core.IntLiteral) -> Core.IntLiteral = "in... + // CHECK:STDERR: · ───────────────────────────────────┬────────────────────────────────── + // CHECK:STDERR: · ╰──┤ compile-time-only function declared here + // CHECK:STDERR: · │ [CompTimeOnlyFunctionHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ return AndLit(5, a); + // CHECK:STDERR: · ━━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: non-constant call to compile-time-only function + // CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return AndLit(5, a); } @@ -63,16 +72,36 @@ fn F(a: Core.IntLiteral) -> Core.IntLiteral { library "[[@TEST_NAME]]"; // Heterogeneous "and" is not supported. -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-49: error: invalid signature for builtin function "int.and" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn MixedAnd1(a: i32, b: Core.IntLiteral) -> i32 = "int.and"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.and" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn MixedAnd1(a: i32, b: Core.IntLiteral) -> i32 = "int.and"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-49: error: invalid signature for builtin function "int.and" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn MixedAnd2(a: Core.IntLiteral, b: i32) -> i32 = "int.and"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.and" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn MixedAnd2(a: Core.IntLiteral, b: i32) -> i32 = "int.and"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-61: error: invalid signature for builtin function "int.and" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn MixedAnd3(a: i32, b: Core.IntLiteral) -> Core.IntLiteral = "int.and"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.and" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn MixedAnd3(a: i32, b: Core.IntLiteral) -> Core.IntLiteral = "int.and"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-61: error: invalid signature for builtin function "int.and" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn MixedAnd4(a: Core.IntLiteral, b: i32) -> Core.IntLiteral = "int.and"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.and" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn MixedAnd4(a: Core.IntLiteral, b: i32) -> Core.IntLiteral = "int.and"; @@ -85,16 +114,43 @@ fn And(a: Core.IntLiteral, b: Core.IntLiteral) -> Core.IntLiteral = "int.and"; fn Test(n: Core.IntLiteral) { // OK And(1, 1); - // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+3]]:3-11: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] - // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-6]]:1-67: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] + // CHECK:STDERR: ╭─┤ fail_runtime_literal.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn And(a: Core.IntLiteral, b: Core.IntLiteral) -> Core.IntLiteral = "int.and"; + // CHECK:STDERR: · ─────────────────────────────────┬───────────────────────────────── + // CHECK:STDERR: · ╰──┤ compile-time-only function declared here + // CHECK:STDERR: · │ [CompTimeOnlyFunctionHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ And(n, 1); + // CHECK:STDERR: · ━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: non-constant call to compile-time-only function + // CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: ╰──── // CHECK:STDERR: And(n, 1); - // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+3]]:3-11: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] - // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-10]]:1-67: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] + // CHECK:STDERR: ╭─┤ fail_runtime_literal.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn And(a: Core.IntLiteral, b: Core.IntLiteral) -> Core.IntLiteral = "int.and"; + // CHECK:STDERR: · ─────────────────────────────────┬───────────────────────────────── + // CHECK:STDERR: · ╰──┤ compile-time-only function declared here + // CHECK:STDERR: · │ [CompTimeOnlyFunctionHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ And(1, n); + // CHECK:STDERR: · ━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: non-constant call to compile-time-only function + // CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: ╰──── // CHECK:STDERR: And(1, n); - // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+3]]:3-11: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] - // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-14]]:1-67: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] + // CHECK:STDERR: ╭─┤ fail_runtime_literal.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn And(a: Core.IntLiteral, b: Core.IntLiteral) -> Core.IntLiteral = "int.and"; + // CHECK:STDERR: · ─────────────────────────────────┬───────────────────────────────── + // CHECK:STDERR: · ╰──┤ compile-time-only function declared here + // CHECK:STDERR: · │ [CompTimeOnlyFunctionHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ And(n, n); + // CHECK:STDERR: · ━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: non-constant call to compile-time-only function + // CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: ╰──── // CHECK:STDERR: And(n, n); } diff --git a/toolchain/check/testdata/builtins/int/and_assign.carbon b/toolchain/check/testdata/builtins/int/and_assign.carbon index 2953ffc9eb3c..fc0d332d82dd 100644 --- a/toolchain/check/testdata/builtins/int/and_assign.carbon +++ b/toolchain/check/testdata/builtins/int/and_assign.carbon @@ -26,7 +26,12 @@ fn Call(ref a: i32, b: i32) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.and_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_unsized.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.and_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.and_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.and_assign"; @@ -34,7 +39,12 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.and_assign"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_not_ptr.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.and_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_not_ptr.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn NotRef(a: i32, b: i32) = "int.and_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.and_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.and_assign"; @@ -44,7 +54,12 @@ fn NotRef(a: i32, b: i32) = "int.and_assign"; // // library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_not_ptr.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.and_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_not_ptr.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn MixedTypes(ref a: i32, b: i64) = "int.and_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.and_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn MixedTypes(ref a: i32, b: i64) = "int.and_assign"; diff --git a/toolchain/check/testdata/builtins/int/complement.carbon b/toolchain/check/testdata/builtins/int/complement.carbon index c239f2ddfcaa..94be4ca1c134 100644 --- a/toolchain/check/testdata/builtins/int/complement.carbon +++ b/toolchain/check/testdata/builtins/int/complement.carbon @@ -52,8 +52,17 @@ library "[[@TEST_NAME]]"; fn Complement(a: Core.IntLiteral) -> Core.IntLiteral = "int.complement"; fn F(a: Core.IntLiteral) -> Core.IntLiteral { - // CHECK:STDERR: fail_literal_runtime.carbon:[[@LINE+3]]:10-22: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] - // CHECK:STDERR: fail_literal_runtime.carbon:[[@LINE-4]]:1-54: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] + // CHECK:STDERR: ╭─┤ fail_literal_runtime.carbon:[[@LINE+12]]:10 + // CHECK:STDERR: │ fn Complement(a: Core.IntLiteral) -> Core.IntLiteral = "int.complement"; + // CHECK:STDERR: · ───────────────────────────┬────────────────────────── + // CHECK:STDERR: · ╰──┤ compile-time-only function declared here + // CHECK:STDERR: · │ [CompTimeOnlyFunctionHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ return Complement(a); + // CHECK:STDERR: · ━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: non-constant call to compile-time-only function + // CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return Complement(a); } diff --git a/toolchain/check/testdata/builtins/int/convert.carbon b/toolchain/check/testdata/builtins/int/convert.carbon index 960131d2f452..f85d310773df 100644 --- a/toolchain/check/testdata/builtins/int/convert.carbon +++ b/toolchain/check/testdata/builtins/int/convert.carbon @@ -76,8 +76,15 @@ import library "int_ops"; fn F() { // Ensure our testing machinery works. - // CHECK:STDERR: fail_self_test.carbon:[[@LINE+3]]:3-43: error: cannot convert expression of type `Expect(0)` to `Expect(1)` with `as` [ConversionFailure] - // CHECK:STDERR: fail_self_test.carbon:[[@LINE+2]]:3-43: note: type `Expect(0)` does not implement interface `Core.As(Expect(1))` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_self_test.carbon:[[@LINE+10]]:3 + // CHECK:STDERR: -> │ Test(Int32ToInt32(0)) as Expect(1 as i32); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `Expect(0)` to `Expect(1)` with + // CHECK:STDERR: · │ ┃ `as` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Expect(0)` does not implement interface `Core.As(Expect(1))` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Test(Int32ToInt32(0)) as Expect(1 as i32); } @@ -241,8 +248,19 @@ import library "int_ops"; let not_constant: Core.IntLiteral = 0; -// CHECK:STDERR: fail_not_constant.carbon:[[@LINE+3]]:33-63: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] -// CHECK:STDERR: int_ops.carbon:16:1-49: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] +// CHECK:STDERR: ╭─┤ fail_not_constant.carbon:[[@LINE+14]]:33 +// CHECK:STDERR: -> │ let convert_not_constant: i16 = IntLiteralToInt16(not_constant); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: non-constant call to +// CHECK:STDERR: · ┃ compile-time-only function +// CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ int_ops.carbon +// CHECK:STDERR: │ fn IntLiteralToInt16(a: Core.IntLiteral) -> i16 = "int.convert"; +// CHECK:STDERR: · ────────────────────────┬──────────────────────── +// CHECK:STDERR: · ╰──┤ compile-time-only function declared here +// CHECK:STDERR: · │ [CompTimeOnlyFunctionHere] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let convert_not_constant: i16 = IntLiteralToInt16(not_constant); diff --git a/toolchain/check/testdata/builtins/int/convert_char_literal.carbon b/toolchain/check/testdata/builtins/int/convert_char_literal.carbon index 49512f590a80..826cc3451380 100644 --- a/toolchain/check/testdata/builtins/int/convert_char_literal.carbon +++ b/toolchain/check/testdata/builtins/int/convert_char_literal.carbon @@ -40,15 +40,33 @@ alias IntLiteral = MakeIntLiteral(); fn ConvertFromIntLiteral(n: IntLiteral) -> CharLiteral = "int.convert_char_literal"; -// CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:22-46: error: integer value -1 is not a valid Unicode code point [InvalidCharLiteralValue] +// CHECK:STDERR: ╭─┤ fail_invalid.carbon:[[@LINE+8]]:22 +// CHECK:STDERR: -> │ let a: CharLiteral = ConvertFromIntLiteral(-1); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: integer value -1 is not a valid Unicode code +// CHECK:STDERR: · ┃ point +// CHECK:STDERR: · ┃ [InvalidCharLiteralValue] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let a: CharLiteral = ConvertFromIntLiteral(-1); -// CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:22-50: error: integer value 55296 is not a valid Unicode code point [InvalidCharLiteralValue] +// CHECK:STDERR: ╭─┤ fail_invalid.carbon:[[@LINE+8]]:22 +// CHECK:STDERR: -> │ let b: CharLiteral = ConvertFromIntLiteral(0xD800); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: integer value 55296 is not a valid Unicode code +// CHECK:STDERR: · ┃ point +// CHECK:STDERR: · ┃ [InvalidCharLiteralValue] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let b: CharLiteral = ConvertFromIntLiteral(0xD800); -// CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:22-52: error: integer value 1114112 is not a valid Unicode code point [InvalidCharLiteralValue] +// CHECK:STDERR: ╭─┤ fail_invalid.carbon:[[@LINE+8]]:22 +// CHECK:STDERR: -> │ let c: CharLiteral = ConvertFromIntLiteral(0x110000); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: integer value 1114112 is not a valid Unicode +// CHECK:STDERR: · ┃ code point +// CHECK:STDERR: · ┃ [InvalidCharLiteralValue] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let c: CharLiteral = ConvertFromIntLiteral(0x110000); diff --git a/toolchain/check/testdata/builtins/int/convert_checked.carbon b/toolchain/check/testdata/builtins/int/convert_checked.carbon index b9ba8e6494b9..00e0cc93a7c3 100644 --- a/toolchain/check/testdata/builtins/int/convert_checked.carbon +++ b/toolchain/check/testdata/builtins/int/convert_checked.carbon @@ -130,7 +130,12 @@ library "[[@TEST_NAME]]"; import library "int_ops"; let max_plus_one: i32 = - // CHECK:STDERR: fail_too_large_u32_for_i32.carbon:[[@LINE+2]]:3-16: error: integer value 2147483648 too large for type `i32` [IntTooLargeForType] + // CHECK:STDERR: ╭─┤ fail_too_large_u32_for_i32.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ Uint32ToInt32( + // CHECK:STDERR: · ━━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: integer value 2147483648 too large for type `i32` + // CHECK:STDERR: · ┃ [IntTooLargeForType] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Uint32ToInt32( AddU32(Int32ToUint32(0x7FFF_FFFF), @@ -141,7 +146,12 @@ let max_plus_one: i32 = library "[[@TEST_NAME]]"; import library "int_ops"; -// CHECK:STDERR: fail_too_large_i32_for_i16.carbon:[[@LINE+2]]:25-44: error: integer value 32768 too large for type `i16` [IntTooLargeForType] +// CHECK:STDERR: ╭─┤ fail_too_large_i32_for_i16.carbon:[[@LINE+7]]:25 +// CHECK:STDERR: -> │ let max_plus_one: i16 = Int32ToInt16(0x8000); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: integer value 32768 too large for type `i16` +// CHECK:STDERR: · ┃ [IntTooLargeForType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let max_plus_one: i16 = Int32ToInt16(0x8000); @@ -150,7 +160,12 @@ let max_plus_one: i16 = Int32ToInt16(0x8000); library "[[@TEST_NAME]]"; import library "int_ops"; -// CHECK:STDERR: fail_too_large_i32_for_u16.carbon:[[@LINE+2]]:25-47: error: integer value 65536 too large for type `u16` [IntTooLargeForType] +// CHECK:STDERR: ╭─┤ fail_too_large_i32_for_u16.carbon:[[@LINE+7]]:25 +// CHECK:STDERR: -> │ let max_plus_one: u16 = Int32ToUint16(0x1_0000); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: integer value 65536 too large for type `u16` +// CHECK:STDERR: · ┃ [IntTooLargeForType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let max_plus_one: u16 = Int32ToUint16(0x1_0000); @@ -159,7 +174,12 @@ let max_plus_one: u16 = Int32ToUint16(0x1_0000); library "[[@TEST_NAME]]"; import library "int_ops"; -// CHECK:STDERR: fail_too_large_u32_for_i16.carbon:[[@LINE+2]]:25-60: error: integer value 32768 too large for type `i16` [IntTooLargeForType] +// CHECK:STDERR: ╭─┤ fail_too_large_u32_for_i16.carbon:[[@LINE+7]]:25 +// CHECK:STDERR: -> │ let max_plus_one: i16 = Uint32ToInt16(Int32ToUint32(0x8000)); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: integer value 32768 too large for type `i16` +// CHECK:STDERR: · ┃ [IntTooLargeForType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let max_plus_one: i16 = Uint32ToInt16(Int32ToUint32(0x8000)); @@ -168,7 +188,12 @@ let max_plus_one: i16 = Uint32ToInt16(Int32ToUint32(0x8000)); library "[[@TEST_NAME]]"; import library "int_ops"; -// CHECK:STDERR: fail_too_large_u32_for_u16.carbon:[[@LINE+2]]:25-63: error: integer value 65536 too large for type `u16` [IntTooLargeForType] +// CHECK:STDERR: ╭─┤ fail_too_large_u32_for_u16.carbon:[[@LINE+7]]:25 +// CHECK:STDERR: -> │ let max_plus_one: u16 = Uint32ToUint16(Int32ToUint32(0x1_0000)); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: integer value 65536 too large for type `u16` +// CHECK:STDERR: · ┃ [IntTooLargeForType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let max_plus_one: u16 = Uint32ToUint16(Int32ToUint32(0x1_0000)); @@ -177,7 +202,13 @@ let max_plus_one: u16 = Uint32ToUint16(Int32ToUint32(0x1_0000)); library "[[@TEST_NAME]]"; import library "int_ops"; -// CHECK:STDERR: fail_negative_i32_to_u16.carbon:[[@LINE+2]]:29-55: error: negative integer value -1 converted to unsigned type `u16` [NegativeIntInUnsignedType] +// CHECK:STDERR: ╭─┤ fail_negative_i32_to_u16.carbon:[[@LINE+8]]:29 +// CHECK:STDERR: -> │ let minus_one_to_u16: u16 = Int32ToUint16(SubI32(0, 1)); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: negative integer value -1 converted to +// CHECK:STDERR: · ┃ unsigned type `u16` +// CHECK:STDERR: · ┃ [NegativeIntInUnsignedType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let minus_one_to_u16: u16 = Int32ToUint16(SubI32(0, 1)); @@ -186,7 +217,13 @@ let minus_one_to_u16: u16 = Int32ToUint16(SubI32(0, 1)); library "[[@TEST_NAME]]"; import library "int_ops"; -// CHECK:STDERR: fail_negative_i32_to_u32.carbon:[[@LINE+2]]:29-55: error: negative integer value -1 converted to unsigned type `u32` [NegativeIntInUnsignedType] +// CHECK:STDERR: ╭─┤ fail_negative_i32_to_u32.carbon:[[@LINE+8]]:29 +// CHECK:STDERR: -> │ let minus_one_to_u32: u32 = Int32ToUint32(SubI32(0, 1)); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: negative integer value -1 converted to +// CHECK:STDERR: · ┃ unsigned type `u32` +// CHECK:STDERR: · ┃ [NegativeIntInUnsignedType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let minus_one_to_u32: u32 = Int32ToUint32(SubI32(0, 1)); @@ -195,7 +232,13 @@ let minus_one_to_u32: u32 = Int32ToUint32(SubI32(0, 1)); library "[[@TEST_NAME]]"; import library "int_ops"; -// CHECK:STDERR: fail_negative_i32_to_u64.carbon:[[@LINE+2]]:29-55: error: negative integer value -1 converted to unsigned type `u64` [NegativeIntInUnsignedType] +// CHECK:STDERR: ╭─┤ fail_negative_i32_to_u64.carbon:[[@LINE+8]]:29 +// CHECK:STDERR: -> │ let minus_one_to_u64: u64 = Int32ToUint64(SubI32(0, 1)); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: negative integer value -1 converted to +// CHECK:STDERR: · ┃ unsigned type `u64` +// CHECK:STDERR: · ┃ [NegativeIntInUnsignedType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let minus_one_to_u64: u64 = Int32ToUint64(SubI32(0, 1)); @@ -204,7 +247,13 @@ let minus_one_to_u64: u64 = Int32ToUint64(SubI32(0, 1)); library "[[@TEST_NAME]]"; import library "int_ops"; -// CHECK:STDERR: fail_too_small_i32_for_i16.carbon:[[@LINE+2]]:26-56: error: integer value -32769 too large for type `i16` [IntTooLargeForType] +// CHECK:STDERR: ╭─┤ fail_too_small_i32_for_i16.carbon:[[@LINE+8]]:26 +// CHECK:STDERR: -> │ let min_minus_one: i16 = Int32ToInt16(NegateI32(0x8001)); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: integer value -32769 too large for type +// CHECK:STDERR: · ┃ `i16` +// CHECK:STDERR: · ┃ [IntTooLargeForType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let min_minus_one: i16 = Int32ToInt16(NegateI32(0x8001)); @@ -215,18 +264,51 @@ import library "int_ops"; let not_constant: i32 = 0; -// CHECK:STDERR: fail_not_constant.carbon:[[@LINE+3]]:40-65: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] -// CHECK:STDERR: int_ops.carbon:19:1-32: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] +// CHECK:STDERR: ╭─┤ fail_not_constant.carbon:[[@LINE+14]]:40 +// CHECK:STDERR: -> │ let convert_not_constant_narrow: i16 = Int32ToInt16(not_constant); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: non-constant call to +// CHECK:STDERR: · ┃ compile-time-only function +// CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ int_ops.carbon +// CHECK:STDERR: │ fn Int32ToInt16(a: i32) -> i16 = "int.convert_checked"; +// CHECK:STDERR: · ────────────────┬─────────────── +// CHECK:STDERR: · ╰──┤ compile-time-only function declared here +// CHECK:STDERR: · │ [CompTimeOnlyFunctionHere] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let convert_not_constant_narrow: i16 = Int32ToInt16(not_constant); -// CHECK:STDERR: fail_not_constant.carbon:[[@LINE+3]]:38-63: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] -// CHECK:STDERR: int_ops.carbon:11:1-32: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] +// CHECK:STDERR: ╭─┤ fail_not_constant.carbon:[[@LINE+14]]:38 +// CHECK:STDERR: -> │ let convert_not_constant_same: i32 = Int32ToInt32(not_constant); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: non-constant call to +// CHECK:STDERR: · ┃ compile-time-only function +// CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ int_ops.carbon +// CHECK:STDERR: │ fn Int32ToInt32(a: i32) -> i32 = "int.convert_checked"; +// CHECK:STDERR: · ────────────────┬─────────────── +// CHECK:STDERR: · ╰──┤ compile-time-only function declared here +// CHECK:STDERR: · │ [CompTimeOnlyFunctionHere] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let convert_not_constant_same: i32 = Int32ToInt32(not_constant); -// CHECK:STDERR: fail_not_constant.carbon:[[@LINE+3]]:39-64: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] -// CHECK:STDERR: int_ops.carbon:27:1-32: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] +// CHECK:STDERR: ╭─┤ fail_not_constant.carbon:[[@LINE+14]]:39 +// CHECK:STDERR: -> │ let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: non-constant call to +// CHECK:STDERR: · ┃ compile-time-only function +// CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ int_ops.carbon +// CHECK:STDERR: │ fn Int32ToInt64(a: i32) -> i64 = "int.convert_checked"; +// CHECK:STDERR: · ────────────────┬─────────────── +// CHECK:STDERR: · ╰──┤ compile-time-only function declared here +// CHECK:STDERR: · │ [CompTimeOnlyFunctionHere] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let convert_not_constant_widen: i64 = Int32ToInt64(not_constant); diff --git a/toolchain/check/testdata/builtins/int/convert_float.carbon b/toolchain/check/testdata/builtins/int/convert_float.carbon index 36e95cffb1e9..1b530b3d7ed7 100644 --- a/toolchain/check/testdata/builtins/int/convert_float.carbon +++ b/toolchain/check/testdata/builtins/int/convert_float.carbon @@ -48,7 +48,15 @@ library "[[@TEST_NAME]]"; import library "int_to_float"; //@dump-sem-ir-begin -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:21-354: error: integer value 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 too large for floating-point type `f64` [IntTooLargeForFloatType] +// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+10]]:21 +// CHECK:STDERR: -> │ ...t overflow: f64 = ConvertIntLiteralToF64(100000000000000000000000000000000... +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: integer value +// CHECK:STDERR: · ┃ 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +// CHECK:STDERR: · ┃ too large for floating-point type `f64` +// CHECK:STDERR: · ┃ [IntTooLargeForFloatType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let overflow: f64 = ConvertIntLiteralToF64(1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000); //@dump-sem-ir-end @@ -71,10 +79,10 @@ let overflow: f64 = ConvertIntLiteralToF64(1000000000000000000000000000000000000 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { -// CHECK:STDOUT: %.loc7_354.1: %f64.761 = value_of_initializer @__global_init.%ConvertIntLiteralToF64.call [concrete = ] -// CHECK:STDOUT: %.loc7_354.2: %f64.761 = converted @__global_init.%ConvertIntLiteralToF64.call, %.loc7_354.1 [concrete = ] +// CHECK:STDOUT: %.loc15_354.1: %f64.761 = value_of_initializer @__global_init.%ConvertIntLiteralToF64.call [concrete = ] +// CHECK:STDOUT: %.loc15_354.2: %f64.761 = converted @__global_init.%ConvertIntLiteralToF64.call, %.loc15_354.1 [concrete = ] // CHECK:STDOUT: %f64: type = type_literal constants.%f64.761 [concrete = constants.%f64.761] -// CHECK:STDOUT: %overflow: %f64.761 = wrapper_binding overflow, %.loc7_354.2 [concrete = ] +// CHECK:STDOUT: %overflow: %f64.761 = wrapper_binding overflow, %.loc15_354.2 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %overflow.patt: %pattern_type.667 = value_binding_pattern overflow [concrete = constants.%overflow.patt] // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/builtins/int/convert_float_checked.carbon b/toolchain/check/testdata/builtins/int/convert_float_checked.carbon index 2a8c62bc532d..54d3f8b5f468 100644 --- a/toolchain/check/testdata/builtins/int/convert_float_checked.carbon +++ b/toolchain/check/testdata/builtins/int/convert_float_checked.carbon @@ -36,7 +36,13 @@ library "[[@TEST_NAME]]"; import library "int_to_float_checked"; //@dump-sem-ir-begin -// CHECK:STDERR: fail_lossy.carbon:[[@LINE+2]]:18-50: error: integer value 123456789 cannot be represented exactly in floating-point type `f32` [IntLossyConversionToFloat] +// CHECK:STDERR: ╭─┤ fail_lossy.carbon:[[@LINE+8]]:18 +// CHECK:STDERR: -> │ let lossy: f32 = ConvertIntLiteralToF32(123456789); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: integer value 123456789 cannot be represented +// CHECK:STDERR: · ┃ exactly in floating-point type `f32` +// CHECK:STDERR: · ┃ [IntLossyConversionToFloat] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let lossy: f32 = ConvertIntLiteralToF32(123456789); //@dump-sem-ir-end @@ -59,10 +65,10 @@ let lossy: f32 = ConvertIntLiteralToF32(123456789); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { -// CHECK:STDOUT: %.loc7_50.1: %f32.3bc = value_of_initializer @__global_init.%ConvertIntLiteralToF32.call [concrete = ] -// CHECK:STDOUT: %.loc7_50.2: %f32.3bc = converted @__global_init.%ConvertIntLiteralToF32.call, %.loc7_50.1 [concrete = ] +// CHECK:STDOUT: %.loc13_50.1: %f32.3bc = value_of_initializer @__global_init.%ConvertIntLiteralToF32.call [concrete = ] +// CHECK:STDOUT: %.loc13_50.2: %f32.3bc = converted @__global_init.%ConvertIntLiteralToF32.call, %.loc13_50.1 [concrete = ] // CHECK:STDOUT: %f32: type = type_literal constants.%f32.3bc [concrete = constants.%f32.3bc] -// CHECK:STDOUT: %lossy: %f32.3bc = wrapper_binding lossy, %.loc7_50.2 [concrete = ] +// CHECK:STDOUT: %lossy: %f32.3bc = wrapper_binding lossy, %.loc13_50.2 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %lossy.patt: %pattern_type.239 = value_binding_pattern lossy [concrete = constants.%lossy.patt] // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/builtins/int/eq.carbon b/toolchain/check/testdata/builtins/int/eq.carbon index d8f104e4aa01..b6a9e53371c8 100644 --- a/toolchain/check/testdata/builtins/int/eq.carbon +++ b/toolchain/check/testdata/builtins/int/eq.carbon @@ -34,7 +34,12 @@ fn RuntimeCallIsValid(a: i32, b: i32) -> bool { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-39: error: invalid signature for builtin function "int.eq" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn WrongResult(a: i32, b: i32) -> i32 = "int.eq"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.eq" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn WrongResult(a: i32, b: i32) -> i32 = "int.eq"; @@ -79,16 +84,43 @@ fn Eq(a: Core.IntLiteral, b: Core.IntLiteral) -> bool = "int.eq"; fn Test(n: Core.IntLiteral) { // OK Eq(1, 1); - // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+3]]:3-10: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] - // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-6]]:1-55: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] + // CHECK:STDERR: ╭─┤ fail_runtime_literal.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn Eq(a: Core.IntLiteral, b: Core.IntLiteral) -> bool = "int.eq"; + // CHECK:STDERR: · ───────────────────────────┬─────────────────────────── + // CHECK:STDERR: · ╰──┤ compile-time-only function declared here + // CHECK:STDERR: · │ [CompTimeOnlyFunctionHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Eq(n, 1); + // CHECK:STDERR: · ━━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: non-constant call to compile-time-only function + // CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Eq(n, 1); - // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+3]]:3-10: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] - // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-10]]:1-55: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] + // CHECK:STDERR: ╭─┤ fail_runtime_literal.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn Eq(a: Core.IntLiteral, b: Core.IntLiteral) -> bool = "int.eq"; + // CHECK:STDERR: · ───────────────────────────┬─────────────────────────── + // CHECK:STDERR: · ╰──┤ compile-time-only function declared here + // CHECK:STDERR: · │ [CompTimeOnlyFunctionHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Eq(1, n); + // CHECK:STDERR: · ━━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: non-constant call to compile-time-only function + // CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Eq(1, n); - // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+3]]:3-10: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] - // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-14]]:1-55: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] + // CHECK:STDERR: ╭─┤ fail_runtime_literal.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn Eq(a: Core.IntLiteral, b: Core.IntLiteral) -> bool = "int.eq"; + // CHECK:STDERR: · ───────────────────────────┬─────────────────────────── + // CHECK:STDERR: · ╰──┤ compile-time-only function declared here + // CHECK:STDERR: · │ [CompTimeOnlyFunctionHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Eq(n, n); + // CHECK:STDERR: · ━━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: non-constant call to compile-time-only function + // CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Eq(n, n); } diff --git a/toolchain/check/testdata/builtins/int/fail_convert_oversized_type.carbon b/toolchain/check/testdata/builtins/int/fail_convert_oversized_type.carbon index 983204a050b9..049aa210c3e3 100644 --- a/toolchain/check/testdata/builtins/int/fail_convert_oversized_type.carbon +++ b/toolchain/check/testdata/builtins/int/fail_convert_oversized_type.carbon @@ -17,10 +17,28 @@ library "[[@TEST_NAME]]"; // Initializing a binding whose type is an invalid integer type must not crash // constant evaluation (#7278). The type is diagnosed; the conversion of the // initializer should then produce an error value, not a CHECK failure. -// CHECK:STDERR: fail_width_not_multiple_of_8.carbon:[[@LINE+5]]:10-17: error: bit width of integer type literal must be a multiple of 8; use `Core.Int(8388609)` instead [IntWidthNotMultipleOf8] +// CHECK:STDERR: ╭─┤ fail_width_not_multiple_of_8.carbon:[[@LINE+23]]:10 +// CHECK:STDERR: -> │ let bad: i8388609 = 0; +// CHECK:STDERR: · ┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: bit width of integer type literal must be a multiple of 8; +// CHECK:STDERR: · ┃ use `Core.Int(8388609)` instead +// CHECK:STDERR: · ┃ [IntWidthNotMultipleOf8] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_width_not_multiple_of_8.carbon:[[@LINE+3]]:10-17: error: binding pattern has incomplete type `i8388609` in name binding declaration [IncompleteTypeInBindingDecl] -// CHECK:STDERR: {{.*}}/prelude/types/int.carbon:18:9-18: note: integer type width of 8388609 is greater than the maximum supported width of 8388608 [IntWidthTooLarge] +// CHECK:STDERR: ╭─┤ fail_width_not_multiple_of_8.carbon:[[@LINE+15]]:10 +// CHECK:STDERR: -> │ let bad: i8388609 = 0; +// CHECK:STDERR: · ┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: binding pattern has incomplete type `i8388609` in name +// CHECK:STDERR: · ┃ binding declaration +// CHECK:STDERR: · ┃ [IncompleteTypeInBindingDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ {{.*}}/prelude/types/int.carbon +// CHECK:STDERR: │ adapt MakeInt(N); +// CHECK:STDERR: · ┬───────── +// CHECK:STDERR: · ╰──┤ integer type width of 8388609 is greater than the maximum supported +// CHECK:STDERR: · │ width of 8388608 +// CHECK:STDERR: · │ [IntWidthTooLarge] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let bad: i8388609 = 0; @@ -28,8 +46,20 @@ let bad: i8388609 = 0; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_width_too_large.carbon:[[@LINE+3]]:10-18: error: binding pattern has incomplete type `i16777216` in name binding declaration [IncompleteTypeInBindingDecl] -// CHECK:STDERR: {{.*}}/prelude/types/int.carbon:18:9-18: note: integer type width of 16777216 is greater than the maximum supported width of 8388608 [IntWidthTooLarge] +// CHECK:STDERR: ╭─┤ fail_width_too_large.carbon:[[@LINE+15]]:10 +// CHECK:STDERR: -> │ let bad: i16777216 = 0; +// CHECK:STDERR: · ┳━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: binding pattern has incomplete type `i16777216` in name +// CHECK:STDERR: · ┃ binding declaration +// CHECK:STDERR: · ┃ [IncompleteTypeInBindingDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ {{.*}}/prelude/types/int.carbon +// CHECK:STDERR: │ adapt MakeInt(N); +// CHECK:STDERR: · ┬───────── +// CHECK:STDERR: · ╰──┤ integer type width of 16777216 is greater than the maximum +// CHECK:STDERR: · │ supported width of 8388608 +// CHECK:STDERR: · │ [IntWidthTooLarge] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let bad: i16777216 = 0; @@ -37,7 +67,19 @@ let bad: i16777216 = 0; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_width_too_large_core_int.carbon:[[@LINE+3]]:10-26: error: binding pattern has incomplete type `i8388609` in name binding declaration [IncompleteTypeInBindingDecl] -// CHECK:STDERR: {{.*}}/prelude/types/int.carbon:18:9-18: note: integer type width of 8388609 is greater than the maximum supported width of 8388608 [IntWidthTooLarge] +// CHECK:STDERR: ╭─┤ fail_width_too_large_core_int.carbon:[[@LINE+15]]:10 +// CHECK:STDERR: -> │ let bad: Core.Int(8388609) = 0; +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: binding pattern has incomplete type `i8388609` in name +// CHECK:STDERR: · ┃ binding declaration +// CHECK:STDERR: · ┃ [IncompleteTypeInBindingDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ {{.*}}/prelude/types/int.carbon +// CHECK:STDERR: │ adapt MakeInt(N); +// CHECK:STDERR: · ┬───────── +// CHECK:STDERR: · ╰──┤ integer type width of 8388609 is greater than the maximum supported +// CHECK:STDERR: · │ width of 8388608 +// CHECK:STDERR: · │ [IntWidthTooLarge] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let bad: Core.Int(8388609) = 0; diff --git a/toolchain/check/testdata/builtins/int/left_shift.carbon b/toolchain/check/testdata/builtins/int/left_shift.carbon index d97e04f412ad..0d8b35e8f754 100644 --- a/toolchain/check/testdata/builtins/int/left_shift.carbon +++ b/toolchain/check/testdata/builtins/int/left_shift.carbon @@ -111,36 +111,81 @@ fn LeftShiftLit(a: Core.IntLiteral, b: i32) -> Core.IntLiteral = "int.left_shift // Shift greater than size is disallowed for sized types. let size_1: i32 = LeftShift(1, 31); -// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+2]]:19-34: error: shift distance >= type width of 32 in `1 << 32` [CompileTimeShiftOutOfRange] +// CHECK:STDERR: ╭─┤ fail_bad_shift.carbon:[[@LINE+7]]:19 +// CHECK:STDERR: -> │ let size_2: i32 = LeftShift(1, 32); +// CHECK:STDERR: · ━━━┳━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: shift distance >= type width of 32 in `1 << 32` +// CHECK:STDERR: · ┃ [CompileTimeShiftOutOfRange] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let size_2: i32 = LeftShift(1, 32); -// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+2]]:19-34: error: shift distance >= type width of 32 in `1 << 33` [CompileTimeShiftOutOfRange] +// CHECK:STDERR: ╭─┤ fail_bad_shift.carbon:[[@LINE+7]]:19 +// CHECK:STDERR: -> │ let size_3: i32 = LeftShift(1, 33); +// CHECK:STDERR: · ━━━┳━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: shift distance >= type width of 32 in `1 << 33` +// CHECK:STDERR: · ┃ [CompileTimeShiftOutOfRange] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let size_3: i32 = LeftShift(1, 33); // Overflow is allowed if the shift distance is in bounds. let overflow_1: i32 = LeftShift(1000, 31); -// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+2]]:23-41: error: shift distance >= type width of 32 in `1000 << 32` [CompileTimeShiftOutOfRange] +// CHECK:STDERR: ╭─┤ fail_bad_shift.carbon:[[@LINE+8]]:23 +// CHECK:STDERR: -> │ let overflow_2: i32 = LeftShift(1000, 32); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: shift distance >= type width of 32 in +// CHECK:STDERR: · ┃ `1000 << 32` +// CHECK:STDERR: · ┃ [CompileTimeShiftOutOfRange] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let overflow_2: i32 = LeftShift(1000, 32); // Oversize shifts aren't allowed even if there's no overflow. let no_overflow_1: i32 = LeftShift(0, 31); -// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+2]]:26-41: error: shift distance >= type width of 32 in `0 << 32` [CompileTimeShiftOutOfRange] +// CHECK:STDERR: ╭─┤ fail_bad_shift.carbon:[[@LINE+8]]:26 +// CHECK:STDERR: -> │ let no_overflow_2: i32 = LeftShift(0, 32); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: shift distance >= type width of 32 in +// CHECK:STDERR: · ┃ `0 << 32` +// CHECK:STDERR: · ┃ [CompileTimeShiftOutOfRange] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let no_overflow_2: i32 = LeftShift(0, 32); // Negative shifts aren't allowed either, even for literals, even if the lhs is zero. -// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+2]]:21-36: error: shift distance >= type width of 32 in `1 << -1` [CompileTimeShiftOutOfRange] +// CHECK:STDERR: ╭─┤ fail_bad_shift.carbon:[[@LINE+7]]:21 +// CHECK:STDERR: -> │ let negative: i32 = LeftShift(1, -1); +// CHECK:STDERR: · ━┳━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: shift distance >= type width of 32 in `1 << -1` +// CHECK:STDERR: · ┃ [CompileTimeShiftOutOfRange] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let negative: i32 = LeftShift(1, -1); -// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+2]]:26-41: error: shift distance >= type width of 32 in `0 << -1` [CompileTimeShiftOutOfRange] +// CHECK:STDERR: ╭─┤ fail_bad_shift.carbon:[[@LINE+8]]:26 +// CHECK:STDERR: -> │ let negative_zero: i32 = LeftShift(0, -1); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: shift distance >= type width of 32 in +// CHECK:STDERR: · ┃ `0 << -1` +// CHECK:STDERR: · ┃ [CompileTimeShiftOutOfRange] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let negative_zero: i32 = LeftShift(0, -1); -// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+2]]:37-55: error: shift distance negative in `1 << -1` [CompileTimeShiftNegative] +// CHECK:STDERR: ╭─┤ fail_bad_shift.carbon:[[@LINE+8]]:37 +// CHECK:STDERR: -> │ let negative_lit: Core.IntLiteral = LeftShiftLit(1, -1); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: shift distance negative in +// CHECK:STDERR: · ┃ `1 << -1` +// CHECK:STDERR: · ┃ [CompileTimeShiftNegative] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let negative_lit: Core.IntLiteral = LeftShiftLit(1, -1); -// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+2]]:42-60: error: shift distance negative in `0 << -1` [CompileTimeShiftNegative] +// CHECK:STDERR: ╭─┤ fail_bad_shift.carbon:[[@LINE+8]]:42 +// CHECK:STDERR: -> │ let negative_lit_zero: Core.IntLiteral = LeftShiftLit(0, -1); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: shift distance negative in +// CHECK:STDERR: · ┃ `0 << -1` +// CHECK:STDERR: · ┃ [CompileTimeShiftNegative] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let negative_lit_zero: Core.IntLiteral = LeftShiftLit(0, -1); @@ -150,11 +195,25 @@ library "[[@TEST_NAME]]"; fn LeftShift(a: Core.IntLiteral, b: Core.IntLiteral) -> Core.IntLiteral = "int.left_shift"; -// CHECK:STDERR: fail_literal_overflow.carbon:[[@LINE+2]]:16-42: error: shift distance of 1000000000 would result in an integer whose width is greater than the maximum supported width of 8388608 [CompileTimeUnsizedShiftOutOfRange] +// CHECK:STDERR: ╭─┤ fail_literal_overflow.carbon:[[@LINE+9]]:16 +// CHECK:STDERR: -> │ let bad: i32 = LeftShift(1, 1_000_000_000); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: shift distance of 1000000000 would result in an +// CHECK:STDERR: · ┃ integer whose width is greater than the maximum +// CHECK:STDERR: · ┃ supported width of 8388608 +// CHECK:STDERR: · ┃ [CompileTimeUnsizedShiftOutOfRange] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let bad: i32 = LeftShift(1, 1_000_000_000); -// CHECK:STDERR: fail_literal_overflow.carbon:[[@LINE+2]]:25-52: error: shift distance of 1000000000 would result in an integer whose width is greater than the maximum supported width of 8388608 [CompileTimeUnsizedShiftOutOfRange] +// CHECK:STDERR: ╭─┤ fail_literal_overflow.carbon:[[@LINE+9]]:25 +// CHECK:STDERR: -> │ let bad_negative: i32 = LeftShift(-1, 1_000_000_000); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: shift distance of 1000000000 would result in +// CHECK:STDERR: · ┃ an integer whose width is greater than the +// CHECK:STDERR: · ┃ maximum supported width of 8388608 +// CHECK:STDERR: · ┃ [CompileTimeUnsizedShiftOutOfRange] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let bad_negative: i32 = LeftShift(-1, 1_000_000_000); @@ -169,26 +228,64 @@ var a_lit: Core.IntLiteral = 12; var an_i32: i32 = 34; // This can't be valid: we don't have a compile-time or runtime integer value for `a_lit`. -// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE+3]]:17-45: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] -// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE-8]]:1-54: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] +// CHECK:STDERR: ╭─┤ fail_comp_time_only_shift.carbon:[[@LINE+12]]:17 +// CHECK:STDERR: │ fn LeftShiftByLit(a: i32, b: Core.IntLiteral) -> i32 = "int.left_shift"; +// CHECK:STDERR: · ───────────────────────────┬────────────────────────── +// CHECK:STDERR: · ╰──┤ compile-time-only function declared here +// CHECK:STDERR: · │ [CompTimeOnlyFunctionHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ let bad1: i32 = LeftShiftByLit(an_i32, a_lit); +// CHECK:STDERR: · ━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: non-constant call to compile-time-only function +// CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let bad1: i32 = LeftShiftByLit(an_i32, a_lit); // TODO: This could be valid because we don't actually need the return value at runtime. -// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE+3]]:29-57: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] -// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE-13]]:1-66: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] +// CHECK:STDERR: ╭─┤ fail_comp_time_only_shift.carbon:[[@LINE+13]]:29 +// CHECK:STDERR: │ fn LeftShiftOfLit(a: Core.IntLiteral, b: i32) -> Core.IntLiteral = "int.le... +// CHECK:STDERR: · ─────────────────────────────────┬──────────────────────────────── +// CHECK:STDERR: · ╰──┤ compile-time-only function declared here +// CHECK:STDERR: · │ [CompTimeOnlyFunctionHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ let bad2: Core.IntLiteral = LeftShiftOfLit(a_lit, an_i32); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: non-constant call to compile-time-only +// CHECK:STDERR: · ┃ function +// CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let bad2: Core.IntLiteral = LeftShiftOfLit(a_lit, an_i32); // TODO: This could be valid because the literal argument has a constant value. -// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE+3]]:17-42: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] -// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE-20]]:1-54: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] +// CHECK:STDERR: ╭─┤ fail_comp_time_only_shift.carbon:[[@LINE+12]]:17 +// CHECK:STDERR: │ fn LeftShiftByLit(a: i32, b: Core.IntLiteral) -> i32 = "int.left_shift"; +// CHECK:STDERR: · ───────────────────────────┬────────────────────────── +// CHECK:STDERR: · ╰──┤ compile-time-only function declared here +// CHECK:STDERR: · │ [CompTimeOnlyFunctionHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ let bad3: i32 = LeftShiftByLit(an_i32, 12); +// CHECK:STDERR: · ━━━━━┳━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: non-constant call to compile-time-only function +// CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let bad3: i32 = LeftShiftByLit(an_i32, 12); // TODO: This could be valid because we don't actually need the return value at runtime. -// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE+3]]:29-54: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] -// CHECK:STDERR: fail_comp_time_only_shift.carbon:[[@LINE-25]]:1-66: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] +// CHECK:STDERR: ╭─┤ fail_comp_time_only_shift.carbon:[[@LINE+13]]:29 +// CHECK:STDERR: │ fn LeftShiftOfLit(a: Core.IntLiteral, b: i32) -> Core.IntLiteral = "int.le... +// CHECK:STDERR: · ─────────────────────────────────┬──────────────────────────────── +// CHECK:STDERR: · ╰──┤ compile-time-only function declared here +// CHECK:STDERR: · │ [CompTimeOnlyFunctionHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ let bad4: Core.IntLiteral = LeftShiftOfLit(12, an_i32); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: non-constant call to compile-time-only +// CHECK:STDERR: · ┃ function +// CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let bad4: Core.IntLiteral = LeftShiftOfLit(12, an_i32); diff --git a/toolchain/check/testdata/builtins/int/left_shift_assign.carbon b/toolchain/check/testdata/builtins/int/left_shift_assign.carbon index 31d0c7d5b9cb..f41fb0b5fca4 100644 --- a/toolchain/check/testdata/builtins/int/left_shift_assign.carbon +++ b/toolchain/check/testdata/builtins/int/left_shift_assign.carbon @@ -34,7 +34,12 @@ fn CallMixed(ref a: i32, b: i64) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.left_shift_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_unsized.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.left_shift_a... +// CHECK:STDERR: · ━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.left_shift_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.left_shift_assign"; @@ -42,7 +47,12 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.left_shift_assign" library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.left_shift_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn NotRef(a: i32, b: i32) = "int.left_shift_assign"; +// CHECK:STDERR: · ━━━━━━┳━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.left_shift_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.left_shift_assign"; diff --git a/toolchain/check/testdata/builtins/int/less_eq.carbon b/toolchain/check/testdata/builtins/int/less_eq.carbon index 9bf391e712d2..01f458215183 100644 --- a/toolchain/check/testdata/builtins/int/less_eq.carbon +++ b/toolchain/check/testdata/builtins/int/less_eq.carbon @@ -79,16 +79,43 @@ fn LessEq(a: Core.IntLiteral, b: Core.IntLiteral) -> bool = "int.less_eq"; fn Test(n: Core.IntLiteral) { // OK LessEq(1, 1); - // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+3]]:3-14: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] - // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-6]]:1-59: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] + // CHECK:STDERR: ╭─┤ fail_runtime_literal.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn LessEq(a: Core.IntLiteral, b: Core.IntLiteral) -> bool = "int.less_eq"; + // CHECK:STDERR: · ─────────────────────────────┬───────────────────────────── + // CHECK:STDERR: · ╰──┤ compile-time-only function declared here + // CHECK:STDERR: · │ [CompTimeOnlyFunctionHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ LessEq(n, 1); + // CHECK:STDERR: · ━━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: non-constant call to compile-time-only function + // CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: ╰──── // CHECK:STDERR: LessEq(n, 1); - // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+3]]:3-14: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] - // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-10]]:1-59: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] + // CHECK:STDERR: ╭─┤ fail_runtime_literal.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn LessEq(a: Core.IntLiteral, b: Core.IntLiteral) -> bool = "int.less_eq"; + // CHECK:STDERR: · ─────────────────────────────┬───────────────────────────── + // CHECK:STDERR: · ╰──┤ compile-time-only function declared here + // CHECK:STDERR: · │ [CompTimeOnlyFunctionHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ LessEq(1, n); + // CHECK:STDERR: · ━━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: non-constant call to compile-time-only function + // CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: ╰──── // CHECK:STDERR: LessEq(1, n); - // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE+3]]:3-14: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] - // CHECK:STDERR: fail_runtime_literal.carbon:[[@LINE-14]]:1-59: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] + // CHECK:STDERR: ╭─┤ fail_runtime_literal.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn LessEq(a: Core.IntLiteral, b: Core.IntLiteral) -> bool = "int.less_eq"; + // CHECK:STDERR: · ─────────────────────────────┬───────────────────────────── + // CHECK:STDERR: · ╰──┤ compile-time-only function declared here + // CHECK:STDERR: · │ [CompTimeOnlyFunctionHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ LessEq(n, n); + // CHECK:STDERR: · ━━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: non-constant call to compile-time-only function + // CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: ╰──── // CHECK:STDERR: LessEq(n, n); } diff --git a/toolchain/check/testdata/builtins/int/make_type_signed.carbon b/toolchain/check/testdata/builtins/int/make_type_signed.carbon index 006469338060..bb2e68b3c341 100644 --- a/toolchain/check/testdata/builtins/int/make_type_signed.carbon +++ b/toolchain/check/testdata/builtins/int/make_type_signed.carbon @@ -71,7 +71,12 @@ library "[[@TEST_NAME]]"; import library "types"; -// CHECK:STDERR: fail_zero_size.carbon:[[@LINE+2]]:8-13: error: integer type width of 0 is not positive [IntWidthNotPositive] +// CHECK:STDERR: ╭─┤ fail_zero_size.carbon:[[@LINE+7]]:8 +// CHECK:STDERR: -> │ var n: Int(0); +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: integer type width of 0 is not positive +// CHECK:STDERR: · ┃ [IntWidthNotPositive] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var n: Int(0); @@ -83,7 +88,12 @@ import library "types"; fn Negate(a: IntLiteral) -> IntLiteral = "int.snegate"; -// CHECK:STDERR: fail_negative_size.carbon:[[@LINE+2]]:8-21: error: integer type width of -1 is not positive [IntWidthNotPositive] +// CHECK:STDERR: ╭─┤ fail_negative_size.carbon:[[@LINE+7]]:8 +// CHECK:STDERR: -> │ var n: Int(Negate(1)); +// CHECK:STDERR: · ━━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: integer type width of -1 is not positive +// CHECK:STDERR: · ┃ [IntWidthNotPositive] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var n: Int(Negate(1)); @@ -93,7 +103,13 @@ library "[[@TEST_NAME]]"; import library "types"; -// CHECK:STDERR: fail_oversized.carbon:[[@LINE+2]]:8-22: error: integer type width of 1000000000 is greater than the maximum supported width of 8388608 [IntWidthTooLarge] +// CHECK:STDERR: ╭─┤ fail_oversized.carbon:[[@LINE+8]]:8 +// CHECK:STDERR: -> │ var m: Int(1000000000); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: integer type width of 1000000000 is greater than the maximum +// CHECK:STDERR: · ┃ supported width of 8388608 +// CHECK:STDERR: · ┃ [IntWidthTooLarge] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var m: Int(1000000000); diff --git a/toolchain/check/testdata/builtins/int/make_type_unsigned.carbon b/toolchain/check/testdata/builtins/int/make_type_unsigned.carbon index 9a49beeea121..f2e9aa33a3a2 100644 --- a/toolchain/check/testdata/builtins/int/make_type_unsigned.carbon +++ b/toolchain/check/testdata/builtins/int/make_type_unsigned.carbon @@ -53,7 +53,12 @@ library "[[@TEST_NAME]]"; import library "types"; -// CHECK:STDERR: fail_zero_size.carbon:[[@LINE+2]]:8-14: error: integer type width of 0 is not positive [IntWidthNotPositive] +// CHECK:STDERR: ╭─┤ fail_zero_size.carbon:[[@LINE+7]]:8 +// CHECK:STDERR: -> │ var n: UInt(0); +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: integer type width of 0 is not positive +// CHECK:STDERR: · ┃ [IntWidthNotPositive] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var n: UInt(0); @@ -65,7 +70,12 @@ import library "types"; fn Negate(n: i32) -> i32 = "int.snegate"; -// CHECK:STDERR: fail_negative_size.carbon:[[@LINE+2]]:8-22: error: integer type width of -1 is not positive [IntWidthNotPositive] +// CHECK:STDERR: ╭─┤ fail_negative_size.carbon:[[@LINE+7]]:8 +// CHECK:STDERR: -> │ var n: UInt(Negate(1)); +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: integer type width of -1 is not positive +// CHECK:STDERR: · ┃ [IntWidthNotPositive] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var n: UInt(Negate(1)); @@ -75,7 +85,13 @@ library "[[@TEST_NAME]]"; import library "types"; -// CHECK:STDERR: fail_oversized.carbon:[[@LINE+2]]:8-23: error: integer type width of 1000000000 is greater than the maximum supported width of 8388608 [IntWidthTooLarge] +// CHECK:STDERR: ╭─┤ fail_oversized.carbon:[[@LINE+8]]:8 +// CHECK:STDERR: -> │ var m: UInt(1000000000); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: integer type width of 1000000000 is greater than the maximum +// CHECK:STDERR: · ┃ supported width of 8388608 +// CHECK:STDERR: · ┃ [IntWidthTooLarge] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var m: UInt(1000000000); diff --git a/toolchain/check/testdata/builtins/int/or_assign.carbon b/toolchain/check/testdata/builtins/int/or_assign.carbon index fa609108165f..ffd2c4cc839e 100644 --- a/toolchain/check/testdata/builtins/int/or_assign.carbon +++ b/toolchain/check/testdata/builtins/int/or_assign.carbon @@ -26,7 +26,12 @@ fn Call(ref a: i32, b: i32) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.or_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_unsized.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.or_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.or_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.or_assign"; @@ -34,11 +39,21 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.or_assign"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.or_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn NotRef(a: i32, b: i32) = "int.or_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.or_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.or_assign"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.or_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn MixedTypes(ref a: i32, b: i64) = "int.or_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.or_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn MixedTypes(ref a: i32, b: i64) = "int.or_assign"; diff --git a/toolchain/check/testdata/builtins/int/right_shift.carbon b/toolchain/check/testdata/builtins/int/right_shift.carbon index 587b03dbdc9b..b2077a0847b3 100644 --- a/toolchain/check/testdata/builtins/int/right_shift.carbon +++ b/toolchain/check/testdata/builtins/int/right_shift.carbon @@ -99,24 +99,57 @@ fn RightShiftLit(a: Core.IntLiteral, b: i32) -> Core.IntLiteral = "int.right_shi // Shift greater than size is disallowed for sized types. let size_1: i32 = RightShift(1, 31); -// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+2]]:19-35: error: shift distance >= type width of 32 in `1 >> 32` [CompileTimeShiftOutOfRange] +// CHECK:STDERR: ╭─┤ fail_bad_shift.carbon:[[@LINE+7]]:19 +// CHECK:STDERR: -> │ let size_2: i32 = RightShift(1, 32); +// CHECK:STDERR: · ━━━┳━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: shift distance >= type width of 32 in `1 >> 32` +// CHECK:STDERR: · ┃ [CompileTimeShiftOutOfRange] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let size_2: i32 = RightShift(1, 32); -// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+2]]:19-35: error: shift distance >= type width of 32 in `1 >> 33` [CompileTimeShiftOutOfRange] +// CHECK:STDERR: ╭─┤ fail_bad_shift.carbon:[[@LINE+7]]:19 +// CHECK:STDERR: -> │ let size_3: i32 = RightShift(1, 33); +// CHECK:STDERR: · ━━━┳━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: shift distance >= type width of 32 in `1 >> 33` +// CHECK:STDERR: · ┃ [CompileTimeShiftOutOfRange] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let size_3: i32 = RightShift(1, 33); // Negative shifts aren't allowed either, even for literals, even if the lhs is zero. -// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+2]]:21-37: error: shift distance >= type width of 32 in `1 >> -1` [CompileTimeShiftOutOfRange] +// CHECK:STDERR: ╭─┤ fail_bad_shift.carbon:[[@LINE+7]]:21 +// CHECK:STDERR: -> │ let negative: i32 = RightShift(1, -1); +// CHECK:STDERR: · ━┳━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: shift distance >= type width of 32 in `1 >> -1` +// CHECK:STDERR: · ┃ [CompileTimeShiftOutOfRange] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let negative: i32 = RightShift(1, -1); -// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+2]]:26-42: error: shift distance >= type width of 32 in `0 >> -1` [CompileTimeShiftOutOfRange] +// CHECK:STDERR: ╭─┤ fail_bad_shift.carbon:[[@LINE+8]]:26 +// CHECK:STDERR: -> │ let negative_zero: i32 = RightShift(0, -1); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: shift distance >= type width of 32 in +// CHECK:STDERR: · ┃ `0 >> -1` +// CHECK:STDERR: · ┃ [CompileTimeShiftOutOfRange] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let negative_zero: i32 = RightShift(0, -1); -// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+2]]:37-56: error: shift distance negative in `1 >> -1` [CompileTimeShiftNegative] +// CHECK:STDERR: ╭─┤ fail_bad_shift.carbon:[[@LINE+8]]:37 +// CHECK:STDERR: -> │ let negative_lit: Core.IntLiteral = RightShiftLit(1, -1); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: shift distance negative in +// CHECK:STDERR: · ┃ `1 >> -1` +// CHECK:STDERR: · ┃ [CompileTimeShiftNegative] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let negative_lit: Core.IntLiteral = RightShiftLit(1, -1); -// CHECK:STDERR: fail_bad_shift.carbon:[[@LINE+2]]:42-61: error: shift distance negative in `0 >> -1` [CompileTimeShiftNegative] +// CHECK:STDERR: ╭─┤ fail_bad_shift.carbon:[[@LINE+8]]:42 +// CHECK:STDERR: -> │ let negative_lit_zero: Core.IntLiteral = RightShiftLit(0, -1); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: shift distance negative in +// CHECK:STDERR: · ┃ `0 >> -1` +// CHECK:STDERR: · ┃ [CompileTimeShiftNegative] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let negative_lit_zero: Core.IntLiteral = RightShiftLit(0, -1); diff --git a/toolchain/check/testdata/builtins/int/right_shift_assign.carbon b/toolchain/check/testdata/builtins/int/right_shift_assign.carbon index 4314182ae943..2e5cce58e1c1 100644 --- a/toolchain/check/testdata/builtins/int/right_shift_assign.carbon +++ b/toolchain/check/testdata/builtins/int/right_shift_assign.carbon @@ -34,7 +34,12 @@ fn CallMixed(ref a: i32, b: i64) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.right_shift_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_unsized.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.right_shift_... +// CHECK:STDERR: · ━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.right_shift_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.right_shift_assign"; @@ -42,7 +47,12 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.right_shift_assign library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.right_shift_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn NotRef(a: i32, b: i32) = "int.right_shift_assign"; +// CHECK:STDERR: · ━━━━━┳━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.right_shift_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.right_shift_assign"; diff --git a/toolchain/check/testdata/builtins/int/sadd.carbon b/toolchain/check/testdata/builtins/int/sadd.carbon index aebbe79b23ff..85cce2909da9 100644 --- a/toolchain/check/testdata/builtins/int/sadd.carbon +++ b/toolchain/check/testdata/builtins/int/sadd.carbon @@ -57,11 +57,20 @@ fn F() { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_too_few.carbon:[[@LINE+2]]:1-26: error: invalid signature for builtin function "int.sadd" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_too_few.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn TooFew(a: i32) -> i32 = "int.sadd"; +// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.sadd" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn TooFew(a: i32) -> i32 = "int.sadd"; -// CHECK:STDERR: fail_too_few.carbon:[[@LINE+2]]:26-32: error: name `TooMany` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_too_few.carbon:[[@LINE+6]]:26 +// CHECK:STDERR: -> │ var too_many: array(i32, TooMany(1, 2, 3)); +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: name `TooMany` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var too_many: array(i32, TooMany(1, 2, 3)); @@ -73,11 +82,21 @@ fn RuntimeCallIsValidTooFew(a: i32) -> i32 { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_too_many.carbon:[[@LINE+2]]:1-43: error: invalid signature for builtin function "int.sadd" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_too_many.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn TooMany(a: i32, b: i32, c: i32) -> i32 = "int.sadd"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.sadd" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn TooMany(a: i32, b: i32, c: i32) -> i32 = "int.sadd"; -// CHECK:STDERR: fail_too_many.carbon:[[@LINE+2]]:33-45: error: name `BadReturnType` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_too_many.carbon:[[@LINE+7]]:33 +// CHECK:STDERR: -> │ var bad_return_type: array(i32, BadReturnType(1, 2)); +// CHECK:STDERR: · ━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: name `BadReturnType` not found +// CHECK:STDERR: · ┃ [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var bad_return_type: array(i32, BadReturnType(1, 2)); @@ -89,11 +108,20 @@ fn RuntimeCallIsValidTooMany(a: i32, b: i32, c: i32) -> i32 { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+2]]:1-42: error: invalid signature for builtin function "int.sadd" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_return_type.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn BadReturnType(a: i32, b: i32) -> bool = "int.sadd"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.sadd" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn BadReturnType(a: i32, b: i32) -> bool = "int.sadd"; -// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+2]]:25-30: error: name `TooFew` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_bad_return_type.carbon:[[@LINE+6]]:25 +// CHECK:STDERR: -> │ var too_few: array(i32, TooFew(1)); +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: name `TooFew` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var too_few: array(i32, TooFew(1)); @@ -105,7 +133,12 @@ fn RuntimeCallIsValidBadReturnType(a: i32, b: i32) -> bool { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_call.carbon:[[@LINE+2]]:26-34: error: name `JustRight` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_bad_call.carbon:[[@LINE+7]]:26 +// CHECK:STDERR: -> │ var bad_call: array(i32, JustRight(1, 2, 3)); +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: name `JustRight` not found +// CHECK:STDERR: · ┃ [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var bad_call: array(i32, JustRight(1, 2, 3)); @@ -113,16 +146,36 @@ var bad_call: array(i32, JustRight(1, 2, 3)); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_mixed_add.carbon:[[@LINE+2]]:1-49: error: invalid signature for builtin function "int.sadd" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_mixed_add.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn MixedAdd1(a: i32, b: Core.IntLiteral) -> i32 = "int.sadd"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.sadd" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn MixedAdd1(a: i32, b: Core.IntLiteral) -> i32 = "int.sadd"; -// CHECK:STDERR: fail_mixed_add.carbon:[[@LINE+2]]:1-49: error: invalid signature for builtin function "int.sadd" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_mixed_add.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn MixedAdd2(a: Core.IntLiteral, b: i32) -> i32 = "int.sadd"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.sadd" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn MixedAdd2(a: Core.IntLiteral, b: i32) -> i32 = "int.sadd"; -// CHECK:STDERR: fail_mixed_add.carbon:[[@LINE+2]]:1-61: error: invalid signature for builtin function "int.sadd" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_mixed_add.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn MixedAdd3(a: i32, b: Core.IntLiteral) -> Core.IntLiteral = "int.sadd"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.sadd" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn MixedAdd3(a: i32, b: Core.IntLiteral) -> Core.IntLiteral = "int.sadd"; -// CHECK:STDERR: fail_mixed_add.carbon:[[@LINE+2]]:1-61: error: invalid signature for builtin function "int.sadd" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_mixed_add.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn MixedAdd4(a: Core.IntLiteral, b: i32) -> Core.IntLiteral = "int.sadd"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.sadd" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn MixedAdd4(a: Core.IntLiteral, b: i32) -> Core.IntLiteral = "int.sadd"; @@ -133,7 +186,12 @@ library "[[@TEST_NAME]]"; fn Add(a: i32, b: i32) -> i32 = "int.sadd"; let a: i32 = Add(0x7FFFFFFF, 0); -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:14-31: error: integer overflow in calculation `2147483647 + 1` [CompileTimeIntegerOverflow] +// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+7]]:14 +// CHECK:STDERR: -> │ let b: i32 = Add(0x7FFFFFFF, 1); +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: integer overflow in calculation `2147483647 + 1` +// CHECK:STDERR: · ┃ [CompileTimeIntegerOverflow] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let b: i32 = Add(0x7FFFFFFF, 1); diff --git a/toolchain/check/testdata/builtins/int/sadd_assign.carbon b/toolchain/check/testdata/builtins/int/sadd_assign.carbon index 067da74df060..906dafc9e271 100644 --- a/toolchain/check/testdata/builtins/int/sadd_assign.carbon +++ b/toolchain/check/testdata/builtins/int/sadd_assign.carbon @@ -24,7 +24,12 @@ fn Call(ref a: i32, b: i32) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.sadd_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_unsized.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.sadd_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.sadd_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.sadd_assign"; @@ -32,10 +37,20 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.sadd_assign"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.sadd_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn NotRef(a: i32, b: i32) = "int.sadd_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.sadd_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.sadd_assign"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.sadd_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn MixedTypes(ref a: i32, b: i64) = "int.sadd_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.sadd_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn MixedTypes(ref a: i32, b: i64) = "int.sadd_assign"; diff --git a/toolchain/check/testdata/builtins/int/sdiv.carbon b/toolchain/check/testdata/builtins/int/sdiv.carbon index b1da9d4b7ffd..dbb1ab52684f 100644 --- a/toolchain/check/testdata/builtins/int/sdiv.carbon +++ b/toolchain/check/testdata/builtins/int/sdiv.carbon @@ -40,7 +40,12 @@ let a: i32 = Div(-0x7FFF_FFFF, -1); let b: i32 = Div(-0x8000_0000, 1); // -0x8000_0000 / -1 overflows. -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:14-34: error: integer overflow in calculation `-2147483648 / -1` [CompileTimeIntegerOverflow] +// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+7]]:14 +// CHECK:STDERR: -> │ let c: i32 = Div(-0x8000_0000, -1); +// CHECK:STDERR: · ━━━━━┳━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: integer overflow in calculation `-2147483648 / -1` +// CHECK:STDERR: · ┃ [CompileTimeIntegerOverflow] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let c: i32 = Div(-0x8000_0000, -1); @@ -65,20 +70,38 @@ library "[[@TEST_NAME]]"; fn Div(a: i32, b: i32) -> i32 = "int.sdiv"; fn DivLit(a: Core.IntLiteral, b: Core.IntLiteral) -> Core.IntLiteral = "int.sdiv"; -// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+2]]:14-22: error: division by zero [CompileTimeDivisionByZero] +// CHECK:STDERR: ╭─┤ fail_div_by_zero.carbon:[[@LINE+6]]:14 +// CHECK:STDERR: -> │ let a: i32 = Div(1, 0); +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: division by zero [CompileTimeDivisionByZero] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let a: i32 = Div(1, 0); -// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+2]]:14-22: error: division by zero [CompileTimeDivisionByZero] +// CHECK:STDERR: ╭─┤ fail_div_by_zero.carbon:[[@LINE+6]]:14 +// CHECK:STDERR: -> │ let b: i32 = Div(0, 0); +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: division by zero [CompileTimeDivisionByZero] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let b: i32 = Div(0, 0); // IntLiteral allows "overflow" by widening its representation, but not overflow to infinity. -// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+2]]:26-37: error: division by zero [CompileTimeDivisionByZero] +// CHECK:STDERR: ╭─┤ fail_div_by_zero.carbon:[[@LINE+7]]:26 +// CHECK:STDERR: -> │ let c: Core.IntLiteral = DivLit(1, 0); +// CHECK:STDERR: · ━━━━━━┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: division by zero +// CHECK:STDERR: · ┃ [CompileTimeDivisionByZero] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let c: Core.IntLiteral = DivLit(1, 0); -// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+2]]:26-37: error: division by zero [CompileTimeDivisionByZero] +// CHECK:STDERR: ╭─┤ fail_div_by_zero.carbon:[[@LINE+7]]:26 +// CHECK:STDERR: -> │ let d: Core.IntLiteral = DivLit(0, 0); +// CHECK:STDERR: · ━━━━━━┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: division by zero +// CHECK:STDERR: · ┃ [CompileTimeDivisionByZero] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let d: Core.IntLiteral = DivLit(0, 0); diff --git a/toolchain/check/testdata/builtins/int/sdiv_assign.carbon b/toolchain/check/testdata/builtins/int/sdiv_assign.carbon index 5315afff8a40..6d9b882538bf 100644 --- a/toolchain/check/testdata/builtins/int/sdiv_assign.carbon +++ b/toolchain/check/testdata/builtins/int/sdiv_assign.carbon @@ -26,7 +26,12 @@ fn Call(ref a: i32, b: i32) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.sdiv_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_unsized.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.sdiv_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.sdiv_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.sdiv_assign"; @@ -34,11 +39,21 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.sdiv_assign"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.sdiv_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn NotRef(a: i32, b: i32) = "int.sdiv_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.sdiv_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.sdiv_assign"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.sdiv_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn MixedTypes(ref a: i32, b: i64) = "int.sdiv_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.sdiv_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn MixedTypes(ref a: i32, b: i64) = "int.sdiv_assign"; diff --git a/toolchain/check/testdata/builtins/int/smod.carbon b/toolchain/check/testdata/builtins/int/smod.carbon index 63b81e9cb0d0..a66e7428dfa7 100644 --- a/toolchain/check/testdata/builtins/int/smod.carbon +++ b/toolchain/check/testdata/builtins/int/smod.carbon @@ -41,7 +41,12 @@ let b: i32 = Mod(Sub(Negate(0x7FFF_FFFF), 1), 1); // -0x8000_0000 / -1 overflows, so -0x8000_0000 % -1 is disallowed, even though // its result is representable. -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:14-56: error: integer overflow in calculation `-2147483648 % -1` [CompileTimeIntegerOverflow] +// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+7]]:14 +// CHECK:STDERR: -> │ let c: i32 = Mod(Sub(Negate(0x7FFF_FFFF), 1), Negate(1)); +// CHECK:STDERR: · ━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: integer overflow in calculation `-2147483648 % -1` +// CHECK:STDERR: · ┃ [CompileTimeIntegerOverflow] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let c: i32 = Mod(Sub(Negate(0x7FFF_FFFF), 1), Negate(1)); @@ -53,11 +58,19 @@ fn Mod(a: i32, b: i32) -> i32 = "int.smod"; // Remainder of division by zero is not defined. -// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+2]]:14-22: error: division by zero [CompileTimeDivisionByZero] +// CHECK:STDERR: ╭─┤ fail_div_by_zero.carbon:[[@LINE+6]]:14 +// CHECK:STDERR: -> │ let a: i32 = Mod(1, 0); +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: division by zero [CompileTimeDivisionByZero] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let a: i32 = Mod(1, 0); -// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+2]]:14-22: error: division by zero [CompileTimeDivisionByZero] +// CHECK:STDERR: ╭─┤ fail_div_by_zero.carbon:[[@LINE+6]]:14 +// CHECK:STDERR: -> │ let b: i32 = Mod(0, 0); +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: division by zero [CompileTimeDivisionByZero] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let b: i32 = Mod(0, 0); diff --git a/toolchain/check/testdata/builtins/int/smod_assign.carbon b/toolchain/check/testdata/builtins/int/smod_assign.carbon index b2f211ba8ca7..c4cfc4f300f3 100644 --- a/toolchain/check/testdata/builtins/int/smod_assign.carbon +++ b/toolchain/check/testdata/builtins/int/smod_assign.carbon @@ -26,7 +26,12 @@ fn Call(ref a: i32, b: i32) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.smod_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_unsized.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.smod_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.smod_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.smod_assign"; @@ -34,11 +39,21 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.smod_assign"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.smod_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn NotRef(a: i32, b: i32) = "int.smod_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.smod_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.smod_assign"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.smod_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn MixedTypes(ref a: i32, b: i64) = "int.smod_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.smod_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn MixedTypes(ref a: i32, b: i64) = "int.smod_assign"; diff --git a/toolchain/check/testdata/builtins/int/smul.carbon b/toolchain/check/testdata/builtins/int/smul.carbon index 171a52a80199..14ec3a68a73f 100644 --- a/toolchain/check/testdata/builtins/int/smul.carbon +++ b/toolchain/check/testdata/builtins/int/smul.carbon @@ -68,7 +68,12 @@ library "[[@TEST_NAME]]"; fn Mul(a: i32, b: i32) -> i32 = "int.smul"; let a: i32 = Mul(0x7FFF, 0x10000); -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:14-33: error: integer overflow in calculation `32768 * 65536` [CompileTimeIntegerOverflow] +// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+7]]:14 +// CHECK:STDERR: -> │ let b: i32 = Mul(0x8000, 0x10000); +// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: integer overflow in calculation `32768 * 65536` +// CHECK:STDERR: · ┃ [CompileTimeIntegerOverflow] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let b: i32 = Mul(0x8000, 0x10000); diff --git a/toolchain/check/testdata/builtins/int/smul_assign.carbon b/toolchain/check/testdata/builtins/int/smul_assign.carbon index e2915cfb0294..3b5621a084bf 100644 --- a/toolchain/check/testdata/builtins/int/smul_assign.carbon +++ b/toolchain/check/testdata/builtins/int/smul_assign.carbon @@ -26,7 +26,12 @@ fn Call(ref a: i32, b: i32) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.smul_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_unsized.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.smul_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.smul_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.smul_assign"; @@ -34,11 +39,21 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.smul_assign"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.smul_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn NotRef(a: i32, b: i32) = "int.smul_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.smul_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.smul_assign"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.smul_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn MixedTypes(ref a: i32, b: i64) = "int.smul_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.smul_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn MixedTypes(ref a: i32, b: i64) = "int.smul_assign"; diff --git a/toolchain/check/testdata/builtins/int/snegate.carbon b/toolchain/check/testdata/builtins/int/snegate.carbon index 26f99452ec71..29db3459847e 100644 --- a/toolchain/check/testdata/builtins/int/snegate.carbon +++ b/toolchain/check/testdata/builtins/int/snegate.carbon @@ -47,11 +47,21 @@ fn F() { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_too_few.carbon:[[@LINE+2]]:1-20: error: invalid signature for builtin function "int.snegate" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_too_few.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn TooFew() -> i32 = "int.snegate"; +// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.snegate" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn TooFew() -> i32 = "int.snegate"; -// CHECK:STDERR: fail_too_few.carbon:[[@LINE+2]]:25-32: error: array bound is not a constant [InvalidArrayExpr] +// CHECK:STDERR: ╭─┤ fail_too_few.carbon:[[@LINE+7]]:25 +// CHECK:STDERR: -> │ var too_few: array(i32, TooFew()); +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: array bound is not a constant +// CHECK:STDERR: · ┃ [InvalidArrayExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var too_few: array(i32, TooFew()); @@ -63,11 +73,21 @@ fn RuntimeCallIsValidTooFew() -> i32 { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_too_many.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.snegate" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_too_many.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn TooMany(a: i32, b: i32) -> i32 = "int.snegate"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.snegate" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn TooMany(a: i32, b: i32) -> i32 = "int.snegate"; -// CHECK:STDERR: fail_too_many.carbon:[[@LINE+2]]:26-38: error: array bound is not a constant [InvalidArrayExpr] +// CHECK:STDERR: ╭─┤ fail_too_many.carbon:[[@LINE+7]]:26 +// CHECK:STDERR: -> │ var too_many: array(i32, TooMany(1, 2)); +// CHECK:STDERR: · ━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: array bound is not a constant +// CHECK:STDERR: · ┃ [InvalidArrayExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var too_many: array(i32, TooMany(1, 2)); @@ -79,11 +99,21 @@ fn RuntimeCallIsValidTooMany(a: i32, b: i32) -> i32 { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+2]]:1-34: error: invalid signature for builtin function "int.snegate" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_return_type.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn BadReturnType(a: i32) -> bool = "int.snegate"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.snegate" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn BadReturnType(a: i32) -> bool = "int.snegate"; -// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+2]]:33-48: error: array bound is not a constant [InvalidArrayExpr] +// CHECK:STDERR: ╭─┤ fail_bad_return_type.carbon:[[@LINE+7]]:33 +// CHECK:STDERR: -> │ var bad_return_type: array(i32, BadReturnType(1)); +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: array bound is not a constant +// CHECK:STDERR: · ┃ [InvalidArrayExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var bad_return_type: array(i32, BadReturnType(1)); @@ -97,8 +127,17 @@ library "[[@TEST_NAME]]"; fn Negate(a: i32) -> i32 = "int.snegate"; -// CHECK:STDERR: fail_bad_call.carbon:[[@LINE+3]]:26-37: error: 2 arguments passed to function expecting 1 argument [CallArgCountMismatch] -// CHECK:STDERR: fail_bad_call.carbon:[[@LINE-3]]:1-26: note: calling function declared here [InCallToEntity] +// CHECK:STDERR: ╭─┤ fail_bad_call.carbon:[[@LINE+12]]:26 +// CHECK:STDERR: │ fn Negate(a: i32) -> i32 = "int.snegate"; +// CHECK:STDERR: · ─────────────┬──────────── +// CHECK:STDERR: · ╰──┤ calling function declared here [InCallToEntity] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ var bad_call: array(i32, Negate(1, 2)); +// CHECK:STDERR: · ┳━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: 2 arguments passed to function expecting 1 +// CHECK:STDERR: · ┃ argument +// CHECK:STDERR: · ┃ [CallArgCountMismatch] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var bad_call: array(i32, Negate(1, 2)); @@ -113,7 +152,12 @@ fn Sub(a: i32, b: i32) -> i32 = "int.ssub"; let a: i32 = Negate(Negate(0x7FFF_FFFF)); // -INT_MIN is too large for i32. -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:14-33: error: integer overflow in negation of -2147483648 [CompileTimeIntegerNegateOverflow] +// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+7]]:14 +// CHECK:STDERR: -> │ let b: i32 = Negate(-0x8000_0000); +// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: integer overflow in negation of -2147483648 +// CHECK:STDERR: · ┃ [CompileTimeIntegerNegateOverflow] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let b: i32 = Negate(-0x8000_0000); diff --git a/toolchain/check/testdata/builtins/int/ssub.carbon b/toolchain/check/testdata/builtins/int/ssub.carbon index 322046290866..b0de98e92459 100644 --- a/toolchain/check/testdata/builtins/int/ssub.carbon +++ b/toolchain/check/testdata/builtins/int/ssub.carbon @@ -33,7 +33,12 @@ fn Sub(a: i32, b: i32) -> i32 = "int.ssub"; let a: i32 = Sub(0, 0x7FFFFFFF); let b: i32 = Sub(Sub(0, 0x7FFFFFFF), 1); -// CHECK:STDERR: fail_overflow.carbon:[[@LINE+2]]:14-39: error: integer overflow in calculation `-2147483647 - 2` [CompileTimeIntegerOverflow] +// CHECK:STDERR: ╭─┤ fail_overflow.carbon:[[@LINE+7]]:14 +// CHECK:STDERR: -> │ let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); +// CHECK:STDERR: · ━━━━━━┳━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: integer overflow in calculation `-2147483647 - 2` +// CHECK:STDERR: · ┃ [CompileTimeIntegerOverflow] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let c: i32 = Sub(Sub(0, 0x7FFFFFFF), 2); diff --git a/toolchain/check/testdata/builtins/int/ssub_assign.carbon b/toolchain/check/testdata/builtins/int/ssub_assign.carbon index 87d7c2089d80..d23272ef2209 100644 --- a/toolchain/check/testdata/builtins/int/ssub_assign.carbon +++ b/toolchain/check/testdata/builtins/int/ssub_assign.carbon @@ -26,7 +26,12 @@ fn Call(ref a: i32, b: i32) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.ssub_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_unsized.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.ssub_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.ssub_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.ssub_assign"; @@ -34,11 +39,21 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.ssub_assign"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.ssub_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn NotRef(a: i32, b: i32) = "int.ssub_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.ssub_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.ssub_assign"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.ssub_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn MixedTypes(ref a: i32, b: i64) = "int.ssub_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.ssub_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn MixedTypes(ref a: i32, b: i64) = "int.ssub_assign"; diff --git a/toolchain/check/testdata/builtins/int/uadd.carbon b/toolchain/check/testdata/builtins/int/uadd.carbon index 0da41e32948a..f71eea896e33 100644 --- a/toolchain/check/testdata/builtins/int/uadd.carbon +++ b/toolchain/check/testdata/builtins/int/uadd.carbon @@ -29,11 +29,21 @@ fn RuntimeCallIsValid(a: i32, b: i32) -> i32 { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_too_few.carbon:[[@LINE+2]]:1-26: error: invalid signature for builtin function "int.uadd" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_too_few.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn TooFew(a: i32) -> i32 = "int.uadd"; +// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.uadd" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn TooFew(a: i32) -> i32 = "int.uadd"; -// CHECK:STDERR: fail_too_few.carbon:[[@LINE+2]]:25-33: error: array bound is not a constant [InvalidArrayExpr] +// CHECK:STDERR: ╭─┤ fail_too_few.carbon:[[@LINE+7]]:25 +// CHECK:STDERR: -> │ var too_few: array(i32, TooFew(1)); +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: array bound is not a constant +// CHECK:STDERR: · ┃ [InvalidArrayExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var too_few: array(i32, TooFew(1)); @@ -45,11 +55,21 @@ fn RuntimeCallIsValidTooFew(a: i32) -> i32 { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_too_many.carbon:[[@LINE+2]]:1-43: error: invalid signature for builtin function "int.uadd" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_too_many.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn TooMany(a: i32, b: i32, c: i32) -> i32 = "int.uadd"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.uadd" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn TooMany(a: i32, b: i32, c: i32) -> i32 = "int.uadd"; -// CHECK:STDERR: fail_too_many.carbon:[[@LINE+2]]:26-41: error: array bound is not a constant [InvalidArrayExpr] +// CHECK:STDERR: ╭─┤ fail_too_many.carbon:[[@LINE+7]]:26 +// CHECK:STDERR: -> │ var too_many: array(i32, TooMany(1, 2, 3)); +// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: array bound is not a constant +// CHECK:STDERR: · ┃ [InvalidArrayExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var too_many: array(i32, TooMany(1, 2, 3)); @@ -61,11 +81,21 @@ fn RuntimeCallIsValidTooMany(a: i32, b: i32, c: i32) -> i32 { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+2]]:1-42: error: invalid signature for builtin function "int.uadd" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_return_type.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn BadReturnType(a: i32, b: i32) -> bool = "int.uadd"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.uadd" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn BadReturnType(a: i32, b: i32) -> bool = "int.uadd"; -// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+2]]:33-51: error: array bound is not a constant [InvalidArrayExpr] +// CHECK:STDERR: ╭─┤ fail_bad_return_type.carbon:[[@LINE+7]]:33 +// CHECK:STDERR: -> │ var bad_return_type: array(i32, BadReturnType(1, 2)); +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: array bound is not a constant +// CHECK:STDERR: · ┃ [InvalidArrayExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var bad_return_type: array(i32, BadReturnType(1, 2)); @@ -79,8 +109,17 @@ library "[[@TEST_NAME]]"; fn Add(a: i32, b: i32) -> i32 = "int.uadd"; -// CHECK:STDERR: fail_bad_call.carbon:[[@LINE+3]]:26-37: error: 3 arguments passed to function expecting 2 arguments [CallArgCountMismatch] -// CHECK:STDERR: fail_bad_call.carbon:[[@LINE-3]]:1-31: note: calling function declared here [InCallToEntity] +// CHECK:STDERR: ╭─┤ fail_bad_call.carbon:[[@LINE+12]]:26 +// CHECK:STDERR: │ fn Add(a: i32, b: i32) -> i32 = "int.uadd"; +// CHECK:STDERR: · ───────────────┬─────────────── +// CHECK:STDERR: · ╰──┤ calling function declared here [InCallToEntity] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ var bad_call: array(i32, Add(1, 2, 3)); +// CHECK:STDERR: · ┳━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: 3 arguments passed to function expecting 2 +// CHECK:STDERR: · ┃ arguments +// CHECK:STDERR: · ┃ [CallArgCountMismatch] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var bad_call: array(i32, Add(1, 2, 3)); diff --git a/toolchain/check/testdata/builtins/int/uadd_assign.carbon b/toolchain/check/testdata/builtins/int/uadd_assign.carbon index 40a6dbe81ab9..f5fe2ee89e4c 100644 --- a/toolchain/check/testdata/builtins/int/uadd_assign.carbon +++ b/toolchain/check/testdata/builtins/int/uadd_assign.carbon @@ -26,7 +26,12 @@ fn Call(ref a: i32, b: i32) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.uadd_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_unsized.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.uadd_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.uadd_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.uadd_assign"; @@ -34,11 +39,21 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.uadd_assign"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.uadd_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn NotRef(a: i32, b: i32) = "int.uadd_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.uadd_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.uadd_assign"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.uadd_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn MixedTypes(ref a: i32, b: i64) = "int.uadd_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.uadd_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn MixedTypes(ref a: i32, b: i64) = "int.uadd_assign"; diff --git a/toolchain/check/testdata/builtins/int/udiv.carbon b/toolchain/check/testdata/builtins/int/udiv.carbon index ed6215b21442..ce412926077a 100644 --- a/toolchain/check/testdata/builtins/int/udiv.carbon +++ b/toolchain/check/testdata/builtins/int/udiv.carbon @@ -48,11 +48,19 @@ library "[[@TEST_NAME]]"; fn Div(a: i32, b: i32) -> i32 = "int.udiv"; -// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+2]]:14-22: error: division by zero [CompileTimeDivisionByZero] +// CHECK:STDERR: ╭─┤ fail_div_by_zero.carbon:[[@LINE+6]]:14 +// CHECK:STDERR: -> │ let a: i32 = Div(1, 0); +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: division by zero [CompileTimeDivisionByZero] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let a: i32 = Div(1, 0); -// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+2]]:14-22: error: division by zero [CompileTimeDivisionByZero] +// CHECK:STDERR: ╭─┤ fail_div_by_zero.carbon:[[@LINE+6]]:14 +// CHECK:STDERR: -> │ let b: i32 = Div(0, 0); +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: division by zero [CompileTimeDivisionByZero] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let b: i32 = Div(0, 0); diff --git a/toolchain/check/testdata/builtins/int/udiv_assign.carbon b/toolchain/check/testdata/builtins/int/udiv_assign.carbon index 90ee7153fb4f..061a64131bb3 100644 --- a/toolchain/check/testdata/builtins/int/udiv_assign.carbon +++ b/toolchain/check/testdata/builtins/int/udiv_assign.carbon @@ -26,7 +26,12 @@ fn Call(ref a: i32, b: i32) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.udiv_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_unsized.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.udiv_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.udiv_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.udiv_assign"; @@ -34,11 +39,21 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.udiv_assign"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.udiv_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn NotRef(a: i32, b: i32) = "int.udiv_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.udiv_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.udiv_assign"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.udiv_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn MixedTypes(ref a: i32, b: i64) = "int.udiv_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.udiv_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn MixedTypes(ref a: i32, b: i64) = "int.udiv_assign"; diff --git a/toolchain/check/testdata/builtins/int/umod.carbon b/toolchain/check/testdata/builtins/int/umod.carbon index 6dce3b5c7493..909e8955603b 100644 --- a/toolchain/check/testdata/builtins/int/umod.carbon +++ b/toolchain/check/testdata/builtins/int/umod.carbon @@ -50,11 +50,19 @@ fn Mod(a: i32, b: i32) -> i32 = "int.umod"; // Remainder of division by zero is not defined. -// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+2]]:14-22: error: division by zero [CompileTimeDivisionByZero] +// CHECK:STDERR: ╭─┤ fail_div_by_zero.carbon:[[@LINE+6]]:14 +// CHECK:STDERR: -> │ let a: i32 = Mod(1, 0); +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: division by zero [CompileTimeDivisionByZero] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let a: i32 = Mod(1, 0); -// CHECK:STDERR: fail_div_by_zero.carbon:[[@LINE+2]]:14-22: error: division by zero [CompileTimeDivisionByZero] +// CHECK:STDERR: ╭─┤ fail_div_by_zero.carbon:[[@LINE+6]]:14 +// CHECK:STDERR: -> │ let b: i32 = Mod(0, 0); +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: division by zero [CompileTimeDivisionByZero] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let b: i32 = Mod(0, 0); diff --git a/toolchain/check/testdata/builtins/int/umod_assign.carbon b/toolchain/check/testdata/builtins/int/umod_assign.carbon index 20460006e66d..930bbf0d7050 100644 --- a/toolchain/check/testdata/builtins/int/umod_assign.carbon +++ b/toolchain/check/testdata/builtins/int/umod_assign.carbon @@ -26,7 +26,12 @@ fn Call(ref a: i32, b: i32) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.umod_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_unsized.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.umod_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.umod_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.umod_assign"; @@ -34,11 +39,21 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.umod_assign"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.umod_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn NotRef(a: i32, b: i32) = "int.umod_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.umod_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.umod_assign"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.umod_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn MixedTypes(ref a: i32, b: i64) = "int.umod_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.umod_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn MixedTypes(ref a: i32, b: i64) = "int.umod_assign"; diff --git a/toolchain/check/testdata/builtins/int/umul_assign.carbon b/toolchain/check/testdata/builtins/int/umul_assign.carbon index 6262011257e5..6a80b8e5eebb 100644 --- a/toolchain/check/testdata/builtins/int/umul_assign.carbon +++ b/toolchain/check/testdata/builtins/int/umul_assign.carbon @@ -26,7 +26,12 @@ fn Call(ref a: i32, b: i32) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.umul_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_unsized.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.umul_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.umul_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.umul_assign"; @@ -34,11 +39,21 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.umul_assign"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.umul_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn NotRef(a: i32, b: i32) = "int.umul_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.umul_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.umul_assign"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.umul_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn MixedTypes(ref a: i32, b: i64) = "int.umul_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.umul_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn MixedTypes(ref a: i32, b: i64) = "int.umul_assign"; diff --git a/toolchain/check/testdata/builtins/int/unegate.carbon b/toolchain/check/testdata/builtins/int/unegate.carbon index 87b5a677770a..65cc44be4f7d 100644 --- a/toolchain/check/testdata/builtins/int/unegate.carbon +++ b/toolchain/check/testdata/builtins/int/unegate.carbon @@ -31,11 +31,21 @@ fn RuntimeCallIsValid(a: u32, unused b: u32) -> u32 { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_too_few.carbon:[[@LINE+2]]:1-20: error: invalid signature for builtin function "int.unegate" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_too_few.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn TooFew() -> u32 = "int.unegate"; +// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.unegate" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn TooFew() -> u32 = "int.unegate"; -// CHECK:STDERR: fail_too_few.carbon:[[@LINE+2]]:25-32: error: array bound is not a constant [InvalidArrayExpr] +// CHECK:STDERR: ╭─┤ fail_too_few.carbon:[[@LINE+7]]:25 +// CHECK:STDERR: -> │ var too_few: array(u32, TooFew()); +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: array bound is not a constant +// CHECK:STDERR: · ┃ [InvalidArrayExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var too_few: array(u32, TooFew()); @@ -47,11 +57,21 @@ fn RuntimeCallIsValidTooFew() -> u32 { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_too_many.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.unegate" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_too_many.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn TooMany(a: u32, b: u32) -> u32 = "int.unegate"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.unegate" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn TooMany(a: u32, b: u32) -> u32 = "int.unegate"; -// CHECK:STDERR: fail_too_many.carbon:[[@LINE+2]]:26-38: error: array bound is not a constant [InvalidArrayExpr] +// CHECK:STDERR: ╭─┤ fail_too_many.carbon:[[@LINE+7]]:26 +// CHECK:STDERR: -> │ var too_many: array(u32, TooMany(1, 2)); +// CHECK:STDERR: · ━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: array bound is not a constant +// CHECK:STDERR: · ┃ [InvalidArrayExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var too_many: array(u32, TooMany(1, 2)); @@ -63,11 +83,21 @@ fn RuntimeCallIsValidTooMany(a: u32, b: u32) -> u32 { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+2]]:1-34: error: invalid signature for builtin function "int.unegate" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_return_type.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn BadReturnType(a: u32) -> bool = "int.unegate"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.unegate" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn BadReturnType(a: u32) -> bool = "int.unegate"; -// CHECK:STDERR: fail_bad_return_type.carbon:[[@LINE+2]]:33-48: error: array bound is not a constant [InvalidArrayExpr] +// CHECK:STDERR: ╭─┤ fail_bad_return_type.carbon:[[@LINE+7]]:33 +// CHECK:STDERR: -> │ var bad_return_type: array(u32, BadReturnType(1)); +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: array bound is not a constant +// CHECK:STDERR: · ┃ [InvalidArrayExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var bad_return_type: array(u32, BadReturnType(1)); @@ -81,8 +111,17 @@ library "[[@TEST_NAME]]"; fn Negate(a: u32) -> u32 = "int.unegate"; -// CHECK:STDERR: fail_bad_call.carbon:[[@LINE+3]]:26-37: error: 2 arguments passed to function expecting 1 argument [CallArgCountMismatch] -// CHECK:STDERR: fail_bad_call.carbon:[[@LINE-3]]:1-26: note: calling function declared here [InCallToEntity] +// CHECK:STDERR: ╭─┤ fail_bad_call.carbon:[[@LINE+12]]:26 +// CHECK:STDERR: │ fn Negate(a: u32) -> u32 = "int.unegate"; +// CHECK:STDERR: · ─────────────┬──────────── +// CHECK:STDERR: · ╰──┤ calling function declared here [InCallToEntity] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ var bad_call: array(u32, Negate(1, 2)); +// CHECK:STDERR: · ┳━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: 2 arguments passed to function expecting 1 +// CHECK:STDERR: · ┃ argument +// CHECK:STDERR: · ┃ [CallArgCountMismatch] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var bad_call: array(u32, Negate(1, 2)); diff --git a/toolchain/check/testdata/builtins/int/usub_assign.carbon b/toolchain/check/testdata/builtins/int/usub_assign.carbon index a02611e15e02..5c89683abbcc 100644 --- a/toolchain/check/testdata/builtins/int/usub_assign.carbon +++ b/toolchain/check/testdata/builtins/int/usub_assign.carbon @@ -26,7 +26,12 @@ fn Call(ref a: i32, b: i32) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.usub_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_unsized.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.usub_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.usub_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.usub_assign"; @@ -34,11 +39,21 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.usub_assign"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.usub_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn NotRef(a: i32, b: i32) = "int.usub_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.usub_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.usub_assign"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.usub_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn MixedTypes(ref a: i32, b: i64) = "int.usub_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.usub_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn MixedTypes(ref a: i32, b: i64) = "int.usub_assign"; diff --git a/toolchain/check/testdata/builtins/int/xor_assign.carbon b/toolchain/check/testdata/builtins/int/xor_assign.carbon index ce36d50d0227..80c041ab47ca 100644 --- a/toolchain/check/testdata/builtins/int/xor_assign.carbon +++ b/toolchain/check/testdata/builtins/int/xor_assign.carbon @@ -26,7 +26,12 @@ fn Call(ref a: i32, b: i32) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_unsized.carbon:[[@LINE+2]]:1-56: error: invalid signature for builtin function "int.xor_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_unsized.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.xor_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.xor_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.xor_assign"; @@ -34,11 +39,21 @@ fn Builtin(ref a: Core.IntLiteral, b: Core.IntLiteral) = "int.xor_assign"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-27: error: invalid signature for builtin function "int.xor_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn NotRef(a: i32, b: i32) = "int.xor_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.xor_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn NotRef(a: i32, b: i32) = "int.xor_assign"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-35: error: invalid signature for builtin function "int.xor_assign" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn MixedTypes(ref a: i32, b: i64) = "int.xor_assign"; +// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.xor_assign" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn MixedTypes(ref a: i32, b: i64) = "int.xor_assign"; diff --git a/toolchain/check/testdata/builtins/maybe_unformed/make_type.carbon b/toolchain/check/testdata/builtins/maybe_unformed/make_type.carbon index 7cdf89be5680..c1d818ad6b88 100644 --- a/toolchain/check/testdata/builtins/maybe_unformed/make_type.carbon +++ b/toolchain/check/testdata/builtins/maybe_unformed/make_type.carbon @@ -41,11 +41,21 @@ let u: type = Make(t); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-22: error: invalid signature for builtin function "maybe_unformed.make_type" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn NoParam() -> type = "maybe_unformed.make_type"; +// CHECK:STDERR: · ━━━┳━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "maybe_unformed.make_type" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn NoParam() -> type = "maybe_unformed.make_type"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-44: error: invalid signature for builtin function "maybe_unformed.make_type" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn ColonBangParam(generic T: type) -> type = "maybe_unformed.make_type"; +// CHECK:STDERR: · ━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "maybe_unformed.make_type" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn ColonBangParam(generic T: type) -> type = "maybe_unformed.make_type"; diff --git a/toolchain/check/testdata/builtins/no_op.carbon b/toolchain/check/testdata/builtins/no_op.carbon index 8c41b61e37f1..0f9dc0804875 100644 --- a/toolchain/check/testdata/builtins/no_op.carbon +++ b/toolchain/check/testdata/builtins/no_op.carbon @@ -60,7 +60,12 @@ var x: () = NoOp(); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_signature.carbon:[[@LINE+2]]:1-17: error: invalid signature for builtin function "no_op" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_signature.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn NoOp() -> {} = "no_op"; +// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "no_op" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn NoOp() -> {} = "no_op"; diff --git a/toolchain/check/testdata/builtins/pointer/is_null.carbon b/toolchain/check/testdata/builtins/pointer/is_null.carbon index d0880d9f30bb..25f3a83df0d8 100644 --- a/toolchain/check/testdata/builtins/pointer/is_null.carbon +++ b/toolchain/check/testdata/builtins/pointer/is_null.carbon @@ -55,23 +55,48 @@ library "[[@TEST_NAME]]"; fn MakeUnformed(t: type) -> type = "maybe_unformed.make_type"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-22: error: invalid signature for builtin function "pointer.is_null" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn NoParam() -> bool = "pointer.is_null"; +// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "pointer.is_null" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn NoParam() -> bool = "pointer.is_null"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-36: error: invalid signature for builtin function "pointer.is_null" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn NoRetType(p: MakeUnformed({}*)) = "pointer.is_null"; +// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "pointer.is_null" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn NoRetType(p: MakeUnformed({}*)) = "pointer.is_null"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-45: error: invalid signature for builtin function "pointer.is_null" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn WrongRetType(p: MakeUnformed({}*)) -> {} = "pointer.is_null"; +// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "pointer.is_null" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn WrongRetType(p: MakeUnformed({}*)) -> {} = "pointer.is_null"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-31: error: invalid signature for builtin function "pointer.is_null" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn NoUnformed(p: {}*) -> bool = "pointer.is_null"; +// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "pointer.is_null" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn NoUnformed(p: {}*) -> bool = "pointer.is_null"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-44: error: invalid signature for builtin function "pointer.is_null" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn NotPointer(p: MakeUnformed({})) -> bool = "pointer.is_null"; +// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "pointer.is_null" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn NotPointer(p: MakeUnformed({})) -> bool = "pointer.is_null"; diff --git a/toolchain/check/testdata/builtins/pointer/make_null.carbon b/toolchain/check/testdata/builtins/pointer/make_null.carbon index af18664f71e9..6b3b0d90c0bb 100644 --- a/toolchain/check/testdata/builtins/pointer/make_null.carbon +++ b/toolchain/check/testdata/builtins/pointer/make_null.carbon @@ -45,15 +45,30 @@ library "[[@TEST_NAME]]"; fn MakeUnformed(t: type) -> type = "maybe_unformed.make_type"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-16: error: invalid signature for builtin function "pointer.make_null" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn NoRetType() = "pointer.make_null"; +// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "pointer.make_null" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn NoRetType() = "pointer.make_null"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-24: error: invalid signature for builtin function "pointer.make_null" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn NoUnformed() -> {}* = "pointer.make_null"; +// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "pointer.make_null" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn NoUnformed() -> {}* = "pointer.make_null"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-37: error: invalid signature for builtin function "pointer.make_null" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn NotPointer() -> MakeUnformed({}) = "pointer.make_null"; +// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "pointer.make_null" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn NotPointer() -> MakeUnformed({}) = "pointer.make_null"; diff --git a/toolchain/check/testdata/builtins/type/and.carbon b/toolchain/check/testdata/builtins/type/and.carbon index d8e883d5ad28..dd9e123d7e22 100644 --- a/toolchain/check/testdata/builtins/type/and.carbon +++ b/toolchain/check/testdata/builtins/type/and.carbon @@ -50,12 +50,30 @@ class JustJ { } fn Call() { - // CHECK:STDERR: fail_combine_facets_bad_call.carbon:[[@LINE+3]]:3-15: error: cannot convert type `JustI` into type implementing `I & J` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_combine_facets_bad_call.carbon:[[@LINE-12]]:26-41: note: initializing generic parameter `T` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_combine_facets_bad_call.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn TakeIJ(unused generic T: TypeAnd(I, J)) {} + // CHECK:STDERR: · ──┬───────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ TakeIJ(JustI); + // CHECK:STDERR: · ━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `JustI` into type implementing `I & J` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: TakeIJ(JustI); - // CHECK:STDERR: fail_combine_facets_bad_call.carbon:[[@LINE+3]]:3-15: error: cannot convert type `JustJ` into type implementing `I & J` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_combine_facets_bad_call.carbon:[[@LINE-16]]:26-41: note: initializing generic parameter `T` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_combine_facets_bad_call.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn TakeIJ(unused generic T: TypeAnd(I, J)) {} + // CHECK:STDERR: · ──┬───────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ TakeIJ(JustJ); + // CHECK:STDERR: · ━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `JustJ` into type implementing `I & J` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: TakeIJ(JustJ); } @@ -64,22 +82,47 @@ fn Call() { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-28: error: invalid signature for builtin function "type.and" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn TooFew(a: type) -> type = "type.and"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━┳━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "type.and" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn TooFew(a: type) -> type = "type.and"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-47: error: invalid signature for builtin function "type.and" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn TooMany(a: type, b: type, c: type) -> type = "type.and"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "type.and" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn TooMany(a: type, b: type, c: type) -> type = "type.and"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-39: error: invalid signature for builtin function "type.and" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn ParamNotType(a: {}, b: {}) -> type = "type.and"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "type.and" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn ParamNotType(a: {}, b: {}) -> type = "type.and"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-42: error: invalid signature for builtin function "type.and" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn ResultNotType(a: type, b: type) -> {} = "type.and"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "type.and" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn ResultNotType(a: type, b: type) -> {} = "type.and"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-41: error: invalid signature for builtin function "type.and" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn ResultNotSpecified(a: type, b: type) = "type.and"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "type.and" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn ResultNotSpecified(a: type, b: type) = "type.and"; diff --git a/toolchain/check/testdata/choice/basic.carbon b/toolchain/check/testdata/choice/basic.carbon index 16f7a9cfd5f5..0e2ca9aaa059 100644 --- a/toolchain/check/testdata/choice/basic.carbon +++ b/toolchain/check/testdata/choice/basic.carbon @@ -66,7 +66,13 @@ library "[[@TEST_NAME]]"; choice Never {} // TODO: Can we produce a better diagnostic? -// CHECK:STDERR: fail_no_alternative_construct.carbon:[[@LINE+2]]:20-21: error: missing value for field `discriminant` in struct initialization [StructInitMissingFieldInLiteral] +// CHECK:STDERR: ╭─┤ fail_no_alternative_construct.carbon:[[@LINE+8]]:20 +// CHECK:STDERR: -> │ let never: Never = {}; +// CHECK:STDERR: · ┳━ +// CHECK:STDERR: · ┗━━┫ error: missing value for field `discriminant` in struct +// CHECK:STDERR: · ┃ initialization +// CHECK:STDERR: · ┃ [StructInitMissingFieldInLiteral] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let never: Never = {}; diff --git a/toolchain/check/testdata/choice/params.carbon b/toolchain/check/testdata/choice/params.carbon index 2f0bae6e055a..6bf4bb714d57 100644 --- a/toolchain/check/testdata/choice/params.carbon +++ b/toolchain/check/testdata/choice/params.carbon @@ -14,7 +14,13 @@ library "[[@TEST_NAME]]"; choice Always { - // CHECK:STDERR: fail_todo_empty_params.carbon:[[@LINE+2]]:8-9: error: semantics TODO: `empty parameter list should make a member function` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_empty_params.carbon:[[@LINE+8]]:8 + // CHECK:STDERR: -> │ Sunny() + // CHECK:STDERR: · ┳━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: + // CHECK:STDERR: · ┃ `empty parameter list should make a member function` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Sunny() } @@ -26,7 +32,13 @@ library "[[@TEST_NAME]]"; choice C { Alt1, - // CHECK:STDERR: fail_todo_params.carbon:[[@LINE+2]]:7-22: error: semantics TODO: `choice alternatives with parameters are not yet supported` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_params.carbon:[[@LINE+8]]:7 + // CHECK:STDERR: -> │ Alt2(a: i32, b: i64), + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: + // CHECK:STDERR: · ┃ `choice alternatives with parameters are not yet supported` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Alt2(a: i32, b: i64), Alt3, @@ -36,7 +48,13 @@ choice C { library "[[@TEST_NAME]]"; choice C(T: type) { - // CHECK:STDERR: fail_todo_generic_params.carbon:[[@LINE+2]]:6-11: error: semantics TODO: `choice alternatives with parameters are not yet supported` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_generic_params.carbon:[[@LINE+8]]:6 + // CHECK:STDERR: -> │ Alt(a: T) + // CHECK:STDERR: · ┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: + // CHECK:STDERR: · ┃ `choice alternatives with parameters are not yet supported` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Alt(a: T) } @@ -45,7 +63,13 @@ choice C(T: type) { library "[[@TEST_NAME]]"; choice C { - // CHECK:STDERR: fail_todo_self_param.carbon:[[@LINE+2]]:6-15: error: semantics TODO: `choice alternatives with parameters are not yet supported` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_self_param.carbon:[[@LINE+8]]:6 + // CHECK:STDERR: -> │ Alt(a: Self*) + // CHECK:STDERR: · ┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: + // CHECK:STDERR: · ┃ `choice alternatives with parameters are not yet supported` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Alt(a: Self*) } diff --git a/toolchain/check/testdata/class/abstract/abstract.carbon b/toolchain/check/testdata/class/abstract/abstract.carbon index bed6090ba93d..a51ae5fd1b92 100644 --- a/toolchain/check/testdata/class/abstract/abstract.carbon +++ b/toolchain/check/testdata/class/abstract/abstract.carbon @@ -19,8 +19,17 @@ abstract class Abstract { } class Contains { - // CHECK:STDERR: fail_abstract_field.carbon:[[@LINE+3]]:10-17: error: binding pattern has abstract type `Abstract` in `var` pattern [AbstractTypeInVarPattern] - // CHECK:STDERR: fail_abstract_field.carbon:[[@LINE-5]]:1-25: note: class was declared abstract here [ClassAbstractHere] + // CHECK:STDERR: ╭─┤ fail_abstract_field.carbon:[[@LINE+12]]:10 + // CHECK:STDERR: │ abstract class Abstract { + // CHECK:STDERR: · ────────────┬──────────── + // CHECK:STDERR: · ╰──┤ class was declared abstract here [ClassAbstractHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ var a: Abstract; + // CHECK:STDERR: · ┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: binding pattern has abstract type `Abstract` in `var` + // CHECK:STDERR: · ┃ pattern + // CHECK:STDERR: · ┃ [AbstractTypeInVarPattern] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var a: Abstract; } @@ -32,8 +41,17 @@ abstract class Abstract { } fn Var() { - // CHECK:STDERR: fail_abstract_var.carbon:[[@LINE+3]]:17-24: error: binding pattern has abstract type `Abstract` in `var` pattern [AbstractTypeInVarPattern] - // CHECK:STDERR: fail_abstract_var.carbon:[[@LINE-5]]:1-25: note: class was declared abstract here [ClassAbstractHere] + // CHECK:STDERR: ╭─┤ fail_abstract_var.carbon:[[@LINE+12]]:17 + // CHECK:STDERR: │ abstract class Abstract { + // CHECK:STDERR: · ────────────┬──────────── + // CHECK:STDERR: · ╰──┤ class was declared abstract here [ClassAbstractHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ var unused v: Abstract; + // CHECK:STDERR: · ┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: binding pattern has abstract type `Abstract` in + // CHECK:STDERR: · ┃ `var` pattern + // CHECK:STDERR: · ┃ [AbstractTypeInVarPattern] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused v: Abstract; } @@ -44,8 +62,17 @@ library "[[@TEST_NAME]]"; abstract class Abstract { } -// CHECK:STDERR: fail_abstract_var_function_param.carbon:[[@LINE+3]]:13-20: error: binding pattern has abstract type `Abstract` in `var` pattern [AbstractTypeInVarPattern] -// CHECK:STDERR: fail_abstract_var_function_param.carbon:[[@LINE-4]]:1-25: note: class was declared abstract here [ClassAbstractHere] +// CHECK:STDERR: ╭─┤ fail_abstract_var_function_param.carbon:[[@LINE+12]]:13 +// CHECK:STDERR: │ abstract class Abstract { +// CHECK:STDERR: · ────────────┬──────────── +// CHECK:STDERR: · ╰──┤ class was declared abstract here [ClassAbstractHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn F(var _: Abstract) { +// CHECK:STDERR: · ┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: binding pattern has abstract type `Abstract` in `var` +// CHECK:STDERR: · ┃ pattern +// CHECK:STDERR: · ┃ [AbstractTypeInVarPattern] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(var _: Abstract) { } @@ -68,8 +95,16 @@ abstract class Abstract { class Adapter { // TODO(#4387): This should probably be valid - // CHECK:STDERR: fail_abstract_adapter.carbon:[[@LINE+3]]:3-17: error: adapted type `Abstract` is an abstract type [AbstractTypeInAdaptDecl] - // CHECK:STDERR: fail_abstract_adapter.carbon:[[@LINE-6]]:1-25: note: class was declared abstract here [ClassAbstractHere] + // CHECK:STDERR: ╭─┤ fail_abstract_adapter.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ abstract class Abstract { + // CHECK:STDERR: · ────────────┬──────────── + // CHECK:STDERR: · ╰──┤ class was declared abstract here [ClassAbstractHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ adapt Abstract; + // CHECK:STDERR: · ━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: adapted type `Abstract` is an abstract type + // CHECK:STDERR: · ┃ [AbstractTypeInAdaptDecl] + // CHECK:STDERR: ╰──── // CHECK:STDERR: adapt Abstract; } @@ -114,8 +149,16 @@ class Derived { var d: {}; } -// CHECK:STDERR: fail_return_abstract.carbon:[[@LINE+3]]:24-34: error: function returns abstract type `Abstract` [AbstractTypeInFunctionReturnType] -// CHECK:STDERR: fail_return_abstract.carbon:[[@LINE-10]]:1-25: note: class was declared abstract here [ClassAbstractHere] +// CHECK:STDERR: ╭─┤ fail_return_abstract.carbon:[[@LINE+11]]:24 +// CHECK:STDERR: │ abstract class Abstract { +// CHECK:STDERR: · ────────────┬──────────── +// CHECK:STDERR: · ╰──┤ class was declared abstract here [ClassAbstractHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn Return(a: Abstract) -> Abstract { +// CHECK:STDERR: · ━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: function returns abstract type `Abstract` +// CHECK:STDERR: · ┃ [AbstractTypeInFunctionReturnType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Return(a: Abstract) -> Abstract { return a; @@ -149,10 +192,27 @@ abstract class Abstract { } fn F() { - // CHECK:STDERR: fail_abstract_let_temporary_struct_literal.carbon:[[@LINE+5]]:28-29: error: initialization of abstract class `Abstract` [AbstractTypeInInit] + // CHECK:STDERR: ╭─┤ fail_abstract_let_temporary_struct_literal.carbon:[[@LINE+22]]:28 + // CHECK:STDERR: -> │ let unused l: Abstract = {}; + // CHECK:STDERR: · ┳━ + // CHECK:STDERR: · ┗━━┫ error: initialization of abstract class + // CHECK:STDERR: · ┃ `Abstract` + // CHECK:STDERR: · ┃ [AbstractTypeInInit] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_abstract_let_temporary_struct_literal.carbon:[[@LINE+3]]:28-29: error: cannot convert type `Abstract` into type implementing `Core.Destroy` [ConversionFailureTypeToFacet] - // CHECK:STDERR: {{.*}}/prelude/destroy.carbon:36:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_abstract_let_temporary_struct_literal.carbon:[[@LINE+14]]:28 + // CHECK:STDERR: -> │ let unused l: Abstract = {}; + // CHECK:STDERR: · ┳━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `Abstract` into type + // CHECK:STDERR: · ┃ implementing `Core.Destroy` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ {{.*}}/prelude/destroy.carbon + // CHECK:STDERR: │ fn SelfDestruct[T: Destroy](ref t: T) { + // CHECK:STDERR: · ───────────────────┬─────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused l: Abstract = {}; } @@ -170,8 +230,19 @@ class Derived { fn F() { // TODO: support destroying classes that derive from abstract types. // - // CHECK:STDERR: fail_todo_abstract_let_temporary.carbon:[[@LINE+3]]:28-50: error: cannot convert type `Derived` into type implementing `Core.Destroy` [ConversionFailureTypeToFacet] - // CHECK:STDERR: {{.*}}/prelude/destroy.carbon:36:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_todo_abstract_let_temporary.carbon:[[@LINE+14]]:28 + // CHECK:STDERR: -> │ let unused l: Abstract = {.base = {}} as Derived; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `Derived` into type + // CHECK:STDERR: · ┃ implementing `Core.Destroy` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ {{.*}}/prelude/destroy.carbon + // CHECK:STDERR: │ fn SelfDestruct[T: Destroy](ref t: T) { + // CHECK:STDERR: · ───────────────────┬─────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused l: Abstract = {.base = {}} as Derived; } @@ -185,9 +256,21 @@ abstract class Abstract { fn ReturnAbstract() -> Abstract; fn CallReturnAbstract() { - // CHECK:STDERR: fail_call_abstract_return.carbon:[[@LINE+4]]:3-18: error: function returns abstract type `Abstract` [AbstractTypeInFunctionReturnType] - // CHECK:STDERR: fail_call_abstract_return.carbon:[[@LINE-7]]:1-25: note: class was declared abstract here [ClassAbstractHere] - // CHECK:STDERR: fail_call_abstract_return.carbon:[[@LINE-5]]:21-31: note: return type declared here [IncompleteReturnTypeHere] + // CHECK:STDERR: ╭─┤ fail_call_abstract_return.carbon:[[@LINE+16]]:3 + // CHECK:STDERR: │ abstract class Abstract { + // CHECK:STDERR: · ────────────┬──────────── + // CHECK:STDERR: · ╰──┤ class was declared abstract here [ClassAbstractHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ fn ReturnAbstract() -> Abstract; + // CHECK:STDERR: · ─────┬───── + // CHECK:STDERR: · ╰──┤ return type declared here + // CHECK:STDERR: · │ [IncompleteReturnTypeHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ ReturnAbstract(); + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: function returns abstract type `Abstract` + // CHECK:STDERR: · ┃ [AbstractTypeInFunctionReturnType] + // CHECK:STDERR: ╰──── // CHECK:STDERR: ReturnAbstract(); } @@ -199,8 +282,13 @@ abstract class Abstract { } fn Assign(ref a: Abstract) { - // CHECK:STDERR: fail_assign_to_abstract_ref.carbon:[[@LINE+3]]:7: error: cannot copy value of type `Abstract` [CopyOfUncopyableType] - // CHECK:STDERR: fail_assign_to_abstract_ref.carbon:[[@LINE+2]]:7: note: type `Abstract` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_assign_to_abstract_ref.carbon:[[@LINE+8]]:7 + // CHECK:STDERR: -> │ a = a; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot copy value of type `Abstract` [CopyOfUncopyableType] + // CHECK:STDERR: · ╰────┤ type `Abstract` does not implement interface `Core.Copy` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: a = a; } @@ -677,12 +765,12 @@ fn Assign(ref a: Abstract) { // CHECK:STDOUT: %a.param_patt: %pattern_type.169 = value_param_pattern [concrete = constants.%a.param_patt] // CHECK:STDOUT: %a.patt: %pattern_type.169 = wrapper_binding_pattern a, %a.param_patt [concrete = constants.%a.patt] // CHECK:STDOUT: %return.param_patt: %pattern_type.169 = out_param_pattern [concrete = constants.%return.param_patt] -// CHECK:STDOUT: %return.patt: %pattern_type.169 = return_slot_pattern %return.param_patt, %Abstract.ref.loc15_27 [concrete = constants.%return.patt] +// CHECK:STDOUT: %return.patt: %pattern_type.169 = return_slot_pattern %return.param_patt, %Abstract.ref.loc23_27 [concrete = constants.%return.patt] // CHECK:STDOUT: } { -// CHECK:STDOUT: %Abstract.ref.loc15_27: type = name_ref Abstract, file.%Abstract.decl [concrete = constants.%Abstract] -// CHECK:STDOUT: %.loc15: Core.Form = init_form %Abstract.ref.loc15_27 [concrete = constants.%.749] +// CHECK:STDOUT: %Abstract.ref.loc23_27: type = name_ref Abstract, file.%Abstract.decl [concrete = constants.%Abstract] +// CHECK:STDOUT: %.loc23: Core.Form = init_form %Abstract.ref.loc23_27 [concrete = constants.%.749] // CHECK:STDOUT: %a.param: %Abstract = value_param call_param0 -// CHECK:STDOUT: %Abstract.ref.loc15_14: type = name_ref Abstract, file.%Abstract.decl [concrete = constants.%Abstract] +// CHECK:STDOUT: %Abstract.ref.loc23_14: type = name_ref Abstract, file.%Abstract.decl [concrete = constants.%Abstract] // CHECK:STDOUT: %a: %Abstract = wrapper_binding a, %a.param // CHECK:STDOUT: %return.param: ref %Abstract = out_param call_param1 // CHECK:STDOUT: %return: ref %Abstract = return_slot %return.param @@ -906,14 +994,14 @@ fn Assign(ref a: Abstract) { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc12_29.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc12_29.2: ref %Abstract = temporary_storage -// CHECK:STDOUT: %.loc12_29.3: init %Abstract to %.loc12_29.2 = class_init () [concrete = constants.%Abstract.val] -// CHECK:STDOUT: %.loc12_29.4: init %Abstract = converted %.loc12_29.1, %.loc12_29.3 [concrete = constants.%Abstract.val] -// CHECK:STDOUT: %.loc12_29.5: ref %Abstract = temporary %.loc12_29.2, %.loc12_29.4 [concrete = constants.%.69a] -// CHECK:STDOUT: %.loc12_29.6: %Abstract = acquire_value %.loc12_29.5 [concrete = constants.%Abstract.val] +// CHECK:STDOUT: %.loc29_29.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc29_29.2: ref %Abstract = temporary_storage +// CHECK:STDOUT: %.loc29_29.3: init %Abstract to %.loc29_29.2 = class_init () [concrete = constants.%Abstract.val] +// CHECK:STDOUT: %.loc29_29.4: init %Abstract = converted %.loc29_29.1, %.loc29_29.3 [concrete = constants.%Abstract.val] +// CHECK:STDOUT: %.loc29_29.5: ref %Abstract = temporary %.loc29_29.2, %.loc29_29.4 [concrete = constants.%.69a] +// CHECK:STDOUT: %.loc29_29.6: %Abstract = acquire_value %.loc29_29.5 [concrete = constants.%Abstract.val] // CHECK:STDOUT: %Abstract.ref: type = name_ref Abstract, file.%Abstract.decl [concrete = constants.%Abstract] -// CHECK:STDOUT: %l: %Abstract = wrapper_binding l, %.loc12_29.6 +// CHECK:STDOUT: %l: %Abstract = wrapper_binding l, %.loc29_29.6 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %l.patt: %pattern_type.169 = value_binding_pattern l [concrete = constants.%l.patt] // CHECK:STDOUT: } @@ -993,22 +1081,22 @@ fn Assign(ref a: Abstract) { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc16_38.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct.a40] -// CHECK:STDOUT: %.loc16_39.1: %struct_type.base.f5e = struct_literal (%.loc16_38.1) [concrete = constants.%struct] +// CHECK:STDOUT: %.loc27_38.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct.a40] +// CHECK:STDOUT: %.loc27_39.1: %struct_type.base.f5e = struct_literal (%.loc27_38.1) [concrete = constants.%struct] // CHECK:STDOUT: %Derived.ref: type = name_ref Derived, file.%Derived.decl [concrete = constants.%Derived] -// CHECK:STDOUT: %.loc16_39.2: ref %Derived = temporary_storage -// CHECK:STDOUT: %.loc16_39.3: ref %.79f = class_element_access %.loc16_39.2, element0 -// CHECK:STDOUT: %.loc16_38.2: init %.79f to %.loc16_39.3 = class_init () [concrete = constants.%empty_struct.5e0] -// CHECK:STDOUT: %.loc16_39.4: init %.79f = converted %.loc16_38.1, %.loc16_38.2 [concrete = constants.%empty_struct.5e0] -// CHECK:STDOUT: %.loc16_39.5: init %Abstract = as_compatible %.loc16_39.4 [concrete = constants.%Abstract.val] -// CHECK:STDOUT: %.loc16_39.6: init %Derived to %.loc16_39.2 = class_init (%.loc16_39.5) [concrete = constants.%Derived.val] -// CHECK:STDOUT: %.loc16_41.1: init %Derived = converted %.loc16_39.1, %.loc16_39.6 [concrete = constants.%Derived.val] -// CHECK:STDOUT: %.loc16_41.2: ref %Derived = temporary %.loc16_39.2, %.loc16_41.1 [concrete = constants.%.521] -// CHECK:STDOUT: %.loc16_41.3: ref %Abstract = class_element_access %.loc16_41.2, element0 [concrete = constants.%.5d3] -// CHECK:STDOUT: %.loc16_41.4: ref %Abstract = converted %.loc16_41.1, %.loc16_41.3 [concrete = constants.%.5d3] -// CHECK:STDOUT: %.loc16_41.5: %Abstract = acquire_value %.loc16_41.4 +// CHECK:STDOUT: %.loc27_39.2: ref %Derived = temporary_storage +// CHECK:STDOUT: %.loc27_39.3: ref %.79f = class_element_access %.loc27_39.2, element0 +// CHECK:STDOUT: %.loc27_38.2: init %.79f to %.loc27_39.3 = class_init () [concrete = constants.%empty_struct.5e0] +// CHECK:STDOUT: %.loc27_39.4: init %.79f = converted %.loc27_38.1, %.loc27_38.2 [concrete = constants.%empty_struct.5e0] +// CHECK:STDOUT: %.loc27_39.5: init %Abstract = as_compatible %.loc27_39.4 [concrete = constants.%Abstract.val] +// CHECK:STDOUT: %.loc27_39.6: init %Derived to %.loc27_39.2 = class_init (%.loc27_39.5) [concrete = constants.%Derived.val] +// CHECK:STDOUT: %.loc27_41.1: init %Derived = converted %.loc27_39.1, %.loc27_39.6 [concrete = constants.%Derived.val] +// CHECK:STDOUT: %.loc27_41.2: ref %Derived = temporary %.loc27_39.2, %.loc27_41.1 [concrete = constants.%.521] +// CHECK:STDOUT: %.loc27_41.3: ref %Abstract = class_element_access %.loc27_41.2, element0 [concrete = constants.%.5d3] +// CHECK:STDOUT: %.loc27_41.4: ref %Abstract = converted %.loc27_41.1, %.loc27_41.3 [concrete = constants.%.5d3] +// CHECK:STDOUT: %.loc27_41.5: %Abstract = acquire_value %.loc27_41.4 // CHECK:STDOUT: %Abstract.ref: type = name_ref Abstract, file.%Abstract.decl [concrete = constants.%Abstract] -// CHECK:STDOUT: %l: %Abstract = wrapper_binding l, %.loc16_41.5 +// CHECK:STDOUT: %l: %Abstract = wrapper_binding l, %.loc27_41.5 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %l.patt: %pattern_type.169 = value_binding_pattern l [concrete = constants.%l.patt] // CHECK:STDOUT: } @@ -1129,10 +1217,10 @@ fn Assign(ref a: Abstract) { // CHECK:STDOUT: // CHECK:STDOUT: fn @Assign(%a.param: ref %Abstract) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %a.ref.loc10_3: ref %Abstract = name_ref a, %a -// CHECK:STDOUT: %a.ref.loc10_7: ref %Abstract = name_ref a, %a -// CHECK:STDOUT: %.loc10: %Abstract = acquire_value %a.ref.loc10_7 -// CHECK:STDOUT: assign %a.ref.loc10_3, +// CHECK:STDOUT: %a.ref.loc15_3: ref %Abstract = name_ref a, %a +// CHECK:STDOUT: %a.ref.loc15_7: ref %Abstract = name_ref a, %a +// CHECK:STDOUT: %.loc15: %Abstract = acquire_value %a.ref.loc15_7 +// CHECK:STDOUT: assign %a.ref.loc15_3, // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/abstract/fail_abstract_in_struct.carbon b/toolchain/check/testdata/class/abstract/fail_abstract_in_struct.carbon index 3717a84ae6b5..72fd723055c0 100644 --- a/toolchain/check/testdata/class/abstract/fail_abstract_in_struct.carbon +++ b/toolchain/check/testdata/class/abstract/fail_abstract_in_struct.carbon @@ -18,8 +18,17 @@ library "[[@TEST_NAME]]"; abstract class Abstract1 {} class Contains { - // CHECK:STDERR: fail_abstract_field.carbon:[[@LINE+3]]:10-25: error: binding pattern has abstract type `{.m1: Abstract1}` in `var` pattern [AbstractTypeInVarPattern] - // CHECK:STDERR: fail_abstract_field.carbon:[[@LINE-4]]:1-26: note: uses class that was declared abstract here [ClassAbstractHere] + // CHECK:STDERR: ╭─┤ fail_abstract_field.carbon:[[@LINE+12]]:10 + // CHECK:STDERR: │ abstract class Abstract1 {} + // CHECK:STDERR: · ─────────────┬──────────── + // CHECK:STDERR: · ╰──┤ uses class that was declared abstract here [ClassAbstractHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ var a: {.m1: Abstract1}; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: binding pattern has abstract type `{.m1: Abstract1}` in + // CHECK:STDERR: · ┃ `var` pattern + // CHECK:STDERR: · ┃ [AbstractTypeInVarPattern] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var a: {.m1: Abstract1}; } @@ -29,8 +38,17 @@ library "[[@TEST_NAME]]"; abstract class Abstract2 {} -// CHECK:STDERR: fail_abstract_var.carbon:[[@LINE+3]]:8-23: error: binding pattern has abstract type `{.m2: Abstract2}` in `var` pattern [AbstractTypeInVarPattern] -// CHECK:STDERR: fail_abstract_var.carbon:[[@LINE-3]]:1-26: note: uses class that was declared abstract here [ClassAbstractHere] +// CHECK:STDERR: ╭─┤ fail_abstract_var.carbon:[[@LINE+12]]:8 +// CHECK:STDERR: │ abstract class Abstract2 {} +// CHECK:STDERR: · ─────────────┬──────────── +// CHECK:STDERR: · ╰──┤ uses class that was declared abstract here [ClassAbstractHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ var v: {.m2: Abstract2}; +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: binding pattern has abstract type `{.m2: Abstract2}` in `var` +// CHECK:STDERR: · ┃ pattern +// CHECK:STDERR: · ┃ [AbstractTypeInVarPattern] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var v: {.m2: Abstract2}; @@ -50,8 +68,17 @@ library "[[@TEST_NAME]]"; abstract class Abstract4 {} abstract class Abstract5 {} -// CHECK:STDERR: fail_abstract_twice.carbon:[[@LINE+3]]:9-40: error: binding pattern has abstract type `{.m4: Abstract4, .m5: Abstract5}` in `var` pattern [AbstractTypeInVarPattern] -// CHECK:STDERR: fail_abstract_twice.carbon:[[@LINE-4]]:1-26: note: uses class that was declared abstract here [ClassAbstractHere] +// CHECK:STDERR: ╭─┤ fail_abstract_twice.carbon:[[@LINE+12]]:9 +// CHECK:STDERR: │ abstract class Abstract4 {} +// CHECK:STDERR: · ─────────────┬──────────── +// CHECK:STDERR: · ╰──┤ uses class that was declared abstract here [ClassAbstractHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ var v2: {.m4: Abstract4, .m5: Abstract5}; +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: binding pattern has abstract type +// CHECK:STDERR: · ┃ `{.m4: Abstract4, .m5: Abstract5}` in `var` pattern +// CHECK:STDERR: · ┃ [AbstractTypeInVarPattern] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var v2: {.m4: Abstract4, .m5: Abstract5}; @@ -60,8 +87,17 @@ library "[[@TEST_NAME]]"; abstract class Abstract6 {} -// CHECK:STDERR: fail_abstract_first.carbon:[[@LINE+3]]:9-33: error: binding pattern has abstract type `{.m6: Abstract6, .c1: ()}` in `var` pattern [AbstractTypeInVarPattern] -// CHECK:STDERR: fail_abstract_first.carbon:[[@LINE-3]]:1-26: note: uses class that was declared abstract here [ClassAbstractHere] +// CHECK:STDERR: ╭─┤ fail_abstract_first.carbon:[[@LINE+12]]:9 +// CHECK:STDERR: │ abstract class Abstract6 {} +// CHECK:STDERR: · ─────────────┬──────────── +// CHECK:STDERR: · ╰──┤ uses class that was declared abstract here [ClassAbstractHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ var v3: {.m6: Abstract6, .c1: ()}; +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: binding pattern has abstract type +// CHECK:STDERR: · ┃ `{.m6: Abstract6, .c1: ()}` in `var` pattern +// CHECK:STDERR: · ┃ [AbstractTypeInVarPattern] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var v3: {.m6: Abstract6, .c1: ()}; @@ -70,8 +106,17 @@ library "[[@TEST_NAME]]"; abstract class Abstract7 {} -// CHECK:STDERR: fail_abstract_second.carbon:[[@LINE+3]]:9-33: error: binding pattern has abstract type `{.c2: (), .m7: Abstract7}` in `var` pattern [AbstractTypeInVarPattern] -// CHECK:STDERR: fail_abstract_second.carbon:[[@LINE-3]]:1-26: note: uses class that was declared abstract here [ClassAbstractHere] +// CHECK:STDERR: ╭─┤ fail_abstract_second.carbon:[[@LINE+12]]:9 +// CHECK:STDERR: │ abstract class Abstract7 {} +// CHECK:STDERR: · ─────────────┬──────────── +// CHECK:STDERR: · ╰──┤ uses class that was declared abstract here [ClassAbstractHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ var v4: {.c2: (), .m7: Abstract7}; +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: binding pattern has abstract type +// CHECK:STDERR: · ┃ `{.c2: (), .m7: Abstract7}` in `var` pattern +// CHECK:STDERR: · ┃ [AbstractTypeInVarPattern] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var v4: {.c2: (), .m7: Abstract7}; @@ -85,9 +130,19 @@ library "[[@TEST_NAME]]"; import library "lib"; -// CHECK:STDERR: fail_import.carbon:[[@LINE+4]]:9-22: error: binding pattern has abstract type `{.m: Abstract}` in `var` pattern [AbstractTypeInVarPattern] -// CHECK:STDERR: imported from: fail_import.carbon:[[@LINE-3]]:1 [InImport] -// CHECK:STDERR: lib.carbon:3:1-25: note: uses class that was declared abstract here [ClassAbstractHere] +// CHECK:STDERR: ╭─┤ fail_import.carbon:[[@LINE+14]]:9 +// CHECK:STDERR: -> │ var v5: {.m: Abstract}; +// CHECK:STDERR: · ┳━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: binding pattern has abstract type `{.m: Abstract}` in `var` +// CHECK:STDERR: · ┃ pattern +// CHECK:STDERR: · ┃ [AbstractTypeInVarPattern] +// CHECK:STDERR: ┆ +// CHECK:STDERR: │ ╭── imported from: fail_import.carbon [InImport] +// CHECK:STDERR: ├─┤ lib.carbon +// CHECK:STDERR: │ abstract class Abstract {} +// CHECK:STDERR: · ────────────┬──────────── +// CHECK:STDERR: · ╰──┤ uses class that was declared abstract here [ClassAbstractHere] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var v5: {.m: Abstract}; @@ -150,7 +205,7 @@ var v5: {.m: Abstract}; // CHECK:STDOUT: } // CHECK:STDOUT: %Abstract2.decl: type = class_decl @Abstract2 [concrete = constants.%Abstract2] {} {} // CHECK:STDOUT: %v.var: ref = var_storage %v.var_patt [concrete = ] -// CHECK:STDOUT: %.loc8: type = splice_block %struct_type.m2 [concrete = constants.%struct_type.m2.bb3] { +// CHECK:STDOUT: %.loc17: type = splice_block %struct_type.m2 [concrete = constants.%struct_type.m2.bb3] { // CHECK:STDOUT: %Abstract2.ref: type = name_ref Abstract2, %Abstract2.decl [concrete = constants.%Abstract2] // CHECK:STDOUT: %struct_type.m2: type = struct_type {.m2: %Abstract2} [concrete = constants.%struct_type.m2.bb3] // CHECK:STDOUT: } @@ -253,7 +308,7 @@ var v5: {.m: Abstract}; // CHECK:STDOUT: %Abstract4.decl: type = class_decl @Abstract4 [concrete = constants.%Abstract4] {} {} // CHECK:STDOUT: %Abstract5.decl: type = class_decl @Abstract5 [concrete = constants.%Abstract5] {} {} // CHECK:STDOUT: %v2.var: ref = var_storage %v2.var_patt [concrete = ] -// CHECK:STDOUT: %.loc9: type = splice_block %struct_type.m4.m5 [concrete = constants.%struct_type.m4.m5.5e1] { +// CHECK:STDOUT: %.loc18: type = splice_block %struct_type.m4.m5 [concrete = constants.%struct_type.m4.m5.5e1] { // CHECK:STDOUT: %Abstract4.ref: type = name_ref Abstract4, %Abstract4.decl [concrete = constants.%Abstract4] // CHECK:STDOUT: %Abstract5.ref: type = name_ref Abstract5, %Abstract5.decl [concrete = constants.%Abstract5] // CHECK:STDOUT: %struct_type.m4.m5: type = struct_type {.m4: %Abstract4, .m5: %Abstract5} [concrete = constants.%struct_type.m4.m5.5e1] @@ -306,10 +361,10 @@ var v5: {.m: Abstract}; // CHECK:STDOUT: } // CHECK:STDOUT: %Abstract6.decl: type = class_decl @Abstract6 [concrete = constants.%Abstract6] {} {} // CHECK:STDOUT: %v3.var: ref = var_storage %v3.var_patt [concrete = ] -// CHECK:STDOUT: %.loc8_33: type = splice_block %struct_type.m6.c1 [concrete = constants.%struct_type.m6.c1.a63] { +// CHECK:STDOUT: %.loc17_33: type = splice_block %struct_type.m6.c1 [concrete = constants.%struct_type.m6.c1.a63] { // CHECK:STDOUT: %Abstract6.ref: type = name_ref Abstract6, %Abstract6.decl [concrete = constants.%Abstract6] -// CHECK:STDOUT: %.loc8_32.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_32.2: type = converted %.loc8_32.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc17_32.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc17_32.2: type = converted %.loc17_32.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: %struct_type.m6.c1: type = struct_type {.m6: %Abstract6, .c1: %empty_tuple.type} [concrete = constants.%struct_type.m6.c1.a63] // CHECK:STDOUT: } // CHECK:STDOUT: %v3: = wrapper_binding v3, [concrete = ] @@ -352,9 +407,9 @@ var v5: {.m: Abstract}; // CHECK:STDOUT: } // CHECK:STDOUT: %Abstract7.decl: type = class_decl @Abstract7 [concrete = constants.%Abstract7] {} {} // CHECK:STDOUT: %v4.var: ref = var_storage %v4.var_patt [concrete = ] -// CHECK:STDOUT: %.loc8_33: type = splice_block %struct_type.c2.m7 [concrete = constants.%struct_type.c2.m7.518] { -// CHECK:STDOUT: %.loc8_16.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_16.2: type = converted %.loc8_16.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc17_33: type = splice_block %struct_type.c2.m7 [concrete = constants.%struct_type.c2.m7.518] { +// CHECK:STDOUT: %.loc17_16.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc17_16.2: type = converted %.loc17_16.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: %Abstract7.ref: type = name_ref Abstract7, %Abstract7.decl [concrete = constants.%Abstract7] // CHECK:STDOUT: %struct_type.c2.m7: type = struct_type {.c2: %empty_tuple.type, .m7: %Abstract7} [concrete = constants.%struct_type.c2.m7.518] // CHECK:STDOUT: } @@ -426,7 +481,7 @@ var v5: {.m: Abstract}; // CHECK:STDOUT: } // CHECK:STDOUT: %default.import = import // CHECK:STDOUT: %v5.var: ref = var_storage %v5.var_patt [concrete = ] -// CHECK:STDOUT: %.loc9: type = splice_block %struct_type.m [concrete = constants.%struct_type.m.b92] { +// CHECK:STDOUT: %.loc19: type = splice_block %struct_type.m [concrete = constants.%struct_type.m.b92] { // CHECK:STDOUT: %Abstract.ref: type = name_ref Abstract, imports.%Main.Abstract [concrete = constants.%Abstract] // CHECK:STDOUT: %struct_type.m: type = struct_type {.m: %Abstract} [concrete = constants.%struct_type.m.b92] // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/abstract/fail_abstract_in_tuple.carbon b/toolchain/check/testdata/class/abstract/fail_abstract_in_tuple.carbon index d4426d2b9635..eb34b21bf8ef 100644 --- a/toolchain/check/testdata/class/abstract/fail_abstract_in_tuple.carbon +++ b/toolchain/check/testdata/class/abstract/fail_abstract_in_tuple.carbon @@ -18,8 +18,17 @@ library "[[@TEST_NAME]]"; abstract class Abstract1 {} class Contains { - // CHECK:STDERR: fail_abstract_field.carbon:[[@LINE+3]]:10-21: error: binding pattern has abstract type `(Abstract1,)` in `var` pattern [AbstractTypeInVarPattern] - // CHECK:STDERR: fail_abstract_field.carbon:[[@LINE-4]]:1-26: note: uses class that was declared abstract here [ClassAbstractHere] + // CHECK:STDERR: ╭─┤ fail_abstract_field.carbon:[[@LINE+12]]:10 + // CHECK:STDERR: │ abstract class Abstract1 {} + // CHECK:STDERR: · ─────────────┬──────────── + // CHECK:STDERR: · ╰──┤ uses class that was declared abstract here [ClassAbstractHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ var a: (Abstract1,); + // CHECK:STDERR: · ┳━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: binding pattern has abstract type `(Abstract1,)` in `var` + // CHECK:STDERR: · ┃ pattern + // CHECK:STDERR: · ┃ [AbstractTypeInVarPattern] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var a: (Abstract1,); } @@ -30,8 +39,17 @@ library "[[@TEST_NAME]]"; abstract class Abstract2 {} fn Var() { - // CHECK:STDERR: fail_abstract_var.carbon:[[@LINE+3]]:17-28: error: binding pattern has abstract type `(Abstract2,)` in `var` pattern [AbstractTypeInVarPattern] - // CHECK:STDERR: fail_abstract_var.carbon:[[@LINE-4]]:1-26: note: uses class that was declared abstract here [ClassAbstractHere] + // CHECK:STDERR: ╭─┤ fail_abstract_var.carbon:[[@LINE+12]]:17 + // CHECK:STDERR: │ abstract class Abstract2 {} + // CHECK:STDERR: · ─────────────┬──────────── + // CHECK:STDERR: · ╰──┤ uses class that was declared abstract here [ClassAbstractHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ var unused v: (Abstract2,); + // CHECK:STDERR: · ┳━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: binding pattern has abstract type `(Abstract2,)` in + // CHECK:STDERR: · ┃ `var` pattern + // CHECK:STDERR: · ┃ [AbstractTypeInVarPattern] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused v: (Abstract2,); } @@ -53,8 +71,17 @@ abstract class Abstract4 {} abstract class Abstract5 {} fn Var2() { - // CHECK:STDERR: fail_abstract_twice.carbon:[[@LINE+3]]:18-39: error: binding pattern has abstract type `(Abstract4, Abstract5)` in `var` pattern [AbstractTypeInVarPattern] - // CHECK:STDERR: fail_abstract_twice.carbon:[[@LINE-5]]:1-26: note: uses class that was declared abstract here [ClassAbstractHere] + // CHECK:STDERR: ╭─┤ fail_abstract_twice.carbon:[[@LINE+12]]:18 + // CHECK:STDERR: │ abstract class Abstract4 {} + // CHECK:STDERR: · ─────────────┬──────────── + // CHECK:STDERR: · ╰──┤ uses class that was declared abstract here [ClassAbstractHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ var unused v2: (Abstract4, Abstract5); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: binding pattern has abstract type + // CHECK:STDERR: · ┃ `(Abstract4, Abstract5)` in `var` pattern + // CHECK:STDERR: · ┃ [AbstractTypeInVarPattern] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused v2: (Abstract4, Abstract5); } @@ -65,8 +92,17 @@ library "[[@TEST_NAME]]"; abstract class Abstract6 {} fn Var3() { - // CHECK:STDERR: fail_abstract_first.carbon:[[@LINE+3]]:18-32: error: binding pattern has abstract type `(Abstract6, {})` in `var` pattern [AbstractTypeInVarPattern] - // CHECK:STDERR: fail_abstract_first.carbon:[[@LINE-4]]:1-26: note: uses class that was declared abstract here [ClassAbstractHere] + // CHECK:STDERR: ╭─┤ fail_abstract_first.carbon:[[@LINE+12]]:18 + // CHECK:STDERR: │ abstract class Abstract6 {} + // CHECK:STDERR: · ─────────────┬──────────── + // CHECK:STDERR: · ╰──┤ uses class that was declared abstract here [ClassAbstractHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ var unused v3: (Abstract6, {}); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: binding pattern has abstract type `(Abstract6, {})` + // CHECK:STDERR: · ┃ in `var` pattern + // CHECK:STDERR: · ┃ [AbstractTypeInVarPattern] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused v3: (Abstract6, {}); } @@ -77,8 +113,17 @@ library "[[@TEST_NAME]]"; abstract class Abstract7 {} fn Var4() { - // CHECK:STDERR: fail_abstract_second.carbon:[[@LINE+3]]:18-32: error: binding pattern has abstract type `({}, Abstract7)` in `var` pattern [AbstractTypeInVarPattern] - // CHECK:STDERR: fail_abstract_second.carbon:[[@LINE-4]]:1-26: note: uses class that was declared abstract here [ClassAbstractHere] + // CHECK:STDERR: ╭─┤ fail_abstract_second.carbon:[[@LINE+12]]:18 + // CHECK:STDERR: │ abstract class Abstract7 {} + // CHECK:STDERR: · ─────────────┬──────────── + // CHECK:STDERR: · ╰──┤ uses class that was declared abstract here [ClassAbstractHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ var unused v4: ({}, Abstract7); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: binding pattern has abstract type `({}, Abstract7)` + // CHECK:STDERR: · ┃ in `var` pattern + // CHECK:STDERR: · ┃ [AbstractTypeInVarPattern] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused v4: ({}, Abstract7); } @@ -94,9 +139,19 @@ library "[[@TEST_NAME]]"; import library "lib"; fn Var5() { - // CHECK:STDERR: fail_import.carbon:[[@LINE+4]]:18-28: error: binding pattern has abstract type `(Abstract,)` in `var` pattern [AbstractTypeInVarPattern] - // CHECK:STDERR: imported from: fail_import.carbon:[[@LINE-4]]:1 [InImport] - // CHECK:STDERR: lib.carbon:3:1-25: note: uses class that was declared abstract here [ClassAbstractHere] + // CHECK:STDERR: ╭─┤ fail_import.carbon:[[@LINE+14]]:18 + // CHECK:STDERR: -> │ var unused v5: (Abstract,); + // CHECK:STDERR: · ┳━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: binding pattern has abstract type `(Abstract,)` in + // CHECK:STDERR: · ┃ `var` pattern + // CHECK:STDERR: · ┃ [AbstractTypeInVarPattern] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ ╭── imported from: fail_import.carbon [InImport] + // CHECK:STDERR: ├─┤ lib.carbon + // CHECK:STDERR: │ abstract class Abstract {} + // CHECK:STDERR: · ────────────┬──────────── + // CHECK:STDERR: · ╰──┤ uses class that was declared abstract here [ClassAbstractHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused v5: (Abstract,); } @@ -141,10 +196,10 @@ fn Var5() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Contains { -// CHECK:STDOUT: %field_decl: = field_decl a, element0, %.loc9_21.2 in [concrete] { +// CHECK:STDOUT: %field_decl: = field_decl a, element0, %.loc18_21.2 in [concrete] { // CHECK:STDOUT: %Abstract1.ref: type = name_ref Abstract1, file.%Abstract1.decl [concrete = constants.%Abstract1] -// CHECK:STDOUT: %.loc9_21.1: %tuple.type.135 = tuple_literal (%Abstract1.ref) [concrete = constants.%tuple] -// CHECK:STDOUT: %.loc9_21.2: type = converted %.loc9_21.1, constants.%tuple.type.b06 [concrete = constants.%tuple.type.b06] +// CHECK:STDOUT: %.loc18_21.1: %tuple.type.135 = tuple_literal (%Abstract1.ref) [concrete = constants.%tuple] +// CHECK:STDOUT: %.loc18_21.2: type = converted %.loc18_21.1, constants.%tuple.type.b06 [concrete = constants.%tuple.type.b06] // CHECK:STDOUT: } // CHECK:STDOUT: %complete_type: = complete_type_witness [concrete = ] // CHECK:STDOUT: complete_type_witness = %complete_type @@ -203,10 +258,10 @@ fn Var5() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %v.var: ref = var_storage %v.var_patt [concrete = ] // CHECK:STDOUT: assign %v.var, -// CHECK:STDOUT: %.loc9_28.1: type = splice_block %.loc9_28.3 [concrete = constants.%tuple.type.ea9] { +// CHECK:STDOUT: %.loc18_28.1: type = splice_block %.loc18_28.3 [concrete = constants.%tuple.type.ea9] { // CHECK:STDOUT: %Abstract2.ref: type = name_ref Abstract2, file.%Abstract2.decl [concrete = constants.%Abstract2] -// CHECK:STDOUT: %.loc9_28.2: %tuple.type.135 = tuple_literal (%Abstract2.ref) [concrete = constants.%tuple] -// CHECK:STDOUT: %.loc9_28.3: type = converted %.loc9_28.2, constants.%tuple.type.ea9 [concrete = constants.%tuple.type.ea9] +// CHECK:STDOUT: %.loc18_28.2: %tuple.type.135 = tuple_literal (%Abstract2.ref) [concrete = constants.%tuple] +// CHECK:STDOUT: %.loc18_28.3: type = converted %.loc18_28.2, constants.%tuple.type.ea9 [concrete = constants.%tuple.type.ea9] // CHECK:STDOUT: } // CHECK:STDOUT: %v: = wrapper_binding v, [concrete = ] // CHECK:STDOUT: name_binding_decl { @@ -345,11 +400,11 @@ fn Var5() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %v2.var: ref = var_storage %v2.var_patt [concrete = ] // CHECK:STDOUT: assign %v2.var, -// CHECK:STDOUT: %.loc10_39.1: type = splice_block %.loc10_39.3 [concrete = constants.%tuple.type.417] { +// CHECK:STDOUT: %.loc19_39.1: type = splice_block %.loc19_39.3 [concrete = constants.%tuple.type.417] { // CHECK:STDOUT: %Abstract4.ref: type = name_ref Abstract4, file.%Abstract4.decl [concrete = constants.%Abstract4] // CHECK:STDOUT: %Abstract5.ref: type = name_ref Abstract5, file.%Abstract5.decl [concrete = constants.%Abstract5] -// CHECK:STDOUT: %.loc10_39.2: %tuple.type.693 = tuple_literal (%Abstract4.ref, %Abstract5.ref) [concrete = constants.%tuple] -// CHECK:STDOUT: %.loc10_39.3: type = converted %.loc10_39.2, constants.%tuple.type.417 [concrete = constants.%tuple.type.417] +// CHECK:STDOUT: %.loc19_39.2: %tuple.type.693 = tuple_literal (%Abstract4.ref, %Abstract5.ref) [concrete = constants.%tuple] +// CHECK:STDOUT: %.loc19_39.3: type = converted %.loc19_39.2, constants.%tuple.type.417 [concrete = constants.%tuple.type.417] // CHECK:STDOUT: } // CHECK:STDOUT: %v2: = wrapper_binding v2, [concrete = ] // CHECK:STDOUT: name_binding_decl { @@ -408,12 +463,12 @@ fn Var5() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %v3.var: ref = var_storage %v3.var_patt [concrete = ] // CHECK:STDOUT: assign %v3.var, -// CHECK:STDOUT: %.loc9_32.1: type = splice_block %.loc9_32.4 [concrete = constants.%tuple.type.427] { +// CHECK:STDOUT: %.loc18_32.1: type = splice_block %.loc18_32.4 [concrete = constants.%tuple.type.427] { // CHECK:STDOUT: %Abstract6.ref: type = name_ref Abstract6, file.%Abstract6.decl [concrete = constants.%Abstract6] -// CHECK:STDOUT: %.loc9_31: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc9_32.2: %tuple.type.4d1 = tuple_literal (%Abstract6.ref, %.loc9_31) [concrete = constants.%tuple] -// CHECK:STDOUT: %.loc9_32.3: type = converted constants.%empty_struct, constants.%empty_struct_type [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %.loc9_32.4: type = converted %.loc9_32.2, constants.%tuple.type.427 [concrete = constants.%tuple.type.427] +// CHECK:STDOUT: %.loc18_31: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc18_32.2: %tuple.type.4d1 = tuple_literal (%Abstract6.ref, %.loc18_31) [concrete = constants.%tuple] +// CHECK:STDOUT: %.loc18_32.3: type = converted constants.%empty_struct, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc18_32.4: type = converted %.loc18_32.2, constants.%tuple.type.427 [concrete = constants.%tuple.type.427] // CHECK:STDOUT: } // CHECK:STDOUT: %v3: = wrapper_binding v3, [concrete = ] // CHECK:STDOUT: name_binding_decl { @@ -472,12 +527,12 @@ fn Var5() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %v4.var: ref = var_storage %v4.var_patt [concrete = ] // CHECK:STDOUT: assign %v4.var, -// CHECK:STDOUT: %.loc9_32.1: type = splice_block %.loc9_32.4 [concrete = constants.%tuple.type.9db] { -// CHECK:STDOUT: %.loc9_20: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc18_32.1: type = splice_block %.loc18_32.4 [concrete = constants.%tuple.type.9db] { +// CHECK:STDOUT: %.loc18_20: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] // CHECK:STDOUT: %Abstract7.ref: type = name_ref Abstract7, file.%Abstract7.decl [concrete = constants.%Abstract7] -// CHECK:STDOUT: %.loc9_32.2: %tuple.type.12a = tuple_literal (%.loc9_20, %Abstract7.ref) [concrete = constants.%tuple] -// CHECK:STDOUT: %.loc9_32.3: type = converted constants.%empty_struct, constants.%empty_struct_type [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %.loc9_32.4: type = converted %.loc9_32.2, constants.%tuple.type.9db [concrete = constants.%tuple.type.9db] +// CHECK:STDOUT: %.loc18_32.2: %tuple.type.12a = tuple_literal (%.loc18_20, %Abstract7.ref) [concrete = constants.%tuple] +// CHECK:STDOUT: %.loc18_32.3: type = converted constants.%empty_struct, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc18_32.4: type = converted %.loc18_32.2, constants.%tuple.type.9db [concrete = constants.%tuple.type.9db] // CHECK:STDOUT: } // CHECK:STDOUT: %v4: = wrapper_binding v4, [concrete = ] // CHECK:STDOUT: name_binding_decl { @@ -570,10 +625,10 @@ fn Var5() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %v5.var: ref = var_storage %v5.var_patt [concrete = ] // CHECK:STDOUT: assign %v5.var, -// CHECK:STDOUT: %.loc10_28.1: type = splice_block %.loc10_28.3 [concrete = constants.%tuple.type.763] { +// CHECK:STDOUT: %.loc20_28.1: type = splice_block %.loc20_28.3 [concrete = constants.%tuple.type.763] { // CHECK:STDOUT: %Abstract.ref: type = name_ref Abstract, imports.%Main.Abstract [concrete = constants.%Abstract] -// CHECK:STDOUT: %.loc10_28.2: %tuple.type.135 = tuple_literal (%Abstract.ref) [concrete = constants.%tuple] -// CHECK:STDOUT: %.loc10_28.3: type = converted %.loc10_28.2, constants.%tuple.type.763 [concrete = constants.%tuple.type.763] +// CHECK:STDOUT: %.loc20_28.2: %tuple.type.135 = tuple_literal (%Abstract.ref) [concrete = constants.%tuple] +// CHECK:STDOUT: %.loc20_28.3: type = converted %.loc20_28.2, constants.%tuple.type.763 [concrete = constants.%tuple.type.763] // CHECK:STDOUT: } // CHECK:STDOUT: %v5: = wrapper_binding v5, [concrete = ] // CHECK:STDOUT: name_binding_decl { diff --git a/toolchain/check/testdata/class/access/access_modifiers.carbon b/toolchain/check/testdata/class/access/access_modifiers.carbon index e9351d748b50..a5036c55cd0d 100644 --- a/toolchain/check/testdata/class/access/access_modifiers.carbon +++ b/toolchain/check/testdata/class/access/access_modifiers.carbon @@ -31,21 +31,56 @@ class Circle { fn Run() { //@dump-sem-ir-begin let circle: Circle = Circle.Make(); - // CHECK:STDERR: fail_private_field_access.carbon:[[@LINE+3]]:28-40: error: cannot access private member `radius` of type `Circle` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_private_field_access.carbon:[[@LINE-18]]:15-25: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_private_field_access.carbon:[[@LINE+12]]:28 + // CHECK:STDERR: │ private var radius: i32; + // CHECK:STDERR: · ─────┬───── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ let unused radius: i32 = circle.radius; + // CHECK:STDERR: · ┳━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `radius` of + // CHECK:STDERR: · ┃ type `Circle` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused radius: i32 = circle.radius; - // CHECK:STDERR: fail_private_field_access.carbon:[[@LINE+3]]:3-15: error: cannot access private member `radius` of type `Circle` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_private_field_access.carbon:[[@LINE-22]]:15-25: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_private_field_access.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ private var radius: i32; + // CHECK:STDERR: · ─────┬───── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ circle.radius = 5; + // CHECK:STDERR: · ━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `radius` of type `Circle` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: circle.radius = 5; - // CHECK:STDERR: fail_private_field_access.carbon:[[@LINE+3]]:3-31: error: cannot access private member `SOME_INTERNAL_CONSTANT` of type `Circle` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_private_field_access.carbon:[[@LINE-25]]:15-41: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_private_field_access.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ private let SOME_INTERNAL_CONSTANT: i32 = 5; + // CHECK:STDERR: · ─────────────┬───────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ circle.SOME_INTERNAL_CONSTANT; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `SOME_INTERNAL_CONSTANT` of type + // CHECK:STDERR: · ┃ `Circle` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: circle.SOME_INTERNAL_CONSTANT; - // CHECK:STDERR: fail_private_field_access.carbon:[[@LINE+3]]:3-29: error: cannot access private member `SomeInternalFunction` of type `Circle` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_private_field_access.carbon:[[@LINE-28]]:3-44: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_private_field_access.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ private fn SomeInternalFunction() -> i32 { + // CHECK:STDERR: · ─────────────────────┬──────────────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ circle.SomeInternalFunction(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `SomeInternalFunction` of type + // CHECK:STDERR: · ┃ `Circle` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: circle.SomeInternalFunction(); //@dump-sem-ir-end @@ -60,8 +95,16 @@ class A { fn Run() { //@dump-sem-ir-begin - // CHECK:STDERR: fail_protected_field_access.carbon:[[@LINE+3]]:23-25: error: cannot access protected member `x` of type `A` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_protected_field_access.carbon:[[@LINE-6]]:17-22: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_protected_field_access.carbon:[[@LINE+11]]:23 + // CHECK:STDERR: │ protected var x: i32; + // CHECK:STDERR: · ───┬── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ let unused x: i32 = A.x; + // CHECK:STDERR: · ┳━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access protected member `x` of type `A` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused x: i32 = A.x; //@dump-sem-ir-end @@ -137,12 +180,28 @@ class A { } //@dump-sem-ir-begin -// CHECK:STDERR: fail_global_access.carbon:[[@LINE+3]]:14-16: error: cannot access protected member `x` of type `A` [ClassInvalidMemberAccess] -// CHECK:STDERR: fail_global_access.carbon:[[@LINE-6]]:17-22: note: declared here [ClassMemberDeclaration] +// CHECK:STDERR: ╭─┤ fail_global_access.carbon:[[@LINE+11]]:14 +// CHECK:STDERR: │ protected let x: i32 = 5; +// CHECK:STDERR: · ───┬── +// CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ let x: i32 = A.x; +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┗━━┫ error: cannot access protected member `x` of type `A` +// CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let x: i32 = A.x; -// CHECK:STDERR: fail_global_access.carbon:[[@LINE+3]]:14-16: error: cannot access private member `y` of type `A` [ClassInvalidMemberAccess] -// CHECK:STDERR: fail_global_access.carbon:[[@LINE-9]]:15-20: note: declared here [ClassMemberDeclaration] +// CHECK:STDERR: ╭─┤ fail_global_access.carbon:[[@LINE+11]]:14 +// CHECK:STDERR: │ private let y: i32 = 5; +// CHECK:STDERR: · ───┬── +// CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ let y: i32 = A.y; +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┗━━┫ error: cannot access private member `y` of type `A` +// CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let y: i32 = A.y; //@dump-sem-ir-end @@ -261,20 +320,20 @@ class A { // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %circle.patt: %pattern_type.f70 = value_binding_pattern circle [concrete = constants.%circle.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %circle.ref.loc24: %Circle = name_ref circle, %circle -// CHECK:STDOUT: %radius.ref.loc24: = name_ref radius, [concrete = ] +// CHECK:STDOUT: %circle.ref.loc33: %Circle = name_ref circle, %circle +// CHECK:STDOUT: %radius.ref.loc33: = name_ref radius, [concrete = ] // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %radius: %i32 = wrapper_binding radius, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %radius.patt: %pattern_type.d94 = value_binding_pattern radius [concrete = constants.%radius.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %circle.ref.loc28: %Circle = name_ref circle, %circle -// CHECK:STDOUT: %radius.ref.loc28: = name_ref radius, [concrete = ] +// CHECK:STDOUT: %circle.ref.loc45: %Circle = name_ref circle, %circle +// CHECK:STDOUT: %radius.ref.loc45: = name_ref radius, [concrete = ] // CHECK:STDOUT: %int_5: Core.IntLiteral = int_value 5 [concrete = constants.%int_5.64b] -// CHECK:STDOUT: assign %radius.ref.loc28, -// CHECK:STDOUT: %circle.ref.loc32: %Circle = name_ref circle, %circle +// CHECK:STDOUT: assign %radius.ref.loc45, +// CHECK:STDOUT: %circle.ref.loc58: %Circle = name_ref circle, %circle // CHECK:STDOUT: %SOME_INTERNAL_CONSTANT.ref: = name_ref SOME_INTERNAL_CONSTANT, [concrete = ] -// CHECK:STDOUT: %circle.ref.loc37: %Circle = name_ref circle, %circle +// CHECK:STDOUT: %circle.ref.loc72: %Circle = name_ref circle, %circle // CHECK:STDOUT: %SomeInternalFunction.ref: = name_ref SomeInternalFunction, [concrete = ] // CHECK:STDOUT: %Destroy.facet.loc20_36.1: %Destroy.type = facet_value constants.%Circle, (constants.%DestroyImpl.impl_witness.60b, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.4b3] // CHECK:STDOUT: %.loc20_36.4: %Destroy.type = converted constants.%Circle, %Destroy.facet.loc20_36.1 [concrete = constants.%Destroy.facet.4b3] @@ -486,12 +545,12 @@ class A { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { -// CHECK:STDOUT: %i32.loc12: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc20: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %x: %i32 = wrapper_binding x, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %x.patt: %pattern_type.d94 = value_binding_pattern x [concrete = constants.%x.patt.ea2] // CHECK:STDOUT: } -// CHECK:STDOUT: %i32.loc16: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc32: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %y: %i32 = wrapper_binding y, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %y.patt: %pattern_type.d94 = value_binding_pattern y [concrete = constants.%y.patt.cd5] @@ -500,9 +559,9 @@ class A { // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %A.ref.loc12: type = name_ref A, file.%A.decl [concrete = constants.%A] +// CHECK:STDOUT: %A.ref.loc20: type = name_ref A, file.%A.decl [concrete = constants.%A] // CHECK:STDOUT: %x.ref: = name_ref x, [concrete = ] -// CHECK:STDOUT: %A.ref.loc16: type = name_ref A, file.%A.decl [concrete = constants.%A] +// CHECK:STDOUT: %A.ref.loc32: type = name_ref A, file.%A.decl [concrete = constants.%A] // CHECK:STDOUT: %y.ref: = name_ref y, [concrete = ] // CHECK:STDOUT: // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/access/friend.carbon b/toolchain/check/testdata/class/access/friend.carbon index b947254dc773..f542c242fe5f 100644 --- a/toolchain/check/testdata/class/access/friend.carbon +++ b/toolchain/check/testdata/class/access/friend.carbon @@ -18,8 +18,16 @@ class C { } fn F(c: C) -> i32 { - // CHECK:STDERR: fail_non_friend.carbon:[[@LINE+3]]:10-12: error: cannot access private member `i` of type `C` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_non_friend.carbon:[[@LINE-5]]:15-20: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_non_friend.carbon:[[@LINE+11]]:10 + // CHECK:STDERR: │ private var i: i32; + // CHECK:STDERR: · ───┬── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ return c.i; + // CHECK:STDERR: · ━┳━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `i` of type `C` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return c.i; } @@ -33,7 +41,12 @@ fn F(c: C) -> i32; class C { private var i: i32; - // CHECK:STDERR: fail_todo_friend_function.carbon:[[@LINE+2]]:3-11: error: semantics TODO: `befriending a function not yet implemented` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_friend_function.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ friend F; + // CHECK:STDERR: · ━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `befriending a function not yet implemented` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: friend F; } @@ -134,7 +147,12 @@ var v: i32; class C { private var i: i32; - // CHECK:STDERR: fail_friend_var.carbon:[[@LINE+2]]:10: error: friend declaration names entity that is not a name scope [FriendNotNameScope] + // CHECK:STDERR: ╭─┤ fail_friend_var.carbon:[[@LINE+7]]:10 + // CHECK:STDERR: -> │ friend v; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: friend declaration names entity that is not a name scope + // CHECK:STDERR: · ┃ [FriendNotNameScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: friend v; } @@ -161,7 +179,12 @@ library "[[@TEST_NAME]]"; class C; interface I { - // CHECK:STDERR: fail_friend_not_in_class.carbon:[[@LINE+2]]:3-11: error: `friend` declaration in non-class scope [FriendNotAllowedInScope] + // CHECK:STDERR: ╭─┤ fail_friend_not_in_class.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ friend C; + // CHECK:STDERR: · ━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: `friend` declaration in non-class scope + // CHECK:STDERR: · ┃ [FriendNotAllowedInScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: friend C; } @@ -171,7 +194,12 @@ library "[[@TEST_NAME]]"; class C { var v: i32; - // CHECK:STDERR: fail_friend_not_constant.carbon:[[@LINE+2]]:10: error: friend declaration names entity that is not a name scope [FriendNotNameScope] + // CHECK:STDERR: ╭─┤ fail_friend_not_constant.carbon:[[@LINE+7]]:10 + // CHECK:STDERR: -> │ friend v; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: friend declaration names entity that is not a name scope + // CHECK:STDERR: · ┃ [FriendNotNameScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: friend v; } diff --git a/toolchain/check/testdata/class/access/import_access.carbon b/toolchain/check/testdata/class/access/import_access.carbon index 050aa1f47683..e2f3156dc55b 100644 --- a/toolchain/check/testdata/class/access/import_access.carbon +++ b/toolchain/check/testdata/class/access/import_access.carbon @@ -50,7 +50,11 @@ package Test library "[[@TEST_NAME]]"; import library "def"; -// CHECK:STDERR: fail_local_def.carbon:[[@LINE+2]]:8-10: error: name `Def` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_local_def.carbon:[[@LINE+6]]:8 +// CHECK:STDERR: -> │ var c: Def = {}; +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┗━━┫ error: name `Def` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var c: Def = {}; @@ -60,7 +64,12 @@ package Other library "[[@TEST_NAME]]"; import Test library "def"; -// CHECK:STDERR: fail_other_def.carbon:[[@LINE+2]]:8-15: error: member name `Def` not found in `Test` [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╭─┤ fail_other_def.carbon:[[@LINE+7]]:8 +// CHECK:STDERR: -> │ var c: Test.Def = {}; +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: member name `Def` not found in `Test` +// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var c: Test.Def = {}; @@ -76,7 +85,11 @@ package Test library "[[@TEST_NAME]]"; import library "forward_with_def"; -// CHECK:STDERR: fail_local_forward_with_def.carbon:[[@LINE+2]]:8-21: error: name `ForwardWithDef` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_local_forward_with_def.carbon:[[@LINE+6]]:8 +// CHECK:STDERR: -> │ var c: ForwardWithDef = {}; +// CHECK:STDERR: · ━━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: name `ForwardWithDef` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var c: ForwardWithDef = {}; @@ -86,7 +99,12 @@ package Other library "[[@TEST_NAME]]"; import Test library "forward_with_def"; -// CHECK:STDERR: fail_other_forward_with_def.carbon:[[@LINE+2]]:8-26: error: member name `ForwardWithDef` not found in `Test` [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╭─┤ fail_other_forward_with_def.carbon:[[@LINE+7]]:8 +// CHECK:STDERR: -> │ var c: Test.ForwardWithDef = {}; +// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: member name `ForwardWithDef` not found in `Test` +// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var c: Test.ForwardWithDef = {}; @@ -104,7 +122,11 @@ package Test library "[[@TEST_NAME]]"; import library "forward"; -// CHECK:STDERR: fail_local_forward.carbon:[[@LINE+2]]:16-22: error: name `Forward` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_local_forward.carbon:[[@LINE+6]]:16 +// CHECK:STDERR: -> │ fn F(unused c: Forward*) {} +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: name `Forward` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused c: Forward*) {} @@ -114,7 +136,12 @@ package Other library "[[@TEST_NAME]]"; import Test library "forward"; -// CHECK:STDERR: fail_other_forward.carbon:[[@LINE+2]]:16-27: error: member name `Forward` not found in `Test` [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╭─┤ fail_other_forward.carbon:[[@LINE+7]]:16 +// CHECK:STDERR: -> │ fn F(unused c: Test.Forward*) {} +// CHECK:STDERR: · ━━━━━━┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: member name `Forward` not found in `Test` +// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused c: Test.Forward*) {} diff --git a/toolchain/check/testdata/class/access/inheritance_access.carbon b/toolchain/check/testdata/class/access/inheritance_access.carbon index 9d2104a848a6..b17894da8ba8 100644 --- a/toolchain/check/testdata/class/access/inheritance_access.carbon +++ b/toolchain/check/testdata/class/access/inheritance_access.carbon @@ -81,8 +81,16 @@ class Square { extend base: Shape; fn GetPosition(self) -> i32 { - // CHECK:STDERR: fail_inherited_private_field_access.carbon:[[@LINE+3]]:12-17: error: cannot access private member `y` of type `Shape` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_inherited_private_field_access.carbon:[[@LINE-8]]:15-20: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_inherited_private_field_access.carbon:[[@LINE+11]]:12 + // CHECK:STDERR: │ private var y: i32; + // CHECK:STDERR: · ───┬── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ return self.y; + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `y` of type `Shape` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return self.y; } @@ -122,8 +130,16 @@ base class B { class C { extend base: B; - // CHECK:STDERR: fail_noninstance_private_on_parent_qualified.carbon:[[@LINE+3]]:12-17: error: cannot access private member `F` of type `B` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_noninstance_private_on_parent_qualified.carbon:[[@LINE-6]]:3-18: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_noninstance_private_on_parent_qualified.carbon:[[@LINE+11]]:12 + // CHECK:STDERR: │ private fn F() {} + // CHECK:STDERR: · ────────┬─────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ fn G() { Self.F(); } + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `F` of type `B` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn G() { Self.F(); } } @@ -146,18 +162,43 @@ base class B { class C { extend base: B; - // CHECK:STDERR: fail_noninstance_private_on_parent_unqualified.carbon:[[@LINE+3]]:27-47: error: cannot access private member `SOME_PRIVATE_CONSTANT` of type `B` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_noninstance_private_on_parent_unqualified.carbon:[[@LINE-8]]:15-40: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_noninstance_private_on_parent_unqualified.carbon:[[@LINE+12]]:27 + // CHECK:STDERR: │ private let SOME_PRIVATE_CONSTANT: i32 = 86; + // CHECK:STDERR: · ─────────────┬──────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ fn G1() -> i32 { return SOME_PRIVATE_CONSTANT; } + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member + // CHECK:STDERR: · ┃ `SOME_PRIVATE_CONSTANT` of type `B` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn G1() -> i32 { return SOME_PRIVATE_CONSTANT; } - // CHECK:STDERR: fail_noninstance_private_on_parent_unqualified.carbon:[[@LINE+3]]:13-14: error: cannot access private member `Fa` of type `A` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_noninstance_private_on_parent_unqualified.carbon:[[@LINE-19]]:3-19: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_noninstance_private_on_parent_unqualified.carbon:[[@LINE+11]]:13 + // CHECK:STDERR: │ private fn Fa() {} + // CHECK:STDERR: · ────────┬──────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ fn G2() { Fa(); } + // CHECK:STDERR: · ━┳ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `Fa` of type `A` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn G2() { Fa(); } - // CHECK:STDERR: fail_noninstance_private_on_parent_unqualified.carbon:[[@LINE+3]]:13-14: error: cannot access private member `Fb` of type `B` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_noninstance_private_on_parent_unqualified.carbon:[[@LINE-17]]:3-19: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_noninstance_private_on_parent_unqualified.carbon:[[@LINE+11]]:13 + // CHECK:STDERR: │ private fn Fb() {} + // CHECK:STDERR: · ────────┬──────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ fn G3() { Fb(); } + // CHECK:STDERR: · ━┳ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `Fb` of type `B` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn G3() { Fb(); } } @@ -192,20 +233,46 @@ class B { private var internal: Internal; fn G() -> i32 { - // CHECK:STDERR: fail_non_inherited_access.carbon:[[@LINE+3]]:5-27: error: cannot access private member `SOME_PRIVATE_CONSTANT` of type `A` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_non_inherited_access.carbon:[[@LINE-12]]:15-40: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_non_inherited_access.carbon:[[@LINE+11]]:5 + // CHECK:STDERR: │ private let SOME_PRIVATE_CONSTANT: i32 = 5; + // CHECK:STDERR: · ─────────────┬──────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ A.SOME_PRIVATE_CONSTANT; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `SOME_PRIVATE_CONSTANT` of type `A` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: A.SOME_PRIVATE_CONSTANT; - // CHECK:STDERR: fail_non_inherited_access.carbon:[[@LINE+3]]:12-36: error: cannot access protected member `SOME_PROTECTED_CONSTANT` of type `A` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_non_inherited_access.carbon:[[@LINE-18]]:17-44: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_non_inherited_access.carbon:[[@LINE+12]]:12 + // CHECK:STDERR: │ protected let SOME_PROTECTED_CONSTANT: i32 = 5; + // CHECK:STDERR: · ──────────────┬───────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ return A.SOME_PROTECTED_CONSTANT; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access protected member `SOME_PROTECTED_CONSTANT` + // CHECK:STDERR: · ┃ of type `A` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return A.SOME_PROTECTED_CONSTANT; } fn SomeFunc(self) -> i32{ - // CHECK:STDERR: fail_non_inherited_access.carbon:[[@LINE+3]]:12-42: error: cannot access protected member `INTERNAL_CONSTANT` of type `Internal` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_non_inherited_access.carbon:[[@LINE-20]]:17-38: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_non_inherited_access.carbon:[[@LINE+12]]:12 + // CHECK:STDERR: │ protected let INTERNAL_CONSTANT: i32 = 5; + // CHECK:STDERR: · ───────────┬────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ return self.internal.INTERNAL_CONSTANT; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access protected member `INTERNAL_CONSTANT` of + // CHECK:STDERR: · ┃ type `Internal` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return self.internal.INTERNAL_CONSTANT; } @@ -222,8 +289,16 @@ base class A { class B { extend base: A; fn F(self) { - // CHECK:STDERR: fail_compound_member_access.carbon:[[@LINE+3]]:11-13: error: cannot access private member `x` of type `A` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_compound_member_access.carbon:[[@LINE-7]]:15-20: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_compound_member_access.carbon:[[@LINE+11]]:11 + // CHECK:STDERR: │ private var x: i32; + // CHECK:STDERR: · ───┬── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ self.(A.x); + // CHECK:STDERR: · ━┳━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `x` of type `A` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: self.(A.x); } @@ -269,13 +344,34 @@ fn G() { var d: C(i32) = { .base = Cpp.B.B(), }; - // CHECK:STDERR: fail_access_private_parent_in_generic.carbon:[[@LINE+8]]:13: error: cannot access private member `X` of type `Cpp.B` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_access_private_parent_in_generic.carbon:[[@LINE+7]]:13: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_access_private_parent_in_generic.carbon:[[@LINE+29]]:13 + // CHECK:STDERR: -> │ Cpp.F(&d); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `X` of type `Cpp.B` + // CHECK:STDERR: · │ ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: · ╰────┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_access_private_parent_in_generic.carbon:[[@LINE-15]]:8: error: 'X' is a private member of 'A' [CppInteropParseError] - // CHECK:STDERR: fail_access_private_parent_in_generic.carbon:[[@LINE+4]]:13: note: in instantiation of function template specialization 'F>' requested here [CppInteropParseNote] - // CHECK:STDERR: fail_access_private_parent_in_generic.carbon:[[@LINE-21]]:12-20: note: constrained by private inheritance here [CppInteropParseNote] - // CHECK:STDERR: fail_access_private_parent_in_generic.carbon:[[@LINE-24]]:8: note: member is declared here [CppInteropParseNote] + // CHECK:STDERR: ╭─┤ fail_access_private_parent_in_generic.carbon:[[@LINE-20]]:8 + // CHECK:STDERR: │ bool X() const; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ member is declared here [CppInteropParseNote] + // CHECK:STDERR: │ }; + // CHECK:STDERR: │ struct B : private A {}; + // CHECK:STDERR: · ────┬──── + // CHECK:STDERR: · ╰──┤ constrained by private inheritance here + // CHECK:STDERR: · │ [CppInteropParseNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ t->X(); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: 'X' is a private member of 'A' [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ Cpp.F(&d); + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ in instantiation of function template specialization + // CHECK:STDERR: · │ 'F>' requested here + // CHECK:STDERR: · │ [CppInteropParseNote] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.F(&d); } diff --git a/toolchain/check/testdata/class/access/method_access.carbon b/toolchain/check/testdata/class/access/method_access.carbon index 3a9ca0252bc5..e90bc30d0336 100644 --- a/toolchain/check/testdata/class/access/method_access.carbon +++ b/toolchain/check/testdata/class/access/method_access.carbon @@ -18,7 +18,13 @@ class X { fn G(x: X) { // TODO: Produce a better diagnostic for this case. - // CHECK:STDERR: fail_multiple_bindings.carbon:[[@LINE+2]]:3-9: error: member name of type `` in compound member access is not an instance member or an interface member [CompoundMemberAccessDoesNotUseBase] + // CHECK:STDERR: ╭─┤ fail_multiple_bindings.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ x.(x.F)(); + // CHECK:STDERR: · ┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: member name of type `` in compound member access is + // CHECK:STDERR: · ┃ not an instance member or an interface member + // CHECK:STDERR: · ┃ [CompoundMemberAccessDoesNotUseBase] + // CHECK:STDERR: ╰──── // CHECK:STDERR: x.(x.F)(); } diff --git a/toolchain/check/testdata/class/adapter/adapt.carbon b/toolchain/check/testdata/class/adapter/adapt.carbon index a3f93ca18186..a24450dfebed 100644 --- a/toolchain/check/testdata/class/adapter/adapt.carbon +++ b/toolchain/check/testdata/class/adapter/adapt.carbon @@ -43,7 +43,12 @@ class AdaptNotExtend { fn F(a: AdaptNotExtend) { // `Adapted` is not extended, so lookup for `F` finds nothing. - // CHECK:STDERR: fail_not_extend.carbon:[[@LINE+2]]:3-5: error: member name `F` not found in `AdaptNotExtend` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╭─┤ fail_not_extend.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ a.F(); + // CHECK:STDERR: · ━┳━ + // CHECK:STDERR: · ┗━━┫ error: member name `F` not found in `AdaptNotExtend` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: a.F(); } @@ -53,13 +58,23 @@ fn F(a: AdaptNotExtend) { library "[[@TEST_NAME]]"; fn F() { - // CHECK:STDERR: fail_misplaced.carbon:[[@LINE+2]]:3-12: error: `adapt` declaration outside class [ClassSpecificDeclOutsideClass] + // CHECK:STDERR: ╭─┤ fail_misplaced.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ adapt i32; + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: `adapt` declaration outside class + // CHECK:STDERR: · ┃ [ClassSpecificDeclOutsideClass] + // CHECK:STDERR: ╰──── // CHECK:STDERR: adapt i32; } interface I { - // CHECK:STDERR: fail_misplaced.carbon:[[@LINE+2]]:3-12: error: `adapt` declaration outside class [ClassSpecificDeclOutsideClass] + // CHECK:STDERR: ╭─┤ fail_misplaced.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ adapt i32; + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: `adapt` declaration outside class + // CHECK:STDERR: · ┃ [ClassSpecificDeclOutsideClass] + // CHECK:STDERR: ╰──── // CHECK:STDERR: adapt i32; } diff --git a/toolchain/check/testdata/class/adapter/adapt_copy.carbon b/toolchain/check/testdata/class/adapter/adapt_copy.carbon index e4ee803af261..377a57d94ce8 100644 --- a/toolchain/check/testdata/class/adapter/adapt_copy.carbon +++ b/toolchain/check/testdata/class/adapter/adapt_copy.carbon @@ -24,23 +24,50 @@ class AdaptCopyable { } fn F(c: AdaptCopyable) -> AdaptCopyable { - // CHECK:STDERR: fail_adapt_copyable.carbon:[[@LINE+3]]:26: error: cannot copy value of type `AdaptCopyable` [CopyOfUncopyableType] - // CHECK:STDERR: fail_adapt_copyable.carbon:[[@LINE+2]]:26: note: type `AdaptCopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_adapt_copyable.carbon:[[@LINE+10]]:26 + // CHECK:STDERR: -> │ var d: AdaptCopyable = c; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot copy value of type `AdaptCopyable` + // CHECK:STDERR: · │ ┃ [CopyOfUncopyableType] + // CHECK:STDERR: · ╰────┤ type `AdaptCopyable` does not implement + // CHECK:STDERR: · │ interface `Core.Copy` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var d: AdaptCopyable = c; - // CHECK:STDERR: fail_adapt_copyable.carbon:[[@LINE+3]]:10: error: cannot copy value of type `AdaptCopyable` [CopyOfUncopyableType] - // CHECK:STDERR: fail_adapt_copyable.carbon:[[@LINE+2]]:10: note: type `AdaptCopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_adapt_copyable.carbon:[[@LINE+9]]:10 + // CHECK:STDERR: -> │ return d; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot copy value of type `AdaptCopyable` + // CHECK:STDERR: · │ ┃ [CopyOfUncopyableType] + // CHECK:STDERR: · ╰────┤ type `AdaptCopyable` does not implement interface `Core.Copy` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return d; } fn InTuple(c: (AdaptCopyable, u32)) -> (AdaptCopyable, u32) { - // CHECK:STDERR: fail_adapt_copyable.carbon:[[@LINE+3]]:33: error: cannot copy value of type `AdaptCopyable` [CopyOfUncopyableType] - // CHECK:STDERR: fail_adapt_copyable.carbon:[[@LINE+2]]:33: note: type `AdaptCopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_adapt_copyable.carbon:[[@LINE+11]]:33 + // CHECK:STDERR: -> │ var d: (AdaptCopyable, u32) = c; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot copy value of type + // CHECK:STDERR: · │ ┃ `AdaptCopyable` + // CHECK:STDERR: · │ ┃ [CopyOfUncopyableType] + // CHECK:STDERR: · ╰────┤ type `AdaptCopyable` does not implement + // CHECK:STDERR: · │ interface `Core.Copy` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var d: (AdaptCopyable, u32) = c; - // CHECK:STDERR: fail_adapt_copyable.carbon:[[@LINE+3]]:10: error: cannot copy value of type `AdaptCopyable` [CopyOfUncopyableType] - // CHECK:STDERR: fail_adapt_copyable.carbon:[[@LINE+2]]:10: note: type `AdaptCopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_adapt_copyable.carbon:[[@LINE+9]]:10 + // CHECK:STDERR: -> │ return d; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot copy value of type `AdaptCopyable` + // CHECK:STDERR: · │ ┃ [CopyOfUncopyableType] + // CHECK:STDERR: · ╰────┤ type `AdaptCopyable` does not implement interface `Core.Copy` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return d; } @@ -76,12 +103,26 @@ class AdaptNoncopyable { } fn G(a: AdaptNoncopyable) -> AdaptNoncopyable { - // CHECK:STDERR: fail_adapt_not_copyable.carbon:[[@LINE+3]]:29: error: cannot copy value of type `AdaptNoncopyable` [CopyOfUncopyableType] - // CHECK:STDERR: fail_adapt_not_copyable.carbon:[[@LINE+2]]:29: note: type `AdaptNoncopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_adapt_not_copyable.carbon:[[@LINE+11]]:29 + // CHECK:STDERR: -> │ var b: AdaptNoncopyable = a; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot copy value of type + // CHECK:STDERR: · │ ┃ `AdaptNoncopyable` + // CHECK:STDERR: · │ ┃ [CopyOfUncopyableType] + // CHECK:STDERR: · ╰────┤ type `AdaptNoncopyable` does not implement + // CHECK:STDERR: · │ interface `Core.Copy` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var b: AdaptNoncopyable = a; - // CHECK:STDERR: fail_adapt_not_copyable.carbon:[[@LINE+3]]:10: error: cannot copy value of type `AdaptNoncopyable` [CopyOfUncopyableType] - // CHECK:STDERR: fail_adapt_not_copyable.carbon:[[@LINE+2]]:10: note: type `AdaptNoncopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_adapt_not_copyable.carbon:[[@LINE+9]]:10 + // CHECK:STDERR: -> │ return b; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot copy value of type `AdaptNoncopyable` + // CHECK:STDERR: · │ ┃ [CopyOfUncopyableType] + // CHECK:STDERR: · ╰────┤ type `AdaptNoncopyable` does not implement interface `Core.Copy` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return b; } @@ -99,14 +140,30 @@ class AdaptNoncopyableIndirect { } fn H(a: AdaptNoncopyableIndirect) -> AdaptNoncopyableIndirect { - // CHECK:STDERR: fail_adapt_not_copyable_indirect.carbon:[[@LINE+4]]:3-33: error: cannot copy value of type `Noncopyable` [CopyOfUncopyableType] - // CHECK:STDERR: fail_adapt_not_copyable_indirect.carbon:[[@LINE+3]]:3-33: note: type `Noncopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: fail_adapt_not_copyable_indirect.carbon:[[@LINE+2]]:37: note: in copy of `AdaptNoncopyableIndirect` [InCopy] + // CHECK:STDERR: ╭─┤ fail_adapt_not_copyable_indirect.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: -> │ var b: AdaptNoncopyableIndirect = a; + // CHECK:STDERR: · ━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━ ┬ + // CHECK:STDERR: · ┗━━━━━━━━━━━━━━━━━━━━━┫ error: cannot copy value of type + // CHECK:STDERR: · │ │ ┃ `Noncopyable` + // CHECK:STDERR: · │ │ ┃ [CopyOfUncopyableType] + // CHECK:STDERR: · ╰───────────────────────┤ type `Noncopyable` does not implement + // CHECK:STDERR: · │ │ interface `Core.Copy` + // CHECK:STDERR: · │ │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: · ╰──────┤ in copy of + // CHECK:STDERR: · │ `AdaptNoncopyableIndirect` + // CHECK:STDERR: · │ [InCopy] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var b: AdaptNoncopyableIndirect = a; - // CHECK:STDERR: fail_adapt_not_copyable_indirect.carbon:[[@LINE+4]]:3-11: error: cannot copy value of type `Noncopyable` [CopyOfUncopyableType] - // CHECK:STDERR: fail_adapt_not_copyable_indirect.carbon:[[@LINE+3]]:3-11: note: type `Noncopyable` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: fail_adapt_not_copyable_indirect.carbon:[[@LINE+2]]:10: note: in copy of `AdaptNoncopyableIndirect` [InCopy] + // CHECK:STDERR: ╭─┤ fail_adapt_not_copyable_indirect.carbon:[[@LINE+10]]:3 + // CHECK:STDERR: -> │ return b; + // CHECK:STDERR: · ━━━━┳━━┯━ + // CHECK:STDERR: · ┗━━━━━┫ error: cannot copy value of type `Noncopyable` + // CHECK:STDERR: · │ │ ┃ [CopyOfUncopyableType] + // CHECK:STDERR: · ╰───────┤ type `Noncopyable` does not implement interface `Core.Copy` + // CHECK:STDERR: · │ │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: · ╰──────┤ in copy of `AdaptNoncopyableIndirect` [InCopy] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return b; } @@ -159,7 +216,7 @@ fn InTuple(c: (AdaptStruct, u32)) -> (AdaptStruct, u32) { // CHECK:STDOUT: %T.09f: %SubobjectDestroy.type = symbolic_binding T, 0 [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.type.dea: type = fn_type @T.as_type.as.DestroyImpl.impl.Op, @T.as_type.as.DestroyImpl.impl(%T.09f) [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.6e5: %T.as_type.as.DestroyImpl.impl.Op.type.dea = struct_value () [symbolic] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.2: type = fn_type @SubobjectDestroy.WithSelf.Op.loc12_3.2 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.2: type = fn_type @SubobjectDestroy.WithSelf.Op.loc19_3.2 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.2: %SubobjectDestroy.WithSelf.Op.type.6870fd.2 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80ef6.2: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.2), @SubobjectDestroy [concrete] // CHECK:STDOUT: %SubobjectDestroy.facet.f53: %SubobjectDestroy.type = facet_value %AdaptCopyable, (%custom_witness.b80ef6.2) [concrete] @@ -182,10 +239,10 @@ fn InTuple(c: (AdaptStruct, u32)) -> (AdaptStruct, u32) { // CHECK:STDOUT: %InTuple: %InTuple.type = struct_value () [concrete] // CHECK:STDOUT: %d.patt.883: %pattern_type.848 = ref_binding_pattern d [concrete] // CHECK:STDOUT: %d.var_patt.66d: %pattern_type.848 = var_pattern %d.patt.883 [concrete] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.3: type = fn_type @SubobjectDestroy.WithSelf.Op.loc23_3.1 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.3: type = fn_type @SubobjectDestroy.WithSelf.Op.loc44_3.1 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.3: %SubobjectDestroy.WithSelf.Op.type.6870fd.3 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80ef6.3: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.3), @SubobjectDestroy [concrete] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.4: type = fn_type @SubobjectDestroy.WithSelf.Op.loc23_3.2 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.4: type = fn_type @SubobjectDestroy.WithSelf.Op.loc44_3.2 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.4: %SubobjectDestroy.WithSelf.Op.type.6870fd.4 = struct_value () [concrete] // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete] // CHECK:STDOUT: %SubobjectDestroy.facet.439: %SubobjectDestroy.type = facet_value %u32, (%custom_witness.b80ef6.3) [concrete] @@ -244,19 +301,19 @@ fn InTuple(c: (AdaptStruct, u32)) -> (AdaptStruct, u32) { // CHECK:STDOUT: %c.param_patt: %pattern_type.848 = value_param_pattern [concrete = constants.%c.param_patt.47e] // CHECK:STDOUT: %c.patt: %pattern_type.848 = wrapper_binding_pattern c, %c.param_patt [concrete = constants.%c.patt.fe5] // CHECK:STDOUT: %return.param_patt: %pattern_type.848 = out_param_pattern [concrete = constants.%return.param_patt.117] -// CHECK:STDOUT: %return.patt: %pattern_type.848 = return_slot_pattern %return.param_patt, %.loc19_59.2 [concrete = constants.%return.patt.77a] +// CHECK:STDOUT: %return.patt: %pattern_type.848 = return_slot_pattern %return.param_patt, %.loc32_59.2 [concrete = constants.%return.patt.77a] // CHECK:STDOUT: } { -// CHECK:STDOUT: %AdaptCopyable.ref.loc19_41: type = name_ref AdaptCopyable, file.%AdaptCopyable.decl [concrete = constants.%AdaptCopyable] -// CHECK:STDOUT: %u32.loc19_56: type = type_literal constants.%u32 [concrete = constants.%u32] -// CHECK:STDOUT: %.loc19_59.1: %tuple.type.693 = tuple_literal (%AdaptCopyable.ref.loc19_41, %u32.loc19_56) [concrete = constants.%tuple.0f9] -// CHECK:STDOUT: %.loc19_59.2: type = converted %.loc19_59.1, constants.%tuple.type.c35 [concrete = constants.%tuple.type.c35] -// CHECK:STDOUT: %.loc19_59.3: Core.Form = init_form %.loc19_59.2 [concrete = constants.%.70b] +// CHECK:STDOUT: %AdaptCopyable.ref.loc32_41: type = name_ref AdaptCopyable, file.%AdaptCopyable.decl [concrete = constants.%AdaptCopyable] +// CHECK:STDOUT: %u32.loc32_56: type = type_literal constants.%u32 [concrete = constants.%u32] +// CHECK:STDOUT: %.loc32_59.1: %tuple.type.693 = tuple_literal (%AdaptCopyable.ref.loc32_41, %u32.loc32_56) [concrete = constants.%tuple.0f9] +// CHECK:STDOUT: %.loc32_59.2: type = converted %.loc32_59.1, constants.%tuple.type.c35 [concrete = constants.%tuple.type.c35] +// CHECK:STDOUT: %.loc32_59.3: Core.Form = init_form %.loc32_59.2 [concrete = constants.%.70b] // CHECK:STDOUT: %c.param: %tuple.type.c35 = value_param call_param0 -// CHECK:STDOUT: %.loc19_34.1: type = splice_block %.loc19_34.3 [concrete = constants.%tuple.type.c35] { -// CHECK:STDOUT: %AdaptCopyable.ref.loc19_16: type = name_ref AdaptCopyable, file.%AdaptCopyable.decl [concrete = constants.%AdaptCopyable] -// CHECK:STDOUT: %u32.loc19_31: type = type_literal constants.%u32 [concrete = constants.%u32] -// CHECK:STDOUT: %.loc19_34.2: %tuple.type.693 = tuple_literal (%AdaptCopyable.ref.loc19_16, %u32.loc19_31) [concrete = constants.%tuple.0f9] -// CHECK:STDOUT: %.loc19_34.3: type = converted %.loc19_34.2, constants.%tuple.type.c35 [concrete = constants.%tuple.type.c35] +// CHECK:STDOUT: %.loc32_34.1: type = splice_block %.loc32_34.3 [concrete = constants.%tuple.type.c35] { +// CHECK:STDOUT: %AdaptCopyable.ref.loc32_16: type = name_ref AdaptCopyable, file.%AdaptCopyable.decl [concrete = constants.%AdaptCopyable] +// CHECK:STDOUT: %u32.loc32_31: type = type_literal constants.%u32 [concrete = constants.%u32] +// CHECK:STDOUT: %.loc32_34.2: %tuple.type.693 = tuple_literal (%AdaptCopyable.ref.loc32_16, %u32.loc32_31) [concrete = constants.%tuple.0f9] +// CHECK:STDOUT: %.loc32_34.3: type = converted %.loc32_34.2, constants.%tuple.type.c35 [concrete = constants.%tuple.type.c35] // CHECK:STDOUT: } // CHECK:STDOUT: %c: %tuple.type.c35 = wrapper_binding c, %c.param // CHECK:STDOUT: %return.param: ref %tuple.type.c35 = out_param call_param1 @@ -279,38 +336,38 @@ fn InTuple(c: (AdaptStruct, u32)) -> (AdaptStruct, u32) { // CHECK:STDOUT: %d.var: ref %AdaptCopyable = var_storage %d.var_patt // CHECK:STDOUT: %c.ref: %AdaptCopyable = name_ref c, %c // CHECK:STDOUT: assign %d.var, -// CHECK:STDOUT: %AdaptCopyable.ref.loc12: type = name_ref AdaptCopyable, file.%AdaptCopyable.decl [concrete = constants.%AdaptCopyable] +// CHECK:STDOUT: %AdaptCopyable.ref.loc19: type = name_ref AdaptCopyable, file.%AdaptCopyable.decl [concrete = constants.%AdaptCopyable] // CHECK:STDOUT: %d: ref %AdaptCopyable = wrapper_binding d, %d.var // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %d.patt: %pattern_type.3b9 = ref_binding_pattern d [concrete = constants.%d.patt.467] // CHECK:STDOUT: %d.var_patt: %pattern_type.3b9 = var_pattern %d.patt [concrete = constants.%d.var_patt.b13] // CHECK:STDOUT: } // CHECK:STDOUT: %d.ref: ref %AdaptCopyable = name_ref d, %d -// CHECK:STDOUT: %.loc16: %AdaptCopyable = acquire_value %d.ref -// CHECK:STDOUT: %Destroy.facet.loc12_3.1: %Destroy.type = facet_value constants.%AdaptCopyable, (constants.%DestroyImpl.impl_witness.da7, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.11a] -// CHECK:STDOUT: %.loc12_3.1: %Destroy.type = converted constants.%AdaptCopyable, %Destroy.facet.loc12_3.1 [concrete = constants.%Destroy.facet.11a] -// CHECK:STDOUT: %Destroy.facet.loc12_3.2: %Destroy.type = facet_value constants.%AdaptCopyable, (constants.%DestroyImpl.impl_witness.da7, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.11a] -// CHECK:STDOUT: %.loc12_3.2: %Destroy.type = converted constants.%AdaptCopyable, %Destroy.facet.loc12_3.2 [concrete = constants.%Destroy.facet.11a] +// CHECK:STDOUT: %.loc29: %AdaptCopyable = acquire_value %d.ref +// CHECK:STDOUT: %Destroy.facet.loc19_3.1: %Destroy.type = facet_value constants.%AdaptCopyable, (constants.%DestroyImpl.impl_witness.da7, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.11a] +// CHECK:STDOUT: %.loc19_3.1: %Destroy.type = converted constants.%AdaptCopyable, %Destroy.facet.loc19_3.1 [concrete = constants.%Destroy.facet.11a] +// CHECK:STDOUT: %Destroy.facet.loc19_3.2: %Destroy.type = facet_value constants.%AdaptCopyable, (constants.%DestroyImpl.impl_witness.da7, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.11a] +// CHECK:STDOUT: %.loc19_3.2: %Destroy.type = converted constants.%AdaptCopyable, %Destroy.facet.loc19_3.2 [concrete = constants.%Destroy.facet.11a] // CHECK:STDOUT: %SelfDestruct.specific_fn: = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet.11a) [concrete = constants.%SelfDestruct.specific_fn.97c] // CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%d.var) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc12_3.1(%self.param: ref %i32) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc19_3.1(%self.param: ref %i32) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc12_3.2(%self.param: ref %AdaptCopyable) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc19_3.2(%self.param: ref %AdaptCopyable) = "no_op"; // CHECK:STDOUT: // CHECK:STDOUT: fn @InTuple(%c.param: %tuple.type.c35) -> out %return.param: %tuple.type.c35 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %d.var: ref %tuple.type.c35 = var_storage %d.var_patt // CHECK:STDOUT: %c.ref: %tuple.type.c35 = name_ref c, %c -// CHECK:STDOUT: %tuple.elem0.loc23: %AdaptCopyable = tuple_access %c.ref, element0 +// CHECK:STDOUT: %tuple.elem0.loc44: %AdaptCopyable = tuple_access %c.ref, element0 // CHECK:STDOUT: assign %d.var, -// CHECK:STDOUT: %.loc23_29.1: type = splice_block %.loc23_29.3 [concrete = constants.%tuple.type.c35] { -// CHECK:STDOUT: %AdaptCopyable.ref.loc23: type = name_ref AdaptCopyable, file.%AdaptCopyable.decl [concrete = constants.%AdaptCopyable] -// CHECK:STDOUT: %u32.loc23: type = type_literal constants.%u32 [concrete = constants.%u32] -// CHECK:STDOUT: %.loc23_29.2: %tuple.type.693 = tuple_literal (%AdaptCopyable.ref.loc23, %u32.loc23) [concrete = constants.%tuple.0f9] -// CHECK:STDOUT: %.loc23_29.3: type = converted %.loc23_29.2, constants.%tuple.type.c35 [concrete = constants.%tuple.type.c35] +// CHECK:STDOUT: %.loc44_29.1: type = splice_block %.loc44_29.3 [concrete = constants.%tuple.type.c35] { +// CHECK:STDOUT: %AdaptCopyable.ref.loc44: type = name_ref AdaptCopyable, file.%AdaptCopyable.decl [concrete = constants.%AdaptCopyable] +// CHECK:STDOUT: %u32.loc44: type = type_literal constants.%u32 [concrete = constants.%u32] +// CHECK:STDOUT: %.loc44_29.2: %tuple.type.693 = tuple_literal (%AdaptCopyable.ref.loc44, %u32.loc44) [concrete = constants.%tuple.0f9] +// CHECK:STDOUT: %.loc44_29.3: type = converted %.loc44_29.2, constants.%tuple.type.c35 [concrete = constants.%tuple.type.c35] // CHECK:STDOUT: } // CHECK:STDOUT: %d: ref %tuple.type.c35 = wrapper_binding d, %d.var // CHECK:STDOUT: name_binding_decl { @@ -318,37 +375,37 @@ fn InTuple(c: (AdaptStruct, u32)) -> (AdaptStruct, u32) { // CHECK:STDOUT: %d.var_patt: %pattern_type.848 = var_pattern %d.patt [concrete = constants.%d.var_patt.66d] // CHECK:STDOUT: } // CHECK:STDOUT: %d.ref: ref %tuple.type.c35 = name_ref d, %d -// CHECK:STDOUT: %tuple.elem0.loc27: ref %AdaptCopyable = tuple_access %d.ref, element0 -// CHECK:STDOUT: %.loc27: %AdaptCopyable = acquire_value %tuple.elem0.loc27 -// CHECK:STDOUT: %Destroy.facet.loc23_3.1: %Destroy.type = facet_value constants.%tuple.type.c35, (constants.%DestroyImpl.impl_witness.2ab, constants.%custom_witness.b80ef6.4) [concrete = constants.%Destroy.facet.aca] -// CHECK:STDOUT: %.loc23_3.1: %Destroy.type = converted constants.%tuple.type.c35, %Destroy.facet.loc23_3.1 [concrete = constants.%Destroy.facet.aca] -// CHECK:STDOUT: %Destroy.facet.loc23_3.2: %Destroy.type = facet_value constants.%tuple.type.c35, (constants.%DestroyImpl.impl_witness.2ab, constants.%custom_witness.b80ef6.4) [concrete = constants.%Destroy.facet.aca] -// CHECK:STDOUT: %.loc23_3.2: %Destroy.type = converted constants.%tuple.type.c35, %Destroy.facet.loc23_3.2 [concrete = constants.%Destroy.facet.aca] +// CHECK:STDOUT: %tuple.elem0.loc54: ref %AdaptCopyable = tuple_access %d.ref, element0 +// CHECK:STDOUT: %.loc54: %AdaptCopyable = acquire_value %tuple.elem0.loc54 +// CHECK:STDOUT: %Destroy.facet.loc44_3.1: %Destroy.type = facet_value constants.%tuple.type.c35, (constants.%DestroyImpl.impl_witness.2ab, constants.%custom_witness.b80ef6.4) [concrete = constants.%Destroy.facet.aca] +// CHECK:STDOUT: %.loc44_3.1: %Destroy.type = converted constants.%tuple.type.c35, %Destroy.facet.loc44_3.1 [concrete = constants.%Destroy.facet.aca] +// CHECK:STDOUT: %Destroy.facet.loc44_3.2: %Destroy.type = facet_value constants.%tuple.type.c35, (constants.%DestroyImpl.impl_witness.2ab, constants.%custom_witness.b80ef6.4) [concrete = constants.%Destroy.facet.aca] +// CHECK:STDOUT: %.loc44_3.2: %Destroy.type = converted constants.%tuple.type.c35, %Destroy.facet.loc44_3.2 [concrete = constants.%Destroy.facet.aca] // CHECK:STDOUT: %SelfDestruct.specific_fn: = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet.aca) [concrete = constants.%SelfDestruct.specific_fn.f48] // CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%d.var) // CHECK:STDOUT: return to %return.param // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc23_3.1(%self.param: ref %u32) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc44_3.1(%self.param: ref %u32) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc23_3.2(%self.param: ref %tuple.type.c35) { +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc44_3.2(%self.param: ref %tuple.type.c35) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] // CHECK:STDOUT: %tuple.elem1: ref %u32 = tuple_access %self.param, element1 -// CHECK:STDOUT: %Destroy.facet.loc23_3.1: %Destroy.type = facet_value constants.%u32, (constants.%DestroyImpl.impl_witness.ee7, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.35c] -// CHECK:STDOUT: %.loc23_3.1: %Destroy.type = converted constants.%u32, %Destroy.facet.loc23_3.1 [concrete = constants.%Destroy.facet.35c] -// CHECK:STDOUT: %Destroy.facet.loc23_3.2: %Destroy.type = facet_value constants.%u32, (constants.%DestroyImpl.impl_witness.ee7, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.35c] -// CHECK:STDOUT: %.loc23_3.2: %Destroy.type = converted constants.%u32, %Destroy.facet.loc23_3.2 [concrete = constants.%Destroy.facet.35c] +// CHECK:STDOUT: %Destroy.facet.loc44_3.1: %Destroy.type = facet_value constants.%u32, (constants.%DestroyImpl.impl_witness.ee7, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.35c] +// CHECK:STDOUT: %.loc44_3.1: %Destroy.type = converted constants.%u32, %Destroy.facet.loc44_3.1 [concrete = constants.%Destroy.facet.35c] +// CHECK:STDOUT: %Destroy.facet.loc44_3.2: %Destroy.type = facet_value constants.%u32, (constants.%DestroyImpl.impl_witness.ee7, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.35c] +// CHECK:STDOUT: %.loc44_3.2: %Destroy.type = converted constants.%u32, %Destroy.facet.loc44_3.2 [concrete = constants.%Destroy.facet.35c] // CHECK:STDOUT: %SelfDestruct.specific_fn.1: = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet.35c) [concrete = constants.%SelfDestruct.specific_fn.a73] -// CHECK:STDOUT: %SelfDestruct.call.loc23_3.1: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%tuple.elem1) +// CHECK:STDOUT: %SelfDestruct.call.loc44_3.1: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%tuple.elem1) // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] // CHECK:STDOUT: %tuple.elem0: ref %AdaptCopyable = tuple_access %self.param, element0 -// CHECK:STDOUT: %Destroy.facet.loc23_3.3: %Destroy.type = facet_value constants.%AdaptCopyable, (constants.%DestroyImpl.impl_witness.da7, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.11a] -// CHECK:STDOUT: %.loc23_3.3: %Destroy.type = converted constants.%AdaptCopyable, %Destroy.facet.loc23_3.3 [concrete = constants.%Destroy.facet.11a] -// CHECK:STDOUT: %Destroy.facet.loc23_3.4: %Destroy.type = facet_value constants.%AdaptCopyable, (constants.%DestroyImpl.impl_witness.da7, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.11a] -// CHECK:STDOUT: %.loc23_3.4: %Destroy.type = converted constants.%AdaptCopyable, %Destroy.facet.loc23_3.4 [concrete = constants.%Destroy.facet.11a] +// CHECK:STDOUT: %Destroy.facet.loc44_3.3: %Destroy.type = facet_value constants.%AdaptCopyable, (constants.%DestroyImpl.impl_witness.da7, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.11a] +// CHECK:STDOUT: %.loc44_3.3: %Destroy.type = converted constants.%AdaptCopyable, %Destroy.facet.loc44_3.3 [concrete = constants.%Destroy.facet.11a] +// CHECK:STDOUT: %Destroy.facet.loc44_3.4: %Destroy.type = facet_value constants.%AdaptCopyable, (constants.%DestroyImpl.impl_witness.da7, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.11a] +// CHECK:STDOUT: %.loc44_3.4: %Destroy.type = converted constants.%AdaptCopyable, %Destroy.facet.loc44_3.4 [concrete = constants.%Destroy.facet.11a] // CHECK:STDOUT: %SelfDestruct.specific_fn.2: = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet.11a) [concrete = constants.%SelfDestruct.specific_fn.97c] -// CHECK:STDOUT: %SelfDestruct.call.loc23_3.2: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%tuple.elem0) +// CHECK:STDOUT: %SelfDestruct.call.loc44_3.2: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%tuple.elem0) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -766,7 +823,7 @@ fn InTuple(c: (AdaptStruct, u32)) -> (AdaptStruct, u32) { // CHECK:STDOUT: %T.09f: %SubobjectDestroy.type = symbolic_binding T, 0 [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.type.dea: type = fn_type @T.as_type.as.DestroyImpl.impl.Op, @T.as_type.as.DestroyImpl.impl(%T.09f) [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.6e5: %T.as_type.as.DestroyImpl.impl.Op.type.dea = struct_value () [symbolic] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.3: type = fn_type @SubobjectDestroy.WithSelf.Op.loc16_3.3 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.3: type = fn_type @SubobjectDestroy.WithSelf.Op.loc24_3.3 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.3: %SubobjectDestroy.WithSelf.Op.type.6870fd.3 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80ef6.3: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.3), @SubobjectDestroy [concrete] // CHECK:STDOUT: %SubobjectDestroy.facet.7fa: %SubobjectDestroy.type = facet_value %AdaptNoncopyable, (%custom_witness.b80ef6.3) [concrete] @@ -838,28 +895,28 @@ fn InTuple(c: (AdaptStruct, u32)) -> (AdaptStruct, u32) { // CHECK:STDOUT: %b.var: ref %AdaptNoncopyable = var_storage %b.var_patt // CHECK:STDOUT: %a.ref: %AdaptNoncopyable = name_ref a, %a // CHECK:STDOUT: assign %b.var, -// CHECK:STDOUT: %AdaptNoncopyable.ref.loc16: type = name_ref AdaptNoncopyable, file.%AdaptNoncopyable.decl [concrete = constants.%AdaptNoncopyable] +// CHECK:STDOUT: %AdaptNoncopyable.ref.loc24: type = name_ref AdaptNoncopyable, file.%AdaptNoncopyable.decl [concrete = constants.%AdaptNoncopyable] // CHECK:STDOUT: %b: ref %AdaptNoncopyable = wrapper_binding b, %b.var // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %b.patt: %pattern_type.d14 = ref_binding_pattern b [concrete = constants.%b.patt] // CHECK:STDOUT: %b.var_patt: %pattern_type.d14 = var_pattern %b.patt [concrete = constants.%b.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %b.ref: ref %AdaptNoncopyable = name_ref b, %b -// CHECK:STDOUT: %.loc20: %AdaptNoncopyable = acquire_value %b.ref -// CHECK:STDOUT: %Destroy.facet.loc16_3.1: %Destroy.type = facet_value constants.%AdaptNoncopyable, (constants.%DestroyImpl.impl_witness.9f4, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc16_3.1: %Destroy.type = converted constants.%AdaptNoncopyable, %Destroy.facet.loc16_3.1 [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %Destroy.facet.loc16_3.2: %Destroy.type = facet_value constants.%AdaptNoncopyable, (constants.%DestroyImpl.impl_witness.9f4, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc16_3.2: %Destroy.type = converted constants.%AdaptNoncopyable, %Destroy.facet.loc16_3.2 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc34: %AdaptNoncopyable = acquire_value %b.ref +// CHECK:STDOUT: %Destroy.facet.loc24_3.1: %Destroy.type = facet_value constants.%AdaptNoncopyable, (constants.%DestroyImpl.impl_witness.9f4, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc24_3.1: %Destroy.type = converted constants.%AdaptNoncopyable, %Destroy.facet.loc24_3.1 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %Destroy.facet.loc24_3.2: %Destroy.type = facet_value constants.%AdaptNoncopyable, (constants.%DestroyImpl.impl_witness.9f4, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc24_3.2: %Destroy.type = converted constants.%AdaptNoncopyable, %Destroy.facet.loc24_3.2 [concrete = constants.%Destroy.facet] // CHECK:STDOUT: %SelfDestruct.specific_fn: = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet) [concrete = constants.%SelfDestruct.specific_fn] // CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%b.var) // CHECK:STDOUT: return to %return.param // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc16_3.1(%self.param: ref %empty_struct_type) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc24_3.1(%self.param: ref %empty_struct_type) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc16_3.2(%self.param: ref %Noncopyable) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc24_3.2(%self.param: ref %Noncopyable) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc16_3.3(%self.param: ref %AdaptNoncopyable) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc24_3.3(%self.param: ref %AdaptNoncopyable) = "no_op"; // CHECK:STDOUT: // CHECK:STDOUT: --- fail_adapt_not_copyable_indirect.carbon // CHECK:STDOUT: @@ -906,10 +963,10 @@ fn InTuple(c: (AdaptStruct, u32)) -> (AdaptStruct, u32) { // CHECK:STDOUT: %T.09f: %SubobjectDestroy.type = symbolic_binding T, 0 [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.type.dea: type = fn_type @T.as_type.as.DestroyImpl.impl.Op, @T.as_type.as.DestroyImpl.impl(%T.09f) [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.6e5: %T.as_type.as.DestroyImpl.impl.Op.type.dea = struct_value () [symbolic] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.1: type = fn_type @SubobjectDestroy.WithSelf.Op.loc17_3.1 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.1: type = fn_type @SubobjectDestroy.WithSelf.Op.loc27_3.1 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.1: %SubobjectDestroy.WithSelf.Op.type.6870fd.1 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80ef6.1: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.1), @SubobjectDestroy [concrete] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.3: type = fn_type @SubobjectDestroy.WithSelf.Op.loc17_3.3 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.3: type = fn_type @SubobjectDestroy.WithSelf.Op.loc27_3.3 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.3: %SubobjectDestroy.WithSelf.Op.type.6870fd.3 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80ef6.3: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.3), @SubobjectDestroy [concrete] // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete] @@ -923,7 +980,7 @@ fn InTuple(c: (AdaptStruct, u32)) -> (AdaptStruct, u32) { // CHECK:STDOUT: %Destroy.facet.6f5: %Destroy.type = facet_value %Noncopyable, (%DestroyImpl.impl_witness.59b, %custom_witness.b80ef6.3) [concrete] // CHECK:STDOUT: %SelfDestruct.specific_fn.20b: = specific_function %SelfDestruct, @SelfDestruct(%Destroy.facet.6f5) [concrete] // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.5: type = fn_type @SubobjectDestroy.WithSelf.Op.loc17_3.5 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.5: type = fn_type @SubobjectDestroy.WithSelf.Op.loc27_3.5 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.5: %SubobjectDestroy.WithSelf.Op.type.6870fd.5 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80ef6.5: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.5), @SubobjectDestroy [concrete] // CHECK:STDOUT: %SubobjectDestroy.facet.e5e: %SubobjectDestroy.type = facet_value %AdaptNoncopyableIndirect, (%custom_witness.b80ef6.5) [concrete] @@ -1002,83 +1059,83 @@ fn InTuple(c: (AdaptStruct, u32)) -> (AdaptStruct, u32) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %b.var: ref %AdaptNoncopyableIndirect = var_storage %b.var_patt // CHECK:STDOUT: %a.ref: %AdaptNoncopyableIndirect = name_ref a, %a -// CHECK:STDOUT: %.loc17_3.1: %tuple.type.71d = as_compatible %a.ref -// CHECK:STDOUT: %tuple.elem0.loc17_3.1: %i32 = tuple_access %.loc17_3.1, element0 -// CHECK:STDOUT: %impl.elem0.loc17: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae] -// CHECK:STDOUT: %bound_method.loc17_3.1: = bound_method %tuple.elem0.loc17_3.1, %impl.elem0.loc17 -// CHECK:STDOUT: %specific_fn.loc17: = specific_function %impl.elem0.loc17, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc17_3.2: = bound_method %tuple.elem0.loc17_3.1, %specific_fn.loc17 -// CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc17: init %i32 = call %bound_method.loc17_3.2(%tuple.elem0.loc17_3.1) -// CHECK:STDOUT: %.loc17_3.2: ref %tuple.type.71d = as_compatible %b.var -// CHECK:STDOUT: %tuple.elem0.loc17_3.2: ref %i32 = tuple_access %.loc17_3.2, element0 -// CHECK:STDOUT: %.loc17_3.3: init %i32 to %tuple.elem0.loc17_3.2 = in_place_init %Int.as.Copy.impl.Op.call.loc17 -// CHECK:STDOUT: %tuple.elem1.loc17: %Noncopyable = tuple_access %.loc17_3.1, element1 +// CHECK:STDOUT: %.loc27_3.1: %tuple.type.71d = as_compatible %a.ref +// CHECK:STDOUT: %tuple.elem0.loc27_3.1: %i32 = tuple_access %.loc27_3.1, element0 +// CHECK:STDOUT: %impl.elem0.loc27: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae] +// CHECK:STDOUT: %bound_method.loc27_3.1: = bound_method %tuple.elem0.loc27_3.1, %impl.elem0.loc27 +// CHECK:STDOUT: %specific_fn.loc27: = specific_function %impl.elem0.loc27, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc27_3.2: = bound_method %tuple.elem0.loc27_3.1, %specific_fn.loc27 +// CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc27: init %i32 = call %bound_method.loc27_3.2(%tuple.elem0.loc27_3.1) +// CHECK:STDOUT: %.loc27_3.2: ref %tuple.type.71d = as_compatible %b.var +// CHECK:STDOUT: %tuple.elem0.loc27_3.2: ref %i32 = tuple_access %.loc27_3.2, element0 +// CHECK:STDOUT: %.loc27_3.3: init %i32 to %tuple.elem0.loc27_3.2 = in_place_init %Int.as.Copy.impl.Op.call.loc27 +// CHECK:STDOUT: %tuple.elem1.loc27: %Noncopyable = tuple_access %.loc27_3.1, element1 // CHECK:STDOUT: assign %b.var, -// CHECK:STDOUT: %AdaptNoncopyableIndirect.ref.loc17: type = name_ref AdaptNoncopyableIndirect, file.%AdaptNoncopyableIndirect.decl [concrete = constants.%AdaptNoncopyableIndirect] +// CHECK:STDOUT: %AdaptNoncopyableIndirect.ref.loc27: type = name_ref AdaptNoncopyableIndirect, file.%AdaptNoncopyableIndirect.decl [concrete = constants.%AdaptNoncopyableIndirect] // CHECK:STDOUT: %b: ref %AdaptNoncopyableIndirect = wrapper_binding b, %b.var // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %b.patt: %pattern_type.be3 = ref_binding_pattern b [concrete = constants.%b.patt] // CHECK:STDOUT: %b.var_patt: %pattern_type.be3 = var_pattern %b.patt [concrete = constants.%b.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %b.ref: ref %AdaptNoncopyableIndirect = name_ref b, %b -// CHECK:STDOUT: %.loc22_11.1: ref %tuple.type.71d = as_compatible %b.ref -// CHECK:STDOUT: %tuple.elem0.loc22_11.1: ref %i32 = tuple_access %.loc22_11.1, element0 -// CHECK:STDOUT: %.loc22_11.2: %i32 = acquire_value %tuple.elem0.loc22_11.1 -// CHECK:STDOUT: %impl.elem0.loc22: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae] -// CHECK:STDOUT: %bound_method.loc22_11.1: = bound_method %.loc22_11.2, %impl.elem0.loc22 -// CHECK:STDOUT: %specific_fn.loc22: = specific_function %impl.elem0.loc22, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc22_11.2: = bound_method %.loc22_11.2, %specific_fn.loc22 -// CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc22: init %i32 = call %bound_method.loc22_11.2(%.loc22_11.2) -// CHECK:STDOUT: %.loc22_11.3: ref %tuple.type.71d = as_compatible %return.param -// CHECK:STDOUT: %tuple.elem0.loc22_11.2: ref %i32 = tuple_access %.loc22_11.3, element0 -// CHECK:STDOUT: %.loc22_11.4: init %i32 to %tuple.elem0.loc22_11.2 = in_place_init %Int.as.Copy.impl.Op.call.loc22 -// CHECK:STDOUT: %tuple.elem1.loc22: ref %Noncopyable = tuple_access %.loc22_11.1, element1 -// CHECK:STDOUT: %.loc22_11.5: %Noncopyable = acquire_value %tuple.elem1.loc22 -// CHECK:STDOUT: %Destroy.facet.loc17_3.1: %Destroy.type = facet_value constants.%AdaptNoncopyableIndirect, (constants.%DestroyImpl.impl_witness.860, constants.%custom_witness.b80ef6.5) [concrete = constants.%Destroy.facet.1f2] -// CHECK:STDOUT: %.loc17_3.4: %Destroy.type = converted constants.%AdaptNoncopyableIndirect, %Destroy.facet.loc17_3.1 [concrete = constants.%Destroy.facet.1f2] -// CHECK:STDOUT: %Destroy.facet.loc17_3.2: %Destroy.type = facet_value constants.%AdaptNoncopyableIndirect, (constants.%DestroyImpl.impl_witness.860, constants.%custom_witness.b80ef6.5) [concrete = constants.%Destroy.facet.1f2] -// CHECK:STDOUT: %.loc17_3.5: %Destroy.type = converted constants.%AdaptNoncopyableIndirect, %Destroy.facet.loc17_3.2 [concrete = constants.%Destroy.facet.1f2] +// CHECK:STDOUT: %.loc38_11.1: ref %tuple.type.71d = as_compatible %b.ref +// CHECK:STDOUT: %tuple.elem0.loc38_11.1: ref %i32 = tuple_access %.loc38_11.1, element0 +// CHECK:STDOUT: %.loc38_11.2: %i32 = acquire_value %tuple.elem0.loc38_11.1 +// CHECK:STDOUT: %impl.elem0.loc38: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae] +// CHECK:STDOUT: %bound_method.loc38_11.1: = bound_method %.loc38_11.2, %impl.elem0.loc38 +// CHECK:STDOUT: %specific_fn.loc38: = specific_function %impl.elem0.loc38, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc38_11.2: = bound_method %.loc38_11.2, %specific_fn.loc38 +// CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc38: init %i32 = call %bound_method.loc38_11.2(%.loc38_11.2) +// CHECK:STDOUT: %.loc38_11.3: ref %tuple.type.71d = as_compatible %return.param +// CHECK:STDOUT: %tuple.elem0.loc38_11.2: ref %i32 = tuple_access %.loc38_11.3, element0 +// CHECK:STDOUT: %.loc38_11.4: init %i32 to %tuple.elem0.loc38_11.2 = in_place_init %Int.as.Copy.impl.Op.call.loc38 +// CHECK:STDOUT: %tuple.elem1.loc38: ref %Noncopyable = tuple_access %.loc38_11.1, element1 +// CHECK:STDOUT: %.loc38_11.5: %Noncopyable = acquire_value %tuple.elem1.loc38 +// CHECK:STDOUT: %Destroy.facet.loc27_3.1: %Destroy.type = facet_value constants.%AdaptNoncopyableIndirect, (constants.%DestroyImpl.impl_witness.860, constants.%custom_witness.b80ef6.5) [concrete = constants.%Destroy.facet.1f2] +// CHECK:STDOUT: %.loc27_3.4: %Destroy.type = converted constants.%AdaptNoncopyableIndirect, %Destroy.facet.loc27_3.1 [concrete = constants.%Destroy.facet.1f2] +// CHECK:STDOUT: %Destroy.facet.loc27_3.2: %Destroy.type = facet_value constants.%AdaptNoncopyableIndirect, (constants.%DestroyImpl.impl_witness.860, constants.%custom_witness.b80ef6.5) [concrete = constants.%Destroy.facet.1f2] +// CHECK:STDOUT: %.loc27_3.5: %Destroy.type = converted constants.%AdaptNoncopyableIndirect, %Destroy.facet.loc27_3.2 [concrete = constants.%Destroy.facet.1f2] // CHECK:STDOUT: %SelfDestruct.specific_fn: = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet.1f2) [concrete = constants.%SelfDestruct.specific_fn.0b6] // CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%b.var) // CHECK:STDOUT: return to %return.param // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc17_3.1(%self.param: ref %i32) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc27_3.1(%self.param: ref %i32) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc17_3.2(%self.param: ref %empty_struct_type) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc27_3.2(%self.param: ref %empty_struct_type) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc17_3.3(%self.param: ref %Noncopyable) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc27_3.3(%self.param: ref %Noncopyable) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc17_3.4(%self.param: ref %tuple.type.71d) { +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc27_3.4(%self.param: ref %tuple.type.71d) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2] // CHECK:STDOUT: %tuple.elem2: ref %i32 = tuple_access %self.param, element2 -// CHECK:STDOUT: %Destroy.facet.loc17_3.1: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc17_3.1: %Destroy.type = converted constants.%i32, %Destroy.facet.loc17_3.1 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc17_3.2: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc17_3.2: %Destroy.type = converted constants.%i32, %Destroy.facet.loc17_3.2 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc27_3.1: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc27_3.1: %Destroy.type = converted constants.%i32, %Destroy.facet.loc27_3.1 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc27_3.2: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc27_3.2: %Destroy.type = converted constants.%i32, %Destroy.facet.loc27_3.2 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: %SelfDestruct.specific_fn.1: = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet.c2b) [concrete = constants.%SelfDestruct.specific_fn.845] -// CHECK:STDOUT: %SelfDestruct.call.loc17_3.1: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%tuple.elem2) +// CHECK:STDOUT: %SelfDestruct.call.loc27_3.1: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%tuple.elem2) // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] // CHECK:STDOUT: %tuple.elem1: ref %Noncopyable = tuple_access %self.param, element1 -// CHECK:STDOUT: %Destroy.facet.loc17_3.3: %Destroy.type = facet_value constants.%Noncopyable, (constants.%DestroyImpl.impl_witness.59b, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.6f5] -// CHECK:STDOUT: %.loc17_3.3: %Destroy.type = converted constants.%Noncopyable, %Destroy.facet.loc17_3.3 [concrete = constants.%Destroy.facet.6f5] -// CHECK:STDOUT: %Destroy.facet.loc17_3.4: %Destroy.type = facet_value constants.%Noncopyable, (constants.%DestroyImpl.impl_witness.59b, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.6f5] -// CHECK:STDOUT: %.loc17_3.4: %Destroy.type = converted constants.%Noncopyable, %Destroy.facet.loc17_3.4 [concrete = constants.%Destroy.facet.6f5] +// CHECK:STDOUT: %Destroy.facet.loc27_3.3: %Destroy.type = facet_value constants.%Noncopyable, (constants.%DestroyImpl.impl_witness.59b, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.6f5] +// CHECK:STDOUT: %.loc27_3.3: %Destroy.type = converted constants.%Noncopyable, %Destroy.facet.loc27_3.3 [concrete = constants.%Destroy.facet.6f5] +// CHECK:STDOUT: %Destroy.facet.loc27_3.4: %Destroy.type = facet_value constants.%Noncopyable, (constants.%DestroyImpl.impl_witness.59b, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.6f5] +// CHECK:STDOUT: %.loc27_3.4: %Destroy.type = converted constants.%Noncopyable, %Destroy.facet.loc27_3.4 [concrete = constants.%Destroy.facet.6f5] // CHECK:STDOUT: %SelfDestruct.specific_fn.2: = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet.6f5) [concrete = constants.%SelfDestruct.specific_fn.20b] -// CHECK:STDOUT: %SelfDestruct.call.loc17_3.2: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%tuple.elem1) +// CHECK:STDOUT: %SelfDestruct.call.loc27_3.2: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%tuple.elem1) // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] // CHECK:STDOUT: %tuple.elem0: ref %i32 = tuple_access %self.param, element0 -// CHECK:STDOUT: %Destroy.facet.loc17_3.5: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc17_3.5: %Destroy.type = converted constants.%i32, %Destroy.facet.loc17_3.5 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc17_3.6: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc17_3.6: %Destroy.type = converted constants.%i32, %Destroy.facet.loc17_3.6 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc27_3.5: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc27_3.5: %Destroy.type = converted constants.%i32, %Destroy.facet.loc27_3.5 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc27_3.6: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc27_3.6: %Destroy.type = converted constants.%i32, %Destroy.facet.loc27_3.6 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: %SelfDestruct.specific_fn.3: = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet.c2b) [concrete = constants.%SelfDestruct.specific_fn.845] -// CHECK:STDOUT: %SelfDestruct.call.loc17_3.3: init %empty_tuple.type = call %SelfDestruct.specific_fn.3(%tuple.elem0) +// CHECK:STDOUT: %SelfDestruct.call.loc27_3.3: init %empty_tuple.type = call %SelfDestruct.specific_fn.3(%tuple.elem0) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc17_3.5(%self.param: ref %AdaptNoncopyableIndirect) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc27_3.5(%self.param: ref %AdaptNoncopyableIndirect) = "no_op"; // CHECK:STDOUT: // CHECK:STDOUT: --- adapt_copyable_struct.carbon // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/adapter/convert_incomplete.carbon b/toolchain/check/testdata/class/adapter/convert_incomplete.carbon index 37172bc2bbb2..d4a9e181a05b 100644 --- a/toolchain/check/testdata/class/adapter/convert_incomplete.carbon +++ b/toolchain/check/testdata/class/adapter/convert_incomplete.carbon @@ -52,8 +52,16 @@ class Adapter(T: type); class X {} fn F(p: Adapter(X)*) { - // CHECK:STDERR: fail_incomplete.carbon:[[@LINE+3]]:22-29: error: cannot convert expression of type `Adapter(X)` to `X*` with `as` [ConversionFailure] - // CHECK:STDERR: fail_incomplete.carbon:[[@LINE+2]]:22-29: note: type `Adapter(X)` does not implement interface `Core.As(X*)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_incomplete.carbon:[[@LINE+11]]:22 + // CHECK:STDERR: -> │ let unused x: X* = *p as X*; + // CHECK:STDERR: · ┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `Adapter(X)` + // CHECK:STDERR: · │ ┃ to `X*` with `as` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Adapter(X)` does not implement interface + // CHECK:STDERR: · │ `Core.As(X*)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused x: X* = *p as X*; } diff --git a/toolchain/check/testdata/class/adapter/extend_adapt.carbon b/toolchain/check/testdata/class/adapter/extend_adapt.carbon index d4096c2dcc85..d34874f66d22 100644 --- a/toolchain/check/testdata/class/adapter/extend_adapt.carbon +++ b/toolchain/check/testdata/class/adapter/extend_adapt.carbon @@ -52,9 +52,20 @@ class SomeClassAdapter { } fn F(a: SomeClassAdapter) { - // CHECK:STDERR: fail_todo_method_access.carbon:[[@LINE+4]]:3: error: cannot implicitly convert expression of type `SomeClassAdapter` to `SomeClass` [ConversionFailure] - // CHECK:STDERR: fail_todo_method_access.carbon:[[@LINE+3]]:3: note: type `SomeClassAdapter` does not implement interface `Core.ImplicitAs(SomeClass)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: fail_todo_method_access.carbon:[[@LINE-10]]:8-11: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_todo_method_access.carbon:[[@LINE+15]]:3 + // CHECK:STDERR: │ fn F(self); + // CHECK:STDERR: · ──┬─ + // CHECK:STDERR: · ╰──┤ initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ a.F(); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `SomeClassAdapter` to + // CHECK:STDERR: · │ ┃ `SomeClass` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `SomeClassAdapter` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(SomeClass)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: a.F(); } @@ -73,8 +84,16 @@ class SomeClassAdapter { } fn F(a: SomeClassAdapter) -> i32 { - // CHECK:STDERR: fail_todo_field_access.carbon:[[@LINE+3]]:10-12: error: cannot implicitly convert expression of type `SomeClassAdapter` to `SomeClass` [ConversionFailure] - // CHECK:STDERR: fail_todo_field_access.carbon:[[@LINE+2]]:10-12: note: type `SomeClassAdapter` does not implement interface `Core.ImplicitAs(SomeClass)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_todo_field_access.carbon:[[@LINE+11]]:10 + // CHECK:STDERR: -> │ return a.b; + // CHECK:STDERR: · ┳━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type + // CHECK:STDERR: · │ ┃ `SomeClassAdapter` to `SomeClass` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `SomeClassAdapter` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(SomeClass)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return a.b; } @@ -89,7 +108,12 @@ class StructAdapter { fn F(a: StructAdapter) -> i32 { // TODO: This should be allowed. - // CHECK:STDERR: fail_todo_adapt_struct.carbon:[[@LINE+2]]:10-12: error: member name `b` not found in `StructAdapter` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╭─┤ fail_todo_adapt_struct.carbon:[[@LINE+7]]:10 + // CHECK:STDERR: -> │ return a.b; + // CHECK:STDERR: · ━┳━ + // CHECK:STDERR: · ┗━━┫ error: member name `b` not found in `StructAdapter` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return a.b; } @@ -104,7 +128,13 @@ class TupleAdapter { fn F(a: TupleAdapter) -> i32 { // TODO: This should be allowed. - // CHECK:STDERR: fail_todo_adapt_tuple.carbon:[[@LINE+2]]:10-12: error: type `TupleAdapter` does not support tuple indexing; only tuples can be indexed that way [TupleIndexOnANonTupleType] + // CHECK:STDERR: ╭─┤ fail_todo_adapt_tuple.carbon:[[@LINE+8]]:10 + // CHECK:STDERR: -> │ return a.1; + // CHECK:STDERR: · ┳━━ + // CHECK:STDERR: · ┗━━┫ error: type `TupleAdapter` does not support tuple indexing; only + // CHECK:STDERR: · ┃ tuples can be indexed that way + // CHECK:STDERR: · ┃ [TupleIndexOnANonTupleType] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return a.1; } @@ -121,7 +151,12 @@ class IntAdapter { fn F(a: IntAdapter) -> i32 { // Builtin types have no member names. - // CHECK:STDERR: fail_adapt_builtin.carbon:[[@LINE+2]]:10-14: error: member name `foo` not found in `IntAdapter` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╭─┤ fail_adapt_builtin.carbon:[[@LINE+7]]:10 + // CHECK:STDERR: -> │ return a.foo; + // CHECK:STDERR: · ━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: member name `foo` not found in `IntAdapter` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return a.foo; } @@ -346,7 +381,7 @@ fn F(a: IntAdapter) -> i32 { // CHECK:STDOUT: %a.ref: %SomeClassAdapter = name_ref a, %a // CHECK:STDOUT: %F.ref: %SomeClass.F.type = name_ref F, @SomeClass.%SomeClass.F.decl [concrete = constants.%SomeClass.F] // CHECK:STDOUT: %SomeClass.F.bound: = bound_method %a.ref, %F.ref -// CHECK:STDOUT: %.loc17: %SomeClass = converted %a.ref, [concrete = ] +// CHECK:STDOUT: %.loc28: %SomeClass = converted %a.ref, [concrete = ] // CHECK:STDOUT: %SomeClass.F.call: init %empty_tuple.type = call %SomeClass.F.bound() // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -447,8 +482,8 @@ fn F(a: IntAdapter) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: %SomeClassAdapter = name_ref a, %a // CHECK:STDOUT: %b.ref: %SomeClass.elem = name_ref b, @SomeClass.%field_decl.loc6 [concrete = @SomeClass.%field_decl.loc6] -// CHECK:STDOUT: %.loc17_11.1: %SomeClass = converted %a.ref, [concrete = ] -// CHECK:STDOUT: %.loc17_11.2: %i32 = class_element_access , element1 [concrete = ] +// CHECK:STDOUT: %.loc25_11.1: %SomeClass = converted %a.ref, [concrete = ] +// CHECK:STDOUT: %.loc25_11.2: %i32 = class_element_access , element1 [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/adapter/fail_adapt_bad_decl.carbon b/toolchain/check/testdata/class/adapter/fail_adapt_bad_decl.carbon index 9f19890d2a9a..13f57c201427 100644 --- a/toolchain/check/testdata/class/adapter/fail_adapt_bad_decl.carbon +++ b/toolchain/check/testdata/class/adapter/fail_adapt_bad_decl.carbon @@ -15,13 +15,26 @@ library "[[@TEST_NAME]]"; class Bad { - // CHECK:STDERR: fail_not_type.carbon:[[@LINE+3]]:3-12: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet] - // CHECK:STDERR: fail_not_type.carbon:[[@LINE+2]]:3-12: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_not_type.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: -> │ adapt 100; + // CHECK:STDERR: · ┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert non-type value of type `Core.IntLiteral` + // CHECK:STDERR: · │ ┃ to `type` + // CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: · ╰────┤ type `Core.IntLiteral` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(type)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: adapt 100; } -// CHECK:STDERR: fail_not_type.carbon:[[@LINE+2]]:18-20: error: member name `F` not found in `Bad` [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╭─┤ fail_not_type.carbon:[[@LINE+7]]:18 +// CHECK:STDERR: -> │ fn Use(b: Bad) { b.F(); } +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┗━━┫ error: member name `F` not found in `Bad` +// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Use(b: Bad) { b.F(); } @@ -30,8 +43,16 @@ fn Use(b: Bad) { b.F(); } library "[[@TEST_NAME]]"; class Bad { - // CHECK:STDERR: fail_extend_not_type.carbon:[[@LINE+3]]:3-19: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet] - // CHECK:STDERR: fail_extend_not_type.carbon:[[@LINE+2]]:3-19: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_extend_not_type.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: -> │ extend adapt 100; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert non-type value of type `Core.IntLiteral` + // CHECK:STDERR: · │ ┃ to `type` + // CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: · ╰────┤ type `Core.IntLiteral` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(type)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend adapt 100; } @@ -45,16 +66,30 @@ library "[[@TEST_NAME]]"; class MultipleAdapts { adapt (); - // CHECK:STDERR: fail_repeated.carbon:[[@LINE+3]]:3-11: error: multiple `adapt` declarations in class [AdaptDeclRepeated] - // CHECK:STDERR: fail_repeated.carbon:[[@LINE-2]]:3-11: note: previous `adapt` declaration is here [ClassSpecificDeclPrevious] + // CHECK:STDERR: ╭─┤ fail_repeated.carbon:[[@LINE+10]]:3 + // CHECK:STDERR: │ adapt (); + // CHECK:STDERR: · ────┬──── + // CHECK:STDERR: · ╰──┤ previous `adapt` declaration is here [ClassSpecificDeclPrevious] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ adapt {}; + // CHECK:STDERR: · ━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: multiple `adapt` declarations in class [AdaptDeclRepeated] + // CHECK:STDERR: ╰──── // CHECK:STDERR: adapt {}; } class MultipleAdaptsSameType { adapt (); - // CHECK:STDERR: fail_repeated.carbon:[[@LINE+3]]:3-11: error: multiple `adapt` declarations in class [AdaptDeclRepeated] - // CHECK:STDERR: fail_repeated.carbon:[[@LINE-2]]:3-11: note: previous `adapt` declaration is here [ClassSpecificDeclPrevious] + // CHECK:STDERR: ╭─┤ fail_repeated.carbon:[[@LINE+10]]:3 + // CHECK:STDERR: │ adapt (); + // CHECK:STDERR: · ────┬──── + // CHECK:STDERR: · ╰──┤ previous `adapt` declaration is here [ClassSpecificDeclPrevious] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ adapt (); + // CHECK:STDERR: · ━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: multiple `adapt` declarations in class [AdaptDeclRepeated] + // CHECK:STDERR: ╰──── // CHECK:STDERR: adapt (); } @@ -63,19 +98,34 @@ class MultipleAdaptsSameType { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_scope.carbon:[[@LINE+2]]:1-9: error: `adapt` declaration outside class [ClassSpecificDeclOutsideClass] +// CHECK:STDERR: ╭─┤ fail_bad_scope.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ adapt {}; +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: `adapt` declaration outside class +// CHECK:STDERR: · ┃ [ClassSpecificDeclOutsideClass] +// CHECK:STDERR: ╰──── // CHECK:STDERR: adapt {}; interface I { - // CHECK:STDERR: fail_bad_scope.carbon:[[@LINE+2]]:3-11: error: `adapt` declaration outside class [ClassSpecificDeclOutsideClass] + // CHECK:STDERR: ╭─┤ fail_bad_scope.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ adapt {}; + // CHECK:STDERR: · ━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: `adapt` declaration outside class + // CHECK:STDERR: · ┃ [ClassSpecificDeclOutsideClass] + // CHECK:STDERR: ╰──── // CHECK:STDERR: adapt {}; } class C { interface I { - // CHECK:STDERR: fail_bad_scope.carbon:[[@LINE+2]]:5-13: error: `adapt` declaration outside class [ClassSpecificDeclOutsideClass] + // CHECK:STDERR: ╭─┤ fail_bad_scope.carbon:[[@LINE+7]]:5 + // CHECK:STDERR: -> │ adapt {}; + // CHECK:STDERR: · ━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: `adapt` declaration outside class + // CHECK:STDERR: · ┃ [ClassSpecificDeclOutsideClass] + // CHECK:STDERR: ╰──── // CHECK:STDERR: adapt {}; } diff --git a/toolchain/check/testdata/class/adapter/fail_adapt_bad_type.carbon b/toolchain/check/testdata/class/adapter/fail_adapt_bad_type.carbon index bfa150b43d6e..061df1e6b9b2 100644 --- a/toolchain/check/testdata/class/adapter/fail_adapt_bad_type.carbon +++ b/toolchain/check/testdata/class/adapter/fail_adapt_bad_type.carbon @@ -17,8 +17,16 @@ library "[[@TEST_NAME]]"; class Incomplete; class AdaptIncomplete { - // CHECK:STDERR: fail_incomplete_type.carbon:[[@LINE+3]]:3-19: error: adapted type `Incomplete` is an incomplete type [IncompleteTypeInAdaptDecl] - // CHECK:STDERR: fail_incomplete_type.carbon:[[@LINE-4]]:1-17: note: class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ╭─┤ fail_incomplete_type.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ class Incomplete; + // CHECK:STDERR: · ────────┬──────── + // CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ adapt Incomplete; + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: adapted type `Incomplete` is an incomplete type + // CHECK:STDERR: · ┃ [IncompleteTypeInAdaptDecl] + // CHECK:STDERR: ╰──── // CHECK:STDERR: adapt Incomplete; } diff --git a/toolchain/check/testdata/class/adapter/fail_adapt_modifiers.carbon b/toolchain/check/testdata/class/adapter/fail_adapt_modifiers.carbon index 4889ca89c1d2..957a79581d85 100644 --- a/toolchain/check/testdata/class/adapter/fail_adapt_modifiers.carbon +++ b/toolchain/check/testdata/class/adapter/fail_adapt_modifiers.carbon @@ -13,38 +13,67 @@ class B {} class C1 { - // CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+2]]:3-9: error: `private` not allowed on `adapt` declaration [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╭─┤ fail_adapt_modifiers.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ private adapt B; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: `private` not allowed on `adapt` declaration + // CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: private adapt B; } class C2 { - // CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+2]]:3-10: error: `abstract` not allowed on `adapt` declaration [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╭─┤ fail_adapt_modifiers.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ abstract adapt B; + // CHECK:STDERR: · ━━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: `abstract` not allowed on `adapt` declaration + // CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: abstract adapt B; } class C3 { - // CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+2]]:3-9: error: `default` not allowed on `adapt` declaration [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╭─┤ fail_adapt_modifiers.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ default adapt B; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: `default` not allowed on `adapt` declaration + // CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: default adapt B; } class C4 { - // CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+3]]:10-15: error: `extend` repeated on declaration [ModifierRepeated] - // CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+2]]:3-8: note: `extend` previously appeared here [ModifierPrevious] + // CHECK:STDERR: ╭─┤ fail_adapt_modifiers.carbon:[[@LINE+7]]:10 + // CHECK:STDERR: -> │ extend extend adapt B; + // CHECK:STDERR: · ───┬── ━━━┳━━ + // CHECK:STDERR: · │ ┗━━┫ error: `extend` repeated on declaration [ModifierRepeated] + // CHECK:STDERR: · ╰───────────┤ `extend` previously appeared here [ModifierPrevious] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend extend adapt B; } class C5 { - // CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+2]]:3-6: error: `base` not allowed on `adapt` declaration [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╭─┤ fail_adapt_modifiers.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ base adapt B; + // CHECK:STDERR: · ━━┳━ + // CHECK:STDERR: · ┗━━┫ error: `base` not allowed on `adapt` declaration + // CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: base adapt B; } class C6 { - // CHECK:STDERR: fail_adapt_modifiers.carbon:[[@LINE+2]]:10-13: error: `base` not allowed on `adapt` declaration [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╭─┤ fail_adapt_modifiers.carbon:[[@LINE+7]]:10 + // CHECK:STDERR: -> │ extend base adapt B; + // CHECK:STDERR: · ━━┳━ + // CHECK:STDERR: · ┗━━┫ error: `base` not allowed on `adapt` declaration + // CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend base adapt B; } diff --git a/toolchain/check/testdata/class/adapter/fail_adapt_with_base.carbon b/toolchain/check/testdata/class/adapter/fail_adapt_with_base.carbon index 670339e8921b..6131861ce7f0 100644 --- a/toolchain/check/testdata/class/adapter/fail_adapt_with_base.carbon +++ b/toolchain/check/testdata/class/adapter/fail_adapt_with_base.carbon @@ -12,8 +12,16 @@ class Simple {}; base class AdaptWithVirtual { virtual fn F(self); - // CHECK:STDERR: fail_adapt_with_base.carbon:[[@LINE+3]]:3-15: error: adapter with virtual function [AdaptWithVirtual] - // CHECK:STDERR: fail_adapt_with_base.carbon:[[@LINE-2]]:3-21: note: first virtual function declaration is here [AdaptWithVirtualHere] + // CHECK:STDERR: ╭─┤ fail_adapt_with_base.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ virtual fn F(self); + // CHECK:STDERR: · ─────────┬───────── + // CHECK:STDERR: · ╰──┤ first virtual function declaration is here + // CHECK:STDERR: · │ [AdaptWithVirtualHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ adapt Simple; + // CHECK:STDERR: · ━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: adapter with virtual function [AdaptWithVirtual] + // CHECK:STDERR: ╰──── // CHECK:STDERR: adapt Simple; } diff --git a/toolchain/check/testdata/class/adapter/fail_adapt_with_subobjects.carbon b/toolchain/check/testdata/class/adapter/fail_adapt_with_subobjects.carbon index 807d3b34c71e..214491c5cfc5 100644 --- a/toolchain/check/testdata/class/adapter/fail_adapt_with_subobjects.carbon +++ b/toolchain/check/testdata/class/adapter/fail_adapt_with_subobjects.carbon @@ -19,10 +19,16 @@ library "[[@TEST_NAME]]"; base class Base {} class AdaptWithBase { - // CHECK:STDERR: fail_adapt_with_base.carbon:[[@LINE+1]]:3-12: error: adapter with base class [AdaptWithBase] - adapt i32; - // CHECK:STDERR: fail_adapt_with_base.carbon:[[@LINE+2]]:3-20: note: `base` declaration is here [AdaptWithBaseHere] + // CHECK:STDERR: ╭─┤ fail_adapt_with_base.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ adapt i32; + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: adapter with base class [AdaptWithBase] + // CHECK:STDERR: │ extend base: Base; + // CHECK:STDERR: · ─────────┬──────── + // CHECK:STDERR: · ╰──┤ `base` declaration is here [AdaptWithBaseHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: + adapt i32; extend base: Base; } @@ -31,18 +37,30 @@ class AdaptWithBase { library "[[@TEST_NAME]]"; class AdaptWithField { - // CHECK:STDERR: fail_adapt_with_fields.carbon:[[@LINE+1]]:3-12: error: adapter with fields [AdaptWithFields] - adapt i32; - // CHECK:STDERR: fail_adapt_with_fields.carbon:[[@LINE+2]]:7-12: note: first field declaration is here [AdaptWithFieldHere] + // CHECK:STDERR: ╭─┤ fail_adapt_with_fields.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ adapt i32; + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: adapter with fields [AdaptWithFields] + // CHECK:STDERR: │ var n: i32; + // CHECK:STDERR: · ───┬── + // CHECK:STDERR: · ╰──┤ first field declaration is here [AdaptWithFieldHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: + adapt i32; var n: i32; } class AdaptWithFields { - // CHECK:STDERR: fail_adapt_with_fields.carbon:[[@LINE+1]]:3-12: error: adapter with fields [AdaptWithFields] - adapt i32; - // CHECK:STDERR: fail_adapt_with_fields.carbon:[[@LINE+2]]:7-12: note: first field declaration is here [AdaptWithFieldHere] + // CHECK:STDERR: ╭─┤ fail_adapt_with_fields.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ adapt i32; + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: adapter with fields [AdaptWithFields] + // CHECK:STDERR: │ var a: i32; + // CHECK:STDERR: · ───┬── + // CHECK:STDERR: · ╰──┤ first field declaration is here [AdaptWithFieldHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: + adapt i32; var a: i32; var b: i32; var c: i32; @@ -57,8 +75,15 @@ base class Base {} class AdaptWithBaseAndFields { extend base: Base; var n: i32; - // CHECK:STDERR: fail_adapt_with_base_and_fields.carbon:[[@LINE+3]]:3-11: error: adapter with base class [AdaptWithBase] - // CHECK:STDERR: fail_adapt_with_base_and_fields.carbon:[[@LINE-3]]:3-20: note: `base` declaration is here [AdaptWithBaseHere] + // CHECK:STDERR: ╭─┤ fail_adapt_with_base_and_fields.carbon:[[@LINE+10]]:3 + // CHECK:STDERR: │ extend base: Base; + // CHECK:STDERR: · ─────────┬──────── + // CHECK:STDERR: · ╰──┤ `base` declaration is here [AdaptWithBaseHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ adapt {}; + // CHECK:STDERR: · ━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: adapter with base class [AdaptWithBase] + // CHECK:STDERR: ╰──── // CHECK:STDERR: adapt {}; } @@ -110,13 +135,13 @@ class AdaptWithBaseAndFields { // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: adapt_decl %i32 [concrete] // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [concrete = constants.%Base] -// CHECK:STDOUT: %.loc11: %AdaptWithBase.elem = base_decl %Base.ref, element [concrete] +// CHECK:STDOUT: %.loc17: %AdaptWithBase.elem = base_decl %Base.ref, element [concrete] // CHECK:STDOUT: complete_type_witness = // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%AdaptWithBase // CHECK:STDOUT: .Base = -// CHECK:STDOUT: .base = %.loc11 +// CHECK:STDOUT: .base = %.loc17 // CHECK:STDOUT: extend %Base.ref // CHECK:STDOUT: } // CHECK:STDOUT: @@ -155,10 +180,10 @@ class AdaptWithBaseAndFields { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @AdaptWithField { -// CHECK:STDOUT: %i32.loc6: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: adapt_decl %i32.loc6 [concrete] -// CHECK:STDOUT: %field_decl: %AdaptWithField.elem = field_decl n, element, %i32.loc9 in [concrete] { -// CHECK:STDOUT: %i32.loc9: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc14: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: adapt_decl %i32.loc14 [concrete] +// CHECK:STDOUT: %field_decl: %AdaptWithField.elem = field_decl n, element, %i32.loc15 in [concrete] { +// CHECK:STDOUT: %i32.loc15: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: } // CHECK:STDOUT: complete_type_witness = // CHECK:STDOUT: @@ -168,24 +193,24 @@ class AdaptWithBaseAndFields { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @AdaptWithFields { -// CHECK:STDOUT: %i32.loc14: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: adapt_decl %i32.loc14 [concrete] -// CHECK:STDOUT: %field_decl.loc17: %AdaptWithFields.elem = field_decl a, element, %i32.loc17 in [concrete] { -// CHECK:STDOUT: %i32.loc17: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc28: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: adapt_decl %i32.loc28 [concrete] +// CHECK:STDOUT: %field_decl.loc29: %AdaptWithFields.elem = field_decl a, element, %i32.loc29 in [concrete] { +// CHECK:STDOUT: %i32.loc29: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: } -// CHECK:STDOUT: %field_decl.loc18: %AdaptWithFields.elem = field_decl b, element, %i32.loc18 in [concrete] { -// CHECK:STDOUT: %i32.loc18: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %field_decl.loc30: %AdaptWithFields.elem = field_decl b, element, %i32.loc30 in [concrete] { +// CHECK:STDOUT: %i32.loc30: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: } -// CHECK:STDOUT: %field_decl.loc19: %AdaptWithFields.elem = field_decl c, element, %i32.loc19 in [concrete] { -// CHECK:STDOUT: %i32.loc19: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %field_decl.loc31: %AdaptWithFields.elem = field_decl c, element, %i32.loc31 in [concrete] { +// CHECK:STDOUT: %i32.loc31: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: } // CHECK:STDOUT: complete_type_witness = // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%AdaptWithFields -// CHECK:STDOUT: .a = %field_decl.loc17 -// CHECK:STDOUT: .b = %field_decl.loc18 -// CHECK:STDOUT: .c = %field_decl.loc19 +// CHECK:STDOUT: .a = %field_decl.loc29 +// CHECK:STDOUT: .b = %field_decl.loc30 +// CHECK:STDOUT: .c = %field_decl.loc31 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_adapt_with_base_and_fields.carbon @@ -239,9 +264,9 @@ class AdaptWithBaseAndFields { // CHECK:STDOUT: %field_decl: %AdaptWithBaseAndFields.elem.a86 = field_decl n, element, %i32 in [concrete] { // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc12_10: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc12_11: type = converted %.loc12_10, constants.%empty_struct_type [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: adapt_decl %.loc12_11 [concrete] +// CHECK:STDOUT: %.loc19_10: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc19_11: type = converted %.loc19_10, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: adapt_decl %.loc19_11 [concrete] // CHECK:STDOUT: complete_type_witness = // CHECK:STDOUT: // CHECK:STDOUT: !members: diff --git a/toolchain/check/testdata/class/adapter/init_adapt.carbon b/toolchain/check/testdata/class/adapter/init_adapt.carbon index b5c2bcbcf6d9..905b8edbbac6 100644 --- a/toolchain/check/testdata/class/adapter/init_adapt.carbon +++ b/toolchain/check/testdata/class/adapter/init_adapt.carbon @@ -56,13 +56,29 @@ let a: C = {.a = 1, .b = 2}; // Cannot implicitly convert between a type and an adapter for the type. -// CHECK:STDERR: fail_not_implicit.carbon:[[@LINE+3]]:17: error: cannot implicitly convert expression of type `C` to `AdaptC` [ConversionFailure] -// CHECK:STDERR: fail_not_implicit.carbon:[[@LINE+2]]:17: note: type `C` does not implement interface `Core.ImplicitAs(AdaptC)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_not_implicit.carbon:[[@LINE+11]]:17 +// CHECK:STDERR: -> │ let b: AdaptC = a; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `C` to +// CHECK:STDERR: · │ ┃ `AdaptC` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╰────┤ type `C` does not implement interface +// CHECK:STDERR: · │ `Core.ImplicitAs(AdaptC)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let b: AdaptC = a; -// CHECK:STDERR: fail_not_implicit.carbon:[[@LINE+3]]:12: error: cannot implicitly convert expression of type `AdaptC` to `C` [ConversionFailure] -// CHECK:STDERR: fail_not_implicit.carbon:[[@LINE+2]]:12: note: type `AdaptC` does not implement interface `Core.ImplicitAs(C)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_not_implicit.carbon:[[@LINE+11]]:12 +// CHECK:STDERR: -> │ let c: C = b; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `AdaptC` to +// CHECK:STDERR: · │ ┃ `C` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╰────┤ type `AdaptC` does not implement interface +// CHECK:STDERR: · │ `Core.ImplicitAs(C)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let c: C = b; @@ -70,13 +86,25 @@ fn MakeC() -> C; fn MakeAdaptC() -> AdaptC; -// CHECK:STDERR: fail_not_implicit.carbon:[[@LINE+3]]:1-13: error: cannot implicitly convert expression of type `C` to `AdaptC` [ConversionFailure] -// CHECK:STDERR: fail_not_implicit.carbon:[[@LINE+2]]:1-13: note: type `C` does not implement interface `Core.ImplicitAs(AdaptC)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_not_implicit.carbon:[[@LINE+9]]:1 +// CHECK:STDERR: -> │ var d: AdaptC = MakeC(); +// CHECK:STDERR: · ━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `C` to `AdaptC` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╰────┤ type `C` does not implement interface `Core.ImplicitAs(AdaptC)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var d: AdaptC = MakeC(); -// CHECK:STDERR: fail_not_implicit.carbon:[[@LINE+3]]:1-8: error: cannot implicitly convert expression of type `AdaptC` to `C` [ConversionFailure] -// CHECK:STDERR: fail_not_implicit.carbon:[[@LINE+2]]:1-8: note: type `AdaptC` does not implement interface `Core.ImplicitAs(C)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_not_implicit.carbon:[[@LINE+9]]:1 +// CHECK:STDERR: -> │ var e: C = MakeAdaptC(); +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `AdaptC` to `C` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╰────┤ type `AdaptC` does not implement interface `Core.ImplicitAs(C)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var e: C = MakeAdaptC(); @@ -413,14 +441,14 @@ var e: C = MakeAdaptC(); // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %a.patt: %pattern_type.98b = value_binding_pattern a [concrete = constants.%a.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc20: %AdaptC = converted @__global_init.%a.ref, [concrete = ] -// CHECK:STDOUT: %AdaptC.ref.loc20: type = name_ref AdaptC, %AdaptC.decl [concrete = constants.%AdaptC] +// CHECK:STDOUT: %.loc28: %AdaptC = converted @__global_init.%a.ref, [concrete = ] +// CHECK:STDOUT: %AdaptC.ref.loc28: type = name_ref AdaptC, %AdaptC.decl [concrete = constants.%AdaptC] // CHECK:STDOUT: %b: %AdaptC = wrapper_binding b, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %b.patt: %pattern_type.720 = value_binding_pattern b [concrete = constants.%b.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc25: %C = converted @__global_init.%b.ref, [concrete = ] -// CHECK:STDOUT: %C.ref.loc25: type = name_ref C, %C.decl [concrete = constants.%C] +// CHECK:STDOUT: %.loc41: %C = converted @__global_init.%b.ref, [concrete = ] +// CHECK:STDOUT: %C.ref.loc41: type = name_ref C, %C.decl [concrete = constants.%C] // CHECK:STDOUT: %c: %C = wrapper_binding c, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %c.patt: %pattern_type.98b = value_binding_pattern c [concrete = constants.%c.patt] @@ -430,7 +458,7 @@ var e: C = MakeAdaptC(); // CHECK:STDOUT: %return.patt: %pattern_type.98b = return_slot_pattern %return.param_patt, %C.ref [concrete = constants.%return.patt.e4a] // CHECK:STDOUT: } { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %.loc27: Core.Form = init_form %C.ref [concrete = constants.%.a44] +// CHECK:STDOUT: %.loc43: Core.Form = init_form %C.ref [concrete = constants.%.a44] // CHECK:STDOUT: %return.param: ref %C = out_param call_param0 // CHECK:STDOUT: %return: ref %C = return_slot %return.param // CHECK:STDOUT: } @@ -439,19 +467,19 @@ var e: C = MakeAdaptC(); // CHECK:STDOUT: %return.patt: %pattern_type.720 = return_slot_pattern %return.param_patt, %AdaptC.ref [concrete = constants.%return.patt.794] // CHECK:STDOUT: } { // CHECK:STDOUT: %AdaptC.ref: type = name_ref AdaptC, file.%AdaptC.decl [concrete = constants.%AdaptC] -// CHECK:STDOUT: %.loc29: Core.Form = init_form %AdaptC.ref [concrete = constants.%.624] +// CHECK:STDOUT: %.loc45: Core.Form = init_form %AdaptC.ref [concrete = constants.%.624] // CHECK:STDOUT: %return.param: ref %AdaptC = out_param call_param0 // CHECK:STDOUT: %return: ref %AdaptC = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: %d.var: ref %AdaptC = var_storage %d.var_patt [concrete] -// CHECK:STDOUT: %AdaptC.ref.loc34: type = name_ref AdaptC, %AdaptC.decl [concrete = constants.%AdaptC] +// CHECK:STDOUT: %AdaptC.ref.loc56: type = name_ref AdaptC, %AdaptC.decl [concrete = constants.%AdaptC] // CHECK:STDOUT: %d: ref %AdaptC = wrapper_binding d, %d.var [concrete = %d.var] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %d.patt: %pattern_type.720 = ref_binding_pattern d [concrete = constants.%d.patt] // CHECK:STDOUT: %d.var_patt: %pattern_type.720 = var_pattern %d.patt [concrete = constants.%d.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %e.var: ref %C = var_storage %e.var_patt [concrete] -// CHECK:STDOUT: %C.ref.loc39: type = name_ref C, %C.decl [concrete = constants.%C] +// CHECK:STDOUT: %C.ref.loc67: type = name_ref C, %C.decl [concrete = constants.%C] // CHECK:STDOUT: %e: ref %C = wrapper_binding e, %e.var [concrete = %e.var] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %e.patt: %pattern_type.98b = ref_binding_pattern e [concrete = constants.%e.patt] @@ -498,14 +526,14 @@ var e: C = MakeAdaptC(); // CHECK:STDOUT: %a.ref: %C = name_ref a, file.%a // CHECK:STDOUT: %b.ref: %AdaptC = name_ref b, file.%b [concrete = ] // CHECK:STDOUT: %MakeC.ref: %MakeC.type = name_ref MakeC, file.%MakeC.decl [concrete = constants.%MakeC] -// CHECK:STDOUT: %.loc34_23: ref %C = temporary_storage -// CHECK:STDOUT: %MakeC.call: init %C to %.loc34_23 = call %MakeC.ref() -// CHECK:STDOUT: %.loc34_1: %AdaptC = converted %MakeC.call, [concrete = ] +// CHECK:STDOUT: %.loc56_23: ref %C = temporary_storage +// CHECK:STDOUT: %MakeC.call: init %C to %.loc56_23 = call %MakeC.ref() +// CHECK:STDOUT: %.loc56_1: %AdaptC = converted %MakeC.call, [concrete = ] // CHECK:STDOUT: assign file.%d.var, // CHECK:STDOUT: %MakeAdaptC.ref: %MakeAdaptC.type = name_ref MakeAdaptC, file.%MakeAdaptC.decl [concrete = constants.%MakeAdaptC] -// CHECK:STDOUT: %.loc39_23: ref %AdaptC = temporary_storage -// CHECK:STDOUT: %MakeAdaptC.call: init %AdaptC to %.loc39_23 = call %MakeAdaptC.ref() -// CHECK:STDOUT: %.loc39_1: %C = converted %MakeAdaptC.call, [concrete = ] +// CHECK:STDOUT: %.loc67_23: ref %AdaptC = temporary_storage +// CHECK:STDOUT: %MakeAdaptC.call: init %AdaptC to %.loc67_23 = call %MakeAdaptC.ref() +// CHECK:STDOUT: %.loc67_1: %C = converted %MakeAdaptC.call, [concrete = ] // CHECK:STDOUT: assign file.%e.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/cross_package_import.carbon b/toolchain/check/testdata/class/cross_package_import.carbon index 8d49be292591..023fa8a5c309 100644 --- a/toolchain/check/testdata/class/cross_package_import.carbon +++ b/toolchain/check/testdata/class/cross_package_import.carbon @@ -52,9 +52,55 @@ library "[[@TEST_NAME]]"; import Other library "other_extern"; -// CHECK:STDERR: fail_extern.carbon:[[@LINE+4]]:8-14: error: binding pattern has incomplete type `C` in name binding declaration [IncompleteTypeInBindingDecl] -// CHECK:STDERR: imported from: fail_extern.carbon:[[@LINE-3]]:1 [InImport] -// CHECK:STDERR: other_extern.carbon:4:1-15: note: class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: ╭─┤ fail_extern.carbon:[[@LINE+50]]:8 +// CHECK:STDERR: -> │ var c: Other.C = {}; +// CHECK:STDERR: · ┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: binding pattern has incomplete type `C` in name binding +// CHECK:STDERR: · ┃ declaration +// CHECK:STDERR: · ┃ [IncompleteTypeInBindingDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: │ ╭── imported from: fail_extern.carbon [InImport] +// CHECK:STDERR: ├─┤ other_extern.carbon +// CHECK:STDERR: │ extern class C; +// CHECK:STDERR: · ───────┬─────── +// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: +// CHECK:STDERR: ╷ ╭── imported from: fail_todo_merge_define_extern.carbon [InImport] +// CHECK:STDERR: ├─┤ other_extern.carbon:4:1 +// CHECK:STDERR: -> │ extern class C; +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `C` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ other_define.carbon +// CHECK:STDERR: │ class C {} +// CHECK:STDERR: · ────┬──── +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ fail_todo_merge_define_extern.carbon +// CHECK:STDERR: │ var c: Other.C = {}; +// CHECK:STDERR: · ───┬─── +// CHECK:STDERR: · ╰──┤ in name lookup for `C` [InNameLookup] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: +// CHECK:STDERR: ╷ ╭── imported from: fail_conflict.carbon [InImport] +// CHECK:STDERR: ├─┤ other_conflict.carbon:4:1 +// CHECK:STDERR: -> │ fn C() {} +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `C` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ other_define.carbon +// CHECK:STDERR: │ class C {} +// CHECK:STDERR: · ────┬──── +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ fail_conflict.carbon +// CHECK:STDERR: │ var c: Other.C = {}; +// CHECK:STDERR: · ───┬─── +// CHECK:STDERR: · ╰──┤ in name lookup for `C` [InNameLookup] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var c: Other.C = {}; @@ -62,28 +108,18 @@ var c: Other.C = {}; library "[[@TEST_NAME]]"; -// CHECK:STDERR: imported from: fail_todo_merge_define_extern.carbon:[[@LINE+3]]:1 [InImport] -// CHECK:STDERR: other_extern.carbon:4:1-15: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: other_define.carbon:4:1-9: note: name is previously declared here [NameDeclPrevious] import Other library "other_define"; import Other library "other_extern"; -// CHECK:STDERR: fail_todo_merge_define_extern.carbon:[[@LINE+2]]:8-14: note: in name lookup for `C` [InNameLookup] -// CHECK:STDERR: var c: Other.C = {}; // --- fail_conflict.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: imported from: fail_conflict.carbon:[[@LINE+3]]:1 [InImport] -// CHECK:STDERR: other_conflict.carbon:4:1-8: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: other_define.carbon:4:1-9: note: name is previously declared here [NameDeclPrevious] import Other library "other_define"; import Other library "other_conflict"; -// CHECK:STDERR: fail_conflict.carbon:[[@LINE+2]]:8-14: note: in name lookup for `C` [InNameLookup] -// CHECK:STDERR: var c: Other.C = {}; // CHECK:STDOUT: --- other_define.carbon @@ -267,7 +303,7 @@ var c: Other.C = {}; // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %Other.import = import Other // CHECK:STDOUT: %c.var: ref = var_storage %c.var_patt [concrete = ] -// CHECK:STDOUT: %.loc10: type = splice_block %C.ref [concrete = constants.%C] { +// CHECK:STDOUT: %.loc56: type = splice_block %C.ref [concrete = constants.%C] { // CHECK:STDOUT: %Other.ref: = name_ref Other, imports.%Other [concrete = imports.%Other] // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Other.C [concrete = constants.%C] // CHECK:STDOUT: } @@ -282,7 +318,7 @@ var c: Other.C = {}; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc56: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] // CHECK:STDOUT: assign file.%c.var, // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -325,7 +361,7 @@ var c: Other.C = {}; // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %Other.import = import Other // CHECK:STDOUT: %c.var: ref %C = var_storage %c.var_patt [concrete] -// CHECK:STDOUT: %.loc12: type = splice_block %C.ref [concrete = constants.%C] { +// CHECK:STDOUT: %.loc7: type = splice_block %C.ref [concrete = constants.%C] { // CHECK:STDOUT: %Other.ref: = name_ref Other, imports.%Other [concrete = imports.%Other] // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Other.C [concrete = constants.%C] // CHECK:STDOUT: } @@ -345,10 +381,10 @@ var c: Other.C = {}; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc12_19.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc12_19.2: init %C to file.%c.var = class_init () [concrete = constants.%C.val] -// CHECK:STDOUT: %.loc12_1: init %C = converted %.loc12_19.1, %.loc12_19.2 [concrete = constants.%C.val] -// CHECK:STDOUT: assign file.%c.var, %.loc12_1 +// CHECK:STDOUT: %.loc7_19.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc7_19.2: init %C to file.%c.var = class_init () [concrete = constants.%C.val] +// CHECK:STDOUT: %.loc7_1: init %C = converted %.loc7_19.1, %.loc7_19.2 [concrete = constants.%C.val] +// CHECK:STDOUT: assign file.%c.var, %.loc7_1 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -390,7 +426,7 @@ var c: Other.C = {}; // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %Other.import = import Other // CHECK:STDOUT: %c.var: ref %C = var_storage %c.var_patt [concrete] -// CHECK:STDOUT: %.loc12: type = splice_block %C.ref [concrete = constants.%C] { +// CHECK:STDOUT: %.loc7: type = splice_block %C.ref [concrete = constants.%C] { // CHECK:STDOUT: %Other.ref: = name_ref Other, imports.%Other [concrete = imports.%Other] // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Other.C [concrete = constants.%C] // CHECK:STDOUT: } @@ -410,10 +446,10 @@ var c: Other.C = {}; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc12_19.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc12_19.2: init %C to file.%c.var = class_init () [concrete = constants.%C.val] -// CHECK:STDOUT: %.loc12_1: init %C = converted %.loc12_19.1, %.loc12_19.2 [concrete = constants.%C.val] -// CHECK:STDOUT: assign file.%c.var, %.loc12_1 +// CHECK:STDOUT: %.loc7_19.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc7_19.2: init %C to file.%c.var = class_init () [concrete = constants.%C.val] +// CHECK:STDOUT: %.loc7_1: init %C = converted %.loc7_19.1, %.loc7_19.2 [concrete = constants.%C.val] +// CHECK:STDOUT: assign file.%c.var, %.loc7_1 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/extern.carbon b/toolchain/check/testdata/class/extern.carbon index 39e7ca8d6f16..e77766e821af 100644 --- a/toolchain/check/testdata/class/extern.carbon +++ b/toolchain/check/testdata/class/extern.carbon @@ -49,8 +49,16 @@ class C {} library "[[@TEST_NAME]]"; extern class C; -// CHECK:STDERR: fail_decl_fn_in_extern.carbon:[[@LINE+3]]:4: error: cannot declare a member of incomplete class `C` [QualifiedDeclInIncompleteClassScope] -// CHECK:STDERR: fail_decl_fn_in_extern.carbon:[[@LINE-2]]:1-15: note: class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: ╭─┤ fail_decl_fn_in_extern.carbon:[[@LINE+11]]:4 +// CHECK:STDERR: │ extern class C; +// CHECK:STDERR: · ───────┬─────── +// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn C.F(); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: cannot declare a member of incomplete class `C` +// CHECK:STDERR: · ┃ [QualifiedDeclInIncompleteClassScope] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn C.F(); @@ -65,8 +73,15 @@ extern class C {} library "[[@TEST_NAME]]"; extern class C; -// CHECK:STDERR: fail_extern_decl_after_extern_decl.carbon:[[@LINE+3]]:1-15: error: redeclaration of `class C` is redundant [RedeclRedundant] -// CHECK:STDERR: fail_extern_decl_after_extern_decl.carbon:[[@LINE-2]]:1-15: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_extern_decl_after_extern_decl.carbon:[[@LINE+10]]:1 +// CHECK:STDERR: │ extern class C; +// CHECK:STDERR: · ───────┬─────── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ extern class C; +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of `class C` is redundant [RedeclRedundant] +// CHECK:STDERR: ╰──── // CHECK:STDERR: extern class C; @@ -75,8 +90,15 @@ extern class C; library "[[@TEST_NAME]]"; extern class C; -// CHECK:STDERR: fail_decl_after_extern_decl.carbon:[[@LINE+3]]:1-8: error: redeclaration of `class C` is redundant [RedeclRedundant] -// CHECK:STDERR: fail_decl_after_extern_decl.carbon:[[@LINE-2]]:1-15: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_decl_after_extern_decl.carbon:[[@LINE+10]]:1 +// CHECK:STDERR: │ extern class C; +// CHECK:STDERR: · ───────┬─────── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ class C; +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of `class C` is redundant [RedeclRedundant] +// CHECK:STDERR: ╰──── // CHECK:STDERR: class C; @@ -85,7 +107,12 @@ class C; library "[[@TEST_NAME]]"; class C { - // CHECK:STDERR: fail_extern_member_class.carbon:[[@LINE+2]]:3-8: error: `extern` not allowed; requires file or namespace scope [ModifierExternNotAllowed] + // CHECK:STDERR: ╭─┤ fail_extern_member_class.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ extern class D; + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: `extern` not allowed; requires file or namespace scope + // CHECK:STDERR: · ┃ [ModifierExternNotAllowed] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extern class D; } @@ -95,8 +122,16 @@ class C { library "[[@TEST_NAME]]"; extern class C; -// CHECK:STDERR: fail_def_after_extern_decl.carbon:[[@LINE+3]]:1-9: error: redeclarations of `class C` must match use of `extern` [RedeclExternMismatch] -// CHECK:STDERR: fail_def_after_extern_decl.carbon:[[@LINE-2]]:1-15: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_def_after_extern_decl.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: │ extern class C; +// CHECK:STDERR: · ───────┬─────── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ class C {} +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclarations of `class C` must match use of `extern` +// CHECK:STDERR: · ┃ [RedeclExternMismatch] +// CHECK:STDERR: ╰──── // CHECK:STDERR: class C {} @@ -105,8 +140,93 @@ class C {} library "[[@TEST_NAME]]"; class C; -// CHECK:STDERR: fail_extern_decl_after_decl.carbon:[[@LINE+3]]:1-15: error: redeclaration of `class C` is redundant [RedeclRedundant] -// CHECK:STDERR: fail_extern_decl_after_decl.carbon:[[@LINE-2]]:1-8: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_extern_decl_after_decl.carbon:[[@LINE+88]]:1 +// CHECK:STDERR: │ class C; +// CHECK:STDERR: · ────┬─── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ extern class C; +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of `class C` is redundant [RedeclRedundant] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: +// CHECK:STDERR: ╷ ╭── imported from: fail_import_extern_decl_then_decl.carbon [InImport] +// CHECK:STDERR: ├─┤ decl.carbon:4:1 +// CHECK:STDERR: -> │ class C; +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `C` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ extern_decl.carbon +// CHECK:STDERR: │ extern class C; +// CHECK:STDERR: · ───────┬─────── +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: +// CHECK:STDERR: ╷ ╭── imported from: fail_import_decl_then_extern_decl.carbon [InImport] +// CHECK:STDERR: ├─┤ extern_decl.carbon:4:1 +// CHECK:STDERR: -> │ extern class C; +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `C` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ decl.carbon +// CHECK:STDERR: │ class C; +// CHECK:STDERR: · ────┬─── +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: +// CHECK:STDERR: ╷ ╭── imported from: fail_import_extern_decl_then_def.carbon [InImport] +// CHECK:STDERR: ├─┤ def.carbon:4:1 +// CHECK:STDERR: -> │ class C {} +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `C` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ extern_decl.carbon +// CHECK:STDERR: │ extern class C; +// CHECK:STDERR: · ───────┬─────── +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: +// CHECK:STDERR: ╷ ╭── imported from: fail_import_ownership_conflict.carbon [InImport] +// CHECK:STDERR: ├─┤ decl.carbon:4:1 +// CHECK:STDERR: -> │ class C; +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `C` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ extern_decl.carbon +// CHECK:STDERR: │ extern class C; +// CHECK:STDERR: · ───────┬─────── +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: +// CHECK:STDERR: ╷ ╭── imported from: fail_import_ownership_conflict.carbon [InImport] +// CHECK:STDERR: ├─┤ def.carbon:4:1 +// CHECK:STDERR: -> │ class C {} +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `C` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ extern_decl.carbon +// CHECK:STDERR: │ extern class C; +// CHECK:STDERR: · ───────┬─────── +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: +// CHECK:STDERR: ╷ ╭── imported from: fail_todo_import_extern_decl_copy.carbon [InImport] +// CHECK:STDERR: ├─┤ extern_decl_copy.carbon:4:1 +// CHECK:STDERR: -> │ extern class C; +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `C` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ extern_decl.carbon +// CHECK:STDERR: │ extern class C; +// CHECK:STDERR: · ───────┬─────── +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: extern class C; @@ -114,10 +234,6 @@ extern class C; library "[[@TEST_NAME]]"; -// CHECK:STDERR: imported from: fail_import_extern_decl_then_decl.carbon:[[@LINE+4]]:1 [InImport] -// CHECK:STDERR: decl.carbon:4:1-8: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: extern_decl.carbon:4:1-15: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: import library "extern_decl"; import library "decl"; @@ -125,10 +241,6 @@ import library "decl"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: imported from: fail_import_decl_then_extern_decl.carbon:[[@LINE+4]]:1 [InImport] -// CHECK:STDERR: extern_decl.carbon:4:1-15: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: decl.carbon:4:1-8: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: import library "decl"; import library "extern_decl"; @@ -136,10 +248,6 @@ import library "extern_decl"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: imported from: fail_import_extern_decl_then_def.carbon:[[@LINE+4]]:1 [InImport] -// CHECK:STDERR: def.carbon:4:1-9: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: extern_decl.carbon:4:1-15: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: import library "extern_decl"; import library "def"; @@ -147,14 +255,6 @@ import library "def"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: imported from: fail_import_ownership_conflict.carbon:[[@LINE+8]]:1 [InImport] -// CHECK:STDERR: decl.carbon:4:1-8: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: extern_decl.carbon:4:1-15: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: -// CHECK:STDERR: imported from: fail_import_ownership_conflict.carbon:[[@LINE+4]]:1 [InImport] -// CHECK:STDERR: def.carbon:4:1-9: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: extern_decl.carbon:4:1-15: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: import library "extern_decl"; import library "decl"; import library "def"; @@ -163,10 +263,6 @@ import library "def"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: imported from: fail_todo_import_extern_decl_copy.carbon:[[@LINE+4]]:1 [InImport] -// CHECK:STDERR: extern_decl_copy.carbon:4:1-15: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: extern_decl.carbon:4:1-15: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: import library "extern_decl"; import library "extern_decl_copy"; @@ -176,8 +272,16 @@ library "[[@TEST_NAME]]"; import library "extern_decl"; -// CHECK:STDERR: fail_extern_decl_after_import_extern_decl.carbon:[[@LINE+3]]:1-15: error: redeclaration of `class C` is redundant [RedeclRedundant] -// CHECK:STDERR: extern_decl.carbon:4:1-15: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_extern_decl_after_import_extern_decl.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: -> │ extern class C; +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of `class C` is redundant [RedeclRedundant] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ extern_decl.carbon +// CHECK:STDERR: │ extern class C; +// CHECK:STDERR: · ───────┬─────── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: extern class C; @@ -187,8 +291,17 @@ library "[[@TEST_NAME]]"; import library "decl"; -// CHECK:STDERR: fail_decl_after_import_extern_decl.carbon:[[@LINE+3]]:1-15: error: redeclarations of `class C` must match use of `extern` [RedeclExternMismatch] -// CHECK:STDERR: decl.carbon:4:1-8: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_decl_after_import_extern_decl.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: -> │ extern class C; +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclarations of `class C` must match use of `extern` +// CHECK:STDERR: · ┃ [RedeclExternMismatch] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ decl.carbon +// CHECK:STDERR: │ class C; +// CHECK:STDERR: · ────┬─── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: extern class C; @@ -198,8 +311,17 @@ library "[[@TEST_NAME]]"; import library "def"; -// CHECK:STDERR: fail_def_after_import_extern_decl.carbon:[[@LINE+3]]:1-15: error: redeclarations of `class C` must match use of `extern` [RedeclExternMismatch] -// CHECK:STDERR: def.carbon:4:1-9: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_def_after_import_extern_decl.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: -> │ extern class C; +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclarations of `class C` must match use of `extern` +// CHECK:STDERR: · ┃ [RedeclExternMismatch] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ def.carbon +// CHECK:STDERR: │ class C {} +// CHECK:STDERR: · ────┬──── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: extern class C; @@ -209,8 +331,17 @@ library "[[@TEST_NAME]]"; import library "def"; -// CHECK:STDERR: fail_extern_decl_after_import_def.carbon:[[@LINE+3]]:1-15: error: redeclarations of `class C` must match use of `extern` [RedeclExternMismatch] -// CHECK:STDERR: def.carbon:4:1-9: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_extern_decl_after_import_def.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: -> │ extern class C; +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclarations of `class C` must match use of `extern` +// CHECK:STDERR: · ┃ [RedeclExternMismatch] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ def.carbon +// CHECK:STDERR: │ class C {} +// CHECK:STDERR: · ────┬──── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: extern class C; @@ -343,7 +474,7 @@ extern class C; // CHECK:STDOUT: .C = %C.decl.loc4 // CHECK:STDOUT: } // CHECK:STDOUT: %C.decl.loc4: type = class_decl @C [concrete = constants.%C] {} {} -// CHECK:STDOUT: %C.decl.loc8: type = class_decl @C [concrete = constants.%C] {} {} +// CHECK:STDOUT: %C.decl.loc15: type = class_decl @C [concrete = constants.%C] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C; @@ -357,10 +488,10 @@ extern class C; // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .C = %C.decl.loc8 +// CHECK:STDOUT: .C = %C.decl.loc15 // CHECK:STDOUT: } // CHECK:STDOUT: %C.decl.loc4: type = class_decl @C [concrete = constants.%C] {} {} -// CHECK:STDOUT: %C.decl.loc8: type = class_decl @C [concrete = constants.%C] {} {} +// CHECK:STDOUT: %C.decl.loc15: type = class_decl @C [concrete = constants.%C] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C; @@ -405,10 +536,10 @@ extern class C; // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .C = %C.decl.loc8 +// CHECK:STDOUT: .C = %C.decl.loc16 // CHECK:STDOUT: } // CHECK:STDOUT: %C.decl.loc4: type = class_decl @C [concrete = constants.%C] {} {} -// CHECK:STDOUT: %C.decl.loc8: type = class_decl @C [concrete = constants.%C] {} {} +// CHECK:STDOUT: %C.decl.loc16: type = class_decl @C [concrete = constants.%C] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { @@ -431,7 +562,7 @@ extern class C; // CHECK:STDOUT: .C = %C.decl.loc4 // CHECK:STDOUT: } // CHECK:STDOUT: %C.decl.loc4: type = class_decl @C [concrete = constants.%C] {} {} -// CHECK:STDOUT: %C.decl.loc8: type = class_decl @C [concrete = constants.%C] {} {} +// CHECK:STDOUT: %C.decl.loc93: type = class_decl @C [concrete = constants.%C] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C; diff --git a/toolchain/check/testdata/class/extern_library.carbon b/toolchain/check/testdata/class/extern_library.carbon index a7debde60e2a..7a15e8bc5748 100644 --- a/toolchain/check/testdata/class/extern_library.carbon +++ b/toolchain/check/testdata/class/extern_library.carbon @@ -14,7 +14,11 @@ // --- fail_todo.carbon -// CHECK:STDERR: fail_todo.carbon:[[@LINE+2]]:1-29: error: semantics TODO: `extern library` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_todo.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ extern library "foo" class C; +// CHECK:STDERR: · ━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `extern library` [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: extern library "foo" class C; diff --git a/toolchain/check/testdata/class/fail_compound_type_mismatch.carbon b/toolchain/check/testdata/class/fail_compound_type_mismatch.carbon index 730960650b4b..796a27e51319 100644 --- a/toolchain/check/testdata/class/fail_compound_type_mismatch.carbon +++ b/toolchain/check/testdata/class/fail_compound_type_mismatch.carbon @@ -19,8 +19,14 @@ class B { } fn AccessBInA(a: A) -> i32 { - // CHECK:STDERR: fail_compound_type_mismatch.carbon:[[@LINE+3]]:10-16: error: cannot implicitly convert expression of type `A` to `B` [ConversionFailure] - // CHECK:STDERR: fail_compound_type_mismatch.carbon:[[@LINE+2]]:10-16: note: type `A` does not implement interface `Core.ImplicitAs(B)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_compound_type_mismatch.carbon:[[@LINE+9]]:10 + // CHECK:STDERR: -> │ return a.(B.b); + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `A` to `B` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `A` does not implement interface `Core.ImplicitAs(B)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return a.(B.b); } diff --git a/toolchain/check/testdata/class/fail_convert_to_invalid.carbon b/toolchain/check/testdata/class/fail_convert_to_invalid.carbon index d08517a2e153..f7708f6fc7fd 100644 --- a/toolchain/check/testdata/class/fail_convert_to_invalid.carbon +++ b/toolchain/check/testdata/class/fail_convert_to_invalid.carbon @@ -11,7 +11,11 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_convert_to_invalid.carbon class C { - // CHECK:STDERR: fail_convert_to_invalid.carbon:[[@LINE+2]]:10-19: error: name `NoSuchType` not found [NameNotFound] + // CHECK:STDERR: ╭─┤ fail_convert_to_invalid.carbon:[[@LINE+6]]:10 + // CHECK:STDERR: -> │ var a: NoSuchType; + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: name `NoSuchType` not found [NameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var a: NoSuchType; } diff --git a/toolchain/check/testdata/class/fail_error_recovery.carbon b/toolchain/check/testdata/class/fail_error_recovery.carbon index 8bd2032e76e0..b3cbff8eaa73 100644 --- a/toolchain/check/testdata/class/fail_error_recovery.carbon +++ b/toolchain/check/testdata/class/fail_error_recovery.carbon @@ -12,7 +12,12 @@ // --- fail_virtual_fn_in_invalid_context.carbon -// CHECK:STDERR: fail_virtual_fn_in_invalid_context.carbon:[[@LINE+2]]:24-38: error: name `error_not_found` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_virtual_fn_in_invalid_context.carbon:[[@LINE+7]]:24 +// CHECK:STDERR: -> │ fn F(unused generic N: error_not_found) { +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: name `error_not_found` not found +// CHECK:STDERR: · ┃ [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused generic N: error_not_found) { base class C { diff --git a/toolchain/check/testdata/class/fail_import_misuses.carbon b/toolchain/check/testdata/class/fail_import_misuses.carbon index d8bcfe8db7e5..b4fd93f7ffc7 100644 --- a/toolchain/check/testdata/class/fail_import_misuses.carbon +++ b/toolchain/check/testdata/class/fail_import_misuses.carbon @@ -25,14 +25,32 @@ library "[[@TEST_NAME]]"; import library "a"; -// CHECK:STDERR: fail_b.carbon:[[@LINE+3]]:1-13: error: redeclaration of `class Empty` is redundant [RedeclRedundant] -// CHECK:STDERR: a.carbon:4:1-13: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_b.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: -> │ class Empty { +// CHECK:STDERR: · ━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of `class Empty` is redundant [RedeclRedundant] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ a.carbon +// CHECK:STDERR: │ class Empty { +// CHECK:STDERR: · ──────┬────── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: class Empty { } -// CHECK:STDERR: fail_b.carbon:[[@LINE+4]]:8-17: error: binding pattern has incomplete type `Incomplete` in name binding declaration [IncompleteTypeInBindingDecl] -// CHECK:STDERR: imported from: fail_b.carbon:[[@LINE-9]]:1 [InImport] -// CHECK:STDERR: a.carbon:7:1-17: note: class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: ╭─┤ fail_b.carbon:[[@LINE+14]]:8 +// CHECK:STDERR: -> │ var a: Incomplete; +// CHECK:STDERR: · ┳━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: binding pattern has incomplete type `Incomplete` in name +// CHECK:STDERR: · ┃ binding declaration +// CHECK:STDERR: · ┃ [IncompleteTypeInBindingDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: │ ╭── imported from: fail_b.carbon [InImport] +// CHECK:STDERR: ├─┤ a.carbon +// CHECK:STDERR: │ class Incomplete; +// CHECK:STDERR: · ────────┬──────── +// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var a: Incomplete; diff --git a/toolchain/check/testdata/class/fail_incomplete.carbon b/toolchain/check/testdata/class/fail_incomplete.carbon index 751f87745c40..bdc2b5f11318 100644 --- a/toolchain/check/testdata/class/fail_incomplete.carbon +++ b/toolchain/check/testdata/class/fail_incomplete.carbon @@ -16,52 +16,118 @@ library "[[@TEST_NAME]]"; class Class; -// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+3]]:4-8: error: cannot declare a member of incomplete class `Class` [QualifiedDeclInIncompleteClassScope] -// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-3]]:1-12: note: class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: ╭─┤ fail_forward_decl.carbon:[[@LINE+11]]:4 +// CHECK:STDERR: │ class Class; +// CHECK:STDERR: · ──────┬───── +// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn Class.Function() {} +// CHECK:STDERR: · ━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: cannot declare a member of incomplete class `Class` +// CHECK:STDERR: · ┃ [QualifiedDeclInIncompleteClassScope] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Class.Function() {} fn CallClassFunction() { - // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+3]]:3-16: error: member access into incomplete class `Class` [QualifiedExprInIncompleteClassScope] - // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-9]]:1-12: note: class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ╭─┤ fail_forward_decl.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ class Class; + // CHECK:STDERR: · ──────┬───── + // CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Class.Function(); + // CHECK:STDERR: · ━━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: member access into incomplete class `Class` + // CHECK:STDERR: · ┃ [QualifiedExprInIncompleteClassScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Class.Function(); } -// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+3]]:17-21: error: binding pattern has incomplete type `Class` in name binding declaration [IncompleteTypeInBindingDecl] -// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-15]]:1-12: note: class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: ╭─┤ fail_forward_decl.carbon:[[@LINE+12]]:17 +// CHECK:STDERR: │ class Class; +// CHECK:STDERR: · ──────┬───── +// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ var global_var: Class; +// CHECK:STDERR: · ┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: binding pattern has incomplete type `Class` in name +// CHECK:STDERR: · ┃ binding declaration +// CHECK:STDERR: · ┃ [IncompleteTypeInBindingDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var global_var: Class; -// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+3]]:24-31: error: function returns incomplete type `Class` [IncompleteTypeInFunctionReturnType] -// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-20]]:1-12: note: class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: ╭─┤ fail_forward_decl.carbon:[[@LINE+11]]:24 +// CHECK:STDERR: │ class Class; +// CHECK:STDERR: · ──────┬───── +// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn ConvertFromStruct() -> Class { return {}; } +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: function returns incomplete type `Class` +// CHECK:STDERR: · ┃ [IncompleteTypeInFunctionReturnType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn ConvertFromStruct() -> Class { return {}; } fn G(p: Class*) -> () { - // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+3]]:10-13: error: member access into object of incomplete type `Class` [IncompleteTypeInMemberAccess] - // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-26]]:1-12: note: class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ╭─┤ fail_forward_decl.carbon:[[@LINE+11]]:10 + // CHECK:STDERR: │ class Class; + // CHECK:STDERR: · ──────┬───── + // CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ return p->n; + // CHECK:STDERR: · ━━┳━ + // CHECK:STDERR: · ┗━━┫ error: member access into object of incomplete type `Class` + // CHECK:STDERR: · ┃ [IncompleteTypeInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return p->n; } fn MemberAccess(p: Class*) -> () { - // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+3]]:11-12: error: member access into object of incomplete type `Class` [IncompleteTypeInMemberAccess] - // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-33]]:1-12: note: class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ╭─┤ fail_forward_decl.carbon:[[@LINE+11]]:11 + // CHECK:STDERR: │ class Class; + // CHECK:STDERR: · ──────┬───── + // CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ return (*p).n; + // CHECK:STDERR: · ━┳ + // CHECK:STDERR: · ┗━━┫ error: member access into object of incomplete type `Class` + // CHECK:STDERR: · ┃ [IncompleteTypeInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return (*p).n; } -// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+3]]:20-27: error: function returns incomplete type `Class` [IncompleteTypeInFunctionReturnType] -// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-39]]:1-12: note: class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: ╭─┤ fail_forward_decl.carbon:[[@LINE+11]]:20 +// CHECK:STDERR: │ class Class; +// CHECK:STDERR: · ──────┬───── +// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn Copy(p: Class*) -> Class { +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: function returns incomplete type `Class` +// CHECK:STDERR: · ┃ [IncompleteTypeInFunctionReturnType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Copy(p: Class*) -> Class { return *p; } fn Let(p: Class*) { - // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+3]]:17-21: error: binding pattern has incomplete type `Class` in name binding declaration [IncompleteTypeInBindingDecl] - // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-47]]:1-12: note: class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ╭─┤ fail_forward_decl.carbon:[[@LINE+12]]:17 + // CHECK:STDERR: │ class Class; + // CHECK:STDERR: · ──────┬───── + // CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ let unused c: Class = *p; + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: binding pattern has incomplete type `Class` in name + // CHECK:STDERR: · ┃ binding declaration + // CHECK:STDERR: · ┃ [IncompleteTypeInBindingDecl] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused c: Class = *p; } @@ -71,23 +137,59 @@ fn TakeIncomplete(c: Class); fn ReturnIncomplete() -> Class; fn CallTakeIncomplete(p: Class*) { - // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+4]]:18-19: error: forming value of incomplete type `Class` [IncompleteTypeInValueConversion] - // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-58]]:1-12: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-7]]:19-26: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_forward_decl.carbon:[[@LINE+16]]:18 + // CHECK:STDERR: │ class Class; + // CHECK:STDERR: · ──────┬───── + // CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ fn TakeIncomplete(c: Class); + // CHECK:STDERR: · ────┬─── + // CHECK:STDERR: · ╰──┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ TakeIncomplete(*p); + // CHECK:STDERR: · ━┳ + // CHECK:STDERR: · ┗━━┫ error: forming value of incomplete type `Class` + // CHECK:STDERR: · ┃ [IncompleteTypeInValueConversion] + // CHECK:STDERR: ╰──── // CHECK:STDERR: TakeIncomplete(*p); - // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+4]]:18-19: error: forming value of incomplete type `Class` [IncompleteTypeInValueConversion] - // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-64]]:1-12: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-13]]:19-26: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_forward_decl.carbon:[[@LINE+16]]:18 + // CHECK:STDERR: │ class Class; + // CHECK:STDERR: · ──────┬───── + // CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ fn TakeIncomplete(c: Class); + // CHECK:STDERR: · ────┬─── + // CHECK:STDERR: · ╰──┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ TakeIncomplete({}); + // CHECK:STDERR: · ━┳ + // CHECK:STDERR: · ┗━━┫ error: forming value of incomplete type `Class` + // CHECK:STDERR: · ┃ [IncompleteTypeInValueConversion] + // CHECK:STDERR: ╰──── // CHECK:STDERR: TakeIncomplete({}); } fn CallReturnIncomplete() { - // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+4]]:3-20: error: function returns incomplete type `Class` [IncompleteTypeInFunctionReturnType] - // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-72]]:1-12: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: fail_forward_decl.carbon:[[@LINE-19]]:23-30: note: return type declared here [IncompleteReturnTypeHere] + // CHECK:STDERR: ╭─┤ fail_forward_decl.carbon:[[@LINE+16]]:3 + // CHECK:STDERR: │ class Class; + // CHECK:STDERR: · ──────┬───── + // CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ fn ReturnIncomplete() -> Class; + // CHECK:STDERR: · ────┬─── + // CHECK:STDERR: · ╰──┤ return type declared here + // CHECK:STDERR: · │ [IncompleteReturnTypeHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ ReturnIncomplete(); + // CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: function returns incomplete type `Class` + // CHECK:STDERR: · ┃ [IncompleteTypeInFunctionReturnType] + // CHECK:STDERR: ╰──── // CHECK:STDERR: ReturnIncomplete(); } @@ -97,8 +199,18 @@ fn CallReturnIncomplete() { library "[[@TEST_NAME]]"; class C { - // CHECK:STDERR: fail_in_definition.carbon:[[@LINE+3]]:10: error: binding pattern has incomplete type `C` in name binding declaration [IncompleteTypeInBindingDecl] - // CHECK:STDERR: fail_in_definition.carbon:[[@LINE-2]]:1-9: note: class is incomplete within its definition [ClassIncompleteWithinDefinition] + // CHECK:STDERR: ╭─┤ fail_in_definition.carbon:[[@LINE+13]]:10 + // CHECK:STDERR: │ class C { + // CHECK:STDERR: · ────┬──── + // CHECK:STDERR: · ╰──┤ class is incomplete within its definition + // CHECK:STDERR: · │ [ClassIncompleteWithinDefinition] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ var c: C; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: binding pattern has incomplete type `C` in name binding + // CHECK:STDERR: · ┃ declaration + // CHECK:STDERR: · ┃ [IncompleteTypeInBindingDecl] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var c: C; } diff --git a/toolchain/check/testdata/class/fail_init.carbon b/toolchain/check/testdata/class/fail_init.carbon index f006e22273e8..090c8aa126a2 100644 --- a/toolchain/check/testdata/class/fail_init.carbon +++ b/toolchain/check/testdata/class/fail_init.carbon @@ -16,13 +16,28 @@ class Class { } fn F() { - // CHECK:STDERR: fail_init.carbon:[[@LINE+2]]:3-10: error: missing value for field `b` in struct initialization [StructInitMissingFieldInLiteral] + // CHECK:STDERR: ╭─┤ fail_init.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ {.a = 1} as Class; + // CHECK:STDERR: · ━━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: missing value for field `b` in struct initialization + // CHECK:STDERR: · ┃ [StructInitMissingFieldInLiteral] + // CHECK:STDERR: ╰──── // CHECK:STDERR: {.a = 1} as Class; - // CHECK:STDERR: fail_init.carbon:[[@LINE+2]]:3-18: error: struct `Class` has no field named `c` [StructInitUnexpectedFieldInLiteral] + // CHECK:STDERR: ╭─┤ fail_init.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ {.a = 1, .c = 2} as Class; + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: struct `Class` has no field named `c` + // CHECK:STDERR: · ┃ [StructInitUnexpectedFieldInLiteral] + // CHECK:STDERR: ╰──── // CHECK:STDERR: {.a = 1, .c = 2} as Class; - // CHECK:STDERR: fail_init.carbon:[[@LINE+2]]:3-26: error: struct `Class` has no field named `c` [StructInitUnexpectedFieldInLiteral] + // CHECK:STDERR: ╭─┤ fail_init.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ {.a = 1, .b = 2, .c = 3} as Class; + // CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: struct `Class` has no field named `c` + // CHECK:STDERR: · ┃ [StructInitUnexpectedFieldInLiteral] + // CHECK:STDERR: ╰──── // CHECK:STDERR: {.a = 1, .b = 2, .c = 3} as Class; } diff --git a/toolchain/check/testdata/class/fail_memaccess_category.carbon b/toolchain/check/testdata/class/fail_memaccess_category.carbon index df1cbeafc2eb..925fef3eb761 100644 --- a/toolchain/check/testdata/class/fail_memaccess_category.carbon +++ b/toolchain/check/testdata/class/fail_memaccess_category.carbon @@ -20,15 +20,29 @@ class B { fn F(s: {.a: A}, b: B) { // `s` has only a value representation, so this must be invalid. - // CHECK:STDERR: fail_memaccess_category.carbon:[[@LINE+3]]:3-5: error: value expression passed to reference parameter [ValueForRefParam] - // CHECK:STDERR: fail_memaccess_category.carbon:[[@LINE-10]]:8-18: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_memaccess_category.carbon:[[@LINE+10]]:3 + // CHECK:STDERR: │ fn F(ref self: A); + // CHECK:STDERR: · ─────┬───── + // CHECK:STDERR: · ╰──┤ initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ s.a.F(); + // CHECK:STDERR: · ━┳━ + // CHECK:STDERR: · ┗━━┫ error: value expression passed to reference parameter [ValueForRefParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: s.a.F(); // `b` has an object representation for `A`, but this is still invalid for // consistency. - // CHECK:STDERR: fail_memaccess_category.carbon:[[@LINE+3]]:3-5: error: value expression passed to reference parameter [ValueForRefParam] - // CHECK:STDERR: fail_memaccess_category.carbon:[[@LINE-17]]:8-18: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_memaccess_category.carbon:[[@LINE+10]]:3 + // CHECK:STDERR: │ fn F(ref self: A); + // CHECK:STDERR: · ─────┬───── + // CHECK:STDERR: · ╰──┤ initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ b.a.F(); + // CHECK:STDERR: · ━┳━ + // CHECK:STDERR: · ┗━━┫ error: value expression passed to reference parameter [ValueForRefParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: b.a.F(); } diff --git a/toolchain/check/testdata/class/fail_member_of_let.carbon b/toolchain/check/testdata/class/fail_member_of_let.carbon index 5be6e9f191a8..bc9c9c853b70 100644 --- a/toolchain/check/testdata/class/fail_member_of_let.carbon +++ b/toolchain/check/testdata/class/fail_member_of_let.carbon @@ -19,7 +19,17 @@ let T: type = Class; // The class name is required to be written in the same way as in the class // declaration. An expression that evaluates to the class name is not accepted. -// CHECK:STDERR: fail_member_of_let.carbon:[[@LINE+3]]:4: error: name qualifiers are only allowed for entities that provide a scope [QualifiedNameInNonScope] -// CHECK:STDERR: fail_member_of_let.carbon:[[@LINE-5]]:5-11: note: referenced non-scope entity declared here [QualifiedNameNonScopeEntity] +// CHECK:STDERR: ╭─┤ fail_member_of_let.carbon:[[@LINE+13]]:4 +// CHECK:STDERR: │ let T: type = Class; +// CHECK:STDERR: · ───┬─── +// CHECK:STDERR: · ╰──┤ referenced non-scope entity declared here +// CHECK:STDERR: · │ [QualifiedNameNonScopeEntity] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn T.F() {} +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: name qualifiers are only allowed for entities that provide a +// CHECK:STDERR: · ┃ scope +// CHECK:STDERR: · ┃ [QualifiedNameInNonScope] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn T.F() {} diff --git a/toolchain/check/testdata/class/fail_modifiers.carbon b/toolchain/check/testdata/class/fail_modifiers.carbon index 818ba82364a4..64cec8aa07a0 100644 --- a/toolchain/check/testdata/class/fail_modifiers.carbon +++ b/toolchain/check/testdata/class/fail_modifiers.carbon @@ -10,55 +10,115 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_modifiers.carbon -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+3]]:9-15: error: `private` repeated on declaration [ModifierRepeated] -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-7: note: `private` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+7]]:9 +// CHECK:STDERR: -> │ private private class DuplicatePrivate; +// CHECK:STDERR: · ───┬─── ━━━┳━━━ +// CHECK:STDERR: · │ ┗━━┫ error: `private` repeated on declaration [ModifierRepeated] +// CHECK:STDERR: · ╰────────────┤ `private` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: private private class DuplicatePrivate; -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-8: error: `abstract` not allowed on `class` forward declaration, only definition [ModifierOnlyAllowedOnDefinition] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ abstract class AbstractDecl; +// CHECK:STDERR: · ┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `abstract` not allowed on `class` forward declaration, only +// CHECK:STDERR: · ┃ definition +// CHECK:STDERR: · ┃ [ModifierOnlyAllowedOnDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: abstract class AbstractDecl; -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+3]]:9-17: error: `protected` not allowed on declaration with `private` [ModifierNotAllowedWith] -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-7: note: `private` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+8]]:9 +// CHECK:STDERR: -> │ private protected class TwoAccess; +// CHECK:STDERR: · ───┬─── ━━━━┳━━━━ +// CHECK:STDERR: · │ ┗━━┫ error: `protected` not allowed on declaration with `private` +// CHECK:STDERR: · │ ┃ [ModifierNotAllowedWith] +// CHECK:STDERR: · ╰─────────────┤ `private` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: private protected class TwoAccess; -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-4: error: `base` not allowed on `class` forward declaration, only definition [ModifierOnlyAllowedOnDefinition] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ base class BaseDecl; +// CHECK:STDERR: · ━━┳━ +// CHECK:STDERR: · ┗━━┫ error: `base` not allowed on `class` forward declaration, only definition +// CHECK:STDERR: · ┃ [ModifierOnlyAllowedOnDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: base class BaseDecl; -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+3]]:10-17: error: `abstract` repeated on declaration [ModifierRepeated] -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-8: note: `abstract` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+7]]:10 +// CHECK:STDERR: -> │ abstract abstract class TwoAbstract { } +// CHECK:STDERR: · ────┬─── ━━━━┳━━━ +// CHECK:STDERR: · │ ┗━━┫ error: `abstract` repeated on declaration [ModifierRepeated] +// CHECK:STDERR: · ╰─────────────┤ `abstract` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: abstract abstract class TwoAbstract { } -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+7]]:19-22: error: `base` not allowed on declaration with `virtual` [ModifierNotAllowedWith] -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+6]]:11-17: note: `virtual` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+22]]:19 +// CHECK:STDERR: -> │ protected virtual base class Virtual {} +// CHECK:STDERR: · ───┬─── ━━┳━ +// CHECK:STDERR: · │ ┗━━┫ error: `base` not allowed on declaration with `virtual` +// CHECK:STDERR: · │ ┃ [ModifierNotAllowedWith] +// CHECK:STDERR: · ╰───────────┤ `virtual` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1-9: error: `protected` not allowed; requires class scope [ModifierProtectedNotAllowed] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+14]]:1 +// CHECK:STDERR: -> │ protected virtual base class Virtual {} +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: `protected` not allowed; requires class scope +// CHECK:STDERR: · ┃ [ModifierProtectedNotAllowed] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:11-17: error: `virtual` not allowed on `class` declaration [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+7]]:11 +// CHECK:STDERR: -> │ protected virtual base class Virtual {} +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: `virtual` not allowed on `class` declaration +// CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╰──── // CHECK:STDERR: protected virtual base class Virtual {} -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+3]]:10-18: error: `protected` must appear before `abstract` [ModifierMustAppearBefore] -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-8: note: `abstract` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+8]]:10 +// CHECK:STDERR: -> │ abstract protected class WrongOrder { } +// CHECK:STDERR: · ────┬─── ━━━━┳━━━━ +// CHECK:STDERR: · │ ┗━━┫ error: `protected` must appear before `abstract` +// CHECK:STDERR: · │ ┃ [ModifierMustAppearBefore] +// CHECK:STDERR: · ╰─────────────┤ `abstract` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: abstract protected class WrongOrder { } -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+3]]:10-13: error: `base` not allowed on declaration with `abstract` [ModifierNotAllowedWith] -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-8: note: `abstract` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+8]]:10 +// CHECK:STDERR: -> │ abstract base class AbstractAndBase {} +// CHECK:STDERR: · ────┬─── ━━┳━ +// CHECK:STDERR: · │ ┗━━┫ error: `base` not allowed on declaration with `abstract` +// CHECK:STDERR: · │ ┃ [ModifierNotAllowedWith] +// CHECK:STDERR: · ╰───────────┤ `abstract` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: abstract base class AbstractAndBase {} abstract class AbstractWithDefinition { - // CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:30: error: definition of `abstract` function [DefinedAbstractFunction] + // CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+7]]:30 + // CHECK:STDERR: -> │ abstract fn F(unused self) {} + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: definition of `abstract` function + // CHECK:STDERR: · ┃ [DefinedAbstractFunction] + // CHECK:STDERR: ╰──── // CHECK:STDERR: abstract fn F(unused self) {} abstract fn G(self); } -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:42: error: definition of `abstract` function [DefinedAbstractFunction] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+8]]:42 +// CHECK:STDERR: -> │ fn AbstractWithDefinition.G(unused self) { +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: definition of `abstract` +// CHECK:STDERR: · ┃ function +// CHECK:STDERR: · ┃ [DefinedAbstractFunction] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn AbstractWithDefinition.G(unused self) { } diff --git a/toolchain/check/testdata/class/fail_redeclaration_scope.carbon b/toolchain/check/testdata/class/fail_redeclaration_scope.carbon index d04815171f17..9f93327b633b 100644 --- a/toolchain/check/testdata/class/fail_redeclaration_scope.carbon +++ b/toolchain/check/testdata/class/fail_redeclaration_scope.carbon @@ -21,7 +21,11 @@ class X { class A { class B; } class Y { - // CHECK:STDERR: fail_redeclaration_scope.carbon:[[@LINE+2]]:9: error: name `A` not found [NameNotFound] + // CHECK:STDERR: ╭─┤ fail_redeclaration_scope.carbon:[[@LINE+6]]:9 + // CHECK:STDERR: -> │ class A.B {} + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: name `A` not found [NameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: class A.B {} } diff --git a/toolchain/check/testdata/class/fail_redefinition.carbon b/toolchain/check/testdata/class/fail_redefinition.carbon index b5a256c62c57..bfece9ccd164 100644 --- a/toolchain/check/testdata/class/fail_redefinition.carbon +++ b/toolchain/check/testdata/class/fail_redefinition.carbon @@ -16,8 +16,15 @@ class Class { fn I() {} } -// CHECK:STDERR: fail_redefinition.carbon:[[@LINE+3]]:1-13: error: redefinition of `class Class` [RedeclRedef] -// CHECK:STDERR: fail_redefinition.carbon:[[@LINE-7]]:1-13: note: previously defined here [RedeclPrevDef] +// CHECK:STDERR: ╭─┤ fail_redefinition.carbon:[[@LINE+10]]:1 +// CHECK:STDERR: │ class Class { +// CHECK:STDERR: · ──────┬────── +// CHECK:STDERR: · ╰──┤ previously defined here [RedeclPrevDef] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ class Class { +// CHECK:STDERR: · ━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redefinition of `class Class` [RedeclRedef] +// CHECK:STDERR: ╰──── // CHECK:STDERR: class Class { fn G(); @@ -26,11 +33,24 @@ class Class { } fn Class.F() {} -// CHECK:STDERR: fail_redefinition.carbon:[[@LINE+2]]:10: error: out-of-line declaration requires a declaration in scoped entity [QualifiedDeclOutsideScopeEntity] +// CHECK:STDERR: ╭─┤ fail_redefinition.carbon:[[@LINE+8]]:10 +// CHECK:STDERR: -> │ fn Class.G() {} +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: out-of-line declaration requires a declaration in scoped +// CHECK:STDERR: · ┃ entity +// CHECK:STDERR: · ┃ [QualifiedDeclOutsideScopeEntity] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Class.G() {} fn Class.H() {} -// CHECK:STDERR: fail_redefinition.carbon:[[@LINE+3]]:1-14: error: redefinition of `fn I` [RedeclRedef] -// CHECK:STDERR: fail_redefinition.carbon:[[@LINE-18]]:3-10: note: previously defined here [RedeclPrevDef] +// CHECK:STDERR: ╭─┤ fail_redefinition.carbon:[[@LINE+10]]:1 +// CHECK:STDERR: │ fn I() {} +// CHECK:STDERR: · ────┬─── +// CHECK:STDERR: · ╰──┤ previously defined here [RedeclPrevDef] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn Class.I() {} +// CHECK:STDERR: · ━━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redefinition of `fn I` [RedeclRedef] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Class.I() {} diff --git a/toolchain/check/testdata/class/fail_scope.carbon b/toolchain/check/testdata/class/fail_scope.carbon index b729c999518a..fdd11d7bcd65 100644 --- a/toolchain/check/testdata/class/fail_scope.carbon +++ b/toolchain/check/testdata/class/fail_scope.carbon @@ -17,7 +17,11 @@ class Class { } fn G() -> () { - // CHECK:STDERR: fail_scope.carbon:[[@LINE+2]]:10: error: name `F` not found [NameNotFound] + // CHECK:STDERR: ╭─┤ fail_scope.carbon:[[@LINE+6]]:10 + // CHECK:STDERR: -> │ return F(); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: name `F` not found [NameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return F(); } diff --git a/toolchain/check/testdata/class/fail_unknown_member.carbon b/toolchain/check/testdata/class/fail_unknown_member.carbon index 3bbbce4e3d82..8d4726dcbe67 100644 --- a/toolchain/check/testdata/class/fail_unknown_member.carbon +++ b/toolchain/check/testdata/class/fail_unknown_member.carbon @@ -16,7 +16,12 @@ class Class { fn G(c: Class) -> i32 { // TODO: Mention the scope in which we looked for the name. - // CHECK:STDERR: fail_unknown_member.carbon:[[@LINE+2]]:10-20: error: member name `something` not found in `Class` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╭─┤ fail_unknown_member.carbon:[[@LINE+7]]:10 + // CHECK:STDERR: -> │ return c.something; + // CHECK:STDERR: · ━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: member name `something` not found in `Class` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return c.something; } diff --git a/toolchain/check/testdata/class/fail_var_param.carbon b/toolchain/check/testdata/class/fail_var_param.carbon index 1380a0905dbc..6eb09c1567f1 100644 --- a/toolchain/check/testdata/class/fail_var_param.carbon +++ b/toolchain/check/testdata/class/fail_var_param.carbon @@ -12,7 +12,12 @@ // A `var` parameter is not constant, so it is not allowed as a parameter of a // generic type. -// CHECK:STDERR: fail_var_param.carbon:[[@LINE+3]]:13-18: error: parameters of generic types must be constant [GenericParamMustBeConstant] -// CHECK:STDERR: fail_var_param.carbon:[[@LINE+2]]:13-18: note: `var` parameters are runtime [VarParamIsRuntime] +// CHECK:STDERR: ╭─┤ fail_var_param.carbon:[[@LINE+8]]:13 +// CHECK:STDERR: -> │ class C(var x: i32); +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: parameters of generic types must be constant +// CHECK:STDERR: · │ ┃ [GenericParamMustBeConstant] +// CHECK:STDERR: · ╰────┤ `var` parameters are runtime [VarParamIsRuntime] +// CHECK:STDERR: ╰──── // CHECK:STDERR: class C(var x: i32); diff --git a/toolchain/check/testdata/class/field/comp_time_field.carbon b/toolchain/check/testdata/class/field/comp_time_field.carbon index 04817a0135ef..0e7314cfff39 100644 --- a/toolchain/check/testdata/class/field/comp_time_field.carbon +++ b/toolchain/check/testdata/class/field/comp_time_field.carbon @@ -17,11 +17,24 @@ library "[[@TEST_NAME]]"; class Class { - // CHECK:STDERR: fail_let.carbon:[[@LINE+2]]:15-21: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_let.carbon:[[@LINE+9]]:15 + // CHECK:STDERR: -> │ let generic A: type = Class; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: semantics TODO: + // CHECK:STDERR: · ┃ ``let` compile time binding outside function or interface` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let generic A: type = Class; - // CHECK:STDERR: fail_let.carbon:[[@LINE+2]]:7-22: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_let.carbon:[[@LINE+8]]:7 + // CHECK:STDERR: -> │ let template B: type = Class; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: + // CHECK:STDERR: · ┃ ``let` compile time binding outside function or interface` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let template B: type = Class; } @@ -31,13 +44,29 @@ class Class { library "[[@TEST_NAME]]"; class Class { - // CHECK:STDERR: fail_var.carbon:[[@LINE+4]]:15-21: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_var.carbon:[[@LINE+15]]:15 + // CHECK:STDERR: -> │ var generic C: type = Class; + // CHECK:STDERR: · ┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: + // CHECK:STDERR: · ┃ `handle invalid parse trees in `check`` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_var.carbon:[[@LINE+2]]:23: error: found generic binding inside `var` pattern [NonRegularBindingInVarDecl] + // CHECK:STDERR: ╭─┤ fail_var.carbon:[[@LINE+7]]:23 + // CHECK:STDERR: -> │ var generic C: type = Class; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: found generic binding inside `var` pattern + // CHECK:STDERR: · ┃ [NonRegularBindingInVarDecl] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var generic C: type = Class; - // CHECK:STDERR: fail_var.carbon:[[@LINE+2]]:24: error: found generic binding inside `var` pattern [NonRegularBindingInVarDecl] + // CHECK:STDERR: ╭─┤ fail_var.carbon:[[@LINE+7]]:24 + // CHECK:STDERR: -> │ var template D: type = Class; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: found generic binding inside `var` pattern + // CHECK:STDERR: · ┃ [NonRegularBindingInVarDecl] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var template D: type = Class; } @@ -65,21 +94,21 @@ var x: Class = {}; // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %Class.ref.loc7: type = name_ref Class, file.%Class.decl [concrete = constants.%Class] -// CHECK:STDOUT: %.loc7_18.1: type = splice_block %.loc7_18.2 [concrete = type] { -// CHECK:STDOUT: %.Self.frozen.loc7: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc7_18.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %Class.ref.loc14: type = name_ref Class, file.%Class.decl [concrete = constants.%Class] +// CHECK:STDOUT: %.loc14_18.1: type = splice_block %.loc14_18.2 [concrete = type] { +// CHECK:STDOUT: %.Self.frozen.loc14: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc14_18.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %A: type = wrapper_binding A, %Class.ref.loc7 +// CHECK:STDOUT: %A: type = wrapper_binding A, %Class.ref.loc14 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %A.patt: %pattern_type = value_binding_pattern A [concrete = constants.%A.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %Class.ref.loc11: type = name_ref Class, file.%Class.decl [concrete = constants.%Class] -// CHECK:STDOUT: %.loc11_19.1: type = splice_block %.loc11_19.2 [concrete = type] { -// CHECK:STDOUT: %.Self.frozen.loc11: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc11_19.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %Class.ref.loc24: type = name_ref Class, file.%Class.decl [concrete = constants.%Class] +// CHECK:STDOUT: %.loc24_19.1: type = splice_block %.loc24_19.2 [concrete = type] { +// CHECK:STDOUT: %.Self.frozen.loc24: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc24_19.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %B: type = wrapper_binding B, %Class.ref.loc11 +// CHECK:STDOUT: %B: type = wrapper_binding B, %Class.ref.loc24 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %B.patt: %pattern_type = value_binding_pattern B [concrete = constants.%B.patt] // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/field/fail_field_modifiers.carbon b/toolchain/check/testdata/class/field/fail_field_modifiers.carbon index 7af5095132cb..5a0376134bf3 100644 --- a/toolchain/check/testdata/class/field/fail_field_modifiers.carbon +++ b/toolchain/check/testdata/class/field/fail_field_modifiers.carbon @@ -12,19 +12,39 @@ class Class { - // CHECK:STDERR: fail_field_modifiers.carbon:[[@LINE+2]]:3-9: error: `default` not allowed on `var` declaration [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╭─┤ fail_field_modifiers.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ default var j: i32; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: `default` not allowed on `var` declaration + // CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: default var j: i32; - // CHECK:STDERR: fail_field_modifiers.carbon:[[@LINE+2]]:3-7: error: `final` not allowed on `var` declaration [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╭─┤ fail_field_modifiers.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ final var k: i32; + // CHECK:STDERR: · ━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: `final` not allowed on `var` declaration + // CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: final var k: i32; - // CHECK:STDERR: fail_field_modifiers.carbon:[[@LINE+2]]:3-9: error: `default` not allowed; requires interface scope [ModifierRequiresInterface] + // CHECK:STDERR: ╭─┤ fail_field_modifiers.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ default let l: i32 = 0; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: `default` not allowed; requires interface scope + // CHECK:STDERR: · ┃ [ModifierRequiresInterface] + // CHECK:STDERR: ╰──── // CHECK:STDERR: default let l: i32 = 0; - // CHECK:STDERR: fail_field_modifiers.carbon:[[@LINE+2]]:3-7: error: `final` not allowed; requires interface scope [ModifierRequiresInterface] + // CHECK:STDERR: ╭─┤ fail_field_modifiers.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ final let m: i32 = 1; + // CHECK:STDERR: · ━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: `final` not allowed; requires interface scope + // CHECK:STDERR: · ┃ [ModifierRequiresInterface] + // CHECK:STDERR: ╰──── // CHECK:STDERR: final let m: i32 = 1; } diff --git a/toolchain/check/testdata/class/field/fail_unbound_field.carbon b/toolchain/check/testdata/class/field/fail_unbound_field.carbon index 2180381ff761..483e18e474a4 100644 --- a/toolchain/check/testdata/class/field/fail_unbound_field.carbon +++ b/toolchain/check/testdata/class/field/fail_unbound_field.carbon @@ -13,20 +13,38 @@ class Class { var field: i32; fn F() -> i32 { - // CHECK:STDERR: fail_unbound_field.carbon:[[@LINE+2]]:12-16: error: expression cannot be used as a value [UseOfNonExprAsValue] + // CHECK:STDERR: ╭─┤ fail_unbound_field.carbon:[[@LINE+7]]:12 + // CHECK:STDERR: -> │ return field; + // CHECK:STDERR: · ━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: expression cannot be used as a value + // CHECK:STDERR: · ┃ [UseOfNonExprAsValue] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return field; } fn IsZero() -> bool { - // CHECK:STDERR: fail_unbound_field.carbon:[[@LINE+2]]:12-21: error: cannot access member of interface `Core.EqWith(Core.IntLiteral)` in type `` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_unbound_field.carbon:[[@LINE+10]]:12 + // CHECK:STDERR: -> │ return field == 0; + // CHECK:STDERR: · ┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.EqWith(Core.IntLiteral)` in type + // CHECK:STDERR: · ┃ `` that does not + // CHECK:STDERR: · ┃ implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return field == 0; } } fn G() -> i32 { - // CHECK:STDERR: fail_unbound_field.carbon:[[@LINE+2]]:10-20: error: expression cannot be used as a value [UseOfNonExprAsValue] + // CHECK:STDERR: ╭─┤ fail_unbound_field.carbon:[[@LINE+7]]:10 + // CHECK:STDERR: -> │ return Class.field; + // CHECK:STDERR: · ━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: expression cannot be used as a value + // CHECK:STDERR: · ┃ [UseOfNonExprAsValue] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return Class.field; } diff --git a/toolchain/check/testdata/class/field/field_initializer.carbon b/toolchain/check/testdata/class/field/field_initializer.carbon index 76c34f0b1c2b..bc6c090b1a1f 100644 --- a/toolchain/check/testdata/class/field/field_initializer.carbon +++ b/toolchain/check/testdata/class/field/field_initializer.carbon @@ -50,7 +50,12 @@ class Class { var field: i32 = 123; } -// CHECK:STDERR: fail_field_initializer_invalid_name.carbon:[[@LINE+2]]:16-35: error: struct `Class` has no field named `not_a_field` [StructInitUnexpectedFieldInLiteral] +// CHECK:STDERR: ╭─┤ fail_field_initializer_invalid_name.carbon:[[@LINE+7]]:16 +// CHECK:STDERR: -> │ var C: Class = {.not_a_field = 456}; +// CHECK:STDERR: · ━━━━━━┳━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: struct `Class` has no field named `not_a_field` +// CHECK:STDERR: · ┃ [StructInitUnexpectedFieldInLiteral] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var C: Class = {.not_a_field = 456}; @@ -58,8 +63,16 @@ var C: Class = {.not_a_field = 456}; library "[[@TEST_NAME]]"; class Class { - // CHECK:STDERR: fail_field_initializer_wrong_type.carbon:[[@LINE+3]]:20-21: error: cannot implicitly convert expression of type `()` to `i32` [ConversionFailure] - // CHECK:STDERR: fail_field_initializer_wrong_type.carbon:[[@LINE+2]]:20-21: note: type `()` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_field_initializer_wrong_type.carbon:[[@LINE+11]]:20 + // CHECK:STDERR: -> │ var field: i32 = (); + // CHECK:STDERR: · ┳━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `()` + // CHECK:STDERR: · │ ┃ to `i32` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `()` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(i32)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var field: i32 = (); } @@ -69,7 +82,13 @@ library "[[@TEST_NAME]]"; var x: i32; class Class { - // CHECK:STDERR: fail_field_initializer_not_constant.carbon:[[@LINE+2]]:20: error: semantics TODO: `field initializer is not constant` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_field_initializer_not_constant.carbon:[[@LINE+8]]:20 + // CHECK:STDERR: -> │ var field: i32 = x; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: + // CHECK:STDERR: · ┃ `field initializer is not constant` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var field: i32 = x; } diff --git a/toolchain/check/testdata/class/field/static.carbon b/toolchain/check/testdata/class/field/static.carbon index 69bd71655d2d..700e3e6b8b41 100644 --- a/toolchain/check/testdata/class/field/static.carbon +++ b/toolchain/check/testdata/class/field/static.carbon @@ -43,8 +43,16 @@ class C { } fn F() { - // CHECK:STDERR: fail_private_static_field_invalid_access.carbon:[[@LINE+3]]:3-16: error: cannot access private member `static_field` of type `C` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_private_static_field_invalid_access.carbon:[[@LINE-5]]:22-38: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_private_static_field_invalid_access.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ private static var static_field: i32; + // CHECK:STDERR: · ────────┬──────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ C.static_field = 123; + // CHECK:STDERR: · ━━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `static_field` of type `C` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: C.static_field = 123; } diff --git a/toolchain/check/testdata/class/generic/adapt.carbon b/toolchain/check/testdata/class/generic/adapt.carbon index 2c30b9520ff8..761c58d985a7 100644 --- a/toolchain/check/testdata/class/generic/adapt.carbon +++ b/toolchain/check/testdata/class/generic/adapt.carbon @@ -52,8 +52,16 @@ class Adapter { fn Access(a: Adapter) -> i32 { // TODO: This should presumably work, but the design doesn't say how yet. - // CHECK:STDERR: fail_todo_extend_adapt_specific_type.carbon:[[@LINE+3]]:10-12: error: cannot implicitly convert expression of type `Adapter` to `C(i32)` [ConversionFailure] - // CHECK:STDERR: fail_todo_extend_adapt_specific_type.carbon:[[@LINE+2]]:10-12: note: type `Adapter` does not implement interface `Core.ImplicitAs(C(i32))` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_todo_extend_adapt_specific_type.carbon:[[@LINE+11]]:10 + // CHECK:STDERR: -> │ return a.x; + // CHECK:STDERR: · ┳━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `Adapter` to + // CHECK:STDERR: · │ ┃ `C(i32)` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Adapter` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(C(i32))` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return a.x; } @@ -81,8 +89,16 @@ import library "extend_adapt_specific_type_library"; fn ImportedAccess(a: Adapter) -> i32 { // TODO: This should presumably work, but the design doesn't say how yet. - // CHECK:STDERR: fail_todo_import_extend_adapt_specific_type.carbon:[[@LINE+3]]:10-12: error: cannot implicitly convert expression of type `Adapter` to `C(i32)` [ConversionFailure] - // CHECK:STDERR: fail_todo_import_extend_adapt_specific_type.carbon:[[@LINE+2]]:10-12: note: type `Adapter` does not implement interface `Core.ImplicitAs(C(i32))` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_todo_import_extend_adapt_specific_type.carbon:[[@LINE+11]]:10 + // CHECK:STDERR: -> │ return a.x; + // CHECK:STDERR: · ┳━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `Adapter` to + // CHECK:STDERR: · │ ┃ `C(i32)` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Adapter` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(C(i32))` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return a.x; } @@ -574,8 +590,8 @@ fn ImportedConvertLocal(a: Adapter(C)) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: %Adapter = name_ref a, %a // CHECK:STDOUT: %x.ref: %C.elem.0b0 = name_ref x, @C.%field_decl [concrete = @C.%field_decl] -// CHECK:STDOUT: %.loc17_11.1: %C.4da = converted %a.ref, [concrete = ] -// CHECK:STDOUT: %.loc17_11.2: %i32 = class_element_access , element0 [concrete = ] +// CHECK:STDOUT: %.loc25_11.1: %C.4da = converted %a.ref, [concrete = ] +// CHECK:STDOUT: %.loc25_11.2: %i32 = class_element_access , element0 [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -824,8 +840,8 @@ fn ImportedConvertLocal(a: Adapter(C)) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: %Adapter = name_ref a, %a // CHECK:STDOUT: %x.ref: %C.elem.0b0 = name_ref x, imports.%Main.import_ref.130 [concrete = imports.%field_decl] -// CHECK:STDOUT: %.loc11_11.1: %C.4da = converted %a.ref, [concrete = ] -// CHECK:STDOUT: %.loc11_11.2: %i32 = class_element_access , element0 [concrete = ] +// CHECK:STDOUT: %.loc19_11.1: %C.4da = converted %a.ref, [concrete = ] +// CHECK:STDOUT: %.loc19_11.2: %i32 = class_element_access , element0 [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/generic/base_is_generic.carbon b/toolchain/check/testdata/class/generic/base_is_generic.carbon index 5d6f4580ea5f..92c05b864809 100644 --- a/toolchain/check/testdata/class/generic/base_is_generic.carbon +++ b/toolchain/check/testdata/class/generic/base_is_generic.carbon @@ -47,7 +47,13 @@ fn ImportedDoubleFieldAccess(d: Derived) -> i32 { library "[[@TEST_NAME]]"; class C(T: type) { - // CHECK:STDERR: fail_todo_extend_symbolic_base.carbon:[[@LINE+2]]:16: error: deriving from final type `T`; base type must be an `abstract` or `base` class [BaseIsFinal] + // CHECK:STDERR: ╭─┤ fail_todo_extend_symbolic_base.carbon:[[@LINE+8]]:16 + // CHECK:STDERR: -> │ extend base: T; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: deriving from final type `T`; base type must be an + // CHECK:STDERR: · ┃ `abstract` or `base` class + // CHECK:STDERR: · ┃ [BaseIsFinal] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend base: T; } @@ -518,14 +524,14 @@ fn H() { // CHECK:STDOUT: // CHECK:STDOUT: class { // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc4_10.2 [symbolic = %T.loc4_10.1 (constants.%T)] -// CHECK:STDOUT: %.loc7: = base_decl , element0 [concrete] +// CHECK:STDOUT: %.loc13: = base_decl , element0 [concrete] // CHECK:STDOUT: %complete_type: = complete_type_witness [concrete = ] // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C.04a // CHECK:STDOUT: .T = -// CHECK:STDOUT: .base = %.loc7 +// CHECK:STDOUT: .base = %.loc13 // CHECK:STDOUT: .G = // CHECK:STDOUT: has_error // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/generic/call.carbon b/toolchain/check/testdata/class/generic/call.carbon index 2118f0afabaa..afddabb189d3 100644 --- a/toolchain/check/testdata/class/generic/call.carbon +++ b/toolchain/check/testdata/class/generic/call.carbon @@ -29,8 +29,16 @@ library "[[@TEST_NAME]]"; class Class(T: type, N: i32) {} -// CHECK:STDERR: fail_too_few.carbon:[[@LINE+3]]:8-18: error: 1 argument passed to generic class expecting 2 arguments [CallArgCountMismatch] -// CHECK:STDERR: fail_too_few.carbon:[[@LINE-3]]:1-30: note: calling generic class declared here [InCallToEntity] +// CHECK:STDERR: ╭─┤ fail_too_few.carbon:[[@LINE+11]]:8 +// CHECK:STDERR: │ class Class(T: type, N: i32) {} +// CHECK:STDERR: · ───────────────┬────────────── +// CHECK:STDERR: · ╰──┤ calling generic class declared here [InCallToEntity] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ var a: Class(i32*); +// CHECK:STDERR: · ━━━━━┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: 1 argument passed to generic class expecting 2 arguments +// CHECK:STDERR: · ┃ [CallArgCountMismatch] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var a: Class(i32*); @@ -40,8 +48,16 @@ library "[[@TEST_NAME]]"; class Class(T: type, N: i32) {} -// CHECK:STDERR: fail_too_many.carbon:[[@LINE+3]]:8-24: error: 3 arguments passed to generic class expecting 2 arguments [CallArgCountMismatch] -// CHECK:STDERR: fail_too_many.carbon:[[@LINE-3]]:1-30: note: calling generic class declared here [InCallToEntity] +// CHECK:STDERR: ╭─┤ fail_too_many.carbon:[[@LINE+11]]:8 +// CHECK:STDERR: │ class Class(T: type, N: i32) {} +// CHECK:STDERR: · ───────────────┬────────────── +// CHECK:STDERR: · ╰──┤ calling generic class declared here [InCallToEntity] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ var a: Class(i32*, 1, 2); +// CHECK:STDERR: · ━━━━┳━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: 3 arguments passed to generic class expecting 2 arguments +// CHECK:STDERR: · ┃ [CallArgCountMismatch] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var a: Class(i32*, 1, 2); @@ -51,9 +67,21 @@ library "[[@TEST_NAME]]"; class Class(T: type, N: i32) {} -// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+4]]:8-21: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet] -// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+3]]:8-21: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE-4]]:13-19: note: initializing generic parameter `T` declared here [InitializingGenericParam] +// CHECK:STDERR: ╭─┤ fail_no_conversion.carbon:[[@LINE+16]]:8 +// CHECK:STDERR: │ class Class(T: type, N: i32) {} +// CHECK:STDERR: · ───┬─── +// CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here +// CHECK:STDERR: · │ [InitializingGenericParam] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ var a: Class(5, i32*); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert non-type value of type +// CHECK:STDERR: · │ ┃ `Core.IntLiteral` to `type` +// CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet] +// CHECK:STDERR: · ╰────┤ type `Core.IntLiteral` does not implement interface +// CHECK:STDERR: · │ `Core.ImplicitAs(type)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var a: Class(5, i32*); @@ -551,7 +579,7 @@ class Outer(T: type) { // CHECK:STDOUT: %int_5: Core.IntLiteral = int_value 5 [concrete = constants.%int_5] // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %ptr: type = ptr_type %i32 [concrete = constants.%ptr] -// CHECK:STDOUT: %.loc10: type = converted %int_5, [concrete = ] +// CHECK:STDOUT: %.loc22: type = converted %int_5, [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: %a: = wrapper_binding a, [concrete = ] // CHECK:STDOUT: name_binding_decl { diff --git a/toolchain/check/testdata/class/generic/complete_in_conversion.carbon b/toolchain/check/testdata/class/generic/complete_in_conversion.carbon index 3499ab91d05a..e53600ab0795 100644 --- a/toolchain/check/testdata/class/generic/complete_in_conversion.carbon +++ b/toolchain/check/testdata/class/generic/complete_in_conversion.carbon @@ -25,8 +25,16 @@ class A(N: i32) { } fn F(a: A(0)*) { - // CHECK:STDERR: fail_derived_to_base.carbon:[[@LINE+3]]:22: error: unable to monomorphize specific `A(0)` [ResolvingSpecificHere] - // CHECK:STDERR: fail_derived_to_base.carbon:[[@LINE-5]]:10-15: note: integer type width of 0 is not positive [IntWidthNotPositive] + // CHECK:STDERR: ╭─┤ fail_derived_to_base.carbon:[[@LINE+11]]:22 + // CHECK:STDERR: │ var n: Int(N); + // CHECK:STDERR: · ───┬── + // CHECK:STDERR: · ╰──┤ integer type width of 0 is not positive [IntWidthNotPositive] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ let unused b: B* = a; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: unable to monomorphize specific `A(0)` + // CHECK:STDERR: · ┃ [ResolvingSpecificHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused b: B* = a; } @@ -247,15 +255,15 @@ fn F(a: A(0)*) { // CHECK:STDOUT: fn @F(%a.param: %ptr.0b6) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: %ptr.0b6 = name_ref a, %a -// CHECK:STDOUT: %.loc16_22.1: ref %A.10a = deref %a.ref -// CHECK:STDOUT: %.loc16_22.2: ref %B = class_element_access %.loc16_22.1, element0 -// CHECK:STDOUT: %addr: %ptr.432 = addr_of %.loc16_22.2 -// CHECK:STDOUT: %.loc16_22.3: %ptr.432 = converted %a.ref, %addr -// CHECK:STDOUT: %.loc16_18: type = splice_block %ptr.loc16 [concrete = constants.%ptr.432] { +// CHECK:STDOUT: %.loc24_22.1: ref %A.10a = deref %a.ref +// CHECK:STDOUT: %.loc24_22.2: ref %B = class_element_access %.loc24_22.1, element0 +// CHECK:STDOUT: %addr: %ptr.432 = addr_of %.loc24_22.2 +// CHECK:STDOUT: %.loc24_22.3: %ptr.432 = converted %a.ref, %addr +// CHECK:STDOUT: %.loc24_18: type = splice_block %ptr.loc24 [concrete = constants.%ptr.432] { // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B] -// CHECK:STDOUT: %ptr.loc16: type = ptr_type %B.ref [concrete = constants.%ptr.432] +// CHECK:STDOUT: %ptr.loc24: type = ptr_type %B.ref [concrete = constants.%ptr.432] // CHECK:STDOUT: } -// CHECK:STDOUT: %b: %ptr.432 = wrapper_binding b, %.loc16_22.3 +// CHECK:STDOUT: %b: %ptr.432 = wrapper_binding b, %.loc24_22.3 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %b.patt: %pattern_type.3c8 = value_binding_pattern b [concrete = constants.%b.patt] // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/generic/generic_vs_params.carbon b/toolchain/check/testdata/class/generic/generic_vs_params.carbon index 6295230c6d03..9af2d8aeb92d 100644 --- a/toolchain/check/testdata/class/generic/generic_vs_params.carbon +++ b/toolchain/check/testdata/class/generic/generic_vs_params.carbon @@ -37,7 +37,12 @@ var e: C(X).GenericAndParams(X) = {}; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_non_generic_implicit_params.carbon:[[@LINE+2]]:9-23: error: parameters of generic types must be constant [GenericParamMustBeConstant] +// CHECK:STDERR: ╭─┤ fail_non_generic_implicit_params.carbon:[[@LINE+7]]:9 +// CHECK:STDERR: -> │ class A[runtime T: type]() {} +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: parameters of generic types must be constant +// CHECK:STDERR: · ┃ [GenericParamMustBeConstant] +// CHECK:STDERR: ╰──── // CHECK:STDERR: class A[runtime T: type]() {} @@ -45,7 +50,12 @@ class A[runtime T: type]() {} library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_non_generic_params.carbon:[[@LINE+2]]:9-23: error: parameters of generic types must be constant [GenericParamMustBeConstant] +// CHECK:STDERR: ╭─┤ fail_non_generic_params.carbon:[[@LINE+7]]:9 +// CHECK:STDERR: -> │ class A(runtime T: type) {} +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: parameters of generic types must be constant +// CHECK:STDERR: · ┃ [GenericParamMustBeConstant] +// CHECK:STDERR: ╰──── // CHECK:STDERR: class A(runtime T: type) {} @@ -58,7 +68,12 @@ fn F(generic T: type) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_implicit_params_only_empty.carbon:[[@LINE+2]]:10-11: error: expected explicit parameters after implicit parameters [GenericMissingExplicitParameters] +// CHECK:STDERR: ╭─┤ fail_implicit_params_only_empty.carbon:[[@LINE+7]]:10 +// CHECK:STDERR: -> │ class Foo[]; +// CHECK:STDERR: · ━┳ +// CHECK:STDERR: · ┗━━┫ error: expected explicit parameters after implicit parameters +// CHECK:STDERR: · ┃ [GenericMissingExplicitParameters] +// CHECK:STDERR: ╰──── // CHECK:STDERR: class Foo[]; @@ -66,7 +81,12 @@ class Foo[]; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_implicit_params_only.carbon:[[@LINE+2]]:10-18: error: expected explicit parameters after implicit parameters [GenericMissingExplicitParameters] +// CHECK:STDERR: ╭─┤ fail_implicit_params_only.carbon:[[@LINE+7]]:10 +// CHECK:STDERR: -> │ class Foo[T: type]; +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: expected explicit parameters after implicit parameters +// CHECK:STDERR: · ┃ [GenericMissingExplicitParameters] +// CHECK:STDERR: ╰──── // CHECK:STDERR: class Foo[T: type]; @@ -434,13 +454,13 @@ class Foo[T: type]; // CHECK:STDOUT: } // CHECK:STDOUT: %A.decl: %A.type = class_decl @A [concrete = constants.%A.generic] {} {} // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] { -// CHECK:STDOUT: %T.patt.loc9_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc9_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.patt.loc14_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc14_15.2 (constants.%T.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc9_17.1: type = splice_block %.loc9_17.2 [concrete = type] { +// CHECK:STDOUT: %.loc14_17.1: type = splice_block %.loc14_17.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc9_17.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc14_17.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc9_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc9_15.1 (constants.%T)] +// CHECK:STDOUT: %T.loc14_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc14_15.1 (constants.%T)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -452,24 +472,24 @@ class Foo[T: type]; // CHECK:STDOUT: .Self = constants.%A // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @F(%T.loc9_15.2: type) { -// CHECK:STDOUT: %T.patt.loc9_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc9_15.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc9_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc9_15.1 (constants.%T)] +// CHECK:STDOUT: generic fn @F(%T.loc14_15.2: type) { +// CHECK:STDOUT: %T.patt.loc14_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc14_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc14_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc14_15.1 (constants.%T)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: // CHECK:STDOUT: fn() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %A.ref: %A.type = name_ref A, file.%A.decl [concrete = constants.%A.generic] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc9_15.2 [symbolic = %T.loc9_15.1 (constants.%T)] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc14_15.2 [symbolic = %T.loc14_15.1 (constants.%T)] // CHECK:STDOUT: %A: type = class_type @A [concrete = constants.%A] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @F(constants.%T) { -// CHECK:STDOUT: %T.patt.loc9_15.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc9_15.1 => constants.%T +// CHECK:STDOUT: %T.patt.loc14_15.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc14_15.1 => constants.%T // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_implicit_params_only_empty.carbon @@ -506,25 +526,25 @@ class Foo[T: type]; // CHECK:STDOUT: .Foo = %Foo.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Foo.decl: %Foo.type = class_decl @Foo [concrete = constants.%Foo.generic] { -// CHECK:STDOUT: %T.patt.loc6_12.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_12.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.patt.loc11_12.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_12.2 (constants.%T.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc6_14.1: type = splice_block %.loc6_14.2 [concrete = type] { +// CHECK:STDOUT: %.loc11_14.1: type = splice_block %.loc11_14.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc6_14.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc11_14.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc6_12.2: type = symbolic_binding T, 0 [symbolic = %T.loc6_12.1 (constants.%T)] +// CHECK:STDOUT: %T.loc11_12.2: type = symbolic_binding T, 0 [symbolic = %T.loc11_12.1 (constants.%T)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic class @Foo(%T.loc6_12.2: type) { -// CHECK:STDOUT: %T.patt.loc6_12.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_12.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc6_12.1: type = symbolic_binding T, 0 [symbolic = %T.loc6_12.1 (constants.%T)] +// CHECK:STDOUT: generic class @Foo(%T.loc11_12.2: type) { +// CHECK:STDOUT: %T.patt.loc11_12.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_12.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc11_12.1: type = symbolic_binding T, 0 [symbolic = %T.loc11_12.1 (constants.%T)] // CHECK:STDOUT: // CHECK:STDOUT: class; // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Foo(constants.%T) { -// CHECK:STDOUT: %T.patt.loc6_12.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc6_12.1 => constants.%T +// CHECK:STDOUT: %T.patt.loc11_12.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc11_12.1 => constants.%T // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/generic/import.carbon b/toolchain/check/testdata/class/generic/import.carbon index 79352005de91..2d746f24e01c 100644 --- a/toolchain/check/testdata/class/generic/import.carbon +++ b/toolchain/check/testdata/class/generic/import.carbon @@ -58,8 +58,16 @@ library "[[@TEST_NAME]]"; import library "foo"; fn Use() { - // CHECK:STDERR: fail_generic_arg_mismatch.carbon:[[@LINE+3]]:3-35: error: cannot implicitly convert expression of type `CompleteClass(i32)` to `CompleteClass(i32*)` [ConversionFailure] - // CHECK:STDERR: fail_generic_arg_mismatch.carbon:[[@LINE+2]]:3-35: note: type `CompleteClass(i32)` does not implement interface `Core.ImplicitAs(CompleteClass(i32*))` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_generic_arg_mismatch.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: -> │ var unused v: CompleteClass(i32*) = F(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `CompleteClass(i32)` + // CHECK:STDERR: · │ ┃ to `CompleteClass(i32*)` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `CompleteClass(i32)` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(CompleteClass(i32*))` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused v: CompleteClass(i32*) = F(); } @@ -68,11 +76,25 @@ fn Use() { impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_foo.impl.carbon:[[@LINE+3]]:13-19: error: redeclaration differs at parameter 1 [RedeclParamDiffers] -// CHECK:STDERR: foo.carbon:4:13-19: note: previous declaration's corresponding parameter here [RedeclParamPrevious] +// CHECK:STDERR: ╭─┤ fail_foo.impl.carbon:[[@LINE+13]]:13 +// CHECK:STDERR: -> │ class Class(U: type) { +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration differs at parameter 1 +// CHECK:STDERR: · ┃ [RedeclParamDiffers] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ foo.carbon +// CHECK:STDERR: │ class Class(T: type); +// CHECK:STDERR: · ───┬─── +// CHECK:STDERR: · ╰──┤ previous declaration's corresponding parameter here +// CHECK:STDERR: · │ [RedeclParamPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: class Class(U: type) { - // CHECK:STDERR: fail_foo.impl.carbon:[[@LINE+2]]:10: error: name `T` not found [NameNotFound] + // CHECK:STDERR: ╭─┤ fail_foo.impl.carbon:[[@LINE+6]]:10 + // CHECK:STDERR: -> │ var x: T; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: name `T` not found [NameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var x: T; } @@ -796,14 +818,14 @@ class Class(U: type) { // CHECK:STDOUT: %T.09f: %SubobjectDestroy.type = symbolic_binding T, 0 [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.type.dea: type = fn_type @T.as_type.as.DestroyImpl.impl.Op, @T.as_type.as.DestroyImpl.impl(%T.09f) [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.6e5: %T.as_type.as.DestroyImpl.impl.Op.type.dea = struct_value () [symbolic] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.1: type = fn_type @SubobjectDestroy.WithSelf.Op.loc9_3.1 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.1: type = fn_type @SubobjectDestroy.WithSelf.Op.loc17_3.1 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.1: %SubobjectDestroy.WithSelf.Op.type.6870fd.1 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80ef6.1: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.1), @SubobjectDestroy [concrete] // CHECK:STDOUT: %SubobjectDestroy.facet.49a: %SubobjectDestroy.type = facet_value %i32, (%custom_witness.b80ef6.1) [concrete] // CHECK:STDOUT: %DestroyImpl.impl_witness.077: = impl_witness imports.%DestroyImpl.impl_witness_table, @T.as_type.as.DestroyImpl.impl(%SubobjectDestroy.facet.49a) [concrete] // CHECK:STDOUT: %Destroy.facet.c2b: %Destroy.type = facet_value %i32, (%DestroyImpl.impl_witness.077, %custom_witness.b80ef6.1) [concrete] // CHECK:STDOUT: %SelfDestruct.specific_fn.845: = specific_function %SelfDestruct, @SelfDestruct(%Destroy.facet.c2b) [concrete] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.3: type = fn_type @SubobjectDestroy.WithSelf.Op.loc9_3.3 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.3: type = fn_type @SubobjectDestroy.WithSelf.Op.loc17_3.3 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.3: %SubobjectDestroy.WithSelf.Op.type.6870fd.3 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80ef6.3: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.3), @SubobjectDestroy [concrete] // CHECK:STDOUT: %SubobjectDestroy.facet.e3b: %SubobjectDestroy.type = facet_value %CompleteClass.860, (%custom_witness.b80ef6.3) [concrete] @@ -875,11 +897,11 @@ class Class(U: type) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %v.var: ref %CompleteClass.860 = var_storage %v.var_patt // CHECK:STDOUT: %F.ref: %F.type = name_ref F, imports.%Main.F [concrete = constants.%F] -// CHECK:STDOUT: %.loc9_41: ref %CompleteClass.09c = temporary_storage -// CHECK:STDOUT: %F.call: init %CompleteClass.09c to %.loc9_41 = call %F.ref() -// CHECK:STDOUT: %.loc9_3.1: %CompleteClass.860 = converted %F.call, [concrete = ] +// CHECK:STDOUT: %.loc17_41: ref %CompleteClass.09c = temporary_storage +// CHECK:STDOUT: %F.call: init %CompleteClass.09c to %.loc17_41 = call %F.ref() +// CHECK:STDOUT: %.loc17_3.1: %CompleteClass.860 = converted %F.call, [concrete = ] // CHECK:STDOUT: assign %v.var, -// CHECK:STDOUT: %.loc9_35: type = splice_block %CompleteClass [concrete = constants.%CompleteClass.860] { +// CHECK:STDOUT: %.loc17_35: type = splice_block %CompleteClass [concrete = constants.%CompleteClass.860] { // CHECK:STDOUT: %CompleteClass.ref: %CompleteClass.type = name_ref CompleteClass, imports.%Main.CompleteClass [concrete = constants.%CompleteClass.generic] // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %ptr: type = ptr_type %i32 [concrete = constants.%ptr.a17] @@ -890,10 +912,10 @@ class Class(U: type) { // CHECK:STDOUT: %v.patt: %pattern_type.c65 = ref_binding_pattern v [concrete = constants.%v.patt] // CHECK:STDOUT: %v.var_patt: %pattern_type.c65 = var_pattern %v.patt [concrete = constants.%v.var_patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.facet.loc9_3.1: %Destroy.type = facet_value constants.%CompleteClass.860, (constants.%DestroyImpl.impl_witness.766, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.336] -// CHECK:STDOUT: %.loc9_3.2: %Destroy.type = converted constants.%CompleteClass.860, %Destroy.facet.loc9_3.1 [concrete = constants.%Destroy.facet.336] -// CHECK:STDOUT: %Destroy.facet.loc9_3.2: %Destroy.type = facet_value constants.%CompleteClass.860, (constants.%DestroyImpl.impl_witness.766, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.336] -// CHECK:STDOUT: %.loc9_3.3: %Destroy.type = converted constants.%CompleteClass.860, %Destroy.facet.loc9_3.2 [concrete = constants.%Destroy.facet.336] +// CHECK:STDOUT: %Destroy.facet.loc17_3.1: %Destroy.type = facet_value constants.%CompleteClass.860, (constants.%DestroyImpl.impl_witness.766, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.336] +// CHECK:STDOUT: %.loc17_3.2: %Destroy.type = converted constants.%CompleteClass.860, %Destroy.facet.loc17_3.1 [concrete = constants.%Destroy.facet.336] +// CHECK:STDOUT: %Destroy.facet.loc17_3.2: %Destroy.type = facet_value constants.%CompleteClass.860, (constants.%DestroyImpl.impl_witness.766, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.336] +// CHECK:STDOUT: %.loc17_3.3: %Destroy.type = converted constants.%CompleteClass.860, %Destroy.facet.loc17_3.2 [concrete = constants.%Destroy.facet.336] // CHECK:STDOUT: %SelfDestruct.specific_fn: = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet.336) [concrete = constants.%SelfDestruct.specific_fn.826] // CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%v.var) // CHECK:STDOUT: return @@ -907,30 +929,30 @@ class Class(U: type) { // CHECK:STDOUT: // CHECK:STDOUT: fn @F [from "foo.carbon"]; // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc9_3.1(%self.param: ref %i32) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc17_3.1(%self.param: ref %i32) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc9_3.2(%self.param: ref %struct_type.n) { +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc17_3.2(%self.param: ref %struct_type.n) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc9_3.1: ref %i32 = struct_access %self.param, element0 -// CHECK:STDOUT: %Destroy.facet.loc9_3.1: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc9_3.2: %Destroy.type = converted constants.%i32, %Destroy.facet.loc9_3.1 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc9_3.2: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc9_3.3: %Destroy.type = converted constants.%i32, %Destroy.facet.loc9_3.2 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc17_3.1: ref %i32 = struct_access %self.param, element0 +// CHECK:STDOUT: %Destroy.facet.loc17_3.1: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc17_3.2: %Destroy.type = converted constants.%i32, %Destroy.facet.loc17_3.1 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc17_3.2: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc17_3.3: %Destroy.type = converted constants.%i32, %Destroy.facet.loc17_3.2 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: %SelfDestruct.specific_fn: = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet.c2b) [concrete = constants.%SelfDestruct.specific_fn.845] -// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc9_3.1) +// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc17_3.1) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc9_3.3(%self.param: ref %CompleteClass.860) { +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc17_3.3(%self.param: ref %CompleteClass.860) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %n.ref: %CompleteClass.elem.609 = name_ref n, imports.%Main.import_ref.14b [concrete = imports.%field_decl] -// CHECK:STDOUT: %.loc9_3.1: ref %i32 = class_element_access %self.param, element0 -// CHECK:STDOUT: %Destroy.facet.loc9_3.1: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc9_3.2: %Destroy.type = converted constants.%i32, %Destroy.facet.loc9_3.1 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc9_3.2: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc9_3.3: %Destroy.type = converted constants.%i32, %Destroy.facet.loc9_3.2 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc17_3.1: ref %i32 = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.facet.loc17_3.1: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc17_3.2: %Destroy.type = converted constants.%i32, %Destroy.facet.loc17_3.1 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc17_3.2: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc17_3.3: %Destroy.type = converted constants.%i32, %Destroy.facet.loc17_3.2 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: %SelfDestruct.specific_fn: = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet.c2b) [concrete = constants.%SelfDestruct.specific_fn.845] -// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc9_3.1) +// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc17_3.1) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -981,9 +1003,9 @@ class Class(U: type) { // CHECK:STDOUT: %Class.generic.d9d1e3.1: %Class.type.e90e5c.1 = struct_value () [concrete] // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic] // CHECK:STDOUT: %T.patt: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic] -// CHECK:STDOUT: %Class.type.e90e5c.2: type = parameterized_class_name_type @Class.loc7 [concrete] +// CHECK:STDOUT: %Class.type.e90e5c.2: type = parameterized_class_name_type @Class.loc17 [concrete] // CHECK:STDOUT: %Class.generic.d9d1e3.2: %Class.type.e90e5c.2 = struct_value () [concrete] -// CHECK:STDOUT: %Class.d9697b.2: type = class_type @Class.loc7, @Class.loc7(%U) [symbolic] +// CHECK:STDOUT: %Class.d9697b.2: type = class_type @Class.loc17, @Class.loc17(%U) [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -1008,14 +1030,14 @@ class Class(U: type) { // CHECK:STDOUT: %default.import.loc2_19.1 = import // CHECK:STDOUT: %default.import.loc2_19.2 = import // CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %Class.decl: %Class.type.e90e5c.2 = class_decl @Class.loc7 [concrete = constants.%Class.generic.d9d1e3.2] { -// CHECK:STDOUT: %U.patt.loc7_14.1: %pattern_type.9a5 = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc7_14.2 (constants.%U.patt)] +// CHECK:STDOUT: %Class.decl: %Class.type.e90e5c.2 = class_decl @Class.loc17 [concrete = constants.%Class.generic.d9d1e3.2] { +// CHECK:STDOUT: %U.patt.loc17_14.1: %pattern_type.9a5 = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc17_14.2 (constants.%U.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc7_16.1: type = splice_block %.loc7_16.2 [concrete = type] { +// CHECK:STDOUT: %.loc17_16.1: type = splice_block %.loc17_16.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc7_16.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc17_16.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %U.loc7_14.2: type = symbolic_binding U, 0 [symbolic = %U.loc7_14.1 (constants.%U)] +// CHECK:STDOUT: %U.loc17_14.2: type = symbolic_binding U, 0 [symbolic = %U.loc17_14.1 (constants.%U)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1026,9 +1048,9 @@ class Class(U: type) { // CHECK:STDOUT: class; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic class @Class.loc7(%U.loc7_14.2: type) { -// CHECK:STDOUT: %U.patt.loc7_14.2: %pattern_type.9a5 = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc7_14.2 (constants.%U.patt)] -// CHECK:STDOUT: %U.loc7_14.1: type = symbolic_binding U, 0 [symbolic = %U.loc7_14.1 (constants.%U)] +// CHECK:STDOUT: generic class @Class.loc17(%U.loc17_14.2: type) { +// CHECK:STDOUT: %U.patt.loc17_14.2: %pattern_type.9a5 = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc17_14.2 (constants.%U.patt)] +// CHECK:STDOUT: %U.loc17_14.1: type = symbolic_binding U, 0 [symbolic = %U.loc17_14.1 (constants.%U)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -1051,8 +1073,8 @@ class Class(U: type) { // CHECK:STDOUT: %T => constants.%T // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Class.loc7(constants.%U) { -// CHECK:STDOUT: %U.patt.loc7_14.2 => constants.%U.patt -// CHECK:STDOUT: %U.loc7_14.1 => constants.%U +// CHECK:STDOUT: specific @Class.loc17(constants.%U) { +// CHECK:STDOUT: %U.patt.loc17_14.2 => constants.%U.patt +// CHECK:STDOUT: %U.loc17_14.1 => constants.%U // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/generic/member_inline.carbon b/toolchain/check/testdata/class/generic/member_inline.carbon index 8b3220b24d0e..1c5c10565859 100644 --- a/toolchain/check/testdata/class/generic/member_inline.carbon +++ b/toolchain/check/testdata/class/generic/member_inline.carbon @@ -35,7 +35,11 @@ library "[[@TEST_NAME]]"; //@dump-sem-ir-begin class C(T: Core.Copy) { fn F() { - // CHECK:STDERR: fail_member_inline_missing_self_dot.carbon:[[@LINE+2]]:5-8: error: expression cannot be used as a value [UseOfNonExprAsValue] + // CHECK:STDERR: ╭─┤ fail_member_inline_missing_self_dot.carbon:[[@LINE+6]]:5 + // CHECK:STDERR: -> │ data; + // CHECK:STDERR: · ━━┳━ + // CHECK:STDERR: · ┗━━┫ error: expression cannot be used as a value [UseOfNonExprAsValue] + // CHECK:STDERR: ╰──── // CHECK:STDERR: data; } @@ -349,9 +353,9 @@ class C(T: Core.Copy) { // CHECK:STDOUT: // CHECK:STDOUT: class { // CHECK:STDOUT: %C.F.decl: @C.%C.F.type (%C.F.type) = fn_decl @C.F [symbolic = @C.%C.F (constants.%C.F)] {} {} -// CHECK:STDOUT: %field_decl: @C.%C.elem (%C.elem) = field_decl data, element0, %.loc11_14.2 in [concrete] { -// CHECK:STDOUT: %.loc11_14.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc11_14.2: type = converted %.loc11_14.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %field_decl: @C.%C.elem (%C.elem) = field_decl data, element0, %.loc15_14.2 in [concrete] { +// CHECK:STDOUT: %.loc15_14.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc15_14.2: type = converted %.loc15_14.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: } // CHECK:STDOUT: %complete_type: = complete_type_witness constants.%struct_type.data [concrete = constants.%complete_type] // CHECK:STDOUT: complete_type_witness = %complete_type @@ -371,8 +375,8 @@ class C(T: Core.Copy) { // CHECK:STDOUT: // CHECK:STDOUT: fn() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc9: @C.F.%C.elem (%C.elem) = specific_constant @C.%field_decl, @C(constants.%T) [concrete = @C.%field_decl] -// CHECK:STDOUT: %data.ref: @C.F.%C.elem (%C.elem) = name_ref data, %.loc9 [concrete = @C.%field_decl] +// CHECK:STDOUT: %.loc13: @C.F.%C.elem (%C.elem) = specific_constant @C.%field_decl, @C(constants.%T) [concrete = @C.%field_decl] +// CHECK:STDOUT: %data.ref: @C.F.%C.elem (%C.elem) = name_ref data, %.loc13 [concrete = @C.%field_decl] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/generic/member_lookup.carbon b/toolchain/check/testdata/class/generic/member_lookup.carbon index cb7232d88cd1..9bfe507c34b9 100644 --- a/toolchain/check/testdata/class/generic/member_lookup.carbon +++ b/toolchain/check/testdata/class/generic/member_lookup.carbon @@ -53,19 +53,34 @@ class Derived(T: type) { } fn AccessMissingBase[T: type](x: Base(T)) -> T { - // CHECK:STDERR: fail_no_member.carbon:[[@LINE+2]]:10-19: error: member name `nonesuch` not found in `Base(T)` [MemberNameNotFoundInSpecificScope] + // CHECK:STDERR: ╭─┤ fail_no_member.carbon:[[@LINE+7]]:10 + // CHECK:STDERR: -> │ return x.nonesuch; + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: member name `nonesuch` not found in `Base(T)` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInSpecificScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return x.nonesuch; } fn AccessMissingDerived[T: type](x: Derived(T)) -> T { - // CHECK:STDERR: fail_no_member.carbon:[[@LINE+2]]:10-19: error: member name `nonesuch` not found in `Derived(T)` [MemberNameNotFoundInSpecificScope] + // CHECK:STDERR: ╭─┤ fail_no_member.carbon:[[@LINE+7]]:10 + // CHECK:STDERR: -> │ return x.nonesuch; + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: member name `nonesuch` not found in `Derived(T)` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInSpecificScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return x.nonesuch; } fn AccessMissingConcrete(x: Derived(i32)) -> i32 { - // CHECK:STDERR: fail_no_member.carbon:[[@LINE+2]]:10-19: error: member name `nonesuch` not found in `Derived(i32)` [MemberNameNotFoundInSpecificScope] + // CHECK:STDERR: ╭─┤ fail_no_member.carbon:[[@LINE+7]]:10 + // CHECK:STDERR: -> │ return x.nonesuch; + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: member name `nonesuch` not found in `Derived(i32)` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInSpecificScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return x.nonesuch; } diff --git a/toolchain/check/testdata/class/generic/member_out_of_line.carbon b/toolchain/check/testdata/class/generic/member_out_of_line.carbon index 34cf1ec0865e..1af13a1f85f7 100644 --- a/toolchain/check/testdata/class/generic/member_out_of_line.carbon +++ b/toolchain/check/testdata/class/generic/member_out_of_line.carbon @@ -52,8 +52,17 @@ class NotGeneric { fn F(); } -// CHECK:STDERR: fail_mismatched_not_generic_vs_generic.carbon:[[@LINE+3]]:4-13: error: redeclaration differs because of parameter list [RedeclParamListDiffers] -// CHECK:STDERR: fail_mismatched_not_generic_vs_generic.carbon:[[@LINE-5]]:1-18: note: previously declared without parameter list [RedeclParamListPrevious] +// CHECK:STDERR: ╭─┤ fail_mismatched_not_generic_vs_generic.carbon:[[@LINE+12]]:4 +// CHECK:STDERR: │ class NotGeneric { +// CHECK:STDERR: · ─────────┬──────── +// CHECK:STDERR: · ╰──┤ previously declared without parameter list +// CHECK:STDERR: · │ [RedeclParamListPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn NotGeneric(unused T: type).F() {} +// CHECK:STDERR: · ━━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration differs because of parameter list +// CHECK:STDERR: · ┃ [RedeclParamListDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn NotGeneric(unused T: type).F() {} @@ -65,8 +74,17 @@ class Generic(unused T: type) { fn TooFew(); } -// CHECK:STDERR: fail_mismatched_too_few_args.carbon:[[@LINE+3]]:4-10: error: redeclaration differs because of parameter count of 0 [RedeclParamCountDiffers] -// CHECK:STDERR: fail_mismatched_too_few_args.carbon:[[@LINE-5]]:1-31: note: previously declared with parameter count of 1 [RedeclParamCountPrevious] +// CHECK:STDERR: ╭─┤ fail_mismatched_too_few_args.carbon:[[@LINE+12]]:4 +// CHECK:STDERR: │ class Generic(unused T: type) { +// CHECK:STDERR: · ───────────────┬─────────────── +// CHECK:STDERR: · ╰──┤ previously declared with parameter count of 1 +// CHECK:STDERR: · │ [RedeclParamCountPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn Generic().TooFew() {} +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration differs because of parameter count of 0 +// CHECK:STDERR: · ┃ [RedeclParamCountDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Generic().TooFew() {} @@ -78,8 +96,17 @@ class Generic(T: type) { fn TooMany(); } -// CHECK:STDERR: fail_mismatched_too_many_args.carbon:[[@LINE+3]]:4-10: error: redeclaration differs because of parameter count of 2 [RedeclParamCountDiffers] -// CHECK:STDERR: fail_mismatched_too_many_args.carbon:[[@LINE-5]]:1-24: note: previously declared with parameter count of 1 [RedeclParamCountPrevious] +// CHECK:STDERR: ╭─┤ fail_mismatched_too_many_args.carbon:[[@LINE+12]]:4 +// CHECK:STDERR: │ class Generic(T: type) { +// CHECK:STDERR: · ────────────┬─────────── +// CHECK:STDERR: · ╰──┤ previously declared with parameter count of 1 +// CHECK:STDERR: · │ [RedeclParamCountPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn Generic(unused T: type, unused U: type).TooMany() {} +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration differs because of parameter count of 2 +// CHECK:STDERR: · ┃ [RedeclParamCountDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Generic(unused T: type, unused U: type).TooMany() {} @@ -91,8 +118,19 @@ class Generic(unused T: type) { fn WrongType(); } -// CHECK:STDERR: fail_mismatched_wrong_arg_type.carbon:[[@LINE+3]]:19-23: error: type `` of parameter 1 in redeclaration differs from previous parameter type `` [RedeclParamDiffersType] -// CHECK:STDERR: fail_mismatched_wrong_arg_type.carbon:[[@LINE-5]]:22-28: note: previous declaration's corresponding parameter here [RedeclParamPrevious] +// CHECK:STDERR: ╭─┤ fail_mismatched_wrong_arg_type.carbon:[[@LINE+14]]:19 +// CHECK:STDERR: │ class Generic(unused T: type) { +// CHECK:STDERR: · ───┬─── +// CHECK:STDERR: · ╰──┤ previous declaration's corresponding parameter here +// CHECK:STDERR: · │ [RedeclParamPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn Generic(unused T: ()).WrongType() {} +// CHECK:STDERR: · ┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: type `` of parameter 1 in +// CHECK:STDERR: · ┃ redeclaration differs from previous parameter type +// CHECK:STDERR: · ┃ `` +// CHECK:STDERR: · ┃ [RedeclParamDiffersType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Generic(unused T: ()).WrongType() {} diff --git a/toolchain/check/testdata/class/generic/redeclare.carbon b/toolchain/check/testdata/class/generic/redeclare.carbon index 77f51ede79de..e09578064567 100644 --- a/toolchain/check/testdata/class/generic/redeclare.carbon +++ b/toolchain/check/testdata/class/generic/redeclare.carbon @@ -26,8 +26,16 @@ class Generic(T: type) { library "[[@TEST_NAME]]"; class A; -// CHECK:STDERR: fail_mismatch_param_list.carbon:[[@LINE+3]]:1-18: error: redeclaration differs because of parameter list [RedeclParamListDiffers] -// CHECK:STDERR: fail_mismatch_param_list.carbon:[[@LINE-2]]:1-8: note: previously declared without parameter list [RedeclParamListPrevious] +// CHECK:STDERR: ╭─┤ fail_mismatch_param_list.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: │ class A; +// CHECK:STDERR: · ────┬─── +// CHECK:STDERR: · ╰──┤ previously declared without parameter list [RedeclParamListPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ class A(T: type) {} +// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration differs because of parameter list +// CHECK:STDERR: · ┃ [RedeclParamListDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: class A(T: type) {} @@ -38,8 +46,17 @@ library "[[@TEST_NAME]]"; class A {} class B(N: A); -// CHECK:STDERR: fail_mismatch_implicit_param_list.carbon:[[@LINE+3]]:1-24: error: redeclaration differs because of implicit parameter list [RedeclParamListDiffers] -// CHECK:STDERR: fail_mismatch_implicit_param_list.carbon:[[@LINE-2]]:1-14: note: previously declared without implicit parameter list [RedeclParamListPrevious] +// CHECK:STDERR: ╭─┤ fail_mismatch_implicit_param_list.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: │ class B(N: A); +// CHECK:STDERR: · ───────┬────── +// CHECK:STDERR: · ╰──┤ previously declared without implicit parameter list +// CHECK:STDERR: · │ [RedeclParamListPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ class B[T: type](N: T) {} +// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration differs because of implicit parameter list +// CHECK:STDERR: · ┃ [RedeclParamListDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: class B[T: type](N: T) {} @@ -50,8 +67,17 @@ library "[[@TEST_NAME]]"; class A {} class C(T: type); -// CHECK:STDERR: fail_mismatch_param_count.carbon:[[@LINE+3]]:1-24: error: redeclaration differs because of parameter count of 2 [RedeclParamCountDiffers] -// CHECK:STDERR: fail_mismatch_param_count.carbon:[[@LINE-2]]:1-17: note: previously declared with parameter count of 1 [RedeclParamCountPrevious] +// CHECK:STDERR: ╭─┤ fail_mismatch_param_count.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: │ class C(T: type); +// CHECK:STDERR: · ────────┬──────── +// CHECK:STDERR: · ╰──┤ previously declared with parameter count of 1 +// CHECK:STDERR: · │ [RedeclParamCountPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ class C(T: type, U: A) {} +// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration differs because of parameter count of 2 +// CHECK:STDERR: · ┃ [RedeclParamCountDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: class C(T: type, U: A) {} @@ -62,8 +88,18 @@ library "[[@TEST_NAME]]"; class A {} class D(T: type); -// CHECK:STDERR: fail_mismatch_param_type.carbon:[[@LINE+3]]:9-12: error: type `` of parameter 1 in redeclaration differs from previous parameter type `` [RedeclParamDiffersType] -// CHECK:STDERR: fail_mismatch_param_type.carbon:[[@LINE-2]]:9-15: note: previous declaration's corresponding parameter here [RedeclParamPrevious] +// CHECK:STDERR: ╭─┤ fail_mismatch_param_type.carbon:[[@LINE+13]]:9 +// CHECK:STDERR: │ class D(T: type); +// CHECK:STDERR: · ───┬─── +// CHECK:STDERR: · ╰──┤ previous declaration's corresponding parameter here +// CHECK:STDERR: · │ [RedeclParamPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ class D(T: A) {} +// CHECK:STDERR: · ┳━━━ +// CHECK:STDERR: · ┗━━┫ error: type `` of parameter 1 in redeclaration +// CHECK:STDERR: · ┃ differs from previous parameter type `` +// CHECK:STDERR: · ┃ [RedeclParamDiffersType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: class D(T: A) {} @@ -72,8 +108,16 @@ class D(T: A) {} library "[[@TEST_NAME]]"; class E(T: type); -// CHECK:STDERR: fail_mismatch_param_name.carbon:[[@LINE+3]]:9-15: error: redeclaration differs at parameter 1 [RedeclParamDiffers] -// CHECK:STDERR: fail_mismatch_param_name.carbon:[[@LINE-2]]:9-15: note: previous declaration's corresponding parameter here [RedeclParamPrevious] +// CHECK:STDERR: ╭─┤ fail_mismatch_param_name.carbon:[[@LINE+11]]:9 +// CHECK:STDERR: │ class E(T: type); +// CHECK:STDERR: · ───┬─── +// CHECK:STDERR: · ╰──┤ previous declaration's corresponding parameter here +// CHECK:STDERR: · │ [RedeclParamPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ class E(U: type) {} +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration differs at parameter 1 [RedeclParamDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: class E(U: type) {} @@ -154,9 +198,9 @@ class E(U: type) {} // CHECK:STDOUT: %pattern_type: type = pattern_type type [concrete] // CHECK:STDOUT: %T.patt: %pattern_type = symbolic_binding_pattern T, 0 [symbolic] // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic] -// CHECK:STDOUT: %A.type: type = parameterized_class_name_type @A.loc8 [concrete] +// CHECK:STDOUT: %A.type: type = parameterized_class_name_type @A.loc16 [concrete] // CHECK:STDOUT: %A.generic: %A.type = struct_value () [concrete] -// CHECK:STDOUT: %A.59f: type = class_type @A.loc8, @A.loc8(%T) [symbolic] +// CHECK:STDOUT: %A.59f: type = class_type @A.loc16, @A.loc16(%T) [symbolic] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] // CHECK:STDOUT: } @@ -175,22 +219,22 @@ class E(U: type) {} // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %A.decl.loc4: type = class_decl @A.loc4 [concrete = constants.%A.5a2] {} {} -// CHECK:STDOUT: %A.decl.loc8: %A.type = class_decl @A.loc8 [concrete = constants.%A.generic] { -// CHECK:STDOUT: %T.patt.loc8_10.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_10.2 (constants.%T.patt)] +// CHECK:STDOUT: %A.decl.loc16: %A.type = class_decl @A.loc16 [concrete = constants.%A.generic] { +// CHECK:STDOUT: %T.patt.loc16_10.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc16_10.2 (constants.%T.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc8_12.1: type = splice_block %.loc8_12.2 [concrete = type] { +// CHECK:STDOUT: %.loc16_12.1: type = splice_block %.loc16_12.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc8_12.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc16_12.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc8_10.2: type = symbolic_binding T, 0 [symbolic = %T.loc8_10.1 (constants.%T)] +// CHECK:STDOUT: %T.loc16_10.2: type = symbolic_binding T, 0 [symbolic = %T.loc16_10.1 (constants.%T)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @A.loc4; // CHECK:STDOUT: -// CHECK:STDOUT: generic class @A.loc8(%T.loc8_10.2: type) { -// CHECK:STDOUT: %T.patt.loc8_10.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_10.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc8_10.1: type = symbolic_binding T, 0 [symbolic = %T.loc8_10.1 (constants.%T)] +// CHECK:STDOUT: generic class @A.loc16(%T.loc16_10.2: type) { +// CHECK:STDOUT: %T.patt.loc16_10.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc16_10.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc16_10.1: type = symbolic_binding T, 0 [symbolic = %T.loc16_10.1 (constants.%T)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -203,9 +247,9 @@ class E(U: type) {} // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @A.loc8(constants.%T) { -// CHECK:STDOUT: %T.patt.loc8_10.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc8_10.1 => constants.%T +// CHECK:STDOUT: specific @A.loc16(constants.%T) { +// CHECK:STDOUT: %T.patt.loc16_10.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc16_10.1 => constants.%T // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_mismatch_implicit_param_list.carbon @@ -227,9 +271,9 @@ class E(U: type) {} // CHECK:STDOUT: %pattern_type.51d: type = pattern_type %T [symbolic] // CHECK:STDOUT: %N.patt.9f0: %pattern_type.51d = symbolic_binding_pattern N, 1 [symbolic] // CHECK:STDOUT: %N.bd9: %T = symbolic_binding N, 1 [symbolic] -// CHECK:STDOUT: %B.type.7c49ec.2: type = parameterized_class_name_type @B.loc10 [concrete] +// CHECK:STDOUT: %B.type.7c49ec.2: type = parameterized_class_name_type @B.loc19 [concrete] // CHECK:STDOUT: %B.generic.4b73a1.2: %B.type.7c49ec.2 = struct_value () [concrete] -// CHECK:STDOUT: %B.cb8: type = class_type @B.loc10, @B.loc10(%T, %N.bd9) [symbolic] +// CHECK:STDOUT: %B.cb8: type = class_type @B.loc19, @B.loc19(%T, %N.bd9) [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -256,20 +300,20 @@ class E(U: type) {} // CHECK:STDOUT: } // CHECK:STDOUT: %N.loc6_10.2: %A = symbolic_binding N, 0 [symbolic = %N.loc6_10.1 (constants.%N.37f)] // CHECK:STDOUT: } -// CHECK:STDOUT: %B.decl.loc10: %B.type.7c49ec.2 = class_decl @B.loc10 [concrete = constants.%B.generic.4b73a1.2] { -// CHECK:STDOUT: %T.patt.loc10_10.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc10_10.2 (constants.%T.patt)] -// CHECK:STDOUT: %N.patt.loc10_19.1: @B.loc10.%pattern_type (%pattern_type.51d) = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc10_19.2 (constants.%N.patt.9f0)] +// CHECK:STDOUT: %B.decl.loc19: %B.type.7c49ec.2 = class_decl @B.loc19 [concrete = constants.%B.generic.4b73a1.2] { +// CHECK:STDOUT: %T.patt.loc19_10.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc19_10.2 (constants.%T.patt)] +// CHECK:STDOUT: %N.patt.loc19_19.1: @B.loc19.%pattern_type (%pattern_type.51d) = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc19_19.2 (constants.%N.patt.9f0)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc10_12.1: type = splice_block %.loc10_12.2 [concrete = type] { -// CHECK:STDOUT: %.Self.frozen.loc10_10: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc10_12.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc19_12.1: type = splice_block %.loc19_12.2 [concrete = type] { +// CHECK:STDOUT: %.Self.frozen.loc19_10: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc19_12.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc10_10.2: type = symbolic_binding T, 0 [symbolic = %T.loc10_10.1 (constants.%T)] -// CHECK:STDOUT: %.loc10_21: type = splice_block %T.ref [symbolic = %T.loc10_10.1 (constants.%T)] { -// CHECK:STDOUT: %.Self.frozen.loc10_19: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc10_10.2 [symbolic = %T.loc10_10.1 (constants.%T)] +// CHECK:STDOUT: %T.loc19_10.2: type = symbolic_binding T, 0 [symbolic = %T.loc19_10.1 (constants.%T)] +// CHECK:STDOUT: %.loc19_21: type = splice_block %T.ref [symbolic = %T.loc19_10.1 (constants.%T)] { +// CHECK:STDOUT: %.Self.frozen.loc19_19: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc19_10.2 [symbolic = %T.loc19_10.1 (constants.%T)] // CHECK:STDOUT: } -// CHECK:STDOUT: %N.loc10_19.2: @B.loc10.%T.loc10_10.1 (%T) = symbolic_binding N, 1 [symbolic = %N.loc10_19.1 (constants.%N.bd9)] +// CHECK:STDOUT: %N.loc19_19.2: @B.loc19.%T.loc19_10.1 (%T) = symbolic_binding N, 1 [symbolic = %N.loc19_19.1 (constants.%N.bd9)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -288,12 +332,12 @@ class E(U: type) {} // CHECK:STDOUT: class; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic class @B.loc10(%T.loc10_10.2: type, %N.loc10_19.2: @B.loc10.%T.loc10_10.1 (%T)) { -// CHECK:STDOUT: %T.patt.loc10_10.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc10_10.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc10_10.1: type = symbolic_binding T, 0 [symbolic = %T.loc10_10.1 (constants.%T)] -// CHECK:STDOUT: %pattern_type: type = pattern_type %T.loc10_10.1 [symbolic = %pattern_type (constants.%pattern_type.51d)] -// CHECK:STDOUT: %N.patt.loc10_19.2: @B.loc10.%pattern_type (%pattern_type.51d) = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc10_19.2 (constants.%N.patt.9f0)] -// CHECK:STDOUT: %N.loc10_19.1: @B.loc10.%T.loc10_10.1 (%T) = symbolic_binding N, 1 [symbolic = %N.loc10_19.1 (constants.%N.bd9)] +// CHECK:STDOUT: generic class @B.loc19(%T.loc19_10.2: type, %N.loc19_19.2: @B.loc19.%T.loc19_10.1 (%T)) { +// CHECK:STDOUT: %T.patt.loc19_10.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc19_10.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc19_10.1: type = symbolic_binding T, 0 [symbolic = %T.loc19_10.1 (constants.%T)] +// CHECK:STDOUT: %pattern_type: type = pattern_type %T.loc19_10.1 [symbolic = %pattern_type (constants.%pattern_type.51d)] +// CHECK:STDOUT: %N.patt.loc19_19.2: @B.loc19.%pattern_type (%pattern_type.51d) = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc19_19.2 (constants.%N.patt.9f0)] +// CHECK:STDOUT: %N.loc19_19.1: @B.loc19.%T.loc19_10.1 (%T) = symbolic_binding N, 1 [symbolic = %N.loc19_19.1 (constants.%N.bd9)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -311,12 +355,12 @@ class E(U: type) {} // CHECK:STDOUT: %N.loc6_10.1 => constants.%N.37f // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @B.loc10(constants.%T, constants.%N.bd9) { -// CHECK:STDOUT: %T.patt.loc10_10.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc10_10.1 => constants.%T +// CHECK:STDOUT: specific @B.loc19(constants.%T, constants.%N.bd9) { +// CHECK:STDOUT: %T.patt.loc19_10.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc19_10.1 => constants.%T // CHECK:STDOUT: %pattern_type => constants.%pattern_type.51d -// CHECK:STDOUT: %N.patt.loc10_19.2 => constants.%N.patt.9f0 -// CHECK:STDOUT: %N.loc10_19.1 => constants.%N.bd9 +// CHECK:STDOUT: %N.patt.loc19_19.2 => constants.%N.patt.9f0 +// CHECK:STDOUT: %N.loc19_19.1 => constants.%N.bd9 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_mismatch_param_count.carbon @@ -335,9 +379,9 @@ class E(U: type) {} // CHECK:STDOUT: %pattern_type.9ef: type = pattern_type %A [concrete] // CHECK:STDOUT: %U.patt: %pattern_type.9ef = symbolic_binding_pattern U, 1 [symbolic] // CHECK:STDOUT: %U: %A = symbolic_binding U, 1 [symbolic] -// CHECK:STDOUT: %C.type.7a6f96.2: type = parameterized_class_name_type @C.loc10 [concrete] +// CHECK:STDOUT: %C.type.7a6f96.2: type = parameterized_class_name_type @C.loc19 [concrete] // CHECK:STDOUT: %C.generic.e6debf.2: %C.type.7a6f96.2 = struct_value () [concrete] -// CHECK:STDOUT: %C.4c2: type = class_type @C.loc10, @C.loc10(%T, %U) [symbolic] +// CHECK:STDOUT: %C.4c2: type = class_type @C.loc19, @C.loc19(%T, %U) [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -364,20 +408,20 @@ class E(U: type) {} // CHECK:STDOUT: } // CHECK:STDOUT: %T.loc6_10.2: type = symbolic_binding T, 0 [symbolic = %T.loc6_10.1 (constants.%T)] // CHECK:STDOUT: } -// CHECK:STDOUT: %C.decl.loc10: %C.type.7a6f96.2 = class_decl @C.loc10 [concrete = constants.%C.generic.e6debf.2] { -// CHECK:STDOUT: %T.patt.loc10_10.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc10_10.2 (constants.%T.patt)] -// CHECK:STDOUT: %U.patt.loc10_19.1: %pattern_type.9ef = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc10_19.2 (constants.%U.patt)] +// CHECK:STDOUT: %C.decl.loc19: %C.type.7a6f96.2 = class_decl @C.loc19 [concrete = constants.%C.generic.e6debf.2] { +// CHECK:STDOUT: %T.patt.loc19_10.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc19_10.2 (constants.%T.patt)] +// CHECK:STDOUT: %U.patt.loc19_19.1: %pattern_type.9ef = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc19_19.2 (constants.%U.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc10_12.1: type = splice_block %.loc10_12.2 [concrete = type] { -// CHECK:STDOUT: %.Self.frozen.loc10_10: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc10_12.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc19_12.1: type = splice_block %.loc19_12.2 [concrete = type] { +// CHECK:STDOUT: %.Self.frozen.loc19_10: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc19_12.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc10_10.2: type = symbolic_binding T, 0 [symbolic = %T.loc10_10.1 (constants.%T)] -// CHECK:STDOUT: %.loc10_21: type = splice_block %A.ref [concrete = constants.%A] { -// CHECK:STDOUT: %.Self.frozen.loc10_19: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %T.loc19_10.2: type = symbolic_binding T, 0 [symbolic = %T.loc19_10.1 (constants.%T)] +// CHECK:STDOUT: %.loc19_21: type = splice_block %A.ref [concrete = constants.%A] { +// CHECK:STDOUT: %.Self.frozen.loc19_19: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A] // CHECK:STDOUT: } -// CHECK:STDOUT: %U.loc10_19.2: %A = symbolic_binding U, 1 [symbolic = %U.loc10_19.1 (constants.%U)] +// CHECK:STDOUT: %U.loc19_19.2: %A = symbolic_binding U, 1 [symbolic = %U.loc19_19.1 (constants.%U)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -396,11 +440,11 @@ class E(U: type) {} // CHECK:STDOUT: class; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic class @C.loc10(%T.loc10_10.2: type, %U.loc10_19.2: %A) { -// CHECK:STDOUT: %T.patt.loc10_10.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc10_10.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc10_10.1: type = symbolic_binding T, 0 [symbolic = %T.loc10_10.1 (constants.%T)] -// CHECK:STDOUT: %U.patt.loc10_19.2: %pattern_type.9ef = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc10_19.2 (constants.%U.patt)] -// CHECK:STDOUT: %U.loc10_19.1: %A = symbolic_binding U, 1 [symbolic = %U.loc10_19.1 (constants.%U)] +// CHECK:STDOUT: generic class @C.loc19(%T.loc19_10.2: type, %U.loc19_19.2: %A) { +// CHECK:STDOUT: %T.patt.loc19_10.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc19_10.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc19_10.1: type = symbolic_binding T, 0 [symbolic = %T.loc19_10.1 (constants.%T)] +// CHECK:STDOUT: %U.patt.loc19_19.2: %pattern_type.9ef = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc19_19.2 (constants.%U.patt)] +// CHECK:STDOUT: %U.loc19_19.1: %A = symbolic_binding U, 1 [symbolic = %U.loc19_19.1 (constants.%U)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -418,11 +462,11 @@ class E(U: type) {} // CHECK:STDOUT: %T.loc6_10.1 => constants.%T // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @C.loc10(constants.%T, constants.%U) { -// CHECK:STDOUT: %T.patt.loc10_10.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc10_10.1 => constants.%T -// CHECK:STDOUT: %U.patt.loc10_19.2 => constants.%U.patt -// CHECK:STDOUT: %U.loc10_19.1 => constants.%U +// CHECK:STDOUT: specific @C.loc19(constants.%T, constants.%U) { +// CHECK:STDOUT: %T.patt.loc19_10.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc19_10.1 => constants.%T +// CHECK:STDOUT: %U.patt.loc19_19.2 => constants.%U.patt +// CHECK:STDOUT: %U.loc19_19.1 => constants.%U // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_mismatch_param_type.carbon @@ -441,9 +485,9 @@ class E(U: type) {} // CHECK:STDOUT: %pattern_type.9ef: type = pattern_type %A [concrete] // CHECK:STDOUT: %T.patt.3a1: %pattern_type.9ef = symbolic_binding_pattern T, 0 [symbolic] // CHECK:STDOUT: %T.37f: %A = symbolic_binding T, 0 [symbolic] -// CHECK:STDOUT: %D.type.0f59a4.2: type = parameterized_class_name_type @D.loc10 [concrete] +// CHECK:STDOUT: %D.type.0f59a4.2: type = parameterized_class_name_type @D.loc20 [concrete] // CHECK:STDOUT: %D.generic.f4a710.2: %D.type.0f59a4.2 = struct_value () [concrete] -// CHECK:STDOUT: %D.703: type = class_type @D.loc10, @D.loc10(%T.37f) [symbolic] +// CHECK:STDOUT: %D.703: type = class_type @D.loc20, @D.loc20(%T.37f) [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -470,14 +514,14 @@ class E(U: type) {} // CHECK:STDOUT: } // CHECK:STDOUT: %T.loc6_10.2: type = symbolic_binding T, 0 [symbolic = %T.loc6_10.1 (constants.%T.67d)] // CHECK:STDOUT: } -// CHECK:STDOUT: %D.decl.loc10: %D.type.0f59a4.2 = class_decl @D.loc10 [concrete = constants.%D.generic.f4a710.2] { -// CHECK:STDOUT: %T.patt.loc10_10.1: %pattern_type.9ef = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc10_10.2 (constants.%T.patt.3a1)] +// CHECK:STDOUT: %D.decl.loc20: %D.type.0f59a4.2 = class_decl @D.loc20 [concrete = constants.%D.generic.f4a710.2] { +// CHECK:STDOUT: %T.patt.loc20_10.1: %pattern_type.9ef = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc20_10.2 (constants.%T.patt.3a1)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc10: type = splice_block %A.ref [concrete = constants.%A] { +// CHECK:STDOUT: %.loc20: type = splice_block %A.ref [concrete = constants.%A] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc10_10.2: %A = symbolic_binding T, 0 [symbolic = %T.loc10_10.1 (constants.%T.37f)] +// CHECK:STDOUT: %T.loc20_10.2: %A = symbolic_binding T, 0 [symbolic = %T.loc20_10.1 (constants.%T.37f)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -496,9 +540,9 @@ class E(U: type) {} // CHECK:STDOUT: class; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic class @D.loc10(%T.loc10_10.2: %A) { -// CHECK:STDOUT: %T.patt.loc10_10.2: %pattern_type.9ef = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc10_10.2 (constants.%T.patt.3a1)] -// CHECK:STDOUT: %T.loc10_10.1: %A = symbolic_binding T, 0 [symbolic = %T.loc10_10.1 (constants.%T.37f)] +// CHECK:STDOUT: generic class @D.loc20(%T.loc20_10.2: %A) { +// CHECK:STDOUT: %T.patt.loc20_10.2: %pattern_type.9ef = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc20_10.2 (constants.%T.patt.3a1)] +// CHECK:STDOUT: %T.loc20_10.1: %A = symbolic_binding T, 0 [symbolic = %T.loc20_10.1 (constants.%T.37f)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -516,9 +560,9 @@ class E(U: type) {} // CHECK:STDOUT: %T.loc6_10.1 => constants.%T.67d // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @D.loc10(constants.%T.37f) { -// CHECK:STDOUT: %T.patt.loc10_10.2 => constants.%T.patt.3a1 -// CHECK:STDOUT: %T.loc10_10.1 => constants.%T.37f +// CHECK:STDOUT: specific @D.loc20(constants.%T.37f) { +// CHECK:STDOUT: %T.patt.loc20_10.2 => constants.%T.patt.3a1 +// CHECK:STDOUT: %T.loc20_10.1 => constants.%T.37f // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_mismatch_param_name.carbon @@ -533,9 +577,9 @@ class E(U: type) {} // CHECK:STDOUT: %E.generic.a02b8a.1: %E.type.d96618.1 = struct_value () [concrete] // CHECK:STDOUT: %U.patt: %pattern_type = symbolic_binding_pattern U, 0 [symbolic] // CHECK:STDOUT: %U: type = symbolic_binding U, 0 [symbolic] -// CHECK:STDOUT: %E.type.d96618.2: type = parameterized_class_name_type @E.loc8 [concrete] +// CHECK:STDOUT: %E.type.d96618.2: type = parameterized_class_name_type @E.loc16 [concrete] // CHECK:STDOUT: %E.generic.a02b8a.2: %E.type.d96618.2 = struct_value () [concrete] -// CHECK:STDOUT: %E.2b2fa7.2: type = class_type @E.loc8, @E.loc8(%U) [symbolic] +// CHECK:STDOUT: %E.2b2fa7.2: type = class_type @E.loc16, @E.loc16(%U) [symbolic] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] // CHECK:STDOUT: } @@ -562,14 +606,14 @@ class E(U: type) {} // CHECK:STDOUT: } // CHECK:STDOUT: %T.loc4_10.2: type = symbolic_binding T, 0 [symbolic = %T.loc4_10.1 (constants.%T)] // CHECK:STDOUT: } -// CHECK:STDOUT: %E.decl.loc8: %E.type.d96618.2 = class_decl @E.loc8 [concrete = constants.%E.generic.a02b8a.2] { -// CHECK:STDOUT: %U.patt.loc8_10.1: %pattern_type = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc8_10.2 (constants.%U.patt)] +// CHECK:STDOUT: %E.decl.loc16: %E.type.d96618.2 = class_decl @E.loc16 [concrete = constants.%E.generic.a02b8a.2] { +// CHECK:STDOUT: %U.patt.loc16_10.1: %pattern_type = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc16_10.2 (constants.%U.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc8_12.1: type = splice_block %.loc8_12.2 [concrete = type] { +// CHECK:STDOUT: %.loc16_12.1: type = splice_block %.loc16_12.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc8_12.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc16_12.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %U.loc8_10.2: type = symbolic_binding U, 0 [symbolic = %U.loc8_10.1 (constants.%U)] +// CHECK:STDOUT: %U.loc16_10.2: type = symbolic_binding U, 0 [symbolic = %U.loc16_10.1 (constants.%U)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -580,9 +624,9 @@ class E(U: type) {} // CHECK:STDOUT: class; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic class @E.loc8(%U.loc8_10.2: type) { -// CHECK:STDOUT: %U.patt.loc8_10.2: %pattern_type = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc8_10.2 (constants.%U.patt)] -// CHECK:STDOUT: %U.loc8_10.1: type = symbolic_binding U, 0 [symbolic = %U.loc8_10.1 (constants.%U)] +// CHECK:STDOUT: generic class @E.loc16(%U.loc16_10.2: type) { +// CHECK:STDOUT: %U.patt.loc16_10.2: %pattern_type = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc16_10.2 (constants.%U.patt)] +// CHECK:STDOUT: %U.loc16_10.1: type = symbolic_binding U, 0 [symbolic = %U.loc16_10.1 (constants.%U)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -600,8 +644,8 @@ class E(U: type) {} // CHECK:STDOUT: %T.loc4_10.1 => constants.%T // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @E.loc8(constants.%U) { -// CHECK:STDOUT: %U.patt.loc8_10.2 => constants.%U.patt -// CHECK:STDOUT: %U.loc8_10.1 => constants.%U +// CHECK:STDOUT: specific @E.loc16(constants.%U) { +// CHECK:STDOUT: %U.patt.loc16_10.2 => constants.%U.patt +// CHECK:STDOUT: %U.loc16_10.1 => constants.%U // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/generic/stringify.carbon b/toolchain/check/testdata/class/generic/stringify.carbon index 604a81c63ade..217212ae4cc2 100644 --- a/toolchain/check/testdata/class/generic/stringify.carbon +++ b/toolchain/check/testdata/class/generic/stringify.carbon @@ -20,8 +20,16 @@ class NoParams {} class EmptyParams() {} var v: NoParams; -// CHECK:STDERR: fail_empty_params.carbon:[[@LINE+3]]:1-20: error: cannot implicitly convert expression of type `NoParams` to `EmptyParams()` [ConversionFailure] -// CHECK:STDERR: fail_empty_params.carbon:[[@LINE+2]]:1-20: note: type `NoParams` does not implement interface `Core.ImplicitAs(EmptyParams())` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_empty_params.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: -> │ var w: EmptyParams() = v; +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `NoParams` to +// CHECK:STDERR: · │ ┃ `EmptyParams()` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╰────┤ type `NoParams` does not implement interface +// CHECK:STDERR: · │ `Core.ImplicitAs(EmptyParams())` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var w: EmptyParams() = v; @@ -37,8 +45,16 @@ class Outer(T: type) { var v: Outer({}*); // TODO: It would be nice to include the `Outer({}*).` prefix in the name of `Inner`. -// CHECK:STDERR: fail_nested.carbon:[[@LINE+3]]:1-35: error: cannot implicitly convert expression of type `Outer({}*)` to `Inner({.a: i32}*)` [ConversionFailure] -// CHECK:STDERR: fail_nested.carbon:[[@LINE+2]]:1-35: note: type `Outer({}*)` does not implement interface `Core.ImplicitAs(Inner({.a: i32}*))` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_nested.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: -> │ var w: Outer({}*).Inner({.a: i32}*) = v; +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `Outer({}*)` to +// CHECK:STDERR: · │ ┃ `Inner({.a: i32}*)` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╰────┤ type `Outer({}*)` does not implement interface +// CHECK:STDERR: · │ `Core.ImplicitAs(Inner({.a: i32}*))` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var w: Outer({}*).Inner({.a: i32}*) = v; @@ -48,8 +64,14 @@ library "[[@TEST_NAME]]"; class C(N: i32) {} -// CHECK:STDERR: fail_int_value.carbon:[[@LINE+3]]:1-13: error: cannot implicitly convert expression of type `()` to `C(123)` [ConversionFailure] -// CHECK:STDERR: fail_int_value.carbon:[[@LINE+2]]:1-13: note: type `()` does not implement interface `Core.ImplicitAs(C(123))` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_int_value.carbon:[[@LINE+9]]:1 +// CHECK:STDERR: -> │ var v: C(123) = (); +// CHECK:STDERR: · ━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `()` to `C(123)` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╰────┤ type `()` does not implement interface `Core.ImplicitAs(C(123))` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var v: C(123) = (); @@ -64,8 +86,16 @@ class D { class E(F: D) {} -// CHECK:STDERR: fail_class_param.carbon:[[@LINE+3]]:1-26: error: cannot implicitly convert expression of type `E({.a = 3, .b = 4})` to `E({.a = 1, .b = 2})` [ConversionFailure] -// CHECK:STDERR: fail_class_param.carbon:[[@LINE+2]]:1-26: note: type `E({.a = 3, .b = 4})` does not implement interface `Core.ImplicitAs(E({.a = 1, .b = 2}))` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_class_param.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: -> │ var g: E({.a = 1, .b = 2}) = {} as E({.a = 3, .b = 4} as D); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `E({.a = 3, .b = 4})` +// CHECK:STDERR: · │ ┃ to `E({.a = 1, .b = 2})` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╰────┤ type `E({.a = 3, .b = 4})` does not implement interface +// CHECK:STDERR: · │ `Core.ImplicitAs(E({.a = 1, .b = 2}))` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var g: E({.a = 1, .b = 2}) = {} as E({.a = 3, .b = 4} as D); @@ -130,7 +160,7 @@ var g: E({.a = 1, .b = 2}) = {} as E({.a = 3, .b = 4} as D); // CHECK:STDOUT: %v.var_patt: %pattern_type.c07 = var_pattern %v.patt [concrete = constants.%v.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %w.var: ref %EmptyParams = var_storage %w.var_patt [concrete] -// CHECK:STDOUT: %.loc11: type = splice_block %EmptyParams [concrete = constants.%EmptyParams] { +// CHECK:STDOUT: %.loc19: type = splice_block %EmptyParams [concrete = constants.%EmptyParams] { // CHECK:STDOUT: %EmptyParams.ref: %EmptyParams.type = name_ref EmptyParams, %EmptyParams.decl [concrete = constants.%EmptyParams.generic] // CHECK:STDOUT: %EmptyParams: type = class_type @EmptyParams [concrete = constants.%EmptyParams] // CHECK:STDOUT: } @@ -168,7 +198,7 @@ var g: E({.a = 1, .b = 2}) = {} as E({.a = 3, .b = 4} as D); // CHECK:STDOUT: %T.as.DefaultOrUnformed.impl.Op.call: init %NoParams to %.loc7_1 = call %T.as.DefaultOrUnformed.impl.Op.specific_fn() // CHECK:STDOUT: assign file.%v.var, %T.as.DefaultOrUnformed.impl.Op.call // CHECK:STDOUT: %v.ref: ref %NoParams = name_ref v, file.%v [concrete = file.%v.var] -// CHECK:STDOUT: %.loc11: %EmptyParams = converted %v.ref, [concrete = ] +// CHECK:STDOUT: %.loc19: %EmptyParams = converted %v.ref, [concrete = ] // CHECK:STDOUT: assign file.%w.var, // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -267,17 +297,17 @@ var g: E({.a = 1, .b = 2}) = {} as E({.a = 3, .b = 4} as D); // CHECK:STDOUT: %v.var_patt: %pattern_type.dbc = var_pattern %v.patt [concrete = constants.%v.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %w.var: ref %Inner.8dc = var_storage %w.var_patt [concrete] -// CHECK:STDOUT: %.loc15_35: type = splice_block %Inner [concrete = constants.%Inner.8dc] { -// CHECK:STDOUT: %Outer.ref.loc15: %Outer.type = name_ref Outer, %Outer.decl [concrete = constants.%Outer.generic] -// CHECK:STDOUT: %.loc15_15: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc15_16: type = converted %.loc15_15, constants.%empty_struct_type [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %ptr.loc15_16: type = ptr_type %.loc15_16 [concrete = constants.%ptr.c28] -// CHECK:STDOUT: %Outer.loc15: type = class_type @Outer, @Outer(constants.%ptr.c28) [concrete = constants.%Outer.856] -// CHECK:STDOUT: %.loc15_18: %Inner.type.894 = specific_constant @Outer.%Inner.decl, @Outer(constants.%ptr.c28) [concrete = constants.%Inner.generic.787] -// CHECK:STDOUT: %Inner.ref: %Inner.type.894 = name_ref Inner, %.loc15_18 [concrete = constants.%Inner.generic.787] +// CHECK:STDOUT: %.loc23_35: type = splice_block %Inner [concrete = constants.%Inner.8dc] { +// CHECK:STDOUT: %Outer.ref.loc23: %Outer.type = name_ref Outer, %Outer.decl [concrete = constants.%Outer.generic] +// CHECK:STDOUT: %.loc23_15: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc23_16: type = converted %.loc23_15, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %ptr.loc23_16: type = ptr_type %.loc23_16 [concrete = constants.%ptr.c28] +// CHECK:STDOUT: %Outer.loc23: type = class_type @Outer, @Outer(constants.%ptr.c28) [concrete = constants.%Outer.856] +// CHECK:STDOUT: %.loc23_18: %Inner.type.894 = specific_constant @Outer.%Inner.decl, @Outer(constants.%ptr.c28) [concrete = constants.%Inner.generic.787] +// CHECK:STDOUT: %Inner.ref: %Inner.type.894 = name_ref Inner, %.loc23_18 [concrete = constants.%Inner.generic.787] // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %i32} [concrete = constants.%struct_type.a] -// CHECK:STDOUT: %ptr.loc15_34: type = ptr_type %struct_type.a [concrete = constants.%ptr.54f] +// CHECK:STDOUT: %ptr.loc23_34: type = ptr_type %struct_type.a [concrete = constants.%ptr.54f] // CHECK:STDOUT: %Inner: type = class_type @Inner, @Inner(constants.%ptr.c28, constants.%ptr.54f) [concrete = constants.%Inner.8dc] // CHECK:STDOUT: } // CHECK:STDOUT: %w: ref %Inner.8dc = wrapper_binding w, %w.var [concrete = %w.var] @@ -340,7 +370,7 @@ var g: E({.a = 1, .b = 2}) = {} as E({.a = 3, .b = 4} as D); // CHECK:STDOUT: %T.as.DefaultOrUnformed.impl.Op.call: init %Outer.856 to %.loc9_1 = call %T.as.DefaultOrUnformed.impl.Op.specific_fn() // CHECK:STDOUT: assign file.%v.var, %T.as.DefaultOrUnformed.impl.Op.call // CHECK:STDOUT: %v.ref: ref %Outer.856 = name_ref v, file.%v [concrete = file.%v.var] -// CHECK:STDOUT: %.loc15: %Inner.8dc = converted %v.ref, [concrete = ] +// CHECK:STDOUT: %.loc23: %Inner.8dc = converted %v.ref, [concrete = ] // CHECK:STDOUT: assign file.%w.var, // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -443,16 +473,16 @@ var g: E({.a = 1, .b = 2}) = {} as E({.a = 3, .b = 4} as D); // CHECK:STDOUT: %N.loc4_10.2: %i32 = symbolic_binding N, 0 [symbolic = %N.loc4_10.1 (constants.%N.c34)] // CHECK:STDOUT: } // CHECK:STDOUT: %v.var: ref %C.a98 = var_storage %v.var_patt [concrete] -// CHECK:STDOUT: %.loc9_13.1: type = splice_block %C [concrete = constants.%C.a98] { +// CHECK:STDOUT: %.loc15_13.1: type = splice_block %C [concrete = constants.%C.a98] { // CHECK:STDOUT: %C.ref: %C.type = name_ref C, %C.decl [concrete = constants.%C.generic] // CHECK:STDOUT: %int_123: Core.IntLiteral = int_value 123 [concrete = constants.%int_123.fff] // CHECK:STDOUT: %impl.elem0: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc9_13.1: = bound_method %int_123, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %bound_method.loc15_13.1: = bound_method %int_123, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] // CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc9_13.2: = bound_method %int_123, %specific_fn [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc9_13.2(%int_123) [concrete = constants.%int_123.c07] -// CHECK:STDOUT: %.loc9_13.2: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_123.c07] -// CHECK:STDOUT: %.loc9_13.3: %i32 = converted %int_123, %.loc9_13.2 [concrete = constants.%int_123.c07] +// CHECK:STDOUT: %bound_method.loc15_13.2: = bound_method %int_123, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc15_13.2(%int_123) [concrete = constants.%int_123.c07] +// CHECK:STDOUT: %.loc15_13.2: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_123.c07] +// CHECK:STDOUT: %.loc15_13.3: %i32 = converted %int_123, %.loc15_13.2 [concrete = constants.%int_123.c07] // CHECK:STDOUT: %C: type = class_type @C, @C(constants.%int_123.c07) [concrete = constants.%C.a98] // CHECK:STDOUT: } // CHECK:STDOUT: %v: ref %C.a98 = wrapper_binding v, %v.var [concrete = %v.var] @@ -479,8 +509,8 @@ var g: E({.a = 1, .b = 2}) = {} as E({.a = 3, .b = 4} as D); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc9_18: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc9_1: %C.a98 = converted %.loc9_18, [concrete = ] +// CHECK:STDOUT: %.loc15_18: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc15_1: %C.a98 = converted %.loc15_18, [concrete = ] // CHECK:STDOUT: assign file.%v.var, // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -595,32 +625,32 @@ var g: E({.a = 1, .b = 2}) = {} as E({.a = 3, .b = 4} as D); // CHECK:STDOUT: %F.loc9_10.2: %D = symbolic_binding F, 0 [symbolic = %F.loc9_10.1 (constants.%F)] // CHECK:STDOUT: } // CHECK:STDOUT: %g.var: ref %E.468 = var_storage %g.var_patt [concrete] -// CHECK:STDOUT: %.loc14_26.1: type = splice_block %E [concrete = constants.%E.468] { +// CHECK:STDOUT: %.loc22_26.1: type = splice_block %E [concrete = constants.%E.468] { // CHECK:STDOUT: %E.ref: %E.type = name_ref E, %E.decl [concrete = constants.%E.generic] // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] -// CHECK:STDOUT: %.loc14_25.1: %struct_type.a.b.cfd = struct_literal (%int_1, %int_2) [concrete = constants.%struct.4aa] -// CHECK:STDOUT: %impl.elem0.loc14_25.1: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc14_25.1: = bound_method %int_1, %impl.elem0.loc14_25.1 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282] -// CHECK:STDOUT: %specific_fn.loc14_25.1: = specific_function %impl.elem0.loc14_25.1, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc14_25.2: = bound_method %int_1, %specific_fn.loc14_25.1 [concrete = constants.%bound_method.3bd] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc14_25.1: init %i32 = call %bound_method.loc14_25.2(%int_1) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc14_25.2: init %i32 = converted %int_1, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc14_25.1 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc14_25.3: ref %D = temporary_storage -// CHECK:STDOUT: %.loc14_25.4: ref %i32 = class_element_access %.loc14_25.3, element0 -// CHECK:STDOUT: %.loc14_25.5: init %i32 to %.loc14_25.4 = in_place_init %.loc14_25.2 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %impl.elem0.loc14_25.2: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc14_25.3: = bound_method %int_2, %impl.elem0.loc14_25.2 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.8a6] -// CHECK:STDOUT: %specific_fn.loc14_25.2: = specific_function %impl.elem0.loc14_25.2, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc14_25.4: = bound_method %int_2, %specific_fn.loc14_25.2 [concrete = constants.%bound_method.a55] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc14_25.2: init %i32 = call %bound_method.loc14_25.4(%int_2) [concrete = constants.%int_2.2e0] -// CHECK:STDOUT: %.loc14_25.6: init %i32 = converted %int_2, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc14_25.2 [concrete = constants.%int_2.2e0] -// CHECK:STDOUT: %.loc14_25.7: ref %i32 = class_element_access %.loc14_25.3, element1 -// CHECK:STDOUT: %.loc14_25.8: init %i32 to %.loc14_25.7 = in_place_init %.loc14_25.6 [concrete = constants.%int_2.2e0] -// CHECK:STDOUT: %.loc14_25.9: init %D to %.loc14_25.3 = class_init (%.loc14_25.5, %.loc14_25.8) [concrete = constants.%D.val.b5e] -// CHECK:STDOUT: %.loc14_26.2: init %D = converted %.loc14_25.1, %.loc14_25.9 [concrete = constants.%D.val.b5e] -// CHECK:STDOUT: %.loc14_26.3: ref %D = temporary %.loc14_25.3, %.loc14_26.2 [concrete = constants.%.738] -// CHECK:STDOUT: %.loc14_26.4: %D = acquire_value %.loc14_26.3 [concrete = constants.%D.val.b5e] +// CHECK:STDOUT: %.loc22_25.1: %struct_type.a.b.cfd = struct_literal (%int_1, %int_2) [concrete = constants.%struct.4aa] +// CHECK:STDOUT: %impl.elem0.loc22_25.1: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc22_25.1: = bound_method %int_1, %impl.elem0.loc22_25.1 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282] +// CHECK:STDOUT: %specific_fn.loc22_25.1: = specific_function %impl.elem0.loc22_25.1, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc22_25.2: = bound_method %int_1, %specific_fn.loc22_25.1 [concrete = constants.%bound_method.3bd] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc22_25.1: init %i32 = call %bound_method.loc22_25.2(%int_1) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc22_25.2: init %i32 = converted %int_1, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc22_25.1 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc22_25.3: ref %D = temporary_storage +// CHECK:STDOUT: %.loc22_25.4: ref %i32 = class_element_access %.loc22_25.3, element0 +// CHECK:STDOUT: %.loc22_25.5: init %i32 to %.loc22_25.4 = in_place_init %.loc22_25.2 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %impl.elem0.loc22_25.2: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc22_25.3: = bound_method %int_2, %impl.elem0.loc22_25.2 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.8a6] +// CHECK:STDOUT: %specific_fn.loc22_25.2: = specific_function %impl.elem0.loc22_25.2, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc22_25.4: = bound_method %int_2, %specific_fn.loc22_25.2 [concrete = constants.%bound_method.a55] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc22_25.2: init %i32 = call %bound_method.loc22_25.4(%int_2) [concrete = constants.%int_2.2e0] +// CHECK:STDOUT: %.loc22_25.6: init %i32 = converted %int_2, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc22_25.2 [concrete = constants.%int_2.2e0] +// CHECK:STDOUT: %.loc22_25.7: ref %i32 = class_element_access %.loc22_25.3, element1 +// CHECK:STDOUT: %.loc22_25.8: init %i32 to %.loc22_25.7 = in_place_init %.loc22_25.6 [concrete = constants.%int_2.2e0] +// CHECK:STDOUT: %.loc22_25.9: init %D to %.loc22_25.3 = class_init (%.loc22_25.5, %.loc22_25.8) [concrete = constants.%D.val.b5e] +// CHECK:STDOUT: %.loc22_26.2: init %D = converted %.loc22_25.1, %.loc22_25.9 [concrete = constants.%D.val.b5e] +// CHECK:STDOUT: %.loc22_26.3: ref %D = temporary %.loc22_25.3, %.loc22_26.2 [concrete = constants.%.738] +// CHECK:STDOUT: %.loc22_26.4: %D = acquire_value %.loc22_26.3 [concrete = constants.%D.val.b5e] // CHECK:STDOUT: %E: type = class_type @E, @E(constants.%D.val.b5e) [concrete = constants.%E.468] // CHECK:STDOUT: } // CHECK:STDOUT: %g: ref %E.468 = wrapper_binding g, %g.var [concrete = %g.var] @@ -663,38 +693,38 @@ var g: E({.a = 1, .b = 2}) = {} as E({.a = 3, .b = 4} as D); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc14_31.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc22_31.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] // CHECK:STDOUT: %E.ref: %E.type = name_ref E, file.%E.decl [concrete = constants.%E.generic] // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3.1ba] // CHECK:STDOUT: %int_4: Core.IntLiteral = int_value 4 [concrete = constants.%int_4.0c1] -// CHECK:STDOUT: %.loc14_53.1: %struct_type.a.b.cfd = struct_literal (%int_3, %int_4) [concrete = constants.%struct.cb7] +// CHECK:STDOUT: %.loc22_53.1: %struct_type.a.b.cfd = struct_literal (%int_3, %int_4) [concrete = constants.%struct.cb7] // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [concrete = constants.%D] -// CHECK:STDOUT: %impl.elem0.loc14_53.1: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc14_53.1: = bound_method %int_3, %impl.elem0.loc14_53.1 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.b3c] -// CHECK:STDOUT: %specific_fn.loc14_53.1: = specific_function %impl.elem0.loc14_53.1, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc14_53.2: = bound_method %int_3, %specific_fn.loc14_53.1 [concrete = constants.%bound_method.fb0] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc14_53.1: init %i32 = call %bound_method.loc14_53.2(%int_3) [concrete = constants.%int_3.9f3] -// CHECK:STDOUT: %.loc14_53.2: init %i32 = converted %int_3, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc14_53.1 [concrete = constants.%int_3.9f3] -// CHECK:STDOUT: %.loc14_53.3: ref %D = temporary_storage -// CHECK:STDOUT: %.loc14_53.4: ref %i32 = class_element_access %.loc14_53.3, element0 -// CHECK:STDOUT: %.loc14_53.5: init %i32 to %.loc14_53.4 = in_place_init %.loc14_53.2 [concrete = constants.%int_3.9f3] -// CHECK:STDOUT: %impl.elem0.loc14_53.2: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc14_53.3: = bound_method %int_4, %impl.elem0.loc14_53.2 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.776] -// CHECK:STDOUT: %specific_fn.loc14_53.2: = specific_function %impl.elem0.loc14_53.2, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc14_53.4: = bound_method %int_4, %specific_fn.loc14_53.2 [concrete = constants.%bound_method.7fa] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc14_53.2: init %i32 = call %bound_method.loc14_53.4(%int_4) [concrete = constants.%int_4.6bf] -// CHECK:STDOUT: %.loc14_53.6: init %i32 = converted %int_4, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc14_53.2 [concrete = constants.%int_4.6bf] -// CHECK:STDOUT: %.loc14_53.7: ref %i32 = class_element_access %.loc14_53.3, element1 -// CHECK:STDOUT: %.loc14_53.8: init %i32 to %.loc14_53.7 = in_place_init %.loc14_53.6 [concrete = constants.%int_4.6bf] -// CHECK:STDOUT: %.loc14_53.9: init %D to %.loc14_53.3 = class_init (%.loc14_53.5, %.loc14_53.8) [concrete = constants.%D.val.db4] -// CHECK:STDOUT: %.loc14_55.1: init %D = converted %.loc14_53.1, %.loc14_53.9 [concrete = constants.%D.val.db4] -// CHECK:STDOUT: %.loc14_55.2: ref %D = temporary %.loc14_53.3, %.loc14_55.1 [concrete = constants.%.c27] -// CHECK:STDOUT: %.loc14_55.3: %D = acquire_value %.loc14_55.2 [concrete = constants.%D.val.db4] +// CHECK:STDOUT: %impl.elem0.loc22_53.1: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc22_53.1: = bound_method %int_3, %impl.elem0.loc22_53.1 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.b3c] +// CHECK:STDOUT: %specific_fn.loc22_53.1: = specific_function %impl.elem0.loc22_53.1, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc22_53.2: = bound_method %int_3, %specific_fn.loc22_53.1 [concrete = constants.%bound_method.fb0] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc22_53.1: init %i32 = call %bound_method.loc22_53.2(%int_3) [concrete = constants.%int_3.9f3] +// CHECK:STDOUT: %.loc22_53.2: init %i32 = converted %int_3, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc22_53.1 [concrete = constants.%int_3.9f3] +// CHECK:STDOUT: %.loc22_53.3: ref %D = temporary_storage +// CHECK:STDOUT: %.loc22_53.4: ref %i32 = class_element_access %.loc22_53.3, element0 +// CHECK:STDOUT: %.loc22_53.5: init %i32 to %.loc22_53.4 = in_place_init %.loc22_53.2 [concrete = constants.%int_3.9f3] +// CHECK:STDOUT: %impl.elem0.loc22_53.2: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc22_53.3: = bound_method %int_4, %impl.elem0.loc22_53.2 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.776] +// CHECK:STDOUT: %specific_fn.loc22_53.2: = specific_function %impl.elem0.loc22_53.2, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc22_53.4: = bound_method %int_4, %specific_fn.loc22_53.2 [concrete = constants.%bound_method.7fa] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc22_53.2: init %i32 = call %bound_method.loc22_53.4(%int_4) [concrete = constants.%int_4.6bf] +// CHECK:STDOUT: %.loc22_53.6: init %i32 = converted %int_4, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc22_53.2 [concrete = constants.%int_4.6bf] +// CHECK:STDOUT: %.loc22_53.7: ref %i32 = class_element_access %.loc22_53.3, element1 +// CHECK:STDOUT: %.loc22_53.8: init %i32 to %.loc22_53.7 = in_place_init %.loc22_53.6 [concrete = constants.%int_4.6bf] +// CHECK:STDOUT: %.loc22_53.9: init %D to %.loc22_53.3 = class_init (%.loc22_53.5, %.loc22_53.8) [concrete = constants.%D.val.db4] +// CHECK:STDOUT: %.loc22_55.1: init %D = converted %.loc22_53.1, %.loc22_53.9 [concrete = constants.%D.val.db4] +// CHECK:STDOUT: %.loc22_55.2: ref %D = temporary %.loc22_53.3, %.loc22_55.1 [concrete = constants.%.c27] +// CHECK:STDOUT: %.loc22_55.3: %D = acquire_value %.loc22_55.2 [concrete = constants.%D.val.db4] // CHECK:STDOUT: %E: type = class_type @E, @E(constants.%D.val.db4) [concrete = constants.%E.dc1] -// CHECK:STDOUT: %.loc14_31.2: ref %E.dc1 = temporary_storage -// CHECK:STDOUT: %.loc14_31.3: init %E.dc1 to %.loc14_31.2 = class_init () [concrete = constants.%E.val] -// CHECK:STDOUT: %.loc14_33: init %E.dc1 = converted %.loc14_31.1, %.loc14_31.3 [concrete = constants.%E.val] -// CHECK:STDOUT: %.loc14_1: %E.468 = converted %.loc14_33, [concrete = ] +// CHECK:STDOUT: %.loc22_31.2: ref %E.dc1 = temporary_storage +// CHECK:STDOUT: %.loc22_31.3: init %E.dc1 to %.loc22_31.2 = class_init () [concrete = constants.%E.val] +// CHECK:STDOUT: %.loc22_33: init %E.dc1 = converted %.loc22_31.1, %.loc22_31.3 [concrete = constants.%E.val] +// CHECK:STDOUT: %.loc22_1: %E.468 = converted %.loc22_33, [concrete = ] // CHECK:STDOUT: assign file.%g.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/implicit_import.carbon b/toolchain/check/testdata/class/implicit_import.carbon index fe59b75f3471..17c680487021 100644 --- a/toolchain/check/testdata/class/implicit_import.carbon +++ b/toolchain/check/testdata/class/implicit_import.carbon @@ -34,8 +34,16 @@ class C {} impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_redecl_after_def.impl.carbon:[[@LINE+3]]:1-8: error: redeclaration of `class C` is redundant [RedeclRedundant] -// CHECK:STDERR: redecl_after_def.carbon:4:1-9: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_redecl_after_def.impl.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: -> │ class C; +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of `class C` is redundant [RedeclRedundant] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ redecl_after_def.carbon +// CHECK:STDERR: │ class C {} +// CHECK:STDERR: · ────┬──── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: class C; @@ -49,8 +57,16 @@ class C {} impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_redef_after_def.impl.carbon:[[@LINE+3]]:1-9: error: redefinition of `class C` [RedeclRedef] -// CHECK:STDERR: redef_after_def.carbon:4:1-9: note: previously defined here [RedeclPrevDef] +// CHECK:STDERR: ╭─┤ fail_redef_after_def.impl.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: -> │ class C {} +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: redefinition of `class C` [RedeclRedef] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ redef_after_def.carbon +// CHECK:STDERR: │ class C {} +// CHECK:STDERR: · ────┬──── +// CHECK:STDERR: · ╰──┤ previously defined here [RedeclPrevDef] +// CHECK:STDERR: ╰──── // CHECK:STDERR: class C {} @@ -65,8 +81,17 @@ alias B = C; impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_def_alias.impl.carbon:[[@LINE+3]]:7: error: duplicate name `B` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: def_alias.carbon:5:7: note: name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╭─┤ fail_def_alias.impl.carbon:[[@LINE+12]]:7 +// CHECK:STDERR: -> │ class B {} +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `B` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ def_alias.carbon +// CHECK:STDERR: │ alias B = C; +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: class B {} @@ -197,7 +222,7 @@ class B {} // CHECK:STDOUT: %C.08d9e3.1: type = class_type @C.1 [concrete] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] -// CHECK:STDOUT: %C.08d9e3.2: type = class_type @C.loc7 [concrete] +// CHECK:STDOUT: %C.08d9e3.2: type = class_type @C.loc15 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -212,7 +237,7 @@ class B {} // CHECK:STDOUT: } // CHECK:STDOUT: %default.import.loc2_31.1 = import // CHECK:STDOUT: %default.import.loc2_31.2 = import -// CHECK:STDOUT: %C.decl: type = class_decl @C.loc7 [concrete = constants.%C.08d9e3.2] {} {} +// CHECK:STDOUT: %C.decl: type = class_decl @C.loc15 [concrete = constants.%C.08d9e3.2] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C.1 [from "redef_after_def.carbon"] { @@ -222,7 +247,7 @@ class B {} // CHECK:STDOUT: .Self = imports.%Main.import_ref.e47 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: class @C.loc7 { +// CHECK:STDOUT: class @C.loc15 { // CHECK:STDOUT: %complete_type: = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type] // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/inheritance/base.carbon b/toolchain/check/testdata/class/inheritance/base.carbon index b8459ccb3708..151f183c33ed 100644 --- a/toolchain/check/testdata/class/inheritance/base.carbon +++ b/toolchain/check/testdata/class/inheritance/base.carbon @@ -42,7 +42,12 @@ base class Base { class Derived { var d: i32; - // CHECK:STDERR: fail_base_after_field.carbon:[[@LINE+2]]:3-20: error: `base` declaration must appear before field declarations [BaseDeclAfterFieldDecl] + // CHECK:STDERR: ╭─┤ fail_base_after_field.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ extend base: Base; + // CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: `base` declaration must appear before field declarations + // CHECK:STDERR: · ┃ [BaseDeclAfterFieldDecl] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend base: Base; } diff --git a/toolchain/check/testdata/class/inheritance/fail_base_as_declared_name.carbon b/toolchain/check/testdata/class/inheritance/fail_base_as_declared_name.carbon index 635c9bbeaab9..26aeb4145b0b 100644 --- a/toolchain/check/testdata/class/inheritance/fail_base_as_declared_name.carbon +++ b/toolchain/check/testdata/class/inheritance/fail_base_as_declared_name.carbon @@ -12,6 +12,12 @@ namespace N; -// CHECK:STDERR: fail_base_as_declared_name.carbon:[[@LINE+2]]:6-9: error: `.` should be followed by a name; prefix reserved word with `r#` to form a valid identifier [ExpectedDeclNameAfterPeriod] +// CHECK:STDERR: ╭─┤ fail_base_as_declared_name.carbon:[[@LINE+8]]:6 +// CHECK:STDERR: -> │ fn N.base() {} +// CHECK:STDERR: · ┳━━━ +// CHECK:STDERR: · ┗━━┫ error: `.` should be followed by a name; prefix reserved word with +// CHECK:STDERR: · ┃ `r#` to form a valid identifier +// CHECK:STDERR: · ┃ [ExpectedDeclNameAfterPeriod] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn N.base() {} diff --git a/toolchain/check/testdata/class/inheritance/fail_base_bad_type.carbon b/toolchain/check/testdata/class/inheritance/fail_base_bad_type.carbon index 569ffe9d8a37..745f06bc812e 100644 --- a/toolchain/check/testdata/class/inheritance/fail_base_bad_type.carbon +++ b/toolchain/check/testdata/class/inheritance/fail_base_bad_type.carbon @@ -15,7 +15,11 @@ library "[[@TEST_NAME]]"; class DeriveFromError { - // CHECK:STDERR: fail_derive_from_error.carbon:[[@LINE+2]]:16-20: error: name `error` not found [NameNotFound] + // CHECK:STDERR: ╭─┤ fail_derive_from_error.carbon:[[@LINE+6]]:16 + // CHECK:STDERR: -> │ extend base: error; + // CHECK:STDERR: · ━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: name `error` not found [NameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend base: error; } @@ -28,8 +32,16 @@ fn AccessMemberWithInvalidBaseError(p: DeriveFromError*) -> i32 { return (*p).n; library "[[@TEST_NAME]]"; class DeriveFromNonType { - // CHECK:STDERR: fail_derive_from_non_type.carbon:[[@LINE+3]]:16-17: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet] - // CHECK:STDERR: fail_derive_from_non_type.carbon:[[@LINE+2]]:16-17: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_derive_from_non_type.carbon:[[@LINE+11]]:16 + // CHECK:STDERR: -> │ extend base: 32; + // CHECK:STDERR: · ┳━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert non-type value of type + // CHECK:STDERR: · │ ┃ `Core.IntLiteral` to `type` + // CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: · ╰────┤ type `Core.IntLiteral` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(type)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend base: 32; } @@ -41,19 +53,44 @@ fn AccessMemberWithInvalidBasNonType(p: DeriveFromNonType*) -> i32 { return (*p) library "[[@TEST_NAME]]"; class DeriveFromi32 { - // CHECK:STDERR: fail_derive_from_i32.carbon:[[@LINE+2]]:16-18: error: deriving from final type `i32`; base type must be an `abstract` or `base` class [BaseIsFinal] + // CHECK:STDERR: ╭─┤ fail_derive_from_i32.carbon:[[@LINE+8]]:16 + // CHECK:STDERR: -> │ extend base: i32; + // CHECK:STDERR: · ┳━━ + // CHECK:STDERR: · ┗━━┫ error: deriving from final type `i32`; base type must be an + // CHECK:STDERR: · ┃ `abstract` or `base` class + // CHECK:STDERR: · ┃ [BaseIsFinal] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend base: i32; } // It's not really important whether this conversion produces an error or not, // but it shouldn't crash. -// CHECK:STDERR: fail_derive_from_i32.carbon:[[@LINE+3]]:53-61: error: cannot implicitly convert expression of type `DeriveFromi32*` to `i32*` [ConversionFailure] -// CHECK:STDERR: fail_derive_from_i32.carbon:[[@LINE+2]]:53-61: note: type `DeriveFromi32*` does not implement interface `Core.ImplicitAs(i32*)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_derive_from_i32.carbon:[[@LINE+16]]:53 +// CHECK:STDERR: -> │ fn ConvertToBadBasei32(p: DeriveFromi32*) -> i32* { return p; } +// CHECK:STDERR: · ┳━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot +// CHECK:STDERR: · │ ┃ implicitly +// CHECK:STDERR: · │ ┃ convert +// CHECK:STDERR: · │ ┃ expression of +// CHECK:STDERR: · │ ┃ type +// CHECK:STDERR: · │ ┃ `DeriveFromi32*` +// CHECK:STDERR: · │ ┃ to `i32*` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╭───────────────────────────────────────────────────╯ +// CHECK:STDERR: · │ type `DeriveFromi32*` does not implement interface `Core.ImplicitAs(i32*)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn ConvertToBadBasei32(p: DeriveFromi32*) -> i32* { return p; } -// CHECK:STDERR: fail_derive_from_i32.carbon:[[@LINE+2]]:70-75: error: member name `n` not found in `DeriveFromi32` [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╭─┤ fail_derive_from_i32.carbon:[[@LINE+8]]:70 +// CHECK:STDERR: -> │ fn AccessMemberWithInvalidBasei32(p: DeriveFromi32*) -> i32 { return (*p).n; } +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: member name `n` not found in `DeriveFromi32` +// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn AccessMemberWithInvalidBasei32(p: DeriveFromi32*) -> i32 { return (*p).n; } @@ -64,13 +101,29 @@ library "[[@TEST_NAME]]"; base class Base {} class DeriveFromTuple { - // CHECK:STDERR: fail_derive_from_tuple.carbon:[[@LINE+2]]:16-22: error: deriving from final type `(Base,)`; base type must be an `abstract` or `base` class [BaseIsFinal] + // CHECK:STDERR: ╭─┤ fail_derive_from_tuple.carbon:[[@LINE+8]]:16 + // CHECK:STDERR: -> │ extend base: (Base,); + // CHECK:STDERR: · ┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: deriving from final type `(Base,)`; base type must be + // CHECK:STDERR: · ┃ an `abstract` or `base` class + // CHECK:STDERR: · ┃ [BaseIsFinal] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend base: (Base,); } -// CHECK:STDERR: fail_derive_from_tuple.carbon:[[@LINE+3]]:61-69: error: cannot implicitly convert expression of type `DeriveFromTuple*` to `(Base,)*` [ConversionFailure] -// CHECK:STDERR: fail_derive_from_tuple.carbon:[[@LINE+2]]:61-69: note: type `DeriveFromTuple*` does not implement interface `Core.ImplicitAs((Base,)*)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_derive_from_tuple.carbon:[[@LINE+13]]:61 +// CHECK:STDERR: -> │ fn ConvertToBadBaseTuple(p: DeriveFromTuple*) -> (Base,)* { return p; } +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: cannot implicitly convert expression of type `DeriveFromTuple*` to +// CHECK:STDERR: · ┃ `(Base,)*` +// CHECK:STDERR: · ┃ [ConversionFailure] +// CHECK:STDERR: · ╭───────────────────────────────────────────────────────────────╯ +// CHECK:STDERR: · │ type `DeriveFromTuple*` does not implement interface +// CHECK:STDERR: · │ `Core.ImplicitAs((Base,)*)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn ConvertToBadBaseTuple(p: DeriveFromTuple*) -> (Base,)* { return p; } @@ -83,13 +136,29 @@ library "[[@TEST_NAME]]"; // TODO: Should we allow this? // We do allow `{.base = {.a: i32, .b: i32}}`. class DeriveFromStruct { - // CHECK:STDERR: fail_derive_from_struct.carbon:[[@LINE+2]]:16-33: error: deriving from final type `{.a: i32, .b: i32}`; base type must be an `abstract` or `base` class [BaseIsFinal] + // CHECK:STDERR: ╭─┤ fail_derive_from_struct.carbon:[[@LINE+8]]:16 + // CHECK:STDERR: -> │ extend base: {.a: i32, .b: i32}; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: deriving from final type `{.a: i32, .b: i32}`; base + // CHECK:STDERR: · ┃ type must be an `abstract` or `base` class + // CHECK:STDERR: · ┃ [BaseIsFinal] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend base: {.a: i32, .b: i32}; } -// CHECK:STDERR: fail_derive_from_struct.carbon:[[@LINE+3]]:74-82: error: cannot implicitly convert expression of type `DeriveFromStruct*` to `{.a: i32, .b: i32}*` [ConversionFailure] -// CHECK:STDERR: fail_derive_from_struct.carbon:[[@LINE+2]]:74-82: note: type `DeriveFromStruct*` does not implement interface `Core.ImplicitAs({.a: i32, .b: i32}*)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_derive_from_struct.carbon:[[@LINE+13]]:74 +// CHECK:STDERR: -> │ ...ToBadBaseStruct(p: DeriveFromStruct*) -> {.a: i32, .b: i32}* { return p; } +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: cannot implicitly convert expression of type `DeriveFromStruct*` to +// CHECK:STDERR: · ┃ `{.a: i32, .b: i32}*` +// CHECK:STDERR: · ┃ [ConversionFailure] +// CHECK:STDERR: · ╭─────────────────────────────────────────────────────────────────────╯ +// CHECK:STDERR: · │ type `DeriveFromStruct*` does not implement interface +// CHECK:STDERR: · │ `Core.ImplicitAs({.a: i32, .b: i32}*)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn ConvertToBadBaseStruct(p: DeriveFromStruct*) -> {.a: i32, .b: i32}* { return p; } @@ -100,19 +169,42 @@ fn AccessMemberWithInvalidBaseStruct(p: DeriveFromStruct*) -> i32 { return (*p). library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_derive_from_incomplete.carbon:[[@LINE+2]]:1-4: error: `base` not allowed on `class` forward declaration, only definition [ModifierOnlyAllowedOnDefinition] +// CHECK:STDERR: ╭─┤ fail_derive_from_incomplete.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ base class Incomplete; +// CHECK:STDERR: · ━━┳━ +// CHECK:STDERR: · ┗━━┫ error: `base` not allowed on `class` forward declaration, only definition +// CHECK:STDERR: · ┃ [ModifierOnlyAllowedOnDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: base class Incomplete; class DeriveFromIncomplete { - // CHECK:STDERR: fail_derive_from_incomplete.carbon:[[@LINE+3]]:16-25: error: base `Incomplete` is an incomplete type [IncompleteTypeInBaseDecl] - // CHECK:STDERR: fail_derive_from_incomplete.carbon:[[@LINE-4]]:1-22: note: class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ╭─┤ fail_derive_from_incomplete.carbon:[[@LINE+11]]:16 + // CHECK:STDERR: │ base class Incomplete; + // CHECK:STDERR: · ───────────┬────────── + // CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ extend base: Incomplete; + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: base `Incomplete` is an incomplete type + // CHECK:STDERR: · ┃ [IncompleteTypeInBaseDecl] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend base: Incomplete; } -// CHECK:STDERR: fail_derive_from_incomplete.carbon:[[@LINE+3]]:74-82: error: cannot implicitly convert expression of type `DeriveFromIncomplete*` to `Incomplete*` [ConversionFailure] -// CHECK:STDERR: fail_derive_from_incomplete.carbon:[[@LINE+2]]:74-82: note: type `DeriveFromIncomplete*` does not implement interface `Core.ImplicitAs(Incomplete*)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_derive_from_incomplete.carbon:[[@LINE+13]]:74 +// CHECK:STDERR: -> │ ...ToBadBaseIncomplete(p: DeriveFromIncomplete*) -> Incomplete* { return p; } +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: cannot implicitly convert expression of type `DeriveFromIncomplete*` to +// CHECK:STDERR: · ┃ `Incomplete*` +// CHECK:STDERR: · ┃ [ConversionFailure] +// CHECK:STDERR: · ╭─────────────────────────────────────────────────────────────────────╯ +// CHECK:STDERR: · │ type `DeriveFromIncomplete*` does not implement interface +// CHECK:STDERR: · │ `Core.ImplicitAs(Incomplete*)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn ConvertToBadBaseIncomplete(p: DeriveFromIncomplete*) -> Incomplete* { return p; } @@ -127,7 +219,13 @@ class Final { } class DeriveFromFinal { - // CHECK:STDERR: fail_derive_from_final.carbon:[[@LINE+2]]:16-20: error: deriving from final type `Final`; base type must be an `abstract` or `base` class [BaseIsFinal] + // CHECK:STDERR: ╭─┤ fail_derive_from_final.carbon:[[@LINE+8]]:16 + // CHECK:STDERR: -> │ extend base: Final; + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: deriving from final type `Final`; base type must be + // CHECK:STDERR: · ┃ an `abstract` or `base` class + // CHECK:STDERR: · ┃ [BaseIsFinal] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend base: Final; } @@ -142,7 +240,12 @@ fn AccessMemberWithInvalidBaseFinal_WithMember(p: DeriveFromFinal*) -> i32 { } fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { - // CHECK:STDERR: fail_derive_from_final.carbon:[[@LINE+2]]:10-15: error: member name `b` not found in `DeriveFromFinal` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╭─┤ fail_derive_from_final.carbon:[[@LINE+7]]:10 + // CHECK:STDERR: -> │ return (*p).b; + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: member name `b` not found in `DeriveFromFinal` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return (*p).b; } diff --git a/toolchain/check/testdata/class/inheritance/fail_base_method_define.carbon b/toolchain/check/testdata/class/inheritance/fail_base_method_define.carbon index de0792d7d072..050717ff953c 100644 --- a/toolchain/check/testdata/class/inheritance/fail_base_method_define.carbon +++ b/toolchain/check/testdata/class/inheritance/fail_base_method_define.carbon @@ -22,10 +22,19 @@ class D { extend base: B; } -// CHECK:STDERR: fail_base_method_define.carbon:[[@LINE+2]]:6: error: out-of-line declaration requires a declaration in scoped entity [QualifiedDeclOutsideScopeEntity] +// CHECK:STDERR: ╭─┤ fail_base_method_define.carbon:[[@LINE+7]]:6 +// CHECK:STDERR: -> │ fn D.F() {} +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: out-of-line declaration requires a declaration in scoped entity +// CHECK:STDERR: · ┃ [QualifiedDeclOutsideScopeEntity] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn D.F() {} -// CHECK:STDERR: fail_base_method_define.carbon:[[@LINE+2]]:6: error: name `C` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_base_method_define.carbon:[[@LINE+6]]:6 +// CHECK:STDERR: -> │ fn D.C.F() {} +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: name `C` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn D.C.F() {} diff --git a/toolchain/check/testdata/class/inheritance/fail_base_misplaced.carbon b/toolchain/check/testdata/class/inheritance/fail_base_misplaced.carbon index 57db0c28ed71..33e918c9193e 100644 --- a/toolchain/check/testdata/class/inheritance/fail_base_misplaced.carbon +++ b/toolchain/check/testdata/class/inheritance/fail_base_misplaced.carbon @@ -12,19 +12,34 @@ base class B {} -// CHECK:STDERR: fail_base_misplaced.carbon:[[@LINE+2]]:1-15: error: `base` declaration outside class [ClassSpecificDeclOutsideClass] +// CHECK:STDERR: ╭─┤ fail_base_misplaced.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ extend base: B; +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `base` declaration outside class +// CHECK:STDERR: · ┃ [ClassSpecificDeclOutsideClass] +// CHECK:STDERR: ╰──── // CHECK:STDERR: extend base: B; fn F() { - // CHECK:STDERR: fail_base_misplaced.carbon:[[@LINE+2]]:3-17: error: `base` declaration outside class [ClassSpecificDeclOutsideClass] + // CHECK:STDERR: ╭─┤ fail_base_misplaced.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ extend base: B; + // CHECK:STDERR: · ━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: `base` declaration outside class + // CHECK:STDERR: · ┃ [ClassSpecificDeclOutsideClass] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend base: B; } class C { fn F() { - // CHECK:STDERR: fail_base_misplaced.carbon:[[@LINE+2]]:5-19: error: `base` declaration outside class [ClassSpecificDeclOutsideClass] + // CHECK:STDERR: ╭─┤ fail_base_misplaced.carbon:[[@LINE+7]]:5 + // CHECK:STDERR: -> │ extend base: B; + // CHECK:STDERR: · ━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: `base` declaration outside class + // CHECK:STDERR: · ┃ [ClassSpecificDeclOutsideClass] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend base: B; } diff --git a/toolchain/check/testdata/class/inheritance/fail_base_modifiers.carbon b/toolchain/check/testdata/class/inheritance/fail_base_modifiers.carbon index ae33ddab8d5a..54b2372e4528 100644 --- a/toolchain/check/testdata/class/inheritance/fail_base_modifiers.carbon +++ b/toolchain/check/testdata/class/inheritance/fail_base_modifiers.carbon @@ -13,28 +13,52 @@ base class B {} class C1 { - // CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+2]]:3-9: error: `private` not allowed on `base` declaration [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_modifiers.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ private extend base: B; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: `private` not allowed on `base` declaration + // CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: private extend base: B; } class C2 { - // CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+4]]:3-10: error: `abstract` not allowed on `base` declaration [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_modifiers.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: -> │ abstract base: B; + // CHECK:STDERR: · ━━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: `abstract` not allowed on `base` declaration + // CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+2]]:3-19: error: missing `extend` before `base` declaration [BaseMissingExtend] + // CHECK:STDERR: ╭─┤ fail_base_modifiers.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ abstract base: B; + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: missing `extend` before `base` declaration + // CHECK:STDERR: · ┃ [BaseMissingExtend] + // CHECK:STDERR: ╰──── // CHECK:STDERR: abstract base: B; } class C3 { - // CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+2]]:10-16: error: `default` not allowed on `base` declaration [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_modifiers.carbon:[[@LINE+7]]:10 + // CHECK:STDERR: -> │ extend default base: B; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: `default` not allowed on `base` declaration + // CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend default base: B; } class C4 { - // CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+3]]:10-15: error: `extend` repeated on declaration [ModifierRepeated] - // CHECK:STDERR: fail_base_modifiers.carbon:[[@LINE+2]]:3-8: note: `extend` previously appeared here [ModifierPrevious] + // CHECK:STDERR: ╭─┤ fail_base_modifiers.carbon:[[@LINE+7]]:10 + // CHECK:STDERR: -> │ extend extend base: B; + // CHECK:STDERR: · ───┬── ━━━┳━━ + // CHECK:STDERR: · │ ┗━━┫ error: `extend` repeated on declaration [ModifierRepeated] + // CHECK:STDERR: · ╰───────────┤ `extend` previously appeared here [ModifierPrevious] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend extend base: B; } diff --git a/toolchain/check/testdata/class/inheritance/fail_base_no_extend.carbon b/toolchain/check/testdata/class/inheritance/fail_base_no_extend.carbon index 24760fb61a0d..7afdf3ff4580 100644 --- a/toolchain/check/testdata/class/inheritance/fail_base_no_extend.carbon +++ b/toolchain/check/testdata/class/inheritance/fail_base_no_extend.carbon @@ -13,7 +13,11 @@ base class B {} class C { - // CHECK:STDERR: fail_base_no_extend.carbon:[[@LINE+2]]:3-10: error: missing `extend` before `base` declaration [BaseMissingExtend] + // CHECK:STDERR: ╭─┤ fail_base_no_extend.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ base: B; + // CHECK:STDERR: · ━━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: missing `extend` before `base` declaration [BaseMissingExtend] + // CHECK:STDERR: ╰──── // CHECK:STDERR: base: B; } diff --git a/toolchain/check/testdata/class/inheritance/fail_base_repeated.carbon b/toolchain/check/testdata/class/inheritance/fail_base_repeated.carbon index dc13641990f3..403070bfcfb1 100644 --- a/toolchain/check/testdata/class/inheritance/fail_base_repeated.carbon +++ b/toolchain/check/testdata/class/inheritance/fail_base_repeated.carbon @@ -15,8 +15,17 @@ base class B2 {} class C { extend base: B1; - // CHECK:STDERR: fail_base_repeated.carbon:[[@LINE+3]]:3-18: error: multiple `base` declarations in class; multiple inheritance is not permitted [BaseDeclRepeated] - // CHECK:STDERR: fail_base_repeated.carbon:[[@LINE-2]]:3-18: note: previous `base` declaration is here [ClassSpecificDeclPrevious] + // CHECK:STDERR: ╭─┤ fail_base_repeated.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ extend base: B1; + // CHECK:STDERR: · ────────┬─────── + // CHECK:STDERR: · ╰──┤ previous `base` declaration is here [ClassSpecificDeclPrevious] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ extend base: B2; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: multiple `base` declarations in class; multiple inheritance is not + // CHECK:STDERR: · ┃ permitted + // CHECK:STDERR: · ┃ [BaseDeclRepeated] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend base: B2; } @@ -24,8 +33,17 @@ class C { class D { // TODO: Consider adding a custom diagnostic for this case. extend base: B1; - // CHECK:STDERR: fail_base_repeated.carbon:[[@LINE+3]]:3-18: error: multiple `base` declarations in class; multiple inheritance is not permitted [BaseDeclRepeated] - // CHECK:STDERR: fail_base_repeated.carbon:[[@LINE-2]]:3-18: note: previous `base` declaration is here [ClassSpecificDeclPrevious] + // CHECK:STDERR: ╭─┤ fail_base_repeated.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ extend base: B1; + // CHECK:STDERR: · ────────┬─────── + // CHECK:STDERR: · ╰──┤ previous `base` declaration is here [ClassSpecificDeclPrevious] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ extend base: B1; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: multiple `base` declarations in class; multiple inheritance is not + // CHECK:STDERR: · ┃ permitted + // CHECK:STDERR: · ┃ [BaseDeclRepeated] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend base: B1; } diff --git a/toolchain/check/testdata/class/inheritance/fail_base_unbound.carbon b/toolchain/check/testdata/class/inheritance/fail_base_unbound.carbon index fcd7f14b32ec..a1e8d166c0fe 100644 --- a/toolchain/check/testdata/class/inheritance/fail_base_unbound.carbon +++ b/toolchain/check/testdata/class/inheritance/fail_base_unbound.carbon @@ -16,6 +16,11 @@ class C { extend base: B; } -// CHECK:STDERR: fail_base_unbound.carbon:[[@LINE+2]]:12-17: error: expression cannot be used as a value [UseOfNonExprAsValue] +// CHECK:STDERR: ╭─┤ fail_base_unbound.carbon:[[@LINE+7]]:12 +// CHECK:STDERR: -> │ let b: B = C.base; +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: expression cannot be used as a value +// CHECK:STDERR: · ┃ [UseOfNonExprAsValue] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let b: B = C.base; diff --git a/toolchain/check/testdata/class/inheritance/fail_derived_to_base.carbon b/toolchain/check/testdata/class/inheritance/fail_derived_to_base.carbon index 90d64e72b125..c95c5cf96044 100644 --- a/toolchain/check/testdata/class/inheritance/fail_derived_to_base.carbon +++ b/toolchain/check/testdata/class/inheritance/fail_derived_to_base.carbon @@ -23,14 +23,34 @@ class B2 { var b: i32; } -// CHECK:STDERR: fail_derived_to_base.carbon:[[@LINE+3]]:38-46: error: cannot implicitly convert expression of type `B2*` to `A1*` [ConversionFailure] -// CHECK:STDERR: fail_derived_to_base.carbon:[[@LINE+2]]:38-46: note: type `B2*` does not implement interface `Core.ImplicitAs(A1*)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_derived_to_base.carbon:[[@LINE+12]]:38 +// CHECK:STDERR: -> │ fn ConvertUnrelated(p: B2*) -> A1* { return p; } +// CHECK:STDERR: · ┳━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert +// CHECK:STDERR: · │ ┃ expression of type `B2*` to +// CHECK:STDERR: · │ ┃ `A1*` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╰────┤ type `B2*` does not implement +// CHECK:STDERR: · │ interface `Core.ImplicitAs(A1*)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn ConvertUnrelated(p: B2*) -> A1* { return p; } class Incomplete; -// CHECK:STDERR: fail_derived_to_base.carbon:[[@LINE+3]]:47-55: error: cannot implicitly convert expression of type `Incomplete*` to `A2*` [ConversionFailure] -// CHECK:STDERR: fail_derived_to_base.carbon:[[@LINE+2]]:47-55: note: type `Incomplete*` does not implement interface `Core.ImplicitAs(A2*)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_derived_to_base.carbon:[[@LINE+14]]:47 +// CHECK:STDERR: -> │ fn ConvertIncomplete(p: Incomplete*) -> A2* { return p; } +// CHECK:STDERR: · ┳━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly +// CHECK:STDERR: · │ ┃ convert expression of +// CHECK:STDERR: · │ ┃ type `Incomplete*` to +// CHECK:STDERR: · │ ┃ `A2*` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╰────┤ type `Incomplete*` does not +// CHECK:STDERR: · │ implement interface +// CHECK:STDERR: · │ `Core.ImplicitAs(A2*)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn ConvertIncomplete(p: Incomplete*) -> A2* { return p; } diff --git a/toolchain/check/testdata/class/inheritance/fail_extend_cycle.carbon b/toolchain/check/testdata/class/inheritance/fail_extend_cycle.carbon index b64e7dff28e3..cd817dab22d6 100644 --- a/toolchain/check/testdata/class/inheritance/fail_extend_cycle.carbon +++ b/toolchain/check/testdata/class/inheritance/fail_extend_cycle.carbon @@ -18,12 +18,23 @@ base class B { extend base: A; } -// CHECK:STDERR: fail_extend_cycle.carbon:[[@LINE+3]]:1-14: error: redefinition of `class A` [RedeclRedef] -// CHECK:STDERR: fail_extend_cycle.carbon:[[@LINE-9]]:1-14: note: previously defined here [RedeclPrevDef] +// CHECK:STDERR: ╭─┤ fail_extend_cycle.carbon:[[@LINE+10]]:1 +// CHECK:STDERR: │ base class A { +// CHECK:STDERR: · ───────┬────── +// CHECK:STDERR: · ╰──┤ previously defined here [RedeclPrevDef] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ base class A { +// CHECK:STDERR: · ━━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redefinition of `class A` [RedeclRedef] +// CHECK:STDERR: ╰──── // CHECK:STDERR: base class A { extend base: A; - // CHECK:STDERR: fail_extend_cycle.carbon:[[@LINE+2]]:10: error: name `C` not found [NameNotFound] + // CHECK:STDERR: ╭─┤ fail_extend_cycle.carbon:[[@LINE+6]]:10 + // CHECK:STDERR: -> │ var c: C; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: name `C` not found [NameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var c: C; } diff --git a/toolchain/check/testdata/class/inheritance/fail_init_missing_base.carbon b/toolchain/check/testdata/class/inheritance/fail_init_missing_base.carbon index d53d5f33e444..1eba8d7ddcdc 100644 --- a/toolchain/check/testdata/class/inheritance/fail_init_missing_base.carbon +++ b/toolchain/check/testdata/class/inheritance/fail_init_missing_base.carbon @@ -17,7 +17,12 @@ class Z { } fn Run() { - // CHECK:STDERR: fail_init_missing_base.carbon:[[@LINE+2]]:14-15: error: missing value for field `base` in struct initialization [StructInitMissingFieldInLiteral] + // CHECK:STDERR: ╭─┤ fail_init_missing_base.carbon:[[@LINE+7]]:14 + // CHECK:STDERR: -> │ var _: Z = {}; + // CHECK:STDERR: · ┳━ + // CHECK:STDERR: · ┗━━┫ error: missing value for field `base` in struct initialization + // CHECK:STDERR: · ┃ [StructInitMissingFieldInLiteral] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var _: Z = {}; } diff --git a/toolchain/check/testdata/class/method/bound_method_value.carbon b/toolchain/check/testdata/class/method/bound_method_value.carbon index 0576dac0c1ad..91347d62cdb5 100644 --- a/toolchain/check/testdata/class/method/bound_method_value.carbon +++ b/toolchain/check/testdata/class/method/bound_method_value.carbon @@ -18,8 +18,16 @@ class C { } fn F(c: C) { - // CHECK:STDERR: fail_implicit_conversion.carbon:[[@LINE+3]]:3-12: error: cannot implicitly convert expression of type `` to `i32` [ConversionFailure] - // CHECK:STDERR: fail_implicit_conversion.carbon:[[@LINE+2]]:3-12: note: type `` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_implicit_conversion.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: -> │ var _: i32 = c.Get; + // CHECK:STDERR: · ┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `` to + // CHECK:STDERR: · │ ┃ `i32` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(i32)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var _: i32 = c.Get; } @@ -32,8 +40,16 @@ class C { } fn F(c: C) -> i32 { - // CHECK:STDERR: fail_as.carbon:[[@LINE+3]]:10-21: error: cannot convert expression of type `` to `i32` with `as` [ConversionFailure] - // CHECK:STDERR: fail_as.carbon:[[@LINE+2]]:10-21: note: type `` does not implement interface `Core.As(i32)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_as.carbon:[[@LINE+11]]:10 + // CHECK:STDERR: -> │ return c.Get as i32; + // CHECK:STDERR: · ┳━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `` to `i32` + // CHECK:STDERR: · │ ┃ with `as` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `` does not implement interface + // CHECK:STDERR: · │ `Core.As(i32)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return c.Get as i32; } @@ -50,7 +66,13 @@ class C { } fn F(c: C) { - // CHECK:STDERR: fail_interface_member.carbon:[[@LINE+2]]:3-14: error: cannot access member of interface `I` in type `` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_interface_member.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ c.Get.(I.Op)(); + // CHECK:STDERR: · ┳━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `I` in type `` + // CHECK:STDERR: · ┃ that does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: c.Get.(I.Op)(); } @@ -63,8 +85,15 @@ class C { } fn F(c: C) { - // CHECK:STDERR: fail_copy.carbon:[[@LINE+3]]:26-30: error: cannot copy value of type `` [CopyOfUncopyableType] - // CHECK:STDERR: fail_copy.carbon:[[@LINE+2]]:26-30: note: type `` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_copy.carbon:[[@LINE+10]]:26 + // CHECK:STDERR: -> │ var _: typeof(c.Get) = c.Get; + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot copy value of type `` + // CHECK:STDERR: · │ ┃ [CopyOfUncopyableType] + // CHECK:STDERR: · ╰────┤ type `` does not implement + // CHECK:STDERR: · │ interface `Core.Copy` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var _: typeof(c.Get) = c.Get; } diff --git a/toolchain/check/testdata/class/method/fail_call_without_method_syntax.carbon b/toolchain/check/testdata/class/method/fail_call_without_method_syntax.carbon index 2ad1b2dde9bc..a2bed5a9bc07 100644 --- a/toolchain/check/testdata/class/method/fail_call_without_method_syntax.carbon +++ b/toolchain/check/testdata/class/method/fail_call_without_method_syntax.carbon @@ -24,23 +24,50 @@ class Other {} // When a method is called as an ordinary function, `self` is an ordinary // argument, so the usual arity and conversion rules apply. fn TooFew() -> i32 { - // CHECK:STDERR: fail_call_without_method_syntax.carbon:[[@LINE+3]]:10-20: error: 0 arguments passed to function expecting 1 argument [CallArgCountMismatch] - // CHECK:STDERR: fail_call_without_method_syntax.carbon:[[@LINE-11]]:3-23: note: calling function declared here [InCallToEntity] + // CHECK:STDERR: ╭─┤ fail_call_without_method_syntax.carbon:[[@LINE+11]]:10 + // CHECK:STDERR: │ fn Get(self) -> i32 { return self.x; } + // CHECK:STDERR: · ──────────┬────────── + // CHECK:STDERR: · ╰──┤ calling function declared here [InCallToEntity] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ return Point.Get(); + // CHECK:STDERR: · ━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: 0 arguments passed to function expecting 1 argument + // CHECK:STDERR: · ┃ [CallArgCountMismatch] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return Point.Get(); } fn TooMany(p: Point) -> i32 { - // CHECK:STDERR: fail_call_without_method_syntax.carbon:[[@LINE+3]]:10-24: error: 2 arguments passed to function expecting 1 argument [CallArgCountMismatch] - // CHECK:STDERR: fail_call_without_method_syntax.carbon:[[@LINE-18]]:3-23: note: calling function declared here [InCallToEntity] + // CHECK:STDERR: ╭─┤ fail_call_without_method_syntax.carbon:[[@LINE+11]]:10 + // CHECK:STDERR: │ fn Get(self) -> i32 { return self.x; } + // CHECK:STDERR: · ──────────┬────────── + // CHECK:STDERR: · ╰──┤ calling function declared here [InCallToEntity] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ return Point.Get(p, p); + // CHECK:STDERR: · ━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: 2 arguments passed to function expecting 1 argument + // CHECK:STDERR: · ┃ [CallArgCountMismatch] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return Point.Get(p, p); } fn WrongSelfType(o: Other) -> i32 { - // CHECK:STDERR: fail_call_without_method_syntax.carbon:[[@LINE+4]]:20: error: cannot implicitly convert expression of type `Other` to `Point` [ConversionFailure] - // CHECK:STDERR: fail_call_without_method_syntax.carbon:[[@LINE+3]]:20: note: type `Other` does not implement interface `Core.ImplicitAs(Point)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: fail_call_without_method_syntax.carbon:[[@LINE-26]]:10-13: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_call_without_method_syntax.carbon:[[@LINE+15]]:20 + // CHECK:STDERR: │ fn Get(self) -> i32 { return self.x; } + // CHECK:STDERR: · ──┬─ + // CHECK:STDERR: · ╰──┤ initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ return Point.Get(o); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type + // CHECK:STDERR: · │ ┃ `Other` to `Point` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Other` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(Point)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return Point.Get(o); } diff --git a/toolchain/check/testdata/class/method/fail_generic_method.carbon b/toolchain/check/testdata/class/method/fail_generic_method.carbon index 05f964c5835d..1adba55ceadc 100644 --- a/toolchain/check/testdata/class/method/fail_generic_method.carbon +++ b/toolchain/check/testdata/class/method/fail_generic_method.carbon @@ -19,11 +19,32 @@ class Class(T: type) { // TODO: The follow-on errors here aren't great. Investigate whether we can // enter the scope anyway if the parameters don't match. -// CHECK:STDERR: fail_generic_method.carbon:[[@LINE+7]]:17-20: error: type `` of parameter 1 in redeclaration differs from previous parameter type `` [RedeclParamDiffersType] -// CHECK:STDERR: fail_generic_method.carbon:[[@LINE-8]]:13-19: note: previous declaration's corresponding parameter here [RedeclParamPrevious] +// CHECK:STDERR: ╭─┤ fail_generic_method.carbon:[[@LINE+28]]:17 +// CHECK:STDERR: │ class Class(T: type) { +// CHECK:STDERR: · ───┬─── +// CHECK:STDERR: · ╰──┤ previous declaration's corresponding parameter here +// CHECK:STDERR: · │ [RedeclParamPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn Class(unused N: I).F(unused self, unused n: T) {} +// CHECK:STDERR: · ┳━━━ +// CHECK:STDERR: · ┗━━┫ error: type `` of parameter 1 in +// CHECK:STDERR: · ┃ redeclaration differs from previous parameter type +// CHECK:STDERR: · ┃ `` +// CHECK:STDERR: · ┃ [RedeclParamDiffersType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_generic_method.carbon:[[@LINE+4]]:32-35: error: name `Self` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_generic_method.carbon:[[@LINE+14]]:32 +// CHECK:STDERR: -> │ fn Class(unused N: I).F(unused self, unused n: T) {} +// CHECK:STDERR: · ━━┳━ +// CHECK:STDERR: · ┗━━┫ error: name `Self` not found +// CHECK:STDERR: · ┃ [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_generic_method.carbon:[[@LINE+2]]:48: error: name `T` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_generic_method.carbon:[[@LINE+7]]:48 +// CHECK:STDERR: -> │ fn Class(unused N: I).F(unused self, unused n: T) {} +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: name `T` not found +// CHECK:STDERR: · ┃ [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Class(unused N: I).F(unused self, unused n: T) {} diff --git a/toolchain/check/testdata/class/method/fail_method.carbon b/toolchain/check/testdata/class/method/fail_method.carbon index 4f49c62e919e..9eea153dd6d6 100644 --- a/toolchain/check/testdata/class/method/fail_method.carbon +++ b/toolchain/check/testdata/class/method/fail_method.carbon @@ -22,14 +22,30 @@ fn F(c: Class) { c.WithSelf(); Class.NoSelf(); - // CHECK:STDERR: fail_method.carbon:[[@LINE+3]]:3-18: error: 0 arguments passed to function expecting 1 argument [CallArgCountMismatch] - // CHECK:STDERR: fail_method.carbon:[[@LINE-11]]:3-27: note: calling function declared here [InCallToEntity] + // CHECK:STDERR: ╭─┤ fail_method.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ fn WithSelf(self: Class); + // CHECK:STDERR: · ────────────┬──────────── + // CHECK:STDERR: · ╰──┤ calling function declared here [InCallToEntity] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Class.WithSelf(); + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: 0 arguments passed to function expecting 1 argument + // CHECK:STDERR: · ┃ [CallArgCountMismatch] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Class.WithSelf(); Class.WithSelf(c); - // CHECK:STDERR: fail_method.carbon:[[@LINE+3]]:3-5: error: 0 arguments passed to function expecting 1 argument [CallArgCountMismatch] - // CHECK:STDERR: fail_method.carbon:[[@LINE-17]]:3-27: note: calling function declared here [InCallToEntity] + // CHECK:STDERR: ╭─┤ fail_method.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ fn WithSelf(self: Class); + // CHECK:STDERR: · ────────────┬──────────── + // CHECK:STDERR: · ╰──┤ calling function declared here [InCallToEntity] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ A(); + // CHECK:STDERR: · ━┳━ + // CHECK:STDERR: · ┗━━┫ error: 0 arguments passed to function expecting 1 argument + // CHECK:STDERR: · ┃ [CallArgCountMismatch] + // CHECK:STDERR: ╰──── // CHECK:STDERR: A(); } diff --git a/toolchain/check/testdata/class/method/fail_method_modifiers.carbon b/toolchain/check/testdata/class/method/fail_method_modifiers.carbon index 06b8368e85f9..9c0a040b39ad 100644 --- a/toolchain/check/testdata/class/method/fail_method_modifiers.carbon +++ b/toolchain/check/testdata/class/method/fail_method_modifiers.carbon @@ -12,32 +12,66 @@ class FinalClass { - // CHECK:STDERR: fail_method_modifiers.carbon:[[@LINE+3]]:3-10: error: `abstract` not allowed; requires `abstract` class scope [ModifierAbstractNotAllowed] - // CHECK:STDERR: fail_method_modifiers.carbon:[[@LINE-3]]:1-18: note: containing definition here [ModifierNotInContext] + // CHECK:STDERR: ╭─┤ fail_method_modifiers.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ class FinalClass { + // CHECK:STDERR: · ─────────┬──────── + // CHECK:STDERR: · ╰──┤ containing definition here [ModifierNotInContext] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ abstract fn Abstract(self); + // CHECK:STDERR: · ━━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: `abstract` not allowed; requires `abstract` class scope + // CHECK:STDERR: · ┃ [ModifierAbstractNotAllowed] + // CHECK:STDERR: ╰──── // CHECK:STDERR: abstract fn Abstract(self); - // CHECK:STDERR: fail_method_modifiers.carbon:[[@LINE+3]]:3-9: error: `virtual` not allowed; requires `abstract` or `base` class scope [ModifierVirtualNotAllowed] - // CHECK:STDERR: fail_method_modifiers.carbon:[[@LINE-8]]:1-18: note: containing definition here [ModifierNotInContext] + // CHECK:STDERR: ╭─┤ fail_method_modifiers.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ class FinalClass { + // CHECK:STDERR: · ─────────┬──────── + // CHECK:STDERR: · ╰──┤ containing definition here [ModifierNotInContext] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ virtual fn Virtual(self); + // CHECK:STDERR: · ━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: `virtual` not allowed; requires `abstract` or `base` class scope + // CHECK:STDERR: · ┃ [ModifierVirtualNotAllowed] + // CHECK:STDERR: ╰──── // CHECK:STDERR: virtual fn Virtual(self); } abstract class AbstractClass { - // CHECK:STDERR: fail_method_modifiers.carbon:[[@LINE+2]]:3-9: error: `default` not allowed; requires interface scope [ModifierRequiresInterface] + // CHECK:STDERR: ╭─┤ fail_method_modifiers.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ default fn Default(self); + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: `default` not allowed; requires interface scope + // CHECK:STDERR: · ┃ [ModifierRequiresInterface] + // CHECK:STDERR: ╰──── // CHECK:STDERR: default fn Default(self); - // CHECK:STDERR: fail_method_modifiers.carbon:[[@LINE+2]]:3-7: error: `final` not allowed; requires interface scope [ModifierRequiresInterface] + // CHECK:STDERR: ╭─┤ fail_method_modifiers.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ final fn Final(self); + // CHECK:STDERR: · ━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: `final` not allowed; requires interface scope + // CHECK:STDERR: · ┃ [ModifierRequiresInterface] + // CHECK:STDERR: ╰──── // CHECK:STDERR: final fn Final(self); } base class BaseClass { - // CHECK:STDERR: fail_method_modifiers.carbon:[[@LINE+3]]:3-10: error: `abstract` not allowed; requires `abstract` class scope [ModifierAbstractNotAllowed] - // CHECK:STDERR: fail_method_modifiers.carbon:[[@LINE-3]]:1-22: note: containing definition here [ModifierNotInContext] + // CHECK:STDERR: ╭─┤ fail_method_modifiers.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ base class BaseClass { + // CHECK:STDERR: · ───────────┬────────── + // CHECK:STDERR: · ╰──┤ containing definition here [ModifierNotInContext] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ abstract fn Abstract(self); + // CHECK:STDERR: · ━━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: `abstract` not allowed; requires `abstract` class scope + // CHECK:STDERR: · ┃ [ModifierAbstractNotAllowed] + // CHECK:STDERR: ╰──── // CHECK:STDERR: abstract fn Abstract(self); } diff --git a/toolchain/check/testdata/class/method/fail_method_redefinition.carbon b/toolchain/check/testdata/class/method/fail_method_redefinition.carbon index 6c4a7a60c24d..11e3ef2d9866 100644 --- a/toolchain/check/testdata/class/method/fail_method_redefinition.carbon +++ b/toolchain/check/testdata/class/method/fail_method_redefinition.carbon @@ -12,8 +12,15 @@ class Class { fn F() {} - // CHECK:STDERR: fail_method_redefinition.carbon:[[@LINE+3]]:3-10: error: redefinition of `fn F` [RedeclRedef] - // CHECK:STDERR: fail_method_redefinition.carbon:[[@LINE-2]]:3-10: note: previously defined here [RedeclPrevDef] + // CHECK:STDERR: ╭─┤ fail_method_redefinition.carbon:[[@LINE+10]]:3 + // CHECK:STDERR: │ fn F() {} + // CHECK:STDERR: · ────┬─── + // CHECK:STDERR: · ╰──┤ previously defined here [RedeclPrevDef] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ fn F() {} + // CHECK:STDERR: · ━━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: redefinition of `fn F` [RedeclRedef] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn F() {} } diff --git a/toolchain/check/testdata/class/method/fail_out_of_line_decl.carbon b/toolchain/check/testdata/class/method/fail_out_of_line_decl.carbon index 9ec715968afa..cfb4a0d22a31 100644 --- a/toolchain/check/testdata/class/method/fail_out_of_line_decl.carbon +++ b/toolchain/check/testdata/class/method/fail_out_of_line_decl.carbon @@ -12,6 +12,11 @@ class C {} -// CHECK:STDERR: fail_out_of_line_decl.carbon:[[@LINE+2]]:6: error: out-of-line declaration requires a declaration in scoped entity [QualifiedDeclOutsideScopeEntity] +// CHECK:STDERR: ╭─┤ fail_out_of_line_decl.carbon:[[@LINE+7]]:6 +// CHECK:STDERR: -> │ fn C.F() {} +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: out-of-line declaration requires a declaration in scoped entity +// CHECK:STDERR: · ┃ [QualifiedDeclOutsideScopeEntity] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn C.F() {} diff --git a/toolchain/check/testdata/class/method/virtual.carbon b/toolchain/check/testdata/class/method/virtual.carbon index 02fb38a611c8..c7e7d305d660 100644 --- a/toolchain/check/testdata/class/method/virtual.carbon +++ b/toolchain/check/testdata/class/method/virtual.carbon @@ -110,7 +110,11 @@ fn Use() { library "[[@TEST_NAME]]"; class C { - // CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:3-22: error: override without base class [OverrideWithoutBase] + // CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ override fn F(self); + // CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: override without base class [OverrideWithoutBase] + // CHECK:STDERR: ╰──── // CHECK:STDERR: override fn F(self); } @@ -145,7 +149,12 @@ base class Base { class Derived { extend base: Base; - // CHECK:STDERR: fail_impl_without_base_declaration.carbon:[[@LINE+2]]:3-22: error: override without compatible virtual in base class [OverrideWithoutVirtualInBase] + // CHECK:STDERR: ╭─┤ fail_impl_without_base_declaration.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ override fn F(self); + // CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: override without compatible virtual in base class + // CHECK:STDERR: · ┃ [OverrideWithoutVirtualInBase] + // CHECK:STDERR: ╰──── // CHECK:STDERR: override fn F(self); } @@ -198,8 +207,17 @@ base class Base { class Derived { extend base: Base; - // CHECK:STDERR: fail_impl_mismatch.carbon:[[@LINE+3]]:3-30: error: override without compatible virtual in base class [OverrideWithoutVirtualInBase] - // CHECK:STDERR: fail_impl_mismatch.carbon:[[@LINE-6]]:3-21: note: base class function has fewer parameters (0 vs 1 excluding `self`) [OverrideCandidateArityMismatch] + // CHECK:STDERR: ╭─┤ fail_impl_mismatch.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ virtual fn F(self); + // CHECK:STDERR: · ───────┬─────────── + // CHECK:STDERR: · ╰──┤ base class function has fewer parameters (0 vs 1 excluding `self`) + // CHECK:STDERR: · │ [OverrideCandidateArityMismatch] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ override fn F(self, v: i32); + // CHECK:STDERR: · ━━━━━━━━━━━━━━┳━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: override without compatible virtual in base class + // CHECK:STDERR: · ┃ [OverrideWithoutVirtualInBase] + // CHECK:STDERR: ╰──── // CHECK:STDERR: override fn F(self, v: i32); } @@ -239,10 +257,18 @@ fn Derived.F(unused self) -> T2 { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_generic_virtual_decl.carbon:[[@LINE+1]]:1-26: error: use of undefined generic function [MissingGenericFunctionDefinition] +// CHECK:STDERR: ╭─┤ fail_generic_virtual_decl.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: -> │ base class Base(T: type) { +// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: use of undefined generic function +// CHECK:STDERR: · ┃ [MissingGenericFunctionDefinition] +// CHECK:STDERR: │ virtual fn F(self); +// CHECK:STDERR: · ─────────┬───────── +// CHECK:STDERR: · ╰──┤ generic function declared here +// CHECK:STDERR: · │ [MissingGenericFunctionDefinitionHere] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: base class Base(T: type) { - // CHECK:STDERR: fail_generic_virtual_decl.carbon:[[@LINE+2]]:3-21: note: generic function declared here [MissingGenericFunctionDefinitionHere] - // CHECK:STDERR: virtual fn F(self); } @@ -268,17 +294,29 @@ class Derived { library "[[@TEST_NAME]]"; abstract class T1 { - // CHECK:STDERR: fail_virtual_without_self.carbon:[[@LINE+2]]:3-17: error: virtual class function [VirtualWithoutSelf] + // CHECK:STDERR: ╭─┤ fail_virtual_without_self.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ virtual fn F(); + // CHECK:STDERR: · ━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: virtual class function [VirtualWithoutSelf] + // CHECK:STDERR: ╰──── // CHECK:STDERR: virtual fn F(); - // CHECK:STDERR: fail_virtual_without_self.carbon:[[@LINE+2]]:3-18: error: virtual class function [VirtualWithoutSelf] + // CHECK:STDERR: ╭─┤ fail_virtual_without_self.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ abstract fn G(); + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: virtual class function [VirtualWithoutSelf] + // CHECK:STDERR: ╰──── // CHECK:STDERR: abstract fn G(); } class T2 { extend base: T1; - // CHECK:STDERR: fail_virtual_without_self.carbon:[[@LINE+2]]:3-18: error: virtual class function [VirtualWithoutSelf] + // CHECK:STDERR: ╭─┤ fail_virtual_without_self.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ override fn F(); + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: virtual class function [VirtualWithoutSelf] + // CHECK:STDERR: ╰──── // CHECK:STDERR: override fn F(); } @@ -293,9 +331,19 @@ base class T1 { class T2 { extend base: T1; - // CHECK:STDERR: fail_ref_self_mismatch.carbon:[[@LINE+4]]:3-27: error: value expression passed to reference parameter [ValueForRefParam] - // CHECK:STDERR: fail_ref_self_mismatch.carbon:[[@LINE+3]]:18-25: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fail_ref_self_mismatch.carbon:[[@LINE-7]]:3-22: note: while building thunk to match the signature of this function [ThunkSignature] + // CHECK:STDERR: ╭─┤ fail_ref_self_mismatch.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: │ virtual fn F1(self); + // CHECK:STDERR: · ──────────┬───────── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ override fn F1(ref self); + // CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━┯━━━━━ + // CHECK:STDERR: · ┗━━━━━━━━━┫ error: value expression passed to reference parameter + // CHECK:STDERR: · │ ┃ [ValueForRefParam] + // CHECK:STDERR: · ╰────┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: override fn F1(ref self); } @@ -305,7 +353,11 @@ class T2 { library "[[@TEST_NAME]]"; base class T1 { - // CHECK:STDERR: fail_generic_virtual.carbon:[[@LINE+2]]:3-30: error: generic virtual function [GenericVirtual] + // CHECK:STDERR: ╭─┤ fail_generic_virtual.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ virtual fn F[T: type](self); + // CHECK:STDERR: · ━━━━━━━━━━━━━━┳━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: generic virtual function [GenericVirtual] + // CHECK:STDERR: ╰──── // CHECK:STDERR: virtual fn F[T: type](self); } @@ -315,7 +367,11 @@ base class T1 { library "[[@TEST_NAME]]"; base class T1(T: type) { - // CHECK:STDERR: fail_generic_virtual_in_generic_class.carbon:[[@LINE+2]]:3-30: error: generic virtual function [GenericVirtual] + // CHECK:STDERR: ╭─┤ fail_generic_virtual_in_generic_class.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ virtual fn F[T: type](self); + // CHECK:STDERR: · ━━━━━━━━━━━━━━┳━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: generic virtual function [GenericVirtual] + // CHECK:STDERR: ╰──── // CHECK:STDERR: virtual fn F[T: type](self); } @@ -408,10 +464,24 @@ base class Base(T: type) { class D1 { extend base: Base(T1); - // CHECK:STDERR: fail_impl_generic_specifically_mismatch.carbon:[[@LINE+5]]:3-45: error: cannot implicitly convert expression of type `T1*` to `T2*` [ConversionFailure] - // CHECK:STDERR: fail_impl_generic_specifically_mismatch.carbon:[[@LINE+4]]:3-45: note: type `T1*` does not implement interface `Core.ImplicitAs(T2*)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: fail_impl_generic_specifically_mismatch.carbon:[[@LINE+3]]:37-42: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fail_impl_generic_specifically_mismatch.carbon:[[@LINE-8]]:3-44: note: while building thunk to match the signature of this function [ThunkSignature] + // CHECK:STDERR: ╭─┤ fail_impl_generic_specifically_mismatch.carbon:[[@LINE+19]]:3 + // CHECK:STDERR: │ virtual fn F(unused self, unused t: T1*) { } + // CHECK:STDERR: · ─────────────┬──────────────────────────── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ override fn F(unused self, unused t: T2*) { } + // CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┯━━━━━━━━ + // CHECK:STDERR: · ┗━━━━━━━━━━━━━━━┫ error: cannot implicitly convert + // CHECK:STDERR: · │ │ ┃ expression of type `T1*` to + // CHECK:STDERR: · │ │ ┃ `T2*` + // CHECK:STDERR: · │ │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰─────────────────┤ type `T1*` does not implement + // CHECK:STDERR: · │ │ interface `Core.ImplicitAs(T2*)` + // CHECK:STDERR: · │ │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: · ╰──────┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: override fn F(unused self, unused t: T2*) { } } @@ -425,10 +495,23 @@ abstract class Base(T: type) { } class Derived(T: type) { extend base: Base(T); - // CHECK:STDERR: fail_impl_generic_generic_mismatch.carbon:[[@LINE+5]]:3-43: error: cannot implicitly convert expression of type `T*` to `T` [ConversionFailure] - // CHECK:STDERR: fail_impl_generic_generic_mismatch.carbon:[[@LINE+4]]:3-43: note: type `T*` does not implement interface `Core.ImplicitAs(T)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: fail_impl_generic_generic_mismatch.carbon:[[@LINE+3]]:37-40: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fail_impl_generic_generic_mismatch.carbon:[[@LINE-7]]:3-43: note: while building thunk to match the signature of this function [ThunkSignature] + // CHECK:STDERR: ╭─┤ fail_impl_generic_generic_mismatch.carbon:[[@LINE+18]]:3 + // CHECK:STDERR: │ virtual fn F(unused self, unused t: T*) { } + // CHECK:STDERR: · ─────────────┬─────────────────────────── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ override fn F(unused self, unused t: T) { } + // CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┯━━━━━━ + // CHECK:STDERR: · ┗━━━━━━━━━━━━━━━━┫ error: cannot implicitly convert + // CHECK:STDERR: · │ │ ┃ expression of type `T*` to `T` + // CHECK:STDERR: · │ │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰──────────────────┤ type `T*` does not implement + // CHECK:STDERR: · │ │ interface `Core.ImplicitAs(T)` + // CHECK:STDERR: · │ │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: · ╰──────┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: override fn F(unused self, unused t: T) { } } diff --git a/toolchain/check/testdata/class/name_poisoning.carbon b/toolchain/check/testdata/class/name_poisoning.carbon index 8d77d082e6ba..f9aa09f0db52 100644 --- a/toolchain/check/testdata/class/name_poisoning.carbon +++ b/toolchain/check/testdata/class/name_poisoning.carbon @@ -44,12 +44,19 @@ class C; namespace N; // Use `package.C` and poison `N.C`. -// CHECK:STDERR: fail_declare_after_poison.carbon:[[@LINE+1]]:11: error: name `C` used before it was declared [NameUseBeforeDecl] +// CHECK:STDERR: ╭─┤ fail_declare_after_poison.carbon:[[@LINE+10]]:11 +// CHECK:STDERR: -> │ fn N.F(x: C); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: name `C` used before it was declared [NameUseBeforeDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: │ class N.C; +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ declared here [NameUseBeforeDeclNote] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: fn N.F(x: C); // Failure: `N.C` declared after it was poisoned. -// CHECK:STDERR: fail_declare_after_poison.carbon:[[@LINE+2]]:9: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: class N.C; // --- fail_use_poison.carbon @@ -63,7 +70,12 @@ namespace N; fn N.F1() -> C; // Use `N.C` which was poisoned and not declared. -// CHECK:STDERR: fail_use_poison.carbon:[[@LINE+2]]:14-16: error: member name `C` not found in `N` [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╭─┤ fail_use_poison.carbon:[[@LINE+7]]:14 +// CHECK:STDERR: -> │ fn N.F2() -> N.C; +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┗━━┫ error: member name `C` not found in `N` +// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn N.F2() -> N.C; @@ -75,16 +87,28 @@ class C; namespace N; // Use `package.C` and poison `N.C`. -// CHECK:STDERR: fail_use_declaration_after_poison.carbon:[[@LINE+1]]:12: error: name `C` used before it was declared [NameUseBeforeDecl] +// CHECK:STDERR: ╭─┤ fail_use_declaration_after_poison.carbon:[[@LINE+10]]:12 +// CHECK:STDERR: -> │ fn N.F1(x: C); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: name `C` used before it was declared [NameUseBeforeDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: │ class N.C; +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ declared here [NameUseBeforeDeclNote] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: fn N.F1(x: C); // Failure: N.C declared after it was poisoned. -// CHECK:STDERR: fail_use_declaration_after_poison.carbon:[[@LINE+2]]:9: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: class N.C; // Failure: `N.C` used after declaration failed. -// CHECK:STDERR: fail_use_declaration_after_poison.carbon:[[@LINE+2]]:12-14: error: member name `C` not found in `N` [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╭─┤ fail_use_declaration_after_poison.carbon:[[@LINE+7]]:12 +// CHECK:STDERR: -> │ fn N.F2(x: N.C); +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┗━━┫ error: member name `C` not found in `N` +// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn N.F2(x: N.C); @@ -95,8 +119,12 @@ library "[[@TEST_NAME]]"; class C; namespace N; -// CHECK:STDERR: fail_alias.carbon:[[@LINE+3]]:13: error: name `C` used before it was declared [NameUseBeforeDecl] -// CHECK:STDERR: fail_alias.carbon:[[@LINE+2]]:9: note: declared here [NameUseBeforeDeclNote] +// CHECK:STDERR: ╭─┤ fail_alias.carbon:[[@LINE+7]]:13 +// CHECK:STDERR: -> │ alias N.C = C; +// CHECK:STDERR: · ┬ ┳ +// CHECK:STDERR: · │ ┗━━┫ error: name `C` used before it was declared [NameUseBeforeDecl] +// CHECK:STDERR: · ╰────────┤ declared here [NameUseBeforeDeclNote] +// CHECK:STDERR: ╰──── // CHECK:STDERR: alias N.C = C; @@ -113,21 +141,45 @@ class C2 { // * `C2.C1` // * `C2.C3.C1` // * `C2.C3.C4.C1` - // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+1]]:15-16: error: name `C1` used before it was declared [NameUseBeforeDecl] + // CHECK:STDERR: ╭─┤ fail_poison_multiple_scopes.carbon:[[@LINE+33]]:15 + // CHECK:STDERR: -> │ fn F(x: C1); + // CHECK:STDERR: · ━┳ + // CHECK:STDERR: · ┗━━┫ error: name `C1` used before it was declared + // CHECK:STDERR: · ┃ [NameUseBeforeDecl] + // CHECK:STDERR: │ + // CHECK:STDERR: │ class C1; + // CHECK:STDERR: · ─┬ + // CHECK:STDERR: · ╰──┤ declared here [NameUseBeforeDeclNote] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: + // CHECK:STDERR: ╭─┤ fail_poison_multiple_scopes.carbon:[[@LINE+22]]:15 + // CHECK:STDERR: -> │ fn F(x: C1); + // CHECK:STDERR: · ━┳ + // CHECK:STDERR: · ┗━━┫ error: name `C1` used before it was declared + // CHECK:STDERR: · ┃ [NameUseBeforeDecl] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ class C1; + // CHECK:STDERR: · ─┬ + // CHECK:STDERR: · ╰──┤ declared here [NameUseBeforeDeclNote] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: + // CHECK:STDERR: ╭─┤ fail_poison_multiple_scopes.carbon:[[@LINE+11]]:15 + // CHECK:STDERR: -> │ fn F(x: C1); + // CHECK:STDERR: · ━┳ + // CHECK:STDERR: · ┗━━┫ error: name `C1` used before it was declared + // CHECK:STDERR: · ┃ [NameUseBeforeDecl] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ class C1; + // CHECK:STDERR: · ─┬ + // CHECK:STDERR: · ╰──┤ declared here [NameUseBeforeDeclNote] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: fn F(x: C1); - // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+3]]:13-14: note: declared here [NameUseBeforeDeclNote] - // CHECK:STDERR: - // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE-4]]:15-16: error: name `C1` used before it was declared [NameUseBeforeDecl] class C1; } - // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+3]]:11-12: note: declared here [NameUseBeforeDeclNote] - // CHECK:STDERR: - // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE-9]]:15-16: error: name `C1` used before it was declared [NameUseBeforeDecl] class C1; } - // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+2]]:9-10: note: declared here [NameUseBeforeDeclNote] - // CHECK:STDERR: class C1; } @@ -152,18 +204,36 @@ library "[[@TEST_NAME]]"; namespace N; // `package.C` and `N.C` poisoned when not found. -// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+3]]:11: error: name `C` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_poison_when_lookup_fails.carbon:[[@LINE+26]]:11 +// CHECK:STDERR: -> │ fn N.F(x: C); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: name `C` not found [NameNotFound] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: +// CHECK:STDERR: ╭─┤ fail_poison_when_lookup_fails.carbon:[[@LINE+20]]:11 +// CHECK:STDERR: -> │ fn N.F(x: C); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: name `C` used before it was declared [NameUseBeforeDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: │ class C; +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ declared here [NameUseBeforeDeclNote] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: +// CHECK:STDERR: ╭─┤ fail_poison_when_lookup_fails.carbon:[[@LINE+10]]:11 +// CHECK:STDERR: -> │ fn N.F(x: C); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: name `C` used before it was declared [NameUseBeforeDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: │ class N.C; +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ declared here [NameUseBeforeDeclNote] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+1]]:11: error: name `C` used before it was declared [NameUseBeforeDecl] fn N.F(x: C); // TODO: We should ideally only produce one diagnostic here. -// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+3]]:7: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: -// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE-5]]:11: error: name `C` used before it was declared [NameUseBeforeDecl] class C; -// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+2]]:9: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: class N.C; // --- fail_poison_with_lexical_result.carbon @@ -174,11 +244,19 @@ fn F() { class C1 {} class C2 { - // CHECK:STDERR: fail_poison_with_lexical_result.carbon:[[@LINE+1]]:12-13: error: name `C1` used before it was declared [NameUseBeforeDecl] + // CHECK:STDERR: ╭─┤ fail_poison_with_lexical_result.carbon:[[@LINE+11]]:12 + // CHECK:STDERR: -> │ var v: C1; + // CHECK:STDERR: · ━┳ + // CHECK:STDERR: · ┗━━┫ error: name `C1` used before it was declared + // CHECK:STDERR: · ┃ [NameUseBeforeDecl] + // CHECK:STDERR: │ + // CHECK:STDERR: │ class C1; + // CHECK:STDERR: · ─┬ + // CHECK:STDERR: · ╰──┤ declared here [NameUseBeforeDeclNote] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: var v: C1; - // CHECK:STDERR: fail_poison_with_lexical_result.carbon:[[@LINE+2]]:11-12: note: declared here [NameUseBeforeDeclNote] - // CHECK:STDERR: class C1; } } @@ -191,13 +269,20 @@ class C1; class C2 { // Use `package.C1` and poison `C2.C1`. - // CHECK:STDERR: fail_declare_data_member_after_poison.carbon:[[@LINE+1]]:11-12: error: name `C1` used before it was declared [NameUseBeforeDecl] + // CHECK:STDERR: ╭─┤ fail_declare_data_member_after_poison.carbon:[[@LINE+10]]:11 + // CHECK:STDERR: -> │ fn F(x: C1); + // CHECK:STDERR: · ━┳ + // CHECK:STDERR: · ┗━━┫ error: name `C1` used before it was declared [NameUseBeforeDecl] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ var C1: C2; + // CHECK:STDERR: · ─┬ + // CHECK:STDERR: · ╰──┤ declared here [NameUseBeforeDeclNote] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: fn F(x: C1); class C2 {} // Failure: `C2.C1` declared after it was poisoned. - // CHECK:STDERR: fail_declare_data_member_after_poison.carbon:[[@LINE+2]]:7-8: note: declared here [NameUseBeforeDeclNote] - // CHECK:STDERR: var C1: C2; } @@ -208,11 +293,19 @@ library "[[@TEST_NAME]]"; base class B {} class C { - // CHECK:STDERR: fail_extend_poison_class_members.carbon:[[@LINE+1]]:16: error: name `B` used before it was declared [NameUseBeforeDecl] + // CHECK:STDERR: ╭─┤ fail_extend_poison_class_members.carbon:[[@LINE+11]]:16 + // CHECK:STDERR: -> │ extend base: B; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: name `B` used before it was declared + // CHECK:STDERR: · ┃ [NameUseBeforeDecl] + // CHECK:STDERR: │ + // CHECK:STDERR: │ fn B(); + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ declared here [NameUseBeforeDeclNote] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: extend base: B; - // CHECK:STDERR: fail_extend_poison_class_members.carbon:[[@LINE+2]]:6: note: declared here [NameUseBeforeDeclNote] - // CHECK:STDERR: fn B(); } diff --git a/toolchain/check/testdata/class/no_definition_in_impl_file.carbon b/toolchain/check/testdata/class/no_definition_in_impl_file.carbon index 935f0ec4284f..2162e675d9d5 100644 --- a/toolchain/check/testdata/class/no_definition_in_impl_file.carbon +++ b/toolchain/check/testdata/class/no_definition_in_impl_file.carbon @@ -52,10 +52,23 @@ class C; impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_decl_in_api_decl_in_impl.impl.carbon:[[@LINE+5]]:1-8: error: redeclaration of `class C` is redundant [RedeclRedundant] -// CHECK:STDERR: decl_in_api_decl_in_impl.carbon:4:1-8: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_decl_in_api_decl_in_impl.impl.carbon:[[@LINE+18]]:1 +// CHECK:STDERR: -> │ class C; +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of `class C` is redundant [RedeclRedundant] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ decl_in_api_decl_in_impl.carbon +// CHECK:STDERR: │ class C; +// CHECK:STDERR: · ────┬─── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_decl_in_api_decl_in_impl.impl.carbon:[[@LINE+2]]:1-8: error: no definition found for declaration in impl file [MissingDefinitionInImpl] +// CHECK:STDERR: ╭─┤ fail_decl_in_api_decl_in_impl.impl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ class C; +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: no definition found for declaration in impl file +// CHECK:STDERR: · ┃ [MissingDefinitionInImpl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: class C; @@ -69,8 +82,16 @@ class D; impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_decl_in_api_decl_and_definition_in_impl.impl.carbon:[[@LINE+3]]:1-8: error: redeclaration of `class D` is redundant [RedeclRedundant] -// CHECK:STDERR: decl_in_api_decl_and_definition_in_impl.carbon:4:1-8: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_decl_in_api_decl_and_definition_in_impl.impl.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: -> │ class D; +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of `class D` is redundant [RedeclRedundant] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ decl_in_api_decl_and_definition_in_impl.carbon +// CHECK:STDERR: │ class D; +// CHECK:STDERR: · ────┬─── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: class D; @@ -84,6 +105,11 @@ library "[[@TEST_NAME]]"; impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_decl_only_in_impl.impl.carbon:[[@LINE+2]]:1-8: error: no definition found for declaration in impl file [MissingDefinitionInImpl] +// CHECK:STDERR: ╭─┤ fail_decl_only_in_impl.impl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ class E; +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: no definition found for declaration in impl file +// CHECK:STDERR: · ┃ [MissingDefinitionInImpl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: class E; diff --git a/toolchain/check/testdata/class/partial/access.carbon b/toolchain/check/testdata/class/partial/access.carbon index cfbf559ffc63..eebc35251340 100644 --- a/toolchain/check/testdata/class/partial/access.carbon +++ b/toolchain/check/testdata/class/partial/access.carbon @@ -36,8 +36,16 @@ library "[[@TEST_NAME]]"; import Common; fn F(ref pb: partial Common.B) { - // CHECK:STDERR: fail_invalid_partial_member_access.carbon:[[@LINE+3]]:27-33: error: cannot implicitly convert expression of type `partial Common.A` to `Common.A` [ConversionFailure] - // CHECK:STDERR: fail_invalid_partial_member_access.carbon:[[@LINE+2]]:27-33: note: type `partial Common.A` does not implement interface `Core.ImplicitAs(Common.A)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_invalid_partial_member_access.carbon:[[@LINE+11]]:27 + // CHECK:STDERR: -> │ let ref _: Common.A = pb.base; + // CHECK:STDERR: · ┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of + // CHECK:STDERR: · │ ┃ type `partial Common.A` to `Common.A` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `partial Common.A` does not implement + // CHECK:STDERR: · │ interface `Core.ImplicitAs(Common.A)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let ref _: Common.A = pb.base; } diff --git a/toolchain/check/testdata/class/partial/qualifier.carbon b/toolchain/check/testdata/class/partial/qualifier.carbon index effc4220a566..1ba683eef4fa 100644 --- a/toolchain/check/testdata/class/partial/qualifier.carbon +++ b/toolchain/check/testdata/class/partial/qualifier.carbon @@ -43,7 +43,11 @@ library "[[@TEST_NAME]]"; class C { } //@dump-sem-ir-begin -// CHECK:STDERR: fail_partial_nondynamic.carbon:[[@LINE+2]]:9-17: error: `partial` applied to final type `C` [PartialOnFinal] +// CHECK:STDERR: ╭─┤ fail_partial_nondynamic.carbon:[[@LINE+6]]:9 +// CHECK:STDERR: -> │ fn G(p: partial C); +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: `partial` applied to final type `C` [PartialOnFinal] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn G(p: partial C); //@dump-sem-ir-end @@ -57,7 +61,12 @@ class Derived { } //@dump-sem-ir-begin -// CHECK:STDERR: fail_partial_final.carbon:[[@LINE+2]]:9-23: error: `partial` applied to final type `Derived` [PartialOnFinal] +// CHECK:STDERR: ╭─┤ fail_partial_final.carbon:[[@LINE+7]]:9 +// CHECK:STDERR: -> │ fn G(p: partial Derived); +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `partial` applied to final type `Derived` +// CHECK:STDERR: · ┃ [PartialOnFinal] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn G(p: partial Derived); //@dump-sem-ir-end @@ -71,7 +80,11 @@ class C; // but since we only have a declaration, we don't know. //@dump-sem-ir-begin // applied to final type `C` [PartialOnFinal] CHECK:STDERR: fn G(p: partial C); -// CHECK:STDERR: fail_partial_decl.carbon:[[@LINE+2]]:9-17: error: `partial` applied to final type `C` [PartialOnFinal] +// CHECK:STDERR: ╭─┤ fail_partial_decl.carbon:[[@LINE+6]]:9 +// CHECK:STDERR: -> │ fn G(p: partial C); +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: `partial` applied to final type `C` [PartialOnFinal] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn G(p: partial C); //@dump-sem-ir-end @@ -82,7 +95,12 @@ library "[[@TEST_NAME]]"; class C; //@dump-sem-ir-begin -// CHECK:STDERR: fail_partial_tuple.carbon:[[@LINE+2]]:9-22: error: `partial` applied to final type `(C, C)` [PartialOnFinal] +// CHECK:STDERR: ╭─┤ fail_partial_tuple.carbon:[[@LINE+7]]:9 +// CHECK:STDERR: -> │ fn G(p: partial (C, C)); +// CHECK:STDERR: · ━━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `partial` applied to final type `(C, C)` +// CHECK:STDERR: · ┃ [PartialOnFinal] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn G(p: partial (C, C)); //@dump-sem-ir-end @@ -93,7 +111,12 @@ library "[[@TEST_NAME]]"; class C; //@dump-sem-ir-begin -// CHECK:STDERR: fail_partial_struct.carbon:[[@LINE+2]]:9-23: error: `partial` applied to final type `{.x: C}` [PartialOnFinal] +// CHECK:STDERR: ╭─┤ fail_partial_struct.carbon:[[@LINE+7]]:9 +// CHECK:STDERR: -> │ fn G(p: partial {.x: C}); +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `partial` applied to final type `{.x: C}` +// CHECK:STDERR: · ┃ [PartialOnFinal] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn G(p: partial {.x: C}); //@dump-sem-ir-end @@ -104,7 +127,12 @@ library "[[@TEST_NAME]]"; base class C { } //@dump-sem-ir-begin -// CHECK:STDERR: fail_duplicate.carbon:[[@LINE+2]]:9-27: error: `partial` applied to final type `partial C` [PartialOnFinal] +// CHECK:STDERR: ╭─┤ fail_duplicate.carbon:[[@LINE+7]]:9 +// CHECK:STDERR: -> │ fn F(p: partial (partial C)); +// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `partial` applied to final type `partial C` +// CHECK:STDERR: · ┃ [PartialOnFinal] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(p: partial (partial C)); //@dump-sem-ir-end @@ -115,8 +143,14 @@ library "[[@TEST_NAME]]"; base class C { } fn G(p: partial C*) -> C* { - // CHECK:STDERR: fail_convert_to_nonpartial.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `partial C*` to `C*` [ConversionFailure] - // CHECK:STDERR: fail_convert_to_nonpartial.carbon:[[@LINE+2]]:3-11: note: type `partial C*` does not implement interface `Core.ImplicitAs(C*)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_convert_to_nonpartial.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ return p; + // CHECK:STDERR: · ━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `partial C*` to `C*` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `partial C*` does not implement interface `Core.ImplicitAs(C*)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return p; } @@ -127,7 +161,13 @@ library "[[@TEST_NAME]]"; base class C { } class Derived { - // CHECK:STDERR: fail_derive_from_partial.carbon:[[@LINE+2]]:16-24: error: deriving from final type `partial C`; base type must be an `abstract` or `base` class [BaseIsFinal] + // CHECK:STDERR: ╭─┤ fail_derive_from_partial.carbon:[[@LINE+8]]:16 + // CHECK:STDERR: -> │ extend base: partial C; + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: deriving from final type `partial C`; base type must + // CHECK:STDERR: · ┃ be an `abstract` or `base` class + // CHECK:STDERR: · ┃ [BaseIsFinal] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend base: partial C; } @@ -138,7 +178,12 @@ library "[[@TEST_NAME]]"; // TODO: This should be accepted because `T` might be final once we know what it // is. -// CHECK:STDERR: fail_todo_partial_template_dependent.carbon:[[@LINE+2]]:27-35: error: `partial` applied to final type `T` [PartialOnFinal] +// CHECK:STDERR: ╭─┤ fail_todo_partial_template_dependent.carbon:[[@LINE+7]]:27 +// CHECK:STDERR: -> │ fn G[template T: type](p: partial T*); +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: `partial` applied to final type `T` +// CHECK:STDERR: · ┃ [PartialOnFinal] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn G[template T: type](p: partial T*); @@ -149,7 +194,12 @@ library "[[@TEST_NAME]]"; // generic type and its requirements, as distinct from the concrete type that // might be used here in any specific. -// CHECK:STDERR: fail_partial_generic.carbon:[[@LINE+2]]:18-26: error: `partial` applied to final type `T` [PartialOnFinal] +// CHECK:STDERR: ╭─┤ fail_partial_generic.carbon:[[@LINE+7]]:18 +// CHECK:STDERR: -> │ fn F[T: type](p: partial T*); +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: `partial` applied to final type `T` +// CHECK:STDERR: · ┃ [PartialOnFinal] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F[T: type](p: partial T*); @@ -259,9 +309,9 @@ fn F[T: type](p: partial T*); // CHECK:STDOUT: %p.patt: %pattern_type = wrapper_binding_pattern p, %p.param_patt [concrete = constants.%p.patt] // CHECK:STDOUT: } { // CHECK:STDOUT: %p.param: %.331 = value_param call_param0 -// CHECK:STDOUT: %.loc8_9.1: type = splice_block %.loc8_9.2 [concrete = constants.%.331] { +// CHECK:STDOUT: %.loc12_9.1: type = splice_block %.loc12_9.2 [concrete = constants.%.331] { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %.loc8_9.2: type = partial_type %C.ref [concrete = constants.%.331] +// CHECK:STDOUT: %.loc12_9.2: type = partial_type %C.ref [concrete = constants.%.331] // CHECK:STDOUT: } // CHECK:STDOUT: %p: %.331 = wrapper_binding p, %p.param // CHECK:STDOUT: } @@ -288,9 +338,9 @@ fn F[T: type](p: partial T*); // CHECK:STDOUT: %p.patt: %pattern_type = wrapper_binding_pattern p, %p.param_patt [concrete = constants.%p.patt] // CHECK:STDOUT: } { // CHECK:STDOUT: %p.param: %.546 = value_param call_param0 -// CHECK:STDOUT: %.loc11_9.1: type = splice_block %.loc11_9.2 [concrete = constants.%.546] { +// CHECK:STDOUT: %.loc16_9.1: type = splice_block %.loc16_9.2 [concrete = constants.%.546] { // CHECK:STDOUT: %Derived.ref: type = name_ref Derived, file.%Derived.decl [concrete = constants.%Derived] -// CHECK:STDOUT: %.loc11_9.2: type = partial_type %Derived.ref [concrete = constants.%.546] +// CHECK:STDOUT: %.loc16_9.2: type = partial_type %Derived.ref [concrete = constants.%.546] // CHECK:STDOUT: } // CHECK:STDOUT: %p: %.546 = wrapper_binding p, %p.param // CHECK:STDOUT: } @@ -317,9 +367,9 @@ fn F[T: type](p: partial T*); // CHECK:STDOUT: %p.patt: %pattern_type = wrapper_binding_pattern p, %p.param_patt [concrete = constants.%p.patt] // CHECK:STDOUT: } { // CHECK:STDOUT: %p.param: %.331 = value_param call_param0 -// CHECK:STDOUT: %.loc11_9.1: type = splice_block %.loc11_9.2 [concrete = constants.%.331] { +// CHECK:STDOUT: %.loc15_9.1: type = splice_block %.loc15_9.2 [concrete = constants.%.331] { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %.loc11_9.2: type = partial_type %C.ref [concrete = constants.%.331] +// CHECK:STDOUT: %.loc15_9.2: type = partial_type %C.ref [concrete = constants.%.331] // CHECK:STDOUT: } // CHECK:STDOUT: %p: %.331 = wrapper_binding p, %p.param // CHECK:STDOUT: } @@ -349,12 +399,12 @@ fn F[T: type](p: partial T*); // CHECK:STDOUT: %p.patt: %pattern_type = wrapper_binding_pattern p, %p.param_patt [concrete = constants.%p.patt] // CHECK:STDOUT: } { // CHECK:STDOUT: %p.param: %.8dc = value_param call_param0 -// CHECK:STDOUT: %.loc8_9.1: type = splice_block %.loc8_9.3 [concrete = constants.%.8dc] { -// CHECK:STDOUT: %C.ref.loc8_18: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %C.ref.loc8_21: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %.loc8_22: %tuple.type.693 = tuple_literal (%C.ref.loc8_18, %C.ref.loc8_21) [concrete = constants.%tuple] -// CHECK:STDOUT: %.loc8_9.2: type = converted %.loc8_22, constants.%tuple.type.748 [concrete = constants.%tuple.type.748] -// CHECK:STDOUT: %.loc8_9.3: type = partial_type %.loc8_9.2 [concrete = constants.%.8dc] +// CHECK:STDOUT: %.loc13_9.1: type = splice_block %.loc13_9.3 [concrete = constants.%.8dc] { +// CHECK:STDOUT: %C.ref.loc13_18: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %C.ref.loc13_21: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %.loc13_22: %tuple.type.693 = tuple_literal (%C.ref.loc13_18, %C.ref.loc13_21) [concrete = constants.%tuple] +// CHECK:STDOUT: %.loc13_9.2: type = converted %.loc13_22, constants.%tuple.type.748 [concrete = constants.%tuple.type.748] +// CHECK:STDOUT: %.loc13_9.3: type = partial_type %.loc13_9.2 [concrete = constants.%.8dc] // CHECK:STDOUT: } // CHECK:STDOUT: %p: %.8dc = wrapper_binding p, %p.param // CHECK:STDOUT: } @@ -382,10 +432,10 @@ fn F[T: type](p: partial T*); // CHECK:STDOUT: %p.patt: %pattern_type = wrapper_binding_pattern p, %p.param_patt [concrete = constants.%p.patt] // CHECK:STDOUT: } { // CHECK:STDOUT: %p.param: %.91f = value_param call_param0 -// CHECK:STDOUT: %.loc8_9.1: type = splice_block %.loc8_9.2 [concrete = constants.%.91f] { +// CHECK:STDOUT: %.loc13_9.1: type = splice_block %.loc13_9.2 [concrete = constants.%.91f] { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %struct_type.x: type = struct_type {.x: %C} [concrete = constants.%struct_type.x] -// CHECK:STDOUT: %.loc8_9.2: type = partial_type %struct_type.x [concrete = constants.%.91f] +// CHECK:STDOUT: %.loc13_9.2: type = partial_type %struct_type.x [concrete = constants.%.91f] // CHECK:STDOUT: } // CHECK:STDOUT: %p: %.91f = wrapper_binding p, %p.param // CHECK:STDOUT: } @@ -413,10 +463,10 @@ fn F[T: type](p: partial T*); // CHECK:STDOUT: %p.patt: %pattern_type = wrapper_binding_pattern p, %p.param_patt [concrete = constants.%p.patt] // CHECK:STDOUT: } { // CHECK:STDOUT: %p.param: %.d52 = value_param call_param0 -// CHECK:STDOUT: %.loc8_9.1: type = splice_block %.loc8_9.2 [concrete = constants.%.d52] { +// CHECK:STDOUT: %.loc13_9.1: type = splice_block %.loc13_9.2 [concrete = constants.%.d52] { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %.loc8_18: type = partial_type %C.ref [concrete = constants.%.331] -// CHECK:STDOUT: %.loc8_9.2: type = partial_type %.loc8_18 [concrete = constants.%.d52] +// CHECK:STDOUT: %.loc13_18: type = partial_type %C.ref [concrete = constants.%.331] +// CHECK:STDOUT: %.loc13_9.2: type = partial_type %.loc13_18 [concrete = constants.%.d52] // CHECK:STDOUT: } // CHECK:STDOUT: %p: %.d52 = wrapper_binding p, %p.param // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/self/fail_ref_self.carbon b/toolchain/check/testdata/class/self/fail_ref_self.carbon index aff49d71b87f..e61f5269b681 100644 --- a/toolchain/check/testdata/class/self/fail_ref_self.carbon +++ b/toolchain/check/testdata/class/self/fail_ref_self.carbon @@ -19,8 +19,15 @@ class Class { fn Make() -> Class; fn F(c: Class, p: Class*) { - // CHECK:STDERR: fail_ref_self.carbon:[[@LINE+3]]:3: error: value expression passed to reference parameter [ValueForRefParam] - // CHECK:STDERR: fail_ref_self.carbon:[[@LINE-7]]:8-15: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_ref_self.carbon:[[@LINE+10]]:3 + // CHECK:STDERR: │ fn F(ref self); + // CHECK:STDERR: · ────┬─── + // CHECK:STDERR: · ╰──┤ initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ c.F(); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: value expression passed to reference parameter [ValueForRefParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: c.F(); @@ -64,7 +71,7 @@ fn F(c: Class, p: Class*) { // CHECK:STDOUT: %T.09f: %SubobjectDestroy.type = symbolic_binding T, 0 [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.type.dea: type = fn_type @T.as_type.as.DestroyImpl.impl.Op, @T.as_type.as.DestroyImpl.impl(%T.09f) [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.6e5: %T.as_type.as.DestroyImpl.impl.Op.type.dea = struct_value () [symbolic] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.2: type = fn_type @SubobjectDestroy.WithSelf.Op.loc31_8.2 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.2: type = fn_type @SubobjectDestroy.WithSelf.Op.loc38_8.2 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.2: %SubobjectDestroy.WithSelf.Op.type.6870fd.2 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80ef6.2: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.2), @SubobjectDestroy [concrete] // CHECK:STDOUT: %SubobjectDestroy.facet.3a1: %SubobjectDestroy.type = facet_value %Class, (%custom_witness.b80ef6.2) [concrete] @@ -144,31 +151,31 @@ fn F(c: Class, p: Class*) { // CHECK:STDOUT: fn @F(%c.param: %Class, %p.param: %ptr.7ee) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %c.ref: %Class = name_ref c, %c -// CHECK:STDOUT: %F.ref.loc25: %Class.F.type = name_ref F, @Class.%Class.F.decl [concrete = constants.%Class.F] -// CHECK:STDOUT: %Class.F.bound.loc25: = bound_method %c.ref, %F.ref.loc25 -// CHECK:STDOUT: %Class.F.call.loc25: init %empty_tuple.type = call %Class.F.bound.loc25() +// CHECK:STDOUT: %F.ref.loc32: %Class.F.type = name_ref F, @Class.%Class.F.decl [concrete = constants.%Class.F] +// CHECK:STDOUT: %Class.F.bound.loc32: = bound_method %c.ref, %F.ref.loc32 +// CHECK:STDOUT: %Class.F.call.loc32: init %empty_tuple.type = call %Class.F.bound.loc32() // CHECK:STDOUT: %p.ref: %ptr.7ee = name_ref p, %p -// CHECK:STDOUT: %.loc28: ref %Class = deref %p.ref -// CHECK:STDOUT: %F.ref.loc28: %Class.F.type = name_ref F, @Class.%Class.F.decl [concrete = constants.%Class.F] -// CHECK:STDOUT: %Class.F.bound.loc28: = bound_method %.loc28, %F.ref.loc28 -// CHECK:STDOUT: %Class.F.call.loc28: init %empty_tuple.type = call %Class.F.bound.loc28(%.loc28) +// CHECK:STDOUT: %.loc35: ref %Class = deref %p.ref +// CHECK:STDOUT: %F.ref.loc35: %Class.F.type = name_ref F, @Class.%Class.F.decl [concrete = constants.%Class.F] +// CHECK:STDOUT: %Class.F.bound.loc35: = bound_method %.loc35, %F.ref.loc35 +// CHECK:STDOUT: %Class.F.call.loc35: init %empty_tuple.type = call %Class.F.bound.loc35(%.loc35) // CHECK:STDOUT: %Make.ref: %Make.type = name_ref Make, file.%Make.decl [concrete = constants.%Make] -// CHECK:STDOUT: %.loc31_8.1: ref %Class = temporary_storage -// CHECK:STDOUT: %Make.call: init %Class to %.loc31_8.1 = call %Make.ref() -// CHECK:STDOUT: %.loc31_8.2: ref %Class = temporary %.loc31_8.1, %Make.call -// CHECK:STDOUT: %F.ref.loc31: %Class.F.type = name_ref F, @Class.%Class.F.decl [concrete = constants.%Class.F] -// CHECK:STDOUT: %Class.F.bound.loc31: = bound_method %.loc31_8.2, %F.ref.loc31 -// CHECK:STDOUT: %Class.F.call.loc31: init %empty_tuple.type = call %Class.F.bound.loc31(%.loc31_8.2) -// CHECK:STDOUT: %Destroy.facet.loc31_8.1: %Destroy.type = facet_value constants.%Class, (constants.%DestroyImpl.impl_witness.66c, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc31_8.3: %Destroy.type = converted constants.%Class, %Destroy.facet.loc31_8.1 [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %Destroy.facet.loc31_8.2: %Destroy.type = facet_value constants.%Class, (constants.%DestroyImpl.impl_witness.66c, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc31_8.4: %Destroy.type = converted constants.%Class, %Destroy.facet.loc31_8.2 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc38_8.1: ref %Class = temporary_storage +// CHECK:STDOUT: %Make.call: init %Class to %.loc38_8.1 = call %Make.ref() +// CHECK:STDOUT: %.loc38_8.2: ref %Class = temporary %.loc38_8.1, %Make.call +// CHECK:STDOUT: %F.ref.loc38: %Class.F.type = name_ref F, @Class.%Class.F.decl [concrete = constants.%Class.F] +// CHECK:STDOUT: %Class.F.bound.loc38: = bound_method %.loc38_8.2, %F.ref.loc38 +// CHECK:STDOUT: %Class.F.call.loc38: init %empty_tuple.type = call %Class.F.bound.loc38(%.loc38_8.2) +// CHECK:STDOUT: %Destroy.facet.loc38_8.1: %Destroy.type = facet_value constants.%Class, (constants.%DestroyImpl.impl_witness.66c, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc38_8.3: %Destroy.type = converted constants.%Class, %Destroy.facet.loc38_8.1 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %Destroy.facet.loc38_8.2: %Destroy.type = facet_value constants.%Class, (constants.%DestroyImpl.impl_witness.66c, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc38_8.4: %Destroy.type = converted constants.%Class, %Destroy.facet.loc38_8.2 [concrete = constants.%Destroy.facet] // CHECK:STDOUT: %SelfDestruct.specific_fn: = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet) [concrete = constants.%SelfDestruct.specific_fn] -// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc31_8.2) +// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc38_8.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc31_8.1(%self.param: ref %empty_struct_type) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc38_8.1(%self.param: ref %empty_struct_type) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc31_8.2(%self.param: ref %Class) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc38_8.2(%self.param: ref %Class) = "no_op"; // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/self/fail_self.carbon b/toolchain/check/testdata/class/self/fail_self.carbon index 2b9565cebe95..27553d934f1c 100644 --- a/toolchain/check/testdata/class/self/fail_self.carbon +++ b/toolchain/check/testdata/class/self/fail_self.carbon @@ -16,19 +16,44 @@ library "[[@TEST_NAME]]"; // `self` is not permitted in the implicit parameter list, regardless of how // its type is spelled (explicit `Self`, an arbitrary type, or omitted). class Class { - // CHECK:STDERR: fail_self_implicit_list.carbon:[[@LINE+2]]:8-17: error: `self` must be declared in the explicit parameter list [SelfInImplicitParamList] + // CHECK:STDERR: ╭─┤ fail_self_implicit_list.carbon:[[@LINE+7]]:8 + // CHECK:STDERR: -> │ fn F[self: Self](); + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: `self` must be declared in the explicit parameter list + // CHECK:STDERR: · ┃ [SelfInImplicitParamList] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn F[self: Self](); - // CHECK:STDERR: fail_self_implicit_list.carbon:[[@LINE+2]]:8-18: error: `self` must be declared in the explicit parameter list [SelfInImplicitParamList] + // CHECK:STDERR: ╭─┤ fail_self_implicit_list.carbon:[[@LINE+7]]:8 + // CHECK:STDERR: -> │ fn G[self: Class](); + // CHECK:STDERR: · ━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: `self` must be declared in the explicit parameter list + // CHECK:STDERR: · ┃ [SelfInImplicitParamList] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn G[self: Class](); - // CHECK:STDERR: fail_self_implicit_list.carbon:[[@LINE+2]]:8-11: error: `self` must be declared in the explicit parameter list [SelfInImplicitParamList] + // CHECK:STDERR: ╭─┤ fail_self_implicit_list.carbon:[[@LINE+7]]:8 + // CHECK:STDERR: -> │ fn H[self](); + // CHECK:STDERR: · ━━┳━ + // CHECK:STDERR: · ┗━━┫ error: `self` must be declared in the explicit parameter list + // CHECK:STDERR: · ┃ [SelfInImplicitParamList] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn H[self](); - // CHECK:STDERR: fail_self_implicit_list.carbon:[[@LINE+2]]:8-21: error: `self` must be declared in the explicit parameter list [SelfInImplicitParamList] + // CHECK:STDERR: ╭─┤ fail_self_implicit_list.carbon:[[@LINE+7]]:8 + // CHECK:STDERR: -> │ fn I[ref self: Self](); + // CHECK:STDERR: · ━━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: `self` must be declared in the explicit parameter list + // CHECK:STDERR: · ┃ [SelfInImplicitParamList] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn I[ref self: Self](); - // CHECK:STDERR: fail_self_implicit_list.carbon:[[@LINE+2]]:8-15: error: `self` must be declared in the explicit parameter list [SelfInImplicitParamList] + // CHECK:STDERR: ╭─┤ fail_self_implicit_list.carbon:[[@LINE+7]]:8 + // CHECK:STDERR: -> │ fn J[ref self](); + // CHECK:STDERR: · ━━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: `self` must be declared in the explicit parameter list + // CHECK:STDERR: · ┃ [SelfInImplicitParamList] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn J[ref self](); } @@ -37,12 +62,20 @@ class Class { library "[[@TEST_NAME]]"; // `self` outside any class scope has no `Self` to default to. -// CHECK:STDERR: fail_self_outside_class.carbon:[[@LINE+2]]:6-9: error: name `Self` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_self_outside_class.carbon:[[@LINE+6]]:6 +// CHECK:STDERR: -> │ fn F(self); +// CHECK:STDERR: · ━━┳━ +// CHECK:STDERR: · ┗━━┫ error: name `Self` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(self); // `ref self` is similarly invalid at file scope. -// CHECK:STDERR: fail_self_outside_class.carbon:[[@LINE+2]]:6-13: error: name `Self` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_self_outside_class.carbon:[[@LINE+6]]:6 +// CHECK:STDERR: -> │ fn G(ref self); +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: name `Self` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn G(ref self); @@ -51,63 +84,156 @@ library "[[@TEST_NAME]]"; class Class { // Repeating `self` within a single parameter list is rejected. - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+3]]:14-17: error: duplicate name `self` being declared in the same scope [NameDeclDuplicate] - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+2]]:8-11: note: name is previously declared here [NameDeclPrevious] + // CHECK:STDERR: ╭─┤ fail_self_repeated.carbon:[[@LINE+8]]:14 + // CHECK:STDERR: -> │ fn F(self, self); + // CHECK:STDERR: · ──┬─ ━┳━━ + // CHECK:STDERR: · │ ┗━━┫ error: duplicate name `self` being declared in the same scope + // CHECK:STDERR: · │ ┃ [NameDeclDuplicate] + // CHECK:STDERR: · ╰─────────┤ name is previously declared here [NameDeclPrevious] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(self, self); - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+3]]:20-23: error: duplicate name `self` being declared in the same scope [NameDeclDuplicate] - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+2]]:8-17: note: name is previously declared here [NameDeclPrevious] + // CHECK:STDERR: ╭─┤ fail_self_repeated.carbon:[[@LINE+9]]:20 + // CHECK:STDERR: -> │ fn G(self: Self, self); + // CHECK:STDERR: · ─────┬──── ┳━━━ + // CHECK:STDERR: · │ ┗━━┫ error: duplicate name `self` being declared in the same + // CHECK:STDERR: · │ ┃ scope + // CHECK:STDERR: · │ ┃ [NameDeclDuplicate] + // CHECK:STDERR: · ╰───────────┤ name is previously declared here [NameDeclPrevious] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn G(self: Self, self); - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+3]]:14-17: error: duplicate name `self` being declared in the same scope [NameDeclDuplicate] - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+2]]:8-11: note: name is previously declared here [NameDeclPrevious] + // CHECK:STDERR: ╭─┤ fail_self_repeated.carbon:[[@LINE+8]]:14 + // CHECK:STDERR: -> │ fn H(self, self: Self); + // CHECK:STDERR: · ──┬─ ━┳━━ + // CHECK:STDERR: · │ ┗━━┫ error: duplicate name `self` being declared in the same scope + // CHECK:STDERR: · │ ┃ [NameDeclDuplicate] + // CHECK:STDERR: · ╰─────────┤ name is previously declared here [NameDeclPrevious] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn H(self, self: Self); - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+3]]:18-21: error: duplicate name `self` being declared in the same scope [NameDeclDuplicate] - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+2]]:8-15: note: name is previously declared here [NameDeclPrevious] + // CHECK:STDERR: ╭─┤ fail_self_repeated.carbon:[[@LINE+9]]:18 + // CHECK:STDERR: -> │ fn I(ref self, self); + // CHECK:STDERR: · ────┬─── ┳━━━ + // CHECK:STDERR: · │ ┗━━┫ error: duplicate name `self` being declared in the same + // CHECK:STDERR: · │ ┃ scope + // CHECK:STDERR: · │ ┃ [NameDeclDuplicate] + // CHECK:STDERR: · ╰──────────┤ name is previously declared here [NameDeclPrevious] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn I(ref self, self); - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+3]]:24-27: error: duplicate name `self` being declared in the same scope [NameDeclDuplicate] - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+2]]:8-21: note: name is previously declared here [NameDeclPrevious] + // CHECK:STDERR: ╭─┤ fail_self_repeated.carbon:[[@LINE+10]]:24 + // CHECK:STDERR: -> │ fn J(ref self: Self, self: Self); + // CHECK:STDERR: · ───────┬────── ┳━━━ + // CHECK:STDERR: · │ ┗━━┫ error: duplicate name `self` being declared in the + // CHECK:STDERR: · │ ┃ same scope + // CHECK:STDERR: · │ ┃ [NameDeclDuplicate] + // CHECK:STDERR: · ╰─────────────┤ name is previously declared here + // CHECK:STDERR: · │ [NameDeclPrevious] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn J(ref self: Self, self: Self); // `self` in both lists, even just once each, is rejected: the implicit // occurrence is wrong, and the explicit one becomes a duplicate. - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+5]]:8-11: error: `self` must be declared in the explicit parameter list [SelfInImplicitParamList] + // CHECK:STDERR: ╭─┤ fail_self_repeated.carbon:[[@LINE+15]]:8 + // CHECK:STDERR: -> │ fn K[self](self); + // CHECK:STDERR: · ━━┳━ + // CHECK:STDERR: · ┗━━┫ error: `self` must be declared in the explicit parameter list + // CHECK:STDERR: · ┃ [SelfInImplicitParamList] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+3]]:14-17: error: duplicate name `self` being declared in the same scope [NameDeclDuplicate] - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+2]]:8-11: note: name is previously declared here [NameDeclPrevious] + // CHECK:STDERR: ╭─┤ fail_self_repeated.carbon:[[@LINE+8]]:14 + // CHECK:STDERR: -> │ fn K[self](self); + // CHECK:STDERR: · ──┬─ ━┳━━ + // CHECK:STDERR: · │ ┗━━┫ error: duplicate name `self` being declared in the same scope + // CHECK:STDERR: · │ ┃ [NameDeclDuplicate] + // CHECK:STDERR: · ╰─────────┤ name is previously declared here [NameDeclPrevious] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn K[self](self); - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+5]]:8-17: error: `self` must be declared in the explicit parameter list [SelfInImplicitParamList] + // CHECK:STDERR: ╭─┤ fail_self_repeated.carbon:[[@LINE+16]]:8 + // CHECK:STDERR: -> │ fn L[self: Self](self); + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: `self` must be declared in the explicit parameter list + // CHECK:STDERR: · ┃ [SelfInImplicitParamList] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+3]]:20-23: error: duplicate name `self` being declared in the same scope [NameDeclDuplicate] - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+2]]:8-17: note: name is previously declared here [NameDeclPrevious] + // CHECK:STDERR: ╭─┤ fail_self_repeated.carbon:[[@LINE+9]]:20 + // CHECK:STDERR: -> │ fn L[self: Self](self); + // CHECK:STDERR: · ─────┬──── ┳━━━ + // CHECK:STDERR: · │ ┗━━┫ error: duplicate name `self` being declared in the same + // CHECK:STDERR: · │ ┃ scope + // CHECK:STDERR: · │ ┃ [NameDeclDuplicate] + // CHECK:STDERR: · ╰───────────┤ name is previously declared here [NameDeclPrevious] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn L[self: Self](self); // Duplicates within the implicit list and across both lists. - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+7]]:8-11: error: `self` must be declared in the explicit parameter list [SelfInImplicitParamList] + // CHECK:STDERR: ╭─┤ fail_self_repeated.carbon:[[@LINE+22]]:8 + // CHECK:STDERR: -> │ fn M[self, self](); + // CHECK:STDERR: · ━━┳━ + // CHECK:STDERR: · ┗━━┫ error: `self` must be declared in the explicit parameter list + // CHECK:STDERR: · ┃ [SelfInImplicitParamList] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+5]]:14-17: error: `self` must be declared in the explicit parameter list [SelfInImplicitParamList] + // CHECK:STDERR: ╭─┤ fail_self_repeated.carbon:[[@LINE+15]]:14 + // CHECK:STDERR: -> │ fn M[self, self](); + // CHECK:STDERR: · ━┳━━ + // CHECK:STDERR: · ┗━━┫ error: `self` must be declared in the explicit parameter list + // CHECK:STDERR: · ┃ [SelfInImplicitParamList] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+3]]:14-17: error: duplicate name `self` being declared in the same scope [NameDeclDuplicate] - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+2]]:8-11: note: name is previously declared here [NameDeclPrevious] + // CHECK:STDERR: ╭─┤ fail_self_repeated.carbon:[[@LINE+8]]:14 + // CHECK:STDERR: -> │ fn M[self, self](); + // CHECK:STDERR: · ──┬─ ━┳━━ + // CHECK:STDERR: · │ ┗━━┫ error: duplicate name `self` being declared in the same scope + // CHECK:STDERR: · │ ┃ [NameDeclDuplicate] + // CHECK:STDERR: · ╰─────────┤ name is previously declared here [NameDeclPrevious] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn M[self, self](); - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+13]]:8-11: error: `self` must be declared in the explicit parameter list [SelfInImplicitParamList] + // CHECK:STDERR: ╭─┤ fail_self_repeated.carbon:[[@LINE+41]]:8 + // CHECK:STDERR: -> │ fn N[self, self](self, self); + // CHECK:STDERR: · ━━┳━ + // CHECK:STDERR: · ┗━━┫ error: `self` must be declared in the explicit parameter list + // CHECK:STDERR: · ┃ [SelfInImplicitParamList] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+11]]:14-17: error: `self` must be declared in the explicit parameter list [SelfInImplicitParamList] + // CHECK:STDERR: ╭─┤ fail_self_repeated.carbon:[[@LINE+34]]:14 + // CHECK:STDERR: -> │ fn N[self, self](self, self); + // CHECK:STDERR: · ━┳━━ + // CHECK:STDERR: · ┗━━┫ error: `self` must be declared in the explicit parameter list + // CHECK:STDERR: · ┃ [SelfInImplicitParamList] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+9]]:14-17: error: duplicate name `self` being declared in the same scope [NameDeclDuplicate] - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+8]]:8-11: note: name is previously declared here [NameDeclPrevious] + // CHECK:STDERR: ╭─┤ fail_self_repeated.carbon:[[@LINE+27]]:14 + // CHECK:STDERR: -> │ fn N[self, self](self, self); + // CHECK:STDERR: · ──┬─ ━┳━━ + // CHECK:STDERR: · │ ┗━━┫ error: duplicate name `self` being declared in the same scope + // CHECK:STDERR: · │ ┃ [NameDeclDuplicate] + // CHECK:STDERR: · ╰─────────┤ name is previously declared here [NameDeclPrevious] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+6]]:20-23: error: duplicate name `self` being declared in the same scope [NameDeclDuplicate] - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+5]]:8-11: note: name is previously declared here [NameDeclPrevious] + // CHECK:STDERR: ╭─┤ fail_self_repeated.carbon:[[@LINE+19]]:20 + // CHECK:STDERR: -> │ fn N[self, self](self, self); + // CHECK:STDERR: · ──┬─ ┳━━━ + // CHECK:STDERR: · │ ┗━━┫ error: duplicate name `self` being declared in the same + // CHECK:STDERR: · │ ┃ scope + // CHECK:STDERR: · │ ┃ [NameDeclDuplicate] + // CHECK:STDERR: · ╰──────────────┤ name is previously declared here [NameDeclPrevious] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+3]]:26-29: error: duplicate name `self` being declared in the same scope [NameDeclDuplicate] - // CHECK:STDERR: fail_self_repeated.carbon:[[@LINE+2]]:8-11: note: name is previously declared here [NameDeclPrevious] + // CHECK:STDERR: ╭─┤ fail_self_repeated.carbon:[[@LINE+10]]:26 + // CHECK:STDERR: -> │ fn N[self, self](self, self); + // CHECK:STDERR: · ──┬─ ┳━━━ + // CHECK:STDERR: · │ ┗━━┫ error: duplicate name `self` being declared in the + // CHECK:STDERR: · │ ┃ same scope + // CHECK:STDERR: · │ ┃ [NameDeclDuplicate] + // CHECK:STDERR: · ╰────────────────────┤ name is previously declared here + // CHECK:STDERR: · │ [NameDeclPrevious] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn N[self, self](self, self); } @@ -122,7 +248,12 @@ class Class { fn Class.F() { // `var self` is only valid as the receiver of a method, not as a local // variable. - // CHECK:STDERR: fail_var_self.carbon:[[@LINE+2]]:14-23: error: `self` can only be declared in a parameter list [SelfOutsideParamList] + // CHECK:STDERR: ╭─┤ fail_var_self.carbon:[[@LINE+7]]:14 + // CHECK:STDERR: -> │ var unused self: Self; + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: `self` can only be declared in a parameter list + // CHECK:STDERR: · ┃ [SelfOutsideParamList] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused self: Self; } @@ -140,9 +271,19 @@ class WrongSelf { } fn CallWrongSelf(ws: WrongSelf) { - // CHECK:STDERR: fail_self_wrong_type.carbon:[[@LINE+4]]:3-4: error: cannot implicitly convert expression of type `WrongSelf` to `Class` [ConversionFailure] - // CHECK:STDERR: fail_self_wrong_type.carbon:[[@LINE+3]]:3-4: note: type `WrongSelf` does not implement interface `Core.ImplicitAs(Class)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: fail_self_wrong_type.carbon:[[@LINE-6]]:8-18: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_self_wrong_type.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: │ fn F(self: Class); + // CHECK:STDERR: · ─────┬───── + // CHECK:STDERR: · ╰──┤ initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ ws.F(); + // CHECK:STDERR: · ┳━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `WrongSelf` to + // CHECK:STDERR: · │ ┃ `Class` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `WrongSelf` does not implement interface `Core.ImplicitAs(Class)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: ws.F(); } @@ -152,7 +293,12 @@ library "[[@TEST_NAME]]"; class Class { // `self` must be the first explicit parameter. - // CHECK:STDERR: fail_self_not_first.carbon:[[@LINE+2]]:22-31: error: `self` must be the first explicit parameter [SelfNotFirstParam] + // CHECK:STDERR: ╭─┤ fail_self_not_first.carbon:[[@LINE+7]]:22 + // CHECK:STDERR: -> │ fn F(other: Class, self: Self); + // CHECK:STDERR: · ━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: `self` must be the first explicit parameter + // CHECK:STDERR: · ┃ [SelfNotFirstParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(other: Class, self: Self); } diff --git a/toolchain/check/testdata/class/self/fail_self_param.carbon b/toolchain/check/testdata/class/self/fail_self_param.carbon index da55d7b7dcae..41a93975d41a 100644 --- a/toolchain/check/testdata/class/self/fail_self_param.carbon +++ b/toolchain/check/testdata/class/self/fail_self_param.carbon @@ -15,11 +15,24 @@ library "[[@TEST_NAME]]"; // `self` is not a valid parameter of a class declaration even when placed in // the explicit parameter list. -// CHECK:STDERR: fail_self_param.carbon:[[@LINE+2]]:9-18: error: `self` parameter only allowed on functions [SelfParameterNotAllowed] +// CHECK:STDERR: ╭─┤ fail_self_param.carbon:[[@LINE+7]]:9 +// CHECK:STDERR: -> │ class C(self: type, x: self) {} +// CHECK:STDERR: · ━━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: `self` parameter only allowed on functions +// CHECK:STDERR: · ┃ [SelfParameterNotAllowed] +// CHECK:STDERR: ╰──── // CHECK:STDERR: class C(self: type, x: self) {} -// CHECK:STDERR: fail_self_param.carbon:[[@LINE+3]]:8-12: error: 1 argument passed to generic class expecting 2 arguments [CallArgCountMismatch] -// CHECK:STDERR: fail_self_param.carbon:[[@LINE-2]]:1-30: note: calling generic class declared here [InCallToEntity] +// CHECK:STDERR: ╭─┤ fail_self_param.carbon:[[@LINE+11]]:8 +// CHECK:STDERR: │ class C(self: type, x: self) {} +// CHECK:STDERR: · ───────────────┬────────────── +// CHECK:STDERR: · ╰──┤ calling generic class declared here [InCallToEntity] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ var v: C(()); +// CHECK:STDERR: · ━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: 1 argument passed to generic class expecting 2 arguments +// CHECK:STDERR: · ┃ [CallArgCountMismatch] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var v: C(()); @@ -28,9 +41,19 @@ library "[[@TEST_NAME]]"; // `self` in the implicit parameter list of a class declaration is reported as // both being in the wrong list and not allowed on a class at all. -// CHECK:STDERR: fail_self_param_implicit.carbon:[[@LINE+4]]:9-18: error: `self` must be declared in the explicit parameter list [SelfInImplicitParamList] +// CHECK:STDERR: ╭─┤ fail_self_param_implicit.carbon:[[@LINE+14]]:9 +// CHECK:STDERR: -> │ class C[self: type](x: self) {} +// CHECK:STDERR: · ━━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: `self` must be declared in the explicit parameter list +// CHECK:STDERR: · ┃ [SelfInImplicitParamList] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_self_param_implicit.carbon:[[@LINE+2]]:9-18: error: `self` parameter only allowed on functions [SelfParameterNotAllowed] +// CHECK:STDERR: ╭─┤ fail_self_param_implicit.carbon:[[@LINE+7]]:9 +// CHECK:STDERR: -> │ class C[self: type](x: self) {} +// CHECK:STDERR: · ━━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: `self` parameter only allowed on functions +// CHECK:STDERR: · ┃ [SelfParameterNotAllowed] +// CHECK:STDERR: ╰──── // CHECK:STDERR: class C[self: type](x: self) {} var v: C(()); diff --git a/toolchain/check/testdata/class/self/fail_self_type_member.carbon b/toolchain/check/testdata/class/self/fail_self_type_member.carbon index 2c1d20d4a494..08d726ec9f75 100644 --- a/toolchain/check/testdata/class/self/fail_self_type_member.carbon +++ b/toolchain/check/testdata/class/self/fail_self_type_member.carbon @@ -16,9 +16,20 @@ class Class { fn F() -> bool { var c1: Class = {.b = true}; - // CHECK:STDERR: fail_self_type_member.carbon:[[@LINE+4]]:17-20: error: expected identifier after `.`; prefix reserved word with `r#` to form a valid identifier [ExpectedIdentifierAfterPeriodOrArrow] + // CHECK:STDERR: ╭─┤ fail_self_type_member.carbon:[[@LINE+15]]:17 + // CHECK:STDERR: -> │ var c2: Class.Self = c1; + // CHECK:STDERR: · ┳━━━ + // CHECK:STDERR: · ┗━━┫ error: expected identifier after `.`; prefix reserved word + // CHECK:STDERR: · ┃ with `r#` to form a valid identifier + // CHECK:STDERR: · ┃ [ExpectedIdentifierAfterPeriodOrArrow] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_self_type_member.carbon:[[@LINE+2]]:11-20: error: member name `r#Self` not found in `Class` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╭─┤ fail_self_type_member.carbon:[[@LINE+7]]:11 + // CHECK:STDERR: -> │ var c2: Class.Self = c1; + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: member name `r#Self` not found in `Class` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var c2: Class.Self = c1; return c2.b; diff --git a/toolchain/check/testdata/class/self/generic_self.carbon b/toolchain/check/testdata/class/self/generic_self.carbon index 96501fe7be78..8060ccc29751 100644 --- a/toolchain/check/testdata/class/self/generic_self.carbon +++ b/toolchain/check/testdata/class/self/generic_self.carbon @@ -29,8 +29,17 @@ class Class { } fn G(c: Class) { - // CHECK:STDERR: fail_runtime_arg.carbon:[[@LINE+3]]:3-7: error: argument for generic parameter is not a compile-time constant [CompTimeArgumentNotConstant] - // CHECK:STDERR: fail_runtime_arg.carbon:[[@LINE-5]]:23-32: note: initializing generic parameter `self` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_runtime_arg.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn F(unused generic self: Self) {} + // CHECK:STDERR: · ──┬─────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `self` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ c.F(); + // CHECK:STDERR: · ━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: argument for generic parameter is not a compile-time constant + // CHECK:STDERR: · ┃ [CompTimeArgumentNotConstant] + // CHECK:STDERR: ╰──── // CHECK:STDERR: c.F(); } diff --git a/toolchain/check/testdata/class/self/self.carbon b/toolchain/check/testdata/class/self/self.carbon index 38c582f8dff4..bb915a4f045e 100644 --- a/toolchain/check/testdata/class/self/self.carbon +++ b/toolchain/check/testdata/class/self/self.carbon @@ -42,13 +42,31 @@ class Class { } // A redeclaration must spell `self` the same way as the original. -// CHECK:STDERR: fail_self_syntax_mismatch.carbon:[[@LINE+3]]:19-22: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] -// CHECK:STDERR: fail_self_syntax_mismatch.carbon:[[@LINE-6]]:12: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] +// CHECK:STDERR: ╭─┤ fail_self_syntax_mismatch.carbon:[[@LINE+12]]:19 +// CHECK:STDERR: │ fn F(self: Self); +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ comparing with previous declaration here +// CHECK:STDERR: · │ [RedeclParamSyntaxPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn Class.F(unused self) {} +// CHECK:STDERR: · ━━┳━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration syntax differs here +// CHECK:STDERR: · ┃ [RedeclParamSyntaxDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Class.F(unused self) {} -// CHECK:STDERR: fail_self_syntax_mismatch.carbon:[[@LINE+3]]:23: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] -// CHECK:STDERR: fail_self_syntax_mismatch.carbon:[[@LINE-10]]:8-11: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] +// CHECK:STDERR: ╭─┤ fail_self_syntax_mismatch.carbon:[[@LINE+12]]:23 +// CHECK:STDERR: │ fn G(self); +// CHECK:STDERR: · ──┬─ +// CHECK:STDERR: · ╰──┤ comparing with previous declaration here +// CHECK:STDERR: · │ [RedeclParamSyntaxPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn Class.G(unused self: Self) {} +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: redeclaration syntax differs here +// CHECK:STDERR: · ┃ [RedeclParamSyntaxDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Class.G(unused self: Self) {} @@ -61,8 +79,17 @@ class Class { // Two explicit `self` types that differ syntactically (here `Class` instead of // `Self`, even though they refer to the same type). -// CHECK:STDERR: fail_self_type_mismatch.carbon:[[@LINE+3]]:25-29: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] -// CHECK:STDERR: fail_self_type_mismatch.carbon:[[@LINE-6]]:14-17: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] +// CHECK:STDERR: ╭─┤ fail_self_type_mismatch.carbon:[[@LINE+12]]:25 +// CHECK:STDERR: │ fn F(self: Self); +// CHECK:STDERR: · ──┬─ +// CHECK:STDERR: · ╰──┤ comparing with previous declaration here +// CHECK:STDERR: · │ [RedeclParamSyntaxPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn Class.F(unused self: Class) {} +// CHECK:STDERR: · ━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration syntax differs here +// CHECK:STDERR: · ┃ [RedeclParamSyntaxDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Class.F(unused self: Class) {} @@ -70,8 +97,16 @@ fn Class.F(unused self: Class) {} library "[[@TEST_NAME]]"; class Class { - // CHECK:STDERR: fail_return_self_value.carbon:[[@LINE+3]]:17-20: error: cannot implicitly convert non-type value of type `Self` to `type` [ConversionFailureNonTypeToFacet] - // CHECK:STDERR: fail_return_self_value.carbon:[[@LINE+2]]:17-20: note: type `Class` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_return_self_value.carbon:[[@LINE+11]]:17 + // CHECK:STDERR: -> │ fn F(self) -> self; + // CHECK:STDERR: · ┳━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert non-type value of type + // CHECK:STDERR: · │ ┃ `Self` to `type` + // CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: · ╰────┤ type `Class` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(type)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(self) -> self; } @@ -249,9 +284,9 @@ class Class { // CHECK:STDOUT: %Class.G.d407b2.1: %Class.G.type.321a2c.1 = struct_value () [concrete] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] -// CHECK:STDOUT: %Class.F.type.48cdab.2: type = fn_type @Class.F.loc12 [concrete] +// CHECK:STDOUT: %Class.F.type.48cdab.2: type = fn_type @Class.F.loc21 [concrete] // CHECK:STDOUT: %Class.F.bd5be1.2: %Class.F.type.48cdab.2 = struct_value () [concrete] -// CHECK:STDOUT: %Class.G.type.321a2c.2: type = fn_type @Class.G.loc17 [concrete] +// CHECK:STDOUT: %Class.G.type.321a2c.2: type = fn_type @Class.G.loc35 [concrete] // CHECK:STDOUT: %Class.G.d407b2.2: %Class.G.type.321a2c.2 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -269,7 +304,7 @@ class Class { // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %Class.decl: type = class_decl @Class [concrete = constants.%Class] {} {} -// CHECK:STDOUT: %Class.F.decl: %Class.F.type.48cdab.2 = fn_decl @Class.F.loc12 [concrete = constants.%Class.F.bd5be1.2] { +// CHECK:STDOUT: %Class.F.decl: %Class.F.type.48cdab.2 = fn_decl @Class.F.loc21 [concrete = constants.%Class.F.bd5be1.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type = value_param_pattern [concrete = constants.%self.param_patt] // CHECK:STDOUT: %self.patt: %pattern_type = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt] // CHECK:STDOUT: } { @@ -277,7 +312,7 @@ class Class { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Class [concrete = constants.%Class] // CHECK:STDOUT: %self: %Class = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Class.G.decl: %Class.G.type.321a2c.2 = fn_decl @Class.G.loc17 [concrete = constants.%Class.G.d407b2.2] { +// CHECK:STDOUT: %Class.G.decl: %Class.G.type.321a2c.2 = fn_decl @Class.G.loc35 [concrete = constants.%Class.G.d407b2.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type = value_param_pattern [concrete = constants.%self.param_patt] // CHECK:STDOUT: %self.patt: %pattern_type = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt] // CHECK:STDOUT: } { @@ -317,12 +352,12 @@ class Class { // CHECK:STDOUT: // CHECK:STDOUT: fn @Class.G.loc5(%self.param: %Class); // CHECK:STDOUT: -// CHECK:STDOUT: fn @Class.F.loc12(%self.param: %Class) { +// CHECK:STDOUT: fn @Class.F.loc21(%self.param: %Class) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Class.G.loc17(%self.param: %Class) { +// CHECK:STDOUT: fn @Class.G.loc35(%self.param: %Class) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -339,7 +374,7 @@ class Class { // CHECK:STDOUT: %Class.F.bd5be1.1: %Class.F.type.48cdab.1 = struct_value () [concrete] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] -// CHECK:STDOUT: %Class.F.type.48cdab.2: type = fn_type @Class.F.loc12 [concrete] +// CHECK:STDOUT: %Class.F.type.48cdab.2: type = fn_type @Class.F.loc21 [concrete] // CHECK:STDOUT: %Class.F.bd5be1.2: %Class.F.type.48cdab.2 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -357,7 +392,7 @@ class Class { // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %Class.decl: type = class_decl @Class [concrete = constants.%Class] {} {} -// CHECK:STDOUT: %Class.F.decl: %Class.F.type.48cdab.2 = fn_decl @Class.F.loc12 [concrete = constants.%Class.F.bd5be1.2] { +// CHECK:STDOUT: %Class.F.decl: %Class.F.type.48cdab.2 = fn_decl @Class.F.loc21 [concrete = constants.%Class.F.bd5be1.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type = value_param_pattern [concrete = constants.%self.param_patt] // CHECK:STDOUT: %self.patt: %pattern_type = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt] // CHECK:STDOUT: } { @@ -387,7 +422,7 @@ class Class { // CHECK:STDOUT: // CHECK:STDOUT: fn @Class.F.loc4(%self.param: %Class); // CHECK:STDOUT: -// CHECK:STDOUT: fn @Class.F.loc12(%self.param: %Class) { +// CHECK:STDOUT: fn @Class.F.loc21(%self.param: %Class) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -433,7 +468,7 @@ class Class { // CHECK:STDOUT: %return.patt: = return_slot_pattern , [concrete = ] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.ref: %Class = name_ref self, %self -// CHECK:STDOUT: %.loc7: type = converted %self.ref, [concrete = ] +// CHECK:STDOUT: %.loc15: type = converted %self.ref, [concrete = ] // CHECK:STDOUT: %self.param: %Class = value_param call_param0 // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Class [concrete = constants.%Class] // CHECK:STDOUT: %self: %Class = wrapper_binding self, %self.param diff --git a/toolchain/check/testdata/class/syntactic_merge.carbon b/toolchain/check/testdata/class/syntactic_merge.carbon index fb1890878ee6..87c627b73ec8 100644 --- a/toolchain/check/testdata/class/syntactic_merge.carbon +++ b/toolchain/check/testdata/class/syntactic_merge.carbon @@ -41,8 +41,17 @@ library "[[@TEST_NAME]]"; class C {} class Foo(a: C); -// CHECK:STDERR: fail_parens.carbon:[[@LINE+3]]:14: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] -// CHECK:STDERR: fail_parens.carbon:[[@LINE-2]]:14: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] +// CHECK:STDERR: ╭─┤ fail_parens.carbon:[[@LINE+12]]:14 +// CHECK:STDERR: │ class Foo(a: C); +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ comparing with previous declaration here +// CHECK:STDERR: · │ [RedeclParamSyntaxPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ class Foo(a: (C)) {} +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: redeclaration syntax differs here +// CHECK:STDERR: · ┃ [RedeclParamSyntaxDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: class Foo(a: (C)) {} @@ -53,8 +62,17 @@ library "[[@TEST_NAME]]"; class C {} class Foo(a: C); -// CHECK:STDERR: fail_raw_identifier.carbon:[[@LINE+3]]:14-16: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] -// CHECK:STDERR: fail_raw_identifier.carbon:[[@LINE-2]]:14: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] +// CHECK:STDERR: ╭─┤ fail_raw_identifier.carbon:[[@LINE+12]]:14 +// CHECK:STDERR: │ class Foo(a: C); +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ comparing with previous declaration here +// CHECK:STDERR: · │ [RedeclParamSyntaxPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ class Foo(a: r#C) {} +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration syntax differs here +// CHECK:STDERR: · ┃ [RedeclParamSyntaxDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: class Foo(a: r#C) {} @@ -83,8 +101,17 @@ class C {} alias D = C; class Foo(a: C); -// CHECK:STDERR: fail_name_mismatch.carbon:[[@LINE+3]]:11-14: error: redeclaration differs at parameter 1 [RedeclParamDiffers] -// CHECK:STDERR: fail_name_mismatch.carbon:[[@LINE-2]]:11-14: note: previous declaration's corresponding parameter here [RedeclParamPrevious] +// CHECK:STDERR: ╭─┤ fail_name_mismatch.carbon:[[@LINE+12]]:11 +// CHECK:STDERR: │ class Foo(a: C); +// CHECK:STDERR: · ──┬─ +// CHECK:STDERR: · ╰──┤ previous declaration's corresponding parameter here +// CHECK:STDERR: · │ [RedeclParamPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ class Foo(b: D) {} +// CHECK:STDERR: · ━━┳━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration differs at parameter 1 +// CHECK:STDERR: · ┃ [RedeclParamDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: class Foo(b: D) {} @@ -96,8 +123,17 @@ class C {} alias D = C; class Foo(a: C); -// CHECK:STDERR: fail_alias.carbon:[[@LINE+3]]:14: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] -// CHECK:STDERR: fail_alias.carbon:[[@LINE-2]]:14: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] +// CHECK:STDERR: ╭─┤ fail_alias.carbon:[[@LINE+12]]:14 +// CHECK:STDERR: │ class Foo(a: C); +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ comparing with previous declaration here +// CHECK:STDERR: · │ [RedeclParamSyntaxPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ class Foo(a: D) {} +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: redeclaration syntax differs here +// CHECK:STDERR: · ┃ [RedeclParamSyntaxDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: class Foo(a: D) {} @@ -109,8 +145,17 @@ class C {} alias D = C; class Foo[a: C](); -// CHECK:STDERR: fail_deduced_alias.carbon:[[@LINE+3]]:14: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] -// CHECK:STDERR: fail_deduced_alias.carbon:[[@LINE-2]]:14: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] +// CHECK:STDERR: ╭─┤ fail_deduced_alias.carbon:[[@LINE+12]]:14 +// CHECK:STDERR: │ class Foo[a: C](); +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ comparing with previous declaration here +// CHECK:STDERR: · │ [RedeclParamSyntaxPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ class Foo[a: D]() {} +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: redeclaration syntax differs here +// CHECK:STDERR: · ┃ [RedeclParamSyntaxDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: class Foo[a: D]() {} @@ -137,10 +182,25 @@ library "[[@TEST_NAME]]"; class C {} class Foo(a: const C); -// CHECK:STDERR: fail_repeat_const.carbon:[[@LINE+5]]:14-28: warning: `const` applied repeatedly to the same type has no additional effect [RepeatedConst] +// CHECK:STDERR: ╭─┤ fail_repeat_const.carbon:[[@LINE+20]]:14 +// CHECK:STDERR: -> │ class Foo(a: const (const C)) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ warning: `const` applied repeatedly to the same type has no +// CHECK:STDERR: · ┃ additional effect +// CHECK:STDERR: · ┃ [RepeatedConst] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_repeat_const.carbon:[[@LINE+3]]:20: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] -// CHECK:STDERR: fail_repeat_const.carbon:[[@LINE-4]]:20: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] +// CHECK:STDERR: ╭─┤ fail_repeat_const.carbon:[[@LINE+12]]:20 +// CHECK:STDERR: │ class Foo(a: const C); +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ comparing with previous declaration here +// CHECK:STDERR: · │ [RedeclParamSyntaxPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ class Foo(a: const (const C)) {} +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: redeclaration syntax differs here +// CHECK:STDERR: · ┃ [RedeclParamSyntaxDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: class Foo(a: const (const C)) {} @@ -154,8 +214,17 @@ base class Base { fn F(ref self); } -// CHECK:STDERR: fail_self_type.carbon:[[@LINE+3]]:19: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] -// CHECK:STDERR: fail_self_type.carbon:[[@LINE-4]]:8-15: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] +// CHECK:STDERR: ╭─┤ fail_self_type.carbon:[[@LINE+12]]:19 +// CHECK:STDERR: │ fn F(ref self); +// CHECK:STDERR: · ────┬─── +// CHECK:STDERR: · ╰──┤ comparing with previous declaration here +// CHECK:STDERR: · │ [RedeclParamSyntaxPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn Base.F(ref self: Base) { +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: redeclaration syntax differs here +// CHECK:STDERR: · ┃ [RedeclParamSyntaxDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Base.F(ref self: Base) { self.a = (); @@ -359,9 +428,9 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: %a: %C = symbolic_binding a, 0 [symbolic] // CHECK:STDOUT: %Foo.type.6e5839.1: type = parameterized_class_name_type @Foo.loc6 [concrete] // CHECK:STDOUT: %Foo.generic.08f655.1: %Foo.type.6e5839.1 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.6e5839.2: type = parameterized_class_name_type @Foo.loc10 [concrete] +// CHECK:STDOUT: %Foo.type.6e5839.2: type = parameterized_class_name_type @Foo.loc19 [concrete] // CHECK:STDOUT: %Foo.generic.08f655.2: %Foo.type.6e5839.2 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.755f1e.2: type = class_type @Foo.loc10, @Foo.loc10(%a) [symbolic] +// CHECK:STDOUT: %Foo.755f1e.2: type = class_type @Foo.loc19, @Foo.loc19(%a) [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -379,14 +448,14 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: } // CHECK:STDOUT: %a.loc6_12.2: %C = symbolic_binding a, 0 [symbolic = %a.loc6_12.1 (constants.%a)] // CHECK:STDOUT: } -// CHECK:STDOUT: %Foo.decl.loc10: %Foo.type.6e5839.2 = class_decl @Foo.loc10 [concrete = constants.%Foo.generic.08f655.2] { -// CHECK:STDOUT: %a.patt.loc10_12.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc10_12.2 (constants.%a.patt)] +// CHECK:STDOUT: %Foo.decl.loc19: %Foo.type.6e5839.2 = class_decl @Foo.loc19 [concrete = constants.%Foo.generic.08f655.2] { +// CHECK:STDOUT: %a.patt.loc19_12.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc19_12.2 (constants.%a.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc10: type = splice_block %C.ref [concrete = constants.%C] { +// CHECK:STDOUT: %.loc19: type = splice_block %C.ref [concrete = constants.%C] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: } -// CHECK:STDOUT: %a.loc10_12.2: %C = symbolic_binding a, 0 [symbolic = %a.loc10_12.1 (constants.%a)] +// CHECK:STDOUT: %a.loc19_12.2: %C = symbolic_binding a, 0 [symbolic = %a.loc19_12.1 (constants.%a)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -405,9 +474,9 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: class; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic class @Foo.loc10(%a.loc10_12.2: %C) { -// CHECK:STDOUT: %a.patt.loc10_12.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc10_12.2 (constants.%a.patt)] -// CHECK:STDOUT: %a.loc10_12.1: %C = symbolic_binding a, 0 [symbolic = %a.loc10_12.1 (constants.%a)] +// CHECK:STDOUT: generic class @Foo.loc19(%a.loc19_12.2: %C) { +// CHECK:STDOUT: %a.patt.loc19_12.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc19_12.2 (constants.%a.patt)] +// CHECK:STDOUT: %a.loc19_12.1: %C = symbolic_binding a, 0 [symbolic = %a.loc19_12.1 (constants.%a)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -425,9 +494,9 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: %a.loc6_12.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Foo.loc10(constants.%a) { -// CHECK:STDOUT: %a.patt.loc10_12.2 => constants.%a.patt -// CHECK:STDOUT: %a.loc10_12.1 => constants.%a +// CHECK:STDOUT: specific @Foo.loc19(constants.%a) { +// CHECK:STDOUT: %a.patt.loc19_12.2 => constants.%a.patt +// CHECK:STDOUT: %a.loc19_12.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_raw_identifier.carbon @@ -443,9 +512,9 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: %a: %C = symbolic_binding a, 0 [symbolic] // CHECK:STDOUT: %Foo.type.6e5839.1: type = parameterized_class_name_type @Foo.loc6 [concrete] // CHECK:STDOUT: %Foo.generic.08f655.1: %Foo.type.6e5839.1 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.6e5839.2: type = parameterized_class_name_type @Foo.loc10 [concrete] +// CHECK:STDOUT: %Foo.type.6e5839.2: type = parameterized_class_name_type @Foo.loc19 [concrete] // CHECK:STDOUT: %Foo.generic.08f655.2: %Foo.type.6e5839.2 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.755f1e.2: type = class_type @Foo.loc10, @Foo.loc10(%a) [symbolic] +// CHECK:STDOUT: %Foo.755f1e.2: type = class_type @Foo.loc19, @Foo.loc19(%a) [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -463,14 +532,14 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: } // CHECK:STDOUT: %a.loc6_12.2: %C = symbolic_binding a, 0 [symbolic = %a.loc6_12.1 (constants.%a)] // CHECK:STDOUT: } -// CHECK:STDOUT: %Foo.decl.loc10: %Foo.type.6e5839.2 = class_decl @Foo.loc10 [concrete = constants.%Foo.generic.08f655.2] { -// CHECK:STDOUT: %a.patt.loc10_12.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc10_12.2 (constants.%a.patt)] +// CHECK:STDOUT: %Foo.decl.loc19: %Foo.type.6e5839.2 = class_decl @Foo.loc19 [concrete = constants.%Foo.generic.08f655.2] { +// CHECK:STDOUT: %a.patt.loc19_12.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc19_12.2 (constants.%a.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc10: type = splice_block %C.ref [concrete = constants.%C] { +// CHECK:STDOUT: %.loc19: type = splice_block %C.ref [concrete = constants.%C] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: } -// CHECK:STDOUT: %a.loc10_12.2: %C = symbolic_binding a, 0 [symbolic = %a.loc10_12.1 (constants.%a)] +// CHECK:STDOUT: %a.loc19_12.2: %C = symbolic_binding a, 0 [symbolic = %a.loc19_12.1 (constants.%a)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -489,9 +558,9 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: class; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic class @Foo.loc10(%a.loc10_12.2: %C) { -// CHECK:STDOUT: %a.patt.loc10_12.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc10_12.2 (constants.%a.patt)] -// CHECK:STDOUT: %a.loc10_12.1: %C = symbolic_binding a, 0 [symbolic = %a.loc10_12.1 (constants.%a)] +// CHECK:STDOUT: generic class @Foo.loc19(%a.loc19_12.2: %C) { +// CHECK:STDOUT: %a.patt.loc19_12.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc19_12.2 (constants.%a.patt)] +// CHECK:STDOUT: %a.loc19_12.1: %C = symbolic_binding a, 0 [symbolic = %a.loc19_12.1 (constants.%a)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -509,9 +578,9 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: %a.loc6_12.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Foo.loc10(constants.%a) { -// CHECK:STDOUT: %a.patt.loc10_12.2 => constants.%a.patt -// CHECK:STDOUT: %a.loc10_12.1 => constants.%a +// CHECK:STDOUT: specific @Foo.loc19(constants.%a) { +// CHECK:STDOUT: %a.patt.loc19_12.2 => constants.%a.patt +// CHECK:STDOUT: %a.loc19_12.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- two_file.carbon @@ -712,9 +781,9 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: %Foo.generic.08f655.1: %Foo.type.6e5839.1 = struct_value () [concrete] // CHECK:STDOUT: %b.patt: %pattern_type = symbolic_binding_pattern b, 0 [symbolic] // CHECK:STDOUT: %b: %C = symbolic_binding b, 0 [symbolic] -// CHECK:STDOUT: %Foo.type.6e5839.2: type = parameterized_class_name_type @Foo.loc11 [concrete] +// CHECK:STDOUT: %Foo.type.6e5839.2: type = parameterized_class_name_type @Foo.loc20 [concrete] // CHECK:STDOUT: %Foo.generic.08f655.2: %Foo.type.6e5839.2 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.755f1e.2: type = class_type @Foo.loc11, @Foo.loc11(%b) [symbolic] +// CHECK:STDOUT: %Foo.755f1e.2: type = class_type @Foo.loc20, @Foo.loc20(%b) [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -735,14 +804,14 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: } // CHECK:STDOUT: %a.loc7_12.2: %C = symbolic_binding a, 0 [symbolic = %a.loc7_12.1 (constants.%a)] // CHECK:STDOUT: } -// CHECK:STDOUT: %Foo.decl.loc11: %Foo.type.6e5839.2 = class_decl @Foo.loc11 [concrete = constants.%Foo.generic.08f655.2] { -// CHECK:STDOUT: %b.patt.loc11_12.1: %pattern_type = symbolic_binding_pattern b, 0 [symbolic = %b.patt.loc11_12.2 (constants.%b.patt)] +// CHECK:STDOUT: %Foo.decl.loc20: %Foo.type.6e5839.2 = class_decl @Foo.loc20 [concrete = constants.%Foo.generic.08f655.2] { +// CHECK:STDOUT: %b.patt.loc20_12.1: %pattern_type = symbolic_binding_pattern b, 0 [symbolic = %b.patt.loc20_12.2 (constants.%b.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc11: type = splice_block %D.ref [concrete = constants.%C] { +// CHECK:STDOUT: %.loc20: type = splice_block %D.ref [concrete = constants.%C] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D [concrete = constants.%C] // CHECK:STDOUT: } -// CHECK:STDOUT: %b.loc11_12.2: %C = symbolic_binding b, 0 [symbolic = %b.loc11_12.1 (constants.%b)] +// CHECK:STDOUT: %b.loc20_12.2: %C = symbolic_binding b, 0 [symbolic = %b.loc20_12.1 (constants.%b)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -761,9 +830,9 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: class; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic class @Foo.loc11(%b.loc11_12.2: %C) { -// CHECK:STDOUT: %b.patt.loc11_12.2: %pattern_type = symbolic_binding_pattern b, 0 [symbolic = %b.patt.loc11_12.2 (constants.%b.patt)] -// CHECK:STDOUT: %b.loc11_12.1: %C = symbolic_binding b, 0 [symbolic = %b.loc11_12.1 (constants.%b)] +// CHECK:STDOUT: generic class @Foo.loc20(%b.loc20_12.2: %C) { +// CHECK:STDOUT: %b.patt.loc20_12.2: %pattern_type = symbolic_binding_pattern b, 0 [symbolic = %b.patt.loc20_12.2 (constants.%b.patt)] +// CHECK:STDOUT: %b.loc20_12.1: %C = symbolic_binding b, 0 [symbolic = %b.loc20_12.1 (constants.%b)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -781,9 +850,9 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: %a.loc7_12.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Foo.loc11(constants.%b) { -// CHECK:STDOUT: %b.patt.loc11_12.2 => constants.%b.patt -// CHECK:STDOUT: %b.loc11_12.1 => constants.%b +// CHECK:STDOUT: specific @Foo.loc20(constants.%b) { +// CHECK:STDOUT: %b.patt.loc20_12.2 => constants.%b.patt +// CHECK:STDOUT: %b.loc20_12.1 => constants.%b // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_alias.carbon @@ -799,9 +868,9 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: %a: %C = symbolic_binding a, 0 [symbolic] // CHECK:STDOUT: %Foo.type.6e5839.1: type = parameterized_class_name_type @Foo.loc7 [concrete] // CHECK:STDOUT: %Foo.generic.08f655.1: %Foo.type.6e5839.1 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.6e5839.2: type = parameterized_class_name_type @Foo.loc11 [concrete] +// CHECK:STDOUT: %Foo.type.6e5839.2: type = parameterized_class_name_type @Foo.loc20 [concrete] // CHECK:STDOUT: %Foo.generic.08f655.2: %Foo.type.6e5839.2 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.755f1e.2: type = class_type @Foo.loc11, @Foo.loc11(%a) [symbolic] +// CHECK:STDOUT: %Foo.755f1e.2: type = class_type @Foo.loc20, @Foo.loc20(%a) [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -822,14 +891,14 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: } // CHECK:STDOUT: %a.loc7_12.2: %C = symbolic_binding a, 0 [symbolic = %a.loc7_12.1 (constants.%a)] // CHECK:STDOUT: } -// CHECK:STDOUT: %Foo.decl.loc11: %Foo.type.6e5839.2 = class_decl @Foo.loc11 [concrete = constants.%Foo.generic.08f655.2] { -// CHECK:STDOUT: %a.patt.loc11_12.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc11_12.2 (constants.%a.patt)] +// CHECK:STDOUT: %Foo.decl.loc20: %Foo.type.6e5839.2 = class_decl @Foo.loc20 [concrete = constants.%Foo.generic.08f655.2] { +// CHECK:STDOUT: %a.patt.loc20_12.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc20_12.2 (constants.%a.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc11: type = splice_block %D.ref [concrete = constants.%C] { +// CHECK:STDOUT: %.loc20: type = splice_block %D.ref [concrete = constants.%C] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D [concrete = constants.%C] // CHECK:STDOUT: } -// CHECK:STDOUT: %a.loc11_12.2: %C = symbolic_binding a, 0 [symbolic = %a.loc11_12.1 (constants.%a)] +// CHECK:STDOUT: %a.loc20_12.2: %C = symbolic_binding a, 0 [symbolic = %a.loc20_12.1 (constants.%a)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -848,9 +917,9 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: class; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic class @Foo.loc11(%a.loc11_12.2: %C) { -// CHECK:STDOUT: %a.patt.loc11_12.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc11_12.2 (constants.%a.patt)] -// CHECK:STDOUT: %a.loc11_12.1: %C = symbolic_binding a, 0 [symbolic = %a.loc11_12.1 (constants.%a)] +// CHECK:STDOUT: generic class @Foo.loc20(%a.loc20_12.2: %C) { +// CHECK:STDOUT: %a.patt.loc20_12.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc20_12.2 (constants.%a.patt)] +// CHECK:STDOUT: %a.loc20_12.1: %C = symbolic_binding a, 0 [symbolic = %a.loc20_12.1 (constants.%a)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -868,9 +937,9 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: %a.loc7_12.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Foo.loc11(constants.%a) { -// CHECK:STDOUT: %a.patt.loc11_12.2 => constants.%a.patt -// CHECK:STDOUT: %a.loc11_12.1 => constants.%a +// CHECK:STDOUT: specific @Foo.loc20(constants.%a) { +// CHECK:STDOUT: %a.patt.loc20_12.2 => constants.%a.patt +// CHECK:STDOUT: %a.loc20_12.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_deduced_alias.carbon @@ -886,9 +955,9 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: %a: %C = symbolic_binding a, 0 [symbolic] // CHECK:STDOUT: %Foo.type.6e5839.1: type = parameterized_class_name_type @Foo.loc7 [concrete] // CHECK:STDOUT: %Foo.generic.08f655.1: %Foo.type.6e5839.1 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.6e5839.2: type = parameterized_class_name_type @Foo.loc11 [concrete] +// CHECK:STDOUT: %Foo.type.6e5839.2: type = parameterized_class_name_type @Foo.loc20 [concrete] // CHECK:STDOUT: %Foo.generic.08f655.2: %Foo.type.6e5839.2 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.755f1e.2: type = class_type @Foo.loc11, @Foo.loc11(%a) [symbolic] +// CHECK:STDOUT: %Foo.755f1e.2: type = class_type @Foo.loc20, @Foo.loc20(%a) [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -909,14 +978,14 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: } // CHECK:STDOUT: %a.loc7_12.2: %C = symbolic_binding a, 0 [symbolic = %a.loc7_12.1 (constants.%a)] // CHECK:STDOUT: } -// CHECK:STDOUT: %Foo.decl.loc11: %Foo.type.6e5839.2 = class_decl @Foo.loc11 [concrete = constants.%Foo.generic.08f655.2] { -// CHECK:STDOUT: %a.patt.loc11_12.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc11_12.2 (constants.%a.patt)] +// CHECK:STDOUT: %Foo.decl.loc20: %Foo.type.6e5839.2 = class_decl @Foo.loc20 [concrete = constants.%Foo.generic.08f655.2] { +// CHECK:STDOUT: %a.patt.loc20_12.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc20_12.2 (constants.%a.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc11: type = splice_block %D.ref [concrete = constants.%C] { +// CHECK:STDOUT: %.loc20: type = splice_block %D.ref [concrete = constants.%C] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D [concrete = constants.%C] // CHECK:STDOUT: } -// CHECK:STDOUT: %a.loc11_12.2: %C = symbolic_binding a, 0 [symbolic = %a.loc11_12.1 (constants.%a)] +// CHECK:STDOUT: %a.loc20_12.2: %C = symbolic_binding a, 0 [symbolic = %a.loc20_12.1 (constants.%a)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -935,9 +1004,9 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: class; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic class @Foo.loc11(%a.loc11_12.2: %C) { -// CHECK:STDOUT: %a.patt.loc11_12.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc11_12.2 (constants.%a.patt)] -// CHECK:STDOUT: %a.loc11_12.1: %C = symbolic_binding a, 0 [symbolic = %a.loc11_12.1 (constants.%a)] +// CHECK:STDOUT: generic class @Foo.loc20(%a.loc20_12.2: %C) { +// CHECK:STDOUT: %a.patt.loc20_12.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc20_12.2 (constants.%a.patt)] +// CHECK:STDOUT: %a.loc20_12.1: %C = symbolic_binding a, 0 [symbolic = %a.loc20_12.1 (constants.%a)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -955,9 +1024,9 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: %a.loc7_12.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Foo.loc11(constants.%a) { -// CHECK:STDOUT: %a.patt.loc11_12.2 => constants.%a.patt -// CHECK:STDOUT: %a.loc11_12.1 => constants.%a +// CHECK:STDOUT: specific @Foo.loc20(constants.%a) { +// CHECK:STDOUT: %a.patt.loc20_12.2 => constants.%a.patt +// CHECK:STDOUT: %a.loc20_12.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- alias_two_file.carbon @@ -1097,9 +1166,9 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: %a: %const = symbolic_binding a, 0 [symbolic] // CHECK:STDOUT: %Foo.type.6e5839.1: type = parameterized_class_name_type @Foo.loc6 [concrete] // CHECK:STDOUT: %Foo.generic.08f655.1: %Foo.type.6e5839.1 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.6e5839.2: type = parameterized_class_name_type @Foo.loc12 [concrete] +// CHECK:STDOUT: %Foo.type.6e5839.2: type = parameterized_class_name_type @Foo.loc27 [concrete] // CHECK:STDOUT: %Foo.generic.08f655.2: %Foo.type.6e5839.2 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.16c1fe.2: type = class_type @Foo.loc12, @Foo.loc12(%a) [symbolic] +// CHECK:STDOUT: %Foo.16c1fe.2: type = class_type @Foo.loc27, @Foo.loc27(%a) [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -1118,16 +1187,16 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: } // CHECK:STDOUT: %a.loc6_12.2: %const = symbolic_binding a, 0 [symbolic = %a.loc6_12.1 (constants.%a)] // CHECK:STDOUT: } -// CHECK:STDOUT: %Foo.decl.loc12: %Foo.type.6e5839.2 = class_decl @Foo.loc12 [concrete = constants.%Foo.generic.08f655.2] { -// CHECK:STDOUT: %a.patt.loc12_12.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc12_12.2 (constants.%a.patt)] +// CHECK:STDOUT: %Foo.decl.loc27: %Foo.type.6e5839.2 = class_decl @Foo.loc27 [concrete = constants.%Foo.generic.08f655.2] { +// CHECK:STDOUT: %a.patt.loc27_12.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc27_12.2 (constants.%a.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc12: type = splice_block %const.loc12_14 [concrete = constants.%const] { +// CHECK:STDOUT: %.loc27: type = splice_block %const.loc27_14 [concrete = constants.%const] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %const.loc12_21: type = const_type %C.ref [concrete = constants.%const] -// CHECK:STDOUT: %const.loc12_14: type = const_type %const.loc12_21 [concrete = constants.%const] +// CHECK:STDOUT: %const.loc27_21: type = const_type %C.ref [concrete = constants.%const] +// CHECK:STDOUT: %const.loc27_14: type = const_type %const.loc27_21 [concrete = constants.%const] // CHECK:STDOUT: } -// CHECK:STDOUT: %a.loc12_12.2: %const = symbolic_binding a, 0 [symbolic = %a.loc12_12.1 (constants.%a)] +// CHECK:STDOUT: %a.loc27_12.2: %const = symbolic_binding a, 0 [symbolic = %a.loc27_12.1 (constants.%a)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1146,9 +1215,9 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: class; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic class @Foo.loc12(%a.loc12_12.2: %const) { -// CHECK:STDOUT: %a.patt.loc12_12.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc12_12.2 (constants.%a.patt)] -// CHECK:STDOUT: %a.loc12_12.1: %const = symbolic_binding a, 0 [symbolic = %a.loc12_12.1 (constants.%a)] +// CHECK:STDOUT: generic class @Foo.loc27(%a.loc27_12.2: %const) { +// CHECK:STDOUT: %a.patt.loc27_12.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc27_12.2 (constants.%a.patt)] +// CHECK:STDOUT: %a.loc27_12.1: %const = symbolic_binding a, 0 [symbolic = %a.loc27_12.1 (constants.%a)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -1166,9 +1235,9 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: %a.loc6_12.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Foo.loc12(constants.%a) { -// CHECK:STDOUT: %a.patt.loc12_12.2 => constants.%a.patt -// CHECK:STDOUT: %a.loc12_12.1 => constants.%a +// CHECK:STDOUT: specific @Foo.loc27(constants.%a) { +// CHECK:STDOUT: %a.patt.loc27_12.2 => constants.%a.patt +// CHECK:STDOUT: %a.loc27_12.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_self_type.carbon @@ -1186,7 +1255,7 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: %Base.F.bd5be1.1: %Base.F.type.48cdab.1 = struct_value () [concrete] // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %empty_tuple.type} [concrete] // CHECK:STDOUT: %complete_type: = complete_type_witness %struct_type.a [concrete] -// CHECK:STDOUT: %Base.F.type.48cdab.2: type = fn_type @Base.F.loc13 [concrete] +// CHECK:STDOUT: %Base.F.type.48cdab.2: type = fn_type @Base.F.loc22 [concrete] // CHECK:STDOUT: %Base.F.bd5be1.2: %Base.F.type.48cdab.2 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1195,7 +1264,7 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: .Base = %Base.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Base.decl: type = class_decl @Base [concrete = constants.%Base] {} {} -// CHECK:STDOUT: %Base.F.decl: %Base.F.type.48cdab.2 = fn_decl @Base.F.loc13 [concrete = constants.%Base.F.bd5be1.2] { +// CHECK:STDOUT: %Base.F.decl: %Base.F.type.48cdab.2 = fn_decl @Base.F.loc22 [concrete = constants.%Base.F.bd5be1.2] { // CHECK:STDOUT: %self.param_patt: %pattern_type.912 = ref_param_pattern [concrete = constants.%self.param_patt] // CHECK:STDOUT: %self.patt: %pattern_type.912 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt] // CHECK:STDOUT: } { @@ -1230,15 +1299,15 @@ fn Base.F(ref self: Base) { // CHECK:STDOUT: // CHECK:STDOUT: fn @Base.F.loc7(%self.param: ref %Base); // CHECK:STDOUT: -// CHECK:STDOUT: fn @Base.F.loc13(%self.param: ref %Base) { +// CHECK:STDOUT: fn @Base.F.loc22(%self.param: ref %Base) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %self.ref: ref %Base = name_ref self, %self // CHECK:STDOUT: %a.ref: %Base.elem = name_ref a, @Base.%field_decl [concrete = @Base.%field_decl] -// CHECK:STDOUT: %.loc14_7: ref %empty_tuple.type = class_element_access %self.ref, element0 -// CHECK:STDOUT: %.loc14_13.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc14_13.2: init %empty_tuple.type = tuple_init () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc14_10: init %empty_tuple.type = converted %.loc14_13.1, %.loc14_13.2 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: assign %.loc14_7, %.loc14_10 +// CHECK:STDOUT: %.loc23_7: ref %empty_tuple.type = class_element_access %self.ref, element0 +// CHECK:STDOUT: %.loc23_13.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc23_13.2: init %empty_tuple.type = tuple_init () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc23_10: init %empty_tuple.type = converted %.loc23_13.1, %.loc23_13.2 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: assign %.loc23_7, %.loc23_10 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/syntactic_merge_literal.carbon b/toolchain/check/testdata/class/syntactic_merge_literal.carbon index c61f2fe444b1..201a5c035d91 100644 --- a/toolchain/check/testdata/class/syntactic_merge_literal.carbon +++ b/toolchain/check/testdata/class/syntactic_merge_literal.carbon @@ -26,8 +26,17 @@ library "[[@TEST_NAME]]"; class C(a: i32) {} class D(b: C(1000)); -// CHECK:STDERR: fail_int_mismatch.carbon:[[@LINE+3]]:14-18: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] -// CHECK:STDERR: fail_int_mismatch.carbon:[[@LINE-2]]:14-17: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] +// CHECK:STDERR: ╭─┤ fail_int_mismatch.carbon:[[@LINE+12]]:14 +// CHECK:STDERR: │ class D(b: C(1000)); +// CHECK:STDERR: · ──┬─ +// CHECK:STDERR: · ╰──┤ comparing with previous declaration here +// CHECK:STDERR: · │ [RedeclParamSyntaxPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ class D(b: C(1_000)) {} +// CHECK:STDERR: · ━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration syntax differs here +// CHECK:STDERR: · ┃ [RedeclParamSyntaxDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: class D(b: C(1_000)) {} @@ -226,9 +235,9 @@ class D(b: C(1_000)) {} // CHECK:STDOUT: %b: %C.f79 = symbolic_binding b, 0 [symbolic] // CHECK:STDOUT: %D.type.0f59a4.1: type = parameterized_class_name_type @D.loc5 [concrete] // CHECK:STDOUT: %D.generic.f4a710.1: %D.type.0f59a4.1 = struct_value () [concrete] -// CHECK:STDOUT: %D.type.0f59a4.2: type = parameterized_class_name_type @D.loc9 [concrete] +// CHECK:STDOUT: %D.type.0f59a4.2: type = parameterized_class_name_type @D.loc18 [concrete] // CHECK:STDOUT: %D.generic.f4a710.2: %D.type.0f59a4.2 = struct_value () [concrete] -// CHECK:STDOUT: %D.690fbd.2: type = class_type @D.loc9, @D.loc9(%b) [symbolic] +// CHECK:STDOUT: %D.690fbd.2: type = class_type @D.loc18, @D.loc18(%b) [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -278,23 +287,23 @@ class D(b: C(1_000)) {} // CHECK:STDOUT: } // CHECK:STDOUT: %b.loc5_10.2: %C.f79 = symbolic_binding b, 0 [symbolic = %b.loc5_10.1 (constants.%b)] // CHECK:STDOUT: } -// CHECK:STDOUT: %D.decl.loc9: %D.type.0f59a4.2 = class_decl @D.loc9 [concrete = constants.%D.generic.f4a710.2] { -// CHECK:STDOUT: %b.patt.loc9_10.1: %pattern_type.864 = symbolic_binding_pattern b, 0 [symbolic = %b.patt.loc9_10.2 (constants.%b.patt)] +// CHECK:STDOUT: %D.decl.loc18: %D.type.0f59a4.2 = class_decl @D.loc18 [concrete = constants.%D.generic.f4a710.2] { +// CHECK:STDOUT: %b.patt.loc18_10.1: %pattern_type.864 = symbolic_binding_pattern b, 0 [symbolic = %b.patt.loc18_10.2 (constants.%b.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc9_19.1: type = splice_block %C [concrete = constants.%C.f79] { +// CHECK:STDOUT: %.loc18_19.1: type = splice_block %C [concrete = constants.%C.f79] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [concrete = constants.%C.generic] // CHECK:STDOUT: %int_1000: Core.IntLiteral = int_value 1000 [concrete = constants.%int_1000.ff9] // CHECK:STDOUT: %impl.elem0: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc9_19.1: = bound_method %int_1000, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %bound_method.loc18_19.1: = bound_method %int_1000, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] // CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc9_19.2: = bound_method %int_1000, %specific_fn [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc9_19.2(%int_1000) [concrete = constants.%int_1000.b23] -// CHECK:STDOUT: %.loc9_19.2: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_1000.b23] -// CHECK:STDOUT: %.loc9_19.3: %i32 = converted %int_1000, %.loc9_19.2 [concrete = constants.%int_1000.b23] +// CHECK:STDOUT: %bound_method.loc18_19.2: = bound_method %int_1000, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc18_19.2(%int_1000) [concrete = constants.%int_1000.b23] +// CHECK:STDOUT: %.loc18_19.2: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_1000.b23] +// CHECK:STDOUT: %.loc18_19.3: %i32 = converted %int_1000, %.loc18_19.2 [concrete = constants.%int_1000.b23] // CHECK:STDOUT: %C: type = class_type @C, @C(constants.%int_1000.b23) [concrete = constants.%C.f79] // CHECK:STDOUT: } -// CHECK:STDOUT: %b.loc9_10.2: %C.f79 = symbolic_binding b, 0 [symbolic = %b.loc9_10.1 (constants.%b)] +// CHECK:STDOUT: %b.loc18_10.2: %C.f79 = symbolic_binding b, 0 [symbolic = %b.loc18_10.1 (constants.%b)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -320,9 +329,9 @@ class D(b: C(1_000)) {} // CHECK:STDOUT: class; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic class @D.loc9(%b.loc9_10.2: %C.f79) { -// CHECK:STDOUT: %b.patt.loc9_10.2: %pattern_type.864 = symbolic_binding_pattern b, 0 [symbolic = %b.patt.loc9_10.2 (constants.%b.patt)] -// CHECK:STDOUT: %b.loc9_10.1: %C.f79 = symbolic_binding b, 0 [symbolic = %b.loc9_10.1 (constants.%b)] +// CHECK:STDOUT: generic class @D.loc18(%b.loc18_10.2: %C.f79) { +// CHECK:STDOUT: %b.patt.loc18_10.2: %pattern_type.864 = symbolic_binding_pattern b, 0 [symbolic = %b.patt.loc18_10.2 (constants.%b.patt)] +// CHECK:STDOUT: %b.loc18_10.1: %C.f79 = symbolic_binding b, 0 [symbolic = %b.loc18_10.1 (constants.%b)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -350,8 +359,8 @@ class D(b: C(1_000)) {} // CHECK:STDOUT: %b.loc5_10.1 => constants.%b // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @D.loc9(constants.%b) { -// CHECK:STDOUT: %b.patt.loc9_10.2 => constants.%b.patt -// CHECK:STDOUT: %b.loc9_10.1 => constants.%b +// CHECK:STDOUT: specific @D.loc18(constants.%b) { +// CHECK:STDOUT: %b.patt.loc18_10.2 => constants.%b.patt +// CHECK:STDOUT: %b.loc18_10.1 => constants.%b // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/const/access.carbon b/toolchain/check/testdata/const/access.carbon index 7e70813f5417..df3bb3d21097 100644 --- a/toolchain/check/testdata/const/access.carbon +++ b/toolchain/check/testdata/const/access.carbon @@ -29,7 +29,11 @@ class C { } fn F(c: const C) { - // CHECK:STDERR: fail_const_member_assign.carbon:[[@LINE+2]]:3-5: error: expression is not assignable [AssignmentToNonAssignable] + // CHECK:STDERR: ╭─┤ fail_const_member_assign.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ c.x = (); + // CHECK:STDERR: · ━┳━ + // CHECK:STDERR: · ┗━━┫ error: expression is not assignable [AssignmentToNonAssignable] + // CHECK:STDERR: ╰──── // CHECK:STDERR: c.x = (); } @@ -42,7 +46,11 @@ class C { } fn F(ref c: const C) { - // CHECK:STDERR: fail_const_ref_member_assign.carbon:[[@LINE+2]]:3-5: error: expression is not assignable [AssignmentToNonAssignable] + // CHECK:STDERR: ╭─┤ fail_const_ref_member_assign.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ c.x = (); + // CHECK:STDERR: · ━┳━ + // CHECK:STDERR: · ┗━━┫ error: expression is not assignable [AssignmentToNonAssignable] + // CHECK:STDERR: ╰──── // CHECK:STDERR: c.x = (); } diff --git a/toolchain/check/testdata/const/basics.carbon b/toolchain/check/testdata/const/basics.carbon index 43ed1bd17d5d..2d95be05343b 100644 --- a/toolchain/check/testdata/const/basics.carbon +++ b/toolchain/check/testdata/const/basics.carbon @@ -32,7 +32,13 @@ class C; // OK, `const (const C)` is the same type as `const C`. //@dump-sem-ir-begin -// CHECK:STDERR: collapse.carbon:[[@LINE+2]]:23-37: warning: `const` applied repeatedly to the same type has no additional effect [RepeatedConst] +// CHECK:STDERR: ╭─┤ collapse.carbon:[[@LINE+8]]:23 +// CHECK:STDERR: -> │ fn F(p: const C**) -> const (const C)** { +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ warning: `const` applied repeatedly to the same type +// CHECK:STDERR: · ┃ has no additional effect +// CHECK:STDERR: · ┃ [RepeatedConst] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(p: const C**) -> const (const C)** { return p; @@ -44,11 +50,23 @@ library "[[@TEST_NAME]]"; class C; -// CHECK:STDERR: fail_collapse_in_error.carbon:[[@LINE+2]]:9-23: warning: `const` applied repeatedly to the same type has no additional effect [RepeatedConst] +// CHECK:STDERR: ╭─┤ fail_collapse_in_error.carbon:[[@LINE+8]]:9 +// CHECK:STDERR: -> │ fn G(p: const (const C)**) -> C** { +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ warning: `const` applied repeatedly to the same type has no +// CHECK:STDERR: · ┃ additional effect +// CHECK:STDERR: · ┃ [RepeatedConst] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn G(p: const (const C)**) -> C** { - // CHECK:STDERR: fail_collapse_in_error.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `const C**` to `C**` [ConversionFailure] - // CHECK:STDERR: fail_collapse_in_error.carbon:[[@LINE+2]]:3-11: note: type `const C**` does not implement interface `Core.ImplicitAs(C**)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_collapse_in_error.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ return p; + // CHECK:STDERR: · ━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `const C**` to `C**` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `const C**` does not implement interface `Core.ImplicitAs(C**)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return p; } @@ -106,9 +124,18 @@ class X { } fn PassConstReferenceToReference(p: const X*) { - // CHECK:STDERR: fail_remove_while_forming_reference.carbon:[[@LINE+4]]:3-17: error: cannot implicitly convert expression of type `const X` to `X` [ConversionFailure] - // CHECK:STDERR: fail_remove_while_forming_reference.carbon:[[@LINE+3]]:3-17: note: type `const X` does not implement interface `Core.ImplicitAs(X)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: fail_remove_while_forming_reference.carbon:[[@LINE-6]]:15-22: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_remove_while_forming_reference.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn TakeSelf(ref self); + // CHECK:STDERR: · ────┬─── + // CHECK:STDERR: · ╰──┤ initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ p->(X.TakeSelf)(); + // CHECK:STDERR: · ━━━━━┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `const X` to `X` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `const X` does not implement interface `Core.ImplicitAs(X)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: p->(X.TakeSelf)(); } @@ -123,21 +150,48 @@ interface J {} // type. The operand of `const` is parenthesized if it's a facet type formed // with `&` or `where`. fn F() -> const (I & J); -// CHECK:STDERR: fail_print_const_facet_type.carbon:[[@LINE+3]]:1-13: error: function redeclaration differs because return type is `{}` [FunctionRedeclReturnTypeDiffers] -// CHECK:STDERR: fail_print_const_facet_type.carbon:[[@LINE-2]]:1-24: note: previously declared with return type `const (I & J)` [FunctionRedeclReturnTypePrevious] +// CHECK:STDERR: ╭─┤ fail_print_const_facet_type.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: │ fn F() -> const (I & J); +// CHECK:STDERR: · ────────────┬─────────── +// CHECK:STDERR: · ╰──┤ previously declared with return type `const (I & J)` +// CHECK:STDERR: · │ [FunctionRedeclReturnTypePrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn F() -> {}; +// CHECK:STDERR: · ━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: function redeclaration differs because return type is `{}` +// CHECK:STDERR: · ┃ [FunctionRedeclReturnTypeDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F() -> {}; fn G() -> const (I where .T = ()); -// CHECK:STDERR: fail_print_const_facet_type.carbon:[[@LINE+3]]:1-13: error: function redeclaration differs because return type is `{}` [FunctionRedeclReturnTypeDiffers] -// CHECK:STDERR: fail_print_const_facet_type.carbon:[[@LINE-2]]:1-34: note: previously declared with return type `const (I where .(I.T) = ())` [FunctionRedeclReturnTypePrevious] +// CHECK:STDERR: ╭─┤ fail_print_const_facet_type.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: │ fn G() -> const (I where .T = ()); +// CHECK:STDERR: · ─────────┬──────────────────────── +// CHECK:STDERR: · ╰──┤ previously declared with return type `const (I where .(I.T) = ())` +// CHECK:STDERR: · │ [FunctionRedeclReturnTypePrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn G() -> {}; +// CHECK:STDERR: · ━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: function redeclaration differs because return type is `{}` +// CHECK:STDERR: · ┃ [FunctionRedeclReturnTypeDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn G() -> {}; // No parentheses are needed for a single interface. fn H() -> const I; -// CHECK:STDERR: fail_print_const_facet_type.carbon:[[@LINE+3]]:1-13: error: function redeclaration differs because return type is `{}` [FunctionRedeclReturnTypeDiffers] -// CHECK:STDERR: fail_print_const_facet_type.carbon:[[@LINE-2]]:1-18: note: previously declared with return type `const I` [FunctionRedeclReturnTypePrevious] +// CHECK:STDERR: ╭─┤ fail_print_const_facet_type.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: │ fn H() -> const I; +// CHECK:STDERR: · ─────────┬──────── +// CHECK:STDERR: · ╰──┤ previously declared with return type `const I` +// CHECK:STDERR: · │ [FunctionRedeclReturnTypePrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn H() -> {}; +// CHECK:STDERR: · ━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: function redeclaration differs because return type is `{}` +// CHECK:STDERR: · ┃ [FunctionRedeclReturnTypeDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn H() -> {}; @@ -309,20 +363,20 @@ fn H() -> {}; // CHECK:STDOUT: %p.param_patt: %pattern_type.803 = value_param_pattern [concrete = constants.%p.param_patt] // CHECK:STDOUT: %p.patt: %pattern_type.803 = wrapper_binding_pattern p, %p.param_patt [concrete = constants.%p.patt] // CHECK:STDOUT: %return.param_patt: %pattern_type.803 = out_param_pattern [concrete = constants.%return.param_patt.934] -// CHECK:STDOUT: %return.patt: %pattern_type.803 = return_slot_pattern %return.param_patt, %ptr.loc9_39 [concrete = constants.%return.patt.895] +// CHECK:STDOUT: %return.patt: %pattern_type.803 = return_slot_pattern %return.param_patt, %ptr.loc15_39 [concrete = constants.%return.patt.895] // CHECK:STDOUT: } { -// CHECK:STDOUT: %C.ref.loc9_36: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %const.loc9_30: type = const_type %C.ref.loc9_36 [concrete = constants.%const.13f] -// CHECK:STDOUT: %const.loc9_23: type = const_type %const.loc9_30 [concrete = constants.%const.13f] -// CHECK:STDOUT: %ptr.loc9_38: type = ptr_type %const.loc9_23 [concrete = constants.%ptr.77f] -// CHECK:STDOUT: %ptr.loc9_39: type = ptr_type %ptr.loc9_38 [concrete = constants.%ptr.0c8] -// CHECK:STDOUT: %.loc9_39: Core.Form = init_form %ptr.loc9_39 [concrete = constants.%.5f5] +// CHECK:STDOUT: %C.ref.loc15_36: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %const.loc15_30: type = const_type %C.ref.loc15_36 [concrete = constants.%const.13f] +// CHECK:STDOUT: %const.loc15_23: type = const_type %const.loc15_30 [concrete = constants.%const.13f] +// CHECK:STDOUT: %ptr.loc15_38: type = ptr_type %const.loc15_23 [concrete = constants.%ptr.77f] +// CHECK:STDOUT: %ptr.loc15_39: type = ptr_type %ptr.loc15_38 [concrete = constants.%ptr.0c8] +// CHECK:STDOUT: %.loc15_39: Core.Form = init_form %ptr.loc15_39 [concrete = constants.%.5f5] // CHECK:STDOUT: %p.param: %ptr.0c8 = value_param call_param0 -// CHECK:STDOUT: %.loc9_17: type = splice_block %ptr.loc9_17 [concrete = constants.%ptr.0c8] { -// CHECK:STDOUT: %C.ref.loc9_15: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %const.loc9_9: type = const_type %C.ref.loc9_15 [concrete = constants.%const.13f] -// CHECK:STDOUT: %ptr.loc9_16: type = ptr_type %const.loc9_9 [concrete = constants.%ptr.77f] -// CHECK:STDOUT: %ptr.loc9_17: type = ptr_type %ptr.loc9_16 [concrete = constants.%ptr.0c8] +// CHECK:STDOUT: %.loc15_17: type = splice_block %ptr.loc15_17 [concrete = constants.%ptr.0c8] { +// CHECK:STDOUT: %C.ref.loc15_15: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %const.loc15_9: type = const_type %C.ref.loc15_15 [concrete = constants.%const.13f] +// CHECK:STDOUT: %ptr.loc15_16: type = ptr_type %const.loc15_9 [concrete = constants.%ptr.77f] +// CHECK:STDOUT: %ptr.loc15_17: type = ptr_type %ptr.loc15_16 [concrete = constants.%ptr.0c8] // CHECK:STDOUT: } // CHECK:STDOUT: %p: %ptr.0c8 = wrapper_binding p, %p.param // CHECK:STDOUT: %return.param: ref %ptr.0c8 = out_param call_param1 @@ -334,10 +388,10 @@ fn H() -> {}; // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: %ptr.0c8 = name_ref p, %p // CHECK:STDOUT: %impl.elem0: %.a9c = impl_witness_access constants.%Copy.impl_witness.9f0, element0 [concrete = constants.%ptr.as.Copy.impl.Op.e7f] -// CHECK:STDOUT: %bound_method.loc10_10.1: = bound_method %p.ref, %impl.elem0 +// CHECK:STDOUT: %bound_method.loc16_10.1: = bound_method %p.ref, %impl.elem0 // CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @ptr.as.Copy.impl.Op(constants.%ptr.77f) [concrete = constants.%ptr.as.Copy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc10_10.2: = bound_method %p.ref, %specific_fn -// CHECK:STDOUT: %ptr.as.Copy.impl.Op.call: init %ptr.0c8 = call %bound_method.loc10_10.2(%p.ref) +// CHECK:STDOUT: %bound_method.loc16_10.2: = bound_method %p.ref, %specific_fn +// CHECK:STDOUT: %ptr.as.Copy.impl.Op.call: init %ptr.0c8 = call %bound_method.loc16_10.2(%p.ref) // CHECK:STDOUT: return %ptr.as.Copy.impl.Op.call // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/deduce/array.carbon b/toolchain/check/testdata/deduce/array.carbon index 39882f08c867..7531f5227d68 100644 --- a/toolchain/check/testdata/deduce/array.carbon +++ b/toolchain/check/testdata/deduce/array.carbon @@ -62,9 +62,21 @@ fn F[T: type](a: array(T, 2)) -> T { return F(a); } fn G() -> C { // TODO: We succeed at deducing T here but fail to convert. Is this the right behavior? var a: array(C, 3) = ({}, {}, {}); - // CHECK:STDERR: fail_bound_mismatch.carbon:[[@LINE+4]]:12: error: cannot implicitly convert expression of type `array(C, 3)` to `array(C, 2)` [ConversionFailure] - // CHECK:STDERR: fail_bound_mismatch.carbon:[[@LINE+3]]:12: note: type `array(C, 3)` does not implement interface `Core.ImplicitAs(array(C, 2))` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: fail_bound_mismatch.carbon:[[@LINE-7]]:15-28: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_bound_mismatch.carbon:[[@LINE+16]]:12 + // CHECK:STDERR: │ fn F[T: type](a: array(T, 2)) -> T { return F(a); } + // CHECK:STDERR: · ───────┬────── + // CHECK:STDERR: · ╰──┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ return F(a); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type + // CHECK:STDERR: · │ ┃ `array(C, 3)` to `array(C, 2)` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `array(C, 3)` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(array(C, 2))` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return F(a); } @@ -81,9 +93,21 @@ fn F[N: Core.IntLiteral](unused a: array(C, N)) -> i32 { return N; } fn G() -> i32 { // TODO: We succeed at deducing N here but fail to convert. Is this the right behavior? var a: array(D, 3) = ({}, {}, {}); - // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+4]]:12: error: cannot implicitly convert expression of type `array(D, 3)` to `array(C, 3)` [ConversionFailure] - // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+3]]:12: note: type `array(D, 3)` does not implement interface `Core.ImplicitAs(array(C, 3))` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE-7]]:33-46: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_type_mismatch.carbon:[[@LINE+16]]:12 + // CHECK:STDERR: │ fn F[N: Core.IntLiteral](unused a: array(C, N)) -> i32 { return N; } + // CHECK:STDERR: · ───────┬────── + // CHECK:STDERR: · ╰──┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ return F(a); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type + // CHECK:STDERR: · │ ┃ `array(D, 3)` to `array(C, 3)` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `array(D, 3)` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(array(C, 3))` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return F(a); } @@ -103,8 +127,17 @@ fn G() -> i32 { // which we can't deduce through. We should decide if we want to support // deductions of that form. If not, it'd be nice to diagnose this situation // better. - // CHECK:STDERR: fail_bound_type_mismatch.carbon:[[@LINE+3]]:10-13: error: cannot deduce value for generic parameter `N` [DeductionIncomplete] - // CHECK:STDERR: fail_bound_type_mismatch.carbon:[[@LINE-10]]:1-44: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_bound_type_mismatch.carbon:[[@LINE+12]]:10 + // CHECK:STDERR: │ fn F[N: i32](unused a: array(C, N)) -> i32 { return N; } + // CHECK:STDERR: · ──────────────────────┬───────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ return F(a); + // CHECK:STDERR: · ━━┳━ + // CHECK:STDERR: · ┗━━┫ error: cannot deduce value for generic parameter `N` + // CHECK:STDERR: · ┃ [DeductionIncomplete] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return F(a); } @@ -119,8 +152,17 @@ fn F[N: i32](unused a: array(C, N)) {} fn G() { // TODO: Deduce N as 3 from the tuple's size. // - // CHECK:STDERR: fail_todo_array_length_from_tuple.carbon:[[@LINE+3]]:3-17: error: cannot deduce value for generic parameter `N` [DeductionIncomplete] - // CHECK:STDERR: fail_todo_array_length_from_tuple.carbon:[[@LINE-6]]:1-37: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_todo_array_length_from_tuple.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn F[N: i32](unused a: array(C, N)) {} + // CHECK:STDERR: · ──────────────────┬────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(({}, {}, {})); + // CHECK:STDERR: · ━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot deduce value for generic parameter `N` + // CHECK:STDERR: · ┃ [DeductionIncomplete] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(({}, {}, {})); } @@ -1156,7 +1198,7 @@ fn G() { // CHECK:STDOUT: %a.ref: ref %Array.96f = name_ref a, %a // CHECK:STDOUT: %F.specific_fn: = specific_function %F.ref, @F(constants.%C) [concrete = constants.%F.specific_fn.c73] // CHECK:STDOUT: %.loc8_11.1: ref %C = splice_block %return.param {} -// CHECK:STDOUT: %.loc15: %Array.ee7 = converted %a.ref, [concrete = ] +// CHECK:STDOUT: %.loc27: %Array.ee7 = converted %a.ref, [concrete = ] // CHECK:STDOUT: %F.call: init %C to %.loc8_11.1 = call %F.specific_fn() // CHECK:STDOUT: %Destroy.facet.loc10_3.1: %Destroy.type = facet_value constants.%Array.96f, (constants.%DestroyImpl.impl_witness.f0d, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.3c2] // CHECK:STDOUT: %.loc10_3.2: %Destroy.type = converted constants.%Array.96f, %Destroy.facet.loc10_3.1 [concrete = constants.%Destroy.facet.3c2] @@ -1474,7 +1516,7 @@ fn G() { // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] // CHECK:STDOUT: %a.ref: ref %Array.f94 = name_ref a, %a // CHECK:STDOUT: %F.specific_fn: = specific_function %F.ref, @F(constants.%int_3.1ba) [concrete = constants.%F.specific_fn] -// CHECK:STDOUT: %.loc16: %Array.96f = converted %a.ref, [concrete = ] +// CHECK:STDOUT: %.loc28: %Array.96f = converted %a.ref, [concrete = ] // CHECK:STDOUT: %F.call: init %i32 = call %F.specific_fn() // CHECK:STDOUT: %Destroy.facet.loc11_3.1: %Destroy.type = facet_value constants.%Array.f94, (constants.%DestroyImpl.impl_witness.b21, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.2c1] // CHECK:STDOUT: %.loc11_3.2: %Destroy.type = converted constants.%Array.f94, %Destroy.facet.loc11_3.1 [concrete = constants.%Destroy.facet.2c1] @@ -1965,10 +2007,10 @@ fn G() { // CHECK:STDOUT: fn @G() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] -// CHECK:STDOUT: %.loc13_7: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc13_11: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc13_15: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc13_16: %tuple.type = tuple_literal (%.loc13_7, %.loc13_11, %.loc13_15) [concrete = constants.%tuple] +// CHECK:STDOUT: %.loc22_7: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc22_11: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc22_15: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc22_16: %tuple.type = tuple_literal (%.loc22_7, %.loc22_11, %.loc22_15) [concrete = constants.%tuple] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/deduce/binding_pattern.carbon b/toolchain/check/testdata/deduce/binding_pattern.carbon index 9bf712bb7e18..83664ab3086e 100644 --- a/toolchain/check/testdata/deduce/binding_pattern.carbon +++ b/toolchain/check/testdata/deduce/binding_pattern.carbon @@ -19,9 +19,20 @@ class C(T: type) { } fn F(unused generic U: type, generic V: type) { - // CHECK:STDERR: fail_incompatible_deduce.carbon:[[@LINE+4]]:15-16: error: cannot implicitly convert expression of type `{}` to `V` [ConversionFailure] - // CHECK:STDERR: fail_incompatible_deduce.carbon:[[@LINE+3]]:15-16: note: type `{}` does not implement interface `Core.ImplicitAs(V)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: fail_incompatible_deduce.carbon:[[@LINE-6]]:20-27: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_incompatible_deduce.carbon:[[@LINE+15]]:15 + // CHECK:STDERR: │ fn Create(unused value: T) {} + // CHECK:STDERR: · ────┬─── + // CHECK:STDERR: · ╰──┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ C(V).Create({}); + // CHECK:STDERR: · ┳━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `{}` to + // CHECK:STDERR: · │ ┃ `V` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `{}` does not implement interface `Core.ImplicitAs(V)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: C(V).Create({}); } @@ -45,7 +56,11 @@ library "[[@TEST_NAME]]"; class A {}; -// CHECK:STDERR: fail_invalid_type.carbon:[[@LINE+2]]:9-20: error: name `DoesNotExist` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_invalid_type.carbon:[[@LINE+6]]:9 +// CHECK:STDERR: -> │ fn F[T: DoesNotExist](unused x: T) {} +// CHECK:STDERR: · ━━━━━━┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: name `DoesNotExist` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F[T: DoesNotExist](unused x: T) {} diff --git a/toolchain/check/testdata/deduce/symbolic_facets.carbon b/toolchain/check/testdata/deduce/symbolic_facets.carbon index 7cc1be5ec779..7138266567e0 100644 --- a/toolchain/check/testdata/deduce/symbolic_facets.carbon +++ b/toolchain/check/testdata/deduce/symbolic_facets.carbon @@ -29,8 +29,18 @@ class D(DD: type) { // T only implements D(DD).B, so should not convert to a facet value // implementing C(()).A. // - // CHECK:STDERR: fail_missing_interface.carbon:[[@LINE+3]]:5-14: error: cannot convert type `T` that implements `B` into type implementing `A` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_missing_interface.carbon:[[@LINE-10]]:3-29: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_missing_interface.carbon:[[@LINE+13]]:5 + // CHECK:STDERR: │ fn F(unused generic T: A) {} + // CHECK:STDERR: · ─────────────┬───────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ C(()).F(T); + // CHECK:STDERR: · ┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `T` that implements `B` into type + // CHECK:STDERR: · ┃ implementing `A` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: C(()).F(T); } @@ -50,8 +60,18 @@ class D(DD: type) { // T implements C({}).A and D(DD).B, so should not convert to a facet value // implementing C(()).A. // - // CHECK:STDERR: fail_interface_wrong_generic_param.carbon:[[@LINE+3]]:5-14: error: cannot convert type `T` that implements `A & B` into type implementing `A` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_interface_wrong_generic_param.carbon:[[@LINE-10]]:3-29: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_interface_wrong_generic_param.carbon:[[@LINE+13]]:5 + // CHECK:STDERR: │ fn F(unused generic T: A) {} + // CHECK:STDERR: · ─────────────┬───────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ C(()).F(T); + // CHECK:STDERR: · ┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `T` that implements `A & B` into type + // CHECK:STDERR: · ┃ implementing `A` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: C(()).F(T); } diff --git a/toolchain/check/testdata/deduce/tuple.carbon b/toolchain/check/testdata/deduce/tuple.carbon index 07d619c12b1f..ea67497e3fc2 100644 --- a/toolchain/check/testdata/deduce/tuple.carbon +++ b/toolchain/check/testdata/deduce/tuple.carbon @@ -47,8 +47,17 @@ class D {} fn F[T: type](pair: (T, T)) -> T; fn G(pair: (C, D)) -> D { - // CHECK:STDERR: fail_inconsistent.carbon:[[@LINE+3]]:10-16: error: inconsistent deductions for value of generic parameter `T` [DeductionInconsistent] - // CHECK:STDERR: fail_inconsistent.carbon:[[@LINE-4]]:1-33: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_inconsistent.carbon:[[@LINE+12]]:10 + // CHECK:STDERR: │ fn F[T: type](pair: (T, T)) -> T; + // CHECK:STDERR: · ────────────────┬──────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ return F(pair); + // CHECK:STDERR: · ━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: inconsistent deductions for value of generic parameter `T` + // CHECK:STDERR: · ┃ [DeductionInconsistent] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return F(pair); } diff --git a/toolchain/check/testdata/deduce/type_operator.carbon b/toolchain/check/testdata/deduce/type_operator.carbon index ce32657073d2..d5e8b397844e 100644 --- a/toolchain/check/testdata/deduce/type_operator.carbon +++ b/toolchain/check/testdata/deduce/type_operator.carbon @@ -57,8 +57,17 @@ class C {} fn F[T: type](p: const T*) -> T { return F(p); } fn G(p: C*) -> const C { - // CHECK:STDERR: fail_const_from_nonconst.carbon:[[@LINE+3]]:10-13: error: cannot deduce value for generic parameter `T` [DeductionIncomplete] - // CHECK:STDERR: fail_const_from_nonconst.carbon:[[@LINE-4]]:1-33: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_const_from_nonconst.carbon:[[@LINE+12]]:10 + // CHECK:STDERR: │ fn F[T: type](p: const T*) -> T { return F(p); } + // CHECK:STDERR: · ────────────────┬──────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ return F(p); + // CHECK:STDERR: · ━━┳━ + // CHECK:STDERR: · ┗━━┫ error: cannot deduce value for generic parameter `T` + // CHECK:STDERR: · ┃ [DeductionIncomplete] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return F(p); } diff --git a/toolchain/check/testdata/deduce/value_with_type_through_access.carbon b/toolchain/check/testdata/deduce/value_with_type_through_access.carbon index 74093a35b01c..3b0b8ae962fe 100644 --- a/toolchain/check/testdata/deduce/value_with_type_through_access.carbon +++ b/toolchain/check/testdata/deduce/value_with_type_through_access.carbon @@ -61,7 +61,13 @@ class HoldsType(T: Class) {} // should be able to eval to a type. We would expect the `.` in `T.t` to be a // ClassElementAccess but it is an AcquireValue, which has a runtime value. // -// CHECK:STDERR: fail_todo_class_access.carbon:[[@LINE+2]]:50-52: error: cannot evaluate type expression [TypeExprEvaluationFailure] +// CHECK:STDERR: ╭─┤ fail_todo_class_access.carbon:[[@LINE+8]]:50 +// CHECK:STDERR: -> │ fn F[T: Class](unused x: HoldsType(T), unused a: T.t) {} +// CHECK:STDERR: · ┳━━ +// CHECK:STDERR: · ┗━━┫ error: cannot evaluate +// CHECK:STDERR: · ┃ type expression +// CHECK:STDERR: · ┃ [TypeExprEvaluationFailure] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F[T: Class](unused x: HoldsType(T), unused a: T.t) {} @@ -83,7 +89,15 @@ class HoldsType(T: array(type, 1)) {} // `a` is received as a value, and has a type that requires going through // ArrayIndex. Building the value representation must handle this indirection. -// CHECK:STDERR: fail_todo_array_index.carbon:[[@LINE+2]]:59-62: error: cannot evaluate type expression [TypeExprEvaluationFailure] +// CHECK:STDERR: ╭─┤ fail_todo_array_index.carbon:[[@LINE+10]]:59 +// CHECK:STDERR: -> │ fn F[T: array(type, 1)](unused x: HoldsType(T), unused a: T[0]) {} +// CHECK:STDERR: · ┳━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot +// CHECK:STDERR: · ┃ evaluate +// CHECK:STDERR: · ┃ type +// CHECK:STDERR: · ┃ expression +// CHECK:STDERR: · ┃ [TypeExprEvaluationFailure] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F[T: array(type, 1)](unused x: HoldsType(T), unused a: T[0]) {} @@ -675,14 +689,14 @@ fn G() { // CHECK:STDOUT: %T.09f: %SubobjectDestroy.type = symbolic_binding T, 0 [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.type.dea: type = fn_type @T.as_type.as.DestroyImpl.impl.Op, @T.as_type.as.DestroyImpl.impl(%T.09f) [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.6e5: %T.as_type.as.DestroyImpl.impl.Op.type.dea = struct_value () [symbolic] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.1: type = fn_type @SubobjectDestroy.WithSelf.Op.loc28_13.1 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.1: type = fn_type @SubobjectDestroy.WithSelf.Op.loc34_13.1 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.1: %SubobjectDestroy.WithSelf.Op.type.6870fd.1 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80ef6.1: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.1), @SubobjectDestroy [concrete] // CHECK:STDOUT: %SubobjectDestroy.facet.1f5: %SubobjectDestroy.type = facet_value type, (%custom_witness.b80ef6.1) [concrete] // CHECK:STDOUT: %DestroyImpl.impl_witness.a54: = impl_witness imports.%DestroyImpl.impl_witness_table, @T.as_type.as.DestroyImpl.impl(%SubobjectDestroy.facet.1f5) [concrete] // CHECK:STDOUT: %Destroy.facet.029: %Destroy.type = facet_value type, (%DestroyImpl.impl_witness.a54, %custom_witness.b80ef6.1) [concrete] // CHECK:STDOUT: %SelfDestruct.specific_fn.fe0: = specific_function %SelfDestruct, @SelfDestruct(%Destroy.facet.029) [concrete] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.3: type = fn_type @SubobjectDestroy.WithSelf.Op.loc28_13.3 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.3: type = fn_type @SubobjectDestroy.WithSelf.Op.loc34_13.3 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.3: %SubobjectDestroy.WithSelf.Op.type.6870fd.3 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80ef6.3: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.3), @SubobjectDestroy [concrete] // CHECK:STDOUT: %SubobjectDestroy.facet.3a1: %SubobjectDestroy.type = facet_value %Class, (%custom_witness.b80ef6.3) [concrete] @@ -730,42 +744,42 @@ fn G() { // CHECK:STDOUT: %T.loc8_18.2: %Class = symbolic_binding T, 0 [symbolic = %T.loc8_18.1 (constants.%T.f25)] // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] { -// CHECK:STDOUT: %T.patt.loc19_7.1: %pattern_type.f15 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc19_7.2 (constants.%T.patt.125)] -// CHECK:STDOUT: %x.param_patt.loc19_24.1: @F.%pattern_type (%pattern_type.d63) = value_param_pattern [symbolic = %x.param_patt.loc19_24.2 (constants.%x.param_patt)] -// CHECK:STDOUT: %x.patt.loc19_24.1: @F.%pattern_type (%pattern_type.d63) = wrapper_binding_pattern x, %x.param_patt.loc19_24.1 [symbolic = %x.patt.loc19_24.2 (constants.%x.patt)] +// CHECK:STDOUT: %T.patt.loc25_7.1: %pattern_type.f15 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc25_7.2 (constants.%T.patt.125)] +// CHECK:STDOUT: %x.param_patt.loc25_24.1: @F.%pattern_type (%pattern_type.d63) = value_param_pattern [symbolic = %x.param_patt.loc25_24.2 (constants.%x.param_patt)] +// CHECK:STDOUT: %x.patt.loc25_24.1: @F.%pattern_type (%pattern_type.d63) = wrapper_binding_pattern x, %x.param_patt.loc25_24.1 [symbolic = %x.patt.loc25_24.2 (constants.%x.patt)] // CHECK:STDOUT: %a.param_patt: = value_param_pattern [concrete = ] // CHECK:STDOUT: %a.patt: = wrapper_binding_pattern a, %a.param_patt [concrete = ] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc19_9: type = splice_block %Class.ref [concrete = constants.%Class] { +// CHECK:STDOUT: %.loc25_9: type = splice_block %Class.ref [concrete = constants.%Class] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [concrete = constants.%Class] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc19_7.2: %Class = symbolic_binding T, 0 [symbolic = %T.loc19_7.1 (constants.%T.f25)] -// CHECK:STDOUT: %x.param: @F.%HoldsType.loc19_37.1 (%HoldsType.ef239b.1) = value_param call_param0 -// CHECK:STDOUT: %.loc19_37: type = splice_block %HoldsType.loc19_37.2 [symbolic = %HoldsType.loc19_37.1 (constants.%HoldsType.ef239b.1)] { +// CHECK:STDOUT: %T.loc25_7.2: %Class = symbolic_binding T, 0 [symbolic = %T.loc25_7.1 (constants.%T.f25)] +// CHECK:STDOUT: %x.param: @F.%HoldsType.loc25_37.1 (%HoldsType.ef239b.1) = value_param call_param0 +// CHECK:STDOUT: %.loc25_37: type = splice_block %HoldsType.loc25_37.2 [symbolic = %HoldsType.loc25_37.1 (constants.%HoldsType.ef239b.1)] { // CHECK:STDOUT: %HoldsType.ref: %HoldsType.type = name_ref HoldsType, file.%HoldsType.decl [concrete = constants.%HoldsType.generic] -// CHECK:STDOUT: %T.ref.loc19_36: %Class = name_ref T, %T.loc19_7.2 [symbolic = %T.loc19_7.1 (constants.%T.f25)] -// CHECK:STDOUT: %HoldsType.loc19_37.2: type = class_type @HoldsType, @HoldsType(constants.%T.f25) [symbolic = %HoldsType.loc19_37.1 (constants.%HoldsType.ef239b.1)] +// CHECK:STDOUT: %T.ref.loc25_36: %Class = name_ref T, %T.loc25_7.2 [symbolic = %T.loc25_7.1 (constants.%T.f25)] +// CHECK:STDOUT: %HoldsType.loc25_37.2: type = class_type @HoldsType, @HoldsType(constants.%T.f25) [symbolic = %HoldsType.loc25_37.1 (constants.%HoldsType.ef239b.1)] // CHECK:STDOUT: } -// CHECK:STDOUT: %x: @F.%HoldsType.loc19_37.1 (%HoldsType.ef239b.1) = wrapper_binding x, %x.param +// CHECK:STDOUT: %x: @F.%HoldsType.loc25_37.1 (%HoldsType.ef239b.1) = wrapper_binding x, %x.param // CHECK:STDOUT: %a.param: = value_param call_param1 // CHECK:STDOUT: %.1: = splice_block [concrete = ] { -// CHECK:STDOUT: %T.ref.loc19_50: %Class = name_ref T, %T.loc19_7.2 [symbolic = %T.loc19_7.1 (constants.%T.f25)] +// CHECK:STDOUT: %T.ref.loc25_50: %Class = name_ref T, %T.loc25_7.2 [symbolic = %T.loc25_7.1 (constants.%T.f25)] // CHECK:STDOUT: %t.ref: %Class.elem = name_ref t, @Class.%field_decl [concrete = @Class.%field_decl] -// CHECK:STDOUT: %.loc19_51.2: ref type = class_element_access %T.ref.loc19_50, element0 [symbolic = %.loc19_51.1 (constants.%.9dd)] -// CHECK:STDOUT: %.loc19_51.3: type = acquire_value %.loc19_51.2 +// CHECK:STDOUT: %.loc25_51.2: ref type = class_element_access %T.ref.loc25_50, element0 [symbolic = %.loc25_51.1 (constants.%.9dd)] +// CHECK:STDOUT: %.loc25_51.3: type = acquire_value %.loc25_51.2 // CHECK:STDOUT: } // CHECK:STDOUT: %a: = wrapper_binding a, [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {} // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] { -// CHECK:STDOUT: %c.patt.loc23_15.1: %pattern_type.f15 = symbolic_binding_pattern c, 0 [symbolic = %c.patt.loc23_15.2 (constants.%c.patt)] +// CHECK:STDOUT: %c.patt.loc29_15.1: %pattern_type.f15 = symbolic_binding_pattern c, 0 [symbolic = %c.patt.loc29_15.2 (constants.%c.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc23: type = splice_block %Class.ref [concrete = constants.%Class] { +// CHECK:STDOUT: %.loc29: type = splice_block %Class.ref [concrete = constants.%Class] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [concrete = constants.%Class] // CHECK:STDOUT: } -// CHECK:STDOUT: %c.loc23_15.2: %Class = symbolic_binding c, 0 [symbolic = %c.loc23_15.1 (constants.%c)] +// CHECK:STDOUT: %c.loc29_15.2: %Class = symbolic_binding c, 0 [symbolic = %c.loc29_15.1 (constants.%c)] // CHECK:STDOUT: } // CHECK:STDOUT: %H.decl: %H.type = fn_decl @H [concrete = constants.%H] {} {} // CHECK:STDOUT: } @@ -805,44 +819,44 @@ fn G() { // CHECK:STDOUT: .Self = constants.%C // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @F(%T.loc19_7.2: %Class) { -// CHECK:STDOUT: %T.patt.loc19_7.2: %pattern_type.f15 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc19_7.2 (constants.%T.patt.125)] -// CHECK:STDOUT: %T.loc19_7.1: %Class = symbolic_binding T, 0 [symbolic = %T.loc19_7.1 (constants.%T.f25)] -// CHECK:STDOUT: %HoldsType.loc19_37.1: type = class_type @HoldsType, @HoldsType(%T.loc19_7.1) [symbolic = %HoldsType.loc19_37.1 (constants.%HoldsType.ef239b.1)] -// CHECK:STDOUT: %pattern_type: type = pattern_type %HoldsType.loc19_37.1 [symbolic = %pattern_type (constants.%pattern_type.d63)] -// CHECK:STDOUT: %x.param_patt.loc19_24.2: @F.%pattern_type (%pattern_type.d63) = value_param_pattern [symbolic = %x.param_patt.loc19_24.2 (constants.%x.param_patt)] -// CHECK:STDOUT: %x.patt.loc19_24.2: @F.%pattern_type (%pattern_type.d63) = wrapper_binding_pattern x, %x.param_patt.loc19_24.2 [symbolic = %x.patt.loc19_24.2 (constants.%x.patt)] -// CHECK:STDOUT: %.loc19_51.1: ref type = class_element_access %T.loc19_7.1, element0 [symbolic = %.loc19_51.1 (constants.%.9dd)] +// CHECK:STDOUT: generic fn @F(%T.loc25_7.2: %Class) { +// CHECK:STDOUT: %T.patt.loc25_7.2: %pattern_type.f15 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc25_7.2 (constants.%T.patt.125)] +// CHECK:STDOUT: %T.loc25_7.1: %Class = symbolic_binding T, 0 [symbolic = %T.loc25_7.1 (constants.%T.f25)] +// CHECK:STDOUT: %HoldsType.loc25_37.1: type = class_type @HoldsType, @HoldsType(%T.loc25_7.1) [symbolic = %HoldsType.loc25_37.1 (constants.%HoldsType.ef239b.1)] +// CHECK:STDOUT: %pattern_type: type = pattern_type %HoldsType.loc25_37.1 [symbolic = %pattern_type (constants.%pattern_type.d63)] +// CHECK:STDOUT: %x.param_patt.loc25_24.2: @F.%pattern_type (%pattern_type.d63) = value_param_pattern [symbolic = %x.param_patt.loc25_24.2 (constants.%x.param_patt)] +// CHECK:STDOUT: %x.patt.loc25_24.2: @F.%pattern_type (%pattern_type.d63) = wrapper_binding_pattern x, %x.param_patt.loc25_24.2 [symbolic = %x.patt.loc25_24.2 (constants.%x.patt)] +// CHECK:STDOUT: %.loc25_51.1: ref type = class_element_access %T.loc25_7.1, element0 [symbolic = %.loc25_51.1 (constants.%.9dd)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type %HoldsType.loc19_37.1 [symbolic = %require_complete (constants.%require_complete.8b59ba.1)] +// CHECK:STDOUT: %require_complete: = require_complete_type %HoldsType.loc25_37.1 [symbolic = %require_complete (constants.%require_complete.8b59ba.1)] // CHECK:STDOUT: -// CHECK:STDOUT: fn(%x.param: @F.%HoldsType.loc19_37.1 (%HoldsType.ef239b.1), %a.param: ) { +// CHECK:STDOUT: fn(%x.param: @F.%HoldsType.loc25_37.1 (%HoldsType.ef239b.1), %a.param: ) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @G(%c.loc23_15.2: %Class) { -// CHECK:STDOUT: %c.patt.loc23_15.2: %pattern_type.f15 = symbolic_binding_pattern c, 0 [symbolic = %c.patt.loc23_15.2 (constants.%c.patt)] -// CHECK:STDOUT: %c.loc23_15.1: %Class = symbolic_binding c, 0 [symbolic = %c.loc23_15.1 (constants.%c)] +// CHECK:STDOUT: generic fn @G(%c.loc29_15.2: %Class) { +// CHECK:STDOUT: %c.patt.loc29_15.2: %pattern_type.f15 = symbolic_binding_pattern c, 0 [symbolic = %c.patt.loc29_15.2 (constants.%c.patt)] +// CHECK:STDOUT: %c.loc29_15.1: %Class = symbolic_binding c, 0 [symbolic = %c.loc29_15.1 (constants.%c)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %HoldsType.loc24_22.2: type = class_type @HoldsType, @HoldsType(%c.loc23_15.1) [symbolic = %HoldsType.loc24_22.2 (constants.%HoldsType.ef239b.2)] -// CHECK:STDOUT: %require_complete: = require_complete_type %HoldsType.loc24_22.2 [symbolic = %require_complete (constants.%require_complete.8b59ba.2)] -// CHECK:STDOUT: %HoldsType.val: @G.%HoldsType.loc24_22.2 (%HoldsType.ef239b.2) = struct_value () [symbolic = %HoldsType.val (constants.%HoldsType.val.16e)] +// CHECK:STDOUT: %HoldsType.loc30_22.2: type = class_type @HoldsType, @HoldsType(%c.loc29_15.1) [symbolic = %HoldsType.loc30_22.2 (constants.%HoldsType.ef239b.2)] +// CHECK:STDOUT: %require_complete: = require_complete_type %HoldsType.loc30_22.2 [symbolic = %require_complete (constants.%require_complete.8b59ba.2)] +// CHECK:STDOUT: %HoldsType.val: @G.%HoldsType.loc30_22.2 (%HoldsType.ef239b.2) = struct_value () [symbolic = %HoldsType.val (constants.%HoldsType.val.16e)] // CHECK:STDOUT: // CHECK:STDOUT: fn() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] -// CHECK:STDOUT: %.loc24_6.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc30_6.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] // CHECK:STDOUT: %HoldsType.ref: %HoldsType.type = name_ref HoldsType, file.%HoldsType.decl [concrete = constants.%HoldsType.generic] -// CHECK:STDOUT: %c.ref: %Class = name_ref c, %c.loc23_15.2 [symbolic = %c.loc23_15.1 (constants.%c)] -// CHECK:STDOUT: %HoldsType.loc24_22.1: type = class_type @HoldsType, @HoldsType(constants.%c) [symbolic = %HoldsType.loc24_22.2 (constants.%HoldsType.ef239b.2)] -// CHECK:STDOUT: %.loc24_6.2: ref @G.%HoldsType.loc24_22.2 (%HoldsType.ef239b.2) = temporary_storage -// CHECK:STDOUT: %.loc24_6.3: init @G.%HoldsType.loc24_22.2 (%HoldsType.ef239b.2) to %.loc24_6.2 = class_init () [symbolic = %HoldsType.val (constants.%HoldsType.val.16e)] -// CHECK:STDOUT: %.loc24_8: init @G.%HoldsType.loc24_22.2 (%HoldsType.ef239b.2) = converted %.loc24_6.1, %.loc24_6.3 [symbolic = %HoldsType.val (constants.%HoldsType.val.16e)] -// CHECK:STDOUT: %.loc24_26: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %c.ref: %Class = name_ref c, %c.loc29_15.2 [symbolic = %c.loc29_15.1 (constants.%c)] +// CHECK:STDOUT: %HoldsType.loc30_22.1: type = class_type @HoldsType, @HoldsType(constants.%c) [symbolic = %HoldsType.loc30_22.2 (constants.%HoldsType.ef239b.2)] +// CHECK:STDOUT: %.loc30_6.2: ref @G.%HoldsType.loc30_22.2 (%HoldsType.ef239b.2) = temporary_storage +// CHECK:STDOUT: %.loc30_6.3: init @G.%HoldsType.loc30_22.2 (%HoldsType.ef239b.2) to %.loc30_6.2 = class_init () [symbolic = %HoldsType.val (constants.%HoldsType.val.16e)] +// CHECK:STDOUT: %.loc30_8: init @G.%HoldsType.loc30_22.2 (%HoldsType.ef239b.2) = converted %.loc30_6.1, %.loc30_6.3 [symbolic = %HoldsType.val (constants.%HoldsType.val.16e)] +// CHECK:STDOUT: %.loc30_26: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -851,52 +865,52 @@ fn G() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %G.ref: %G.type = name_ref G, file.%G.decl [concrete = constants.%G] // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %.loc28_12.1: %struct_type.t = struct_literal (%C.ref) [concrete = constants.%struct] +// CHECK:STDOUT: %.loc34_12.1: %struct_type.t = struct_literal (%C.ref) [concrete = constants.%struct] // CHECK:STDOUT: %impl.elem0: %.cd2 = impl_witness_access constants.%Copy.impl_witness.f3e, element0 [concrete = constants.%type.as.Copy.impl.Op] // CHECK:STDOUT: %bound_method: = bound_method %C.ref, %impl.elem0 [concrete = constants.%type.as.Copy.impl.Op.bound] // CHECK:STDOUT: %type.as.Copy.impl.Op.call: init type = call %bound_method(%C.ref) [concrete = constants.%C] -// CHECK:STDOUT: %.loc28_12.2: ref %Class = temporary_storage -// CHECK:STDOUT: %.loc28_12.3: ref type = class_element_access %.loc28_12.2, element0 -// CHECK:STDOUT: %.loc28_12.4: init type to %.loc28_12.3 = in_place_init %type.as.Copy.impl.Op.call [concrete = constants.%C] -// CHECK:STDOUT: %.loc28_12.5: init %Class to %.loc28_12.2 = class_init (%.loc28_12.4) [concrete = constants.%Class.val] -// CHECK:STDOUT: %.loc28_13.1: init %Class = converted %.loc28_12.1, %.loc28_12.5 [concrete = constants.%Class.val] -// CHECK:STDOUT: %.loc28_13.2: ref %Class = temporary %.loc28_12.2, %.loc28_13.1 [concrete = constants.%.0de] -// CHECK:STDOUT: %.loc28_13.3: %Class = acquire_value %.loc28_13.2 [concrete = constants.%Class.val] +// CHECK:STDOUT: %.loc34_12.2: ref %Class = temporary_storage +// CHECK:STDOUT: %.loc34_12.3: ref type = class_element_access %.loc34_12.2, element0 +// CHECK:STDOUT: %.loc34_12.4: init type to %.loc34_12.3 = in_place_init %type.as.Copy.impl.Op.call [concrete = constants.%C] +// CHECK:STDOUT: %.loc34_12.5: init %Class to %.loc34_12.2 = class_init (%.loc34_12.4) [concrete = constants.%Class.val] +// CHECK:STDOUT: %.loc34_13.1: init %Class = converted %.loc34_12.1, %.loc34_12.5 [concrete = constants.%Class.val] +// CHECK:STDOUT: %.loc34_13.2: ref %Class = temporary %.loc34_12.2, %.loc34_13.1 [concrete = constants.%.0de] +// CHECK:STDOUT: %.loc34_13.3: %Class = acquire_value %.loc34_13.2 [concrete = constants.%Class.val] // CHECK:STDOUT: %G.specific_fn: = specific_function %G.ref, @G(constants.%Class.val) [concrete = constants.%G.specific_fn] // CHECK:STDOUT: %G.call: init %empty_tuple.type = call %G.specific_fn() -// CHECK:STDOUT: %Destroy.facet.loc28_13.1: %Destroy.type = facet_value constants.%Class, (constants.%DestroyImpl.impl_witness.66c, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.728] -// CHECK:STDOUT: %.loc28_13.4: %Destroy.type = converted constants.%Class, %Destroy.facet.loc28_13.1 [concrete = constants.%Destroy.facet.728] -// CHECK:STDOUT: %Destroy.facet.loc28_13.2: %Destroy.type = facet_value constants.%Class, (constants.%DestroyImpl.impl_witness.66c, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.728] -// CHECK:STDOUT: %.loc28_13.5: %Destroy.type = converted constants.%Class, %Destroy.facet.loc28_13.2 [concrete = constants.%Destroy.facet.728] +// CHECK:STDOUT: %Destroy.facet.loc34_13.1: %Destroy.type = facet_value constants.%Class, (constants.%DestroyImpl.impl_witness.66c, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.728] +// CHECK:STDOUT: %.loc34_13.4: %Destroy.type = converted constants.%Class, %Destroy.facet.loc34_13.1 [concrete = constants.%Destroy.facet.728] +// CHECK:STDOUT: %Destroy.facet.loc34_13.2: %Destroy.type = facet_value constants.%Class, (constants.%DestroyImpl.impl_witness.66c, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.728] +// CHECK:STDOUT: %.loc34_13.5: %Destroy.type = converted constants.%Class, %Destroy.facet.loc34_13.2 [concrete = constants.%Destroy.facet.728] // CHECK:STDOUT: %SelfDestruct.specific_fn: = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet.728) [concrete = constants.%SelfDestruct.specific_fn.744] -// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc28_13.2) +// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc34_13.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc28_13.1(%self.param: ref type) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc34_13.1(%self.param: ref type) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc28_13.2(%self.param: ref %struct_type.t) { +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc34_13.2(%self.param: ref %struct_type.t) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc28_13.1: ref type = struct_access %self.param, element0 -// CHECK:STDOUT: %Destroy.facet.loc28_13.1: %Destroy.type = facet_value type, (constants.%DestroyImpl.impl_witness.a54, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.029] -// CHECK:STDOUT: %.loc28_13.2: %Destroy.type = converted type, %Destroy.facet.loc28_13.1 [concrete = constants.%Destroy.facet.029] -// CHECK:STDOUT: %Destroy.facet.loc28_13.2: %Destroy.type = facet_value type, (constants.%DestroyImpl.impl_witness.a54, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.029] -// CHECK:STDOUT: %.loc28_13.3: %Destroy.type = converted type, %Destroy.facet.loc28_13.2 [concrete = constants.%Destroy.facet.029] +// CHECK:STDOUT: %.loc34_13.1: ref type = struct_access %self.param, element0 +// CHECK:STDOUT: %Destroy.facet.loc34_13.1: %Destroy.type = facet_value type, (constants.%DestroyImpl.impl_witness.a54, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.029] +// CHECK:STDOUT: %.loc34_13.2: %Destroy.type = converted type, %Destroy.facet.loc34_13.1 [concrete = constants.%Destroy.facet.029] +// CHECK:STDOUT: %Destroy.facet.loc34_13.2: %Destroy.type = facet_value type, (constants.%DestroyImpl.impl_witness.a54, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.029] +// CHECK:STDOUT: %.loc34_13.3: %Destroy.type = converted type, %Destroy.facet.loc34_13.2 [concrete = constants.%Destroy.facet.029] // CHECK:STDOUT: %SelfDestruct.specific_fn: = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet.029) [concrete = constants.%SelfDestruct.specific_fn.fe0] -// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc28_13.1) +// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc34_13.1) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc28_13.3(%self.param: ref %Class) { +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc34_13.3(%self.param: ref %Class) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %t.ref: %Class.elem = name_ref t, @Class.%field_decl [concrete = @Class.%field_decl] -// CHECK:STDOUT: %.loc28_13.1: ref type = class_element_access %self.param, element0 -// CHECK:STDOUT: %Destroy.facet.loc28_13.1: %Destroy.type = facet_value type, (constants.%DestroyImpl.impl_witness.a54, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.029] -// CHECK:STDOUT: %.loc28_13.2: %Destroy.type = converted type, %Destroy.facet.loc28_13.1 [concrete = constants.%Destroy.facet.029] -// CHECK:STDOUT: %Destroy.facet.loc28_13.2: %Destroy.type = facet_value type, (constants.%DestroyImpl.impl_witness.a54, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.029] -// CHECK:STDOUT: %.loc28_13.3: %Destroy.type = converted type, %Destroy.facet.loc28_13.2 [concrete = constants.%Destroy.facet.029] +// CHECK:STDOUT: %.loc34_13.1: ref type = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.facet.loc34_13.1: %Destroy.type = facet_value type, (constants.%DestroyImpl.impl_witness.a54, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.029] +// CHECK:STDOUT: %.loc34_13.2: %Destroy.type = converted type, %Destroy.facet.loc34_13.1 [concrete = constants.%Destroy.facet.029] +// CHECK:STDOUT: %Destroy.facet.loc34_13.2: %Destroy.type = facet_value type, (constants.%DestroyImpl.impl_witness.a54, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.029] +// CHECK:STDOUT: %.loc34_13.3: %Destroy.type = converted type, %Destroy.facet.loc34_13.2 [concrete = constants.%Destroy.facet.029] // CHECK:STDOUT: %SelfDestruct.specific_fn: = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet.029) [concrete = constants.%SelfDestruct.specific_fn.fe0] -// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc28_13.1) +// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc34_13.1) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -908,18 +922,18 @@ fn G() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @F(constants.%T.f25) { -// CHECK:STDOUT: %T.patt.loc19_7.2 => constants.%T.patt.125 -// CHECK:STDOUT: %T.loc19_7.1 => constants.%T.f25 -// CHECK:STDOUT: %HoldsType.loc19_37.1 => constants.%HoldsType.ef239b.1 +// CHECK:STDOUT: %T.patt.loc25_7.2 => constants.%T.patt.125 +// CHECK:STDOUT: %T.loc25_7.1 => constants.%T.f25 +// CHECK:STDOUT: %HoldsType.loc25_37.1 => constants.%HoldsType.ef239b.1 // CHECK:STDOUT: %pattern_type => constants.%pattern_type.d63 -// CHECK:STDOUT: %x.param_patt.loc19_24.2 => constants.%x.param_patt -// CHECK:STDOUT: %x.patt.loc19_24.2 => constants.%x.patt -// CHECK:STDOUT: %.loc19_51.1 => constants.%.9dd +// CHECK:STDOUT: %x.param_patt.loc25_24.2 => constants.%x.param_patt +// CHECK:STDOUT: %x.patt.loc25_24.2 => constants.%x.patt +// CHECK:STDOUT: %.loc25_51.1 => constants.%.9dd // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @G(constants.%c) { -// CHECK:STDOUT: %c.patt.loc23_15.2 => constants.%c.patt -// CHECK:STDOUT: %c.loc23_15.1 => constants.%c +// CHECK:STDOUT: %c.patt.loc29_15.2 => constants.%c.patt +// CHECK:STDOUT: %c.loc29_15.1 => constants.%c // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @HoldsType(constants.%c) { @@ -930,11 +944,11 @@ fn G() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @G(constants.%Class.val) { -// CHECK:STDOUT: %c.patt.loc23_15.2 => constants.%c.patt -// CHECK:STDOUT: %c.loc23_15.1 => constants.%Class.val +// CHECK:STDOUT: %c.patt.loc29_15.2 => constants.%c.patt +// CHECK:STDOUT: %c.loc29_15.1 => constants.%Class.val // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %HoldsType.loc24_22.2 => constants.%HoldsType.ddc +// CHECK:STDOUT: %HoldsType.loc30_22.2 => constants.%HoldsType.ddc // CHECK:STDOUT: %require_complete => constants.%complete_type.357 // CHECK:STDOUT: %HoldsType.val => constants.%HoldsType.val.046 // CHECK:STDOUT: } @@ -1016,7 +1030,7 @@ fn G() { // CHECK:STDOUT: %T.09f: %SubobjectDestroy.type = symbolic_binding T, 0 [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.type.dea: type = fn_type @T.as_type.as.DestroyImpl.impl.Op, @T.as_type.as.DestroyImpl.impl(%T.09f) [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.6e5: %T.as_type.as.DestroyImpl.impl.Op.type.dea = struct_value () [symbolic] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.687: type = fn_type @SubobjectDestroy.WithSelf.Op.loc15 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.687: type = fn_type @SubobjectDestroy.WithSelf.Op.loc23 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f: %SubobjectDestroy.WithSelf.Op.type.687 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f), @SubobjectDestroy [concrete] // CHECK:STDOUT: %SubobjectDestroy.facet.edc: %SubobjectDestroy.type = facet_value %Array.612, (%custom_witness.b80) [concrete] @@ -1069,40 +1083,40 @@ fn G() { // CHECK:STDOUT: %T.loc4_18.2: %Array.612 = symbolic_binding T, 0 [symbolic = %T.loc4_18.1 (constants.%T.6be)] // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] { -// CHECK:STDOUT: %T.patt.loc10_7.1: %pattern_type.809 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc10_7.2 (constants.%T.patt.bb1)] -// CHECK:STDOUT: %x.param_patt.loc10_33.1: @F.%pattern_type (%pattern_type.dc7) = value_param_pattern [symbolic = %x.param_patt.loc10_33.2 (constants.%x.param_patt)] -// CHECK:STDOUT: %x.patt.loc10_33.1: @F.%pattern_type (%pattern_type.dc7) = wrapper_binding_pattern x, %x.param_patt.loc10_33.1 [symbolic = %x.patt.loc10_33.2 (constants.%x.patt)] +// CHECK:STDOUT: %T.patt.loc18_7.1: %pattern_type.809 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc18_7.2 (constants.%T.patt.bb1)] +// CHECK:STDOUT: %x.param_patt.loc18_33.1: @F.%pattern_type (%pattern_type.dc7) = value_param_pattern [symbolic = %x.param_patt.loc18_33.2 (constants.%x.param_patt)] +// CHECK:STDOUT: %x.patt.loc18_33.1: @F.%pattern_type (%pattern_type.dc7) = wrapper_binding_pattern x, %x.param_patt.loc18_33.1 [symbolic = %x.patt.loc18_33.2 (constants.%x.patt)] // CHECK:STDOUT: %a.param_patt: = value_param_pattern [concrete = ] // CHECK:STDOUT: %a.patt: = wrapper_binding_pattern a, %a.param_patt [concrete = ] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc10_22: type = splice_block %Array [concrete = constants.%Array.612] { +// CHECK:STDOUT: %.loc18_22: type = splice_block %Array [concrete = constants.%Array.612] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc10_15: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc18_15: type = type_literal type [concrete = type] // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] // CHECK:STDOUT: %Array: type = class_type @Array, @Array(type, constants.%int_1) [concrete = constants.%Array.612] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc10_7.2: %Array.612 = symbolic_binding T, 0 [symbolic = %T.loc10_7.1 (constants.%T.6be)] -// CHECK:STDOUT: %x.param: @F.%HoldsType.loc10_46.1 (%HoldsType.9dd) = value_param call_param0 -// CHECK:STDOUT: %.loc10_46: type = splice_block %HoldsType.loc10_46.2 [symbolic = %HoldsType.loc10_46.1 (constants.%HoldsType.9dd)] { +// CHECK:STDOUT: %T.loc18_7.2: %Array.612 = symbolic_binding T, 0 [symbolic = %T.loc18_7.1 (constants.%T.6be)] +// CHECK:STDOUT: %x.param: @F.%HoldsType.loc18_46.1 (%HoldsType.9dd) = value_param call_param0 +// CHECK:STDOUT: %.loc18_46: type = splice_block %HoldsType.loc18_46.2 [symbolic = %HoldsType.loc18_46.1 (constants.%HoldsType.9dd)] { // CHECK:STDOUT: %HoldsType.ref: %HoldsType.type = name_ref HoldsType, file.%HoldsType.decl [concrete = constants.%HoldsType.generic] -// CHECK:STDOUT: %T.ref.loc10_45: %Array.612 = name_ref T, %T.loc10_7.2 [symbolic = %T.loc10_7.1 (constants.%T.6be)] -// CHECK:STDOUT: %HoldsType.loc10_46.2: type = class_type @HoldsType, @HoldsType(constants.%T.6be) [symbolic = %HoldsType.loc10_46.1 (constants.%HoldsType.9dd)] +// CHECK:STDOUT: %T.ref.loc18_45: %Array.612 = name_ref T, %T.loc18_7.2 [symbolic = %T.loc18_7.1 (constants.%T.6be)] +// CHECK:STDOUT: %HoldsType.loc18_46.2: type = class_type @HoldsType, @HoldsType(constants.%T.6be) [symbolic = %HoldsType.loc18_46.1 (constants.%HoldsType.9dd)] // CHECK:STDOUT: } -// CHECK:STDOUT: %x: @F.%HoldsType.loc10_46.1 (%HoldsType.9dd) = wrapper_binding x, %x.param +// CHECK:STDOUT: %x: @F.%HoldsType.loc18_46.1 (%HoldsType.9dd) = wrapper_binding x, %x.param // CHECK:STDOUT: %a.param: = value_param call_param1 // CHECK:STDOUT: %.1: = splice_block [concrete = ] { -// CHECK:STDOUT: %T.ref.loc10_59: %Array.612 = name_ref T, %T.loc10_7.2 [symbolic = %T.loc10_7.1 (constants.%T.6be)] +// CHECK:STDOUT: %T.ref.loc18_59: %Array.612 = name_ref T, %T.loc18_7.2 [symbolic = %T.loc18_7.1 (constants.%T.6be)] // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] // CHECK:STDOUT: %impl.elem0: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc10_61.1: = bound_method %int_0, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %bound_method.loc18_61.1: = bound_method %int_0, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] // CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc10_61.2: = bound_method %int_0, %specific_fn [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc10_61.2(%int_0) [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc10_61.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc10_61.2: %i32 = converted %int_0, %.loc10_61.1 [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc10_62.1: ref %Array.612 = value_as_ref %T.ref.loc10_59 -// CHECK:STDOUT: %.loc10_62.2: ref type = array_index %.loc10_62.1, %.loc10_61.2 -// CHECK:STDOUT: %.loc10_62.3: type = acquire_value %.loc10_62.2 +// CHECK:STDOUT: %bound_method.loc18_61.2: = bound_method %int_0, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc18_61.2(%int_0) [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc18_61.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc18_61.2: %i32 = converted %int_0, %.loc18_61.1 [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc18_62.1: ref %Array.612 = value_as_ref %T.ref.loc18_59 +// CHECK:STDOUT: %.loc18_62.2: ref type = array_index %.loc18_62.1, %.loc18_61.2 +// CHECK:STDOUT: %.loc18_62.3: type = acquire_value %.loc18_62.2 // CHECK:STDOUT: } // CHECK:STDOUT: %a: = wrapper_binding a, [concrete = ] // CHECK:STDOUT: } @@ -1133,18 +1147,18 @@ fn G() { // CHECK:STDOUT: .Self = constants.%C // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @F(%T.loc10_7.2: %Array.612) { -// CHECK:STDOUT: %T.patt.loc10_7.2: %pattern_type.809 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc10_7.2 (constants.%T.patt.bb1)] -// CHECK:STDOUT: %T.loc10_7.1: %Array.612 = symbolic_binding T, 0 [symbolic = %T.loc10_7.1 (constants.%T.6be)] -// CHECK:STDOUT: %HoldsType.loc10_46.1: type = class_type @HoldsType, @HoldsType(%T.loc10_7.1) [symbolic = %HoldsType.loc10_46.1 (constants.%HoldsType.9dd)] -// CHECK:STDOUT: %pattern_type: type = pattern_type %HoldsType.loc10_46.1 [symbolic = %pattern_type (constants.%pattern_type.dc7)] -// CHECK:STDOUT: %x.param_patt.loc10_33.2: @F.%pattern_type (%pattern_type.dc7) = value_param_pattern [symbolic = %x.param_patt.loc10_33.2 (constants.%x.param_patt)] -// CHECK:STDOUT: %x.patt.loc10_33.2: @F.%pattern_type (%pattern_type.dc7) = wrapper_binding_pattern x, %x.param_patt.loc10_33.2 [symbolic = %x.patt.loc10_33.2 (constants.%x.patt)] +// CHECK:STDOUT: generic fn @F(%T.loc18_7.2: %Array.612) { +// CHECK:STDOUT: %T.patt.loc18_7.2: %pattern_type.809 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc18_7.2 (constants.%T.patt.bb1)] +// CHECK:STDOUT: %T.loc18_7.1: %Array.612 = symbolic_binding T, 0 [symbolic = %T.loc18_7.1 (constants.%T.6be)] +// CHECK:STDOUT: %HoldsType.loc18_46.1: type = class_type @HoldsType, @HoldsType(%T.loc18_7.1) [symbolic = %HoldsType.loc18_46.1 (constants.%HoldsType.9dd)] +// CHECK:STDOUT: %pattern_type: type = pattern_type %HoldsType.loc18_46.1 [symbolic = %pattern_type (constants.%pattern_type.dc7)] +// CHECK:STDOUT: %x.param_patt.loc18_33.2: @F.%pattern_type (%pattern_type.dc7) = value_param_pattern [symbolic = %x.param_patt.loc18_33.2 (constants.%x.param_patt)] +// CHECK:STDOUT: %x.patt.loc18_33.2: @F.%pattern_type (%pattern_type.dc7) = wrapper_binding_pattern x, %x.param_patt.loc18_33.2 [symbolic = %x.patt.loc18_33.2 (constants.%x.patt)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type %HoldsType.loc10_46.1 [symbolic = %require_complete (constants.%require_complete.501)] +// CHECK:STDOUT: %require_complete: = require_complete_type %HoldsType.loc18_46.1 [symbolic = %require_complete (constants.%require_complete.501)] // CHECK:STDOUT: -// CHECK:STDOUT: fn(%x.param: @F.%HoldsType.loc10_46.1 (%HoldsType.9dd), %a.param: ) { +// CHECK:STDOUT: fn(%x.param: @F.%HoldsType.loc18_46.1 (%HoldsType.9dd), %a.param: ) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -1153,39 +1167,39 @@ fn G() { // CHECK:STDOUT: fn @G() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] -// CHECK:STDOUT: %.loc15_6.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc23_6.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] // CHECK:STDOUT: %HoldsType.ref: %HoldsType.type = name_ref HoldsType, file.%HoldsType.decl [concrete = constants.%HoldsType.generic] // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %.loc15_25.1: %tuple.type.135 = tuple_literal (%C.ref) [concrete = constants.%tuple.9e1] -// CHECK:STDOUT: %.loc15_36: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc23_25.1: %tuple.type.135 = tuple_literal (%C.ref) [concrete = constants.%tuple.9e1] +// CHECK:STDOUT: %.loc23_36: type = type_literal type [concrete = type] // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] // CHECK:STDOUT: %Array: type = class_type @Array, @Array(type, constants.%int_1) [concrete = constants.%Array.612] // CHECK:STDOUT: %impl.elem0: %.cd2 = impl_witness_access constants.%Copy.impl_witness.f3e, element0 [concrete = constants.%type.as.Copy.impl.Op] // CHECK:STDOUT: %bound_method: = bound_method %C.ref, %impl.elem0 [concrete = constants.%type.as.Copy.impl.Op.bound] // CHECK:STDOUT: %type.as.Copy.impl.Op.call: init type = call %bound_method(%C.ref) [concrete = constants.%C] -// CHECK:STDOUT: %.loc15_25.2: ref %Array.612 = temporary_storage +// CHECK:STDOUT: %.loc23_25.2: ref %Array.612 = temporary_storage // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] -// CHECK:STDOUT: %.loc15_25.3: ref type = array_index %.loc15_25.2, %int_0 -// CHECK:STDOUT: %.loc15_25.4: init type to %.loc15_25.3 = in_place_init %type.as.Copy.impl.Op.call [concrete = constants.%C] -// CHECK:STDOUT: %.loc15_25.5: init %Array.612 to %.loc15_25.2 = array_init (%.loc15_25.4) [concrete = constants.%array] -// CHECK:STDOUT: %.loc15_27.1: init %Array.612 = converted %.loc15_25.1, %.loc15_25.5 [concrete = constants.%array] -// CHECK:STDOUT: %.loc15_27.2: ref %Array.612 = temporary %.loc15_25.2, %.loc15_27.1 [concrete = constants.%.345] -// CHECK:STDOUT: %.loc15_27.3: %Array.612 = acquire_value %.loc15_27.2 [concrete = constants.%array] +// CHECK:STDOUT: %.loc23_25.3: ref type = array_index %.loc23_25.2, %int_0 +// CHECK:STDOUT: %.loc23_25.4: init type to %.loc23_25.3 = in_place_init %type.as.Copy.impl.Op.call [concrete = constants.%C] +// CHECK:STDOUT: %.loc23_25.5: init %Array.612 to %.loc23_25.2 = array_init (%.loc23_25.4) [concrete = constants.%array] +// CHECK:STDOUT: %.loc23_27.1: init %Array.612 = converted %.loc23_25.1, %.loc23_25.5 [concrete = constants.%array] +// CHECK:STDOUT: %.loc23_27.2: ref %Array.612 = temporary %.loc23_25.2, %.loc23_27.1 [concrete = constants.%.345] +// CHECK:STDOUT: %.loc23_27.3: %Array.612 = acquire_value %.loc23_27.2 [concrete = constants.%array] // CHECK:STDOUT: %HoldsType: type = class_type @HoldsType, @HoldsType(constants.%array) [concrete = constants.%HoldsType.00d] -// CHECK:STDOUT: %.loc15_6.2: ref %HoldsType.00d = temporary_storage -// CHECK:STDOUT: %.loc15_6.3: init %HoldsType.00d to %.loc15_6.2 = class_init () [concrete = constants.%HoldsType.val] -// CHECK:STDOUT: %.loc15_8: init %HoldsType.00d = converted %.loc15_6.1, %.loc15_6.3 [concrete = constants.%HoldsType.val] -// CHECK:STDOUT: %.loc15_48: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %Destroy.facet.loc15_27.1: %Destroy.type = facet_value constants.%Array.612, (constants.%DestroyImpl.impl_witness.e45, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc15_27.4: %Destroy.type = converted constants.%Array.612, %Destroy.facet.loc15_27.1 [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %Destroy.facet.loc15_27.2: %Destroy.type = facet_value constants.%Array.612, (constants.%DestroyImpl.impl_witness.e45, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc15_27.5: %Destroy.type = converted constants.%Array.612, %Destroy.facet.loc15_27.2 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc23_6.2: ref %HoldsType.00d = temporary_storage +// CHECK:STDOUT: %.loc23_6.3: init %HoldsType.00d to %.loc23_6.2 = class_init () [concrete = constants.%HoldsType.val] +// CHECK:STDOUT: %.loc23_8: init %HoldsType.00d = converted %.loc23_6.1, %.loc23_6.3 [concrete = constants.%HoldsType.val] +// CHECK:STDOUT: %.loc23_48: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %Destroy.facet.loc23_27.1: %Destroy.type = facet_value constants.%Array.612, (constants.%DestroyImpl.impl_witness.e45, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc23_27.4: %Destroy.type = converted constants.%Array.612, %Destroy.facet.loc23_27.1 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %Destroy.facet.loc23_27.2: %Destroy.type = facet_value constants.%Array.612, (constants.%DestroyImpl.impl_witness.e45, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc23_27.5: %Destroy.type = converted constants.%Array.612, %Destroy.facet.loc23_27.2 [concrete = constants.%Destroy.facet] // CHECK:STDOUT: %SelfDestruct.specific_fn: = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet) [concrete = constants.%SelfDestruct.specific_fn] -// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc15_27.2) +// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc23_27.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc15(%self.param: ref %Array.612) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc23(%self.param: ref %Array.612) = "no_op"; // CHECK:STDOUT: // CHECK:STDOUT: specific @HoldsType(constants.%T.6be) { // CHECK:STDOUT: %T.patt.loc4_18.2 => constants.%T.patt.bb1 @@ -1195,12 +1209,12 @@ fn G() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @F(constants.%T.6be) { -// CHECK:STDOUT: %T.patt.loc10_7.2 => constants.%T.patt.bb1 -// CHECK:STDOUT: %T.loc10_7.1 => constants.%T.6be -// CHECK:STDOUT: %HoldsType.loc10_46.1 => constants.%HoldsType.9dd +// CHECK:STDOUT: %T.patt.loc18_7.2 => constants.%T.patt.bb1 +// CHECK:STDOUT: %T.loc18_7.1 => constants.%T.6be +// CHECK:STDOUT: %HoldsType.loc18_46.1 => constants.%HoldsType.9dd // CHECK:STDOUT: %pattern_type => constants.%pattern_type.dc7 -// CHECK:STDOUT: %x.param_patt.loc10_33.2 => constants.%x.param_patt -// CHECK:STDOUT: %x.patt.loc10_33.2 => constants.%x.patt +// CHECK:STDOUT: %x.param_patt.loc18_33.2 => constants.%x.param_patt +// CHECK:STDOUT: %x.patt.loc18_33.2 => constants.%x.patt // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @HoldsType(constants.%array) { diff --git a/toolchain/check/testdata/deduce/where.carbon b/toolchain/check/testdata/deduce/where.carbon index 5a87a684eb3f..98ea6518aa15 100644 --- a/toolchain/check/testdata/deduce/where.carbon +++ b/toolchain/check/testdata/deduce/where.carbon @@ -28,8 +28,17 @@ fn G() { // TODO: Should be able to see that ().(Z.Z1) is C(D), so deduce that C(U) // is C(D) and U is D. // - // CHECK:STDERR: fail_todo_where.carbon:[[@LINE+3]]:3-15: error: cannot deduce value for generic parameter `U` [DeductionIncomplete] - // CHECK:STDERR: fail_todo_where.carbon:[[@LINE-10]]:1-53: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_todo_where.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn F[U: type](unused generic T: Z where .Z1 = C(U)) {} + // CHECK:STDERR: · ─────────────────────────┬─────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(() as type); + // CHECK:STDERR: · ━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot deduce value for generic parameter `U` + // CHECK:STDERR: · ┃ [DeductionIncomplete] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(() as type); } diff --git a/toolchain/check/testdata/eval/aggregates.carbon b/toolchain/check/testdata/eval/aggregates.carbon index 7913d7ab6ba4..1eb590f39a4c 100644 --- a/toolchain/check/testdata/eval/aggregates.carbon +++ b/toolchain/check/testdata/eval/aggregates.carbon @@ -28,7 +28,13 @@ library "[[@TEST_NAME]]"; // TODO: This creates an array temporary, which we don't yet support evaluating. //@dump-sem-ir-begin -// CHECK:STDERR: fail_todo_array_temporary.carbon:[[@LINE+2]]:53-86: error: array bound is not a constant [InvalidArrayExpr] +// CHECK:STDERR: ╭─┤ fail_todo_array_temporary.carbon:[[@LINE+8]]:53 +// CHECK:STDERR: -> │ ...x: array(i32, 1) = (0,) as array(i32, ((5, 7, 1, 9) as array(i32, 4))[2]); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: array bound is not a +// CHECK:STDERR: · ┃ constant +// CHECK:STDERR: · ┃ [InvalidArrayExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var array_index: array(i32, 1) = (0,) as array(i32, ((5, 7, 1, 9) as array(i32, 4))[2]); //@dump-sem-ir-end @@ -413,7 +419,7 @@ fn G(generic N: i32) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: %array_index.var: ref %Array.00c = var_storage %array_index.var_patt [concrete] -// CHECK:STDOUT: %.loc7: type = splice_block %Array [concrete = constants.%Array.00c] { +// CHECK:STDOUT: %.loc13: type = splice_block %Array [concrete = constants.%Array.00c] { // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] // CHECK:STDOUT: %Array: type = class_type @Array, @Array(constants.%i32, constants.%int_1.5b8) [concrete = constants.%Array.00c] @@ -427,67 +433,67 @@ fn G(generic N: i32) { // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %int_0.loc7_35: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] -// CHECK:STDOUT: %.loc7_37: %tuple.type.985 = tuple_literal (%int_0.loc7_35) [concrete = constants.%tuple.4f2] -// CHECK:STDOUT: %i32.loc7_48: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %int_0.loc13_35: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] +// CHECK:STDOUT: %.loc13_37: %tuple.type.985 = tuple_literal (%int_0.loc13_35) [concrete = constants.%tuple.4f2] +// CHECK:STDOUT: %i32.loc13_48: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %int_5: Core.IntLiteral = int_value 5 [concrete = constants.%int_5.64b] // CHECK:STDOUT: %int_7: Core.IntLiteral = int_value 7 [concrete = constants.%int_7.29f] -// CHECK:STDOUT: %int_1.loc7_61: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %int_1.loc13_61: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] // CHECK:STDOUT: %int_9: Core.IntLiteral = int_value 9 [concrete = constants.%int_9.988] -// CHECK:STDOUT: %.loc7_65.1: %tuple.type.d46 = tuple_literal (%int_5, %int_7, %int_1.loc7_61, %int_9) [concrete = constants.%tuple.869] -// CHECK:STDOUT: %i32.loc7_76: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc13_65.1: %tuple.type.d46 = tuple_literal (%int_5, %int_7, %int_1.loc13_61, %int_9) [concrete = constants.%tuple.869] +// CHECK:STDOUT: %i32.loc13_76: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %int_4: Core.IntLiteral = int_value 4 [concrete = constants.%int_4] // CHECK:STDOUT: %Array: type = class_type @Array, @Array(constants.%i32, constants.%int_4) [concrete = constants.%Array.f09] -// CHECK:STDOUT: %impl.elem0.loc7_65.1: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc7_65.1: = bound_method %int_5, %impl.elem0.loc7_65.1 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.f65] -// CHECK:STDOUT: %specific_fn.loc7_65.1: = specific_function %impl.elem0.loc7_65.1, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc7_65.2: = bound_method %int_5, %specific_fn.loc7_65.1 [concrete = constants.%bound_method.ab2] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc7_65.1: init %i32 = call %bound_method.loc7_65.2(%int_5) [concrete = constants.%int_5.708] -// CHECK:STDOUT: %.loc7_65.2: init %i32 = converted %int_5, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc7_65.1 [concrete = constants.%int_5.708] -// CHECK:STDOUT: %.loc7_65.3: ref %Array.f09 = temporary_storage -// CHECK:STDOUT: %int_0.loc7_65: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] -// CHECK:STDOUT: %.loc7_65.4: ref %i32 = array_index %.loc7_65.3, %int_0.loc7_65 -// CHECK:STDOUT: %.loc7_65.5: init %i32 to %.loc7_65.4 = in_place_init %.loc7_65.2 [concrete = constants.%int_5.708] -// CHECK:STDOUT: %impl.elem0.loc7_65.2: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc7_65.3: = bound_method %int_7, %impl.elem0.loc7_65.2 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.5f1] -// CHECK:STDOUT: %specific_fn.loc7_65.2: = specific_function %impl.elem0.loc7_65.2, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc7_65.4: = bound_method %int_7, %specific_fn.loc7_65.2 [concrete = constants.%bound_method.a5e] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc7_65.2: init %i32 = call %bound_method.loc7_65.4(%int_7) [concrete = constants.%int_7.a13] -// CHECK:STDOUT: %.loc7_65.6: init %i32 = converted %int_7, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc7_65.2 [concrete = constants.%int_7.a13] -// CHECK:STDOUT: %int_1.loc7_65: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %.loc7_65.7: ref %i32 = array_index %.loc7_65.3, %int_1.loc7_65 -// CHECK:STDOUT: %.loc7_65.8: init %i32 to %.loc7_65.7 = in_place_init %.loc7_65.6 [concrete = constants.%int_7.a13] -// CHECK:STDOUT: %impl.elem0.loc7_65.3: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc7_65.5: = bound_method %int_1.loc7_61, %impl.elem0.loc7_65.3 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282] -// CHECK:STDOUT: %specific_fn.loc7_65.3: = specific_function %impl.elem0.loc7_65.3, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc7_65.6: = bound_method %int_1.loc7_61, %specific_fn.loc7_65.3 [concrete = constants.%bound_method.3bd] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc7_65.3: init %i32 = call %bound_method.loc7_65.6(%int_1.loc7_61) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc7_65.9: init %i32 = converted %int_1.loc7_61, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc7_65.3 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %int_2.loc7_65: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] -// CHECK:STDOUT: %.loc7_65.10: ref %i32 = array_index %.loc7_65.3, %int_2.loc7_65 -// CHECK:STDOUT: %.loc7_65.11: init %i32 to %.loc7_65.10 = in_place_init %.loc7_65.9 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %impl.elem0.loc7_65.4: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc7_65.7: = bound_method %int_9, %impl.elem0.loc7_65.4 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.cf2] -// CHECK:STDOUT: %specific_fn.loc7_65.4: = specific_function %impl.elem0.loc7_65.4, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc7_65.8: = bound_method %int_9, %specific_fn.loc7_65.4 [concrete = constants.%bound_method.015] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc7_65.4: init %i32 = call %bound_method.loc7_65.8(%int_9) [concrete = constants.%int_9.607] -// CHECK:STDOUT: %.loc7_65.12: init %i32 = converted %int_9, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc7_65.4 [concrete = constants.%int_9.607] +// CHECK:STDOUT: %impl.elem0.loc13_65.1: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc13_65.1: = bound_method %int_5, %impl.elem0.loc13_65.1 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.f65] +// CHECK:STDOUT: %specific_fn.loc13_65.1: = specific_function %impl.elem0.loc13_65.1, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc13_65.2: = bound_method %int_5, %specific_fn.loc13_65.1 [concrete = constants.%bound_method.ab2] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc13_65.1: init %i32 = call %bound_method.loc13_65.2(%int_5) [concrete = constants.%int_5.708] +// CHECK:STDOUT: %.loc13_65.2: init %i32 = converted %int_5, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc13_65.1 [concrete = constants.%int_5.708] +// CHECK:STDOUT: %.loc13_65.3: ref %Array.f09 = temporary_storage +// CHECK:STDOUT: %int_0.loc13_65: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] +// CHECK:STDOUT: %.loc13_65.4: ref %i32 = array_index %.loc13_65.3, %int_0.loc13_65 +// CHECK:STDOUT: %.loc13_65.5: init %i32 to %.loc13_65.4 = in_place_init %.loc13_65.2 [concrete = constants.%int_5.708] +// CHECK:STDOUT: %impl.elem0.loc13_65.2: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc13_65.3: = bound_method %int_7, %impl.elem0.loc13_65.2 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.5f1] +// CHECK:STDOUT: %specific_fn.loc13_65.2: = specific_function %impl.elem0.loc13_65.2, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc13_65.4: = bound_method %int_7, %specific_fn.loc13_65.2 [concrete = constants.%bound_method.a5e] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc13_65.2: init %i32 = call %bound_method.loc13_65.4(%int_7) [concrete = constants.%int_7.a13] +// CHECK:STDOUT: %.loc13_65.6: init %i32 = converted %int_7, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc13_65.2 [concrete = constants.%int_7.a13] +// CHECK:STDOUT: %int_1.loc13_65: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %.loc13_65.7: ref %i32 = array_index %.loc13_65.3, %int_1.loc13_65 +// CHECK:STDOUT: %.loc13_65.8: init %i32 to %.loc13_65.7 = in_place_init %.loc13_65.6 [concrete = constants.%int_7.a13] +// CHECK:STDOUT: %impl.elem0.loc13_65.3: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc13_65.5: = bound_method %int_1.loc13_61, %impl.elem0.loc13_65.3 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282] +// CHECK:STDOUT: %specific_fn.loc13_65.3: = specific_function %impl.elem0.loc13_65.3, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc13_65.6: = bound_method %int_1.loc13_61, %specific_fn.loc13_65.3 [concrete = constants.%bound_method.3bd] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc13_65.3: init %i32 = call %bound_method.loc13_65.6(%int_1.loc13_61) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc13_65.9: init %i32 = converted %int_1.loc13_61, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc13_65.3 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %int_2.loc13_65: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] +// CHECK:STDOUT: %.loc13_65.10: ref %i32 = array_index %.loc13_65.3, %int_2.loc13_65 +// CHECK:STDOUT: %.loc13_65.11: init %i32 to %.loc13_65.10 = in_place_init %.loc13_65.9 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %impl.elem0.loc13_65.4: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc13_65.7: = bound_method %int_9, %impl.elem0.loc13_65.4 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.cf2] +// CHECK:STDOUT: %specific_fn.loc13_65.4: = specific_function %impl.elem0.loc13_65.4, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc13_65.8: = bound_method %int_9, %specific_fn.loc13_65.4 [concrete = constants.%bound_method.015] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc13_65.4: init %i32 = call %bound_method.loc13_65.8(%int_9) [concrete = constants.%int_9.607] +// CHECK:STDOUT: %.loc13_65.12: init %i32 = converted %int_9, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc13_65.4 [concrete = constants.%int_9.607] // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3] -// CHECK:STDOUT: %.loc7_65.13: ref %i32 = array_index %.loc7_65.3, %int_3 -// CHECK:STDOUT: %.loc7_65.14: init %i32 to %.loc7_65.13 = in_place_init %.loc7_65.12 [concrete = constants.%int_9.607] -// CHECK:STDOUT: %.loc7_65.15: init %Array.f09 to %.loc7_65.3 = array_init (%.loc7_65.5, %.loc7_65.8, %.loc7_65.11, %.loc7_65.14) [concrete = constants.%array] -// CHECK:STDOUT: %.loc7_67.1: init %Array.f09 = converted %.loc7_65.1, %.loc7_65.15 [concrete = constants.%array] -// CHECK:STDOUT: %int_2.loc7_85: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] -// CHECK:STDOUT: %.loc7_67.2: ref %Array.f09 = temporary %.loc7_65.3, %.loc7_67.1 [concrete = constants.%.4ae] -// CHECK:STDOUT: %impl.elem0.loc7_85: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc7_85.1: = bound_method %int_2.loc7_85, %impl.elem0.loc7_85 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.8a6] -// CHECK:STDOUT: %specific_fn.loc7_85: = specific_function %impl.elem0.loc7_85, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc7_85.2: = bound_method %int_2.loc7_85, %specific_fn.loc7_85 [concrete = constants.%bound_method.a55] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc7_85: init %i32 = call %bound_method.loc7_85.2(%int_2.loc7_85) [concrete = constants.%int_2.2e0] -// CHECK:STDOUT: %.loc7_85.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc7_85 [concrete = constants.%int_2.2e0] -// CHECK:STDOUT: %.loc7_85.2: %i32 = converted %int_2.loc7_85, %.loc7_85.1 [concrete = constants.%int_2.2e0] -// CHECK:STDOUT: %.loc7_86.1: ref %i32 = array_index %.loc7_67.2, %.loc7_85.2 -// CHECK:STDOUT: %.loc7_86.2: %i32 = acquire_value %.loc7_86.1 +// CHECK:STDOUT: %.loc13_65.13: ref %i32 = array_index %.loc13_65.3, %int_3 +// CHECK:STDOUT: %.loc13_65.14: init %i32 to %.loc13_65.13 = in_place_init %.loc13_65.12 [concrete = constants.%int_9.607] +// CHECK:STDOUT: %.loc13_65.15: init %Array.f09 to %.loc13_65.3 = array_init (%.loc13_65.5, %.loc13_65.8, %.loc13_65.11, %.loc13_65.14) [concrete = constants.%array] +// CHECK:STDOUT: %.loc13_67.1: init %Array.f09 = converted %.loc13_65.1, %.loc13_65.15 [concrete = constants.%array] +// CHECK:STDOUT: %int_2.loc13_85: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] +// CHECK:STDOUT: %.loc13_67.2: ref %Array.f09 = temporary %.loc13_65.3, %.loc13_67.1 [concrete = constants.%.4ae] +// CHECK:STDOUT: %impl.elem0.loc13_85: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc13_85.1: = bound_method %int_2.loc13_85, %impl.elem0.loc13_85 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.8a6] +// CHECK:STDOUT: %specific_fn.loc13_85: = specific_function %impl.elem0.loc13_85, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc13_85.2: = bound_method %int_2.loc13_85, %specific_fn.loc13_85 [concrete = constants.%bound_method.a55] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc13_85: init %i32 = call %bound_method.loc13_85.2(%int_2.loc13_85) [concrete = constants.%int_2.2e0] +// CHECK:STDOUT: %.loc13_85.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc13_85 [concrete = constants.%int_2.2e0] +// CHECK:STDOUT: %.loc13_85.2: %i32 = converted %int_2.loc13_85, %.loc13_85.1 [concrete = constants.%int_2.2e0] +// CHECK:STDOUT: %.loc13_86.1: ref %i32 = array_index %.loc13_67.2, %.loc13_85.2 +// CHECK:STDOUT: %.loc13_86.2: %i32 = acquire_value %.loc13_86.1 // CHECK:STDOUT: assign file.%array_index.var, // CHECK:STDOUT: // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/eval/binding.carbon b/toolchain/check/testdata/eval/binding.carbon index 4781b70d21fe..6979f40f72f8 100644 --- a/toolchain/check/testdata/eval/binding.carbon +++ b/toolchain/check/testdata/eval/binding.carbon @@ -33,12 +33,20 @@ library "[[@TEST_NAME]]"; let a: i32 = 3; eval fn G() -> i32 { - // CHECK:STDERR: fail_global.carbon:[[@LINE+1]]:10: error: expression is runtime; expected constant [EvalRequiresConstantValue] + // CHECK:STDERR: ╭─┤ fail_global.carbon:[[@LINE+11]]:10 + // CHECK:STDERR: -> │ return a; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expression is runtime; expected constant + // CHECK:STDERR: · ┃ [EvalRequiresConstantValue] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ let n: array(i32, G()) = (1, 2, 3); + // CHECK:STDERR: · ─┬─ + // CHECK:STDERR: · ╰──┤ in call to G here [InCallToEvalFn] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: return a; } -// CHECK:STDERR: fail_global.carbon:[[@LINE+2]]:19-21: note: in call to G here [InCallToEvalFn] -// CHECK:STDERR: let n: array(i32, G()) = (1, 2, 3); // --- fail_runtime_value.carbon @@ -50,12 +58,20 @@ fn F() -> i32; let a: i32 = F(); eval fn G() -> i32 { - // CHECK:STDERR: fail_runtime_value.carbon:[[@LINE+1]]:10: error: expression is runtime; expected constant [EvalRequiresConstantValue] + // CHECK:STDERR: ╭─┤ fail_runtime_value.carbon:[[@LINE+11]]:10 + // CHECK:STDERR: -> │ return a; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expression is runtime; expected constant + // CHECK:STDERR: · ┃ [EvalRequiresConstantValue] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ let n: array(i32, G()) = (1, 2, 3); + // CHECK:STDERR: · ─┬─ + // CHECK:STDERR: · ╰──┤ in call to G here [InCallToEvalFn] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: return a; } -// CHECK:STDERR: fail_runtime_value.carbon:[[@LINE+2]]:19-21: note: in call to G here [InCallToEvalFn] -// CHECK:STDERR: let n: array(i32, G()) = (1, 2, 3); // CHECK:STDOUT: --- local.carbon diff --git a/toolchain/check/testdata/eval/branch.carbon b/toolchain/check/testdata/eval/branch.carbon index 56111bb9d150..f072a14b48aa 100644 --- a/toolchain/check/testdata/eval/branch.carbon +++ b/toolchain/check/testdata/eval/branch.carbon @@ -57,7 +57,14 @@ var b: F(false) = MakeB(); library "[[@TEST_NAME]]"; import library "types"; -// CHECK:STDERR: fail_todo_if_expression_direct.carbon:[[@LINE+2]]:8-28: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_todo_if_expression_direct.carbon:[[@LINE+9]]:8 +// CHECK:STDERR: -> │ var a: if true then A else B = MakeA(); +// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: semantics TODO: +// CHECK:STDERR: · ┃ `Control flow expressions are currently only supported inside functions.` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var a: if true then A else B = MakeA(); var b: if false then A else B = MakeB(); diff --git a/toolchain/check/testdata/eval/call.carbon b/toolchain/check/testdata/eval/call.carbon index 8219ee4d60a3..c392db226568 100644 --- a/toolchain/check/testdata/eval/call.carbon +++ b/toolchain/check/testdata/eval/call.carbon @@ -26,7 +26,13 @@ eval fn F() -> i32 { return 3; } // Ensure we get an error about the over-sized initializer and aren't just // treating all `eval fn` calls as silent errors. -// CHECK:STDERR: fail_call_wrong_value.carbon:[[@LINE+2]]:26-37: error: cannot initialize array of 3 elements from 4 initializers [ArrayInitFromLiteralArgCountMismatch] +// CHECK:STDERR: ╭─┤ fail_call_wrong_value.carbon:[[@LINE+8]]:26 +// CHECK:STDERR: -> │ var a: array(i32, F()) = (0, 1, 2, 3); +// CHECK:STDERR: · ┳━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot initialize array of 3 elements from +// CHECK:STDERR: · ┃ 4 initializers +// CHECK:STDERR: · ┃ [ArrayInitFromLiteralArgCountMismatch] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var a: array(i32, F()) = (0, 1, 2, 3); @@ -36,7 +42,11 @@ library "[[@TEST_NAME]]"; fn F() -> i32 { return 3; } -// CHECK:STDERR: fail_call_fn_not_eval.carbon:[[@LINE+2]]:19-21: error: array bound is not a constant [InvalidArrayExpr] +// CHECK:STDERR: ╭─┤ fail_call_fn_not_eval.carbon:[[@LINE+6]]:19 +// CHECK:STDERR: -> │ var a: array(i32, F()) = (0, 1, 2); +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┗━━┫ error: array bound is not a constant [InvalidArrayExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var a: array(i32, F()) = (0, 1, 2); @@ -47,7 +57,11 @@ library "[[@TEST_NAME]]"; eval fn F() -> i32; // TODO: We should be able to diagnose this better. -// CHECK:STDERR: fail_call_eval_fn_not_defined.carbon:[[@LINE+2]]:19-21: error: array bound is not a constant [InvalidArrayExpr] +// CHECK:STDERR: ╭─┤ fail_call_eval_fn_not_defined.carbon:[[@LINE+6]]:19 +// CHECK:STDERR: -> │ var a: array(i32, F()) = (0, 1, 2); +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┗━━┫ error: array bound is not a constant [InvalidArrayExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var a: array(i32, F()) = (0, 1, 2); @@ -127,7 +141,12 @@ eval fn G(v: (i32, i32, i32)) -> i32 { return v.1; } fn H() { // TODO: The call to the function is a constant, but the `temporary` instruction wrapping it is not. //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_return_in_place_tuple.carbon:[[@LINE+2]]:28-33: error: array bound is not a constant [InvalidArrayExpr] + // CHECK:STDERR: ╭─┤ fail_todo_return_in_place_tuple.carbon:[[@LINE+7]]:28 + // CHECK:STDERR: -> │ var unused a: array(i32, G(F())) = (1, 2); + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: array bound is not a constant + // CHECK:STDERR: · ┃ [InvalidArrayExpr] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused a: array(i32, G(F())) = (1, 2); //@dump-sem-ir-end @@ -543,10 +562,10 @@ fn H() { // CHECK:STDOUT: %T.09f: %SubobjectDestroy.type = symbolic_binding T, 0 [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.type.dea: type = fn_type @T.as_type.as.DestroyImpl.impl.Op, @T.as_type.as.DestroyImpl.impl(%T.09f) [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.6e5: %T.as_type.as.DestroyImpl.impl.Op.type.dea = struct_value () [symbolic] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.1: type = fn_type @SubobjectDestroy.WithSelf.Op.loc15_32.1 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.1: type = fn_type @SubobjectDestroy.WithSelf.Op.loc20_32.1 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.1: %SubobjectDestroy.WithSelf.Op.type.6870fd.1 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80ef6.1: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.1), @SubobjectDestroy [concrete] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.2: type = fn_type @SubobjectDestroy.WithSelf.Op.loc15_32.2 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.2: type = fn_type @SubobjectDestroy.WithSelf.Op.loc20_32.2 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.2: %SubobjectDestroy.WithSelf.Op.type.6870fd.2 = struct_value () [concrete] // CHECK:STDOUT: %SubobjectDestroy.facet.49a: %SubobjectDestroy.type = facet_value %i32, (%custom_witness.b80ef6.1) [concrete] // CHECK:STDOUT: %DestroyImpl.impl_witness.077: = impl_witness imports.%DestroyImpl.impl_witness_table, @T.as_type.as.DestroyImpl.impl(%SubobjectDestroy.facet.49a) [concrete] @@ -621,7 +640,7 @@ fn H() { // CHECK:STDOUT: %a.var: ref = var_storage %a.var_patt [concrete = ] // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] -// CHECK:STDOUT: %.loc15_43: %tuple.type.f94 = tuple_literal (%int_1, %int_2) [concrete = constants.%tuple.ad8] +// CHECK:STDOUT: %.loc20_43: %tuple.type.f94 = tuple_literal (%int_1, %int_2) [concrete = constants.%tuple.ad8] // CHECK:STDOUT: assign %a.var, // CHECK:STDOUT: // CHECK:STDOUT: %a: = wrapper_binding a, [concrete = ] @@ -629,43 +648,43 @@ fn H() { // CHECK:STDOUT: %a.patt: = ref_binding_pattern a [concrete = ] // CHECK:STDOUT: %a.var_patt: = var_pattern %a.patt [concrete = ] // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.facet.loc15_32.1: %Destroy.type = facet_value constants.%tuple.type.abc, (constants.%DestroyImpl.impl_witness.62e, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c1b] -// CHECK:STDOUT: %.loc15_32.1: %Destroy.type = converted constants.%tuple.type.abc, %Destroy.facet.loc15_32.1 [concrete = constants.%Destroy.facet.c1b] -// CHECK:STDOUT: %Destroy.facet.loc15_32.2: %Destroy.type = facet_value constants.%tuple.type.abc, (constants.%DestroyImpl.impl_witness.62e, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c1b] -// CHECK:STDOUT: %.loc15_32.2: %Destroy.type = converted constants.%tuple.type.abc, %Destroy.facet.loc15_32.2 [concrete = constants.%Destroy.facet.c1b] +// CHECK:STDOUT: %Destroy.facet.loc20_32.1: %Destroy.type = facet_value constants.%tuple.type.abc, (constants.%DestroyImpl.impl_witness.62e, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c1b] +// CHECK:STDOUT: %.loc20_32.1: %Destroy.type = converted constants.%tuple.type.abc, %Destroy.facet.loc20_32.1 [concrete = constants.%Destroy.facet.c1b] +// CHECK:STDOUT: %Destroy.facet.loc20_32.2: %Destroy.type = facet_value constants.%tuple.type.abc, (constants.%DestroyImpl.impl_witness.62e, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c1b] +// CHECK:STDOUT: %.loc20_32.2: %Destroy.type = converted constants.%tuple.type.abc, %Destroy.facet.loc20_32.2 [concrete = constants.%Destroy.facet.c1b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc15_32.4) +// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc20_32.4) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc15_32.1(%self.param: ref %i32) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc20_32.1(%self.param: ref %i32) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc15_32.2(%self.param: ref %tuple.type.abc) { +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc20_32.2(%self.param: ref %tuple.type.abc) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] // CHECK:STDOUT: %tuple.elem2: ref %i32 = tuple_access %self.param, element2 -// CHECK:STDOUT: %Destroy.facet.loc15_32.1: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc15_32.1: %Destroy.type = converted constants.%i32, %Destroy.facet.loc15_32.1 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc15_32.2: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc15_32.2: %Destroy.type = converted constants.%i32, %Destroy.facet.loc15_32.2 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_32.1: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_32.1: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_32.1 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_32.2: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_32.2: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_32.2 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc15_32.1: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%tuple.elem2) +// CHECK:STDOUT: %SelfDestruct.call.loc20_32.1: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%tuple.elem2) // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] // CHECK:STDOUT: %tuple.elem1: ref %i32 = tuple_access %self.param, element1 -// CHECK:STDOUT: %Destroy.facet.loc15_32.3: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc15_32.3: %Destroy.type = converted constants.%i32, %Destroy.facet.loc15_32.3 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc15_32.4: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc15_32.4: %Destroy.type = converted constants.%i32, %Destroy.facet.loc15_32.4 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_32.3: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_32.3: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_32.3 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_32.4: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_32.4: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_32.4 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc15_32.2: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%tuple.elem1) +// CHECK:STDOUT: %SelfDestruct.call.loc20_32.2: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%tuple.elem1) // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] // CHECK:STDOUT: %tuple.elem0: ref %i32 = tuple_access %self.param, element0 -// CHECK:STDOUT: %Destroy.facet.loc15_32.5: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc15_32.5: %Destroy.type = converted constants.%i32, %Destroy.facet.loc15_32.5 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc15_32.6: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc15_32.6: %Destroy.type = converted constants.%i32, %Destroy.facet.loc15_32.6 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_32.5: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_32.5: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_32.5 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_32.6: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_32.6: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_32.6 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc15_32.3: init %empty_tuple.type = call %SelfDestruct.specific_fn.3(%tuple.elem0) +// CHECK:STDOUT: %SelfDestruct.call.loc20_32.3: init %empty_tuple.type = call %SelfDestruct.specific_fn.3(%tuple.elem0) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/eval/symbolic.carbon b/toolchain/check/testdata/eval/symbolic.carbon index 0453753dac52..e2e9792717f6 100644 --- a/toolchain/check/testdata/eval/symbolic.carbon +++ b/toolchain/check/testdata/eval/symbolic.carbon @@ -41,8 +41,17 @@ fn G(generic B: bool) { // TODO: Provide a location for the "cannot initialize" error message. fn H() { - // CHECK:STDERR: fail_symbolic_call_to_eval_fn_invalid_instantiation.carbon:[[@LINE+3]]:3: error: unable to monomorphize specific `G(true)` [ResolvingSpecificHere] - // CHECK:STDERR: fail_symbolic_call_to_eval_fn_invalid_instantiation.carbon:[[@LINE-6]]:24-31: note: cannot initialize tuple of 0 elements from tuple with 2 elements [TupleInitElementCountMismatch] + // CHECK:STDERR: ╭─┤ fail_symbolic_call_to_eval_fn_invalid_instantiation.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ let unused n: F(B) = ({}, {}); + // CHECK:STDERR: · ┬─────── + // CHECK:STDERR: · ╰──┤ cannot initialize tuple of 0 elements from tuple + // CHECK:STDERR: · │ with 2 elements + // CHECK:STDERR: · │ [TupleInitElementCountMismatch] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ G(true); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: unable to monomorphize specific `G(true)` [ResolvingSpecificHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: G(true); } @@ -83,16 +92,41 @@ eval fn G(generic B: bool, (a: bool, b: bool)) -> type { // the type of the parameter. The argument for the generic parameter is found // in the specific for the callee, not in the arguments of the SemIR `call`. fn UseF(generic B: bool, x: F(B)); -// CHECK:STDERR: fail_print_call_in_diagnostic.carbon:[[@LINE+3]]:26-32: error: type `` of parameter 2 in redeclaration differs from previous parameter type `` [RedeclParamDiffersType] -// CHECK:STDERR: fail_print_call_in_diagnostic.carbon:[[@LINE-2]]:26-32: note: previous declaration's corresponding parameter here [RedeclParamPrevious] +// CHECK:STDERR: ╭─┤ fail_print_call_in_diagnostic.carbon:[[@LINE+15]]:26 +// CHECK:STDERR: │ fn UseF(generic B: bool, x: F(B)); +// CHECK:STDERR: · ┬────── +// CHECK:STDERR: · ╰──┤ previous declaration's corresponding parameter +// CHECK:STDERR: · │ here +// CHECK:STDERR: · │ [RedeclParamPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn UseF(generic B: bool, x: bool); +// CHECK:STDERR: · ┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: type `` of parameter 2 in +// CHECK:STDERR: · ┃ redeclaration differs from previous +// CHECK:STDERR: · ┃ parameter type `` +// CHECK:STDERR: · ┃ [RedeclParamDiffersType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn UseF(generic B: bool, x: bool); // The arguments of the SemIR `call` are flattened by the nested tuple pattern // in the signature of `G`, and are regrouped here to match the source. fn UseG(generic B: bool, x: G(B, (true, false))); -// CHECK:STDERR: fail_print_call_in_diagnostic.carbon:[[@LINE+3]]:26-32: error: type `` of parameter 2 in redeclaration differs from previous parameter type `` [RedeclParamDiffersType] -// CHECK:STDERR: fail_print_call_in_diagnostic.carbon:[[@LINE-2]]:26-47: note: previous declaration's corresponding parameter here [RedeclParamPrevious] +// CHECK:STDERR: ╭─┤ fail_print_call_in_diagnostic.carbon:[[@LINE+16]]:26 +// CHECK:STDERR: │ fn UseG(generic B: bool, x: G(B, (true, false))); +// CHECK:STDERR: · ┬───────────────────── +// CHECK:STDERR: · ╰──┤ previous declaration's corresponding parameter +// CHECK:STDERR: · │ here +// CHECK:STDERR: · │ [RedeclParamPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn UseG(generic B: bool, x: bool); +// CHECK:STDERR: · ┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: type `` of parameter 2 in +// CHECK:STDERR: · ┃ redeclaration differs from previous +// CHECK:STDERR: · ┃ parameter type +// CHECK:STDERR: · ┃ `` +// CHECK:STDERR: · ┃ [RedeclParamDiffersType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn UseG(generic B: bool, x: bool); @@ -103,15 +137,32 @@ eval fn H(generic B: bool, (a: bool,)) -> type { } fn UseH(generic B: bool, x: H(B, (true,))); -// CHECK:STDERR: fail_print_call_in_diagnostic.carbon:[[@LINE+3]]:26-32: error: type `` of parameter 2 in redeclaration differs from previous parameter type `` [RedeclParamDiffersType] -// CHECK:STDERR: fail_print_call_in_diagnostic.carbon:[[@LINE-2]]:26-41: note: previous declaration's corresponding parameter here [RedeclParamPrevious] +// CHECK:STDERR: ╭─┤ fail_print_call_in_diagnostic.carbon:[[@LINE+16]]:26 +// CHECK:STDERR: │ fn UseH(generic B: bool, x: H(B, (true,))); +// CHECK:STDERR: · ┬─────────────── +// CHECK:STDERR: · ╰──┤ previous declaration's corresponding parameter +// CHECK:STDERR: · │ here +// CHECK:STDERR: · │ [RedeclParamPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn UseH(generic B: bool, x: bool); +// CHECK:STDERR: · ┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: type `` of parameter 2 in +// CHECK:STDERR: · ┃ redeclaration differs from previous +// CHECK:STDERR: · ┃ parameter type +// CHECK:STDERR: · ┃ `` +// CHECK:STDERR: · ┃ [RedeclParamDiffersType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn UseH(generic B: bool, x: bool); // The `self` argument is the first argument of the SemIR `call`, but is printed // before the name of the method, as it was written. class C { - // CHECK:STDERR: fail_print_call_in_diagnostic.carbon:[[@LINE+2]]:13-22: warning: binding `self` unused [UnusedBinding] + // CHECK:STDERR: ╭─┤ fail_print_call_in_diagnostic.carbon:[[@LINE+6]]:13 + // CHECK:STDERR: -> │ eval fn M(self: Self, b: bool) -> type { + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ warning: binding `self` unused [UnusedBinding] + // CHECK:STDERR: ╰──── // CHECK:STDERR: eval fn M(self: Self, b: bool) -> type { if (b) { return (); } @@ -120,8 +171,19 @@ class C { } fn UseM(generic c: C, x: c.M(true)); -// CHECK:STDERR: fail_print_call_in_diagnostic.carbon:[[@LINE+3]]:23-29: error: type `` of parameter 2 in redeclaration differs from previous parameter type `` [RedeclParamDiffersType] -// CHECK:STDERR: fail_print_call_in_diagnostic.carbon:[[@LINE-2]]:23-34: note: previous declaration's corresponding parameter here [RedeclParamPrevious] +// CHECK:STDERR: ╭─┤ fail_print_call_in_diagnostic.carbon:[[@LINE+14]]:23 +// CHECK:STDERR: │ fn UseM(generic c: C, x: c.M(true)); +// CHECK:STDERR: · ──┬───────── +// CHECK:STDERR: · ╰──┤ previous declaration's corresponding parameter here +// CHECK:STDERR: · │ [RedeclParamPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn UseM(generic c: C, x: bool); +// CHECK:STDERR: · ┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: type `` of parameter 2 in +// CHECK:STDERR: · ┃ redeclaration differs from previous parameter +// CHECK:STDERR: · ┃ type `` +// CHECK:STDERR: · ┃ [RedeclParamDiffersType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn UseM(generic c: C, x: bool); @@ -134,8 +196,21 @@ impl type as J { } fn UseN(generic T: type, x: (const T).(J.N)()); -// CHECK:STDERR: fail_print_call_in_diagnostic.carbon:[[@LINE+3]]:26-32: error: type `` of parameter 2 in redeclaration differs from previous parameter type `` [RedeclParamDiffersType] -// CHECK:STDERR: fail_print_call_in_diagnostic.carbon:[[@LINE-2]]:26-45: note: previous declaration's corresponding parameter here [RedeclParamPrevious] +// CHECK:STDERR: ╭─┤ fail_print_call_in_diagnostic.carbon:[[@LINE+16]]:26 +// CHECK:STDERR: │ fn UseN(generic T: type, x: (const T).(J.N)()); +// CHECK:STDERR: · ┬─────────────────── +// CHECK:STDERR: · ╰──┤ previous declaration's corresponding parameter +// CHECK:STDERR: · │ here +// CHECK:STDERR: · │ [RedeclParamPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn UseN(generic T: type, x: bool); +// CHECK:STDERR: · ┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: type `` of parameter 2 in +// CHECK:STDERR: · ┃ redeclaration differs from previous +// CHECK:STDERR: · ┃ parameter type +// CHECK:STDERR: · ┃ `` +// CHECK:STDERR: · ┃ [RedeclParamDiffersType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn UseN(generic T: type, x: bool); diff --git a/toolchain/check/testdata/eval/unexpected_runtime.carbon b/toolchain/check/testdata/eval/unexpected_runtime.carbon index a74ec9546ade..1d4814b51eef 100644 --- a/toolchain/check/testdata/eval/unexpected_runtime.carbon +++ b/toolchain/check/testdata/eval/unexpected_runtime.carbon @@ -20,7 +20,12 @@ interface Z { } class D { - // CHECK:STDERR: fail_unexpected_runtime_base.carbon:[[@LINE+2]]:18: error: cannot evaluate type expression [TypeExprEvaluationFailure] + // CHECK:STDERR: ╭─┤ fail_unexpected_runtime_base.carbon:[[@LINE+7]]:18 + // CHECK:STDERR: -> │ extend impl as x where .T = () {} + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot evaluate type expression + // CHECK:STDERR: · ┃ [TypeExprEvaluationFailure] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend impl as x where .T = () {} } @@ -35,9 +40,21 @@ interface Z { } class D { - // CHECK:STDERR: fail_unexpected_runtime_rewrite_lhs.carbon:[[@LINE+4]]:18-26: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_unexpected_runtime_rewrite_lhs.carbon:[[@LINE+16]]:18 + // CHECK:STDERR: -> │ extend impl as Z where x = () {} + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: + // CHECK:STDERR: · ┃ `handle invalid parse trees in `check`` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_unexpected_runtime_rewrite_lhs.carbon:[[@LINE+2]]:28: error: requirement can only use `=` after `.member` designator [RequirementEqualAfterNonDesignator] + // CHECK:STDERR: ╭─┤ fail_unexpected_runtime_rewrite_lhs.carbon:[[@LINE+8]]:28 + // CHECK:STDERR: -> │ extend impl as Z where x = () {} + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: requirement can only use `=` after + // CHECK:STDERR: · ┃ `.member` designator + // CHECK:STDERR: · ┃ [RequirementEqualAfterNonDesignator] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend impl as Z where x = () {} } @@ -52,7 +69,13 @@ interface Z { } class D { - // CHECK:STDERR: fail_unexpected_runtime_rewrite_rhs.carbon:[[@LINE+2]]:31: error: expression is runtime; expected constant [EvalRequiresConstantValue] + // CHECK:STDERR: ╭─┤ fail_unexpected_runtime_rewrite_rhs.carbon:[[@LINE+8]]:31 + // CHECK:STDERR: -> │ extend impl as Z where .T = x {} + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expression is runtime; expected + // CHECK:STDERR: · ┃ constant + // CHECK:STDERR: · ┃ [EvalRequiresConstantValue] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend impl as Z where .T = x {} } @@ -65,7 +88,12 @@ var x: type; interface Z(T: type) {} class D { - // CHECK:STDERR: fail_unexpected_runtime_impls_lhs.carbon:[[@LINE+2]]:29: error: cannot evaluate type expression [TypeExprEvaluationFailure] + // CHECK:STDERR: ╭─┤ fail_unexpected_runtime_impls_lhs.carbon:[[@LINE+7]]:29 + // CHECK:STDERR: -> │ extend impl as type where x impls Z(.Self) {} + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot evaluate type expression + // CHECK:STDERR: · ┃ [TypeExprEvaluationFailure] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend impl as type where x impls Z(.Self) {} } @@ -78,7 +106,13 @@ var x: type; interface Z {} class D { - // CHECK:STDERR: fail_unexpected_runtime_impls_rhs.carbon:[[@LINE+2]]:41: error: cannot evaluate type expression [TypeExprEvaluationFailure] + // CHECK:STDERR: ╭─┤ fail_unexpected_runtime_impls_rhs.carbon:[[@LINE+8]]:41 + // CHECK:STDERR: -> │ extend impl as type where .Self impls x {} + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot evaluate type + // CHECK:STDERR: · ┃ expression + // CHECK:STDERR: · ┃ [TypeExprEvaluationFailure] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend impl as type where .Self impls x {} } diff --git a/toolchain/check/testdata/facet/access.carbon b/toolchain/check/testdata/facet/access.carbon index 485f69e2a8b2..b2377a5144c4 100644 --- a/toolchain/check/testdata/facet/access.carbon +++ b/toolchain/check/testdata/facet/access.carbon @@ -148,16 +148,30 @@ fn F(generic U: Core.Destroy & I where .X = .Self) { // member lookup, but can't call methods without `self`. See the // `compound_access_through_call_with_self_param.carbon` test for the former. // - // CHECK:STDERR: fail_compound_access_through_call.carbon:[[@LINE+3]]:3-9: error: cannot implicitly convert non-type value of type `U` into type implementing `I` [ConversionFailureNonTypeToFacet] - // CHECK:STDERR: fail_compound_access_through_call.carbon:[[@LINE+2]]:3-9: note: type `U` does not implement interface `Core.ImplicitAs(I)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_compound_access_through_call.carbon:[[@LINE+10]]:3 + // CHECK:STDERR: -> │ u.(I.G)(); + // CHECK:STDERR: · ┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert non-type value of type `U` into type + // CHECK:STDERR: · │ ┃ implementing `I` + // CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: · ╰────┤ type `U` does not implement interface `Core.ImplicitAs(I)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: u.(I.G)(); // This is the same as the above, since G() returns a non-type value of type // `U`. // - // CHECK:STDERR: fail_compound_access_through_call.carbon:[[@LINE+3]]:3-17: error: cannot implicitly convert non-type value of type `U` into type implementing `I` [ConversionFailureNonTypeToFacet] - // CHECK:STDERR: fail_compound_access_through_call.carbon:[[@LINE+2]]:3-17: note: type `U` does not implement interface `Core.ImplicitAs(I)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_compound_access_through_call.carbon:[[@LINE+10]]:3 + // CHECK:STDERR: -> │ U.(I.G)().(I.G)(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert non-type value of type `U` into type + // CHECK:STDERR: · │ ┃ implementing `I` + // CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: · ╰────┤ type `U` does not implement interface `Core.ImplicitAs(I)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: U.(I.G)().(I.G)(); } @@ -193,7 +207,12 @@ fn Id[U: type](x: U) -> U { return Id(x); } impl () as I where .T = () {} // Type of member expr is associated entity type, // but value is not constant. -// CHECK:STDERR: fail_non_const_associated.carbon:[[@LINE+2]]:8-19: error: semantics TODO: `Non-constant associated entity value` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_non_const_associated.carbon:[[@LINE+7]]:8 +// CHECK:STDERR: -> │ var v: ().(Id(I.T)); +// CHECK:STDERR: · ━━━━━━┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `Non-constant associated entity value` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var v: ().(Id(I.T)); @@ -204,7 +223,12 @@ fn Id[U: type](x: U) -> U { return Id(x); } interface J { let T: type; - // CHECK:STDERR: fail_non_const_associated_in_interface.carbon:[[@LINE+2]]:13-17: error: cannot evaluate type expression [TypeExprEvaluationFailure] + // CHECK:STDERR: ╭─┤ fail_non_const_associated_in_interface.carbon:[[@LINE+7]]:13 + // CHECK:STDERR: -> │ fn F() -> Id(T); + // CHECK:STDERR: · ━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: cannot evaluate type expression + // CHECK:STDERR: · ┃ [TypeExprEvaluationFailure] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn F() -> Id(T); } @@ -216,7 +240,11 @@ interface I { let T: type; } -// CHECK:STDERR: fail_alias_to_non_const_assoc_entity.carbon:[[@LINE+2]]:8-11: error: semantics TODO: `HandleAutoTypeLiteral` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_alias_to_non_const_assoc_entity.carbon:[[@LINE+6]]:8 +// CHECK:STDERR: -> │ let x: auto = I.T; +// CHECK:STDERR: · ━━┳━ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `HandleAutoTypeLiteral` [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let x: auto = I.T; @@ -244,7 +272,13 @@ import library "to_import"; interface J { // extend I; alias V = U; - // CHECK:STDERR: fail_access_alias_in_imported_library.carbon:[[@LINE+2]]:13: error: cannot convert type `Self` that implements `J` into type implementing `I` [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╭─┤ fail_access_alias_in_imported_library.carbon:[[@LINE+8]]:13 + // CHECK:STDERR: -> │ fn F() -> V; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `Self` that implements `J` into type + // CHECK:STDERR: · ┃ implementing `I` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn F() -> V; } @@ -372,8 +406,16 @@ fn F(generic V: Z(.Self)) { // // TODO: The identified facet type `NX` includes `X` and should provide a // same-type constraint `X.X1 == {}` which would allow this conversion. - // CHECK:STDERR: fail_todo_find_access_value_in_second_nested_access.carbon:[[@LINE+3]]:3-36: error: cannot convert expression of type `{}` to `V.(Z(V).Z1).(Y(V).Y1).(X.X1)` with `as` [ConversionFailure] - // CHECK:STDERR: fail_todo_find_access_value_in_second_nested_access.carbon:[[@LINE+2]]:3-36: note: type `{}` does not implement interface `Core.As(V.(Z(V).Z1).(Y(V).Y1).(X.X1))` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_todo_find_access_value_in_second_nested_access.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: -> │ {} as V.(Z(V).Z1).(Y(V).Y1).(X.X1); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `{}` to + // CHECK:STDERR: · │ ┃ `V.(Z(V).Z1).(Y(V).Y1).(X.X1)` with `as` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `{}` does not implement interface + // CHECK:STDERR: · │ `Core.As(V.(Z(V).Z1).(Y(V).Y1).(X.X1))` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: {} as V.(Z(V).Z1).(Y(V).Y1).(X.X1); } @@ -411,7 +453,13 @@ fn F(generic V: Z(.Self) where .Z0 impls NY(()) // // TODO: The identified facet type `NX` includes `X` and should provide a // same-type constraint `X.X1 == V` which would allow this conversion. - // CHECK:STDERR: fail_todo_find_access_value_in_third_nested_access.carbon:[[@LINE+2]]:9-33: error: cannot convert type `V.(Z(V).Z1).(Y.Y1)` into type implementing `X` [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╭─┤ fail_todo_find_access_value_in_third_nested_access.carbon:[[@LINE+8]]:9 + // CHECK:STDERR: -> │ {} as V.(Z(V).Z1).(Y.Y1).(X.X1); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `V.(Z(V).Z1).(Y.Y1)` into type + // CHECK:STDERR: · ┃ implementing `X` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: {} as V.(Z(V).Z1).(Y.Y1).(X.X1); } @@ -433,8 +481,14 @@ constraint NY(PeriodSelf: type) { // `(C as Y(T)).Y1` but we currently only look in `C`. See the TODO in // `TryFindValueInRewriteConstraints()`. fn F(generic T: Z where C impls NY(.Self)) -> C.(Y(T).Y1) { - // CHECK:STDERR: fail_todo_find_access_value_in_facet_from_specific_interface.carbon:[[@LINE+3]]:3-12: error: cannot implicitly convert expression of type `{}` to `C.(Y(T).Y1)` [ConversionFailure] - // CHECK:STDERR: fail_todo_find_access_value_in_facet_from_specific_interface.carbon:[[@LINE+2]]:3-12: note: type `{}` does not implement interface `Core.ImplicitAs(C.(Y(T).Y1))` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_todo_find_access_value_in_facet_from_specific_interface.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ return {}; + // CHECK:STDERR: · ┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `{}` to `C.(Y(T).Y1)` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `{}` does not implement interface `Core.ImplicitAs(C.(Y(T).Y1))` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return {}; } diff --git a/toolchain/check/testdata/facet/aggregate_through_access.carbon b/toolchain/check/testdata/facet/aggregate_through_access.carbon index 909af4ada0a4..751e2c6304fc 100644 --- a/toolchain/check/testdata/facet/aggregate_through_access.carbon +++ b/toolchain/check/testdata/facet/aggregate_through_access.carbon @@ -17,7 +17,14 @@ interface Z { let X: type; } -// CHECK:STDERR: fail_todo_tuple_access_through_witness.carbon:[[@LINE+2]]:41-45: error: type `type` does not support tuple indexing; only tuples can be indexed that way [TupleIndexOnANonTupleType] +// CHECK:STDERR: ╭─┤ fail_todo_tuple_access_through_witness.carbon:[[@LINE+9]]:41 +// CHECK:STDERR: -> │ fn F(generic T: Z where .X = ({}, )) -> T.X.0 { +// CHECK:STDERR: · ┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: type `type` does not support +// CHECK:STDERR: · ┃ tuple indexing; only tuples +// CHECK:STDERR: · ┃ can be indexed that way +// CHECK:STDERR: · ┃ [TupleIndexOnANonTupleType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic T: Z where .X = ({}, )) -> T.X.0 { return {}; @@ -30,7 +37,14 @@ interface Z { let X: type; } -// CHECK:STDERR: fail_todo_struct_access_through_witness.carbon:[[@LINE+2]]:43-47: error: type `type` does not support qualified expressions [QualifiedExprUnsupported] +// CHECK:STDERR: ╭─┤ fail_todo_struct_access_through_witness.carbon:[[@LINE+9]]:43 +// CHECK:STDERR: -> │ fn F(generic T: Z where .X = {.t: ()}) -> T.X.t { +// CHECK:STDERR: · ┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: type `type` does not +// CHECK:STDERR: · ┃ support qualified +// CHECK:STDERR: · ┃ expressions +// CHECK:STDERR: · ┃ [QualifiedExprUnsupported] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic T: Z where .X = {.t: ()}) -> T.X.t { return (); @@ -43,7 +57,14 @@ interface Z { let X: type; } -// CHECK:STDERR: fail_todo_array_access_through_witness.carbon:[[@LINE+2]]:47-52: error: cannot access member of interface `Core.IndexWith(Core.IntLiteral)` in type `type` that does not implement that interface [MissingImplInMemberAccess] +// CHECK:STDERR: ╭─┤ fail_todo_array_access_through_witness.carbon:[[@LINE+9]]:47 +// CHECK:STDERR: -> │ fn F(generic T: Z where .X = array({}, 1)) -> T.X[0] { +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: cannot access member of interface `Core.IndexWith(Core.IntLiteral)` in +// CHECK:STDERR: · ┃ type `type` that does not implement that interface +// CHECK:STDERR: · ┃ [MissingImplInMemberAccess] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic T: Z where .X = array({}, 1)) -> T.X[0] { return {}; diff --git a/toolchain/check/testdata/facet/combine.carbon b/toolchain/check/testdata/facet/combine.carbon index 7219d5482db4..7295c715747c 100644 --- a/toolchain/check/testdata/facet/combine.carbon +++ b/toolchain/check/testdata/facet/combine.carbon @@ -31,7 +31,13 @@ impl C as B { fn F() { // TODO: This error message is wrong here, we are not using `extend`. - // CHECK:STDERR: fail_name_collision.carbon:[[@LINE+2]]:14-22: error: ambiguous use of name `G` found in multiple extended scopes [NameAmbiguousDueToExtend] + // CHECK:STDERR: ╭─┤ fail_name_collision.carbon:[[@LINE+8]]:14 + // CHECK:STDERR: -> │ ({} as C).((A & B).G)(); + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: ambiguous use of name `G` found in multiple extended + // CHECK:STDERR: · ┃ scopes + // CHECK:STDERR: · ┃ [NameAmbiguousDueToExtend] + // CHECK:STDERR: ╰──── // CHECK:STDERR: ({} as C).((A & B).G)(); } @@ -96,8 +102,17 @@ impl C as B {} fn G[T: A(P2) & B](unused t: T) {} fn F() { - // CHECK:STDERR: fail_wrong_generic_interface.carbon:[[@LINE+3]]:3-12: error: cannot convert type `C` into type implementing `A(P2) & B` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_wrong_generic_interface.carbon:[[@LINE-4]]:1-33: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_wrong_generic_interface.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn G[T: A(P2) & B](unused t: T) {} + // CHECK:STDERR: · ────────────────┬──────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ G({} as C); + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `C` into type implementing `A(P2) & B` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: G({} as C); } @@ -173,8 +188,17 @@ interface J {} interface K {} fn Test() { - // CHECK:STDERR: fail_compare_not_equal.carbon:[[@LINE+3]]:3-36: error: inconsistent deductions for value of generic parameter `T` [DeductionInconsistent] - // CHECK:STDERR: fail_compare_not_equal.carbon:[[@LINE-9]]:1-64: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_compare_not_equal.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn Same[T: type](unused a: WrapType(T), unused b: WrapType(T)) {} + // CHECK:STDERR: · ─────────────────────────┬────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Same(Type(I & J), Type(K & I & J)); + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: inconsistent deductions for value of generic parameter `T` + // CHECK:STDERR: · ┃ [DeductionInconsistent] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Same(Type(I & J), Type(K & I & J)); } @@ -190,8 +214,17 @@ interface I {} interface J(T: type) {} fn Test() { - // CHECK:STDERR: fail_compare_not_equal_parameterized.carbon:[[@LINE+3]]:3-40: error: inconsistent deductions for value of generic parameter `T` [DeductionInconsistent] - // CHECK:STDERR: fail_compare_not_equal_parameterized.carbon:[[@LINE-8]]:1-64: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_compare_not_equal_parameterized.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn Same[T: type](unused a: WrapType(T), unused b: WrapType(T)) {} + // CHECK:STDERR: · ─────────────────────────┬────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Same(Type(I & J(())), Type(J({}) & I)); + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: inconsistent deductions for value of generic parameter `T` + // CHECK:STDERR: · ┃ [DeductionInconsistent] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Same(Type(I & J(())), Type(J({}) & I)); } @@ -207,8 +240,17 @@ interface I {} interface J(T: type) {} fn Test() { - // CHECK:STDERR: fail_compare_not_equal_parameterized_extra.carbon:[[@LINE+3]]:3-48: error: inconsistent deductions for value of generic parameter `T` [DeductionInconsistent] - // CHECK:STDERR: fail_compare_not_equal_parameterized_extra.carbon:[[@LINE-8]]:1-64: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_compare_not_equal_parameterized_extra.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn Same[T: type](unused a: WrapType(T), unused b: WrapType(T)) {} + // CHECK:STDERR: · ─────────────────────────┬────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Same(Type(I & J(())), Type(J(()) & J({}) & I)); + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: inconsistent deductions for value of generic parameter `T` + // CHECK:STDERR: · ┃ [DeductionInconsistent] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Same(Type(I & J(())), Type(J(()) & J({}) & I)); } diff --git a/toolchain/check/testdata/facet/convert_class_value_to_generic_facet_value_value.carbon b/toolchain/check/testdata/facet/convert_class_value_to_generic_facet_value_value.carbon index 864e6a5a2bb7..b18fc36abe47 100644 --- a/toolchain/check/testdata/facet/convert_class_value_to_generic_facet_value_value.carbon +++ b/toolchain/check/testdata/facet/convert_class_value_to_generic_facet_value_value.carbon @@ -62,8 +62,17 @@ impl forall [T: type] C as I(T, ()) {} fn A[T: I({}, {})](unused t: T) {} fn B() { - // CHECK:STDERR: fail_mismatch_impl_constraint_with_fixed_specific.carbon:[[@LINE+3]]:3-12: error: cannot convert type `C` into type implementing `I({}, {})` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_mismatch_impl_constraint_with_fixed_specific.carbon:[[@LINE-4]]:1-33: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_mismatch_impl_constraint_with_fixed_specific.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn A[T: I({}, {})](unused t: T) {} + // CHECK:STDERR: · ────────────────┬──────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ A({} as C); + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `C` into type implementing `I({}, {})` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: A({} as C); } @@ -80,8 +89,17 @@ impl forall [T: type] C(T, ()) as I {} fn A[T: I](unused t: T) {} fn B() { - // CHECK:STDERR: fail_mismatch_impl_self_with_fixed_specific.carbon:[[@LINE+3]]:3-20: error: cannot convert type `C({}, {})` into type implementing `I` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_mismatch_impl_self_with_fixed_specific.carbon:[[@LINE-4]]:1-25: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_mismatch_impl_self_with_fixed_specific.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn A[T: I](unused t: T) {} + // CHECK:STDERR: · ────────────┬──────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ A({} as C({}, {})); + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `C({}, {})` into type implementing `I` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: A({} as C({}, {})); } @@ -1026,11 +1044,11 @@ fn B() { // CHECK:STDOUT: fn @B() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %A.ref: %A.type = name_ref A, file.%A.decl [concrete = constants.%A] -// CHECK:STDOUT: %.loc15_6.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc24_6.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %.loc15_6.2: ref %C = temporary_storage -// CHECK:STDOUT: %.loc15_6.3: init %C to %.loc15_6.2 = class_init () [concrete = constants.%C.val] -// CHECK:STDOUT: %.loc15_8: init %C = converted %.loc15_6.1, %.loc15_6.3 [concrete = constants.%C.val] +// CHECK:STDOUT: %.loc24_6.2: ref %C = temporary_storage +// CHECK:STDOUT: %.loc24_6.3: init %C to %.loc24_6.2 = class_init () [concrete = constants.%C.val] +// CHECK:STDOUT: %.loc24_8: init %C = converted %.loc24_6.1, %.loc24_6.3 [concrete = constants.%C.val] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1264,16 +1282,16 @@ fn B() { // CHECK:STDOUT: fn @B() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %A.ref: %A.type = name_ref A, file.%A.decl [concrete = constants.%A] -// CHECK:STDOUT: %.loc15_6.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc24_6.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [concrete = constants.%C.generic] -// CHECK:STDOUT: %.loc15_14: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc15_18: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc15_19.1: type = converted %.loc15_14, constants.%empty_struct_type [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %.loc15_19.2: type = converted %.loc15_18, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc24_14: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc24_18: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc24_19.1: type = converted %.loc24_14, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc24_19.2: type = converted %.loc24_18, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: %C: type = class_type @C, @C(constants.%empty_struct_type, constants.%empty_struct_type) [concrete = constants.%C.35b] -// CHECK:STDOUT: %.loc15_6.2: ref %C.35b = temporary_storage -// CHECK:STDOUT: %.loc15_6.3: init %C.35b to %.loc15_6.2 = class_init () [concrete = constants.%C.val] -// CHECK:STDOUT: %.loc15_8: init %C.35b = converted %.loc15_6.1, %.loc15_6.3 [concrete = constants.%C.val] +// CHECK:STDOUT: %.loc24_6.2: ref %C.35b = temporary_storage +// CHECK:STDOUT: %.loc24_6.3: init %C.35b to %.loc24_6.2 = class_init () [concrete = constants.%C.val] +// CHECK:STDOUT: %.loc24_8: init %C.35b = converted %.loc24_6.1, %.loc24_6.3 [concrete = constants.%C.val] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/facet/convert_facet_type_to_facet_value.carbon b/toolchain/check/testdata/facet/convert_facet_type_to_facet_value.carbon index f17f3fc58317..275d011fbcf1 100644 --- a/toolchain/check/testdata/facet/convert_facet_type_to_facet_value.carbon +++ b/toolchain/check/testdata/facet/convert_facet_type_to_facet_value.carbon @@ -40,8 +40,18 @@ class Goat {} impl Goat as Animal {} fn F() { - // CHECK:STDERR: fail_facet_value_to_facet_type.carbon:[[@LINE+3]]:3-22: error: cannot convert type `Goat as Animal` that implements `Animal` into type implementing `Eats` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_facet_value_to_facet_type.carbon:[[@LINE-6]]:24-30: note: initializing generic parameter `e` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_facet_value_to_facet_type.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn Feed(unused generic e: Eats) {} + // CHECK:STDERR: · ───┬─── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `e` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Feed(Goat as Animal); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `Goat as Animal` that implements `Animal` into + // CHECK:STDERR: · ┃ type implementing `Eats` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Feed(Goat as Animal); } @@ -65,13 +75,33 @@ impl Goat as Climbs {} // These are expected to fail: // https://github.com/carbon-language/carbon-lang/issues/4853#issuecomment-2707673344 fn F() { - // CHECK:STDERR: fail_convert_multi_interface_facet_value_to_facet_value.carbon:[[@LINE+3]]:3-33: error: cannot convert type `Goat as Animal & Climbs` that implements `Animal & Climbs` into type implementing `Eats` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_convert_multi_interface_facet_value_to_facet_value.carbon:[[@LINE-9]]:24-30: note: initializing generic parameter `e` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_convert_multi_interface_facet_value_to_facet_value.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn Feed(unused generic e: Eats) {} + // CHECK:STDERR: · ───┬─── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `e` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Feed(Goat as (Animal & Climbs)); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `Goat as Animal & Climbs` that implements + // CHECK:STDERR: · ┃ `Animal & Climbs` into type implementing `Eats` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Feed(Goat as (Animal & Climbs)); - // CHECK:STDERR: fail_convert_multi_interface_facet_value_to_facet_value.carbon:[[@LINE+3]]:3-23: error: cannot convert type `Animal & Climbs` into type implementing `Eats` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_convert_multi_interface_facet_value_to_facet_value.carbon:[[@LINE-14]]:24-30: note: initializing generic parameter `e` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_convert_multi_interface_facet_value_to_facet_value.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn Feed(unused generic e: Eats) {} + // CHECK:STDERR: · ───┬─── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `e` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Feed(Animal & Climbs); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `Animal & Climbs` into type implementing + // CHECK:STDERR: · ┃ `Eats` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Feed(Animal & Climbs); } diff --git a/toolchain/check/testdata/facet/early_impls.carbon b/toolchain/check/testdata/facet/early_impls.carbon index d305527cc3b3..0290ddcf8ed3 100644 --- a/toolchain/check/testdata/facet/early_impls.carbon +++ b/toolchain/check/testdata/facet/early_impls.carbon @@ -195,7 +195,13 @@ constraint N(V: type) { // `C impls N(.Z1)` gives `.Z1 impls Y(C)`. // -// CHECK:STDERR: fail_early_impl_named_constraint_gives_wrong_witness_for_different_self.carbon:[[@LINE+2]]:58-72: error: cannot convert type `.(Z(.Self).Z1)` into type implementing `Y(.Self)` [ConversionFailureTypeToFacet] +// CHECK:STDERR: ╭─┤ fail_early_impl_named_constraint_gives_wrong_witness_for_different_self.carbon:[[@LINE+8]]:58 +// CHECK:STDERR: -> │ fn F(generic _: Z(.Self) where C impls N(.Z1) and .Z2 = (.Z1 as Y(.Self))) {} +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: cannot convert type `.(Z(.Self).Z1)` into type implementing `Y(.Self)` +// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic _: Z(.Self) where C impls N(.Z1) and .Z2 = (.Z1 as Y(.Self))) {} @@ -265,8 +271,20 @@ interface S(T: type); // there should be replaced during the conversion. We show that it was replaced // because the `C impls Z(.Self)` constraint does not satisfy `C as Z(C)` so the // conversion fails. -// CHECK:STDERR: fail_early_impls_with_period_self_replaced.carbon:[[@LINE+3]]:56-63: error: cannot convert type `C` into type implementing `Z(.Self)` [ConversionFailureTypeToFacet] -// CHECK:STDERR: fail_early_impls_with_period_self_replaced.carbon:[[@LINE-10]]:1-25: note: while deducing parameters of generic declared here [DeductionGenericHere] +// CHECK:STDERR: ╭─┤ fail_early_impls_with_period_self_replaced.carbon:[[@LINE+15]]:56 +// CHECK:STDERR: │ class NeedZ(V: Z(.Self)); +// CHECK:STDERR: · ────────────┬──────────── +// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here +// CHECK:STDERR: · │ [DeductionGenericHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ ...sed generic T: type where C impls Z(.Self) and NeedZ(C) impls S(.Self)) {} +// CHECK:STDERR: · ┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot convert +// CHECK:STDERR: · ┃ type `C` into type +// CHECK:STDERR: · ┃ implementing +// CHECK:STDERR: · ┃ `Z(.Self)` +// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused generic T: type where C impls Z(.Self) and NeedZ(C) impls S(.Self)) {} diff --git a/toolchain/check/testdata/facet/early_rewrites.carbon b/toolchain/check/testdata/facet/early_rewrites.carbon index ab6542f31d87..f4b3830685df 100644 --- a/toolchain/check/testdata/facet/early_rewrites.carbon +++ b/toolchain/check/testdata/facet/early_rewrites.carbon @@ -29,8 +29,19 @@ class C(T: Z where .Z1 = ()) {} interface J { // Implied: .Z1 == () - // CHECK:STDERR: fail_todo_implied_constraint_on_self.carbon:[[@LINE+3]]:25-32: error: cannot convert type `.Self` that implements `Z` into type implementing `Z where .(Z.Z1) = ()` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_todo_implied_constraint_on_self.carbon:[[@LINE-5]]:9-27: note: initializing generic parameter `T` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_todo_implied_constraint_on_self.carbon:[[@LINE+14]]:25 + // CHECK:STDERR: │ class C(T: Z where .Z1 = ()) {} + // CHECK:STDERR: · ─────────┬───────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ let J1: Z where .Z2 = C(.Self); + // CHECK:STDERR: · ┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `.Self` that implements + // CHECK:STDERR: · ┃ `Z` into type implementing + // CHECK:STDERR: · ┃ `Z where .(Z.Z1) = ()` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let J1: Z where .Z2 = C(.Self); } @@ -39,8 +50,20 @@ fn F(unused generic T: J) {} class D; // Satisfies the implied constraint in J.J1. -// CHECK:STDERR: fail_todo_implied_constraint_on_self.carbon:[[@LINE+3]]:38-45: error: cannot convert type `.Self` that implements `Z` into type implementing `Z where .(Z.Z1) = ()` [ConversionFailureFacetToFacet] -// CHECK:STDERR: fail_todo_implied_constraint_on_self.carbon:[[@LINE-15]]:9-27: note: initializing generic parameter `T` declared here [InitializingGenericParam] +// CHECK:STDERR: ╭─┤ fail_todo_implied_constraint_on_self.carbon:[[@LINE+15]]:38 +// CHECK:STDERR: │ class C(T: Z where .Z1 = ()) {} +// CHECK:STDERR: · ─────────┬───────── +// CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here +// CHECK:STDERR: · │ [InitializingGenericParam] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ impl D as Z where .Z1 = () and .Z2 = C(.Self) {} +// CHECK:STDERR: · ┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot convert type `.Self` +// CHECK:STDERR: · ┃ that implements `Z` into type +// CHECK:STDERR: · ┃ implementing +// CHECK:STDERR: · ┃ `Z where .(Z.Z1) = ()` +// CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl D as Z where .Z1 = () and .Z2 = C(.Self) {} fn G(generic T: J where .J1 = D) { @@ -62,8 +85,18 @@ class C(T: Tuple) {} interface J { // Implied: .Z1 impls Tuple - // CHECK:STDERR: fail_todo_implied_constraint_on_associated_constant.carbon:[[@LINE+3]]:25-30: error: cannot convert type `.(Z.Z1)` into type implementing `Tuple` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_todo_implied_constraint_on_associated_constant.carbon:[[@LINE-5]]:9-16: note: initializing generic parameter `T` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_todo_implied_constraint_on_associated_constant.carbon:[[@LINE+13]]:25 + // CHECK:STDERR: │ class C(T: Tuple) {} + // CHECK:STDERR: · ────┬─── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ let J1: Z where .Z2 = C(.Z1); + // CHECK:STDERR: · ┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `.(Z.Z1)` into type + // CHECK:STDERR: · ┃ implementing `Tuple` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let J1: Z where .Z2 = C(.Z1); } @@ -101,9 +134,22 @@ class D; // // TODO: Right now the type of `U` ends up with an ImplSelfWitness // which does not resolve the access. So () can't convert to it. -// CHECK:STDERR: fail_todo_period_self_used_in_access_in_nested_specific.carbon:[[@LINE+4]]:38-50: error: cannot implicitly convert expression of type `type` to `.(Z.Z1)` [ConversionFailure] -// CHECK:STDERR: fail_todo_period_self_used_in_access_in_nested_specific.carbon:[[@LINE+3]]:38-50: note: type `type` does not implement interface `Core.ImplicitAs(.(Z.Z1))` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: fail_todo_period_self_used_in_access_in_nested_specific.carbon:[[@LINE-15]]:1-32: note: while deducing parameters of generic declared here [DeductionGenericHere] +// CHECK:STDERR: ╭─┤ fail_todo_period_self_used_in_access_in_nested_specific.carbon:[[@LINE+17]]:38 +// CHECK:STDERR: │ class C(T: Z & Y, U: T.(Z.Z1)) {} +// CHECK:STDERR: · ────────────────┬─────────────── +// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here +// CHECK:STDERR: · │ [DeductionGenericHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ impl D as Z where .Z1 = () and .Z2 = C(.Self, .Z1) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert +// CHECK:STDERR: · │ ┃ expression of type `type` to +// CHECK:STDERR: · │ ┃ `.(Z.Z1)` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╰────┤ type `type` does not implement +// CHECK:STDERR: · │ interface `Core.ImplicitAs(.(Z.Z1))` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl D as Z where .Z1 = () and .Z2 = C(.Self, .Z1) {} @@ -131,9 +177,21 @@ class D; // // TODO: Right now the type of `U` ends up with an ImplSelfWitness // which does not resolve the access. So `.Z1` can't convert to it. -// CHECK:STDERR: fail_todo_period_self_used_in_access_in_nested_specific_before_rewrite_of_access.carbon:[[@LINE+4]]:25-37: error: cannot implicitly convert expression of type `type` to `.(Z.Z1)` [ConversionFailure] -// CHECK:STDERR: fail_todo_period_self_used_in_access_in_nested_specific_before_rewrite_of_access.carbon:[[@LINE+3]]:25-37: note: type `type` does not implement interface `Core.ImplicitAs(.(Z.Z1))` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: fail_todo_period_self_used_in_access_in_nested_specific_before_rewrite_of_access.carbon:[[@LINE-15]]:1-32: note: while deducing parameters of generic declared here [DeductionGenericHere] +// CHECK:STDERR: ╭─┤ fail_todo_period_self_used_in_access_in_nested_specific_before_rewrite_of_access.carbon:[[@LINE+16]]:25 +// CHECK:STDERR: │ class C(T: Z & Y, U: T.(Z.Z1)) {} +// CHECK:STDERR: · ────────────────┬─────────────── +// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here +// CHECK:STDERR: · │ [DeductionGenericHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ impl D as Z where .Z2 = C(.Self, .Z1) and .Z1 = () {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type +// CHECK:STDERR: · │ ┃ `type` to `.(Z.Z1)` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╰────┤ type `type` does not implement interface +// CHECK:STDERR: · │ `Core.ImplicitAs(.(Z.Z1))` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl D as Z where .Z2 = C(.Self, .Z1) and .Z1 = () {} @@ -149,8 +207,20 @@ class C(T: Z where .Z1 = ()) {} interface J { // Implied: .Z1 == (), but this is also explicitly required for J1. - // CHECK:STDERR: fail_todo_nested_constraint_visible_in_type_parameter.carbon:[[@LINE+3]]:42-49: error: cannot convert type `.Self` that implements `Z` into type implementing `Z where .(Z.Z1) = ()` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_todo_nested_constraint_visible_in_type_parameter.carbon:[[@LINE-5]]:9-27: note: initializing generic parameter `T` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_todo_nested_constraint_visible_in_type_parameter.carbon:[[@LINE+15]]:42 + // CHECK:STDERR: │ class C(T: Z where .Z1 = ()) {} + // CHECK:STDERR: · ─────────┬───────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ let J1: (Z where .Z1 = ()) where .Z2 = C(.Self); + // CHECK:STDERR: · ┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `.Self` + // CHECK:STDERR: · ┃ that implements `Z` into + // CHECK:STDERR: · ┃ type implementing + // CHECK:STDERR: · ┃ `Z where .(Z.Z1) = ()` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let J1: (Z where .Z1 = ()) where .Z2 = C(.Self); } @@ -159,8 +229,20 @@ fn F(unused generic T: J) {} class D; // Satisfies the implied constraint in J.J1. -// CHECK:STDERR: fail_todo_nested_constraint_visible_in_type_parameter.carbon:[[@LINE+3]]:38-45: error: cannot convert type `.Self` that implements `Z` into type implementing `Z where .(Z.Z1) = ()` [ConversionFailureFacetToFacet] -// CHECK:STDERR: fail_todo_nested_constraint_visible_in_type_parameter.carbon:[[@LINE-15]]:9-27: note: initializing generic parameter `T` declared here [InitializingGenericParam] +// CHECK:STDERR: ╭─┤ fail_todo_nested_constraint_visible_in_type_parameter.carbon:[[@LINE+15]]:38 +// CHECK:STDERR: │ class C(T: Z where .Z1 = ()) {} +// CHECK:STDERR: · ─────────┬───────── +// CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here +// CHECK:STDERR: · │ [InitializingGenericParam] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ impl D as Z where .Z1 = () and .Z2 = C(.Self) {} +// CHECK:STDERR: · ┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot convert type `.Self` +// CHECK:STDERR: · ┃ that implements `Z` into type +// CHECK:STDERR: · ┃ implementing +// CHECK:STDERR: · ┃ `Z where .(Z.Z1) = ()` +// CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl D as Z where .Z1 = () and .Z2 = C(.Self) {} fn G(generic T: J where .J1 = D) { @@ -179,8 +261,19 @@ class C(T: Z where .Z1 = ()) {} interface J { // Implied: .Z1 == (), but this is also explicitly required for J1. - // CHECK:STDERR: fail_todo_outer_nested_constraint_visible_in_type_parameter.carbon:[[@LINE+3]]:26-33: error: cannot convert type `.Self` that implements `Z` into type implementing `Z where .(Z.Z1) = ()` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_todo_outer_nested_constraint_visible_in_type_parameter.carbon:[[@LINE-5]]:9-27: note: initializing generic parameter `T` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_todo_outer_nested_constraint_visible_in_type_parameter.carbon:[[@LINE+14]]:26 + // CHECK:STDERR: │ class C(T: Z where .Z1 = ()) {} + // CHECK:STDERR: · ─────────┬───────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ let J1: (Z where .Z2 = C(.Self)) where .Z1 = (); + // CHECK:STDERR: · ┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `.Self` that implements + // CHECK:STDERR: · ┃ `Z` into type implementing + // CHECK:STDERR: · ┃ `Z where .(Z.Z1) = ()` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let J1: (Z where .Z2 = C(.Self)) where .Z1 = (); } @@ -189,8 +282,20 @@ fn F(unused generic T: J) {} class D; // Satisfies the implied constraint in J.J1. -// CHECK:STDERR: fail_todo_outer_nested_constraint_visible_in_type_parameter.carbon:[[@LINE+3]]:38-45: error: cannot convert type `.Self` that implements `Z` into type implementing `Z where .(Z.Z1) = ()` [ConversionFailureFacetToFacet] -// CHECK:STDERR: fail_todo_outer_nested_constraint_visible_in_type_parameter.carbon:[[@LINE-15]]:9-27: note: initializing generic parameter `T` declared here [InitializingGenericParam] +// CHECK:STDERR: ╭─┤ fail_todo_outer_nested_constraint_visible_in_type_parameter.carbon:[[@LINE+15]]:38 +// CHECK:STDERR: │ class C(T: Z where .Z1 = ()) {} +// CHECK:STDERR: · ─────────┬───────── +// CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here +// CHECK:STDERR: · │ [InitializingGenericParam] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ impl D as Z where .Z1 = () and .Z2 = C(.Self) {} +// CHECK:STDERR: · ┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot convert type `.Self` +// CHECK:STDERR: · ┃ that implements `Z` into type +// CHECK:STDERR: · ┃ implementing +// CHECK:STDERR: · ┃ `Z where .(Z.Z1) = ()` +// CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl D as Z where .Z1 = () and .Z2 = C(.Self) {} fn G(generic T: J where .J1 = D) { @@ -209,8 +314,20 @@ class C(T: Z where .Z1 = ()) {} interface J { // Implied: .Z1 == (), but this is also explicitly required for J1. - // CHECK:STDERR: fail_todo_earlier_constraint_visible_in_type_parameter.carbon:[[@LINE+3]]:38-45: error: cannot convert type `.Self` that implements `Z` into type implementing `Z where .(Z.Z1) = ()` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_todo_earlier_constraint_visible_in_type_parameter.carbon:[[@LINE-5]]:9-27: note: initializing generic parameter `T` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_todo_earlier_constraint_visible_in_type_parameter.carbon:[[@LINE+15]]:38 + // CHECK:STDERR: │ class C(T: Z where .Z1 = ()) {} + // CHECK:STDERR: · ─────────┬───────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ let J1: Z where .Z1 = () and .Z2 = C(.Self); + // CHECK:STDERR: · ┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `.Self` + // CHECK:STDERR: · ┃ that implements `Z` into type + // CHECK:STDERR: · ┃ implementing + // CHECK:STDERR: · ┃ `Z where .(Z.Z1) = ()` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let J1: Z where .Z1 = () and .Z2 = C(.Self); } @@ -219,8 +336,20 @@ fn F(unused generic T: J) {} class D; // Satisfies the implied constraint in J.J1. -// CHECK:STDERR: fail_todo_earlier_constraint_visible_in_type_parameter.carbon:[[@LINE+3]]:38-45: error: cannot convert type `.Self` that implements `Z` into type implementing `Z where .(Z.Z1) = ()` [ConversionFailureFacetToFacet] -// CHECK:STDERR: fail_todo_earlier_constraint_visible_in_type_parameter.carbon:[[@LINE-15]]:9-27: note: initializing generic parameter `T` declared here [InitializingGenericParam] +// CHECK:STDERR: ╭─┤ fail_todo_earlier_constraint_visible_in_type_parameter.carbon:[[@LINE+15]]:38 +// CHECK:STDERR: │ class C(T: Z where .Z1 = ()) {} +// CHECK:STDERR: · ─────────┬───────── +// CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here +// CHECK:STDERR: · │ [InitializingGenericParam] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ impl D as Z where .Z1 = () and .Z2 = C(.Self) {} +// CHECK:STDERR: · ┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot convert type `.Self` +// CHECK:STDERR: · ┃ that implements `Z` into type +// CHECK:STDERR: · ┃ implementing +// CHECK:STDERR: · ┃ `Z where .(Z.Z1) = ()` +// CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl D as Z where .Z1 = () and .Z2 = C(.Self) {} fn G(generic T: J where .J1 = D) { @@ -239,8 +368,19 @@ class C(T: Z where .Z1 = ()) {} interface J { // Implied: .Z1 == (), but this is also explicitly required for J1. - // CHECK:STDERR: fail_todo_later_constraint_visible_in_type_parameter.carbon:[[@LINE+3]]:25-32: error: cannot convert type `.Self` that implements `Z` into type implementing `Z where .(Z.Z1) = ()` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_todo_later_constraint_visible_in_type_parameter.carbon:[[@LINE-5]]:9-27: note: initializing generic parameter `T` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_todo_later_constraint_visible_in_type_parameter.carbon:[[@LINE+14]]:25 + // CHECK:STDERR: │ class C(T: Z where .Z1 = ()) {} + // CHECK:STDERR: · ─────────┬───────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ let J1: Z where .Z2 = C(.Self) and .Z1 = (); + // CHECK:STDERR: · ┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `.Self` that implements + // CHECK:STDERR: · ┃ `Z` into type implementing + // CHECK:STDERR: · ┃ `Z where .(Z.Z1) = ()` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let J1: Z where .Z2 = C(.Self) and .Z1 = (); } @@ -249,8 +389,20 @@ fn F(unused generic T: J) {} class D; // Satisfies the implied constraint in J.J1. -// CHECK:STDERR: fail_todo_later_constraint_visible_in_type_parameter.carbon:[[@LINE+3]]:38-45: error: cannot convert type `.Self` that implements `Z` into type implementing `Z where .(Z.Z1) = ()` [ConversionFailureFacetToFacet] -// CHECK:STDERR: fail_todo_later_constraint_visible_in_type_parameter.carbon:[[@LINE-15]]:9-27: note: initializing generic parameter `T` declared here [InitializingGenericParam] +// CHECK:STDERR: ╭─┤ fail_todo_later_constraint_visible_in_type_parameter.carbon:[[@LINE+15]]:38 +// CHECK:STDERR: │ class C(T: Z where .Z1 = ()) {} +// CHECK:STDERR: · ─────────┬───────── +// CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here +// CHECK:STDERR: · │ [InitializingGenericParam] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ impl D as Z where .Z1 = () and .Z2 = C(.Self) {} +// CHECK:STDERR: · ┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot convert type `.Self` +// CHECK:STDERR: · ┃ that implements `Z` into type +// CHECK:STDERR: · ┃ implementing +// CHECK:STDERR: · ┃ `Z where .(Z.Z1) = ()` +// CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl D as Z where .Z1 = () and .Z2 = C(.Self) {} fn G(generic T: J where .J1 = D) { @@ -387,10 +539,23 @@ fn F(unused generic T: J) {} class D; // Satisfies the implied constraint in J.J1. impl D as Y where .Y1 = () {} -// CHECK:STDERR: fail_todo_resolved_constraint_visible_in_type_parameter.carbon:[[@LINE+2]]:25-29: error: cannot convert type `.Self` that implements `Z` into type implementing `Y` [ConversionFailureFacetToFacet] +// CHECK:STDERR: ╭─┤ fail_todo_resolved_constraint_visible_in_type_parameter.carbon:[[@LINE+8]]:25 +// CHECK:STDERR: -> │ impl D as Z where .Z1 = .Self and .Z2 = () and .Z3 = C(()) {} +// CHECK:STDERR: · ┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot convert type `.Self` that implements +// CHECK:STDERR: · ┃ `Z` into type implementing `Y` +// CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl D as Z where .Z1 = .Self and .Z2 = () and .Z3 = C(()) {} -// CHECK:STDERR: fail_todo_resolved_constraint_visible_in_type_parameter.carbon:[[@LINE+2]]:31: error: cannot convert type `D` into type implementing `Y & Z where .(Y.Y1) = () and .(Z.Z1) = .Self as Y and .(Z.Z2) = () and .(Z.Z3) = C(() as Tuple)` [ConversionFailureTypeToFacet] +// CHECK:STDERR: ╭─┤ fail_todo_resolved_constraint_visible_in_type_parameter.carbon:[[@LINE+9]]:31 +// CHECK:STDERR: -> │ fn G(generic T: J where .J1 = D) { +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: cannot convert type `D` into type implementing +// CHECK:STDERR: · ┃ `Y & Z where .(Y.Y1) = () and .(Z.Z1) = .Self as Y and .(Z.Z2) = () and .(Z.Z3) = C(() as Tuple)` +// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn G(generic T: J where .J1 = D) { F(T); @@ -415,8 +580,18 @@ constraint NY(V: type) { extend require impls Y where .Y1 = V; } -// CHECK:STDERR: fail_todo_early_rewrite_from_previous_impls_constraint.carbon:[[@LINE+3]]:59-71: error: cannot convert type `.(Z.Z1).(Y.Y1)` into type implementing `Tuple` [ConversionFailureTypeToFacet] -// CHECK:STDERR: fail_todo_early_rewrite_from_previous_impls_constraint.carbon:[[@LINE-7]]:9-16: note: initializing generic parameter `U` declared here [InitializingGenericParam] +// CHECK:STDERR: ╭─┤ fail_todo_early_rewrite_from_previous_impls_constraint.carbon:[[@LINE+13]]:59 +// CHECK:STDERR: │ class C(U: Tuple); +// CHECK:STDERR: · ────┬─── +// CHECK:STDERR: · ╰──┤ initializing generic parameter `U` declared here +// CHECK:STDERR: · │ [InitializingGenericParam] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn F(unused generic T: Z where .Z1 impls NY(()) and .Z2 = C(.Z1.(Y.Y1))) {} +// CHECK:STDERR: · ━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: cannot convert type `.(Z.Z1).(Y.Y1)` into type implementing `Tuple` +// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused generic T: Z where .Z1 impls NY(()) and .Z2 = C(.Z1.(Y.Y1))) {} @@ -442,8 +617,18 @@ constraint NY(V: type) { // This should fail: `T.(Y.Y1)` is rewritten to be `()` but `T.(Z.Z1).(Y.Y1)` // is used in the argument to `C`. // -// CHECK:STDERR: fail_early_rewrite_correct_interface_wrong_self_access_rewrite_in_period_self.carbon:[[@LINE+3]]:77-89: error: cannot convert type `.(Z.Z1).(Y.Y1)` into type implementing `Tuple` [ConversionFailureTypeToFacet] -// CHECK:STDERR: fail_early_rewrite_correct_interface_wrong_self_access_rewrite_in_period_self.carbon:[[@LINE-10]]:9-16: note: initializing generic parameter `U` declared here [InitializingGenericParam] +// CHECK:STDERR: ╭─┤ fail_early_rewrite_correct_interface_wrong_self_access_rewrite_in_period_self.carbon:[[@LINE+13]]:77 +// CHECK:STDERR: │ class C(U: Tuple); +// CHECK:STDERR: · ────┬─── +// CHECK:STDERR: · ╰──┤ initializing generic parameter `U` declared here +// CHECK:STDERR: · │ [InitializingGenericParam] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ ... T: Z where .Self impls NY(()) and .Z1 impls Y and .Z2 = C(.Z1.(Y.Y1))) {} +// CHECK:STDERR: · ━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: cannot convert type `.(Z.Z1).(Y.Y1)` into type implementing `Tuple` +// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused generic T: Z where .Self impls NY(()) and .Z1 impls Y and .Z2 = C(.Z1.(Y.Y1))) {} @@ -469,7 +654,15 @@ constraint NY(V: type) { // This should fail: `T.(Z.Z1).(Y.Y1)` is rewritten to be `()` but `T.(Y.Y1)` is used // in the argument to `C`. // -// CHECK:STDERR: fail_early_rewrite_correct_interface_wrong_self_access_rewrite_in_associated_constant.carbon:[[@LINE+2]]:79-82: error: name `Self` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_early_rewrite_correct_interface_wrong_self_access_rewrite_in_associated_constant.carbon:[[@LINE+10]]:79 +// CHECK:STDERR: -> │ ...T: Z where .Z1 impls NY(()) and .Self impls Y and .Z2 = C(Self.(Y.Y1))) {} +// CHECK:STDERR: · ┳━━━ +// CHECK:STDERR: · ┗━━┫ error: name +// CHECK:STDERR: · ┃ `Self` +// CHECK:STDERR: · ┃ not +// CHECK:STDERR: · ┃ found +// CHECK:STDERR: · ┃ [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn G(unused generic T: Z where .Z1 impls NY(()) and .Self impls Y and .Z2 = C(Self.(Y.Y1))) {} diff --git a/toolchain/check/testdata/facet/facet_assoc_const.carbon b/toolchain/check/testdata/facet/facet_assoc_const.carbon index f082da21438c..382bf43db86e 100644 --- a/toolchain/check/testdata/facet/facet_assoc_const.carbon +++ b/toolchain/check/testdata/facet/facet_assoc_const.carbon @@ -29,7 +29,13 @@ library "[[@TEST_NAME]]"; interface L { let W: type; } -// CHECK:STDERR: fail_two_different.carbon:[[@LINE+2]]:24-50: error: associated constant `.(L.W)` given two different values `{}` and `()` [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╭─┤ fail_two_different.carbon:[[@LINE+8]]:24 +// CHECK:STDERR: -> │ fn F(unused generic T: L where .W = {} and .W = ()) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: associated constant `.(L.W)` given two +// CHECK:STDERR: · ┃ different values `{}` and `()` +// CHECK:STDERR: · ┃ [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused generic T: L where .W = {} and .W = ()) {} @@ -38,7 +44,13 @@ library "[[@TEST_NAME]]"; interface L { let W: type; let X: type; } -// CHECK:STDERR: fail_two_different_first_associated.carbon:[[@LINE+2]]:24-50: error: associated constant `.(L.W)` given two different values `()` and `.(L.X)` [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╭─┤ fail_two_different_first_associated.carbon:[[@LINE+8]]:24 +// CHECK:STDERR: -> │ fn F(unused generic T: L where .W = .X and .W = ()) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: associated constant `.(L.W)` given two +// CHECK:STDERR: · ┃ different values `()` and `.(L.X)` +// CHECK:STDERR: · ┃ [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused generic T: L where .W = .X and .W = ()) {} @@ -47,7 +59,13 @@ library "[[@TEST_NAME]]"; interface L { let W: type; let X: type; } -// CHECK:STDERR: fail_two_different_second_associated.carbon:[[@LINE+2]]:24-50: error: associated constant `.(L.W)` given two different values `()` and `.(L.X)` [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╭─┤ fail_two_different_second_associated.carbon:[[@LINE+8]]:24 +// CHECK:STDERR: -> │ fn F(unused generic T: L where .W = () and .W = .X) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: associated constant `.(L.W)` given two +// CHECK:STDERR: · ┃ different values `()` and `.(L.X)` +// CHECK:STDERR: · ┃ [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused generic T: L where .W = () and .W = .X) {} @@ -56,7 +74,12 @@ library "[[@TEST_NAME]]"; interface L { let W: type; } -// CHECK:STDERR: fail_two_different_first_bad.carbon:[[@LINE+2]]:37-40: error: name `BAD5` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_two_different_first_bad.carbon:[[@LINE+7]]:37 +// CHECK:STDERR: -> │ fn F(unused generic T: L where .W = BAD5 and .W = ()) {} +// CHECK:STDERR: · ━━┳━ +// CHECK:STDERR: · ┗━━┫ error: name `BAD5` not found +// CHECK:STDERR: · ┃ [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused generic T: L where .W = BAD5 and .W = ()) {} @@ -65,7 +88,13 @@ library "[[@TEST_NAME]]"; interface L { let W: type; } -// CHECK:STDERR: fail_two_different_second_bad.carbon:[[@LINE+2]]:49-52: error: name `BAD6` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_two_different_second_bad.carbon:[[@LINE+8]]:49 +// CHECK:STDERR: -> │ fn F(unused generic T: L where .W = {} and .W = BAD6) {} +// CHECK:STDERR: · ┳━━━ +// CHECK:STDERR: · ┗━━┫ error: name `BAD6` not +// CHECK:STDERR: · ┃ found +// CHECK:STDERR: · ┃ [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused generic T: L where .W = {} and .W = BAD6) {} @@ -74,9 +103,20 @@ library "[[@TEST_NAME]]"; interface L { let W: type; } -// CHECK:STDERR: fail_two_different_both_bad.carbon:[[@LINE+4]]:37-40: error: name `BAD7` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_two_different_both_bad.carbon:[[@LINE+15]]:37 +// CHECK:STDERR: -> │ fn F(unused generic T: L where .W = BAD7 and .W = BAD8) {} +// CHECK:STDERR: · ━━┳━ +// CHECK:STDERR: · ┗━━┫ error: name `BAD7` not found +// CHECK:STDERR: · ┃ [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_two_different_both_bad.carbon:[[@LINE+2]]:51-54: error: name `BAD8` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_two_different_both_bad.carbon:[[@LINE+8]]:51 +// CHECK:STDERR: -> │ fn F(unused generic T: L where .W = BAD7 and .W = BAD8) {} +// CHECK:STDERR: · ┳━━━ +// CHECK:STDERR: · ┗━━┫ error: name `BAD8` not +// CHECK:STDERR: · ┃ found +// CHECK:STDERR: · ┃ [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused generic T: L where .W = BAD7 and .W = BAD8) {} @@ -85,7 +125,13 @@ library "[[@TEST_NAME]]"; interface L { let W: type; } -// CHECK:STDERR: fail_two_different_combined_from_bitand.carbon:[[@LINE+2]]:24-60: error: associated constant `.(L.W)` given two different values `{}` and `()` [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╭─┤ fail_two_different_combined_from_bitand.carbon:[[@LINE+8]]:24 +// CHECK:STDERR: -> │ fn F(unused generic T: (L where .W = {}) & (L where .W = ())) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: associated constant `.(L.W)` given two +// CHECK:STDERR: · ┃ different values `{}` and `()` +// CHECK:STDERR: · ┃ [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused generic T: (L where .W = {}) & (L where .W = ())) {} @@ -129,8 +175,19 @@ fn F(generic T: M & (L where .W = {}), a: T.W) { // likely to show up in diagnostics? Or should we diagnose `T` as being // invalid directly, where we can see both `.W` values and print them? // - // CHECK:STDERR: fail_two_different_combined_from_final_impl_and_facet.carbon:[[@LINE+3]]:22-28: error: cannot convert type `T` that implements `L & M where .(L.W) = {}` into type implementing `L where .(L.W) = {}` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_two_different_combined_from_final_impl_and_facet.carbon:[[@LINE-13]]:14-31: note: initializing generic parameter `T` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_two_different_combined_from_final_impl_and_facet.carbon:[[@LINE+14]]:22 + // CHECK:STDERR: │ fn H(generic T: L where .W = {}, a: T.W) -> {} { return a; } + // CHECK:STDERR: · ─────────┬──────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ let unused c: {} = H(T, a); + // CHECK:STDERR: · ┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `T` that implements + // CHECK:STDERR: · ┃ `L & M where .(L.W) = {}` into type + // CHECK:STDERR: · ┃ implementing `L where .(L.W) = {}` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused c: {} = H(T, a); } @@ -140,7 +197,14 @@ library "[[@TEST_NAME]]"; interface L { let W: type; } -// CHECK:STDERR: fail_many_different.carbon:[[@LINE+2]]:24-114: error: associated constant `.(L.W)` given two different values `((), (), ())` and `({}, (), ())` [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╭─┤ fail_many_different.carbon:[[@LINE+9]]:24 +// CHECK:STDERR: -> │ ...unused generic T: L where .W = ((), (), ()) and .W = ({}, (), ()) and .W =... +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: associated constant `.(L.W)` given two +// CHECK:STDERR: · ┃ different values `((), (), ())` and +// CHECK:STDERR: · ┃ `({}, (), ())` +// CHECK:STDERR: · ┃ [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn G(unused generic T: L where .W = ((), (), ()) and .W = ({}, (), ()) and .W = ({}, {}, ()) and .W = ({}, (), {})) {} @@ -158,7 +222,15 @@ library "[[@TEST_NAME]]"; interface M { let X: type; let Y: type; } -// CHECK:STDERR: fail_rewrite_conflicts_with_second_facet.carbon:[[@LINE+2]]:52-79: error: associated constant `.(M.Y)` given two different values `T.(M.X)` and `.(M.X)` [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╭─┤ fail_rewrite_conflicts_with_second_facet.carbon:[[@LINE+10]]:52 +// CHECK:STDERR: -> │ ...ric T: M where .X = (), unused generic U: M where .Y = T.X and .Y = .X) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: associated constant +// CHECK:STDERR: · ┃ `.(M.Y)` given two +// CHECK:STDERR: · ┃ different values +// CHECK:STDERR: · ┃ `T.(M.X)` and `.(M.X)` +// CHECK:STDERR: · ┃ [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic T: M where .X = (), unused generic U: M where .Y = T.X and .Y = .X) {} @@ -216,7 +288,13 @@ library "[[@TEST_NAME]]"; interface M { let X: type; } -// CHECK:STDERR: fail_repeated_and_different.carbon:[[@LINE+2]]:24-62: error: associated constant `.(M.X)` given two different values `{}` and `()` [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╭─┤ fail_repeated_and_different.carbon:[[@LINE+8]]:24 +// CHECK:STDERR: -> │ fn F(unused generic T: M where .X = {} and .X = () and .X = {}) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: associated constant `.(M.X)` given two +// CHECK:STDERR: · ┃ different values `{}` and `()` +// CHECK:STDERR: · ┃ [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused generic T: M where .X = {} and .X = () and .X = {}) {} @@ -227,14 +305,26 @@ interface M { let X: type; } // This fails because it resolves to `.X = .X` which is cyclical. // -// CHECK:STDERR: fail_cycle_single.carbon:[[@LINE+2]]:24-38: error: found cycle in facet type constraint for `.(M.X)` [FacetTypeConstraintCycle] +// CHECK:STDERR: ╭─┤ fail_cycle_single.carbon:[[@LINE+8]]:24 +// CHECK:STDERR: -> │ fn F(unused generic T: M where .X = .X) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: found cycle in facet type constraint for +// CHECK:STDERR: · ┃ `.(M.X)` +// CHECK:STDERR: · ┃ [FacetTypeConstraintCycle] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused generic T: M where .X = .X) {} // Even though `.X = ()` is specified, the rewrites are resolved left to right // and a cycle `.X = .X` is found first. // -// CHECK:STDERR: fail_cycle_single.carbon:[[@LINE+2]]:24-50: error: found cycle in facet type constraint for `.(M.X)` [FacetTypeConstraintCycle] +// CHECK:STDERR: ╭─┤ fail_cycle_single.carbon:[[@LINE+8]]:24 +// CHECK:STDERR: -> │ fn G(unused generic T: M where .X = .X and .X = ()) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: found cycle in facet type constraint for +// CHECK:STDERR: · ┃ `.(M.X)` +// CHECK:STDERR: · ┃ [FacetTypeConstraintCycle] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn G(unused generic T: M where .X = .X and .X = ()) {} @@ -247,7 +337,13 @@ interface M { let X: type; let Y: type; let Z: type; } // The value of .X and .Y becomes but .Z is still valid. // //@dump-sem-ir-begin -// CHECK:STDERR: fail_cycle.carbon:[[@LINE+2]]:24-62: error: found cycle in facet type constraint for `.(M.Y)` [FacetTypeConstraintCycle] +// CHECK:STDERR: ╭─┤ fail_cycle.carbon:[[@LINE+8]]:24 +// CHECK:STDERR: -> │ fn F(unused generic T: M where .X = .Y and .Y = .X and .Z = ()) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: found cycle in facet type constraint for +// CHECK:STDERR: · ┃ `.(M.Y)` +// CHECK:STDERR: · ┃ [FacetTypeConstraintCycle] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused generic T: M where .X = .Y and .Y = .X and .Z = ()) {} //@dump-sem-ir-end @@ -265,7 +361,13 @@ interface J { // This fails because it resolves to `.X1 = .X1` which is cyclical. // -// CHECK:STDERR: fail_cycle_between_interfaces.carbon:[[@LINE+2]]:24-72: error: found cycle in facet type constraint for `.(J.X3)` [FacetTypeConstraintCycle] +// CHECK:STDERR: ╭─┤ fail_cycle_between_interfaces.carbon:[[@LINE+8]]:24 +// CHECK:STDERR: -> │ fn G(unused generic T: I & J where .X1 = .X3 and .X2 = .X1 and .X3 = .X2) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: found cycle in facet type constraint for +// CHECK:STDERR: · ┃ `.(J.X3)` +// CHECK:STDERR: · ┃ [FacetTypeConstraintCycle] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn G(unused generic T: I & J where .X1 = .X3 and .X2 = .X1 and .X3 = .X2) {} @@ -279,14 +381,24 @@ interface I { // This fails because it resolves to `.X1 = .X1**` which is cyclical. // -// CHECK:STDERR: fail_indirect_cycle.carbon:[[@LINE+2]]:17-49: error: found cycle in facet type constraint for `.(I.X2)` [FacetTypeConstraintCycle] +// CHECK:STDERR: ╭─┤ fail_indirect_cycle.carbon:[[@LINE+7]]:17 +// CHECK:STDERR: -> │ fn F(generic T: I where .X1 = .X2* and .X2 = .X1*); +// CHECK:STDERR: · ━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: found cycle in facet type constraint for `.(I.X2)` +// CHECK:STDERR: · ┃ [FacetTypeConstraintCycle] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic T: I where .X1 = .X2* and .X2 = .X1*); class C(T: type); // This fails because it resolves to `.X1 = C(C(.X1))` which is cyclical. // -// CHECK:STDERR: fail_indirect_cycle.carbon:[[@LINE+2]]:17-53: error: found cycle in facet type constraint for `.(I.X2)` [FacetTypeConstraintCycle] +// CHECK:STDERR: ╭─┤ fail_indirect_cycle.carbon:[[@LINE+7]]:17 +// CHECK:STDERR: -> │ fn G(generic T: I where .X1 = C(.X2) and .X2 = C(.X1)); +// CHECK:STDERR: · ━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: found cycle in facet type constraint for `.(I.X2)` +// CHECK:STDERR: · ┃ [FacetTypeConstraintCycle] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn G(generic T: I where .X1 = C(.X2) and .X2 = C(.X1)); @@ -304,7 +416,12 @@ class C(T: type, U: type); // This fails because it resolves to `.X1 = C(C(.X3, .X1), .X3)` which is // cyclical. // -// CHECK:STDERR: fail_complex_indirect_cycle.carbon:[[@LINE+2]]:17-63: error: found cycle in facet type constraint for `.(I.X2)` [FacetTypeConstraintCycle] +// CHECK:STDERR: ╭─┤ fail_complex_indirect_cycle.carbon:[[@LINE+7]]:17 +// CHECK:STDERR: -> │ fn F(generic T: I where .X1 = C(.X2, .X3) and .X2 = C(.X3, .X1)); +// CHECK:STDERR: · ━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: found cycle in facet type constraint for `.(I.X2)` +// CHECK:STDERR: · ┃ [FacetTypeConstraintCycle] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic T: I where .X1 = C(.X2, .X3) and .X2 = C(.X3, .X1)); @@ -363,7 +480,12 @@ interface Z { // approach can recursively rebuild the RHS values from the ground up // repeatedly. fn F( - // CHECK:STDERR: fail_exponential_large_cycle.carbon:[[@LINE+2]]:16-22: error: found cycle in facet type constraint for `.(Z.T0)` [FacetTypeConstraintCycle] + // CHECK:STDERR: ╭─┤ fail_exponential_large_cycle.carbon:[[@LINE+7]]:16 + // CHECK:STDERR: -> │ generic T: Z where + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: found cycle in facet type constraint for `.(Z.T0)` + // CHECK:STDERR: · ┃ [FacetTypeConstraintCycle] + // CHECK:STDERR: ╰──── // CHECK:STDERR: generic T: Z where .T9 = .T0 and @@ -403,7 +525,13 @@ interface N { let Y: {.a: type}; } -// CHECK:STDERR: fail_non-type_different.carbon:[[@LINE+2]]:24-64: error: associated constant `.(N.Y)` given two different values `{.a = {}}` and `{.a = ()}` [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╭─┤ fail_non-type_different.carbon:[[@LINE+8]]:24 +// CHECK:STDERR: -> │ fn F(unused generic T: N where .Y = {.a = {}} and .Y = {.a = ()}) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: associated constant `.(N.Y)` given two +// CHECK:STDERR: · ┃ different values `{.a = {}}` and `{.a = ()}` +// CHECK:STDERR: · ┃ [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused generic T: N where .Y = {.a = {}} and .Y = {.a = ()}) {} @@ -435,7 +563,13 @@ interface Z { let U: Z; } -// CHECK:STDERR: fail_cycle_through_self_reference.carbon:[[@LINE+2]]:24-55: error: found cycle in facet type constraint for `.(Z.T)` [FacetTypeConstraintCycle] +// CHECK:STDERR: ╭─┤ fail_cycle_through_self_reference.carbon:[[@LINE+8]]:24 +// CHECK:STDERR: -> │ fn F(unused generic A: Z where .T = .U.T and .U = .Self) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: found cycle in facet type constraint for +// CHECK:STDERR: · ┃ `.(Z.T)` +// CHECK:STDERR: · ┃ [FacetTypeConstraintCycle] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused generic A: Z where .T = .U.T and .U = .Self) {} @@ -472,7 +606,13 @@ interface Z { let T3: type; } -// CHECK:STDERR: fail_cycle_with_unrelated_associated_constant.carbon:[[@LINE+2]]:24-68: error: found cycle in facet type constraint for `.(Z.T1)` [FacetTypeConstraintCycle] +// CHECK:STDERR: ╭─┤ fail_cycle_with_unrelated_associated_constant.carbon:[[@LINE+8]]:24 +// CHECK:STDERR: -> │ fn F(unused generic T: Z where .T0 = .T1 and .T1 = .T0 and .T2 = .T3) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: found cycle in facet type constraint for +// CHECK:STDERR: · ┃ `.(Z.T1)` +// CHECK:STDERR: · ┃ [FacetTypeConstraintCycle] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused generic T: Z where .T0 = .T1 and .T1 = .T0 and .T2 = .T3) {} @@ -489,11 +629,23 @@ interface Z { // TODO: There should only be one diagnostic here. // -// CHECK:STDERR: fail_cycle_with_branching_in_rhs.carbon:[[@LINE+2]]:24-89: error: found cycle in facet type constraint for `.(Z.T3)` [FacetTypeConstraintCycle] +// CHECK:STDERR: ╭─┤ fail_cycle_with_branching_in_rhs.carbon:[[@LINE+8]]:24 +// CHECK:STDERR: -> │ ...unused generic T: Z where .T0 = .T1 and .T1 = (.T2, .T3) and .T2 = .T4 and... +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: found cycle in facet type constraint for +// CHECK:STDERR: · ┃ `.(Z.T3)` +// CHECK:STDERR: · ┃ [FacetTypeConstraintCycle] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused generic T: Z where .T0 = .T1 and .T1 = (.T2, .T3) and .T2 = .T4 and .T3 = .T1) {} -// CHECK:STDERR: fail_cycle_with_branching_in_rhs.carbon:[[@LINE+2]]:24-89: error: found cycle in facet type constraint for `.(Z.T1)` [FacetTypeConstraintCycle] +// CHECK:STDERR: ╭─┤ fail_cycle_with_branching_in_rhs.carbon:[[@LINE+8]]:24 +// CHECK:STDERR: -> │ ...unused generic T: Z where .T0 = .T1 and .T1 = (.T2, .T3) and .T2 = .T4 and... +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: found cycle in facet type constraint for +// CHECK:STDERR: · ┃ `.(Z.T1)` +// CHECK:STDERR: · ┃ [FacetTypeConstraintCycle] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn G(unused generic T: Z where .T0 = .T1 and .T1 = (.T2, .T3) and .T2 = .T4 and .T3 = .T0) {} @@ -618,57 +770,57 @@ fn F(unused generic T: I & J where .I1 = .J1.I2) {} // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] { // CHECK:STDOUT: %T.patt: = symbolic_binding_pattern T, 0 [concrete = ] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc11_26.1: type = splice_block %.loc11_26.2 [concrete = ] { -// CHECK:STDOUT: %.Self.frozen.loc11_22: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen.e58] +// CHECK:STDOUT: %.loc17_26.1: type = splice_block %.loc17_26.2 [concrete = ] { +// CHECK:STDOUT: %.Self.frozen.loc17_22: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen.e58] // CHECK:STDOUT: %M.ref: type = name_ref M, file.%M.decl [concrete = constants.%M.type] -// CHECK:STDOUT: %.Self.frozen.loc11_26: %M.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen.1cb] +// CHECK:STDOUT: %.Self.frozen.loc17_26: %M.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen.1cb] // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %M.ref [concrete] -// CHECK:STDOUT: %.Self.ref.loc11_32: %M.type = name_ref .Self, %.Self.frozen.loc11_26 [symbolic_self = constants.%.Self.frozen.1cb] -// CHECK:STDOUT: %.Self.as_type.loc11_32: type = facet_access_type %.Self.ref.loc11_32 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc11_32: type = converted %.Self.ref.loc11_32, %.Self.as_type.loc11_32 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %X.ref.loc11_32: %M.assoc_type = name_ref X, @X.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc11_32.1: type = impl_witness_access constants.%M.lookup_impl_witness.beb, element0 [symbolic_self = constants.%impl.elem0.352] -// CHECK:STDOUT: %.Self.ref.loc11_37: %M.type = name_ref .Self, %.Self.frozen.loc11_26 [symbolic_self = constants.%.Self.frozen.1cb] -// CHECK:STDOUT: %.Self.as_type.loc11_37: type = facet_access_type %.Self.ref.loc11_37 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc11_37: type = converted %.Self.ref.loc11_37, %.Self.as_type.loc11_37 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %Y.ref.loc11_37: %M.assoc_type = name_ref Y, @Y.%assoc1 [concrete = constants.%assoc1] -// CHECK:STDOUT: %impl.elem1.loc11_37.1: type = impl_witness_access constants.%M.lookup_impl_witness.beb, element1 [symbolic_self = constants.%impl.elem1.66c] -// CHECK:STDOUT: %rewrite.loc11_35.1 = requirement_rewrite %impl.elem0.loc11_32.1, %impl.elem1.loc11_37.1 [concrete] -// CHECK:STDOUT: %.Self.ref.loc11_44: %M.type = name_ref .Self, %.Self.frozen.loc11_26 [symbolic_self = constants.%.Self.frozen.1cb] -// CHECK:STDOUT: %.Self.as_type.loc11_44: type = facet_access_type %.Self.ref.loc11_44 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc11_44: type = converted %.Self.ref.loc11_44, %.Self.as_type.loc11_44 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %Y.ref.loc11_44: %M.assoc_type = name_ref Y, @Y.%assoc1 [concrete = constants.%assoc1] -// CHECK:STDOUT: %impl.elem1.loc11_44.1: type = impl_witness_access constants.%M.lookup_impl_witness.beb, element1 [symbolic_self = constants.%impl.elem1.66c] -// CHECK:STDOUT: %.Self.ref.loc11_49: %M.type = name_ref .Self, %.Self.frozen.loc11_26 [symbolic_self = constants.%.Self.frozen.1cb] -// CHECK:STDOUT: %.Self.as_type.loc11_49: type = facet_access_type %.Self.ref.loc11_49 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc11_49: type = converted %.Self.ref.loc11_49, %.Self.as_type.loc11_49 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %X.ref.loc11_49: %M.assoc_type = name_ref X, @X.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc11_49.1: type = impl_witness_access constants.%M.lookup_impl_witness.beb, element0 [symbolic_self = constants.%impl.elem0.352] -// CHECK:STDOUT: %impl.elem0.subst.loc11_49.1: type = impl_witness_access_substituted %impl.elem0.loc11_49.1, %impl.elem1.loc11_37.1 [symbolic_self = constants.%impl.elem1.66c] -// CHECK:STDOUT: %rewrite.loc11_47.1 = requirement_rewrite %impl.elem1.loc11_44.1, %impl.elem0.subst.loc11_49.1 [concrete] -// CHECK:STDOUT: %.Self.ref.loc11_56: %M.type = name_ref .Self, %.Self.frozen.loc11_26 [symbolic_self = constants.%.Self.frozen.1cb] -// CHECK:STDOUT: %.Self.as_type.loc11_56: type = facet_access_type %.Self.ref.loc11_56 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc11_56: type = converted %.Self.ref.loc11_56, %.Self.as_type.loc11_56 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.Self.ref.loc17_32: %M.type = name_ref .Self, %.Self.frozen.loc17_26 [symbolic_self = constants.%.Self.frozen.1cb] +// CHECK:STDOUT: %.Self.as_type.loc17_32: type = facet_access_type %.Self.ref.loc17_32 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc17_32: type = converted %.Self.ref.loc17_32, %.Self.as_type.loc17_32 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %X.ref.loc17_32: %M.assoc_type = name_ref X, @X.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: %impl.elem0.loc17_32.1: type = impl_witness_access constants.%M.lookup_impl_witness.beb, element0 [symbolic_self = constants.%impl.elem0.352] +// CHECK:STDOUT: %.Self.ref.loc17_37: %M.type = name_ref .Self, %.Self.frozen.loc17_26 [symbolic_self = constants.%.Self.frozen.1cb] +// CHECK:STDOUT: %.Self.as_type.loc17_37: type = facet_access_type %.Self.ref.loc17_37 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc17_37: type = converted %.Self.ref.loc17_37, %.Self.as_type.loc17_37 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %Y.ref.loc17_37: %M.assoc_type = name_ref Y, @Y.%assoc1 [concrete = constants.%assoc1] +// CHECK:STDOUT: %impl.elem1.loc17_37.1: type = impl_witness_access constants.%M.lookup_impl_witness.beb, element1 [symbolic_self = constants.%impl.elem1.66c] +// CHECK:STDOUT: %rewrite.loc17_35.1 = requirement_rewrite %impl.elem0.loc17_32.1, %impl.elem1.loc17_37.1 [concrete] +// CHECK:STDOUT: %.Self.ref.loc17_44: %M.type = name_ref .Self, %.Self.frozen.loc17_26 [symbolic_self = constants.%.Self.frozen.1cb] +// CHECK:STDOUT: %.Self.as_type.loc17_44: type = facet_access_type %.Self.ref.loc17_44 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc17_44: type = converted %.Self.ref.loc17_44, %.Self.as_type.loc17_44 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %Y.ref.loc17_44: %M.assoc_type = name_ref Y, @Y.%assoc1 [concrete = constants.%assoc1] +// CHECK:STDOUT: %impl.elem1.loc17_44.1: type = impl_witness_access constants.%M.lookup_impl_witness.beb, element1 [symbolic_self = constants.%impl.elem1.66c] +// CHECK:STDOUT: %.Self.ref.loc17_49: %M.type = name_ref .Self, %.Self.frozen.loc17_26 [symbolic_self = constants.%.Self.frozen.1cb] +// CHECK:STDOUT: %.Self.as_type.loc17_49: type = facet_access_type %.Self.ref.loc17_49 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc17_49: type = converted %.Self.ref.loc17_49, %.Self.as_type.loc17_49 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %X.ref.loc17_49: %M.assoc_type = name_ref X, @X.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: %impl.elem0.loc17_49.1: type = impl_witness_access constants.%M.lookup_impl_witness.beb, element0 [symbolic_self = constants.%impl.elem0.352] +// CHECK:STDOUT: %impl.elem0.subst.loc17_49.1: type = impl_witness_access_substituted %impl.elem0.loc17_49.1, %impl.elem1.loc17_37.1 [symbolic_self = constants.%impl.elem1.66c] +// CHECK:STDOUT: %rewrite.loc17_47.1 = requirement_rewrite %impl.elem1.loc17_44.1, %impl.elem0.subst.loc17_49.1 [concrete] +// CHECK:STDOUT: %.Self.ref.loc17_56: %M.type = name_ref .Self, %.Self.frozen.loc17_26 [symbolic_self = constants.%.Self.frozen.1cb] +// CHECK:STDOUT: %.Self.as_type.loc17_56: type = facet_access_type %.Self.ref.loc17_56 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc17_56: type = converted %.Self.ref.loc17_56, %.Self.as_type.loc17_56 [symbolic_self = constants.%.Self.frozen.as_type] // CHECK:STDOUT: %Z.ref: %M.assoc_type = name_ref Z, @Z.%assoc2 [concrete = constants.%assoc2] -// CHECK:STDOUT: %impl.elem2.loc11_56.1: type = impl_witness_access constants.%M.lookup_impl_witness.beb, element2 [symbolic_self = constants.%impl.elem2.c22] -// CHECK:STDOUT: %.loc11_62.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc11_62.2: type = converted %.loc11_62.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %rewrite.loc11_59.1 = requirement_rewrite %impl.elem2.loc11_56.1, %.loc11_62.2 [concrete] -// CHECK:STDOUT: %impl.elem0.loc11_32.2: type = impl_witness_access constants.%M.lookup_impl_witness.e09, element0 [symbolic_self = constants.%impl.elem0.c24] -// CHECK:STDOUT: %impl.elem1.loc11_37.2: type = impl_witness_access constants.%M.lookup_impl_witness.e09, element1 [symbolic_self = constants.%impl.elem1.e3e] -// CHECK:STDOUT: %rewrite.loc11_35.2 = requirement_rewrite %impl.elem0.loc11_32.2, %impl.elem1.loc11_37.2 [concrete] -// CHECK:STDOUT: %impl.elem1.loc11_44.2: type = impl_witness_access constants.%M.lookup_impl_witness.e09, element1 [symbolic_self = constants.%impl.elem1.e3e] -// CHECK:STDOUT: %impl.elem0.loc11_49.2: type = impl_witness_access constants.%M.lookup_impl_witness.e09, element0 [symbolic_self = constants.%impl.elem0.c24] -// CHECK:STDOUT: %impl.elem1.loc11_37.3: type = impl_witness_access constants.%M.lookup_impl_witness.e09, element1 [symbolic_self = constants.%impl.elem1.e3e] -// CHECK:STDOUT: %impl.elem0.subst.loc11_49.2: type = impl_witness_access_substituted %impl.elem0.loc11_49.2, %impl.elem1.loc11_37.3 [symbolic_self = constants.%impl.elem1.e3e] -// CHECK:STDOUT: %rewrite.loc11_47.2 = requirement_rewrite %impl.elem1.loc11_44.2, %impl.elem0.subst.loc11_49.2 [concrete] -// CHECK:STDOUT: %impl.elem2.loc11_56.2: type = impl_witness_access constants.%M.lookup_impl_witness.e09, element2 [symbolic_self = constants.%impl.elem2.017] -// CHECK:STDOUT: %rewrite.loc11_59.2 = requirement_rewrite %impl.elem2.loc11_56.2, %.loc11_62.2 [concrete] -// CHECK:STDOUT: %.loc11_26.2: type = where_expr [concrete = ] { +// CHECK:STDOUT: %impl.elem2.loc17_56.1: type = impl_witness_access constants.%M.lookup_impl_witness.beb, element2 [symbolic_self = constants.%impl.elem2.c22] +// CHECK:STDOUT: %.loc17_62.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc17_62.2: type = converted %.loc17_62.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %rewrite.loc17_59.1 = requirement_rewrite %impl.elem2.loc17_56.1, %.loc17_62.2 [concrete] +// CHECK:STDOUT: %impl.elem0.loc17_32.2: type = impl_witness_access constants.%M.lookup_impl_witness.e09, element0 [symbolic_self = constants.%impl.elem0.c24] +// CHECK:STDOUT: %impl.elem1.loc17_37.2: type = impl_witness_access constants.%M.lookup_impl_witness.e09, element1 [symbolic_self = constants.%impl.elem1.e3e] +// CHECK:STDOUT: %rewrite.loc17_35.2 = requirement_rewrite %impl.elem0.loc17_32.2, %impl.elem1.loc17_37.2 [concrete] +// CHECK:STDOUT: %impl.elem1.loc17_44.2: type = impl_witness_access constants.%M.lookup_impl_witness.e09, element1 [symbolic_self = constants.%impl.elem1.e3e] +// CHECK:STDOUT: %impl.elem0.loc17_49.2: type = impl_witness_access constants.%M.lookup_impl_witness.e09, element0 [symbolic_self = constants.%impl.elem0.c24] +// CHECK:STDOUT: %impl.elem1.loc17_37.3: type = impl_witness_access constants.%M.lookup_impl_witness.e09, element1 [symbolic_self = constants.%impl.elem1.e3e] +// CHECK:STDOUT: %impl.elem0.subst.loc17_49.2: type = impl_witness_access_substituted %impl.elem0.loc17_49.2, %impl.elem1.loc17_37.3 [symbolic_self = constants.%impl.elem1.e3e] +// CHECK:STDOUT: %rewrite.loc17_47.2 = requirement_rewrite %impl.elem1.loc17_44.2, %impl.elem0.subst.loc17_49.2 [concrete] +// CHECK:STDOUT: %impl.elem2.loc17_56.2: type = impl_witness_access constants.%M.lookup_impl_witness.e09, element2 [symbolic_self = constants.%impl.elem2.017] +// CHECK:STDOUT: %rewrite.loc17_59.2 = requirement_rewrite %impl.elem2.loc17_56.2, %.loc17_62.2 [concrete] +// CHECK:STDOUT: %.loc17_26.2: type = where_expr [concrete = ] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %M.ref [concrete] -// CHECK:STDOUT: %rewrite.loc11_35.2 = requirement_rewrite %impl.elem0.loc11_32.2, %impl.elem1.loc11_37.2 [concrete] -// CHECK:STDOUT: %rewrite.loc11_47.2 = requirement_rewrite %impl.elem1.loc11_44.2, %impl.elem0.subst.loc11_49.2 [concrete] -// CHECK:STDOUT: %rewrite.loc11_59.2 = requirement_rewrite %impl.elem2.loc11_56.2, %.loc11_62.2 [concrete] +// CHECK:STDOUT: %rewrite.loc17_35.2 = requirement_rewrite %impl.elem0.loc17_32.2, %impl.elem1.loc17_37.2 [concrete] +// CHECK:STDOUT: %rewrite.loc17_47.2 = requirement_rewrite %impl.elem1.loc17_44.2, %impl.elem0.subst.loc17_49.2 [concrete] +// CHECK:STDOUT: %rewrite.loc17_59.2 = requirement_rewrite %impl.elem2.loc17_56.2, %.loc17_62.2 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: %T: = symbolic_binding T, 0 [concrete = ] diff --git a/toolchain/check/testdata/facet/fail_convert_class_type_to_generic_facet_value.carbon b/toolchain/check/testdata/facet/fail_convert_class_type_to_generic_facet_value.carbon index 1295aa6cace2..07687d6a4a4c 100644 --- a/toolchain/check/testdata/facet/fail_convert_class_type_to_generic_facet_value.carbon +++ b/toolchain/check/testdata/facet/fail_convert_class_type_to_generic_facet_value.carbon @@ -27,8 +27,18 @@ impl ImplsGeneric as Generic(GenericParam) { fn CallGenericMethod(generic T: type, unused generic U: Generic(T)) {} fn G() { - // CHECK:STDERR: fail_convert_class_type_to_generic_facet_value.carbon:[[@LINE+3]]:3-52: error: cannot convert type `ImplsGeneric` into type implementing `Generic(WrongGenericParam)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_convert_class_type_to_generic_facet_value.carbon:[[@LINE-4]]:1-69: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_convert_class_type_to_generic_facet_value.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn CallGenericMethod(generic T: type, unused generic U: Generic(T)) {} + // CHECK:STDERR: · ─────────────────────────┬─────────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ CallGenericMethod(WrongGenericParam, ImplsGeneric); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `ImplsGeneric` into type implementing + // CHECK:STDERR: · ┃ `Generic(WrongGenericParam)` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: CallGenericMethod(WrongGenericParam, ImplsGeneric); } diff --git a/toolchain/check/testdata/facet/fail_convert_facet_value_to_missing_impl.carbon b/toolchain/check/testdata/facet/fail_convert_facet_value_to_missing_impl.carbon index 428fbf9a7286..8674438d4240 100644 --- a/toolchain/check/testdata/facet/fail_convert_facet_value_to_missing_impl.carbon +++ b/toolchain/check/testdata/facet/fail_convert_facet_value_to_missing_impl.carbon @@ -17,8 +17,19 @@ interface Animal {} fn Feed[T: Eats](unused e: T) {} -// CHECK:STDERR: fail_convert_facet_value_to_missing_impl.carbon:[[@LINE+3]]:36-42: error: cannot convert type `T` that implements `Animal` into type implementing `Eats` [ConversionFailureFacetToFacet] -// CHECK:STDERR: fail_convert_facet_value_to_missing_impl.carbon:[[@LINE-3]]:1-31: note: while deducing parameters of generic declared here [DeductionGenericHere] +// CHECK:STDERR: ╭─┤ fail_convert_facet_value_to_missing_impl.carbon:[[@LINE+14]]:36 +// CHECK:STDERR: │ fn Feed[T: Eats](unused e: T) {} +// CHECK:STDERR: · ───────────────┬─────────────── +// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here +// CHECK:STDERR: · │ [DeductionGenericHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn HandleAnimal[T: Animal](a: T) { Feed(a); } +// CHECK:STDERR: · ┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot convert type `T` that +// CHECK:STDERR: · ┃ implements `Animal` into type +// CHECK:STDERR: · ┃ implementing `Eats` +// CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn HandleAnimal[T: Animal](a: T) { Feed(a); } @@ -90,22 +101,22 @@ fn HandleAnimal[T: Animal](a: T) { Feed(a); } // CHECK:STDOUT: %e: @Feed.%T.as_type.loc18_28.1 (%T.as_type.422) = wrapper_binding e, %e.param // CHECK:STDOUT: } // CHECK:STDOUT: %HandleAnimal.decl: %HandleAnimal.type = fn_decl @HandleAnimal [concrete = constants.%HandleAnimal] { -// CHECK:STDOUT: %T.patt.loc23_18.1: %pattern_type.333 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc23_18.2 (constants.%T.patt.e44)] -// CHECK:STDOUT: %a.param_patt.loc23_29.1: @HandleAnimal.%pattern_type (%pattern_type.e90) = value_param_pattern [symbolic = %a.param_patt.loc23_29.2 (constants.%a.param_patt)] -// CHECK:STDOUT: %a.patt.loc23_29.1: @HandleAnimal.%pattern_type (%pattern_type.e90) = wrapper_binding_pattern a, %a.param_patt.loc23_29.1 [symbolic = %a.patt.loc23_29.2 (constants.%a.patt)] +// CHECK:STDOUT: %T.patt.loc34_18.1: %pattern_type.333 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc34_18.2 (constants.%T.patt.e44)] +// CHECK:STDOUT: %a.param_patt.loc34_29.1: @HandleAnimal.%pattern_type (%pattern_type.e90) = value_param_pattern [symbolic = %a.param_patt.loc34_29.2 (constants.%a.param_patt)] +// CHECK:STDOUT: %a.patt.loc34_29.1: @HandleAnimal.%pattern_type (%pattern_type.e90) = wrapper_binding_pattern a, %a.param_patt.loc34_29.1 [symbolic = %a.patt.loc34_29.2 (constants.%a.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc23_20: type = splice_block %Animal.ref [concrete = constants.%Animal.type] { +// CHECK:STDOUT: %.loc34_20: type = splice_block %Animal.ref [concrete = constants.%Animal.type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %Animal.ref: type = name_ref Animal, file.%Animal.decl [concrete = constants.%Animal.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc23_18.2: %Animal.type = symbolic_binding T, 0 [symbolic = %T.loc23_18.1 (constants.%T.443)] -// CHECK:STDOUT: %a.param: @HandleAnimal.%T.as_type.loc23_31.1 (%T.as_type.01d) = value_param call_param0 -// CHECK:STDOUT: %.loc23_31.1: type = splice_block %.loc23_31.2 [symbolic = %T.as_type.loc23_31.1 (constants.%T.as_type.01d)] { -// CHECK:STDOUT: %T.ref: %Animal.type = name_ref T, %T.loc23_18.2 [symbolic = %T.loc23_18.1 (constants.%T.443)] -// CHECK:STDOUT: %T.as_type.loc23_31.2: type = facet_access_type %T.ref [symbolic = %T.as_type.loc23_31.1 (constants.%T.as_type.01d)] -// CHECK:STDOUT: %.loc23_31.2: type = converted %T.ref, %T.as_type.loc23_31.2 [symbolic = %T.as_type.loc23_31.1 (constants.%T.as_type.01d)] +// CHECK:STDOUT: %T.loc34_18.2: %Animal.type = symbolic_binding T, 0 [symbolic = %T.loc34_18.1 (constants.%T.443)] +// CHECK:STDOUT: %a.param: @HandleAnimal.%T.as_type.loc34_31.1 (%T.as_type.01d) = value_param call_param0 +// CHECK:STDOUT: %.loc34_31.1: type = splice_block %.loc34_31.2 [symbolic = %T.as_type.loc34_31.1 (constants.%T.as_type.01d)] { +// CHECK:STDOUT: %T.ref: %Animal.type = name_ref T, %T.loc34_18.2 [symbolic = %T.loc34_18.1 (constants.%T.443)] +// CHECK:STDOUT: %T.as_type.loc34_31.2: type = facet_access_type %T.ref [symbolic = %T.as_type.loc34_31.1 (constants.%T.as_type.01d)] +// CHECK:STDOUT: %.loc34_31.2: type = converted %T.ref, %T.as_type.loc34_31.2 [symbolic = %T.as_type.loc34_31.1 (constants.%T.as_type.01d)] // CHECK:STDOUT: } -// CHECK:STDOUT: %a: @HandleAnimal.%T.as_type.loc23_31.1 (%T.as_type.01d) = wrapper_binding a, %a.param +// CHECK:STDOUT: %a: @HandleAnimal.%T.as_type.loc34_31.1 (%T.as_type.01d) = wrapper_binding a, %a.param // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -148,21 +159,21 @@ fn HandleAnimal[T: Animal](a: T) { Feed(a); } // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @HandleAnimal(%T.loc23_18.2: %Animal.type) { -// CHECK:STDOUT: %T.patt.loc23_18.2: %pattern_type.333 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc23_18.2 (constants.%T.patt.e44)] -// CHECK:STDOUT: %T.loc23_18.1: %Animal.type = symbolic_binding T, 0 [symbolic = %T.loc23_18.1 (constants.%T.443)] -// CHECK:STDOUT: %T.as_type.loc23_31.1: type = facet_access_type %T.loc23_18.1 [symbolic = %T.as_type.loc23_31.1 (constants.%T.as_type.01d)] -// CHECK:STDOUT: %pattern_type: type = pattern_type %T.as_type.loc23_31.1 [symbolic = %pattern_type (constants.%pattern_type.e90)] -// CHECK:STDOUT: %a.param_patt.loc23_29.2: @HandleAnimal.%pattern_type (%pattern_type.e90) = value_param_pattern [symbolic = %a.param_patt.loc23_29.2 (constants.%a.param_patt)] -// CHECK:STDOUT: %a.patt.loc23_29.2: @HandleAnimal.%pattern_type (%pattern_type.e90) = wrapper_binding_pattern a, %a.param_patt.loc23_29.2 [symbolic = %a.patt.loc23_29.2 (constants.%a.patt)] +// CHECK:STDOUT: generic fn @HandleAnimal(%T.loc34_18.2: %Animal.type) { +// CHECK:STDOUT: %T.patt.loc34_18.2: %pattern_type.333 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc34_18.2 (constants.%T.patt.e44)] +// CHECK:STDOUT: %T.loc34_18.1: %Animal.type = symbolic_binding T, 0 [symbolic = %T.loc34_18.1 (constants.%T.443)] +// CHECK:STDOUT: %T.as_type.loc34_31.1: type = facet_access_type %T.loc34_18.1 [symbolic = %T.as_type.loc34_31.1 (constants.%T.as_type.01d)] +// CHECK:STDOUT: %pattern_type: type = pattern_type %T.as_type.loc34_31.1 [symbolic = %pattern_type (constants.%pattern_type.e90)] +// CHECK:STDOUT: %a.param_patt.loc34_29.2: @HandleAnimal.%pattern_type (%pattern_type.e90) = value_param_pattern [symbolic = %a.param_patt.loc34_29.2 (constants.%a.param_patt)] +// CHECK:STDOUT: %a.patt.loc34_29.2: @HandleAnimal.%pattern_type (%pattern_type.e90) = wrapper_binding_pattern a, %a.param_patt.loc34_29.2 [symbolic = %a.patt.loc34_29.2 (constants.%a.patt)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type %T.as_type.loc23_31.1 [symbolic = %require_complete (constants.%require_complete.db4)] +// CHECK:STDOUT: %require_complete: = require_complete_type %T.as_type.loc34_31.1 [symbolic = %require_complete (constants.%require_complete.db4)] // CHECK:STDOUT: -// CHECK:STDOUT: fn(%a.param: @HandleAnimal.%T.as_type.loc23_31.1 (%T.as_type.01d)) { +// CHECK:STDOUT: fn(%a.param: @HandleAnimal.%T.as_type.loc34_31.1 (%T.as_type.01d)) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Feed.ref: %Feed.type = name_ref Feed, file.%Feed.decl [concrete = constants.%Feed] -// CHECK:STDOUT: %a.ref: @HandleAnimal.%T.as_type.loc23_31.1 (%T.as_type.01d) = name_ref a, %a +// CHECK:STDOUT: %a.ref: @HandleAnimal.%T.as_type.loc34_31.1 (%T.as_type.01d) = name_ref a, %a // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -181,11 +192,11 @@ fn HandleAnimal[T: Animal](a: T) { Feed(a); } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @HandleAnimal(constants.%T.443) { -// CHECK:STDOUT: %T.patt.loc23_18.2 => constants.%T.patt.e44 -// CHECK:STDOUT: %T.loc23_18.1 => constants.%T.443 -// CHECK:STDOUT: %T.as_type.loc23_31.1 => constants.%T.as_type.01d +// CHECK:STDOUT: %T.patt.loc34_18.2 => constants.%T.patt.e44 +// CHECK:STDOUT: %T.loc34_18.1 => constants.%T.443 +// CHECK:STDOUT: %T.as_type.loc34_31.1 => constants.%T.as_type.01d // CHECK:STDOUT: %pattern_type => constants.%pattern_type.e90 -// CHECK:STDOUT: %a.param_patt.loc23_29.2 => constants.%a.param_patt -// CHECK:STDOUT: %a.patt.loc23_29.2 => constants.%a.patt +// CHECK:STDOUT: %a.param_patt.loc34_29.2 => constants.%a.param_patt +// CHECK:STDOUT: %a.patt.loc34_29.2 => constants.%a.patt // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/facet/fail_convert_type_erased_type_to_facet.carbon b/toolchain/check/testdata/facet/fail_convert_type_erased_type_to_facet.carbon index e7bbb566be12..173a34883718 100644 --- a/toolchain/check/testdata/facet/fail_convert_type_erased_type_to_facet.carbon +++ b/toolchain/check/testdata/facet/fail_convert_type_erased_type_to_facet.carbon @@ -20,7 +20,14 @@ impl Goat as Animal {} fn WalkAnimal(unused generic a: Animal) {} fn F() { - // CHECK:STDERR: fail_convert_type_erased_type_to_facet.carbon:[[@LINE+2]]:15-21: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_convert_type_erased_type_to_facet.carbon:[[@LINE+9]]:15 + // CHECK:STDERR: -> │ let generic x: type = Goat; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: semantics TODO: + // CHECK:STDERR: · ┃ `local generic `let` bindings are currently unsupported` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let generic x: type = Goat; WalkAnimal(x); diff --git a/toolchain/check/testdata/facet/fail_deduction_uses_runtime_type_conversion.carbon b/toolchain/check/testdata/facet/fail_deduction_uses_runtime_type_conversion.carbon index a7df9d4c0c72..067e13cb7a18 100644 --- a/toolchain/check/testdata/facet/fail_deduction_uses_runtime_type_conversion.carbon +++ b/toolchain/check/testdata/facet/fail_deduction_uses_runtime_type_conversion.carbon @@ -27,9 +27,20 @@ impl RuntimeConvertFrom as Core.ImplicitAs(RuntimeConvertTo) { fn F[T: (type, )](unused generic A: T.0, unused x: HoldsType(T)) {} fn G(holds_to: HoldsType((RuntimeConvertTo, )), generic from: RuntimeConvertFrom) { - // CHECK:STDERR: fail_deduction_uses_runtime_type_conversion.carbon:[[@LINE+4]]:3-19: error: compile-time value requires runtime conversion, constructing value of type `RuntimeConvertTo` [RuntimeConversionDuringCompTimeDeduction] - // CHECK:STDERR: fail_deduction_uses_runtime_type_conversion.carbon:[[@LINE-4]]:1-66: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fail_deduction_uses_runtime_type_conversion.carbon:[[@LINE-5]]:1-66: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_deduction_uses_runtime_type_conversion.carbon:[[@LINE+15]]:3 + // CHECK:STDERR: │ fn F[T: (type, )](unused generic A: T.0, unused x: HoldsType(T)) {} + // CHECK:STDERR: · ───────────────────────┬────────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ │ [DeductionGenericHere] + // CHECK:STDERR: · ╰────┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(from, holds_to); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: compile-time value requires runtime conversion, constructing value + // CHECK:STDERR: · ┃ of type `RuntimeConvertTo` + // CHECK:STDERR: · ┃ [RuntimeConversionDuringCompTimeDeduction] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(from, holds_to); } @@ -104,7 +115,7 @@ fn G(holds_to: HoldsType((RuntimeConvertTo, )), generic from: RuntimeConvertFrom // CHECK:STDOUT: %T.09f: %SubobjectDestroy.type = symbolic_binding T, 0 [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.type.dea: type = fn_type @T.as_type.as.DestroyImpl.impl.Op, @T.as_type.as.DestroyImpl.impl(%T.09f) [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.6e5: %T.as_type.as.DestroyImpl.impl.Op.type.dea = struct_value () [symbolic] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.2: type = fn_type @SubobjectDestroy.WithSelf.Op.loc34_19.2 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.2: type = fn_type @SubobjectDestroy.WithSelf.Op.loc45_19.2 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.2: %SubobjectDestroy.WithSelf.Op.type.6870fd.2 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80ef6.2: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.2), @SubobjectDestroy [concrete] // CHECK:STDOUT: %SubobjectDestroy.facet.790: %SubobjectDestroy.type = facet_value %RuntimeConvertTo, (%custom_witness.b80ef6.2) [concrete] @@ -307,28 +318,28 @@ fn G(holds_to: HoldsType((RuntimeConvertTo, )), generic from: RuntimeConvertFrom // CHECK:STDOUT: %holds_to.ref: %HoldsType.30a = name_ref holds_to, %holds_to // CHECK:STDOUT: %impl.elem0: %.0aa = impl_witness_access constants.%ImplicitAs.impl_witness, element0 [concrete = constants.%RuntimeConvertFrom.as.ImplicitAs.impl.Convert] // CHECK:STDOUT: %bound_method: = bound_method constants.%from, %impl.elem0 [symbolic = %RuntimeConvertFrom.as.ImplicitAs.impl.Convert.bound (constants.%RuntimeConvertFrom.as.ImplicitAs.impl.Convert.bound)] -// CHECK:STDOUT: %.loc34_19.1: ref %RuntimeConvertTo = temporary_storage -// CHECK:STDOUT: %RuntimeConvertFrom.as.ImplicitAs.impl.Convert.call: init %RuntimeConvertTo to %.loc34_19.1 = call %bound_method(constants.%from) -// CHECK:STDOUT: %.loc34_19.2: init %RuntimeConvertTo = converted constants.%from, %RuntimeConvertFrom.as.ImplicitAs.impl.Convert.call -// CHECK:STDOUT: %.loc34_19.3: ref %RuntimeConvertTo = temporary %.loc34_19.1, %.loc34_19.2 -// CHECK:STDOUT: %.loc34_19.4: %RuntimeConvertTo = acquire_value %.loc34_19.3 +// CHECK:STDOUT: %.loc45_19.1: ref %RuntimeConvertTo = temporary_storage +// CHECK:STDOUT: %RuntimeConvertFrom.as.ImplicitAs.impl.Convert.call: init %RuntimeConvertTo to %.loc45_19.1 = call %bound_method(constants.%from) +// CHECK:STDOUT: %.loc45_19.2: init %RuntimeConvertTo = converted constants.%from, %RuntimeConvertFrom.as.ImplicitAs.impl.Convert.call +// CHECK:STDOUT: %.loc45_19.3: ref %RuntimeConvertTo = temporary %.loc45_19.1, %.loc45_19.2 +// CHECK:STDOUT: %.loc45_19.4: %RuntimeConvertTo = acquire_value %.loc45_19.3 // CHECK:STDOUT: %F.specific_fn: = specific_function %F.ref, @F(constants.%tuple.eb2, ) [concrete = ] -// CHECK:STDOUT: %.loc34_19.5: %empty_tuple.type = call %F.specific_fn(%holds_to.ref) +// CHECK:STDOUT: %.loc45_19.5: %empty_tuple.type = call %F.specific_fn(%holds_to.ref) // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc34_19.6: %empty_tuple.type = converted %.loc34_19.5, %empty_tuple [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %Destroy.facet.loc34_19.1: %Destroy.type = facet_value constants.%RuntimeConvertTo, (constants.%DestroyImpl.impl_witness.18d, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc34_19.7: %Destroy.type = converted constants.%RuntimeConvertTo, %Destroy.facet.loc34_19.1 [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %Destroy.facet.loc34_19.2: %Destroy.type = facet_value constants.%RuntimeConvertTo, (constants.%DestroyImpl.impl_witness.18d, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc34_19.8: %Destroy.type = converted constants.%RuntimeConvertTo, %Destroy.facet.loc34_19.2 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc45_19.6: %empty_tuple.type = converted %.loc45_19.5, %empty_tuple [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %Destroy.facet.loc45_19.1: %Destroy.type = facet_value constants.%RuntimeConvertTo, (constants.%DestroyImpl.impl_witness.18d, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc45_19.7: %Destroy.type = converted constants.%RuntimeConvertTo, %Destroy.facet.loc45_19.1 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %Destroy.facet.loc45_19.2: %Destroy.type = facet_value constants.%RuntimeConvertTo, (constants.%DestroyImpl.impl_witness.18d, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc45_19.8: %Destroy.type = converted constants.%RuntimeConvertTo, %Destroy.facet.loc45_19.2 [concrete = constants.%Destroy.facet] // CHECK:STDOUT: %SelfDestruct.specific_fn: = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet) [concrete = constants.%SelfDestruct.specific_fn] -// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc34_19.3) +// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc45_19.3) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc34_19.1(%self.param: ref %empty_struct_type) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc45_19.1(%self.param: ref %empty_struct_type) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc34_19.2(%self.param: ref %RuntimeConvertTo) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc45_19.2(%self.param: ref %RuntimeConvertTo) = "no_op"; // CHECK:STDOUT: // CHECK:STDOUT: specific @HoldsType(constants.%T.198) { // CHECK:STDOUT: %T.patt.loc17_18.2 => constants.%T.patt.d26 diff --git a/toolchain/check/testdata/facet/fail_namespace_type.carbon b/toolchain/check/testdata/facet/fail_namespace_type.carbon index 70b340ac3688..e076091b8ebd 100644 --- a/toolchain/check/testdata/facet/fail_namespace_type.carbon +++ b/toolchain/check/testdata/facet/fail_namespace_type.carbon @@ -20,7 +20,11 @@ interface Z {} impl forall [T: type] T as Z {} fn F() { - // CHECK:STDERR: fail_namespace_as.carbon:[[@LINE+2]]:3: error: expression cannot be used as a value [UseOfNonExprAsValue] + // CHECK:STDERR: ╭─┤ fail_namespace_as.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ N as Z; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expression cannot be used as a value [UseOfNonExprAsValue] + // CHECK:STDERR: ╰──── // CHECK:STDERR: N as Z; } @@ -37,8 +41,15 @@ impl forall [T: type] T as Z {} fn G[T: Z](unused a: T) {} fn F() { - // CHECK:STDERR: fail_namespace_argument.carbon:[[@LINE+3]]:5: error: expression cannot be used as a value [UseOfNonExprAsValue] - // CHECK:STDERR: fail_namespace_argument.carbon:[[@LINE-4]]:19-22: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_namespace_argument.carbon:[[@LINE+10]]:5 + // CHECK:STDERR: │ fn G[T: Z](unused a: T) {} + // CHECK:STDERR: · ──┬─ + // CHECK:STDERR: · ╰──┤ initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ G(N); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expression cannot be used as a value [UseOfNonExprAsValue] + // CHECK:STDERR: ╰──── // CHECK:STDERR: G(N); } diff --git a/toolchain/check/testdata/facet/named_constant.carbon b/toolchain/check/testdata/facet/named_constant.carbon index caf55d254aad..0b0c2325e484 100644 --- a/toolchain/check/testdata/facet/named_constant.carbon +++ b/toolchain/check/testdata/facet/named_constant.carbon @@ -19,7 +19,14 @@ interface I { } fn Test() { - // CHECK:STDERR: fail_todo_named_constant_in_rewrite.carbon:[[@LINE+2]]:15-28: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_named_constant_in_rewrite.carbon:[[@LINE+9]]:15 + // CHECK:STDERR: -> │ let generic Constant: type = (); + // CHECK:STDERR: · ━━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: semantics TODO: + // CHECK:STDERR: · ┃ `local generic `let` bindings are currently unsupported` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let generic Constant: type = (); @@ -40,7 +47,14 @@ interface I { } fn Test() { - // CHECK:STDERR: fail_todo_named_constant_two_levels_in_rewrite.carbon:[[@LINE+2]]:15-29: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_named_constant_two_levels_in_rewrite.carbon:[[@LINE+9]]:15 + // CHECK:STDERR: -> │ let generic Constant2: type = (); + // CHECK:STDERR: · ━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: semantics TODO: + // CHECK:STDERR: · ┃ `local generic `let` bindings are currently unsupported` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let generic Constant2: type = (); let generic Constant: type = (Constant2, ); @@ -62,7 +76,14 @@ interface I { } fn Test() { - // CHECK:STDERR: fail_todo_named_constant_in_rewrite_callee.carbon:[[@LINE+2]]:15-28: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_named_constant_in_rewrite_callee.carbon:[[@LINE+9]]:15 + // CHECK:STDERR: -> │ let generic Constant: type = (); + // CHECK:STDERR: · ━━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: semantics TODO: + // CHECK:STDERR: · ┃ `local generic `let` bindings are currently unsupported` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let generic Constant: type = (); @@ -83,7 +104,14 @@ interface I { } fn Test() { - // CHECK:STDERR: fail_todo_named_constant_in_rewrite_caller.carbon:[[@LINE+2]]:15-28: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_named_constant_in_rewrite_caller.carbon:[[@LINE+9]]:15 + // CHECK:STDERR: -> │ let generic Constant: type = (); + // CHECK:STDERR: · ━━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: semantics TODO: + // CHECK:STDERR: · ┃ `local generic `let` bindings are currently unsupported` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let generic Constant: type = (); @@ -104,7 +132,14 @@ interface I { } fn Test() { - // CHECK:STDERR: fail_todo_named_constant_in_nested_facet_type.carbon:[[@LINE+2]]:15-28: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_named_constant_in_nested_facet_type.carbon:[[@LINE+9]]:15 + // CHECK:STDERR: -> │ let generic Constant: type = (); + // CHECK:STDERR: · ━━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: semantics TODO: + // CHECK:STDERR: · ┃ `local generic `let` bindings are currently unsupported` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let generic Constant: type = (); @@ -127,7 +162,14 @@ interface I { } fn Test() { - // CHECK:STDERR: fail_todo_named_constant_in_nested_facet_type_caller.carbon:[[@LINE+2]]:15-28: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_named_constant_in_nested_facet_type_caller.carbon:[[@LINE+9]]:15 + // CHECK:STDERR: -> │ let generic Constant: type = (); + // CHECK:STDERR: · ━━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: semantics TODO: + // CHECK:STDERR: · ┃ `local generic `let` bindings are currently unsupported` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let generic Constant: type = (); @@ -150,7 +192,14 @@ interface I { } fn Test() { - // CHECK:STDERR: fail_named_constant_in_nested_facet_type_callee.carbon:[[@LINE+2]]:15-28: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_named_constant_in_nested_facet_type_callee.carbon:[[@LINE+9]]:15 + // CHECK:STDERR: -> │ let generic Constant: type = (); + // CHECK:STDERR: · ━━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: semantics TODO: + // CHECK:STDERR: · ┃ `local generic `let` bindings are currently unsupported` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let generic Constant: type = (); diff --git a/toolchain/check/testdata/facet/nested_facet_types.carbon b/toolchain/check/testdata/facet/nested_facet_types.carbon index 436a0dac776d..aafdc6b2e5ef 100644 --- a/toolchain/check/testdata/facet/nested_facet_types.carbon +++ b/toolchain/check/testdata/facet/nested_facet_types.carbon @@ -72,7 +72,13 @@ interface Z { let T: type; } -// CHECK:STDERR: fail_nested_facet_types_different.carbon:[[@LINE+2]]:25-55: error: associated constant `.(Z.T)` given two different values `()` and `{}` [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╭─┤ fail_nested_facet_types_different.carbon:[[@LINE+8]]:25 +// CHECK:STDERR: -> │ fn F(unused generic FF: (Z where .T = ()) where .T = {}) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: associated constant `.(Z.T)` given two +// CHECK:STDERR: · ┃ different values `()` and `{}` +// CHECK:STDERR: · ┃ [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused generic FF: (Z where .T = ()) where .T = {}) {} @@ -84,7 +90,13 @@ interface Z { let U: type; } -// CHECK:STDERR: fail_nested_facet_types_different_with_associated.carbon:[[@LINE+2]]:25-55: error: associated constant `.(Z.T)` given two different values `.(Z.U)` and `{}` [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╭─┤ fail_nested_facet_types_different_with_associated.carbon:[[@LINE+8]]:25 +// CHECK:STDERR: -> │ fn F(unused generic FF: (Z where .T = .U) where .T = {}) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: associated constant `.(Z.T)` given two +// CHECK:STDERR: · ┃ different values `.(Z.U)` and `{}` +// CHECK:STDERR: · ┃ [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused generic FF: (Z where .T = .U) where .T = {}) {} @@ -97,7 +109,13 @@ interface Z { } interface Y {} -// CHECK:STDERR: fail_nested_facet_types_different_with_impls_interface.carbon:[[@LINE+2]]:25-73: error: associated constant `.(Z.T)` given two different values `()` and `{}` [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╭─┤ fail_nested_facet_types_different_with_impls_interface.carbon:[[@LINE+8]]:25 +// CHECK:STDERR: -> │ fn F(unused generic FF: (Z where .Self impls Y and .T = ()) where .T = {}) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: associated constant `.(Z.T)` given two +// CHECK:STDERR: · ┃ different values `()` and `{}` +// CHECK:STDERR: · ┃ [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused generic FF: (Z where .Self impls Y and .T = ()) where .T = {}) {} @@ -110,7 +128,13 @@ interface Z { } constraint Y {} -// CHECK:STDERR: fail_nested_facet_types_different_with_impls_constraint.carbon:[[@LINE+2]]:25-73: error: associated constant `.(Z.T)` given two different values `()` and `{}` [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╭─┤ fail_nested_facet_types_different_with_impls_constraint.carbon:[[@LINE+8]]:25 +// CHECK:STDERR: -> │ fn F(unused generic FF: (Z where .Self impls Y and .T = ()) where .T = {}) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: associated constant `.(Z.T)` given two +// CHECK:STDERR: · ┃ different values `()` and `{}` +// CHECK:STDERR: · ┃ [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused generic FF: (Z where .Self impls Y and .T = ()) where .T = {}) {} @@ -123,7 +147,13 @@ interface Z { } class C(T: type) {} -// CHECK:STDERR: fail_nested_facet_types_different_with_associated_in_generic_parameter.carbon:[[@LINE+2]]:25-58: error: associated constant `.(Z.T)` given two different values `C(.(Z.U))` and `{}` [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╭─┤ fail_nested_facet_types_different_with_associated_in_generic_parameter.carbon:[[@LINE+8]]:25 +// CHECK:STDERR: -> │ fn F(unused generic FF: (Z where .T = C(.U)) where .T = {}) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: associated constant `.(Z.T)` given two +// CHECK:STDERR: · ┃ different values `C(.(Z.U))` and `{}` +// CHECK:STDERR: · ┃ [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused generic FF: (Z where .T = C(.U)) where .T = {}) {} @@ -145,7 +175,13 @@ interface Z { let U: type; } -// CHECK:STDERR: fail_nested_facet_types_different_with_bitand.carbon:[[@LINE+2]]:25-77: error: associated constant `.(Z.T)` given two different values `.(Z.U)` and `{}` [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╭─┤ fail_nested_facet_types_different_with_bitand.carbon:[[@LINE+8]]:25 +// CHECK:STDERR: -> │ ...nused generic FF: ((Z where .T = .U) where .T = .U) & (Z where .T = {})) {... +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: associated constant `.(Z.T)` given two +// CHECK:STDERR: · ┃ different values `.(Z.U)` and `{}` +// CHECK:STDERR: · ┃ [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused generic FF: ((Z where .T = .U) where .T = .U) & (Z where .T = {})) {} @@ -157,7 +193,13 @@ interface Z { let U: type; } -// CHECK:STDERR: fail_nested_facet_type_cycle.carbon:[[@LINE+2]]:25-55: error: found cycle in facet type constraint for `.(Z.U)` [FacetTypeConstraintCycle] +// CHECK:STDERR: ╭─┤ fail_nested_facet_type_cycle.carbon:[[@LINE+8]]:25 +// CHECK:STDERR: -> │ fn F(unused generic FF: (Z where .T = .U) where .U = .T) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: found cycle in facet type constraint for +// CHECK:STDERR: · ┃ `.(Z.U)` +// CHECK:STDERR: · ┃ [FacetTypeConstraintCycle] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused generic FF: (Z where .T = .U) where .U = .T) {} @@ -174,7 +216,13 @@ interface Z { // The ordering here is meant to find a way to insert a LHS between the two `.S` // ids, by producing different orderings to get an id between them. -// CHECK:STDERR: fail_nested_facet_types_different_separated_order_one.carbon:[[@LINE+2]]:25-93: error: associated constant `.(Z.S)` given two different values `.(Z.U)` and `{}` [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╭─┤ fail_nested_facet_types_different_separated_order_one.carbon:[[@LINE+8]]:25 +// CHECK:STDERR: -> │ ...nused generic FF: (((Z where .S = .U) where .V = {}) where .T = .U) & (Z w... +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: associated constant `.(Z.S)` given two +// CHECK:STDERR: · ┃ different values `.(Z.U)` and `{}` +// CHECK:STDERR: · ┃ [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused generic FF: (((Z where .S = .U) where .V = {}) where .T = .U) & (Z where .S = {})) {} @@ -192,7 +240,13 @@ interface Z { // ids, by producing different orderings to get an id between them. As of today, // this is the case where `.T` is sorted between the two `.S` rewrite rules. -// CHECK:STDERR: fail_nested_facet_types_different_separated_order_two.carbon:[[@LINE+2]]:25-93: error: associated constant `.(Z.S)` given two different values `{}` and `.(Z.U)` [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╭─┤ fail_nested_facet_types_different_separated_order_two.carbon:[[@LINE+8]]:25 +// CHECK:STDERR: -> │ ...nused generic FF: (((Z where .V = {}) where .S = .U) where .T = .U) & (Z w... +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: associated constant `.(Z.S)` given two +// CHECK:STDERR: · ┃ different values `{}` and `.(Z.U)` +// CHECK:STDERR: · ┃ [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused generic FF: (((Z where .V = {}) where .S = .U) where .T = .U) & (Z where .S = {})) {} @@ -209,7 +263,13 @@ interface Z { // The ordering here is meant to find a way to insert a LHS between the two `.S` // ids, by producing different orderings to get an id between them. -// CHECK:STDERR: fail_nested_facet_types_different_separated_order_three.carbon:[[@LINE+2]]:25-93: error: associated constant `.(Z.S)` given two different values `{}` and `.(Z.U)` [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╭─┤ fail_nested_facet_types_different_separated_order_three.carbon:[[@LINE+8]]:25 +// CHECK:STDERR: -> │ ...nused generic FF: (((Z where .V = {}) where .T = .U) where .S = .U) & (Z w... +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: associated constant `.(Z.S)` given two +// CHECK:STDERR: · ┃ different values `{}` and `.(Z.U)` +// CHECK:STDERR: · ┃ [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused generic FF: (((Z where .V = {}) where .T = .U) where .S = .U) & (Z where .S = {})) {} @@ -288,8 +348,15 @@ constraint NZ2 { } fn F(generic FF: ((Y where .Y1 = ()) where .Self impls NZ1) where .Self impls NZ2) -> FF.(Z.Z1) { - // CHECK:STDERR: fail_todo_nested_impl_combine_rewrites_from_named_constraints.carbon:[[@LINE+3]]:3-21: error: cannot implicitly convert expression of type `C(())` to `FF.(Z.Z1)` [ConversionFailure] - // CHECK:STDERR: fail_todo_nested_impl_combine_rewrites_from_named_constraints.carbon:[[@LINE+2]]:3-21: note: type `C(())` does not implement interface `Core.ImplicitAs(FF.(Z.Z1))` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_todo_nested_impl_combine_rewrites_from_named_constraints.carbon:[[@LINE+10]]:3 + // CHECK:STDERR: -> │ return () as C(()); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `C(())` to + // CHECK:STDERR: · │ ┃ `FF.(Z.Z1)` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `C(())` does not implement interface `Core.ImplicitAs(FF.(Z.Z1))` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return () as C(()); } @@ -297,8 +364,17 @@ fn F(generic FF: ((Y where .Y1 = ()) where .Self impls NZ1) where .Self impls NZ // --- fail_where_nested_inside_where_impls.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_where_nested_inside_where_impls.carbon:[[@LINE+3]]:41-67: error: found `where` expression nested on the right-hand side of `where` [NestedWhereInsideWhere] -// CHECK:STDERR: fail_where_nested_inside_where_impls.carbon:[[@LINE+2]]:17-26: note: on right-hand side of `where` here [NestedWhereInsideWhereOuterNote] +// CHECK:STDERR: ╭─┤ fail_where_nested_inside_where_impls.carbon:[[@LINE+12]]:41 +// CHECK:STDERR: -> │ fn F(generic _: type where .Self impls (type where .Self impls type)) {} +// CHECK:STDERR: · ─────┬──── ┳━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · │ ┗━━┫ error: found `where` expression +// CHECK:STDERR: · │ ┃ nested on the right-hand +// CHECK:STDERR: · │ ┃ side of `where` +// CHECK:STDERR: · │ ┃ [NestedWhereInsideWhere] +// CHECK:STDERR: · ╰───────────────────────┤ on right-hand side of `where` +// CHECK:STDERR: · │ here +// CHECK:STDERR: · │ [NestedWhereInsideWhereOuterNote] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic _: type where .Self impls (type where .Self impls type)) {} @@ -309,8 +385,15 @@ interface Z { let Z1: type; } -// CHECK:STDERR: fail_where_nested_inside_where_rewrite.carbon:[[@LINE+3]]:32-58: error: found `where` expression nested on the right-hand side of `where` [NestedWhereInsideWhere] -// CHECK:STDERR: fail_where_nested_inside_where_rewrite.carbon:[[@LINE+2]]:17-23: note: on right-hand side of `where` here [NestedWhereInsideWhereOuterNote] +// CHECK:STDERR: ╭─┤ fail_where_nested_inside_where_rewrite.carbon:[[@LINE+10]]:32 +// CHECK:STDERR: -> │ fn F(generic _: Z where .Z1 = (type where .Self impls type)) {} +// CHECK:STDERR: · ───┬─── ┳━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · │ ┗━━┫ error: found `where` expression nested on +// CHECK:STDERR: · │ ┃ the right-hand side of `where` +// CHECK:STDERR: · │ ┃ [NestedWhereInsideWhere] +// CHECK:STDERR: · ╰────────────────┤ on right-hand side of `where` here +// CHECK:STDERR: · │ [NestedWhereInsideWhereOuterNote] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic _: Z where .Z1 = (type where .Self impls type)) {} @@ -320,8 +403,15 @@ library "[[@TEST_NAME]]"; interface Z {} class C; -// CHECK:STDERR: fail_where_nested_inside_where_same_type.carbon:[[@LINE+3]]:31-57: error: found `where` expression nested on the right-hand side of `where` [NestedWhereInsideWhere] -// CHECK:STDERR: fail_where_nested_inside_where_same_type.carbon:[[@LINE+2]]:17-23: note: on right-hand side of `where` here [NestedWhereInsideWhereOuterNote] +// CHECK:STDERR: ╭─┤ fail_where_nested_inside_where_same_type.carbon:[[@LINE+10]]:31 +// CHECK:STDERR: -> │ fn F(generic _: Z where C == (type where .Self impls type)) {} +// CHECK:STDERR: · ───┬─── ┳━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · │ ┗━━┫ error: found `where` expression nested on the +// CHECK:STDERR: · │ ┃ right-hand side of `where` +// CHECK:STDERR: · │ ┃ [NestedWhereInsideWhere] +// CHECK:STDERR: · ╰───────────────┤ on right-hand side of `where` here +// CHECK:STDERR: · │ [NestedWhereInsideWhereOuterNote] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic _: Z where C == (type where .Self impls type)) {} @@ -331,7 +421,13 @@ library "[[@TEST_NAME]]"; interface Z(T: type) {} interface Y {} -// CHECK:STDERR: fail_where_nested_inside_binding.carbon:[[@LINE+2]]:17-43: error: found `where` expression in binding's type that does not constrain the binding [InvalidWhereInsideBinding] +// CHECK:STDERR: ╭─┤ fail_where_nested_inside_binding.carbon:[[@LINE+8]]:17 +// CHECK:STDERR: -> │ fn F(generic _: Z(type where .Self impls Y)) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: found `where` expression in binding's type that does +// CHECK:STDERR: · ┃ not constrain the binding +// CHECK:STDERR: · ┃ [InvalidWhereInsideBinding] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic _: Z(type where .Self impls Y)) {} @@ -341,7 +437,13 @@ library "[[@TEST_NAME]]"; interface Z(T: type) {} interface Y {} -// CHECK:STDERR: fail_where_double_nested_inside_binding.carbon:[[@LINE+2]]:17-43: error: found `where` expression in binding's type that does not constrain the binding [InvalidWhereInsideBinding] +// CHECK:STDERR: ╭─┤ fail_where_double_nested_inside_binding.carbon:[[@LINE+8]]:17 +// CHECK:STDERR: -> │ fn F(generic _: Z(type where .Self impls Y) where .Self impls Y) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: found `where` expression in binding's type that does +// CHECK:STDERR: · ┃ not constrain the binding +// CHECK:STDERR: · ┃ [InvalidWhereInsideBinding] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic _: Z(type where .Self impls Y) where .Self impls Y) {} @@ -351,7 +453,13 @@ library "[[@TEST_NAME]]"; interface Z(T: type) {} interface Y {} -// CHECK:STDERR: fail_where_triple_nested_inside_binding.carbon:[[@LINE+2]]:18-44: error: found `where` expression in binding's type that does not constrain the binding [InvalidWhereInsideBinding] +// CHECK:STDERR: ╭─┤ fail_where_triple_nested_inside_binding.carbon:[[@LINE+8]]:18 +// CHECK:STDERR: -> │ fn F(generic _: (Z(type where .Self impls Y) where .Self impls Y) where .S... +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: found `where` expression in binding's type that +// CHECK:STDERR: · ┃ does not constrain the binding +// CHECK:STDERR: · ┃ [InvalidWhereInsideBinding] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic _: (Z(type where .Self impls Y) where .Self impls Y) where .Self impls Y) {} @@ -361,7 +469,13 @@ library "[[@TEST_NAME]]"; interface Z(T: type) {} interface Y {} -// CHECK:STDERR: fail_where_nested_inside_binding_combined.carbon:[[@LINE+2]]:17-47: error: found `where` expression in binding's type that does not constrain the binding [InvalidWhereInsideBinding] +// CHECK:STDERR: ╭─┤ fail_where_nested_inside_binding_combined.carbon:[[@LINE+8]]:17 +// CHECK:STDERR: -> │ fn F(generic _: Z(type where .Self impls Y) & Y) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: found `where` expression in binding's type that does +// CHECK:STDERR: · ┃ not constrain the binding +// CHECK:STDERR: · ┃ [InvalidWhereInsideBinding] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic _: Z(type where .Self impls Y) & Y) {} @@ -371,7 +485,13 @@ library "[[@TEST_NAME]]"; interface Z(T: type) {} interface Y {} -// CHECK:STDERR: fail_where_double_nested_inside_binding_combined.carbon:[[@LINE+2]]:17-69: error: found `where` expression in binding's type that does not constrain the binding [InvalidWhereInsideBinding] +// CHECK:STDERR: ╭─┤ fail_where_double_nested_inside_binding_combined.carbon:[[@LINE+8]]:17 +// CHECK:STDERR: -> │ fn F(generic _: (Z(type where .Self impls Y) where .Self impls Y) & Y) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: found `where` expression in binding's type that does +// CHECK:STDERR: · ┃ not constrain the binding +// CHECK:STDERR: · ┃ [InvalidWhereInsideBinding] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic _: (Z(type where .Self impls Y) where .Self impls Y) & Y) {} @@ -381,7 +501,13 @@ library "[[@TEST_NAME]]"; interface Z(T: type) {} interface Y {} -// CHECK:STDERR: fail_where_triple_nested_inside_binding_combined.carbon:[[@LINE+2]]:17-91: error: found `where` expression in binding's type that does not constrain the binding [InvalidWhereInsideBinding] +// CHECK:STDERR: ╭─┤ fail_where_triple_nested_inside_binding_combined.carbon:[[@LINE+8]]:17 +// CHECK:STDERR: -> │ fn F(generic _: ((Z(type where .Self impls Y) where .Self impls Y) where .... +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: found `where` expression in binding's type that does +// CHECK:STDERR: · ┃ not constrain the binding +// CHECK:STDERR: · ┃ [InvalidWhereInsideBinding] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic _: ((Z(type where .Self impls Y) where .Self impls Y) where .Self impls Y) & Y) {} @@ -391,7 +517,13 @@ library "[[@TEST_NAME]]"; class C(T: type); interface Y {} -// CHECK:STDERR: fail_where_nested_inside_binding_of_non_facet_type.carbon:[[@LINE+2]]:17-43: error: found `where` expression in binding's type that does not constrain the binding [InvalidWhereInsideBinding] +// CHECK:STDERR: ╭─┤ fail_where_nested_inside_binding_of_non_facet_type.carbon:[[@LINE+8]]:17 +// CHECK:STDERR: -> │ fn F(generic _: C(type where .Self impls Y)) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: found `where` expression in binding's type that does +// CHECK:STDERR: · ┃ not constrain the binding +// CHECK:STDERR: · ┃ [InvalidWhereInsideBinding] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic _: C(type where .Self impls Y)) {} @@ -401,7 +533,13 @@ library "[[@TEST_NAME]]"; interface Z(T: type) {} interface Y {} -// CHECK:STDERR: fail_where_nested_inside_runtime_let_binding.carbon:[[@LINE+2]]:9-35: error: found `where` expression in binding's type that does not constrain the binding [InvalidWhereInsideBinding] +// CHECK:STDERR: ╭─┤ fail_where_nested_inside_runtime_let_binding.carbon:[[@LINE+8]]:9 +// CHECK:STDERR: -> │ fn F(_: Z(type where .Self impls Y)) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: found `where` expression in binding's type that does not +// CHECK:STDERR: · ┃ constrain the binding +// CHECK:STDERR: · ┃ [InvalidWhereInsideBinding] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(_: Z(type where .Self impls Y)) {} @@ -411,7 +549,13 @@ library "[[@TEST_NAME]]"; interface Z(T: type) {} interface Y {} -// CHECK:STDERR: fail_where_nested_inside_form_binding.carbon:[[@LINE+2]]:10-36: error: found `where` expression in binding's type that does not constrain the binding [InvalidWhereInsideBinding] +// CHECK:STDERR: ╭─┤ fail_where_nested_inside_form_binding.carbon:[[@LINE+8]]:10 +// CHECK:STDERR: -> │ fn F(_:? Z(type where .Self impls Y)) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: found `where` expression in binding's type that does not +// CHECK:STDERR: · ┃ constrain the binding +// CHECK:STDERR: · ┃ [InvalidWhereInsideBinding] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(_:? Z(type where .Self impls Y)) {} @@ -421,6 +565,12 @@ library "[[@TEST_NAME]]"; interface Z(T: type) {} interface Y {} -// CHECK:STDERR: fail_where_nested_inside_var_binding.carbon:[[@LINE+2]]:13-39: error: found `where` expression in binding's type that does not constrain the binding [InvalidWhereInsideBinding] +// CHECK:STDERR: ╭─┤ fail_where_nested_inside_var_binding.carbon:[[@LINE+8]]:13 +// CHECK:STDERR: -> │ fn F(var _: Z(type where .Self impls Y)) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: found `where` expression in binding's type that does not +// CHECK:STDERR: · ┃ constrain the binding +// CHECK:STDERR: · ┃ [InvalidWhereInsideBinding] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(var _: Z(type where .Self impls Y)) {} diff --git a/toolchain/check/testdata/facet/nested_facet_types_from_eval.carbon b/toolchain/check/testdata/facet/nested_facet_types_from_eval.carbon index 1368e31fe93c..2dc71850a481 100644 --- a/toolchain/check/testdata/facet/nested_facet_types_from_eval.carbon +++ b/toolchain/check/testdata/facet/nested_facet_types_from_eval.carbon @@ -21,7 +21,14 @@ alias A = I where .Self == C; // The use of `A` introduces a `where` expression inside the `where` written // here, which is an error. // -// CHECK:STDERR: fail_where_nested_inside_where_through_alias_impls_lhs.carbon:[[@LINE+2]]:28-42: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] +// CHECK:STDERR: ╭─┤ fail_where_nested_inside_where_through_alias_impls_lhs.carbon:[[@LINE+9]]:28 +// CHECK:STDERR: -> │ fn F(generic _: type where C(A) impls type) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: constraint in `where` clause without a +// CHECK:STDERR: · ┃ designator; expected `.Self` or a member +// CHECK:STDERR: · ┃ access like `.M` +// CHECK:STDERR: · ┃ [WhereWithoutDesignator] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic _: type where C(A) impls type) {} @@ -35,8 +42,16 @@ alias A = type where .Self impls I; // The use of `A` introduces a `where` expression inside the `where` written // here, which is an error. // -// CHECK:STDERR: fail_where_nested_inside_where_through_alias_impls_rhs_with_self_impls_interface.carbon:[[@LINE+3]]:40: error: found `where` expression nested on the right-hand side of `where` [NestedWhereInsideWhere] -// CHECK:STDERR: fail_where_nested_inside_where_through_alias_impls_rhs_with_self_impls_interface.carbon:[[@LINE+2]]:17-26: note: on right-hand side of `where` here [NestedWhereInsideWhereOuterNote] +// CHECK:STDERR: ╭─┤ fail_where_nested_inside_where_through_alias_impls_rhs_with_self_impls_interface.carbon:[[@LINE+11]]:40 +// CHECK:STDERR: -> │ fn F(generic _: type where .Self impls A) {} +// CHECK:STDERR: · ─────┬──── ┳ +// CHECK:STDERR: · │ ┗━━┫ error: found `where` expression +// CHECK:STDERR: · │ ┃ nested on the right-hand side +// CHECK:STDERR: · │ ┃ of `where` +// CHECK:STDERR: · │ ┃ [NestedWhereInsideWhere] +// CHECK:STDERR: · ╰──────────────────────┤ on right-hand side of `where` here +// CHECK:STDERR: · │ [NestedWhereInsideWhereOuterNote] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic _: type where .Self impls A) {} @@ -50,8 +65,16 @@ alias A = type where .Self impls N; // The use of `A` introduces a `where` expression inside the `where` written // here, which is an error. // -// CHECK:STDERR: fail_where_nested_inside_where_through_alias_impls_rhs_with_self_impls_named_constraint.carbon:[[@LINE+3]]:40: error: found `where` expression nested on the right-hand side of `where` [NestedWhereInsideWhere] -// CHECK:STDERR: fail_where_nested_inside_where_through_alias_impls_rhs_with_self_impls_named_constraint.carbon:[[@LINE+2]]:17-26: note: on right-hand side of `where` here [NestedWhereInsideWhereOuterNote] +// CHECK:STDERR: ╭─┤ fail_where_nested_inside_where_through_alias_impls_rhs_with_self_impls_named_constraint.carbon:[[@LINE+11]]:40 +// CHECK:STDERR: -> │ fn F(generic _: type where .Self impls A) {} +// CHECK:STDERR: · ─────┬──── ┳ +// CHECK:STDERR: · │ ┗━━┫ error: found `where` expression +// CHECK:STDERR: · │ ┃ nested on the right-hand side +// CHECK:STDERR: · │ ┃ of `where` +// CHECK:STDERR: · │ ┃ [NestedWhereInsideWhere] +// CHECK:STDERR: · ╰──────────────────────┤ on right-hand side of `where` here +// CHECK:STDERR: · │ [NestedWhereInsideWhereOuterNote] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic _: type where .Self impls A) {} @@ -66,8 +89,16 @@ alias A = type where C impls I(.Self); // The use of `A` introduces a `where` expression inside the `where` written // here, which is an error. // -// CHECK:STDERR: fail_where_nested_inside_where_through_alias_impls_rhs_with_type_impls_interface.carbon:[[@LINE+3]]:40: error: found `where` expression nested on the right-hand side of `where` [NestedWhereInsideWhere] -// CHECK:STDERR: fail_where_nested_inside_where_through_alias_impls_rhs_with_type_impls_interface.carbon:[[@LINE+2]]:17-26: note: on right-hand side of `where` here [NestedWhereInsideWhereOuterNote] +// CHECK:STDERR: ╭─┤ fail_where_nested_inside_where_through_alias_impls_rhs_with_type_impls_interface.carbon:[[@LINE+11]]:40 +// CHECK:STDERR: -> │ fn F(generic _: type where .Self impls A) {} +// CHECK:STDERR: · ─────┬──── ┳ +// CHECK:STDERR: · │ ┗━━┫ error: found `where` expression +// CHECK:STDERR: · │ ┃ nested on the right-hand side +// CHECK:STDERR: · │ ┃ of `where` +// CHECK:STDERR: · │ ┃ [NestedWhereInsideWhere] +// CHECK:STDERR: · ╰──────────────────────┤ on right-hand side of `where` here +// CHECK:STDERR: · │ [NestedWhereInsideWhereOuterNote] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic _: type where .Self impls A) {} @@ -82,8 +113,16 @@ alias A = type where C impls N(.Self); // The use of `A` introduces a `where` expression inside the `where` written // here, which is an error. // -// CHECK:STDERR: fail_where_nested_inside_where_through_alias_impls_rhs_with_type_impls_named_constraint.carbon:[[@LINE+3]]:40: error: found `where` expression nested on the right-hand side of `where` [NestedWhereInsideWhere] -// CHECK:STDERR: fail_where_nested_inside_where_through_alias_impls_rhs_with_type_impls_named_constraint.carbon:[[@LINE+2]]:17-26: note: on right-hand side of `where` here [NestedWhereInsideWhereOuterNote] +// CHECK:STDERR: ╭─┤ fail_where_nested_inside_where_through_alias_impls_rhs_with_type_impls_named_constraint.carbon:[[@LINE+11]]:40 +// CHECK:STDERR: -> │ fn F(generic _: type where .Self impls A) {} +// CHECK:STDERR: · ─────┬──── ┳ +// CHECK:STDERR: · │ ┗━━┫ error: found `where` expression +// CHECK:STDERR: · │ ┃ nested on the right-hand side +// CHECK:STDERR: · │ ┃ of `where` +// CHECK:STDERR: · │ ┃ [NestedWhereInsideWhere] +// CHECK:STDERR: · ╰──────────────────────┤ on right-hand side of `where` here +// CHECK:STDERR: · │ [NestedWhereInsideWhereOuterNote] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic _: type where .Self impls A) {} @@ -98,8 +137,16 @@ alias A = I where .I1 = C; // The use of `A` introduces a `where` expression inside the `where` written // here, which is an error. // -// CHECK:STDERR: fail_where_nested_inside_where_through_alias_impls_rhs_with_rewrite.carbon:[[@LINE+3]]:40: error: found `where` expression nested on the right-hand side of `where` [NestedWhereInsideWhere] -// CHECK:STDERR: fail_where_nested_inside_where_through_alias_impls_rhs_with_rewrite.carbon:[[@LINE+2]]:17-26: note: on right-hand side of `where` here [NestedWhereInsideWhereOuterNote] +// CHECK:STDERR: ╭─┤ fail_where_nested_inside_where_through_alias_impls_rhs_with_rewrite.carbon:[[@LINE+11]]:40 +// CHECK:STDERR: -> │ fn F(generic _: type where .Self impls A) {} +// CHECK:STDERR: · ─────┬──── ┳ +// CHECK:STDERR: · │ ┗━━┫ error: found `where` expression +// CHECK:STDERR: · │ ┃ nested on the right-hand side +// CHECK:STDERR: · │ ┃ of `where` +// CHECK:STDERR: · │ ┃ [NestedWhereInsideWhere] +// CHECK:STDERR: · ╰──────────────────────┤ on right-hand side of `where` here +// CHECK:STDERR: · │ [NestedWhereInsideWhereOuterNote] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic _: type where .Self impls A) {} @@ -113,8 +160,16 @@ alias A = type where .Self == C; // The use of `A` introduces a `where` expression inside the `where` written // here, which is an error. // -// CHECK:STDERR: fail_where_nested_inside_where_through_alias_impls_rhs_with_equiv.carbon:[[@LINE+3]]:40: error: found `where` expression nested on the right-hand side of `where` [NestedWhereInsideWhere] -// CHECK:STDERR: fail_where_nested_inside_where_through_alias_impls_rhs_with_equiv.carbon:[[@LINE+2]]:17-26: note: on right-hand side of `where` here [NestedWhereInsideWhereOuterNote] +// CHECK:STDERR: ╭─┤ fail_where_nested_inside_where_through_alias_impls_rhs_with_equiv.carbon:[[@LINE+11]]:40 +// CHECK:STDERR: -> │ fn F(generic _: type where .Self impls A) {} +// CHECK:STDERR: · ─────┬──── ┳ +// CHECK:STDERR: · │ ┗━━┫ error: found `where` expression +// CHECK:STDERR: · │ ┃ nested on the right-hand side +// CHECK:STDERR: · │ ┃ of `where` +// CHECK:STDERR: · │ ┃ [NestedWhereInsideWhere] +// CHECK:STDERR: · ╰──────────────────────┤ on right-hand side of `where` here +// CHECK:STDERR: · │ [NestedWhereInsideWhereOuterNote] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic _: type where .Self impls A) {} @@ -129,8 +184,15 @@ alias A = I where .Self == C; // The use of `A` introduces a `where` expression inside the `where` written // here, which is an error. // -// CHECK:STDERR: fail_where_nested_inside_where_through_alias_rewrite_rhs.carbon:[[@LINE+3]]:31: error: found `where` expression nested on the right-hand side of `where` [NestedWhereInsideWhere] -// CHECK:STDERR: fail_where_nested_inside_where_through_alias_rewrite_rhs.carbon:[[@LINE+2]]:17-23: note: on right-hand side of `where` here [NestedWhereInsideWhereOuterNote] +// CHECK:STDERR: ╭─┤ fail_where_nested_inside_where_through_alias_rewrite_rhs.carbon:[[@LINE+10]]:31 +// CHECK:STDERR: -> │ fn F(generic _: I where .I1 = A) {} +// CHECK:STDERR: · ───┬─── ┳ +// CHECK:STDERR: · │ ┗━━┫ error: found `where` expression nested on the +// CHECK:STDERR: · │ ┃ right-hand side of `where` +// CHECK:STDERR: · │ ┃ [NestedWhereInsideWhere] +// CHECK:STDERR: · ╰───────────────┤ on right-hand side of `where` here +// CHECK:STDERR: · │ [NestedWhereInsideWhereOuterNote] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic _: I where .I1 = A) {} @@ -145,8 +207,15 @@ alias A = I where .Self == C; // The use of `A` introduces a `where` expression inside the `where` written // here, which is an error. // -// CHECK:STDERR: fail_where_nested_inside_where_through_alias_equiv_lhs.carbon:[[@LINE+3]]:28: error: found `where` expression nested on the right-hand side of `where` [NestedWhereInsideWhere] -// CHECK:STDERR: fail_where_nested_inside_where_through_alias_equiv_lhs.carbon:[[@LINE+2]]:17-26: note: on right-hand side of `where` here [NestedWhereInsideWhereOuterNote] +// CHECK:STDERR: ╭─┤ fail_where_nested_inside_where_through_alias_equiv_lhs.carbon:[[@LINE+10]]:28 +// CHECK:STDERR: -> │ fn F(generic _: type where A == .Self) {} +// CHECK:STDERR: · ─────┬──── ┳ +// CHECK:STDERR: · │ ┗━━┫ error: found `where` expression nested on the +// CHECK:STDERR: · │ ┃ right-hand side of `where` +// CHECK:STDERR: · │ ┃ [NestedWhereInsideWhere] +// CHECK:STDERR: · ╰──────────┤ on right-hand side of `where` here +// CHECK:STDERR: · │ [NestedWhereInsideWhereOuterNote] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic _: type where A == .Self) {} @@ -161,8 +230,16 @@ alias A = I where .Self == C; // The use of `A` introduces a `where` expression inside the `where` written // here, which is an error. // -// CHECK:STDERR: fail_where_nested_inside_where_through_alias_equiv_rhs.carbon:[[@LINE+3]]:37: error: found `where` expression nested on the right-hand side of `where` [NestedWhereInsideWhere] -// CHECK:STDERR: fail_where_nested_inside_where_through_alias_equiv_rhs.carbon:[[@LINE+2]]:17-26: note: on right-hand side of `where` here [NestedWhereInsideWhereOuterNote] +// CHECK:STDERR: ╭─┤ fail_where_nested_inside_where_through_alias_equiv_rhs.carbon:[[@LINE+11]]:37 +// CHECK:STDERR: -> │ fn F(generic _: type where .Self == A) {} +// CHECK:STDERR: · ─────┬──── ┳ +// CHECK:STDERR: · │ ┗━━┫ error: found `where` expression nested +// CHECK:STDERR: · │ ┃ on the right-hand side of +// CHECK:STDERR: · │ ┃ `where` +// CHECK:STDERR: · │ ┃ [NestedWhereInsideWhere] +// CHECK:STDERR: · ╰───────────────────┤ on right-hand side of `where` here +// CHECK:STDERR: · │ [NestedWhereInsideWhereOuterNote] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic _: type where .Self == A) {} @@ -179,8 +256,16 @@ eval fn E() -> type { // The use of `E()` introduces a `where` expression inside the `where` // written here, which is an error. // -// CHECK:STDERR: fail_where_nested_inside_where_through_fn_eval.carbon:[[@LINE+3]]:40-42: error: found `where` expression nested on the right-hand side of `where` [NestedWhereInsideWhere] -// CHECK:STDERR: fail_where_nested_inside_where_through_fn_eval.carbon:[[@LINE+2]]:17-26: note: on right-hand side of `where` here [NestedWhereInsideWhereOuterNote] +// CHECK:STDERR: ╭─┤ fail_where_nested_inside_where_through_fn_eval.carbon:[[@LINE+11]]:40 +// CHECK:STDERR: -> │ fn F(generic _: type where .Self impls E()) {} +// CHECK:STDERR: · ─────┬──── ┳━━ +// CHECK:STDERR: · │ ┗━━┫ error: found `where` expression +// CHECK:STDERR: · │ ┃ nested on the right-hand side +// CHECK:STDERR: · │ ┃ of `where` +// CHECK:STDERR: · │ ┃ [NestedWhereInsideWhere] +// CHECK:STDERR: · ╰──────────────────────┤ on right-hand side of `where` here +// CHECK:STDERR: · │ [NestedWhereInsideWhereOuterNote] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic _: type where .Self impls E()) {} @@ -202,7 +287,15 @@ alias X = {} as X1; // The use of `type * X` introduces a `where` expression inside the `where` // written here, which is an error. // -// CHECK:STDERR: fail_where_nested_inside_where_through_operator_eval.carbon:[[@LINE+3]]:40-47: error: found `where` expression nested on the right-hand side of `where` [NestedWhereInsideWhere] -// CHECK:STDERR: fail_where_nested_inside_where_through_operator_eval.carbon:[[@LINE+2]]:17-26: note: on right-hand side of `where` here [NestedWhereInsideWhereOuterNote] +// CHECK:STDERR: ╭─┤ fail_where_nested_inside_where_through_operator_eval.carbon:[[@LINE+11]]:40 +// CHECK:STDERR: -> │ fn F(generic _: type where .Self impls type * X) {} +// CHECK:STDERR: · ─────┬──── ┳━━━━━━━ +// CHECK:STDERR: · │ ┗━━┫ error: found `where` expression +// CHECK:STDERR: · │ ┃ nested on the right-hand side +// CHECK:STDERR: · │ ┃ of `where` +// CHECK:STDERR: · │ ┃ [NestedWhereInsideWhere] +// CHECK:STDERR: · ╰──────────────────────┤ on right-hand side of `where` here +// CHECK:STDERR: · │ [NestedWhereInsideWhereOuterNote] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic _: type where .Self impls type * X) {} diff --git a/toolchain/check/testdata/facet/partially_identified.carbon b/toolchain/check/testdata/facet/partially_identified.carbon index 3707ff6c1a34..a2e9f06c4c72 100644 --- a/toolchain/check/testdata/facet/partially_identified.carbon +++ b/toolchain/check/testdata/facet/partially_identified.carbon @@ -16,8 +16,18 @@ library "[[@TEST_NAME]]"; interface Y {} interface NeedsY(T: Y) {} constraint W { - // CHECK:STDERR: fail_self_doesnt_meet_constraint.carbon:[[@LINE+3]]:24-35: error: cannot convert type `Self` that implements `W` into type implementing `Y` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_self_doesnt_meet_constraint.carbon:[[@LINE-3]]:18-21: note: initializing generic parameter `T` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_self_doesnt_meet_constraint.carbon:[[@LINE+13]]:24 + // CHECK:STDERR: │ interface NeedsY(T: Y) {} + // CHECK:STDERR: · ──┬─ + // CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ extend require impls NeedsY(Self); + // CHECK:STDERR: · ┳━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `Self` that implements + // CHECK:STDERR: · ┃ `W` into type implementing `Y` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend require impls NeedsY(Self); } @@ -168,8 +178,18 @@ interface X { let XZ: Z; } constraint W { require impls Z; // Target of impl lookup can not be partially identified. - // CHECK:STDERR: fail_impl_lookup_target_partially_identified.carbon:[[@LINE+3]]:32-46: error: facet type `Z & W` can not be identified [ImplLookupInUnidentifiedFacetType] - // CHECK:STDERR: fail_impl_lookup_target_partially_identified.carbon:[[@LINE-4]]:1-14: note: constraint is currently being defined [NamedConstraintIncompleteWithinDefinition] + // CHECK:STDERR: ╭─┤ fail_impl_lookup_target_partially_identified.carbon:[[@LINE+13]]:32 + // CHECK:STDERR: │ constraint W { + // CHECK:STDERR: · ───────┬────── + // CHECK:STDERR: · ╰──┤ constraint is currently being defined + // CHECK:STDERR: · │ [NamedConstraintIncompleteWithinDefinition] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ require impls X where .XZ = (Self as (W & Z)); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: facet type `Z & W` can not be + // CHECK:STDERR: · ┃ identified + // CHECK:STDERR: · ┃ [ImplLookupInUnidentifiedFacetType] + // CHECK:STDERR: ╰──── // CHECK:STDERR: require impls X where .XZ = (Self as (W & Z)); } diff --git a/toolchain/check/testdata/facet/period_self.carbon b/toolchain/check/testdata/facet/period_self.carbon index 83fd6d15a5bb..b37443d324d9 100644 --- a/toolchain/check/testdata/facet/period_self.carbon +++ b/toolchain/check/testdata/facet/period_self.carbon @@ -41,7 +41,12 @@ fn G(generic _: I(.Self) where .I1 = ()) {} // --- fail_period_self_as_type.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_period_self_as_type.carbon:[[@LINE+2]]:16-20: error: `.Self` used in a type that is not a facet type [PeriodSelfInNonFacetType] +// CHECK:STDERR: ╭─┤ fail_period_self_as_type.carbon:[[@LINE+7]]:16 +// CHECK:STDERR: -> │ interface I(T: .Self) { +// CHECK:STDERR: · ━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: `.Self` used in a type that is not a facet type +// CHECK:STDERR: · ┃ [PeriodSelfInNonFacetType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: interface I(T: .Self) { fn G() -> T; @@ -84,17 +89,32 @@ fn F2[U: I(.Self)](unused T: U*) {} fn F(generic U: I(.Self)) { // Caller sees the returned `.Self` type from `F()` as the full `U`. - // CHECK:STDERR: fail_todo_return_of_type_period_self.carbon:[[@LINE+2]]:3-10: error: type `.Self` does not support qualified expressions [QualifiedExprUnsupported] + // CHECK:STDERR: ╭─┤ fail_todo_return_of_type_period_self.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ U.G()->G()->G(); + // CHECK:STDERR: · ━━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: type `.Self` does not support qualified expressions + // CHECK:STDERR: · ┃ [QualifiedExprUnsupported] + // CHECK:STDERR: ╰──── // CHECK:STDERR: U.G()->G()->G(); // Conversion to `type` retains access to all of `U`. - // CHECK:STDERR: fail_todo_return_of_type_period_self.carbon:[[@LINE+2]]:3-20: error: type `.Self` does not support qualified expressions [QualifiedExprUnsupported] + // CHECK:STDERR: ╭─┤ fail_todo_return_of_type_period_self.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ (U as type).G()->G()->G(); + // CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: type `.Self` does not support qualified expressions + // CHECK:STDERR: · ┃ [QualifiedExprUnsupported] + // CHECK:STDERR: ╰──── // CHECK:STDERR: (U as type).G()->G()->G(); // Using the returned `.Self` as a facet value works, not just member lookup // on its facet type. - // CHECK:STDERR: fail_todo_return_of_type_period_self.carbon:[[@LINE+2]]:6-13: error: type `.Self` does not support qualified expressions [QualifiedExprUnsupported] + // CHECK:STDERR: ╭─┤ fail_todo_return_of_type_period_self.carbon:[[@LINE+7]]:6 + // CHECK:STDERR: -> │ F2(U.G()->G()->G()); + // CHECK:STDERR: · ━━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: type `.Self` does not support qualified expressions + // CHECK:STDERR: · ┃ [QualifiedExprUnsupported] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F2(U.G()->G()->G()); } @@ -115,15 +135,30 @@ fn F2[U: I(.Self) & J(.Self)](unused T: U*) {} fn F(generic U: I(.Self) & J(.Self)) { // TODO: The returned value of `I1` and `J1` has type `U` which has access to // the methods of `I` and `J`. - // CHECK:STDERR: fail_todo_return_of_type_period_self_extends_interface.carbon:[[@LINE+2]]:3-12: error: type `.Self` does not support qualified expressions [QualifiedExprUnsupported] + // CHECK:STDERR: ╭─┤ fail_todo_return_of_type_period_self_extends_interface.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ U.I1()->J1()->I1()->J1()->I1()->J1(); + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: type `.Self` does not support qualified expressions + // CHECK:STDERR: · ┃ [QualifiedExprUnsupported] + // CHECK:STDERR: ╰──── // CHECK:STDERR: U.I1()->J1()->I1()->J1()->I1()->J1(); - // CHECK:STDERR: fail_todo_return_of_type_period_self_extends_interface.carbon:[[@LINE+2]]:3-22: error: type `.Self` does not support qualified expressions [QualifiedExprUnsupported] + // CHECK:STDERR: ╭─┤ fail_todo_return_of_type_period_self_extends_interface.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ (U as type).I1()->J1()->I1()->J1()->I1()->J1(); + // CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: type `.Self` does not support qualified expressions + // CHECK:STDERR: · ┃ [QualifiedExprUnsupported] + // CHECK:STDERR: ╰──── // CHECK:STDERR: (U as type).I1()->J1()->I1()->J1()->I1()->J1(); // TODO: Using the returned value of type `U` as a facet value works. - // CHECK:STDERR: fail_todo_return_of_type_period_self_extends_interface.carbon:[[@LINE+2]]:6-15: error: type `.Self` does not support qualified expressions [QualifiedExprUnsupported] + // CHECK:STDERR: ╭─┤ fail_todo_return_of_type_period_self_extends_interface.carbon:[[@LINE+7]]:6 + // CHECK:STDERR: -> │ F2(U.I1()->J1()->I1()->J1()->I1()->J1()); + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: type `.Self` does not support qualified expressions + // CHECK:STDERR: · ┃ [QualifiedExprUnsupported] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F2(U.I1()->J1()->I1()->J1()->I1()->J1()); } @@ -147,22 +182,40 @@ fn G(generic U: I(.Self) where .Self impls J(.Self)) { // TODO: This step should work. // - // CHECK:STDERR: fail_todo_return_of_period_self_impls_interface.carbon:[[@LINE+3]]:14-19: error: cannot implicitly convert expression of type `.Self` to `U` [ConversionFailure] - // CHECK:STDERR: fail_todo_return_of_period_self_impls_interface.carbon:[[@LINE+2]]:14-19: note: type `.Self` does not implement interface `Core.ImplicitAs(U)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_todo_return_of_period_self_impls_interface.carbon:[[@LINE+11]]:14 + // CHECK:STDERR: -> │ let u: U = U.I1(); + // CHECK:STDERR: · ┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `.Self` to + // CHECK:STDERR: · │ ┃ `U` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `.Self` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(U)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let u: U = U.I1(); // `u` is a non-type value. Can call methods with `self` through compound // member lookup, but can't call methods without `self`. See the // `compound_access_through_call_with_self_param.carbon` test for the former. // - // CHECK:STDERR: fail_todo_return_of_period_self_impls_interface.carbon:[[@LINE+2]]:6-9: error: type `` does not support qualified expressions [QualifiedExprUnsupported] + // CHECK:STDERR: ╭─┤ fail_todo_return_of_period_self_impls_interface.carbon:[[@LINE+7]]:6 + // CHECK:STDERR: -> │ u.(J.J1)(); + // CHECK:STDERR: · ━━┳━ + // CHECK:STDERR: · ┗━━┫ error: type `` does not support qualified expressions + // CHECK:STDERR: · ┃ [QualifiedExprUnsupported] + // CHECK:STDERR: ╰──── // CHECK:STDERR: u.(J.J1)(); // This is the same as the above, since U.I1() returns a non-type value of // type `U`. // - // CHECK:STDERR: fail_todo_return_of_period_self_impls_interface.carbon:[[@LINE+2]]:11-14: error: type `` does not support qualified expressions [QualifiedExprUnsupported] + // CHECK:STDERR: ╭─┤ fail_todo_return_of_period_self_impls_interface.carbon:[[@LINE+7]]:11 + // CHECK:STDERR: -> │ U.I1().(J.J1)(); + // CHECK:STDERR: · ━┳━━ + // CHECK:STDERR: · ┗━━┫ error: type `` does not support qualified expressions + // CHECK:STDERR: · ┃ [QualifiedExprUnsupported] + // CHECK:STDERR: ╰──── // CHECK:STDERR: U.I1().(J.J1)(); } @@ -175,8 +228,16 @@ interface I(T: type) { } fn F(generic U: I(.Self)) { - // CHECK:STDERR: fail_todo_return_of_type_period_self_has_type_u.carbon:[[@LINE+3]]:21-25: error: cannot implicitly convert expression of type `.Self` to `U` [ConversionFailure] - // CHECK:STDERR: fail_todo_return_of_type_period_self_has_type_u.carbon:[[@LINE+2]]:21-25: note: type `.Self` does not implement interface `Core.ImplicitAs(U)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_todo_return_of_type_period_self_has_type_u.carbon:[[@LINE+11]]:21 + // CHECK:STDERR: -> │ let unused a: U = U.G(); + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type + // CHECK:STDERR: · │ ┃ `.Self` to `U` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `.Self` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(U)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused a: U = U.G(); } @@ -209,8 +270,19 @@ interface I(T: Core.Destroy) {} // TODO: Implied constraints that `.Self` impls `Core.Destroy` are satisfied by // the `&` expression. // -// CHECK:STDERR: fail_todo_period_self_parameter_constraint_satisfied_with_type_and.carbon:[[@LINE+3]]:39-46: error: cannot convert type `.Self` into type implementing `Core.Destroy` [ConversionFailureTypeToFacet] -// CHECK:STDERR: fail_todo_period_self_parameter_constraint_satisfied_with_type_and.carbon:[[@LINE-6]]:13-27: note: initializing generic parameter `T` declared here [InitializingGenericParam] +// CHECK:STDERR: ╭─┤ fail_todo_period_self_parameter_constraint_satisfied_with_type_and.carbon:[[@LINE+14]]:39 +// CHECK:STDERR: │ interface I(T: Core.Destroy) {} +// CHECK:STDERR: · ───────┬─────── +// CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here +// CHECK:STDERR: · │ [InitializingGenericParam] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn F(unused generic U: Core.Destroy & I(.Self)) {} +// CHECK:STDERR: · ┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot convert type `.Self` +// CHECK:STDERR: · ┃ into type implementing +// CHECK:STDERR: · ┃ `Core.Destroy` +// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused generic U: Core.Destroy & I(.Self)) {} @@ -271,8 +343,22 @@ interface Z {} // This is missing `.Self impls M` so the `final impl` is not used, through // deduction is attempted. // -// CHECK:STDERR: fail_infinite_cycle_identifying_associated_constant_as_impls_type_missing_impls_m.carbon:[[@LINE+3]]:53-61: error: cannot implicitly convert expression of type `T.(L.W)` to `{}` [ConversionFailure] -// CHECK:STDERR: fail_infinite_cycle_identifying_associated_constant_as_impls_type_missing_impls_m.carbon:[[@LINE+2]]:53-61: note: type `T.(L.W)` does not implement interface `Core.ImplicitAs({})` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_infinite_cycle_identifying_associated_constant_as_impls_type_missing_impls_m.carbon:[[@LINE+17]]:53 +// CHECK:STDERR: -> │ fn F(generic T: L where .W impls Z, a: T.W) -> {} { return a; } +// CHECK:STDERR: · ┳━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot +// CHECK:STDERR: · │ ┃ implicitly +// CHECK:STDERR: · │ ┃ convert +// CHECK:STDERR: · │ ┃ expression of +// CHECK:STDERR: · │ ┃ type `T.(L.W)` +// CHECK:STDERR: · │ ┃ to `{}` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╰────┤ type `T.(L.W)` does +// CHECK:STDERR: · │ not implement +// CHECK:STDERR: · │ interface +// CHECK:STDERR: · │ `Core.ImplicitAs({})` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic T: L where .W impls Z, a: T.W) -> {} { return a; } @@ -311,8 +397,16 @@ interface Z(T: type) {} // This is missing `.Self impls M` so the `final impl` is not used, through // deduction is attempted. // -// CHECK:STDERR: fail_infinite_cycle_identifying_associated_constant_in_impls_interface_as_type_missing_m.carbon:[[@LINE+3]]:60-68: error: cannot implicitly convert expression of type `T.(L.W)` to `()` [ConversionFailure] -// CHECK:STDERR: fail_infinite_cycle_identifying_associated_constant_in_impls_interface_as_type_missing_m.carbon:[[@LINE+2]]:60-68: note: type `T.(L.W)` does not implement interface `Core.ImplicitAs(())` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_infinite_cycle_identifying_associated_constant_in_impls_interface_as_type_missing_m.carbon:[[@LINE+11]]:60 +// CHECK:STDERR: -> │ fn F(generic T: L where .Self impls Z(.W), a: T.W) -> () { return a; } +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: cannot implicitly convert expression of type `T.(L.W)` to `()` +// CHECK:STDERR: · ┃ [ConversionFailure] +// CHECK:STDERR: · ╭──────────────────────────────────────────────────────────────╯ +// CHECK:STDERR: · │ type `T.(L.W)` does not implement interface `Core.ImplicitAs(())` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic T: L where .Self impls Z(.W), a: T.W) -> () { return a; } @@ -329,8 +423,16 @@ interface Z(T: L) {} // This is missing `.Self impls M` so the `final impl` is not used, through // deduction is attempted. // -// CHECK:STDERR: fail_infinite_cycle_identifying_period_self_in_impls_interface_as_type_missing_m.carbon:[[@LINE+3]]:63-71: error: cannot implicitly convert expression of type `T.(L.W)` to `()` [ConversionFailure] -// CHECK:STDERR: fail_infinite_cycle_identifying_period_self_in_impls_interface_as_type_missing_m.carbon:[[@LINE+2]]:63-71: note: type `T.(L.W)` does not implement interface `Core.ImplicitAs(())` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_infinite_cycle_identifying_period_self_in_impls_interface_as_type_missing_m.carbon:[[@LINE+11]]:63 +// CHECK:STDERR: -> │ fn F(generic T: L where .Self impls Z(.Self), a: T.W) -> () { return a; } +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: cannot implicitly convert expression of type `T.(L.W)` to `()` +// CHECK:STDERR: · ┃ [ConversionFailure] +// CHECK:STDERR: · ╭─────────────────────────────────────────────────────────────────╯ +// CHECK:STDERR: · │ type `T.(L.W)` does not implement interface `Core.ImplicitAs(())` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic T: L where .Self impls Z(.Self), a: T.W) -> () { return a; } @@ -370,8 +472,16 @@ interface Z(T: Y) {} // This is missing `.Self impls M` so the `final impl` is not used, through // deduction is attempted. // -// CHECK:STDERR: fail_infinite_cycle_identifying_associated_constant_in_impls_interface_as_facet_type_missing_m.carbon:[[@LINE+3]]:75-83: error: cannot implicitly convert expression of type `T.(L.W)` to `()` [ConversionFailure] -// CHECK:STDERR: fail_infinite_cycle_identifying_associated_constant_in_impls_interface_as_facet_type_missing_m.carbon:[[@LINE+2]]:75-83: note: type `T.(L.W)` does not implement interface `Core.ImplicitAs(())` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_infinite_cycle_identifying_associated_constant_in_impls_interface_as_facet_type_missing_m.carbon:[[@LINE+11]]:75 +// CHECK:STDERR: -> │ ...c T: L where .W impls Y and .Self impls Z(.W), a: T.W) -> () { return a; } +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: cannot implicitly convert expression of type `T.(L.W)` to `()` +// CHECK:STDERR: · ┃ [ConversionFailure] +// CHECK:STDERR: · ╭─────────────────────────────────────────────────────────────────────╯ +// CHECK:STDERR: · │ type `T.(L.W)` does not implement interface `Core.ImplicitAs(())` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic T: L where .W impls Y and .Self impls Z(.W), a: T.W) -> () { return a; } @@ -432,8 +542,16 @@ class C(U: Y, v: U.Y1.L1) { // This creates a bug in the toolchain since the specific is now wrong and we're // unable to get the concrete value of `C(T, ()).C1`. fn F(generic T: Y where .Y1 impls M and C(.Self, ()) impls M) -> C(T, ()).C1 { - // CHECK:STDERR: fail_todo_specific_resolves_final_impl_while_collecting_witnesses.carbon:[[@LINE+3]]:3-12: error: cannot implicitly convert expression of type `()` to `T.(Y.Y1).(L.L1)` [ConversionFailure] - // CHECK:STDERR: fail_todo_specific_resolves_final_impl_while_collecting_witnesses.carbon:[[@LINE+2]]:3-12: note: type `()` does not implement interface `Core.ImplicitAs(T.(Y.Y1).(L.L1))` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_todo_specific_resolves_final_impl_while_collecting_witnesses.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: -> │ return (); + // CHECK:STDERR: · ┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `()` to + // CHECK:STDERR: · │ ┃ `T.(Y.Y1).(L.L1)` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `()` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(T.(Y.Y1).(L.L1))` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return (); } @@ -612,7 +730,15 @@ class C(C1: type); // // TODO: We have a witness for `L(.Self: type)` but we need a witness for // `L(.Self: (L(.Self: type) & M(.Self: type)))`, so this fails to convert. -// CHECK:STDERR: fail_todo_concrete_access_witness_generic_m_in_extend_constraint_compound_access.carbon:[[@LINE+2]]:47-64: error: cannot convert type `.Self` that implements `L(.Self) & M(.Self)` into type implementing `L(.Self)` [ConversionFailureFacetToFacet] +// CHECK:STDERR: ╭─┤ fail_todo_concrete_access_witness_generic_m_in_extend_constraint_compound_access.carbon:[[@LINE+10]]:47 +// CHECK:STDERR: -> │ ...ric T: (L(.Self) & M(.Self)) where C(.Self.(L(.Self).W)) impls Z(.Self)) { +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot convert type `.Self` +// CHECK:STDERR: · ┃ that implements +// CHECK:STDERR: · ┃ `L(.Self) & M(.Self)` into +// CHECK:STDERR: · ┃ type implementing `L(.Self)` +// CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn H(generic T: (L(.Self) & M(.Self)) where C(.Self.(L(.Self).W)) impls Z(.Self)) { C(()) as Z(T); @@ -640,7 +766,12 @@ class C(C1: type); // witness for `M(.Self: L(.Self: type))` instead, so we don't use the impl. // The test passes if we write `.W` as `.Self.(L(.Self).W)` instead. fn H(generic T: (L(.Self) where .Self impls M(.Self)) where C(.W) impls Z(.Self)) { - // CHECK:STDERR: fail_todo_concrete_access_witness_generic_m_in_impls_interface.carbon:[[@LINE+2]]:3-15: error: cannot convert type `C(())` into type implementing `Z(T)` [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╭─┤ fail_todo_concrete_access_witness_generic_m_in_impls_interface.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ C(()) as Z(T); + // CHECK:STDERR: · ━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `C(())` into type implementing `Z(T)` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: C(()) as Z(T); } @@ -668,7 +799,12 @@ class C(C1: type); // witness for `M(.Self: L(.Self: type))` instead, so we don't use the impl. // The test passes if we write `.W` as `.Self.(L(.Self).W)` instead. fn H(generic T: (L(.Self) where .Self impls GivesM(.Self)) where C(.W) impls Z(.Self)) { - // CHECK:STDERR: fail_todo_concrete_access_witness_generic_m_in_impls_constraint.carbon:[[@LINE+2]]:3-15: error: cannot convert type `C(())` into type implementing `Z(T)` [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╭─┤ fail_todo_concrete_access_witness_generic_m_in_impls_constraint.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ C(()) as Z(T); + // CHECK:STDERR: · ━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `C(())` into type implementing `Z(T)` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: C(()) as Z(T); } @@ -736,7 +872,12 @@ class C(C1: type); // witness for `M(.Self: L(.Self: type))` instead, so we don't use the impl. // The test passes if we write `.W` as `.Self.(L(.Self).W)` instead. fn H(generic T: L(.Self) where .Self impls M(.Self) and C(.W) impls Z(.Self)) { - // CHECK:STDERR: fail_todo_concrete_access_witness_generic_m_in_earlier_requirement.carbon:[[@LINE+2]]:3-15: error: cannot convert type `C(())` into type implementing `Z(T)` [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╭─┤ fail_todo_concrete_access_witness_generic_m_in_earlier_requirement.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ C(()) as Z(T); + // CHECK:STDERR: · ━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `C(())` into type implementing `Z(T)` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: C(()) as Z(T); } @@ -762,7 +903,12 @@ class C(C1: type); // cycle that identifies `T`, which deduces `T: M` for the `impl`, which // identifies `T`. See TODO in CollectFacetWitnessSources for ideas. fn F(generic T: L where C(.W) impls Z(.Self) and .Self impls M) { - // CHECK:STDERR: fail_todo_concrete_access_witness.carbon:[[@LINE+2]]:3-15: error: cannot convert type `C(())` into type implementing `Z(T)` [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╭─┤ fail_todo_concrete_access_witness.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ C(()) as Z(T); + // CHECK:STDERR: · ━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `C(())` into type implementing `Z(T)` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: C(()) as Z(T); } @@ -772,7 +918,12 @@ library "[[@TEST_NAME]]"; class C(T: type); -// CHECK:STDERR: fail_period_self_in_class_argument.carbon:[[@LINE+2]]:17-24: error: `.Self` used in a type that is not a facet type [PeriodSelfInNonFacetType] +// CHECK:STDERR: ╭─┤ fail_period_self_in_class_argument.carbon:[[@LINE+7]]:17 +// CHECK:STDERR: -> │ fn F(generic _: C(.Self)) {} +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: `.Self` used in a type that is not a facet type +// CHECK:STDERR: · ┃ [PeriodSelfInNonFacetType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic _: C(.Self)) {} @@ -781,9 +932,22 @@ library "[[@TEST_NAME]]"; class C(T: type); -// CHECK:STDERR: fail_period_self_in_class_argument_in_where.carbon:[[@LINE+4]]:17-24: error: left argument of `where` operator must be a facet type [WhereOnNonFacetType] +// CHECK:STDERR: ╭─┤ fail_period_self_in_class_argument_in_where.carbon:[[@LINE+17]]:17 +// CHECK:STDERR: -> │ fn F(generic _: C(.Self) where type == type) {} +// CHECK:STDERR: · ┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: left argument of `where` operator must be a facet +// CHECK:STDERR: · ┃ type +// CHECK:STDERR: · ┃ [WhereOnNonFacetType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_period_self_in_class_argument_in_where.carbon:[[@LINE+2]]:32-43: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] +// CHECK:STDERR: ╭─┤ fail_period_self_in_class_argument_in_where.carbon:[[@LINE+9]]:32 +// CHECK:STDERR: -> │ fn F(generic _: C(.Self) where type == type) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: constraint in `where` clause without +// CHECK:STDERR: · ┃ a designator; expected `.Self` or a +// CHECK:STDERR: · ┃ member access like `.M` +// CHECK:STDERR: · ┃ [WhereWithoutDesignator] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic _: C(.Self) where type == type) {} @@ -793,7 +957,12 @@ library "[[@TEST_NAME]]"; class C(T: type); interface Z(T: type); -// CHECK:STDERR: fail_period_self_in_interface_argument_in_class_argument.carbon:[[@LINE+2]]:17-27: error: `.Self` used in a type that is not a facet type [PeriodSelfInNonFacetType] +// CHECK:STDERR: ╭─┤ fail_period_self_in_interface_argument_in_class_argument.carbon:[[@LINE+7]]:17 +// CHECK:STDERR: -> │ fn F(generic _: C(Z(.Self))) {} +// CHECK:STDERR: · ━━━━━┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `.Self` used in a type that is not a facet type +// CHECK:STDERR: · ┃ [PeriodSelfInNonFacetType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic _: C(Z(.Self))) {} @@ -811,7 +980,14 @@ interface Y(T: type) { eval fn YF() -> T; } -// CHECK:STDERR: fail_todo_period_self_in_interface_generic_argument.carbon:[[@LINE+2]]:44-48: error: cannot convert type `.(Y(Z where .(Z.Z1) = ()).YF)()` that implements `Z where .(Z.Z1) = ()` into type implementing `Z where .(Z.Z1) = ()` [ConversionFailureFacetToFacet] +// CHECK:STDERR: ╭─┤ fail_todo_period_self_in_interface_generic_argument.carbon:[[@LINE+9]]:44 +// CHECK:STDERR: -> │ impl () as Y(Z where .Z1 = ()) where .Y1 = .YF() {} +// CHECK:STDERR: · ━━┳━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: cannot convert type `.(Y(Z where .(Z.Z1) = ()).YF)()` that implements +// CHECK:STDERR: · ┃ `Z where .(Z.Z1) = ()` into type implementing `Z where .(Z.Z1) = ()` +// CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as Y(Z where .Z1 = ()) where .Y1 = .YF() {} diff --git a/toolchain/check/testdata/facet/require_import.carbon b/toolchain/check/testdata/facet/require_import.carbon index a718d6edccea..af457791fd25 100644 --- a/toolchain/check/testdata/facet/require_import.carbon +++ b/toolchain/check/testdata/facet/require_import.carbon @@ -43,7 +43,13 @@ fn F(generic B: Y) { // Y` since the identified facet type doesn't include Z. We need to be able to // find a symbolic facet from the require decl in Y during impl lookup. // - // CHECK:STDERR: fail_todo_symbolic_facet_interface_requires_interface.carbon:[[@LINE+2]]:3-5: error: cannot access member of interface `Z(B)` in type `B` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_todo_symbolic_facet_interface_requires_interface.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ B.F(); + // CHECK:STDERR: · ┳━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Z(B)` in type `B` that does not + // CHECK:STDERR: · ┃ implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: B.F(); } diff --git a/toolchain/check/testdata/facet/require_invalid.carbon b/toolchain/check/testdata/facet/require_invalid.carbon index d5366f0b5ddd..9491dbc6e584 100644 --- a/toolchain/check/testdata/facet/require_invalid.carbon +++ b/toolchain/check/testdata/facet/require_invalid.carbon @@ -15,7 +15,12 @@ library "[[@TEST_NAME]]"; interface Y {} -// CHECK:STDERR: fail_require_outside_scope.carbon:[[@LINE+2]]:1-7: error: `require` can only be used in an `interface` or `constraint` [RequireInWrongScope] +// CHECK:STDERR: ╭─┤ fail_require_outside_scope.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ require impls Y; +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: `require` can only be used in an `interface` or `constraint` +// CHECK:STDERR: · ┃ [RequireInWrongScope] +// CHECK:STDERR: ╰──── // CHECK:STDERR: require impls Y; @@ -25,7 +30,12 @@ library "[[@TEST_NAME]]"; interface Y {} class C { - // CHECK:STDERR: fail_require_in_class.carbon:[[@LINE+2]]:3-9: error: `require` can only be used in an `interface` or `constraint` [RequireInWrongScope] + // CHECK:STDERR: ╭─┤ fail_require_in_class.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ require impls Y; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: `require` can only be used in an `interface` or `constraint` + // CHECK:STDERR: · ┃ [RequireInWrongScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: require impls Y; } @@ -38,9 +48,18 @@ interface Y {} fn F() { // require is not allowed outside of `interface` or `constraint`. // - // CHECK:STDERR: fail_require_in_fn.carbon:[[@LINE+4]]:3-9: error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╭─┤ fail_require_in_fn.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: -> │ require impls Y; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_require_in_fn.carbon:[[@LINE+2]]:3-9: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_require_in_fn.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ require impls Y; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `handle invalid parse trees in `check`` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: require impls Y; } @@ -54,7 +73,12 @@ interface Z { // TODO: Add `default` modifier. fn F() { class C { - // CHECK:STDERR: fail_require_in_nested_class.carbon:[[@LINE+2]]:7-13: error: `require` can only be used in an `interface` or `constraint` [RequireInWrongScope] + // CHECK:STDERR: ╭─┤ fail_require_in_nested_class.carbon:[[@LINE+7]]:7 + // CHECK:STDERR: -> │ require impls Y; + // CHECK:STDERR: · ━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: `require` can only be used in an `interface` or `constraint` + // CHECK:STDERR: · ┃ [RequireInWrongScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: require impls Y; } @@ -71,9 +95,18 @@ interface Z { fn F() { // require is not allowed outside of `interface` or `constraint`. // - // CHECK:STDERR: fail_require_in_nested_fn.carbon:[[@LINE+4]]:5-11: error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╭─┤ fail_require_in_nested_fn.carbon:[[@LINE+13]]:5 + // CHECK:STDERR: -> │ require impls Y; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_require_in_nested_fn.carbon:[[@LINE+2]]:5-11: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_require_in_nested_fn.carbon:[[@LINE+7]]:5 + // CHECK:STDERR: -> │ require impls Y; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `handle invalid parse trees in `check`` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: require impls Y; } @@ -86,9 +119,18 @@ class C { // The `require` is diagnosed as being in the wrong place. But we can still // diagnose issues inside the decl too. // - // CHECK:STDERR: fail_errors_in_require_still_found.carbon:[[@LINE+4]]:3-9: error: `require` can only be used in an `interface` or `constraint` [RequireInWrongScope] + // CHECK:STDERR: ╭─┤ fail_errors_in_require_still_found.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: -> │ require impls Y; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: `require` can only be used in an `interface` or `constraint` + // CHECK:STDERR: · ┃ [RequireInWrongScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_errors_in_require_still_found.carbon:[[@LINE+2]]:17: error: name `Y` not found [NameNotFound] + // CHECK:STDERR: ╭─┤ fail_errors_in_require_still_found.carbon:[[@LINE+6]]:17 + // CHECK:STDERR: -> │ require impls Y; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: name `Y` not found [NameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: require impls Y; } @@ -99,7 +141,12 @@ library "[[@TEST_NAME]]"; interface Y {} interface Z { - // CHECK:STDERR: fail_extend_require_type.carbon:[[@LINE+2]]:18-19: error: `extend require impls` with explicit type [RequireImplsExtendWithExplicitSelf] + // CHECK:STDERR: ╭─┤ fail_extend_require_type.carbon:[[@LINE+7]]:18 + // CHECK:STDERR: -> │ extend require () impls Y; + // CHECK:STDERR: · ━┳ + // CHECK:STDERR: · ┗━━┫ error: `extend require impls` with explicit type + // CHECK:STDERR: · ┃ [RequireImplsExtendWithExplicitSelf] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend require () impls Y; @@ -117,13 +164,22 @@ library "[[@TEST_NAME]]"; interface Y {} interface Z { - // CHECK:STDERR: fail_require_with_nonexistent_type.carbon:[[@LINE+2]]:11-21: error: name `nonexistent` not found [NameNotFound] + // CHECK:STDERR: ╭─┤ fail_require_with_nonexistent_type.carbon:[[@LINE+6]]:11 + // CHECK:STDERR: -> │ require nonexistent impls Y; + // CHECK:STDERR: · ━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: name `nonexistent` not found [NameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: require nonexistent impls Y; fn F() { // The name lookup error still happens, since the `require` is not `extend`. - // CHECK:STDERR: fail_require_with_nonexistent_type.carbon:[[@LINE+2]]:5-10: error: member name `A` not found in `Z` [MemberNameNotFoundInSpecificScope] + // CHECK:STDERR: ╭─┤ fail_require_with_nonexistent_type.carbon:[[@LINE+7]]:5 + // CHECK:STDERR: -> │ Self.A; + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: member name `A` not found in `Z` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInSpecificScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Self.A; } @@ -135,7 +191,11 @@ library "[[@TEST_NAME]]"; interface Y {} interface Z { - // CHECK:STDERR: fail_extend_require_with_nonexistent_type.carbon:[[@LINE+2]]:18-28: error: name `nonexistent` not found [NameNotFound] + // CHECK:STDERR: ╭─┤ fail_extend_require_with_nonexistent_type.carbon:[[@LINE+6]]:18 + // CHECK:STDERR: -> │ extend require nonexistent impls Y; + // CHECK:STDERR: · ━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: name `nonexistent` not found [NameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend require nonexistent impls Y; @@ -153,7 +213,11 @@ library "[[@TEST_NAME]]"; interface Y {} interface Z { - // CHECK:STDERR: fail_extend_require_with_nonexistent_type_pointer.carbon:[[@LINE+2]]:18-28: error: name `nonexistent` not found [NameNotFound] + // CHECK:STDERR: ╭─┤ fail_extend_require_with_nonexistent_type_pointer.carbon:[[@LINE+6]]:18 + // CHECK:STDERR: -> │ extend require nonexistent* impls Y; + // CHECK:STDERR: · ━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: name `nonexistent` not found [NameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend require nonexistent* impls Y; @@ -178,7 +242,12 @@ fn G() { class C {} // .Z0 has the wrong type for M. impl C as Z where .Z0 = () {} - // CHECK:STDERR: fail_impl_mismatch_named_constraint_rewrites.carbon:[[@LINE+2]]:3-8: error: cannot convert type `C` into type implementing `M` [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╭─┤ fail_impl_mismatch_named_constraint_rewrites.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ C as M; + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `C` into type implementing `M` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: C as M; } diff --git a/toolchain/check/testdata/facet/runtime_value.carbon b/toolchain/check/testdata/facet/runtime_value.carbon index 4b6db6b7f252..f5aa8f845302 100644 --- a/toolchain/check/testdata/facet/runtime_value.carbon +++ b/toolchain/check/testdata/facet/runtime_value.carbon @@ -44,7 +44,13 @@ fn F(c: C) { // TODO: This copy should work, but the narrowing prevents it currently. // //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_facet_copy_narrowing_from_reference.carbon:[[@LINE+2]]:21-24: error: semantics TODO: `conversion of runtime facet value` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_facet_copy_narrowing_from_reference.carbon:[[@LINE+8]]:21 + // CHECK:STDERR: -> │ let unused a: I = c.ij; + // CHECK:STDERR: · ┳━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: + // CHECK:STDERR: · ┃ `conversion of runtime facet value` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused a: I = c.ij; //@dump-sem-ir-end @@ -57,7 +63,13 @@ interface Z { let X: type; } -// CHECK:STDERR: fail_compound_member_lookup_in_runtime_facet_without_value.carbon:[[@LINE+2]]:15-21: error: semantics TODO: `associated value lookup on runtime facet value` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_compound_member_lookup_in_runtime_facet_without_value.carbon:[[@LINE+8]]:15 +// CHECK:STDERR: -> │ fn F(T: Z, v: T.(Z.X)); +// CHECK:STDERR: · ┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: +// CHECK:STDERR: · ┃ `associated value lookup on runtime facet value` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(T: Z, v: T.(Z.X)); @@ -72,7 +84,13 @@ interface Z { // _and_ its facet type doesn't specific a value for `.X`. Or make this work // by producing an ImplWitnessAccess that functions against a runtime facet. // -// CHECK:STDERR: fail_member_lookup_in_runtime_facet_without_value.carbon:[[@LINE+2]]:15-17: error: cannot access member of interface `Z` in type `Z` that does not implement that interface [MissingImplInMemberAccess] +// CHECK:STDERR: ╭─┤ fail_member_lookup_in_runtime_facet_without_value.carbon:[[@LINE+8]]:15 +// CHECK:STDERR: -> │ fn F(T: Z, v: T.X); +// CHECK:STDERR: · ┳━━ +// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Z` in type `Z` that +// CHECK:STDERR: · ┃ does not implement that interface +// CHECK:STDERR: · ┃ [MissingImplInMemberAccess] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(T: Z, v: T.X); @@ -86,7 +104,13 @@ interface Z { // TODO: We should be able to get the value of `.X` from the `FacetType` of // `T`. // -// CHECK:STDERR: fail_todo_compound_member_lookup_in_runtime_facet_with_value.carbon:[[@LINE+2]]:29-35: error: semantics TODO: `conversion of runtime facet value` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_todo_compound_member_lookup_in_runtime_facet_with_value.carbon:[[@LINE+8]]:29 +// CHECK:STDERR: -> │ fn F(T: Z where .X = (), v: T.(Z.X)); +// CHECK:STDERR: · ┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: +// CHECK:STDERR: · ┃ `conversion of runtime facet value` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(T: Z where .X = (), v: T.(Z.X)); @@ -100,7 +124,14 @@ interface Z { // TODO: We should be able to get the value of `.X` from the `FacetType` of // `T`. // -// CHECK:STDERR: fail_todo_member_lookup_in_runtime_facet_with_value.carbon:[[@LINE+2]]:29-31: error: cannot access member of interface `Z` in type `Z where .(Z.X) = ()` that does not implement that interface [MissingImplInMemberAccess] +// CHECK:STDERR: ╭─┤ fail_todo_member_lookup_in_runtime_facet_with_value.carbon:[[@LINE+9]]:29 +// CHECK:STDERR: -> │ fn F(T: Z where .X = (), v: T.X); +// CHECK:STDERR: · ┳━━ +// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Z` in +// CHECK:STDERR: · ┃ type `Z where .(Z.X) = ()` that does not +// CHECK:STDERR: · ┃ implement that interface +// CHECK:STDERR: · ┃ [MissingImplInMemberAccess] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(T: Z where .X = (), v: T.X); @@ -112,7 +143,13 @@ interface Z { } fn F(T: Z) { - // CHECK:STDERR: fail_todo_member_lookup_in_type_of_runtime_facet_with_value.carbon:[[@LINE+2]]:3-5: error: cannot access member of interface `Z` in type `Z` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_todo_member_lookup_in_type_of_runtime_facet_with_value.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ T.G(); + // CHECK:STDERR: · ┳━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Z` in type `Z` that does not + // CHECK:STDERR: · ┃ implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: T.G(); } @@ -125,7 +162,13 @@ interface Z { } fn F(T: Z) { - // CHECK:STDERR: fail_member_access_runtime_facet.carbon:[[@LINE+2]]:3-5: error: cannot access member of interface `Z` in type `Z` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_member_access_runtime_facet.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ T.G(); + // CHECK:STDERR: · ┳━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Z` in type `Z` that does not + // CHECK:STDERR: · ┃ implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: T.G(); } @@ -134,7 +177,12 @@ fn F(T: Z) { library "[[@TEST_NAME]]"; fn F(T: type) { - // CHECK:STDERR: fail_member_access_runtime_type.carbon:[[@LINE+2]]:3-5: error: type `type` does not support qualified expressions [QualifiedExprUnsupported] + // CHECK:STDERR: ╭─┤ fail_member_access_runtime_type.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ T.G(); + // CHECK:STDERR: · ━┳━ + // CHECK:STDERR: · ┗━━┫ error: type `type` does not support qualified expressions + // CHECK:STDERR: · ┃ [QualifiedExprUnsupported] + // CHECK:STDERR: ╰──── // CHECK:STDERR: T.G(); } @@ -180,8 +228,8 @@ fn F(T: type) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %c.ref: %C = name_ref c, %c // CHECK:STDOUT: %ij.ref: %C.elem = name_ref ij, @C.%field_decl [concrete = @C.%field_decl] -// CHECK:STDOUT: %.loc19_22.1: ref %facet_type = class_element_access %c.ref, element0 -// CHECK:STDOUT: %.loc19_22.2: %facet_type = acquire_value %.loc19_22.1 +// CHECK:STDOUT: %.loc25_22.1: ref %facet_type = class_element_access %c.ref, element0 +// CHECK:STDOUT: %.loc25_22.2: %facet_type = acquire_value %.loc25_22.1 // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: %a: %I.type = wrapper_binding a, [concrete = ] // CHECK:STDOUT: name_binding_decl { diff --git a/toolchain/check/testdata/facet/tuple_and_struct_type_literal.carbon b/toolchain/check/testdata/facet/tuple_and_struct_type_literal.carbon index 9a53e516811e..2011671dca2a 100644 --- a/toolchain/check/testdata/facet/tuple_and_struct_type_literal.carbon +++ b/toolchain/check/testdata/facet/tuple_and_struct_type_literal.carbon @@ -48,7 +48,14 @@ interface Z { impl ((), {}) as Y {} -// CHECK:STDERR: fail_mismatch_tuple_literal_to_facet_value.carbon:[[@LINE+2]]:41-48: error: cannot convert type `({}, {})` into type implementing `Y` [ConversionFailureTypeToFacet] +// CHECK:STDERR: ╭─┤ fail_mismatch_tuple_literal_to_facet_value.carbon:[[@LINE+9]]:41 +// CHECK:STDERR: -> │ impl forall [T: type] T as Z where .X = ({}, {}) {} +// CHECK:STDERR: · ┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot convert type +// CHECK:STDERR: · ┃ `({}, {})` into type +// CHECK:STDERR: · ┃ implementing `Y` +// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [T: type] T as Z where .X = ({}, {}) {} @@ -90,7 +97,14 @@ interface Z { impl {.a: (), .b: {}} as Y {} -// CHECK:STDERR: fail_mismatch_struct_literal_to_facet_value.carbon:[[@LINE+2]]:41-56: error: cannot convert type `{.a: {}, .b: {}}` into type implementing `Y` [ConversionFailureTypeToFacet] +// CHECK:STDERR: ╭─┤ fail_mismatch_struct_literal_to_facet_value.carbon:[[@LINE+9]]:41 +// CHECK:STDERR: -> │ impl forall [T: type] T as Z where .X = {.a: {}, .b: {}} {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot convert type +// CHECK:STDERR: · ┃ `{.a: {}, .b: {}}` into type +// CHECK:STDERR: · ┃ implementing `Y` +// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [T: type] T as Z where .X = {.a: {}, .b: {}} {} @@ -122,14 +136,38 @@ fn InterfaceParam(unused generic U: Z) {} fn ConstraintParam(unused generic U: N) {} fn F() { - // CHECK:STDERR: fail_struct_literal_with_field_to_facet_type_parameter.carbon:[[@LINE+4]]:3-27: error: cannot implicitly convert non-type value of type `{.a: ()}` into type implementing `Z` [ConversionFailureNonTypeToFacet] - // CHECK:STDERR: fail_struct_literal_with_field_to_facet_type_parameter.carbon:[[@LINE+3]]:3-27: note: type `{.a: ()}` does not implement interface `Core.ImplicitAs(Z)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: fail_struct_literal_with_field_to_facet_type_parameter.carbon:[[@LINE-6]]:34-37: note: initializing generic parameter `U` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_struct_literal_with_field_to_facet_type_parameter.carbon:[[@LINE+16]]:3 + // CHECK:STDERR: │ fn InterfaceParam(unused generic U: Z) {} + // CHECK:STDERR: · ┬─── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `U` + // CHECK:STDERR: · │ declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ InterfaceParam({.a = ()}); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert non-type value of type `{.a: ()}` into + // CHECK:STDERR: · │ ┃ type implementing `Z` + // CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: · ╰────┤ type `{.a: ()}` does not implement interface `Core.ImplicitAs(Z)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: InterfaceParam({.a = ()}); - // CHECK:STDERR: fail_struct_literal_with_field_to_facet_type_parameter.carbon:[[@LINE+4]]:3-28: error: cannot implicitly convert non-type value of type `{.a: ()}` into type implementing `N` [ConversionFailureNonTypeToFacet] - // CHECK:STDERR: fail_struct_literal_with_field_to_facet_type_parameter.carbon:[[@LINE+3]]:3-28: note: type `{.a: ()}` does not implement interface `Core.ImplicitAs(N)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: fail_struct_literal_with_field_to_facet_type_parameter.carbon:[[@LINE-10]]:35-38: note: initializing generic parameter `U` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_struct_literal_with_field_to_facet_type_parameter.carbon:[[@LINE+16]]:3 + // CHECK:STDERR: │ fn ConstraintParam(unused generic U: N) {} + // CHECK:STDERR: · ┬─── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `U` + // CHECK:STDERR: · │ declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ ConstraintParam({.a = ()}); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert non-type value of type `{.a: ()}` into + // CHECK:STDERR: · │ ┃ type implementing `N` + // CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: · ╰────┤ type `{.a: ()}` does not implement interface `Core.ImplicitAs(N)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: ConstraintParam({.a = ()}); } diff --git a/toolchain/check/testdata/facet/tuple_and_struct_type_value.carbon b/toolchain/check/testdata/facet/tuple_and_struct_type_value.carbon index 73521f9839f3..8f69dd424c34 100644 --- a/toolchain/check/testdata/facet/tuple_and_struct_type_value.carbon +++ b/toolchain/check/testdata/facet/tuple_and_struct_type_value.carbon @@ -75,14 +75,38 @@ fn InterfaceParam(unused generic U: Z) {} fn ConstraintParam(unused generic U: N) {} fn F(generic T: {.a: type}) { - // CHECK:STDERR: fail_struct_value_with_field_to_facet_value.carbon:[[@LINE+4]]:3-19: error: cannot implicitly convert non-type value of type `{.a: type}` into type implementing `Z` [ConversionFailureNonTypeToFacet] - // CHECK:STDERR: fail_struct_value_with_field_to_facet_value.carbon:[[@LINE+3]]:3-19: note: type `{.a: type}` does not implement interface `Core.ImplicitAs(Z)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: fail_struct_value_with_field_to_facet_value.carbon:[[@LINE-6]]:34-37: note: initializing generic parameter `U` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_struct_value_with_field_to_facet_value.carbon:[[@LINE+16]]:3 + // CHECK:STDERR: │ fn InterfaceParam(unused generic U: Z) {} + // CHECK:STDERR: · ┬─── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `U` + // CHECK:STDERR: · │ declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ InterfaceParam(T); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert non-type value of type `{.a: type}` into + // CHECK:STDERR: · │ ┃ type implementing `Z` + // CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: · ╰────┤ type `{.a: type}` does not implement interface `Core.ImplicitAs(Z)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: InterfaceParam(T); - // CHECK:STDERR: fail_struct_value_with_field_to_facet_value.carbon:[[@LINE+4]]:3-20: error: cannot implicitly convert non-type value of type `{.a: type}` into type implementing `N` [ConversionFailureNonTypeToFacet] - // CHECK:STDERR: fail_struct_value_with_field_to_facet_value.carbon:[[@LINE+3]]:3-20: note: type `{.a: type}` does not implement interface `Core.ImplicitAs(N)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: fail_struct_value_with_field_to_facet_value.carbon:[[@LINE-10]]:35-38: note: initializing generic parameter `U` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_struct_value_with_field_to_facet_value.carbon:[[@LINE+16]]:3 + // CHECK:STDERR: │ fn ConstraintParam(unused generic U: N) {} + // CHECK:STDERR: · ┬─── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `U` + // CHECK:STDERR: · │ declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ ConstraintParam(T); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert non-type value of type `{.a: type}` into + // CHECK:STDERR: · │ ┃ type implementing `N` + // CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: · ╰────┤ type `{.a: type}` does not implement interface `Core.ImplicitAs(N)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: ConstraintParam(T); } diff --git a/toolchain/check/testdata/facet/validate_impl_constraints.carbon b/toolchain/check/testdata/facet/validate_impl_constraints.carbon index e1a8403cb13b..3dd6a594e039 100644 --- a/toolchain/check/testdata/facet/validate_impl_constraints.carbon +++ b/toolchain/check/testdata/facet/validate_impl_constraints.carbon @@ -22,8 +22,18 @@ constraint N { } fn G(generic T: I where .Self impls N) { - // CHECK:STDERR: fail_todo_self_impls_modifies_assoc_constant.carbon:[[@LINE+3]]:3-6: error: cannot convert type `T` that implements `I where .Self impls N` into type implementing `I where .(I.X) = ()` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_todo_self_impls_modifies_assoc_constant.carbon:[[@LINE-8]]:21-38: note: initializing generic parameter `T` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_todo_self_impls_modifies_assoc_constant.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn F(unused generic T: I where .X = ()) {} + // CHECK:STDERR: · ───────┬────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(T); + // CHECK:STDERR: · ┳━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `T` that implements `I where .Self impls N` + // CHECK:STDERR: · ┃ into type implementing `I where .(I.X) = ()` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(T); } @@ -40,8 +50,18 @@ constraint N { } fn G(generic T: I where .Self impls N) { - // CHECK:STDERR: fail_self_impls_modifies_assoc_constant_type_differs.carbon:[[@LINE+3]]:3-6: error: cannot convert type `T` that implements `I where .Self impls N` into type implementing `I where .(I.X) = ()` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_self_impls_modifies_assoc_constant_type_differs.carbon:[[@LINE-8]]:21-38: note: initializing generic parameter `T` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_self_impls_modifies_assoc_constant_type_differs.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn F(unused generic T: I where .X = ()) {} + // CHECK:STDERR: · ───────┬────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(T); + // CHECK:STDERR: · ┳━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `T` that implements `I where .Self impls N` + // CHECK:STDERR: · ┃ into type implementing `I where .(I.X) = ()` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(T); } @@ -70,8 +90,18 @@ fn G(generic T: L) { // `(C(T) as M).M0` concretely, so we don't know that it is `{}` and we can't // convert assuming it is. // - // CHECK:STDERR: fail_where_impls_tests_associated_constant_of_generic_type_non_final_impl.carbon:[[@LINE+3]]:3-6: error: cannot convert type `T` that implements `L` into type implementing `type where C(.Self) impls M0IsStruct` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_where_impls_tests_associated_constant_of_generic_type_non_final_impl.carbon:[[@LINE-8]]:21-59: note: initializing generic parameter `U` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_where_impls_tests_associated_constant_of_generic_type_non_final_impl.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn F(unused generic U: type where C(.Self) impls M0IsStruct) {} + // CHECK:STDERR: · ───────┬─────────────────────────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `U` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(T); + // CHECK:STDERR: · ┳━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `T` that implements `L` into type implementing + // CHECK:STDERR: · ┃ `type where C(.Self) impls M0IsStruct` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(T); } @@ -121,8 +151,18 @@ fn F(unused generic U: type where C(.Self) impls M0IsStruct) {} fn G(generic T: L) { // F requires .M0 = {}, but the final impl provides .M0 = (). // - // CHECK:STDERR: fail_where_impls_tests_associated_constant_of_generic_type_type_differs.carbon:[[@LINE+3]]:3-6: error: cannot convert type `T` that implements `L` into type implementing `type where C(.Self) impls M0IsStruct` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_where_impls_tests_associated_constant_of_generic_type_type_differs.carbon:[[@LINE-6]]:21-59: note: initializing generic parameter `U` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_where_impls_tests_associated_constant_of_generic_type_type_differs.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn F(unused generic U: type where C(.Self) impls M0IsStruct) {} + // CHECK:STDERR: · ───────┬─────────────────────────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `U` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(T); + // CHECK:STDERR: · ┳━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `T` that implements `L` into type implementing + // CHECK:STDERR: · ┃ `type where C(.Self) impls M0IsStruct` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(T); } @@ -151,8 +191,18 @@ fn G(generic T: L) { // `(C as M(T)).M0` concretely, so we don't know that it is `{}` and we can't // convert assuming it is. // - // CHECK:STDERR: fail_where_impls_tests_associated_constant_of_generic_interface_non_final_impl.carbon:[[@LINE+3]]:3-6: error: cannot convert type `T` that implements `L` into type implementing `type where C impls M0IsStruct(.Self)` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_where_impls_tests_associated_constant_of_generic_interface_non_final_impl.carbon:[[@LINE-8]]:21-59: note: initializing generic parameter `U` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_where_impls_tests_associated_constant_of_generic_interface_non_final_impl.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn F(unused generic U: type where C impls M0IsStruct(.Self)) {} + // CHECK:STDERR: · ───────┬─────────────────────────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `U` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(T); + // CHECK:STDERR: · ┳━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `T` that implements `L` into type implementing + // CHECK:STDERR: · ┃ `type where C impls M0IsStruct(.Self)` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(T); } @@ -203,8 +253,18 @@ fn G(generic T: L) { // F requires that .M0 = {} but the final impl provides that .M0 = (). // // TODO: This should fail. - // CHECK:STDERR: fail_where_impls_tests_associated_constant_of_generic_interface_type_differs.carbon:[[@LINE+3]]:3-6: error: cannot convert type `T` that implements `L` into type implementing `type where C impls M0IsStruct(.Self)` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_where_impls_tests_associated_constant_of_generic_interface_type_differs.carbon:[[@LINE-7]]:21-59: note: initializing generic parameter `U` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_where_impls_tests_associated_constant_of_generic_interface_type_differs.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn F(unused generic U: type where C impls M0IsStruct(.Self)) {} + // CHECK:STDERR: · ───────┬─────────────────────────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `U` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(T); + // CHECK:STDERR: · ┳━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `T` that implements `L` into type implementing + // CHECK:STDERR: · ┃ `type where C impls M0IsStruct(.Self)` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(T); } @@ -230,13 +290,33 @@ interface I(T: Z) {} // TODO: I(.Self) introduces an implied constraint `.Self impls Z`, which is // satisfied and checked at the end of the fn signature. // -// CHECK:STDERR: fail_todo_self_in_interface_generic_param_constrained.carbon:[[@LINE+3]]:24-31: error: cannot convert type `.Self` into type implementing `Z` [ConversionFailureTypeToFacet] -// CHECK:STDERR: fail_todo_self_in_interface_generic_param_constrained.carbon:[[@LINE-6]]:13-16: note: initializing generic parameter `T` declared here [InitializingGenericParam] +// CHECK:STDERR: ╭─┤ fail_todo_self_in_interface_generic_param_constrained.carbon:[[@LINE+13]]:24 +// CHECK:STDERR: │ interface I(T: Z) {} +// CHECK:STDERR: · ──┬─ +// CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here +// CHECK:STDERR: · │ [InitializingGenericParam] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn F(unused generic T: I(.Self) where .Self impls Z) {} +// CHECK:STDERR: · ┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot convert type `.Self` into type +// CHECK:STDERR: · ┃ implementing `Z` +// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused generic T: I(.Self) where .Self impls Z) {} -// CHECK:STDERR: fail_todo_self_in_interface_generic_param_constrained.carbon:[[@LINE+3]]:21-28: error: cannot convert type `.Self` into type implementing `Z` [ConversionFailureTypeToFacet] -// CHECK:STDERR: fail_todo_self_in_interface_generic_param_constrained.carbon:[[@LINE-11]]:13-16: note: initializing generic parameter `T` declared here [InitializingGenericParam] +// CHECK:STDERR: ╭─┤ fail_todo_self_in_interface_generic_param_constrained.carbon:[[@LINE+13]]:21 +// CHECK:STDERR: │ interface I(T: Z) {} +// CHECK:STDERR: · ──┬─ +// CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here +// CHECK:STDERR: · │ [InitializingGenericParam] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn G(generic T: Z & I(.Self)) { +// CHECK:STDERR: · ┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot convert type `.Self` into type +// CHECK:STDERR: · ┃ implementing `Z` +// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn G(generic T: Z & I(.Self)) { F(T); @@ -332,8 +412,18 @@ fn G() { // ImplWitnessAccess would become concrete without being able to provide any // value, since it's still a `LookupImplWitness` type of witness. - // CHECK:STDERR: fail_concrete_witness_without_impl.carbon:[[@LINE+3]]:3-6: error: cannot convert type `C` into type implementing `I where .(I.I1) impls J` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_concrete_witness_without_impl.carbon:[[@LINE-14]]:14-35: note: initializing generic parameter `_` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_concrete_witness_without_impl.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn F(generic _: I where .I1 impls J) {} + // CHECK:STDERR: · ───────────┬────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `_` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(C); + // CHECK:STDERR: · ┳━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `C` into type implementing + // CHECK:STDERR: · ┃ `I where .(I.I1) impls J` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(C); } diff --git a/toolchain/check/testdata/facet/validate_rewrite_constraints.carbon b/toolchain/check/testdata/facet/validate_rewrite_constraints.carbon index a1c32dc2f29f..8fca023b6df7 100644 --- a/toolchain/check/testdata/facet/validate_rewrite_constraints.carbon +++ b/toolchain/check/testdata/facet/validate_rewrite_constraints.carbon @@ -48,8 +48,18 @@ fn F(generic U: type, unused generic T: I(U) where .X = ()) {} fn G() { // This finds the impl where `.X = {}`, but F requires that `.X = ()`. // - // CHECK:STDERR: fail_generic_interface_facet_value_wrong_specific_impl.carbon:[[@LINE+3]]:3-10: error: cannot convert type `C` into type implementing `I({}) where {} = ()` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_generic_interface_facet_value_wrong_specific_impl.carbon:[[@LINE-5]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_generic_interface_facet_value_wrong_specific_impl.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn F(generic U: type, unused generic T: I(U) where .X = ()) {} + // CHECK:STDERR: · ─────────────────────────┬─────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F({}, C); + // CHECK:STDERR: · ┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `C` into type implementing + // CHECK:STDERR: · ┃ `I({}) where {} = ()` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F({}, C); } @@ -76,15 +86,36 @@ fn F(unused generic T: I where .X = {.a: (), .b: {}}) {} fn H() { class C; impl C as I where .X = {.b: {}, .a: ()} {} - // CHECK:STDERR: fail_convert.carbon:[[@LINE+3]]:3-6: error: cannot convert type `C` into type implementing `I where .(I.X) = {.a: (), .b: {}}` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_convert.carbon:[[@LINE-6]]:21-52: note: initializing generic parameter `T` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_convert.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn F(unused generic T: I where .X = {.a: (), .b: {}}) {} + // CHECK:STDERR: · ───────┬──────────────────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(C); + // CHECK:STDERR: · ┳━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `C` into type implementing + // CHECK:STDERR: · ┃ `I where .(I.X) = {.a: (), .b: {}}` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(C); } fn G(generic T: I where .X = {.b: {}, .a: ()}) { - // CHECK:STDERR: fail_convert.carbon:[[@LINE+3]]:3-6: error: cannot convert type `T` that implements `I where .(I.X) = {.b: {}, .a: ()}` into type implementing `I where .(I.X) = {.a: (), .b: {}}` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_convert.carbon:[[@LINE-13]]:21-52: note: initializing generic parameter `T` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_convert.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: │ fn F(unused generic T: I where .X = {.a: (), .b: {}}) {} + // CHECK:STDERR: · ───────┬──────────────────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(T); + // CHECK:STDERR: · ┳━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `T` that implements + // CHECK:STDERR: · ┃ `I where .(I.X) = {.b: {}, .a: ()}` into type implementing + // CHECK:STDERR: · ┃ `I where .(I.X) = {.a: (), .b: {}}` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(T); } @@ -95,11 +126,28 @@ library "[[@TEST_NAME]]"; interface I { let X: type; } interface J { let Y: type; } -// CHECK:STDERR: fail_todo_dependent_rules_compound.carbon:[[@LINE+6]]:30: error: expected identifier or `Self` after `.` [ExpectedIdentifierOrSelfAfterPeriod] +// CHECK:STDERR: ╭─┤ fail_todo_dependent_rules_compound.carbon:[[@LINE+23]]:30 +// CHECK:STDERR: -> │ fn F(generic T: I & J where .(I.X) = .(J.Y)) { +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected identifier or `Self` after `.` +// CHECK:STDERR: · ┃ [ExpectedIdentifierOrSelfAfterPeriod] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_todo_dependent_rules_compound.carbon:[[@LINE+4]]:30: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_todo_dependent_rules_compound.carbon:[[@LINE+16]]:30 +// CHECK:STDERR: -> │ fn F(generic T: I & J where .(I.X) = .(J.Y)) { +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: +// CHECK:STDERR: · ┃ `handle invalid parse trees in `check`` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_todo_dependent_rules_compound.carbon:[[@LINE+2]]:39: error: expected identifier or `Self` after `.` [ExpectedIdentifierOrSelfAfterPeriod] +// CHECK:STDERR: ╭─┤ fail_todo_dependent_rules_compound.carbon:[[@LINE+8]]:39 +// CHECK:STDERR: -> │ fn F(generic T: I & J where .(I.X) = .(J.Y)) { +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected identifier or `Self` +// CHECK:STDERR: · ┃ after `.` +// CHECK:STDERR: · ┃ [ExpectedIdentifierOrSelfAfterPeriod] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic T: I & J where .(I.X) = .(J.Y)) { // Allowed since `T impls I`, `T impls J`, and has constraint providing @@ -127,11 +175,30 @@ interface I(T: type) { let X: type; } final impl forall [J: I(())] J as I({}) where .X = {} {} -// CHECK:STDERR: fail_todo_parameterized_interface_compound.carbon:[[@LINE+6]]:38: error: expected identifier or `Self` after `.` [ExpectedIdentifierOrSelfAfterPeriod] +// CHECK:STDERR: ╭─┤ fail_todo_parameterized_interface_compound.carbon:[[@LINE+25]]:38 +// CHECK:STDERR: -> │ fn F(generic T: I(()) & I({}) where .(I(()).X) = () and .(I({}).X) = {}) {} +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected identifier or `Self` +// CHECK:STDERR: · ┃ after `.` +// CHECK:STDERR: · ┃ [ExpectedIdentifierOrSelfAfterPeriod] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_todo_parameterized_interface_compound.carbon:[[@LINE+4]]:38: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_todo_parameterized_interface_compound.carbon:[[@LINE+17]]:38 +// CHECK:STDERR: -> │ fn F(generic T: I(()) & I({}) where .(I(()).X) = () and .(I({}).X) = {}) {} +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_todo_parameterized_interface_compound.carbon:[[@LINE+2]]:58: error: expected identifier or `Self` after `.` [ExpectedIdentifierOrSelfAfterPeriod] +// CHECK:STDERR: ╭─┤ fail_todo_parameterized_interface_compound.carbon:[[@LINE+10]]:58 +// CHECK:STDERR: -> │ fn F(generic T: I(()) & I({}) where .(I(()).X) = () and .(I({}).X) = {}) {} +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected +// CHECK:STDERR: · ┃ identifier +// CHECK:STDERR: · ┃ or `Self` +// CHECK:STDERR: · ┃ after `.` +// CHECK:STDERR: · ┃ [ExpectedIdentifierOrSelfAfterPeriod] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic T: I(()) & I({}) where .(I(()).X) = () and .(I({}).X) = {}) {} @@ -149,8 +216,19 @@ final impl forall [J: I(()) where .X = {}] J as I({}) where .X = {} {} fn F(unused generic T: I({}) where .X = {}) {} fn G(generic T: I(()) where .X = ()) { - // CHECK:STDERR: fail_parameterized_interface_with_wrong_where_in_impl_deduction.carbon:[[@LINE+3]]:3-6: error: cannot convert type `T` that implements `I(()) where .(I(()).X) = ()` into type implementing `I({}) where .(I({}).X) = {}` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_parameterized_interface_with_wrong_where_in_impl_deduction.carbon:[[@LINE-4]]:21-42: note: initializing generic parameter `T` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_parameterized_interface_with_wrong_where_in_impl_deduction.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: │ fn F(unused generic T: I({}) where .X = {}) {} + // CHECK:STDERR: · ───────┬────────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(T); + // CHECK:STDERR: · ┳━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `T` that implements + // CHECK:STDERR: · ┃ `I(()) where .(I(()).X) = ()` into type implementing + // CHECK:STDERR: · ┃ `I({}) where .(I({}).X) = {}` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(T); } @@ -237,14 +315,32 @@ class C; // .X2 is not set in the impl definition, so its value is an ErrorInst // in the impl's witness table. // -// CHECK:STDERR: fail_error_in_witness_table.carbon:[[@LINE+3]]:1-28: error: associated constant X2 not given a value in impl of interface I [ImplAssociatedConstantNeedsValue] -// CHECK:STDERR: fail_error_in_witness_table.carbon:[[@LINE-10]]:7-14: note: associated constant declared here [AssociatedConstantHere] +// CHECK:STDERR: ╭─┤ fail_error_in_witness_table.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: │ let X2: type; +// CHECK:STDERR: · ────┬─── +// CHECK:STDERR: · ╰──┤ associated constant declared here [AssociatedConstantHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ impl C as I where .X1 = () {} +// CHECK:STDERR: · ━━━━━┳━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: associated constant X2 not given a value in impl of interface I +// CHECK:STDERR: · ┃ [ImplAssociatedConstantNeedsValue] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl C as I where .X1 = () {} fn G() { - // CHECK:STDERR: fail_error_in_witness_table.carbon:[[@LINE+3]]:3-6: error: cannot convert type `C` into type implementing `I where .(I.X1) = .(I.X2)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_error_in_witness_table.carbon:[[@LINE-13]]:21-40: note: initializing generic parameter `T` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_error_in_witness_table.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn F(unused generic T: I where .X1 = .X2) {} + // CHECK:STDERR: · ───────┬──────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(C); + // CHECK:STDERR: · ┳━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `C` into type implementing + // CHECK:STDERR: · ┃ `I where .(I.X1) = .(I.X2)` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(C); } @@ -294,8 +390,18 @@ fn G(generic T: type) { // The type `C(T)` is generic so that the resulting impl witness will not be // effectively final. // - // CHECK:STDERR: fail_non_final_impl_deduce.carbon:[[@LINE+3]]:3-9: error: cannot convert type `C(T)` into type implementing `I where .(I.X) = ()` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_non_final_impl_deduce.carbon:[[@LINE-9]]:21-38: note: initializing generic parameter `T` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_non_final_impl_deduce.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn F(unused generic T: I where .X = ()) {} + // CHECK:STDERR: · ───────┬────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(C(T)); + // CHECK:STDERR: · ┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `C(T)` into type implementing + // CHECK:STDERR: · ┃ `I where .(I.X) = ()` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(C(T)); } @@ -313,7 +419,13 @@ fn F(generic T: type) { // The type `C(T)` is generic so that the resulting impl witness will not be // effectively final. // - // CHECK:STDERR: fail_non_final_impl_explicit.carbon:[[@LINE+2]]:3-27: error: cannot convert type `C(T)` into type implementing `I where .(I.X) = ()` [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╭─┤ fail_non_final_impl_explicit.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ C(T) as (I where .X = ()); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `C(T)` into type implementing + // CHECK:STDERR: · ┃ `I where .(I.X) = ()` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: C(T) as (I where .X = ()); } @@ -424,8 +536,19 @@ class C(T: type); fn F(unused generic T: I where .X = C(.Y)) {} fn G(generic T: I where .X = C(()) and .Y = {}) { - // CHECK:STDERR: fail_wrong_rewrite_value_in_class_param.carbon:[[@LINE+3]]:3-6: error: cannot convert type `T` that implements `I where .(I.X) = C(()) and .(I.Y) = {}` into type implementing `I where .(I.X) = C(.(I.Y))` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_wrong_rewrite_value_in_class_param.carbon:[[@LINE-4]]:21-41: note: initializing generic parameter `T` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_wrong_rewrite_value_in_class_param.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: │ fn F(unused generic T: I where .X = C(.Y)) {} + // CHECK:STDERR: · ───────┬───────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(T); + // CHECK:STDERR: · ┳━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `T` that implements + // CHECK:STDERR: · ┃ `I where .(I.X) = C(()) and .(I.Y) = {}` into type implementing + // CHECK:STDERR: · ┃ `I where .(I.X) = C(.(I.Y))` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(T); } @@ -472,8 +595,18 @@ interface I { fn F(unused generic T: I where .Y = .A) {} fn G(generic T: I where .Y = .B) { - // CHECK:STDERR: fail_wrong_function_as_rewrite_value.carbon:[[@LINE+3]]:3-6: error: cannot convert type `T` that implements `I where .(I.Y) = .(I.B)` into type implementing `I where .(I.Y) = .(I.A)` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_wrong_function_as_rewrite_value.carbon:[[@LINE-4]]:21-38: note: initializing generic parameter `T` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_wrong_function_as_rewrite_value.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn F(unused generic T: I where .Y = .A) {} + // CHECK:STDERR: · ───────┬────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(T); + // CHECK:STDERR: · ┳━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `T` that implements `I where .(I.Y) = .(I.B)` + // CHECK:STDERR: · ┃ into type implementing `I where .(I.Y) = .(I.A)` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(T); } @@ -498,8 +631,19 @@ interface J { fn F(unused generic T: I & J where .Y = .A) {} fn G(generic T: I & J where .Y = .B) { - // CHECK:STDERR: fail_wrong_function_as_rewrite_value_in_other_interface.carbon:[[@LINE+3]]:3-6: error: cannot convert type `T` that implements `I & J where .(I.Y) = .(J.B)` into type implementing `I & J where .(I.Y) = .(I.A)` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_wrong_function_as_rewrite_value_in_other_interface.carbon:[[@LINE-4]]:21-42: note: initializing generic parameter `T` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_wrong_function_as_rewrite_value_in_other_interface.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: │ fn F(unused generic T: I & J where .Y = .A) {} + // CHECK:STDERR: · ───────┬────────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(T); + // CHECK:STDERR: · ┳━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `T` that implements + // CHECK:STDERR: · ┃ `I & J where .(I.Y) = .(J.B)` into type implementing + // CHECK:STDERR: · ┃ `I & J where .(I.Y) = .(I.A)` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(T); } @@ -530,7 +674,14 @@ fn F(generic AA: A where .X = (), generic BB: B where .Y = {}) { // The types match but there may be a specialization that specifies different // types and would be prefered for a specific `AA` or `BB`. // - // CHECK:STDERR: fail_facet_type_concrete_types_match_blanket_impl_concrete_types.carbon:[[@LINE+2]]:3-43: error: cannot convert type `AA` that implements `A where .(A.X) = ()` into type implementing `C(BB as B) where .(C(BB as B).AX) = () and .(C(BB as B).BY) = {}` [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╭─┤ fail_facet_type_concrete_types_match_blanket_impl_concrete_types.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ AA as (C(BB) where .AX = () and .BY = {}); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `AA` that implements `A where .(A.X) = ()` + // CHECK:STDERR: · ┃ into type implementing + // CHECK:STDERR: · ┃ `C(BB as B) where .(C(BB as B).AX) = () and .(C(BB as B).BY) = {}` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: AA as (C(BB) where .AX = () and .BY = {}); } @@ -549,7 +700,14 @@ fn F(generic AA: A where .X = (), generic BB: B where .Y = {}) { // The types match but there may be a specialization that specifies different // types and would be prefered for a specific `AA` or `BB`. // - // CHECK:STDERR: fail_facet_type_concrete_types_become_blank_impl_types.carbon:[[@LINE+2]]:3-43: error: cannot convert type `AA` that implements `A where .(A.X) = ()` into type implementing `C(BB as B) where .(C(BB as B).AX) = () and .(C(BB as B).BY) = {}` [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╭─┤ fail_facet_type_concrete_types_become_blank_impl_types.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ AA as (C(BB) where .AX = () and .BY = {}); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `AA` that implements `A where .(A.X) = ()` + // CHECK:STDERR: · ┃ into type implementing + // CHECK:STDERR: · ┃ `C(BB as B) where .(C(BB as B).AX) = () and .(C(BB as B).BY) = {}` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: AA as (C(BB) where .AX = () and .BY = {}); } @@ -593,7 +751,14 @@ interface C(BB: B) { let AX: type; let BY: type; } final impl forall [AA: A, BB: B] AA as C(BB) where .AX = AA.X and .BY = BB.Y {} fn F(generic AA: A where .X = (), generic BB: B where .Y = {}) { - // CHECK:STDERR: fail_facet_type_concrete_types_become_final_blanket_impl_types_wrong_types.carbon:[[@LINE+2]]:3-43: error: cannot convert type `AA` that implements `A where .(A.X) = ()` into type implementing `C(BB as B) where .(C(BB as B).AX) = {} and .(C(BB as B).BY) = ()` [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╭─┤ fail_facet_type_concrete_types_become_final_blanket_impl_types_wrong_types.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ AA as (C(BB) where .AX = {} and .BY = ()); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `AA` that implements `A where .(A.X) = ()` + // CHECK:STDERR: · ┃ into type implementing + // CHECK:STDERR: · ┃ `C(BB as B) where .(C(BB as B).AX) = {} and .(C(BB as B).BY) = ()` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: AA as (C(BB) where .AX = {} and .BY = ()); } @@ -709,8 +874,19 @@ interface J(T: type) {} fn F(unused generic T: I where .X = J(())) {} fn G(generic T: I where .X = J({}) and .Y = ()) { - // CHECK:STDERR: fail_facet_type_in_assoc_constant_differs.carbon:[[@LINE+3]]:3-6: error: cannot convert type `T` that implements `I where .(I.X) = J({}) and .(I.Y) = ()` into type implementing `I where .(I.X) = J(())` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_facet_type_in_assoc_constant_differs.carbon:[[@LINE-4]]:21-41: note: initializing generic parameter `T` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_facet_type_in_assoc_constant_differs.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: │ fn F(unused generic T: I where .X = J(())) {} + // CHECK:STDERR: · ───────┬───────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(T); + // CHECK:STDERR: · ┳━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `T` that implements + // CHECK:STDERR: · ┃ `I where .(I.X) = J({}) and .(I.Y) = ()` into type implementing + // CHECK:STDERR: · ┃ `I where .(I.X) = J(())` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(T); } @@ -803,24 +979,63 @@ fn F(unused generic T: I & J & K where .K1 = .Self and .J1 = .Self and .I1 = (.K // F's requirement I1 = I2 is not met, as I1 = () and I2 = {} fn G(generic T: I & J & K where .K1 = .Self and .J1 = .Self and .I1 = () and .I2 = {}) { - // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_self_wrong_type.carbon:[[@LINE+3]]:3-6: error: cannot convert type `T` that implements `I & J & K where .(K.K1) = .Self as J and .(J.J1) = .Self as I and .(I.I1) = () and .(I.I2) = {}` into type implementing `I & J & K where .(K.K1) = .Self as J and .(J.J1) = .Self as I and .(I.I1) = .(I.I2)` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_self_wrong_type.carbon:[[@LINE-5]]:21-88: note: initializing generic parameter `T` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_rewrite_requires_subst_in_nested_access_of_self_wrong_type.carbon:[[@LINE+16]]:3 + // CHECK:STDERR: │ ... F(unused generic T: I & J & K where .K1 = .Self and .J1 = .Self and .I1 =... + // CHECK:STDERR: · ──────┬──────────────────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(T); + // CHECK:STDERR: · ━━┳━ + // CHECK:STDERR: · ┏━━━┛ + // CHECK:STDERR: · ┃ error: cannot convert type `T` that implements + // CHECK:STDERR: · ┃ `I & J & K where .(K.K1) = .Self as J and .(J.J1) = .Self as I and .(I.I1) = () and .(I.I2) = {}` + // CHECK:STDERR: · ┃ into type implementing + // CHECK:STDERR: · ┃ `I & J & K where .(K.K1) = .Self as J and .(J.J1) = .Self as I and .(I.I1) = .(I.I2)` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(T); } // F's requirement I1 = I2 is not met, as I1 = {} and I2 is unspecified fn G2(generic T: I & J & K where .K1 = .Self and .J1 = .Self and .I1 = {}) { - // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_self_wrong_type.carbon:[[@LINE+3]]:3-6: error: cannot convert type `T` that implements `I & J & K where .(K.K1) = .Self as J and .(J.J1) = .Self as I and .(I.I1) = {}` into type implementing `I & J & K where .(K.K1) = .Self as J and .(J.J1) = .Self as I and .(I.I1) = .(I.I2)` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_self_wrong_type.carbon:[[@LINE-13]]:21-88: note: initializing generic parameter `T` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_rewrite_requires_subst_in_nested_access_of_self_wrong_type.carbon:[[@LINE+16]]:3 + // CHECK:STDERR: │ ... F(unused generic T: I & J & K where .K1 = .Self and .J1 = .Self and .I1 =... + // CHECK:STDERR: · ──────┬──────────────────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(T); + // CHECK:STDERR: · ━━┳━ + // CHECK:STDERR: · ┏━━━┛ + // CHECK:STDERR: · ┃ error: cannot convert type `T` that implements + // CHECK:STDERR: · ┃ `I & J & K where .(K.K1) = .Self as J and .(J.J1) = .Self as I and .(I.I1) = {}` + // CHECK:STDERR: · ┃ into type implementing + // CHECK:STDERR: · ┃ `I & J & K where .(K.K1) = .Self as J and .(J.J1) = .Self as I and .(I.I1) = .(I.I2)` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(T); } // F's requirement I1 = I2 is not met, as I2 = {} and I1 is unspecified fn G3(generic T: I & J & K where .K1 = .Self and .J1 = .Self and .I2 = {}) { - // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_self_wrong_type.carbon:[[@LINE+3]]:3-6: error: cannot convert type `T` that implements `I & J & K where .(K.K1) = .Self as J and .(J.J1) = .Self as I and .(I.I2) = {}` into type implementing `I & J & K where .(K.K1) = .Self as J and .(J.J1) = .Self as I and .(I.I1) = .(I.I2)` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_self_wrong_type.carbon:[[@LINE-21]]:21-88: note: initializing generic parameter `T` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_rewrite_requires_subst_in_nested_access_of_self_wrong_type.carbon:[[@LINE+16]]:3 + // CHECK:STDERR: │ ... F(unused generic T: I & J & K where .K1 = .Self and .J1 = .Self and .I1 =... + // CHECK:STDERR: · ──────┬──────────────────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(T); + // CHECK:STDERR: · ━━┳━ + // CHECK:STDERR: · ┏━━━┛ + // CHECK:STDERR: · ┃ error: cannot convert type `T` that implements + // CHECK:STDERR: · ┃ `I & J & K where .(K.K1) = .Self as J and .(J.J1) = .Self as I and .(I.I2) = {}` + // CHECK:STDERR: · ┃ into type implementing + // CHECK:STDERR: · ┃ `I & J & K where .(K.K1) = .Self as J and .(J.J1) = .Self as I and .(I.I1) = .(I.I2)` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(T); } @@ -870,24 +1085,62 @@ fn F(unused generic U: I, unused generic T: J & K where .J2 = (.K1.J1).I1) {} // F's requirement J2 = I1 is not met as J2 = () and I1 = {} fn G(generic U: I where .I1 = {}, generic T: J & K where .K1 = .Self and .J1 = U and .J2 = ()) { - // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_wrong_type.carbon:[[@LINE+3]]:3-9: error: cannot convert type `T` that implements `J & K where .(J.J2) = () and .(K.K1) = .Self as J and .(J.J1) = U as I` into type implementing `J & K where .(J.J2) = .(K.K1).(J.J1).(I.I1)` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_wrong_type.carbon:[[@LINE-5]]:42-73: note: initializing generic parameter `T` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_rewrite_requires_subst_in_nested_access_of_other_wrong_type.carbon:[[@LINE+16]]:3 + // CHECK:STDERR: │ fn F(unused generic U: I, unused generic T: J & K where .J2 = (.K1.J1).I1) {} + // CHECK:STDERR: · ┬─────────────────────────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `T` + // CHECK:STDERR: · │ declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(U, T); + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┏━━━━┛ + // CHECK:STDERR: · ┃ error: cannot convert type `T` that implements + // CHECK:STDERR: · ┃ `J & K where .(J.J2) = () and .(K.K1) = .Self as J and .(J.J1) = U as I` + // CHECK:STDERR: · ┃ into type implementing `J & K where .(J.J2) = .(K.K1).(J.J1).(I.I1)` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(U, T); } // F's requirement J2 = I1 is not met as J2 = () and I1 is unspecified fn G2(generic U: I, generic T: J & K where .K1 = .Self and .J1 = U and .J2 = ()) { - // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_wrong_type.carbon:[[@LINE+3]]:3-9: error: cannot convert type `T` that implements `J & K where .(J.J2) = () and .(K.K1) = .Self as J and .(J.J1) = U` into type implementing `J & K where .(J.J2) = .(K.K1).(J.J1).(I.I1)` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_wrong_type.carbon:[[@LINE-13]]:42-73: note: initializing generic parameter `T` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_rewrite_requires_subst_in_nested_access_of_other_wrong_type.carbon:[[@LINE+16]]:3 + // CHECK:STDERR: │ fn F(unused generic U: I, unused generic T: J & K where .J2 = (.K1.J1).I1) {} + // CHECK:STDERR: · ┬─────────────────────────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `T` + // CHECK:STDERR: · │ declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(U, T); + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┏━━━━┛ + // CHECK:STDERR: · ┃ error: cannot convert type `T` that implements + // CHECK:STDERR: · ┃ `J & K where .(J.J2) = () and .(K.K1) = .Self as J and .(J.J1) = U` + // CHECK:STDERR: · ┃ into type implementing `J & K where .(J.J2) = .(K.K1).(J.J1).(I.I1)` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(U, T); } // F's requirement J2 = I1 is not met as I1 = {} and J2 is unspecified fn G3(generic U: I where .I1 = {}, generic T: J & K where .K1 = .Self and .J1 = U) { - // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_wrong_type.carbon:[[@LINE+3]]:3-9: error: cannot convert type `T` that implements `J & K where .(K.K1) = .Self as J and .(J.J1) = U as I` into type implementing `J & K where .(J.J2) = .(K.K1).(J.J1).(I.I1)` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_wrong_type.carbon:[[@LINE-21]]:42-73: note: initializing generic parameter `T` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_rewrite_requires_subst_in_nested_access_of_other_wrong_type.carbon:[[@LINE+15]]:3 + // CHECK:STDERR: │ fn F(unused generic U: I, unused generic T: J & K where .J2 = (.K1.J1).I1) {} + // CHECK:STDERR: · ┬─────────────────────────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `T` + // CHECK:STDERR: · │ declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(U, T); + // CHECK:STDERR: · ┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `T` that implements + // CHECK:STDERR: · ┃ `J & K where .(K.K1) = .Self as J and .(J.J1) = U as I` into type + // CHECK:STDERR: · ┃ implementing `J & K where .(J.J2) = .(K.K1).(J.J1).(I.I1)` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(U, T); } @@ -936,40 +1189,105 @@ fn F(unused generic U: I & J, unused generic T: K where .K2 = .K1.I1 and .K3 = . // K2 = I1 fails since K2 = {} and I1 = () fn G(generic U: I & J where .I1 = () and .J1 = {}, generic T: K where .K1 = U and .K2 = {} and .K3 = {}) { - // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_with_two_witnesses_wrong_type.carbon:[[@LINE+3]]:3-9: error: cannot convert type `T` that implements `K where .(K.K2) = {} and .(K.K1) = U as I & J and .(K.K3) = {}` into type implementing `K where .(K.K2) = .(K.K1).(I.I1) and .(K.K3) = .(K.K1).(J.J1)` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_with_two_witnesses_wrong_type.carbon:[[@LINE-5]]:46-85: note: initializing generic parameter `T` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_rewrite_requires_subst_in_nested_access_of_other_with_two_witnesses_wrong_type.carbon:[[@LINE+16]]:3 + // CHECK:STDERR: │ ...eric U: I & J, unused generic T: K where .K2 = .K1.I1 and .K3 = .K1.J1) {} + // CHECK:STDERR: · ┬─────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `T` + // CHECK:STDERR: · │ declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(U, T); + // CHECK:STDERR: · ┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `T` that implements + // CHECK:STDERR: · ┃ `K where .(K.K2) = {} and .(K.K1) = U as I & J and .(K.K3) = {}` + // CHECK:STDERR: · ┃ into type implementing + // CHECK:STDERR: · ┃ `K where .(K.K2) = .(K.K1).(I.I1) and .(K.K3) = .(K.K1).(J.J1)` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(U, T); } // K2 = I1 fails since I1 = () and K2 is unspecified. fn G2(generic U: I & J where .I1 = () and .J1 = {}, generic T: K where .K1 = U and .K3 = {}) { - // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_with_two_witnesses_wrong_type.carbon:[[@LINE+3]]:3-9: error: cannot convert type `T` that implements `K where .(K.K1) = U as I & J and .(K.K3) = {}` into type implementing `K where .(K.K2) = .(K.K1).(I.I1) and .(K.K3) = .(K.K1).(J.J1)` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_with_two_witnesses_wrong_type.carbon:[[@LINE-13]]:46-85: note: initializing generic parameter `T` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_rewrite_requires_subst_in_nested_access_of_other_with_two_witnesses_wrong_type.carbon:[[@LINE+16]]:3 + // CHECK:STDERR: │ ...eric U: I & J, unused generic T: K where .K2 = .K1.I1 and .K3 = .K1.J1) {} + // CHECK:STDERR: · ┬─────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `T` + // CHECK:STDERR: · │ declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(U, T); + // CHECK:STDERR: · ┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `T` that implements + // CHECK:STDERR: · ┃ `K where .(K.K1) = U as I & J and .(K.K3) = {}` into type + // CHECK:STDERR: · ┃ implementing + // CHECK:STDERR: · ┃ `K where .(K.K2) = .(K.K1).(I.I1) and .(K.K3) = .(K.K1).(J.J1)` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(U, T); } // K2 = I1 fails since K2 = () and I1 is unspecified. fn G3(generic U: I & J where .J1 = {}, generic T: K where .K1 = U and .K2 = () and .K3 = {}) { - // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_with_two_witnesses_wrong_type.carbon:[[@LINE+3]]:3-9: error: cannot convert type `T` that implements `K where .(K.K2) = () and .(K.K1) = U as I & J and .(K.K3) = {}` into type implementing `K where .(K.K2) = .(K.K1).(I.I1) and .(K.K3) = .(K.K1).(J.J1)` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_with_two_witnesses_wrong_type.carbon:[[@LINE-21]]:46-85: note: initializing generic parameter `T` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_rewrite_requires_subst_in_nested_access_of_other_with_two_witnesses_wrong_type.carbon:[[@LINE+16]]:3 + // CHECK:STDERR: │ ...eric U: I & J, unused generic T: K where .K2 = .K1.I1 and .K3 = .K1.J1) {} + // CHECK:STDERR: · ┬─────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `T` + // CHECK:STDERR: · │ declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(U, T); + // CHECK:STDERR: · ┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `T` that implements + // CHECK:STDERR: · ┃ `K where .(K.K2) = () and .(K.K1) = U as I & J and .(K.K3) = {}` + // CHECK:STDERR: · ┃ into type implementing + // CHECK:STDERR: · ┃ `K where .(K.K2) = .(K.K1).(I.I1) and .(K.K3) = .(K.K1).(J.J1)` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(U, T); } // K3 = J1 fails since J1 = {} and K3 is unspecified. fn G4(generic U: I & J where .I1 = () and .J1 = {}, generic T: K where .K1 = U and .K2 = ()) { - // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_with_two_witnesses_wrong_type.carbon:[[@LINE+3]]:3-9: error: cannot convert type `T` that implements `K where .(K.K2) = () and .(K.K1) = U as I & J` into type implementing `K where .(K.K2) = .(K.K1).(I.I1) and .(K.K3) = .(K.K1).(J.J1)` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_with_two_witnesses_wrong_type.carbon:[[@LINE-29]]:46-85: note: initializing generic parameter `T` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_rewrite_requires_subst_in_nested_access_of_other_with_two_witnesses_wrong_type.carbon:[[@LINE+16]]:3 + // CHECK:STDERR: │ ...eric U: I & J, unused generic T: K where .K2 = .K1.I1 and .K3 = .K1.J1) {} + // CHECK:STDERR: · ┬─────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `T` + // CHECK:STDERR: · │ declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(U, T); + // CHECK:STDERR: · ┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `T` that implements + // CHECK:STDERR: · ┃ `K where .(K.K2) = () and .(K.K1) = U as I & J` into type + // CHECK:STDERR: · ┃ implementing + // CHECK:STDERR: · ┃ `K where .(K.K2) = .(K.K1).(I.I1) and .(K.K3) = .(K.K1).(J.J1)` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(U, T); } // K3 = J1 fails since K3 = {} and J1 is unspecified. fn G5(generic U: I & J where .I1 = (), generic T: K where .K1 = U and .K2 = () and .K3 = {}) { - // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_with_two_witnesses_wrong_type.carbon:[[@LINE+3]]:3-9: error: cannot convert type `T` that implements `K where .(K.K2) = () and .(K.K1) = U as I & J and .(K.K3) = {}` into type implementing `K where .(K.K2) = .(K.K1).(I.I1) and .(K.K3) = .(K.K1).(J.J1)` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_rewrite_requires_subst_in_nested_access_of_other_with_two_witnesses_wrong_type.carbon:[[@LINE-37]]:46-85: note: initializing generic parameter `T` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_rewrite_requires_subst_in_nested_access_of_other_with_two_witnesses_wrong_type.carbon:[[@LINE+16]]:3 + // CHECK:STDERR: │ ...eric U: I & J, unused generic T: K where .K2 = .K1.I1 and .K3 = .K1.J1) {} + // CHECK:STDERR: · ┬─────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `T` + // CHECK:STDERR: · │ declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(U, T); + // CHECK:STDERR: · ┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `T` that implements + // CHECK:STDERR: · ┃ `K where .(K.K2) = () and .(K.K1) = U as I & J and .(K.K3) = {}` + // CHECK:STDERR: · ┃ into type implementing + // CHECK:STDERR: · ┃ `K where .(K.K2) = .(K.K1).(I.I1) and .(K.K3) = .(K.K1).(J.J1)` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(U, T); } @@ -987,8 +1305,19 @@ interface I { fn F(unused generic T: I where .I1 = () and .I2 = ()) {} fn G(generic T: I where .I1 = .I2) { - // CHECK:STDERR: fail_target_rewrites_dont_apply_to_source.carbon:[[@LINE+3]]:3-6: error: cannot convert type `T` that implements `I where .(I.I1) = .(I.I2)` into type implementing `I where .(I.I1) = () and .(I.I2) = ()` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_target_rewrites_dont_apply_to_source.carbon:[[@LINE-4]]:21-52: note: initializing generic parameter `T` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_target_rewrites_dont_apply_to_source.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: │ fn F(unused generic T: I where .I1 = () and .I2 = ()) {} + // CHECK:STDERR: · ───────┬──────────────────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(T); + // CHECK:STDERR: · ┳━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `T` that implements + // CHECK:STDERR: · ┃ `I where .(I.I1) = .(I.I2)` into type implementing + // CHECK:STDERR: · ┃ `I where .(I.I1) = () and .(I.I2) = ()` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(T); } @@ -1048,8 +1377,20 @@ constraint NI(V: type) { fn F(generic T: I where .X = NI({}), unused generic U: T.X) {} fn G(generic T: I where .X = NI({}), generic U: J where .Y = ()) { - // CHECK:STDERR: fail_nested_facet_type_used_as_root_facet_type_differs_in_interface.carbon:[[@LINE+3]]:3-9: error: cannot convert type `U` that implements `J where .(J.Y) = ()` into type implementing `NI({})` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_nested_facet_type_used_as_root_facet_type_differs_in_interface.carbon:[[@LINE-4]]:53-58: note: initializing generic parameter `U` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_nested_facet_type_used_as_root_facet_type_differs_in_interface.carbon:[[@LINE+15]]:3 + // CHECK:STDERR: │ fn F(generic T: I where .X = NI({}), unused generic U: T.X) {} + // CHECK:STDERR: · ┬───── + // CHECK:STDERR: · ╰──┤ initializing generic + // CHECK:STDERR: · │ parameter `U` declared + // CHECK:STDERR: · │ here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(T, U); + // CHECK:STDERR: · ┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `U` that implements `J where .(J.Y) = ()` into + // CHECK:STDERR: · ┃ type implementing `NI({})` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(T, U); } @@ -1072,8 +1413,20 @@ fn G(generic T: I where .X = NI({}), generic U: I where .Y = ()) { // The caller's `U` has type `I where .Y = ()` but the callee wants something // of type `I where .Y = {}`. // - // CHECK:STDERR: fail_nested_facet_type_used_as_root_facet_type_differs_in_rewrite_callee_access.carbon:[[@LINE+3]]:3-9: error: cannot convert type `U` that implements `I where .(I.Y) = ()` into type implementing `NI({})` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_nested_facet_type_used_as_root_facet_type_differs_in_rewrite_callee_access.carbon:[[@LINE-7]]:53-58: note: initializing generic parameter `U` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_nested_facet_type_used_as_root_facet_type_differs_in_rewrite_callee_access.carbon:[[@LINE+15]]:3 + // CHECK:STDERR: │ fn F(generic T: I where .X = NI({}), unused generic U: T.X) {} + // CHECK:STDERR: · ┬───── + // CHECK:STDERR: · ╰──┤ initializing generic + // CHECK:STDERR: · │ parameter `U` declared + // CHECK:STDERR: · │ here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(T, U); + // CHECK:STDERR: · ┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `U` that implements `I where .(I.Y) = ()` into + // CHECK:STDERR: · ┃ type implementing `NI({})` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(T, U); } @@ -1096,8 +1449,20 @@ fn G(generic T: I where .X = NI({}), generic U: T.X) { // The caller's `U` has type `I where .Y = {}` but the callee wants something // of type `I where .Y = ()`. // - // CHECK:STDERR: fail_nested_facet_type_used_as_root_facet_type_differs_in_rewrite_caller_access.carbon:[[@LINE+3]]:3-9: error: cannot convert type `U` that implements `NI({})` into type implementing `I where .(I.Y) = ()` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_nested_facet_type_used_as_root_facet_type_differs_in_rewrite_caller_access.carbon:[[@LINE-7]]:60-77: note: initializing generic parameter `U` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_nested_facet_type_used_as_root_facet_type_differs_in_rewrite_caller_access.carbon:[[@LINE+15]]:3 + // CHECK:STDERR: │ ...used generic T: I where .X = NI({}), unused generic U: I where .Y = ()) {} + // CHECK:STDERR: · ┬───────────────── + // CHECK:STDERR: · ╰──┤ initializing generic + // CHECK:STDERR: · │ parameter `U` + // CHECK:STDERR: · │ declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(T, U); + // CHECK:STDERR: · ┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `U` that implements `NI({})` into type + // CHECK:STDERR: · ┃ implementing `I where .(I.Y) = ()` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(T, U); } @@ -1240,8 +1605,18 @@ constraint N { } fn G(generic T: N) { - // CHECK:STDERR: fail_rewrite_not_provided_by_named_constraint_without_extend.carbon:[[@LINE+3]]:3-6: error: cannot convert type `T` that implements `N` into type implementing `Z where .(Z.Z1) = {}` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_rewrite_not_provided_by_named_constraint_without_extend.carbon:[[@LINE-12]]:14-32: note: initializing generic parameter `_` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_rewrite_not_provided_by_named_constraint_without_extend.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn F(generic _: Z where .Z1 = {}) {} + // CHECK:STDERR: · ─────────┬───────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `_` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(T); + // CHECK:STDERR: · ┳━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `T` that implements `N` into type implementing + // CHECK:STDERR: · ┃ `Z where .(Z.Z1) = {}` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(T); } diff --git a/toolchain/check/testdata/for/basic.carbon b/toolchain/check/testdata/for/basic.carbon index d1bec71834ea..a36e0ab4a151 100644 --- a/toolchain/check/testdata/for/basic.carbon +++ b/toolchain/check/testdata/for/basic.carbon @@ -16,7 +16,13 @@ library "[[@TEST_NAME]]"; fn Run() { // TODO: These diagnostics could be better. - // CHECK:STDERR: fail_not_range.carbon:[[@LINE+2]]:7-26: error: cannot access member of interface `Core.Iterate` in type `{}` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_not_range.carbon:[[@LINE+8]]:7 + // CHECK:STDERR: -> │ for (unused c: {} in {}) { + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.Iterate` in type `{}` + // CHECK:STDERR: · ┃ that does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: for (unused c: {} in {}) { } diff --git a/toolchain/check/testdata/for/pattern.carbon b/toolchain/check/testdata/for/pattern.carbon index ce98b64554ca..30a3899b4d25 100644 --- a/toolchain/check/testdata/for/pattern.carbon +++ b/toolchain/check/testdata/for/pattern.carbon @@ -106,8 +106,14 @@ import library "empty_range"; class X {} fn Run() { - // CHECK:STDERR: fail_bad_pattern.carbon:[[@LINE+3]]:7-43: error: cannot implicitly convert expression of type `C` to `X` [ConversionFailure] - // CHECK:STDERR: fail_bad_pattern.carbon:[[@LINE+2]]:7-43: note: type `C` does not implement interface `Core.ImplicitAs(X)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_bad_pattern.carbon:[[@LINE+9]]:7 + // CHECK:STDERR: -> │ for (unused x: X in EmptyRange(C).Make()) { + // CHECK:STDERR: · ━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `C` to `X` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `C` does not implement interface `Core.ImplicitAs(X)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: for (unused x: X in EmptyRange(C).Make()) { } diff --git a/toolchain/check/testdata/function/builtin/adapted_type.carbon b/toolchain/check/testdata/function/builtin/adapted_type.carbon index 44582159a299..38afb711d237 100644 --- a/toolchain/check/testdata/function/builtin/adapted_type.carbon +++ b/toolchain/check/testdata/function/builtin/adapted_type.carbon @@ -45,7 +45,12 @@ class MyIntLiteral { adapt {}; } -// CHECK:STDERR: fail_bad_adapt.carbon:[[@LINE+2]]:1-33: error: invalid signature for builtin function "int.make_type_signed" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_adapt.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn Int(N: MyIntLiteral) -> type = "int.make_type_signed"; +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.make_type_signed" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Int(N: MyIntLiteral) -> type = "int.make_type_signed"; @@ -287,10 +292,10 @@ fn Int(N: MyIntLiteral) -> type = "int.make_type_signed"; // CHECK:STDOUT: %N.param_patt: %pattern_type.129 = value_param_pattern [concrete = constants.%N.param_patt] // CHECK:STDOUT: %N.patt: %pattern_type.129 = wrapper_binding_pattern N, %N.param_patt [concrete = constants.%N.patt] // CHECK:STDOUT: %return.param_patt: %pattern_type.9a5 = out_param_pattern [concrete = constants.%return.param_patt] -// CHECK:STDOUT: %return.patt: %pattern_type.9a5 = return_slot_pattern %return.param_patt, %.loc10_28.1 [concrete = constants.%return.patt] +// CHECK:STDOUT: %return.patt: %pattern_type.9a5 = return_slot_pattern %return.param_patt, %.loc15_28.1 [concrete = constants.%return.patt] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc10_28.1: type = type_literal type [concrete = type] -// CHECK:STDOUT: %.loc10_28.2: Core.Form = init_form %.loc10_28.1 [concrete = constants.%.576] +// CHECK:STDOUT: %.loc15_28.1: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc15_28.2: Core.Form = init_form %.loc15_28.1 [concrete = constants.%.576] // CHECK:STDOUT: %N.param: %MyIntLiteral = value_param call_param0 // CHECK:STDOUT: %MyIntLiteral.ref: type = name_ref MyIntLiteral, file.%MyIntLiteral.decl [concrete = constants.%MyIntLiteral] // CHECK:STDOUT: %N: %MyIntLiteral = wrapper_binding N, %N.param diff --git a/toolchain/check/testdata/function/builtin/fail_redefined.carbon b/toolchain/check/testdata/function/builtin/fail_redefined.carbon index e4922862eaa7..78546e760010 100644 --- a/toolchain/check/testdata/function/builtin/fail_redefined.carbon +++ b/toolchain/check/testdata/function/builtin/fail_redefined.carbon @@ -13,20 +13,41 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/builtin/fail_redefined.carbon fn A(n: i32, m: i32) -> i32 = "int.sadd"; -// CHECK:STDERR: fail_redefined.carbon:[[@LINE+3]]:1-36: error: redefinition of `fn A` [RedeclRedef] -// CHECK:STDERR: fail_redefined.carbon:[[@LINE-2]]:1-29: note: previously defined here [RedeclPrevDef] +// CHECK:STDERR: ╭─┤ fail_redefined.carbon:[[@LINE+10]]:1 +// CHECK:STDERR: │ fn A(n: i32, m: i32) -> i32 = "int.sadd"; +// CHECK:STDERR: · ──────────────┬────────────── +// CHECK:STDERR: · ╰──┤ previously defined here [RedeclPrevDef] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn A(n: i32, unused m: i32) -> i32 { return n; } +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redefinition of `fn A` [RedeclRedef] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn A(n: i32, unused m: i32) -> i32 { return n; } fn B(n: i32, unused m: i32) -> i32 { return n; } -// CHECK:STDERR: fail_redefined.carbon:[[@LINE+3]]:1-29: error: redefinition of `fn B` [RedeclRedef] -// CHECK:STDERR: fail_redefined.carbon:[[@LINE-2]]:1-36: note: previously defined here [RedeclPrevDef] +// CHECK:STDERR: ╭─┤ fail_redefined.carbon:[[@LINE+10]]:1 +// CHECK:STDERR: │ fn B(n: i32, unused m: i32) -> i32 { return n; } +// CHECK:STDERR: · ──────────────────┬───────────────── +// CHECK:STDERR: · ╰──┤ previously defined here [RedeclPrevDef] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn B(n: i32, m: i32) -> i32 = "int.sadd"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redefinition of `fn B` [RedeclRedef] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn B(n: i32, m: i32) -> i32 = "int.sadd"; fn C(n: i32, m: i32) -> i32 = "int.sadd"; -// CHECK:STDERR: fail_redefined.carbon:[[@LINE+3]]:1-29: error: redefinition of `fn C` [RedeclRedef] -// CHECK:STDERR: fail_redefined.carbon:[[@LINE-2]]:1-29: note: previously defined here [RedeclPrevDef] +// CHECK:STDERR: ╭─┤ fail_redefined.carbon:[[@LINE+10]]:1 +// CHECK:STDERR: │ fn C(n: i32, m: i32) -> i32 = "int.sadd"; +// CHECK:STDERR: · ──────────────┬────────────── +// CHECK:STDERR: · ╰──┤ previously defined here [RedeclPrevDef] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn C(n: i32, m: i32) -> i32 = "int.sadd"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redefinition of `fn C` [RedeclRedef] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn C(n: i32, m: i32) -> i32 = "int.sadd"; @@ -49,7 +70,7 @@ fn C(n: i32, m: i32) -> i32 = "int.sadd"; // CHECK:STDOUT: %return.patt.6fa: %pattern_type.d94 = return_slot_pattern %return.param_patt.299, %i32 [concrete] // CHECK:STDOUT: %A.type.9f4a6d.1: type = fn_type @A.loc15 [concrete] // CHECK:STDOUT: %A.921eb9.1: %A.type.9f4a6d.1 = struct_value () [concrete] -// CHECK:STDOUT: %A.type.9f4a6d.2: type = fn_type @A.loc19 [concrete] +// CHECK:STDOUT: %A.type.9f4a6d.2: type = fn_type @A.loc26 [concrete] // CHECK:STDOUT: %A.921eb9.2: %A.type.9f4a6d.2 = struct_value () [concrete] // CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete] // CHECK:STDOUT: %Int.as.Copy.impl.Op.type.a1d: type = fn_type @Int.as.Copy.impl.Op, @Int.as.Copy.impl(%N) [symbolic] @@ -61,13 +82,13 @@ fn C(n: i32, m: i32) -> i32 = "int.sadd"; // CHECK:STDOUT: %Int.as.Copy.impl.Op.type.648: type = fn_type @Int.as.Copy.impl.Op, @Int.as.Copy.impl(%int_32) [concrete] // CHECK:STDOUT: %Int.as.Copy.impl.Op.cae: %Int.as.Copy.impl.Op.type.648 = struct_value () [concrete] // CHECK:STDOUT: %Int.as.Copy.impl.Op.specific_fn: = specific_function %Int.as.Copy.impl.Op.cae, @Int.as.Copy.impl.Op(%int_32) [concrete] -// CHECK:STDOUT: %B.type.573c71.1: type = fn_type @B.loc21 [concrete] +// CHECK:STDOUT: %B.type.573c71.1: type = fn_type @B.loc28 [concrete] // CHECK:STDOUT: %B.08ed21.1: %B.type.573c71.1 = struct_value () [concrete] -// CHECK:STDOUT: %B.type.573c71.2: type = fn_type @B.loc25 [concrete] +// CHECK:STDOUT: %B.type.573c71.2: type = fn_type @B.loc39 [concrete] // CHECK:STDOUT: %B.08ed21.2: %B.type.573c71.2 = struct_value () [concrete] -// CHECK:STDOUT: %C.type.322e3b.1: type = fn_type @C.loc27 [concrete] +// CHECK:STDOUT: %C.type.322e3b.1: type = fn_type @C.loc41 [concrete] // CHECK:STDOUT: %C.010386.1: %C.type.322e3b.1 = struct_value () [concrete] -// CHECK:STDOUT: %C.type.322e3b.2: type = fn_type @C.loc31 [concrete] +// CHECK:STDOUT: %C.type.322e3b.2: type = fn_type @C.loc52 [concrete] // CHECK:STDOUT: %C.010386.2: %C.type.322e3b.2 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -88,8 +109,8 @@ fn C(n: i32, m: i32) -> i32 = "int.sadd"; // CHECK:STDOUT: package: = namespace [concrete] { // CHECK:STDOUT: .Core = imports.%Core // CHECK:STDOUT: .A = %A.decl.loc15 -// CHECK:STDOUT: .B = %B.decl.loc21 -// CHECK:STDOUT: .C = %C.decl.loc27 +// CHECK:STDOUT: .B = %B.decl.loc28 +// CHECK:STDOUT: .C = %C.decl.loc41 // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %A.decl.loc15: %A.type.9f4a6d.1 = fn_decl @A.loc15 [concrete = constants.%A.921eb9.1] { @@ -111,97 +132,97 @@ fn C(n: i32, m: i32) -> i32 = "int.sadd"; // CHECK:STDOUT: %return.param: ref %i32 = out_param call_param2 // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %A.decl.loc19: %A.type.9f4a6d.2 = fn_decl @A.loc19 [concrete = constants.%A.921eb9.2] { +// CHECK:STDOUT: %A.decl.loc26: %A.type.9f4a6d.2 = fn_decl @A.loc26 [concrete = constants.%A.921eb9.2] { // CHECK:STDOUT: %n.param_patt: %pattern_type.d94 = value_param_pattern [concrete = constants.%n.param_patt] // CHECK:STDOUT: %n.patt: %pattern_type.d94 = wrapper_binding_pattern n, %n.param_patt [concrete = constants.%n.patt] // CHECK:STDOUT: %m.param_patt: %pattern_type.d94 = value_param_pattern [concrete = constants.%m.param_patt] // CHECK:STDOUT: %m.patt: %pattern_type.d94 = wrapper_binding_pattern m, %m.param_patt [concrete = constants.%m.patt] // CHECK:STDOUT: %return.param_patt: %pattern_type.d94 = out_param_pattern [concrete = constants.%return.param_patt.299] -// CHECK:STDOUT: %return.patt: %pattern_type.d94 = return_slot_pattern %return.param_patt, %i32.loc19_32 [concrete = constants.%return.patt.6fa] +// CHECK:STDOUT: %return.patt: %pattern_type.d94 = return_slot_pattern %return.param_patt, %i32.loc26_32 [concrete = constants.%return.patt.6fa] // CHECK:STDOUT: } { -// CHECK:STDOUT: %i32.loc19_32: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %.loc19: Core.Form = init_form %i32.loc19_32 [concrete = constants.%.0b3] +// CHECK:STDOUT: %i32.loc26_32: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc26: Core.Form = init_form %i32.loc26_32 [concrete = constants.%.0b3] // CHECK:STDOUT: %n.param: %i32 = value_param call_param0 -// CHECK:STDOUT: %i32.loc19_9: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc26_9: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %n: %i32 = wrapper_binding n, %n.param // CHECK:STDOUT: %m.param: %i32 = value_param call_param1 -// CHECK:STDOUT: %i32.loc19_24: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc26_24: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %m: %i32 = wrapper_binding m, %m.param // CHECK:STDOUT: %return.param: ref %i32 = out_param call_param2 // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %B.decl.loc21: %B.type.573c71.1 = fn_decl @B.loc21 [concrete = constants.%B.08ed21.1] { +// CHECK:STDOUT: %B.decl.loc28: %B.type.573c71.1 = fn_decl @B.loc28 [concrete = constants.%B.08ed21.1] { // CHECK:STDOUT: %n.param_patt: %pattern_type.d94 = value_param_pattern [concrete = constants.%n.param_patt] // CHECK:STDOUT: %n.patt: %pattern_type.d94 = wrapper_binding_pattern n, %n.param_patt [concrete = constants.%n.patt] // CHECK:STDOUT: %m.param_patt: %pattern_type.d94 = value_param_pattern [concrete = constants.%m.param_patt] // CHECK:STDOUT: %m.patt: %pattern_type.d94 = wrapper_binding_pattern m, %m.param_patt [concrete = constants.%m.patt] // CHECK:STDOUT: %return.param_patt: %pattern_type.d94 = out_param_pattern [concrete = constants.%return.param_patt.299] -// CHECK:STDOUT: %return.patt: %pattern_type.d94 = return_slot_pattern %return.param_patt, %i32.loc21_32 [concrete = constants.%return.patt.6fa] +// CHECK:STDOUT: %return.patt: %pattern_type.d94 = return_slot_pattern %return.param_patt, %i32.loc28_32 [concrete = constants.%return.patt.6fa] // CHECK:STDOUT: } { -// CHECK:STDOUT: %i32.loc21_32: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %.loc21: Core.Form = init_form %i32.loc21_32 [concrete = constants.%.0b3] +// CHECK:STDOUT: %i32.loc28_32: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc28: Core.Form = init_form %i32.loc28_32 [concrete = constants.%.0b3] // CHECK:STDOUT: %n.param: %i32 = value_param call_param0 -// CHECK:STDOUT: %i32.loc21_9: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc28_9: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %n: %i32 = wrapper_binding n, %n.param // CHECK:STDOUT: %m.param: %i32 = value_param call_param1 -// CHECK:STDOUT: %i32.loc21_24: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc28_24: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %m: %i32 = wrapper_binding m, %m.param // CHECK:STDOUT: %return.param: ref %i32 = out_param call_param2 // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %B.decl.loc25: %B.type.573c71.2 = fn_decl @B.loc25 [concrete = constants.%B.08ed21.2] { +// CHECK:STDOUT: %B.decl.loc39: %B.type.573c71.2 = fn_decl @B.loc39 [concrete = constants.%B.08ed21.2] { // CHECK:STDOUT: %n.param_patt: %pattern_type.d94 = value_param_pattern [concrete = constants.%n.param_patt] // CHECK:STDOUT: %n.patt: %pattern_type.d94 = wrapper_binding_pattern n, %n.param_patt [concrete = constants.%n.patt] // CHECK:STDOUT: %m.param_patt: %pattern_type.d94 = value_param_pattern [concrete = constants.%m.param_patt] // CHECK:STDOUT: %m.patt: %pattern_type.d94 = wrapper_binding_pattern m, %m.param_patt [concrete = constants.%m.patt] // CHECK:STDOUT: %return.param_patt: %pattern_type.d94 = out_param_pattern [concrete = constants.%return.param_patt.299] -// CHECK:STDOUT: %return.patt: %pattern_type.d94 = return_slot_pattern %return.param_patt, %i32.loc25_25 [concrete = constants.%return.patt.6fa] +// CHECK:STDOUT: %return.patt: %pattern_type.d94 = return_slot_pattern %return.param_patt, %i32.loc39_25 [concrete = constants.%return.patt.6fa] // CHECK:STDOUT: } { -// CHECK:STDOUT: %i32.loc25_25: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %.loc25: Core.Form = init_form %i32.loc25_25 [concrete = constants.%.0b3] +// CHECK:STDOUT: %i32.loc39_25: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc39: Core.Form = init_form %i32.loc39_25 [concrete = constants.%.0b3] // CHECK:STDOUT: %n.param: %i32 = value_param call_param0 -// CHECK:STDOUT: %i32.loc25_9: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc39_9: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %n: %i32 = wrapper_binding n, %n.param // CHECK:STDOUT: %m.param: %i32 = value_param call_param1 -// CHECK:STDOUT: %i32.loc25_17: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc39_17: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %m: %i32 = wrapper_binding m, %m.param // CHECK:STDOUT: %return.param: ref %i32 = out_param call_param2 // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %C.decl.loc27: %C.type.322e3b.1 = fn_decl @C.loc27 [concrete = constants.%C.010386.1] { +// CHECK:STDOUT: %C.decl.loc41: %C.type.322e3b.1 = fn_decl @C.loc41 [concrete = constants.%C.010386.1] { // CHECK:STDOUT: %n.param_patt: %pattern_type.d94 = value_param_pattern [concrete = constants.%n.param_patt] // CHECK:STDOUT: %n.patt: %pattern_type.d94 = wrapper_binding_pattern n, %n.param_patt [concrete = constants.%n.patt] // CHECK:STDOUT: %m.param_patt: %pattern_type.d94 = value_param_pattern [concrete = constants.%m.param_patt] // CHECK:STDOUT: %m.patt: %pattern_type.d94 = wrapper_binding_pattern m, %m.param_patt [concrete = constants.%m.patt] // CHECK:STDOUT: %return.param_patt: %pattern_type.d94 = out_param_pattern [concrete = constants.%return.param_patt.299] -// CHECK:STDOUT: %return.patt: %pattern_type.d94 = return_slot_pattern %return.param_patt, %i32.loc27_25 [concrete = constants.%return.patt.6fa] +// CHECK:STDOUT: %return.patt: %pattern_type.d94 = return_slot_pattern %return.param_patt, %i32.loc41_25 [concrete = constants.%return.patt.6fa] // CHECK:STDOUT: } { -// CHECK:STDOUT: %i32.loc27_25: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %.loc27: Core.Form = init_form %i32.loc27_25 [concrete = constants.%.0b3] +// CHECK:STDOUT: %i32.loc41_25: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc41: Core.Form = init_form %i32.loc41_25 [concrete = constants.%.0b3] // CHECK:STDOUT: %n.param: %i32 = value_param call_param0 -// CHECK:STDOUT: %i32.loc27_9: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc41_9: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %n: %i32 = wrapper_binding n, %n.param // CHECK:STDOUT: %m.param: %i32 = value_param call_param1 -// CHECK:STDOUT: %i32.loc27_17: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc41_17: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %m: %i32 = wrapper_binding m, %m.param // CHECK:STDOUT: %return.param: ref %i32 = out_param call_param2 // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %C.decl.loc31: %C.type.322e3b.2 = fn_decl @C.loc31 [concrete = constants.%C.010386.2] { +// CHECK:STDOUT: %C.decl.loc52: %C.type.322e3b.2 = fn_decl @C.loc52 [concrete = constants.%C.010386.2] { // CHECK:STDOUT: %n.param_patt: %pattern_type.d94 = value_param_pattern [concrete = constants.%n.param_patt] // CHECK:STDOUT: %n.patt: %pattern_type.d94 = wrapper_binding_pattern n, %n.param_patt [concrete = constants.%n.patt] // CHECK:STDOUT: %m.param_patt: %pattern_type.d94 = value_param_pattern [concrete = constants.%m.param_patt] // CHECK:STDOUT: %m.patt: %pattern_type.d94 = wrapper_binding_pattern m, %m.param_patt [concrete = constants.%m.patt] // CHECK:STDOUT: %return.param_patt: %pattern_type.d94 = out_param_pattern [concrete = constants.%return.param_patt.299] -// CHECK:STDOUT: %return.patt: %pattern_type.d94 = return_slot_pattern %return.param_patt, %i32.loc31_25 [concrete = constants.%return.patt.6fa] +// CHECK:STDOUT: %return.patt: %pattern_type.d94 = return_slot_pattern %return.param_patt, %i32.loc52_25 [concrete = constants.%return.patt.6fa] // CHECK:STDOUT: } { -// CHECK:STDOUT: %i32.loc31_25: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %.loc31: Core.Form = init_form %i32.loc31_25 [concrete = constants.%.0b3] +// CHECK:STDOUT: %i32.loc52_25: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc52: Core.Form = init_form %i32.loc52_25 [concrete = constants.%.0b3] // CHECK:STDOUT: %n.param: %i32 = value_param call_param0 -// CHECK:STDOUT: %i32.loc31_9: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc52_9: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %n: %i32 = wrapper_binding n, %n.param // CHECK:STDOUT: %m.param: %i32 = value_param call_param1 -// CHECK:STDOUT: %i32.loc31_17: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc52_17: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %m: %i32 = wrapper_binding m, %m.param // CHECK:STDOUT: %return.param: ref %i32 = out_param call_param2 // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param @@ -210,31 +231,31 @@ fn C(n: i32, m: i32) -> i32 = "int.sadd"; // CHECK:STDOUT: // CHECK:STDOUT: fn @A.loc15(%n.param: %i32, %m.param: %i32) -> out %return.param: %i32 = "int.sadd"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @A.loc19(%n.param: %i32, %m.param: %i32) -> out %return.param: %i32 { +// CHECK:STDOUT: fn @A.loc26(%n.param: %i32, %m.param: %i32) -> out %return.param: %i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %n.ref: %i32 = name_ref n, %n // CHECK:STDOUT: %impl.elem0: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae] -// CHECK:STDOUT: %bound_method.loc19_45.1: = bound_method %n.ref, %impl.elem0 +// CHECK:STDOUT: %bound_method.loc26_45.1: = bound_method %n.ref, %impl.elem0 // CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc19_45.2: = bound_method %n.ref, %specific_fn -// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc19_45.2(%n.ref) +// CHECK:STDOUT: %bound_method.loc26_45.2: = bound_method %n.ref, %specific_fn +// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc26_45.2(%n.ref) // CHECK:STDOUT: return %Int.as.Copy.impl.Op.call // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @B.loc21(%n.param: %i32, %m.param: %i32) -> out %return.param: %i32 { +// CHECK:STDOUT: fn @B.loc28(%n.param: %i32, %m.param: %i32) -> out %return.param: %i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %n.ref: %i32 = name_ref n, %n // CHECK:STDOUT: %impl.elem0: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae] -// CHECK:STDOUT: %bound_method.loc21_45.1: = bound_method %n.ref, %impl.elem0 +// CHECK:STDOUT: %bound_method.loc28_45.1: = bound_method %n.ref, %impl.elem0 // CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc21_45.2: = bound_method %n.ref, %specific_fn -// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc21_45.2(%n.ref) +// CHECK:STDOUT: %bound_method.loc28_45.2: = bound_method %n.ref, %specific_fn +// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc28_45.2(%n.ref) // CHECK:STDOUT: return %Int.as.Copy.impl.Op.call // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @B.loc25(%n.param: %i32, %m.param: %i32) -> out %return.param: %i32 = "int.sadd"; +// CHECK:STDOUT: fn @B.loc39(%n.param: %i32, %m.param: %i32) -> out %return.param: %i32 = "int.sadd"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @C.loc27(%n.param: %i32, %m.param: %i32) -> out %return.param: %i32 = "int.sadd"; +// CHECK:STDOUT: fn @C.loc41(%n.param: %i32, %m.param: %i32) -> out %return.param: %i32 = "int.sadd"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @C.loc31(%n.param: %i32, %m.param: %i32) -> out %return.param: %i32 = "int.sadd"; +// CHECK:STDOUT: fn @C.loc52(%n.param: %i32, %m.param: %i32) -> out %return.param: %i32 = "int.sadd"; // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/builtin/fail_unknown.carbon b/toolchain/check/testdata/function/builtin/fail_unknown.carbon index 929d37e1adc8..876fdeebca22 100644 --- a/toolchain/check/testdata/function/builtin/fail_unknown.carbon +++ b/toolchain/check/testdata/function/builtin/fail_unknown.carbon @@ -12,7 +12,13 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/builtin/fail_unknown.carbon -// CHECK:STDERR: fail_unknown.carbon:[[@LINE+2]]:23-44: error: unknown builtin function name "unknown.builtin.name" [UnknownBuiltinFunctionName] +// CHECK:STDERR: ╭─┤ fail_unknown.carbon:[[@LINE+8]]:23 +// CHECK:STDERR: -> │ fn UnknownBuiltin() = "unknown.builtin.name"; +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: unknown builtin function name +// CHECK:STDERR: · ┃ "unknown.builtin.name" +// CHECK:STDERR: · ┃ [UnknownBuiltinFunctionName] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn UnknownBuiltin() = "unknown.builtin.name"; diff --git a/toolchain/check/testdata/function/builtin/positional.carbon b/toolchain/check/testdata/function/builtin/positional.carbon index 3b50a34e4e22..69716b11f154 100644 --- a/toolchain/check/testdata/function/builtin/positional.carbon +++ b/toolchain/check/testdata/function/builtin/positional.carbon @@ -14,15 +14,35 @@ // --- fail_positional.carbon -// CHECK:STDERR: fail_positional.carbon:[[@LINE+4]]:1-15: error: semantics TODO: `function with positional parameters` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_positional.carbon:[[@LINE+14]]:1 +// CHECK:STDERR: -> │ fn Add -> i32 = "int.sadd"; +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `function with positional parameters` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_positional.carbon:[[@LINE+2]]:1-15: error: invalid signature for builtin function "int.sadd" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_positional.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn Add -> i32 = "int.sadd"; +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.sadd" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Add -> i32 = "int.sadd"; -// CHECK:STDERR: fail_positional.carbon:[[@LINE+4]]:1-8: error: semantics TODO: `function with positional parameters` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_positional.carbon:[[@LINE+14]]:1 +// CHECK:STDERR: -> │ fn Mul = "int.smul"; +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `function with positional parameters` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_positional.carbon:[[@LINE+2]]:1-8: error: invalid signature for builtin function "int.smul" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_positional.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn Mul = "int.smul"; +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.smul" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Mul = "int.smul"; @@ -65,7 +85,7 @@ fn Mul = "int.smul"; // CHECK:STDOUT: %return.patt: %pattern_type.d94 = return_slot_pattern %return.param_patt, %i32 [concrete = constants.%return.patt] // CHECK:STDOUT: } { // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %.loc6: Core.Form = init_form %i32 [concrete = constants.%.0b3] +// CHECK:STDOUT: %.loc16: Core.Form = init_form %i32 [concrete = constants.%.0b3] // CHECK:STDOUT: %return.param: ref %i32 = out_param call_param0 // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/call/default_values.carbon b/toolchain/check/testdata/function/call/default_values.carbon index 08971f5ac1ad..02c43a87a126 100644 --- a/toolchain/check/testdata/function/call/default_values.carbon +++ b/toolchain/check/testdata/function/call/default_values.carbon @@ -18,11 +18,27 @@ fn F(unused x: C = {}, unused y: C = {}, unused z: C = {}) {} fn H(unused x: C = {}, (unused y: C = {}, unused z: C = {}) = ({}, {})) {} fn G() { - // CHECK:STDERR: fail_caller_too_many_arguments.carbon:[[@LINE+6]]:3-19: error: 4 arguments passed to function expecting 3 arguments [CallArgCountMismatch] - // CHECK:STDERR: fail_caller_too_many_arguments.carbon:[[@LINE-5]]:1-60: note: calling function declared here [InCallToEntity] + // CHECK:STDERR: ╭─┤ fail_caller_too_many_arguments.carbon:[[@LINE+22]]:3 + // CHECK:STDERR: │ fn F(unused x: C = {}, unused y: C = {}, unused z: C = {}) {} + // CHECK:STDERR: · ──────────────────────────────┬───────────────────────────── + // CHECK:STDERR: · ╰──┤ calling function declared here + // CHECK:STDERR: · │ [InCallToEntity] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F({}, {}, {}, {}); + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: 4 arguments passed to function expecting 3 arguments + // CHECK:STDERR: · ┃ [CallArgCountMismatch] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_caller_too_many_arguments.carbon:[[@LINE-6]]:24-59: error: tuple pattern expects 2 elements, but tuple literal has 3 [TuplePatternSizeDoesntMatchLiteral] - // CHECK:STDERR: fail_caller_too_many_arguments.carbon:[[@LINE-7]]:24-70: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_caller_too_many_arguments.carbon:[[@LINE-15]]:24 + // CHECK:STDERR: -> │ fn H(unused x: C = {}, (unused y: C = {}, unused z: C = {}) = ({}, {})) {} + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━─────────── + // CHECK:STDERR: · ┗━━┫ error: tuple pattern expects 2 elements, but tuple + // CHECK:STDERR: · │ ┃ literal has 3 + // CHECK:STDERR: · │ ┃ [TuplePatternSizeDoesntMatchLiteral] + // CHECK:STDERR: · ╰────┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F({}, {}, {}, {}); H({}, ({}, {}, {})); @@ -35,8 +51,16 @@ class C {} fn F(unused x: C, unused y: C = {}) {} fn G() { - // CHECK:STDERR: fail_caller_too_few_arguments.carbon:[[@LINE+3]]:3-5: error: 0 arguments passed to function expecting 2 arguments [CallArgCountMismatch] - // CHECK:STDERR: fail_caller_too_few_arguments.carbon:[[@LINE-4]]:1-37: note: calling function declared here [InCallToEntity] + // CHECK:STDERR: ╭─┤ fail_caller_too_few_arguments.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ fn F(unused x: C, unused y: C = {}) {} + // CHECK:STDERR: · ──────────────────┬────────────────── + // CHECK:STDERR: · ╰──┤ calling function declared here [InCallToEntity] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(); + // CHECK:STDERR: · ━┳━ + // CHECK:STDERR: · ┗━━┫ error: 0 arguments passed to function expecting 2 arguments + // CHECK:STDERR: · ┃ [CallArgCountMismatch] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(); } diff --git a/toolchain/check/testdata/function/call/eval_musteval.carbon b/toolchain/check/testdata/function/call/eval_musteval.carbon index 1baa3b13d62b..3e27a88d7afa 100644 --- a/toolchain/check/testdata/function/call/eval_musteval.carbon +++ b/toolchain/check/testdata/function/call/eval_musteval.carbon @@ -29,8 +29,17 @@ library "[[@TEST_NAME]]"; musteval fn MustEval(unused n: i32) {} fn RuntimeArg(n: i32) { - // CHECK:STDERR: fail_no_eval_musteval.carbon:[[@LINE+3]]:3-13: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] - // CHECK:STDERR: fail_no_eval_musteval.carbon:[[@LINE-4]]:1-37: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] + // CHECK:STDERR: ╭─┤ fail_no_eval_musteval.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ musteval fn MustEval(unused n: i32) {} + // CHECK:STDERR: · ──────────────────┬────────────────── + // CHECK:STDERR: · ╰──┤ compile-time-only function declared here + // CHECK:STDERR: · │ [CompTimeOnlyFunctionHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ MustEval(n); + // CHECK:STDERR: · ━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: non-constant call to compile-time-only function + // CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: ╰──── // CHECK:STDERR: MustEval(n); } @@ -57,8 +66,17 @@ musteval fn MustEval(unused n: i32) {} // TODO: This should be accepted. musteval fn CallMustEval(n: i32) { - // CHECK:STDERR: fail_todo_musteval_calls_musteval.carbon:[[@LINE+3]]:3-13: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] - // CHECK:STDERR: fail_todo_musteval_calls_musteval.carbon:[[@LINE-5]]:1-37: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] + // CHECK:STDERR: ╭─┤ fail_todo_musteval_calls_musteval.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ musteval fn MustEval(unused n: i32) {} + // CHECK:STDERR: · ──────────────────┬────────────────── + // CHECK:STDERR: · ╰──┤ compile-time-only function declared here + // CHECK:STDERR: · │ [CompTimeOnlyFunctionHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ MustEval(n); + // CHECK:STDERR: · ━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: non-constant call to compile-time-only function + // CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: ╰──── // CHECK:STDERR: MustEval(n); } diff --git a/toolchain/check/testdata/function/call/fail_not_callable.carbon b/toolchain/check/testdata/function/call/fail_not_callable.carbon index f0a93aa5ad92..6b88670f05dd 100644 --- a/toolchain/check/testdata/function/call/fail_not_callable.carbon +++ b/toolchain/check/testdata/function/call/fail_not_callable.carbon @@ -11,7 +11,12 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/call/fail_not_callable.carbon fn Run() { - // CHECK:STDERR: fail_not_callable.carbon:[[@LINE+2]]:23-31: error: value of type `str` is not callable [CallToNonCallable] + // CHECK:STDERR: ╭─┤ fail_not_callable.carbon:[[@LINE+7]]:23 + // CHECK:STDERR: -> │ var unused x: i32 = "hello"(); + // CHECK:STDERR: · ━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: value of type `str` is not callable + // CHECK:STDERR: · ┃ [CallToNonCallable] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused x: i32 = "hello"(); } diff --git a/toolchain/check/testdata/function/call/fail_param_count.carbon b/toolchain/check/testdata/function/call/fail_param_count.carbon index 2836e360cbfe..d58b441601ca 100644 --- a/toolchain/check/testdata/function/call/fail_param_count.carbon +++ b/toolchain/check/testdata/function/call/fail_param_count.carbon @@ -17,30 +17,78 @@ fn Run1(unused a: i32) {} fn Run2(unused a: i32, unused b: i32) {} fn Main() { - // CHECK:STDERR: fail_param_count.carbon:[[@LINE+3]]:3-9: error: 1 argument passed to function expecting 0 arguments [CallArgCountMismatch] - // CHECK:STDERR: fail_param_count.carbon:[[@LINE-6]]:1-11: note: calling function declared here [InCallToEntity] + // CHECK:STDERR: ╭─┤ fail_param_count.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ fn Run0() {} + // CHECK:STDERR: · ─────┬───── + // CHECK:STDERR: · ╰──┤ calling function declared here [InCallToEntity] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Run0(1); + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: 1 argument passed to function expecting 0 arguments + // CHECK:STDERR: · ┃ [CallArgCountMismatch] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Run0(1); - // CHECK:STDERR: fail_param_count.carbon:[[@LINE+3]]:3-12: error: 2 arguments passed to function expecting 0 arguments [CallArgCountMismatch] - // CHECK:STDERR: fail_param_count.carbon:[[@LINE-10]]:1-11: note: calling function declared here [InCallToEntity] + // CHECK:STDERR: ╭─┤ fail_param_count.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ fn Run0() {} + // CHECK:STDERR: · ─────┬───── + // CHECK:STDERR: · ╰──┤ calling function declared here [InCallToEntity] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Run0(0, 1); + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: 2 arguments passed to function expecting 0 arguments + // CHECK:STDERR: · ┃ [CallArgCountMismatch] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Run0(0, 1); - // CHECK:STDERR: fail_param_count.carbon:[[@LINE+3]]:3-8: error: 0 arguments passed to function expecting 1 argument [CallArgCountMismatch] - // CHECK:STDERR: fail_param_count.carbon:[[@LINE-14]]:1-24: note: calling function declared here [InCallToEntity] + // CHECK:STDERR: ╭─┤ fail_param_count.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ fn Run1(unused a: i32) {} + // CHECK:STDERR: · ────────────┬─────────── + // CHECK:STDERR: · ╰──┤ calling function declared here [InCallToEntity] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Run1(); + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: 0 arguments passed to function expecting 1 argument + // CHECK:STDERR: · ┃ [CallArgCountMismatch] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Run1(); - // CHECK:STDERR: fail_param_count.carbon:[[@LINE+3]]:3-12: error: 2 arguments passed to function expecting 1 argument [CallArgCountMismatch] - // CHECK:STDERR: fail_param_count.carbon:[[@LINE-18]]:1-24: note: calling function declared here [InCallToEntity] + // CHECK:STDERR: ╭─┤ fail_param_count.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ fn Run1(unused a: i32) {} + // CHECK:STDERR: · ────────────┬─────────── + // CHECK:STDERR: · ╰──┤ calling function declared here [InCallToEntity] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Run1(0, 1); + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: 2 arguments passed to function expecting 1 argument + // CHECK:STDERR: · ┃ [CallArgCountMismatch] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Run1(0, 1); - // CHECK:STDERR: fail_param_count.carbon:[[@LINE+3]]:3-8: error: 0 arguments passed to function expecting 2 arguments [CallArgCountMismatch] - // CHECK:STDERR: fail_param_count.carbon:[[@LINE-22]]:1-39: note: calling function declared here [InCallToEntity] + // CHECK:STDERR: ╭─┤ fail_param_count.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ fn Run2(unused a: i32, unused b: i32) {} + // CHECK:STDERR: · ───────────────────┬─────────────────── + // CHECK:STDERR: · ╰──┤ calling function declared here [InCallToEntity] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Run2(); + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: 0 arguments passed to function expecting 2 arguments + // CHECK:STDERR: · ┃ [CallArgCountMismatch] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Run2(); - // CHECK:STDERR: fail_param_count.carbon:[[@LINE+3]]:3-9: error: 1 argument passed to function expecting 2 arguments [CallArgCountMismatch] - // CHECK:STDERR: fail_param_count.carbon:[[@LINE-26]]:1-39: note: calling function declared here [InCallToEntity] + // CHECK:STDERR: ╭─┤ fail_param_count.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ fn Run2(unused a: i32, unused b: i32) {} + // CHECK:STDERR: · ───────────────────┬─────────────────── + // CHECK:STDERR: · ╰──┤ calling function declared here [InCallToEntity] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Run2(0); + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: 1 argument passed to function expecting 2 arguments + // CHECK:STDERR: · ┃ [CallArgCountMismatch] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Run2(0); } @@ -131,18 +179,18 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Run0.ref.loc23: %Run0.type = name_ref Run0, file.%Run0.decl [concrete = constants.%Run0] -// CHECK:STDOUT: %int_1.loc23: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] -// CHECK:STDOUT: %Run0.ref.loc27: %Run0.type = name_ref Run0, file.%Run0.decl [concrete = constants.%Run0] -// CHECK:STDOUT: %int_0.loc27: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] -// CHECK:STDOUT: %int_1.loc27: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] -// CHECK:STDOUT: %Run1.ref.loc32: %Run1.type = name_ref Run1, file.%Run1.decl [concrete = constants.%Run1] -// CHECK:STDOUT: %Run1.ref.loc36: %Run1.type = name_ref Run1, file.%Run1.decl [concrete = constants.%Run1] -// CHECK:STDOUT: %int_0.loc36: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] -// CHECK:STDOUT: %int_1.loc36: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] -// CHECK:STDOUT: %Run2.ref.loc41: %Run2.type = name_ref Run2, file.%Run2.decl [concrete = constants.%Run2] -// CHECK:STDOUT: %Run2.ref.loc45: %Run2.type = name_ref Run2, file.%Run2.decl [concrete = constants.%Run2] -// CHECK:STDOUT: %int_0.loc45: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] +// CHECK:STDOUT: %Run0.ref.loc31: %Run0.type = name_ref Run0, file.%Run0.decl [concrete = constants.%Run0] +// CHECK:STDOUT: %int_1.loc31: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] +// CHECK:STDOUT: %Run0.ref.loc43: %Run0.type = name_ref Run0, file.%Run0.decl [concrete = constants.%Run0] +// CHECK:STDOUT: %int_0.loc43: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] +// CHECK:STDOUT: %int_1.loc43: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] +// CHECK:STDOUT: %Run1.ref.loc56: %Run1.type = name_ref Run1, file.%Run1.decl [concrete = constants.%Run1] +// CHECK:STDOUT: %Run1.ref.loc68: %Run1.type = name_ref Run1, file.%Run1.decl [concrete = constants.%Run1] +// CHECK:STDOUT: %int_0.loc68: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] +// CHECK:STDOUT: %int_1.loc68: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] +// CHECK:STDOUT: %Run2.ref.loc81: %Run2.type = name_ref Run2, file.%Run2.decl [concrete = constants.%Run2] +// CHECK:STDOUT: %Run2.ref.loc93: %Run2.type = name_ref Run2, file.%Run2.decl [concrete = constants.%Run2] +// CHECK:STDOUT: %int_0.loc93: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/call/fail_param_type.carbon b/toolchain/check/testdata/function/call/fail_param_type.carbon index 37820f5f6745..2a9829690959 100644 --- a/toolchain/check/testdata/function/call/fail_param_type.carbon +++ b/toolchain/check/testdata/function/call/fail_param_type.carbon @@ -15,9 +15,20 @@ fn G(unused a: i32) {} fn F() { - // CHECK:STDERR: fail_param_type.carbon:[[@LINE+4]]:5-7: error: cannot implicitly convert expression of type `Core.FloatLiteral` to `i32` [ConversionFailure] - // CHECK:STDERR: fail_param_type.carbon:[[@LINE+3]]:5-7: note: type `Core.FloatLiteral` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: fail_param_type.carbon:[[@LINE-5]]:13-18: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_param_type.carbon:[[@LINE+15]]:5 + // CHECK:STDERR: │ fn G(unused a: i32) {} + // CHECK:STDERR: · ───┬── + // CHECK:STDERR: · ╰──┤ initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ G(1.0); + // CHECK:STDERR: · ┳━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `Core.FloatLiteral` + // CHECK:STDERR: · │ ┃ to `i32` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Core.FloatLiteral` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(i32)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: G(1.0); } @@ -81,7 +92,7 @@ fn F() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %G.ref: %G.type = name_ref G, file.%G.decl [concrete = constants.%G] // CHECK:STDOUT: %float: Core.FloatLiteral = float_literal_value 10e-1 [concrete = constants.%float] -// CHECK:STDOUT: %.loc22: %i32 = converted %float, [concrete = ] +// CHECK:STDOUT: %.loc33: %i32 = converted %float, [concrete = ] // CHECK:STDOUT: %G.call: init %empty_tuple.type = call %G.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/call/fail_return_type_mismatch.carbon b/toolchain/check/testdata/function/call/fail_return_type_mismatch.carbon index b556c24755ae..b11d26eef549 100644 --- a/toolchain/check/testdata/function/call/fail_return_type_mismatch.carbon +++ b/toolchain/check/testdata/function/call/fail_return_type_mismatch.carbon @@ -15,8 +15,14 @@ fn Foo() -> f64 { return 1.0; } fn Run() { - // CHECK:STDERR: fail_return_type_mismatch.carbon:[[@LINE+3]]:3-19: error: cannot implicitly convert expression of type `f64` to `i32` [ConversionFailure] - // CHECK:STDERR: fail_return_type_mismatch.carbon:[[@LINE+2]]:3-19: note: type `f64` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_return_type_mismatch.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ var unused x: i32 = Foo(); + // CHECK:STDERR: · ━━━━━━━┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `f64` to `i32` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `f64` does not implement interface `Core.ImplicitAs(i32)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused x: i32 = Foo(); } @@ -69,7 +75,7 @@ fn Run() { // CHECK:STDOUT: %T.09f: %SubobjectDestroy.type = symbolic_binding T, 0 [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.type.dea: type = fn_type @T.as_type.as.DestroyImpl.impl.Op, @T.as_type.as.DestroyImpl.impl(%T.09f) [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.6e5: %T.as_type.as.DestroyImpl.impl.Op.type.dea = struct_value () [symbolic] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.687: type = fn_type @SubobjectDestroy.WithSelf.Op.loc21 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.687: type = fn_type @SubobjectDestroy.WithSelf.Op.loc27 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f: %SubobjectDestroy.WithSelf.Op.type.687 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f), @SubobjectDestroy [concrete] // CHECK:STDOUT: %SubobjectDestroy.facet.49a: %SubobjectDestroy.type = facet_value %i32, (%custom_witness.b80) [concrete] @@ -133,7 +139,7 @@ fn Run() { // CHECK:STDOUT: %x.var: ref %i32 = var_storage %x.var_patt // CHECK:STDOUT: %Foo.ref: %Foo.type = name_ref Foo, file.%Foo.decl [concrete = constants.%Foo] // CHECK:STDOUT: %Foo.call: init %f64.761 = call %Foo.ref() -// CHECK:STDOUT: %.loc21_3.1: %i32 = converted %Foo.call, [concrete = ] +// CHECK:STDOUT: %.loc27_3.1: %i32 = converted %Foo.call, [concrete = ] // CHECK:STDOUT: assign %x.var, // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %x: ref %i32 = wrapper_binding x, %x.var @@ -141,14 +147,14 @@ fn Run() { // CHECK:STDOUT: %x.patt: %pattern_type.d94 = ref_binding_pattern x [concrete = constants.%x.patt] // CHECK:STDOUT: %x.var_patt: %pattern_type.d94 = var_pattern %x.patt [concrete = constants.%x.var_patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.facet.loc21_3.1: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc21_3.2: %Destroy.type = converted constants.%i32, %Destroy.facet.loc21_3.1 [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %Destroy.facet.loc21_3.2: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc21_3.3: %Destroy.type = converted constants.%i32, %Destroy.facet.loc21_3.2 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %Destroy.facet.loc27_3.1: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc27_3.2: %Destroy.type = converted constants.%i32, %Destroy.facet.loc27_3.1 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %Destroy.facet.loc27_3.2: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc27_3.3: %Destroy.type = converted constants.%i32, %Destroy.facet.loc27_3.2 [concrete = constants.%Destroy.facet] // CHECK:STDOUT: %SelfDestruct.specific_fn: = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet) [concrete = constants.%SelfDestruct.specific_fn] // CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%x.var) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc21(%self.param: ref %i32) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc27(%self.param: ref %i32) = "no_op"; // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/call/fail_runtime_implicit_param.carbon b/toolchain/check/testdata/function/call/fail_runtime_implicit_param.carbon index e36fbc2063a3..f445f660aa6d 100644 --- a/toolchain/check/testdata/function/call/fail_runtime_implicit_param.carbon +++ b/toolchain/check/testdata/function/call/fail_runtime_implicit_param.carbon @@ -12,7 +12,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/call/fail_runtime_implicit_param.carbon -// CHECK:STDERR: fail_runtime_implicit_param.carbon:[[@LINE+2]]:6-18: error: implicit parameters of functions must be constant [ImplictParamMustBeConstant] +// CHECK:STDERR: ╭─┤ fail_runtime_implicit_param.carbon:[[@LINE+7]]:6 +// CHECK:STDERR: -> │ fn F[runtime s: ()](); +// CHECK:STDERR: · ━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: implicit parameters of functions must be constant +// CHECK:STDERR: · ┃ [ImplictParamMustBeConstant] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F[runtime s: ()](); diff --git a/toolchain/check/testdata/function/call/form.carbon b/toolchain/check/testdata/function/call/form.carbon index 7821820abc6d..2144c5b89475 100644 --- a/toolchain/check/testdata/function/call/form.carbon +++ b/toolchain/check/testdata/function/call/form.carbon @@ -70,20 +70,43 @@ library "[[@TEST_NAME]]"; import Core library "core"; fn F() -> Core.Form; -// CHECK:STDERR: fail_param_form_not_constant.carbon:[[@LINE+2]]:10-12: error: cannot evaluate form expression [FormExprEvaluationFailure] +// CHECK:STDERR: ╭─┤ fail_param_form_not_constant.carbon:[[@LINE+7]]:10 +// CHECK:STDERR: -> │ fn G(x:? F()); +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┗━━┫ error: cannot evaluate form expression +// CHECK:STDERR: · ┃ [FormExprEvaluationFailure] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn G(x:? F()); // --- fail_form_param_not_form.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_form_param_not_form.carbon:[[@LINE+3]]:10-12: error: cannot implicitly convert expression of type `type` to `Core.Form` [ConversionFailure] -// CHECK:STDERR: fail_form_param_not_form.carbon:[[@LINE+2]]:10-12: note: type `type` does not implement interface `Core.ImplicitAs(Core.Form)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_form_param_not_form.carbon:[[@LINE+11]]:10 +// CHECK:STDERR: -> │ fn F(x:? i32); +// CHECK:STDERR: · ┳━━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `type` to +// CHECK:STDERR: · │ ┃ `Core.Form` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╰────┤ type `type` does not implement interface +// CHECK:STDERR: · │ `Core.ImplicitAs(Core.Form)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(x:? i32); -// CHECK:STDERR: fail_form_param_not_form.carbon:[[@LINE+4]]:6-8: error: `ref` is only allowed on a runtime binding [ExpectedRuntimeBindingPatternAfterRef] +// CHECK:STDERR: ╭─┤ fail_form_param_not_form.carbon:[[@LINE+14]]:6 +// CHECK:STDERR: -> │ fn G(ref x:? i32); +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┗━━┫ error: `ref` is only allowed on a runtime binding +// CHECK:STDERR: · ┃ [ExpectedRuntimeBindingPatternAfterRef] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_form_param_not_form.carbon:[[@LINE+2]]:11-12: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_form_param_not_form.carbon:[[@LINE+7]]:11 +// CHECK:STDERR: -> │ fn G(ref x:? i32); +// CHECK:STDERR: · ━┳ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `handle invalid parse trees in `check`` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn G(ref x:? i32); @@ -94,8 +117,16 @@ fn F(x:? form(ref i32)); fn G() { var y: i32 = 0; - // CHECK:STDERR: fail_missing_ref_tag.carbon:[[@LINE+3]]:5: error: argument to `ref` parameter not marked with `ref` [RefParamNoRefTag] - // CHECK:STDERR: fail_missing_ref_tag.carbon:[[@LINE-5]]:6-22: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_missing_ref_tag.carbon:[[@LINE+11]]:5 + // CHECK:STDERR: │ fn F(x:? form(ref i32)); + // CHECK:STDERR: · ────────┬──────── + // CHECK:STDERR: · ╰──┤ initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(y); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: argument to `ref` parameter not marked with `ref` + // CHECK:STDERR: · ┃ [RefParamNoRefTag] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(y); } @@ -121,9 +152,21 @@ fn F(generic Fm: Core.Form, unused x:? Fm) {} fn G() { var x: i32; - // CHECK:STDERR: fail_todo_composite_generic_form.carbon:[[@LINE+4]]:3-47: error: cannot implicitly convert expression of type `(Core.Form, Core.Form)` to `Core.Form` [ConversionFailure] - // CHECK:STDERR: fail_todo_composite_generic_form.carbon:[[@LINE+3]]:3-47: note: type `(Core.Form, Core.Form)` does not implement interface `Core.ImplicitAs(Core.Form)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: fail_todo_composite_generic_form.carbon:[[@LINE-6]]:14-26: note: initializing generic parameter `Fm` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_todo_composite_generic_form.carbon:[[@LINE+16]]:3 + // CHECK:STDERR: │ fn F(generic Fm: Core.Form, unused x:? Fm) {} + // CHECK:STDERR: · ──────┬────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `Fm` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F((form(var i32), form(ref i32)), (x, ref x)); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type + // CHECK:STDERR: · │ ┃ `(Core.Form, Core.Form)` to `Core.Form` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `(Core.Form, Core.Form)` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(Core.Form)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F((form(var i32), form(ref i32)), (x, ref x)); } @@ -137,8 +180,17 @@ fn F[Fm: Core.Form](v:? Fm); fn G() { var v: i32 = 0; - // CHECK:STDERR: fail_todo_deduce_generic_form.carbon:[[@LINE+3]]:3-10: error: cannot deduce value for generic parameter `Fm` [DeductionIncomplete] - // CHECK:STDERR: fail_todo_deduce_generic_form.carbon:[[@LINE-5]]:1-28: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_todo_deduce_generic_form.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn F[Fm: Core.Form](v:? Fm); + // CHECK:STDERR: · ──────────────┬───────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(ref v); + // CHECK:STDERR: · ━━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot deduce value for generic parameter `Fm` + // CHECK:STDERR: · ┃ [DeductionIncomplete] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(ref v); } @@ -152,9 +204,19 @@ fn F(generic Fm: Core.Form, unused x:? Fm) {} fn G() { var x: i32; - // CHECK:STDERR: fail_form_generic_arg_not_form.carbon:[[@LINE+4]]:3-11: error: cannot implicitly convert expression of type `type` to `Core.Form` [ConversionFailure] - // CHECK:STDERR: fail_form_generic_arg_not_form.carbon:[[@LINE+3]]:3-11: note: type `type` does not implement interface `Core.ImplicitAs(Core.Form)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: fail_form_generic_arg_not_form.carbon:[[@LINE-6]]:14-26: note: initializing generic parameter `Fm` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_form_generic_arg_not_form.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: │ fn F(generic Fm: Core.Form, unused x:? Fm) {} + // CHECK:STDERR: · ──────┬────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `Fm` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(i32, x); + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `type` to `Core.Form` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `type` does not implement interface `Core.ImplicitAs(Core.Form)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(i32, x); } @@ -168,9 +230,20 @@ fn F(generic Fm: Core.Form, unused x:? Fm) {} fn G() { var x: i32; - // CHECK:STDERR: fail_form_generic_missing_ref_tag.carbon:[[@LINE+4]]:20: error: argument to `ref` parameter not marked with `ref` [RefParamNoRefTag] - // CHECK:STDERR: fail_form_generic_missing_ref_tag.carbon: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fail_form_generic_missing_ref_tag.carbon:[[@LINE-6]]:36-41: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_form_generic_missing_ref_tag.carbon:[[@LINE+15]]:20 + // CHECK:STDERR: │ fn F(generic Fm: Core.Form, unused x:? Fm) {} + // CHECK:STDERR: · ───┬── + // CHECK:STDERR: · ╰──┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(form(ref i32), x); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: argument to `ref` parameter not marked with `ref` + // CHECK:STDERR: · ┃ [RefParamNoRefTag] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ fail_form_generic_missing_ref_tag.carbon + // CHECK:STDERR: · ╰──┤ initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(form(ref i32), x); } @@ -179,7 +252,12 @@ fn G() { library "[[@TEST_NAME]]"; fn F() { - // CHECK:STDERR: fail_todo_local_init_form_binding.carbon:[[@LINE+2]]:7-23: error: semantics TODO: `support local form bindings` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_local_init_form_binding.carbon:[[@LINE+7]]:7 + // CHECK:STDERR: -> │ let x:? form(var i32) = 0; + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `support local form bindings` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let x:? form(var i32) = 0; } @@ -192,7 +270,12 @@ import Core library "core"; // TODO: this code should fail for a different reason, but right now we don't // have a way to write correct code that reaches the TODO we're exercising here. fn F(generic Form: Core.Form) { - // CHECK:STDERR: fail_todo_local_symbolic_form_binding.carbon:[[@LINE+2]]:7-14: error: semantics TODO: `support local form bindings` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_local_symbolic_form_binding.carbon:[[@LINE+7]]:7 + // CHECK:STDERR: -> │ let y:? Form = 0; + // CHECK:STDERR: · ━━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `support local form bindings` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let y:? Form = 0; } @@ -293,11 +376,24 @@ fn G[T: I](x: T) { // --- fail_return_form_not_form.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_return_form_not_form.carbon:[[@LINE+3]]:12-14: error: cannot implicitly convert expression of type `type` to `Core.Form` [ConversionFailure] -// CHECK:STDERR: fail_return_form_not_form.carbon:[[@LINE+2]]:12-14: note: type `type` does not implement interface `Core.ImplicitAs(Core.Form)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_return_form_not_form.carbon:[[@LINE+11]]:12 +// CHECK:STDERR: -> │ fn F() ->? i32; +// CHECK:STDERR: · ┳━━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `type` to +// CHECK:STDERR: · │ ┃ `Core.Form` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╰────┤ type `type` does not implement interface +// CHECK:STDERR: · │ `Core.ImplicitAs(Core.Form)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F() ->? i32; -// CHECK:STDERR: fail_return_form_not_form.carbon:[[@LINE+2]]:12-18: error: `ref` tag is not an argument to a `ref` parameter [RefTagNoRefParam] +// CHECK:STDERR: ╭─┤ fail_return_form_not_form.carbon:[[@LINE+7]]:12 +// CHECK:STDERR: -> │ fn F() ->? ref i32; +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: `ref` tag is not an argument to a `ref` parameter +// CHECK:STDERR: · ┃ [RefTagNoRefParam] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F() ->? ref i32; diff --git a/toolchain/check/testdata/function/call/ref.carbon b/toolchain/check/testdata/function/call/ref.carbon index 6ec822139a49..6711af9c32ac 100644 --- a/toolchain/check/testdata/function/call/ref.carbon +++ b/toolchain/check/testdata/function/call/ref.carbon @@ -49,8 +49,16 @@ fn F(ref x: i32); fn G() { let y: i32 = 0; - // CHECK:STDERR: fail_ref_not_durable_ref.carbon:[[@LINE+3]]:5-9: error: value expression passed to reference parameter [ValueForRefParam] - // CHECK:STDERR: fail_ref_not_durable_ref.carbon:[[@LINE-5]]:6-15: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_ref_not_durable_ref.carbon:[[@LINE+11]]:5 + // CHECK:STDERR: │ fn F(ref x: i32); + // CHECK:STDERR: · ─────┬──── + // CHECK:STDERR: · ╰──┤ initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(ref y); + // CHECK:STDERR: · ━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: value expression passed to reference parameter + // CHECK:STDERR: · ┃ [ValueForRefParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(ref y); } @@ -63,8 +71,16 @@ fn F(ref x: i32); fn G() { var y: i32 = 0; - // CHECK:STDERR: fail_missing_ref.carbon:[[@LINE+3]]:5: error: argument to `ref` parameter not marked with `ref` [RefParamNoRefTag] - // CHECK:STDERR: fail_missing_ref.carbon:[[@LINE-5]]:6-15: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_missing_ref.carbon:[[@LINE+11]]:5 + // CHECK:STDERR: │ fn F(ref x: i32); + // CHECK:STDERR: · ─────┬──── + // CHECK:STDERR: · ╰──┤ initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(y); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: argument to `ref` parameter not marked with `ref` + // CHECK:STDERR: · ┃ [RefParamNoRefTag] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(y); } @@ -78,11 +94,25 @@ fn F(x: i32); fn G() { var y: i32 = 0; - // CHECK:STDERR: fail_unnecessary_ref.carbon:[[@LINE+2]]:27-31: error: `ref` tag is not an argument to a `ref` parameter [RefTagNoRefParam] + // CHECK:STDERR: ╭─┤ fail_unnecessary_ref.carbon:[[@LINE+8]]:27 + // CHECK:STDERR: -> │ var unused z: (i32,) = (ref y,); + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: `ref` tag is not an argument to a `ref` + // CHECK:STDERR: · ┃ parameter + // CHECK:STDERR: · ┃ [RefTagNoRefParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused z: (i32,) = (ref y,); - // CHECK:STDERR: fail_unnecessary_ref.carbon:[[@LINE+3]]:5-9: error: `ref` tag is not an argument to a `ref` parameter [RefTagNoRefParam] - // CHECK:STDERR: fail_unnecessary_ref.carbon:[[@LINE-9]]:6-11: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_unnecessary_ref.carbon:[[@LINE+11]]:5 + // CHECK:STDERR: │ fn F(x: i32); + // CHECK:STDERR: · ───┬── + // CHECK:STDERR: · ╰──┤ initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(ref y); + // CHECK:STDERR: · ━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: `ref` tag is not an argument to a `ref` parameter + // CHECK:STDERR: · ┃ [RefTagNoRefParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(ref y); } diff --git a/toolchain/check/testdata/function/capture/uncaptured_locals.carbon b/toolchain/check/testdata/function/capture/uncaptured_locals.carbon index 335345afa4dd..a46cf2f0e3bc 100644 --- a/toolchain/check/testdata/function/capture/uncaptured_locals.carbon +++ b/toolchain/check/testdata/function/capture/uncaptured_locals.carbon @@ -24,7 +24,11 @@ fn Test() { } // Intentionally include an error here so we skip dominance checking, which CHECK-fails for the above example. -// CHECK:STDERR: fail_todo_reference_uncaptured.carbon:[[@LINE+2]]:14-18: error: name `error` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_todo_reference_uncaptured.carbon:[[@LINE+6]]:14 +// CHECK:STDERR: -> │ fn Error() { error; } +// CHECK:STDERR: · ━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: name `error` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Error() { error; } @@ -42,6 +46,10 @@ fn Test() { } // Intentionally include an error here so we skip dominance checking, which CHECK-fails for the above example. -// CHECK:STDERR: fail_todo_reference_uncaptured_lambda.carbon:[[@LINE+2]]:14-18: error: name `error` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_todo_reference_uncaptured_lambda.carbon:[[@LINE+6]]:14 +// CHECK:STDERR: -> │ fn Error() { error; } +// CHECK:STDERR: · ━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: name `error` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Error() { error; } diff --git a/toolchain/check/testdata/function/declaration/default_values.carbon b/toolchain/check/testdata/function/declaration/default_values.carbon index efde49985e49..8d4620bf16c8 100644 --- a/toolchain/check/testdata/function/declaration/default_values.carbon +++ b/toolchain/check/testdata/function/declaration/default_values.carbon @@ -15,7 +15,12 @@ library "[[@TEST_NAME]]"; class C {} -// CHECK:STDERR: fail_value_not_constant.carbon:[[@LINE+2]]:19: error: default value is not a constant [PatternDefaultValueNotConstant] +// CHECK:STDERR: ╭─┤ fail_value_not_constant.carbon:[[@LINE+7]]:19 +// CHECK:STDERR: -> │ fn H(x: C, y: C = x); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: default value is not a constant +// CHECK:STDERR: · ┃ [PatternDefaultValueNotConstant] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn H(x: C, y: C = x); @@ -25,8 +30,14 @@ library "[[@TEST_NAME]]"; class C {} class D {} -// CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+3]]:13-19: error: cannot implicitly convert expression of type `D` to `C` [ConversionFailure] -// CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+2]]:13-19: note: type `D` does not implement interface `Core.ImplicitAs(C)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_type_mismatch.carbon:[[@LINE+9]]:13 +// CHECK:STDERR: -> │ fn K(x: C = {} as D); +// CHECK:STDERR: · ━┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `D` to `C` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╰────┤ type `D` does not implement interface `Core.ImplicitAs(C)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn K(x: C = {} as D); @@ -35,7 +46,13 @@ library "[[@TEST_NAME]]"; class C {} -// CHECK:STDERR: fail_pattern_defaults_not_in_parameter_list.carbon:[[@LINE+2]]:19-20: error: default values are only supported in parameter lists [PatternDefaultValueNotInParameterList] +// CHECK:STDERR: ╭─┤ fail_pattern_defaults_not_in_parameter_list.carbon:[[@LINE+8]]:19 +// CHECK:STDERR: -> │ let (y: C, x: C = {}) = ({}, {}); +// CHECK:STDERR: · ┳━ +// CHECK:STDERR: · ┗━━┫ error: default values are only supported in parameter +// CHECK:STDERR: · ┃ lists +// CHECK:STDERR: · ┃ [PatternDefaultValueNotInParameterList] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let (y: C, x: C = {}) = ({}, {}); @@ -44,12 +61,39 @@ library "[[@TEST_NAME]]"; class C {} -// CHECK:STDERR: fail_required_default_values_missing.carbon:[[@LINE+7]]:35-38: error: this pattern is missing a required default value [RequiredPatternDefaultValueMissing] -// CHECK:STDERR: fail_required_default_values_missing.carbon:[[@LINE+6]]:24-27: note: all patterns to the right of this first pattern with a default value must also specify a default value [RequiredPatternDefaultValueFirstDefault] +// CHECK:STDERR: ╭─┤ fail_required_default_values_missing.carbon:[[@LINE+34]]:35 +// CHECK:STDERR: -> │ fn Z(v: C, x: C = {}, (y: C = {}, z: C), w: C = {}, k: C); +// CHECK:STDERR: · ──┬─ ┳━━━ +// CHECK:STDERR: · │ ┗━━┫ error: this pattern is missing a required +// CHECK:STDERR: · │ ┃ default value +// CHECK:STDERR: · │ ┃ [RequiredPatternDefaultValueMissing] +// CHECK:STDERR: · ╰─────────────┤ all patterns to the right of this first +// CHECK:STDERR: · │ pattern with a default value must also +// CHECK:STDERR: · │ specify a default value +// CHECK:STDERR: · │ [RequiredPatternDefaultValueFirstDefault] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_required_default_values_missing.carbon:[[@LINE+4]]:23-39: error: this pattern is missing a required default value [RequiredPatternDefaultValueMissing] -// CHECK:STDERR: fail_required_default_values_missing.carbon:[[@LINE+3]]:53-56: note: this pattern is also missing a required default value [RequiredPatternDefaultValueMissingAdditional] -// CHECK:STDERR: fail_required_default_values_missing.carbon:[[@LINE+2]]:12-15: note: all patterns to the right of this first pattern with a default value must also specify a default value [RequiredPatternDefaultValueFirstDefault] +// CHECK:STDERR: ╭─┤ fail_required_default_values_missing.carbon:[[@LINE+22]]:23 +// CHECK:STDERR: -> │ fn Z(v: C, x: C = {}, (y: C = {}, z: C), w: C = {}, k: C); +// CHECK:STDERR: · ──┬─ ━━━━━━━━┳━━━━━━━━ ┬─── +// CHECK:STDERR: · │ ┗━━━━━━━━━━━━━━━━━━━━━━━━┫ error: this pattern is +// CHECK:STDERR: · │ │ ┃ missing a +// CHECK:STDERR: · │ │ ┃ required default +// CHECK:STDERR: · │ │ ┃ value +// CHECK:STDERR: · │ │ ┃ [RequiredPatternDefaultValueMissing] +// CHECK:STDERR: · ╰───────────────────────────────────────────┤ all patterns to the +// CHECK:STDERR: · │ │ right of this first +// CHECK:STDERR: · │ │ pattern with a +// CHECK:STDERR: · │ │ default value must +// CHECK:STDERR: · │ │ also specify a +// CHECK:STDERR: · │ │ default value +// CHECK:STDERR: · │ │ [RequiredPatternDefaultValueFirstDefault] +// CHECK:STDERR: · ╰──────┤ this pattern is +// CHECK:STDERR: · │ also missing a +// CHECK:STDERR: · │ required default +// CHECK:STDERR: · │ value +// CHECK:STDERR: · │ [RequiredPatternDefaultValueMissingAdditional] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Z(v: C, x: C = {}, (y: C = {}, z: C), w: C = {}, k: C); @@ -58,11 +102,29 @@ library "[[@TEST_NAME]]"; class C {} -// CHECK:STDERR: fail_nesting_required_default_values_missing.carbon:[[@LINE+6]]:36-47: error: this pattern is missing a required default value [RequiredPatternDefaultValueMissing] -// CHECK:STDERR: fail_nesting_required_default_values_missing.carbon:[[@LINE+5]]:25-28: note: all patterns to the right of this first pattern with a default value must also specify a default value [RequiredPatternDefaultValueFirstDefault] +// CHECK:STDERR: ╭─┤ fail_nesting_required_default_values_missing.carbon:[[@LINE+24]]:36 +// CHECK:STDERR: -> │ fn F(a: C, (b: C = {}, (c: C = {}, (d: C, e: C)))); +// CHECK:STDERR: · ──┬─ ┳━━━━━━━━━━━ +// CHECK:STDERR: · │ ┗━━┫ error: this pattern is missing a +// CHECK:STDERR: · │ ┃ required default value +// CHECK:STDERR: · │ ┃ [RequiredPatternDefaultValueMissing] +// CHECK:STDERR: · ╰─────────────┤ all patterns to the right of this +// CHECK:STDERR: · │ first pattern with a default value +// CHECK:STDERR: · │ must also specify a default value +// CHECK:STDERR: · │ [RequiredPatternDefaultValueFirstDefault] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_nesting_required_default_values_missing.carbon:[[@LINE+3]]:24-48: error: this pattern is missing a required default value [RequiredPatternDefaultValueMissing] -// CHECK:STDERR: fail_nesting_required_default_values_missing.carbon:[[@LINE+2]]:13-16: note: all patterns to the right of this first pattern with a default value must also specify a default value [RequiredPatternDefaultValueFirstDefault] +// CHECK:STDERR: ╭─┤ fail_nesting_required_default_values_missing.carbon:[[@LINE+12]]:24 +// CHECK:STDERR: -> │ fn F(a: C, (b: C = {}, (c: C = {}, (d: C, e: C)))); +// CHECK:STDERR: · ──┬─ ┳━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · │ ┗━━┫ error: this pattern is missing a required default +// CHECK:STDERR: · │ ┃ value +// CHECK:STDERR: · │ ┃ [RequiredPatternDefaultValueMissing] +// CHECK:STDERR: · ╰─────────────┤ all patterns to the right of this first pattern +// CHECK:STDERR: · │ with a default value must also specify a default +// CHECK:STDERR: · │ value +// CHECK:STDERR: · │ [RequiredPatternDefaultValueFirstDefault] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(a: C, (b: C = {}, (c: C = {}, (d: C, e: C)))); @@ -75,8 +137,14 @@ impl C as Core.As(D) { fn Convert(unused self: C) -> D { return {} as D; } } -// CHECK:STDERR: fail_explicit_conversion_not_supported.carbon:[[@LINE+3]]:13-19: error: cannot implicitly convert expression of type `C` to `D` [ConversionFailure] -// CHECK:STDERR: fail_explicit_conversion_not_supported.carbon:[[@LINE+2]]:13-19: note: type `C` does not implement interface `Core.ImplicitAs(D)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_explicit_conversion_not_supported.carbon:[[@LINE+9]]:13 +// CHECK:STDERR: -> │ fn F(a: D = {} as C); +// CHECK:STDERR: · ━┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `C` to `D` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╰────┤ type `C` does not implement interface `Core.ImplicitAs(D)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(a: D = {} as C); diff --git a/toolchain/check/testdata/function/declaration/eval_musteval.carbon b/toolchain/check/testdata/function/declaration/eval_musteval.carbon index 4f0df384e807..6dc62317e707 100644 --- a/toolchain/check/testdata/function/declaration/eval_musteval.carbon +++ b/toolchain/check/testdata/function/declaration/eval_musteval.carbon @@ -38,8 +38,13 @@ private musteval fn MustEval() -> i32 { return 0; } library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_conflict.carbon:[[@LINE+3]]:6-13: error: `musteval` not allowed on declaration with `eval` [ModifierNotAllowedWith] -// CHECK:STDERR: fail_conflict.carbon:[[@LINE+2]]:1-4: note: `eval` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╭─┤ fail_conflict.carbon:[[@LINE+8]]:6 +// CHECK:STDERR: -> │ eval musteval fn Mixed(); +// CHECK:STDERR: · ──┬─ ━━━━┳━━━ +// CHECK:STDERR: · │ ┗━━┫ error: `musteval` not allowed on declaration with `eval` +// CHECK:STDERR: · │ ┃ [ModifierNotAllowedWith] +// CHECK:STDERR: · ╰───────────┤ `eval` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: eval musteval fn Mixed(); @@ -47,19 +52,34 @@ eval musteval fn Mixed(); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_order.carbon:[[@LINE+3]]:6-11: error: `export` must appear before `eval` [ModifierMustAppearBefore] -// CHECK:STDERR: fail_order.carbon:[[@LINE+2]]:1-4: note: `eval` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╭─┤ fail_order.carbon:[[@LINE+8]]:6 +// CHECK:STDERR: -> │ eval export fn ExportEval(); +// CHECK:STDERR: · ──┬─ ━━━┳━━ +// CHECK:STDERR: · │ ┗━━┫ error: `export` must appear before `eval` +// CHECK:STDERR: · │ ┃ [ModifierMustAppearBefore] +// CHECK:STDERR: · ╰──────────┤ `eval` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: eval export fn ExportEval(); -// CHECK:STDERR: fail_order.carbon:[[@LINE+3]]:6-12: error: `private` must appear before `eval` [ModifierMustAppearBefore] -// CHECK:STDERR: fail_order.carbon:[[@LINE+2]]:1-4: note: `eval` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╭─┤ fail_order.carbon:[[@LINE+8]]:6 +// CHECK:STDERR: -> │ eval private fn PrivateEval(); +// CHECK:STDERR: · ──┬─ ━━━┳━━━ +// CHECK:STDERR: · │ ┗━━┫ error: `private` must appear before `eval` +// CHECK:STDERR: · │ ┃ [ModifierMustAppearBefore] +// CHECK:STDERR: · ╰──────────┤ `eval` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: eval private fn PrivateEval(); class C { - // CHECK:STDERR: fail_order.carbon:[[@LINE+3]]:8-14: error: `virtual` must appear before `eval` [ModifierMustAppearBefore] - // CHECK:STDERR: fail_order.carbon:[[@LINE+2]]:3-6: note: `eval` previously appeared here [ModifierPrevious] + // CHECK:STDERR: ╭─┤ fail_order.carbon:[[@LINE+8]]:8 + // CHECK:STDERR: -> │ eval virtual fn VirtualEval(); + // CHECK:STDERR: · ──┬─ ━━━┳━━━ + // CHECK:STDERR: · │ ┗━━┫ error: `virtual` must appear before `eval` + // CHECK:STDERR: · │ ┃ [ModifierMustAppearBefore] + // CHECK:STDERR: · ╰──────────┤ `eval` previously appeared here [ModifierPrevious] + // CHECK:STDERR: ╰──── // CHECK:STDERR: eval virtual fn VirtualEval(); } @@ -68,11 +88,21 @@ class C { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_not_fn.carbon:[[@LINE+2]]:1-4: error: `eval` not allowed on `var` declaration [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╭─┤ fail_not_fn.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ eval var x: i32; +// CHECK:STDERR: · ━━┳━ +// CHECK:STDERR: · ┗━━┫ error: `eval` not allowed on `var` declaration +// CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╰──── // CHECK:STDERR: eval var x: i32; -// CHECK:STDERR: fail_not_fn.carbon:[[@LINE+2]]:1-4: error: `eval` not allowed on `class` declaration [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╭─┤ fail_not_fn.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ eval class C {}; +// CHECK:STDERR: · ━━┳━ +// CHECK:STDERR: · ┗━━┫ error: `eval` not allowed on `class` declaration +// CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╰──── // CHECK:STDERR: eval class C {}; @@ -97,32 +127,87 @@ eval fn EvalThenMustEval(); musteval fn MustEvalThenNone(); musteval fn MustEvalThenEval(); -// CHECK:STDERR: fail_differ_in_redecl.carbon:[[@LINE+3]]:1-24: error: function redeclaration differs because new function is `eval` [FunctionRedeclEvaluationModeDiffers] -// CHECK:STDERR: fail_differ_in_redecl.carbon:[[@LINE-8]]:1-18: note: previously not declared as `eval` [FunctionRedeclEvaluationModePrevious] +// CHECK:STDERR: ╭─┤ fail_differ_in_redecl.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: │ fn NoneThenEval(); +// CHECK:STDERR: · ─────────┬──────── +// CHECK:STDERR: · ╰──┤ previously not declared as `eval` +// CHECK:STDERR: · │ [FunctionRedeclEvaluationModePrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ eval fn NoneThenEval() {} +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: function redeclaration differs because new function is `eval` +// CHECK:STDERR: · ┃ [FunctionRedeclEvaluationModeDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: eval fn NoneThenEval() {} -// CHECK:STDERR: fail_differ_in_redecl.carbon:[[@LINE+3]]:1-32: error: function redeclaration differs because new function is `musteval` [FunctionRedeclEvaluationModeDiffers] -// CHECK:STDERR: fail_differ_in_redecl.carbon:[[@LINE-12]]:1-22: note: previously not declared as `musteval` [FunctionRedeclEvaluationModePrevious] +// CHECK:STDERR: ╭─┤ fail_differ_in_redecl.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: │ fn NoneThenMustEval(); +// CHECK:STDERR: · ───────────┬────────── +// CHECK:STDERR: · ╰──┤ previously not declared as `musteval` +// CHECK:STDERR: · │ [FunctionRedeclEvaluationModePrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ musteval fn NoneThenMustEval() {} +// CHECK:STDERR: · ━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: function redeclaration differs because new function is `musteval` +// CHECK:STDERR: · ┃ [FunctionRedeclEvaluationModeDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: musteval fn NoneThenMustEval() {} -// CHECK:STDERR: fail_differ_in_redecl.carbon:[[@LINE+3]]:1-19: error: function redeclaration differs because new function is not `eval` [FunctionRedeclEvaluationModeDiffers] -// CHECK:STDERR: fail_differ_in_redecl.carbon:[[@LINE-16]]:1-23: note: previously declared as `eval` [FunctionRedeclEvaluationModePrevious] +// CHECK:STDERR: ╭─┤ fail_differ_in_redecl.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: │ eval fn EvalThenNone(); +// CHECK:STDERR: · ───────────┬─────────── +// CHECK:STDERR: · ╰──┤ previously declared as `eval` +// CHECK:STDERR: · │ [FunctionRedeclEvaluationModePrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn EvalThenNone() {} +// CHECK:STDERR: · ━━━┳━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: function redeclaration differs because new function is not `eval` +// CHECK:STDERR: · ┃ [FunctionRedeclEvaluationModeDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn EvalThenNone() {} -// CHECK:STDERR: fail_differ_in_redecl.carbon:[[@LINE+3]]:1-32: error: function redeclaration differs because new function is `musteval` [FunctionRedeclEvaluationModeDiffers] -// CHECK:STDERR: fail_differ_in_redecl.carbon:[[@LINE-20]]:1-27: note: previously declared as `eval` [FunctionRedeclEvaluationModePrevious] +// CHECK:STDERR: ╭─┤ fail_differ_in_redecl.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: │ eval fn EvalThenMustEval(); +// CHECK:STDERR: · ─────────────┬───────────── +// CHECK:STDERR: · ╰──┤ previously declared as `eval` +// CHECK:STDERR: · │ [FunctionRedeclEvaluationModePrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ musteval fn EvalThenMustEval() {} +// CHECK:STDERR: · ━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: function redeclaration differs because new function is `musteval` +// CHECK:STDERR: · ┃ [FunctionRedeclEvaluationModeDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: musteval fn EvalThenMustEval() {} -// CHECK:STDERR: fail_differ_in_redecl.carbon:[[@LINE+3]]:1-23: error: function redeclaration differs because new function is not `musteval` [FunctionRedeclEvaluationModeDiffers] -// CHECK:STDERR: fail_differ_in_redecl.carbon:[[@LINE-24]]:1-31: note: previously declared as `musteval` [FunctionRedeclEvaluationModePrevious] +// CHECK:STDERR: ╭─┤ fail_differ_in_redecl.carbon:[[@LINE+13]]:1 +// CHECK:STDERR: │ musteval fn MustEvalThenNone(); +// CHECK:STDERR: · ───────────────┬─────────────── +// CHECK:STDERR: · ╰──┤ previously declared as `musteval` +// CHECK:STDERR: · │ [FunctionRedeclEvaluationModePrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn MustEvalThenNone() {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: function redeclaration differs because new function is not +// CHECK:STDERR: · ┃ `musteval` +// CHECK:STDERR: · ┃ [FunctionRedeclEvaluationModeDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn MustEvalThenNone() {} -// CHECK:STDERR: fail_differ_in_redecl.carbon:[[@LINE+3]]:1-28: error: function redeclaration differs because new function is `eval` [FunctionRedeclEvaluationModeDiffers] -// CHECK:STDERR: fail_differ_in_redecl.carbon:[[@LINE-28]]:1-31: note: previously declared as `musteval` [FunctionRedeclEvaluationModePrevious] +// CHECK:STDERR: ╭─┤ fail_differ_in_redecl.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: │ musteval fn MustEvalThenEval(); +// CHECK:STDERR: · ───────────────┬─────────────── +// CHECK:STDERR: · ╰──┤ previously declared as `musteval` +// CHECK:STDERR: · │ [FunctionRedeclEvaluationModePrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ eval fn MustEvalThenEval() {} +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: function redeclaration differs because new function is `eval` +// CHECK:STDERR: · ┃ [FunctionRedeclEvaluationModeDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: eval fn MustEvalThenEval() {} diff --git a/toolchain/check/testdata/function/declaration/extern.carbon b/toolchain/check/testdata/function/declaration/extern.carbon index 977153b9224b..8516c19e6da3 100644 --- a/toolchain/check/testdata/function/declaration/extern.carbon +++ b/toolchain/check/testdata/function/declaration/extern.carbon @@ -29,8 +29,15 @@ var x: () = F(); library "[[@TEST_NAME]]"; extern fn F(); -// CHECK:STDERR: fail_redecl.carbon:[[@LINE+3]]:1-14: error: redeclaration of `fn F` is redundant [RedeclRedundant] -// CHECK:STDERR: fail_redecl.carbon:[[@LINE-2]]:1-14: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_redecl.carbon:[[@LINE+10]]:1 +// CHECK:STDERR: │ extern fn F(); +// CHECK:STDERR: · ───────┬────── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ extern fn F(); +// CHECK:STDERR: · ━━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of `fn F` is redundant [RedeclRedundant] +// CHECK:STDERR: ╰──── // CHECK:STDERR: extern fn F(); @@ -39,8 +46,15 @@ extern fn F(); library "[[@TEST_NAME]]"; extern fn F(); -// CHECK:STDERR: fail_redecl_extern.carbon:[[@LINE+3]]:1-7: error: redeclaration of `fn F` is redundant [RedeclRedundant] -// CHECK:STDERR: fail_redecl_extern.carbon:[[@LINE-2]]:1-14: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_redecl_extern.carbon:[[@LINE+10]]:1 +// CHECK:STDERR: │ extern fn F(); +// CHECK:STDERR: · ───────┬────── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn F(); +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of `fn F` is redundant [RedeclRedundant] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(); @@ -49,10 +63,20 @@ fn F(); library "[[@TEST_NAME]]"; class C { - // CHECK:STDERR: fail_member_extern.carbon:[[@LINE+2]]:3-8: error: `extern` not allowed; requires file or namespace scope [ModifierExternNotAllowed] + // CHECK:STDERR: ╭─┤ fail_member_extern.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ extern fn F(); + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: `extern` not allowed; requires file or namespace scope + // CHECK:STDERR: · ┃ [ModifierExternNotAllowed] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extern fn F(); - // CHECK:STDERR: fail_member_extern.carbon:[[@LINE+2]]:3-8: error: `extern` not allowed; requires file or namespace scope [ModifierExternNotAllowed] + // CHECK:STDERR: ╭─┤ fail_member_extern.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ extern fn G(self); + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: `extern` not allowed; requires file or namespace scope + // CHECK:STDERR: · ┃ [ModifierExternNotAllowed] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extern fn G(self); } @@ -63,8 +87,17 @@ library "[[@TEST_NAME]]"; import library "basic"; -// CHECK:STDERR: fail_extern_library_in_importer.carbon:[[@LINE+3]]:1-30: error: cannot declare imported `fn F` as `extern library` [ExternLibraryInImporter] -// CHECK:STDERR: basic.carbon:4:1-14: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_extern_library_in_importer.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: -> │ extern library "basic" fn F(); +// CHECK:STDERR: · ━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot declare imported `fn F` as `extern library` +// CHECK:STDERR: · ┃ [ExternLibraryInImporter] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ basic.carbon +// CHECK:STDERR: │ extern fn F(); +// CHECK:STDERR: · ───────┬────── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: extern library "basic" fn F(); @@ -143,7 +176,7 @@ extern library "basic" fn F(); // CHECK:STDOUT: .F = %F.decl.loc4 // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl.loc4: %F.type = fn_decl @F [concrete = constants.%F] {} {} -// CHECK:STDOUT: %F.decl.loc8: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: %F.decl.loc15: %F.type = fn_decl @F [concrete = constants.%F] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: extern fn @F(); @@ -161,7 +194,7 @@ extern library "basic" fn F(); // CHECK:STDOUT: .F = %F.decl.loc4 // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl.loc4: %F.type = fn_decl @F [concrete = constants.%F] {} {} -// CHECK:STDOUT: %F.decl.loc8: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: %F.decl.loc15: %F.type = fn_decl @F [concrete = constants.%F] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: extern fn @F(); diff --git a/toolchain/check/testdata/function/declaration/extern_library.carbon b/toolchain/check/testdata/function/declaration/extern_library.carbon index e352ba816e25..13cb7c366ac1 100644 --- a/toolchain/check/testdata/function/declaration/extern_library.carbon +++ b/toolchain/check/testdata/function/declaration/extern_library.carbon @@ -32,8 +32,19 @@ library "[[@TEST_NAME]]"; import library "extern_library"; -// CHECK:STDERR: fail_extern_library_nonowner.carbon:[[@LINE+3]]:1-14: error: declaration in library "extern_library_nonowner" doesn't match `extern library` declaration [ExternLibraryIncorrect] -// CHECK:STDERR: extern_library.carbon:4:1-45: note: previously declared with `extern library` here [ExternLibraryExpected] +// CHECK:STDERR: ╭─┤ fail_extern_library_nonowner.carbon:[[@LINE+14]]:1 +// CHECK:STDERR: -> │ extern fn F(); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: declaration in library "extern_library_nonowner" doesn't match +// CHECK:STDERR: · ┃ `extern library` declaration +// CHECK:STDERR: · ┃ [ExternLibraryIncorrect] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ extern_library.carbon +// CHECK:STDERR: │ extern library "extern_library_owner" fn F(); +// CHECK:STDERR: · ──────────────────────┬────────────────────── +// CHECK:STDERR: · ╰──┤ previously declared with `extern library` here +// CHECK:STDERR: · │ [ExternLibraryExpected] +// CHECK:STDERR: ╰──── // CHECK:STDERR: extern fn F(); @@ -43,8 +54,17 @@ library "[[@TEST_NAME]]"; import library "extern_library"; -// CHECK:STDERR: fail_extern_library_nonextern.carbon:[[@LINE+3]]:1-7: error: redeclarations of `fn F` must match use of `extern` [RedeclExternMismatch] -// CHECK:STDERR: extern_library.carbon:4:1-45: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_extern_library_nonextern.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: -> │ fn F(); +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclarations of `fn F` must match use of `extern` +// CHECK:STDERR: · ┃ [RedeclExternMismatch] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ extern_library.carbon +// CHECK:STDERR: │ extern library "extern_library_owner" fn F(); +// CHECK:STDERR: · ──────────────────────┬────────────────────── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(); @@ -54,8 +74,19 @@ library "[[@TEST_NAME]]"; import library "extern_library"; -// CHECK:STDERR: fail_extern_library_redecl.carbon:[[@LINE+3]]:1-45: error: declaration in library "extern_library_redecl" doesn't match `extern library` declaration [ExternLibraryIncorrect] -// CHECK:STDERR: extern_library.carbon:4:1-45: note: previously declared with `extern library` here [ExternLibraryExpected] +// CHECK:STDERR: ╭─┤ fail_extern_library_redecl.carbon:[[@LINE+14]]:1 +// CHECK:STDERR: -> │ extern library "extern_library_owner" fn F(); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: declaration in library "extern_library_redecl" doesn't match +// CHECK:STDERR: · ┃ `extern library` declaration +// CHECK:STDERR: · ┃ [ExternLibraryIncorrect] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ extern_library.carbon +// CHECK:STDERR: │ extern library "extern_library_owner" fn F(); +// CHECK:STDERR: · ──────────────────────┬────────────────────── +// CHECK:STDERR: · ╰──┤ previously declared with `extern library` here +// CHECK:STDERR: · │ [ExternLibraryExpected] +// CHECK:STDERR: ╰──── // CHECK:STDERR: extern library "extern_library_owner" fn F(); @@ -63,16 +94,25 @@ extern library "extern_library_owner" fn F(); library "[[@TEST_NAME]]"; +// CHECK:STDERR: ╷ ╭── imported from: fail_extern_library_collision.carbon [InImport] +// CHECK:STDERR: ├─┤ extern_library_copy.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: -> │ extern library "extern_library_owner" fn F(); +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `F` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ extern_library.carbon +// CHECK:STDERR: │ extern library "extern_library_owner" fn F(); +// CHECK:STDERR: · ──────────────────────┬────────────────────── +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: extern library "extern_library_owner" fn F(); // --- fail_extern_library_collision.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: imported from: fail_extern_library_collision.carbon:[[@LINE+4]]:1 [InImport] -// CHECK:STDERR: extern_library_copy.carbon:4:1-45: error: duplicate name `F` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: extern_library.carbon:4:1-45: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: import library "extern_library"; import library "extern_library_copy"; @@ -86,9 +126,20 @@ extern library "extern_library_owner" fn F(); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_extern_library_mismatch_owner.carbon:[[@LINE+4]]:41: error: `import` declarations must end with a `;` [ExpectedDeclSemi] +// CHECK:STDERR: ╭─┤ fail_extern_library_mismatch_owner.carbon:[[@LINE+15]]:41 +// CHECK:STDERR: -> │ import library "extern_library_mismatch" +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `import` declarations must +// CHECK:STDERR: · ┃ end with a `;` +// CHECK:STDERR: · ┃ [ExpectedDeclSemi] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_extern_library_mismatch_owner.carbon:[[@LINE+2]]:1-40: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_extern_library_mismatch_owner.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ import library "extern_library_mismatch" +// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `handle invalid parse trees in `check`` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import library "extern_library_mismatch" @@ -98,7 +149,12 @@ extern fn F(); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_extern_self_library.carbon:[[@LINE+2]]:1-36: error: `extern library` cannot specify the current library [ExternLibraryIsCurrentLibrary] +// CHECK:STDERR: ╭─┤ fail_extern_self_library.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ extern library "extern_self_library" fn F(); +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `extern library` cannot specify the current library +// CHECK:STDERR: · ┃ [ExternLibraryIsCurrentLibrary] +// CHECK:STDERR: ╰──── // CHECK:STDERR: extern library "extern_self_library" fn F(); @@ -114,8 +170,17 @@ library "[[@TEST_NAME]]"; import library "extern_of_import"; -// CHECK:STDERR: fail_extern_of_import_redecl.carbon:[[@LINE+3]]:1-41: error: redeclarations of `fn F` must match use of `extern` [RedeclExternMismatch] -// CHECK:STDERR: extern_of_import.carbon:4:1-7: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_extern_of_import_redecl.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: -> │ extern library "extern_of_import" fn F(); +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclarations of `fn F` must match use of `extern` +// CHECK:STDERR: · ┃ [RedeclExternMismatch] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ extern_of_import.carbon +// CHECK:STDERR: │ fn F(); +// CHECK:STDERR: · ───┬─── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: extern library "extern_of_import" fn F(); @@ -123,7 +188,13 @@ extern library "extern_of_import" fn F(); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_extern_library_on_definition.carbon:[[@LINE+2]]:1-37: error: a library cannot be provided for an `extern` modifier on a definition [ExternLibraryOnDefinition] +// CHECK:STDERR: ╭─┤ fail_extern_library_on_definition.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ extern library "extern_library_owner" fn F() {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: a library cannot be provided for an `extern` modifier on a +// CHECK:STDERR: · ┃ definition +// CHECK:STDERR: · ┃ [ExternLibraryOnDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: extern library "extern_library_owner" fn F() {} diff --git a/toolchain/check/testdata/function/declaration/extern_library_for_default.carbon b/toolchain/check/testdata/function/declaration/extern_library_for_default.carbon index cb3fa7092a5a..b1fe217d422e 100644 --- a/toolchain/check/testdata/function/declaration/extern_library_for_default.carbon +++ b/toolchain/check/testdata/function/declaration/extern_library_for_default.carbon @@ -32,8 +32,19 @@ package Foo library "[[@TEST_NAME]]"; import library default; -// CHECK:STDERR: fail_wrong_library.carbon:[[@LINE+3]]:1-14: error: declaration in library "wrong_library" doesn't match `extern library` declaration [ExternLibraryIncorrect] -// CHECK:STDERR: default.carbon:4:1-33: note: previously declared with `extern library` here [ExternLibraryExpected] +// CHECK:STDERR: ╭─┤ fail_wrong_library.carbon:[[@LINE+14]]:1 +// CHECK:STDERR: -> │ extern fn F(); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: declaration in library "wrong_library" doesn't match +// CHECK:STDERR: · ┃ `extern library` declaration +// CHECK:STDERR: · ┃ [ExternLibraryIncorrect] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ default.carbon +// CHECK:STDERR: │ extern library "expected" fn F(); +// CHECK:STDERR: · ────────────────┬──────────────── +// CHECK:STDERR: · ╰──┤ previously declared with `extern library` here +// CHECK:STDERR: · │ [ExternLibraryExpected] +// CHECK:STDERR: ╰──── // CHECK:STDERR: extern fn F(); diff --git a/toolchain/check/testdata/function/declaration/extern_library_from_default.carbon b/toolchain/check/testdata/function/declaration/extern_library_from_default.carbon index 99bed74bb6c8..ea48d5f6b287 100644 --- a/toolchain/check/testdata/function/declaration/extern_library_from_default.carbon +++ b/toolchain/check/testdata/function/declaration/extern_library_from_default.carbon @@ -30,8 +30,19 @@ library "[[@TEST_NAME]]"; import library "extern_library"; -// CHECK:STDERR: fail_wrong_library.carbon:[[@LINE+3]]:1-14: error: declaration in library "wrong_library" doesn't match `extern library` declaration [ExternLibraryIncorrect] -// CHECK:STDERR: extern_library.carbon:4:1-30: note: previously declared with `extern library` here [ExternLibraryExpected] +// CHECK:STDERR: ╭─┤ fail_wrong_library.carbon:[[@LINE+14]]:1 +// CHECK:STDERR: -> │ extern fn F(); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: declaration in library "wrong_library" doesn't match +// CHECK:STDERR: · ┃ `extern library` declaration +// CHECK:STDERR: · ┃ [ExternLibraryIncorrect] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ extern_library.carbon +// CHECK:STDERR: │ extern library default fn F(); +// CHECK:STDERR: · ───────────────┬────────────── +// CHECK:STDERR: · ╰──┤ previously declared with `extern library` here +// CHECK:STDERR: · │ [ExternLibraryExpected] +// CHECK:STDERR: ╰──── // CHECK:STDERR: extern fn F(); diff --git a/toolchain/check/testdata/function/declaration/fail_import_incomplete_return.carbon b/toolchain/check/testdata/function/declaration/fail_import_incomplete_return.carbon index b26535ea2a04..6b44a65a311f 100644 --- a/toolchain/check/testdata/function/declaration/fail_import_incomplete_return.carbon +++ b/toolchain/check/testdata/function/declaration/fail_import_incomplete_return.carbon @@ -25,14 +25,36 @@ fn ReturnDUnused() -> D; fn ReturnDUsed() -> D; fn Call() { - // CHECK:STDERR: fail_incomplete_return.carbon:[[@LINE+4]]:3-15: error: function returns incomplete type `C` [IncompleteTypeInFunctionReturnType] - // CHECK:STDERR: fail_incomplete_return.carbon:[[@LINE-10]]:1-8: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: fail_incomplete_return.carbon:[[@LINE-7]]:18-21: note: return type declared here [IncompleteReturnTypeHere] + // CHECK:STDERR: ╭─┤ fail_incomplete_return.carbon:[[@LINE+15]]:3 + // CHECK:STDERR: │ class C; + // CHECK:STDERR: · ────┬─── + // CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ fn ReturnCUsed() -> C; + // CHECK:STDERR: · ──┬─ + // CHECK:STDERR: · ╰──┤ return type declared here [IncompleteReturnTypeHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ ReturnCUsed(); + // CHECK:STDERR: · ━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: function returns incomplete type `C` + // CHECK:STDERR: · ┃ [IncompleteTypeInFunctionReturnType] + // CHECK:STDERR: ╰──── // CHECK:STDERR: ReturnCUsed(); - // CHECK:STDERR: fail_incomplete_return.carbon:[[@LINE+4]]:3-15: error: function returns incomplete type `D` [IncompleteTypeInFunctionReturnType] - // CHECK:STDERR: fail_incomplete_return.carbon:[[@LINE-14]]:1-8: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: fail_incomplete_return.carbon:[[@LINE-10]]:18-21: note: return type declared here [IncompleteReturnTypeHere] + // CHECK:STDERR: ╭─┤ fail_incomplete_return.carbon:[[@LINE+15]]:3 + // CHECK:STDERR: │ class D; + // CHECK:STDERR: · ────┬─── + // CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ fn ReturnDUsed() -> D; + // CHECK:STDERR: · ──┬─ + // CHECK:STDERR: · ╰──┤ return type declared here [IncompleteReturnTypeHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ ReturnDUsed(); + // CHECK:STDERR: · ━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: function returns incomplete type `D` + // CHECK:STDERR: · ┃ [IncompleteTypeInFunctionReturnType] + // CHECK:STDERR: ╰──── // CHECK:STDERR: ReturnDUsed(); } @@ -46,16 +68,40 @@ library "[[@TEST_NAME]]"; import library "incomplete_return"; fn CallFAndGIncomplete() { - // CHECK:STDERR: fail_use_imported.carbon:[[@LINE+5]]:3-17: error: function returns incomplete type `C` [IncompleteTypeInFunctionReturnType] - // CHECK:STDERR: imported from: fail_use_imported.carbon:[[@LINE-4]]:1 [InImport] - // CHECK:STDERR: fail_incomplete_return.carbon:4:1-8: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: fail_incomplete_return.carbon:7:20-23: note: return type declared here [IncompleteReturnTypeHere] + // CHECK:STDERR: ╭─┤ fail_use_imported.carbon:[[@LINE+17]]:3 + // CHECK:STDERR: -> │ ReturnCUnused(); + // CHECK:STDERR: · ━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: function returns incomplete type `C` + // CHECK:STDERR: · ┃ [IncompleteTypeInFunctionReturnType] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ ╭── imported from: fail_use_imported.carbon [InImport] + // CHECK:STDERR: ├─┤ fail_incomplete_return.carbon + // CHECK:STDERR: │ class C; + // CHECK:STDERR: · ────┬─── + // CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ fn ReturnCUnused() -> C; + // CHECK:STDERR: · ──┬─ + // CHECK:STDERR: · ╰──┤ return type declared here [IncompleteReturnTypeHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: ReturnCUnused(); - // CHECK:STDERR: fail_use_imported.carbon:[[@LINE+5]]:3-15: error: function returns incomplete type `C` [IncompleteTypeInFunctionReturnType] - // CHECK:STDERR: imported from: fail_use_imported.carbon:[[@LINE-10]]:1 [InImport] - // CHECK:STDERR: fail_incomplete_return.carbon:4:1-8: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: fail_incomplete_return.carbon:8:18-21: note: return type declared here [IncompleteReturnTypeHere] + // CHECK:STDERR: ╭─┤ fail_use_imported.carbon:[[@LINE+17]]:3 + // CHECK:STDERR: -> │ ReturnCUsed(); + // CHECK:STDERR: · ━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: function returns incomplete type `C` + // CHECK:STDERR: · ┃ [IncompleteTypeInFunctionReturnType] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ ╭── imported from: fail_use_imported.carbon [InImport] + // CHECK:STDERR: ├─┤ fail_incomplete_return.carbon + // CHECK:STDERR: │ class C; + // CHECK:STDERR: · ────┬─── + // CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ fn ReturnCUsed() -> C; + // CHECK:STDERR: · ──┬─ + // CHECK:STDERR: · ╰──┤ return type declared here [IncompleteReturnTypeHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: ReturnCUsed(); ReturnDUnused(); @@ -148,7 +194,7 @@ fn CallFAndGIncomplete() { // CHECK:STDOUT: %return: ref %D = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: %Call.decl: %Call.type = fn_decl @Call [concrete = constants.%Call] {} {} -// CHECK:STDOUT: %D.decl.loc25: type = class_decl @D [concrete = constants.%D] {} {} +// CHECK:STDOUT: %D.decl.loc47: type = class_decl @D [concrete = constants.%D] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C; @@ -201,7 +247,7 @@ fn CallFAndGIncomplete() { // CHECK:STDOUT: %T.09f: %SubobjectDestroy.type = symbolic_binding T, 0 [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.type.dea: type = fn_type @T.as_type.as.DestroyImpl.impl.Op, @T.as_type.as.DestroyImpl.impl(%T.09f) [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.6e5: %T.as_type.as.DestroyImpl.impl.Op.type.dea = struct_value () [symbolic] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.2: type = fn_type @SubobjectDestroy.WithSelf.Op.loc19_17.2 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.2: type = fn_type @SubobjectDestroy.WithSelf.Op.loc43_17.2 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.2: %SubobjectDestroy.WithSelf.Op.type.6870fd.2 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80ef6.2: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.2), @SubobjectDestroy [concrete] // CHECK:STDOUT: %SubobjectDestroy.facet.f61: %SubobjectDestroy.type = facet_value %D, (%custom_witness.b80ef6.2) [concrete] @@ -225,7 +271,7 @@ fn CallFAndGIncomplete() { // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } -// CHECK:STDOUT: %Main.import_ref.8f2: = import_ref Main//incomplete_return, loc25_10, loaded [concrete = constants.%complete_type] +// CHECK:STDOUT: %Main.import_ref.8f2: = import_ref Main//incomplete_return, loc47_10, loaded [concrete = constants.%complete_type] // CHECK:STDOUT: %Main.import_ref.54a = import_ref Main//incomplete_return, inst{{[0-9A-F]+}} [no loc], unloaded // CHECK:STDOUT: %Core.SelfDestruct: %SelfDestruct.type = import_ref Core//prelude/parts/destroy, SelfDestruct, loaded [concrete = constants.%SelfDestruct] // CHECK:STDOUT: %Core.import_ref.74d: @T.as_type.as.DestroyImpl.impl.%T.as_type.as.DestroyImpl.impl.Op.type (%T.as_type.as.DestroyImpl.impl.Op.type.dea) = import_ref Core//prelude/parts/destroy, loc{{\d+_\d+}}, loaded [symbolic = @T.as_type.as.DestroyImpl.impl.%T.as_type.as.DestroyImpl.impl.Op (constants.%T.as_type.as.DestroyImpl.impl.Op.6e5)] @@ -265,25 +311,25 @@ fn CallFAndGIncomplete() { // CHECK:STDOUT: %ReturnCUsed.ref: %ReturnCUsed.type = name_ref ReturnCUsed, imports.%Main.ReturnCUsed [concrete = constants.%ReturnCUsed] // CHECK:STDOUT: %ReturnCUsed.call: init = call %ReturnCUsed.ref() // CHECK:STDOUT: %ReturnDUnused.ref: %ReturnDUnused.type = name_ref ReturnDUnused, imports.%Main.ReturnDUnused [concrete = constants.%ReturnDUnused] -// CHECK:STDOUT: %.loc19_17.1: ref %D = temporary_storage -// CHECK:STDOUT: %ReturnDUnused.call: init %D to %.loc19_17.1 = call %ReturnDUnused.ref() -// CHECK:STDOUT: %.loc19_17.2: ref %D = temporary %.loc19_17.1, %ReturnDUnused.call -// CHECK:STDOUT: %Destroy.facet.loc19_17.1: %Destroy.type = facet_value constants.%D, (constants.%DestroyImpl.impl_witness.30f, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc19_17.3: %Destroy.type = converted constants.%D, %Destroy.facet.loc19_17.1 [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %Destroy.facet.loc19_17.2: %Destroy.type = facet_value constants.%D, (constants.%DestroyImpl.impl_witness.30f, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc19_17.4: %Destroy.type = converted constants.%D, %Destroy.facet.loc19_17.2 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc43_17.1: ref %D = temporary_storage +// CHECK:STDOUT: %ReturnDUnused.call: init %D to %.loc43_17.1 = call %ReturnDUnused.ref() +// CHECK:STDOUT: %.loc43_17.2: ref %D = temporary %.loc43_17.1, %ReturnDUnused.call +// CHECK:STDOUT: %Destroy.facet.loc43_17.1: %Destroy.type = facet_value constants.%D, (constants.%DestroyImpl.impl_witness.30f, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc43_17.3: %Destroy.type = converted constants.%D, %Destroy.facet.loc43_17.1 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %Destroy.facet.loc43_17.2: %Destroy.type = facet_value constants.%D, (constants.%DestroyImpl.impl_witness.30f, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc43_17.4: %Destroy.type = converted constants.%D, %Destroy.facet.loc43_17.2 [concrete = constants.%Destroy.facet] // CHECK:STDOUT: %SelfDestruct.specific_fn.1: = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet) [concrete = constants.%SelfDestruct.specific_fn] -// CHECK:STDOUT: %SelfDestruct.call.loc19: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%.loc19_17.2) +// CHECK:STDOUT: %SelfDestruct.call.loc43: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%.loc43_17.2) // CHECK:STDOUT: %ReturnDUsed.ref: %ReturnDUsed.type = name_ref ReturnDUsed, imports.%Main.ReturnDUsed [concrete = constants.%ReturnDUsed] -// CHECK:STDOUT: %.loc20_15.1: ref %D = temporary_storage -// CHECK:STDOUT: %ReturnDUsed.call: init %D to %.loc20_15.1 = call %ReturnDUsed.ref() -// CHECK:STDOUT: %.loc20_15.2: ref %D = temporary %.loc20_15.1, %ReturnDUsed.call -// CHECK:STDOUT: %Destroy.facet.loc20_15.1: %Destroy.type = facet_value constants.%D, (constants.%DestroyImpl.impl_witness.30f, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc20_15.3: %Destroy.type = converted constants.%D, %Destroy.facet.loc20_15.1 [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %Destroy.facet.loc20_15.2: %Destroy.type = facet_value constants.%D, (constants.%DestroyImpl.impl_witness.30f, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc20_15.4: %Destroy.type = converted constants.%D, %Destroy.facet.loc20_15.2 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc44_15.1: ref %D = temporary_storage +// CHECK:STDOUT: %ReturnDUsed.call: init %D to %.loc44_15.1 = call %ReturnDUsed.ref() +// CHECK:STDOUT: %.loc44_15.2: ref %D = temporary %.loc44_15.1, %ReturnDUsed.call +// CHECK:STDOUT: %Destroy.facet.loc44_15.1: %Destroy.type = facet_value constants.%D, (constants.%DestroyImpl.impl_witness.30f, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc44_15.3: %Destroy.type = converted constants.%D, %Destroy.facet.loc44_15.1 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %Destroy.facet.loc44_15.2: %Destroy.type = facet_value constants.%D, (constants.%DestroyImpl.impl_witness.30f, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc44_15.4: %Destroy.type = converted constants.%D, %Destroy.facet.loc44_15.2 [concrete = constants.%Destroy.facet] // CHECK:STDOUT: %SelfDestruct.specific_fn.2: = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet) [concrete = constants.%SelfDestruct.specific_fn] -// CHECK:STDOUT: %SelfDestruct.call.loc20: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%.loc20_15.2) +// CHECK:STDOUT: %SelfDestruct.call.loc44: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%.loc44_15.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -293,9 +339,9 @@ fn CallFAndGIncomplete() { // CHECK:STDOUT: // CHECK:STDOUT: fn @ReturnDUnused [from "fail_incomplete_return.carbon"]; // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc19_17.1(%self.param: ref %empty_struct_type) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc43_17.1(%self.param: ref %empty_struct_type) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc19_17.2(%self.param: ref %D) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc43_17.2(%self.param: ref %D) = "no_op"; // CHECK:STDOUT: // CHECK:STDOUT: fn @ReturnDUsed [from "fail_incomplete_return.carbon"]; // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/declaration/fail_modifiers.carbon b/toolchain/check/testdata/function/declaration/fail_modifiers.carbon index 45845f75cd51..b3e786286517 100644 --- a/toolchain/check/testdata/function/declaration/fail_modifiers.carbon +++ b/toolchain/check/testdata/function/declaration/fail_modifiers.carbon @@ -12,48 +12,107 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/declaration/fail_modifiers.carbon -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+5]]:9-17: error: `protected` must appear before `default` [ModifierMustAppearBefore] -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1-7: note: `default` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+15]]:9 +// CHECK:STDERR: -> │ default protected fn WrongOrder(); +// CHECK:STDERR: · ───┬─── ━━━━┳━━━━ +// CHECK:STDERR: · │ ┗━━┫ error: `protected` must appear before `default` +// CHECK:STDERR: · │ ┃ [ModifierMustAppearBefore] +// CHECK:STDERR: · ╰─────────────┤ `default` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-7: error: `default` not allowed; requires interface scope [ModifierRequiresInterface] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ default protected fn WrongOrder(); +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: `default` not allowed; requires interface scope +// CHECK:STDERR: · ┃ [ModifierRequiresInterface] +// CHECK:STDERR: ╰──── // CHECK:STDERR: default protected fn WrongOrder(); -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+5]]:9-15: error: `virtual` repeated on declaration [ModifierRepeated] -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1-7: note: `virtual` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+14]]:9 +// CHECK:STDERR: -> │ virtual virtual fn DuplicateVirtual() {} +// CHECK:STDERR: · ───┬─── ━━━┳━━━ +// CHECK:STDERR: · │ ┗━━┫ error: `virtual` repeated on declaration [ModifierRepeated] +// CHECK:STDERR: · ╰────────────┤ `virtual` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-7: error: `virtual` not allowed; requires class scope [ModifierRequiresClass] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ virtual virtual fn DuplicateVirtual() {} +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: `virtual` not allowed; requires class scope +// CHECK:STDERR: · ┃ [ModifierRequiresClass] +// CHECK:STDERR: ╰──── // CHECK:STDERR: virtual virtual fn DuplicateVirtual() {} -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+3]]:9-17: error: `protected` not allowed on declaration with `private` [ModifierNotAllowedWith] -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-7: note: `private` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+8]]:9 +// CHECK:STDERR: -> │ private protected fn TwoAccess(); +// CHECK:STDERR: · ───┬─── ━━━━┳━━━━ +// CHECK:STDERR: · │ ┗━━┫ error: `protected` not allowed on declaration with `private` +// CHECK:STDERR: · │ ┃ [ModifierNotAllowedWith] +// CHECK:STDERR: · ╰─────────────┤ `private` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: private protected fn TwoAccess(); -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+5]]:10-16: error: `virtual` not allowed on declaration with `abstract` [ModifierNotAllowedWith] -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1-8: note: `abstract` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+15]]:10 +// CHECK:STDERR: -> │ abstract virtual fn ModifiersConflict() {} +// CHECK:STDERR: · ────┬─── ━━━┳━━━ +// CHECK:STDERR: · │ ┗━━┫ error: `virtual` not allowed on declaration with `abstract` +// CHECK:STDERR: · │ ┃ [ModifierNotAllowedWith] +// CHECK:STDERR: · ╰────────────┤ `abstract` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-8: error: `abstract` not allowed; requires class scope [ModifierRequiresClass] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ abstract virtual fn ModifiersConflict() {} +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: `abstract` not allowed; requires class scope +// CHECK:STDERR: · ┃ [ModifierRequiresClass] +// CHECK:STDERR: ╰──── // CHECK:STDERR: abstract virtual fn ModifiersConflict() {} -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-4: error: `base` not allowed on `fn` declaration [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ base fn InvalidModifier(); +// CHECK:STDERR: · ━━┳━ +// CHECK:STDERR: · ┗━━┫ error: `base` not allowed on `fn` declaration +// CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╰──── // CHECK:STDERR: base fn InvalidModifier(); -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+8]]:9-13: error: `final` not allowed on declaration with `default` [ModifierNotAllowedWith] -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+7]]:1-7: note: `default` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+23]]:9 +// CHECK:STDERR: -> │ default final virtual fn ModifiersConflict2() {} +// CHECK:STDERR: · ───┬─── ━━┳━━ +// CHECK:STDERR: · │ ┗━━┫ error: `final` not allowed on declaration with `default` +// CHECK:STDERR: · │ ┃ [ModifierNotAllowedWith] +// CHECK:STDERR: · ╰───────────┤ `default` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+5]]:15-21: error: `virtual` not allowed on declaration with `default` [ModifierNotAllowedWith] -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1-7: note: `default` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+15]]:15 +// CHECK:STDERR: -> │ default final virtual fn ModifiersConflict2() {} +// CHECK:STDERR: · ───┬─── ━━━┳━━━ +// CHECK:STDERR: · │ ┗━━┫ error: `virtual` not allowed on declaration with `default` +// CHECK:STDERR: · │ ┃ [ModifierNotAllowedWith] +// CHECK:STDERR: · ╰──────────────────┤ `default` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-7: error: `default` not allowed; requires interface scope [ModifierRequiresInterface] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ default final virtual fn ModifiersConflict2() {} +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: `default` not allowed; requires interface scope +// CHECK:STDERR: · ┃ [ModifierRequiresInterface] +// CHECK:STDERR: ╰──── // CHECK:STDERR: default final virtual fn ModifiersConflict2() {} -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+3]]:8-14: error: `private` must appear before `extern` [ModifierMustAppearBefore] -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-6: note: `extern` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+8]]:8 +// CHECK:STDERR: -> │ extern private fn ExternOrderAndConflict() {} +// CHECK:STDERR: · ───┬── ━━━┳━━━ +// CHECK:STDERR: · │ ┗━━┫ error: `private` must appear before `extern` +// CHECK:STDERR: · │ ┃ [ModifierMustAppearBefore] +// CHECK:STDERR: · ╰───────────┤ `extern` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: extern private fn ExternOrderAndConflict() {} diff --git a/toolchain/check/testdata/function/declaration/fail_param_in_type.carbon b/toolchain/check/testdata/function/declaration/fail_param_in_type.carbon index 5dd75713398c..bc72ce562ebe 100644 --- a/toolchain/check/testdata/function/declaration/fail_param_in_type.carbon +++ b/toolchain/check/testdata/function/declaration/fail_param_in_type.carbon @@ -12,7 +12,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/declaration/fail_param_in_type.carbon -// CHECK:STDERR: fail_param_in_type.carbon:[[@LINE+2]]:28: error: array bound is not a constant [InvalidArrayExpr] +// CHECK:STDERR: ╭─┤ fail_param_in_type.carbon:[[@LINE+7]]:28 +// CHECK:STDERR: -> │ fn F(n: i32, a: array(i32, n)*); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: array bound is not a constant +// CHECK:STDERR: · ┃ [InvalidArrayExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(n: i32, a: array(i32, n)*); @@ -53,11 +58,11 @@ fn F(n: i32, a: array(i32, n)*); // CHECK:STDOUT: %a.patt: = wrapper_binding_pattern a, %a.param_patt [concrete = ] // CHECK:STDOUT: } { // CHECK:STDOUT: %n.param: %i32 = value_param call_param0 -// CHECK:STDOUT: %i32.loc17_9: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc22_9: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %n: %i32 = wrapper_binding n, %n.param // CHECK:STDOUT: %a.param: = value_param call_param1 -// CHECK:STDOUT: %.loc17: type = splice_block %ptr [concrete = ] { -// CHECK:STDOUT: %i32.loc17_23: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc22: type = splice_block %ptr [concrete = ] { +// CHECK:STDOUT: %i32.loc22_23: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %n.ref: %i32 = name_ref n, %n // CHECK:STDOUT: %ptr: type = ptr_type [concrete = ] // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/declaration/fail_param_redecl.carbon b/toolchain/check/testdata/function/declaration/fail_param_redecl.carbon index 62e1ffa1a81c..f17c17d0cd81 100644 --- a/toolchain/check/testdata/function/declaration/fail_param_redecl.carbon +++ b/toolchain/check/testdata/function/declaration/fail_param_redecl.carbon @@ -12,8 +12,13 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/declaration/fail_param_redecl.carbon -// CHECK:STDERR: fail_param_redecl.carbon:[[@LINE+3]]:14: error: duplicate name `n` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: fail_param_redecl.carbon:[[@LINE+2]]:6-11: note: name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╭─┤ fail_param_redecl.carbon:[[@LINE+8]]:14 +// CHECK:STDERR: -> │ fn F(n: i32, n: i32); +// CHECK:STDERR: · ───┬── ┳ +// CHECK:STDERR: · │ ┗━━┫ error: duplicate name `n` being declared in the same scope +// CHECK:STDERR: · │ ┃ [NameDeclDuplicate] +// CHECK:STDERR: · ╰─────────┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(n: i32, n: i32); @@ -48,19 +53,19 @@ fn F(n: i32, n: i32); // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] { -// CHECK:STDOUT: %n.param_patt.loc18_7: %pattern_type.d94 = value_param_pattern [concrete = constants.%n.param_patt] -// CHECK:STDOUT: %n.patt.loc18_7: %pattern_type.d94 = wrapper_binding_pattern n, %n.param_patt.loc18_7 [concrete = constants.%n.patt] -// CHECK:STDOUT: %n.param_patt.loc18_15: %pattern_type.d94 = value_param_pattern [concrete = constants.%n.param_patt] -// CHECK:STDOUT: %n.patt.loc18_15: %pattern_type.d94 = wrapper_binding_pattern n, %n.param_patt.loc18_15 [concrete = constants.%n.patt] +// CHECK:STDOUT: %n.param_patt.loc23_7: %pattern_type.d94 = value_param_pattern [concrete = constants.%n.param_patt] +// CHECK:STDOUT: %n.patt.loc23_7: %pattern_type.d94 = wrapper_binding_pattern n, %n.param_patt.loc23_7 [concrete = constants.%n.patt] +// CHECK:STDOUT: %n.param_patt.loc23_15: %pattern_type.d94 = value_param_pattern [concrete = constants.%n.param_patt] +// CHECK:STDOUT: %n.patt.loc23_15: %pattern_type.d94 = wrapper_binding_pattern n, %n.param_patt.loc23_15 [concrete = constants.%n.patt] // CHECK:STDOUT: } { -// CHECK:STDOUT: %n.param.loc18_7: %i32 = value_param call_param0 -// CHECK:STDOUT: %i32.loc18_9: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %n.loc18_7: %i32 = wrapper_binding n, %n.param.loc18_7 -// CHECK:STDOUT: %n.param.loc18_15: %i32 = value_param call_param1 -// CHECK:STDOUT: %i32.loc18_17: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %n.loc18_15: %i32 = wrapper_binding n, %n.param.loc18_15 +// CHECK:STDOUT: %n.param.loc23_7: %i32 = value_param call_param0 +// CHECK:STDOUT: %i32.loc23_9: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %n.loc23_7: %i32 = wrapper_binding n, %n.param.loc23_7 +// CHECK:STDOUT: %n.param.loc23_15: %i32 = value_param call_param1 +// CHECK:STDOUT: %i32.loc23_17: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %n.loc23_15: %i32 = wrapper_binding n, %n.param.loc23_15 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F(%n.param.loc18_7: %i32, %n.param.loc18_15: %i32); +// CHECK:STDOUT: fn @F(%n.param.loc23_7: %i32, %n.param.loc23_15: %i32); // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/declaration/fail_redecl.carbon b/toolchain/check/testdata/function/declaration/fail_redecl.carbon index cb4204bb646c..6bb3e5cd54bf 100644 --- a/toolchain/check/testdata/function/declaration/fail_redecl.carbon +++ b/toolchain/check/testdata/function/declaration/fail_redecl.carbon @@ -13,32 +13,68 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/declaration/fail_redecl.carbon fn A(); -// CHECK:STDERR: fail_redecl.carbon:[[@LINE+3]]:1-7: error: redeclaration of `fn A` is redundant [RedeclRedundant] -// CHECK:STDERR: fail_redecl.carbon:[[@LINE-2]]:1-7: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_redecl.carbon:[[@LINE+10]]:1 +// CHECK:STDERR: │ fn A(); +// CHECK:STDERR: · ───┬─── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn A(); +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of `fn A` is redundant [RedeclRedundant] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn A(); fn B(x: ()); -// CHECK:STDERR: fail_redecl.carbon:[[@LINE+3]]:1-12: error: redeclaration of `fn B` is redundant [RedeclRedundant] -// CHECK:STDERR: fail_redecl.carbon:[[@LINE-2]]:1-12: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_redecl.carbon:[[@LINE+10]]:1 +// CHECK:STDERR: │ fn B(x: ()); +// CHECK:STDERR: · ──────┬───── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn B(x: ()); +// CHECK:STDERR: · ━━━━━━┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of `fn B` is redundant [RedeclRedundant] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn B(x: ()); fn C(); -// CHECK:STDERR: fail_redecl.carbon:[[@LINE+3]]:1-12: error: redeclaration differs because of parameter count of 1 [RedeclParamCountDiffers] -// CHECK:STDERR: fail_redecl.carbon:[[@LINE-2]]:1-7: note: previously declared with parameter count of 0 [RedeclParamCountPrevious] +// CHECK:STDERR: ╭─┤ fail_redecl.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: │ fn C(); +// CHECK:STDERR: · ───┬─── +// CHECK:STDERR: · ╰──┤ previously declared with parameter count of 0 [RedeclParamCountPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn C(x: ()); +// CHECK:STDERR: · ━━━━━━┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration differs because of parameter count of 1 +// CHECK:STDERR: · ┃ [RedeclParamCountDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn C(x: ()); fn D() {} -// CHECK:STDERR: fail_redecl.carbon:[[@LINE+3]]:1-7: error: redeclaration of `fn D` is redundant [RedeclRedundant] -// CHECK:STDERR: fail_redecl.carbon:[[@LINE-2]]:1-8: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_redecl.carbon:[[@LINE+10]]:1 +// CHECK:STDERR: │ fn D() {} +// CHECK:STDERR: · ────┬─── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn D(); +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of `fn D` is redundant [RedeclRedundant] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn D(); fn E() {} -// CHECK:STDERR: fail_redecl.carbon:[[@LINE+3]]:1-8: error: redefinition of `fn E` [RedeclRedef] -// CHECK:STDERR: fail_redecl.carbon:[[@LINE-2]]:1-8: note: previously defined here [RedeclPrevDef] +// CHECK:STDERR: ╭─┤ fail_redecl.carbon:[[@LINE+10]]:1 +// CHECK:STDERR: │ fn E() {} +// CHECK:STDERR: · ────┬─── +// CHECK:STDERR: · ╰──┤ previously defined here [RedeclPrevDef] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn E() {} +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: redefinition of `fn E` [RedeclRedef] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn E() {} @@ -55,87 +91,87 @@ fn E() {} // CHECK:STDOUT: %x.patt: %pattern_type = wrapper_binding_pattern x, %x.param_patt [concrete] // CHECK:STDOUT: %B.type: type = fn_type @B [concrete] // CHECK:STDOUT: %B: %B.type = struct_value () [concrete] -// CHECK:STDOUT: %C.type.322e3b.1: type = fn_type @C.loc27 [concrete] +// CHECK:STDOUT: %C.type.322e3b.1: type = fn_type @C.loc41 [concrete] // CHECK:STDOUT: %C.010386.1: %C.type.322e3b.1 = struct_value () [concrete] -// CHECK:STDOUT: %C.type.322e3b.2: type = fn_type @C.loc31 [concrete] +// CHECK:STDOUT: %C.type.322e3b.2: type = fn_type @C.loc53 [concrete] // CHECK:STDOUT: %C.010386.2: %C.type.322e3b.2 = struct_value () [concrete] // CHECK:STDOUT: %D.type: type = fn_type @D [concrete] // CHECK:STDOUT: %D: %D.type = struct_value () [concrete] -// CHECK:STDOUT: %E.type.53e05b.1: type = fn_type @E.loc39 [concrete] +// CHECK:STDOUT: %E.type.53e05b.1: type = fn_type @E.loc68 [concrete] // CHECK:STDOUT: %E.3f2512.1: %E.type.53e05b.1 = struct_value () [concrete] -// CHECK:STDOUT: %E.type.53e05b.2: type = fn_type @E.loc43 [concrete] +// CHECK:STDOUT: %E.type.53e05b.2: type = fn_type @E.loc79 [concrete] // CHECK:STDOUT: %E.3f2512.2: %E.type.53e05b.2 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [concrete] { // CHECK:STDOUT: .A = %A.decl.loc15 -// CHECK:STDOUT: .B = %B.decl.loc21 -// CHECK:STDOUT: .C = %C.decl.loc27 -// CHECK:STDOUT: .D = %D.decl.loc33 -// CHECK:STDOUT: .E = %E.decl.loc39 +// CHECK:STDOUT: .B = %B.decl.loc28 +// CHECK:STDOUT: .C = %C.decl.loc41 +// CHECK:STDOUT: .D = %D.decl.loc55 +// CHECK:STDOUT: .E = %E.decl.loc68 // CHECK:STDOUT: } // CHECK:STDOUT: %A.decl.loc15: %A.type = fn_decl @A [concrete = constants.%A] {} {} -// CHECK:STDOUT: %A.decl.loc19: %A.type = fn_decl @A [concrete = constants.%A] {} {} -// CHECK:STDOUT: %B.decl.loc21: %B.type = fn_decl @B [concrete = constants.%B] { +// CHECK:STDOUT: %A.decl.loc26: %A.type = fn_decl @A [concrete = constants.%A] {} {} +// CHECK:STDOUT: %B.decl.loc28: %B.type = fn_decl @B [concrete = constants.%B] { // CHECK:STDOUT: %x.param_patt: %pattern_type = value_param_pattern [concrete = constants.%x.param_patt] // CHECK:STDOUT: %x.patt: %pattern_type = wrapper_binding_pattern x, %x.param_patt [concrete = constants.%x.patt] // CHECK:STDOUT: } { -// CHECK:STDOUT: %x.param.loc21: %empty_tuple.type = value_param call_param0 -// CHECK:STDOUT: %.loc21_10.1: type = splice_block %.loc21_10.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc21_10.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc21_10.3: type = converted %.loc21_10.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %x.param.loc28: %empty_tuple.type = value_param call_param0 +// CHECK:STDOUT: %.loc28_10.1: type = splice_block %.loc28_10.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc28_10.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc28_10.3: type = converted %.loc28_10.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %x.loc21: %empty_tuple.type = wrapper_binding x, %x.param.loc21 +// CHECK:STDOUT: %x.loc28: %empty_tuple.type = wrapper_binding x, %x.param.loc28 // CHECK:STDOUT: } -// CHECK:STDOUT: %B.decl.loc25: %B.type = fn_decl @B [concrete = constants.%B] { +// CHECK:STDOUT: %B.decl.loc39: %B.type = fn_decl @B [concrete = constants.%B] { // CHECK:STDOUT: %x.param_patt: %pattern_type = value_param_pattern [concrete = constants.%x.param_patt] // CHECK:STDOUT: %x.patt: %pattern_type = wrapper_binding_pattern x, %x.param_patt [concrete = constants.%x.patt] // CHECK:STDOUT: } { -// CHECK:STDOUT: %x.param.loc25: %empty_tuple.type = value_param call_param0 -// CHECK:STDOUT: %.loc25_10.1: type = splice_block %.loc25_10.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc25_10.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc25_10.3: type = converted %.loc25_10.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %x.param.loc39: %empty_tuple.type = value_param call_param0 +// CHECK:STDOUT: %.loc39_10.1: type = splice_block %.loc39_10.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc39_10.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc39_10.3: type = converted %.loc39_10.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %x.loc25: %empty_tuple.type = wrapper_binding x, %x.param.loc25 +// CHECK:STDOUT: %x.loc39: %empty_tuple.type = wrapper_binding x, %x.param.loc39 // CHECK:STDOUT: } -// CHECK:STDOUT: %C.decl.loc27: %C.type.322e3b.1 = fn_decl @C.loc27 [concrete = constants.%C.010386.1] {} {} -// CHECK:STDOUT: %C.decl.loc31: %C.type.322e3b.2 = fn_decl @C.loc31 [concrete = constants.%C.010386.2] { +// CHECK:STDOUT: %C.decl.loc41: %C.type.322e3b.1 = fn_decl @C.loc41 [concrete = constants.%C.010386.1] {} {} +// CHECK:STDOUT: %C.decl.loc53: %C.type.322e3b.2 = fn_decl @C.loc53 [concrete = constants.%C.010386.2] { // CHECK:STDOUT: %x.param_patt: %pattern_type = value_param_pattern [concrete = constants.%x.param_patt] // CHECK:STDOUT: %x.patt: %pattern_type = wrapper_binding_pattern x, %x.param_patt [concrete = constants.%x.patt] // CHECK:STDOUT: } { // CHECK:STDOUT: %x.param: %empty_tuple.type = value_param call_param0 -// CHECK:STDOUT: %.loc31_10.1: type = splice_block %.loc31_10.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc31_10.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc31_10.3: type = converted %.loc31_10.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc53_10.1: type = splice_block %.loc53_10.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc53_10.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc53_10.3: type = converted %.loc53_10.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %x: %empty_tuple.type = wrapper_binding x, %x.param // CHECK:STDOUT: } -// CHECK:STDOUT: %D.decl.loc33: %D.type = fn_decl @D [concrete = constants.%D] {} {} -// CHECK:STDOUT: %D.decl.loc37: %D.type = fn_decl @D [concrete = constants.%D] {} {} -// CHECK:STDOUT: %E.decl.loc39: %E.type.53e05b.1 = fn_decl @E.loc39 [concrete = constants.%E.3f2512.1] {} {} -// CHECK:STDOUT: %E.decl.loc43: %E.type.53e05b.2 = fn_decl @E.loc43 [concrete = constants.%E.3f2512.2] {} {} +// CHECK:STDOUT: %D.decl.loc55: %D.type = fn_decl @D [concrete = constants.%D] {} {} +// CHECK:STDOUT: %D.decl.loc66: %D.type = fn_decl @D [concrete = constants.%D] {} {} +// CHECK:STDOUT: %E.decl.loc68: %E.type.53e05b.1 = fn_decl @E.loc68 [concrete = constants.%E.3f2512.1] {} {} +// CHECK:STDOUT: %E.decl.loc79: %E.type.53e05b.2 = fn_decl @E.loc79 [concrete = constants.%E.3f2512.2] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A(); // CHECK:STDOUT: -// CHECK:STDOUT: fn @B(%x.param.loc21: %empty_tuple.type); +// CHECK:STDOUT: fn @B(%x.param.loc28: %empty_tuple.type); // CHECK:STDOUT: -// CHECK:STDOUT: fn @C.loc27(); +// CHECK:STDOUT: fn @C.loc41(); // CHECK:STDOUT: -// CHECK:STDOUT: fn @C.loc31(%x.param: %empty_tuple.type); +// CHECK:STDOUT: fn @C.loc53(%x.param: %empty_tuple.type); // CHECK:STDOUT: // CHECK:STDOUT: fn @D() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @E.loc39() { +// CHECK:STDOUT: fn @E.loc68() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @E.loc43() { +// CHECK:STDOUT: fn @E.loc79() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/declaration/fail_todo_no_params.carbon b/toolchain/check/testdata/function/declaration/fail_todo_no_params.carbon index 433062c9ecc2..1d9f39bf051a 100644 --- a/toolchain/check/testdata/function/declaration/fail_todo_no_params.carbon +++ b/toolchain/check/testdata/function/declaration/fail_todo_no_params.carbon @@ -13,14 +13,24 @@ // --- fail_no_body.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_no_body.carbon:[[@LINE+2]]:1-5: error: semantics TODO: `function with positional parameters` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_no_body.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn A; +// CHECK:STDERR: · ━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `function with positional parameters` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn A; // --- fail_todo_brace_body.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_todo_brace_body.carbon:[[@LINE+2]]:1-6: error: semantics TODO: `function with positional parameters` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_todo_brace_body.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn A { +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `function with positional parameters` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn A { } @@ -28,21 +38,36 @@ fn A { // --- fail_todo_return_type.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_todo_return_type.carbon:[[@LINE+2]]:1-11: error: semantics TODO: `function with positional parameters` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_todo_return_type.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn A -> (); +// CHECK:STDERR: · ━━━━━┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `function with positional parameters` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn A -> (); // --- fail_todo_implicit_only.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_todo_implicit_only.carbon:[[@LINE+2]]:1-13: error: semantics TODO: `function with positional parameters` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_todo_implicit_only.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn A[] -> (); +// CHECK:STDERR: · ━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `function with positional parameters` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn A[] -> (); // --- fail_todo_arrow_body.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_todo_arrow_body.carbon:[[@LINE+2]]:1-7: error: semantics TODO: `function with positional parameters` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_todo_arrow_body.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn A => 0; +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `function with positional parameters` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn A => 0; @@ -50,9 +75,19 @@ fn A => 0; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_invalid_file_generic_regression_test.carbon:[[@LINE+4]]:13-17: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_invalid_file_generic_regression_test.carbon:[[@LINE+14]]:13 +// CHECK:STDERR: -> │ var generic x: () = (); +// CHECK:STDERR: · ━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `handle invalid parse trees in `check`` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_invalid_file_generic_regression_test.carbon:[[@LINE+2]]:19: error: found generic binding inside `var` pattern [NonRegularBindingInVarDecl] +// CHECK:STDERR: ╭─┤ fail_invalid_file_generic_regression_test.carbon:[[@LINE+7]]:19 +// CHECK:STDERR: -> │ var generic x: () = (); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: found generic binding inside `var` pattern +// CHECK:STDERR: · ┃ [NonRegularBindingInVarDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var generic x: () = (); diff --git a/toolchain/check/testdata/function/declaration/implicit_import.carbon b/toolchain/check/testdata/function/declaration/implicit_import.carbon index 26fc0e09e679..08146da25c84 100644 --- a/toolchain/check/testdata/function/declaration/implicit_import.carbon +++ b/toolchain/check/testdata/function/declaration/implicit_import.carbon @@ -34,10 +34,24 @@ extern fn A(); impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_extern_api.impl.carbon:[[@LINE+5]]:1-7: error: redeclarations of `fn A` must match use of `extern` [RedeclExternMismatch] -// CHECK:STDERR: extern_api.carbon:4:1-14: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_extern_api.impl.carbon:[[@LINE+19]]:1 +// CHECK:STDERR: -> │ fn A(); +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclarations of `fn A` must match use of `extern` +// CHECK:STDERR: · ┃ [RedeclExternMismatch] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ extern_api.carbon +// CHECK:STDERR: │ extern fn A(); +// CHECK:STDERR: · ───────┬────── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_extern_api.impl.carbon:[[@LINE+2]]:1-7: error: no definition found for declaration in impl file [MissingDefinitionInImpl] +// CHECK:STDERR: ╭─┤ fail_extern_api.impl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn A(); +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: no definition found for declaration in impl file +// CHECK:STDERR: · ┃ [MissingDefinitionInImpl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn A(); @@ -51,8 +65,17 @@ fn A(); impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_extern_impl.impl.carbon:[[@LINE+3]]:1-14: error: redeclarations of `fn A` must match use of `extern` [RedeclExternMismatch] -// CHECK:STDERR: extern_impl.carbon:4:1-7: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_extern_impl.impl.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: -> │ extern fn A(); +// CHECK:STDERR: · ━━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclarations of `fn A` must match use of `extern` +// CHECK:STDERR: · ┃ [RedeclExternMismatch] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ extern_impl.carbon +// CHECK:STDERR: │ fn A(); +// CHECK:STDERR: · ───┬─── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: extern fn A(); diff --git a/toolchain/check/testdata/function/declaration/import.carbon b/toolchain/check/testdata/function/declaration/import.carbon index 2ff86b9cd7cd..6b3a4c5c6b6c 100644 --- a/toolchain/check/testdata/function/declaration/import.carbon +++ b/toolchain/check/testdata/function/declaration/import.carbon @@ -62,24 +62,200 @@ library "[[@TEST_NAME]]"; import library "api"; -// CHECK:STDERR: fail_redecl_api.carbon:[[@LINE+3]]:1-14: error: redeclarations of `fn A` must match use of `extern` [RedeclExternMismatch] -// CHECK:STDERR: api.carbon:4:1-7: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_redecl_api.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: -> │ extern fn A(); +// CHECK:STDERR: · ━━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclarations of `fn A` must match use of `extern` +// CHECK:STDERR: · ┃ [RedeclExternMismatch] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ api.carbon +// CHECK:STDERR: │ fn A(); +// CHECK:STDERR: · ───┬─── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: extern fn A(); -// CHECK:STDERR: fail_redecl_api.carbon:[[@LINE+3]]:1-27: error: redeclarations of `fn B` must match use of `extern` [RedeclExternMismatch] -// CHECK:STDERR: api.carbon:5:1-20: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_redecl_api.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: -> │ extern fn B(b: i32) -> i32; +// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclarations of `fn B` must match use of `extern` +// CHECK:STDERR: · ┃ [RedeclExternMismatch] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ api.carbon +// CHECK:STDERR: │ fn B(b: i32) -> i32; +// CHECK:STDERR: · ──────────┬───────── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: extern fn B(b: i32) -> i32; -// CHECK:STDERR: fail_redecl_api.carbon:[[@LINE+3]]:1-36: error: redeclarations of `fn C` must match use of `extern` [RedeclExternMismatch] -// CHECK:STDERR: api.carbon:6:1-29: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_redecl_api.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: -> │ extern fn C(c: (i32,)) -> {.c: i32}; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclarations of `fn C` must match use of `extern` +// CHECK:STDERR: · ┃ [RedeclExternMismatch] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ api.carbon +// CHECK:STDERR: │ fn C(c: (i32,)) -> {.c: i32}; +// CHECK:STDERR: · ──────────────┬────────────── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: extern fn C(c: (i32,)) -> {.c: i32}; -// CHECK:STDERR: fail_redecl_api.carbon:[[@LINE+3]]:1-14: error: redeclaration of `fn D` is redundant [RedeclRedundant] -// CHECK:STDERR: api.carbon:7:1-14: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_redecl_api.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: -> │ extern fn D(); +// CHECK:STDERR: · ━━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of `fn D` is redundant [RedeclRedundant] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ api.carbon +// CHECK:STDERR: │ extern fn D(); +// CHECK:STDERR: · ───────┬────── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: extern fn D(); -// CHECK:STDERR: fail_redecl_api.carbon:[[@LINE+3]]:1-17: error: redeclarations of `fn E` must match use of `extern` [RedeclExternMismatch] -// CHECK:STDERR: api.carbon:10:1-10: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_redecl_api.carbon:[[@LINE+144]]:1 +// CHECK:STDERR: -> │ extern fn NS.E(); +// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclarations of `fn E` must match use of `extern` +// CHECK:STDERR: · ┃ [RedeclExternMismatch] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ api.carbon +// CHECK:STDERR: │ fn NS.E(); +// CHECK:STDERR: · ─────┬──── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: +// CHECK:STDERR: ╷ ╭── imported from: fail_merge.carbon [InImport] +// CHECK:STDERR: ├─┤ extern_api.carbon:4:1 +// CHECK:STDERR: -> │ extern library "redecl_extern_api" fn A(); +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `A` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ api.carbon +// CHECK:STDERR: │ fn A(); +// CHECK:STDERR: · ───┬─── +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: +// CHECK:STDERR: ╷ ╭── imported from: fail_merge.carbon [InImport] +// CHECK:STDERR: ├─┤ extern_api.carbon:5:1 +// CHECK:STDERR: -> │ extern library "redecl_extern_api" fn B(b: i32) -> i32; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `B` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ api.carbon +// CHECK:STDERR: │ fn B(b: i32) -> i32; +// CHECK:STDERR: · ──────────┬───────── +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: +// CHECK:STDERR: ╷ ╭── imported from: fail_merge.carbon [InImport] +// CHECK:STDERR: ├─┤ extern_api.carbon:6:1 +// CHECK:STDERR: -> │ extern library "redecl_extern_api" fn C(c: (i32,)) -> {.c: i32}; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `C` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ api.carbon +// CHECK:STDERR: │ fn C(c: (i32,)) -> {.c: i32}; +// CHECK:STDERR: · ──────────────┬────────────── +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: +// CHECK:STDERR: ╷ ╭── imported from: fail_merge.carbon [InImport] +// CHECK:STDERR: ├─┤ extern_api.carbon:7:1 +// CHECK:STDERR: -> │ extern library "redecl_extern_api" fn D(); +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `D` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ api.carbon +// CHECK:STDERR: │ extern fn D(); +// CHECK:STDERR: · ───────┬────── +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: +// CHECK:STDERR: ╷ ╭── imported from: fail_merge.carbon [InImport] +// CHECK:STDERR: ├─┤ extern_api.carbon:10:1 +// CHECK:STDERR: -> │ extern library "redecl_extern_api" fn NS.E(); +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `E` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ api.carbon +// CHECK:STDERR: │ fn NS.E(); +// CHECK:STDERR: · ─────┬──── +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: +// CHECK:STDERR: ╷ ╭── imported from: fail_merge_reverse.carbon [InImport] +// CHECK:STDERR: ├─┤ api.carbon:4:1 +// CHECK:STDERR: -> │ fn A(); +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `A` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ extern_api.carbon +// CHECK:STDERR: │ extern library "redecl_extern_api" fn A(); +// CHECK:STDERR: · ─────────────────────┬──────────────────── +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: +// CHECK:STDERR: ╷ ╭── imported from: fail_merge_reverse.carbon [InImport] +// CHECK:STDERR: ├─┤ api.carbon:5:1 +// CHECK:STDERR: -> │ fn B(b: i32) -> i32; +// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `B` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ extern_api.carbon +// CHECK:STDERR: │ extern library "redecl_extern_api" fn B(b: i32) -> i32; +// CHECK:STDERR: · ───────────────────────────┬─────────────────────────── +// CHECK:STDERR: · ╰──┤ name is previously declared here +// CHECK:STDERR: · │ [NameDeclPrevious] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: +// CHECK:STDERR: ╷ ╭── imported from: fail_merge_reverse.carbon [InImport] +// CHECK:STDERR: ├─┤ api.carbon:6:1 +// CHECK:STDERR: -> │ fn C(c: (i32,)) -> {.c: i32}; +// CHECK:STDERR: · ━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `C` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ extern_api.carbon +// CHECK:STDERR: │ extern library "redecl_extern_api" fn C(c: (i32,)) -> {.c: i32}; +// CHECK:STDERR: · ────────────────────────────────┬─────────────────────────────── +// CHECK:STDERR: · ╰──┤ name is previously declared here +// CHECK:STDERR: · │ [NameDeclPrevious] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: +// CHECK:STDERR: ╷ ╭── imported from: fail_merge_reverse.carbon [InImport] +// CHECK:STDERR: ├─┤ api.carbon:7:1 +// CHECK:STDERR: -> │ extern fn D(); +// CHECK:STDERR: · ━━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `D` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ extern_api.carbon +// CHECK:STDERR: │ extern library "redecl_extern_api" fn D(); +// CHECK:STDERR: · ─────────────────────┬──────────────────── +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: +// CHECK:STDERR: ╷ ╭── imported from: fail_merge_reverse.carbon [InImport] +// CHECK:STDERR: ├─┤ api.carbon:10:1 +// CHECK:STDERR: -> │ fn NS.E(); +// CHECK:STDERR: · ━━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `E` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ extern_api.carbon +// CHECK:STDERR: │ extern library "redecl_extern_api" fn NS.E(); +// CHECK:STDERR: · ──────────────────────┬────────────────────── +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: extern fn NS.E(); @@ -111,26 +287,6 @@ var e: () = NS.E(); library "[[@TEST_NAME]]"; -// CHECK:STDERR: imported from: fail_merge.carbon:[[@LINE+20]]:1 [InImport] -// CHECK:STDERR: extern_api.carbon:4:1-42: error: duplicate name `A` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: api.carbon:4:1-7: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: -// CHECK:STDERR: imported from: fail_merge.carbon:[[@LINE+16]]:1 [InImport] -// CHECK:STDERR: extern_api.carbon:5:1-55: error: duplicate name `B` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: api.carbon:5:1-20: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: -// CHECK:STDERR: imported from: fail_merge.carbon:[[@LINE+12]]:1 [InImport] -// CHECK:STDERR: extern_api.carbon:6:1-64: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: api.carbon:6:1-29: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: -// CHECK:STDERR: imported from: fail_merge.carbon:[[@LINE+8]]:1 [InImport] -// CHECK:STDERR: extern_api.carbon:7:1-42: error: duplicate name `D` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: api.carbon:7:1-14: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: -// CHECK:STDERR: imported from: fail_merge.carbon:[[@LINE+4]]:1 [InImport] -// CHECK:STDERR: extern_api.carbon:10:1-45: error: duplicate name `E` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: api.carbon:10:1-10: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: import library "api"; import library "extern_api"; @@ -144,26 +300,6 @@ var e: () = NS.E(); library "[[@TEST_NAME]]"; -// CHECK:STDERR: imported from: fail_merge_reverse.carbon:[[@LINE+20]]:1 [InImport] -// CHECK:STDERR: api.carbon:4:1-7: error: duplicate name `A` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: extern_api.carbon:4:1-42: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: -// CHECK:STDERR: imported from: fail_merge_reverse.carbon:[[@LINE+16]]:1 [InImport] -// CHECK:STDERR: api.carbon:5:1-20: error: duplicate name `B` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: extern_api.carbon:5:1-55: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: -// CHECK:STDERR: imported from: fail_merge_reverse.carbon:[[@LINE+12]]:1 [InImport] -// CHECK:STDERR: api.carbon:6:1-29: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: extern_api.carbon:6:1-64: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: -// CHECK:STDERR: imported from: fail_merge_reverse.carbon:[[@LINE+8]]:1 [InImport] -// CHECK:STDERR: api.carbon:7:1-14: error: duplicate name `D` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: extern_api.carbon:7:1-42: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: -// CHECK:STDERR: imported from: fail_merge_reverse.carbon:[[@LINE+4]]:1 [InImport] -// CHECK:STDERR: api.carbon:10:1-10: error: duplicate name `E` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: extern_api.carbon:10:1-45: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: import library "extern_api"; import library "api"; @@ -689,23 +825,23 @@ import library "extern_api"; // CHECK:STDOUT: %default.import = import // CHECK:STDOUT: %A.decl: %A.type = fn_decl @A [concrete = constants.%A] {} {} // CHECK:STDOUT: %B.decl: %B.type = fn_decl @B [concrete = constants.%B] {} { -// CHECK:STDOUT: %i32.loc13_24: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %.loc13: Core.Form = init_form %i32.loc13_24 [concrete = constants.%.0b3] +// CHECK:STDOUT: %i32.loc31_24: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc31: Core.Form = init_form %i32.loc31_24 [concrete = constants.%.0b3] // CHECK:STDOUT: %b.param: %i32 = value_param call_param0 -// CHECK:STDOUT: %i32.loc13_16: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc31_16: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %b: %i32 = wrapper_binding b, %b.param // CHECK:STDOUT: %return.param: ref %i32 = out_param call_param1 // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: %C.decl: %C.type = fn_decl @C [concrete = constants.%C] {} { -// CHECK:STDOUT: %i32.loc17_32: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc44_32: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.c: type = struct_type {.c: %i32} [concrete = constants.%struct_type.c] -// CHECK:STDOUT: %.loc17_35: Core.Form = init_form %struct_type.c [concrete = constants.%.fc2] +// CHECK:STDOUT: %.loc44_35: Core.Form = init_form %struct_type.c [concrete = constants.%.fc2] // CHECK:STDOUT: %c.param: %tuple.type.294 = value_param call_param0 -// CHECK:STDOUT: %.loc17_21.1: type = splice_block %.loc17_21.3 [concrete = constants.%tuple.type.294] { -// CHECK:STDOUT: %i32.loc17_17: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %.loc17_21.2: %tuple.type.135 = tuple_literal (%i32.loc17_17) [concrete = constants.%tuple.f7a] -// CHECK:STDOUT: %.loc17_21.3: type = converted %.loc17_21.2, constants.%tuple.type.294 [concrete = constants.%tuple.type.294] +// CHECK:STDOUT: %.loc44_21.1: type = splice_block %.loc44_21.3 [concrete = constants.%tuple.type.294] { +// CHECK:STDOUT: %i32.loc44_17: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc44_21.2: %tuple.type.135 = tuple_literal (%i32.loc44_17) [concrete = constants.%tuple.f7a] +// CHECK:STDOUT: %.loc44_21.3: type = converted %.loc44_21.2, constants.%tuple.type.294 [concrete = constants.%tuple.type.294] // CHECK:STDOUT: } // CHECK:STDOUT: %c: %tuple.type.294 = wrapper_binding c, %c.param // CHECK:STDOUT: %return.param: ref %struct_type.c = out_param call_param1 @@ -714,9 +850,9 @@ import library "extern_api"; // CHECK:STDOUT: %D.decl: %D.type = fn_decl @D [concrete = constants.%D] {} {} // CHECK:STDOUT: %E.decl: %E.type = fn_decl @E [concrete = constants.%E] {} {} // CHECK:STDOUT: %a.var: ref %empty_tuple.type = var_storage %a.var_patt [concrete] -// CHECK:STDOUT: %.loc27_9.1: type = splice_block %.loc27_9.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc27_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc27_9.3: type = converted %.loc27_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc203_9.1: type = splice_block %.loc203_9.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc203_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc203_9.3: type = converted %.loc203_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %a: ref %empty_tuple.type = wrapper_binding a, %a.var [concrete = %a.var] // CHECK:STDOUT: name_binding_decl { @@ -724,15 +860,15 @@ import library "extern_api"; // CHECK:STDOUT: %a.var_patt: %pattern_type.cb1 = var_pattern %a.patt [concrete = constants.%a.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %b.var: ref %i32 = var_storage %b.var_patt [concrete] -// CHECK:STDOUT: %i32.loc28: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc204: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %b: ref %i32 = wrapper_binding b, %b.var [concrete = %b.var] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %b.patt: %pattern_type.d94 = ref_binding_pattern b [concrete = constants.%b.patt.920] // CHECK:STDOUT: %b.var_patt: %pattern_type.d94 = var_pattern %b.patt [concrete = constants.%b.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %c.var: ref %struct_type.c = var_storage %c.var_patt [concrete] -// CHECK:STDOUT: %.loc29: type = splice_block %struct_type.c [concrete = constants.%struct_type.c] { -// CHECK:STDOUT: %i32.loc29: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc205: type = splice_block %struct_type.c [concrete = constants.%struct_type.c] { +// CHECK:STDOUT: %i32.loc205: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.c: type = struct_type {.c: %i32} [concrete = constants.%struct_type.c] // CHECK:STDOUT: } // CHECK:STDOUT: %c: ref %struct_type.c = wrapper_binding c, %c.var [concrete = %c.var] @@ -741,9 +877,9 @@ import library "extern_api"; // CHECK:STDOUT: %c.var_patt: %pattern_type.51a = var_pattern %c.patt [concrete = constants.%c.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %d.var: ref %empty_tuple.type = var_storage %d.var_patt [concrete] -// CHECK:STDOUT: %.loc30_9.1: type = splice_block %.loc30_9.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc30_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc30_9.3: type = converted %.loc30_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc206_9.1: type = splice_block %.loc206_9.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc206_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc206_9.3: type = converted %.loc206_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %d: ref %empty_tuple.type = wrapper_binding d, %d.var [concrete = %d.var] // CHECK:STDOUT: name_binding_decl { @@ -751,9 +887,9 @@ import library "extern_api"; // CHECK:STDOUT: %d.var_patt: %pattern_type.cb1 = var_pattern %d.patt [concrete = constants.%d.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %e.var: ref %empty_tuple.type = var_storage %e.var_patt [concrete] -// CHECK:STDOUT: %.loc31_9.1: type = splice_block %.loc31_9.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc31_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc31_9.3: type = converted %.loc31_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc207_9.1: type = splice_block %.loc207_9.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc207_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc207_9.3: type = converted %.loc207_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %e: ref %empty_tuple.type = wrapper_binding e, %e.var [concrete = %e.var] // CHECK:STDOUT: name_binding_decl { @@ -778,29 +914,29 @@ import library "extern_api"; // CHECK:STDOUT: %A.call: init %empty_tuple.type = call %A.ref() // CHECK:STDOUT: assign file.%a.var, %A.call // CHECK:STDOUT: %B.ref: %B.type = name_ref B, file.%B.decl [concrete = constants.%B] -// CHECK:STDOUT: %int_1.loc28: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %impl.elem0.loc28: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc28_16.1: = bound_method %int_1.loc28, %impl.elem0.loc28 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] -// CHECK:STDOUT: %specific_fn.loc28: = specific_function %impl.elem0.loc28, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc28_16.2: = bound_method %int_1.loc28, %specific_fn.loc28 [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc28: init %i32 = call %bound_method.loc28_16.2(%int_1.loc28) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc28_16.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc28 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc28_16.2: %i32 = converted %int_1.loc28, %.loc28_16.1 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %B.call: init %i32 = call %B.ref(%.loc28_16.2) +// CHECK:STDOUT: %int_1.loc204: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %impl.elem0.loc204: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc204_16.1: = bound_method %int_1.loc204, %impl.elem0.loc204 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %specific_fn.loc204: = specific_function %impl.elem0.loc204, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc204_16.2: = bound_method %int_1.loc204, %specific_fn.loc204 [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc204: init %i32 = call %bound_method.loc204_16.2(%int_1.loc204) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc204_16.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc204 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc204_16.2: %i32 = converted %int_1.loc204, %.loc204_16.1 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %B.call: init %i32 = call %B.ref(%.loc204_16.2) // CHECK:STDOUT: assign file.%b.var, %B.call // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %int_1.loc29: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %.loc29_25.1: %tuple.type.985 = tuple_literal (%int_1.loc29) [concrete = constants.%tuple.378] -// CHECK:STDOUT: %impl.elem0.loc29: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc29_25.1: = bound_method %int_1.loc29, %impl.elem0.loc29 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] -// CHECK:STDOUT: %specific_fn.loc29: = specific_function %impl.elem0.loc29, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc29_25.2: = bound_method %int_1.loc29, %specific_fn.loc29 [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc29: init %i32 = call %bound_method.loc29_25.2(%int_1.loc29) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc29_25.2: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc29 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc29_25.3: %i32 = converted %int_1.loc29, %.loc29_25.2 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %tuple: %tuple.type.294 = tuple_value (%.loc29_25.3) [concrete = constants.%tuple.f6b] -// CHECK:STDOUT: %.loc29_25.4: %tuple.type.294 = converted %.loc29_25.1, %tuple [concrete = constants.%tuple.f6b] -// CHECK:STDOUT: %C.call: init %struct_type.c = call %C.ref(%.loc29_25.4) +// CHECK:STDOUT: %int_1.loc205: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %.loc205_25.1: %tuple.type.985 = tuple_literal (%int_1.loc205) [concrete = constants.%tuple.378] +// CHECK:STDOUT: %impl.elem0.loc205: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc205_25.1: = bound_method %int_1.loc205, %impl.elem0.loc205 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %specific_fn.loc205: = specific_function %impl.elem0.loc205, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc205_25.2: = bound_method %int_1.loc205, %specific_fn.loc205 [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc205: init %i32 = call %bound_method.loc205_25.2(%int_1.loc205) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc205_25.2: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc205 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc205_25.3: %i32 = converted %int_1.loc205, %.loc205_25.2 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %tuple: %tuple.type.294 = tuple_value (%.loc205_25.3) [concrete = constants.%tuple.f6b] +// CHECK:STDOUT: %.loc205_25.4: %tuple.type.294 = converted %.loc205_25.1, %tuple [concrete = constants.%tuple.f6b] +// CHECK:STDOUT: %C.call: init %struct_type.c = call %C.ref(%.loc205_25.4) // CHECK:STDOUT: assign file.%c.var, %C.call // CHECK:STDOUT: %D.ref: %D.type = name_ref D, file.%D.decl [concrete = constants.%D] // CHECK:STDOUT: %D.call: init %empty_tuple.type = call %D.ref() @@ -1127,9 +1263,9 @@ import library "extern_api"; // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %default.import = import // CHECK:STDOUT: %a.var: ref %empty_tuple.type = var_storage %a.var_patt [concrete] -// CHECK:STDOUT: %.loc27_9.1: type = splice_block %.loc27_9.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc27_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc27_9.3: type = converted %.loc27_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc7_9.1: type = splice_block %.loc7_9.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc7_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc7_9.3: type = converted %.loc7_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %a: ref %empty_tuple.type = wrapper_binding a, %a.var [concrete = %a.var] // CHECK:STDOUT: name_binding_decl { @@ -1137,15 +1273,15 @@ import library "extern_api"; // CHECK:STDOUT: %a.var_patt: %pattern_type.cb1 = var_pattern %a.patt [concrete = constants.%a.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %b.var: ref %i32 = var_storage %b.var_patt [concrete] -// CHECK:STDOUT: %i32.loc28: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc8: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %b: ref %i32 = wrapper_binding b, %b.var [concrete = %b.var] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %b.patt: %pattern_type.d94 = ref_binding_pattern b [concrete = constants.%b.patt.920] // CHECK:STDOUT: %b.var_patt: %pattern_type.d94 = var_pattern %b.patt [concrete = constants.%b.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %c.var: ref %struct_type.c = var_storage %c.var_patt [concrete] -// CHECK:STDOUT: %.loc29: type = splice_block %struct_type.c [concrete = constants.%struct_type.c] { -// CHECK:STDOUT: %i32.loc29: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc9: type = splice_block %struct_type.c [concrete = constants.%struct_type.c] { +// CHECK:STDOUT: %i32.loc9: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.c: type = struct_type {.c: %i32} [concrete = constants.%struct_type.c] // CHECK:STDOUT: } // CHECK:STDOUT: %c: ref %struct_type.c = wrapper_binding c, %c.var [concrete = %c.var] @@ -1154,9 +1290,9 @@ import library "extern_api"; // CHECK:STDOUT: %c.var_patt: %pattern_type.51a = var_pattern %c.patt [concrete = constants.%c.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %d.var: ref %empty_tuple.type = var_storage %d.var_patt [concrete] -// CHECK:STDOUT: %.loc30_9.1: type = splice_block %.loc30_9.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc30_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc30_9.3: type = converted %.loc30_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc10_9.1: type = splice_block %.loc10_9.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc10_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc10_9.3: type = converted %.loc10_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %d: ref %empty_tuple.type = wrapper_binding d, %d.var [concrete = %d.var] // CHECK:STDOUT: name_binding_decl { @@ -1164,9 +1300,9 @@ import library "extern_api"; // CHECK:STDOUT: %d.var_patt: %pattern_type.cb1 = var_pattern %d.patt [concrete = constants.%d.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %e.var: ref %empty_tuple.type = var_storage %e.var_patt [concrete] -// CHECK:STDOUT: %.loc31_9.1: type = splice_block %.loc31_9.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc31_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc31_9.3: type = converted %.loc31_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc11_9.1: type = splice_block %.loc11_9.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc11_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc11_9.3: type = converted %.loc11_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %e: ref %empty_tuple.type = wrapper_binding e, %e.var [concrete = %e.var] // CHECK:STDOUT: name_binding_decl { @@ -1191,29 +1327,29 @@ import library "extern_api"; // CHECK:STDOUT: %A.call: init %empty_tuple.type = call %A.ref() // CHECK:STDOUT: assign file.%a.var, %A.call // CHECK:STDOUT: %B.ref: %B.type = name_ref B, imports.%Main.B [concrete = constants.%B] -// CHECK:STDOUT: %int_1.loc28: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %impl.elem0.loc28: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc28_16.1: = bound_method %int_1.loc28, %impl.elem0.loc28 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] -// CHECK:STDOUT: %specific_fn.loc28: = specific_function %impl.elem0.loc28, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc28_16.2: = bound_method %int_1.loc28, %specific_fn.loc28 [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc28: init %i32 = call %bound_method.loc28_16.2(%int_1.loc28) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc28_16.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc28 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc28_16.2: %i32 = converted %int_1.loc28, %.loc28_16.1 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %B.call: init %i32 = call %B.ref(%.loc28_16.2) +// CHECK:STDOUT: %int_1.loc8: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %impl.elem0.loc8: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc8_16.1: = bound_method %int_1.loc8, %impl.elem0.loc8 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %specific_fn.loc8: = specific_function %impl.elem0.loc8, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc8_16.2: = bound_method %int_1.loc8, %specific_fn.loc8 [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc8: init %i32 = call %bound_method.loc8_16.2(%int_1.loc8) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc8_16.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc8 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc8_16.2: %i32 = converted %int_1.loc8, %.loc8_16.1 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %B.call: init %i32 = call %B.ref(%.loc8_16.2) // CHECK:STDOUT: assign file.%b.var, %B.call // CHECK:STDOUT: %C.ref: %C.type = name_ref C, imports.%Main.C [concrete = constants.%C] -// CHECK:STDOUT: %int_1.loc29: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %.loc29_25.1: %tuple.type.985 = tuple_literal (%int_1.loc29) [concrete = constants.%tuple.378] -// CHECK:STDOUT: %impl.elem0.loc29: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc29_25.1: = bound_method %int_1.loc29, %impl.elem0.loc29 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] -// CHECK:STDOUT: %specific_fn.loc29: = specific_function %impl.elem0.loc29, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc29_25.2: = bound_method %int_1.loc29, %specific_fn.loc29 [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc29: init %i32 = call %bound_method.loc29_25.2(%int_1.loc29) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc29_25.2: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc29 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc29_25.3: %i32 = converted %int_1.loc29, %.loc29_25.2 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %tuple: %tuple.type.294 = tuple_value (%.loc29_25.3) [concrete = constants.%tuple.f6b] -// CHECK:STDOUT: %.loc29_25.4: %tuple.type.294 = converted %.loc29_25.1, %tuple [concrete = constants.%tuple.f6b] -// CHECK:STDOUT: %C.call: init %struct_type.c = call %C.ref(%.loc29_25.4) +// CHECK:STDOUT: %int_1.loc9: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %.loc9_25.1: %tuple.type.985 = tuple_literal (%int_1.loc9) [concrete = constants.%tuple.378] +// CHECK:STDOUT: %impl.elem0.loc9: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc9_25.1: = bound_method %int_1.loc9, %impl.elem0.loc9 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %specific_fn.loc9: = specific_function %impl.elem0.loc9, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc9_25.2: = bound_method %int_1.loc9, %specific_fn.loc9 [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc9: init %i32 = call %bound_method.loc9_25.2(%int_1.loc9) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc9_25.2: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc9 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc9_25.3: %i32 = converted %int_1.loc9, %.loc9_25.2 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %tuple: %tuple.type.294 = tuple_value (%.loc9_25.3) [concrete = constants.%tuple.f6b] +// CHECK:STDOUT: %.loc9_25.4: %tuple.type.294 = converted %.loc9_25.1, %tuple [concrete = constants.%tuple.f6b] +// CHECK:STDOUT: %C.call: init %struct_type.c = call %C.ref(%.loc9_25.4) // CHECK:STDOUT: assign file.%c.var, %C.call // CHECK:STDOUT: %D.ref: %D.type = name_ref D, imports.%Main.D [concrete = constants.%D] // CHECK:STDOUT: %D.call: init %empty_tuple.type = call %D.ref() @@ -1321,9 +1457,9 @@ import library "extern_api"; // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %default.import = import // CHECK:STDOUT: %a.var: ref %empty_tuple.type = var_storage %a.var_patt [concrete] -// CHECK:STDOUT: %.loc27_9.1: type = splice_block %.loc27_9.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc27_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc27_9.3: type = converted %.loc27_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc7_9.1: type = splice_block %.loc7_9.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc7_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc7_9.3: type = converted %.loc7_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %a: ref %empty_tuple.type = wrapper_binding a, %a.var [concrete = %a.var] // CHECK:STDOUT: name_binding_decl { @@ -1331,15 +1467,15 @@ import library "extern_api"; // CHECK:STDOUT: %a.var_patt: %pattern_type.cb1 = var_pattern %a.patt [concrete = constants.%a.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %b.var: ref %i32 = var_storage %b.var_patt [concrete] -// CHECK:STDOUT: %i32.loc28: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc8: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %b: ref %i32 = wrapper_binding b, %b.var [concrete = %b.var] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %b.patt: %pattern_type.d94 = ref_binding_pattern b [concrete = constants.%b.patt.920] // CHECK:STDOUT: %b.var_patt: %pattern_type.d94 = var_pattern %b.patt [concrete = constants.%b.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %c.var: ref %struct_type.c = var_storage %c.var_patt [concrete] -// CHECK:STDOUT: %.loc29: type = splice_block %struct_type.c [concrete = constants.%struct_type.c] { -// CHECK:STDOUT: %i32.loc29: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc9: type = splice_block %struct_type.c [concrete = constants.%struct_type.c] { +// CHECK:STDOUT: %i32.loc9: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.c: type = struct_type {.c: %i32} [concrete = constants.%struct_type.c] // CHECK:STDOUT: } // CHECK:STDOUT: %c: ref %struct_type.c = wrapper_binding c, %c.var [concrete = %c.var] @@ -1348,9 +1484,9 @@ import library "extern_api"; // CHECK:STDOUT: %c.var_patt: %pattern_type.51a = var_pattern %c.patt [concrete = constants.%c.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %d.var: ref %empty_tuple.type = var_storage %d.var_patt [concrete] -// CHECK:STDOUT: %.loc30_9.1: type = splice_block %.loc30_9.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc30_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc30_9.3: type = converted %.loc30_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc10_9.1: type = splice_block %.loc10_9.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc10_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc10_9.3: type = converted %.loc10_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %d: ref %empty_tuple.type = wrapper_binding d, %d.var [concrete = %d.var] // CHECK:STDOUT: name_binding_decl { @@ -1358,9 +1494,9 @@ import library "extern_api"; // CHECK:STDOUT: %d.var_patt: %pattern_type.cb1 = var_pattern %d.patt [concrete = constants.%d.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %e.var: ref %empty_tuple.type = var_storage %e.var_patt [concrete] -// CHECK:STDOUT: %.loc31_9.1: type = splice_block %.loc31_9.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc31_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc31_9.3: type = converted %.loc31_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc11_9.1: type = splice_block %.loc11_9.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc11_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc11_9.3: type = converted %.loc11_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %e: ref %empty_tuple.type = wrapper_binding e, %e.var [concrete = %e.var] // CHECK:STDOUT: name_binding_decl { @@ -1385,29 +1521,29 @@ import library "extern_api"; // CHECK:STDOUT: %A.call: init %empty_tuple.type = call %A.ref() // CHECK:STDOUT: assign file.%a.var, %A.call // CHECK:STDOUT: %B.ref: %B.type = name_ref B, imports.%Main.B [concrete = constants.%B] -// CHECK:STDOUT: %int_1.loc28: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %impl.elem0.loc28: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc28_16.1: = bound_method %int_1.loc28, %impl.elem0.loc28 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] -// CHECK:STDOUT: %specific_fn.loc28: = specific_function %impl.elem0.loc28, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc28_16.2: = bound_method %int_1.loc28, %specific_fn.loc28 [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc28: init %i32 = call %bound_method.loc28_16.2(%int_1.loc28) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc28_16.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc28 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc28_16.2: %i32 = converted %int_1.loc28, %.loc28_16.1 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %B.call: init %i32 = call %B.ref(%.loc28_16.2) +// CHECK:STDOUT: %int_1.loc8: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %impl.elem0.loc8: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc8_16.1: = bound_method %int_1.loc8, %impl.elem0.loc8 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %specific_fn.loc8: = specific_function %impl.elem0.loc8, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc8_16.2: = bound_method %int_1.loc8, %specific_fn.loc8 [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc8: init %i32 = call %bound_method.loc8_16.2(%int_1.loc8) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc8_16.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc8 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc8_16.2: %i32 = converted %int_1.loc8, %.loc8_16.1 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %B.call: init %i32 = call %B.ref(%.loc8_16.2) // CHECK:STDOUT: assign file.%b.var, %B.call // CHECK:STDOUT: %C.ref: %C.type = name_ref C, imports.%Main.C [concrete = constants.%C] -// CHECK:STDOUT: %int_1.loc29: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %.loc29_25.1: %tuple.type.985 = tuple_literal (%int_1.loc29) [concrete = constants.%tuple.378] -// CHECK:STDOUT: %impl.elem0.loc29: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc29_25.1: = bound_method %int_1.loc29, %impl.elem0.loc29 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] -// CHECK:STDOUT: %specific_fn.loc29: = specific_function %impl.elem0.loc29, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc29_25.2: = bound_method %int_1.loc29, %specific_fn.loc29 [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc29: init %i32 = call %bound_method.loc29_25.2(%int_1.loc29) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc29_25.2: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc29 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc29_25.3: %i32 = converted %int_1.loc29, %.loc29_25.2 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %tuple: %tuple.type.294 = tuple_value (%.loc29_25.3) [concrete = constants.%tuple.f6b] -// CHECK:STDOUT: %.loc29_25.4: %tuple.type.294 = converted %.loc29_25.1, %tuple [concrete = constants.%tuple.f6b] -// CHECK:STDOUT: %C.call: init %struct_type.c = call %C.ref(%.loc29_25.4) +// CHECK:STDOUT: %int_1.loc9: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %.loc9_25.1: %tuple.type.985 = tuple_literal (%int_1.loc9) [concrete = constants.%tuple.378] +// CHECK:STDOUT: %impl.elem0.loc9: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc9_25.1: = bound_method %int_1.loc9, %impl.elem0.loc9 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %specific_fn.loc9: = specific_function %impl.elem0.loc9, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc9_25.2: = bound_method %int_1.loc9, %specific_fn.loc9 [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc9: init %i32 = call %bound_method.loc9_25.2(%int_1.loc9) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc9_25.2: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc9 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc9_25.3: %i32 = converted %int_1.loc9, %.loc9_25.2 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %tuple: %tuple.type.294 = tuple_value (%.loc9_25.3) [concrete = constants.%tuple.f6b] +// CHECK:STDOUT: %.loc9_25.4: %tuple.type.294 = converted %.loc9_25.1, %tuple [concrete = constants.%tuple.f6b] +// CHECK:STDOUT: %C.call: init %struct_type.c = call %C.ref(%.loc9_25.4) // CHECK:STDOUT: assign file.%c.var, %C.call // CHECK:STDOUT: %D.ref: %D.type = name_ref D, imports.%Main.D [concrete = constants.%D] // CHECK:STDOUT: %D.call: init %empty_tuple.type = call %D.ref() diff --git a/toolchain/check/testdata/function/declaration/name_poisoning.carbon b/toolchain/check/testdata/function/declaration/name_poisoning.carbon index e2cf3f448814..496ca01064f5 100644 --- a/toolchain/check/testdata/function/declaration/name_poisoning.carbon +++ b/toolchain/check/testdata/function/declaration/name_poisoning.carbon @@ -47,12 +47,20 @@ fn F1(); namespace N; // Use `package.F1` and poison `N.F1`. -// CHECK:STDERR: fail_declare_after_poison.carbon:[[@LINE+1]]:14-15: error: name `F1` used before it was declared [NameUseBeforeDecl] +// CHECK:STDERR: ╭─┤ fail_declare_after_poison.carbon:[[@LINE+11]]:14 +// CHECK:STDERR: -> │ alias N.F2 = F1; +// CHECK:STDERR: · ━┳ +// CHECK:STDERR: · ┗━━┫ error: name `F1` used before it was declared +// CHECK:STDERR: · ┃ [NameUseBeforeDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: │ fn N.F1(); +// CHECK:STDERR: · ─┬ +// CHECK:STDERR: · ╰──┤ declared here [NameUseBeforeDeclNote] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: alias N.F2 = F1; // Failure: `N.F1` declared after it was poisoned. -// CHECK:STDERR: fail_declare_after_poison.carbon:[[@LINE+2]]:6-7: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: fn N.F1(); // --- fail_use_poison.carbon @@ -65,7 +73,12 @@ fn F1(); namespace N; alias N.F2 = F1; -// CHECK:STDERR: fail_use_poison.carbon:[[@LINE+2]]:14-17: error: member name `F1` not found in `N` [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╭─┤ fail_use_poison.carbon:[[@LINE+7]]:14 +// CHECK:STDERR: -> │ alias N.F3 = N.F1; +// CHECK:STDERR: · ━━┳━ +// CHECK:STDERR: · ┗━━┫ error: member name `F1` not found in `N` +// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╰──── // CHECK:STDERR: alias N.F3 = N.F1; @@ -77,12 +90,20 @@ fn F1(); namespace N; // Use `package.F1` and poison `N.F1`. -// CHECK:STDERR: fail_use_declaration_after_poison.carbon:[[@LINE+1]]:14-15: error: name `F1` used before it was declared [NameUseBeforeDecl] +// CHECK:STDERR: ╭─┤ fail_use_declaration_after_poison.carbon:[[@LINE+11]]:14 +// CHECK:STDERR: -> │ alias N.F2 = F1; +// CHECK:STDERR: · ━┳ +// CHECK:STDERR: · ┗━━┫ error: name `F1` used before it was declared +// CHECK:STDERR: · ┃ [NameUseBeforeDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: │ fn N.F1(); +// CHECK:STDERR: · ─┬ +// CHECK:STDERR: · ╰──┤ declared here [NameUseBeforeDeclNote] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: alias N.F2 = F1; // Failure: `N.F1` declared after it was poisoned. -// CHECK:STDERR: fail_use_declaration_after_poison.carbon:[[@LINE+2]]:6-7: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: fn N.F1(); // Don't produce an additional diagnostic here. @@ -101,19 +122,43 @@ namespace N1.N2.N3; // * `N1.F1` // * `N1.N2.F1` // * `N1.N2.N3.F1` -// CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+1]]:21-22: error: name `F1` used before it was declared [NameUseBeforeDecl] +// CHECK:STDERR: ╭─┤ fail_poison_multiple_scopes.carbon:[[@LINE+33]]:21 +// CHECK:STDERR: -> │ alias N1.N2.N3.F2 = F1; +// CHECK:STDERR: · ━┳ +// CHECK:STDERR: · ┗━━┫ error: name `F1` used before it was declared +// CHECK:STDERR: · ┃ [NameUseBeforeDecl] +// CHECK:STDERR: │ +// CHECK:STDERR: │ fn N1.F1(); +// CHECK:STDERR: · ─┬ +// CHECK:STDERR: · ╰──┤ declared here [NameUseBeforeDeclNote] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: +// CHECK:STDERR: ╭─┤ fail_poison_multiple_scopes.carbon:[[@LINE+22]]:21 +// CHECK:STDERR: -> │ alias N1.N2.N3.F2 = F1; +// CHECK:STDERR: · ━┳ +// CHECK:STDERR: · ┗━━┫ error: name `F1` used before it was declared +// CHECK:STDERR: · ┃ [NameUseBeforeDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: │ fn N1.N2.F1(); +// CHECK:STDERR: · ─┬ +// CHECK:STDERR: · ╰──┤ declared here [NameUseBeforeDeclNote] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: +// CHECK:STDERR: ╭─┤ fail_poison_multiple_scopes.carbon:[[@LINE+11]]:21 +// CHECK:STDERR: -> │ alias N1.N2.N3.F2 = F1; +// CHECK:STDERR: · ━┳ +// CHECK:STDERR: · ┗━━┫ error: name `F1` used before it was declared +// CHECK:STDERR: · ┃ [NameUseBeforeDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: │ fn N1.N2.N3.F1(); +// CHECK:STDERR: · ─┬ +// CHECK:STDERR: · ╰──┤ declared here [NameUseBeforeDeclNote] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: alias N1.N2.N3.F2 = F1; -// CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+3]]:7-8: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: -// CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE-4]]:21-22: error: name `F1` used before it was declared [NameUseBeforeDecl] fn N1.F1(); -// CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+3]]:10-11: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: -// CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE-8]]:21-22: error: name `F1` used before it was declared [NameUseBeforeDecl] fn N1.N2.F1(); -// CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+2]]:13-14: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: fn N1.N2.N3.F1(); // --- fail_alias.carbon @@ -123,8 +168,12 @@ library "[[@TEST_NAME]]"; fn F(); namespace N; -// CHECK:STDERR: fail_alias.carbon:[[@LINE+3]]:13: error: name `F` used before it was declared [NameUseBeforeDecl] -// CHECK:STDERR: fail_alias.carbon:[[@LINE+2]]:9: note: declared here [NameUseBeforeDeclNote] +// CHECK:STDERR: ╭─┤ fail_alias.carbon:[[@LINE+7]]:13 +// CHECK:STDERR: -> │ alias N.F = F; +// CHECK:STDERR: · ┬ ┳ +// CHECK:STDERR: · │ ┗━━┫ error: name `F` used before it was declared [NameUseBeforeDecl] +// CHECK:STDERR: · ╰────────┤ declared here [NameUseBeforeDeclNote] +// CHECK:STDERR: ╰──── // CHECK:STDERR: alias N.F = F; @@ -149,18 +198,38 @@ library "[[@TEST_NAME]]"; namespace N; // `N.F1` poisoned when not found. -// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+3]]:14-15: error: name `F1` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_poison_when_lookup_fails.carbon:[[@LINE+28]]:14 +// CHECK:STDERR: -> │ alias N.F2 = F1; +// CHECK:STDERR: · ━┳ +// CHECK:STDERR: · ┗━━┫ error: name `F1` not found [NameNotFound] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: +// CHECK:STDERR: ╭─┤ fail_poison_when_lookup_fails.carbon:[[@LINE+22]]:14 +// CHECK:STDERR: -> │ alias N.F2 = F1; +// CHECK:STDERR: · ━┳ +// CHECK:STDERR: · ┗━━┫ error: name `F1` used before it was declared +// CHECK:STDERR: · ┃ [NameUseBeforeDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: │ fn F1(); +// CHECK:STDERR: · ─┬ +// CHECK:STDERR: · ╰──┤ declared here [NameUseBeforeDeclNote] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: +// CHECK:STDERR: ╭─┤ fail_poison_when_lookup_fails.carbon:[[@LINE+11]]:14 +// CHECK:STDERR: -> │ alias N.F2 = F1; +// CHECK:STDERR: · ━┳ +// CHECK:STDERR: · ┗━━┫ error: name `F1` used before it was declared +// CHECK:STDERR: · ┃ [NameUseBeforeDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: │ fn N.F1(); +// CHECK:STDERR: · ─┬ +// CHECK:STDERR: · ╰──┤ declared here [NameUseBeforeDeclNote] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+1]]:14-15: error: name `F1` used before it was declared [NameUseBeforeDecl] alias N.F2 = F1; // TODO: We should ideally only produce one diagnostic here. -// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+3]]:4-5: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: -// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE-5]]:14-15: error: name `F1` used before it was declared [NameUseBeforeDecl] fn F1(); -// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+2]]:6-7: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: fn N.F1(); // --- fail_poison_with_lexical_result.carbon @@ -171,11 +240,19 @@ fn F1() { fn F2(); class C { - // CHECK:STDERR: fail_poison_with_lexical_result.carbon:[[@LINE+1]]:16-17: error: name `F2` used before it was declared [NameUseBeforeDecl] + // CHECK:STDERR: ╭─┤ fail_poison_with_lexical_result.carbon:[[@LINE+11]]:16 + // CHECK:STDERR: -> │ alias F3 = F2; + // CHECK:STDERR: · ━┳ + // CHECK:STDERR: · ┗━━┫ error: name `F2` used before it was declared + // CHECK:STDERR: · ┃ [NameUseBeforeDecl] + // CHECK:STDERR: │ + // CHECK:STDERR: │ fn F2(); + // CHECK:STDERR: · ─┬ + // CHECK:STDERR: · ╰──┤ declared here [NameUseBeforeDeclNote] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: alias F3 = F2; - // CHECK:STDERR: fail_poison_with_lexical_result.carbon:[[@LINE+2]]:8-9: note: declared here [NameUseBeforeDeclNote] - // CHECK:STDERR: fn F2(); } } diff --git a/toolchain/check/testdata/function/declaration/no_definition_in_impl_file.carbon b/toolchain/check/testdata/function/declaration/no_definition_in_impl_file.carbon index dac824acbe7e..e48dc19b1480 100644 --- a/toolchain/check/testdata/function/declaration/no_definition_in_impl_file.carbon +++ b/toolchain/check/testdata/function/declaration/no_definition_in_impl_file.carbon @@ -52,10 +52,23 @@ fn C(); impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_decl_in_api_decl_in_impl.impl.carbon:[[@LINE+5]]:1-7: error: redeclaration of `fn C` is redundant [RedeclRedundant] -// CHECK:STDERR: decl_in_api_decl_in_impl.carbon:4:1-7: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_decl_in_api_decl_in_impl.impl.carbon:[[@LINE+18]]:1 +// CHECK:STDERR: -> │ fn C(); +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of `fn C` is redundant [RedeclRedundant] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ decl_in_api_decl_in_impl.carbon +// CHECK:STDERR: │ fn C(); +// CHECK:STDERR: · ───┬─── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_decl_in_api_decl_in_impl.impl.carbon:[[@LINE+2]]:1-7: error: no definition found for declaration in impl file [MissingDefinitionInImpl] +// CHECK:STDERR: ╭─┤ fail_decl_in_api_decl_in_impl.impl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn C(); +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: no definition found for declaration in impl file +// CHECK:STDERR: · ┃ [MissingDefinitionInImpl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn C(); @@ -69,8 +82,16 @@ fn D(); impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_decl_in_api_decl_and_definition_in_impl.impl.carbon:[[@LINE+3]]:1-7: error: redeclaration of `fn D` is redundant [RedeclRedundant] -// CHECK:STDERR: decl_in_api_decl_and_definition_in_impl.carbon:4:1-7: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_decl_in_api_decl_and_definition_in_impl.impl.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: -> │ fn D(); +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of `fn D` is redundant [RedeclRedundant] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ decl_in_api_decl_and_definition_in_impl.carbon +// CHECK:STDERR: │ fn D(); +// CHECK:STDERR: · ───┬─── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn D(); @@ -84,6 +105,11 @@ library "[[@TEST_NAME]]"; impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_decl_only_in_impl.impl.carbon:[[@LINE+2]]:1-7: error: no definition found for declaration in impl file [MissingDefinitionInImpl] +// CHECK:STDERR: ╭─┤ fail_decl_only_in_impl.impl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn E(); +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: no definition found for declaration in impl file +// CHECK:STDERR: · ┃ [MissingDefinitionInImpl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn E(); diff --git a/toolchain/check/testdata/function/declaration/ref.carbon b/toolchain/check/testdata/function/declaration/ref.carbon index e38baaf40c74..8f6a37ad32d4 100644 --- a/toolchain/check/testdata/function/declaration/ref.carbon +++ b/toolchain/check/testdata/function/declaration/ref.carbon @@ -33,7 +33,12 @@ library "[[@TEST_NAME]]"; // TODO: Per p5434, a return form starting with `(` is a compound form, which // isn't supported yet. -// CHECK:STDERR: fail_todo_ref_return_parenthesized.carbon:[[@LINE+2]]:12-18: error: `ref` tag is not an argument to a `ref` parameter [RefTagNoRefParam] +// CHECK:STDERR: ╭─┤ fail_todo_ref_return_parenthesized.carbon:[[@LINE+7]]:12 +// CHECK:STDERR: -> │ fn F() -> (ref i32); +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: `ref` tag is not an argument to a `ref` parameter +// CHECK:STDERR: · ┃ [RefTagNoRefParam] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F() -> (ref i32); diff --git a/toolchain/check/testdata/function/declaration/val_var_return.carbon b/toolchain/check/testdata/function/declaration/val_var_return.carbon index b0946565faf4..c1c3670d96f0 100644 --- a/toolchain/check/testdata/function/declaration/val_var_return.carbon +++ b/toolchain/check/testdata/function/declaration/val_var_return.carbon @@ -67,8 +67,17 @@ fn F() -> var i32 { library "[[@TEST_NAME]]"; fn F() -> val i32 { - // CHECK:STDERR: fail_val_return_returned_var.carbon:[[@LINE+3]]:3-10: error: `returned var` declaration in function with non-initializing return form [ReturnedVarNotInit] - // CHECK:STDERR: fail_val_return_returned_var.carbon:[[@LINE-2]]:11-17: note: return form declared here [ReturnFormHereNote] + // CHECK:STDERR: ╭─┤ fail_val_return_returned_var.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn F() -> val i32 { + // CHECK:STDERR: · ───┬─── + // CHECK:STDERR: · ╰──┤ return form declared here [ReturnFormHereNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ returned var v: i32 = 1; + // CHECK:STDERR: · ┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: `returned var` declaration in function with non-initializing + // CHECK:STDERR: · ┃ return form + // CHECK:STDERR: · ┃ [ReturnedVarNotInit] + // CHECK:STDERR: ╰──── // CHECK:STDERR: returned var v: i32 = 1; return var; diff --git a/toolchain/check/testdata/function/deduced_return/fail_member.carbon b/toolchain/check/testdata/function/deduced_return/fail_member.carbon index 8768cb414e66..bab8149b2ec0 100644 --- a/toolchain/check/testdata/function/deduced_return/fail_member.carbon +++ b/toolchain/check/testdata/function/deduced_return/fail_member.carbon @@ -14,7 +14,12 @@ library "[[@TEST_NAME]]"; interface I { - // CHECK:STDERR: fail_interface.carbon:[[@LINE+2]]:10-16: error: interface member with deduced return type [DeducedReturnTypeNotAllowed] + // CHECK:STDERR: ╭─┤ fail_interface.carbon:[[@LINE+7]]:10 + // CHECK:STDERR: -> │ fn F() -> auto; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: interface member with deduced return type + // CHECK:STDERR: · ┃ [DeducedReturnTypeNotAllowed] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn F() -> auto; } @@ -23,7 +28,12 @@ interface I { library "[[@TEST_NAME]]"; interface I { - // CHECK:STDERR: fail_interface_default.carbon:[[@LINE+2]]:18-24: error: interface member with deduced return type [DeducedReturnTypeNotAllowed] + // CHECK:STDERR: ╭─┤ fail_interface_default.carbon:[[@LINE+7]]:18 + // CHECK:STDERR: -> │ default fn F() -> auto { return 0 as i32; } + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: interface member with deduced return type + // CHECK:STDERR: · ┃ [DeducedReturnTypeNotAllowed] + // CHECK:STDERR: ╰──── // CHECK:STDERR: default fn F() -> auto { return 0 as i32; } } @@ -32,7 +42,13 @@ interface I { library "[[@TEST_NAME]]"; base class B { - // CHECK:STDERR: fail_virtual.carbon:[[@LINE+2]]:29-35: error: virtual function with deduced return type [DeducedReturnTypeNotAllowed] + // CHECK:STDERR: ╭─┤ fail_virtual.carbon:[[@LINE+8]]:29 + // CHECK:STDERR: -> │ virtual fn F(unused self) -> auto { return 0 as i32; } + // CHECK:STDERR: · ┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: virtual function with deduced return + // CHECK:STDERR: · ┃ type + // CHECK:STDERR: · ┃ [DeducedReturnTypeNotAllowed] + // CHECK:STDERR: ╰──── // CHECK:STDERR: virtual fn F(unused self) -> auto { return 0 as i32; } } @@ -41,7 +57,12 @@ base class B { library "[[@TEST_NAME]]"; abstract class A { - // CHECK:STDERR: fail_abstract.carbon:[[@LINE+2]]:23-29: error: virtual function with deduced return type [DeducedReturnTypeNotAllowed] + // CHECK:STDERR: ╭─┤ fail_abstract.carbon:[[@LINE+7]]:23 + // CHECK:STDERR: -> │ abstract fn F(self) -> auto; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: virtual function with deduced return type + // CHECK:STDERR: · ┃ [DeducedReturnTypeNotAllowed] + // CHECK:STDERR: ╰──── // CHECK:STDERR: abstract fn F(self) -> auto; } @@ -55,7 +76,13 @@ base class B { class D { extend base: B; - // CHECK:STDERR: fail_override.carbon:[[@LINE+2]]:30-36: error: virtual function with deduced return type [DeducedReturnTypeNotAllowed] + // CHECK:STDERR: ╭─┤ fail_override.carbon:[[@LINE+8]]:30 + // CHECK:STDERR: -> │ override fn F(unused self) -> auto { return 0 as i32; } + // CHECK:STDERR: · ┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: virtual function with deduced return + // CHECK:STDERR: · ┃ type + // CHECK:STDERR: · ┃ [DeducedReturnTypeNotAllowed] + // CHECK:STDERR: ╰──── // CHECK:STDERR: override fn F(unused self) -> auto { return 0 as i32; } } @@ -70,7 +97,12 @@ interface I { class C {} impl C as I { - // CHECK:STDERR: fail_todo_impl.carbon:[[@LINE+2]]:10-16: error: semantics TODO: `deduced return type for `impl` member` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_impl.carbon:[[@LINE+7]]:10 + // CHECK:STDERR: -> │ fn F() -> auto { return 0 as i32; } + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `deduced return type for `impl` member` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn F() -> auto { return 0 as i32; } } diff --git a/toolchain/check/testdata/function/deduced_return/fail_redecl.carbon b/toolchain/check/testdata/function/deduced_return/fail_redecl.carbon index 0e75c1c37c68..c036230ef384 100644 --- a/toolchain/check/testdata/function/deduced_return/fail_redecl.carbon +++ b/toolchain/check/testdata/function/deduced_return/fail_redecl.carbon @@ -13,18 +13,36 @@ // --- fail_forward_decl.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_forward_decl.carbon:[[@LINE+2]]:8-14: error: forward declaration of function with deduced return type [DeducedReturnTypeNotDefinition] +// CHECK:STDERR: ╭─┤ fail_forward_decl.carbon:[[@LINE+7]]:8 +// CHECK:STDERR: -> │ fn F() -> auto; +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: forward declaration of function with deduced return type +// CHECK:STDERR: · ┃ [DeducedReturnTypeNotDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F() -> auto; // --- fail_forward_decl_then_def.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_forward_decl_then_def.carbon:[[@LINE+2]]:8-14: error: forward declaration of function with deduced return type [DeducedReturnTypeNotDefinition] +// CHECK:STDERR: ╭─┤ fail_forward_decl_then_def.carbon:[[@LINE+7]]:8 +// CHECK:STDERR: -> │ fn F() -> auto; +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: forward declaration of function with deduced return type +// CHECK:STDERR: · ┃ [DeducedReturnTypeNotDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F() -> auto; -// CHECK:STDERR: fail_forward_decl_then_def.carbon:[[@LINE+3]]:1-16: error: redeclaration of function with deduced return type [DeducedReturnTypeRedecl] -// CHECK:STDERR: fail_forward_decl_then_def.carbon:[[@LINE-2]]:1-15: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_forward_decl_then_def.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: │ fn F() -> auto; +// CHECK:STDERR: · ───────┬─────── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn F() -> auto { return 0 as i32; } +// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of function with deduced return type +// CHECK:STDERR: · ┃ [DeducedReturnTypeRedecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F() -> auto { return 0 as i32; } @@ -32,8 +50,16 @@ fn F() -> auto { return 0 as i32; } library "[[@TEST_NAME]]"; fn F() -> i32; -// CHECK:STDERR: fail_decl_then_auto_def.carbon:[[@LINE+3]]:1-16: error: redeclaration of function with deduced return type [DeducedReturnTypeRedecl] -// CHECK:STDERR: fail_decl_then_auto_def.carbon:[[@LINE-2]]:1-14: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_decl_then_auto_def.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: │ fn F() -> i32; +// CHECK:STDERR: · ───────┬────── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn F() -> auto { return 0 as i32; } +// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of function with deduced return type +// CHECK:STDERR: · ┃ [DeducedReturnTypeRedecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F() -> auto { return 0 as i32; } @@ -41,8 +67,16 @@ fn F() -> auto { return 0 as i32; } library "[[@TEST_NAME]]"; fn F() -> auto { return 0 as i32; } -// CHECK:STDERR: fail_auto_def_then_decl.carbon:[[@LINE+3]]:1-14: error: redeclaration of function with deduced return type [DeducedReturnTypeRedecl] -// CHECK:STDERR: fail_auto_def_then_decl.carbon:[[@LINE-2]]:1-16: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_auto_def_then_decl.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: │ fn F() -> auto { return 0 as i32; } +// CHECK:STDERR: · ────────┬─────── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn F() -> i32; +// CHECK:STDERR: · ━━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of function with deduced return type +// CHECK:STDERR: · ┃ [DeducedReturnTypeRedecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F() -> i32; @@ -50,8 +84,16 @@ fn F() -> i32; library "[[@TEST_NAME]]"; fn F() -> auto { return 0 as i32; } -// CHECK:STDERR: fail_redefinition.carbon:[[@LINE+3]]:1-16: error: redeclaration of function with deduced return type [DeducedReturnTypeRedecl] -// CHECK:STDERR: fail_redefinition.carbon:[[@LINE-2]]:1-16: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_redefinition.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: │ fn F() -> auto { return 0 as i32; } +// CHECK:STDERR: · ────────┬─────── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn F() -> auto { return 0 as i32; } +// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of function with deduced return type +// CHECK:STDERR: · ┃ [DeducedReturnTypeRedecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F() -> auto { return 0 as i32; } @@ -59,29 +101,57 @@ fn F() -> auto { return 0 as i32; } library "[[@TEST_NAME]]"; class C { - // CHECK:STDERR: fail_member_out_of_line.carbon:[[@LINE+2]]:10-16: error: forward declaration of function with deduced return type [DeducedReturnTypeNotDefinition] + // CHECK:STDERR: ╭─┤ fail_member_out_of_line.carbon:[[@LINE+7]]:10 + // CHECK:STDERR: -> │ fn F() -> auto; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: forward declaration of function with deduced return type + // CHECK:STDERR: · ┃ [DeducedReturnTypeNotDefinition] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn F() -> auto; } -// CHECK:STDERR: fail_member_out_of_line.carbon:[[@LINE+3]]:1-18: error: redeclaration of function with deduced return type [DeducedReturnTypeRedecl] -// CHECK:STDERR: fail_member_out_of_line.carbon:[[@LINE-4]]:3-17: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_member_out_of_line.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: │ fn F() -> auto; +// CHECK:STDERR: · ───────┬─────── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn C.F() -> auto { return 0 as i32; } +// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of function with deduced return type +// CHECK:STDERR: · ┃ [DeducedReturnTypeRedecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn C.F() -> auto { return 0 as i32; } // --- fail_builtin.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_builtin.carbon:[[@LINE+4]]:26-32: error: builtin function with deduced return type [DeducedReturnTypeNotAllowed] +// CHECK:STDERR: ╭─┤ fail_builtin.carbon:[[@LINE+14]]:26 +// CHECK:STDERR: -> │ fn F(n: Core.IntLiteral) -> auto = "int.make_type_signed"; +// CHECK:STDERR: · ━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: builtin function with deduced return type +// CHECK:STDERR: · ┃ [DeducedReturnTypeNotAllowed] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_builtin.carbon:[[@LINE+2]]:1-34: error: invalid signature for builtin function "int.make_type_signed" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_builtin.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn F(n: Core.IntLiteral) -> auto = "int.make_type_signed"; +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "int.make_type_signed" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(n: Core.IntLiteral) -> auto = "int.make_type_signed"; // --- fail_extern.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_extern.carbon:[[@LINE+2]]:15-21: error: `extern` function with deduced return type [DeducedReturnTypeNotAllowed] +// CHECK:STDERR: ╭─┤ fail_extern.carbon:[[@LINE+7]]:15 +// CHECK:STDERR: -> │ extern fn F() -> auto { return 0 as i32; } +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: `extern` function with deduced return type +// CHECK:STDERR: · ┃ [DeducedReturnTypeNotAllowed] +// CHECK:STDERR: ╰──── // CHECK:STDERR: extern fn F() -> auto { return 0 as i32; } @@ -93,10 +163,24 @@ fn F() -> auto { return 0 as i32; } // --- fail_api_def.impl.carbon impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_api_def.impl.carbon:[[@LINE+5]]:1-14: error: redeclaration of function with deduced return type [DeducedReturnTypeRedecl] -// CHECK:STDERR: api_def.carbon:3:1-16: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_api_def.impl.carbon:[[@LINE+19]]:1 +// CHECK:STDERR: -> │ fn F() -> i32; +// CHECK:STDERR: · ━━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of function with deduced return type +// CHECK:STDERR: · ┃ [DeducedReturnTypeRedecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ api_def.carbon +// CHECK:STDERR: │ fn F() -> auto { return 0 as i32; } +// CHECK:STDERR: · ────────┬─────── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_api_def.impl.carbon:[[@LINE+2]]:1-14: error: no definition found for declaration in impl file [MissingDefinitionInImpl] +// CHECK:STDERR: ╭─┤ fail_api_def.impl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn F() -> i32; +// CHECK:STDERR: · ━━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: no definition found for declaration in impl file +// CHECK:STDERR: · ┃ [MissingDefinitionInImpl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F() -> i32; @@ -108,7 +192,16 @@ fn F() -> i32; // --- fail_api_decl.impl.carbon impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_api_decl.impl.carbon:[[@LINE+3]]:1-16: error: redeclaration of function with deduced return type [DeducedReturnTypeRedecl] -// CHECK:STDERR: api_decl.carbon:3:1-14: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_api_decl.impl.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: -> │ fn F() -> auto { return 0 as i32; } +// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of function with deduced return type +// CHECK:STDERR: · ┃ [DeducedReturnTypeRedecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ api_decl.carbon +// CHECK:STDERR: │ fn F() -> i32; +// CHECK:STDERR: · ───────┬────── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F() -> auto { return 0 as i32; } diff --git a/toolchain/check/testdata/function/deduced_return/fail_return.carbon b/toolchain/check/testdata/function/deduced_return/fail_return.carbon index 0ab997bc441c..478b783afb8c 100644 --- a/toolchain/check/testdata/function/deduced_return/fail_return.carbon +++ b/toolchain/check/testdata/function/deduced_return/fail_return.carbon @@ -17,8 +17,18 @@ fn F(b: bool) -> auto { if (b) { return 1 as i32; } - // CHECK:STDERR: fail_mismatch.carbon:[[@LINE+3]]:10-13: error: deduced return type `bool` does not match return type deduced earlier [DeducedReturnTypeMismatch] - // CHECK:STDERR: fail_mismatch.carbon:[[@LINE-3]]:12-19: note: return type previously deduced as `i32` here [DeducedReturnTypeMismatchPrevious] + // CHECK:STDERR: ╭─┤ fail_mismatch.carbon:[[@LINE+13]]:10 + // CHECK:STDERR: │ return 1 as i32; + // CHECK:STDERR: · ────┬─── + // CHECK:STDERR: · ╰──┤ return type previously deduced as `i32` here + // CHECK:STDERR: · │ [DeducedReturnTypeMismatchPrevious] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ return true; + // CHECK:STDERR: · ┳━━━ + // CHECK:STDERR: · ┗━━┫ error: deduced return type `bool` does not match return type + // CHECK:STDERR: · ┃ deduced earlier + // CHECK:STDERR: · ┃ [DeducedReturnTypeMismatch] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return true; } @@ -31,8 +41,18 @@ fn F(b: bool) -> auto { return 1 as i32; } // TODO: This should work once we use CommonType in return type deduction. - // CHECK:STDERR: fail_todo_mismatch_int_vs_int_literal.carbon:[[@LINE+3]]:10: error: deduced return type `Core.IntLiteral` does not match return type deduced earlier [DeducedReturnTypeMismatch] - // CHECK:STDERR: fail_todo_mismatch_int_vs_int_literal.carbon:[[@LINE-4]]:12-19: note: return type previously deduced as `i32` here [DeducedReturnTypeMismatchPrevious] + // CHECK:STDERR: ╭─┤ fail_todo_mismatch_int_vs_int_literal.carbon:[[@LINE+13]]:10 + // CHECK:STDERR: │ return 1 as i32; + // CHECK:STDERR: · ────┬─── + // CHECK:STDERR: · ╰──┤ return type previously deduced as `i32` here + // CHECK:STDERR: · │ [DeducedReturnTypeMismatchPrevious] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ return 0; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: deduced return type `Core.IntLiteral` does not match return + // CHECK:STDERR: · ┃ type deduced earlier + // CHECK:STDERR: · ┃ [DeducedReturnTypeMismatch] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return 0; } @@ -43,7 +63,11 @@ library "[[@TEST_NAME]]"; // The erroneous `return` doesn't affect the deduced return type. fn F(b: bool) -> auto { if (b) { - // CHECK:STDERR: fail_error_return_ignored.carbon:[[@LINE+2]]:12-21: error: name `Undeclared` not found [NameNotFound] + // CHECK:STDERR: ╭─┤ fail_error_return_ignored.carbon:[[@LINE+6]]:12 + // CHECK:STDERR: -> │ return Undeclared; + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: name `Undeclared` not found [NameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return Undeclared; } @@ -59,8 +83,15 @@ library "[[@TEST_NAME]]"; fn F(b: bool) -> auto { if (b) { - // CHECK:STDERR: fail_return_no_value.carbon:[[@LINE+3]]:5-11: error: missing return value [ReturnStatementMissingExpr] - // CHECK:STDERR: fail_return_no_value.carbon:[[@LINE-3]]:1-23: note: return type of function is deduced [ReturnTypeIsDeducedNote] + // CHECK:STDERR: ╭─┤ fail_return_no_value.carbon:[[@LINE+10]]:5 + // CHECK:STDERR: │ fn F(b: bool) -> auto { + // CHECK:STDERR: · ───────────┬─────────── + // CHECK:STDERR: · ╰──┤ return type of function is deduced [ReturnTypeIsDeducedNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ return; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: missing return value [ReturnStatementMissingExpr] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return; } @@ -71,8 +102,15 @@ fn F(b: bool) -> auto { library "[[@TEST_NAME]]"; fn F() -> auto { - // CHECK:STDERR: fail_return_no_value_only.carbon:[[@LINE+3]]:3-9: error: missing return value [ReturnStatementMissingExpr] - // CHECK:STDERR: fail_return_no_value_only.carbon:[[@LINE-2]]:1-16: note: return type of function is deduced [ReturnTypeIsDeducedNote] + // CHECK:STDERR: ╭─┤ fail_return_no_value_only.carbon:[[@LINE+10]]:3 + // CHECK:STDERR: │ fn F() -> auto { + // CHECK:STDERR: · ────────┬─────── + // CHECK:STDERR: · ╰──┤ return type of function is deduced [ReturnTypeIsDeducedNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ return; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: missing return value [ReturnStatementMissingExpr] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return; } @@ -84,14 +122,24 @@ fn F(b: bool) -> auto { if (b) { return 1 as i32; } -// CHECK:STDERR: fail_reachable_end.carbon:[[@LINE+2]]:1: error: missing `return` at end of function with declared return type [MissingReturnStatement] +// CHECK:STDERR: ╭─┤ fail_reachable_end.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ } +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: missing `return` at end of function with declared return type +// CHECK:STDERR: · ┃ [MissingReturnStatement] +// CHECK:STDERR: ╰──── // CHECK:STDERR: } // --- fail_no_return.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_no_return.carbon:[[@LINE+2]]:1-16: error: no `return` in function with deduced return type [DeducedReturnTypeWithoutReturn] +// CHECK:STDERR: ╭─┤ fail_no_return.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn F() -> auto {} +// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: no `return` in function with deduced return type +// CHECK:STDERR: · ┃ [DeducedReturnTypeWithoutReturn] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F() -> auto {} @@ -99,7 +147,12 @@ fn F() -> auto {} library "[[@TEST_NAME]]"; fn F() -> auto { - // CHECK:STDERR: fail_return_var_no_returned_var.carbon:[[@LINE+2]]:3-13: error: `return var;` with no `returned var` in scope [ReturnVarWithNoReturnedVar] + // CHECK:STDERR: ╭─┤ fail_return_var_no_returned_var.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ return var; + // CHECK:STDERR: · ━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: `return var;` with no `returned var` in scope + // CHECK:STDERR: · ┃ [ReturnVarWithNoReturnedVar] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return var; } @@ -112,8 +165,16 @@ class C; fn Make() -> C*; fn F() -> auto { - // CHECK:STDERR: fail_incomplete.carbon:[[@LINE+3]]:10-16: error: function returns incomplete type `C` [IncompleteTypeInFunctionReturnType] - // CHECK:STDERR: fail_incomplete.carbon:[[@LINE-6]]:1-8: note: class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ╭─┤ fail_incomplete.carbon:[[@LINE+11]]:10 + // CHECK:STDERR: │ class C; + // CHECK:STDERR: · ────┬─── + // CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ return *Make(); + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: function returns incomplete type `C` + // CHECK:STDERR: · ┃ [IncompleteTypeInFunctionReturnType] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return *Make(); } diff --git a/toolchain/check/testdata/function/deduced_return/form.carbon b/toolchain/check/testdata/function/deduced_return/form.carbon index dc7dff252dfa..fbcc153a0fc3 100644 --- a/toolchain/check/testdata/function/deduced_return/form.carbon +++ b/toolchain/check/testdata/function/deduced_return/form.carbon @@ -96,8 +96,14 @@ fn F() -> var auto { library "[[@TEST_NAME]]"; fn F() -> ref auto { - // CHECK:STDERR: fail_ref_auto_non_ref.carbon:[[@LINE+3]]:3-18: error: cannot bind durable reference to non-reference value of type `i32` [ConversionFailureNonRefToRef] - // CHECK:STDERR: fail_ref_auto_non_ref.carbon:[[@LINE+2]]:10-17: note: return type deduced as `i32` [ReturnTypeDeducedAs] + // CHECK:STDERR: ╭─┤ fail_ref_auto_non_ref.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ return 0 as i32; + // CHECK:STDERR: · ━━━━━━━┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot bind durable reference to non-reference value of + // CHECK:STDERR: · │ ┃ type `i32` + // CHECK:STDERR: · │ ┃ [ConversionFailureNonRefToRef] + // CHECK:STDERR: · ╰────┤ return type deduced as `i32` [ReturnTypeDeducedAs] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return 0 as i32; } @@ -106,8 +112,17 @@ fn F() -> ref auto { library "[[@TEST_NAME]]"; fn F() -> ref auto { - // CHECK:STDERR: fail_ref_auto_returned_var.carbon:[[@LINE+3]]:3-10: error: `returned var` declaration in function with non-initializing return form [ReturnedVarNotInit] - // CHECK:STDERR: fail_ref_auto_returned_var.carbon:[[@LINE-2]]:1-20: note: return form declared here [ReturnFormHereNote] + // CHECK:STDERR: ╭─┤ fail_ref_auto_returned_var.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn F() -> ref auto { + // CHECK:STDERR: · ──────────┬───────── + // CHECK:STDERR: · ╰──┤ return form declared here [ReturnFormHereNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ returned var v: i32 = 1; + // CHECK:STDERR: · ┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: `returned var` declaration in function with non-initializing + // CHECK:STDERR: · ┃ return form + // CHECK:STDERR: · ┃ [ReturnedVarNotInit] + // CHECK:STDERR: ╰──── // CHECK:STDERR: returned var v: i32 = 1; return var; @@ -117,8 +132,17 @@ fn F() -> ref auto { library "[[@TEST_NAME]]"; fn F() -> val auto { - // CHECK:STDERR: fail_val_auto_returned_var.carbon:[[@LINE+3]]:3-10: error: `returned var` declaration in function with non-initializing return form [ReturnedVarNotInit] - // CHECK:STDERR: fail_val_auto_returned_var.carbon:[[@LINE-2]]:1-20: note: return form declared here [ReturnFormHereNote] + // CHECK:STDERR: ╭─┤ fail_val_auto_returned_var.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn F() -> val auto { + // CHECK:STDERR: · ──────────┬───────── + // CHECK:STDERR: · ╰──┤ return form declared here [ReturnFormHereNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ returned var v: i32 = 1; + // CHECK:STDERR: · ┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: `returned var` declaration in function with non-initializing + // CHECK:STDERR: · ┃ return form + // CHECK:STDERR: · ┃ [ReturnedVarNotInit] + // CHECK:STDERR: ╰──── // CHECK:STDERR: returned var v: i32 = 1; return var; @@ -127,7 +151,12 @@ fn F() -> val auto { // --- fail_ref_auto_forward_decl.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_ref_auto_forward_decl.carbon:[[@LINE+2]]:8-18: error: forward declaration of function with deduced return type [DeducedReturnTypeNotDefinition] +// CHECK:STDERR: ╭─┤ fail_ref_auto_forward_decl.carbon:[[@LINE+7]]:8 +// CHECK:STDERR: -> │ fn F() -> ref auto; +// CHECK:STDERR: · ━━━━━┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: forward declaration of function with deduced return type +// CHECK:STDERR: · ┃ [DeducedReturnTypeNotDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F() -> ref auto; @@ -135,8 +164,15 @@ fn F() -> ref auto; library "[[@TEST_NAME]]"; fn F() -> ref auto { - // CHECK:STDERR: fail_ref_auto_missing_return_value.carbon:[[@LINE+3]]:3-9: error: missing return value [ReturnStatementMissingExpr] - // CHECK:STDERR: fail_ref_auto_missing_return_value.carbon:[[@LINE-2]]:1-20: note: return type of function is deduced [ReturnTypeIsDeducedNote] + // CHECK:STDERR: ╭─┤ fail_ref_auto_missing_return_value.carbon:[[@LINE+10]]:3 + // CHECK:STDERR: │ fn F() -> ref auto { + // CHECK:STDERR: · ──────────┬───────── + // CHECK:STDERR: · ╰──┤ return type of function is deduced [ReturnTypeIsDeducedNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ return; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: missing return value [ReturnStatementMissingExpr] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return; } @@ -146,7 +182,12 @@ library "[[@TEST_NAME]]"; var g: i32 = 0; -// CHECK:STDERR: fail_todo_form_literal.carbon:[[@LINE+2]]:21-24: error: semantics TODO: `HandleAutoTypeLiteral` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_todo_form_literal.carbon:[[@LINE+7]]:21 +// CHECK:STDERR: -> │ fn F() ->? form(ref auto) { +// CHECK:STDERR: · ━━┳━ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `HandleAutoTypeLiteral` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F() ->? form(ref auto) { return g; diff --git a/toolchain/check/testdata/function/deduced_return/generic.carbon b/toolchain/check/testdata/function/deduced_return/generic.carbon index ac44a7337cb0..f0bd12e14dac 100644 --- a/toolchain/check/testdata/function/deduced_return/generic.carbon +++ b/toolchain/check/testdata/function/deduced_return/generic.carbon @@ -108,8 +108,17 @@ library "[[@TEST_NAME]]"; fn F[T: Core.Copy](x: T, b: bool) -> auto { if (b) { - // CHECK:STDERR: fail_recursion_before_deduced.carbon:[[@LINE+3]]:12-22: error: call to `F` before its return type is known [CallBeforeReturnTypeDeduced] - // CHECK:STDERR: fail_recursion_before_deduced.carbon:[[@LINE-3]]:1-43: note: return type of `F` is deduced from its definition [ReturnTypeDeducedFromDefinition] + // CHECK:STDERR: ╭─┤ fail_recursion_before_deduced.carbon:[[@LINE+12]]:12 + // CHECK:STDERR: │ fn F[T: Core.Copy](x: T, b: bool) -> auto { + // CHECK:STDERR: · ─────────────────────┬───────────────────── + // CHECK:STDERR: · ╰──┤ return type of `F` is deduced from its definition + // CHECK:STDERR: · │ [ReturnTypeDeducedFromDefinition] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ return F(x, false); + // CHECK:STDERR: · ━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: call to `F` before its return type is known + // CHECK:STDERR: · ┃ [CallBeforeReturnTypeDeduced] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return F(x, false); } @@ -122,8 +131,17 @@ library "[[@TEST_NAME]]"; fn F[T: Core.Copy](x: T, b: bool) -> auto { returned var r: T = x; if (b) { - // CHECK:STDERR: fail_recursion_with_different_arguments.carbon:[[@LINE+3]]:5-22: error: call to `F` before its return type is known [CallBeforeReturnTypeDeduced] - // CHECK:STDERR: fail_recursion_with_different_arguments.carbon:[[@LINE-4]]:1-43: note: return type of `F` is deduced from its definition [ReturnTypeDeducedFromDefinition] + // CHECK:STDERR: ╭─┤ fail_recursion_with_different_arguments.carbon:[[@LINE+12]]:5 + // CHECK:STDERR: │ fn F[T: Core.Copy](x: T, b: bool) -> auto { + // CHECK:STDERR: · ─────────────────────┬───────────────────── + // CHECK:STDERR: · ╰──┤ return type of `F` is deduced from its definition + // CHECK:STDERR: · │ [ReturnTypeDeducedFromDefinition] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(0 as i32, false); + // CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: call to `F` before its return type is known + // CHECK:STDERR: · ┃ [CallBeforeReturnTypeDeduced] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(0 as i32, false); } diff --git a/toolchain/check/testdata/function/deduced_return/generic_form.carbon b/toolchain/check/testdata/function/deduced_return/generic_form.carbon index 7ed7102614aa..db61be0f1c72 100644 --- a/toolchain/check/testdata/function/deduced_return/generic_form.carbon +++ b/toolchain/check/testdata/function/deduced_return/generic_form.carbon @@ -148,8 +148,14 @@ fn H(ref n: i32) -> i32* { return G(ref n); } library "[[@TEST_NAME]]"; fn F[T: type](x: T) -> ref auto { - // CHECK:STDERR: fail_ref_auto_non_ref.carbon:[[@LINE+3]]:3-11: error: cannot bind durable reference to non-reference value of type `T` [ConversionFailureNonRefToRef] - // CHECK:STDERR: fail_ref_auto_non_ref.carbon:[[@LINE+2]]:10: note: return type deduced as `T` [ReturnTypeDeducedAs] + // CHECK:STDERR: ╭─┤ fail_ref_auto_non_ref.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ return x; + // CHECK:STDERR: · ━━━━┳━━┯━ + // CHECK:STDERR: · ┗━━━━━┫ error: cannot bind durable reference to non-reference value of + // CHECK:STDERR: · │ ┃ type `T` + // CHECK:STDERR: · │ ┃ [ConversionFailureNonRefToRef] + // CHECK:STDERR: · ╰────┤ return type deduced as `T` [ReturnTypeDeducedAs] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return x; } @@ -164,8 +170,18 @@ class C { } fn G(c: C) { - // CHECK:STDERR: fail_template_ref_auto_non_ref.carbon:[[@LINE+3]]:3-6: error: unable to monomorphize specific `F(C)` [ResolvingSpecificHere] - // CHECK:STDERR: fail_template_ref_auto_non_ref.carbon:[[@LINE-8]]:44-54: note: cannot bind durable reference to non-reference value of type `i32` [ConversionFailureNonRefToRef] + // CHECK:STDERR: ╭─┤ fail_template_ref_auto_non_ref.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn F[template T: type](x: T) -> ref auto { return x.n; } + // CHECK:STDERR: · ┬────────── + // CHECK:STDERR: · ╰──┤ cannot bind durable reference to + // CHECK:STDERR: · │ non-reference value of type + // CHECK:STDERR: · │ `i32` + // CHECK:STDERR: · │ [ConversionFailureNonRefToRef] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(c); + // CHECK:STDERR: · ━━┳━ + // CHECK:STDERR: · ┗━━┫ error: unable to monomorphize specific `F(C)` [ResolvingSpecificHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(c); } @@ -178,9 +194,21 @@ fn F[template T: type](ref x: T) -> ref auto { } fn G(ref n: i32) { - // CHECK:STDERR: fail_template_ref_auto_recursion_before_deduced.carbon:[[@LINE+4]]:3-10: error: unable to monomorphize specific `F(i32)` [ResolvingSpecificHere] - // CHECK:STDERR: fail_template_ref_auto_recursion_before_deduced.carbon:[[@LINE-5]]:10-17: note: call to `F` before its return type is known [CallBeforeReturnTypeDeduced] - // CHECK:STDERR: fail_template_ref_auto_recursion_before_deduced.carbon:[[@LINE-7]]:1-46: note: return type of `F` is deduced from its definition [ReturnTypeDeducedFromDefinition] + // CHECK:STDERR: ╭─┤ fail_template_ref_auto_recursion_before_deduced.carbon:[[@LINE+16]]:3 + // CHECK:STDERR: │ fn F[template T: type](ref x: T) -> ref auto { + // CHECK:STDERR: · ───────────────────────┬────────────────────── + // CHECK:STDERR: · ╰──┤ return type of `F` is deduced from its definition + // CHECK:STDERR: · │ [ReturnTypeDeducedFromDefinition] + // CHECK:STDERR: │ return F(ref x); + // CHECK:STDERR: · ────┬─── + // CHECK:STDERR: · ╰──┤ call to `F` before its return type is known + // CHECK:STDERR: · │ [CallBeforeReturnTypeDeduced] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(ref n); + // CHECK:STDERR: · ━━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: unable to monomorphize specific `F(i32)` + // CHECK:STDERR: · ┃ [ResolvingSpecificHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(ref n); } diff --git a/toolchain/check/testdata/function/deduced_return/returned_var.carbon b/toolchain/check/testdata/function/deduced_return/returned_var.carbon index b86a6f8e9382..88a0f5bedeb7 100644 --- a/toolchain/check/testdata/function/deduced_return/returned_var.carbon +++ b/toolchain/check/testdata/function/deduced_return/returned_var.carbon @@ -79,12 +79,21 @@ library "[[@TEST_NAME]]"; fn F(b: bool) -> auto { if (b) { - // CHECK:STDERR: fail_return_before_returned_var.carbon:[[@LINE+2]]:5-16: error: cannot implicitly convert expression of type `bool` to `i32` [ConversionFailure] - // CHECK:STDERR: fail_return_before_returned_var.carbon:[[@LINE+1]]:5-16: note: type `bool` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_return_before_returned_var.carbon:[[@LINE+13]]:5 + // CHECK:STDERR: -> │ return true; + // CHECK:STDERR: · ━━━━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `bool` to `i32` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `bool` does not implement interface `Core.ImplicitAs(i32)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: │ } + // CHECK:STDERR: │ returned var r: i32 = 0; + // CHECK:STDERR: · ─┬─ + // CHECK:STDERR: · ╰──┤ return type deduced as `i32` [ReturnTypeDeducedAs] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: return true; } - // CHECK:STDERR: fail_return_before_returned_var.carbon:[[@LINE+2]]:19-21: note: return type deduced as `i32` [ReturnTypeDeducedAs] - // CHECK:STDERR: returned var r: i32 = 0; return var; } @@ -97,8 +106,17 @@ fn F(b: bool) -> auto { returned var r: i32 = 0; return var; } - // CHECK:STDERR: fail_returned_var_mismatch.carbon:[[@LINE+3]]:19-22: error: type `bool` of `returned var` does not match return type of enclosing function [ReturnedVarWrongType] - // CHECK:STDERR: fail_returned_var_mismatch.carbon:[[@LINE-4]]:21-23: note: return type of function is `i32` [ReturnTypeHereNote] + // CHECK:STDERR: ╭─┤ fail_returned_var_mismatch.carbon:[[@LINE+12]]:19 + // CHECK:STDERR: │ returned var r: i32 = 0; + // CHECK:STDERR: · ─┬─ + // CHECK:STDERR: · ╰──┤ return type of function is `i32` [ReturnTypeHereNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ returned var s: bool = true; + // CHECK:STDERR: · ┳━━━ + // CHECK:STDERR: · ┗━━┫ error: type `bool` of `returned var` does not match + // CHECK:STDERR: · ┃ return type of enclosing function + // CHECK:STDERR: · ┃ [ReturnedVarWrongType] + // CHECK:STDERR: ╰──── // CHECK:STDERR: returned var s: bool = true; return var; diff --git a/toolchain/check/testdata/function/deduced_return/template.carbon b/toolchain/check/testdata/function/deduced_return/template.carbon index 84091c4b7a42..dbf56cb54e19 100644 --- a/toolchain/check/testdata/function/deduced_return/template.carbon +++ b/toolchain/check/testdata/function/deduced_return/template.carbon @@ -45,8 +45,18 @@ class D { // The definition of `F(D)` is needed to determine the return type, so it's // instantiated at the call. fn G(d: D) -> i32 { - // CHECK:STDERR: fail_instantiation_error.carbon:[[@LINE+3]]:10-13: error: unable to monomorphize specific `F(D)` [ResolvingSpecificHere] - // CHECK:STDERR: fail_instantiation_error.carbon:[[@LINE-10]]:47-49: note: member name `n` not found in `D` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╭─┤ fail_instantiation_error.carbon:[[@LINE+13]]:10 + // CHECK:STDERR: │ fn F[template T: type](x: T) -> auto { return x.n; } + // CHECK:STDERR: · ┬── + // CHECK:STDERR: · ╰──┤ member name `n` not found in + // CHECK:STDERR: · │ `D` + // CHECK:STDERR: · │ [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ return F(d); + // CHECK:STDERR: · ━━┳━ + // CHECK:STDERR: · ┗━━┫ error: unable to monomorphize specific `F(D)` + // CHECK:STDERR: · ┃ [ResolvingSpecificHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return F(d); } @@ -59,9 +69,21 @@ fn F[template T: type](x: T) -> auto { } fn G() { - // CHECK:STDERR: fail_recursion_before_deduced.carbon:[[@LINE+4]]:3-13: error: unable to monomorphize specific `F(i32)` [ResolvingSpecificHere] - // CHECK:STDERR: fail_recursion_before_deduced.carbon:[[@LINE-5]]:10-13: note: call to `F` before its return type is known [CallBeforeReturnTypeDeduced] - // CHECK:STDERR: fail_recursion_before_deduced.carbon:[[@LINE-7]]:1-38: note: return type of `F` is deduced from its definition [ReturnTypeDeducedFromDefinition] + // CHECK:STDERR: ╭─┤ fail_recursion_before_deduced.carbon:[[@LINE+16]]:3 + // CHECK:STDERR: │ fn F[template T: type](x: T) -> auto { + // CHECK:STDERR: · ───────────────────┬────────────────── + // CHECK:STDERR: · ╰──┤ return type of `F` is deduced from its definition + // CHECK:STDERR: · │ [ReturnTypeDeducedFromDefinition] + // CHECK:STDERR: │ return F(x); + // CHECK:STDERR: · ──┬─ + // CHECK:STDERR: · ╰──┤ call to `F` before its return type is known + // CHECK:STDERR: · │ [CallBeforeReturnTypeDeduced] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(0 as i32); + // CHECK:STDERR: · ━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: unable to monomorphize specific `F(i32)` + // CHECK:STDERR: · ┃ [ResolvingSpecificHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(0 as i32); } diff --git a/toolchain/check/testdata/function/deduced_return/use_before_deduced.carbon b/toolchain/check/testdata/function/deduced_return/use_before_deduced.carbon index 199a499d062b..4b2ff3c08be5 100644 --- a/toolchain/check/testdata/function/deduced_return/use_before_deduced.carbon +++ b/toolchain/check/testdata/function/deduced_return/use_before_deduced.carbon @@ -15,8 +15,17 @@ library "[[@TEST_NAME]]"; fn F(b: bool) -> auto { if (b) { - // CHECK:STDERR: fail_recursion.carbon:[[@LINE+3]]:12-19: error: call to `F` before its return type is known [CallBeforeReturnTypeDeduced] - // CHECK:STDERR: fail_recursion.carbon:[[@LINE-3]]:1-23: note: return type of `F` is deduced from its definition [ReturnTypeDeducedFromDefinition] + // CHECK:STDERR: ╭─┤ fail_recursion.carbon:[[@LINE+12]]:12 + // CHECK:STDERR: │ fn F(b: bool) -> auto { + // CHECK:STDERR: · ───────────┬─────────── + // CHECK:STDERR: · ╰──┤ return type of `F` is deduced from its definition + // CHECK:STDERR: · │ [ReturnTypeDeducedFromDefinition] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ return F(false); + // CHECK:STDERR: · ━━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: call to `F` before its return type is known + // CHECK:STDERR: · ┃ [CallBeforeReturnTypeDeduced] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return F(false); } @@ -28,10 +37,18 @@ library "[[@TEST_NAME]]"; class C { // The body of `F` is checked after the body of `G`. - // CHECK:STDERR: fail_member_order.carbon:[[@LINE+1]]:26-28: error: call to `F` before its return type is known [CallBeforeReturnTypeDeduced] - fn G() -> i32 { return F(); } - // CHECK:STDERR: fail_member_order.carbon:[[@LINE+2]]:3-18: note: return type of `F` is deduced from its definition [ReturnTypeDeducedFromDefinition] + // CHECK:STDERR: ╭─┤ fail_member_order.carbon:[[@LINE+11]]:26 + // CHECK:STDERR: -> │ fn G() -> i32 { return F(); } + // CHECK:STDERR: · ┳━━ + // CHECK:STDERR: · ┗━━┫ error: call to `F` before its return type is known + // CHECK:STDERR: · ┃ [CallBeforeReturnTypeDeduced] + // CHECK:STDERR: │ fn F() -> auto { return 0 as i32; } + // CHECK:STDERR: · ────────┬─────── + // CHECK:STDERR: · ╰──┤ return type of `F` is deduced from its definition + // CHECK:STDERR: · │ [ReturnTypeDeducedFromDefinition] + // CHECK:STDERR: ╰──── // CHECK:STDERR: + fn G() -> i32 { return F(); } fn F() -> auto { return 0 as i32; } } diff --git a/toolchain/check/testdata/function/definition/basics.carbon b/toolchain/check/testdata/function/definition/basics.carbon index 0d297711ce5b..63c2e12b5ddd 100644 --- a/toolchain/check/testdata/function/definition/basics.carbon +++ b/toolchain/check/testdata/function/definition/basics.carbon @@ -17,8 +17,16 @@ class C; -// CHECK:STDERR: fail_incomplete_type.carbon:[[@LINE+3]]:13-16: error: parameter has incomplete type `C` in function definition [IncompleteTypeInFunctionParam] -// CHECK:STDERR: fail_incomplete_type.carbon:[[@LINE-3]]:1-8: note: class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: ╭─┤ fail_incomplete_type.carbon:[[@LINE+11]]:13 +// CHECK:STDERR: │ class C; +// CHECK:STDERR: · ────┬─── +// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn F(unused n: C) {} +// CHECK:STDERR: · ┳━━━ +// CHECK:STDERR: · ┗━━┫ error: parameter has incomplete type `C` in function definition +// CHECK:STDERR: · ┃ [IncompleteTypeInFunctionParam] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused n: C) {} diff --git a/toolchain/check/testdata/function/definition/default_values.carbon b/toolchain/check/testdata/function/definition/default_values.carbon index cea94ac30a64..14cda2041ccc 100644 --- a/toolchain/check/testdata/function/definition/default_values.carbon +++ b/toolchain/check/testdata/function/definition/default_values.carbon @@ -14,8 +14,17 @@ library "[[@TEST_NAME]]"; fn F(x: i32 = 0, y: i32 = 10); -// CHECK:STDERR: fail_defaults_different_values_redecl.carbon:[[@LINE+3]]:25-42: error: redeclaration differs at parameter 2 [RedeclParamDiffers] -// CHECK:STDERR: fail_defaults_different_values_redecl.carbon:[[@LINE-2]]:18-28: note: previous declaration's corresponding parameter here [RedeclParamPrevious] +// CHECK:STDERR: ╭─┤ fail_defaults_different_values_redecl.carbon:[[@LINE+12]]:25 +// CHECK:STDERR: │ fn F(x: i32 = 0, y: i32 = 10); +// CHECK:STDERR: · ─────┬───── +// CHECK:STDERR: · ╰──┤ previous declaration's corresponding parameter here +// CHECK:STDERR: · │ [RedeclParamPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn F(unused x: i32 = 0, unused y: i32 = 22) { } +// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration differs at parameter 2 +// CHECK:STDERR: · ┃ [RedeclParamDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused x: i32 = 0, unused y: i32 = 22) { } @@ -27,8 +36,18 @@ fn F(x: i32 = 0, y: i32 = 1, z: i32 = 2); // --- fail_imported_default_presence_mismatch.impl.carbon impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_imported_default_presence_mismatch.impl.carbon:[[@LINE+3]]:13-18: error: redeclaration differs at parameter 1 [RedeclParamDiffers] -// CHECK:STDERR: imported_default_presence_mismatch.carbon:3:6-15: note: previous declaration's corresponding parameter here [RedeclParamPrevious] +// CHECK:STDERR: ╭─┤ fail_imported_default_presence_mismatch.impl.carbon:[[@LINE+13]]:13 +// CHECK:STDERR: -> │ fn F(unused x: i32, unused y: i32 = 1, unused z: i32 = 2) { } +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration differs at parameter 1 +// CHECK:STDERR: · ┃ [RedeclParamDiffers] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ imported_default_presence_mismatch.carbon +// CHECK:STDERR: │ fn F(x: i32 = 0, y: i32 = 1, z: i32 = 2); +// CHECK:STDERR: · ─────┬──── +// CHECK:STDERR: · ╰──┤ previous declaration's corresponding parameter here +// CHECK:STDERR: · │ [RedeclParamPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused x: i32, unused y: i32 = 1, unused z: i32 = 2) { } @@ -40,8 +59,18 @@ fn F(x: i32 = 0, y: i32 = 10); // --- fail_imported_defaults_different_values.impl.carbon impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_imported_defaults_different_values.impl.carbon:[[@LINE+3]]:25-42: error: redeclaration differs at parameter 2 [RedeclParamDiffers] -// CHECK:STDERR: imported_defaults_different_values.carbon:3:18-28: note: previous declaration's corresponding parameter here [RedeclParamPrevious] +// CHECK:STDERR: ╭─┤ fail_imported_defaults_different_values.impl.carbon:[[@LINE+13]]:25 +// CHECK:STDERR: -> │ fn F(unused x: i32 = 0, unused y: i32 = 22) { } +// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration differs at parameter 2 +// CHECK:STDERR: · ┃ [RedeclParamDiffers] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ imported_defaults_different_values.carbon +// CHECK:STDERR: │ fn F(x: i32 = 0, y: i32 = 10); +// CHECK:STDERR: · ─────┬───── +// CHECK:STDERR: · ╰──┤ previous declaration's corresponding parameter here +// CHECK:STDERR: · │ [RedeclParamPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused x: i32 = 0, unused y: i32 = 22) { } diff --git a/toolchain/check/testdata/function/definition/extern.carbon b/toolchain/check/testdata/function/definition/extern.carbon index c7f88ba16b22..684ead0d2707 100644 --- a/toolchain/check/testdata/function/definition/extern.carbon +++ b/toolchain/check/testdata/function/definition/extern.carbon @@ -42,8 +42,16 @@ extern fn F() {} library "[[@TEST_NAME]]"; extern fn F(); -// CHECK:STDERR: fail_def_extern_mismatch.carbon:[[@LINE+3]]:1-8: error: redeclarations of `fn F` must match use of `extern` [RedeclExternMismatch] -// CHECK:STDERR: fail_def_extern_mismatch.carbon:[[@LINE-2]]:1-14: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_def_extern_mismatch.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: │ extern fn F(); +// CHECK:STDERR: · ───────┬────── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn F() {} +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclarations of `fn F` must match use of `extern` +// CHECK:STDERR: · ┃ [RedeclExternMismatch] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F() {} @@ -52,8 +60,16 @@ fn F() {} library "[[@TEST_NAME]]"; fn F(); -// CHECK:STDERR: fail_def_extern_mismatch_reverse.carbon:[[@LINE+3]]:1-15: error: redeclarations of `fn F` must match use of `extern` [RedeclExternMismatch] -// CHECK:STDERR: fail_def_extern_mismatch_reverse.carbon:[[@LINE-2]]:1-7: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_def_extern_mismatch_reverse.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: │ fn F(); +// CHECK:STDERR: · ───┬─── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ extern fn F() {} +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclarations of `fn F` must match use of `extern` +// CHECK:STDERR: · ┃ [RedeclExternMismatch] +// CHECK:STDERR: ╰──── // CHECK:STDERR: extern fn F() {} @@ -62,12 +78,27 @@ extern fn F() {} library "[[@TEST_NAME]]"; extern fn F(); -// CHECK:STDERR: fail_extern_diag_suppressed.carbon:[[@LINE+3]]:1-7: error: redeclaration of `fn F` is redundant [RedeclRedundant] -// CHECK:STDERR: fail_extern_diag_suppressed.carbon:[[@LINE-2]]:1-14: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_extern_diag_suppressed.carbon:[[@LINE+10]]:1 +// CHECK:STDERR: │ extern fn F(); +// CHECK:STDERR: · ───────┬────── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn F(); +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of `fn F` is redundant [RedeclRedundant] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(); -// CHECK:STDERR: fail_extern_diag_suppressed.carbon:[[@LINE+3]]:1-8: error: redeclarations of `fn F` must match use of `extern` [RedeclExternMismatch] -// CHECK:STDERR: fail_extern_diag_suppressed.carbon:[[@LINE-6]]:1-14: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_extern_diag_suppressed.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: │ extern fn F(); +// CHECK:STDERR: · ───────┬────── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn F() {} +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclarations of `fn F` must match use of `extern` +// CHECK:STDERR: · ┃ [RedeclExternMismatch] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F() {} @@ -76,8 +107,15 @@ fn F() {} library "[[@TEST_NAME]]"; fn F() {} -// CHECK:STDERR: fail_extern_decl_after_def.carbon:[[@LINE+3]]:1-14: error: redeclaration of `fn F` is redundant [RedeclRedundant] -// CHECK:STDERR: fail_extern_decl_after_def.carbon:[[@LINE-2]]:1-8: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_extern_decl_after_def.carbon:[[@LINE+10]]:1 +// CHECK:STDERR: │ fn F() {} +// CHECK:STDERR: · ────┬─── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ extern fn F(); +// CHECK:STDERR: · ━━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of `fn F` is redundant [RedeclRedundant] +// CHECK:STDERR: ╰──── // CHECK:STDERR: extern fn F(); @@ -89,7 +127,12 @@ library "[[@TEST_NAME]]"; impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_in_impl.impl.carbon:[[@LINE+2]]:1-15: error: `extern` entities must have a declaration in the API file [ExternRequiresDeclInApiFile] +// CHECK:STDERR: ╭─┤ fail_in_impl.impl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ extern fn F() {} +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `extern` entities must have a declaration in the API file +// CHECK:STDERR: · ┃ [ExternRequiresDeclInApiFile] +// CHECK:STDERR: ╰──── // CHECK:STDERR: extern fn F() {} @@ -186,7 +229,7 @@ extern fn F() {} // CHECK:STDOUT: .F = %F.decl.loc4 // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl.loc4: %F.type = fn_decl @F [concrete = constants.%F] {} {} -// CHECK:STDOUT: %F.decl.loc8: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: %F.decl.loc16: %F.type = fn_decl @F [concrete = constants.%F] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: extern fn @F() { @@ -207,7 +250,7 @@ extern fn F() {} // CHECK:STDOUT: .F = %F.decl.loc4 // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl.loc4: %F.type = fn_decl @F [concrete = constants.%F] {} {} -// CHECK:STDOUT: %F.decl.loc8: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: %F.decl.loc16: %F.type = fn_decl @F [concrete = constants.%F] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { @@ -228,8 +271,8 @@ extern fn F() {} // CHECK:STDOUT: .F = %F.decl.loc4 // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl.loc4: %F.type = fn_decl @F [concrete = constants.%F] {} {} -// CHECK:STDOUT: %F.decl.loc8: %F.type = fn_decl @F [concrete = constants.%F] {} {} -// CHECK:STDOUT: %F.decl.loc12: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: %F.decl.loc15: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: %F.decl.loc27: %F.type = fn_decl @F [concrete = constants.%F] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: extern fn @F() { @@ -250,7 +293,7 @@ extern fn F() {} // CHECK:STDOUT: .F = %F.decl.loc4 // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl.loc4: %F.type = fn_decl @F [concrete = constants.%F] {} {} -// CHECK:STDOUT: %F.decl.loc8: %F.type = fn_decl @F [concrete = constants.%F] {} {} +// CHECK:STDOUT: %F.decl.loc15: %F.type = fn_decl @F [concrete = constants.%F] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { diff --git a/toolchain/check/testdata/function/definition/extern_library.carbon b/toolchain/check/testdata/function/definition/extern_library.carbon index a86cf2be1805..61e124296664 100644 --- a/toolchain/check/testdata/function/definition/extern_library.carbon +++ b/toolchain/check/testdata/function/definition/extern_library.carbon @@ -58,8 +58,17 @@ extern fn F(); impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_two_file_impl_mismatch.impl.carbon:[[@LINE+3]]:1-8: error: redeclarations of `fn F` must match use of `extern` [RedeclExternMismatch] -// CHECK:STDERR: two_file_impl_mismatch.carbon:4:1-14: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_two_file_impl_mismatch.impl.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: -> │ fn F() {} +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclarations of `fn F` must match use of `extern` +// CHECK:STDERR: · ┃ [RedeclExternMismatch] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ two_file_impl_mismatch.carbon +// CHECK:STDERR: │ extern fn F(); +// CHECK:STDERR: · ───────┬────── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F() {} @@ -67,6 +76,14 @@ fn F() {} library "[[@TEST_NAME]]"; +// CHECK:STDERR: ╷ ╭── imported from: fail_no_decl.carbon [InImport] +// CHECK:STDERR: ├─┤ no_decl_extern.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ extern library "no_decl" fn F(); +// CHECK:STDERR: · ━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: owning declaration required for non-owning declaration +// CHECK:STDERR: · ┃ [MissingOwningDeclarationInApi] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: extern library "no_decl" fn F(); // --- no_decl_extern.impl.carbon @@ -77,31 +94,38 @@ impl library "no_decl_extern"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: imported from: fail_no_decl.carbon:[[@LINE+3]]:1 [InImport] -// CHECK:STDERR: no_decl_extern.carbon:4:1-32: error: owning declaration required for non-owning declaration [MissingOwningDeclarationInApi] -// CHECK:STDERR: import library "no_decl_extern"; // --- indirect_two_file_extern.carbon library "[[@TEST_NAME]]"; +// CHECK:STDERR: ╷ ╭── imported from: fail_indirect_two_file.carbon [InImport] +// CHECK:STDERR: ├─┤ indirect_two_file_extern.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ extern library "indirect_two_file" fn F(); +// CHECK:STDERR: · ━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: owning declaration required for non-owning declaration +// CHECK:STDERR: · ┃ [MissingOwningDeclarationInApi] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: extern library "indirect_two_file" fn F(); // --- fail_indirect_two_file.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: imported from: fail_indirect_two_file.carbon:[[@LINE+3]]:1 [InImport] -// CHECK:STDERR: indirect_two_file_extern.carbon:4:1-42: error: owning declaration required for non-owning declaration [MissingOwningDeclarationInApi] -// CHECK:STDERR: import library "indirect_two_file_extern"; // --- fail_indirect_two_file.impl.carbon impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_indirect_two_file.impl.carbon:[[@LINE+2]]:1-15: error: `extern` entities must have a declaration in the API file [ExternRequiresDeclInApiFile] +// CHECK:STDERR: ╭─┤ fail_indirect_two_file.impl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ extern fn F() {} +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `extern` entities must have a declaration in the API file +// CHECK:STDERR: · ┃ [ExternRequiresDeclInApiFile] +// CHECK:STDERR: ╰──── // CHECK:STDERR: extern fn F() {} @@ -121,7 +145,12 @@ impl library "[[@TEST_NAME]]"; import library "in_impl_extern"; -// CHECK:STDERR: fail_in_impl.impl.carbon:[[@LINE+2]]:1-15: error: `extern` entities must have a declaration in the API file [ExternRequiresDeclInApiFile] +// CHECK:STDERR: ╭─┤ fail_in_impl.impl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ extern fn F() {} +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `extern` entities must have a declaration in the API file +// CHECK:STDERR: · ┃ [ExternRequiresDeclInApiFile] +// CHECK:STDERR: ╰──── // CHECK:STDERR: extern fn F() {} diff --git a/toolchain/check/testdata/function/definition/fail_decl_param_mismatch.carbon b/toolchain/check/testdata/function/definition/fail_decl_param_mismatch.carbon index be06e065b3e3..f6c44e72c91f 100644 --- a/toolchain/check/testdata/function/definition/fail_decl_param_mismatch.carbon +++ b/toolchain/check/testdata/function/definition/fail_decl_param_mismatch.carbon @@ -13,37 +13,87 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/definition/fail_decl_param_mismatch.carbon fn F(); -// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE+3]]:1-20: error: redeclaration differs because of parameter count of 1 [RedeclParamCountDiffers] -// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE-2]]:1-7: note: previously declared with parameter count of 0 [RedeclParamCountPrevious] +// CHECK:STDERR: ╭─┤ fail_decl_param_mismatch.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: │ fn F(); +// CHECK:STDERR: · ───┬─── +// CHECK:STDERR: · ╰──┤ previously declared with parameter count of 0 [RedeclParamCountPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn F(unused x: ()) {} +// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration differs because of parameter count of 1 +// CHECK:STDERR: · ┃ [RedeclParamCountDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused x: ()) {} fn G(x: ()); -// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE+3]]:1-8: error: redeclaration differs because of parameter count of 0 [RedeclParamCountDiffers] -// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE-2]]:1-12: note: previously declared with parameter count of 1 [RedeclParamCountPrevious] +// CHECK:STDERR: ╭─┤ fail_decl_param_mismatch.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: │ fn G(x: ()); +// CHECK:STDERR: · ──────┬───── +// CHECK:STDERR: · ╰──┤ previously declared with parameter count of 1 +// CHECK:STDERR: · │ [RedeclParamCountPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn G() {} +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration differs because of parameter count of 0 +// CHECK:STDERR: · ┃ [RedeclParamCountDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn G() {} fn H(x: ()); -// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE+2]]:16-19: error: `Core.Bool` implicitly referenced here, but package `Core` not found [CoreNotFound] +// CHECK:STDERR: ╭─┤ fail_decl_param_mismatch.carbon:[[@LINE+8]]:16 +// CHECK:STDERR: -> │ fn H(unused x: bool) {} +// CHECK:STDERR: · ┳━━━ +// CHECK:STDERR: · ┗━━┫ error: `Core.Bool` implicitly referenced here, but package +// CHECK:STDERR: · ┃ `Core` not found +// CHECK:STDERR: · ┃ [CoreNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn H(unused x: bool) {} fn I(); -// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE+3]]:1-14: error: function redeclaration differs because return type is `()` [FunctionRedeclReturnTypeDiffers] -// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE-2]]:1-7: note: previously declared with no return type [FunctionRedeclReturnTypePreviousNoReturn] +// CHECK:STDERR: ╭─┤ fail_decl_param_mismatch.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: │ fn I(); +// CHECK:STDERR: · ───┬─── +// CHECK:STDERR: · ╰──┤ previously declared with no return type +// CHECK:STDERR: · │ [FunctionRedeclReturnTypePreviousNoReturn] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn I() -> () { return (); } +// CHECK:STDERR: · ━━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: function redeclaration differs because return type is `()` +// CHECK:STDERR: · ┃ [FunctionRedeclReturnTypeDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn I() -> () { return (); } fn J() -> (); -// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE+3]]:1-8: error: function redeclaration differs because no return type is provided [FunctionRedeclReturnTypeDiffersNoReturn] -// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE-2]]:1-13: note: previously declared with return type `()` [FunctionRedeclReturnTypePrevious] +// CHECK:STDERR: ╭─┤ fail_decl_param_mismatch.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: │ fn J() -> (); +// CHECK:STDERR: · ──────┬────── +// CHECK:STDERR: · ╰──┤ previously declared with return type `()` +// CHECK:STDERR: · │ [FunctionRedeclReturnTypePrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn J() {} +// CHECK:STDERR: · ━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: function redeclaration differs because no return type is provided +// CHECK:STDERR: · ┃ [FunctionRedeclReturnTypeDiffersNoReturn] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn J() {} fn K() -> (); -// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE+3]]:1-14: error: function redeclaration differs because return type is `{}` [FunctionRedeclReturnTypeDiffers] -// CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE-2]]:1-13: note: previously declared with return type `()` [FunctionRedeclReturnTypePrevious] +// CHECK:STDERR: ╭─┤ fail_decl_param_mismatch.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: │ fn K() -> (); +// CHECK:STDERR: · ──────┬────── +// CHECK:STDERR: · ╰──┤ previously declared with return type `()` +// CHECK:STDERR: · │ [FunctionRedeclReturnTypePrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn K() -> {} { return {}; } +// CHECK:STDERR: · ━━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: function redeclaration differs because return type is `{}` +// CHECK:STDERR: · ┃ [FunctionRedeclReturnTypeDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn K() -> {} { return {}; } @@ -58,29 +108,29 @@ fn K() -> {} { return {}; } // CHECK:STDOUT: %pattern_type.cb1: type = pattern_type %empty_tuple.type [concrete] // CHECK:STDOUT: %x.param_patt: %pattern_type.cb1 = value_param_pattern [concrete] // CHECK:STDOUT: %x.patt.2180a6.1: %pattern_type.cb1 = wrapper_binding_pattern x, %x.param_patt [concrete] -// CHECK:STDOUT: %F.type.eb3ec9.2: type = fn_type @F.loc19 [concrete] +// CHECK:STDOUT: %F.type.eb3ec9.2: type = fn_type @F.loc27 [concrete] // CHECK:STDOUT: %F.7088cc.2: %F.type.eb3ec9.2 = struct_value () [concrete] // CHECK:STDOUT: %x.patt.2180a6.2: %pattern_type.cb1 = wrapper_binding_pattern x, %x.param_patt [concrete] -// CHECK:STDOUT: %G.type.f42045.1: type = fn_type @G.loc21 [concrete] +// CHECK:STDOUT: %G.type.f42045.1: type = fn_type @G.loc29 [concrete] // CHECK:STDOUT: %G.4228ed.1: %G.type.f42045.1 = struct_value () [concrete] -// CHECK:STDOUT: %G.type.f42045.2: type = fn_type @G.loc25 [concrete] +// CHECK:STDOUT: %G.type.f42045.2: type = fn_type @G.loc42 [concrete] // CHECK:STDOUT: %G.4228ed.2: %G.type.f42045.2 = struct_value () [concrete] -// CHECK:STDOUT: %H.type.c0bf33.1: type = fn_type @H.loc27 [concrete] +// CHECK:STDOUT: %H.type.c0bf33.1: type = fn_type @H.loc44 [concrete] // CHECK:STDOUT: %H.aacb46.1: %H.type.c0bf33.1 = struct_value () [concrete] -// CHECK:STDOUT: %H.type.c0bf33.2: type = fn_type @H.loc30 [concrete] +// CHECK:STDOUT: %H.type.c0bf33.2: type = fn_type @H.loc53 [concrete] // CHECK:STDOUT: %H.aacb46.2: %H.type.c0bf33.2 = struct_value () [concrete] -// CHECK:STDOUT: %I.type.4c8936.1: type = fn_type @I.loc32 [concrete] +// CHECK:STDOUT: %I.type.4c8936.1: type = fn_type @I.loc55 [concrete] // CHECK:STDOUT: %I.8a67f5.1: %I.type.4c8936.1 = struct_value () [concrete] // CHECK:STDOUT: %.262: Core.Form = init_form %empty_tuple.type [concrete] // CHECK:STDOUT: %return.param_patt.900: %pattern_type.cb1 = out_param_pattern [concrete] // CHECK:STDOUT: %return.patt.427: %pattern_type.cb1 = return_slot_pattern %return.param_patt.900, %empty_tuple.type [concrete] -// CHECK:STDOUT: %I.type.4c8936.2: type = fn_type @I.loc36 [concrete] +// CHECK:STDOUT: %I.type.4c8936.2: type = fn_type @I.loc68 [concrete] // CHECK:STDOUT: %I.8a67f5.2: %I.type.4c8936.2 = struct_value () [concrete] -// CHECK:STDOUT: %J.type.6304f1.1: type = fn_type @J.loc38 [concrete] +// CHECK:STDOUT: %J.type.6304f1.1: type = fn_type @J.loc70 [concrete] // CHECK:STDOUT: %J.64b370.1: %J.type.6304f1.1 = struct_value () [concrete] -// CHECK:STDOUT: %J.type.6304f1.2: type = fn_type @J.loc42 [concrete] +// CHECK:STDOUT: %J.type.6304f1.2: type = fn_type @J.loc83 [concrete] // CHECK:STDOUT: %J.64b370.2: %J.type.6304f1.2 = struct_value () [concrete] -// CHECK:STDOUT: %K.type.b73f4f.1: type = fn_type @K.loc44 [concrete] +// CHECK:STDOUT: %K.type.b73f4f.1: type = fn_type @K.loc85 [concrete] // CHECK:STDOUT: %K.4fd1e7.1: %K.type.b73f4f.1 = struct_value () [concrete] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete] @@ -88,101 +138,101 @@ fn K() -> {} { return {}; } // CHECK:STDOUT: %pattern_type.a96: type = pattern_type %empty_struct_type [concrete] // CHECK:STDOUT: %return.param_patt.296: %pattern_type.a96 = out_param_pattern [concrete] // CHECK:STDOUT: %return.patt.c45: %pattern_type.a96 = return_slot_pattern %return.param_patt.296, %empty_struct_type [concrete] -// CHECK:STDOUT: %K.type.b73f4f.2: type = fn_type @K.loc48 [concrete] +// CHECK:STDOUT: %K.type.b73f4f.2: type = fn_type @K.loc98 [concrete] // CHECK:STDOUT: %K.4fd1e7.2: %K.type.b73f4f.2 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [concrete] { // CHECK:STDOUT: .F = %F.decl.loc15 -// CHECK:STDOUT: .G = %G.decl.loc21 -// CHECK:STDOUT: .H = %H.decl.loc27 -// CHECK:STDOUT: .I = %I.decl.loc32 -// CHECK:STDOUT: .J = %J.decl.loc38 -// CHECK:STDOUT: .K = %K.decl.loc44 +// CHECK:STDOUT: .G = %G.decl.loc29 +// CHECK:STDOUT: .H = %H.decl.loc44 +// CHECK:STDOUT: .I = %I.decl.loc55 +// CHECK:STDOUT: .J = %J.decl.loc70 +// CHECK:STDOUT: .K = %K.decl.loc85 // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl.loc15: %F.type.eb3ec9.1 = fn_decl @F.loc15 [concrete = constants.%F.7088cc.1] {} {} -// CHECK:STDOUT: %F.decl.loc19: %F.type.eb3ec9.2 = fn_decl @F.loc19 [concrete = constants.%F.7088cc.2] { +// CHECK:STDOUT: %F.decl.loc27: %F.type.eb3ec9.2 = fn_decl @F.loc27 [concrete = constants.%F.7088cc.2] { // CHECK:STDOUT: %x.param_patt: %pattern_type.cb1 = value_param_pattern [concrete = constants.%x.param_patt] // CHECK:STDOUT: %x.patt: %pattern_type.cb1 = wrapper_binding_pattern x, %x.param_patt [concrete = constants.%x.patt.2180a6.1] // CHECK:STDOUT: } { // CHECK:STDOUT: %x.param: %empty_tuple.type = value_param call_param0 -// CHECK:STDOUT: %.loc19_17.1: type = splice_block %.loc19_17.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc19_17.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc19_17.3: type = converted %.loc19_17.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc27_17.1: type = splice_block %.loc27_17.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc27_17.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc27_17.3: type = converted %.loc27_17.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %x: %empty_tuple.type = wrapper_binding x, %x.param // CHECK:STDOUT: } -// CHECK:STDOUT: %G.decl.loc21: %G.type.f42045.1 = fn_decl @G.loc21 [concrete = constants.%G.4228ed.1] { +// CHECK:STDOUT: %G.decl.loc29: %G.type.f42045.1 = fn_decl @G.loc29 [concrete = constants.%G.4228ed.1] { // CHECK:STDOUT: %x.param_patt: %pattern_type.cb1 = value_param_pattern [concrete = constants.%x.param_patt] // CHECK:STDOUT: %x.patt: %pattern_type.cb1 = wrapper_binding_pattern x, %x.param_patt [concrete = constants.%x.patt.2180a6.2] // CHECK:STDOUT: } { // CHECK:STDOUT: %x.param: %empty_tuple.type = value_param call_param0 -// CHECK:STDOUT: %.loc21_10.1: type = splice_block %.loc21_10.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc21_10.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc21_10.3: type = converted %.loc21_10.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc29_10.1: type = splice_block %.loc29_10.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc29_10.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc29_10.3: type = converted %.loc29_10.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %x: %empty_tuple.type = wrapper_binding x, %x.param // CHECK:STDOUT: } -// CHECK:STDOUT: %G.decl.loc25: %G.type.f42045.2 = fn_decl @G.loc25 [concrete = constants.%G.4228ed.2] {} {} -// CHECK:STDOUT: %H.decl.loc27: %H.type.c0bf33.1 = fn_decl @H.loc27 [concrete = constants.%H.aacb46.1] { +// CHECK:STDOUT: %G.decl.loc42: %G.type.f42045.2 = fn_decl @G.loc42 [concrete = constants.%G.4228ed.2] {} {} +// CHECK:STDOUT: %H.decl.loc44: %H.type.c0bf33.1 = fn_decl @H.loc44 [concrete = constants.%H.aacb46.1] { // CHECK:STDOUT: %x.param_patt: %pattern_type.cb1 = value_param_pattern [concrete = constants.%x.param_patt] // CHECK:STDOUT: %x.patt: %pattern_type.cb1 = wrapper_binding_pattern x, %x.param_patt [concrete = constants.%x.patt.2180a6.2] // CHECK:STDOUT: } { // CHECK:STDOUT: %x.param: %empty_tuple.type = value_param call_param0 -// CHECK:STDOUT: %.loc27_10.1: type = splice_block %.loc27_10.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc27_10.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc27_10.3: type = converted %.loc27_10.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc44_10.1: type = splice_block %.loc44_10.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc44_10.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc44_10.3: type = converted %.loc44_10.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %x: %empty_tuple.type = wrapper_binding x, %x.param // CHECK:STDOUT: } -// CHECK:STDOUT: %H.decl.loc30: %H.type.c0bf33.2 = fn_decl @H.loc30 [concrete = constants.%H.aacb46.2] { +// CHECK:STDOUT: %H.decl.loc53: %H.type.c0bf33.2 = fn_decl @H.loc53 [concrete = constants.%H.aacb46.2] { // CHECK:STDOUT: %x.param_patt: = value_param_pattern [concrete = ] // CHECK:STDOUT: %x.patt: = wrapper_binding_pattern x, %x.param_patt [concrete = ] // CHECK:STDOUT: } { // CHECK:STDOUT: %x.param: = value_param call_param0 -// CHECK:STDOUT: %.loc30: type = type_literal [concrete = ] +// CHECK:STDOUT: %.loc53: type = type_literal [concrete = ] // CHECK:STDOUT: %x: = wrapper_binding x, [concrete = ] // CHECK:STDOUT: } -// CHECK:STDOUT: %I.decl.loc32: %I.type.4c8936.1 = fn_decl @I.loc32 [concrete = constants.%I.8a67f5.1] {} {} -// CHECK:STDOUT: %I.decl.loc36: %I.type.4c8936.2 = fn_decl @I.loc36 [concrete = constants.%I.8a67f5.2] { +// CHECK:STDOUT: %I.decl.loc55: %I.type.4c8936.1 = fn_decl @I.loc55 [concrete = constants.%I.8a67f5.1] {} {} +// CHECK:STDOUT: %I.decl.loc68: %I.type.4c8936.2 = fn_decl @I.loc68 [concrete = constants.%I.8a67f5.2] { // CHECK:STDOUT: %return.param_patt: %pattern_type.cb1 = out_param_pattern [concrete = constants.%return.param_patt.900] -// CHECK:STDOUT: %return.patt: %pattern_type.cb1 = return_slot_pattern %return.param_patt, %.loc36_12.2 [concrete = constants.%return.patt.427] +// CHECK:STDOUT: %return.patt: %pattern_type.cb1 = return_slot_pattern %return.param_patt, %.loc68_12.2 [concrete = constants.%return.patt.427] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc36_12.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc36_12.2: type = converted %.loc36_12.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %.loc36_12.3: Core.Form = init_form %.loc36_12.2 [concrete = constants.%.262] +// CHECK:STDOUT: %.loc68_12.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc68_12.2: type = converted %.loc68_12.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc68_12.3: Core.Form = init_form %.loc68_12.2 [concrete = constants.%.262] // CHECK:STDOUT: %return.param: ref %empty_tuple.type = out_param call_param0 // CHECK:STDOUT: %return: ref %empty_tuple.type = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %J.decl.loc38: %J.type.6304f1.1 = fn_decl @J.loc38 [concrete = constants.%J.64b370.1] { +// CHECK:STDOUT: %J.decl.loc70: %J.type.6304f1.1 = fn_decl @J.loc70 [concrete = constants.%J.64b370.1] { // CHECK:STDOUT: %return.param_patt: %pattern_type.cb1 = out_param_pattern [concrete = constants.%return.param_patt.900] -// CHECK:STDOUT: %return.patt: %pattern_type.cb1 = return_slot_pattern %return.param_patt, %.loc38_12.2 [concrete = constants.%return.patt.427] +// CHECK:STDOUT: %return.patt: %pattern_type.cb1 = return_slot_pattern %return.param_patt, %.loc70_12.2 [concrete = constants.%return.patt.427] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc38_12.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc38_12.2: type = converted %.loc38_12.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %.loc38_12.3: Core.Form = init_form %.loc38_12.2 [concrete = constants.%.262] +// CHECK:STDOUT: %.loc70_12.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc70_12.2: type = converted %.loc70_12.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc70_12.3: Core.Form = init_form %.loc70_12.2 [concrete = constants.%.262] // CHECK:STDOUT: %return.param: ref %empty_tuple.type = out_param call_param0 // CHECK:STDOUT: %return: ref %empty_tuple.type = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %J.decl.loc42: %J.type.6304f1.2 = fn_decl @J.loc42 [concrete = constants.%J.64b370.2] {} {} -// CHECK:STDOUT: %K.decl.loc44: %K.type.b73f4f.1 = fn_decl @K.loc44 [concrete = constants.%K.4fd1e7.1] { +// CHECK:STDOUT: %J.decl.loc83: %J.type.6304f1.2 = fn_decl @J.loc83 [concrete = constants.%J.64b370.2] {} {} +// CHECK:STDOUT: %K.decl.loc85: %K.type.b73f4f.1 = fn_decl @K.loc85 [concrete = constants.%K.4fd1e7.1] { // CHECK:STDOUT: %return.param_patt: %pattern_type.cb1 = out_param_pattern [concrete = constants.%return.param_patt.900] -// CHECK:STDOUT: %return.patt: %pattern_type.cb1 = return_slot_pattern %return.param_patt, %.loc44_12.2 [concrete = constants.%return.patt.427] +// CHECK:STDOUT: %return.patt: %pattern_type.cb1 = return_slot_pattern %return.param_patt, %.loc85_12.2 [concrete = constants.%return.patt.427] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc44_12.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc44_12.2: type = converted %.loc44_12.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %.loc44_12.3: Core.Form = init_form %.loc44_12.2 [concrete = constants.%.262] +// CHECK:STDOUT: %.loc85_12.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc85_12.2: type = converted %.loc85_12.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc85_12.3: Core.Form = init_form %.loc85_12.2 [concrete = constants.%.262] // CHECK:STDOUT: %return.param: ref %empty_tuple.type = out_param call_param0 // CHECK:STDOUT: %return: ref %empty_tuple.type = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %K.decl.loc48: %K.type.b73f4f.2 = fn_decl @K.loc48 [concrete = constants.%K.4fd1e7.2] { +// CHECK:STDOUT: %K.decl.loc98: %K.type.b73f4f.2 = fn_decl @K.loc98 [concrete = constants.%K.4fd1e7.2] { // CHECK:STDOUT: %return.param_patt: %pattern_type.a96 = out_param_pattern [concrete = constants.%return.param_patt.296] -// CHECK:STDOUT: %return.patt: %pattern_type.a96 = return_slot_pattern %return.param_patt, %.loc48_12.2 [concrete = constants.%return.patt.c45] +// CHECK:STDOUT: %return.patt: %pattern_type.a96 = return_slot_pattern %return.param_patt, %.loc98_12.2 [concrete = constants.%return.patt.c45] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc48_12.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc48_12.2: type = converted %.loc48_12.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %.loc48_12.3: Core.Form = init_form %.loc48_12.2 [concrete = constants.%.469] +// CHECK:STDOUT: %.loc98_12.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc98_12.2: type = converted %.loc98_12.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc98_12.3: Core.Form = init_form %.loc98_12.2 [concrete = constants.%.469] // CHECK:STDOUT: %return.param: ref %empty_struct_type = out_param call_param0 // CHECK:STDOUT: %return: ref %empty_struct_type = return_slot %return.param // CHECK:STDOUT: } @@ -190,49 +240,49 @@ fn K() -> {} { return {}; } // CHECK:STDOUT: // CHECK:STDOUT: fn @F.loc15(); // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.loc19(%x.param: %empty_tuple.type) { +// CHECK:STDOUT: fn @F.loc27(%x.param: %empty_tuple.type) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @G.loc21(%x.param: %empty_tuple.type); +// CHECK:STDOUT: fn @G.loc29(%x.param: %empty_tuple.type); // CHECK:STDOUT: -// CHECK:STDOUT: fn @G.loc25() { +// CHECK:STDOUT: fn @G.loc42() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @H.loc27(%x.param: %empty_tuple.type); +// CHECK:STDOUT: fn @H.loc44(%x.param: %empty_tuple.type); // CHECK:STDOUT: -// CHECK:STDOUT: fn @H.loc30(%x.param: ) { +// CHECK:STDOUT: fn @H.loc53(%x.param: ) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @I.loc32(); +// CHECK:STDOUT: fn @I.loc55(); // CHECK:STDOUT: -// CHECK:STDOUT: fn @I.loc36() -> out %return.param: %empty_tuple.type { +// CHECK:STDOUT: fn @I.loc68() -> out %return.param: %empty_tuple.type { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc36_24.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc36_24.2: init %empty_tuple.type = tuple_init () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc36_25: init %empty_tuple.type = converted %.loc36_24.1, %.loc36_24.2 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: return %.loc36_25 +// CHECK:STDOUT: %.loc68_24.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc68_24.2: init %empty_tuple.type = tuple_init () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc68_25: init %empty_tuple.type = converted %.loc68_24.1, %.loc68_24.2 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: return %.loc68_25 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @J.loc38() -> out %return.param: %empty_tuple.type; +// CHECK:STDOUT: fn @J.loc70() -> out %return.param: %empty_tuple.type; // CHECK:STDOUT: -// CHECK:STDOUT: fn @J.loc42() { +// CHECK:STDOUT: fn @J.loc83() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @K.loc44() -> out %return.param: %empty_tuple.type; +// CHECK:STDOUT: fn @K.loc85() -> out %return.param: %empty_tuple.type; // CHECK:STDOUT: -// CHECK:STDOUT: fn @K.loc48() -> out %return.param: %empty_struct_type { +// CHECK:STDOUT: fn @K.loc98() -> out %return.param: %empty_struct_type { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc48_24.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc48_24.2: init %empty_struct_type = struct_init () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc48_25: init %empty_struct_type = converted %.loc48_24.1, %.loc48_24.2 [concrete = constants.%empty_struct] -// CHECK:STDOUT: return %.loc48_25 +// CHECK:STDOUT: %.loc98_24.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc98_24.2: init %empty_struct_type = struct_init () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc98_25: init %empty_struct_type = converted %.loc98_24.1, %.loc98_24.2 [concrete = constants.%empty_struct] +// CHECK:STDOUT: return %.loc98_25 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/definition/fail_local_decl.carbon b/toolchain/check/testdata/function/definition/fail_local_decl.carbon index edffe22c88b4..2e71f4458069 100644 --- a/toolchain/check/testdata/function/definition/fail_local_decl.carbon +++ b/toolchain/check/testdata/function/definition/fail_local_decl.carbon @@ -15,13 +15,28 @@ library "[[@TEST_NAME]]"; fn F() { - // CHECK:STDERR: fail_virtual.carbon:[[@LINE+2]]:3-9: error: `default` not allowed; requires interface scope [ModifierRequiresInterface] + // CHECK:STDERR: ╭─┤ fail_virtual.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ default fn F(); + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: `default` not allowed; requires interface scope + // CHECK:STDERR: · ┃ [ModifierRequiresInterface] + // CHECK:STDERR: ╰──── // CHECK:STDERR: default fn F(); - // CHECK:STDERR: fail_virtual.carbon:[[@LINE+2]]:3-10: error: `override` not allowed; requires class scope [ModifierRequiresClass] + // CHECK:STDERR: ╭─┤ fail_virtual.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ override fn G(); + // CHECK:STDERR: · ━━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: `override` not allowed; requires class scope + // CHECK:STDERR: · ┃ [ModifierRequiresClass] + // CHECK:STDERR: ╰──── // CHECK:STDERR: override fn G(); - // CHECK:STDERR: fail_virtual.carbon:[[@LINE+2]]:3-9: error: `virtual` not allowed; requires class scope [ModifierRequiresClass] + // CHECK:STDERR: ╭─┤ fail_virtual.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ virtual fn H(); + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: `virtual` not allowed; requires class scope + // CHECK:STDERR: · ┃ [ModifierRequiresClass] + // CHECK:STDERR: ╰──── // CHECK:STDERR: virtual fn H(); } @@ -31,10 +46,20 @@ fn F() { library "[[@TEST_NAME]]"; fn F() { - // CHECK:STDERR: fail_access.carbon:[[@LINE+2]]:3-9: error: `private` not allowed; requires class or file scope [ModifierPrivateNotAllowed] + // CHECK:STDERR: ╭─┤ fail_access.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ private var unused v: {} = {}; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: `private` not allowed; requires class or file scope + // CHECK:STDERR: · ┃ [ModifierPrivateNotAllowed] + // CHECK:STDERR: ╰──── // CHECK:STDERR: private var unused v: {} = {}; - // CHECK:STDERR: fail_access.carbon:[[@LINE+2]]:3-11: error: `protected` not allowed; requires class scope [ModifierProtectedNotAllowed] + // CHECK:STDERR: ╭─┤ fail_access.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ protected var unused w: {} = {}; + // CHECK:STDERR: · ━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: `protected` not allowed; requires class scope + // CHECK:STDERR: · ┃ [ModifierProtectedNotAllowed] + // CHECK:STDERR: ╰──── // CHECK:STDERR: protected var unused w: {} = {}; } diff --git a/toolchain/check/testdata/function/definition/fail_redef.carbon b/toolchain/check/testdata/function/definition/fail_redef.carbon index b246805fb300..d076438cc574 100644 --- a/toolchain/check/testdata/function/definition/fail_redef.carbon +++ b/toolchain/check/testdata/function/definition/fail_redef.carbon @@ -13,8 +13,15 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/definition/fail_redef.carbon fn F() {} -// CHECK:STDERR: fail_redef.carbon:[[@LINE+3]]:1-8: error: redefinition of `fn F` [RedeclRedef] -// CHECK:STDERR: fail_redef.carbon:[[@LINE-2]]:1-8: note: previously defined here [RedeclPrevDef] +// CHECK:STDERR: ╭─┤ fail_redef.carbon:[[@LINE+10]]:1 +// CHECK:STDERR: │ fn F() {} +// CHECK:STDERR: · ────┬─── +// CHECK:STDERR: · ╰──┤ previously defined here [RedeclPrevDef] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn F() {} +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: redefinition of `fn F` [RedeclRedef] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F() {} @@ -24,7 +31,7 @@ fn F() {} // CHECK:STDOUT: type: type = facet_type [concrete] // CHECK:STDOUT: %F.type.eb3ec9.1: type = fn_type @F.loc15 [concrete] // CHECK:STDOUT: %F.7088cc.1: %F.type.eb3ec9.1 = struct_value () [concrete] -// CHECK:STDOUT: %F.type.eb3ec9.2: type = fn_type @F.loc19 [concrete] +// CHECK:STDOUT: %F.type.eb3ec9.2: type = fn_type @F.loc26 [concrete] // CHECK:STDOUT: %F.7088cc.2: %F.type.eb3ec9.2 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -33,7 +40,7 @@ fn F() {} // CHECK:STDOUT: .F = %F.decl.loc15 // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl.loc15: %F.type.eb3ec9.1 = fn_decl @F.loc15 [concrete = constants.%F.7088cc.1] {} {} -// CHECK:STDOUT: %F.decl.loc19: %F.type.eb3ec9.2 = fn_decl @F.loc19 [concrete = constants.%F.7088cc.2] {} {} +// CHECK:STDOUT: %F.decl.loc26: %F.type.eb3ec9.2 = fn_decl @F.loc26 [concrete = constants.%F.7088cc.2] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F.loc15() { @@ -41,7 +48,7 @@ fn F() {} // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.loc19() { +// CHECK:STDOUT: fn @F.loc26() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/definition/implicit_import.carbon b/toolchain/check/testdata/function/definition/implicit_import.carbon index 5827a9ead3aa..00d772624909 100644 --- a/toolchain/check/testdata/function/definition/implicit_import.carbon +++ b/toolchain/check/testdata/function/definition/implicit_import.carbon @@ -34,8 +34,17 @@ extern fn A(); impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_extern_api.impl.carbon:[[@LINE+3]]:1-8: error: redeclarations of `fn A` must match use of `extern` [RedeclExternMismatch] -// CHECK:STDERR: extern_api.carbon:4:1-14: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_extern_api.impl.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: -> │ fn A() {} +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclarations of `fn A` must match use of `extern` +// CHECK:STDERR: · ┃ [RedeclExternMismatch] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ extern_api.carbon +// CHECK:STDERR: │ extern fn A(); +// CHECK:STDERR: · ───────┬────── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn A() {} @@ -49,8 +58,17 @@ fn A(); impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_extern_impl.impl.carbon:[[@LINE+3]]:1-15: error: redeclarations of `fn A` must match use of `extern` [RedeclExternMismatch] -// CHECK:STDERR: extern_impl.carbon:4:1-7: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_extern_impl.impl.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: -> │ extern fn A() {} +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclarations of `fn A` must match use of `extern` +// CHECK:STDERR: · ┃ [RedeclExternMismatch] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ extern_impl.carbon +// CHECK:STDERR: │ fn A(); +// CHECK:STDERR: · ───┬─── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: extern fn A() {} @@ -64,8 +82,16 @@ fn A() {} impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_redecl_after_def.impl.carbon:[[@LINE+3]]:1-7: error: redeclaration of `fn A` is redundant [RedeclRedundant] -// CHECK:STDERR: redecl_after_def.carbon:4:1-8: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_redecl_after_def.impl.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: -> │ fn A(); +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of `fn A` is redundant [RedeclRedundant] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ redecl_after_def.carbon +// CHECK:STDERR: │ fn A() {} +// CHECK:STDERR: · ────┬─── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn A(); @@ -79,8 +105,16 @@ fn A() {} impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_redef_after_def.impl.carbon:[[@LINE+3]]:1-8: error: redefinition of `fn A` [RedeclRedef] -// CHECK:STDERR: redef_after_def.carbon:4:1-8: note: previously defined here [RedeclPrevDef] +// CHECK:STDERR: ╭─┤ fail_redef_after_def.impl.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: -> │ fn A() {} +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: redefinition of `fn A` [RedeclRedef] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ redef_after_def.carbon +// CHECK:STDERR: │ fn A() {} +// CHECK:STDERR: · ────┬─── +// CHECK:STDERR: · ╰──┤ previously defined here [RedeclPrevDef] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn A() {} @@ -95,8 +129,17 @@ alias B = A; impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_def_alias.impl.carbon:[[@LINE+3]]:4: error: duplicate name `B` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: def_alias.carbon:5:7: note: name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╭─┤ fail_def_alias.impl.carbon:[[@LINE+12]]:4 +// CHECK:STDERR: -> │ fn B() {} +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `B` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ def_alias.carbon +// CHECK:STDERR: │ alias B = A; +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn B() {} @@ -282,7 +325,7 @@ fn B() {} // CHECK:STDOUT: type: type = facet_type [concrete] // CHECK:STDOUT: %A.type.9f4a6d.1: type = fn_type @A.1 [concrete] // CHECK:STDOUT: %A.921eb9.1: %A.type.9f4a6d.1 = struct_value () [concrete] -// CHECK:STDOUT: %A.type.9f4a6d.2: type = fn_type @A.loc7 [concrete] +// CHECK:STDOUT: %A.type.9f4a6d.2: type = fn_type @A.loc15 [concrete] // CHECK:STDOUT: %A.921eb9.2: %A.type.9f4a6d.2 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -296,12 +339,12 @@ fn B() {} // CHECK:STDOUT: } // CHECK:STDOUT: %default.import.loc2_31.1 = import // CHECK:STDOUT: %default.import.loc2_31.2 = import -// CHECK:STDOUT: %A.decl: %A.type.9f4a6d.2 = fn_decl @A.loc7 [concrete = constants.%A.921eb9.2] {} {} +// CHECK:STDOUT: %A.decl: %A.type.9f4a6d.2 = fn_decl @A.loc15 [concrete = constants.%A.921eb9.2] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A.1 [from "redef_after_def.carbon"]; // CHECK:STDOUT: -// CHECK:STDOUT: fn @A.loc7() { +// CHECK:STDOUT: fn @A.loc15() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/definition/import.carbon b/toolchain/check/testdata/function/definition/import.carbon index 51377dd665a9..a3ac63298f61 100644 --- a/toolchain/check/testdata/function/definition/import.carbon +++ b/toolchain/check/testdata/function/definition/import.carbon @@ -51,12 +51,28 @@ library "[[@TEST_NAME]]"; import library "fns"; -// CHECK:STDERR: fail_def_ownership.carbon:[[@LINE+3]]:1-8: error: redeclaration of `fn A` is redundant [RedeclRedundant] -// CHECK:STDERR: fns.carbon:4:1-8: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_def_ownership.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: -> │ fn A() {}; +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of `fn A` is redundant [RedeclRedundant] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ fns.carbon +// CHECK:STDERR: │ fn A() {} +// CHECK:STDERR: · ────┬─── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn A() {}; -// CHECK:STDERR: fail_def_ownership.carbon:[[@LINE+3]]:1-20: error: redeclaration of `fn B` is redundant [RedeclRedundant] -// CHECK:STDERR: fns.carbon:5:1-21: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_def_ownership.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: -> │ fn B(b: i32) -> i32; +// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of `fn B` is redundant [RedeclRedundant] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ fns.carbon +// CHECK:STDERR: │ fn B(b: i32) -> i32 { return b; } +// CHECK:STDERR: · ──────────┬────────── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn B(b: i32) -> i32; @@ -66,13 +82,31 @@ library "[[@TEST_NAME]]"; import library "extern"; -// CHECK:STDERR: fail_redecl_then_def.carbon:[[@LINE+3]]:1-7: error: redeclarations of `fn A` must match use of `extern` [RedeclExternMismatch] -// CHECK:STDERR: extern.carbon:4:1-14: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_redecl_then_def.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: -> │ fn A(); +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclarations of `fn A` must match use of `extern` +// CHECK:STDERR: · ┃ [RedeclExternMismatch] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ extern.carbon +// CHECK:STDERR: │ extern fn A(); +// CHECK:STDERR: · ───────┬────── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn A(); -// CHECK:STDERR: fail_redecl_then_def.carbon:[[@LINE+3]]:1-8: error: redeclarations of `fn A` must match use of `extern` [RedeclExternMismatch] -// CHECK:STDERR: extern.carbon:4:1-14: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_redecl_then_def.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: -> │ fn A() {} +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclarations of `fn A` must match use of `extern` +// CHECK:STDERR: · ┃ [RedeclExternMismatch] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ extern.carbon +// CHECK:STDERR: │ extern fn A(); +// CHECK:STDERR: · ───────┬────── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn A() {} @@ -82,8 +116,17 @@ library "[[@TEST_NAME]]"; import library "fns"; -// CHECK:STDERR: fail_mix_extern_decl.carbon:[[@LINE+3]]:1-14: error: redeclarations of `fn D` must match use of `extern` [RedeclExternMismatch] -// CHECK:STDERR: fns.carbon:7:1-7: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_mix_extern_decl.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: -> │ extern fn D(); +// CHECK:STDERR: · ━━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclarations of `fn D` must match use of `extern` +// CHECK:STDERR: · ┃ [RedeclExternMismatch] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ fns.carbon +// CHECK:STDERR: │ fn D(); +// CHECK:STDERR: · ───┬─── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: extern fn D(); @@ -408,7 +451,7 @@ fn D() {} // CHECK:STDOUT: type: type = facet_type [concrete] // CHECK:STDOUT: %A.type.9f4a6d.1: type = fn_type @A.1 [concrete] // CHECK:STDOUT: %A.921eb9.1: %A.type.9f4a6d.1 = struct_value () [concrete] -// CHECK:STDOUT: %A.type.9f4a6d.2: type = fn_type @A.loc9 [concrete] +// CHECK:STDOUT: %A.type.9f4a6d.2: type = fn_type @A.loc17 [concrete] // CHECK:STDOUT: %A.921eb9.2: %A.type.9f4a6d.2 = struct_value () [concrete] // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete] // CHECK:STDOUT: %Int.type: type = parameterized_class_name_type @Int [concrete] @@ -441,12 +484,12 @@ fn D() {} // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %default.import = import -// CHECK:STDOUT: %A.decl: %A.type.9f4a6d.2 = fn_decl @A.loc9 [concrete = constants.%A.921eb9.2] {} {} +// CHECK:STDOUT: %A.decl: %A.type.9f4a6d.2 = fn_decl @A.loc17 [concrete = constants.%A.921eb9.2] {} {} // CHECK:STDOUT: %B.decl: %B.type = fn_decl @B [concrete = constants.%B] {} { -// CHECK:STDOUT: %i32.loc13_17: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %.loc13: Core.Form = init_form %i32.loc13_17 [concrete = constants.%.0b3] +// CHECK:STDOUT: %i32.loc29_17: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc29: Core.Form = init_form %i32.loc29_17 [concrete = constants.%.0b3] // CHECK:STDOUT: %b.param: %i32 = value_param call_param0 -// CHECK:STDOUT: %i32.loc13_9: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc29_9: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %b: %i32 = wrapper_binding b, %b.param // CHECK:STDOUT: %return.param: ref %i32 = out_param call_param1 // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param @@ -455,7 +498,7 @@ fn D() {} // CHECK:STDOUT: // CHECK:STDOUT: fn @A.1 [from "fns.carbon"]; // CHECK:STDOUT: -// CHECK:STDOUT: fn @A.loc9() { +// CHECK:STDOUT: fn @A.loc17() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -479,13 +522,13 @@ fn D() {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .A = %A.decl.loc9 +// CHECK:STDOUT: .A = %A.decl.loc18 // CHECK:STDOUT: .Core = imports.%Core // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %default.import = import -// CHECK:STDOUT: %A.decl.loc9: %A.type = fn_decl @A [concrete = constants.%A] {} {} -// CHECK:STDOUT: %A.decl.loc14: %A.type = fn_decl @A [concrete = constants.%A] {} {} +// CHECK:STDOUT: %A.decl.loc18: %A.type = fn_decl @A [concrete = constants.%A] {} {} +// CHECK:STDOUT: %A.decl.loc32: %A.type = fn_decl @A [concrete = constants.%A] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: extern fn @A() [from "extern.carbon"] { @@ -516,13 +559,13 @@ fn D() {} // CHECK:STDOUT: .A = imports.%Main.A // CHECK:STDOUT: .B = imports.%Main.B // CHECK:STDOUT: .C = imports.%Main.C -// CHECK:STDOUT: .D = %D.decl.loc9 +// CHECK:STDOUT: .D = %D.decl.loc18 // CHECK:STDOUT: .Core = imports.%Core // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %default.import = import -// CHECK:STDOUT: %D.decl.loc9: %D.type = fn_decl @D [concrete = constants.%D] {} {} -// CHECK:STDOUT: %D.decl.loc11: %D.type = fn_decl @D [concrete = constants.%D] {} {} +// CHECK:STDOUT: %D.decl.loc18: %D.type = fn_decl @D [concrete = constants.%D] {} {} +// CHECK:STDOUT: %D.decl.loc20: %D.type = fn_decl @D [concrete = constants.%D] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @D() [from "fns.carbon"] { diff --git a/toolchain/check/testdata/function/definition/import_access.carbon b/toolchain/check/testdata/function/definition/import_access.carbon index e4413ad11357..42433b4c576d 100644 --- a/toolchain/check/testdata/function/definition/import_access.carbon +++ b/toolchain/check/testdata/function/definition/import_access.carbon @@ -52,7 +52,11 @@ package Test library "[[@TEST_NAME]]"; import library "def"; -// CHECK:STDERR: fail_local_def.carbon:[[@LINE+2]]:13-15: error: name `Def` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_local_def.carbon:[[@LINE+6]]:13 +// CHECK:STDERR: -> │ var f: () = Def(); +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┗━━┫ error: name `Def` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var f: () = Def(); @@ -62,7 +66,12 @@ package Other library "[[@TEST_NAME]]"; import Test library "def"; -// CHECK:STDERR: fail_other_def.carbon:[[@LINE+2]]:13-20: error: member name `Def` not found in `Test` [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╭─┤ fail_other_def.carbon:[[@LINE+7]]:13 +// CHECK:STDERR: -> │ var f: () = Test.Def(); +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: member name `Def` not found in `Test` +// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var f: () = Test.Def(); @@ -78,7 +87,11 @@ package Test library "[[@TEST_NAME]]"; import library "forward_with_def"; -// CHECK:STDERR: fail_local_forward_with_def.carbon:[[@LINE+2]]:13-26: error: name `ForwardWithDef` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_local_forward_with_def.carbon:[[@LINE+6]]:13 +// CHECK:STDERR: -> │ var f: () = ForwardWithDef(); +// CHECK:STDERR: · ━━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: name `ForwardWithDef` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var f: () = ForwardWithDef(); @@ -88,7 +101,12 @@ package Other library "[[@TEST_NAME]]"; import Test library "forward_with_def"; -// CHECK:STDERR: fail_other_forward_with_def.carbon:[[@LINE+2]]:13-31: error: member name `ForwardWithDef` not found in `Test` [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╭─┤ fail_other_forward_with_def.carbon:[[@LINE+7]]:13 +// CHECK:STDERR: -> │ var f: () = Test.ForwardWithDef(); +// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: member name `ForwardWithDef` not found in `Test` +// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var f: () = Test.ForwardWithDef(); @@ -106,7 +124,11 @@ package Test library "[[@TEST_NAME]]"; import library "forward"; -// CHECK:STDERR: fail_local_forward.carbon:[[@LINE+2]]:13-19: error: name `Forward` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_local_forward.carbon:[[@LINE+6]]:13 +// CHECK:STDERR: -> │ var f: () = Forward(); +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: name `Forward` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var f: () = Forward(); @@ -116,7 +138,12 @@ package Other library "[[@TEST_NAME]]"; import Test library "forward"; -// CHECK:STDERR: fail_other_forward.carbon:[[@LINE+2]]:13-24: error: member name `Forward` not found in `Test` [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╭─┤ fail_other_forward.carbon:[[@LINE+7]]:13 +// CHECK:STDERR: -> │ var f: () = Test.Forward(); +// CHECK:STDERR: · ━━━━━━┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: member name `Forward` not found in `Test` +// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var f: () = Test.Forward(); @@ -250,9 +277,9 @@ private fn Redecl() {} // CHECK:STDOUT: } // CHECK:STDOUT: %default.import = import // CHECK:STDOUT: %f.var: ref %empty_tuple.type = var_storage %f.var_patt [concrete] -// CHECK:STDOUT: %.loc8_9.1: type = splice_block %.loc8_9.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc8_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_9.3: type = converted %.loc8_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc12_9.1: type = splice_block %.loc12_9.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc12_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc12_9.3: type = converted %.loc12_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %f: ref %empty_tuple.type = wrapper_binding f, %f.var [concrete = %f.var] // CHECK:STDOUT: name_binding_decl { @@ -293,9 +320,9 @@ private fn Redecl() {} // CHECK:STDOUT: } // CHECK:STDOUT: %Test.import = import Test // CHECK:STDOUT: %f.var: ref %empty_tuple.type = var_storage %f.var_patt [concrete] -// CHECK:STDOUT: %.loc8_9.1: type = splice_block %.loc8_9.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc8_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_9.3: type = converted %.loc8_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc13_9.1: type = splice_block %.loc13_9.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc13_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc13_9.3: type = converted %.loc13_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %f: ref %empty_tuple.type = wrapper_binding f, %f.var [concrete = %f.var] // CHECK:STDOUT: name_binding_decl { @@ -376,9 +403,9 @@ private fn Redecl() {} // CHECK:STDOUT: } // CHECK:STDOUT: %default.import = import // CHECK:STDOUT: %f.var: ref %empty_tuple.type = var_storage %f.var_patt [concrete] -// CHECK:STDOUT: %.loc8_9.1: type = splice_block %.loc8_9.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc8_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_9.3: type = converted %.loc8_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc12_9.1: type = splice_block %.loc12_9.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc12_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc12_9.3: type = converted %.loc12_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %f: ref %empty_tuple.type = wrapper_binding f, %f.var [concrete = %f.var] // CHECK:STDOUT: name_binding_decl { @@ -419,9 +446,9 @@ private fn Redecl() {} // CHECK:STDOUT: } // CHECK:STDOUT: %Test.import = import Test // CHECK:STDOUT: %f.var: ref %empty_tuple.type = var_storage %f.var_patt [concrete] -// CHECK:STDOUT: %.loc8_9.1: type = splice_block %.loc8_9.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc8_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_9.3: type = converted %.loc8_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc13_9.1: type = splice_block %.loc13_9.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc13_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc13_9.3: type = converted %.loc13_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %f: ref %empty_tuple.type = wrapper_binding f, %f.var [concrete = %f.var] // CHECK:STDOUT: name_binding_decl { @@ -506,9 +533,9 @@ private fn Redecl() {} // CHECK:STDOUT: } // CHECK:STDOUT: %default.import = import // CHECK:STDOUT: %f.var: ref %empty_tuple.type = var_storage %f.var_patt [concrete] -// CHECK:STDOUT: %.loc8_9.1: type = splice_block %.loc8_9.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc8_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_9.3: type = converted %.loc8_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc12_9.1: type = splice_block %.loc12_9.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc12_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc12_9.3: type = converted %.loc12_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %f: ref %empty_tuple.type = wrapper_binding f, %f.var [concrete = %f.var] // CHECK:STDOUT: name_binding_decl { @@ -549,9 +576,9 @@ private fn Redecl() {} // CHECK:STDOUT: } // CHECK:STDOUT: %Test.import = import Test // CHECK:STDOUT: %f.var: ref %empty_tuple.type = var_storage %f.var_patt [concrete] -// CHECK:STDOUT: %.loc8_9.1: type = splice_block %.loc8_9.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc8_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_9.3: type = converted %.loc8_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc13_9.1: type = splice_block %.loc13_9.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc13_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc13_9.3: type = converted %.loc13_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %f: ref %empty_tuple.type = wrapper_binding f, %f.var [concrete = %f.var] // CHECK:STDOUT: name_binding_decl { diff --git a/toolchain/check/testdata/function/definition/syntactic_merge.carbon b/toolchain/check/testdata/function/definition/syntactic_merge.carbon index e3c05c68cff9..bb02b66a7556 100644 --- a/toolchain/check/testdata/function/definition/syntactic_merge.carbon +++ b/toolchain/check/testdata/function/definition/syntactic_merge.carbon @@ -41,8 +41,17 @@ library "[[@TEST_NAME]]"; class C {} fn Foo(a: C); -// CHECK:STDERR: fail_parens.carbon:[[@LINE+3]]:18: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] -// CHECK:STDERR: fail_parens.carbon:[[@LINE-2]]:11: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] +// CHECK:STDERR: ╭─┤ fail_parens.carbon:[[@LINE+12]]:18 +// CHECK:STDERR: │ fn Foo(a: C); +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ comparing with previous declaration here +// CHECK:STDERR: · │ [RedeclParamSyntaxPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn Foo(unused a: (C)) {} +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: redeclaration syntax differs here +// CHECK:STDERR: · ┃ [RedeclParamSyntaxDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Foo(unused a: (C)) {} @@ -52,14 +61,34 @@ library "[[@TEST_NAME]]"; class C {} -// CHECK:STDERR: fail_only_implicit_params.carbon:[[@LINE+4]]:8-19: error: implicit parameters of functions must be constant [ImplictParamMustBeConstant] +// CHECK:STDERR: ╭─┤ fail_only_implicit_params.carbon:[[@LINE+14]]:8 +// CHECK:STDERR: -> │ fn Foo[runtime a: C]; +// CHECK:STDERR: · ━━━━━━┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: implicit parameters of functions must be constant +// CHECK:STDERR: · ┃ [ImplictParamMustBeConstant] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_only_implicit_params.carbon:[[@LINE+2]]:1-21: error: semantics TODO: `function with positional parameters` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_only_implicit_params.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn Foo[runtime a: C]; +// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `function with positional parameters` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Foo[runtime a: C]; -// CHECK:STDERR: fail_only_implicit_params.carbon:[[@LINE+4]]:8-21: error: implicit parameters of functions must be constant [ImplictParamMustBeConstant] +// CHECK:STDERR: ╭─┤ fail_only_implicit_params.carbon:[[@LINE+14]]:8 +// CHECK:STDERR: -> │ fn Foo[runtime a: (C)] {} +// CHECK:STDERR: · ━━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: implicit parameters of functions must be constant +// CHECK:STDERR: · ┃ [ImplictParamMustBeConstant] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_only_implicit_params.carbon:[[@LINE+2]]:1-24: error: semantics TODO: `function with positional parameters` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_only_implicit_params.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn Foo[runtime a: (C)] {} +// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `function with positional parameters` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Foo[runtime a: (C)] {} @@ -70,8 +99,17 @@ library "[[@TEST_NAME]]"; class C {} fn Foo(_: C); -// CHECK:STDERR: fail_raw_identifier.carbon:[[@LINE+3]]:11-13: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] -// CHECK:STDERR: fail_raw_identifier.carbon:[[@LINE-2]]:11: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] +// CHECK:STDERR: ╭─┤ fail_raw_identifier.carbon:[[@LINE+12]]:11 +// CHECK:STDERR: │ fn Foo(_: C); +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ comparing with previous declaration here +// CHECK:STDERR: · │ [RedeclParamSyntaxPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn Foo(_: r#C) {} +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration syntax differs here +// CHECK:STDERR: · ┃ [RedeclParamSyntaxDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Foo(_: r#C) {} @@ -100,8 +138,17 @@ class C {} alias D = C; fn Foo(a: C); -// CHECK:STDERR: fail_name_mismatch.carbon:[[@LINE+3]]:15-18: error: redeclaration differs at parameter 1 [RedeclParamDiffers] -// CHECK:STDERR: fail_name_mismatch.carbon:[[@LINE-2]]:8-11: note: previous declaration's corresponding parameter here [RedeclParamPrevious] +// CHECK:STDERR: ╭─┤ fail_name_mismatch.carbon:[[@LINE+12]]:15 +// CHECK:STDERR: │ fn Foo(a: C); +// CHECK:STDERR: · ──┬─ +// CHECK:STDERR: · ╰──┤ previous declaration's corresponding parameter here +// CHECK:STDERR: · │ [RedeclParamPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn Foo(unused b: D) {} +// CHECK:STDERR: · ━━┳━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration differs at parameter 1 +// CHECK:STDERR: · ┃ [RedeclParamDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Foo(unused b: D) {} @@ -113,8 +160,17 @@ class C {} alias D = C; fn Foo(a: C); -// CHECK:STDERR: fail_alias.carbon:[[@LINE+3]]:18: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] -// CHECK:STDERR: fail_alias.carbon:[[@LINE-2]]:11: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] +// CHECK:STDERR: ╭─┤ fail_alias.carbon:[[@LINE+12]]:18 +// CHECK:STDERR: │ fn Foo(a: C); +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ comparing with previous declaration here +// CHECK:STDERR: · │ [RedeclParamSyntaxPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn Foo(unused a: D) {} +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: redeclaration syntax differs here +// CHECK:STDERR: · ┃ [RedeclParamSyntaxDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Foo(unused a: D) {} @@ -126,8 +182,17 @@ class C {} alias D = C; fn Foo[a: C](); -// CHECK:STDERR: fail_deduced_alias.carbon:[[@LINE+3]]:18: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] -// CHECK:STDERR: fail_deduced_alias.carbon:[[@LINE-2]]:11: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] +// CHECK:STDERR: ╭─┤ fail_deduced_alias.carbon:[[@LINE+12]]:18 +// CHECK:STDERR: │ fn Foo[a: C](); +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ comparing with previous declaration here +// CHECK:STDERR: · │ [RedeclParamSyntaxPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn Foo[unused a: D]() {} +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: redeclaration syntax differs here +// CHECK:STDERR: · ┃ [RedeclParamSyntaxDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Foo[unused a: D]() {} @@ -164,10 +229,25 @@ library "[[@TEST_NAME]]"; class C {} fn Foo(a: const C); -// CHECK:STDERR: fail_repeat_const.carbon:[[@LINE+5]]:18-32: warning: `const` applied repeatedly to the same type has no additional effect [RepeatedConst] +// CHECK:STDERR: ╭─┤ fail_repeat_const.carbon:[[@LINE+20]]:18 +// CHECK:STDERR: -> │ fn Foo(unused a: const (const C)) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ warning: `const` applied repeatedly to the same type has +// CHECK:STDERR: · ┃ no additional effect +// CHECK:STDERR: · ┃ [RepeatedConst] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_repeat_const.carbon:[[@LINE+3]]:24: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] -// CHECK:STDERR: fail_repeat_const.carbon:[[@LINE-4]]:17: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] +// CHECK:STDERR: ╭─┤ fail_repeat_const.carbon:[[@LINE+12]]:24 +// CHECK:STDERR: │ fn Foo(a: const C); +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ comparing with previous declaration here +// CHECK:STDERR: · │ [RedeclParamSyntaxPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn Foo(unused a: const (const C)) {} +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: redeclaration syntax differs here +// CHECK:STDERR: · ┃ [RedeclParamSyntaxDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Foo(unused a: const (const C)) {} @@ -312,7 +392,7 @@ fn Foo(unused a: const (const C)) {} // CHECK:STDOUT: %a.patt: %pattern_type = wrapper_binding_pattern a, %a.param_patt [concrete] // CHECK:STDOUT: %Foo.type.11c674.1: type = fn_type @Foo.loc6 [concrete] // CHECK:STDOUT: %Foo.12ccef.1: %Foo.type.11c674.1 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.11c674.2: type = fn_type @Foo.loc10 [concrete] +// CHECK:STDOUT: %Foo.type.11c674.2: type = fn_type @Foo.loc19 [concrete] // CHECK:STDOUT: %Foo.12ccef.2: %Foo.type.11c674.2 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -330,7 +410,7 @@ fn Foo(unused a: const (const C)) {} // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %a: %C = wrapper_binding a, %a.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Foo.decl.loc10: %Foo.type.11c674.2 = fn_decl @Foo.loc10 [concrete = constants.%Foo.12ccef.2] { +// CHECK:STDOUT: %Foo.decl.loc19: %Foo.type.11c674.2 = fn_decl @Foo.loc19 [concrete = constants.%Foo.12ccef.2] { // CHECK:STDOUT: %a.param_patt: %pattern_type = value_param_pattern [concrete = constants.%a.param_patt] // CHECK:STDOUT: %a.patt: %pattern_type = wrapper_binding_pattern a, %a.param_patt [concrete = constants.%a.patt] // CHECK:STDOUT: } { @@ -350,7 +430,7 @@ fn Foo(unused a: const (const C)) {} // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo.loc6(%a.param: %C); // CHECK:STDOUT: -// CHECK:STDOUT: fn @Foo.loc10(%a.param: %C) { +// CHECK:STDOUT: fn @Foo.loc19(%a.param: %C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -362,20 +442,20 @@ fn Foo(unused a: const (const C)) {} // CHECK:STDOUT: %C: type = class_type @C [concrete] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] -// CHECK:STDOUT: %Foo.type.11c674.1: type = fn_type @Foo.loc10 [concrete] +// CHECK:STDOUT: %Foo.type.11c674.1: type = fn_type @Foo.loc20 [concrete] // CHECK:STDOUT: %Foo.12ccef.1: %Foo.type.11c674.1 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.11c674.2: type = fn_type @Foo.loc15 [concrete] +// CHECK:STDOUT: %Foo.type.11c674.2: type = fn_type @Foo.loc35 [concrete] // CHECK:STDOUT: %Foo.12ccef.2: %Foo.type.11c674.2 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [concrete] { // CHECK:STDOUT: .C = %C.decl -// CHECK:STDOUT: .Foo = %Foo.decl.loc10 +// CHECK:STDOUT: .Foo = %Foo.decl.loc20 // CHECK:STDOUT: } // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {} -// CHECK:STDOUT: %Foo.decl.loc10: %Foo.type.11c674.1 = fn_decl @Foo.loc10 [concrete = constants.%Foo.12ccef.1] {} {} -// CHECK:STDOUT: %Foo.decl.loc15: %Foo.type.11c674.2 = fn_decl @Foo.loc15 [concrete = constants.%Foo.12ccef.2] {} {} +// CHECK:STDOUT: %Foo.decl.loc20: %Foo.type.11c674.1 = fn_decl @Foo.loc20 [concrete = constants.%Foo.12ccef.1] {} {} +// CHECK:STDOUT: %Foo.decl.loc35: %Foo.type.11c674.2 = fn_decl @Foo.loc35 [concrete = constants.%Foo.12ccef.2] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { @@ -386,9 +466,9 @@ fn Foo(unused a: const (const C)) {} // CHECK:STDOUT: .Self = constants.%C // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Foo.loc10(); +// CHECK:STDOUT: fn @Foo.loc20(); // CHECK:STDOUT: -// CHECK:STDOUT: fn @Foo.loc15() { +// CHECK:STDOUT: fn @Foo.loc35() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -405,7 +485,7 @@ fn Foo(unused a: const (const C)) {} // CHECK:STDOUT: %_.patt: %pattern_type = wrapper_binding_pattern _, %_.param_patt [concrete] // CHECK:STDOUT: %Foo.type.11c674.1: type = fn_type @Foo.loc6 [concrete] // CHECK:STDOUT: %Foo.12ccef.1: %Foo.type.11c674.1 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.11c674.2: type = fn_type @Foo.loc10 [concrete] +// CHECK:STDOUT: %Foo.type.11c674.2: type = fn_type @Foo.loc19 [concrete] // CHECK:STDOUT: %Foo.12ccef.2: %Foo.type.11c674.2 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -423,7 +503,7 @@ fn Foo(unused a: const (const C)) {} // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %_: %C = wrapper_binding _, %_.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Foo.decl.loc10: %Foo.type.11c674.2 = fn_decl @Foo.loc10 [concrete = constants.%Foo.12ccef.2] { +// CHECK:STDOUT: %Foo.decl.loc19: %Foo.type.11c674.2 = fn_decl @Foo.loc19 [concrete = constants.%Foo.12ccef.2] { // CHECK:STDOUT: %_.param_patt: %pattern_type = value_param_pattern [concrete = constants.%_.param_patt] // CHECK:STDOUT: %_.patt: %pattern_type = wrapper_binding_pattern _, %_.param_patt [concrete = constants.%_.patt] // CHECK:STDOUT: } { @@ -443,7 +523,7 @@ fn Foo(unused a: const (const C)) {} // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo.loc6(%_.param: %C); // CHECK:STDOUT: -// CHECK:STDOUT: fn @Foo.loc10(%_.param: %C) { +// CHECK:STDOUT: fn @Foo.loc19(%_.param: %C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -586,7 +666,7 @@ fn Foo(unused a: const (const C)) {} // CHECK:STDOUT: %Foo.12ccef.1: %Foo.type.11c674.1 = struct_value () [concrete] // CHECK:STDOUT: %b.param_patt: %pattern_type = value_param_pattern [concrete] // CHECK:STDOUT: %b.patt: %pattern_type = wrapper_binding_pattern b, %b.param_patt [concrete] -// CHECK:STDOUT: %Foo.type.11c674.2: type = fn_type @Foo.loc11 [concrete] +// CHECK:STDOUT: %Foo.type.11c674.2: type = fn_type @Foo.loc20 [concrete] // CHECK:STDOUT: %Foo.12ccef.2: %Foo.type.11c674.2 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -607,7 +687,7 @@ fn Foo(unused a: const (const C)) {} // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %a: %C = wrapper_binding a, %a.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Foo.decl.loc11: %Foo.type.11c674.2 = fn_decl @Foo.loc11 [concrete = constants.%Foo.12ccef.2] { +// CHECK:STDOUT: %Foo.decl.loc20: %Foo.type.11c674.2 = fn_decl @Foo.loc20 [concrete = constants.%Foo.12ccef.2] { // CHECK:STDOUT: %b.param_patt: %pattern_type = value_param_pattern [concrete = constants.%b.param_patt] // CHECK:STDOUT: %b.patt: %pattern_type = wrapper_binding_pattern b, %b.param_patt [concrete = constants.%b.patt] // CHECK:STDOUT: } { @@ -627,7 +707,7 @@ fn Foo(unused a: const (const C)) {} // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo.loc7(%a.param: %C); // CHECK:STDOUT: -// CHECK:STDOUT: fn @Foo.loc11(%b.param: %C) { +// CHECK:STDOUT: fn @Foo.loc20(%b.param: %C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -644,7 +724,7 @@ fn Foo(unused a: const (const C)) {} // CHECK:STDOUT: %a.patt: %pattern_type = wrapper_binding_pattern a, %a.param_patt [concrete] // CHECK:STDOUT: %Foo.type.11c674.1: type = fn_type @Foo.loc7 [concrete] // CHECK:STDOUT: %Foo.12ccef.1: %Foo.type.11c674.1 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.11c674.2: type = fn_type @Foo.loc11 [concrete] +// CHECK:STDOUT: %Foo.type.11c674.2: type = fn_type @Foo.loc20 [concrete] // CHECK:STDOUT: %Foo.12ccef.2: %Foo.type.11c674.2 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -665,7 +745,7 @@ fn Foo(unused a: const (const C)) {} // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %a: %C = wrapper_binding a, %a.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Foo.decl.loc11: %Foo.type.11c674.2 = fn_decl @Foo.loc11 [concrete = constants.%Foo.12ccef.2] { +// CHECK:STDOUT: %Foo.decl.loc20: %Foo.type.11c674.2 = fn_decl @Foo.loc20 [concrete = constants.%Foo.12ccef.2] { // CHECK:STDOUT: %a.param_patt: %pattern_type = value_param_pattern [concrete = constants.%a.param_patt] // CHECK:STDOUT: %a.patt: %pattern_type = wrapper_binding_pattern a, %a.param_patt [concrete = constants.%a.patt] // CHECK:STDOUT: } { @@ -685,7 +765,7 @@ fn Foo(unused a: const (const C)) {} // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo.loc7(%a.param: %C); // CHECK:STDOUT: -// CHECK:STDOUT: fn @Foo.loc11(%a.param: %C) { +// CHECK:STDOUT: fn @Foo.loc20(%a.param: %C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -704,7 +784,7 @@ fn Foo(unused a: const (const C)) {} // CHECK:STDOUT: %Foo.type.11c674.1: type = fn_type @Foo.loc7 [concrete] // CHECK:STDOUT: %Foo.12ccef.1: %Foo.type.11c674.1 = struct_value () [concrete] // CHECK:STDOUT: %a.1bf9e8.2: %C = symbolic_binding a, 0 [symbolic] -// CHECK:STDOUT: %Foo.type.11c674.2: type = fn_type @Foo.loc11 [concrete] +// CHECK:STDOUT: %Foo.type.11c674.2: type = fn_type @Foo.loc20 [concrete] // CHECK:STDOUT: %Foo.12ccef.2: %Foo.type.11c674.2 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -726,14 +806,14 @@ fn Foo(unused a: const (const C)) {} // CHECK:STDOUT: } // CHECK:STDOUT: %a.loc7_9.2: %C = symbolic_binding a, 0 [symbolic = %a.loc7_9.1 (constants.%a.1bf9e8.1)] // CHECK:STDOUT: } -// CHECK:STDOUT: %Foo.decl.loc11: %Foo.type.11c674.2 = fn_decl @Foo.loc11 [concrete = constants.%Foo.12ccef.2] { -// CHECK:STDOUT: %a.patt.loc11_16.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc11_16.2 (constants.%a.patt)] +// CHECK:STDOUT: %Foo.decl.loc20: %Foo.type.11c674.2 = fn_decl @Foo.loc20 [concrete = constants.%Foo.12ccef.2] { +// CHECK:STDOUT: %a.patt.loc20_16.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc20_16.2 (constants.%a.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc11: type = splice_block %D.ref [concrete = constants.%C] { +// CHECK:STDOUT: %.loc20: type = splice_block %D.ref [concrete = constants.%C] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D [concrete = constants.%C] // CHECK:STDOUT: } -// CHECK:STDOUT: %a.loc11_16.3: %C = symbolic_binding a, 0 [symbolic = %a.loc11_16.2 (constants.%a.1bf9e8.2)] +// CHECK:STDOUT: %a.loc20_16.3: %C = symbolic_binding a, 0 [symbolic = %a.loc20_16.2 (constants.%a.1bf9e8.2)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -752,10 +832,10 @@ fn Foo(unused a: const (const C)) {} // CHECK:STDOUT: fn(); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Foo.loc11(%a.loc11_16.3: %C) { -// CHECK:STDOUT: %a.patt.loc11_16.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc11_16.2 (constants.%a.patt)] -// CHECK:STDOUT: %a.loc11_16.1: %C = symbolic_binding a, 0 [symbolic = %a.loc11_16.1 (constants.%a.1bf9e8.1)] -// CHECK:STDOUT: %a.loc11_16.2: %C = symbolic_binding a, 0 [symbolic = %a.loc11_16.2 (constants.%a.1bf9e8.2)] +// CHECK:STDOUT: generic fn @Foo.loc20(%a.loc20_16.3: %C) { +// CHECK:STDOUT: %a.patt.loc20_16.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc20_16.2 (constants.%a.patt)] +// CHECK:STDOUT: %a.loc20_16.1: %C = symbolic_binding a, 0 [symbolic = %a.loc20_16.1 (constants.%a.1bf9e8.1)] +// CHECK:STDOUT: %a.loc20_16.2: %C = symbolic_binding a, 0 [symbolic = %a.loc20_16.2 (constants.%a.1bf9e8.2)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -770,10 +850,10 @@ fn Foo(unused a: const (const C)) {} // CHECK:STDOUT: %a.loc7_9.1 => constants.%a.1bf9e8.1 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Foo.loc11(constants.%a.1bf9e8.2) { -// CHECK:STDOUT: %a.patt.loc11_16.2 => constants.%a.patt -// CHECK:STDOUT: %a.loc11_16.1 => constants.%a.1bf9e8.2 -// CHECK:STDOUT: %a.loc11_16.2 => constants.%a.1bf9e8.2 +// CHECK:STDOUT: specific @Foo.loc20(constants.%a.1bf9e8.2) { +// CHECK:STDOUT: %a.patt.loc20_16.2 => constants.%a.patt +// CHECK:STDOUT: %a.loc20_16.1 => constants.%a.1bf9e8.2 +// CHECK:STDOUT: %a.loc20_16.2 => constants.%a.1bf9e8.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- todo_fail_alias_in_return.carbon @@ -943,7 +1023,7 @@ fn Foo(unused a: const (const C)) {} // CHECK:STDOUT: %a.patt: %pattern_type = wrapper_binding_pattern a, %a.param_patt [concrete] // CHECK:STDOUT: %Foo.type.11c674.1: type = fn_type @Foo.loc6 [concrete] // CHECK:STDOUT: %Foo.12ccef.1: %Foo.type.11c674.1 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.11c674.2: type = fn_type @Foo.loc12 [concrete] +// CHECK:STDOUT: %Foo.type.11c674.2: type = fn_type @Foo.loc27 [concrete] // CHECK:STDOUT: %Foo.12ccef.2: %Foo.type.11c674.2 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -964,15 +1044,15 @@ fn Foo(unused a: const (const C)) {} // CHECK:STDOUT: } // CHECK:STDOUT: %a: %const = wrapper_binding a, %a.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Foo.decl.loc12: %Foo.type.11c674.2 = fn_decl @Foo.loc12 [concrete = constants.%Foo.12ccef.2] { +// CHECK:STDOUT: %Foo.decl.loc27: %Foo.type.11c674.2 = fn_decl @Foo.loc27 [concrete = constants.%Foo.12ccef.2] { // CHECK:STDOUT: %a.param_patt: %pattern_type = value_param_pattern [concrete = constants.%a.param_patt] // CHECK:STDOUT: %a.patt: %pattern_type = wrapper_binding_pattern a, %a.param_patt [concrete = constants.%a.patt] // CHECK:STDOUT: } { // CHECK:STDOUT: %a.param: %const = value_param call_param0 -// CHECK:STDOUT: %.loc12: type = splice_block %const.loc12_18 [concrete = constants.%const] { +// CHECK:STDOUT: %.loc27: type = splice_block %const.loc27_18 [concrete = constants.%const] { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %const.loc12_25: type = const_type %C.ref [concrete = constants.%const] -// CHECK:STDOUT: %const.loc12_18: type = const_type %const.loc12_25 [concrete = constants.%const] +// CHECK:STDOUT: %const.loc27_25: type = const_type %C.ref [concrete = constants.%const] +// CHECK:STDOUT: %const.loc27_18: type = const_type %const.loc27_25 [concrete = constants.%const] // CHECK:STDOUT: } // CHECK:STDOUT: %a: %const = wrapper_binding a, %a.param // CHECK:STDOUT: } @@ -988,7 +1068,7 @@ fn Foo(unused a: const (const C)) {} // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo.loc6(%a.param: %const); // CHECK:STDOUT: -// CHECK:STDOUT: fn @Foo.loc12(%a.param: %const) { +// CHECK:STDOUT: fn @Foo.loc27(%a.param: %const) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/definition/terse.carbon b/toolchain/check/testdata/function/definition/terse.carbon index f7e0fd050c07..6028b19cda20 100644 --- a/toolchain/check/testdata/function/definition/terse.carbon +++ b/toolchain/check/testdata/function/definition/terse.carbon @@ -90,18 +90,34 @@ fn Run() => (); // --- fail_main_run_bool.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_main_run_bool.carbon:[[@LINE+2]]:1-11: error: invalid return type for `Main.Run` function; expected `fn (...)` or `fn (...) -> i32` [InvalidMainRunReturnType] +// CHECK:STDERR: ╭─┤ fail_main_run_bool.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ fn Run() => true; +// CHECK:STDERR: · ┳━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid return type for `Main.Run` function; expected `fn (...)` or +// CHECK:STDERR: · ┃ `fn (...) -> i32` +// CHECK:STDERR: · ┃ [InvalidMainRunReturnType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Run() => true; // --- fail_return_type.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_return_type.carbon:[[@LINE+2]]:14-19: error: cannot specify a return type with `=>` [ReturnTypeInTerseFunction] +// CHECK:STDERR: ╭─┤ fail_return_type.carbon:[[@LINE+7]]:14 +// CHECK:STDERR: -> │ fn G(x: i32) -> i32 => x; +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: cannot specify a return type with `=>` +// CHECK:STDERR: · ┃ [ReturnTypeInTerseFunction] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn G(x: i32) -> i32 => x; -// CHECK:STDERR: fail_return_type.carbon:[[@LINE+2]]:18-34: error: cannot specify a return form with `=>` [ReturnTypeInTerseFunction] +// CHECK:STDERR: ╭─┤ fail_return_type.carbon:[[@LINE+7]]:18 +// CHECK:STDERR: -> │ fn H(ref x: i32) ->? form(ref i32) => x; +// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot specify a return form with `=>` +// CHECK:STDERR: · ┃ [ReturnTypeInTerseFunction] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn H(ref x: i32) ->? form(ref i32) => x; @@ -109,20 +125,44 @@ fn H(ref x: i32) ->? form(ref i32) => x; library "[[@TEST_NAME]]"; fn DeclaredI32() -> i32; -// CHECK:STDERR: fail_redecl.carbon:[[@LINE+3]]:1-19: error: redeclaration of function with deduced return type [DeducedReturnTypeRedecl] -// CHECK:STDERR: fail_redecl.carbon:[[@LINE-2]]:1-24: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_redecl.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: │ fn DeclaredI32() -> i32; +// CHECK:STDERR: · ────────────┬─────────── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn DeclaredI32() => 0 as i32; +// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of function with deduced return type +// CHECK:STDERR: · ┃ [DeducedReturnTypeRedecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn DeclaredI32() => 0 as i32; fn DeclaredUnit(); -// CHECK:STDERR: fail_redecl.carbon:[[@LINE+3]]:1-20: error: redeclaration of function with deduced return type [DeducedReturnTypeRedecl] -// CHECK:STDERR: fail_redecl.carbon:[[@LINE-2]]:1-18: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_redecl.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: │ fn DeclaredUnit(); +// CHECK:STDERR: · ─────────┬──────── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn DeclaredUnit() => (); +// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of function with deduced return type +// CHECK:STDERR: · ┃ [DeducedReturnTypeRedecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn DeclaredUnit() => (); fn TerseFirst() => 0 as i32; -// CHECK:STDERR: fail_redecl.carbon:[[@LINE+3]]:1-18: error: redeclaration of function with deduced return type [DeducedReturnTypeRedecl] -// CHECK:STDERR: fail_redecl.carbon:[[@LINE-2]]:1-18: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_redecl.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: │ fn TerseFirst() => 0 as i32; +// CHECK:STDERR: · ─────────┬──────── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn TerseFirst() => 1 as i32; +// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of function with deduced return type +// CHECK:STDERR: · ┃ [DeducedReturnTypeRedecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn TerseFirst() => 1 as i32; @@ -133,23 +173,75 @@ class Incomplete; // TODO: This test produces too many error messages for the same problem. -// CHECK:STDERR: fail_incomplete_return.carbon:[[@LINE+3]]:39-40: error: function returns incomplete type `Incomplete` [IncompleteTypeInFunctionReturnType] -// CHECK:STDERR: fail_incomplete_return.carbon:[[@LINE-5]]:1-17: note: class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: ╭─┤ fail_incomplete_return.carbon:[[@LINE+12]]:39 +// CHECK:STDERR: │ class Incomplete; +// CHECK:STDERR: · ────────┬──────── +// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn DerefIncomplete(p: Incomplete*) => *p; +// CHECK:STDERR: · ┳━ +// CHECK:STDERR: · ┗━━┫ error: function returns incomplete +// CHECK:STDERR: · ┃ type `Incomplete` +// CHECK:STDERR: · ┃ [IncompleteTypeInFunctionReturnType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn DerefIncomplete(p: Incomplete*) => *p; fn GenericDerefIncomplete[template T: type](p: T*) => *p; fn CallGenericDerefIncomplete(p: Incomplete*) { - // CHECK:STDERR: fail_incomplete_return.carbon:[[@LINE+11]]:3-27: error: unable to monomorphize specific `GenericDerefIncomplete(Incomplete)` [ResolvingSpecificHere] - // CHECK:STDERR: fail_incomplete_return.carbon:[[@LINE-3]]:55-56: note: `T` evaluates to incomplete type `Incomplete` [IncompleteTypeInMonomorphization] - // CHECK:STDERR: fail_incomplete_return.carbon:[[@LINE-13]]:1-17: note: class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ╭─┤ fail_incomplete_return.carbon:[[@LINE+54]]:3 + // CHECK:STDERR: │ class Incomplete; + // CHECK:STDERR: · ────────┬──────── + // CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ fn GenericDerefIncomplete[template T: type](p: T*) => *p; + // CHECK:STDERR: · ┬─ + // CHECK:STDERR: · ╰──┤ `T` evaluates to + // CHECK:STDERR: · │ incomplete type + // CHECK:STDERR: · │ `Incomplete` + // CHECK:STDERR: · │ [IncompleteTypeInMonomorphization] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ GenericDerefIncomplete(p); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: unable to monomorphize specific + // CHECK:STDERR: · ┃ `GenericDerefIncomplete(Incomplete)` + // CHECK:STDERR: · ┃ [ResolvingSpecificHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_incomplete_return.carbon:[[@LINE+7]]:3-27: error: unable to monomorphize specific `GenericDerefIncomplete(Incomplete)` [ResolvingSpecificHere] - // CHECK:STDERR: fail_incomplete_return.carbon:[[@LINE-7]]:55-56: note: cannot access member of interface `Core.Copy` in type `Incomplete` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_incomplete_return.carbon:[[@LINE+35]]:3 + // CHECK:STDERR: │ fn GenericDerefIncomplete[template T: type](p: T*) => *p; + // CHECK:STDERR: · ┬─ + // CHECK:STDERR: · ╰──┤ cannot access member + // CHECK:STDERR: · │ of interface + // CHECK:STDERR: · │ `Core.Copy` in type + // CHECK:STDERR: · │ `Incomplete` that + // CHECK:STDERR: · │ does not implement + // CHECK:STDERR: · │ that interface + // CHECK:STDERR: · │ [MissingImplInMemberAccess] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ GenericDerefIncomplete(p); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: unable to monomorphize specific + // CHECK:STDERR: · ┃ `GenericDerefIncomplete(Incomplete)` + // CHECK:STDERR: · ┃ [ResolvingSpecificHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_incomplete_return.carbon:[[@LINE+4]]:3-27: error: function returns incomplete type `Incomplete` [IncompleteTypeInFunctionReturnType] - // CHECK:STDERR: fail_incomplete_return.carbon:[[@LINE-19]]:1-17: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: fail_incomplete_return.carbon:[[@LINE-11]]:55-56: note: return type declared here [IncompleteReturnTypeHere] + // CHECK:STDERR: ╭─┤ fail_incomplete_return.carbon:[[@LINE+17]]:3 + // CHECK:STDERR: │ class Incomplete; + // CHECK:STDERR: · ────────┬──────── + // CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ fn GenericDerefIncomplete[template T: type](p: T*) => *p; + // CHECK:STDERR: · ┬─ + // CHECK:STDERR: · ╰──┤ return type declared + // CHECK:STDERR: · │ here + // CHECK:STDERR: · │ [IncompleteReturnTypeHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ GenericDerefIncomplete(p); + // CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: function returns incomplete type `Incomplete` + // CHECK:STDERR: · ┃ [IncompleteTypeInFunctionReturnType] + // CHECK:STDERR: ╰──── // CHECK:STDERR: GenericDerefIncomplete(p); } @@ -157,25 +249,52 @@ fn CallGenericDerefIncomplete(p: Incomplete*) { // --- fail_unused.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_unused.carbon:[[@LINE+5]]:15-20: warning: binding `x` unused [UnusedBinding] +// CHECK:STDERR: ╭─┤ fail_unused.carbon:[[@LINE+15]]:15 +// CHECK:STDERR: -> │ fn UnusedTest(x: i32, unused y: i32) => y; +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┗━━┫ warning: binding `x` unused [UnusedBinding] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_unused.carbon:[[@LINE+3]]:30-35: error: variable `y` marked `unused` but used [UnusedButUsed] -// CHECK:STDERR: fail_unused.carbon:[[@LINE+2]]:41: note: usage here [UnusedButUsedHere] +// CHECK:STDERR: ╭─┤ fail_unused.carbon:[[@LINE+9]]:30 +// CHECK:STDERR: -> │ fn UnusedTest(x: i32, unused y: i32) => y; +// CHECK:STDERR: · ━━━┳━━ ┬ +// CHECK:STDERR: · ┗━━━━━━━━━━┫ error: variable `y` marked `unused` +// CHECK:STDERR: · │ ┃ but used +// CHECK:STDERR: · │ ┃ [UnusedButUsed] +// CHECK:STDERR: · ╰────┤ usage here [UnusedButUsedHere] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn UnusedTest(x: i32, unused y: i32) => y; // --- fail_call_before_deduced.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_call_before_deduced.carbon:[[@LINE+3]]:23-32: error: call to `Recurse` before its return type is known [CallBeforeReturnTypeDeduced] -// CHECK:STDERR: fail_call_before_deduced.carbon:[[@LINE+2]]:1-21: note: return type of `Recurse` is deduced from its definition [ReturnTypeDeducedFromDefinition] +// CHECK:STDERR: ╭─┤ fail_call_before_deduced.carbon:[[@LINE+11]]:23 +// CHECK:STDERR: -> │ fn Recurse(x: i32) => Recurse(x); +// CHECK:STDERR: · ──────────┬────────── ┳━━━━━━━━━ +// CHECK:STDERR: · │ ┗━━┫ error: call to `Recurse` before its return type is +// CHECK:STDERR: · │ ┃ known +// CHECK:STDERR: · │ ┃ [CallBeforeReturnTypeDeduced] +// CHECK:STDERR: · ╰────────────────┤ return type of `Recurse` is deduced from its +// CHECK:STDERR: · │ definition +// CHECK:STDERR: · │ [ReturnTypeDeducedFromDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Recurse(x: i32) => Recurse(x); class EarlyCall { fn M() => 1 as i32; - // CHECK:STDERR: fail_call_before_deduced.carbon:[[@LINE+3]]:16-18: error: call to `M` before its return type is known [CallBeforeReturnTypeDeduced] - // CHECK:STDERR: fail_call_before_deduced.carbon:[[@LINE-2]]:3-11: note: return type of `M` is deduced from its definition [ReturnTypeDeducedFromDefinition] + // CHECK:STDERR: ╭─┤ fail_call_before_deduced.carbon:[[@LINE+12]]:16 + // CHECK:STDERR: │ fn M() => 1 as i32; + // CHECK:STDERR: · ────┬──── + // CHECK:STDERR: · ╰──┤ return type of `M` is deduced from its definition + // CHECK:STDERR: · │ [ReturnTypeDeducedFromDefinition] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ var x: i32 = M(); + // CHECK:STDERR: · ━┳━ + // CHECK:STDERR: · ┗━━┫ error: call to `M` before its return type is known + // CHECK:STDERR: · ┃ [CallBeforeReturnTypeDeduced] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var x: i32 = M(); } @@ -189,7 +308,12 @@ interface I { class C { impl as I { - // CHECK:STDERR: fail_todo_thunk_before_deduced.carbon:[[@LINE+2]]:5-13: error: semantics TODO: `deduced return type for `impl` member` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_thunk_before_deduced.carbon:[[@LINE+7]]:5 + // CHECK:STDERR: -> │ fn F() => 0 as i32; + // CHECK:STDERR: · ━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `deduced return type for `impl` member` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn F() => 0 as i32; } diff --git a/toolchain/check/testdata/function/generic/deduce.carbon b/toolchain/check/testdata/function/generic/deduce.carbon index bc058759dbfe..098fbc3d8e15 100644 --- a/toolchain/check/testdata/function/generic/deduce.carbon +++ b/toolchain/check/testdata/function/generic/deduce.carbon @@ -37,8 +37,17 @@ fn CallExplicitGenericParamConst(generic T: type) { } fn CallExplicitGenericParamNonConst(T: type) { - // CHECK:STDERR: fail_deduce_explicit_non_constant.carbon:[[@LINE+3]]:3-25: error: argument for generic parameter is not a compile-time constant [CompTimeArgumentNotConstant] - // CHECK:STDERR: fail_deduce_explicit_non_constant.carbon:[[@LINE-8]]:33-39: note: initializing generic parameter `T` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_deduce_explicit_non_constant.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ ...citGenericParam(generic T: type) -> T* { return ExplicitGenericParam(T); } + // CHECK:STDERR: · ┬────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ ExplicitGenericParam(T); + // CHECK:STDERR: · ━━━━━┳━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: argument for generic parameter is not a compile-time constant + // CHECK:STDERR: · ┃ [CompTimeArgumentNotConstant] + // CHECK:STDERR: ╰──── // CHECK:STDERR: ExplicitGenericParam(T); } @@ -94,8 +103,17 @@ library "[[@TEST_NAME]]"; fn BigStructParam[T: type](unused x: {.c: T, .d: i32, .e: i32}) {} fn CallBigStructParam() { - // CHECK:STDERR: fail_deduce_bigger_struct.carbon:[[@LINE+3]]:3-34: error: cannot deduce value for generic parameter `T` [DeductionIncomplete] - // CHECK:STDERR: fail_deduce_bigger_struct.carbon:[[@LINE-4]]:1-65: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_deduce_bigger_struct.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn BigStructParam[T: type](unused x: {.c: T, .d: i32, .e: i32}) {} + // CHECK:STDERR: · ─────────────────────────┬─────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ BigStructParam({.c = 3, .d = 4}); + // CHECK:STDERR: · ━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot deduce value for generic parameter `T` + // CHECK:STDERR: · ┃ [DeductionIncomplete] + // CHECK:STDERR: ╰──── // CHECK:STDERR: BigStructParam({.c = 3, .d = 4}); } @@ -107,8 +125,17 @@ library "[[@TEST_NAME]]"; fn SmallStructParam[T: type](unused x: {.f: T, .g: i32}) {} fn CallSmallStructParam() { - // CHECK:STDERR: fail_deduce_smaller_struct.carbon:[[@LINE+3]]:3-44: error: cannot deduce value for generic parameter `T` [DeductionIncomplete] - // CHECK:STDERR: fail_deduce_smaller_struct.carbon:[[@LINE-4]]:1-58: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_deduce_smaller_struct.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn SmallStructParam[T: type](unused x: {.f: T, .g: i32}) {} + // CHECK:STDERR: · ─────────────────────────┬──────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ SmallStructParam({.f = 5, .g = 6, .h = 7}); + // CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot deduce value for generic parameter `T` + // CHECK:STDERR: · ┃ [DeductionIncomplete] + // CHECK:STDERR: ╰──── // CHECK:STDERR: SmallStructParam({.f = 5, .g = 6, .h = 7}); } @@ -120,8 +147,17 @@ library "[[@TEST_NAME]]"; fn WrongNameStructParam[T: type](unused x: {.i: T, .different: i32}) {} fn CallWrongNameStructParam() { - // CHECK:STDERR: fail_deduce_struct_wrong_name.carbon:[[@LINE+3]]:3-40: error: cannot deduce value for generic parameter `T` [DeductionIncomplete] - // CHECK:STDERR: fail_deduce_struct_wrong_name.carbon:[[@LINE-4]]:1-70: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_deduce_struct_wrong_name.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn WrongNameStructParam[T: type](unused x: {.i: T, .different: i32}) {} + // CHECK:STDERR: · ─────────────────────────┬──────────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ WrongNameStructParam({.i = 8, .j = 9}); + // CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot deduce value for generic parameter `T` + // CHECK:STDERR: · ┃ [DeductionIncomplete] + // CHECK:STDERR: ╰──── // CHECK:STDERR: WrongNameStructParam({.i = 8, .j = 9}); } @@ -133,8 +169,17 @@ library "[[@TEST_NAME]]"; fn WrongOrderStructParam[T: type](unused x: {.first: T, .second: i32}) {} fn CallWrongOrderStructParam() { - // CHECK:STDERR: fail_todo_deduce_struct_wrong_order.carbon:[[@LINE+3]]:3-52: error: cannot deduce value for generic parameter `T` [DeductionIncomplete] - // CHECK:STDERR: fail_todo_deduce_struct_wrong_order.carbon:[[@LINE-4]]:1-72: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_todo_deduce_struct_wrong_order.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn WrongOrderStructParam[T: type](unused x: {.first: T, .second: i32}) {} + // CHECK:STDERR: · ─────────────────────────┬────────────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ WrongOrderStructParam({.second = 11, .first = 10}); + // CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot deduce value for generic parameter `T` + // CHECK:STDERR: · ┃ [DeductionIncomplete] + // CHECK:STDERR: ╰──── // CHECK:STDERR: WrongOrderStructParam({.second = 11, .first = 10}); } @@ -148,8 +193,17 @@ library "[[@TEST_NAME]]"; fn ImplicitNotDeducible[T: type, U: type](x: T) -> U; fn CallImplicitNotDeducible() { - // CHECK:STDERR: fail_deduce_incomplete.carbon:[[@LINE+3]]:3-26: error: cannot deduce value for generic parameter `U` [DeductionIncomplete] - // CHECK:STDERR: fail_deduce_incomplete.carbon:[[@LINE-4]]:1-53: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_deduce_incomplete.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn ImplicitNotDeducible[T: type, U: type](x: T) -> U; + // CHECK:STDERR: · ─────────────────────────┬─────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ ImplicitNotDeducible(42); + // CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot deduce value for generic parameter `U` + // CHECK:STDERR: · ┃ [DeductionIncomplete] + // CHECK:STDERR: ╰──── // CHECK:STDERR: ImplicitNotDeducible(42); } @@ -161,8 +215,17 @@ library "[[@TEST_NAME]]"; fn ImplicitNotDeducible[T: type](x: T, y: T) -> T; fn CallImplicitNotDeducible() { - // CHECK:STDERR: fail_deduce_inconsistent.carbon:[[@LINE+3]]:3-37: error: inconsistent deductions for value of generic parameter `T` [DeductionInconsistent] - // CHECK:STDERR: fail_deduce_inconsistent.carbon:[[@LINE-4]]:1-50: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_deduce_inconsistent.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn ImplicitNotDeducible[T: type](x: T, y: T) -> T; + // CHECK:STDERR: · ─────────────────────────┬──────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ ImplicitNotDeducible(42, {.x = 12}); + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: inconsistent deductions for value of generic parameter `T` + // CHECK:STDERR: · ┃ [DeductionInconsistent] + // CHECK:STDERR: ╰──── // CHECK:STDERR: ImplicitNotDeducible(42, {.x = 12}); } @@ -1310,7 +1373,7 @@ fn F() { // CHECK:STDOUT: %BigStructParam.ref: %BigStructParam.type = name_ref BigStructParam, file.%BigStructParam.decl [concrete = constants.%BigStructParam] // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3] // CHECK:STDOUT: %int_4: Core.IntLiteral = int_value 4 [concrete = constants.%int_4] -// CHECK:STDOUT: %.loc10: %struct_type.c.d = struct_literal (%int_3, %int_4) [concrete = constants.%struct] +// CHECK:STDOUT: %.loc19: %struct_type.c.d = struct_literal (%int_3, %int_4) [concrete = constants.%struct] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1411,7 +1474,7 @@ fn F() { // CHECK:STDOUT: %int_5: Core.IntLiteral = int_value 5 [concrete = constants.%int_5] // CHECK:STDOUT: %int_6: Core.IntLiteral = int_value 6 [concrete = constants.%int_6] // CHECK:STDOUT: %int_7: Core.IntLiteral = int_value 7 [concrete = constants.%int_7] -// CHECK:STDOUT: %.loc10: %struct_type.f.g.h = struct_literal (%int_5, %int_6, %int_7) [concrete = constants.%struct] +// CHECK:STDOUT: %.loc19: %struct_type.f.g.h = struct_literal (%int_5, %int_6, %int_7) [concrete = constants.%struct] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1510,7 +1573,7 @@ fn F() { // CHECK:STDOUT: %WrongNameStructParam.ref: %WrongNameStructParam.type = name_ref WrongNameStructParam, file.%WrongNameStructParam.decl [concrete = constants.%WrongNameStructParam] // CHECK:STDOUT: %int_8: Core.IntLiteral = int_value 8 [concrete = constants.%int_8] // CHECK:STDOUT: %int_9: Core.IntLiteral = int_value 9 [concrete = constants.%int_9] -// CHECK:STDOUT: %.loc10: %struct_type.i.j = struct_literal (%int_8, %int_9) [concrete = constants.%struct] +// CHECK:STDOUT: %.loc19: %struct_type.i.j = struct_literal (%int_8, %int_9) [concrete = constants.%struct] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1609,7 +1672,7 @@ fn F() { // CHECK:STDOUT: %WrongOrderStructParam.ref: %WrongOrderStructParam.type = name_ref WrongOrderStructParam, file.%WrongOrderStructParam.decl [concrete = constants.%WrongOrderStructParam] // CHECK:STDOUT: %int_11: Core.IntLiteral = int_value 11 [concrete = constants.%int_11] // CHECK:STDOUT: %int_10: Core.IntLiteral = int_value 10 [concrete = constants.%int_10] -// CHECK:STDOUT: %.loc10: %struct_type.second.first = struct_literal (%int_11, %int_10) [concrete = constants.%struct] +// CHECK:STDOUT: %.loc19: %struct_type.second.first = struct_literal (%int_11, %int_10) [concrete = constants.%struct] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1814,7 +1877,7 @@ fn F() { // CHECK:STDOUT: %ImplicitNotDeducible.ref: %ImplicitNotDeducible.type = name_ref ImplicitNotDeducible, file.%ImplicitNotDeducible.decl [concrete = constants.%ImplicitNotDeducible] // CHECK:STDOUT: %int_42: Core.IntLiteral = int_value 42 [concrete = constants.%int_42] // CHECK:STDOUT: %int_12: Core.IntLiteral = int_value 12 [concrete = constants.%int_12] -// CHECK:STDOUT: %.loc10: %struct_type.x = struct_literal (%int_12) [concrete = constants.%struct] +// CHECK:STDOUT: %.loc19: %struct_type.x = struct_literal (%int_12) [concrete = constants.%struct] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/generic/fail_deduce_imported_function.carbon b/toolchain/check/testdata/function/generic/fail_deduce_imported_function.carbon index 5822cba7e6bc..190185c82d87 100644 --- a/toolchain/check/testdata/function/generic/fail_deduce_imported_function.carbon +++ b/toolchain/check/testdata/function/generic/fail_deduce_imported_function.carbon @@ -25,13 +25,32 @@ import Lib; fn A[T: Lib.Z](unused x: {.a: T}) {} fn B() { - // CHECK:STDERR: fail_deduce_imported_function.carbon:[[@LINE+3]]:3-14: error: cannot deduce value for generic parameter `T` [DeductionIncomplete] - // CHECK:STDERR: fail_deduce_imported_function.carbon:[[@LINE-4]]:1-35: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_deduce_imported_function.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn A[T: Lib.Z](unused x: {.a: T}) {} + // CHECK:STDERR: · ─────────────────┬───────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ A({.b = {}}); + // CHECK:STDERR: · ━━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot deduce value for generic parameter `T` + // CHECK:STDERR: · ┃ [DeductionIncomplete] + // CHECK:STDERR: ╰──── // CHECK:STDERR: A({.b = {}}); - // CHECK:STDERR: fail_deduce_imported_function.carbon:[[@LINE+3]]:3-18: error: cannot deduce value for generic parameter `T` [DeductionIncomplete] - // CHECK:STDERR: lib.carbon:4:1-31: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_deduce_imported_function.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: -> │ Lib.A({.b = {}}); + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot deduce value for generic parameter `T` + // CHECK:STDERR: · ┃ [DeductionIncomplete] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ lib.carbon + // CHECK:STDERR: │ fn A[T: Z](unused x: {.a: T}) {} + // CHECK:STDERR: · ───────────────┬─────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Lib.A({.b = {}}); } @@ -223,13 +242,13 @@ fn B() { // CHECK:STDOUT: // CHECK:STDOUT: fn @B() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %A.ref.loc10: %A.type.9f4 = name_ref A, file.%A.decl [concrete = constants.%A.921] -// CHECK:STDOUT: %.loc10_12: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc10_13: %struct_type.b = struct_literal (%.loc10_12) [concrete = constants.%struct] +// CHECK:STDOUT: %A.ref.loc19: %A.type.9f4 = name_ref A, file.%A.decl [concrete = constants.%A.921] +// CHECK:STDOUT: %.loc19_12: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc19_13: %struct_type.b = struct_literal (%.loc19_12) [concrete = constants.%struct] // CHECK:STDOUT: %Lib.ref: = name_ref Lib, imports.%Lib [concrete = imports.%Lib] -// CHECK:STDOUT: %A.ref.loc15: %A.type.42a = name_ref A, imports.%Lib.A [concrete = constants.%A.b9a] -// CHECK:STDOUT: %.loc15_16: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc15_17: %struct_type.b = struct_literal (%.loc15_16) [concrete = constants.%struct] +// CHECK:STDOUT: %A.ref.loc34: %A.type.42a = name_ref A, imports.%Lib.A [concrete = constants.%A.b9a] +// CHECK:STDOUT: %.loc34_16: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc34_17: %struct_type.b = struct_literal (%.loc34_16) [concrete = constants.%struct] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/generic/fail_type_param_mismatch.carbon b/toolchain/check/testdata/function/generic/fail_type_param_mismatch.carbon index f451857053f8..68d153ae7fb9 100644 --- a/toolchain/check/testdata/function/generic/fail_type_param_mismatch.carbon +++ b/toolchain/check/testdata/function/generic/fail_type_param_mismatch.carbon @@ -12,8 +12,16 @@ fn F(generic T: type, generic U: type) { var p: T*; - // CHECK:STDERR: fail_type_param_mismatch.carbon:[[@LINE+3]]:21-22: error: cannot implicitly convert expression of type `T` to `U` [ConversionFailure] - // CHECK:STDERR: fail_type_param_mismatch.carbon:[[@LINE+2]]:21-22: note: type `T` does not implement interface `Core.ImplicitAs(U)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_type_param_mismatch.carbon:[[@LINE+11]]:21 + // CHECK:STDERR: -> │ let unused n: U = *p; + // CHECK:STDERR: · ┳━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `T` + // CHECK:STDERR: · │ ┃ to `U` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `T` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(U)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused n: U = *p; } diff --git a/toolchain/check/testdata/function/generic/redeclare.carbon b/toolchain/check/testdata/function/generic/redeclare.carbon index 40bcb052b660..230672b856a4 100644 --- a/toolchain/check/testdata/function/generic/redeclare.carbon +++ b/toolchain/check/testdata/function/generic/redeclare.carbon @@ -28,12 +28,29 @@ library "[[@TEST_NAME]]"; fn F(generic T: type, generic U: type) -> T*; -// CHECK:STDERR: fail_different_return_type.carbon:[[@LINE+3]]:1-46: error: function redeclaration differs because return type is `U*` [FunctionRedeclReturnTypeDiffers] -// CHECK:STDERR: fail_different_return_type.carbon:[[@LINE-3]]:1-45: note: previously declared with return type `T*` [FunctionRedeclReturnTypePrevious] +// CHECK:STDERR: ╭─┤ fail_different_return_type.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: │ fn F(generic T: type, generic U: type) -> T*; +// CHECK:STDERR: · ──────────────────────┬────────────────────── +// CHECK:STDERR: · ╰──┤ previously declared with return type `T*` +// CHECK:STDERR: · │ [FunctionRedeclReturnTypePrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn F(generic T: type, generic U: type) -> U* { +// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: function redeclaration differs because return type is `U*` +// CHECK:STDERR: · ┃ [FunctionRedeclReturnTypeDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic T: type, generic U: type) -> U* { - // CHECK:STDERR: fail_different_return_type.carbon:[[@LINE+3]]:10-13: error: 1 argument passed to function expecting 2 arguments [CallArgCountMismatch] - // CHECK:STDERR: fail_different_return_type.carbon:[[@LINE-7]]:1-45: note: calling function declared here [InCallToEntity] + // CHECK:STDERR: ╭─┤ fail_different_return_type.carbon:[[@LINE+11]]:10 + // CHECK:STDERR: │ fn F(generic T: type, generic U: type) -> T*; + // CHECK:STDERR: · ──────────────────────┬────────────────────── + // CHECK:STDERR: · ╰──┤ calling function declared here [InCallToEntity] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ return F(T); + // CHECK:STDERR: · ━━┳━ + // CHECK:STDERR: · ┗━━┫ error: 1 argument passed to function expecting 2 arguments + // CHECK:STDERR: · ┃ [CallArgCountMismatch] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return F(T); } @@ -44,12 +61,29 @@ library "[[@TEST_NAME]]"; fn F(generic T: type, generic U: type) -> T*; -// CHECK:STDERR: fail_reorder.carbon:[[@LINE+3]]:21-27: error: redeclaration differs at parameter 1 [RedeclParamDiffers] -// CHECK:STDERR: fail_reorder.carbon:[[@LINE-3]]:14-20: note: previous declaration's corresponding parameter here [RedeclParamPrevious] +// CHECK:STDERR: ╭─┤ fail_reorder.carbon:[[@LINE+12]]:21 +// CHECK:STDERR: │ fn F(generic T: type, generic U: type) -> T*; +// CHECK:STDERR: · ───┬─── +// CHECK:STDERR: · ╰──┤ previous declaration's corresponding parameter here +// CHECK:STDERR: · │ [RedeclParamPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn F(unused generic U: type, generic T: type) -> T* { +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration differs at parameter 1 +// CHECK:STDERR: · ┃ [RedeclParamDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused generic U: type, generic T: type) -> T* { - // CHECK:STDERR: fail_reorder.carbon:[[@LINE+3]]:10-13: error: 1 argument passed to function expecting 2 arguments [CallArgCountMismatch] - // CHECK:STDERR: fail_reorder.carbon:[[@LINE-7]]:1-45: note: calling function declared here [InCallToEntity] + // CHECK:STDERR: ╭─┤ fail_reorder.carbon:[[@LINE+11]]:10 + // CHECK:STDERR: │ fn F(generic T: type, generic U: type) -> T*; + // CHECK:STDERR: · ──────────────────────┬────────────────────── + // CHECK:STDERR: · ╰──┤ calling function declared here [InCallToEntity] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ return F(T); + // CHECK:STDERR: · ━━┳━ + // CHECK:STDERR: · ┗━━┫ error: 1 argument passed to function expecting 2 arguments + // CHECK:STDERR: · ┃ [CallArgCountMismatch] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return F(T); } @@ -60,12 +94,29 @@ library "[[@TEST_NAME]]"; fn F(generic T: type, generic U: type) -> T*; -// CHECK:STDERR: fail_rename.carbon:[[@LINE+3]]:14-20: error: redeclaration differs at parameter 1 [RedeclParamDiffers] -// CHECK:STDERR: fail_rename.carbon:[[@LINE-3]]:14-20: note: previous declaration's corresponding parameter here [RedeclParamPrevious] +// CHECK:STDERR: ╭─┤ fail_rename.carbon:[[@LINE+12]]:14 +// CHECK:STDERR: │ fn F(generic T: type, generic U: type) -> T*; +// CHECK:STDERR: · ───┬─── +// CHECK:STDERR: · ╰──┤ previous declaration's corresponding parameter here +// CHECK:STDERR: · │ [RedeclParamPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn F(generic U: type, generic T: type) -> U* { +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration differs at parameter 1 +// CHECK:STDERR: · ┃ [RedeclParamDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic U: type, generic T: type) -> U* { - // CHECK:STDERR: fail_rename.carbon:[[@LINE+3]]:10-13: error: 1 argument passed to function expecting 2 arguments [CallArgCountMismatch] - // CHECK:STDERR: fail_rename.carbon:[[@LINE-7]]:1-45: note: calling function declared here [InCallToEntity] + // CHECK:STDERR: ╭─┤ fail_rename.carbon:[[@LINE+11]]:10 + // CHECK:STDERR: │ fn F(generic T: type, generic U: type) -> T*; + // CHECK:STDERR: · ──────────────────────┬────────────────────── + // CHECK:STDERR: · ╰──┤ calling function declared here [InCallToEntity] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ return F(T); + // CHECK:STDERR: · ━━┳━ + // CHECK:STDERR: · ┗━━┫ error: 1 argument passed to function expecting 2 arguments + // CHECK:STDERR: · ┃ [CallArgCountMismatch] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return F(T); } @@ -195,7 +246,7 @@ fn F(generic U: type, generic T: type) -> U* { // CHECK:STDOUT: %pattern_type.423: type = pattern_type %ptr.18e [symbolic] // CHECK:STDOUT: %return.param_patt.534: %pattern_type.423 = out_param_pattern [symbolic] // CHECK:STDOUT: %return.patt.669: %pattern_type.423 = return_slot_pattern %return.param_patt.534, %ptr.18e [symbolic] -// CHECK:STDOUT: %F.type.eb3ec9.2: type = fn_type @F.loc9 [concrete] +// CHECK:STDOUT: %F.type.eb3ec9.2: type = fn_type @F.loc18 [concrete] // CHECK:STDOUT: %F.7088cc.2: %F.type.eb3ec9.2 = struct_value () [concrete] // CHECK:STDOUT: %require_complete: = require_complete_type %ptr.18e [symbolic] // CHECK:STDOUT: } @@ -235,27 +286,27 @@ fn F(generic U: type, generic T: type) -> U* { // CHECK:STDOUT: %return.param: ref @F.loc4.%ptr.loc4_44.1 (%ptr.e8f) = out_param call_param0 // CHECK:STDOUT: %return: ref @F.loc4.%ptr.loc4_44.1 (%ptr.e8f) = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %F.decl.loc9: %F.type.eb3ec9.2 = fn_decl @F.loc9 [concrete = constants.%F.7088cc.2] { -// CHECK:STDOUT: %T.patt.loc9_15.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc9_15.2 (constants.%T.patt)] -// CHECK:STDOUT: %U.patt.loc9_32.1: %pattern_type.9a5 = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc9_32.2 (constants.%U.patt)] -// CHECK:STDOUT: %return.param_patt.loc9_44.1: @F.loc9.%pattern_type (%pattern_type.423) = out_param_pattern [symbolic = %return.param_patt.loc9_44.2 (constants.%return.param_patt.534)] -// CHECK:STDOUT: %return.patt.loc9_40.1: @F.loc9.%pattern_type (%pattern_type.423) = return_slot_pattern %return.param_patt.loc9_44.1, %ptr.loc9_44.2 [symbolic = %return.patt.loc9_40.2 (constants.%return.patt.669)] +// CHECK:STDOUT: %F.decl.loc18: %F.type.eb3ec9.2 = fn_decl @F.loc18 [concrete = constants.%F.7088cc.2] { +// CHECK:STDOUT: %T.patt.loc18_15.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc18_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %U.patt.loc18_32.1: %pattern_type.9a5 = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc18_32.2 (constants.%U.patt)] +// CHECK:STDOUT: %return.param_patt.loc18_44.1: @F.loc18.%pattern_type (%pattern_type.423) = out_param_pattern [symbolic = %return.param_patt.loc18_44.2 (constants.%return.param_patt.534)] +// CHECK:STDOUT: %return.patt.loc18_40.1: @F.loc18.%pattern_type (%pattern_type.423) = return_slot_pattern %return.param_patt.loc18_44.1, %ptr.loc18_44.2 [symbolic = %return.patt.loc18_40.2 (constants.%return.patt.669)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %U.ref: type = name_ref U, %U.loc9_32.2 [symbolic = %U.loc9_32.1 (constants.%U)] -// CHECK:STDOUT: %ptr.loc9_44.2: type = ptr_type %U.ref [symbolic = %ptr.loc9_44.1 (constants.%ptr.18e)] -// CHECK:STDOUT: %.loc9_44.2: Core.Form = init_form %ptr.loc9_44.2 [symbolic = %.loc9_44.1 (constants.%.6d8)] -// CHECK:STDOUT: %.loc9_17.1: type = splice_block %.loc9_17.2 [concrete = type] { -// CHECK:STDOUT: %.Self.frozen.loc9_15: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc9_17.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %U.ref: type = name_ref U, %U.loc18_32.2 [symbolic = %U.loc18_32.1 (constants.%U)] +// CHECK:STDOUT: %ptr.loc18_44.2: type = ptr_type %U.ref [symbolic = %ptr.loc18_44.1 (constants.%ptr.18e)] +// CHECK:STDOUT: %.loc18_44.2: Core.Form = init_form %ptr.loc18_44.2 [symbolic = %.loc18_44.1 (constants.%.6d8)] +// CHECK:STDOUT: %.loc18_17.1: type = splice_block %.loc18_17.2 [concrete = type] { +// CHECK:STDOUT: %.Self.frozen.loc18_15: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc18_17.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc9_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc9_15.1 (constants.%T)] -// CHECK:STDOUT: %.loc9_34.1: type = splice_block %.loc9_34.2 [concrete = type] { -// CHECK:STDOUT: %.Self.frozen.loc9_32: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc9_34.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %T.loc18_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc18_15.1 (constants.%T)] +// CHECK:STDOUT: %.loc18_34.1: type = splice_block %.loc18_34.2 [concrete = type] { +// CHECK:STDOUT: %.Self.frozen.loc18_32: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc18_34.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %U.loc9_32.2: type = symbolic_binding U, 1 [symbolic = %U.loc9_32.1 (constants.%U)] -// CHECK:STDOUT: %return.param: ref @F.loc9.%ptr.loc9_44.1 (%ptr.18e) = out_param call_param0 -// CHECK:STDOUT: %return: ref @F.loc9.%ptr.loc9_44.1 (%ptr.18e) = return_slot %return.param +// CHECK:STDOUT: %U.loc18_32.2: type = symbolic_binding U, 1 [symbolic = %U.loc18_32.1 (constants.%U)] +// CHECK:STDOUT: %return.param: ref @F.loc18.%ptr.loc18_44.1 (%ptr.18e) = out_param call_param0 +// CHECK:STDOUT: %return: ref @F.loc18.%ptr.loc18_44.1 (%ptr.18e) = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -273,24 +324,24 @@ fn F(generic U: type, generic T: type) -> U* { // CHECK:STDOUT: fn() -> out %return.param: @F.loc4.%ptr.loc4_44.1 (%ptr.e8f); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @F.loc9(%T.loc9_15.2: type, %U.loc9_32.2: type) { -// CHECK:STDOUT: %T.patt.loc9_15.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc9_15.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc9_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc9_15.1 (constants.%T)] -// CHECK:STDOUT: %U.patt.loc9_32.2: %pattern_type.9a5 = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc9_32.2 (constants.%U.patt)] -// CHECK:STDOUT: %U.loc9_32.1: type = symbolic_binding U, 1 [symbolic = %U.loc9_32.1 (constants.%U)] -// CHECK:STDOUT: %ptr.loc9_44.1: type = ptr_type %U.loc9_32.1 [symbolic = %ptr.loc9_44.1 (constants.%ptr.18e)] -// CHECK:STDOUT: %.loc9_44.1: Core.Form = init_form %ptr.loc9_44.1 [symbolic = %.loc9_44.1 (constants.%.6d8)] -// CHECK:STDOUT: %pattern_type: type = pattern_type %ptr.loc9_44.1 [symbolic = %pattern_type (constants.%pattern_type.423)] -// CHECK:STDOUT: %return.param_patt.loc9_44.2: @F.loc9.%pattern_type (%pattern_type.423) = out_param_pattern [symbolic = %return.param_patt.loc9_44.2 (constants.%return.param_patt.534)] -// CHECK:STDOUT: %return.patt.loc9_40.2: @F.loc9.%pattern_type (%pattern_type.423) = return_slot_pattern %return.param_patt.loc9_44.2, %ptr.loc9_44.1 [symbolic = %return.patt.loc9_40.2 (constants.%return.patt.669)] +// CHECK:STDOUT: generic fn @F.loc18(%T.loc18_15.2: type, %U.loc18_32.2: type) { +// CHECK:STDOUT: %T.patt.loc18_15.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc18_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc18_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc18_15.1 (constants.%T)] +// CHECK:STDOUT: %U.patt.loc18_32.2: %pattern_type.9a5 = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc18_32.2 (constants.%U.patt)] +// CHECK:STDOUT: %U.loc18_32.1: type = symbolic_binding U, 1 [symbolic = %U.loc18_32.1 (constants.%U)] +// CHECK:STDOUT: %ptr.loc18_44.1: type = ptr_type %U.loc18_32.1 [symbolic = %ptr.loc18_44.1 (constants.%ptr.18e)] +// CHECK:STDOUT: %.loc18_44.1: Core.Form = init_form %ptr.loc18_44.1 [symbolic = %.loc18_44.1 (constants.%.6d8)] +// CHECK:STDOUT: %pattern_type: type = pattern_type %ptr.loc18_44.1 [symbolic = %pattern_type (constants.%pattern_type.423)] +// CHECK:STDOUT: %return.param_patt.loc18_44.2: @F.loc18.%pattern_type (%pattern_type.423) = out_param_pattern [symbolic = %return.param_patt.loc18_44.2 (constants.%return.param_patt.534)] +// CHECK:STDOUT: %return.patt.loc18_40.2: @F.loc18.%pattern_type (%pattern_type.423) = return_slot_pattern %return.param_patt.loc18_44.2, %ptr.loc18_44.1 [symbolic = %return.patt.loc18_40.2 (constants.%return.patt.669)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type %ptr.loc9_44.1 [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %require_complete: = require_complete_type %ptr.loc18_44.1 [symbolic = %require_complete (constants.%require_complete)] // CHECK:STDOUT: -// CHECK:STDOUT: fn() -> out %return.param: @F.loc9.%ptr.loc9_44.1 (%ptr.18e) { +// CHECK:STDOUT: fn() -> out %return.param: @F.loc18.%ptr.loc18_44.1 (%ptr.18e) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: %F.type.eb3ec9.1 = name_ref F, file.%F.decl.loc4 [concrete = constants.%F.7088cc.1] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc9_15.2 [symbolic = %T.loc9_15.1 (constants.%T)] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc18_15.2 [symbolic = %T.loc18_15.1 (constants.%T)] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -307,16 +358,16 @@ fn F(generic U: type, generic T: type) -> U* { // CHECK:STDOUT: %return.patt.loc4_40.2 => constants.%return.patt.d67 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.loc9(constants.%T, constants.%U) { -// CHECK:STDOUT: %T.patt.loc9_15.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc9_15.1 => constants.%T -// CHECK:STDOUT: %U.patt.loc9_32.2 => constants.%U.patt -// CHECK:STDOUT: %U.loc9_32.1 => constants.%U -// CHECK:STDOUT: %ptr.loc9_44.1 => constants.%ptr.18e -// CHECK:STDOUT: %.loc9_44.1 => constants.%.6d8 +// CHECK:STDOUT: specific @F.loc18(constants.%T, constants.%U) { +// CHECK:STDOUT: %T.patt.loc18_15.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc18_15.1 => constants.%T +// CHECK:STDOUT: %U.patt.loc18_32.2 => constants.%U.patt +// CHECK:STDOUT: %U.loc18_32.1 => constants.%U +// CHECK:STDOUT: %ptr.loc18_44.1 => constants.%ptr.18e +// CHECK:STDOUT: %.loc18_44.1 => constants.%.6d8 // CHECK:STDOUT: %pattern_type => constants.%pattern_type.423 -// CHECK:STDOUT: %return.param_patt.loc9_44.2 => constants.%return.param_patt.534 -// CHECK:STDOUT: %return.patt.loc9_40.2 => constants.%return.patt.669 +// CHECK:STDOUT: %return.param_patt.loc18_44.2 => constants.%return.param_patt.534 +// CHECK:STDOUT: %return.patt.loc18_40.2 => constants.%return.patt.669 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_reorder.carbon @@ -345,7 +396,7 @@ fn F(generic U: type, generic T: type) -> U* { // CHECK:STDOUT: %pattern_type.423: type = pattern_type %ptr.18e [symbolic] // CHECK:STDOUT: %return.param_patt.534: %pattern_type.423 = out_param_pattern [symbolic] // CHECK:STDOUT: %return.patt.669: %pattern_type.423 = return_slot_pattern %return.param_patt.534, %ptr.18e [symbolic] -// CHECK:STDOUT: %F.type.eb3ec9.2: type = fn_type @F.loc9 [concrete] +// CHECK:STDOUT: %F.type.eb3ec9.2: type = fn_type @F.loc18 [concrete] // CHECK:STDOUT: %F.7088cc.2: %F.type.eb3ec9.2 = struct_value () [concrete] // CHECK:STDOUT: %require_complete: = require_complete_type %ptr.18e [symbolic] // CHECK:STDOUT: } @@ -385,27 +436,27 @@ fn F(generic U: type, generic T: type) -> U* { // CHECK:STDOUT: %return.param: ref @F.loc4.%ptr.loc4_44.1 (%ptr.e8f) = out_param call_param0 // CHECK:STDOUT: %return: ref @F.loc4.%ptr.loc4_44.1 (%ptr.e8f) = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %F.decl.loc9: %F.type.eb3ec9.2 = fn_decl @F.loc9 [concrete = constants.%F.7088cc.2] { -// CHECK:STDOUT: %U.patt.loc9_22.1: %pattern_type.9a5 = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc9_22.2 (constants.%U.patt.3a0)] -// CHECK:STDOUT: %T.patt.loc9_39.1: %pattern_type.9a5 = symbolic_binding_pattern T, 1 [symbolic = %T.patt.loc9_39.2 (constants.%T.patt.cb8)] -// CHECK:STDOUT: %return.param_patt.loc9_51.1: @F.loc9.%pattern_type (%pattern_type.423) = out_param_pattern [symbolic = %return.param_patt.loc9_51.2 (constants.%return.param_patt.534)] -// CHECK:STDOUT: %return.patt.loc9_47.1: @F.loc9.%pattern_type (%pattern_type.423) = return_slot_pattern %return.param_patt.loc9_51.1, %ptr.loc9_51.2 [symbolic = %return.patt.loc9_47.2 (constants.%return.patt.669)] +// CHECK:STDOUT: %F.decl.loc18: %F.type.eb3ec9.2 = fn_decl @F.loc18 [concrete = constants.%F.7088cc.2] { +// CHECK:STDOUT: %U.patt.loc18_22.1: %pattern_type.9a5 = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc18_22.2 (constants.%U.patt.3a0)] +// CHECK:STDOUT: %T.patt.loc18_39.1: %pattern_type.9a5 = symbolic_binding_pattern T, 1 [symbolic = %T.patt.loc18_39.2 (constants.%T.patt.cb8)] +// CHECK:STDOUT: %return.param_patt.loc18_51.1: @F.loc18.%pattern_type (%pattern_type.423) = out_param_pattern [symbolic = %return.param_patt.loc18_51.2 (constants.%return.param_patt.534)] +// CHECK:STDOUT: %return.patt.loc18_47.1: @F.loc18.%pattern_type (%pattern_type.423) = return_slot_pattern %return.param_patt.loc18_51.1, %ptr.loc18_51.2 [symbolic = %return.patt.loc18_47.2 (constants.%return.patt.669)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %T.ref.loc9: type = name_ref T, %T.loc9_39.2 [symbolic = %T.loc9_39.1 (constants.%T.091)] -// CHECK:STDOUT: %ptr.loc9_51.2: type = ptr_type %T.ref.loc9 [symbolic = %ptr.loc9_51.1 (constants.%ptr.18e)] -// CHECK:STDOUT: %.loc9_51.2: Core.Form = init_form %ptr.loc9_51.2 [symbolic = %.loc9_51.1 (constants.%.6d8)] -// CHECK:STDOUT: %.loc9_24.1: type = splice_block %.loc9_24.2 [concrete = type] { -// CHECK:STDOUT: %.Self.frozen.loc9_22: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc9_24.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %T.ref.loc18: type = name_ref T, %T.loc18_39.2 [symbolic = %T.loc18_39.1 (constants.%T.091)] +// CHECK:STDOUT: %ptr.loc18_51.2: type = ptr_type %T.ref.loc18 [symbolic = %ptr.loc18_51.1 (constants.%ptr.18e)] +// CHECK:STDOUT: %.loc18_51.2: Core.Form = init_form %ptr.loc18_51.2 [symbolic = %.loc18_51.1 (constants.%.6d8)] +// CHECK:STDOUT: %.loc18_24.1: type = splice_block %.loc18_24.2 [concrete = type] { +// CHECK:STDOUT: %.Self.frozen.loc18_22: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc18_24.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %U.loc9_22.2: type = symbolic_binding U, 0 [symbolic = %U.loc9_22.1 (constants.%U.67d)] -// CHECK:STDOUT: %.loc9_41.1: type = splice_block %.loc9_41.2 [concrete = type] { -// CHECK:STDOUT: %.Self.frozen.loc9_39: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc9_41.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %U.loc18_22.2: type = symbolic_binding U, 0 [symbolic = %U.loc18_22.1 (constants.%U.67d)] +// CHECK:STDOUT: %.loc18_41.1: type = splice_block %.loc18_41.2 [concrete = type] { +// CHECK:STDOUT: %.Self.frozen.loc18_39: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc18_41.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc9_39.2: type = symbolic_binding T, 1 [symbolic = %T.loc9_39.1 (constants.%T.091)] -// CHECK:STDOUT: %return.param: ref @F.loc9.%ptr.loc9_51.1 (%ptr.18e) = out_param call_param0 -// CHECK:STDOUT: %return: ref @F.loc9.%ptr.loc9_51.1 (%ptr.18e) = return_slot %return.param +// CHECK:STDOUT: %T.loc18_39.2: type = symbolic_binding T, 1 [symbolic = %T.loc18_39.1 (constants.%T.091)] +// CHECK:STDOUT: %return.param: ref @F.loc18.%ptr.loc18_51.1 (%ptr.18e) = out_param call_param0 +// CHECK:STDOUT: %return: ref @F.loc18.%ptr.loc18_51.1 (%ptr.18e) = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -423,24 +474,24 @@ fn F(generic U: type, generic T: type) -> U* { // CHECK:STDOUT: fn() -> out %return.param: @F.loc4.%ptr.loc4_44.1 (%ptr.e8f); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @F.loc9(%U.loc9_22.2: type, %T.loc9_39.2: type) { -// CHECK:STDOUT: %U.patt.loc9_22.2: %pattern_type.9a5 = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc9_22.2 (constants.%U.patt.3a0)] -// CHECK:STDOUT: %U.loc9_22.1: type = symbolic_binding U, 0 [symbolic = %U.loc9_22.1 (constants.%U.67d)] -// CHECK:STDOUT: %T.patt.loc9_39.2: %pattern_type.9a5 = symbolic_binding_pattern T, 1 [symbolic = %T.patt.loc9_39.2 (constants.%T.patt.cb8)] -// CHECK:STDOUT: %T.loc9_39.1: type = symbolic_binding T, 1 [symbolic = %T.loc9_39.1 (constants.%T.091)] -// CHECK:STDOUT: %ptr.loc9_51.1: type = ptr_type %T.loc9_39.1 [symbolic = %ptr.loc9_51.1 (constants.%ptr.18e)] -// CHECK:STDOUT: %.loc9_51.1: Core.Form = init_form %ptr.loc9_51.1 [symbolic = %.loc9_51.1 (constants.%.6d8)] -// CHECK:STDOUT: %pattern_type: type = pattern_type %ptr.loc9_51.1 [symbolic = %pattern_type (constants.%pattern_type.423)] -// CHECK:STDOUT: %return.param_patt.loc9_51.2: @F.loc9.%pattern_type (%pattern_type.423) = out_param_pattern [symbolic = %return.param_patt.loc9_51.2 (constants.%return.param_patt.534)] -// CHECK:STDOUT: %return.patt.loc9_47.2: @F.loc9.%pattern_type (%pattern_type.423) = return_slot_pattern %return.param_patt.loc9_51.2, %ptr.loc9_51.1 [symbolic = %return.patt.loc9_47.2 (constants.%return.patt.669)] +// CHECK:STDOUT: generic fn @F.loc18(%U.loc18_22.2: type, %T.loc18_39.2: type) { +// CHECK:STDOUT: %U.patt.loc18_22.2: %pattern_type.9a5 = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc18_22.2 (constants.%U.patt.3a0)] +// CHECK:STDOUT: %U.loc18_22.1: type = symbolic_binding U, 0 [symbolic = %U.loc18_22.1 (constants.%U.67d)] +// CHECK:STDOUT: %T.patt.loc18_39.2: %pattern_type.9a5 = symbolic_binding_pattern T, 1 [symbolic = %T.patt.loc18_39.2 (constants.%T.patt.cb8)] +// CHECK:STDOUT: %T.loc18_39.1: type = symbolic_binding T, 1 [symbolic = %T.loc18_39.1 (constants.%T.091)] +// CHECK:STDOUT: %ptr.loc18_51.1: type = ptr_type %T.loc18_39.1 [symbolic = %ptr.loc18_51.1 (constants.%ptr.18e)] +// CHECK:STDOUT: %.loc18_51.1: Core.Form = init_form %ptr.loc18_51.1 [symbolic = %.loc18_51.1 (constants.%.6d8)] +// CHECK:STDOUT: %pattern_type: type = pattern_type %ptr.loc18_51.1 [symbolic = %pattern_type (constants.%pattern_type.423)] +// CHECK:STDOUT: %return.param_patt.loc18_51.2: @F.loc18.%pattern_type (%pattern_type.423) = out_param_pattern [symbolic = %return.param_patt.loc18_51.2 (constants.%return.param_patt.534)] +// CHECK:STDOUT: %return.patt.loc18_47.2: @F.loc18.%pattern_type (%pattern_type.423) = return_slot_pattern %return.param_patt.loc18_51.2, %ptr.loc18_51.1 [symbolic = %return.patt.loc18_47.2 (constants.%return.patt.669)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type %ptr.loc9_51.1 [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %require_complete: = require_complete_type %ptr.loc18_51.1 [symbolic = %require_complete (constants.%require_complete)] // CHECK:STDOUT: -// CHECK:STDOUT: fn() -> out %return.param: @F.loc9.%ptr.loc9_51.1 (%ptr.18e) { +// CHECK:STDOUT: fn() -> out %return.param: @F.loc18.%ptr.loc18_51.1 (%ptr.18e) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: %F.type.eb3ec9.1 = name_ref F, file.%F.decl.loc4 [concrete = constants.%F.7088cc.1] -// CHECK:STDOUT: %T.ref.loc13: type = name_ref T, %T.loc9_39.2 [symbolic = %T.loc9_39.1 (constants.%T.091)] +// CHECK:STDOUT: %T.ref.loc30: type = name_ref T, %T.loc18_39.2 [symbolic = %T.loc18_39.1 (constants.%T.091)] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -457,16 +508,16 @@ fn F(generic U: type, generic T: type) -> U* { // CHECK:STDOUT: %return.patt.loc4_40.2 => constants.%return.patt.d67 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.loc9(constants.%U.67d, constants.%T.091) { -// CHECK:STDOUT: %U.patt.loc9_22.2 => constants.%U.patt.3a0 -// CHECK:STDOUT: %U.loc9_22.1 => constants.%U.67d -// CHECK:STDOUT: %T.patt.loc9_39.2 => constants.%T.patt.cb8 -// CHECK:STDOUT: %T.loc9_39.1 => constants.%T.091 -// CHECK:STDOUT: %ptr.loc9_51.1 => constants.%ptr.18e -// CHECK:STDOUT: %.loc9_51.1 => constants.%.6d8 +// CHECK:STDOUT: specific @F.loc18(constants.%U.67d, constants.%T.091) { +// CHECK:STDOUT: %U.patt.loc18_22.2 => constants.%U.patt.3a0 +// CHECK:STDOUT: %U.loc18_22.1 => constants.%U.67d +// CHECK:STDOUT: %T.patt.loc18_39.2 => constants.%T.patt.cb8 +// CHECK:STDOUT: %T.loc18_39.1 => constants.%T.091 +// CHECK:STDOUT: %ptr.loc18_51.1 => constants.%ptr.18e +// CHECK:STDOUT: %.loc18_51.1 => constants.%.6d8 // CHECK:STDOUT: %pattern_type => constants.%pattern_type.423 -// CHECK:STDOUT: %return.param_patt.loc9_51.2 => constants.%return.param_patt.534 -// CHECK:STDOUT: %return.patt.loc9_47.2 => constants.%return.patt.669 +// CHECK:STDOUT: %return.param_patt.loc18_51.2 => constants.%return.param_patt.534 +// CHECK:STDOUT: %return.patt.loc18_47.2 => constants.%return.patt.669 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_rename.carbon @@ -495,7 +546,7 @@ fn F(generic U: type, generic T: type) -> U* { // CHECK:STDOUT: %pattern_type.4f4b84.2: type = pattern_type %ptr.e8f8f9.2 [symbolic] // CHECK:STDOUT: %return.param_patt.27f587.2: %pattern_type.4f4b84.2 = out_param_pattern [symbolic] // CHECK:STDOUT: %return.patt.d67681.2: %pattern_type.4f4b84.2 = return_slot_pattern %return.param_patt.27f587.2, %ptr.e8f8f9.2 [symbolic] -// CHECK:STDOUT: %F.type.eb3ec9.2: type = fn_type @F.loc9 [concrete] +// CHECK:STDOUT: %F.type.eb3ec9.2: type = fn_type @F.loc18 [concrete] // CHECK:STDOUT: %F.7088cc.2: %F.type.eb3ec9.2 = struct_value () [concrete] // CHECK:STDOUT: %require_complete: = require_complete_type %ptr.e8f8f9.2 [symbolic] // CHECK:STDOUT: } @@ -535,27 +586,27 @@ fn F(generic U: type, generic T: type) -> U* { // CHECK:STDOUT: %return.param: ref @F.loc4.%ptr.loc4_44.1 (%ptr.e8f8f9.1) = out_param call_param0 // CHECK:STDOUT: %return: ref @F.loc4.%ptr.loc4_44.1 (%ptr.e8f8f9.1) = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %F.decl.loc9: %F.type.eb3ec9.2 = fn_decl @F.loc9 [concrete = constants.%F.7088cc.2] { -// CHECK:STDOUT: %U.patt.loc9_15.1: %pattern_type.9a5 = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc9_15.2 (constants.%U.patt.3a0)] -// CHECK:STDOUT: %T.patt.loc9_32.1: %pattern_type.9a5 = symbolic_binding_pattern T, 1 [symbolic = %T.patt.loc9_32.2 (constants.%T.patt.cb8)] -// CHECK:STDOUT: %return.param_patt.loc9_44.1: @F.loc9.%pattern_type (%pattern_type.4f4b84.2) = out_param_pattern [symbolic = %return.param_patt.loc9_44.2 (constants.%return.param_patt.27f587.2)] -// CHECK:STDOUT: %return.patt.loc9_40.1: @F.loc9.%pattern_type (%pattern_type.4f4b84.2) = return_slot_pattern %return.param_patt.loc9_44.1, %ptr.loc9_44.2 [symbolic = %return.patt.loc9_40.2 (constants.%return.patt.d67681.2)] +// CHECK:STDOUT: %F.decl.loc18: %F.type.eb3ec9.2 = fn_decl @F.loc18 [concrete = constants.%F.7088cc.2] { +// CHECK:STDOUT: %U.patt.loc18_15.1: %pattern_type.9a5 = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc18_15.2 (constants.%U.patt.3a0)] +// CHECK:STDOUT: %T.patt.loc18_32.1: %pattern_type.9a5 = symbolic_binding_pattern T, 1 [symbolic = %T.patt.loc18_32.2 (constants.%T.patt.cb8)] +// CHECK:STDOUT: %return.param_patt.loc18_44.1: @F.loc18.%pattern_type (%pattern_type.4f4b84.2) = out_param_pattern [symbolic = %return.param_patt.loc18_44.2 (constants.%return.param_patt.27f587.2)] +// CHECK:STDOUT: %return.patt.loc18_40.1: @F.loc18.%pattern_type (%pattern_type.4f4b84.2) = return_slot_pattern %return.param_patt.loc18_44.1, %ptr.loc18_44.2 [symbolic = %return.patt.loc18_40.2 (constants.%return.patt.d67681.2)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %U.ref: type = name_ref U, %U.loc9_15.2 [symbolic = %U.loc9_15.1 (constants.%U.67d)] -// CHECK:STDOUT: %ptr.loc9_44.2: type = ptr_type %U.ref [symbolic = %ptr.loc9_44.1 (constants.%ptr.e8f8f9.2)] -// CHECK:STDOUT: %.loc9_44.2: Core.Form = init_form %ptr.loc9_44.2 [symbolic = %.loc9_44.1 (constants.%.cb6cb9.2)] -// CHECK:STDOUT: %.loc9_17.1: type = splice_block %.loc9_17.2 [concrete = type] { -// CHECK:STDOUT: %.Self.frozen.loc9_15: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc9_17.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %U.ref: type = name_ref U, %U.loc18_15.2 [symbolic = %U.loc18_15.1 (constants.%U.67d)] +// CHECK:STDOUT: %ptr.loc18_44.2: type = ptr_type %U.ref [symbolic = %ptr.loc18_44.1 (constants.%ptr.e8f8f9.2)] +// CHECK:STDOUT: %.loc18_44.2: Core.Form = init_form %ptr.loc18_44.2 [symbolic = %.loc18_44.1 (constants.%.cb6cb9.2)] +// CHECK:STDOUT: %.loc18_17.1: type = splice_block %.loc18_17.2 [concrete = type] { +// CHECK:STDOUT: %.Self.frozen.loc18_15: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc18_17.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %U.loc9_15.2: type = symbolic_binding U, 0 [symbolic = %U.loc9_15.1 (constants.%U.67d)] -// CHECK:STDOUT: %.loc9_34.1: type = splice_block %.loc9_34.2 [concrete = type] { -// CHECK:STDOUT: %.Self.frozen.loc9_32: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc9_34.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %U.loc18_15.2: type = symbolic_binding U, 0 [symbolic = %U.loc18_15.1 (constants.%U.67d)] +// CHECK:STDOUT: %.loc18_34.1: type = splice_block %.loc18_34.2 [concrete = type] { +// CHECK:STDOUT: %.Self.frozen.loc18_32: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc18_34.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc9_32.2: type = symbolic_binding T, 1 [symbolic = %T.loc9_32.1 (constants.%T.091)] -// CHECK:STDOUT: %return.param: ref @F.loc9.%ptr.loc9_44.1 (%ptr.e8f8f9.2) = out_param call_param0 -// CHECK:STDOUT: %return: ref @F.loc9.%ptr.loc9_44.1 (%ptr.e8f8f9.2) = return_slot %return.param +// CHECK:STDOUT: %T.loc18_32.2: type = symbolic_binding T, 1 [symbolic = %T.loc18_32.1 (constants.%T.091)] +// CHECK:STDOUT: %return.param: ref @F.loc18.%ptr.loc18_44.1 (%ptr.e8f8f9.2) = out_param call_param0 +// CHECK:STDOUT: %return: ref @F.loc18.%ptr.loc18_44.1 (%ptr.e8f8f9.2) = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -573,24 +624,24 @@ fn F(generic U: type, generic T: type) -> U* { // CHECK:STDOUT: fn() -> out %return.param: @F.loc4.%ptr.loc4_44.1 (%ptr.e8f8f9.1); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @F.loc9(%U.loc9_15.2: type, %T.loc9_32.2: type) { -// CHECK:STDOUT: %U.patt.loc9_15.2: %pattern_type.9a5 = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc9_15.2 (constants.%U.patt.3a0)] -// CHECK:STDOUT: %U.loc9_15.1: type = symbolic_binding U, 0 [symbolic = %U.loc9_15.1 (constants.%U.67d)] -// CHECK:STDOUT: %T.patt.loc9_32.2: %pattern_type.9a5 = symbolic_binding_pattern T, 1 [symbolic = %T.patt.loc9_32.2 (constants.%T.patt.cb8)] -// CHECK:STDOUT: %T.loc9_32.1: type = symbolic_binding T, 1 [symbolic = %T.loc9_32.1 (constants.%T.091)] -// CHECK:STDOUT: %ptr.loc9_44.1: type = ptr_type %U.loc9_15.1 [symbolic = %ptr.loc9_44.1 (constants.%ptr.e8f8f9.2)] -// CHECK:STDOUT: %.loc9_44.1: Core.Form = init_form %ptr.loc9_44.1 [symbolic = %.loc9_44.1 (constants.%.cb6cb9.2)] -// CHECK:STDOUT: %pattern_type: type = pattern_type %ptr.loc9_44.1 [symbolic = %pattern_type (constants.%pattern_type.4f4b84.2)] -// CHECK:STDOUT: %return.param_patt.loc9_44.2: @F.loc9.%pattern_type (%pattern_type.4f4b84.2) = out_param_pattern [symbolic = %return.param_patt.loc9_44.2 (constants.%return.param_patt.27f587.2)] -// CHECK:STDOUT: %return.patt.loc9_40.2: @F.loc9.%pattern_type (%pattern_type.4f4b84.2) = return_slot_pattern %return.param_patt.loc9_44.2, %ptr.loc9_44.1 [symbolic = %return.patt.loc9_40.2 (constants.%return.patt.d67681.2)] +// CHECK:STDOUT: generic fn @F.loc18(%U.loc18_15.2: type, %T.loc18_32.2: type) { +// CHECK:STDOUT: %U.patt.loc18_15.2: %pattern_type.9a5 = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc18_15.2 (constants.%U.patt.3a0)] +// CHECK:STDOUT: %U.loc18_15.1: type = symbolic_binding U, 0 [symbolic = %U.loc18_15.1 (constants.%U.67d)] +// CHECK:STDOUT: %T.patt.loc18_32.2: %pattern_type.9a5 = symbolic_binding_pattern T, 1 [symbolic = %T.patt.loc18_32.2 (constants.%T.patt.cb8)] +// CHECK:STDOUT: %T.loc18_32.1: type = symbolic_binding T, 1 [symbolic = %T.loc18_32.1 (constants.%T.091)] +// CHECK:STDOUT: %ptr.loc18_44.1: type = ptr_type %U.loc18_15.1 [symbolic = %ptr.loc18_44.1 (constants.%ptr.e8f8f9.2)] +// CHECK:STDOUT: %.loc18_44.1: Core.Form = init_form %ptr.loc18_44.1 [symbolic = %.loc18_44.1 (constants.%.cb6cb9.2)] +// CHECK:STDOUT: %pattern_type: type = pattern_type %ptr.loc18_44.1 [symbolic = %pattern_type (constants.%pattern_type.4f4b84.2)] +// CHECK:STDOUT: %return.param_patt.loc18_44.2: @F.loc18.%pattern_type (%pattern_type.4f4b84.2) = out_param_pattern [symbolic = %return.param_patt.loc18_44.2 (constants.%return.param_patt.27f587.2)] +// CHECK:STDOUT: %return.patt.loc18_40.2: @F.loc18.%pattern_type (%pattern_type.4f4b84.2) = return_slot_pattern %return.param_patt.loc18_44.2, %ptr.loc18_44.1 [symbolic = %return.patt.loc18_40.2 (constants.%return.patt.d67681.2)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type %ptr.loc9_44.1 [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %require_complete: = require_complete_type %ptr.loc18_44.1 [symbolic = %require_complete (constants.%require_complete)] // CHECK:STDOUT: -// CHECK:STDOUT: fn() -> out %return.param: @F.loc9.%ptr.loc9_44.1 (%ptr.e8f8f9.2) { +// CHECK:STDOUT: fn() -> out %return.param: @F.loc18.%ptr.loc18_44.1 (%ptr.e8f8f9.2) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: %F.type.eb3ec9.1 = name_ref F, file.%F.decl.loc4 [concrete = constants.%F.7088cc.1] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc9_32.2 [symbolic = %T.loc9_32.1 (constants.%T.091)] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc18_32.2 [symbolic = %T.loc18_32.1 (constants.%T.091)] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -607,15 +658,15 @@ fn F(generic U: type, generic T: type) -> U* { // CHECK:STDOUT: %return.patt.loc4_40.2 => constants.%return.patt.d67681.1 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.loc9(constants.%U.67d, constants.%T.091) { -// CHECK:STDOUT: %U.patt.loc9_15.2 => constants.%U.patt.3a0 -// CHECK:STDOUT: %U.loc9_15.1 => constants.%U.67d -// CHECK:STDOUT: %T.patt.loc9_32.2 => constants.%T.patt.cb8 -// CHECK:STDOUT: %T.loc9_32.1 => constants.%T.091 -// CHECK:STDOUT: %ptr.loc9_44.1 => constants.%ptr.e8f8f9.2 -// CHECK:STDOUT: %.loc9_44.1 => constants.%.cb6cb9.2 +// CHECK:STDOUT: specific @F.loc18(constants.%U.67d, constants.%T.091) { +// CHECK:STDOUT: %U.patt.loc18_15.2 => constants.%U.patt.3a0 +// CHECK:STDOUT: %U.loc18_15.1 => constants.%U.67d +// CHECK:STDOUT: %T.patt.loc18_32.2 => constants.%T.patt.cb8 +// CHECK:STDOUT: %T.loc18_32.1 => constants.%T.091 +// CHECK:STDOUT: %ptr.loc18_44.1 => constants.%ptr.e8f8f9.2 +// CHECK:STDOUT: %.loc18_44.1 => constants.%.cb6cb9.2 // CHECK:STDOUT: %pattern_type => constants.%pattern_type.4f4b84.2 -// CHECK:STDOUT: %return.param_patt.loc9_44.2 => constants.%return.param_patt.27f587.2 -// CHECK:STDOUT: %return.patt.loc9_40.2 => constants.%return.patt.d67681.2 +// CHECK:STDOUT: %return.param_patt.loc18_44.2 => constants.%return.param_patt.27f587.2 +// CHECK:STDOUT: %return.patt.loc18_40.2 => constants.%return.patt.d67681.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/generic/resolve_used.carbon b/toolchain/check/testdata/function/generic/resolve_used.carbon index b5884d0efc81..fa3c4d3498b2 100644 --- a/toolchain/check/testdata/function/generic/resolve_used.carbon +++ b/toolchain/check/testdata/function/generic/resolve_used.carbon @@ -25,9 +25,22 @@ fn ErrorIfNIsZero(generic N: Core.IntLiteral) { } fn CallNegative() { - // CHECK:STDERR: fail_todo_call_monomorphization_error.carbon:[[@LINE+4]]:3-16: error: unable to monomorphize specific `ErrorIfNIsZero(0)` [ResolvingSpecificHere] - // CHECK:STDERR: fail_todo_call_monomorphization_error.carbon:[[@LINE-5]]:17-27: note: `Core.Int(N)` evaluates to incomplete type `i0` [IncompleteTypeInMonomorphization] - // CHECK:STDERR: min_prelude/parts/int.carbon:11:9-18: note: integer type width of 0 is not positive [IntWidthNotPositive] + // CHECK:STDERR: ╭─┤ fail_todo_call_monomorphization_error.carbon:[[@LINE+17]]:3 + // CHECK:STDERR: │ var unused v: Core.Int(N); + // CHECK:STDERR: · ─────┬───── + // CHECK:STDERR: · ╰──┤ `Core.Int(N)` evaluates to incomplete type `i0` + // CHECK:STDERR: · │ [IncompleteTypeInMonomorphization] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ ErrorIfNIsZero(0); + // CHECK:STDERR: · ━━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: unable to monomorphize specific `ErrorIfNIsZero(0)` + // CHECK:STDERR: · ┃ [ResolvingSpecificHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ min_prelude/parts/int.carbon + // CHECK:STDERR: │ adapt MakeInt(N); + // CHECK:STDERR: · ─────┬──── + // CHECK:STDERR: · ╰──┤ integer type width of 0 is not positive [IntWidthNotPositive] + // CHECK:STDERR: ╰──── // CHECK:STDERR: ErrorIfNIsZero(0); } diff --git a/toolchain/check/testdata/function/generic/undefined.carbon b/toolchain/check/testdata/function/generic/undefined.carbon index 6124e5840e5d..cbb4a0578506 100644 --- a/toolchain/check/testdata/function/generic/undefined.carbon +++ b/toolchain/check/testdata/function/generic/undefined.carbon @@ -39,8 +39,17 @@ library "[[@TEST_NAME]]"; fn Undefined[T: type](x: T); fn CallUndefined() { - // CHECK:STDERR: fail_call_undefined.carbon:[[@LINE+3]]:3-11: error: use of undefined generic function [MissingGenericFunctionDefinition] - // CHECK:STDERR: fail_call_undefined.carbon:[[@LINE-4]]:1-28: note: generic function declared here [MissingGenericFunctionDefinitionHere] + // CHECK:STDERR: ╭─┤ fail_call_undefined.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn Undefined[T: type](x: T); + // CHECK:STDERR: · ──────────────┬───────────── + // CHECK:STDERR: · ╰──┤ generic function declared here + // CHECK:STDERR: · │ [MissingGenericFunctionDefinitionHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Undefined(0 as i32); + // CHECK:STDERR: · ━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: use of undefined generic function + // CHECK:STDERR: · ┃ [MissingGenericFunctionDefinition] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Undefined(0 as i32); } diff --git a/toolchain/check/testdata/generic/complete_type.carbon b/toolchain/check/testdata/generic/complete_type.carbon index 7c411b3d8a78..cc20a5cba766 100644 --- a/toolchain/check/testdata/generic/complete_type.carbon +++ b/toolchain/check/testdata/generic/complete_type.carbon @@ -22,12 +22,34 @@ class A(T: type) { var v: T; } -// CHECK:STDERR: fail_incomplete_in_class.carbon:[[@LINE+7]]:13-19: error: parameter has incomplete type `A(B)` in function definition [IncompleteTypeInFunctionParam] -// CHECK:STDERR: fail_incomplete_in_class.carbon:[[@LINE-4]]:10: note: `T` evaluates to incomplete type `B` [IncompleteTypeInMonomorphization] -// CHECK:STDERR: fail_incomplete_in_class.carbon:[[@LINE-8]]:1-8: note: class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: ╭─┤ fail_incomplete_in_class.carbon:[[@LINE+29]]:13 +// CHECK:STDERR: │ class B; +// CHECK:STDERR: · ────┬─── +// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: │ var v: T; +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ `T` evaluates to incomplete type `B` +// CHECK:STDERR: · │ [IncompleteTypeInMonomorphization] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn F(unused x: A(B)) {} +// CHECK:STDERR: · ┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: parameter has incomplete type `A(B)` in function +// CHECK:STDERR: · ┃ definition +// CHECK:STDERR: · ┃ [IncompleteTypeInFunctionParam] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_incomplete_in_class.carbon:[[@LINE+3]]:13-19: error: parameter has incomplete type `A(B)` in function definition [IncompleteTypeInFunctionParam] -// CHECK:STDERR: fail_incomplete_in_class.carbon:[[@LINE-11]]:1-8: note: class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: ╭─┤ fail_incomplete_in_class.carbon:[[@LINE+12]]:13 +// CHECK:STDERR: │ class B; +// CHECK:STDERR: · ────┬─── +// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn F(unused x: A(B)) {} +// CHECK:STDERR: · ┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: parameter has incomplete type `A(B)` in function +// CHECK:STDERR: · ┃ definition +// CHECK:STDERR: · ┃ [IncompleteTypeInFunctionParam] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused x: A(B)) {} @@ -58,9 +80,21 @@ fn F(generic T: type, p: T*) { let _: T = *p; } -// CHECK:STDERR: fail_incomplete_in_function_at_eof.carbon:[[@LINE+4]]:15: error: unable to monomorphize specific `F(B)` [ResolvingSpecificHere] -// CHECK:STDERR: fail_incomplete_in_function_at_eof.carbon:[[@LINE-4]]:10: note: `T` evaluates to incomplete type `B` [IncompleteTypeInMonomorphization] -// CHECK:STDERR: fail_incomplete_in_function_at_eof.carbon:[[@LINE-8]]:1-8: note: class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: ╭─┤ fail_incomplete_in_function_at_eof.carbon:[[@LINE+16]]:15 +// CHECK:STDERR: │ class B; +// CHECK:STDERR: · ────┬─── +// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: │ let _: T = *p; +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ `T` evaluates to incomplete type `B` +// CHECK:STDERR: · │ [IncompleteTypeInMonomorphization] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn G(p: B*) { F(B, p); } +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: unable to monomorphize specific `F(B)` +// CHECK:STDERR: · ┃ [ResolvingSpecificHere] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn G(p: B*) { F(B, p); } @@ -123,14 +157,14 @@ fn G(p: B*) { F(B, p); } // CHECK:STDOUT: %x.patt: %pattern_type.709 = wrapper_binding_pattern x, %x.param_patt [concrete = constants.%x.patt] // CHECK:STDOUT: } { // CHECK:STDOUT: %x.param: %A.7d2 = value_param call_param0 -// CHECK:STDOUT: %.loc17: type = splice_block %A [concrete = constants.%A.7d2] { +// CHECK:STDOUT: %.loc39: type = splice_block %A [concrete = constants.%A.7d2] { // CHECK:STDOUT: %A.ref: %A.type = name_ref A, file.%A.decl [concrete = constants.%A.generic] // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl.loc4 [concrete = constants.%B] // CHECK:STDOUT: %A: type = class_type @A, @A(constants.%B) [concrete = constants.%A.7d2] // CHECK:STDOUT: } // CHECK:STDOUT: %x: %A.7d2 = wrapper_binding x, %x.param // CHECK:STDOUT: } -// CHECK:STDOUT: %B.decl.loc19: type = class_decl @B [concrete = constants.%B] {} {} +// CHECK:STDOUT: %B.decl.loc41: type = class_decl @B [concrete = constants.%B] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B { @@ -394,9 +428,9 @@ fn G(p: B*) { F(B, p); } // CHECK:STDOUT: %p.patt: %pattern_type.3c8 = wrapper_binding_pattern p, %p.param_patt [concrete = constants.%p.patt.8dd] // CHECK:STDOUT: } { // CHECK:STDOUT: %p.param: %ptr.432 = value_param call_param0 -// CHECK:STDOUT: %.loc14: type = splice_block %ptr [concrete = constants.%ptr.432] { -// CHECK:STDOUT: %B.ref.loc14_9: type = name_ref B, file.%B.decl [concrete = constants.%B] -// CHECK:STDOUT: %ptr: type = ptr_type %B.ref.loc14_9 [concrete = constants.%ptr.432] +// CHECK:STDOUT: %.loc26: type = splice_block %ptr [concrete = constants.%ptr.432] { +// CHECK:STDOUT: %B.ref.loc26_9: type = name_ref B, file.%B.decl [concrete = constants.%B] +// CHECK:STDOUT: %ptr: type = ptr_type %B.ref.loc26_9 [concrete = constants.%ptr.432] // CHECK:STDOUT: } // CHECK:STDOUT: %p: %ptr.432 = wrapper_binding p, %p.param // CHECK:STDOUT: } @@ -435,7 +469,7 @@ fn G(p: B*) { F(B, p); } // CHECK:STDOUT: fn @G(%p.param: %ptr.432) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] -// CHECK:STDOUT: %B.ref.loc14_17: type = name_ref B, file.%B.decl [concrete = constants.%B] +// CHECK:STDOUT: %B.ref.loc26_17: type = name_ref B, file.%B.decl [concrete = constants.%B] // CHECK:STDOUT: %p.ref: %ptr.432 = name_ref p, %p // CHECK:STDOUT: %F.specific_fn: = specific_function %F.ref, @F(constants.%B) [concrete = constants.%F.specific_fn] // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.specific_fn(%p.ref) diff --git a/toolchain/check/testdata/generic/dot_self_symbolic_type.carbon b/toolchain/check/testdata/generic/dot_self_symbolic_type.carbon index 6d1b50d3ea97..61cfd2fe4f6e 100644 --- a/toolchain/check/testdata/generic/dot_self_symbolic_type.carbon +++ b/toolchain/check/testdata/generic/dot_self_symbolic_type.carbon @@ -28,8 +28,18 @@ class C(CC: type) { class D(DD: type) { fn G(generic T: type) { //@dump-sem-ir-begin - // CHECK:STDERR: fail_dot_self_symbolic_type.carbon:[[@LINE+3]]:5-14: error: cannot convert type `T` into type implementing `A(DD) where .(A(DD).X) = DD` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_dot_self_symbolic_type.carbon:[[@LINE-8]]:3-47: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_dot_self_symbolic_type.carbon:[[@LINE+13]]:5 + // CHECK:STDERR: │ fn F(unused generic T: A(CC) where .X = CC) {} + // CHECK:STDERR: · ──────────────────────┬────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ C(DD).F(T); + // CHECK:STDERR: · ┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `T` into type implementing + // CHECK:STDERR: · ┃ `A(DD) where .(A(DD).X) = DD` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: C(DD).F(T); //@dump-sem-ir-end @@ -211,19 +221,19 @@ fn H(generic T: type) { // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %DD: type = symbolic_binding DD, 0 [symbolic = %DD (constants.%DD)] -// CHECK:STDOUT: %C.loc21_9.2: type = class_type @C, @C(%DD) [symbolic = %C.loc21_9.2 (constants.%C.04ad3b.2)] -// CHECK:STDOUT: %require_complete: = require_complete_type %C.loc21_9.2 [symbolic = %require_complete (constants.%require_complete.095)] +// CHECK:STDOUT: %C.loc31_9.2: type = class_type @C, @C(%DD) [symbolic = %C.loc31_9.2 (constants.%C.04ad3b.2)] +// CHECK:STDOUT: %require_complete: = require_complete_type %C.loc31_9.2 [symbolic = %require_complete (constants.%require_complete.095)] // CHECK:STDOUT: %C.F.type: type = fn_type @C.F, @C(%DD) [symbolic = %C.F.type (constants.%C.F.type.8772f5.2)] // CHECK:STDOUT: %C.F: @D.G.%C.F.type (%C.F.type.8772f5.2) = struct_value () [symbolic = %C.F (constants.%C.F.889ece.2)] // CHECK:STDOUT: // CHECK:STDOUT: fn() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [concrete = constants.%C.generic] -// CHECK:STDOUT: %.loc21_7: type = specific_constant @D.%DD.loc15_11.2, @D(constants.%DD) [symbolic = %DD (constants.%DD)] -// CHECK:STDOUT: %DD.ref: type = name_ref DD, %.loc21_7 [symbolic = %DD (constants.%DD)] -// CHECK:STDOUT: %C.loc21_9.1: type = class_type @C, @C(constants.%DD) [symbolic = %C.loc21_9.2 (constants.%C.04ad3b.2)] -// CHECK:STDOUT: %.loc21_10: @D.G.%C.F.type (%C.F.type.8772f5.2) = specific_constant @C.%C.F.decl, @C(constants.%DD) [symbolic = %C.F (constants.%C.F.889ece.2)] -// CHECK:STDOUT: %F.ref: @D.G.%C.F.type (%C.F.type.8772f5.2) = name_ref F, %.loc21_10 [symbolic = %C.F (constants.%C.F.889ece.2)] +// CHECK:STDOUT: %.loc31_7: type = specific_constant @D.%DD.loc15_11.2, @D(constants.%DD) [symbolic = %DD (constants.%DD)] +// CHECK:STDOUT: %DD.ref: type = name_ref DD, %.loc31_7 [symbolic = %DD (constants.%DD)] +// CHECK:STDOUT: %C.loc31_9.1: type = class_type @C, @C(constants.%DD) [symbolic = %C.loc31_9.2 (constants.%C.04ad3b.2)] +// CHECK:STDOUT: %.loc31_10: @D.G.%C.F.type (%C.F.type.8772f5.2) = specific_constant @C.%C.F.decl, @C(constants.%DD) [symbolic = %C.F (constants.%C.F.889ece.2)] +// CHECK:STDOUT: %F.ref: @D.G.%C.F.type (%C.F.type.8772f5.2) = name_ref F, %.loc31_10 [symbolic = %C.F (constants.%C.F.889ece.2)] // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc16_17.2 [symbolic = %T.loc16_17.1 (constants.%T.091)] // CHECK:STDOUT: // CHECK:STDOUT: } @@ -289,7 +299,7 @@ fn H(generic T: type) { // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %DD => constants.%empty_struct_type -// CHECK:STDOUT: %C.loc21_9.2 => constants.%C.664 +// CHECK:STDOUT: %C.loc31_9.2 => constants.%C.664 // CHECK:STDOUT: %require_complete => constants.%complete_type // CHECK:STDOUT: %C.F.type => constants.%C.F.type.157 // CHECK:STDOUT: %C.F => constants.%C.F.0b5 diff --git a/toolchain/check/testdata/generic/extend_type_completion.carbon b/toolchain/check/testdata/generic/extend_type_completion.carbon index 1ffe752a90b5..afb5e8acfd37 100644 --- a/toolchain/check/testdata/generic/extend_type_completion.carbon +++ b/toolchain/check/testdata/generic/extend_type_completion.carbon @@ -38,8 +38,17 @@ class C(N: i32) { } // C extends K so the type of K is completed, but is invalid. -// CHECK:STDERR: fail_class_extend_impl_does_need_complete_interface.carbon:[[@LINE+3]]:13-20: error: parameter has incomplete type `C(-1)` in function definition [IncompleteTypeInFunctionParam] -// CHECK:STDERR: fail_class_extend_impl_does_need_complete_interface.carbon:[[@LINE-5]]:18-33: note: array bound of -1 is negative [ArrayBoundNegative] +// CHECK:STDERR: ╭─┤ fail_class_extend_impl_does_need_complete_interface.carbon:[[@LINE+12]]:13 +// CHECK:STDERR: │ extend impl as K(Array(i32, N)) {} +// CHECK:STDERR: · ────────┬─────── +// CHECK:STDERR: · ╰──┤ array bound of -1 is negative [ArrayBoundNegative] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn F(unused v: C(-1)) {} +// CHECK:STDERR: · ┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: parameter has incomplete type `C(-1)` in function +// CHECK:STDERR: · ┃ definition +// CHECK:STDERR: · ┃ [IncompleteTypeInFunctionParam] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused v: C(-1)) {} @@ -77,9 +86,23 @@ interface I(N: i32) { // need a location for the type in context.bind_name_map() to use as the // location to Convert(). // -// CHECK:STDERR: fail_interface_extend_require_impls_does_need_complete_interface.carbon:[[@LINE+4]]:13-20: error: parameter has incomplete type `I(-1)` in function definition [IncompleteTypeInFunctionParam] -// CHECK:STDERR: fail_interface_extend_require_impls_does_need_complete_interface.carbon:[[@LINE-10]]:24-27: note: `J(N)` evaluates to incomplete type `J(-1)` [IncompleteTypeInMonomorphization] -// CHECK:STDERR: fail_interface_extend_require_impls_does_need_complete_interface.carbon:[[@LINE-14]]:24-39: note: array bound of -1 is negative [ArrayBoundNegative] +// CHECK:STDERR: ╭─┤ fail_interface_extend_require_impls_does_need_complete_interface.carbon:[[@LINE+18]]:13 +// CHECK:STDERR: │ extend require impls K(Array(i32, N)); +// CHECK:STDERR: · ────────┬─────── +// CHECK:STDERR: · ╰──┤ array bound of -1 is negative +// CHECK:STDERR: · │ [ArrayBoundNegative] +// CHECK:STDERR: ┆ +// CHECK:STDERR: │ extend require impls J(N); +// CHECK:STDERR: · ──┬─ +// CHECK:STDERR: · ╰──┤ `J(N)` evaluates to incomplete type `J(-1)` +// CHECK:STDERR: · │ [IncompleteTypeInMonomorphization] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn F(unused v: I(-1)) {} +// CHECK:STDERR: · ┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: parameter has incomplete type `I(-1)` in function +// CHECK:STDERR: · ┃ definition +// CHECK:STDERR: · ┃ [IncompleteTypeInFunctionParam] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused v: I(-1)) {} @@ -112,9 +135,23 @@ constraint I(N: i32) { } // I extends J extends K so the type of K is completed, but is invalid. -// CHECK:STDERR: fail_constraint_extend_require_impls_does_need_complete_interface.carbon:[[@LINE+4]]:13-20: error: parameter has incomplete type `I(-1)` in function definition [IncompleteTypeInFunctionParam] -// CHECK:STDERR: fail_constraint_extend_require_impls_does_need_complete_interface.carbon:[[@LINE-5]]:24-27: note: `J(N)` evaluates to incomplete type `J(-1)` [IncompleteTypeInMonomorphization] -// CHECK:STDERR: fail_constraint_extend_require_impls_does_need_complete_interface.carbon:[[@LINE-9]]:24-39: note: array bound of -1 is negative [ArrayBoundNegative] +// CHECK:STDERR: ╭─┤ fail_constraint_extend_require_impls_does_need_complete_interface.carbon:[[@LINE+18]]:13 +// CHECK:STDERR: │ extend require impls K(Array(i32, N)); +// CHECK:STDERR: · ────────┬─────── +// CHECK:STDERR: · ╰──┤ array bound of -1 is negative +// CHECK:STDERR: · │ [ArrayBoundNegative] +// CHECK:STDERR: ┆ +// CHECK:STDERR: │ extend require impls J(N); +// CHECK:STDERR: · ──┬─ +// CHECK:STDERR: · ╰──┤ `J(N)` evaluates to incomplete type `J(-1)` +// CHECK:STDERR: · │ [IncompleteTypeInMonomorphization] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn F(unused v: I(-1)) {} +// CHECK:STDERR: · ┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: parameter has incomplete type `I(-1)` in function +// CHECK:STDERR: · ┃ definition +// CHECK:STDERR: · ┃ [IncompleteTypeInFunctionParam] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused v: I(-1)) {} diff --git a/toolchain/check/testdata/generic/fail_generic_copy.carbon b/toolchain/check/testdata/generic/fail_generic_copy.carbon index 7de98dc59bb6..97856bafe574 100644 --- a/toolchain/check/testdata/generic/fail_generic_copy.carbon +++ b/toolchain/check/testdata/generic/fail_generic_copy.carbon @@ -15,8 +15,13 @@ library "[[@TEST_NAME]]"; fn F[T: type](x: T) -> T { - // CHECK:STDERR: fail_return.carbon:[[@LINE+3]]:10: error: cannot copy value of type `T` [CopyOfUncopyableType] - // CHECK:STDERR: fail_return.carbon:[[@LINE+2]]:10: note: type `T` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_return.carbon:[[@LINE+8]]:10 + // CHECK:STDERR: -> │ return x; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot copy value of type `T` [CopyOfUncopyableType] + // CHECK:STDERR: · ╰────┤ type `T` does not implement interface `Core.Copy` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return x; } @@ -26,8 +31,14 @@ fn F[T: type](x: T) -> T { library "[[@TEST_NAME]]"; fn F[T: Core.Destroy](x: T) { - // CHECK:STDERR: fail_var.carbon:[[@LINE+3]]:21: error: cannot copy value of type `T` [CopyOfUncopyableType] - // CHECK:STDERR: fail_var.carbon:[[@LINE+2]]:21: note: type `T` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_var.carbon:[[@LINE+9]]:21 + // CHECK:STDERR: -> │ var unused y: T = x; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot copy value of type `T` + // CHECK:STDERR: · │ ┃ [CopyOfUncopyableType] + // CHECK:STDERR: · ╰────┤ type `T` does not implement interface `Core.Copy` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused y: T = x; } diff --git a/toolchain/check/testdata/generic/identify_specific_facet_type.carbon b/toolchain/check/testdata/generic/identify_specific_facet_type.carbon index 4f9f8b9cd17c..077c2467df7c 100644 --- a/toolchain/check/testdata/generic/identify_specific_facet_type.carbon +++ b/toolchain/check/testdata/generic/identify_specific_facet_type.carbon @@ -27,8 +27,17 @@ constraint J(N: i32) { require impls L(N); } -// CHECK:STDERR: fail_error_in_identifying_require_facet_type.carbon:[[@LINE+3]]:1-18: error: facet type `J(-1)` cannot be identified in `impl as` [ImplOfUnidentifiedFacetType] -// CHECK:STDERR: fail_error_in_identifying_require_facet_type.carbon:[[@LINE-7]]:30: note: array bound of -1 is negative [ArrayBoundNegative] +// CHECK:STDERR: ╭─┤ fail_error_in_identifying_require_facet_type.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: │ require impls K(Array(i32, N)); +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ array bound of -1 is negative +// CHECK:STDERR: · │ [ArrayBoundNegative] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ impl {} as J(-1) {} +// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: facet type `J(-1)` cannot be identified in `impl as` +// CHECK:STDERR: · ┃ [ImplOfUnidentifiedFacetType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl {} as J(-1) {} @@ -46,8 +55,17 @@ constraint J(N: i32) { extend require impls K(Array(i32, N)); } -// CHECK:STDERR: fail_error_in_identifying_extend_require_facet_type.carbon:[[@LINE+3]]:1-18: error: facet type `J(-1)` cannot be identified in `impl as` [ImplOfUnidentifiedFacetType] -// CHECK:STDERR: fail_error_in_identifying_extend_require_facet_type.carbon:[[@LINE-4]]:24-39: note: array bound of -1 is negative [ArrayBoundNegative] +// CHECK:STDERR: ╭─┤ fail_error_in_identifying_extend_require_facet_type.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: │ extend require impls K(Array(i32, N)); +// CHECK:STDERR: · ────────┬─────── +// CHECK:STDERR: · ╰──┤ array bound of -1 is negative +// CHECK:STDERR: · │ [ArrayBoundNegative] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ impl {} as J(-1) {} +// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: facet type `J(-1)` cannot be identified in `impl as` +// CHECK:STDERR: · ┃ [ImplOfUnidentifiedFacetType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl {} as J(-1) {} @@ -80,10 +98,28 @@ constraint S(N: Core.IntLiteral) { fn F(generic N: Core.IntLiteral, generic _: S(N) where .Z2 impls Y) {} fn G(generic T: Y) { - // CHECK:STDERR: fail_monomorphization_during_period_self_substitution.carbon:[[@LINE+5]]:3-10: error: constructed invalid specific for `S(N) where .(CanFailToMonomorphize(N).Z2) impls Y` from argument [SubstitutingGenericParamType] - // CHECK:STDERR: fail_monomorphization_during_period_self_substitution.carbon:[[@LINE-17]]:24-47: note: `CanFailToMonomorphize(N)` evaluates to incomplete type `CanFailToMonomorphize(-1)` [IncompleteTypeInMonomorphization] - // CHECK:STDERR: fail_monomorphization_during_period_self_substitution.carbon:[[@LINE-23]]:21: note: array bound of -1 is negative [ArrayBoundNegative] - // CHECK:STDERR: fail_monomorphization_during_period_self_substitution.carbon:[[@LINE-6]]:1-69: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_monomorphization_during_period_self_substitution.carbon:[[@LINE+23]]:3 + // CHECK:STDERR: │ let Z1: Array((), N); + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ array bound of -1 is negative [ArrayBoundNegative] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ extend require impls CanFailToMonomorphize(N); + // CHECK:STDERR: · ┬─────────────────────── + // CHECK:STDERR: · ╰──┤ `CanFailToMonomorphize(N)` evaluates to incomplete + // CHECK:STDERR: · │ type `CanFailToMonomorphize(-1)` + // CHECK:STDERR: · │ [IncompleteTypeInMonomorphization] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ fn F(generic N: Core.IntLiteral, generic _: S(N) where .Z2 impls Y) {} + // CHECK:STDERR: · ─────────────────────────┬─────────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(-1, T); + // CHECK:STDERR: · ┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: constructed invalid specific for + // CHECK:STDERR: · ┃ `S(N) where .(CanFailToMonomorphize(N).Z2) impls Y` from argument + // CHECK:STDERR: · ┃ [SubstitutingGenericParamType] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(-1, T); }; @@ -106,9 +142,22 @@ constraint S(N: Core.IntLiteral) { fn F(generic N: Core.IntLiteral, generic _: S(N)) {} fn G(generic T: Z) { - // CHECK:STDERR: fail_monomorphization_identify_in_call.carbon:[[@LINE+4]]:3-10: error: facet type `S(-1)` can not be identified [ImplLookupInUnidentifiedFacetType] - // CHECK:STDERR: fail_monomorphization_identify_in_call.carbon:[[@LINE-7]]:24-49: note: array bound of -1 is negative [ArrayBoundNegative] - // CHECK:STDERR: fail_monomorphization_identify_in_call.carbon:[[@LINE-5]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_monomorphization_identify_in_call.carbon:[[@LINE+17]]:3 + // CHECK:STDERR: │ extend require impls Z where .Z1 = Array((), N); + // CHECK:STDERR: · ─────────────┬──────────── + // CHECK:STDERR: · ╰──┤ array bound of -1 is negative + // CHECK:STDERR: · │ [ArrayBoundNegative] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ fn F(generic N: Core.IntLiteral, generic _: S(N)) {} + // CHECK:STDERR: · ─────────────────────────┬───────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(-1, T); + // CHECK:STDERR: · ━━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: facet type `S(-1)` can not be identified + // CHECK:STDERR: · ┃ [ImplLookupInUnidentifiedFacetType] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(-1, T); }; @@ -131,9 +180,21 @@ constraint S(N: Core.IntLiteral) { fn F(generic N: Core.IntLiteral, generic _: S(N) where .Z1 = Array((), N)) {} fn G(generic T: Z) { - // CHECK:STDERR: fail_monomorphization_during_deduction_in_call.carbon:[[@LINE+4]]:3-10: error: constructed invalid specific for `S(N) where .(Z.Z1) = ` from argument [SubstitutingGenericParamType] - // CHECK:STDERR: fail_monomorphization_during_deduction_in_call.carbon:[[@LINE-4]]:42-73: note: array bound of -1 is negative [ArrayBoundNegative] - // CHECK:STDERR: fail_monomorphization_during_deduction_in_call.carbon:[[@LINE-5]]:1-76: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_monomorphization_during_deduction_in_call.carbon:[[@LINE+16]]:3 + // CHECK:STDERR: │ fn F(generic N: Core.IntLiteral, generic _: S(N) where .Z1 = Array((), N)) {} + // CHECK:STDERR: · ──────────────────────────────────────┬──┬────────────────────────────────── + // CHECK:STDERR: · ╰─────┤ while deducing parameters of + // CHECK:STDERR: · │ │ generic declared here + // CHECK:STDERR: · │ │ [DeductionGenericHere] + // CHECK:STDERR: · ╰────┤ array bound of -1 is negative + // CHECK:STDERR: · │ [ArrayBoundNegative] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(-1, T); + // CHECK:STDERR: · ┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: constructed invalid specific for + // CHECK:STDERR: · ┃ `S(N) where .(Z.Z1) = ` from argument + // CHECK:STDERR: · ┃ [SubstitutingGenericParamType] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(-1, T); }; diff --git a/toolchain/check/testdata/generic/import.carbon b/toolchain/check/testdata/generic/import.carbon index 23d40e8892f5..e8f336e1b12f 100644 --- a/toolchain/check/testdata/generic/import.carbon +++ b/toolchain/check/testdata/generic/import.carbon @@ -12,6 +12,16 @@ // --- leaf.h +// CHECK:STDERR: ╷ ╭── imported from: fail_use.carbon [InImport] +// CHECK:STDERR: │ ├── included from: middle.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./leaf.h:[[@LINE+8]]:7 +// CHECK:STDERR: -> │ class Leaf {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: +// CHECK:STDERR: · ┃ `indirect import of C++ declaration with no direct Cpp import` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: class Leaf {}; // --- middle.carbon @@ -34,10 +44,6 @@ class Middle(T: type) { // Consequently, this test can be removed if this TODO is resolved and there are // no other ways of triggering an error while importing a valid generic. -// CHECK:STDERR: imported from: fail_use.carbon:[[@LINE+4]]:1 [InImport] -// CHECK:STDERR: included from: middle.carbon:3:10 [InCppInclude] -// CHECK:STDERR: ./leaf.h:2:7: error: semantics TODO: `indirect import of C++ declaration with no direct Cpp import` [SemanticsTodo] -// CHECK:STDERR: import library "lib"; alias M = Middle; diff --git a/toolchain/check/testdata/generic/local.carbon b/toolchain/check/testdata/generic/local.carbon index c6194f7657a5..09907b461a27 100644 --- a/toolchain/check/testdata/generic/local.carbon +++ b/toolchain/check/testdata/generic/local.carbon @@ -29,8 +29,13 @@ library "[[@TEST_NAME]]"; fn F() { // TODO: Decide on what behavior we want here. We don't reject the corresponding case outside of a function. - // CHECK:STDERR: fail_param_shadows_class.carbon:[[@LINE+3]]:9: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] - // CHECK:STDERR: fail_param_shadows_class.carbon:[[@LINE+2]]:11-17: note: name is previously declared here [NameDeclPrevious] + // CHECK:STDERR: ╭─┤ fail_param_shadows_class.carbon:[[@LINE+8]]:9 + // CHECK:STDERR: -> │ class C(C: type) { + // CHECK:STDERR: · ┳ ───┬─── + // CHECK:STDERR: · ┗━━━━━━━┫ error: duplicate name `C` being declared in the same scope + // CHECK:STDERR: · │ ┃ [NameDeclDuplicate] + // CHECK:STDERR: · ╰────┤ name is previously declared here [NameDeclPrevious] + // CHECK:STDERR: ╰──── // CHECK:STDERR: class C(C: type) { } @@ -289,9 +294,9 @@ class C(C: type) { // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic class @C(%C.loc9_12.2: type) { -// CHECK:STDOUT: %C.patt.loc9_12.2: %pattern_type = symbolic_binding_pattern C, 0 [symbolic = %C.patt.loc9_12.2 (constants.%C.patt)] -// CHECK:STDOUT: %C.loc9_12.1: type = symbolic_binding C, 0 [symbolic = %C.loc9_12.1 (constants.%C.67d)] +// CHECK:STDOUT: generic class @C(%C.loc14_12.2: type) { +// CHECK:STDOUT: %C.patt.loc14_12.2: %pattern_type = symbolic_binding_pattern C, 0 [symbolic = %C.patt.loc14_12.2 (constants.%C.patt)] +// CHECK:STDOUT: %C.loc14_12.1: type = symbolic_binding C, 0 [symbolic = %C.loc14_12.1 (constants.%C.67d)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -307,20 +312,20 @@ class C(C: type) { // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %C.decl: %C.type = class_decl @C [concrete = constants.%C.generic] { -// CHECK:STDOUT: %C.patt.loc9_12.1: %pattern_type = symbolic_binding_pattern C, 0 [symbolic = %C.patt.loc9_12.2 (constants.%C.patt)] +// CHECK:STDOUT: %C.patt.loc14_12.1: %pattern_type = symbolic_binding_pattern C, 0 [symbolic = %C.patt.loc14_12.2 (constants.%C.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc9_14.1: type = splice_block %.loc9_14.2 [concrete = type] { +// CHECK:STDOUT: %.loc14_14.1: type = splice_block %.loc14_14.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc9_14.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc14_14.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %C.loc9_12.2: type = symbolic_binding C, 0 [symbolic = %C.loc9_12.1 (constants.%C.67d)] +// CHECK:STDOUT: %C.loc14_12.2: type = symbolic_binding C, 0 [symbolic = %C.loc14_12.1 (constants.%C.67d)] // CHECK:STDOUT: } // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @C(constants.%C.67d) { -// CHECK:STDOUT: %C.patt.loc9_12.2 => constants.%C.patt -// CHECK:STDOUT: %C.loc9_12.1 => constants.%C.67d +// CHECK:STDOUT: %C.patt.loc14_12.2 => constants.%C.patt +// CHECK:STDOUT: %C.loc14_12.1 => constants.%C.67d // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- nonlocal_param_shadows_class.carbon diff --git a/toolchain/check/testdata/generic/template/argument.carbon b/toolchain/check/testdata/generic/template/argument.carbon index 0e4cab7486f6..b89b5193fa15 100644 --- a/toolchain/check/testdata/generic/template/argument.carbon +++ b/toolchain/check/testdata/generic/template/argument.carbon @@ -74,8 +74,17 @@ let T: type = Y; fn F(template T: type, unused y: T) {} fn H(y: Y) { - // CHECK:STDERR: fail_non_constant_type_argument.carbon:[[@LINE+3]]:3-9: error: argument for generic parameter is not a compile-time constant [CompTimeArgumentNotConstant] - // CHECK:STDERR: fail_non_constant_type_argument.carbon:[[@LINE-4]]:6-21: note: initializing generic parameter `T` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_non_constant_type_argument.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn F(template T: type, unused y: T) {} + // CHECK:STDERR: · ────────┬─────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(T, y); + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: argument for generic parameter is not a compile-time constant + // CHECK:STDERR: · ┃ [CompTimeArgumentNotConstant] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(T, y); } @@ -88,8 +97,17 @@ class Y {} fn F(unused template X: Y) {} fn H(y: Y) { - // CHECK:STDERR: fail_non_constant_nontype_argument.carbon:[[@LINE+3]]:3-6: error: argument for generic parameter is not a compile-time constant [CompTimeArgumentNotConstant] - // CHECK:STDERR: fail_non_constant_nontype_argument.carbon:[[@LINE-4]]:13-25: note: initializing generic parameter `X` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_non_constant_nontype_argument.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn F(unused template X: Y) {} + // CHECK:STDERR: · ──────┬────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `X` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(y); + // CHECK:STDERR: · ━━┳━ + // CHECK:STDERR: · ┗━━┫ error: argument for generic parameter is not a compile-time constant + // CHECK:STDERR: · ┃ [CompTimeArgumentNotConstant] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(y); } diff --git a/toolchain/check/testdata/generic/template/call.carbon b/toolchain/check/testdata/generic/template/call.carbon index 3adf5c64fe2a..690250a7fb51 100644 --- a/toolchain/check/testdata/generic/template/call.carbon +++ b/toolchain/check/testdata/generic/template/call.carbon @@ -20,8 +20,17 @@ fn F[template G: type](H: G, x: X) { } fn TakeX(unused x: X) {} -// CHECK:STDERR: fail_todo_dependent_call_nonconst_arg.carbon:[[@LINE+3]]:21: error: unable to monomorphize specific `F()` [ResolvingSpecificHere] -// CHECK:STDERR: fail_todo_dependent_call_nonconst_arg.carbon:[[@LINE-5]]:3-6: note: value of type `` is not callable [CallToNonCallable] +// CHECK:STDERR: ╭─┤ fail_todo_dependent_call_nonconst_arg.carbon:[[@LINE+12]]:21 +// CHECK:STDERR: │ H(x); +// CHECK:STDERR: · ──┬─ +// CHECK:STDERR: · ╰──┤ value of type `` is not callable [CallToNonCallable] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn GoodCall(x: X) { F(TakeX, x); } +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: unable to monomorphize specific +// CHECK:STDERR: · ┃ `F()` +// CHECK:STDERR: · ┃ [ResolvingSpecificHere] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn GoodCall(x: X) { F(TakeX, x); } @@ -36,7 +45,16 @@ fn F[template G: type](H: G, x: X) { fn TakeY(unused y: Y) {} // TODO: should fail, but not because of UseOfNonExprAsValue -// CHECK:STDERR: fail_dependent_call_nonconst_arg_wrong_type.carbon:[[@LINE+3]]:20: error: unable to monomorphize specific `F()` [ResolvingSpecificHere] -// CHECK:STDERR: fail_dependent_call_nonconst_arg_wrong_type.carbon:[[@LINE-6]]:3-6: note: value of type `` is not callable [CallToNonCallable] +// CHECK:STDERR: ╭─┤ fail_dependent_call_nonconst_arg_wrong_type.carbon:[[@LINE+12]]:20 +// CHECK:STDERR: │ H(x); +// CHECK:STDERR: · ──┬─ +// CHECK:STDERR: · ╰──┤ value of type `` is not callable [CallToNonCallable] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn BadCall(x: X) { F(TakeY, x); } +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: unable to monomorphize specific +// CHECK:STDERR: · ┃ `F()` +// CHECK:STDERR: · ┃ [ResolvingSpecificHere] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn BadCall(x: X) { F(TakeY, x); } diff --git a/toolchain/check/testdata/generic/template/convert.carbon b/toolchain/check/testdata/generic/template/convert.carbon index d932861aaa28..53a9e8ef4fb4 100644 --- a/toolchain/check/testdata/generic/template/convert.carbon +++ b/toolchain/check/testdata/generic/template/convert.carbon @@ -48,9 +48,20 @@ fn F[template T: type](x: T) -> i32 { class D {} fn Test(d: D) -> i32 { - // CHECK:STDERR: fail_cannot_convert.carbon:[[@LINE+4]]:10: error: unable to monomorphize specific `F(D)` [ResolvingSpecificHere] - // CHECK:STDERR: fail_cannot_convert.carbon:[[@LINE-8]]:16: note: cannot implicitly convert expression of type `D` to `i32` [ConversionFailure] - // CHECK:STDERR: fail_cannot_convert.carbon:[[@LINE-9]]:16: note: type `D` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_cannot_convert.carbon:[[@LINE+15]]:10 + // CHECK:STDERR: │ let n: i32 = x; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ cannot implicitly convert expression of type `D` to `i32` + // CHECK:STDERR: · │ │ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `D` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(i32)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ return F(d); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: unable to monomorphize specific `F(D)` + // CHECK:STDERR: · ┃ [ResolvingSpecificHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return F(d); } @@ -178,9 +189,19 @@ fn AsI32[template T: type](x: T) -> i32 { class D {} fn Test(d: D) { - // CHECK:STDERR: fail_cannot_as.carbon:[[@LINE+4]]:16-20: error: unable to monomorphize specific `AsI32(D)` [ResolvingSpecificHere] - // CHECK:STDERR: fail_cannot_as.carbon:[[@LINE-7]]:10-17: note: cannot convert expression of type `D` to `i32` with `as` [ConversionFailure] - // CHECK:STDERR: fail_cannot_as.carbon:[[@LINE-8]]:10-17: note: type `D` does not implement interface `Core.As(i32)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_cannot_as.carbon:[[@LINE+14]]:16 + // CHECK:STDERR: │ return x as i32; + // CHECK:STDERR: · ────┬─── + // CHECK:STDERR: · ╰──┤ cannot convert expression of type `D` to `i32` with `as` + // CHECK:STDERR: · │ │ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `D` does not implement interface `Core.As(i32)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ let _: i32 = AsI32(d); + // CHECK:STDERR: · ━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: unable to monomorphize specific `AsI32(D)` + // CHECK:STDERR: · ┃ [ResolvingSpecificHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: i32 = AsI32(d); } @@ -221,9 +242,19 @@ fn AsType[template T: type](x: T, template U: type) { class D {} fn Test(d: D) { - // CHECK:STDERR: fail_cannot_as_type.carbon:[[@LINE+4]]:3-8: error: unable to monomorphize specific `AsType(D, i32)` [ResolvingSpecificHere] - // CHECK:STDERR: fail_cannot_as_type.carbon:[[@LINE-7]]:14-19: note: cannot convert expression of type `D` to `i32` with `as` [ConversionFailure] - // CHECK:STDERR: fail_cannot_as_type.carbon:[[@LINE-8]]:14-19: note: type `D` does not implement interface `Core.As(i32)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_cannot_as_type.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: │ let _: U = x as U; + // CHECK:STDERR: · ───┬── + // CHECK:STDERR: · ╰──┤ cannot convert expression of type `D` to `i32` with `as` + // CHECK:STDERR: · │ │ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `D` does not implement interface `Core.As(i32)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ AsType(d, i32); + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: unable to monomorphize specific `AsType(D, i32)` + // CHECK:STDERR: · ┃ [ResolvingSpecificHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: AsType(d, i32); } diff --git a/toolchain/check/testdata/generic/template/member_access.carbon b/toolchain/check/testdata/generic/template/member_access.carbon index f96697d6d0f5..b8f61789a148 100644 --- a/toolchain/check/testdata/generic/template/member_access.carbon +++ b/toolchain/check/testdata/generic/template/member_access.carbon @@ -47,8 +47,16 @@ class D { } fn Test(d: D) { - // CHECK:STDERR: fail_no_such_member.carbon:[[@LINE+3]]:3: error: unable to monomorphize specific `F(D)` [ResolvingSpecificHere] - // CHECK:STDERR: fail_no_such_member.carbon:[[@LINE-10]]:16-18: note: member name `n` not found in `D` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╭─┤ fail_no_such_member.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ let n: i32 = x.n; + // CHECK:STDERR: · ─┬─ + // CHECK:STDERR: · ╰──┤ member name `n` not found in `D` + // CHECK:STDERR: · │ [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(d); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: unable to monomorphize specific `F(D)` [ResolvingSpecificHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(d); } @@ -68,9 +76,19 @@ class E { } fn Test(e: E) { - // CHECK:STDERR: fail_member_wrong_type.carbon:[[@LINE+4]]:3: error: unable to monomorphize specific `F(E)` [ResolvingSpecificHere] - // CHECK:STDERR: fail_member_wrong_type.carbon:[[@LINE-11]]:16-18: note: cannot implicitly convert expression of type `F` to `i32` [ConversionFailure] - // CHECK:STDERR: fail_member_wrong_type.carbon:[[@LINE-12]]:16-18: note: type `F` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_member_wrong_type.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: │ let n: i32 = x.n; + // CHECK:STDERR: · ┬── + // CHECK:STDERR: · ╰──┤ cannot implicitly convert expression of type `F` to `i32` + // CHECK:STDERR: · │ │ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `F` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(i32)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(e); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: unable to monomorphize specific `F(E)` [ResolvingSpecificHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(e); } diff --git a/toolchain/check/testdata/generic/template/member_out_of_line.carbon b/toolchain/check/testdata/generic/template/member_out_of_line.carbon index 4c3fba3abcff..f0d3d6cf987c 100644 --- a/toolchain/check/testdata/generic/template/member_out_of_line.carbon +++ b/toolchain/check/testdata/generic/template/member_out_of_line.carbon @@ -21,15 +21,39 @@ class Class(template T: type) { var n: T; } -// CHECK:STDERR: fail_todo_basic.carbon:[[@LINE+3]]:30-35: error: type `>>` of parameter 1 in redeclaration differs from previous parameter type `` [RedeclParamDiffersType] -// CHECK:STDERR: fail_todo_basic.carbon:[[@LINE-6]]:8-11: note: previous declaration's corresponding parameter here [RedeclParamPrevious] +// CHECK:STDERR: ╭─┤ fail_todo_basic.carbon:[[@LINE+16]]:30 +// CHECK:STDERR: │ fn F(n: T) -> T; +// CHECK:STDERR: · ──┬─ +// CHECK:STDERR: · ╰──┤ previous declaration's corresponding parameter here +// CHECK:STDERR: · │ [RedeclParamPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn Class(template T: type).F(n: T.U) -> T.U { +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: type +// CHECK:STDERR: · ┃ `>>` +// CHECK:STDERR: · ┃ of parameter 1 in redeclaration differs from previous parameter type +// CHECK:STDERR: · ┃ `` +// CHECK:STDERR: · ┃ [RedeclParamDiffersType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Class(template T: type).F(n: T.U) -> T.U { return n; } -// CHECK:STDERR: fail_todo_basic.carbon:[[@LINE+3]]:1-43: error: function redeclaration differs because return type is `>` [FunctionRedeclReturnTypeDiffers] -// CHECK:STDERR: fail_todo_basic.carbon:[[@LINE-12]]:3-18: note: previously declared with return type `T` [FunctionRedeclReturnTypePrevious] +// CHECK:STDERR: ╭─┤ fail_todo_basic.carbon:[[@LINE+14]]:1 +// CHECK:STDERR: │ fn G(self) -> T; +// CHECK:STDERR: · ────────┬─────── +// CHECK:STDERR: · ╰──┤ previously declared with return type `T` +// CHECK:STDERR: · │ [FunctionRedeclReturnTypePrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn Class(template T: type).G(self) -> T.U { +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: function redeclaration differs because return type is +// CHECK:STDERR: · ┃ `>` +// CHECK:STDERR: · ┃ [FunctionRedeclReturnTypeDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Class(template T: type).G(self) -> T.U { return self.n; @@ -64,15 +88,15 @@ fn Class(template T: type).G(self) -> T.U { // CHECK:STDOUT: %Class.elem: type = unbound_element_type %Class, %T [template] // CHECK:STDOUT: %struct_type.n: type = struct_type {.n: %T} [template] // CHECK:STDOUT: %complete_type: = complete_type_witness %struct_type.n [template] -// CHECK:STDOUT: %.eff391.1: type = type_of_inst @Class.F.loc14.%.loc14_34.1 [template] -// CHECK:STDOUT: %.b66113.1: %.eff391.1 = splice_inst @Class.F.loc14.%.loc14_34.1 [template] -// CHECK:STDOUT: %.5372ba.1: type = splice_inst @Class.F.loc14.%.loc14_34.4 [template] +// CHECK:STDOUT: %.eff391.1: type = type_of_inst @Class.F.loc27.%.loc27_34.1 [template] +// CHECK:STDOUT: %.b66113.1: %.eff391.1 = splice_inst @Class.F.loc27.%.loc27_34.1 [template] +// CHECK:STDOUT: %.5372ba.1: type = splice_inst @Class.F.loc27.%.loc27_34.4 [template] // CHECK:STDOUT: %pattern_type.fcb8f3.1: type = pattern_type %.5372ba.1 [template] // CHECK:STDOUT: %n.param_patt.110b44.1: %pattern_type.fcb8f3.1 = value_param_pattern [template] // CHECK:STDOUT: %n.patt.9e3e22.1: %pattern_type.fcb8f3.1 = wrapper_binding_pattern n, %n.param_patt.110b44.1 [template] -// CHECK:STDOUT: %.eff391.2: type = type_of_inst @Class.F.loc14.%.loc14_42.1 [template] -// CHECK:STDOUT: %.b66113.2: %.eff391.2 = splice_inst @Class.F.loc14.%.loc14_42.1 [template] -// CHECK:STDOUT: %.5372ba.2: type = splice_inst @Class.F.loc14.%.loc14_42.4 [template] +// CHECK:STDOUT: %.eff391.2: type = type_of_inst @Class.F.loc27.%.loc27_42.1 [template] +// CHECK:STDOUT: %.b66113.2: %.eff391.2 = splice_inst @Class.F.loc27.%.loc27_42.1 [template] +// CHECK:STDOUT: %.5372ba.2: type = splice_inst @Class.F.loc27.%.loc27_42.4 [template] // CHECK:STDOUT: %.cd79f1.1: Core.Form = init_form %.5372ba.2 [template] // CHECK:STDOUT: %pattern_type.fcb8f3.2: type = pattern_type %.5372ba.2 [template] // CHECK:STDOUT: %return.param_patt.2e9ac5.1: %pattern_type.fcb8f3.2 = out_param_pattern [template] @@ -88,26 +112,26 @@ fn Class(template T: type).G(self) -> T.U { // CHECK:STDOUT: %.cd79f1.2: Core.Form = init_form %.5372ba.3 [template] // CHECK:STDOUT: %return.param_patt.2e9ac5.2: %pattern_type.fcb8f3.3 = out_param_pattern [template] // CHECK:STDOUT: %return.patt.7fc6a1.2: %pattern_type.fcb8f3.3 = return_slot_pattern %return.param_patt.2e9ac5.2, %.5372ba.3 [template] -// CHECK:STDOUT: %Class.F.type.30a249.2: type = fn_type @Class.F.loc14, @Class(%T) [template] +// CHECK:STDOUT: %Class.F.type.30a249.2: type = fn_type @Class.F.loc27, @Class(%T) [template] // CHECK:STDOUT: %Class.F.4883b3.2: %Class.F.type.30a249.2 = struct_value () [template] // CHECK:STDOUT: %require_complete.cb0614.1: = require_complete_type %.5372ba.1 [template] // CHECK:STDOUT: %require_complete.cb0614.2: = require_complete_type %.5372ba.2 [template] // CHECK:STDOUT: %tuple.type: type = tuple_type () [concrete] -// CHECK:STDOUT: %.5d6323.1: %.5372ba.2 = splice_inst @Class.F.loc14.%tuple.elem0 [template] -// CHECK:STDOUT: %.eff391.4: type = type_of_inst @Class.G.loc21.%.loc21_40.1 [template] -// CHECK:STDOUT: %.b66113.4: %.eff391.4 = splice_inst @Class.G.loc21.%.loc21_40.1 [template] -// CHECK:STDOUT: %.5372ba.4: type = splice_inst @Class.G.loc21.%.loc21_40.4 [template] +// CHECK:STDOUT: %.5d6323.1: %.5372ba.2 = splice_inst @Class.F.loc27.%tuple.elem0 [template] +// CHECK:STDOUT: %.eff391.4: type = type_of_inst @Class.G.loc45.%.loc45_40.1 [template] +// CHECK:STDOUT: %.b66113.4: %.eff391.4 = splice_inst @Class.G.loc45.%.loc45_40.1 [template] +// CHECK:STDOUT: %.5372ba.4: type = splice_inst @Class.G.loc45.%.loc45_40.4 [template] // CHECK:STDOUT: %.cd79f1.3: Core.Form = init_form %.5372ba.4 [template] // CHECK:STDOUT: %pattern_type.fcb8f3.4: type = pattern_type %.5372ba.4 [template] // CHECK:STDOUT: %return.param_patt.2e9ac5.3: %pattern_type.fcb8f3.4 = out_param_pattern [template] // CHECK:STDOUT: %return.patt.7fc6a1.3: %pattern_type.fcb8f3.4 = return_slot_pattern %return.param_patt.2e9ac5.3, %.5372ba.4 [template] -// CHECK:STDOUT: %Class.G.type.f7c942.2: type = fn_type @Class.G.loc21, @Class(%T) [template] +// CHECK:STDOUT: %Class.G.type.f7c942.2: type = fn_type @Class.G.loc45, @Class(%T) [template] // CHECK:STDOUT: %Class.G.05f5b3.2: %Class.G.type.f7c942.2 = struct_value () [template] // CHECK:STDOUT: %require_complete.ac0: = require_complete_type %Class [template] // CHECK:STDOUT: %require_complete.cb0614.3: = require_complete_type %.5372ba.4 [template] -// CHECK:STDOUT: %.237: type = type_of_inst @Class.G.loc21.%.loc22_14.3 [template] -// CHECK:STDOUT: %.f96: %.237 = splice_inst @Class.G.loc21.%.loc22_14.3 [template] -// CHECK:STDOUT: %.5d6323.2: %.5372ba.4 = splice_inst @Class.G.loc21.%tuple.elem0 [template] +// CHECK:STDOUT: %.237: type = type_of_inst @Class.G.loc45.%.loc46_14.3 [template] +// CHECK:STDOUT: %.f96: %.237 = splice_inst @Class.G.loc45.%.loc46_14.3 [template] +// CHECK:STDOUT: %.5d6323.2: %.5372ba.4 = splice_inst @Class.G.loc45.%tuple.elem0 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -120,60 +144,60 @@ fn Class(template T: type).G(self) -> T.U { // CHECK:STDOUT: } // CHECK:STDOUT: %T.loc5_23.2: type = symbolic_binding T, 0, template [template = %T.loc5_23.1 (constants.%T)] // CHECK:STDOUT: } -// CHECK:STDOUT: %Class.F.decl: %Class.F.type.30a249.2 = fn_decl @Class.F.loc14 [template = constants.%Class.F.4883b3.2] { -// CHECK:STDOUT: %n.param_patt.loc14_31.1: @Class.F.loc14.%pattern_type.loc14_31 (%pattern_type.fcb8f3.1) = value_param_pattern [template = %n.param_patt.loc14_31.2 (constants.%n.param_patt.110b44.1)] -// CHECK:STDOUT: %n.patt.loc14_31.1: @Class.F.loc14.%pattern_type.loc14_31 (%pattern_type.fcb8f3.1) = wrapper_binding_pattern n, %n.param_patt.loc14_31.1 [template = %n.patt.loc14_31.2 (constants.%n.patt.9e3e22.1)] -// CHECK:STDOUT: %return.param_patt.loc14_42.1: @Class.F.loc14.%pattern_type.loc14_42 (%pattern_type.fcb8f3.2) = out_param_pattern [template = %return.param_patt.loc14_42.2 (constants.%return.param_patt.2e9ac5.1)] -// CHECK:STDOUT: %return.patt.loc14_38.1: @Class.F.loc14.%pattern_type.loc14_42 (%pattern_type.fcb8f3.2) = return_slot_pattern %return.param_patt.loc14_42.1, %.loc14_42.9 [template = %return.patt.loc14_38.2 (constants.%return.patt.7fc6a1.1)] +// CHECK:STDOUT: %Class.F.decl: %Class.F.type.30a249.2 = fn_decl @Class.F.loc27 [template = constants.%Class.F.4883b3.2] { +// CHECK:STDOUT: %n.param_patt.loc27_31.1: @Class.F.loc27.%pattern_type.loc27_31 (%pattern_type.fcb8f3.1) = value_param_pattern [template = %n.param_patt.loc27_31.2 (constants.%n.param_patt.110b44.1)] +// CHECK:STDOUT: %n.patt.loc27_31.1: @Class.F.loc27.%pattern_type.loc27_31 (%pattern_type.fcb8f3.1) = wrapper_binding_pattern n, %n.param_patt.loc27_31.1 [template = %n.patt.loc27_31.2 (constants.%n.patt.9e3e22.1)] +// CHECK:STDOUT: %return.param_patt.loc27_42.1: @Class.F.loc27.%pattern_type.loc27_42 (%pattern_type.fcb8f3.2) = out_param_pattern [template = %return.param_patt.loc27_42.2 (constants.%return.param_patt.2e9ac5.1)] +// CHECK:STDOUT: %return.patt.loc27_38.1: @Class.F.loc27.%pattern_type.loc27_42 (%pattern_type.fcb8f3.2) = return_slot_pattern %return.param_patt.loc27_42.1, %.loc27_42.9 [template = %return.patt.loc27_38.2 (constants.%return.patt.7fc6a1.1)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc14_22.1: type = splice_block %.loc14_22.2 [concrete = type] { +// CHECK:STDOUT: %.loc27_22.1: type = splice_block %.loc27_22.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc14_22.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc27_22.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc14_20: type = symbolic_binding T, 0, template [template = @Class.%T.loc5_23.1 (constants.%T)] -// CHECK:STDOUT: %.loc14_41: type = specific_constant %T.loc14_20, @Class(constants.%T) [template = %T.loc14_33 (constants.%T)] -// CHECK:STDOUT: %T.ref.loc14_41: type = name_ref T, %.loc14_41 [template = %T.loc14_33 (constants.%T)] -// CHECK:STDOUT: %.loc14_42.7: type = type_of_inst %.loc14_42.1 [template = %.loc14_42.2 (constants.%.eff391.2)] -// CHECK:STDOUT: %.loc14_42.8: @Class.F.loc14.%.loc14_42.2 (%.eff391.2) = splice_inst %.loc14_42.1 [template = %.loc14_42.3 (constants.%.b66113.2)] -// CHECK:STDOUT: %.loc14_42.9: type = splice_inst %.loc14_42.4 [template = %.loc14_42.5 (constants.%.5372ba.2)] -// CHECK:STDOUT: %.loc14_42.10: Core.Form = init_form %.loc14_42.9 [template = %.loc14_42.6 (constants.%.cd79f1.1)] -// CHECK:STDOUT: %n.param: @Class.F.loc14.%.loc14_34.5 (%.5372ba.1) = value_param call_param0 -// CHECK:STDOUT: %.loc14_34.6: type = splice_block %.loc14_34.9 [template = %.loc14_34.5 (constants.%.5372ba.1)] { -// CHECK:STDOUT: %.loc14_33: type = specific_constant %T.loc14_20, @Class(constants.%T) [template = %T.loc14_33 (constants.%T)] -// CHECK:STDOUT: %T.ref.loc14_33: type = name_ref T, %.loc14_33 [template = %T.loc14_33 (constants.%T)] -// CHECK:STDOUT: %.loc14_34.7: type = type_of_inst %.loc14_34.1 [template = %.loc14_34.2 (constants.%.eff391.1)] -// CHECK:STDOUT: %.loc14_34.8: @Class.F.loc14.%.loc14_34.2 (%.eff391.1) = splice_inst %.loc14_34.1 [template = %.loc14_34.3 (constants.%.b66113.1)] -// CHECK:STDOUT: %.loc14_34.9: type = splice_inst %.loc14_34.4 [template = %.loc14_34.5 (constants.%.5372ba.1)] +// CHECK:STDOUT: %T.loc27_20: type = symbolic_binding T, 0, template [template = @Class.%T.loc5_23.1 (constants.%T)] +// CHECK:STDOUT: %.loc27_41: type = specific_constant %T.loc27_20, @Class(constants.%T) [template = %T.loc27_33 (constants.%T)] +// CHECK:STDOUT: %T.ref.loc27_41: type = name_ref T, %.loc27_41 [template = %T.loc27_33 (constants.%T)] +// CHECK:STDOUT: %.loc27_42.7: type = type_of_inst %.loc27_42.1 [template = %.loc27_42.2 (constants.%.eff391.2)] +// CHECK:STDOUT: %.loc27_42.8: @Class.F.loc27.%.loc27_42.2 (%.eff391.2) = splice_inst %.loc27_42.1 [template = %.loc27_42.3 (constants.%.b66113.2)] +// CHECK:STDOUT: %.loc27_42.9: type = splice_inst %.loc27_42.4 [template = %.loc27_42.5 (constants.%.5372ba.2)] +// CHECK:STDOUT: %.loc27_42.10: Core.Form = init_form %.loc27_42.9 [template = %.loc27_42.6 (constants.%.cd79f1.1)] +// CHECK:STDOUT: %n.param: @Class.F.loc27.%.loc27_34.5 (%.5372ba.1) = value_param call_param0 +// CHECK:STDOUT: %.loc27_34.6: type = splice_block %.loc27_34.9 [template = %.loc27_34.5 (constants.%.5372ba.1)] { +// CHECK:STDOUT: %.loc27_33: type = specific_constant %T.loc27_20, @Class(constants.%T) [template = %T.loc27_33 (constants.%T)] +// CHECK:STDOUT: %T.ref.loc27_33: type = name_ref T, %.loc27_33 [template = %T.loc27_33 (constants.%T)] +// CHECK:STDOUT: %.loc27_34.7: type = type_of_inst %.loc27_34.1 [template = %.loc27_34.2 (constants.%.eff391.1)] +// CHECK:STDOUT: %.loc27_34.8: @Class.F.loc27.%.loc27_34.2 (%.eff391.1) = splice_inst %.loc27_34.1 [template = %.loc27_34.3 (constants.%.b66113.1)] +// CHECK:STDOUT: %.loc27_34.9: type = splice_inst %.loc27_34.4 [template = %.loc27_34.5 (constants.%.5372ba.1)] // CHECK:STDOUT: } -// CHECK:STDOUT: %n: @Class.F.loc14.%.loc14_34.5 (%.5372ba.1) = wrapper_binding n, %n.param -// CHECK:STDOUT: %return.param: ref @Class.F.loc14.%.loc14_42.5 (%.5372ba.2) = out_param call_param1 -// CHECK:STDOUT: %return: ref @Class.F.loc14.%.loc14_42.5 (%.5372ba.2) = return_slot %return.param +// CHECK:STDOUT: %n: @Class.F.loc27.%.loc27_34.5 (%.5372ba.1) = wrapper_binding n, %n.param +// CHECK:STDOUT: %return.param: ref @Class.F.loc27.%.loc27_42.5 (%.5372ba.2) = out_param call_param1 +// CHECK:STDOUT: %return: ref @Class.F.loc27.%.loc27_42.5 (%.5372ba.2) = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Class.G.decl: %Class.G.type.f7c942.2 = fn_decl @Class.G.loc21 [template = constants.%Class.G.05f5b3.2] { -// CHECK:STDOUT: %self.param_patt.loc21_30.1: @Class.G.loc21.%pattern_type.loc21_30 (%pattern_type.28f) = value_param_pattern [template = %self.param_patt.loc21_30.2 (constants.%self.param_patt)] -// CHECK:STDOUT: %self.patt.loc21_30.1: @Class.G.loc21.%pattern_type.loc21_30 (%pattern_type.28f) = wrapper_binding_pattern self, %self.param_patt.loc21_30.1 [template = %self.patt.loc21_30.2 (constants.%self.patt)] -// CHECK:STDOUT: %return.param_patt.loc21_40.1: @Class.G.loc21.%pattern_type.loc21_40 (%pattern_type.fcb8f3.4) = out_param_pattern [template = %return.param_patt.loc21_40.2 (constants.%return.param_patt.2e9ac5.3)] -// CHECK:STDOUT: %return.patt.loc21_36.1: @Class.G.loc21.%pattern_type.loc21_40 (%pattern_type.fcb8f3.4) = return_slot_pattern %return.param_patt.loc21_40.1, %.loc21_40.9 [template = %return.patt.loc21_36.2 (constants.%return.patt.7fc6a1.3)] +// CHECK:STDOUT: %Class.G.decl: %Class.G.type.f7c942.2 = fn_decl @Class.G.loc45 [template = constants.%Class.G.05f5b3.2] { +// CHECK:STDOUT: %self.param_patt.loc45_30.1: @Class.G.loc45.%pattern_type.loc45_30 (%pattern_type.28f) = value_param_pattern [template = %self.param_patt.loc45_30.2 (constants.%self.param_patt)] +// CHECK:STDOUT: %self.patt.loc45_30.1: @Class.G.loc45.%pattern_type.loc45_30 (%pattern_type.28f) = wrapper_binding_pattern self, %self.param_patt.loc45_30.1 [template = %self.patt.loc45_30.2 (constants.%self.patt)] +// CHECK:STDOUT: %return.param_patt.loc45_40.1: @Class.G.loc45.%pattern_type.loc45_40 (%pattern_type.fcb8f3.4) = out_param_pattern [template = %return.param_patt.loc45_40.2 (constants.%return.param_patt.2e9ac5.3)] +// CHECK:STDOUT: %return.patt.loc45_36.1: @Class.G.loc45.%pattern_type.loc45_40 (%pattern_type.fcb8f3.4) = return_slot_pattern %return.param_patt.loc45_40.1, %.loc45_40.9 [template = %return.patt.loc45_36.2 (constants.%return.patt.7fc6a1.3)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc21_22.1: type = splice_block %.loc21_22.2 [concrete = type] { +// CHECK:STDOUT: %.loc45_22.1: type = splice_block %.loc45_22.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc21_22.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc45_22.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc21_20: type = symbolic_binding T, 0, template [template = @Class.%T.loc5_23.1 (constants.%T)] -// CHECK:STDOUT: %.loc21_39: type = specific_constant %T.loc21_20, @Class(constants.%T) [template = %T.loc21_30 (constants.%T)] -// CHECK:STDOUT: %T.ref: type = name_ref T, %.loc21_39 [template = %T.loc21_30 (constants.%T)] -// CHECK:STDOUT: %.loc21_40.7: type = type_of_inst %.loc21_40.1 [template = %.loc21_40.2 (constants.%.eff391.4)] -// CHECK:STDOUT: %.loc21_40.8: @Class.G.loc21.%.loc21_40.2 (%.eff391.4) = splice_inst %.loc21_40.1 [template = %.loc21_40.3 (constants.%.b66113.4)] -// CHECK:STDOUT: %.loc21_40.9: type = splice_inst %.loc21_40.4 [template = %.loc21_40.5 (constants.%.5372ba.4)] -// CHECK:STDOUT: %.loc21_40.10: Core.Form = init_form %.loc21_40.9 [template = %.loc21_40.6 (constants.%.cd79f1.3)] -// CHECK:STDOUT: %self.param: @Class.G.loc21.%Class (%Class) = value_param call_param0 -// CHECK:STDOUT: %.loc21_30.1: type = splice_block %Self.ref [template = %Class (constants.%Class)] { -// CHECK:STDOUT: %.loc21_30.2: type = specific_constant constants.%Class, @Class(constants.%T) [template = %Class (constants.%Class)] -// CHECK:STDOUT: %Self.ref: type = name_ref Self, %.loc21_30.2 [template = %Class (constants.%Class)] +// CHECK:STDOUT: %T.loc45_20: type = symbolic_binding T, 0, template [template = @Class.%T.loc5_23.1 (constants.%T)] +// CHECK:STDOUT: %.loc45_39: type = specific_constant %T.loc45_20, @Class(constants.%T) [template = %T.loc45_30 (constants.%T)] +// CHECK:STDOUT: %T.ref: type = name_ref T, %.loc45_39 [template = %T.loc45_30 (constants.%T)] +// CHECK:STDOUT: %.loc45_40.7: type = type_of_inst %.loc45_40.1 [template = %.loc45_40.2 (constants.%.eff391.4)] +// CHECK:STDOUT: %.loc45_40.8: @Class.G.loc45.%.loc45_40.2 (%.eff391.4) = splice_inst %.loc45_40.1 [template = %.loc45_40.3 (constants.%.b66113.4)] +// CHECK:STDOUT: %.loc45_40.9: type = splice_inst %.loc45_40.4 [template = %.loc45_40.5 (constants.%.5372ba.4)] +// CHECK:STDOUT: %.loc45_40.10: Core.Form = init_form %.loc45_40.9 [template = %.loc45_40.6 (constants.%.cd79f1.3)] +// CHECK:STDOUT: %self.param: @Class.G.loc45.%Class (%Class) = value_param call_param0 +// CHECK:STDOUT: %.loc45_30.1: type = splice_block %Self.ref [template = %Class (constants.%Class)] { +// CHECK:STDOUT: %.loc45_30.2: type = specific_constant constants.%Class, @Class(constants.%T) [template = %Class (constants.%Class)] +// CHECK:STDOUT: %Self.ref: type = name_ref Self, %.loc45_30.2 [template = %Class (constants.%Class)] // CHECK:STDOUT: } -// CHECK:STDOUT: %self: @Class.G.loc21.%Class (%Class) = wrapper_binding self, %self.param -// CHECK:STDOUT: %return.param: ref @Class.G.loc21.%.loc21_40.5 (%.5372ba.4) = out_param call_param1 -// CHECK:STDOUT: %return: ref @Class.G.loc21.%.loc21_40.5 (%.5372ba.4) = return_slot %return.param +// CHECK:STDOUT: %self: @Class.G.loc45.%Class (%Class) = wrapper_binding self, %self.param +// CHECK:STDOUT: %return.param: ref @Class.G.loc45.%.loc45_40.5 (%.5372ba.4) = out_param call_param1 +// CHECK:STDOUT: %return: ref @Class.G.loc45.%.loc45_40.5 (%.5372ba.4) = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -270,74 +294,74 @@ fn Class(template T: type).G(self) -> T.U { // CHECK:STDOUT: fn(%self.param: @Class.G.loc7.%Class (%Class)) -> out %return.param: @Class.G.loc7.%T (%T); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Class.F.loc14(%T.loc14_20: type) { -// CHECK:STDOUT: %T.loc14_33: type = symbolic_binding T, 0, template [template = %T.loc14_33 (constants.%T)] -// CHECK:STDOUT: %.loc14_34.1: = access_member_action %T.ref.loc14_33, U [template] -// CHECK:STDOUT: %.loc14_34.2: type = type_of_inst %.loc14_34.1 [template = %.loc14_34.2 (constants.%.eff391.1)] -// CHECK:STDOUT: %.loc14_34.3: @Class.F.loc14.%.loc14_34.2 (%.eff391.1) = splice_inst %.loc14_34.1 [template = %.loc14_34.3 (constants.%.b66113.1)] -// CHECK:STDOUT: %.loc14_34.4: = convert_to_value_action %.loc14_34.8, type [template] -// CHECK:STDOUT: %.loc14_34.5: type = splice_inst %.loc14_34.4 [template = %.loc14_34.5 (constants.%.5372ba.1)] -// CHECK:STDOUT: %pattern_type.loc14_31: type = pattern_type %.loc14_34.5 [template = %pattern_type.loc14_31 (constants.%pattern_type.fcb8f3.1)] -// CHECK:STDOUT: %n.param_patt.loc14_31.2: @Class.F.loc14.%pattern_type.loc14_31 (%pattern_type.fcb8f3.1) = value_param_pattern [template = %n.param_patt.loc14_31.2 (constants.%n.param_patt.110b44.1)] -// CHECK:STDOUT: %n.patt.loc14_31.2: @Class.F.loc14.%pattern_type.loc14_31 (%pattern_type.fcb8f3.1) = wrapper_binding_pattern n, %n.param_patt.loc14_31.2 [template = %n.patt.loc14_31.2 (constants.%n.patt.9e3e22.1)] -// CHECK:STDOUT: %.loc14_42.1: = access_member_action %T.ref.loc14_41, U [template] -// CHECK:STDOUT: %.loc14_42.2: type = type_of_inst %.loc14_42.1 [template = %.loc14_42.2 (constants.%.eff391.2)] -// CHECK:STDOUT: %.loc14_42.3: @Class.F.loc14.%.loc14_42.2 (%.eff391.2) = splice_inst %.loc14_42.1 [template = %.loc14_42.3 (constants.%.b66113.2)] -// CHECK:STDOUT: %.loc14_42.4: = convert_to_value_action %.loc14_42.8, type [template] -// CHECK:STDOUT: %.loc14_42.5: type = splice_inst %.loc14_42.4 [template = %.loc14_42.5 (constants.%.5372ba.2)] -// CHECK:STDOUT: %.loc14_42.6: Core.Form = init_form %.loc14_42.5 [template = %.loc14_42.6 (constants.%.cd79f1.1)] -// CHECK:STDOUT: %pattern_type.loc14_42: type = pattern_type %.loc14_42.5 [template = %pattern_type.loc14_42 (constants.%pattern_type.fcb8f3.2)] -// CHECK:STDOUT: %return.param_patt.loc14_42.2: @Class.F.loc14.%pattern_type.loc14_42 (%pattern_type.fcb8f3.2) = out_param_pattern [template = %return.param_patt.loc14_42.2 (constants.%return.param_patt.2e9ac5.1)] -// CHECK:STDOUT: %return.patt.loc14_38.2: @Class.F.loc14.%pattern_type.loc14_42 (%pattern_type.fcb8f3.2) = return_slot_pattern %return.param_patt.loc14_42.2, %.loc14_42.5 [template = %return.patt.loc14_38.2 (constants.%return.patt.7fc6a1.1)] +// CHECK:STDOUT: generic fn @Class.F.loc27(%T.loc27_20: type) { +// CHECK:STDOUT: %T.loc27_33: type = symbolic_binding T, 0, template [template = %T.loc27_33 (constants.%T)] +// CHECK:STDOUT: %.loc27_34.1: = access_member_action %T.ref.loc27_33, U [template] +// CHECK:STDOUT: %.loc27_34.2: type = type_of_inst %.loc27_34.1 [template = %.loc27_34.2 (constants.%.eff391.1)] +// CHECK:STDOUT: %.loc27_34.3: @Class.F.loc27.%.loc27_34.2 (%.eff391.1) = splice_inst %.loc27_34.1 [template = %.loc27_34.3 (constants.%.b66113.1)] +// CHECK:STDOUT: %.loc27_34.4: = convert_to_value_action %.loc27_34.8, type [template] +// CHECK:STDOUT: %.loc27_34.5: type = splice_inst %.loc27_34.4 [template = %.loc27_34.5 (constants.%.5372ba.1)] +// CHECK:STDOUT: %pattern_type.loc27_31: type = pattern_type %.loc27_34.5 [template = %pattern_type.loc27_31 (constants.%pattern_type.fcb8f3.1)] +// CHECK:STDOUT: %n.param_patt.loc27_31.2: @Class.F.loc27.%pattern_type.loc27_31 (%pattern_type.fcb8f3.1) = value_param_pattern [template = %n.param_patt.loc27_31.2 (constants.%n.param_patt.110b44.1)] +// CHECK:STDOUT: %n.patt.loc27_31.2: @Class.F.loc27.%pattern_type.loc27_31 (%pattern_type.fcb8f3.1) = wrapper_binding_pattern n, %n.param_patt.loc27_31.2 [template = %n.patt.loc27_31.2 (constants.%n.patt.9e3e22.1)] +// CHECK:STDOUT: %.loc27_42.1: = access_member_action %T.ref.loc27_41, U [template] +// CHECK:STDOUT: %.loc27_42.2: type = type_of_inst %.loc27_42.1 [template = %.loc27_42.2 (constants.%.eff391.2)] +// CHECK:STDOUT: %.loc27_42.3: @Class.F.loc27.%.loc27_42.2 (%.eff391.2) = splice_inst %.loc27_42.1 [template = %.loc27_42.3 (constants.%.b66113.2)] +// CHECK:STDOUT: %.loc27_42.4: = convert_to_value_action %.loc27_42.8, type [template] +// CHECK:STDOUT: %.loc27_42.5: type = splice_inst %.loc27_42.4 [template = %.loc27_42.5 (constants.%.5372ba.2)] +// CHECK:STDOUT: %.loc27_42.6: Core.Form = init_form %.loc27_42.5 [template = %.loc27_42.6 (constants.%.cd79f1.1)] +// CHECK:STDOUT: %pattern_type.loc27_42: type = pattern_type %.loc27_42.5 [template = %pattern_type.loc27_42 (constants.%pattern_type.fcb8f3.2)] +// CHECK:STDOUT: %return.param_patt.loc27_42.2: @Class.F.loc27.%pattern_type.loc27_42 (%pattern_type.fcb8f3.2) = out_param_pattern [template = %return.param_patt.loc27_42.2 (constants.%return.param_patt.2e9ac5.1)] +// CHECK:STDOUT: %return.patt.loc27_38.2: @Class.F.loc27.%pattern_type.loc27_42 (%pattern_type.fcb8f3.2) = return_slot_pattern %return.param_patt.loc27_42.2, %.loc27_42.5 [template = %return.patt.loc27_38.2 (constants.%return.patt.7fc6a1.1)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete.loc14_31: = require_complete_type %.loc14_34.5 [template = %require_complete.loc14_31 (constants.%require_complete.cb0614.1)] -// CHECK:STDOUT: %require_complete.loc14_38: = require_complete_type %.loc14_42.5 [template = %require_complete.loc14_38 (constants.%require_complete.cb0614.2)] -// CHECK:STDOUT: %.loc15_11.2: %tuple.type = initialize_action %n.ref, %.loc14_42.5, %return.param, none, false [template] -// CHECK:STDOUT: %tuple.elem0: = tuple_access %.loc15_11.2, element0 [template] -// CHECK:STDOUT: %.loc15_11.3: @Class.F.loc14.%.loc14_42.5 (%.5372ba.2) = splice_inst %tuple.elem0 [template = %.loc15_11.3 (constants.%.5d6323.1)] +// CHECK:STDOUT: %require_complete.loc27_31: = require_complete_type %.loc27_34.5 [template = %require_complete.loc27_31 (constants.%require_complete.cb0614.1)] +// CHECK:STDOUT: %require_complete.loc27_38: = require_complete_type %.loc27_42.5 [template = %require_complete.loc27_38 (constants.%require_complete.cb0614.2)] +// CHECK:STDOUT: %.loc28_11.2: %tuple.type = initialize_action %n.ref, %.loc27_42.5, %return.param, none, false [template] +// CHECK:STDOUT: %tuple.elem0: = tuple_access %.loc28_11.2, element0 [template] +// CHECK:STDOUT: %.loc28_11.3: @Class.F.loc27.%.loc27_42.5 (%.5372ba.2) = splice_inst %tuple.elem0 [template = %.loc28_11.3 (constants.%.5d6323.1)] // CHECK:STDOUT: -// CHECK:STDOUT: fn(%n.param: @Class.F.loc14.%.loc14_34.5 (%.5372ba.1)) -> out %return.param: @Class.F.loc14.%.loc14_42.5 (%.5372ba.2) { +// CHECK:STDOUT: fn(%n.param: @Class.F.loc27.%.loc27_34.5 (%.5372ba.1)) -> out %return.param: @Class.F.loc27.%.loc27_42.5 (%.5372ba.2) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %n.ref: @Class.F.loc14.%.loc14_34.5 (%.5372ba.1) = name_ref n, %n -// CHECK:STDOUT: %.loc15_11.1: @Class.F.loc14.%.loc14_42.5 (%.5372ba.2) = splice_inst %tuple.elem0 [template = %.loc15_11.3 (constants.%.5d6323.1)] -// CHECK:STDOUT: return %.loc15_11.1 to %return.param +// CHECK:STDOUT: %n.ref: @Class.F.loc27.%.loc27_34.5 (%.5372ba.1) = name_ref n, %n +// CHECK:STDOUT: %.loc28_11.1: @Class.F.loc27.%.loc27_42.5 (%.5372ba.2) = splice_inst %tuple.elem0 [template = %.loc28_11.3 (constants.%.5d6323.1)] +// CHECK:STDOUT: return %.loc28_11.1 to %return.param // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Class.G.loc21(%T.loc21_20: type) { -// CHECK:STDOUT: %T.loc21_30: type = symbolic_binding T, 0, template [template = %T.loc21_30 (constants.%T)] -// CHECK:STDOUT: %Class: type = class_type @Class, @Class(%T.loc21_30) [template = %Class (constants.%Class)] -// CHECK:STDOUT: %pattern_type.loc21_30: type = pattern_type %Class [template = %pattern_type.loc21_30 (constants.%pattern_type.28f)] -// CHECK:STDOUT: %self.param_patt.loc21_30.2: @Class.G.loc21.%pattern_type.loc21_30 (%pattern_type.28f) = value_param_pattern [template = %self.param_patt.loc21_30.2 (constants.%self.param_patt)] -// CHECK:STDOUT: %self.patt.loc21_30.2: @Class.G.loc21.%pattern_type.loc21_30 (%pattern_type.28f) = wrapper_binding_pattern self, %self.param_patt.loc21_30.2 [template = %self.patt.loc21_30.2 (constants.%self.patt)] -// CHECK:STDOUT: %.loc21_40.1: = access_member_action %T.ref, U [template] -// CHECK:STDOUT: %.loc21_40.2: type = type_of_inst %.loc21_40.1 [template = %.loc21_40.2 (constants.%.eff391.4)] -// CHECK:STDOUT: %.loc21_40.3: @Class.G.loc21.%.loc21_40.2 (%.eff391.4) = splice_inst %.loc21_40.1 [template = %.loc21_40.3 (constants.%.b66113.4)] -// CHECK:STDOUT: %.loc21_40.4: = convert_to_value_action %.loc21_40.8, type [template] -// CHECK:STDOUT: %.loc21_40.5: type = splice_inst %.loc21_40.4 [template = %.loc21_40.5 (constants.%.5372ba.4)] -// CHECK:STDOUT: %.loc21_40.6: Core.Form = init_form %.loc21_40.5 [template = %.loc21_40.6 (constants.%.cd79f1.3)] -// CHECK:STDOUT: %pattern_type.loc21_40: type = pattern_type %.loc21_40.5 [template = %pattern_type.loc21_40 (constants.%pattern_type.fcb8f3.4)] -// CHECK:STDOUT: %return.param_patt.loc21_40.2: @Class.G.loc21.%pattern_type.loc21_40 (%pattern_type.fcb8f3.4) = out_param_pattern [template = %return.param_patt.loc21_40.2 (constants.%return.param_patt.2e9ac5.3)] -// CHECK:STDOUT: %return.patt.loc21_36.2: @Class.G.loc21.%pattern_type.loc21_40 (%pattern_type.fcb8f3.4) = return_slot_pattern %return.param_patt.loc21_40.2, %.loc21_40.5 [template = %return.patt.loc21_36.2 (constants.%return.patt.7fc6a1.3)] +// CHECK:STDOUT: generic fn @Class.G.loc45(%T.loc45_20: type) { +// CHECK:STDOUT: %T.loc45_30: type = symbolic_binding T, 0, template [template = %T.loc45_30 (constants.%T)] +// CHECK:STDOUT: %Class: type = class_type @Class, @Class(%T.loc45_30) [template = %Class (constants.%Class)] +// CHECK:STDOUT: %pattern_type.loc45_30: type = pattern_type %Class [template = %pattern_type.loc45_30 (constants.%pattern_type.28f)] +// CHECK:STDOUT: %self.param_patt.loc45_30.2: @Class.G.loc45.%pattern_type.loc45_30 (%pattern_type.28f) = value_param_pattern [template = %self.param_patt.loc45_30.2 (constants.%self.param_patt)] +// CHECK:STDOUT: %self.patt.loc45_30.2: @Class.G.loc45.%pattern_type.loc45_30 (%pattern_type.28f) = wrapper_binding_pattern self, %self.param_patt.loc45_30.2 [template = %self.patt.loc45_30.2 (constants.%self.patt)] +// CHECK:STDOUT: %.loc45_40.1: = access_member_action %T.ref, U [template] +// CHECK:STDOUT: %.loc45_40.2: type = type_of_inst %.loc45_40.1 [template = %.loc45_40.2 (constants.%.eff391.4)] +// CHECK:STDOUT: %.loc45_40.3: @Class.G.loc45.%.loc45_40.2 (%.eff391.4) = splice_inst %.loc45_40.1 [template = %.loc45_40.3 (constants.%.b66113.4)] +// CHECK:STDOUT: %.loc45_40.4: = convert_to_value_action %.loc45_40.8, type [template] +// CHECK:STDOUT: %.loc45_40.5: type = splice_inst %.loc45_40.4 [template = %.loc45_40.5 (constants.%.5372ba.4)] +// CHECK:STDOUT: %.loc45_40.6: Core.Form = init_form %.loc45_40.5 [template = %.loc45_40.6 (constants.%.cd79f1.3)] +// CHECK:STDOUT: %pattern_type.loc45_40: type = pattern_type %.loc45_40.5 [template = %pattern_type.loc45_40 (constants.%pattern_type.fcb8f3.4)] +// CHECK:STDOUT: %return.param_patt.loc45_40.2: @Class.G.loc45.%pattern_type.loc45_40 (%pattern_type.fcb8f3.4) = out_param_pattern [template = %return.param_patt.loc45_40.2 (constants.%return.param_patt.2e9ac5.3)] +// CHECK:STDOUT: %return.patt.loc45_36.2: @Class.G.loc45.%pattern_type.loc45_40 (%pattern_type.fcb8f3.4) = return_slot_pattern %return.param_patt.loc45_40.2, %.loc45_40.5 [template = %return.patt.loc45_36.2 (constants.%return.patt.7fc6a1.3)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete.loc21_30: = require_complete_type %Class [template = %require_complete.loc21_30 (constants.%require_complete.ac0)] -// CHECK:STDOUT: %require_complete.loc21_36: = require_complete_type %.loc21_40.5 [template = %require_complete.loc21_36 (constants.%require_complete.cb0614.3)] -// CHECK:STDOUT: %.loc22_14.3: = access_member_action %self.ref, n [template] -// CHECK:STDOUT: %.loc22_14.4: type = type_of_inst %.loc22_14.3 [template = %.loc22_14.4 (constants.%.237)] -// CHECK:STDOUT: %.loc22_14.5: @Class.G.loc21.%.loc22_14.4 (%.237) = splice_inst %.loc22_14.3 [template = %.loc22_14.5 (constants.%.f96)] -// CHECK:STDOUT: %.loc22_16.2: %tuple.type = initialize_action %.loc22_14.2, %.loc21_40.5, %return.param, none, false [template] -// CHECK:STDOUT: %tuple.elem0: = tuple_access %.loc22_16.2, element0 [template] -// CHECK:STDOUT: %.loc22_16.3: @Class.G.loc21.%.loc21_40.5 (%.5372ba.4) = splice_inst %tuple.elem0 [template = %.loc22_16.3 (constants.%.5d6323.2)] +// CHECK:STDOUT: %require_complete.loc45_30: = require_complete_type %Class [template = %require_complete.loc45_30 (constants.%require_complete.ac0)] +// CHECK:STDOUT: %require_complete.loc45_36: = require_complete_type %.loc45_40.5 [template = %require_complete.loc45_36 (constants.%require_complete.cb0614.3)] +// CHECK:STDOUT: %.loc46_14.3: = access_member_action %self.ref, n [template] +// CHECK:STDOUT: %.loc46_14.4: type = type_of_inst %.loc46_14.3 [template = %.loc46_14.4 (constants.%.237)] +// CHECK:STDOUT: %.loc46_14.5: @Class.G.loc45.%.loc46_14.4 (%.237) = splice_inst %.loc46_14.3 [template = %.loc46_14.5 (constants.%.f96)] +// CHECK:STDOUT: %.loc46_16.2: %tuple.type = initialize_action %.loc46_14.2, %.loc45_40.5, %return.param, none, false [template] +// CHECK:STDOUT: %tuple.elem0: = tuple_access %.loc46_16.2, element0 [template] +// CHECK:STDOUT: %.loc46_16.3: @Class.G.loc45.%.loc45_40.5 (%.5372ba.4) = splice_inst %tuple.elem0 [template = %.loc46_16.3 (constants.%.5d6323.2)] // CHECK:STDOUT: -// CHECK:STDOUT: fn(%self.param: @Class.G.loc21.%Class (%Class)) -> out %return.param: @Class.G.loc21.%.loc21_40.5 (%.5372ba.4) { +// CHECK:STDOUT: fn(%self.param: @Class.G.loc45.%Class (%Class)) -> out %return.param: @Class.G.loc45.%.loc45_40.5 (%.5372ba.4) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %self.ref: @Class.G.loc21.%Class (%Class) = name_ref self, %self -// CHECK:STDOUT: %.loc22_14.1: type = type_of_inst %.loc22_14.3 [template = %.loc22_14.4 (constants.%.237)] -// CHECK:STDOUT: %.loc22_14.2: @Class.G.loc21.%.loc22_14.4 (%.237) = splice_inst %.loc22_14.3 [template = %.loc22_14.5 (constants.%.f96)] -// CHECK:STDOUT: %.loc22_16.1: @Class.G.loc21.%.loc21_40.5 (%.5372ba.4) = splice_inst %tuple.elem0 [template = %.loc22_16.3 (constants.%.5d6323.2)] -// CHECK:STDOUT: return %.loc22_16.1 to %return.param +// CHECK:STDOUT: %self.ref: @Class.G.loc45.%Class (%Class) = name_ref self, %self +// CHECK:STDOUT: %.loc46_14.1: type = type_of_inst %.loc46_14.3 [template = %.loc46_14.4 (constants.%.237)] +// CHECK:STDOUT: %.loc46_14.2: @Class.G.loc45.%.loc46_14.4 (%.237) = splice_inst %.loc46_14.3 [template = %.loc46_14.5 (constants.%.f96)] +// CHECK:STDOUT: %.loc46_16.1: @Class.G.loc45.%.loc45_40.5 (%.5372ba.4) = splice_inst %tuple.elem0 [template = %.loc46_16.3 (constants.%.5d6323.2)] +// CHECK:STDOUT: return %.loc46_16.1 to %return.param // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -379,41 +403,41 @@ fn Class(template T: type).G(self) -> T.U { // CHECK:STDOUT: %return.patt.loc7_14.2 => constants.%return.patt.b39 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Class.F.loc14(constants.%T) { -// CHECK:STDOUT: %T.loc14_33 => constants.%T -// CHECK:STDOUT: %.loc14_34.1 => constants.%.9af -// CHECK:STDOUT: %.loc14_34.2 => constants.%.eff391.3 -// CHECK:STDOUT: %.loc14_34.3 => constants.%.b66113.3 -// CHECK:STDOUT: %.loc14_34.4 => constants.%.c8c -// CHECK:STDOUT: %.loc14_34.5 => constants.%.5372ba.3 -// CHECK:STDOUT: %pattern_type.loc14_31 => constants.%pattern_type.fcb8f3.3 -// CHECK:STDOUT: %n.param_patt.loc14_31.2 => constants.%n.param_patt.110b44.2 -// CHECK:STDOUT: %n.patt.loc14_31.2 => constants.%n.patt.9e3e22.2 -// CHECK:STDOUT: %.loc14_42.1 => constants.%.9af -// CHECK:STDOUT: %.loc14_42.2 => constants.%.eff391.3 -// CHECK:STDOUT: %.loc14_42.3 => constants.%.b66113.3 -// CHECK:STDOUT: %.loc14_42.4 => constants.%.c8c -// CHECK:STDOUT: %.loc14_42.5 => constants.%.5372ba.3 -// CHECK:STDOUT: %.loc14_42.6 => constants.%.cd79f1.2 -// CHECK:STDOUT: %pattern_type.loc14_42 => constants.%pattern_type.fcb8f3.3 -// CHECK:STDOUT: %return.param_patt.loc14_42.2 => constants.%return.param_patt.2e9ac5.2 -// CHECK:STDOUT: %return.patt.loc14_38.2 => constants.%return.patt.7fc6a1.2 +// CHECK:STDOUT: specific @Class.F.loc27(constants.%T) { +// CHECK:STDOUT: %T.loc27_33 => constants.%T +// CHECK:STDOUT: %.loc27_34.1 => constants.%.9af +// CHECK:STDOUT: %.loc27_34.2 => constants.%.eff391.3 +// CHECK:STDOUT: %.loc27_34.3 => constants.%.b66113.3 +// CHECK:STDOUT: %.loc27_34.4 => constants.%.c8c +// CHECK:STDOUT: %.loc27_34.5 => constants.%.5372ba.3 +// CHECK:STDOUT: %pattern_type.loc27_31 => constants.%pattern_type.fcb8f3.3 +// CHECK:STDOUT: %n.param_patt.loc27_31.2 => constants.%n.param_patt.110b44.2 +// CHECK:STDOUT: %n.patt.loc27_31.2 => constants.%n.patt.9e3e22.2 +// CHECK:STDOUT: %.loc27_42.1 => constants.%.9af +// CHECK:STDOUT: %.loc27_42.2 => constants.%.eff391.3 +// CHECK:STDOUT: %.loc27_42.3 => constants.%.b66113.3 +// CHECK:STDOUT: %.loc27_42.4 => constants.%.c8c +// CHECK:STDOUT: %.loc27_42.5 => constants.%.5372ba.3 +// CHECK:STDOUT: %.loc27_42.6 => constants.%.cd79f1.2 +// CHECK:STDOUT: %pattern_type.loc27_42 => constants.%pattern_type.fcb8f3.3 +// CHECK:STDOUT: %return.param_patt.loc27_42.2 => constants.%return.param_patt.2e9ac5.2 +// CHECK:STDOUT: %return.patt.loc27_38.2 => constants.%return.patt.7fc6a1.2 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Class.G.loc21(constants.%T) { -// CHECK:STDOUT: %T.loc21_30 => constants.%T +// CHECK:STDOUT: specific @Class.G.loc45(constants.%T) { +// CHECK:STDOUT: %T.loc45_30 => constants.%T // CHECK:STDOUT: %Class => constants.%Class -// CHECK:STDOUT: %pattern_type.loc21_30 => constants.%pattern_type.28f -// CHECK:STDOUT: %self.param_patt.loc21_30.2 => constants.%self.param_patt -// CHECK:STDOUT: %self.patt.loc21_30.2 => constants.%self.patt -// CHECK:STDOUT: %.loc21_40.1 => constants.%.9af -// CHECK:STDOUT: %.loc21_40.2 => constants.%.eff391.3 -// CHECK:STDOUT: %.loc21_40.3 => constants.%.b66113.3 -// CHECK:STDOUT: %.loc21_40.4 => constants.%.c8c -// CHECK:STDOUT: %.loc21_40.5 => constants.%.5372ba.3 -// CHECK:STDOUT: %.loc21_40.6 => constants.%.cd79f1.2 -// CHECK:STDOUT: %pattern_type.loc21_40 => constants.%pattern_type.fcb8f3.3 -// CHECK:STDOUT: %return.param_patt.loc21_40.2 => constants.%return.param_patt.2e9ac5.2 -// CHECK:STDOUT: %return.patt.loc21_36.2 => constants.%return.patt.7fc6a1.2 +// CHECK:STDOUT: %pattern_type.loc45_30 => constants.%pattern_type.28f +// CHECK:STDOUT: %self.param_patt.loc45_30.2 => constants.%self.param_patt +// CHECK:STDOUT: %self.patt.loc45_30.2 => constants.%self.patt +// CHECK:STDOUT: %.loc45_40.1 => constants.%.9af +// CHECK:STDOUT: %.loc45_40.2 => constants.%.eff391.3 +// CHECK:STDOUT: %.loc45_40.3 => constants.%.b66113.3 +// CHECK:STDOUT: %.loc45_40.4 => constants.%.c8c +// CHECK:STDOUT: %.loc45_40.5 => constants.%.5372ba.3 +// CHECK:STDOUT: %.loc45_40.6 => constants.%.cd79f1.2 +// CHECK:STDOUT: %pattern_type.loc45_40 => constants.%pattern_type.fcb8f3.3 +// CHECK:STDOUT: %return.param_patt.loc45_40.2 => constants.%return.param_patt.2e9ac5.2 +// CHECK:STDOUT: %return.patt.loc45_36.2 => constants.%return.patt.7fc6a1.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/generic/template/unimplemented.carbon b/toolchain/check/testdata/generic/template/unimplemented.carbon index 5b24f581de07..759497bd92ac 100644 --- a/toolchain/check/testdata/generic/template/unimplemented.carbon +++ b/toolchain/check/testdata/generic/template/unimplemented.carbon @@ -19,7 +19,12 @@ library "[[@TEST_NAME]]"; // Check that we get a reasonable diagnostic for an unimplemented operation on a // template dependent expression. fn F[template T: type](x: T) { - // CHECK:STDERR: fail_todo_unimplemented_operator.carbon:[[@LINE+2]]:3: error: cannot dereference operand of non-pointer type `` [DerefOfNonPointer] + // CHECK:STDERR: ╭─┤ fail_todo_unimplemented_operator.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ *x.n; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot dereference operand of non-pointer type `` + // CHECK:STDERR: · ┃ [DerefOfNonPointer] + // CHECK:STDERR: ╰──── // CHECK:STDERR: *x.n; } @@ -36,7 +41,12 @@ class C { // template dependent value where the type is concrete but determined through // the template dependent value. fn F(template c: C) { - // CHECK:STDERR: fail_todo_unimplemented_value.carbon:[[@LINE+2]]:3: error: cannot dereference operand of non-pointer type `` [DerefOfNonPointer] + // CHECK:STDERR: ╭─┤ fail_todo_unimplemented_value.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ *c.n; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot dereference operand of non-pointer type `` + // CHECK:STDERR: · ┃ [DerefOfNonPointer] + // CHECK:STDERR: ╰──── // CHECK:STDERR: *c.n; } @@ -55,10 +65,10 @@ fn F(template c: C) { // CHECK:STDOUT: %F.type: type = fn_type @F [concrete] // CHECK:STDOUT: %F: %F.type = struct_value () [concrete] // CHECK:STDOUT: %require_complete.944: = require_complete_type %T [template] -// CHECK:STDOUT: %.237: type = type_of_inst @F.%.loc9_5.4 [template] -// CHECK:STDOUT: %.f96: %.237 = splice_inst @F.%.loc9_5.4 [template] +// CHECK:STDOUT: %.237: type = type_of_inst @F.%.loc14_5.4 [template] +// CHECK:STDOUT: %.f96: %.237 = splice_inst @F.%.loc14_5.4 [template] // CHECK:STDOUT: %require_complete.b43: = require_complete_type %.237 [template] -// CHECK:STDOUT: %.fb1: %.237 = splice_inst @F.%.loc9_5.7 [template] +// CHECK:STDOUT: %.fb1: %.237 = splice_inst @F.%.loc14_5.7 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -99,20 +109,20 @@ fn F(template c: C) { // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete.loc6: = require_complete_type %T.loc6_16.1 [template = %require_complete.loc6 (constants.%require_complete.944)] -// CHECK:STDOUT: %.loc9_5.4: = access_member_action %x.ref, n [template] -// CHECK:STDOUT: %.loc9_5.5: type = type_of_inst %.loc9_5.4 [template = %.loc9_5.5 (constants.%.237)] -// CHECK:STDOUT: %.loc9_5.6: @F.%.loc9_5.5 (%.237) = splice_inst %.loc9_5.4 [template = %.loc9_5.6 (constants.%.f96)] -// CHECK:STDOUT: %require_complete.loc9: = require_complete_type %.loc9_5.5 [template = %require_complete.loc9 (constants.%require_complete.b43)] -// CHECK:STDOUT: %.loc9_5.7: = convert_to_category_action %.loc9_5.2, element1 [template] -// CHECK:STDOUT: %.loc9_5.8: @F.%.loc9_5.5 (%.237) = splice_inst %.loc9_5.7 [template = %.loc9_5.8 (constants.%.fb1)] +// CHECK:STDOUT: %.loc14_5.4: = access_member_action %x.ref, n [template] +// CHECK:STDOUT: %.loc14_5.5: type = type_of_inst %.loc14_5.4 [template = %.loc14_5.5 (constants.%.237)] +// CHECK:STDOUT: %.loc14_5.6: @F.%.loc14_5.5 (%.237) = splice_inst %.loc14_5.4 [template = %.loc14_5.6 (constants.%.f96)] +// CHECK:STDOUT: %require_complete.loc14: = require_complete_type %.loc14_5.5 [template = %require_complete.loc14 (constants.%require_complete.b43)] +// CHECK:STDOUT: %.loc14_5.7: = convert_to_category_action %.loc14_5.2, element1 [template] +// CHECK:STDOUT: %.loc14_5.8: @F.%.loc14_5.5 (%.237) = splice_inst %.loc14_5.7 [template = %.loc14_5.8 (constants.%.fb1)] // CHECK:STDOUT: // CHECK:STDOUT: fn(%x.param: @F.%T.loc6_16.1 (%T)) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %x.ref: @F.%T.loc6_16.1 (%T) = name_ref x, %x -// CHECK:STDOUT: %.loc9_5.1: type = type_of_inst %.loc9_5.4 [template = %.loc9_5.5 (constants.%.237)] -// CHECK:STDOUT: %.loc9_5.2: @F.%.loc9_5.5 (%.237) = splice_inst %.loc9_5.4 [template = %.loc9_5.6 (constants.%.f96)] -// CHECK:STDOUT: %.loc9_5.3: @F.%.loc9_5.5 (%.237) = splice_inst %.loc9_5.7 [template = %.loc9_5.8 (constants.%.fb1)] -// CHECK:STDOUT: %.loc9_3: ref = deref %.loc9_5.3 [concrete = ] +// CHECK:STDOUT: %.loc14_5.1: type = type_of_inst %.loc14_5.4 [template = %.loc14_5.5 (constants.%.237)] +// CHECK:STDOUT: %.loc14_5.2: @F.%.loc14_5.5 (%.237) = splice_inst %.loc14_5.4 [template = %.loc14_5.6 (constants.%.f96)] +// CHECK:STDOUT: %.loc14_5.3: @F.%.loc14_5.5 (%.237) = splice_inst %.loc14_5.7 [template = %.loc14_5.8 (constants.%.fb1)] +// CHECK:STDOUT: %.loc14_3: ref = deref %.loc14_5.3 [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -143,10 +153,10 @@ fn F(template c: C) { // CHECK:STDOUT: %c: %C = symbolic_binding c, 0, template [template] // CHECK:STDOUT: %F.type: type = fn_type @F [concrete] // CHECK:STDOUT: %F: %F.type = struct_value () [concrete] -// CHECK:STDOUT: %.237: type = type_of_inst @F.%.loc14_5.4 [template] -// CHECK:STDOUT: %.f96: %.237 = splice_inst @F.%.loc14_5.4 [template] +// CHECK:STDOUT: %.237: type = type_of_inst @F.%.loc19_5.4 [template] +// CHECK:STDOUT: %.f96: %.237 = splice_inst @F.%.loc19_5.4 [template] // CHECK:STDOUT: %require_complete.b43: = require_complete_type %.237 [template] -// CHECK:STDOUT: %.fb1: %.237 = splice_inst @F.%.loc14_5.7 [template] +// CHECK:STDOUT: %.fb1: %.237 = splice_inst @F.%.loc19_5.7 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -194,20 +204,20 @@ fn F(template c: C) { // CHECK:STDOUT: %c.loc11_16.1: %C = symbolic_binding c, 0, template [template = %c.loc11_16.1 (constants.%c)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %.loc14_5.4: = access_member_action %c.ref, n [template] -// CHECK:STDOUT: %.loc14_5.5: type = type_of_inst %.loc14_5.4 [template = %.loc14_5.5 (constants.%.237)] -// CHECK:STDOUT: %.loc14_5.6: @F.%.loc14_5.5 (%.237) = splice_inst %.loc14_5.4 [template = %.loc14_5.6 (constants.%.f96)] -// CHECK:STDOUT: %require_complete: = require_complete_type %.loc14_5.5 [template = %require_complete (constants.%require_complete.b43)] -// CHECK:STDOUT: %.loc14_5.7: = convert_to_category_action %.loc14_5.2, element1 [template] -// CHECK:STDOUT: %.loc14_5.8: @F.%.loc14_5.5 (%.237) = splice_inst %.loc14_5.7 [template = %.loc14_5.8 (constants.%.fb1)] +// CHECK:STDOUT: %.loc19_5.4: = access_member_action %c.ref, n [template] +// CHECK:STDOUT: %.loc19_5.5: type = type_of_inst %.loc19_5.4 [template = %.loc19_5.5 (constants.%.237)] +// CHECK:STDOUT: %.loc19_5.6: @F.%.loc19_5.5 (%.237) = splice_inst %.loc19_5.4 [template = %.loc19_5.6 (constants.%.f96)] +// CHECK:STDOUT: %require_complete: = require_complete_type %.loc19_5.5 [template = %require_complete (constants.%require_complete.b43)] +// CHECK:STDOUT: %.loc19_5.7: = convert_to_category_action %.loc19_5.2, element1 [template] +// CHECK:STDOUT: %.loc19_5.8: @F.%.loc19_5.5 (%.237) = splice_inst %.loc19_5.7 [template = %.loc19_5.8 (constants.%.fb1)] // CHECK:STDOUT: // CHECK:STDOUT: fn() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %c.ref: %C = name_ref c, %c.loc11_16.2 [template = %c.loc11_16.1 (constants.%c)] -// CHECK:STDOUT: %.loc14_5.1: type = type_of_inst %.loc14_5.4 [template = %.loc14_5.5 (constants.%.237)] -// CHECK:STDOUT: %.loc14_5.2: @F.%.loc14_5.5 (%.237) = splice_inst %.loc14_5.4 [template = %.loc14_5.6 (constants.%.f96)] -// CHECK:STDOUT: %.loc14_5.3: @F.%.loc14_5.5 (%.237) = splice_inst %.loc14_5.7 [template = %.loc14_5.8 (constants.%.fb1)] -// CHECK:STDOUT: %.loc14_3: ref = deref %.loc14_5.3 [concrete = ] +// CHECK:STDOUT: %.loc19_5.1: type = type_of_inst %.loc19_5.4 [template = %.loc19_5.5 (constants.%.237)] +// CHECK:STDOUT: %.loc19_5.2: @F.%.loc19_5.5 (%.237) = splice_inst %.loc19_5.4 [template = %.loc19_5.6 (constants.%.f96)] +// CHECK:STDOUT: %.loc19_5.3: @F.%.loc19_5.5 (%.237) = splice_inst %.loc19_5.7 [template = %.loc19_5.8 (constants.%.fb1)] +// CHECK:STDOUT: %.loc19_3: ref = deref %.loc19_5.3 [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/if/basics.carbon b/toolchain/check/testdata/if/basics.carbon index 7e84e20c4550..6598aaec6b3f 100644 --- a/toolchain/check/testdata/if/basics.carbon +++ b/toolchain/check/testdata/if/basics.carbon @@ -65,7 +65,12 @@ fn If1(b: bool) -> bool { return false; } else { } -// CHECK:STDERR: fail_reachable_fallthrough.carbon:[[@LINE+2]]:1: error: missing `return` at end of function with declared return type [MissingReturnStatement] +// CHECK:STDERR: ╭─┤ fail_reachable_fallthrough.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ } +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: missing `return` at end of function with declared return type +// CHECK:STDERR: · ┃ [MissingReturnStatement] +// CHECK:STDERR: ╰──── // CHECK:STDERR: } @@ -74,7 +79,12 @@ fn If2(b: bool) -> bool { } else { return true; } -// CHECK:STDERR: fail_reachable_fallthrough.carbon:[[@LINE+2]]:1: error: missing `return` at end of function with declared return type [MissingReturnStatement] +// CHECK:STDERR: ╭─┤ fail_reachable_fallthrough.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ } +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: missing `return` at end of function with declared return type +// CHECK:STDERR: · ┃ [MissingReturnStatement] +// CHECK:STDERR: ╰──── // CHECK:STDERR: } @@ -82,7 +92,12 @@ fn If3(b: bool) -> bool { if (b) { return false; } -// CHECK:STDERR: fail_reachable_fallthrough.carbon:[[@LINE+2]]:1: error: missing `return` at end of function with declared return type [MissingReturnStatement] +// CHECK:STDERR: ╭─┤ fail_reachable_fallthrough.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ } +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: missing `return` at end of function with declared return type +// CHECK:STDERR: · ┃ [MissingReturnStatement] +// CHECK:STDERR: ╰──── // CHECK:STDERR: } @@ -94,7 +109,11 @@ fn VarScope(b: bool) -> bool { var n: bool = true; return n; } - // CHECK:STDERR: fail_scope.carbon:[[@LINE+2]]:10: error: name `n` not found [NameNotFound] + // CHECK:STDERR: ╭─┤ fail_scope.carbon:[[@LINE+6]]:10 + // CHECK:STDERR: -> │ return n; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: name `n` not found [NameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return n; } diff --git a/toolchain/check/testdata/if_expr/fail_not_in_function.carbon b/toolchain/check/testdata/if_expr/fail_not_in_function.carbon index 5a00b86d58a0..20434e97c7e3 100644 --- a/toolchain/check/testdata/if_expr/fail_not_in_function.carbon +++ b/toolchain/check/testdata/if_expr/fail_not_in_function.carbon @@ -16,11 +16,32 @@ library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_basic.carbon:[[@LINE+6]]:14-20: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_basic.carbon:[[@LINE+27]]:14 +// CHECK:STDERR: -> │ let x: i32 = if true then 1 else 0; +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: semantics TODO: +// CHECK:STDERR: · ┃ `Control flow expressions are currently only supported inside functions.` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_basic.carbon:[[@LINE+4]]:22-27: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_basic.carbon:[[@LINE+18]]:22 +// CHECK:STDERR: -> │ let x: i32 = if true then 1 else 0; +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: semantics TODO: +// CHECK:STDERR: · ┃ `Control flow expressions are currently only supported inside functions.` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_basic.carbon:[[@LINE+2]]:14-34: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_basic.carbon:[[@LINE+9]]:14 +// CHECK:STDERR: -> │ let x: i32 = if true then 1 else 0; +// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: semantics TODO: +// CHECK:STDERR: · ┃ `Control flow expressions are currently only supported inside functions.` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let x: i32 = if true then 1 else 0; @@ -28,7 +49,14 @@ let x: i32 = if true then 1 else 0; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_types.carbon:[[@LINE+2]]:8-32: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_types.carbon:[[@LINE+9]]:8 +// CHECK:STDERR: -> │ var y: if true then i32 else f64; +// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: semantics TODO: +// CHECK:STDERR: · ┃ `Control flow expressions are currently only supported inside functions.` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var y: if true then i32 else f64; @@ -36,7 +64,14 @@ var y: if true then i32 else f64; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_in_param.carbon:[[@LINE+2]]:9-33: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_in_param.carbon:[[@LINE+9]]:9 +// CHECK:STDERR: -> │ fn F(a: if true then i32 else f64); +// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: semantics TODO: +// CHECK:STDERR: · ┃ `Control flow expressions are currently only supported inside functions.` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(a: if true then i32 else f64); @@ -45,7 +80,14 @@ fn F(a: if true then i32 else f64); library "[[@TEST_NAME]]"; class C { - // CHECK:STDERR: fail_class.carbon:[[@LINE+2]]:10-34: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_class.carbon:[[@LINE+9]]:10 + // CHECK:STDERR: -> │ var n: if true then i32 else f64; + // CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: semantics TODO: + // CHECK:STDERR: · ┃ `Control flow expressions are currently only supported inside functions.` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var n: if true then i32 else f64; } @@ -58,7 +100,14 @@ base class C(T: type) {} fn F() { class B { - // CHECK:STDERR: fail_nested_class.carbon:[[@LINE+2]]:20-44: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_nested_class.carbon:[[@LINE+9]]:20 + // CHECK:STDERR: -> │ extend base: C(if true then i32 else i32); + // CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: semantics TODO: + // CHECK:STDERR: · ┃ `Control flow expressions are currently only supported inside functions.` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend base: C(if true then i32 else i32); } diff --git a/toolchain/check/testdata/if_expr/fail_partial_constant.carbon b/toolchain/check/testdata/if_expr/fail_partial_constant.carbon index 05669f688c9a..f4c574e9bf2c 100644 --- a/toolchain/check/testdata/if_expr/fail_partial_constant.carbon +++ b/toolchain/check/testdata/if_expr/fail_partial_constant.carbon @@ -20,7 +20,12 @@ fn ConditionIsNonConstant(b: bool) { // We choose to not accept this even if both arms evaluate to the same // constant value, because it notionally involves evaluating a non-constant // condition. - // CHECK:STDERR: fail_non_constant_condition.carbon:[[@LINE+2]]:17-38: error: cannot evaluate type expression [TypeExprEvaluationFailure] + // CHECK:STDERR: ╭─┤ fail_non_constant_condition.carbon:[[@LINE+7]]:17 + // CHECK:STDERR: -> │ var unused v: if b then i32 else i32 = 1; + // CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot evaluate type expression + // CHECK:STDERR: · ┃ [TypeExprEvaluationFailure] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused v: if b then i32 else i32 = 1; } @@ -30,10 +35,20 @@ fn ConditionIsNonConstant(b: bool) { package NonConstantResult; fn ChosenBranchIsNonConstant(t: type) { - // CHECK:STDERR: fail_non_constant_result.carbon:[[@LINE+2]]:17-39: error: cannot evaluate type expression [TypeExprEvaluationFailure] + // CHECK:STDERR: ╭─┤ fail_non_constant_result.carbon:[[@LINE+7]]:17 + // CHECK:STDERR: -> │ var unused v: if true then t else i32 = 1; + // CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot evaluate type expression + // CHECK:STDERR: · ┃ [TypeExprEvaluationFailure] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused v: if true then t else i32 = 1; - // CHECK:STDERR: fail_non_constant_result.carbon:[[@LINE+2]]:17-40: error: cannot evaluate type expression [TypeExprEvaluationFailure] + // CHECK:STDERR: ╭─┤ fail_non_constant_result.carbon:[[@LINE+7]]:17 + // CHECK:STDERR: -> │ var unused w: if false then i32 else t = 1; + // CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot evaluate type expression + // CHECK:STDERR: · ┃ [TypeExprEvaluationFailure] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused w: if false then i32 else t = 1; } @@ -90,25 +105,25 @@ fn ChosenBranchIsNonConstant(t: type) { // CHECK:STDOUT: %v.var: ref = var_storage %v.var_patt [concrete = ] // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] // CHECK:STDOUT: assign %v.var, -// CHECK:STDOUT: br !.loc10_20 +// CHECK:STDOUT: br !.loc15_20 // CHECK:STDOUT: -// CHECK:STDOUT: !.loc10_20: +// CHECK:STDOUT: !.loc15_20: // CHECK:STDOUT: %b.ref: bool = name_ref b, %b // CHECK:STDOUT: if %b.ref br !if.expr.then else br !if.expr.else // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then: -// CHECK:STDOUT: %i32.loc10_27: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: br !if.expr.result(%i32.loc10_27) +// CHECK:STDOUT: %i32.loc15_27: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: br !if.expr.result(%i32.loc15_27) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else: -// CHECK:STDOUT: %i32.loc10_36: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: br !if.expr.result(%i32.loc10_36) +// CHECK:STDOUT: %i32.loc15_36: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: br !if.expr.result(%i32.loc15_36) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result: -// CHECK:STDOUT: %.loc10: type = block_arg !if.expr.result -// CHECK:STDOUT: br !.loc10_15 +// CHECK:STDOUT: %.loc15: type = block_arg !if.expr.result +// CHECK:STDOUT: br !.loc15_15 // CHECK:STDOUT: -// CHECK:STDOUT: !.loc10_15: +// CHECK:STDOUT: !.loc15_15: // CHECK:STDOUT: %v: = wrapper_binding v, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %v.patt: = ref_binding_pattern v [concrete = ] @@ -167,54 +182,54 @@ fn ChosenBranchIsNonConstant(t: type) { // CHECK:STDOUT: fn @ChosenBranchIsNonConstant(%t.param: type) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %v.var: ref = var_storage %v.var_patt [concrete = ] -// CHECK:STDOUT: %int_1.loc7: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] +// CHECK:STDOUT: %int_1.loc12: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] // CHECK:STDOUT: assign %v.var, -// CHECK:STDOUT: br !.loc7_20 +// CHECK:STDOUT: br !.loc12_20 // CHECK:STDOUT: -// CHECK:STDOUT: !.loc7_20: +// CHECK:STDOUT: !.loc12_20: // CHECK:STDOUT: %true: bool = bool_literal true [concrete = constants.%true] -// CHECK:STDOUT: if %true br !if.expr.then.loc7 else br !if.expr.else.loc7 +// CHECK:STDOUT: if %true br !if.expr.then.loc12 else br !if.expr.else.loc12 // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc7: -// CHECK:STDOUT: %t.ref.loc7: type = name_ref t, %t -// CHECK:STDOUT: br !if.expr.result.loc7(%t.ref.loc7) +// CHECK:STDOUT: !if.expr.then.loc12: +// CHECK:STDOUT: %t.ref.loc12: type = name_ref t, %t +// CHECK:STDOUT: br !if.expr.result.loc12(%t.ref.loc12) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc7: -// CHECK:STDOUT: %i32.loc7: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: br !if.expr.result.loc7(%i32.loc7) +// CHECK:STDOUT: !if.expr.else.loc12: +// CHECK:STDOUT: %i32.loc12: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: br !if.expr.result.loc12(%i32.loc12) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc7: -// CHECK:STDOUT: %.loc7: type = block_arg !if.expr.result.loc7 -// CHECK:STDOUT: br !.loc7_15 +// CHECK:STDOUT: !if.expr.result.loc12: +// CHECK:STDOUT: %.loc12: type = block_arg !if.expr.result.loc12 +// CHECK:STDOUT: br !.loc12_15 // CHECK:STDOUT: -// CHECK:STDOUT: !.loc7_15: +// CHECK:STDOUT: !.loc12_15: // CHECK:STDOUT: %v: = wrapper_binding v, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %v.patt: = ref_binding_pattern v [concrete = ] // CHECK:STDOUT: %v.var_patt: = var_pattern %v.patt [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: %w.var: ref = var_storage %w.var_patt [concrete = ] -// CHECK:STDOUT: %int_1.loc10: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] +// CHECK:STDOUT: %int_1.loc20: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] // CHECK:STDOUT: assign %w.var, -// CHECK:STDOUT: br !.loc10_20 +// CHECK:STDOUT: br !.loc20_20 // CHECK:STDOUT: -// CHECK:STDOUT: !.loc10_20: +// CHECK:STDOUT: !.loc20_20: // CHECK:STDOUT: %false: bool = bool_literal false [concrete = constants.%false] -// CHECK:STDOUT: if %false br !if.expr.then.loc10 else br !if.expr.else.loc10 +// CHECK:STDOUT: if %false br !if.expr.then.loc20 else br !if.expr.else.loc20 // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc10: -// CHECK:STDOUT: %i32.loc10: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: br !if.expr.result.loc10(%i32.loc10) +// CHECK:STDOUT: !if.expr.then.loc20: +// CHECK:STDOUT: %i32.loc20: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: br !if.expr.result.loc20(%i32.loc20) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc10: -// CHECK:STDOUT: %t.ref.loc10: type = name_ref t, %t -// CHECK:STDOUT: br !if.expr.result.loc10(%t.ref.loc10) +// CHECK:STDOUT: !if.expr.else.loc20: +// CHECK:STDOUT: %t.ref.loc20: type = name_ref t, %t +// CHECK:STDOUT: br !if.expr.result.loc20(%t.ref.loc20) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc10: -// CHECK:STDOUT: %.loc10: type = block_arg !if.expr.result.loc10 -// CHECK:STDOUT: br !.loc10_15 +// CHECK:STDOUT: !if.expr.result.loc20: +// CHECK:STDOUT: %.loc20: type = block_arg !if.expr.result.loc20 +// CHECK:STDOUT: br !.loc20_15 // CHECK:STDOUT: -// CHECK:STDOUT: !.loc10_15: +// CHECK:STDOUT: !.loc20_15: // CHECK:STDOUT: %w: = wrapper_binding w, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %w.patt: = ref_binding_pattern w [concrete = ] diff --git a/toolchain/check/testdata/impl/access.carbon b/toolchain/check/testdata/impl/access.carbon index ad269b4533a9..c82c3630adba 100644 --- a/toolchain/check/testdata/impl/access.carbon +++ b/toolchain/check/testdata/impl/access.carbon @@ -49,8 +49,16 @@ class A { impl B as I { fn Get(self: B) -> i32 { - // CHECK:STDERR: fail_impl_in_other_class1.carbon:[[@LINE+3]]:20-25: error: cannot access private member `m` of type `B` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_impl_in_other_class1.carbon:[[@LINE-9]]:17-22: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_impl_in_other_class1.carbon:[[@LINE+11]]:20 + // CHECK:STDERR: │ private var m: i32; + // CHECK:STDERR: · ───┬── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ return self.m; + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `m` of type `B` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return self.m; } @@ -70,8 +78,16 @@ class A { impl as K(B) { fn Get(t: B) -> i32 { - // CHECK:STDERR: fail_impl_in_other_class2.carbon:[[@LINE+3]]:20-22: error: cannot access private member `m` of type `B` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_impl_in_other_class2.carbon:[[@LINE-9]]:17-22: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_impl_in_other_class2.carbon:[[@LINE+11]]:20 + // CHECK:STDERR: │ private var m: i32; + // CHECK:STDERR: · ───┬── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ return t.m; + // CHECK:STDERR: · ━┳━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `m` of type `B` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return t.m; } @@ -88,8 +104,16 @@ class A { impl A as J { fn Get(self: Self) -> i32 { - // CHECK:STDERR: fail_impl_outside_class1.carbon:[[@LINE+3]]:16-21: error: cannot access private member `n` of type `A` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_impl_outside_class1.carbon:[[@LINE-6]]:17-22: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_impl_outside_class1.carbon:[[@LINE+11]]:16 + // CHECK:STDERR: │ private var n: i32; + // CHECK:STDERR: · ───┬── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ return self.n; + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `n` of type `A` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return self.n; } @@ -105,8 +129,16 @@ class B { impl B as J { fn Get(self: B) -> i32 { - // CHECK:STDERR: fail_impl_outside_class2.carbon:[[@LINE+3]]:16-21: error: cannot access private member `m` of type `B` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_impl_outside_class2.carbon:[[@LINE-6]]:17-22: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_impl_outside_class2.carbon:[[@LINE+11]]:16 + // CHECK:STDERR: │ private var m: i32; + // CHECK:STDERR: · ───┬── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ return self.m; + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `m` of type `B` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return self.m; } diff --git a/toolchain/check/testdata/impl/assoc_const_self.carbon b/toolchain/check/testdata/impl/assoc_const_self.carbon index fc1cfcbdb599..d379f083b6c3 100644 --- a/toolchain/check/testdata/impl/assoc_const_self.carbon +++ b/toolchain/check/testdata/impl/assoc_const_self.carbon @@ -32,8 +32,16 @@ interface I { let V: Self; } -// CHECK:STDERR: fail_assoc_const_mismatch.carbon:[[@LINE+3]]:12-25: error: cannot implicitly convert expression of type `Core.IntLiteral` to `{}` [ConversionFailure] -// CHECK:STDERR: fail_assoc_const_mismatch.carbon:[[@LINE+2]]:12-25: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs({})` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_assoc_const_mismatch.carbon:[[@LINE+11]]:12 +// CHECK:STDERR: -> │ impl {} as I where .V = 0 {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type +// CHECK:STDERR: · │ ┃ `Core.IntLiteral` to `{}` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╰────┤ type `Core.IntLiteral` does not implement interface +// CHECK:STDERR: · │ `Core.ImplicitAs({})` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl {} as I where .V = 0 {} @@ -51,7 +59,13 @@ impl () as Core.ImplicitAs(C) { fn Convert(unused self: ()) -> C { return {}; } } -// CHECK:STDERR: fail_assoc_const_not_constant_after_conversion.carbon:[[@LINE+2]]:11-25: error: associated constant V given value `()` that is not constant after conversion to `C` [AssociatedConstantNotConstantAfterConversion] +// CHECK:STDERR: ╭─┤ fail_assoc_const_not_constant_after_conversion.carbon:[[@LINE+8]]:11 +// CHECK:STDERR: -> │ impl C as I where .V = () {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: associated constant V given value `()` that is not +// CHECK:STDERR: · ┃ constant after conversion to `C` +// CHECK:STDERR: · ┃ [AssociatedConstantNotConstantAfterConversion] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl C as I where .V = () {} @@ -66,8 +80,17 @@ interface I(N: Core.IntLiteral) { let V: Array(Self, N); } -// CHECK:STDERR: fail_monomorphization_failure.carbon:[[@LINE+3]]:24-25: error: member access into facet of incomplete type `I(-1)` [IncompleteTypeInMemberAccessOfFacet] -// CHECK:STDERR: fail_monomorphization_failure.carbon:[[@LINE-4]]:16-19: note: array bound of -1 is negative [ArrayBoundNegative] +// CHECK:STDERR: ╭─┤ fail_monomorphization_failure.carbon:[[@LINE+12]]:24 +// CHECK:STDERR: │ let V: Array(Self, N); +// CHECK:STDERR: · ──┬─ +// CHECK:STDERR: · ╰──┤ array bound of -1 is negative [ArrayBoundNegative] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ impl {} as I(-1) where .V = () {} +// CHECK:STDERR: · ┳━ +// CHECK:STDERR: · ┗━━┫ error: member access into facet of incomplete type +// CHECK:STDERR: · ┃ `I(-1)` +// CHECK:STDERR: · ┃ [IncompleteTypeInMemberAccessOfFacet] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl {} as I(-1) where .V = () {} @@ -83,8 +106,18 @@ fn F(generic T: I where {} impls Core.ImplicitAs(.Self) and .V = {}); fn CallF() { // TODO: This call should eventually work. - // CHECK:STDERR: fail_todo_constrained_fn.carbon:[[@LINE+3]]:3-7: error: cannot convert type `{}` into type implementing `I where {} impls Core.ImplicitAs(.Self) and .(I.V) = {}` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_todo_constrained_fn.carbon:[[@LINE-5]]:14-67: note: initializing generic parameter `T` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_todo_constrained_fn.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn F(generic T: I where {} impls Core.ImplicitAs(.Self) and .V = {}); + // CHECK:STDERR: · ──────────────┬─────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F({}); + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `{}` into type implementing + // CHECK:STDERR: · ┃ `I where {} impls Core.ImplicitAs(.Self) and .(I.V) = {}` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F({}); } @@ -330,26 +363,26 @@ fn CallF() { // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {} // CHECK:STDOUT: impl_decl @empty_struct_type.as.I.impl [concrete] {} { -// CHECK:STDOUT: %.loc11_7.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc11_7.2: type = converted %.loc11_7.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc19_7.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc19_7.2: type = converted %.loc19_7.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: %.Self.frozen: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] // CHECK:STDOUT: %.Self.ref: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc11_20: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc19_20: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.frozen.as_type] // CHECK:STDOUT: %V.ref: %I.assoc_type = name_ref V, @V.%assoc0 [concrete = constants.%assoc0.660] -// CHECK:STDOUT: %impl.elem0.loc11_20.1: %.Self.frozen.as_type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.4da] +// CHECK:STDOUT: %impl.elem0.loc19_20.1: %.Self.frozen.as_type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.4da] // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] -// CHECK:STDOUT: %rewrite.loc11_23.1 = requirement_rewrite %impl.elem0.loc11_20.1, %int_0 [concrete] -// CHECK:STDOUT: %impl.elem0.loc11_20.2: %.Self.as_type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.ca3] -// CHECK:STDOUT: %rewrite.loc11_23.2 = requirement_rewrite %impl.elem0.loc11_20.2, %int_0 [concrete] -// CHECK:STDOUT: %.loc11_14.1: type = where_expr [concrete = constants.%I_where.type.8e4] { +// CHECK:STDOUT: %rewrite.loc19_23.1 = requirement_rewrite %impl.elem0.loc19_20.1, %int_0 [concrete] +// CHECK:STDOUT: %impl.elem0.loc19_20.2: %.Self.as_type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.ca3] +// CHECK:STDOUT: %rewrite.loc19_23.2 = requirement_rewrite %impl.elem0.loc19_20.2, %int_0 [concrete] +// CHECK:STDOUT: %.loc19_14.1: type = where_expr [concrete = constants.%I_where.type.8e4] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] -// CHECK:STDOUT: %rewrite.loc11_23.2 = requirement_rewrite %impl.elem0.loc11_20.2, %int_0 [concrete] +// CHECK:STDOUT: %rewrite.loc19_23.2 = requirement_rewrite %impl.elem0.loc19_20.2, %int_0 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc11: = impl_self_witness @empty_struct_type.as.I.impl.%.loc11_7.2, @I [concrete = constants.%.aaf] +// CHECK:STDOUT: %.loc19: = impl_self_witness @empty_struct_type.as.I.impl.%.loc19_7.2, @I [concrete = constants.%.aaf] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { @@ -369,10 +402,10 @@ fn CallF() { // CHECK:STDOUT: !requires: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @empty_struct_type.as.I.impl: %.loc11_7.2 as %I.ref { +// CHECK:STDOUT: impl @empty_struct_type.as.I.impl: %.loc19_7.2 as %I.ref { // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (%impl_witness_assoc_constant), @empty_struct_type.as.I.impl [concrete] // CHECK:STDOUT: %I.impl_witness: = impl_witness %I.impl_witness_table [concrete = constants.%I.impl_witness] -// CHECK:STDOUT: %.loc11_14.2: %empty_struct_type = converted constants.%int_0, [concrete = ] +// CHECK:STDOUT: %.loc19_14.2: %empty_struct_type = converted constants.%int_0, [concrete = ] // CHECK:STDOUT: %impl_witness_assoc_constant: = impl_witness_assoc_constant [concrete = ] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -486,21 +519,21 @@ fn CallF() { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] // CHECK:STDOUT: %.Self.ref: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc16_19: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc22_19: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.frozen.as_type] // CHECK:STDOUT: %V.ref: %I.assoc_type = name_ref V, @V.%assoc0 [concrete = constants.%assoc0.660] -// CHECK:STDOUT: %impl.elem0.loc16_19.1: %.Self.frozen.as_type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.4da] -// CHECK:STDOUT: %.loc16_25.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %impl.elem0.loc22_19.1: %.Self.frozen.as_type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.4da] +// CHECK:STDOUT: %.loc22_25.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc16_25.2: %empty_tuple.type = converted %.loc16_25.1, %empty_tuple [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %rewrite.loc16_22.1 = requirement_rewrite %impl.elem0.loc16_19.1, %.loc16_25.2 [concrete] -// CHECK:STDOUT: %impl.elem0.loc16_19.2: %.Self.as_type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.ca3] -// CHECK:STDOUT: %rewrite.loc16_22.2 = requirement_rewrite %impl.elem0.loc16_19.2, %.loc16_25.2 [concrete] -// CHECK:STDOUT: %.loc16_13.1: type = where_expr [concrete = constants.%I_where.type.d5e] { +// CHECK:STDOUT: %.loc22_25.2: %empty_tuple.type = converted %.loc22_25.1, %empty_tuple [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %rewrite.loc22_22.1 = requirement_rewrite %impl.elem0.loc22_19.1, %.loc22_25.2 [concrete] +// CHECK:STDOUT: %impl.elem0.loc22_19.2: %.Self.as_type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.ca3] +// CHECK:STDOUT: %rewrite.loc22_22.2 = requirement_rewrite %impl.elem0.loc22_19.2, %.loc22_25.2 [concrete] +// CHECK:STDOUT: %.loc22_13.1: type = where_expr [concrete = constants.%I_where.type.d5e] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] -// CHECK:STDOUT: %rewrite.loc16_22.2 = requirement_rewrite %impl.elem0.loc16_19.2, %.loc16_25.2 [concrete] +// CHECK:STDOUT: %rewrite.loc22_22.2 = requirement_rewrite %impl.elem0.loc22_19.2, %.loc22_25.2 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc16: = impl_self_witness @C.as.I.impl.%C.ref, @I [concrete = constants.%.b7f] +// CHECK:STDOUT: %.loc22: = impl_self_witness @C.as.I.impl.%C.ref, @I [concrete = constants.%.b7f] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { @@ -551,13 +584,13 @@ fn CallF() { // CHECK:STDOUT: impl @C.as.I.impl: %C.ref as %I.ref { // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (%impl_witness_assoc_constant), @C.as.I.impl [concrete] // CHECK:STDOUT: %I.impl_witness: = impl_witness %I.impl_witness_table [concrete = constants.%I.impl_witness] -// CHECK:STDOUT: %impl.elem0.loc16_13: %.cf4 = impl_witness_access constants.%ImplicitAs.impl_witness, element0 [concrete = constants.%empty_tuple.type.as.ImplicitAs.impl.Convert] -// CHECK:STDOUT: %bound_method: = bound_method constants.%empty_tuple, %impl.elem0.loc16_13 [concrete = constants.%empty_tuple.type.as.ImplicitAs.impl.Convert.bound] -// CHECK:STDOUT: %.loc16_13.2: ref %C = temporary_storage -// CHECK:STDOUT: %empty_tuple.type.as.ImplicitAs.impl.Convert.call: init %C to %.loc16_13.2 = call %bound_method(constants.%empty_tuple) -// CHECK:STDOUT: %.loc16_13.3: init %C = converted constants.%empty_tuple, %empty_tuple.type.as.ImplicitAs.impl.Convert.call -// CHECK:STDOUT: %.loc16_13.4: ref %C = temporary %.loc16_13.2, %.loc16_13.3 -// CHECK:STDOUT: %.loc16_13.5: %C = acquire_value %.loc16_13.4 +// CHECK:STDOUT: %impl.elem0.loc22_13: %.cf4 = impl_witness_access constants.%ImplicitAs.impl_witness, element0 [concrete = constants.%empty_tuple.type.as.ImplicitAs.impl.Convert] +// CHECK:STDOUT: %bound_method: = bound_method constants.%empty_tuple, %impl.elem0.loc22_13 [concrete = constants.%empty_tuple.type.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %.loc22_13.2: ref %C = temporary_storage +// CHECK:STDOUT: %empty_tuple.type.as.ImplicitAs.impl.Convert.call: init %C to %.loc22_13.2 = call %bound_method(constants.%empty_tuple) +// CHECK:STDOUT: %.loc22_13.3: init %C = converted constants.%empty_tuple, %empty_tuple.type.as.ImplicitAs.impl.Convert.call +// CHECK:STDOUT: %.loc22_13.4: ref %C = temporary %.loc22_13.2, %.loc22_13.3 +// CHECK:STDOUT: %.loc22_13.5: %C = acquire_value %.loc22_13.4 // CHECK:STDOUT: %impl_witness_assoc_constant: = impl_witness_assoc_constant [concrete = ] // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -707,25 +740,25 @@ fn CallF() { // CHECK:STDOUT: %N.loc7_14.2: Core.IntLiteral = symbolic_binding N, 0 [symbolic = %N.loc7_14.1 (constants.%N)] // CHECK:STDOUT: } // CHECK:STDOUT: impl_decl @empty_struct_type.as..impl [concrete] {} { -// CHECK:STDOUT: %.loc14_7.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc14_7.2: type = converted %.loc14_7.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc23_7.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc23_7.2: type = converted %.loc23_7.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: %I.ref: %I.type.335 = name_ref I, file.%I.decl [concrete = constants.%I.generic] // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] // CHECK:STDOUT: %impl.elem1: %.2ac = impl_witness_access constants.%Negate.impl_witness, element1 [concrete = constants.%Core.IntLiteral.as.Negate.impl.Op] // CHECK:STDOUT: %bound_method: = bound_method %int_1, %impl.elem1 [concrete = constants.%Core.IntLiteral.as.Negate.impl.Op.bound] // CHECK:STDOUT: %Core.IntLiteral.as.Negate.impl.Op.call: init Core.IntLiteral = call %bound_method(%int_1) [concrete = constants.%int_-1] -// CHECK:STDOUT: %.loc14_16.1: Core.IntLiteral = value_of_initializer %Core.IntLiteral.as.Negate.impl.Op.call [concrete = constants.%int_-1] -// CHECK:STDOUT: %.loc14_16.2: Core.IntLiteral = converted %Core.IntLiteral.as.Negate.impl.Op.call, %.loc14_16.1 [concrete = constants.%int_-1] +// CHECK:STDOUT: %.loc23_16.1: Core.IntLiteral = value_of_initializer %Core.IntLiteral.as.Negate.impl.Op.call [concrete = constants.%int_-1] +// CHECK:STDOUT: %.loc23_16.2: Core.IntLiteral = converted %Core.IntLiteral.as.Negate.impl.Op.call, %.loc23_16.1 [concrete = constants.%int_-1] // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(constants.%int_-1)> [concrete = constants.%I.type.8c1] // CHECK:STDOUT: %.Self.frozen: %I.type.8c1 = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen.1af] // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.type [concrete] // CHECK:STDOUT: %.Self.ref: %I.type.8c1 = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen.1af] // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc14_24: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc23_24: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.frozen.as_type] // CHECK:STDOUT: %V.ref: = name_ref V, [concrete = ] -// CHECK:STDOUT: %.loc14_30: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc23_30: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] // CHECK:STDOUT: %rewrite = requirement_rewrite %V.ref, [concrete] -// CHECK:STDOUT: %.loc14_18: type = where_expr [concrete = ] { +// CHECK:STDOUT: %.loc23_18: type = where_expr [concrete = ] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.type [concrete] // CHECK:STDOUT: %rewrite = requirement_rewrite %V.ref, [concrete] // CHECK:STDOUT: } @@ -762,7 +795,7 @@ fn CallF() { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @empty_struct_type.as..impl: %.loc14_7.2 as { +// CHECK:STDOUT: impl @empty_struct_type.as..impl: %.loc23_7.2 as { // CHECK:STDOUT: !members: // CHECK:STDOUT: extend // CHECK:STDOUT: witness = @@ -917,7 +950,7 @@ fn CallF() { // CHECK:STDOUT: fn @CallF() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] -// CHECK:STDOUT: %.loc15: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc25: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/basic.carbon b/toolchain/check/testdata/impl/basic.carbon index 3ce0ec49528b..8789fa5678e0 100644 --- a/toolchain/check/testdata/impl/basic.carbon +++ b/toolchain/check/testdata/impl/basic.carbon @@ -37,7 +37,11 @@ interface I { class C {} // This produces an invalid impl. -// CHECK:STDERR: fail_invalid_impl.carbon:[[@LINE+2]]:6-12: error: name `Unknown` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_invalid_impl.carbon:[[@LINE+6]]:6 +// CHECK:STDERR: -> │ impl Unknown as I { +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: name `Unknown` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl Unknown as I { fn Op(unused self) {} @@ -51,7 +55,13 @@ import library "invalid_impl"; fn F() { // This impl doesn't exist, but it still tests that we can ignore the // `impl Unknown as I` on import. - // CHECK:STDERR: fail_import_invalid_impl.carbon:[[@LINE+2]]:3-10: error: cannot access member of interface `I` in type `type` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_import_invalid_impl.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ C.(I.Op)(); + // CHECK:STDERR: · ┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `I` in type `type` that does not + // CHECK:STDERR: · ┃ implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: C.(I.Op)(); } @@ -64,27 +74,61 @@ interface I {} class C(T: type) {} -// CHECK:STDERR: fail_conflicting_bad_impls.carbon:[[@LINE+2]]:12-18: error: name `invalid` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_conflicting_bad_impls.carbon:[[@LINE+6]]:12 +// CHECK:STDERR: -> │ final impl invalid as I {} +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: name `invalid` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: final impl invalid as I {} -// CHECK:STDERR: fail_conflicting_bad_impls.carbon:[[@LINE+5]]:12-18: error: name `invalid` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_conflicting_bad_impls.carbon:[[@LINE+16]]:12 +// CHECK:STDERR: -> │ final impl invalid as I {} +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: name `invalid` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_conflicting_bad_impls.carbon:[[@LINE+3]]:1-25: error: redefinition of `impl as I` [ImplRedefinition] -// CHECK:STDERR: fail_conflicting_bad_impls.carbon:[[@LINE-4]]:1-25: note: previous definition was here [ImplPreviousDefinition] +// CHECK:STDERR: ╭─┤ fail_conflicting_bad_impls.carbon:[[@LINE+10]]:1 +// CHECK:STDERR: │ final impl invalid as I {} +// CHECK:STDERR: · ────────────┬──────────── +// CHECK:STDERR: · ╰──┤ previous definition was here [ImplPreviousDefinition] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ final impl invalid as I {} +// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redefinition of `impl as I` [ImplRedefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: final impl invalid as I {} -// CHECK:STDERR: fail_conflicting_bad_impls.carbon:[[@LINE+2]]:12-22: error: name `alsoinvalid` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_conflicting_bad_impls.carbon:[[@LINE+6]]:12 +// CHECK:STDERR: -> │ final impl alsoinvalid as I {} +// CHECK:STDERR: · ━━━━━┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: name `alsoinvalid` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: final impl alsoinvalid as I {} -// CHECK:STDERR: fail_conflicting_bad_impls.carbon:[[@LINE+2]]:14-20: error: name `invalid` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_conflicting_bad_impls.carbon:[[@LINE+6]]:14 +// CHECK:STDERR: -> │ final impl C(invalid) as I {} +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: name `invalid` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: final impl C(invalid) as I {} -// CHECK:STDERR: fail_conflicting_bad_impls.carbon:[[@LINE+5]]:14-20: error: name `invalid` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_conflicting_bad_impls.carbon:[[@LINE+16]]:14 +// CHECK:STDERR: -> │ final impl C(invalid) as I {} +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: name `invalid` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_conflicting_bad_impls.carbon:[[@LINE+3]]:1-28: error: redefinition of `impl as I` [ImplRedefinition] -// CHECK:STDERR: fail_conflicting_bad_impls.carbon:[[@LINE-4]]:1-28: note: previous definition was here [ImplPreviousDefinition] +// CHECK:STDERR: ╭─┤ fail_conflicting_bad_impls.carbon:[[@LINE+10]]:1 +// CHECK:STDERR: │ final impl C(invalid) as I {} +// CHECK:STDERR: · ──────────────┬───────────── +// CHECK:STDERR: · ╰──┤ previous definition was here [ImplPreviousDefinition] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ final impl C(invalid) as I {} +// CHECK:STDERR: · ━━━━━━━━━━━━━━┳━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redefinition of `impl as I` [ImplRedefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: final impl C(invalid) as I {} diff --git a/toolchain/check/testdata/impl/compound.carbon b/toolchain/check/testdata/impl/compound.carbon index 63c3b6aaebc7..d562e0b25143 100644 --- a/toolchain/check/testdata/impl/compound.carbon +++ b/toolchain/check/testdata/impl/compound.carbon @@ -48,8 +48,16 @@ impl {.b: ()} as NonInstance2 { } fn NonInstanceCall2(n: {.b: ()}) { - // CHECK:STDERR: fail_non-instance.carbon:[[@LINE+3]]:3-21: error: cannot implicitly convert non-type value of type `{.b: ()}` into type implementing `NonInstance2` [ConversionFailureNonTypeToFacet] - // CHECK:STDERR: fail_non-instance.carbon:[[@LINE+2]]:3-21: note: type `{.b: ()}` does not implement interface `Core.ImplicitAs(NonInstance2)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_non-instance.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: -> │ n.(NonInstance2.F2)(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert non-type value of type `{.b: ()}` into + // CHECK:STDERR: · │ ┃ type implementing `NonInstance2` + // CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: · ╰────┤ type `{.b: ()}` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(NonInstance2)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: n.(NonInstance2.F2)(); } @@ -68,8 +76,16 @@ impl {.c: ()} as NonInstance3 { } fn NonInstanceCallIndirect(p: {.c: ()}*) { - // CHECK:STDERR: fail_non-instance_indirect.carbon:[[@LINE+3]]:3-22: error: cannot implicitly convert non-type value of type `{.c: ()}` into type implementing `NonInstance3` [ConversionFailureNonTypeToFacet] - // CHECK:STDERR: fail_non-instance_indirect.carbon:[[@LINE+2]]:3-22: note: type `{.c: ()}` does not implement interface `Core.ImplicitAs(NonInstance3)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_non-instance_indirect.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: -> │ p->(NonInstance3.F3)(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert non-type value of type `{.c: ()}` into + // CHECK:STDERR: · │ ┃ type implementing `NonInstance3` + // CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: · ╰────┤ type `{.c: ()}` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(NonInstance3)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: p->(NonInstance3.F3)(); } @@ -105,7 +121,13 @@ impl {.e: ()} as Instance2 { } fn InstanceCallFail() { - // CHECK:STDERR: fail_instance.carbon:[[@LINE+2]]:3-25: error: cannot access member of interface `Instance2` in type `type` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_instance.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ {.e: ()}.(Instance2.G2)(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Instance2` in type `type` that + // CHECK:STDERR: · ┃ does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: {.e: ()}.(Instance2.G2)(); } @@ -500,7 +522,7 @@ fn InstanceCallFail() { // CHECK:STDOUT: %n.ref: %struct_type.b = name_ref n, %n // CHECK:STDOUT: %NonInstance2.ref: type = name_ref NonInstance2, file.%NonInstance2.decl [concrete = constants.%NonInstance2.type] // CHECK:STDOUT: %F2.ref: %NonInstance2.assoc_type = name_ref F2, @NonInstance2.WithSelf.%assoc0 [concrete = constants.%assoc0.d17] -// CHECK:STDOUT: %.loc17: %NonInstance2.type = converted %n.ref, [concrete = ] +// CHECK:STDOUT: %.loc25: %NonInstance2.type = converted %n.ref, [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -737,8 +759,8 @@ fn InstanceCallFail() { // CHECK:STDOUT: %p.ref: %ptr = name_ref p, %p // CHECK:STDOUT: %NonInstance3.ref: type = name_ref NonInstance3, file.%NonInstance3.decl [concrete = constants.%NonInstance3.type] // CHECK:STDOUT: %F3.ref: %NonInstance3.assoc_type = name_ref F3, @NonInstance3.WithSelf.%assoc0 [concrete = constants.%assoc0.4a8] -// CHECK:STDOUT: %.loc17_4.1: ref %struct_type.c = deref %p.ref -// CHECK:STDOUT: %.loc17_4.2: %NonInstance3.type = converted %.loc17_4.1, [concrete = ] +// CHECK:STDOUT: %.loc25_4.1: ref %struct_type.c = deref %p.ref +// CHECK:STDOUT: %.loc25_4.2: %NonInstance3.type = converted %.loc25_4.1, [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1126,8 +1148,8 @@ fn InstanceCallFail() { // CHECK:STDOUT: // CHECK:STDOUT: fn @InstanceCallFail() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc14_9.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc14_9.2: type = converted %.loc14_9.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc20_9.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc20_9.2: type = converted %.loc20_9.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: %struct_type.e: type = struct_type {.e: %empty_tuple.type} [concrete = constants.%struct_type.e] // CHECK:STDOUT: %Instance2.ref: type = name_ref Instance2, file.%Instance2.decl [concrete = constants.%Instance2.type] // CHECK:STDOUT: %G2.ref: %Instance2.assoc_type = name_ref G2, @Instance2.WithSelf.%assoc0 [concrete = constants.%assoc0] diff --git a/toolchain/check/testdata/impl/custom_witness/destroy.carbon b/toolchain/check/testdata/impl/custom_witness/destroy.carbon index eeb8ce468a75..486b38a617aa 100644 --- a/toolchain/check/testdata/impl/custom_witness/destroy.carbon +++ b/toolchain/check/testdata/impl/custom_witness/destroy.carbon @@ -71,7 +71,12 @@ class C(T: type); fn F() { // This looks for a Destroy witness for an incomplete class type. - // CHECK:STDERR: fail_destroy_incomplete_class.carbon:[[@LINE+2]]:3-23: error: cannot convert type `C({})` into type implementing `Core.Destroy` [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╭─┤ fail_destroy_incomplete_class.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ C({}) as Core.Destroy; + // CHECK:STDERR: · ━┳━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `C({})` into type implementing `Core.Destroy` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: C({}) as Core.Destroy; } diff --git a/toolchain/check/testdata/impl/custom_witness/fail_todo_require_impls_for_impl_in_class.carbon b/toolchain/check/testdata/impl/custom_witness/fail_todo_require_impls_for_impl_in_class.carbon index f5c9de50517c..5c607d053ca9 100644 --- a/toolchain/check/testdata/impl/custom_witness/fail_todo_require_impls_for_impl_in_class.carbon +++ b/toolchain/check/testdata/impl/custom_witness/fail_todo_require_impls_for_impl_in_class.carbon @@ -33,7 +33,13 @@ impl forall [T: SubobjectDestroy] T as DestroyImpl { import Core library "prelude/destroy"; class NonTrivialDestroy { - // CHECK:STDERR: fail_todo_require_impls_for_impl_in_class.carbon:[[@LINE+2]]:3-28: error: interface `DestroyImpl` being implemented requires that `NonTrivialDestroy` implements `Core.SubobjectDestroy` [InterfaceRequireImplsNotImplemented] + // CHECK:STDERR: ╭─┤ fail_todo_require_impls_for_impl_in_class.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ impl as Core.DestroyImpl { + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: interface `DestroyImpl` being implemented requires that + // CHECK:STDERR: · ┃ `NonTrivialDestroy` implements `Core.SubobjectDestroy` + // CHECK:STDERR: · ┃ [InterfaceRequireImplsNotImplemented] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl as Core.DestroyImpl { fn Op(unused ref self) {} diff --git a/toolchain/check/testdata/impl/custom_witness/float_fits_in.carbon b/toolchain/check/testdata/impl/custom_witness/float_fits_in.carbon index 5e32d33bc652..59de1168cb1a 100644 --- a/toolchain/check/testdata/impl/custom_witness/float_fits_in.carbon +++ b/toolchain/check/testdata/impl/custom_witness/float_fits_in.carbon @@ -42,12 +42,34 @@ library "[[@TEST_NAME]]"; import Core; fn CheckFail() { - // CHECK:STDERR: fail_narrowing.carbon:[[@LINE+3]]:3-42: error: cannot convert type `f64` into type implementing `Core.FloatFitsIn(f32)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: core.carbon:6:1-70: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_narrowing.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: -> │ Core.CheckFitsIn(1.0 as f64, 2.0 as f32); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `f64` into type implementing + // CHECK:STDERR: · ┃ `Core.FloatFitsIn(f32)` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ core.carbon + // CHECK:STDERR: │ fn CheckFitsIn[U: type, T: FloatFitsIn(U)](unused t: T, unused u: U) {} + // CHECK:STDERR: · ─────────────────────────┬──────────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Core.CheckFitsIn(1.0 as f64, 2.0 as f32); - // CHECK:STDERR: fail_narrowing.carbon:[[@LINE+3]]:3-42: error: cannot convert type `f32` into type implementing `Core.FloatFitsIn(f16)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: core.carbon:6:1-70: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_narrowing.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: -> │ Core.CheckFitsIn(1.0 as f32, 2.0 as f16); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `f32` into type implementing + // CHECK:STDERR: · ┃ `Core.FloatFitsIn(f16)` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ core.carbon + // CHECK:STDERR: │ fn CheckFitsIn[U: type, T: FloatFitsIn(U)](unused t: T, unused u: U) {} + // CHECK:STDERR: · ─────────────────────────┬──────────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Core.CheckFitsIn(1.0 as f32, 2.0 as f16); } diff --git a/toolchain/check/testdata/impl/custom_witness/int_fits_in.carbon b/toolchain/check/testdata/impl/custom_witness/int_fits_in.carbon index 6997efacbea6..b88955172f9f 100644 --- a/toolchain/check/testdata/impl/custom_witness/int_fits_in.carbon +++ b/toolchain/check/testdata/impl/custom_witness/int_fits_in.carbon @@ -42,20 +42,64 @@ library "[[@TEST_NAME]]"; import Core; fn CheckFail() { - // CHECK:STDERR: fail_narrowing.carbon:[[@LINE+3]]:3-38: error: cannot convert type `i64` into type implementing `Core.IntFitsIn(i32)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: core.carbon:6:1-68: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_narrowing.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: -> │ Core.CheckFitsIn(1 as i64, 2 as i32); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `i64` into type implementing + // CHECK:STDERR: · ┃ `Core.IntFitsIn(i32)` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ core.carbon + // CHECK:STDERR: │ fn CheckFitsIn[U: type, T: IntFitsIn(U)](unused t: T, unused u: U) {} + // CHECK:STDERR: · ─────────────────────────┬────────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Core.CheckFitsIn(1 as i64, 2 as i32); - // CHECK:STDERR: fail_narrowing.carbon:[[@LINE+3]]:3-38: error: cannot convert type `i64` into type implementing `Core.IntFitsIn(u32)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: core.carbon:6:1-68: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_narrowing.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: -> │ Core.CheckFitsIn(1 as i64, 2 as u32); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `i64` into type implementing + // CHECK:STDERR: · ┃ `Core.IntFitsIn(u32)` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ core.carbon + // CHECK:STDERR: │ fn CheckFitsIn[U: type, T: IntFitsIn(U)](unused t: T, unused u: U) {} + // CHECK:STDERR: · ─────────────────────────┬────────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Core.CheckFitsIn(1 as i64, 2 as u32); - // CHECK:STDERR: fail_narrowing.carbon:[[@LINE+3]]:3-38: error: cannot convert type `u64` into type implementing `Core.IntFitsIn(i32)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: core.carbon:6:1-68: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_narrowing.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: -> │ Core.CheckFitsIn(1 as u64, 2 as i32); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `u64` into type implementing + // CHECK:STDERR: · ┃ `Core.IntFitsIn(i32)` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ core.carbon + // CHECK:STDERR: │ fn CheckFitsIn[U: type, T: IntFitsIn(U)](unused t: T, unused u: U) {} + // CHECK:STDERR: · ─────────────────────────┬────────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Core.CheckFitsIn(1 as u64, 2 as i32); - // CHECK:STDERR: fail_narrowing.carbon:[[@LINE+3]]:3-38: error: cannot convert type `u64` into type implementing `Core.IntFitsIn(u32)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: core.carbon:6:1-68: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_narrowing.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: -> │ Core.CheckFitsIn(1 as u64, 2 as u32); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `u64` into type implementing + // CHECK:STDERR: · ┃ `Core.IntFitsIn(u32)` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ core.carbon + // CHECK:STDERR: │ fn CheckFitsIn[U: type, T: IntFitsIn(U)](unused t: T, unused u: U) {} + // CHECK:STDERR: · ─────────────────────────┬────────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Core.CheckFitsIn(1 as u64, 2 as u32); } @@ -67,12 +111,34 @@ library "[[@TEST_NAME]]"; import Core; fn CheckFail() { - // CHECK:STDERR: fail_same_size_sign_change.carbon:[[@LINE+3]]:3-38: error: cannot convert type `u32` into type implementing `Core.IntFitsIn(i32)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: core.carbon:6:1-68: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_same_size_sign_change.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: -> │ Core.CheckFitsIn(1 as u32, 2 as i32); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `u32` into type implementing + // CHECK:STDERR: · ┃ `Core.IntFitsIn(i32)` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ core.carbon + // CHECK:STDERR: │ fn CheckFitsIn[U: type, T: IntFitsIn(U)](unused t: T, unused u: U) {} + // CHECK:STDERR: · ─────────────────────────┬────────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Core.CheckFitsIn(1 as u32, 2 as i32); - // CHECK:STDERR: fail_same_size_sign_change.carbon:[[@LINE+3]]:3-38: error: cannot convert type `i32` into type implementing `Core.IntFitsIn(u32)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: core.carbon:6:1-68: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_same_size_sign_change.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: -> │ Core.CheckFitsIn(1 as i32, 2 as u32); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `i32` into type implementing + // CHECK:STDERR: · ┃ `Core.IntFitsIn(u32)` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ core.carbon + // CHECK:STDERR: │ fn CheckFitsIn[U: type, T: IntFitsIn(U)](unused t: T, unused u: U) {} + // CHECK:STDERR: · ─────────────────────────┬────────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Core.CheckFitsIn(1 as i32, 2 as u32); } @@ -84,8 +150,19 @@ library "[[@TEST_NAME]]"; import Core; fn CheckFail() { - // CHECK:STDERR: fail_signed_to_wider_unsigned.carbon:[[@LINE+3]]:3-38: error: cannot convert type `i32` into type implementing `Core.IntFitsIn(u32)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: core.carbon:6:1-68: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_signed_to_wider_unsigned.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: -> │ Core.CheckFitsIn(1 as i32, 2 as u32); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `i32` into type implementing + // CHECK:STDERR: · ┃ `Core.IntFitsIn(u32)` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ core.carbon + // CHECK:STDERR: │ fn CheckFitsIn[U: type, T: IntFitsIn(U)](unused t: T, unused u: U) {} + // CHECK:STDERR: · ─────────────────────────┬────────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Core.CheckFitsIn(1 as i32, 2 as u32); } diff --git a/toolchain/check/testdata/impl/error_recovery.carbon b/toolchain/check/testdata/impl/error_recovery.carbon index cfb3579acf25..c2382f845259 100644 --- a/toolchain/check/testdata/impl/error_recovery.carbon +++ b/toolchain/check/testdata/impl/error_recovery.carbon @@ -17,7 +17,12 @@ class C {} interface I {} //@dump-sem-ir-begin -// CHECK:STDERR: fail_runtime_generic_param.carbon:[[@LINE+2]]:14-28: error: parameters of generic types must be constant [GenericParamMustBeConstant] +// CHECK:STDERR: ╭─┤ fail_runtime_generic_param.carbon:[[@LINE+7]]:14 +// CHECK:STDERR: -> │ impl forall [runtime T: type] C as I {} +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: parameters of generic types must be constant +// CHECK:STDERR: · ┃ [GenericParamMustBeConstant] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [runtime T: type] C as I {} //@dump-sem-ir-end @@ -26,7 +31,11 @@ impl forall [runtime T: type] C as I {} library "[[@TEST_NAME]]"; interface Z {} -// CHECK:STDERR: fail_nonfinal_lookup_impl_witness_error_in_import.carbon:[[@LINE+2]]:1-29: error: impl declared but not defined [ImplMissingDefinition] +// CHECK:STDERR: ╭─┤ fail_nonfinal_lookup_impl_witness_error_in_import.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ impl forall [T: type] T as Z; +// CHECK:STDERR: · ━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: impl declared but not defined [ImplMissingDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [T: type] T as Z; @@ -56,7 +65,11 @@ fn H() { library "[[@TEST_NAME]]"; interface Z {} -// CHECK:STDERR: fail_nonfinal_lookup_impl_witness_error.carbon:[[@LINE+2]]:1-29: error: impl declared but not defined [ImplMissingDefinition] +// CHECK:STDERR: ╭─┤ fail_nonfinal_lookup_impl_witness_error.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ impl forall [T: type] T as Z; +// CHECK:STDERR: · ━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: impl declared but not defined [ImplMissingDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [T: type] T as Z; @@ -83,7 +96,11 @@ fn H() { library "[[@TEST_NAME]]"; interface Z {} -// CHECK:STDERR: fail_final_lookup_impl_witness_error.carbon:[[@LINE+2]]:1-29: error: impl declared but not defined [ImplMissingDefinition] +// CHECK:STDERR: ╭─┤ fail_final_lookup_impl_witness_error.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ impl forall [T: type] T as Z; +// CHECK:STDERR: · ━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: impl declared but not defined [ImplMissingDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [T: type] T as Z; @@ -110,11 +127,24 @@ class C {}; //@dump-sem-ir-begin impl C as I { // This leaves the impl with a placeholder instruction in the witness table. - // CHECK:STDERR: fail_invalid_fn_syntax_in_impl.carbon:[[@LINE+6]]:9: error: name `x` not found [NameNotFound] + // CHECK:STDERR: ╭─┤ fail_invalid_fn_syntax_in_impl.carbon:[[@LINE+19]]:9 + // CHECK:STDERR: -> │ fn Op[x self: C]() {} + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: name `x` not found [NameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_invalid_fn_syntax_in_impl.carbon:[[@LINE+4]]:10: error: expected `,` or `]` [UnexpectedTokenAfterListElement] + // CHECK:STDERR: ╭─┤ fail_invalid_fn_syntax_in_impl.carbon:[[@LINE+13]]:10 + // CHECK:STDERR: -> │ fn Op[x self: C]() {} + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `,` or `]` [UnexpectedTokenAfterListElement] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_invalid_fn_syntax_in_impl.carbon:[[@LINE+2]]:8-18: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_invalid_fn_syntax_in_impl.carbon:[[@LINE+7]]:8 + // CHECK:STDERR: -> │ fn Op[x self: C]() {} + // CHECK:STDERR: · ━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `handle invalid parse trees in `check`` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn Op[x self: C]() {} } @@ -135,7 +165,7 @@ impl C as I { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc9: = impl_self_witness @C.as.I.impl.%C.ref, @I [concrete = constants.%.b7f] +// CHECK:STDOUT: %.loc14: = impl_self_witness @C.as.I.impl.%C.ref, @I [concrete = constants.%.b7f] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @C.as.I.impl: %C.ref as %I.ref { @@ -168,40 +198,40 @@ impl C as I { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] { -// CHECK:STDOUT: %T.patt.loc11_15.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.patt.loc15_15.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc15_15.2 (constants.%T.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc11_17.1: type = splice_block %.loc11_17.2 [concrete = type] { +// CHECK:STDOUT: %.loc15_17.1: type = splice_block %.loc15_17.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc11_17.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc15_17.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc11_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc11_15.1 (constants.%T)] +// CHECK:STDOUT: %T.loc15_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc15_15.1 (constants.%T)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @G(%T.loc11_15.2: type) { -// CHECK:STDOUT: %T.patt.loc11_15.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_15.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc11_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc11_15.1 (constants.%T)] +// CHECK:STDOUT: generic fn @G(%T.loc15_15.2: type) { +// CHECK:STDOUT: %T.patt.loc15_15.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc15_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc15_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc15_15.1 (constants.%T)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Z.lookup_impl_witness: = lookup_impl_witness %T.loc11_15.1, @Z [symbolic = %Z.lookup_impl_witness (constants.%Z.lookup_impl_witness)] -// CHECK:STDOUT: %Z.facet.loc17_6.2: %Z.type = facet_value %T.loc11_15.1, (%Z.lookup_impl_witness) [symbolic = %Z.facet.loc17_6.2 (constants.%Z.facet)] -// CHECK:STDOUT: %F.specific_fn.loc17_3.2: = specific_function constants.%F, @F(%Z.facet.loc17_6.2) [symbolic = %F.specific_fn.loc17_3.2 (constants.%F.specific_fn)] +// CHECK:STDOUT: %Z.lookup_impl_witness: = lookup_impl_witness %T.loc15_15.1, @Z [symbolic = %Z.lookup_impl_witness (constants.%Z.lookup_impl_witness)] +// CHECK:STDOUT: %Z.facet.loc21_6.2: %Z.type = facet_value %T.loc15_15.1, (%Z.lookup_impl_witness) [symbolic = %Z.facet.loc21_6.2 (constants.%Z.facet)] +// CHECK:STDOUT: %F.specific_fn.loc21_3.2: = specific_function constants.%F, @F(%Z.facet.loc21_6.2) [symbolic = %F.specific_fn.loc21_3.2 (constants.%F.specific_fn)] // CHECK:STDOUT: // CHECK:STDOUT: fn() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc11_15.2 [symbolic = %T.loc11_15.1 (constants.%T)] -// CHECK:STDOUT: %Z.facet.loc17_6.1: %Z.type = facet_value %T.ref, (constants.%Z.lookup_impl_witness) [symbolic = %Z.facet.loc17_6.2 (constants.%Z.facet)] -// CHECK:STDOUT: %.loc17: %Z.type = converted %T.ref, %Z.facet.loc17_6.1 [symbolic = %Z.facet.loc17_6.2 (constants.%Z.facet)] -// CHECK:STDOUT: %F.specific_fn.loc17_3.1: = specific_function %F.ref, @F(constants.%Z.facet) [symbolic = %F.specific_fn.loc17_3.2 (constants.%F.specific_fn)] -// CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.specific_fn.loc17_3.1() +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc15_15.2 [symbolic = %T.loc15_15.1 (constants.%T)] +// CHECK:STDOUT: %Z.facet.loc21_6.1: %Z.type = facet_value %T.ref, (constants.%Z.lookup_impl_witness) [symbolic = %Z.facet.loc21_6.2 (constants.%Z.facet)] +// CHECK:STDOUT: %.loc21: %Z.type = converted %T.ref, %Z.facet.loc21_6.1 [symbolic = %Z.facet.loc21_6.2 (constants.%Z.facet)] +// CHECK:STDOUT: %F.specific_fn.loc21_3.1: = specific_function %F.ref, @F(constants.%Z.facet) [symbolic = %F.specific_fn.loc21_3.2 (constants.%F.specific_fn)] +// CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.specific_fn.loc21_3.1() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @G(constants.%T) { -// CHECK:STDOUT: %T.patt.loc11_15.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc11_15.1 => constants.%T +// CHECK:STDOUT: %T.patt.loc15_15.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc15_15.1 => constants.%T // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_nonfinal_lookup_impl_witness_error.carbon @@ -225,50 +255,50 @@ impl C as I { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] { -// CHECK:STDOUT: %T.patt.loc11_15.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.patt.loc15_15.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc15_15.2 (constants.%T.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc11_17.1: type = splice_block %.loc11_17.2 [concrete = type] { +// CHECK:STDOUT: %.loc15_17.1: type = splice_block %.loc15_17.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc11_17.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc15_17.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc11_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc11_15.1 (constants.%T)] +// CHECK:STDOUT: %T.loc15_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc15_15.1 (constants.%T)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @G(%T.loc11_15.2: type) { -// CHECK:STDOUT: %T.patt.loc11_15.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_15.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc11_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc11_15.1 (constants.%T)] +// CHECK:STDOUT: generic fn @G(%T.loc15_15.2: type) { +// CHECK:STDOUT: %T.patt.loc15_15.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc15_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc15_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc15_15.1 (constants.%T)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Z.lookup_impl_witness: = lookup_impl_witness %T.loc11_15.1, @Z [symbolic = %Z.lookup_impl_witness (constants.%Z.lookup_impl_witness)] -// CHECK:STDOUT: %Z.facet.loc17_6.2: %Z.type = facet_value %T.loc11_15.1, (%Z.lookup_impl_witness) [symbolic = %Z.facet.loc17_6.2 (constants.%Z.facet)] -// CHECK:STDOUT: %F.specific_fn.loc17_3.2: = specific_function constants.%F, @F(%Z.facet.loc17_6.2) [symbolic = %F.specific_fn.loc17_3.2 (constants.%F.specific_fn)] +// CHECK:STDOUT: %Z.lookup_impl_witness: = lookup_impl_witness %T.loc15_15.1, @Z [symbolic = %Z.lookup_impl_witness (constants.%Z.lookup_impl_witness)] +// CHECK:STDOUT: %Z.facet.loc21_6.2: %Z.type = facet_value %T.loc15_15.1, (%Z.lookup_impl_witness) [symbolic = %Z.facet.loc21_6.2 (constants.%Z.facet)] +// CHECK:STDOUT: %F.specific_fn.loc21_3.2: = specific_function constants.%F, @F(%Z.facet.loc21_6.2) [symbolic = %F.specific_fn.loc21_3.2 (constants.%F.specific_fn)] // CHECK:STDOUT: // CHECK:STDOUT: fn() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc11_15.2 [symbolic = %T.loc11_15.1 (constants.%T)] -// CHECK:STDOUT: %Z.facet.loc17_6.1: %Z.type = facet_value %T.ref, (constants.%Z.lookup_impl_witness) [symbolic = %Z.facet.loc17_6.2 (constants.%Z.facet)] -// CHECK:STDOUT: %.loc17: %Z.type = converted %T.ref, %Z.facet.loc17_6.1 [symbolic = %Z.facet.loc17_6.2 (constants.%Z.facet)] -// CHECK:STDOUT: %F.specific_fn.loc17_3.1: = specific_function %F.ref, @F(constants.%Z.facet) [symbolic = %F.specific_fn.loc17_3.2 (constants.%F.specific_fn)] -// CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.specific_fn.loc17_3.1() +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc15_15.2 [symbolic = %T.loc15_15.1 (constants.%T)] +// CHECK:STDOUT: %Z.facet.loc21_6.1: %Z.type = facet_value %T.ref, (constants.%Z.lookup_impl_witness) [symbolic = %Z.facet.loc21_6.2 (constants.%Z.facet)] +// CHECK:STDOUT: %.loc21: %Z.type = converted %T.ref, %Z.facet.loc21_6.1 [symbolic = %Z.facet.loc21_6.2 (constants.%Z.facet)] +// CHECK:STDOUT: %F.specific_fn.loc21_3.1: = specific_function %F.ref, @F(constants.%Z.facet) [symbolic = %F.specific_fn.loc21_3.2 (constants.%F.specific_fn)] +// CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.specific_fn.loc21_3.1() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @G(constants.%T) { -// CHECK:STDOUT: %T.patt.loc11_15.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc11_15.1 => constants.%T +// CHECK:STDOUT: %T.patt.loc15_15.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc15_15.1 => constants.%T // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @G(constants.%empty_tuple.type) { -// CHECK:STDOUT: %T.patt.loc11_15.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc11_15.1 => constants.%empty_tuple.type +// CHECK:STDOUT: %T.patt.loc15_15.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc15_15.1 => constants.%empty_tuple.type // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %Z.lookup_impl_witness => -// CHECK:STDOUT: %Z.facet.loc17_6.2 => -// CHECK:STDOUT: %F.specific_fn.loc17_3.2 => +// CHECK:STDOUT: %Z.facet.loc21_6.2 => +// CHECK:STDOUT: %F.specific_fn.loc21_3.2 => // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_final_lookup_impl_witness_error.carbon @@ -288,9 +318,9 @@ impl C as I { // CHECK:STDOUT: fn @G() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] -// CHECK:STDOUT: %.loc16_6: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc20_6: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] // CHECK:STDOUT: %Z.facet: %Z.type = facet_value constants.%empty_tuple.type, (constants.%Z.impl_witness.47a) [concrete = constants.%Z.facet] -// CHECK:STDOUT: %.loc16_7: %Z.type = converted %.loc16_6, %Z.facet [concrete = constants.%Z.facet] +// CHECK:STDOUT: %.loc20_7: %Z.type = converted %.loc20_6, %Z.facet [concrete = constants.%Z.facet] // CHECK:STDOUT: %F.specific_fn: = specific_function %F.ref, @F(constants.%Z.facet) [concrete = constants.%F.specific_fn] // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.specific_fn() // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/eval_musteval.carbon b/toolchain/check/testdata/impl/eval_musteval.carbon index be9185651b4e..612a2cecb650 100644 --- a/toolchain/check/testdata/impl/eval_musteval.carbon +++ b/toolchain/check/testdata/impl/eval_musteval.carbon @@ -77,13 +77,28 @@ impl A as MustEval { } fn Call() { - // CHECK:STDERR: fail_impl_runtime_eval.carbon:[[@LINE+2]]:17-39: error: cannot evaluate type expression [TypeExprEvaluationFailure] + // CHECK:STDERR: ╭─┤ fail_impl_runtime_eval.carbon:[[@LINE+7]]:17 + // CHECK:STDERR: -> │ let unused t: ({} as A).(Runtime.F)() = {} as A; + // CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot evaluate type expression + // CHECK:STDERR: · ┃ [TypeExprEvaluationFailure] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused t: ({} as A).(Runtime.F)() = {} as A; - // CHECK:STDERR: fail_impl_runtime_eval.carbon:[[@LINE+2]]:17-36: error: cannot evaluate type expression [TypeExprEvaluationFailure] + // CHECK:STDERR: ╭─┤ fail_impl_runtime_eval.carbon:[[@LINE+7]]:17 + // CHECK:STDERR: -> │ let unused u: ({} as A).(Eval.F)() = {} as A; + // CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot evaluate type expression + // CHECK:STDERR: · ┃ [TypeExprEvaluationFailure] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused u: ({} as A).(Eval.F)() = {} as A; - // CHECK:STDERR: fail_impl_runtime_eval.carbon:[[@LINE+2]]:17-40: error: cannot evaluate type expression [TypeExprEvaluationFailure] + // CHECK:STDERR: ╭─┤ fail_impl_runtime_eval.carbon:[[@LINE+7]]:17 + // CHECK:STDERR: -> │ let unused v: ({} as A).(MustEval.F)() = {} as A; + // CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot evaluate type expression + // CHECK:STDERR: · ┃ [TypeExprEvaluationFailure] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused v: ({} as A).(MustEval.F)() = {} as A; } @@ -136,7 +151,12 @@ impl B as Runtime { fn Call() { // TODO: Should we allow calling this at compile time? This is allowed if we // don't generate a thunk. - // CHECK:STDERR: fail_todo_impl_eval_from_runtime_thunk.carbon:[[@LINE+2]]:17-39: error: cannot evaluate type expression [TypeExprEvaluationFailure] + // CHECK:STDERR: ╭─┤ fail_todo_impl_eval_from_runtime_thunk.carbon:[[@LINE+7]]:17 + // CHECK:STDERR: -> │ let unused t: ({} as B).(Runtime.F)() = {} as B; + // CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot evaluate type expression + // CHECK:STDERR: · ┃ [TypeExprEvaluationFailure] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused t: ({} as B).(Runtime.F)() = {} as B; } @@ -150,17 +170,39 @@ import library "interface"; class B { adapt {}; } impl B as Runtime { - // CHECK:STDERR: fail_impl_musteval.carbon:[[@LINE+4]]:3-38: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] - // CHECK:STDERR: fail_impl_musteval.carbon:[[@LINE+3]]:3-38: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] - // CHECK:STDERR: interface.carbon:5:3-21: note: while building thunk to match the signature of this function [ThunkSignature] + // CHECK:STDERR: ╭─┤ fail_impl_musteval.carbon:[[@LINE+15]]:3 + // CHECK:STDERR: -> │ musteval fn F(unused self) -> type { return B; } + // CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: non-constant call to compile-time-only function + // CHECK:STDERR: · │ ┃ [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: · ╰────┤ compile-time-only function declared here + // CHECK:STDERR: · │ [CompTimeOnlyFunctionHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ interface.carbon + // CHECK:STDERR: │ fn F(self) -> type; + // CHECK:STDERR: · ─────────┬───────── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ╰──── // CHECK:STDERR: musteval fn F(unused self) -> type { return B; } } impl B as Eval { - // CHECK:STDERR: fail_impl_musteval.carbon:[[@LINE+4]]:3-38: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] - // CHECK:STDERR: fail_impl_musteval.carbon:[[@LINE+3]]:3-38: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] - // CHECK:STDERR: interface.carbon:9:3-26: note: while building thunk to match the signature of this function [ThunkSignature] + // CHECK:STDERR: ╭─┤ fail_impl_musteval.carbon:[[@LINE+15]]:3 + // CHECK:STDERR: -> │ musteval fn F(unused self) -> type { return B; } + // CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: non-constant call to compile-time-only function + // CHECK:STDERR: · │ ┃ [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: · ╰────┤ compile-time-only function declared here + // CHECK:STDERR: · │ [CompTimeOnlyFunctionHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ interface.carbon + // CHECK:STDERR: │ eval fn F(self) -> type; + // CHECK:STDERR: · ────────────┬─────────── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ╰──── // CHECK:STDERR: musteval fn F(unused self) -> type { return B; } } @@ -195,9 +237,20 @@ impl B as Core.ImplicitAs(BView) { } impl B as MustEval { - // CHECK:STDERR: fail_todo_impl_musteval_from_musteval_thunk.carbon:[[@LINE+4]]:3-45: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] - // CHECK:STDERR: fail_todo_impl_musteval_from_musteval_thunk.carbon:[[@LINE+3]]:3-45: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] - // CHECK:STDERR: interface.carbon:13:3-30: note: while building thunk to match the signature of this function [ThunkSignature] + // CHECK:STDERR: ╭─┤ fail_todo_impl_musteval_from_musteval_thunk.carbon:[[@LINE+15]]:3 + // CHECK:STDERR: -> │ musteval fn F(unused self: BView) -> type { return B; } + // CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: non-constant call to compile-time-only function + // CHECK:STDERR: · │ ┃ [NonConstantCallToCompTimeOnlyFunction] + // CHECK:STDERR: · ╰────┤ compile-time-only function declared here + // CHECK:STDERR: · │ [CompTimeOnlyFunctionHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ interface.carbon + // CHECK:STDERR: │ musteval fn F(self) -> type; + // CHECK:STDERR: · ─────────────┬────────────── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ╰──── // CHECK:STDERR: musteval fn F(unused self: BView) -> type { return B; } } diff --git a/toolchain/check/testdata/impl/extend_final.carbon b/toolchain/check/testdata/impl/extend_final.carbon index 8f7ce62fc31c..2cdce7766bc5 100644 --- a/toolchain/check/testdata/impl/extend_final.carbon +++ b/toolchain/check/testdata/impl/extend_final.carbon @@ -31,8 +31,13 @@ library "[[@TEST_NAME]]"; interface Z {} class C { - // CHECK:STDERR: fail_final_extend_impl.carbon:[[@LINE+3]]:9-14: error: `extend` must appear before `final` [ModifierMustAppearBefore] - // CHECK:STDERR: fail_final_extend_impl.carbon:[[@LINE+2]]:3-7: note: `final` previously appeared here [ModifierPrevious] + // CHECK:STDERR: ╭─┤ fail_final_extend_impl.carbon:[[@LINE+8]]:9 + // CHECK:STDERR: -> │ final extend impl as Z {} + // CHECK:STDERR: · ──┬── ━━━┳━━ + // CHECK:STDERR: · │ ┗━━┫ error: `extend` must appear before `final` + // CHECK:STDERR: · │ ┃ [ModifierMustAppearBefore] + // CHECK:STDERR: · ╰───────────┤ `final` previously appeared here [ModifierPrevious] + // CHECK:STDERR: ╰──── // CHECK:STDERR: final extend impl as Z {} } @@ -44,6 +49,11 @@ interface Z {} class C {} -// CHECK:STDERR: fail_final_extend_impl_outside_class.carbon:[[@LINE+2]]:1-26: error: `extend impl` can only be used in an interface or class [ExtendImplOutsideClass] +// CHECK:STDERR: ╭─┤ fail_final_extend_impl_outside_class.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ extend final impl C as Z {} +// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `extend impl` can only be used in an interface or class +// CHECK:STDERR: · ┃ [ExtendImplOutsideClass] +// CHECK:STDERR: ╰──── // CHECK:STDERR: extend final impl C as Z {} diff --git a/toolchain/check/testdata/impl/extend_impl.carbon b/toolchain/check/testdata/impl/extend_impl.carbon index 1e673bc2d9d5..e8cf93868ec9 100644 --- a/toolchain/check/testdata/impl/extend_impl.carbon +++ b/toolchain/check/testdata/impl/extend_impl.carbon @@ -38,7 +38,11 @@ library "[[@TEST_NAME]]"; interface I {} class C { - // CHECK:STDERR: fail_extend_impl_nonexistent.carbon:[[@LINE+2]]:15-25: error: name `nonexistent` not found [NameNotFound] + // CHECK:STDERR: ╭─┤ fail_extend_impl_nonexistent.carbon:[[@LINE+6]]:15 + // CHECK:STDERR: -> │ extend impl nonexistent as I {} + // CHECK:STDERR: · ━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: name `nonexistent` not found [NameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend impl nonexistent as I {} @@ -57,13 +61,22 @@ library "[[@TEST_NAME]]"; interface I {} class C { - // CHECK:STDERR: fail_impl_nonexistent.carbon:[[@LINE+2]]:8-18: error: name `nonexistent` not found [NameNotFound] + // CHECK:STDERR: ╭─┤ fail_impl_nonexistent.carbon:[[@LINE+6]]:8 + // CHECK:STDERR: -> │ impl nonexistent as I {} + // CHECK:STDERR: · ━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: name `nonexistent` not found [NameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl nonexistent as I {} fn F() { // The name lookup error still happens, since the `require` is not `extend`. - // CHECK:STDERR: fail_impl_nonexistent.carbon:[[@LINE+2]]:5-10: error: member name `A` not found in `C` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╭─┤ fail_impl_nonexistent.carbon:[[@LINE+7]]:5 + // CHECK:STDERR: -> │ Self.A; + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: member name `A` not found in `C` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Self.A; } @@ -76,7 +89,11 @@ library "[[@TEST_NAME]]"; interface I {} class C { - // CHECK:STDERR: fail_extend_impl_nonexistent_pointer.carbon:[[@LINE+2]]:15-25: error: name `nonexistent` not found [NameNotFound] + // CHECK:STDERR: ╭─┤ fail_extend_impl_nonexistent_pointer.carbon:[[@LINE+6]]:15 + // CHECK:STDERR: -> │ extend impl nonexistent* as I {} + // CHECK:STDERR: · ━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: name `nonexistent` not found [NameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend impl nonexistent* as I {} @@ -93,7 +110,11 @@ class C { library "[[@TEST_NAME]]"; interface I {} -// CHECK:STDERR: fail_extend_impl_nonexistent_outside_class.carbon:[[@LINE+2]]:13-23: error: name `nonexistent` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_extend_impl_nonexistent_outside_class.carbon:[[@LINE+6]]:13 +// CHECK:STDERR: -> │ extend impl nonexistent* as I {} +// CHECK:STDERR: · ━━━━━┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: name `nonexistent` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: extend impl nonexistent* as I {} diff --git a/toolchain/check/testdata/impl/fail_alias.carbon b/toolchain/check/testdata/impl/fail_alias.carbon index dd3aa122ba2f..6d7e0fe97910 100644 --- a/toolchain/check/testdata/impl/fail_alias.carbon +++ b/toolchain/check/testdata/impl/fail_alias.carbon @@ -20,8 +20,15 @@ alias AC = C; impl AC as AI {} -// CHECK:STDERR: fail_alias.carbon:[[@LINE+3]]:1-15: error: redefinition of `impl AC as AI` [ImplRedefinition] -// CHECK:STDERR: fail_alias.carbon:[[@LINE-3]]:1-15: note: previous definition was here [ImplPreviousDefinition] +// CHECK:STDERR: ╭─┤ fail_alias.carbon:[[@LINE+10]]:1 +// CHECK:STDERR: │ impl AC as AI {} +// CHECK:STDERR: · ───────┬─────── +// CHECK:STDERR: · ╰──┤ previous definition was here [ImplPreviousDefinition] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ impl AC as AI {} +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redefinition of `impl AC as AI` [ImplRedefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl AC as AI {} @@ -61,7 +68,7 @@ impl AC as AI {} // CHECK:STDOUT: %AC.ref: type = name_ref AC, file.%AC [concrete = constants.%C] // CHECK:STDOUT: %AI.ref: type = name_ref AI, file.%AI [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc26: = impl_self_witness @C.as.I.impl.e103db.2.%AC.ref, @I [concrete = constants.%.b7f] +// CHECK:STDOUT: %.loc33: = impl_self_witness @C.as.I.impl.e103db.2.%AC.ref, @I [concrete = constants.%.b7f] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { diff --git a/toolchain/check/testdata/impl/fail_call_invalid.carbon b/toolchain/check/testdata/impl/fail_call_invalid.carbon index da930a2f5075..5a44539e0bf0 100644 --- a/toolchain/check/testdata/impl/fail_call_invalid.carbon +++ b/toolchain/check/testdata/impl/fail_call_invalid.carbon @@ -17,7 +17,11 @@ interface Simple { } impl i32 as Simple { - // CHECK:STDERR: fail_call_invalid.carbon:[[@LINE+2]]:14-23: error: name `Undeclared` not found [NameNotFound] + // CHECK:STDERR: ╭─┤ fail_call_invalid.carbon:[[@LINE+6]]:14 + // CHECK:STDERR: -> │ fn G(self: Undeclared); + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: name `Undeclared` not found [NameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn G(self: Undeclared); } @@ -48,7 +52,7 @@ fn InstanceCall(n: i32) { // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] // CHECK:STDOUT: %.b0e: = impl_self_witness %i32, @Simple [concrete] // CHECK:STDOUT: %Simple.impl_witness: = impl_witness @i32.as.Simple.impl.%Simple.impl_witness_table [concrete] -// CHECK:STDOUT: %i32.as.Simple.impl.G.type.321a2c.1: type = fn_type @i32.as.Simple.impl.G.loc22_25.1 [concrete] +// CHECK:STDOUT: %i32.as.Simple.impl.G.type.321a2c.1: type = fn_type @i32.as.Simple.impl.G.loc26_25.1 [concrete] // CHECK:STDOUT: %i32.as.Simple.impl.G.d407b2.1: %i32.as.Simple.impl.G.type.321a2c.1 = struct_value () [concrete] // CHECK:STDOUT: %Simple.facet: %Simple.type = facet_value %i32, (%Simple.impl_witness) [concrete] // CHECK:STDOUT: %Simple.WithSelf.G.type.34c: type = fn_type @Simple.WithSelf.G, @Simple.WithSelf(%Simple.facet) [concrete] @@ -56,7 +60,7 @@ fn InstanceCall(n: i32) { // CHECK:STDOUT: %pattern_type.d94: type = pattern_type %i32 [concrete] // CHECK:STDOUT: %self.param_patt.f52: %pattern_type.d94 = value_param_pattern [concrete] // CHECK:STDOUT: %self.patt.835: %pattern_type.d94 = wrapper_binding_pattern self, %self.param_patt.f52 [concrete] -// CHECK:STDOUT: %i32.as.Simple.impl.G.type.321a2c.2: type = fn_type @i32.as.Simple.impl.G.loc22_25.2 [concrete] +// CHECK:STDOUT: %i32.as.Simple.impl.G.type.321a2c.2: type = fn_type @i32.as.Simple.impl.G.loc26_25.2 [concrete] // CHECK:STDOUT: %i32.as.Simple.impl.G.d407b2.2: %i32.as.Simple.impl.G.type.321a2c.2 = struct_value () [concrete] // CHECK:STDOUT: %n.param_patt: %pattern_type.d94 = value_param_pattern [concrete] // CHECK:STDOUT: %n.patt: %pattern_type.d94 = wrapper_binding_pattern n, %n.param_patt [concrete] @@ -127,7 +131,7 @@ fn InstanceCall(n: i32) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @i32.as.Simple.impl: %i32 as %Simple.ref { -// CHECK:STDOUT: %i32.as.Simple.impl.G.decl.loc22_25.1: %i32.as.Simple.impl.G.type.321a2c.1 = fn_decl @i32.as.Simple.impl.G.loc22_25.1 [concrete = constants.%i32.as.Simple.impl.G.d407b2.1] { +// CHECK:STDOUT: %i32.as.Simple.impl.G.decl.loc26_25.1: %i32.as.Simple.impl.G.type.321a2c.1 = fn_decl @i32.as.Simple.impl.G.loc26_25.1 [concrete = constants.%i32.as.Simple.impl.G.d407b2.1] { // CHECK:STDOUT: %self.param_patt: = value_param_pattern [concrete = ] // CHECK:STDOUT: %self.patt: = wrapper_binding_pattern self, %self.param_patt [concrete = ] // CHECK:STDOUT: } { @@ -135,19 +139,19 @@ fn InstanceCall(n: i32) { // CHECK:STDOUT: %Undeclared.ref: = name_ref Undeclared, [concrete = ] // CHECK:STDOUT: %self: = wrapper_binding self, [concrete = ] // CHECK:STDOUT: } -// CHECK:STDOUT: %i32.as.Simple.impl.G.decl.loc22_25.2: %i32.as.Simple.impl.G.type.321a2c.2 = fn_decl @i32.as.Simple.impl.G.loc22_25.2 [concrete = constants.%i32.as.Simple.impl.G.d407b2.2] { +// CHECK:STDOUT: %i32.as.Simple.impl.G.decl.loc26_25.2: %i32.as.Simple.impl.G.type.321a2c.2 = fn_decl @i32.as.Simple.impl.G.loc26_25.2 [concrete = constants.%i32.as.Simple.impl.G.d407b2.2] { // CHECK:STDOUT: %.1: %pattern_type.d94 = specific_constant constants.%self.param_patt.f52, @Simple.WithSelf.G(constants.%Simple.facet) [concrete = constants.%self.param_patt.f52] // CHECK:STDOUT: %self.patt: %pattern_type.d94 = wrapper_binding_pattern self, %.1 [concrete = constants.%self.patt.835] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: %i32 = value_param call_param0 // CHECK:STDOUT: %self: %i32 = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %Simple.impl_witness_table = impl_witness_table (%i32.as.Simple.impl.G.decl.loc22_25.2), @i32.as.Simple.impl [concrete] +// CHECK:STDOUT: %Simple.impl_witness_table = impl_witness_table (%i32.as.Simple.impl.G.decl.loc26_25.2), @i32.as.Simple.impl [concrete] // CHECK:STDOUT: %Simple.impl_witness: = impl_witness %Simple.impl_witness_table [concrete = constants.%Simple.impl_witness] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Undeclared = -// CHECK:STDOUT: .G = %i32.as.Simple.impl.G.decl.loc22_25.1 +// CHECK:STDOUT: .G = %i32.as.Simple.impl.G.decl.loc26_25.1 // CHECK:STDOUT: extend %Simple.ref // CHECK:STDOUT: witness = %Simple.impl_witness // CHECK:STDOUT: } @@ -162,11 +166,11 @@ fn InstanceCall(n: i32) { // CHECK:STDOUT: fn(%self.param: @Simple.WithSelf.G.%Self.as_type.loc16_8.1 (%Self.as_type)); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @i32.as.Simple.impl.G.loc22_25.1(%self.param: ); +// CHECK:STDOUT: fn @i32.as.Simple.impl.G.loc26_25.1(%self.param: ); // CHECK:STDOUT: -// CHECK:STDOUT: fn @i32.as.Simple.impl.G.loc22_25.2(%self.param: %i32) [thunk @i32.as.Simple.impl.%i32.as.Simple.impl.G.decl.loc22_25.1 for @Simple.WithSelf.%Simple.WithSelf.G.decl, @Simple.WithSelf.G(constants.%Simple.facet)] { +// CHECK:STDOUT: fn @i32.as.Simple.impl.G.loc26_25.2(%self.param: %i32) [thunk @i32.as.Simple.impl.%i32.as.Simple.impl.G.decl.loc26_25.1 for @Simple.WithSelf.%Simple.WithSelf.G.decl, @Simple.WithSelf.G(constants.%Simple.facet)] { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %G.ref: %i32.as.Simple.impl.G.type.321a2c.1 = name_ref G, @i32.as.Simple.impl.%i32.as.Simple.impl.G.decl.loc22_25.1 [concrete = constants.%i32.as.Simple.impl.G.d407b2.1] +// CHECK:STDOUT: %G.ref: %i32.as.Simple.impl.G.type.321a2c.1 = name_ref G, @i32.as.Simple.impl.%i32.as.Simple.impl.G.decl.loc26_25.1 [concrete = constants.%i32.as.Simple.impl.G.d407b2.1] // CHECK:STDOUT: %i32.as.Simple.impl.G.bound: = bound_method %self.param, %G.ref // CHECK:STDOUT: %i32.as.Simple.impl.G.call: init %empty_tuple.type = call %i32.as.Simple.impl.G.bound() // CHECK:STDOUT: return @@ -176,11 +180,11 @@ fn InstanceCall(n: i32) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %n.ref: %i32 = name_ref n, %n // CHECK:STDOUT: %Simple.ref: type = name_ref Simple, file.%Simple.decl [concrete = constants.%Simple.type] -// CHECK:STDOUT: %G.ref.loc26_12: %Simple.assoc_type = name_ref G, @Simple.WithSelf.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: %G.ref.loc30_12: %Simple.assoc_type = name_ref G, @Simple.WithSelf.%assoc0 [concrete = constants.%assoc0] // CHECK:STDOUT: %impl.elem0: %.20e = impl_witness_access constants.%Simple.impl_witness, element0 [concrete = constants.%i32.as.Simple.impl.G.d407b2.2] // CHECK:STDOUT: %bound_method: = bound_method %n.ref, %impl.elem0 -// CHECK:STDOUT: %G.ref.loc26_16: %i32.as.Simple.impl.G.type.321a2c.1 = name_ref G, @i32.as.Simple.impl.%i32.as.Simple.impl.G.decl.loc22_25.1 [concrete = constants.%i32.as.Simple.impl.G.d407b2.1] -// CHECK:STDOUT: %i32.as.Simple.impl.G.bound: = bound_method %n.ref, %G.ref.loc26_16 +// CHECK:STDOUT: %G.ref.loc30_16: %i32.as.Simple.impl.G.type.321a2c.1 = name_ref G, @i32.as.Simple.impl.%i32.as.Simple.impl.G.decl.loc26_25.1 [concrete = constants.%i32.as.Simple.impl.G.d407b2.1] +// CHECK:STDOUT: %i32.as.Simple.impl.G.bound: = bound_method %n.ref, %G.ref.loc30_16 // CHECK:STDOUT: %i32.as.Simple.impl.G.call: init %empty_tuple.type = call %i32.as.Simple.impl.G.bound() // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/impl/fail_extend_impl_forall.carbon b/toolchain/check/testdata/impl/fail_extend_impl_forall.carbon index 9043bdd381a8..88fa8b0c5134 100644 --- a/toolchain/check/testdata/impl/fail_extend_impl_forall.carbon +++ b/toolchain/check/testdata/impl/fail_extend_impl_forall.carbon @@ -17,7 +17,11 @@ interface GenericInterface(T: type) { } class C { - // CHECK:STDERR: fail_extend_impl_forall.carbon:[[@LINE+2]]:3-8: error: cannot `extend` a parameterized `impl` [ExtendImplForall] + // CHECK:STDERR: ╭─┤ fail_extend_impl_forall.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ extend impl forall [T: type] as GenericInterface(T) { + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: cannot `extend` a parameterized `impl` [ExtendImplForall] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend impl forall [T: type] as GenericInterface(T) { fn F(unused x: T) {} @@ -107,55 +111,55 @@ class C { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic impl @C.as.GenericInterface.impl(%T.loc22_24.2: type) { -// CHECK:STDOUT: %T.patt.loc22_24.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc22_24.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc22_24.1: type = symbolic_binding T, 0 [symbolic = %T.loc22_24.1 (constants.%T)] -// CHECK:STDOUT: %GenericInterface.type.loc22_53.1: type = facet_type <@GenericInterface, @GenericInterface(%T.loc22_24.1)> [symbolic = %GenericInterface.type.loc22_53.1 (constants.%GenericInterface.type.076)] -// CHECK:STDOUT: %.loc22_55: = impl_self_witness constants.%C, @GenericInterface, @GenericInterface(%T.loc22_24.1) [symbolic = %.loc22_55 (constants.%.c61)] -// CHECK:STDOUT: %GenericInterface.impl_witness.loc22_55.2: = impl_witness %GenericInterface.impl_witness_table, @C.as.GenericInterface.impl(%T.loc22_24.1) [symbolic = %GenericInterface.impl_witness.loc22_55.2 (constants.%GenericInterface.impl_witness)] +// CHECK:STDOUT: generic impl @C.as.GenericInterface.impl(%T.loc26_24.2: type) { +// CHECK:STDOUT: %T.patt.loc26_24.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc26_24.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc26_24.1: type = symbolic_binding T, 0 [symbolic = %T.loc26_24.1 (constants.%T)] +// CHECK:STDOUT: %GenericInterface.type.loc26_53.1: type = facet_type <@GenericInterface, @GenericInterface(%T.loc26_24.1)> [symbolic = %GenericInterface.type.loc26_53.1 (constants.%GenericInterface.type.076)] +// CHECK:STDOUT: %.loc26_55: = impl_self_witness constants.%C, @GenericInterface, @GenericInterface(%T.loc26_24.1) [symbolic = %.loc26_55 (constants.%.c61)] +// CHECK:STDOUT: %GenericInterface.impl_witness.loc26_55.2: = impl_witness %GenericInterface.impl_witness_table, @C.as.GenericInterface.impl(%T.loc26_24.1) [symbolic = %GenericInterface.impl_witness.loc26_55.2 (constants.%GenericInterface.impl_witness)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %C.as.GenericInterface.impl.F.type: type = fn_type @C.as.GenericInterface.impl.F, @C.as.GenericInterface.impl(%T.loc22_24.1) [symbolic = %C.as.GenericInterface.impl.F.type (constants.%C.as.GenericInterface.impl.F.type)] +// CHECK:STDOUT: %C.as.GenericInterface.impl.F.type: type = fn_type @C.as.GenericInterface.impl.F, @C.as.GenericInterface.impl(%T.loc26_24.1) [symbolic = %C.as.GenericInterface.impl.F.type (constants.%C.as.GenericInterface.impl.F.type)] // CHECK:STDOUT: %C.as.GenericInterface.impl.F: @C.as.GenericInterface.impl.%C.as.GenericInterface.impl.F.type (%C.as.GenericInterface.impl.F.type) = struct_value () [symbolic = %C.as.GenericInterface.impl.F (constants.%C.as.GenericInterface.impl.F)] // CHECK:STDOUT: -// CHECK:STDOUT: impl: %Self.ref as %GenericInterface.type.loc22_53.2 { +// CHECK:STDOUT: impl: %Self.ref as %GenericInterface.type.loc26_53.2 { // CHECK:STDOUT: %C.as.GenericInterface.impl.F.decl: @C.as.GenericInterface.impl.%C.as.GenericInterface.impl.F.type (%C.as.GenericInterface.impl.F.type) = fn_decl @C.as.GenericInterface.impl.F [symbolic = @C.as.GenericInterface.impl.%C.as.GenericInterface.impl.F (constants.%C.as.GenericInterface.impl.F)] { -// CHECK:STDOUT: %x.param_patt.loc23_18.1: @C.as.GenericInterface.impl.F.%pattern_type (%pattern_type.51d) = value_param_pattern [symbolic = %x.param_patt.loc23_18.2 (constants.%x.param_patt)] -// CHECK:STDOUT: %x.patt.loc23_18.1: @C.as.GenericInterface.impl.F.%pattern_type (%pattern_type.51d) = wrapper_binding_pattern x, %x.param_patt.loc23_18.1 [symbolic = %x.patt.loc23_18.2 (constants.%x.patt)] +// CHECK:STDOUT: %x.param_patt.loc27_18.1: @C.as.GenericInterface.impl.F.%pattern_type (%pattern_type.51d) = value_param_pattern [symbolic = %x.param_patt.loc27_18.2 (constants.%x.param_patt)] +// CHECK:STDOUT: %x.patt.loc27_18.1: @C.as.GenericInterface.impl.F.%pattern_type (%pattern_type.51d) = wrapper_binding_pattern x, %x.param_patt.loc27_18.1 [symbolic = %x.patt.loc27_18.2 (constants.%x.patt)] // CHECK:STDOUT: } { // CHECK:STDOUT: %x.param: @C.as.GenericInterface.impl.F.%T (%T) = value_param call_param0 -// CHECK:STDOUT: %.loc23_20.1: type = splice_block %T.ref [symbolic = %T (constants.%T)] { -// CHECK:STDOUT: %.loc23_20.2: type = specific_constant @C.as.GenericInterface.impl.%T.loc22_24.2, @C.as.GenericInterface.impl(constants.%T) [symbolic = %T (constants.%T)] -// CHECK:STDOUT: %T.ref: type = name_ref T, %.loc23_20.2 [symbolic = %T (constants.%T)] +// CHECK:STDOUT: %.loc27_20.1: type = splice_block %T.ref [symbolic = %T (constants.%T)] { +// CHECK:STDOUT: %.loc27_20.2: type = specific_constant @C.as.GenericInterface.impl.%T.loc26_24.2, @C.as.GenericInterface.impl(constants.%T) [symbolic = %T (constants.%T)] +// CHECK:STDOUT: %T.ref: type = name_ref T, %.loc27_20.2 [symbolic = %T (constants.%T)] // CHECK:STDOUT: } // CHECK:STDOUT: %x: @C.as.GenericInterface.impl.F.%T (%T) = wrapper_binding x, %x.param // CHECK:STDOUT: } // CHECK:STDOUT: %GenericInterface.impl_witness_table = impl_witness_table (), @C.as.GenericInterface.impl [concrete] -// CHECK:STDOUT: %GenericInterface.impl_witness.loc22_55.1: = impl_witness %GenericInterface.impl_witness_table, @C.as.GenericInterface.impl(constants.%T) [symbolic = %GenericInterface.impl_witness.loc22_55.2 (constants.%GenericInterface.impl_witness)] +// CHECK:STDOUT: %GenericInterface.impl_witness.loc26_55.1: = impl_witness %GenericInterface.impl_witness_table, @C.as.GenericInterface.impl(constants.%T) [symbolic = %GenericInterface.impl_witness.loc26_55.2 (constants.%GenericInterface.impl_witness)] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .T = // CHECK:STDOUT: .F = %C.as.GenericInterface.impl.F.decl -// CHECK:STDOUT: extend %GenericInterface.type.loc22_53.2 +// CHECK:STDOUT: extend %GenericInterface.type.loc26_53.2 // CHECK:STDOUT: witness = // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { // CHECK:STDOUT: impl_decl @C.as.GenericInterface.impl [concrete] { -// CHECK:STDOUT: %T.patt.loc22_24.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc22_24.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.patt.loc26_24.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc26_24.2 (constants.%T.patt)] // CHECK:STDOUT: } { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%C [concrete = constants.%C] // CHECK:STDOUT: %GenericInterface.ref: %GenericInterface.type.26e = name_ref GenericInterface, file.%GenericInterface.decl [concrete = constants.%GenericInterface.generic] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc22_24.2 [symbolic = %T.loc22_24.1 (constants.%T)] -// CHECK:STDOUT: %GenericInterface.type.loc22_53.2: type = facet_type <@GenericInterface, @GenericInterface(constants.%T)> [symbolic = %GenericInterface.type.loc22_53.1 (constants.%GenericInterface.type.076)] -// CHECK:STDOUT: %.loc22_26.1: type = splice_block %.loc22_26.2 [concrete = type] { +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc26_24.2 [symbolic = %T.loc26_24.1 (constants.%T)] +// CHECK:STDOUT: %GenericInterface.type.loc26_53.2: type = facet_type <@GenericInterface, @GenericInterface(constants.%T)> [symbolic = %GenericInterface.type.loc26_53.1 (constants.%GenericInterface.type.076)] +// CHECK:STDOUT: %.loc26_26.1: type = splice_block %.loc26_26.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc22_26.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc26_26.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc22_24.2: type = symbolic_binding T, 0 [symbolic = %T.loc22_24.1 (constants.%T)] +// CHECK:STDOUT: %T.loc26_24.2: type = symbolic_binding T, 0 [symbolic = %T.loc26_24.1 (constants.%T)] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc22: = impl_self_witness @C.as.GenericInterface.impl.%Self.ref, @GenericInterface, @GenericInterface(constants.%T) [symbolic = @C.as.GenericInterface.impl.%.loc22_55 (constants.%.c61)] +// CHECK:STDOUT: %.loc26: = impl_self_witness @C.as.GenericInterface.impl.%Self.ref, @GenericInterface, @GenericInterface(constants.%T) [symbolic = @C.as.GenericInterface.impl.%.loc26_55 (constants.%.c61)] // CHECK:STDOUT: %complete_type: = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type] // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: @@ -174,11 +178,11 @@ class C { // CHECK:STDOUT: fn(%x.param: @GenericInterface.WithSelf.F.%T (%T)); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @C.as.GenericInterface.impl.F(@C.as.GenericInterface.impl.%T.loc22_24.2: type) { +// CHECK:STDOUT: generic fn @C.as.GenericInterface.impl.F(@C.as.GenericInterface.impl.%T.loc26_24.2: type) { // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic = %T (constants.%T)] // CHECK:STDOUT: %pattern_type: type = pattern_type %T [symbolic = %pattern_type (constants.%pattern_type.51d)] -// CHECK:STDOUT: %x.param_patt.loc23_18.2: @C.as.GenericInterface.impl.F.%pattern_type (%pattern_type.51d) = value_param_pattern [symbolic = %x.param_patt.loc23_18.2 (constants.%x.param_patt)] -// CHECK:STDOUT: %x.patt.loc23_18.2: @C.as.GenericInterface.impl.F.%pattern_type (%pattern_type.51d) = wrapper_binding_pattern x, %x.param_patt.loc23_18.2 [symbolic = %x.patt.loc23_18.2 (constants.%x.patt)] +// CHECK:STDOUT: %x.param_patt.loc27_18.2: @C.as.GenericInterface.impl.F.%pattern_type (%pattern_type.51d) = value_param_pattern [symbolic = %x.param_patt.loc27_18.2 (constants.%x.param_patt)] +// CHECK:STDOUT: %x.patt.loc27_18.2: @C.as.GenericInterface.impl.F.%pattern_type (%pattern_type.51d) = wrapper_binding_pattern x, %x.param_patt.loc27_18.2 [symbolic = %x.patt.loc27_18.2 (constants.%x.patt)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete: = require_complete_type %T [symbolic = %require_complete (constants.%require_complete)] @@ -213,11 +217,11 @@ class C { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @C.as.GenericInterface.impl(constants.%T) { -// CHECK:STDOUT: %T.patt.loc22_24.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc22_24.1 => constants.%T -// CHECK:STDOUT: %GenericInterface.type.loc22_53.1 => constants.%GenericInterface.type.076 -// CHECK:STDOUT: %.loc22_55 => constants.%.c61 -// CHECK:STDOUT: %GenericInterface.impl_witness.loc22_55.2 => constants.%GenericInterface.impl_witness +// CHECK:STDOUT: %T.patt.loc26_24.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc26_24.1 => constants.%T +// CHECK:STDOUT: %GenericInterface.type.loc26_53.1 => constants.%GenericInterface.type.076 +// CHECK:STDOUT: %.loc26_55 => constants.%.c61 +// CHECK:STDOUT: %GenericInterface.impl_witness.loc26_55.2 => constants.%GenericInterface.impl_witness // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %C.as.GenericInterface.impl.F.type => constants.%C.as.GenericInterface.impl.F.type @@ -227,7 +231,7 @@ class C { // CHECK:STDOUT: specific @C.as.GenericInterface.impl.F(constants.%T) { // CHECK:STDOUT: %T => constants.%T // CHECK:STDOUT: %pattern_type => constants.%pattern_type.51d -// CHECK:STDOUT: %x.param_patt.loc23_18.2 => constants.%x.param_patt -// CHECK:STDOUT: %x.patt.loc23_18.2 => constants.%x.patt +// CHECK:STDOUT: %x.param_patt.loc27_18.2 => constants.%x.param_patt +// CHECK:STDOUT: %x.patt.loc27_18.2 => constants.%x.patt // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/fail_extend_impl_scope.carbon b/toolchain/check/testdata/impl/fail_extend_impl_scope.carbon index 1c6e69002ffd..98d92251c4e4 100644 --- a/toolchain/check/testdata/impl/fail_extend_impl_scope.carbon +++ b/toolchain/check/testdata/impl/fail_extend_impl_scope.carbon @@ -17,7 +17,12 @@ library "[[@TEST_NAME]]"; interface I {} -// CHECK:STDERR: fail_extend_impl_file_scope.carbon:[[@LINE+2]]:1-21: error: `extend impl` can only be used in an interface or class [ExtendImplOutsideClass] +// CHECK:STDERR: ╭─┤ fail_extend_impl_file_scope.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ extend impl () as I {} +// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `extend impl` can only be used in an interface or class +// CHECK:STDERR: · ┃ [ExtendImplOutsideClass] +// CHECK:STDERR: ╰──── // CHECK:STDERR: extend impl () as I {} @@ -27,7 +32,12 @@ library "[[@TEST_NAME]]"; interface J {} fn F() { - // CHECK:STDERR: fail_extend_impl_function_scope.carbon:[[@LINE+2]]:3-23: error: `extend impl` can only be used in an interface or class [ExtendImplOutsideClass] + // CHECK:STDERR: ╭─┤ fail_extend_impl_function_scope.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ extend impl {} as J {} + // CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: `extend impl` can only be used in an interface or class + // CHECK:STDERR: · ┃ [ExtendImplOutsideClass] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend impl {} as J {} } @@ -38,7 +48,12 @@ library "[[@TEST_NAME]]"; interface Z { fn Zero(); - // CHECK:STDERR: fail_extend_impl_self_interface.carbon:[[@LINE+2]]:15-16: error: `impl as` can only be used in a class [ImplAsOutsideClass] + // CHECK:STDERR: ╭─┤ fail_extend_impl_self_interface.carbon:[[@LINE+7]]:15 + // CHECK:STDERR: -> │ extend impl as Z { + // CHECK:STDERR: · ━┳ + // CHECK:STDERR: · ┗━━┫ error: `impl as` can only be used in a class + // CHECK:STDERR: · ┃ [ImplAsOutsideClass] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend impl as Z { fn Zero() {} @@ -85,11 +100,11 @@ fn F() { // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {} // CHECK:STDOUT: impl_decl @empty_tuple.type.as.I.impl [concrete] {} { -// CHECK:STDOUT: %.loc7_14.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc7_14.2: type = converted %.loc7_14.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc12_14.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc12_14.2: type = converted %.loc12_14.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc7: = impl_self_witness @empty_tuple.type.as.I.impl.%.loc7_14.2, @I [concrete = constants.%.2ef] +// CHECK:STDOUT: %.loc12: = impl_self_witness @empty_tuple.type.as.I.impl.%.loc12_14.2, @I [concrete = constants.%.2ef] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { @@ -103,7 +118,7 @@ fn F() { // CHECK:STDOUT: !requires: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @empty_tuple.type.as.I.impl: %.loc7_14.2 as %I.ref { +// CHECK:STDOUT: impl @empty_tuple.type.as.I.impl: %.loc12_14.2 as %I.ref { // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (), @empty_tuple.type.as.I.impl [concrete] // CHECK:STDOUT: %I.impl_witness: = impl_witness %I.impl_witness_table [concrete = constants.%I.impl_witness] // CHECK:STDOUT: @@ -157,7 +172,7 @@ fn F() { // CHECK:STDOUT: !requires: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @empty_struct_type.as.J.impl: %.loc8_16.2 as %J.ref { +// CHECK:STDOUT: impl @empty_struct_type.as.J.impl: %.loc13_16.2 as %J.ref { // CHECK:STDOUT: %J.impl_witness_table = impl_witness_table (), @empty_struct_type.as.J.impl [concrete] // CHECK:STDOUT: %J.impl_witness: = impl_witness %J.impl_witness_table [concrete = constants.%J.impl_witness] // CHECK:STDOUT: @@ -169,11 +184,11 @@ fn F() { // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: impl_decl @empty_struct_type.as.J.impl [concrete] {} { -// CHECK:STDOUT: %.loc8_16.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc8_16.2: type = converted %.loc8_16.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc13_16.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc13_16.2: type = converted %.loc13_16.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [concrete = constants.%J.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8: = impl_self_witness @empty_struct_type.as.J.impl.%.loc8_16.2, @J [concrete = constants.%.948] +// CHECK:STDOUT: %.loc13: = impl_self_witness @empty_struct_type.as.J.impl.%.loc13_16.2, @J [concrete = constants.%.948] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -217,7 +232,7 @@ fn F() { // CHECK:STDOUT: %T.09f: %SubobjectDestroy.type = symbolic_binding T, 0 [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.type.dea: type = fn_type @T.as_type.as.DestroyImpl.impl.Op, @T.as_type.as.DestroyImpl.impl(%T.09f) [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.6e5: %T.as_type.as.DestroyImpl.impl.Op.type.dea = struct_value () [symbolic] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.2: type = fn_type @SubobjectDestroy.WithSelf.Op.loc23_7.2 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.2: type = fn_type @SubobjectDestroy.WithSelf.Op.loc28_7.2 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.2: %SubobjectDestroy.WithSelf.Op.type.6870fd.2 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80ef6.2: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.2), @SubobjectDestroy [concrete] // CHECK:STDOUT: %SubobjectDestroy.facet.04d: %SubobjectDestroy.type = facet_value %Point, (%custom_witness.b80ef6.2) [concrete] @@ -260,7 +275,7 @@ fn F() { // CHECK:STDOUT: impl_decl @.as.Z.impl [concrete] {} { // CHECK:STDOUT: %Z.ref: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8: = impl_self_witness , @Z [concrete = ] +// CHECK:STDOUT: %.loc13: = impl_self_witness , @Z [concrete = ] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self @@ -304,7 +319,7 @@ fn F() { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Point [concrete = constants.%Point] // CHECK:STDOUT: %Z.ref: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc14: = impl_self_witness @Point.as.Z.impl.%Self.ref, @Z [concrete = constants.%.354] +// CHECK:STDOUT: %.loc19: = impl_self_witness @Point.as.Z.impl.%Self.ref, @Z [concrete = constants.%.354] // CHECK:STDOUT: %complete_type: = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type] // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: @@ -335,27 +350,27 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc23_5.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc28_5.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] // CHECK:STDOUT: %Point.ref: type = name_ref Point, file.%Point.decl [concrete = constants.%Point] -// CHECK:STDOUT: %.loc23_5.2: ref %Point = temporary_storage -// CHECK:STDOUT: %.loc23_5.3: init %Point to %.loc23_5.2 = class_init () [concrete = constants.%Point.val] -// CHECK:STDOUT: %.loc23_7.1: init %Point = converted %.loc23_5.1, %.loc23_5.3 [concrete = constants.%Point.val] -// CHECK:STDOUT: %.loc23_7.2: ref %Point = temporary %.loc23_5.2, %.loc23_7.1 [concrete = constants.%.e6b] +// CHECK:STDOUT: %.loc28_5.2: ref %Point = temporary_storage +// CHECK:STDOUT: %.loc28_5.3: init %Point to %.loc28_5.2 = class_init () [concrete = constants.%Point.val] +// CHECK:STDOUT: %.loc28_7.1: init %Point = converted %.loc28_5.1, %.loc28_5.3 [concrete = constants.%Point.val] +// CHECK:STDOUT: %.loc28_7.2: ref %Point = temporary %.loc28_5.2, %.loc28_7.1 [concrete = constants.%.e6b] // CHECK:STDOUT: %Zero.ref: %Z.assoc_type = name_ref Zero, @Z.WithSelf.%assoc0 [concrete = constants.%assoc0] // CHECK:STDOUT: %impl.elem0: %.075 = impl_witness_access constants.%Z.impl_witness, element0 [concrete = constants.%Point.as.Z.impl.Zero] // CHECK:STDOUT: %Point.as.Z.impl.Zero.call: init %empty_tuple.type = call %impl.elem0() -// CHECK:STDOUT: %Destroy.facet.loc23_7.1: %Destroy.type = facet_value constants.%Point, (constants.%DestroyImpl.impl_witness.222, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc23_7.3: %Destroy.type = converted constants.%Point, %Destroy.facet.loc23_7.1 [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %Destroy.facet.loc23_7.2: %Destroy.type = facet_value constants.%Point, (constants.%DestroyImpl.impl_witness.222, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc23_7.4: %Destroy.type = converted constants.%Point, %Destroy.facet.loc23_7.2 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %Destroy.facet.loc28_7.1: %Destroy.type = facet_value constants.%Point, (constants.%DestroyImpl.impl_witness.222, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc28_7.3: %Destroy.type = converted constants.%Point, %Destroy.facet.loc28_7.1 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %Destroy.facet.loc28_7.2: %Destroy.type = facet_value constants.%Point, (constants.%DestroyImpl.impl_witness.222, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc28_7.4: %Destroy.type = converted constants.%Point, %Destroy.facet.loc28_7.2 [concrete = constants.%Destroy.facet] // CHECK:STDOUT: %SelfDestruct.specific_fn: = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet) [concrete = constants.%SelfDestruct.specific_fn] -// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc23_7.2) +// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc28_7.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc23_7.1(%self.param: ref %empty_struct_type) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc28_7.1(%self.param: ref %empty_struct_type) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc23_7.2(%self.param: ref %Point) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc28_7.2(%self.param: ref %Point) = "no_op"; // CHECK:STDOUT: // CHECK:STDOUT: specific @Z.WithSelf(constants.%Self.cb6) { // CHECK:STDOUT: !definition: diff --git a/toolchain/check/testdata/impl/fail_extend_impl_type_as.carbon b/toolchain/check/testdata/impl/fail_extend_impl_type_as.carbon index 76282ecd3e9d..6b8860d7db57 100644 --- a/toolchain/check/testdata/impl/fail_extend_impl_type_as.carbon +++ b/toolchain/check/testdata/impl/fail_extend_impl_type_as.carbon @@ -15,23 +15,44 @@ interface I {} class C { - // CHECK:STDERR: fail_extend_impl_type_as.carbon:[[@LINE+2]]:3-8: error: cannot `extend` an `impl` with an explicit self type [ExtendImplSelfAs] + // CHECK:STDERR: ╭─┤ fail_extend_impl_type_as.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ extend impl i32 as I {} + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: cannot `extend` an `impl` with an explicit self type + // CHECK:STDERR: · ┃ [ExtendImplSelfAs] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend impl i32 as I {} } class D { - // CHECK:STDERR: fail_extend_impl_type_as.carbon:[[@LINE+3]]:3-8: error: cannot `extend` an `impl` with an explicit self type [ExtendImplSelfAs] - // CHECK:STDERR: fail_extend_impl_type_as.carbon:[[@LINE+2]]:15: note: remove the explicit `Self` type here [ExtendImplSelfAsDefault] + // CHECK:STDERR: ╭─┤ fail_extend_impl_type_as.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ extend impl D as I; + // CHECK:STDERR: · ━━━┳━━ ┬ + // CHECK:STDERR: · ┗━━━━━━━━━━━┫ error: cannot `extend` an `impl` with an explicit self type + // CHECK:STDERR: · │ ┃ [ExtendImplSelfAs] + // CHECK:STDERR: · ╰────┤ remove the explicit `Self` type here + // CHECK:STDERR: · │ [ExtendImplSelfAsDefault] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend impl D as I; } class E { - // CHECK:STDERR: fail_extend_impl_type_as.carbon:[[@LINE+5]]:3-8: error: cannot `extend` an `impl` with an explicit self type [ExtendImplSelfAs] - // CHECK:STDERR: fail_extend_impl_type_as.carbon:[[@LINE+4]]:15-18: note: remove the explicit `Self` type here [ExtendImplSelfAsDefault] + // CHECK:STDERR: ╭─┤ fail_extend_impl_type_as.carbon:[[@LINE+15]]:3 + // CHECK:STDERR: -> │ extend impl Self as I {} + // CHECK:STDERR: · ━━━┳━━ ──┬─ + // CHECK:STDERR: · ┗━━━━━━━━━━━━━┫ error: cannot `extend` an `impl` with an explicit self type + // CHECK:STDERR: · │ ┃ [ExtendImplSelfAs] + // CHECK:STDERR: · ╰────┤ remove the explicit `Self` type here + // CHECK:STDERR: · │ [ExtendImplSelfAsDefault] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_extend_impl_type_as.carbon:[[@LINE-7]]:3-21: error: impl declared but not defined [ImplMissingDefinition] + // CHECK:STDERR: ╭─┤ fail_extend_impl_type_as.carbon:[[@LINE-13]]:3 + // CHECK:STDERR: -> │ extend impl D as I; + // CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: impl declared but not defined [ImplMissingDefinition] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend impl Self as I {} } @@ -114,7 +135,7 @@ class E { // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc20: = impl_self_witness , @I [concrete = ] +// CHECK:STDOUT: %.loc25: = impl_self_witness , @I [concrete = ] // CHECK:STDOUT: %complete_type: = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type.357] // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: @@ -129,7 +150,7 @@ class E { // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [concrete = constants.%D] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc27: = impl_self_witness @D.as.I.impl.%D.ref, @I [concrete = constants.%.393] +// CHECK:STDOUT: %.loc38: = impl_self_witness @D.as.I.impl.%D.ref, @I [concrete = constants.%.393] // CHECK:STDOUT: %complete_type: = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type.357] // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: @@ -145,7 +166,7 @@ class E { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%E [concrete = constants.%E] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc36: = impl_self_witness @E.as.I.impl.%Self.ref, @I [concrete = constants.%.e0d] +// CHECK:STDOUT: %.loc57: = impl_self_witness @E.as.I.impl.%Self.ref, @I [concrete = constants.%.e0d] // CHECK:STDOUT: %complete_type: = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type.357] // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/fail_extend_non_interface.carbon b/toolchain/check/testdata/impl/fail_extend_non_interface.carbon index 1055512479cd..826a44f9c823 100644 --- a/toolchain/check/testdata/impl/fail_extend_non_interface.carbon +++ b/toolchain/check/testdata/impl/fail_extend_non_interface.carbon @@ -13,7 +13,11 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/fail_extend_non_interface.carbon class C { - // CHECK:STDERR: fail_extend_non_interface.carbon:[[@LINE+2]]:3-21: error: impl as non-facet type `i32` [ImplAsNonFacetType] + // CHECK:STDERR: ╭─┤ fail_extend_non_interface.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ extend impl as i32; + // CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: impl as non-facet type `i32` [ImplAsNonFacetType] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend impl as i32; } diff --git a/toolchain/check/testdata/impl/fail_extend_partially_defined_interface.carbon b/toolchain/check/testdata/impl/fail_extend_partially_defined_interface.carbon index 784cfa0a5a20..2ef4ce419b19 100644 --- a/toolchain/check/testdata/impl/fail_extend_partially_defined_interface.carbon +++ b/toolchain/check/testdata/impl/fail_extend_partially_defined_interface.carbon @@ -14,8 +14,17 @@ interface I { class C { - // CHECK:STDERR: fail_extend_partially_defined_interface.carbon:[[@LINE+3]]:5-21: error: `extend impl as` incomplete facet type `I` [ExtendImplAsIncomplete] - // CHECK:STDERR: fail_extend_partially_defined_interface.carbon:[[@LINE-3]]:1-13: note: interface is currently being defined [InterfaceIncompleteWithinDefinition] + // CHECK:STDERR: ╭─┤ fail_extend_partially_defined_interface.carbon:[[@LINE+12]]:5 + // CHECK:STDERR: │ interface I { + // CHECK:STDERR: · ──────┬────── + // CHECK:STDERR: · ╰──┤ interface is currently being defined + // CHECK:STDERR: · │ [InterfaceIncompleteWithinDefinition] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ extend impl as I; + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: `extend impl as` incomplete facet type `I` + // CHECK:STDERR: · ┃ [ExtendImplAsIncomplete] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend impl as I; } @@ -61,8 +70,8 @@ interface I { // CHECK:STDOUT: generic impl @C.as.I.impl(@I.%Self: %I.type) { // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self)] // CHECK:STDOUT: %C: type = class_type @C, @C(%Self) [symbolic = %C (constants.%C)] -// CHECK:STDOUT: %.loc20: = impl_self_witness %C, @I [symbolic = %.loc20 (constants.%.af5)] -// CHECK:STDOUT: %I.impl_witness.loc20_21.2: = impl_witness %I.impl_witness_table, @C.as.I.impl(%Self) [symbolic = %I.impl_witness.loc20_21.2 (constants.%I.impl_witness)] +// CHECK:STDOUT: %.loc29: = impl_self_witness %C, @I [symbolic = %.loc29 (constants.%.af5)] +// CHECK:STDOUT: %I.impl_witness.loc29_21.2: = impl_witness %I.impl_witness_table, @C.as.I.impl(%Self) [symbolic = %I.impl_witness.loc29_21.2 (constants.%I.impl_witness)] // CHECK:STDOUT: // CHECK:STDOUT: impl: %Self.ref as %I.ref; // CHECK:STDOUT: } @@ -75,7 +84,7 @@ interface I { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%C [symbolic = %C (constants.%C)] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc20: = impl_self_witness @C.as.I.impl.%Self.ref, @I [symbolic = @C.as.I.impl.%.loc20 (constants.%.af5)] +// CHECK:STDOUT: %.loc29: = impl_self_witness @C.as.I.impl.%Self.ref, @I [symbolic = @C.as.I.impl.%.loc29 (constants.%.af5)] // CHECK:STDOUT: %complete_type: = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type] // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: @@ -93,7 +102,7 @@ interface I { // CHECK:STDOUT: specific @C.as.I.impl(constants.%Self) { // CHECK:STDOUT: %Self => constants.%Self // CHECK:STDOUT: %C => constants.%C -// CHECK:STDOUT: %.loc20 => constants.%.af5 -// CHECK:STDOUT: %I.impl_witness.loc20_21.2 => constants.%I.impl_witness +// CHECK:STDOUT: %.loc29 => constants.%.af5 +// CHECK:STDOUT: %I.impl_witness.loc29_21.2 => constants.%I.impl_witness // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/fail_extend_undefined_interface.carbon b/toolchain/check/testdata/impl/fail_extend_undefined_interface.carbon index ad91f0cad5b7..d77c6dde50c0 100644 --- a/toolchain/check/testdata/impl/fail_extend_undefined_interface.carbon +++ b/toolchain/check/testdata/impl/fail_extend_undefined_interface.carbon @@ -15,8 +15,16 @@ interface I; class C { - // CHECK:STDERR: fail_extend_undefined_interface.carbon:[[@LINE+3]]:3-19: error: `extend impl as` incomplete facet type `I` [ExtendImplAsIncomplete] - // CHECK:STDERR: fail_extend_undefined_interface.carbon:[[@LINE-4]]:1-12: note: interface was forward declared here [InterfaceForwardDeclaredHere] + // CHECK:STDERR: ╭─┤ fail_extend_undefined_interface.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ interface I; + // CHECK:STDERR: · ──────┬───── + // CHECK:STDERR: · ╰──┤ interface was forward declared here [InterfaceForwardDeclaredHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ extend impl as I; + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: `extend impl as` incomplete facet type `I` + // CHECK:STDERR: · ┃ [ExtendImplAsIncomplete] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend impl as I; } @@ -55,7 +63,7 @@ fn F(c: C) { // CHECK:STDOUT: %c.patt: %pattern_type = wrapper_binding_pattern c, %c.param_patt [concrete = constants.%c.patt] // CHECK:STDOUT: } { // CHECK:STDOUT: %c.param: %C = value_param call_param0 -// CHECK:STDOUT: %C.ref.loc24: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %C.ref.loc32: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %c: %C = wrapper_binding c, %c.param // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -69,7 +77,7 @@ fn F(c: C) { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%C [concrete = constants.%C] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc21: = impl_self_witness @C.as.I.impl.%Self.ref, @I [concrete = constants.%.b7f] +// CHECK:STDOUT: %.loc29: = impl_self_witness @C.as.I.impl.%Self.ref, @I [concrete = constants.%.b7f] // CHECK:STDOUT: %complete_type: = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type] // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: @@ -82,10 +90,10 @@ fn F(c: C) { // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%c.param: %C) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %C.ref.loc25: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %F.ref.loc25: = name_ref F, [concrete = ] +// CHECK:STDOUT: %C.ref.loc33: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %F.ref.loc33: = name_ref F, [concrete = ] // CHECK:STDOUT: %c.ref: %C = name_ref c, %c -// CHECK:STDOUT: %F.ref.loc26: = name_ref F, [concrete = ] +// CHECK:STDOUT: %F.ref.loc34: = name_ref F, [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/fail_impl_as_scope.carbon b/toolchain/check/testdata/impl/fail_impl_as_scope.carbon index 222c0ad6b6c4..11b2ccf45886 100644 --- a/toolchain/check/testdata/impl/fail_impl_as_scope.carbon +++ b/toolchain/check/testdata/impl/fail_impl_as_scope.carbon @@ -19,7 +19,11 @@ interface I {} fn G() {} -// CHECK:STDERR: fail_impl_as_file_scope.carbon:[[@LINE+2]]:6-7: error: `impl as` can only be used in a class [ImplAsOutsideClass] +// CHECK:STDERR: ╭─┤ fail_impl_as_file_scope.carbon:[[@LINE+6]]:6 +// CHECK:STDERR: -> │ impl as I {} +// CHECK:STDERR: · ━┳ +// CHECK:STDERR: · ┗━━┫ error: `impl as` can only be used in a class [ImplAsOutsideClass] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl as I {} @@ -33,7 +37,11 @@ interface J {} fn G() {} fn F() { - // CHECK:STDERR: fail_impl_as_function_scope.carbon:[[@LINE+2]]:8-9: error: `impl as` can only be used in a class [ImplAsOutsideClass] + // CHECK:STDERR: ╭─┤ fail_impl_as_function_scope.carbon:[[@LINE+6]]:8 + // CHECK:STDERR: -> │ impl as J {} + // CHECK:STDERR: · ━┳ + // CHECK:STDERR: · ┗━━┫ error: `impl as` can only be used in a class [ImplAsOutsideClass] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl as J {} G(); @@ -46,7 +54,11 @@ interface Z { fn Zero(); fn Method(self); - // CHECK:STDERR: fail_impl_as_self_interface.carbon:[[@LINE+2]]:9-10: error: `impl as` can only be used in a class [ImplAsOutsideClass] + // CHECK:STDERR: ╭─┤ fail_impl_as_self_interface.carbon:[[@LINE+6]]:9 + // CHECK:STDERR: -> │ impl as Z { + // CHECK:STDERR: · ━┳ + // CHECK:STDERR: · ┗━━┫ error: `impl as` can only be used in a class [ImplAsOutsideClass] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl as Z { fn Zero() {} @@ -82,7 +94,11 @@ fn G() {} class X { impl as A { - // CHECK:STDERR: fail_impl_as_other_interface.carbon:[[@LINE+2]]:10-11: error: `impl as` can only be used in a class [ImplAsOutsideClass] + // CHECK:STDERR: ╭─┤ fail_impl_as_other_interface.carbon:[[@LINE+6]]:10 + // CHECK:STDERR: -> │ impl as C {} + // CHECK:STDERR: · ━┳ + // CHECK:STDERR: · ┗━━┫ error: `impl as` can only be used in a class [ImplAsOutsideClass] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl as C {} fn B() { @@ -125,7 +141,7 @@ class X { // CHECK:STDOUT: impl_decl @.as.I.impl [concrete] {} { // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc9: = impl_self_witness , @I [concrete = ] +// CHECK:STDOUT: %.loc13: = impl_self_witness , @I [concrete = ] // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: @@ -220,7 +236,7 @@ class X { // CHECK:STDOUT: impl_decl @.as.J.impl [concrete] {} { // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [concrete = constants.%J.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc10: = impl_self_witness , @J [concrete = ] +// CHECK:STDOUT: %.loc14: = impl_self_witness , @J [concrete = ] // CHECK:STDOUT: %G.ref: %G.type = name_ref G, file.%G.decl [concrete = constants.%G] // CHECK:STDOUT: %G.call: init %empty_tuple.type = call %G.ref() // CHECK:STDOUT: return @@ -283,7 +299,7 @@ class X { // CHECK:STDOUT: %T.09f: %SubobjectDestroy.type = symbolic_binding T, 0 [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.type.dea: type = fn_type @T.as_type.as.DestroyImpl.impl.Op, @T.as_type.as.DestroyImpl.impl(%T.09f) [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.6e5: %T.as_type.as.DestroyImpl.impl.Op.type.dea = struct_value () [symbolic] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.2: type = fn_type @SubobjectDestroy.WithSelf.Op.loc27_7.2 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.2: type = fn_type @SubobjectDestroy.WithSelf.Op.loc31_7.2 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.2: %SubobjectDestroy.WithSelf.Op.type.6870fd.2 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80ef6.2: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.2), @SubobjectDestroy [concrete] // CHECK:STDOUT: %SubobjectDestroy.facet.04d: %SubobjectDestroy.type = facet_value %Point, (%custom_witness.b80ef6.2) [concrete] @@ -339,7 +355,7 @@ class X { // CHECK:STDOUT: impl_decl @.as.Z.impl [concrete] {} { // CHECK:STDOUT: %Z.ref: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc9: = impl_self_witness , @Z [concrete = ] +// CHECK:STDOUT: %.loc13: = impl_self_witness , @Z [concrete = ] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self @@ -363,16 +379,16 @@ class X { // CHECK:STDOUT: impl: as %Z.ref { // CHECK:STDOUT: %.as.Z.impl.Zero.decl: @.as.Z.impl.%.as.Z.impl.Zero.type (%.as.Z.impl.Zero.type) = fn_decl @.as.Z.impl.Zero [symbolic = @.as.Z.impl.%.as.Z.impl.Zero (constants.%.as.Z.impl.Zero)] {} {} // CHECK:STDOUT: %.as.Z.impl.Method.decl: @.as.Z.impl.%.as.Z.impl.Method.type (%.as.Z.impl.Method.type) = fn_decl @.as.Z.impl.Method [symbolic = @.as.Z.impl.%.as.Z.impl.Method (constants.%.as.Z.impl.Method)] { -// CHECK:STDOUT: %self.param_patt.loc11_22.1: @.as.Z.impl.Method.%pattern_type (%pattern_type.52a) = value_param_pattern [symbolic = %self.param_patt.loc11_22.2 (constants.%self.param_patt.241)] -// CHECK:STDOUT: %self.patt.loc11_22.1: @.as.Z.impl.Method.%pattern_type (%pattern_type.52a) = wrapper_binding_pattern self, %self.param_patt.loc11_22.1 [symbolic = %self.patt.loc11_22.2 (constants.%self.patt.b15)] +// CHECK:STDOUT: %self.param_patt.loc15_22.1: @.as.Z.impl.Method.%pattern_type (%pattern_type.52a) = value_param_pattern [symbolic = %self.param_patt.loc15_22.2 (constants.%self.param_patt.241)] +// CHECK:STDOUT: %self.patt.loc15_22.1: @.as.Z.impl.Method.%pattern_type (%pattern_type.52a) = wrapper_binding_pattern self, %self.param_patt.loc15_22.1 [symbolic = %self.patt.loc15_22.2 (constants.%self.patt.b15)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param: @.as.Z.impl.Method.%Self.as_type.loc11_22.1 (%Self.as_type.0cf) = value_param call_param0 -// CHECK:STDOUT: %.loc11_22.1: type = splice_block %.loc11_22.2 [symbolic = %Self.as_type.loc11_22.1 (constants.%Self.as_type.0cf)] { +// CHECK:STDOUT: %self.param: @.as.Z.impl.Method.%Self.as_type.loc15_22.1 (%Self.as_type.0cf) = value_param call_param0 +// CHECK:STDOUT: %.loc15_22.1: type = splice_block %.loc15_22.2 [symbolic = %Self.as_type.loc15_22.1 (constants.%Self.as_type.0cf)] { // CHECK:STDOUT: %Self.ref: %Z.type = name_ref Self, @Z.%Self [symbolic = %Self (constants.%Self.cb6)] -// CHECK:STDOUT: %Self.as_type.loc11_22.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc11_22.1 (constants.%Self.as_type.0cf)] -// CHECK:STDOUT: %.loc11_22.2: type = converted %Self.ref, %Self.as_type.loc11_22.2 [symbolic = %Self.as_type.loc11_22.1 (constants.%Self.as_type.0cf)] +// CHECK:STDOUT: %Self.as_type.loc15_22.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc15_22.1 (constants.%Self.as_type.0cf)] +// CHECK:STDOUT: %.loc15_22.2: type = converted %Self.ref, %Self.as_type.loc15_22.2 [symbolic = %Self.as_type.loc15_22.1 (constants.%Self.as_type.0cf)] // CHECK:STDOUT: } -// CHECK:STDOUT: %self: @.as.Z.impl.Method.%Self.as_type.loc11_22.1 (%Self.as_type.0cf) = wrapper_binding self, %self.param +// CHECK:STDOUT: %self: @.as.Z.impl.Method.%Self.as_type.loc15_22.1 (%Self.as_type.0cf) = wrapper_binding self, %self.param // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -408,7 +424,7 @@ class X { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Point [concrete = constants.%Point] // CHECK:STDOUT: %Z.ref: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc16: = impl_self_witness @Point.as.Z.impl.%Self.ref, @Z [concrete = constants.%.354] +// CHECK:STDOUT: %.loc20: = impl_self_witness @Point.as.Z.impl.%Self.ref, @Z [concrete = constants.%.354] // CHECK:STDOUT: %complete_type: = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type] // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: @@ -442,15 +458,15 @@ class X { // CHECK:STDOUT: // CHECK:STDOUT: generic fn @.as.Z.impl.Method(@Z.%Self: %Z.type) { // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.cb6)] -// CHECK:STDOUT: %Self.as_type.loc11_22.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc11_22.1 (constants.%Self.as_type.0cf)] -// CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type.loc11_22.1 [symbolic = %pattern_type (constants.%pattern_type.52a)] -// CHECK:STDOUT: %self.param_patt.loc11_22.2: @.as.Z.impl.Method.%pattern_type (%pattern_type.52a) = value_param_pattern [symbolic = %self.param_patt.loc11_22.2 (constants.%self.param_patt.241)] -// CHECK:STDOUT: %self.patt.loc11_22.2: @.as.Z.impl.Method.%pattern_type (%pattern_type.52a) = wrapper_binding_pattern self, %self.param_patt.loc11_22.2 [symbolic = %self.patt.loc11_22.2 (constants.%self.patt.b15)] +// CHECK:STDOUT: %Self.as_type.loc15_22.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc15_22.1 (constants.%Self.as_type.0cf)] +// CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type.loc15_22.1 [symbolic = %pattern_type (constants.%pattern_type.52a)] +// CHECK:STDOUT: %self.param_patt.loc15_22.2: @.as.Z.impl.Method.%pattern_type (%pattern_type.52a) = value_param_pattern [symbolic = %self.param_patt.loc15_22.2 (constants.%self.param_patt.241)] +// CHECK:STDOUT: %self.patt.loc15_22.2: @.as.Z.impl.Method.%pattern_type (%pattern_type.52a) = wrapper_binding_pattern self, %self.param_patt.loc15_22.2 [symbolic = %self.patt.loc15_22.2 (constants.%self.patt.b15)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete: = require_complete_type %Self.as_type.loc11_22.1 [symbolic = %require_complete (constants.%require_complete.350)] +// CHECK:STDOUT: %require_complete: = require_complete_type %Self.as_type.loc15_22.1 [symbolic = %require_complete (constants.%require_complete.350)] // CHECK:STDOUT: -// CHECK:STDOUT: fn(%self.param: @.as.Z.impl.Method.%Self.as_type.loc11_22.1 (%Self.as_type.0cf)) { +// CHECK:STDOUT: fn(%self.param: @.as.Z.impl.Method.%Self.as_type.loc15_22.1 (%Self.as_type.0cf)) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -468,37 +484,37 @@ class X { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Point.ref.loc26: type = name_ref Point, file.%Point.decl [concrete = constants.%Point] -// CHECK:STDOUT: %Z.ref.loc26: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type] +// CHECK:STDOUT: %Point.ref.loc30: type = name_ref Point, file.%Point.decl [concrete = constants.%Point] +// CHECK:STDOUT: %Z.ref.loc30: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type] // CHECK:STDOUT: %Zero.ref: %Z.assoc_type = name_ref Zero, @Z.WithSelf.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %Z.facet: %Z.type = facet_value %Point.ref.loc26, (constants.%Z.impl_witness) [concrete = constants.%Z.facet] -// CHECK:STDOUT: %.loc26: %Z.type = converted %Point.ref.loc26, %Z.facet [concrete = constants.%Z.facet] +// CHECK:STDOUT: %Z.facet: %Z.type = facet_value %Point.ref.loc30, (constants.%Z.impl_witness) [concrete = constants.%Z.facet] +// CHECK:STDOUT: %.loc30: %Z.type = converted %Point.ref.loc30, %Z.facet [concrete = constants.%Z.facet] // CHECK:STDOUT: %impl.elem0: %.075 = impl_witness_access constants.%Z.impl_witness, element0 [concrete = constants.%Point.as.Z.impl.Zero] // CHECK:STDOUT: %Point.as.Z.impl.Zero.call: init %empty_tuple.type = call %impl.elem0() -// CHECK:STDOUT: %.loc27_5.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %Point.ref.loc27: type = name_ref Point, file.%Point.decl [concrete = constants.%Point] -// CHECK:STDOUT: %.loc27_5.2: ref %Point = temporary_storage -// CHECK:STDOUT: %.loc27_5.3: init %Point to %.loc27_5.2 = class_init () [concrete = constants.%Point.val] -// CHECK:STDOUT: %.loc27_7.1: init %Point = converted %.loc27_5.1, %.loc27_5.3 [concrete = constants.%Point.val] -// CHECK:STDOUT: %Z.ref.loc27: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type] +// CHECK:STDOUT: %.loc31_5.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %Point.ref.loc31: type = name_ref Point, file.%Point.decl [concrete = constants.%Point] +// CHECK:STDOUT: %.loc31_5.2: ref %Point = temporary_storage +// CHECK:STDOUT: %.loc31_5.3: init %Point to %.loc31_5.2 = class_init () [concrete = constants.%Point.val] +// CHECK:STDOUT: %.loc31_7.1: init %Point = converted %.loc31_5.1, %.loc31_5.3 [concrete = constants.%Point.val] +// CHECK:STDOUT: %Z.ref.loc31: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type] // CHECK:STDOUT: %Method.ref: %Z.assoc_type = name_ref Method, @Z.WithSelf.%assoc1 [concrete = constants.%assoc1] // CHECK:STDOUT: %impl.elem1: %.18a = impl_witness_access constants.%Z.impl_witness, element1 [concrete = constants.%Point.as.Z.impl.Method] -// CHECK:STDOUT: %bound_method: = bound_method %.loc27_7.1, %impl.elem1 [concrete = constants.%Point.as.Z.impl.Method.bound] -// CHECK:STDOUT: %.loc27_7.2: ref %Point = temporary %.loc27_5.2, %.loc27_7.1 [concrete = constants.%.e6b] -// CHECK:STDOUT: %.loc27_7.3: %Point = acquire_value %.loc27_7.2 [concrete = constants.%Point.val] -// CHECK:STDOUT: %Point.as.Z.impl.Method.call: init %empty_tuple.type = call %bound_method(%.loc27_7.3) -// CHECK:STDOUT: %Destroy.facet.loc27_7.1: %Destroy.type = facet_value constants.%Point, (constants.%DestroyImpl.impl_witness.222, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc27_7.4: %Destroy.type = converted constants.%Point, %Destroy.facet.loc27_7.1 [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %Destroy.facet.loc27_7.2: %Destroy.type = facet_value constants.%Point, (constants.%DestroyImpl.impl_witness.222, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc27_7.5: %Destroy.type = converted constants.%Point, %Destroy.facet.loc27_7.2 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %bound_method: = bound_method %.loc31_7.1, %impl.elem1 [concrete = constants.%Point.as.Z.impl.Method.bound] +// CHECK:STDOUT: %.loc31_7.2: ref %Point = temporary %.loc31_5.2, %.loc31_7.1 [concrete = constants.%.e6b] +// CHECK:STDOUT: %.loc31_7.3: %Point = acquire_value %.loc31_7.2 [concrete = constants.%Point.val] +// CHECK:STDOUT: %Point.as.Z.impl.Method.call: init %empty_tuple.type = call %bound_method(%.loc31_7.3) +// CHECK:STDOUT: %Destroy.facet.loc31_7.1: %Destroy.type = facet_value constants.%Point, (constants.%DestroyImpl.impl_witness.222, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc31_7.4: %Destroy.type = converted constants.%Point, %Destroy.facet.loc31_7.1 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %Destroy.facet.loc31_7.2: %Destroy.type = facet_value constants.%Point, (constants.%DestroyImpl.impl_witness.222, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc31_7.5: %Destroy.type = converted constants.%Point, %Destroy.facet.loc31_7.2 [concrete = constants.%Destroy.facet] // CHECK:STDOUT: %SelfDestruct.specific_fn: = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet) [concrete = constants.%SelfDestruct.specific_fn] -// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc27_7.2) +// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc31_7.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc27_7.1(%self.param: ref %empty_struct_type) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc31_7.1(%self.param: ref %empty_struct_type) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc27_7.2(%self.param: ref %Point) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc31_7.2(%self.param: ref %Point) = "no_op"; // CHECK:STDOUT: // CHECK:STDOUT: specific @Z.WithSelf(constants.%Self.cb6) { // CHECK:STDOUT: !definition: @@ -532,10 +548,10 @@ class X { // CHECK:STDOUT: // CHECK:STDOUT: specific @.as.Z.impl.Method(constants.%Self.cb6) { // CHECK:STDOUT: %Self => constants.%Self.cb6 -// CHECK:STDOUT: %Self.as_type.loc11_22.1 => constants.%Self.as_type.0cf +// CHECK:STDOUT: %Self.as_type.loc15_22.1 => constants.%Self.as_type.0cf // CHECK:STDOUT: %pattern_type => constants.%pattern_type.52a -// CHECK:STDOUT: %self.param_patt.loc11_22.2 => constants.%self.param_patt.241 -// CHECK:STDOUT: %self.patt.loc11_22.2 => constants.%self.patt.b15 +// CHECK:STDOUT: %self.param_patt.loc15_22.2 => constants.%self.param_patt.241 +// CHECK:STDOUT: %self.patt.loc15_22.2 => constants.%self.patt.b15 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Z.WithSelf(constants.%Z.facet) { @@ -639,7 +655,7 @@ class X { // CHECK:STDOUT: impl_decl @.as.C.impl [concrete] {} { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc15: = impl_self_witness , @C [concrete = ] +// CHECK:STDOUT: %.loc19: = impl_self_witness , @C [concrete = ] // CHECK:STDOUT: %X.as.A.impl.B.decl: %X.as.A.impl.B.type = fn_decl @X.as.A.impl.B [concrete = constants.%X.as.A.impl.B] {} {} // CHECK:STDOUT: %A.impl_witness_table = impl_witness_table (%X.as.A.impl.B.decl), @X.as.A.impl [concrete] // CHECK:STDOUT: %A.impl_witness: = impl_witness %A.impl_witness_table [concrete = constants.%A.impl_witness] diff --git a/toolchain/check/testdata/impl/fail_impl_bad_assoc_const.carbon b/toolchain/check/testdata/impl/fail_impl_bad_assoc_const.carbon index 917fc783f710..cfd6318854e7 100644 --- a/toolchain/check/testdata/impl/fail_impl_bad_assoc_const.carbon +++ b/toolchain/check/testdata/impl/fail_impl_bad_assoc_const.carbon @@ -14,8 +14,17 @@ interface I { let T: type; } -// CHECK:STDERR: fail_impl_bad_assoc_const.carbon:[[@LINE+3]]:1-14: error: associated constant T not given a value in impl of interface I [ImplAssociatedConstantNeedsValue] -// CHECK:STDERR: fail_impl_bad_assoc_const.carbon:[[@LINE-3]]:19-25: note: associated constant declared here [AssociatedConstantHere] +// CHECK:STDERR: ╭─┤ fail_impl_bad_assoc_const.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: │ interface I { let T: type; } +// CHECK:STDERR: · ───┬─── +// CHECK:STDERR: · ╰──┤ associated constant declared here +// CHECK:STDERR: · │ [AssociatedConstantHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ impl () as I {} +// CHECK:STDERR: · ━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: associated constant T not given a value in impl of interface I +// CHECK:STDERR: · ┃ [ImplAssociatedConstantNeedsValue] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as I {} @@ -40,11 +49,11 @@ impl () as I {} // CHECK:STDOUT: } // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {} // CHECK:STDOUT: impl_decl @empty_tuple.type.as.I.impl [concrete] {} { -// CHECK:STDOUT: %.loc20_7.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc20_7.2: type = converted %.loc20_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc29_7.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc29_7.2: type = converted %.loc29_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc20: = impl_self_witness @empty_tuple.type.as.I.impl.%.loc20_7.2, @I [concrete = constants.%.2ef] +// CHECK:STDOUT: %.loc29: = impl_self_witness @empty_tuple.type.as.I.impl.%.loc29_7.2, @I [concrete = constants.%.2ef] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { @@ -64,7 +73,7 @@ impl () as I {} // CHECK:STDOUT: !requires: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @empty_tuple.type.as.I.impl: %.loc20_7.2 as %I.ref { +// CHECK:STDOUT: impl @empty_tuple.type.as.I.impl: %.loc29_7.2 as %I.ref { // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (), @empty_tuple.type.as.I.impl [concrete] // CHECK:STDOUT: %I.impl_witness: = impl_witness %I.impl_witness_table [concrete = constants.%I.impl_witness] // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/fail_impl_bad_assoc_fn.carbon b/toolchain/check/testdata/impl/fail_impl_bad_assoc_fn.carbon index f5d036de6960..a4914d9e793e 100644 --- a/toolchain/check/testdata/impl/fail_impl_bad_assoc_fn.carbon +++ b/toolchain/check/testdata/impl/fail_impl_bad_assoc_fn.carbon @@ -15,16 +15,34 @@ interface I { fn F(); } class NoF { - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+3]]:3-13: error: missing implementation of F in impl of interface I [ImplMissingFunction] - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-4]]:15-21: note: associated function F declared here [AssociatedFunctionHere] + // CHECK:STDERR: ╭─┤ fail_impl_bad_assoc_fn.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ interface I { fn F(); } + // CHECK:STDERR: · ───┬─── + // CHECK:STDERR: · ╰──┤ associated function F declared here + // CHECK:STDERR: · │ [AssociatedFunctionHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ impl as I {} + // CHECK:STDERR: · ━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: missing implementation of F in impl of interface I + // CHECK:STDERR: · ┃ [ImplMissingFunction] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl as I {} } class FNotFunction { impl as I { - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+3]]:5-12: error: associated function F implemented by non-function [ImplFunctionWithNonFunction] - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-12]]:15-21: note: associated function F declared here [AssociatedFunctionHere] + // CHECK:STDERR: ╭─┤ fail_impl_bad_assoc_fn.carbon:[[@LINE+12]]:5 + // CHECK:STDERR: │ interface I { fn F(); } + // CHECK:STDERR: · ───┬─── + // CHECK:STDERR: · ╰──┤ associated function F declared here + // CHECK:STDERR: · │ [AssociatedFunctionHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ class F; + // CHECK:STDERR: · ━━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: associated function F implemented by non-function + // CHECK:STDERR: · ┃ [ImplFunctionWithNonFunction] + // CHECK:STDERR: ╰──── // CHECK:STDERR: class F; } @@ -32,9 +50,18 @@ class FNotFunction { class FExtraParam { impl as I { - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+4]]:5-18: error: 0 arguments passed to function expecting 1 argument [CallArgCountMismatch] - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+3]]:5-18: note: calling function declared here [InCallToEntity] - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-22]]:15-21: note: while building thunk to match the signature of this function [ThunkSignature] + // CHECK:STDERR: ╭─┤ fail_impl_bad_assoc_fn.carbon:[[@LINE+13]]:5 + // CHECK:STDERR: │ interface I { fn F(); } + // CHECK:STDERR: · ─┬───── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ fn F(b: bool); + // CHECK:STDERR: · ━━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: 0 arguments passed to function expecting 1 argument + // CHECK:STDERR: · │ ┃ [CallArgCountMismatch] + // CHECK:STDERR: · ╰────┤ calling function declared here [InCallToEntity] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(b: bool); } @@ -42,9 +69,18 @@ class FExtraParam { class FExtraImplicitParam { impl as I { - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+4]]:5-15: error: 0 arguments passed to function expecting 1 argument [CallArgCountMismatch] - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+3]]:5-15: note: calling function declared here [InCallToEntity] - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-32]]:15-21: note: while building thunk to match the signature of this function [ThunkSignature] + // CHECK:STDERR: ╭─┤ fail_impl_bad_assoc_fn.carbon:[[@LINE+13]]:5 + // CHECK:STDERR: │ interface I { fn F(); } + // CHECK:STDERR: · ─┬───── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ fn F(self); + // CHECK:STDERR: · ━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: 0 arguments passed to function expecting 1 argument + // CHECK:STDERR: · │ ┃ [CallArgCountMismatch] + // CHECK:STDERR: · ╰────┤ calling function declared here [InCallToEntity] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(self); } @@ -53,8 +89,17 @@ class FExtraImplicitParam { // TODO: Should this be permitted? class FExtraReturnType { impl as I { - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+3]]:5-19: error: function redeclaration differs because return type is `bool` [FunctionRedeclReturnTypeDiffers] - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-42]]:15-21: note: previously declared with no return type [FunctionRedeclReturnTypePreviousNoReturn] + // CHECK:STDERR: ╭─┤ fail_impl_bad_assoc_fn.carbon:[[@LINE+12]]:5 + // CHECK:STDERR: │ interface I { fn F(); } + // CHECK:STDERR: · ───┬─── + // CHECK:STDERR: · ╰──┤ previously declared with no return type + // CHECK:STDERR: · │ [FunctionRedeclReturnTypePreviousNoReturn] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ fn F() -> bool; + // CHECK:STDERR: · ━━━━┳━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: function redeclaration differs because return type is `bool` + // CHECK:STDERR: · ┃ [FunctionRedeclReturnTypeDiffers] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn F() -> bool; } @@ -64,9 +109,18 @@ interface J { fn F(self: bool, b: bool) -> bool; } class FMissingParam { impl as J { - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+4]]:5-29: error: 1 argument passed to function expecting 0 arguments [CallArgCountMismatch] - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+3]]:5-29: note: calling function declared here [InCallToEntity] - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-6]]:15-48: note: while building thunk to match the signature of this function [ThunkSignature] + // CHECK:STDERR: ╭─┤ fail_impl_bad_assoc_fn.carbon:[[@LINE+13]]:5 + // CHECK:STDERR: │ interface J { fn F(self: bool, b: bool) -> bool; } + // CHECK:STDERR: · ─┬──────────────────────────────── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ fn F(self: bool) -> bool; + // CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: 1 argument passed to function expecting 0 arguments + // CHECK:STDERR: · │ ┃ [CallArgCountMismatch] + // CHECK:STDERR: · ╰────┤ calling function declared here [InCallToEntity] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(self: bool) -> bool; } @@ -74,8 +128,18 @@ class FMissingParam { class FMissingImplicitParam { impl as J { - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+3]]:5-26: error: member name of type `` in compound member access is not an instance member or an interface member [CompoundMemberAccessDoesNotUseBase] - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-15]]:15-48: note: while building thunk to match the signature of this function [ThunkSignature] + // CHECK:STDERR: ╭─┤ fail_impl_bad_assoc_fn.carbon:[[@LINE+13]]:5 + // CHECK:STDERR: │ interface J { fn F(self: bool, b: bool) -> bool; } + // CHECK:STDERR: · ─┬──────────────────────────────── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ fn F(b: bool) -> bool; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: member name of type `` in compound member access is + // CHECK:STDERR: · ┃ not an instance member or an interface member + // CHECK:STDERR: · ┃ [CompoundMemberAccessDoesNotUseBase] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(b: bool) -> bool; } @@ -83,9 +147,19 @@ class FMissingImplicitParam { class FMissingReturnType { impl as J { - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+4]]:5-30: error: cannot implicitly convert expression of type `()` to `bool` [ConversionFailure] - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+3]]:5-30: note: type `()` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-25]]:15-48: note: while building thunk to match the signature of this function [ThunkSignature] + // CHECK:STDERR: ╭─┤ fail_impl_bad_assoc_fn.carbon:[[@LINE+14]]:5 + // CHECK:STDERR: │ interface J { fn F(self: bool, b: bool) -> bool; } + // CHECK:STDERR: · ─┬──────────────────────────────── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ fn F(self: bool, b: bool); + // CHECK:STDERR: · ━━━━━┳━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `()` to `bool` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `()` does not implement interface `Core.ImplicitAs(bool)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(self: bool, b: bool); } @@ -93,10 +167,23 @@ class FMissingReturnType { class FDifferentParamType { impl as J { - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+5]]:5-38: error: cannot implicitly convert expression of type `bool` to `FDifferentParamType` [ConversionFailure] - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+4]]:5-38: note: type `bool` does not implement interface `Core.ImplicitAs(FDifferentParamType)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+3]]:22-28: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-36]]:15-48: note: while building thunk to match the signature of this function [ThunkSignature] + // CHECK:STDERR: ╭─┤ fail_impl_bad_assoc_fn.carbon:[[@LINE+18]]:5 + // CHECK:STDERR: │ interface J { fn F(self: bool, b: bool) -> bool; } + // CHECK:STDERR: · ─┬──────────────────────────────── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ fn F(self: bool, b: Self) -> bool; + // CHECK:STDERR: · ━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type + // CHECK:STDERR: · │ ┃ `bool` to `FDifferentParamType` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `bool` does not implement interface + // CHECK:STDERR: · │ │ `Core.ImplicitAs(FDifferentParamType)` + // CHECK:STDERR: · │ │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: · ╰──────┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(self: bool, b: Self) -> bool; } @@ -104,10 +191,22 @@ class FDifferentParamType { class FDifferentImplicitParamType { impl as J { - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+5]]:5-32: error: cannot implicitly convert expression of type `bool` to `FDifferentImplicitParamType` [ConversionFailure] - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+4]]:5-32: note: type `bool` does not implement interface `Core.ImplicitAs(FDifferentImplicitParamType)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+3]]:10-13: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-47]]:15-48: note: while building thunk to match the signature of this function [ThunkSignature] + // CHECK:STDERR: ╭─┤ fail_impl_bad_assoc_fn.carbon:[[@LINE+17]]:5 + // CHECK:STDERR: │ interface J { fn F(self: bool, b: bool) -> bool; } + // CHECK:STDERR: · ─┬──────────────────────────────── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ fn F(self, b: bool) -> bool; + // CHECK:STDERR: · ━━━━━┳━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `bool` to + // CHECK:STDERR: · │ ┃ `FDifferentImplicitParamType` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: · ╰──────┤ type `bool` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(FDifferentImplicitParamType)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(self, b: bool) -> bool; } @@ -116,9 +215,20 @@ class FDifferentImplicitParamType { class FDifferentReturnType { impl as J { // TODO: Include an "aka" in this diagnostic to explain that the type `Self` is `FDifferentReturnType`. - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+4]]:5-38: error: cannot implicitly convert expression of type `Self` to `bool` [ConversionFailure] - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+3]]:5-38: note: type `FDifferentReturnType` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-58]]:15-48: note: while building thunk to match the signature of this function [ThunkSignature] + // CHECK:STDERR: ╭─┤ fail_impl_bad_assoc_fn.carbon:[[@LINE+15]]:5 + // CHECK:STDERR: │ interface J { fn F(self: bool, b: bool) -> bool; } + // CHECK:STDERR: · ─┬──────────────────────────────── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ fn F(self: bool, b: bool) -> Self; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `Self` to `bool` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `FDifferentReturnType` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(bool)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(self: bool, b: bool) -> Self; } @@ -130,10 +240,22 @@ interface SelfNested { class SelfNestedBadParam { impl as SelfNested { - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+5]]:5-87: error: cannot implicitly convert expression of type `SelfNestedBadParam` to `i32` [ConversionFailure] - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+4]]:5-87: note: type `SelfNestedBadParam` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+3]]:10-53: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-8]]:3-58: note: while building thunk to match the signature of this function [ThunkSignature] + // CHECK:STDERR: ╭─┤ fail_impl_bad_assoc_fn.carbon:[[@LINE+17]]:5 + // CHECK:STDERR: │ fn F(x: (Self*, {.x: Self, .y: i32})) -> array(Self, 4); + // CHECK:STDERR: · ─────────────┬────────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ fn F(x: (SelfNestedBadParam*, {.x: i32, .y: i32})) -> array(SelfNested... + // CHECK:STDERR: · ━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type + // CHECK:STDERR: · │ ┃ `SelfNestedBadParam` to `i32` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: · ╰──────┤ type `SelfNestedBadParam` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(i32)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(x: (SelfNestedBadParam*, {.x: i32, .y: i32})) -> array(SelfNestedBadParam, 4); } @@ -141,9 +263,22 @@ class SelfNestedBadParam { class SelfNestedBadReturnType { impl as SelfNested { - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+4]]:5-112: error: cannot implicitly convert expression of type `array(SelfNestedBadParam, 4)` to `array(SelfNestedBadReturnType, 4)` [ConversionFailure] - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE+3]]:5-112: note: type `array(SelfNestedBadParam, 4)` does not implement interface `Core.ImplicitAs(array(SelfNestedBadReturnType, 4))` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: fail_impl_bad_assoc_fn.carbon:[[@LINE-18]]:3-58: note: while building thunk to match the signature of this function [ThunkSignature] + // CHECK:STDERR: ╭─┤ fail_impl_bad_assoc_fn.carbon:[[@LINE+17]]:5 + // CHECK:STDERR: │ fn F(x: (Self*, {.x: Self, .y: i32})) -> array(Self, 4); + // CHECK:STDERR: · ─────────────┬────────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ fn F(x: (SelfNestedBadReturnType*, {.x: SelfNestedBadReturnType, .y: i... + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type + // CHECK:STDERR: · │ ┃ `array(SelfNestedBadParam, 4)` to + // CHECK:STDERR: · │ ┃ `array(SelfNestedBadReturnType, 4)` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `array(SelfNestedBadParam, 4)` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(array(SelfNestedBadReturnType, 4))` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(x: (SelfNestedBadReturnType*, {.x: SelfNestedBadReturnType, .y: i32})) -> array(SelfNestedBadParam, 4); } @@ -182,12 +317,12 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %pattern_type.831: type = pattern_type bool [concrete] // CHECK:STDOUT: %b.param_patt.792: %pattern_type.831 = value_param_pattern [concrete] // CHECK:STDOUT: %b.patt.d80: %pattern_type.831 = wrapper_binding_pattern b, %b.param_patt.792 [concrete] -// CHECK:STDOUT: %FExtraParam.as.I.impl.F.type.ec7b0b.1: type = fn_type @FExtraParam.as.I.impl.F.loc39_18.1 [concrete] +// CHECK:STDOUT: %FExtraParam.as.I.impl.F.type.ec7b0b.1: type = fn_type @FExtraParam.as.I.impl.F.loc66_18.1 [concrete] // CHECK:STDOUT: %FExtraParam.as.I.impl.F.ef9801.1: %FExtraParam.as.I.impl.F.type.ec7b0b.1 = struct_value () [concrete] // CHECK:STDOUT: %I.facet.476: %I.type = facet_value %FExtraParam, (%I.impl_witness.0d1) [concrete] // CHECK:STDOUT: %I.WithSelf.F.type.f2e: type = fn_type @I.WithSelf.F, @I.WithSelf(%I.facet.476) [concrete] // CHECK:STDOUT: %I.WithSelf.F.91f: %I.WithSelf.F.type.f2e = struct_value () [concrete] -// CHECK:STDOUT: %FExtraParam.as.I.impl.F.type.ec7b0b.2: type = fn_type @FExtraParam.as.I.impl.F.loc39_18.2 [concrete] +// CHECK:STDOUT: %FExtraParam.as.I.impl.F.type.ec7b0b.2: type = fn_type @FExtraParam.as.I.impl.F.loc66_18.2 [concrete] // CHECK:STDOUT: %FExtraParam.as.I.impl.F.ef9801.2: %FExtraParam.as.I.impl.F.type.ec7b0b.2 = struct_value () [concrete] // CHECK:STDOUT: %FExtraImplicitParam: type = class_type @FExtraImplicitParam [concrete] // CHECK:STDOUT: %.77c: = impl_self_witness %FExtraImplicitParam, @I [concrete] @@ -195,12 +330,12 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %pattern_type.54d: type = pattern_type %FExtraImplicitParam [concrete] // CHECK:STDOUT: %self.param_patt.f41: %pattern_type.54d = value_param_pattern [concrete] // CHECK:STDOUT: %self.patt.cca: %pattern_type.54d = wrapper_binding_pattern self, %self.param_patt.f41 [concrete] -// CHECK:STDOUT: %FExtraImplicitParam.as.I.impl.F.type.54cac2.1: type = fn_type @FExtraImplicitParam.as.I.impl.F.loc49_15.1 [concrete] +// CHECK:STDOUT: %FExtraImplicitParam.as.I.impl.F.type.54cac2.1: type = fn_type @FExtraImplicitParam.as.I.impl.F.loc85_15.1 [concrete] // CHECK:STDOUT: %FExtraImplicitParam.as.I.impl.F.a42f35.1: %FExtraImplicitParam.as.I.impl.F.type.54cac2.1 = struct_value () [concrete] // CHECK:STDOUT: %I.facet.7ed: %I.type = facet_value %FExtraImplicitParam, (%I.impl_witness.989) [concrete] // CHECK:STDOUT: %I.WithSelf.F.type.0ed: type = fn_type @I.WithSelf.F, @I.WithSelf(%I.facet.7ed) [concrete] // CHECK:STDOUT: %I.WithSelf.F.ec4: %I.WithSelf.F.type.0ed = struct_value () [concrete] -// CHECK:STDOUT: %FExtraImplicitParam.as.I.impl.F.type.54cac2.2: type = fn_type @FExtraImplicitParam.as.I.impl.F.loc49_15.2 [concrete] +// CHECK:STDOUT: %FExtraImplicitParam.as.I.impl.F.type.54cac2.2: type = fn_type @FExtraImplicitParam.as.I.impl.F.loc85_15.2 [concrete] // CHECK:STDOUT: %FExtraImplicitParam.as.I.impl.F.a42f35.2: %FExtraImplicitParam.as.I.impl.F.type.54cac2.2 = struct_value () [concrete] // CHECK:STDOUT: %FExtraReturnType: type = class_type @FExtraReturnType [concrete] // CHECK:STDOUT: %.ebd: = impl_self_witness %FExtraReturnType, @I [concrete] @@ -224,32 +359,32 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %FMissingParam: type = class_type @FMissingParam [concrete] // CHECK:STDOUT: %.599: = impl_self_witness %FMissingParam, @J [concrete] // CHECK:STDOUT: %J.impl_witness.24e: = impl_witness @FMissingParam.as.J.impl.%J.impl_witness_table [concrete] -// CHECK:STDOUT: %FMissingParam.as.J.impl.F.type.aad6ec.1: type = fn_type @FMissingParam.as.J.impl.F.loc71_29.1 [concrete] +// CHECK:STDOUT: %FMissingParam.as.J.impl.F.type.aad6ec.1: type = fn_type @FMissingParam.as.J.impl.F.loc125_29.1 [concrete] // CHECK:STDOUT: %FMissingParam.as.J.impl.F.dd09dc.1: %FMissingParam.as.J.impl.F.type.aad6ec.1 = struct_value () [concrete] // CHECK:STDOUT: %J.facet.2a3: %J.type = facet_value %FMissingParam, (%J.impl_witness.24e) [concrete] // CHECK:STDOUT: %J.WithSelf.F.type.38e: type = fn_type @J.WithSelf.F, @J.WithSelf(%J.facet.2a3) [concrete] // CHECK:STDOUT: %J.WithSelf.F.433: %J.WithSelf.F.type.38e = struct_value () [concrete] -// CHECK:STDOUT: %FMissingParam.as.J.impl.F.type.aad6ec.2: type = fn_type @FMissingParam.as.J.impl.F.loc71_29.2 [concrete] +// CHECK:STDOUT: %FMissingParam.as.J.impl.F.type.aad6ec.2: type = fn_type @FMissingParam.as.J.impl.F.loc125_29.2 [concrete] // CHECK:STDOUT: %FMissingParam.as.J.impl.F.dd09dc.2: %FMissingParam.as.J.impl.F.type.aad6ec.2 = struct_value () [concrete] // CHECK:STDOUT: %FMissingImplicitParam: type = class_type @FMissingImplicitParam [concrete] // CHECK:STDOUT: %.f79: = impl_self_witness %FMissingImplicitParam, @J [concrete] // CHECK:STDOUT: %J.impl_witness.0d0: = impl_witness @FMissingImplicitParam.as.J.impl.%J.impl_witness_table [concrete] -// CHECK:STDOUT: %FMissingImplicitParam.as.J.impl.F.type.f666a8.1: type = fn_type @FMissingImplicitParam.as.J.impl.F.loc80_26.1 [concrete] +// CHECK:STDOUT: %FMissingImplicitParam.as.J.impl.F.type.f666a8.1: type = fn_type @FMissingImplicitParam.as.J.impl.F.loc144_26.1 [concrete] // CHECK:STDOUT: %FMissingImplicitParam.as.J.impl.F.620ed1.1: %FMissingImplicitParam.as.J.impl.F.type.f666a8.1 = struct_value () [concrete] // CHECK:STDOUT: %J.facet.ba1: %J.type = facet_value %FMissingImplicitParam, (%J.impl_witness.0d0) [concrete] // CHECK:STDOUT: %J.WithSelf.F.type.5df: type = fn_type @J.WithSelf.F, @J.WithSelf(%J.facet.ba1) [concrete] // CHECK:STDOUT: %J.WithSelf.F.44b: %J.WithSelf.F.type.5df = struct_value () [concrete] -// CHECK:STDOUT: %FMissingImplicitParam.as.J.impl.F.type.f666a8.2: type = fn_type @FMissingImplicitParam.as.J.impl.F.loc80_26.2 [concrete] +// CHECK:STDOUT: %FMissingImplicitParam.as.J.impl.F.type.f666a8.2: type = fn_type @FMissingImplicitParam.as.J.impl.F.loc144_26.2 [concrete] // CHECK:STDOUT: %FMissingImplicitParam.as.J.impl.F.620ed1.2: %FMissingImplicitParam.as.J.impl.F.type.f666a8.2 = struct_value () [concrete] // CHECK:STDOUT: %FMissingReturnType: type = class_type @FMissingReturnType [concrete] // CHECK:STDOUT: %.199: = impl_self_witness %FMissingReturnType, @J [concrete] // CHECK:STDOUT: %J.impl_witness.50a: = impl_witness @FMissingReturnType.as.J.impl.%J.impl_witness_table [concrete] -// CHECK:STDOUT: %FMissingReturnType.as.J.impl.F.type.9cd56a.1: type = fn_type @FMissingReturnType.as.J.impl.F.loc90_30.1 [concrete] +// CHECK:STDOUT: %FMissingReturnType.as.J.impl.F.type.9cd56a.1: type = fn_type @FMissingReturnType.as.J.impl.F.loc164_30.1 [concrete] // CHECK:STDOUT: %FMissingReturnType.as.J.impl.F.6975be.1: %FMissingReturnType.as.J.impl.F.type.9cd56a.1 = struct_value () [concrete] // CHECK:STDOUT: %J.facet.b68: %J.type = facet_value %FMissingReturnType, (%J.impl_witness.50a) [concrete] // CHECK:STDOUT: %J.WithSelf.F.type.628: type = fn_type @J.WithSelf.F, @J.WithSelf(%J.facet.b68) [concrete] // CHECK:STDOUT: %J.WithSelf.F.70e: %J.WithSelf.F.type.628 = struct_value () [concrete] -// CHECK:STDOUT: %FMissingReturnType.as.J.impl.F.type.9cd56a.2: type = fn_type @FMissingReturnType.as.J.impl.F.loc90_30.2 [concrete] +// CHECK:STDOUT: %FMissingReturnType.as.J.impl.F.type.9cd56a.2: type = fn_type @FMissingReturnType.as.J.impl.F.loc164_30.2 [concrete] // CHECK:STDOUT: %FMissingReturnType.as.J.impl.F.6975be.2: %FMissingReturnType.as.J.impl.F.type.9cd56a.2 = struct_value () [concrete] // CHECK:STDOUT: %ImplicitAs.type.0ff: type = generic_interface_type @ImplicitAs [concrete] // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.0ff = struct_value () [concrete] @@ -259,12 +394,12 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %pattern_type.5d3: type = pattern_type %FDifferentParamType [concrete] // CHECK:STDOUT: %b.param_patt.0a8: %pattern_type.5d3 = value_param_pattern [concrete] // CHECK:STDOUT: %b.patt.f7e: %pattern_type.5d3 = wrapper_binding_pattern b, %b.param_patt.0a8 [concrete] -// CHECK:STDOUT: %FDifferentParamType.as.J.impl.F.type.4a2e9b.1: type = fn_type @FDifferentParamType.as.J.impl.F.loc101_38.1 [concrete] +// CHECK:STDOUT: %FDifferentParamType.as.J.impl.F.type.4a2e9b.1: type = fn_type @FDifferentParamType.as.J.impl.F.loc188_38.1 [concrete] // CHECK:STDOUT: %FDifferentParamType.as.J.impl.F.28602a.1: %FDifferentParamType.as.J.impl.F.type.4a2e9b.1 = struct_value () [concrete] // CHECK:STDOUT: %J.facet.73e: %J.type = facet_value %FDifferentParamType, (%J.impl_witness.9e2) [concrete] // CHECK:STDOUT: %J.WithSelf.F.type.fec: type = fn_type @J.WithSelf.F, @J.WithSelf(%J.facet.73e) [concrete] // CHECK:STDOUT: %J.WithSelf.F.236: %J.WithSelf.F.type.fec = struct_value () [concrete] -// CHECK:STDOUT: %FDifferentParamType.as.J.impl.F.type.4a2e9b.2: type = fn_type @FDifferentParamType.as.J.impl.F.loc101_38.2 [concrete] +// CHECK:STDOUT: %FDifferentParamType.as.J.impl.F.type.4a2e9b.2: type = fn_type @FDifferentParamType.as.J.impl.F.loc188_38.2 [concrete] // CHECK:STDOUT: %FDifferentParamType.as.J.impl.F.28602a.2: %FDifferentParamType.as.J.impl.F.type.4a2e9b.2 = struct_value () [concrete] // CHECK:STDOUT: %FDifferentImplicitParamType: type = class_type @FDifferentImplicitParamType [concrete] // CHECK:STDOUT: %.46c: = impl_self_witness %FDifferentImplicitParamType, @J [concrete] @@ -272,12 +407,12 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %pattern_type.1bc: type = pattern_type %FDifferentImplicitParamType [concrete] // CHECK:STDOUT: %self.param_patt.ea6: %pattern_type.1bc = value_param_pattern [concrete] // CHECK:STDOUT: %self.patt.85b: %pattern_type.1bc = wrapper_binding_pattern self, %self.param_patt.ea6 [concrete] -// CHECK:STDOUT: %FDifferentImplicitParamType.as.J.impl.F.type.6ef8a6.1: type = fn_type @FDifferentImplicitParamType.as.J.impl.F.loc112_32.1 [concrete] +// CHECK:STDOUT: %FDifferentImplicitParamType.as.J.impl.F.type.6ef8a6.1: type = fn_type @FDifferentImplicitParamType.as.J.impl.F.loc211_32.1 [concrete] // CHECK:STDOUT: %FDifferentImplicitParamType.as.J.impl.F.792c78.1: %FDifferentImplicitParamType.as.J.impl.F.type.6ef8a6.1 = struct_value () [concrete] // CHECK:STDOUT: %J.facet.00a: %J.type = facet_value %FDifferentImplicitParamType, (%J.impl_witness.d1a) [concrete] // CHECK:STDOUT: %J.WithSelf.F.type.fa8: type = fn_type @J.WithSelf.F, @J.WithSelf(%J.facet.00a) [concrete] // CHECK:STDOUT: %J.WithSelf.F.a0b: %J.WithSelf.F.type.fa8 = struct_value () [concrete] -// CHECK:STDOUT: %FDifferentImplicitParamType.as.J.impl.F.type.6ef8a6.2: type = fn_type @FDifferentImplicitParamType.as.J.impl.F.loc112_32.2 [concrete] +// CHECK:STDOUT: %FDifferentImplicitParamType.as.J.impl.F.type.6ef8a6.2: type = fn_type @FDifferentImplicitParamType.as.J.impl.F.loc211_32.2 [concrete] // CHECK:STDOUT: %FDifferentImplicitParamType.as.J.impl.F.792c78.2: %FDifferentImplicitParamType.as.J.impl.F.type.6ef8a6.2 = struct_value () [concrete] // CHECK:STDOUT: %FDifferentReturnType: type = class_type @FDifferentReturnType [concrete] // CHECK:STDOUT: %.ce7: = impl_self_witness %FDifferentReturnType, @J [concrete] @@ -286,12 +421,12 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %pattern_type.b9f: type = pattern_type %FDifferentReturnType [concrete] // CHECK:STDOUT: %return.param_patt.f37: %pattern_type.b9f = out_param_pattern [concrete] // CHECK:STDOUT: %return.patt.e4f: %pattern_type.b9f = return_slot_pattern %return.param_patt.f37, %FDifferentReturnType [concrete] -// CHECK:STDOUT: %FDifferentReturnType.as.J.impl.F.type.ff55f4.1: type = fn_type @FDifferentReturnType.as.J.impl.F.loc123_38.1 [concrete] +// CHECK:STDOUT: %FDifferentReturnType.as.J.impl.F.type.ff55f4.1: type = fn_type @FDifferentReturnType.as.J.impl.F.loc233_38.1 [concrete] // CHECK:STDOUT: %FDifferentReturnType.as.J.impl.F.9725a5.1: %FDifferentReturnType.as.J.impl.F.type.ff55f4.1 = struct_value () [concrete] // CHECK:STDOUT: %J.facet.6a7: %J.type = facet_value %FDifferentReturnType, (%J.impl_witness.6a4) [concrete] // CHECK:STDOUT: %J.WithSelf.F.type.b41: type = fn_type @J.WithSelf.F, @J.WithSelf(%J.facet.6a7) [concrete] // CHECK:STDOUT: %J.WithSelf.F.982: %J.WithSelf.F.type.b41 = struct_value () [concrete] -// CHECK:STDOUT: %FDifferentReturnType.as.J.impl.F.type.ff55f4.2: type = fn_type @FDifferentReturnType.as.J.impl.F.loc123_38.2 [concrete] +// CHECK:STDOUT: %FDifferentReturnType.as.J.impl.F.type.ff55f4.2: type = fn_type @FDifferentReturnType.as.J.impl.F.loc233_38.2 [concrete] // CHECK:STDOUT: %FDifferentReturnType.as.J.impl.F.9725a5.2: %FDifferentReturnType.as.J.impl.F.type.ff55f4.2 = struct_value () [concrete] // CHECK:STDOUT: %SelfNested.type: type = facet_type <@SelfNested> [concrete] // CHECK:STDOUT: %Self.e81: %SelfNested.type = symbolic_binding Self, 0 [symbolic] @@ -335,7 +470,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %pattern_type.ec1: type = pattern_type %Array.870 [concrete] // CHECK:STDOUT: %return.param_patt.8ed: %pattern_type.ec1 = out_param_pattern [concrete] // CHECK:STDOUT: %return.patt.21a: %pattern_type.ec1 = return_slot_pattern %return.param_patt.8ed, %Array.870 [concrete] -// CHECK:STDOUT: %SelfNestedBadParam.as.SelfNested.impl.F.type.4325e7.1: type = fn_type @SelfNestedBadParam.as.SelfNested.impl.F.loc138_87.1 [concrete] +// CHECK:STDOUT: %SelfNestedBadParam.as.SelfNested.impl.F.type.4325e7.1: type = fn_type @SelfNestedBadParam.as.SelfNested.impl.F.loc260_87.1 [concrete] // CHECK:STDOUT: %SelfNestedBadParam.as.SelfNested.impl.F.5fd896.1: %SelfNestedBadParam.as.SelfNested.impl.F.type.4325e7.1 = struct_value () [concrete] // CHECK:STDOUT: %SelfNested.facet.d0d: %SelfNested.type = facet_value %SelfNestedBadParam, (%SelfNested.impl_witness.09d) [concrete] // CHECK:STDOUT: %SelfNested.WithSelf.F.type.49e: type = fn_type @SelfNested.WithSelf.F, @SelfNested.WithSelf(%SelfNested.facet.d0d) [concrete] @@ -346,7 +481,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %pattern_type.1ec: type = pattern_type %tuple.type.5e1 [concrete] // CHECK:STDOUT: %x.param_patt.255: %pattern_type.1ec = value_param_pattern [concrete] // CHECK:STDOUT: %x.patt.79a: %pattern_type.1ec = wrapper_binding_pattern x, %x.param_patt.255 [concrete] -// CHECK:STDOUT: %SelfNestedBadParam.as.SelfNested.impl.F.type.4325e7.2: type = fn_type @SelfNestedBadParam.as.SelfNested.impl.F.loc138_87.2 [concrete] +// CHECK:STDOUT: %SelfNestedBadParam.as.SelfNested.impl.F.type.4325e7.2: type = fn_type @SelfNestedBadParam.as.SelfNested.impl.F.loc260_87.2 [concrete] // CHECK:STDOUT: %SelfNestedBadParam.as.SelfNested.impl.F.5fd896.2: %SelfNestedBadParam.as.SelfNested.impl.F.type.4325e7.2 = struct_value () [concrete] // CHECK:STDOUT: %SelfNestedBadReturnType: type = class_type @SelfNestedBadReturnType [concrete] // CHECK:STDOUT: %.020: = impl_self_witness %SelfNestedBadReturnType, @SelfNested [concrete] @@ -358,7 +493,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %pattern_type.7fc: type = pattern_type %tuple.type.dce [concrete] // CHECK:STDOUT: %x.param_patt.04c: %pattern_type.7fc = value_param_pattern [concrete] // CHECK:STDOUT: %x.patt.10a: %pattern_type.7fc = wrapper_binding_pattern x, %x.param_patt.04c [concrete] -// CHECK:STDOUT: %SelfNestedBadReturnType.as.SelfNested.impl.F.type.1cbabe.1: type = fn_type @SelfNestedBadReturnType.as.SelfNested.impl.F.loc148_112.1 [concrete] +// CHECK:STDOUT: %SelfNestedBadReturnType.as.SelfNested.impl.F.type.1cbabe.1: type = fn_type @SelfNestedBadReturnType.as.SelfNested.impl.F.loc283_112.1 [concrete] // CHECK:STDOUT: %SelfNestedBadReturnType.as.SelfNested.impl.F.5a7d54.1: %SelfNestedBadReturnType.as.SelfNested.impl.F.type.1cbabe.1 = struct_value () [concrete] // CHECK:STDOUT: %SelfNested.facet.e71: %SelfNested.type = facet_value %SelfNestedBadReturnType, (%SelfNested.impl_witness.849) [concrete] // CHECK:STDOUT: %SelfNested.WithSelf.F.type.369: type = fn_type @SelfNested.WithSelf.F, @SelfNested.WithSelf(%SelfNested.facet.e71) [concrete] @@ -368,7 +503,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %pattern_type.5b0: type = pattern_type %Array.ce4 [concrete] // CHECK:STDOUT: %return.param_patt.c20: %pattern_type.5b0 = out_param_pattern [concrete] // CHECK:STDOUT: %return.patt.02d: %pattern_type.5b0 = return_slot_pattern %return.param_patt.c20, %Array.ce4 [concrete] -// CHECK:STDOUT: %SelfNestedBadReturnType.as.SelfNested.impl.F.type.1cbabe.2: type = fn_type @SelfNestedBadReturnType.as.SelfNested.impl.F.loc148_112.2 [concrete] +// CHECK:STDOUT: %SelfNestedBadReturnType.as.SelfNested.impl.F.type.1cbabe.2: type = fn_type @SelfNestedBadReturnType.as.SelfNested.impl.F.loc283_112.2 [concrete] // CHECK:STDOUT: %SelfNestedBadReturnType.as.SelfNested.impl.F.5a7d54.2: %SelfNestedBadReturnType.as.SelfNested.impl.F.type.1cbabe.2 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -453,15 +588,15 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %b.param_patt: %pattern_type.831 = value_param_pattern [concrete = constants.%b.param_patt.792] // CHECK:STDOUT: %b.patt: %pattern_type.831 = wrapper_binding_pattern b, %b.param_patt [concrete = constants.%b.patt.d80] // CHECK:STDOUT: %return.param_patt: %pattern_type.831 = out_param_pattern [concrete = constants.%return.param_patt.5a1] -// CHECK:STDOUT: %return.patt: %pattern_type.831 = return_slot_pattern %return.param_patt, %.loc63_44.1 [concrete = constants.%return.patt.c0c] +// CHECK:STDOUT: %return.patt: %pattern_type.831 = return_slot_pattern %return.param_patt, %.loc108_44.1 [concrete = constants.%return.patt.c0c] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc63_44.1: type = type_literal bool [concrete = bool] -// CHECK:STDOUT: %.loc63_44.2: Core.Form = init_form %.loc63_44.1 [concrete = constants.%.f34] +// CHECK:STDOUT: %.loc108_44.1: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %.loc108_44.2: Core.Form = init_form %.loc108_44.1 [concrete = constants.%.f34] // CHECK:STDOUT: %self.param: bool = value_param call_param0 -// CHECK:STDOUT: %.loc63_26: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %.loc108_26: type = type_literal bool [concrete = bool] // CHECK:STDOUT: %self: bool = wrapper_binding self, %self.param // CHECK:STDOUT: %b.param: bool = value_param call_param1 -// CHECK:STDOUT: %.loc63_35: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %.loc108_35: type = type_literal bool [concrete = bool] // CHECK:STDOUT: %b: bool = wrapper_binding b, %b.param // CHECK:STDOUT: %return.param: ref bool = out_param call_param2 // CHECK:STDOUT: %return: ref bool = return_slot %return.param @@ -482,34 +617,34 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: // CHECK:STDOUT: !with Self: // CHECK:STDOUT: %SelfNested.WithSelf.F.decl: @SelfNested.WithSelf.%SelfNested.WithSelf.F.type (%SelfNested.WithSelf.F.type.3a1) = fn_decl @SelfNested.WithSelf.F [symbolic = @SelfNested.WithSelf.%SelfNested.WithSelf.F (constants.%SelfNested.WithSelf.F.796)] { -// CHECK:STDOUT: %x.param_patt.loc128_9.1: @SelfNested.WithSelf.F.%pattern_type.loc128_9 (%pattern_type.871) = value_param_pattern [symbolic = %x.param_patt.loc128_9.2 (constants.%x.param_patt.8f6)] -// CHECK:STDOUT: %x.patt.loc128_9.1: @SelfNested.WithSelf.F.%pattern_type.loc128_9 (%pattern_type.871) = wrapper_binding_pattern x, %x.param_patt.loc128_9.1 [symbolic = %x.patt.loc128_9.2 (constants.%x.patt.48b)] -// CHECK:STDOUT: %return.param_patt.loc128_57.1: @SelfNested.WithSelf.F.%pattern_type.loc128_57 (%pattern_type.4a4) = out_param_pattern [symbolic = %return.param_patt.loc128_57.2 (constants.%return.param_patt.36b)] -// CHECK:STDOUT: %return.patt.loc128_41.1: @SelfNested.WithSelf.F.%pattern_type.loc128_57 (%pattern_type.4a4) = return_slot_pattern %return.param_patt.loc128_57.1, %Array.loc128_57.2 [symbolic = %return.patt.loc128_41.2 (constants.%return.patt.7a8)] +// CHECK:STDOUT: %x.param_patt.loc238_9.1: @SelfNested.WithSelf.F.%pattern_type.loc238_9 (%pattern_type.871) = value_param_pattern [symbolic = %x.param_patt.loc238_9.2 (constants.%x.param_patt.8f6)] +// CHECK:STDOUT: %x.patt.loc238_9.1: @SelfNested.WithSelf.F.%pattern_type.loc238_9 (%pattern_type.871) = wrapper_binding_pattern x, %x.param_patt.loc238_9.1 [symbolic = %x.patt.loc238_9.2 (constants.%x.patt.48b)] +// CHECK:STDOUT: %return.param_patt.loc238_57.1: @SelfNested.WithSelf.F.%pattern_type.loc238_57 (%pattern_type.4a4) = out_param_pattern [symbolic = %return.param_patt.loc238_57.2 (constants.%return.param_patt.36b)] +// CHECK:STDOUT: %return.patt.loc238_41.1: @SelfNested.WithSelf.F.%pattern_type.loc238_57 (%pattern_type.4a4) = return_slot_pattern %return.param_patt.loc238_57.1, %Array.loc238_57.2 [symbolic = %return.patt.loc238_41.2 (constants.%return.patt.7a8)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %Self.ref.loc128_50: %SelfNested.type = name_ref Self, @SelfNested.%Self [symbolic = %Self (constants.%Self.e81)] +// CHECK:STDOUT: %Self.ref.loc238_50: %SelfNested.type = name_ref Self, @SelfNested.%Self [symbolic = %Self (constants.%Self.e81)] // CHECK:STDOUT: %int_4: Core.IntLiteral = int_value 4 [concrete = constants.%int_4] -// CHECK:STDOUT: %Self.as_type.loc128_50: type = facet_access_type %Self.ref.loc128_50 [symbolic = %Self.as_type.loc128_16.1 (constants.%Self.as_type.8ab)] -// CHECK:STDOUT: %.loc128_50: type = converted %Self.ref.loc128_50, %Self.as_type.loc128_50 [symbolic = %Self.as_type.loc128_16.1 (constants.%Self.as_type.8ab)] -// CHECK:STDOUT: %Array.loc128_57.2: type = class_type @Array, @Array(constants.%Self.as_type.8ab, constants.%int_4) [symbolic = %Array.loc128_57.1 (constants.%Array.d32)] -// CHECK:STDOUT: %.loc128_57.2: Core.Form = init_form %Array.loc128_57.2 [symbolic = %.loc128_57.1 (constants.%.ec2)] +// CHECK:STDOUT: %Self.as_type.loc238_50: type = facet_access_type %Self.ref.loc238_50 [symbolic = %Self.as_type.loc238_16.1 (constants.%Self.as_type.8ab)] +// CHECK:STDOUT: %.loc238_50: type = converted %Self.ref.loc238_50, %Self.as_type.loc238_50 [symbolic = %Self.as_type.loc238_16.1 (constants.%Self.as_type.8ab)] +// CHECK:STDOUT: %Array.loc238_57.2: type = class_type @Array, @Array(constants.%Self.as_type.8ab, constants.%int_4) [symbolic = %Array.loc238_57.1 (constants.%Array.d32)] +// CHECK:STDOUT: %.loc238_57.2: Core.Form = init_form %Array.loc238_57.2 [symbolic = %.loc238_57.1 (constants.%.ec2)] // CHECK:STDOUT: %x.param: @SelfNested.WithSelf.F.%tuple.type (%tuple.type.684) = value_param call_param0 -// CHECK:STDOUT: %.loc128_38.1: type = splice_block %.loc128_38.3 [symbolic = %tuple.type (constants.%tuple.type.684)] { -// CHECK:STDOUT: %Self.ref.loc128_12: %SelfNested.type = name_ref Self, @SelfNested.%Self [symbolic = %Self (constants.%Self.e81)] -// CHECK:STDOUT: %Self.as_type.loc128_16.2: type = facet_access_type %Self.ref.loc128_12 [symbolic = %Self.as_type.loc128_16.1 (constants.%Self.as_type.8ab)] -// CHECK:STDOUT: %.loc128_16: type = converted %Self.ref.loc128_12, %Self.as_type.loc128_16.2 [symbolic = %Self.as_type.loc128_16.1 (constants.%Self.as_type.8ab)] -// CHECK:STDOUT: %ptr.loc128_16.2: type = ptr_type %.loc128_16 [symbolic = %ptr.loc128_16.1 (constants.%ptr.a16)] -// CHECK:STDOUT: %Self.ref.loc128_24: %SelfNested.type = name_ref Self, @SelfNested.%Self [symbolic = %Self (constants.%Self.e81)] -// CHECK:STDOUT: %Self.as_type.loc128_24: type = facet_access_type %Self.ref.loc128_24 [symbolic = %Self.as_type.loc128_16.1 (constants.%Self.as_type.8ab)] -// CHECK:STDOUT: %.loc128_24: type = converted %Self.ref.loc128_24, %Self.as_type.loc128_24 [symbolic = %Self.as_type.loc128_16.1 (constants.%Self.as_type.8ab)] +// CHECK:STDOUT: %.loc238_38.1: type = splice_block %.loc238_38.3 [symbolic = %tuple.type (constants.%tuple.type.684)] { +// CHECK:STDOUT: %Self.ref.loc238_12: %SelfNested.type = name_ref Self, @SelfNested.%Self [symbolic = %Self (constants.%Self.e81)] +// CHECK:STDOUT: %Self.as_type.loc238_16.2: type = facet_access_type %Self.ref.loc238_12 [symbolic = %Self.as_type.loc238_16.1 (constants.%Self.as_type.8ab)] +// CHECK:STDOUT: %.loc238_16: type = converted %Self.ref.loc238_12, %Self.as_type.loc238_16.2 [symbolic = %Self.as_type.loc238_16.1 (constants.%Self.as_type.8ab)] +// CHECK:STDOUT: %ptr.loc238_16.2: type = ptr_type %.loc238_16 [symbolic = %ptr.loc238_16.1 (constants.%ptr.a16)] +// CHECK:STDOUT: %Self.ref.loc238_24: %SelfNested.type = name_ref Self, @SelfNested.%Self [symbolic = %Self (constants.%Self.e81)] +// CHECK:STDOUT: %Self.as_type.loc238_24: type = facet_access_type %Self.ref.loc238_24 [symbolic = %Self.as_type.loc238_16.1 (constants.%Self.as_type.8ab)] +// CHECK:STDOUT: %.loc238_24: type = converted %Self.ref.loc238_24, %Self.as_type.loc238_24 [symbolic = %Self.as_type.loc238_16.1 (constants.%Self.as_type.8ab)] // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %struct_type.x.y.loc128_37.2: type = struct_type {.x: @SelfNested.WithSelf.F.%Self.as_type.loc128_16.1 (%Self.as_type.8ab), .y: %i32} [symbolic = %struct_type.x.y.loc128_37.1 (constants.%struct_type.x.y.34d)] -// CHECK:STDOUT: %.loc128_38.2: %tuple.type.693 = tuple_literal (%ptr.loc128_16.2, %struct_type.x.y.loc128_37.2) [symbolic = %tuple (constants.%tuple.ea4)] -// CHECK:STDOUT: %.loc128_38.3: type = converted %.loc128_38.2, constants.%tuple.type.684 [symbolic = %tuple.type (constants.%tuple.type.684)] +// CHECK:STDOUT: %struct_type.x.y.loc238_37.2: type = struct_type {.x: @SelfNested.WithSelf.F.%Self.as_type.loc238_16.1 (%Self.as_type.8ab), .y: %i32} [symbolic = %struct_type.x.y.loc238_37.1 (constants.%struct_type.x.y.34d)] +// CHECK:STDOUT: %.loc238_38.2: %tuple.type.693 = tuple_literal (%ptr.loc238_16.2, %struct_type.x.y.loc238_37.2) [symbolic = %tuple (constants.%tuple.ea4)] +// CHECK:STDOUT: %.loc238_38.3: type = converted %.loc238_38.2, constants.%tuple.type.684 [symbolic = %tuple.type (constants.%tuple.type.684)] // CHECK:STDOUT: } // CHECK:STDOUT: %x: @SelfNested.WithSelf.F.%tuple.type (%tuple.type.684) = wrapper_binding x, %x.param -// CHECK:STDOUT: %return.param: ref @SelfNested.WithSelf.F.%Array.loc128_57.1 (%Array.d32) = out_param call_param1 -// CHECK:STDOUT: %return: ref @SelfNested.WithSelf.F.%Array.loc128_57.1 (%Array.d32) = return_slot %return.param +// CHECK:STDOUT: %return.param: ref @SelfNested.WithSelf.F.%Array.loc238_57.1 (%Array.d32) = out_param call_param1 +// CHECK:STDOUT: %return: ref @SelfNested.WithSelf.F.%Array.loc238_57.1 (%Array.d32) = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: %assoc0: %SelfNested.assoc_type = assoc_entity element0, %SelfNested.WithSelf.F.decl [concrete = constants.%assoc0.5a5] // CHECK:STDOUT: @@ -545,26 +680,26 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @FExtraParam.as.I.impl: %Self.ref as %I.ref { -// CHECK:STDOUT: %FExtraParam.as.I.impl.F.decl.loc39_18.1: %FExtraParam.as.I.impl.F.type.ec7b0b.1 = fn_decl @FExtraParam.as.I.impl.F.loc39_18.1 [concrete = constants.%FExtraParam.as.I.impl.F.ef9801.1] { +// CHECK:STDOUT: %FExtraParam.as.I.impl.F.decl.loc66_18.1: %FExtraParam.as.I.impl.F.type.ec7b0b.1 = fn_decl @FExtraParam.as.I.impl.F.loc66_18.1 [concrete = constants.%FExtraParam.as.I.impl.F.ef9801.1] { // CHECK:STDOUT: %b.param_patt: %pattern_type.831 = value_param_pattern [concrete = constants.%b.param_patt.792] // CHECK:STDOUT: %b.patt: %pattern_type.831 = wrapper_binding_pattern b, %b.param_patt [concrete = constants.%b.patt.d80] // CHECK:STDOUT: } { // CHECK:STDOUT: %b.param: bool = value_param call_param0 -// CHECK:STDOUT: %.loc39: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %.loc66: type = type_literal bool [concrete = bool] // CHECK:STDOUT: %b: bool = wrapper_binding b, %b.param // CHECK:STDOUT: } -// CHECK:STDOUT: %FExtraParam.as.I.impl.F.decl.loc39_18.2: %FExtraParam.as.I.impl.F.type.ec7b0b.2 = fn_decl @FExtraParam.as.I.impl.F.loc39_18.2 [concrete = constants.%FExtraParam.as.I.impl.F.ef9801.2] {} {} -// CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (%FExtraParam.as.I.impl.F.decl.loc39_18.2), @FExtraParam.as.I.impl [concrete] +// CHECK:STDOUT: %FExtraParam.as.I.impl.F.decl.loc66_18.2: %FExtraParam.as.I.impl.F.type.ec7b0b.2 = fn_decl @FExtraParam.as.I.impl.F.loc66_18.2 [concrete = constants.%FExtraParam.as.I.impl.F.ef9801.2] {} {} +// CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (%FExtraParam.as.I.impl.F.decl.loc66_18.2), @FExtraParam.as.I.impl [concrete] // CHECK:STDOUT: %I.impl_witness: = impl_witness %I.impl_witness_table [concrete = constants.%I.impl_witness.0d1] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %FExtraParam.as.I.impl.F.decl.loc39_18.1 +// CHECK:STDOUT: .F = %FExtraParam.as.I.impl.F.decl.loc66_18.1 // CHECK:STDOUT: extend %I.ref // CHECK:STDOUT: witness = %I.impl_witness // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @FExtraImplicitParam.as.I.impl: %Self.ref as %I.ref { -// CHECK:STDOUT: %FExtraImplicitParam.as.I.impl.F.decl.loc49_15.1: %FExtraImplicitParam.as.I.impl.F.type.54cac2.1 = fn_decl @FExtraImplicitParam.as.I.impl.F.loc49_15.1 [concrete = constants.%FExtraImplicitParam.as.I.impl.F.a42f35.1] { +// CHECK:STDOUT: %FExtraImplicitParam.as.I.impl.F.decl.loc85_15.1: %FExtraImplicitParam.as.I.impl.F.type.54cac2.1 = fn_decl @FExtraImplicitParam.as.I.impl.F.loc85_15.1 [concrete = constants.%FExtraImplicitParam.as.I.impl.F.a42f35.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.54d = value_param_pattern [concrete = constants.%self.param_patt.f41] // CHECK:STDOUT: %self.patt: %pattern_type.54d = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.cca] // CHECK:STDOUT: } { @@ -572,12 +707,12 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FExtraImplicitParam [concrete = constants.%FExtraImplicitParam] // CHECK:STDOUT: %self: %FExtraImplicitParam = wrapper_binding self, %self.param // CHECK:STDOUT: } -// CHECK:STDOUT: %FExtraImplicitParam.as.I.impl.F.decl.loc49_15.2: %FExtraImplicitParam.as.I.impl.F.type.54cac2.2 = fn_decl @FExtraImplicitParam.as.I.impl.F.loc49_15.2 [concrete = constants.%FExtraImplicitParam.as.I.impl.F.a42f35.2] {} {} -// CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (%FExtraImplicitParam.as.I.impl.F.decl.loc49_15.2), @FExtraImplicitParam.as.I.impl [concrete] +// CHECK:STDOUT: %FExtraImplicitParam.as.I.impl.F.decl.loc85_15.2: %FExtraImplicitParam.as.I.impl.F.type.54cac2.2 = fn_decl @FExtraImplicitParam.as.I.impl.F.loc85_15.2 [concrete = constants.%FExtraImplicitParam.as.I.impl.F.a42f35.2] {} {} +// CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (%FExtraImplicitParam.as.I.impl.F.decl.loc85_15.2), @FExtraImplicitParam.as.I.impl [concrete] // CHECK:STDOUT: %I.impl_witness: = impl_witness %I.impl_witness_table [concrete = constants.%I.impl_witness.989] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %FExtraImplicitParam.as.I.impl.F.decl.loc49_15.1 +// CHECK:STDOUT: .F = %FExtraImplicitParam.as.I.impl.F.decl.loc85_15.1 // CHECK:STDOUT: extend %I.ref // CHECK:STDOUT: witness = %I.impl_witness // CHECK:STDOUT: } @@ -585,10 +720,10 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: impl @FExtraReturnType.as.I.impl: %Self.ref as %I.ref { // CHECK:STDOUT: %FExtraReturnType.as.I.impl.F.decl: %FExtraReturnType.as.I.impl.F.type = fn_decl @FExtraReturnType.as.I.impl.F [concrete = constants.%FExtraReturnType.as.I.impl.F] { // CHECK:STDOUT: %return.param_patt: %pattern_type.831 = out_param_pattern [concrete = constants.%return.param_patt.5a1] -// CHECK:STDOUT: %return.patt: %pattern_type.831 = return_slot_pattern %return.param_patt, %.loc59_15.1 [concrete = constants.%return.patt.c0c] +// CHECK:STDOUT: %return.patt: %pattern_type.831 = return_slot_pattern %return.param_patt, %.loc104_15.1 [concrete = constants.%return.patt.c0c] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc59_15.1: type = type_literal bool [concrete = bool] -// CHECK:STDOUT: %.loc59_15.2: Core.Form = init_form %.loc59_15.1 [concrete = constants.%.f34] +// CHECK:STDOUT: %.loc104_15.1: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %.loc104_15.2: Core.Form = init_form %.loc104_15.1 [concrete = constants.%.f34] // CHECK:STDOUT: %return.param: ref bool = out_param call_param0 // CHECK:STDOUT: %return: ref bool = return_slot %return.param // CHECK:STDOUT: } @@ -602,23 +737,23 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @FMissingParam.as.J.impl: %Self.ref as %J.ref { -// CHECK:STDOUT: %FMissingParam.as.J.impl.F.decl.loc71_29.1: %FMissingParam.as.J.impl.F.type.aad6ec.1 = fn_decl @FMissingParam.as.J.impl.F.loc71_29.1 [concrete = constants.%FMissingParam.as.J.impl.F.dd09dc.1] { +// CHECK:STDOUT: %FMissingParam.as.J.impl.F.decl.loc125_29.1: %FMissingParam.as.J.impl.F.type.aad6ec.1 = fn_decl @FMissingParam.as.J.impl.F.loc125_29.1 [concrete = constants.%FMissingParam.as.J.impl.F.dd09dc.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.831 = value_param_pattern [concrete = constants.%self.param_patt.210] // CHECK:STDOUT: %self.patt: %pattern_type.831 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.3a9] // CHECK:STDOUT: %return.param_patt: %pattern_type.831 = out_param_pattern [concrete = constants.%return.param_patt.5a1] -// CHECK:STDOUT: %return.patt: %pattern_type.831 = return_slot_pattern %return.param_patt, %.loc71_25.1 [concrete = constants.%return.patt.c0c] +// CHECK:STDOUT: %return.patt: %pattern_type.831 = return_slot_pattern %return.param_patt, %.loc125_25.1 [concrete = constants.%return.patt.c0c] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc71_25.1: type = type_literal bool [concrete = bool] -// CHECK:STDOUT: %.loc71_25.2: Core.Form = init_form %.loc71_25.1 [concrete = constants.%.f34] +// CHECK:STDOUT: %.loc125_25.1: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %.loc125_25.2: Core.Form = init_form %.loc125_25.1 [concrete = constants.%.f34] // CHECK:STDOUT: %self.param: bool = value_param call_param0 -// CHECK:STDOUT: %.loc71_16: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %.loc125_16: type = type_literal bool [concrete = bool] // CHECK:STDOUT: %self: bool = wrapper_binding self, %self.param // CHECK:STDOUT: %return.param: ref bool = out_param call_param1 // CHECK:STDOUT: %return: ref bool = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc63_44.1: type = specific_constant @J.WithSelf.F.%.loc63_44.1, @J.WithSelf.F(constants.%J.facet.2a3) [concrete = bool] -// CHECK:STDOUT: %.loc63_44.2: Core.Form = specific_constant @J.WithSelf.F.%.loc63_44.2, @J.WithSelf.F(constants.%J.facet.2a3) [concrete = constants.%.f34] -// CHECK:STDOUT: %FMissingParam.as.J.impl.F.decl.loc71_29.2: %FMissingParam.as.J.impl.F.type.aad6ec.2 = fn_decl @FMissingParam.as.J.impl.F.loc71_29.2 [concrete = constants.%FMissingParam.as.J.impl.F.dd09dc.2] { +// CHECK:STDOUT: %.loc108_44.1: type = specific_constant @J.WithSelf.F.%.loc108_44.1, @J.WithSelf.F(constants.%J.facet.2a3) [concrete = bool] +// CHECK:STDOUT: %.loc108_44.2: Core.Form = specific_constant @J.WithSelf.F.%.loc108_44.2, @J.WithSelf.F(constants.%J.facet.2a3) [concrete = constants.%.f34] +// CHECK:STDOUT: %FMissingParam.as.J.impl.F.decl.loc125_29.2: %FMissingParam.as.J.impl.F.type.aad6ec.2 = fn_decl @FMissingParam.as.J.impl.F.loc125_29.2 [concrete = constants.%FMissingParam.as.J.impl.F.dd09dc.2] { // CHECK:STDOUT: %.1: %pattern_type.831 = specific_constant constants.%self.param_patt.210, @J.WithSelf.F(constants.%J.facet.2a3) [concrete = constants.%self.param_patt.210] // CHECK:STDOUT: %self.patt: %pattern_type.831 = wrapper_binding_pattern self, %.1 [concrete = constants.%self.patt.3a9] // CHECK:STDOUT: %.2: %pattern_type.831 = specific_constant constants.%b.param_patt.792, @J.WithSelf.F(constants.%J.facet.2a3) [concrete = constants.%b.param_patt.792] @@ -632,33 +767,33 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %return.param: ref bool = out_param call_param2 // CHECK:STDOUT: %return: ref bool = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %J.impl_witness_table = impl_witness_table (%FMissingParam.as.J.impl.F.decl.loc71_29.2), @FMissingParam.as.J.impl [concrete] +// CHECK:STDOUT: %J.impl_witness_table = impl_witness_table (%FMissingParam.as.J.impl.F.decl.loc125_29.2), @FMissingParam.as.J.impl [concrete] // CHECK:STDOUT: %J.impl_witness: = impl_witness %J.impl_witness_table [concrete = constants.%J.impl_witness.24e] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %FMissingParam.as.J.impl.F.decl.loc71_29.1 +// CHECK:STDOUT: .F = %FMissingParam.as.J.impl.F.decl.loc125_29.1 // CHECK:STDOUT: extend %J.ref // CHECK:STDOUT: witness = %J.impl_witness // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @FMissingImplicitParam.as.J.impl: %Self.ref as %J.ref { -// CHECK:STDOUT: %FMissingImplicitParam.as.J.impl.F.decl.loc80_26.1: %FMissingImplicitParam.as.J.impl.F.type.f666a8.1 = fn_decl @FMissingImplicitParam.as.J.impl.F.loc80_26.1 [concrete = constants.%FMissingImplicitParam.as.J.impl.F.620ed1.1] { +// CHECK:STDOUT: %FMissingImplicitParam.as.J.impl.F.decl.loc144_26.1: %FMissingImplicitParam.as.J.impl.F.type.f666a8.1 = fn_decl @FMissingImplicitParam.as.J.impl.F.loc144_26.1 [concrete = constants.%FMissingImplicitParam.as.J.impl.F.620ed1.1] { // CHECK:STDOUT: %b.param_patt: %pattern_type.831 = value_param_pattern [concrete = constants.%b.param_patt.792] // CHECK:STDOUT: %b.patt: %pattern_type.831 = wrapper_binding_pattern b, %b.param_patt [concrete = constants.%b.patt.d80] // CHECK:STDOUT: %return.param_patt: %pattern_type.831 = out_param_pattern [concrete = constants.%return.param_patt.5a1] -// CHECK:STDOUT: %return.patt: %pattern_type.831 = return_slot_pattern %return.param_patt, %.loc80_22.1 [concrete = constants.%return.patt.c0c] +// CHECK:STDOUT: %return.patt: %pattern_type.831 = return_slot_pattern %return.param_patt, %.loc144_22.1 [concrete = constants.%return.patt.c0c] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc80_22.1: type = type_literal bool [concrete = bool] -// CHECK:STDOUT: %.loc80_22.2: Core.Form = init_form %.loc80_22.1 [concrete = constants.%.f34] +// CHECK:STDOUT: %.loc144_22.1: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %.loc144_22.2: Core.Form = init_form %.loc144_22.1 [concrete = constants.%.f34] // CHECK:STDOUT: %b.param: bool = value_param call_param0 -// CHECK:STDOUT: %.loc80_13: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %.loc144_13: type = type_literal bool [concrete = bool] // CHECK:STDOUT: %b: bool = wrapper_binding b, %b.param // CHECK:STDOUT: %return.param: ref bool = out_param call_param1 // CHECK:STDOUT: %return: ref bool = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc63_44.1: type = specific_constant @J.WithSelf.F.%.loc63_44.1, @J.WithSelf.F(constants.%J.facet.ba1) [concrete = bool] -// CHECK:STDOUT: %.loc63_44.2: Core.Form = specific_constant @J.WithSelf.F.%.loc63_44.2, @J.WithSelf.F(constants.%J.facet.ba1) [concrete = constants.%.f34] -// CHECK:STDOUT: %FMissingImplicitParam.as.J.impl.F.decl.loc80_26.2: %FMissingImplicitParam.as.J.impl.F.type.f666a8.2 = fn_decl @FMissingImplicitParam.as.J.impl.F.loc80_26.2 [concrete = constants.%FMissingImplicitParam.as.J.impl.F.620ed1.2] { +// CHECK:STDOUT: %.loc108_44.1: type = specific_constant @J.WithSelf.F.%.loc108_44.1, @J.WithSelf.F(constants.%J.facet.ba1) [concrete = bool] +// CHECK:STDOUT: %.loc108_44.2: Core.Form = specific_constant @J.WithSelf.F.%.loc108_44.2, @J.WithSelf.F(constants.%J.facet.ba1) [concrete = constants.%.f34] +// CHECK:STDOUT: %FMissingImplicitParam.as.J.impl.F.decl.loc144_26.2: %FMissingImplicitParam.as.J.impl.F.type.f666a8.2 = fn_decl @FMissingImplicitParam.as.J.impl.F.loc144_26.2 [concrete = constants.%FMissingImplicitParam.as.J.impl.F.620ed1.2] { // CHECK:STDOUT: %.1: %pattern_type.831 = specific_constant constants.%self.param_patt.210, @J.WithSelf.F(constants.%J.facet.ba1) [concrete = constants.%self.param_patt.210] // CHECK:STDOUT: %self.patt: %pattern_type.831 = wrapper_binding_pattern self, %.1 [concrete = constants.%self.patt.3a9] // CHECK:STDOUT: %.2: %pattern_type.831 = specific_constant constants.%b.param_patt.792, @J.WithSelf.F(constants.%J.facet.ba1) [concrete = constants.%b.param_patt.792] @@ -672,32 +807,32 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %return.param: ref bool = out_param call_param2 // CHECK:STDOUT: %return: ref bool = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %J.impl_witness_table = impl_witness_table (%FMissingImplicitParam.as.J.impl.F.decl.loc80_26.2), @FMissingImplicitParam.as.J.impl [concrete] +// CHECK:STDOUT: %J.impl_witness_table = impl_witness_table (%FMissingImplicitParam.as.J.impl.F.decl.loc144_26.2), @FMissingImplicitParam.as.J.impl [concrete] // CHECK:STDOUT: %J.impl_witness: = impl_witness %J.impl_witness_table [concrete = constants.%J.impl_witness.0d0] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %FMissingImplicitParam.as.J.impl.F.decl.loc80_26.1 +// CHECK:STDOUT: .F = %FMissingImplicitParam.as.J.impl.F.decl.loc144_26.1 // CHECK:STDOUT: extend %J.ref // CHECK:STDOUT: witness = %J.impl_witness // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @FMissingReturnType.as.J.impl: %Self.ref as %J.ref { -// CHECK:STDOUT: %FMissingReturnType.as.J.impl.F.decl.loc90_30.1: %FMissingReturnType.as.J.impl.F.type.9cd56a.1 = fn_decl @FMissingReturnType.as.J.impl.F.loc90_30.1 [concrete = constants.%FMissingReturnType.as.J.impl.F.6975be.1] { +// CHECK:STDOUT: %FMissingReturnType.as.J.impl.F.decl.loc164_30.1: %FMissingReturnType.as.J.impl.F.type.9cd56a.1 = fn_decl @FMissingReturnType.as.J.impl.F.loc164_30.1 [concrete = constants.%FMissingReturnType.as.J.impl.F.6975be.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.831 = value_param_pattern [concrete = constants.%self.param_patt.210] // CHECK:STDOUT: %self.patt: %pattern_type.831 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.3a9] // CHECK:STDOUT: %b.param_patt: %pattern_type.831 = value_param_pattern [concrete = constants.%b.param_patt.792] // CHECK:STDOUT: %b.patt: %pattern_type.831 = wrapper_binding_pattern b, %b.param_patt [concrete = constants.%b.patt.d80] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: bool = value_param call_param0 -// CHECK:STDOUT: %.loc90_16: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %.loc164_16: type = type_literal bool [concrete = bool] // CHECK:STDOUT: %self: bool = wrapper_binding self, %self.param // CHECK:STDOUT: %b.param: bool = value_param call_param1 -// CHECK:STDOUT: %.loc90_25: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %.loc164_25: type = type_literal bool [concrete = bool] // CHECK:STDOUT: %b: bool = wrapper_binding b, %b.param // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc63_44.1: type = specific_constant @J.WithSelf.F.%.loc63_44.1, @J.WithSelf.F(constants.%J.facet.b68) [concrete = bool] -// CHECK:STDOUT: %.loc63_44.2: Core.Form = specific_constant @J.WithSelf.F.%.loc63_44.2, @J.WithSelf.F(constants.%J.facet.b68) [concrete = constants.%.f34] -// CHECK:STDOUT: %FMissingReturnType.as.J.impl.F.decl.loc90_30.2: %FMissingReturnType.as.J.impl.F.type.9cd56a.2 = fn_decl @FMissingReturnType.as.J.impl.F.loc90_30.2 [concrete = constants.%FMissingReturnType.as.J.impl.F.6975be.2] { +// CHECK:STDOUT: %.loc108_44.1: type = specific_constant @J.WithSelf.F.%.loc108_44.1, @J.WithSelf.F(constants.%J.facet.b68) [concrete = bool] +// CHECK:STDOUT: %.loc108_44.2: Core.Form = specific_constant @J.WithSelf.F.%.loc108_44.2, @J.WithSelf.F(constants.%J.facet.b68) [concrete = constants.%.f34] +// CHECK:STDOUT: %FMissingReturnType.as.J.impl.F.decl.loc164_30.2: %FMissingReturnType.as.J.impl.F.type.9cd56a.2 = fn_decl @FMissingReturnType.as.J.impl.F.loc164_30.2 [concrete = constants.%FMissingReturnType.as.J.impl.F.6975be.2] { // CHECK:STDOUT: %.1: %pattern_type.831 = specific_constant constants.%self.param_patt.210, @J.WithSelf.F(constants.%J.facet.b68) [concrete = constants.%self.param_patt.210] // CHECK:STDOUT: %self.patt: %pattern_type.831 = wrapper_binding_pattern self, %.1 [concrete = constants.%self.patt.3a9] // CHECK:STDOUT: %.2: %pattern_type.831 = specific_constant constants.%b.param_patt.792, @J.WithSelf.F(constants.%J.facet.b68) [concrete = constants.%b.param_patt.792] @@ -711,28 +846,28 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %return.param: ref bool = out_param call_param2 // CHECK:STDOUT: %return: ref bool = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %J.impl_witness_table = impl_witness_table (%FMissingReturnType.as.J.impl.F.decl.loc90_30.2), @FMissingReturnType.as.J.impl [concrete] +// CHECK:STDOUT: %J.impl_witness_table = impl_witness_table (%FMissingReturnType.as.J.impl.F.decl.loc164_30.2), @FMissingReturnType.as.J.impl [concrete] // CHECK:STDOUT: %J.impl_witness: = impl_witness %J.impl_witness_table [concrete = constants.%J.impl_witness.50a] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %FMissingReturnType.as.J.impl.F.decl.loc90_30.1 +// CHECK:STDOUT: .F = %FMissingReturnType.as.J.impl.F.decl.loc164_30.1 // CHECK:STDOUT: extend %J.ref // CHECK:STDOUT: witness = %J.impl_witness // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @FDifferentParamType.as.J.impl: %Self.ref as %J.ref { -// CHECK:STDOUT: %FDifferentParamType.as.J.impl.F.decl.loc101_38.1: %FDifferentParamType.as.J.impl.F.type.4a2e9b.1 = fn_decl @FDifferentParamType.as.J.impl.F.loc101_38.1 [concrete = constants.%FDifferentParamType.as.J.impl.F.28602a.1] { +// CHECK:STDOUT: %FDifferentParamType.as.J.impl.F.decl.loc188_38.1: %FDifferentParamType.as.J.impl.F.type.4a2e9b.1 = fn_decl @FDifferentParamType.as.J.impl.F.loc188_38.1 [concrete = constants.%FDifferentParamType.as.J.impl.F.28602a.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.831 = value_param_pattern [concrete = constants.%self.param_patt.210] // CHECK:STDOUT: %self.patt: %pattern_type.831 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.3a9] // CHECK:STDOUT: %b.param_patt: %pattern_type.5d3 = value_param_pattern [concrete = constants.%b.param_patt.0a8] // CHECK:STDOUT: %b.patt: %pattern_type.5d3 = wrapper_binding_pattern b, %b.param_patt [concrete = constants.%b.patt.f7e] // CHECK:STDOUT: %return.param_patt: %pattern_type.831 = out_param_pattern [concrete = constants.%return.param_patt.5a1] -// CHECK:STDOUT: %return.patt: %pattern_type.831 = return_slot_pattern %return.param_patt, %.loc101_34.1 [concrete = constants.%return.patt.c0c] +// CHECK:STDOUT: %return.patt: %pattern_type.831 = return_slot_pattern %return.param_patt, %.loc188_34.1 [concrete = constants.%return.patt.c0c] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc101_34.1: type = type_literal bool [concrete = bool] -// CHECK:STDOUT: %.loc101_34.2: Core.Form = init_form %.loc101_34.1 [concrete = constants.%.f34] +// CHECK:STDOUT: %.loc188_34.1: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %.loc188_34.2: Core.Form = init_form %.loc188_34.1 [concrete = constants.%.f34] // CHECK:STDOUT: %self.param: bool = value_param call_param0 -// CHECK:STDOUT: %.loc101_16: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %.loc188_16: type = type_literal bool [concrete = bool] // CHECK:STDOUT: %self: bool = wrapper_binding self, %self.param // CHECK:STDOUT: %b.param: %FDifferentParamType = value_param call_param1 // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FDifferentParamType [concrete = constants.%FDifferentParamType] @@ -740,9 +875,9 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %return.param: ref bool = out_param call_param2 // CHECK:STDOUT: %return: ref bool = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc63_44.1: type = specific_constant @J.WithSelf.F.%.loc63_44.1, @J.WithSelf.F(constants.%J.facet.73e) [concrete = bool] -// CHECK:STDOUT: %.loc63_44.2: Core.Form = specific_constant @J.WithSelf.F.%.loc63_44.2, @J.WithSelf.F(constants.%J.facet.73e) [concrete = constants.%.f34] -// CHECK:STDOUT: %FDifferentParamType.as.J.impl.F.decl.loc101_38.2: %FDifferentParamType.as.J.impl.F.type.4a2e9b.2 = fn_decl @FDifferentParamType.as.J.impl.F.loc101_38.2 [concrete = constants.%FDifferentParamType.as.J.impl.F.28602a.2] { +// CHECK:STDOUT: %.loc108_44.1: type = specific_constant @J.WithSelf.F.%.loc108_44.1, @J.WithSelf.F(constants.%J.facet.73e) [concrete = bool] +// CHECK:STDOUT: %.loc108_44.2: Core.Form = specific_constant @J.WithSelf.F.%.loc108_44.2, @J.WithSelf.F(constants.%J.facet.73e) [concrete = constants.%.f34] +// CHECK:STDOUT: %FDifferentParamType.as.J.impl.F.decl.loc188_38.2: %FDifferentParamType.as.J.impl.F.type.4a2e9b.2 = fn_decl @FDifferentParamType.as.J.impl.F.loc188_38.2 [concrete = constants.%FDifferentParamType.as.J.impl.F.28602a.2] { // CHECK:STDOUT: %.1: %pattern_type.831 = specific_constant constants.%self.param_patt.210, @J.WithSelf.F(constants.%J.facet.73e) [concrete = constants.%self.param_patt.210] // CHECK:STDOUT: %self.patt: %pattern_type.831 = wrapper_binding_pattern self, %.1 [concrete = constants.%self.patt.3a9] // CHECK:STDOUT: %.2: %pattern_type.831 = specific_constant constants.%b.param_patt.792, @J.WithSelf.F(constants.%J.facet.73e) [concrete = constants.%b.param_patt.792] @@ -756,38 +891,38 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %return.param: ref bool = out_param call_param2 // CHECK:STDOUT: %return: ref bool = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %J.impl_witness_table = impl_witness_table (%FDifferentParamType.as.J.impl.F.decl.loc101_38.2), @FDifferentParamType.as.J.impl [concrete] +// CHECK:STDOUT: %J.impl_witness_table = impl_witness_table (%FDifferentParamType.as.J.impl.F.decl.loc188_38.2), @FDifferentParamType.as.J.impl [concrete] // CHECK:STDOUT: %J.impl_witness: = impl_witness %J.impl_witness_table [concrete = constants.%J.impl_witness.9e2] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %FDifferentParamType.as.J.impl.F.decl.loc101_38.1 +// CHECK:STDOUT: .F = %FDifferentParamType.as.J.impl.F.decl.loc188_38.1 // CHECK:STDOUT: extend %J.ref // CHECK:STDOUT: witness = %J.impl_witness // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @FDifferentImplicitParamType.as.J.impl: %Self.ref as %J.ref { -// CHECK:STDOUT: %FDifferentImplicitParamType.as.J.impl.F.decl.loc112_32.1: %FDifferentImplicitParamType.as.J.impl.F.type.6ef8a6.1 = fn_decl @FDifferentImplicitParamType.as.J.impl.F.loc112_32.1 [concrete = constants.%FDifferentImplicitParamType.as.J.impl.F.792c78.1] { +// CHECK:STDOUT: %FDifferentImplicitParamType.as.J.impl.F.decl.loc211_32.1: %FDifferentImplicitParamType.as.J.impl.F.type.6ef8a6.1 = fn_decl @FDifferentImplicitParamType.as.J.impl.F.loc211_32.1 [concrete = constants.%FDifferentImplicitParamType.as.J.impl.F.792c78.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.1bc = value_param_pattern [concrete = constants.%self.param_patt.ea6] // CHECK:STDOUT: %self.patt: %pattern_type.1bc = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.85b] // CHECK:STDOUT: %b.param_patt: %pattern_type.831 = value_param_pattern [concrete = constants.%b.param_patt.792] // CHECK:STDOUT: %b.patt: %pattern_type.831 = wrapper_binding_pattern b, %b.param_patt [concrete = constants.%b.patt.d80] // CHECK:STDOUT: %return.param_patt: %pattern_type.831 = out_param_pattern [concrete = constants.%return.param_patt.5a1] -// CHECK:STDOUT: %return.patt: %pattern_type.831 = return_slot_pattern %return.param_patt, %.loc112_28.1 [concrete = constants.%return.patt.c0c] +// CHECK:STDOUT: %return.patt: %pattern_type.831 = return_slot_pattern %return.param_patt, %.loc211_28.1 [concrete = constants.%return.patt.c0c] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc112_28.1: type = type_literal bool [concrete = bool] -// CHECK:STDOUT: %.loc112_28.2: Core.Form = init_form %.loc112_28.1 [concrete = constants.%.f34] +// CHECK:STDOUT: %.loc211_28.1: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %.loc211_28.2: Core.Form = init_form %.loc211_28.1 [concrete = constants.%.f34] // CHECK:STDOUT: %self.param: %FDifferentImplicitParamType = value_param call_param0 // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FDifferentImplicitParamType [concrete = constants.%FDifferentImplicitParamType] // CHECK:STDOUT: %self: %FDifferentImplicitParamType = wrapper_binding self, %self.param // CHECK:STDOUT: %b.param: bool = value_param call_param1 -// CHECK:STDOUT: %.loc112_19: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %.loc211_19: type = type_literal bool [concrete = bool] // CHECK:STDOUT: %b: bool = wrapper_binding b, %b.param // CHECK:STDOUT: %return.param: ref bool = out_param call_param2 // CHECK:STDOUT: %return: ref bool = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc63_44.1: type = specific_constant @J.WithSelf.F.%.loc63_44.1, @J.WithSelf.F(constants.%J.facet.00a) [concrete = bool] -// CHECK:STDOUT: %.loc63_44.2: Core.Form = specific_constant @J.WithSelf.F.%.loc63_44.2, @J.WithSelf.F(constants.%J.facet.00a) [concrete = constants.%.f34] -// CHECK:STDOUT: %FDifferentImplicitParamType.as.J.impl.F.decl.loc112_32.2: %FDifferentImplicitParamType.as.J.impl.F.type.6ef8a6.2 = fn_decl @FDifferentImplicitParamType.as.J.impl.F.loc112_32.2 [concrete = constants.%FDifferentImplicitParamType.as.J.impl.F.792c78.2] { +// CHECK:STDOUT: %.loc108_44.1: type = specific_constant @J.WithSelf.F.%.loc108_44.1, @J.WithSelf.F(constants.%J.facet.00a) [concrete = bool] +// CHECK:STDOUT: %.loc108_44.2: Core.Form = specific_constant @J.WithSelf.F.%.loc108_44.2, @J.WithSelf.F(constants.%J.facet.00a) [concrete = constants.%.f34] +// CHECK:STDOUT: %FDifferentImplicitParamType.as.J.impl.F.decl.loc211_32.2: %FDifferentImplicitParamType.as.J.impl.F.type.6ef8a6.2 = fn_decl @FDifferentImplicitParamType.as.J.impl.F.loc211_32.2 [concrete = constants.%FDifferentImplicitParamType.as.J.impl.F.792c78.2] { // CHECK:STDOUT: %.1: %pattern_type.831 = specific_constant constants.%self.param_patt.210, @J.WithSelf.F(constants.%J.facet.00a) [concrete = constants.%self.param_patt.210] // CHECK:STDOUT: %self.patt: %pattern_type.831 = wrapper_binding_pattern self, %.1 [concrete = constants.%self.patt.3a9] // CHECK:STDOUT: %.2: %pattern_type.831 = specific_constant constants.%b.param_patt.792, @J.WithSelf.F(constants.%J.facet.00a) [concrete = constants.%b.param_patt.792] @@ -801,17 +936,17 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %return.param: ref bool = out_param call_param2 // CHECK:STDOUT: %return: ref bool = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %J.impl_witness_table = impl_witness_table (%FDifferentImplicitParamType.as.J.impl.F.decl.loc112_32.2), @FDifferentImplicitParamType.as.J.impl [concrete] +// CHECK:STDOUT: %J.impl_witness_table = impl_witness_table (%FDifferentImplicitParamType.as.J.impl.F.decl.loc211_32.2), @FDifferentImplicitParamType.as.J.impl [concrete] // CHECK:STDOUT: %J.impl_witness: = impl_witness %J.impl_witness_table [concrete = constants.%J.impl_witness.d1a] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %FDifferentImplicitParamType.as.J.impl.F.decl.loc112_32.1 +// CHECK:STDOUT: .F = %FDifferentImplicitParamType.as.J.impl.F.decl.loc211_32.1 // CHECK:STDOUT: extend %J.ref // CHECK:STDOUT: witness = %J.impl_witness // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @FDifferentReturnType.as.J.impl: %Self.ref as %J.ref { -// CHECK:STDOUT: %FDifferentReturnType.as.J.impl.F.decl.loc123_38.1: %FDifferentReturnType.as.J.impl.F.type.ff55f4.1 = fn_decl @FDifferentReturnType.as.J.impl.F.loc123_38.1 [concrete = constants.%FDifferentReturnType.as.J.impl.F.9725a5.1] { +// CHECK:STDOUT: %FDifferentReturnType.as.J.impl.F.decl.loc233_38.1: %FDifferentReturnType.as.J.impl.F.type.ff55f4.1 = fn_decl @FDifferentReturnType.as.J.impl.F.loc233_38.1 [concrete = constants.%FDifferentReturnType.as.J.impl.F.9725a5.1] { // CHECK:STDOUT: %self.param_patt: %pattern_type.831 = value_param_pattern [concrete = constants.%self.param_patt.210] // CHECK:STDOUT: %self.patt: %pattern_type.831 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.3a9] // CHECK:STDOUT: %b.param_patt: %pattern_type.831 = value_param_pattern [concrete = constants.%b.param_patt.792] @@ -820,19 +955,19 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %return.patt: %pattern_type.b9f = return_slot_pattern %return.param_patt, %Self.ref [concrete = constants.%return.patt.e4f] // CHECK:STDOUT: } { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FDifferentReturnType [concrete = constants.%FDifferentReturnType] -// CHECK:STDOUT: %.loc123_34: Core.Form = init_form %Self.ref [concrete = constants.%.1f5] +// CHECK:STDOUT: %.loc233_34: Core.Form = init_form %Self.ref [concrete = constants.%.1f5] // CHECK:STDOUT: %self.param: bool = value_param call_param0 -// CHECK:STDOUT: %.loc123_16: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %.loc233_16: type = type_literal bool [concrete = bool] // CHECK:STDOUT: %self: bool = wrapper_binding self, %self.param // CHECK:STDOUT: %b.param: bool = value_param call_param1 -// CHECK:STDOUT: %.loc123_25: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %.loc233_25: type = type_literal bool [concrete = bool] // CHECK:STDOUT: %b: bool = wrapper_binding b, %b.param // CHECK:STDOUT: %return.param: ref %FDifferentReturnType = out_param call_param2 // CHECK:STDOUT: %return: ref %FDifferentReturnType = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc63_44.1: type = specific_constant @J.WithSelf.F.%.loc63_44.1, @J.WithSelf.F(constants.%J.facet.6a7) [concrete = bool] -// CHECK:STDOUT: %.loc63_44.2: Core.Form = specific_constant @J.WithSelf.F.%.loc63_44.2, @J.WithSelf.F(constants.%J.facet.6a7) [concrete = constants.%.f34] -// CHECK:STDOUT: %FDifferentReturnType.as.J.impl.F.decl.loc123_38.2: %FDifferentReturnType.as.J.impl.F.type.ff55f4.2 = fn_decl @FDifferentReturnType.as.J.impl.F.loc123_38.2 [concrete = constants.%FDifferentReturnType.as.J.impl.F.9725a5.2] { +// CHECK:STDOUT: %.loc108_44.1: type = specific_constant @J.WithSelf.F.%.loc108_44.1, @J.WithSelf.F(constants.%J.facet.6a7) [concrete = bool] +// CHECK:STDOUT: %.loc108_44.2: Core.Form = specific_constant @J.WithSelf.F.%.loc108_44.2, @J.WithSelf.F(constants.%J.facet.6a7) [concrete = constants.%.f34] +// CHECK:STDOUT: %FDifferentReturnType.as.J.impl.F.decl.loc233_38.2: %FDifferentReturnType.as.J.impl.F.type.ff55f4.2 = fn_decl @FDifferentReturnType.as.J.impl.F.loc233_38.2 [concrete = constants.%FDifferentReturnType.as.J.impl.F.9725a5.2] { // CHECK:STDOUT: %.1: %pattern_type.831 = specific_constant constants.%self.param_patt.210, @J.WithSelf.F(constants.%J.facet.6a7) [concrete = constants.%self.param_patt.210] // CHECK:STDOUT: %self.patt: %pattern_type.831 = wrapper_binding_pattern self, %.1 [concrete = constants.%self.patt.3a9] // CHECK:STDOUT: %.2: %pattern_type.831 = specific_constant constants.%b.param_patt.792, @J.WithSelf.F(constants.%J.facet.6a7) [concrete = constants.%b.param_patt.792] @@ -846,43 +981,43 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %return.param: ref bool = out_param call_param2 // CHECK:STDOUT: %return: ref bool = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %J.impl_witness_table = impl_witness_table (%FDifferentReturnType.as.J.impl.F.decl.loc123_38.2), @FDifferentReturnType.as.J.impl [concrete] +// CHECK:STDOUT: %J.impl_witness_table = impl_witness_table (%FDifferentReturnType.as.J.impl.F.decl.loc233_38.2), @FDifferentReturnType.as.J.impl [concrete] // CHECK:STDOUT: %J.impl_witness: = impl_witness %J.impl_witness_table [concrete = constants.%J.impl_witness.6a4] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .F = %FDifferentReturnType.as.J.impl.F.decl.loc123_38.1 +// CHECK:STDOUT: .F = %FDifferentReturnType.as.J.impl.F.decl.loc233_38.1 // CHECK:STDOUT: extend %J.ref // CHECK:STDOUT: witness = %J.impl_witness // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @SelfNestedBadParam.as.SelfNested.impl: %Self.ref as %SelfNested.ref { -// CHECK:STDOUT: %SelfNestedBadParam.as.SelfNested.impl.F.decl.loc138_87.1: %SelfNestedBadParam.as.SelfNested.impl.F.type.4325e7.1 = fn_decl @SelfNestedBadParam.as.SelfNested.impl.F.loc138_87.1 [concrete = constants.%SelfNestedBadParam.as.SelfNested.impl.F.5fd896.1] { +// CHECK:STDOUT: %SelfNestedBadParam.as.SelfNested.impl.F.decl.loc260_87.1: %SelfNestedBadParam.as.SelfNested.impl.F.type.4325e7.1 = fn_decl @SelfNestedBadParam.as.SelfNested.impl.F.loc260_87.1 [concrete = constants.%SelfNestedBadParam.as.SelfNested.impl.F.5fd896.1] { // CHECK:STDOUT: %x.param_patt: %pattern_type.f03 = value_param_pattern [concrete = constants.%x.param_patt.95a] // CHECK:STDOUT: %x.patt: %pattern_type.f03 = wrapper_binding_pattern x, %x.param_patt [concrete = constants.%x.patt.23c] // CHECK:STDOUT: %return.param_patt: %pattern_type.ec1 = out_param_pattern [concrete = constants.%return.param_patt.8ed] // CHECK:STDOUT: %return.patt: %pattern_type.ec1 = return_slot_pattern %return.param_patt, %Array [concrete = constants.%return.patt.21a] // CHECK:STDOUT: } { -// CHECK:STDOUT: %SelfNestedBadParam.ref.loc138_65: type = name_ref SelfNestedBadParam, file.%SelfNestedBadParam.decl [concrete = constants.%SelfNestedBadParam] +// CHECK:STDOUT: %SelfNestedBadParam.ref.loc260_65: type = name_ref SelfNestedBadParam, file.%SelfNestedBadParam.decl [concrete = constants.%SelfNestedBadParam] // CHECK:STDOUT: %int_4: Core.IntLiteral = int_value 4 [concrete = constants.%int_4] // CHECK:STDOUT: %Array: type = class_type @Array, @Array(constants.%SelfNestedBadParam, constants.%int_4) [concrete = constants.%Array.870] -// CHECK:STDOUT: %.loc138_86: Core.Form = init_form %Array [concrete = constants.%.a71] +// CHECK:STDOUT: %.loc260_86: Core.Form = init_form %Array [concrete = constants.%.a71] // CHECK:STDOUT: %x.param: %tuple.type.f65 = value_param call_param0 -// CHECK:STDOUT: %.loc138_53.1: type = splice_block %.loc138_53.3 [concrete = constants.%tuple.type.f65] { -// CHECK:STDOUT: %SelfNestedBadParam.ref.loc138_14: type = name_ref SelfNestedBadParam, file.%SelfNestedBadParam.decl [concrete = constants.%SelfNestedBadParam] -// CHECK:STDOUT: %ptr: type = ptr_type %SelfNestedBadParam.ref.loc138_14 [concrete = constants.%ptr.52e] -// CHECK:STDOUT: %i32.loc138_40: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %i32.loc138_49: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc260_53.1: type = splice_block %.loc260_53.3 [concrete = constants.%tuple.type.f65] { +// CHECK:STDOUT: %SelfNestedBadParam.ref.loc260_14: type = name_ref SelfNestedBadParam, file.%SelfNestedBadParam.decl [concrete = constants.%SelfNestedBadParam] +// CHECK:STDOUT: %ptr: type = ptr_type %SelfNestedBadParam.ref.loc260_14 [concrete = constants.%ptr.52e] +// CHECK:STDOUT: %i32.loc260_40: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc260_49: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.x.y: type = struct_type {.x: %i32, .y: %i32} [concrete = constants.%struct_type.x.y.d8c] -// CHECK:STDOUT: %.loc138_53.2: %tuple.type.693 = tuple_literal (%ptr, %struct_type.x.y) [concrete = constants.%tuple.60a] -// CHECK:STDOUT: %.loc138_53.3: type = converted %.loc138_53.2, constants.%tuple.type.f65 [concrete = constants.%tuple.type.f65] +// CHECK:STDOUT: %.loc260_53.2: %tuple.type.693 = tuple_literal (%ptr, %struct_type.x.y) [concrete = constants.%tuple.60a] +// CHECK:STDOUT: %.loc260_53.3: type = converted %.loc260_53.2, constants.%tuple.type.f65 [concrete = constants.%tuple.type.f65] // CHECK:STDOUT: } // CHECK:STDOUT: %x: %tuple.type.f65 = wrapper_binding x, %x.param // CHECK:STDOUT: %return.param: ref %Array.870 = out_param call_param1 // CHECK:STDOUT: %return: ref %Array.870 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc128_57.1: type = specific_constant @SelfNested.WithSelf.F.%Array.loc128_57.2, @SelfNested.WithSelf.F(constants.%SelfNested.facet.d0d) [concrete = constants.%Array.870] -// CHECK:STDOUT: %.loc128_57.2: Core.Form = specific_constant @SelfNested.WithSelf.F.%.loc128_57.2, @SelfNested.WithSelf.F(constants.%SelfNested.facet.d0d) [concrete = constants.%.a71] -// CHECK:STDOUT: %SelfNestedBadParam.as.SelfNested.impl.F.decl.loc138_87.2: %SelfNestedBadParam.as.SelfNested.impl.F.type.4325e7.2 = fn_decl @SelfNestedBadParam.as.SelfNested.impl.F.loc138_87.2 [concrete = constants.%SelfNestedBadParam.as.SelfNested.impl.F.5fd896.2] { +// CHECK:STDOUT: %.loc238_57.1: type = specific_constant @SelfNested.WithSelf.F.%Array.loc238_57.2, @SelfNested.WithSelf.F(constants.%SelfNested.facet.d0d) [concrete = constants.%Array.870] +// CHECK:STDOUT: %.loc238_57.2: Core.Form = specific_constant @SelfNested.WithSelf.F.%.loc238_57.2, @SelfNested.WithSelf.F(constants.%SelfNested.facet.d0d) [concrete = constants.%.a71] +// CHECK:STDOUT: %SelfNestedBadParam.as.SelfNested.impl.F.decl.loc260_87.2: %SelfNestedBadParam.as.SelfNested.impl.F.type.4325e7.2 = fn_decl @SelfNestedBadParam.as.SelfNested.impl.F.loc260_87.2 [concrete = constants.%SelfNestedBadParam.as.SelfNested.impl.F.5fd896.2] { // CHECK:STDOUT: %.1: %pattern_type.1ec = specific_constant constants.%x.param_patt.255, @SelfNested.WithSelf.F(constants.%SelfNested.facet.d0d) [concrete = constants.%x.param_patt.255] // CHECK:STDOUT: %x.patt: %pattern_type.1ec = wrapper_binding_pattern x, %.1 [concrete = constants.%x.patt.79a] // CHECK:STDOUT: %.2: %pattern_type.ec1 = specific_constant constants.%return.patt.21a, @SelfNested.WithSelf.F(constants.%SelfNested.facet.d0d) [concrete = constants.%return.patt.21a] @@ -892,18 +1027,18 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %return.param: ref %Array.870 = out_param call_param1 // CHECK:STDOUT: %return: ref %Array.870 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %SelfNested.impl_witness_table = impl_witness_table (%SelfNestedBadParam.as.SelfNested.impl.F.decl.loc138_87.2), @SelfNestedBadParam.as.SelfNested.impl [concrete] +// CHECK:STDOUT: %SelfNested.impl_witness_table = impl_witness_table (%SelfNestedBadParam.as.SelfNested.impl.F.decl.loc260_87.2), @SelfNestedBadParam.as.SelfNested.impl [concrete] // CHECK:STDOUT: %SelfNested.impl_witness: = impl_witness %SelfNested.impl_witness_table [concrete = constants.%SelfNested.impl_witness.09d] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .SelfNestedBadParam = -// CHECK:STDOUT: .F = %SelfNestedBadParam.as.SelfNested.impl.F.decl.loc138_87.1 +// CHECK:STDOUT: .F = %SelfNestedBadParam.as.SelfNested.impl.F.decl.loc260_87.1 // CHECK:STDOUT: extend %SelfNested.ref // CHECK:STDOUT: witness = %SelfNested.impl_witness // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @SelfNestedBadReturnType.as.SelfNested.impl: %Self.ref as %SelfNested.ref { -// CHECK:STDOUT: %SelfNestedBadReturnType.as.SelfNested.impl.F.decl.loc148_112.1: %SelfNestedBadReturnType.as.SelfNested.impl.F.type.1cbabe.1 = fn_decl @SelfNestedBadReturnType.as.SelfNested.impl.F.loc148_112.1 [concrete = constants.%SelfNestedBadReturnType.as.SelfNested.impl.F.5a7d54.1] { +// CHECK:STDOUT: %SelfNestedBadReturnType.as.SelfNested.impl.F.decl.loc283_112.1: %SelfNestedBadReturnType.as.SelfNested.impl.F.type.1cbabe.1 = fn_decl @SelfNestedBadReturnType.as.SelfNested.impl.F.loc283_112.1 [concrete = constants.%SelfNestedBadReturnType.as.SelfNested.impl.F.5a7d54.1] { // CHECK:STDOUT: %x.param_patt: %pattern_type.7fc = value_param_pattern [concrete = constants.%x.param_patt.04c] // CHECK:STDOUT: %x.patt: %pattern_type.7fc = wrapper_binding_pattern x, %x.param_patt [concrete = constants.%x.patt.10a] // CHECK:STDOUT: %return.param_patt: %pattern_type.ec1 = out_param_pattern [concrete = constants.%return.param_patt.8ed] @@ -912,24 +1047,24 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %SelfNestedBadParam.ref: type = name_ref SelfNestedBadParam, file.%SelfNestedBadParam.decl [concrete = constants.%SelfNestedBadParam] // CHECK:STDOUT: %int_4: Core.IntLiteral = int_value 4 [concrete = constants.%int_4] // CHECK:STDOUT: %Array: type = class_type @Array, @Array(constants.%SelfNestedBadParam, constants.%int_4) [concrete = constants.%Array.870] -// CHECK:STDOUT: %.loc148_111: Core.Form = init_form %Array [concrete = constants.%.a71] +// CHECK:STDOUT: %.loc283_111: Core.Form = init_form %Array [concrete = constants.%.a71] // CHECK:STDOUT: %x.param: %tuple.type.dce = value_param call_param0 -// CHECK:STDOUT: %.loc148_78.1: type = splice_block %.loc148_78.3 [concrete = constants.%tuple.type.dce] { -// CHECK:STDOUT: %SelfNestedBadReturnType.ref.loc148_14: type = name_ref SelfNestedBadReturnType, file.%SelfNestedBadReturnType.decl [concrete = constants.%SelfNestedBadReturnType] -// CHECK:STDOUT: %ptr: type = ptr_type %SelfNestedBadReturnType.ref.loc148_14 [concrete = constants.%ptr.f55] -// CHECK:STDOUT: %SelfNestedBadReturnType.ref.loc148_45: type = name_ref SelfNestedBadReturnType, file.%SelfNestedBadReturnType.decl [concrete = constants.%SelfNestedBadReturnType] +// CHECK:STDOUT: %.loc283_78.1: type = splice_block %.loc283_78.3 [concrete = constants.%tuple.type.dce] { +// CHECK:STDOUT: %SelfNestedBadReturnType.ref.loc283_14: type = name_ref SelfNestedBadReturnType, file.%SelfNestedBadReturnType.decl [concrete = constants.%SelfNestedBadReturnType] +// CHECK:STDOUT: %ptr: type = ptr_type %SelfNestedBadReturnType.ref.loc283_14 [concrete = constants.%ptr.f55] +// CHECK:STDOUT: %SelfNestedBadReturnType.ref.loc283_45: type = name_ref SelfNestedBadReturnType, file.%SelfNestedBadReturnType.decl [concrete = constants.%SelfNestedBadReturnType] // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.x.y: type = struct_type {.x: %SelfNestedBadReturnType, .y: %i32} [concrete = constants.%struct_type.x.y.03e] -// CHECK:STDOUT: %.loc148_78.2: %tuple.type.693 = tuple_literal (%ptr, %struct_type.x.y) [concrete = constants.%tuple.ef1] -// CHECK:STDOUT: %.loc148_78.3: type = converted %.loc148_78.2, constants.%tuple.type.dce [concrete = constants.%tuple.type.dce] +// CHECK:STDOUT: %.loc283_78.2: %tuple.type.693 = tuple_literal (%ptr, %struct_type.x.y) [concrete = constants.%tuple.ef1] +// CHECK:STDOUT: %.loc283_78.3: type = converted %.loc283_78.2, constants.%tuple.type.dce [concrete = constants.%tuple.type.dce] // CHECK:STDOUT: } // CHECK:STDOUT: %x: %tuple.type.dce = wrapper_binding x, %x.param // CHECK:STDOUT: %return.param: ref %Array.870 = out_param call_param1 // CHECK:STDOUT: %return: ref %Array.870 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc128_57.1: type = specific_constant @SelfNested.WithSelf.F.%Array.loc128_57.2, @SelfNested.WithSelf.F(constants.%SelfNested.facet.e71) [concrete = constants.%Array.ce4] -// CHECK:STDOUT: %.loc128_57.2: Core.Form = specific_constant @SelfNested.WithSelf.F.%.loc128_57.2, @SelfNested.WithSelf.F(constants.%SelfNested.facet.e71) [concrete = constants.%.069] -// CHECK:STDOUT: %SelfNestedBadReturnType.as.SelfNested.impl.F.decl.loc148_112.2: %SelfNestedBadReturnType.as.SelfNested.impl.F.type.1cbabe.2 = fn_decl @SelfNestedBadReturnType.as.SelfNested.impl.F.loc148_112.2 [concrete = constants.%SelfNestedBadReturnType.as.SelfNested.impl.F.5a7d54.2] { +// CHECK:STDOUT: %.loc238_57.1: type = specific_constant @SelfNested.WithSelf.F.%Array.loc238_57.2, @SelfNested.WithSelf.F(constants.%SelfNested.facet.e71) [concrete = constants.%Array.ce4] +// CHECK:STDOUT: %.loc238_57.2: Core.Form = specific_constant @SelfNested.WithSelf.F.%.loc238_57.2, @SelfNested.WithSelf.F(constants.%SelfNested.facet.e71) [concrete = constants.%.069] +// CHECK:STDOUT: %SelfNestedBadReturnType.as.SelfNested.impl.F.decl.loc283_112.2: %SelfNestedBadReturnType.as.SelfNested.impl.F.type.1cbabe.2 = fn_decl @SelfNestedBadReturnType.as.SelfNested.impl.F.loc283_112.2 [concrete = constants.%SelfNestedBadReturnType.as.SelfNested.impl.F.5a7d54.2] { // CHECK:STDOUT: %.1: %pattern_type.7fc = specific_constant constants.%x.param_patt.04c, @SelfNested.WithSelf.F(constants.%SelfNested.facet.e71) [concrete = constants.%x.param_patt.04c] // CHECK:STDOUT: %x.patt: %pattern_type.7fc = wrapper_binding_pattern x, %.1 [concrete = constants.%x.patt.10a] // CHECK:STDOUT: %.2: %pattern_type.5b0 = specific_constant constants.%return.patt.02d, @SelfNested.WithSelf.F(constants.%SelfNested.facet.e71) [concrete = constants.%return.patt.02d] @@ -939,13 +1074,13 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %return.param: ref %Array.ce4 = out_param call_param1 // CHECK:STDOUT: %return: ref %Array.ce4 = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %SelfNested.impl_witness_table = impl_witness_table (%SelfNestedBadReturnType.as.SelfNested.impl.F.decl.loc148_112.2), @SelfNestedBadReturnType.as.SelfNested.impl [concrete] +// CHECK:STDOUT: %SelfNested.impl_witness_table = impl_witness_table (%SelfNestedBadReturnType.as.SelfNested.impl.F.decl.loc283_112.2), @SelfNestedBadReturnType.as.SelfNested.impl [concrete] // CHECK:STDOUT: %SelfNested.impl_witness: = impl_witness %SelfNested.impl_witness_table [concrete = constants.%SelfNested.impl_witness.849] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .SelfNestedBadReturnType = // CHECK:STDOUT: .SelfNestedBadParam = -// CHECK:STDOUT: .F = %SelfNestedBadReturnType.as.SelfNested.impl.F.decl.loc148_112.1 +// CHECK:STDOUT: .F = %SelfNestedBadReturnType.as.SelfNested.impl.F.decl.loc283_112.1 // CHECK:STDOUT: extend %SelfNested.ref // CHECK:STDOUT: witness = %SelfNested.impl_witness // CHECK:STDOUT: } @@ -955,7 +1090,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%NoF [concrete = constants.%NoF] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc21: = impl_self_witness @NoF.as.I.impl.%Self.ref, @I [concrete = constants.%.6c7] +// CHECK:STDOUT: %.loc30: = impl_self_witness @NoF.as.I.impl.%Self.ref, @I [concrete = constants.%.6c7] // CHECK:STDOUT: %complete_type: = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type.357] // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: @@ -969,7 +1104,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FNotFunction [concrete = constants.%FNotFunction] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc25: = impl_self_witness @FNotFunction.as.I.impl.%Self.ref, @I [concrete = constants.%.d4c] +// CHECK:STDOUT: %.loc34: = impl_self_witness @FNotFunction.as.I.impl.%Self.ref, @I [concrete = constants.%.d4c] // CHECK:STDOUT: %complete_type: = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type.357] // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: @@ -985,7 +1120,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FExtraParam [concrete = constants.%FExtraParam] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc34: = impl_self_witness @FExtraParam.as.I.impl.%Self.ref, @I [concrete = constants.%.44b] +// CHECK:STDOUT: %.loc52: = impl_self_witness @FExtraParam.as.I.impl.%Self.ref, @I [concrete = constants.%.44b] // CHECK:STDOUT: %complete_type: = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type.357] // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: @@ -999,7 +1134,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FExtraImplicitParam [concrete = constants.%FExtraImplicitParam] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc44: = impl_self_witness @FExtraImplicitParam.as.I.impl.%Self.ref, @I [concrete = constants.%.77c] +// CHECK:STDOUT: %.loc71: = impl_self_witness @FExtraImplicitParam.as.I.impl.%Self.ref, @I [concrete = constants.%.77c] // CHECK:STDOUT: %complete_type: = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type.357] // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: @@ -1013,7 +1148,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FExtraReturnType [concrete = constants.%FExtraReturnType] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc55: = impl_self_witness @FExtraReturnType.as.I.impl.%Self.ref, @I [concrete = constants.%.ebd] +// CHECK:STDOUT: %.loc91: = impl_self_witness @FExtraReturnType.as.I.impl.%Self.ref, @I [concrete = constants.%.ebd] // CHECK:STDOUT: %complete_type: = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type.357] // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: @@ -1027,7 +1162,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FMissingParam [concrete = constants.%FMissingParam] // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [concrete = constants.%J.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc66: = impl_self_witness @FMissingParam.as.J.impl.%Self.ref, @J [concrete = constants.%.599] +// CHECK:STDOUT: %.loc111: = impl_self_witness @FMissingParam.as.J.impl.%Self.ref, @J [concrete = constants.%.599] // CHECK:STDOUT: %complete_type: = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type.357] // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: @@ -1041,7 +1176,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FMissingImplicitParam [concrete = constants.%FMissingImplicitParam] // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [concrete = constants.%J.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc76: = impl_self_witness @FMissingImplicitParam.as.J.impl.%Self.ref, @J [concrete = constants.%.f79] +// CHECK:STDOUT: %.loc130: = impl_self_witness @FMissingImplicitParam.as.J.impl.%Self.ref, @J [concrete = constants.%.f79] // CHECK:STDOUT: %complete_type: = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type.357] // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: @@ -1055,7 +1190,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FMissingReturnType [concrete = constants.%FMissingReturnType] // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [concrete = constants.%J.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc85: = impl_self_witness @FMissingReturnType.as.J.impl.%Self.ref, @J [concrete = constants.%.199] +// CHECK:STDOUT: %.loc149: = impl_self_witness @FMissingReturnType.as.J.impl.%Self.ref, @J [concrete = constants.%.199] // CHECK:STDOUT: %complete_type: = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type.357] // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: @@ -1069,7 +1204,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FDifferentParamType [concrete = constants.%FDifferentParamType] // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [concrete = constants.%J.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc95: = impl_self_witness @FDifferentParamType.as.J.impl.%Self.ref, @J [concrete = constants.%.593] +// CHECK:STDOUT: %.loc169: = impl_self_witness @FDifferentParamType.as.J.impl.%Self.ref, @J [concrete = constants.%.593] // CHECK:STDOUT: %complete_type: = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type.357] // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: @@ -1083,7 +1218,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FDifferentImplicitParamType [concrete = constants.%FDifferentImplicitParamType] // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [concrete = constants.%J.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc106: = impl_self_witness @FDifferentImplicitParamType.as.J.impl.%Self.ref, @J [concrete = constants.%.46c] +// CHECK:STDOUT: %.loc193: = impl_self_witness @FDifferentImplicitParamType.as.J.impl.%Self.ref, @J [concrete = constants.%.46c] // CHECK:STDOUT: %complete_type: = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type.357] // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: @@ -1097,7 +1232,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FDifferentReturnType [concrete = constants.%FDifferentReturnType] // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [concrete = constants.%J.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc117: = impl_self_witness @FDifferentReturnType.as.J.impl.%Self.ref, @J [concrete = constants.%.ce7] +// CHECK:STDOUT: %.loc216: = impl_self_witness @FDifferentReturnType.as.J.impl.%Self.ref, @J [concrete = constants.%.ce7] // CHECK:STDOUT: %complete_type: = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type.357] // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: @@ -1111,7 +1246,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%SelfNestedBadParam [concrete = constants.%SelfNestedBadParam] // CHECK:STDOUT: %SelfNested.ref: type = name_ref SelfNested, file.%SelfNested.decl [concrete = constants.%SelfNested.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc132: = impl_self_witness @SelfNestedBadParam.as.SelfNested.impl.%Self.ref, @SelfNested [concrete = constants.%.83b] +// CHECK:STDOUT: %.loc242: = impl_self_witness @SelfNestedBadParam.as.SelfNested.impl.%Self.ref, @SelfNested [concrete = constants.%.83b] // CHECK:STDOUT: %complete_type: = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type.357] // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: @@ -1126,7 +1261,7 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%SelfNestedBadReturnType [concrete = constants.%SelfNestedBadReturnType] // CHECK:STDOUT: %SelfNested.ref: type = name_ref SelfNested, file.%SelfNested.decl [concrete = constants.%SelfNested.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc143: = impl_self_witness @SelfNestedBadReturnType.as.SelfNested.impl.%Self.ref, @SelfNested [concrete = constants.%.020] +// CHECK:STDOUT: %.loc265: = impl_self_witness @SelfNestedBadReturnType.as.SelfNested.impl.%Self.ref, @SelfNested [concrete = constants.%.020] // CHECK:STDOUT: %complete_type: = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type.357] // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: @@ -1141,19 +1276,19 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: fn(); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @FExtraParam.as.I.impl.F.loc39_18.1(%b.param: bool); +// CHECK:STDOUT: fn @FExtraParam.as.I.impl.F.loc66_18.1(%b.param: bool); // CHECK:STDOUT: -// CHECK:STDOUT: fn @FExtraParam.as.I.impl.F.loc39_18.2() [thunk @FExtraParam.as.I.impl.%FExtraParam.as.I.impl.F.decl.loc39_18.1 for @I.WithSelf.%I.WithSelf.F.decl, @I.WithSelf.F(constants.%I.facet.476)] { +// CHECK:STDOUT: fn @FExtraParam.as.I.impl.F.loc66_18.2() [thunk @FExtraParam.as.I.impl.%FExtraParam.as.I.impl.F.decl.loc66_18.1 for @I.WithSelf.%I.WithSelf.F.decl, @I.WithSelf.F(constants.%I.facet.476)] { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: %FExtraParam.as.I.impl.F.type.ec7b0b.1 = name_ref F, @FExtraParam.as.I.impl.%FExtraParam.as.I.impl.F.decl.loc39_18.1 [concrete = constants.%FExtraParam.as.I.impl.F.ef9801.1] +// CHECK:STDOUT: %F.ref: %FExtraParam.as.I.impl.F.type.ec7b0b.1 = name_ref F, @FExtraParam.as.I.impl.%FExtraParam.as.I.impl.F.decl.loc66_18.1 [concrete = constants.%FExtraParam.as.I.impl.F.ef9801.1] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @FExtraImplicitParam.as.I.impl.F.loc49_15.1(%self.param: %FExtraImplicitParam); +// CHECK:STDOUT: fn @FExtraImplicitParam.as.I.impl.F.loc85_15.1(%self.param: %FExtraImplicitParam); // CHECK:STDOUT: -// CHECK:STDOUT: fn @FExtraImplicitParam.as.I.impl.F.loc49_15.2() [thunk @FExtraImplicitParam.as.I.impl.%FExtraImplicitParam.as.I.impl.F.decl.loc49_15.1 for @I.WithSelf.%I.WithSelf.F.decl, @I.WithSelf.F(constants.%I.facet.7ed)] { +// CHECK:STDOUT: fn @FExtraImplicitParam.as.I.impl.F.loc85_15.2() [thunk @FExtraImplicitParam.as.I.impl.%FExtraImplicitParam.as.I.impl.F.decl.loc85_15.1 for @I.WithSelf.%I.WithSelf.F.decl, @I.WithSelf.F(constants.%I.facet.7ed)] { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: %FExtraImplicitParam.as.I.impl.F.type.54cac2.1 = name_ref F, @FExtraImplicitParam.as.I.impl.%FExtraImplicitParam.as.I.impl.F.decl.loc49_15.1 [concrete = constants.%FExtraImplicitParam.as.I.impl.F.a42f35.1] +// CHECK:STDOUT: %F.ref: %FExtraImplicitParam.as.I.impl.F.type.54cac2.1 = name_ref F, @FExtraImplicitParam.as.I.impl.%FExtraImplicitParam.as.I.impl.F.decl.loc85_15.1 [concrete = constants.%FExtraImplicitParam.as.I.impl.F.a42f35.1] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1163,110 +1298,110 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: fn(%self.param: bool, %b.param: bool) -> out %return.param: bool; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @FMissingParam.as.J.impl.F.loc71_29.1(%self.param: bool) -> out %return.param: bool; +// CHECK:STDOUT: fn @FMissingParam.as.J.impl.F.loc125_29.1(%self.param: bool) -> out %return.param: bool; // CHECK:STDOUT: -// CHECK:STDOUT: fn @FMissingParam.as.J.impl.F.loc71_29.2(%self.param: bool, %b.param: bool) -> out %return.param: bool [thunk @FMissingParam.as.J.impl.%FMissingParam.as.J.impl.F.decl.loc71_29.1 for @J.WithSelf.%J.WithSelf.F.decl, @J.WithSelf.F(constants.%J.facet.2a3)] { +// CHECK:STDOUT: fn @FMissingParam.as.J.impl.F.loc125_29.2(%self.param: bool, %b.param: bool) -> out %return.param: bool [thunk @FMissingParam.as.J.impl.%FMissingParam.as.J.impl.F.decl.loc125_29.1 for @J.WithSelf.%J.WithSelf.F.decl, @J.WithSelf.F(constants.%J.facet.2a3)] { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: %FMissingParam.as.J.impl.F.type.aad6ec.1 = name_ref F, @FMissingParam.as.J.impl.%FMissingParam.as.J.impl.F.decl.loc71_29.1 [concrete = constants.%FMissingParam.as.J.impl.F.dd09dc.1] +// CHECK:STDOUT: %F.ref: %FMissingParam.as.J.impl.F.type.aad6ec.1 = name_ref F, @FMissingParam.as.J.impl.%FMissingParam.as.J.impl.F.decl.loc125_29.1 [concrete = constants.%FMissingParam.as.J.impl.F.dd09dc.1] // CHECK:STDOUT: %FMissingParam.as.J.impl.F.bound: = bound_method %self.param, %F.ref // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @FMissingImplicitParam.as.J.impl.F.loc80_26.1(%b.param: bool) -> out %return.param: bool; +// CHECK:STDOUT: fn @FMissingImplicitParam.as.J.impl.F.loc144_26.1(%b.param: bool) -> out %return.param: bool; // CHECK:STDOUT: -// CHECK:STDOUT: fn @FMissingImplicitParam.as.J.impl.F.loc80_26.2(%self.param: bool, %b.param: bool) -> out %return.param: bool [thunk @FMissingImplicitParam.as.J.impl.%FMissingImplicitParam.as.J.impl.F.decl.loc80_26.1 for @J.WithSelf.%J.WithSelf.F.decl, @J.WithSelf.F(constants.%J.facet.ba1)] { +// CHECK:STDOUT: fn @FMissingImplicitParam.as.J.impl.F.loc144_26.2(%self.param: bool, %b.param: bool) -> out %return.param: bool [thunk @FMissingImplicitParam.as.J.impl.%FMissingImplicitParam.as.J.impl.F.decl.loc144_26.1 for @J.WithSelf.%J.WithSelf.F.decl, @J.WithSelf.F(constants.%J.facet.ba1)] { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: %FMissingImplicitParam.as.J.impl.F.type.f666a8.1 = name_ref F, @FMissingImplicitParam.as.J.impl.%FMissingImplicitParam.as.J.impl.F.decl.loc80_26.1 [concrete = constants.%FMissingImplicitParam.as.J.impl.F.620ed1.1] +// CHECK:STDOUT: %F.ref: %FMissingImplicitParam.as.J.impl.F.type.f666a8.1 = name_ref F, @FMissingImplicitParam.as.J.impl.%FMissingImplicitParam.as.J.impl.F.decl.loc144_26.1 [concrete = constants.%FMissingImplicitParam.as.J.impl.F.620ed1.1] // CHECK:STDOUT: %FMissingImplicitParam.as.J.impl.F.call: init bool = call %F.ref(%b.param) // CHECK:STDOUT: return %FMissingImplicitParam.as.J.impl.F.call // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @FMissingReturnType.as.J.impl.F.loc90_30.1(%self.param: bool, %b.param: bool); +// CHECK:STDOUT: fn @FMissingReturnType.as.J.impl.F.loc164_30.1(%self.param: bool, %b.param: bool); // CHECK:STDOUT: -// CHECK:STDOUT: fn @FMissingReturnType.as.J.impl.F.loc90_30.2(%self.param: bool, %b.param: bool) -> out %return.param: bool [thunk @FMissingReturnType.as.J.impl.%FMissingReturnType.as.J.impl.F.decl.loc90_30.1 for @J.WithSelf.%J.WithSelf.F.decl, @J.WithSelf.F(constants.%J.facet.b68)] { +// CHECK:STDOUT: fn @FMissingReturnType.as.J.impl.F.loc164_30.2(%self.param: bool, %b.param: bool) -> out %return.param: bool [thunk @FMissingReturnType.as.J.impl.%FMissingReturnType.as.J.impl.F.decl.loc164_30.1 for @J.WithSelf.%J.WithSelf.F.decl, @J.WithSelf.F(constants.%J.facet.b68)] { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: %FMissingReturnType.as.J.impl.F.type.9cd56a.1 = name_ref F, @FMissingReturnType.as.J.impl.%FMissingReturnType.as.J.impl.F.decl.loc90_30.1 [concrete = constants.%FMissingReturnType.as.J.impl.F.6975be.1] +// CHECK:STDOUT: %F.ref: %FMissingReturnType.as.J.impl.F.type.9cd56a.1 = name_ref F, @FMissingReturnType.as.J.impl.%FMissingReturnType.as.J.impl.F.decl.loc164_30.1 [concrete = constants.%FMissingReturnType.as.J.impl.F.6975be.1] // CHECK:STDOUT: %FMissingReturnType.as.J.impl.F.bound: = bound_method %self.param, %F.ref // CHECK:STDOUT: %FMissingReturnType.as.J.impl.F.call: init %empty_tuple.type = call %FMissingReturnType.as.J.impl.F.bound(%self.param, %b.param) -// CHECK:STDOUT: %.loc90: bool = converted %FMissingReturnType.as.J.impl.F.call, [concrete = ] +// CHECK:STDOUT: %.loc164: bool = converted %FMissingReturnType.as.J.impl.F.call, [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @FDifferentParamType.as.J.impl.F.loc101_38.1(%self.param: bool, %b.param: %FDifferentParamType) -> out %return.param: bool; +// CHECK:STDOUT: fn @FDifferentParamType.as.J.impl.F.loc188_38.1(%self.param: bool, %b.param: %FDifferentParamType) -> out %return.param: bool; // CHECK:STDOUT: -// CHECK:STDOUT: fn @FDifferentParamType.as.J.impl.F.loc101_38.2(%self.param: bool, %b.param: bool) -> out %return.param: bool [thunk @FDifferentParamType.as.J.impl.%FDifferentParamType.as.J.impl.F.decl.loc101_38.1 for @J.WithSelf.%J.WithSelf.F.decl, @J.WithSelf.F(constants.%J.facet.73e)] { +// CHECK:STDOUT: fn @FDifferentParamType.as.J.impl.F.loc188_38.2(%self.param: bool, %b.param: bool) -> out %return.param: bool [thunk @FDifferentParamType.as.J.impl.%FDifferentParamType.as.J.impl.F.decl.loc188_38.1 for @J.WithSelf.%J.WithSelf.F.decl, @J.WithSelf.F(constants.%J.facet.73e)] { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: %FDifferentParamType.as.J.impl.F.type.4a2e9b.1 = name_ref F, @FDifferentParamType.as.J.impl.%FDifferentParamType.as.J.impl.F.decl.loc101_38.1 [concrete = constants.%FDifferentParamType.as.J.impl.F.28602a.1] +// CHECK:STDOUT: %F.ref: %FDifferentParamType.as.J.impl.F.type.4a2e9b.1 = name_ref F, @FDifferentParamType.as.J.impl.%FDifferentParamType.as.J.impl.F.decl.loc188_38.1 [concrete = constants.%FDifferentParamType.as.J.impl.F.28602a.1] // CHECK:STDOUT: %FDifferentParamType.as.J.impl.F.bound: = bound_method %self.param, %F.ref -// CHECK:STDOUT: %.loc101: %FDifferentParamType = converted %b.param, [concrete = ] +// CHECK:STDOUT: %.loc188: %FDifferentParamType = converted %b.param, [concrete = ] // CHECK:STDOUT: %FDifferentParamType.as.J.impl.F.call: init bool = call %FDifferentParamType.as.J.impl.F.bound(%self.param, ) // CHECK:STDOUT: return %FDifferentParamType.as.J.impl.F.call // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @FDifferentImplicitParamType.as.J.impl.F.loc112_32.1(%self.param: %FDifferentImplicitParamType, %b.param: bool) -> out %return.param: bool; +// CHECK:STDOUT: fn @FDifferentImplicitParamType.as.J.impl.F.loc211_32.1(%self.param: %FDifferentImplicitParamType, %b.param: bool) -> out %return.param: bool; // CHECK:STDOUT: -// CHECK:STDOUT: fn @FDifferentImplicitParamType.as.J.impl.F.loc112_32.2(%self.param: bool, %b.param: bool) -> out %return.param: bool [thunk @FDifferentImplicitParamType.as.J.impl.%FDifferentImplicitParamType.as.J.impl.F.decl.loc112_32.1 for @J.WithSelf.%J.WithSelf.F.decl, @J.WithSelf.F(constants.%J.facet.00a)] { +// CHECK:STDOUT: fn @FDifferentImplicitParamType.as.J.impl.F.loc211_32.2(%self.param: bool, %b.param: bool) -> out %return.param: bool [thunk @FDifferentImplicitParamType.as.J.impl.%FDifferentImplicitParamType.as.J.impl.F.decl.loc211_32.1 for @J.WithSelf.%J.WithSelf.F.decl, @J.WithSelf.F(constants.%J.facet.00a)] { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: %FDifferentImplicitParamType.as.J.impl.F.type.6ef8a6.1 = name_ref F, @FDifferentImplicitParamType.as.J.impl.%FDifferentImplicitParamType.as.J.impl.F.decl.loc112_32.1 [concrete = constants.%FDifferentImplicitParamType.as.J.impl.F.792c78.1] +// CHECK:STDOUT: %F.ref: %FDifferentImplicitParamType.as.J.impl.F.type.6ef8a6.1 = name_ref F, @FDifferentImplicitParamType.as.J.impl.%FDifferentImplicitParamType.as.J.impl.F.decl.loc211_32.1 [concrete = constants.%FDifferentImplicitParamType.as.J.impl.F.792c78.1] // CHECK:STDOUT: %FDifferentImplicitParamType.as.J.impl.F.bound: = bound_method %self.param, %F.ref -// CHECK:STDOUT: %.loc112: %FDifferentImplicitParamType = converted %self.param, [concrete = ] +// CHECK:STDOUT: %.loc211: %FDifferentImplicitParamType = converted %self.param, [concrete = ] // CHECK:STDOUT: %FDifferentImplicitParamType.as.J.impl.F.call: init bool = call %FDifferentImplicitParamType.as.J.impl.F.bound(, %b.param) // CHECK:STDOUT: return %FDifferentImplicitParamType.as.J.impl.F.call // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @FDifferentReturnType.as.J.impl.F.loc123_38.1(%self.param: bool, %b.param: bool) -> out %return.param: %FDifferentReturnType; +// CHECK:STDOUT: fn @FDifferentReturnType.as.J.impl.F.loc233_38.1(%self.param: bool, %b.param: bool) -> out %return.param: %FDifferentReturnType; // CHECK:STDOUT: -// CHECK:STDOUT: fn @FDifferentReturnType.as.J.impl.F.loc123_38.2(%self.param: bool, %b.param: bool) -> out %return.param: bool [thunk @FDifferentReturnType.as.J.impl.%FDifferentReturnType.as.J.impl.F.decl.loc123_38.1 for @J.WithSelf.%J.WithSelf.F.decl, @J.WithSelf.F(constants.%J.facet.6a7)] { +// CHECK:STDOUT: fn @FDifferentReturnType.as.J.impl.F.loc233_38.2(%self.param: bool, %b.param: bool) -> out %return.param: bool [thunk @FDifferentReturnType.as.J.impl.%FDifferentReturnType.as.J.impl.F.decl.loc233_38.1 for @J.WithSelf.%J.WithSelf.F.decl, @J.WithSelf.F(constants.%J.facet.6a7)] { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: %FDifferentReturnType.as.J.impl.F.type.ff55f4.1 = name_ref F, @FDifferentReturnType.as.J.impl.%FDifferentReturnType.as.J.impl.F.decl.loc123_38.1 [concrete = constants.%FDifferentReturnType.as.J.impl.F.9725a5.1] +// CHECK:STDOUT: %F.ref: %FDifferentReturnType.as.J.impl.F.type.ff55f4.1 = name_ref F, @FDifferentReturnType.as.J.impl.%FDifferentReturnType.as.J.impl.F.decl.loc233_38.1 [concrete = constants.%FDifferentReturnType.as.J.impl.F.9725a5.1] // CHECK:STDOUT: %FDifferentReturnType.as.J.impl.F.bound: = bound_method %self.param, %F.ref -// CHECK:STDOUT: %.loc123_38.1: ref %FDifferentReturnType = temporary_storage -// CHECK:STDOUT: %FDifferentReturnType.as.J.impl.F.call: init %FDifferentReturnType to %.loc123_38.1 = call %FDifferentReturnType.as.J.impl.F.bound(%self.param, %b.param) -// CHECK:STDOUT: %.loc123_38.2: bool = converted %FDifferentReturnType.as.J.impl.F.call, [concrete = ] +// CHECK:STDOUT: %.loc233_38.1: ref %FDifferentReturnType = temporary_storage +// CHECK:STDOUT: %FDifferentReturnType.as.J.impl.F.call: init %FDifferentReturnType to %.loc233_38.1 = call %FDifferentReturnType.as.J.impl.F.bound(%self.param, %b.param) +// CHECK:STDOUT: %.loc233_38.2: bool = converted %FDifferentReturnType.as.J.impl.F.call, [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic fn @SelfNested.WithSelf.F(@SelfNested.%Self: %SelfNested.type) { // CHECK:STDOUT: %Self: %SelfNested.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.e81)] -// CHECK:STDOUT: %Self.as_type.loc128_16.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc128_16.1 (constants.%Self.as_type.8ab)] -// CHECK:STDOUT: %ptr.loc128_16.1: type = ptr_type %Self.as_type.loc128_16.1 [symbolic = %ptr.loc128_16.1 (constants.%ptr.a16)] -// CHECK:STDOUT: %struct_type.x.y.loc128_37.1: type = struct_type {.x: @SelfNested.WithSelf.F.%Self.as_type.loc128_16.1 (%Self.as_type.8ab), .y: %i32} [symbolic = %struct_type.x.y.loc128_37.1 (constants.%struct_type.x.y.34d)] -// CHECK:STDOUT: %tuple: %tuple.type.693 = tuple_value (%ptr.loc128_16.1, %struct_type.x.y.loc128_37.1) [symbolic = %tuple (constants.%tuple.ea4)] -// CHECK:STDOUT: %tuple.type: type = tuple_type (%ptr.loc128_16.1, %struct_type.x.y.loc128_37.1) [symbolic = %tuple.type (constants.%tuple.type.684)] -// CHECK:STDOUT: %pattern_type.loc128_9: type = pattern_type %tuple.type [symbolic = %pattern_type.loc128_9 (constants.%pattern_type.871)] -// CHECK:STDOUT: %x.param_patt.loc128_9.2: @SelfNested.WithSelf.F.%pattern_type.loc128_9 (%pattern_type.871) = value_param_pattern [symbolic = %x.param_patt.loc128_9.2 (constants.%x.param_patt.8f6)] -// CHECK:STDOUT: %x.patt.loc128_9.2: @SelfNested.WithSelf.F.%pattern_type.loc128_9 (%pattern_type.871) = wrapper_binding_pattern x, %x.param_patt.loc128_9.2 [symbolic = %x.patt.loc128_9.2 (constants.%x.patt.48b)] -// CHECK:STDOUT: %Array.loc128_57.1: type = class_type @Array, @Array(%Self.as_type.loc128_16.1, constants.%int_4) [symbolic = %Array.loc128_57.1 (constants.%Array.d32)] -// CHECK:STDOUT: %.loc128_57.1: Core.Form = init_form %Array.loc128_57.1 [symbolic = %.loc128_57.1 (constants.%.ec2)] -// CHECK:STDOUT: %pattern_type.loc128_57: type = pattern_type %Array.loc128_57.1 [symbolic = %pattern_type.loc128_57 (constants.%pattern_type.4a4)] -// CHECK:STDOUT: %return.param_patt.loc128_57.2: @SelfNested.WithSelf.F.%pattern_type.loc128_57 (%pattern_type.4a4) = out_param_pattern [symbolic = %return.param_patt.loc128_57.2 (constants.%return.param_patt.36b)] -// CHECK:STDOUT: %return.patt.loc128_41.2: @SelfNested.WithSelf.F.%pattern_type.loc128_57 (%pattern_type.4a4) = return_slot_pattern %return.param_patt.loc128_57.2, %Array.loc128_57.1 [symbolic = %return.patt.loc128_41.2 (constants.%return.patt.7a8)] +// CHECK:STDOUT: %Self.as_type.loc238_16.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc238_16.1 (constants.%Self.as_type.8ab)] +// CHECK:STDOUT: %ptr.loc238_16.1: type = ptr_type %Self.as_type.loc238_16.1 [symbolic = %ptr.loc238_16.1 (constants.%ptr.a16)] +// CHECK:STDOUT: %struct_type.x.y.loc238_37.1: type = struct_type {.x: @SelfNested.WithSelf.F.%Self.as_type.loc238_16.1 (%Self.as_type.8ab), .y: %i32} [symbolic = %struct_type.x.y.loc238_37.1 (constants.%struct_type.x.y.34d)] +// CHECK:STDOUT: %tuple: %tuple.type.693 = tuple_value (%ptr.loc238_16.1, %struct_type.x.y.loc238_37.1) [symbolic = %tuple (constants.%tuple.ea4)] +// CHECK:STDOUT: %tuple.type: type = tuple_type (%ptr.loc238_16.1, %struct_type.x.y.loc238_37.1) [symbolic = %tuple.type (constants.%tuple.type.684)] +// CHECK:STDOUT: %pattern_type.loc238_9: type = pattern_type %tuple.type [symbolic = %pattern_type.loc238_9 (constants.%pattern_type.871)] +// CHECK:STDOUT: %x.param_patt.loc238_9.2: @SelfNested.WithSelf.F.%pattern_type.loc238_9 (%pattern_type.871) = value_param_pattern [symbolic = %x.param_patt.loc238_9.2 (constants.%x.param_patt.8f6)] +// CHECK:STDOUT: %x.patt.loc238_9.2: @SelfNested.WithSelf.F.%pattern_type.loc238_9 (%pattern_type.871) = wrapper_binding_pattern x, %x.param_patt.loc238_9.2 [symbolic = %x.patt.loc238_9.2 (constants.%x.patt.48b)] +// CHECK:STDOUT: %Array.loc238_57.1: type = class_type @Array, @Array(%Self.as_type.loc238_16.1, constants.%int_4) [symbolic = %Array.loc238_57.1 (constants.%Array.d32)] +// CHECK:STDOUT: %.loc238_57.1: Core.Form = init_form %Array.loc238_57.1 [symbolic = %.loc238_57.1 (constants.%.ec2)] +// CHECK:STDOUT: %pattern_type.loc238_57: type = pattern_type %Array.loc238_57.1 [symbolic = %pattern_type.loc238_57 (constants.%pattern_type.4a4)] +// CHECK:STDOUT: %return.param_patt.loc238_57.2: @SelfNested.WithSelf.F.%pattern_type.loc238_57 (%pattern_type.4a4) = out_param_pattern [symbolic = %return.param_patt.loc238_57.2 (constants.%return.param_patt.36b)] +// CHECK:STDOUT: %return.patt.loc238_41.2: @SelfNested.WithSelf.F.%pattern_type.loc238_57 (%pattern_type.4a4) = return_slot_pattern %return.param_patt.loc238_57.2, %Array.loc238_57.1 [symbolic = %return.patt.loc238_41.2 (constants.%return.patt.7a8)] // CHECK:STDOUT: -// CHECK:STDOUT: fn(%x.param: @SelfNested.WithSelf.F.%tuple.type (%tuple.type.684)) -> out %return.param: @SelfNested.WithSelf.F.%Array.loc128_57.1 (%Array.d32); +// CHECK:STDOUT: fn(%x.param: @SelfNested.WithSelf.F.%tuple.type (%tuple.type.684)) -> out %return.param: @SelfNested.WithSelf.F.%Array.loc238_57.1 (%Array.d32); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SelfNestedBadParam.as.SelfNested.impl.F.loc138_87.1(%x.param: %tuple.type.f65) -> out %return.param: %Array.870; +// CHECK:STDOUT: fn @SelfNestedBadParam.as.SelfNested.impl.F.loc260_87.1(%x.param: %tuple.type.f65) -> out %return.param: %Array.870; // CHECK:STDOUT: -// CHECK:STDOUT: fn @SelfNestedBadParam.as.SelfNested.impl.F.loc138_87.2(%x.param: %tuple.type.5e1) -> out %return.param: %Array.870 [thunk @SelfNestedBadParam.as.SelfNested.impl.%SelfNestedBadParam.as.SelfNested.impl.F.decl.loc138_87.1 for @SelfNested.WithSelf.%SelfNested.WithSelf.F.decl, @SelfNested.WithSelf.F(constants.%SelfNested.facet.d0d)] { +// CHECK:STDOUT: fn @SelfNestedBadParam.as.SelfNested.impl.F.loc260_87.2(%x.param: %tuple.type.5e1) -> out %return.param: %Array.870 [thunk @SelfNestedBadParam.as.SelfNested.impl.%SelfNestedBadParam.as.SelfNested.impl.F.decl.loc260_87.1 for @SelfNested.WithSelf.%SelfNested.WithSelf.F.decl, @SelfNested.WithSelf.F(constants.%SelfNested.facet.d0d)] { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: %SelfNestedBadParam.as.SelfNested.impl.F.type.4325e7.1 = name_ref F, @SelfNestedBadParam.as.SelfNested.impl.%SelfNestedBadParam.as.SelfNested.impl.F.decl.loc138_87.1 [concrete = constants.%SelfNestedBadParam.as.SelfNested.impl.F.5fd896.1] +// CHECK:STDOUT: %F.ref: %SelfNestedBadParam.as.SelfNested.impl.F.type.4325e7.1 = name_ref F, @SelfNestedBadParam.as.SelfNested.impl.%SelfNestedBadParam.as.SelfNested.impl.F.decl.loc260_87.1 [concrete = constants.%SelfNestedBadParam.as.SelfNested.impl.F.5fd896.1] // CHECK:STDOUT: %.3: ref %Array.870 = splice_block %return.param {} // CHECK:STDOUT: %tuple.elem0: %ptr.52e = tuple_access %x.param, element0 // CHECK:STDOUT: %tuple.elem1: %struct_type.x.y.25d = tuple_access %x.param, element1 -// CHECK:STDOUT: %.loc138_87.1: %SelfNestedBadParam = struct_access %tuple.elem1, element0 -// CHECK:STDOUT: %.loc138_87.2: %i32 = converted %.loc138_87.1, [concrete = ] +// CHECK:STDOUT: %.loc260_87.1: %SelfNestedBadParam = struct_access %tuple.elem1, element0 +// CHECK:STDOUT: %.loc260_87.2: %i32 = converted %.loc260_87.1, [concrete = ] // CHECK:STDOUT: %SelfNestedBadParam.as.SelfNested.impl.F.call: init %Array.870 to %.3 = call %F.ref() // CHECK:STDOUT: return %SelfNestedBadParam.as.SelfNested.impl.F.call to %return.param // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SelfNestedBadReturnType.as.SelfNested.impl.F.loc148_112.1(%x.param: %tuple.type.dce) -> out %return.param: %Array.870; +// CHECK:STDOUT: fn @SelfNestedBadReturnType.as.SelfNested.impl.F.loc283_112.1(%x.param: %tuple.type.dce) -> out %return.param: %Array.870; // CHECK:STDOUT: -// CHECK:STDOUT: fn @SelfNestedBadReturnType.as.SelfNested.impl.F.loc148_112.2(%x.param: %tuple.type.dce) -> out %return.param: %Array.ce4 [thunk @SelfNestedBadReturnType.as.SelfNested.impl.%SelfNestedBadReturnType.as.SelfNested.impl.F.decl.loc148_112.1 for @SelfNested.WithSelf.%SelfNested.WithSelf.F.decl, @SelfNested.WithSelf.F(constants.%SelfNested.facet.e71)] { +// CHECK:STDOUT: fn @SelfNestedBadReturnType.as.SelfNested.impl.F.loc283_112.2(%x.param: %tuple.type.dce) -> out %return.param: %Array.ce4 [thunk @SelfNestedBadReturnType.as.SelfNested.impl.%SelfNestedBadReturnType.as.SelfNested.impl.F.decl.loc283_112.1 for @SelfNested.WithSelf.%SelfNested.WithSelf.F.decl, @SelfNested.WithSelf.F(constants.%SelfNested.facet.e71)] { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: %SelfNestedBadReturnType.as.SelfNested.impl.F.type.1cbabe.1 = name_ref F, @SelfNestedBadReturnType.as.SelfNested.impl.%SelfNestedBadReturnType.as.SelfNested.impl.F.decl.loc148_112.1 [concrete = constants.%SelfNestedBadReturnType.as.SelfNested.impl.F.5a7d54.1] -// CHECK:STDOUT: %.loc148_112.1: ref %Array.870 = temporary_storage -// CHECK:STDOUT: %SelfNestedBadReturnType.as.SelfNested.impl.F.call: init %Array.870 to %.loc148_112.1 = call %F.ref(%x.param) -// CHECK:STDOUT: %.loc148_112.2: %Array.ce4 = converted %SelfNestedBadReturnType.as.SelfNested.impl.F.call, [concrete = ] +// CHECK:STDOUT: %F.ref: %SelfNestedBadReturnType.as.SelfNested.impl.F.type.1cbabe.1 = name_ref F, @SelfNestedBadReturnType.as.SelfNested.impl.%SelfNestedBadReturnType.as.SelfNested.impl.F.decl.loc283_112.1 [concrete = constants.%SelfNestedBadReturnType.as.SelfNested.impl.F.5a7d54.1] +// CHECK:STDOUT: %.loc283_112.1: ref %Array.870 = temporary_storage +// CHECK:STDOUT: %SelfNestedBadReturnType.as.SelfNested.impl.F.call: init %Array.870 to %.loc283_112.1 = call %F.ref(%x.param) +// CHECK:STDOUT: %.loc283_112.2: %Array.ce4 = converted %SelfNestedBadReturnType.as.SelfNested.impl.F.call, [concrete = ] // CHECK:STDOUT: return to %return.param // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1392,19 +1527,19 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: // CHECK:STDOUT: specific @SelfNested.WithSelf.F(constants.%Self.e81) { // CHECK:STDOUT: %Self => constants.%Self.e81 -// CHECK:STDOUT: %Self.as_type.loc128_16.1 => constants.%Self.as_type.8ab -// CHECK:STDOUT: %ptr.loc128_16.1 => constants.%ptr.a16 -// CHECK:STDOUT: %struct_type.x.y.loc128_37.1 => constants.%struct_type.x.y.34d +// CHECK:STDOUT: %Self.as_type.loc238_16.1 => constants.%Self.as_type.8ab +// CHECK:STDOUT: %ptr.loc238_16.1 => constants.%ptr.a16 +// CHECK:STDOUT: %struct_type.x.y.loc238_37.1 => constants.%struct_type.x.y.34d // CHECK:STDOUT: %tuple => constants.%tuple.ea4 // CHECK:STDOUT: %tuple.type => constants.%tuple.type.684 -// CHECK:STDOUT: %pattern_type.loc128_9 => constants.%pattern_type.871 -// CHECK:STDOUT: %x.param_patt.loc128_9.2 => constants.%x.param_patt.8f6 -// CHECK:STDOUT: %x.patt.loc128_9.2 => constants.%x.patt.48b -// CHECK:STDOUT: %Array.loc128_57.1 => constants.%Array.d32 -// CHECK:STDOUT: %.loc128_57.1 => constants.%.ec2 -// CHECK:STDOUT: %pattern_type.loc128_57 => constants.%pattern_type.4a4 -// CHECK:STDOUT: %return.param_patt.loc128_57.2 => constants.%return.param_patt.36b -// CHECK:STDOUT: %return.patt.loc128_41.2 => constants.%return.patt.7a8 +// CHECK:STDOUT: %pattern_type.loc238_9 => constants.%pattern_type.871 +// CHECK:STDOUT: %x.param_patt.loc238_9.2 => constants.%x.param_patt.8f6 +// CHECK:STDOUT: %x.patt.loc238_9.2 => constants.%x.patt.48b +// CHECK:STDOUT: %Array.loc238_57.1 => constants.%Array.d32 +// CHECK:STDOUT: %.loc238_57.1 => constants.%.ec2 +// CHECK:STDOUT: %pattern_type.loc238_57 => constants.%pattern_type.4a4 +// CHECK:STDOUT: %return.param_patt.loc238_57.2 => constants.%return.param_patt.36b +// CHECK:STDOUT: %return.patt.loc238_41.2 => constants.%return.patt.7a8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @SelfNested.WithSelf(constants.%SelfNested.facet.d0d) { @@ -1416,19 +1551,19 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: // CHECK:STDOUT: specific @SelfNested.WithSelf.F(constants.%SelfNested.facet.d0d) { // CHECK:STDOUT: %Self => constants.%SelfNested.facet.d0d -// CHECK:STDOUT: %Self.as_type.loc128_16.1 => constants.%SelfNestedBadParam -// CHECK:STDOUT: %ptr.loc128_16.1 => constants.%ptr.52e -// CHECK:STDOUT: %struct_type.x.y.loc128_37.1 => constants.%struct_type.x.y.25d +// CHECK:STDOUT: %Self.as_type.loc238_16.1 => constants.%SelfNestedBadParam +// CHECK:STDOUT: %ptr.loc238_16.1 => constants.%ptr.52e +// CHECK:STDOUT: %struct_type.x.y.loc238_37.1 => constants.%struct_type.x.y.25d // CHECK:STDOUT: %tuple => constants.%tuple.17a // CHECK:STDOUT: %tuple.type => constants.%tuple.type.5e1 -// CHECK:STDOUT: %pattern_type.loc128_9 => constants.%pattern_type.1ec -// CHECK:STDOUT: %x.param_patt.loc128_9.2 => constants.%x.param_patt.255 -// CHECK:STDOUT: %x.patt.loc128_9.2 => constants.%x.patt.79a -// CHECK:STDOUT: %Array.loc128_57.1 => constants.%Array.870 -// CHECK:STDOUT: %.loc128_57.1 => constants.%.a71 -// CHECK:STDOUT: %pattern_type.loc128_57 => constants.%pattern_type.ec1 -// CHECK:STDOUT: %return.param_patt.loc128_57.2 => constants.%return.param_patt.8ed -// CHECK:STDOUT: %return.patt.loc128_41.2 => constants.%return.patt.21a +// CHECK:STDOUT: %pattern_type.loc238_9 => constants.%pattern_type.1ec +// CHECK:STDOUT: %x.param_patt.loc238_9.2 => constants.%x.param_patt.255 +// CHECK:STDOUT: %x.patt.loc238_9.2 => constants.%x.patt.79a +// CHECK:STDOUT: %Array.loc238_57.1 => constants.%Array.870 +// CHECK:STDOUT: %.loc238_57.1 => constants.%.a71 +// CHECK:STDOUT: %pattern_type.loc238_57 => constants.%pattern_type.ec1 +// CHECK:STDOUT: %return.param_patt.loc238_57.2 => constants.%return.param_patt.8ed +// CHECK:STDOUT: %return.patt.loc238_41.2 => constants.%return.patt.21a // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @SelfNested.WithSelf(constants.%SelfNested.facet.e71) { @@ -1440,18 +1575,18 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: // CHECK:STDOUT: specific @SelfNested.WithSelf.F(constants.%SelfNested.facet.e71) { // CHECK:STDOUT: %Self => constants.%SelfNested.facet.e71 -// CHECK:STDOUT: %Self.as_type.loc128_16.1 => constants.%SelfNestedBadReturnType -// CHECK:STDOUT: %ptr.loc128_16.1 => constants.%ptr.f55 -// CHECK:STDOUT: %struct_type.x.y.loc128_37.1 => constants.%struct_type.x.y.03e +// CHECK:STDOUT: %Self.as_type.loc238_16.1 => constants.%SelfNestedBadReturnType +// CHECK:STDOUT: %ptr.loc238_16.1 => constants.%ptr.f55 +// CHECK:STDOUT: %struct_type.x.y.loc238_37.1 => constants.%struct_type.x.y.03e // CHECK:STDOUT: %tuple => constants.%tuple.ef1 // CHECK:STDOUT: %tuple.type => constants.%tuple.type.dce -// CHECK:STDOUT: %pattern_type.loc128_9 => constants.%pattern_type.7fc -// CHECK:STDOUT: %x.param_patt.loc128_9.2 => constants.%x.param_patt.04c -// CHECK:STDOUT: %x.patt.loc128_9.2 => constants.%x.patt.10a -// CHECK:STDOUT: %Array.loc128_57.1 => constants.%Array.ce4 -// CHECK:STDOUT: %.loc128_57.1 => constants.%.069 -// CHECK:STDOUT: %pattern_type.loc128_57 => constants.%pattern_type.5b0 -// CHECK:STDOUT: %return.param_patt.loc128_57.2 => constants.%return.param_patt.c20 -// CHECK:STDOUT: %return.patt.loc128_41.2 => constants.%return.patt.02d +// CHECK:STDOUT: %pattern_type.loc238_9 => constants.%pattern_type.7fc +// CHECK:STDOUT: %x.param_patt.loc238_9.2 => constants.%x.param_patt.04c +// CHECK:STDOUT: %x.patt.loc238_9.2 => constants.%x.patt.10a +// CHECK:STDOUT: %Array.loc238_57.1 => constants.%Array.ce4 +// CHECK:STDOUT: %.loc238_57.1 => constants.%.069 +// CHECK:STDOUT: %pattern_type.loc238_57 => constants.%pattern_type.5b0 +// CHECK:STDOUT: %return.param_patt.loc238_57.2 => constants.%return.param_patt.c20 +// CHECK:STDOUT: %return.patt.loc238_41.2 => constants.%return.patt.02d // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/fail_impl_bad_interface.carbon b/toolchain/check/testdata/impl/fail_impl_bad_interface.carbon index 15625dd60fd4..85bf99a16533 100644 --- a/toolchain/check/testdata/impl/fail_impl_bad_interface.carbon +++ b/toolchain/check/testdata/impl/fail_impl_bad_interface.carbon @@ -16,8 +16,16 @@ library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_impl_as_false.carbon:[[@LINE+3]]:13-17: error: cannot implicitly convert non-type value of type `bool` to `type` [ConversionFailureNonTypeToFacet] -// CHECK:STDERR: fail_impl_as_false.carbon:[[@LINE+2]]:13-17: note: type `bool` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_impl_as_false.carbon:[[@LINE+11]]:13 +// CHECK:STDERR: -> │ impl i32 as false {} +// CHECK:STDERR: · ┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert non-type value of type `bool` +// CHECK:STDERR: · │ ┃ to `type` +// CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet] +// CHECK:STDERR: · ╰────┤ type `bool` does not implement interface +// CHECK:STDERR: · │ `Core.ImplicitAs(type)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl i32 as false {} @@ -25,7 +33,11 @@ impl i32 as false {} library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_impl_as_type.carbon:[[@LINE+2]]:1-19: error: impl as 0 interfaces, expected 1 [ImplOfNotOneInterface] +// CHECK:STDERR: ╭─┤ fail_impl_as_type.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ impl bool as type {} +// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: impl as 0 interfaces, expected 1 [ImplOfNotOneInterface] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl bool as type {} @@ -33,7 +45,12 @@ impl bool as type {} library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_impl_as_type_where.carbon:[[@LINE+2]]:1-41: error: impl as 0 interfaces, expected 1 [ImplOfNotOneInterface] +// CHECK:STDERR: ╭─┤ fail_impl_as_type_where.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ impl f64 as type where .Self impls type {} +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: impl as 0 interfaces, expected 1 +// CHECK:STDERR: · ┃ [ImplOfNotOneInterface] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl f64 as type where .Self impls type {} @@ -43,7 +60,12 @@ library "[[@TEST_NAME]]"; interface I {} -// CHECK:STDERR: fail_impl_as_type_where_impls_interface.carbon:[[@LINE+2]]:1-45: error: impl as 0 interfaces, expected 1 [ImplOfNotOneInterface] +// CHECK:STDERR: ╭─┤ fail_impl_as_type_where_impls_interface.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ impl {.a: bool} as type where .Self impls I {} +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: impl as 0 interfaces, expected 1 +// CHECK:STDERR: · ┃ [ImplOfNotOneInterface] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl {.a: bool} as type where .Self impls I {} @@ -76,7 +98,7 @@ impl {.a: bool} as type where .Self impls I {} // CHECK:STDOUT: .Core = imports.%Core // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %.loc7: type = converted @i32.as..impl.%false, [concrete = ] +// CHECK:STDOUT: %.loc15: type = converted @i32.as..impl.%false, [concrete = ] // CHECK:STDOUT: impl_decl @i32.as..impl [concrete] {} { // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %false: bool = bool_literal false [concrete = constants.%false] @@ -110,12 +132,12 @@ impl {.a: bool} as type where .Self impls I {} // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: impl_decl @bool.as..impl [concrete] {} { -// CHECK:STDOUT: %.loc6_6: type = type_literal bool [concrete = bool] -// CHECK:STDOUT: %.loc6_14: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc10_6: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %.loc10_14: type = type_literal type [concrete = type] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @bool.as..impl: %.loc6_6 as { +// CHECK:STDOUT: impl @bool.as..impl: %.loc10_6 as { // CHECK:STDOUT: !members: // CHECK:STDOUT: extend // CHECK:STDOUT: witness = @@ -149,18 +171,18 @@ impl {.a: bool} as type where .Self impls I {} // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: impl_decl @f64.as..impl [concrete] {} { // CHECK:STDOUT: %f64: type = type_literal constants.%f64 [concrete = constants.%f64] -// CHECK:STDOUT: %.loc6_13: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc11_13: type = type_literal type [concrete = type] // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %.loc6_13 [concrete] -// CHECK:STDOUT: %.Self.ref.loc6_24.1: type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc6_36: type = type_literal type [concrete = type] -// CHECK:STDOUT: %impls.loc6_30.1 = requirement_impls %.Self.ref.loc6_24.1, %.loc6_36 [concrete] +// CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %.loc11_13 [concrete] +// CHECK:STDOUT: %.Self.ref.loc11_24.1: type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc11_36: type = type_literal type [concrete = type] +// CHECK:STDOUT: %impls.loc11_30.1 = requirement_impls %.Self.ref.loc11_24.1, %.loc11_36 [concrete] // CHECK:STDOUT: %.Self: type = symbolic_binding .Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %.Self.ref.loc6_24.2: type = name_ref .Self, %.Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %impls.loc6_30.2 = requirement_impls %.Self.ref.loc6_24.2, %.loc6_36 [concrete] -// CHECK:STDOUT: %.loc6_18: type = where_expr [concrete = type] { -// CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %.loc6_13 [concrete] -// CHECK:STDOUT: %impls.loc6_30.2 = requirement_impls %.Self.ref.loc6_24.2, %.loc6_36 [concrete] +// CHECK:STDOUT: %.Self.ref.loc11_24.2: type = name_ref .Self, %.Self [symbolic_self = constants.%.Self] +// CHECK:STDOUT: %impls.loc11_30.2 = requirement_impls %.Self.ref.loc11_24.2, %.loc11_36 [concrete] +// CHECK:STDOUT: %.loc11_18: type = where_expr [concrete = type] { +// CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %.loc11_13 [concrete] +// CHECK:STDOUT: %impls.loc11_30.2 = requirement_impls %.Self.ref.loc11_24.2, %.loc11_36 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -200,20 +222,20 @@ impl {.a: bool} as type where .Self impls I {} // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {} // CHECK:STDOUT: impl_decl @struct_type.a.as..impl [concrete] {} { -// CHECK:STDOUT: %.loc8_11: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %.loc13_11: type = type_literal bool [concrete = bool] // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: bool} [concrete = constants.%struct_type.a] -// CHECK:STDOUT: %.loc8_20: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc13_20: type = type_literal type [concrete = type] // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %.loc8_20 [concrete] -// CHECK:STDOUT: %.Self.ref.loc8_31.1: type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %.loc13_20 [concrete] +// CHECK:STDOUT: %.Self.ref.loc13_31.1: type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] -// CHECK:STDOUT: %impls.loc8_37.1 = requirement_impls %.Self.ref.loc8_31.1, %I.ref [concrete] +// CHECK:STDOUT: %impls.loc13_37.1 = requirement_impls %.Self.ref.loc13_31.1, %I.ref [concrete] // CHECK:STDOUT: %.Self: type = symbolic_binding .Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %.Self.ref.loc8_31.2: type = name_ref .Self, %.Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %impls.loc8_37.2 = requirement_impls %.Self.ref.loc8_31.2, %I.ref [concrete] -// CHECK:STDOUT: %.loc8_25: type = where_expr [concrete = constants.%type_where] { -// CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %.loc8_20 [concrete] -// CHECK:STDOUT: %impls.loc8_37.2 = requirement_impls %.Self.ref.loc8_31.2, %I.ref [concrete] +// CHECK:STDOUT: %.Self.ref.loc13_31.2: type = name_ref .Self, %.Self [symbolic_self = constants.%.Self] +// CHECK:STDOUT: %impls.loc13_37.2 = requirement_impls %.Self.ref.loc13_31.2, %I.ref [concrete] +// CHECK:STDOUT: %.loc13_25: type = where_expr [concrete = constants.%type_where] { +// CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %.loc13_20 [concrete] +// CHECK:STDOUT: %impls.loc13_37.2 = requirement_impls %.Self.ref.loc13_31.2, %I.ref [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/impl/fail_impl_bad_type.carbon b/toolchain/check/testdata/impl/fail_impl_bad_type.carbon index 9d4795cd31a9..1a43dffd16ab 100644 --- a/toolchain/check/testdata/impl/fail_impl_bad_type.carbon +++ b/toolchain/check/testdata/impl/fail_impl_bad_type.carbon @@ -14,8 +14,15 @@ interface I {} -// CHECK:STDERR: fail_impl_bad_type.carbon:[[@LINE+3]]:6-9: error: cannot implicitly convert non-type value of type `bool` to `type` [ConversionFailureNonTypeToFacet] -// CHECK:STDERR: fail_impl_bad_type.carbon:[[@LINE+2]]:6-9: note: type `bool` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_impl_bad_type.carbon:[[@LINE+10]]:6 +// CHECK:STDERR: -> │ impl true as I {} +// CHECK:STDERR: · ┳━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert non-type value of type `bool` to +// CHECK:STDERR: · │ ┃ `type` +// CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet] +// CHECK:STDERR: · ╰────┤ type `bool` does not implement interface `Core.ImplicitAs(type)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl true as I {} @@ -48,10 +55,10 @@ impl true as I {} // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {} // CHECK:STDOUT: impl_decl @.as.I.impl [concrete] {} { // CHECK:STDOUT: %true: bool = bool_literal true [concrete = constants.%true] -// CHECK:STDOUT: %.loc20: type = converted %true, [concrete = ] +// CHECK:STDOUT: %.loc27: type = converted %true, [concrete = ] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc20: = impl_self_witness , @I [concrete = ] +// CHECK:STDOUT: %.loc27: = impl_self_witness , @I [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { diff --git a/toolchain/check/testdata/impl/fail_redefinition.carbon b/toolchain/check/testdata/impl/fail_redefinition.carbon index 3c7f0341ade9..3ecf9db56fb7 100644 --- a/toolchain/check/testdata/impl/fail_redefinition.carbon +++ b/toolchain/check/testdata/impl/fail_redefinition.carbon @@ -16,8 +16,15 @@ interface I {} impl i32 as I {} -// CHECK:STDERR: fail_redefinition.carbon:[[@LINE+3]]:1-15: error: redefinition of `impl i32 as I` [ImplRedefinition] -// CHECK:STDERR: fail_redefinition.carbon:[[@LINE-3]]:1-15: note: previous definition was here [ImplPreviousDefinition] +// CHECK:STDERR: ╭─┤ fail_redefinition.carbon:[[@LINE+10]]:1 +// CHECK:STDERR: │ impl i32 as I {} +// CHECK:STDERR: · ───────┬─────── +// CHECK:STDERR: · ╰──┤ previous definition was here [ImplPreviousDefinition] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ impl i32 as I {} +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redefinition of `impl i32 as I` [ImplRedefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl i32 as I {} @@ -61,7 +68,7 @@ impl i32 as I {} // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc22: = impl_self_witness @i32.as.I.impl.3f9847.2.%i32, @I [concrete = constants.%.c43] +// CHECK:STDOUT: %.loc29: = impl_self_witness @i32.as.I.impl.3f9847.2.%i32, @I [concrete = constants.%.c43] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { diff --git a/toolchain/check/testdata/impl/fail_self_type_mismatch.carbon b/toolchain/check/testdata/impl/fail_self_type_mismatch.carbon index 79f51fb01934..6673f39dfb60 100644 --- a/toolchain/check/testdata/impl/fail_self_type_mismatch.carbon +++ b/toolchain/check/testdata/impl/fail_self_type_mismatch.carbon @@ -27,10 +27,22 @@ impl bool as I { } impl i32 as I { - // CHECK:STDERR: fail_self_type_mismatch.carbon:[[@LINE+5]]:3-18: error: cannot implicitly convert expression of type `C(i32 as I)` to `C(i32)` [ConversionFailure] - // CHECK:STDERR: fail_self_type_mismatch.carbon:[[@LINE+4]]:3-18: note: type `C(i32 as I)` does not implement interface `Core.ImplicitAs(C(i32))` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: fail_self_type_mismatch.carbon:[[@LINE+3]]:8-16: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fail_self_type_mismatch.carbon:[[@LINE-14]]:3-19: note: while building thunk to match the signature of this function [ThunkSignature] + // CHECK:STDERR: ╭─┤ fail_self_type_mismatch.carbon:[[@LINE+17]]:3 + // CHECK:STDERR: │ fn F(c: C(Self)); + // CHECK:STDERR: · ────────┬──────── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ fn F(c: C(i32)); + // CHECK:STDERR: · ━━━━━┳━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `C(i32 as I)` to + // CHECK:STDERR: · │ ┃ `C(i32)` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `C(i32 as I)` does not implement interface + // CHECK:STDERR: · │ │ `Core.ImplicitAs(C(i32))` + // CHECK:STDERR: · │ │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: · ╰──────┤ initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(c: C(i32)); } @@ -86,7 +98,7 @@ impl i32 as I { // CHECK:STDOUT: %pattern_type.256: type = pattern_type %C.fef [concrete] // CHECK:STDOUT: %c.param_patt.ab3: %pattern_type.256 = value_param_pattern [concrete] // CHECK:STDOUT: %c.patt.e1b: %pattern_type.256 = wrapper_binding_pattern c, %c.param_patt.ab3 [concrete] -// CHECK:STDOUT: %i32.as.I.impl.F.type.48cdab.1: type = fn_type @i32.as.I.impl.F.loc35_18.1 [concrete] +// CHECK:STDOUT: %i32.as.I.impl.F.type.48cdab.1: type = fn_type @i32.as.I.impl.F.loc47_18.1 [concrete] // CHECK:STDOUT: %i32.as.I.impl.F.bd5be1.1: %i32.as.I.impl.F.type.48cdab.1 = struct_value () [concrete] // CHECK:STDOUT: %I.facet.01e: %I.type = facet_value %i32, (%I.impl_witness.f53) [concrete] // CHECK:STDOUT: %I.WithSelf.F.type.091: type = fn_type @I.WithSelf.F, @I.WithSelf(%I.facet.01e) [concrete] @@ -95,7 +107,7 @@ impl i32 as I { // CHECK:STDOUT: %pattern_type.e36: type = pattern_type %C.186 [concrete] // CHECK:STDOUT: %c.param_patt.21f: %pattern_type.e36 = value_param_pattern [concrete] // CHECK:STDOUT: %c.patt.147: %pattern_type.e36 = wrapper_binding_pattern c, %c.param_patt.21f [concrete] -// CHECK:STDOUT: %i32.as.I.impl.F.type.48cdab.2: type = fn_type @i32.as.I.impl.F.loc35_18.2 [concrete] +// CHECK:STDOUT: %i32.as.I.impl.F.type.48cdab.2: type = fn_type @i32.as.I.impl.F.loc47_18.2 [concrete] // CHECK:STDOUT: %i32.as.I.impl.F.bd5be1.2: %i32.as.I.impl.F.type.48cdab.2 = struct_value () [concrete] // CHECK:STDOUT: %ImplicitAs.type.0ff: type = generic_interface_type @ImplicitAs [concrete] // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.0ff = struct_value () [concrete] @@ -207,31 +219,31 @@ impl i32 as I { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @i32.as.I.impl: %i32 as %I.ref { -// CHECK:STDOUT: %i32.as.I.impl.F.decl.loc35_18.1: %i32.as.I.impl.F.type.48cdab.1 = fn_decl @i32.as.I.impl.F.loc35_18.1 [concrete = constants.%i32.as.I.impl.F.bd5be1.1] { +// CHECK:STDOUT: %i32.as.I.impl.F.decl.loc47_18.1: %i32.as.I.impl.F.type.48cdab.1 = fn_decl @i32.as.I.impl.F.loc47_18.1 [concrete = constants.%i32.as.I.impl.F.bd5be1.1] { // CHECK:STDOUT: %c.param_patt: %pattern_type.256 = value_param_pattern [concrete = constants.%c.param_patt.ab3] // CHECK:STDOUT: %c.patt: %pattern_type.256 = wrapper_binding_pattern c, %c.param_patt [concrete = constants.%c.patt.e1b] // CHECK:STDOUT: } { // CHECK:STDOUT: %c.param: %C.fef = value_param call_param0 -// CHECK:STDOUT: %.loc35: type = splice_block %C [concrete = constants.%C.fef] { +// CHECK:STDOUT: %.loc47: type = splice_block %C [concrete = constants.%C.fef] { // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [concrete = constants.%C.generic] // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %C: type = class_type @C, @C(type, constants.%i32) [concrete = constants.%C.fef] // CHECK:STDOUT: } // CHECK:STDOUT: %c: %C.fef = wrapper_binding c, %c.param // CHECK:STDOUT: } -// CHECK:STDOUT: %i32.as.I.impl.F.decl.loc35_18.2: %i32.as.I.impl.F.type.48cdab.2 = fn_decl @i32.as.I.impl.F.loc35_18.2 [concrete = constants.%i32.as.I.impl.F.bd5be1.2] { +// CHECK:STDOUT: %i32.as.I.impl.F.decl.loc47_18.2: %i32.as.I.impl.F.type.48cdab.2 = fn_decl @i32.as.I.impl.F.loc47_18.2 [concrete = constants.%i32.as.I.impl.F.bd5be1.2] { // CHECK:STDOUT: %.1: %pattern_type.e36 = specific_constant constants.%c.param_patt.21f, @I.WithSelf.F(constants.%I.facet.01e) [concrete = constants.%c.param_patt.21f] // CHECK:STDOUT: %c.patt: %pattern_type.e36 = wrapper_binding_pattern c, %.1 [concrete = constants.%c.patt.147] // CHECK:STDOUT: } { // CHECK:STDOUT: %c.param: %C.186 = value_param call_param0 // CHECK:STDOUT: %c: %C.186 = wrapper_binding c, %c.param // CHECK:STDOUT: } -// CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (%i32.as.I.impl.F.decl.loc35_18.2), @i32.as.I.impl [concrete] +// CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (%i32.as.I.impl.F.decl.loc47_18.2), @i32.as.I.impl [concrete] // CHECK:STDOUT: %I.impl_witness: = impl_witness %I.impl_witness_table [concrete = constants.%I.impl_witness.f53] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .C = -// CHECK:STDOUT: .F = %i32.as.I.impl.F.decl.loc35_18.1 +// CHECK:STDOUT: .F = %i32.as.I.impl.F.decl.loc47_18.1 // CHECK:STDOUT: extend %I.ref // CHECK:STDOUT: witness = %I.impl_witness // CHECK:STDOUT: } @@ -266,12 +278,12 @@ impl i32 as I { // CHECK:STDOUT: // CHECK:STDOUT: fn @bool.as.I.impl.F(%c.param: %C.820); // CHECK:STDOUT: -// CHECK:STDOUT: fn @i32.as.I.impl.F.loc35_18.1(%c.param: %C.fef); +// CHECK:STDOUT: fn @i32.as.I.impl.F.loc47_18.1(%c.param: %C.fef); // CHECK:STDOUT: -// CHECK:STDOUT: fn @i32.as.I.impl.F.loc35_18.2(%c.param: %C.186) [thunk @i32.as.I.impl.%i32.as.I.impl.F.decl.loc35_18.1 for @I.WithSelf.%I.WithSelf.F.decl, @I.WithSelf.F(constants.%I.facet.01e)] { +// CHECK:STDOUT: fn @i32.as.I.impl.F.loc47_18.2(%c.param: %C.186) [thunk @i32.as.I.impl.%i32.as.I.impl.F.decl.loc47_18.1 for @I.WithSelf.%I.WithSelf.F.decl, @I.WithSelf.F(constants.%I.facet.01e)] { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: %i32.as.I.impl.F.type.48cdab.1 = name_ref F, @i32.as.I.impl.%i32.as.I.impl.F.decl.loc35_18.1 [concrete = constants.%i32.as.I.impl.F.bd5be1.1] -// CHECK:STDOUT: %.loc35: %C.fef = converted %c.param, [concrete = ] +// CHECK:STDOUT: %F.ref: %i32.as.I.impl.F.type.48cdab.1 = name_ref F, @i32.as.I.impl.%i32.as.I.impl.F.decl.loc47_18.1 [concrete = constants.%i32.as.I.impl.F.bd5be1.1] +// CHECK:STDOUT: %.loc47: %C.fef = converted %c.param, [concrete = ] // CHECK:STDOUT: %i32.as.I.impl.F.call: init %empty_tuple.type = call %F.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/impl/forward_decls.carbon b/toolchain/check/testdata/impl/forward_decls.carbon index 242029b68c8b..e4285efef9d8 100644 --- a/toolchain/check/testdata/impl/forward_decls.carbon +++ b/toolchain/check/testdata/impl/forward_decls.carbon @@ -88,12 +88,25 @@ interface I { class C {} impl C as I; -// CHECK:STDERR: fail_unset_associated_const.carbon:[[@LINE+2]]:8-17: error: accessing member from impl before it has a defined value [ImplAccessMemberBeforeSet] +// CHECK:STDERR: ╭─┤ fail_unset_associated_const.carbon:[[@LINE+7]]:8 +// CHECK:STDERR: -> │ let x: (C as I).T = (); +// CHECK:STDERR: · ━━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: accessing member from impl before it has a defined value +// CHECK:STDERR: · ┃ [ImplAccessMemberBeforeSet] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let x: (C as I).T = (); -// CHECK:STDERR: fail_unset_associated_const.carbon:[[@LINE+3]]:1-13: error: associated constant T not given a value in impl of interface I [ImplAssociatedConstantNeedsValue] -// CHECK:STDERR: fail_unset_associated_const.carbon:[[@LINE-10]]:7-13: note: associated constant declared here [AssociatedConstantHere] +// CHECK:STDERR: ╭─┤ fail_unset_associated_const.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: │ let T: type; +// CHECK:STDERR: · ───┬─── +// CHECK:STDERR: · ╰──┤ associated constant declared here [AssociatedConstantHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ impl C as I {} +// CHECK:STDERR: · ━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: associated constant T not given a value in impl of interface I +// CHECK:STDERR: · ┃ [ImplAssociatedConstantNeedsValue] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl C as I {} @@ -103,14 +116,27 @@ library "[[@TEST_NAME]]"; interface I; class C; class D {} -// CHECK:STDERR: fail_associated_const_before_interface_definition.carbon:[[@LINE+3]]:19-20: error: member access into facet of incomplete type `I` [IncompleteTypeInMemberAccessOfFacet] -// CHECK:STDERR: fail_associated_const_before_interface_definition.carbon:[[@LINE-4]]:1-12: note: interface was forward declared here [InterfaceForwardDeclaredHere] +// CHECK:STDERR: ╭─┤ fail_associated_const_before_interface_definition.carbon:[[@LINE+11]]:19 +// CHECK:STDERR: │ interface I; +// CHECK:STDERR: · ──────┬───── +// CHECK:STDERR: · ╰──┤ interface was forward declared here [InterfaceForwardDeclaredHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ impl D as I where .T = C; +// CHECK:STDERR: · ━┳ +// CHECK:STDERR: · ┗━━┫ error: member access into facet of incomplete type `I` +// CHECK:STDERR: · ┃ [IncompleteTypeInMemberAccessOfFacet] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl D as I where .T = C; interface I {} class C {} -// CHECK:STDERR: fail_associated_const_before_interface_definition.carbon:[[@LINE+2]]:19-20: error: member name `T` not found in `I` [MemberNameNotFoundInSpecificScope] +// CHECK:STDERR: ╭─┤ fail_associated_const_before_interface_definition.carbon:[[@LINE+7]]:19 +// CHECK:STDERR: -> │ impl D as I where .T = C {} +// CHECK:STDERR: · ━┳ +// CHECK:STDERR: · ┗━━┫ error: member name `T` not found in `I` +// CHECK:STDERR: · ┃ [MemberNameNotFoundInSpecificScope] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl D as I where .T = C {} @@ -149,7 +175,11 @@ library "[[@TEST_NAME]]"; interface I; interface J; -// CHECK:STDERR: fail_todo_two_interfaces.carbon:[[@LINE+2]]:1-17: error: impl as 2 interfaces, expected 1 [ImplOfNotOneInterface] +// CHECK:STDERR: ╭─┤ fail_todo_two_interfaces.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ impl {} as I & J; +// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: impl as 2 interfaces, expected 1 [ImplOfNotOneInterface] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl {} as I & J; @@ -167,8 +197,16 @@ class C {} impl C as I where .T = (); -// CHECK:STDERR: fail_never_assigned_associated_const.carbon:[[@LINE+3]]:1-27: error: associated constant U not given a value in impl of interface I [ImplAssociatedConstantNeedsValue] -// CHECK:STDERR: fail_never_assigned_associated_const.carbon:[[@LINE-7]]:7-13: note: associated constant declared here [AssociatedConstantHere] +// CHECK:STDERR: ╭─┤ fail_never_assigned_associated_const.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: │ let U: type; +// CHECK:STDERR: · ───┬─── +// CHECK:STDERR: · ╰──┤ associated constant declared here [AssociatedConstantHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ impl C as I where .T = () {} +// CHECK:STDERR: · ━━━━━━┳━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: associated constant U not given a value in impl of interface I +// CHECK:STDERR: · ┃ [ImplAssociatedConstantNeedsValue] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl C as I where .T = () {} @@ -960,13 +998,13 @@ impl C as Y {} // CHECK:STDOUT: %I.ref.loc7: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } // CHECK:STDOUT: %.loc7: = impl_self_witness @C.as.I.impl.%C.ref.loc7, @I [concrete = constants.%.b7f] -// CHECK:STDOUT: %.loc11_16.1: type = splice_block %impl.elem0 [concrete = ] { +// CHECK:STDOUT: %.loc16_16.1: type = splice_block %impl.elem0 [concrete = ] { // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [concrete = constants.%C] // CHECK:STDOUT: %I.ref: type = name_ref I, %I.decl [concrete = constants.%I.type] // CHECK:STDOUT: %I.facet: %I.type = facet_value %C.ref, (constants.%I.impl_witness) [concrete = constants.%I.facet] -// CHECK:STDOUT: %.loc11_11: %I.type = converted %C.ref, %I.facet [concrete = constants.%I.facet] -// CHECK:STDOUT: %as_type: type = facet_access_type %.loc11_11 [concrete = constants.%C] -// CHECK:STDOUT: %.loc11_16.2: type = converted %.loc11_11, %as_type [concrete = constants.%C] +// CHECK:STDOUT: %.loc16_11: %I.type = converted %C.ref, %I.facet [concrete = constants.%I.facet] +// CHECK:STDOUT: %as_type: type = facet_access_type %.loc16_11 [concrete = constants.%C] +// CHECK:STDOUT: %.loc16_16.2: type = converted %.loc16_11, %as_type [concrete = constants.%C] // CHECK:STDOUT: %T.ref: %I.assoc_type = name_ref T, @T.%assoc0 [concrete = constants.%assoc0] // CHECK:STDOUT: %impl.elem0: type = impl_witness_access constants.%I.impl_witness, element0 [concrete = ] // CHECK:STDOUT: } @@ -975,10 +1013,10 @@ impl C as Y {} // CHECK:STDOUT: %x.patt: = value_binding_pattern x [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: impl_decl @C.as.I.impl [concrete] {} { -// CHECK:STDOUT: %C.ref.loc16: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %I.ref.loc16: type = name_ref I, file.%I.decl [concrete = constants.%I.type] +// CHECK:STDOUT: %C.ref.loc29: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %I.ref.loc29: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc16: = impl_self_witness @C.as.I.impl.%C.ref.loc16, @I [concrete = constants.%.b7f] +// CHECK:STDOUT: %.loc29: = impl_self_witness @C.as.I.impl.%C.ref.loc29, @I [concrete = constants.%.b7f] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { @@ -1017,7 +1055,7 @@ impl C as Y {} // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc16: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1062,37 +1100,37 @@ impl C as Y {} // CHECK:STDOUT: %C.decl.loc4: type = class_decl @C [concrete = constants.%C] {} {} // CHECK:STDOUT: %D.decl: type = class_decl @D [concrete = constants.%D] {} {} // CHECK:STDOUT: impl_decl @D.as..impl [concrete] {} { -// CHECK:STDOUT: %D.ref.loc9: type = name_ref D, file.%D.decl [concrete = constants.%D] -// CHECK:STDOUT: %I.ref.loc9: type = name_ref I, file.%I.decl.loc3 [concrete = constants.%I.type] -// CHECK:STDOUT: %.Self.frozen.loc9: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %base_facet_type.loc9 = requirement_base_facet_type %I.ref.loc9 [concrete] -// CHECK:STDOUT: %.Self.ref.loc9: %I.type = name_ref .Self, %.Self.frozen.loc9 [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc9: type = facet_access_type %.Self.ref.loc9 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc9_19: type = converted %.Self.ref.loc9, %.Self.as_type.loc9 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %T.ref.loc9: = name_ref T, [concrete = ] -// CHECK:STDOUT: %C.ref.loc9: type = name_ref C, file.%C.decl.loc4 [concrete = constants.%C] -// CHECK:STDOUT: %rewrite.loc9 = requirement_rewrite %T.ref.loc9, [concrete] -// CHECK:STDOUT: %.loc9_13: type = where_expr [concrete = ] { -// CHECK:STDOUT: %base_facet_type.loc9 = requirement_base_facet_type %I.ref.loc9 [concrete] -// CHECK:STDOUT: %rewrite.loc9 = requirement_rewrite %T.ref.loc9, [concrete] +// CHECK:STDOUT: %D.ref.loc17: type = name_ref D, file.%D.decl [concrete = constants.%D] +// CHECK:STDOUT: %I.ref.loc17: type = name_ref I, file.%I.decl.loc3 [concrete = constants.%I.type] +// CHECK:STDOUT: %.Self.frozen.loc17: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %base_facet_type.loc17 = requirement_base_facet_type %I.ref.loc17 [concrete] +// CHECK:STDOUT: %.Self.ref.loc17: %I.type = name_ref .Self, %.Self.frozen.loc17 [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc17: type = facet_access_type %.Self.ref.loc17 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc17_19: type = converted %.Self.ref.loc17, %.Self.as_type.loc17 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %T.ref.loc17: = name_ref T, [concrete = ] +// CHECK:STDOUT: %C.ref.loc17: type = name_ref C, file.%C.decl.loc4 [concrete = constants.%C] +// CHECK:STDOUT: %rewrite.loc17 = requirement_rewrite %T.ref.loc17, [concrete] +// CHECK:STDOUT: %.loc17_13: type = where_expr [concrete = ] { +// CHECK:STDOUT: %base_facet_type.loc17 = requirement_base_facet_type %I.ref.loc17 [concrete] +// CHECK:STDOUT: %rewrite.loc17 = requirement_rewrite %T.ref.loc17, [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } -// CHECK:STDOUT: %I.decl.loc11: type = interface_decl @I [concrete = constants.%I.type] {} {} -// CHECK:STDOUT: %C.decl.loc12: type = class_decl @C [concrete = constants.%C] {} {} +// CHECK:STDOUT: %I.decl.loc19: type = interface_decl @I [concrete = constants.%I.type] {} {} +// CHECK:STDOUT: %C.decl.loc20: type = class_decl @C [concrete = constants.%C] {} {} // CHECK:STDOUT: impl_decl @D.as..impl [concrete] {} { -// CHECK:STDOUT: %D.ref.loc15: type = name_ref D, file.%D.decl [concrete = constants.%D] -// CHECK:STDOUT: %I.ref.loc15: type = name_ref I, file.%I.decl.loc3 [concrete = constants.%I.type] -// CHECK:STDOUT: %.Self.frozen.loc15: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %base_facet_type.loc15 = requirement_base_facet_type %I.ref.loc15 [concrete] -// CHECK:STDOUT: %.Self.ref.loc15: %I.type = name_ref .Self, %.Self.frozen.loc15 [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc15: type = facet_access_type %.Self.ref.loc15 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc15_19: type = converted %.Self.ref.loc15, %.Self.as_type.loc15 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %T.ref.loc15: = name_ref T, [concrete = ] -// CHECK:STDOUT: %C.ref.loc15: type = name_ref C, file.%C.decl.loc4 [concrete = constants.%C] -// CHECK:STDOUT: %rewrite.loc15 = requirement_rewrite %T.ref.loc15, [concrete] -// CHECK:STDOUT: %.loc15_13: type = where_expr [concrete = ] { -// CHECK:STDOUT: %base_facet_type.loc15 = requirement_base_facet_type %I.ref.loc15 [concrete] -// CHECK:STDOUT: %rewrite.loc15 = requirement_rewrite %T.ref.loc15, [concrete] +// CHECK:STDOUT: %D.ref.loc28: type = name_ref D, file.%D.decl [concrete = constants.%D] +// CHECK:STDOUT: %I.ref.loc28: type = name_ref I, file.%I.decl.loc3 [concrete = constants.%I.type] +// CHECK:STDOUT: %.Self.frozen.loc28: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %base_facet_type.loc28 = requirement_base_facet_type %I.ref.loc28 [concrete] +// CHECK:STDOUT: %.Self.ref.loc28: %I.type = name_ref .Self, %.Self.frozen.loc28 [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc28: type = facet_access_type %.Self.ref.loc28 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc28_19: type = converted %.Self.ref.loc28, %.Self.as_type.loc28 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %T.ref.loc28: = name_ref T, [concrete = ] +// CHECK:STDOUT: %C.ref.loc28: type = name_ref C, file.%C.decl.loc4 [concrete = constants.%C] +// CHECK:STDOUT: %rewrite.loc28 = requirement_rewrite %T.ref.loc28, [concrete] +// CHECK:STDOUT: %.loc28_13: type = where_expr [concrete = ] { +// CHECK:STDOUT: %base_facet_type.loc28 = requirement_base_facet_type %I.ref.loc28 [concrete] +// CHECK:STDOUT: %rewrite.loc28 = requirement_rewrite %T.ref.loc28, [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -1109,7 +1147,7 @@ impl C as Y {} // CHECK:STDOUT: !requires: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @D.as..impl: %D.ref.loc9 as { +// CHECK:STDOUT: impl @D.as..impl: %D.ref.loc17 as { // CHECK:STDOUT: !members: // CHECK:STDOUT: extend // CHECK:STDOUT: witness = @@ -1553,19 +1591,19 @@ impl C as Y {} // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %I.decl.loc3: type = interface_decl @I [concrete = constants.%I.type] {} {} // CHECK:STDOUT: %J.decl.loc4: type = interface_decl @J [concrete = constants.%J.type] {} {} -// CHECK:STDOUT: %.loc8_14.1: type = value_of_initializer @empty_struct_type.as..impl.%type.as.BitAndWith.impl.Op.call [concrete = constants.%facet_type] -// CHECK:STDOUT: %.loc8_14.2: type = converted @empty_struct_type.as..impl.%type.as.BitAndWith.impl.Op.call, %.loc8_14.1 [concrete = constants.%facet_type] +// CHECK:STDOUT: %.loc12_14.1: type = value_of_initializer @empty_struct_type.as..impl.%type.as.BitAndWith.impl.Op.call [concrete = constants.%facet_type] +// CHECK:STDOUT: %.loc12_14.2: type = converted @empty_struct_type.as..impl.%type.as.BitAndWith.impl.Op.call, %.loc12_14.1 [concrete = constants.%facet_type] // CHECK:STDOUT: impl_decl @empty_struct_type.as..impl [concrete] {} { -// CHECK:STDOUT: %.loc8_7.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc8_7.2: type = converted %.loc8_7.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc12_7.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc12_7.2: type = converted %.loc12_7.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl.loc3 [concrete = constants.%I.type] // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl.loc4 [concrete = constants.%J.type] // CHECK:STDOUT: %impl.elem0: %.b4e = impl_witness_access constants.%BitAndWith.impl_witness, element0 [concrete = constants.%type.as.BitAndWith.impl.Op] // CHECK:STDOUT: %bound_method: = bound_method %I.ref, %impl.elem0 [concrete = constants.%type.as.BitAndWith.impl.Op.bound] // CHECK:STDOUT: %type.as.BitAndWith.impl.Op.call: init type = call %bound_method(%I.ref, %J.ref) [concrete = constants.%facet_type] // CHECK:STDOUT: } -// CHECK:STDOUT: %I.decl.loc10: type = interface_decl @I [concrete = constants.%I.type] {} {} -// CHECK:STDOUT: %J.decl.loc11: type = interface_decl @J [concrete = constants.%J.type] {} {} +// CHECK:STDOUT: %I.decl.loc14: type = interface_decl @I [concrete = constants.%I.type] {} {} +// CHECK:STDOUT: %J.decl.loc15: type = interface_decl @J [concrete = constants.%J.type] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { @@ -1590,7 +1628,7 @@ impl C as Y {} // CHECK:STDOUT: !requires: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @empty_struct_type.as..impl: %.loc8_7.2 as ; +// CHECK:STDOUT: impl @empty_struct_type.as..impl: %.loc12_7.2 as ; // CHECK:STDOUT: // CHECK:STDOUT: specific @I.WithSelf(constants.%Self.37e) {} // CHECK:STDOUT: @@ -1661,26 +1699,26 @@ impl C as Y {} // CHECK:STDOUT: } // CHECK:STDOUT: %.loc9: = impl_self_witness @C.as.I.impl.%C.ref.loc9, @I [concrete = constants.%.b7f] // CHECK:STDOUT: impl_decl @C.as.I.impl [concrete] {} { -// CHECK:STDOUT: %C.ref.loc14: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %I.ref.loc14: type = name_ref I, file.%I.decl [concrete = constants.%I.type] -// CHECK:STDOUT: %.Self.frozen.loc14: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %base_facet_type.loc14 = requirement_base_facet_type %I.ref.loc14 [concrete] -// CHECK:STDOUT: %.Self.ref.loc14: %I.type = name_ref .Self, %.Self.frozen.loc14 [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc14: type = facet_access_type %.Self.ref.loc14 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc14_19: type = converted %.Self.ref.loc14, %.Self.as_type.loc14 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %T.ref.loc14: %I.assoc_type = name_ref T, @T.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc14_19.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] -// CHECK:STDOUT: %.loc14_25.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc14_25.2: type = converted %.loc14_25.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %rewrite.loc14_22.1 = requirement_rewrite %impl.elem0.loc14_19.1, %.loc14_25.2 [concrete] -// CHECK:STDOUT: %impl.elem0.loc14_19.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] -// CHECK:STDOUT: %rewrite.loc14_22.2 = requirement_rewrite %impl.elem0.loc14_19.2, %.loc14_25.2 [concrete] -// CHECK:STDOUT: %.loc14_13: type = where_expr [concrete = constants.%I_where.type.d99] { -// CHECK:STDOUT: %base_facet_type.loc14 = requirement_base_facet_type %I.ref.loc14 [concrete] -// CHECK:STDOUT: %rewrite.loc14_22.2 = requirement_rewrite %impl.elem0.loc14_19.2, %.loc14_25.2 [concrete] +// CHECK:STDOUT: %C.ref.loc22: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %I.ref.loc22: type = name_ref I, file.%I.decl [concrete = constants.%I.type] +// CHECK:STDOUT: %.Self.frozen.loc22: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %base_facet_type.loc22 = requirement_base_facet_type %I.ref.loc22 [concrete] +// CHECK:STDOUT: %.Self.ref.loc22: %I.type = name_ref .Self, %.Self.frozen.loc22 [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc22: type = facet_access_type %.Self.ref.loc22 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc22_19: type = converted %.Self.ref.loc22, %.Self.as_type.loc22 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %T.ref.loc22: %I.assoc_type = name_ref T, @T.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: %impl.elem0.loc22_19.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] +// CHECK:STDOUT: %.loc22_25.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc22_25.2: type = converted %.loc22_25.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %rewrite.loc22_22.1 = requirement_rewrite %impl.elem0.loc22_19.1, %.loc22_25.2 [concrete] +// CHECK:STDOUT: %impl.elem0.loc22_19.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] +// CHECK:STDOUT: %rewrite.loc22_22.2 = requirement_rewrite %impl.elem0.loc22_19.2, %.loc22_25.2 [concrete] +// CHECK:STDOUT: %.loc22_13: type = where_expr [concrete = constants.%I_where.type.d99] { +// CHECK:STDOUT: %base_facet_type.loc22 = requirement_base_facet_type %I.ref.loc22 [concrete] +// CHECK:STDOUT: %rewrite.loc22_22.2 = requirement_rewrite %impl.elem0.loc22_19.2, %.loc22_25.2 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc14: = impl_self_witness @C.as.I.impl.%C.ref.loc14, @I [concrete = constants.%.b7f] +// CHECK:STDOUT: %.loc22: = impl_self_witness @C.as.I.impl.%C.ref.loc22, @I [concrete = constants.%.b7f] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { diff --git a/toolchain/check/testdata/impl/generic_redeclaration.carbon b/toolchain/check/testdata/impl/generic_redeclaration.carbon index 387f9ab610d6..3c81129c2f70 100644 --- a/toolchain/check/testdata/impl/generic_redeclaration.carbon +++ b/toolchain/check/testdata/impl/generic_redeclaration.carbon @@ -45,8 +45,15 @@ interface I {} interface J {} impl forall [T: I] T as J {} -// CHECK:STDERR: fail_same_self_and_interface_redefined.carbon:[[@LINE+3]]:1-27: error: redefinition of `impl T as J` [ImplRedefinition] -// CHECK:STDERR: fail_same_self_and_interface_redefined.carbon:[[@LINE-2]]:1-27: note: previous definition was here [ImplPreviousDefinition] +// CHECK:STDERR: ╭─┤ fail_same_self_and_interface_redefined.carbon:[[@LINE+10]]:1 +// CHECK:STDERR: │ impl forall [T: I] T as J {} +// CHECK:STDERR: · ─────────────┬───────────── +// CHECK:STDERR: · ╰──┤ previous definition was here [ImplPreviousDefinition] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ impl forall [T: I] T as J {} +// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redefinition of `impl T as J` [ImplRedefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [T: I] T as J {} @@ -60,8 +67,17 @@ interface I {} // Since the spelling is different, it's not caught as a redefinition, but it // is diagnosed as an overlapping impl without using a `match_first` block. impl C as I {} -// CHECK:STDERR: fail_same_type_different_spelling.carbon:[[@LINE+3]]:1-20: error: found non-final `impl` with the same type structure as another non-final `impl` [ImplNonFinalSameTypeStructure] -// CHECK:STDERR: fail_same_type_different_spelling.carbon:[[@LINE-2]]:1-13: note: other `impl` here [ImplNonFinalSameTypeStructureNote] +// CHECK:STDERR: ╭─┤ fail_same_type_different_spelling.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: │ impl C as I {} +// CHECK:STDERR: · ──────┬────── +// CHECK:STDERR: · ╰──┤ other `impl` here [ImplNonFinalSameTypeStructureNote] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ impl (C, C).0 as I {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: found non-final `impl` with the same type structure as another +// CHECK:STDERR: · ┃ non-final `impl` +// CHECK:STDERR: · ┃ [ImplNonFinalSameTypeStructure] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl (C, C).0 as I {} @@ -73,8 +89,15 @@ impl forall [T: type] T as I { fn A() {} } -// CHECK:STDERR: fail_redefinition_generic_regions.carbon:[[@LINE+3]]:1-30: error: redefinition of `impl T as I` [ImplRedefinition] -// CHECK:STDERR: fail_redefinition_generic_regions.carbon:[[@LINE-5]]:1-30: note: previous definition was here [ImplPreviousDefinition] +// CHECK:STDERR: ╭─┤ fail_redefinition_generic_regions.carbon:[[@LINE+10]]:1 +// CHECK:STDERR: │ impl forall [T: type] T as I { +// CHECK:STDERR: · ───────────────┬────────────── +// CHECK:STDERR: · ╰──┤ previous definition was here [ImplPreviousDefinition] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ impl forall [T: type] T as I { +// CHECK:STDERR: · ━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redefinition of `impl T as I` [ImplRedefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [T: type] T as I { // Although not referenced, B has the same generic region index of A, and @@ -512,19 +535,19 @@ impl forall [T: type] T as I { // CHECK:STDOUT: } // CHECK:STDOUT: %.loc7: = impl_self_witness @T.as_type.as.J.impl.377648.1.%.loc7_20, @J [symbolic = @T.as_type.as.J.impl.377648.1.%.loc7_27 (constants.%.d10)] // CHECK:STDOUT: impl_decl @T.as_type.as.J.impl.377648.2 [concrete] { -// CHECK:STDOUT: %T.patt.loc11_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.patt.loc18_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc18_15.2 (constants.%T.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %T.ref: %I.type = name_ref T, %T.loc11_15.1 [symbolic = %T.loc11_15.2 (constants.%T)] -// CHECK:STDOUT: %T.as_type.loc11_20.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc11_20.2 (constants.%T.as_type)] -// CHECK:STDOUT: %.loc11_20: type = converted %T.ref, %T.as_type.loc11_20.1 [symbolic = %T.as_type.loc11_20.2 (constants.%T.as_type)] +// CHECK:STDOUT: %T.ref: %I.type = name_ref T, %T.loc18_15.1 [symbolic = %T.loc18_15.2 (constants.%T)] +// CHECK:STDOUT: %T.as_type.loc18_20.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc18_20.2 (constants.%T.as_type)] +// CHECK:STDOUT: %.loc18_20: type = converted %T.ref, %T.as_type.loc18_20.1 [symbolic = %T.as_type.loc18_20.2 (constants.%T.as_type)] // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [concrete = constants.%J.type] -// CHECK:STDOUT: %.loc11_17: type = splice_block %I.ref [concrete = constants.%I.type] { +// CHECK:STDOUT: %.loc18_17: type = splice_block %I.ref [concrete = constants.%I.type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc11_15.1: %I.type = symbolic_binding T, 0 [symbolic = %T.loc11_15.2 (constants.%T)] +// CHECK:STDOUT: %T.loc18_15.1: %I.type = symbolic_binding T, 0 [symbolic = %T.loc18_15.2 (constants.%T)] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc11: = impl_self_witness @T.as_type.as.J.impl.377648.2.%.loc11_20, @J [symbolic = @T.as_type.as.J.impl.377648.2.%.loc11_27 (constants.%.d10)] +// CHECK:STDOUT: %.loc18: = impl_self_witness @T.as_type.as.J.impl.377648.2.%.loc18_20, @J [symbolic = @T.as_type.as.J.impl.377648.2.%.loc18_27 (constants.%.d10)] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { @@ -568,15 +591,15 @@ impl forall [T: type] T as I { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic impl @T.as_type.as.J.impl.377648.2(%T.loc11_15.1: %I.type) { -// CHECK:STDOUT: %T.patt.loc11_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_15.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc11_15.2: %I.type = symbolic_binding T, 0 [symbolic = %T.loc11_15.2 (constants.%T)] -// CHECK:STDOUT: %T.as_type.loc11_20.2: type = facet_access_type %T.loc11_15.2 [symbolic = %T.as_type.loc11_20.2 (constants.%T.as_type)] -// CHECK:STDOUT: %.loc11_27: = impl_self_witness %T.loc11_15.2, @J [symbolic = %.loc11_27 (constants.%.d10)] +// CHECK:STDOUT: generic impl @T.as_type.as.J.impl.377648.2(%T.loc18_15.1: %I.type) { +// CHECK:STDOUT: %T.patt.loc18_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc18_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc18_15.2: %I.type = symbolic_binding T, 0 [symbolic = %T.loc18_15.2 (constants.%T)] +// CHECK:STDOUT: %T.as_type.loc18_20.2: type = facet_access_type %T.loc18_15.2 [symbolic = %T.as_type.loc18_20.2 (constants.%T.as_type)] +// CHECK:STDOUT: %.loc18_27: = impl_self_witness %T.loc18_15.2, @J [symbolic = %.loc18_27 (constants.%.d10)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: -// CHECK:STDOUT: impl: %.loc11_20 as %J.ref { +// CHECK:STDOUT: impl: %.loc18_20 as %J.ref { // CHECK:STDOUT: !members: // CHECK:STDOUT: extend %J.ref // CHECK:STDOUT: witness = @@ -602,10 +625,10 @@ impl forall [T: type] T as I { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @T.as_type.as.J.impl.377648.2(constants.%T) { -// CHECK:STDOUT: %T.patt.loc11_15.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc11_15.2 => constants.%T -// CHECK:STDOUT: %T.as_type.loc11_20.2 => constants.%T.as_type -// CHECK:STDOUT: %.loc11_27 => constants.%.d10 +// CHECK:STDOUT: %T.patt.loc18_15.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc18_15.2 => constants.%T +// CHECK:STDOUT: %T.as_type.loc18_20.2 => constants.%T.as_type +// CHECK:STDOUT: %.loc18_27 => constants.%.d10 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_same_type_different_spelling.carbon @@ -647,16 +670,16 @@ impl forall [T: type] T as I { // CHECK:STDOUT: } // CHECK:STDOUT: %.loc9: = impl_self_witness @C.as.I.impl.e103db.1.%C.ref, @I [concrete = constants.%.b7f] // CHECK:STDOUT: impl_decl @C.as.I.impl.e103db.2 [concrete] {} { -// CHECK:STDOUT: %C.ref.loc13_7: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %C.ref.loc13_10: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %.loc13_11.1: %tuple.type = tuple_literal (%C.ref.loc13_7, %C.ref.loc13_10) [concrete = constants.%tuple] +// CHECK:STDOUT: %C.ref.loc22_7: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %C.ref.loc22_10: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %.loc22_11.1: %tuple.type = tuple_literal (%C.ref.loc22_7, %C.ref.loc22_10) [concrete = constants.%tuple] // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] -// CHECK:STDOUT: %tuple: %tuple.type = tuple_value (%C.ref.loc13_7, %C.ref.loc13_10) [concrete = constants.%tuple] -// CHECK:STDOUT: %.loc13_11.2: %tuple.type = converted %.loc13_11.1, %tuple [concrete = constants.%tuple] -// CHECK:STDOUT: %tuple.elem0: type = tuple_access %.loc13_11.2, element0 [concrete = constants.%C] +// CHECK:STDOUT: %tuple: %tuple.type = tuple_value (%C.ref.loc22_7, %C.ref.loc22_10) [concrete = constants.%tuple] +// CHECK:STDOUT: %.loc22_11.2: %tuple.type = converted %.loc22_11.1, %tuple [concrete = constants.%tuple] +// CHECK:STDOUT: %tuple.elem0: type = tuple_access %.loc22_11.2, element0 [concrete = constants.%C] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc13: = impl_self_witness @C.as.I.impl.e103db.2.%tuple.elem0, @I [concrete = constants.%.b7f] +// CHECK:STDOUT: %.loc22: = impl_self_witness @C.as.I.impl.e103db.2.%tuple.elem0, @I [concrete = constants.%.b7f] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { @@ -759,17 +782,17 @@ impl forall [T: type] T as I { // CHECK:STDOUT: } // CHECK:STDOUT: %.loc4: = impl_self_witness @T.as.I.impl.812d8b.1.%T.ref, @I [symbolic = @T.as.I.impl.812d8b.1.%.loc4_30 (constants.%.917)] // CHECK:STDOUT: impl_decl @T.as.I.impl.812d8b.2 [concrete] { -// CHECK:STDOUT: %T.patt.loc11_15.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.patt.loc18_15.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc18_15.2 (constants.%T.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc11_15.2 [symbolic = %T.loc11_15.1 (constants.%T)] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc18_15.2 [symbolic = %T.loc18_15.1 (constants.%T)] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] -// CHECK:STDOUT: %.loc11_17.1: type = splice_block %.loc11_17.2 [concrete = type] { +// CHECK:STDOUT: %.loc18_17.1: type = splice_block %.loc18_17.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc11_17.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc18_17.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc11_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc11_15.1 (constants.%T)] +// CHECK:STDOUT: %T.loc18_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc18_15.1 (constants.%T)] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc11: = impl_self_witness @T.as.I.impl.812d8b.2.%T.ref, @I [symbolic = @T.as.I.impl.812d8b.2.%.loc11_30 (constants.%.917)] +// CHECK:STDOUT: %.loc18: = impl_self_witness @T.as.I.impl.812d8b.2.%T.ref, @I [symbolic = @T.as.I.impl.812d8b.2.%.loc18_30 (constants.%.917)] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { @@ -805,38 +828,38 @@ impl forall [T: type] T as I { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic impl @T.as.I.impl.812d8b.2(%T.loc11_15.2: type) { -// CHECK:STDOUT: %T.patt.loc11_15.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_15.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc11_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc11_15.1 (constants.%T)] -// CHECK:STDOUT: %.loc11_30: = impl_self_witness %T.loc11_15.1, @I [symbolic = %.loc11_30 (constants.%.917)] +// CHECK:STDOUT: generic impl @T.as.I.impl.812d8b.2(%T.loc18_15.2: type) { +// CHECK:STDOUT: %T.patt.loc18_15.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc18_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc18_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc18_15.1 (constants.%T)] +// CHECK:STDOUT: %.loc18_30: = impl_self_witness %T.loc18_15.1, @I [symbolic = %.loc18_30 (constants.%.917)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %T.as.I.impl.B.type: type = fn_type @T.as.I.impl.B, @T.as.I.impl.812d8b.2(%T.loc11_15.1) [symbolic = %T.as.I.impl.B.type (constants.%T.as.I.impl.B.type)] +// CHECK:STDOUT: %T.as.I.impl.B.type: type = fn_type @T.as.I.impl.B, @T.as.I.impl.812d8b.2(%T.loc18_15.1) [symbolic = %T.as.I.impl.B.type (constants.%T.as.I.impl.B.type)] // CHECK:STDOUT: %T.as.I.impl.B: @T.as.I.impl.812d8b.2.%T.as.I.impl.B.type (%T.as.I.impl.B.type) = struct_value () [symbolic = %T.as.I.impl.B (constants.%T.as.I.impl.B)] -// CHECK:STDOUT: %T.as.I.impl.C.type: type = fn_type @T.as.I.impl.C, @T.as.I.impl.812d8b.2(%T.loc11_15.1) [symbolic = %T.as.I.impl.C.type (constants.%T.as.I.impl.C.type)] +// CHECK:STDOUT: %T.as.I.impl.C.type: type = fn_type @T.as.I.impl.C, @T.as.I.impl.812d8b.2(%T.loc18_15.1) [symbolic = %T.as.I.impl.C.type (constants.%T.as.I.impl.C.type)] // CHECK:STDOUT: %T.as.I.impl.C: @T.as.I.impl.812d8b.2.%T.as.I.impl.C.type (%T.as.I.impl.C.type) = struct_value () [symbolic = %T.as.I.impl.C (constants.%T.as.I.impl.C)] -// CHECK:STDOUT: %T.as.I.impl.D.type: type = fn_type @T.as.I.impl.D, @T.as.I.impl.812d8b.2(%T.loc11_15.1) [symbolic = %T.as.I.impl.D.type (constants.%T.as.I.impl.D.type)] +// CHECK:STDOUT: %T.as.I.impl.D.type: type = fn_type @T.as.I.impl.D, @T.as.I.impl.812d8b.2(%T.loc18_15.1) [symbolic = %T.as.I.impl.D.type (constants.%T.as.I.impl.D.type)] // CHECK:STDOUT: %T.as.I.impl.D: @T.as.I.impl.812d8b.2.%T.as.I.impl.D.type (%T.as.I.impl.D.type) = struct_value () [symbolic = %T.as.I.impl.D (constants.%T.as.I.impl.D)] // CHECK:STDOUT: // CHECK:STDOUT: impl: %T.ref as %I.ref { // CHECK:STDOUT: %T.as.I.impl.B.decl: @T.as.I.impl.812d8b.2.%T.as.I.impl.B.type (%T.as.I.impl.B.type) = fn_decl @T.as.I.impl.B [symbolic = @T.as.I.impl.812d8b.2.%T.as.I.impl.B (constants.%T.as.I.impl.B)] {} {} // CHECK:STDOUT: %T.as.I.impl.C.decl: @T.as.I.impl.812d8b.2.%T.as.I.impl.C.type (%T.as.I.impl.C.type) = fn_decl @T.as.I.impl.C [symbolic = @T.as.I.impl.812d8b.2.%T.as.I.impl.C (constants.%T.as.I.impl.C)] { // CHECK:STDOUT: %return.param_patt: %pattern_type.cb1 = out_param_pattern [concrete = constants.%return.param_patt] -// CHECK:STDOUT: %return.patt: %pattern_type.cb1 = return_slot_pattern %return.param_patt, %.loc15_14.2 [concrete = constants.%return.patt] +// CHECK:STDOUT: %return.patt: %pattern_type.cb1 = return_slot_pattern %return.param_patt, %.loc22_14.2 [concrete = constants.%return.patt] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc15_14.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc15_14.2: type = converted %.loc15_14.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %.loc15_14.3: Core.Form = init_form %.loc15_14.2 [concrete = constants.%.262] +// CHECK:STDOUT: %.loc22_14.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc22_14.2: type = converted %.loc22_14.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc22_14.3: Core.Form = init_form %.loc22_14.2 [concrete = constants.%.262] // CHECK:STDOUT: %return.param: ref %empty_tuple.type = out_param call_param0 // CHECK:STDOUT: %return: ref %empty_tuple.type = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: %T.as.I.impl.D.decl: @T.as.I.impl.812d8b.2.%T.as.I.impl.D.type (%T.as.I.impl.D.type) = fn_decl @T.as.I.impl.D [symbolic = @T.as.I.impl.812d8b.2.%T.as.I.impl.D (constants.%T.as.I.impl.D)] { // CHECK:STDOUT: %return.param_patt: %pattern_type.cb1 = out_param_pattern [concrete = constants.%return.param_patt] -// CHECK:STDOUT: %return.patt: %pattern_type.cb1 = return_slot_pattern %return.param_patt, %.loc16_14.2 [concrete = constants.%return.patt] +// CHECK:STDOUT: %return.patt: %pattern_type.cb1 = return_slot_pattern %return.param_patt, %.loc23_14.2 [concrete = constants.%return.patt] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc16_14.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc16_14.2: type = converted %.loc16_14.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %.loc16_14.3: Core.Form = init_form %.loc16_14.2 [concrete = constants.%.262] +// CHECK:STDOUT: %.loc23_14.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc23_14.2: type = converted %.loc23_14.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc23_14.3: Core.Form = init_form %.loc23_14.2 [concrete = constants.%.262] // CHECK:STDOUT: %return.param: ref %empty_tuple.type = out_param call_param0 // CHECK:STDOUT: %return: ref %empty_tuple.type = return_slot %return.param // CHECK:STDOUT: } @@ -859,7 +882,7 @@ impl forall [T: type] T as I { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @T.as.I.impl.B(@T.as.I.impl.812d8b.2.%T.loc11_15.2: type) { +// CHECK:STDOUT: generic fn @T.as.I.impl.B(@T.as.I.impl.812d8b.2.%T.loc18_15.2: type) { // CHECK:STDOUT: !definition: // CHECK:STDOUT: // CHECK:STDOUT: fn() { @@ -868,31 +891,31 @@ impl forall [T: type] T as I { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @T.as.I.impl.C(@T.as.I.impl.812d8b.2.%T.loc11_15.2: type) { +// CHECK:STDOUT: generic fn @T.as.I.impl.C(@T.as.I.impl.812d8b.2.%T.loc18_15.2: type) { // CHECK:STDOUT: !definition: // CHECK:STDOUT: // CHECK:STDOUT: fn() -> out %return.param: %empty_tuple.type { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc15_26.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc15_26.2: init %empty_tuple.type = tuple_init () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc15_27: init %empty_tuple.type = converted %.loc15_26.1, %.loc15_26.2 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: return %.loc15_27 +// CHECK:STDOUT: %.loc22_26.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc22_26.2: init %empty_tuple.type = tuple_init () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc22_27: init %empty_tuple.type = converted %.loc22_26.1, %.loc22_26.2 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: return %.loc22_27 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @T.as.I.impl.D(@T.as.I.impl.812d8b.2.%T.loc11_15.2: type) { +// CHECK:STDOUT: generic fn @T.as.I.impl.D(@T.as.I.impl.812d8b.2.%T.loc18_15.2: type) { // CHECK:STDOUT: !definition: // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic = %T (constants.%T)] // CHECK:STDOUT: %T.as.I.impl.C.type: type = fn_type @T.as.I.impl.C, @T.as.I.impl.812d8b.2(%T) [symbolic = %T.as.I.impl.C.type (constants.%T.as.I.impl.C.type)] // CHECK:STDOUT: %T.as.I.impl.C: @T.as.I.impl.D.%T.as.I.impl.C.type (%T.as.I.impl.C.type) = struct_value () [symbolic = %T.as.I.impl.C (constants.%T.as.I.impl.C)] -// CHECK:STDOUT: %T.as.I.impl.C.specific_fn.loc17_12.2: = specific_function %T.as.I.impl.C, @T.as.I.impl.C(%T) [symbolic = %T.as.I.impl.C.specific_fn.loc17_12.2 (constants.%T.as.I.impl.C.specific_fn)] +// CHECK:STDOUT: %T.as.I.impl.C.specific_fn.loc24_12.2: = specific_function %T.as.I.impl.C, @T.as.I.impl.C(%T) [symbolic = %T.as.I.impl.C.specific_fn.loc24_12.2 (constants.%T.as.I.impl.C.specific_fn)] // CHECK:STDOUT: // CHECK:STDOUT: fn() -> out %return.param: %empty_tuple.type { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc17: @T.as.I.impl.D.%T.as.I.impl.C.type (%T.as.I.impl.C.type) = specific_constant @T.as.I.impl.812d8b.2.%T.as.I.impl.C.decl, @T.as.I.impl.812d8b.2(constants.%T) [symbolic = %T.as.I.impl.C (constants.%T.as.I.impl.C)] -// CHECK:STDOUT: %C.ref: @T.as.I.impl.D.%T.as.I.impl.C.type (%T.as.I.impl.C.type) = name_ref C, %.loc17 [symbolic = %T.as.I.impl.C (constants.%T.as.I.impl.C)] -// CHECK:STDOUT: %T.as.I.impl.C.specific_fn.loc17_12.1: = specific_function %C.ref, @T.as.I.impl.C(constants.%T) [symbolic = %T.as.I.impl.C.specific_fn.loc17_12.2 (constants.%T.as.I.impl.C.specific_fn)] -// CHECK:STDOUT: %T.as.I.impl.C.call: init %empty_tuple.type = call %T.as.I.impl.C.specific_fn.loc17_12.1() +// CHECK:STDOUT: %.loc24: @T.as.I.impl.D.%T.as.I.impl.C.type (%T.as.I.impl.C.type) = specific_constant @T.as.I.impl.812d8b.2.%T.as.I.impl.C.decl, @T.as.I.impl.812d8b.2(constants.%T) [symbolic = %T.as.I.impl.C (constants.%T.as.I.impl.C)] +// CHECK:STDOUT: %C.ref: @T.as.I.impl.D.%T.as.I.impl.C.type (%T.as.I.impl.C.type) = name_ref C, %.loc24 [symbolic = %T.as.I.impl.C (constants.%T.as.I.impl.C)] +// CHECK:STDOUT: %T.as.I.impl.C.specific_fn.loc24_12.1: = specific_function %C.ref, @T.as.I.impl.C(constants.%T) [symbolic = %T.as.I.impl.C.specific_fn.loc24_12.2 (constants.%T.as.I.impl.C.specific_fn)] +// CHECK:STDOUT: %T.as.I.impl.C.call: init %empty_tuple.type = call %T.as.I.impl.C.specific_fn.loc24_12.1() // CHECK:STDOUT: return %T.as.I.impl.C.call // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -919,9 +942,9 @@ impl forall [T: type] T as I { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @T.as.I.impl.812d8b.2(constants.%T) { -// CHECK:STDOUT: %T.patt.loc11_15.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc11_15.1 => constants.%T -// CHECK:STDOUT: %.loc11_30 => constants.%.917 +// CHECK:STDOUT: %T.patt.loc18_15.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc18_15.1 => constants.%T +// CHECK:STDOUT: %.loc18_30 => constants.%.917 // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %T.as.I.impl.B.type => constants.%T.as.I.impl.B.type diff --git a/toolchain/check/testdata/impl/impl_as_named_constraint.carbon b/toolchain/check/testdata/impl/impl_as_named_constraint.carbon index b903c6a50aa8..a6817f157650 100644 --- a/toolchain/check/testdata/impl/impl_as_named_constraint.carbon +++ b/toolchain/check/testdata/impl/impl_as_named_constraint.carbon @@ -15,7 +15,11 @@ library "[[@TEST_NAME]]"; constraint A {} -// CHECK:STDERR: fail_empty_constraint.carbon:[[@LINE+2]]:1-14: error: impl as 0 interfaces, expected 1 [ImplOfNotOneInterface] +// CHECK:STDERR: ╭─┤ fail_empty_constraint.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ impl () as A {} +// CHECK:STDERR: · ━━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: impl as 0 interfaces, expected 1 [ImplOfNotOneInterface] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as A {} @@ -29,7 +33,11 @@ constraint B { extend require impls A2; } -// CHECK:STDERR: fail_too_many_interfaces_in_constraint.carbon:[[@LINE+2]]:1-14: error: impl as 2 interfaces, expected 1 [ImplOfNotOneInterface] +// CHECK:STDERR: ╭─┤ fail_too_many_interfaces_in_constraint.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ impl () as B {} +// CHECK:STDERR: · ━━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: impl as 2 interfaces, expected 1 [ImplOfNotOneInterface] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as B {} @@ -51,7 +59,11 @@ constraint B { require impls A; } -// CHECK:STDERR: fail_one_impls_interface_in_constraint.carbon:[[@LINE+2]]:1-14: error: impl as 0 interfaces, expected 1 [ImplOfNotOneInterface] +// CHECK:STDERR: ╭─┤ fail_one_impls_interface_in_constraint.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ impl () as B {} +// CHECK:STDERR: · ━━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: impl as 0 interfaces, expected 1 [ImplOfNotOneInterface] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as B {} @@ -80,7 +92,11 @@ constraint C { require impls B; } -// CHECK:STDERR: fail_nested_constraints_not_extend_outer.carbon:[[@LINE+2]]:1-14: error: impl as 0 interfaces, expected 1 [ImplOfNotOneInterface] +// CHECK:STDERR: ╭─┤ fail_nested_constraints_not_extend_outer.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ impl () as C {} +// CHECK:STDERR: · ━━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: impl as 0 interfaces, expected 1 [ImplOfNotOneInterface] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as C {} @@ -96,7 +112,11 @@ constraint C { extend require impls B; } -// CHECK:STDERR: fail_nested_constraints_not_extend_inner.carbon:[[@LINE+2]]:1-14: error: impl as 0 interfaces, expected 1 [ImplOfNotOneInterface] +// CHECK:STDERR: ╭─┤ fail_nested_constraints_not_extend_inner.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ impl () as C {} +// CHECK:STDERR: · ━━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: impl as 0 interfaces, expected 1 [ImplOfNotOneInterface] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as C {} @@ -112,7 +132,11 @@ constraint C { require impls B; } -// CHECK:STDERR: fail_nested_constraints_not_extend_both.carbon:[[@LINE+2]]:1-14: error: impl as 0 interfaces, expected 1 [ImplOfNotOneInterface] +// CHECK:STDERR: ╭─┤ fail_nested_constraints_not_extend_both.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ impl () as C {} +// CHECK:STDERR: · ━━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: impl as 0 interfaces, expected 1 [ImplOfNotOneInterface] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as C {} @@ -128,8 +152,17 @@ constraint B(X: type, Y: type) { // This should impl () as A({}). impl () as B((), {}) {} -// CHECK:STDERR: fail_duplicate_through_generic_constraint.carbon:[[@LINE+3]]:1-18: error: found non-final `impl` with the same type structure as another non-final `impl` [ImplNonFinalSameTypeStructure] -// CHECK:STDERR: fail_duplicate_through_generic_constraint.carbon:[[@LINE-3]]:1-22: note: other `impl` here [ImplNonFinalSameTypeStructureNote] +// CHECK:STDERR: ╭─┤ fail_duplicate_through_generic_constraint.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: │ impl () as B((), {}) {} +// CHECK:STDERR: · ───────────┬────────── +// CHECK:STDERR: · ╰──┤ other `impl` here [ImplNonFinalSameTypeStructureNote] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ impl () as A({}) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: found non-final `impl` with the same type structure as another +// CHECK:STDERR: · ┃ non-final `impl` +// CHECK:STDERR: · ┃ [ImplNonFinalSameTypeStructure] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as A({}) {} @@ -142,7 +175,11 @@ interface A(T: type) {} // the constraint. //@dump-sem-ir-begin // -// CHECK:STDERR: fail_error_self_in_require.carbon:[[@LINE+2]]:17-25: error: name `Undefined` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_error_self_in_require.carbon:[[@LINE+6]]:17 +// CHECK:STDERR: -> │ constraint B(X: Undefined) { +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: name `Undefined` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: constraint B(X: Undefined) { extend require impls A(X); @@ -276,10 +313,23 @@ class C; // the first one. Once rewrites can be done in the impl defn body, these errors // won't always have the same location (with the location being the decl) // though. -// CHECK:STDERR: fail_impl_as_constraint_missing_rewrite.carbon:[[@LINE+5]]:1-13: error: accessing member from impl before it has a defined value [ImplAccessMemberBeforeSet] +// CHECK:STDERR: ╭─┤ fail_impl_as_constraint_missing_rewrite.carbon:[[@LINE+18]]:1 +// CHECK:STDERR: -> │ impl C as N {} +// CHECK:STDERR: · ━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: accessing member from impl before it has a defined value +// CHECK:STDERR: · ┃ [ImplAccessMemberBeforeSet] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_impl_as_constraint_missing_rewrite.carbon:[[@LINE+3]]:1-13: error: associated constant I1 not given a value in impl of interface I [ImplAssociatedConstantNeedsValue] -// CHECK:STDERR: fail_impl_as_constraint_missing_rewrite.carbon:[[@LINE-16]]:7-14: note: associated constant declared here [AssociatedConstantHere] +// CHECK:STDERR: ╭─┤ fail_impl_as_constraint_missing_rewrite.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: │ let I1: type; +// CHECK:STDERR: · ────┬─── +// CHECK:STDERR: · ╰──┤ associated constant declared here [AssociatedConstantHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ impl C as N {} +// CHECK:STDERR: · ━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: associated constant I1 not given a value in impl of interface I +// CHECK:STDERR: · ┃ [ImplAssociatedConstantNeedsValue] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl C as N {} @@ -297,7 +347,11 @@ constraint Y { } // Y does not have any extend require on `Self`. -// CHECK:STDERR: fail_no_require_self.carbon:[[@LINE+2]]:1-14: error: impl as 0 interfaces, expected 1 [ImplOfNotOneInterface] +// CHECK:STDERR: ╭─┤ fail_no_require_self.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ impl () as Y {} +// CHECK:STDERR: · ━━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: impl as 0 interfaces, expected 1 [ImplOfNotOneInterface] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as Y {} @@ -436,7 +490,13 @@ interface Z { let Z1: type; } constraint J { extend require impls Z where .Z1 = {}; } -// CHECK:STDERR: fail_rewrite_twice_different.carbon:[[@LINE+2]]:12-27: error: associated constant Z1 given value `()` that is different from previously given value `{}` [AssociatedConstantGivenDifferentValues] +// CHECK:STDERR: ╭─┤ fail_rewrite_twice_different.carbon:[[@LINE+8]]:12 +// CHECK:STDERR: -> │ impl () as J where .Z1 = () {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: associated constant Z1 given value `()` that is different +// CHECK:STDERR: · ┃ from previously given value `{}` +// CHECK:STDERR: · ┃ [AssociatedConstantGivenDifferentValues] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as J where .Z1 = () {} @@ -451,7 +511,13 @@ constraint J { extend require impls Z where .Z1 = {}; extend require impls K; } -// CHECK:STDERR: fail_rewrite_twice_different_named_constraints.carbon:[[@LINE+2]]:12: error: associated constant Z1 given value `{}` that is different from previously given value `()` [AssociatedConstantGivenDifferentValues] +// CHECK:STDERR: ╭─┤ fail_rewrite_twice_different_named_constraints.carbon:[[@LINE+8]]:12 +// CHECK:STDERR: -> │ impl () as J {} +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: associated constant Z1 given value `{}` that is different +// CHECK:STDERR: · ┃ from previously given value `()` +// CHECK:STDERR: · ┃ [AssociatedConstantGivenDifferentValues] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as J {} diff --git a/toolchain/check/testdata/impl/impl_assoc_const.carbon b/toolchain/check/testdata/impl/impl_assoc_const.carbon index 168c92dfd40e..ae11a50d5712 100644 --- a/toolchain/check/testdata/impl/impl_assoc_const.carbon +++ b/toolchain/check/testdata/impl/impl_assoc_const.carbon @@ -37,7 +37,11 @@ library "[[@TEST_NAME]]"; interface I3 { let T3: type; } -// CHECK:STDERR: fail_redecl_adds_rewrites.carbon:[[@LINE+2]]:1-14: error: impl declared but not defined [ImplMissingDefinition] +// CHECK:STDERR: ╭─┤ fail_redecl_adds_rewrites.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ impl () as I3; +// CHECK:STDERR: · ━━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: impl declared but not defined [ImplMissingDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as I3; impl () as I3 where .T3 = {} {} @@ -47,7 +51,11 @@ library "[[@TEST_NAME]]"; interface J { let U: type; } -// CHECK:STDERR: fail_mismatch.carbon:[[@LINE+2]]:1-27: error: impl declared but not defined [ImplMissingDefinition] +// CHECK:STDERR: ╭─┤ fail_mismatch.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ impl () as J where .U = {}; +// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: impl declared but not defined [ImplMissingDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as J where .U = {}; impl () as J where .U = () {} @@ -61,15 +69,40 @@ interface I4 { let T6: type; } -// CHECK:STDERR: fail_mismatch_bad_value.carbon:[[@LINE+4]]:27-30: error: name `BAD1` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_mismatch_bad_value.carbon:[[@LINE+16]]:27 +// CHECK:STDERR: -> │ impl () as I4 where .T4 = BAD1 and .T5 = {.a: {}} and .T6 = BAD2; +// CHECK:STDERR: · ━━┳━ +// CHECK:STDERR: · ┗━━┫ error: name `BAD1` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_mismatch_bad_value.carbon:[[@LINE+2]]:61-64: error: name `BAD2` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_mismatch_bad_value.carbon:[[@LINE+10]]:61 +// CHECK:STDERR: -> │ impl () as I4 where .T4 = BAD1 and .T5 = {.a: {}} and .T6 = BAD2; +// CHECK:STDERR: · ┳━━━ +// CHECK:STDERR: · ┗━━┫ error: name +// CHECK:STDERR: · ┃ `BAD2` +// CHECK:STDERR: · ┃ not +// CHECK:STDERR: · ┃ found +// CHECK:STDERR: · ┃ [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as I4 where .T4 = BAD1 and .T5 = {.a: {}} and .T6 = BAD2; -// CHECK:STDERR: fail_mismatch_bad_value.carbon:[[@LINE+4]]:46-49: error: name `BAD3` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_mismatch_bad_value.carbon:[[@LINE+17]]:46 +// CHECK:STDERR: -> │ impl () as I4 where .T4 = {.b: {}} and .T5 = BAD3 and .T6 = BAD4 {} +// CHECK:STDERR: · ━━┳━ +// CHECK:STDERR: · ┗━━┫ error: name `BAD3` not found +// CHECK:STDERR: · ┃ [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_mismatch_bad_value.carbon:[[@LINE+2]]:61-64: error: name `BAD4` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_mismatch_bad_value.carbon:[[@LINE+10]]:61 +// CHECK:STDERR: -> │ impl () as I4 where .T4 = {.b: {}} and .T5 = BAD3 and .T6 = BAD4 {} +// CHECK:STDERR: · ┳━━━ +// CHECK:STDERR: · ┗━━┫ error: name +// CHECK:STDERR: · ┃ `BAD4` +// CHECK:STDERR: · ┃ not +// CHECK:STDERR: · ┃ found +// CHECK:STDERR: · ┃ [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as I4 where .T4 = {.b: {}} and .T5 = BAD3 and .T6 = BAD4 {} @@ -79,10 +112,23 @@ library "[[@TEST_NAME]]"; interface K { let V: type; } impl () as K where .V = {}; -// CHECK:STDERR: fail_missing_on_definition.carbon:[[@LINE+5]]:1-14: error: associated constant V not given a value in impl of interface K [ImplAssociatedConstantNeedsValue] -// CHECK:STDERR: fail_missing_on_definition.carbon:[[@LINE-4]]:19-25: note: associated constant declared here [AssociatedConstantHere] +// CHECK:STDERR: ╭─┤ fail_missing_on_definition.carbon:[[@LINE+18]]:1 +// CHECK:STDERR: │ interface K { let V: type; } +// CHECK:STDERR: · ───┬─── +// CHECK:STDERR: · ╰──┤ associated constant declared here +// CHECK:STDERR: · │ [AssociatedConstantHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ impl () as K {} +// CHECK:STDERR: · ━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: associated constant V not given a value in impl of interface K +// CHECK:STDERR: · ┃ [ImplAssociatedConstantNeedsValue] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_missing_on_definition.carbon:[[@LINE-4]]:1-27: error: impl declared but not defined [ImplMissingDefinition] +// CHECK:STDERR: ╭─┤ fail_missing_on_definition.carbon:[[@LINE-13]]:1 +// CHECK:STDERR: -> │ impl () as K where .V = {}; +// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: impl declared but not defined [ImplMissingDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as K {} @@ -91,7 +137,13 @@ library "[[@TEST_NAME]]"; interface L { let W: type; } -// CHECK:STDERR: fail_two_different.carbon:[[@LINE+2]]:12-38: error: associated constant `.(L.W)` given two different values `{}` and `()` [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╭─┤ fail_two_different.carbon:[[@LINE+8]]:12 +// CHECK:STDERR: -> │ impl () as L where .W = {} and .W = () {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: associated constant `.(L.W)` given two different values +// CHECK:STDERR: · ┃ `{}` and `()` +// CHECK:STDERR: · ┃ [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as L where .W = {} and .W = () {} @@ -100,7 +152,13 @@ library "[[@TEST_NAME]]"; interface L2 { let W2: type; let X2: type; } -// CHECK:STDERR: fail_two_different_first_associated.carbon:[[@LINE+2]]:12-42: error: associated constant `.(L2.W2)` given two different values `()` and `.(L2.X2)` [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╭─┤ fail_two_different_first_associated.carbon:[[@LINE+8]]:12 +// CHECK:STDERR: -> │ impl () as L2 where .W2 = .X2 and .W2 = () {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: associated constant `.(L2.W2)` given two different values +// CHECK:STDERR: · ┃ `()` and `.(L2.X2)` +// CHECK:STDERR: · ┃ [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as L2 where .W2 = .X2 and .W2 = () {} @@ -109,7 +167,13 @@ library "[[@TEST_NAME]]"; interface L2 { let W2: type; let X2: type; } -// CHECK:STDERR: fail_two_different_second_associated.carbon:[[@LINE+2]]:12-42: error: associated constant `.(L2.W2)` given two different values `()` and `.(L2.X2)` [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╭─┤ fail_two_different_second_associated.carbon:[[@LINE+8]]:12 +// CHECK:STDERR: -> │ impl () as L2 where .W2 = () and .W2 = .X2 {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: associated constant `.(L2.W2)` given two different values +// CHECK:STDERR: · ┃ `()` and `.(L2.X2)` +// CHECK:STDERR: · ┃ [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as L2 where .W2 = () and .W2 = .X2 {} @@ -118,7 +182,11 @@ library "[[@TEST_NAME]]"; interface L2 { let W2: type; } -// CHECK:STDERR: fail_two_different_first_bad.carbon:[[@LINE+2]]:27-30: error: name `BAD5` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_two_different_first_bad.carbon:[[@LINE+6]]:27 +// CHECK:STDERR: -> │ impl () as L2 where .W2 = BAD5 and .W2 = () {} +// CHECK:STDERR: · ━━┳━ +// CHECK:STDERR: · ┗━━┫ error: name `BAD5` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as L2 where .W2 = BAD5 and .W2 = () {} @@ -127,7 +195,12 @@ library "[[@TEST_NAME]]"; interface L3 { let W3: type; } -// CHECK:STDERR: fail_two_different_second_bad.carbon:[[@LINE+2]]:40-43: error: name `BAD6` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_two_different_second_bad.carbon:[[@LINE+7]]:40 +// CHECK:STDERR: -> │ impl () as L3 where .W3 = {} and .W3 = BAD6 {} +// CHECK:STDERR: · ━━┳━ +// CHECK:STDERR: · ┗━━┫ error: name `BAD6` not found +// CHECK:STDERR: · ┃ [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as L3 where .W3 = {} and .W3 = BAD6 {} @@ -136,9 +209,18 @@ library "[[@TEST_NAME]]"; interface L4 { let W4: type; } -// CHECK:STDERR: fail_two_different_both_bad.carbon:[[@LINE+4]]:27-30: error: name `BAD7` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_two_different_both_bad.carbon:[[@LINE+13]]:27 +// CHECK:STDERR: -> │ impl () as L4 where .W4 = BAD7 and .W4 = BAD8 {} +// CHECK:STDERR: · ━━┳━ +// CHECK:STDERR: · ┗━━┫ error: name `BAD7` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_two_different_both_bad.carbon:[[@LINE+2]]:42-45: error: name `BAD8` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_two_different_both_bad.carbon:[[@LINE+7]]:42 +// CHECK:STDERR: -> │ impl () as L4 where .W4 = BAD7 and .W4 = BAD8 {} +// CHECK:STDERR: · ━━┳━ +// CHECK:STDERR: · ┗━━┫ error: name `BAD8` not found +// CHECK:STDERR: · ┃ [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as L4 where .W4 = BAD7 and .W4 = BAD8 {} @@ -151,7 +233,13 @@ interface L { let W: type; } // are all errors, and they get deduped). // //@dump-sem-ir-begin -// CHECK:STDERR: fail_many_different.carbon:[[@LINE+2]]:12-102: error: associated constant `.(L.W)` given two different values `((), (), ())` and `({}, (), ())` [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╭─┤ fail_many_different.carbon:[[@LINE+8]]:12 +// CHECK:STDERR: -> │ impl () as L where .W = ((), (), ()) and .W = ({}, (), ()) and .W = ({}, {... +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: associated constant `.(L.W)` given two different values +// CHECK:STDERR: · ┃ `((), (), ())` and `({}, (), ())` +// CHECK:STDERR: · ┃ [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as L where .W = ((), (), ()) and .W = ({}, (), ()) and .W = ({}, {}, ()) and .W = ({}, (), {}) {} //@dump-sem-ir-end @@ -184,7 +272,13 @@ library "[[@TEST_NAME]]"; interface M { let X: type; } -// CHECK:STDERR: fail_repeated_and_different.carbon:[[@LINE+2]]:12-50: error: associated constant `.(M.X)` given two different values `{}` and `()` [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╭─┤ fail_repeated_and_different.carbon:[[@LINE+8]]:12 +// CHECK:STDERR: -> │ impl () as M where .X = {} and .X = () and .X = {} {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: associated constant `.(M.X)` given two different values +// CHECK:STDERR: · ┃ `{}` and `()` +// CHECK:STDERR: · ┃ [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as M where .X = {} and .X = () and .X = {} {} @@ -195,14 +289,24 @@ interface M { let X: type; } // This fails because it resolves to `.X = .X` which is cyclical. // -// CHECK:STDERR: fail_cycle_single.carbon:[[@LINE+2]]:12-26: error: found cycle in facet type constraint for `.(M.X)` [FacetTypeConstraintCycle] +// CHECK:STDERR: ╭─┤ fail_cycle_single.carbon:[[@LINE+7]]:12 +// CHECK:STDERR: -> │ impl () as M where .X = .X {} +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: found cycle in facet type constraint for `.(M.X)` +// CHECK:STDERR: · ┃ [FacetTypeConstraintCycle] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as M where .X = .X {} // Even though `.X = ()` is specified, the rewrites are resolved left to right // and a cycle `.X = .X` is found first. // -// CHECK:STDERR: fail_cycle_single.carbon:[[@LINE+2]]:12-38: error: found cycle in facet type constraint for `.(M.X)` [FacetTypeConstraintCycle] +// CHECK:STDERR: ╭─┤ fail_cycle_single.carbon:[[@LINE+7]]:12 +// CHECK:STDERR: -> │ impl () as M where .X = .X and .X = () {} +// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: found cycle in facet type constraint for `.(M.X)` +// CHECK:STDERR: · ┃ [FacetTypeConstraintCycle] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as M where .X = .X and .X = () {} @@ -215,7 +319,12 @@ interface M { let X: type; let Y: type; let Z: type; } // The value of .X and .Y becomes but .Z is still valid. // //@dump-sem-ir-begin -// CHECK:STDERR: fail_cycle.carbon:[[@LINE+2]]:12-50: error: found cycle in facet type constraint for `.(M.Y)` [FacetTypeConstraintCycle] +// CHECK:STDERR: ╭─┤ fail_cycle.carbon:[[@LINE+7]]:12 +// CHECK:STDERR: -> │ impl () as M where .X = .Y and .Y = .X and .Z = () {} +// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: found cycle in facet type constraint for `.(M.Y)` +// CHECK:STDERR: · ┃ [FacetTypeConstraintCycle] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as M where .X = .Y and .Y = .X and .Z = () {} //@dump-sem-ir-end @@ -235,11 +344,28 @@ interface J { // now it's failing due to compound member access in a rewrite constraint not // working. // -// CHECK:STDERR: fail_todo_cycle_between_interfaces.carbon:[[@LINE+6]]:45: error: expected identifier or `Self` after `.` [ExpectedIdentifierOrSelfAfterPeriod] +// CHECK:STDERR: ╭─┤ fail_todo_cycle_between_interfaces.carbon:[[@LINE+23]]:45 +// CHECK:STDERR: -> │ ...I where .Self impls J and .X1 = .(J.X3) and .X2 = .X1 and .(J.X3) = .X2 {} +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected identifier or `Self` +// CHECK:STDERR: · ┃ after `.` +// CHECK:STDERR: · ┃ [ExpectedIdentifierOrSelfAfterPeriod] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_todo_cycle_between_interfaces.carbon:[[@LINE+4]]:45: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_todo_cycle_between_interfaces.carbon:[[@LINE+15]]:45 +// CHECK:STDERR: -> │ ...I where .Self impls J and .X1 = .(J.X3) and .X2 = .X1 and .(J.X3) = .X2 {} +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_todo_cycle_between_interfaces.carbon:[[@LINE+2]]:71: error: expected identifier or `Self` after `.` [ExpectedIdentifierOrSelfAfterPeriod] +// CHECK:STDERR: ╭─┤ fail_todo_cycle_between_interfaces.carbon:[[@LINE+8]]:71 +// CHECK:STDERR: -> │ ...I where .Self impls J and .X1 = .(J.X3) and .X2 = .X1 and .(J.X3) = .X2 {} +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: expected identifier or `Self` after `.` +// CHECK:STDERR: · ┃ [ExpectedIdentifierOrSelfAfterPeriod] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as I where .Self impls J and .X1 = .(J.X3) and .X2 = .X1 and .(J.X3) = .X2 {} @@ -268,7 +394,13 @@ interface N { let Y: {.a: type}; } -// CHECK:STDERR: fail_non-type_different.carbon:[[@LINE+2]]:12-52: error: associated constant `.(N.Y)` given two different values `{.a = {}}` and `{.a = ()}` [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╭─┤ fail_non-type_different.carbon:[[@LINE+8]]:12 +// CHECK:STDERR: -> │ impl () as N where .Y = {.a = {}} and .Y = {.a = ()} {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: associated constant `.(N.Y)` given two different values +// CHECK:STDERR: · ┃ `{.a = {}}` and `{.a = ()}` +// CHECK:STDERR: · ┃ [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as N where .Y = {.a = {}} and .Y = {.a = ()} {} @@ -279,7 +411,12 @@ interface IF { fn F(); } class CD { } -// CHECK:STDERR: fail_where_rewrite_function.carbon:[[@LINE+2]]:12-26: error: rewrite specified for associated function F [RewriteForAssociatedFunction] +// CHECK:STDERR: ╭─┤ fail_where_rewrite_function.carbon:[[@LINE+7]]:12 +// CHECK:STDERR: -> │ impl CD as IF where .F = 0 { +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: rewrite specified for associated function F +// CHECK:STDERR: · ┃ [RewriteForAssociatedFunction] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl CD as IF where .F = 0 { fn F() {} @@ -309,7 +446,13 @@ impl C as Y {} // decl (where we know .Self is C). See: // https://discord.com/channels/655572317891461132/941071822756143115/1400953094015160370 // -// CHECK:STDERR: fail_todo_period_self_impl_lookup.carbon:[[@LINE+2]]:25-29: error: cannot convert type `.Self` that implements `Z` into type implementing `Y` [ConversionFailureFacetToFacet] +// CHECK:STDERR: ╭─┤ fail_todo_period_self_impl_lookup.carbon:[[@LINE+8]]:25 +// CHECK:STDERR: -> │ impl C as Z where .Z1 = .Self {} +// CHECK:STDERR: · ┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot convert type `.Self` that implements +// CHECK:STDERR: · ┃ `Z` into type implementing `Y` +// CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl C as Z where .Z1 = .Self {} @@ -328,7 +471,14 @@ impl C as Z where .Z1 = C {} // Implied constraint: .Self impls Y. Should be verified against the type of the // facet value replacing T when calling F. // -// CHECK:STDERR: fail_todo_period_self_compared_with_concrete_self.carbon:[[@LINE+2]]:38-42: error: cannot convert type `.Self` that implements `Z` into type implementing `Y` [ConversionFailureFacetToFacet] +// CHECK:STDERR: ╭─┤ fail_todo_period_self_compared_with_concrete_self.carbon:[[@LINE+9]]:38 +// CHECK:STDERR: -> │ fn F(unused generic T: Z where .Z1 = .Self) {} +// CHECK:STDERR: · ┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot convert type `.Self` +// CHECK:STDERR: · ┃ that implements `Z` into type +// CHECK:STDERR: · ┃ implementing `Y` +// CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused generic T: Z where .Z1 = .Self) {} fn G() { @@ -337,7 +487,13 @@ fn G() { // Implied constraint: .Self impls Y. Should be verified against the type of // the facet value of C when casting. // - // CHECK:STDERR: fail_todo_period_self_compared_with_concrete_self.carbon:[[@LINE+2]]:23-27: error: cannot convert type `.Self` that implements `Z` into type implementing `Y` [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╭─┤ fail_todo_period_self_compared_with_concrete_self.carbon:[[@LINE+8]]:23 + // CHECK:STDERR: -> │ C as (Z where .Z1 = .Self); + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `.Self` that implements + // CHECK:STDERR: · ┃ `Z` into type implementing `Y` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: C as (Z where .Z1 = .Self); } @@ -395,92 +551,92 @@ fn G() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: impl_decl @empty_tuple.type.as..impl [concrete] {} { -// CHECK:STDOUT: %.loc11_7.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc11_7.2: type = converted %.loc11_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc17_7.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc17_7.2: type = converted %.loc17_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: %L.ref: type = name_ref L, file.%L.decl [concrete = constants.%L.type] // CHECK:STDOUT: %.Self.frozen: %L.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %L.ref [concrete] -// CHECK:STDOUT: %.Self.ref.loc11_20: %L.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc11_20: type = facet_access_type %.Self.ref.loc11_20 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc11_20: type = converted %.Self.ref.loc11_20, %.Self.as_type.loc11_20 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %W.ref.loc11_20: %L.assoc_type = name_ref W, @W.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc11_20.1: type = impl_witness_access constants.%.63f, element0 [symbolic_self = constants.%impl.elem0.2e9] -// CHECK:STDOUT: %.loc11_27: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc11_31: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc11_35: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc11_36.1: %tuple.type.2d5 = tuple_literal (%.loc11_27, %.loc11_31, %.loc11_35) [concrete = constants.%tuple.7e4] -// CHECK:STDOUT: %.loc11_36.2: type = converted constants.%empty_tuple, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %.loc11_36.3: type = converted constants.%empty_tuple, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %.loc11_36.4: type = converted constants.%empty_tuple, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %.loc11_36.5: type = converted %.loc11_36.1, constants.%tuple.type.2d5 [concrete = constants.%tuple.type.2d5] -// CHECK:STDOUT: %rewrite.loc11_23.1 = requirement_rewrite %impl.elem0.loc11_20.1, %.loc11_36.5 [concrete] -// CHECK:STDOUT: %.Self.ref.loc11_42: %L.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc11_42: type = facet_access_type %.Self.ref.loc11_42 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc11_42: type = converted %.Self.ref.loc11_42, %.Self.as_type.loc11_42 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %W.ref.loc11_42: %L.assoc_type = name_ref W, @W.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc11_42.1: type = impl_witness_access constants.%.63f, element0 [symbolic_self = constants.%impl.elem0.2e9] -// CHECK:STDOUT: %impl.elem0.subst.loc11_42.1: type = impl_witness_access_substituted %impl.elem0.loc11_42.1, %.loc11_36.5 [concrete = constants.%tuple.type.2d5] -// CHECK:STDOUT: %.loc11_49: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc11_53: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc11_57: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc11_58.1: %tuple.type.e5a = tuple_literal (%.loc11_49, %.loc11_53, %.loc11_57) [concrete = constants.%tuple.b36] -// CHECK:STDOUT: %.loc11_58.2: type = converted constants.%empty_struct, constants.%empty_struct_type [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %.loc11_58.3: type = converted constants.%empty_tuple, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %.loc11_58.4: type = converted constants.%empty_tuple, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %.loc11_58.5: type = converted %.loc11_58.1, constants.%tuple.type.e5a [concrete = constants.%tuple.type.e5a] -// CHECK:STDOUT: %rewrite.loc11_45.1 = requirement_rewrite %impl.elem0.subst.loc11_42.1, %.loc11_58.5 [concrete] -// CHECK:STDOUT: %.Self.ref.loc11_64: %L.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc11_64: type = facet_access_type %.Self.ref.loc11_64 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc11_64: type = converted %.Self.ref.loc11_64, %.Self.as_type.loc11_64 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %W.ref.loc11_64: %L.assoc_type = name_ref W, @W.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc11_64.1: type = impl_witness_access constants.%.63f, element0 [symbolic_self = constants.%impl.elem0.2e9] -// CHECK:STDOUT: %impl.elem0.subst.loc11_64.1: type = impl_witness_access_substituted %impl.elem0.loc11_64.1, %.loc11_36.5 [concrete = constants.%tuple.type.2d5] -// CHECK:STDOUT: %.loc11_71: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc11_75: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc11_79: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc11_80.1: %tuple.type.d7e = tuple_literal (%.loc11_71, %.loc11_75, %.loc11_79) [concrete = constants.%tuple.8ed] -// CHECK:STDOUT: %.loc11_80.2: type = converted constants.%empty_struct, constants.%empty_struct_type [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %.loc11_80.3: type = converted constants.%empty_struct, constants.%empty_struct_type [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %.loc11_80.4: type = converted constants.%empty_tuple, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %.loc11_80.5: type = converted %.loc11_80.1, constants.%tuple.type.d7e [concrete = constants.%tuple.type.d7e] -// CHECK:STDOUT: %rewrite.loc11_67.1 = requirement_rewrite %impl.elem0.subst.loc11_64.1, %.loc11_80.5 [concrete] -// CHECK:STDOUT: %.Self.ref.loc11_86: %L.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc11_86: type = facet_access_type %.Self.ref.loc11_86 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc11_86: type = converted %.Self.ref.loc11_86, %.Self.as_type.loc11_86 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %W.ref.loc11_86: %L.assoc_type = name_ref W, @W.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc11_86.1: type = impl_witness_access constants.%.63f, element0 [symbolic_self = constants.%impl.elem0.2e9] -// CHECK:STDOUT: %impl.elem0.subst.loc11_86.1: type = impl_witness_access_substituted %impl.elem0.loc11_86.1, %.loc11_36.5 [concrete = constants.%tuple.type.2d5] -// CHECK:STDOUT: %.loc11_93: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc11_97: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc11_101: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc11_102.1: %tuple.type.bd8 = tuple_literal (%.loc11_93, %.loc11_97, %.loc11_101) [concrete = constants.%tuple.d90] -// CHECK:STDOUT: %.loc11_102.2: type = converted constants.%empty_struct, constants.%empty_struct_type [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %.loc11_102.3: type = converted constants.%empty_tuple, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %.loc11_102.4: type = converted constants.%empty_struct, constants.%empty_struct_type [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %.loc11_102.5: type = converted %.loc11_102.1, constants.%tuple.type.bd8 [concrete = constants.%tuple.type.bd8] -// CHECK:STDOUT: %rewrite.loc11_89.1 = requirement_rewrite %impl.elem0.subst.loc11_86.1, %.loc11_102.5 [concrete] -// CHECK:STDOUT: %impl.elem0.loc11_20.2: type = impl_witness_access constants.%.300, element0 [symbolic_self = constants.%impl.elem0.865] -// CHECK:STDOUT: %rewrite.loc11_23.2 = requirement_rewrite %impl.elem0.loc11_20.2, %.loc11_36.5 [concrete] -// CHECK:STDOUT: %impl.elem0.loc11_42.2: type = impl_witness_access constants.%.300, element0 [symbolic_self = constants.%impl.elem0.865] -// CHECK:STDOUT: %impl.elem0.subst.loc11_42.2: type = impl_witness_access_substituted %impl.elem0.loc11_42.2, %.loc11_36.5 [concrete = constants.%tuple.type.2d5] -// CHECK:STDOUT: %rewrite.loc11_45.2 = requirement_rewrite %impl.elem0.subst.loc11_42.2, %.loc11_58.5 [concrete] -// CHECK:STDOUT: %impl.elem0.loc11_64.2: type = impl_witness_access constants.%.300, element0 [symbolic_self = constants.%impl.elem0.865] -// CHECK:STDOUT: %impl.elem0.subst.loc11_64.2: type = impl_witness_access_substituted %impl.elem0.loc11_64.2, %.loc11_36.5 [concrete = constants.%tuple.type.2d5] -// CHECK:STDOUT: %rewrite.loc11_67.2 = requirement_rewrite %impl.elem0.subst.loc11_64.2, %.loc11_80.5 [concrete] -// CHECK:STDOUT: %impl.elem0.loc11_86.2: type = impl_witness_access constants.%.300, element0 [symbolic_self = constants.%impl.elem0.865] -// CHECK:STDOUT: %impl.elem0.subst.loc11_86.2: type = impl_witness_access_substituted %impl.elem0.loc11_86.2, %.loc11_36.5 [concrete = constants.%tuple.type.2d5] -// CHECK:STDOUT: %rewrite.loc11_89.2 = requirement_rewrite %impl.elem0.subst.loc11_86.2, %.loc11_102.5 [concrete] -// CHECK:STDOUT: %.loc11_14: type = where_expr [concrete = ] { +// CHECK:STDOUT: %.Self.ref.loc17_20: %L.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc17_20: type = facet_access_type %.Self.ref.loc17_20 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc17_20: type = converted %.Self.ref.loc17_20, %.Self.as_type.loc17_20 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %W.ref.loc17_20: %L.assoc_type = name_ref W, @W.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: %impl.elem0.loc17_20.1: type = impl_witness_access constants.%.63f, element0 [symbolic_self = constants.%impl.elem0.2e9] +// CHECK:STDOUT: %.loc17_27: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc17_31: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc17_35: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc17_36.1: %tuple.type.2d5 = tuple_literal (%.loc17_27, %.loc17_31, %.loc17_35) [concrete = constants.%tuple.7e4] +// CHECK:STDOUT: %.loc17_36.2: type = converted constants.%empty_tuple, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc17_36.3: type = converted constants.%empty_tuple, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc17_36.4: type = converted constants.%empty_tuple, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc17_36.5: type = converted %.loc17_36.1, constants.%tuple.type.2d5 [concrete = constants.%tuple.type.2d5] +// CHECK:STDOUT: %rewrite.loc17_23.1 = requirement_rewrite %impl.elem0.loc17_20.1, %.loc17_36.5 [concrete] +// CHECK:STDOUT: %.Self.ref.loc17_42: %L.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc17_42: type = facet_access_type %.Self.ref.loc17_42 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc17_42: type = converted %.Self.ref.loc17_42, %.Self.as_type.loc17_42 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %W.ref.loc17_42: %L.assoc_type = name_ref W, @W.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: %impl.elem0.loc17_42.1: type = impl_witness_access constants.%.63f, element0 [symbolic_self = constants.%impl.elem0.2e9] +// CHECK:STDOUT: %impl.elem0.subst.loc17_42.1: type = impl_witness_access_substituted %impl.elem0.loc17_42.1, %.loc17_36.5 [concrete = constants.%tuple.type.2d5] +// CHECK:STDOUT: %.loc17_49: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc17_53: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc17_57: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc17_58.1: %tuple.type.e5a = tuple_literal (%.loc17_49, %.loc17_53, %.loc17_57) [concrete = constants.%tuple.b36] +// CHECK:STDOUT: %.loc17_58.2: type = converted constants.%empty_struct, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc17_58.3: type = converted constants.%empty_tuple, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc17_58.4: type = converted constants.%empty_tuple, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc17_58.5: type = converted %.loc17_58.1, constants.%tuple.type.e5a [concrete = constants.%tuple.type.e5a] +// CHECK:STDOUT: %rewrite.loc17_45.1 = requirement_rewrite %impl.elem0.subst.loc17_42.1, %.loc17_58.5 [concrete] +// CHECK:STDOUT: %.Self.ref.loc17_64: %L.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc17_64: type = facet_access_type %.Self.ref.loc17_64 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc17_64: type = converted %.Self.ref.loc17_64, %.Self.as_type.loc17_64 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %W.ref.loc17_64: %L.assoc_type = name_ref W, @W.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: %impl.elem0.loc17_64.1: type = impl_witness_access constants.%.63f, element0 [symbolic_self = constants.%impl.elem0.2e9] +// CHECK:STDOUT: %impl.elem0.subst.loc17_64.1: type = impl_witness_access_substituted %impl.elem0.loc17_64.1, %.loc17_36.5 [concrete = constants.%tuple.type.2d5] +// CHECK:STDOUT: %.loc17_71: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc17_75: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc17_79: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc17_80.1: %tuple.type.d7e = tuple_literal (%.loc17_71, %.loc17_75, %.loc17_79) [concrete = constants.%tuple.8ed] +// CHECK:STDOUT: %.loc17_80.2: type = converted constants.%empty_struct, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc17_80.3: type = converted constants.%empty_struct, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc17_80.4: type = converted constants.%empty_tuple, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc17_80.5: type = converted %.loc17_80.1, constants.%tuple.type.d7e [concrete = constants.%tuple.type.d7e] +// CHECK:STDOUT: %rewrite.loc17_67.1 = requirement_rewrite %impl.elem0.subst.loc17_64.1, %.loc17_80.5 [concrete] +// CHECK:STDOUT: %.Self.ref.loc17_86: %L.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc17_86: type = facet_access_type %.Self.ref.loc17_86 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc17_86: type = converted %.Self.ref.loc17_86, %.Self.as_type.loc17_86 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %W.ref.loc17_86: %L.assoc_type = name_ref W, @W.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: %impl.elem0.loc17_86.1: type = impl_witness_access constants.%.63f, element0 [symbolic_self = constants.%impl.elem0.2e9] +// CHECK:STDOUT: %impl.elem0.subst.loc17_86.1: type = impl_witness_access_substituted %impl.elem0.loc17_86.1, %.loc17_36.5 [concrete = constants.%tuple.type.2d5] +// CHECK:STDOUT: %.loc17_93: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc17_97: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc17_101: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc17_102.1: %tuple.type.bd8 = tuple_literal (%.loc17_93, %.loc17_97, %.loc17_101) [concrete = constants.%tuple.d90] +// CHECK:STDOUT: %.loc17_102.2: type = converted constants.%empty_struct, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc17_102.3: type = converted constants.%empty_tuple, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc17_102.4: type = converted constants.%empty_struct, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc17_102.5: type = converted %.loc17_102.1, constants.%tuple.type.bd8 [concrete = constants.%tuple.type.bd8] +// CHECK:STDOUT: %rewrite.loc17_89.1 = requirement_rewrite %impl.elem0.subst.loc17_86.1, %.loc17_102.5 [concrete] +// CHECK:STDOUT: %impl.elem0.loc17_20.2: type = impl_witness_access constants.%.300, element0 [symbolic_self = constants.%impl.elem0.865] +// CHECK:STDOUT: %rewrite.loc17_23.2 = requirement_rewrite %impl.elem0.loc17_20.2, %.loc17_36.5 [concrete] +// CHECK:STDOUT: %impl.elem0.loc17_42.2: type = impl_witness_access constants.%.300, element0 [symbolic_self = constants.%impl.elem0.865] +// CHECK:STDOUT: %impl.elem0.subst.loc17_42.2: type = impl_witness_access_substituted %impl.elem0.loc17_42.2, %.loc17_36.5 [concrete = constants.%tuple.type.2d5] +// CHECK:STDOUT: %rewrite.loc17_45.2 = requirement_rewrite %impl.elem0.subst.loc17_42.2, %.loc17_58.5 [concrete] +// CHECK:STDOUT: %impl.elem0.loc17_64.2: type = impl_witness_access constants.%.300, element0 [symbolic_self = constants.%impl.elem0.865] +// CHECK:STDOUT: %impl.elem0.subst.loc17_64.2: type = impl_witness_access_substituted %impl.elem0.loc17_64.2, %.loc17_36.5 [concrete = constants.%tuple.type.2d5] +// CHECK:STDOUT: %rewrite.loc17_67.2 = requirement_rewrite %impl.elem0.subst.loc17_64.2, %.loc17_80.5 [concrete] +// CHECK:STDOUT: %impl.elem0.loc17_86.2: type = impl_witness_access constants.%.300, element0 [symbolic_self = constants.%impl.elem0.865] +// CHECK:STDOUT: %impl.elem0.subst.loc17_86.2: type = impl_witness_access_substituted %impl.elem0.loc17_86.2, %.loc17_36.5 [concrete = constants.%tuple.type.2d5] +// CHECK:STDOUT: %rewrite.loc17_89.2 = requirement_rewrite %impl.elem0.subst.loc17_86.2, %.loc17_102.5 [concrete] +// CHECK:STDOUT: %.loc17_14: type = where_expr [concrete = ] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %L.ref [concrete] -// CHECK:STDOUT: %rewrite.loc11_23.2 = requirement_rewrite %impl.elem0.loc11_20.2, %.loc11_36.5 [concrete] -// CHECK:STDOUT: %rewrite.loc11_45.2 = requirement_rewrite %impl.elem0.subst.loc11_42.2, %.loc11_58.5 [concrete] -// CHECK:STDOUT: %rewrite.loc11_67.2 = requirement_rewrite %impl.elem0.subst.loc11_64.2, %.loc11_80.5 [concrete] -// CHECK:STDOUT: %rewrite.loc11_89.2 = requirement_rewrite %impl.elem0.subst.loc11_86.2, %.loc11_102.5 [concrete] +// CHECK:STDOUT: %rewrite.loc17_23.2 = requirement_rewrite %impl.elem0.loc17_20.2, %.loc17_36.5 [concrete] +// CHECK:STDOUT: %rewrite.loc17_45.2 = requirement_rewrite %impl.elem0.subst.loc17_42.2, %.loc17_58.5 [concrete] +// CHECK:STDOUT: %rewrite.loc17_67.2 = requirement_rewrite %impl.elem0.subst.loc17_64.2, %.loc17_80.5 [concrete] +// CHECK:STDOUT: %rewrite.loc17_89.2 = requirement_rewrite %impl.elem0.subst.loc17_86.2, %.loc17_102.5 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @empty_tuple.type.as..impl: %.loc11_7.2 as { +// CHECK:STDOUT: impl @empty_tuple.type.as..impl: %.loc17_7.2 as { // CHECK:STDOUT: !members: // CHECK:STDOUT: extend // CHECK:STDOUT: witness = @@ -512,62 +668,62 @@ fn G() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: impl_decl @empty_tuple.type.as..impl [concrete] {} { -// CHECK:STDOUT: %.loc11_7.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc11_7.2: type = converted %.loc11_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc16_7.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc16_7.2: type = converted %.loc16_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: %M.ref: type = name_ref M, file.%M.decl [concrete = constants.%M.type] // CHECK:STDOUT: %.Self.frozen: %M.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %M.ref [concrete] -// CHECK:STDOUT: %.Self.ref.loc11_20: %M.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc11_20: type = facet_access_type %.Self.ref.loc11_20 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc11_20: type = converted %.Self.ref.loc11_20, %.Self.as_type.loc11_20 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %X.ref.loc11_20: %M.assoc_type = name_ref X, @X.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc11_20.1: type = impl_witness_access constants.%.b7a, element0 [symbolic_self = constants.%impl.elem0.88c] -// CHECK:STDOUT: %.Self.ref.loc11_25: %M.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc11_25: type = facet_access_type %.Self.ref.loc11_25 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc11_25: type = converted %.Self.ref.loc11_25, %.Self.as_type.loc11_25 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %Y.ref.loc11_25: %M.assoc_type = name_ref Y, @Y.%assoc1 [concrete = constants.%assoc1] -// CHECK:STDOUT: %impl.elem1.loc11_25.1: type = impl_witness_access constants.%.b7a, element1 [symbolic_self = constants.%impl.elem1.17a] -// CHECK:STDOUT: %rewrite.loc11_23.1 = requirement_rewrite %impl.elem0.loc11_20.1, %impl.elem1.loc11_25.1 [concrete] -// CHECK:STDOUT: %.Self.ref.loc11_32: %M.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc11_32: type = facet_access_type %.Self.ref.loc11_32 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc11_32: type = converted %.Self.ref.loc11_32, %.Self.as_type.loc11_32 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %Y.ref.loc11_32: %M.assoc_type = name_ref Y, @Y.%assoc1 [concrete = constants.%assoc1] -// CHECK:STDOUT: %impl.elem1.loc11_32.1: type = impl_witness_access constants.%.b7a, element1 [symbolic_self = constants.%impl.elem1.17a] -// CHECK:STDOUT: %.Self.ref.loc11_37: %M.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc11_37: type = facet_access_type %.Self.ref.loc11_37 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc11_37: type = converted %.Self.ref.loc11_37, %.Self.as_type.loc11_37 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %X.ref.loc11_37: %M.assoc_type = name_ref X, @X.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc11_37.1: type = impl_witness_access constants.%.b7a, element0 [symbolic_self = constants.%impl.elem0.88c] -// CHECK:STDOUT: %impl.elem0.subst.loc11_37.1: type = impl_witness_access_substituted %impl.elem0.loc11_37.1, %impl.elem1.loc11_25.1 [symbolic_self = constants.%impl.elem1.17a] -// CHECK:STDOUT: %rewrite.loc11_35.1 = requirement_rewrite %impl.elem1.loc11_32.1, %impl.elem0.subst.loc11_37.1 [concrete] -// CHECK:STDOUT: %.Self.ref.loc11_44: %M.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc11_44: type = facet_access_type %.Self.ref.loc11_44 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc11_44: type = converted %.Self.ref.loc11_44, %.Self.as_type.loc11_44 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.Self.ref.loc16_20: %M.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc16_20: type = facet_access_type %.Self.ref.loc16_20 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc16_20: type = converted %.Self.ref.loc16_20, %.Self.as_type.loc16_20 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %X.ref.loc16_20: %M.assoc_type = name_ref X, @X.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: %impl.elem0.loc16_20.1: type = impl_witness_access constants.%.b7a, element0 [symbolic_self = constants.%impl.elem0.88c] +// CHECK:STDOUT: %.Self.ref.loc16_25: %M.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc16_25: type = facet_access_type %.Self.ref.loc16_25 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc16_25: type = converted %.Self.ref.loc16_25, %.Self.as_type.loc16_25 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %Y.ref.loc16_25: %M.assoc_type = name_ref Y, @Y.%assoc1 [concrete = constants.%assoc1] +// CHECK:STDOUT: %impl.elem1.loc16_25.1: type = impl_witness_access constants.%.b7a, element1 [symbolic_self = constants.%impl.elem1.17a] +// CHECK:STDOUT: %rewrite.loc16_23.1 = requirement_rewrite %impl.elem0.loc16_20.1, %impl.elem1.loc16_25.1 [concrete] +// CHECK:STDOUT: %.Self.ref.loc16_32: %M.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc16_32: type = facet_access_type %.Self.ref.loc16_32 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc16_32: type = converted %.Self.ref.loc16_32, %.Self.as_type.loc16_32 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %Y.ref.loc16_32: %M.assoc_type = name_ref Y, @Y.%assoc1 [concrete = constants.%assoc1] +// CHECK:STDOUT: %impl.elem1.loc16_32.1: type = impl_witness_access constants.%.b7a, element1 [symbolic_self = constants.%impl.elem1.17a] +// CHECK:STDOUT: %.Self.ref.loc16_37: %M.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc16_37: type = facet_access_type %.Self.ref.loc16_37 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc16_37: type = converted %.Self.ref.loc16_37, %.Self.as_type.loc16_37 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %X.ref.loc16_37: %M.assoc_type = name_ref X, @X.%assoc0 [concrete = constants.%assoc0] +// CHECK:STDOUT: %impl.elem0.loc16_37.1: type = impl_witness_access constants.%.b7a, element0 [symbolic_self = constants.%impl.elem0.88c] +// CHECK:STDOUT: %impl.elem0.subst.loc16_37.1: type = impl_witness_access_substituted %impl.elem0.loc16_37.1, %impl.elem1.loc16_25.1 [symbolic_self = constants.%impl.elem1.17a] +// CHECK:STDOUT: %rewrite.loc16_35.1 = requirement_rewrite %impl.elem1.loc16_32.1, %impl.elem0.subst.loc16_37.1 [concrete] +// CHECK:STDOUT: %.Self.ref.loc16_44: %M.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc16_44: type = facet_access_type %.Self.ref.loc16_44 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc16_44: type = converted %.Self.ref.loc16_44, %.Self.as_type.loc16_44 [symbolic_self = constants.%.Self.frozen.as_type] // CHECK:STDOUT: %Z.ref: %M.assoc_type = name_ref Z, @Z.%assoc2 [concrete = constants.%assoc2] -// CHECK:STDOUT: %impl.elem2.loc11_44.1: type = impl_witness_access constants.%.b7a, element2 [symbolic_self = constants.%impl.elem2.efd] -// CHECK:STDOUT: %.loc11_50.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc11_50.2: type = converted %.loc11_50.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %rewrite.loc11_47.1 = requirement_rewrite %impl.elem2.loc11_44.1, %.loc11_50.2 [concrete] -// CHECK:STDOUT: %impl.elem0.loc11_20.2: type = impl_witness_access constants.%.f89, element0 [symbolic_self = constants.%impl.elem0.dfb] -// CHECK:STDOUT: %impl.elem1.loc11_25.2: type = impl_witness_access constants.%.f89, element1 [symbolic_self = constants.%impl.elem1.bb0] -// CHECK:STDOUT: %rewrite.loc11_23.2 = requirement_rewrite %impl.elem0.loc11_20.2, %impl.elem1.loc11_25.2 [concrete] -// CHECK:STDOUT: %impl.elem1.loc11_32.2: type = impl_witness_access constants.%.f89, element1 [symbolic_self = constants.%impl.elem1.bb0] -// CHECK:STDOUT: %impl.elem0.loc11_37.2: type = impl_witness_access constants.%.f89, element0 [symbolic_self = constants.%impl.elem0.dfb] -// CHECK:STDOUT: %impl.elem1.loc11_25.3: type = impl_witness_access constants.%.f89, element1 [symbolic_self = constants.%impl.elem1.bb0] -// CHECK:STDOUT: %impl.elem0.subst.loc11_37.2: type = impl_witness_access_substituted %impl.elem0.loc11_37.2, %impl.elem1.loc11_25.3 [symbolic_self = constants.%impl.elem1.bb0] -// CHECK:STDOUT: %rewrite.loc11_35.2 = requirement_rewrite %impl.elem1.loc11_32.2, %impl.elem0.subst.loc11_37.2 [concrete] -// CHECK:STDOUT: %impl.elem2.loc11_44.2: type = impl_witness_access constants.%.f89, element2 [symbolic_self = constants.%impl.elem2.d85] -// CHECK:STDOUT: %rewrite.loc11_47.2 = requirement_rewrite %impl.elem2.loc11_44.2, %.loc11_50.2 [concrete] -// CHECK:STDOUT: %.loc11_14: type = where_expr [concrete = ] { +// CHECK:STDOUT: %impl.elem2.loc16_44.1: type = impl_witness_access constants.%.b7a, element2 [symbolic_self = constants.%impl.elem2.efd] +// CHECK:STDOUT: %.loc16_50.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc16_50.2: type = converted %.loc16_50.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %rewrite.loc16_47.1 = requirement_rewrite %impl.elem2.loc16_44.1, %.loc16_50.2 [concrete] +// CHECK:STDOUT: %impl.elem0.loc16_20.2: type = impl_witness_access constants.%.f89, element0 [symbolic_self = constants.%impl.elem0.dfb] +// CHECK:STDOUT: %impl.elem1.loc16_25.2: type = impl_witness_access constants.%.f89, element1 [symbolic_self = constants.%impl.elem1.bb0] +// CHECK:STDOUT: %rewrite.loc16_23.2 = requirement_rewrite %impl.elem0.loc16_20.2, %impl.elem1.loc16_25.2 [concrete] +// CHECK:STDOUT: %impl.elem1.loc16_32.2: type = impl_witness_access constants.%.f89, element1 [symbolic_self = constants.%impl.elem1.bb0] +// CHECK:STDOUT: %impl.elem0.loc16_37.2: type = impl_witness_access constants.%.f89, element0 [symbolic_self = constants.%impl.elem0.dfb] +// CHECK:STDOUT: %impl.elem1.loc16_25.3: type = impl_witness_access constants.%.f89, element1 [symbolic_self = constants.%impl.elem1.bb0] +// CHECK:STDOUT: %impl.elem0.subst.loc16_37.2: type = impl_witness_access_substituted %impl.elem0.loc16_37.2, %impl.elem1.loc16_25.3 [symbolic_self = constants.%impl.elem1.bb0] +// CHECK:STDOUT: %rewrite.loc16_35.2 = requirement_rewrite %impl.elem1.loc16_32.2, %impl.elem0.subst.loc16_37.2 [concrete] +// CHECK:STDOUT: %impl.elem2.loc16_44.2: type = impl_witness_access constants.%.f89, element2 [symbolic_self = constants.%impl.elem2.d85] +// CHECK:STDOUT: %rewrite.loc16_47.2 = requirement_rewrite %impl.elem2.loc16_44.2, %.loc16_50.2 [concrete] +// CHECK:STDOUT: %.loc16_14: type = where_expr [concrete = ] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %M.ref [concrete] -// CHECK:STDOUT: %rewrite.loc11_23.2 = requirement_rewrite %impl.elem0.loc11_20.2, %impl.elem1.loc11_25.2 [concrete] -// CHECK:STDOUT: %rewrite.loc11_35.2 = requirement_rewrite %impl.elem1.loc11_32.2, %impl.elem0.subst.loc11_37.2 [concrete] -// CHECK:STDOUT: %rewrite.loc11_47.2 = requirement_rewrite %impl.elem2.loc11_44.2, %.loc11_50.2 [concrete] +// CHECK:STDOUT: %rewrite.loc16_23.2 = requirement_rewrite %impl.elem0.loc16_20.2, %impl.elem1.loc16_25.2 [concrete] +// CHECK:STDOUT: %rewrite.loc16_35.2 = requirement_rewrite %impl.elem1.loc16_32.2, %impl.elem0.subst.loc16_37.2 [concrete] +// CHECK:STDOUT: %rewrite.loc16_47.2 = requirement_rewrite %impl.elem2.loc16_44.2, %.loc16_50.2 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @empty_tuple.type.as..impl: %.loc11_7.2 as { +// CHECK:STDOUT: impl @empty_tuple.type.as..impl: %.loc16_7.2 as { // CHECK:STDOUT: !members: // CHECK:STDOUT: extend // CHECK:STDOUT: witness = diff --git a/toolchain/check/testdata/impl/impl_assoc_const_with_prelude.carbon b/toolchain/check/testdata/impl/impl_assoc_const_with_prelude.carbon index 335807e23749..ca4f7c5ec018 100644 --- a/toolchain/check/testdata/impl/impl_assoc_const_with_prelude.carbon +++ b/toolchain/check/testdata/impl/impl_assoc_const_with_prelude.carbon @@ -26,7 +26,14 @@ library "[[@TEST_NAME]]"; interface I { let X: {.a: bool, .b: (i32, i32)}; } -// CHECK:STDERR: fail_two_different_non_type.carbon:[[@LINE+2]]:12-83: error: associated constant `.(I.X)` given two different values `{.a = true, .b = (1, 2)}` and `{.a = false, .b = (3, 4)}` [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╭─┤ fail_two_different_non_type.carbon:[[@LINE+9]]:12 +// CHECK:STDERR: -> │ impl () as I where .X = {.a = true, .b = (1, 2)} and .X = {.a = false, .b ... +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: associated constant `.(I.X)` given two different values +// CHECK:STDERR: · ┃ `{.a = true, .b = (1, 2)}` and +// CHECK:STDERR: · ┃ `{.a = false, .b = (3, 4)}` +// CHECK:STDERR: · ┃ [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as I where .X = {.a = true, .b = (1, 2)} and .X = {.a = false, .b = (3, 4)} {} @@ -362,79 +369,79 @@ impl () as I where .X = {.a = true, .b = (1, 2)} and .X = {.a = false, .b = (3, // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {} // CHECK:STDOUT: impl_decl @empty_tuple.type.as..impl [concrete] {} { -// CHECK:STDOUT: %.loc8_7.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_7.2: type = converted %.loc8_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc15_7.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc15_7.2: type = converted %.loc15_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: %.Self.frozen: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] -// CHECK:STDOUT: %.Self.ref.loc8_20: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc8_20: type = facet_access_type %.Self.ref.loc8_20 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc8_20: type = converted %.Self.ref.loc8_20, %.Self.as_type.loc8_20 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %X.ref.loc8_20: %I.assoc_type = name_ref X, @X.%assoc0 [concrete = constants.%assoc0.194] -// CHECK:STDOUT: %impl.elem0.loc8_20.1: %struct_type.a.b.36f = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.84d] +// CHECK:STDOUT: %.Self.ref.loc15_20: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc15_20: type = facet_access_type %.Self.ref.loc15_20 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc15_20: type = converted %.Self.ref.loc15_20, %.Self.as_type.loc15_20 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %X.ref.loc15_20: %I.assoc_type = name_ref X, @X.%assoc0 [concrete = constants.%assoc0.194] +// CHECK:STDOUT: %impl.elem0.loc15_20.1: %struct_type.a.b.36f = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.84d] // CHECK:STDOUT: %true: bool = bool_literal true [concrete = constants.%true] // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] -// CHECK:STDOUT: %.loc8_47.1: %tuple.type.f94 = tuple_literal (%int_1, %int_2) [concrete = constants.%tuple.ad8] -// CHECK:STDOUT: %.loc8_48.1: %struct_type.a.b.aa4 = struct_literal (%true, %.loc8_47.1) [concrete = constants.%struct.e57] -// CHECK:STDOUT: %impl.elem0.loc8_47.1: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc8_47.1: = bound_method %int_1, %impl.elem0.loc8_47.1 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282] -// CHECK:STDOUT: %specific_fn.loc8_47.1: = specific_function %impl.elem0.loc8_47.1, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc8_47.2: = bound_method %int_1, %specific_fn.loc8_47.1 [concrete = constants.%bound_method.3bd] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc8_47.1: init %i32 = call %bound_method.loc8_47.2(%int_1) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc8_47.2: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc8_47.1 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc8_47.3: %i32 = converted %int_1, %.loc8_47.2 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %impl.elem0.loc8_47.2: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc8_47.3: = bound_method %int_2, %impl.elem0.loc8_47.2 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.8a6] -// CHECK:STDOUT: %specific_fn.loc8_47.2: = specific_function %impl.elem0.loc8_47.2, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc8_47.4: = bound_method %int_2, %specific_fn.loc8_47.2 [concrete = constants.%bound_method.a55] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc8_47.2: init %i32 = call %bound_method.loc8_47.4(%int_2) [concrete = constants.%int_2.2e0] -// CHECK:STDOUT: %.loc8_47.4: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc8_47.2 [concrete = constants.%int_2.2e0] -// CHECK:STDOUT: %.loc8_47.5: %i32 = converted %int_2, %.loc8_47.4 [concrete = constants.%int_2.2e0] -// CHECK:STDOUT: %tuple.loc8_47: %tuple.type.35f = tuple_value (%.loc8_47.3, %.loc8_47.5) [concrete = constants.%tuple.380] -// CHECK:STDOUT: %.loc8_48.2: %tuple.type.35f = converted %.loc8_47.1, %tuple.loc8_47 [concrete = constants.%tuple.380] -// CHECK:STDOUT: %struct.loc8_48: %struct_type.a.b.36f = struct_value (%true, %.loc8_48.2) [concrete = constants.%struct.8fa] -// CHECK:STDOUT: %.loc8_48.3: %struct_type.a.b.36f = converted %.loc8_48.1, %struct.loc8_48 [concrete = constants.%struct.8fa] -// CHECK:STDOUT: %rewrite.loc8_23.1 = requirement_rewrite %impl.elem0.loc8_20.1, %.loc8_48.3 [concrete] -// CHECK:STDOUT: %.Self.ref.loc8_54: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc8_54: type = facet_access_type %.Self.ref.loc8_54 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc8_54: type = converted %.Self.ref.loc8_54, %.Self.as_type.loc8_54 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %X.ref.loc8_54: %I.assoc_type = name_ref X, @X.%assoc0 [concrete = constants.%assoc0.194] -// CHECK:STDOUT: %impl.elem0.loc8_54.1: %struct_type.a.b.36f = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.84d] -// CHECK:STDOUT: %impl.elem0.subst.loc8_54.1: %struct_type.a.b.36f = impl_witness_access_substituted %impl.elem0.loc8_54.1, %.loc8_48.3 [concrete = constants.%struct.8fa] +// CHECK:STDOUT: %.loc15_47.1: %tuple.type.f94 = tuple_literal (%int_1, %int_2) [concrete = constants.%tuple.ad8] +// CHECK:STDOUT: %.loc15_48.1: %struct_type.a.b.aa4 = struct_literal (%true, %.loc15_47.1) [concrete = constants.%struct.e57] +// CHECK:STDOUT: %impl.elem0.loc15_47.1: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc15_47.1: = bound_method %int_1, %impl.elem0.loc15_47.1 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282] +// CHECK:STDOUT: %specific_fn.loc15_47.1: = specific_function %impl.elem0.loc15_47.1, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc15_47.2: = bound_method %int_1, %specific_fn.loc15_47.1 [concrete = constants.%bound_method.3bd] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc15_47.1: init %i32 = call %bound_method.loc15_47.2(%int_1) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc15_47.2: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc15_47.1 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc15_47.3: %i32 = converted %int_1, %.loc15_47.2 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %impl.elem0.loc15_47.2: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc15_47.3: = bound_method %int_2, %impl.elem0.loc15_47.2 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.8a6] +// CHECK:STDOUT: %specific_fn.loc15_47.2: = specific_function %impl.elem0.loc15_47.2, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc15_47.4: = bound_method %int_2, %specific_fn.loc15_47.2 [concrete = constants.%bound_method.a55] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc15_47.2: init %i32 = call %bound_method.loc15_47.4(%int_2) [concrete = constants.%int_2.2e0] +// CHECK:STDOUT: %.loc15_47.4: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc15_47.2 [concrete = constants.%int_2.2e0] +// CHECK:STDOUT: %.loc15_47.5: %i32 = converted %int_2, %.loc15_47.4 [concrete = constants.%int_2.2e0] +// CHECK:STDOUT: %tuple.loc15_47: %tuple.type.35f = tuple_value (%.loc15_47.3, %.loc15_47.5) [concrete = constants.%tuple.380] +// CHECK:STDOUT: %.loc15_48.2: %tuple.type.35f = converted %.loc15_47.1, %tuple.loc15_47 [concrete = constants.%tuple.380] +// CHECK:STDOUT: %struct.loc15_48: %struct_type.a.b.36f = struct_value (%true, %.loc15_48.2) [concrete = constants.%struct.8fa] +// CHECK:STDOUT: %.loc15_48.3: %struct_type.a.b.36f = converted %.loc15_48.1, %struct.loc15_48 [concrete = constants.%struct.8fa] +// CHECK:STDOUT: %rewrite.loc15_23.1 = requirement_rewrite %impl.elem0.loc15_20.1, %.loc15_48.3 [concrete] +// CHECK:STDOUT: %.Self.ref.loc15_54: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc15_54: type = facet_access_type %.Self.ref.loc15_54 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc15_54: type = converted %.Self.ref.loc15_54, %.Self.as_type.loc15_54 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %X.ref.loc15_54: %I.assoc_type = name_ref X, @X.%assoc0 [concrete = constants.%assoc0.194] +// CHECK:STDOUT: %impl.elem0.loc15_54.1: %struct_type.a.b.36f = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.84d] +// CHECK:STDOUT: %impl.elem0.subst.loc15_54.1: %struct_type.a.b.36f = impl_witness_access_substituted %impl.elem0.loc15_54.1, %.loc15_48.3 [concrete = constants.%struct.8fa] // CHECK:STDOUT: %false: bool = bool_literal false [concrete = constants.%false] // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3.1ba] // CHECK:STDOUT: %int_4: Core.IntLiteral = int_value 4 [concrete = constants.%int_4.0c1] -// CHECK:STDOUT: %.loc8_82.1: %tuple.type.f94 = tuple_literal (%int_3, %int_4) [concrete = constants.%tuple.302] -// CHECK:STDOUT: %.loc8_83.1: %struct_type.a.b.aa4 = struct_literal (%false, %.loc8_82.1) [concrete = constants.%struct.1ec] -// CHECK:STDOUT: %impl.elem0.loc8_82.1: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc8_82.1: = bound_method %int_3, %impl.elem0.loc8_82.1 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.b3c] -// CHECK:STDOUT: %specific_fn.loc8_82.1: = specific_function %impl.elem0.loc8_82.1, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc8_82.2: = bound_method %int_3, %specific_fn.loc8_82.1 [concrete = constants.%bound_method.fb0] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc8_82.1: init %i32 = call %bound_method.loc8_82.2(%int_3) [concrete = constants.%int_3.9f3] -// CHECK:STDOUT: %.loc8_82.2: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc8_82.1 [concrete = constants.%int_3.9f3] -// CHECK:STDOUT: %.loc8_82.3: %i32 = converted %int_3, %.loc8_82.2 [concrete = constants.%int_3.9f3] -// CHECK:STDOUT: %impl.elem0.loc8_82.2: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc8_82.3: = bound_method %int_4, %impl.elem0.loc8_82.2 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.776] -// CHECK:STDOUT: %specific_fn.loc8_82.2: = specific_function %impl.elem0.loc8_82.2, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc8_82.4: = bound_method %int_4, %specific_fn.loc8_82.2 [concrete = constants.%bound_method.7fa] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc8_82.2: init %i32 = call %bound_method.loc8_82.4(%int_4) [concrete = constants.%int_4.6bf] -// CHECK:STDOUT: %.loc8_82.4: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc8_82.2 [concrete = constants.%int_4.6bf] -// CHECK:STDOUT: %.loc8_82.5: %i32 = converted %int_4, %.loc8_82.4 [concrete = constants.%int_4.6bf] -// CHECK:STDOUT: %tuple.loc8_82: %tuple.type.35f = tuple_value (%.loc8_82.3, %.loc8_82.5) [concrete = constants.%tuple.859] -// CHECK:STDOUT: %.loc8_83.2: %tuple.type.35f = converted %.loc8_82.1, %tuple.loc8_82 [concrete = constants.%tuple.859] -// CHECK:STDOUT: %struct.loc8_83: %struct_type.a.b.36f = struct_value (%false, %.loc8_83.2) [concrete = constants.%struct.7c4] -// CHECK:STDOUT: %.loc8_83.3: %struct_type.a.b.36f = converted %.loc8_83.1, %struct.loc8_83 [concrete = constants.%struct.7c4] -// CHECK:STDOUT: %rewrite.loc8_57.1 = requirement_rewrite %impl.elem0.subst.loc8_54.1, %.loc8_83.3 [concrete] -// CHECK:STDOUT: %impl.elem0.loc8_20.2: %struct_type.a.b.36f = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.fcf] -// CHECK:STDOUT: %rewrite.loc8_23.2 = requirement_rewrite %impl.elem0.loc8_20.2, %.loc8_48.3 [concrete] -// CHECK:STDOUT: %impl.elem0.loc8_54.2: %struct_type.a.b.36f = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.fcf] -// CHECK:STDOUT: %impl.elem0.subst.loc8_54.2: %struct_type.a.b.36f = impl_witness_access_substituted %impl.elem0.loc8_54.2, %.loc8_48.3 [concrete = constants.%struct.8fa] -// CHECK:STDOUT: %rewrite.loc8_57.2 = requirement_rewrite %impl.elem0.subst.loc8_54.2, %.loc8_83.3 [concrete] -// CHECK:STDOUT: %.loc8_14: type = where_expr [concrete = ] { +// CHECK:STDOUT: %.loc15_82.1: %tuple.type.f94 = tuple_literal (%int_3, %int_4) [concrete = constants.%tuple.302] +// CHECK:STDOUT: %.loc15_83.1: %struct_type.a.b.aa4 = struct_literal (%false, %.loc15_82.1) [concrete = constants.%struct.1ec] +// CHECK:STDOUT: %impl.elem0.loc15_82.1: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc15_82.1: = bound_method %int_3, %impl.elem0.loc15_82.1 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.b3c] +// CHECK:STDOUT: %specific_fn.loc15_82.1: = specific_function %impl.elem0.loc15_82.1, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc15_82.2: = bound_method %int_3, %specific_fn.loc15_82.1 [concrete = constants.%bound_method.fb0] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc15_82.1: init %i32 = call %bound_method.loc15_82.2(%int_3) [concrete = constants.%int_3.9f3] +// CHECK:STDOUT: %.loc15_82.2: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc15_82.1 [concrete = constants.%int_3.9f3] +// CHECK:STDOUT: %.loc15_82.3: %i32 = converted %int_3, %.loc15_82.2 [concrete = constants.%int_3.9f3] +// CHECK:STDOUT: %impl.elem0.loc15_82.2: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc15_82.3: = bound_method %int_4, %impl.elem0.loc15_82.2 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.776] +// CHECK:STDOUT: %specific_fn.loc15_82.2: = specific_function %impl.elem0.loc15_82.2, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc15_82.4: = bound_method %int_4, %specific_fn.loc15_82.2 [concrete = constants.%bound_method.7fa] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc15_82.2: init %i32 = call %bound_method.loc15_82.4(%int_4) [concrete = constants.%int_4.6bf] +// CHECK:STDOUT: %.loc15_82.4: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc15_82.2 [concrete = constants.%int_4.6bf] +// CHECK:STDOUT: %.loc15_82.5: %i32 = converted %int_4, %.loc15_82.4 [concrete = constants.%int_4.6bf] +// CHECK:STDOUT: %tuple.loc15_82: %tuple.type.35f = tuple_value (%.loc15_82.3, %.loc15_82.5) [concrete = constants.%tuple.859] +// CHECK:STDOUT: %.loc15_83.2: %tuple.type.35f = converted %.loc15_82.1, %tuple.loc15_82 [concrete = constants.%tuple.859] +// CHECK:STDOUT: %struct.loc15_83: %struct_type.a.b.36f = struct_value (%false, %.loc15_83.2) [concrete = constants.%struct.7c4] +// CHECK:STDOUT: %.loc15_83.3: %struct_type.a.b.36f = converted %.loc15_83.1, %struct.loc15_83 [concrete = constants.%struct.7c4] +// CHECK:STDOUT: %rewrite.loc15_57.1 = requirement_rewrite %impl.elem0.subst.loc15_54.1, %.loc15_83.3 [concrete] +// CHECK:STDOUT: %impl.elem0.loc15_20.2: %struct_type.a.b.36f = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.fcf] +// CHECK:STDOUT: %rewrite.loc15_23.2 = requirement_rewrite %impl.elem0.loc15_20.2, %.loc15_48.3 [concrete] +// CHECK:STDOUT: %impl.elem0.loc15_54.2: %struct_type.a.b.36f = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.fcf] +// CHECK:STDOUT: %impl.elem0.subst.loc15_54.2: %struct_type.a.b.36f = impl_witness_access_substituted %impl.elem0.loc15_54.2, %.loc15_48.3 [concrete = constants.%struct.8fa] +// CHECK:STDOUT: %rewrite.loc15_57.2 = requirement_rewrite %impl.elem0.subst.loc15_54.2, %.loc15_83.3 [concrete] +// CHECK:STDOUT: %.loc15_14: type = where_expr [concrete = ] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] -// CHECK:STDOUT: %rewrite.loc8_23.2 = requirement_rewrite %impl.elem0.loc8_20.2, %.loc8_48.3 [concrete] -// CHECK:STDOUT: %rewrite.loc8_57.2 = requirement_rewrite %impl.elem0.subst.loc8_54.2, %.loc8_83.3 [concrete] +// CHECK:STDOUT: %rewrite.loc15_23.2 = requirement_rewrite %impl.elem0.loc15_20.2, %.loc15_48.3 [concrete] +// CHECK:STDOUT: %rewrite.loc15_57.2 = requirement_rewrite %impl.elem0.subst.loc15_54.2, %.loc15_83.3 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -456,7 +463,7 @@ impl () as I where .X = {.a = true, .b = (1, 2)} and .X = {.a = false, .b = (3, // CHECK:STDOUT: !requires: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @empty_tuple.type.as..impl: %.loc8_7.2 as { +// CHECK:STDOUT: impl @empty_tuple.type.as..impl: %.loc15_7.2 as { // CHECK:STDOUT: !members: // CHECK:STDOUT: extend // CHECK:STDOUT: witness = diff --git a/toolchain/check/testdata/impl/impl_forall.carbon b/toolchain/check/testdata/impl/impl_forall.carbon index 41baeb3e396c..68231a281825 100644 --- a/toolchain/check/testdata/impl/impl_forall.carbon +++ b/toolchain/check/testdata/impl/impl_forall.carbon @@ -31,7 +31,11 @@ interface Y {} // The self type `T` is an `ErrorInst`, and when identifying the facet type // would get substituted into the `.Self`. -// CHECK:STDERR: fail_self_error.carbon:[[@LINE+2]]:17-23: error: name `Invalid` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_self_error.carbon:[[@LINE+6]]:17 +// CHECK:STDERR: -> │ impl forall [T: Invalid] T as Z where .Z1 impls Y {} +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: name `Invalid` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [T: Invalid] T as Z where .Z1 impls Y {} @@ -193,23 +197,23 @@ impl forall [T: Invalid] T as Z where .Z1 impls Y {} // CHECK:STDOUT: } { // CHECK:STDOUT: %T.ref: = name_ref T, %T [concrete = ] // CHECK:STDOUT: %Z.ref: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type] -// CHECK:STDOUT: %.Self.frozen.loc10_33: %Z.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen.7b7] +// CHECK:STDOUT: %.Self.frozen.loc14_33: %Z.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen.7b7] // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %Z.ref [concrete] -// CHECK:STDOUT: %.Self.ref: %Z.type = name_ref .Self, %.Self.frozen.loc10_33 [symbolic_self = constants.%.Self.frozen.7b7] +// CHECK:STDOUT: %.Self.ref: %Z.type = name_ref .Self, %.Self.frozen.loc14_33 [symbolic_self = constants.%.Self.frozen.7b7] // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc10_39: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc14_39: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.frozen.as_type] // CHECK:STDOUT: %Z1.ref: %Z.assoc_type = name_ref Z1, @Z1.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc10_39.1: type = impl_witness_access constants.%.db1, element0 [symbolic_self = constants.%impl.elem0.e1c] +// CHECK:STDOUT: %impl.elem0.loc14_39.1: type = impl_witness_access constants.%.db1, element0 [symbolic_self = constants.%impl.elem0.e1c] // CHECK:STDOUT: %Y.ref: type = name_ref Y, file.%Y.decl [concrete = constants.%Y.type] -// CHECK:STDOUT: %impls.loc10_43.1 = requirement_impls %impl.elem0.loc10_39.1, %Y.ref [concrete] -// CHECK:STDOUT: %impl.elem0.loc10_39.2: type = impl_witness_access constants.%.513, element0 [symbolic_self = constants.%impl.elem0.ff0] -// CHECK:STDOUT: %impls.loc10_43.2 = requirement_impls %impl.elem0.loc10_39.2, %Y.ref [concrete] -// CHECK:STDOUT: %.loc10_33: type = where_expr [concrete = constants.%Z_where.type] { +// CHECK:STDOUT: %impls.loc14_43.1 = requirement_impls %impl.elem0.loc14_39.1, %Y.ref [concrete] +// CHECK:STDOUT: %impl.elem0.loc14_39.2: type = impl_witness_access constants.%.513, element0 [symbolic_self = constants.%impl.elem0.ff0] +// CHECK:STDOUT: %impls.loc14_43.2 = requirement_impls %impl.elem0.loc14_39.2, %Y.ref [concrete] +// CHECK:STDOUT: %.loc14_33: type = where_expr [concrete = constants.%Z_where.type] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %Z.ref [concrete] -// CHECK:STDOUT: %impls.loc10_43.2 = requirement_impls %impl.elem0.loc10_39.2, %Y.ref [concrete] +// CHECK:STDOUT: %impls.loc14_43.2 = requirement_impls %impl.elem0.loc14_39.2, %Y.ref [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = splice_block [concrete = ] { -// CHECK:STDOUT: %.Self.frozen.loc10_15: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen.e58] +// CHECK:STDOUT: %.Self.frozen.loc14_15: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen.e58] // CHECK:STDOUT: %Invalid.ref: = name_ref Invalid, [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: %T: = symbolic_binding T, 0 [concrete = ] diff --git a/toolchain/check/testdata/impl/impl_self_as.carbon b/toolchain/check/testdata/impl/impl_self_as.carbon index 8d57e2f0bb28..ec26c6f78add 100644 --- a/toolchain/check/testdata/impl/impl_self_as.carbon +++ b/toolchain/check/testdata/impl/impl_self_as.carbon @@ -65,84 +65,156 @@ interface J6(T6: type) {} // `impl C as` should not match `impl Self as` or `impl as`. class C3 { - // CHECK:STDERR: fail_no_match.carbon:[[@LINE+2]]:3-16: error: impl declared but not defined [ImplMissingDefinition] + // CHECK:STDERR: ╭─┤ fail_no_match.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ impl C3 as I3; + // CHECK:STDERR: · ━━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: impl declared but not defined [ImplMissingDefinition] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl C3 as I3; impl as I3 {} - // CHECK:STDERR: fail_no_match.carbon:[[@LINE+2]]:3-16: error: impl declared but not defined [ImplMissingDefinition] + // CHECK:STDERR: ╭─┤ fail_no_match.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ impl C3 as I4; + // CHECK:STDERR: · ━━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: impl declared but not defined [ImplMissingDefinition] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl C3 as I4; impl Self as I4 {} - // CHECK:STDERR: fail_no_match.carbon:[[@LINE+2]]:3-13: error: impl declared but not defined [ImplMissingDefinition] + // CHECK:STDERR: ╭─┤ fail_no_match.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ impl as I5; + // CHECK:STDERR: · ━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: impl declared but not defined [ImplMissingDefinition] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl as I5; impl C3 as I5 {} - // CHECK:STDERR: fail_no_match.carbon:[[@LINE+2]]:3-18: error: impl declared but not defined [ImplMissingDefinition] + // CHECK:STDERR: ╭─┤ fail_no_match.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ impl Self as I6; + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: impl declared but not defined [ImplMissingDefinition] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl Self as I6; impl C3 as I6 {} - // CHECK:STDERR: fail_no_match.carbon:[[@LINE+2]]:3-38: error: impl declared but not defined [ImplMissingDefinition] + // CHECK:STDERR: ╭─┤ fail_no_match.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ impl forall [Z3: type] C3 as J3(Z3); + // CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: impl declared but not defined + // CHECK:STDERR: · ┃ [ImplMissingDefinition] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [Z3: type] C3 as J3(Z3); impl forall [Z3: type] as J3(Z3) {} - // CHECK:STDERR: fail_no_match.carbon:[[@LINE+2]]:3-38: error: impl declared but not defined [ImplMissingDefinition] + // CHECK:STDERR: ╭─┤ fail_no_match.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ impl forall [Z4: type] C3 as J4(Z4); + // CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: impl declared but not defined + // CHECK:STDERR: · ┃ [ImplMissingDefinition] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [Z4: type] C3 as J4(Z4); impl forall [Z4: type] Self as J4(Z4) {} - // CHECK:STDERR: fail_no_match.carbon:[[@LINE+2]]:3-35: error: impl declared but not defined [ImplMissingDefinition] + // CHECK:STDERR: ╭─┤ fail_no_match.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ impl forall [Z5: type] as J5(Z5); + // CHECK:STDERR: · ━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: impl declared but not defined + // CHECK:STDERR: · ┃ [ImplMissingDefinition] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [Z5: type] as J5(Z5); impl forall [Z5: type] C3 as J5(Z5) {} - // CHECK:STDERR: fail_no_match.carbon:[[@LINE+2]]:3-40: error: impl declared but not defined [ImplMissingDefinition] + // CHECK:STDERR: ╭─┤ fail_no_match.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ impl forall [Z6: type] Self as J6(Z6); + // CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: impl declared but not defined + // CHECK:STDERR: · ┃ [ImplMissingDefinition] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [Z6: type] Self as J6(Z6); impl forall [Z6: type] C3 as J6(Z6) {} } class C4(A: type) { - // CHECK:STDERR: fail_no_match.carbon:[[@LINE+2]]:3-19: error: impl declared but not defined [ImplMissingDefinition] + // CHECK:STDERR: ╭─┤ fail_no_match.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ impl C4(A) as I3; + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: impl declared but not defined [ImplMissingDefinition] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl C4(A) as I3; impl as I3 {} - // CHECK:STDERR: fail_no_match.carbon:[[@LINE+2]]:3-19: error: impl declared but not defined [ImplMissingDefinition] + // CHECK:STDERR: ╭─┤ fail_no_match.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ impl C4(A) as I4; + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: impl declared but not defined [ImplMissingDefinition] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl C4(A) as I4; impl Self as I4 {} - // CHECK:STDERR: fail_no_match.carbon:[[@LINE+2]]:3-13: error: impl declared but not defined [ImplMissingDefinition] + // CHECK:STDERR: ╭─┤ fail_no_match.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ impl as I5; + // CHECK:STDERR: · ━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: impl declared but not defined [ImplMissingDefinition] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl as I5; impl C4(A) as I5 {} - // CHECK:STDERR: fail_no_match.carbon:[[@LINE+2]]:3-18: error: impl declared but not defined [ImplMissingDefinition] + // CHECK:STDERR: ╭─┤ fail_no_match.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ impl Self as I6; + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: impl declared but not defined [ImplMissingDefinition] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl Self as I6; impl C4(A) as I6 {} - // CHECK:STDERR: fail_no_match.carbon:[[@LINE+2]]:3-41: error: impl declared but not defined [ImplMissingDefinition] + // CHECK:STDERR: ╭─┤ fail_no_match.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ impl forall [B3: type] C4(A) as J3(B3); + // CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: impl declared but not defined + // CHECK:STDERR: · ┃ [ImplMissingDefinition] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [B3: type] C4(A) as J3(B3); impl forall [B3: type] as J3(B3) {} - // CHECK:STDERR: fail_no_match.carbon:[[@LINE+2]]:3-41: error: impl declared but not defined [ImplMissingDefinition] + // CHECK:STDERR: ╭─┤ fail_no_match.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ impl forall [B4: type] C4(A) as J4(B4); + // CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: impl declared but not defined + // CHECK:STDERR: · ┃ [ImplMissingDefinition] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [B4: type] C4(A) as J4(B4); impl forall [B4: type] Self as J4(B4) {} - // CHECK:STDERR: fail_no_match.carbon:[[@LINE+2]]:3-35: error: impl declared but not defined [ImplMissingDefinition] + // CHECK:STDERR: ╭─┤ fail_no_match.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ impl forall [B5: type] as J5(B5); + // CHECK:STDERR: · ━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: impl declared but not defined + // CHECK:STDERR: · ┃ [ImplMissingDefinition] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [B5: type] as J5(B5); impl forall [B5: type] C4(A) as J5(B5) {} - // CHECK:STDERR: fail_no_match.carbon:[[@LINE+2]]:3-40: error: impl declared but not defined [ImplMissingDefinition] + // CHECK:STDERR: ╭─┤ fail_no_match.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ impl forall [B6: type] Self as J6(B6); + // CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: impl declared but not defined + // CHECK:STDERR: · ┃ [ImplMissingDefinition] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [B6: type] Self as J6(B6); impl forall [B6: type] C4(A) as J6(B6) {} diff --git a/toolchain/check/testdata/impl/impl_thunk.carbon b/toolchain/check/testdata/impl/impl_thunk.carbon index 0192348e8a9d..0f7b926b827c 100644 --- a/toolchain/check/testdata/impl/impl_thunk.carbon +++ b/toolchain/check/testdata/impl/impl_thunk.carbon @@ -154,9 +154,18 @@ interface X { impl A as X { //@dump-sem-ir-begin - // CHECK:STDERR: fail_inheritance_value_conversion_copy_return.carbon:[[@LINE+4]]:3-14: error: cannot copy value of type `A` [CopyOfUncopyableType] - // CHECK:STDERR: fail_inheritance_value_conversion_copy_return.carbon:[[@LINE+3]]:3-14: note: type `A` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: fail_inheritance_value_conversion_copy_return.carbon:[[@LINE-7]]:3-17: note: while building thunk to match the signature of this function [ThunkSignature] + // CHECK:STDERR: ╭─┤ fail_inheritance_value_conversion_copy_return.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn F() -> Self; + // CHECK:STDERR: · ───────┬─────── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ fn F() -> B; + // CHECK:STDERR: · ━━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot copy value of type `A` [CopyOfUncopyableType] + // CHECK:STDERR: · ╰────┤ type `A` does not implement interface `Core.Copy` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn F() -> B; //@dump-sem-ir-end @@ -174,10 +183,20 @@ class A {} class B {} impl A as I { - // CHECK:STDERR: fail_param_type_mismatch.carbon:[[@LINE+5]]:3-13: error: cannot implicitly convert expression of type `A` to `B` [ConversionFailure] - // CHECK:STDERR: fail_param_type_mismatch.carbon:[[@LINE+4]]:3-13: note: type `A` does not implement interface `Core.ImplicitAs(B)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: fail_param_type_mismatch.carbon:[[@LINE+3]]:8-11: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fail_param_type_mismatch.carbon:[[@LINE-10]]:3-16: note: while building thunk to match the signature of this function [ThunkSignature] + // CHECK:STDERR: ╭─┤ fail_param_type_mismatch.carbon:[[@LINE+15]]:3 + // CHECK:STDERR: │ fn F(a: Self); + // CHECK:STDERR: · ───────┬────── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ fn F(a: B); + // CHECK:STDERR: · ━━━━━┳━┯━━━ + // CHECK:STDERR: · ┗━━━━┫ error: cannot implicitly convert expression of type `A` to `B` + // CHECK:STDERR: · │ │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰──────┤ type `A` does not implement interface `Core.ImplicitAs(B)` + // CHECK:STDERR: · │ │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: · ╰──────┤ initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(a: B); } @@ -194,9 +213,19 @@ class A {} class B {} impl A as I { - // CHECK:STDERR: fail_return_mismatch.carbon:[[@LINE+4]]:3-14: error: cannot implicitly convert expression of type `B` to `A` [ConversionFailure] - // CHECK:STDERR: fail_return_mismatch.carbon:[[@LINE+3]]:3-14: note: type `B` does not implement interface `Core.ImplicitAs(A)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: fail_return_mismatch.carbon:[[@LINE-9]]:3-17: note: while building thunk to match the signature of this function [ThunkSignature] + // CHECK:STDERR: ╭─┤ fail_return_mismatch.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: │ fn F() -> Self; + // CHECK:STDERR: · ───────┬─────── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ fn F() -> B; + // CHECK:STDERR: · ━━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `B` to `A` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `B` does not implement interface `Core.ImplicitAs(A)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn F() -> B; } @@ -232,8 +261,17 @@ interface I { impl () as I { // TODO: The proposal says to reject this. But should we really do so? - // CHECK:STDERR: fail_return_empty_tuple_mismatch.carbon:[[@LINE+3]]:3-22: error: function redeclaration differs because return type is `()` [FunctionRedeclReturnTypeDiffers] - // CHECK:STDERR: fail_return_empty_tuple_mismatch.carbon:[[@LINE-6]]:3-16: note: previously declared with no return type [FunctionRedeclReturnTypePreviousNoReturn] + // CHECK:STDERR: ╭─┤ fail_return_empty_tuple_mismatch.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn NoReturn(); + // CHECK:STDERR: · ───────┬────── + // CHECK:STDERR: · ╰──┤ previously declared with no return type + // CHECK:STDERR: · │ [FunctionRedeclReturnTypePreviousNoReturn] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ fn NoReturn() -> (); + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: function redeclaration differs because return type is `()` + // CHECK:STDERR: · ┃ [FunctionRedeclReturnTypeDiffers] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn NoReturn() -> (); } @@ -241,14 +279,35 @@ impl () as I { class C {} impl C as I { - // CHECK:STDERR: fail_return_empty_tuple_mismatch.carbon:[[@LINE+3]]:3-21: error: function redeclaration differs because return type is `C` [FunctionRedeclReturnTypeDiffers] - // CHECK:STDERR: fail_return_empty_tuple_mismatch.carbon:[[@LINE-15]]:3-16: note: previously declared with no return type [FunctionRedeclReturnTypePreviousNoReturn] + // CHECK:STDERR: ╭─┤ fail_return_empty_tuple_mismatch.carbon:[[@LINE+25]]:3 + // CHECK:STDERR: │ fn NoReturn(); + // CHECK:STDERR: · ───────┬────── + // CHECK:STDERR: · ╰──┤ previously declared with no return type + // CHECK:STDERR: · │ [FunctionRedeclReturnTypePreviousNoReturn] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ fn NoReturn() -> C; + // CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: function redeclaration differs because return type is `C` + // CHECK:STDERR: · ┃ [FunctionRedeclReturnTypeDiffers] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: + // CHECK:STDERR: -> ╭─┤ fail_param_type_incomplete.carbon + // CHECK:STDERR: · ┗━━┫ error: parameter has incomplete type `B` in function definition + // CHECK:STDERR: · ┃ [IncompleteTypeInFunctionParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ class B; + // CHECK:STDERR: · ────┬─── + // CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ fn F(c: C); + // CHECK:STDERR: · ─────┬───── + // CHECK:STDERR: · ╰──┤ while building thunk calling this function [ThunkCallee] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn NoReturn() -> C; } // --- fail_param_type_incomplete.carbon -// CHECK:STDERR: fail_param_type_incomplete.carbon: error: parameter has incomplete type `B` in function definition [IncompleteTypeInFunctionParam] library "[[@TEST_NAME]]"; @@ -256,17 +315,24 @@ interface I(T: type) { fn F(a: T); } -// CHECK:STDERR: fail_param_type_incomplete.carbon:[[@LINE+1]]:1-8: note: class was forward declared here [ClassForwardDeclaredHere] class B; class C { impl as I(B) { - // CHECK:STDERR: fail_param_type_incomplete.carbon:[[@LINE+7]]:5-15: note: while building thunk calling this function [ThunkCallee] - // CHECK:STDERR: - // CHECK:STDERR: fail_param_type_incomplete.carbon:[[@LINE+5]]:5-15: error: cannot implicitly convert expression of type `B` to `C` [ConversionFailure] - // CHECK:STDERR: fail_param_type_incomplete.carbon:[[@LINE+4]]:5-15: note: type `B` does not implement interface `Core.ImplicitAs(C)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: fail_param_type_incomplete.carbon:[[@LINE+3]]:10-13: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fail_param_type_incomplete.carbon:[[@LINE-13]]:3-13: note: while building thunk to match the signature of this function [ThunkSignature] + // CHECK:STDERR: ╭─┤ fail_param_type_incomplete.carbon:[[@LINE+15]]:5 + // CHECK:STDERR: │ fn F(a: T); + // CHECK:STDERR: · ─────┬───── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ fn F(c: C); + // CHECK:STDERR: · ━━━━━┳━┯━━━ + // CHECK:STDERR: · ┗━━━━┫ error: cannot implicitly convert expression of type `B` to `C` + // CHECK:STDERR: · │ │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰──────┤ type `B` does not implement interface `Core.ImplicitAs(C)` + // CHECK:STDERR: · │ │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: · ╰──────┤ initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(c: C); } @@ -1032,23 +1098,23 @@ impl () as I({}) { // CHECK:STDOUT: %pattern_type.e39: type = pattern_type %B [concrete] // CHECK:STDOUT: %return.param_patt.934: %pattern_type.e39 = out_param_pattern [concrete] // CHECK:STDOUT: %return.patt.911: %pattern_type.e39 = return_slot_pattern %return.param_patt.934, %B [concrete] -// CHECK:STDOUT: %A.as.X.impl.F.type.48cdab.1: type = fn_type @A.as.X.impl.F.loc17_14.1 [concrete] +// CHECK:STDOUT: %A.as.X.impl.F.type.48cdab.1: type = fn_type @A.as.X.impl.F.loc26_14.1 [concrete] // CHECK:STDOUT: %A.as.X.impl.F.bd5be1.1: %A.as.X.impl.F.type.48cdab.1 = struct_value () [concrete] // CHECK:STDOUT: %X.facet: %X.type = facet_value %A, (%X.impl_witness) [concrete] -// CHECK:STDOUT: %A.as.X.impl.F.type.48cdab.2: type = fn_type @A.as.X.impl.F.loc17_14.2 [concrete] +// CHECK:STDOUT: %A.as.X.impl.F.type.48cdab.2: type = fn_type @A.as.X.impl.F.loc26_14.2 [concrete] // CHECK:STDOUT: %A.as.X.impl.F.bd5be1.2: %A.as.X.impl.F.type.48cdab.2 = struct_value () [concrete] // CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] // CHECK:STDOUT: %SubobjectDestroy.type: type = facet_type <@SubobjectDestroy> [concrete] // CHECK:STDOUT: %T.09f: %SubobjectDestroy.type = symbolic_binding T, 0 [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.type.dea: type = fn_type @T.as_type.as.DestroyImpl.impl.Op, @T.as_type.as.DestroyImpl.impl(%T.09f) [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.6e5: %T.as_type.as.DestroyImpl.impl.Op.type.dea = struct_value () [symbolic] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.2: type = fn_type @SubobjectDestroy.WithSelf.Op.loc17_14.2 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.2: type = fn_type @SubobjectDestroy.WithSelf.Op.loc26_14.2 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.2: %SubobjectDestroy.WithSelf.Op.type.6870fd.2 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80ef6.2: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.2), @SubobjectDestroy [concrete] // CHECK:STDOUT: %SubobjectDestroy.facet.9bf: %SubobjectDestroy.type = facet_value %A, (%custom_witness.b80ef6.2) [concrete] // CHECK:STDOUT: %DestroyImpl.impl_witness.6d1: = impl_witness imports.%DestroyImpl.impl_witness_table, @T.as_type.as.DestroyImpl.impl(%SubobjectDestroy.facet.9bf) [concrete] // CHECK:STDOUT: %Destroy.facet.35e: %Destroy.type = facet_value %A, (%DestroyImpl.impl_witness.6d1, %custom_witness.b80ef6.2) [concrete] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.4: type = fn_type @SubobjectDestroy.WithSelf.Op.loc17_14.4 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.4: type = fn_type @SubobjectDestroy.WithSelf.Op.loc26_14.4 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.4: %SubobjectDestroy.WithSelf.Op.type.6870fd.4 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80ef6.4: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.4), @SubobjectDestroy [concrete] // CHECK:STDOUT: %SubobjectDestroy.facet.92e: %SubobjectDestroy.type = facet_value %B, (%custom_witness.b80ef6.4) [concrete] @@ -1062,17 +1128,17 @@ impl () as I({}) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @A.as.X.impl: %A.ref as %X.ref { -// CHECK:STDOUT: %A.as.X.impl.F.decl.loc17_14.1: %A.as.X.impl.F.type.48cdab.1 = fn_decl @A.as.X.impl.F.loc17_14.1 [concrete = constants.%A.as.X.impl.F.bd5be1.1] { +// CHECK:STDOUT: %A.as.X.impl.F.decl.loc26_14.1: %A.as.X.impl.F.type.48cdab.1 = fn_decl @A.as.X.impl.F.loc26_14.1 [concrete = constants.%A.as.X.impl.F.bd5be1.1] { // CHECK:STDOUT: %return.param_patt: %pattern_type.e39 = out_param_pattern [concrete = constants.%return.param_patt.934] // CHECK:STDOUT: %return.patt: %pattern_type.e39 = return_slot_pattern %return.param_patt, %B.ref [concrete = constants.%return.patt.911] // CHECK:STDOUT: } { // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B] -// CHECK:STDOUT: %.loc17: Core.Form = init_form %B.ref [concrete = constants.%.d83] +// CHECK:STDOUT: %.loc26: Core.Form = init_form %B.ref [concrete = constants.%.d83] // CHECK:STDOUT: %return.param: ref %B = out_param call_param0 // CHECK:STDOUT: %return: ref %B = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: %A.as.X.impl.F.decl.loc17_14.2: %A.as.X.impl.F.type.48cdab.2 = fn_decl @A.as.X.impl.F.loc17_14.2 [concrete = constants.%A.as.X.impl.F.bd5be1.2] { +// CHECK:STDOUT: %A.as.X.impl.F.decl.loc26_14.2: %A.as.X.impl.F.type.48cdab.2 = fn_decl @A.as.X.impl.F.loc26_14.2 [concrete = constants.%A.as.X.impl.F.bd5be1.2] { // CHECK:STDOUT: // CHECK:STDOUT: } { // CHECK:STDOUT: @@ -1081,57 +1147,57 @@ impl () as I({}) { // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .B = -// CHECK:STDOUT: .F = %A.as.X.impl.F.decl.loc17_14.1 +// CHECK:STDOUT: .F = %A.as.X.impl.F.decl.loc26_14.1 // CHECK:STDOUT: extend %X.ref // CHECK:STDOUT: witness = %X.impl_witness // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @A.as.X.impl.F.loc17_14.1() -> out %return.param: %B; +// CHECK:STDOUT: fn @A.as.X.impl.F.loc26_14.1() -> out %return.param: %B; // CHECK:STDOUT: -// CHECK:STDOUT: fn @A.as.X.impl.F.loc17_14.2() -> out %return.param: %A [thunk @A.as.X.impl.%A.as.X.impl.F.decl.loc17_14.1 for @X.WithSelf.%X.WithSelf.F.decl, @X.WithSelf.F(constants.%X.facet)] { +// CHECK:STDOUT: fn @A.as.X.impl.F.loc26_14.2() -> out %return.param: %A [thunk @A.as.X.impl.%A.as.X.impl.F.decl.loc26_14.1 for @X.WithSelf.%X.WithSelf.F.decl, @X.WithSelf.F(constants.%X.facet)] { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: %A.as.X.impl.F.type.48cdab.1 = name_ref F, @A.as.X.impl.%A.as.X.impl.F.decl.loc17_14.1 [concrete = constants.%A.as.X.impl.F.bd5be1.1] -// CHECK:STDOUT: %.loc17_14.1: ref %B = temporary_storage -// CHECK:STDOUT: %A.as.X.impl.F.call: init %B to %.loc17_14.1 = call %F.ref() -// CHECK:STDOUT: %.loc17_14.2: ref %B = temporary %.loc17_14.1, %A.as.X.impl.F.call -// CHECK:STDOUT: %.loc17_14.3: ref %A = class_element_access %.loc17_14.2, element0 -// CHECK:STDOUT: %.loc17_14.4: ref %A = converted %A.as.X.impl.F.call, %.loc17_14.3 -// CHECK:STDOUT: %.loc17_14.5: %A = acquire_value %.loc17_14.4 -// CHECK:STDOUT: %Destroy.facet.loc17_14.1: %Destroy.type = facet_value constants.%B, (constants.%DestroyImpl.impl_witness.131, constants.%custom_witness.b80ef6.4) [concrete = constants.%Destroy.facet.09e] -// CHECK:STDOUT: %.loc17_14.6: %Destroy.type = converted constants.%B, %Destroy.facet.loc17_14.1 [concrete = constants.%Destroy.facet.09e] -// CHECK:STDOUT: %Destroy.facet.loc17_14.2: %Destroy.type = facet_value constants.%B, (constants.%DestroyImpl.impl_witness.131, constants.%custom_witness.b80ef6.4) [concrete = constants.%Destroy.facet.09e] -// CHECK:STDOUT: %.loc17_14.7: %Destroy.type = converted constants.%B, %Destroy.facet.loc17_14.2 [concrete = constants.%Destroy.facet.09e] +// CHECK:STDOUT: %F.ref: %A.as.X.impl.F.type.48cdab.1 = name_ref F, @A.as.X.impl.%A.as.X.impl.F.decl.loc26_14.1 [concrete = constants.%A.as.X.impl.F.bd5be1.1] +// CHECK:STDOUT: %.loc26_14.1: ref %B = temporary_storage +// CHECK:STDOUT: %A.as.X.impl.F.call: init %B to %.loc26_14.1 = call %F.ref() +// CHECK:STDOUT: %.loc26_14.2: ref %B = temporary %.loc26_14.1, %A.as.X.impl.F.call +// CHECK:STDOUT: %.loc26_14.3: ref %A = class_element_access %.loc26_14.2, element0 +// CHECK:STDOUT: %.loc26_14.4: ref %A = converted %A.as.X.impl.F.call, %.loc26_14.3 +// CHECK:STDOUT: %.loc26_14.5: %A = acquire_value %.loc26_14.4 +// CHECK:STDOUT: %Destroy.facet.loc26_14.1: %Destroy.type = facet_value constants.%B, (constants.%DestroyImpl.impl_witness.131, constants.%custom_witness.b80ef6.4) [concrete = constants.%Destroy.facet.09e] +// CHECK:STDOUT: %.loc26_14.6: %Destroy.type = converted constants.%B, %Destroy.facet.loc26_14.1 [concrete = constants.%Destroy.facet.09e] +// CHECK:STDOUT: %Destroy.facet.loc26_14.2: %Destroy.type = facet_value constants.%B, (constants.%DestroyImpl.impl_witness.131, constants.%custom_witness.b80ef6.4) [concrete = constants.%Destroy.facet.09e] +// CHECK:STDOUT: %.loc26_14.7: %Destroy.type = converted constants.%B, %Destroy.facet.loc26_14.2 [concrete = constants.%Destroy.facet.09e] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc17_14.2) +// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc26_14.2) // CHECK:STDOUT: return to %return.param // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc17_14.1(%self.param: ref %empty_struct_type) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc26_14.1(%self.param: ref %empty_struct_type) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc17_14.2(%self.param: ref %A) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc26_14.2(%self.param: ref %A) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc17_14.3(%self.param: ref %struct_type.base.cb7) { +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc26_14.3(%self.param: ref %struct_type.base.cb7) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc17_14.1: ref %A = struct_access %self.param, element0 -// CHECK:STDOUT: %Destroy.facet.loc17_14.1: %Destroy.type = facet_value constants.%A, (constants.%DestroyImpl.impl_witness.6d1, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.35e] -// CHECK:STDOUT: %.loc17_14.2: %Destroy.type = converted constants.%A, %Destroy.facet.loc17_14.1 [concrete = constants.%Destroy.facet.35e] -// CHECK:STDOUT: %Destroy.facet.loc17_14.2: %Destroy.type = facet_value constants.%A, (constants.%DestroyImpl.impl_witness.6d1, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.35e] -// CHECK:STDOUT: %.loc17_14.3: %Destroy.type = converted constants.%A, %Destroy.facet.loc17_14.2 [concrete = constants.%Destroy.facet.35e] +// CHECK:STDOUT: %.loc26_14.1: ref %A = struct_access %self.param, element0 +// CHECK:STDOUT: %Destroy.facet.loc26_14.1: %Destroy.type = facet_value constants.%A, (constants.%DestroyImpl.impl_witness.6d1, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.35e] +// CHECK:STDOUT: %.loc26_14.2: %Destroy.type = converted constants.%A, %Destroy.facet.loc26_14.1 [concrete = constants.%Destroy.facet.35e] +// CHECK:STDOUT: %Destroy.facet.loc26_14.2: %Destroy.type = facet_value constants.%A, (constants.%DestroyImpl.impl_witness.6d1, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.35e] +// CHECK:STDOUT: %.loc26_14.3: %Destroy.type = converted constants.%A, %Destroy.facet.loc26_14.2 [concrete = constants.%Destroy.facet.35e] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc17_14.1) +// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc26_14.1) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc17_14.4(%self.param: ref %B) { +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc26_14.4(%self.param: ref %B) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %base.ref: %B.elem = name_ref base, @B.%.loc5 [concrete = @B.%.loc5] -// CHECK:STDOUT: %.loc17_14.1: ref %A = class_element_access %self.param, element0 -// CHECK:STDOUT: %Destroy.facet.loc17_14.1: %Destroy.type = facet_value constants.%A, (constants.%DestroyImpl.impl_witness.6d1, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.35e] -// CHECK:STDOUT: %.loc17_14.2: %Destroy.type = converted constants.%A, %Destroy.facet.loc17_14.1 [concrete = constants.%Destroy.facet.35e] -// CHECK:STDOUT: %Destroy.facet.loc17_14.2: %Destroy.type = facet_value constants.%A, (constants.%DestroyImpl.impl_witness.6d1, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.35e] -// CHECK:STDOUT: %.loc17_14.3: %Destroy.type = converted constants.%A, %Destroy.facet.loc17_14.2 [concrete = constants.%Destroy.facet.35e] +// CHECK:STDOUT: %.loc26_14.1: ref %A = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.facet.loc26_14.1: %Destroy.type = facet_value constants.%A, (constants.%DestroyImpl.impl_witness.6d1, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.35e] +// CHECK:STDOUT: %.loc26_14.2: %Destroy.type = converted constants.%A, %Destroy.facet.loc26_14.1 [concrete = constants.%Destroy.facet.35e] +// CHECK:STDOUT: %Destroy.facet.loc26_14.2: %Destroy.type = facet_value constants.%A, (constants.%DestroyImpl.impl_witness.6d1, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.35e] +// CHECK:STDOUT: %.loc26_14.3: %Destroy.type = converted constants.%A, %Destroy.facet.loc26_14.2 [concrete = constants.%Destroy.facet.35e] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc17_14.1) +// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc26_14.1) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/impl_thunk_min_prelude.carbon b/toolchain/check/testdata/impl/impl_thunk_min_prelude.carbon index e5e3bdbe35df..8e6640e7d234 100644 --- a/toolchain/check/testdata/impl/impl_thunk_min_prelude.carbon +++ b/toolchain/check/testdata/impl/impl_thunk_min_prelude.carbon @@ -51,8 +51,14 @@ interface OpWith(U: type) { } impl forall [T: type, U: Core.ImplicitAs(Wrap(T))] Wrap(T) as OpWith(U) { - // CHECK:STDERR: fail_todo_out_of_line_thunk.carbon:[[@LINE+3]]:3-27: error: use of undefined generic function [MissingGenericFunctionDefinition] - // CHECK:STDERR: fail_todo_out_of_line_thunk.carbon:[[@LINE+2]]:3-27: note: generic function declared here [MissingGenericFunctionDefinitionHere] + // CHECK:STDERR: ╭─┤ fail_todo_out_of_line_thunk.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ fn Op(self, other: Self); + // CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: use of undefined generic function + // CHECK:STDERR: · │ ┃ [MissingGenericFunctionDefinition] + // CHECK:STDERR: · ╰────┤ generic function declared here + // CHECK:STDERR: · │ [MissingGenericFunctionDefinitionHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn Op(self, other: Self); } diff --git a/toolchain/check/testdata/impl/impl_where_redecl.carbon b/toolchain/check/testdata/impl/impl_where_redecl.carbon index c693e612c8e8..004090671024 100644 --- a/toolchain/check/testdata/impl/impl_where_redecl.carbon +++ b/toolchain/check/testdata/impl/impl_where_redecl.carbon @@ -18,17 +18,30 @@ library "[[@TEST_NAME]]"; interface I { let T: type; } constraint N(U: type) {} -// CHECK:STDERR: fail_match_with_associated_type.carbon:[[@LINE+2]]:1-27: error: impl declared but not defined [ImplMissingDefinition] +// CHECK:STDERR: ╭─┤ fail_match_with_associated_type.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ impl () as I where .T = {}; +// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: impl declared but not defined [ImplMissingDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as I where .T = {}; impl () as I where .T = {} and .T impls N(.Self) {} -// CHECK:STDERR: fail_match_with_associated_type.carbon:[[@LINE+2]]:1-13: error: impl declared but not defined [ImplMissingDefinition] +// CHECK:STDERR: ╭─┤ fail_match_with_associated_type.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ impl {} as I; +// CHECK:STDERR: · ━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: impl declared but not defined [ImplMissingDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl {} as I; impl {} as I where .T = {} and .T impls N(.Self) {} -// CHECK:STDERR: fail_match_with_associated_type.carbon:[[@LINE+2]]:1-52: error: impl declared but not defined [ImplMissingDefinition] +// CHECK:STDERR: ╭─┤ fail_match_with_associated_type.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ impl ({},) as I where .T = {} and .T impls N(.Self); +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: impl declared but not defined +// CHECK:STDERR: · ┃ [ImplMissingDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl ({},) as I where .T = {} and .T impls N(.Self); impl ({},) as I where .T = {} {} @@ -39,12 +52,21 @@ library "[[@TEST_NAME]]"; interface J {} constraint N {} -// CHECK:STDERR: fail_match_with_empty_interface.carbon:[[@LINE+2]]:1-13: error: impl declared but not defined [ImplMissingDefinition] +// CHECK:STDERR: ╭─┤ fail_match_with_empty_interface.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ impl () as J; +// CHECK:STDERR: · ━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: impl declared but not defined [ImplMissingDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as J; impl () as J where .Self impls type and .Self impls N {} -// CHECK:STDERR: fail_match_with_empty_interface.carbon:[[@LINE+2]]:1-54: error: impl declared but not defined [ImplMissingDefinition] +// CHECK:STDERR: ╭─┤ fail_match_with_empty_interface.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ impl {} as J where .Self impls type and .Self impls N; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: impl declared but not defined +// CHECK:STDERR: · ┃ [ImplMissingDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl {} as J where .Self impls type and .Self impls N; impl {} as J {} @@ -54,7 +76,12 @@ library "[[@TEST_NAME]]"; interface K {} -// CHECK:STDERR: fail_parens_other_nesting.carbon:[[@LINE+2]]:1-61: error: impl declared but not defined [ImplMissingDefinition] +// CHECK:STDERR: ╭─┤ fail_parens_other_nesting.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ impl {} as (K where .Self impls type) where .Self impls type; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: impl declared but not defined +// CHECK:STDERR: · ┃ [ImplMissingDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl {} as (K where .Self impls type) where .Self impls type; impl {} as (K where .Self impls type) {} @@ -64,7 +91,12 @@ library "[[@TEST_NAME]]"; interface L {} -// CHECK:STDERR: fail_other_nesting.carbon:[[@LINE+2]]:1-61: error: impl declared but not defined [ImplMissingDefinition] +// CHECK:STDERR: ╭─┤ fail_other_nesting.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ impl () as (L where .Self impls type) where .Self impls type; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: impl declared but not defined +// CHECK:STDERR: · ┃ [ImplMissingDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as (L where .Self impls type) where .Self impls type; impl () as L {} diff --git a/toolchain/check/testdata/impl/import_compound.carbon b/toolchain/check/testdata/impl/import_compound.carbon index 0db6e339a4b8..274c0de127eb 100644 --- a/toolchain/check/testdata/impl/import_compound.carbon +++ b/toolchain/check/testdata/impl/import_compound.carbon @@ -46,8 +46,16 @@ library "[[@TEST_NAME]]"; import library "lib"; fn NonInstanceCallImportFail(n: {.i: ()}) { - // CHECK:STDERR: fail_import_non-instance.carbon:[[@LINE+3]]:3-19: error: cannot implicitly convert non-type value of type `{.i: ()}` into type implementing `NonInstance` [ConversionFailureNonTypeToFacet] - // CHECK:STDERR: fail_import_non-instance.carbon:[[@LINE+2]]:3-19: note: type `{.i: ()}` does not implement interface `Core.ImplicitAs(NonInstance)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_import_non-instance.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: -> │ n.(NonInstance.F)(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert non-type value of type `{.i: ()}` into + // CHECK:STDERR: · │ ┃ type implementing `NonInstance` + // CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: · ╰────┤ type `{.i: ()}` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(NonInstance)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: n.(NonInstance.F)(); } @@ -58,8 +66,16 @@ library "[[@TEST_NAME]]"; import library "lib"; fn NonInstanceCallIndirectImport(p: {.i: ()}*) { - // CHECK:STDERR: fail_import_non-instance_indirect.carbon:[[@LINE+3]]:3-20: error: cannot implicitly convert non-type value of type `{.i: ()}` into type implementing `NonInstance` [ConversionFailureNonTypeToFacet] - // CHECK:STDERR: fail_import_non-instance_indirect.carbon:[[@LINE+2]]:3-20: note: type `{.i: ()}` does not implement interface `Core.ImplicitAs(NonInstance)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_import_non-instance_indirect.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: -> │ p->(NonInstance.F)(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert non-type value of type `{.i: ()}` into + // CHECK:STDERR: · │ ┃ type implementing `NonInstance` + // CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: · ╰────┤ type `{.i: ()}` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(NonInstance)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: p->(NonInstance.F)(); } @@ -83,7 +99,13 @@ library "[[@TEST_NAME]]"; import library "lib"; fn InstanceCallImportFail() { - // CHECK:STDERR: fail_import_instance.carbon:[[@LINE+2]]:3-23: error: cannot access member of interface `Instance` in type `type` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_import_instance.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ {.i: ()}.(Instance.G)(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Instance` in type `type` that + // CHECK:STDERR: · ┃ does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: {.i: ()}.(Instance.G)(); } @@ -487,7 +509,7 @@ fn InstanceCallImportFail() { // CHECK:STDOUT: %n.ref: %struct_type.i = name_ref n, %n // CHECK:STDOUT: %NonInstance.ref: type = name_ref NonInstance, imports.%Main.NonInstance [concrete = constants.%NonInstance.type] // CHECK:STDOUT: %F.ref: %NonInstance.assoc_type = name_ref F, imports.%Main.import_ref.12d [concrete = constants.%assoc0.dae] -// CHECK:STDOUT: %.loc9: %NonInstance.type = converted %n.ref, [concrete = ] +// CHECK:STDOUT: %.loc17: %NonInstance.type = converted %n.ref, [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -581,8 +603,8 @@ fn InstanceCallImportFail() { // CHECK:STDOUT: %p.ref: %ptr = name_ref p, %p // CHECK:STDOUT: %NonInstance.ref: type = name_ref NonInstance, imports.%Main.NonInstance [concrete = constants.%NonInstance.type] // CHECK:STDOUT: %F.ref: %NonInstance.assoc_type = name_ref F, imports.%Main.import_ref.12d [concrete = constants.%assoc0.dae] -// CHECK:STDOUT: %.loc9_4.1: ref %struct_type.i = deref %p.ref -// CHECK:STDOUT: %.loc9_4.2: %NonInstance.type = converted %.loc9_4.1, [concrete = ] +// CHECK:STDOUT: %.loc17_4.1: ref %struct_type.i = deref %p.ref +// CHECK:STDOUT: %.loc17_4.2: %NonInstance.type = converted %.loc17_4.1, [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -835,8 +857,8 @@ fn InstanceCallImportFail() { // CHECK:STDOUT: // CHECK:STDOUT: fn @InstanceCallImportFail() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8_9.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_9.2: type = converted %.loc8_9.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc14_9.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc14_9.2: type = converted %.loc14_9.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: %struct_type.i: type = struct_type {.i: %empty_tuple.type} [concrete = constants.%struct_type.i] // CHECK:STDOUT: %Instance.ref: type = name_ref Instance, imports.%Main.Instance [concrete = constants.%Instance.type] // CHECK:STDOUT: %G.ref: %Instance.assoc_type = name_ref G, imports.%Main.import_ref.437 [concrete = constants.%assoc0] diff --git a/toolchain/check/testdata/impl/import_generic.carbon b/toolchain/check/testdata/impl/import_generic.carbon index 56100849431c..64e7acc1eb71 100644 --- a/toolchain/check/testdata/impl/import_generic.carbon +++ b/toolchain/check/testdata/impl/import_generic.carbon @@ -66,26 +66,50 @@ constraint N(T: type) { impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_import_generic.impl.carbon:[[@LINE+2]]:1-32: error: redeclaration of imported impl [RedeclImportedImpl] +// CHECK:STDERR: ╭─┤ fail_import_generic.impl.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ impl forall [T: type] C as I(T); +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of imported impl [RedeclImportedImpl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [T: type] C as I(T); -// CHECK:STDERR: fail_import_generic.impl.carbon:[[@LINE+2]]:1-33: error: redeclaration of imported impl [RedeclImportedImpl] +// CHECK:STDERR: ╭─┤ fail_import_generic.impl.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ impl forall [T: type] C as I(T) {} +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of imported impl [RedeclImportedImpl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [T: type] C as I(T) {} -// CHECK:STDERR: fail_import_generic.impl.carbon:[[@LINE+2]]:1-33: error: redeclaration of imported impl [RedeclImportedImpl] +// CHECK:STDERR: ╭─┤ fail_import_generic.impl.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ impl forall [T: type] C as I(T*); +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of imported impl [RedeclImportedImpl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [T: type] C as I(T*); -// CHECK:STDERR: fail_import_generic.impl.carbon:[[@LINE+2]]:1-34: error: redeclaration of imported impl [RedeclImportedImpl] +// CHECK:STDERR: ╭─┤ fail_import_generic.impl.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ impl forall [T: type] C as I(T*) {} +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of imported impl [RedeclImportedImpl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [T: type] C as I(T*) {} -// CHECK:STDERR: fail_import_generic.impl.carbon:[[@LINE+2]]:1-32: error: redeclaration of imported impl [RedeclImportedImpl] +// CHECK:STDERR: ╭─┤ fail_import_generic.impl.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ impl forall [T: type] C as N(T); +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of imported impl [RedeclImportedImpl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [T: type] C as N(T); -// CHECK:STDERR: fail_import_generic.impl.carbon:[[@LINE+2]]:1-33: error: redeclaration of imported impl [RedeclImportedImpl] +// CHECK:STDERR: ╭─┤ fail_import_generic.impl.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ impl forall [T: type] C as N(T*); +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of imported impl [RedeclImportedImpl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [T: type] C as N(T*); @@ -121,11 +145,21 @@ constraint N(T: type) { extend require impls J(T); } -// CHECK:STDERR: fail_import_generic_decl.carbon:[[@LINE+2]]:1-32: error: impl declared but not defined [ImplMissingDefinition] +// CHECK:STDERR: ╭─┤ fail_import_generic_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ impl forall [T: type] D as J(T); +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: impl declared but not defined +// CHECK:STDERR: · ┃ [ImplMissingDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [T: type] D as J(T); -// CHECK:STDERR: fail_import_generic_decl.carbon:[[@LINE+2]]:1-33: error: impl declared but not defined [ImplMissingDefinition] +// CHECK:STDERR: ╭─┤ fail_import_generic_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ impl forall [T: type] D as J(T*); +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: impl declared but not defined +// CHECK:STDERR: · ┃ [ImplMissingDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [T: type] D as J(T*); @@ -133,27 +167,51 @@ impl forall [T: type] D as J(T*); impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_import_generic_decl.impl.carbon:[[@LINE+2]]:1-32: error: redeclaration of imported impl [RedeclImportedImpl] +// CHECK:STDERR: ╭─┤ fail_import_generic_decl.impl.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ impl forall [T: type] D as J(T); +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of imported impl [RedeclImportedImpl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [T: type] D as J(T); -// CHECK:STDERR: fail_import_generic_decl.impl.carbon:[[@LINE+2]]:1-33: error: redeclaration of imported impl [RedeclImportedImpl] +// CHECK:STDERR: ╭─┤ fail_import_generic_decl.impl.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ impl forall [T: type] D as J(T) {} +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of imported impl [RedeclImportedImpl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [T: type] D as J(T) {} -// CHECK:STDERR: fail_import_generic_decl.impl.carbon:[[@LINE+2]]:1-33: error: redeclaration of imported impl [RedeclImportedImpl] +// CHECK:STDERR: ╭─┤ fail_import_generic_decl.impl.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ impl forall [T: type] D as J(T*); +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of imported impl [RedeclImportedImpl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [T: type] D as J(T*); -// CHECK:STDERR: fail_import_generic_decl.impl.carbon:[[@LINE+2]]:1-34: error: redeclaration of imported impl [RedeclImportedImpl] +// CHECK:STDERR: ╭─┤ fail_import_generic_decl.impl.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ impl forall [T: type] D as J(T*) {} +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of imported impl [RedeclImportedImpl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [T: type] D as J(T*) {} -// CHECK:STDERR: fail_import_generic_decl.impl.carbon:[[@LINE+2]]:1-33: error: redeclaration of imported impl [RedeclImportedImpl] +// CHECK:STDERR: ╭─┤ fail_import_generic_decl.impl.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ impl forall [T: type] D as N(T) {} +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of imported impl [RedeclImportedImpl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [T: type] D as N(T) {} -// CHECK:STDERR: fail_import_generic_decl.impl.carbon:[[@LINE+2]]:1-34: error: redeclaration of imported impl [RedeclImportedImpl] +// CHECK:STDERR: ╭─┤ fail_import_generic_decl.impl.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ impl forall [T: type] D as N(T*) {} +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of imported impl [RedeclImportedImpl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [T: type] D as N(T*) {} @@ -1247,20 +1305,6 @@ impl forall [T: type] D as N(T*) {} // CHECK:STDOUT: %default.import.loc2_30.1 = import // CHECK:STDOUT: %default.import.loc2_30.2 = import // CHECK:STDOUT: impl_decl @C.as.I.impl.4a876a.1 [concrete] { -// CHECK:STDOUT: %T.patt.loc6_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_15.2 (constants.%T.patt)] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [concrete = constants.%C] -// CHECK:STDOUT: %I.ref: %I.type.335 = name_ref I, imports.%Main.I [concrete = constants.%I.generic] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc6_15.1 [symbolic = %T.loc6_15.2 (constants.%T)] -// CHECK:STDOUT: %I.type.loc6_31.1: type = facet_type <@I, @I(constants.%T)> [symbolic = %I.type.loc6_31.2 (constants.%I.type.184)] -// CHECK:STDOUT: %.loc6_17.1: type = splice_block %.loc6_17.2 [concrete = type] { -// CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc6_17.2: type = type_literal type [concrete = type] -// CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc6_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc6_15.2 (constants.%T)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %.loc6: = impl_self_witness @C.as.I.impl.4a876a.1.%C.ref, @I, @I(constants.%T) [symbolic = @C.as.I.impl.4a876a.1.%.loc6_32 (constants.%.855)] -// CHECK:STDOUT: impl_decl @C.as.I.impl.4a876a.2 [concrete] { // CHECK:STDOUT: %T.patt.loc10_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc10_15.2 (constants.%T.patt)] // CHECK:STDOUT: } { // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [concrete = constants.%C] @@ -1273,66 +1317,80 @@ impl forall [T: type] D as N(T*) {} // CHECK:STDOUT: } // CHECK:STDOUT: %T.loc10_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc10_15.2 (constants.%T)] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc10: = impl_self_witness @C.as.I.impl.4a876a.2.%C.ref, @I, @I(constants.%T) [symbolic = @C.as.I.impl.4a876a.2.%.loc10_33 (constants.%.855)] -// CHECK:STDOUT: impl_decl @C.as.I.impl.aa9e57.1 [concrete] { -// CHECK:STDOUT: %T.patt.loc14_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc14_15.2 (constants.%T.patt)] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [concrete = constants.%C] -// CHECK:STDOUT: %I.ref: %I.type.335 = name_ref I, imports.%Main.I [concrete = constants.%I.generic] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc14_15.1 [symbolic = %T.loc14_15.2 (constants.%T)] -// CHECK:STDOUT: %ptr.loc14_31.1: type = ptr_type %T.ref [symbolic = %ptr.loc14_31.2 (constants.%ptr)] -// CHECK:STDOUT: %I.type.loc14_32.1: type = facet_type <@I, @I(constants.%ptr)> [symbolic = %I.type.loc14_32.2 (constants.%I.type.751)] -// CHECK:STDOUT: %.loc14_17.1: type = splice_block %.loc14_17.2 [concrete = type] { -// CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc14_17.2: type = type_literal type [concrete = type] -// CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc14_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc14_15.2 (constants.%T)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %.loc14: = impl_self_witness @C.as.I.impl.aa9e57.1.%C.ref, @I, @I(constants.%ptr) [symbolic = @C.as.I.impl.aa9e57.1.%.loc14_33 (constants.%.f39)] -// CHECK:STDOUT: impl_decl @C.as.I.impl.aa9e57.2 [concrete] { +// CHECK:STDOUT: %.loc10: = impl_self_witness @C.as.I.impl.4a876a.1.%C.ref, @I, @I(constants.%T) [symbolic = @C.as.I.impl.4a876a.1.%.loc10_32 (constants.%.855)] +// CHECK:STDOUT: impl_decl @C.as.I.impl.4a876a.2 [concrete] { // CHECK:STDOUT: %T.patt.loc18_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc18_15.2 (constants.%T.patt)] // CHECK:STDOUT: } { // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [concrete = constants.%C] // CHECK:STDOUT: %I.ref: %I.type.335 = name_ref I, imports.%Main.I [concrete = constants.%I.generic] // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc18_15.1 [symbolic = %T.loc18_15.2 (constants.%T)] -// CHECK:STDOUT: %ptr.loc18_31.1: type = ptr_type %T.ref [symbolic = %ptr.loc18_31.2 (constants.%ptr)] -// CHECK:STDOUT: %I.type.loc18_32.1: type = facet_type <@I, @I(constants.%ptr)> [symbolic = %I.type.loc18_32.2 (constants.%I.type.751)] +// CHECK:STDOUT: %I.type.loc18_31.1: type = facet_type <@I, @I(constants.%T)> [symbolic = %I.type.loc18_31.2 (constants.%I.type.184)] // CHECK:STDOUT: %.loc18_17.1: type = splice_block %.loc18_17.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %.loc18_17.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } // CHECK:STDOUT: %T.loc18_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc18_15.2 (constants.%T)] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc18: = impl_self_witness @C.as.I.impl.aa9e57.2.%C.ref, @I, @I(constants.%ptr) [symbolic = @C.as.I.impl.aa9e57.2.%.loc18_34 (constants.%.f39)] +// CHECK:STDOUT: %.loc18: = impl_self_witness @C.as.I.impl.4a876a.2.%C.ref, @I, @I(constants.%T) [symbolic = @C.as.I.impl.4a876a.2.%.loc18_33 (constants.%.855)] +// CHECK:STDOUT: impl_decl @C.as.I.impl.aa9e57.1 [concrete] { +// CHECK:STDOUT: %T.patt.loc26_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc26_15.2 (constants.%T.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [concrete = constants.%C] +// CHECK:STDOUT: %I.ref: %I.type.335 = name_ref I, imports.%Main.I [concrete = constants.%I.generic] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc26_15.1 [symbolic = %T.loc26_15.2 (constants.%T)] +// CHECK:STDOUT: %ptr.loc26_31.1: type = ptr_type %T.ref [symbolic = %ptr.loc26_31.2 (constants.%ptr)] +// CHECK:STDOUT: %I.type.loc26_32.1: type = facet_type <@I, @I(constants.%ptr)> [symbolic = %I.type.loc26_32.2 (constants.%I.type.751)] +// CHECK:STDOUT: %.loc26_17.1: type = splice_block %.loc26_17.2 [concrete = type] { +// CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc26_17.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: } +// CHECK:STDOUT: %T.loc26_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc26_15.2 (constants.%T)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %.loc26: = impl_self_witness @C.as.I.impl.aa9e57.1.%C.ref, @I, @I(constants.%ptr) [symbolic = @C.as.I.impl.aa9e57.1.%.loc26_33 (constants.%.f39)] +// CHECK:STDOUT: impl_decl @C.as.I.impl.aa9e57.2 [concrete] { +// CHECK:STDOUT: %T.patt.loc34_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc34_15.2 (constants.%T.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [concrete = constants.%C] +// CHECK:STDOUT: %I.ref: %I.type.335 = name_ref I, imports.%Main.I [concrete = constants.%I.generic] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc34_15.1 [symbolic = %T.loc34_15.2 (constants.%T)] +// CHECK:STDOUT: %ptr.loc34_31.1: type = ptr_type %T.ref [symbolic = %ptr.loc34_31.2 (constants.%ptr)] +// CHECK:STDOUT: %I.type.loc34_32.1: type = facet_type <@I, @I(constants.%ptr)> [symbolic = %I.type.loc34_32.2 (constants.%I.type.751)] +// CHECK:STDOUT: %.loc34_17.1: type = splice_block %.loc34_17.2 [concrete = type] { +// CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc34_17.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: } +// CHECK:STDOUT: %T.loc34_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc34_15.2 (constants.%T)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %.loc34: = impl_self_witness @C.as.I.impl.aa9e57.2.%C.ref, @I, @I(constants.%ptr) [symbolic = @C.as.I.impl.aa9e57.2.%.loc34_34 (constants.%.f39)] // CHECK:STDOUT: impl_decl @C.as.I.impl.042f52.1 [concrete] { -// CHECK:STDOUT: %T.patt.loc22_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc22_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.patt.loc42_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc42_15.2 (constants.%T.patt)] // CHECK:STDOUT: } { // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [concrete = constants.%C] // CHECK:STDOUT: %N.ref: %N.type.b76 = name_ref N, imports.%Main.N [concrete = constants.%empty_struct] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc22_15.1 [symbolic = %T.loc22_15.2 (constants.%T)] -// CHECK:STDOUT: %N.type.loc22_31.1: type = facet_type <@N, @N(constants.%T)> [symbolic = %N.type.loc22_31.2 (constants.%N.type.d682d6.1)] -// CHECK:STDOUT: %.loc22_17.1: type = splice_block %.loc22_17.2 [concrete = type] { +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc42_15.1 [symbolic = %T.loc42_15.2 (constants.%T)] +// CHECK:STDOUT: %N.type.loc42_31.1: type = facet_type <@N, @N(constants.%T)> [symbolic = %N.type.loc42_31.2 (constants.%N.type.d682d6.1)] +// CHECK:STDOUT: %.loc42_17.1: type = splice_block %.loc42_17.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc22_17.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc42_17.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc22_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc22_15.2 (constants.%T)] +// CHECK:STDOUT: %T.loc42_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc42_15.2 (constants.%T)] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc22: = impl_self_witness @C.as.I.impl.042f52.1.%C.ref, @I, @I(constants.%T) [symbolic = @C.as.I.impl.042f52.1.%.loc22_32 (constants.%.855)] +// CHECK:STDOUT: %.loc42: = impl_self_witness @C.as.I.impl.042f52.1.%C.ref, @I, @I(constants.%T) [symbolic = @C.as.I.impl.042f52.1.%.loc42_32 (constants.%.855)] // CHECK:STDOUT: impl_decl @C.as.I.impl.042f52.2 [concrete] { -// CHECK:STDOUT: %T.patt.loc25_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc25_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.patt.loc49_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc49_15.2 (constants.%T.patt)] // CHECK:STDOUT: } { // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [concrete = constants.%C] // CHECK:STDOUT: %N.ref: %N.type.b76 = name_ref N, imports.%Main.N [concrete = constants.%empty_struct] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc25_15.1 [symbolic = %T.loc25_15.2 (constants.%T)] -// CHECK:STDOUT: %ptr.loc25_31.1: type = ptr_type %T.ref [symbolic = %ptr.loc25_31.2 (constants.%ptr)] -// CHECK:STDOUT: %N.type.loc25_32.1: type = facet_type <@N, @N(constants.%ptr)> [symbolic = %N.type.loc25_32.2 (constants.%N.type.d682d6.3)] -// CHECK:STDOUT: %.loc25_17.1: type = splice_block %.loc25_17.2 [concrete = type] { +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc49_15.1 [symbolic = %T.loc49_15.2 (constants.%T)] +// CHECK:STDOUT: %ptr.loc49_31.1: type = ptr_type %T.ref [symbolic = %ptr.loc49_31.2 (constants.%ptr)] +// CHECK:STDOUT: %N.type.loc49_32.1: type = facet_type <@N, @N(constants.%ptr)> [symbolic = %N.type.loc49_32.2 (constants.%N.type.d682d6.3)] +// CHECK:STDOUT: %.loc49_17.1: type = splice_block %.loc49_17.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc25_17.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc49_17.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc25_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc25_15.2 (constants.%T)] +// CHECK:STDOUT: %T.loc49_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc49_15.2 (constants.%T)] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc25: = impl_self_witness @C.as.I.impl.042f52.2.%C.ref, @I, @I(constants.%ptr) [symbolic = @C.as.I.impl.042f52.2.%.loc25_33 (constants.%.f39)] +// CHECK:STDOUT: %.loc49: = impl_self_witness @C.as.I.impl.042f52.2.%C.ref, @I, @I(constants.%ptr) [symbolic = @C.as.I.impl.042f52.2.%.loc49_33 (constants.%.f39)] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic interface @I(imports.%Main.import_ref.b3bc94.2: type) [from "import_generic.carbon"] { @@ -1415,73 +1473,73 @@ impl forall [T: type] D as N(T*) {} // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic impl @C.as.I.impl.4a876a.1(%T.loc6_15.1: type) { -// CHECK:STDOUT: %T.patt.loc6_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_15.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc6_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc6_15.2 (constants.%T)] -// CHECK:STDOUT: %I.type.loc6_31.2: type = facet_type <@I, @I(%T.loc6_15.2)> [symbolic = %I.type.loc6_31.2 (constants.%I.type.184)] -// CHECK:STDOUT: %.loc6_32: = impl_self_witness constants.%C, @I, @I(%T.loc6_15.2) [symbolic = %.loc6_32 (constants.%.855)] -// CHECK:STDOUT: -// CHECK:STDOUT: impl: %C.ref as %I.type.loc6_31.1; -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic impl @C.as.I.impl.4a876a.2(%T.loc10_15.1: type) { +// CHECK:STDOUT: generic impl @C.as.I.impl.4a876a.1(%T.loc10_15.1: type) { // CHECK:STDOUT: %T.patt.loc10_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc10_15.2 (constants.%T.patt)] // CHECK:STDOUT: %T.loc10_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc10_15.2 (constants.%T)] // CHECK:STDOUT: %I.type.loc10_31.2: type = facet_type <@I, @I(%T.loc10_15.2)> [symbolic = %I.type.loc10_31.2 (constants.%I.type.184)] -// CHECK:STDOUT: %.loc10_33: = impl_self_witness constants.%C, @I, @I(%T.loc10_15.2) [symbolic = %.loc10_33 (constants.%.855)] +// CHECK:STDOUT: %.loc10_32: = impl_self_witness constants.%C, @I, @I(%T.loc10_15.2) [symbolic = %.loc10_32 (constants.%.855)] // CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: -// CHECK:STDOUT: impl: %C.ref as %I.type.loc10_31.1 { -// CHECK:STDOUT: !members: -// CHECK:STDOUT: extend %I.type.loc10_31.1 -// CHECK:STDOUT: witness = -// CHECK:STDOUT: } +// CHECK:STDOUT: impl: %C.ref as %I.type.loc10_31.1; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic impl @C.as.I.impl.aa9e57.1(%T.loc14_15.1: type) { -// CHECK:STDOUT: %T.patt.loc14_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc14_15.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc14_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc14_15.2 (constants.%T)] -// CHECK:STDOUT: %ptr.loc14_31.2: type = ptr_type %T.loc14_15.2 [symbolic = %ptr.loc14_31.2 (constants.%ptr)] -// CHECK:STDOUT: %I.type.loc14_32.2: type = facet_type <@I, @I(%ptr.loc14_31.2)> [symbolic = %I.type.loc14_32.2 (constants.%I.type.751)] -// CHECK:STDOUT: %.loc14_33: = impl_self_witness constants.%C, @I, @I(%ptr.loc14_31.2) [symbolic = %.loc14_33 (constants.%.f39)] -// CHECK:STDOUT: -// CHECK:STDOUT: impl: %C.ref as %I.type.loc14_32.1; -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic impl @C.as.I.impl.aa9e57.2(%T.loc18_15.1: type) { +// CHECK:STDOUT: generic impl @C.as.I.impl.4a876a.2(%T.loc18_15.1: type) { // CHECK:STDOUT: %T.patt.loc18_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc18_15.2 (constants.%T.patt)] // CHECK:STDOUT: %T.loc18_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc18_15.2 (constants.%T)] -// CHECK:STDOUT: %ptr.loc18_31.2: type = ptr_type %T.loc18_15.2 [symbolic = %ptr.loc18_31.2 (constants.%ptr)] -// CHECK:STDOUT: %I.type.loc18_32.2: type = facet_type <@I, @I(%ptr.loc18_31.2)> [symbolic = %I.type.loc18_32.2 (constants.%I.type.751)] -// CHECK:STDOUT: %.loc18_34: = impl_self_witness constants.%C, @I, @I(%ptr.loc18_31.2) [symbolic = %.loc18_34 (constants.%.f39)] +// CHECK:STDOUT: %I.type.loc18_31.2: type = facet_type <@I, @I(%T.loc18_15.2)> [symbolic = %I.type.loc18_31.2 (constants.%I.type.184)] +// CHECK:STDOUT: %.loc18_33: = impl_self_witness constants.%C, @I, @I(%T.loc18_15.2) [symbolic = %.loc18_33 (constants.%.855)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: -// CHECK:STDOUT: impl: %C.ref as %I.type.loc18_32.1 { +// CHECK:STDOUT: impl: %C.ref as %I.type.loc18_31.1 { // CHECK:STDOUT: !members: -// CHECK:STDOUT: extend %I.type.loc18_32.1 +// CHECK:STDOUT: extend %I.type.loc18_31.1 // CHECK:STDOUT: witness = // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic impl @C.as.I.impl.042f52.1(%T.loc22_15.1: type) { -// CHECK:STDOUT: %T.patt.loc22_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc22_15.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc22_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc22_15.2 (constants.%T)] -// CHECK:STDOUT: %N.type.loc22_31.2: type = facet_type <@N, @N(%T.loc22_15.2)> [symbolic = %N.type.loc22_31.2 (constants.%N.type.d682d6.1)] -// CHECK:STDOUT: %.loc22_32: = impl_self_witness constants.%C, @I, @I(%T.loc22_15.2) [symbolic = %.loc22_32 (constants.%.855)] +// CHECK:STDOUT: generic impl @C.as.I.impl.aa9e57.1(%T.loc26_15.1: type) { +// CHECK:STDOUT: %T.patt.loc26_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc26_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc26_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc26_15.2 (constants.%T)] +// CHECK:STDOUT: %ptr.loc26_31.2: type = ptr_type %T.loc26_15.2 [symbolic = %ptr.loc26_31.2 (constants.%ptr)] +// CHECK:STDOUT: %I.type.loc26_32.2: type = facet_type <@I, @I(%ptr.loc26_31.2)> [symbolic = %I.type.loc26_32.2 (constants.%I.type.751)] +// CHECK:STDOUT: %.loc26_33: = impl_self_witness constants.%C, @I, @I(%ptr.loc26_31.2) [symbolic = %.loc26_33 (constants.%.f39)] // CHECK:STDOUT: -// CHECK:STDOUT: impl: %C.ref as %N.type.loc22_31.1; +// CHECK:STDOUT: impl: %C.ref as %I.type.loc26_32.1; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic impl @C.as.I.impl.042f52.2(%T.loc25_15.1: type) { -// CHECK:STDOUT: %T.patt.loc25_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc25_15.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc25_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc25_15.2 (constants.%T)] -// CHECK:STDOUT: %ptr.loc25_31.2: type = ptr_type %T.loc25_15.2 [symbolic = %ptr.loc25_31.2 (constants.%ptr)] -// CHECK:STDOUT: %N.type.loc25_32.2: type = facet_type <@N, @N(%ptr.loc25_31.2)> [symbolic = %N.type.loc25_32.2 (constants.%N.type.d682d6.3)] -// CHECK:STDOUT: %.loc25_33: = impl_self_witness constants.%C, @I, @I(%ptr.loc25_31.2) [symbolic = %.loc25_33 (constants.%.f39)] +// CHECK:STDOUT: generic impl @C.as.I.impl.aa9e57.2(%T.loc34_15.1: type) { +// CHECK:STDOUT: %T.patt.loc34_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc34_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc34_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc34_15.2 (constants.%T)] +// CHECK:STDOUT: %ptr.loc34_31.2: type = ptr_type %T.loc34_15.2 [symbolic = %ptr.loc34_31.2 (constants.%ptr)] +// CHECK:STDOUT: %I.type.loc34_32.2: type = facet_type <@I, @I(%ptr.loc34_31.2)> [symbolic = %I.type.loc34_32.2 (constants.%I.type.751)] +// CHECK:STDOUT: %.loc34_34: = impl_self_witness constants.%C, @I, @I(%ptr.loc34_31.2) [symbolic = %.loc34_34 (constants.%.f39)] // CHECK:STDOUT: -// CHECK:STDOUT: impl: %C.ref as %N.type.loc25_32.1; +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: impl: %C.ref as %I.type.loc34_32.1 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: extend %I.type.loc34_32.1 +// CHECK:STDOUT: witness = +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @C.as.I.impl.042f52.1(%T.loc42_15.1: type) { +// CHECK:STDOUT: %T.patt.loc42_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc42_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc42_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc42_15.2 (constants.%T)] +// CHECK:STDOUT: %N.type.loc42_31.2: type = facet_type <@N, @N(%T.loc42_15.2)> [symbolic = %N.type.loc42_31.2 (constants.%N.type.d682d6.1)] +// CHECK:STDOUT: %.loc42_32: = impl_self_witness constants.%C, @I, @I(%T.loc42_15.2) [symbolic = %.loc42_32 (constants.%.855)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: %C.ref as %N.type.loc42_31.1; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @C.as.I.impl.042f52.2(%T.loc49_15.1: type) { +// CHECK:STDOUT: %T.patt.loc49_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc49_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc49_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc49_15.2 (constants.%T)] +// CHECK:STDOUT: %ptr.loc49_31.2: type = ptr_type %T.loc49_15.2 [symbolic = %ptr.loc49_31.2 (constants.%ptr)] +// CHECK:STDOUT: %N.type.loc49_32.2: type = facet_type <@N, @N(%ptr.loc49_31.2)> [symbolic = %N.type.loc49_32.2 (constants.%N.type.d682d6.3)] +// CHECK:STDOUT: %.loc49_33: = impl_self_witness constants.%C, @I, @I(%ptr.loc49_31.2) [symbolic = %.loc49_33 (constants.%.f39)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: %C.ref as %N.type.loc49_32.1; // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C [from "import_generic.carbon"] { @@ -1531,33 +1589,33 @@ impl forall [T: type] D as N(T*) {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @C.as.I.impl.4a876a.1(constants.%T) { -// CHECK:STDOUT: %T.patt.loc6_15.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc6_15.2 => constants.%T -// CHECK:STDOUT: %I.type.loc6_31.2 => constants.%I.type.184 -// CHECK:STDOUT: %.loc6_32 => constants.%.855 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @C.as.I.impl.4a876a.2(constants.%T) { // CHECK:STDOUT: %T.patt.loc10_15.2 => constants.%T.patt // CHECK:STDOUT: %T.loc10_15.2 => constants.%T // CHECK:STDOUT: %I.type.loc10_31.2 => constants.%I.type.184 -// CHECK:STDOUT: %.loc10_33 => constants.%.855 +// CHECK:STDOUT: %.loc10_32 => constants.%.855 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @C.as.I.impl.4a876a.2(constants.%T) { +// CHECK:STDOUT: %T.patt.loc18_15.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc18_15.2 => constants.%T +// CHECK:STDOUT: %I.type.loc18_31.2 => constants.%I.type.184 +// CHECK:STDOUT: %.loc18_33 => constants.%.855 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @C.as.I.impl.aa9e57.1(constants.%T) { -// CHECK:STDOUT: %T.patt.loc14_15.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc14_15.2 => constants.%T -// CHECK:STDOUT: %ptr.loc14_31.2 => constants.%ptr -// CHECK:STDOUT: %I.type.loc14_32.2 => constants.%I.type.751 -// CHECK:STDOUT: %.loc14_33 => constants.%.f39 +// CHECK:STDOUT: %T.patt.loc26_15.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc26_15.2 => constants.%T +// CHECK:STDOUT: %ptr.loc26_31.2 => constants.%ptr +// CHECK:STDOUT: %I.type.loc26_32.2 => constants.%I.type.751 +// CHECK:STDOUT: %.loc26_33 => constants.%.f39 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @C.as.I.impl.aa9e57.2(constants.%T) { -// CHECK:STDOUT: %T.patt.loc18_15.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc18_15.2 => constants.%T -// CHECK:STDOUT: %ptr.loc18_31.2 => constants.%ptr -// CHECK:STDOUT: %I.type.loc18_32.2 => constants.%I.type.751 -// CHECK:STDOUT: %.loc18_34 => constants.%.f39 +// CHECK:STDOUT: %T.patt.loc34_15.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc34_15.2 => constants.%T +// CHECK:STDOUT: %ptr.loc34_31.2 => constants.%ptr +// CHECK:STDOUT: %I.type.loc34_32.2 => constants.%I.type.751 +// CHECK:STDOUT: %.loc34_34 => constants.%.f39 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @N(constants.%T) { @@ -1601,10 +1659,10 @@ impl forall [T: type] D as N(T*) {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @C.as.I.impl.042f52.1(constants.%T) { -// CHECK:STDOUT: %T.patt.loc22_15.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc22_15.2 => constants.%T -// CHECK:STDOUT: %N.type.loc22_31.2 => constants.%N.type.d682d6.1 -// CHECK:STDOUT: %.loc22_32 => constants.%.855 +// CHECK:STDOUT: %T.patt.loc42_15.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc42_15.2 => constants.%T +// CHECK:STDOUT: %N.type.loc42_31.2 => constants.%N.type.d682d6.1 +// CHECK:STDOUT: %.loc42_32 => constants.%.855 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @N(constants.%ptr) { @@ -1638,11 +1696,11 @@ impl forall [T: type] D as N(T*) {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @C.as.I.impl.042f52.2(constants.%T) { -// CHECK:STDOUT: %T.patt.loc25_15.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc25_15.2 => constants.%T -// CHECK:STDOUT: %ptr.loc25_31.2 => constants.%ptr -// CHECK:STDOUT: %N.type.loc25_32.2 => constants.%N.type.d682d6.3 -// CHECK:STDOUT: %.loc25_33 => constants.%.f39 +// CHECK:STDOUT: %T.patt.loc49_15.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc49_15.2 => constants.%T +// CHECK:STDOUT: %ptr.loc49_31.2 => constants.%ptr +// CHECK:STDOUT: %N.type.loc49_32.2 => constants.%N.type.d682d6.3 +// CHECK:STDOUT: %.loc49_33 => constants.%.f39 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- import_generic_with_different_specific.carbon @@ -2243,34 +2301,34 @@ impl forall [T: type] D as N(T*) {} // CHECK:STDOUT: %T.loc7_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc7_15.1 (constants.%T)] // CHECK:STDOUT: } // CHECK:STDOUT: impl_decl @D.as.J.impl.7ed [concrete] { -// CHECK:STDOUT: %T.patt.loc13_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc13_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.patt.loc18_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc18_15.2 (constants.%T.patt)] // CHECK:STDOUT: } { // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [concrete = constants.%D] // CHECK:STDOUT: %J.ref: %J.type.23c = name_ref J, file.%J.decl [concrete = constants.%J.generic] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc13_15.1 [symbolic = %T.loc13_15.2 (constants.%T)] -// CHECK:STDOUT: %J.type.loc13_31.1: type = facet_type <@J, @J(constants.%T)> [symbolic = %J.type.loc13_31.2 (constants.%J.type.ed5)] -// CHECK:STDOUT: %.loc13_17.1: type = splice_block %.loc13_17.2 [concrete = type] { +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc18_15.1 [symbolic = %T.loc18_15.2 (constants.%T)] +// CHECK:STDOUT: %J.type.loc18_31.1: type = facet_type <@J, @J(constants.%T)> [symbolic = %J.type.loc18_31.2 (constants.%J.type.ed5)] +// CHECK:STDOUT: %.loc18_17.1: type = splice_block %.loc18_17.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc13_17.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc18_17.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc13_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc13_15.2 (constants.%T)] +// CHECK:STDOUT: %T.loc18_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc18_15.2 (constants.%T)] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc13: = impl_self_witness @D.as.J.impl.7ed.%D.ref, @J, @J(constants.%T) [symbolic = @D.as.J.impl.7ed.%.loc13_32 (constants.%.c85)] +// CHECK:STDOUT: %.loc18: = impl_self_witness @D.as.J.impl.7ed.%D.ref, @J, @J(constants.%T) [symbolic = @D.as.J.impl.7ed.%.loc18_32 (constants.%.c85)] // CHECK:STDOUT: impl_decl @D.as.J.impl.68b [concrete] { -// CHECK:STDOUT: %T.patt.loc17_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc17_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.patt.loc27_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc27_15.2 (constants.%T.patt)] // CHECK:STDOUT: } { // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [concrete = constants.%D] // CHECK:STDOUT: %J.ref: %J.type.23c = name_ref J, file.%J.decl [concrete = constants.%J.generic] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc17_15.1 [symbolic = %T.loc17_15.2 (constants.%T)] -// CHECK:STDOUT: %ptr.loc17_31.1: type = ptr_type %T.ref [symbolic = %ptr.loc17_31.2 (constants.%ptr)] -// CHECK:STDOUT: %J.type.loc17_32.1: type = facet_type <@J, @J(constants.%ptr)> [symbolic = %J.type.loc17_32.2 (constants.%J.type.a41)] -// CHECK:STDOUT: %.loc17_17.1: type = splice_block %.loc17_17.2 [concrete = type] { +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc27_15.1 [symbolic = %T.loc27_15.2 (constants.%T)] +// CHECK:STDOUT: %ptr.loc27_31.1: type = ptr_type %T.ref [symbolic = %ptr.loc27_31.2 (constants.%ptr)] +// CHECK:STDOUT: %J.type.loc27_32.1: type = facet_type <@J, @J(constants.%ptr)> [symbolic = %J.type.loc27_32.2 (constants.%J.type.a41)] +// CHECK:STDOUT: %.loc27_17.1: type = splice_block %.loc27_17.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc17_17.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc27_17.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc17_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc17_15.2 (constants.%T)] +// CHECK:STDOUT: %T.loc27_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc27_15.2 (constants.%T)] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc17: = impl_self_witness @D.as.J.impl.68b.%D.ref, @J, @J(constants.%ptr) [symbolic = @D.as.J.impl.68b.%.loc17_33 (constants.%.d76)] +// CHECK:STDOUT: %.loc27: = impl_self_witness @D.as.J.impl.68b.%D.ref, @J, @J(constants.%ptr) [symbolic = @D.as.J.impl.68b.%.loc27_33 (constants.%.d76)] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic interface @J(%T.loc5_14.2: type) { @@ -2340,25 +2398,25 @@ impl forall [T: type] D as N(T*) {} // CHECK:STDOUT: %J.type.loc8_27.2: type = facet_type <@J, @J(%T)> [symbolic = %J.type.loc8_27.2 (constants.%J.type.ed5)] // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic impl @D.as.J.impl.7ed(%T.loc13_15.1: type) { -// CHECK:STDOUT: %T.patt.loc13_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc13_15.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc13_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc13_15.2 (constants.%T)] -// CHECK:STDOUT: %J.type.loc13_31.2: type = facet_type <@J, @J(%T.loc13_15.2)> [symbolic = %J.type.loc13_31.2 (constants.%J.type.ed5)] -// CHECK:STDOUT: %.loc13_32: = impl_self_witness constants.%D, @J, @J(%T.loc13_15.2) [symbolic = %.loc13_32 (constants.%.c85)] -// CHECK:STDOUT: %J.impl_witness.loc13_32.2: = impl_witness %J.impl_witness_table, @D.as.J.impl.7ed(%T.loc13_15.2) [symbolic = %J.impl_witness.loc13_32.2 (constants.%J.impl_witness.dfb)] +// CHECK:STDOUT: generic impl @D.as.J.impl.7ed(%T.loc18_15.1: type) { +// CHECK:STDOUT: %T.patt.loc18_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc18_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc18_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc18_15.2 (constants.%T)] +// CHECK:STDOUT: %J.type.loc18_31.2: type = facet_type <@J, @J(%T.loc18_15.2)> [symbolic = %J.type.loc18_31.2 (constants.%J.type.ed5)] +// CHECK:STDOUT: %.loc18_32: = impl_self_witness constants.%D, @J, @J(%T.loc18_15.2) [symbolic = %.loc18_32 (constants.%.c85)] +// CHECK:STDOUT: %J.impl_witness.loc18_32.2: = impl_witness %J.impl_witness_table, @D.as.J.impl.7ed(%T.loc18_15.2) [symbolic = %J.impl_witness.loc18_32.2 (constants.%J.impl_witness.dfb)] // CHECK:STDOUT: -// CHECK:STDOUT: impl: %D.ref as %J.type.loc13_31.1; +// CHECK:STDOUT: impl: %D.ref as %J.type.loc18_31.1; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic impl @D.as.J.impl.68b(%T.loc17_15.1: type) { -// CHECK:STDOUT: %T.patt.loc17_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc17_15.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc17_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc17_15.2 (constants.%T)] -// CHECK:STDOUT: %ptr.loc17_31.2: type = ptr_type %T.loc17_15.2 [symbolic = %ptr.loc17_31.2 (constants.%ptr)] -// CHECK:STDOUT: %J.type.loc17_32.2: type = facet_type <@J, @J(%ptr.loc17_31.2)> [symbolic = %J.type.loc17_32.2 (constants.%J.type.a41)] -// CHECK:STDOUT: %.loc17_33: = impl_self_witness constants.%D, @J, @J(%ptr.loc17_31.2) [symbolic = %.loc17_33 (constants.%.d76)] -// CHECK:STDOUT: %J.impl_witness.loc17_33.2: = impl_witness %J.impl_witness_table, @D.as.J.impl.68b(%T.loc17_15.2) [symbolic = %J.impl_witness.loc17_33.2 (constants.%J.impl_witness.ac6)] +// CHECK:STDOUT: generic impl @D.as.J.impl.68b(%T.loc27_15.1: type) { +// CHECK:STDOUT: %T.patt.loc27_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc27_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc27_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc27_15.2 (constants.%T)] +// CHECK:STDOUT: %ptr.loc27_31.2: type = ptr_type %T.loc27_15.2 [symbolic = %ptr.loc27_31.2 (constants.%ptr)] +// CHECK:STDOUT: %J.type.loc27_32.2: type = facet_type <@J, @J(%ptr.loc27_31.2)> [symbolic = %J.type.loc27_32.2 (constants.%J.type.a41)] +// CHECK:STDOUT: %.loc27_33: = impl_self_witness constants.%D, @J, @J(%ptr.loc27_31.2) [symbolic = %.loc27_33 (constants.%.d76)] +// CHECK:STDOUT: %J.impl_witness.loc27_33.2: = impl_witness %J.impl_witness_table, @D.as.J.impl.68b(%T.loc27_15.2) [symbolic = %J.impl_witness.loc27_33.2 (constants.%J.impl_witness.ac6)] // CHECK:STDOUT: -// CHECK:STDOUT: impl: %D.ref as %J.type.loc17_32.1; +// CHECK:STDOUT: impl: %D.ref as %J.type.loc27_32.1; // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @D { @@ -2398,11 +2456,11 @@ impl forall [T: type] D as N(T*) {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @D.as.J.impl.7ed(constants.%T) { -// CHECK:STDOUT: %T.patt.loc13_15.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc13_15.2 => constants.%T -// CHECK:STDOUT: %J.type.loc13_31.2 => constants.%J.type.ed5 -// CHECK:STDOUT: %.loc13_32 => constants.%.c85 -// CHECK:STDOUT: %J.impl_witness.loc13_32.2 => constants.%J.impl_witness.dfb +// CHECK:STDOUT: %T.patt.loc18_15.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc18_15.2 => constants.%T +// CHECK:STDOUT: %J.type.loc18_31.2 => constants.%J.type.ed5 +// CHECK:STDOUT: %.loc18_32 => constants.%.c85 +// CHECK:STDOUT: %J.impl_witness.loc18_32.2 => constants.%J.impl_witness.dfb // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @J(constants.%ptr) { @@ -2411,12 +2469,12 @@ impl forall [T: type] D as N(T*) {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @D.as.J.impl.68b(constants.%T) { -// CHECK:STDOUT: %T.patt.loc17_15.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc17_15.2 => constants.%T -// CHECK:STDOUT: %ptr.loc17_31.2 => constants.%ptr -// CHECK:STDOUT: %J.type.loc17_32.2 => constants.%J.type.a41 -// CHECK:STDOUT: %.loc17_33 => constants.%.d76 -// CHECK:STDOUT: %J.impl_witness.loc17_33.2 => constants.%J.impl_witness.ac6 +// CHECK:STDOUT: %T.patt.loc27_15.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc27_15.2 => constants.%T +// CHECK:STDOUT: %ptr.loc27_31.2 => constants.%ptr +// CHECK:STDOUT: %J.type.loc27_32.2 => constants.%J.type.a41 +// CHECK:STDOUT: %.loc27_33 => constants.%.d76 +// CHECK:STDOUT: %J.impl_witness.loc27_33.2 => constants.%J.impl_witness.ac6 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_import_generic_decl.impl.carbon @@ -2463,13 +2521,13 @@ impl forall [T: type] D as N(T*) {} // CHECK:STDOUT: %Main.import_ref.8f2: = import_ref Main//import_generic_decl, loc4_10, loaded [concrete = constants.%complete_type] // CHECK:STDOUT: %Main.import_ref.54a = import_ref Main//import_generic_decl, inst{{[0-9A-F]+}} [no loc], unloaded // CHECK:STDOUT: %J.impl_witness_table.9fc = impl_witness_table (), @D.as.J.impl.0c9 [concrete] -// CHECK:STDOUT: %Main.import_ref.2e2cf0.1: type = import_ref Main//import_generic_decl, loc13_23, loaded [concrete = constants.%D] -// CHECK:STDOUT: %Main.import_ref.babd8d.1: type = import_ref Main//import_generic_decl, loc13_31, loaded [symbolic = @D.as.J.impl.0c9.%J.type (constants.%J.type.ed5)] -// CHECK:STDOUT: %Main.import_ref.b3bc94.3: type = import_ref Main//import_generic_decl, loc13_15, loaded [symbolic = @D.as.J.impl.0c9.%T (constants.%T)] +// CHECK:STDOUT: %Main.import_ref.2e2cf0.1: type = import_ref Main//import_generic_decl, loc18_23, loaded [concrete = constants.%D] +// CHECK:STDOUT: %Main.import_ref.babd8d.1: type = import_ref Main//import_generic_decl, loc18_31, loaded [symbolic = @D.as.J.impl.0c9.%J.type (constants.%J.type.ed5)] +// CHECK:STDOUT: %Main.import_ref.b3bc94.3: type = import_ref Main//import_generic_decl, loc18_15, loaded [symbolic = @D.as.J.impl.0c9.%T (constants.%T)] // CHECK:STDOUT: %J.impl_witness_table.8f0 = impl_witness_table (), @D.as.J.impl.26a [concrete] -// CHECK:STDOUT: %Main.import_ref.2e2cf0.2: type = import_ref Main//import_generic_decl, loc17_23, loaded [concrete = constants.%D] -// CHECK:STDOUT: %Main.import_ref.19d: type = import_ref Main//import_generic_decl, loc17_32, loaded [symbolic = @D.as.J.impl.26a.%J.type (constants.%J.type.a41)] -// CHECK:STDOUT: %Main.import_ref.b3bc94.4: type = import_ref Main//import_generic_decl, loc17_15, loaded [symbolic = @D.as.J.impl.26a.%T (constants.%T)] +// CHECK:STDOUT: %Main.import_ref.2e2cf0.2: type = import_ref Main//import_generic_decl, loc27_23, loaded [concrete = constants.%D] +// CHECK:STDOUT: %Main.import_ref.19d: type = import_ref Main//import_generic_decl, loc27_32, loaded [symbolic = @D.as.J.impl.26a.%J.type (constants.%J.type.a41)] +// CHECK:STDOUT: %Main.import_ref.b3bc94.4: type = import_ref Main//import_generic_decl, loc27_15, loaded [symbolic = @D.as.J.impl.26a.%T (constants.%T)] // CHECK:STDOUT: %Main.import_ref.af3 = import_ref Main//import_generic_decl, loc8_28, unloaded // CHECK:STDOUT: %Main.import_ref.849: type = import_ref Main//import_generic_decl, loc8_18, loaded [symbolic = @N.WithSelf.Self.as_type.impls.J.type.require.%Self.as_type (constants.%Self.as_type)] // CHECK:STDOUT: %Main.import_ref.babd8d.2: type = import_ref Main//import_generic_decl, loc8_27, loaded [symbolic = @N.WithSelf.Self.as_type.impls.J.type.require.%J.type (constants.%J.type.ed5)] @@ -2488,20 +2546,6 @@ impl forall [T: type] D as N(T*) {} // CHECK:STDOUT: %default.import.loc2_35.1 = import // CHECK:STDOUT: %default.import.loc2_35.2 = import // CHECK:STDOUT: impl_decl @D.as.J.impl.7edb40.1 [concrete] { -// CHECK:STDOUT: %T.patt.loc6_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_15.2 (constants.%T.patt)] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %D.ref: type = name_ref D, imports.%Main.D [concrete = constants.%D] -// CHECK:STDOUT: %J.ref: %J.type.23c = name_ref J, imports.%Main.J [concrete = constants.%J.generic] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc6_15.1 [symbolic = %T.loc6_15.2 (constants.%T)] -// CHECK:STDOUT: %J.type.loc6_31.1: type = facet_type <@J, @J(constants.%T)> [symbolic = %J.type.loc6_31.2 (constants.%J.type.ed5)] -// CHECK:STDOUT: %.loc6_17.1: type = splice_block %.loc6_17.2 [concrete = type] { -// CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc6_17.2: type = type_literal type [concrete = type] -// CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc6_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc6_15.2 (constants.%T)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %.loc6: = impl_self_witness @D.as.J.impl.7edb40.1.%D.ref, @J, @J(constants.%T) [symbolic = @D.as.J.impl.7edb40.1.%.loc6_32 (constants.%.c85)] -// CHECK:STDOUT: impl_decl @D.as.J.impl.7edb40.2 [concrete] { // CHECK:STDOUT: %T.patt.loc10_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc10_15.2 (constants.%T.patt)] // CHECK:STDOUT: } { // CHECK:STDOUT: %D.ref: type = name_ref D, imports.%Main.D [concrete = constants.%D] @@ -2514,66 +2558,80 @@ impl forall [T: type] D as N(T*) {} // CHECK:STDOUT: } // CHECK:STDOUT: %T.loc10_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc10_15.2 (constants.%T)] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc10: = impl_self_witness @D.as.J.impl.7edb40.2.%D.ref, @J, @J(constants.%T) [symbolic = @D.as.J.impl.7edb40.2.%.loc10_33 (constants.%.c85)] -// CHECK:STDOUT: impl_decl @D.as.J.impl.68b536.1 [concrete] { -// CHECK:STDOUT: %T.patt.loc14_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc14_15.2 (constants.%T.patt)] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %D.ref: type = name_ref D, imports.%Main.D [concrete = constants.%D] -// CHECK:STDOUT: %J.ref: %J.type.23c = name_ref J, imports.%Main.J [concrete = constants.%J.generic] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc14_15.1 [symbolic = %T.loc14_15.2 (constants.%T)] -// CHECK:STDOUT: %ptr.loc14_31.1: type = ptr_type %T.ref [symbolic = %ptr.loc14_31.2 (constants.%ptr)] -// CHECK:STDOUT: %J.type.loc14_32.1: type = facet_type <@J, @J(constants.%ptr)> [symbolic = %J.type.loc14_32.2 (constants.%J.type.a41)] -// CHECK:STDOUT: %.loc14_17.1: type = splice_block %.loc14_17.2 [concrete = type] { -// CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc14_17.2: type = type_literal type [concrete = type] -// CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc14_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc14_15.2 (constants.%T)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %.loc14: = impl_self_witness @D.as.J.impl.68b536.1.%D.ref, @J, @J(constants.%ptr) [symbolic = @D.as.J.impl.68b536.1.%.loc14_33 (constants.%.d76)] -// CHECK:STDOUT: impl_decl @D.as.J.impl.68b536.2 [concrete] { +// CHECK:STDOUT: %.loc10: = impl_self_witness @D.as.J.impl.7edb40.1.%D.ref, @J, @J(constants.%T) [symbolic = @D.as.J.impl.7edb40.1.%.loc10_32 (constants.%.c85)] +// CHECK:STDOUT: impl_decl @D.as.J.impl.7edb40.2 [concrete] { // CHECK:STDOUT: %T.patt.loc18_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc18_15.2 (constants.%T.patt)] // CHECK:STDOUT: } { // CHECK:STDOUT: %D.ref: type = name_ref D, imports.%Main.D [concrete = constants.%D] // CHECK:STDOUT: %J.ref: %J.type.23c = name_ref J, imports.%Main.J [concrete = constants.%J.generic] // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc18_15.1 [symbolic = %T.loc18_15.2 (constants.%T)] -// CHECK:STDOUT: %ptr.loc18_31.1: type = ptr_type %T.ref [symbolic = %ptr.loc18_31.2 (constants.%ptr)] -// CHECK:STDOUT: %J.type.loc18_32.1: type = facet_type <@J, @J(constants.%ptr)> [symbolic = %J.type.loc18_32.2 (constants.%J.type.a41)] +// CHECK:STDOUT: %J.type.loc18_31.1: type = facet_type <@J, @J(constants.%T)> [symbolic = %J.type.loc18_31.2 (constants.%J.type.ed5)] // CHECK:STDOUT: %.loc18_17.1: type = splice_block %.loc18_17.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %.loc18_17.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } // CHECK:STDOUT: %T.loc18_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc18_15.2 (constants.%T)] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc18: = impl_self_witness @D.as.J.impl.68b536.2.%D.ref, @J, @J(constants.%ptr) [symbolic = @D.as.J.impl.68b536.2.%.loc18_34 (constants.%.d76)] -// CHECK:STDOUT: impl_decl @D.as.J.impl.d69d6f.1 [concrete] { -// CHECK:STDOUT: %T.patt.loc22_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc22_15.2 (constants.%T.patt)] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %D.ref: type = name_ref D, imports.%Main.D [concrete = constants.%D] -// CHECK:STDOUT: %N.ref: %N.type.b76 = name_ref N, imports.%Main.N [concrete = constants.%empty_struct] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc22_15.1 [symbolic = %T.loc22_15.2 (constants.%T)] -// CHECK:STDOUT: %N.type.loc22_31.1: type = facet_type <@N, @N(constants.%T)> [symbolic = %N.type.loc22_31.2 (constants.%N.type.d682d6.1)] -// CHECK:STDOUT: %.loc22_17.1: type = splice_block %.loc22_17.2 [concrete = type] { -// CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc22_17.2: type = type_literal type [concrete = type] -// CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc22_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc22_15.2 (constants.%T)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %.loc22: = impl_self_witness @D.as.J.impl.d69d6f.1.%D.ref, @J, @J(constants.%T) [symbolic = @D.as.J.impl.d69d6f.1.%.loc22_33 (constants.%.c85)] -// CHECK:STDOUT: impl_decl @D.as.J.impl.d69d6f.2 [concrete] { +// CHECK:STDOUT: %.loc18: = impl_self_witness @D.as.J.impl.7edb40.2.%D.ref, @J, @J(constants.%T) [symbolic = @D.as.J.impl.7edb40.2.%.loc18_33 (constants.%.c85)] +// CHECK:STDOUT: impl_decl @D.as.J.impl.68b536.1 [concrete] { // CHECK:STDOUT: %T.patt.loc26_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc26_15.2 (constants.%T.patt)] // CHECK:STDOUT: } { // CHECK:STDOUT: %D.ref: type = name_ref D, imports.%Main.D [concrete = constants.%D] -// CHECK:STDOUT: %N.ref: %N.type.b76 = name_ref N, imports.%Main.N [concrete = constants.%empty_struct] +// CHECK:STDOUT: %J.ref: %J.type.23c = name_ref J, imports.%Main.J [concrete = constants.%J.generic] // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc26_15.1 [symbolic = %T.loc26_15.2 (constants.%T)] // CHECK:STDOUT: %ptr.loc26_31.1: type = ptr_type %T.ref [symbolic = %ptr.loc26_31.2 (constants.%ptr)] -// CHECK:STDOUT: %N.type.loc26_32.1: type = facet_type <@N, @N(constants.%ptr)> [symbolic = %N.type.loc26_32.2 (constants.%N.type.d682d6.3)] +// CHECK:STDOUT: %J.type.loc26_32.1: type = facet_type <@J, @J(constants.%ptr)> [symbolic = %J.type.loc26_32.2 (constants.%J.type.a41)] // CHECK:STDOUT: %.loc26_17.1: type = splice_block %.loc26_17.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %.loc26_17.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } // CHECK:STDOUT: %T.loc26_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc26_15.2 (constants.%T)] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc26: = impl_self_witness @D.as.J.impl.d69d6f.2.%D.ref, @J, @J(constants.%ptr) [symbolic = @D.as.J.impl.d69d6f.2.%.loc26_34 (constants.%.d76)] +// CHECK:STDOUT: %.loc26: = impl_self_witness @D.as.J.impl.68b536.1.%D.ref, @J, @J(constants.%ptr) [symbolic = @D.as.J.impl.68b536.1.%.loc26_33 (constants.%.d76)] +// CHECK:STDOUT: impl_decl @D.as.J.impl.68b536.2 [concrete] { +// CHECK:STDOUT: %T.patt.loc34_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc34_15.2 (constants.%T.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %D.ref: type = name_ref D, imports.%Main.D [concrete = constants.%D] +// CHECK:STDOUT: %J.ref: %J.type.23c = name_ref J, imports.%Main.J [concrete = constants.%J.generic] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc34_15.1 [symbolic = %T.loc34_15.2 (constants.%T)] +// CHECK:STDOUT: %ptr.loc34_31.1: type = ptr_type %T.ref [symbolic = %ptr.loc34_31.2 (constants.%ptr)] +// CHECK:STDOUT: %J.type.loc34_32.1: type = facet_type <@J, @J(constants.%ptr)> [symbolic = %J.type.loc34_32.2 (constants.%J.type.a41)] +// CHECK:STDOUT: %.loc34_17.1: type = splice_block %.loc34_17.2 [concrete = type] { +// CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc34_17.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: } +// CHECK:STDOUT: %T.loc34_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc34_15.2 (constants.%T)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %.loc34: = impl_self_witness @D.as.J.impl.68b536.2.%D.ref, @J, @J(constants.%ptr) [symbolic = @D.as.J.impl.68b536.2.%.loc34_34 (constants.%.d76)] +// CHECK:STDOUT: impl_decl @D.as.J.impl.d69d6f.1 [concrete] { +// CHECK:STDOUT: %T.patt.loc42_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc42_15.2 (constants.%T.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %D.ref: type = name_ref D, imports.%Main.D [concrete = constants.%D] +// CHECK:STDOUT: %N.ref: %N.type.b76 = name_ref N, imports.%Main.N [concrete = constants.%empty_struct] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc42_15.1 [symbolic = %T.loc42_15.2 (constants.%T)] +// CHECK:STDOUT: %N.type.loc42_31.1: type = facet_type <@N, @N(constants.%T)> [symbolic = %N.type.loc42_31.2 (constants.%N.type.d682d6.1)] +// CHECK:STDOUT: %.loc42_17.1: type = splice_block %.loc42_17.2 [concrete = type] { +// CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc42_17.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: } +// CHECK:STDOUT: %T.loc42_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc42_15.2 (constants.%T)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %.loc42: = impl_self_witness @D.as.J.impl.d69d6f.1.%D.ref, @J, @J(constants.%T) [symbolic = @D.as.J.impl.d69d6f.1.%.loc42_33 (constants.%.c85)] +// CHECK:STDOUT: impl_decl @D.as.J.impl.d69d6f.2 [concrete] { +// CHECK:STDOUT: %T.patt.loc50_15.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc50_15.2 (constants.%T.patt)] +// CHECK:STDOUT: } { +// CHECK:STDOUT: %D.ref: type = name_ref D, imports.%Main.D [concrete = constants.%D] +// CHECK:STDOUT: %N.ref: %N.type.b76 = name_ref N, imports.%Main.N [concrete = constants.%empty_struct] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc50_15.1 [symbolic = %T.loc50_15.2 (constants.%T)] +// CHECK:STDOUT: %ptr.loc50_31.1: type = ptr_type %T.ref [symbolic = %ptr.loc50_31.2 (constants.%ptr)] +// CHECK:STDOUT: %N.type.loc50_32.1: type = facet_type <@N, @N(constants.%ptr)> [symbolic = %N.type.loc50_32.2 (constants.%N.type.d682d6.3)] +// CHECK:STDOUT: %.loc50_17.1: type = splice_block %.loc50_17.2 [concrete = type] { +// CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc50_17.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: } +// CHECK:STDOUT: %T.loc50_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc50_15.2 (constants.%T)] +// CHECK:STDOUT: } +// CHECK:STDOUT: %.loc50: = impl_self_witness @D.as.J.impl.d69d6f.2.%D.ref, @J, @J(constants.%ptr) [symbolic = @D.as.J.impl.d69d6f.2.%.loc50_34 (constants.%.d76)] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generic interface @J(imports.%Main.import_ref.b3bc94.2: type) [from "fail_import_generic_decl.carbon"] { @@ -2642,83 +2700,83 @@ impl forall [T: type] D as N(T*) {} // CHECK:STDOUT: impl: imports.%Main.import_ref.2e2cf0.2 as imports.%Main.import_ref.19d; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic impl @D.as.J.impl.7edb40.1(%T.loc6_15.1: type) { -// CHECK:STDOUT: %T.patt.loc6_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_15.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc6_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc6_15.2 (constants.%T)] -// CHECK:STDOUT: %J.type.loc6_31.2: type = facet_type <@J, @J(%T.loc6_15.2)> [symbolic = %J.type.loc6_31.2 (constants.%J.type.ed5)] -// CHECK:STDOUT: %.loc6_32: = impl_self_witness constants.%D, @J, @J(%T.loc6_15.2) [symbolic = %.loc6_32 (constants.%.c85)] -// CHECK:STDOUT: -// CHECK:STDOUT: impl: %D.ref as %J.type.loc6_31.1; -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic impl @D.as.J.impl.7edb40.2(%T.loc10_15.1: type) { +// CHECK:STDOUT: generic impl @D.as.J.impl.7edb40.1(%T.loc10_15.1: type) { // CHECK:STDOUT: %T.patt.loc10_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc10_15.2 (constants.%T.patt)] // CHECK:STDOUT: %T.loc10_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc10_15.2 (constants.%T)] // CHECK:STDOUT: %J.type.loc10_31.2: type = facet_type <@J, @J(%T.loc10_15.2)> [symbolic = %J.type.loc10_31.2 (constants.%J.type.ed5)] -// CHECK:STDOUT: %.loc10_33: = impl_self_witness constants.%D, @J, @J(%T.loc10_15.2) [symbolic = %.loc10_33 (constants.%.c85)] +// CHECK:STDOUT: %.loc10_32: = impl_self_witness constants.%D, @J, @J(%T.loc10_15.2) [symbolic = %.loc10_32 (constants.%.c85)] // CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: -// CHECK:STDOUT: impl: %D.ref as %J.type.loc10_31.1 { -// CHECK:STDOUT: !members: -// CHECK:STDOUT: extend %J.type.loc10_31.1 -// CHECK:STDOUT: witness = -// CHECK:STDOUT: } +// CHECK:STDOUT: impl: %D.ref as %J.type.loc10_31.1; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic impl @D.as.J.impl.68b536.1(%T.loc14_15.1: type) { -// CHECK:STDOUT: %T.patt.loc14_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc14_15.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc14_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc14_15.2 (constants.%T)] -// CHECK:STDOUT: %ptr.loc14_31.2: type = ptr_type %T.loc14_15.2 [symbolic = %ptr.loc14_31.2 (constants.%ptr)] -// CHECK:STDOUT: %J.type.loc14_32.2: type = facet_type <@J, @J(%ptr.loc14_31.2)> [symbolic = %J.type.loc14_32.2 (constants.%J.type.a41)] -// CHECK:STDOUT: %.loc14_33: = impl_self_witness constants.%D, @J, @J(%ptr.loc14_31.2) [symbolic = %.loc14_33 (constants.%.d76)] -// CHECK:STDOUT: -// CHECK:STDOUT: impl: %D.ref as %J.type.loc14_32.1; -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic impl @D.as.J.impl.68b536.2(%T.loc18_15.1: type) { +// CHECK:STDOUT: generic impl @D.as.J.impl.7edb40.2(%T.loc18_15.1: type) { // CHECK:STDOUT: %T.patt.loc18_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc18_15.2 (constants.%T.patt)] // CHECK:STDOUT: %T.loc18_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc18_15.2 (constants.%T)] -// CHECK:STDOUT: %ptr.loc18_31.2: type = ptr_type %T.loc18_15.2 [symbolic = %ptr.loc18_31.2 (constants.%ptr)] -// CHECK:STDOUT: %J.type.loc18_32.2: type = facet_type <@J, @J(%ptr.loc18_31.2)> [symbolic = %J.type.loc18_32.2 (constants.%J.type.a41)] -// CHECK:STDOUT: %.loc18_34: = impl_self_witness constants.%D, @J, @J(%ptr.loc18_31.2) [symbolic = %.loc18_34 (constants.%.d76)] +// CHECK:STDOUT: %J.type.loc18_31.2: type = facet_type <@J, @J(%T.loc18_15.2)> [symbolic = %J.type.loc18_31.2 (constants.%J.type.ed5)] +// CHECK:STDOUT: %.loc18_33: = impl_self_witness constants.%D, @J, @J(%T.loc18_15.2) [symbolic = %.loc18_33 (constants.%.c85)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: -// CHECK:STDOUT: impl: %D.ref as %J.type.loc18_32.1 { +// CHECK:STDOUT: impl: %D.ref as %J.type.loc18_31.1 { // CHECK:STDOUT: !members: -// CHECK:STDOUT: extend %J.type.loc18_32.1 +// CHECK:STDOUT: extend %J.type.loc18_31.1 // CHECK:STDOUT: witness = // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic impl @D.as.J.impl.d69d6f.1(%T.loc22_15.1: type) { -// CHECK:STDOUT: %T.patt.loc22_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc22_15.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc22_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc22_15.2 (constants.%T)] -// CHECK:STDOUT: %N.type.loc22_31.2: type = facet_type <@N, @N(%T.loc22_15.2)> [symbolic = %N.type.loc22_31.2 (constants.%N.type.d682d6.1)] -// CHECK:STDOUT: %.loc22_33: = impl_self_witness constants.%D, @J, @J(%T.loc22_15.2) [symbolic = %.loc22_33 (constants.%.c85)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: -// CHECK:STDOUT: impl: %D.ref as %N.type.loc22_31.1 { -// CHECK:STDOUT: !members: -// CHECK:STDOUT: extend %N.type.loc22_31.1 -// CHECK:STDOUT: witness = -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic impl @D.as.J.impl.d69d6f.2(%T.loc26_15.1: type) { +// CHECK:STDOUT: generic impl @D.as.J.impl.68b536.1(%T.loc26_15.1: type) { // CHECK:STDOUT: %T.patt.loc26_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc26_15.2 (constants.%T.patt)] // CHECK:STDOUT: %T.loc26_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc26_15.2 (constants.%T)] // CHECK:STDOUT: %ptr.loc26_31.2: type = ptr_type %T.loc26_15.2 [symbolic = %ptr.loc26_31.2 (constants.%ptr)] -// CHECK:STDOUT: %N.type.loc26_32.2: type = facet_type <@N, @N(%ptr.loc26_31.2)> [symbolic = %N.type.loc26_32.2 (constants.%N.type.d682d6.3)] -// CHECK:STDOUT: %.loc26_34: = impl_self_witness constants.%D, @J, @J(%ptr.loc26_31.2) [symbolic = %.loc26_34 (constants.%.d76)] +// CHECK:STDOUT: %J.type.loc26_32.2: type = facet_type <@J, @J(%ptr.loc26_31.2)> [symbolic = %J.type.loc26_32.2 (constants.%J.type.a41)] +// CHECK:STDOUT: %.loc26_33: = impl_self_witness constants.%D, @J, @J(%ptr.loc26_31.2) [symbolic = %.loc26_33 (constants.%.d76)] +// CHECK:STDOUT: +// CHECK:STDOUT: impl: %D.ref as %J.type.loc26_32.1; +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @D.as.J.impl.68b536.2(%T.loc34_15.1: type) { +// CHECK:STDOUT: %T.patt.loc34_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc34_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc34_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc34_15.2 (constants.%T)] +// CHECK:STDOUT: %ptr.loc34_31.2: type = ptr_type %T.loc34_15.2 [symbolic = %ptr.loc34_31.2 (constants.%ptr)] +// CHECK:STDOUT: %J.type.loc34_32.2: type = facet_type <@J, @J(%ptr.loc34_31.2)> [symbolic = %J.type.loc34_32.2 (constants.%J.type.a41)] +// CHECK:STDOUT: %.loc34_34: = impl_self_witness constants.%D, @J, @J(%ptr.loc34_31.2) [symbolic = %.loc34_34 (constants.%.d76)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: -// CHECK:STDOUT: impl: %D.ref as %N.type.loc26_32.1 { +// CHECK:STDOUT: impl: %D.ref as %J.type.loc34_32.1 { // CHECK:STDOUT: !members: -// CHECK:STDOUT: extend %N.type.loc26_32.1 +// CHECK:STDOUT: extend %J.type.loc34_32.1 +// CHECK:STDOUT: witness = +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @D.as.J.impl.d69d6f.1(%T.loc42_15.1: type) { +// CHECK:STDOUT: %T.patt.loc42_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc42_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc42_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc42_15.2 (constants.%T)] +// CHECK:STDOUT: %N.type.loc42_31.2: type = facet_type <@N, @N(%T.loc42_15.2)> [symbolic = %N.type.loc42_31.2 (constants.%N.type.d682d6.1)] +// CHECK:STDOUT: %.loc42_33: = impl_self_witness constants.%D, @J, @J(%T.loc42_15.2) [symbolic = %.loc42_33 (constants.%.c85)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: impl: %D.ref as %N.type.loc42_31.1 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: extend %N.type.loc42_31.1 +// CHECK:STDOUT: witness = +// CHECK:STDOUT: } +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: generic impl @D.as.J.impl.d69d6f.2(%T.loc50_15.1: type) { +// CHECK:STDOUT: %T.patt.loc50_15.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc50_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc50_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc50_15.2 (constants.%T)] +// CHECK:STDOUT: %ptr.loc50_31.2: type = ptr_type %T.loc50_15.2 [symbolic = %ptr.loc50_31.2 (constants.%ptr)] +// CHECK:STDOUT: %N.type.loc50_32.2: type = facet_type <@N, @N(%ptr.loc50_31.2)> [symbolic = %N.type.loc50_32.2 (constants.%N.type.d682d6.3)] +// CHECK:STDOUT: %.loc50_34: = impl_self_witness constants.%D, @J, @J(%ptr.loc50_31.2) [symbolic = %.loc50_34 (constants.%.d76)] +// CHECK:STDOUT: +// CHECK:STDOUT: !definition: +// CHECK:STDOUT: +// CHECK:STDOUT: impl: %D.ref as %N.type.loc50_32.1 { +// CHECK:STDOUT: !members: +// CHECK:STDOUT: extend %N.type.loc50_32.1 // CHECK:STDOUT: witness = // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -2766,33 +2824,33 @@ impl forall [T: type] D as N(T*) {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @D.as.J.impl.7edb40.1(constants.%T) { -// CHECK:STDOUT: %T.patt.loc6_15.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc6_15.2 => constants.%T -// CHECK:STDOUT: %J.type.loc6_31.2 => constants.%J.type.ed5 -// CHECK:STDOUT: %.loc6_32 => constants.%.c85 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @D.as.J.impl.7edb40.2(constants.%T) { // CHECK:STDOUT: %T.patt.loc10_15.2 => constants.%T.patt // CHECK:STDOUT: %T.loc10_15.2 => constants.%T // CHECK:STDOUT: %J.type.loc10_31.2 => constants.%J.type.ed5 -// CHECK:STDOUT: %.loc10_33 => constants.%.c85 +// CHECK:STDOUT: %.loc10_32 => constants.%.c85 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @D.as.J.impl.7edb40.2(constants.%T) { +// CHECK:STDOUT: %T.patt.loc18_15.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc18_15.2 => constants.%T +// CHECK:STDOUT: %J.type.loc18_31.2 => constants.%J.type.ed5 +// CHECK:STDOUT: %.loc18_33 => constants.%.c85 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @D.as.J.impl.68b536.1(constants.%T) { -// CHECK:STDOUT: %T.patt.loc14_15.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc14_15.2 => constants.%T -// CHECK:STDOUT: %ptr.loc14_31.2 => constants.%ptr -// CHECK:STDOUT: %J.type.loc14_32.2 => constants.%J.type.a41 -// CHECK:STDOUT: %.loc14_33 => constants.%.d76 +// CHECK:STDOUT: %T.patt.loc26_15.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc26_15.2 => constants.%T +// CHECK:STDOUT: %ptr.loc26_31.2 => constants.%ptr +// CHECK:STDOUT: %J.type.loc26_32.2 => constants.%J.type.a41 +// CHECK:STDOUT: %.loc26_33 => constants.%.d76 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @D.as.J.impl.68b536.2(constants.%T) { -// CHECK:STDOUT: %T.patt.loc18_15.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc18_15.2 => constants.%T -// CHECK:STDOUT: %ptr.loc18_31.2 => constants.%ptr -// CHECK:STDOUT: %J.type.loc18_32.2 => constants.%J.type.a41 -// CHECK:STDOUT: %.loc18_34 => constants.%.d76 +// CHECK:STDOUT: %T.patt.loc34_15.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc34_15.2 => constants.%T +// CHECK:STDOUT: %ptr.loc34_31.2 => constants.%ptr +// CHECK:STDOUT: %J.type.loc34_32.2 => constants.%J.type.a41 +// CHECK:STDOUT: %.loc34_34 => constants.%.d76 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @N(constants.%T) { @@ -2836,10 +2894,10 @@ impl forall [T: type] D as N(T*) {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @D.as.J.impl.d69d6f.1(constants.%T) { -// CHECK:STDOUT: %T.patt.loc22_15.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc22_15.2 => constants.%T -// CHECK:STDOUT: %N.type.loc22_31.2 => constants.%N.type.d682d6.1 -// CHECK:STDOUT: %.loc22_33 => constants.%.c85 +// CHECK:STDOUT: %T.patt.loc42_15.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc42_15.2 => constants.%T +// CHECK:STDOUT: %N.type.loc42_31.2 => constants.%N.type.d682d6.1 +// CHECK:STDOUT: %.loc42_33 => constants.%.c85 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @N(constants.%ptr) { @@ -2873,10 +2931,10 @@ impl forall [T: type] D as N(T*) {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @D.as.J.impl.d69d6f.2(constants.%T) { -// CHECK:STDOUT: %T.patt.loc26_15.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc26_15.2 => constants.%T -// CHECK:STDOUT: %ptr.loc26_31.2 => constants.%ptr -// CHECK:STDOUT: %N.type.loc26_32.2 => constants.%N.type.d682d6.3 -// CHECK:STDOUT: %.loc26_34 => constants.%.d76 +// CHECK:STDOUT: %T.patt.loc50_15.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc50_15.2 => constants.%T +// CHECK:STDOUT: %ptr.loc50_31.2 => constants.%ptr +// CHECK:STDOUT: %N.type.loc50_32.2 => constants.%N.type.d682d6.3 +// CHECK:STDOUT: %.loc50_34 => constants.%.d76 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/import_impl_with_no_interface.carbon b/toolchain/check/testdata/impl/import_impl_with_no_interface.carbon index 285f6ae5aae6..6e2aff7a15f7 100644 --- a/toolchain/check/testdata/impl/import_impl_with_no_interface.carbon +++ b/toolchain/check/testdata/impl/import_impl_with_no_interface.carbon @@ -13,7 +13,11 @@ // --- fail_lib.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_lib.carbon:[[@LINE+2]]:18-27: error: name `Undeclared` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_lib.carbon:[[@LINE+6]]:18 +// CHECK:STDERR: -> │ impl {.i: ()} as Undeclared { +// CHECK:STDERR: · ━━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: name `Undeclared` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl {.i: ()} as Undeclared { fn F() {} diff --git a/toolchain/check/testdata/impl/import_interface_assoc_const.carbon b/toolchain/check/testdata/impl/import_interface_assoc_const.carbon index 3bc6970ab535..13cb7b9968ce 100644 --- a/toolchain/check/testdata/impl/import_interface_assoc_const.carbon +++ b/toolchain/check/testdata/impl/import_interface_assoc_const.carbon @@ -47,7 +47,11 @@ library "[[@TEST_NAME]]"; import library "interface"; class C3 { } -// CHECK:STDERR: fail_redecl_adds_rewrites.carbon:[[@LINE+2]]:1-13: error: impl declared but not defined [ImplMissingDefinition] +// CHECK:STDERR: ╭─┤ fail_redecl_adds_rewrites.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ impl C3 as I; +// CHECK:STDERR: · ━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: impl declared but not defined [ImplMissingDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl C3 as I; impl C3 as I where .T = {} { } @@ -57,7 +61,11 @@ library "[[@TEST_NAME]]"; import library "interface"; class C4 { } -// CHECK:STDERR: fail_mismatch.carbon:[[@LINE+2]]:1-27: error: impl declared but not defined [ImplMissingDefinition] +// CHECK:STDERR: ╭─┤ fail_mismatch.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ impl C4 as I where .T = {}; +// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: impl declared but not defined [ImplMissingDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl C4 as I where .T = {}; impl C4 as I where .T = () { } @@ -71,15 +79,40 @@ class C5 { } // This is testing that it won't complain about mismatching values if they // have errors. -// CHECK:STDERR: fail_mismatch_bad_value.carbon:[[@LINE+4]]:27-30: error: name `BAD1` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_mismatch_bad_value.carbon:[[@LINE+16]]:27 +// CHECK:STDERR: -> │ impl C5 as I3 where .T1 = BAD1 and .T2 = {.a: {}} and .T3 = BAD2; +// CHECK:STDERR: · ━━┳━ +// CHECK:STDERR: · ┗━━┫ error: name `BAD1` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_mismatch_bad_value.carbon:[[@LINE+2]]:61-64: error: name `BAD2` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_mismatch_bad_value.carbon:[[@LINE+10]]:61 +// CHECK:STDERR: -> │ impl C5 as I3 where .T1 = BAD1 and .T2 = {.a: {}} and .T3 = BAD2; +// CHECK:STDERR: · ┳━━━ +// CHECK:STDERR: · ┗━━┫ error: name +// CHECK:STDERR: · ┃ `BAD2` +// CHECK:STDERR: · ┃ not +// CHECK:STDERR: · ┃ found +// CHECK:STDERR: · ┃ [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl C5 as I3 where .T1 = BAD1 and .T2 = {.a: {}} and .T3 = BAD2; -// CHECK:STDERR: fail_mismatch_bad_value.carbon:[[@LINE+4]]:46-49: error: name `BAD3` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_mismatch_bad_value.carbon:[[@LINE+17]]:46 +// CHECK:STDERR: -> │ impl C5 as I3 where .T1 = {.b: {}} and .T2 = BAD3 and .T3 = BAD4 { } +// CHECK:STDERR: · ━━┳━ +// CHECK:STDERR: · ┗━━┫ error: name `BAD3` not found +// CHECK:STDERR: · ┃ [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_mismatch_bad_value.carbon:[[@LINE+2]]:61-64: error: name `BAD4` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_mismatch_bad_value.carbon:[[@LINE+10]]:61 +// CHECK:STDERR: -> │ impl C5 as I3 where .T1 = {.b: {}} and .T2 = BAD3 and .T3 = BAD4 { } +// CHECK:STDERR: · ┳━━━ +// CHECK:STDERR: · ┗━━┫ error: name +// CHECK:STDERR: · ┃ `BAD4` +// CHECK:STDERR: · ┃ not +// CHECK:STDERR: · ┃ found +// CHECK:STDERR: · ┃ [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl C5 as I3 where .T1 = {.b: {}} and .T2 = BAD3 and .T3 = BAD4 { } @@ -89,10 +122,24 @@ import library "interface"; class C6 { } impl C6 as I where .T = {}; -// CHECK:STDERR: fail_missing_on_definition.carbon:[[@LINE+5]]:1-14: error: associated constant T not given a value in impl of interface I [ImplAssociatedConstantNeedsValue] -// CHECK:STDERR: interface.carbon:3:19-25: note: associated constant declared here [AssociatedConstantHere] +// CHECK:STDERR: ╭─┤ fail_missing_on_definition.carbon:[[@LINE+19]]:1 +// CHECK:STDERR: -> │ impl C6 as I { } +// CHECK:STDERR: · ━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: associated constant T not given a value in impl of interface I +// CHECK:STDERR: · ┃ [ImplAssociatedConstantNeedsValue] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ interface.carbon +// CHECK:STDERR: │ interface I { let T: type; } +// CHECK:STDERR: · ───┬─── +// CHECK:STDERR: · ╰──┤ associated constant declared here +// CHECK:STDERR: · │ [AssociatedConstantHere] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_missing_on_definition.carbon:[[@LINE-4]]:1-27: error: impl declared but not defined [ImplMissingDefinition] +// CHECK:STDERR: ╭─┤ fail_missing_on_definition.carbon:[[@LINE-14]]:1 +// CHECK:STDERR: -> │ impl C6 as I where .T = {}; +// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: impl declared but not defined [ImplMissingDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl C6 as I { } @@ -102,7 +149,13 @@ import library "interface"; class C7 { } -// CHECK:STDERR: fail_two_different.carbon:[[@LINE+2]]:12-38: error: associated constant `.(I.T)` given two different values `{}` and `()` [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╭─┤ fail_two_different.carbon:[[@LINE+8]]:12 +// CHECK:STDERR: -> │ impl C7 as I where .T = {} and .T = () { } +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: associated constant `.(I.T)` given two different values +// CHECK:STDERR: · ┃ `{}` and `()` +// CHECK:STDERR: · ┃ [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl C7 as I where .T = {} and .T = () { } @@ -112,7 +165,11 @@ import library "interface"; class C8 { } -// CHECK:STDERR: fail_two_different_first_bad.carbon:[[@LINE+2]]:25-28: error: name `BAD5` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_two_different_first_bad.carbon:[[@LINE+6]]:25 +// CHECK:STDERR: -> │ impl C8 as I where .T = BAD5 and .T = () { } +// CHECK:STDERR: · ━━┳━ +// CHECK:STDERR: · ┗━━┫ error: name `BAD5` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl C8 as I where .T = BAD5 and .T = () { } @@ -122,7 +179,12 @@ import library "interface"; class C9 { } -// CHECK:STDERR: fail_two_different_second_bad.carbon:[[@LINE+2]]:37-40: error: name `BAD6` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_two_different_second_bad.carbon:[[@LINE+7]]:37 +// CHECK:STDERR: -> │ impl C9 as I where .T = {} and .T = BAD6 { } +// CHECK:STDERR: · ━━┳━ +// CHECK:STDERR: · ┗━━┫ error: name `BAD6` not found +// CHECK:STDERR: · ┃ [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl C9 as I where .T = {} and .T = BAD6 { } @@ -132,9 +194,18 @@ import library "interface"; class CA { } -// CHECK:STDERR: fail_two_different_both_bad.carbon:[[@LINE+4]]:25-28: error: name `BAD7` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_two_different_both_bad.carbon:[[@LINE+13]]:25 +// CHECK:STDERR: -> │ impl CA as I where .T = BAD7 and .T = BAD8 { } +// CHECK:STDERR: · ━━┳━ +// CHECK:STDERR: · ┗━━┫ error: name `BAD7` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_two_different_both_bad.carbon:[[@LINE+2]]:39-42: error: name `BAD8` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_two_different_both_bad.carbon:[[@LINE+7]]:39 +// CHECK:STDERR: -> │ impl CA as I where .T = BAD7 and .T = BAD8 { } +// CHECK:STDERR: · ━━┳━ +// CHECK:STDERR: · ┗━━┫ error: name `BAD8` not found +// CHECK:STDERR: · ┃ [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl CA as I where .T = BAD7 and .T = BAD8 { } @@ -165,7 +236,12 @@ import library "interface_with_function"; class CD { } -// CHECK:STDERR: fail_where_rewrite_function.carbon:[[@LINE+2]]:12-26: error: rewrite specified for associated function F [RewriteForAssociatedFunction] +// CHECK:STDERR: ╭─┤ fail_where_rewrite_function.carbon:[[@LINE+7]]:12 +// CHECK:STDERR: -> │ impl CD as IF where .F = 0 { +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: rewrite specified for associated function F +// CHECK:STDERR: · ┃ [RewriteForAssociatedFunction] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl CD as IF where .F = 0 { fn F() {} @@ -553,7 +629,7 @@ impl CD as IF where .F = 0 { // CHECK:STDOUT: %C3.ref: type = name_ref C3, file.%C3.decl [concrete = constants.%C3] // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc7: = impl_self_witness @C3.as.I.impl.a518fc.1.%C3.ref, @I [concrete = constants.%.afd] +// CHECK:STDOUT: %.loc11: = impl_self_witness @C3.as.I.impl.a518fc.1.%C3.ref, @I [concrete = constants.%.afd] // CHECK:STDOUT: impl_decl @C3.as.I.impl.a518fc.2 [concrete] {} { // CHECK:STDOUT: %C3.ref: type = name_ref C3, file.%C3.decl [concrete = constants.%C3] // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type] @@ -561,20 +637,20 @@ impl CD as IF where .F = 0 { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] // CHECK:STDOUT: %.Self.ref: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc8_20: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc12_20: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.frozen.as_type] // CHECK:STDOUT: %T.ref: %I.assoc_type = name_ref T, imports.%Main.import_ref.b8f [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc8_20.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] -// CHECK:STDOUT: %.loc8_26.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc8_26.2: type = converted %.loc8_26.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %rewrite.loc8_23.1 = requirement_rewrite %impl.elem0.loc8_20.1, %.loc8_26.2 [concrete] -// CHECK:STDOUT: %impl.elem0.loc8_20.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] -// CHECK:STDOUT: %rewrite.loc8_23.2 = requirement_rewrite %impl.elem0.loc8_20.2, %.loc8_26.2 [concrete] -// CHECK:STDOUT: %.loc8_14: type = where_expr [concrete = constants.%I_where.type.c16] { +// CHECK:STDOUT: %impl.elem0.loc12_20.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] +// CHECK:STDOUT: %.loc12_26.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc12_26.2: type = converted %.loc12_26.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %rewrite.loc12_23.1 = requirement_rewrite %impl.elem0.loc12_20.1, %.loc12_26.2 [concrete] +// CHECK:STDOUT: %impl.elem0.loc12_20.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] +// CHECK:STDOUT: %rewrite.loc12_23.2 = requirement_rewrite %impl.elem0.loc12_20.2, %.loc12_26.2 [concrete] +// CHECK:STDOUT: %.loc12_14: type = where_expr [concrete = constants.%I_where.type.c16] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] -// CHECK:STDOUT: %rewrite.loc8_23.2 = requirement_rewrite %impl.elem0.loc8_20.2, %.loc8_26.2 [concrete] +// CHECK:STDOUT: %rewrite.loc12_23.2 = requirement_rewrite %impl.elem0.loc12_20.2, %.loc12_26.2 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8: = impl_self_witness @C3.as.I.impl.a518fc.2.%C3.ref, @I [concrete = constants.%.afd] +// CHECK:STDOUT: %.loc12: = impl_self_witness @C3.as.I.impl.a518fc.2.%C3.ref, @I [concrete = constants.%.afd] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I [from "interface.carbon"] { @@ -673,20 +749,20 @@ impl CD as IF where .F = 0 { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] // CHECK:STDOUT: %.Self.ref: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc7_20: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc11_20: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.frozen.as_type] // CHECK:STDOUT: %T.ref: %I.assoc_type = name_ref T, imports.%Main.import_ref.b8f [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc7_20.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] -// CHECK:STDOUT: %.loc7_26.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc7_26.2: type = converted %.loc7_26.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %rewrite.loc7_23.1 = requirement_rewrite %impl.elem0.loc7_20.1, %.loc7_26.2 [concrete] -// CHECK:STDOUT: %impl.elem0.loc7_20.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] -// CHECK:STDOUT: %rewrite.loc7_23.2 = requirement_rewrite %impl.elem0.loc7_20.2, %.loc7_26.2 [concrete] -// CHECK:STDOUT: %.loc7_14: type = where_expr [concrete = constants.%I_where.type.c16] { +// CHECK:STDOUT: %impl.elem0.loc11_20.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] +// CHECK:STDOUT: %.loc11_26.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc11_26.2: type = converted %.loc11_26.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %rewrite.loc11_23.1 = requirement_rewrite %impl.elem0.loc11_20.1, %.loc11_26.2 [concrete] +// CHECK:STDOUT: %impl.elem0.loc11_20.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] +// CHECK:STDOUT: %rewrite.loc11_23.2 = requirement_rewrite %impl.elem0.loc11_20.2, %.loc11_26.2 [concrete] +// CHECK:STDOUT: %.loc11_14: type = where_expr [concrete = constants.%I_where.type.c16] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] -// CHECK:STDOUT: %rewrite.loc7_23.2 = requirement_rewrite %impl.elem0.loc7_20.2, %.loc7_26.2 [concrete] +// CHECK:STDOUT: %rewrite.loc11_23.2 = requirement_rewrite %impl.elem0.loc11_20.2, %.loc11_26.2 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc7: = impl_self_witness @C4.as.I.impl.c5f663.1.%C4.ref, @I [concrete = constants.%.911] +// CHECK:STDOUT: %.loc11: = impl_self_witness @C4.as.I.impl.c5f663.1.%C4.ref, @I [concrete = constants.%.911] // CHECK:STDOUT: impl_decl @C4.as.I.impl.c5f663.2 [concrete] {} { // CHECK:STDOUT: %C4.ref: type = name_ref C4, file.%C4.decl [concrete = constants.%C4] // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type] @@ -694,20 +770,20 @@ impl CD as IF where .F = 0 { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] // CHECK:STDOUT: %.Self.ref: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc8_20: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc12_20: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.frozen.as_type] // CHECK:STDOUT: %T.ref: %I.assoc_type = name_ref T, imports.%Main.import_ref.b8f [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc8_20.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] -// CHECK:STDOUT: %.loc8_26.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_26.2: type = converted %.loc8_26.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %rewrite.loc8_23.1 = requirement_rewrite %impl.elem0.loc8_20.1, %.loc8_26.2 [concrete] -// CHECK:STDOUT: %impl.elem0.loc8_20.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] -// CHECK:STDOUT: %rewrite.loc8_23.2 = requirement_rewrite %impl.elem0.loc8_20.2, %.loc8_26.2 [concrete] -// CHECK:STDOUT: %.loc8_14: type = where_expr [concrete = constants.%I_where.type.d99] { +// CHECK:STDOUT: %impl.elem0.loc12_20.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] +// CHECK:STDOUT: %.loc12_26.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc12_26.2: type = converted %.loc12_26.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %rewrite.loc12_23.1 = requirement_rewrite %impl.elem0.loc12_20.1, %.loc12_26.2 [concrete] +// CHECK:STDOUT: %impl.elem0.loc12_20.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] +// CHECK:STDOUT: %rewrite.loc12_23.2 = requirement_rewrite %impl.elem0.loc12_20.2, %.loc12_26.2 [concrete] +// CHECK:STDOUT: %.loc12_14: type = where_expr [concrete = constants.%I_where.type.d99] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] -// CHECK:STDOUT: %rewrite.loc8_23.2 = requirement_rewrite %impl.elem0.loc8_20.2, %.loc8_26.2 [concrete] +// CHECK:STDOUT: %rewrite.loc12_23.2 = requirement_rewrite %impl.elem0.loc12_20.2, %.loc12_26.2 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8: = impl_self_witness @C4.as.I.impl.c5f663.2.%C4.ref, @I [concrete = constants.%.911] +// CHECK:STDOUT: %.loc12: = impl_self_witness @C4.as.I.impl.c5f663.2.%C4.ref, @I [concrete = constants.%.911] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I [from "interface.carbon"] { @@ -817,40 +893,40 @@ impl CD as IF where .F = 0 { // CHECK:STDOUT: %I3.ref: type = name_ref I3, imports.%Main.I3 [concrete = constants.%I3.type] // CHECK:STDOUT: %.Self.frozen: %I3.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I3.ref [concrete] -// CHECK:STDOUT: %.Self.ref.loc13_21: %I3.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc13_21: type = facet_access_type %.Self.ref.loc13_21 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc13_21: type = converted %.Self.ref.loc13_21, %.Self.as_type.loc13_21 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.Self.ref.loc25_21: %I3.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc25_21: type = facet_access_type %.Self.ref.loc25_21 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc25_21: type = converted %.Self.ref.loc25_21, %.Self.as_type.loc25_21 [symbolic_self = constants.%.Self.frozen.as_type] // CHECK:STDOUT: %T1.ref: %I3.assoc_type = name_ref T1, imports.%Main.import_ref.e53 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc13_21.1: type = impl_witness_access constants.%.408, element0 [symbolic_self = constants.%impl.elem0.80b] +// CHECK:STDOUT: %impl.elem0.loc25_21.1: type = impl_witness_access constants.%.408, element0 [symbolic_self = constants.%impl.elem0.80b] // CHECK:STDOUT: %BAD1.ref: = name_ref BAD1, [concrete = ] -// CHECK:STDOUT: %rewrite.loc13_25.1 = requirement_rewrite %impl.elem0.loc13_21.1, [concrete] -// CHECK:STDOUT: %.Self.ref.loc13_36: %I3.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc13_36: type = facet_access_type %.Self.ref.loc13_36 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc13_36: type = converted %.Self.ref.loc13_36, %.Self.as_type.loc13_36 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %rewrite.loc25_25.1 = requirement_rewrite %impl.elem0.loc25_21.1, [concrete] +// CHECK:STDOUT: %.Self.ref.loc25_36: %I3.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc25_36: type = facet_access_type %.Self.ref.loc25_36 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc25_36: type = converted %.Self.ref.loc25_36, %.Self.as_type.loc25_36 [symbolic_self = constants.%.Self.frozen.as_type] // CHECK:STDOUT: %T2.ref: %I3.assoc_type = name_ref T2, imports.%Main.import_ref.7af [concrete = constants.%assoc1] -// CHECK:STDOUT: %impl.elem1.loc13_36.1: type = impl_witness_access constants.%.408, element1 [symbolic_self = constants.%impl.elem1.74f] -// CHECK:STDOUT: %.loc13_48.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc13_48.2: type = converted %.loc13_48.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %impl.elem1.loc25_36.1: type = impl_witness_access constants.%.408, element1 [symbolic_self = constants.%impl.elem1.74f] +// CHECK:STDOUT: %.loc25_48.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc25_48.2: type = converted %.loc25_48.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %empty_struct_type} [concrete = constants.%struct_type.a] -// CHECK:STDOUT: %rewrite.loc13_40.1 = requirement_rewrite %impl.elem1.loc13_36.1, %struct_type.a [concrete] -// CHECK:STDOUT: %.Self.ref.loc13_55: %I3.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc13_55: type = facet_access_type %.Self.ref.loc13_55 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc13_55: type = converted %.Self.ref.loc13_55, %.Self.as_type.loc13_55 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %rewrite.loc25_40.1 = requirement_rewrite %impl.elem1.loc25_36.1, %struct_type.a [concrete] +// CHECK:STDOUT: %.Self.ref.loc25_55: %I3.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc25_55: type = facet_access_type %.Self.ref.loc25_55 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc25_55: type = converted %.Self.ref.loc25_55, %.Self.as_type.loc25_55 [symbolic_self = constants.%.Self.frozen.as_type] // CHECK:STDOUT: %T3.ref: %I3.assoc_type = name_ref T3, imports.%Main.import_ref.c31 [concrete = constants.%assoc2] -// CHECK:STDOUT: %impl.elem2.loc13_55.1: type = impl_witness_access constants.%.408, element2 [symbolic_self = constants.%impl.elem2.926] +// CHECK:STDOUT: %impl.elem2.loc25_55.1: type = impl_witness_access constants.%.408, element2 [symbolic_self = constants.%impl.elem2.926] // CHECK:STDOUT: %BAD2.ref: = name_ref BAD2, [concrete = ] -// CHECK:STDOUT: %rewrite.loc13_59.1 = requirement_rewrite %impl.elem2.loc13_55.1, [concrete] -// CHECK:STDOUT: %impl.elem0.loc13_21.2: type = impl_witness_access constants.%.dbd, element0 [symbolic_self = constants.%impl.elem0.91b] -// CHECK:STDOUT: %rewrite.loc13_25.2 = requirement_rewrite %impl.elem0.loc13_21.2, [concrete] -// CHECK:STDOUT: %impl.elem1.loc13_36.2: type = impl_witness_access constants.%.dbd, element1 [symbolic_self = constants.%impl.elem1.4e8] -// CHECK:STDOUT: %rewrite.loc13_40.2 = requirement_rewrite %impl.elem1.loc13_36.2, %struct_type.a [concrete] -// CHECK:STDOUT: %impl.elem2.loc13_55.2: type = impl_witness_access constants.%.dbd, element2 [symbolic_self = constants.%impl.elem2.5f8] -// CHECK:STDOUT: %rewrite.loc13_59.2 = requirement_rewrite %impl.elem2.loc13_55.2, [concrete] -// CHECK:STDOUT: %.loc13_15: type = where_expr [concrete = ] { +// CHECK:STDOUT: %rewrite.loc25_59.1 = requirement_rewrite %impl.elem2.loc25_55.1, [concrete] +// CHECK:STDOUT: %impl.elem0.loc25_21.2: type = impl_witness_access constants.%.dbd, element0 [symbolic_self = constants.%impl.elem0.91b] +// CHECK:STDOUT: %rewrite.loc25_25.2 = requirement_rewrite %impl.elem0.loc25_21.2, [concrete] +// CHECK:STDOUT: %impl.elem1.loc25_36.2: type = impl_witness_access constants.%.dbd, element1 [symbolic_self = constants.%impl.elem1.4e8] +// CHECK:STDOUT: %rewrite.loc25_40.2 = requirement_rewrite %impl.elem1.loc25_36.2, %struct_type.a [concrete] +// CHECK:STDOUT: %impl.elem2.loc25_55.2: type = impl_witness_access constants.%.dbd, element2 [symbolic_self = constants.%impl.elem2.5f8] +// CHECK:STDOUT: %rewrite.loc25_59.2 = requirement_rewrite %impl.elem2.loc25_55.2, [concrete] +// CHECK:STDOUT: %.loc25_15: type = where_expr [concrete = ] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I3.ref [concrete] -// CHECK:STDOUT: %rewrite.loc13_25.2 = requirement_rewrite %impl.elem0.loc13_21.2, [concrete] -// CHECK:STDOUT: %rewrite.loc13_40.2 = requirement_rewrite %impl.elem1.loc13_36.2, %struct_type.a [concrete] -// CHECK:STDOUT: %rewrite.loc13_59.2 = requirement_rewrite %impl.elem2.loc13_55.2, [concrete] +// CHECK:STDOUT: %rewrite.loc25_25.2 = requirement_rewrite %impl.elem0.loc25_21.2, [concrete] +// CHECK:STDOUT: %rewrite.loc25_40.2 = requirement_rewrite %impl.elem1.loc25_36.2, %struct_type.a [concrete] +// CHECK:STDOUT: %rewrite.loc25_59.2 = requirement_rewrite %impl.elem2.loc25_55.2, [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: impl_decl @C5.as..impl.f79ae5.2 [concrete] {} { @@ -858,40 +934,40 @@ impl CD as IF where .F = 0 { // CHECK:STDOUT: %I3.ref: type = name_ref I3, imports.%Main.I3 [concrete = constants.%I3.type] // CHECK:STDOUT: %.Self.frozen: %I3.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I3.ref [concrete] -// CHECK:STDOUT: %.Self.ref.loc19_21: %I3.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc19_21: type = facet_access_type %.Self.ref.loc19_21 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc19_21: type = converted %.Self.ref.loc19_21, %.Self.as_type.loc19_21 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.Self.ref.loc44_21: %I3.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc44_21: type = facet_access_type %.Self.ref.loc44_21 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc44_21: type = converted %.Self.ref.loc44_21, %.Self.as_type.loc44_21 [symbolic_self = constants.%.Self.frozen.as_type] // CHECK:STDOUT: %T1.ref: %I3.assoc_type = name_ref T1, imports.%Main.import_ref.e53 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc19_21.1: type = impl_witness_access constants.%.408, element0 [symbolic_self = constants.%impl.elem0.80b] -// CHECK:STDOUT: %.loc19_33.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc19_33.2: type = converted %.loc19_33.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %impl.elem0.loc44_21.1: type = impl_witness_access constants.%.408, element0 [symbolic_self = constants.%impl.elem0.80b] +// CHECK:STDOUT: %.loc44_33.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc44_33.2: type = converted %.loc44_33.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: %struct_type.b: type = struct_type {.b: %empty_struct_type} [concrete = constants.%struct_type.b] -// CHECK:STDOUT: %rewrite.loc19_25.1 = requirement_rewrite %impl.elem0.loc19_21.1, %struct_type.b [concrete] -// CHECK:STDOUT: %.Self.ref.loc19_40: %I3.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc19_40: type = facet_access_type %.Self.ref.loc19_40 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc19_40: type = converted %.Self.ref.loc19_40, %.Self.as_type.loc19_40 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %rewrite.loc44_25.1 = requirement_rewrite %impl.elem0.loc44_21.1, %struct_type.b [concrete] +// CHECK:STDOUT: %.Self.ref.loc44_40: %I3.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc44_40: type = facet_access_type %.Self.ref.loc44_40 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc44_40: type = converted %.Self.ref.loc44_40, %.Self.as_type.loc44_40 [symbolic_self = constants.%.Self.frozen.as_type] // CHECK:STDOUT: %T2.ref: %I3.assoc_type = name_ref T2, imports.%Main.import_ref.7af [concrete = constants.%assoc1] -// CHECK:STDOUT: %impl.elem1.loc19_40.1: type = impl_witness_access constants.%.408, element1 [symbolic_self = constants.%impl.elem1.74f] +// CHECK:STDOUT: %impl.elem1.loc44_40.1: type = impl_witness_access constants.%.408, element1 [symbolic_self = constants.%impl.elem1.74f] // CHECK:STDOUT: %BAD3.ref: = name_ref BAD3, [concrete = ] -// CHECK:STDOUT: %rewrite.loc19_44.1 = requirement_rewrite %impl.elem1.loc19_40.1, [concrete] -// CHECK:STDOUT: %.Self.ref.loc19_55: %I3.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc19_55: type = facet_access_type %.Self.ref.loc19_55 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc19_55: type = converted %.Self.ref.loc19_55, %.Self.as_type.loc19_55 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %rewrite.loc44_44.1 = requirement_rewrite %impl.elem1.loc44_40.1, [concrete] +// CHECK:STDOUT: %.Self.ref.loc44_55: %I3.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc44_55: type = facet_access_type %.Self.ref.loc44_55 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc44_55: type = converted %.Self.ref.loc44_55, %.Self.as_type.loc44_55 [symbolic_self = constants.%.Self.frozen.as_type] // CHECK:STDOUT: %T3.ref: %I3.assoc_type = name_ref T3, imports.%Main.import_ref.c31 [concrete = constants.%assoc2] -// CHECK:STDOUT: %impl.elem2.loc19_55.1: type = impl_witness_access constants.%.408, element2 [symbolic_self = constants.%impl.elem2.926] +// CHECK:STDOUT: %impl.elem2.loc44_55.1: type = impl_witness_access constants.%.408, element2 [symbolic_self = constants.%impl.elem2.926] // CHECK:STDOUT: %BAD4.ref: = name_ref BAD4, [concrete = ] -// CHECK:STDOUT: %rewrite.loc19_59.1 = requirement_rewrite %impl.elem2.loc19_55.1, [concrete] -// CHECK:STDOUT: %impl.elem0.loc19_21.2: type = impl_witness_access constants.%.dbd, element0 [symbolic_self = constants.%impl.elem0.91b] -// CHECK:STDOUT: %rewrite.loc19_25.2 = requirement_rewrite %impl.elem0.loc19_21.2, %struct_type.b [concrete] -// CHECK:STDOUT: %impl.elem1.loc19_40.2: type = impl_witness_access constants.%.dbd, element1 [symbolic_self = constants.%impl.elem1.4e8] -// CHECK:STDOUT: %rewrite.loc19_44.2 = requirement_rewrite %impl.elem1.loc19_40.2, [concrete] -// CHECK:STDOUT: %impl.elem2.loc19_55.2: type = impl_witness_access constants.%.dbd, element2 [symbolic_self = constants.%impl.elem2.5f8] -// CHECK:STDOUT: %rewrite.loc19_59.2 = requirement_rewrite %impl.elem2.loc19_55.2, [concrete] -// CHECK:STDOUT: %.loc19_15: type = where_expr [concrete = ] { +// CHECK:STDOUT: %rewrite.loc44_59.1 = requirement_rewrite %impl.elem2.loc44_55.1, [concrete] +// CHECK:STDOUT: %impl.elem0.loc44_21.2: type = impl_witness_access constants.%.dbd, element0 [symbolic_self = constants.%impl.elem0.91b] +// CHECK:STDOUT: %rewrite.loc44_25.2 = requirement_rewrite %impl.elem0.loc44_21.2, %struct_type.b [concrete] +// CHECK:STDOUT: %impl.elem1.loc44_40.2: type = impl_witness_access constants.%.dbd, element1 [symbolic_self = constants.%impl.elem1.4e8] +// CHECK:STDOUT: %rewrite.loc44_44.2 = requirement_rewrite %impl.elem1.loc44_40.2, [concrete] +// CHECK:STDOUT: %impl.elem2.loc44_55.2: type = impl_witness_access constants.%.dbd, element2 [symbolic_self = constants.%impl.elem2.5f8] +// CHECK:STDOUT: %rewrite.loc44_59.2 = requirement_rewrite %impl.elem2.loc44_55.2, [concrete] +// CHECK:STDOUT: %.loc44_15: type = where_expr [concrete = ] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I3.ref [concrete] -// CHECK:STDOUT: %rewrite.loc19_25.2 = requirement_rewrite %impl.elem0.loc19_21.2, %struct_type.b [concrete] -// CHECK:STDOUT: %rewrite.loc19_44.2 = requirement_rewrite %impl.elem1.loc19_40.2, [concrete] -// CHECK:STDOUT: %rewrite.loc19_59.2 = requirement_rewrite %impl.elem2.loc19_55.2, [concrete] +// CHECK:STDOUT: %rewrite.loc44_25.2 = requirement_rewrite %impl.elem0.loc44_21.2, %struct_type.b [concrete] +// CHECK:STDOUT: %rewrite.loc44_44.2 = requirement_rewrite %impl.elem1.loc44_40.2, [concrete] +// CHECK:STDOUT: %rewrite.loc44_59.2 = requirement_rewrite %impl.elem2.loc44_55.2, [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -1001,7 +1077,7 @@ impl CD as IF where .F = 0 { // CHECK:STDOUT: %C6.ref: type = name_ref C6, file.%C6.decl [concrete = constants.%C6] // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc11: = impl_self_witness @C6.as.I.impl.e1b87a.2.%C6.ref, @I [concrete = constants.%.7ff] +// CHECK:STDOUT: %.loc25: = impl_self_witness @C6.as.I.impl.e1b87a.2.%C6.ref, @I [concrete = constants.%.7ff] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I [from "interface.carbon"] { @@ -1092,32 +1168,32 @@ impl CD as IF where .F = 0 { // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type] // CHECK:STDOUT: %.Self.frozen: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] -// CHECK:STDOUT: %.Self.ref.loc8_20: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc8_20: type = facet_access_type %.Self.ref.loc8_20 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc8_20: type = converted %.Self.ref.loc8_20, %.Self.as_type.loc8_20 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %T.ref.loc8_20: %I.assoc_type = name_ref T, imports.%Main.import_ref.b8f [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc8_20.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] -// CHECK:STDOUT: %.loc8_26.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc8_26.2: type = converted %.loc8_26.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %rewrite.loc8_23.1 = requirement_rewrite %impl.elem0.loc8_20.1, %.loc8_26.2 [concrete] -// CHECK:STDOUT: %.Self.ref.loc8_32: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc8_32: type = facet_access_type %.Self.ref.loc8_32 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc8_32: type = converted %.Self.ref.loc8_32, %.Self.as_type.loc8_32 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %T.ref.loc8_32: %I.assoc_type = name_ref T, imports.%Main.import_ref.b8f [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc8_32.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] -// CHECK:STDOUT: %impl.elem0.subst.loc8_32.1: type = impl_witness_access_substituted %impl.elem0.loc8_32.1, %.loc8_26.2 [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %.loc8_38.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_38.2: type = converted %.loc8_38.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %rewrite.loc8_35.1 = requirement_rewrite %impl.elem0.subst.loc8_32.1, %.loc8_38.2 [concrete] -// CHECK:STDOUT: %impl.elem0.loc8_20.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] -// CHECK:STDOUT: %rewrite.loc8_23.2 = requirement_rewrite %impl.elem0.loc8_20.2, %.loc8_26.2 [concrete] -// CHECK:STDOUT: %impl.elem0.loc8_32.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] -// CHECK:STDOUT: %impl.elem0.subst.loc8_32.2: type = impl_witness_access_substituted %impl.elem0.loc8_32.2, %.loc8_26.2 [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %rewrite.loc8_35.2 = requirement_rewrite %impl.elem0.subst.loc8_32.2, %.loc8_38.2 [concrete] -// CHECK:STDOUT: %.loc8_14: type = where_expr [concrete = ] { +// CHECK:STDOUT: %.Self.ref.loc14_20: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc14_20: type = facet_access_type %.Self.ref.loc14_20 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc14_20: type = converted %.Self.ref.loc14_20, %.Self.as_type.loc14_20 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %T.ref.loc14_20: %I.assoc_type = name_ref T, imports.%Main.import_ref.b8f [concrete = constants.%assoc0] +// CHECK:STDOUT: %impl.elem0.loc14_20.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] +// CHECK:STDOUT: %.loc14_26.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc14_26.2: type = converted %.loc14_26.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %rewrite.loc14_23.1 = requirement_rewrite %impl.elem0.loc14_20.1, %.loc14_26.2 [concrete] +// CHECK:STDOUT: %.Self.ref.loc14_32: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc14_32: type = facet_access_type %.Self.ref.loc14_32 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc14_32: type = converted %.Self.ref.loc14_32, %.Self.as_type.loc14_32 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %T.ref.loc14_32: %I.assoc_type = name_ref T, imports.%Main.import_ref.b8f [concrete = constants.%assoc0] +// CHECK:STDOUT: %impl.elem0.loc14_32.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] +// CHECK:STDOUT: %impl.elem0.subst.loc14_32.1: type = impl_witness_access_substituted %impl.elem0.loc14_32.1, %.loc14_26.2 [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc14_38.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc14_38.2: type = converted %.loc14_38.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %rewrite.loc14_35.1 = requirement_rewrite %impl.elem0.subst.loc14_32.1, %.loc14_38.2 [concrete] +// CHECK:STDOUT: %impl.elem0.loc14_20.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] +// CHECK:STDOUT: %rewrite.loc14_23.2 = requirement_rewrite %impl.elem0.loc14_20.2, %.loc14_26.2 [concrete] +// CHECK:STDOUT: %impl.elem0.loc14_32.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] +// CHECK:STDOUT: %impl.elem0.subst.loc14_32.2: type = impl_witness_access_substituted %impl.elem0.loc14_32.2, %.loc14_26.2 [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %rewrite.loc14_35.2 = requirement_rewrite %impl.elem0.subst.loc14_32.2, %.loc14_38.2 [concrete] +// CHECK:STDOUT: %.loc14_14: type = where_expr [concrete = ] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] -// CHECK:STDOUT: %rewrite.loc8_23.2 = requirement_rewrite %impl.elem0.loc8_20.2, %.loc8_26.2 [concrete] -// CHECK:STDOUT: %rewrite.loc8_35.2 = requirement_rewrite %impl.elem0.subst.loc8_32.2, %.loc8_38.2 [concrete] +// CHECK:STDOUT: %rewrite.loc14_23.2 = requirement_rewrite %impl.elem0.loc14_20.2, %.loc14_26.2 [concrete] +// CHECK:STDOUT: %rewrite.loc14_35.2 = requirement_rewrite %impl.elem0.subst.loc14_32.2, %.loc14_38.2 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -1201,31 +1277,31 @@ impl CD as IF where .F = 0 { // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type] // CHECK:STDOUT: %.Self.frozen: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] -// CHECK:STDOUT: %.Self.ref.loc8_20: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc8_20: type = facet_access_type %.Self.ref.loc8_20 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc8_20: type = converted %.Self.ref.loc8_20, %.Self.as_type.loc8_20 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %T.ref.loc8_20: %I.assoc_type = name_ref T, imports.%Main.import_ref.b8f [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc8_20.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] +// CHECK:STDOUT: %.Self.ref.loc12_20: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc12_20: type = facet_access_type %.Self.ref.loc12_20 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc12_20: type = converted %.Self.ref.loc12_20, %.Self.as_type.loc12_20 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %T.ref.loc12_20: %I.assoc_type = name_ref T, imports.%Main.import_ref.b8f [concrete = constants.%assoc0] +// CHECK:STDOUT: %impl.elem0.loc12_20.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] // CHECK:STDOUT: %BAD5.ref: = name_ref BAD5, [concrete = ] -// CHECK:STDOUT: %rewrite.loc8_23.1 = requirement_rewrite %impl.elem0.loc8_20.1, [concrete] -// CHECK:STDOUT: %.Self.ref.loc8_34: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc8_34: type = facet_access_type %.Self.ref.loc8_34 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc8_34: type = converted %.Self.ref.loc8_34, %.Self.as_type.loc8_34 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %T.ref.loc8_34: %I.assoc_type = name_ref T, imports.%Main.import_ref.b8f [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc8_34.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] -// CHECK:STDOUT: %impl.elem0.subst.loc8_34.1: type = impl_witness_access_substituted %impl.elem0.loc8_34.1, [concrete = ] -// CHECK:STDOUT: %.loc8_40.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_40.2: type = converted %.loc8_40.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %rewrite.loc8_37.1 = requirement_rewrite %impl.elem0.subst.loc8_34.1, %.loc8_40.2 [concrete] -// CHECK:STDOUT: %impl.elem0.loc8_20.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] -// CHECK:STDOUT: %rewrite.loc8_23.2 = requirement_rewrite %impl.elem0.loc8_20.2, [concrete] -// CHECK:STDOUT: %impl.elem0.loc8_34.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] -// CHECK:STDOUT: %impl.elem0.subst.loc8_34.2: type = impl_witness_access_substituted %impl.elem0.loc8_34.2, [concrete = ] -// CHECK:STDOUT: %rewrite.loc8_37.2 = requirement_rewrite %impl.elem0.subst.loc8_34.2, %.loc8_40.2 [concrete] -// CHECK:STDOUT: %.loc8_14: type = where_expr [concrete = ] { +// CHECK:STDOUT: %rewrite.loc12_23.1 = requirement_rewrite %impl.elem0.loc12_20.1, [concrete] +// CHECK:STDOUT: %.Self.ref.loc12_34: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc12_34: type = facet_access_type %.Self.ref.loc12_34 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc12_34: type = converted %.Self.ref.loc12_34, %.Self.as_type.loc12_34 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %T.ref.loc12_34: %I.assoc_type = name_ref T, imports.%Main.import_ref.b8f [concrete = constants.%assoc0] +// CHECK:STDOUT: %impl.elem0.loc12_34.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] +// CHECK:STDOUT: %impl.elem0.subst.loc12_34.1: type = impl_witness_access_substituted %impl.elem0.loc12_34.1, [concrete = ] +// CHECK:STDOUT: %.loc12_40.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc12_40.2: type = converted %.loc12_40.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %rewrite.loc12_37.1 = requirement_rewrite %impl.elem0.subst.loc12_34.1, %.loc12_40.2 [concrete] +// CHECK:STDOUT: %impl.elem0.loc12_20.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] +// CHECK:STDOUT: %rewrite.loc12_23.2 = requirement_rewrite %impl.elem0.loc12_20.2, [concrete] +// CHECK:STDOUT: %impl.elem0.loc12_34.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] +// CHECK:STDOUT: %impl.elem0.subst.loc12_34.2: type = impl_witness_access_substituted %impl.elem0.loc12_34.2, [concrete = ] +// CHECK:STDOUT: %rewrite.loc12_37.2 = requirement_rewrite %impl.elem0.subst.loc12_34.2, %.loc12_40.2 [concrete] +// CHECK:STDOUT: %.loc12_14: type = where_expr [concrete = ] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] -// CHECK:STDOUT: %rewrite.loc8_23.2 = requirement_rewrite %impl.elem0.loc8_20.2, [concrete] -// CHECK:STDOUT: %rewrite.loc8_37.2 = requirement_rewrite %impl.elem0.subst.loc8_34.2, %.loc8_40.2 [concrete] +// CHECK:STDOUT: %rewrite.loc12_23.2 = requirement_rewrite %impl.elem0.loc12_20.2, [concrete] +// CHECK:STDOUT: %rewrite.loc12_37.2 = requirement_rewrite %impl.elem0.subst.loc12_34.2, %.loc12_40.2 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -1308,31 +1384,31 @@ impl CD as IF where .F = 0 { // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type] // CHECK:STDOUT: %.Self.frozen: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] -// CHECK:STDOUT: %.Self.ref.loc8_20: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc8_20: type = facet_access_type %.Self.ref.loc8_20 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc8_20: type = converted %.Self.ref.loc8_20, %.Self.as_type.loc8_20 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %T.ref.loc8_20: %I.assoc_type = name_ref T, imports.%Main.import_ref.b8f [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc8_20.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] -// CHECK:STDOUT: %.loc8_26.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc8_26.2: type = converted %.loc8_26.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %rewrite.loc8_23.1 = requirement_rewrite %impl.elem0.loc8_20.1, %.loc8_26.2 [concrete] -// CHECK:STDOUT: %.Self.ref.loc8_32: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc8_32: type = facet_access_type %.Self.ref.loc8_32 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc8_32: type = converted %.Self.ref.loc8_32, %.Self.as_type.loc8_32 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %T.ref.loc8_32: %I.assoc_type = name_ref T, imports.%Main.import_ref.b8f [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc8_32.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] -// CHECK:STDOUT: %impl.elem0.subst.loc8_32.1: type = impl_witness_access_substituted %impl.elem0.loc8_32.1, %.loc8_26.2 [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.Self.ref.loc13_20: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc13_20: type = facet_access_type %.Self.ref.loc13_20 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc13_20: type = converted %.Self.ref.loc13_20, %.Self.as_type.loc13_20 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %T.ref.loc13_20: %I.assoc_type = name_ref T, imports.%Main.import_ref.b8f [concrete = constants.%assoc0] +// CHECK:STDOUT: %impl.elem0.loc13_20.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] +// CHECK:STDOUT: %.loc13_26.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc13_26.2: type = converted %.loc13_26.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %rewrite.loc13_23.1 = requirement_rewrite %impl.elem0.loc13_20.1, %.loc13_26.2 [concrete] +// CHECK:STDOUT: %.Self.ref.loc13_32: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc13_32: type = facet_access_type %.Self.ref.loc13_32 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc13_32: type = converted %.Self.ref.loc13_32, %.Self.as_type.loc13_32 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %T.ref.loc13_32: %I.assoc_type = name_ref T, imports.%Main.import_ref.b8f [concrete = constants.%assoc0] +// CHECK:STDOUT: %impl.elem0.loc13_32.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] +// CHECK:STDOUT: %impl.elem0.subst.loc13_32.1: type = impl_witness_access_substituted %impl.elem0.loc13_32.1, %.loc13_26.2 [concrete = constants.%empty_struct_type] // CHECK:STDOUT: %BAD6.ref: = name_ref BAD6, [concrete = ] -// CHECK:STDOUT: %rewrite.loc8_35.1 = requirement_rewrite %impl.elem0.subst.loc8_32.1, [concrete] -// CHECK:STDOUT: %impl.elem0.loc8_20.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] -// CHECK:STDOUT: %rewrite.loc8_23.2 = requirement_rewrite %impl.elem0.loc8_20.2, %.loc8_26.2 [concrete] -// CHECK:STDOUT: %impl.elem0.loc8_32.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] -// CHECK:STDOUT: %impl.elem0.subst.loc8_32.2: type = impl_witness_access_substituted %impl.elem0.loc8_32.2, %.loc8_26.2 [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %rewrite.loc8_35.2 = requirement_rewrite %impl.elem0.subst.loc8_32.2, [concrete] -// CHECK:STDOUT: %.loc8_14: type = where_expr [concrete = ] { +// CHECK:STDOUT: %rewrite.loc13_35.1 = requirement_rewrite %impl.elem0.subst.loc13_32.1, [concrete] +// CHECK:STDOUT: %impl.elem0.loc13_20.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] +// CHECK:STDOUT: %rewrite.loc13_23.2 = requirement_rewrite %impl.elem0.loc13_20.2, %.loc13_26.2 [concrete] +// CHECK:STDOUT: %impl.elem0.loc13_32.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] +// CHECK:STDOUT: %impl.elem0.subst.loc13_32.2: type = impl_witness_access_substituted %impl.elem0.loc13_32.2, %.loc13_26.2 [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %rewrite.loc13_35.2 = requirement_rewrite %impl.elem0.subst.loc13_32.2, [concrete] +// CHECK:STDOUT: %.loc13_14: type = where_expr [concrete = ] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] -// CHECK:STDOUT: %rewrite.loc8_23.2 = requirement_rewrite %impl.elem0.loc8_20.2, %.loc8_26.2 [concrete] -// CHECK:STDOUT: %rewrite.loc8_35.2 = requirement_rewrite %impl.elem0.subst.loc8_32.2, [concrete] +// CHECK:STDOUT: %rewrite.loc13_23.2 = requirement_rewrite %impl.elem0.loc13_20.2, %.loc13_26.2 [concrete] +// CHECK:STDOUT: %rewrite.loc13_35.2 = requirement_rewrite %impl.elem0.subst.loc13_32.2, [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -1415,30 +1491,30 @@ impl CD as IF where .F = 0 { // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type] // CHECK:STDOUT: %.Self.frozen: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] -// CHECK:STDOUT: %.Self.ref.loc10_20: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc10_20: type = facet_access_type %.Self.ref.loc10_20 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc10_20: type = converted %.Self.ref.loc10_20, %.Self.as_type.loc10_20 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %T.ref.loc10_20: %I.assoc_type = name_ref T, imports.%Main.import_ref.b8f [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc10_20.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] +// CHECK:STDOUT: %.Self.ref.loc19_20: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc19_20: type = facet_access_type %.Self.ref.loc19_20 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc19_20: type = converted %.Self.ref.loc19_20, %.Self.as_type.loc19_20 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %T.ref.loc19_20: %I.assoc_type = name_ref T, imports.%Main.import_ref.b8f [concrete = constants.%assoc0] +// CHECK:STDOUT: %impl.elem0.loc19_20.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] // CHECK:STDOUT: %BAD7.ref: = name_ref BAD7, [concrete = ] -// CHECK:STDOUT: %rewrite.loc10_23.1 = requirement_rewrite %impl.elem0.loc10_20.1, [concrete] -// CHECK:STDOUT: %.Self.ref.loc10_34: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc10_34: type = facet_access_type %.Self.ref.loc10_34 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc10_34: type = converted %.Self.ref.loc10_34, %.Self.as_type.loc10_34 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %T.ref.loc10_34: %I.assoc_type = name_ref T, imports.%Main.import_ref.b8f [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc10_34.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] -// CHECK:STDOUT: %impl.elem0.subst.loc10_34.1: type = impl_witness_access_substituted %impl.elem0.loc10_34.1, [concrete = ] +// CHECK:STDOUT: %rewrite.loc19_23.1 = requirement_rewrite %impl.elem0.loc19_20.1, [concrete] +// CHECK:STDOUT: %.Self.ref.loc19_34: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc19_34: type = facet_access_type %.Self.ref.loc19_34 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc19_34: type = converted %.Self.ref.loc19_34, %.Self.as_type.loc19_34 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %T.ref.loc19_34: %I.assoc_type = name_ref T, imports.%Main.import_ref.b8f [concrete = constants.%assoc0] +// CHECK:STDOUT: %impl.elem0.loc19_34.1: type = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.fc9] +// CHECK:STDOUT: %impl.elem0.subst.loc19_34.1: type = impl_witness_access_substituted %impl.elem0.loc19_34.1, [concrete = ] // CHECK:STDOUT: %BAD8.ref: = name_ref BAD8, [concrete = ] -// CHECK:STDOUT: %rewrite.loc10_37.1 = requirement_rewrite %impl.elem0.subst.loc10_34.1, [concrete] -// CHECK:STDOUT: %impl.elem0.loc10_20.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] -// CHECK:STDOUT: %rewrite.loc10_23.2 = requirement_rewrite %impl.elem0.loc10_20.2, [concrete] -// CHECK:STDOUT: %impl.elem0.loc10_34.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] -// CHECK:STDOUT: %impl.elem0.subst.loc10_34.2: type = impl_witness_access_substituted %impl.elem0.loc10_34.2, [concrete = ] -// CHECK:STDOUT: %rewrite.loc10_37.2 = requirement_rewrite %impl.elem0.subst.loc10_34.2, [concrete] -// CHECK:STDOUT: %.loc10_14: type = where_expr [concrete = ] { +// CHECK:STDOUT: %rewrite.loc19_37.1 = requirement_rewrite %impl.elem0.subst.loc19_34.1, [concrete] +// CHECK:STDOUT: %impl.elem0.loc19_20.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] +// CHECK:STDOUT: %rewrite.loc19_23.2 = requirement_rewrite %impl.elem0.loc19_20.2, [concrete] +// CHECK:STDOUT: %impl.elem0.loc19_34.2: type = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.c0c] +// CHECK:STDOUT: %impl.elem0.subst.loc19_34.2: type = impl_witness_access_substituted %impl.elem0.loc19_34.2, [concrete = ] +// CHECK:STDOUT: %rewrite.loc19_37.2 = requirement_rewrite %impl.elem0.subst.loc19_34.2, [concrete] +// CHECK:STDOUT: %.loc19_14: type = where_expr [concrete = ] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] -// CHECK:STDOUT: %rewrite.loc10_23.2 = requirement_rewrite %impl.elem0.loc10_20.2, [concrete] -// CHECK:STDOUT: %rewrite.loc10_37.2 = requirement_rewrite %impl.elem0.subst.loc10_34.2, [concrete] +// CHECK:STDOUT: %rewrite.loc19_23.2 = requirement_rewrite %impl.elem0.loc19_20.2, [concrete] +// CHECK:STDOUT: %rewrite.loc19_37.2 = requirement_rewrite %impl.elem0.subst.loc19_34.2, [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -1809,19 +1885,19 @@ impl CD as IF where .F = 0 { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %IF.ref [concrete] // CHECK:STDOUT: %.Self.ref: %IF.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc8_21: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc13_21: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.frozen.as_type] // CHECK:STDOUT: %F.ref: %IF.assoc_type = name_ref F, imports.%Main.import_ref.ad5 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc8_21.1: %.d0c = impl_witness_access constants.%.3bb, element0 [symbolic_self = constants.%impl.elem0.fb7] +// CHECK:STDOUT: %impl.elem0.loc13_21.1: %.d0c = impl_witness_access constants.%.3bb, element0 [symbolic_self = constants.%impl.elem0.fb7] // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] -// CHECK:STDOUT: %rewrite.loc8_24.1 = requirement_rewrite %impl.elem0.loc8_21.1, %int_0 [concrete] -// CHECK:STDOUT: %impl.elem0.loc8_21.2: %.e24 = impl_witness_access constants.%.1c7, element0 [symbolic_self = constants.%impl.elem0.b9d] -// CHECK:STDOUT: %rewrite.loc8_24.2 = requirement_rewrite %impl.elem0.loc8_21.2, %int_0 [concrete] -// CHECK:STDOUT: %.loc8_15: type = where_expr [concrete = constants.%IF_where.type.dd6] { +// CHECK:STDOUT: %rewrite.loc13_24.1 = requirement_rewrite %impl.elem0.loc13_21.1, %int_0 [concrete] +// CHECK:STDOUT: %impl.elem0.loc13_21.2: %.e24 = impl_witness_access constants.%.1c7, element0 [symbolic_self = constants.%impl.elem0.b9d] +// CHECK:STDOUT: %rewrite.loc13_24.2 = requirement_rewrite %impl.elem0.loc13_21.2, %int_0 [concrete] +// CHECK:STDOUT: %.loc13_15: type = where_expr [concrete = constants.%IF_where.type.dd6] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %IF.ref [concrete] -// CHECK:STDOUT: %rewrite.loc8_24.2 = requirement_rewrite %impl.elem0.loc8_21.2, %int_0 [concrete] +// CHECK:STDOUT: %rewrite.loc13_24.2 = requirement_rewrite %impl.elem0.loc13_21.2, %int_0 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8: = impl_self_witness @CD.as.IF.impl.%CD.ref, @IF [concrete = constants.%.1f4] +// CHECK:STDOUT: %.loc13: = impl_self_witness @CD.as.IF.impl.%CD.ref, @IF [concrete = constants.%.1f4] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @IF [from "interface_with_function.carbon"] { diff --git a/toolchain/check/testdata/impl/import_use_generic.carbon b/toolchain/check/testdata/impl/import_use_generic.carbon index abdc212553db..7e70a8c7f2f6 100644 --- a/toolchain/check/testdata/impl/import_use_generic.carbon +++ b/toolchain/check/testdata/impl/import_use_generic.carbon @@ -34,14 +34,38 @@ import library "import_generic"; var c: C({}) = {}; // We're just checking that this doesn't crash. It's not expected to compile. -// CHECK:STDERR: fail_use_in_fn_decl.carbon:[[@LINE+4]]:11-17: error: `Core.ImplicitAs` implicitly referenced here, but package `Core` not found [CoreNotFound] +// CHECK:STDERR: ╭─┤ fail_use_in_fn_decl.carbon:[[@LINE+16]]:11 +// CHECK:STDERR: -> │ fn G() -> c.(I.F)() {} +// CHECK:STDERR: · ┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `Core.ImplicitAs` implicitly referenced here, but package +// CHECK:STDERR: · ┃ `Core` not found +// CHECK:STDERR: · ┃ [CoreNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_use_in_fn_decl.carbon:[[@LINE+2]]:22: error: missing `return` at end of function with declared return type [MissingReturnStatement] +// CHECK:STDERR: ╭─┤ fail_use_in_fn_decl.carbon:[[@LINE+8]]:22 +// CHECK:STDERR: -> │ fn G() -> c.(I.F)() {} +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: missing `return` at end of function with +// CHECK:STDERR: · ┃ declared return type +// CHECK:STDERR: · ┃ [MissingReturnStatement] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn G() -> c.(I.F)() {} -// CHECK:STDERR: fail_use_in_fn_decl.carbon:[[@LINE+4]]:11-23: error: `Core.ImplicitAs` implicitly referenced here, but package `Core` not found [CoreNotFound] +// CHECK:STDERR: ╭─┤ fail_use_in_fn_decl.carbon:[[@LINE+16]]:11 +// CHECK:STDERR: -> │ fn H() -> C({}).(I.F)() {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `Core.ImplicitAs` implicitly referenced here, but package +// CHECK:STDERR: · ┃ `Core` not found +// CHECK:STDERR: · ┃ [CoreNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_use_in_fn_decl.carbon:[[@LINE+2]]:26: error: missing `return` at end of function with declared return type [MissingReturnStatement] +// CHECK:STDERR: ╭─┤ fail_use_in_fn_decl.carbon:[[@LINE+8]]:26 +// CHECK:STDERR: -> │ fn H() -> C({}).(I.F)() {} +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: missing `return` at end of function with +// CHECK:STDERR: · ┃ declared return type +// CHECK:STDERR: · ┃ [MissingReturnStatement] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn H() -> C({}).(I.F)() {} @@ -299,24 +323,24 @@ fn H() -> C({}).(I.F)() {} // CHECK:STDOUT: %c.ref: ref %C.664 = name_ref c, file.%c [concrete = file.%c.var] // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type] // CHECK:STDOUT: %F.ref: %I.assoc_type = name_ref F, imports.%Main.import_ref.a45 [concrete = constants.%assoc0] -// CHECK:STDOUT: %.loc12: %I.type = converted %c.ref, [concrete = ] +// CHECK:STDOUT: %.loc24: %I.type = converted %c.ref, [concrete = ] // CHECK:STDOUT: %return: = return_slot // CHECK:STDOUT: } // CHECK:STDOUT: %H.decl: %H.type = fn_decl @H [concrete = constants.%H] { // CHECK:STDOUT: %return.patt: = return_slot_pattern , [concrete = ] // CHECK:STDOUT: } { // CHECK:STDOUT: %C.ref: %C.type = name_ref C, imports.%Main.C [concrete = constants.%C.generic] -// CHECK:STDOUT: %.loc17_14: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc17_15: type = converted %.loc17_14, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc41_14: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc41_15: type = converted %.loc41_14, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: %C: type = class_type @C, @C(constants.%empty_struct_type) [concrete = constants.%C.664] // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type] // CHECK:STDOUT: %F.ref: %I.assoc_type = name_ref F, imports.%Main.import_ref.a45 [concrete = constants.%assoc0] // CHECK:STDOUT: %I.facet: %I.type = facet_value %C, (constants.%I.impl_witness.85d) [concrete = constants.%I.facet] -// CHECK:STDOUT: %.loc17_16: %I.type = converted %C, %I.facet [concrete = constants.%I.facet] +// CHECK:STDOUT: %.loc41_16: %I.type = converted %C, %I.facet [concrete = constants.%I.facet] // CHECK:STDOUT: %impl.elem0: %.250 = impl_witness_access constants.%I.impl_witness.85d, element0 [concrete = constants.%C.as.I.impl.F.bb5] // CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @C.as.I.impl.F(constants.%empty_struct_type) [concrete = constants.%C.as.I.impl.F.specific_fn] // CHECK:STDOUT: %C.as.I.impl.F.call: init %empty_tuple.type = call %specific_fn() -// CHECK:STDOUT: %.loc17_23: type = converted %C.as.I.impl.F.call, [concrete = ] +// CHECK:STDOUT: %.loc41_23: type = converted %C.as.I.impl.F.call, [concrete = ] // CHECK:STDOUT: %return: = return_slot // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/impl/incomplete.carbon b/toolchain/check/testdata/impl/incomplete.carbon index c27d64c1d256..f61087619f5d 100644 --- a/toolchain/check/testdata/impl/incomplete.carbon +++ b/toolchain/check/testdata/impl/incomplete.carbon @@ -20,8 +20,16 @@ interface I; // Requires I identified. impl {} as I; -// CHECK:STDERR: fail_empty_struct.carbon:[[@LINE+3]]:1-14: error: definition of impl as incomplete facet type `I` [ImplAsIncompleteFacetTypeDefinition] -// CHECK:STDERR: fail_empty_struct.carbon:[[@LINE-6]]:1-12: note: interface was forward declared here [InterfaceForwardDeclaredHere] +// CHECK:STDERR: ╭─┤ fail_empty_struct.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: │ interface I; +// CHECK:STDERR: · ──────┬───── +// CHECK:STDERR: · ╰──┤ interface was forward declared here [InterfaceForwardDeclaredHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ impl {} as I {} +// CHECK:STDERR: · ━━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: definition of impl as incomplete facet type `I` +// CHECK:STDERR: · ┃ [ImplAsIncompleteFacetTypeDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl {} as I {} @@ -32,12 +40,24 @@ interface J; class C {} // Requires I identified. -// CHECK:STDERR: fail_class.carbon:[[@LINE+2]]:11: error: name `I` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_class.carbon:[[@LINE+6]]:11 +// CHECK:STDERR: -> │ impl C as I; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: name `I` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl C as I; -// CHECK:STDERR: fail_class.carbon:[[@LINE+3]]:1-13: error: definition of impl as incomplete facet type `J` [ImplAsIncompleteFacetTypeDefinition] -// CHECK:STDERR: fail_class.carbon:[[@LINE-9]]:1-12: note: interface was forward declared here [InterfaceForwardDeclaredHere] +// CHECK:STDERR: ╭─┤ fail_class.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: │ interface J; +// CHECK:STDERR: · ──────┬───── +// CHECK:STDERR: · ╰──┤ interface was forward declared here [InterfaceForwardDeclaredHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ impl C as J {} +// CHECK:STDERR: · ━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: definition of impl as incomplete facet type `J` +// CHECK:STDERR: · ┃ [ImplAsIncompleteFacetTypeDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl C as J {} @@ -47,8 +67,16 @@ library "[[@TEST_NAME]]"; interface J; class C {} -// CHECK:STDERR: fail_class_no_forward_decl.carbon:[[@LINE+3]]:1-13: error: definition of impl as incomplete facet type `J` [ImplAsIncompleteFacetTypeDefinition] -// CHECK:STDERR: fail_class_no_forward_decl.carbon:[[@LINE-4]]:1-12: note: interface was forward declared here [InterfaceForwardDeclaredHere] +// CHECK:STDERR: ╭─┤ fail_class_no_forward_decl.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: │ interface J; +// CHECK:STDERR: · ──────┬───── +// CHECK:STDERR: · ╰──┤ interface was forward declared here [InterfaceForwardDeclaredHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ impl C as J {} +// CHECK:STDERR: · ━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: definition of impl as incomplete facet type `J` +// CHECK:STDERR: · ┃ [ImplAsIncompleteFacetTypeDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl C as J {} @@ -58,13 +86,29 @@ library "[[@TEST_NAME]]"; interface J; class C {} -// CHECK:STDERR: fail_class_with_rewrite.carbon:[[@LINE+3]]:19-20: error: member access into facet of incomplete type `J` [IncompleteTypeInMemberAccessOfFacet] -// CHECK:STDERR: fail_class_with_rewrite.carbon:[[@LINE-4]]:1-12: note: interface was forward declared here [InterfaceForwardDeclaredHere] +// CHECK:STDERR: ╭─┤ fail_class_with_rewrite.carbon:[[@LINE+11]]:19 +// CHECK:STDERR: │ interface J; +// CHECK:STDERR: · ──────┬───── +// CHECK:STDERR: · ╰──┤ interface was forward declared here [InterfaceForwardDeclaredHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ impl C as J where .X = (); +// CHECK:STDERR: · ━┳ +// CHECK:STDERR: · ┗━━┫ error: member access into facet of incomplete type `J` +// CHECK:STDERR: · ┃ [IncompleteTypeInMemberAccessOfFacet] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl C as J where .X = (); -// CHECK:STDERR: fail_class_with_rewrite.carbon:[[@LINE+3]]:19-20: error: member access into facet of incomplete type `J` [IncompleteTypeInMemberAccessOfFacet] -// CHECK:STDERR: fail_class_with_rewrite.carbon:[[@LINE-9]]:1-12: note: interface was forward declared here [InterfaceForwardDeclaredHere] +// CHECK:STDERR: ╭─┤ fail_class_with_rewrite.carbon:[[@LINE+11]]:19 +// CHECK:STDERR: │ interface J; +// CHECK:STDERR: · ──────┬───── +// CHECK:STDERR: · ╰──┤ interface was forward declared here [InterfaceForwardDeclaredHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ impl C as J where .X = () {} +// CHECK:STDERR: · ━┳ +// CHECK:STDERR: · ┗━━┫ error: member access into facet of incomplete type `J` +// CHECK:STDERR: · ┃ [IncompleteTypeInMemberAccessOfFacet] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl C as J where .X = () {} @@ -106,7 +150,13 @@ class C {} interface I {} interface Incomplete; -// CHECK:STDERR: fail_incomplete_where_definition.carbon:[[@LINE+2]]:1-42: error: constraint `I where .Self impls Incomplete` being implemented requires that `C` implements `Incomplete` [IdentifiedRequireImplsNotImplemented] +// CHECK:STDERR: ╭─┤ fail_incomplete_where_definition.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ impl C as I where .Self impls Incomplete {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: constraint `I where .Self impls Incomplete` being implemented +// CHECK:STDERR: · ┃ requires that `C` implements `Incomplete` +// CHECK:STDERR: · ┃ [IdentifiedRequireImplsNotImplemented] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl C as I where .Self impls Incomplete {} @@ -118,11 +168,27 @@ class C {} interface I {} interface Incomplete; -// CHECK:STDERR: fail_declaration_lookup_into_incomplete.carbon:[[@LINE+2]]:1-42: error: constraint `I where .Self impls Incomplete` being implemented requires that `C` implements `Incomplete` [IdentifiedRequireImplsNotImplemented] +// CHECK:STDERR: ╭─┤ fail_declaration_lookup_into_incomplete.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ impl C as I where .Self impls Incomplete { +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: constraint `I where .Self impls Incomplete` being implemented +// CHECK:STDERR: · ┃ requires that `C` implements `Incomplete` +// CHECK:STDERR: · ┃ [IdentifiedRequireImplsNotImplemented] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl C as I where .Self impls Incomplete { - // CHECK:STDERR: fail_declaration_lookup_into_incomplete.carbon:[[@LINE+3]]:19-30: error: member access into incomplete facet type `Incomplete` [QualifiedExprInIncompleteFacetTypeScope] - // CHECK:STDERR: fail_declaration_lookup_into_incomplete.carbon:[[@LINE-6]]:1-21: note: interface was forward declared here [InterfaceForwardDeclaredHere] + // CHECK:STDERR: ╭─┤ fail_declaration_lookup_into_incomplete.carbon:[[@LINE+13]]:19 + // CHECK:STDERR: │ interface Incomplete; + // CHECK:STDERR: · ──────────┬────────── + // CHECK:STDERR: · ╰──┤ interface was forward declared here + // CHECK:STDERR: · │ [InterfaceForwardDeclaredHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ fn F() -> Self.(Incomplete.T); + // CHECK:STDERR: · ┳━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: member access into incomplete facet type + // CHECK:STDERR: · ┃ `Incomplete` + // CHECK:STDERR: · ┃ [QualifiedExprInIncompleteFacetTypeScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn F() -> Self.(Incomplete.T); }; @@ -134,8 +200,17 @@ constraint X; class C {} // Requires X identified. -// CHECK:STDERR: fail_unidentified_constraint.carbon:[[@LINE+3]]:1-12: error: facet type `X` cannot be identified in `impl as` [ImplOfUnidentifiedFacetType] -// CHECK:STDERR: fail_unidentified_constraint.carbon:[[@LINE-5]]:1-13: note: constraint was forward declared here [NamedConstraintForwardDeclaredHere] +// CHECK:STDERR: ╭─┤ fail_unidentified_constraint.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: │ constraint X; +// CHECK:STDERR: · ──────┬────── +// CHECK:STDERR: · ╰──┤ constraint was forward declared here +// CHECK:STDERR: · │ [NamedConstraintForwardDeclaredHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ impl C as X; +// CHECK:STDERR: · ━━━━━━┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: facet type `X` cannot be identified in `impl as` +// CHECK:STDERR: · ┃ [ImplOfUnidentifiedFacetType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl C as X; @@ -163,8 +238,18 @@ library "[[@TEST_NAME]]"; constraint A; interface B { - // CHECK:STDERR: fail_incomplete_constraint.carbon:[[@LINE+3]]:17: error: facet type `A` cannot be identified in `require` declaration [RequireImplsUnidentifiedFacetType] - // CHECK:STDERR: fail_incomplete_constraint.carbon:[[@LINE-4]]:1-13: note: constraint was forward declared here [NamedConstraintForwardDeclaredHere] + // CHECK:STDERR: ╭─┤ fail_incomplete_constraint.carbon:[[@LINE+13]]:17 + // CHECK:STDERR: │ constraint A; + // CHECK:STDERR: · ──────┬────── + // CHECK:STDERR: · ╰──┤ constraint was forward declared here + // CHECK:STDERR: · │ [NamedConstraintForwardDeclaredHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ require impls A; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: facet type `A` cannot be identified in `require` + // CHECK:STDERR: · ┃ declaration + // CHECK:STDERR: · ┃ [RequireImplsUnidentifiedFacetType] + // CHECK:STDERR: ╰──── // CHECK:STDERR: require impls A; } @@ -192,11 +277,11 @@ interface B { // CHECK:STDOUT: } // CHECK:STDOUT: %.loc6: = impl_self_witness @empty_struct_type.as.I.impl.%.loc6_7.2, @I [concrete = constants.%.aaf] // CHECK:STDOUT: impl_decl @empty_struct_type.as.I.impl [concrete] {} { -// CHECK:STDOUT: %.loc11_7.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc11_7.2: type = converted %.loc11_7.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %I.ref.loc11: type = name_ref I, file.%I.decl [concrete = constants.%I.type] +// CHECK:STDOUT: %.loc19_7.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc19_7.2: type = converted %.loc19_7.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %I.ref.loc19: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc11: = impl_self_witness @empty_struct_type.as.I.impl.%.loc11_7.2, @I [concrete = constants.%.aaf] +// CHECK:STDOUT: %.loc19: = impl_self_witness @empty_struct_type.as.I.impl.%.loc19_7.2, @I [concrete = constants.%.aaf] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I; @@ -238,7 +323,7 @@ interface B { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [concrete = constants.%J.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc14: = impl_self_witness @C.as.J.impl.%C.ref, @J [concrete = constants.%.ffd] +// CHECK:STDOUT: %.loc26: = impl_self_witness @C.as.J.impl.%C.ref, @J [concrete = constants.%.ffd] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @J; @@ -285,7 +370,7 @@ interface B { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [concrete = constants.%J.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc9: = impl_self_witness @C.as.J.impl.%C.ref, @J [concrete = constants.%.ffd] +// CHECK:STDOUT: %.loc17: = impl_self_witness @C.as.J.impl.%C.ref, @J [concrete = constants.%.ffd] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @J; @@ -329,42 +414,42 @@ interface B { // CHECK:STDOUT: %J.decl: type = interface_decl @J [concrete = constants.%J.type] {} {} // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {} // CHECK:STDOUT: impl_decl @C.as..impl [concrete] {} { -// CHECK:STDOUT: %C.ref.loc9: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %J.ref.loc9: type = name_ref J, file.%J.decl [concrete = constants.%J.type] -// CHECK:STDOUT: %.Self.frozen.loc9: %J.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %base_facet_type.loc9 = requirement_base_facet_type %J.ref.loc9 [concrete] -// CHECK:STDOUT: %.Self.ref.loc9: %J.type = name_ref .Self, %.Self.frozen.loc9 [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc9: type = facet_access_type %.Self.ref.loc9 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc9_19: type = converted %.Self.ref.loc9, %.Self.as_type.loc9 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %X.ref.loc9: = name_ref X, [concrete = ] -// CHECK:STDOUT: %.loc9_25: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %rewrite.loc9 = requirement_rewrite %X.ref.loc9, [concrete] -// CHECK:STDOUT: %.loc9_13: type = where_expr [concrete = ] { -// CHECK:STDOUT: %base_facet_type.loc9 = requirement_base_facet_type %J.ref.loc9 [concrete] -// CHECK:STDOUT: %rewrite.loc9 = requirement_rewrite %X.ref.loc9, [concrete] +// CHECK:STDOUT: %C.ref.loc17: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %J.ref.loc17: type = name_ref J, file.%J.decl [concrete = constants.%J.type] +// CHECK:STDOUT: %.Self.frozen.loc17: %J.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %base_facet_type.loc17 = requirement_base_facet_type %J.ref.loc17 [concrete] +// CHECK:STDOUT: %.Self.ref.loc17: %J.type = name_ref .Self, %.Self.frozen.loc17 [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc17: type = facet_access_type %.Self.ref.loc17 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc17_19: type = converted %.Self.ref.loc17, %.Self.as_type.loc17 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %X.ref.loc17: = name_ref X, [concrete = ] +// CHECK:STDOUT: %.loc17_25: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %rewrite.loc17 = requirement_rewrite %X.ref.loc17, [concrete] +// CHECK:STDOUT: %.loc17_13: type = where_expr [concrete = ] { +// CHECK:STDOUT: %base_facet_type.loc17 = requirement_base_facet_type %J.ref.loc17 [concrete] +// CHECK:STDOUT: %rewrite.loc17 = requirement_rewrite %X.ref.loc17, [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: impl_decl @C.as..impl [concrete] {} { -// CHECK:STDOUT: %C.ref.loc14: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %J.ref.loc14: type = name_ref J, file.%J.decl [concrete = constants.%J.type] -// CHECK:STDOUT: %.Self.frozen.loc14: %J.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %base_facet_type.loc14 = requirement_base_facet_type %J.ref.loc14 [concrete] -// CHECK:STDOUT: %.Self.ref.loc14: %J.type = name_ref .Self, %.Self.frozen.loc14 [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.Self.as_type.loc14: type = facet_access_type %.Self.ref.loc14 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc14_19: type = converted %.Self.ref.loc14, %.Self.as_type.loc14 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %X.ref.loc14: = name_ref X, [concrete = ] -// CHECK:STDOUT: %.loc14_25: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %rewrite.loc14 = requirement_rewrite %X.ref.loc14, [concrete] -// CHECK:STDOUT: %.loc14_13: type = where_expr [concrete = ] { -// CHECK:STDOUT: %base_facet_type.loc14 = requirement_base_facet_type %J.ref.loc14 [concrete] -// CHECK:STDOUT: %rewrite.loc14 = requirement_rewrite %X.ref.loc14, [concrete] +// CHECK:STDOUT: %C.ref.loc30: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %J.ref.loc30: type = name_ref J, file.%J.decl [concrete = constants.%J.type] +// CHECK:STDOUT: %.Self.frozen.loc30: %J.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %base_facet_type.loc30 = requirement_base_facet_type %J.ref.loc30 [concrete] +// CHECK:STDOUT: %.Self.ref.loc30: %J.type = name_ref .Self, %.Self.frozen.loc30 [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.as_type.loc30: type = facet_access_type %.Self.ref.loc30 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc30_19: type = converted %.Self.ref.loc30, %.Self.as_type.loc30 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %X.ref.loc30: = name_ref X, [concrete = ] +// CHECK:STDOUT: %.loc30_25: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %rewrite.loc30 = requirement_rewrite %X.ref.loc30, [concrete] +// CHECK:STDOUT: %.loc30_13: type = where_expr [concrete = ] { +// CHECK:STDOUT: %base_facet_type.loc30 = requirement_base_facet_type %J.ref.loc30 [concrete] +// CHECK:STDOUT: %rewrite.loc30 = requirement_rewrite %X.ref.loc30, [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @J; // CHECK:STDOUT: -// CHECK:STDOUT: impl @C.as..impl: %C.ref.loc9 as { +// CHECK:STDOUT: impl @C.as..impl: %C.ref.loc17 as { // CHECK:STDOUT: !members: // CHECK:STDOUT: extend // CHECK:STDOUT: witness = @@ -746,22 +831,22 @@ interface B { // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: %.Self.frozen: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] -// CHECK:STDOUT: %.Self.ref.loc10_19.1: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.ref.loc16_19.1: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %Incomplete.ref: type = name_ref Incomplete, file.%Incomplete.decl [concrete = constants.%Incomplete.type] -// CHECK:STDOUT: %.Self.as_type.loc10_19.1: type = facet_access_type %.Self.ref.loc10_19.1 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc10_19.1: type = converted %.Self.ref.loc10_19.1, %.Self.as_type.loc10_19.1 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %impls.loc10_25.1 = requirement_impls %.loc10_19.1, %Incomplete.ref [concrete] +// CHECK:STDOUT: %.Self.as_type.loc16_19.1: type = facet_access_type %.Self.ref.loc16_19.1 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc16_19.1: type = converted %.Self.ref.loc16_19.1, %.Self.as_type.loc16_19.1 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %impls.loc16_25.1 = requirement_impls %.loc16_19.1, %Incomplete.ref [concrete] // CHECK:STDOUT: %.Self: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %.Self.ref.loc10_19.2: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %.Self.as_type.loc10_19.2: type = facet_access_type %.Self.ref.loc10_19.2 [symbolic_self = constants.%.Self.as_type] -// CHECK:STDOUT: %.loc10_19.2: type = converted %.Self.ref.loc10_19.1, %.Self.as_type.loc10_19.2 [symbolic_self = constants.%.Self.as_type] -// CHECK:STDOUT: %impls.loc10_25.2 = requirement_impls %.loc10_19.2, %Incomplete.ref [concrete] -// CHECK:STDOUT: %.loc10_13: type = where_expr [concrete = constants.%I_where.type] { +// CHECK:STDOUT: %.Self.ref.loc16_19.2: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self] +// CHECK:STDOUT: %.Self.as_type.loc16_19.2: type = facet_access_type %.Self.ref.loc16_19.2 [symbolic_self = constants.%.Self.as_type] +// CHECK:STDOUT: %.loc16_19.2: type = converted %.Self.ref.loc16_19.1, %.Self.as_type.loc16_19.2 [symbolic_self = constants.%.Self.as_type] +// CHECK:STDOUT: %impls.loc16_25.2 = requirement_impls %.loc16_19.2, %Incomplete.ref [concrete] +// CHECK:STDOUT: %.loc16_13: type = where_expr [concrete = constants.%I_where.type] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] -// CHECK:STDOUT: %impls.loc10_25.2 = requirement_impls %.loc10_19.2, %Incomplete.ref [concrete] +// CHECK:STDOUT: %impls.loc16_25.2 = requirement_impls %.loc16_19.2, %Incomplete.ref [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc10: = impl_self_witness @C.as.I.impl.%C.ref, @I [concrete = constants.%.b7f] +// CHECK:STDOUT: %.loc16: = impl_self_witness @C.as.I.impl.%C.ref, @I [concrete = constants.%.b7f] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { @@ -833,22 +918,22 @@ interface B { // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: %.Self.frozen: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] -// CHECK:STDOUT: %.Self.ref.loc10_19.1: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.Self.ref.loc16_19.1: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %Incomplete.ref: type = name_ref Incomplete, file.%Incomplete.decl [concrete = constants.%Incomplete.type] -// CHECK:STDOUT: %.Self.as_type.loc10_19.1: type = facet_access_type %.Self.ref.loc10_19.1 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc10_19.1: type = converted %.Self.ref.loc10_19.1, %.Self.as_type.loc10_19.1 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %impls.loc10_25.1 = requirement_impls %.loc10_19.1, %Incomplete.ref [concrete] +// CHECK:STDOUT: %.Self.as_type.loc16_19.1: type = facet_access_type %.Self.ref.loc16_19.1 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc16_19.1: type = converted %.Self.ref.loc16_19.1, %.Self.as_type.loc16_19.1 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %impls.loc16_25.1 = requirement_impls %.loc16_19.1, %Incomplete.ref [concrete] // CHECK:STDOUT: %.Self: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %.Self.ref.loc10_19.2: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %.Self.as_type.loc10_19.2: type = facet_access_type %.Self.ref.loc10_19.2 [symbolic_self = constants.%.Self.as_type] -// CHECK:STDOUT: %.loc10_19.2: type = converted %.Self.ref.loc10_19.1, %.Self.as_type.loc10_19.2 [symbolic_self = constants.%.Self.as_type] -// CHECK:STDOUT: %impls.loc10_25.2 = requirement_impls %.loc10_19.2, %Incomplete.ref [concrete] -// CHECK:STDOUT: %.loc10_13: type = where_expr [concrete = constants.%I_where.type] { +// CHECK:STDOUT: %.Self.ref.loc16_19.2: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self] +// CHECK:STDOUT: %.Self.as_type.loc16_19.2: type = facet_access_type %.Self.ref.loc16_19.2 [symbolic_self = constants.%.Self.as_type] +// CHECK:STDOUT: %.loc16_19.2: type = converted %.Self.ref.loc16_19.1, %.Self.as_type.loc16_19.2 [symbolic_self = constants.%.Self.as_type] +// CHECK:STDOUT: %impls.loc16_25.2 = requirement_impls %.loc16_19.2, %Incomplete.ref [concrete] +// CHECK:STDOUT: %.loc16_13: type = where_expr [concrete = constants.%I_where.type] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] -// CHECK:STDOUT: %impls.loc10_25.2 = requirement_impls %.loc10_19.2, %Incomplete.ref [concrete] +// CHECK:STDOUT: %impls.loc16_25.2 = requirement_impls %.loc16_19.2, %Incomplete.ref [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc10: = impl_self_witness @C.as.I.impl.%C.ref, @I [concrete = constants.%.b7f] +// CHECK:STDOUT: %.loc16: = impl_self_witness @C.as.I.impl.%C.ref, @I [concrete = constants.%.b7f] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { diff --git a/toolchain/check/testdata/impl/interface_args.carbon b/toolchain/check/testdata/impl/interface_args.carbon index 8969ee4740bf..8c5b536fa34d 100644 --- a/toolchain/check/testdata/impl/interface_args.carbon +++ b/toolchain/check/testdata/impl/interface_args.carbon @@ -40,7 +40,13 @@ fn G(a: A) { a.(Action(B).Op)(); } impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_action.impl.carbon:[[@LINE+2]]:14-29: error: cannot access member of interface `Action(C)` in type `A` that does not implement that interface [MissingImplInMemberAccess] +// CHECK:STDERR: ╭─┤ fail_action.impl.carbon:[[@LINE+8]]:14 +// CHECK:STDERR: -> │ fn G(a: A) { a.(Action(C).Op)(); } +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Action(C)` in type +// CHECK:STDERR: · ┃ `A` that does not implement that interface +// CHECK:STDERR: · ┃ [MissingImplInMemberAccess] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn G(a: A) { a.(Action(C).Op)(); } @@ -81,13 +87,24 @@ impl library "[[@TEST_NAME]]"; class C {} fn MakeC() -> C { - // CHECK:STDERR: fail_factory.impl.carbon:[[@LINE+2]]:10-28: error: cannot convert type `A` into type implementing `Factory(C)` [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╭─┤ fail_factory.impl.carbon:[[@LINE+7]]:10 + // CHECK:STDERR: -> │ return A.(Factory(C).Make)(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `A` into type implementing `Factory(C)` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return A.(Factory(C).Make)(); } fn InstanceC(a: A) -> C { - // CHECK:STDERR: fail_factory.impl.carbon:[[@LINE+2]]:10-30: error: cannot access member of interface `Factory(C)` in type `A` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_factory.impl.carbon:[[@LINE+8]]:10 + // CHECK:STDERR: -> │ return a.(Factory(C).Method)(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Factory(C)` in type `A` + // CHECK:STDERR: · ┃ that does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return a.(Factory(C).Method)(); } @@ -726,8 +743,8 @@ fn InstanceC(a: A) -> C { // CHECK:STDOUT: %Action.ref: %Action.type.538 = name_ref Action, imports.%Main.Action [concrete = constants.%Action.generic] // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [concrete = constants.%C] // CHECK:STDOUT: %Action.type: type = facet_type <@Action, @Action(constants.%C)> [concrete = constants.%Action.type.d5e] -// CHECK:STDOUT: %.loc6: %Action.assoc_type.1ac = specific_constant imports.%Main.import_ref.8fb, @Action.WithSelf(constants.%C, constants.%Self.60a) [concrete = constants.%assoc0.933] -// CHECK:STDOUT: %Op.ref: %Action.assoc_type.1ac = name_ref Op, %.loc6 [concrete = constants.%assoc0.933] +// CHECK:STDOUT: %.loc12: %Action.assoc_type.1ac = specific_constant imports.%Main.import_ref.8fb, @Action.WithSelf(constants.%C, constants.%Self.60a) [concrete = constants.%assoc0.933] +// CHECK:STDOUT: %Op.ref: %Action.assoc_type.1ac = name_ref Op, %.loc12 [concrete = constants.%assoc0.933] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1522,10 +1539,10 @@ fn InstanceC(a: A) -> C { // CHECK:STDOUT: %a.param_patt: %pattern_type.9ef = value_param_pattern [concrete = constants.%a.param_patt] // CHECK:STDOUT: %a.patt: %pattern_type.9ef = wrapper_binding_pattern a, %a.param_patt [concrete = constants.%a.patt] // CHECK:STDOUT: %return.param_patt: %pattern_type.98b = out_param_pattern [concrete = constants.%return.param_patt.89a] -// CHECK:STDOUT: %return.patt: %pattern_type.98b = return_slot_pattern %return.param_patt, %C.ref.loc12 [concrete = constants.%return.patt.e4a] +// CHECK:STDOUT: %return.patt: %pattern_type.98b = return_slot_pattern %return.param_patt, %C.ref.loc17 [concrete = constants.%return.patt.e4a] // CHECK:STDOUT: } { -// CHECK:STDOUT: %C.ref.loc12: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %.loc12: Core.Form = init_form %C.ref.loc12 [concrete = constants.%.a44] +// CHECK:STDOUT: %C.ref.loc17: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %.loc17: Core.Form = init_form %C.ref.loc17 [concrete = constants.%.a44] // CHECK:STDOUT: %a.param: %A = value_param call_param0 // CHECK:STDOUT: %A.ref: type = name_ref A, imports.%Main.A [concrete = constants.%A] // CHECK:STDOUT: %a: %A = wrapper_binding a, %a.param @@ -1613,10 +1630,10 @@ fn InstanceC(a: A) -> C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %A.ref: type = name_ref A, imports.%Main.A [concrete = constants.%A] // CHECK:STDOUT: %Factory.ref: %Factory.type.9da = name_ref Factory, imports.%Main.Factory [concrete = constants.%Factory.generic] -// CHECK:STDOUT: %C.ref.loc9: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %C.ref.loc14: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(constants.%C)> [concrete = constants.%Factory.type.120] -// CHECK:STDOUT: %.loc9: %Factory.assoc_type.b33 = specific_constant imports.%Main.import_ref.0c4, @Factory.WithSelf(constants.%C, constants.%Self.0bb) [concrete = constants.%assoc0.593] -// CHECK:STDOUT: %Make.ref: %Factory.assoc_type.b33 = name_ref Make, %.loc9 [concrete = constants.%assoc0.593] +// CHECK:STDOUT: %.loc14: %Factory.assoc_type.b33 = specific_constant imports.%Main.import_ref.0c4, @Factory.WithSelf(constants.%C, constants.%Self.0bb) [concrete = constants.%assoc0.593] +// CHECK:STDOUT: %Make.ref: %Factory.assoc_type.b33 = name_ref Make, %.loc14 [concrete = constants.%assoc0.593] // CHECK:STDOUT: return to %return.param // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1624,10 +1641,10 @@ fn InstanceC(a: A) -> C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: %A = name_ref a, %a // CHECK:STDOUT: %Factory.ref: %Factory.type.9da = name_ref Factory, imports.%Main.Factory [concrete = constants.%Factory.generic] -// CHECK:STDOUT: %C.ref.loc15: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %C.ref.loc26: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(constants.%C)> [concrete = constants.%Factory.type.120] -// CHECK:STDOUT: %.loc15: %Factory.assoc_type.b33 = specific_constant imports.%Main.import_ref.998, @Factory.WithSelf(constants.%C, constants.%Self.0bb) [concrete = constants.%assoc1.4d7] -// CHECK:STDOUT: %Method.ref: %Factory.assoc_type.b33 = name_ref Method, %.loc15 [concrete = constants.%assoc1.4d7] +// CHECK:STDOUT: %.loc26: %Factory.assoc_type.b33 = specific_constant imports.%Main.import_ref.998, @Factory.WithSelf(constants.%C, constants.%Self.0bb) [concrete = constants.%assoc1.4d7] +// CHECK:STDOUT: %Method.ref: %Factory.assoc_type.b33 = name_ref Method, %.loc26 [concrete = constants.%assoc1.4d7] // CHECK:STDOUT: return to %return.param // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/lookup/access.carbon b/toolchain/check/testdata/impl/lookup/access.carbon index bf5da5f18002..fb6a44023359 100644 --- a/toolchain/check/testdata/impl/lookup/access.carbon +++ b/toolchain/check/testdata/impl/lookup/access.carbon @@ -53,7 +53,13 @@ fn H(generic U: type, generic V: Z where .Z1 = C(U)) { // query's. // // TODO: This should pass. - // CHECK:STDERR: fail_todo_impl_witness_access_in_impl_type_structure.carbon:[[@LINE+2]]:3-11: error: cannot convert type `V` that implements `Z where .(Z.Z1) = C(U)` into type implementing `X(U)` [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╭─┤ fail_todo_impl_witness_access_in_impl_type_structure.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ V as X(U); + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `V` that implements `Z where .(Z.Z1) = C(U)` + // CHECK:STDERR: · ┃ into type implementing `X(U)` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: V as X(U); } diff --git a/toolchain/check/testdata/impl/lookup/fail_alias_impl_not_found.carbon b/toolchain/check/testdata/impl/lookup/fail_alias_impl_not_found.carbon index ed4cd7268e33..a532da94fcf1 100644 --- a/toolchain/check/testdata/impl/lookup/fail_alias_impl_not_found.carbon +++ b/toolchain/check/testdata/impl/lookup/fail_alias_impl_not_found.carbon @@ -21,10 +21,22 @@ class C { } fn F(c: C) { - // CHECK:STDERR: fail_alias_impl_not_found.carbon:[[@LINE+2]]:3-5: error: cannot access member of interface `I` in type `C` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_alias_impl_not_found.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ C.F(); + // CHECK:STDERR: · ┳━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `I` in type `C` that does not + // CHECK:STDERR: · ┃ implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: C.F(); - // CHECK:STDERR: fail_alias_impl_not_found.carbon:[[@LINE+2]]:3-5: error: cannot access member of interface `I` in type `C` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_alias_impl_not_found.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ c.F(); + // CHECK:STDERR: · ┳━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `I` in type `C` that does not + // CHECK:STDERR: · ┃ implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: c.F(); } @@ -102,10 +114,10 @@ fn F(c: C) { // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%c.param: %C) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %C.ref.loc26: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %F.ref.loc26: %I.assoc_type = name_ref F, @C.%F [concrete = constants.%assoc0] +// CHECK:STDOUT: %C.ref.loc32: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %F.ref.loc32: %I.assoc_type = name_ref F, @C.%F [concrete = constants.%assoc0] // CHECK:STDOUT: %c.ref: %C = name_ref c, %c -// CHECK:STDOUT: %F.ref.loc29: %I.assoc_type = name_ref F, @C.%F [concrete = constants.%assoc0] +// CHECK:STDOUT: %F.ref.loc41: %I.assoc_type = name_ref F, @C.%F [concrete = constants.%assoc0] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/lookup/fail_function_types.carbon b/toolchain/check/testdata/impl/lookup/fail_function_types.carbon index e57d4c9ffac7..28bbfbda46fd 100644 --- a/toolchain/check/testdata/impl/lookup/fail_function_types.carbon +++ b/toolchain/check/testdata/impl/lookup/fail_function_types.carbon @@ -22,10 +22,22 @@ impl forall [T: type] T as Z { } fn F() { - // CHECK:STDERR: fail_function_type_with_self_type.carbon:[[@LINE+5]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] + // CHECK:STDERR: ╭─┤ fail_function_type_with_self_type.carbon:[[@LINE+17]]:3 + // CHECK:STDERR: -> │ &(().(Z.G)) as type; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot take the address of non-reference expression [AddrOfNonRef] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_function_type_with_self_type.carbon:[[@LINE+3]]:3-21: error: cannot convert non-type value of type `*` to `type` with `as` [ConversionFailureNonTypeToFacet] - // CHECK:STDERR: fail_function_type_with_self_type.carbon:[[@LINE+2]]:3-21: note: type `*` does not implement interface `Core.As(type)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_function_type_with_self_type.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: -> │ &(().(Z.G)) as type; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert non-type value of type `*` to + // CHECK:STDERR: · │ ┃ `type` with `as` + // CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: · ╰────┤ type `*` does not implement interface + // CHECK:STDERR: · │ `Core.As(type)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: &(().(Z.G)) as type; } @@ -36,10 +48,21 @@ library "[[@TEST_NAME]]"; fn F() { // This does an impl lookup for `As` with `FunctionType` in the self type. // - // CHECK:STDERR: fail_function_type.carbon:[[@LINE+5]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] + // CHECK:STDERR: ╭─┤ fail_function_type.carbon:[[@LINE+16]]:3 + // CHECK:STDERR: -> │ &F as type; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot take the address of non-reference expression [AddrOfNonRef] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_function_type.carbon:[[@LINE+3]]:3-12: error: cannot convert non-type value of type `*` to `type` with `as` [ConversionFailureNonTypeToFacet] - // CHECK:STDERR: fail_function_type.carbon:[[@LINE+2]]:3-12: note: type `*` does not implement interface `Core.As(type)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_function_type.carbon:[[@LINE+10]]:3 + // CHECK:STDERR: -> │ &F as type; + // CHECK:STDERR: · ┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert non-type value of type `*` to `type` + // CHECK:STDERR: · │ ┃ with `as` + // CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: · ╰────┤ type `*` does not implement interface `Core.As(type)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: &F as type; } diff --git a/toolchain/check/testdata/impl/lookup/fail_poison_custom_witness.carbon b/toolchain/check/testdata/impl/lookup/fail_poison_custom_witness.carbon index b57379927c3f..5b4674855f4d 100644 --- a/toolchain/check/testdata/impl/lookup/fail_poison_custom_witness.carbon +++ b/toolchain/check/testdata/impl/lookup/fail_poison_custom_witness.carbon @@ -56,8 +56,20 @@ struct A { }; '''; -// CHECK:STDERR: fail_poison_custom_witness.carbon:[[@LINE+3]]:1-9: error: found `impl` for Cpp.A as SubobjectDestroy, which has a custom witness [PoisonedImplLookupCustomResult] -// CHECK:STDERR: destroy.carbon:8:1-45: note: the use tried to select the `impl` here, but a custom witness was already chosen [PoisonedImplLookupCustomResultNoteBadImpl] +// CHECK:STDERR: ╭─┤ fail_poison_custom_witness.carbon:[[@LINE+15]]:1 +// CHECK:STDERR: -> │ class B { +// CHECK:STDERR: · ┳━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: found `impl` for Cpp.A as SubobjectDestroy, which has a custom +// CHECK:STDERR: · ┃ witness +// CHECK:STDERR: · ┃ [PoisonedImplLookupCustomResult] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ destroy.carbon +// CHECK:STDERR: │ impl forall [T: type] T as SubobjectDestroy { +// CHECK:STDERR: · ┬──────────────────────────────────────────── +// CHECK:STDERR: · ╰──┤ the use tried to select the `impl` here, but a custom witness was already +// CHECK:STDERR: · │ chosen +// CHECK:STDERR: · │ [PoisonedImplLookupCustomResultNoteBadImpl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: class B { extend base: Cpp.A; diff --git a/toolchain/check/testdata/impl/lookup/fail_todo_undefined_impl.carbon b/toolchain/check/testdata/impl/lookup/fail_todo_undefined_impl.carbon index 71ca633faf72..040fb9a40924 100644 --- a/toolchain/check/testdata/impl/lookup/fail_todo_undefined_impl.carbon +++ b/toolchain/check/testdata/impl/lookup/fail_todo_undefined_impl.carbon @@ -23,7 +23,12 @@ class C { } fn F() { - // CHECK:STDERR: fail_todo_undefined_impl.carbon:[[@LINE+2]]:3-5: error: accessing member from impl before it has a defined value [ImplAccessMemberBeforeSet] + // CHECK:STDERR: ╭─┤ fail_todo_undefined_impl.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ C.F(); + // CHECK:STDERR: · ━┳━ + // CHECK:STDERR: · ┗━━┫ error: accessing member from impl before it has a defined value + // CHECK:STDERR: · ┃ [ImplAccessMemberBeforeSet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: C.F(); } @@ -35,9 +40,18 @@ impl C as I { } fn G() { - // CHECK:STDERR: fail_todo_undefined_impl.carbon:[[@LINE+4]]:3-5: error: accessing member from impl before it has a defined value [ImplAccessMemberBeforeSet] + // CHECK:STDERR: ╭─┤ fail_todo_undefined_impl.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: -> │ C.F(); + // CHECK:STDERR: · ━┳━ + // CHECK:STDERR: · ┗━━┫ error: accessing member from impl before it has a defined value + // CHECK:STDERR: · ┃ [ImplAccessMemberBeforeSet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_todo_undefined_impl.carbon:[[@LINE-18]]:3-19: error: impl declared but not defined [ImplMissingDefinition] + // CHECK:STDERR: ╭─┤ fail_todo_undefined_impl.carbon:[[@LINE-28]]:3 + // CHECK:STDERR: -> │ extend impl as I; + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: impl declared but not defined [ImplMissingDefinition] + // CHECK:STDERR: ╰──── // CHECK:STDERR: C.F(); } @@ -89,7 +103,7 @@ fn G() { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc33: = impl_self_witness @C.as.I.impl.e10.%C.ref, @I [concrete = constants.%.b7f] +// CHECK:STDOUT: %.loc38: = impl_self_witness @C.as.I.impl.e10.%C.ref, @I [concrete = constants.%.b7f] // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/lookup/generic.carbon b/toolchain/check/testdata/impl/lookup/generic.carbon index cb20d0e38f18..74ea995cf490 100644 --- a/toolchain/check/testdata/impl/lookup/generic.carbon +++ b/toolchain/check/testdata/impl/lookup/generic.carbon @@ -86,14 +86,25 @@ interface HasF { fn F(self); } -// CHECK:STDERR: fail_incomplete_deduction.carbon:[[@LINE+2]]:13-30: error: `impl` with unused generic binding [ImplUnusedBinding] +// CHECK:STDERR: ╭─┤ fail_incomplete_deduction.carbon:[[@LINE+7]]:13 +// CHECK:STDERR: -> │ impl forall [T: type, U: type] T as HasF { +// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `impl` with unused generic binding +// CHECK:STDERR: · ┃ [ImplUnusedBinding] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [T: type, U: type] T as HasF { fn F(unused self) {} } fn G(x: {}) { - // CHECK:STDERR: fail_incomplete_deduction.carbon:[[@LINE+2]]:3-12: error: cannot access member of interface `HasF` in type `{}` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_incomplete_deduction.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ x.(HasF.F)(); + // CHECK:STDERR: · ┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `HasF` in type `{}` that does + // CHECK:STDERR: · ┃ not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: x.(HasF.F)(); } @@ -116,7 +127,13 @@ class B {} fn G(x: A) { // TODO: It'd be nice to include a note here saying that deduction failed because // we deduced two different values for `T`. - // CHECK:STDERR: fail_inconsistent_deduction.carbon:[[@LINE+2]]:3-15: error: cannot access member of interface `HasF(B)` in type `A` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_inconsistent_deduction.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ x.(HasF(B).F)(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `HasF(B)` in type `A` that does + // CHECK:STDERR: · ┃ not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: x.(HasF(B).F)(); } @@ -1451,31 +1468,31 @@ fn G(x: A) { // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %HasF.decl: type = interface_decl @HasF [concrete = constants.%HasF.type] {} {} // CHECK:STDOUT: impl_decl @T.as.HasF.impl [concrete] { -// CHECK:STDOUT: %T.patt.loc10_15.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc10_15.2 (constants.%T.patt)] -// CHECK:STDOUT: %U.patt.loc10_24.1: %pattern_type.9a5 = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc10_24.2 (constants.%U.patt)] +// CHECK:STDOUT: %T.patt.loc15_15.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc15_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %U.patt.loc15_24.1: %pattern_type.9a5 = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc15_24.2 (constants.%U.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc10_15.2 [symbolic = %T.loc10_15.1 (constants.%T)] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc15_15.2 [symbolic = %T.loc15_15.1 (constants.%T)] // CHECK:STDOUT: %HasF.ref: type = name_ref HasF, file.%HasF.decl [concrete = constants.%HasF.type] -// CHECK:STDOUT: %.loc10_17.1: type = splice_block %.loc10_17.2 [concrete = type] { -// CHECK:STDOUT: %.Self.frozen.loc10_15: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc10_17.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc15_17.1: type = splice_block %.loc15_17.2 [concrete = type] { +// CHECK:STDOUT: %.Self.frozen.loc15_15: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc15_17.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc10_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc10_15.1 (constants.%T)] -// CHECK:STDOUT: %.loc10_26.1: type = splice_block %.loc10_26.2 [concrete = type] { -// CHECK:STDOUT: %.Self.frozen.loc10_24: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc10_26.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %T.loc15_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc15_15.1 (constants.%T)] +// CHECK:STDOUT: %.loc15_26.1: type = splice_block %.loc15_26.2 [concrete = type] { +// CHECK:STDOUT: %.Self.frozen.loc15_24: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc15_26.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %U.loc10_24.2: type = symbolic_binding U, 1 [symbolic = %U.loc10_24.1 (constants.%U)] +// CHECK:STDOUT: %U.loc15_24.2: type = symbolic_binding U, 1 [symbolic = %U.loc15_24.1 (constants.%U)] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc10: = impl_self_witness @T.as.HasF.impl.%T.ref, @HasF [symbolic = @T.as.HasF.impl.%.loc10_42 (constants.%.989)] +// CHECK:STDOUT: %.loc15: = impl_self_witness @T.as.HasF.impl.%T.ref, @HasF [symbolic = @T.as.HasF.impl.%.loc15_42 (constants.%.989)] // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] { // CHECK:STDOUT: %x.param_patt: %pattern_type.a96 = value_param_pattern [concrete = constants.%x.param_patt] // CHECK:STDOUT: %x.patt: %pattern_type.a96 = wrapper_binding_pattern x, %x.param_patt [concrete = constants.%x.patt] // CHECK:STDOUT: } { // CHECK:STDOUT: %x.param: %empty_struct_type = value_param call_param0 -// CHECK:STDOUT: %.loc14_10.1: type = splice_block %.loc14_10.3 [concrete = constants.%empty_struct_type] { -// CHECK:STDOUT: %.loc14_10.2: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc14_10.3: type = converted %.loc14_10.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc19_10.1: type = splice_block %.loc19_10.3 [concrete = constants.%empty_struct_type] { +// CHECK:STDOUT: %.loc19_10.2: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc19_10.3: type = converted %.loc19_10.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: } // CHECK:STDOUT: %x: %empty_struct_type = wrapper_binding x, %x.param // CHECK:STDOUT: } @@ -1508,32 +1525,32 @@ fn G(x: A) { // CHECK:STDOUT: !requires: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic impl @T.as.HasF.impl(%T.loc10_15.2: type, %U.loc10_24.2: type) { -// CHECK:STDOUT: %T.patt.loc10_15.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc10_15.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc10_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc10_15.1 (constants.%T)] -// CHECK:STDOUT: %U.patt.loc10_24.2: %pattern_type.9a5 = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc10_24.2 (constants.%U.patt)] -// CHECK:STDOUT: %U.loc10_24.1: type = symbolic_binding U, 1 [symbolic = %U.loc10_24.1 (constants.%U)] -// CHECK:STDOUT: %.loc10_42: = impl_self_witness %T.loc10_15.1, @HasF [symbolic = %.loc10_42 (constants.%.989)] -// CHECK:STDOUT: %HasF.impl_witness.loc10_42.2: = impl_witness %HasF.impl_witness_table, @T.as.HasF.impl(%T.loc10_15.1, %U.loc10_24.1) [symbolic = %HasF.impl_witness.loc10_42.2 (constants.%HasF.impl_witness)] +// CHECK:STDOUT: generic impl @T.as.HasF.impl(%T.loc15_15.2: type, %U.loc15_24.2: type) { +// CHECK:STDOUT: %T.patt.loc15_15.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc15_15.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc15_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc15_15.1 (constants.%T)] +// CHECK:STDOUT: %U.patt.loc15_24.2: %pattern_type.9a5 = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc15_24.2 (constants.%U.patt)] +// CHECK:STDOUT: %U.loc15_24.1: type = symbolic_binding U, 1 [symbolic = %U.loc15_24.1 (constants.%U)] +// CHECK:STDOUT: %.loc15_42: = impl_self_witness %T.loc15_15.1, @HasF [symbolic = %.loc15_42 (constants.%.989)] +// CHECK:STDOUT: %HasF.impl_witness.loc15_42.2: = impl_witness %HasF.impl_witness_table, @T.as.HasF.impl(%T.loc15_15.1, %U.loc15_24.1) [symbolic = %HasF.impl_witness.loc15_42.2 (constants.%HasF.impl_witness)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %T.as.HasF.impl.F.type: type = fn_type @T.as.HasF.impl.F, @T.as.HasF.impl(%T.loc10_15.1, %U.loc10_24.1) [symbolic = %T.as.HasF.impl.F.type (constants.%T.as.HasF.impl.F.type)] +// CHECK:STDOUT: %T.as.HasF.impl.F.type: type = fn_type @T.as.HasF.impl.F, @T.as.HasF.impl(%T.loc15_15.1, %U.loc15_24.1) [symbolic = %T.as.HasF.impl.F.type (constants.%T.as.HasF.impl.F.type)] // CHECK:STDOUT: %T.as.HasF.impl.F: @T.as.HasF.impl.%T.as.HasF.impl.F.type (%T.as.HasF.impl.F.type) = struct_value () [symbolic = %T.as.HasF.impl.F (constants.%T.as.HasF.impl.F)] // CHECK:STDOUT: // CHECK:STDOUT: impl: %T.ref as %HasF.ref { // CHECK:STDOUT: %T.as.HasF.impl.F.decl: @T.as.HasF.impl.%T.as.HasF.impl.F.type (%T.as.HasF.impl.F.type) = fn_decl @T.as.HasF.impl.F [symbolic = @T.as.HasF.impl.%T.as.HasF.impl.F (constants.%T.as.HasF.impl.F)] { -// CHECK:STDOUT: %self.param_patt.loc11_15.1: @T.as.HasF.impl.F.%pattern_type (%pattern_type.51d) = value_param_pattern [symbolic = %self.param_patt.loc11_15.2 (constants.%self.param_patt.b7c)] -// CHECK:STDOUT: %self.patt.loc11_15.1: @T.as.HasF.impl.F.%pattern_type (%pattern_type.51d) = wrapper_binding_pattern self, %self.param_patt.loc11_15.1 [symbolic = %self.patt.loc11_15.2 (constants.%self.patt.4d9)] +// CHECK:STDOUT: %self.param_patt.loc16_15.1: @T.as.HasF.impl.F.%pattern_type (%pattern_type.51d) = value_param_pattern [symbolic = %self.param_patt.loc16_15.2 (constants.%self.param_patt.b7c)] +// CHECK:STDOUT: %self.patt.loc16_15.1: @T.as.HasF.impl.F.%pattern_type (%pattern_type.51d) = wrapper_binding_pattern self, %self.param_patt.loc16_15.1 [symbolic = %self.patt.loc16_15.2 (constants.%self.patt.4d9)] // CHECK:STDOUT: } { // CHECK:STDOUT: %self.param: @T.as.HasF.impl.F.%T (%T) = value_param call_param0 -// CHECK:STDOUT: %.loc11_15.1: type = splice_block %Self.ref [symbolic = %T (constants.%T)] { -// CHECK:STDOUT: %.loc11_15.2: type = specific_constant @T.as.HasF.impl.%T.ref, @T.as.HasF.impl(constants.%T, constants.%U) [symbolic = %T (constants.%T)] -// CHECK:STDOUT: %Self.ref: type = name_ref Self, %.loc11_15.2 [symbolic = %T (constants.%T)] +// CHECK:STDOUT: %.loc16_15.1: type = splice_block %Self.ref [symbolic = %T (constants.%T)] { +// CHECK:STDOUT: %.loc16_15.2: type = specific_constant @T.as.HasF.impl.%T.ref, @T.as.HasF.impl(constants.%T, constants.%U) [symbolic = %T (constants.%T)] +// CHECK:STDOUT: %Self.ref: type = name_ref Self, %.loc16_15.2 [symbolic = %T (constants.%T)] // CHECK:STDOUT: } // CHECK:STDOUT: %self: @T.as.HasF.impl.F.%T (%T) = wrapper_binding self, %self.param // CHECK:STDOUT: } // CHECK:STDOUT: %HasF.impl_witness_table = impl_witness_table (), @T.as.HasF.impl [concrete] -// CHECK:STDOUT: %HasF.impl_witness.loc10_42.1: = impl_witness %HasF.impl_witness_table, @T.as.HasF.impl(constants.%T, constants.%U) [symbolic = %HasF.impl_witness.loc10_42.2 (constants.%HasF.impl_witness)] +// CHECK:STDOUT: %HasF.impl_witness.loc15_42.1: = impl_witness %HasF.impl_witness_table, @T.as.HasF.impl(constants.%T, constants.%U) [symbolic = %HasF.impl_witness.loc15_42.2 (constants.%HasF.impl_witness)] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %T.as.HasF.impl.F.decl @@ -1552,11 +1569,11 @@ fn G(x: A) { // CHECK:STDOUT: fn(%self.param: @HasF.WithSelf.F.%Self.as_type.loc5_8.1 (%Self.as_type)); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @T.as.HasF.impl.F(@T.as.HasF.impl.%T.loc10_15.2: type, @T.as.HasF.impl.%U.loc10_24.2: type) { +// CHECK:STDOUT: generic fn @T.as.HasF.impl.F(@T.as.HasF.impl.%T.loc15_15.2: type, @T.as.HasF.impl.%U.loc15_24.2: type) { // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic = %T (constants.%T)] // CHECK:STDOUT: %pattern_type: type = pattern_type %T [symbolic = %pattern_type (constants.%pattern_type.51d)] -// CHECK:STDOUT: %self.param_patt.loc11_15.2: @T.as.HasF.impl.F.%pattern_type (%pattern_type.51d) = value_param_pattern [symbolic = %self.param_patt.loc11_15.2 (constants.%self.param_patt.b7c)] -// CHECK:STDOUT: %self.patt.loc11_15.2: @T.as.HasF.impl.F.%pattern_type (%pattern_type.51d) = wrapper_binding_pattern self, %self.param_patt.loc11_15.2 [symbolic = %self.patt.loc11_15.2 (constants.%self.patt.4d9)] +// CHECK:STDOUT: %self.param_patt.loc16_15.2: @T.as.HasF.impl.F.%pattern_type (%pattern_type.51d) = value_param_pattern [symbolic = %self.param_patt.loc16_15.2 (constants.%self.param_patt.b7c)] +// CHECK:STDOUT: %self.patt.loc16_15.2: @T.as.HasF.impl.F.%pattern_type (%pattern_type.51d) = wrapper_binding_pattern self, %self.param_patt.loc16_15.2 [symbolic = %self.patt.loc16_15.2 (constants.%self.patt.4d9)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete: = require_complete_type %T [symbolic = %require_complete (constants.%require_complete)] @@ -1591,12 +1608,12 @@ fn G(x: A) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @T.as.HasF.impl(constants.%T, constants.%U) { -// CHECK:STDOUT: %T.patt.loc10_15.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc10_15.1 => constants.%T -// CHECK:STDOUT: %U.patt.loc10_24.2 => constants.%U.patt -// CHECK:STDOUT: %U.loc10_24.1 => constants.%U -// CHECK:STDOUT: %.loc10_42 => constants.%.989 -// CHECK:STDOUT: %HasF.impl_witness.loc10_42.2 => constants.%HasF.impl_witness +// CHECK:STDOUT: %T.patt.loc15_15.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc15_15.1 => constants.%T +// CHECK:STDOUT: %U.patt.loc15_24.2 => constants.%U.patt +// CHECK:STDOUT: %U.loc15_24.1 => constants.%U +// CHECK:STDOUT: %.loc15_42 => constants.%.989 +// CHECK:STDOUT: %HasF.impl_witness.loc15_42.2 => constants.%HasF.impl_witness // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %T.as.HasF.impl.F.type => constants.%T.as.HasF.impl.F.type @@ -1606,8 +1623,8 @@ fn G(x: A) { // CHECK:STDOUT: specific @T.as.HasF.impl.F(constants.%T, constants.%U) { // CHECK:STDOUT: %T => constants.%T // CHECK:STDOUT: %pattern_type => constants.%pattern_type.51d -// CHECK:STDOUT: %self.param_patt.loc11_15.2 => constants.%self.param_patt.b7c -// CHECK:STDOUT: %self.patt.loc11_15.2 => constants.%self.patt.4d9 +// CHECK:STDOUT: %self.param_patt.loc16_15.2 => constants.%self.param_patt.b7c +// CHECK:STDOUT: %self.patt.loc16_15.2 => constants.%self.patt.4d9 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_inconsistent_deduction.carbon @@ -1830,8 +1847,8 @@ fn G(x: A) { // CHECK:STDOUT: %HasF.ref: %HasF.type.c96 = name_ref HasF, file.%HasF.decl [concrete = constants.%HasF.generic] // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B] // CHECK:STDOUT: %HasF.type: type = facet_type <@HasF, @HasF(constants.%B)> [concrete = constants.%HasF.type.673] -// CHECK:STDOUT: %.loc20: %HasF.assoc_type.3f9 = specific_constant @HasF.WithSelf.%assoc0.loc5_13.1, @HasF.WithSelf(constants.%B, constants.%Self.0a5) [concrete = constants.%assoc0.489] -// CHECK:STDOUT: %F.ref: %HasF.assoc_type.3f9 = name_ref F, %.loc20 [concrete = constants.%assoc0.489] +// CHECK:STDOUT: %.loc26: %HasF.assoc_type.3f9 = specific_constant @HasF.WithSelf.%assoc0.loc5_13.1, @HasF.WithSelf(constants.%B, constants.%Self.0a5) [concrete = constants.%assoc0.489] +// CHECK:STDOUT: %F.ref: %HasF.assoc_type.3f9 = name_ref F, %.loc26 [concrete = constants.%assoc0.489] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/lookup/impl_cycle.carbon b/toolchain/check/testdata/impl/lookup/impl_cycle.carbon index dd85b907007f..142c98cf6492 100644 --- a/toolchain/check/testdata/impl/lookup/impl_cycle.carbon +++ b/toolchain/check/testdata/impl/lookup/impl_cycle.carbon @@ -25,10 +25,23 @@ fn F() { // with a note about the cycle as the reason for impl lookup failing, or the // cycle causes an error so the conversion is not diagnosed. - // CHECK:STDERR: fail_impl_simple_cycle.carbon:[[@LINE+5]]:3-12: error: cycle found in search for impl of `Z` for type `Point` [ImplLookupCycle] - // CHECK:STDERR: fail_impl_simple_cycle.carbon:[[@LINE-10]]:1-27: note: determining if this impl clause matches [ImplLookupCycleNote] + // CHECK:STDERR: ╭─┤ fail_impl_simple_cycle.carbon:[[@LINE+18]]:3 + // CHECK:STDERR: │ impl forall [T: Z] T as Z {} + // CHECK:STDERR: · ─────────────┬───────────── + // CHECK:STDERR: · ╰──┤ determining if this impl clause matches [ImplLookupCycleNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Point as Z; + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cycle found in search for impl of `Z` for type `Point` + // CHECK:STDERR: · ┃ [ImplLookupCycle] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_impl_simple_cycle.carbon:[[@LINE+2]]:3-12: error: cannot convert type `Point` into type implementing `Z` [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╭─┤ fail_impl_simple_cycle.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ Point as Z; + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `Point` into type implementing `Z` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Point as Z; } @@ -45,10 +58,25 @@ impl forall [T: type where .Self impls Z] T as Z {} class Point {} fn F() { - // CHECK:STDERR: fail_impl_simple_where_cycle.carbon:[[@LINE+5]]:3-12: error: cycle found in search for impl of `type where .Self impls Z` for type `Point` [ImplLookupCycle] - // CHECK:STDERR: fail_impl_simple_where_cycle.carbon:[[@LINE-6]]:1-50: note: determining if this impl clause matches [ImplLookupCycleNote] + // CHECK:STDERR: ╭─┤ fail_impl_simple_where_cycle.carbon:[[@LINE+20]]:3 + // CHECK:STDERR: │ impl forall [T: type where .Self impls Z] T as Z {} + // CHECK:STDERR: · ─────────────────────────┬──────────────────────── + // CHECK:STDERR: · ╰──┤ determining if this impl clause matches + // CHECK:STDERR: · │ [ImplLookupCycleNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Point as Z; + // CHECK:STDERR: · ┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cycle found in search for impl of `type where .Self impls Z` for + // CHECK:STDERR: · ┃ type `Point` + // CHECK:STDERR: · ┃ [ImplLookupCycle] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_impl_simple_where_cycle.carbon:[[@LINE+2]]:3-12: error: cannot convert type `Point` into type implementing `Z` [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╭─┤ fail_impl_simple_where_cycle.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ Point as Z; + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `Point` into type implementing `Z` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Point as Z; } @@ -65,10 +93,24 @@ impl forall [T: Z & Y] T as Z {} class Point {} fn F() { - // CHECK:STDERR: fail_impl_simple_two_interfaces.carbon:[[@LINE+5]]:3-12: error: cycle found in search for impl of `Z & Y` for type `Point` [ImplLookupCycle] - // CHECK:STDERR: fail_impl_simple_two_interfaces.carbon:[[@LINE-6]]:1-31: note: determining if this impl clause matches [ImplLookupCycleNote] + // CHECK:STDERR: ╭─┤ fail_impl_simple_two_interfaces.carbon:[[@LINE+19]]:3 + // CHECK:STDERR: │ impl forall [T: Z & Y] T as Z {} + // CHECK:STDERR: · ───────────────┬─────────────── + // CHECK:STDERR: · ╰──┤ determining if this impl clause matches + // CHECK:STDERR: · │ [ImplLookupCycleNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Point as Z; + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cycle found in search for impl of `Z & Y` for type `Point` + // CHECK:STDERR: · ┃ [ImplLookupCycle] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_impl_simple_two_interfaces.carbon:[[@LINE+2]]:3-12: error: cannot convert type `Point` into type implementing `Z` [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╭─┤ fail_impl_simple_two_interfaces.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ Point as Z; + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `Point` into type implementing `Z` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Point as Z; } @@ -88,12 +130,29 @@ impl forall [T: Z] T as X {} class C {} fn F() { - // CHECK:STDERR: fail_impl_long_cycle.carbon:[[@LINE+7]]:3-8: error: cycle found in search for impl of `Z` for type `C` [ImplLookupCycle] - // CHECK:STDERR: fail_impl_long_cycle.carbon:[[@LINE-7]]:1-27: note: determining if this impl clause matches [ImplLookupCycleNote] - // CHECK:STDERR: fail_impl_long_cycle.carbon:[[@LINE-9]]:1-27: note: determining if this impl clause matches [ImplLookupCycleNote] - // CHECK:STDERR: fail_impl_long_cycle.carbon:[[@LINE-8]]:1-27: note: determining if this impl clause matches [ImplLookupCycleNote] + // CHECK:STDERR: ╭─┤ fail_impl_long_cycle.carbon:[[@LINE+24]]:3 + // CHECK:STDERR: │ impl forall [T: X] T as Y {} + // CHECK:STDERR: · ─────────────┬───────────── + // CHECK:STDERR: · ╰──┤ determining if this impl clause matches [ImplLookupCycleNote] + // CHECK:STDERR: │ impl forall [T: Y] T as Z {} + // CHECK:STDERR: · ─────────────┬───────────── + // CHECK:STDERR: · ╰──┤ determining if this impl clause matches [ImplLookupCycleNote] + // CHECK:STDERR: │ impl forall [T: Z] T as X {} + // CHECK:STDERR: · ─────────────┬───────────── + // CHECK:STDERR: · ╰──┤ determining if this impl clause matches [ImplLookupCycleNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ C as Z; + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: cycle found in search for impl of `Z` for type `C` + // CHECK:STDERR: · ┃ [ImplLookupCycle] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_impl_long_cycle.carbon:[[@LINE+2]]:3-8: error: cannot convert type `C` into type implementing `Z` [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╭─┤ fail_impl_long_cycle.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ C as Z; + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `C` into type implementing `Z` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: C as Z; } @@ -113,32 +172,100 @@ class D {} fn Compare[T: type, U: ComparableWith(T)](unused t: T, unused u: U) {} fn F() { - // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE+7]]:3-27: error: cycle found in search for impl of `ComparableWith(C)` for type `C` [ImplLookupCycle] - // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE-10]]:1-43: note: determining if this impl clause matches [ImplLookupCycleNote] - // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE-5]]:1-69: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_impl_cycle_one_generic_param.carbon:[[@LINE+29]]:3 + // CHECK:STDERR: │ impl forall [U: type, T: ComparableWith(U)] + // CHECK:STDERR: · ─────────────────────┬───────────────────── + // CHECK:STDERR: · ╰──┤ determining if this impl clause matches + // CHECK:STDERR: · │ [ImplLookupCycleNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ fn Compare[T: type, U: ComparableWith(T)](unused t: T, unused u: U) {} + // CHECK:STDERR: · ─────────────────────────┬─────────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Compare({} as C, {} as C); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cycle found in search for impl of `ComparableWith(C)` for type `C` + // CHECK:STDERR: · ┃ [ImplLookupCycle] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE+3]]:3-27: error: cannot convert type `C` into type implementing `ComparableWith(C)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE-8]]:1-69: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_impl_cycle_one_generic_param.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn Compare[T: type, U: ComparableWith(T)](unused t: T, unused u: U) {} + // CHECK:STDERR: · ─────────────────────────┬─────────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Compare({} as C, {} as C); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `C` into type implementing `ComparableWith(C)` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Compare({} as C, {} as C); - // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE+8]]:3-27: error: cycle found in search for impl of `ComparableWith(C)` for type `D` [ImplLookupCycle] - // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE-19]]:1-43: note: determining if this impl clause matches [ImplLookupCycleNote] - // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE-20]]:1-43: note: determining if this impl clause matches [ImplLookupCycleNote] - // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE-15]]:1-69: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_impl_cycle_one_generic_param.carbon:[[@LINE+31]]:3 + // CHECK:STDERR: │ impl forall [U: type, T: ComparableWith(U)] + // CHECK:STDERR: · ─────────────────────┬───────────────────── + // CHECK:STDERR: · ╰──┤ determining if this impl clause matches + // CHECK:STDERR: · │ │ [ImplLookupCycleNote] + // CHECK:STDERR: · ╰────┤ determining if this impl clause matches + // CHECK:STDERR: · │ [ImplLookupCycleNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ fn Compare[T: type, U: ComparableWith(T)](unused t: T, unused u: U) {} + // CHECK:STDERR: · ─────────────────────────┬─────────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Compare({} as C, {} as D); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cycle found in search for impl of `ComparableWith(C)` for type `D` + // CHECK:STDERR: · ┃ [ImplLookupCycle] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE+3]]:3-27: error: cannot convert type `D` into type implementing `ComparableWith(C)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE-18]]:1-69: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_impl_cycle_one_generic_param.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn Compare[T: type, U: ComparableWith(T)](unused t: T, unused u: U) {} + // CHECK:STDERR: · ─────────────────────────┬─────────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Compare({} as C, {} as D); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `D` into type implementing `ComparableWith(C)` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Compare({} as C, {} as D); - // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE+8]]:3-27: error: cycle found in search for impl of `ComparableWith(D)` for type `C` [ImplLookupCycle] - // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE-29]]:1-43: note: determining if this impl clause matches [ImplLookupCycleNote] - // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE-30]]:1-43: note: determining if this impl clause matches [ImplLookupCycleNote] - // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE-25]]:1-69: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_impl_cycle_one_generic_param.carbon:[[@LINE+31]]:3 + // CHECK:STDERR: │ impl forall [U: type, T: ComparableWith(U)] + // CHECK:STDERR: · ─────────────────────┬───────────────────── + // CHECK:STDERR: · ╰──┤ determining if this impl clause matches + // CHECK:STDERR: · │ │ [ImplLookupCycleNote] + // CHECK:STDERR: · ╰────┤ determining if this impl clause matches + // CHECK:STDERR: · │ [ImplLookupCycleNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ fn Compare[T: type, U: ComparableWith(T)](unused t: T, unused u: U) {} + // CHECK:STDERR: · ─────────────────────────┬─────────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Compare({} as D, {} as C); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cycle found in search for impl of `ComparableWith(D)` for type `C` + // CHECK:STDERR: · ┃ [ImplLookupCycle] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE+3]]:3-27: error: cannot convert type `C` into type implementing `ComparableWith(D)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_impl_cycle_one_generic_param.carbon:[[@LINE-28]]:1-69: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_impl_cycle_one_generic_param.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn Compare[T: type, U: ComparableWith(T)](unused t: T, unused u: U) {} + // CHECK:STDERR: · ─────────────────────────┬─────────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Compare({} as D, {} as C); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `C` into type implementing `ComparableWith(D)` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Compare({} as D, {} as C); } diff --git a/toolchain/check/testdata/impl/lookup/impl_overlap.carbon b/toolchain/check/testdata/impl/lookup/impl_overlap.carbon index 3fef44c57a8f..0e1f550d3136 100644 --- a/toolchain/check/testdata/impl/lookup/impl_overlap.carbon +++ b/toolchain/check/testdata/impl/lookup/impl_overlap.carbon @@ -98,8 +98,17 @@ final impl forall [T: type] T as Z(T) {} // The final impl here overlaps with the final impl above, but is not in a // match_first. // -// CHECK:STDERR: fail_multiple_finals_overlap_with_interface.carbon:[[@LINE+3]]:1-40: error: `final impl` overlaps with `final impl` from same file outside a `match_first` block [FinalImplOverlapsSameFile] -// CHECK:STDERR: fail_multiple_finals_overlap_with_interface.carbon:[[@LINE-6]]:1-39: note: other `final impl` here [FinalImplOverlapsSameFileNote] +// CHECK:STDERR: ╭─┤ fail_multiple_finals_overlap_with_interface.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: │ final impl forall [T: type] T as Z(T) {} +// CHECK:STDERR: · ───────────────────┬─────────────────── +// CHECK:STDERR: · ╰──┤ other `final impl` here [FinalImplOverlapsSameFileNote] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ final impl forall [T: type] T as Z(()) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `final impl` overlaps with `final impl` from same file outside a +// CHECK:STDERR: · ┃ `match_first` block +// CHECK:STDERR: · ┃ [FinalImplOverlapsSameFile] +// CHECK:STDERR: ╰──── // CHECK:STDERR: final impl forall [T: type] T as Z(()) {} @@ -108,8 +117,17 @@ class C {} // The final impl here overlaps with the first final impl above, but is not in // a match_first. // -// CHECK:STDERR: fail_multiple_finals_overlap_with_interface.carbon:[[@LINE+3]]:1-23: error: `final impl` overlaps with `final impl` from same file outside a `match_first` block [FinalImplOverlapsSameFile] -// CHECK:STDERR: fail_multiple_finals_overlap_with_interface.carbon:[[@LINE-16]]:1-39: note: other `final impl` here [FinalImplOverlapsSameFileNote] +// CHECK:STDERR: ╭─┤ fail_multiple_finals_overlap_with_interface.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: │ final impl forall [T: type] T as Z(T) {} +// CHECK:STDERR: · ───────────────────┬─────────────────── +// CHECK:STDERR: · ╰──┤ other `final impl` here [FinalImplOverlapsSameFileNote] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ final impl C as Z({}) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `final impl` overlaps with `final impl` from same file outside a +// CHECK:STDERR: · ┃ `match_first` block +// CHECK:STDERR: · ┃ [FinalImplOverlapsSameFile] +// CHECK:STDERR: ╰──── // CHECK:STDERR: final impl C as Z({}) {} @@ -125,8 +143,17 @@ final impl C as Z(()) {} // The final impl here overlaps with the first final impl above, but is not in // a match_first. // -// CHECK:STDERR: fail_multiple_finals_overlap_with_self_type.carbon:[[@LINE+3]]:1-39: error: `final impl` overlaps with `final impl` from same file outside a `match_first` block [FinalImplOverlapsSameFile] -// CHECK:STDERR: fail_multiple_finals_overlap_with_self_type.carbon:[[@LINE-6]]:1-23: note: other `final impl` here [FinalImplOverlapsSameFileNote] +// CHECK:STDERR: ╭─┤ fail_multiple_finals_overlap_with_self_type.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: │ final impl C as Z(()) {} +// CHECK:STDERR: · ───────────┬─────────── +// CHECK:STDERR: · ╰──┤ other `final impl` here [FinalImplOverlapsSameFileNote] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ final impl forall [T: type] C as Z(T) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `final impl` overlaps with `final impl` from same file outside a +// CHECK:STDERR: · ┃ `match_first` block +// CHECK:STDERR: · ┃ [FinalImplOverlapsSameFile] +// CHECK:STDERR: ╰──── // CHECK:STDERR: final impl forall [T: type] C as Z(T) {} @@ -175,8 +202,18 @@ class C {} // Can't write a final impl in both the interface's file and the root self // type's file (when they are different files). // -// CHECK:STDERR: fail_final_impl_with_both_interface_and_self_but_different_files.carbon:[[@LINE+3]]:1-23: error: `final impl` overlaps with `final impl` from another file [FinalImplOverlapsDifferentFile] -// CHECK:STDERR: interface_z_with_impl.carbon:9:1-39: note: imported `final impl` here [FinalImplOverlapsDifferentFileNote] +// CHECK:STDERR: ╭─┤ fail_final_impl_with_both_interface_and_self_but_different_files.carbon:[[@LINE+13]]:1 +// CHECK:STDERR: -> │ final impl C as Z(()) {} +// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `final impl` overlaps with `final impl` from another file +// CHECK:STDERR: · ┃ [FinalImplOverlapsDifferentFile] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ interface_z_with_impl.carbon +// CHECK:STDERR: │ final impl forall [T: type] T as Z(T) {} +// CHECK:STDERR: · ───────────────────┬─────────────────── +// CHECK:STDERR: · ╰──┤ imported `final impl` here +// CHECK:STDERR: · │ [FinalImplOverlapsDifferentFileNote] +// CHECK:STDERR: ╰──── // CHECK:STDERR: final impl C as Z(()) {} @@ -190,8 +227,18 @@ class C {} // This final impl is overlapped by a final impl in the interface file, and you // can't write a final impl in two different files. // -// CHECK:STDERR: fail_final_overlaps_final_from_other_file.carbon:[[@LINE+3]]:1-22: error: `final impl` overlaps with `final impl` from another file [FinalImplOverlapsDifferentFile] -// CHECK:STDERR: interface_z_with_impl.carbon:9:1-39: note: imported `final impl` here [FinalImplOverlapsDifferentFileNote] +// CHECK:STDERR: ╭─┤ fail_final_overlaps_final_from_other_file.carbon:[[@LINE+13]]:1 +// CHECK:STDERR: -> │ final impl C as Z(C) {} +// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `final impl` overlaps with `final impl` from another file +// CHECK:STDERR: · ┃ [FinalImplOverlapsDifferentFile] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ interface_z_with_impl.carbon +// CHECK:STDERR: │ final impl forall [T: type] T as Z(T) {} +// CHECK:STDERR: · ───────────────────┬─────────────────── +// CHECK:STDERR: · ╰──┤ imported `final impl` here +// CHECK:STDERR: · │ [FinalImplOverlapsDifferentFileNote] +// CHECK:STDERR: ╰──── // CHECK:STDERR: final impl C as Z(C) {} @@ -204,8 +251,17 @@ class C {} // This non-final impl is subsumed by a final impl in the interface file. // -// CHECK:STDERR: fail_final_overlaps_non_final_from_other_file.carbon:[[@LINE+3]]:1-16: error: `impl` will never be used [ImplFinalOverlapsNonFinal] -// CHECK:STDERR: interface_z_with_impl.carbon:9:1-39: note: `final impl` declared here would always be used instead [ImplFinalOverlapsNonFinalNote] +// CHECK:STDERR: ╭─┤ fail_final_overlaps_non_final_from_other_file.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: -> │ impl C as Z(C) {} +// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `impl` will never be used [ImplFinalOverlapsNonFinal] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ interface_z_with_impl.carbon +// CHECK:STDERR: │ final impl forall [T: type] T as Z(T) {} +// CHECK:STDERR: · ───────────────────┬─────────────────── +// CHECK:STDERR: · ╰──┤ `final impl` declared here would always be used instead +// CHECK:STDERR: · │ [ImplFinalOverlapsNonFinalNote] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl C as Z(C) {} @@ -219,7 +275,13 @@ class C; // The root type must be defined in the same library, not just declared. // -// CHECK:STDERR: fail_final_root_self_type_not_defined.carbon:[[@LINE+2]]:1-23: error: `final impl` found in file that does not contain the root self type nor the interface definition [FinalImplInvalidFile] +// CHECK:STDERR: ╭─┤ fail_final_root_self_type_not_defined.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ final impl C as Z(()) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `final impl` found in file that does not contain the root self type +// CHECK:STDERR: · ┃ nor the interface definition +// CHECK:STDERR: · ┃ [FinalImplInvalidFile] +// CHECK:STDERR: ╰──── // CHECK:STDERR: final impl C as Z(()) {} @@ -234,7 +296,13 @@ class C {} // Can't make a final impl that is not in the same file as the self type nor // the interface. // -// CHECK:STDERR: fail_final_different_file_from_self_and_interface.carbon:[[@LINE+2]]:1-26: error: `final impl` found in file that does not contain the root self type nor the interface definition [FinalImplInvalidFile] +// CHECK:STDERR: ╭─┤ fail_final_different_file_from_self_and_interface.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ final impl D(C) as Z(()) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `final impl` found in file that does not contain the root self type +// CHECK:STDERR: · ┃ nor the interface definition +// CHECK:STDERR: · ┃ [FinalImplInvalidFile] +// CHECK:STDERR: ╰──── // CHECK:STDERR: final impl D(C) as Z(()) {} @@ -248,7 +316,13 @@ class C {} // Can't make a final impl that is not in the same file as the self type nor // the interface. // -// CHECK:STDERR: fail_final_different_file_from_self_and_interface_with_generic_self.carbon:[[@LINE+2]]:1-39: error: `final impl` found in file that does not contain the root self type nor the interface definition [FinalImplInvalidFile] +// CHECK:STDERR: ╭─┤ fail_final_different_file_from_self_and_interface_with_generic_self.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ final impl forall [T: type] T as Z(C) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `final impl` found in file that does not contain the root self type +// CHECK:STDERR: · ┃ nor the interface definition +// CHECK:STDERR: · ┃ [FinalImplInvalidFile] +// CHECK:STDERR: ╰──── // CHECK:STDERR: final impl forall [T: type] T as Z(C) {} @@ -257,11 +331,19 @@ library "[[@TEST_NAME]]"; interface Z(T: type) {} -// CHECK:STDERR: fail_final_overlaps_earlier_non_final_impl.carbon:[[@LINE+1]]:1-18: error: `impl` will never be used [ImplFinalOverlapsNonFinal] +// CHECK:STDERR: ╭─┤ fail_final_overlaps_earlier_non_final_impl.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: -> │ impl () as Z(()) {} +// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `impl` will never be used [ImplFinalOverlapsNonFinal] +// CHECK:STDERR: │ +// CHECK:STDERR: │ final impl forall [T: type] T as Z(T) {} +// CHECK:STDERR: · ───────────────────┬─────────────────── +// CHECK:STDERR: · ╰──┤ `final impl` declared here would always be used instead +// CHECK:STDERR: · │ [ImplFinalOverlapsNonFinalNote] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: impl () as Z(()) {} -// CHECK:STDERR: fail_final_overlaps_earlier_non_final_impl.carbon:[[@LINE+2]]:1-39: note: `final impl` declared here would always be used instead [ImplFinalOverlapsNonFinalNote] -// CHECK:STDERR: final impl forall [T: type] T as Z(T) {} // --- fail_final_overlaps_later_non_final_impl.carbon @@ -271,8 +353,16 @@ interface Z(T: type) {} final impl forall [T: type] T as Z(T) {} -// CHECK:STDERR: fail_final_overlaps_later_non_final_impl.carbon:[[@LINE+3]]:1-18: error: `impl` will never be used [ImplFinalOverlapsNonFinal] -// CHECK:STDERR: fail_final_overlaps_later_non_final_impl.carbon:[[@LINE-3]]:1-39: note: `final impl` declared here would always be used instead [ImplFinalOverlapsNonFinalNote] +// CHECK:STDERR: ╭─┤ fail_final_overlaps_later_non_final_impl.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: │ final impl forall [T: type] T as Z(T) {} +// CHECK:STDERR: · ───────────────────┬─────────────────── +// CHECK:STDERR: · ╰──┤ `final impl` declared here would always be used instead +// CHECK:STDERR: · │ [ImplFinalOverlapsNonFinalNote] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ impl () as Z(()) {} +// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `impl` will never be used [ImplFinalOverlapsNonFinal] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as Z(()) {} @@ -285,8 +375,17 @@ class C {} final impl C as Z(C) {} -// CHECK:STDERR: fail_final_overlaps_earlier_final_impl.carbon:[[@LINE+3]]:1-39: error: `final impl` overlaps with `final impl` from same file outside a `match_first` block [FinalImplOverlapsSameFile] -// CHECK:STDERR: fail_final_overlaps_earlier_final_impl.carbon:[[@LINE-3]]:1-22: note: other `final impl` here [FinalImplOverlapsSameFileNote] +// CHECK:STDERR: ╭─┤ fail_final_overlaps_earlier_final_impl.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: │ final impl C as Z(C) {} +// CHECK:STDERR: · ───────────┬────────── +// CHECK:STDERR: · ╰──┤ other `final impl` here [FinalImplOverlapsSameFileNote] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ final impl forall [T: type] T as Z(T) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `final impl` overlaps with `final impl` from same file outside a +// CHECK:STDERR: · ┃ `match_first` block +// CHECK:STDERR: · ┃ [FinalImplOverlapsSameFile] +// CHECK:STDERR: ╰──── // CHECK:STDERR: final impl forall [T: type] T as Z(T) {} @@ -299,8 +398,17 @@ class C {} final impl forall [T: type] T as Z(T) {} -// CHECK:STDERR: fail_final_overlaps_later_final_impl.carbon:[[@LINE+3]]:1-22: error: `final impl` overlaps with `final impl` from same file outside a `match_first` block [FinalImplOverlapsSameFile] -// CHECK:STDERR: fail_final_overlaps_later_final_impl.carbon:[[@LINE-3]]:1-39: note: other `final impl` here [FinalImplOverlapsSameFileNote] +// CHECK:STDERR: ╭─┤ fail_final_overlaps_later_final_impl.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: │ final impl forall [T: type] T as Z(T) {} +// CHECK:STDERR: · ───────────────────┬─────────────────── +// CHECK:STDERR: · ╰──┤ other `final impl` here [FinalImplOverlapsSameFileNote] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ final impl C as Z(C) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `final impl` overlaps with `final impl` from same file outside a +// CHECK:STDERR: · ┃ `match_first` block +// CHECK:STDERR: · ┃ [FinalImplOverlapsSameFile] +// CHECK:STDERR: ╰──── // CHECK:STDERR: final impl C as Z(C) {} @@ -317,8 +425,17 @@ class C(T: type); // No diagnosis here as the type structure is unique. impl forall [T: type] T as Z(C(T)) {} -// CHECK:STDERR: fail_non_final_type_structure_matches_non_final_impl.carbon:[[@LINE+3]]:1-33: error: found non-final `impl` with the same type structure as another non-final `impl` [ImplNonFinalSameTypeStructure] -// CHECK:STDERR: fail_non_final_type_structure_matches_non_final_impl.carbon:[[@LINE-8]]:1-30: note: other `impl` here [ImplNonFinalSameTypeStructureNote] +// CHECK:STDERR: ╭─┤ fail_non_final_type_structure_matches_non_final_impl.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: │ impl forall [T: Y] T as Z(T) {} +// CHECK:STDERR: · ───────────────┬────────────── +// CHECK:STDERR: · ╰──┤ other `impl` here [ImplNonFinalSameTypeStructureNote] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ impl forall [T: type] T as Z(T) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: found non-final `impl` with the same type structure as another +// CHECK:STDERR: · ┃ non-final `impl` +// CHECK:STDERR: · ┃ [ImplNonFinalSameTypeStructure] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [T: type] T as Z(T) {} @@ -359,7 +476,17 @@ class C(T: type) {} // more specific in the self type. They overlap for the query `C(()) as Z(())` // but neither impl is completely more specific than the other. final impl forall [T: type] C(T) as Z(()) {} -// CHECK:STDERR: fail_final_overlap_where_each_is_more_specific_than_the_other.carbon:[[@LINE+3]]:1-43: error: `final impl` overlaps with `final impl` from same file outside a `match_first` block [FinalImplOverlapsSameFile] -// CHECK:STDERR: fail_final_overlap_where_each_is_more_specific_than_the_other.carbon:[[@LINE-2]]:1-43: note: other `final impl` here [FinalImplOverlapsSameFileNote] +// CHECK:STDERR: ╭─┤ fail_final_overlap_where_each_is_more_specific_than_the_other.carbon:[[@LINE+13]]:1 +// CHECK:STDERR: │ final impl forall [T: type] C(T) as Z(()) {} +// CHECK:STDERR: · ─────────────────────┬───────────────────── +// CHECK:STDERR: · ╰──┤ other `final impl` here +// CHECK:STDERR: · │ [FinalImplOverlapsSameFileNote] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ final impl forall [T: type] C(()) as Z(T) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `final impl` overlaps with `final impl` from same file outside a +// CHECK:STDERR: · ┃ `match_first` block +// CHECK:STDERR: · ┃ [FinalImplOverlapsSameFile] +// CHECK:STDERR: ╰──── // CHECK:STDERR: final impl forall [T: type] C(()) as Z(T) {} diff --git a/toolchain/check/testdata/impl/lookup/impl_overlap_wrapped_types.carbon b/toolchain/check/testdata/impl/lookup/impl_overlap_wrapped_types.carbon index 6061c0738a37..f9f37539ed0c 100644 --- a/toolchain/check/testdata/impl/lookup/impl_overlap_wrapped_types.carbon +++ b/toolchain/check/testdata/impl/lookup/impl_overlap_wrapped_types.carbon @@ -41,8 +41,15 @@ impl Core.MaybeUnformed(C) as I {} impl partial C as I {} impl C* as I {} -// CHECK:STDERR: fail_const_overlap.carbon:[[@LINE+3]]:1-19: error: redefinition of `impl const C as I` [ImplRedefinition] -// CHECK:STDERR: fail_const_overlap.carbon:[[@LINE-6]]:1-19: note: previous definition was here [ImplPreviousDefinition] +// CHECK:STDERR: ╭─┤ fail_const_overlap.carbon:[[@LINE+10]]:1 +// CHECK:STDERR: │ impl const C as I {} +// CHECK:STDERR: · ─────────┬───────── +// CHECK:STDERR: · ╰──┤ previous definition was here [ImplPreviousDefinition] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ impl const C as I {} +// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redefinition of `impl const C as I` [ImplRedefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl const C as I {} @@ -58,8 +65,16 @@ impl Core.MaybeUnformed(C) as I {} impl partial C as I {} impl C* as I {} -// CHECK:STDERR: fail_maybe_unformed_overlap.carbon:[[@LINE+3]]:1-33: error: redefinition of `impl Core.MaybeUnformed(C as Core.Destroy) as I` [ImplRedefinition] -// CHECK:STDERR: fail_maybe_unformed_overlap.carbon:[[@LINE-5]]:1-33: note: previous definition was here [ImplPreviousDefinition] +// CHECK:STDERR: ╭─┤ fail_maybe_unformed_overlap.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: │ impl Core.MaybeUnformed(C) as I {} +// CHECK:STDERR: · ────────────────┬──────────────── +// CHECK:STDERR: · ╰──┤ previous definition was here [ImplPreviousDefinition] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ impl Core.MaybeUnformed(C) as I {} +// CHECK:STDERR: · ━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redefinition of `impl Core.MaybeUnformed(C as Core.Destroy) as I` +// CHECK:STDERR: · ┃ [ImplRedefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl Core.MaybeUnformed(C) as I {} @@ -75,8 +90,15 @@ impl Core.MaybeUnformed(C) as I {} impl partial C as I {} impl C* as I {} -// CHECK:STDERR: fail_partial_overlap.carbon:[[@LINE+3]]:1-21: error: redefinition of `impl partial C as I` [ImplRedefinition] -// CHECK:STDERR: fail_partial_overlap.carbon:[[@LINE-4]]:1-21: note: previous definition was here [ImplPreviousDefinition] +// CHECK:STDERR: ╭─┤ fail_partial_overlap.carbon:[[@LINE+10]]:1 +// CHECK:STDERR: │ impl partial C as I {} +// CHECK:STDERR: · ──────────┬────────── +// CHECK:STDERR: · ╰──┤ previous definition was here [ImplPreviousDefinition] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ impl partial C as I {} +// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redefinition of `impl partial C as I` [ImplRedefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl partial C as I {} @@ -92,7 +114,14 @@ impl Core.MaybeUnformed(C) as I {} impl partial C as I {} impl C* as I {} -// CHECK:STDERR: fail_pointer_overlap.carbon:[[@LINE+3]]:1-14: error: redefinition of `impl C* as I` [ImplRedefinition] -// CHECK:STDERR: fail_pointer_overlap.carbon:[[@LINE-3]]:1-14: note: previous definition was here [ImplPreviousDefinition] +// CHECK:STDERR: ╭─┤ fail_pointer_overlap.carbon:[[@LINE+10]]:1 +// CHECK:STDERR: │ impl C* as I {} +// CHECK:STDERR: · ───────┬────── +// CHECK:STDERR: · ╰──┤ previous definition was here [ImplPreviousDefinition] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ impl C* as I {} +// CHECK:STDERR: · ━━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redefinition of `impl C* as I` [ImplRedefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl C* as I {} diff --git a/toolchain/check/testdata/impl/lookup/import.carbon b/toolchain/check/testdata/impl/lookup/import.carbon index f41f630f03d6..c0e565dda6e3 100644 --- a/toolchain/check/testdata/impl/lookup/import.carbon +++ b/toolchain/check/testdata/impl/lookup/import.carbon @@ -216,7 +216,14 @@ import HasExtraInterfaces; fn Test(c: HasExtraInterfaces.C(type)) { // This triggers the import of a bunch more interfaces, which reallocates the // interface ValueStore. Ensure that doesn't result in a use-after-free crash. - // CHECK:STDERR: fail_use_has_extra_interfaces.carbon:[[@LINE+2]]:3-28: error: cannot access member of interface `HasExtraInterfaces.I` in type `HasExtraInterfaces.C(type)` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_use_has_extra_interfaces.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ c.(HasExtraInterfaces.I.F)(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `HasExtraInterfaces.I` in type + // CHECK:STDERR: · ┃ `HasExtraInterfaces.C(type)` that does not implement that + // CHECK:STDERR: · ┃ interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: c.(HasExtraInterfaces.I.F)(); } @@ -3404,7 +3411,7 @@ fn Test(c: HasExtraInterfaces.C(type)) { // CHECK:STDOUT: fn @Test(%c.param: %C.6a9) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %c.ref: %C.6a9 = name_ref c, %c -// CHECK:STDOUT: %HasExtraInterfaces.ref.loc10: = name_ref HasExtraInterfaces, imports.%HasExtraInterfaces [concrete = imports.%HasExtraInterfaces] +// CHECK:STDOUT: %HasExtraInterfaces.ref.loc17: = name_ref HasExtraInterfaces, imports.%HasExtraInterfaces [concrete = imports.%HasExtraInterfaces] // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%HasExtraInterfaces.I [concrete = constants.%I.type] // CHECK:STDOUT: %F.ref: %I.assoc_type = name_ref F, imports.%HasExtraInterfaces.import_ref.d70 [concrete = constants.%assoc0] // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/impl/lookup/import_error.carbon b/toolchain/check/testdata/impl/lookup/import_error.carbon index 842c85c52cf5..c3d077f75974 100644 --- a/toolchain/check/testdata/impl/lookup/import_error.carbon +++ b/toolchain/check/testdata/impl/lookup/import_error.carbon @@ -18,7 +18,13 @@ interface Z { } // The value of .X is an error. -// CHECK:STDERR: fail_error_interface_z.carbon:[[@LINE+2]]:34-60: error: associated constant `.(Z.X)` given two different values `{}` and `()` [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╭─┤ fail_error_interface_z.carbon:[[@LINE+8]]:34 +// CHECK:STDERR: -> │ final impl forall [T: type] T as Z where .X = {} and .X = () {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: associated constant `.(Z.X)` given +// CHECK:STDERR: · ┃ two different values `{}` and `()` +// CHECK:STDERR: · ┃ [AssociatedConstantWithDifferentValues] +// CHECK:STDERR: ╰──── // CHECK:STDERR: final impl forall [T: type] T as Z where .X = {} and .X = () {} @@ -30,8 +36,16 @@ import library "error_interface_z"; fn F[unused U: type](generic T: Z) { // The value of `.X` is an error. It should not crash though. // - // CHECK:STDERR: fail_import_error.carbon:[[@LINE+3]]:23-24: error: cannot implicitly convert expression of type `()` to `T.(Z.X)` [ConversionFailure] - // CHECK:STDERR: fail_import_error.carbon:[[@LINE+2]]:23-24: note: type `()` does not implement interface `Core.ImplicitAs(T.(Z.X))` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_import_error.carbon:[[@LINE+11]]:23 + // CHECK:STDERR: -> │ let unused a: T.X = (); + // CHECK:STDERR: · ┳━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type + // CHECK:STDERR: · │ ┃ `()` to `T.(Z.X)` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `()` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(T.(Z.X))` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused a: T.X = (); } diff --git a/toolchain/check/testdata/impl/lookup/specialization.carbon b/toolchain/check/testdata/impl/lookup/specialization.carbon index a12345be6265..b069c31da976 100644 --- a/toolchain/check/testdata/impl/lookup/specialization.carbon +++ b/toolchain/check/testdata/impl/lookup/specialization.carbon @@ -237,8 +237,16 @@ fn F[D: Y](unused d: D) { // because we are in a generic where `D` is an unknown type, which will cause // the query and impl self type to be C(FacetValue) for a symbolic FacetValue. // - // CHECK:STDERR: fail_specialized_class_with_symbolic_facet_value_param.carbon:[[@LINE+3]]:30-31: error: cannot implicitly convert expression of type `()` to `C(D).(Z.X)` [ConversionFailure] - // CHECK:STDERR: fail_specialized_class_with_symbolic_facet_value_param.carbon:[[@LINE+2]]:30-31: note: type `()` does not implement interface `Core.ImplicitAs(C(D).(Z.X))` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_specialized_class_with_symbolic_facet_value_param.carbon:[[@LINE+11]]:30 + // CHECK:STDERR: -> │ let unused a: C(D).(Z.X) = (); + // CHECK:STDERR: · ┳━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of + // CHECK:STDERR: · │ ┃ type `()` to `C(D).(Z.X)` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `()` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(C(D).(Z.X))` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused a: C(D).(Z.X) = (); } @@ -335,8 +343,16 @@ impl forall [T: type, U: type] T as Z(U) where .X = () {} fn F[unused U: type](generic T: Z(C)) { // The value of `.X` is symbolic, it can't be assigned a value of type `C`. - // CHECK:STDERR: fail_specialization_written_after_generic_use_of_type_constant.carbon:[[@LINE+3]]:23-29: error: cannot implicitly convert expression of type `C` to `T.(Z(C).X)` [ConversionFailure] - // CHECK:STDERR: fail_specialization_written_after_generic_use_of_type_constant.carbon:[[@LINE+2]]:23-29: note: type `C` does not implement interface `Core.ImplicitAs(T.(Z(C).X))` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_specialization_written_after_generic_use_of_type_constant.carbon:[[@LINE+11]]:23 + // CHECK:STDERR: -> │ let unused a: T.X = {} as C; + // CHECK:STDERR: · ┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type + // CHECK:STDERR: · │ ┃ `C` to `T.(Z(C).X)` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `C` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(T.(Z(C).X))` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused a: T.X = {} as C; } diff --git a/toolchain/check/testdata/impl/lookup/specialization_poison.carbon b/toolchain/check/testdata/impl/lookup/specialization_poison.carbon index dd3dc4fcb432..dcc5705c0620 100644 --- a/toolchain/check/testdata/impl/lookup/specialization_poison.carbon +++ b/toolchain/check/testdata/impl/lookup/specialization_poison.carbon @@ -22,7 +22,24 @@ impl forall [U: type] U as I where .T = () { fn F(unused self) -> () { return (); } } -// CHECK:STDERR: fail_final_poisoned_concrete_query_in_specific.carbon:[[@LINE+1]]:24-30: error: found `impl` that would change the result of an earlier use of `C* as I` [PoisonedImplLookupConcreteResult] +// CHECK:STDERR: ╭─┤ fail_final_poisoned_concrete_query_in_specific.carbon:[[@LINE+18]]:24 +// CHECK:STDERR: │ impl forall [U: type] U as I where .T = () { +// CHECK:STDERR: · ──────────────────────┬───────────────────── +// CHECK:STDERR: · ╰──┤ the use had selected the `impl` here +// CHECK:STDERR: · │ [PoisonedImplLookupConcreteResultNotePreviousImpl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn H[W: type](v: W) -> W.(I.T) { +// CHECK:STDERR: · ┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: found `impl` that would change the result of +// CHECK:STDERR: · ┃ an earlier use of `C* as I` +// CHECK:STDERR: · ┃ [PoisonedImplLookupConcreteResult] +// CHECK:STDERR: ┆ +// CHECK:STDERR: │ impl C* as I where .T = C { +// CHECK:STDERR: · ─────────────┬───────────── +// CHECK:STDERR: · ╰──┤ the use would select the `impl` here but it was not found yet +// CHECK:STDERR: · │ [PoisonedImplLookupConcreteResultNoteBadImpl] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: fn H[W: type](v: W) -> W.(I.T) { return v.(I.F)(); } @@ -34,9 +51,6 @@ fn G(p: C*) -> () { return H(p); } -// CHECK:STDERR: fail_final_poisoned_concrete_query_in_specific.carbon:[[@LINE+3]]:1-27: note: the use would select the `impl` here but it was not found yet [PoisonedImplLookupConcreteResultNoteBadImpl] -// CHECK:STDERR: fail_final_poisoned_concrete_query_in_specific.carbon:[[@LINE-17]]:1-44: note: the use had selected the `impl` here [PoisonedImplLookupConcreteResultNotePreviousImpl] -// CHECK:STDERR: impl C* as I where .T = C { fn F(self) -> C { return *self; } } @@ -54,13 +68,27 @@ class C {} fn H[W: type](unused v: W) { // This concrete impl lookup query poisons any further specializations. - // CHECK:STDERR: fail_final_poisoned_concrete_query_in_generic.carbon:[[@LINE+1]]:17-23: error: found `impl` that would change the result of an earlier use of `C as I` [PoisonedImplLookupConcreteResult] + // CHECK:STDERR: ╭─┤ fail_final_poisoned_concrete_query_in_generic.carbon:[[@LINE+18]]:17 + // CHECK:STDERR: │ impl forall [U: type] U as I where .T = () {} + // CHECK:STDERR: · ──────────────────────┬───────────────────── + // CHECK:STDERR: · ╰──┤ the use had selected the `impl` here + // CHECK:STDERR: · │ [PoisonedImplLookupConcreteResultNotePreviousImpl] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ let unused a: C.(I.T) = (); + // CHECK:STDERR: · ┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: found `impl` that would change the result of an + // CHECK:STDERR: · ┃ earlier use of `C as I` + // CHECK:STDERR: · ┃ [PoisonedImplLookupConcreteResult] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ impl C as I where .T = C {} + // CHECK:STDERR: · ─────────────┬──────────── + // CHECK:STDERR: · ╰──┤ the use would select the `impl` here but it was not found yet + // CHECK:STDERR: · │ [PoisonedImplLookupConcreteResultNoteBadImpl] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: let unused a: C.(I.T) = (); } -// CHECK:STDERR: fail_final_poisoned_concrete_query_in_generic.carbon:[[@LINE+3]]:1-26: note: the use would select the `impl` here but it was not found yet [PoisonedImplLookupConcreteResultNoteBadImpl] -// CHECK:STDERR: fail_final_poisoned_concrete_query_in_generic.carbon:[[@LINE-11]]:1-44: note: the use had selected the `impl` here [PoisonedImplLookupConcreteResultNotePreviousImpl] -// CHECK:STDERR: impl C as I where .T = C {} // --- fail_final_poisoned_concrete_query_nested_type_in_self.carbon @@ -79,13 +107,27 @@ impl forall [U: type] C(U) as I where .T = () { fn G(c: C(())) -> () { // This concrete impl lookup query poisons any further specializations. - // CHECK:STDERR: fail_final_poisoned_concrete_query_nested_type_in_self.carbon:[[@LINE+1]]:10-16: error: found `impl` that would change the result of an earlier use of `C(()) as I` [PoisonedImplLookupConcreteResult] + // CHECK:STDERR: ╭─┤ fail_final_poisoned_concrete_query_nested_type_in_self.carbon:[[@LINE+18]]:10 + // CHECK:STDERR: │ impl forall [U: type] C(U) as I where .T = () { + // CHECK:STDERR: · ───────────────────────┬─────────────────────── + // CHECK:STDERR: · ╰──┤ the use had selected the `impl` here + // CHECK:STDERR: · │ [PoisonedImplLookupConcreteResultNotePreviousImpl] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ return c.(I.F)(); + // CHECK:STDERR: · ┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: found `impl` that would change the result of an earlier use + // CHECK:STDERR: · ┃ of `C(()) as I` + // CHECK:STDERR: · ┃ [PoisonedImplLookupConcreteResult] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ impl C(()) as I where .T = {} { + // CHECK:STDERR: · ──────────────┬──────────────── + // CHECK:STDERR: · ╰──┤ the use would select the `impl` here but it was not found yet + // CHECK:STDERR: · │ [PoisonedImplLookupConcreteResultNoteBadImpl] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: return c.(I.F)(); } -// CHECK:STDERR: fail_final_poisoned_concrete_query_nested_type_in_self.carbon:[[@LINE+3]]:1-31: note: the use would select the `impl` here but it was not found yet [PoisonedImplLookupConcreteResultNoteBadImpl] -// CHECK:STDERR: fail_final_poisoned_concrete_query_nested_type_in_self.carbon:[[@LINE-11]]:1-47: note: the use had selected the `impl` here [PoisonedImplLookupConcreteResultNotePreviousImpl] -// CHECK:STDERR: impl C(()) as I where .T = {} { fn F(unused self) -> {} { return {}; } } @@ -106,13 +148,27 @@ class C {} fn G(c: C) -> () { // This concrete impl lookup query poisons any further specializations. - // CHECK:STDERR: fail_final_poisoned_concrete_query_nested_type_in_interface.carbon:[[@LINE+1]]:10-19: error: found `impl` that would change the result of an earlier use of `C as I(C)` [PoisonedImplLookupConcreteResult] + // CHECK:STDERR: ╭─┤ fail_final_poisoned_concrete_query_nested_type_in_interface.carbon:[[@LINE+18]]:10 + // CHECK:STDERR: │ impl forall [U: type] U as I(U) where .T = () { + // CHECK:STDERR: · ───────────────────────┬─────────────────────── + // CHECK:STDERR: · ╰──┤ the use had selected the `impl` here + // CHECK:STDERR: · │ [PoisonedImplLookupConcreteResultNotePreviousImpl] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ return c.(I(C).F)(); + // CHECK:STDERR: · ┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: found `impl` that would change the result of an earlier use + // CHECK:STDERR: · ┃ of `C as I(C)` + // CHECK:STDERR: · ┃ [PoisonedImplLookupConcreteResult] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ impl C as I(C) where .T = {} { + // CHECK:STDERR: · ──────────────┬─────────────── + // CHECK:STDERR: · ╰──┤ the use would select the `impl` here but it was not found yet + // CHECK:STDERR: · │ [PoisonedImplLookupConcreteResultNoteBadImpl] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: return c.(I(C).F)(); } -// CHECK:STDERR: fail_final_poisoned_concrete_query_nested_type_in_interface.carbon:[[@LINE+3]]:1-30: note: the use would select the `impl` here but it was not found yet [PoisonedImplLookupConcreteResultNoteBadImpl] -// CHECK:STDERR: fail_final_poisoned_concrete_query_nested_type_in_interface.carbon:[[@LINE-13]]:1-47: note: the use had selected the `impl` here [PoisonedImplLookupConcreteResultNotePreviousImpl] -// CHECK:STDERR: impl C as I(C) where .T = {} { fn F(unused self) -> {} { return {}; } } @@ -156,13 +212,27 @@ fn F() { musteval fn G() -> auto { class C(T: type) {} impl forall [T: type] C(T) as Z {} - // CHECK:STDERR: fail_poisoned_concrete_lookup_from_eval_fn.carbon:[[@LINE+1]]:5-13: error: found `impl` that would change the result of an earlier use of `C(D) as Z` [PoisonedImplLookupConcreteResult] + // CHECK:STDERR: ╭─┤ fail_poisoned_concrete_lookup_from_eval_fn.carbon:[[@LINE+18]]:5 + // CHECK:STDERR: │ impl forall [T: type] C(T) as Z {} + // CHECK:STDERR: · ────────────────┬──────────────── + // CHECK:STDERR: · ╰──┤ the use had selected the `impl` here + // CHECK:STDERR: · │ [PoisonedImplLookupConcreteResultNotePreviousImpl] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ C(D) as Z; + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: found `impl` that would change the result of an earlier use of + // CHECK:STDERR: · ┃ `C(D) as Z` + // CHECK:STDERR: · ┃ [PoisonedImplLookupConcreteResult] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ impl G() as Z {} + // CHECK:STDERR: · ───────┬─────── + // CHECK:STDERR: · ╰──┤ the use would select the `impl` here but it was not found yet + // CHECK:STDERR: · │ [PoisonedImplLookupConcreteResultNoteBadImpl] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: C(D) as Z; return C(D); } - // CHECK:STDERR: fail_poisoned_concrete_lookup_from_eval_fn.carbon:[[@LINE+3]]:3-17: note: the use would select the `impl` here but it was not found yet [PoisonedImplLookupConcreteResultNoteBadImpl] - // CHECK:STDERR: fail_poisoned_concrete_lookup_from_eval_fn.carbon:[[@LINE-7]]:5-37: note: the use had selected the `impl` here [PoisonedImplLookupConcreteResultNotePreviousImpl] - // CHECK:STDERR: impl G() as Z {} } diff --git a/toolchain/check/testdata/impl/lookup/specialization_with_symbolic_rewrite.carbon b/toolchain/check/testdata/impl/lookup/specialization_with_symbolic_rewrite.carbon index 080141a03e4a..fa033b06d1ed 100644 --- a/toolchain/check/testdata/impl/lookup/specialization_with_symbolic_rewrite.carbon +++ b/toolchain/check/testdata/impl/lookup/specialization_with_symbolic_rewrite.carbon @@ -45,8 +45,16 @@ impl forall [T: type, S: type] T as Z(S) where .X = () {} impl forall [T: type] T as Z(C) where .X = T {} fn F(generic T: Z(C), t: T) { - // CHECK:STDERR: fail_nonfinal_specialized_symbolic_rewrite.carbon:[[@LINE+3]]:23: error: cannot implicitly convert expression of type `T` to `T.(Z(C).X)` [ConversionFailure] - // CHECK:STDERR: fail_nonfinal_specialized_symbolic_rewrite.carbon:[[@LINE+2]]:23: note: type `T` does not implement interface `Core.ImplicitAs(T.(Z(C).X))` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_nonfinal_specialized_symbolic_rewrite.carbon:[[@LINE+11]]:23 + // CHECK:STDERR: -> │ let unused a: T.X = t; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type + // CHECK:STDERR: · │ ┃ `T` to `T.(Z(C).X)` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `T` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(T.(Z(C).X))` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused a: T.X = t; } @@ -811,33 +819,33 @@ fn F[T: Ptr](var t: T) -> T.(Ptr.Type) { // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete.loc14: = require_complete_type %T.as_type.loc14_26.1 [symbolic = %require_complete.loc14 (constants.%require_complete.6f0)] // CHECK:STDOUT: %Z.lookup_impl_witness: = lookup_impl_witness %T.loc14_15.1, @Z, @Z(constants.%C) [symbolic = %Z.lookup_impl_witness (constants.%Z.lookup_impl_witness)] -// CHECK:STDOUT: %impl.elem0.loc18_18.2: type = impl_witness_access %Z.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc18_18.2 (constants.%impl.elem0.5bb)] -// CHECK:STDOUT: %require_complete.loc18_18: = require_complete_type %impl.elem0.loc18_18.2 [symbolic = %require_complete.loc18_18 (constants.%require_complete.fee)] -// CHECK:STDOUT: %pattern_type.loc18: type = pattern_type %impl.elem0.loc18_18.2 [symbolic = %pattern_type.loc18 (constants.%pattern_type.58e)] -// CHECK:STDOUT: %a.patt.loc18_15.2: @F.%pattern_type.loc18 (%pattern_type.58e) = value_binding_pattern a [symbolic = %a.patt.loc18_15.2 (constants.%a.patt)] -// CHECK:STDOUT: %ImplicitAs.type.loc18_23.2: type = facet_type <@ImplicitAs, @ImplicitAs(%impl.elem0.loc18_18.2)> [symbolic = %ImplicitAs.type.loc18_23.2 (constants.%ImplicitAs.type.64b)] -// CHECK:STDOUT: %require_complete.loc18_23: = require_complete_type %ImplicitAs.type.loc18_23.2 [symbolic = %require_complete.loc18_23 (constants.%require_complete.535)] -// CHECK:STDOUT: %ImplicitAs.assoc_type: type = assoc_entity_type @ImplicitAs, @ImplicitAs(%impl.elem0.loc18_18.2) [symbolic = %ImplicitAs.assoc_type (constants.%ImplicitAs.assoc_type.1b5)] +// CHECK:STDOUT: %impl.elem0.loc26_18.2: type = impl_witness_access %Z.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc26_18.2 (constants.%impl.elem0.5bb)] +// CHECK:STDOUT: %require_complete.loc26_18: = require_complete_type %impl.elem0.loc26_18.2 [symbolic = %require_complete.loc26_18 (constants.%require_complete.fee)] +// CHECK:STDOUT: %pattern_type.loc26: type = pattern_type %impl.elem0.loc26_18.2 [symbolic = %pattern_type.loc26 (constants.%pattern_type.58e)] +// CHECK:STDOUT: %a.patt.loc26_15.2: @F.%pattern_type.loc26 (%pattern_type.58e) = value_binding_pattern a [symbolic = %a.patt.loc26_15.2 (constants.%a.patt)] +// CHECK:STDOUT: %ImplicitAs.type.loc26_23.2: type = facet_type <@ImplicitAs, @ImplicitAs(%impl.elem0.loc26_18.2)> [symbolic = %ImplicitAs.type.loc26_23.2 (constants.%ImplicitAs.type.64b)] +// CHECK:STDOUT: %require_complete.loc26_23: = require_complete_type %ImplicitAs.type.loc26_23.2 [symbolic = %require_complete.loc26_23 (constants.%require_complete.535)] +// CHECK:STDOUT: %ImplicitAs.assoc_type: type = assoc_entity_type @ImplicitAs, @ImplicitAs(%impl.elem0.loc26_18.2) [symbolic = %ImplicitAs.assoc_type (constants.%ImplicitAs.assoc_type.1b5)] // CHECK:STDOUT: %assoc0: @F.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.1b5) = assoc_entity element0, imports.%Core.import_ref.a03 [symbolic = %assoc0 (constants.%assoc0.e44)] // CHECK:STDOUT: // CHECK:STDOUT: fn(%t.param: @F.%T.as_type.loc14_26.1 (%T.as_type)) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %t.ref: @F.%T.as_type.loc14_26.1 (%T.as_type) = name_ref t, %t -// CHECK:STDOUT: %ImplicitAs.type.loc18_23.1: type = facet_type <@ImplicitAs, @ImplicitAs(constants.%impl.elem0.5bb)> [symbolic = %ImplicitAs.type.loc18_23.2 (constants.%ImplicitAs.type.64b)] -// CHECK:STDOUT: %.loc18_23.1: @F.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.1b5) = specific_constant imports.%Core.import_ref.383, @ImplicitAs.WithSelf(constants.%impl.elem0.5bb, constants.%Self.862) [symbolic = %assoc0 (constants.%assoc0.e44)] -// CHECK:STDOUT: %Convert.ref: @F.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.1b5) = name_ref Convert, %.loc18_23.1 [symbolic = %assoc0 (constants.%assoc0.e44)] -// CHECK:STDOUT: %.loc18_23.2: @F.%impl.elem0.loc18_18.2 (%impl.elem0.5bb) = converted %t.ref, [concrete = ] -// CHECK:STDOUT: %.loc18_18.1: type = splice_block %impl.elem0.loc18_18.1 [symbolic = %impl.elem0.loc18_18.2 (constants.%impl.elem0.5bb)] { -// CHECK:STDOUT: %T.ref.loc18: %Z.type.a07 = name_ref T, %T.loc14_15.2 [symbolic = %T.loc14_15.1 (constants.%T.bdb)] -// CHECK:STDOUT: %T.as_type.loc18: type = facet_access_type %T.ref.loc18 [symbolic = %T.as_type.loc14_26.1 (constants.%T.as_type)] -// CHECK:STDOUT: %.loc18_18.2: type = converted %T.ref.loc18, %T.as_type.loc18 [symbolic = %T.as_type.loc14_26.1 (constants.%T.as_type)] -// CHECK:STDOUT: %.loc18_18.3: %Z.assoc_type.714 = specific_constant @X.%assoc0, @Z.WithSelf(constants.%C, constants.%T.bdb) [concrete = constants.%assoc0.fd2] -// CHECK:STDOUT: %X.ref: %Z.assoc_type.714 = name_ref X, %.loc18_18.3 [concrete = constants.%assoc0.fd2] -// CHECK:STDOUT: %impl.elem0.loc18_18.1: type = impl_witness_access constants.%Z.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc18_18.2 (constants.%impl.elem0.5bb)] +// CHECK:STDOUT: %ImplicitAs.type.loc26_23.1: type = facet_type <@ImplicitAs, @ImplicitAs(constants.%impl.elem0.5bb)> [symbolic = %ImplicitAs.type.loc26_23.2 (constants.%ImplicitAs.type.64b)] +// CHECK:STDOUT: %.loc26_23.1: @F.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.1b5) = specific_constant imports.%Core.import_ref.383, @ImplicitAs.WithSelf(constants.%impl.elem0.5bb, constants.%Self.862) [symbolic = %assoc0 (constants.%assoc0.e44)] +// CHECK:STDOUT: %Convert.ref: @F.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.1b5) = name_ref Convert, %.loc26_23.1 [symbolic = %assoc0 (constants.%assoc0.e44)] +// CHECK:STDOUT: %.loc26_23.2: @F.%impl.elem0.loc26_18.2 (%impl.elem0.5bb) = converted %t.ref, [concrete = ] +// CHECK:STDOUT: %.loc26_18.1: type = splice_block %impl.elem0.loc26_18.1 [symbolic = %impl.elem0.loc26_18.2 (constants.%impl.elem0.5bb)] { +// CHECK:STDOUT: %T.ref.loc26: %Z.type.a07 = name_ref T, %T.loc14_15.2 [symbolic = %T.loc14_15.1 (constants.%T.bdb)] +// CHECK:STDOUT: %T.as_type.loc26: type = facet_access_type %T.ref.loc26 [symbolic = %T.as_type.loc14_26.1 (constants.%T.as_type)] +// CHECK:STDOUT: %.loc26_18.2: type = converted %T.ref.loc26, %T.as_type.loc26 [symbolic = %T.as_type.loc14_26.1 (constants.%T.as_type)] +// CHECK:STDOUT: %.loc26_18.3: %Z.assoc_type.714 = specific_constant @X.%assoc0, @Z.WithSelf(constants.%C, constants.%T.bdb) [concrete = constants.%assoc0.fd2] +// CHECK:STDOUT: %X.ref: %Z.assoc_type.714 = name_ref X, %.loc26_18.3 [concrete = constants.%assoc0.fd2] +// CHECK:STDOUT: %impl.elem0.loc26_18.1: type = impl_witness_access constants.%Z.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc26_18.2 (constants.%impl.elem0.5bb)] // CHECK:STDOUT: } -// CHECK:STDOUT: %a: @F.%impl.elem0.loc18_18.2 (%impl.elem0.5bb) = wrapper_binding a, [concrete = ] +// CHECK:STDOUT: %a: @F.%impl.elem0.loc26_18.2 (%impl.elem0.5bb) = wrapper_binding a, [concrete = ] // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %a.patt.loc18_15.1: @F.%pattern_type.loc18 (%pattern_type.58e) = value_binding_pattern a [symbolic = %a.patt.loc18_15.2 (constants.%a.patt)] +// CHECK:STDOUT: %a.patt.loc26_15.1: @F.%pattern_type.loc26 (%pattern_type.58e) = value_binding_pattern a [symbolic = %a.patt.loc26_15.2 (constants.%a.patt)] // CHECK:STDOUT: } // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/impl/lookup/unused_generic_binding.carbon b/toolchain/check/testdata/impl/lookup/unused_generic_binding.carbon index de0fdf6b8d5b..8472c1c1f0a1 100644 --- a/toolchain/check/testdata/impl/lookup/unused_generic_binding.carbon +++ b/toolchain/check/testdata/impl/lookup/unused_generic_binding.carbon @@ -24,7 +24,12 @@ class C {} // This impl can never deduce its implicit generic parameter `V`, which // should be diagnosed. // -// CHECK:STDERR: fail_no_binding_used.carbon:[[@LINE+2]]:13-21: error: `impl` with unused generic binding [ImplUnusedBinding] +// CHECK:STDERR: ╭─┤ fail_no_binding_used.carbon:[[@LINE+7]]:13 +// CHECK:STDERR: -> │ impl forall [V: type] C as I where .T = {.unmatched: ()} {} +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: `impl` with unused generic binding +// CHECK:STDERR: · ┃ [ImplUnusedBinding] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [V: type] C as I where .T = {.unmatched: ()} {} @@ -51,7 +56,12 @@ class C {} // should be diagnosed. // https://discord.com/channels/655572317891461132/941071822756143115/1354563497731686550 // -// CHECK:STDERR: fail_one_binding_unused.carbon:[[@LINE+2]]:13-30: error: `impl` with unused generic binding [ImplUnusedBinding] +// CHECK:STDERR: ╭─┤ fail_one_binding_unused.carbon:[[@LINE+7]]:13 +// CHECK:STDERR: -> │ impl forall [V: type, W: type] V as I where .T = {.unmatched: ()} {} +// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `impl` with unused generic binding +// CHECK:STDERR: · ┃ [ImplUnusedBinding] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [V: type, W: type] V as I where .T = {.unmatched: ()} {} @@ -77,7 +87,12 @@ class C(U: type) { // // TODO: We should point the diagnostic at the binding `U` in C. // - // CHECK:STDERR: fail_inherited_binding_unused.carbon:[[@LINE+2]]:3-47: error: `impl` with unused generic binding [ImplUnusedBinding] + // CHECK:STDERR: ╭─┤ fail_inherited_binding_unused.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ impl C(()) as I where .T = {.unmatched: ()} {} + // CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: `impl` with unused generic binding + // CHECK:STDERR: · ┃ [ImplUnusedBinding] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl C(()) as I where .T = {.unmatched: ()} {} } @@ -101,7 +116,12 @@ class C(U: type) { // // TODO: We should point the diagnostic at the binding `U` in C. // - // CHECK:STDERR: fail_inherited_binding_in_forall_unused.carbon:[[@LINE+2]]:15-23: error: `impl` with unused generic binding [ImplUnusedBinding] + // CHECK:STDERR: ╭─┤ fail_inherited_binding_in_forall_unused.carbon:[[@LINE+7]]:15 + // CHECK:STDERR: -> │ impl forall [V: type] C(V) as I where .T = {.unmatched: ()} {} + // CHECK:STDERR: · ━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: `impl` with unused generic binding + // CHECK:STDERR: · ┃ [ImplUnusedBinding] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [V: type] C(V) as I where .T = {.unmatched: ()} {} } diff --git a/toolchain/check/testdata/impl/multiple_extend.carbon b/toolchain/check/testdata/impl/multiple_extend.carbon index ecc229ee7e90..3d4e01e3340e 100644 --- a/toolchain/check/testdata/impl/multiple_extend.carbon +++ b/toolchain/check/testdata/impl/multiple_extend.carbon @@ -62,10 +62,20 @@ class D { } fn B(d: D) { - // CHECK:STDERR: fail_ambiguous_impls.carbon:[[@LINE+2]]:3-5: error: ambiguous use of name `A` found in multiple extended scopes [NameAmbiguousDueToExtend] + // CHECK:STDERR: ╭─┤ fail_ambiguous_impls.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ D.A(); + // CHECK:STDERR: · ━┳━ + // CHECK:STDERR: · ┗━━┫ error: ambiguous use of name `A` found in multiple extended scopes + // CHECK:STDERR: · ┃ [NameAmbiguousDueToExtend] + // CHECK:STDERR: ╰──── // CHECK:STDERR: D.A(); - // CHECK:STDERR: fail_ambiguous_impls.carbon:[[@LINE+2]]:3-5: error: ambiguous use of name `A` found in multiple extended scopes [NameAmbiguousDueToExtend] + // CHECK:STDERR: ╭─┤ fail_ambiguous_impls.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ d.A(); + // CHECK:STDERR: · ━┳━ + // CHECK:STDERR: · ┗━━┫ error: ambiguous use of name `A` found in multiple extended scopes + // CHECK:STDERR: · ┃ [NameAmbiguousDueToExtend] + // CHECK:STDERR: ╰──── // CHECK:STDERR: d.A(); } @@ -116,10 +126,20 @@ class L { } fn M(l: L) { - // CHECK:STDERR: fail_ambiguous_impl_and_base.carbon:[[@LINE+2]]:4-6: error: ambiguous use of name `K` found in multiple extended scopes [NameAmbiguousDueToExtend] + // CHECK:STDERR: ╭─┤ fail_ambiguous_impl_and_base.carbon:[[@LINE+7]]:4 + // CHECK:STDERR: -> │ L.K(); + // CHECK:STDERR: · ━┳━ + // CHECK:STDERR: · ┗━━┫ error: ambiguous use of name `K` found in multiple extended scopes + // CHECK:STDERR: · ┃ [NameAmbiguousDueToExtend] + // CHECK:STDERR: ╰──── // CHECK:STDERR: L.K(); - // CHECK:STDERR: fail_ambiguous_impl_and_base.carbon:[[@LINE+2]]:4-6: error: ambiguous use of name `K` found in multiple extended scopes [NameAmbiguousDueToExtend] + // CHECK:STDERR: ╭─┤ fail_ambiguous_impl_and_base.carbon:[[@LINE+7]]:4 + // CHECK:STDERR: -> │ l.K(); + // CHECK:STDERR: · ━┳━ + // CHECK:STDERR: · ┗━━┫ error: ambiguous use of name `K` found in multiple extended scopes + // CHECK:STDERR: · ┃ [NameAmbiguousDueToExtend] + // CHECK:STDERR: ╰──── // CHECK:STDERR: l.K(); } @@ -555,10 +575,10 @@ fn P(o: O) { // CHECK:STDOUT: // CHECK:STDOUT: fn @B(%d.param: %D) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %D.ref.loc24: type = name_ref D, file.%D.decl [concrete = constants.%D] -// CHECK:STDOUT: %A.ref.loc24: = name_ref A, [concrete = ] +// CHECK:STDOUT: %D.ref.loc29: type = name_ref D, file.%D.decl [concrete = constants.%D] +// CHECK:STDOUT: %A.ref.loc29: = name_ref A, [concrete = ] // CHECK:STDOUT: %d.ref: %D = name_ref d, %d -// CHECK:STDOUT: %A.ref.loc27: = name_ref A, [concrete = ] +// CHECK:STDOUT: %A.ref.loc37: = name_ref A, [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -919,10 +939,10 @@ fn P(o: O) { // CHECK:STDOUT: // CHECK:STDOUT: fn @M(%l.param: %L) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %L.ref.loc22: type = name_ref L, file.%L.decl [concrete = constants.%L] -// CHECK:STDOUT: %K.ref.loc22: = name_ref K, [concrete = ] +// CHECK:STDOUT: %L.ref.loc27: type = name_ref L, file.%L.decl [concrete = constants.%L] +// CHECK:STDOUT: %K.ref.loc27: = name_ref K, [concrete = ] // CHECK:STDOUT: %l.ref: %L = name_ref l, %l -// CHECK:STDOUT: %K.ref.loc25: = name_ref K, [concrete = ] +// CHECK:STDOUT: %K.ref.loc35: = name_ref K, [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/name_poisoning.carbon b/toolchain/check/testdata/impl/name_poisoning.carbon index cfd7a0dc6863..f2bf595c6bb0 100644 --- a/toolchain/check/testdata/impl/name_poisoning.carbon +++ b/toolchain/check/testdata/impl/name_poisoning.carbon @@ -36,10 +36,23 @@ interface I { class B { impl as I { - // CHECK:STDERR: fail_impl_function_poisoned.carbon:[[@LINE+5]]:13: error: accessing member from impl before it has a defined value [ImplAccessMemberBeforeSet] + // CHECK:STDERR: ╭─┤ fail_impl_function_poisoned.carbon:[[@LINE+18]]:13 + // CHECK:STDERR: -> │ fn A(x: B); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: accessing member from impl before it has a defined value + // CHECK:STDERR: · ┃ [ImplAccessMemberBeforeSet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_impl_function_poisoned.carbon:[[@LINE+3]]:13: error: cannot implicitly convert non-type value of type `` to `type` [ConversionFailureNonTypeToFacet] - // CHECK:STDERR: fail_impl_function_poisoned.carbon:[[@LINE+2]]:13: note: type `` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_impl_function_poisoned.carbon:[[@LINE+11]]:13 + // CHECK:STDERR: -> │ fn A(x: B); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert non-type value of type + // CHECK:STDERR: · │ ┃ `` to `type` + // CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: · ╰────┤ type `` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(type)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn A(x: B); fn B(); diff --git a/toolchain/check/testdata/impl/no_definition_in_impl_file.carbon b/toolchain/check/testdata/impl/no_definition_in_impl_file.carbon index 302a48cb8e1a..3b46134fde5f 100644 --- a/toolchain/check/testdata/impl/no_definition_in_impl_file.carbon +++ b/toolchain/check/testdata/impl/no_definition_in_impl_file.carbon @@ -18,7 +18,11 @@ library "[[@TEST_NAME]]"; interface A {} -// CHECK:STDERR: fail_decl_in_api_definition_in_impl.carbon:[[@LINE+2]]:1-13: error: impl declared but not defined [ImplMissingDefinition] +// CHECK:STDERR: ╭─┤ fail_decl_in_api_definition_in_impl.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ impl () as A; +// CHECK:STDERR: · ━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: impl declared but not defined [ImplMissingDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as A; @@ -26,11 +30,19 @@ impl () as A; impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_decl_in_api_definition_in_impl.impl.carbon:[[@LINE+2]]:1-13: error: redeclaration of imported impl [RedeclImportedImpl] +// CHECK:STDERR: ╭─┤ fail_decl_in_api_definition_in_impl.impl.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ impl () as A; +// CHECK:STDERR: · ━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of imported impl [RedeclImportedImpl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as A; -// CHECK:STDERR: fail_decl_in_api_definition_in_impl.impl.carbon:[[@LINE+2]]:1-14: error: redeclaration of imported impl [RedeclImportedImpl] +// CHECK:STDERR: ╭─┤ fail_decl_in_api_definition_in_impl.impl.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ impl () as A {} +// CHECK:STDERR: · ━━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of imported impl [RedeclImportedImpl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as A {} @@ -50,7 +62,11 @@ library "[[@TEST_NAME]]"; interface B {} -// CHECK:STDERR: fail_decl_only_in_api.carbon:[[@LINE+2]]:1-13: error: impl declared but not defined [ImplMissingDefinition] +// CHECK:STDERR: ╭─┤ fail_decl_only_in_api.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ impl () as B; +// CHECK:STDERR: · ━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: impl declared but not defined [ImplMissingDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as B; @@ -64,7 +80,11 @@ library "[[@TEST_NAME]]"; interface C {} -// CHECK:STDERR: fail_decl_in_api_decl_in_impl.carbon:[[@LINE+2]]:1-13: error: impl declared but not defined [ImplMissingDefinition] +// CHECK:STDERR: ╭─┤ fail_decl_in_api_decl_in_impl.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ impl () as C; +// CHECK:STDERR: · ━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: impl declared but not defined [ImplMissingDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as C; @@ -72,7 +92,11 @@ impl () as C; impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_decl_in_api_decl_in_impl.impl.carbon:[[@LINE+2]]:1-13: error: redeclaration of imported impl [RedeclImportedImpl] +// CHECK:STDERR: ╭─┤ fail_decl_in_api_decl_in_impl.impl.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ impl () as C; +// CHECK:STDERR: · ━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of imported impl [RedeclImportedImpl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as C; @@ -86,7 +110,11 @@ impl library "[[@TEST_NAME]]"; interface D {} -// CHECK:STDERR: fail_decl_only_in_impl.impl.carbon:[[@LINE+2]]:1-13: error: impl declared but not defined [ImplMissingDefinition] +// CHECK:STDERR: ╭─┤ fail_decl_only_in_impl.impl.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ impl () as D; +// CHECK:STDERR: · ━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: impl declared but not defined [ImplMissingDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as D; @@ -107,11 +135,11 @@ impl () as D; // CHECK:STDOUT: } // CHECK:STDOUT: %A.decl: type = interface_decl @A [concrete = constants.%A.type] {} {} // CHECK:STDOUT: impl_decl @empty_tuple.type.as.A.impl [concrete] {} { -// CHECK:STDOUT: %.loc8_7.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_7.2: type = converted %.loc8_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc12_7.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc12_7.2: type = converted %.loc12_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8: = impl_self_witness @empty_tuple.type.as.A.impl.%.loc8_7.2, @A [concrete = constants.%.b5f] +// CHECK:STDOUT: %.loc12: = impl_self_witness @empty_tuple.type.as.A.impl.%.loc12_7.2, @A [concrete = constants.%.b5f] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @A { @@ -125,7 +153,7 @@ impl () as D; // CHECK:STDOUT: !requires: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @empty_tuple.type.as.A.impl: %.loc8_7.2 as %A.ref; +// CHECK:STDOUT: impl @empty_tuple.type.as.A.impl: %.loc12_7.2 as %A.ref; // CHECK:STDOUT: // CHECK:STDOUT: specific @A.WithSelf(constants.%Self) {} // CHECK:STDOUT: @@ -143,8 +171,8 @@ impl () as D; // CHECK:STDOUT: imports { // CHECK:STDOUT: %Main.A: type = import_ref Main//decl_in_api_definition_in_impl, A, loaded [concrete = constants.%A.type] // CHECK:STDOUT: %Main.import_ref.0a1 = import_ref Main//decl_in_api_definition_in_impl, loc4_13, unloaded -// CHECK:STDOUT: %Main.import_ref.e5c: type = import_ref Main//decl_in_api_definition_in_impl, loc8_7, loaded [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %Main.import_ref.201: type = import_ref Main//decl_in_api_definition_in_impl, loc8_12, loaded [concrete = constants.%A.type] +// CHECK:STDOUT: %Main.import_ref.e5c: type = import_ref Main//decl_in_api_definition_in_impl, loc12_7, loaded [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %Main.import_ref.201: type = import_ref Main//decl_in_api_definition_in_impl, loc12_12, loaded [concrete = constants.%A.type] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -154,17 +182,17 @@ impl () as D; // CHECK:STDOUT: %default.import.loc2_46.1 = import // CHECK:STDOUT: %default.import.loc2_46.2 = import // CHECK:STDOUT: impl_decl @empty_tuple.type.as.A.impl.2e7a85.1 [concrete] {} { -// CHECK:STDOUT: %.loc6_7.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc6_7.2: type = converted %.loc6_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %A.ref: type = name_ref A, imports.%Main.A [concrete = constants.%A.type] -// CHECK:STDOUT: } -// CHECK:STDOUT: %.loc6: = impl_self_witness @empty_tuple.type.as.A.impl.2e7a85.1.%.loc6_7.2, @A [concrete = constants.%.b5f] -// CHECK:STDOUT: impl_decl @empty_tuple.type.as.A.impl.2e7a85.2 [concrete] {} { // CHECK:STDOUT: %.loc10_7.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] // CHECK:STDOUT: %.loc10_7.2: type = converted %.loc10_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: %A.ref: type = name_ref A, imports.%Main.A [concrete = constants.%A.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc10: = impl_self_witness @empty_tuple.type.as.A.impl.2e7a85.2.%.loc10_7.2, @A [concrete = constants.%.b5f] +// CHECK:STDOUT: %.loc10: = impl_self_witness @empty_tuple.type.as.A.impl.2e7a85.1.%.loc10_7.2, @A [concrete = constants.%.b5f] +// CHECK:STDOUT: impl_decl @empty_tuple.type.as.A.impl.2e7a85.2 [concrete] {} { +// CHECK:STDOUT: %.loc18_7.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc18_7.2: type = converted %.loc18_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %A.ref: type = name_ref A, imports.%Main.A [concrete = constants.%A.type] +// CHECK:STDOUT: } +// CHECK:STDOUT: %.loc18: = impl_self_witness @empty_tuple.type.as.A.impl.2e7a85.2.%.loc18_7.2, @A [concrete = constants.%.b5f] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @A [from "fail_decl_in_api_definition_in_impl.carbon"] { @@ -177,9 +205,9 @@ impl () as D; // CHECK:STDOUT: // CHECK:STDOUT: impl @empty_tuple.type.as.A.impl.f51: imports.%Main.import_ref.e5c as imports.%Main.import_ref.201 [from "fail_decl_in_api_definition_in_impl.carbon"]; // CHECK:STDOUT: -// CHECK:STDOUT: impl @empty_tuple.type.as.A.impl.2e7a85.1: %.loc6_7.2 as %A.ref; +// CHECK:STDOUT: impl @empty_tuple.type.as.A.impl.2e7a85.1: %.loc10_7.2 as %A.ref; // CHECK:STDOUT: -// CHECK:STDOUT: impl @empty_tuple.type.as.A.impl.2e7a85.2: %.loc10_7.2 as %A.ref { +// CHECK:STDOUT: impl @empty_tuple.type.as.A.impl.2e7a85.2: %.loc18_7.2 as %A.ref { // CHECK:STDOUT: !members: // CHECK:STDOUT: extend %A.ref // CHECK:STDOUT: witness = @@ -224,11 +252,11 @@ impl () as D; // CHECK:STDOUT: } // CHECK:STDOUT: %B.decl: type = interface_decl @B [concrete = constants.%B.type] {} {} // CHECK:STDOUT: impl_decl @empty_tuple.type.as.B.impl [concrete] {} { -// CHECK:STDOUT: %.loc8_7.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_7.2: type = converted %.loc8_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc12_7.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc12_7.2: type = converted %.loc12_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8: = impl_self_witness @empty_tuple.type.as.B.impl.%.loc8_7.2, @B [concrete = constants.%.9cc] +// CHECK:STDOUT: %.loc12: = impl_self_witness @empty_tuple.type.as.B.impl.%.loc12_7.2, @B [concrete = constants.%.9cc] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @B { @@ -242,7 +270,7 @@ impl () as D; // CHECK:STDOUT: !requires: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @empty_tuple.type.as.B.impl: %.loc8_7.2 as %B.ref; +// CHECK:STDOUT: impl @empty_tuple.type.as.B.impl: %.loc12_7.2 as %B.ref; // CHECK:STDOUT: // CHECK:STDOUT: specific @B.WithSelf(constants.%Self) {} // CHECK:STDOUT: @@ -258,8 +286,8 @@ impl () as D; // CHECK:STDOUT: imports { // CHECK:STDOUT: %Main.B = import_ref Main//decl_only_in_api, B, unloaded // CHECK:STDOUT: %Main.import_ref.c07 = import_ref Main//decl_only_in_api, loc4_13, unloaded -// CHECK:STDOUT: %Main.import_ref.e5c: type = import_ref Main//decl_only_in_api, loc8_7, loaded [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %Main.import_ref.21a: type = import_ref Main//decl_only_in_api, loc8_12, loaded [concrete = constants.%B.type] +// CHECK:STDOUT: %Main.import_ref.e5c: type = import_ref Main//decl_only_in_api, loc12_7, loaded [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %Main.import_ref.21a: type = import_ref Main//decl_only_in_api, loc12_12, loaded [concrete = constants.%B.type] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -299,11 +327,11 @@ impl () as D; // CHECK:STDOUT: } // CHECK:STDOUT: %C.decl: type = interface_decl @C [concrete = constants.%C.type] {} {} // CHECK:STDOUT: impl_decl @empty_tuple.type.as.C.impl [concrete] {} { -// CHECK:STDOUT: %.loc8_7.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_7.2: type = converted %.loc8_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc12_7.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc12_7.2: type = converted %.loc12_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8: = impl_self_witness @empty_tuple.type.as.C.impl.%.loc8_7.2, @C [concrete = constants.%.d74] +// CHECK:STDOUT: %.loc12: = impl_self_witness @empty_tuple.type.as.C.impl.%.loc12_7.2, @C [concrete = constants.%.d74] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @C { @@ -317,7 +345,7 @@ impl () as D; // CHECK:STDOUT: !requires: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @empty_tuple.type.as.C.impl: %.loc8_7.2 as %C.ref; +// CHECK:STDOUT: impl @empty_tuple.type.as.C.impl: %.loc12_7.2 as %C.ref; // CHECK:STDOUT: // CHECK:STDOUT: specific @C.WithSelf(constants.%Self) {} // CHECK:STDOUT: @@ -335,8 +363,8 @@ impl () as D; // CHECK:STDOUT: imports { // CHECK:STDOUT: %Main.C: type = import_ref Main//decl_in_api_decl_in_impl, C, loaded [concrete = constants.%C.type] // CHECK:STDOUT: %Main.import_ref.fb3 = import_ref Main//decl_in_api_decl_in_impl, loc4_13, unloaded -// CHECK:STDOUT: %Main.import_ref.e5c: type = import_ref Main//decl_in_api_decl_in_impl, loc8_7, loaded [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %Main.import_ref.3f1: type = import_ref Main//decl_in_api_decl_in_impl, loc8_12, loaded [concrete = constants.%C.type] +// CHECK:STDOUT: %Main.import_ref.e5c: type = import_ref Main//decl_in_api_decl_in_impl, loc12_7, loaded [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %Main.import_ref.3f1: type = import_ref Main//decl_in_api_decl_in_impl, loc12_12, loaded [concrete = constants.%C.type] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -346,11 +374,11 @@ impl () as D; // CHECK:STDOUT: %default.import.loc2_40.1 = import // CHECK:STDOUT: %default.import.loc2_40.2 = import // CHECK:STDOUT: impl_decl @empty_tuple.type.as.C.impl.006 [concrete] {} { -// CHECK:STDOUT: %.loc6_7.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc6_7.2: type = converted %.loc6_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc10_7.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc10_7.2: type = converted %.loc10_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [concrete = constants.%C.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc6: = impl_self_witness @empty_tuple.type.as.C.impl.006.%.loc6_7.2, @C [concrete = constants.%.d74] +// CHECK:STDOUT: %.loc10: = impl_self_witness @empty_tuple.type.as.C.impl.006.%.loc10_7.2, @C [concrete = constants.%.d74] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @C [from "fail_decl_in_api_decl_in_impl.carbon"] { @@ -363,7 +391,7 @@ impl () as D; // CHECK:STDOUT: // CHECK:STDOUT: impl @empty_tuple.type.as.C.impl.4b9: imports.%Main.import_ref.e5c as imports.%Main.import_ref.3f1 [from "fail_decl_in_api_decl_in_impl.carbon"]; // CHECK:STDOUT: -// CHECK:STDOUT: impl @empty_tuple.type.as.C.impl.006: %.loc6_7.2 as %C.ref; +// CHECK:STDOUT: impl @empty_tuple.type.as.C.impl.006: %.loc10_7.2 as %C.ref; // CHECK:STDOUT: // CHECK:STDOUT: specific @C.WithSelf(constants.%Self) {} // CHECK:STDOUT: @@ -392,11 +420,11 @@ impl () as D; // CHECK:STDOUT: %default.import.loc2_33.2 = import // CHECK:STDOUT: %D.decl: type = interface_decl @D [concrete = constants.%D.type] {} {} // CHECK:STDOUT: impl_decl @empty_tuple.type.as.D.impl [concrete] {} { -// CHECK:STDOUT: %.loc8_7.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_7.2: type = converted %.loc8_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc12_7.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc12_7.2: type = converted %.loc12_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [concrete = constants.%D.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8: = impl_self_witness @empty_tuple.type.as.D.impl.%.loc8_7.2, @D [concrete = constants.%.d28] +// CHECK:STDOUT: %.loc12: = impl_self_witness @empty_tuple.type.as.D.impl.%.loc12_7.2, @D [concrete = constants.%.d28] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @D { @@ -410,7 +438,7 @@ impl () as D; // CHECK:STDOUT: !requires: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @empty_tuple.type.as.D.impl: %.loc8_7.2 as %D.ref; +// CHECK:STDOUT: impl @empty_tuple.type.as.D.impl: %.loc12_7.2 as %D.ref; // CHECK:STDOUT: // CHECK:STDOUT: specific @D.WithSelf(constants.%Self) {} // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/orphan.carbon b/toolchain/check/testdata/impl/orphan.carbon index fc4351c40130..f57d999b2a5c 100644 --- a/toolchain/check/testdata/impl/orphan.carbon +++ b/toolchain/check/testdata/impl/orphan.carbon @@ -58,7 +58,13 @@ library "[[@TEST_NAME]]"; import library "imports"; -// CHECK:STDERR: fail_imported_class.carbon:[[@LINE+2]]:1-29: error: orphan `impl` found; something in the self-type or constraint must be defined in the same file [ImplIsOrphan] +// CHECK:STDERR: ╭─┤ fail_imported_class.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ impl ImportedC as ImportedY {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: orphan `impl` found; something in the self-type or constraint must +// CHECK:STDERR: · ┃ be defined in the same file +// CHECK:STDERR: · ┃ [ImplIsOrphan] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl ImportedC as ImportedY {} @@ -67,7 +73,13 @@ library "[[@TEST_NAME]]"; import library "imports"; -// CHECK:STDERR: fail_imported_class_for_self_specific.carbon:[[@LINE+2]]:1-40: error: orphan `impl` found; something in the self-type or constraint must be defined in the same file [ImplIsOrphan] +// CHECK:STDERR: ╭─┤ fail_imported_class_for_self_specific.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ impl ImportedD(ImportedC) as ImportedY {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: orphan `impl` found; something in the self-type or constraint must +// CHECK:STDERR: · ┃ be defined in the same file +// CHECK:STDERR: · ┃ [ImplIsOrphan] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl ImportedD(ImportedC) as ImportedY {} @@ -76,7 +88,13 @@ library "[[@TEST_NAME]]"; import library "imports"; -// CHECK:STDERR: fail_imported_class_for_interface_specific.carbon:[[@LINE+2]]:1-40: error: orphan `impl` found; something in the self-type or constraint must be defined in the same file [ImplIsOrphan] +// CHECK:STDERR: ╭─┤ fail_imported_class_for_interface_specific.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ impl ImportedC as ImportedZ(ImportedC) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: orphan `impl` found; something in the self-type or constraint must +// CHECK:STDERR: · ┃ be defined in the same file +// CHECK:STDERR: · ┃ [ImplIsOrphan] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl ImportedC as ImportedZ(ImportedC) {} @@ -145,7 +163,13 @@ library "[[@TEST_NAME]]"; import library "imports"; -// CHECK:STDERR: fail_generic_class_from_import.carbon:[[@LINE+2]]:1-47: error: orphan `impl` found; something in the self-type or constraint must be defined in the same file [ImplIsOrphan] +// CHECK:STDERR: ╭─┤ fail_generic_class_from_import.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ impl ImportedAnyParam(ImportedD) as ImportedY {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: orphan `impl` found; something in the self-type or constraint must +// CHECK:STDERR: · ┃ be defined in the same file +// CHECK:STDERR: · ┃ [ImplIsOrphan] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl ImportedAnyParam(ImportedD) as ImportedY {} @@ -163,7 +187,13 @@ library "[[@TEST_NAME]]"; import library "imports"; -// CHECK:STDERR: fail_generic_interface_from_import.carbon:[[@LINE+2]]:1-47: error: orphan `impl` found; something in the self-type or constraint must be defined in the same file [ImplIsOrphan] +// CHECK:STDERR: ╭─┤ fail_generic_interface_from_import.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ impl ImportedAnyParam(ImportedZ) as ImportedY {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: orphan `impl` found; something in the self-type or constraint must +// CHECK:STDERR: · ┃ be defined in the same file +// CHECK:STDERR: · ┃ [ImplIsOrphan] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl ImportedAnyParam(ImportedZ) as ImportedY {} @@ -181,7 +211,13 @@ library "[[@TEST_NAME]]"; import library "imports"; -// CHECK:STDERR: fail_generic_named_constraint_from_import.carbon:[[@LINE+2]]:1-47: error: orphan `impl` found; something in the self-type or constraint must be defined in the same file [ImplIsOrphan] +// CHECK:STDERR: ╭─┤ fail_generic_named_constraint_from_import.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ impl ImportedAnyParam(ImportedN) as ImportedY {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: orphan `impl` found; something in the self-type or constraint must +// CHECK:STDERR: · ┃ be defined in the same file +// CHECK:STDERR: · ┃ [ImplIsOrphan] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl ImportedAnyParam(ImportedN) as ImportedY {} @@ -242,7 +278,11 @@ interface Z {} // Neither {} nor Z are defined within or by the scope of `F`. fn F(unused generic T: type) { // TODO: The error should be about being an orphan, not an unused binding. - // CHECK:STDERR: fail_todo_orphan_in_generic_fn_scope.carbon:[[@LINE+2]]:3-16: error: `impl` with unused generic binding [ImplUnusedBinding] + // CHECK:STDERR: ╭─┤ fail_todo_orphan_in_generic_fn_scope.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ impl {} as Z {} + // CHECK:STDERR: · ━━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: `impl` with unused generic binding [ImplUnusedBinding] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl {} as Z {} } @@ -351,7 +391,17 @@ library "[[@TEST_NAME]]"; import library "use_extern_class"; -// CHECK:STDERR: fail_todo_extern_class.carbon:[[@LINE+1]]:1-15: error: redeclaration of `class C` is redundant [RedeclRedundant] +// CHECK:STDERR: ╭─┤ fail_todo_extern_class.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: -> │ extern class C; +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of `class C` is redundant [RedeclRedundant] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ fail_use_extern_class.carbon +// CHECK:STDERR: │ extern library "extern_class" class C; +// CHECK:STDERR: · ───────────────────┬────────────────── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: extern class C; // --- fail_use_extern_class.carbon @@ -360,9 +410,11 @@ library "[[@TEST_NAME]]"; import library "imports"; // A non-owning decl of C. -// CHECK:STDERR: fail_use_extern_class.carbon:[[@LINE+4]]:1-38: note: previously declared here [RedeclPrevDecl] -// CHECK:STDERR: -// CHECK:STDERR: fail_use_extern_class.carbon:[[@LINE+2]]:1-38: error: semantics TODO: `extern library` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_use_extern_class.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ extern library "extern_class" class C; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `extern library` [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: extern library "extern_class" class C; diff --git a/toolchain/check/testdata/impl/redeclaration.carbon b/toolchain/check/testdata/impl/redeclaration.carbon index 944cf7ea7344..0343d19fbc1c 100644 --- a/toolchain/check/testdata/impl/redeclaration.carbon +++ b/toolchain/check/testdata/impl/redeclaration.carbon @@ -49,11 +49,24 @@ class C { } // TODO: This should typecheck (see #5366). -// CHECK:STDERR: fail_todo_redeclaration_reenter_class.carbon:[[@LINE+6]]:9: error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╭─┤ fail_todo_redeclaration_reenter_class.carbon:[[@LINE+19]]:9 +// CHECK:STDERR: -> │ impl C.(as Z) {} +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_todo_redeclaration_reenter_class.carbon:[[@LINE+4]]:9-10: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_todo_redeclaration_reenter_class.carbon:[[@LINE+13]]:9 +// CHECK:STDERR: -> │ impl C.(as Z) {} +// CHECK:STDERR: · ━┳ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `handle invalid parse trees in `check`` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_todo_redeclaration_reenter_class.carbon:[[@LINE+2]]:14: error: expected `as` in `impl` declaration [ImplExpectedAs] +// CHECK:STDERR: ╭─┤ fail_todo_redeclaration_reenter_class.carbon:[[@LINE+6]]:14 +// CHECK:STDERR: -> │ impl C.(as Z) {} +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `as` in `impl` declaration [ImplExpectedAs] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl C.(as Z) {} @@ -69,11 +82,25 @@ class C { } // TODO: This should typecheck (see #5366). -// CHECK:STDERR: fail_todo_redeclaration_reenter_class_explicit_self.carbon:[[@LINE+6]]:9-12: error: name `Self` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_todo_redeclaration_reenter_class_explicit_self.carbon:[[@LINE+20]]:9 +// CHECK:STDERR: -> │ impl C.(Self as Z) {} +// CHECK:STDERR: · ━━┳━ +// CHECK:STDERR: · ┗━━┫ error: name `Self` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_todo_redeclaration_reenter_class_explicit_self.carbon:[[@LINE+4]]:19: error: expected `as` in `impl` declaration [ImplExpectedAs] +// CHECK:STDERR: ╭─┤ fail_todo_redeclaration_reenter_class_explicit_self.carbon:[[@LINE+14]]:19 +// CHECK:STDERR: -> │ impl C.(Self as Z) {} +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `as` in `impl` declaration +// CHECK:STDERR: · ┃ [ImplExpectedAs] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_todo_redeclaration_reenter_class_explicit_self.carbon:[[@LINE+2]]:1-21: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_todo_redeclaration_reenter_class_explicit_self.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ impl C.(Self as Z) {} +// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `handle invalid parse trees in `check`` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl C.(Self as Z) {} @@ -87,11 +114,25 @@ class C { } // TODO: This should typecheck (see #5366). -// CHECK:STDERR: fail_todo_redeclaration_reenter_class_mixed_self_outside.carbon:[[@LINE+6]]:9-12: error: name `Self` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_todo_redeclaration_reenter_class_mixed_self_outside.carbon:[[@LINE+20]]:9 +// CHECK:STDERR: -> │ impl C.(Self as Z) {} +// CHECK:STDERR: · ━━┳━ +// CHECK:STDERR: · ┗━━┫ error: name `Self` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_todo_redeclaration_reenter_class_mixed_self_outside.carbon:[[@LINE+4]]:19: error: expected `as` in `impl` declaration [ImplExpectedAs] +// CHECK:STDERR: ╭─┤ fail_todo_redeclaration_reenter_class_mixed_self_outside.carbon:[[@LINE+14]]:19 +// CHECK:STDERR: -> │ impl C.(Self as Z) {} +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `as` in `impl` declaration +// CHECK:STDERR: · ┃ [ImplExpectedAs] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_todo_redeclaration_reenter_class_mixed_self_outside.carbon:[[@LINE+2]]:1-21: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_todo_redeclaration_reenter_class_mixed_self_outside.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ impl C.(Self as Z) {} +// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `handle invalid parse trees in `check`` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl C.(Self as Z) {} @@ -105,11 +146,24 @@ class C { } // TODO: This should typecheck (see #5366). -// CHECK:STDERR: fail_todo_redeclaration_reenter_class_mixed_self_inside.carbon:[[@LINE+6]]:9: error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╭─┤ fail_todo_redeclaration_reenter_class_mixed_self_inside.carbon:[[@LINE+19]]:9 +// CHECK:STDERR: -> │ impl C.(as Z) {} +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_todo_redeclaration_reenter_class_mixed_self_inside.carbon:[[@LINE+4]]:9-10: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_todo_redeclaration_reenter_class_mixed_self_inside.carbon:[[@LINE+13]]:9 +// CHECK:STDERR: -> │ impl C.(as Z) {} +// CHECK:STDERR: · ━┳ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `handle invalid parse trees in `check`` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_todo_redeclaration_reenter_class_mixed_self_inside.carbon:[[@LINE+2]]:14: error: expected `as` in `impl` declaration [ImplExpectedAs] +// CHECK:STDERR: ╭─┤ fail_todo_redeclaration_reenter_class_mixed_self_inside.carbon:[[@LINE+6]]:14 +// CHECK:STDERR: -> │ impl C.(as Z) {} +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `as` in `impl` declaration [ImplExpectedAs] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl C.(as Z) {} @@ -122,12 +176,21 @@ class C; impl C as Z; class C { - // CHECK:STDERR: fail_redeclaration_inside_class_is_separate_impl.carbon:[[@LINE+1]]:3-15: error: found non-final `impl` with the same type structure as another non-final `impl` [ImplNonFinalSameTypeStructure] + // CHECK:STDERR: ╭─┤ fail_redeclaration_inside_class_is_separate_impl.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: -> │ impl C as Z {} + // CHECK:STDERR: · ┳━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: found non-final `impl` with the same type structure as another + // CHECK:STDERR: · ┃ non-final `impl` + // CHECK:STDERR: · ┃ [ImplNonFinalSameTypeStructure] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ impl C as Z {} + // CHECK:STDERR: · ──────┬────── + // CHECK:STDERR: · ╰──┤ other `impl` here [ImplNonFinalSameTypeStructureNote] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: impl C as Z {} } -// CHECK:STDERR: fail_redeclaration_inside_class_is_separate_impl.carbon:[[@LINE+2]]:1-13: note: other `impl` here [ImplNonFinalSameTypeStructureNote] -// CHECK:STDERR: impl C as Z {} // --- fail_redeclaration_outside_class_is_separate_impl.carbon @@ -139,8 +202,17 @@ class C { impl C as Z {} } -// CHECK:STDERR: fail_redeclaration_outside_class_is_separate_impl.carbon:[[@LINE+3]]:1-13: error: found non-final `impl` with the same type structure as another non-final `impl` [ImplNonFinalSameTypeStructure] -// CHECK:STDERR: fail_redeclaration_outside_class_is_separate_impl.carbon:[[@LINE-4]]:3-15: note: other `impl` here [ImplNonFinalSameTypeStructureNote] +// CHECK:STDERR: ╭─┤ fail_redeclaration_outside_class_is_separate_impl.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: │ impl C as Z {} +// CHECK:STDERR: · ──────┬────── +// CHECK:STDERR: · ╰──┤ other `impl` here [ImplNonFinalSameTypeStructureNote] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ impl C as Z {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: found non-final `impl` with the same type structure as another +// CHECK:STDERR: · ┃ non-final `impl` +// CHECK:STDERR: · ┃ [ImplNonFinalSameTypeStructure] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl C as Z {} @@ -156,8 +228,17 @@ fn F() { return C; } // This is not a redeclaration, since it's in a different scope. - // CHECK:STDERR: fail_redeclaration_in_block_scope_is_separate_impl.carbon:[[@LINE+3]]:3-17: error: found non-final `impl` with the same type structure as another non-final `impl` [ImplNonFinalSameTypeStructure] - // CHECK:STDERR: fail_redeclaration_in_block_scope_is_separate_impl.carbon:[[@LINE-5]]:5-17: note: other `impl` here [ImplNonFinalSameTypeStructureNote] + // CHECK:STDERR: ╭─┤ fail_redeclaration_in_block_scope_is_separate_impl.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ impl C as Z {} + // CHECK:STDERR: · ──────┬────── + // CHECK:STDERR: · ╰──┤ other `impl` here [ImplNonFinalSameTypeStructureNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ impl G() as Z {} + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: found non-final `impl` with the same type structure as another + // CHECK:STDERR: · ┃ non-final `impl` + // CHECK:STDERR: · ┃ [ImplNonFinalSameTypeStructure] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl G() as Z {} } @@ -172,7 +253,11 @@ impl C as Z {} // --- fail_redecl_of_imported_impl.impl.carbon impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_redecl_of_imported_impl.impl.carbon:[[@LINE+2]]:1-13: error: redeclaration of imported impl [RedeclImportedImpl] +// CHECK:STDERR: ╭─┤ fail_redecl_of_imported_impl.impl.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ impl C as Z {} +// CHECK:STDERR: · ━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of imported impl [RedeclImportedImpl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl C as Z {} @@ -191,8 +276,18 @@ class D { // But that means it overlaps fully with the impl from the api file, which is // a separate error. - // CHECK:STDERR: fail_decl_of_imported_impl_in_new_scope.impl.carbon:[[@LINE+3]]:3-15: error: found non-final `impl` with the same type structure as another non-final `impl` [ImplNonFinalSameTypeStructure] - // CHECK:STDERR: decl_of_imported_impl_in_new_scope.carbon:5:1-13: note: other `impl` here [ImplNonFinalSameTypeStructureNote] + // CHECK:STDERR: ╭─┤ fail_decl_of_imported_impl_in_new_scope.impl.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: -> │ impl C as Z {} + // CHECK:STDERR: · ┳━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: found non-final `impl` with the same type structure as another + // CHECK:STDERR: · ┃ non-final `impl` + // CHECK:STDERR: · ┃ [ImplNonFinalSameTypeStructure] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ decl_of_imported_impl_in_new_scope.carbon + // CHECK:STDERR: │ impl C as Z {} + // CHECK:STDERR: · ──────┬────── + // CHECK:STDERR: · ╰──┤ other `impl` here [ImplNonFinalSameTypeStructureNote] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl C as Z {} } @@ -205,9 +300,19 @@ interface Z {} fn F() { class C {} impl C as Z; - // CHECK:STDERR: fail_redecl_in_fn_scope.carbon:[[@LINE+4]]:3-15: error: impl redeclaration not in a declarative scope; redeclaration is allowed only in a class or namespace [ImplDeclInInvalidScope] + // CHECK:STDERR: ╭─┤ fail_redecl_in_fn_scope.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: -> │ impl C as Z {} + // CHECK:STDERR: · ┳━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: impl redeclaration not in a declarative scope; redeclaration is + // CHECK:STDERR: · ┃ allowed only in a class or namespace + // CHECK:STDERR: · ┃ [ImplDeclInInvalidScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_redecl_in_fn_scope.carbon:[[@LINE-3]]:3-14: error: impl declared but not defined [ImplMissingDefinition] + // CHECK:STDERR: ╭─┤ fail_redecl_in_fn_scope.carbon:[[@LINE-9]]:3 + // CHECK:STDERR: -> │ impl C as Z; + // CHECK:STDERR: · ━━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: impl declared but not defined [ImplMissingDefinition] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl C as Z {} } @@ -223,9 +328,19 @@ fn F() { } fn G() { - // CHECK:STDERR: fail_redecl_in_different_fn_scope.carbon:[[@LINE+4]]:3-15: error: impl redeclaration not in a declarative scope; redeclaration is allowed only in a class or namespace [ImplDeclInInvalidScope] + // CHECK:STDERR: ╭─┤ fail_redecl_in_different_fn_scope.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: -> │ impl C as Z {} + // CHECK:STDERR: · ┳━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: impl redeclaration not in a declarative scope; redeclaration is + // CHECK:STDERR: · ┃ allowed only in a class or namespace + // CHECK:STDERR: · ┃ [ImplDeclInInvalidScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_redecl_in_different_fn_scope.carbon:[[@LINE-6]]:3-14: error: impl declared but not defined [ImplMissingDefinition] + // CHECK:STDERR: ╭─┤ fail_redecl_in_different_fn_scope.carbon:[[@LINE-12]]:3 + // CHECK:STDERR: -> │ impl C as Z; + // CHECK:STDERR: · ━━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: impl declared but not defined [ImplMissingDefinition] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl C as Z {} } @@ -239,9 +354,19 @@ fn F() { if (true) { class C {} impl C as Z; - // CHECK:STDERR: fail_redecl_in_block_scope.carbon:[[@LINE+4]]:5-17: error: impl redeclaration not in a declarative scope; redeclaration is allowed only in a class or namespace [ImplDeclInInvalidScope] + // CHECK:STDERR: ╭─┤ fail_redecl_in_block_scope.carbon:[[@LINE+14]]:5 + // CHECK:STDERR: -> │ impl C as Z {} + // CHECK:STDERR: · ┳━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: impl redeclaration not in a declarative scope; redeclaration is + // CHECK:STDERR: · ┃ allowed only in a class or namespace + // CHECK:STDERR: · ┃ [ImplDeclInInvalidScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_redecl_in_block_scope.carbon:[[@LINE-3]]:5-16: error: impl declared but not defined [ImplMissingDefinition] + // CHECK:STDERR: ╭─┤ fail_redecl_in_block_scope.carbon:[[@LINE-9]]:5 + // CHECK:STDERR: -> │ impl C as Z; + // CHECK:STDERR: · ━━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: impl declared but not defined [ImplMissingDefinition] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl C as Z {} } @@ -258,9 +383,19 @@ fn F() { impl C as Z; } if (true) { - // CHECK:STDERR: fail_redecl_in_different_block_scope.carbon:[[@LINE+4]]:5-17: error: impl redeclaration not in a declarative scope; redeclaration is allowed only in a class or namespace [ImplDeclInInvalidScope] + // CHECK:STDERR: ╭─┤ fail_redecl_in_different_block_scope.carbon:[[@LINE+14]]:5 + // CHECK:STDERR: -> │ impl C as Z {} + // CHECK:STDERR: · ┳━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: impl redeclaration not in a declarative scope; redeclaration is + // CHECK:STDERR: · ┃ allowed only in a class or namespace + // CHECK:STDERR: · ┃ [ImplDeclInInvalidScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_redecl_in_different_block_scope.carbon:[[@LINE-5]]:5-16: error: impl declared but not defined [ImplMissingDefinition] + // CHECK:STDERR: ╭─┤ fail_redecl_in_different_block_scope.carbon:[[@LINE-11]]:5 + // CHECK:STDERR: -> │ impl C as Z; + // CHECK:STDERR: · ━━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: impl declared but not defined [ImplMissingDefinition] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl C as Z {} } diff --git a/toolchain/check/testdata/impl/reenter_scopes.carbon b/toolchain/check/testdata/impl/reenter_scopes.carbon index f45cd2cbcacf..183578d791a5 100644 --- a/toolchain/check/testdata/impl/reenter_scopes.carbon +++ b/toolchain/check/testdata/impl/reenter_scopes.carbon @@ -21,11 +21,24 @@ class N.C { class D {} } -// CHECK:STDERR: fail_todo_reenter_class_scope.carbon:[[@LINE+6]]:11: error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╭─┤ fail_todo_reenter_class_scope.carbon:[[@LINE+19]]:11 +// CHECK:STDERR: -> │ impl N.C.(as Z) { +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_todo_reenter_class_scope.carbon:[[@LINE+4]]:11-12: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_todo_reenter_class_scope.carbon:[[@LINE+13]]:11 +// CHECK:STDERR: -> │ impl N.C.(as Z) { +// CHECK:STDERR: · ━┳ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `handle invalid parse trees in `check`` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_todo_reenter_class_scope.carbon:[[@LINE+2]]:16: error: expected `as` in `impl` declaration [ImplExpectedAs] +// CHECK:STDERR: ╭─┤ fail_todo_reenter_class_scope.carbon:[[@LINE+6]]:16 +// CHECK:STDERR: -> │ impl N.C.(as Z) { +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `as` in `impl` declaration [ImplExpectedAs] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl N.C.(as Z) { fn ZF() { @@ -45,13 +58,31 @@ class N.C { class D {} } -// CHECK:STDERR: fail_todo_reenter_class_scope_explicit_self.carbon:[[@LINE+8]]:11-14: error: name `Self` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_todo_reenter_class_scope_explicit_self.carbon:[[@LINE+26]]:11 +// CHECK:STDERR: -> │ impl N.C.(Self as Z) { +// CHECK:STDERR: · ━━┳━ +// CHECK:STDERR: · ┗━━┫ error: name `Self` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_todo_reenter_class_scope_explicit_self.carbon:[[@LINE+6]]:19: error: name `Z` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_todo_reenter_class_scope_explicit_self.carbon:[[@LINE+20]]:19 +// CHECK:STDERR: -> │ impl N.C.(Self as Z) { +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: name `Z` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_todo_reenter_class_scope_explicit_self.carbon:[[@LINE+4]]:21: error: expected `as` in `impl` declaration [ImplExpectedAs] +// CHECK:STDERR: ╭─┤ fail_todo_reenter_class_scope_explicit_self.carbon:[[@LINE+14]]:21 +// CHECK:STDERR: -> │ impl N.C.(Self as Z) { +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `as` in `impl` declaration +// CHECK:STDERR: · ┃ [ImplExpectedAs] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_todo_reenter_class_scope_explicit_self.carbon:[[@LINE+2]]:1-22: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_todo_reenter_class_scope_explicit_self.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ impl N.C.(Self as Z) { +// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `handle invalid parse trees in `check`` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl N.C.(Self as Z) { fn ZF() { @@ -71,13 +102,31 @@ class N.C { class D {} } -// CHECK:STDERR: fail_todo_reenter_class_scope_unrelated_self.carbon:[[@LINE+8]]:11: error: name `D` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_todo_reenter_class_scope_unrelated_self.carbon:[[@LINE+26]]:11 +// CHECK:STDERR: -> │ impl N.C.(D as Z) { +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: name `D` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_todo_reenter_class_scope_unrelated_self.carbon:[[@LINE+6]]:16: error: name `Z` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_todo_reenter_class_scope_unrelated_self.carbon:[[@LINE+20]]:16 +// CHECK:STDERR: -> │ impl N.C.(D as Z) { +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: name `Z` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_todo_reenter_class_scope_unrelated_self.carbon:[[@LINE+4]]:18: error: expected `as` in `impl` declaration [ImplExpectedAs] +// CHECK:STDERR: ╭─┤ fail_todo_reenter_class_scope_unrelated_self.carbon:[[@LINE+14]]:18 +// CHECK:STDERR: -> │ impl N.C.(D as Z) { +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `as` in `impl` declaration +// CHECK:STDERR: · ┃ [ImplExpectedAs] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_todo_reenter_class_scope_unrelated_self.carbon:[[@LINE+2]]:1-19: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_todo_reenter_class_scope_unrelated_self.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ impl N.C.(D as Z) { +// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `handle invalid parse trees in `check`` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl N.C.(D as Z) { fn ZF() { @@ -95,13 +144,30 @@ class N.C {} class N.D {} // The path outside the parens must point to a class. -// CHECK:STDERR: fail_todo_reenter_namespace_scope.carbon:[[@LINE+8]]:9: error: name `C` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_todo_reenter_namespace_scope.carbon:[[@LINE+25]]:9 +// CHECK:STDERR: -> │ impl N.(C as Z) { +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: name `C` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_todo_reenter_namespace_scope.carbon:[[@LINE+6]]:14: error: name `Z` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_todo_reenter_namespace_scope.carbon:[[@LINE+19]]:14 +// CHECK:STDERR: -> │ impl N.(C as Z) { +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: name `Z` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_todo_reenter_namespace_scope.carbon:[[@LINE+4]]:16: error: expected `as` in `impl` declaration [ImplExpectedAs] +// CHECK:STDERR: ╭─┤ fail_todo_reenter_namespace_scope.carbon:[[@LINE+13]]:16 +// CHECK:STDERR: -> │ impl N.(C as Z) { +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `as` in `impl` declaration [ImplExpectedAs] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_todo_reenter_namespace_scope.carbon:[[@LINE+2]]:1-17: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_todo_reenter_namespace_scope.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ impl N.(C as Z) { +// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `handle invalid parse trees in `check`` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl N.(C as Z) { fn ZF() { diff --git a/toolchain/check/testdata/impl/require_satisified_in_interface.carbon b/toolchain/check/testdata/impl/require_satisified_in_interface.carbon index 070bb6aefbd2..724318b34c20 100644 --- a/toolchain/check/testdata/impl/require_satisified_in_interface.carbon +++ b/toolchain/check/testdata/impl/require_satisified_in_interface.carbon @@ -23,7 +23,12 @@ interface Y { impl () as Y; // () needs to impl Z at the start of the definition. -// CHECK:STDERR: fail_missing_extend_require_for_concrete_type.carbon:[[@LINE+2]]:1-14: error: interface `Y` being implemented requires that `()` implements `Z` [InterfaceRequireImplsNotImplemented] +// CHECK:STDERR: ╭─┤ fail_missing_extend_require_for_concrete_type.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ impl () as Y {} +// CHECK:STDERR: · ━━━┳━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: interface `Y` being implemented requires that `()` implements `Z` +// CHECK:STDERR: · ┃ [InterfaceRequireImplsNotImplemented] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as Y {} @@ -40,7 +45,12 @@ interface Y { impl () as Y; // () needs to impl Z at the start of the definition. -// CHECK:STDERR: fail_missing_require_for_concrete_type.carbon:[[@LINE+2]]:1-14: error: interface `Y` being implemented requires that `()` implements `Z` [InterfaceRequireImplsNotImplemented] +// CHECK:STDERR: ╭─┤ fail_missing_require_for_concrete_type.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ impl () as Y {} +// CHECK:STDERR: · ━━━┳━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: interface `Y` being implemented requires that `()` implements `Z` +// CHECK:STDERR: · ┃ [InterfaceRequireImplsNotImplemented] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as Y {} @@ -57,7 +67,12 @@ interface Y { impl forall [T: type] T as Y; // T needs to impl Z at the start of the definition. -// CHECK:STDERR: fail_missing_extend_require_for_symbolic_type.carbon:[[@LINE+2]]:1-30: error: interface `Y` being implemented requires that `T` implements `Z` [InterfaceRequireImplsNotImplemented] +// CHECK:STDERR: ╭─┤ fail_missing_extend_require_for_symbolic_type.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ impl forall [T: type] T as Y {} +// CHECK:STDERR: · ━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: interface `Y` being implemented requires that `T` implements `Z` +// CHECK:STDERR: · ┃ [InterfaceRequireImplsNotImplemented] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [T: type] T as Y {} @@ -74,7 +89,12 @@ interface Y { impl forall [T: type] T as Y; // T needs to impl Z at the start of the definition. -// CHECK:STDERR: fail_missing_require_for_symbolic_type.carbon:[[@LINE+2]]:1-30: error: interface `Y` being implemented requires that `T` implements `Z` [InterfaceRequireImplsNotImplemented] +// CHECK:STDERR: ╭─┤ fail_missing_require_for_symbolic_type.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ impl forall [T: type] T as Y {} +// CHECK:STDERR: · ━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: interface `Y` being implemented requires that `T` implements `Z` +// CHECK:STDERR: · ┃ [InterfaceRequireImplsNotImplemented] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [T: type] T as Y {} @@ -91,7 +111,13 @@ interface Y(U: type) { extend require impls Z1(U) & Z2(B); } -// CHECK:STDERR: fail_missing_extend_require_double.carbon:[[@LINE+2]]:1-17: error: interface `Y(A)` being implemented requires that `()` implements `Z1(A) & Z2(B)` [InterfaceRequireImplsNotImplemented] +// CHECK:STDERR: ╭─┤ fail_missing_extend_require_double.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ impl () as Y(A) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: interface `Y(A)` being implemented requires that `()` implements +// CHECK:STDERR: · ┃ `Z1(A) & Z2(B)` +// CHECK:STDERR: · ┃ [InterfaceRequireImplsNotImplemented] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as Y(A) {} @@ -108,7 +134,13 @@ interface Y(U: type) { require impls Z1(U) & Z2(B); } -// CHECK:STDERR: fail_missing_require_double.carbon:[[@LINE+2]]:1-17: error: interface `Y(A)` being implemented requires that `()` implements `Z1(A) & Z2(B)` [InterfaceRequireImplsNotImplemented] +// CHECK:STDERR: ╭─┤ fail_missing_require_double.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ impl () as Y(A) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: interface `Y(A)` being implemented requires that `()` implements +// CHECK:STDERR: · ┃ `Z1(A) & Z2(B)` +// CHECK:STDERR: · ┃ [InterfaceRequireImplsNotImplemented] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as Y(A) {} @@ -215,7 +247,13 @@ interface Y(U: type) { } // Y requires that C impls Z(Self), but it does not do so. -// CHECK:STDERR: fail_require_non_self_missing.carbon:[[@LINE+2]]:1-18: error: interface `Y(())` being implemented requires that `C` implements `Z(())` [InterfaceRequireImplsNotImplemented] +// CHECK:STDERR: ╭─┤ fail_require_non_self_missing.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ impl () as Y(()) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: interface `Y(())` being implemented requires that `C` implements +// CHECK:STDERR: · ┃ `Z(())` +// CHECK:STDERR: · ┃ [InterfaceRequireImplsNotImplemented] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as Y(()) {} @@ -304,8 +342,16 @@ impl forall [N: Core.IntLiteral, T: C(N)] T as B(N) { } fn F(generic T: C(-1)) { - // CHECK:STDERR: fail_impl_requires_itself_cycle_with_monomorphization_error.carbon:[[@LINE+3]]:3-16: error: unable to monomorphize specific `AA()` [ResolvingSpecificHere] - // CHECK:STDERR: fail_impl_requires_itself_cycle_with_monomorphization_error.carbon:[[@LINE-25]]:26: note: array bound of -1 is negative [ArrayBoundNegative] + // CHECK:STDERR: ╭─┤ fail_impl_requires_itself_cycle_with_monomorphization_error.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ fn AA() -> W(Array((), N)); + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ array bound of -1 is negative [ArrayBoundNegative] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ T.(A(-1).AA)(); + // CHECK:STDERR: · ━━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: unable to monomorphize specific `AA()` + // CHECK:STDERR: · ┃ [ResolvingSpecificHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: T.(A(-1).AA)(); } diff --git a/toolchain/check/testdata/impl/require_satisified_in_named_constraint.carbon b/toolchain/check/testdata/impl/require_satisified_in_named_constraint.carbon index 16b8fd5f6d98..00cf5126274a 100644 --- a/toolchain/check/testdata/impl/require_satisified_in_named_constraint.carbon +++ b/toolchain/check/testdata/impl/require_satisified_in_named_constraint.carbon @@ -25,7 +25,12 @@ constraint N { impl () as N; // () needs to impl Z at the start of the definition. -// CHECK:STDERR: fail_missing_require_for_concrete_type.carbon:[[@LINE+2]]:1-14: error: constraint `N` being implemented requires that `()` implements `Z` [IdentifiedRequireImplsNotImplemented] +// CHECK:STDERR: ╭─┤ fail_missing_require_for_concrete_type.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ impl () as N {} +// CHECK:STDERR: · ━━┳━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: constraint `N` being implemented requires that `()` implements `Z` +// CHECK:STDERR: · ┃ [IdentifiedRequireImplsNotImplemented] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as N {} @@ -44,7 +49,12 @@ constraint N { impl forall [T: type] T as N; // T needs to impl Z at the start of the definition. -// CHECK:STDERR: fail_missing_require_for_symbolic_type.carbon:[[@LINE+2]]:1-30: error: constraint `N` being implemented requires that `T` implements `Z` [IdentifiedRequireImplsNotImplemented] +// CHECK:STDERR: ╭─┤ fail_missing_require_for_symbolic_type.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ impl forall [T: type] T as N {} +// CHECK:STDERR: · ━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: constraint `N` being implemented requires that `T` implements `Z` +// CHECK:STDERR: · ┃ [IdentifiedRequireImplsNotImplemented] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [T: type] T as N {} @@ -167,9 +177,19 @@ impl () as N; // Wrong type for the requirement. impl () as Z where .Z1 = {}; -// CHECK:STDERR: fail_require_non_extended_rewrite_wrong_type.carbon:[[@LINE+4]]:1-14: error: constraint `N` being implemented requires that `().(Z.Z1)` equals `()`; found `{}` and `()` [IdentifiedRequireImplsNotEquivalent] +// CHECK:STDERR: ╭─┤ fail_require_non_extended_rewrite_wrong_type.carbon:[[@LINE+14]]:1 +// CHECK:STDERR: -> │ impl () as N {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: constraint `N` being implemented requires that `().(Z.Z1)` equals +// CHECK:STDERR: · ┃ `()`; found `{}` and `()` +// CHECK:STDERR: · ┃ [IdentifiedRequireImplsNotEquivalent] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_require_non_extended_rewrite_wrong_type.carbon:[[@LINE-4]]:1-28: error: impl declared but not defined [ImplMissingDefinition] +// CHECK:STDERR: ╭─┤ fail_require_non_extended_rewrite_wrong_type.carbon:[[@LINE-10]]:1 +// CHECK:STDERR: -> │ impl () as Z where .Z1 = {}; +// CHECK:STDERR: · ━━━━━━━━━━━━━━┳━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: impl declared but not defined [ImplMissingDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as N {} @@ -202,6 +222,12 @@ constraint N { } // Wrong type for `.Z1`. -// CHECK:STDERR: fail_require_non_extended_rewrite_same_interface_wrong_type.carbon:[[@LINE+2]]:1-29: error: constraint `N where .(Z.Z1) = {}` being implemented requires that `().(Z.Z1)` equals `()`; found `{}` and `()` [IdentifiedRequireImplsNotEquivalent] +// CHECK:STDERR: ╭─┤ fail_require_non_extended_rewrite_same_interface_wrong_type.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ impl () as N where .Z1 = {} {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: constraint `N where .(Z.Z1) = {}` being implemented requires that +// CHECK:STDERR: · ┃ `().(Z.Z1)` equals `()`; found `{}` and `()` +// CHECK:STDERR: · ┃ [IdentifiedRequireImplsNotEquivalent] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as N where .Z1 = {} {} diff --git a/toolchain/check/testdata/impl/rewrites.carbon b/toolchain/check/testdata/impl/rewrites.carbon index 913bc9aa3d5b..582ee5998180 100644 --- a/toolchain/check/testdata/impl/rewrites.carbon +++ b/toolchain/check/testdata/impl/rewrites.carbon @@ -28,7 +28,13 @@ interface I { let X: type; } interface J {} // .X does not impl J. -// CHECK:STDERR: fail_rewrite_in_facet_type_before_missing_impl.carbon:[[@LINE+2]]:1-59: error: constraint `I where () impls J and .(I.X) = ()` being implemented requires that `()` implements `J` [IdentifiedRequireImplsNotImplemented] +// CHECK:STDERR: ╭─┤ fail_rewrite_in_facet_type_before_missing_impl.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ impl forall [T: type] T as I where .X = () and .X impls J {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: constraint `I where () impls J and .(I.X) = ()` being implemented +// CHECK:STDERR: · ┃ requires that `()` implements `J` +// CHECK:STDERR: · ┃ [IdentifiedRequireImplsNotImplemented] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [T: type] T as I where .X = () and .X impls J {} @@ -51,7 +57,13 @@ interface I { let X: type; } interface J {} // .X does not impl J. -// CHECK:STDERR: fail_rewrite_in_facet_type_after_missing_impl.carbon:[[@LINE+2]]:1-59: error: constraint `I where .(I.X) impls J and .(I.X) = ()` being implemented requires that `()` implements `J` [IdentifiedRequireImplsNotImplemented] +// CHECK:STDERR: ╭─┤ fail_rewrite_in_facet_type_after_missing_impl.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ impl forall [T: type] T as I where .X impls J and .X = () {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: constraint `I where .(I.X) impls J and .(I.X) = ()` being +// CHECK:STDERR: · ┃ implemented requires that `()` implements `J` +// CHECK:STDERR: · ┃ [IdentifiedRequireImplsNotImplemented] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [T: type] T as I where .X impls J and .X = () {} @@ -81,7 +93,13 @@ constraint GivesI { } // .X does not impl J. -// CHECK:STDERR: fail_rewrite_in_named_constraint_missing_impl.carbon:[[@LINE+2]]:1-52: error: constraint `GivesI where .(I.X) impls J` being implemented requires that `()` implements `J` [IdentifiedRequireImplsNotImplemented] +// CHECK:STDERR: ╭─┤ fail_rewrite_in_named_constraint_missing_impl.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ impl forall [T: type] T as GivesI where .X impls J {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: constraint `GivesI where .(I.X) impls J` being implemented requires +// CHECK:STDERR: · ┃ that `()` implements `J` +// CHECK:STDERR: · ┃ [IdentifiedRequireImplsNotImplemented] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [T: type] T as GivesI where .X impls J {} @@ -113,7 +131,13 @@ constraint GivesI { } // .X does not impl J. -// CHECK:STDERR: fail_rewrite_and_impls_in_named_constraint_missing_impl.carbon:[[@LINE+2]]:1-35: error: constraint `GivesI` being implemented requires that `()` implements `J` [IdentifiedRequireImplsNotImplemented] +// CHECK:STDERR: ╭─┤ fail_rewrite_and_impls_in_named_constraint_missing_impl.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ impl forall [T: type] T as GivesI {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: constraint `GivesI` being implemented requires that `()` implements +// CHECK:STDERR: · ┃ `J` +// CHECK:STDERR: · ┃ [IdentifiedRequireImplsNotImplemented] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [T: type] T as GivesI {} diff --git a/toolchain/check/testdata/impl/use_assoc_entity.carbon b/toolchain/check/testdata/impl/use_assoc_entity.carbon index a12e4f1f617e..d987f9fc60e7 100644 --- a/toolchain/check/testdata/impl/use_assoc_entity.carbon +++ b/toolchain/check/testdata/impl/use_assoc_entity.carbon @@ -268,19 +268,48 @@ class A {} // TODO: Make sure this behaves reasonably once we support `where` declarations. -// CHECK:STDERR: fail_todo_associated_constant_use_before_value_known.carbon:[[@LINE+6]]:1-13: error: associated constant T not given a value in impl of interface J [ImplAssociatedConstantNeedsValue] -// CHECK:STDERR: fail_todo_associated_constant_use_before_value_known.carbon:[[@LINE-9]]:7-13: note: associated constant declared here [AssociatedConstantHere] +// CHECK:STDERR: ╭─┤ fail_todo_associated_constant_use_before_value_known.carbon:[[@LINE+22]]:1 +// CHECK:STDERR: │ let T: type; +// CHECK:STDERR: · ───┬─── +// CHECK:STDERR: · ╰──┤ associated constant declared here [AssociatedConstantHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ impl A as J { +// CHECK:STDERR: · ━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: associated constant T not given a value in impl of interface J +// CHECK:STDERR: · ┃ [ImplAssociatedConstantNeedsValue] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_todo_associated_constant_use_before_value_known.carbon:[[@LINE+3]]:1-13: error: associated constant U not given a value in impl of interface J [ImplAssociatedConstantNeedsValue] -// CHECK:STDERR: fail_todo_associated_constant_use_before_value_known.carbon:[[@LINE-11]]:7-13: note: associated constant declared here [AssociatedConstantHere] +// CHECK:STDERR: ╭─┤ fail_todo_associated_constant_use_before_value_known.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: │ let U: type; +// CHECK:STDERR: · ───┬─── +// CHECK:STDERR: · ╰──┤ associated constant declared here [AssociatedConstantHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ impl A as J { +// CHECK:STDERR: · ━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: associated constant U not given a value in impl of interface J +// CHECK:STDERR: · ┃ [ImplAssociatedConstantNeedsValue] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl A as J { - // CHECK:STDERR: fail_todo_associated_constant_use_before_value_known.carbon:[[@LINE+4]]:3-7: error: unrecognized declaration introducer [UnrecognizedDecl] + // CHECK:STDERR: ╭─┤ fail_todo_associated_constant_use_before_value_known.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: -> │ where .U = T; + // CHECK:STDERR: · ━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: unrecognized declaration introducer [UnrecognizedDecl] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_todo_associated_constant_use_before_value_known.carbon:[[@LINE+2]]:3-7: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_associated_constant_use_before_value_known.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ where .U = T; + // CHECK:STDERR: · ━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `handle invalid parse trees in `check`` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: where .U = T; - // CHECK:STDERR: fail_todo_associated_constant_use_before_value_known.carbon:[[@LINE+2]]:3-7: error: unrecognized declaration introducer [UnrecognizedDecl] + // CHECK:STDERR: ╭─┤ fail_todo_associated_constant_use_before_value_known.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ where .T = (); + // CHECK:STDERR: · ━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: unrecognized declaration introducer [UnrecognizedDecl] + // CHECK:STDERR: ╰──── // CHECK:STDERR: where .T = (); } @@ -318,7 +347,12 @@ impl A as J { // definition of `G()` until the enclosing `impl` is complete. // TODO: Diagnose this better. eval fn G() -> type { return A; } - // CHECK:STDERR: fail_associated_fn_use_in_decl_after_decl.carbon:[[@LINE+2]]:13-15: error: cannot evaluate type expression [TypeExprEvaluationFailure] + // CHECK:STDERR: ╭─┤ fail_associated_fn_use_in_decl_after_decl.carbon:[[@LINE+7]]:13 + // CHECK:STDERR: -> │ fn F() -> G(); + // CHECK:STDERR: · ━┳━ + // CHECK:STDERR: · ┗━━┫ error: cannot evaluate type expression + // CHECK:STDERR: · ┃ [TypeExprEvaluationFailure] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn F() -> G(); } @@ -334,7 +368,12 @@ interface J { class A {} impl A as J { - // CHECK:STDERR: fail_associated_fn_use_in_decl_before_decl.carbon:[[@LINE+2]]:13: error: accessing member from impl before it has a defined value [ImplAccessMemberBeforeSet] + // CHECK:STDERR: ╭─┤ fail_associated_fn_use_in_decl_before_decl.carbon:[[@LINE+7]]:13 + // CHECK:STDERR: -> │ fn F() -> G(); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: accessing member from impl before it has a defined value + // CHECK:STDERR: · ┃ [ImplAccessMemberBeforeSet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn F() -> G(); eval fn G() -> type { return A; } @@ -345,11 +384,30 @@ library "[[@TEST_NAME]]"; interface J2 { let U2: type; - // CHECK:STDERR: fail_todo_self_period_associated_type.carbon:[[@LINE+6]]:17-20: error: member access into facet of incomplete type `J2` [IncompleteTypeInMemberAccessOfFacet] - // CHECK:STDERR: fail_todo_self_period_associated_type.carbon:[[@LINE-3]]:1-14: note: interface is currently being defined [InterfaceIncompleteWithinDefinition] + // CHECK:STDERR: ╭─┤ fail_todo_self_period_associated_type.carbon:[[@LINE+25]]:17 + // CHECK:STDERR: │ interface J2 { + // CHECK:STDERR: · ───────┬────── + // CHECK:STDERR: · ╰──┤ interface is currently being defined + // CHECK:STDERR: · │ [InterfaceIncompleteWithinDefinition] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ fn F(self, z: Self.U2) -> Self.U2; + // CHECK:STDERR: · ━━┳━ + // CHECK:STDERR: · ┗━━┫ error: member access into facet of incomplete type `J2` + // CHECK:STDERR: · ┃ [IncompleteTypeInMemberAccessOfFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_todo_self_period_associated_type.carbon:[[@LINE+3]]:29-32: error: member access into facet of incomplete type `J2` [IncompleteTypeInMemberAccessOfFacet] - // CHECK:STDERR: fail_todo_self_period_associated_type.carbon:[[@LINE-6]]:1-14: note: interface is currently being defined [InterfaceIncompleteWithinDefinition] + // CHECK:STDERR: ╭─┤ fail_todo_self_period_associated_type.carbon:[[@LINE+13]]:29 + // CHECK:STDERR: │ interface J2 { + // CHECK:STDERR: · ───────┬────── + // CHECK:STDERR: · ╰──┤ interface is currently being defined + // CHECK:STDERR: · │ [InterfaceIncompleteWithinDefinition] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ fn F(self, z: Self.U2) -> Self.U2; + // CHECK:STDERR: · ┳━━━ + // CHECK:STDERR: · ┗━━┫ error: member access into facet of incomplete + // CHECK:STDERR: · ┃ type `J2` + // CHECK:STDERR: · ┃ [IncompleteTypeInMemberAccessOfFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(self, z: Self.U2) -> Self.U2; } @@ -376,12 +434,33 @@ interface K { } impl () as K where .V = {.a: ()} { - // CHECK:STDERR: fail_associated_type_in_signature_mismatch.carbon:[[@LINE+7]]:3-46: error: cannot convert from struct type `{.a: ()}` to `{.x: ()}`: unexpected field `a` in source type [StructInitUnexpectedFieldInConversion] - // CHECK:STDERR: fail_associated_type_in_signature_mismatch.carbon:[[@LINE+6]]:21-31: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: fail_associated_type_in_signature_mismatch.carbon:[[@LINE-6]]:3-24: note: while building thunk to match the signature of this function [ThunkSignature] + // CHECK:STDERR: ╭─┤ fail_associated_type_in_signature_mismatch.carbon:[[@LINE+28]]:3 + // CHECK:STDERR: │ fn F(self, v: V) -> V; + // CHECK:STDERR: · ───────────┬────────── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ fn F(unused self, v: {.x: ()}) -> {.x: ()} { return v; } + // CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert from struct type `{.a: ()}` to + // CHECK:STDERR: · │ ┃ `{.x: ()}`: unexpected field `a` in source type + // CHECK:STDERR: · │ ┃ [StructInitUnexpectedFieldInConversion] + // CHECK:STDERR: · ╰────┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_associated_type_in_signature_mismatch.carbon:[[@LINE+3]]:3-46: error: cannot convert from struct type `{.x: ()}` to `{.a: ()}`: unexpected field `x` in source type [StructInitUnexpectedFieldInConversion] - // CHECK:STDERR: fail_associated_type_in_signature_mismatch.carbon:[[@LINE-9]]:3-24: note: while building thunk to match the signature of this function [ThunkSignature] + // CHECK:STDERR: ╭─┤ fail_associated_type_in_signature_mismatch.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn F(self, v: V) -> V; + // CHECK:STDERR: · ───────────┬────────── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ fn F(unused self, v: {.x: ()}) -> {.x: ()} { return v; } + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert from struct type `{.x: ()}` to `{.a: ()}`: + // CHECK:STDERR: · ┃ unexpected field `x` in source type + // CHECK:STDERR: · ┃ [StructInitUnexpectedFieldInConversion] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused self, v: {.x: ()}) -> {.x: ()} { return v; } } diff --git a/toolchain/check/testdata/impl/using_invalid_interface.carbon b/toolchain/check/testdata/impl/using_invalid_interface.carbon index f8729b629369..e54968540633 100644 --- a/toolchain/check/testdata/impl/using_invalid_interface.carbon +++ b/toolchain/check/testdata/impl/using_invalid_interface.carbon @@ -19,8 +19,18 @@ class ArgToI(T: I) {} interface IMisuse { let Arg: type; - // CHECK:STDERR: fail_invalid_interface.carbon:[[@LINE+3]]:18-28: error: cannot convert type `Arg` into type implementing `I` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_invalid_interface.carbon:[[@LINE-5]]:14-17: note: initializing generic parameter `T` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_invalid_interface.carbon:[[@LINE+13]]:18 + // CHECK:STDERR: │ class ArgToI(T: I) {} + // CHECK:STDERR: · ──┬─ + // CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ fn Op(self) -> ArgToI(Arg); + // CHECK:STDERR: · ┳━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `Arg` into type implementing + // CHECK:STDERR: · ┃ `I` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn Op(self) -> ArgToI(Arg); } @@ -31,10 +41,18 @@ library "[[@TEST_NAME]]"; import library "invalid_interface"; class C { - // CHECK:STDERR: fail_misusing_invalid_interface.carbon:[[@LINE+2]]:32: error: name `T` not found [NameNotFound] + // CHECK:STDERR: ╭─┤ fail_misusing_invalid_interface.carbon:[[@LINE+6]]:32 + // CHECK:STDERR: -> │ impl as IMisuse where .Arg = T { + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: name `T` not found [NameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl as IMisuse where .Arg = T { - // CHECK:STDERR: fail_misusing_invalid_interface.carbon:[[@LINE+2]]:34: error: name `T` not found [NameNotFound] + // CHECK:STDERR: ╭─┤ fail_misusing_invalid_interface.carbon:[[@LINE+6]]:34 + // CHECK:STDERR: -> │ fn Op(unused self) -> ArgToI(T) { + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: name `T` not found [NameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn Op(unused self) -> ArgToI(T) { return {}; @@ -42,16 +60,37 @@ class C { } } -// CHECK:STDERR: fail_misusing_invalid_interface.carbon:[[@LINE+3]]:28-33: error: 0 arguments passed to function expecting 1 argument [CallArgCountMismatch] -// CHECK:STDERR: fail_invalid_interface.carbon:12:3-29: note: calling function declared here [InCallToEntity] +// CHECK:STDERR: ╭─┤ fail_misusing_invalid_interface.carbon:[[@LINE+13]]:28 +// CHECK:STDERR: -> │ fn F(generic T: IMisuse) { T.Op(); } +// CHECK:STDERR: · ┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: 0 arguments passed to function expecting +// CHECK:STDERR: · ┃ 1 argument +// CHECK:STDERR: · ┃ [CallArgCountMismatch] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ fail_invalid_interface.carbon +// CHECK:STDERR: │ fn Op(self) -> ArgToI(Arg); +// CHECK:STDERR: · ─────────────┬───────────── +// CHECK:STDERR: · ╰──┤ calling function declared here [InCallToEntity] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic T: IMisuse) { T.Op(); } fn G() { var c: C; - // CHECK:STDERR: fail_misusing_invalid_interface.carbon:[[@LINE+4]]:3-6: error: cannot implicitly convert non-type value of type `C` into type implementing `IMisuse` [ConversionFailureNonTypeToFacet] - // CHECK:STDERR: fail_misusing_invalid_interface.carbon:[[@LINE+3]]:3-6: note: type `C` does not implement interface `Core.ImplicitAs(IMisuse)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: fail_misusing_invalid_interface.carbon:[[@LINE-6]]:14-23: note: initializing generic parameter `T` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_misusing_invalid_interface.carbon:[[@LINE+15]]:3 + // CHECK:STDERR: │ fn F(generic T: IMisuse) { T.Op(); } + // CHECK:STDERR: · ─────┬──── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(c); + // CHECK:STDERR: · ┳━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert non-type value of type `C` into type + // CHECK:STDERR: · │ ┃ implementing `IMisuse` + // CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: · ╰────┤ type `C` does not implement interface `Core.ImplicitAs(IMisuse)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(c); } @@ -65,8 +104,19 @@ class ArgC {} class C { impl as IMisuse where .Arg = ArgC { - // CHECK:STDERR: fail_using_invalid_interface.carbon:[[@LINE+3]]:27-38: error: cannot convert type `ArgC` into type implementing `I` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_invalid_interface.carbon:5:14-17: note: initializing generic parameter `T` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_using_invalid_interface.carbon:[[@LINE+14]]:27 + // CHECK:STDERR: -> │ fn Op(unused self) -> ArgToI(ArgC) { + // CHECK:STDERR: · ┳━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `ArgC` into type + // CHECK:STDERR: · ┃ implementing `I` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ fail_invalid_interface.carbon + // CHECK:STDERR: │ class ArgToI(T: I) {} + // CHECK:STDERR: · ──┬─ + // CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn Op(unused self) -> ArgToI(ArgC) { return {}; @@ -74,16 +124,37 @@ class C { } } -// CHECK:STDERR: fail_using_invalid_interface.carbon:[[@LINE+3]]:28-33: error: 0 arguments passed to function expecting 1 argument [CallArgCountMismatch] -// CHECK:STDERR: fail_invalid_interface.carbon:12:3-29: note: calling function declared here [InCallToEntity] +// CHECK:STDERR: ╭─┤ fail_using_invalid_interface.carbon:[[@LINE+13]]:28 +// CHECK:STDERR: -> │ fn F(generic T: IMisuse) { T.Op(); } +// CHECK:STDERR: · ┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: 0 arguments passed to function expecting +// CHECK:STDERR: · ┃ 1 argument +// CHECK:STDERR: · ┃ [CallArgCountMismatch] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ fail_invalid_interface.carbon +// CHECK:STDERR: │ fn Op(self) -> ArgToI(Arg); +// CHECK:STDERR: · ─────────────┬───────────── +// CHECK:STDERR: · ╰──┤ calling function declared here [InCallToEntity] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic T: IMisuse) { T.Op(); } fn G() { var c: C; - // CHECK:STDERR: fail_using_invalid_interface.carbon:[[@LINE+4]]:3-6: error: cannot implicitly convert non-type value of type `C` into type implementing `IMisuse` [ConversionFailureNonTypeToFacet] - // CHECK:STDERR: fail_using_invalid_interface.carbon:[[@LINE+3]]:3-6: note: type `C` does not implement interface `Core.ImplicitAs(IMisuse)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: fail_using_invalid_interface.carbon:[[@LINE-6]]:14-23: note: initializing generic parameter `T` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_using_invalid_interface.carbon:[[@LINE+15]]:3 + // CHECK:STDERR: │ fn F(generic T: IMisuse) { T.Op(); } + // CHECK:STDERR: · ─────┬──── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(c); + // CHECK:STDERR: · ┳━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert non-type value of type `C` into type + // CHECK:STDERR: · │ ┃ implementing `IMisuse` + // CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: · ╰────┤ type `C` does not implement interface `Core.ImplicitAs(IMisuse)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(c); } diff --git a/toolchain/check/testdata/index/fail_array_large_index.carbon b/toolchain/check/testdata/index/fail_array_large_index.carbon index 8d614e20e84f..832ba265f0d3 100644 --- a/toolchain/check/testdata/index/fail_array_large_index.carbon +++ b/toolchain/check/testdata/index/fail_array_large_index.carbon @@ -14,11 +14,23 @@ var a: array(i32, 1) = (12,); -// CHECK:STDERR: fail_array_large_index.carbon:[[@LINE+2]]:16: error: array index `1` is past the end of type `array(i32, 1)` [ArrayIndexOutOfBounds] +// CHECK:STDERR: ╭─┤ fail_array_large_index.carbon:[[@LINE+8]]:16 +// CHECK:STDERR: -> │ var b: i32 = a[1]; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: array index `1` is past the end of type +// CHECK:STDERR: · ┃ `array(i32, 1)` +// CHECK:STDERR: · ┃ [ArrayIndexOutOfBounds] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var b: i32 = a[1]; -// CHECK:STDERR: fail_array_large_index.carbon:[[@LINE+2]]:16-26: error: array index `2147483647` is past the end of type `array(i32, 1)` [ArrayIndexOutOfBounds] +// CHECK:STDERR: ╭─┤ fail_array_large_index.carbon:[[@LINE+8]]:16 +// CHECK:STDERR: -> │ var c: i32 = a[0x7FFF_FFFF]; +// CHECK:STDERR: · ┳━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: array index `2147483647` is past the end of type +// CHECK:STDERR: · ┃ `array(i32, 1)` +// CHECK:STDERR: · ┃ [ArrayIndexOutOfBounds] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var c: i32 = a[0x7FFF_FFFF]; @@ -122,14 +134,14 @@ var c: i32 = a[0x7FFF_FFFF]; // CHECK:STDOUT: %a.var_patt: %pattern_type.dc1 = var_pattern %a.patt [concrete = constants.%a.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %b.var: ref %i32 = var_storage %b.var_patt [concrete] -// CHECK:STDOUT: %i32.loc19: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc25: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %b: ref %i32 = wrapper_binding b, %b.var [concrete = %b.var] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %b.patt: %pattern_type.d94 = ref_binding_pattern b [concrete = constants.%b.patt] // CHECK:STDOUT: %b.var_patt: %pattern_type.d94 = var_pattern %b.patt [concrete = constants.%b.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %c.var: ref %i32 = var_storage %c.var_patt [concrete] -// CHECK:STDOUT: %i32.loc23: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc35: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %c: ref %i32 = wrapper_binding c, %c.var [concrete = %c.var] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %c.patt: %pattern_type.d94 = ref_binding_pattern c [concrete = constants.%c.patt] @@ -153,40 +165,40 @@ var c: i32 = a[0x7FFF_FFFF]; // CHECK:STDOUT: %.loc15_28.5: init %Array.00c to file.%a.var = array_init (%.loc15_28.4) [concrete = constants.%array] // CHECK:STDOUT: %.loc15_1: init %Array.00c = converted %.loc15_28.1, %.loc15_28.5 [concrete = constants.%array] // CHECK:STDOUT: assign file.%a.var, %.loc15_1 -// CHECK:STDOUT: %a.ref.loc19: ref %Array.00c = name_ref a, file.%a [concrete = file.%a.var] +// CHECK:STDOUT: %a.ref.loc25: ref %Array.00c = name_ref a, file.%a [concrete = file.%a.var] // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %impl.elem0.loc19_16: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc19_16.1: = bound_method %int_1, %impl.elem0.loc19_16 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282] -// CHECK:STDOUT: %specific_fn.loc19_16: = specific_function %impl.elem0.loc19_16, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc19_16.2: = bound_method %int_1, %specific_fn.loc19_16 [concrete = constants.%bound_method.3bd] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc19: init %i32 = call %bound_method.loc19_16.2(%int_1) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc19_16.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc19 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc19_16.2: %i32 = converted %int_1, %.loc19_16.1 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc19_17.1: ref %i32 = array_index %a.ref.loc19, %.loc19_16.2 [concrete = ] -// CHECK:STDOUT: %.loc19_17.2: %i32 = acquire_value %.loc19_17.1 [concrete = ] -// CHECK:STDOUT: %impl.elem0.loc19_17: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae] -// CHECK:STDOUT: %bound_method.loc19_17.1: = bound_method %.loc19_17.2, %impl.elem0.loc19_17 [concrete = ] -// CHECK:STDOUT: %specific_fn.loc19_17: = specific_function %impl.elem0.loc19_17, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc19_17.2: = bound_method %.loc19_17.2, %specific_fn.loc19_17 [concrete = ] -// CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc19: init %i32 = call %bound_method.loc19_17.2(%.loc19_17.2) [concrete = ] -// CHECK:STDOUT: assign file.%b.var, %Int.as.Copy.impl.Op.call.loc19 -// CHECK:STDOUT: %a.ref.loc23: ref %Array.00c = name_ref a, file.%a [concrete = file.%a.var] +// CHECK:STDOUT: %impl.elem0.loc25_16: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc25_16.1: = bound_method %int_1, %impl.elem0.loc25_16 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282] +// CHECK:STDOUT: %specific_fn.loc25_16: = specific_function %impl.elem0.loc25_16, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc25_16.2: = bound_method %int_1, %specific_fn.loc25_16 [concrete = constants.%bound_method.3bd] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc25: init %i32 = call %bound_method.loc25_16.2(%int_1) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc25_16.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc25 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc25_16.2: %i32 = converted %int_1, %.loc25_16.1 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc25_17.1: ref %i32 = array_index %a.ref.loc25, %.loc25_16.2 [concrete = ] +// CHECK:STDOUT: %.loc25_17.2: %i32 = acquire_value %.loc25_17.1 [concrete = ] +// CHECK:STDOUT: %impl.elem0.loc25_17: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae] +// CHECK:STDOUT: %bound_method.loc25_17.1: = bound_method %.loc25_17.2, %impl.elem0.loc25_17 [concrete = ] +// CHECK:STDOUT: %specific_fn.loc25_17: = specific_function %impl.elem0.loc25_17, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc25_17.2: = bound_method %.loc25_17.2, %specific_fn.loc25_17 [concrete = ] +// CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc25: init %i32 = call %bound_method.loc25_17.2(%.loc25_17.2) [concrete = ] +// CHECK:STDOUT: assign file.%b.var, %Int.as.Copy.impl.Op.call.loc25 +// CHECK:STDOUT: %a.ref.loc35: ref %Array.00c = name_ref a, file.%a [concrete = file.%a.var] // CHECK:STDOUT: %int_2147483647: Core.IntLiteral = int_value 2147483647 [concrete = constants.%int_2147483647.d89] -// CHECK:STDOUT: %impl.elem0.loc23_16: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc23_16.1: = bound_method %int_2147483647, %impl.elem0.loc23_16 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.90a] -// CHECK:STDOUT: %specific_fn.loc23_16: = specific_function %impl.elem0.loc23_16, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc23_16.2: = bound_method %int_2147483647, %specific_fn.loc23_16 [concrete = constants.%bound_method.eca] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc23: init %i32 = call %bound_method.loc23_16.2(%int_2147483647) [concrete = constants.%int_2147483647.85c] -// CHECK:STDOUT: %.loc23_16.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc23 [concrete = constants.%int_2147483647.85c] -// CHECK:STDOUT: %.loc23_16.2: %i32 = converted %int_2147483647, %.loc23_16.1 [concrete = constants.%int_2147483647.85c] -// CHECK:STDOUT: %.loc23_27.1: ref %i32 = array_index %a.ref.loc23, %.loc23_16.2 [concrete = ] -// CHECK:STDOUT: %.loc23_27.2: %i32 = acquire_value %.loc23_27.1 [concrete = ] -// CHECK:STDOUT: %impl.elem0.loc23_27: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae] -// CHECK:STDOUT: %bound_method.loc23_27.1: = bound_method %.loc23_27.2, %impl.elem0.loc23_27 [concrete = ] -// CHECK:STDOUT: %specific_fn.loc23_27: = specific_function %impl.elem0.loc23_27, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc23_27.2: = bound_method %.loc23_27.2, %specific_fn.loc23_27 [concrete = ] -// CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc23: init %i32 = call %bound_method.loc23_27.2(%.loc23_27.2) [concrete = ] -// CHECK:STDOUT: assign file.%c.var, %Int.as.Copy.impl.Op.call.loc23 +// CHECK:STDOUT: %impl.elem0.loc35_16: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc35_16.1: = bound_method %int_2147483647, %impl.elem0.loc35_16 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.90a] +// CHECK:STDOUT: %specific_fn.loc35_16: = specific_function %impl.elem0.loc35_16, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc35_16.2: = bound_method %int_2147483647, %specific_fn.loc35_16 [concrete = constants.%bound_method.eca] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc35: init %i32 = call %bound_method.loc35_16.2(%int_2147483647) [concrete = constants.%int_2147483647.85c] +// CHECK:STDOUT: %.loc35_16.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc35 [concrete = constants.%int_2147483647.85c] +// CHECK:STDOUT: %.loc35_16.2: %i32 = converted %int_2147483647, %.loc35_16.1 [concrete = constants.%int_2147483647.85c] +// CHECK:STDOUT: %.loc35_27.1: ref %i32 = array_index %a.ref.loc35, %.loc35_16.2 [concrete = ] +// CHECK:STDOUT: %.loc35_27.2: %i32 = acquire_value %.loc35_27.1 [concrete = ] +// CHECK:STDOUT: %impl.elem0.loc35_27: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae] +// CHECK:STDOUT: %bound_method.loc35_27.1: = bound_method %.loc35_27.2, %impl.elem0.loc35_27 [concrete = ] +// CHECK:STDOUT: %specific_fn.loc35_27: = specific_function %impl.elem0.loc35_27, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc35_27.2: = bound_method %.loc35_27.2, %specific_fn.loc35_27 [concrete = ] +// CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc35: init %i32 = call %bound_method.loc35_27.2(%.loc35_27.2) [concrete = ] +// CHECK:STDOUT: assign file.%c.var, %Int.as.Copy.impl.Op.call.loc35 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/index/fail_array_non_int_indexing.carbon b/toolchain/check/testdata/index/fail_array_non_int_indexing.carbon index 2eeb93a87fd4..343ad2200e21 100644 --- a/toolchain/check/testdata/index/fail_array_non_int_indexing.carbon +++ b/toolchain/check/testdata/index/fail_array_non_int_indexing.carbon @@ -13,8 +13,16 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/index/fail_array_non_int_indexing.carbon var a: array(i32, 1) = (12,); -// CHECK:STDERR: fail_array_non_int_indexing.carbon:[[@LINE+3]]:16-18: error: cannot implicitly convert expression of type `Core.FloatLiteral` to `i32` [ConversionFailure] -// CHECK:STDERR: fail_array_non_int_indexing.carbon:[[@LINE+2]]:16-18: note: type `Core.FloatLiteral` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_array_non_int_indexing.carbon:[[@LINE+11]]:16 +// CHECK:STDERR: -> │ var b: i32 = a[2.6]; +// CHECK:STDERR: · ┳━━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type +// CHECK:STDERR: · │ ┃ `Core.FloatLiteral` to `i32` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╰────┤ type `Core.FloatLiteral` does not implement interface +// CHECK:STDERR: · │ `Core.ImplicitAs(i32)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var b: i32 = a[2.6]; @@ -109,7 +117,7 @@ var b: i32 = a[2.6]; // CHECK:STDOUT: %a.var_patt: %pattern_type.dc1 = var_pattern %a.patt [concrete = constants.%a.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %b.var: ref %i32 = var_storage %b.var_patt [concrete] -// CHECK:STDOUT: %i32.loc19: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc27: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %b: ref %i32 = wrapper_binding b, %b.var [concrete = %b.var] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %b.patt: %pattern_type.d94 = ref_binding_pattern b [concrete = constants.%b.patt] @@ -135,14 +143,14 @@ var b: i32 = a[2.6]; // CHECK:STDOUT: assign file.%a.var, %.loc15_1 // CHECK:STDOUT: %a.ref: ref %Array.00c = name_ref a, file.%a [concrete = file.%a.var] // CHECK:STDOUT: %float: Core.FloatLiteral = float_literal_value 26e-1 [concrete = constants.%float] -// CHECK:STDOUT: %.loc19_16: %i32 = converted %float, [concrete = ] -// CHECK:STDOUT: %.loc19_19.1: ref %i32 = array_index %a.ref, [concrete = ] -// CHECK:STDOUT: %.loc19_19.2: %i32 = acquire_value %.loc19_19.1 [concrete = ] -// CHECK:STDOUT: %impl.elem0.loc19: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae] -// CHECK:STDOUT: %bound_method.loc19_19.1: = bound_method %.loc19_19.2, %impl.elem0.loc19 [concrete = ] -// CHECK:STDOUT: %specific_fn.loc19: = specific_function %impl.elem0.loc19, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc19_19.2: = bound_method %.loc19_19.2, %specific_fn.loc19 [concrete = ] -// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc19_19.2(%.loc19_19.2) [concrete = ] +// CHECK:STDOUT: %.loc27_16: %i32 = converted %float, [concrete = ] +// CHECK:STDOUT: %.loc27_19.1: ref %i32 = array_index %a.ref, [concrete = ] +// CHECK:STDOUT: %.loc27_19.2: %i32 = acquire_value %.loc27_19.1 [concrete = ] +// CHECK:STDOUT: %impl.elem0.loc27: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae] +// CHECK:STDOUT: %bound_method.loc27_19.1: = bound_method %.loc27_19.2, %impl.elem0.loc27 [concrete = ] +// CHECK:STDOUT: %specific_fn.loc27: = specific_function %impl.elem0.loc27, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc27_19.2: = bound_method %.loc27_19.2, %specific_fn.loc27 [concrete = ] +// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc27_19.2(%.loc27_19.2) [concrete = ] // CHECK:STDOUT: assign file.%b.var, %Int.as.Copy.impl.Op.call // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/index/fail_array_out_of_bound_access.carbon b/toolchain/check/testdata/index/fail_array_out_of_bound_access.carbon index 0fd3be8662f8..08e0b2321191 100644 --- a/toolchain/check/testdata/index/fail_array_out_of_bound_access.carbon +++ b/toolchain/check/testdata/index/fail_array_out_of_bound_access.carbon @@ -13,7 +13,13 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/index/fail_array_out_of_bound_access.carbon var a: array(i32, 1) = (12,); -// CHECK:STDERR: fail_array_out_of_bound_access.carbon:[[@LINE+2]]:16: error: array index `1` is past the end of type `array(i32, 1)` [ArrayIndexOutOfBounds] +// CHECK:STDERR: ╭─┤ fail_array_out_of_bound_access.carbon:[[@LINE+8]]:16 +// CHECK:STDERR: -> │ var b: i32 = a[1]; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: array index `1` is past the end of type +// CHECK:STDERR: · ┃ `array(i32, 1)` +// CHECK:STDERR: · ┃ [ArrayIndexOutOfBounds] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var b: i32 = a[1]; @@ -110,7 +116,7 @@ var b: i32 = a[1]; // CHECK:STDOUT: %a.var_patt: %pattern_type.dc1 = var_pattern %a.patt [concrete = constants.%a.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %b.var: ref %i32 = var_storage %b.var_patt [concrete] -// CHECK:STDOUT: %i32.loc18: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc24: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %b: ref %i32 = wrapper_binding b, %b.var [concrete = %b.var] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %b.patt: %pattern_type.d94 = ref_binding_pattern b [concrete = constants.%b.patt] @@ -136,20 +142,20 @@ var b: i32 = a[1]; // CHECK:STDOUT: assign file.%a.var, %.loc15_1 // CHECK:STDOUT: %a.ref: ref %Array.00c = name_ref a, file.%a [concrete = file.%a.var] // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %impl.elem0.loc18_16: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc18_16.1: = bound_method %int_1, %impl.elem0.loc18_16 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282] -// CHECK:STDOUT: %specific_fn.loc18_16: = specific_function %impl.elem0.loc18_16, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc18_16.2: = bound_method %int_1, %specific_fn.loc18_16 [concrete = constants.%bound_method.3bd] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc18: init %i32 = call %bound_method.loc18_16.2(%int_1) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc18_16.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc18 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc18_16.2: %i32 = converted %int_1, %.loc18_16.1 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc18_17.1: ref %i32 = array_index %a.ref, %.loc18_16.2 [concrete = ] -// CHECK:STDOUT: %.loc18_17.2: %i32 = acquire_value %.loc18_17.1 [concrete = ] -// CHECK:STDOUT: %impl.elem0.loc18_17: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae] -// CHECK:STDOUT: %bound_method.loc18_17.1: = bound_method %.loc18_17.2, %impl.elem0.loc18_17 [concrete = ] -// CHECK:STDOUT: %specific_fn.loc18_17: = specific_function %impl.elem0.loc18_17, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc18_17.2: = bound_method %.loc18_17.2, %specific_fn.loc18_17 [concrete = ] -// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc18_17.2(%.loc18_17.2) [concrete = ] +// CHECK:STDOUT: %impl.elem0.loc24_16: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc24_16.1: = bound_method %int_1, %impl.elem0.loc24_16 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282] +// CHECK:STDOUT: %specific_fn.loc24_16: = specific_function %impl.elem0.loc24_16, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc24_16.2: = bound_method %int_1, %specific_fn.loc24_16 [concrete = constants.%bound_method.3bd] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc24: init %i32 = call %bound_method.loc24_16.2(%int_1) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc24_16.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc24 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc24_16.2: %i32 = converted %int_1, %.loc24_16.1 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc24_17.1: ref %i32 = array_index %a.ref, %.loc24_16.2 [concrete = ] +// CHECK:STDOUT: %.loc24_17.2: %i32 = acquire_value %.loc24_17.1 [concrete = ] +// CHECK:STDOUT: %impl.elem0.loc24_17: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae] +// CHECK:STDOUT: %bound_method.loc24_17.1: = bound_method %.loc24_17.2, %impl.elem0.loc24_17 [concrete = ] +// CHECK:STDOUT: %specific_fn.loc24_17: = specific_function %impl.elem0.loc24_17, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc24_17.2: = bound_method %.loc24_17.2, %specific_fn.loc24_17 [concrete = ] +// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc24_17.2(%.loc24_17.2) [concrete = ] // CHECK:STDOUT: assign file.%b.var, %Int.as.Copy.impl.Op.call // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/index/fail_expr_category.carbon b/toolchain/check/testdata/index/fail_expr_category.carbon index 12d5501684cb..c1469865c18d 100644 --- a/toolchain/check/testdata/index/fail_expr_category.carbon +++ b/toolchain/check/testdata/index/fail_expr_category.carbon @@ -16,19 +16,39 @@ fn F() -> array(i32, 3); fn G(b: array(i32, 3)) { // Indexing an array value gives a value. - // CHECK:STDERR: fail_expr_category.carbon:[[@LINE+2]]:25: error: cannot take the address of non-reference expression [AddrOfNonRef] + // CHECK:STDERR: ╭─┤ fail_expr_category.carbon:[[@LINE+8]]:25 + // CHECK:STDERR: -> │ var unused pb: i32* = &b[0]; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot take the address of non-reference + // CHECK:STDERR: · ┃ expression + // CHECK:STDERR: · ┃ [AddrOfNonRef] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused pb: i32* = &b[0]; - // CHECK:STDERR: fail_expr_category.carbon:[[@LINE+2]]:3-6: error: expression is not assignable [AssignmentToNonAssignable] + // CHECK:STDERR: ╭─┤ fail_expr_category.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ b[0] = 4; + // CHECK:STDERR: · ━━┳━ + // CHECK:STDERR: · ┗━━┫ error: expression is not assignable [AssignmentToNonAssignable] + // CHECK:STDERR: ╰──── // CHECK:STDERR: b[0] = 4; // Indexing an ephemeral reference (materialized from an initializing // expression) gives a value. - // CHECK:STDERR: fail_expr_category.carbon:[[@LINE+2]]:25: error: cannot take the address of non-reference expression [AddrOfNonRef] + // CHECK:STDERR: ╭─┤ fail_expr_category.carbon:[[@LINE+8]]:25 + // CHECK:STDERR: -> │ var unused pf: i32* = &F()[0]; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot take the address of non-reference + // CHECK:STDERR: · ┃ expression + // CHECK:STDERR: · ┃ [AddrOfNonRef] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused pf: i32* = &F()[0]; - // CHECK:STDERR: fail_expr_category.carbon:[[@LINE+2]]:3-8: error: expression is not assignable [AssignmentToNonAssignable] + // CHECK:STDERR: ╭─┤ fail_expr_category.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ F()[0] = 4; + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: expression is not assignable [AssignmentToNonAssignable] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F()[0] = 4; } @@ -101,10 +121,10 @@ fn G(b: array(i32, 3)) { // CHECK:STDOUT: %T.09f: %SubobjectDestroy.type = symbolic_binding T, 0 [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.type.dea: type = fn_type @T.as_type.as.DestroyImpl.impl.Op, @T.as_type.as.DestroyImpl.impl(%T.09f) [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.6e5: %T.as_type.as.DestroyImpl.impl.Op.type.dea = struct_value () [symbolic] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.1: type = fn_type @SubobjectDestroy.WithSelf.Op.loc33_5.1 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.1: type = fn_type @SubobjectDestroy.WithSelf.Op.loc53_5.1 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.1: %SubobjectDestroy.WithSelf.Op.type.6870fd.1 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80ef6.1: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.1), @SubobjectDestroy [concrete] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.2: type = fn_type @SubobjectDestroy.WithSelf.Op.loc33_5.2 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.2: type = fn_type @SubobjectDestroy.WithSelf.Op.loc53_5.2 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.2: %SubobjectDestroy.WithSelf.Op.type.6870fd.2 = struct_value () [concrete] // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete] // CHECK:STDOUT: %SubobjectDestroy.facet.49a: %SubobjectDestroy.type = facet_value %i32, (%custom_witness.b80ef6.1) [concrete] @@ -117,7 +137,7 @@ fn G(b: array(i32, 3)) { // CHECK:STDOUT: %DestroyImpl.impl_witness.90e: = impl_witness imports.%DestroyImpl.impl_witness_table, @T.as_type.as.DestroyImpl.impl(%SubobjectDestroy.facet.79c) [concrete] // CHECK:STDOUT: %Destroy.facet.416: %Destroy.type = facet_value %Array.95c, (%DestroyImpl.impl_witness.90e, %custom_witness.b80ef6.2) [concrete] // CHECK:STDOUT: %SelfDestruct.specific_fn.cd8: = specific_function %SelfDestruct, @SelfDestruct(%Destroy.facet.416) [concrete] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.3: type = fn_type @SubobjectDestroy.WithSelf.Op.loc30 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.3: type = fn_type @SubobjectDestroy.WithSelf.Op.loc46 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.3: %SubobjectDestroy.WithSelf.Op.type.6870fd.3 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80ef6.3: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.3), @SubobjectDestroy [concrete] // CHECK:STDOUT: %SubobjectDestroy.facet.d4d: %SubobjectDestroy.type = facet_value %ptr.a17, (%custom_witness.b80ef6.3) [concrete] @@ -186,164 +206,164 @@ fn G(b: array(i32, 3)) { // CHECK:STDOUT: fn @G(%b.param: %Array.95c) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %pb.var: ref %ptr.a17 = var_storage %pb.var_patt -// CHECK:STDOUT: %b.ref.loc21: %Array.95c = name_ref b, %b -// CHECK:STDOUT: %int_0.loc21: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] -// CHECK:STDOUT: %impl.elem0.loc21_28: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc21_28.1: = bound_method %int_0.loc21, %impl.elem0.loc21_28 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.762] -// CHECK:STDOUT: %specific_fn.loc21_28: = specific_function %impl.elem0.loc21_28, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc21_28.2: = bound_method %int_0.loc21, %specific_fn.loc21_28 [concrete = constants.%bound_method.036] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc21: init %i32 = call %bound_method.loc21_28.2(%int_0.loc21) [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc21_28.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc21 [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc21_28.2: %i32 = converted %int_0.loc21, %.loc21_28.1 [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc21_29.1: ref %Array.95c = value_as_ref %b.ref.loc21 -// CHECK:STDOUT: %.loc21_29.2: ref %i32 = array_index %.loc21_29.1, %.loc21_28.2 -// CHECK:STDOUT: %.loc21_29.3: %i32 = acquire_value %.loc21_29.2 -// CHECK:STDOUT: %addr.loc21: %ptr.a17 = addr_of [concrete = ] -// CHECK:STDOUT: %impl.elem0.loc21_25: %.309 = impl_witness_access constants.%Copy.impl_witness.83a, element0 [concrete = constants.%ptr.as.Copy.impl.Op.81f] -// CHECK:STDOUT: %bound_method.loc21_25.1: = bound_method %addr.loc21, %impl.elem0.loc21_25 [concrete = ] -// CHECK:STDOUT: %specific_fn.loc21_25: = specific_function %impl.elem0.loc21_25, @ptr.as.Copy.impl.Op(constants.%i32) [concrete = constants.%ptr.as.Copy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc21_25.2: = bound_method %addr.loc21, %specific_fn.loc21_25 [concrete = ] -// CHECK:STDOUT: %ptr.as.Copy.impl.Op.call.loc21: init %ptr.a17 = call %bound_method.loc21_25.2(%addr.loc21) [concrete = ] -// CHECK:STDOUT: assign %pb.var, %ptr.as.Copy.impl.Op.call.loc21 -// CHECK:STDOUT: %.loc21_21: type = splice_block %ptr.loc21 [concrete = constants.%ptr.a17] { -// CHECK:STDOUT: %i32.loc21: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %ptr.loc21: type = ptr_type %i32.loc21 [concrete = constants.%ptr.a17] +// CHECK:STDOUT: %b.ref.loc27: %Array.95c = name_ref b, %b +// CHECK:STDOUT: %int_0.loc27: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] +// CHECK:STDOUT: %impl.elem0.loc27_28: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc27_28.1: = bound_method %int_0.loc27, %impl.elem0.loc27_28 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.762] +// CHECK:STDOUT: %specific_fn.loc27_28: = specific_function %impl.elem0.loc27_28, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc27_28.2: = bound_method %int_0.loc27, %specific_fn.loc27_28 [concrete = constants.%bound_method.036] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc27: init %i32 = call %bound_method.loc27_28.2(%int_0.loc27) [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc27_28.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc27 [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc27_28.2: %i32 = converted %int_0.loc27, %.loc27_28.1 [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc27_29.1: ref %Array.95c = value_as_ref %b.ref.loc27 +// CHECK:STDOUT: %.loc27_29.2: ref %i32 = array_index %.loc27_29.1, %.loc27_28.2 +// CHECK:STDOUT: %.loc27_29.3: %i32 = acquire_value %.loc27_29.2 +// CHECK:STDOUT: %addr.loc27: %ptr.a17 = addr_of [concrete = ] +// CHECK:STDOUT: %impl.elem0.loc27_25: %.309 = impl_witness_access constants.%Copy.impl_witness.83a, element0 [concrete = constants.%ptr.as.Copy.impl.Op.81f] +// CHECK:STDOUT: %bound_method.loc27_25.1: = bound_method %addr.loc27, %impl.elem0.loc27_25 [concrete = ] +// CHECK:STDOUT: %specific_fn.loc27_25: = specific_function %impl.elem0.loc27_25, @ptr.as.Copy.impl.Op(constants.%i32) [concrete = constants.%ptr.as.Copy.impl.Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc27_25.2: = bound_method %addr.loc27, %specific_fn.loc27_25 [concrete = ] +// CHECK:STDOUT: %ptr.as.Copy.impl.Op.call.loc27: init %ptr.a17 = call %bound_method.loc27_25.2(%addr.loc27) [concrete = ] +// CHECK:STDOUT: assign %pb.var, %ptr.as.Copy.impl.Op.call.loc27 +// CHECK:STDOUT: %.loc27_21: type = splice_block %ptr.loc27 [concrete = constants.%ptr.a17] { +// CHECK:STDOUT: %i32.loc27: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %ptr.loc27: type = ptr_type %i32.loc27 [concrete = constants.%ptr.a17] // CHECK:STDOUT: } // CHECK:STDOUT: %pb: ref %ptr.a17 = wrapper_binding pb, %pb.var // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %pb.patt: %pattern_type.7dc = ref_binding_pattern pb [concrete = constants.%pb.patt] // CHECK:STDOUT: %pb.var_patt: %pattern_type.7dc = var_pattern %pb.patt [concrete = constants.%pb.var_patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %b.ref.loc24: %Array.95c = name_ref b, %b -// CHECK:STDOUT: %int_0.loc24: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] -// CHECK:STDOUT: %impl.elem0.loc24_5: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc24_5.1: = bound_method %int_0.loc24, %impl.elem0.loc24_5 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.762] -// CHECK:STDOUT: %specific_fn.loc24_5: = specific_function %impl.elem0.loc24_5, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc24_5.2: = bound_method %int_0.loc24, %specific_fn.loc24_5 [concrete = constants.%bound_method.036] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc24_5: init %i32 = call %bound_method.loc24_5.2(%int_0.loc24) [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc24_5.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc24_5 [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc24_5.2: %i32 = converted %int_0.loc24, %.loc24_5.1 [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc24_6.1: ref %Array.95c = value_as_ref %b.ref.loc24 -// CHECK:STDOUT: %.loc24_6.2: ref %i32 = array_index %.loc24_6.1, %.loc24_5.2 -// CHECK:STDOUT: %.loc24_6.3: %i32 = acquire_value %.loc24_6.2 -// CHECK:STDOUT: %int_4.loc24: Core.IntLiteral = int_value 4 [concrete = constants.%int_4.0c1] -// CHECK:STDOUT: %impl.elem0.loc24_8: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc24_8.1: = bound_method %int_4.loc24, %impl.elem0.loc24_8 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.776] -// CHECK:STDOUT: %specific_fn.loc24_8: = specific_function %impl.elem0.loc24_8, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc24_8.2: = bound_method %int_4.loc24, %specific_fn.loc24_8 [concrete = constants.%bound_method.7fa] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc24_8: init %i32 = call %bound_method.loc24_8.2(%int_4.loc24) [concrete = constants.%int_4.6bf] -// CHECK:STDOUT: %.loc24_8: init %i32 = converted %int_4.loc24, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc24_8 [concrete = constants.%int_4.6bf] -// CHECK:STDOUT: assign %.loc24_6.3, %.loc24_8 +// CHECK:STDOUT: %b.ref.loc34: %Array.95c = name_ref b, %b +// CHECK:STDOUT: %int_0.loc34: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] +// CHECK:STDOUT: %impl.elem0.loc34_5: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc34_5.1: = bound_method %int_0.loc34, %impl.elem0.loc34_5 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.762] +// CHECK:STDOUT: %specific_fn.loc34_5: = specific_function %impl.elem0.loc34_5, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc34_5.2: = bound_method %int_0.loc34, %specific_fn.loc34_5 [concrete = constants.%bound_method.036] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc34_5: init %i32 = call %bound_method.loc34_5.2(%int_0.loc34) [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc34_5.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc34_5 [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc34_5.2: %i32 = converted %int_0.loc34, %.loc34_5.1 [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc34_6.1: ref %Array.95c = value_as_ref %b.ref.loc34 +// CHECK:STDOUT: %.loc34_6.2: ref %i32 = array_index %.loc34_6.1, %.loc34_5.2 +// CHECK:STDOUT: %.loc34_6.3: %i32 = acquire_value %.loc34_6.2 +// CHECK:STDOUT: %int_4.loc34: Core.IntLiteral = int_value 4 [concrete = constants.%int_4.0c1] +// CHECK:STDOUT: %impl.elem0.loc34_8: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc34_8.1: = bound_method %int_4.loc34, %impl.elem0.loc34_8 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.776] +// CHECK:STDOUT: %specific_fn.loc34_8: = specific_function %impl.elem0.loc34_8, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc34_8.2: = bound_method %int_4.loc34, %specific_fn.loc34_8 [concrete = constants.%bound_method.7fa] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc34_8: init %i32 = call %bound_method.loc34_8.2(%int_4.loc34) [concrete = constants.%int_4.6bf] +// CHECK:STDOUT: %.loc34_8: init %i32 = converted %int_4.loc34, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc34_8 [concrete = constants.%int_4.6bf] +// CHECK:STDOUT: assign %.loc34_6.3, %.loc34_8 // CHECK:STDOUT: %pf.var: ref %ptr.a17 = var_storage %pf.var_patt -// CHECK:STDOUT: %F.ref.loc30: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] -// CHECK:STDOUT: %.loc30_28.1: ref %Array.95c = temporary_storage -// CHECK:STDOUT: %F.call.loc30: init %Array.95c to %.loc30_28.1 = call %F.ref.loc30() -// CHECK:STDOUT: %int_0.loc30: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] -// CHECK:STDOUT: %.loc30_28.2: ref %Array.95c = temporary %.loc30_28.1, %F.call.loc30 -// CHECK:STDOUT: %impl.elem0.loc30_30: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc30_30.1: = bound_method %int_0.loc30, %impl.elem0.loc30_30 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.762] -// CHECK:STDOUT: %specific_fn.loc30_30: = specific_function %impl.elem0.loc30_30, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc30_30.2: = bound_method %int_0.loc30, %specific_fn.loc30_30 [concrete = constants.%bound_method.036] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc30: init %i32 = call %bound_method.loc30_30.2(%int_0.loc30) [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc30_30.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc30 [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc30_30.2: %i32 = converted %int_0.loc30, %.loc30_30.1 [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc30_31.1: ref %i32 = array_index %.loc30_28.2, %.loc30_30.2 -// CHECK:STDOUT: %.loc30_31.2: %i32 = acquire_value %.loc30_31.1 -// CHECK:STDOUT: %addr.loc30: %ptr.a17 = addr_of [concrete = ] -// CHECK:STDOUT: %impl.elem0.loc30_25: %.309 = impl_witness_access constants.%Copy.impl_witness.83a, element0 [concrete = constants.%ptr.as.Copy.impl.Op.81f] -// CHECK:STDOUT: %bound_method.loc30_25.1: = bound_method %addr.loc30, %impl.elem0.loc30_25 [concrete = ] -// CHECK:STDOUT: %specific_fn.loc30_25: = specific_function %impl.elem0.loc30_25, @ptr.as.Copy.impl.Op(constants.%i32) [concrete = constants.%ptr.as.Copy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc30_25.2: = bound_method %addr.loc30, %specific_fn.loc30_25 [concrete = ] -// CHECK:STDOUT: %ptr.as.Copy.impl.Op.call.loc30: init %ptr.a17 = call %bound_method.loc30_25.2(%addr.loc30) [concrete = ] -// CHECK:STDOUT: assign %pf.var, %ptr.as.Copy.impl.Op.call.loc30 -// CHECK:STDOUT: %.loc30_21: type = splice_block %ptr.loc30 [concrete = constants.%ptr.a17] { -// CHECK:STDOUT: %i32.loc30: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %ptr.loc30: type = ptr_type %i32.loc30 [concrete = constants.%ptr.a17] +// CHECK:STDOUT: %F.ref.loc46: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] +// CHECK:STDOUT: %.loc46_28.1: ref %Array.95c = temporary_storage +// CHECK:STDOUT: %F.call.loc46: init %Array.95c to %.loc46_28.1 = call %F.ref.loc46() +// CHECK:STDOUT: %int_0.loc46: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] +// CHECK:STDOUT: %.loc46_28.2: ref %Array.95c = temporary %.loc46_28.1, %F.call.loc46 +// CHECK:STDOUT: %impl.elem0.loc46_30: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc46_30.1: = bound_method %int_0.loc46, %impl.elem0.loc46_30 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.762] +// CHECK:STDOUT: %specific_fn.loc46_30: = specific_function %impl.elem0.loc46_30, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc46_30.2: = bound_method %int_0.loc46, %specific_fn.loc46_30 [concrete = constants.%bound_method.036] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc46: init %i32 = call %bound_method.loc46_30.2(%int_0.loc46) [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc46_30.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc46 [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc46_30.2: %i32 = converted %int_0.loc46, %.loc46_30.1 [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc46_31.1: ref %i32 = array_index %.loc46_28.2, %.loc46_30.2 +// CHECK:STDOUT: %.loc46_31.2: %i32 = acquire_value %.loc46_31.1 +// CHECK:STDOUT: %addr.loc46: %ptr.a17 = addr_of [concrete = ] +// CHECK:STDOUT: %impl.elem0.loc46_25: %.309 = impl_witness_access constants.%Copy.impl_witness.83a, element0 [concrete = constants.%ptr.as.Copy.impl.Op.81f] +// CHECK:STDOUT: %bound_method.loc46_25.1: = bound_method %addr.loc46, %impl.elem0.loc46_25 [concrete = ] +// CHECK:STDOUT: %specific_fn.loc46_25: = specific_function %impl.elem0.loc46_25, @ptr.as.Copy.impl.Op(constants.%i32) [concrete = constants.%ptr.as.Copy.impl.Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc46_25.2: = bound_method %addr.loc46, %specific_fn.loc46_25 [concrete = ] +// CHECK:STDOUT: %ptr.as.Copy.impl.Op.call.loc46: init %ptr.a17 = call %bound_method.loc46_25.2(%addr.loc46) [concrete = ] +// CHECK:STDOUT: assign %pf.var, %ptr.as.Copy.impl.Op.call.loc46 +// CHECK:STDOUT: %.loc46_21: type = splice_block %ptr.loc46 [concrete = constants.%ptr.a17] { +// CHECK:STDOUT: %i32.loc46: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %ptr.loc46: type = ptr_type %i32.loc46 [concrete = constants.%ptr.a17] // CHECK:STDOUT: } // CHECK:STDOUT: %pf: ref %ptr.a17 = wrapper_binding pf, %pf.var // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %pf.patt: %pattern_type.7dc = ref_binding_pattern pf [concrete = constants.%pf.patt] // CHECK:STDOUT: %pf.var_patt: %pattern_type.7dc = var_pattern %pf.patt [concrete = constants.%pf.var_patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %F.ref.loc33: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] -// CHECK:STDOUT: %.loc33_5.1: ref %Array.95c = temporary_storage -// CHECK:STDOUT: %F.call.loc33: init %Array.95c to %.loc33_5.1 = call %F.ref.loc33() -// CHECK:STDOUT: %int_0.loc33: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] -// CHECK:STDOUT: %.loc33_5.2: ref %Array.95c = temporary %.loc33_5.1, %F.call.loc33 -// CHECK:STDOUT: %impl.elem0.loc33_7: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc33_7.1: = bound_method %int_0.loc33, %impl.elem0.loc33_7 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.762] -// CHECK:STDOUT: %specific_fn.loc33_7: = specific_function %impl.elem0.loc33_7, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc33_7.2: = bound_method %int_0.loc33, %specific_fn.loc33_7 [concrete = constants.%bound_method.036] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc33_7: init %i32 = call %bound_method.loc33_7.2(%int_0.loc33) [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc33_7.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc33_7 [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc33_7.2: %i32 = converted %int_0.loc33, %.loc33_7.1 [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc33_8.1: ref %i32 = array_index %.loc33_5.2, %.loc33_7.2 -// CHECK:STDOUT: %.loc33_8.2: %i32 = acquire_value %.loc33_8.1 -// CHECK:STDOUT: %int_4.loc33: Core.IntLiteral = int_value 4 [concrete = constants.%int_4.0c1] -// CHECK:STDOUT: %impl.elem0.loc33_10: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc33_10.1: = bound_method %int_4.loc33, %impl.elem0.loc33_10 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.776] -// CHECK:STDOUT: %specific_fn.loc33_10: = specific_function %impl.elem0.loc33_10, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc33_10.2: = bound_method %int_4.loc33, %specific_fn.loc33_10 [concrete = constants.%bound_method.7fa] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc33_10: init %i32 = call %bound_method.loc33_10.2(%int_4.loc33) [concrete = constants.%int_4.6bf] -// CHECK:STDOUT: %.loc33_10: init %i32 = converted %int_4.loc33, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc33_10 [concrete = constants.%int_4.6bf] -// CHECK:STDOUT: assign %.loc33_8.2, %.loc33_10 -// CHECK:STDOUT: %Destroy.facet.loc33_5.1: %Destroy.type = facet_value constants.%Array.95c, (constants.%DestroyImpl.impl_witness.90e, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.416] -// CHECK:STDOUT: %.loc33_5.3: %Destroy.type = converted constants.%Array.95c, %Destroy.facet.loc33_5.1 [concrete = constants.%Destroy.facet.416] -// CHECK:STDOUT: %Destroy.facet.loc33_5.2: %Destroy.type = facet_value constants.%Array.95c, (constants.%DestroyImpl.impl_witness.90e, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.416] -// CHECK:STDOUT: %.loc33_5.4: %Destroy.type = converted constants.%Array.95c, %Destroy.facet.loc33_5.2 [concrete = constants.%Destroy.facet.416] +// CHECK:STDOUT: %F.ref.loc53: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] +// CHECK:STDOUT: %.loc53_5.1: ref %Array.95c = temporary_storage +// CHECK:STDOUT: %F.call.loc53: init %Array.95c to %.loc53_5.1 = call %F.ref.loc53() +// CHECK:STDOUT: %int_0.loc53: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] +// CHECK:STDOUT: %.loc53_5.2: ref %Array.95c = temporary %.loc53_5.1, %F.call.loc53 +// CHECK:STDOUT: %impl.elem0.loc53_7: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc53_7.1: = bound_method %int_0.loc53, %impl.elem0.loc53_7 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.762] +// CHECK:STDOUT: %specific_fn.loc53_7: = specific_function %impl.elem0.loc53_7, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc53_7.2: = bound_method %int_0.loc53, %specific_fn.loc53_7 [concrete = constants.%bound_method.036] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc53_7: init %i32 = call %bound_method.loc53_7.2(%int_0.loc53) [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc53_7.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc53_7 [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc53_7.2: %i32 = converted %int_0.loc53, %.loc53_7.1 [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc53_8.1: ref %i32 = array_index %.loc53_5.2, %.loc53_7.2 +// CHECK:STDOUT: %.loc53_8.2: %i32 = acquire_value %.loc53_8.1 +// CHECK:STDOUT: %int_4.loc53: Core.IntLiteral = int_value 4 [concrete = constants.%int_4.0c1] +// CHECK:STDOUT: %impl.elem0.loc53_10: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc53_10.1: = bound_method %int_4.loc53, %impl.elem0.loc53_10 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.776] +// CHECK:STDOUT: %specific_fn.loc53_10: = specific_function %impl.elem0.loc53_10, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc53_10.2: = bound_method %int_4.loc53, %specific_fn.loc53_10 [concrete = constants.%bound_method.7fa] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc53_10: init %i32 = call %bound_method.loc53_10.2(%int_4.loc53) [concrete = constants.%int_4.6bf] +// CHECK:STDOUT: %.loc53_10: init %i32 = converted %int_4.loc53, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc53_10 [concrete = constants.%int_4.6bf] +// CHECK:STDOUT: assign %.loc53_8.2, %.loc53_10 +// CHECK:STDOUT: %Destroy.facet.loc53_5.1: %Destroy.type = facet_value constants.%Array.95c, (constants.%DestroyImpl.impl_witness.90e, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.416] +// CHECK:STDOUT: %.loc53_5.3: %Destroy.type = converted constants.%Array.95c, %Destroy.facet.loc53_5.1 [concrete = constants.%Destroy.facet.416] +// CHECK:STDOUT: %Destroy.facet.loc53_5.2: %Destroy.type = facet_value constants.%Array.95c, (constants.%DestroyImpl.impl_witness.90e, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.416] +// CHECK:STDOUT: %.loc53_5.4: %Destroy.type = converted constants.%Array.95c, %Destroy.facet.loc53_5.2 [concrete = constants.%Destroy.facet.416] // CHECK:STDOUT: %SelfDestruct.specific_fn.1: = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet.416) [concrete = constants.%SelfDestruct.specific_fn.cd8] -// CHECK:STDOUT: %SelfDestruct.call.loc33: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%.loc33_5.2) -// CHECK:STDOUT: %Destroy.facet.loc30_28.1: %Destroy.type = facet_value constants.%Array.95c, (constants.%DestroyImpl.impl_witness.90e, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.416] -// CHECK:STDOUT: %.loc30_28.3: %Destroy.type = converted constants.%Array.95c, %Destroy.facet.loc30_28.1 [concrete = constants.%Destroy.facet.416] -// CHECK:STDOUT: %Destroy.facet.loc30_28.2: %Destroy.type = facet_value constants.%Array.95c, (constants.%DestroyImpl.impl_witness.90e, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.416] -// CHECK:STDOUT: %.loc30_28.4: %Destroy.type = converted constants.%Array.95c, %Destroy.facet.loc30_28.2 [concrete = constants.%Destroy.facet.416] +// CHECK:STDOUT: %SelfDestruct.call.loc53: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%.loc53_5.2) +// CHECK:STDOUT: %Destroy.facet.loc46_28.1: %Destroy.type = facet_value constants.%Array.95c, (constants.%DestroyImpl.impl_witness.90e, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.416] +// CHECK:STDOUT: %.loc46_28.3: %Destroy.type = converted constants.%Array.95c, %Destroy.facet.loc46_28.1 [concrete = constants.%Destroy.facet.416] +// CHECK:STDOUT: %Destroy.facet.loc46_28.2: %Destroy.type = facet_value constants.%Array.95c, (constants.%DestroyImpl.impl_witness.90e, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.416] +// CHECK:STDOUT: %.loc46_28.4: %Destroy.type = converted constants.%Array.95c, %Destroy.facet.loc46_28.2 [concrete = constants.%Destroy.facet.416] // CHECK:STDOUT: %SelfDestruct.specific_fn.2: = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet.416) [concrete = constants.%SelfDestruct.specific_fn.cd8] -// CHECK:STDOUT: %SelfDestruct.call.loc30_28: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%.loc30_28.2) -// CHECK:STDOUT: %Destroy.facet.loc30_3.1: %Destroy.type = facet_value constants.%ptr.a17, (constants.%DestroyImpl.impl_witness.b8f, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.abb] -// CHECK:STDOUT: %.loc30_3.1: %Destroy.type = converted constants.%ptr.a17, %Destroy.facet.loc30_3.1 [concrete = constants.%Destroy.facet.abb] -// CHECK:STDOUT: %Destroy.facet.loc30_3.2: %Destroy.type = facet_value constants.%ptr.a17, (constants.%DestroyImpl.impl_witness.b8f, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.abb] -// CHECK:STDOUT: %.loc30_3.2: %Destroy.type = converted constants.%ptr.a17, %Destroy.facet.loc30_3.2 [concrete = constants.%Destroy.facet.abb] +// CHECK:STDOUT: %SelfDestruct.call.loc46_28: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%.loc46_28.2) +// CHECK:STDOUT: %Destroy.facet.loc46_3.1: %Destroy.type = facet_value constants.%ptr.a17, (constants.%DestroyImpl.impl_witness.b8f, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.abb] +// CHECK:STDOUT: %.loc46_3.1: %Destroy.type = converted constants.%ptr.a17, %Destroy.facet.loc46_3.1 [concrete = constants.%Destroy.facet.abb] +// CHECK:STDOUT: %Destroy.facet.loc46_3.2: %Destroy.type = facet_value constants.%ptr.a17, (constants.%DestroyImpl.impl_witness.b8f, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.abb] +// CHECK:STDOUT: %.loc46_3.2: %Destroy.type = converted constants.%ptr.a17, %Destroy.facet.loc46_3.2 [concrete = constants.%Destroy.facet.abb] // CHECK:STDOUT: %SelfDestruct.specific_fn.3: = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet.abb) [concrete = constants.%SelfDestruct.specific_fn.690] -// CHECK:STDOUT: %SelfDestruct.call.loc30_3: init %empty_tuple.type = call %SelfDestruct.specific_fn.3(%pf.var) -// CHECK:STDOUT: %Destroy.facet.loc21_3.1: %Destroy.type = facet_value constants.%ptr.a17, (constants.%DestroyImpl.impl_witness.b8f, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.abb] -// CHECK:STDOUT: %.loc21_3.1: %Destroy.type = converted constants.%ptr.a17, %Destroy.facet.loc21_3.1 [concrete = constants.%Destroy.facet.abb] -// CHECK:STDOUT: %Destroy.facet.loc21_3.2: %Destroy.type = facet_value constants.%ptr.a17, (constants.%DestroyImpl.impl_witness.b8f, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.abb] -// CHECK:STDOUT: %.loc21_3.2: %Destroy.type = converted constants.%ptr.a17, %Destroy.facet.loc21_3.2 [concrete = constants.%Destroy.facet.abb] +// CHECK:STDOUT: %SelfDestruct.call.loc46_3: init %empty_tuple.type = call %SelfDestruct.specific_fn.3(%pf.var) +// CHECK:STDOUT: %Destroy.facet.loc27_3.1: %Destroy.type = facet_value constants.%ptr.a17, (constants.%DestroyImpl.impl_witness.b8f, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.abb] +// CHECK:STDOUT: %.loc27_3.1: %Destroy.type = converted constants.%ptr.a17, %Destroy.facet.loc27_3.1 [concrete = constants.%Destroy.facet.abb] +// CHECK:STDOUT: %Destroy.facet.loc27_3.2: %Destroy.type = facet_value constants.%ptr.a17, (constants.%DestroyImpl.impl_witness.b8f, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.abb] +// CHECK:STDOUT: %.loc27_3.2: %Destroy.type = converted constants.%ptr.a17, %Destroy.facet.loc27_3.2 [concrete = constants.%Destroy.facet.abb] // CHECK:STDOUT: %SelfDestruct.specific_fn.4: = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet.abb) [concrete = constants.%SelfDestruct.specific_fn.690] -// CHECK:STDOUT: %SelfDestruct.call.loc21: init %empty_tuple.type = call %SelfDestruct.specific_fn.4(%pb.var) +// CHECK:STDOUT: %SelfDestruct.call.loc27: init %empty_tuple.type = call %SelfDestruct.specific_fn.4(%pb.var) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc33_5.1(%self.param: ref %i32) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc53_5.1(%self.param: ref %i32) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc33_5.2(%self.param: ref %Array.95c) { +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc53_5.2(%self.param: ref %Array.95c) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2] -// CHECK:STDOUT: %.loc33_5.1: ref %i32 = array_index %self.param, %int_2 -// CHECK:STDOUT: %Destroy.facet.loc33_5.1: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc33_5.2: %Destroy.type = converted constants.%i32, %Destroy.facet.loc33_5.1 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc33_5.2: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc33_5.3: %Destroy.type = converted constants.%i32, %Destroy.facet.loc33_5.2 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc53_5.1: ref %i32 = array_index %self.param, %int_2 +// CHECK:STDOUT: %Destroy.facet.loc53_5.1: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc53_5.2: %Destroy.type = converted constants.%i32, %Destroy.facet.loc53_5.1 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc53_5.2: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc53_5.3: %Destroy.type = converted constants.%i32, %Destroy.facet.loc53_5.2 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: %SelfDestruct.specific_fn.1: = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet.c2b) [concrete = constants.%SelfDestruct.specific_fn.845] -// CHECK:STDOUT: %SelfDestruct.call.loc33_5.1: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%.loc33_5.1) +// CHECK:STDOUT: %SelfDestruct.call.loc53_5.1: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%.loc53_5.1) // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] -// CHECK:STDOUT: %.loc33_5.4: ref %i32 = array_index %self.param, %int_1 -// CHECK:STDOUT: %Destroy.facet.loc33_5.3: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc33_5.5: %Destroy.type = converted constants.%i32, %Destroy.facet.loc33_5.3 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc33_5.4: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc33_5.6: %Destroy.type = converted constants.%i32, %Destroy.facet.loc33_5.4 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc53_5.4: ref %i32 = array_index %self.param, %int_1 +// CHECK:STDOUT: %Destroy.facet.loc53_5.3: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc53_5.5: %Destroy.type = converted constants.%i32, %Destroy.facet.loc53_5.3 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc53_5.4: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc53_5.6: %Destroy.type = converted constants.%i32, %Destroy.facet.loc53_5.4 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: %SelfDestruct.specific_fn.2: = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet.c2b) [concrete = constants.%SelfDestruct.specific_fn.845] -// CHECK:STDOUT: %SelfDestruct.call.loc33_5.2: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%.loc33_5.4) +// CHECK:STDOUT: %SelfDestruct.call.loc53_5.2: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%.loc53_5.4) // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] -// CHECK:STDOUT: %.loc33_5.7: ref %i32 = array_index %self.param, %int_0 -// CHECK:STDOUT: %Destroy.facet.loc33_5.5: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc33_5.8: %Destroy.type = converted constants.%i32, %Destroy.facet.loc33_5.5 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc33_5.6: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc33_5.9: %Destroy.type = converted constants.%i32, %Destroy.facet.loc33_5.6 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc53_5.7: ref %i32 = array_index %self.param, %int_0 +// CHECK:STDOUT: %Destroy.facet.loc53_5.5: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc53_5.8: %Destroy.type = converted constants.%i32, %Destroy.facet.loc53_5.5 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc53_5.6: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.1) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc53_5.9: %Destroy.type = converted constants.%i32, %Destroy.facet.loc53_5.6 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: %SelfDestruct.specific_fn.3: = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet.c2b) [concrete = constants.%SelfDestruct.specific_fn.845] -// CHECK:STDOUT: %SelfDestruct.call.loc33_5.3: init %empty_tuple.type = call %SelfDestruct.specific_fn.3(%.loc33_5.7) +// CHECK:STDOUT: %SelfDestruct.call.loc53_5.3: init %empty_tuple.type = call %SelfDestruct.specific_fn.3(%.loc53_5.7) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc30(%self.param: ref %ptr.a17) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc46(%self.param: ref %ptr.a17) = "no_op"; // CHECK:STDOUT: diff --git a/toolchain/check/testdata/index/fail_invalid_base.carbon b/toolchain/check/testdata/index/fail_invalid_base.carbon index 1c50fedbd3c4..258ef4ea6fb3 100644 --- a/toolchain/check/testdata/index/fail_invalid_base.carbon +++ b/toolchain/check/testdata/index/fail_invalid_base.carbon @@ -14,20 +14,47 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/index/fail_invalid_base.carbon namespace N; -// CHECK:STDERR: fail_invalid_base.carbon:[[@LINE+2]]:14: error: expression cannot be used as a value [UseOfNonExprAsValue] +// CHECK:STDERR: ╭─┤ fail_invalid_base.carbon:[[@LINE+7]]:14 +// CHECK:STDERR: -> │ var a: i32 = N[0]; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expression cannot be used as a value +// CHECK:STDERR: · ┃ [UseOfNonExprAsValue] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var a: i32 = N[0]; fn F(); -// CHECK:STDERR: fail_invalid_base.carbon:[[@LINE+2]]:14-17: error: cannot access member of interface `Core.IndexWith(Core.IntLiteral)` in type `` that does not implement that interface [MissingImplInMemberAccess] +// CHECK:STDERR: ╭─┤ fail_invalid_base.carbon:[[@LINE+9]]:14 +// CHECK:STDERR: -> │ var b: i32 = F[1]; +// CHECK:STDERR: · ┳━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface +// CHECK:STDERR: · ┃ `Core.IndexWith(Core.IntLiteral)` in type `` +// CHECK:STDERR: · ┃ that does not implement that interface +// CHECK:STDERR: · ┃ [MissingImplInMemberAccess] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var b: i32 = F[1]; -// CHECK:STDERR: fail_invalid_base.carbon:[[@LINE+2]]:14-32: error: cannot access member of interface `Core.IndexWith(Core.IntLiteral)` in type `{.a: Core.IntLiteral, .b: Core.IntLiteral}` that does not implement that interface [MissingImplInMemberAccess] +// CHECK:STDERR: ╭─┤ fail_invalid_base.carbon:[[@LINE+10]]:14 +// CHECK:STDERR: -> │ var c: i32 = {.a = 1, .b = 2}[0]; +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface +// CHECK:STDERR: · ┃ `Core.IndexWith(Core.IntLiteral)` in type +// CHECK:STDERR: · ┃ `{.a: Core.IntLiteral, .b: Core.IntLiteral}` that does +// CHECK:STDERR: · ┃ not implement that interface +// CHECK:STDERR: · ┃ [MissingImplInMemberAccess] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var c: i32 = {.a = 1, .b = 2}[0]; -// CHECK:STDERR: fail_invalid_base.carbon:[[@LINE+2]]:14-34: error: cannot access member of interface `Core.IndexWith(Core.IntLiteral)` in type `type` that does not implement that interface [MissingImplInMemberAccess] +// CHECK:STDERR: ╭─┤ fail_invalid_base.carbon:[[@LINE+9]]:14 +// CHECK:STDERR: -> │ var d: i32 = {.a: i32, .b: i32}[0]; +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface +// CHECK:STDERR: · ┃ `Core.IndexWith(Core.IntLiteral)` in type `type` that +// CHECK:STDERR: · ┃ does not implement that interface +// CHECK:STDERR: · ┃ [MissingImplInMemberAccess] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var d: i32 = {.a: i32, .b: i32}[0]; @@ -88,7 +115,7 @@ var d: i32 = {.a: i32, .b: i32}[0]; // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %N: = namespace [concrete] {} // CHECK:STDOUT: %a.var: ref %i32 = var_storage %a.var_patt [concrete] -// CHECK:STDOUT: %i32.loc19: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc24: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %a: ref %i32 = wrapper_binding a, %a.var [concrete = %a.var] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %a.patt: %pattern_type.d94 = ref_binding_pattern a [concrete = constants.%a.patt] @@ -96,21 +123,21 @@ var d: i32 = {.a: i32, .b: i32}[0]; // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} // CHECK:STDOUT: %b.var: ref %i32 = var_storage %b.var_patt [concrete] -// CHECK:STDOUT: %i32.loc24: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc36: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %b: ref %i32 = wrapper_binding b, %b.var [concrete = %b.var] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %b.patt: %pattern_type.d94 = ref_binding_pattern b [concrete = constants.%b.patt] // CHECK:STDOUT: %b.var_patt: %pattern_type.d94 = var_pattern %b.patt [concrete = constants.%b.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %c.var: ref %i32 = var_storage %c.var_patt [concrete] -// CHECK:STDOUT: %i32.loc28: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc48: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %c: ref %i32 = wrapper_binding c, %c.var [concrete = %c.var] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %c.patt: %pattern_type.d94 = ref_binding_pattern c [concrete = constants.%c.patt] // CHECK:STDOUT: %c.var_patt: %pattern_type.d94 = var_pattern %c.patt [concrete = constants.%c.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %d.var: ref %i32 = var_storage %d.var_patt [concrete] -// CHECK:STDOUT: %i32.loc32: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc59: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %d: ref %i32 = wrapper_binding d, %d.var [concrete = %d.var] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %d.patt: %pattern_type.d94 = ref_binding_pattern d [concrete = constants.%d.patt] @@ -123,22 +150,22 @@ var d: i32 = {.a: i32, .b: i32}[0]; // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %N.ref: = name_ref N, file.%N [concrete = file.%N] -// CHECK:STDOUT: %int_0.loc19: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] +// CHECK:STDOUT: %int_0.loc24: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] // CHECK:STDOUT: assign file.%a.var, // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] -// CHECK:STDOUT: %int_1.loc24: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] +// CHECK:STDOUT: %int_1.loc36: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] // CHECK:STDOUT: assign file.%b.var, -// CHECK:STDOUT: %int_1.loc28: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] +// CHECK:STDOUT: %int_1.loc48: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2] -// CHECK:STDOUT: %.loc28_29.1: %struct_type.a.b.cfd = struct_literal (%int_1.loc28, %int_2) [concrete = constants.%struct] -// CHECK:STDOUT: %int_0.loc28: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] -// CHECK:STDOUT: %struct: %struct_type.a.b.cfd = struct_value (%int_1.loc28, %int_2) [concrete = constants.%struct] -// CHECK:STDOUT: %.loc28_29.2: %struct_type.a.b.cfd = converted %.loc28_29.1, %struct [concrete = constants.%struct] +// CHECK:STDOUT: %.loc48_29.1: %struct_type.a.b.cfd = struct_literal (%int_1.loc48, %int_2) [concrete = constants.%struct] +// CHECK:STDOUT: %int_0.loc48: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] +// CHECK:STDOUT: %struct: %struct_type.a.b.cfd = struct_value (%int_1.loc48, %int_2) [concrete = constants.%struct] +// CHECK:STDOUT: %.loc48_29.2: %struct_type.a.b.cfd = converted %.loc48_29.1, %struct [concrete = constants.%struct] // CHECK:STDOUT: assign file.%c.var, -// CHECK:STDOUT: %i32.loc32_19: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %i32.loc32_28: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc59_19: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc59_28: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.a.b: type = struct_type {.a: %i32, .b: %i32} [concrete = constants.%struct_type.a.b.250] -// CHECK:STDOUT: %int_0.loc32: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] +// CHECK:STDOUT: %int_0.loc59: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] // CHECK:STDOUT: assign file.%d.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/index/fail_name_not_found.carbon b/toolchain/check/testdata/index/fail_name_not_found.carbon index e7034470293a..d7efd04893e9 100644 --- a/toolchain/check/testdata/index/fail_name_not_found.carbon +++ b/toolchain/check/testdata/index/fail_name_not_found.carbon @@ -13,7 +13,11 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/index/fail_name_not_found.carbon fn Main() { - // CHECK:STDERR: fail_name_not_found.carbon:[[@LINE+2]]:23: error: name `a` not found [NameNotFound] + // CHECK:STDERR: ╭─┤ fail_name_not_found.carbon:[[@LINE+6]]:23 + // CHECK:STDERR: -> │ var unused b: i32 = a[0]; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: name `a` not found [NameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused b: i32 = a[0]; } @@ -40,7 +44,7 @@ fn Main() { // CHECK:STDOUT: %T.09f: %SubobjectDestroy.type = symbolic_binding T, 0 [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.type.dea: type = fn_type @T.as_type.as.DestroyImpl.impl.Op, @T.as_type.as.DestroyImpl.impl(%T.09f) [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.6e5: %T.as_type.as.DestroyImpl.impl.Op.type.dea = struct_value () [symbolic] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.687: type = fn_type @SubobjectDestroy.WithSelf.Op.loc18 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.687: type = fn_type @SubobjectDestroy.WithSelf.Op.loc22 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f: %SubobjectDestroy.WithSelf.Op.type.687 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f), @SubobjectDestroy [concrete] // CHECK:STDOUT: %SubobjectDestroy.facet.49a: %SubobjectDestroy.type = facet_value %i32, (%custom_witness.b80) [concrete] @@ -84,14 +88,14 @@ fn Main() { // CHECK:STDOUT: %b.patt: %pattern_type.d94 = ref_binding_pattern b [concrete = constants.%b.patt] // CHECK:STDOUT: %b.var_patt: %pattern_type.d94 = var_pattern %b.patt [concrete = constants.%b.var_patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.facet.loc18_3.1: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc18_3.1: %Destroy.type = converted constants.%i32, %Destroy.facet.loc18_3.1 [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %Destroy.facet.loc18_3.2: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc18_3.2: %Destroy.type = converted constants.%i32, %Destroy.facet.loc18_3.2 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %Destroy.facet.loc22_3.1: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc22_3.1: %Destroy.type = converted constants.%i32, %Destroy.facet.loc22_3.1 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %Destroy.facet.loc22_3.2: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc22_3.2: %Destroy.type = converted constants.%i32, %Destroy.facet.loc22_3.2 [concrete = constants.%Destroy.facet] // CHECK:STDOUT: %SelfDestruct.specific_fn: = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet) [concrete = constants.%SelfDestruct.specific_fn] // CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%b.var) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc18(%self.param: ref %i32) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc22(%self.param: ref %i32) = "no_op"; // CHECK:STDOUT: diff --git a/toolchain/check/testdata/index/fail_negative_indexing.carbon b/toolchain/check/testdata/index/fail_negative_indexing.carbon index 2adec6d28486..c67ed4bd6c18 100644 --- a/toolchain/check/testdata/index/fail_negative_indexing.carbon +++ b/toolchain/check/testdata/index/fail_negative_indexing.carbon @@ -13,7 +13,13 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/index/fail_negative_indexing.carbon var c: array(i32, 2) = (42, 42); -// CHECK:STDERR: fail_negative_indexing.carbon:[[@LINE+2]]:16-18: error: array index `-10` is past the end of type `array(i32, 2)` [ArrayIndexOutOfBounds] +// CHECK:STDERR: ╭─┤ fail_negative_indexing.carbon:[[@LINE+8]]:16 +// CHECK:STDERR: -> │ var d: i32 = c[-10]; +// CHECK:STDERR: · ┳━━ +// CHECK:STDERR: · ┗━━┫ error: array index `-10` is past the end of type +// CHECK:STDERR: · ┃ `array(i32, 2)` +// CHECK:STDERR: · ┃ [ArrayIndexOutOfBounds] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var d: i32 = c[-10]; @@ -127,7 +133,7 @@ var d: i32 = c[-10]; // CHECK:STDOUT: %c.var_patt: %pattern_type.c08 = var_pattern %c.patt [concrete = constants.%c.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %d.var: ref %i32 = var_storage %d.var_patt [concrete] -// CHECK:STDOUT: %i32.loc18: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc24: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %d: ref %i32 = wrapper_binding d, %d.var [concrete = %d.var] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %d.patt: %pattern_type.d94 = ref_binding_pattern d [concrete = constants.%d.patt] @@ -164,24 +170,24 @@ var d: i32 = c[-10]; // CHECK:STDOUT: %c.ref: ref %Array.641 = name_ref c, file.%c [concrete = file.%c.var] // CHECK:STDOUT: %int_10: Core.IntLiteral = int_value 10 [concrete = constants.%int_10] // CHECK:STDOUT: %impl.elem1: %.2ac = impl_witness_access constants.%Negate.impl_witness, element1 [concrete = constants.%Core.IntLiteral.as.Negate.impl.Op] -// CHECK:STDOUT: %bound_method.loc18_16.1: = bound_method %int_10, %impl.elem1 [concrete = constants.%Core.IntLiteral.as.Negate.impl.Op.bound] -// CHECK:STDOUT: %Core.IntLiteral.as.Negate.impl.Op.call: init Core.IntLiteral = call %bound_method.loc18_16.1(%int_10) [concrete = constants.%int_-10.06d] -// CHECK:STDOUT: %impl.elem0.loc18_16: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc18_16.2: = bound_method %Core.IntLiteral.as.Negate.impl.Op.call, %impl.elem0.loc18_16 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.b38] -// CHECK:STDOUT: %specific_fn.loc18_16: = specific_function %impl.elem0.loc18_16, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc18_16.3: = bound_method %Core.IntLiteral.as.Negate.impl.Op.call, %specific_fn.loc18_16 [concrete = constants.%bound_method.378] -// CHECK:STDOUT: %.loc18_16.1: Core.IntLiteral = value_of_initializer %Core.IntLiteral.as.Negate.impl.Op.call [concrete = constants.%int_-10.06d] -// CHECK:STDOUT: %.loc18_16.2: Core.IntLiteral = converted %Core.IntLiteral.as.Negate.impl.Op.call, %.loc18_16.1 [concrete = constants.%int_-10.06d] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc18: init %i32 = call %bound_method.loc18_16.3(%.loc18_16.2) [concrete = constants.%int_-10.bee] -// CHECK:STDOUT: %.loc18_16.3: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc18 [concrete = constants.%int_-10.bee] -// CHECK:STDOUT: %.loc18_16.4: %i32 = converted %Core.IntLiteral.as.Negate.impl.Op.call, %.loc18_16.3 [concrete = constants.%int_-10.bee] -// CHECK:STDOUT: %.loc18_19.1: ref %i32 = array_index %c.ref, %.loc18_16.4 [concrete = ] -// CHECK:STDOUT: %.loc18_19.2: %i32 = acquire_value %.loc18_19.1 [concrete = ] -// CHECK:STDOUT: %impl.elem0.loc18_19: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae] -// CHECK:STDOUT: %bound_method.loc18_19.1: = bound_method %.loc18_19.2, %impl.elem0.loc18_19 [concrete = ] -// CHECK:STDOUT: %specific_fn.loc18_19: = specific_function %impl.elem0.loc18_19, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc18_19.2: = bound_method %.loc18_19.2, %specific_fn.loc18_19 [concrete = ] -// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc18_19.2(%.loc18_19.2) [concrete = ] +// CHECK:STDOUT: %bound_method.loc24_16.1: = bound_method %int_10, %impl.elem1 [concrete = constants.%Core.IntLiteral.as.Negate.impl.Op.bound] +// CHECK:STDOUT: %Core.IntLiteral.as.Negate.impl.Op.call: init Core.IntLiteral = call %bound_method.loc24_16.1(%int_10) [concrete = constants.%int_-10.06d] +// CHECK:STDOUT: %impl.elem0.loc24_16: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc24_16.2: = bound_method %Core.IntLiteral.as.Negate.impl.Op.call, %impl.elem0.loc24_16 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.b38] +// CHECK:STDOUT: %specific_fn.loc24_16: = specific_function %impl.elem0.loc24_16, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc24_16.3: = bound_method %Core.IntLiteral.as.Negate.impl.Op.call, %specific_fn.loc24_16 [concrete = constants.%bound_method.378] +// CHECK:STDOUT: %.loc24_16.1: Core.IntLiteral = value_of_initializer %Core.IntLiteral.as.Negate.impl.Op.call [concrete = constants.%int_-10.06d] +// CHECK:STDOUT: %.loc24_16.2: Core.IntLiteral = converted %Core.IntLiteral.as.Negate.impl.Op.call, %.loc24_16.1 [concrete = constants.%int_-10.06d] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc24: init %i32 = call %bound_method.loc24_16.3(%.loc24_16.2) [concrete = constants.%int_-10.bee] +// CHECK:STDOUT: %.loc24_16.3: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc24 [concrete = constants.%int_-10.bee] +// CHECK:STDOUT: %.loc24_16.4: %i32 = converted %Core.IntLiteral.as.Negate.impl.Op.call, %.loc24_16.3 [concrete = constants.%int_-10.bee] +// CHECK:STDOUT: %.loc24_19.1: ref %i32 = array_index %c.ref, %.loc24_16.4 [concrete = ] +// CHECK:STDOUT: %.loc24_19.2: %i32 = acquire_value %.loc24_19.1 [concrete = ] +// CHECK:STDOUT: %impl.elem0.loc24_19: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae] +// CHECK:STDOUT: %bound_method.loc24_19.1: = bound_method %.loc24_19.2, %impl.elem0.loc24_19 [concrete = ] +// CHECK:STDOUT: %specific_fn.loc24_19: = specific_function %impl.elem0.loc24_19, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc24_19.2: = bound_method %.loc24_19.2, %specific_fn.loc24_19 [concrete = ] +// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc24_19.2(%.loc24_19.2) [concrete = ] // CHECK:STDOUT: assign file.%d.var, %Int.as.Copy.impl.Op.call // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/index/fail_non_tuple_access.carbon b/toolchain/check/testdata/index/fail_non_tuple_access.carbon index 2dd52f23ec90..3d878b3fe122 100644 --- a/toolchain/check/testdata/index/fail_non_tuple_access.carbon +++ b/toolchain/check/testdata/index/fail_non_tuple_access.carbon @@ -13,7 +13,14 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/index/fail_non_tuple_access.carbon fn Main() { - // CHECK:STDERR: fail_non_tuple_access.carbon:[[@LINE+2]]:3-6: error: cannot access member of interface `Core.IndexWith(Core.IntLiteral)` in type `Core.IntLiteral` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_non_tuple_access.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ 0[1]; + // CHECK:STDERR: · ┳━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.IndexWith(Core.IntLiteral)` in type `Core.IntLiteral` that + // CHECK:STDERR: · ┃ does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: 0[1]; } diff --git a/toolchain/check/testdata/interface/compound_member_access.carbon b/toolchain/check/testdata/interface/compound_member_access.carbon index 3b227e0d12d2..bb86b500a228 100644 --- a/toolchain/check/testdata/interface/compound_member_access.carbon +++ b/toolchain/check/testdata/interface/compound_member_access.carbon @@ -57,8 +57,15 @@ fn Simple3(generic T: K2, x: T) { // Compound member access does not. It tries to convert `y` to `K2`, but only // its type `V` can. fn Compound3(generic V: K2, y: V) { - // CHECK:STDERR: fail_caller_instance_interface_not.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert non-type value of type `V` into type implementing `K2` [ConversionFailureNonTypeToFacet] - // CHECK:STDERR: fail_caller_instance_interface_not.carbon:[[@LINE+2]]:3-11: note: type `V` does not implement interface `Core.ImplicitAs(K2)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_caller_instance_interface_not.carbon:[[@LINE+10]]:3 + // CHECK:STDERR: -> │ y.(K2.Q2)(); + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert non-type value of type `V` into type + // CHECK:STDERR: · │ ┃ implementing `K2` + // CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: · ╰────┤ type `V` does not implement interface `Core.ImplicitAs(K2)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: y.(K2.Q2)(); } @@ -94,22 +101,50 @@ interface L2 { // Simple member access. Fails since calling an instance method without an object. fn Simple5(generic T: L2) { - // CHECK:STDERR: fail_interface_instance_caller_not.carbon:[[@LINE+3]]:3-8: error: 0 arguments passed to function expecting 1 argument [CallArgCountMismatch] - // CHECK:STDERR: fail_interface_instance_caller_not.carbon:[[@LINE-7]]:3-14: note: calling function declared here [InCallToEntity] + // CHECK:STDERR: ╭─┤ fail_interface_instance_caller_not.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ fn R2(self); + // CHECK:STDERR: · ──────┬───── + // CHECK:STDERR: · ╰──┤ calling function declared here [InCallToEntity] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ T.R2(); + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: 0 arguments passed to function expecting 1 argument + // CHECK:STDERR: · ┃ [CallArgCountMismatch] + // CHECK:STDERR: ╰──── // CHECK:STDERR: T.R2(); - // CHECK:STDERR: fail_interface_instance_caller_not.carbon:[[@LINE+3]]:3-8: error: 0 arguments passed to function expecting 1 argument [CallArgCountMismatch] - // CHECK:STDERR: fail_interface_instance_caller_not.carbon:[[@LINE-10]]:3-18: note: calling function declared here [InCallToEntity] + // CHECK:STDERR: ╭─┤ fail_interface_instance_caller_not.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ fn S2(ref self); + // CHECK:STDERR: · ────────┬─────── + // CHECK:STDERR: · ╰──┤ calling function declared here [InCallToEntity] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ T.S2(); + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: 0 arguments passed to function expecting 1 argument + // CHECK:STDERR: · ┃ [CallArgCountMismatch] + // CHECK:STDERR: ╰──── // CHECK:STDERR: T.S2(); } // TODO: Expected to fail in the same way as `Simple5`. fn Compound5(generic V: L2) { - // CHECK:STDERR: fail_interface_instance_caller_not.carbon:[[@LINE+2]]:3-11: error: cannot access member of interface `L2` in type `L2` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_interface_instance_caller_not.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ V.(L2.R2)(); + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `L2` in type `L2` that does not + // CHECK:STDERR: · ┃ implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: V.(L2.R2)(); - // CHECK:STDERR: fail_interface_instance_caller_not.carbon:[[@LINE+2]]:3-11: error: cannot access member of interface `L2` in type `L2` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_interface_instance_caller_not.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ V.(L2.S2)(); + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `L2` in type `L2` that does not + // CHECK:STDERR: · ┃ implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: V.(L2.S2)(); } @@ -129,16 +164,37 @@ impl C as A { // Since `A.G` is a non-instance method, compound member access may only be // used with a type, not an instance. fn Fails() { - // CHECK:STDERR: fail_combine_non_instance.carbon:[[@LINE+3]]:3-23: error: cannot implicitly convert non-type value of type `C` into type implementing `A` [ConversionFailureNonTypeToFacet] - // CHECK:STDERR: fail_combine_non_instance.carbon:[[@LINE+2]]:3-23: note: type `C` does not implement interface `Core.ImplicitAs(A)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_combine_non_instance.carbon:[[@LINE+10]]:3 + // CHECK:STDERR: -> │ ({} as C).((A & A).G)(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert non-type value of type `C` into type + // CHECK:STDERR: · │ ┃ implementing `A` + // CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: · ╰────┤ type `C` does not implement interface `Core.ImplicitAs(A)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: ({} as C).((A & A).G)(); - // CHECK:STDERR: fail_combine_non_instance.carbon:[[@LINE+3]]:3-43: error: cannot implicitly convert non-type value of type `C` into type implementing `A` [ConversionFailureNonTypeToFacet] - // CHECK:STDERR: fail_combine_non_instance.carbon:[[@LINE+2]]:3-43: note: type `C` does not implement interface `Core.ImplicitAs(A)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_combine_non_instance.carbon:[[@LINE+10]]:3 + // CHECK:STDERR: -> │ (({} as C) as (C as (A & A))).((A & A).G)(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert non-type value of type `C` into type + // CHECK:STDERR: · │ ┃ implementing `A` + // CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: · ╰────┤ type `C` does not implement interface `Core.ImplicitAs(A)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: (({} as C) as (C as (A & A))).((A & A).G)(); - // CHECK:STDERR: fail_combine_non_instance.carbon:[[@LINE+3]]:3-37: error: cannot implicitly convert non-type value of type `C` into type implementing `A` [ConversionFailureNonTypeToFacet] - // CHECK:STDERR: fail_combine_non_instance.carbon:[[@LINE+2]]:3-37: note: type `C` does not implement interface `Core.ImplicitAs(A)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_combine_non_instance.carbon:[[@LINE+10]]:3 + // CHECK:STDERR: -> │ (({} as C) as (C as (A & A))).(A.G)(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert non-type value of type `C` into type + // CHECK:STDERR: · │ ┃ implementing `A` + // CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: · ╰────┤ type `C` does not implement interface `Core.ImplicitAs(A)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: (({} as C) as (C as (A & A))).(A.G)(); } @@ -668,9 +724,9 @@ fn Works() { // CHECK:STDOUT: fn(%y.param: @Compound3.%V.as_type.loc14_32.1 (%V.as_type)) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %y.ref: @Compound3.%V.as_type.loc14_32.1 (%V.as_type) = name_ref y, %y -// CHECK:STDOUT: %K2.ref.loc18: type = name_ref K2, file.%K2.decl [concrete = constants.%K2.type] +// CHECK:STDOUT: %K2.ref.loc25: type = name_ref K2, file.%K2.decl [concrete = constants.%K2.type] // CHECK:STDOUT: %Q2.ref: %K2.assoc_type = name_ref Q2, @K2.WithSelf.%assoc0 [concrete = constants.%assoc0.441] -// CHECK:STDOUT: %.loc18: %K2.type = converted %y.ref, [concrete = ] +// CHECK:STDOUT: %.loc25: %K2.type = converted %y.ref, [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -1198,13 +1254,13 @@ fn Works() { // CHECK:STDOUT: %T.loc10_21.2: %L2.type = symbolic_binding T, 0 [symbolic = %T.loc10_21.1 (constants.%T)] // CHECK:STDOUT: } // CHECK:STDOUT: %Compound5.decl: %Compound5.type = fn_decl @Compound5 [concrete = constants.%Compound5] { -// CHECK:STDOUT: %V.patt.loc22_23.1: %pattern_type.5b3 = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc22_23.2 (constants.%V.patt)] +// CHECK:STDOUT: %V.patt.loc38_23.1: %pattern_type.5b3 = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc38_23.2 (constants.%V.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc22: type = splice_block %L2.ref.loc22 [concrete = constants.%L2.type] { +// CHECK:STDOUT: %.loc38: type = splice_block %L2.ref.loc38 [concrete = constants.%L2.type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %L2.ref.loc22: type = name_ref L2, file.%L2.decl [concrete = constants.%L2.type] +// CHECK:STDOUT: %L2.ref.loc38: type = name_ref L2, file.%L2.decl [concrete = constants.%L2.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %V.loc22_23.2: %L2.type = symbolic_binding V, 0 [symbolic = %V.loc22_23.1 (constants.%V)] +// CHECK:STDOUT: %V.loc38_23.2: %L2.type = symbolic_binding V, 0 [symbolic = %V.loc38_23.1 (constants.%V)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1274,44 +1330,44 @@ fn Works() { // CHECK:STDOUT: %T.loc10_21.1: %L2.type = symbolic_binding T, 0 [symbolic = %T.loc10_21.1 (constants.%T)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %T.as_type.loc14_4.2: type = facet_access_type %T.loc10_21.1 [symbolic = %T.as_type.loc14_4.2 (constants.%T.as_type)] +// CHECK:STDOUT: %T.as_type.loc22_4.2: type = facet_access_type %T.loc10_21.1 [symbolic = %T.as_type.loc22_4.2 (constants.%T.as_type)] // CHECK:STDOUT: %L2.WithSelf.R2.type: type = fn_type @L2.WithSelf.R2, @L2.WithSelf(%T.loc10_21.1) [symbolic = %L2.WithSelf.R2.type (constants.%L2.WithSelf.R2.type.4ee)] -// CHECK:STDOUT: %.loc14_4.2: type = fn_type_with_self_type %L2.WithSelf.R2.type, %T.loc10_21.1 [symbolic = %.loc14_4.2 (constants.%.253)] +// CHECK:STDOUT: %.loc22_4.2: type = fn_type_with_self_type %L2.WithSelf.R2.type, %T.loc10_21.1 [symbolic = %.loc22_4.2 (constants.%.253)] // CHECK:STDOUT: %L2.lookup_impl_witness: = lookup_impl_witness %T.loc10_21.1, @L2 [symbolic = %L2.lookup_impl_witness (constants.%L2.lookup_impl_witness.d84)] -// CHECK:STDOUT: %impl.elem0.loc14_4.2: @Simple5.%.loc14_4.2 (%.253) = impl_witness_access %L2.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc14_4.2 (constants.%impl.elem0)] +// CHECK:STDOUT: %impl.elem0.loc22_4.2: @Simple5.%.loc22_4.2 (%.253) = impl_witness_access %L2.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc22_4.2 (constants.%impl.elem0)] // CHECK:STDOUT: %L2.WithSelf.S2.type: type = fn_type @L2.WithSelf.S2, @L2.WithSelf(%T.loc10_21.1) [symbolic = %L2.WithSelf.S2.type (constants.%L2.WithSelf.S2.type.746)] -// CHECK:STDOUT: %.loc18_4.2: type = fn_type_with_self_type %L2.WithSelf.S2.type, %T.loc10_21.1 [symbolic = %.loc18_4.2 (constants.%.3d3)] -// CHECK:STDOUT: %impl.elem1.loc18_4.2: @Simple5.%.loc18_4.2 (%.3d3) = impl_witness_access %L2.lookup_impl_witness, element1 [symbolic = %impl.elem1.loc18_4.2 (constants.%impl.elem1)] +// CHECK:STDOUT: %.loc34_4.2: type = fn_type_with_self_type %L2.WithSelf.S2.type, %T.loc10_21.1 [symbolic = %.loc34_4.2 (constants.%.3d3)] +// CHECK:STDOUT: %impl.elem1.loc34_4.2: @Simple5.%.loc34_4.2 (%.3d3) = impl_witness_access %L2.lookup_impl_witness, element1 [symbolic = %impl.elem1.loc34_4.2 (constants.%impl.elem1)] // CHECK:STDOUT: // CHECK:STDOUT: fn() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %T.ref.loc14: %L2.type = name_ref T, %T.loc10_21.2 [symbolic = %T.loc10_21.1 (constants.%T)] -// CHECK:STDOUT: %T.as_type.loc14_4.1: type = facet_access_type %T.ref.loc14 [symbolic = %T.as_type.loc14_4.2 (constants.%T.as_type)] -// CHECK:STDOUT: %.loc14_4.1: type = converted %T.ref.loc14, %T.as_type.loc14_4.1 [symbolic = %T.as_type.loc14_4.2 (constants.%T.as_type)] +// CHECK:STDOUT: %T.ref.loc22: %L2.type = name_ref T, %T.loc10_21.2 [symbolic = %T.loc10_21.1 (constants.%T)] +// CHECK:STDOUT: %T.as_type.loc22_4.1: type = facet_access_type %T.ref.loc22 [symbolic = %T.as_type.loc22_4.2 (constants.%T.as_type)] +// CHECK:STDOUT: %.loc22_4.1: type = converted %T.ref.loc22, %T.as_type.loc22_4.1 [symbolic = %T.as_type.loc22_4.2 (constants.%T.as_type)] // CHECK:STDOUT: %R2.ref: %L2.assoc_type = name_ref R2, @L2.WithSelf.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc14_4.1: @Simple5.%.loc14_4.2 (%.253) = impl_witness_access constants.%L2.lookup_impl_witness.d84, element0 [symbolic = %impl.elem0.loc14_4.2 (constants.%impl.elem0)] -// CHECK:STDOUT: %T.ref.loc18: %L2.type = name_ref T, %T.loc10_21.2 [symbolic = %T.loc10_21.1 (constants.%T)] -// CHECK:STDOUT: %T.as_type.loc18: type = facet_access_type %T.ref.loc18 [symbolic = %T.as_type.loc14_4.2 (constants.%T.as_type)] -// CHECK:STDOUT: %.loc18_4.1: type = converted %T.ref.loc18, %T.as_type.loc18 [symbolic = %T.as_type.loc14_4.2 (constants.%T.as_type)] +// CHECK:STDOUT: %impl.elem0.loc22_4.1: @Simple5.%.loc22_4.2 (%.253) = impl_witness_access constants.%L2.lookup_impl_witness.d84, element0 [symbolic = %impl.elem0.loc22_4.2 (constants.%impl.elem0)] +// CHECK:STDOUT: %T.ref.loc34: %L2.type = name_ref T, %T.loc10_21.2 [symbolic = %T.loc10_21.1 (constants.%T)] +// CHECK:STDOUT: %T.as_type.loc34: type = facet_access_type %T.ref.loc34 [symbolic = %T.as_type.loc22_4.2 (constants.%T.as_type)] +// CHECK:STDOUT: %.loc34_4.1: type = converted %T.ref.loc34, %T.as_type.loc34 [symbolic = %T.as_type.loc22_4.2 (constants.%T.as_type)] // CHECK:STDOUT: %S2.ref: %L2.assoc_type = name_ref S2, @L2.WithSelf.%assoc1 [concrete = constants.%assoc1] -// CHECK:STDOUT: %impl.elem1.loc18_4.1: @Simple5.%.loc18_4.2 (%.3d3) = impl_witness_access constants.%L2.lookup_impl_witness.d84, element1 [symbolic = %impl.elem1.loc18_4.2 (constants.%impl.elem1)] +// CHECK:STDOUT: %impl.elem1.loc34_4.1: @Simple5.%.loc34_4.2 (%.3d3) = impl_witness_access constants.%L2.lookup_impl_witness.d84, element1 [symbolic = %impl.elem1.loc34_4.2 (constants.%impl.elem1)] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Compound5(%V.loc22_23.2: %L2.type) { -// CHECK:STDOUT: %V.patt.loc22_23.2: %pattern_type.5b3 = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc22_23.2 (constants.%V.patt)] -// CHECK:STDOUT: %V.loc22_23.1: %L2.type = symbolic_binding V, 0 [symbolic = %V.loc22_23.1 (constants.%V)] +// CHECK:STDOUT: generic fn @Compound5(%V.loc38_23.2: %L2.type) { +// CHECK:STDOUT: %V.patt.loc38_23.2: %pattern_type.5b3 = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc38_23.2 (constants.%V.patt)] +// CHECK:STDOUT: %V.loc38_23.1: %L2.type = symbolic_binding V, 0 [symbolic = %V.loc38_23.1 (constants.%V)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: // CHECK:STDOUT: fn() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %V.ref.loc25: %L2.type = name_ref V, %V.loc22_23.2 [symbolic = %V.loc22_23.1 (constants.%V)] -// CHECK:STDOUT: %L2.ref.loc25: type = name_ref L2, file.%L2.decl [concrete = constants.%L2.type] +// CHECK:STDOUT: %V.ref.loc47: %L2.type = name_ref V, %V.loc38_23.2 [symbolic = %V.loc38_23.1 (constants.%V)] +// CHECK:STDOUT: %L2.ref.loc47: type = name_ref L2, file.%L2.decl [concrete = constants.%L2.type] // CHECK:STDOUT: %R2.ref: %L2.assoc_type = name_ref R2, @L2.WithSelf.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %V.ref.loc28: %L2.type = name_ref V, %V.loc22_23.2 [symbolic = %V.loc22_23.1 (constants.%V)] -// CHECK:STDOUT: %L2.ref.loc28: type = name_ref L2, file.%L2.decl [concrete = constants.%L2.type] +// CHECK:STDOUT: %V.ref.loc56: %L2.type = name_ref V, %V.loc38_23.2 [symbolic = %V.loc38_23.1 (constants.%V)] +// CHECK:STDOUT: %L2.ref.loc56: type = name_ref L2, file.%L2.decl [concrete = constants.%L2.type] // CHECK:STDOUT: %S2.ref: %L2.assoc_type = name_ref S2, @L2.WithSelf.%assoc1 [concrete = constants.%assoc1] // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -1357,8 +1413,8 @@ fn Works() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Compound5(constants.%V) { -// CHECK:STDOUT: %V.patt.loc22_23.2 => constants.%V.patt -// CHECK:STDOUT: %V.loc22_23.1 => constants.%V +// CHECK:STDOUT: %V.patt.loc38_23.2 => constants.%V.patt +// CHECK:STDOUT: %V.loc38_23.1 => constants.%V // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_combine_non_instance.carbon @@ -1476,62 +1532,62 @@ fn Works() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Fails() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc18_5.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %C.ref.loc18: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %.loc18_5.2: ref %C = temporary_storage -// CHECK:STDOUT: %.loc18_5.3: init %C to %.loc18_5.2 = class_init () [concrete = constants.%C.val] -// CHECK:STDOUT: %.loc18_7: init %C = converted %.loc18_5.1, %.loc18_5.3 [concrete = constants.%C.val] -// CHECK:STDOUT: %A.ref.loc18_15: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %A.ref.loc18_19: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %impl.elem0.loc18: %.b4e = impl_witness_access constants.%BitAndWith.impl_witness, element0 [concrete = constants.%type.as.BitAndWith.impl.Op] -// CHECK:STDOUT: %bound_method.loc18: = bound_method %A.ref.loc18_15, %impl.elem0.loc18 [concrete = constants.%type.as.BitAndWith.impl.Op.bound] -// CHECK:STDOUT: %type.as.BitAndWith.impl.Op.call.loc18: init type = call %bound_method.loc18(%A.ref.loc18_15, %A.ref.loc18_19) [concrete = constants.%A.type] -// CHECK:STDOUT: %G.ref.loc18: %A.assoc_type = name_ref G, @A.WithSelf.%assoc0 [concrete = constants.%assoc0.050] -// CHECK:STDOUT: %.loc18_12: %A.type = converted %.loc18_7, [concrete = ] -// CHECK:STDOUT: %.loc22_6.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %C.ref.loc22_11: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %.loc22_6.2: ref %C = temporary_storage -// CHECK:STDOUT: %.loc22_6.3: init %C to %.loc22_6.2 = class_init () [concrete = constants.%C.val] -// CHECK:STDOUT: %.loc22_8: init %C = converted %.loc22_6.1, %.loc22_6.3 [concrete = constants.%C.val] -// CHECK:STDOUT: %C.ref.loc22_18: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %A.ref.loc22_24: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %A.ref.loc22_28: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %impl.elem0.loc22_26: %.b4e = impl_witness_access constants.%BitAndWith.impl_witness, element0 [concrete = constants.%type.as.BitAndWith.impl.Op] -// CHECK:STDOUT: %bound_method.loc22_26: = bound_method %A.ref.loc22_24, %impl.elem0.loc22_26 [concrete = constants.%type.as.BitAndWith.impl.Op.bound] -// CHECK:STDOUT: %type.as.BitAndWith.impl.Op.call.loc22_26: init type = call %bound_method.loc22_26(%A.ref.loc22_24, %A.ref.loc22_28) [concrete = constants.%A.type] -// CHECK:STDOUT: %.loc22_29.1: type = value_of_initializer %type.as.BitAndWith.impl.Op.call.loc22_26 [concrete = constants.%A.type] -// CHECK:STDOUT: %.loc22_29.2: type = converted %type.as.BitAndWith.impl.Op.call.loc22_26, %.loc22_29.1 [concrete = constants.%A.type] -// CHECK:STDOUT: %A.facet.loc22: %A.type = facet_value %C.ref.loc22_18, (constants.%A.impl_witness) [concrete = constants.%A.facet] -// CHECK:STDOUT: %.loc22_20: %A.type = converted %C.ref.loc22_18, %A.facet.loc22 [concrete = constants.%A.facet] -// CHECK:STDOUT: %as_type.loc22: type = facet_access_type %.loc22_20 [concrete = constants.%C] -// CHECK:STDOUT: %.loc22_30: type = converted %.loc22_20, %as_type.loc22 [concrete = constants.%C] -// CHECK:STDOUT: %A.ref.loc22_35: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %A.ref.loc22_39: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %impl.elem0.loc22_37: %.b4e = impl_witness_access constants.%BitAndWith.impl_witness, element0 [concrete = constants.%type.as.BitAndWith.impl.Op] -// CHECK:STDOUT: %bound_method.loc22_37: = bound_method %A.ref.loc22_35, %impl.elem0.loc22_37 [concrete = constants.%type.as.BitAndWith.impl.Op.bound] -// CHECK:STDOUT: %type.as.BitAndWith.impl.Op.call.loc22_37: init type = call %bound_method.loc22_37(%A.ref.loc22_35, %A.ref.loc22_39) [concrete = constants.%A.type] -// CHECK:STDOUT: %G.ref.loc22: %A.assoc_type = name_ref G, @A.WithSelf.%assoc0 [concrete = constants.%assoc0.050] -// CHECK:STDOUT: %.loc22_32: %A.type = converted %.loc22_8, [concrete = ] -// CHECK:STDOUT: %.loc26_6.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %C.ref.loc26_11: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %.loc26_6.2: ref %C = temporary_storage -// CHECK:STDOUT: %.loc26_6.3: init %C to %.loc26_6.2 = class_init () [concrete = constants.%C.val] -// CHECK:STDOUT: %.loc26_8: init %C = converted %.loc26_6.1, %.loc26_6.3 [concrete = constants.%C.val] -// CHECK:STDOUT: %C.ref.loc26_18: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %A.ref.loc26_24: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %A.ref.loc26_28: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %impl.elem0.loc26: %.b4e = impl_witness_access constants.%BitAndWith.impl_witness, element0 [concrete = constants.%type.as.BitAndWith.impl.Op] -// CHECK:STDOUT: %bound_method.loc26: = bound_method %A.ref.loc26_24, %impl.elem0.loc26 [concrete = constants.%type.as.BitAndWith.impl.Op.bound] -// CHECK:STDOUT: %type.as.BitAndWith.impl.Op.call.loc26: init type = call %bound_method.loc26(%A.ref.loc26_24, %A.ref.loc26_28) [concrete = constants.%A.type] -// CHECK:STDOUT: %.loc26_29.1: type = value_of_initializer %type.as.BitAndWith.impl.Op.call.loc26 [concrete = constants.%A.type] -// CHECK:STDOUT: %.loc26_29.2: type = converted %type.as.BitAndWith.impl.Op.call.loc26, %.loc26_29.1 [concrete = constants.%A.type] -// CHECK:STDOUT: %A.facet.loc26: %A.type = facet_value %C.ref.loc26_18, (constants.%A.impl_witness) [concrete = constants.%A.facet] -// CHECK:STDOUT: %.loc26_20: %A.type = converted %C.ref.loc26_18, %A.facet.loc26 [concrete = constants.%A.facet] -// CHECK:STDOUT: %as_type.loc26: type = facet_access_type %.loc26_20 [concrete = constants.%C] -// CHECK:STDOUT: %.loc26_30: type = converted %.loc26_20, %as_type.loc26 [concrete = constants.%C] -// CHECK:STDOUT: %A.ref.loc26_34: type = name_ref A, file.%A.decl [concrete = constants.%A.type] -// CHECK:STDOUT: %G.ref.loc26: %A.assoc_type = name_ref G, @A.WithSelf.%assoc0 [concrete = constants.%assoc0.050] -// CHECK:STDOUT: %.loc26_32: %A.type = converted %.loc26_8, [concrete = ] +// CHECK:STDOUT: %.loc25_5.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %C.ref.loc25: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %.loc25_5.2: ref %C = temporary_storage +// CHECK:STDOUT: %.loc25_5.3: init %C to %.loc25_5.2 = class_init () [concrete = constants.%C.val] +// CHECK:STDOUT: %.loc25_7: init %C = converted %.loc25_5.1, %.loc25_5.3 [concrete = constants.%C.val] +// CHECK:STDOUT: %A.ref.loc25_15: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %A.ref.loc25_19: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %impl.elem0.loc25: %.b4e = impl_witness_access constants.%BitAndWith.impl_witness, element0 [concrete = constants.%type.as.BitAndWith.impl.Op] +// CHECK:STDOUT: %bound_method.loc25: = bound_method %A.ref.loc25_15, %impl.elem0.loc25 [concrete = constants.%type.as.BitAndWith.impl.Op.bound] +// CHECK:STDOUT: %type.as.BitAndWith.impl.Op.call.loc25: init type = call %bound_method.loc25(%A.ref.loc25_15, %A.ref.loc25_19) [concrete = constants.%A.type] +// CHECK:STDOUT: %G.ref.loc25: %A.assoc_type = name_ref G, @A.WithSelf.%assoc0 [concrete = constants.%assoc0.050] +// CHECK:STDOUT: %.loc25_12: %A.type = converted %.loc25_7, [concrete = ] +// CHECK:STDOUT: %.loc36_6.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %C.ref.loc36_11: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %.loc36_6.2: ref %C = temporary_storage +// CHECK:STDOUT: %.loc36_6.3: init %C to %.loc36_6.2 = class_init () [concrete = constants.%C.val] +// CHECK:STDOUT: %.loc36_8: init %C = converted %.loc36_6.1, %.loc36_6.3 [concrete = constants.%C.val] +// CHECK:STDOUT: %C.ref.loc36_18: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %A.ref.loc36_24: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %A.ref.loc36_28: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %impl.elem0.loc36_26: %.b4e = impl_witness_access constants.%BitAndWith.impl_witness, element0 [concrete = constants.%type.as.BitAndWith.impl.Op] +// CHECK:STDOUT: %bound_method.loc36_26: = bound_method %A.ref.loc36_24, %impl.elem0.loc36_26 [concrete = constants.%type.as.BitAndWith.impl.Op.bound] +// CHECK:STDOUT: %type.as.BitAndWith.impl.Op.call.loc36_26: init type = call %bound_method.loc36_26(%A.ref.loc36_24, %A.ref.loc36_28) [concrete = constants.%A.type] +// CHECK:STDOUT: %.loc36_29.1: type = value_of_initializer %type.as.BitAndWith.impl.Op.call.loc36_26 [concrete = constants.%A.type] +// CHECK:STDOUT: %.loc36_29.2: type = converted %type.as.BitAndWith.impl.Op.call.loc36_26, %.loc36_29.1 [concrete = constants.%A.type] +// CHECK:STDOUT: %A.facet.loc36: %A.type = facet_value %C.ref.loc36_18, (constants.%A.impl_witness) [concrete = constants.%A.facet] +// CHECK:STDOUT: %.loc36_20: %A.type = converted %C.ref.loc36_18, %A.facet.loc36 [concrete = constants.%A.facet] +// CHECK:STDOUT: %as_type.loc36: type = facet_access_type %.loc36_20 [concrete = constants.%C] +// CHECK:STDOUT: %.loc36_30: type = converted %.loc36_20, %as_type.loc36 [concrete = constants.%C] +// CHECK:STDOUT: %A.ref.loc36_35: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %A.ref.loc36_39: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %impl.elem0.loc36_37: %.b4e = impl_witness_access constants.%BitAndWith.impl_witness, element0 [concrete = constants.%type.as.BitAndWith.impl.Op] +// CHECK:STDOUT: %bound_method.loc36_37: = bound_method %A.ref.loc36_35, %impl.elem0.loc36_37 [concrete = constants.%type.as.BitAndWith.impl.Op.bound] +// CHECK:STDOUT: %type.as.BitAndWith.impl.Op.call.loc36_37: init type = call %bound_method.loc36_37(%A.ref.loc36_35, %A.ref.loc36_39) [concrete = constants.%A.type] +// CHECK:STDOUT: %G.ref.loc36: %A.assoc_type = name_ref G, @A.WithSelf.%assoc0 [concrete = constants.%assoc0.050] +// CHECK:STDOUT: %.loc36_32: %A.type = converted %.loc36_8, [concrete = ] +// CHECK:STDOUT: %.loc47_6.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %C.ref.loc47_11: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %.loc47_6.2: ref %C = temporary_storage +// CHECK:STDOUT: %.loc47_6.3: init %C to %.loc47_6.2 = class_init () [concrete = constants.%C.val] +// CHECK:STDOUT: %.loc47_8: init %C = converted %.loc47_6.1, %.loc47_6.3 [concrete = constants.%C.val] +// CHECK:STDOUT: %C.ref.loc47_18: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %A.ref.loc47_24: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %A.ref.loc47_28: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %impl.elem0.loc47: %.b4e = impl_witness_access constants.%BitAndWith.impl_witness, element0 [concrete = constants.%type.as.BitAndWith.impl.Op] +// CHECK:STDOUT: %bound_method.loc47: = bound_method %A.ref.loc47_24, %impl.elem0.loc47 [concrete = constants.%type.as.BitAndWith.impl.Op.bound] +// CHECK:STDOUT: %type.as.BitAndWith.impl.Op.call.loc47: init type = call %bound_method.loc47(%A.ref.loc47_24, %A.ref.loc47_28) [concrete = constants.%A.type] +// CHECK:STDOUT: %.loc47_29.1: type = value_of_initializer %type.as.BitAndWith.impl.Op.call.loc47 [concrete = constants.%A.type] +// CHECK:STDOUT: %.loc47_29.2: type = converted %type.as.BitAndWith.impl.Op.call.loc47, %.loc47_29.1 [concrete = constants.%A.type] +// CHECK:STDOUT: %A.facet.loc47: %A.type = facet_value %C.ref.loc47_18, (constants.%A.impl_witness) [concrete = constants.%A.facet] +// CHECK:STDOUT: %.loc47_20: %A.type = converted %C.ref.loc47_18, %A.facet.loc47 [concrete = constants.%A.facet] +// CHECK:STDOUT: %as_type.loc47: type = facet_access_type %.loc47_20 [concrete = constants.%C] +// CHECK:STDOUT: %.loc47_30: type = converted %.loc47_20, %as_type.loc47 [concrete = constants.%C] +// CHECK:STDOUT: %A.ref.loc47_34: type = name_ref A, file.%A.decl [concrete = constants.%A.type] +// CHECK:STDOUT: %G.ref.loc47: %A.assoc_type = name_ref G, @A.WithSelf.%assoc0 [concrete = constants.%assoc0.050] +// CHECK:STDOUT: %.loc47_32: %A.type = converted %.loc47_8, [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/fail_add_member_outside_definition.carbon b/toolchain/check/testdata/interface/fail_add_member_outside_definition.carbon index b8f23e45baee..3e8951384b15 100644 --- a/toolchain/check/testdata/interface/fail_add_member_outside_definition.carbon +++ b/toolchain/check/testdata/interface/fail_add_member_outside_definition.carbon @@ -14,18 +14,34 @@ interface Interface { } -// CHECK:STDERR: fail_add_member_outside_definition.carbon:[[@LINE+2]]:14: error: out-of-line declaration requires a declaration in scoped entity [QualifiedDeclOutsideScopeEntity] +// CHECK:STDERR: ╭─┤ fail_add_member_outside_definition.carbon:[[@LINE+8]]:14 +// CHECK:STDERR: -> │ fn Interface.F() {} +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: out-of-line declaration requires a declaration in +// CHECK:STDERR: · ┃ scoped entity +// CHECK:STDERR: · ┃ [QualifiedDeclOutsideScopeEntity] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Interface.F() {} // Nesting interfaces like this is not valid, but make sure we don't crash. interface Outer { interface Inner { - // CHECK:STDERR: fail_add_member_outside_definition.carbon:[[@LINE+2]]:8-12: error: name `Outer` not found [NameNotFound] + // CHECK:STDERR: ╭─┤ fail_add_member_outside_definition.carbon:[[@LINE+6]]:8 + // CHECK:STDERR: -> │ fn Outer.F(); + // CHECK:STDERR: · ━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: name `Outer` not found [NameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn Outer.F(); } - // CHECK:STDERR: fail_add_member_outside_definition.carbon:[[@LINE+2]]:12: error: out-of-line declaration requires a declaration in scoped entity [QualifiedDeclOutsideScopeEntity] + // CHECK:STDERR: ╭─┤ fail_add_member_outside_definition.carbon:[[@LINE+8]]:12 + // CHECK:STDERR: -> │ fn Inner.F(); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: out-of-line declaration requires a declaration in scoped + // CHECK:STDERR: · ┃ entity + // CHECK:STDERR: · ┃ [QualifiedDeclOutsideScopeEntity] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn Inner.F(); } @@ -42,9 +58,9 @@ interface Outer { // CHECK:STDOUT: %Self.a58: %Outer.type = symbolic_binding Self, 0 [symbolic] // CHECK:STDOUT: %Inner.type: type = facet_type <@Inner, @Inner(%Self.a58)> [symbolic] // CHECK:STDOUT: %Self.4ae: %Inner.type = symbolic_binding Self, 1 [symbolic] -// CHECK:STDOUT: %Inner.WithSelf.F.type.3f066d.1: type = fn_type @Inner.WithSelf.F.loc26, @Inner.WithSelf(%Self.a58, %Self.4ae) [symbolic] +// CHECK:STDOUT: %Inner.WithSelf.F.type.3f066d.1: type = fn_type @Inner.WithSelf.F.loc36, @Inner.WithSelf(%Self.a58, %Self.4ae) [symbolic] // CHECK:STDOUT: %Inner.WithSelf.F.3cb3ec.1: %Inner.WithSelf.F.type.3f066d.1 = struct_value () [symbolic] -// CHECK:STDOUT: %Inner.WithSelf.F.type.3f066d.2: type = fn_type @Inner.WithSelf.F.loc30, @Inner.WithSelf(%Self.a58, %Self.4ae) [symbolic] +// CHECK:STDOUT: %Inner.WithSelf.F.type.3f066d.2: type = fn_type @Inner.WithSelf.F.loc46, @Inner.WithSelf(%Self.a58, %Self.4ae) [symbolic] // CHECK:STDOUT: %Inner.WithSelf.F.3cb3ec.2: %Inner.WithSelf.F.type.3f066d.2 = struct_value () [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -76,7 +92,7 @@ interface Outer { // CHECK:STDOUT: // CHECK:STDOUT: !with Self: // CHECK:STDOUT: %Inner.decl: type = interface_decl @Inner [symbolic = @Outer.WithSelf.%Inner.type (constants.%Inner.type)] {} {} -// CHECK:STDOUT: %Inner.WithSelf.F.decl: @Outer.WithSelf.%Inner.WithSelf.F.type (%Inner.WithSelf.F.type.3f066d.2) = fn_decl @Inner.WithSelf.F.loc30 [symbolic = @Outer.WithSelf.%Inner.WithSelf.F (constants.%Inner.WithSelf.F.3cb3ec.2)] {} {} +// CHECK:STDOUT: %Inner.WithSelf.F.decl: @Outer.WithSelf.%Inner.WithSelf.F.type (%Inner.WithSelf.F.type.3f066d.2) = fn_decl @Inner.WithSelf.F.loc46 [symbolic = @Outer.WithSelf.%Inner.WithSelf.F (constants.%Inner.WithSelf.F.3cb3ec.2)] {} {} // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self @@ -88,19 +104,19 @@ interface Outer { // CHECK:STDOUT: // CHECK:STDOUT: generic interface @Inner(@Outer.%Self: %Outer.type) { // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Self.loc23_19.2: %Outer.type = symbolic_binding Self, 0 [symbolic = %Self.loc23_19.2 (constants.%Self.a58)] -// CHECK:STDOUT: %Inner.type: type = facet_type <@Inner, @Inner(%Self.loc23_19.2)> [symbolic = %Inner.type (constants.%Inner.type)] -// CHECK:STDOUT: %Self.loc23_19.3: @Inner.%Inner.type (%Inner.type) = symbolic_binding Self, 1 [symbolic = %Self.loc23_19.3 (constants.%Self.4ae)] +// CHECK:STDOUT: %Self.loc29_19.2: %Outer.type = symbolic_binding Self, 0 [symbolic = %Self.loc29_19.2 (constants.%Self.a58)] +// CHECK:STDOUT: %Inner.type: type = facet_type <@Inner, @Inner(%Self.loc29_19.2)> [symbolic = %Inner.type (constants.%Inner.type)] +// CHECK:STDOUT: %Self.loc29_19.3: @Inner.%Inner.type (%Inner.type) = symbolic_binding Self, 1 [symbolic = %Self.loc29_19.3 (constants.%Self.4ae)] // CHECK:STDOUT: // CHECK:STDOUT: interface { -// CHECK:STDOUT: %Self.loc23_19.1: @Inner.%Inner.type (%Inner.type) = symbolic_binding Self, 1 [symbolic = %Self.loc23_19.3 (constants.%Self.4ae)] +// CHECK:STDOUT: %Self.loc29_19.1: @Inner.%Inner.type (%Inner.type) = symbolic_binding Self, 1 [symbolic = %Self.loc29_19.3 (constants.%Self.4ae)] // CHECK:STDOUT: %Inner.WithSelf.decl = interface_with_self_decl @Inner [concrete] // CHECK:STDOUT: // CHECK:STDOUT: !with Self: -// CHECK:STDOUT: %Inner.WithSelf.F.decl: @Inner.WithSelf.%Inner.WithSelf.F.type (%Inner.WithSelf.F.type.3f066d.1) = fn_decl @Inner.WithSelf.F.loc26 [symbolic = @Inner.WithSelf.%Inner.WithSelf.F (constants.%Inner.WithSelf.F.3cb3ec.1)] {} {} +// CHECK:STDOUT: %Inner.WithSelf.F.decl: @Inner.WithSelf.%Inner.WithSelf.F.type (%Inner.WithSelf.F.type.3f066d.1) = fn_decl @Inner.WithSelf.F.loc36 [symbolic = @Inner.WithSelf.%Inner.WithSelf.F (constants.%Inner.WithSelf.F.3cb3ec.1)] {} {} // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.loc23_19.1 +// CHECK:STDOUT: .Self = %Self.loc29_19.1 // CHECK:STDOUT: .F = @Outer.WithSelf.%Inner.WithSelf.F.decl // CHECK:STDOUT: witness = () // CHECK:STDOUT: @@ -117,11 +133,11 @@ interface Outer { // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Inner.WithSelf.F.loc26(@Outer.%Self: %Outer.type, @Inner.%Self.loc23_19.1: @Inner.%Inner.type (%Inner.type)) { +// CHECK:STDOUT: generic fn @Inner.WithSelf.F.loc36(@Outer.%Self: %Outer.type, @Inner.%Self.loc29_19.1: @Inner.%Inner.type (%Inner.type)) { // CHECK:STDOUT: fn(); // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Inner.WithSelf.F.loc30(@Outer.%Self: %Outer.type, @Inner.%Self.loc23_19.1: @Inner.%Inner.type (%Inner.type)) { +// CHECK:STDOUT: generic fn @Inner.WithSelf.F.loc46(@Outer.%Self: %Outer.type, @Inner.%Self.loc29_19.1: @Inner.%Inner.type (%Inner.type)) { // CHECK:STDOUT: fn(); // CHECK:STDOUT: } // CHECK:STDOUT: @@ -133,14 +149,14 @@ interface Outer { // CHECK:STDOUT: // CHECK:STDOUT: specific @Inner(constants.%Self.a58) { // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Self.loc23_19.2 => constants.%Self.a58 +// CHECK:STDOUT: %Self.loc29_19.2 => constants.%Self.a58 // CHECK:STDOUT: %Inner.type => constants.%Inner.type -// CHECK:STDOUT: %Self.loc23_19.3 => constants.%Self.4ae +// CHECK:STDOUT: %Self.loc29_19.3 => constants.%Self.4ae // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Inner.WithSelf(constants.%Self.a58, constants.%Self.4ae) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @Inner.WithSelf.F.loc26(constants.%Self.a58, constants.%Self.4ae) {} +// CHECK:STDOUT: specific @Inner.WithSelf.F.loc36(constants.%Self.a58, constants.%Self.4ae) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @Inner.WithSelf.F.loc30(constants.%Self.a58, constants.%Self.4ae) {} +// CHECK:STDOUT: specific @Inner.WithSelf.F.loc46(constants.%Self.a58, constants.%Self.4ae) {} // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/fail_assoc_const_alias.carbon b/toolchain/check/testdata/interface/fail_assoc_const_alias.carbon index fb1697a04337..8374774d6a4c 100644 --- a/toolchain/check/testdata/interface/fail_assoc_const_alias.carbon +++ b/toolchain/check/testdata/interface/fail_assoc_const_alias.carbon @@ -19,7 +19,13 @@ interface I { interface J { alias U = I.T; - // CHECK:STDERR: fail_alias_to_different_interface.carbon:[[@LINE+2]]:13: error: cannot convert type `Self` that implements `J` into type implementing `I` [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╭─┤ fail_alias_to_different_interface.carbon:[[@LINE+8]]:13 + // CHECK:STDERR: -> │ fn F() -> U; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `Self` that implements `J` into type + // CHECK:STDERR: · ┃ implementing `I` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn F() -> U; } @@ -50,7 +56,13 @@ interface A { } interface B { alias F = A.F; - // CHECK:STDERR: fail_call_method_alias.carbon:[[@LINE+2]]:13: error: cannot convert type `Self` that implements `B` into type implementing `A` [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╭─┤ fail_call_method_alias.carbon:[[@LINE+8]]:13 + // CHECK:STDERR: -> │ fn G() -> F(); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `Self` that implements `B` into type + // CHECK:STDERR: · ┃ implementing `A` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn G() -> F(); } diff --git a/toolchain/check/testdata/interface/fail_assoc_const_bad_default.carbon b/toolchain/check/testdata/interface/fail_assoc_const_bad_default.carbon index 18fd37ad95ef..126eeb64411d 100644 --- a/toolchain/check/testdata/interface/fail_assoc_const_bad_default.carbon +++ b/toolchain/check/testdata/interface/fail_assoc_const_bad_default.carbon @@ -13,8 +13,16 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/fail_assoc_const_bad_default.carbon interface I { - // CHECK:STDERR: fail_assoc_const_bad_default.carbon:[[@LINE+3]]:3-19: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet] - // CHECK:STDERR: fail_assoc_const_bad_default.carbon:[[@LINE+2]]:3-19: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_assoc_const_bad_default.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: -> │ let T: type = 42; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert non-type value of type `Core.IntLiteral` + // CHECK:STDERR: · │ ┃ to `type` + // CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: · ╰────┤ type `Core.IntLiteral` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(type)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let T: type = 42; } @@ -58,7 +66,7 @@ interface I { // CHECK:STDOUT: %T: type = assoc_const_decl @T [concrete] { // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.WithSelf.%T [concrete = constants.%assoc0.2ce] // CHECK:STDOUT: %int_42: Core.IntLiteral = int_value 42 [concrete = constants.%int_42] -// CHECK:STDOUT: %.loc19: type = converted %int_42, [concrete = ] +// CHECK:STDOUT: %.loc27: type = converted %int_42, [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: diff --git a/toolchain/check/testdata/interface/fail_assoc_fn_invalid_use.carbon b/toolchain/check/testdata/interface/fail_assoc_fn_invalid_use.carbon index 64b01bad8a6a..f268d4f5c53e 100644 --- a/toolchain/check/testdata/interface/fail_assoc_fn_invalid_use.carbon +++ b/toolchain/check/testdata/interface/fail_assoc_fn_invalid_use.carbon @@ -21,7 +21,12 @@ interface I { } fn Use(generic T: I) { - // CHECK:STDERR: fail_member_access.carbon:[[@LINE+2]]:3-12: error: type `` does not support qualified expressions [QualifiedExprUnsupported] + // CHECK:STDERR: ╭─┤ fail_member_access.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ T.F.member; + // CHECK:STDERR: · ━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: type `` does not support qualified expressions + // CHECK:STDERR: · ┃ [QualifiedExprUnsupported] + // CHECK:STDERR: ╰──── // CHECK:STDERR: T.F.member; } @@ -115,20 +120,20 @@ fn Use(generic T: I) { // CHECK:STDOUT: %T.loc8_17.1: %I.type = symbolic_binding T, 0 [symbolic = %T.loc8_17.1 (constants.%T)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %T.as_type.loc11_4.2: type = facet_access_type %T.loc8_17.1 [symbolic = %T.as_type.loc11_4.2 (constants.%T.as_type)] +// CHECK:STDOUT: %T.as_type.loc16_4.2: type = facet_access_type %T.loc8_17.1 [symbolic = %T.as_type.loc16_4.2 (constants.%T.as_type)] // CHECK:STDOUT: %I.WithSelf.F.type: type = fn_type @I.WithSelf.F, @I.WithSelf(%T.loc8_17.1) [symbolic = %I.WithSelf.F.type (constants.%I.WithSelf.F.type.eae)] -// CHECK:STDOUT: %.loc11_4.2: type = fn_type_with_self_type %I.WithSelf.F.type, %T.loc8_17.1 [symbolic = %.loc11_4.2 (constants.%.b94)] +// CHECK:STDOUT: %.loc16_4.2: type = fn_type_with_self_type %I.WithSelf.F.type, %T.loc8_17.1 [symbolic = %.loc16_4.2 (constants.%.b94)] // CHECK:STDOUT: %I.lookup_impl_witness: = lookup_impl_witness %T.loc8_17.1, @I [symbolic = %I.lookup_impl_witness (constants.%I.lookup_impl_witness)] -// CHECK:STDOUT: %impl.elem0.loc11_4.2: @Use.%.loc11_4.2 (%.b94) = impl_witness_access %I.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc11_4.2 (constants.%impl.elem0)] -// CHECK:STDOUT: %require_complete: = require_complete_type %.loc11_4.2 [symbolic = %require_complete (constants.%require_complete)] +// CHECK:STDOUT: %impl.elem0.loc16_4.2: @Use.%.loc16_4.2 (%.b94) = impl_witness_access %I.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc16_4.2 (constants.%impl.elem0)] +// CHECK:STDOUT: %require_complete: = require_complete_type %.loc16_4.2 [symbolic = %require_complete (constants.%require_complete)] // CHECK:STDOUT: // CHECK:STDOUT: fn() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %T.ref: %I.type = name_ref T, %T.loc8_17.2 [symbolic = %T.loc8_17.1 (constants.%T)] -// CHECK:STDOUT: %T.as_type.loc11_4.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc11_4.2 (constants.%T.as_type)] -// CHECK:STDOUT: %.loc11_4.1: type = converted %T.ref, %T.as_type.loc11_4.1 [symbolic = %T.as_type.loc11_4.2 (constants.%T.as_type)] +// CHECK:STDOUT: %T.as_type.loc16_4.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc16_4.2 (constants.%T.as_type)] +// CHECK:STDOUT: %.loc16_4.1: type = converted %T.ref, %T.as_type.loc16_4.1 [symbolic = %T.as_type.loc16_4.2 (constants.%T.as_type)] // CHECK:STDOUT: %F.ref: %I.assoc_type = name_ref F, @I.WithSelf.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc11_4.1: @Use.%.loc11_4.2 (%.b94) = impl_witness_access constants.%I.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc11_4.2 (constants.%impl.elem0)] +// CHECK:STDOUT: %impl.elem0.loc16_4.1: @Use.%.loc16_4.2 (%.b94) = impl_witness_access constants.%I.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc16_4.2 (constants.%impl.elem0)] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/interface/fail_definition_imported.carbon b/toolchain/check/testdata/interface/fail_definition_imported.carbon index 4734707086e5..e8ee0a9c289d 100644 --- a/toolchain/check/testdata/interface/fail_definition_imported.carbon +++ b/toolchain/check/testdata/interface/fail_definition_imported.carbon @@ -24,8 +24,16 @@ library "[[@TEST_NAME]]"; import library "a"; // TODO: Replace this diagnostic with one that better describes the error, such as 'DeclaredInMultipleLibraries'. -// CHECK:STDERR: fail_b.carbon:[[@LINE+3]]:1-13: error: redeclaration of `interface I` is redundant [RedeclRedundant] -// CHECK:STDERR: a.carbon:4:1-12: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_b.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: -> │ interface I {} +// CHECK:STDERR: · ━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of `interface I` is redundant [RedeclRedundant] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ a.carbon +// CHECK:STDERR: │ interface I; +// CHECK:STDERR: · ──────┬───── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: interface I {} diff --git a/toolchain/check/testdata/interface/fail_duplicate.carbon b/toolchain/check/testdata/interface/fail_duplicate.carbon index abef5924bf62..5072bd316d6d 100644 --- a/toolchain/check/testdata/interface/fail_duplicate.carbon +++ b/toolchain/check/testdata/interface/fail_duplicate.carbon @@ -18,8 +18,15 @@ library "[[@TEST_NAME]]"; interface Interface { } -// CHECK:STDERR: fail_redefine_without_dependents.carbon:[[@LINE+3]]:1-21: error: redefinition of `interface Interface` [RedeclRedef] -// CHECK:STDERR: fail_redefine_without_dependents.carbon:[[@LINE-3]]:1-21: note: previously defined here [RedeclPrevDef] +// CHECK:STDERR: ╭─┤ fail_redefine_without_dependents.carbon:[[@LINE+10]]:1 +// CHECK:STDERR: │ interface Interface { } +// CHECK:STDERR: · ──────────┬────────── +// CHECK:STDERR: · ╰──┤ previously defined here [RedeclPrevDef] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ interface Interface { +// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redefinition of `interface Interface` [RedeclRedef] +// CHECK:STDERR: ╰──── // CHECK:STDERR: interface Interface { fn F(); @@ -31,8 +38,15 @@ library "[[@TEST_NAME]]"; interface Interface {} -// CHECK:STDERR: fail_redefine_with_dependents.carbon:[[@LINE+3]]:1-21: error: redefinition of `interface Interface` [RedeclRedef] -// CHECK:STDERR: fail_redefine_with_dependents.carbon:[[@LINE-3]]:1-21: note: previously defined here [RedeclPrevDef] +// CHECK:STDERR: ╭─┤ fail_redefine_with_dependents.carbon:[[@LINE+10]]:1 +// CHECK:STDERR: │ interface Interface {} +// CHECK:STDERR: · ──────────┬────────── +// CHECK:STDERR: · ╰──┤ previously defined here [RedeclPrevDef] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ interface Interface { +// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redefinition of `interface Interface` [RedeclRedef] +// CHECK:STDERR: ╰──── // CHECK:STDERR: interface Interface { fn F(self); @@ -44,8 +58,16 @@ library "[[@TEST_NAME]]"; fn Function(); -// CHECK:STDERR: fail_name_conflict_with_fn.carbon:[[@LINE+3]]:11-18: error: duplicate name `Function` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: fail_name_conflict_with_fn.carbon:[[@LINE-3]]:1-14: note: name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╭─┤ fail_name_conflict_with_fn.carbon:[[@LINE+11]]:11 +// CHECK:STDERR: │ fn Function(); +// CHECK:STDERR: · ───────┬────── +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ interface Function; +// CHECK:STDERR: · ┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `Function` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ╰──── // CHECK:STDERR: interface Function; @@ -53,8 +75,16 @@ interface Function; class Class; -// CHECK:STDERR: fail_name_conflict_with_class.carbon:[[@LINE+3]]:11-15: error: duplicate name `Class` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: fail_name_conflict_with_class.carbon:[[@LINE-3]]:1-12: note: name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╭─┤ fail_name_conflict_with_class.carbon:[[@LINE+11]]:11 +// CHECK:STDERR: │ class Class; +// CHECK:STDERR: · ──────┬───── +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ interface Class { } +// CHECK:STDERR: · ━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `Class` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ╰──── // CHECK:STDERR: interface Class { } @@ -65,12 +95,12 @@ interface Class { } // CHECK:STDOUT: type: type = facet_type [concrete] // CHECK:STDOUT: %Interface.type.283524.1: type = facet_type <@Interface.loc4> [concrete] // CHECK:STDOUT: %Self.3ce02d.1: %Interface.type.283524.1 = symbolic_binding Self, 0 [symbolic] -// CHECK:STDOUT: %Interface.type.283524.2: type = facet_type <@Interface.loc9> [concrete] +// CHECK:STDOUT: %Interface.type.283524.2: type = facet_type <@Interface.loc16> [concrete] // CHECK:STDOUT: %Self.3ce02d.2: %Interface.type.283524.2 = symbolic_binding Self, 0 [symbolic] -// CHECK:STDOUT: %Interface.WithSelf.F.type: type = fn_type @Interface.WithSelf.F, @Interface.WithSelf.loc9(%Self.3ce02d.2) [symbolic] +// CHECK:STDOUT: %Interface.WithSelf.F.type: type = fn_type @Interface.WithSelf.F, @Interface.WithSelf.loc16(%Self.3ce02d.2) [symbolic] // CHECK:STDOUT: %Interface.WithSelf.F: %Interface.WithSelf.F.type = struct_value () [symbolic] -// CHECK:STDOUT: %Interface.assoc_type: type = assoc_entity_type @Interface.loc9 [concrete] -// CHECK:STDOUT: %assoc0: %Interface.assoc_type = assoc_entity element0, @Interface.WithSelf.loc9.%Interface.WithSelf.F.decl [concrete] +// CHECK:STDOUT: %Interface.assoc_type: type = assoc_entity_type @Interface.loc16 [concrete] +// CHECK:STDOUT: %assoc0: %Interface.assoc_type = assoc_entity element0, @Interface.WithSelf.loc16.%Interface.WithSelf.F.decl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -78,7 +108,7 @@ interface Class { } // CHECK:STDOUT: .Interface = %Interface.decl.loc4 // CHECK:STDOUT: } // CHECK:STDOUT: %Interface.decl.loc4: type = interface_decl @Interface.loc4 [concrete = constants.%Interface.type.283524.1] {} {} -// CHECK:STDOUT: %Interface.decl.loc9: type = interface_decl @Interface.loc9 [concrete = constants.%Interface.type.283524.2] {} {} +// CHECK:STDOUT: %Interface.decl.loc16: type = interface_decl @Interface.loc16 [concrete = constants.%Interface.type.283524.2] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Interface.loc4 { @@ -92,29 +122,29 @@ interface Class { } // CHECK:STDOUT: !requires: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: interface @Interface.loc9 { +// CHECK:STDOUT: interface @Interface.loc16 { // CHECK:STDOUT: %Self: %Interface.type.283524.2 = symbolic_binding Self, 0 [symbolic = constants.%Self.3ce02d.2] -// CHECK:STDOUT: %Interface.WithSelf.decl = interface_with_self_decl @Interface.loc9 [concrete] +// CHECK:STDOUT: %Interface.WithSelf.decl = interface_with_self_decl @Interface.loc16 [concrete] // CHECK:STDOUT: // CHECK:STDOUT: !with Self: -// CHECK:STDOUT: %Interface.WithSelf.F.decl: @Interface.WithSelf.loc9.%Interface.WithSelf.F.type (%Interface.WithSelf.F.type) = fn_decl @Interface.WithSelf.F [symbolic = @Interface.WithSelf.loc9.%Interface.WithSelf.F (constants.%Interface.WithSelf.F)] {} {} +// CHECK:STDOUT: %Interface.WithSelf.F.decl: @Interface.WithSelf.loc16.%Interface.WithSelf.F.type (%Interface.WithSelf.F.type) = fn_decl @Interface.WithSelf.F [symbolic = @Interface.WithSelf.loc16.%Interface.WithSelf.F (constants.%Interface.WithSelf.F)] {} {} // CHECK:STDOUT: %assoc0: %Interface.assoc_type = assoc_entity element0, %Interface.WithSelf.F.decl [concrete = constants.%assoc0] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .F = @Interface.WithSelf.loc9.%assoc0 -// CHECK:STDOUT: witness = (@Interface.WithSelf.loc9.%Interface.WithSelf.F.decl) +// CHECK:STDOUT: .F = @Interface.WithSelf.loc16.%assoc0 +// CHECK:STDOUT: witness = (@Interface.WithSelf.loc16.%Interface.WithSelf.F.decl) // CHECK:STDOUT: // CHECK:STDOUT: !requires: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Interface.WithSelf.F(@Interface.loc9.%Self: %Interface.type.283524.2) { +// CHECK:STDOUT: generic fn @Interface.WithSelf.F(@Interface.loc16.%Self: %Interface.type.283524.2) { // CHECK:STDOUT: fn(); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Interface.WithSelf.loc4(constants.%Self.3ce02d.1) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @Interface.WithSelf.loc9(constants.%Self.3ce02d.2) {} +// CHECK:STDOUT: specific @Interface.WithSelf.loc16(constants.%Self.3ce02d.2) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @Interface.WithSelf.F(constants.%Self.3ce02d.2) {} // CHECK:STDOUT: @@ -124,16 +154,16 @@ interface Class { } // CHECK:STDOUT: type: type = facet_type [concrete] // CHECK:STDOUT: %Interface.type.283524.1: type = facet_type <@Interface.loc4> [concrete] // CHECK:STDOUT: %Self.3ce02d.1: %Interface.type.283524.1 = symbolic_binding Self, 0 [symbolic] -// CHECK:STDOUT: %Interface.type.283524.2: type = facet_type <@Interface.loc9> [concrete] +// CHECK:STDOUT: %Interface.type.283524.2: type = facet_type <@Interface.loc16> [concrete] // CHECK:STDOUT: %Self.3ce02d.2: %Interface.type.283524.2 = symbolic_binding Self, 0 [symbolic] // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.3ce02d.2 [symbolic] // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type [symbolic] // CHECK:STDOUT: %self.param_patt: %pattern_type = value_param_pattern [symbolic] // CHECK:STDOUT: %self.patt: %pattern_type = wrapper_binding_pattern self, %self.param_patt [symbolic] -// CHECK:STDOUT: %Interface.WithSelf.F.type: type = fn_type @Interface.WithSelf.F, @Interface.WithSelf.loc9(%Self.3ce02d.2) [symbolic] +// CHECK:STDOUT: %Interface.WithSelf.F.type: type = fn_type @Interface.WithSelf.F, @Interface.WithSelf.loc16(%Self.3ce02d.2) [symbolic] // CHECK:STDOUT: %Interface.WithSelf.F: %Interface.WithSelf.F.type = struct_value () [symbolic] -// CHECK:STDOUT: %Interface.assoc_type: type = assoc_entity_type @Interface.loc9 [concrete] -// CHECK:STDOUT: %assoc0: %Interface.assoc_type = assoc_entity element0, @Interface.WithSelf.loc9.%Interface.WithSelf.F.decl [concrete] +// CHECK:STDOUT: %Interface.assoc_type: type = assoc_entity_type @Interface.loc16 [concrete] +// CHECK:STDOUT: %assoc0: %Interface.assoc_type = assoc_entity element0, @Interface.WithSelf.loc16.%Interface.WithSelf.F.decl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -141,7 +171,7 @@ interface Class { } // CHECK:STDOUT: .Interface = %Interface.decl.loc4 // CHECK:STDOUT: } // CHECK:STDOUT: %Interface.decl.loc4: type = interface_decl @Interface.loc4 [concrete = constants.%Interface.type.283524.1] {} {} -// CHECK:STDOUT: %Interface.decl.loc9: type = interface_decl @Interface.loc9 [concrete = constants.%Interface.type.283524.2] {} {} +// CHECK:STDOUT: %Interface.decl.loc16: type = interface_decl @Interface.loc16 [concrete = constants.%Interface.type.283524.2] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Interface.loc4 { @@ -155,53 +185,53 @@ interface Class { } // CHECK:STDOUT: !requires: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: interface @Interface.loc9 { +// CHECK:STDOUT: interface @Interface.loc16 { // CHECK:STDOUT: %Self: %Interface.type.283524.2 = symbolic_binding Self, 0 [symbolic = constants.%Self.3ce02d.2] -// CHECK:STDOUT: %Interface.WithSelf.decl = interface_with_self_decl @Interface.loc9 [concrete] +// CHECK:STDOUT: %Interface.WithSelf.decl = interface_with_self_decl @Interface.loc16 [concrete] // CHECK:STDOUT: // CHECK:STDOUT: !with Self: -// CHECK:STDOUT: %Interface.WithSelf.F.decl: @Interface.WithSelf.loc9.%Interface.WithSelf.F.type (%Interface.WithSelf.F.type) = fn_decl @Interface.WithSelf.F [symbolic = @Interface.WithSelf.loc9.%Interface.WithSelf.F (constants.%Interface.WithSelf.F)] { -// CHECK:STDOUT: %self.param_patt.loc10_8.1: @Interface.WithSelf.F.%pattern_type (%pattern_type) = value_param_pattern [symbolic = %self.param_patt.loc10_8.2 (constants.%self.param_patt)] -// CHECK:STDOUT: %self.patt.loc10_8.1: @Interface.WithSelf.F.%pattern_type (%pattern_type) = wrapper_binding_pattern self, %self.param_patt.loc10_8.1 [symbolic = %self.patt.loc10_8.2 (constants.%self.patt)] +// CHECK:STDOUT: %Interface.WithSelf.F.decl: @Interface.WithSelf.loc16.%Interface.WithSelf.F.type (%Interface.WithSelf.F.type) = fn_decl @Interface.WithSelf.F [symbolic = @Interface.WithSelf.loc16.%Interface.WithSelf.F (constants.%Interface.WithSelf.F)] { +// CHECK:STDOUT: %self.param_patt.loc17_8.1: @Interface.WithSelf.F.%pattern_type (%pattern_type) = value_param_pattern [symbolic = %self.param_patt.loc17_8.2 (constants.%self.param_patt)] +// CHECK:STDOUT: %self.patt.loc17_8.1: @Interface.WithSelf.F.%pattern_type (%pattern_type) = wrapper_binding_pattern self, %self.param_patt.loc17_8.1 [symbolic = %self.patt.loc17_8.2 (constants.%self.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param: @Interface.WithSelf.F.%Self.as_type.loc10_8.1 (%Self.as_type) = value_param call_param0 -// CHECK:STDOUT: %.loc10_8.1: type = splice_block %.loc10_8.2 [symbolic = %Self.as_type.loc10_8.1 (constants.%Self.as_type)] { -// CHECK:STDOUT: %Self.ref: %Interface.type.283524.2 = name_ref Self, @Interface.loc9.%Self [symbolic = %Self (constants.%Self.3ce02d.2)] -// CHECK:STDOUT: %Self.as_type.loc10_8.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc10_8.1 (constants.%Self.as_type)] -// CHECK:STDOUT: %.loc10_8.2: type = converted %Self.ref, %Self.as_type.loc10_8.2 [symbolic = %Self.as_type.loc10_8.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %self.param: @Interface.WithSelf.F.%Self.as_type.loc17_8.1 (%Self.as_type) = value_param call_param0 +// CHECK:STDOUT: %.loc17_8.1: type = splice_block %.loc17_8.2 [symbolic = %Self.as_type.loc17_8.1 (constants.%Self.as_type)] { +// CHECK:STDOUT: %Self.ref: %Interface.type.283524.2 = name_ref Self, @Interface.loc16.%Self [symbolic = %Self (constants.%Self.3ce02d.2)] +// CHECK:STDOUT: %Self.as_type.loc17_8.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc17_8.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %.loc17_8.2: type = converted %Self.ref, %Self.as_type.loc17_8.2 [symbolic = %Self.as_type.loc17_8.1 (constants.%Self.as_type)] // CHECK:STDOUT: } -// CHECK:STDOUT: %self: @Interface.WithSelf.F.%Self.as_type.loc10_8.1 (%Self.as_type) = wrapper_binding self, %self.param +// CHECK:STDOUT: %self: @Interface.WithSelf.F.%Self.as_type.loc17_8.1 (%Self.as_type) = wrapper_binding self, %self.param // CHECK:STDOUT: } // CHECK:STDOUT: %assoc0: %Interface.assoc_type = assoc_entity element0, %Interface.WithSelf.F.decl [concrete = constants.%assoc0] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .F = @Interface.WithSelf.loc9.%assoc0 -// CHECK:STDOUT: witness = (@Interface.WithSelf.loc9.%Interface.WithSelf.F.decl) +// CHECK:STDOUT: .F = @Interface.WithSelf.loc16.%assoc0 +// CHECK:STDOUT: witness = (@Interface.WithSelf.loc16.%Interface.WithSelf.F.decl) // CHECK:STDOUT: // CHECK:STDOUT: !requires: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Interface.WithSelf.F(@Interface.loc9.%Self: %Interface.type.283524.2) { +// CHECK:STDOUT: generic fn @Interface.WithSelf.F(@Interface.loc16.%Self: %Interface.type.283524.2) { // CHECK:STDOUT: %Self: %Interface.type.283524.2 = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.3ce02d.2)] -// CHECK:STDOUT: %Self.as_type.loc10_8.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc10_8.1 (constants.%Self.as_type)] -// CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type.loc10_8.1 [symbolic = %pattern_type (constants.%pattern_type)] -// CHECK:STDOUT: %self.param_patt.loc10_8.2: @Interface.WithSelf.F.%pattern_type (%pattern_type) = value_param_pattern [symbolic = %self.param_patt.loc10_8.2 (constants.%self.param_patt)] -// CHECK:STDOUT: %self.patt.loc10_8.2: @Interface.WithSelf.F.%pattern_type (%pattern_type) = wrapper_binding_pattern self, %self.param_patt.loc10_8.2 [symbolic = %self.patt.loc10_8.2 (constants.%self.patt)] +// CHECK:STDOUT: %Self.as_type.loc17_8.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc17_8.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type.loc17_8.1 [symbolic = %pattern_type (constants.%pattern_type)] +// CHECK:STDOUT: %self.param_patt.loc17_8.2: @Interface.WithSelf.F.%pattern_type (%pattern_type) = value_param_pattern [symbolic = %self.param_patt.loc17_8.2 (constants.%self.param_patt)] +// CHECK:STDOUT: %self.patt.loc17_8.2: @Interface.WithSelf.F.%pattern_type (%pattern_type) = wrapper_binding_pattern self, %self.param_patt.loc17_8.2 [symbolic = %self.patt.loc17_8.2 (constants.%self.patt)] // CHECK:STDOUT: -// CHECK:STDOUT: fn(%self.param: @Interface.WithSelf.F.%Self.as_type.loc10_8.1 (%Self.as_type)); +// CHECK:STDOUT: fn(%self.param: @Interface.WithSelf.F.%Self.as_type.loc17_8.1 (%Self.as_type)); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Interface.WithSelf.loc4(constants.%Self.3ce02d.1) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @Interface.WithSelf.loc9(constants.%Self.3ce02d.2) {} +// CHECK:STDOUT: specific @Interface.WithSelf.loc16(constants.%Self.3ce02d.2) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @Interface.WithSelf.F(constants.%Self.3ce02d.2) { // CHECK:STDOUT: %Self => constants.%Self.3ce02d.2 -// CHECK:STDOUT: %Self.as_type.loc10_8.1 => constants.%Self.as_type +// CHECK:STDOUT: %Self.as_type.loc17_8.1 => constants.%Self.as_type // CHECK:STDOUT: %pattern_type => constants.%pattern_type -// CHECK:STDOUT: %self.param_patt.loc10_8.2 => constants.%self.param_patt -// CHECK:STDOUT: %self.patt.loc10_8.2 => constants.%self.patt +// CHECK:STDOUT: %self.param_patt.loc17_8.2 => constants.%self.param_patt +// CHECK:STDOUT: %self.patt.loc17_8.2 => constants.%self.patt // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_name_conflict_with_fn.carbon @@ -210,7 +240,7 @@ interface Class { } // CHECK:STDOUT: type: type = facet_type [concrete] // CHECK:STDOUT: %Function.type.b68: type = fn_type @Function.loc4 [concrete] // CHECK:STDOUT: %Function: %Function.type.b68 = struct_value () [concrete] -// CHECK:STDOUT: %Function.type.186: type = facet_type <@Function.loc9> [concrete] +// CHECK:STDOUT: %Function.type.186: type = facet_type <@Function.loc17> [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -218,10 +248,10 @@ interface Class { } // CHECK:STDOUT: .Function = %Function.decl.loc4 // CHECK:STDOUT: } // CHECK:STDOUT: %Function.decl.loc4: %Function.type.b68 = fn_decl @Function.loc4 [concrete = constants.%Function] {} {} -// CHECK:STDOUT: %Function.decl.loc9: type = interface_decl @Function.loc9 [concrete = constants.%Function.type.186] {} {} +// CHECK:STDOUT: %Function.decl.loc17: type = interface_decl @Function.loc17 [concrete = constants.%Function.type.186] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: interface @Function.loc9; +// CHECK:STDOUT: interface @Function.loc17; // CHECK:STDOUT: // CHECK:STDOUT: fn @Function.loc4(); // CHECK:STDOUT: @@ -230,7 +260,7 @@ interface Class { } // CHECK:STDOUT: constants { // CHECK:STDOUT: type: type = facet_type [concrete] // CHECK:STDOUT: %Class: type = class_type @Class.loc2 [concrete] -// CHECK:STDOUT: %Class.type: type = facet_type <@Class.loc7> [concrete] +// CHECK:STDOUT: %Class.type: type = facet_type <@Class.loc15> [concrete] // CHECK:STDOUT: %Self: %Class.type = symbolic_binding Self, 0 [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -239,12 +269,12 @@ interface Class { } // CHECK:STDOUT: .Class = %Class.decl.loc2 // CHECK:STDOUT: } // CHECK:STDOUT: %Class.decl.loc2: type = class_decl @Class.loc2 [concrete = constants.%Class] {} {} -// CHECK:STDOUT: %Class.decl.loc7: type = interface_decl @Class.loc7 [concrete = constants.%Class.type] {} {} +// CHECK:STDOUT: %Class.decl.loc15: type = interface_decl @Class.loc15 [concrete = constants.%Class.type] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: interface @Class.loc7 { +// CHECK:STDOUT: interface @Class.loc15 { // CHECK:STDOUT: %Self: %Class.type = symbolic_binding Self, 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %Class.WithSelf.decl = interface_with_self_decl @Class.loc7 [concrete] +// CHECK:STDOUT: %Class.WithSelf.decl = interface_with_self_decl @Class.loc15 [concrete] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self diff --git a/toolchain/check/testdata/interface/fail_generic_redeclaration.carbon b/toolchain/check/testdata/interface/fail_generic_redeclaration.carbon index e0606c55a9ec..975fd8cc3f2f 100644 --- a/toolchain/check/testdata/interface/fail_generic_redeclaration.carbon +++ b/toolchain/check/testdata/interface/fail_generic_redeclaration.carbon @@ -13,20 +13,50 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/fail_generic_redeclaration.carbon interface NotGeneric; -// CHECK:STDERR: fail_generic_redeclaration.carbon:[[@LINE+3]]:1-31: error: redeclaration differs because of parameter list [RedeclParamListDiffers] -// CHECK:STDERR: fail_generic_redeclaration.carbon:[[@LINE-2]]:1-21: note: previously declared without parameter list [RedeclParamListPrevious] +// CHECK:STDERR: ╭─┤ fail_generic_redeclaration.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: │ interface NotGeneric; +// CHECK:STDERR: · ──────────┬────────── +// CHECK:STDERR: · ╰──┤ previously declared without parameter list +// CHECK:STDERR: · │ [RedeclParamListPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ interface NotGeneric(T: type) {} +// CHECK:STDERR: · ━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration differs because of parameter list +// CHECK:STDERR: · ┃ [RedeclParamListDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: interface NotGeneric(T: type) {} interface Generic(T: type); -// CHECK:STDERR: fail_generic_redeclaration.carbon:[[@LINE+3]]:1-19: error: redeclaration differs because of missing parameter list [RedeclParamListDiffers] -// CHECK:STDERR: fail_generic_redeclaration.carbon:[[@LINE-2]]:1-27: note: previously declared with parameter list [RedeclParamListPrevious] +// CHECK:STDERR: ╭─┤ fail_generic_redeclaration.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: │ interface Generic(T: type); +// CHECK:STDERR: · ─────────────┬───────────── +// CHECK:STDERR: · ╰──┤ previously declared with parameter list +// CHECK:STDERR: · │ [RedeclParamListPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ interface Generic {} +// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration differs because of missing parameter list +// CHECK:STDERR: · ┃ [RedeclParamListDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: interface Generic {} interface DifferentParams(T: type); -// CHECK:STDERR: fail_generic_redeclaration.carbon:[[@LINE+3]]:27-31: error: type `` of parameter 1 in redeclaration differs from previous parameter type `` [RedeclParamDiffersType] -// CHECK:STDERR: fail_generic_redeclaration.carbon:[[@LINE-2]]:27-33: note: previous declaration's corresponding parameter here [RedeclParamPrevious] +// CHECK:STDERR: ╭─┤ fail_generic_redeclaration.carbon:[[@LINE+15]]:27 +// CHECK:STDERR: │ interface DifferentParams(T: type); +// CHECK:STDERR: · ┬────── +// CHECK:STDERR: · ╰──┤ previous declaration's corresponding parameter +// CHECK:STDERR: · │ here +// CHECK:STDERR: · │ [RedeclParamPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ interface DifferentParams(T: ()) {} +// CHECK:STDERR: · ┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: type `` of parameter 1 in +// CHECK:STDERR: · ┃ redeclaration differs from previous +// CHECK:STDERR: · ┃ parameter type `` +// CHECK:STDERR: · ┃ [RedeclParamDiffersType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: interface DifferentParams(T: ()) {} @@ -39,106 +69,106 @@ interface DifferentParams(T: ()) {} // CHECK:STDOUT: %pattern_type.9a5: type = pattern_type type [concrete] // CHECK:STDOUT: %T.patt.3a0: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic] // CHECK:STDOUT: %T.67d: type = symbolic_binding T, 0 [symbolic] -// CHECK:STDOUT: %NotGeneric.type.fec: type = generic_interface_type @NotGeneric.loc19 [concrete] +// CHECK:STDOUT: %NotGeneric.type.fec: type = generic_interface_type @NotGeneric.loc28 [concrete] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %NotGeneric.generic: %NotGeneric.type.fec = struct_value () [concrete] -// CHECK:STDOUT: %NotGeneric.type.bdb: type = facet_type <@NotGeneric.loc19, @NotGeneric.loc19(%T.67d)> [symbolic] +// CHECK:STDOUT: %NotGeneric.type.bdb: type = facet_type <@NotGeneric.loc28, @NotGeneric.loc28(%T.67d)> [symbolic] // CHECK:STDOUT: %Self.b56: %NotGeneric.type.bdb = symbolic_binding Self, 1 [symbolic] -// CHECK:STDOUT: %Generic.type.30d: type = generic_interface_type @Generic.loc21 [concrete] +// CHECK:STDOUT: %Generic.type.30d: type = generic_interface_type @Generic.loc30 [concrete] // CHECK:STDOUT: %Generic.generic: %Generic.type.30d = struct_value () [concrete] -// CHECK:STDOUT: %Generic.type.b2d: type = facet_type <@Generic.loc25> [concrete] +// CHECK:STDOUT: %Generic.type.b2d: type = facet_type <@Generic.loc43> [concrete] // CHECK:STDOUT: %Self.c53: %Generic.type.b2d = symbolic_binding Self, 0 [symbolic] -// CHECK:STDOUT: %DifferentParams.type.998819.1: type = generic_interface_type @DifferentParams.loc27 [concrete] +// CHECK:STDOUT: %DifferentParams.type.998819.1: type = generic_interface_type @DifferentParams.loc45 [concrete] // CHECK:STDOUT: %DifferentParams.generic.54c122.1: %DifferentParams.type.998819.1 = struct_value () [concrete] // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete] // CHECK:STDOUT: %pattern_type.cb1: type = pattern_type %empty_tuple.type [concrete] // CHECK:STDOUT: %T.patt.8f8: %pattern_type.cb1 = symbolic_binding_pattern T, 0 [symbolic] // CHECK:STDOUT: %T.d5f: %empty_tuple.type = symbolic_binding T, 0 [symbolic] -// CHECK:STDOUT: %DifferentParams.type.998819.2: type = generic_interface_type @DifferentParams.loc31 [concrete] +// CHECK:STDOUT: %DifferentParams.type.998819.2: type = generic_interface_type @DifferentParams.loc61 [concrete] // CHECK:STDOUT: %DifferentParams.generic.54c122.2: %DifferentParams.type.998819.2 = struct_value () [concrete] -// CHECK:STDOUT: %DifferentParams.type.848: type = facet_type <@DifferentParams.loc31, @DifferentParams.loc31(%T.d5f)> [symbolic] +// CHECK:STDOUT: %DifferentParams.type.848: type = facet_type <@DifferentParams.loc61, @DifferentParams.loc61(%T.d5f)> [symbolic] // CHECK:STDOUT: %Self.63c: %DifferentParams.type.848 = symbolic_binding Self, 1 [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [concrete] { // CHECK:STDOUT: .NotGeneric = %NotGeneric.decl.loc15 -// CHECK:STDOUT: .Generic = %Generic.decl.loc21 -// CHECK:STDOUT: .DifferentParams = %DifferentParams.decl.loc27 +// CHECK:STDOUT: .Generic = %Generic.decl.loc30 +// CHECK:STDOUT: .DifferentParams = %DifferentParams.decl.loc45 // CHECK:STDOUT: } // CHECK:STDOUT: %NotGeneric.decl.loc15: type = interface_decl @NotGeneric.loc15 [concrete = constants.%NotGeneric.type.fd5] {} {} -// CHECK:STDOUT: %NotGeneric.decl.loc19: %NotGeneric.type.fec = interface_decl @NotGeneric.loc19 [concrete = constants.%NotGeneric.generic] { -// CHECK:STDOUT: %T.patt.loc19_23.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc19_23.2 (constants.%T.patt.3a0)] +// CHECK:STDOUT: %NotGeneric.decl.loc28: %NotGeneric.type.fec = interface_decl @NotGeneric.loc28 [concrete = constants.%NotGeneric.generic] { +// CHECK:STDOUT: %T.patt.loc28_23.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc28_23.2 (constants.%T.patt.3a0)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc19_25.1: type = splice_block %.loc19_25.2 [concrete = type] { +// CHECK:STDOUT: %.loc28_25.1: type = splice_block %.loc28_25.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc19_25.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc28_25.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc19_23.2: type = symbolic_binding T, 0 [symbolic = %T.loc19_23.1 (constants.%T.67d)] +// CHECK:STDOUT: %T.loc28_23.2: type = symbolic_binding T, 0 [symbolic = %T.loc28_23.1 (constants.%T.67d)] // CHECK:STDOUT: } -// CHECK:STDOUT: %Generic.decl.loc21: %Generic.type.30d = interface_decl @Generic.loc21 [concrete = constants.%Generic.generic] { -// CHECK:STDOUT: %T.patt.loc21_20.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc21_20.2 (constants.%T.patt.3a0)] +// CHECK:STDOUT: %Generic.decl.loc30: %Generic.type.30d = interface_decl @Generic.loc30 [concrete = constants.%Generic.generic] { +// CHECK:STDOUT: %T.patt.loc30_20.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc30_20.2 (constants.%T.patt.3a0)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc21_22.1: type = splice_block %.loc21_22.2 [concrete = type] { +// CHECK:STDOUT: %.loc30_22.1: type = splice_block %.loc30_22.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc21_22.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc30_22.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc21_20.2: type = symbolic_binding T, 0 [symbolic = %T.loc21_20.1 (constants.%T.67d)] +// CHECK:STDOUT: %T.loc30_20.2: type = symbolic_binding T, 0 [symbolic = %T.loc30_20.1 (constants.%T.67d)] // CHECK:STDOUT: } -// CHECK:STDOUT: %Generic.decl.loc25: type = interface_decl @Generic.loc25 [concrete = constants.%Generic.type.b2d] {} {} -// CHECK:STDOUT: %DifferentParams.decl.loc27: %DifferentParams.type.998819.1 = interface_decl @DifferentParams.loc27 [concrete = constants.%DifferentParams.generic.54c122.1] { -// CHECK:STDOUT: %T.patt.loc27_28.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc27_28.2 (constants.%T.patt.3a0)] +// CHECK:STDOUT: %Generic.decl.loc43: type = interface_decl @Generic.loc43 [concrete = constants.%Generic.type.b2d] {} {} +// CHECK:STDOUT: %DifferentParams.decl.loc45: %DifferentParams.type.998819.1 = interface_decl @DifferentParams.loc45 [concrete = constants.%DifferentParams.generic.54c122.1] { +// CHECK:STDOUT: %T.patt.loc45_28.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc45_28.2 (constants.%T.patt.3a0)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc27_30.1: type = splice_block %.loc27_30.2 [concrete = type] { +// CHECK:STDOUT: %.loc45_30.1: type = splice_block %.loc45_30.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc27_30.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc45_30.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc27_28.2: type = symbolic_binding T, 0 [symbolic = %T.loc27_28.1 (constants.%T.67d)] +// CHECK:STDOUT: %T.loc45_28.2: type = symbolic_binding T, 0 [symbolic = %T.loc45_28.1 (constants.%T.67d)] // CHECK:STDOUT: } -// CHECK:STDOUT: %DifferentParams.decl.loc31: %DifferentParams.type.998819.2 = interface_decl @DifferentParams.loc31 [concrete = constants.%DifferentParams.generic.54c122.2] { -// CHECK:STDOUT: %T.patt.loc31_28.1: %pattern_type.cb1 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc31_28.2 (constants.%T.patt.8f8)] +// CHECK:STDOUT: %DifferentParams.decl.loc61: %DifferentParams.type.998819.2 = interface_decl @DifferentParams.loc61 [concrete = constants.%DifferentParams.generic.54c122.2] { +// CHECK:STDOUT: %T.patt.loc61_28.1: %pattern_type.cb1 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc61_28.2 (constants.%T.patt.8f8)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc31_31.1: type = splice_block %.loc31_31.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc61_31.1: type = splice_block %.loc61_31.3 [concrete = constants.%empty_tuple.type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc31_31.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc31_31.3: type = converted %.loc31_31.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc61_31.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc61_31.3: type = converted %.loc61_31.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc31_28.2: %empty_tuple.type = symbolic_binding T, 0 [symbolic = %T.loc31_28.1 (constants.%T.d5f)] +// CHECK:STDOUT: %T.loc61_28.2: %empty_tuple.type = symbolic_binding T, 0 [symbolic = %T.loc61_28.1 (constants.%T.d5f)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @NotGeneric.loc15; // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @NotGeneric.loc19(%T.loc19_23.2: type) { -// CHECK:STDOUT: %T.patt.loc19_23.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc19_23.2 (constants.%T.patt.3a0)] -// CHECK:STDOUT: %T.loc19_23.1: type = symbolic_binding T, 0 [symbolic = %T.loc19_23.1 (constants.%T.67d)] +// CHECK:STDOUT: generic interface @NotGeneric.loc28(%T.loc28_23.2: type) { +// CHECK:STDOUT: %T.patt.loc28_23.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc28_23.2 (constants.%T.patt.3a0)] +// CHECK:STDOUT: %T.loc28_23.1: type = symbolic_binding T, 0 [symbolic = %T.loc28_23.1 (constants.%T.67d)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %NotGeneric.type: type = facet_type <@NotGeneric.loc19, @NotGeneric.loc19(%T.loc19_23.1)> [symbolic = %NotGeneric.type (constants.%NotGeneric.type.bdb)] -// CHECK:STDOUT: %Self.loc19_31.2: @NotGeneric.loc19.%NotGeneric.type (%NotGeneric.type.bdb) = symbolic_binding Self, 1 [symbolic = %Self.loc19_31.2 (constants.%Self.b56)] +// CHECK:STDOUT: %NotGeneric.type: type = facet_type <@NotGeneric.loc28, @NotGeneric.loc28(%T.loc28_23.1)> [symbolic = %NotGeneric.type (constants.%NotGeneric.type.bdb)] +// CHECK:STDOUT: %Self.loc28_31.2: @NotGeneric.loc28.%NotGeneric.type (%NotGeneric.type.bdb) = symbolic_binding Self, 1 [symbolic = %Self.loc28_31.2 (constants.%Self.b56)] // CHECK:STDOUT: // CHECK:STDOUT: interface { -// CHECK:STDOUT: %Self.loc19_31.1: @NotGeneric.loc19.%NotGeneric.type (%NotGeneric.type.bdb) = symbolic_binding Self, 1 [symbolic = %Self.loc19_31.2 (constants.%Self.b56)] -// CHECK:STDOUT: %NotGeneric.WithSelf.decl = interface_with_self_decl @NotGeneric.loc19 [concrete] +// CHECK:STDOUT: %Self.loc28_31.1: @NotGeneric.loc28.%NotGeneric.type (%NotGeneric.type.bdb) = symbolic_binding Self, 1 [symbolic = %Self.loc28_31.2 (constants.%Self.b56)] +// CHECK:STDOUT: %NotGeneric.WithSelf.decl = interface_with_self_decl @NotGeneric.loc28 [concrete] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.loc19_31.1 +// CHECK:STDOUT: .Self = %Self.loc28_31.1 // CHECK:STDOUT: witness = () // CHECK:STDOUT: // CHECK:STDOUT: !requires: // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @Generic.loc21(%T.loc21_20.2: type) { -// CHECK:STDOUT: %T.patt.loc21_20.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc21_20.2 (constants.%T.patt.3a0)] -// CHECK:STDOUT: %T.loc21_20.1: type = symbolic_binding T, 0 [symbolic = %T.loc21_20.1 (constants.%T.67d)] +// CHECK:STDOUT: generic interface @Generic.loc30(%T.loc30_20.2: type) { +// CHECK:STDOUT: %T.patt.loc30_20.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc30_20.2 (constants.%T.patt.3a0)] +// CHECK:STDOUT: %T.loc30_20.1: type = symbolic_binding T, 0 [symbolic = %T.loc30_20.1 (constants.%T.67d)] // CHECK:STDOUT: // CHECK:STDOUT: interface; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: interface @Generic.loc25 { +// CHECK:STDOUT: interface @Generic.loc43 { // CHECK:STDOUT: %Self: %Generic.type.b2d = symbolic_binding Self, 0 [symbolic = constants.%Self.c53] -// CHECK:STDOUT: %Generic.WithSelf.decl = interface_with_self_decl @Generic.loc25 [concrete] +// CHECK:STDOUT: %Generic.WithSelf.decl = interface_with_self_decl @Generic.loc43 [concrete] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self @@ -147,55 +177,55 @@ interface DifferentParams(T: ()) {} // CHECK:STDOUT: !requires: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @DifferentParams.loc27(%T.loc27_28.2: type) { -// CHECK:STDOUT: %T.patt.loc27_28.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc27_28.2 (constants.%T.patt.3a0)] -// CHECK:STDOUT: %T.loc27_28.1: type = symbolic_binding T, 0 [symbolic = %T.loc27_28.1 (constants.%T.67d)] +// CHECK:STDOUT: generic interface @DifferentParams.loc45(%T.loc45_28.2: type) { +// CHECK:STDOUT: %T.patt.loc45_28.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc45_28.2 (constants.%T.patt.3a0)] +// CHECK:STDOUT: %T.loc45_28.1: type = symbolic_binding T, 0 [symbolic = %T.loc45_28.1 (constants.%T.67d)] // CHECK:STDOUT: // CHECK:STDOUT: interface; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @DifferentParams.loc31(%T.loc31_28.2: %empty_tuple.type) { -// CHECK:STDOUT: %T.patt.loc31_28.2: %pattern_type.cb1 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc31_28.2 (constants.%T.patt.8f8)] -// CHECK:STDOUT: %T.loc31_28.1: %empty_tuple.type = symbolic_binding T, 0 [symbolic = %T.loc31_28.1 (constants.%T.d5f)] +// CHECK:STDOUT: generic interface @DifferentParams.loc61(%T.loc61_28.2: %empty_tuple.type) { +// CHECK:STDOUT: %T.patt.loc61_28.2: %pattern_type.cb1 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc61_28.2 (constants.%T.patt.8f8)] +// CHECK:STDOUT: %T.loc61_28.1: %empty_tuple.type = symbolic_binding T, 0 [symbolic = %T.loc61_28.1 (constants.%T.d5f)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %DifferentParams.type: type = facet_type <@DifferentParams.loc31, @DifferentParams.loc31(%T.loc31_28.1)> [symbolic = %DifferentParams.type (constants.%DifferentParams.type.848)] -// CHECK:STDOUT: %Self.loc31_34.2: @DifferentParams.loc31.%DifferentParams.type (%DifferentParams.type.848) = symbolic_binding Self, 1 [symbolic = %Self.loc31_34.2 (constants.%Self.63c)] +// CHECK:STDOUT: %DifferentParams.type: type = facet_type <@DifferentParams.loc61, @DifferentParams.loc61(%T.loc61_28.1)> [symbolic = %DifferentParams.type (constants.%DifferentParams.type.848)] +// CHECK:STDOUT: %Self.loc61_34.2: @DifferentParams.loc61.%DifferentParams.type (%DifferentParams.type.848) = symbolic_binding Self, 1 [symbolic = %Self.loc61_34.2 (constants.%Self.63c)] // CHECK:STDOUT: // CHECK:STDOUT: interface { -// CHECK:STDOUT: %Self.loc31_34.1: @DifferentParams.loc31.%DifferentParams.type (%DifferentParams.type.848) = symbolic_binding Self, 1 [symbolic = %Self.loc31_34.2 (constants.%Self.63c)] -// CHECK:STDOUT: %DifferentParams.WithSelf.decl = interface_with_self_decl @DifferentParams.loc31 [concrete] +// CHECK:STDOUT: %Self.loc61_34.1: @DifferentParams.loc61.%DifferentParams.type (%DifferentParams.type.848) = symbolic_binding Self, 1 [symbolic = %Self.loc61_34.2 (constants.%Self.63c)] +// CHECK:STDOUT: %DifferentParams.WithSelf.decl = interface_with_self_decl @DifferentParams.loc61 [concrete] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.loc31_34.1 +// CHECK:STDOUT: .Self = %Self.loc61_34.1 // CHECK:STDOUT: witness = () // CHECK:STDOUT: // CHECK:STDOUT: !requires: // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @NotGeneric.loc19(constants.%T.67d) { -// CHECK:STDOUT: %T.patt.loc19_23.2 => constants.%T.patt.3a0 -// CHECK:STDOUT: %T.loc19_23.1 => constants.%T.67d +// CHECK:STDOUT: specific @NotGeneric.loc28(constants.%T.67d) { +// CHECK:STDOUT: %T.patt.loc28_23.2 => constants.%T.patt.3a0 +// CHECK:STDOUT: %T.loc28_23.1 => constants.%T.67d // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @NotGeneric.WithSelf(constants.%T.67d, constants.%Self.b56) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @Generic.loc21(constants.%T.67d) { -// CHECK:STDOUT: %T.patt.loc21_20.2 => constants.%T.patt.3a0 -// CHECK:STDOUT: %T.loc21_20.1 => constants.%T.67d +// CHECK:STDOUT: specific @Generic.loc30(constants.%T.67d) { +// CHECK:STDOUT: %T.patt.loc30_20.2 => constants.%T.patt.3a0 +// CHECK:STDOUT: %T.loc30_20.1 => constants.%T.67d // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Generic.WithSelf(constants.%Self.c53) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @DifferentParams.loc27(constants.%T.67d) { -// CHECK:STDOUT: %T.patt.loc27_28.2 => constants.%T.patt.3a0 -// CHECK:STDOUT: %T.loc27_28.1 => constants.%T.67d +// CHECK:STDOUT: specific @DifferentParams.loc45(constants.%T.67d) { +// CHECK:STDOUT: %T.patt.loc45_28.2 => constants.%T.patt.3a0 +// CHECK:STDOUT: %T.loc45_28.1 => constants.%T.67d // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @DifferentParams.loc31(constants.%T.d5f) { -// CHECK:STDOUT: %T.patt.loc31_28.2 => constants.%T.patt.8f8 -// CHECK:STDOUT: %T.loc31_28.1 => constants.%T.d5f +// CHECK:STDOUT: specific @DifferentParams.loc61(constants.%T.d5f) { +// CHECK:STDOUT: %T.patt.loc61_28.2 => constants.%T.patt.8f8 +// CHECK:STDOUT: %T.loc61_28.1 => constants.%T.d5f // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @DifferentParams.WithSelf(constants.%T.d5f, constants.%Self.63c) {} diff --git a/toolchain/check/testdata/interface/fail_incorrect_subobject_destroy_method_declarations.carbon b/toolchain/check/testdata/interface/fail_incorrect_subobject_destroy_method_declarations.carbon index e0b93f3152d7..256d8e85445a 100644 --- a/toolchain/check/testdata/interface/fail_incorrect_subobject_destroy_method_declarations.carbon +++ b/toolchain/check/testdata/interface/fail_incorrect_subobject_destroy_method_declarations.carbon @@ -15,7 +15,14 @@ package Core library "too_few_assoc_functions_declared"; -// CHECK:STDERR: fail_too_few_assoc_functions_declared.carbon:[[@LINE+2]]:1-28: error: semantics TODO: `interface `Core.SubobjectDestroy` needs exactly 1 associated function` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_too_few_assoc_functions_declared.carbon:[[@LINE+9]]:1 +// CHECK:STDERR: -> │ interface SubobjectDestroy { +// CHECK:STDERR: · ━━━━━━━━━━━━━━┳━━━━━━━━━━━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: semantics TODO: +// CHECK:STDERR: · ┃ `interface `Core.SubobjectDestroy` needs exactly 1 associated function` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: interface SubobjectDestroy { } @@ -24,7 +31,14 @@ interface SubobjectDestroy { package Core library "too_many_assoc_functions_declared"; -// CHECK:STDERR: fail_too_many_assoc_functions_declared.carbon:[[@LINE+2]]:1-28: error: semantics TODO: `interface `Core.SubobjectDestroy` needs exactly 1 associated function` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_too_many_assoc_functions_declared.carbon:[[@LINE+9]]:1 +// CHECK:STDERR: -> │ interface SubobjectDestroy { +// CHECK:STDERR: · ━━━━━━━━━━━━━━┳━━━━━━━━━━━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: semantics TODO: +// CHECK:STDERR: · ┃ `interface `Core.SubobjectDestroy` needs exactly 1 associated function` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: interface SubobjectDestroy { fn Op(ref self); @@ -36,7 +50,12 @@ interface SubobjectDestroy { package Core library "op_associated_type"; interface SubobjectDestroy { - // CHECK:STDERR: fail_op_associated_type.carbon:[[@LINE+2]]:7-14: error: semantics TODO: `associated entity must be a method` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_op_associated_type.carbon:[[@LINE+7]]:7 + // CHECK:STDERR: -> │ let Op: type; + // CHECK:STDERR: · ━━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `associated entity must be a method` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let Op: type; } @@ -46,7 +65,12 @@ interface SubobjectDestroy { package Core library "op_wrong_name"; interface SubobjectDestroy { - // CHECK:STDERR: fail_op_wrong_name.carbon:[[@LINE+2]]:3-39: error: semantics TODO: `associated function #1 must be named `Op`` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_op_wrong_name.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ final fn SubobjectDestroy(ref self) {} + // CHECK:STDERR: · ━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `associated function #1 must be named `Op`` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: final fn SubobjectDestroy(ref self) {} } @@ -56,7 +80,13 @@ interface SubobjectDestroy { package Core library "op_no_params"; interface SubobjectDestroy { - // CHECK:STDERR: fail_op_no_params.carbon:[[@LINE+2]]:3-10: error: semantics TODO: `associated function must have exactly 1 parameter` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_op_no_params.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ fn Op(); + // CHECK:STDERR: · ┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: + // CHECK:STDERR: · ┃ `associated function must have exactly 1 parameter` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn Op(); } @@ -66,7 +96,13 @@ interface SubobjectDestroy { package Core library "op_two_params"; interface SubobjectDestroy { - // CHECK:STDERR: fail_op_two_params.carbon:[[@LINE+2]]:3-27: error: semantics TODO: `associated function must have exactly 1 parameter` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_op_two_params.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ fn Op(ref self, x: Self); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: + // CHECK:STDERR: · ┃ `associated function must have exactly 1 parameter` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn Op(ref self, x: Self); } @@ -78,7 +114,13 @@ package Core library "op_param_not_self"; class C {} interface SubobjectDestroy { - // CHECK:STDERR: fail_op_param_not_self.carbon:[[@LINE+2]]:3-14: error: semantics TODO: `associated function must take `ref self` as its parameter` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_op_param_not_self.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ fn Op(c: C); + // CHECK:STDERR: · ┳━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `associated function must take `ref + // CHECK:STDERR: · ┃ self` as its parameter` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn Op(c: C); } @@ -88,7 +130,13 @@ interface SubobjectDestroy { package Core library "op_param_is_generic"; interface SubobjectDestroy { - // CHECK:STDERR: fail_op_param_is_generic.carbon:[[@LINE+2]]:3-27: error: semantics TODO: `associated function must take `ref self` as its parameter` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_op_param_is_generic.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ fn Op[T: type](ref c: T); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `associated function must take `ref + // CHECK:STDERR: · ┃ self` as its parameter` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn Op[T: type](ref c: T); } @@ -98,7 +146,13 @@ interface SubobjectDestroy { package Core library "op_self_param_not_reference"; interface SubobjectDestroy { - // CHECK:STDERR: fail_op_self_param_not_reference.carbon:[[@LINE+2]]:3-14: error: semantics TODO: `associated function must take `ref self` as its parameter` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_op_self_param_not_reference.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ fn Op(self); + // CHECK:STDERR: · ┳━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `associated function must take `ref + // CHECK:STDERR: · ┃ self` as its parameter` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn Op(self); } @@ -108,7 +162,13 @@ interface SubobjectDestroy { package Core library "op_explicit_self_type"; interface SubobjectDestroy { - // CHECK:STDERR: fail_op_explicit_self_type.carbon:[[@LINE+2]]:3-21: error: semantics TODO: `associated function must take `ref self` as its parameter` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_op_explicit_self_type.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ fn Op(ref s: Self); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `associated function must take `ref + // CHECK:STDERR: · ┃ self` as its parameter` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn Op(ref s: Self); } @@ -118,7 +178,13 @@ interface SubobjectDestroy { package Core library "op_final"; interface SubobjectDestroy { - // CHECK:STDERR: fail_op_final.carbon:[[@LINE+2]]:3-32: error: semantics TODO: `associated function must not have an interface modifier` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_op_final.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ final fn Op(unused ref self) {} + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: + // CHECK:STDERR: · ┃ `associated function must not have an interface modifier` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: final fn Op(unused ref self) {} } @@ -128,7 +194,13 @@ interface SubobjectDestroy { package Core library "op_default"; interface SubobjectDestroy { - // CHECK:STDERR: fail_op_default.carbon:[[@LINE+2]]:3-34: error: semantics TODO: `associated function must not have an interface modifier` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_op_default.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ default fn Op(unused ref self) {} + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: + // CHECK:STDERR: · ┃ `associated function must not have an interface modifier` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: default fn Op(unused ref self) {} } diff --git a/toolchain/check/testdata/interface/fail_lookup_in_type_type.carbon b/toolchain/check/testdata/interface/fail_lookup_in_type_type.carbon index b27a51564ac1..15458b8ee337 100644 --- a/toolchain/check/testdata/interface/fail_lookup_in_type_type.carbon +++ b/toolchain/check/testdata/interface/fail_lookup_in_type_type.carbon @@ -16,7 +16,12 @@ library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_lookup_in_type.carbon:[[@LINE+2]]:8-21: error: type `type` does not support qualified expressions [QualifiedExprUnsupported] +// CHECK:STDERR: ╭─┤ fail_lookup_in_type.carbon:[[@LINE+7]]:8 +// CHECK:STDERR: -> │ let T: type.not_found = {}; +// CHECK:STDERR: · ━━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: type `type` does not support qualified expressions +// CHECK:STDERR: · ┃ [QualifiedExprUnsupported] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let T: type.not_found = {}; @@ -24,7 +29,12 @@ let T: type.not_found = {}; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_lookup_type_where.carbon:[[@LINE+2]]:8-44: error: type `type` does not support qualified expressions [QualifiedExprUnsupported] +// CHECK:STDERR: ╭─┤ fail_lookup_type_where.carbon:[[@LINE+7]]:8 +// CHECK:STDERR: -> │ let U: (type where .Self impls type).missing = {}; +// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: type `type` does not support qualified expressions +// CHECK:STDERR: · ┃ [QualifiedExprUnsupported] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let U: (type where .Self impls type).missing = {}; @@ -40,7 +50,7 @@ let U: (type where .Self impls type).missing = {}; // CHECK:STDOUT: package: = namespace [concrete] { // CHECK:STDOUT: .T = %T // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc6: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc11: type = type_literal type [concrete = type] // CHECK:STDOUT: %T: = wrapper_binding T, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %T.patt: = value_binding_pattern T [concrete = ] @@ -49,7 +59,7 @@ let U: (type where .Self impls type).missing = {}; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc6: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc11: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -68,18 +78,18 @@ let U: (type where .Self impls type).missing = {}; // CHECK:STDOUT: .U = %U // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = splice_block [concrete = ] { -// CHECK:STDOUT: %.loc6_9: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc11_9: type = type_literal type [concrete = type] // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %.loc6_9 [concrete] -// CHECK:STDOUT: %.Self.ref.loc6_20.1: type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc6_32: type = type_literal type [concrete = type] -// CHECK:STDOUT: %impls.loc6_26.1 = requirement_impls %.Self.ref.loc6_20.1, %.loc6_32 [concrete] +// CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %.loc11_9 [concrete] +// CHECK:STDOUT: %.Self.ref.loc11_20.1: type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc11_32: type = type_literal type [concrete = type] +// CHECK:STDOUT: %impls.loc11_26.1 = requirement_impls %.Self.ref.loc11_20.1, %.loc11_32 [concrete] // CHECK:STDOUT: %.Self: type = symbolic_binding .Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %.Self.ref.loc6_20.2: type = name_ref .Self, %.Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %impls.loc6_26.2 = requirement_impls %.Self.ref.loc6_20.2, %.loc6_32 [concrete] -// CHECK:STDOUT: %.loc6_14: type = where_expr [concrete = type] { -// CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %.loc6_9 [concrete] -// CHECK:STDOUT: %impls.loc6_26.2 = requirement_impls %.Self.ref.loc6_20.2, %.loc6_32 [concrete] +// CHECK:STDOUT: %.Self.ref.loc11_20.2: type = name_ref .Self, %.Self [symbolic_self = constants.%.Self] +// CHECK:STDOUT: %impls.loc11_26.2 = requirement_impls %.Self.ref.loc11_20.2, %.loc11_32 [concrete] +// CHECK:STDOUT: %.loc11_14: type = where_expr [concrete = type] { +// CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %.loc11_9 [concrete] +// CHECK:STDOUT: %impls.loc11_26.2 = requirement_impls %.Self.ref.loc11_20.2, %.loc11_32 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: %U: = wrapper_binding U, [concrete = ] @@ -90,7 +100,7 @@ let U: (type where .Self impls type).missing = {}; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc6: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc11: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/fail_lookup_undefined.carbon b/toolchain/check/testdata/interface/fail_lookup_undefined.carbon index ca9ed70e8a6d..69771662774f 100644 --- a/toolchain/check/testdata/interface/fail_lookup_undefined.carbon +++ b/toolchain/check/testdata/interface/fail_lookup_undefined.carbon @@ -14,24 +14,55 @@ interface Undefined; -// CHECK:STDERR: fail_lookup_undefined.carbon:[[@LINE+3]]:4-12: error: cannot declare a member of undefined interface `Undefined` [QualifiedDeclInUndefinedInterfaceScope] -// CHECK:STDERR: fail_lookup_undefined.carbon:[[@LINE-3]]:1-20: note: interface was forward declared here [InterfaceForwardDeclaredHere] +// CHECK:STDERR: ╭─┤ fail_lookup_undefined.carbon:[[@LINE+12]]:4 +// CHECK:STDERR: │ interface Undefined; +// CHECK:STDERR: · ──────────┬───────── +// CHECK:STDERR: · ╰──┤ interface was forward declared here +// CHECK:STDERR: · │ [InterfaceForwardDeclaredHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn Undefined.F(); +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot declare a member of undefined interface `Undefined` +// CHECK:STDERR: · ┃ [QualifiedDeclInUndefinedInterfaceScope] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Undefined.F(); fn Test() { - // CHECK:STDERR: fail_lookup_undefined.carbon:[[@LINE+3]]:3-13: error: member access into incomplete facet type `Undefined` [QualifiedExprInIncompleteFacetTypeScope] - // CHECK:STDERR: fail_lookup_undefined.carbon:[[@LINE-9]]:1-20: note: interface was forward declared here [InterfaceForwardDeclaredHere] + // CHECK:STDERR: ╭─┤ fail_lookup_undefined.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ interface Undefined; + // CHECK:STDERR: · ──────────┬───────── + // CHECK:STDERR: · ╰──┤ interface was forward declared here + // CHECK:STDERR: · │ [InterfaceForwardDeclaredHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Undefined.G(); + // CHECK:STDERR: · ━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: member access into incomplete facet type `Undefined` + // CHECK:STDERR: · ┃ [QualifiedExprInIncompleteFacetTypeScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Undefined.G(); } interface BeingDefined { - // CHECK:STDERR: fail_lookup_undefined.carbon:[[@LINE+3]]:13-26: error: member access into incomplete facet type `BeingDefined` [QualifiedExprInIncompleteFacetTypeScope] - // CHECK:STDERR: fail_lookup_undefined.carbon:[[@LINE-2]]:1-24: note: interface is currently being defined [InterfaceIncompleteWithinDefinition] + // CHECK:STDERR: ╭─┤ fail_lookup_undefined.carbon:[[@LINE+12]]:13 + // CHECK:STDERR: │ interface BeingDefined { + // CHECK:STDERR: · ────────────┬─────────── + // CHECK:STDERR: · ╰──┤ interface is currently being defined + // CHECK:STDERR: · │ [InterfaceIncompleteWithinDefinition] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ fn H() -> BeingDefined.T; + // CHECK:STDERR: · ━┳━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: member access into incomplete facet type `BeingDefined` + // CHECK:STDERR: · ┃ [QualifiedExprInIncompleteFacetTypeScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn H() -> BeingDefined.T; - // CHECK:STDERR: fail_lookup_undefined.carbon:[[@LINE+2]]:6-17: error: name `BeingDefined` not found [NameNotFound] + // CHECK:STDERR: ╭─┤ fail_lookup_undefined.carbon:[[@LINE+6]]:6 + // CHECK:STDERR: -> │ fn BeingDefined.I(); + // CHECK:STDERR: · ━━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: name `BeingDefined` not found [NameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn BeingDefined.I(); } diff --git a/toolchain/check/testdata/interface/fail_member_lookup.carbon b/toolchain/check/testdata/interface/fail_member_lookup.carbon index c85a6ce45b99..69358f4b852a 100644 --- a/toolchain/check/testdata/interface/fail_member_lookup.carbon +++ b/toolchain/check/testdata/interface/fail_member_lookup.carbon @@ -22,19 +22,39 @@ interface Interface { } fn F() { - // CHECK:STDERR: fail_member_lookup.carbon:[[@LINE+2]]:3-15: error: value of type `` is not callable [CallToNonCallable] + // CHECK:STDERR: ╭─┤ fail_member_lookup.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ Interface.F(); + // CHECK:STDERR: · ━━┳━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: value of type `` is not callable + // CHECK:STDERR: · ┃ [CallToNonCallable] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Interface.F(); - // CHECK:STDERR: fail_member_lookup.carbon:[[@LINE+3]]:17-27: error: cannot implicitly convert non-type value of type `` to `type` [ConversionFailureNonTypeToFacet] - // CHECK:STDERR: fail_member_lookup.carbon:[[@LINE+2]]:17-27: note: type `` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_member_lookup.carbon:[[@LINE+11]]:17 + // CHECK:STDERR: -> │ var unused v: Interface.T; + // CHECK:STDERR: · ┳━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert non-type value of type + // CHECK:STDERR: · │ ┃ `` to `type` + // CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: · ╰────┤ type `` does not + // CHECK:STDERR: · │ implement interface `Core.ImplicitAs(type)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused v: Interface.T; } interface Different {} -// CHECK:STDERR: fail_member_lookup.carbon:[[@LINE+2]]:31-45: error: cannot convert type `U` that implements `Different` into type implementing `Interface` [ConversionFailureFacetToFacet] +// CHECK:STDERR: ╭─┤ fail_member_lookup.carbon:[[@LINE+9]]:31 +// CHECK:STDERR: -> │ fn G(generic U: Different) -> U.(Interface.T); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot convert type `U` that +// CHECK:STDERR: · ┃ implements `Different` into type +// CHECK:STDERR: · ┃ implementing `Interface` +// CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn G(generic U: Different) -> U.(Interface.T); @@ -90,18 +110,18 @@ fn G(generic U: Different) -> U.(Interface.T); // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} // CHECK:STDOUT: %Different.decl: type = interface_decl @Different [concrete = constants.%Different.type] {} {} // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] { -// CHECK:STDOUT: %U.patt.loc24_15.1: %pattern_type.776 = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc24_15.2 (constants.%U.patt)] +// CHECK:STDOUT: %U.patt.loc44_15.1: %pattern_type.776 = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc44_15.2 (constants.%U.patt)] // CHECK:STDOUT: %return.patt: = return_slot_pattern , [concrete = ] // CHECK:STDOUT: } { -// CHECK:STDOUT: %U.ref: %Different.type = name_ref U, %U.loc24_15.2 [symbolic = %U.loc24_15.1 (constants.%U)] +// CHECK:STDOUT: %U.ref: %Different.type = name_ref U, %U.loc44_15.2 [symbolic = %U.loc44_15.1 (constants.%U)] // CHECK:STDOUT: %Interface.ref: type = name_ref Interface, file.%Interface.decl [concrete = constants.%Interface.type] // CHECK:STDOUT: %T.ref: %Interface.assoc_type = name_ref T, @T.%assoc1 [concrete = constants.%assoc1] -// CHECK:STDOUT: %U.as_type.loc24_32.2: type = facet_access_type %U.ref [symbolic = %U.as_type.loc24_32.1 (constants.%U.as_type)] -// CHECK:STDOUT: %.loc24: type = splice_block %Different.ref [concrete = constants.%Different.type] { +// CHECK:STDOUT: %U.as_type.loc44_32.2: type = facet_access_type %U.ref [symbolic = %U.as_type.loc44_32.1 (constants.%U.as_type)] +// CHECK:STDOUT: %.loc44: type = splice_block %Different.ref [concrete = constants.%Different.type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %Different.ref: type = name_ref Different, file.%Different.decl [concrete = constants.%Different.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %U.loc24_15.2: %Different.type = symbolic_binding U, 0 [symbolic = %U.loc24_15.1 (constants.%U)] +// CHECK:STDOUT: %U.loc44_15.2: %Different.type = symbolic_binding U, 0 [symbolic = %U.loc44_15.1 (constants.%U)] // CHECK:STDOUT: %return: = return_slot // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -143,14 +163,14 @@ fn G(generic U: Different) -> U.(Interface.T); // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Interface.ref.loc12: type = name_ref Interface, file.%Interface.decl [concrete = constants.%Interface.type] +// CHECK:STDOUT: %Interface.ref.loc17: type = name_ref Interface, file.%Interface.decl [concrete = constants.%Interface.type] // CHECK:STDOUT: %F.ref: %Interface.assoc_type = name_ref F, @Interface.WithSelf.%assoc0 [concrete = constants.%assoc0.b3c] // CHECK:STDOUT: %v.var: ref = var_storage %v.var_patt [concrete = ] // CHECK:STDOUT: assign %v.var, // CHECK:STDOUT: %.1: = splice_block [concrete = ] { -// CHECK:STDOUT: %Interface.ref.loc17: type = name_ref Interface, file.%Interface.decl [concrete = constants.%Interface.type] +// CHECK:STDOUT: %Interface.ref.loc30: type = name_ref Interface, file.%Interface.decl [concrete = constants.%Interface.type] // CHECK:STDOUT: %T.ref: %Interface.assoc_type = name_ref T, @T.%assoc1 [concrete = constants.%assoc1] -// CHECK:STDOUT: %.loc17: type = converted %T.ref, [concrete = ] +// CHECK:STDOUT: %.loc30: type = converted %T.ref, [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: %v: = wrapper_binding v, [concrete = ] // CHECK:STDOUT: name_binding_decl { @@ -160,10 +180,10 @@ fn G(generic U: Different) -> U.(Interface.T); // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @G(%U.loc24_15.2: %Different.type) { -// CHECK:STDOUT: %U.patt.loc24_15.2: %pattern_type.776 = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc24_15.2 (constants.%U.patt)] -// CHECK:STDOUT: %U.loc24_15.1: %Different.type = symbolic_binding U, 0 [symbolic = %U.loc24_15.1 (constants.%U)] -// CHECK:STDOUT: %U.as_type.loc24_32.1: type = facet_access_type %U.loc24_15.1 [symbolic = %U.as_type.loc24_32.1 (constants.%U.as_type)] +// CHECK:STDOUT: generic fn @G(%U.loc44_15.2: %Different.type) { +// CHECK:STDOUT: %U.patt.loc44_15.2: %pattern_type.776 = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc44_15.2 (constants.%U.patt)] +// CHECK:STDOUT: %U.loc44_15.1: %Different.type = symbolic_binding U, 0 [symbolic = %U.loc44_15.1 (constants.%U)] +// CHECK:STDOUT: %U.as_type.loc44_32.1: type = facet_access_type %U.loc44_15.1 [symbolic = %U.as_type.loc44_32.1 (constants.%U.as_type)] // CHECK:STDOUT: // CHECK:STDOUT: fn() -> ; // CHECK:STDOUT: } @@ -180,8 +200,8 @@ fn G(generic U: Different) -> U.(Interface.T); // CHECK:STDOUT: specific @Different.WithSelf(constants.%Self.8ba) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @G(constants.%U) { -// CHECK:STDOUT: %U.patt.loc24_15.2 => constants.%U.patt -// CHECK:STDOUT: %U.loc24_15.1 => constants.%U -// CHECK:STDOUT: %U.as_type.loc24_32.1 => constants.%U.as_type +// CHECK:STDOUT: %U.patt.loc44_15.2 => constants.%U.patt +// CHECK:STDOUT: %U.loc44_15.1 => constants.%U +// CHECK:STDOUT: %U.as_type.loc44_32.1 => constants.%U.as_type // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/fail_modifiers.carbon b/toolchain/check/testdata/interface/fail_modifiers.carbon index f59aa3ae5930..e4b4baceeb3c 100644 --- a/toolchain/check/testdata/interface/fail_modifiers.carbon +++ b/toolchain/check/testdata/interface/fail_modifiers.carbon @@ -16,7 +16,12 @@ library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_abstract.carbon:[[@LINE+2]]:1-8: error: `abstract` not allowed on `interface` declaration [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╭─┤ fail_abstract.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ abstract interface Abstract { +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: `abstract` not allowed on `interface` declaration +// CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╰──── // CHECK:STDERR: abstract interface Abstract { } @@ -25,7 +30,12 @@ abstract interface Abstract { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_default.carbon:[[@LINE+2]]:1-7: error: `default` not allowed on `interface` declaration [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╭─┤ fail_default.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ default interface Default; +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: `default` not allowed on `interface` declaration +// CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╰──── // CHECK:STDERR: default interface Default; @@ -33,7 +43,12 @@ default interface Default; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_virtual.carbon:[[@LINE+2]]:1-7: error: `virtual` not allowed on `interface` declaration [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╭─┤ fail_virtual.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ virtual interface Virtual { +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: `virtual` not allowed on `interface` declaration +// CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╰──── // CHECK:STDERR: virtual interface Virtual { } @@ -42,7 +57,12 @@ virtual interface Virtual { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_protected.carbon:[[@LINE+2]]:1-9: error: `protected` not allowed; requires class scope [ModifierProtectedNotAllowed] +// CHECK:STDERR: ╭─┤ fail_protected.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ protected interface Protected; +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: `protected` not allowed; requires class scope +// CHECK:STDERR: · ┃ [ModifierProtectedNotAllowed] +// CHECK:STDERR: ╰──── // CHECK:STDERR: protected interface Protected; @@ -51,7 +71,12 @@ protected interface Protected; library "[[@TEST_NAME]]"; interface I { - // CHECK:STDERR: fail_private_member.carbon:[[@LINE+2]]:3-9: error: `private` not allowed; requires class or file scope [ModifierPrivateNotAllowed] + // CHECK:STDERR: ╭─┤ fail_private_member.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ private fn F(self); + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: `private` not allowed; requires class or file scope + // CHECK:STDERR: · ┃ [ModifierPrivateNotAllowed] + // CHECK:STDERR: ╰──── // CHECK:STDERR: private fn F(self); } @@ -61,7 +86,12 @@ interface I { library "[[@TEST_NAME]]"; interface I { - // CHECK:STDERR: fail_protected_member.carbon:[[@LINE+2]]:3-11: error: `protected` not allowed; requires class scope [ModifierProtectedNotAllowed] + // CHECK:STDERR: ╭─┤ fail_protected_member.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ protected fn F(self); + // CHECK:STDERR: · ━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: `protected` not allowed; requires class scope + // CHECK:STDERR: · ┃ [ModifierProtectedNotAllowed] + // CHECK:STDERR: ╰──── // CHECK:STDERR: protected fn F(self); } @@ -183,16 +213,16 @@ interface I { // CHECK:STDOUT: // CHECK:STDOUT: !with Self: // CHECK:STDOUT: %I.WithSelf.F.decl: @I.WithSelf.%I.WithSelf.F.type (%I.WithSelf.F.type) = fn_decl @I.WithSelf.F [symbolic = @I.WithSelf.%I.WithSelf.F (constants.%I.WithSelf.F)] { -// CHECK:STDOUT: %self.param_patt.loc7_16.1: @I.WithSelf.F.%pattern_type (%pattern_type) = value_param_pattern [symbolic = %self.param_patt.loc7_16.2 (constants.%self.param_patt)] -// CHECK:STDOUT: %self.patt.loc7_16.1: @I.WithSelf.F.%pattern_type (%pattern_type) = wrapper_binding_pattern self, %self.param_patt.loc7_16.1 [symbolic = %self.patt.loc7_16.2 (constants.%self.patt)] +// CHECK:STDOUT: %self.param_patt.loc12_16.1: @I.WithSelf.F.%pattern_type (%pattern_type) = value_param_pattern [symbolic = %self.param_patt.loc12_16.2 (constants.%self.param_patt)] +// CHECK:STDOUT: %self.patt.loc12_16.1: @I.WithSelf.F.%pattern_type (%pattern_type) = wrapper_binding_pattern self, %self.param_patt.loc12_16.1 [symbolic = %self.patt.loc12_16.2 (constants.%self.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param: @I.WithSelf.F.%Self.as_type.loc7_16.1 (%Self.as_type) = value_param call_param0 -// CHECK:STDOUT: %.loc7_16.1: type = splice_block %.loc7_16.2 [symbolic = %Self.as_type.loc7_16.1 (constants.%Self.as_type)] { +// CHECK:STDOUT: %self.param: @I.WithSelf.F.%Self.as_type.loc12_16.1 (%Self.as_type) = value_param call_param0 +// CHECK:STDOUT: %.loc12_16.1: type = splice_block %.loc12_16.2 [symbolic = %Self.as_type.loc12_16.1 (constants.%Self.as_type)] { // CHECK:STDOUT: %Self.ref: %I.type = name_ref Self, @I.%Self [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type.loc7_16.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc7_16.1 (constants.%Self.as_type)] -// CHECK:STDOUT: %.loc7_16.2: type = converted %Self.ref, %Self.as_type.loc7_16.2 [symbolic = %Self.as_type.loc7_16.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %Self.as_type.loc12_16.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc12_16.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %.loc12_16.2: type = converted %Self.ref, %Self.as_type.loc12_16.2 [symbolic = %Self.as_type.loc12_16.1 (constants.%Self.as_type)] // CHECK:STDOUT: } -// CHECK:STDOUT: %self: @I.WithSelf.F.%Self.as_type.loc7_16.1 (%Self.as_type) = wrapper_binding self, %self.param +// CHECK:STDOUT: %self: @I.WithSelf.F.%Self.as_type.loc12_16.1 (%Self.as_type) = wrapper_binding self, %self.param // CHECK:STDOUT: } // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, %I.WithSelf.F.decl [concrete = constants.%assoc0] // CHECK:STDOUT: @@ -206,22 +236,22 @@ interface I { // CHECK:STDOUT: // CHECK:STDOUT: generic fn @I.WithSelf.F(@I.%Self: %I.type) { // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type.loc7_16.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc7_16.1 (constants.%Self.as_type)] -// CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type.loc7_16.1 [symbolic = %pattern_type (constants.%pattern_type)] -// CHECK:STDOUT: %self.param_patt.loc7_16.2: @I.WithSelf.F.%pattern_type (%pattern_type) = value_param_pattern [symbolic = %self.param_patt.loc7_16.2 (constants.%self.param_patt)] -// CHECK:STDOUT: %self.patt.loc7_16.2: @I.WithSelf.F.%pattern_type (%pattern_type) = wrapper_binding_pattern self, %self.param_patt.loc7_16.2 [symbolic = %self.patt.loc7_16.2 (constants.%self.patt)] +// CHECK:STDOUT: %Self.as_type.loc12_16.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc12_16.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type.loc12_16.1 [symbolic = %pattern_type (constants.%pattern_type)] +// CHECK:STDOUT: %self.param_patt.loc12_16.2: @I.WithSelf.F.%pattern_type (%pattern_type) = value_param_pattern [symbolic = %self.param_patt.loc12_16.2 (constants.%self.param_patt)] +// CHECK:STDOUT: %self.patt.loc12_16.2: @I.WithSelf.F.%pattern_type (%pattern_type) = wrapper_binding_pattern self, %self.param_patt.loc12_16.2 [symbolic = %self.patt.loc12_16.2 (constants.%self.patt)] // CHECK:STDOUT: -// CHECK:STDOUT: fn(%self.param: @I.WithSelf.F.%Self.as_type.loc7_16.1 (%Self.as_type)); +// CHECK:STDOUT: fn(%self.param: @I.WithSelf.F.%Self.as_type.loc12_16.1 (%Self.as_type)); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @I.WithSelf(constants.%Self) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @I.WithSelf.F(constants.%Self) { // CHECK:STDOUT: %Self => constants.%Self -// CHECK:STDOUT: %Self.as_type.loc7_16.1 => constants.%Self.as_type +// CHECK:STDOUT: %Self.as_type.loc12_16.1 => constants.%Self.as_type // CHECK:STDOUT: %pattern_type => constants.%pattern_type -// CHECK:STDOUT: %self.param_patt.loc7_16.2 => constants.%self.param_patt -// CHECK:STDOUT: %self.patt.loc7_16.2 => constants.%self.patt +// CHECK:STDOUT: %self.param_patt.loc12_16.2 => constants.%self.param_patt +// CHECK:STDOUT: %self.patt.loc12_16.2 => constants.%self.patt // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_protected_member.carbon @@ -253,16 +283,16 @@ interface I { // CHECK:STDOUT: // CHECK:STDOUT: !with Self: // CHECK:STDOUT: %I.WithSelf.F.decl: @I.WithSelf.%I.WithSelf.F.type (%I.WithSelf.F.type) = fn_decl @I.WithSelf.F [symbolic = @I.WithSelf.%I.WithSelf.F (constants.%I.WithSelf.F)] { -// CHECK:STDOUT: %self.param_patt.loc7_18.1: @I.WithSelf.F.%pattern_type (%pattern_type) = value_param_pattern [symbolic = %self.param_patt.loc7_18.2 (constants.%self.param_patt)] -// CHECK:STDOUT: %self.patt.loc7_18.1: @I.WithSelf.F.%pattern_type (%pattern_type) = wrapper_binding_pattern self, %self.param_patt.loc7_18.1 [symbolic = %self.patt.loc7_18.2 (constants.%self.patt)] +// CHECK:STDOUT: %self.param_patt.loc12_18.1: @I.WithSelf.F.%pattern_type (%pattern_type) = value_param_pattern [symbolic = %self.param_patt.loc12_18.2 (constants.%self.param_patt)] +// CHECK:STDOUT: %self.patt.loc12_18.1: @I.WithSelf.F.%pattern_type (%pattern_type) = wrapper_binding_pattern self, %self.param_patt.loc12_18.1 [symbolic = %self.patt.loc12_18.2 (constants.%self.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param: @I.WithSelf.F.%Self.as_type.loc7_18.1 (%Self.as_type) = value_param call_param0 -// CHECK:STDOUT: %.loc7_18.1: type = splice_block %.loc7_18.2 [symbolic = %Self.as_type.loc7_18.1 (constants.%Self.as_type)] { +// CHECK:STDOUT: %self.param: @I.WithSelf.F.%Self.as_type.loc12_18.1 (%Self.as_type) = value_param call_param0 +// CHECK:STDOUT: %.loc12_18.1: type = splice_block %.loc12_18.2 [symbolic = %Self.as_type.loc12_18.1 (constants.%Self.as_type)] { // CHECK:STDOUT: %Self.ref: %I.type = name_ref Self, @I.%Self [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type.loc7_18.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc7_18.1 (constants.%Self.as_type)] -// CHECK:STDOUT: %.loc7_18.2: type = converted %Self.ref, %Self.as_type.loc7_18.2 [symbolic = %Self.as_type.loc7_18.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %Self.as_type.loc12_18.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc12_18.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %.loc12_18.2: type = converted %Self.ref, %Self.as_type.loc12_18.2 [symbolic = %Self.as_type.loc12_18.1 (constants.%Self.as_type)] // CHECK:STDOUT: } -// CHECK:STDOUT: %self: @I.WithSelf.F.%Self.as_type.loc7_18.1 (%Self.as_type) = wrapper_binding self, %self.param +// CHECK:STDOUT: %self: @I.WithSelf.F.%Self.as_type.loc12_18.1 (%Self.as_type) = wrapper_binding self, %self.param // CHECK:STDOUT: } // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, %I.WithSelf.F.decl [concrete = constants.%assoc0] // CHECK:STDOUT: @@ -276,21 +306,21 @@ interface I { // CHECK:STDOUT: // CHECK:STDOUT: generic fn @I.WithSelf.F(@I.%Self: %I.type) { // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type.loc7_18.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc7_18.1 (constants.%Self.as_type)] -// CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type.loc7_18.1 [symbolic = %pattern_type (constants.%pattern_type)] -// CHECK:STDOUT: %self.param_patt.loc7_18.2: @I.WithSelf.F.%pattern_type (%pattern_type) = value_param_pattern [symbolic = %self.param_patt.loc7_18.2 (constants.%self.param_patt)] -// CHECK:STDOUT: %self.patt.loc7_18.2: @I.WithSelf.F.%pattern_type (%pattern_type) = wrapper_binding_pattern self, %self.param_patt.loc7_18.2 [symbolic = %self.patt.loc7_18.2 (constants.%self.patt)] +// CHECK:STDOUT: %Self.as_type.loc12_18.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc12_18.1 (constants.%Self.as_type)] +// CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type.loc12_18.1 [symbolic = %pattern_type (constants.%pattern_type)] +// CHECK:STDOUT: %self.param_patt.loc12_18.2: @I.WithSelf.F.%pattern_type (%pattern_type) = value_param_pattern [symbolic = %self.param_patt.loc12_18.2 (constants.%self.param_patt)] +// CHECK:STDOUT: %self.patt.loc12_18.2: @I.WithSelf.F.%pattern_type (%pattern_type) = wrapper_binding_pattern self, %self.param_patt.loc12_18.2 [symbolic = %self.patt.loc12_18.2 (constants.%self.patt)] // CHECK:STDOUT: -// CHECK:STDOUT: fn(%self.param: @I.WithSelf.F.%Self.as_type.loc7_18.1 (%Self.as_type)); +// CHECK:STDOUT: fn(%self.param: @I.WithSelf.F.%Self.as_type.loc12_18.1 (%Self.as_type)); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @I.WithSelf(constants.%Self) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @I.WithSelf.F(constants.%Self) { // CHECK:STDOUT: %Self => constants.%Self -// CHECK:STDOUT: %Self.as_type.loc7_18.1 => constants.%Self.as_type +// CHECK:STDOUT: %Self.as_type.loc12_18.1 => constants.%Self.as_type // CHECK:STDOUT: %pattern_type => constants.%pattern_type -// CHECK:STDOUT: %self.param_patt.loc7_18.2 => constants.%self.param_patt -// CHECK:STDOUT: %self.patt.loc7_18.2 => constants.%self.patt +// CHECK:STDOUT: %self.param_patt.loc12_18.2 => constants.%self.param_patt +// CHECK:STDOUT: %self.patt.loc12_18.2 => constants.%self.patt // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/fail_redeclare_member.carbon b/toolchain/check/testdata/interface/fail_redeclare_member.carbon index ce51f908538b..4c25b3142826 100644 --- a/toolchain/check/testdata/interface/fail_redeclare_member.carbon +++ b/toolchain/check/testdata/interface/fail_redeclare_member.carbon @@ -14,8 +14,15 @@ interface Interface { fn F(); - // CHECK:STDERR: fail_redeclare_member.carbon:[[@LINE+3]]:3-9: error: redeclaration of `fn F` is redundant [RedeclRedundant] - // CHECK:STDERR: fail_redeclare_member.carbon:[[@LINE-2]]:3-9: note: previously declared here [RedeclPrevDecl] + // CHECK:STDERR: ╭─┤ fail_redeclare_member.carbon:[[@LINE+10]]:3 + // CHECK:STDERR: │ fn F(); + // CHECK:STDERR: · ───┬─── + // CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ fn F(); + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: redeclaration of `fn F` is redundant [RedeclRedundant] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(); } @@ -46,7 +53,7 @@ interface Interface { // CHECK:STDOUT: !with Self: // CHECK:STDOUT: %Interface.WithSelf.F.decl.loc16: @Interface.WithSelf.%Interface.WithSelf.F.type (%Interface.WithSelf.F.type) = fn_decl @Interface.WithSelf.F [symbolic = @Interface.WithSelf.%Interface.WithSelf.F (constants.%Interface.WithSelf.F)] {} {} // CHECK:STDOUT: %assoc0: %Interface.assoc_type = assoc_entity element0, %Interface.WithSelf.F.decl.loc16 [concrete = constants.%assoc0] -// CHECK:STDOUT: %Interface.WithSelf.F.decl.loc20: @Interface.WithSelf.%Interface.WithSelf.F.type (%Interface.WithSelf.F.type) = fn_decl @Interface.WithSelf.F [symbolic = @Interface.WithSelf.%Interface.WithSelf.F (constants.%Interface.WithSelf.F)] {} {} +// CHECK:STDOUT: %Interface.WithSelf.F.decl.loc27: @Interface.WithSelf.%Interface.WithSelf.F.type (%Interface.WithSelf.F.type) = fn_decl @Interface.WithSelf.F [symbolic = @Interface.WithSelf.%Interface.WithSelf.F (constants.%Interface.WithSelf.F)] {} {} // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self diff --git a/toolchain/check/testdata/interface/fail_todo_assoc_const_default.carbon b/toolchain/check/testdata/interface/fail_todo_assoc_const_default.carbon index 3e18698c38b4..7b5b062e2a4e 100644 --- a/toolchain/check/testdata/interface/fail_todo_assoc_const_default.carbon +++ b/toolchain/check/testdata/interface/fail_todo_assoc_const_default.carbon @@ -13,10 +13,18 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/fail_todo_assoc_const_default.carbon interface I { - // CHECK:STDERR: fail_todo_assoc_const_default.carbon:[[@LINE+2]]:3-9: error: semantics TODO: `interface modifier` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_assoc_const_default.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ default let T: type = (i32, i32); + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `interface modifier` [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: default let T: type = (i32, i32); - // CHECK:STDERR: fail_todo_assoc_const_default.carbon:[[@LINE+2]]:3-9: error: semantics TODO: `interface modifier` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_assoc_const_default.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ default let N: i32 = 42; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `interface modifier` [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: default let N: i32 = 42; } @@ -85,21 +93,21 @@ interface I { // CHECK:STDOUT: !with Self: // CHECK:STDOUT: %T: type = assoc_const_decl @T [concrete] { // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.WithSelf.%T [concrete = constants.%assoc0.2ce] -// CHECK:STDOUT: %i32.loc18_26: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %i32.loc18_31: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %.loc18_34: %tuple.type.693 = tuple_literal (%i32.loc18_26, %i32.loc18_31) [concrete = constants.%tuple] -// CHECK:STDOUT: %.loc18_35: type = converted %.loc18_34, constants.%tuple.type.35f [concrete = constants.%tuple.type.35f] +// CHECK:STDOUT: %i32.loc22_26: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc22_31: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc22_34: %tuple.type.693 = tuple_literal (%i32.loc22_26, %i32.loc22_31) [concrete = constants.%tuple] +// CHECK:STDOUT: %.loc22_35: type = converted %.loc22_34, constants.%tuple.type.35f [concrete = constants.%tuple.type.35f] // CHECK:STDOUT: } // CHECK:STDOUT: %N: %i32 = assoc_const_decl @N [concrete] { // CHECK:STDOUT: %assoc1: %I.assoc_type = assoc_entity element1, @I.WithSelf.%N [concrete = constants.%assoc1] // CHECK:STDOUT: %int_42: Core.IntLiteral = int_value 42 [concrete = constants.%int_42.20e] // CHECK:STDOUT: %impl.elem0: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc21_26.1: = bound_method %int_42, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %bound_method.loc29_26.1: = bound_method %int_42, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] // CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc21_26.2: = bound_method %int_42, %specific_fn [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc21_26.2(%int_42) [concrete = constants.%int_42.db5] -// CHECK:STDOUT: %.loc21_26.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_42.db5] -// CHECK:STDOUT: %.loc21_26.2: %i32 = converted %int_42, %.loc21_26.1 [concrete = constants.%int_42.db5] +// CHECK:STDOUT: %bound_method.loc29_26.2: = bound_method %int_42, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc29_26.2(%int_42) [concrete = constants.%int_42.db5] +// CHECK:STDOUT: %.loc29_26.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_42.db5] +// CHECK:STDOUT: %.loc29_26.2: %i32 = converted %int_42, %.loc29_26.1 [concrete = constants.%int_42.db5] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: diff --git a/toolchain/check/testdata/interface/fail_type_as_facet.carbon b/toolchain/check/testdata/interface/fail_type_as_facet.carbon index 41369965d8bb..b585abcd5daa 100644 --- a/toolchain/check/testdata/interface/fail_type_as_facet.carbon +++ b/toolchain/check/testdata/interface/fail_type_as_facet.carbon @@ -12,8 +12,16 @@ interface I { let T: type; - // CHECK:STDERR: fail_type_as_facet.carbon:[[@LINE+3]]:17: error: cannot implicitly convert non-type value of type `T` to `type` [ConversionFailureNonTypeToFacet] - // CHECK:STDERR: fail_type_as_facet.carbon:[[@LINE+2]]:17: note: type `Self.(TODO: element 0 in incomplete Self as I)` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_type_as_facet.carbon:[[@LINE+11]]:17 + // CHECK:STDERR: -> │ fn F[X: T](x: X); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert non-type value of type `T` + // CHECK:STDERR: · │ ┃ to `type` + // CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: · ╰────┤ type `Self.(TODO: element 0 in incomplete Self as I)` + // CHECK:STDERR: · │ does not implement interface `Core.ImplicitAs(type)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn F[X: T](x: X); } diff --git a/toolchain/check/testdata/interface/generic.carbon b/toolchain/check/testdata/interface/generic.carbon index 9ac49cf02283..f5c091809e3e 100644 --- a/toolchain/check/testdata/interface/generic.carbon +++ b/toolchain/check/testdata/interface/generic.carbon @@ -52,8 +52,18 @@ class B {} fn F(generic T: Generic(A)); fn G(generic T: Generic(B)) { - // CHECK:STDERR: fail_mismatched_args.carbon:[[@LINE+3]]:3-6: error: cannot convert type `T` that implements `Generic(B)` into type implementing `Generic(A)` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_mismatched_args.carbon:[[@LINE-3]]:14-26: note: initializing generic parameter `T` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_mismatched_args.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn F(generic T: Generic(A)); + // CHECK:STDERR: · ──────┬────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F(T); + // CHECK:STDERR: · ┳━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `T` that implements `Generic(B)` into type + // CHECK:STDERR: · ┃ implementing `Generic(A)` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F(T); } @@ -63,8 +73,17 @@ library "[[@TEST_NAME]]"; interface Generic(T: type) {} -// CHECK:STDERR: fail_args_count_mismatch.carbon:[[@LINE+3]]:24-38: error: 2 arguments passed to generic interface expecting 1 argument [CallArgCountMismatch] -// CHECK:STDERR: fail_args_count_mismatch.carbon:[[@LINE-3]]:1-28: note: calling generic interface declared here [InCallToEntity] +// CHECK:STDERR: ╭─┤ fail_args_count_mismatch.carbon:[[@LINE+12]]:24 +// CHECK:STDERR: │ interface Generic(T: type) {} +// CHECK:STDERR: · ──────────────┬───────────── +// CHECK:STDERR: · ╰──┤ calling generic interface declared here [InCallToEntity] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn F(unused generic T: Generic((), ())) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: 2 arguments passed to generic interface +// CHECK:STDERR: · ┃ expecting 1 argument +// CHECK:STDERR: · ┃ [CallArgCountMismatch] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused generic T: Generic((), ())) {} @@ -587,13 +606,13 @@ fn F(unused generic T: Generic((), ())) {} // CHECK:STDOUT: %T.loc10_15.1: %Generic.type.a24 = symbolic_binding T, 0 [symbolic = %T.loc10_15.1 (constants.%T.ec1)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %T.as_type.loc14_6.2: type = facet_access_type %T.loc10_15.1 [symbolic = %T.as_type.loc14_6.2 (constants.%T.as_type)] +// CHECK:STDOUT: %T.as_type.loc24_6.2: type = facet_access_type %T.loc10_15.1 [symbolic = %T.as_type.loc24_6.2 (constants.%T.as_type)] // CHECK:STDOUT: // CHECK:STDOUT: fn() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] // CHECK:STDOUT: %T.ref: %Generic.type.a24 = name_ref T, %T.loc10_15.2 [symbolic = %T.loc10_15.1 (constants.%T.ec1)] -// CHECK:STDOUT: %T.as_type.loc14_6.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc14_6.2 (constants.%T.as_type)] +// CHECK:STDOUT: %T.as_type.loc24_6.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc24_6.2 (constants.%T.as_type)] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -663,8 +682,8 @@ fn F(unused generic T: Generic((), ())) {} // CHECK:STDOUT: %.1: = splice_block [concrete = ] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %Generic.ref: %Generic.type.30d = name_ref Generic, file.%Generic.decl [concrete = constants.%Generic.generic] -// CHECK:STDOUT: %.loc8_33: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_37: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc17_33: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc17_37: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] // CHECK:STDOUT: } // CHECK:STDOUT: %T: = symbolic_binding T, 0 [concrete = ] // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/interface/generic_vs_params.carbon b/toolchain/check/testdata/interface/generic_vs_params.carbon index 870a88f4fa4d..c6692bad1c3a 100644 --- a/toolchain/check/testdata/interface/generic_vs_params.carbon +++ b/toolchain/check/testdata/interface/generic_vs_params.carbon @@ -36,7 +36,12 @@ impl X as C(X).GenericAndParams(X) {} library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_non_generic_implicit_params.carbon:[[@LINE+2]]:13-27: error: parameters of generic types must be constant [GenericParamMustBeConstant] +// CHECK:STDERR: ╭─┤ fail_non_generic_implicit_params.carbon:[[@LINE+7]]:13 +// CHECK:STDERR: -> │ interface A[runtime T: type]() {} +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: parameters of generic types must be constant +// CHECK:STDERR: · ┃ [GenericParamMustBeConstant] +// CHECK:STDERR: ╰──── // CHECK:STDERR: interface A[runtime T: type]() {} @@ -44,7 +49,12 @@ interface A[runtime T: type]() {} library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_non_generic_params.carbon:[[@LINE+2]]:13-27: error: parameters of generic types must be constant [GenericParamMustBeConstant] +// CHECK:STDERR: ╭─┤ fail_non_generic_params.carbon:[[@LINE+7]]:13 +// CHECK:STDERR: -> │ interface A(runtime T: type) {} +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: parameters of generic types must be constant +// CHECK:STDERR: · ┃ [GenericParamMustBeConstant] +// CHECK:STDERR: ╰──── // CHECK:STDERR: interface A(runtime T: type) {} @@ -52,7 +62,12 @@ interface A(runtime T: type) {} library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_implicit_params_only_empty.carbon:[[@LINE+2]]:14-15: error: expected explicit parameters after implicit parameters [GenericMissingExplicitParameters] +// CHECK:STDERR: ╭─┤ fail_implicit_params_only_empty.carbon:[[@LINE+7]]:14 +// CHECK:STDERR: -> │ interface Bar[] {} +// CHECK:STDERR: · ━┳ +// CHECK:STDERR: · ┗━━┫ error: expected explicit parameters after implicit parameters +// CHECK:STDERR: · ┃ [GenericMissingExplicitParameters] +// CHECK:STDERR: ╰──── // CHECK:STDERR: interface Bar[] {} @@ -60,7 +75,12 @@ interface Bar[] {} library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_implicit_params_only.carbon:[[@LINE+2]]:14-22: error: expected explicit parameters after implicit parameters [GenericMissingExplicitParameters] +// CHECK:STDERR: ╭─┤ fail_implicit_params_only.carbon:[[@LINE+7]]:14 +// CHECK:STDERR: -> │ interface Bar[T: type] {} +// CHECK:STDERR: · ━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: expected explicit parameters after implicit parameters +// CHECK:STDERR: · ┃ [GenericMissingExplicitParameters] +// CHECK:STDERR: ╰──── // CHECK:STDERR: interface Bar[T: type] {} @@ -563,30 +583,30 @@ interface Bar[T: type] {} // CHECK:STDOUT: .Bar = %Bar.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Bar.decl: %Bar.type.3f0 = interface_decl @Bar [concrete = constants.%Bar.generic] { -// CHECK:STDOUT: %T.patt.loc6_16.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_16.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.patt.loc11_16.1: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_16.2 (constants.%T.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc6_18.1: type = splice_block %.loc6_18.2 [concrete = type] { +// CHECK:STDOUT: %.loc11_18.1: type = splice_block %.loc11_18.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc6_18.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc11_18.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc6_16.2: type = symbolic_binding T, 0 [symbolic = %T.loc6_16.1 (constants.%T)] +// CHECK:STDOUT: %T.loc11_16.2: type = symbolic_binding T, 0 [symbolic = %T.loc11_16.1 (constants.%T)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @Bar(%T.loc6_16.2: type) { -// CHECK:STDOUT: %T.patt.loc6_16.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_16.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc6_16.1: type = symbolic_binding T, 0 [symbolic = %T.loc6_16.1 (constants.%T)] +// CHECK:STDOUT: generic interface @Bar(%T.loc11_16.2: type) { +// CHECK:STDOUT: %T.patt.loc11_16.2: %pattern_type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc11_16.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc11_16.1: type = symbolic_binding T, 0 [symbolic = %T.loc11_16.1 (constants.%T)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Bar.type: type = facet_type <@Bar, @Bar(%T.loc6_16.1)> [symbolic = %Bar.type (constants.%Bar.type.223)] -// CHECK:STDOUT: %Self.loc6_24.2: @Bar.%Bar.type (%Bar.type.223) = symbolic_binding Self, 1 [symbolic = %Self.loc6_24.2 (constants.%Self)] +// CHECK:STDOUT: %Bar.type: type = facet_type <@Bar, @Bar(%T.loc11_16.1)> [symbolic = %Bar.type (constants.%Bar.type.223)] +// CHECK:STDOUT: %Self.loc11_24.2: @Bar.%Bar.type (%Bar.type.223) = symbolic_binding Self, 1 [symbolic = %Self.loc11_24.2 (constants.%Self)] // CHECK:STDOUT: // CHECK:STDOUT: interface { -// CHECK:STDOUT: %Self.loc6_24.1: @Bar.%Bar.type (%Bar.type.223) = symbolic_binding Self, 1 [symbolic = %Self.loc6_24.2 (constants.%Self)] +// CHECK:STDOUT: %Self.loc11_24.1: @Bar.%Bar.type (%Bar.type.223) = symbolic_binding Self, 1 [symbolic = %Self.loc11_24.2 (constants.%Self)] // CHECK:STDOUT: %Bar.WithSelf.decl = interface_with_self_decl @Bar [concrete] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.loc6_24.1 +// CHECK:STDOUT: .Self = %Self.loc11_24.1 // CHECK:STDOUT: witness = () // CHECK:STDOUT: // CHECK:STDOUT: !requires: @@ -594,8 +614,8 @@ interface Bar[T: type] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Bar(constants.%T) { -// CHECK:STDOUT: %T.patt.loc6_16.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc6_16.1 => constants.%T +// CHECK:STDOUT: %T.patt.loc11_16.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc11_16.1 => constants.%T // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Bar.WithSelf(constants.%T, constants.%Self) {} diff --git a/toolchain/check/testdata/interface/import_access.carbon b/toolchain/check/testdata/interface/import_access.carbon index 37a0ca14e344..45ad2e798954 100644 --- a/toolchain/check/testdata/interface/import_access.carbon +++ b/toolchain/check/testdata/interface/import_access.carbon @@ -53,7 +53,11 @@ package Test library "[[@TEST_NAME]]"; import library "def"; -// CHECK:STDERR: fail_local_def.carbon:[[@LINE+2]]:16-18: error: name `Def` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_local_def.carbon:[[@LINE+6]]:16 +// CHECK:STDERR: -> │ fn F(unused i: Def) {} +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┗━━┫ error: name `Def` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused i: Def) {} @@ -63,7 +67,12 @@ package Other library "[[@TEST_NAME]]"; import Test library "def"; -// CHECK:STDERR: fail_other_def.carbon:[[@LINE+2]]:16-23: error: member name `Def` not found in `Test` [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╭─┤ fail_other_def.carbon:[[@LINE+7]]:16 +// CHECK:STDERR: -> │ fn F(unused i: Test.Def) {} +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: member name `Def` not found in `Test` +// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused i: Test.Def) {} @@ -79,7 +88,11 @@ package Test library "[[@TEST_NAME]]"; import library "forward_with_def"; -// CHECK:STDERR: fail_local_forward_with_def.carbon:[[@LINE+2]]:16-29: error: name `ForwardWithDef` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_local_forward_with_def.carbon:[[@LINE+6]]:16 +// CHECK:STDERR: -> │ fn F(unused i: ForwardWithDef) {} +// CHECK:STDERR: · ━━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: name `ForwardWithDef` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused i: ForwardWithDef) {} @@ -89,7 +102,12 @@ package Other library "[[@TEST_NAME]]"; import Test library "forward_with_def"; -// CHECK:STDERR: fail_other_forward_with_def.carbon:[[@LINE+2]]:16-34: error: member name `ForwardWithDef` not found in `Test` [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╭─┤ fail_other_forward_with_def.carbon:[[@LINE+7]]:16 +// CHECK:STDERR: -> │ fn F(unused i: Test.ForwardWithDef) {} +// CHECK:STDERR: · ━━━━━┳━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: member name `ForwardWithDef` not found in `Test` +// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused i: Test.ForwardWithDef) {} @@ -97,13 +115,25 @@ fn F(unused i: Test.ForwardWithDef) {} impl package Test library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_todo_forward.impl.carbon:[[@LINE+3]]:16-22: error: name `Forward` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_todo_forward.impl.carbon:[[@LINE+17]]:16 +// CHECK:STDERR: -> │ fn F(unused i: Forward*) {} +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: name `Forward` not found [NameNotFound] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: +// CHECK:STDERR: ╭─┤ fail_todo_forward.impl.carbon:[[@LINE+11]]:16 +// CHECK:STDERR: -> │ fn F(unused i: Forward*) {} +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: name `Forward` used before it was declared +// CHECK:STDERR: · ┃ [NameUseBeforeDecl] +// CHECK:STDERR: │ +// CHECK:STDERR: │ interface Forward {} +// CHECK:STDERR: · ───┬─── +// CHECK:STDERR: · ╰──┤ declared here [NameUseBeforeDeclNote] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_todo_forward.impl.carbon:[[@LINE+1]]:16-22: error: name `Forward` used before it was declared [NameUseBeforeDecl] fn F(unused i: Forward*) {} -// CHECK:STDERR: fail_todo_forward.impl.carbon:[[@LINE+2]]:11-17: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: interface Forward {} // --- fail_local_forward.carbon @@ -112,7 +142,11 @@ package Test library "[[@TEST_NAME]]"; import library "forward"; -// CHECK:STDERR: fail_local_forward.carbon:[[@LINE+2]]:16-22: error: name `Forward` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_local_forward.carbon:[[@LINE+6]]:16 +// CHECK:STDERR: -> │ fn F(unused i: Forward*) {} +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: name `Forward` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused i: Forward*) {} @@ -122,7 +156,11 @@ package Other library "[[@TEST_NAME]]"; import Test library "forward"; -// CHECK:STDERR: fail_other_forward.carbon:[[@LINE+2]]:16-22: error: name `Forward` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_other_forward.carbon:[[@LINE+6]]:16 +// CHECK:STDERR: -> │ fn F(unused i: Forward*) {} +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: name `Forward` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused i: Forward*) {} @@ -459,7 +497,7 @@ private interface Redecl {} // CHECK:STDOUT: %i.patt: = wrapper_binding_pattern i, %i.param_patt [concrete = ] // CHECK:STDOUT: } { // CHECK:STDOUT: %i.param: = value_param call_param0 -// CHECK:STDOUT: %.loc7: type = splice_block %ptr [concrete = ] { +// CHECK:STDOUT: %.loc21: type = splice_block %ptr [concrete = ] { // CHECK:STDOUT: %Forward.ref: = name_ref Forward, [concrete = ] // CHECK:STDOUT: %ptr: type = ptr_type [concrete = ] // CHECK:STDOUT: } @@ -505,7 +543,7 @@ private interface Redecl {} // CHECK:STDOUT: %i.patt: = wrapper_binding_pattern i, %i.param_patt [concrete = ] // CHECK:STDOUT: } { // CHECK:STDOUT: %i.param: = value_param call_param0 -// CHECK:STDOUT: %.loc8: type = splice_block %ptr [concrete = ] { +// CHECK:STDOUT: %.loc12: type = splice_block %ptr [concrete = ] { // CHECK:STDOUT: %Forward.ref: = name_ref Forward, [concrete = ] // CHECK:STDOUT: %ptr: type = ptr_type [concrete = ] // CHECK:STDOUT: } @@ -544,7 +582,7 @@ private interface Redecl {} // CHECK:STDOUT: %i.patt: = wrapper_binding_pattern i, %i.param_patt [concrete = ] // CHECK:STDOUT: } { // CHECK:STDOUT: %i.param: = value_param call_param0 -// CHECK:STDOUT: %.loc8: type = splice_block %ptr [concrete = ] { +// CHECK:STDOUT: %.loc12: type = splice_block %ptr [concrete = ] { // CHECK:STDOUT: %Forward.ref: = name_ref Forward, [concrete = ] // CHECK:STDOUT: %ptr: type = ptr_type [concrete = ] // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/interface/import_interface_decl.carbon b/toolchain/check/testdata/interface/import_interface_decl.carbon index 270be01c38e8..5ef1b5737557 100644 --- a/toolchain/check/testdata/interface/import_interface_decl.carbon +++ b/toolchain/check/testdata/interface/import_interface_decl.carbon @@ -21,7 +21,11 @@ impl library "[[@TEST_NAME]]"; // --- fail_b.carbon library "[[@TEST_NAME]]"; interface B {} -// CHECK:STDERR: fail_b.carbon:[[@LINE+2]]:1-13: error: impl declared but not defined [ImplMissingDefinition] +// CHECK:STDERR: ╭─┤ fail_b.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ impl () as B; +// CHECK:STDERR: · ━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: impl declared but not defined [ImplMissingDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as B; @@ -55,8 +59,8 @@ impl library "[[@TEST_NAME]]"; // CHECK:STDOUT: imports { // CHECK:STDOUT: %Main.B = import_ref Main//b, B, unloaded // CHECK:STDOUT: %Main.import_ref.c07 = import_ref Main//b, loc2_13, unloaded -// CHECK:STDOUT: %Main.import_ref.e5c: type = import_ref Main//b, loc5_7, loaded [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %Main.import_ref.21a: type = import_ref Main//b, loc5_12, loaded [concrete = constants.%B.type] +// CHECK:STDOUT: %Main.import_ref.e5c: type = import_ref Main//b, loc9_7, loaded [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %Main.import_ref.21a: type = import_ref Main//b, loc9_12, loaded [concrete = constants.%B.type] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { diff --git a/toolchain/check/testdata/interface/incomplete.carbon b/toolchain/check/testdata/interface/incomplete.carbon index bbace1a870a8..838b6fa004a0 100644 --- a/toolchain/check/testdata/interface/incomplete.carbon +++ b/toolchain/check/testdata/interface/incomplete.carbon @@ -30,8 +30,16 @@ interface I { let T: C; } -// CHECK:STDERR: fail_incomplete_type_impl.carbon:[[@LINE+3]]:26-32: error: invalid use of incomplete type `C` [IncompleteTypeInConversion] -// CHECK:STDERR: fail_incomplete_type_impl.carbon:[[@LINE-7]]:1-8: note: class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: ╭─┤ fail_incomplete_type_impl.carbon:[[@LINE+11]]:26 +// CHECK:STDERR: │ class C; +// CHECK:STDERR: · ────┬─── +// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ impl {} as I where .T = ({} as C) {} +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid use of incomplete type `C` +// CHECK:STDERR: · ┃ [IncompleteTypeInConversion] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl {} as I where .T = ({} as C) {} @@ -55,8 +63,18 @@ library "[[@TEST_NAME]]"; constraint A; interface B { - // CHECK:STDERR: fail_incomplete_extend_constraint.carbon:[[@LINE+3]]:24: error: facet type `A` cannot be identified in `require` declaration [RequireImplsUnidentifiedFacetType] - // CHECK:STDERR: fail_incomplete_extend_constraint.carbon:[[@LINE-4]]:1-13: note: constraint was forward declared here [NamedConstraintForwardDeclaredHere] + // CHECK:STDERR: ╭─┤ fail_incomplete_extend_constraint.carbon:[[@LINE+13]]:24 + // CHECK:STDERR: │ constraint A; + // CHECK:STDERR: · ──────┬────── + // CHECK:STDERR: · ╰──┤ constraint was forward declared here + // CHECK:STDERR: · │ [NamedConstraintForwardDeclaredHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ extend require impls A; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: facet type `A` cannot be identified in + // CHECK:STDERR: · ┃ `require` declaration + // CHECK:STDERR: · ┃ [RequireImplsUnidentifiedFacetType] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend require impls A; } @@ -65,8 +83,17 @@ interface B { library "[[@TEST_NAME]]"; interface A { - // CHECK:STDERR: fail_extend_require_enclosing.carbon:[[@LINE+3]]:24: error: `extend require` of incomplete facet type `A` [RequireImplsIncompleteFacetType] - // CHECK:STDERR: fail_extend_require_enclosing.carbon:[[@LINE-2]]:1-13: note: interface is currently being defined [InterfaceIncompleteWithinDefinition] + // CHECK:STDERR: ╭─┤ fail_extend_require_enclosing.carbon:[[@LINE+12]]:24 + // CHECK:STDERR: │ interface A { + // CHECK:STDERR: · ──────┬────── + // CHECK:STDERR: · ╰──┤ interface is currently being defined + // CHECK:STDERR: · │ [InterfaceIncompleteWithinDefinition] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ extend require impls A; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: `extend require` of incomplete facet type `A` + // CHECK:STDERR: · ┃ [RequireImplsIncompleteFacetType] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend require impls A; } @@ -75,8 +102,18 @@ interface A { library "[[@TEST_NAME]]"; interface A(T: type) { - // CHECK:STDERR: fail_extend_require_enclosing_generic.carbon:[[@LINE+3]]:24-28: error: `extend require` of incomplete facet type `A({})` [RequireImplsIncompleteFacetType] - // CHECK:STDERR: fail_extend_require_enclosing_generic.carbon:[[@LINE-2]]:1-22: note: interface is currently being defined [InterfaceIncompleteWithinDefinition] + // CHECK:STDERR: ╭─┤ fail_extend_require_enclosing_generic.carbon:[[@LINE+13]]:24 + // CHECK:STDERR: │ interface A(T: type) { + // CHECK:STDERR: · ───────────┬────────── + // CHECK:STDERR: · ╰──┤ interface is currently being defined + // CHECK:STDERR: · │ [InterfaceIncompleteWithinDefinition] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ extend require impls A({}); + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: `extend require` of incomplete facet type + // CHECK:STDERR: · ┃ `A({})` + // CHECK:STDERR: · ┃ [RequireImplsIncompleteFacetType] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend require impls A({}); } @@ -152,24 +189,24 @@ interface A(T: type) { // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {} // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {} // CHECK:STDOUT: impl_decl @empty_struct_type.as..impl [concrete] {} { -// CHECK:STDOUT: %.loc12_7.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc12_7.2: type = converted %.loc12_7.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc20_7.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc20_7.2: type = converted %.loc20_7.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] // CHECK:STDOUT: %.Self.frozen: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] // CHECK:STDOUT: %.Self.ref: %I.type = name_ref .Self, %.Self.frozen [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc12_20: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc20_20: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.frozen.as_type] // CHECK:STDOUT: %T.ref: %I.assoc_type = name_ref T, @T.%assoc0 [concrete = constants.%assoc0] -// CHECK:STDOUT: %impl.elem0.loc12_20.1: %C = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.419] -// CHECK:STDOUT: %.loc12_27: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %impl.elem0.loc20_20.1: %C = impl_witness_access constants.%.f01, element0 [symbolic_self = constants.%impl.elem0.419] +// CHECK:STDOUT: %.loc20_27: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %rewrite.loc12_23.1 = requirement_rewrite %impl.elem0.loc12_20.1, [concrete] -// CHECK:STDOUT: %impl.elem0.loc12_20.2: %C = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.adf] -// CHECK:STDOUT: %rewrite.loc12_23.2 = requirement_rewrite %impl.elem0.loc12_20.2, [concrete] -// CHECK:STDOUT: %.loc12_14: type = where_expr [concrete = ] { +// CHECK:STDOUT: %rewrite.loc20_23.1 = requirement_rewrite %impl.elem0.loc20_20.1, [concrete] +// CHECK:STDOUT: %impl.elem0.loc20_20.2: %C = impl_witness_access constants.%.00f, element0 [symbolic_self = constants.%impl.elem0.adf] +// CHECK:STDOUT: %rewrite.loc20_23.2 = requirement_rewrite %impl.elem0.loc20_20.2, [concrete] +// CHECK:STDOUT: %.loc20_14: type = where_expr [concrete = ] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] -// CHECK:STDOUT: %rewrite.loc12_23.2 = requirement_rewrite %impl.elem0.loc12_20.2, [concrete] +// CHECK:STDOUT: %rewrite.loc20_23.2 = requirement_rewrite %impl.elem0.loc20_20.2, [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -193,7 +230,7 @@ interface A(T: type) { // CHECK:STDOUT: !requires: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: impl @empty_struct_type.as..impl: %.loc12_7.2 as { +// CHECK:STDOUT: impl @empty_struct_type.as..impl: %.loc20_7.2 as { // CHECK:STDOUT: !members: // CHECK:STDOUT: extend // CHECK:STDOUT: witness = @@ -379,9 +416,9 @@ interface A(T: type) { // CHECK:STDOUT: // CHECK:STDOUT: !with Self: // CHECK:STDOUT: %A.WithSelf.Self.as_type.impls.A.type.require.decl = require_decl @A.WithSelf.Self.as_type.impls.A.type.require [concrete] { -// CHECK:STDOUT: require %Self.as_type.loc7_18.1 impls %A.ref +// CHECK:STDOUT: require %Self.as_type.loc16_18.1 impls %A.ref // CHECK:STDOUT: } { -// CHECK:STDOUT: %Self.as_type.loc7_18.1: type = facet_access_type @A.%Self [symbolic = %Self.as_type.loc7_18.2 (constants.%Self.as_type)] +// CHECK:STDOUT: %Self.as_type.loc16_18.1: type = facet_access_type @A.%Self [symbolic = %Self.as_type.loc16_18.2 (constants.%Self.as_type)] // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A.type] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -396,14 +433,14 @@ interface A(T: type) { // CHECK:STDOUT: // CHECK:STDOUT: generic require @A.WithSelf.Self.as_type.impls.A.type.require(@A.%Self: %A.type) { // CHECK:STDOUT: %Self: %A.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type.loc7_18.2: type = facet_access_type %Self [symbolic = %Self.as_type.loc7_18.2 (constants.%Self.as_type)] +// CHECK:STDOUT: %Self.as_type.loc16_18.2: type = facet_access_type %Self [symbolic = %Self.as_type.loc16_18.2 (constants.%Self.as_type)] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @A.WithSelf(constants.%Self) {} // CHECK:STDOUT: // CHECK:STDOUT: specific @A.WithSelf.Self.as_type.impls.A.type.require(constants.%Self) { // CHECK:STDOUT: %Self => constants.%Self -// CHECK:STDOUT: %Self.as_type.loc7_18.2 => constants.%Self.as_type +// CHECK:STDOUT: %Self.as_type.loc16_18.2 => constants.%Self.as_type // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_extend_require_enclosing_generic.carbon @@ -453,13 +490,13 @@ interface A(T: type) { // CHECK:STDOUT: // CHECK:STDOUT: !with Self: // CHECK:STDOUT: %A.WithSelf.Self.as_type.impls.A.type.require.decl = require_decl @A.WithSelf.Self.as_type.impls.A.type.require [concrete] { -// CHECK:STDOUT: require %Self.as_type.loc7_18.1 impls %A.type.loc7_28 +// CHECK:STDOUT: require %Self.as_type.loc17_18.1 impls %A.type.loc17_28 // CHECK:STDOUT: } { -// CHECK:STDOUT: %Self.as_type.loc7_18.1: type = facet_access_type @A.%Self.loc3_22.1 [symbolic = %Self.as_type.loc7_18.2 (constants.%Self.as_type)] +// CHECK:STDOUT: %Self.as_type.loc17_18.1: type = facet_access_type @A.%Self.loc3_22.1 [symbolic = %Self.as_type.loc17_18.2 (constants.%Self.as_type)] // CHECK:STDOUT: %A.ref: %A.type.55a = name_ref A, file.%A.decl [concrete = constants.%A.generic] -// CHECK:STDOUT: %.loc7_27: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc7_28: type = converted %.loc7_27, constants.%empty_struct_type [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %A.type.loc7_28: type = facet_type <@A, @A(constants.%empty_struct_type)> [concrete = constants.%A.type.ae6] +// CHECK:STDOUT: %.loc17_27: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc17_28: type = converted %.loc17_27, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %A.type.loc17_28: type = facet_type <@A, @A(constants.%empty_struct_type)> [concrete = constants.%A.type.ae6] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -474,9 +511,9 @@ interface A(T: type) { // CHECK:STDOUT: // CHECK:STDOUT: generic require @A.WithSelf.Self.as_type.impls.A.type.require(@A.%T.loc3_14.2: type, @A.%Self.loc3_22.1: @A.%A.type (%A.type.fa0)) { // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic = %T (constants.%T)] -// CHECK:STDOUT: %A.type.loc7_18: type = facet_type <@A, @A(%T)> [symbolic = %A.type.loc7_18 (constants.%A.type.fa0)] -// CHECK:STDOUT: %Self: @A.WithSelf.Self.as_type.impls.A.type.require.%A.type.loc7_18 (%A.type.fa0) = symbolic_binding Self, 1 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type.loc7_18.2: type = facet_access_type %Self [symbolic = %Self.as_type.loc7_18.2 (constants.%Self.as_type)] +// CHECK:STDOUT: %A.type.loc17_18: type = facet_type <@A, @A(%T)> [symbolic = %A.type.loc17_18 (constants.%A.type.fa0)] +// CHECK:STDOUT: %Self: @A.WithSelf.Self.as_type.impls.A.type.require.%A.type.loc17_18 (%A.type.fa0) = symbolic_binding Self, 1 [symbolic = %Self (constants.%Self)] +// CHECK:STDOUT: %Self.as_type.loc17_18.2: type = facet_access_type %Self [symbolic = %Self.as_type.loc17_18.2 (constants.%Self.as_type)] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @A(constants.%T) { @@ -493,8 +530,8 @@ interface A(T: type) { // CHECK:STDOUT: // CHECK:STDOUT: specific @A.WithSelf.Self.as_type.impls.A.type.require(constants.%T, constants.%Self) { // CHECK:STDOUT: %T => constants.%T -// CHECK:STDOUT: %A.type.loc7_18 => constants.%A.type.fa0 +// CHECK:STDOUT: %A.type.loc17_18 => constants.%A.type.fa0 // CHECK:STDOUT: %Self => constants.%Self -// CHECK:STDOUT: %Self.as_type.loc7_18.2 => constants.%Self.as_type +// CHECK:STDOUT: %Self.as_type.loc17_18.2 => constants.%Self.as_type // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/member_lookup.carbon b/toolchain/check/testdata/interface/member_lookup.carbon index 9182514c8967..2fe41906ea7d 100644 --- a/toolchain/check/testdata/interface/member_lookup.carbon +++ b/toolchain/check/testdata/interface/member_lookup.carbon @@ -37,13 +37,23 @@ interface Interface(T: type) { } fn AccessMissingGeneric[T: type](generic I: Interface(T)) -> T { - // CHECK:STDERR: fail_no_member.carbon:[[@LINE+2]]:10-19: error: member name `nonesuch` not found in `Interface(T)` [MemberNameNotFoundInSpecificScope] + // CHECK:STDERR: ╭─┤ fail_no_member.carbon:[[@LINE+7]]:10 + // CHECK:STDERR: -> │ return I.nonesuch; + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: member name `nonesuch` not found in `Interface(T)` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInSpecificScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return I.nonesuch; } fn AccessMissingConcrete(generic I: Interface(i32)) -> i32 { - // CHECK:STDERR: fail_no_member.carbon:[[@LINE+2]]:10-19: error: member name `nonesuch` not found in `Interface(i32)` [MemberNameNotFoundInSpecificScope] + // CHECK:STDERR: ╭─┤ fail_no_member.carbon:[[@LINE+7]]:10 + // CHECK:STDERR: -> │ return I.nonesuch; + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: member name `nonesuch` not found in `Interface(i32)` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInSpecificScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return I.nonesuch; } @@ -469,19 +479,19 @@ fn AccessMissingConcrete(generic I: Interface(i32)) -> i32 { // CHECK:STDOUT: %return: ref @AccessMissingGeneric.%T.loc8_26.1 (%T) = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: %AccessMissingConcrete.decl: %AccessMissingConcrete.type = fn_decl @AccessMissingConcrete [concrete = constants.%AccessMissingConcrete] { -// CHECK:STDOUT: %I.patt.loc14_35.1: %pattern_type.5c6 = symbolic_binding_pattern I, 0 [symbolic = %I.patt.loc14_35.2 (constants.%I.patt.e71)] +// CHECK:STDOUT: %I.patt.loc19_35.1: %pattern_type.5c6 = symbolic_binding_pattern I, 0 [symbolic = %I.patt.loc19_35.2 (constants.%I.patt.e71)] // CHECK:STDOUT: %return.param_patt: %pattern_type.d94 = out_param_pattern [concrete = constants.%return.param_patt.299] -// CHECK:STDOUT: %return.patt: %pattern_type.d94 = return_slot_pattern %return.param_patt, %i32.loc14_56 [concrete = constants.%return.patt.6fa] +// CHECK:STDOUT: %return.patt: %pattern_type.d94 = return_slot_pattern %return.param_patt, %i32.loc19_56 [concrete = constants.%return.patt.6fa] // CHECK:STDOUT: } { -// CHECK:STDOUT: %i32.loc14_56: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %.loc14_56: Core.Form = init_form %i32.loc14_56 [concrete = constants.%.0b3] -// CHECK:STDOUT: %.loc14_50: type = splice_block %Interface.type [concrete = constants.%Interface.type.5ec] { +// CHECK:STDOUT: %i32.loc19_56: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc19_56: Core.Form = init_form %i32.loc19_56 [concrete = constants.%.0b3] +// CHECK:STDOUT: %.loc19_50: type = splice_block %Interface.type [concrete = constants.%Interface.type.5ec] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %Interface.ref: %Interface.type.1b1 = name_ref Interface, file.%Interface.decl [concrete = constants.%Interface.generic] -// CHECK:STDOUT: %i32.loc14_47: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc19_47: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %Interface.type: type = facet_type <@Interface, @Interface(constants.%i32)> [concrete = constants.%Interface.type.5ec] // CHECK:STDOUT: } -// CHECK:STDOUT: %I.loc14_35.2: %Interface.type.5ec = symbolic_binding I, 0 [symbolic = %I.loc14_35.1 (constants.%I.eef)] +// CHECK:STDOUT: %I.loc19_35.2: %Interface.type.5ec = symbolic_binding I, 0 [symbolic = %I.loc19_35.1 (constants.%I.eef)] // CHECK:STDOUT: %return.param: ref %i32 = out_param call_param0 // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param // CHECK:STDOUT: } @@ -530,31 +540,31 @@ fn AccessMissingConcrete(generic I: Interface(i32)) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete.loc8: = require_complete_type %T.loc8_26.1 [symbolic = %require_complete.loc8 (constants.%require_complete.944)] -// CHECK:STDOUT: %require_complete.loc11: = require_complete_type %Interface.type.loc8_56.1 [symbolic = %require_complete.loc11 (constants.%require_complete.e4d)] -// CHECK:STDOUT: %I.as_type.loc11_11.2: type = facet_access_type %I.loc8_43.1 [symbolic = %I.as_type.loc11_11.2 (constants.%I.as_type.c4b)] +// CHECK:STDOUT: %require_complete.loc16: = require_complete_type %Interface.type.loc8_56.1 [symbolic = %require_complete.loc16 (constants.%require_complete.e4d)] +// CHECK:STDOUT: %I.as_type.loc16_11.2: type = facet_access_type %I.loc8_43.1 [symbolic = %I.as_type.loc16_11.2 (constants.%I.as_type.c4b)] // CHECK:STDOUT: // CHECK:STDOUT: fn() -> out %return.param: @AccessMissingGeneric.%T.loc8_26.1 (%T) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %I.ref: @AccessMissingGeneric.%Interface.type.loc8_56.1 (%Interface.type.128) = name_ref I, %I.loc8_43.2 [symbolic = %I.loc8_43.1 (constants.%I.165)] -// CHECK:STDOUT: %I.as_type.loc11_11.1: type = facet_access_type %I.ref [symbolic = %I.as_type.loc11_11.2 (constants.%I.as_type.c4b)] -// CHECK:STDOUT: %.loc11: type = converted %I.ref, %I.as_type.loc11_11.1 [symbolic = %I.as_type.loc11_11.2 (constants.%I.as_type.c4b)] +// CHECK:STDOUT: %I.as_type.loc16_11.1: type = facet_access_type %I.ref [symbolic = %I.as_type.loc16_11.2 (constants.%I.as_type.c4b)] +// CHECK:STDOUT: %.loc16: type = converted %I.ref, %I.as_type.loc16_11.1 [symbolic = %I.as_type.loc16_11.2 (constants.%I.as_type.c4b)] // CHECK:STDOUT: %nonesuch.ref: = name_ref nonesuch, [concrete = ] // CHECK:STDOUT: return to %return.param // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @AccessMissingConcrete(%I.loc14_35.2: %Interface.type.5ec) { -// CHECK:STDOUT: %I.patt.loc14_35.2: %pattern_type.5c6 = symbolic_binding_pattern I, 0 [symbolic = %I.patt.loc14_35.2 (constants.%I.patt.e71)] -// CHECK:STDOUT: %I.loc14_35.1: %Interface.type.5ec = symbolic_binding I, 0 [symbolic = %I.loc14_35.1 (constants.%I.eef)] +// CHECK:STDOUT: generic fn @AccessMissingConcrete(%I.loc19_35.2: %Interface.type.5ec) { +// CHECK:STDOUT: %I.patt.loc19_35.2: %pattern_type.5c6 = symbolic_binding_pattern I, 0 [symbolic = %I.patt.loc19_35.2 (constants.%I.patt.e71)] +// CHECK:STDOUT: %I.loc19_35.1: %Interface.type.5ec = symbolic_binding I, 0 [symbolic = %I.loc19_35.1 (constants.%I.eef)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %I.as_type.loc17_11.2: type = facet_access_type %I.loc14_35.1 [symbolic = %I.as_type.loc17_11.2 (constants.%I.as_type.bed)] +// CHECK:STDOUT: %I.as_type.loc27_11.2: type = facet_access_type %I.loc19_35.1 [symbolic = %I.as_type.loc27_11.2 (constants.%I.as_type.bed)] // CHECK:STDOUT: // CHECK:STDOUT: fn() -> out %return.param: %i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %I.ref: %Interface.type.5ec = name_ref I, %I.loc14_35.2 [symbolic = %I.loc14_35.1 (constants.%I.eef)] -// CHECK:STDOUT: %I.as_type.loc17_11.1: type = facet_access_type %I.ref [symbolic = %I.as_type.loc17_11.2 (constants.%I.as_type.bed)] -// CHECK:STDOUT: %.loc17: type = converted %I.ref, %I.as_type.loc17_11.1 [symbolic = %I.as_type.loc17_11.2 (constants.%I.as_type.bed)] +// CHECK:STDOUT: %I.ref: %Interface.type.5ec = name_ref I, %I.loc19_35.2 [symbolic = %I.loc19_35.1 (constants.%I.eef)] +// CHECK:STDOUT: %I.as_type.loc27_11.1: type = facet_access_type %I.ref [symbolic = %I.as_type.loc27_11.2 (constants.%I.as_type.bed)] +// CHECK:STDOUT: %.loc27: type = converted %I.ref, %I.as_type.loc27_11.1 [symbolic = %I.as_type.loc27_11.2 (constants.%I.as_type.bed)] // CHECK:STDOUT: %nonesuch.ref: = name_ref nonesuch, [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -608,8 +618,8 @@ fn AccessMissingConcrete(generic I: Interface(i32)) -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @AccessMissingConcrete(constants.%I.eef) { -// CHECK:STDOUT: %I.patt.loc14_35.2 => constants.%I.patt.e71 -// CHECK:STDOUT: %I.loc14_35.1 => constants.%I.eef +// CHECK:STDOUT: %I.patt.loc19_35.2 => constants.%I.patt.e71 +// CHECK:STDOUT: %I.loc19_35.1 => constants.%I.eef // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Interface.WithSelf(constants.%i32, constants.%Self.5b9) { diff --git a/toolchain/check/testdata/interface/modifiers.carbon b/toolchain/check/testdata/interface/modifiers.carbon index 22c988206fa8..7868e7b2ef1a 100644 --- a/toolchain/check/testdata/interface/modifiers.carbon +++ b/toolchain/check/testdata/interface/modifiers.carbon @@ -165,17 +165,37 @@ interface I { library "[[@TEST_NAME]]"; interface Modifiers { - // CHECK:STDERR: fail_todo_deferred_modifiers.carbon:[[@LINE+2]]:3-9: error: TODO: `default` modifier currently requires an inline definition [ModifierFinalRequiresDefaultImpl] + // CHECK:STDERR: ╭─┤ fail_todo_deferred_modifiers.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ default fn DefaultFunction(); + // CHECK:STDERR: · ━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: TODO: `default` modifier currently requires an inline definition + // CHECK:STDERR: · ┃ [ModifierFinalRequiresDefaultImpl] + // CHECK:STDERR: ╰──── // CHECK:STDERR: default fn DefaultFunction(); - // CHECK:STDERR: fail_todo_deferred_modifiers.carbon:[[@LINE+2]]:3-9: error: TODO: `default` modifier currently requires an inline definition [ModifierFinalRequiresDefaultImpl] + // CHECK:STDERR: ╭─┤ fail_todo_deferred_modifiers.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ default fn DefaultMethod(self); + // CHECK:STDERR: · ━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: TODO: `default` modifier currently requires an inline definition + // CHECK:STDERR: · ┃ [ModifierFinalRequiresDefaultImpl] + // CHECK:STDERR: ╰──── // CHECK:STDERR: default fn DefaultMethod(self); - // CHECK:STDERR: fail_todo_deferred_modifiers.carbon:[[@LINE+2]]:3-7: error: TODO: `final` modifier currently requires an inline definition [ModifierFinalRequiresDefaultImpl] + // CHECK:STDERR: ╭─┤ fail_todo_deferred_modifiers.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ final fn FinalFunction(); + // CHECK:STDERR: · ━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: TODO: `final` modifier currently requires an inline definition + // CHECK:STDERR: · ┃ [ModifierFinalRequiresDefaultImpl] + // CHECK:STDERR: ╰──── // CHECK:STDERR: final fn FinalFunction(); - // CHECK:STDERR: fail_todo_deferred_modifiers.carbon:[[@LINE+2]]:3-7: error: TODO: `final` modifier currently requires an inline definition [ModifierFinalRequiresDefaultImpl] + // CHECK:STDERR: ╭─┤ fail_todo_deferred_modifiers.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ final fn FinalMethod(self); + // CHECK:STDERR: · ━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: TODO: `final` modifier currently requires an inline definition + // CHECK:STDERR: · ┃ [ModifierFinalRequiresDefaultImpl] + // CHECK:STDERR: ╰──── // CHECK:STDERR: final fn FinalMethod(self); } @@ -186,8 +206,18 @@ library "[[@TEST_NAME]]"; import library "final_interfaces"; class C { - // CHECK:STDERR: fail_impl_final.carbon:[[@LINE+3]]:3-23: error: attempted to implement `M`, which is final in interface `FinalMethod` [ImplFinalFunction] - // CHECK:STDERR: final_interfaces.carbon:10:3-27: note: associated function M declared here [AssociatedFunctionHere] + // CHECK:STDERR: ╭─┤ fail_impl_final.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: -> │ impl as FinalMethod { + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: attempted to implement `M`, which is final in interface + // CHECK:STDERR: · ┃ `FinalMethod` + // CHECK:STDERR: · ┃ [ImplFinalFunction] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ final_interfaces.carbon + // CHECK:STDERR: │ final fn M(unused self) {} + // CHECK:STDERR: · ────────────┬──────────── + // CHECK:STDERR: · ╰──┤ associated function M declared here [AssociatedFunctionHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl as FinalMethod { fn M(unused self) { } @@ -199,10 +229,18 @@ class C { library "[[@TEST_NAME]]"; interface C { - // CHECK:STDERR: fail_modified_associated_constants.carbon:[[@LINE+2]]:3-9: error: semantics TODO: `interface modifier` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_modified_associated_constants.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ default let T: type = C; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `interface modifier` [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: default let T: type = C; - // CHECK:STDERR: fail_modified_associated_constants.carbon:[[@LINE+2]]:3-7: error: semantics TODO: `interface modifier` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_modified_associated_constants.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ final let U: type = C; + // CHECK:STDERR: · ━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `interface modifier` [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: final let U: type = C; } diff --git a/toolchain/check/testdata/interface/name_poisoning.carbon b/toolchain/check/testdata/interface/name_poisoning.carbon index 8796548c7b11..02a14082ee55 100644 --- a/toolchain/check/testdata/interface/name_poisoning.carbon +++ b/toolchain/check/testdata/interface/name_poisoning.carbon @@ -44,12 +44,20 @@ interface I; namespace N; // Use `package.I` and poison `N.I`. -// CHECK:STDERR: fail_declare_after_poison.carbon:[[@LINE+1]]:19: error: name `I` used before it was declared [NameUseBeforeDecl] +// CHECK:STDERR: ╭─┤ fail_declare_after_poison.carbon:[[@LINE+11]]:19 +// CHECK:STDERR: -> │ fn N.F(generic x: I); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: name `I` used before it was declared +// CHECK:STDERR: · ┃ [NameUseBeforeDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: │ interface N.I {} +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ declared here [NameUseBeforeDeclNote] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: fn N.F(generic x: I); // Failure: N.I declared after it was poisoned. -// CHECK:STDERR: fail_declare_after_poison.carbon:[[@LINE+2]]:13: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: interface N.I {} // --- fail_use_poison.carbon @@ -62,7 +70,12 @@ namespace N; // Use `package.I` and poison `N.I`. fn N.F1(generic x: I); -// CHECK:STDERR: fail_use_poison.carbon:[[@LINE+2]]:20-22: error: member name `I` not found in `N` [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╭─┤ fail_use_poison.carbon:[[@LINE+7]]:20 +// CHECK:STDERR: -> │ fn N.F2(generic x: N.I); +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┗━━┫ error: member name `I` not found in `N` +// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn N.F2(generic x: N.I); @@ -74,14 +87,27 @@ interface I; namespace N; // Use `package.I` and poison `N.I`. -// CHECK:STDERR: fail_use_declaration_after_poison.carbon:[[@LINE+1]]:20: error: name `I` used before it was declared [NameUseBeforeDecl] +// CHECK:STDERR: ╭─┤ fail_use_declaration_after_poison.carbon:[[@LINE+11]]:20 +// CHECK:STDERR: -> │ fn N.F1(generic x: I); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: name `I` used before it was declared +// CHECK:STDERR: · ┃ [NameUseBeforeDecl] +// CHECK:STDERR: │ +// CHECK:STDERR: │ interface N.I; +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ declared here [NameUseBeforeDeclNote] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: fn N.F1(generic x: I); -// CHECK:STDERR: fail_use_declaration_after_poison.carbon:[[@LINE+2]]:13: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: interface N.I; -// CHECK:STDERR: fail_use_declaration_after_poison.carbon:[[@LINE+2]]:20-22: error: member name `I` not found in `N` [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╭─┤ fail_use_declaration_after_poison.carbon:[[@LINE+7]]:20 +// CHECK:STDERR: -> │ fn N.F2(generic x: N.I); +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┗━━┫ error: member name `I` not found in `N` +// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn N.F2(generic x: N.I); @@ -92,8 +118,12 @@ library "[[@TEST_NAME]]"; interface I; namespace N; -// CHECK:STDERR: fail_alias.carbon:[[@LINE+3]]:13: error: name `I` used before it was declared [NameUseBeforeDecl] -// CHECK:STDERR: fail_alias.carbon:[[@LINE+2]]:9: note: declared here [NameUseBeforeDeclNote] +// CHECK:STDERR: ╭─┤ fail_alias.carbon:[[@LINE+7]]:13 +// CHECK:STDERR: -> │ alias N.I = I; +// CHECK:STDERR: · ┬ ┳ +// CHECK:STDERR: · │ ┗━━┫ error: name `I` used before it was declared [NameUseBeforeDecl] +// CHECK:STDERR: · ╰────────┤ declared here [NameUseBeforeDeclNote] +// CHECK:STDERR: ╰──── // CHECK:STDERR: alias N.I = I; @@ -110,21 +140,45 @@ interface I2 { // * `I2.I1` // * `I2.I3.I1` // * `I2.I3.I4.I1` - // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+1]]:23-24: error: name `I1` used before it was declared [NameUseBeforeDecl] + // CHECK:STDERR: ╭─┤ fail_poison_multiple_scopes.carbon:[[@LINE+33]]:23 + // CHECK:STDERR: -> │ fn F(generic x: I1); + // CHECK:STDERR: · ━┳ + // CHECK:STDERR: · ┗━━┫ error: name `I1` used before it was declared + // CHECK:STDERR: · ┃ [NameUseBeforeDecl] + // CHECK:STDERR: │ + // CHECK:STDERR: │ interface I1; + // CHECK:STDERR: · ─┬ + // CHECK:STDERR: · ╰──┤ declared here [NameUseBeforeDeclNote] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: + // CHECK:STDERR: ╭─┤ fail_poison_multiple_scopes.carbon:[[@LINE+22]]:23 + // CHECK:STDERR: -> │ fn F(generic x: I1); + // CHECK:STDERR: · ━┳ + // CHECK:STDERR: · ┗━━┫ error: name `I1` used before it was declared + // CHECK:STDERR: · ┃ [NameUseBeforeDecl] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ interface I1; + // CHECK:STDERR: · ─┬ + // CHECK:STDERR: · ╰──┤ declared here [NameUseBeforeDeclNote] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: + // CHECK:STDERR: ╭─┤ fail_poison_multiple_scopes.carbon:[[@LINE+11]]:23 + // CHECK:STDERR: -> │ fn F(generic x: I1); + // CHECK:STDERR: · ━┳ + // CHECK:STDERR: · ┗━━┫ error: name `I1` used before it was declared + // CHECK:STDERR: · ┃ [NameUseBeforeDecl] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ interface I1; + // CHECK:STDERR: · ─┬ + // CHECK:STDERR: · ╰──┤ declared here [NameUseBeforeDeclNote] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: fn F(generic x: I1); - // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+3]]:17-18: note: declared here [NameUseBeforeDeclNote] - // CHECK:STDERR: - // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE-4]]:23-24: error: name `I1` used before it was declared [NameUseBeforeDecl] interface I1; } - // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+3]]:15-16: note: declared here [NameUseBeforeDeclNote] - // CHECK:STDERR: - // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE-9]]:23-24: error: name `I1` used before it was declared [NameUseBeforeDecl] interface I1; } - // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+2]]:13-14: note: declared here [NameUseBeforeDeclNote] - // CHECK:STDERR: interface I1; } @@ -149,18 +203,38 @@ library "[[@TEST_NAME]]"; namespace N; // `package.I` and `N.I` poisoned when not found. -// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+3]]:19: error: name `I` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_poison_when_lookup_fails.carbon:[[@LINE+28]]:19 +// CHECK:STDERR: -> │ fn N.F(generic x: I); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: name `I` not found [NameNotFound] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: +// CHECK:STDERR: ╭─┤ fail_poison_when_lookup_fails.carbon:[[@LINE+22]]:19 +// CHECK:STDERR: -> │ fn N.F(generic x: I); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: name `I` used before it was declared +// CHECK:STDERR: · ┃ [NameUseBeforeDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: │ interface I; +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ declared here [NameUseBeforeDeclNote] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: +// CHECK:STDERR: ╭─┤ fail_poison_when_lookup_fails.carbon:[[@LINE+11]]:19 +// CHECK:STDERR: -> │ fn N.F(generic x: I); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: name `I` used before it was declared +// CHECK:STDERR: · ┃ [NameUseBeforeDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: │ interface N.I; +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ declared here [NameUseBeforeDeclNote] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+1]]:19: error: name `I` used before it was declared [NameUseBeforeDecl] fn N.F(generic x: I); // TODO: We should ideally only produce one diagnostic here. -// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+3]]:11: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: -// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE-5]]:19: error: name `I` used before it was declared [NameUseBeforeDecl] interface I; -// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+2]]:13: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: interface N.I; // --- fail_poison_with_lexical_result.carbon @@ -171,11 +245,19 @@ fn F() { interface I1 {} class C { - // CHECK:STDERR: fail_poison_with_lexical_result.carbon:[[@LINE+1]]:12-13: error: name `I1` used before it was declared [NameUseBeforeDecl] + // CHECK:STDERR: ╭─┤ fail_poison_with_lexical_result.carbon:[[@LINE+11]]:12 + // CHECK:STDERR: -> │ var v: I1; + // CHECK:STDERR: · ━┳ + // CHECK:STDERR: · ┗━━┫ error: name `I1` used before it was declared + // CHECK:STDERR: · ┃ [NameUseBeforeDecl] + // CHECK:STDERR: │ + // CHECK:STDERR: │ interface I1; + // CHECK:STDERR: · ─┬ + // CHECK:STDERR: · ╰──┤ declared here [NameUseBeforeDeclNote] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: var v: I1; - // CHECK:STDERR: fail_poison_with_lexical_result.carbon:[[@LINE+2]]:15-16: note: declared here [NameUseBeforeDeclNote] - // CHECK:STDERR: interface I1; } } diff --git a/toolchain/check/testdata/interface/no_definition_in_impl_file.carbon b/toolchain/check/testdata/interface/no_definition_in_impl_file.carbon index 9d78761c8cdb..11064be7aa19 100644 --- a/toolchain/check/testdata/interface/no_definition_in_impl_file.carbon +++ b/toolchain/check/testdata/interface/no_definition_in_impl_file.carbon @@ -52,10 +52,23 @@ interface C; impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_decl_in_api_decl_in_impl.impl.carbon:[[@LINE+5]]:1-12: error: redeclaration of `interface C` is redundant [RedeclRedundant] -// CHECK:STDERR: decl_in_api_decl_in_impl.carbon:4:1-12: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_decl_in_api_decl_in_impl.impl.carbon:[[@LINE+18]]:1 +// CHECK:STDERR: -> │ interface C; +// CHECK:STDERR: · ━━━━━━┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of `interface C` is redundant [RedeclRedundant] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ decl_in_api_decl_in_impl.carbon +// CHECK:STDERR: │ interface C; +// CHECK:STDERR: · ──────┬───── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_decl_in_api_decl_in_impl.impl.carbon:[[@LINE+2]]:1-12: error: no definition found for declaration in impl file [MissingDefinitionInImpl] +// CHECK:STDERR: ╭─┤ fail_decl_in_api_decl_in_impl.impl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ interface C; +// CHECK:STDERR: · ━━━━━━┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: no definition found for declaration in impl file +// CHECK:STDERR: · ┃ [MissingDefinitionInImpl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: interface C; @@ -69,8 +82,16 @@ interface D; impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_decl_in_api_decl_and_definition_in_impl.impl.carbon:[[@LINE+3]]:1-12: error: redeclaration of `interface D` is redundant [RedeclRedundant] -// CHECK:STDERR: decl_in_api_decl_and_definition_in_impl.carbon:4:1-12: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_decl_in_api_decl_and_definition_in_impl.impl.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: -> │ interface D; +// CHECK:STDERR: · ━━━━━━┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of `interface D` is redundant [RedeclRedundant] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ decl_in_api_decl_and_definition_in_impl.carbon +// CHECK:STDERR: │ interface D; +// CHECK:STDERR: · ──────┬───── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: interface D; @@ -84,6 +105,11 @@ library "[[@TEST_NAME]]"; impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_decl_only_in_impl.impl.carbon:[[@LINE+2]]:1-12: error: no definition found for declaration in impl file [MissingDefinitionInImpl] +// CHECK:STDERR: ╭─┤ fail_decl_only_in_impl.impl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ interface E; +// CHECK:STDERR: · ━━━━━━┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: no definition found for declaration in impl file +// CHECK:STDERR: · ┃ [MissingDefinitionInImpl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: interface E; diff --git a/toolchain/check/testdata/interface/observe.carbon b/toolchain/check/testdata/interface/observe.carbon index 878395882f76..95312422ed6a 100644 --- a/toolchain/check/testdata/interface/observe.carbon +++ b/toolchain/check/testdata/interface/observe.carbon @@ -38,13 +38,33 @@ import library "transitive"; fn F[T: Transitive](t: T) { var a: T.A = t.GetA(); - // CHECK:STDERR: fail_todo_equivalent.carbon:[[@LINE+3]]:3-13: error: cannot convert type `T.(Transitive.A)` that implements `P & Core.Destroy` into type implementing `R & Core.Destroy where...` [ConversionFailureFacetToFacet] - // CHECK:STDERR: transitive.carbon:14:3-24: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_todo_equivalent.carbon:[[@LINE+15]]:3 + // CHECK:STDERR: -> │ t.TakesC(a); + // CHECK:STDERR: · ┳━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `T.(Transitive.A)` that implements + // CHECK:STDERR: · ┃ `P & Core.Destroy` into type implementing + // CHECK:STDERR: · ┃ `R & Core.Destroy where...` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ transitive.carbon + // CHECK:STDERR: │ fn TakesC(self, c: C); + // CHECK:STDERR: · ───────────┬────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: t.TakesC(a); - // CHECK:STDERR: fail_todo_equivalent.carbon:[[@LINE+3]]:4-11: error: cannot convert expression of type `T.(Transitive.A)` to `T.(Transitive.C)` with `as` [ConversionFailure] - // CHECK:STDERR: fail_todo_equivalent.carbon:[[@LINE+2]]:4-11: note: type `T.(Transitive.A)` does not implement interface `Core.As(T.(Transitive.C))` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_todo_equivalent.carbon:[[@LINE+11]]:4 + // CHECK:STDERR: -> │ (a as T.C).InR(); + // CHECK:STDERR: · ┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `T.(Transitive.A)` to + // CHECK:STDERR: · │ ┃ `T.(Transitive.C)` with `as` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `T.(Transitive.A)` does not implement interface + // CHECK:STDERR: · │ `Core.As(T.(Transitive.C))` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: (a as T.C).InR(); } @@ -60,8 +80,18 @@ fn RequiresA[T: A](unused x: T) {} fn F[T: C](x: T) { observe T impls B; - // CHECK:STDERR: fail_todo_impls.carbon:[[@LINE+3]]:3-14: error: cannot convert type `T` that implements `C` into type implementing `A` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_todo_impls.carbon:[[@LINE-5]]:1-33: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_todo_impls.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn RequiresA[T: A](unused x: T) {} + // CHECK:STDERR: · ────────────────┬──────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ RequiresA(x); + // CHECK:STDERR: · ┳━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `T` that implements `C` into type implementing + // CHECK:STDERR: · ┃ `A` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: RequiresA(x); } @@ -76,13 +106,29 @@ fn G[T: Transitive](t: T) { var a: T.A = t.GetA(); observe T.A == T.B impls Q; - // CHECK:STDERR: fail_todo_equivalent_impls.carbon:[[@LINE+2]]:3-11: error: cannot access member of interface `Q` in type `T.(Transitive.A)` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_todo_equivalent_impls.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ a.(Q.InQ)(); + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Q` in type `T.(Transitive.A)` + // CHECK:STDERR: · ┃ that does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: a.(Q.InQ)(); observe T.A == T.C impls R; - // CHECK:STDERR: fail_todo_equivalent_impls.carbon:[[@LINE+3]]:3-13: error: cannot convert type `T.(Transitive.A)` that implements `P & Core.Destroy` into type implementing `P & Q & R` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_todo_equivalent_impls.carbon:[[@LINE-11]]:1-40: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_todo_equivalent_impls.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn TakesPQR[U: P & Q & R](unused u: U) {} + // CHECK:STDERR: · ────────────────────┬─────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ TakesPQR(a); + // CHECK:STDERR: · ┳━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `T.(Transitive.A)` that implements + // CHECK:STDERR: · ┃ `P & Core.Destroy` into type implementing `P & Q & R` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: TakesPQR(a); } @@ -96,12 +142,28 @@ fn TakesPQR[U: P & Q & R](unused u: U) {} fn G[T: Transitive](t: T) { var a: T.A = t.GetA(); - // CHECK:STDERR: fail_equivalent_impls_without_observe.carbon:[[@LINE+2]]:3-11: error: cannot access member of interface `Q` in type `T.(Transitive.A)` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_equivalent_impls_without_observe.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ a.(Q.InQ)(); + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Q` in type `T.(Transitive.A)` + // CHECK:STDERR: · ┃ that does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: a.(Q.InQ)(); - // CHECK:STDERR: fail_equivalent_impls_without_observe.carbon:[[@LINE+3]]:3-13: error: cannot convert type `T.(Transitive.A)` that implements `P & Core.Destroy` into type implementing `P & Q & R` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_equivalent_impls_without_observe.carbon:[[@LINE-9]]:1-40: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_equivalent_impls_without_observe.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn TakesPQR[U: P & Q & R](unused u: U) {} + // CHECK:STDERR: · ────────────────────┬─────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ TakesPQR(a); + // CHECK:STDERR: · ┳━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `T.(Transitive.A)` that implements + // CHECK:STDERR: · ┃ `P & Core.Destroy` into type implementing `P & Q & R` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: TakesPQR(a); } @@ -145,12 +207,29 @@ fn F[U: Z](t: U.Z1) { var a: U.Z1.A = t.GetA(); // Depends on the observe statement in Transitive, which is the type of `Z1`. - // CHECK:STDERR: fail_todo_observe_from_type_of_assoc_constant.carbon:[[@LINE+3]]:3-13: error: cannot convert type `U.(Z.Z1).(Transitive.A)` that implements `P & Core.Destroy` into type implementing `R & Core.Destroy where...` [ConversionFailureFacetToFacet] - // CHECK:STDERR: transitive.carbon:14:3-24: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_todo_observe_from_type_of_assoc_constant.carbon:[[@LINE+15]]:3 + // CHECK:STDERR: -> │ t.TakesC(a); + // CHECK:STDERR: · ┳━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `U.(Z.Z1).(Transitive.A)` that implements + // CHECK:STDERR: · ┃ `P & Core.Destroy` into type implementing + // CHECK:STDERR: · ┃ `R & Core.Destroy where...` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ transitive.carbon + // CHECK:STDERR: │ fn TakesC(self, c: C); + // CHECK:STDERR: · ───────────┬────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: t.TakesC(a); - // CHECK:STDERR: fail_todo_observe_from_type_of_assoc_constant.carbon:[[@LINE+2]]:9-11: error: member name `T` not found in `Z` [MemberNameNotFoundInSpecificScope] + // CHECK:STDERR: ╭─┤ fail_todo_observe_from_type_of_assoc_constant.carbon:[[@LINE+7]]:9 + // CHECK:STDERR: -> │ (a as U.T.C).InR(); + // CHECK:STDERR: · ━┳━ + // CHECK:STDERR: · ┗━━┫ error: member name `T` not found in `Z` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInSpecificScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: (a as U.T.C).InR(); } @@ -179,8 +258,18 @@ interface Y { fn F[T: Y](t: T.Y1) { var a: T.Y1.A = t.GetA(); - // CHECK:STDERR: fail_todo_observe_nested_associated_constants.carbon:[[@LINE+3]]:3-13: error: cannot convert type `T.(Y.Y1).(Z.A)` that implements `Core.Destroy` into type implementing `Core.Destroy where...` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_todo_observe_nested_associated_constants.carbon:[[@LINE-16]]:3-24: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_todo_observe_nested_associated_constants.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn TakesC(self, c: C); + // CHECK:STDERR: · ───────────┬────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ t.TakesC(a); + // CHECK:STDERR: · ┳━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `T.(Y.Y1).(Z.A)` that implements + // CHECK:STDERR: · ┃ `Core.Destroy` into type implementing `Core.Destroy where...` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: t.TakesC(a); } @@ -198,8 +287,18 @@ fn F[T: A, U: B where .Self == T, V: C where .Self == U]() { observe T == U == V; fn InnerF(x: V) { - // CHECK:STDERR: fail_todo_nested_functions_in_outer.carbon:[[@LINE+3]]:5-13: error: cannot convert type `V` that implements `C where...` into type implementing `A` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_todo_nested_functions_in_outer.carbon:[[@LINE-6]]:1-30: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_todo_nested_functions_in_outer.carbon:[[@LINE+13]]:5 + // CHECK:STDERR: │ fn TakesA[T: A](unused x: T) {} + // CHECK:STDERR: · ───────────────┬────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ TakesA(x); + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `V` that implements `C where...` into type + // CHECK:STDERR: · ┃ implementing `A` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: TakesA(x); } @@ -218,8 +317,18 @@ fn F[T: A, U: B where .Self == T, V: C where .Self == U]() { fn InnerF(x: V) { observe T == U == V; - // CHECK:STDERR: fail_todo_nested_functions_in_inner.carbon:[[@LINE+3]]:5-13: error: cannot convert type `V` that implements `C where...` into type implementing `A` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_todo_nested_functions_in_inner.carbon:[[@LINE-6]]:1-30: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_todo_nested_functions_in_inner.carbon:[[@LINE+13]]:5 + // CHECK:STDERR: │ fn TakesA[T: A](unused x: T) {} + // CHECK:STDERR: · ───────────────┬────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ TakesA(x); + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `V` that implements `C where...` into type + // CHECK:STDERR: · ┃ implementing `A` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: TakesA(x); } @@ -236,8 +345,18 @@ fn TakesA[T: A](unused x: T) {} fn F[T: A, U: B where .Self == T, V: C where .Self == U]() { fn InnerF(x: V) { - // CHECK:STDERR: fail_nested_functions_lexical_order.carbon:[[@LINE+3]]:5-13: error: cannot convert type `V` that implements `C where...` into type implementing `A` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_nested_functions_lexical_order.carbon:[[@LINE-5]]:1-30: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_nested_functions_lexical_order.carbon:[[@LINE+13]]:5 + // CHECK:STDERR: │ fn TakesA[T: A](unused x: T) {} + // CHECK:STDERR: · ───────────────┬────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ TakesA(x); + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `V` that implements `C where...` into type + // CHECK:STDERR: · ┃ implementing `A` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: TakesA(x); } @@ -259,8 +378,18 @@ fn F[T: A, U: B where .Self == T, V: C where .Self == U](x: V) { observe T == U == V; } - // CHECK:STDERR: fail_nested_functions_leak_upward.carbon:[[@LINE+3]]:3-11: error: cannot convert type `V` that implements `C where...` into type implementing `A` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_nested_functions_leak_upward.carbon:[[@LINE-8]]:1-30: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_nested_functions_leak_upward.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn TakesA[T: A](unused x: T) {} + // CHECK:STDERR: · ───────────────┬────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ TakesA(x); + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `V` that implements `C where...` into type + // CHECK:STDERR: · ┃ implementing `A` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: TakesA(x); } @@ -276,7 +405,11 @@ fn TakesA[T: A](unused x: T) {} fn F[T: A, U: B where .Self == T, V: C where .Self == U](x: V) { observe T == U; - // CHECK:STDERR: fail_not_observed.carbon:[[@LINE+2]]:3-11: error: name `RequiresA` not found [NameNotFound] + // CHECK:STDERR: ╭─┤ fail_not_observed.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ RequiresA(x); + // CHECK:STDERR: · ━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: name `RequiresA` not found [NameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: RequiresA(x); } @@ -290,8 +423,18 @@ interface B {} fn TakesA[T: A](unused x: T) {} fn F[T: A, U: B](x: U) { observe T == U; - // CHECK:STDERR: fail_invalid_equivalent.carbon:[[@LINE+3]]:3-11: error: cannot convert type `U` that implements `B` into type implementing `A` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_invalid_equivalent.carbon:[[@LINE-4]]:1-30: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_invalid_equivalent.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn TakesA[T: A](unused x: T) {} + // CHECK:STDERR: · ───────────────┬────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ TakesA(x); + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `U` that implements `B` into type implementing + // CHECK:STDERR: · ┃ `A` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: TakesA(x); } @@ -365,7 +508,12 @@ interface A { library "[[@TEST_NAME]]"; class C(T: type, U: type) { - // CHECK:STDERR: fail_wrong_scope_class.carbon:[[@LINE+2]]:3-9: error: `observe` can only be used in an `interface` or `function` [ObserveInWrongScope] + // CHECK:STDERR: ╭─┤ fail_wrong_scope_class.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ observe T == U; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: `observe` can only be used in an `interface` or `function` + // CHECK:STDERR: · ┃ [ObserveInWrongScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: observe T == U; } @@ -374,7 +522,12 @@ class C(T: type, U: type) { library "[[@TEST_NAME]]"; constraint C(T: type, U: type) { - // CHECK:STDERR: fail_wrong_scope_named_constraint.carbon:[[@LINE+2]]:3-9: error: `observe` can only be used in an `interface` or `function` [ObserveInWrongScope] + // CHECK:STDERR: ╭─┤ fail_wrong_scope_named_constraint.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ observe T == U; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: `observe` can only be used in an `interface` or `function` + // CHECK:STDERR: · ┃ [ObserveInWrongScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: observe T == U; } @@ -386,7 +539,13 @@ class C {} interface A {} fn F[T: A]() { - // CHECK:STDERR: fail_non_facet_type_in_impls.carbon:[[@LINE+2]]:19: error: right argument of `impls` requirement must be a facet type [ImplsOnNonFacetType] + // CHECK:STDERR: ╭─┤ fail_non_facet_type_in_impls.carbon:[[@LINE+8]]:19 + // CHECK:STDERR: -> │ observe T impls C; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: right argument of `impls` requirement must be a + // CHECK:STDERR: · ┃ facet type + // CHECK:STDERR: · ┃ [ImplsOnNonFacetType] + // CHECK:STDERR: ╰──── // CHECK:STDERR: observe T impls C; } @@ -417,8 +576,19 @@ import library "generic_observe"; fn F[W: A, X: I(W)](x: X) { var v: X.V = x.GetV(); - // CHECK:STDERR: fail_todo_generic_import.carbon:[[@LINE+3]]:3-13: error: cannot convert type `X.(I(W).V)` that implements `C & Core.Destroy where...` into type implementing `A` [ConversionFailureFacetToFacet] - // CHECK:STDERR: generic_observe.carbon:12:3-24: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_todo_generic_import.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: -> │ x.TakesT(v); + // CHECK:STDERR: · ┳━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `X.(I(W).V)` that implements + // CHECK:STDERR: · ┃ `C & Core.Destroy where...` into type implementing `A` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ generic_observe.carbon + // CHECK:STDERR: │ fn TakesT(self, t: T); + // CHECK:STDERR: · ───────────┬────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: x.TakesT(v); } diff --git a/toolchain/check/testdata/interface/require.carbon b/toolchain/check/testdata/interface/require.carbon index 18867bb07f64..73bacdba61ea 100644 --- a/toolchain/check/testdata/interface/require.carbon +++ b/toolchain/check/testdata/interface/require.carbon @@ -28,14 +28,32 @@ fn F(generic T: Z, generic t: T) { // `T: Z` since the identified facet type doesn't include `Y`. The // identified facet type needs to include extends inside interfaces? - // CHECK:STDERR: fail_todo_extend.carbon:[[@LINE+2]]:3-6: error: cannot access member of interface `Y` in type `T` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_todo_extend.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ T.YY(); + // CHECK:STDERR: · ┳━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Y` in type `T` that does not + // CHECK:STDERR: · ┃ implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: T.YY(); - // CHECK:STDERR: fail_todo_extend.carbon:[[@LINE+2]]:3-10: error: cannot convert type `T` that implements `Z` into type implementing `Y` [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╭─┤ fail_todo_extend.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ T.(Y.YY)(); + // CHECK:STDERR: · ┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `T` that implements `Z` into type implementing + // CHECK:STDERR: · ┃ `Y` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: T.(Y.YY)(); - // CHECK:STDERR: fail_todo_extend.carbon:[[@LINE+2]]:3-6: error: cannot access member of interface `Y` in type `T` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_todo_extend.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ t.YY(); + // CHECK:STDERR: · ┳━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Y` in type `T` that does not + // CHECK:STDERR: · ┃ implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: t.YY(); } @@ -58,10 +76,22 @@ fn F(generic T: Z) { // `T: Z` since the identified facet type doesn't include `Y`. The // identified facet type needs to include extends inside interfaces? // - // CHECK:STDERR: fail_todo_extend_with_self.carbon:[[@LINE+2]]:3-6: error: cannot access member of interface `Y(T)` in type `T` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_todo_extend_with_self.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ T.YY(); + // CHECK:STDERR: · ┳━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Y(T)` in type `T` that does not + // CHECK:STDERR: · ┃ implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: T.YY(); - // CHECK:STDERR: fail_todo_extend_with_self.carbon:[[@LINE+2]]:3-13: error: cannot convert type `T` that implements `Z` into type implementing `Y(T)` [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╭─┤ fail_todo_extend_with_self.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ T.(Y(T).YY)(); + // CHECK:STDERR: · ┳━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `T` that implements `Z` into type implementing + // CHECK:STDERR: · ┃ `Y(T)` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: T.(Y(T).YY)(); } @@ -80,7 +110,13 @@ interface Z { //@dump-sem-ir-end fn F(generic T: Z) { - // CHECK:STDERR: fail_todo_implicit_self_impls.carbon:[[@LINE+2]]:3-10: error: cannot convert type `T` that implements `Z` into type implementing `Y` [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╭─┤ fail_todo_implicit_self_impls.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ T.(Y.YY)(); + // CHECK:STDERR: · ┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `T` that implements `Z` into type implementing + // CHECK:STDERR: · ┃ `Y` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: T.(Y.YY)(); } @@ -99,7 +135,13 @@ interface Z { //@dump-sem-ir-end fn F(generic T: Z) { - // CHECK:STDERR: fail_todo_explicit_self_impls.carbon:[[@LINE+2]]:3-10: error: cannot convert type `T` that implements `Z` into type implementing `Y` [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╭─┤ fail_todo_explicit_self_impls.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ T.(Y.YY)(); + // CHECK:STDERR: · ┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `T` that implements `Z` into type implementing + // CHECK:STDERR: · ┃ `Y` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: T.(Y.YY)(); } @@ -118,7 +160,12 @@ interface Z { fn F(generic T: Z) { // This should fail name lookup since Z does not extend Y. // - // CHECK:STDERR: fail_implicit_self_no_extend_name_lookup_fails.carbon:[[@LINE+2]]:3-6: error: member name `YY` not found in `Z` [MemberNameNotFoundInSpecificScope] + // CHECK:STDERR: ╭─┤ fail_implicit_self_no_extend_name_lookup_fails.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ T.YY(); + // CHECK:STDERR: · ━━┳━ + // CHECK:STDERR: · ┗━━┫ error: member name `YY` not found in `Z` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInSpecificScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: T.YY(); } @@ -137,7 +184,12 @@ interface Z { fn F(generic T: Z) { // This should fail name lookup since Z does not extend Y. // - // CHECK:STDERR: fail_explicit_self_no_extend_name_lookup_fails.carbon:[[@LINE+2]]:3-6: error: member name `YY` not found in `Z` [MemberNameNotFoundInSpecificScope] + // CHECK:STDERR: ╭─┤ fail_explicit_self_no_extend_name_lookup_fails.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ T.YY(); + // CHECK:STDERR: · ━━┳━ + // CHECK:STDERR: · ┗━━┫ error: member name `YY` not found in `Z` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInSpecificScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: T.YY(); } @@ -171,7 +223,13 @@ interface Z { fn F(generic T: Z) { // This fails because `T impls Z` implies that `C(T) impls Y`, not that // `T impls Y`. - // CHECK:STDERR: fail_non_self_doesnt_provide_witness_for_self.carbon:[[@LINE+2]]:3-10: error: cannot convert type `T` that implements `Z` into type implementing `Y` [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╭─┤ fail_non_self_doesnt_provide_witness_for_self.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ T.(Y.YY)(); + // CHECK:STDERR: · ┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `T` that implements `Z` into type implementing + // CHECK:STDERR: · ┃ `Y` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: T.(Y.YY)(); } @@ -190,7 +248,12 @@ interface Z { } fn F(generic T: Z) { - // CHECK:STDERR: fail_todo_non_self_provide_witness_for_non_self.carbon:[[@LINE+2]]:3-13: error: cannot convert type `C(T)` into type implementing `Y` [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╭─┤ fail_todo_non_self_provide_witness_for_non_self.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ C(T).(Y.YY)(); + // CHECK:STDERR: · ━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `C(T)` into type implementing `Y` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: C(T).(Y.YY)(); } @@ -227,7 +290,14 @@ interface Z(T: type) { // it would appear in the type structure used for impl lookup (so inside a // `where` does not count). But they don't. // - // CHECK:STDERR: fail_require_impls_without_self.carbon:[[@LINE+2]]:3-37: error: no `Self` reference found in `require` declaration; `Self` must appear in the self-type or as a generic argument for each required interface, but found interface `Y` without a `Self` argument [RequireImplsMissingSelf] + // CHECK:STDERR: ╭─┤ fail_require_impls_without_self.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ require T impls Y where .Y1 = Self; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no `Self` reference found in `require` declaration; `Self` must + // CHECK:STDERR: · ┃ appear in the self-type or as a generic argument for each required + // CHECK:STDERR: · ┃ interface, but found interface `Y` without a `Self` argument + // CHECK:STDERR: · ┃ [RequireImplsMissingSelf] + // CHECK:STDERR: ╰──── // CHECK:STDERR: require T impls Y where .Y1 = Self; } @@ -240,7 +310,14 @@ interface Y(T: type) {} interface Z(T: type) { // Self is in one interface but not the other. // - // CHECK:STDERR: fail_require_impls_without_self_in_one_interface.carbon:[[@LINE+2]]:3-34: error: no `Self` reference found in `require` declaration; `Self` must appear in the self-type or as a generic argument for each required interface, but found interface `Y({})` without a `Self` argument [RequireImplsMissingSelf] + // CHECK:STDERR: ╭─┤ fail_require_impls_without_self_in_one_interface.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ require T impls Y(Self) & Y({}); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no `Self` reference found in `require` declaration; `Self` must + // CHECK:STDERR: · ┃ appear in the self-type or as a generic argument for each required + // CHECK:STDERR: · ┃ interface, but found interface `Y({})` without a `Self` argument + // CHECK:STDERR: · ┃ [RequireImplsMissingSelf] + // CHECK:STDERR: ╰──── // CHECK:STDERR: require T impls Y(Self) & Y({}); } @@ -253,9 +330,23 @@ interface Y(T: type) {} interface Z(T: type) { // Self does not appear in either interface, we should get an error for each. // - // CHECK:STDERR: fail_require_impls_without_self_in_multiple_interfaces.carbon:[[@LINE+4]]:3-32: error: no `Self` reference found in `require` declaration; `Self` must appear in the self-type or as a generic argument for each required interface, but found interface `Y(())` without a `Self` argument [RequireImplsMissingSelf] + // CHECK:STDERR: ╭─┤ fail_require_impls_without_self_in_multiple_interfaces.carbon:[[@LINE+18]]:3 + // CHECK:STDERR: -> │ require T impls Y(()) & Y({}); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no `Self` reference found in `require` declaration; `Self` must + // CHECK:STDERR: · ┃ appear in the self-type or as a generic argument for each required + // CHECK:STDERR: · ┃ interface, but found interface `Y(())` without a `Self` argument + // CHECK:STDERR: · ┃ [RequireImplsMissingSelf] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_require_impls_without_self_in_multiple_interfaces.carbon:[[@LINE+2]]:3-32: error: no `Self` reference found in `require` declaration; `Self` must appear in the self-type or as a generic argument for each required interface, but found interface `Y({})` without a `Self` argument [RequireImplsMissingSelf] + // CHECK:STDERR: ╭─┤ fail_require_impls_without_self_in_multiple_interfaces.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ require T impls Y(()) & Y({}); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no `Self` reference found in `require` declaration; `Self` must + // CHECK:STDERR: · ┃ appear in the self-type or as a generic argument for each required + // CHECK:STDERR: · ┃ interface, but found interface `Y({})` without a `Self` argument + // CHECK:STDERR: · ┃ [RequireImplsMissingSelf] + // CHECK:STDERR: ╰──── // CHECK:STDERR: require T impls Y(()) & Y({}); } @@ -264,7 +355,14 @@ interface Z(T: type) { library "[[@TEST_NAME]]"; interface Z(T: type) { - // CHECK:STDERR: fail_self_impls_self.carbon:[[@LINE+2]]:17-20: error: `require` declaration constrained by a non-facet type; expected an `interface` or `constraint` name after `impls` [RequireImplsMissingFacetType] + // CHECK:STDERR: ╭─┤ fail_self_impls_self.carbon:[[@LINE+9]]:17 + // CHECK:STDERR: -> │ require impls Self; + // CHECK:STDERR: · ┳━━━ + // CHECK:STDERR: · ┗━━┫ error: `require` declaration constrained by a non-facet + // CHECK:STDERR: · ┃ type; expected an `interface` or `constraint` name + // CHECK:STDERR: · ┃ after `impls` + // CHECK:STDERR: · ┃ [RequireImplsMissingFacetType] + // CHECK:STDERR: ╰──── // CHECK:STDERR: require impls Self; } @@ -275,7 +373,14 @@ library "[[@TEST_NAME]]"; class C(T: type) {} interface Z(T: type) { - // CHECK:STDERR: fail_impls_type.carbon:[[@LINE+2]]:19-25: error: `require` declaration constrained by a non-facet type; expected an `interface` or `constraint` name after `impls` [RequireImplsMissingFacetType] + // CHECK:STDERR: ╭─┤ fail_impls_type.carbon:[[@LINE+9]]:19 + // CHECK:STDERR: -> │ require T impls C(Self); + // CHECK:STDERR: · ┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: `require` declaration constrained by a non-facet + // CHECK:STDERR: · ┃ type; expected an `interface` or `constraint` name + // CHECK:STDERR: · ┃ after `impls` + // CHECK:STDERR: · ┃ [RequireImplsMissingFacetType] + // CHECK:STDERR: ╰──── // CHECK:STDERR: require T impls C(Self); } @@ -286,8 +391,16 @@ library "[[@TEST_NAME]]"; interface Y {} interface Z(T: type) { - // CHECK:STDERR: fail_non_type_impls.carbon:[[@LINE+3]]:11: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet] - // CHECK:STDERR: fail_non_type_impls.carbon:[[@LINE+2]]:11: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_non_type_impls.carbon:[[@LINE+11]]:11 + // CHECK:STDERR: -> │ require 1 impls Y; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert non-type value of type + // CHECK:STDERR: · │ ┃ `Core.IntLiteral` to `type` + // CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: · ╰────┤ type `Core.IntLiteral` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(type)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: require 1 impls Y; } @@ -298,7 +411,14 @@ library "[[@TEST_NAME]]"; interface Y {} interface Z(T: type) { - // CHECK:STDERR: fail_impls_non_type.carbon:[[@LINE+2]]:17: error: `require` declaration constrained by a non-facet type; expected an `interface` or `constraint` name after `impls` [RequireImplsMissingFacetType] + // CHECK:STDERR: ╭─┤ fail_impls_non_type.carbon:[[@LINE+9]]:17 + // CHECK:STDERR: -> │ require impls 1; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: `require` declaration constrained by a non-facet + // CHECK:STDERR: · ┃ type; expected an `interface` or `constraint` name + // CHECK:STDERR: · ┃ after `impls` + // CHECK:STDERR: · ┃ [RequireImplsMissingFacetType] + // CHECK:STDERR: ╰──── // CHECK:STDERR: require impls 1; } diff --git a/toolchain/check/testdata/interface/require_invalid_modifiers.carbon b/toolchain/check/testdata/interface/require_invalid_modifiers.carbon index bfa32c9f87f7..da69eb3a71f2 100644 --- a/toolchain/check/testdata/interface/require_invalid_modifiers.carbon +++ b/toolchain/check/testdata/interface/require_invalid_modifiers.carbon @@ -16,7 +16,12 @@ library "[[@TEST_NAME]]"; interface Y {} interface Z { - // CHECK:STDERR: fail_abstract_require.carbon:[[@LINE+2]]:3-10: error: `abstract` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╭─┤ fail_abstract_require.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ abstract require impls Y; + // CHECK:STDERR: · ━━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: `abstract` not allowed on `require` declaration + // CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: abstract require impls Y; } @@ -27,7 +32,12 @@ library "[[@TEST_NAME]]"; interface Y {} interface Z { - // CHECK:STDERR: fail_base_require.carbon:[[@LINE+2]]:3-6: error: `base` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_require.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ base require impls Y; + // CHECK:STDERR: · ━━┳━ + // CHECK:STDERR: · ┗━━┫ error: `base` not allowed on `require` declaration + // CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: base require impls Y; } @@ -38,7 +48,12 @@ library "[[@TEST_NAME]]"; interface Y {} interface Z { - // CHECK:STDERR: fail_default_require.carbon:[[@LINE+2]]:3-9: error: `default` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╭─┤ fail_default_require.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ default require impls Y; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: `default` not allowed on `require` declaration + // CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: default require impls Y; } @@ -49,7 +64,12 @@ library "[[@TEST_NAME]]"; interface Y {} interface Z { - // CHECK:STDERR: fail_extern_require.carbon:[[@LINE+2]]:3-8: error: `extern` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╭─┤ fail_extern_require.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ extern require impls Y; + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: `extern` not allowed on `require` declaration + // CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extern require impls Y; } @@ -60,7 +80,12 @@ library "[[@TEST_NAME]]"; interface Y {} interface Z { - // CHECK:STDERR: fail_final_require.carbon:[[@LINE+2]]:3-7: error: `final` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╭─┤ fail_final_require.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ final require impls Y; + // CHECK:STDERR: · ━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: `final` not allowed on `require` declaration + // CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: final require impls Y; } @@ -71,7 +96,12 @@ library "[[@TEST_NAME]]"; interface Y {} interface Z { - // CHECK:STDERR: fail_impl_require.carbon:[[@LINE+2]]:3-6: error: `impl` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╭─┤ fail_impl_require.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ impl require impls Y; + // CHECK:STDERR: · ━━┳━ + // CHECK:STDERR: · ┗━━┫ error: `impl` not allowed on `require` declaration + // CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl require impls Y; } @@ -82,7 +112,12 @@ library "[[@TEST_NAME]]"; interface Y {} interface Z { - // CHECK:STDERR: fail_override_require.carbon:[[@LINE+2]]:3-10: error: `override` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╭─┤ fail_override_require.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ override require impls Y; + // CHECK:STDERR: · ━━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: `override` not allowed on `require` declaration + // CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: override require impls Y; } @@ -93,9 +128,18 @@ library "[[@TEST_NAME]]"; interface Y {} interface Z { - // CHECK:STDERR: fail_returned_require.carbon:[[@LINE+4]]:3-10: error: unrecognized declaration introducer [UnrecognizedDecl] + // CHECK:STDERR: ╭─┤ fail_returned_require.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: -> │ returned require impls Y; + // CHECK:STDERR: · ━━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: unrecognized declaration introducer [UnrecognizedDecl] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_returned_require.carbon:[[@LINE+2]]:3-10: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_returned_require.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ returned require impls Y; + // CHECK:STDERR: · ━━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `handle invalid parse trees in `check`` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: returned require impls Y; } @@ -106,7 +150,12 @@ library "[[@TEST_NAME]]"; interface Y {} interface Z { - // CHECK:STDERR: fail_private_require.carbon:[[@LINE+2]]:3-9: error: `private` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╭─┤ fail_private_require.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ private require impls Y; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: `private` not allowed on `require` declaration + // CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: private require impls Y; } @@ -117,7 +166,12 @@ library "[[@TEST_NAME]]"; interface Y {} interface Z { - // CHECK:STDERR: fail_protected_require.carbon:[[@LINE+2]]:3-11: error: `protected` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╭─┤ fail_protected_require.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ protected require impls Y; + // CHECK:STDERR: · ━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: `protected` not allowed on `require` declaration + // CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: protected require impls Y; } @@ -128,7 +182,12 @@ library "[[@TEST_NAME]]"; interface Y {} interface Z { - // CHECK:STDERR: fail_override_virtual.carbon:[[@LINE+2]]:3-9: error: `virtual` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╭─┤ fail_override_virtual.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ virtual require impls Y; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: `virtual` not allowed on `require` declaration + // CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: virtual require impls Y; } diff --git a/toolchain/check/testdata/interface/syntactic_merge.carbon b/toolchain/check/testdata/interface/syntactic_merge.carbon index 3a19c2750227..5d5b7886a513 100644 --- a/toolchain/check/testdata/interface/syntactic_merge.carbon +++ b/toolchain/check/testdata/interface/syntactic_merge.carbon @@ -41,8 +41,17 @@ library "[[@TEST_NAME]]"; class C {} interface Foo(a: C); -// CHECK:STDERR: fail_parens.carbon:[[@LINE+3]]:18: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] -// CHECK:STDERR: fail_parens.carbon:[[@LINE-2]]:18: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] +// CHECK:STDERR: ╭─┤ fail_parens.carbon:[[@LINE+12]]:18 +// CHECK:STDERR: │ interface Foo(a: C); +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ comparing with previous declaration here +// CHECK:STDERR: · │ [RedeclParamSyntaxPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ interface Foo(a: (C)) {} +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: redeclaration syntax differs here +// CHECK:STDERR: · ┃ [RedeclParamSyntaxDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: interface Foo(a: (C)) {} @@ -53,8 +62,17 @@ library "[[@TEST_NAME]]"; class C {} interface Foo(a: C); -// CHECK:STDERR: fail_raw_identifier.carbon:[[@LINE+3]]:18-20: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] -// CHECK:STDERR: fail_raw_identifier.carbon:[[@LINE-2]]:18: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] +// CHECK:STDERR: ╭─┤ fail_raw_identifier.carbon:[[@LINE+12]]:18 +// CHECK:STDERR: │ interface Foo(a: C); +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ comparing with previous declaration here +// CHECK:STDERR: · │ [RedeclParamSyntaxPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ interface Foo(a: r#C) {} +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration syntax differs here +// CHECK:STDERR: · ┃ [RedeclParamSyntaxDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: interface Foo(a: r#C) {} @@ -72,12 +90,30 @@ interface Bar(a: D); impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_todo_two_file.impl.carbon:[[@LINE+3]]:11-13: error: duplicate name `Foo` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: two_file.carbon:7:1-20: note: name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╭─┤ fail_todo_two_file.impl.carbon:[[@LINE+12]]:11 +// CHECK:STDERR: -> │ interface Foo(a: C) {} +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `Foo` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ two_file.carbon +// CHECK:STDERR: │ interface Foo(a: C); +// CHECK:STDERR: · ──────────┬───────── +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: interface Foo(a: C) {} -// CHECK:STDERR: fail_todo_two_file.impl.carbon:[[@LINE+3]]:11-13: error: duplicate name `Bar` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: two_file.carbon:8:1-20: note: name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╭─┤ fail_todo_two_file.impl.carbon:[[@LINE+12]]:11 +// CHECK:STDERR: -> │ interface Bar(a: D) {} +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `Bar` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ two_file.carbon +// CHECK:STDERR: │ interface Bar(a: D); +// CHECK:STDERR: · ──────────┬───────── +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: interface Bar(a: D) {} @@ -89,8 +125,17 @@ class C {} alias D = C; interface Foo(a: C); -// CHECK:STDERR: fail_name_mismatch.carbon:[[@LINE+3]]:15-18: error: redeclaration differs at parameter 1 [RedeclParamDiffers] -// CHECK:STDERR: fail_name_mismatch.carbon:[[@LINE-2]]:15-18: note: previous declaration's corresponding parameter here [RedeclParamPrevious] +// CHECK:STDERR: ╭─┤ fail_name_mismatch.carbon:[[@LINE+12]]:15 +// CHECK:STDERR: │ interface Foo(a: C); +// CHECK:STDERR: · ──┬─ +// CHECK:STDERR: · ╰──┤ previous declaration's corresponding parameter here +// CHECK:STDERR: · │ [RedeclParamPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ interface Foo(b: D) {} +// CHECK:STDERR: · ━━┳━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration differs at parameter 1 +// CHECK:STDERR: · ┃ [RedeclParamDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: interface Foo(b: D) {} @@ -102,8 +147,17 @@ class C {} alias D = C; interface Foo(a: C); -// CHECK:STDERR: fail_alias.carbon:[[@LINE+3]]:18: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] -// CHECK:STDERR: fail_alias.carbon:[[@LINE-2]]:18: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] +// CHECK:STDERR: ╭─┤ fail_alias.carbon:[[@LINE+12]]:18 +// CHECK:STDERR: │ interface Foo(a: C); +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ comparing with previous declaration here +// CHECK:STDERR: · │ [RedeclParamSyntaxPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ interface Foo(a: D) {} +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: redeclaration syntax differs here +// CHECK:STDERR: · ┃ [RedeclParamSyntaxDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: interface Foo(a: D) {} @@ -115,8 +169,17 @@ class C {} alias D = C; interface Foo[a: C](); -// CHECK:STDERR: fail_deduced_alias.carbon:[[@LINE+3]]:18: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] -// CHECK:STDERR: fail_deduced_alias.carbon:[[@LINE-2]]:18: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] +// CHECK:STDERR: ╭─┤ fail_deduced_alias.carbon:[[@LINE+12]]:18 +// CHECK:STDERR: │ interface Foo[a: C](); +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ comparing with previous declaration here +// CHECK:STDERR: · │ [RedeclParamSyntaxPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ interface Foo[a: D]() {} +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: redeclaration syntax differs here +// CHECK:STDERR: · ┃ [RedeclParamSyntaxDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: interface Foo[a: D]() {} @@ -137,8 +200,17 @@ alias D = C; // TODO: This fails because importing interfaces doesn't work well. It should // fail due to `C` versus `D`, but may succeed if importing interfaces is fixed // before syntax matching on imports is supported. -// CHECK:STDERR: fail_alias_two_file.impl.carbon:[[@LINE+3]]:11-13: error: duplicate name `Foo` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: alias_two_file.carbon:6:1-20: note: name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╭─┤ fail_alias_two_file.impl.carbon:[[@LINE+12]]:11 +// CHECK:STDERR: -> │ interface Foo(a: D) {} +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `Foo` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ alias_two_file.carbon +// CHECK:STDERR: │ interface Foo(a: C); +// CHECK:STDERR: · ──────────┬───────── +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: interface Foo(a: D) {} @@ -149,10 +221,25 @@ library "[[@TEST_NAME]]"; class C {} interface Foo(a: const C); -// CHECK:STDERR: fail_repeat_const.carbon:[[@LINE+5]]:18-32: warning: `const` applied repeatedly to the same type has no additional effect [RepeatedConst] +// CHECK:STDERR: ╭─┤ fail_repeat_const.carbon:[[@LINE+20]]:18 +// CHECK:STDERR: -> │ interface Foo(a: const (const C)) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ warning: `const` applied repeatedly to the same type has +// CHECK:STDERR: · ┃ no additional effect +// CHECK:STDERR: · ┃ [RepeatedConst] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_repeat_const.carbon:[[@LINE+3]]:24: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers] -// CHECK:STDERR: fail_repeat_const.carbon:[[@LINE-4]]:24: note: comparing with previous declaration here [RedeclParamSyntaxPrevious] +// CHECK:STDERR: ╭─┤ fail_repeat_const.carbon:[[@LINE+12]]:24 +// CHECK:STDERR: │ interface Foo(a: const C); +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ comparing with previous declaration here +// CHECK:STDERR: · │ [RedeclParamSyntaxPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ interface Foo(a: const (const C)) {} +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: redeclaration syntax differs here +// CHECK:STDERR: · ┃ [RedeclParamSyntaxDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: interface Foo(a: const (const C)) {} @@ -378,9 +465,9 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: %a: %C = symbolic_binding a, 0 [symbolic] // CHECK:STDOUT: %Foo.type.bc6a25.1: type = generic_interface_type @Foo.loc6 [concrete] // CHECK:STDOUT: %Foo.generic.d3ea5a.1: %Foo.type.bc6a25.1 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.bc6a25.2: type = generic_interface_type @Foo.loc10 [concrete] +// CHECK:STDOUT: %Foo.type.bc6a25.2: type = generic_interface_type @Foo.loc19 [concrete] // CHECK:STDOUT: %Foo.generic.d3ea5a.2: %Foo.type.bc6a25.2 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.137: type = facet_type <@Foo.loc10, @Foo.loc10(%a)> [symbolic] +// CHECK:STDOUT: %Foo.type.137: type = facet_type <@Foo.loc19, @Foo.loc19(%a)> [symbolic] // CHECK:STDOUT: %Self: %Foo.type.137 = symbolic_binding Self, 1 [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -399,14 +486,14 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: } // CHECK:STDOUT: %a.loc6_16.2: %C = symbolic_binding a, 0 [symbolic = %a.loc6_16.1 (constants.%a)] // CHECK:STDOUT: } -// CHECK:STDOUT: %Foo.decl.loc10: %Foo.type.bc6a25.2 = interface_decl @Foo.loc10 [concrete = constants.%Foo.generic.d3ea5a.2] { -// CHECK:STDOUT: %a.patt.loc10_16.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc10_16.2 (constants.%a.patt)] +// CHECK:STDOUT: %Foo.decl.loc19: %Foo.type.bc6a25.2 = interface_decl @Foo.loc19 [concrete = constants.%Foo.generic.d3ea5a.2] { +// CHECK:STDOUT: %a.patt.loc19_16.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc19_16.2 (constants.%a.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc10: type = splice_block %C.ref [concrete = constants.%C] { +// CHECK:STDOUT: %.loc19: type = splice_block %C.ref [concrete = constants.%C] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: } -// CHECK:STDOUT: %a.loc10_16.2: %C = symbolic_binding a, 0 [symbolic = %a.loc10_16.1 (constants.%a)] +// CHECK:STDOUT: %a.loc19_16.2: %C = symbolic_binding a, 0 [symbolic = %a.loc19_16.1 (constants.%a)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -417,20 +504,20 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: interface; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @Foo.loc10(%a.loc10_16.2: %C) { -// CHECK:STDOUT: %a.patt.loc10_16.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc10_16.2 (constants.%a.patt)] -// CHECK:STDOUT: %a.loc10_16.1: %C = symbolic_binding a, 0 [symbolic = %a.loc10_16.1 (constants.%a)] +// CHECK:STDOUT: generic interface @Foo.loc19(%a.loc19_16.2: %C) { +// CHECK:STDOUT: %a.patt.loc19_16.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc19_16.2 (constants.%a.patt)] +// CHECK:STDOUT: %a.loc19_16.1: %C = symbolic_binding a, 0 [symbolic = %a.loc19_16.1 (constants.%a)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Foo.type: type = facet_type <@Foo.loc10, @Foo.loc10(%a.loc10_16.1)> [symbolic = %Foo.type (constants.%Foo.type.137)] -// CHECK:STDOUT: %Self.loc10_23.2: @Foo.loc10.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc10_23.2 (constants.%Self)] +// CHECK:STDOUT: %Foo.type: type = facet_type <@Foo.loc19, @Foo.loc19(%a.loc19_16.1)> [symbolic = %Foo.type (constants.%Foo.type.137)] +// CHECK:STDOUT: %Self.loc19_23.2: @Foo.loc19.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc19_23.2 (constants.%Self)] // CHECK:STDOUT: // CHECK:STDOUT: interface { -// CHECK:STDOUT: %Self.loc10_23.1: @Foo.loc10.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc10_23.2 (constants.%Self)] -// CHECK:STDOUT: %Foo.WithSelf.decl = interface_with_self_decl @Foo.loc10 [concrete] +// CHECK:STDOUT: %Self.loc19_23.1: @Foo.loc19.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc19_23.2 (constants.%Self)] +// CHECK:STDOUT: %Foo.WithSelf.decl = interface_with_self_decl @Foo.loc19 [concrete] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.loc10_23.1 +// CHECK:STDOUT: .Self = %Self.loc19_23.1 // CHECK:STDOUT: witness = () // CHECK:STDOUT: // CHECK:STDOUT: !requires: @@ -450,9 +537,9 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: %a.loc6_16.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Foo.loc10(constants.%a) { -// CHECK:STDOUT: %a.patt.loc10_16.2 => constants.%a.patt -// CHECK:STDOUT: %a.loc10_16.1 => constants.%a +// CHECK:STDOUT: specific @Foo.loc19(constants.%a) { +// CHECK:STDOUT: %a.patt.loc19_16.2 => constants.%a.patt +// CHECK:STDOUT: %a.loc19_16.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Foo.WithSelf(constants.%a, constants.%Self) {} @@ -470,9 +557,9 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: %a: %C = symbolic_binding a, 0 [symbolic] // CHECK:STDOUT: %Foo.type.bc6a25.1: type = generic_interface_type @Foo.loc6 [concrete] // CHECK:STDOUT: %Foo.generic.d3ea5a.1: %Foo.type.bc6a25.1 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.bc6a25.2: type = generic_interface_type @Foo.loc10 [concrete] +// CHECK:STDOUT: %Foo.type.bc6a25.2: type = generic_interface_type @Foo.loc19 [concrete] // CHECK:STDOUT: %Foo.generic.d3ea5a.2: %Foo.type.bc6a25.2 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.137: type = facet_type <@Foo.loc10, @Foo.loc10(%a)> [symbolic] +// CHECK:STDOUT: %Foo.type.137: type = facet_type <@Foo.loc19, @Foo.loc19(%a)> [symbolic] // CHECK:STDOUT: %Self: %Foo.type.137 = symbolic_binding Self, 1 [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -491,14 +578,14 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: } // CHECK:STDOUT: %a.loc6_16.2: %C = symbolic_binding a, 0 [symbolic = %a.loc6_16.1 (constants.%a)] // CHECK:STDOUT: } -// CHECK:STDOUT: %Foo.decl.loc10: %Foo.type.bc6a25.2 = interface_decl @Foo.loc10 [concrete = constants.%Foo.generic.d3ea5a.2] { -// CHECK:STDOUT: %a.patt.loc10_16.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc10_16.2 (constants.%a.patt)] +// CHECK:STDOUT: %Foo.decl.loc19: %Foo.type.bc6a25.2 = interface_decl @Foo.loc19 [concrete = constants.%Foo.generic.d3ea5a.2] { +// CHECK:STDOUT: %a.patt.loc19_16.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc19_16.2 (constants.%a.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc10: type = splice_block %C.ref [concrete = constants.%C] { +// CHECK:STDOUT: %.loc19: type = splice_block %C.ref [concrete = constants.%C] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: } -// CHECK:STDOUT: %a.loc10_16.2: %C = symbolic_binding a, 0 [symbolic = %a.loc10_16.1 (constants.%a)] +// CHECK:STDOUT: %a.loc19_16.2: %C = symbolic_binding a, 0 [symbolic = %a.loc19_16.1 (constants.%a)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -509,20 +596,20 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: interface; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @Foo.loc10(%a.loc10_16.2: %C) { -// CHECK:STDOUT: %a.patt.loc10_16.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc10_16.2 (constants.%a.patt)] -// CHECK:STDOUT: %a.loc10_16.1: %C = symbolic_binding a, 0 [symbolic = %a.loc10_16.1 (constants.%a)] +// CHECK:STDOUT: generic interface @Foo.loc19(%a.loc19_16.2: %C) { +// CHECK:STDOUT: %a.patt.loc19_16.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc19_16.2 (constants.%a.patt)] +// CHECK:STDOUT: %a.loc19_16.1: %C = symbolic_binding a, 0 [symbolic = %a.loc19_16.1 (constants.%a)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Foo.type: type = facet_type <@Foo.loc10, @Foo.loc10(%a.loc10_16.1)> [symbolic = %Foo.type (constants.%Foo.type.137)] -// CHECK:STDOUT: %Self.loc10_23.2: @Foo.loc10.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc10_23.2 (constants.%Self)] +// CHECK:STDOUT: %Foo.type: type = facet_type <@Foo.loc19, @Foo.loc19(%a.loc19_16.1)> [symbolic = %Foo.type (constants.%Foo.type.137)] +// CHECK:STDOUT: %Self.loc19_23.2: @Foo.loc19.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc19_23.2 (constants.%Self)] // CHECK:STDOUT: // CHECK:STDOUT: interface { -// CHECK:STDOUT: %Self.loc10_23.1: @Foo.loc10.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc10_23.2 (constants.%Self)] -// CHECK:STDOUT: %Foo.WithSelf.decl = interface_with_self_decl @Foo.loc10 [concrete] +// CHECK:STDOUT: %Self.loc19_23.1: @Foo.loc19.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc19_23.2 (constants.%Self)] +// CHECK:STDOUT: %Foo.WithSelf.decl = interface_with_self_decl @Foo.loc19 [concrete] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.loc10_23.1 +// CHECK:STDOUT: .Self = %Self.loc19_23.1 // CHECK:STDOUT: witness = () // CHECK:STDOUT: // CHECK:STDOUT: !requires: @@ -542,9 +629,9 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: %a.loc6_16.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Foo.loc10(constants.%a) { -// CHECK:STDOUT: %a.patt.loc10_16.2 => constants.%a.patt -// CHECK:STDOUT: %a.loc10_16.1 => constants.%a +// CHECK:STDOUT: specific @Foo.loc19(constants.%a) { +// CHECK:STDOUT: %a.patt.loc19_16.2 => constants.%a.patt +// CHECK:STDOUT: %a.loc19_16.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Foo.WithSelf(constants.%a, constants.%Self) {} @@ -641,15 +728,15 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: %a: %C = symbolic_binding a, 0 [symbolic] // CHECK:STDOUT: %Foo.type.bc6a25.1: type = generic_interface_type @Foo.1 [concrete] // CHECK:STDOUT: %Foo.generic.d3ea5a.1: %Foo.type.bc6a25.1 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.bc6a25.2: type = generic_interface_type @Foo.loc7 [concrete] +// CHECK:STDOUT: %Foo.type.bc6a25.2: type = generic_interface_type @Foo.loc16 [concrete] // CHECK:STDOUT: %Foo.generic.d3ea5a.2: %Foo.type.bc6a25.2 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.137: type = facet_type <@Foo.loc7, @Foo.loc7(%a)> [symbolic] +// CHECK:STDOUT: %Foo.type.137: type = facet_type <@Foo.loc16, @Foo.loc16(%a)> [symbolic] // CHECK:STDOUT: %Self.4d3: %Foo.type.137 = symbolic_binding Self, 1 [symbolic] // CHECK:STDOUT: %Bar.type.3f06c8.1: type = generic_interface_type @Bar.1 [concrete] // CHECK:STDOUT: %Bar.generic.b3011f.1: %Bar.type.3f06c8.1 = struct_value () [concrete] -// CHECK:STDOUT: %Bar.type.3f06c8.2: type = generic_interface_type @Bar.loc11 [concrete] +// CHECK:STDOUT: %Bar.type.3f06c8.2: type = generic_interface_type @Bar.loc29 [concrete] // CHECK:STDOUT: %Bar.generic.b3011f.2: %Bar.type.3f06c8.2 = struct_value () [concrete] -// CHECK:STDOUT: %Bar.type.309: type = facet_type <@Bar.loc11, @Bar.loc11(%a)> [symbolic] +// CHECK:STDOUT: %Bar.type.309: type = facet_type <@Bar.loc29, @Bar.loc29(%a)> [symbolic] // CHECK:STDOUT: %Self.3ee: %Bar.type.309 = symbolic_binding Self, 1 [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -673,23 +760,23 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: } // CHECK:STDOUT: %default.import.loc2_24.1 = import // CHECK:STDOUT: %default.import.loc2_24.2 = import -// CHECK:STDOUT: %Foo.decl: %Foo.type.bc6a25.2 = interface_decl @Foo.loc7 [concrete = constants.%Foo.generic.d3ea5a.2] { -// CHECK:STDOUT: %a.patt.loc7_16.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc7_16.2 (constants.%a.patt)] +// CHECK:STDOUT: %Foo.decl: %Foo.type.bc6a25.2 = interface_decl @Foo.loc16 [concrete = constants.%Foo.generic.d3ea5a.2] { +// CHECK:STDOUT: %a.patt.loc16_16.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc16_16.2 (constants.%a.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc7: type = splice_block %C.ref [concrete = constants.%C] { +// CHECK:STDOUT: %.loc16: type = splice_block %C.ref [concrete = constants.%C] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [concrete = constants.%C] // CHECK:STDOUT: } -// CHECK:STDOUT: %a.loc7_16.2: %C = symbolic_binding a, 0 [symbolic = %a.loc7_16.1 (constants.%a)] +// CHECK:STDOUT: %a.loc16_16.2: %C = symbolic_binding a, 0 [symbolic = %a.loc16_16.1 (constants.%a)] // CHECK:STDOUT: } -// CHECK:STDOUT: %Bar.decl: %Bar.type.3f06c8.2 = interface_decl @Bar.loc11 [concrete = constants.%Bar.generic.b3011f.2] { -// CHECK:STDOUT: %a.patt.loc11_16.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc11_16.2 (constants.%a.patt)] +// CHECK:STDOUT: %Bar.decl: %Bar.type.3f06c8.2 = interface_decl @Bar.loc29 [concrete = constants.%Bar.generic.b3011f.2] { +// CHECK:STDOUT: %a.patt.loc29_16.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc29_16.2 (constants.%a.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc11: type = splice_block %D.ref [concrete = constants.%C] { +// CHECK:STDOUT: %.loc29: type = splice_block %D.ref [concrete = constants.%C] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %D.ref: type = name_ref D, imports.%Main.D [concrete = constants.%C] // CHECK:STDOUT: } -// CHECK:STDOUT: %a.loc11_16.2: %C = symbolic_binding a, 0 [symbolic = %a.loc11_16.1 (constants.%a)] +// CHECK:STDOUT: %a.loc29_16.2: %C = symbolic_binding a, 0 [symbolic = %a.loc29_16.1 (constants.%a)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -700,20 +787,20 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: interface; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @Foo.loc7(%a.loc7_16.2: %C) { -// CHECK:STDOUT: %a.patt.loc7_16.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc7_16.2 (constants.%a.patt)] -// CHECK:STDOUT: %a.loc7_16.1: %C = symbolic_binding a, 0 [symbolic = %a.loc7_16.1 (constants.%a)] +// CHECK:STDOUT: generic interface @Foo.loc16(%a.loc16_16.2: %C) { +// CHECK:STDOUT: %a.patt.loc16_16.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc16_16.2 (constants.%a.patt)] +// CHECK:STDOUT: %a.loc16_16.1: %C = symbolic_binding a, 0 [symbolic = %a.loc16_16.1 (constants.%a)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Foo.type: type = facet_type <@Foo.loc7, @Foo.loc7(%a.loc7_16.1)> [symbolic = %Foo.type (constants.%Foo.type.137)] -// CHECK:STDOUT: %Self.loc7_21.2: @Foo.loc7.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc7_21.2 (constants.%Self.4d3)] +// CHECK:STDOUT: %Foo.type: type = facet_type <@Foo.loc16, @Foo.loc16(%a.loc16_16.1)> [symbolic = %Foo.type (constants.%Foo.type.137)] +// CHECK:STDOUT: %Self.loc16_21.2: @Foo.loc16.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc16_21.2 (constants.%Self.4d3)] // CHECK:STDOUT: // CHECK:STDOUT: interface { -// CHECK:STDOUT: %Self.loc7_21.1: @Foo.loc7.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc7_21.2 (constants.%Self.4d3)] -// CHECK:STDOUT: %Foo.WithSelf.decl = interface_with_self_decl @Foo.loc7 [concrete] +// CHECK:STDOUT: %Self.loc16_21.1: @Foo.loc16.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc16_21.2 (constants.%Self.4d3)] +// CHECK:STDOUT: %Foo.WithSelf.decl = interface_with_self_decl @Foo.loc16 [concrete] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.loc7_21.1 +// CHECK:STDOUT: .Self = %Self.loc16_21.1 // CHECK:STDOUT: witness = () // CHECK:STDOUT: // CHECK:STDOUT: !requires: @@ -727,20 +814,20 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: interface; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @Bar.loc11(%a.loc11_16.2: %C) { -// CHECK:STDOUT: %a.patt.loc11_16.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc11_16.2 (constants.%a.patt)] -// CHECK:STDOUT: %a.loc11_16.1: %C = symbolic_binding a, 0 [symbolic = %a.loc11_16.1 (constants.%a)] +// CHECK:STDOUT: generic interface @Bar.loc29(%a.loc29_16.2: %C) { +// CHECK:STDOUT: %a.patt.loc29_16.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc29_16.2 (constants.%a.patt)] +// CHECK:STDOUT: %a.loc29_16.1: %C = symbolic_binding a, 0 [symbolic = %a.loc29_16.1 (constants.%a)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Bar.type: type = facet_type <@Bar.loc11, @Bar.loc11(%a.loc11_16.1)> [symbolic = %Bar.type (constants.%Bar.type.309)] -// CHECK:STDOUT: %Self.loc11_21.2: @Bar.loc11.%Bar.type (%Bar.type.309) = symbolic_binding Self, 1 [symbolic = %Self.loc11_21.2 (constants.%Self.3ee)] +// CHECK:STDOUT: %Bar.type: type = facet_type <@Bar.loc29, @Bar.loc29(%a.loc29_16.1)> [symbolic = %Bar.type (constants.%Bar.type.309)] +// CHECK:STDOUT: %Self.loc29_21.2: @Bar.loc29.%Bar.type (%Bar.type.309) = symbolic_binding Self, 1 [symbolic = %Self.loc29_21.2 (constants.%Self.3ee)] // CHECK:STDOUT: // CHECK:STDOUT: interface { -// CHECK:STDOUT: %Self.loc11_21.1: @Bar.loc11.%Bar.type (%Bar.type.309) = symbolic_binding Self, 1 [symbolic = %Self.loc11_21.2 (constants.%Self.3ee)] -// CHECK:STDOUT: %Bar.WithSelf.decl = interface_with_self_decl @Bar.loc11 [concrete] +// CHECK:STDOUT: %Self.loc29_21.1: @Bar.loc29.%Bar.type (%Bar.type.309) = symbolic_binding Self, 1 [symbolic = %Self.loc29_21.2 (constants.%Self.3ee)] +// CHECK:STDOUT: %Bar.WithSelf.decl = interface_with_self_decl @Bar.loc29 [concrete] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.loc11_21.1 +// CHECK:STDOUT: .Self = %Self.loc29_21.1 // CHECK:STDOUT: witness = () // CHECK:STDOUT: // CHECK:STDOUT: !requires: @@ -759,9 +846,9 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: %a => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Foo.loc7(constants.%a) { -// CHECK:STDOUT: %a.patt.loc7_16.2 => constants.%a.patt -// CHECK:STDOUT: %a.loc7_16.1 => constants.%a +// CHECK:STDOUT: specific @Foo.loc16(constants.%a) { +// CHECK:STDOUT: %a.patt.loc16_16.2 => constants.%a.patt +// CHECK:STDOUT: %a.loc16_16.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Foo.WithSelf(constants.%a, constants.%Self.4d3) {} @@ -771,9 +858,9 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: %a => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Bar.loc11(constants.%a) { -// CHECK:STDOUT: %a.patt.loc11_16.2 => constants.%a.patt -// CHECK:STDOUT: %a.loc11_16.1 => constants.%a +// CHECK:STDOUT: specific @Bar.loc29(constants.%a) { +// CHECK:STDOUT: %a.patt.loc29_16.2 => constants.%a.patt +// CHECK:STDOUT: %a.loc29_16.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Bar.WithSelf(constants.%a, constants.%Self.3ee) {} @@ -793,9 +880,9 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: %Foo.generic.d3ea5a.1: %Foo.type.bc6a25.1 = struct_value () [concrete] // CHECK:STDOUT: %b.patt: %pattern_type = symbolic_binding_pattern b, 0 [symbolic] // CHECK:STDOUT: %b: %C = symbolic_binding b, 0 [symbolic] -// CHECK:STDOUT: %Foo.type.bc6a25.2: type = generic_interface_type @Foo.loc11 [concrete] +// CHECK:STDOUT: %Foo.type.bc6a25.2: type = generic_interface_type @Foo.loc20 [concrete] // CHECK:STDOUT: %Foo.generic.d3ea5a.2: %Foo.type.bc6a25.2 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.137: type = facet_type <@Foo.loc11, @Foo.loc11(%b)> [symbolic] +// CHECK:STDOUT: %Foo.type.137: type = facet_type <@Foo.loc20, @Foo.loc20(%b)> [symbolic] // CHECK:STDOUT: %Self: %Foo.type.137 = symbolic_binding Self, 1 [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -817,14 +904,14 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: } // CHECK:STDOUT: %a.loc7_16.2: %C = symbolic_binding a, 0 [symbolic = %a.loc7_16.1 (constants.%a)] // CHECK:STDOUT: } -// CHECK:STDOUT: %Foo.decl.loc11: %Foo.type.bc6a25.2 = interface_decl @Foo.loc11 [concrete = constants.%Foo.generic.d3ea5a.2] { -// CHECK:STDOUT: %b.patt.loc11_16.1: %pattern_type = symbolic_binding_pattern b, 0 [symbolic = %b.patt.loc11_16.2 (constants.%b.patt)] +// CHECK:STDOUT: %Foo.decl.loc20: %Foo.type.bc6a25.2 = interface_decl @Foo.loc20 [concrete = constants.%Foo.generic.d3ea5a.2] { +// CHECK:STDOUT: %b.patt.loc20_16.1: %pattern_type = symbolic_binding_pattern b, 0 [symbolic = %b.patt.loc20_16.2 (constants.%b.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc11: type = splice_block %D.ref [concrete = constants.%C] { +// CHECK:STDOUT: %.loc20: type = splice_block %D.ref [concrete = constants.%C] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D [concrete = constants.%C] // CHECK:STDOUT: } -// CHECK:STDOUT: %b.loc11_16.2: %C = symbolic_binding b, 0 [symbolic = %b.loc11_16.1 (constants.%b)] +// CHECK:STDOUT: %b.loc20_16.2: %C = symbolic_binding b, 0 [symbolic = %b.loc20_16.1 (constants.%b)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -835,20 +922,20 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: interface; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @Foo.loc11(%b.loc11_16.2: %C) { -// CHECK:STDOUT: %b.patt.loc11_16.2: %pattern_type = symbolic_binding_pattern b, 0 [symbolic = %b.patt.loc11_16.2 (constants.%b.patt)] -// CHECK:STDOUT: %b.loc11_16.1: %C = symbolic_binding b, 0 [symbolic = %b.loc11_16.1 (constants.%b)] +// CHECK:STDOUT: generic interface @Foo.loc20(%b.loc20_16.2: %C) { +// CHECK:STDOUT: %b.patt.loc20_16.2: %pattern_type = symbolic_binding_pattern b, 0 [symbolic = %b.patt.loc20_16.2 (constants.%b.patt)] +// CHECK:STDOUT: %b.loc20_16.1: %C = symbolic_binding b, 0 [symbolic = %b.loc20_16.1 (constants.%b)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Foo.type: type = facet_type <@Foo.loc11, @Foo.loc11(%b.loc11_16.1)> [symbolic = %Foo.type (constants.%Foo.type.137)] -// CHECK:STDOUT: %Self.loc11_21.2: @Foo.loc11.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc11_21.2 (constants.%Self)] +// CHECK:STDOUT: %Foo.type: type = facet_type <@Foo.loc20, @Foo.loc20(%b.loc20_16.1)> [symbolic = %Foo.type (constants.%Foo.type.137)] +// CHECK:STDOUT: %Self.loc20_21.2: @Foo.loc20.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc20_21.2 (constants.%Self)] // CHECK:STDOUT: // CHECK:STDOUT: interface { -// CHECK:STDOUT: %Self.loc11_21.1: @Foo.loc11.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc11_21.2 (constants.%Self)] -// CHECK:STDOUT: %Foo.WithSelf.decl = interface_with_self_decl @Foo.loc11 [concrete] +// CHECK:STDOUT: %Self.loc20_21.1: @Foo.loc20.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc20_21.2 (constants.%Self)] +// CHECK:STDOUT: %Foo.WithSelf.decl = interface_with_self_decl @Foo.loc20 [concrete] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.loc11_21.1 +// CHECK:STDOUT: .Self = %Self.loc20_21.1 // CHECK:STDOUT: witness = () // CHECK:STDOUT: // CHECK:STDOUT: !requires: @@ -868,9 +955,9 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: %a.loc7_16.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Foo.loc11(constants.%b) { -// CHECK:STDOUT: %b.patt.loc11_16.2 => constants.%b.patt -// CHECK:STDOUT: %b.loc11_16.1 => constants.%b +// CHECK:STDOUT: specific @Foo.loc20(constants.%b) { +// CHECK:STDOUT: %b.patt.loc20_16.2 => constants.%b.patt +// CHECK:STDOUT: %b.loc20_16.1 => constants.%b // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Foo.WithSelf(constants.%b, constants.%Self) {} @@ -888,9 +975,9 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: %a: %C = symbolic_binding a, 0 [symbolic] // CHECK:STDOUT: %Foo.type.bc6a25.1: type = generic_interface_type @Foo.loc7 [concrete] // CHECK:STDOUT: %Foo.generic.d3ea5a.1: %Foo.type.bc6a25.1 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.bc6a25.2: type = generic_interface_type @Foo.loc11 [concrete] +// CHECK:STDOUT: %Foo.type.bc6a25.2: type = generic_interface_type @Foo.loc20 [concrete] // CHECK:STDOUT: %Foo.generic.d3ea5a.2: %Foo.type.bc6a25.2 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.137: type = facet_type <@Foo.loc11, @Foo.loc11(%a)> [symbolic] +// CHECK:STDOUT: %Foo.type.137: type = facet_type <@Foo.loc20, @Foo.loc20(%a)> [symbolic] // CHECK:STDOUT: %Self: %Foo.type.137 = symbolic_binding Self, 1 [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -912,14 +999,14 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: } // CHECK:STDOUT: %a.loc7_16.2: %C = symbolic_binding a, 0 [symbolic = %a.loc7_16.1 (constants.%a)] // CHECK:STDOUT: } -// CHECK:STDOUT: %Foo.decl.loc11: %Foo.type.bc6a25.2 = interface_decl @Foo.loc11 [concrete = constants.%Foo.generic.d3ea5a.2] { -// CHECK:STDOUT: %a.patt.loc11_16.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc11_16.2 (constants.%a.patt)] +// CHECK:STDOUT: %Foo.decl.loc20: %Foo.type.bc6a25.2 = interface_decl @Foo.loc20 [concrete = constants.%Foo.generic.d3ea5a.2] { +// CHECK:STDOUT: %a.patt.loc20_16.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc20_16.2 (constants.%a.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc11: type = splice_block %D.ref [concrete = constants.%C] { +// CHECK:STDOUT: %.loc20: type = splice_block %D.ref [concrete = constants.%C] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D [concrete = constants.%C] // CHECK:STDOUT: } -// CHECK:STDOUT: %a.loc11_16.2: %C = symbolic_binding a, 0 [symbolic = %a.loc11_16.1 (constants.%a)] +// CHECK:STDOUT: %a.loc20_16.2: %C = symbolic_binding a, 0 [symbolic = %a.loc20_16.1 (constants.%a)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -930,20 +1017,20 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: interface; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @Foo.loc11(%a.loc11_16.2: %C) { -// CHECK:STDOUT: %a.patt.loc11_16.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc11_16.2 (constants.%a.patt)] -// CHECK:STDOUT: %a.loc11_16.1: %C = symbolic_binding a, 0 [symbolic = %a.loc11_16.1 (constants.%a)] +// CHECK:STDOUT: generic interface @Foo.loc20(%a.loc20_16.2: %C) { +// CHECK:STDOUT: %a.patt.loc20_16.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc20_16.2 (constants.%a.patt)] +// CHECK:STDOUT: %a.loc20_16.1: %C = symbolic_binding a, 0 [symbolic = %a.loc20_16.1 (constants.%a)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Foo.type: type = facet_type <@Foo.loc11, @Foo.loc11(%a.loc11_16.1)> [symbolic = %Foo.type (constants.%Foo.type.137)] -// CHECK:STDOUT: %Self.loc11_21.2: @Foo.loc11.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc11_21.2 (constants.%Self)] +// CHECK:STDOUT: %Foo.type: type = facet_type <@Foo.loc20, @Foo.loc20(%a.loc20_16.1)> [symbolic = %Foo.type (constants.%Foo.type.137)] +// CHECK:STDOUT: %Self.loc20_21.2: @Foo.loc20.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc20_21.2 (constants.%Self)] // CHECK:STDOUT: // CHECK:STDOUT: interface { -// CHECK:STDOUT: %Self.loc11_21.1: @Foo.loc11.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc11_21.2 (constants.%Self)] -// CHECK:STDOUT: %Foo.WithSelf.decl = interface_with_self_decl @Foo.loc11 [concrete] +// CHECK:STDOUT: %Self.loc20_21.1: @Foo.loc20.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc20_21.2 (constants.%Self)] +// CHECK:STDOUT: %Foo.WithSelf.decl = interface_with_self_decl @Foo.loc20 [concrete] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.loc11_21.1 +// CHECK:STDOUT: .Self = %Self.loc20_21.1 // CHECK:STDOUT: witness = () // CHECK:STDOUT: // CHECK:STDOUT: !requires: @@ -963,9 +1050,9 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: %a.loc7_16.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Foo.loc11(constants.%a) { -// CHECK:STDOUT: %a.patt.loc11_16.2 => constants.%a.patt -// CHECK:STDOUT: %a.loc11_16.1 => constants.%a +// CHECK:STDOUT: specific @Foo.loc20(constants.%a) { +// CHECK:STDOUT: %a.patt.loc20_16.2 => constants.%a.patt +// CHECK:STDOUT: %a.loc20_16.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Foo.WithSelf(constants.%a, constants.%Self) {} @@ -983,9 +1070,9 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: %a: %C = symbolic_binding a, 0 [symbolic] // CHECK:STDOUT: %Foo.type.bc6a25.1: type = generic_interface_type @Foo.loc7 [concrete] // CHECK:STDOUT: %Foo.generic.d3ea5a.1: %Foo.type.bc6a25.1 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.bc6a25.2: type = generic_interface_type @Foo.loc11 [concrete] +// CHECK:STDOUT: %Foo.type.bc6a25.2: type = generic_interface_type @Foo.loc20 [concrete] // CHECK:STDOUT: %Foo.generic.d3ea5a.2: %Foo.type.bc6a25.2 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.137: type = facet_type <@Foo.loc11, @Foo.loc11(%a)> [symbolic] +// CHECK:STDOUT: %Foo.type.137: type = facet_type <@Foo.loc20, @Foo.loc20(%a)> [symbolic] // CHECK:STDOUT: %Self: %Foo.type.137 = symbolic_binding Self, 1 [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1007,14 +1094,14 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: } // CHECK:STDOUT: %a.loc7_16.2: %C = symbolic_binding a, 0 [symbolic = %a.loc7_16.1 (constants.%a)] // CHECK:STDOUT: } -// CHECK:STDOUT: %Foo.decl.loc11: %Foo.type.bc6a25.2 = interface_decl @Foo.loc11 [concrete = constants.%Foo.generic.d3ea5a.2] { -// CHECK:STDOUT: %a.patt.loc11_16.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc11_16.2 (constants.%a.patt)] +// CHECK:STDOUT: %Foo.decl.loc20: %Foo.type.bc6a25.2 = interface_decl @Foo.loc20 [concrete = constants.%Foo.generic.d3ea5a.2] { +// CHECK:STDOUT: %a.patt.loc20_16.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc20_16.2 (constants.%a.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc11: type = splice_block %D.ref [concrete = constants.%C] { +// CHECK:STDOUT: %.loc20: type = splice_block %D.ref [concrete = constants.%C] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D [concrete = constants.%C] // CHECK:STDOUT: } -// CHECK:STDOUT: %a.loc11_16.2: %C = symbolic_binding a, 0 [symbolic = %a.loc11_16.1 (constants.%a)] +// CHECK:STDOUT: %a.loc20_16.2: %C = symbolic_binding a, 0 [symbolic = %a.loc20_16.1 (constants.%a)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1025,20 +1112,20 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: interface; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @Foo.loc11(%a.loc11_16.2: %C) { -// CHECK:STDOUT: %a.patt.loc11_16.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc11_16.2 (constants.%a.patt)] -// CHECK:STDOUT: %a.loc11_16.1: %C = symbolic_binding a, 0 [symbolic = %a.loc11_16.1 (constants.%a)] +// CHECK:STDOUT: generic interface @Foo.loc20(%a.loc20_16.2: %C) { +// CHECK:STDOUT: %a.patt.loc20_16.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc20_16.2 (constants.%a.patt)] +// CHECK:STDOUT: %a.loc20_16.1: %C = symbolic_binding a, 0 [symbolic = %a.loc20_16.1 (constants.%a)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Foo.type: type = facet_type <@Foo.loc11, @Foo.loc11(%a.loc11_16.1)> [symbolic = %Foo.type (constants.%Foo.type.137)] -// CHECK:STDOUT: %Self.loc11_23.2: @Foo.loc11.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc11_23.2 (constants.%Self)] +// CHECK:STDOUT: %Foo.type: type = facet_type <@Foo.loc20, @Foo.loc20(%a.loc20_16.1)> [symbolic = %Foo.type (constants.%Foo.type.137)] +// CHECK:STDOUT: %Self.loc20_23.2: @Foo.loc20.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc20_23.2 (constants.%Self)] // CHECK:STDOUT: // CHECK:STDOUT: interface { -// CHECK:STDOUT: %Self.loc11_23.1: @Foo.loc11.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc11_23.2 (constants.%Self)] -// CHECK:STDOUT: %Foo.WithSelf.decl = interface_with_self_decl @Foo.loc11 [concrete] +// CHECK:STDOUT: %Self.loc20_23.1: @Foo.loc20.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc20_23.2 (constants.%Self)] +// CHECK:STDOUT: %Foo.WithSelf.decl = interface_with_self_decl @Foo.loc20 [concrete] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.loc11_23.1 +// CHECK:STDOUT: .Self = %Self.loc20_23.1 // CHECK:STDOUT: witness = () // CHECK:STDOUT: // CHECK:STDOUT: !requires: @@ -1058,9 +1145,9 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: %a.loc7_16.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Foo.loc11(constants.%a) { -// CHECK:STDOUT: %a.patt.loc11_16.2 => constants.%a.patt -// CHECK:STDOUT: %a.loc11_16.1 => constants.%a +// CHECK:STDOUT: specific @Foo.loc20(constants.%a) { +// CHECK:STDOUT: %a.patt.loc20_16.2 => constants.%a.patt +// CHECK:STDOUT: %a.loc20_16.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Foo.WithSelf(constants.%a, constants.%Self) {} @@ -1130,9 +1217,9 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: %a: %C = symbolic_binding a, 0 [symbolic] // CHECK:STDOUT: %Foo.type.bc6a25.1: type = generic_interface_type @Foo.1 [concrete] // CHECK:STDOUT: %Foo.generic.d3ea5a.1: %Foo.type.bc6a25.1 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.bc6a25.2: type = generic_interface_type @Foo.loc12 [concrete] +// CHECK:STDOUT: %Foo.type.bc6a25.2: type = generic_interface_type @Foo.loc21 [concrete] // CHECK:STDOUT: %Foo.generic.d3ea5a.2: %Foo.type.bc6a25.2 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.137: type = facet_type <@Foo.loc12, @Foo.loc12(%a)> [symbolic] +// CHECK:STDOUT: %Foo.type.137: type = facet_type <@Foo.loc21, @Foo.loc21(%a)> [symbolic] // CHECK:STDOUT: %Self: %Foo.type.137 = symbolic_binding Self, 1 [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1154,14 +1241,14 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: %default.import.loc2_30.2 = import // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [concrete = constants.%C] // CHECK:STDOUT: %D: type = alias_binding D, %C.ref [concrete = constants.%C] -// CHECK:STDOUT: %Foo.decl: %Foo.type.bc6a25.2 = interface_decl @Foo.loc12 [concrete = constants.%Foo.generic.d3ea5a.2] { -// CHECK:STDOUT: %a.patt.loc12_16.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc12_16.2 (constants.%a.patt)] +// CHECK:STDOUT: %Foo.decl: %Foo.type.bc6a25.2 = interface_decl @Foo.loc21 [concrete = constants.%Foo.generic.d3ea5a.2] { +// CHECK:STDOUT: %a.patt.loc21_16.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc21_16.2 (constants.%a.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc12: type = splice_block %D.ref [concrete = constants.%C] { +// CHECK:STDOUT: %.loc21: type = splice_block %D.ref [concrete = constants.%C] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D [concrete = constants.%C] // CHECK:STDOUT: } -// CHECK:STDOUT: %a.loc12_16.2: %C = symbolic_binding a, 0 [symbolic = %a.loc12_16.1 (constants.%a)] +// CHECK:STDOUT: %a.loc21_16.2: %C = symbolic_binding a, 0 [symbolic = %a.loc21_16.1 (constants.%a)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1172,20 +1259,20 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: interface; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @Foo.loc12(%a.loc12_16.2: %C) { -// CHECK:STDOUT: %a.patt.loc12_16.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc12_16.2 (constants.%a.patt)] -// CHECK:STDOUT: %a.loc12_16.1: %C = symbolic_binding a, 0 [symbolic = %a.loc12_16.1 (constants.%a)] +// CHECK:STDOUT: generic interface @Foo.loc21(%a.loc21_16.2: %C) { +// CHECK:STDOUT: %a.patt.loc21_16.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc21_16.2 (constants.%a.patt)] +// CHECK:STDOUT: %a.loc21_16.1: %C = symbolic_binding a, 0 [symbolic = %a.loc21_16.1 (constants.%a)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Foo.type: type = facet_type <@Foo.loc12, @Foo.loc12(%a.loc12_16.1)> [symbolic = %Foo.type (constants.%Foo.type.137)] -// CHECK:STDOUT: %Self.loc12_21.2: @Foo.loc12.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc12_21.2 (constants.%Self)] +// CHECK:STDOUT: %Foo.type: type = facet_type <@Foo.loc21, @Foo.loc21(%a.loc21_16.1)> [symbolic = %Foo.type (constants.%Foo.type.137)] +// CHECK:STDOUT: %Self.loc21_21.2: @Foo.loc21.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc21_21.2 (constants.%Self)] // CHECK:STDOUT: // CHECK:STDOUT: interface { -// CHECK:STDOUT: %Self.loc12_21.1: @Foo.loc12.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc12_21.2 (constants.%Self)] -// CHECK:STDOUT: %Foo.WithSelf.decl = interface_with_self_decl @Foo.loc12 [concrete] +// CHECK:STDOUT: %Self.loc21_21.1: @Foo.loc21.%Foo.type (%Foo.type.137) = symbolic_binding Self, 1 [symbolic = %Self.loc21_21.2 (constants.%Self)] +// CHECK:STDOUT: %Foo.WithSelf.decl = interface_with_self_decl @Foo.loc21 [concrete] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.loc12_21.1 +// CHECK:STDOUT: .Self = %Self.loc21_21.1 // CHECK:STDOUT: witness = () // CHECK:STDOUT: // CHECK:STDOUT: !requires: @@ -1204,9 +1291,9 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: %a => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Foo.loc12(constants.%a) { -// CHECK:STDOUT: %a.patt.loc12_16.2 => constants.%a.patt -// CHECK:STDOUT: %a.loc12_16.1 => constants.%a +// CHECK:STDOUT: specific @Foo.loc21(constants.%a) { +// CHECK:STDOUT: %a.patt.loc21_16.2 => constants.%a.patt +// CHECK:STDOUT: %a.loc21_16.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Foo.WithSelf(constants.%a, constants.%Self) {} @@ -1225,9 +1312,9 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: %a: %const = symbolic_binding a, 0 [symbolic] // CHECK:STDOUT: %Foo.type.bc6a25.1: type = generic_interface_type @Foo.loc6 [concrete] // CHECK:STDOUT: %Foo.generic.d3ea5a.1: %Foo.type.bc6a25.1 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.bc6a25.2: type = generic_interface_type @Foo.loc12 [concrete] +// CHECK:STDOUT: %Foo.type.bc6a25.2: type = generic_interface_type @Foo.loc27 [concrete] // CHECK:STDOUT: %Foo.generic.d3ea5a.2: %Foo.type.bc6a25.2 = struct_value () [concrete] -// CHECK:STDOUT: %Foo.type.758: type = facet_type <@Foo.loc12, @Foo.loc12(%a)> [symbolic] +// CHECK:STDOUT: %Foo.type.758: type = facet_type <@Foo.loc27, @Foo.loc27(%a)> [symbolic] // CHECK:STDOUT: %Self: %Foo.type.758 = symbolic_binding Self, 1 [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1247,16 +1334,16 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: } // CHECK:STDOUT: %a.loc6_16.2: %const = symbolic_binding a, 0 [symbolic = %a.loc6_16.1 (constants.%a)] // CHECK:STDOUT: } -// CHECK:STDOUT: %Foo.decl.loc12: %Foo.type.bc6a25.2 = interface_decl @Foo.loc12 [concrete = constants.%Foo.generic.d3ea5a.2] { -// CHECK:STDOUT: %a.patt.loc12_16.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc12_16.2 (constants.%a.patt)] +// CHECK:STDOUT: %Foo.decl.loc27: %Foo.type.bc6a25.2 = interface_decl @Foo.loc27 [concrete = constants.%Foo.generic.d3ea5a.2] { +// CHECK:STDOUT: %a.patt.loc27_16.1: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc27_16.2 (constants.%a.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc12: type = splice_block %const.loc12_18 [concrete = constants.%const] { +// CHECK:STDOUT: %.loc27: type = splice_block %const.loc27_18 [concrete = constants.%const] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %const.loc12_25: type = const_type %C.ref [concrete = constants.%const] -// CHECK:STDOUT: %const.loc12_18: type = const_type %const.loc12_25 [concrete = constants.%const] +// CHECK:STDOUT: %const.loc27_25: type = const_type %C.ref [concrete = constants.%const] +// CHECK:STDOUT: %const.loc27_18: type = const_type %const.loc27_25 [concrete = constants.%const] // CHECK:STDOUT: } -// CHECK:STDOUT: %a.loc12_16.2: %const = symbolic_binding a, 0 [symbolic = %a.loc12_16.1 (constants.%a)] +// CHECK:STDOUT: %a.loc27_16.2: %const = symbolic_binding a, 0 [symbolic = %a.loc27_16.1 (constants.%a)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1267,20 +1354,20 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: interface; // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @Foo.loc12(%a.loc12_16.2: %const) { -// CHECK:STDOUT: %a.patt.loc12_16.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc12_16.2 (constants.%a.patt)] -// CHECK:STDOUT: %a.loc12_16.1: %const = symbolic_binding a, 0 [symbolic = %a.loc12_16.1 (constants.%a)] +// CHECK:STDOUT: generic interface @Foo.loc27(%a.loc27_16.2: %const) { +// CHECK:STDOUT: %a.patt.loc27_16.2: %pattern_type = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc27_16.2 (constants.%a.patt)] +// CHECK:STDOUT: %a.loc27_16.1: %const = symbolic_binding a, 0 [symbolic = %a.loc27_16.1 (constants.%a)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %Foo.type: type = facet_type <@Foo.loc12, @Foo.loc12(%a.loc12_16.1)> [symbolic = %Foo.type (constants.%Foo.type.758)] -// CHECK:STDOUT: %Self.loc12_35.2: @Foo.loc12.%Foo.type (%Foo.type.758) = symbolic_binding Self, 1 [symbolic = %Self.loc12_35.2 (constants.%Self)] +// CHECK:STDOUT: %Foo.type: type = facet_type <@Foo.loc27, @Foo.loc27(%a.loc27_16.1)> [symbolic = %Foo.type (constants.%Foo.type.758)] +// CHECK:STDOUT: %Self.loc27_35.2: @Foo.loc27.%Foo.type (%Foo.type.758) = symbolic_binding Self, 1 [symbolic = %Self.loc27_35.2 (constants.%Self)] // CHECK:STDOUT: // CHECK:STDOUT: interface { -// CHECK:STDOUT: %Self.loc12_35.1: @Foo.loc12.%Foo.type (%Foo.type.758) = symbolic_binding Self, 1 [symbolic = %Self.loc12_35.2 (constants.%Self)] -// CHECK:STDOUT: %Foo.WithSelf.decl = interface_with_self_decl @Foo.loc12 [concrete] +// CHECK:STDOUT: %Self.loc27_35.1: @Foo.loc27.%Foo.type (%Foo.type.758) = symbolic_binding Self, 1 [symbolic = %Self.loc27_35.2 (constants.%Self)] +// CHECK:STDOUT: %Foo.WithSelf.decl = interface_with_self_decl @Foo.loc27 [concrete] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.loc12_35.1 +// CHECK:STDOUT: .Self = %Self.loc27_35.1 // CHECK:STDOUT: witness = () // CHECK:STDOUT: // CHECK:STDOUT: !requires: @@ -1300,9 +1387,9 @@ interface Foo(a: const (const C)) {} // CHECK:STDOUT: %a.loc6_16.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Foo.loc12(constants.%a) { -// CHECK:STDOUT: %a.patt.loc12_16.2 => constants.%a.patt -// CHECK:STDOUT: %a.loc12_16.1 => constants.%a +// CHECK:STDOUT: specific @Foo.loc27(constants.%a) { +// CHECK:STDOUT: %a.patt.loc27_16.2 => constants.%a.patt +// CHECK:STDOUT: %a.loc27_16.1 => constants.%a // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Foo.WithSelf(constants.%a, constants.%Self) {} diff --git a/toolchain/check/testdata/interop/cpp/basics/cpp_diagnostics.carbon b/toolchain/check/testdata/interop/cpp/basics/cpp_diagnostics.carbon index 4597a2970d5a..969e7960ff82 100644 --- a/toolchain/check/testdata/interop/cpp/basics/cpp_diagnostics.carbon +++ b/toolchain/check/testdata/interop/cpp/basics/cpp_diagnostics.carbon @@ -16,15 +16,19 @@ // --- one_error.h +// CHECK:STDERR: ╷ ╭── included from: fail_import_cpp_file_with_one_error.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./one_error.h:[[@LINE+6]]:2 +// CHECK:STDERR: -> │ #error "error1" +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: "error1" [CppInteropParseError] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: #error "error1" // --- fail_import_cpp_file_with_one_error.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: included from: fail_import_cpp_file_with_one_error.carbon:[[@LINE+3]]:10 [InCppInclude] -// CHECK:STDERR: ./one_error.h:2:2: error: "error1" [CppInteropParseError] -// CHECK:STDERR: import Cpp library "one_error.h"; // ============================================================================ @@ -33,19 +37,27 @@ import Cpp library "one_error.h"; // --- multiple_errors.h +// CHECK:STDERR: ╷ ╭── included from: fail_import_cpp_file_with_multiple_errors.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./multiple_errors.h:[[@LINE+6]]:2 +// CHECK:STDERR: -> │ #error "error1" +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: "error1" [CppInteropParseError] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: #error "error1" +// CHECK:STDERR: ╷ ╭── included from: fail_import_cpp_file_with_multiple_errors.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./multiple_errors.h:[[@LINE+6]]:2 +// CHECK:STDERR: -> │ #error "error2" +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: "error2" [CppInteropParseError] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: #error "error2" // --- fail_import_cpp_file_with_multiple_errors.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: included from: fail_import_cpp_file_with_multiple_errors.carbon:[[@LINE+6]]:10 [InCppInclude] -// CHECK:STDERR: ./multiple_errors.h:2:2: error: "error1" [CppInteropParseError] -// CHECK:STDERR: -// CHECK:STDERR: included from: fail_import_cpp_file_with_multiple_errors.carbon:[[@LINE+3]]:10 [InCppInclude] -// CHECK:STDERR: ./multiple_errors.h:3:2: error: "error2" [CppInteropParseError] -// CHECK:STDERR: import Cpp library "multiple_errors.h"; // ============================================================================ @@ -54,6 +66,13 @@ import Cpp library "multiple_errors.h"; // --- one_warning.h +// CHECK:STDERR: ╷ ╭── included from: import_cpp_file_with_one_warning.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./one_warning.h:[[@LINE+6]]:2 +// CHECK:STDERR: -> │ #warning "warning1" +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ warning: "warning1" [CppInteropParseWarning] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: #warning "warning1" // --- import_cpp_file_with_one_warning.carbon @@ -61,9 +80,6 @@ import Cpp library "multiple_errors.h"; library "[[@TEST_NAME]]"; //@dump-sem-ir-begin -// CHECK:STDERR: included from: import_cpp_file_with_one_warning.carbon:[[@LINE+3]]:10 [InCppInclude] -// CHECK:STDERR: ./one_warning.h:2:2: warning: "warning1" [CppInteropParseWarning] -// CHECK:STDERR: import Cpp library "one_warning.h"; //@dump-sem-ir-end @@ -73,8 +89,29 @@ import Cpp library "one_warning.h"; // --- multiple_warnings.h +// CHECK:STDERR: ╷ ╭── included from: import_cpp_file_with_multiple_warnings.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./multiple_warnings.h:[[@LINE+6]]:2 +// CHECK:STDERR: -> │ #warning "warning1" +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ warning: "warning1" [CppInteropParseWarning] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: #warning "warning1" +// CHECK:STDERR: ╷ ╭── included from: import_cpp_file_with_multiple_warnings.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./multiple_warnings.h:[[@LINE+6]]:2 +// CHECK:STDERR: -> │ #warning "warning2" +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ warning: "warning2" [CppInteropParseWarning] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: #warning "warning2" +// CHECK:STDERR: ╷ ╭── included from: import_cpp_file_with_multiple_warnings.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./multiple_warnings.h:[[@LINE+6]]:2 +// CHECK:STDERR: -> │ #warning "warning3" +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ warning: "warning3" [CppInteropParseWarning] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: #warning "warning3" // --- import_cpp_file_with_multiple_warnings.carbon @@ -82,15 +119,6 @@ import Cpp library "one_warning.h"; library "[[@TEST_NAME]]"; //@dump-sem-ir-begin -// CHECK:STDERR: included from: import_cpp_file_with_multiple_warnings.carbon:[[@LINE+9]]:10 [InCppInclude] -// CHECK:STDERR: ./multiple_warnings.h:2:2: warning: "warning1" [CppInteropParseWarning] -// CHECK:STDERR: -// CHECK:STDERR: included from: import_cpp_file_with_multiple_warnings.carbon:[[@LINE+6]]:10 [InCppInclude] -// CHECK:STDERR: ./multiple_warnings.h:3:2: warning: "warning2" [CppInteropParseWarning] -// CHECK:STDERR: -// CHECK:STDERR: included from: import_cpp_file_with_multiple_warnings.carbon:[[@LINE+3]]:10 [InCppInclude] -// CHECK:STDERR: ./multiple_warnings.h:4:2: warning: "warning3" [CppInteropParseWarning] -// CHECK:STDERR: import Cpp library "multiple_warnings.h"; //@dump-sem-ir-end @@ -100,19 +128,27 @@ import Cpp library "multiple_warnings.h"; // --- one_error_and_one_warning.h +// CHECK:STDERR: ╷ ╭── included from: fail_import_cpp_file_with_one_error_and_one_warning.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./one_error_and_one_warning.h:[[@LINE+6]]:2 +// CHECK:STDERR: -> │ #error "error1" +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: "error1" [CppInteropParseError] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: #error "error1" +// CHECK:STDERR: ╷ ╭── included from: fail_import_cpp_file_with_one_error_and_one_warning.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./one_error_and_one_warning.h:[[@LINE+6]]:2 +// CHECK:STDERR: -> │ #warning "warning1" +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ warning: "warning1" [CppInteropParseWarning] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: #warning "warning1" // --- fail_import_cpp_file_with_one_error_and_one_warning.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: included from: fail_import_cpp_file_with_one_error_and_one_warning.carbon:[[@LINE+6]]:10 [InCppInclude] -// CHECK:STDERR: ./one_error_and_one_warning.h:2:2: error: "error1" [CppInteropParseError] -// CHECK:STDERR: -// CHECK:STDERR: included from: fail_import_cpp_file_with_one_error_and_one_warning.carbon:[[@LINE+3]]:10 [InCppInclude] -// CHECK:STDERR: ./one_error_and_one_warning.h:3:2: warning: "warning1" [CppInteropParseWarning] -// CHECK:STDERR: import Cpp library "one_error_and_one_warning.h"; // ============================================================================ @@ -121,31 +157,51 @@ import Cpp library "one_error_and_one_warning.h"; // --- multiple_errors_and_multiple_warnings.h +// CHECK:STDERR: ╷ ╭── included from: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./multiple_errors_and_multiple_warnings.h:[[@LINE+6]]:2 +// CHECK:STDERR: -> │ #error "error1" +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: "error1" [CppInteropParseError] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: #error "error1" +// CHECK:STDERR: ╷ ╭── included from: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./multiple_errors_and_multiple_warnings.h:[[@LINE+6]]:2 +// CHECK:STDERR: -> │ #error "error2" +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: "error2" [CppInteropParseError] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: #error "error2" +// CHECK:STDERR: ╷ ╭── included from: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./multiple_errors_and_multiple_warnings.h:[[@LINE+6]]:2 +// CHECK:STDERR: -> │ #warning "warning1" +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ warning: "warning1" [CppInteropParseWarning] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: #warning "warning1" +// CHECK:STDERR: ╷ ╭── included from: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./multiple_errors_and_multiple_warnings.h:[[@LINE+6]]:2 +// CHECK:STDERR: -> │ #warning "warning2" +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ warning: "warning2" [CppInteropParseWarning] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: #warning "warning2" +// CHECK:STDERR: ╷ ╭── included from: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./multiple_errors_and_multiple_warnings.h:[[@LINE+6]]:2 +// CHECK:STDERR: -> │ #warning "warning3" +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ warning: "warning3" [CppInteropParseWarning] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: #warning "warning3" // --- fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: included from: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon:[[@LINE+15]]:10 [InCppInclude] -// CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:2:2: error: "error1" [CppInteropParseError] -// CHECK:STDERR: -// CHECK:STDERR: included from: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon:[[@LINE+12]]:10 [InCppInclude] -// CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:3:2: error: "error2" [CppInteropParseError] -// CHECK:STDERR: -// CHECK:STDERR: included from: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon:[[@LINE+9]]:10 [InCppInclude] -// CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:4:2: warning: "warning1" [CppInteropParseWarning] -// CHECK:STDERR: -// CHECK:STDERR: included from: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon:[[@LINE+6]]:10 [InCppInclude] -// CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:5:2: warning: "warning2" [CppInteropParseWarning] -// CHECK:STDERR: -// CHECK:STDERR: included from: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon:[[@LINE+3]]:10 [InCppInclude] -// CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:6:2: warning: "warning3" [CppInteropParseWarning] -// CHECK:STDERR: import Cpp library "multiple_errors_and_multiple_warnings.h"; // ============================================================================ @@ -154,12 +210,40 @@ import Cpp library "multiple_errors_and_multiple_warnings.h"; // --- multi_one_warning.h +// CHECK:STDERR: ╷ ╭── included from: import_multiple_cpp_files_with_warnings.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./multi_one_warning.h:[[@LINE+6]]:2 +// CHECK:STDERR: -> │ #warning "warning1" +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ warning: "warning1" [CppInteropParseWarning] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: #warning "warning1" // --- multi_multiple_warnings.h +// CHECK:STDERR: ╷ ╭── included from: import_multiple_cpp_files_with_warnings.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./multi_multiple_warnings.h:[[@LINE+6]]:2 +// CHECK:STDERR: -> │ #warning "warning1" +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ warning: "warning1" [CppInteropParseWarning] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: #warning "warning1" +// CHECK:STDERR: ╷ ╭── included from: import_multiple_cpp_files_with_warnings.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./multi_multiple_warnings.h:[[@LINE+6]]:2 +// CHECK:STDERR: -> │ #warning "warning2" +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ warning: "warning2" [CppInteropParseWarning] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: #warning "warning2" +// CHECK:STDERR: ╷ ╭── included from: import_multiple_cpp_files_with_warnings.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./multi_multiple_warnings.h:[[@LINE+6]]:2 +// CHECK:STDERR: -> │ #warning "warning3" +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ warning: "warning3" [CppInteropParseWarning] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: #warning "warning3" // --- import_multiple_cpp_files_with_warnings.carbon @@ -167,19 +251,7 @@ import Cpp library "multiple_errors_and_multiple_warnings.h"; library "[[@TEST_NAME]]"; //@dump-sem-ir-begin -// CHECK:STDERR: included from: import_multiple_cpp_files_with_warnings.carbon:[[@LINE+3]]:10 [InCppInclude] -// CHECK:STDERR: ./multi_one_warning.h:2:2: warning: "warning1" [CppInteropParseWarning] -// CHECK:STDERR: import Cpp library "multi_one_warning.h"; -// CHECK:STDERR: included from: import_multiple_cpp_files_with_warnings.carbon:[[@LINE+9]]:10 [InCppInclude] -// CHECK:STDERR: ./multi_multiple_warnings.h:2:2: warning: "warning1" [CppInteropParseWarning] -// CHECK:STDERR: -// CHECK:STDERR: included from: import_multiple_cpp_files_with_warnings.carbon:[[@LINE+6]]:10 [InCppInclude] -// CHECK:STDERR: ./multi_multiple_warnings.h:3:2: warning: "warning2" [CppInteropParseWarning] -// CHECK:STDERR: -// CHECK:STDERR: included from: import_multiple_cpp_files_with_warnings.carbon:[[@LINE+3]]:10 [InCppInclude] -// CHECK:STDERR: ./multi_multiple_warnings.h:4:2: warning: "warning3" [CppInteropParseWarning] -// CHECK:STDERR: import Cpp library "multi_multiple_warnings.h"; //@dump-sem-ir-end @@ -189,43 +261,71 @@ import Cpp library "multi_multiple_warnings.h"; // --- multi_one_error_and_one_warning.h +// CHECK:STDERR: ╷ ╭── included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./multi_one_error_and_one_warning.h:[[@LINE+6]]:2 +// CHECK:STDERR: -> │ #error "error1" +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: "error1" [CppInteropParseError] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: #error "error1" +// CHECK:STDERR: ╷ ╭── included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./multi_one_error_and_one_warning.h:[[@LINE+6]]:2 +// CHECK:STDERR: -> │ #warning "warning1" +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ warning: "warning1" [CppInteropParseWarning] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: #warning "warning1" // --- multi_multiple_errors_and_multiple_warnings.h +// CHECK:STDERR: ╷ ╭── included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./multi_multiple_errors_and_multiple_warnings.h:[[@LINE+6]]:2 +// CHECK:STDERR: -> │ #error "error1" +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: "error1" [CppInteropParseError] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: #error "error1" +// CHECK:STDERR: ╷ ╭── included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./multi_multiple_errors_and_multiple_warnings.h:[[@LINE+6]]:2 +// CHECK:STDERR: -> │ #error "error2" +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: "error2" [CppInteropParseError] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: #error "error2" +// CHECK:STDERR: ╷ ╭── included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./multi_multiple_errors_and_multiple_warnings.h:[[@LINE+6]]:2 +// CHECK:STDERR: -> │ #warning "warning1" +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ warning: "warning1" [CppInteropParseWarning] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: #warning "warning1" +// CHECK:STDERR: ╷ ╭── included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./multi_multiple_errors_and_multiple_warnings.h:[[@LINE+6]]:2 +// CHECK:STDERR: -> │ #warning "warning2" +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ warning: "warning2" [CppInteropParseWarning] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: #warning "warning2" +// CHECK:STDERR: ╷ ╭── included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./multi_multiple_errors_and_multiple_warnings.h:[[@LINE+6]]:2 +// CHECK:STDERR: -> │ #warning "warning3" +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ warning: "warning3" [CppInteropParseWarning] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: #warning "warning3" // --- fail_import_multiple_cpp_files_with_errors_and_warnings.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+6]]:10 [InCppInclude] -// CHECK:STDERR: ./multi_one_error_and_one_warning.h:2:2: error: "error1" [CppInteropParseError] -// CHECK:STDERR: -// CHECK:STDERR: included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+3]]:10 [InCppInclude] -// CHECK:STDERR: ./multi_one_error_and_one_warning.h:3:2: warning: "warning1" [CppInteropParseWarning] -// CHECK:STDERR: import Cpp library "multi_one_error_and_one_warning.h"; -// CHECK:STDERR: included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+15]]:10 [InCppInclude] -// CHECK:STDERR: ./multi_multiple_errors_and_multiple_warnings.h:2:2: error: "error1" [CppInteropParseError] -// CHECK:STDERR: -// CHECK:STDERR: included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+12]]:10 [InCppInclude] -// CHECK:STDERR: ./multi_multiple_errors_and_multiple_warnings.h:3:2: error: "error2" [CppInteropParseError] -// CHECK:STDERR: -// CHECK:STDERR: included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+9]]:10 [InCppInclude] -// CHECK:STDERR: ./multi_multiple_errors_and_multiple_warnings.h:4:2: warning: "warning1" [CppInteropParseWarning] -// CHECK:STDERR: -// CHECK:STDERR: included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+6]]:10 [InCppInclude] -// CHECK:STDERR: ./multi_multiple_errors_and_multiple_warnings.h:5:2: warning: "warning2" [CppInteropParseWarning] -// CHECK:STDERR: -// CHECK:STDERR: included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+3]]:10 [InCppInclude] -// CHECK:STDERR: ./multi_multiple_errors_and_multiple_warnings.h:6:2: warning: "warning3" [CppInteropParseWarning] -// CHECK:STDERR: import Cpp library "multi_multiple_errors_and_multiple_warnings.h"; // ============================================================================ @@ -234,6 +334,14 @@ import Cpp library "multi_multiple_errors_and_multiple_warnings.h"; // --- indirect_one_error.h +// CHECK:STDERR: ╷ ╭── included from: fail_import_indirect_error.carbon [InCppInclude] +// CHECK:STDERR: │ ├── included from: ./indirect_error.h [InCppInclude] +// CHECK:STDERR: ├─┤ ./indirect_one_error.h:[[@LINE+6]]:2 +// CHECK:STDERR: -> │ #error "error1" +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: "error1" [CppInteropParseError] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: #error "error1" // --- indirect_error.h @@ -244,10 +352,6 @@ import Cpp library "multi_multiple_errors_and_multiple_warnings.h"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: included from: fail_import_indirect_error.carbon:[[@LINE+4]]:10 [InCppInclude] -// CHECK:STDERR: included from: ./indirect_error.h:2:10 [InCppInclude] -// CHECK:STDERR: ./indirect_one_error.h:2:2: error: "error1" [CppInteropParseError] -// CHECK:STDERR: import Cpp library "indirect_error.h"; // ============================================================================ @@ -256,6 +360,14 @@ import Cpp library "indirect_error.h"; // --- indirect_one_warning.h +// CHECK:STDERR: ╷ ╭── included from: import_indirect_warning.carbon [InCppInclude] +// CHECK:STDERR: │ ├── included from: ./indirect_warning.h [InCppInclude] +// CHECK:STDERR: ├─┤ ./indirect_one_warning.h:[[@LINE+6]]:2 +// CHECK:STDERR: -> │ #warning "warning1" +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ warning: "warning1" [CppInteropParseWarning] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: #warning "warning1" // --- indirect_warning.h @@ -267,10 +379,6 @@ import Cpp library "indirect_error.h"; library "[[@TEST_NAME]]"; //@dump-sem-ir-begin -// CHECK:STDERR: included from: import_indirect_warning.carbon:[[@LINE+4]]:10 [InCppInclude] -// CHECK:STDERR: included from: ./indirect_warning.h:2:10 [InCppInclude] -// CHECK:STDERR: ./indirect_one_warning.h:2:2: warning: "warning1" [CppInteropParseWarning] -// CHECK:STDERR: import Cpp library "indirect_warning.h"; //@dump-sem-ir-end @@ -280,20 +388,29 @@ import Cpp library "indirect_warning.h"; // --- lexer_error_one_warning.h +// CHECK:STDERR: ╷ ╭── included from: fail_import_cpp_library_lexer_error.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./lexer_error_one_warning.h:[[@LINE+6]]:2 +// CHECK:STDERR: -> │ #warning "warning1" +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ warning: "warning1" [CppInteropParseWarning] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: #warning "warning1" // --- fail_import_cpp_library_lexer_error.carbon library "[[@TEST_NAME]]"; +// CHECK:STDERR: ╭─┤ fail_import_cpp_library_lexer_error.carbon:[[@LINE+7]]:3 +// CHECK:STDERR: -> │ //!Lexer error: whitespace is required after the comment introducer. +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: whitespace is required after '//' +// CHECK:STDERR: · ┃ [NoWhitespaceAfterCommentIntroducer] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: //!Lexer error: whitespace is required after the comment introducer. // TODO: Move this warning to be after the lexer error. -// CHECK:STDERR: included from: fail_import_cpp_library_lexer_error.carbon:[[@LINE+5]]:10 [InCppInclude] -// CHECK:STDERR: ./lexer_error_one_warning.h:2:2: warning: "warning1" [CppInteropParseWarning] -// CHECK:STDERR: -// CHECK:STDERR: fail_import_cpp_library_lexer_error.carbon:[[@LINE-6]]:3: error: whitespace is required after '//' [NoWhitespaceAfterCommentIntroducer] -// CHECK:STDERR: import Cpp library "lexer_error_one_warning.h"; // ============================================================================ @@ -302,20 +419,30 @@ import Cpp library "lexer_error_one_warning.h"; // --- fix_it_hints.h +// CHECK:STDERR: ╷ ╭── included from: fail_import_fix_it_hints.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./fix_it_hints.h:[[@LINE+8]]:19 +// CHECK:STDERR: -> │ double score = 0.1 +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected ';' after top level declarator +// CHECK:STDERR: · │ ┃ [CppInteropParseError] +// CHECK:STDERR: · ╰────┤ insert `;` here [CppInteropFixItInsertion] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: double score = 0.1 // --- fail_import_fix_it_hints.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: included from: fail_import_fix_it_hints.carbon:[[@LINE+4]]:10 [InCppInclude] -// CHECK:STDERR: ./fix_it_hints.h:2:19: error: expected ';' after top level declarator [CppInteropParseError] -// CHECK:STDERR: ./fix_it_hints.h:2:19: note: insert `;` here [CppInteropFixItInsertion] -// CHECK:STDERR: import Cpp library "fix_it_hints.h"; fn F() { - // CHECK:STDERR: fail_import_fix_it_hints.carbon:[[@LINE+2]]:3-9: error: member name `foo` not found in `Cpp` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╭─┤ fail_import_fix_it_hints.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ Cpp.foo(); + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: member name `foo` not found in `Cpp` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.foo(); } @@ -329,6 +456,20 @@ fn F() { void foobar(int); inline void call_foobar() { + // CHECK:STDERR: ╷ ╭── included from: fail_with_notes.carbon [InCppInclude] + // CHECK:STDERR: ├─┤ ./with_notes.h:[[@LINE+13]]:3 + // CHECK:STDERR: │ void foobar(int); + // CHECK:STDERR: · ┬ ─┬─ + // CHECK:STDERR: · ╰──────────┤ candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: · ╰────┤ requires 1 argument, but 2 were provided + // CHECK:STDERR: · │ [CppInteropParseNoteReason] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ foobar(1, 2); + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'foobar' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: foobar(1, 2); } @@ -336,11 +477,6 @@ inline void call_foobar() { library "[[@TEST_NAME]]"; -// CHECK:STDERR: included from: fail_with_notes.carbon:[[@LINE+5]]:10 [InCppInclude] -// CHECK:STDERR: ./with_notes.h:5:3-8: error: no matching function for call to 'foobar' [CppInteropParseError] -// CHECK:STDERR: ./with_notes.h:2:6: note: candidate function not viable [CppInteropParseNote] -// CHECK:STDERR: ./with_notes.h:2:13-15: note: requires 1 argument, but 2 were provided [CppInteropParseNoteReason] -// CHECK:STDERR: import Cpp library "with_notes.h"; fn F() { @@ -356,6 +492,17 @@ fn F() { #define FOO BAR #define BAZ void f(error); +// CHECK:STDERR: ╷ ╭── included from: fail_use_context_stack.carbon [InCppInclude] +// CHECK:STDERR: │ ├── included from: ./direct_include.h [InCppInclude] +// CHECK:STDERR: │ ├── expanded from macro defined at: ./indirect_include.h [InCppMacroExpansion] +// CHECK:STDERR: │ ├── expanded from macro defined at: ./direct_include.h [InCppMacroExpansion] +// CHECK:STDERR: │ ├── expanded from macro defined at: ./indirect_include.h [InCppMacroExpansion] +// CHECK:STDERR: ├─┤ ./indirect_include.h:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ #define BAZ void f(error); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: unknown type name 'error' [CppInteropParseError] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: FOO // --- direct_include.h @@ -368,13 +515,6 @@ FOO library "[[@TEST_NAME]]"; -// CHECK:STDERR: included from: fail_use_context_stack.carbon:[[@LINE+7]]:10 [InCppInclude] -// CHECK:STDERR: included from: ./direct_include.h:4:10 [InCppInclude] -// CHECK:STDERR: expanded from macro defined at: ./indirect_include.h:2:13 [InCppMacroExpansion] -// CHECK:STDERR: expanded from macro defined at: ./direct_include.h:2:13 [InCppMacroExpansion] -// CHECK:STDERR: expanded from macro defined at: ./indirect_include.h:3:20 [InCppMacroExpansion] -// CHECK:STDERR: ./indirect_include.h:5:1: error: unknown type name 'error' [CppInteropParseError] -// CHECK:STDERR: import Cpp library "direct_include.h"; // ============================================================================ @@ -385,7 +525,12 @@ import Cpp library "direct_include.h"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_loc_in_inline_simple.carbon:[[@LINE+2]]:9-14: error: use of undeclared identifier 'banana' [CppInteropParseError] +// CHECK:STDERR: ╭─┤ fail_loc_in_inline_simple.carbon:[[@LINE+7]]:9 +// CHECK:STDERR: -> │ int n = banana; +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: use of undeclared identifier 'banana' +// CHECK:STDERR: · ┃ [CppInteropParseError] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import Cpp inline "int n = banana;"; @@ -393,8 +538,17 @@ import Cpp inline "int n = banana;"; import Cpp inline '''c++ void f(const int n) { - // CHECK:STDERR: fail_loc_in_inline_block.carbon:[[@LINE+3]]:3: error: cannot assign to variable 'n' with const-qualified type 'const int' [CppInteropParseError] - // CHECK:STDERR: fail_loc_in_inline_block.carbon:[[@LINE-2]]:8-18: note: variable 'n' declared const here [CppInteropParseNote] + // CHECK:STDERR: ╭─┤ fail_loc_in_inline_block.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ void f(const int n) { + // CHECK:STDERR: · ─────┬───── + // CHECK:STDERR: · ╰──┤ variable 'n' declared const here [CppInteropParseNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ ++n; + // CHECK:STDERR: · ┳ ─ + // CHECK:STDERR: · ┗━━┫ error: cannot assign to variable 'n' with const-qualified type 'const + // CHECK:STDERR: · ┃ int' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: ++n; } diff --git a/toolchain/check/testdata/interop/cpp/basics/fail_import_fix_its.carbon b/toolchain/check/testdata/interop/cpp/basics/fail_import_fix_its.carbon index de589f327a8f..789a277d0491 100644 --- a/toolchain/check/testdata/interop/cpp/basics/fail_import_fix_its.carbon +++ b/toolchain/check/testdata/interop/cpp/basics/fail_import_fix_its.carbon @@ -10,6 +10,14 @@ // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/basics/fail_import_fix_its.carbon // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/basics/fail_import_fix_its.carbon +// CHECK:STDERR: ╭─┤ :1:1 +// CHECK:STDERR: -> │ ; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ warning: extra ';' outside of a function is incompatible with C++98 +// CHECK:STDERR: · │ ┃ [CppInteropParseWarning] +// CHECK:STDERR: · ╰────┤ remove this [CppInteropFixItRemoval] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: // Covers the three shapes a Clang fix-it comes in, each of which becomes a // label saying what to do rather than the inline rendering Clang would draw. @@ -21,52 +29,80 @@ // --- replacement.h int variable_name; +// CHECK:STDERR: ╷ ╭── included from: fail_import_replacement.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./replacement.h:[[@LINE+21]]:13 +// CHECK:STDERR: │ int variable_name; +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ 'variable_name' declared here [CppInteropParseNote] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ int other = varable_name; +// CHECK:STDERR: · ┳━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: use of undeclared identifier 'varable_name'; did you +// CHECK:STDERR: · │ ┃ mean 'variable_name'? +// CHECK:STDERR: · │ ┃ [CppInteropParseError] +// CHECK:STDERR: · ╰────┤ replace with `variable_name` [CppInteropFixItReplacement] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: +// CHECK:STDERR: ╭─┤ :1:1 +// CHECK:STDERR: -> │ ; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ warning: extra ';' outside of a function is incompatible with C++98 +// CHECK:STDERR: · │ ┃ [CppInteropParseWarning] +// CHECK:STDERR: · ╰────┤ remove this [CppInteropFixItRemoval] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: int other = varable_name; // --- fail_import_replacement.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: :1:1: warning: extra ';' outside of a function is incompatible with C++98 [CppInteropParseWarning] -// CHECK:STDERR: :1:1: note: remove this [CppInteropFixItRemoval] -// CHECK:STDERR: -// CHECK:STDERR: included from: fail_import_replacement.carbon:[[@LINE+5]]:10 [InCppInclude] -// CHECK:STDERR: ./replacement.h:3:13-24: error: use of undeclared identifier 'varable_name'; did you mean 'variable_name'? [CppInteropParseError] -// CHECK:STDERR: ./replacement.h:3:13-24: note: replace with `variable_name` [CppInteropFixItReplacement] -// CHECK:STDERR: ./replacement.h:2:5: note: 'variable_name' declared here [CppInteropParseNote] -// CHECK:STDERR: import Cpp library "replacement.h"; // --- removal.h +// CHECK:STDERR: ╷ ╭── included from: import_removal.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./removal.h:[[@LINE+17]]:25 +// CHECK:STDERR: -> │ struct WithExtraSemi {};; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ warning: extra ';' outside of a function is +// CHECK:STDERR: · │ ┃ incompatible with C++98 +// CHECK:STDERR: · │ ┃ [CppInteropParseWarning] +// CHECK:STDERR: · ╰────┤ remove this [CppInteropFixItRemoval] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: +// CHECK:STDERR: ╭─┤ :1:1 +// CHECK:STDERR: -> │ ; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ warning: extra ';' outside of a function is incompatible with C++98 +// CHECK:STDERR: · │ ┃ [CppInteropParseWarning] +// CHECK:STDERR: · ╰────┤ remove this [CppInteropFixItRemoval] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: struct WithExtraSemi {};; // --- import_removal.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: :1:1: warning: extra ';' outside of a function is incompatible with C++98 [CppInteropParseWarning] -// CHECK:STDERR: :1:1: note: remove this [CppInteropFixItRemoval] -// CHECK:STDERR: -// CHECK:STDERR: included from: import_removal.carbon:[[@LINE+4]]:10 [InCppInclude] -// CHECK:STDERR: ./removal.h:2:25: warning: extra ';' outside of a function is incompatible with C++98 [CppInteropParseWarning] -// CHECK:STDERR: ./removal.h:2:25: note: remove this [CppInteropFixItRemoval] -// CHECK:STDERR: import Cpp library "removal.h"; // --- insertion.h +// CHECK:STDERR: ╷ ╭── included from: fail_import_insertion.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./insertion.h:[[@LINE+9]]:31 +// CHECK:STDERR: -> │ double missing_semicolon = 0.1 +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected ';' after top level +// CHECK:STDERR: · │ ┃ declarator +// CHECK:STDERR: · │ ┃ [CppInteropParseError] +// CHECK:STDERR: · ╰────┤ insert `;` here [CppInteropFixItInsertion] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: double missing_semicolon = 0.1 // --- fail_import_insertion.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: :1:1: warning: extra ';' outside of a function is incompatible with C++98 [CppInteropParseWarning] -// CHECK:STDERR: :1:1: note: remove this [CppInteropFixItRemoval] -// CHECK:STDERR: -// CHECK:STDERR: included from: fail_import_insertion.carbon:[[@LINE+4]]:10 [InCppInclude] -// CHECK:STDERR: ./insertion.h:2:31: error: expected ';' after top level declarator [CppInteropParseError] -// CHECK:STDERR: ./insertion.h:2:31: note: insert `;` here [CppInteropFixItInsertion] -// CHECK:STDERR: import Cpp library "insertion.h"; diff --git a/toolchain/check/testdata/interop/cpp/basics/import/bad_import.carbon b/toolchain/check/testdata/interop/cpp/basics/import/bad_import.carbon index 6d176396a035..88bfdd61664b 100644 --- a/toolchain/check/testdata/interop/cpp/basics/import/bad_import.carbon +++ b/toolchain/check/testdata/interop/cpp/basics/import/bad_import.carbon @@ -9,20 +9,32 @@ // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/basics/import/bad_import.carbon // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/basics/import/bad_import.carbon +// CHECK:STDERR: ╭─┤ :1:2 +// CHECK:STDERR: -> │ ; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected '}' [CppInteropParseError] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ fail_unterminated_import_inline.carbon +// CHECK:STDERR: │ void f() { +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ to match this '{' [CppInteropParseNote] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: // --- fail_unterminated_import_inline.carbon library "[[@TEST_NAME]]"; import Cpp inline '''c++ -// CHECK:STDERR: :1:2: error: expected '}' [CppInteropParseError] -// CHECK:STDERR: fail_unterminated_import_inline.carbon:[[@LINE+2]]:10: note: to match this '{' [CppInteropParseNote] -// CHECK:STDERR: void f() { '''; import Cpp inline '''c++ -// CHECK:STDERR: fail_unterminated_import_inline.carbon:[[@LINE+2]]:1: error: extraneous closing brace ('}') [CppInteropParseError] +// CHECK:STDERR: ╭─┤ fail_unterminated_import_inline.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ } +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: extraneous closing brace ('}') [CppInteropParseError] +// CHECK:STDERR: ╰──── // CHECK:STDERR: } '''; @@ -31,9 +43,21 @@ import Cpp inline '''c++ library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_import_cpp_library_without_name_and_inline_without_content.carbon:[[@LINE+4]]:19: error: expected a string literal to specify the library name [ExpectedLibraryName] +// CHECK:STDERR: ╭─┤ fail_import_cpp_library_without_name_and_inline_without_content.carbon:[[@LINE+16]]:19 +// CHECK:STDERR: -> │ import Cpp library inline; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected a string literal to specify the library +// CHECK:STDERR: · ┃ name +// CHECK:STDERR: · ┃ [ExpectedLibraryName] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_import_cpp_library_without_name_and_inline_without_content.carbon:[[@LINE+2]]:20-25: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_import_cpp_library_without_name_and_inline_without_content.carbon:[[@LINE+8]]:20 +// CHECK:STDERR: -> │ import Cpp library inline; +// CHECK:STDERR: · ┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: +// CHECK:STDERR: · ┃ `handle invalid parse trees in `check`` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import Cpp library inline; @@ -41,9 +65,19 @@ import Cpp library inline; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_import_cpp_library_with_name_and_inline_without_content.carbon:[[@LINE+4]]:27: error: `import` declarations must end with a `;` [ExpectedDeclSemi] +// CHECK:STDERR: ╭─┤ fail_import_cpp_library_with_name_and_inline_without_content.carbon:[[@LINE+14]]:27 +// CHECK:STDERR: -> │ import Cpp library "foo.h" inline; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `import` declarations must end with a `;` +// CHECK:STDERR: · ┃ [ExpectedDeclSemi] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_import_cpp_library_with_name_and_inline_without_content.carbon:[[@LINE+2]]:1-34: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_import_cpp_library_with_name_and_inline_without_content.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ import Cpp library "foo.h" inline; +// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `handle invalid parse trees in `check`` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import Cpp library "foo.h" inline; @@ -51,9 +85,21 @@ import Cpp library "foo.h" inline; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_import_cpp_library_without_name_and_inline_with_content.carbon:[[@LINE+4]]:19: error: expected a string literal to specify the library name [ExpectedLibraryName] +// CHECK:STDERR: ╭─┤ fail_import_cpp_library_without_name_and_inline_with_content.carbon:[[@LINE+16]]:19 +// CHECK:STDERR: -> │ import Cpp library inline ""; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected a string literal to specify the library +// CHECK:STDERR: · ┃ name +// CHECK:STDERR: · ┃ [ExpectedLibraryName] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_import_cpp_library_without_name_and_inline_with_content.carbon:[[@LINE+2]]:20-25: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_import_cpp_library_without_name_and_inline_with_content.carbon:[[@LINE+8]]:20 +// CHECK:STDERR: -> │ import Cpp library inline ""; +// CHECK:STDERR: · ┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: +// CHECK:STDERR: · ┃ `handle invalid parse trees in `check`` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import Cpp library inline ""; @@ -61,8 +107,18 @@ import Cpp library inline ""; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_import_cpp_library_with_name_and_inline_with_content.carbon:[[@LINE+4]]:27: error: `import` declarations must end with a `;` [ExpectedDeclSemi] +// CHECK:STDERR: ╭─┤ fail_import_cpp_library_with_name_and_inline_with_content.carbon:[[@LINE+14]]:27 +// CHECK:STDERR: -> │ import Cpp library "foo.h" inline ""; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `import` declarations must end with a `;` +// CHECK:STDERR: · ┃ [ExpectedDeclSemi] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_import_cpp_library_with_name_and_inline_with_content.carbon:[[@LINE+2]]:1-37: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_import_cpp_library_with_name_and_inline_with_content.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ import Cpp library "foo.h" inline ""; +// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `handle invalid parse trees in `check`` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import Cpp library "foo.h" inline ""; diff --git a/toolchain/check/testdata/interop/cpp/basics/import/bad_import_empty.carbon b/toolchain/check/testdata/interop/cpp/basics/import/bad_import_empty.carbon index 19103653d1fc..fda5b7c2aab5 100644 --- a/toolchain/check/testdata/interop/cpp/basics/import/bad_import_empty.carbon +++ b/toolchain/check/testdata/interop/cpp/basics/import/bad_import_empty.carbon @@ -18,6 +18,10 @@ library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_import_cpp_library_empty.carbon:[[@LINE+2]]:10: error: empty filename [CppInteropParseError] +// CHECK:STDERR: ╭─┤ fail_import_cpp_library_empty.carbon:[[@LINE+6]]:10 +// CHECK:STDERR: -> │ #include "" +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: empty filename [CppInteropParseError] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import Cpp library ""; diff --git a/toolchain/check/testdata/interop/cpp/basics/import/bad_import_nested_quotes.carbon b/toolchain/check/testdata/interop/cpp/basics/import/bad_import_nested_quotes.carbon index ce84b3ae0d34..449437a55f45 100644 --- a/toolchain/check/testdata/interop/cpp/basics/import/bad_import_nested_quotes.carbon +++ b/toolchain/check/testdata/interop/cpp/basics/import/bad_import_nested_quotes.carbon @@ -20,12 +20,27 @@ library "[[@TEST_NAME]]"; // TODO: Translate the file to a `#include` that includes the named file // properly. `\` escapes aren't processed in regular `#include`s. -// CHECK:STDERR: fail_todo_import_cpp_library_file_with_quotes.carbon:[[@LINE+8]]:10-12: error: '\' file not found [CppInteropParseError] +// CHECK:STDERR: ╭─┤ fail_todo_import_cpp_library_file_with_quotes.carbon:[[@LINE+23]]:10 +// CHECK:STDERR: -> │ #include "\"foo.h\"" +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┗━━┫ error: '\' file not found [CppInteropParseError] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_todo_import_cpp_library_file_with_quotes.carbon:[[@LINE+6]]:13: error: invalid suffix on literal; C++11 requires a space between literal and identifier [CppInteropParseError] -// CHECK:STDERR: fail_todo_import_cpp_library_file_with_quotes.carbon:[[@LINE+5]]:13: note: insert ` ` here [CppInteropFixItInsertion] +// CHECK:STDERR: ╭─┤ fail_todo_import_cpp_library_file_with_quotes.carbon:[[@LINE+17]]:13 +// CHECK:STDERR: -> │ #include "\"foo.h\"" +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: invalid suffix on literal; C++11 requires a space +// CHECK:STDERR: · │ ┃ between literal and identifier +// CHECK:STDERR: · │ ┃ [CppInteropParseError] +// CHECK:STDERR: · ╰────┤ insert ` ` here [CppInteropFixItInsertion] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_todo_import_cpp_library_file_with_quotes.carbon:[[@LINE+3]]:13: warning: extra tokens at end of #include directive [CppInteropParseWarning] -// CHECK:STDERR: fail_todo_import_cpp_library_file_with_quotes.carbon:[[@LINE+2]]:13: note: insert `//` here [CppInteropFixItInsertion] +// CHECK:STDERR: ╭─┤ fail_todo_import_cpp_library_file_with_quotes.carbon:[[@LINE+8]]:13 +// CHECK:STDERR: -> │ #include "\"foo.h\"" +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ warning: extra tokens at end of #include directive +// CHECK:STDERR: · │ ┃ [CppInteropParseWarning] +// CHECK:STDERR: · ╰────┤ insert `//` here [CppInteropFixItInsertion] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import Cpp library "\"foo.h\""; diff --git a/toolchain/check/testdata/interop/cpp/basics/import/bad_import_not_found.carbon b/toolchain/check/testdata/interop/cpp/basics/import/bad_import_not_found.carbon index c5832dffa655..450b8486fb37 100644 --- a/toolchain/check/testdata/interop/cpp/basics/import/bad_import_not_found.carbon +++ b/toolchain/check/testdata/interop/cpp/basics/import/bad_import_not_found.carbon @@ -18,6 +18,10 @@ library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_cpp_file_not_found.carbon:[[@LINE+2]]:10-22: error: 'not_found.h' file not found [CppInteropParseError] +// CHECK:STDERR: ╭─┤ fail_cpp_file_not_found.carbon:[[@LINE+6]]:10 +// CHECK:STDERR: -> │ #include "not_found.h" +// CHECK:STDERR: · ━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: 'not_found.h' file not found [CppInteropParseError] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import Cpp library "not_found.h"; diff --git a/toolchain/check/testdata/interop/cpp/basics/import/cpp_namespace.carbon b/toolchain/check/testdata/interop/cpp/basics/import/cpp_namespace.carbon index ae4da0fd0e46..f5f29f534b2c 100644 --- a/toolchain/check/testdata/interop/cpp/basics/import/cpp_namespace.carbon +++ b/toolchain/check/testdata/interop/cpp/basics/import/cpp_namespace.carbon @@ -20,7 +20,13 @@ library "[[@TEST_NAME]]"; import Cpp library "header.h"; -// CHECK:STDERR: fail_duplicate_cpp_name.carbon:[[@LINE+2]]:11-13: error: `namespace` introducer should be followed by a name; prefix reserved word with `r#` to form a valid identifier [ExpectedDeclName] +// CHECK:STDERR: ╭─┤ fail_duplicate_cpp_name.carbon:[[@LINE+8]]:11 +// CHECK:STDERR: -> │ namespace Cpp; +// CHECK:STDERR: · ┳━━ +// CHECK:STDERR: · ┗━━┫ error: `namespace` introducer should be followed by a name; +// CHECK:STDERR: · ┃ prefix reserved word with `r#` to form a valid identifier +// CHECK:STDERR: · ┃ [ExpectedDeclName] +// CHECK:STDERR: ╰──── // CHECK:STDERR: namespace Cpp; @@ -31,7 +37,13 @@ library "[[@TEST_NAME]]"; import Cpp library "header.h"; namespace N; -// CHECK:STDERR: fail_cpp_in_inner_namespace.carbon:[[@LINE+2]]:13-15: error: `.` should be followed by a name; prefix reserved word with `r#` to form a valid identifier [ExpectedDeclNameAfterPeriod] +// CHECK:STDERR: ╭─┤ fail_cpp_in_inner_namespace.carbon:[[@LINE+8]]:13 +// CHECK:STDERR: -> │ namespace N.Cpp; +// CHECK:STDERR: · ┳━━ +// CHECK:STDERR: · ┗━━┫ error: `.` should be followed by a name; prefix reserved word +// CHECK:STDERR: · ┃ with `r#` to form a valid identifier +// CHECK:STDERR: · ┃ [ExpectedDeclNameAfterPeriod] +// CHECK:STDERR: ╰──── // CHECK:STDERR: namespace N.Cpp; @@ -51,9 +63,19 @@ library "[[@TEST_NAME]]"; import Cpp library "header.h"; -// CHECK:STDERR: fail_add_name_to_cpp_namespace.carbon:[[@LINE+4]]:7-9: error: `class` introducer should be followed by a name; prefix reserved word with `r#` to form a valid identifier [ExpectedDeclName] +// CHECK:STDERR: ╭─┤ fail_add_name_to_cpp_namespace.carbon:[[@LINE+14]]:7 +// CHECK:STDERR: -> │ class Cpp.C {}; +// CHECK:STDERR: · ┳━━ +// CHECK:STDERR: · ┗━━┫ error: `class` introducer should be followed by a name; prefix +// CHECK:STDERR: · ┃ reserved word with `r#` to form a valid identifier +// CHECK:STDERR: · ┃ [ExpectedDeclName] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_add_name_to_cpp_namespace.carbon:[[@LINE+2]]:7-9: error: name `r#Cpp` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_add_name_to_cpp_namespace.carbon:[[@LINE+6]]:7 +// CHECK:STDERR: -> │ class Cpp.C {}; +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┗━━┫ error: name `r#Cpp` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: class Cpp.C {}; diff --git a/toolchain/check/testdata/interop/cpp/basics/import/fail_fuzzing.carbon b/toolchain/check/testdata/interop/cpp/basics/import/fail_fuzzing.carbon index 9aa75882e13c..23f09a528ba7 100644 --- a/toolchain/check/testdata/interop/cpp/basics/import/fail_fuzzing.carbon +++ b/toolchain/check/testdata/interop/cpp/basics/import/fail_fuzzing.carbon @@ -11,6 +11,10 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/basics/import/fail_fuzzing.carbon -// CHECK:STDERR: fail_fuzzing.carbon:[[@LINE+2]]:1-28: error: `Cpp` import found during fuzzing [CppInteropFuzzing] +// CHECK:STDERR: ╭─┤ fail_fuzzing.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ import Cpp library "file.h"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━┳━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `Cpp` import found during fuzzing [CppInteropFuzzing] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import Cpp library "file.h"; diff --git a/toolchain/check/testdata/interop/cpp/basics/import/import.carbon b/toolchain/check/testdata/interop/cpp/basics/import/import.carbon index 998058f2d968..51f668c20d1b 100644 --- a/toolchain/check/testdata/interop/cpp/basics/import/import.carbon +++ b/toolchain/check/testdata/interop/cpp/basics/import/import.carbon @@ -16,6 +16,17 @@ // --- struct.h +// CHECK:STDERR: ╷ ╭── imported from: fail_todo_import_struct_api.carbon [InImport] +// CHECK:STDERR: │ ├── included from: struct_api.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./struct.h:[[@LINE+9]]:8 +// CHECK:STDERR: -> │ struct MyStruct { void Foo(); }; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┏━━━━━━┛ +// CHECK:STDERR: · ┃ error: semantics TODO: +// CHECK:STDERR: · ┃ `indirect import of C++ declaration with no direct Cpp import` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: struct MyStruct { void Foo(); }; // --- struct_api.carbon @@ -30,10 +41,6 @@ alias MyStructAlias = Cpp.MyStruct; library "[[@TEST_NAME]]"; -// CHECK:STDERR: imported from: fail_todo_import_struct_api.carbon:[[@LINE+4]]:1 [InImport] -// CHECK:STDERR: included from: struct_api.carbon:4:10 [InCppInclude] -// CHECK:STDERR: ./struct.h:2:8: error: semantics TODO: `indirect import of C++ declaration with no direct Cpp import` [SemanticsTodo] -// CHECK:STDERR: import library "struct_api"; fn F() { diff --git a/toolchain/check/testdata/interop/cpp/basics/import/indirect.carbon b/toolchain/check/testdata/interop/cpp/basics/import/indirect.carbon index e80e9d591cf5..cb10c5894729 100644 --- a/toolchain/check/testdata/interop/cpp/basics/import/indirect.carbon +++ b/toolchain/check/testdata/interop/cpp/basics/import/indirect.carbon @@ -89,9 +89,19 @@ namespace A { fn TryToUseNotLeaked() { // TODO: Clang's diagnostic for using a class whose definition is not // reachable is confusing. - // CHECK:STDERR: fail_not_leaked.carbon:[[@LINE+4]]:17-23: error: binding pattern has incomplete type `X` in name binding declaration [IncompleteTypeInBindingDecl] - // CHECK:STDERR: included from: direct_import.carbon:4:10 [InCppInclude] - // CHECK:STDERR: ./shared.h:3:10: note: class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ╭─┤ fail_not_leaked.carbon:[[@LINE+14]]:17 + // CHECK:STDERR: -> │ var unused x: Cpp.A.X = 0; + // CHECK:STDERR: · ┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: binding pattern has incomplete type `X` in name + // CHECK:STDERR: · ┃ binding declaration + // CHECK:STDERR: · ┃ [IncompleteTypeInBindingDecl] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ ╭── included from: direct_import.carbon [InCppInclude] + // CHECK:STDERR: ├─┤ ./shared.h + // CHECK:STDERR: │ struct X { + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused x: Cpp.A.X = 0; } diff --git a/toolchain/check/testdata/interop/cpp/basics/inline/decl.carbon b/toolchain/check/testdata/interop/cpp/basics/inline/decl.carbon index e3189aced96e..050218f2c80a 100644 --- a/toolchain/check/testdata/interop/cpp/basics/inline/decl.carbon +++ b/toolchain/check/testdata/interop/cpp/basics/inline/decl.carbon @@ -45,8 +45,15 @@ void f() {} '''; inline Cpp ''' -// CHECK:STDERR: fail_redefinition.carbon:[[@LINE+3]]:6: error: redefinition of 'f' [CppInteropParseError] -// CHECK:STDERR: fail_redefinition.carbon:[[@LINE-5]]:6: note: previous definition is here [CppInteropParseNote] +// CHECK:STDERR: ╭─┤ fail_redefinition.carbon:[[@LINE+10]]:6 +// CHECK:STDERR: │ void f() {} +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ previous definition is here [CppInteropParseNote] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ void f() {} +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: redefinition of 'f' [CppInteropParseError] +// CHECK:STDERR: ╰──── // CHECK:STDERR: void f() {} '''; @@ -57,13 +64,23 @@ library "[[@TEST_NAME]]"; import Cpp; -// CHECK:STDERR: fail_diag_location.carbon:[[@LINE+2]]:12-21: error: use of undeclared identifier 'undeclared' [CppInteropParseError] +// CHECK:STDERR: ╭─┤ fail_diag_location.carbon:[[@LINE+7]]:12 +// CHECK:STDERR: -> │ void f() { undeclared = 0; } +// CHECK:STDERR: · ━━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: use of undeclared identifier 'undeclared' +// CHECK:STDERR: · ┃ [CppInteropParseError] +// CHECK:STDERR: ╰──── // CHECK:STDERR: inline Cpp "void f() { undeclared = 0; }"; inline Cpp ''' void g() { - // CHECK:STDERR: fail_diag_location.carbon:[[@LINE+2]]:3-12: error: use of undeclared identifier 'undeclared' [CppInteropParseError] + // CHECK:STDERR: ╭─┤ fail_diag_location.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ undeclared = 0; + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: use of undeclared identifier 'undeclared' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: undeclared = 0; } @@ -73,7 +90,11 @@ void g() { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_inline_no_import.carbon:[[@LINE+2]]:8-10: error: name `Cpp` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_inline_no_import.carbon:[[@LINE+6]]:8 +// CHECK:STDERR: -> │ inline Cpp ""; +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┗━━┫ error: name `Cpp` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: inline Cpp ""; @@ -84,25 +105,45 @@ library "[[@TEST_NAME]]"; import Cpp; class C { - // CHECK:STDERR: fail_nested.carbon:[[@LINE+2]]:3-16: error: `inline Cpp` declaration not at file scope [InlineDeclNotAtFileScope] + // CHECK:STDERR: ╭─┤ fail_nested.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ inline Cpp ""; + // CHECK:STDERR: · ━━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: `inline Cpp` declaration not at file scope + // CHECK:STDERR: · ┃ [InlineDeclNotAtFileScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: inline Cpp ""; } interface I { - // CHECK:STDERR: fail_nested.carbon:[[@LINE+2]]:3-16: error: `inline Cpp` declaration not at file scope [InlineDeclNotAtFileScope] + // CHECK:STDERR: ╭─┤ fail_nested.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ inline Cpp ""; + // CHECK:STDERR: · ━━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: `inline Cpp` declaration not at file scope + // CHECK:STDERR: · ┃ [InlineDeclNotAtFileScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: inline Cpp ""; } constraint N { - // CHECK:STDERR: fail_nested.carbon:[[@LINE+2]]:3-16: error: `inline Cpp` declaration not at file scope [InlineDeclNotAtFileScope] + // CHECK:STDERR: ╭─┤ fail_nested.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ inline Cpp ""; + // CHECK:STDERR: · ━━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: `inline Cpp` declaration not at file scope + // CHECK:STDERR: · ┃ [InlineDeclNotAtFileScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: inline Cpp ""; } impl C as I { - // CHECK:STDERR: fail_nested.carbon:[[@LINE+2]]:3-16: error: `inline Cpp` declaration not at file scope [InlineDeclNotAtFileScope] + // CHECK:STDERR: ╭─┤ fail_nested.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ inline Cpp ""; + // CHECK:STDERR: · ━━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: `inline Cpp` declaration not at file scope + // CHECK:STDERR: · ┃ [InlineDeclNotAtFileScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: inline Cpp ""; } @@ -111,9 +152,18 @@ impl C as I { fn F() { // TODO: Should this be a check error rather than a parse error? - // CHECK:STDERR: fail_nested_fn.carbon:[[@LINE+4]]:3-8: error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╭─┤ fail_nested_fn.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: -> │ inline Cpp ""; + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_nested_fn.carbon:[[@LINE+2]]:3-8: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_nested_fn.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ inline Cpp ""; + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `handle invalid parse trees in `check`` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: inline Cpp ""; } diff --git a/toolchain/check/testdata/interop/cpp/basics/inline/modules.carbon b/toolchain/check/testdata/interop/cpp/basics/inline/modules.carbon index 9dcfa4854464..87e931be0a52 100644 --- a/toolchain/check/testdata/interop/cpp/basics/inline/modules.carbon +++ b/toolchain/check/testdata/interop/cpp/basics/inline/modules.carbon @@ -17,11 +17,28 @@ library "[[@TEST_NAME]]"; // TODO: This diagnostic isn't very good. import Cpp inline ''' -// CHECK:STDERR: fail_export_module_in_inline_cpp.carbon:[[@LINE+6]]:8-18: error: module declaration must not come from an #include directive [CppInteropParseError] +// CHECK:STDERR: ╭─┤ fail_export_module_in_inline_cpp.carbon:[[@LINE+23]]:8 +// CHECK:STDERR: -> │ export module Foo; +// CHECK:STDERR: · ━━┳━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: module declaration must not come from an #include directive +// CHECK:STDERR: · ┃ [CppInteropParseError] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_export_module_in_inline_cpp.carbon:[[@LINE+4]]:8: error: module declaration must occur at the start of the translation unit [CppInteropParseError] -// CHECK:STDERR: :1:1: note: add 'module;' to the start of the file to introduce a global module fragment [CppInteropParseNote] -// CHECK:STDERR: :1:1: note: insert `module; ` here [CppInteropFixItInsertion] +// CHECK:STDERR: ╭─┤ fail_export_module_in_inline_cpp.carbon:[[@LINE+16]]:8 +// CHECK:STDERR: -> │ export module Foo; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: module declaration must occur at the start of the translation +// CHECK:STDERR: · ┃ unit +// CHECK:STDERR: · ┃ [CppInteropParseError] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ +// CHECK:STDERR: │ ; +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ add 'module;' to the start of the file to introduce a global module +// CHECK:STDERR: · │ │ fragment +// CHECK:STDERR: · │ │ [CppInteropParseNote] +// CHECK:STDERR: · ╰────┤ insert `module; ` here [CppInteropFixItInsertion] +// CHECK:STDERR: ╰──── // CHECK:STDERR: export module Foo; '''; @@ -32,13 +49,35 @@ library "[[@TEST_NAME]]"; // TODO: This diagnostic isn't very good. import Cpp inline ''' -// CHECK:STDERR: fail_module_in_inline_cpp.carbon:[[@LINE+8]]:1-11: error: module declaration must not come from an #include directive [CppInteropParseError] +// CHECK:STDERR: ╭─┤ fail_module_in_inline_cpp.carbon:[[@LINE+30]]:1 +// CHECK:STDERR: -> │ module Bar; +// CHECK:STDERR: · ━━━━━┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: module declaration must not come from an #include directive +// CHECK:STDERR: · ┃ [CppInteropParseError] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_module_in_inline_cpp.carbon:[[@LINE+6]]:1: error: module declaration must occur at the start of the translation unit [CppInteropParseError] -// CHECK:STDERR: :1:1: note: add 'module;' to the start of the file to introduce a global module fragment [CppInteropParseNote] -// CHECK:STDERR: :1:1: note: insert `module; ` here [CppInteropFixItInsertion] +// CHECK:STDERR: ╭─┤ fail_module_in_inline_cpp.carbon:[[@LINE+23]]:1 +// CHECK:STDERR: -> │ module Bar; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: module declaration must occur at the start of the translation unit +// CHECK:STDERR: · ┃ [CppInteropParseError] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ +// CHECK:STDERR: │ ; +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ add 'module;' to the start of the file to introduce a global module +// CHECK:STDERR: · │ │ fragment +// CHECK:STDERR: · │ │ [CppInteropParseNote] +// CHECK:STDERR: · ╰────┤ insert `module; ` here [CppInteropFixItInsertion] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_module_in_inline_cpp.carbon:[[@LINE+2]]:8-10: error: module name 'Foo' specified on command line does not match name of module [CppInteropParseError] +// CHECK:STDERR: ╭─┤ fail_module_in_inline_cpp.carbon:[[@LINE+8]]:8 +// CHECK:STDERR: -> │ module Bar; +// CHECK:STDERR: · ┳━━ +// CHECK:STDERR: · ┗━━┫ error: module name 'Foo' specified on command line does not match +// CHECK:STDERR: · ┃ name of module +// CHECK:STDERR: · ┃ [CppInteropParseError] +// CHECK:STDERR: ╰──── // CHECK:STDERR: module Bar; '''; @@ -49,21 +88,54 @@ library "[[@TEST_NAME]]"; // TODO: This diagnostic isn't very good. import Cpp inline ''' -// CHECK:STDERR: fail_global_module_in_inline_cpp.carbon:[[@LINE+4]]:1-7: error: module declaration must not come from an #include directive [CppInteropParseError] +// CHECK:STDERR: ╭─┤ fail_global_module_in_inline_cpp.carbon:[[@LINE+15]]:1 +// CHECK:STDERR: -> │ module; +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: module declaration must not come from an #include directive +// CHECK:STDERR: · ┃ [CppInteropParseError] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_global_module_in_inline_cpp.carbon:[[@LINE+2]]:1-7: error: 'module;' introducing a global module fragment can appear only at the start of the translation unit [CppInteropParseError] +// CHECK:STDERR: ╭─┤ fail_global_module_in_inline_cpp.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ module; +// CHECK:STDERR: · ┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: 'module;' introducing a global module fragment can appear only at +// CHECK:STDERR: · ┃ the start of the translation unit +// CHECK:STDERR: · ┃ [CppInteropParseError] +// CHECK:STDERR: ╰──── // CHECK:STDERR: module; int n; -// CHECK:STDERR: fail_global_module_in_inline_cpp.carbon:[[@LINE+8]]:1-11: error: module declaration must not come from an #include directive [CppInteropParseError] +// CHECK:STDERR: ╭─┤ fail_global_module_in_inline_cpp.carbon:[[@LINE+30]]:1 +// CHECK:STDERR: -> │ module Baz; +// CHECK:STDERR: · ━━━━━┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: module declaration must not come from an #include directive +// CHECK:STDERR: · ┃ [CppInteropParseError] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_global_module_in_inline_cpp.carbon:[[@LINE+6]]:1: error: module declaration must occur at the start of the translation unit [CppInteropParseError] -// CHECK:STDERR: :1:1: note: add 'module;' to the start of the file to introduce a global module fragment [CppInteropParseNote] -// CHECK:STDERR: :1:1: note: insert `module; ` here [CppInteropFixItInsertion] +// CHECK:STDERR: ╭─┤ fail_global_module_in_inline_cpp.carbon:[[@LINE+23]]:1 +// CHECK:STDERR: -> │ module Baz; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: module declaration must occur at the start of the translation unit +// CHECK:STDERR: · ┃ [CppInteropParseError] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ +// CHECK:STDERR: │ ; +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ add 'module;' to the start of the file to introduce a global module +// CHECK:STDERR: · │ │ fragment +// CHECK:STDERR: · │ │ [CppInteropParseNote] +// CHECK:STDERR: · ╰────┤ insert `module; ` here [CppInteropFixItInsertion] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_global_module_in_inline_cpp.carbon:[[@LINE+2]]:8-10: error: module name 'Foo' specified on command line does not match name of module [CppInteropParseError] +// CHECK:STDERR: ╭─┤ fail_global_module_in_inline_cpp.carbon:[[@LINE+8]]:8 +// CHECK:STDERR: -> │ module Baz; +// CHECK:STDERR: · ┳━━ +// CHECK:STDERR: · ┗━━┫ error: module name 'Foo' specified on command line does not match +// CHECK:STDERR: · ┃ name of module +// CHECK:STDERR: · ┃ [CppInteropParseError] +// CHECK:STDERR: ╰──── // CHECK:STDERR: module Baz; '''; @@ -74,7 +146,12 @@ library "[[@TEST_NAME]]"; // TODO: Also test that a valid module import works. import Cpp inline ''' -// CHECK:STDERR: fail_import_in_inline_cpp.carbon:[[@LINE+2]]:8-35: error: 'file_that_does_not_exist.h' file not found [CppInteropParseError] +// CHECK:STDERR: ╭─┤ fail_import_in_inline_cpp.carbon:[[@LINE+7]]:8 +// CHECK:STDERR: -> │ import "file_that_does_not_exist.h"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━┳━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: 'file_that_does_not_exist.h' file not found +// CHECK:STDERR: · ┃ [CppInteropParseError] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import "file_that_does_not_exist.h"; '''; diff --git a/toolchain/check/testdata/interop/cpp/basics/share_ast.carbon b/toolchain/check/testdata/interop/cpp/basics/share_ast.carbon index 5cad0f186fcd..1392b44fd7c9 100644 --- a/toolchain/check/testdata/interop/cpp/basics/share_ast.carbon +++ b/toolchain/check/testdata/interop/cpp/basics/share_ast.carbon @@ -38,7 +38,12 @@ import Cpp; fn CallLeakedA() -> i32 { // This should not be found as we have not imported "a.h". - // CHECK:STDERR: fail_a_does_not_leak.carbon:[[@LINE+2]]:10-17: error: member name `GetA` not found in `Cpp` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╭─┤ fail_a_does_not_leak.carbon:[[@LINE+7]]:10 + // CHECK:STDERR: -> │ return Cpp.GetA(); + // CHECK:STDERR: · ━━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: member name `GetA` not found in `Cpp` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return Cpp.GetA(); } @@ -143,13 +148,30 @@ import Cpp; namespace N; inline Cpp ''' -// CHECK:STDERR: fail_carbon_export_does_not_leak.carbon:[[@LINE+2]]:23: error: no type named 'ExportedClass' in namespace 'Carbon' [CppInteropParseError] +// CHECK:STDERR: ╭─┤ fail_carbon_export_does_not_leak.carbon:[[@LINE+8]]:23 +// CHECK:STDERR: -> │ using Leak1 = Carbon::ExportedClass; +// CHECK:STDERR: · ───────╴╻ +// CHECK:STDERR: · ┗━━┫ error: no type named 'ExportedClass' in namespace +// CHECK:STDERR: · ┃ 'Carbon' +// CHECK:STDERR: · ┃ [CppInteropParseError] +// CHECK:STDERR: ╰──── // CHECK:STDERR: using Leak1 = Carbon::ExportedClass; -// CHECK:STDERR: fail_carbon_export_does_not_leak.carbon:[[@LINE+2]]:26: error: no type named 'ExportedNested' in namespace 'Carbon::N' [CppInteropParseError] +// CHECK:STDERR: ╭─┤ fail_carbon_export_does_not_leak.carbon:[[@LINE+8]]:26 +// CHECK:STDERR: -> │ using Leak2 = Carbon::N::ExportedNested; +// CHECK:STDERR: · ──────────╴╻ +// CHECK:STDERR: · ┗━━┫ error: no type named 'ExportedNested' in namespace +// CHECK:STDERR: · ┃ 'Carbon::N' +// CHECK:STDERR: · ┃ [CppInteropParseError] +// CHECK:STDERR: ╰──── // CHECK:STDERR: using Leak2 = Carbon::N::ExportedNested; -// CHECK:STDERR: fail_carbon_export_does_not_leak.carbon:[[@LINE+2]]:23: error: no member named 'PkgA' in namespace 'Carbon' [CppInteropParseError] +// CHECK:STDERR: ╭─┤ fail_carbon_export_does_not_leak.carbon:[[@LINE+7]]:23 +// CHECK:STDERR: -> │ using Leak3 = Carbon::PkgA::SameName; +// CHECK:STDERR: · ───────╴╻ +// CHECK:STDERR: · ┗━━┫ error: no member named 'PkgA' in namespace 'Carbon' +// CHECK:STDERR: · ┃ [CppInteropParseError] +// CHECK:STDERR: ╰──── // CHECK:STDERR: using Leak3 = Carbon::PkgA::SameName; '''; diff --git a/toolchain/check/testdata/interop/cpp/basics/unsupported_decl_type.carbon b/toolchain/check/testdata/interop/cpp/basics/unsupported_decl_type.carbon index d30313295cc9..61a926a67bd0 100644 --- a/toolchain/check/testdata/interop/cpp/basics/unsupported_decl_type.carbon +++ b/toolchain/check/testdata/interop/cpp/basics/unsupported_decl_type.carbon @@ -13,20 +13,29 @@ // --- structured_binding.h struct X { int a, b; }; +// CHECK:STDERR: ╷ ╭── included from: fail_todo_use_structured_binding.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./structured_binding.h:[[@LINE+12]]:7 +// CHECK:STDERR: -> │ auto [a, b] = X{}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `Unsupported: Declaration type Binding` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ fail_todo_use_structured_binding.carbon +// CHECK:STDERR: │ return Cpp.a; +// CHECK:STDERR: · ──┬── +// CHECK:STDERR: · ╰──┤ in `Cpp` name lookup for `a` [InCppNameLookup] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: auto [a, b] = X{}; // --- fail_todo_use_structured_binding.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: included from: fail_todo_use_structured_binding.carbon:[[@LINE+2]]:10 [InCppInclude] -// CHECK:STDERR: ./structured_binding.h:3:7: error: semantics TODO: `Unsupported: Declaration type Binding` [SemanticsTodo] import Cpp library "structured_binding.h"; fn F() -> i32 { //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_use_structured_binding.carbon:[[@LINE+2]]:10-14: note: in `Cpp` name lookup for `a` [InCppNameLookup] - // CHECK:STDERR: return Cpp.a; //@dump-sem-ir-end } diff --git a/toolchain/check/testdata/interop/cpp/basics/unused_internal.carbon b/toolchain/check/testdata/interop/cpp/basics/unused_internal.carbon index fc3e2bde064f..ef875678275c 100644 --- a/toolchain/check/testdata/interop/cpp/basics/unused_internal.carbon +++ b/toolchain/check/testdata/interop/cpp/basics/unused_internal.carbon @@ -16,10 +16,18 @@ library "[[@TEST_NAME]]"; import Cpp inline '''c++ -// CHECK:STDERR: unused.carbon:[[@LINE+2]]:12: warning: unused variable 'n' [CppInteropParseWarning] +// CHECK:STDERR: ╭─┤ unused.carbon:[[@LINE+6]]:12 +// CHECK:STDERR: -> │ static int n = 0; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ warning: unused variable 'n' [CppInteropParseWarning] +// CHECK:STDERR: ╰──── // CHECK:STDERR: static int n = 0; -// CHECK:STDERR: unused.carbon:[[@LINE+2]]:13: warning: unused function 'f' [CppInteropParseWarning] +// CHECK:STDERR: ╭─┤ unused.carbon:[[@LINE+6]]:13 +// CHECK:STDERR: -> │ static void f() {} +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ warning: unused function 'f' [CppInteropParseWarning] +// CHECK:STDERR: ╰──── // CHECK:STDERR: static void f() {} '''; diff --git a/toolchain/check/testdata/interop/cpp/class/export/access.carbon b/toolchain/check/testdata/interop/cpp/class/export/access.carbon index 027faa587480..caa10c7024fb 100644 --- a/toolchain/check/testdata/interop/cpp/class/export/access.carbon +++ b/toolchain/check/testdata/interop/cpp/class/export/access.carbon @@ -24,10 +24,22 @@ class B { inline Cpp ''' void F() { auto b = Carbon::B::Make(); - // CHECK:STDERR: fail_access_exported_private_var.carbon:[[@LINE+5]]:5: error: 'a' is a private member of 'Carbon::Main::B' [CppInteropParseError] - // CHECK:STDERR: fail_access_exported_private_var.carbon:[[@LINE-7]]:16: note: implicitly declared private here [CppInteropParseNote] + // CHECK:STDERR: ╭─┤ fail_access_exported_private_var.carbon:[[@LINE+17]]:5 + // CHECK:STDERR: │ private var a: A = {}; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ implicitly declared private here [CppInteropParseNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ b.a; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: 'a' is a private member of 'Carbon::Main::B' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_access_exported_private_var.carbon:[[@LINE+2]]:5: warning: expression result unused [CppInteropParseWarning] + // CHECK:STDERR: ╭─┤ fail_access_exported_private_var.carbon:[[@LINE+6]]:5 + // CHECK:STDERR: -> │ b.a; + // CHECK:STDERR: · ─ ┳ + // CHECK:STDERR: · ┗━━┫ warning: expression result unused [CppInteropParseWarning] + // CHECK:STDERR: ╰──── // CHECK:STDERR: b.a; } @@ -47,8 +59,16 @@ class B { inline Cpp ''' void G() { auto b = Carbon::B::Make(); - // CHECK:STDERR: fail_access_exported_private_method.carbon:[[@LINE+3]]:5: error: 'F' is a private member of 'Carbon::Main::B' [CppInteropParseError] - // CHECK:STDERR: fail_access_exported_private_method.carbon:[[@LINE-7]]:18: note: implicitly declared private here [CppInteropParseNote] + // CHECK:STDERR: ╭─┤ fail_access_exported_private_method.carbon:[[@LINE+11]]:5 + // CHECK:STDERR: │ private fn F() {} + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ implicitly declared private here [CppInteropParseNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ b.F(); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: 'F' is a private member of 'Carbon::Main::B' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: b.F(); } @@ -71,10 +91,22 @@ fn MakeB() -> B(A) { inline Cpp ''' void F() { auto b = Carbon::MakeB(); - // CHECK:STDERR: fail_access_exported_private_var_in_generic.carbon:[[@LINE+5]]:5: error: 'a' is a private member of 'Carbon::Main::B' [CppInteropParseError] - // CHECK:STDERR: fail_access_exported_private_var_in_generic.carbon:[[@LINE-11]]:16: note: implicitly declared private here [CppInteropParseNote] + // CHECK:STDERR: ╭─┤ fail_access_exported_private_var_in_generic.carbon:[[@LINE+17]]:5 + // CHECK:STDERR: │ private var a: A = {}; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ implicitly declared private here [CppInteropParseNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ b.a; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: 'a' is a private member of 'Carbon::Main::B' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_access_exported_private_var_in_generic.carbon:[[@LINE+2]]:5: warning: expression result unused [CppInteropParseWarning] + // CHECK:STDERR: ╭─┤ fail_access_exported_private_var_in_generic.carbon:[[@LINE+6]]:5 + // CHECK:STDERR: -> │ b.a; + // CHECK:STDERR: · ─ ┳ + // CHECK:STDERR: · ┗━━┫ warning: expression result unused [CppInteropParseWarning] + // CHECK:STDERR: ╰──── // CHECK:STDERR: b.a; } @@ -88,7 +120,12 @@ class A {} class B(T: type) { // TODO: exporting of methods in generics is not yet supported. - // CHECK:STDERR: fail_todo_access_exported_private_method_in_generic.carbon:[[@LINE+2]]:3-18: error: semantics TODO: `non-class non-namespace name scope` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_access_exported_private_method_in_generic.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ private fn F() {} + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `non-class non-namespace name scope` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: private fn F() {} } @@ -101,7 +138,12 @@ inline Cpp ''' void F() { auto b = Carbon::MakeB(); // TODO: this error should be that `F` is a private member of `B`. - // CHECK:STDERR: fail_todo_access_exported_private_method_in_generic.carbon:[[@LINE+2]]:5: error: no member named 'F' in 'Carbon::Main::B' [CppInteropParseError] + // CHECK:STDERR: ╭─┤ fail_todo_access_exported_private_method_in_generic.carbon:[[@LINE+7]]:5 + // CHECK:STDERR: -> │ b.F(); + // CHECK:STDERR: · ─ ┳ + // CHECK:STDERR: · ┗━━┫ error: no member named 'F' in 'Carbon::Main::B' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: b.F(); } diff --git a/toolchain/check/testdata/interop/cpp/class/export/base.carbon b/toolchain/check/testdata/interop/cpp/class/export/base.carbon index 25c792a66096..bcc81d8b84d8 100644 --- a/toolchain/check/testdata/interop/cpp/class/export/base.carbon +++ b/toolchain/check/testdata/interop/cpp/class/export/base.carbon @@ -62,8 +62,16 @@ import Cpp; class FinalClass {} inline Cpp ''' -// CHECK:STDERR: fail_derive_from_final.carbon:[[@LINE+3]]:12: error: base 'FinalClass' is marked 'final' [CppInteropParseError] -// CHECK:STDERR: fail_derive_from_final.carbon:[[@LINE-4]]:18: note: 'FinalClass' declared here [CppInteropParseNote] +// CHECK:STDERR: ╭─┤ fail_derive_from_final.carbon:[[@LINE+11]]:12 +// CHECK:STDERR: │ class FinalClass {} +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ 'FinalClass' declared here [CppInteropParseNote] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ struct A : Carbon::FinalClass {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: base 'FinalClass' is marked 'final' +// CHECK:STDERR: · ┃ [CppInteropParseError] +// CHECK:STDERR: ╰──── // CHECK:STDERR: struct A : Carbon::FinalClass {}; '''; @@ -80,16 +88,40 @@ struct VirtualDestructor { }; '''; -// CHECK:STDERR: fail_abstract.carbon:[[@LINE+3]]:1-34: error: cannot convert type `AbstractWithVdtor` into type implementing `Core.Destroy` [ConversionFailureTypeToFacet] -// CHECK:STDERR: min_prelude/parts/destroy.carbon:32:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] +// CHECK:STDERR: ╭─┤ fail_abstract.carbon:[[@LINE+14]]:1 +// CHECK:STDERR: -> │ abstract class AbstractWithVdtor { +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot convert type `AbstractWithVdtor` into type implementing +// CHECK:STDERR: · ┃ `Core.Destroy` +// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ min_prelude/parts/destroy.carbon +// CHECK:STDERR: │ fn SelfDestruct[T: Destroy](ref t: T) { +// CHECK:STDERR: · ───────────────────┬─────────────────── +// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here +// CHECK:STDERR: · │ [DeductionGenericHere] +// CHECK:STDERR: ╰──── // CHECK:STDERR: abstract class AbstractWithVdtor { extend base: Cpp.VirtualDestructor; } inline Cpp ''' -// CHECK:STDERR: fail_abstract.carbon:[[@LINE+3]]:27: error: variable type 'Carbon::AbstractWithVdtor' (aka 'Carbon::Main::AbstractWithVdtor') is an abstract class [CppInteropParseError] -// CHECK:STDERR: fail_abstract.carbon:[[@LINE-6]]:34: note: unimplemented pure virtual method '~AbstractWithVdtor' in 'AbstractWithVdtor' [CppInteropParseNote] +// CHECK:STDERR: ╭─┤ fail_abstract.carbon:[[@LINE+16]]:27 +// CHECK:STDERR: │ abstract class AbstractWithVdtor { +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ unimplemented pure virtual method +// CHECK:STDERR: · │ '~AbstractWithVdtor' in +// CHECK:STDERR: · │ 'AbstractWithVdtor' +// CHECK:STDERR: · │ [CppInteropParseNote] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ Carbon::AbstractWithVdtor x; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: variable type 'Carbon::AbstractWithVdtor' +// CHECK:STDERR: · ┃ (aka 'Carbon::Main::AbstractWithVdtor') is +// CHECK:STDERR: · ┃ an abstract class +// CHECK:STDERR: · ┃ [CppInteropParseError] +// CHECK:STDERR: ╰──── // CHECK:STDERR: Carbon::AbstractWithVdtor x; '''; @@ -101,10 +133,28 @@ import Cpp; // TODO: Find a way to export this to C++ as an abstract class, despite not // having a vptr. -// CHECK:STDERR: fail_todo_abstract_nonvirtual_dtor.carbon:[[@LINE+5]]:1-39: error: semantics TODO: `exporting abstract class with no abstract methods and non-virtual destructor to C++` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_todo_abstract_nonvirtual_dtor.carbon:[[@LINE+23]]:1 +// CHECK:STDERR: -> │ abstract class AbstractNonvirtualDtor {} +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: semantics TODO: +// CHECK:STDERR: · ┃ `exporting abstract class with no abstract methods and non-virtual destructor to C++` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_todo_abstract_nonvirtual_dtor.carbon:[[@LINE+3]]:1-39: error: cannot convert type `AbstractNonvirtualDtor` into type implementing `Core.Destroy` [ConversionFailureTypeToFacet] -// CHECK:STDERR: min_prelude/parts/destroy.carbon:32:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] +// CHECK:STDERR: ╭─┤ fail_todo_abstract_nonvirtual_dtor.carbon:[[@LINE+14]]:1 +// CHECK:STDERR: -> │ abstract class AbstractNonvirtualDtor {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot convert type `AbstractNonvirtualDtor` into type implementing +// CHECK:STDERR: · ┃ `Core.Destroy` +// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ min_prelude/parts/destroy.carbon +// CHECK:STDERR: │ fn SelfDestruct[T: Destroy](ref t: T) { +// CHECK:STDERR: · ───────────────────┬─────────────────── +// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here +// CHECK:STDERR: · │ [DeductionGenericHere] +// CHECK:STDERR: ╰──── // CHECK:STDERR: abstract class AbstractNonvirtualDtor {} @@ -120,8 +170,19 @@ import Cpp; // TODO: We should support generating a base subobject destructor for an // abstract class, even though we refuse to generate a complete object // destructor. -// CHECK:STDERR: fail_todo_abstract_nonvirtual_dtor_but_virtual_fns.carbon:[[@LINE+3]]:1-41: error: cannot convert type `AbstractWithMethodNoVptr` into type implementing `Core.Destroy` [ConversionFailureTypeToFacet] -// CHECK:STDERR: min_prelude/parts/destroy.carbon:32:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] +// CHECK:STDERR: ╭─┤ fail_todo_abstract_nonvirtual_dtor_but_virtual_fns.carbon:[[@LINE+14]]:1 +// CHECK:STDERR: -> │ abstract class AbstractWithMethodNoVptr { +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot convert type `AbstractWithMethodNoVptr` into type +// CHECK:STDERR: · ┃ implementing `Core.Destroy` +// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ min_prelude/parts/destroy.carbon +// CHECK:STDERR: │ fn SelfDestruct[T: Destroy](ref t: T) { +// CHECK:STDERR: · ───────────────────┬─────────────────── +// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here +// CHECK:STDERR: · │ [DeductionGenericHere] +// CHECK:STDERR: ╰──── // CHECK:STDERR: abstract class AbstractWithMethodNoVptr { abstract fn F(self); @@ -140,16 +201,40 @@ import Cpp; // TODO: We should support generating a base subobject destructor for an // abstract class, even though we refuse to generate a complete object // destructor. -// CHECK:STDERR: fail_variable_with_abstract_method.carbon:[[@LINE+3]]:1-35: error: cannot convert type `AbstractWithMethod` into type implementing `Core.Destroy` [ConversionFailureTypeToFacet] -// CHECK:STDERR: min_prelude/parts/destroy.carbon:32:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] +// CHECK:STDERR: ╭─┤ fail_variable_with_abstract_method.carbon:[[@LINE+14]]:1 +// CHECK:STDERR: -> │ abstract class AbstractWithMethod { +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot convert type `AbstractWithMethod` into type implementing +// CHECK:STDERR: · ┃ `Core.Destroy` +// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ min_prelude/parts/destroy.carbon +// CHECK:STDERR: │ fn SelfDestruct[T: Destroy](ref t: T) { +// CHECK:STDERR: · ───────────────────┬─────────────────── +// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here +// CHECK:STDERR: · │ [DeductionGenericHere] +// CHECK:STDERR: ╰──── // CHECK:STDERR: abstract class AbstractWithMethod { abstract fn F(self); } inline Cpp ''' -// CHECK:STDERR: fail_variable_with_abstract_method.carbon:[[@LINE+3]]:28: error: variable type 'Carbon::AbstractWithMethod' (aka 'Carbon::Main::AbstractWithMethod') is an abstract class [CppInteropParseError] -// CHECK:STDERR: fail_variable_with_abstract_method.carbon:[[@LINE-5]]:22: note: unimplemented pure virtual method 'F' in 'AbstractWithMethod' [CppInteropParseNote] +// CHECK:STDERR: ╭─┤ fail_variable_with_abstract_method.carbon:[[@LINE+16]]:28 +// CHECK:STDERR: │ abstract fn F(self); +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ unimplemented pure virtual method 'F' in +// CHECK:STDERR: · │ 'AbstractWithMethod' +// CHECK:STDERR: · │ [CppInteropParseNote] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ Carbon::AbstractWithMethod x_abstract; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: variable type +// CHECK:STDERR: · ┃ 'Carbon::AbstractWithMethod' (aka +// CHECK:STDERR: · ┃ 'Carbon::Main::AbstractWithMethod') is an +// CHECK:STDERR: · ┃ abstract class +// CHECK:STDERR: · ┃ [CppInteropParseError] +// CHECK:STDERR: ╰──── // CHECK:STDERR: Carbon::AbstractWithMethod x_abstract; '''; @@ -162,8 +247,19 @@ import Cpp; // TODO: We should support generating a base subobject destructor for an // abstract class, even though we refuse to generate a complete object // destructor. -// CHECK:STDERR: fail_todo_abstract_method_overridden_in_cpp.carbon:[[@LINE+3]]:1-35: error: cannot convert type `AbstractToOverride` into type implementing `Core.Destroy` [ConversionFailureTypeToFacet] -// CHECK:STDERR: min_prelude/parts/destroy.carbon:32:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] +// CHECK:STDERR: ╭─┤ fail_todo_abstract_method_overridden_in_cpp.carbon:[[@LINE+14]]:1 +// CHECK:STDERR: -> │ abstract class AbstractToOverride { +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot convert type `AbstractToOverride` into type implementing +// CHECK:STDERR: · ┃ `Core.Destroy` +// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ min_prelude/parts/destroy.carbon +// CHECK:STDERR: │ fn SelfDestruct[T: Destroy](ref t: T) { +// CHECK:STDERR: · ───────────────────┬─────────────────── +// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here +// CHECK:STDERR: · │ [DeductionGenericHere] +// CHECK:STDERR: ╰──── // CHECK:STDERR: abstract class AbstractToOverride { abstract fn F(ref self); diff --git a/toolchain/check/testdata/interop/cpp/class/export/class.carbon b/toolchain/check/testdata/interop/cpp/class/export/class.carbon index 7ff6931d6cf1..675c7c66a0d6 100644 --- a/toolchain/check/testdata/interop/cpp/class/export/class.carbon +++ b/toolchain/check/testdata/interop/cpp/class/export/class.carbon @@ -59,13 +59,30 @@ library "[[@TEST_NAME]]"; import Cpp; -// CHECK:STDERR: fail_incomplete_concrete.carbon:[[@LINE+2]]:1-26: error: class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: ╭─┤ fail_incomplete_concrete.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ class IncompleteConcreteA; +// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: class was forward declared here +// CHECK:STDERR: · ┃ [ClassForwardDeclaredHere] +// CHECK:STDERR: ╰──── // CHECK:STDERR: class IncompleteConcreteA; inline Cpp ''' -// CHECK:STDERR: fail_incomplete_concrete.carbon:[[@LINE+3]]:29: error: variable has incomplete type 'Carbon::IncompleteConcreteA' (aka 'Carbon::Main::IncompleteConcreteA') [CppInteropParseError] -// CHECK:STDERR: fail_incomplete_concrete.carbon:[[@LINE-4]]:26: note: forward declaration of 'Carbon::Main::IncompleteConcreteA' [CppInteropParseNote] +// CHECK:STDERR: ╭─┤ fail_incomplete_concrete.carbon:[[@LINE+15]]:29 +// CHECK:STDERR: │ class IncompleteConcreteA; +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ forward declaration of +// CHECK:STDERR: · │ 'Carbon::Main::IncompleteConcreteA' +// CHECK:STDERR: · │ [CppInteropParseNote] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ Carbon::IncompleteConcreteA incomplete_concrete_a; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: variable has incomplete type +// CHECK:STDERR: · ┃ 'Carbon::IncompleteConcreteA' (aka +// CHECK:STDERR: · ┃ 'Carbon::Main::IncompleteConcreteA') +// CHECK:STDERR: · ┃ [CppInteropParseError] +// CHECK:STDERR: ╰──── // CHECK:STDERR: Carbon::IncompleteConcreteA incomplete_concrete_a; '''; @@ -75,7 +92,12 @@ library "[[@TEST_NAME]]"; import Cpp; -// CHECK:STDERR: fail_todo_monomorphization_failure.carbon:[[@LINE+2]]:1-17: error: semantics TODO: `binding maps to a non-type template parameter` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_todo_monomorphization_failure.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ class B(N: i32) { +// CHECK:STDERR: · ━━━━━┳━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `binding maps to a non-type template parameter` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: class B(N: i32) { var a: array(i8, N); @@ -86,9 +108,18 @@ class B(N: i32) { alias T = B(-1); inline Cpp ''' -// CHECK:STDERR: fail_todo_monomorphization_failure.carbon:[[@LINE+4]]:1: error: semantics TODO: `interop with unsupported type` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_todo_monomorphization_failure.carbon:[[@LINE+13]]:1 +// CHECK:STDERR: -> │ Carbon::T t; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `interop with unsupported type` [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_todo_monomorphization_failure.carbon:[[@LINE+2]]:9: error: no type named 'T' in namespace 'Carbon' [CppInteropParseError] +// CHECK:STDERR: ╭─┤ fail_todo_monomorphization_failure.carbon:[[@LINE+7]]:9 +// CHECK:STDERR: -> │ Carbon::T t; +// CHECK:STDERR: · ───────╴╻ +// CHECK:STDERR: · ┗━━┫ error: no type named 'T' in namespace 'Carbon' +// CHECK:STDERR: · ┃ [CppInteropParseError] +// CHECK:STDERR: ╰──── // CHECK:STDERR: Carbon::T t; '''; diff --git a/toolchain/check/testdata/interop/cpp/class/export/field.carbon b/toolchain/check/testdata/interop/cpp/class/export/field.carbon index ff3564bd285f..c2f1e9f58142 100644 --- a/toolchain/check/testdata/interop/cpp/class/export/field.carbon +++ b/toolchain/check/testdata/interop/cpp/class/export/field.carbon @@ -75,10 +75,20 @@ class EmptyClass {} inline Cpp ''' void AccessNonexistentField() { Carbon::EmptyClass a; - // CHECK:STDERR: fail_nonexistent_field.carbon:[[@LINE+2]]:5: error: no member named 'x' in 'Carbon::Main::EmptyClass' [CppInteropParseError] + // CHECK:STDERR: ╭─┤ fail_nonexistent_field.carbon:[[@LINE+7]]:5 + // CHECK:STDERR: -> │ a.x = 12; + // CHECK:STDERR: · ─ ┳ + // CHECK:STDERR: · ┗━━┫ error: no member named 'x' in 'Carbon::Main::EmptyClass' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: a.x = 12; - // CHECK:STDERR: fail_nonexistent_field.carbon:[[@LINE+2]]:5: error: no member named 'y' in 'Carbon::Main::EmptyClass' [CppInteropParseError] + // CHECK:STDERR: ╭─┤ fail_nonexistent_field.carbon:[[@LINE+7]]:5 + // CHECK:STDERR: -> │ a.y = 34; + // CHECK:STDERR: · ─ ┳ + // CHECK:STDERR: · ┗━━┫ error: no member named 'y' in 'Carbon::Main::EmptyClass' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: a.y = 34; } @@ -89,10 +99,20 @@ library "[[@TEST_NAME]]"; import Cpp; class UnsupportedFieldType { - // CHECK:STDERR: fail_unsupported_field_type.carbon:[[@LINE+2]]:7-11: error: semantics TODO: `failed to map Carbon type to C++` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_unsupported_field_type.carbon:[[@LINE+7]]:7 + // CHECK:STDERR: -> │ var x: (); + // CHECK:STDERR: · ━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `failed to map Carbon type to C++` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var x: (); - // CHECK:STDERR: fail_unsupported_field_type.carbon:[[@LINE+2]]:7-11: error: semantics TODO: `failed to map Carbon type to C++` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_unsupported_field_type.carbon:[[@LINE+7]]:7 + // CHECK:STDERR: -> │ var y: (); + // CHECK:STDERR: · ━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `failed to map Carbon type to C++` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var y: (); } @@ -100,10 +120,20 @@ class UnsupportedFieldType { inline Cpp ''' void AccessUnsupportedField() { Carbon::UnsupportedFieldType a; - // CHECK:STDERR: fail_unsupported_field_type.carbon:[[@LINE+2]]:5: error: no member named 'x' in 'Carbon::Main::UnsupportedFieldType' [CppInteropParseError] + // CHECK:STDERR: ╭─┤ fail_unsupported_field_type.carbon:[[@LINE+7]]:5 + // CHECK:STDERR: -> │ a.x; + // CHECK:STDERR: · ─ ┳ + // CHECK:STDERR: · ┗━━┫ error: no member named 'x' in 'Carbon::Main::UnsupportedFieldType' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: a.x; - // CHECK:STDERR: fail_unsupported_field_type.carbon:[[@LINE+2]]:5: error: no member named 'y' in 'Carbon::Main::UnsupportedFieldType' [CppInteropParseError] + // CHECK:STDERR: ╭─┤ fail_unsupported_field_type.carbon:[[@LINE+7]]:5 + // CHECK:STDERR: -> │ a.y; + // CHECK:STDERR: · ─ ┳ + // CHECK:STDERR: · ┗━━┫ error: no member named 'y' in 'Carbon::Main::UnsupportedFieldType' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: a.y; } @@ -120,7 +150,12 @@ class AdaptedClass { inline Cpp ''' void AccessAdaptedField() { Carbon::AdaptedClass a; - // CHECK:STDERR: fail_adapter.carbon:[[@LINE+2]]:5: error: no member named 'x' in 'Carbon::Main::AdaptedClass' [CppInteropParseError] + // CHECK:STDERR: ╭─┤ fail_adapter.carbon:[[@LINE+7]]:5 + // CHECK:STDERR: -> │ a.x = 12; + // CHECK:STDERR: · ─ ┳ + // CHECK:STDERR: · ┗━━┫ error: no member named 'x' in 'Carbon::Main::AdaptedClass' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: a.x = 12; } @@ -132,7 +167,11 @@ import Cpp; // This should not cause a crash. class InvalidBaseClass { - // CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:16-21: error: name `Whoops` not found [NameNotFound] + // CHECK:STDERR: ╭─┤ fail_invalid.carbon:[[@LINE+6]]:16 + // CHECK:STDERR: -> │ extend base: Whoops; + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: name `Whoops` not found [NameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend base: Whoops; } @@ -156,8 +195,17 @@ class ClassWithPrivateField { inline Cpp ''' int AccessPrivateField() { auto c = Carbon::ClassWithPrivateField::Make(); - // CHECK:STDERR: fail_private_field.carbon:[[@LINE+3]]:12: error: 'x' is a private member of 'Carbon::Main::ClassWithPrivateField' [CppInteropParseError] - // CHECK:STDERR: fail_private_field.carbon:[[@LINE-7]]:16: note: implicitly declared private here [CppInteropParseNote] + // CHECK:STDERR: ╭─┤ fail_private_field.carbon:[[@LINE+12]]:12 + // CHECK:STDERR: │ private var x: i32; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ implicitly declared private here [CppInteropParseNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ return c.x; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: 'x' is a private member of + // CHECK:STDERR: · ┃ 'Carbon::Main::ClassWithPrivateField' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return c.x; } diff --git a/toolchain/check/testdata/interop/cpp/class/export/generic.carbon b/toolchain/check/testdata/interop/cpp/class/export/generic.carbon index 971bca983450..313d3db568e1 100644 --- a/toolchain/check/testdata/interop/cpp/class/export/generic.carbon +++ b/toolchain/check/testdata/interop/cpp/class/export/generic.carbon @@ -45,7 +45,12 @@ void FSpecific() { library "[[@TEST_NAME]]"; import Cpp; -// CHECK:STDERR: fail_unsupported_specific_arg.carbon:[[@LINE+2]]:1-33: error: semantics TODO: `failed to map specific type arg to C++` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_unsupported_specific_arg.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ class UnsupportedClass(T: type) { +// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `failed to map specific type arg to C++` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: class UnsupportedClass(T: type) { var t: T; @@ -54,9 +59,19 @@ alias AliasEmptyTuple = UnsupportedClass(()); inline Cpp ''' void FUnsupported() { - // CHECK:STDERR: fail_unsupported_specific_arg.carbon:[[@LINE+4]]:11: error: semantics TODO: `interop with unsupported type` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_unsupported_specific_arg.carbon:[[@LINE+14]]:11 + // CHECK:STDERR: -> │ Carbon::AliasEmptyTuple a; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `interop with unsupported type` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_unsupported_specific_arg.carbon:[[@LINE+2]]:11: error: no type named 'AliasEmptyTuple' in namespace 'Carbon' [CppInteropParseError] + // CHECK:STDERR: ╭─┤ fail_unsupported_specific_arg.carbon:[[@LINE+7]]:11 + // CHECK:STDERR: -> │ Carbon::AliasEmptyTuple a; + // CHECK:STDERR: · ───────╴╻ + // CHECK:STDERR: · ┗━━┫ error: no type named 'AliasEmptyTuple' in namespace 'Carbon' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Carbon::AliasEmptyTuple a; a.t = 123; @@ -68,7 +83,12 @@ library "[[@TEST_NAME]]"; import Cpp; class ClassWithMethod(T: type) { - // CHECK:STDERR: fail_todo_generic_class_method_call.carbon:[[@LINE+2]]:3-25: error: semantics TODO: `non-class non-namespace name scope` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_generic_class_method_call.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ fn M(unused ref self) {} + // CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `non-class non-namespace name scope` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn M(unused ref self) {} } @@ -76,7 +96,12 @@ class ClassWithMethod(T: type) { inline Cpp ''' void FMethodCall() { Carbon::ClassWithMethod c; - // CHECK:STDERR: fail_todo_generic_class_method_call.carbon:[[@LINE+2]]:5: error: no member named 'M' in 'Carbon::Main::ClassWithMethod' [CppInteropParseError] + // CHECK:STDERR: ╭─┤ fail_todo_generic_class_method_call.carbon:[[@LINE+7]]:5 + // CHECK:STDERR: -> │ c.M(); + // CHECK:STDERR: · ─ ┳ + // CHECK:STDERR: · ┗━━┫ error: no member named 'M' in 'Carbon::Main::ClassWithMethod' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: c.M(); } diff --git a/toolchain/check/testdata/interop/cpp/class/export/method.carbon b/toolchain/check/testdata/interop/cpp/class/export/method.carbon index d99fda1a4884..0d967008ebe2 100644 --- a/toolchain/check/testdata/interop/cpp/class/export/method.carbon +++ b/toolchain/check/testdata/interop/cpp/class/export/method.carbon @@ -92,8 +92,17 @@ class RefMethodRValueClass { inline Cpp ''' void RefMethodRValue() { - // CHECK:STDERR: fail_ref_method_rvalue.carbon:[[@LINE+3]]:3: error: 'this' argument to member function 'M' is an rvalue, but function has non-const lvalue ref-qualifier [CppInteropParseError] - // CHECK:STDERR: fail_ref_method_rvalue.carbon:[[@LINE-6]]:17: note: 'M' declared here [CppInteropParseNote] + // CHECK:STDERR: ╭─┤ fail_ref_method_rvalue.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn M(ref self); + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ 'M' declared here [CppInteropParseNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Carbon::RefMethodRValueClass().M(); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: 'this' argument to member function 'M' is an rvalue, but function + // CHECK:STDERR: · ┃ has non-const lvalue ref-qualifier + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Carbon::RefMethodRValueClass().M(); } @@ -109,8 +118,19 @@ class RefMethodConstLValueClass { inline Cpp ''' void RefMethodConstLValue(const Carbon::RefMethodConstLValueClass& c) { - // CHECK:STDERR: fail_ref_method_const_lvalue.carbon:[[@LINE+3]]:3: error: 'this' argument to member function 'M' has type 'const Carbon::RefMethodConstLValueClass' (aka 'const Carbon::Main::RefMethodConstLValueClass'), but function is not marked const [CppInteropParseError] - // CHECK:STDERR: fail_ref_method_const_lvalue.carbon:[[@LINE-6]]:17: note: 'M' declared here [CppInteropParseNote] + // CHECK:STDERR: ╭─┤ fail_ref_method_const_lvalue.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: │ fn M(ref self); + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ 'M' declared here [CppInteropParseNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ c.M(); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: 'this' argument to member function 'M' has type 'const + // CHECK:STDERR: · ┃ Carbon::RefMethodConstLValueClass' (aka 'const + // CHECK:STDERR: · ┃ Carbon::Main::RefMethodConstLValueClass'), but function is not + // CHECK:STDERR: · ┃ marked const + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: c.M(); } diff --git a/toolchain/check/testdata/interop/cpp/class/export/override.carbon b/toolchain/check/testdata/interop/cpp/class/export/override.carbon index fa7b20b188fd..f46c8d772ddd 100644 --- a/toolchain/check/testdata/interop/cpp/class/export/override.carbon +++ b/toolchain/check/testdata/interop/cpp/class/export/override.carbon @@ -72,7 +72,13 @@ struct VBase { class A {} -// CHECK:STDERR: fail_todo_generic.carbon:[[@LINE+2]]:1-25: error: semantics TODO: `generic class overriding methods from a C++ virtual class` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_todo_generic.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ class GenericZ(T: type) { +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: +// CHECK:STDERR: · ┃ `generic class overriding methods from a C++ virtual class` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: class GenericZ(T: type) { extend base: Cpp.VBase; diff --git a/toolchain/check/testdata/interop/cpp/class/export/static.carbon b/toolchain/check/testdata/interop/cpp/class/export/static.carbon index 1d246210dd62..8f9bb24eafd8 100644 --- a/toolchain/check/testdata/interop/cpp/class/export/static.carbon +++ b/toolchain/check/testdata/interop/cpp/class/export/static.carbon @@ -34,8 +34,18 @@ class PrivateClass { inline Cpp ''' int PrivateStatic() { - // CHECK:STDERR: fail_static_private.carbon:[[@LINE+3]]:32: error: 'x' is a private member of 'Carbon::Main::PrivateClass' [CppInteropParseError] - // CHECK:STDERR: fail_static_private.carbon:[[@LINE-6]]:23: note: implicitly declared private here [CppInteropParseNote] + // CHECK:STDERR: ╭─┤ fail_static_private.carbon:[[@LINE+13]]:32 + // CHECK:STDERR: │ private static var x: i32 = 123; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ implicitly declared private here + // CHECK:STDERR: · │ [CppInteropParseNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ return Carbon::PrivateClass::x; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: 'x' is a private member of + // CHECK:STDERR: · ┃ 'Carbon::Main::PrivateClass' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return Carbon::PrivateClass::x; } diff --git a/toolchain/check/testdata/interop/cpp/class/import/abstract.carbon b/toolchain/check/testdata/interop/cpp/class/import/abstract.carbon index c85200b75786..f5a2f0d659b0 100644 --- a/toolchain/check/testdata/interop/cpp/class/import/abstract.carbon +++ b/toolchain/check/testdata/interop/cpp/class/import/abstract.carbon @@ -57,7 +57,12 @@ import Cpp library "abstract.h"; class C { extend base: Cpp.A; - // CHECK:STDERR: fail_impl_mismatch_member.carbon:[[@LINE+2]]:3-40: error: override without compatible virtual in base class [OverrideWithoutVirtualInBase] + // CHECK:STDERR: ╭─┤ fail_impl_mismatch_member.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ override fn invalid(unused ref self) {} + // CHECK:STDERR: · ━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: override without compatible virtual in base class + // CHECK:STDERR: · ┃ [OverrideWithoutVirtualInBase] + // CHECK:STDERR: ╰──── // CHECK:STDERR: override fn invalid(unused ref self) {} } @@ -76,7 +81,13 @@ library "[[@TEST_NAME]]"; import Cpp library "abstract_final.h"; class C { - // CHECK:STDERR: fail_derive_from_abstract_final.carbon:[[@LINE+2]]:16-32: error: deriving from final type `AbstractFinal`; base type must be an `abstract` or `base` class [BaseIsFinal] + // CHECK:STDERR: ╭─┤ fail_derive_from_abstract_final.carbon:[[@LINE+8]]:16 + // CHECK:STDERR: -> │ extend base: Cpp.AbstractFinal; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: deriving from final type `AbstractFinal`; base type + // CHECK:STDERR: · ┃ must be an `abstract` or `base` class + // CHECK:STDERR: · ┃ [BaseIsFinal] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend base: Cpp.AbstractFinal; } diff --git a/toolchain/check/testdata/interop/cpp/class/import/access.carbon b/toolchain/check/testdata/interop/cpp/class/import/access.carbon index 173ea8e3e4b9..3ed13757be1a 100644 --- a/toolchain/check/testdata/interop/cpp/class/import/access.carbon +++ b/toolchain/check/testdata/interop/cpp/class/import/access.carbon @@ -70,12 +70,30 @@ library "[[@TEST_NAME]]"; import Cpp library "non_function_member_protected.h"; fn F(c: Cpp.NonFunctionMemberProtected) { - // CHECK:STDERR: fail_import_non_function_member_protected.carbon:[[@LINE+3]]:35-49: error: cannot access protected member `instance_data` of type `Cpp.NonFunctionMemberProtected` [ClassInvalidMemberAccess] - // CHECK:STDERR: ./non_function_member_protected.h:2:7: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_import_non_function_member_protected.carbon:[[@LINE+14]]:35 + // CHECK:STDERR: -> │ let unused instance_data: i32 = c.instance_data; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access protected member + // CHECK:STDERR: · ┃ `instance_data` of type + // CHECK:STDERR: · ┃ `Cpp.NonFunctionMemberProtected` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./non_function_member_protected.h + // CHECK:STDERR: │ class NonFunctionMemberProtected { + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused instance_data: i32 = c.instance_data; - // CHECK:STDERR: fail_import_non_function_member_protected.carbon:[[@LINE+3]]:33-74: error: cannot access protected member `static_data` of type `Cpp.NonFunctionMemberProtected` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_import_non_function_member_protected.carbon:[[@LINE+2]]:33-74: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_import_non_function_member_protected.carbon:[[@LINE+10]]:33 + // CHECK:STDERR: -> │ let unused static_data: i32 = Cpp.NonFunctionMemberProtected.static_data; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access protected member + // CHECK:STDERR: · │ ┃ `static_data` of type + // CHECK:STDERR: · │ ┃ `Cpp.NonFunctionMemberProtected` + // CHECK:STDERR: · │ ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: · ╰────┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused static_data: i32 = Cpp.NonFunctionMemberProtected.static_data; } @@ -91,12 +109,28 @@ class Derived { } fn F(d: Derived) { - // CHECK:STDERR: fail_import_non_function_member_protected_extend.carbon:[[@LINE+3]]:35-49: error: cannot access protected member `instance_data` of type `Derived` [ClassInvalidMemberAccess] - // CHECK:STDERR: ./non_function_member_protected.h:2:7: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_import_non_function_member_protected_extend.carbon:[[@LINE+13]]:35 + // CHECK:STDERR: -> │ let unused instance_data: i32 = d.instance_data; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access protected member + // CHECK:STDERR: · ┃ `instance_data` of type `Derived` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./non_function_member_protected.h + // CHECK:STDERR: │ class NonFunctionMemberProtected { + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused instance_data: i32 = d.instance_data; - // CHECK:STDERR: fail_import_non_function_member_protected_extend.carbon:[[@LINE+3]]:33-51: error: cannot access protected member `static_data` of type `Derived` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_import_non_function_member_protected_extend.carbon:[[@LINE+2]]:33-51: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_import_non_function_member_protected_extend.carbon:[[@LINE+9]]:33 + // CHECK:STDERR: -> │ let unused static_data: i32 = Derived.static_data; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access protected member + // CHECK:STDERR: · │ ┃ `static_data` of type `Derived` + // CHECK:STDERR: · │ ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: · ╰────┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused static_data: i32 = Derived.static_data; } @@ -137,12 +171,30 @@ library "[[@TEST_NAME]]"; import Cpp library "non_function_member_private.h"; fn F(c: Cpp.NonFunctionMemberPrivate) { - // CHECK:STDERR: fail_import_non_function_member_private.carbon:[[@LINE+3]]:35-49: error: cannot access private member `instance_data` of type `Cpp.NonFunctionMemberPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: ./non_function_member_private.h:2:7: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_import_non_function_member_private.carbon:[[@LINE+14]]:35 + // CHECK:STDERR: -> │ let unused instance_data: i32 = c.instance_data; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member + // CHECK:STDERR: · ┃ `instance_data` of type + // CHECK:STDERR: · ┃ `Cpp.NonFunctionMemberPrivate` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./non_function_member_private.h + // CHECK:STDERR: │ class NonFunctionMemberPrivate { + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused instance_data: i32 = c.instance_data; - // CHECK:STDERR: fail_import_non_function_member_private.carbon:[[@LINE+3]]:33-72: error: cannot access private member `static_data` of type `Cpp.NonFunctionMemberPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_import_non_function_member_private.carbon:[[@LINE+2]]:33-72: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_import_non_function_member_private.carbon:[[@LINE+10]]:33 + // CHECK:STDERR: -> │ let unused static_data: i32 = Cpp.NonFunctionMemberPrivate.static_data; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member + // CHECK:STDERR: · │ ┃ `static_data` of type + // CHECK:STDERR: · │ ┃ `Cpp.NonFunctionMemberPrivate` + // CHECK:STDERR: · │ ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: · ╰────┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused static_data: i32 = Cpp.NonFunctionMemberPrivate.static_data; } @@ -156,24 +208,65 @@ import Cpp library "non_function_member_private.h"; class Derived { extend base: Cpp.NonFunctionMemberPrivate; fn F(self) { - // CHECK:STDERR: fail_import_non_function_member_private_extend.carbon:[[@LINE+3]]:37-54: error: cannot access private member `instance_data` of type `Cpp.NonFunctionMemberPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: ./non_function_member_private.h:2:7: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_import_non_function_member_private_extend.carbon:[[@LINE+14]]:37 + // CHECK:STDERR: -> │ let unused instance_data: i32 = self.instance_data; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member + // CHECK:STDERR: · ┃ `instance_data` of type + // CHECK:STDERR: · ┃ `Cpp.NonFunctionMemberPrivate` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./non_function_member_private.h + // CHECK:STDERR: │ class NonFunctionMemberPrivate { + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused instance_data: i32 = self.instance_data; } } fn F(d: Derived) { - // CHECK:STDERR: fail_import_non_function_member_private_extend.carbon:[[@LINE+3]]:35-49: error: cannot access private member `instance_data` of type `Cpp.NonFunctionMemberPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: ./non_function_member_private.h:2:7: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_import_non_function_member_private_extend.carbon:[[@LINE+14]]:35 + // CHECK:STDERR: -> │ let unused instance_data: i32 = d.instance_data; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member + // CHECK:STDERR: · ┃ `instance_data` of type + // CHECK:STDERR: · ┃ `Cpp.NonFunctionMemberPrivate` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./non_function_member_private.h + // CHECK:STDERR: │ class NonFunctionMemberPrivate { + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused instance_data: i32 = d.instance_data; - // CHECK:STDERR: fail_import_non_function_member_private_extend.carbon:[[@LINE+3]]:41-59: error: cannot access private member `static_data` of type `Cpp.NonFunctionMemberPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_import_non_function_member_private_extend.carbon:[[@LINE+2]]:41-59: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_import_non_function_member_private_extend.carbon:[[@LINE+11]]:41 + // CHECK:STDERR: -> │ let unused derived_static_data: i32 = Derived.static_data; + // CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: cannot access private member `static_data` of type + // CHECK:STDERR: · ┃ `Cpp.NonFunctionMemberPrivate` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: · ╰──┤ declared here + // CHECK:STDERR: · │ [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused derived_static_data: i32 = Derived.static_data; - // CHECK:STDERR: fail_import_non_function_member_private_extend.carbon:[[@LINE+3]]:38-77: error: cannot access private member `static_data` of type `Cpp.NonFunctionMemberPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_import_non_function_member_private_extend.carbon:[[@LINE-2]]:41-59: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_import_non_function_member_private_extend.carbon:[[@LINE+14]]:38 + // CHECK:STDERR: │ let unused derived_static_data: i32 = Derived.static_data; + // CHECK:STDERR: · ─────────┬───────── + // CHECK:STDERR: · ╰──┤ declared here + // CHECK:STDERR: · │ [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ let unused base_static_data: i32 = Cpp.NonFunctionMemberPrivate.static_data; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member + // CHECK:STDERR: · ┃ `static_data` of type + // CHECK:STDERR: · ┃ `Cpp.NonFunctionMemberPrivate` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused base_static_data: i32 = Cpp.NonFunctionMemberPrivate.static_data; } @@ -189,8 +282,16 @@ class Derived { fn F() { // TODO: `NonFunctionMemberPrivate.static_data` is private, so this // should fail. - // CHECK:STDERR: fail_import_non_function_member_private_extend_static_within_member_function.carbon:[[@LINE+3]]:47-57: error: cannot access private member `static_data` of type `Cpp.NonFunctionMemberPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_import_non_function_member_private_extend_static_within_member_function.carbon:[[@LINE+2]]:47-57: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_import_non_function_member_private_extend_static_within_member_function.carbon:[[@LINE+11]]:47 + // CHECK:STDERR: -> │ let unused unqualified_static_data: i32 = static_data; + // CHECK:STDERR: · ━━━━━┳━━━━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: cannot access private member `static_data` of type + // CHECK:STDERR: · ┃ `Cpp.NonFunctionMemberPrivate` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: · ╰──┤ declared here + // CHECK:STDERR: · │ [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused unqualified_static_data: i32 = static_data; } @@ -239,12 +340,24 @@ library "[[@TEST_NAME]]"; import Cpp library "function_member_protected.h"; fn F(c: Cpp.FunctionMemberProtected*) { - // CHECK:STDERR: fail_import_function_member_protected.carbon:[[@LINE+3]]:3-16: error: cannot access protected member `instance_fn` of type `Cpp.FunctionMemberProtected` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_import_function_member_protected.carbon:[[@LINE+2]]:3-16: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_import_function_member_protected.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ c->instance_fn(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access protected member `instance_fn` of type + // CHECK:STDERR: · │ ┃ `Cpp.FunctionMemberProtected` + // CHECK:STDERR: · │ ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: · ╰────┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: c->instance_fn(); - // CHECK:STDERR: fail_import_function_member_protected.carbon:[[@LINE+3]]:3-39: error: cannot access protected member `static_fn` of type `Cpp.FunctionMemberProtected` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_import_function_member_protected.carbon:[[@LINE+2]]:3-39: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_import_function_member_protected.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ Cpp.FunctionMemberProtected.static_fn(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access protected member `static_fn` of type + // CHECK:STDERR: · │ ┃ `Cpp.FunctionMemberProtected` + // CHECK:STDERR: · │ ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: · ╰────┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.FunctionMemberProtected.static_fn(); } @@ -260,9 +373,21 @@ class Derived { fn F(self) { //@dump-sem-ir-begin // TODO: It should be possible to call protected methods in the base class. - // CHECK:STDERR: fail_todo_import_function_member_protected_extend_call_instance_in_member.carbon:[[@LINE+4]]:5-20: error: no matching function for call to 'instance_fn' [CppInteropParseError] - // CHECK:STDERR: ./function_member_protected.h:4:8: note: candidate function not viable [CppInteropParseNote] - // CHECK:STDERR: ./function_member_protected.h:4:19-20: note: cannot convert argument of incomplete type 'const Carbon::Main::Derived' to 'FunctionMemberProtected' for object argument [CppInteropParseNoteReason] + // CHECK:STDERR: ╭─┤ fail_todo_import_function_member_protected_extend_call_instance_in_member.carbon:[[@LINE+16]]:5 + // CHECK:STDERR: -> │ self.instance_fn(); + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'instance_fn' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./function_member_protected.h + // CHECK:STDERR: │ auto instance_fn() -> void; + // CHECK:STDERR: · ┬ ┬─ + // CHECK:STDERR: · ╰─────────────┤ candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: · ╰────┤ cannot convert argument of incomplete type 'const + // CHECK:STDERR: · │ Carbon::Main::Derived' to 'FunctionMemberProtected' for + // CHECK:STDERR: · │ object argument + // CHECK:STDERR: · │ [CppInteropParseNoteReason] + // CHECK:STDERR: ╰──── // CHECK:STDERR: self.instance_fn(); //@dump-sem-ir-end @@ -307,36 +432,93 @@ import Cpp library "function_member_private.h"; class Derived { extend base: Cpp.FunctionMemberPrivate; fn F(self) { - // CHECK:STDERR: fail_import_function_member_private.carbon:[[@LINE+3]]:5-20: error: cannot access private member `instance_fn` of type `Cpp.FunctionMemberPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_import_function_member_private.carbon:[[@LINE+2]]:5-20: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_import_function_member_private.carbon:[[@LINE+9]]:5 + // CHECK:STDERR: -> │ self.instance_fn(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `instance_fn` of type + // CHECK:STDERR: · │ ┃ `Cpp.FunctionMemberPrivate` + // CHECK:STDERR: · │ ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: · ╰────┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: self.instance_fn(); - // CHECK:STDERR: fail_import_function_member_private.carbon:[[@LINE+3]]:5-13: error: cannot access private member `static_fn` of type `Cpp.FunctionMemberPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_import_function_member_private.carbon:[[@LINE+2]]:5-13: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_import_function_member_private.carbon:[[@LINE+9]]:5 + // CHECK:STDERR: -> │ static_fn(); + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `static_fn` of type + // CHECK:STDERR: · │ ┃ `Cpp.FunctionMemberPrivate` + // CHECK:STDERR: · │ ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: · ╰────┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: static_fn(); - // CHECK:STDERR: fail_import_function_member_private.carbon:[[@LINE+3]]:5-21: error: cannot access private member `static_fn` of type `Cpp.FunctionMemberPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_import_function_member_private.carbon:[[@LINE-2]]:5-13: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_import_function_member_private.carbon:[[@LINE+12]]:5 + // CHECK:STDERR: │ static_fn(); + // CHECK:STDERR: · ────┬──── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Derived.static_fn(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `static_fn` of type + // CHECK:STDERR: · ┃ `Cpp.FunctionMemberPrivate` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Derived.static_fn(); - // CHECK:STDERR: fail_import_function_member_private.carbon:[[@LINE+3]]:5-39: error: cannot access private member `static_fn` of type `Cpp.FunctionMemberPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_import_function_member_private.carbon:[[@LINE-6]]:5-13: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_import_function_member_private.carbon:[[@LINE+12]]:5 + // CHECK:STDERR: │ static_fn(); + // CHECK:STDERR: · ────┬──── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Cpp.FunctionMemberPrivate.static_fn(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `static_fn` of type + // CHECK:STDERR: · ┃ `Cpp.FunctionMemberPrivate` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.FunctionMemberPrivate.static_fn(); } } fn F(c: Cpp.FunctionMemberPrivate*) { - // CHECK:STDERR: fail_import_function_member_private.carbon:[[@LINE+3]]:3-16: error: cannot access private member `instance_fn` of type `Cpp.FunctionMemberPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_import_function_member_private.carbon:[[@LINE-18]]:5-20: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_import_function_member_private.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ self.instance_fn(); + // CHECK:STDERR: · ────────┬─────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ c->instance_fn(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `instance_fn` of type + // CHECK:STDERR: · ┃ `Cpp.FunctionMemberPrivate` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: c->instance_fn(); - // CHECK:STDERR: fail_import_function_member_private.carbon:[[@LINE+3]]:3-19: error: cannot access private member `static_fn` of type `Cpp.FunctionMemberPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_import_function_member_private.carbon:[[@LINE-18]]:5-13: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_import_function_member_private.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ static_fn(); + // CHECK:STDERR: · ────┬──── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Derived.static_fn(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `static_fn` of type + // CHECK:STDERR: · ┃ `Cpp.FunctionMemberPrivate` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Derived.static_fn(); - // CHECK:STDERR: fail_import_function_member_private.carbon:[[@LINE+3]]:3-37: error: cannot access private member `static_fn` of type `Cpp.FunctionMemberPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_import_function_member_private.carbon:[[@LINE-22]]:5-13: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_import_function_member_private.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ static_fn(); + // CHECK:STDERR: · ────┬──── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Cpp.FunctionMemberPrivate.static_fn(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `static_fn` of type + // CHECK:STDERR: · ┃ `Cpp.FunctionMemberPrivate` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.FunctionMemberPrivate.static_fn(); } @@ -383,12 +565,32 @@ library "[[@TEST_NAME]]"; import Cpp library "overload_set.h"; fn F() { - // CHECK:STDERR: fail_import_overload_set_protected.carbon:[[@LINE+3]]:3-64: error: cannot access protected member `OverloadSet` of type `Cpp.OverloadSet` [ClassInvalidMemberAccess] - // CHECK:STDERR: ./overload_set.h:11:3: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_import_overload_set_protected.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: -> │ Cpp.OverloadSet.OverloadSet(Cpp.ProtectedCall.ProtectedCall()); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access protected member `OverloadSet` of type + // CHECK:STDERR: · ┃ `Cpp.OverloadSet` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./overload_set.h + // CHECK:STDERR: │ OverloadSet(ProtectedCall x); + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.OverloadSet.OverloadSet(Cpp.ProtectedCall.ProtectedCall()); - // CHECK:STDERR: fail_import_overload_set_protected.carbon:[[@LINE+3]]:3-61: error: cannot access protected member `Overload` of type `Cpp.OverloadSet` [ClassInvalidMemberAccess] - // CHECK:STDERR: ./overload_set.h:12:15: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_import_overload_set_protected.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: -> │ Cpp.OverloadSet.Overload(Cpp.ProtectedCall.ProtectedCall()); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access protected member `Overload` of type + // CHECK:STDERR: · ┃ `Cpp.OverloadSet` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./overload_set.h + // CHECK:STDERR: │ static auto Overload(ProtectedCall x) -> void; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.OverloadSet.Overload(Cpp.ProtectedCall.ProtectedCall()); } @@ -434,12 +636,31 @@ library "[[@TEST_NAME]]"; import Cpp library "overload_set.h"; fn F() { - // CHECK:STDERR: fail_import_overload_set_private.carbon:[[@LINE+3]]:3-60: error: cannot access private member `OverloadSet` of type `Cpp.OverloadSet` [ClassInvalidMemberAccess] - // CHECK:STDERR: ./overload_set.h:14:3: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_import_overload_set_private.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: -> │ Cpp.OverloadSet.OverloadSet(Cpp.PrivateCall.PrivateCall()); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `OverloadSet` of type + // CHECK:STDERR: · ┃ `Cpp.OverloadSet` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./overload_set.h + // CHECK:STDERR: │ OverloadSet(PrivateCall x); + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.OverloadSet.OverloadSet(Cpp.PrivateCall.PrivateCall()); - // CHECK:STDERR: fail_import_overload_set_private.carbon:[[@LINE+3]]:3-57: error: cannot access private member `Overload` of type `Cpp.OverloadSet` [ClassInvalidMemberAccess] - // CHECK:STDERR: ./overload_set.h:15:15: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_import_overload_set_private.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: -> │ Cpp.OverloadSet.Overload(Cpp.PrivateCall.PrivateCall()); + // CHECK:STDERR: · ━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `Overload` of type `Cpp.OverloadSet` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./overload_set.h + // CHECK:STDERR: │ static auto Overload(PrivateCall x) -> void; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.OverloadSet.Overload(Cpp.PrivateCall.PrivateCall()); } @@ -454,15 +675,35 @@ class D { extend base: Cpp.OverloadSet; fn MakePrivate() -> D { - // CHECK:STDERR: fail_import_overload_set_private_base.carbon:[[@LINE+3]]:21-62: error: cannot access private member `OverloadSet` of type `Cpp.OverloadSet` [ClassInvalidMemberAccess] - // CHECK:STDERR: ./overload_set.h:14:3: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_import_overload_set_private_base.carbon:[[@LINE+13]]:21 + // CHECK:STDERR: -> │ return {.base = OverloadSet(Cpp.PrivateCall.PrivateCall())}; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `OverloadSet` of + // CHECK:STDERR: · ┃ type `Cpp.OverloadSet` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./overload_set.h + // CHECK:STDERR: │ OverloadSet(PrivateCall x); + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return {.base = OverloadSet(Cpp.PrivateCall.PrivateCall())}; } fn CallPrivate() { - // CHECK:STDERR: fail_import_overload_set_private_base.carbon:[[@LINE+3]]:5-43: error: cannot access private member `Overload` of type `Cpp.OverloadSet` [ClassInvalidMemberAccess] - // CHECK:STDERR: ./overload_set.h:15:15: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_import_overload_set_private_base.carbon:[[@LINE+13]]:5 + // CHECK:STDERR: -> │ Overload(Cpp.PrivateCall.PrivateCall()); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `Overload` of type + // CHECK:STDERR: · ┃ `Cpp.OverloadSet` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./overload_set.h + // CHECK:STDERR: │ static auto Overload(PrivateCall x) -> void; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Overload(Cpp.PrivateCall.PrivateCall()); } @@ -495,12 +736,32 @@ library "[[@TEST_NAME]]"; import Cpp library "overload_set_base_class.h"; fn F() { - // CHECK:STDERR: fail_import_overload_set_public_base_class_call_non_public.carbon:[[@LINE+3]]:3-64: error: cannot access protected member `Overload` of type `Cpp.OverloadPublic` [ClassInvalidMemberAccess] - // CHECK:STDERR: ./overload_set.h:12:15: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_import_overload_set_public_base_class_call_non_public.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: -> │ Cpp.OverloadPublic.Overload(Cpp.ProtectedCall.ProtectedCall()); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access protected member `Overload` of type + // CHECK:STDERR: · ┃ `Cpp.OverloadPublic` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./overload_set.h + // CHECK:STDERR: │ static auto Overload(ProtectedCall x) -> void; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.OverloadPublic.Overload(Cpp.ProtectedCall.ProtectedCall()); - // CHECK:STDERR: fail_import_overload_set_public_base_class_call_non_public.carbon:[[@LINE+3]]:3-60: error: cannot access private member `Overload` of type `Cpp.OverloadPublic` [ClassInvalidMemberAccess] - // CHECK:STDERR: ./overload_set.h:15:15: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_import_overload_set_public_base_class_call_non_public.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: -> │ Cpp.OverloadPublic.Overload(Cpp.PrivateCall.PrivateCall()); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `Overload` of type + // CHECK:STDERR: · ┃ `Cpp.OverloadPublic` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./overload_set.h + // CHECK:STDERR: │ static auto Overload(PrivateCall x) -> void; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.OverloadPublic.Overload(Cpp.PrivateCall.PrivateCall()); } @@ -532,8 +793,18 @@ class Derived { extend base: Cpp.OverloadPublic; fn F() { - // CHECK:STDERR: fail_import_overload_set_public_base_class_derived_call_private.carbon:[[@LINE+3]]:5-43: error: cannot access private member `Overload` of type `Cpp.OverloadPublic` [ClassInvalidMemberAccess] - // CHECK:STDERR: ./overload_set.h:15:15: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_import_overload_set_public_base_class_derived_call_private.carbon:[[@LINE+13]]:5 + // CHECK:STDERR: -> │ Overload(Cpp.PrivateCall.PrivateCall()); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `Overload` of type + // CHECK:STDERR: · ┃ `Cpp.OverloadPublic` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./overload_set.h + // CHECK:STDERR: │ static auto Overload(PrivateCall x) -> void; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Overload(Cpp.PrivateCall.PrivateCall()); } @@ -546,16 +817,40 @@ library "[[@TEST_NAME]]"; import Cpp library "overload_set_base_class.h"; fn F() { - // CHECK:STDERR: fail_import_overload_set_protected_base_class.carbon:[[@LINE+3]]:3-32: error: cannot access protected member `Overload` of type `Cpp.OverloadProtected` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_import_overload_set_protected_base_class.carbon:[[@LINE+2]]:3-32: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_import_overload_set_protected_base_class.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ Cpp.OverloadProtected.Overload(Cpp.PublicCall.PublicCall()); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access protected member `Overload` of type + // CHECK:STDERR: · │ ┃ `Cpp.OverloadProtected` + // CHECK:STDERR: · │ ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: · ╰────┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.OverloadProtected.Overload(Cpp.PublicCall.PublicCall()); - // CHECK:STDERR: fail_import_overload_set_protected_base_class.carbon:[[@LINE+3]]:3-32: error: cannot access protected member `Overload` of type `Cpp.OverloadProtected` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_import_overload_set_protected_base_class.carbon:[[@LINE-2]]:3-32: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_import_overload_set_protected_base_class.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ Cpp.OverloadProtected.Overload(Cpp.PublicCall.PublicCall()); + // CHECK:STDERR: · ───────────────┬────────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Cpp.OverloadProtected.Overload(Cpp.ProtectedCall.ProtectedCall()); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access protected member `Overload` of type + // CHECK:STDERR: · ┃ `Cpp.OverloadProtected` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.OverloadProtected.Overload(Cpp.ProtectedCall.ProtectedCall()); - // CHECK:STDERR: fail_import_overload_set_protected_base_class.carbon:[[@LINE+3]]:3-32: error: cannot access protected member `Overload` of type `Cpp.OverloadProtected` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_import_overload_set_protected_base_class.carbon:[[@LINE-6]]:3-32: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_import_overload_set_protected_base_class.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ Cpp.OverloadProtected.Overload(Cpp.PublicCall.PublicCall()); + // CHECK:STDERR: · ───────────────┬────────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Cpp.OverloadProtected.Overload(Cpp.PrivateCall.PrivateCall()); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access protected member `Overload` of type + // CHECK:STDERR: · ┃ `Cpp.OverloadProtected` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.OverloadProtected.Overload(Cpp.PrivateCall.PrivateCall()); } @@ -587,8 +882,18 @@ class Derived { extend base: Cpp.OverloadProtected; fn F() { - // CHECK:STDERR: fail_import_overload_set_protected_base_class_derived_call_private.carbon:[[@LINE+3]]:5-43: error: cannot access private member `Overload` of type `Cpp.OverloadProtected` [ClassInvalidMemberAccess] - // CHECK:STDERR: ./overload_set.h:15:15: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_import_overload_set_protected_base_class_derived_call_private.carbon:[[@LINE+13]]:5 + // CHECK:STDERR: -> │ Overload(Cpp.PrivateCall.PrivateCall()); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `Overload` of type + // CHECK:STDERR: · ┃ `Cpp.OverloadProtected` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./overload_set.h + // CHECK:STDERR: │ static auto Overload(PrivateCall x) -> void; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Overload(Cpp.PrivateCall.PrivateCall()); } @@ -601,16 +906,40 @@ library "[[@TEST_NAME]]"; import Cpp library "overload_set_base_class.h"; fn F() { - // CHECK:STDERR: fail_import_overload_set_private_base_class.carbon:[[@LINE+3]]:3-30: error: cannot access private member `Overload` of type `Cpp.OverloadPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_import_overload_set_private_base_class.carbon:[[@LINE+2]]:3-30: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_import_overload_set_private_base_class.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ Cpp.OverloadPrivate.Overload(Cpp.PublicCall.PublicCall()); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `Overload` of type + // CHECK:STDERR: · │ ┃ `Cpp.OverloadPrivate` + // CHECK:STDERR: · │ ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: · ╰────┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.OverloadPrivate.Overload(Cpp.PublicCall.PublicCall()); - // CHECK:STDERR: fail_import_overload_set_private_base_class.carbon:[[@LINE+3]]:3-30: error: cannot access private member `Overload` of type `Cpp.OverloadPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_import_overload_set_private_base_class.carbon:[[@LINE-2]]:3-30: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_import_overload_set_private_base_class.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ Cpp.OverloadPrivate.Overload(Cpp.PublicCall.PublicCall()); + // CHECK:STDERR: · ──────────────┬───────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Cpp.OverloadPrivate.Overload(Cpp.ProtectedCall.ProtectedCall()); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `Overload` of type + // CHECK:STDERR: · ┃ `Cpp.OverloadPrivate` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.OverloadPrivate.Overload(Cpp.ProtectedCall.ProtectedCall()); - // CHECK:STDERR: fail_import_overload_set_private_base_class.carbon:[[@LINE+3]]:3-30: error: cannot access private member `Overload` of type `Cpp.OverloadPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_import_overload_set_private_base_class.carbon:[[@LINE-6]]:3-30: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_import_overload_set_private_base_class.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ Cpp.OverloadPrivate.Overload(Cpp.PublicCall.PublicCall()); + // CHECK:STDERR: · ──────────────┬───────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Cpp.OverloadPrivate.Overload(Cpp.PrivateCall.PrivateCall()); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `Overload` of type + // CHECK:STDERR: · ┃ `Cpp.OverloadPrivate` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.OverloadPrivate.Overload(Cpp.PrivateCall.PrivateCall()); } @@ -625,16 +954,40 @@ class Derived { extend base: Cpp.OverloadPrivate; fn F() { - // CHECK:STDERR: fail_import_overload_set_private_base_class_derived.carbon:[[@LINE+3]]:5-12: error: cannot access private member `Overload` of type `Cpp.OverloadPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_import_overload_set_private_base_class_derived.carbon:[[@LINE+2]]:5-12: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_import_overload_set_private_base_class_derived.carbon:[[@LINE+9]]:5 + // CHECK:STDERR: -> │ Overload(Cpp.PublicCall.PublicCall()); + // CHECK:STDERR: · ┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `Overload` of type + // CHECK:STDERR: · │ ┃ `Cpp.OverloadPrivate` + // CHECK:STDERR: · │ ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: · ╰────┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Overload(Cpp.PublicCall.PublicCall()); - // CHECK:STDERR: fail_import_overload_set_private_base_class_derived.carbon:[[@LINE+3]]:5-12: error: cannot access private member `Overload` of type `Cpp.OverloadPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_import_overload_set_private_base_class_derived.carbon:[[@LINE-2]]:5-12: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_import_overload_set_private_base_class_derived.carbon:[[@LINE+12]]:5 + // CHECK:STDERR: │ Overload(Cpp.PublicCall.PublicCall()); + // CHECK:STDERR: · ────┬─── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Overload(Cpp.ProtectedCall.ProtectedCall()); + // CHECK:STDERR: · ┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `Overload` of type + // CHECK:STDERR: · ┃ `Cpp.OverloadPrivate` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Overload(Cpp.ProtectedCall.ProtectedCall()); - // CHECK:STDERR: fail_import_overload_set_private_base_class_derived.carbon:[[@LINE+3]]:5-12: error: cannot access private member `Overload` of type `Cpp.OverloadPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_import_overload_set_private_base_class_derived.carbon:[[@LINE-6]]:5-12: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_import_overload_set_private_base_class_derived.carbon:[[@LINE+12]]:5 + // CHECK:STDERR: │ Overload(Cpp.PublicCall.PublicCall()); + // CHECK:STDERR: · ────┬─── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Overload(Cpp.PrivateCall.PrivateCall()); + // CHECK:STDERR: · ┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `Overload` of type + // CHECK:STDERR: · ┃ `Cpp.OverloadPrivate` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Overload(Cpp.PrivateCall.PrivateCall()); } @@ -716,20 +1069,41 @@ class Derived { extend base: Cpp.Public; fn CallStatic() { - // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE+3]]:5-28: error: cannot access private member `PrivateStatic` of type `Cpp.Public` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE+2]]:5-28: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_public_access_denied.carbon:[[@LINE+9]]:5 + // CHECK:STDERR: -> │ Cpp.Public.PrivateStatic(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `PrivateStatic` of type + // CHECK:STDERR: · │ ┃ `Cpp.Public` + // CHECK:STDERR: · │ ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: · ╰────┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.Public.PrivateStatic(); - // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE+3]]:5-22: error: cannot access private member `PrivateStatic` of type `Cpp.Public` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE-2]]:5-28: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_public_access_denied.carbon:[[@LINE+12]]:5 + // CHECK:STDERR: │ Cpp.Public.PrivateStatic(); + // CHECK:STDERR: · ────────────┬─────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Self.PrivateStatic(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `PrivateStatic` of type + // CHECK:STDERR: · ┃ `Cpp.Public` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Self.PrivateStatic(); } fn CallInstance(var instance: Cpp.Public) { //@dump-sem-ir-begin - // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE+3]]:5-28: error: cannot access private member `PrivateInstance` of type `Cpp.Public` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE+2]]:5-28: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_public_access_denied.carbon:[[@LINE+9]]:5 + // CHECK:STDERR: -> │ instance.PrivateInstance(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `PrivateInstance` of type + // CHECK:STDERR: · │ ┃ `Cpp.Public` + // CHECK:STDERR: · │ ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: · ╰────┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: instance.PrivateInstance(); //@dump-sem-ir-end @@ -737,30 +1111,75 @@ class Derived { } fn Call(var instance: Cpp.Public) { - // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE+3]]:3-28: error: cannot access protected member `ProtectedStatic` of type `Cpp.Public` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE+2]]:3-28: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_public_access_denied.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ Cpp.Public.ProtectedStatic(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access protected member `ProtectedStatic` of type + // CHECK:STDERR: · │ ┃ `Cpp.Public` + // CHECK:STDERR: · │ ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: · ╰────┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.Public.ProtectedStatic(); - // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE+3]]:3-25: error: cannot access protected member `ProtectedStatic` of type `Derived` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE-2]]:3-28: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_public_access_denied.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ Cpp.Public.ProtectedStatic(); + // CHECK:STDERR: · ─────────────┬──────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Derived.ProtectedStatic(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access protected member `ProtectedStatic` of type `Derived` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Derived.ProtectedStatic(); - // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE+3]]:3-26: error: cannot access private member `PrivateStatic` of type `Cpp.Public` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE-28]]:5-28: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_public_access_denied.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ Cpp.Public.PrivateStatic(); + // CHECK:STDERR: · ────────────┬─────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Cpp.Public.PrivateStatic(); + // CHECK:STDERR: · ━┳━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `PrivateStatic` of type `Cpp.Public` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.Public.PrivateStatic(); - // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE+3]]:3-23: error: cannot access private member `PrivateStatic` of type `Cpp.Public` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE-32]]:5-28: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_public_access_denied.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ Cpp.Public.PrivateStatic(); + // CHECK:STDERR: · ────────────┬─────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Derived.PrivateStatic(); + // CHECK:STDERR: · ━┳━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `PrivateStatic` of type `Cpp.Public` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Derived.PrivateStatic(); - // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE+3]]:3-28: error: cannot access protected member `ProtectedInstance` of type `Cpp.Public` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE+2]]:3-28: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_public_access_denied.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ instance.ProtectedInstance(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access protected member `ProtectedInstance` of type + // CHECK:STDERR: · │ ┃ `Cpp.Public` + // CHECK:STDERR: · │ ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: · ╰────┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: instance.ProtectedInstance(); - // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE+3]]:3-26: error: cannot access private member `PrivateInstance` of type `Cpp.Public` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_public_access_denied.carbon:[[@LINE-29]]:5-28: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_public_access_denied.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ instance.PrivateInstance(); + // CHECK:STDERR: · ────────────┬─────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ instance.PrivateInstance(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `PrivateInstance` of type + // CHECK:STDERR: · ┃ `Cpp.Public` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: instance.PrivateInstance(); } @@ -806,62 +1225,150 @@ class Derived { extend base: Cpp.Protected; fn CallStatic() { - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+3]]:5-31: error: cannot access private member `PrivateStatic` of type `Cpp.Protected` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+2]]:5-31: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_protected_access_denied.carbon:[[@LINE+9]]:5 + // CHECK:STDERR: -> │ Cpp.Protected.PrivateStatic(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `PrivateStatic` of type + // CHECK:STDERR: · │ ┃ `Cpp.Protected` + // CHECK:STDERR: · │ ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: · ╰────┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.Protected.PrivateStatic(); - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+3]]:5-22: error: cannot access private member `PrivateStatic` of type `Cpp.Protected` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE-2]]:5-31: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_protected_access_denied.carbon:[[@LINE+12]]:5 + // CHECK:STDERR: │ Cpp.Protected.PrivateStatic(); + // CHECK:STDERR: · ─────────────┬───────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Self.PrivateStatic(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `PrivateStatic` of type + // CHECK:STDERR: · ┃ `Cpp.Protected` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Self.PrivateStatic(); } fn CallInstance(var instance: Cpp.Protected) { - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+3]]:5-28: error: cannot access private member `PrivateInstance` of type `Cpp.Protected` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+2]]:5-28: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_protected_access_denied.carbon:[[@LINE+9]]:5 + // CHECK:STDERR: -> │ instance.PrivateInstance(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `PrivateInstance` of type + // CHECK:STDERR: · │ ┃ `Cpp.Protected` + // CHECK:STDERR: · │ ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: · ╰────┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: instance.PrivateInstance(); } } fn Call(var instance: Cpp.Protected) { - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+3]]:3-28: error: cannot access protected member `PublicStatic` of type `Cpp.Protected` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+2]]:3-28: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_protected_access_denied.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ Cpp.Protected.PublicStatic(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access protected member `PublicStatic` of type + // CHECK:STDERR: · │ ┃ `Cpp.Protected` + // CHECK:STDERR: · │ ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: · ╰────┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.Protected.PublicStatic(); - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+3]]:3-22: error: cannot access protected member `PublicStatic` of type `Derived` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE-2]]:3-28: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_protected_access_denied.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ Cpp.Protected.PublicStatic(); + // CHECK:STDERR: · ─────────────┬──────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Derived.PublicStatic(); + // CHECK:STDERR: · ━━━┳━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access protected member `PublicStatic` of type `Derived` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Derived.PublicStatic(); - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+3]]:3-31: error: cannot access protected member `ProtectedStatic` of type `Cpp.Protected` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+2]]:3-31: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_protected_access_denied.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ Cpp.Protected.ProtectedStatic(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access protected member `ProtectedStatic` of type + // CHECK:STDERR: · │ ┃ `Cpp.Protected` + // CHECK:STDERR: · │ ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: · ╰────┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.Protected.ProtectedStatic(); - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+3]]:3-25: error: cannot access protected member `ProtectedStatic` of type `Derived` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE-2]]:3-31: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_protected_access_denied.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ Cpp.Protected.ProtectedStatic(); + // CHECK:STDERR: · ──────────────┬────────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Derived.ProtectedStatic(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access protected member `ProtectedStatic` of type `Derived` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Derived.ProtectedStatic(); - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+3]]:3-29: error: cannot access private member `PrivateStatic` of type `Cpp.Protected` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE-35]]:5-31: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_protected_access_denied.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ Cpp.Protected.PrivateStatic(); + // CHECK:STDERR: · ─────────────┬───────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Cpp.Protected.PrivateStatic(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `PrivateStatic` of type + // CHECK:STDERR: · ┃ `Cpp.Protected` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.Protected.PrivateStatic(); - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+3]]:3-23: error: cannot access private member `PrivateStatic` of type `Cpp.Protected` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE-39]]:5-31: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_protected_access_denied.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ Cpp.Protected.PrivateStatic(); + // CHECK:STDERR: · ─────────────┬───────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Derived.PrivateStatic(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `PrivateStatic` of type + // CHECK:STDERR: · ┃ `Cpp.Protected` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Derived.PrivateStatic(); - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+3]]:3-25: error: cannot access protected member `PublicInstance` of type `Cpp.Protected` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+2]]:3-25: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_protected_access_denied.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ instance.PublicInstance(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access protected member `PublicInstance` of type + // CHECK:STDERR: · │ ┃ `Cpp.Protected` + // CHECK:STDERR: · │ ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: · ╰────┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: instance.PublicInstance(); - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+3]]:3-28: error: cannot access protected member `ProtectedInstance` of type `Cpp.Protected` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+2]]:3-28: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_protected_access_denied.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ instance.ProtectedInstance(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access protected member `ProtectedInstance` of type + // CHECK:STDERR: · │ ┃ `Cpp.Protected` + // CHECK:STDERR: · │ ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: · ╰────┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: instance.ProtectedInstance(); - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE+3]]:3-26: error: cannot access private member `PrivateInstance` of type `Cpp.Protected` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_protected_access_denied.carbon:[[@LINE-41]]:5-28: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_protected_access_denied.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ instance.PrivateInstance(); + // CHECK:STDERR: · ────────────┬─────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ instance.PrivateInstance(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `PrivateInstance` of type + // CHECK:STDERR: · ┃ `Cpp.Protected` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: instance.PrivateInstance(); } @@ -876,90 +1383,230 @@ class Derived { extend base: Cpp.Private; fn CallStatic() { - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+3]]:5-28: error: cannot access private member `PublicStatic` of type `Cpp.Private` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+2]]:5-28: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_private_access_denied.carbon:[[@LINE+9]]:5 + // CHECK:STDERR: -> │ Cpp.Private.PublicStatic(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `PublicStatic` of type + // CHECK:STDERR: · │ ┃ `Cpp.Private` + // CHECK:STDERR: · │ ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: · ╰────┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.Private.PublicStatic(); - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+3]]:5-21: error: cannot access private member `PublicStatic` of type `Cpp.Private` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE-2]]:5-28: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_private_access_denied.carbon:[[@LINE+12]]:5 + // CHECK:STDERR: │ Cpp.Private.PublicStatic(); + // CHECK:STDERR: · ────────────┬─────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Self.PublicStatic(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `PublicStatic` of type + // CHECK:STDERR: · ┃ `Cpp.Private` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Self.PublicStatic(); - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+3]]:5-31: error: cannot access private member `ProtectedStatic` of type `Cpp.Private` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+2]]:5-31: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_private_access_denied.carbon:[[@LINE+9]]:5 + // CHECK:STDERR: -> │ Cpp.Private.ProtectedStatic(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `ProtectedStatic` of type + // CHECK:STDERR: · │ ┃ `Cpp.Private` + // CHECK:STDERR: · │ ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: · ╰────┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.Private.ProtectedStatic(); - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+3]]:5-24: error: cannot access private member `ProtectedStatic` of type `Cpp.Private` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE-2]]:5-31: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_private_access_denied.carbon:[[@LINE+12]]:5 + // CHECK:STDERR: │ Cpp.Private.ProtectedStatic(); + // CHECK:STDERR: · ─────────────┬───────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Self.ProtectedStatic(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `ProtectedStatic` of type + // CHECK:STDERR: · ┃ `Cpp.Private` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Self.ProtectedStatic(); - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+3]]:5-29: error: cannot access private member `PrivateStatic` of type `Cpp.Private` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+2]]:5-29: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_private_access_denied.carbon:[[@LINE+9]]:5 + // CHECK:STDERR: -> │ Cpp.Private.PrivateStatic(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `PrivateStatic` of type + // CHECK:STDERR: · │ ┃ `Cpp.Private` + // CHECK:STDERR: · │ ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: · ╰────┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.Private.PrivateStatic(); - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+3]]:5-22: error: cannot access private member `PrivateStatic` of type `Cpp.Private` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE-2]]:5-29: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_private_access_denied.carbon:[[@LINE+12]]:5 + // CHECK:STDERR: │ Cpp.Private.PrivateStatic(); + // CHECK:STDERR: · ────────────┬──────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Self.PrivateStatic(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `PrivateStatic` of type + // CHECK:STDERR: · ┃ `Cpp.Private` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Self.PrivateStatic(); } fn CallInstance(var instance: Cpp.Private) { - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+3]]:5-27: error: cannot access private member `PublicInstance` of type `Cpp.Private` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+2]]:5-27: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_private_access_denied.carbon:[[@LINE+9]]:5 + // CHECK:STDERR: -> │ instance.PublicInstance(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `PublicInstance` of type + // CHECK:STDERR: · │ ┃ `Cpp.Private` + // CHECK:STDERR: · │ ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: · ╰────┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: instance.PublicInstance(); - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+3]]:5-30: error: cannot access private member `ProtectedInstance` of type `Cpp.Private` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+2]]:5-30: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_private_access_denied.carbon:[[@LINE+9]]:5 + // CHECK:STDERR: -> │ instance.ProtectedInstance(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `ProtectedInstance` of type + // CHECK:STDERR: · │ ┃ `Cpp.Private` + // CHECK:STDERR: · │ ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: · ╰────┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: instance.ProtectedInstance(); - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+3]]:5-28: error: cannot access private member `PrivateInstance` of type `Cpp.Private` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+2]]:5-28: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_private_access_denied.carbon:[[@LINE+9]]:5 + // CHECK:STDERR: -> │ instance.PrivateInstance(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `PrivateInstance` of type + // CHECK:STDERR: · │ ┃ `Cpp.Private` + // CHECK:STDERR: · │ ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: · ╰────┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: instance.PrivateInstance(); } } fn Call(var instance: Cpp.Private) { - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+3]]:3-26: error: cannot access private member `PublicStatic` of type `Cpp.Private` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE-45]]:5-28: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_private_access_denied.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ Cpp.Private.PublicStatic(); + // CHECK:STDERR: · ────────────┬─────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Cpp.Private.PublicStatic(); + // CHECK:STDERR: · ━┳━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `PublicStatic` of type `Cpp.Private` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.Private.PublicStatic(); - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+3]]:3-22: error: cannot access private member `PublicStatic` of type `Cpp.Private` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE-49]]:5-28: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_private_access_denied.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ Cpp.Private.PublicStatic(); + // CHECK:STDERR: · ────────────┬─────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Derived.PublicStatic(); + // CHECK:STDERR: · ━┳━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `PublicStatic` of type `Cpp.Private` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Derived.PublicStatic(); - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+3]]:3-29: error: cannot access private member `ProtectedStatic` of type `Cpp.Private` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE-45]]:5-31: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_private_access_denied.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ Cpp.Private.ProtectedStatic(); + // CHECK:STDERR: · ─────────────┬───────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Cpp.Private.ProtectedStatic(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `ProtectedStatic` of type + // CHECK:STDERR: · ┃ `Cpp.Private` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.Private.ProtectedStatic(); - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+3]]:3-25: error: cannot access private member `ProtectedStatic` of type `Cpp.Private` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE-49]]:5-31: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_private_access_denied.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ Cpp.Private.ProtectedStatic(); + // CHECK:STDERR: · ─────────────┬───────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Derived.ProtectedStatic(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `ProtectedStatic` of type + // CHECK:STDERR: · ┃ `Cpp.Private` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Derived.ProtectedStatic(); - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+3]]:3-27: error: cannot access private member `PrivateStatic` of type `Cpp.Private` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE-45]]:5-29: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_private_access_denied.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ Cpp.Private.PrivateStatic(); + // CHECK:STDERR: · ────────────┬──────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Cpp.Private.PrivateStatic(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `PrivateStatic` of type `Cpp.Private` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.Private.PrivateStatic(); - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+3]]:3-23: error: cannot access private member `PrivateStatic` of type `Cpp.Private` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE-49]]:5-29: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_private_access_denied.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ Cpp.Private.PrivateStatic(); + // CHECK:STDERR: · ────────────┬──────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Derived.PrivateStatic(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `PrivateStatic` of type `Cpp.Private` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Derived.PrivateStatic(); - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+3]]:3-25: error: cannot access private member `PublicInstance` of type `Cpp.Private` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE-43]]:5-27: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_private_access_denied.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ instance.PublicInstance(); + // CHECK:STDERR: · ───────────┬─────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ instance.PublicInstance(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `PublicInstance` of type + // CHECK:STDERR: · ┃ `Cpp.Private` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: instance.PublicInstance(); - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+3]]:3-28: error: cannot access private member `ProtectedInstance` of type `Cpp.Private` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE-42]]:5-30: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_private_access_denied.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ instance.ProtectedInstance(); + // CHECK:STDERR: · ─────────────┬──────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ instance.ProtectedInstance(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `ProtectedInstance` of type + // CHECK:STDERR: · ┃ `Cpp.Private` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: instance.ProtectedInstance(); - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE+3]]:3-26: error: cannot access private member `PrivateInstance` of type `Cpp.Private` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_private_access_denied.carbon:[[@LINE-41]]:5-28: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_private_access_denied.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ instance.PrivateInstance(); + // CHECK:STDERR: · ────────────┬─────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ instance.PrivateInstance(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `PrivateInstance` of type + // CHECK:STDERR: · ┃ `Cpp.Private` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: instance.PrivateInstance(); } @@ -1005,62 +1652,150 @@ class Derived { extend base: Cpp.PublicProtected; fn CallStatic() { - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+3]]:5-37: error: cannot access private member `PrivateStatic` of type `Cpp.PublicProtected` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+2]]:5-37: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_public_protected_access_denied.carbon:[[@LINE+9]]:5 + // CHECK:STDERR: -> │ Cpp.PublicProtected.PrivateStatic(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `PrivateStatic` of type + // CHECK:STDERR: · │ ┃ `Cpp.PublicProtected` + // CHECK:STDERR: · │ ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: · ╰────┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.PublicProtected.PrivateStatic(); - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+3]]:5-22: error: cannot access private member `PrivateStatic` of type `Cpp.PublicProtected` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE-2]]:5-37: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_public_protected_access_denied.carbon:[[@LINE+12]]:5 + // CHECK:STDERR: │ Cpp.PublicProtected.PrivateStatic(); + // CHECK:STDERR: · ────────────────┬──────────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Self.PrivateStatic(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `PrivateStatic` of type + // CHECK:STDERR: · ┃ `Cpp.PublicProtected` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Self.PrivateStatic(); } fn CallInstance(var instance: Cpp.PublicProtected) { - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+3]]:5-28: error: cannot access private member `PrivateInstance` of type `Cpp.PublicProtected` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+2]]:5-28: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_public_protected_access_denied.carbon:[[@LINE+9]]:5 + // CHECK:STDERR: -> │ instance.PrivateInstance(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `PrivateInstance` of type + // CHECK:STDERR: · │ ┃ `Cpp.PublicProtected` + // CHECK:STDERR: · │ ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: · ╰────┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: instance.PrivateInstance(); } } fn Call(var instance: Cpp.PublicProtected) { - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+3]]:3-34: error: cannot access protected member `PublicStatic` of type `Cpp.PublicProtected` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+2]]:3-34: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_public_protected_access_denied.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ Cpp.PublicProtected.PublicStatic(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access protected member `PublicStatic` of type + // CHECK:STDERR: · │ ┃ `Cpp.PublicProtected` + // CHECK:STDERR: · │ ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: · ╰────┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.PublicProtected.PublicStatic(); - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+3]]:3-22: error: cannot access protected member `PublicStatic` of type `Derived` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE-2]]:3-34: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_public_protected_access_denied.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ Cpp.PublicProtected.PublicStatic(); + // CHECK:STDERR: · ────────────────┬─────────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Derived.PublicStatic(); + // CHECK:STDERR: · ━━━┳━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access protected member `PublicStatic` of type `Derived` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Derived.PublicStatic(); - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+3]]:3-37: error: cannot access protected member `ProtectedStatic` of type `Cpp.PublicProtected` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+2]]:3-37: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_public_protected_access_denied.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ Cpp.PublicProtected.ProtectedStatic(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access protected member `ProtectedStatic` of type + // CHECK:STDERR: · │ ┃ `Cpp.PublicProtected` + // CHECK:STDERR: · │ ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: · ╰────┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.PublicProtected.ProtectedStatic(); - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+3]]:3-25: error: cannot access protected member `ProtectedStatic` of type `Derived` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE-2]]:3-37: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_public_protected_access_denied.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ Cpp.PublicProtected.ProtectedStatic(); + // CHECK:STDERR: · ─────────────────┬───────────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Derived.ProtectedStatic(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access protected member `ProtectedStatic` of type `Derived` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Derived.ProtectedStatic(); - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+3]]:3-35: error: cannot access private member `PrivateStatic` of type `Cpp.PublicProtected` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE-35]]:5-37: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_public_protected_access_denied.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ Cpp.PublicProtected.PrivateStatic(); + // CHECK:STDERR: · ────────────────┬──────────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Cpp.PublicProtected.PrivateStatic(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `PrivateStatic` of type + // CHECK:STDERR: · ┃ `Cpp.PublicProtected` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.PublicProtected.PrivateStatic(); - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+3]]:3-23: error: cannot access private member `PrivateStatic` of type `Cpp.PublicProtected` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE-39]]:5-37: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_public_protected_access_denied.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ Cpp.PublicProtected.PrivateStatic(); + // CHECK:STDERR: · ────────────────┬──────────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Derived.PrivateStatic(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `PrivateStatic` of type + // CHECK:STDERR: · ┃ `Cpp.PublicProtected` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Derived.PrivateStatic(); - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+3]]:3-25: error: cannot access protected member `PublicInstance` of type `Cpp.PublicProtected` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+2]]:3-25: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_public_protected_access_denied.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ instance.PublicInstance(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access protected member `PublicInstance` of type + // CHECK:STDERR: · │ ┃ `Cpp.PublicProtected` + // CHECK:STDERR: · │ ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: · ╰────┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: instance.PublicInstance(); - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+3]]:3-28: error: cannot access protected member `ProtectedInstance` of type `Cpp.PublicProtected` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+2]]:3-28: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_public_protected_access_denied.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ instance.ProtectedInstance(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access protected member `ProtectedInstance` of type + // CHECK:STDERR: · │ ┃ `Cpp.PublicProtected` + // CHECK:STDERR: · │ ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: · ╰────┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: instance.ProtectedInstance(); - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE+3]]:3-26: error: cannot access private member `PrivateInstance` of type `Cpp.PublicProtected` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_public_protected_access_denied.carbon:[[@LINE-41]]:5-28: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_public_protected_access_denied.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ instance.PrivateInstance(); + // CHECK:STDERR: · ────────────┬─────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ instance.PrivateInstance(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `PrivateInstance` of type + // CHECK:STDERR: · ┃ `Cpp.PublicProtected` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: instance.PrivateInstance(); } @@ -1075,90 +1810,234 @@ class Derived { extend base: Cpp.PublicPrivate; fn CallStatic() { - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+3]]:5-34: error: cannot access private member `PublicStatic` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+2]]:5-34: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_public_private_access_denied.carbon:[[@LINE+9]]:5 + // CHECK:STDERR: -> │ Cpp.PublicPrivate.PublicStatic(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `PublicStatic` of type + // CHECK:STDERR: · │ ┃ `Cpp.PublicPrivate` + // CHECK:STDERR: · │ ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: · ╰────┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.PublicPrivate.PublicStatic(); - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+3]]:5-21: error: cannot access private member `PublicStatic` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE-2]]:5-34: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_public_private_access_denied.carbon:[[@LINE+12]]:5 + // CHECK:STDERR: │ Cpp.PublicPrivate.PublicStatic(); + // CHECK:STDERR: · ───────────────┬────────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Self.PublicStatic(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `PublicStatic` of type + // CHECK:STDERR: · ┃ `Cpp.PublicPrivate` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Self.PublicStatic(); - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+3]]:5-37: error: cannot access private member `ProtectedStatic` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+2]]:5-37: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_public_private_access_denied.carbon:[[@LINE+9]]:5 + // CHECK:STDERR: -> │ Cpp.PublicPrivate.ProtectedStatic(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `ProtectedStatic` of type + // CHECK:STDERR: · │ ┃ `Cpp.PublicPrivate` + // CHECK:STDERR: · │ ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: · ╰────┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.PublicPrivate.ProtectedStatic(); - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+3]]:5-24: error: cannot access private member `ProtectedStatic` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE-2]]:5-37: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_public_private_access_denied.carbon:[[@LINE+12]]:5 + // CHECK:STDERR: │ Cpp.PublicPrivate.ProtectedStatic(); + // CHECK:STDERR: · ────────────────┬──────────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Self.ProtectedStatic(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `ProtectedStatic` of type + // CHECK:STDERR: · ┃ `Cpp.PublicPrivate` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Self.ProtectedStatic(); - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+3]]:5-35: error: cannot access private member `PrivateStatic` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+2]]:5-35: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_public_private_access_denied.carbon:[[@LINE+9]]:5 + // CHECK:STDERR: -> │ Cpp.PublicPrivate.PrivateStatic(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `PrivateStatic` of type + // CHECK:STDERR: · │ ┃ `Cpp.PublicPrivate` + // CHECK:STDERR: · │ ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: · ╰────┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.PublicPrivate.PrivateStatic(); - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+3]]:5-22: error: cannot access private member `PrivateStatic` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE-2]]:5-35: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_public_private_access_denied.carbon:[[@LINE+12]]:5 + // CHECK:STDERR: │ Cpp.PublicPrivate.PrivateStatic(); + // CHECK:STDERR: · ───────────────┬─────────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Self.PrivateStatic(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `PrivateStatic` of type + // CHECK:STDERR: · ┃ `Cpp.PublicPrivate` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Self.PrivateStatic(); } fn CallInstance(var instance: Cpp.PublicPrivate) { - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+3]]:5-27: error: cannot access private member `PublicInstance` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+2]]:5-27: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_public_private_access_denied.carbon:[[@LINE+9]]:5 + // CHECK:STDERR: -> │ instance.PublicInstance(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `PublicInstance` of type + // CHECK:STDERR: · │ ┃ `Cpp.PublicPrivate` + // CHECK:STDERR: · │ ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: · ╰────┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: instance.PublicInstance(); - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+3]]:5-30: error: cannot access private member `ProtectedInstance` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+2]]:5-30: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_public_private_access_denied.carbon:[[@LINE+9]]:5 + // CHECK:STDERR: -> │ instance.ProtectedInstance(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `ProtectedInstance` of type + // CHECK:STDERR: · │ ┃ `Cpp.PublicPrivate` + // CHECK:STDERR: · │ ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: · ╰────┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: instance.ProtectedInstance(); - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+3]]:5-28: error: cannot access private member `PrivateInstance` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+2]]:5-28: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_public_private_access_denied.carbon:[[@LINE+9]]:5 + // CHECK:STDERR: -> │ instance.PrivateInstance(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `PrivateInstance` of type + // CHECK:STDERR: · │ ┃ `Cpp.PublicPrivate` + // CHECK:STDERR: · │ ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: · ╰────┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: instance.PrivateInstance(); } } fn Call(var instance: Cpp.PublicPrivate) { - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+3]]:3-32: error: cannot access private member `PublicStatic` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE-45]]:5-34: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_public_private_access_denied.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ Cpp.PublicPrivate.PublicStatic(); + // CHECK:STDERR: · ───────────────┬────────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Cpp.PublicPrivate.PublicStatic(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `PublicStatic` of type + // CHECK:STDERR: · ┃ `Cpp.PublicPrivate` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.PublicPrivate.PublicStatic(); - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+3]]:3-22: error: cannot access private member `PublicStatic` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE-49]]:5-34: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_public_private_access_denied.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ Cpp.PublicPrivate.PublicStatic(); + // CHECK:STDERR: · ───────────────┬────────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Derived.PublicStatic(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `PublicStatic` of type + // CHECK:STDERR: · ┃ `Cpp.PublicPrivate` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Derived.PublicStatic(); - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+3]]:3-35: error: cannot access private member `ProtectedStatic` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE-45]]:5-37: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_public_private_access_denied.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ Cpp.PublicPrivate.ProtectedStatic(); + // CHECK:STDERR: · ────────────────┬──────────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Cpp.PublicPrivate.ProtectedStatic(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `ProtectedStatic` of type + // CHECK:STDERR: · ┃ `Cpp.PublicPrivate` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.PublicPrivate.ProtectedStatic(); - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+3]]:3-25: error: cannot access private member `ProtectedStatic` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE-49]]:5-37: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_public_private_access_denied.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ Cpp.PublicPrivate.ProtectedStatic(); + // CHECK:STDERR: · ────────────────┬──────────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Derived.ProtectedStatic(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `ProtectedStatic` of type + // CHECK:STDERR: · ┃ `Cpp.PublicPrivate` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Derived.ProtectedStatic(); - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+3]]:3-33: error: cannot access private member `PrivateStatic` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE-45]]:5-35: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_public_private_access_denied.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ Cpp.PublicPrivate.PrivateStatic(); + // CHECK:STDERR: · ───────────────┬─────────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Cpp.PublicPrivate.PrivateStatic(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `PrivateStatic` of type + // CHECK:STDERR: · ┃ `Cpp.PublicPrivate` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.PublicPrivate.PrivateStatic(); - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+3]]:3-23: error: cannot access private member `PrivateStatic` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE-49]]:5-35: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_public_private_access_denied.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ Cpp.PublicPrivate.PrivateStatic(); + // CHECK:STDERR: · ───────────────┬─────────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Derived.PrivateStatic(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `PrivateStatic` of type + // CHECK:STDERR: · ┃ `Cpp.PublicPrivate` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Derived.PrivateStatic(); - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+3]]:3-25: error: cannot access private member `PublicInstance` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE-43]]:5-27: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_public_private_access_denied.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ instance.PublicInstance(); + // CHECK:STDERR: · ───────────┬─────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ instance.PublicInstance(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `PublicInstance` of type + // CHECK:STDERR: · ┃ `Cpp.PublicPrivate` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: instance.PublicInstance(); - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+3]]:3-28: error: cannot access private member `ProtectedInstance` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE-42]]:5-30: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_public_private_access_denied.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ instance.ProtectedInstance(); + // CHECK:STDERR: · ─────────────┬──────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ instance.ProtectedInstance(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `ProtectedInstance` of type + // CHECK:STDERR: · ┃ `Cpp.PublicPrivate` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: instance.ProtectedInstance(); - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE+3]]:3-26: error: cannot access private member `PrivateInstance` of type `Cpp.PublicPrivate` [ClassInvalidMemberAccess] - // CHECK:STDERR: fail_base_class_public_private_access_denied.carbon:[[@LINE-41]]:5-28: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_class_public_private_access_denied.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ instance.PrivateInstance(); + // CHECK:STDERR: · ────────────┬─────────── + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ instance.PrivateInstance(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `PrivateInstance` of type + // CHECK:STDERR: · ┃ `Cpp.PublicPrivate` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: instance.PrivateInstance(); } diff --git a/toolchain/check/testdata/interop/cpp/class/import/base.carbon b/toolchain/check/testdata/interop/cpp/class/import/base.carbon index a2e55aa690c7..aa765e5dc209 100644 --- a/toolchain/check/testdata/interop/cpp/class/import/base.carbon +++ b/toolchain/check/testdata/interop/cpp/class/import/base.carbon @@ -156,71 +156,147 @@ library "[[@TEST_NAME]]"; import Cpp library "multiple_inheritance.h"; fn ConvertA(p: Cpp.C*) -> Cpp.A* { - // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `C*` to `Cpp.A*` [ConversionFailure] - // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.C*` does not implement interface `Core.ImplicitAs(Cpp.A*)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ return p; + // CHECK:STDERR: · ━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `C*` to `Cpp.A*` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Cpp.C*` does not implement interface `Core.ImplicitAs(Cpp.A*)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return p; } fn ConvertB(p: Cpp.C*) -> Cpp.B* { - // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `C*` to `Cpp.B*` [ConversionFailure] - // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.C*` does not implement interface `Core.ImplicitAs(Cpp.B*)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ return p; + // CHECK:STDERR: · ━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `C*` to `Cpp.B*` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Cpp.C*` does not implement interface `Core.ImplicitAs(Cpp.B*)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return p; } fn ConvertOneNonEmptyBaseToEmpty1(p: Cpp.OneNonEmptyBase*) -> Cpp.Empty1* { - // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `OneNonEmptyBase*` to `Cpp.Empty1*` [ConversionFailure] - // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.OneNonEmptyBase*` does not implement interface `Core.ImplicitAs(Cpp.Empty1*)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: -> │ return p; + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `OneNonEmptyBase*` to + // CHECK:STDERR: · │ ┃ `Cpp.Empty1*` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Cpp.OneNonEmptyBase*` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.Empty1*)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return p; } fn ConvertOneNonEmptyBaseToEmpty2(p: Cpp.OneNonEmptyBase*) -> Cpp.Empty2* { - // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `OneNonEmptyBase*` to `Cpp.Empty2*` [ConversionFailure] - // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.OneNonEmptyBase*` does not implement interface `Core.ImplicitAs(Cpp.Empty2*)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: -> │ return p; + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `OneNonEmptyBase*` to + // CHECK:STDERR: · │ ┃ `Cpp.Empty2*` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Cpp.OneNonEmptyBase*` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.Empty2*)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return p; } fn ConvertTwoNonEmptyBasesToA(p: Cpp.TwoNonEmptyBases*) -> Cpp.A* { - // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `TwoNonEmptyBases*` to `Cpp.A*` [ConversionFailure] - // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.TwoNonEmptyBases*` does not implement interface `Core.ImplicitAs(Cpp.A*)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: -> │ return p; + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `TwoNonEmptyBases*` + // CHECK:STDERR: · │ ┃ to `Cpp.A*` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Cpp.TwoNonEmptyBases*` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.A*)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return p; } fn ConvertTwoNonEmptyBasesToB(p: Cpp.TwoNonEmptyBases*) -> Cpp.B* { - // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `TwoNonEmptyBases*` to `Cpp.B*` [ConversionFailure] - // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.TwoNonEmptyBases*` does not implement interface `Core.ImplicitAs(Cpp.B*)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: -> │ return p; + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `TwoNonEmptyBases*` + // CHECK:STDERR: · │ ┃ to `Cpp.B*` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Cpp.TwoNonEmptyBases*` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.B*)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return p; } fn ConvertOnePolymorphicBaseToA(p: Cpp.OnePolymorphicBase*) -> Cpp.A* { - // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `OnePolymorphicBase*` to `Cpp.A*` [ConversionFailure] - // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.OnePolymorphicBase*` does not implement interface `Core.ImplicitAs(Cpp.A*)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: -> │ return p; + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `OnePolymorphicBase*` + // CHECK:STDERR: · │ ┃ to `Cpp.A*` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Cpp.OnePolymorphicBase*` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.A*)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return p; } fn ConvertOnePolymorphicBaseToB(p: Cpp.OnePolymorphicBase*) -> Cpp.B* { - // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `OnePolymorphicBase*` to `Cpp.B*` [ConversionFailure] - // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.OnePolymorphicBase*` does not implement interface `Core.ImplicitAs(Cpp.B*)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: -> │ return p; + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `OnePolymorphicBase*` + // CHECK:STDERR: · │ ┃ to `Cpp.B*` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Cpp.OnePolymorphicBase*` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.B*)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return p; } fn ConvertTwoPolymorphicBasesToPolymorphic1(p: Cpp.TwoPolymorphicBases*) -> Cpp.Polymorphic1* { - // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `TwoPolymorphicBases*` to `Cpp.Polymorphic1*` [ConversionFailure] - // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.TwoPolymorphicBases*` does not implement interface `Core.ImplicitAs(Cpp.Polymorphic1*)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: -> │ return p; + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type + // CHECK:STDERR: · │ ┃ `TwoPolymorphicBases*` to `Cpp.Polymorphic1*` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Cpp.TwoPolymorphicBases*` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.Polymorphic1*)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return p; } fn ConvertTwoPolymorphicBasesToPolymorphic2(p: Cpp.TwoPolymorphicBases*) -> Cpp.Polymorphic2* { - // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `TwoPolymorphicBases*` to `Cpp.Polymorphic2*` [ConversionFailure] - // CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.TwoPolymorphicBases*` does not implement interface `Core.ImplicitAs(Cpp.Polymorphic2*)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: -> │ return p; + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type + // CHECK:STDERR: · │ ┃ `TwoPolymorphicBases*` to `Cpp.Polymorphic2*` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Cpp.TwoPolymorphicBases*` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.Polymorphic2*)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return p; } @@ -268,8 +344,16 @@ library "[[@TEST_NAME]]"; import Cpp library "virtual_inheritance.h"; fn Convert(p: Cpp.VirtB*) -> Cpp.VirtA* { - // CHECK:STDERR: fail_todo_use_virtual_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `VirtB*` to `Cpp.VirtA*` [ConversionFailure] - // CHECK:STDERR: fail_todo_use_virtual_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.VirtB*` does not implement interface `Core.ImplicitAs(Cpp.VirtA*)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_todo_use_virtual_inheritance.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: -> │ return p; + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `VirtB*` to + // CHECK:STDERR: · │ ┃ `Cpp.VirtA*` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Cpp.VirtB*` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.VirtA*)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return p; } @@ -299,57 +383,121 @@ library "[[@TEST_NAME]]"; import Cpp library "diamond.h"; fn ConvertBA(p: Cpp.DiamondB*) -> Cpp.DiamondA* { - // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `DiamondB*` to `Cpp.DiamondA*` [ConversionFailure] - // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+2]]:3-11: note: type `Cpp.DiamondB*` does not implement interface `Core.ImplicitAs(Cpp.DiamondA*)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: -> │ return p; + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `DiamondB*` to + // CHECK:STDERR: · │ ┃ `Cpp.DiamondA*` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Cpp.DiamondB*` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.DiamondA*)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return p; } fn ConvertCA(p: Cpp.DiamondC*) -> Cpp.DiamondA* { - // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `DiamondC*` to `Cpp.DiamondA*` [ConversionFailure] - // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+2]]:3-11: note: type `Cpp.DiamondC*` does not implement interface `Core.ImplicitAs(Cpp.DiamondA*)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: -> │ return p; + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `DiamondC*` to + // CHECK:STDERR: · │ ┃ `Cpp.DiamondA*` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Cpp.DiamondC*` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.DiamondA*)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return p; } fn ConvertDB(p: Cpp.DiamondD*) -> Cpp.DiamondB* { - // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `DiamondD*` to `Cpp.DiamondB*` [ConversionFailure] - // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+2]]:3-11: note: type `Cpp.DiamondD*` does not implement interface `Core.ImplicitAs(Cpp.DiamondB*)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: -> │ return p; + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `DiamondD*` to + // CHECK:STDERR: · │ ┃ `Cpp.DiamondB*` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Cpp.DiamondD*` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.DiamondB*)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return p; } fn ConvertDC(p: Cpp.DiamondD*) -> Cpp.DiamondC* { - // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `DiamondD*` to `Cpp.DiamondC*` [ConversionFailure] - // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+2]]:3-11: note: type `Cpp.DiamondD*` does not implement interface `Core.ImplicitAs(Cpp.DiamondC*)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: -> │ return p; + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `DiamondD*` to + // CHECK:STDERR: · │ ┃ `Cpp.DiamondC*` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Cpp.DiamondD*` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.DiamondC*)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return p; } fn AccessBA(d: Cpp.DiamondD) -> i32 { - // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+3]]:11-27: error: cannot convert expression of type `DiamondD` to `Cpp.DiamondB` with `as` [ConversionFailure] - // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+2]]:11-27: note: type `Cpp.DiamondD` does not implement interface `Core.As(Cpp.DiamondB)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+11]]:11 + // CHECK:STDERR: -> │ return (d as Cpp.DiamondB).b; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `DiamondD` to + // CHECK:STDERR: · │ ┃ `Cpp.DiamondB` with `as` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Cpp.DiamondD` does not implement interface + // CHECK:STDERR: · │ `Core.As(Cpp.DiamondB)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return (d as Cpp.DiamondB).b; } fn AccessCA(d: Cpp.DiamondD) -> i32 { - // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+3]]:11-27: error: cannot convert expression of type `DiamondD` to `Cpp.DiamondC` with `as` [ConversionFailure] - // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+2]]:11-27: note: type `Cpp.DiamondD` does not implement interface `Core.As(Cpp.DiamondC)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+11]]:11 + // CHECK:STDERR: -> │ return (d as Cpp.DiamondC).b; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `DiamondD` to + // CHECK:STDERR: · │ ┃ `Cpp.DiamondC` with `as` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Cpp.DiamondD` does not implement interface + // CHECK:STDERR: · │ `Core.As(Cpp.DiamondC)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return (d as Cpp.DiamondC).b; } fn AccessDB(d: Cpp.DiamondD) -> i32 { - // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+3]]:10-12: error: cannot implicitly convert expression of type `DiamondD` to `Cpp.DiamondB` [ConversionFailure] - // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+2]]:10-12: note: type `Cpp.DiamondD` does not implement interface `Core.ImplicitAs(Cpp.DiamondB)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+11]]:10 + // CHECK:STDERR: -> │ return d.b; + // CHECK:STDERR: · ┳━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `DiamondD` to + // CHECK:STDERR: · │ ┃ `Cpp.DiamondB` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Cpp.DiamondD` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.DiamondB)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return d.b; } fn AccessDC(d: Cpp.DiamondD) -> i32 { - // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+3]]:10-12: error: cannot implicitly convert expression of type `DiamondD` to `Cpp.DiamondC` [ConversionFailure] - // CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+2]]:10-12: note: type `Cpp.DiamondD` does not implement interface `Core.ImplicitAs(Cpp.DiamondC)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+11]]:10 + // CHECK:STDERR: -> │ return d.c; + // CHECK:STDERR: · ┳━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `DiamondD` to + // CHECK:STDERR: · │ ┃ `Cpp.DiamondC` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Cpp.DiamondD` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.DiamondC)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return d.c; } @@ -365,7 +513,13 @@ library "[[@TEST_NAME]]"; import Cpp library "final.h"; class B { - // CHECK:STDERR: fail_derive_from_final.carbon:[[@LINE+2]]:16-25: error: deriving from final type `FinalA`; base type must be an `abstract` or `base` class [BaseIsFinal] + // CHECK:STDERR: ╭─┤ fail_derive_from_final.carbon:[[@LINE+8]]:16 + // CHECK:STDERR: -> │ extend base: Cpp.FinalA; + // CHECK:STDERR: · ┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: deriving from final type `FinalA`; base type must be + // CHECK:STDERR: · ┃ an `abstract` or `base` class + // CHECK:STDERR: · ┃ [BaseIsFinal] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend base: Cpp.FinalA; } @@ -381,7 +535,13 @@ library "[[@TEST_NAME]]"; import Cpp library "union.h"; class V { - // CHECK:STDERR: fail_derive_from_union.carbon:[[@LINE+2]]:16-20: error: deriving from final type `U`; base type must be an `abstract` or `base` class [BaseIsFinal] + // CHECK:STDERR: ╭─┤ fail_derive_from_union.carbon:[[@LINE+8]]:16 + // CHECK:STDERR: -> │ extend base: Cpp.U; + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: deriving from final type `U`; base type must be an + // CHECK:STDERR: · ┃ `abstract` or `base` class + // CHECK:STDERR: · ┃ [BaseIsFinal] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend base: Cpp.U; } diff --git a/toolchain/check/testdata/interop/cpp/class/import/class.carbon b/toolchain/check/testdata/interop/cpp/class/import/class.carbon index 7dea034bdac0..6e63c687ed49 100644 --- a/toolchain/check/testdata/interop/cpp/class/import/class.carbon +++ b/toolchain/check/testdata/interop/cpp/class/import/class.carbon @@ -35,9 +35,19 @@ library "[[@TEST_NAME]]"; import Cpp library "declaration.h"; fn MyF() { - // CHECK:STDERR: fail_use_declaration_as_definition.carbon:[[@LINE+4]]:19-29: error: binding pattern has incomplete type `DeclBar` in name binding declaration [IncompleteTypeInBindingDecl] - // CHECK:STDERR: included from: fail_use_declaration_as_definition.carbon:[[@LINE-4]]:10 [InCppInclude] - // CHECK:STDERR: ./declaration.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ╭─┤ fail_use_declaration_as_definition.carbon:[[@LINE+14]]:19 + // CHECK:STDERR: -> │ var unused bar: Cpp.DeclBar; + // CHECK:STDERR: · ┳━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: binding pattern has incomplete type `DeclBar` in + // CHECK:STDERR: · ┃ name binding declaration + // CHECK:STDERR: · ┃ [IncompleteTypeInBindingDecl] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ ╭── included from: fail_use_declaration_as_definition.carbon [InCppInclude] + // CHECK:STDERR: ├─┤ ./declaration.h + // CHECK:STDERR: │ class DeclBar; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused bar: Cpp.DeclBar; } @@ -231,11 +241,28 @@ class Class1; class Generic(x: Core.Copy) { } -// CHECK:STDERR: fail_copy_witness_of_incomplete_class.carbon:[[@LINE+6]]:19-37: error: argument to C++ call has incomplete type `Cpp.Class1` [IncompleteTypeInCopyWitness] -// CHECK:STDERR: fail_copy_witness_of_incomplete_class.carbon:[[@LINE-7]]:7: note: class was forward declared here [ClassForwardDeclaredHere] -// CHECK:STDERR: fail_copy_witness_of_incomplete_class.carbon:[[@LINE-5]]:15-26: note: initializing generic parameter `x` declared here [InitializingGenericParam] +// CHECK:STDERR: ╭─┤ fail_copy_witness_of_incomplete_class.carbon:[[@LINE+23]]:19 +// CHECK:STDERR: │ class Class1; +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: │ class Generic(x: Core.Copy) { +// CHECK:STDERR: · ──────┬───── +// CHECK:STDERR: · ╰──┤ initializing generic parameter `x` declared here +// CHECK:STDERR: · │ [InitializingGenericParam] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn GenericUse(p2: Generic(Cpp.Class1)) { +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: argument to C++ call has incomplete type +// CHECK:STDERR: · ┃ `Cpp.Class1` +// CHECK:STDERR: · ┃ [IncompleteTypeInCopyWitness] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_copy_witness_of_incomplete_class.carbon:[[@LINE+2]]:15-37: warning: binding `p2` unused [UnusedBinding] +// CHECK:STDERR: ╭─┤ fail_copy_witness_of_incomplete_class.carbon:[[@LINE+6]]:15 +// CHECK:STDERR: -> │ fn GenericUse(p2: Generic(Cpp.Class1)) { +// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ warning: binding `p2` unused [UnusedBinding] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn GenericUse(p2: Generic(Cpp.Class1)) { } diff --git a/toolchain/check/testdata/interop/cpp/class/import/constructor.carbon b/toolchain/check/testdata/interop/cpp/class/import/constructor.carbon index da9d25c1c899..3fb25ef66b41 100644 --- a/toolchain/check/testdata/interop/cpp/class/import/constructor.carbon +++ b/toolchain/check/testdata/interop/cpp/class/import/constructor.carbon @@ -80,8 +80,18 @@ fn G(generic T: Core.Default & Core.Destroy) { } fn CallG() { - // CHECK:STDERR: fail_no_default.carbon:[[@LINE+3]]:3-18: error: cannot convert type `NoDefault` into type implementing `Core.Default & Core.Destroy` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_no_default.carbon:[[@LINE-6]]:14-43: note: initializing generic parameter `T` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_no_default.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn G(generic T: Core.Default & Core.Destroy) { + // CHECK:STDERR: · ──────────────┬─────────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ G(Cpp.NoDefault); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `NoDefault` into type implementing + // CHECK:STDERR: · ┃ `Core.Default & Core.Destroy` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: G(Cpp.NoDefault); } @@ -208,13 +218,33 @@ library "[[@TEST_NAME]]"; import Cpp library "deleted.h"; fn F() { - // CHECK:STDERR: fail_import_deleted.carbon:[[@LINE+3]]:32-52: error: call to deleted function 'DeletedC' [CppInteropParseError] - // CHECK:STDERR: ./deleted.h:4:3: note: candidate constructor has been explicitly deleted [CppInteropParseNote] + // CHECK:STDERR: ╭─┤ fail_import_deleted.carbon:[[@LINE+12]]:32 + // CHECK:STDERR: -> │ let unused c: Cpp.DeletedC = Cpp.DeletedC.DeletedC(); + // CHECK:STDERR: · ━━┳━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: call to deleted function 'DeletedC' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./deleted.h + // CHECK:STDERR: │ DeletedC() = delete; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ candidate constructor has been explicitly deleted [CppInteropParseNote] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused c: Cpp.DeletedC = Cpp.DeletedC.DeletedC(); - // CHECK:STDERR: fail_import_deleted.carbon:[[@LINE+4]]:32-52: error: call to deleted function 'DeletedD' [CppInteropParseError] - // CHECK:STDERR: ./deleted.h:9:3: note: candidate constructor has been explicitly deleted [CppInteropParseNote] - // CHECK:STDERR: ./deleted.h:10:3: note: candidate constructor [CppInteropParseNote] + // CHECK:STDERR: ╭─┤ fail_import_deleted.carbon:[[@LINE+15]]:32 + // CHECK:STDERR: -> │ let unused d: Cpp.DeletedD = Cpp.DeletedD.DeletedD(0); + // CHECK:STDERR: · ━━┳━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: call to deleted function 'DeletedD' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./deleted.h + // CHECK:STDERR: │ DeletedD(int) = delete; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ candidate constructor has been explicitly deleted [CppInteropParseNote] + // CHECK:STDERR: │ DeletedD(short); + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ candidate constructor [CppInteropParseNote] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused d: Cpp.DeletedD = Cpp.DeletedD.DeletedD(0); } @@ -283,9 +313,18 @@ library "[[@TEST_NAME]]"; import Cpp library "incomplete.h"; fn F() { - // CHECK:STDERR: fail_import_incomplete.carbon:[[@LINE+4]]:4-30: error: member access into incomplete class `Cpp.IncompleteC` [QualifiedExprInIncompleteClassScope] - // CHECK:STDERR: included from: fail_import_incomplete.carbon:[[@LINE-4]]:10 [InCppInclude] - // CHECK:STDERR: ./incomplete.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ╭─┤ fail_import_incomplete.carbon:[[@LINE+13]]:4 + // CHECK:STDERR: -> │ Cpp.IncompleteC.IncompleteC(); + // CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: member access into incomplete class `Cpp.IncompleteC` + // CHECK:STDERR: · ┃ [QualifiedExprInIncompleteClassScope] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ ╭── included from: fail_import_incomplete.carbon [InCppInclude] + // CHECK:STDERR: ├─┤ ./incomplete.h + // CHECK:STDERR: │ class IncompleteC; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.IncompleteC.IncompleteC(); } diff --git a/toolchain/check/testdata/interop/cpp/class/import/field.carbon b/toolchain/check/testdata/interop/cpp/class/import/field.carbon index fbb2e9affe01..0a2ed921a20a 100644 --- a/toolchain/check/testdata/interop/cpp/class/import/field.carbon +++ b/toolchain/check/testdata/interop/cpp/class/import/field.carbon @@ -95,11 +95,39 @@ fn GetF(a: Cpp.A) -> i32 { return a.f_4; } struct BitfieldStruct { int a; + // CHECK:STDERR: ╷ ╭── included from: fail_todo_use_bitfields.carbon [InCppInclude] + // CHECK:STDERR: ├─┤ ./with_bitfields.h:[[@LINE+13]]:7 + // CHECK:STDERR: -> │ int b : 2; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: + // CHECK:STDERR: · ┃ `Unsupported: field declaration has unhandled type or kind` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ fail_todo_use_bitfields.carbon + // CHECK:STDERR: │ return s.b; + // CHECK:STDERR: · ─┬─ + // CHECK:STDERR: · ╰──┤ in `Cpp` name lookup for `b` [InCppNameLookup] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: int b : 2; }; union BitfieldUnion { int c; + // CHECK:STDERR: ╷ ╭── included from: fail_todo_use_bitfields.carbon [InCppInclude] + // CHECK:STDERR: ├─┤ ./with_bitfields.h:[[@LINE+13]]:7 + // CHECK:STDERR: -> │ int d : 3; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: + // CHECK:STDERR: · ┃ `Unsupported: field declaration has unhandled type or kind` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ fail_todo_use_bitfields.carbon + // CHECK:STDERR: │ return s.d; + // CHECK:STDERR: · ─┬─ + // CHECK:STDERR: · ╰──┤ in `Cpp` name lookup for `d` [InCppNameLookup] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: int d : 3; }; @@ -125,24 +153,16 @@ fn G(s: Cpp.BitfieldUnion) -> i32 { library "[[@TEST_NAME]]"; -// CHECK:STDERR: included from: fail_todo_use_bitfields.carbon:[[@LINE+2]]:10 [InCppInclude] -// CHECK:STDERR: ./with_bitfields.h:4:7: error: semantics TODO: `Unsupported: field declaration has unhandled type or kind` [SemanticsTodo] import Cpp library "with_bitfields.h"; fn F(s: Cpp.BitfieldStruct) -> i32 { //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_use_bitfields.carbon:[[@LINE+4]]:10-12: note: in `Cpp` name lookup for `b` [InCppNameLookup] - // CHECK:STDERR: - // CHECK:STDERR: included from: fail_todo_use_bitfields.carbon:[[@LINE-6]]:10 [InCppInclude] - // CHECK:STDERR: ./with_bitfields.h:9:7: error: semantics TODO: `Unsupported: field declaration has unhandled type or kind` [SemanticsTodo] return s.b; //@dump-sem-ir-end } fn G(s: Cpp.BitfieldUnion) -> i32 { //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_use_bitfields.carbon:[[@LINE+2]]:10-12: note: in `Cpp` name lookup for `d` [InCppNameLookup] - // CHECK:STDERR: return s.d; //@dump-sem-ir-end } @@ -151,6 +171,22 @@ fn G(s: Cpp.BitfieldUnion) -> i32 { struct UnsupportedMembers { // Volatile is not supported. + // CHECK:STDERR: ╷ ╭── included from: fail_use_unsupported_members.carbon [InCppInclude] + // CHECK:STDERR: ├─┤ ./unsupported_members.h:[[@LINE+15]]:16 + // CHECK:STDERR: -> │ volatile int is_volatile; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: semantics TODO: + // CHECK:STDERR: · ┃ `Unsupported: field declaration has unhandled type or kind` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ fail_use_unsupported_members.carbon + // CHECK:STDERR: │ let unused a: i32 = m->is_volatile; + // CHECK:STDERR: · ───────┬────── + // CHECK:STDERR: · ╰──┤ in `Cpp` name lookup for `is_volatile` + // CHECK:STDERR: · │ [InCppNameLookup] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: volatile int is_volatile; // But this should be fine. int integer; @@ -175,13 +211,9 @@ fn Test(m: Cpp.UnsupportedMembers*) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: included from: fail_use_unsupported_members.carbon:[[@LINE+2]]:10 [InCppInclude] -// CHECK:STDERR: ./unsupported_members.h:4:16: error: semantics TODO: `Unsupported: field declaration has unhandled type or kind` [SemanticsTodo] import Cpp library "unsupported_members.h"; fn Test(m: Cpp.UnsupportedMembers*) { - // CHECK:STDERR: fail_use_unsupported_members.carbon:[[@LINE+2]]:23-36: note: in `Cpp` name lookup for `is_volatile` [InCppNameLookup] - // CHECK:STDERR: let unused a: i32 = m->is_volatile; } diff --git a/toolchain/check/testdata/interop/cpp/class/import/invalid.carbon b/toolchain/check/testdata/interop/cpp/class/import/invalid.carbon index 478762d6afaf..5b28c2d8c245 100644 --- a/toolchain/check/testdata/interop/cpp/class/import/invalid.carbon +++ b/toolchain/check/testdata/interop/cpp/class/import/invalid.carbon @@ -16,7 +16,11 @@ library "[[@TEST_NAME]]"; import Cpp inline ''' struct Base { - // CHECK:STDERR: fail_invalid_base.carbon:[[@LINE+2]]:3: error: unknown type name 'no_such_type' [CppInteropParseError] + // CHECK:STDERR: ╭─┤ fail_invalid_base.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ no_such_type invalid; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: unknown type name 'no_such_type' [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: no_such_type invalid; }; diff --git a/toolchain/check/testdata/interop/cpp/class/import/method.carbon b/toolchain/check/testdata/interop/cpp/class/import/method.carbon index 69f739d0724f..b9fb562e684f 100644 --- a/toolchain/check/testdata/interop/cpp/class/import/method.carbon +++ b/toolchain/check/testdata/interop/cpp/class/import/method.carbon @@ -59,24 +59,67 @@ library "[[@TEST_NAME]]"; import Cpp library "object_param_qualifiers.h"; fn Value(v: Cpp.HasQualifiers) { - // CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+3]]:3-9: error: no matching function for call to 'plain' [CppInteropParseError] - // CHECK:STDERR: ./object_param_qualifiers.h:3:8: note: candidate function not viable: 'this' argument has type 'const HasQualifiers', but method is not marked const [CppInteropParseNote] + // CHECK:STDERR: ╭─┤ fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: -> │ v.plain(); + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'plain' [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./object_param_qualifiers.h + // CHECK:STDERR: │ void plain(); + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ candidate function not viable: 'this' argument has type 'const + // CHECK:STDERR: · │ HasQualifiers', but method is not marked const + // CHECK:STDERR: · │ [CppInteropParseNote] + // CHECK:STDERR: ╰──── // CHECK:STDERR: v.plain(); // TODO: This should remain invalid once we support `volatile`. - // CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+3]]:3-17: error: no matching function for call to 'volatile_this' [CppInteropParseError] - // CHECK:STDERR: ./object_param_qualifiers.h:5:8: note: candidate function not viable: 'this' argument has type 'const HasQualifiers', but method is not marked const [CppInteropParseNote] + // CHECK:STDERR: ╭─┤ fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: -> │ v.volatile_this(); + // CHECK:STDERR: · ━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'volatile_this' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./object_param_qualifiers.h + // CHECK:STDERR: │ void volatile_this() volatile; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ candidate function not viable: 'this' argument has type 'const + // CHECK:STDERR: · │ HasQualifiers', but method is not marked const + // CHECK:STDERR: · │ [CppInteropParseNote] + // CHECK:STDERR: ╰──── // CHECK:STDERR: v.volatile_this(); - // CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+3]]:3-12: error: no matching function for call to 'ref_this' [CppInteropParseError] - // CHECK:STDERR: ./object_param_qualifiers.h:7:8: note: candidate function not viable: 'this' argument has type 'const HasQualifiers', but method is not marked const [CppInteropParseNote] + // CHECK:STDERR: ╭─┤ fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: -> │ v.ref_this(); + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'ref_this' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./object_param_qualifiers.h + // CHECK:STDERR: │ void ref_this() &; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ candidate function not viable: 'this' argument has type 'const + // CHECK:STDERR: · │ HasQualifiers', but method is not marked const + // CHECK:STDERR: · │ [CppInteropParseNote] + // CHECK:STDERR: ╰──── // CHECK:STDERR: v.ref_this(); - // CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+3]]:3-16: error: no matching function for call to 'ref_ref_this' [CppInteropParseError] - // CHECK:STDERR: ./object_param_qualifiers.h:10:8: note: candidate function not viable: 'this' argument has type 'const HasQualifiers', but method is not marked const [CppInteropParseNote] + // CHECK:STDERR: ╭─┤ fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: -> │ v.ref_ref_this(); + // CHECK:STDERR: · ━━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'ref_ref_this' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./object_param_qualifiers.h + // CHECK:STDERR: │ void ref_ref_this() &&; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ candidate function not viable: 'this' argument has type 'const + // CHECK:STDERR: · │ HasQualifiers', but method is not marked const + // CHECK:STDERR: · │ [CppInteropParseNote] + // CHECK:STDERR: ╰──── // CHECK:STDERR: v.ref_ref_this(); } @@ -89,7 +132,13 @@ import Cpp library "object_param_qualifiers.h"; fn Ref(p: Cpp.HasQualifiers*) { // TODO: This should eventually be accepted if we support `volatile`. - // CHECK:STDERR: fail_todo_bad_object_param_qualifiers_by_ref.carbon:[[@LINE+2]]:3-20: error: semantics TODO: `Unsupported: parameter type: volatile struct HasQualifiers &` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_bad_object_param_qualifiers_by_ref.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ p->volatile_this(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: + // CHECK:STDERR: · ┃ `Unsupported: parameter type: volatile struct HasQualifiers &` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: p->volatile_this(); } @@ -101,15 +150,36 @@ library "[[@TEST_NAME]]"; import Cpp library "object_param_qualifiers.h"; fn Ref(p: Cpp.HasQualifiers*) { - // CHECK:STDERR: fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE+4]]:3-17: error: no matching function for call to 'ref_ref_this' [CppInteropParseError] - // CHECK:STDERR: ./object_param_qualifiers.h:10:8: note: candidate function not viable [CppInteropParseNote] - // CHECK:STDERR: ./object_param_qualifiers.h:10:20-21: note: expects an rvalue for object argument [CppInteropParseNoteReason] + // CHECK:STDERR: ╭─┤ fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: -> │ p->ref_ref_this(); + // CHECK:STDERR: · ━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'ref_ref_this' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./object_param_qualifiers.h + // CHECK:STDERR: │ void ref_ref_this() &&; + // CHECK:STDERR: · ┬ ─┬ + // CHECK:STDERR: · ╰───────────────┤ candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: · ╰────┤ expects an rvalue for object argument + // CHECK:STDERR: · │ [CppInteropParseNoteReason] + // CHECK:STDERR: ╰──── // CHECK:STDERR: p->ref_ref_this(); - // CHECK:STDERR: fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE+4]]:3-23: error: no matching function for call to 'const_ref_ref_this' [CppInteropParseError] - // CHECK:STDERR: ./object_param_qualifiers.h:11:8: note: candidate function not viable [CppInteropParseNote] - // CHECK:STDERR: ./object_param_qualifiers.h:11:26-27: note: expects an rvalue for object argument [CppInteropParseNoteReason] + // CHECK:STDERR: ╭─┤ fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE+15]]:3 + // CHECK:STDERR: -> │ p->const_ref_ref_this(); + // CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'const_ref_ref_this' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./object_param_qualifiers.h + // CHECK:STDERR: │ void const_ref_ref_this() const&&; + // CHECK:STDERR: · ┬ ─┬ + // CHECK:STDERR: · ╰─────────────────────┤ candidate function not viable + // CHECK:STDERR: · │ │ [CppInteropParseNote] + // CHECK:STDERR: · ╰────┤ expects an rvalue for object argument + // CHECK:STDERR: · │ [CppInteropParseNoteReason] + // CHECK:STDERR: ╰──── // CHECK:STDERR: p->const_ref_ref_this(); } @@ -123,9 +193,19 @@ import Cpp library "object_param_qualifiers.h"; fn Make() -> Cpp.HasQualifiers; fn F() { - // CHECK:STDERR: fail_bad_object_param_qualifiers_for_temporary.carbon:[[@LINE+4]]:3-17: error: no matching function for call to 'ref_this' [CppInteropParseError] - // CHECK:STDERR: ./object_param_qualifiers.h:7:8: note: candidate function not viable [CppInteropParseNote] - // CHECK:STDERR: ./object_param_qualifiers.h:7:16-17: note: expects an lvalue for object argument [CppInteropParseNoteReason] + // CHECK:STDERR: ╭─┤ fail_bad_object_param_qualifiers_for_temporary.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: -> │ Make().ref_this(); + // CHECK:STDERR: · ━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'ref_this' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./object_param_qualifiers.h + // CHECK:STDERR: │ void ref_this() &; + // CHECK:STDERR: · ┬ ─┬ + // CHECK:STDERR: · ╰───────────┤ candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: · ╰────┤ expects an lvalue for object argument + // CHECK:STDERR: · │ [CppInteropParseNoteReason] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Make().ref_this(); } @@ -200,7 +280,12 @@ struct ExplicitObjectParamUnsupported { '''; fn Call(e: Cpp.ExplicitObjectParamUnsupported) { - // CHECK:STDERR: fail_call_explicit_object_param_with_unsupported_type_param.carbon:[[@LINE+2]]:3-45: error: semantics TODO: `Unsupported: parameter type: _BitInt(23)` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_call_explicit_object_param_with_unsupported_type_param.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ e.(Cpp.ExplicitObjectParamUnsupported.F)(1); + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `Unsupported: parameter type: _BitInt(23)` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: e.(Cpp.ExplicitObjectParamUnsupported.F)(1); } diff --git a/toolchain/check/testdata/interop/cpp/class/import/non_aggregate_init.carbon b/toolchain/check/testdata/interop/cpp/class/import/non_aggregate_init.carbon index 84353542e859..e39ea4e9b0fe 100644 --- a/toolchain/check/testdata/interop/cpp/class/import/non_aggregate_init.carbon +++ b/toolchain/check/testdata/interop/cpp/class/import/non_aggregate_init.carbon @@ -29,8 +29,14 @@ library "[[@TEST_NAME]]"; import Cpp library "non_aggregate.h"; fn Make() { - // CHECK:STDERR: fail_non_aggregate_init.carbon:[[@LINE+3]]:3-14: error: cannot implicitly convert expression of type `{}` to `Cpp.X` [ConversionFailure] - // CHECK:STDERR: fail_non_aggregate_init.carbon:[[@LINE+2]]:3-14: note: type `{}` does not implement interface `Core.ImplicitAs(Cpp.X)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_non_aggregate_init.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ var _: Cpp.X = {}; + // CHECK:STDERR: · ━━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `{}` to `Cpp.X` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `{}` does not implement interface `Core.ImplicitAs(Cpp.X)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var _: Cpp.X = {}; } diff --git a/toolchain/check/testdata/interop/cpp/class/import/override.carbon b/toolchain/check/testdata/interop/cpp/class/import/override.carbon index f957c7dc0cf8..e8bc24bc41ab 100644 --- a/toolchain/check/testdata/interop/cpp/class/import/override.carbon +++ b/toolchain/check/testdata/interop/cpp/class/import/override.carbon @@ -41,10 +41,29 @@ import Cpp library "overload.h"; class Overload0Params { extend base: Cpp.OverloadedBase; // - // CHECK:STDERR: fail_overload_no_matching_arity.carbon:[[@LINE+5]]:3-22: error: override without compatible virtual in base class [OverrideWithoutVirtualInBase] - // CHECK:STDERR: ./overload.h:6:16: note: base class function has more parameters (1 vs 0 excluding `self`) [OverrideCandidateArityMismatch] - // CHECK:STDERR: ./overload.h:7:16: note: base class function has more parameters (1 vs 0 excluding `self`) [OverrideCandidateArityMismatch] - // CHECK:STDERR: ./overload.h:8:16: note: base class function has more parameters (2 vs 0 excluding `self`) [OverrideCandidateArityMismatch] + // CHECK:STDERR: ╭─┤ fail_overload_no_matching_arity.carbon:[[@LINE+24]]:3 + // CHECK:STDERR: -> │ override fn f(self); + // CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: override without compatible virtual in base class + // CHECK:STDERR: · ┃ [OverrideWithoutVirtualInBase] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./overload.h + // CHECK:STDERR: │ virtual void f(X x); + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ base class function has more parameters (1 vs 0 excluding + // CHECK:STDERR: · │ `self`) + // CHECK:STDERR: · │ [OverrideCandidateArityMismatch] + // CHECK:STDERR: │ virtual void f(Y y); + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ base class function has more parameters (1 vs 0 excluding + // CHECK:STDERR: · │ `self`) + // CHECK:STDERR: · │ [OverrideCandidateArityMismatch] + // CHECK:STDERR: │ virtual void f(X x, Y y); + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ base class function has more parameters (2 vs 0 excluding + // CHECK:STDERR: · │ `self`) + // CHECK:STDERR: · │ [OverrideCandidateArityMismatch] + // CHECK:STDERR: ╰──── // CHECK:STDERR: override fn f(self); } @@ -52,10 +71,29 @@ class Overload0Params { class Overload3Params { extend base: Cpp.OverloadedBase; // - // CHECK:STDERR: fail_overload_no_matching_arity.carbon:[[@LINE+5]]:3-52: error: override without compatible virtual in base class [OverrideWithoutVirtualInBase] - // CHECK:STDERR: ./overload.h:6:16: note: base class function has fewer parameters (1 vs 3 excluding `self`) [OverrideCandidateArityMismatch] - // CHECK:STDERR: ./overload.h:7:16: note: base class function has fewer parameters (1 vs 3 excluding `self`) [OverrideCandidateArityMismatch] - // CHECK:STDERR: ./overload.h:8:16: note: base class function has fewer parameters (2 vs 3 excluding `self`) [OverrideCandidateArityMismatch] + // CHECK:STDERR: ╭─┤ fail_overload_no_matching_arity.carbon:[[@LINE+24]]:3 + // CHECK:STDERR: -> │ override fn f(self, x: Cpp.X, y: Cpp.Y, z: Cpp.X); + // CHECK:STDERR: · ━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: override without compatible virtual in base class + // CHECK:STDERR: · ┃ [OverrideWithoutVirtualInBase] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./overload.h + // CHECK:STDERR: │ virtual void f(X x); + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ base class function has fewer parameters (1 vs 3 excluding + // CHECK:STDERR: · │ `self`) + // CHECK:STDERR: · │ [OverrideCandidateArityMismatch] + // CHECK:STDERR: │ virtual void f(Y y); + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ base class function has fewer parameters (1 vs 3 excluding + // CHECK:STDERR: · │ `self`) + // CHECK:STDERR: · │ [OverrideCandidateArityMismatch] + // CHECK:STDERR: │ virtual void f(X x, Y y); + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ base class function has fewer parameters (2 vs 3 excluding + // CHECK:STDERR: · │ `self`) + // CHECK:STDERR: · │ [OverrideCandidateArityMismatch] + // CHECK:STDERR: ╰──── // CHECK:STDERR: override fn f(self, x: Cpp.X, y: Cpp.Y, z: Cpp.X); } @@ -70,14 +108,37 @@ import Cpp library "overload.h"; class OverloadX { extend base: Cpp.OverloadedBase; // - // CHECK:STDERR: fail_overload_type.carbon:[[@LINE+9]]:3-32: error: cannot implicitly convert expression of type `Cpp.Y` to `Cpp.X` [ConversionFailure] - // CHECK:STDERR: fail_overload_type.carbon:[[@LINE+8]]:3-32: note: type `Cpp.Y` does not implement interface `Core.ImplicitAs(Cpp.X)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: fail_overload_type.carbon:[[@LINE+7]]:23-30: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_overload_type.carbon:[[@LINE+32]]:3 + // CHECK:STDERR: -> │ override fn f(self, x: Cpp.X); + // CHECK:STDERR: · ━━━━━━━━━━━━━━━┳━━━━┯━━━━━━━━━ + // CHECK:STDERR: · ┗━━━━━━━┫ error: cannot implicitly convert expression of type + // CHECK:STDERR: · │ │ ┃ `Cpp.Y` to `Cpp.X` + // CHECK:STDERR: · │ │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰─────────┤ type `Cpp.Y` does not implement interface + // CHECK:STDERR: · │ │ `Core.ImplicitAs(Cpp.X)` + // CHECK:STDERR: · │ │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: · ╰──────┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_overload_type.carbon:[[@LINE+5]]:3-32: error: cannot implicitly convert expression of type `Cpp.Y` to `Cpp.X` [ConversionFailure] - // CHECK:STDERR: fail_overload_type.carbon:[[@LINE+4]]:3-32: note: type `Cpp.Y` does not implement interface `Core.ImplicitAs(Cpp.X)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: fail_overload_type.carbon:[[@LINE+3]]:23-30: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: ./overload.h:7:16: note: while building thunk to match the signature of this function [ThunkSignature] + // CHECK:STDERR: ╭─┤ fail_overload_type.carbon:[[@LINE+19]]:3 + // CHECK:STDERR: -> │ override fn f(self, x: Cpp.X); + // CHECK:STDERR: · ━━━━━━━━━━━━━━━┳━━━━┯━━━━━━━━━ + // CHECK:STDERR: · ┗━━━━━━━┫ error: cannot implicitly convert expression of type + // CHECK:STDERR: · │ │ ┃ `Cpp.Y` to `Cpp.X` + // CHECK:STDERR: · │ │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰─────────┤ type `Cpp.Y` does not implement interface + // CHECK:STDERR: · │ │ `Core.ImplicitAs(Cpp.X)` + // CHECK:STDERR: · │ │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: · ╰──────┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./overload.h + // CHECK:STDERR: │ virtual void f(Y y); + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ╰──── // CHECK:STDERR: override fn f(self, x: Cpp.X); } @@ -85,14 +146,37 @@ class OverloadX { class OverloadY { extend base: Cpp.OverloadedBase; // - // CHECK:STDERR: fail_overload_type.carbon:[[@LINE+9]]:3-32: error: cannot implicitly convert expression of type `Cpp.X` to `Cpp.Y` [ConversionFailure] - // CHECK:STDERR: fail_overload_type.carbon:[[@LINE+8]]:3-32: note: type `Cpp.X` does not implement interface `Core.ImplicitAs(Cpp.Y)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: fail_overload_type.carbon:[[@LINE+7]]:23-30: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_overload_type.carbon:[[@LINE+32]]:3 + // CHECK:STDERR: -> │ override fn f(self, y: Cpp.Y); + // CHECK:STDERR: · ━━━━━━━━━━━━━━━┳━━━━┯━━━━━━━━━ + // CHECK:STDERR: · ┗━━━━━━━┫ error: cannot implicitly convert expression of type + // CHECK:STDERR: · │ │ ┃ `Cpp.X` to `Cpp.Y` + // CHECK:STDERR: · │ │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰─────────┤ type `Cpp.X` does not implement interface + // CHECK:STDERR: · │ │ `Core.ImplicitAs(Cpp.Y)` + // CHECK:STDERR: · │ │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: · ╰──────┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_overload_type.carbon:[[@LINE+5]]:3-32: error: cannot implicitly convert expression of type `Cpp.X` to `Cpp.Y` [ConversionFailure] - // CHECK:STDERR: fail_overload_type.carbon:[[@LINE+4]]:3-32: note: type `Cpp.X` does not implement interface `Core.ImplicitAs(Cpp.Y)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: fail_overload_type.carbon:[[@LINE+3]]:23-30: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: ./overload.h:6:16: note: while building thunk to match the signature of this function [ThunkSignature] + // CHECK:STDERR: ╭─┤ fail_overload_type.carbon:[[@LINE+19]]:3 + // CHECK:STDERR: -> │ override fn f(self, y: Cpp.Y); + // CHECK:STDERR: · ━━━━━━━━━━━━━━━┳━━━━┯━━━━━━━━━ + // CHECK:STDERR: · ┗━━━━━━━┫ error: cannot implicitly convert expression of type + // CHECK:STDERR: · │ │ ┃ `Cpp.X` to `Cpp.Y` + // CHECK:STDERR: · │ │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰─────────┤ type `Cpp.X` does not implement interface + // CHECK:STDERR: · │ │ `Core.ImplicitAs(Cpp.Y)` + // CHECK:STDERR: · │ │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: · ╰──────┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./overload.h + // CHECK:STDERR: │ virtual void f(X x); + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ╰──── // CHECK:STDERR: override fn f(self, y: Cpp.Y); } diff --git a/toolchain/check/testdata/interop/cpp/class/import/template.carbon b/toolchain/check/testdata/interop/cpp/class/import/template.carbon index 0319c3d18604..d4ee2bb5475f 100644 --- a/toolchain/check/testdata/interop/cpp/class/import/template.carbon +++ b/toolchain/check/testdata/interop/cpp/class/import/template.carbon @@ -65,10 +65,25 @@ import Cpp library "instantiation_error.h"; //@dump-sem-ir-begin var x: Cpp.XY.r#type = 0; -// CHECK:STDERR: fail_use_instantiation_error.carbon:[[@LINE+5]]:8-22: error: member access into incomplete class `Cpp.X` [QualifiedExprInIncompleteClassScope] -// CHECK:STDERR: included from: fail_use_instantiation_error.carbon:[[@LINE-6]]:10 [InCppInclude] -// CHECK:STDERR: ./instantiation_error.h:3:25: note: type 'int' cannot be used prior to '::' because it has no members [CppInteropParseError] -// CHECK:STDERR: ./instantiation_error.h:2:29: note: in instantiation of template class 'X' requested here [CppInteropParseNote] +// CHECK:STDERR: ╭─┤ fail_use_instantiation_error.carbon:[[@LINE+20]]:8 +// CHECK:STDERR: -> │ var y: Cpp.Xint.r#type = 0; +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: member access into incomplete class `Cpp.X` +// CHECK:STDERR: · ┃ [QualifiedExprInIncompleteClassScope] +// CHECK:STDERR: ┆ +// CHECK:STDERR: │ ╭── included from: fail_use_instantiation_error.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./instantiation_error.h +// CHECK:STDERR: │ template struct X { +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ in instantiation of template class 'X' +// CHECK:STDERR: · │ requested here +// CHECK:STDERR: · │ [CppInteropParseNote] +// CHECK:STDERR: │ using type = typename T::member; +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ type 'int' cannot be used prior to '::' because it +// CHECK:STDERR: · │ has no members +// CHECK:STDERR: · │ [CppInteropParseError] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var y: Cpp.Xint.r#type = 0; //@dump-sem-ir-end @@ -289,11 +304,11 @@ fn G() { // CHECK:STDOUT: %x.var_patt: %pattern_type.d94 = var_pattern %x.patt [concrete = constants.%x.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %y.var: ref %i32 = var_storage %y.var_patt [concrete] -// CHECK:STDOUT: %.loc14: type = splice_block %type.ref.loc14 [concrete = constants.%i32] { -// CHECK:STDOUT: %Cpp.ref.loc14: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %.loc29: type = splice_block %type.ref.loc29 [concrete = constants.%i32] { +// CHECK:STDOUT: %Cpp.ref.loc29: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %Xint.ref: type = name_ref Xint, imports.%X.decl.b67 [concrete = constants.%X.c92] // CHECK:STDOUT: -// CHECK:STDOUT: %type.ref.loc14: type = name_ref r#type, %i32.2 [concrete = constants.%i32] +// CHECK:STDOUT: %type.ref.loc29: type = name_ref r#type, %i32.2 [concrete = constants.%i32] // CHECK:STDOUT: } // CHECK:STDOUT: %y: ref %i32 = wrapper_binding y, %y.var [concrete = %y.var] // CHECK:STDOUT: name_binding_decl { @@ -312,14 +327,14 @@ fn G() { // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc7: init %i32 = call %bound_method.loc7_1.2(%int_0.loc7) [concrete = constants.%int_0.753] // CHECK:STDOUT: %.loc7: init %i32 = converted %int_0.loc7, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc7 [concrete = constants.%int_0.753] // CHECK:STDOUT: assign file.%x.var, %.loc7 -// CHECK:STDOUT: %int_0.loc14: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] -// CHECK:STDOUT: %impl.elem0.loc14: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc14_1.1: = bound_method %int_0.loc14, %impl.elem0.loc14 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] -// CHECK:STDOUT: %specific_fn.loc14: = specific_function %impl.elem0.loc14, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc14_1.2: = bound_method %int_0.loc14, %specific_fn.loc14 [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc14: init %i32 = call %bound_method.loc14_1.2(%int_0.loc14) [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc14: init %i32 = converted %int_0.loc14, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc14 [concrete = constants.%int_0.753] -// CHECK:STDOUT: assign file.%y.var, %.loc14 +// CHECK:STDOUT: %int_0.loc29: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] +// CHECK:STDOUT: %impl.elem0.loc29: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc29_1.1: = bound_method %int_0.loc29, %impl.elem0.loc29 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %specific_fn.loc29: = specific_function %impl.elem0.loc29, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc29_1.2: = bound_method %int_0.loc29, %specific_fn.loc29 [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc29: init %i32 = call %bound_method.loc29_1.2(%int_0.loc29) [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc29: init %i32 = converted %int_0.loc29, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc29 [concrete = constants.%int_0.753] +// CHECK:STDOUT: assign file.%y.var, %.loc29 // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interop/cpp/class/import/union.carbon b/toolchain/check/testdata/interop/cpp/class/import/union.carbon index bf9afea6246e..d43da338ccbc 100644 --- a/toolchain/check/testdata/interop/cpp/class/import/union.carbon +++ b/toolchain/check/testdata/interop/cpp/class/import/union.carbon @@ -35,9 +35,19 @@ library "[[@TEST_NAME]]"; import Cpp library "declaration.h"; fn MyF() { - // CHECK:STDERR: fail_use_declaration_as_definition.carbon:[[@LINE+4]]:19-29: error: binding pattern has incomplete type `DeclBar` in name binding declaration [IncompleteTypeInBindingDecl] - // CHECK:STDERR: included from: fail_use_declaration_as_definition.carbon:[[@LINE-4]]:10 [InCppInclude] - // CHECK:STDERR: ./declaration.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ╭─┤ fail_use_declaration_as_definition.carbon:[[@LINE+14]]:19 + // CHECK:STDERR: -> │ var unused bar: Cpp.DeclBar; + // CHECK:STDERR: · ┳━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: binding pattern has incomplete type `DeclBar` in + // CHECK:STDERR: · ┃ name binding declaration + // CHECK:STDERR: · ┃ [IncompleteTypeInBindingDecl] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ ╭── included from: fail_use_declaration_as_definition.carbon [InCppInclude] + // CHECK:STDERR: ├─┤ ./declaration.h + // CHECK:STDERR: │ union DeclBar; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused bar: Cpp.DeclBar; } diff --git a/toolchain/check/testdata/interop/cpp/const/access.carbon b/toolchain/check/testdata/interop/cpp/const/access.carbon index 7882247a420d..f803933b1c70 100644 --- a/toolchain/check/testdata/interop/cpp/const/access.carbon +++ b/toolchain/check/testdata/interop/cpp/const/access.carbon @@ -37,10 +37,22 @@ const S& Get(); '''; fn F() { - // CHECK:STDERR: fail_const_member_assign.carbon:[[@LINE+5]]:3-13: error: expression is not assignable [AssignmentToNonAssignable] + // CHECK:STDERR: ╭─┤ fail_const_member_assign.carbon:[[@LINE+17]]:3 + // CHECK:STDERR: -> │ Cpp.Get().x = 123; + // CHECK:STDERR: · ━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: expression is not assignable [AssignmentToNonAssignable] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_const_member_assign.carbon:[[@LINE+3]]:3-19: error: cannot implicitly convert expression of type `Core.IntLiteral` to `const i32` [ConversionFailure] - // CHECK:STDERR: fail_const_member_assign.carbon:[[@LINE+2]]:3-19: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(const i32)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_const_member_assign.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: -> │ Cpp.Get().x = 123; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `Core.IntLiteral` to + // CHECK:STDERR: · │ ┃ `const i32` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Core.IntLiteral` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(const i32)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.Get().x = 123; } @@ -57,7 +69,11 @@ const S& Get(); '''; fn F() { - // CHECK:STDERR: fail_const_member_assign_cast.carbon:[[@LINE+2]]:3-13: error: expression is not assignable [AssignmentToNonAssignable] + // CHECK:STDERR: ╭─┤ fail_const_member_assign_cast.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ Cpp.Get().x = 123 as i32; + // CHECK:STDERR: · ━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: expression is not assignable [AssignmentToNonAssignable] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.Get().x = 123 as i32; } diff --git a/toolchain/check/testdata/interop/cpp/enum/convert.carbon b/toolchain/check/testdata/interop/cpp/enum/convert.carbon index dc532a9cba43..7a6eaf0bef09 100644 --- a/toolchain/check/testdata/interop/cpp/enum/convert.carbon +++ b/toolchain/check/testdata/interop/cpp/enum/convert.carbon @@ -39,28 +39,60 @@ library "[[@TEST_NAME]]"; import Cpp library "enum.h"; fn F() { - // CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+3]]:3-18: error: cannot convert expression of type `Cpp.Enum` to `i8` with `as` [ConversionFailure] - // CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+2]]:3-18: note: type `Cpp.Enum` does not implement interface `Core.As(i8)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_wrong_type.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ Cpp.Enum.a as i8; + // CHECK:STDERR: · ━━━━┳━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `Cpp.Enum` to `i8` with `as` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Cpp.Enum` does not implement interface `Core.As(i8)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.Enum.a as i8; - // CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+3]]:3-19: error: cannot convert expression of type `Cpp.Enum` to `i32` with `as` [ConversionFailure] - // CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+2]]:3-19: note: type `Cpp.Enum` does not implement interface `Core.As(i32)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_wrong_type.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ Cpp.Enum.a as i32; + // CHECK:STDERR: · ━━━┳━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `Cpp.Enum` to `i32` with `as` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Cpp.Enum` does not implement interface `Core.As(i32)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.Enum.a as i32; - // CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+3]]:3-24: error: cannot convert expression of type `i8` to `Cpp.Enum` with `as` [ConversionFailure] - // CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+2]]:3-24: note: type `i8` does not implement interface `Core.As(Cpp.Enum)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_wrong_type.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ (42 as i8) as Cpp.Enum; + // CHECK:STDERR: · ━━━━┳━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `i8` to `Cpp.Enum` with `as` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `i8` does not implement interface `Core.As(Cpp.Enum)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: (42 as i8) as Cpp.Enum; - // CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+3]]:3-25: error: cannot convert expression of type `i32` to `Cpp.Enum` with `as` [ConversionFailure] - // CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+2]]:3-25: note: type `i32` does not implement interface `Core.As(Cpp.Enum)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_wrong_type.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ (42 as i32) as Cpp.Enum; + // CHECK:STDERR: · ━━━┳━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `i32` to `Cpp.Enum` with `as` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `i32` does not implement interface `Core.As(Cpp.Enum)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: (42 as i32) as Cpp.Enum; - // CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+3]]:3-28: error: cannot convert expression of type `Cpp.Enum` to `Cpp.DifferentSize` with `as` [ConversionFailure] - // CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+2]]:3-28: note: type `Cpp.Enum` does not implement interface `Core.As(Cpp.DifferentSize)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_wrong_type.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: -> │ Cpp.a as Cpp.DifferentSize; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `Cpp.Enum` to + // CHECK:STDERR: · │ ┃ `Cpp.DifferentSize` with `as` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Cpp.Enum` does not implement interface + // CHECK:STDERR: · │ `Core.As(Cpp.DifferentSize)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.a as Cpp.DifferentSize; } diff --git a/toolchain/check/testdata/interop/cpp/enum/eq.carbon b/toolchain/check/testdata/interop/cpp/enum/eq.carbon index b5be4ce72c83..dc11a94fc56c 100644 --- a/toolchain/check/testdata/interop/cpp/enum/eq.carbon +++ b/toolchain/check/testdata/interop/cpp/enum/eq.carbon @@ -76,8 +76,18 @@ fn CompareGeneric[U: type, T: Core.EqWith(U)](x: T, y: U) -> bool { } fn CompareHeterogeneousFail(x: Cpp.Scoped, y: Cpp.Unscoped) -> bool { - // CHECK:STDERR: fail_heterogeneous.carbon:[[@LINE+3]]:10-29: error: cannot convert type `Cpp.Scoped` into type implementing `Core.EqWith(Cpp.Unscoped)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_heterogeneous.carbon:[[@LINE-6]]:1-67: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_heterogeneous.carbon:[[@LINE+13]]:10 + // CHECK:STDERR: │ fn CompareGeneric[U: type, T: Core.EqWith(U)](x: T, y: U) -> bool { + // CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ return CompareGeneric(x, y); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.Scoped` into type implementing + // CHECK:STDERR: · ┃ `Core.EqWith(Cpp.Unscoped)` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return CompareGeneric(x, y); } diff --git a/toolchain/check/testdata/interop/cpp/enum/incomplete.carbon b/toolchain/check/testdata/interop/cpp/enum/incomplete.carbon index c243f3b488c4..197b77b39cd7 100644 --- a/toolchain/check/testdata/interop/cpp/enum/incomplete.carbon +++ b/toolchain/check/testdata/interop/cpp/enum/incomplete.carbon @@ -15,15 +15,28 @@ // This is not valid in standard C++, but MSVC allows it as an extension, and so // Clang allows it in MSVC compatibility mode. +// CHECK:STDERR: ╷ ╭── included from: import_declaration.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./declaration.h:[[@LINE+15]]:6 +// CHECK:STDERR: -> │ enum UnsizedEnum; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ warning: forward references to 'enum' types are a Microsoft extension +// CHECK:STDERR: · ┃ [CppInteropParseWarning] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: +// CHECK:STDERR: ╷ ╭── included from: fail_use_declaration_as_definition.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./declaration.h:[[@LINE+7]]:6 +// CHECK:STDERR: -> │ enum UnsizedEnum; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ warning: forward references to 'enum' types are a Microsoft extension +// CHECK:STDERR: · ┃ [CppInteropParseWarning] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: enum UnsizedEnum; // --- import_declaration.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: included from: import_declaration.carbon:[[@LINE+3]]:10 [InCppInclude] -// CHECK:STDERR: ./declaration.h:4:6: warning: forward references to 'enum' types are a Microsoft extension [CppInteropParseWarning] -// CHECK:STDERR: import Cpp library "declaration.h"; //@dump-sem-ir-begin @@ -34,17 +47,24 @@ fn F(e: Cpp.UnsizedEnum); library "[[@TEST_NAME]]"; -// CHECK:STDERR: included from: fail_use_declaration_as_definition.carbon:[[@LINE+3]]:10 [InCppInclude] -// CHECK:STDERR: ./declaration.h:4:6: warning: forward references to 'enum' types are a Microsoft extension [CppInteropParseWarning] -// CHECK:STDERR: import Cpp library "declaration.h"; fn MyF() { // TODO: It's a bit surprising to refer to this type as a class, even though // we model it as a class in Carbon. Consider customizing the diagnostic. - // CHECK:STDERR: fail_use_declaration_as_definition.carbon:[[@LINE+4]]:17-31: error: binding pattern has incomplete type `UnsizedEnum` in name binding declaration [IncompleteTypeInBindingDecl] - // CHECK:STDERR: included from: fail_use_declaration_as_definition.carbon:[[@LINE-6]]:10 [InCppInclude] - // CHECK:STDERR: ./declaration.h:4:6: note: class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ╭─┤ fail_use_declaration_as_definition.carbon:[[@LINE+14]]:17 + // CHECK:STDERR: -> │ var unused e: Cpp.UnsizedEnum; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: binding pattern has incomplete type `UnsizedEnum` in + // CHECK:STDERR: · ┃ name binding declaration + // CHECK:STDERR: · ┃ [IncompleteTypeInBindingDecl] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ ╭── included from: fail_use_declaration_as_definition.carbon [InCppInclude] + // CHECK:STDERR: ├─┤ ./declaration.h + // CHECK:STDERR: │ enum UnsizedEnum; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused e: Cpp.UnsizedEnum; } @@ -75,7 +95,7 @@ fn MyF() { // CHECK:STDOUT: %e.patt: %pattern_type = wrapper_binding_pattern e, %e.param_patt [concrete = constants.%e.patt] // CHECK:STDOUT: } { // CHECK:STDOUT: %e.param: %UnsizedEnum = value_param call_param0 -// CHECK:STDOUT: %.loc10: type = splice_block %UnsizedEnum.ref [concrete = constants.%UnsizedEnum] { +// CHECK:STDOUT: %.loc7: type = splice_block %UnsizedEnum.ref [concrete = constants.%UnsizedEnum] { // CHECK:STDOUT: %Cpp.ref: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %UnsizedEnum.ref: type = name_ref UnsizedEnum, imports.%UnsizedEnum.decl [concrete = constants.%UnsizedEnum] // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/interop/cpp/enum/invalid.carbon b/toolchain/check/testdata/interop/cpp/enum/invalid.carbon index 036ee157533e..3f86f1646976 100644 --- a/toolchain/check/testdata/interop/cpp/enum/invalid.carbon +++ b/toolchain/check/testdata/interop/cpp/enum/invalid.carbon @@ -15,7 +15,12 @@ library "[[@TEST_NAME]]"; import Cpp inline ''' -// CHECK:STDERR: fail_invalid_underlying_type.carbon:[[@LINE+2]]:20: error: unknown type name 'no_such_type' [CppInteropParseError] +// CHECK:STDERR: ╭─┤ fail_invalid_underlying_type.carbon:[[@LINE+7]]:20 +// CHECK:STDERR: -> │ enum InvalidEnum : no_such_type {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: unknown type name 'no_such_type' +// CHECK:STDERR: · ┃ [CppInteropParseError] +// CHECK:STDERR: ╰──── // CHECK:STDERR: enum InvalidEnum : no_such_type {}; '''; diff --git a/toolchain/check/testdata/interop/cpp/enum/scoped.carbon b/toolchain/check/testdata/interop/cpp/enum/scoped.carbon index cf011910231a..56c227bf9bc2 100644 --- a/toolchain/check/testdata/interop/cpp/enum/scoped.carbon +++ b/toolchain/check/testdata/interop/cpp/enum/scoped.carbon @@ -33,7 +33,12 @@ library "[[@TEST_NAME]]"; import Cpp library "enum.h"; fn F() { - // CHECK:STDERR: fail_name_without_scope.carbon:[[@LINE+2]]:28-32: error: member name `b` not found in `Cpp` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╭─┤ fail_name_without_scope.carbon:[[@LINE+7]]:28 + // CHECK:STDERR: -> │ let unused b: Cpp.Enum = Cpp.b; + // CHECK:STDERR: · ━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: member name `b` not found in `Cpp` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused b: Cpp.Enum = Cpp.b; } diff --git a/toolchain/check/testdata/interop/cpp/enum/unscoped.carbon b/toolchain/check/testdata/interop/cpp/enum/unscoped.carbon index 3c66c199b681..e0bf6c466412 100644 --- a/toolchain/check/testdata/interop/cpp/enum/unscoped.carbon +++ b/toolchain/check/testdata/interop/cpp/enum/unscoped.carbon @@ -36,13 +36,29 @@ library "[[@TEST_NAME]]"; import Cpp library "enum.h"; fn F() { - // CHECK:STDERR: fail_wrong_enum.carbon:[[@LINE+3]]:29-38: error: cannot implicitly convert expression of type `Cpp.Enum` to `Cpp.Other` [ConversionFailure] - // CHECK:STDERR: fail_wrong_enum.carbon:[[@LINE+2]]:29-38: note: type `Cpp.Enum` does not implement interface `Core.ImplicitAs(Cpp.Other)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_wrong_enum.carbon:[[@LINE+11]]:29 + // CHECK:STDERR: -> │ let unused c: Cpp.Other = Cpp.Enum.c; + // CHECK:STDERR: · ┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of + // CHECK:STDERR: · │ ┃ type `Cpp.Enum` to `Cpp.Other` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Cpp.Enum` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.Other)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused c: Cpp.Other = Cpp.Enum.c; - // CHECK:STDERR: fail_wrong_enum.carbon:[[@LINE+3]]:30-34: error: cannot implicitly convert expression of type `Cpp.Enum` to `Cpp.Other` [ConversionFailure] - // CHECK:STDERR: fail_wrong_enum.carbon:[[@LINE+2]]:30-34: note: type `Cpp.Enum` does not implement interface `Core.ImplicitAs(Cpp.Other)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_wrong_enum.carbon:[[@LINE+11]]:30 + // CHECK:STDERR: -> │ let unused c2: Cpp.Other = Cpp.c; + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of + // CHECK:STDERR: · │ ┃ type `Cpp.Enum` to `Cpp.Other` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Cpp.Enum` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.Other)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused c2: Cpp.Other = Cpp.c; } @@ -54,7 +70,12 @@ library "[[@TEST_NAME]]"; import Cpp library "enum.h"; fn F() { - // CHECK:STDERR: fail_non_enum_member.carbon:[[@LINE+2]]:29-38: error: member name `d` not found in `Cpp.Enum` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╭─┤ fail_non_enum_member.carbon:[[@LINE+7]]:29 + // CHECK:STDERR: -> │ let unused c: Cpp.Other = Cpp.Enum.d; + // CHECK:STDERR: · ━┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: member name `d` not found in `Cpp.Enum` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused c: Cpp.Other = Cpp.Enum.d; } diff --git a/toolchain/check/testdata/interop/cpp/enum/using.carbon b/toolchain/check/testdata/interop/cpp/enum/using.carbon index 0a620675d501..1e16cbb8a67d 100644 --- a/toolchain/check/testdata/interop/cpp/enum/using.carbon +++ b/toolchain/check/testdata/interop/cpp/enum/using.carbon @@ -15,6 +15,14 @@ enum class Color {Red, Blue, Green}; +// CHECK:STDERR: ╷ ╭── included from: import_enum.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./enum.h:[[@LINE+7]]:7 +// CHECK:STDERR: -> │ using enum Color; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ warning: using enum declaration is a C++20 extension +// CHECK:STDERR: · ┃ [CppInteropParseWarning] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: using enum Color; class Zoo { @@ -22,18 +30,20 @@ public: enum class Animal { Cat, Dog, Horse }; }; +// CHECK:STDERR: ╷ ╭── included from: import_enum.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./enum.h:[[@LINE+7]]:7 +// CHECK:STDERR: -> │ using enum Zoo::Animal; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ warning: using enum declaration is a C++20 extension +// CHECK:STDERR: · ┃ [CppInteropParseWarning] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: using enum Zoo::Animal; // --- import_enum.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: included from: import_enum.carbon:[[@LINE+6]]:10 [InCppInclude] -// CHECK:STDERR: ./enum.h:5:7: warning: using enum declaration is a C++20 extension [CppInteropParseWarning] -// CHECK:STDERR: -// CHECK:STDERR: included from: import_enum.carbon:[[@LINE+3]]:10 [InCppInclude] -// CHECK:STDERR: ./enum.h:12:7: warning: using enum declaration is a C++20 extension [CppInteropParseWarning] -// CHECK:STDERR: import Cpp library "enum.h"; //@dump-sem-ir-begin @@ -89,46 +99,46 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Cpp.ref.loc14_32: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %Color.ref.loc14_35: type = name_ref Color, imports.%Color.decl [concrete = constants.%Color] +// CHECK:STDOUT: %Cpp.ref.loc8_32: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %Color.ref.loc8_35: type = name_ref Color, imports.%Color.decl [concrete = constants.%Color] // CHECK:STDOUT: %Red.ref: %Color = name_ref Red, imports.%int_0.59e [concrete = constants.%int_0.59e] -// CHECK:STDOUT: %.loc14: type = splice_block %Color.ref.loc14_23 [concrete = constants.%Color] { -// CHECK:STDOUT: %Cpp.ref.loc14_20: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %Color.ref.loc14_23: type = name_ref Color, imports.%Color.decl [concrete = constants.%Color] +// CHECK:STDOUT: %.loc8: type = splice_block %Color.ref.loc8_23 [concrete = constants.%Color] { +// CHECK:STDOUT: %Cpp.ref.loc8_20: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %Color.ref.loc8_23: type = name_ref Color, imports.%Color.decl [concrete = constants.%Color] // CHECK:STDOUT: } // CHECK:STDOUT: %col: %Color = wrapper_binding col, %Red.ref // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %col.patt: %pattern_type.732 = value_binding_pattern col [concrete = constants.%col.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %Cpp.ref.loc15_33: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %Cpp.ref.loc9_33: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %Blue.ref: %Color = name_ref Blue, imports.%int_1.b76 [concrete = constants.%int_1.b76] -// CHECK:STDOUT: %.loc15: type = splice_block %Color.ref.loc15 [concrete = constants.%Color] { -// CHECK:STDOUT: %Cpp.ref.loc15_21: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %Color.ref.loc15: type = name_ref Color, imports.%Color.decl [concrete = constants.%Color] +// CHECK:STDOUT: %.loc9: type = splice_block %Color.ref.loc9 [concrete = constants.%Color] { +// CHECK:STDOUT: %Cpp.ref.loc9_21: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %Color.ref.loc9: type = name_ref Color, imports.%Color.decl [concrete = constants.%Color] // CHECK:STDOUT: } // CHECK:STDOUT: %colb: %Color = wrapper_binding colb, %Blue.ref // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %colb.patt: %pattern_type.732 = value_binding_pattern colb [concrete = constants.%colb.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %Cpp.ref.loc16_37: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %Zoo.ref.loc16_40: type = name_ref Zoo, imports.%Zoo.decl [concrete = constants.%Zoo] -// CHECK:STDOUT: %Animal.ref.loc16_44: type = name_ref Animal, imports.%Animal.decl [concrete = constants.%Animal] +// CHECK:STDOUT: %Cpp.ref.loc10_37: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %Zoo.ref.loc10_40: type = name_ref Zoo, imports.%Zoo.decl [concrete = constants.%Zoo] +// CHECK:STDOUT: %Animal.ref.loc10_44: type = name_ref Animal, imports.%Animal.decl [concrete = constants.%Animal] // CHECK:STDOUT: %Cat.ref: %Animal = name_ref Cat, imports.%int_0.648 [concrete = constants.%int_0.648] -// CHECK:STDOUT: %.loc16: type = splice_block %Animal.ref.loc16_27 [concrete = constants.%Animal] { -// CHECK:STDOUT: %Cpp.ref.loc16_20: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %Zoo.ref.loc16_23: type = name_ref Zoo, imports.%Zoo.decl [concrete = constants.%Zoo] -// CHECK:STDOUT: %Animal.ref.loc16_27: type = name_ref Animal, imports.%Animal.decl [concrete = constants.%Animal] +// CHECK:STDOUT: %.loc10: type = splice_block %Animal.ref.loc10_27 [concrete = constants.%Animal] { +// CHECK:STDOUT: %Cpp.ref.loc10_20: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %Zoo.ref.loc10_23: type = name_ref Zoo, imports.%Zoo.decl [concrete = constants.%Zoo] +// CHECK:STDOUT: %Animal.ref.loc10_27: type = name_ref Animal, imports.%Animal.decl [concrete = constants.%Animal] // CHECK:STDOUT: } // CHECK:STDOUT: %pet: %Animal = wrapper_binding pet, %Cat.ref // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %pet.patt: %pattern_type.8cd = value_binding_pattern pet [concrete = constants.%pet.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %Cpp.ref.loc17_38: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %Cpp.ref.loc11_38: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %Dog.ref: %Animal = name_ref Dog, imports.%int_1.e7b [concrete = constants.%int_1.e7b] -// CHECK:STDOUT: %.loc17: type = splice_block %Animal.ref.loc17 [concrete = constants.%Animal] { -// CHECK:STDOUT: %Cpp.ref.loc17_21: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %Zoo.ref.loc17: type = name_ref Zoo, imports.%Zoo.decl [concrete = constants.%Zoo] -// CHECK:STDOUT: %Animal.ref.loc17: type = name_ref Animal, imports.%Animal.decl [concrete = constants.%Animal] +// CHECK:STDOUT: %.loc11: type = splice_block %Animal.ref.loc11 [concrete = constants.%Animal] { +// CHECK:STDOUT: %Cpp.ref.loc11_21: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %Zoo.ref.loc11: type = name_ref Zoo, imports.%Zoo.decl [concrete = constants.%Zoo] +// CHECK:STDOUT: %Animal.ref.loc11: type = name_ref Animal, imports.%Animal.decl [concrete = constants.%Animal] // CHECK:STDOUT: } // CHECK:STDOUT: %pet2: %Animal = wrapper_binding pet2, %Dog.ref // CHECK:STDOUT: name_binding_decl { diff --git a/toolchain/check/testdata/interop/cpp/function/export/array.carbon b/toolchain/check/testdata/interop/cpp/function/export/array.carbon index 9b5694460130..dcdb13fdc1aa 100644 --- a/toolchain/check/testdata/interop/cpp/function/export/array.carbon +++ b/toolchain/check/testdata/interop/cpp/function/export/array.carbon @@ -43,21 +43,49 @@ import Cpp; // HLSL extension, or by mapping to a `std::array` parameter. // TODO: These diagnostics are very bad. -// CHECK:STDERR: fail_todo_array_var_param.carbon:[[@LINE+4]]:1-48: error: semantics TODO: `by-var array parameter` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_todo_array_var_param.carbon:[[@LINE+14]]:1 +// CHECK:STDERR: -> │ fn FArrayVarParam(var a: array(i32, 5)) -> i32 { return a[2]; } +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `by-var array parameter` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_todo_array_var_param.carbon:[[@LINE+2]]:1-48: error: semantics TODO: `failed to map C++ type to Carbon` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_todo_array_var_param.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn FArrayVarParam(var a: array(i32, 5)) -> i32 { return a[2]; } +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `failed to map C++ type to Carbon` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn FArrayVarParam(var a: array(i32, 5)) -> i32 { return a[2]; } inline Cpp ''' int GArrayVarParam() { //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_array_var_param.carbon:[[@LINE+7]]:10: error: no member named 'FArrayVarParam' in namespace 'Carbon'; did you mean 'GArrayVarParam'? [CppInteropParseError] - // CHECK:STDERR: fail_todo_array_var_param.carbon:[[@LINE+6]]:10-31: note: replace with `GArrayVarParam` [CppInteropFixItReplacement] - // CHECK:STDERR: fail_todo_array_var_param.carbon:[[@LINE-4]]:5: note: 'GArrayVarParam' declared here [CppInteropParseNote] + // CHECK:STDERR: ╭─┤ fail_todo_array_var_param.carbon:[[@LINE+25]]:10 + // CHECK:STDERR: │ int GArrayVarParam() { + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ 'GArrayVarParam' declared here [CppInteropParseNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ return Carbon::FArrayVarParam({1, 2, 3, 4, 5}); + // CHECK:STDERR: · ┳───────────────────── + // CHECK:STDERR: · ┗━━┫ error: no member named 'FArrayVarParam' in namespace 'Carbon'; did + // CHECK:STDERR: · │ ┃ you mean 'GArrayVarParam'? + // CHECK:STDERR: · │ ┃ [CppInteropParseError] + // CHECK:STDERR: · ╰────┤ replace with `GArrayVarParam` [CppInteropFixItReplacement] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_todo_array_var_param.carbon:[[@LINE+3]]:33-47: error: too many arguments to function call, expected 0, have 1 [CppInteropParseError] - // CHECK:STDERR: fail_todo_array_var_param.carbon:[[@LINE-7]]:5: note: 'GArrayVarParam' declared here [CppInteropParseNote] + // CHECK:STDERR: ╭─┤ fail_todo_array_var_param.carbon:[[@LINE+12]]:33 + // CHECK:STDERR: │ int GArrayVarParam() { + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ 'GArrayVarParam' declared here [CppInteropParseNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ return Carbon::FArrayVarParam({1, 2, 3, 4, 5}); + // CHECK:STDERR: · ────────────── ┳━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: too many arguments to function call, + // CHECK:STDERR: · ┃ expected 0, have 1 + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return Carbon::FArrayVarParam({1, 2, 3, 4, 5}); //@dump-sem-ir-end @@ -73,7 +101,12 @@ import Cpp; // types, as C++ does not have such return types. // TODO: Support this, perhaps by returning a `std::array`. -// CHECK:STDERR: fail_todo_array_return.carbon:[[@LINE+2]]:1-36: error: semantics TODO: `array return type` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_todo_array_return.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn FArrayReturn() -> array(i32, 5) { +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `array return type` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn FArrayReturn() -> array(i32, 5) { return (1, 2, 3, 4, 5); @@ -81,12 +114,26 @@ fn FArrayReturn() -> array(i32, 5) { inline Cpp ''' int GArrayReturn() { - // CHECK:STDERR: fail_todo_array_return.carbon:[[@LINE+4]]:16: error: no member named 'FArrayReturn' in namespace 'Carbon'; did you mean 'GArrayReturn'? [CppInteropParseError] - // CHECK:STDERR: fail_todo_array_return.carbon:[[@LINE+3]]:16-35: note: replace with `GArrayReturn` [CppInteropFixItReplacement] - // CHECK:STDERR: fail_todo_array_return.carbon:[[@LINE-3]]:5: note: 'GArrayReturn' declared here [CppInteropParseNote] + // CHECK:STDERR: ╭─┤ fail_todo_array_return.carbon:[[@LINE+13]]:16 + // CHECK:STDERR: │ int GArrayReturn() { + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ 'GArrayReturn' declared here [CppInteropParseNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ auto &&arr = Carbon::FArrayReturn(); + // CHECK:STDERR: · ┳─────────────────── + // CHECK:STDERR: · ┗━━┫ error: no member named 'FArrayReturn' in namespace 'Carbon'; + // CHECK:STDERR: · │ ┃ did you mean 'GArrayReturn'? + // CHECK:STDERR: · │ ┃ [CppInteropParseError] + // CHECK:STDERR: · ╰────┤ replace with `GArrayReturn` [CppInteropFixItReplacement] + // CHECK:STDERR: ╰──── // CHECK:STDERR: auto &&arr = Carbon::FArrayReturn(); - // CHECK:STDERR: fail_todo_array_return.carbon:[[@LINE+2]]:13: error: subscripted value is not an array, pointer, or vector [CppInteropParseError] + // CHECK:STDERR: ╭─┤ fail_todo_array_return.carbon:[[@LINE+7]]:13 + // CHECK:STDERR: -> │ return arr[0]; + // CHECK:STDERR: · ──╴╻╶ + // CHECK:STDERR: · ┗━━┫ error: subscripted value is not an array, pointer, or vector + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return arr[0]; } diff --git a/toolchain/check/testdata/interop/cpp/function/export/constructor.carbon b/toolchain/check/testdata/interop/cpp/function/export/constructor.carbon index e60fbd000695..dbae6bd9f8c6 100644 --- a/toolchain/check/testdata/interop/cpp/function/export/constructor.carbon +++ b/toolchain/check/testdata/interop/cpp/function/export/constructor.carbon @@ -36,10 +36,29 @@ class FactoryIsMethod { inline Cpp ''' void CallFactoryIsMethod() { - // CHECK:STDERR: fail_factory_is_method.carbon:[[@LINE+5]]:27: error: no matching constructor for initialization of 'Carbon::FactoryIsMethod' (aka 'Carbon::Main::FactoryIsMethod') [CppInteropParseError] - // CHECK:STDERR: fail_factory_is_method.carbon:[[@LINE-7]]:23: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const FactoryIsMethod' for 1st argument [CppInteropParseNote] - // CHECK:STDERR: fail_factory_is_method.carbon:[[@LINE-8]]:23: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'int' to 'FactoryIsMethod' for 1st argument [CppInteropParseNote] - // CHECK:STDERR: fail_factory_is_method.carbon:[[@LINE-9]]:23: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided [CppInteropParseNote] + // CHECK:STDERR: ╭─┤ fail_factory_is_method.carbon:[[@LINE+24]]:27 + // CHECK:STDERR: │ class FactoryIsMethod { + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ candidate constructor (the implicit copy constructor) + // CHECK:STDERR: · │ │ not viable: no known conversion from 'int' to 'const + // CHECK:STDERR: · │ │ FactoryIsMethod' for 1st argument + // CHECK:STDERR: · │ │ [CppInteropParseNote] + // CHECK:STDERR: · ╰────┤ candidate constructor (the implicit move + // CHECK:STDERR: · │ │ constructor) not viable: no known conversion from + // CHECK:STDERR: · │ │ 'int' to 'FactoryIsMethod' for 1st argument + // CHECK:STDERR: · │ │ [CppInteropParseNote] + // CHECK:STDERR: · ╰──────┤ candidate constructor (the implicit default + // CHECK:STDERR: · │ constructor) not viable: requires 0 arguments, + // CHECK:STDERR: · │ but 1 was provided + // CHECK:STDERR: · │ [CppInteropParseNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Carbon::FactoryIsMethod a(42); + // CHECK:STDERR: · ┳ ── + // CHECK:STDERR: · ┗━━┫ error: no matching constructor for initialization + // CHECK:STDERR: · ┃ of 'Carbon::FactoryIsMethod' (aka + // CHECK:STDERR: · ┃ 'Carbon::Main::FactoryIsMethod') + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Carbon::FactoryIsMethod a(42); } @@ -56,10 +75,32 @@ class FactoryDoesntReturnSelf { inline Cpp ''' void CallFactoryDoesntReturnSelf() { - // CHECK:STDERR: fail_factory_doesnt_return_self.carbon:[[@LINE+5]]:35: error: no matching constructor for initialization of 'Carbon::FactoryDoesntReturnSelf' (aka 'Carbon::Main::FactoryDoesntReturnSelf') [CppInteropParseError] - // CHECK:STDERR: fail_factory_doesnt_return_self.carbon:[[@LINE-7]]:31: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const FactoryDoesntReturnSelf' for 1st argument [CppInteropParseNote] - // CHECK:STDERR: fail_factory_doesnt_return_self.carbon:[[@LINE-8]]:31: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'int' to 'FactoryDoesntReturnSelf' for 1st argument [CppInteropParseNote] - // CHECK:STDERR: fail_factory_doesnt_return_self.carbon:[[@LINE-9]]:31: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided [CppInteropParseNote] + // CHECK:STDERR: ╭─┤ fail_factory_doesnt_return_self.carbon:[[@LINE+27]]:35 + // CHECK:STDERR: │ class FactoryDoesntReturnSelf { + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ candidate constructor (the implicit copy + // CHECK:STDERR: · │ │ constructor) not viable: no known conversion + // CHECK:STDERR: · │ │ from 'int' to 'const FactoryDoesntReturnSelf' + // CHECK:STDERR: · │ │ for 1st argument + // CHECK:STDERR: · │ │ [CppInteropParseNote] + // CHECK:STDERR: · ╰────┤ candidate constructor (the implicit move + // CHECK:STDERR: · │ │ constructor) not viable: no known + // CHECK:STDERR: · │ │ conversion from 'int' to + // CHECK:STDERR: · │ │ 'FactoryDoesntReturnSelf' for 1st argument + // CHECK:STDERR: · │ │ [CppInteropParseNote] + // CHECK:STDERR: · ╰──────┤ candidate constructor (the implicit + // CHECK:STDERR: · │ default constructor) not viable: requires + // CHECK:STDERR: · │ 0 arguments, but 1 was provided + // CHECK:STDERR: · │ [CppInteropParseNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Carbon::FactoryDoesntReturnSelf a(42); + // CHECK:STDERR: · ┳ ── + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: no matching constructor for initialization of + // CHECK:STDERR: · ┃ 'Carbon::FactoryDoesntReturnSelf' (aka + // CHECK:STDERR: · ┃ 'Carbon::Main::FactoryDoesntReturnSelf') + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Carbon::FactoryDoesntReturnSelf a(42); } @@ -76,10 +117,32 @@ class FactoryReturnsByRef { inline Cpp ''' void CallFactoryReturnsByRef() { - // CHECK:STDERR: fail_factory_returns_by_ref.carbon:[[@LINE+5]]:31: error: no matching constructor for initialization of 'Carbon::FactoryReturnsByRef' (aka 'Carbon::Main::FactoryReturnsByRef') [CppInteropParseError] - // CHECK:STDERR: fail_factory_returns_by_ref.carbon:[[@LINE-7]]:27: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const FactoryReturnsByRef' for 1st argument [CppInteropParseNote] - // CHECK:STDERR: fail_factory_returns_by_ref.carbon:[[@LINE-8]]:27: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'int' to 'FactoryReturnsByRef' for 1st argument [CppInteropParseNote] - // CHECK:STDERR: fail_factory_returns_by_ref.carbon:[[@LINE-9]]:27: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided [CppInteropParseNote] + // CHECK:STDERR: ╭─┤ fail_factory_returns_by_ref.carbon:[[@LINE+27]]:31 + // CHECK:STDERR: │ class FactoryReturnsByRef { + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ candidate constructor (the implicit copy + // CHECK:STDERR: · │ │ constructor) not viable: no known conversion from + // CHECK:STDERR: · │ │ 'int' to 'const FactoryReturnsByRef' for 1st + // CHECK:STDERR: · │ │ argument + // CHECK:STDERR: · │ │ [CppInteropParseNote] + // CHECK:STDERR: · ╰────┤ candidate constructor (the implicit move + // CHECK:STDERR: · │ │ constructor) not viable: no known conversion + // CHECK:STDERR: · │ │ from 'int' to 'FactoryReturnsByRef' for 1st + // CHECK:STDERR: · │ │ argument + // CHECK:STDERR: · │ │ [CppInteropParseNote] + // CHECK:STDERR: · ╰──────┤ candidate constructor (the implicit default + // CHECK:STDERR: · │ constructor) not viable: requires 0 + // CHECK:STDERR: · │ arguments, but 1 was provided + // CHECK:STDERR: · │ [CppInteropParseNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Carbon::FactoryReturnsByRef a(42); + // CHECK:STDERR: · ┳ ── + // CHECK:STDERR: · ┗━━┫ error: no matching constructor for + // CHECK:STDERR: · ┃ initialization of + // CHECK:STDERR: · ┃ 'Carbon::FactoryReturnsByRef' (aka + // CHECK:STDERR: · ┃ 'Carbon::Main::FactoryReturnsByRef') + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Carbon::FactoryReturnsByRef a(42); } @@ -91,7 +154,12 @@ library "[[@TEST_NAME]]"; import Cpp; class GenericConstructor { - // CHECK:STDERR: fail_todo_call_generic_constructor.carbon:[[@LINE+2]]:3-48: error: semantics TODO: `support exporting generic member functions` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_call_generic_constructor.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ fn GenericConstructor[T: type](_: T) -> Self { + // CHECK:STDERR: · ━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `support exporting generic member functions` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn GenericConstructor[T: type](_: T) -> Self { return {}; @@ -100,10 +168,32 @@ class GenericConstructor { inline Cpp ''' void CallGenericConstructor() { - // CHECK:STDERR: fail_todo_call_generic_constructor.carbon:[[@LINE+5]]:30: error: no matching constructor for initialization of 'Carbon::GenericConstructor' (aka 'Carbon::Main::GenericConstructor') [CppInteropParseError] - // CHECK:STDERR: fail_todo_call_generic_constructor.carbon:[[@LINE-11]]:26: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const GenericConstructor' for 1st argument [CppInteropParseNote] - // CHECK:STDERR: fail_todo_call_generic_constructor.carbon:[[@LINE-12]]:26: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'int' to 'GenericConstructor' for 1st argument [CppInteropParseNote] - // CHECK:STDERR: fail_todo_call_generic_constructor.carbon:[[@LINE-13]]:26: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided [CppInteropParseNote] + // CHECK:STDERR: ╭─┤ fail_todo_call_generic_constructor.carbon:[[@LINE+27]]:30 + // CHECK:STDERR: │ class GenericConstructor { + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ candidate constructor (the implicit copy + // CHECK:STDERR: · │ │ constructor) not viable: no known conversion from + // CHECK:STDERR: · │ │ 'int' to 'const GenericConstructor' for 1st + // CHECK:STDERR: · │ │ argument + // CHECK:STDERR: · │ │ [CppInteropParseNote] + // CHECK:STDERR: · ╰────┤ candidate constructor (the implicit move + // CHECK:STDERR: · │ │ constructor) not viable: no known conversion + // CHECK:STDERR: · │ │ from 'int' to 'GenericConstructor' for 1st + // CHECK:STDERR: · │ │ argument + // CHECK:STDERR: · │ │ [CppInteropParseNote] + // CHECK:STDERR: · ╰──────┤ candidate constructor (the implicit default + // CHECK:STDERR: · │ constructor) not viable: requires 0 arguments, + // CHECK:STDERR: · │ but 1 was provided + // CHECK:STDERR: · │ [CppInteropParseNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Carbon::GenericConstructor b(0); + // CHECK:STDERR: · ┳ ─ + // CHECK:STDERR: · ┗━━┫ error: no matching constructor for + // CHECK:STDERR: · ┃ initialization of + // CHECK:STDERR: · ┃ 'Carbon::GenericConstructor' (aka + // CHECK:STDERR: · ┃ 'Carbon::Main::GenericConstructor') + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Carbon::GenericConstructor b(0); } @@ -115,7 +205,12 @@ library "[[@TEST_NAME]]"; import Cpp; class GenericClass(T: type) { - // CHECK:STDERR: fail_todo_call_generic_class_constructor.carbon:[[@LINE+2]]:3-33: error: semantics TODO: `non-class non-namespace name scope` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_call_generic_class_constructor.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ fn GenericClass(_: T) -> Self { + // CHECK:STDERR: · ━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `non-class non-namespace name scope` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn GenericClass(_: T) -> Self { return {}; @@ -124,10 +219,31 @@ class GenericClass(T: type) { inline Cpp ''' void CallGenericClass() { - // CHECK:STDERR: fail_todo_call_generic_class_constructor.carbon:[[@LINE+5]]:29: error: no matching constructor for initialization of 'Carbon::GenericClass' [CppInteropParseError] - // CHECK:STDERR: fail_todo_call_generic_class_constructor.carbon:[[@LINE-11]]:29: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const GenericClass' for 1st argument [CppInteropParseNote] - // CHECK:STDERR: fail_todo_call_generic_class_constructor.carbon:[[@LINE-12]]:29: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'int' to 'GenericClass' for 1st argument [CppInteropParseNote] - // CHECK:STDERR: fail_todo_call_generic_class_constructor.carbon:[[@LINE-13]]:29: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided [CppInteropParseNote] + // CHECK:STDERR: ╭─┤ fail_todo_call_generic_class_constructor.carbon:[[@LINE+26]]:29 + // CHECK:STDERR: │ class GenericClass(T: type) { + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ candidate constructor (the implicit copy + // CHECK:STDERR: · │ │ constructor) not viable: no known conversion + // CHECK:STDERR: · │ │ from 'int' to 'const GenericClass' for 1st + // CHECK:STDERR: · │ │ argument + // CHECK:STDERR: · │ │ [CppInteropParseNote] + // CHECK:STDERR: · ╰────┤ candidate constructor (the implicit move + // CHECK:STDERR: · │ │ constructor) not viable: no known conversion + // CHECK:STDERR: · │ │ from 'int' to 'GenericClass' for 1st + // CHECK:STDERR: · │ │ argument + // CHECK:STDERR: · │ │ [CppInteropParseNote] + // CHECK:STDERR: · ╰──────┤ candidate constructor (the implicit default + // CHECK:STDERR: · │ constructor) not viable: requires 0 + // CHECK:STDERR: · │ arguments, but 1 was provided + // CHECK:STDERR: · │ [CppInteropParseNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Carbon::GenericClass c(0); + // CHECK:STDERR: · ┳ ─ + // CHECK:STDERR: · ┗━━┫ error: no matching constructor for + // CHECK:STDERR: · ┃ initialization of + // CHECK:STDERR: · ┃ 'Carbon::GenericClass' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Carbon::GenericClass c(0); } diff --git a/toolchain/check/testdata/interop/cpp/function/export/function.carbon b/toolchain/check/testdata/interop/cpp/function/export/function.carbon index 95e136ae487d..ac7914f717ce 100644 --- a/toolchain/check/testdata/interop/cpp/function/export/function.carbon +++ b/toolchain/check/testdata/interop/cpp/function/export/function.carbon @@ -89,16 +89,21 @@ void CallUsingF() { UsingF(); } // --- other_generic.carbon package OtherGeneric; +// CHECK:STDERR: ╷ ╭── imported from: fail_todo_generic.carbon [InImport] +// CHECK:STDERR: ├─┤ other_generic.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ fn HasGenericArg(generic T: type, a: T) { a; } +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: 1 argument passed to function expecting 2 arguments +// CHECK:STDERR: · │ ┃ [CallArgCountMismatch] +// CHECK:STDERR: · ╰────┤ calling function declared here [InCallToEntity] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: fn HasGenericArg(generic T: type, a: T) { a; } // --- fail_todo_generic.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: imported from: fail_todo_generic.carbon:[[@LINE+4]]:1 [InImport] -// CHECK:STDERR: other_generic.carbon:3:1-41: error: 1 argument passed to function expecting 2 arguments [CallArgCountMismatch] -// CHECK:STDERR: other_generic.carbon:3:1-41: note: calling function declared here [InCallToEntity] -// CHECK:STDERR: import OtherGeneric; import Cpp inline ''' void CallHasGenericArg() { diff --git a/toolchain/check/testdata/interop/cpp/function/export/generic.carbon b/toolchain/check/testdata/interop/cpp/function/export/generic.carbon index cff7c77c0e88..f2c99edbe286 100644 --- a/toolchain/check/testdata/interop/cpp/function/export/generic.carbon +++ b/toolchain/check/testdata/interop/cpp/function/export/generic.carbon @@ -75,15 +75,29 @@ Carbon::B CallInterfaceF() { library "[[@TEST_NAME]]"; import Cpp; -// CHECK:STDERR: fail_todo_non_type_generic.carbon:[[@LINE+2]]:1-30: error: semantics TODO: `binding maps to a non-type template parameter` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_todo_non_type_generic.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn NonTypeF[unused N: i32]() {} +// CHECK:STDERR: · ━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `binding maps to a non-type template parameter` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn NonTypeF[unused N: i32]() {} inline Cpp ''' void CallNonTypeF() { - // CHECK:STDERR: fail_todo_non_type_generic.carbon:[[@LINE+4]]:11-18: error: no member named 'NonTypeF' in namespace 'Carbon' [CppInteropParseError] + // CHECK:STDERR: ╭─┤ fail_todo_non_type_generic.carbon:[[@LINE+13]]:11 + // CHECK:STDERR: -> │ Carbon::NonTypeF<3>(); + // CHECK:STDERR: · ━━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: no member named 'NonTypeF' in namespace 'Carbon' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_todo_non_type_generic.carbon:[[@LINE+2]]:23: error: expected expression [CppInteropParseError] + // CHECK:STDERR: ╭─┤ fail_todo_non_type_generic.carbon:[[@LINE+6]]:23 + // CHECK:STDERR: -> │ Carbon::NonTypeF<3>(); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected expression [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Carbon::NonTypeF<3>(); } @@ -108,7 +122,12 @@ library "[[@TEST_NAME]]"; import Cpp; class EnclosingA(T: type) { - // CHECK:STDERR: fail_todo_enclosing_generic.carbon:[[@LINE+2]]:3-34: error: semantics TODO: `non-class non-namespace name scope` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_enclosing_generic.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ fn MemberF[U: type](x: T, y: U); + // CHECK:STDERR: · ━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `non-class non-namespace name scope` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn MemberF[U: type](x: T, y: U); } @@ -120,7 +139,12 @@ void CallEnclosingF() { // is to test a generic function within an enclosing generic scope. // Carbon::EnclosingB b; - // CHECK:STDERR: fail_todo_enclosing_generic.carbon:[[@LINE+2]]:5: error: no member named 'MemberF' in 'Carbon::Main::EnclosingA' [CppInteropParseError] + // CHECK:STDERR: ╭─┤ fail_todo_enclosing_generic.carbon:[[@LINE+7]]:5 + // CHECK:STDERR: -> │ b.MemberF(1, 2); + // CHECK:STDERR: · ─ ┳ + // CHECK:STDERR: · ┗━━┫ error: no member named 'MemberF' in 'Carbon::Main::EnclosingA' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: b.MemberF(1, 2); } @@ -130,15 +154,31 @@ void CallEnclosingF() { library "[[@TEST_NAME]]"; import Cpp; -// CHECK:STDERR: fail_generic_unsupported_type.carbon:[[@LINE+2]]:1-39: error: semantics TODO: `failed to import C++ type` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_generic_unsupported_type.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn UnsupportedF[T: type](unused t: T) {} +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `failed to import C++ type` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn UnsupportedF[T: type](unused t: T) {} inline Cpp ''' void CallUnsupportedF() { volatile int x; - // CHECK:STDERR: fail_generic_unsupported_type.carbon:[[@LINE+3]]:3-22: error: no matching function for call to 'UnsupportedF' [CppInteropParseError] - // CHECK:STDERR: fail_generic_unsupported_type.carbon:[[@LINE-6]]:39: note: candidate template ignored: substitution failure [with T = volatile int] [CppInteropParseNote] + // CHECK:STDERR: ╭─┤ fail_generic_unsupported_type.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: │ fn UnsupportedF[T: type](unused t: T) {} + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ candidate template ignored: + // CHECK:STDERR: · │ substitution failure [with T = + // CHECK:STDERR: · │ volatile int] + // CHECK:STDERR: · │ [CppInteropParseNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Carbon::UnsupportedF(x); + // CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'UnsupportedF' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Carbon::UnsupportedF(x); } diff --git a/toolchain/check/testdata/interop/cpp/function/import/arithmetic_types_bridged.carbon b/toolchain/check/testdata/interop/cpp/function/import/arithmetic_types_bridged.carbon index f86b5fbc9bec..6a00cfb6606b 100644 --- a/toolchain/check/testdata/interop/cpp/function/import/arithmetic_types_bridged.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/arithmetic_types_bridged.carbon @@ -123,7 +123,12 @@ import Cpp library "wchar_t_param.h"; fn F() { //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_import_wchar_t_param.carbon:[[@LINE+2]]:3-14: error: semantics TODO: `Unsupported: parameter type: wchar_t` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_import_wchar_t_param.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ Cpp.foo('X'); + // CHECK:STDERR: · ━━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `Unsupported: parameter type: wchar_t` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.foo('X'); //@dump-sem-ir-end @@ -135,15 +140,19 @@ fn F() { // --- char8_t_param.h +// CHECK:STDERR: ╷ ╭── included from: fail_todo_import_char8_t_param.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./char8_t_param.h:[[@LINE+6]]:10 +// CHECK:STDERR: -> │ auto foo(char8_t c) -> void; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: unknown type name 'char8_t' [CppInteropParseError] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: auto foo(char8_t c) -> void; // --- fail_todo_import_char8_t_param.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: included from: fail_todo_import_char8_t_param.carbon:[[@LINE+3]]:10 [InCppInclude] -// CHECK:STDERR: ./char8_t_param.h:2:10: error: unknown type name 'char8_t' [CppInteropParseError] -// CHECK:STDERR: import Cpp library "char8_t_param.h"; fn F() { @@ -168,7 +177,12 @@ import Cpp library "char16_t_param.h"; fn F() { //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_import_char16_t_param.carbon:[[@LINE+2]]:3-12: error: semantics TODO: `Unsupported: parameter type: char16_t` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_import_char16_t_param.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ Cpp.foo(1); + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `Unsupported: parameter type: char16_t` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.foo(1); //@dump-sem-ir-end @@ -190,7 +204,12 @@ import Cpp library "char32_t_param.h"; fn F() { //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_import_char32_t_param.carbon:[[@LINE+2]]:3-12: error: semantics TODO: `Unsupported: parameter type: char32_t` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_import_char32_t_param.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ Cpp.foo(1); + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `Unsupported: parameter type: char32_t` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.foo(1); //@dump-sem-ir-end @@ -234,8 +253,17 @@ library "[[@TEST_NAME]]"; import Cpp library "short_param.h"; fn F() { - // CHECK:STDERR: fail_import_short_param_overflow_max.carbon:[[@LINE+3]]:11-16: error: integer value 32768 too large for type `i16` [IntTooLargeForType] - // CHECK:STDERR: ./short_param.h:2:16: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_import_short_param_overflow_max.carbon:[[@LINE+12]]:11 + // CHECK:STDERR: -> │ Cpp.foo(0x8000); + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: integer value 32768 too large for type `i16` + // CHECK:STDERR: · ┃ [IntTooLargeForType] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./short_param.h + // CHECK:STDERR: │ auto foo(short a) -> void; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.foo(0x8000); } @@ -259,8 +287,17 @@ library "[[@TEST_NAME]]"; import Cpp library "short_param.h"; fn F() { - // CHECK:STDERR: fail_import_short_param_overflow_min.carbon:[[@LINE+3]]:11-17: error: integer value -32769 too large for type `i16` [IntTooLargeForType] - // CHECK:STDERR: ./short_param.h:2:16: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_import_short_param_overflow_min.carbon:[[@LINE+12]]:11 + // CHECK:STDERR: -> │ Cpp.foo(-0x8001); + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: integer value -32769 too large for type `i16` + // CHECK:STDERR: · ┃ [IntTooLargeForType] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./short_param.h + // CHECK:STDERR: │ auto foo(short a) -> void; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.foo(-0x8001); } @@ -272,9 +309,20 @@ library "[[@TEST_NAME]]"; import Cpp library "short_param.h"; fn F() { - // CHECK:STDERR: fail_import_short_param_int32_arg.carbon:[[@LINE+4]]:11-18: error: cannot implicitly convert expression of type `i32` to `i16` [ConversionFailure] - // CHECK:STDERR: fail_import_short_param_int32_arg.carbon:[[@LINE+3]]:11-18: note: type `i32` does not implement interface `Core.ImplicitAs(i16)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: ./short_param.h:2:16: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_import_short_param_int32_arg.carbon:[[@LINE+15]]:11 + // CHECK:STDERR: -> │ Cpp.foo(1 as i32); + // CHECK:STDERR: · ┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `i32` to + // CHECK:STDERR: · │ ┃ `i16` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `i32` does not implement interface `Core.ImplicitAs(i16)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./short_param.h + // CHECK:STDERR: │ auto foo(short a) -> void; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.foo(1 as i32); } @@ -502,7 +550,12 @@ import Cpp library "bit_int_24_param.h"; fn F() { //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_import_bit_int_24_param.carbon:[[@LINE+2]]:3-12: error: semantics TODO: `Unsupported: parameter type: bit_int_24` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_import_bit_int_24_param.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ Cpp.foo(1); + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `Unsupported: parameter type: bit_int_24` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.foo(1); //@dump-sem-ir-end @@ -1021,7 +1074,7 @@ fn F() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Cpp.ref: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %foo.ref: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value] -// CHECK:STDOUT: %.loc10: Core.CharLiteral = char_value U+0058 [concrete = constants.%.d16] +// CHECK:STDOUT: %.loc15: Core.CharLiteral = char_value U+0058 [concrete = constants.%.d16] // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1074,13 +1127,13 @@ fn F() { // CHECK:STDOUT: %foo.ref: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value] // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] // CHECK:STDOUT: %impl.elem0: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc11_11.1: = bound_method %int_1, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %bound_method.loc8_11.1: = bound_method %int_1, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] // CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc11_11.2: = bound_method %int_1, %specific_fn [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc11_11.2(%int_1) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc11_11.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc11_11.2: %i32 = converted %int_1, %.loc11_11.1 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call imports.%foo.decl(%.loc11_11.2) +// CHECK:STDOUT: %bound_method.loc8_11.2: = bound_method %int_1, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc8_11.2(%int_1) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc8_11.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc8_11.2: %i32 = converted %int_1, %.loc8_11.1 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call imports.%foo.decl(%.loc8_11.2) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interop/cpp/function/import/arithmetic_types_direct.carbon b/toolchain/check/testdata/interop/cpp/function/import/arithmetic_types_direct.carbon index d7996ec223f4..e83b45850632 100644 --- a/toolchain/check/testdata/interop/cpp/function/import/arithmetic_types_direct.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/arithmetic_types_direct.carbon @@ -54,8 +54,17 @@ library "[[@TEST_NAME]]"; import Cpp library "int_param.h"; fn F() { - // CHECK:STDERR: fail_import_int_param_overflow_max.carbon:[[@LINE+3]]:11-21: error: integer value 2147483648 too large for type `i32` [IntTooLargeForType] - // CHECK:STDERR: ./int_param.h:2:14: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_import_int_param_overflow_max.carbon:[[@LINE+12]]:11 + // CHECK:STDERR: -> │ Cpp.foo(0x8000_0000); + // CHECK:STDERR: · ━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: integer value 2147483648 too large for type `i32` + // CHECK:STDERR: · ┃ [IntTooLargeForType] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./int_param.h + // CHECK:STDERR: │ auto foo(int a) -> void; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.foo(0x8000_0000); } @@ -79,8 +88,17 @@ library "[[@TEST_NAME]]"; import Cpp library "int_param.h"; fn F() { - // CHECK:STDERR: fail_import_int_param_overflow_min.carbon:[[@LINE+3]]:11-22: error: integer value -2147483649 too large for type `i32` [IntTooLargeForType] - // CHECK:STDERR: ./int_param.h:2:14: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_import_int_param_overflow_min.carbon:[[@LINE+12]]:11 + // CHECK:STDERR: -> │ Cpp.foo(-0x8000_0001); + // CHECK:STDERR: · ━━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: integer value -2147483649 too large for type `i32` + // CHECK:STDERR: · ┃ [IntTooLargeForType] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./int_param.h + // CHECK:STDERR: │ auto foo(int a) -> void; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.foo(-0x8000_0001); } @@ -154,15 +172,35 @@ import Cpp library "unsigned_int_param.h"; fn F() { Cpp.foo(0); - // CHECK:STDERR: fail_import_unsigned_int_param_overflow.carbon:[[@LINE+3]]:11-12: error: negative integer value -1 converted to unsigned type `u32` [NegativeIntInUnsignedType] - // CHECK:STDERR: ./unsigned_int_param.h:2:23: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_import_unsigned_int_param_overflow.carbon:[[@LINE+13]]:11 + // CHECK:STDERR: -> │ Cpp.foo(-1); + // CHECK:STDERR: · ┳━ + // CHECK:STDERR: · ┗━━┫ error: negative integer value -1 converted to unsigned type `u32` + // CHECK:STDERR: · ┃ [NegativeIntInUnsignedType] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./unsigned_int_param.h + // CHECK:STDERR: │ auto foo(unsigned int a) -> void; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.foo(-1); Cpp.foo(0x0_FFFF_FFFF); - // CHECK:STDERR: fail_import_unsigned_int_param_overflow.carbon:[[@LINE+3]]:11-23: error: integer value 4294967296 too large for type `u32` [IntTooLargeForType] - // CHECK:STDERR: ./unsigned_int_param.h:2:23: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_import_unsigned_int_param_overflow.carbon:[[@LINE+13]]:11 + // CHECK:STDERR: -> │ Cpp.foo(0x1_0000_0000); + // CHECK:STDERR: · ━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: integer value 4294967296 too large for type `u32` + // CHECK:STDERR: · ┃ [IntTooLargeForType] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./unsigned_int_param.h + // CHECK:STDERR: │ auto foo(unsigned int a) -> void; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.foo(0x1_0000_0000); } diff --git a/toolchain/check/testdata/interop/cpp/function/import/class.carbon b/toolchain/check/testdata/interop/cpp/function/import/class.carbon index 9b15f0f528b2..6bfd902fa21a 100644 --- a/toolchain/check/testdata/interop/cpp/function/import/class.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/class.carbon @@ -18,36 +18,88 @@ class ForwardDeclaredClass; +// CHECK:STDERR: ╷ ╭── included from: fail_import_decl_value_param_type.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./decl_value_param_type.h:[[@LINE+16]]:6 +// CHECK:STDERR: │ class ForwardDeclaredClass; +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ forward declaration of 'ForwardDeclaredClass' [CppInteropParseNote] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ auto foo_decl_param1(ForwardDeclaredClass) -> void; +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: argument type 'ForwardDeclaredClass' is incomplete +// CHECK:STDERR: · ┃ [CppInteropParseError] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ fail_import_decl_value_param_type.carbon +// CHECK:STDERR: │ Cpp.foo_decl_param1(*p); +// CHECK:STDERR: · ───────────┬─────────── +// CHECK:STDERR: · ╰──┤ in thunk for C++ function used here [InCppThunk] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: auto foo_decl_param1(ForwardDeclaredClass) -> void; +// CHECK:STDERR: ╷ ╭── included from: fail_import_decl_value_param_type.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./decl_value_param_type.h:[[@LINE+16]]:6 +// CHECK:STDERR: │ class ForwardDeclaredClass; +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ forward declaration of 'ForwardDeclaredClass' [CppInteropParseNote] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ auto foo_decl_param2(ForwardDeclaredClass) -> void; +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: argument type 'ForwardDeclaredClass' is incomplete +// CHECK:STDERR: · ┃ [CppInteropParseError] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ fail_import_decl_value_param_type.carbon +// CHECK:STDERR: │ Cpp.foo_decl_param2(*p); +// CHECK:STDERR: · ───────────┬─────────── +// CHECK:STDERR: · ╰──┤ in thunk for C++ function used here [InCppThunk] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: auto foo_decl_param2(ForwardDeclaredClass) -> void; // --- fail_import_decl_value_param_type.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: included from: fail_import_decl_value_param_type.carbon:[[@LINE+3]]:10 [InCppInclude] -// CHECK:STDERR: ./decl_value_param_type.h:4:6-20: error: argument type 'ForwardDeclaredClass' is incomplete [CppInteropParseError] -// CHECK:STDERR: ./decl_value_param_type.h:2:7: note: forward declaration of 'ForwardDeclaredClass' [CppInteropParseNote] import Cpp library "decl_value_param_type.h"; fn F(p: Cpp.ForwardDeclaredClass*) { - // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE+5]]:3-25: note: in thunk for C++ function used here [InCppThunk] + // CHECK:STDERR: ╭─┤ fail_import_decl_value_param_type.carbon:[[@LINE+19]]:23 + // CHECK:STDERR: -> │ Cpp.foo_decl_param1(*p); + // CHECK:STDERR: · ┳━ + // CHECK:STDERR: · ┗━━┫ error: forming value of incomplete type + // CHECK:STDERR: · ┃ `Cpp.ForwardDeclaredClass` + // CHECK:STDERR: · ┃ [IncompleteTypeInValueConversion] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ ╭── included from: fail_import_decl_value_param_type.carbon [InCppInclude] + // CHECK:STDERR: ├─┤ ./decl_value_param_type.h + // CHECK:STDERR: │ class ForwardDeclaredClass; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ auto foo_decl_param1(ForwardDeclaredClass) -> void; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: included from: fail_import_decl_value_param_type.carbon:[[@LINE-5]]:10 [InCppInclude] - // CHECK:STDERR: ./decl_value_param_type.h:5:6-20: error: argument type 'ForwardDeclaredClass' is incomplete [CppInteropParseError] - // CHECK:STDERR: ./decl_value_param_type.h:2:7: note: forward declaration of 'ForwardDeclaredClass' [CppInteropParseNote] Cpp.foo_decl_param1(*p); - // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE+12]]:3-25: note: in thunk for C++ function used here [InCppThunk] - // CHECK:STDERR: - // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE-3]]:23-24: error: forming value of incomplete type `Cpp.ForwardDeclaredClass` [IncompleteTypeInValueConversion] - // CHECK:STDERR: included from: fail_import_decl_value_param_type.carbon:[[@LINE-12]]:10 [InCppInclude] - // CHECK:STDERR: ./decl_value_param_type.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: ./decl_value_param_type.h:4:42: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: - // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE+5]]:23-24: error: forming value of incomplete type `Cpp.ForwardDeclaredClass` [IncompleteTypeInValueConversion] - // CHECK:STDERR: included from: fail_import_decl_value_param_type.carbon:[[@LINE-17]]:10 [InCppInclude] - // CHECK:STDERR: ./decl_value_param_type.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: ./decl_value_param_type.h:5:42: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_import_decl_value_param_type.carbon:[[@LINE+19]]:23 + // CHECK:STDERR: -> │ Cpp.foo_decl_param2(*p); + // CHECK:STDERR: · ┳━ + // CHECK:STDERR: · ┗━━┫ error: forming value of incomplete type + // CHECK:STDERR: · ┃ `Cpp.ForwardDeclaredClass` + // CHECK:STDERR: · ┃ [IncompleteTypeInValueConversion] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ ╭── included from: fail_import_decl_value_param_type.carbon [InCppInclude] + // CHECK:STDERR: ├─┤ ./decl_value_param_type.h + // CHECK:STDERR: │ class ForwardDeclaredClass; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ auto foo_decl_param2(ForwardDeclaredClass) -> void; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.foo_decl_param2(*p); } @@ -84,22 +136,39 @@ class NonCopyableClass { NonCopyableClass(const NonCopyableClass&) = delete; }; +// CHECK:STDERR: ╷ ╭── included from: fail_import_non_copyable_param_type.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./non_copyable_param_type.h:[[@LINE+22]]:6 +// CHECK:STDERR: │ NonCopyableClass(const NonCopyableClass&) = delete; +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ 'NonCopyableClass' has been explicitly marked deleted here +// CHECK:STDERR: · │ [CppInteropParseNote] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ auto foo_non_copyable_param(NonCopyableClass) -> void; +// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━ ┬ +// CHECK:STDERR: · ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫ error: call to deleted +// CHECK:STDERR: · │ ┃ constructor of +// CHECK:STDERR: · │ ┃ 'NonCopyableClass' +// CHECK:STDERR: · │ ┃ [CppInteropParseError] +// CHECK:STDERR: · ╰────┤ passing argument to parameter +// CHECK:STDERR: · │ here +// CHECK:STDERR: · │ [CppInteropParseNote] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ fail_import_non_copyable_param_type.carbon +// CHECK:STDERR: │ Cpp.foo_non_copyable_param(c); +// CHECK:STDERR: · ──────────────┬────────────── +// CHECK:STDERR: · ╰──┤ in thunk for C++ function used here [InCppThunk] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: auto foo_non_copyable_param(NonCopyableClass) -> void; // --- fail_import_non_copyable_param_type.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: included from: fail_import_non_copyable_param_type.carbon:[[@LINE+4]]:10 [InCppInclude] -// CHECK:STDERR: ./non_copyable_param_type.h:6:6-27: error: call to deleted constructor of 'NonCopyableClass' [CppInteropParseError] -// CHECK:STDERR: ./non_copyable_param_type.h:3:3: note: 'NonCopyableClass' has been explicitly marked deleted here [CppInteropParseNote] -// CHECK:STDERR: ./non_copyable_param_type.h:6:45: note: passing argument to parameter here [CppInteropParseNote] import Cpp library "non_copyable_param_type.h"; fn F(c: Cpp.NonCopyableClass) { //@dump-sem-ir-begin - // CHECK:STDERR: fail_import_non_copyable_param_type.carbon:[[@LINE+2]]:3-31: note: in thunk for C++ function used here [InCppThunk] - // CHECK:STDERR: Cpp.foo_non_copyable_param(c); //@dump-sem-ir-end } @@ -114,6 +183,75 @@ struct MoveOnlyClass { MoveOnlyClass(MoveOnlyClass&&); }; +// CHECK:STDERR: ╷ ╭── included from: fail_pass_move_only_param_value.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./move_only_param_type.h:[[@LINE+68]]:6 +// CHECK:STDERR: │ MoveOnlyClass(MoveOnlyClass&&); +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ copy constructor is implicitly deleted because 'MoveOnlyClass' has a +// CHECK:STDERR: · │ user-declared move constructor +// CHECK:STDERR: · │ [CppInteropParseNote] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ auto foo_move_only_param(MoveOnlyClass) -> void; +// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━━ ┬ +// CHECK:STDERR: · ┗━━━━━━━━━━━━━━━━━━━━━━━━━━┫ error: call to implicitly-deleted +// CHECK:STDERR: · │ ┃ copy constructor of +// CHECK:STDERR: · │ ┃ 'MoveOnlyClass' +// CHECK:STDERR: · │ ┃ [CppInteropParseError] +// CHECK:STDERR: · ╰────┤ passing argument to parameter here +// CHECK:STDERR: · │ [CppInteropParseNote] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ fail_pass_move_only_param_value.carbon +// CHECK:STDERR: │ Cpp.foo_move_only_param(c); +// CHECK:STDERR: · ─────────────┬──────────── +// CHECK:STDERR: · ╰──┤ in thunk for C++ function used here [InCppThunk] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: +// CHECK:STDERR: ╷ ╭── included from: fail_pass_move_only_param_ref.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./move_only_param_type.h:[[@LINE+45]]:6 +// CHECK:STDERR: │ MoveOnlyClass(MoveOnlyClass&&); +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ copy constructor is implicitly deleted because 'MoveOnlyClass' has a +// CHECK:STDERR: · │ user-declared move constructor +// CHECK:STDERR: · │ [CppInteropParseNote] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ auto foo_move_only_param(MoveOnlyClass) -> void; +// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━━ ┬ +// CHECK:STDERR: · ┗━━━━━━━━━━━━━━━━━━━━━━━━━━┫ error: call to implicitly-deleted +// CHECK:STDERR: · │ ┃ copy constructor of +// CHECK:STDERR: · │ ┃ 'MoveOnlyClass' +// CHECK:STDERR: · │ ┃ [CppInteropParseError] +// CHECK:STDERR: · ╰────┤ passing argument to parameter here +// CHECK:STDERR: · │ [CppInteropParseNote] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ fail_pass_move_only_param_ref.carbon +// CHECK:STDERR: │ Cpp.foo_move_only_param(c); +// CHECK:STDERR: · ─────────────┬──────────── +// CHECK:STDERR: · ╰──┤ in thunk for C++ function used here [InCppThunk] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: +// CHECK:STDERR: ╷ ╭── included from: fail_todo_pass_move_only_param_ref_by_move.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./move_only_param_type.h:[[@LINE+22]]:6 +// CHECK:STDERR: │ MoveOnlyClass(MoveOnlyClass&&); +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ copy constructor is implicitly deleted because 'MoveOnlyClass' has a +// CHECK:STDERR: · │ user-declared move constructor +// CHECK:STDERR: · │ [CppInteropParseNote] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ auto foo_move_only_param(MoveOnlyClass) -> void; +// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━━ ┬ +// CHECK:STDERR: · ┗━━━━━━━━━━━━━━━━━━━━━━━━━━┫ error: call to implicitly-deleted +// CHECK:STDERR: · │ ┃ copy constructor of +// CHECK:STDERR: · │ ┃ 'MoveOnlyClass' +// CHECK:STDERR: · │ ┃ [CppInteropParseError] +// CHECK:STDERR: · ╰────┤ passing argument to parameter here +// CHECK:STDERR: · │ [CppInteropParseNote] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ fail_todo_pass_move_only_param_ref_by_move.carbon +// CHECK:STDERR: │ Cpp.foo_move_only_param(Cpp.move_move_only(ref c)); +// CHECK:STDERR: · ─────────────────────────┬──────────────────────── +// CHECK:STDERR: · ╰──┤ in thunk for C++ function used here [InCppThunk] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: auto foo_move_only_param(MoveOnlyClass) -> void; auto make_move_only() -> MoveOnlyClass; auto move_move_only(MoveOnlyClass&) -> MoveOnlyClass&&; @@ -134,15 +272,9 @@ fn F() { library "[[@TEST_NAME]]"; -// CHECK:STDERR: included from: fail_pass_move_only_param_value.carbon:[[@LINE+4]]:10 [InCppInclude] -// CHECK:STDERR: ./move_only_param_type.h:6:6-24: error: call to implicitly-deleted copy constructor of 'MoveOnlyClass' [CppInteropParseError] -// CHECK:STDERR: ./move_only_param_type.h:3:3: note: copy constructor is implicitly deleted because 'MoveOnlyClass' has a user-declared move constructor [CppInteropParseNote] -// CHECK:STDERR: ./move_only_param_type.h:6:39: note: passing argument to parameter here [CppInteropParseNote] import Cpp library "move_only_param_type.h"; fn F(c: Cpp.MoveOnlyClass) { - // CHECK:STDERR: fail_pass_move_only_param_value.carbon:[[@LINE+2]]:3-28: note: in thunk for C++ function used here [InCppThunk] - // CHECK:STDERR: Cpp.foo_move_only_param(c); } @@ -150,15 +282,9 @@ fn F(c: Cpp.MoveOnlyClass) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: included from: fail_pass_move_only_param_ref.carbon:[[@LINE+4]]:10 [InCppInclude] -// CHECK:STDERR: ./move_only_param_type.h:6:6-24: error: call to implicitly-deleted copy constructor of 'MoveOnlyClass' [CppInteropParseError] -// CHECK:STDERR: ./move_only_param_type.h:3:3: note: copy constructor is implicitly deleted because 'MoveOnlyClass' has a user-declared move constructor [CppInteropParseNote] -// CHECK:STDERR: ./move_only_param_type.h:6:39: note: passing argument to parameter here [CppInteropParseNote] import Cpp library "move_only_param_type.h"; fn F(ref c: Cpp.MoveOnlyClass) { - // CHECK:STDERR: fail_pass_move_only_param_ref.carbon:[[@LINE+2]]:3-28: note: in thunk for C++ function used here [InCppThunk] - // CHECK:STDERR: Cpp.foo_move_only_param(c); } @@ -166,15 +292,9 @@ fn F(ref c: Cpp.MoveOnlyClass) { library "[[@TEST_NAME]]"; -// CHECK:STDERR: included from: fail_todo_pass_move_only_param_ref_by_move.carbon:[[@LINE+4]]:10 [InCppInclude] -// CHECK:STDERR: ./move_only_param_type.h:6:6-24: error: call to implicitly-deleted copy constructor of 'MoveOnlyClass' [CppInteropParseError] -// CHECK:STDERR: ./move_only_param_type.h:3:3: note: copy constructor is implicitly deleted because 'MoveOnlyClass' has a user-declared move constructor [CppInteropParseNote] -// CHECK:STDERR: ./move_only_param_type.h:6:39: note: passing argument to parameter here [CppInteropParseNote] import Cpp library "move_only_param_type.h"; fn F(ref c: Cpp.MoveOnlyClass) { - // CHECK:STDERR: fail_todo_pass_move_only_param_ref_by_move.carbon:[[@LINE+2]]:3-52: note: in thunk for C++ function used here [InCppThunk] - // CHECK:STDERR: Cpp.foo_move_only_param(Cpp.move_move_only(ref c)); } @@ -359,9 +479,18 @@ library "[[@TEST_NAME]]"; import Cpp library "incomplete.h"; fn F() { - // CHECK:STDERR: fail_import_incomplete.carbon:[[@LINE+4]]:3-20: error: member access into incomplete class `Cpp.Incomplete` [QualifiedExprInIncompleteClassScope] - // CHECK:STDERR: included from: fail_import_incomplete.carbon:[[@LINE-4]]:10 [InCppInclude] - // CHECK:STDERR: ./incomplete.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ╭─┤ fail_import_incomplete.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: -> │ Cpp.Incomplete.foo(); + // CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: member access into incomplete class `Cpp.Incomplete` + // CHECK:STDERR: · ┃ [QualifiedExprInIncompleteClassScope] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ ╭── included from: fail_import_incomplete.carbon [InCppInclude] + // CHECK:STDERR: ├─┤ ./incomplete.h + // CHECK:STDERR: │ class Incomplete; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.Incomplete.foo(); } @@ -418,25 +547,51 @@ fn F(c: Cpp.DefPointerParamClass*) { class DeclValueReturnClass; +// CHECK:STDERR: ╷ ╭── included from: fail_import_decl_value_return_type.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./decl_value_return_type.h:[[@LINE+18]]:6 +// CHECK:STDERR: │ class DeclValueReturnClass; +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ forward declaration of 'DeclValueReturnClass' [CppInteropParseNote] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ auto foo_decl_value_return() -> DeclValueReturnClass; +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: calling 'foo_decl_value_return' with incomplete return type +// CHECK:STDERR: · │ ┃ 'DeclValueReturnClass' +// CHECK:STDERR: · │ ┃ [CppInteropParseError] +// CHECK:STDERR: · ╰────┤ 'foo_decl_value_return' declared here [CppInteropParseNote] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ fail_import_decl_value_return_type.carbon +// CHECK:STDERR: │ Cpp.foo_decl_value_return(); +// CHECK:STDERR: · ─────────────┬───────────── +// CHECK:STDERR: · ╰──┤ in thunk for C++ function used here [InCppThunk] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: auto foo_decl_value_return() -> DeclValueReturnClass; // --- fail_import_decl_value_return_type.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: included from: fail_import_decl_value_return_type.carbon:[[@LINE+4]]:10 [InCppInclude] -// CHECK:STDERR: ./decl_value_return_type.h:4:6-26: error: calling 'foo_decl_value_return' with incomplete return type 'DeclValueReturnClass' [CppInteropParseError] -// CHECK:STDERR: ./decl_value_return_type.h:4:6: note: 'foo_decl_value_return' declared here [CppInteropParseNote] -// CHECK:STDERR: ./decl_value_return_type.h:2:7: note: forward declaration of 'DeclValueReturnClass' [CppInteropParseNote] import Cpp library "decl_value_return_type.h"; fn F() { - // CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE+7]]:3-29: note: in thunk for C++ function used here [InCppThunk] - // CHECK:STDERR: - // CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE+5]]:3-29: error: function returns incomplete type `Cpp.DeclValueReturnClass` [IncompleteTypeInFunctionReturnType] - // CHECK:STDERR: included from: fail_import_decl_value_return_type.carbon:[[@LINE-6]]:10 [InCppInclude] - // CHECK:STDERR: ./decl_value_return_type.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: ./decl_value_return_type.h:4:33: note: return type declared here [IncompleteReturnTypeHere] + // CHECK:STDERR: ╭─┤ fail_import_decl_value_return_type.carbon:[[@LINE+18]]:3 + // CHECK:STDERR: -> │ Cpp.foo_decl_value_return(); + // CHECK:STDERR: · ━━━━━━━┳━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: function returns incomplete type `Cpp.DeclValueReturnClass` + // CHECK:STDERR: · ┃ [IncompleteTypeInFunctionReturnType] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ ╭── included from: fail_import_decl_value_return_type.carbon [InCppInclude] + // CHECK:STDERR: ├─┤ ./decl_value_return_type.h + // CHECK:STDERR: │ class DeclValueReturnClass; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ auto foo_decl_value_return() -> DeclValueReturnClass; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ return type declared here + // CHECK:STDERR: · │ [IncompleteReturnTypeHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.foo_decl_value_return(); } @@ -575,7 +730,7 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%c.param: %NonCopyableClass) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Cpp.ref.loc14: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %Cpp.ref.loc8: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %foo_non_copyable_param.ref: %foo_non_copyable_param.cpp_overload_set.type = name_ref foo_non_copyable_param, imports.%foo_non_copyable_param.cpp_overload_set.value [concrete = constants.%foo_non_copyable_param.cpp_overload_set.value] // CHECK:STDOUT: %c.ref: %NonCopyableClass = name_ref c, %c // CHECK:STDOUT: %foo_non_copyable_param.call: init %empty_tuple.type = call imports.%foo_non_copyable_param.decl(%c.ref) diff --git a/toolchain/check/testdata/interop/cpp/function/import/constexpr.carbon b/toolchain/check/testdata/interop/cpp/function/import/constexpr.carbon index e5dff69a7733..4b28740d95bb 100644 --- a/toolchain/check/testdata/interop/cpp/function/import/constexpr.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/constexpr.carbon @@ -72,7 +72,12 @@ constexpr int invalid_const_fn(int a) { } '''; -// CHECK:STDERR: fail_invalid_constant_eval.carbon:[[@LINE+2]]:19-41: error: array bound is not a constant [InvalidArrayExpr] +// CHECK:STDERR: ╭─┤ fail_invalid_constant_eval.carbon:[[@LINE+7]]:19 +// CHECK:STDERR: -> │ let a: array(i32, Cpp.invalid_const_fn(5)) = (1, 2, 3); +// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: array bound is not a constant +// CHECK:STDERR: · ┃ [InvalidArrayExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let a: array(i32, Cpp.invalid_const_fn(5)) = (1, 2, 3); @@ -101,16 +106,36 @@ var a: i32 = 0; // TODO: This is failing when building the thunk, not when calling it. inline Cpp ''' -// CHECK:STDERR: fail_nonconstant_consteval_call.carbon:[[@LINE+3]]:15: error: call to consteval function 'nonconst_consteval_fn' is not a constant expression [CppInteropParseError] -// CHECK:STDERR: fail_nonconstant_consteval_call.carbon:[[@LINE+2]]:15: note: function parameter 'r' with unknown value cannot be used in a constant expression [CppInteropParseNote] -// CHECK:STDERR: fail_nonconstant_consteval_call.carbon:[[@LINE+1]]:15: note: declared here [CppInteropParseNote] +// CHECK:STDERR: ╭─┤ fail_nonconstant_consteval_call.carbon:[[@LINE+16]]:15 +// CHECK:STDERR: -> │ consteval int nonconst_consteval_fn(const int &r) { return r; } +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: call to consteval function 'nonconst_consteval_fn' is +// CHECK:STDERR: · │ ┃ not a constant expression +// CHECK:STDERR: · │ ┃ [CppInteropParseError] +// CHECK:STDERR: · ╰────┤ function parameter 'r' with unknown value cannot be used in +// CHECK:STDERR: · │ │ a constant expression +// CHECK:STDERR: · │ │ [CppInteropParseNote] +// CHECK:STDERR: · ╰──────┤ declared here [CppInteropParseNote] +// CHECK:STDERR: ┆ +// CHECK:STDERR: │ var b: i32 = Cpp.nonconst_consteval_fn(a); +// CHECK:STDERR: · ──────────────┬───────────── +// CHECK:STDERR: · ╰──┤ in thunk for C++ function used here [InCppThunk] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: consteval int nonconst_consteval_fn(const int &r) { return r; } '''; -// CHECK:STDERR: fail_nonconstant_consteval_call.carbon:[[@LINE+5]]:14-41: note: in thunk for C++ function used here [InCppThunk] -// CHECK:STDERR: -// CHECK:STDERR: fail_nonconstant_consteval_call.carbon:[[@LINE+3]]:14-41: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] -// CHECK:STDERR: fail_nonconstant_consteval_call.carbon:[[@LINE-6]]:15: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] +// CHECK:STDERR: ╭─┤ fail_nonconstant_consteval_call.carbon:[[@LINE+12]]:14 +// CHECK:STDERR: │ consteval int nonconst_consteval_fn(const int &r) { return r; } +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ compile-time-only function declared here +// CHECK:STDERR: · │ [CompTimeOnlyFunctionHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ var b: i32 = Cpp.nonconst_consteval_fn(a); +// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: non-constant call to compile-time-only function +// CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var b: i32 = Cpp.nonconst_consteval_fn(a); @@ -130,14 +155,22 @@ struct ConstexprC { // TODO: This should probably be allowed. eval fn F() -> i32 { //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_constructor.carbon:[[@LINE+1]]:27: error: expression is runtime; expected constant [EvalRequiresConstantValue] + // CHECK:STDERR: ╭─┤ fail_todo_constructor.carbon:[[@LINE+11]]:27 + // CHECK:STDERR: -> │ let c: Cpp.ConstexprC = 3; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expression is runtime; expected constant + // CHECK:STDERR: · ┃ [EvalRequiresConstantValue] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ let a: array(i32, F()) = (1, 2, 3); + // CHECK:STDERR: · ─┬─ + // CHECK:STDERR: · ╰──┤ in call to F here [InCallToEvalFn] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: let c: Cpp.ConstexprC = 3; return c.a; //@dump-sem-ir-end } -// CHECK:STDERR: fail_todo_constructor.carbon:[[@LINE+2]]:19-21: note: in call to F here [InCallToEvalFn] -// CHECK:STDERR: let a: array(i32, F()) = (1, 2, 3); // CHECK:STDOUT: --- fail_todo_constructor.carbon @@ -215,43 +248,43 @@ let a: array(i32, F()) = (1, 2, 3); // CHECK:STDOUT: fn @F() -> out %return.param: %i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3.1ba] -// CHECK:STDOUT: %.loc17_27.1: ref %ConstexprC = temporary_storage -// CHECK:STDOUT: %impl.elem0.loc17: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc17_27.1: = bound_method %int_3, %impl.elem0.loc17 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] -// CHECK:STDOUT: %specific_fn.loc17: = specific_function %impl.elem0.loc17, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc17_27.2: = bound_method %int_3, %specific_fn.loc17 [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc17_27.2(%int_3) [concrete = constants.%int_3.9f3] -// CHECK:STDOUT: %.loc17_27.2: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_3.9f3] -// CHECK:STDOUT: %.loc17_27.3: %i32 = converted %int_3, %.loc17_27.2 [concrete = constants.%int_3.9f3] -// CHECK:STDOUT: %addr: %ptr.0b8 = addr_of %.loc17_27.1 -// CHECK:STDOUT: %ConstexprC__carbon_thunk.call: init %empty_tuple.type = call imports.%ConstexprC__carbon_thunk.decl(%.loc17_27.3, %addr) -// CHECK:STDOUT: %.loc17_27.4: init %ConstexprC to %.loc17_27.1 = mark_in_place_init %ConstexprC__carbon_thunk.call -// CHECK:STDOUT: %.loc17_27.5: init %ConstexprC = converted %int_3, %.loc17_27.4 -// CHECK:STDOUT: %.loc17_27.6: ref %ConstexprC = temporary %.loc17_27.1, %.loc17_27.5 -// CHECK:STDOUT: %.loc17_27.7: %ConstexprC = acquire_value %.loc17_27.6 -// CHECK:STDOUT: %.loc17_13: type = splice_block %ConstexprC.ref [concrete = constants.%ConstexprC] { +// CHECK:STDOUT: %.loc27_27.1: ref %ConstexprC = temporary_storage +// CHECK:STDOUT: %impl.elem0.loc27: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc27_27.1: = bound_method %int_3, %impl.elem0.loc27 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %specific_fn.loc27: = specific_function %impl.elem0.loc27, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc27_27.2: = bound_method %int_3, %specific_fn.loc27 [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc27_27.2(%int_3) [concrete = constants.%int_3.9f3] +// CHECK:STDOUT: %.loc27_27.2: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_3.9f3] +// CHECK:STDOUT: %.loc27_27.3: %i32 = converted %int_3, %.loc27_27.2 [concrete = constants.%int_3.9f3] +// CHECK:STDOUT: %addr: %ptr.0b8 = addr_of %.loc27_27.1 +// CHECK:STDOUT: %ConstexprC__carbon_thunk.call: init %empty_tuple.type = call imports.%ConstexprC__carbon_thunk.decl(%.loc27_27.3, %addr) +// CHECK:STDOUT: %.loc27_27.4: init %ConstexprC to %.loc27_27.1 = mark_in_place_init %ConstexprC__carbon_thunk.call +// CHECK:STDOUT: %.loc27_27.5: init %ConstexprC = converted %int_3, %.loc27_27.4 +// CHECK:STDOUT: %.loc27_27.6: ref %ConstexprC = temporary %.loc27_27.1, %.loc27_27.5 +// CHECK:STDOUT: %.loc27_27.7: %ConstexprC = acquire_value %.loc27_27.6 +// CHECK:STDOUT: %.loc27_13: type = splice_block %ConstexprC.ref [concrete = constants.%ConstexprC] { // CHECK:STDOUT: %Cpp.ref: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %ConstexprC.ref: type = name_ref ConstexprC, imports.%ConstexprC.decl [concrete = constants.%ConstexprC] // CHECK:STDOUT: } -// CHECK:STDOUT: %c: %ConstexprC = wrapper_binding c, %.loc17_27.7 +// CHECK:STDOUT: %c: %ConstexprC = wrapper_binding c, %.loc27_27.7 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %c.patt: %pattern_type.3cc = value_binding_pattern c [concrete = constants.%c.patt] // CHECK:STDOUT: } // CHECK:STDOUT: %c.ref: %ConstexprC = name_ref c, %c // CHECK:STDOUT: %a.ref: %ConstexprC.elem = name_ref a, @ConstexprC.%field_decl [concrete = @ConstexprC.%field_decl] -// CHECK:STDOUT: %.loc18_11.1: ref %i32 = class_element_access %c.ref, element0 -// CHECK:STDOUT: %.loc18_11.2: %i32 = acquire_value %.loc18_11.1 -// CHECK:STDOUT: %impl.elem0.loc18: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae] -// CHECK:STDOUT: %bound_method.loc18_11.1: = bound_method %.loc18_11.2, %impl.elem0.loc18 -// CHECK:STDOUT: %specific_fn.loc18: = specific_function %impl.elem0.loc18, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc18_11.2: = bound_method %.loc18_11.2, %specific_fn.loc18 -// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc18_11.2(%.loc18_11.2) -// CHECK:STDOUT: %Destroy.facet.loc17_27.1: %Destroy.type = facet_value constants.%ConstexprC, (constants.%DestroyImpl.impl_witness.a0d, constants.%custom_witness.576) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc17_27.8: %Destroy.type = converted constants.%ConstexprC, %Destroy.facet.loc17_27.1 [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %Destroy.facet.loc17_27.2: %Destroy.type = facet_value constants.%ConstexprC, (constants.%DestroyImpl.impl_witness.a0d, constants.%custom_witness.576) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc17_27.9: %Destroy.type = converted constants.%ConstexprC, %Destroy.facet.loc17_27.2 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc28_11.1: ref %i32 = class_element_access %c.ref, element0 +// CHECK:STDOUT: %.loc28_11.2: %i32 = acquire_value %.loc28_11.1 +// CHECK:STDOUT: %impl.elem0.loc28: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae] +// CHECK:STDOUT: %bound_method.loc28_11.1: = bound_method %.loc28_11.2, %impl.elem0.loc28 +// CHECK:STDOUT: %specific_fn.loc28: = specific_function %impl.elem0.loc28, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc28_11.2: = bound_method %.loc28_11.2, %specific_fn.loc28 +// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc28_11.2(%.loc28_11.2) +// CHECK:STDOUT: %Destroy.facet.loc27_27.1: %Destroy.type = facet_value constants.%ConstexprC, (constants.%DestroyImpl.impl_witness.a0d, constants.%custom_witness.576) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc27_27.8: %Destroy.type = converted constants.%ConstexprC, %Destroy.facet.loc27_27.1 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %Destroy.facet.loc27_27.2: %Destroy.type = facet_value constants.%ConstexprC, (constants.%DestroyImpl.impl_witness.a0d, constants.%custom_witness.576) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc27_27.9: %Destroy.type = converted constants.%ConstexprC, %Destroy.facet.loc27_27.2 [concrete = constants.%Destroy.facet] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc17_27.6) +// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc27_27.6) // CHECK:STDOUT: return %Int.as.Copy.impl.Op.call // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interop/cpp/function/import/decayed_param.carbon b/toolchain/check/testdata/interop/cpp/function/import/decayed_param.carbon index 904c75f31f51..8a0561ea7581 100644 --- a/toolchain/check/testdata/interop/cpp/function/import/decayed_param.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/decayed_param.carbon @@ -46,20 +46,50 @@ fn G(n: i32) -> i32; fn F() { //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_call_params_2.carbon:[[@LINE+2]]:21-32: error: call argument of type `` is not supported [CppCallArgTypeNotSupported] + // CHECK:STDERR: ╭─┤ fail_todo_call_params_2.carbon:[[@LINE+8]]:21 + // CHECK:STDERR: -> │ Cpp.TakesFunction(Cpp.Function); + // CHECK:STDERR: · ┳━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: call argument of type `` + // CHECK:STDERR: · ┃ is not supported + // CHECK:STDERR: · ┃ [CppCallArgTypeNotSupported] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.TakesFunction(Cpp.Function); var n: array(i32, 42); - // CHECK:STDERR: fail_todo_call_params_2.carbon:[[@LINE+4]]:3-19: error: no matching function for call to 'TakesFunction' [CppInteropParseError] - // CHECK:STDERR: ./params.h:3:6: note: candidate function not viable [CppInteropParseNote] - // CHECK:STDERR: ./params.h:3:20-29: note: no known conversion from 'int * _Nonnull' to 'int (*)(int)' for 1st argument [CppInteropParseNoteReason] + // CHECK:STDERR: ╭─┤ fail_todo_call_params_2.carbon:[[@LINE+15]]:3 + // CHECK:STDERR: -> │ Cpp.TakesFunction(&n[0]); + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'TakesFunction' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./params.h + // CHECK:STDERR: │ void TakesFunction(int f(int)); + // CHECK:STDERR: · ┬ ┬───────── + // CHECK:STDERR: · ╰────────────────┤ candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: · ╰────┤ no known conversion from 'int * _Nonnull' to 'int + // CHECK:STDERR: · │ (*)(int)' for 1st argument + // CHECK:STDERR: · │ [CppInteropParseNoteReason] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.TakesFunction(&n[0]); - // CHECK:STDERR: fail_todo_call_params_2.carbon:[[@LINE+4]]:21-31: error: cannot implicitly convert expression of type `Cpp.nullptr_t` to `` [ConversionFailure] - // CHECK:STDERR: fail_todo_call_params_2.carbon:[[@LINE+3]]:21-31: note: type `Cpp.nullptr_t` does not implement interface `Core.ImplicitAs()` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: ./params.h:3:24: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_todo_call_params_2.carbon:[[@LINE+17]]:21 + // CHECK:STDERR: -> │ Cpp.TakesFunction(Cpp.nullptr); + // CHECK:STDERR: · ┳━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type + // CHECK:STDERR: · │ ┃ `Cpp.nullptr_t` to `` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Cpp.nullptr_t` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs()` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./params.h + // CHECK:STDERR: │ void TakesFunction(int f(int)); + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.TakesFunction(Cpp.nullptr); //@dump-sem-ir-end @@ -771,10 +801,10 @@ fn F() { // CHECK:STDOUT: %.659: type = cpp_fn_ptr_type clang_function_pointer_type61000000 [concrete] // CHECK:STDOUT: %TakesFunction.type: type = fn_type @TakesFunction [concrete] // CHECK:STDOUT: %TakesFunction: %TakesFunction.type = struct_value () [concrete] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.2: type = fn_type @SubobjectDestroy.WithSelf.Op.loc14_3.1 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.2: type = fn_type @SubobjectDestroy.WithSelf.Op.loc20_3.1 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.2: %SubobjectDestroy.WithSelf.Op.type.6870fd.2 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80ef6.2: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.2), @SubobjectDestroy [concrete] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.3: type = fn_type @SubobjectDestroy.WithSelf.Op.loc14_3.2 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.3: type = fn_type @SubobjectDestroy.WithSelf.Op.loc20_3.2 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.3: %SubobjectDestroy.WithSelf.Op.type.6870fd.3 = struct_value () [concrete] // CHECK:STDOUT: %int_41: Core.IntLiteral = int_value 41 [concrete] // CHECK:STDOUT: %SubobjectDestroy.facet.49a: %SubobjectDestroy.type = facet_value %i32, (%custom_witness.b80ef6.2) [concrete] @@ -851,20 +881,20 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Cpp.ref.loc12_3: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %TakesFunction.ref.loc12: %TakesFunction.cpp_overload_set.type = name_ref TakesFunction, imports.%TakesFunction.cpp_overload_set.value [concrete = constants.%TakesFunction.cpp_overload_set.value] -// CHECK:STDOUT: %Cpp.ref.loc12_21: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %Cpp.ref.loc18_3: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %TakesFunction.ref.loc18: %TakesFunction.cpp_overload_set.type = name_ref TakesFunction, imports.%TakesFunction.cpp_overload_set.value [concrete = constants.%TakesFunction.cpp_overload_set.value] +// CHECK:STDOUT: %Cpp.ref.loc18_21: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %Function.ref: %Function.cpp_overload_set.type = name_ref Function, imports.%Function.cpp_overload_set.value [concrete = constants.%Function.cpp_overload_set.value] // CHECK:STDOUT: %n.var: ref %Array.3b5 = var_storage %n.var_patt // CHECK:STDOUT: %DefaultOrUnformed.facet: %DefaultOrUnformed.type = facet_value constants.%Array.3b5, (constants.%DefaultOrUnformed.impl_witness.4bc) [concrete = constants.%DefaultOrUnformed.facet] -// CHECK:STDOUT: %.loc14_24.1: %DefaultOrUnformed.type = converted constants.%Array.3b5, %DefaultOrUnformed.facet [concrete = constants.%DefaultOrUnformed.facet] -// CHECK:STDOUT: %as_type: type = facet_access_type %.loc14_24.1 [concrete = constants.%Array.3b5] -// CHECK:STDOUT: %.loc14_24.2: type = converted %.loc14_24.1, %as_type [concrete = constants.%Array.3b5] +// CHECK:STDOUT: %.loc20_24.1: %DefaultOrUnformed.type = converted constants.%Array.3b5, %DefaultOrUnformed.facet [concrete = constants.%DefaultOrUnformed.facet] +// CHECK:STDOUT: %as_type: type = facet_access_type %.loc20_24.1 [concrete = constants.%Array.3b5] +// CHECK:STDOUT: %.loc20_24.2: type = converted %.loc20_24.1, %as_type [concrete = constants.%Array.3b5] // CHECK:STDOUT: -// CHECK:STDOUT: %.loc14_3.1: ref %Array.3b5 = splice_block %n.var {} -// CHECK:STDOUT: %T.as_type.as.DefaultOrUnformed.impl.Op.call: init %Array.3b5 to %.loc14_3.1 = call %T.as_type.as.DefaultOrUnformed.impl.Op.specific_fn() +// CHECK:STDOUT: %.loc20_3.1: ref %Array.3b5 = splice_block %n.var {} +// CHECK:STDOUT: %T.as_type.as.DefaultOrUnformed.impl.Op.call: init %Array.3b5 to %.loc20_3.1 = call %T.as_type.as.DefaultOrUnformed.impl.Op.specific_fn() // CHECK:STDOUT: assign %n.var, %T.as_type.as.DefaultOrUnformed.impl.Op.call -// CHECK:STDOUT: %.loc14_23: type = splice_block %Array [concrete = constants.%Array.3b5] { +// CHECK:STDOUT: %.loc20_23: type = splice_block %Array [concrete = constants.%Array.3b5] { // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %int_42: Core.IntLiteral = int_value 42 [concrete = constants.%int_42] // CHECK:STDOUT: %Array: type = class_type @Array, @Array(constants.%i32, constants.%int_42) [concrete = constants.%Array.3b5] @@ -874,375 +904,375 @@ fn F() { // CHECK:STDOUT: %n.patt: %pattern_type.9c3 = ref_binding_pattern n [concrete = constants.%n.patt.368] // CHECK:STDOUT: %n.var_patt: %pattern_type.9c3 = var_pattern %n.patt [concrete = constants.%n.var_patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %Cpp.ref.loc19: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %TakesFunction.ref.loc19: %TakesFunction.cpp_overload_set.type = name_ref TakesFunction, imports.%TakesFunction.cpp_overload_set.value [concrete = constants.%TakesFunction.cpp_overload_set.value] +// CHECK:STDOUT: %Cpp.ref.loc36: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %TakesFunction.ref.loc36: %TakesFunction.cpp_overload_set.type = name_ref TakesFunction, imports.%TakesFunction.cpp_overload_set.value [concrete = constants.%TakesFunction.cpp_overload_set.value] // CHECK:STDOUT: %n.ref: ref %Array.3b5 = name_ref n, %n // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] // CHECK:STDOUT: %impl.elem0: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc19_24.1: = bound_method %int_0, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %bound_method.loc36_24.1: = bound_method %int_0, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] // CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc19_24.2: = bound_method %int_0, %specific_fn [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc19_24.2(%int_0) [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc19_24.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc19_24.2: %i32 = converted %int_0, %.loc19_24.1 [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc19_25: ref %i32 = array_index %n.ref, %.loc19_24.2 -// CHECK:STDOUT: %addr: %ptr.a17 = addr_of %.loc19_25 -// CHECK:STDOUT: %Cpp.ref.loc25_3: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %TakesFunction.ref.loc25: %TakesFunction.cpp_overload_set.type = name_ref TakesFunction, imports.%TakesFunction.cpp_overload_set.value [concrete = constants.%TakesFunction.cpp_overload_set.value] -// CHECK:STDOUT: %Cpp.ref.loc25_21: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %bound_method.loc36_24.2: = bound_method %int_0, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc36_24.2(%int_0) [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc36_24.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc36_24.2: %i32 = converted %int_0, %.loc36_24.1 [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc36_25: ref %i32 = array_index %n.ref, %.loc36_24.2 +// CHECK:STDOUT: %addr: %ptr.a17 = addr_of %.loc36_25 +// CHECK:STDOUT: %Cpp.ref.loc55_3: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %TakesFunction.ref.loc55: %TakesFunction.cpp_overload_set.type = name_ref TakesFunction, imports.%TakesFunction.cpp_overload_set.value [concrete = constants.%TakesFunction.cpp_overload_set.value] +// CHECK:STDOUT: %Cpp.ref.loc55_21: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: // CHECK:STDOUT: %nullptr.ref: %Cpp.nullptr_t = name_ref nullptr, %uninit [concrete = constants.%uninit] -// CHECK:STDOUT: %.loc25: %.659 = converted %nullptr.ref, [concrete = ] +// CHECK:STDOUT: %.loc55: %.659 = converted %nullptr.ref, [concrete = ] // CHECK:STDOUT: %TakesFunction.call: init %empty_tuple.type = call imports.%TakesFunction.decl() -// CHECK:STDOUT: %Destroy.facet.loc14_3.1: %Destroy.type = facet_value constants.%Array.3b5, (constants.%DestroyImpl.impl_witness.be3, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.843] -// CHECK:STDOUT: %.loc14_3.2: %Destroy.type = converted constants.%Array.3b5, %Destroy.facet.loc14_3.1 [concrete = constants.%Destroy.facet.843] -// CHECK:STDOUT: %Destroy.facet.loc14_3.2: %Destroy.type = facet_value constants.%Array.3b5, (constants.%DestroyImpl.impl_witness.be3, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.843] -// CHECK:STDOUT: %.loc14_3.3: %Destroy.type = converted constants.%Array.3b5, %Destroy.facet.loc14_3.2 [concrete = constants.%Destroy.facet.843] +// CHECK:STDOUT: %Destroy.facet.loc20_3.1: %Destroy.type = facet_value constants.%Array.3b5, (constants.%DestroyImpl.impl_witness.be3, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.843] +// CHECK:STDOUT: %.loc20_3.2: %Destroy.type = converted constants.%Array.3b5, %Destroy.facet.loc20_3.1 [concrete = constants.%Destroy.facet.843] +// CHECK:STDOUT: %Destroy.facet.loc20_3.2: %Destroy.type = facet_value constants.%Array.3b5, (constants.%DestroyImpl.impl_witness.be3, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.843] +// CHECK:STDOUT: %.loc20_3.3: %Destroy.type = converted constants.%Array.3b5, %Destroy.facet.loc20_3.2 [concrete = constants.%Destroy.facet.843] // CHECK:STDOUT: // CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%n.var) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc14_3.1(%self.param: ref %i32) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc20_3.1(%self.param: ref %i32) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc14_3.2(%self.param: ref %Array.3b5) { +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc20_3.2(%self.param: ref %Array.3b5) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int_41: Core.IntLiteral = int_value 41 [concrete = constants.%int_41] -// CHECK:STDOUT: %.loc14_3.1: ref %i32 = array_index %self.param, %int_41 -// CHECK:STDOUT: %Destroy.facet.loc14_3.1: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.2: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.1 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc14_3.2: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.3: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.2 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.1: ref %i32 = array_index %self.param, %int_41 +// CHECK:STDOUT: %Destroy.facet.loc20_3.1: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.2: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.1 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_3.2: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.3: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.2 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc14_3.1: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%.loc14_3.1) +// CHECK:STDOUT: %SelfDestruct.call.loc20_3.1: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%.loc20_3.1) // CHECK:STDOUT: %int_40: Core.IntLiteral = int_value 40 [concrete = constants.%int_40] -// CHECK:STDOUT: %.loc14_3.4: ref %i32 = array_index %self.param, %int_40 -// CHECK:STDOUT: %Destroy.facet.loc14_3.3: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.5: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.3 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc14_3.4: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.6: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.4 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.4: ref %i32 = array_index %self.param, %int_40 +// CHECK:STDOUT: %Destroy.facet.loc20_3.3: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.5: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.3 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_3.4: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.6: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.4 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc14_3.2: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%.loc14_3.4) +// CHECK:STDOUT: %SelfDestruct.call.loc20_3.2: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%.loc20_3.4) // CHECK:STDOUT: %int_39: Core.IntLiteral = int_value 39 [concrete = constants.%int_39] -// CHECK:STDOUT: %.loc14_3.7: ref %i32 = array_index %self.param, %int_39 -// CHECK:STDOUT: %Destroy.facet.loc14_3.5: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.8: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.5 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc14_3.6: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.9: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.6 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.7: ref %i32 = array_index %self.param, %int_39 +// CHECK:STDOUT: %Destroy.facet.loc20_3.5: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.8: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.5 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_3.6: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.9: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.6 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc14_3.3: init %empty_tuple.type = call %SelfDestruct.specific_fn.3(%.loc14_3.7) +// CHECK:STDOUT: %SelfDestruct.call.loc20_3.3: init %empty_tuple.type = call %SelfDestruct.specific_fn.3(%.loc20_3.7) // CHECK:STDOUT: %int_38: Core.IntLiteral = int_value 38 [concrete = constants.%int_38] -// CHECK:STDOUT: %.loc14_3.10: ref %i32 = array_index %self.param, %int_38 -// CHECK:STDOUT: %Destroy.facet.loc14_3.7: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.11: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.7 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc14_3.8: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.12: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.8 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.10: ref %i32 = array_index %self.param, %int_38 +// CHECK:STDOUT: %Destroy.facet.loc20_3.7: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.11: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.7 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_3.8: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.12: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.8 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc14_3.4: init %empty_tuple.type = call %SelfDestruct.specific_fn.4(%.loc14_3.10) +// CHECK:STDOUT: %SelfDestruct.call.loc20_3.4: init %empty_tuple.type = call %SelfDestruct.specific_fn.4(%.loc20_3.10) // CHECK:STDOUT: %int_37: Core.IntLiteral = int_value 37 [concrete = constants.%int_37] -// CHECK:STDOUT: %.loc14_3.13: ref %i32 = array_index %self.param, %int_37 -// CHECK:STDOUT: %Destroy.facet.loc14_3.9: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.14: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.9 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc14_3.10: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.15: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.10 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.13: ref %i32 = array_index %self.param, %int_37 +// CHECK:STDOUT: %Destroy.facet.loc20_3.9: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.14: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.9 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_3.10: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.15: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.10 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc14_3.5: init %empty_tuple.type = call %SelfDestruct.specific_fn.5(%.loc14_3.13) +// CHECK:STDOUT: %SelfDestruct.call.loc20_3.5: init %empty_tuple.type = call %SelfDestruct.specific_fn.5(%.loc20_3.13) // CHECK:STDOUT: %int_36: Core.IntLiteral = int_value 36 [concrete = constants.%int_36] -// CHECK:STDOUT: %.loc14_3.16: ref %i32 = array_index %self.param, %int_36 -// CHECK:STDOUT: %Destroy.facet.loc14_3.11: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.17: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.11 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc14_3.12: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.18: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.12 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.16: ref %i32 = array_index %self.param, %int_36 +// CHECK:STDOUT: %Destroy.facet.loc20_3.11: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.17: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.11 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_3.12: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.18: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.12 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc14_3.6: init %empty_tuple.type = call %SelfDestruct.specific_fn.6(%.loc14_3.16) +// CHECK:STDOUT: %SelfDestruct.call.loc20_3.6: init %empty_tuple.type = call %SelfDestruct.specific_fn.6(%.loc20_3.16) // CHECK:STDOUT: %int_35: Core.IntLiteral = int_value 35 [concrete = constants.%int_35] -// CHECK:STDOUT: %.loc14_3.19: ref %i32 = array_index %self.param, %int_35 -// CHECK:STDOUT: %Destroy.facet.loc14_3.13: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.20: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.13 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc14_3.14: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.21: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.14 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.19: ref %i32 = array_index %self.param, %int_35 +// CHECK:STDOUT: %Destroy.facet.loc20_3.13: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.20: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.13 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_3.14: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.21: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.14 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc14_3.7: init %empty_tuple.type = call %SelfDestruct.specific_fn.7(%.loc14_3.19) +// CHECK:STDOUT: %SelfDestruct.call.loc20_3.7: init %empty_tuple.type = call %SelfDestruct.specific_fn.7(%.loc20_3.19) // CHECK:STDOUT: %int_34: Core.IntLiteral = int_value 34 [concrete = constants.%int_34] -// CHECK:STDOUT: %.loc14_3.22: ref %i32 = array_index %self.param, %int_34 -// CHECK:STDOUT: %Destroy.facet.loc14_3.15: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.23: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.15 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc14_3.16: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.24: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.16 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.22: ref %i32 = array_index %self.param, %int_34 +// CHECK:STDOUT: %Destroy.facet.loc20_3.15: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.23: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.15 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_3.16: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.24: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.16 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc14_3.8: init %empty_tuple.type = call %SelfDestruct.specific_fn.8(%.loc14_3.22) +// CHECK:STDOUT: %SelfDestruct.call.loc20_3.8: init %empty_tuple.type = call %SelfDestruct.specific_fn.8(%.loc20_3.22) // CHECK:STDOUT: %int_33: Core.IntLiteral = int_value 33 [concrete = constants.%int_33] -// CHECK:STDOUT: %.loc14_3.25: ref %i32 = array_index %self.param, %int_33 -// CHECK:STDOUT: %Destroy.facet.loc14_3.17: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.26: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.17 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc14_3.18: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.27: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.18 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.25: ref %i32 = array_index %self.param, %int_33 +// CHECK:STDOUT: %Destroy.facet.loc20_3.17: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.26: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.17 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_3.18: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.27: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.18 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc14_3.9: init %empty_tuple.type = call %SelfDestruct.specific_fn.9(%.loc14_3.25) +// CHECK:STDOUT: %SelfDestruct.call.loc20_3.9: init %empty_tuple.type = call %SelfDestruct.specific_fn.9(%.loc20_3.25) // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %.loc14_3.28: ref %i32 = array_index %self.param, %int_32 -// CHECK:STDOUT: %Destroy.facet.loc14_3.19: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.29: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.19 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc14_3.20: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.30: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.20 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.28: ref %i32 = array_index %self.param, %int_32 +// CHECK:STDOUT: %Destroy.facet.loc20_3.19: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.29: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.19 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_3.20: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.30: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.20 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc14_3.10: init %empty_tuple.type = call %SelfDestruct.specific_fn.10(%.loc14_3.28) +// CHECK:STDOUT: %SelfDestruct.call.loc20_3.10: init %empty_tuple.type = call %SelfDestruct.specific_fn.10(%.loc20_3.28) // CHECK:STDOUT: %int_31: Core.IntLiteral = int_value 31 [concrete = constants.%int_31] -// CHECK:STDOUT: %.loc14_3.31: ref %i32 = array_index %self.param, %int_31 -// CHECK:STDOUT: %Destroy.facet.loc14_3.21: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.32: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.21 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc14_3.22: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.33: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.22 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.31: ref %i32 = array_index %self.param, %int_31 +// CHECK:STDOUT: %Destroy.facet.loc20_3.21: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.32: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.21 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_3.22: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.33: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.22 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc14_3.11: init %empty_tuple.type = call %SelfDestruct.specific_fn.11(%.loc14_3.31) +// CHECK:STDOUT: %SelfDestruct.call.loc20_3.11: init %empty_tuple.type = call %SelfDestruct.specific_fn.11(%.loc20_3.31) // CHECK:STDOUT: %int_30: Core.IntLiteral = int_value 30 [concrete = constants.%int_30] -// CHECK:STDOUT: %.loc14_3.34: ref %i32 = array_index %self.param, %int_30 -// CHECK:STDOUT: %Destroy.facet.loc14_3.23: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.35: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.23 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc14_3.24: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.36: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.24 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.34: ref %i32 = array_index %self.param, %int_30 +// CHECK:STDOUT: %Destroy.facet.loc20_3.23: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.35: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.23 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_3.24: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.36: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.24 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc14_3.12: init %empty_tuple.type = call %SelfDestruct.specific_fn.12(%.loc14_3.34) +// CHECK:STDOUT: %SelfDestruct.call.loc20_3.12: init %empty_tuple.type = call %SelfDestruct.specific_fn.12(%.loc20_3.34) // CHECK:STDOUT: %int_29: Core.IntLiteral = int_value 29 [concrete = constants.%int_29] -// CHECK:STDOUT: %.loc14_3.37: ref %i32 = array_index %self.param, %int_29 -// CHECK:STDOUT: %Destroy.facet.loc14_3.25: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.38: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.25 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc14_3.26: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.39: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.26 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.37: ref %i32 = array_index %self.param, %int_29 +// CHECK:STDOUT: %Destroy.facet.loc20_3.25: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.38: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.25 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_3.26: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.39: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.26 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc14_3.13: init %empty_tuple.type = call %SelfDestruct.specific_fn.13(%.loc14_3.37) +// CHECK:STDOUT: %SelfDestruct.call.loc20_3.13: init %empty_tuple.type = call %SelfDestruct.specific_fn.13(%.loc20_3.37) // CHECK:STDOUT: %int_28: Core.IntLiteral = int_value 28 [concrete = constants.%int_28] -// CHECK:STDOUT: %.loc14_3.40: ref %i32 = array_index %self.param, %int_28 -// CHECK:STDOUT: %Destroy.facet.loc14_3.27: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.41: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.27 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc14_3.28: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.42: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.28 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.40: ref %i32 = array_index %self.param, %int_28 +// CHECK:STDOUT: %Destroy.facet.loc20_3.27: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.41: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.27 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_3.28: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.42: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.28 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc14_3.14: init %empty_tuple.type = call %SelfDestruct.specific_fn.14(%.loc14_3.40) +// CHECK:STDOUT: %SelfDestruct.call.loc20_3.14: init %empty_tuple.type = call %SelfDestruct.specific_fn.14(%.loc20_3.40) // CHECK:STDOUT: %int_27: Core.IntLiteral = int_value 27 [concrete = constants.%int_27] -// CHECK:STDOUT: %.loc14_3.43: ref %i32 = array_index %self.param, %int_27 -// CHECK:STDOUT: %Destroy.facet.loc14_3.29: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.44: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.29 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc14_3.30: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.45: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.30 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.43: ref %i32 = array_index %self.param, %int_27 +// CHECK:STDOUT: %Destroy.facet.loc20_3.29: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.44: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.29 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_3.30: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.45: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.30 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc14_3.15: init %empty_tuple.type = call %SelfDestruct.specific_fn.15(%.loc14_3.43) +// CHECK:STDOUT: %SelfDestruct.call.loc20_3.15: init %empty_tuple.type = call %SelfDestruct.specific_fn.15(%.loc20_3.43) // CHECK:STDOUT: %int_26: Core.IntLiteral = int_value 26 [concrete = constants.%int_26] -// CHECK:STDOUT: %.loc14_3.46: ref %i32 = array_index %self.param, %int_26 -// CHECK:STDOUT: %Destroy.facet.loc14_3.31: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.47: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.31 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc14_3.32: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.48: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.32 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.46: ref %i32 = array_index %self.param, %int_26 +// CHECK:STDOUT: %Destroy.facet.loc20_3.31: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.47: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.31 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_3.32: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.48: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.32 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc14_3.16: init %empty_tuple.type = call %SelfDestruct.specific_fn.16(%.loc14_3.46) +// CHECK:STDOUT: %SelfDestruct.call.loc20_3.16: init %empty_tuple.type = call %SelfDestruct.specific_fn.16(%.loc20_3.46) // CHECK:STDOUT: %int_25: Core.IntLiteral = int_value 25 [concrete = constants.%int_25] -// CHECK:STDOUT: %.loc14_3.49: ref %i32 = array_index %self.param, %int_25 -// CHECK:STDOUT: %Destroy.facet.loc14_3.33: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.50: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.33 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc14_3.34: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.51: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.34 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.49: ref %i32 = array_index %self.param, %int_25 +// CHECK:STDOUT: %Destroy.facet.loc20_3.33: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.50: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.33 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_3.34: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.51: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.34 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc14_3.17: init %empty_tuple.type = call %SelfDestruct.specific_fn.17(%.loc14_3.49) +// CHECK:STDOUT: %SelfDestruct.call.loc20_3.17: init %empty_tuple.type = call %SelfDestruct.specific_fn.17(%.loc20_3.49) // CHECK:STDOUT: %int_24: Core.IntLiteral = int_value 24 [concrete = constants.%int_24] -// CHECK:STDOUT: %.loc14_3.52: ref %i32 = array_index %self.param, %int_24 -// CHECK:STDOUT: %Destroy.facet.loc14_3.35: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.53: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.35 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc14_3.36: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.54: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.36 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.52: ref %i32 = array_index %self.param, %int_24 +// CHECK:STDOUT: %Destroy.facet.loc20_3.35: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.53: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.35 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_3.36: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.54: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.36 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc14_3.18: init %empty_tuple.type = call %SelfDestruct.specific_fn.18(%.loc14_3.52) +// CHECK:STDOUT: %SelfDestruct.call.loc20_3.18: init %empty_tuple.type = call %SelfDestruct.specific_fn.18(%.loc20_3.52) // CHECK:STDOUT: %int_23: Core.IntLiteral = int_value 23 [concrete = constants.%int_23] -// CHECK:STDOUT: %.loc14_3.55: ref %i32 = array_index %self.param, %int_23 -// CHECK:STDOUT: %Destroy.facet.loc14_3.37: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.56: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.37 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc14_3.38: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.57: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.38 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.55: ref %i32 = array_index %self.param, %int_23 +// CHECK:STDOUT: %Destroy.facet.loc20_3.37: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.56: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.37 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_3.38: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.57: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.38 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc14_3.19: init %empty_tuple.type = call %SelfDestruct.specific_fn.19(%.loc14_3.55) +// CHECK:STDOUT: %SelfDestruct.call.loc20_3.19: init %empty_tuple.type = call %SelfDestruct.specific_fn.19(%.loc20_3.55) // CHECK:STDOUT: %int_22: Core.IntLiteral = int_value 22 [concrete = constants.%int_22] -// CHECK:STDOUT: %.loc14_3.58: ref %i32 = array_index %self.param, %int_22 -// CHECK:STDOUT: %Destroy.facet.loc14_3.39: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.59: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.39 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc14_3.40: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.60: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.40 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.58: ref %i32 = array_index %self.param, %int_22 +// CHECK:STDOUT: %Destroy.facet.loc20_3.39: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.59: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.39 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_3.40: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.60: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.40 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc14_3.20: init %empty_tuple.type = call %SelfDestruct.specific_fn.20(%.loc14_3.58) +// CHECK:STDOUT: %SelfDestruct.call.loc20_3.20: init %empty_tuple.type = call %SelfDestruct.specific_fn.20(%.loc20_3.58) // CHECK:STDOUT: %int_21: Core.IntLiteral = int_value 21 [concrete = constants.%int_21] -// CHECK:STDOUT: %.loc14_3.61: ref %i32 = array_index %self.param, %int_21 -// CHECK:STDOUT: %Destroy.facet.loc14_3.41: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.62: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.41 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc14_3.42: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.63: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.42 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.61: ref %i32 = array_index %self.param, %int_21 +// CHECK:STDOUT: %Destroy.facet.loc20_3.41: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.62: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.41 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_3.42: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.63: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.42 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc14_3.21: init %empty_tuple.type = call %SelfDestruct.specific_fn.21(%.loc14_3.61) +// CHECK:STDOUT: %SelfDestruct.call.loc20_3.21: init %empty_tuple.type = call %SelfDestruct.specific_fn.21(%.loc20_3.61) // CHECK:STDOUT: %int_20: Core.IntLiteral = int_value 20 [concrete = constants.%int_20] -// CHECK:STDOUT: %.loc14_3.64: ref %i32 = array_index %self.param, %int_20 -// CHECK:STDOUT: %Destroy.facet.loc14_3.43: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.65: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.43 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc14_3.44: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.66: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.44 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.64: ref %i32 = array_index %self.param, %int_20 +// CHECK:STDOUT: %Destroy.facet.loc20_3.43: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.65: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.43 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_3.44: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.66: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.44 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc14_3.22: init %empty_tuple.type = call %SelfDestruct.specific_fn.22(%.loc14_3.64) +// CHECK:STDOUT: %SelfDestruct.call.loc20_3.22: init %empty_tuple.type = call %SelfDestruct.specific_fn.22(%.loc20_3.64) // CHECK:STDOUT: %int_19: Core.IntLiteral = int_value 19 [concrete = constants.%int_19] -// CHECK:STDOUT: %.loc14_3.67: ref %i32 = array_index %self.param, %int_19 -// CHECK:STDOUT: %Destroy.facet.loc14_3.45: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.68: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.45 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc14_3.46: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.69: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.46 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.67: ref %i32 = array_index %self.param, %int_19 +// CHECK:STDOUT: %Destroy.facet.loc20_3.45: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.68: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.45 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_3.46: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.69: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.46 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc14_3.23: init %empty_tuple.type = call %SelfDestruct.specific_fn.23(%.loc14_3.67) +// CHECK:STDOUT: %SelfDestruct.call.loc20_3.23: init %empty_tuple.type = call %SelfDestruct.specific_fn.23(%.loc20_3.67) // CHECK:STDOUT: %int_18: Core.IntLiteral = int_value 18 [concrete = constants.%int_18] -// CHECK:STDOUT: %.loc14_3.70: ref %i32 = array_index %self.param, %int_18 -// CHECK:STDOUT: %Destroy.facet.loc14_3.47: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.71: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.47 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc14_3.48: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.72: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.48 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.70: ref %i32 = array_index %self.param, %int_18 +// CHECK:STDOUT: %Destroy.facet.loc20_3.47: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.71: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.47 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_3.48: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.72: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.48 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc14_3.24: init %empty_tuple.type = call %SelfDestruct.specific_fn.24(%.loc14_3.70) +// CHECK:STDOUT: %SelfDestruct.call.loc20_3.24: init %empty_tuple.type = call %SelfDestruct.specific_fn.24(%.loc20_3.70) // CHECK:STDOUT: %int_17: Core.IntLiteral = int_value 17 [concrete = constants.%int_17] -// CHECK:STDOUT: %.loc14_3.73: ref %i32 = array_index %self.param, %int_17 -// CHECK:STDOUT: %Destroy.facet.loc14_3.49: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.74: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.49 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc14_3.50: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.75: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.50 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.73: ref %i32 = array_index %self.param, %int_17 +// CHECK:STDOUT: %Destroy.facet.loc20_3.49: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.74: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.49 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_3.50: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.75: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.50 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc14_3.25: init %empty_tuple.type = call %SelfDestruct.specific_fn.25(%.loc14_3.73) +// CHECK:STDOUT: %SelfDestruct.call.loc20_3.25: init %empty_tuple.type = call %SelfDestruct.specific_fn.25(%.loc20_3.73) // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16] -// CHECK:STDOUT: %.loc14_3.76: ref %i32 = array_index %self.param, %int_16 -// CHECK:STDOUT: %Destroy.facet.loc14_3.51: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.77: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.51 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc14_3.52: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.78: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.52 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.76: ref %i32 = array_index %self.param, %int_16 +// CHECK:STDOUT: %Destroy.facet.loc20_3.51: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.77: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.51 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_3.52: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.78: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.52 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc14_3.26: init %empty_tuple.type = call %SelfDestruct.specific_fn.26(%.loc14_3.76) +// CHECK:STDOUT: %SelfDestruct.call.loc20_3.26: init %empty_tuple.type = call %SelfDestruct.specific_fn.26(%.loc20_3.76) // CHECK:STDOUT: %int_15: Core.IntLiteral = int_value 15 [concrete = constants.%int_15] -// CHECK:STDOUT: %.loc14_3.79: ref %i32 = array_index %self.param, %int_15 -// CHECK:STDOUT: %Destroy.facet.loc14_3.53: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.80: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.53 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc14_3.54: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.81: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.54 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.79: ref %i32 = array_index %self.param, %int_15 +// CHECK:STDOUT: %Destroy.facet.loc20_3.53: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.80: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.53 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_3.54: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.81: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.54 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc14_3.27: init %empty_tuple.type = call %SelfDestruct.specific_fn.27(%.loc14_3.79) +// CHECK:STDOUT: %SelfDestruct.call.loc20_3.27: init %empty_tuple.type = call %SelfDestruct.specific_fn.27(%.loc20_3.79) // CHECK:STDOUT: %int_14: Core.IntLiteral = int_value 14 [concrete = constants.%int_14] -// CHECK:STDOUT: %.loc14_3.82: ref %i32 = array_index %self.param, %int_14 -// CHECK:STDOUT: %Destroy.facet.loc14_3.55: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.83: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.55 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc14_3.56: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.84: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.56 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.82: ref %i32 = array_index %self.param, %int_14 +// CHECK:STDOUT: %Destroy.facet.loc20_3.55: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.83: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.55 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_3.56: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.84: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.56 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc14_3.28: init %empty_tuple.type = call %SelfDestruct.specific_fn.28(%.loc14_3.82) +// CHECK:STDOUT: %SelfDestruct.call.loc20_3.28: init %empty_tuple.type = call %SelfDestruct.specific_fn.28(%.loc20_3.82) // CHECK:STDOUT: %int_13: Core.IntLiteral = int_value 13 [concrete = constants.%int_13] -// CHECK:STDOUT: %.loc14_3.85: ref %i32 = array_index %self.param, %int_13 -// CHECK:STDOUT: %Destroy.facet.loc14_3.57: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.86: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.57 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc14_3.58: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.87: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.58 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.85: ref %i32 = array_index %self.param, %int_13 +// CHECK:STDOUT: %Destroy.facet.loc20_3.57: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.86: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.57 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_3.58: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.87: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.58 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc14_3.29: init %empty_tuple.type = call %SelfDestruct.specific_fn.29(%.loc14_3.85) +// CHECK:STDOUT: %SelfDestruct.call.loc20_3.29: init %empty_tuple.type = call %SelfDestruct.specific_fn.29(%.loc20_3.85) // CHECK:STDOUT: %int_12: Core.IntLiteral = int_value 12 [concrete = constants.%int_12] -// CHECK:STDOUT: %.loc14_3.88: ref %i32 = array_index %self.param, %int_12 -// CHECK:STDOUT: %Destroy.facet.loc14_3.59: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.89: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.59 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc14_3.60: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.90: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.60 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.88: ref %i32 = array_index %self.param, %int_12 +// CHECK:STDOUT: %Destroy.facet.loc20_3.59: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.89: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.59 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_3.60: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.90: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.60 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc14_3.30: init %empty_tuple.type = call %SelfDestruct.specific_fn.30(%.loc14_3.88) +// CHECK:STDOUT: %SelfDestruct.call.loc20_3.30: init %empty_tuple.type = call %SelfDestruct.specific_fn.30(%.loc20_3.88) // CHECK:STDOUT: %int_11: Core.IntLiteral = int_value 11 [concrete = constants.%int_11] -// CHECK:STDOUT: %.loc14_3.91: ref %i32 = array_index %self.param, %int_11 -// CHECK:STDOUT: %Destroy.facet.loc14_3.61: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.92: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.61 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc14_3.62: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.93: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.62 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.91: ref %i32 = array_index %self.param, %int_11 +// CHECK:STDOUT: %Destroy.facet.loc20_3.61: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.92: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.61 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_3.62: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.93: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.62 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc14_3.31: init %empty_tuple.type = call %SelfDestruct.specific_fn.31(%.loc14_3.91) +// CHECK:STDOUT: %SelfDestruct.call.loc20_3.31: init %empty_tuple.type = call %SelfDestruct.specific_fn.31(%.loc20_3.91) // CHECK:STDOUT: %int_10: Core.IntLiteral = int_value 10 [concrete = constants.%int_10] -// CHECK:STDOUT: %.loc14_3.94: ref %i32 = array_index %self.param, %int_10 -// CHECK:STDOUT: %Destroy.facet.loc14_3.63: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.95: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.63 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc14_3.64: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.96: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.64 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.94: ref %i32 = array_index %self.param, %int_10 +// CHECK:STDOUT: %Destroy.facet.loc20_3.63: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.95: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.63 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_3.64: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.96: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.64 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc14_3.32: init %empty_tuple.type = call %SelfDestruct.specific_fn.32(%.loc14_3.94) +// CHECK:STDOUT: %SelfDestruct.call.loc20_3.32: init %empty_tuple.type = call %SelfDestruct.specific_fn.32(%.loc20_3.94) // CHECK:STDOUT: %int_9: Core.IntLiteral = int_value 9 [concrete = constants.%int_9] -// CHECK:STDOUT: %.loc14_3.97: ref %i32 = array_index %self.param, %int_9 -// CHECK:STDOUT: %Destroy.facet.loc14_3.65: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.98: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.65 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc14_3.66: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.99: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.66 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.97: ref %i32 = array_index %self.param, %int_9 +// CHECK:STDOUT: %Destroy.facet.loc20_3.65: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.98: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.65 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_3.66: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.99: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.66 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc14_3.33: init %empty_tuple.type = call %SelfDestruct.specific_fn.33(%.loc14_3.97) +// CHECK:STDOUT: %SelfDestruct.call.loc20_3.33: init %empty_tuple.type = call %SelfDestruct.specific_fn.33(%.loc20_3.97) // CHECK:STDOUT: %int_8: Core.IntLiteral = int_value 8 [concrete = constants.%int_8] -// CHECK:STDOUT: %.loc14_3.100: ref %i32 = array_index %self.param, %int_8 -// CHECK:STDOUT: %Destroy.facet.loc14_3.67: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.101: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.67 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc14_3.68: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.102: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.68 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.100: ref %i32 = array_index %self.param, %int_8 +// CHECK:STDOUT: %Destroy.facet.loc20_3.67: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.101: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.67 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_3.68: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.102: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.68 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc14_3.34: init %empty_tuple.type = call %SelfDestruct.specific_fn.34(%.loc14_3.100) +// CHECK:STDOUT: %SelfDestruct.call.loc20_3.34: init %empty_tuple.type = call %SelfDestruct.specific_fn.34(%.loc20_3.100) // CHECK:STDOUT: %int_7: Core.IntLiteral = int_value 7 [concrete = constants.%int_7] -// CHECK:STDOUT: %.loc14_3.103: ref %i32 = array_index %self.param, %int_7 -// CHECK:STDOUT: %Destroy.facet.loc14_3.69: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.104: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.69 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc14_3.70: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.105: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.70 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.103: ref %i32 = array_index %self.param, %int_7 +// CHECK:STDOUT: %Destroy.facet.loc20_3.69: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.104: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.69 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_3.70: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.105: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.70 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc14_3.35: init %empty_tuple.type = call %SelfDestruct.specific_fn.35(%.loc14_3.103) +// CHECK:STDOUT: %SelfDestruct.call.loc20_3.35: init %empty_tuple.type = call %SelfDestruct.specific_fn.35(%.loc20_3.103) // CHECK:STDOUT: %int_6: Core.IntLiteral = int_value 6 [concrete = constants.%int_6] -// CHECK:STDOUT: %.loc14_3.106: ref %i32 = array_index %self.param, %int_6 -// CHECK:STDOUT: %Destroy.facet.loc14_3.71: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.107: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.71 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc14_3.72: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.108: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.72 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.106: ref %i32 = array_index %self.param, %int_6 +// CHECK:STDOUT: %Destroy.facet.loc20_3.71: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.107: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.71 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_3.72: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.108: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.72 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc14_3.36: init %empty_tuple.type = call %SelfDestruct.specific_fn.36(%.loc14_3.106) +// CHECK:STDOUT: %SelfDestruct.call.loc20_3.36: init %empty_tuple.type = call %SelfDestruct.specific_fn.36(%.loc20_3.106) // CHECK:STDOUT: %int_5: Core.IntLiteral = int_value 5 [concrete = constants.%int_5] -// CHECK:STDOUT: %.loc14_3.109: ref %i32 = array_index %self.param, %int_5 -// CHECK:STDOUT: %Destroy.facet.loc14_3.73: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.110: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.73 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc14_3.74: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.111: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.74 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.109: ref %i32 = array_index %self.param, %int_5 +// CHECK:STDOUT: %Destroy.facet.loc20_3.73: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.110: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.73 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_3.74: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.111: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.74 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc14_3.37: init %empty_tuple.type = call %SelfDestruct.specific_fn.37(%.loc14_3.109) +// CHECK:STDOUT: %SelfDestruct.call.loc20_3.37: init %empty_tuple.type = call %SelfDestruct.specific_fn.37(%.loc20_3.109) // CHECK:STDOUT: %int_4: Core.IntLiteral = int_value 4 [concrete = constants.%int_4] -// CHECK:STDOUT: %.loc14_3.112: ref %i32 = array_index %self.param, %int_4 -// CHECK:STDOUT: %Destroy.facet.loc14_3.75: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.113: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.75 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc14_3.76: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.114: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.76 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.112: ref %i32 = array_index %self.param, %int_4 +// CHECK:STDOUT: %Destroy.facet.loc20_3.75: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.113: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.75 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_3.76: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.114: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.76 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc14_3.38: init %empty_tuple.type = call %SelfDestruct.specific_fn.38(%.loc14_3.112) +// CHECK:STDOUT: %SelfDestruct.call.loc20_3.38: init %empty_tuple.type = call %SelfDestruct.specific_fn.38(%.loc20_3.112) // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3] -// CHECK:STDOUT: %.loc14_3.115: ref %i32 = array_index %self.param, %int_3 -// CHECK:STDOUT: %Destroy.facet.loc14_3.77: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.116: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.77 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc14_3.78: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.117: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.78 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.115: ref %i32 = array_index %self.param, %int_3 +// CHECK:STDOUT: %Destroy.facet.loc20_3.77: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.116: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.77 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_3.78: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.117: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.78 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc14_3.39: init %empty_tuple.type = call %SelfDestruct.specific_fn.39(%.loc14_3.115) +// CHECK:STDOUT: %SelfDestruct.call.loc20_3.39: init %empty_tuple.type = call %SelfDestruct.specific_fn.39(%.loc20_3.115) // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2] -// CHECK:STDOUT: %.loc14_3.118: ref %i32 = array_index %self.param, %int_2 -// CHECK:STDOUT: %Destroy.facet.loc14_3.79: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.119: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.79 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc14_3.80: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.120: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.80 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.118: ref %i32 = array_index %self.param, %int_2 +// CHECK:STDOUT: %Destroy.facet.loc20_3.79: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.119: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.79 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_3.80: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.120: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.80 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc14_3.40: init %empty_tuple.type = call %SelfDestruct.specific_fn.40(%.loc14_3.118) +// CHECK:STDOUT: %SelfDestruct.call.loc20_3.40: init %empty_tuple.type = call %SelfDestruct.specific_fn.40(%.loc20_3.118) // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] -// CHECK:STDOUT: %.loc14_3.121: ref %i32 = array_index %self.param, %int_1 -// CHECK:STDOUT: %Destroy.facet.loc14_3.81: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.122: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.81 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc14_3.82: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.123: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.82 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.121: ref %i32 = array_index %self.param, %int_1 +// CHECK:STDOUT: %Destroy.facet.loc20_3.81: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.122: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.81 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_3.82: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.123: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.82 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc14_3.41: init %empty_tuple.type = call %SelfDestruct.specific_fn.41(%.loc14_3.121) +// CHECK:STDOUT: %SelfDestruct.call.loc20_3.41: init %empty_tuple.type = call %SelfDestruct.specific_fn.41(%.loc20_3.121) // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] -// CHECK:STDOUT: %.loc14_3.124: ref %i32 = array_index %self.param, %int_0 -// CHECK:STDOUT: %Destroy.facet.loc14_3.83: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.125: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.83 [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %Destroy.facet.loc14_3.84: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] -// CHECK:STDOUT: %.loc14_3.126: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.84 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.124: ref %i32 = array_index %self.param, %int_0 +// CHECK:STDOUT: %Destroy.facet.loc20_3.83: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.125: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.83 [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %Destroy.facet.loc20_3.84: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b] +// CHECK:STDOUT: %.loc20_3.126: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.84 [concrete = constants.%Destroy.facet.c2b] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc14_3.42: init %empty_tuple.type = call %SelfDestruct.specific_fn.42(%.loc14_3.124) +// CHECK:STDOUT: %SelfDestruct.call.loc20_3.42: init %empty_tuple.type = call %SelfDestruct.specific_fn.42(%.loc20_3.124) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interop/cpp/function/import/default_arg.carbon b/toolchain/check/testdata/interop/cpp/function/import/default_arg.carbon index 65973fb0c697..d493be337a16 100644 --- a/toolchain/check/testdata/interop/cpp/function/import/default_arg.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/default_arg.carbon @@ -63,45 +63,114 @@ import Cpp library "functions.h"; fn Call() { //@dump-sem-ir-begin - // CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE+4]]:3-20: error: no matching function for call to 'GlobalNoReturn' [CppInteropParseError] - // CHECK:STDERR: ./functions.h:2:6: note: candidate function not viable [CppInteropParseNote] - // CHECK:STDERR: ./functions.h:2:21-54: note: requires at least 2 arguments, but 1 was provided [CppInteropParseNoteReason] + // CHECK:STDERR: ╭─┤ fail_call_too_few_args.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: -> │ Cpp.GlobalNoReturn(1); + // CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'GlobalNoReturn' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./functions.h + // CHECK:STDERR: │ auto GlobalNoReturn(int a, int b, int c = 1, int d = 2) -> void; + // CHECK:STDERR: · ┬ ────┬───────────────────────────── + // CHECK:STDERR: · ╰─────────────────────┤ candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: · ╰────┤ requires at least 2 arguments, but 1 was provided + // CHECK:STDERR: · │ [CppInteropParseNoteReason] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.GlobalNoReturn(1); - // CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE+4]]:3-20: error: no matching function for call to 'GlobalNoReturn' [CppInteropParseError] - // CHECK:STDERR: ./functions.h:2:6: note: candidate function not viable [CppInteropParseNote] - // CHECK:STDERR: ./functions.h:2:21-54: note: requires at least 2 arguments, but 0 were provided [CppInteropParseNoteReason] + // CHECK:STDERR: ╭─┤ fail_call_too_few_args.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: -> │ Cpp.GlobalNoReturn(); + // CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'GlobalNoReturn' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./functions.h + // CHECK:STDERR: │ auto GlobalNoReturn(int a, int b, int c = 1, int d = 2) -> void; + // CHECK:STDERR: · ┬ ───┬────────────────────────────── + // CHECK:STDERR: · ╰────────────────────┤ candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: · ╰────┤ requires at least 2 arguments, but 0 were provided + // CHECK:STDERR: · │ [CppInteropParseNoteReason] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.GlobalNoReturn(); - // CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE+4]]:3-21: error: no matching function for call to 'GlobalReturnInt' [CppInteropParseError] - // CHECK:STDERR: ./functions.h:3:6: note: candidate function not viable [CppInteropParseNote] - // CHECK:STDERR: ./functions.h:3:22-55: note: requires at least 2 arguments, but 1 was provided [CppInteropParseNoteReason] + // CHECK:STDERR: ╭─┤ fail_call_too_few_args.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: -> │ Cpp.GlobalReturnInt(1); + // CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'GlobalReturnInt' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./functions.h + // CHECK:STDERR: │ auto GlobalReturnInt(int a, int b, int c = 1, int d = 2) -> int; + // CHECK:STDERR: · ┬ ───┬────────────────────────────── + // CHECK:STDERR: · ╰─────────────────────┤ candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: · ╰────┤ requires at least 2 arguments, but 1 was provided + // CHECK:STDERR: · │ [CppInteropParseNoteReason] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.GlobalReturnInt(1); - // CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE+4]]:3-21: error: no matching function for call to 'GlobalReturnInt' [CppInteropParseError] - // CHECK:STDERR: ./functions.h:3:6: note: candidate function not viable [CppInteropParseNote] - // CHECK:STDERR: ./functions.h:3:22-55: note: requires at least 2 arguments, but 0 were provided [CppInteropParseNoteReason] + // CHECK:STDERR: ╭─┤ fail_call_too_few_args.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: -> │ Cpp.GlobalReturnInt(); + // CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'GlobalReturnInt' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./functions.h + // CHECK:STDERR: │ auto GlobalReturnInt(int a, int b, int c = 1, int d = 2) -> int; + // CHECK:STDERR: · ┬ ──┬─────────────────────────────── + // CHECK:STDERR: · ╰────────────────────┤ candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: · ╰────┤ requires at least 2 arguments, but 0 were provided + // CHECK:STDERR: · │ [CppInteropParseNoteReason] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.GlobalReturnInt(); - // CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE+4]]:3-17: error: no matching function for call to 'B' [CppInteropParseError] - // CHECK:STDERR: ./functions.h:6:8: note: candidate function not viable [CppInteropParseNote] - // CHECK:STDERR: ./functions.h:6:10-25: note: requires at least argument 'a', but no arguments were provided [CppInteropParseNoteReason] + // CHECK:STDERR: ╭─┤ fail_call_too_few_args.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: -> │ ({} as Cpp.X).B(); + // CHECK:STDERR: · ━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'B' [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./functions.h + // CHECK:STDERR: │ void B(int a, int b = 1); + // CHECK:STDERR: · ┬ ──┬───────────── + // CHECK:STDERR: · ╰──────┤ candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: · ╰────┤ requires at least argument 'a', but no arguments were provided + // CHECK:STDERR: · │ [CppInteropParseNoteReason] + // CHECK:STDERR: ╰──── // CHECK:STDERR: ({} as Cpp.X).B(); - // CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE+4]]:3-9: error: no matching function for call to 'C' [CppInteropParseError] - // CHECK:STDERR: ./functions.h:7:15: note: candidate function not viable [CppInteropParseNote] - // CHECK:STDERR: ./functions.h:7:17-32: note: requires at least argument 'a', but no arguments were provided [CppInteropParseNoteReason] + // CHECK:STDERR: ╭─┤ fail_call_too_few_args.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: -> │ Cpp.X.C(); + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'C' [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./functions.h + // CHECK:STDERR: │ static void C(int a, int b = 1); + // CHECK:STDERR: · ┬ ┬─────────────── + // CHECK:STDERR: · ╰────┤ candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: · ╰────┤ requires at least argument 'a', but no arguments were + // CHECK:STDERR: · │ provided + // CHECK:STDERR: · │ [CppInteropParseNoteReason] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.X.C(); - // CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE+4]]:3-17: error: no matching function for call to 'D' [CppInteropParseError] - // CHECK:STDERR: ./functions.h:8:8: note: candidate function not viable [CppInteropParseNote] - // CHECK:STDERR: ./functions.h:8:10-33: note: requires at least non-object argument 'a', but no arguments were provided [CppInteropParseNoteReason] + // CHECK:STDERR: ╭─┤ fail_call_too_few_args.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: -> │ ({} as Cpp.X).D(); + // CHECK:STDERR: · ━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'D' [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./functions.h + // CHECK:STDERR: │ void D(this X, int a, int b = 1); + // CHECK:STDERR: · ┬ ┬─────────────────────── + // CHECK:STDERR: · ╰────┤ candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: · ╰────┤ requires at least non-object argument 'a', but no arguments were + // CHECK:STDERR: · │ provided + // CHECK:STDERR: · │ [CppInteropParseNoteReason] + // CHECK:STDERR: ╰──── // CHECK:STDERR: ({} as Cpp.X).D(); //@dump-sem-ir-end @@ -921,49 +990,49 @@ fn Call() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Call() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Cpp.ref.loc12: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %GlobalNoReturn.ref.loc12: %GlobalNoReturn.cpp_overload_set.type = name_ref GlobalNoReturn, imports.%GlobalNoReturn.cpp_overload_set.value [concrete = constants.%GlobalNoReturn.cpp_overload_set.value] -// CHECK:STDOUT: %int_1.loc12: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] -// CHECK:STDOUT: %Cpp.ref.loc18: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %GlobalNoReturn.ref.loc18: %GlobalNoReturn.cpp_overload_set.type = name_ref GlobalNoReturn, imports.%GlobalNoReturn.cpp_overload_set.value [concrete = constants.%GlobalNoReturn.cpp_overload_set.value] -// CHECK:STDOUT: %Cpp.ref.loc24: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %GlobalReturnInt.ref.loc24: %GlobalReturnInt.cpp_overload_set.type = name_ref GlobalReturnInt, imports.%GlobalReturnInt.cpp_overload_set.value [concrete = constants.%GlobalReturnInt.cpp_overload_set.value] -// CHECK:STDOUT: %int_1.loc24: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] -// CHECK:STDOUT: %Cpp.ref.loc30: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %GlobalReturnInt.ref.loc30: %GlobalReturnInt.cpp_overload_set.type = name_ref GlobalReturnInt, imports.%GlobalReturnInt.cpp_overload_set.value [concrete = constants.%GlobalReturnInt.cpp_overload_set.value] -// CHECK:STDOUT: %.loc36_5.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %Cpp.ref.loc36: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %X.ref.loc36: type = name_ref X, imports.%X.decl [concrete = constants.%X] -// CHECK:STDOUT: %.loc36_5.2: ref %X = temporary_storage -// CHECK:STDOUT: %.loc36_5.3: init %X to %.loc36_5.2 = class_init () [concrete = constants.%X.val] -// CHECK:STDOUT: %.loc36_7.1: init %X = converted %.loc36_5.1, %.loc36_5.3 [concrete = constants.%X.val] -// CHECK:STDOUT: %.loc36_7.2: ref %X = temporary %.loc36_5.2, %.loc36_7.1 [concrete = constants.%.414] +// CHECK:STDOUT: %Cpp.ref.loc22: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %GlobalNoReturn.ref.loc22: %GlobalNoReturn.cpp_overload_set.type = name_ref GlobalNoReturn, imports.%GlobalNoReturn.cpp_overload_set.value [concrete = constants.%GlobalNoReturn.cpp_overload_set.value] +// CHECK:STDOUT: %int_1.loc22: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] +// CHECK:STDOUT: %Cpp.ref.loc38: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %GlobalNoReturn.ref.loc38: %GlobalNoReturn.cpp_overload_set.type = name_ref GlobalNoReturn, imports.%GlobalNoReturn.cpp_overload_set.value [concrete = constants.%GlobalNoReturn.cpp_overload_set.value] +// CHECK:STDOUT: %Cpp.ref.loc54: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %GlobalReturnInt.ref.loc54: %GlobalReturnInt.cpp_overload_set.type = name_ref GlobalReturnInt, imports.%GlobalReturnInt.cpp_overload_set.value [concrete = constants.%GlobalReturnInt.cpp_overload_set.value] +// CHECK:STDOUT: %int_1.loc54: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] +// CHECK:STDOUT: %Cpp.ref.loc70: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %GlobalReturnInt.ref.loc70: %GlobalReturnInt.cpp_overload_set.type = name_ref GlobalReturnInt, imports.%GlobalReturnInt.cpp_overload_set.value [concrete = constants.%GlobalReturnInt.cpp_overload_set.value] +// CHECK:STDOUT: %.loc85_5.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %Cpp.ref.loc85: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %X.ref.loc85: type = name_ref X, imports.%X.decl [concrete = constants.%X] +// CHECK:STDOUT: %.loc85_5.2: ref %X = temporary_storage +// CHECK:STDOUT: %.loc85_5.3: init %X to %.loc85_5.2 = class_init () [concrete = constants.%X.val] +// CHECK:STDOUT: %.loc85_7.1: init %X = converted %.loc85_5.1, %.loc85_5.3 [concrete = constants.%X.val] +// CHECK:STDOUT: %.loc85_7.2: ref %X = temporary %.loc85_5.2, %.loc85_7.1 [concrete = constants.%.414] // CHECK:STDOUT: %B.ref: %X.B.cpp_overload_set.type = name_ref B, imports.%X.B.cpp_overload_set.value [concrete = constants.%X.B.cpp_overload_set.value] -// CHECK:STDOUT: %bound_method.loc36: = bound_method %.loc36_7.2, %B.ref [concrete = constants.%bound_method.f8c] -// CHECK:STDOUT: %Destroy.facet.loc36_7.1: %Destroy.type = facet_value constants.%X, (constants.%DestroyImpl.impl_witness.a05, constants.%custom_witness.576) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc36_7.3: %Destroy.type = converted constants.%X, %Destroy.facet.loc36_7.1 [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %Destroy.facet.loc36_7.2: %Destroy.type = facet_value constants.%X, (constants.%DestroyImpl.impl_witness.a05, constants.%custom_witness.576) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc36_7.4: %Destroy.type = converted constants.%X, %Destroy.facet.loc36_7.2 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %bound_method.loc85: = bound_method %.loc85_7.2, %B.ref [concrete = constants.%bound_method.f8c] +// CHECK:STDOUT: %Destroy.facet.loc85_7.1: %Destroy.type = facet_value constants.%X, (constants.%DestroyImpl.impl_witness.a05, constants.%custom_witness.576) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc85_7.3: %Destroy.type = converted constants.%X, %Destroy.facet.loc85_7.1 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %Destroy.facet.loc85_7.2: %Destroy.type = facet_value constants.%X, (constants.%DestroyImpl.impl_witness.a05, constants.%custom_witness.576) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc85_7.4: %Destroy.type = converted constants.%X, %Destroy.facet.loc85_7.2 [concrete = constants.%Destroy.facet] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc36: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%.loc36_7.2) -// CHECK:STDOUT: %Cpp.ref.loc42: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %X.ref.loc42: type = name_ref X, imports.%X.decl [concrete = constants.%X] +// CHECK:STDOUT: %SelfDestruct.call.loc85: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%.loc85_7.2) +// CHECK:STDOUT: %Cpp.ref.loc101: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %X.ref.loc101: type = name_ref X, imports.%X.decl [concrete = constants.%X] // CHECK:STDOUT: %C.ref: %X.C.cpp_overload_set.type = name_ref C, imports.%X.C.cpp_overload_set.value [concrete = constants.%X.C.cpp_overload_set.value] -// CHECK:STDOUT: %.loc48_5.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %Cpp.ref.loc48: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %X.ref.loc48: type = name_ref X, imports.%X.decl [concrete = constants.%X] -// CHECK:STDOUT: %.loc48_5.2: ref %X = temporary_storage -// CHECK:STDOUT: %.loc48_5.3: init %X to %.loc48_5.2 = class_init () [concrete = constants.%X.val] -// CHECK:STDOUT: %.loc48_7.1: init %X = converted %.loc48_5.1, %.loc48_5.3 [concrete = constants.%X.val] -// CHECK:STDOUT: %.loc48_7.2: ref %X = temporary %.loc48_5.2, %.loc48_7.1 [concrete = constants.%.414] +// CHECK:STDOUT: %.loc117_5.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %Cpp.ref.loc117: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %X.ref.loc117: type = name_ref X, imports.%X.decl [concrete = constants.%X] +// CHECK:STDOUT: %.loc117_5.2: ref %X = temporary_storage +// CHECK:STDOUT: %.loc117_5.3: init %X to %.loc117_5.2 = class_init () [concrete = constants.%X.val] +// CHECK:STDOUT: %.loc117_7.1: init %X = converted %.loc117_5.1, %.loc117_5.3 [concrete = constants.%X.val] +// CHECK:STDOUT: %.loc117_7.2: ref %X = temporary %.loc117_5.2, %.loc117_7.1 [concrete = constants.%.414] // CHECK:STDOUT: %D.ref: %X.D.cpp_overload_set.type = name_ref D, imports.%X.D.cpp_overload_set.value [concrete = constants.%X.D.cpp_overload_set.value] -// CHECK:STDOUT: %bound_method.loc48: = bound_method %.loc48_7.2, %D.ref [concrete = constants.%bound_method.9a8] -// CHECK:STDOUT: %Destroy.facet.loc48_7.1: %Destroy.type = facet_value constants.%X, (constants.%DestroyImpl.impl_witness.a05, constants.%custom_witness.576) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc48_7.3: %Destroy.type = converted constants.%X, %Destroy.facet.loc48_7.1 [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %Destroy.facet.loc48_7.2: %Destroy.type = facet_value constants.%X, (constants.%DestroyImpl.impl_witness.a05, constants.%custom_witness.576) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc48_7.4: %Destroy.type = converted constants.%X, %Destroy.facet.loc48_7.2 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %bound_method.loc117: = bound_method %.loc117_7.2, %D.ref [concrete = constants.%bound_method.9a8] +// CHECK:STDOUT: %Destroy.facet.loc117_7.1: %Destroy.type = facet_value constants.%X, (constants.%DestroyImpl.impl_witness.a05, constants.%custom_witness.576) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc117_7.3: %Destroy.type = converted constants.%X, %Destroy.facet.loc117_7.1 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %Destroy.facet.loc117_7.2: %Destroy.type = facet_value constants.%X, (constants.%DestroyImpl.impl_witness.a05, constants.%custom_witness.576) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc117_7.4: %Destroy.type = converted constants.%X, %Destroy.facet.loc117_7.2 [concrete = constants.%Destroy.facet] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc48: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%.loc48_7.2) +// CHECK:STDOUT: %SelfDestruct.call.loc117: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%.loc117_7.2) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interop/cpp/function/import/function.carbon b/toolchain/check/testdata/interop/cpp/function/import/function.carbon index 27adb3ede77a..bf997e6066a3 100644 --- a/toolchain/check/testdata/interop/cpp/function/import/function.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/function.carbon @@ -37,7 +37,12 @@ library "[[@TEST_NAME]]"; import Cpp library "global.h"; fn MyF() { - // CHECK:STDERR: fail_import_global_use_different_name.carbon:[[@LINE+2]]:3-9: error: member name `bar` not found in `Cpp` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╭─┤ fail_import_global_use_different_name.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ Cpp.bar(); + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: member name `bar` not found in `Cpp` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.bar(); } @@ -57,7 +62,12 @@ library "[[@TEST_NAME]]"; import Cpp library "special_name.h"; fn MyF() { - // CHECK:STDERR: fail_import_special_name_call_unescaped.carbon:[[@LINE+2]]:3-10: error: member name `base` not found in `Cpp` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╭─┤ fail_import_special_name_call_unescaped.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ Cpp.base(); + // CHECK:STDERR: · ━━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: member name `base` not found in `Cpp` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.base(); } @@ -81,9 +91,19 @@ library "[[@TEST_NAME]]"; import Cpp library "special_name.h"; fn MyF() { - // CHECK:STDERR: fail_import_special_name_call_escaped_no_match.carbon:[[@LINE+4]]:3-12: error: no matching function for call to 'base' [CppInteropParseError] - // CHECK:STDERR: ./special_name.h:2:6: note: candidate function not viable [CppInteropParseNote] - // CHECK:STDERR: ./special_name.h:2:10-11: note: requires 0 arguments, but 1 was provided [CppInteropParseNoteReason] + // CHECK:STDERR: ╭─┤ fail_import_special_name_call_escaped_no_match.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: -> │ Cpp.r#base(1); + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'base' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./special_name.h + // CHECK:STDERR: │ auto base() -> void; + // CHECK:STDERR: · ┬ ─┬ + // CHECK:STDERR: · ╰───────┤ candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: · ╰────┤ requires 0 arguments, but 1 was provided + // CHECK:STDERR: · │ [CppInteropParseNoteReason] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.r#base(1); } @@ -125,7 +145,12 @@ import Cpp library "variadic.h"; fn F() { //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_import_variadic.carbon:[[@LINE+2]]:3-21: error: semantics TODO: `Unsupported: Variadic function` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_import_variadic.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ Cpp.variadic_foo(8); + // CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `Unsupported: Variadic function` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.variadic_foo(8); //@dump-sem-ir-end @@ -138,7 +163,19 @@ fn F() { // --- static.h // TODO: Promote this warning to an error by default. -// CHECK:STDERR: ./static.h:[[@LINE+1]]:13: warning: function 'static_foo' has internal linkage but is not defined [CppInteropParseWarning] +// CHECK:STDERR: ╭─┤ ./static.h:[[@LINE+13]]:13 +// CHECK:STDERR: -> │ static auto static_foo() -> void; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ warning: function 'static_foo' has internal linkage but is not +// CHECK:STDERR: · ┃ defined +// CHECK:STDERR: · ┃ [CppInteropParseWarning] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ todo_fail_import_static.carbon +// CHECK:STDERR: │ Cpp.static_foo(); +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ used here [CppInteropParseNote] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: static auto static_foo() -> void; // --- todo_fail_import_static.carbon @@ -149,8 +186,6 @@ import Cpp library "static.h"; fn F() { //@dump-sem-ir-begin - // CHECK:STDERR: todo_fail_import_static.carbon:[[@LINE+2]]:18: note: used here [CppInteropParseNote] - // CHECK:STDERR: Cpp.static_foo(); //@dump-sem-ir-end } diff --git a/toolchain/check/testdata/interop/cpp/function/import/function_ptr.carbon b/toolchain/check/testdata/interop/cpp/function/import/function_ptr.carbon index 5ffb25461698..8e038b0c8982 100644 --- a/toolchain/check/testdata/interop/cpp/function/import/function_ptr.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/function_ptr.carbon @@ -126,8 +126,22 @@ fn F() { // --- forward_decl.h -// CHECK:STDERR: error: calling function with incomplete return type 'Incomplete' [CppInteropParseError] -// CHECK:STDERR: ./forward_decl.h:[[@LINE+1]]:7: note: forward declaration of 'Incomplete' [CppInteropParseNote] +// CHECK:STDERR: -> ╭─┤ +// CHECK:STDERR: · ┗━━┫ error: calling function with incomplete return type 'Incomplete' +// CHECK:STDERR: · ┃ [CppInteropParseError] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ ./forward_decl.h:[[@LINE+12]]:7 +// CHECK:STDERR: │ class Incomplete; +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ forward declaration of 'Incomplete' [CppInteropParseNote] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ fail_use_forward_decl.carbon +// CHECK:STDERR: │ Cpp.ReturnCallback()(); +// CHECK:STDERR: · ───────────┬────────── +// CHECK:STDERR: · ╰──┤ in thunk for C++ function pointer type used here +// CHECK:STDERR: · │ [InCppFunctionPointerThunk] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: class Incomplete; using CallbackType = Incomplete (*)(); @@ -151,12 +165,21 @@ library "[[@TEST_NAME]]"; import Cpp library "forward_decl.h"; fn F() { - // CHECK:STDERR: fail_use_forward_decl.carbon:[[@LINE+7]]:3-24: note: in thunk for C++ function pointer type used here [InCppFunctionPointerThunk] - // CHECK:STDERR: - // CHECK:STDERR: fail_use_forward_decl.carbon:[[@LINE+5]]:3-24: error: function returns incomplete type `Cpp.Incomplete` [IncompleteTypeInFunctionReturnType] - // CHECK:STDERR: included from: fail_use_forward_decl.carbon:[[@LINE-6]]:10 [InCppInclude] - // CHECK:STDERR: ./forward_decl.h:4:7: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: note: return type declared here [IncompleteReturnTypeHere] + // CHECK:STDERR: ╭─┤ fail_use_forward_decl.carbon:[[@LINE+16]]:3 + // CHECK:STDERR: -> │ Cpp.ReturnCallback()(); + // CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: function returns incomplete type `Cpp.Incomplete` + // CHECK:STDERR: · ┃ [IncompleteTypeInFunctionReturnType] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ ╭── included from: fail_use_forward_decl.carbon [InCppInclude] + // CHECK:STDERR: ├─┤ ./forward_decl.h + // CHECK:STDERR: │ class Incomplete; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ + // CHECK:STDERR: · ╰──┤ return type declared here [IncompleteReturnTypeHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.ReturnCallback()(); } @@ -171,7 +194,13 @@ using MyCallbackType = void(*)(int); fn MyCallback(generic arg: i32); fn F() { - // CHECK:STDERR: fail_convert_generic_arg.carbon:[[@LINE+2]]:43-52: error: semantics TODO: `binding maps to a non-type template parameter` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_convert_generic_arg.carbon:[[@LINE+8]]:43 + // CHECK:STDERR: -> │ var unused fn_ptr: Cpp.MyCallbackType = MyCallback; + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: semantics TODO: `binding maps to a non-type template parameter` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused fn_ptr: Cpp.MyCallbackType = MyCallback; } @@ -186,8 +215,19 @@ using MyCallbackType = void(*)(int); fn MyCallback(arg: i32) -> i32; fn F() { - // CHECK:STDERR: fail_convert_type_mismatch.carbon:[[@LINE+3]]:43-52: error: can't convert exported function pointer to `void (*)(int)` [ExportedFunctionPtrTypeMismatch] - // CHECK:STDERR: fail_convert_type_mismatch.carbon:[[@LINE-4]]:1-31: note: function exported with pointer type `int (*)(int)` [ExportedFromFunction] + // CHECK:STDERR: ╭─┤ fail_convert_type_mismatch.carbon:[[@LINE+14]]:43 + // CHECK:STDERR: │ fn MyCallback(arg: i32) -> i32; + // CHECK:STDERR: · ───────────────┬─────────────── + // CHECK:STDERR: · ╰──┤ function exported with pointer type `int (*)(int)` + // CHECK:STDERR: · │ [ExportedFromFunction] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ var unused fn_ptr: Cpp.MyCallbackType = MyCallback; + // CHECK:STDERR: · ┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: can't convert exported + // CHECK:STDERR: · ┃ function pointer to + // CHECK:STDERR: · ┃ `void (*)(int)` + // CHECK:STDERR: · ┃ [ExportedFunctionPtrTypeMismatch] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused fn_ptr: Cpp.MyCallbackType = MyCallback; } diff --git a/toolchain/check/testdata/interop/cpp/function/import/inline.carbon b/toolchain/check/testdata/interop/cpp/function/import/inline.carbon index 4d0cacf97fda..8b9d8990babe 100644 --- a/toolchain/check/testdata/interop/cpp/function/import/inline.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/inline.carbon @@ -37,7 +37,18 @@ fn MyF() { // --- without_definition.h // TODO: Promote this warning to an error by default. -// CHECK:STDERR: ./without_definition.h:[[@LINE+1]]:13: warning: inline function 'inline_without_def' is not defined [CppInteropParseWarning] +// CHECK:STDERR: ╭─┤ ./without_definition.h:[[@LINE+12]]:13 +// CHECK:STDERR: -> │ inline void inline_without_def(); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ warning: inline function 'inline_without_def' is not defined +// CHECK:STDERR: · ┃ [CppInteropParseWarning] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ todo_fail_import_without_definition.carbon +// CHECK:STDERR: │ Cpp.inline_without_def(); +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ used here [CppInteropParseNote] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: inline void inline_without_def(); // --- todo_fail_import_without_definition.carbon @@ -48,8 +59,6 @@ import Cpp library "without_definition.h"; fn MyF() { //@dump-sem-ir-begin - // CHECK:STDERR: todo_fail_import_without_definition.carbon:[[@LINE+2]]:26: note: used here [CppInteropParseNote] - // CHECK:STDERR: Cpp.inline_without_def(); // Don't error on repeated calls. @@ -131,12 +140,12 @@ fn MyF() { // CHECK:STDOUT: // CHECK:STDOUT: fn @MyF() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Cpp.ref.loc10: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %inline_without_def.ref.loc10: %inline_without_def.cpp_overload_set.type = name_ref inline_without_def, imports.%inline_without_def.cpp_overload_set.value [concrete = constants.%inline_without_def.cpp_overload_set.value] -// CHECK:STDOUT: %inline_without_def.call.loc10: init %empty_tuple.type = call imports.%inline_without_def.decl() -// CHECK:STDOUT: %Cpp.ref.loc13: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %inline_without_def.ref.loc13: %inline_without_def.cpp_overload_set.type = name_ref inline_without_def, imports.%inline_without_def.cpp_overload_set.value [concrete = constants.%inline_without_def.cpp_overload_set.value] -// CHECK:STDOUT: %inline_without_def.call.loc13: init %empty_tuple.type = call imports.%inline_without_def.decl() +// CHECK:STDOUT: %Cpp.ref.loc8: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %inline_without_def.ref.loc8: %inline_without_def.cpp_overload_set.type = name_ref inline_without_def, imports.%inline_without_def.cpp_overload_set.value [concrete = constants.%inline_without_def.cpp_overload_set.value] +// CHECK:STDOUT: %inline_without_def.call.loc8: init %empty_tuple.type = call imports.%inline_without_def.decl() +// CHECK:STDOUT: %Cpp.ref.loc11: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %inline_without_def.ref.loc11: %inline_without_def.cpp_overload_set.type = name_ref inline_without_def, imports.%inline_without_def.cpp_overload_set.value [concrete = constants.%inline_without_def.cpp_overload_set.value] +// CHECK:STDOUT: %inline_without_def.call.loc11: init %empty_tuple.type = call imports.%inline_without_def.decl() // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interop/cpp/function/import/method_ptr.carbon b/toolchain/check/testdata/interop/cpp/function/import/method_ptr.carbon index 8e629d9e774f..24319b28d172 100644 --- a/toolchain/check/testdata/interop/cpp/function/import/method_ptr.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/method_ptr.carbon @@ -75,15 +75,44 @@ library "[[@TEST_NAME]]"; import Cpp library "method_ptr.h"; fn F(c: Cpp.C) { - // CHECK:STDERR: fail_todo_call_method_ptr.carbon:[[@LINE+10]]:3-24: error: member name of type `` in compound member access is not an instance member or an interface member [CompoundMemberAccessDoesNotUseBase] + // CHECK:STDERR: ╭─┤ fail_todo_call_method_ptr.carbon:[[@LINE+39]]:3 + // CHECK:STDERR: -> │ c.(Cpp.GetMethodPtr())(42); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: member name of type `` in + // CHECK:STDERR: · ┃ compound member access is not an instance member or an interface + // CHECK:STDERR: · ┃ member + // CHECK:STDERR: · ┃ [CompoundMemberAccessDoesNotUseBase] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_todo_call_method_ptr.carbon:[[@LINE+8]]:3-28: error: semantics TODO: `invoking a C++ member function pointer is unsupported` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_call_method_ptr.carbon:[[@LINE+30]]:3 + // CHECK:STDERR: -> │ c.(Cpp.GetMethodPtr())(42); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: + // CHECK:STDERR: · ┃ `invoking a C++ member function pointer is unsupported` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: error: called object type 'void (C::*)() const' is not a function or function pointer [CppInteropParseError] - // CHECK:STDERR: fail_todo_call_method_ptr.carbon:[[@LINE+5]]:3-28: note: in thunk for C++ function pointer type used here [InCppFunctionPointerThunk] + // CHECK:STDERR: -> ╭─┤ + // CHECK:STDERR: · ┗━━┫ error: called object type 'void (C::*)() const' is not a function or + // CHECK:STDERR: · ┃ function pointer + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ fail_todo_call_method_ptr.carbon:[[@LINE+17]]:3 + // CHECK:STDERR: │ c.(Cpp.GetMethodPtr())(42); + // CHECK:STDERR: · ─────────────┬──────────── + // CHECK:STDERR: · ╰──┤ in thunk for C++ function pointer type used here + // CHECK:STDERR: · │ [InCppFunctionPointerThunk] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_todo_call_method_ptr.carbon:[[@LINE+3]]:3-28: error: 1 argument passed to function expecting 0 arguments [CallArgCountMismatch] - // CHECK:STDERR: fail_todo_call_method_ptr.carbon: note: calling function declared here [InCallToEntity] + // CHECK:STDERR: ╭─┤ fail_todo_call_method_ptr.carbon:[[@LINE+10]]:3 + // CHECK:STDERR: -> │ c.(Cpp.GetMethodPtr())(42); + // CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: 1 argument passed to function expecting 0 arguments + // CHECK:STDERR: · ┃ [CallArgCountMismatch] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ fail_todo_call_method_ptr.carbon + // CHECK:STDERR: · ╰──┤ calling function declared here [InCallToEntity] + // CHECK:STDERR: ╰──── // CHECK:STDERR: c.(Cpp.GetMethodPtr())(42); } @@ -96,8 +125,19 @@ import Cpp library "method_ptr.h"; fn F(ref c: Cpp.C); fn G() { - // CHECK:STDERR: fail_pass_function_for_method.carbon:[[@LINE+3]]:39: error: can't convert exported function pointer to `void (C::*)(void) const` [ExportedFunctionPtrTypeMismatch] - // CHECK:STDERR: fail_pass_function_for_method.carbon:[[@LINE-4]]:1-19: note: function exported with pointer type `void (*)(class C &)` [ExportedFromFunction] + // CHECK:STDERR: ╭─┤ fail_pass_function_for_method.carbon:[[@LINE+14]]:39 + // CHECK:STDERR: │ fn F(ref c: Cpp.C); + // CHECK:STDERR: · ─────────┬───────── + // CHECK:STDERR: · ╰──┤ function exported with pointer type `void (*)(class C &)` + // CHECK:STDERR: · │ [ExportedFromFunction] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ var unused ptr: Cpp.MethodPtrType = F; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: can't convert exported + // CHECK:STDERR: · ┃ function pointer to + // CHECK:STDERR: · ┃ `void (C::*)(void) const` + // CHECK:STDERR: · ┃ [ExportedFunctionPtrTypeMismatch] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused ptr: Cpp.MethodPtrType = F; } @@ -112,8 +152,20 @@ class C { } fn F() { - // CHECK:STDERR: fail_wrong_parent_type.carbon:[[@LINE+3]]:39-46: error: can't convert exported member function pointer to `void (C::*)(void) const` [ExportedFunctionPtrTypeMismatch] - // CHECK:STDERR: fail_wrong_parent_type.carbon:[[@LINE-5]]:3-18: note: function exported with pointer type `void (Carbon::Main::C::*)(void) const` [ExportedFromFunction] + // CHECK:STDERR: ╭─┤ fail_wrong_parent_type.carbon:[[@LINE+15]]:39 + // CHECK:STDERR: │ fn Method(self); + // CHECK:STDERR: · ┬─────────────── + // CHECK:STDERR: · ╰──┤ function exported with pointer type + // CHECK:STDERR: · │ `void (Carbon::Main::C::*)(void) const` + // CHECK:STDERR: · │ [ExportedFromFunction] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ var unused ptr: Cpp.MethodPtrType = C.Method; + // CHECK:STDERR: · ┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: can't convert exported member + // CHECK:STDERR: · ┃ function pointer to + // CHECK:STDERR: · ┃ `void (C::*)(void) const` + // CHECK:STDERR: · ┃ [ExportedFunctionPtrTypeMismatch] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused ptr: Cpp.MethodPtrType = C.Method; } @@ -133,8 +185,20 @@ using MethodPtrType = void(Carbon::C::*)(float) const; fn G() { //@dump-sem-ir-begin - // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+3]]:39-46: error: can't convert exported member function pointer to `void (Carbon::Main::C::*)(float) const` [ExportedFunctionPtrTypeMismatch] - // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE-10]]:3-26: note: function exported with pointer type `void (Carbon::Main::C::*)(int) const` [ExportedFromFunction] + // CHECK:STDERR: ╭─┤ fail_type_mismatch.carbon:[[@LINE+15]]:39 + // CHECK:STDERR: │ fn Method(self, i: i32); + // CHECK:STDERR: · ┬─────────────────────── + // CHECK:STDERR: · ╰──┤ function exported with pointer type + // CHECK:STDERR: · │ `void (Carbon::Main::C::*)(int) const` + // CHECK:STDERR: · │ [ExportedFromFunction] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ var unused ptr: Cpp.MethodPtrType = C.Method; + // CHECK:STDERR: · ━━━━┳━━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: can't convert exported member function pointer to + // CHECK:STDERR: · ┃ `void (Carbon::Main::C::*)(float) const` + // CHECK:STDERR: · ┃ [ExportedFunctionPtrTypeMismatch] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused ptr: Cpp.MethodPtrType = C.Method; //@dump-sem-ir-end @@ -415,7 +479,7 @@ fn G() { // CHECK:STDOUT: %T.09f: %SubobjectDestroy.type = symbolic_binding T, 0 [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.type.dea: type = fn_type @T.as_type.as.DestroyImpl.impl.Op, @T.as_type.as.DestroyImpl.impl(%T.09f) [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.6e5: %T.as_type.as.DestroyImpl.impl.Op.type.dea = struct_value () [symbolic] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.3: type = fn_type @SubobjectDestroy.WithSelf.Op.loc18 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.3: type = fn_type @SubobjectDestroy.WithSelf.Op.loc30 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.3: %SubobjectDestroy.WithSelf.Op.type.6870fd.3 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80ef6.3: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.3), @SubobjectDestroy [concrete] // CHECK:STDOUT: %SubobjectDestroy.facet.886: %SubobjectDestroy.type = facet_value %.659, (%custom_witness.b80ef6.3) [concrete] @@ -438,7 +502,7 @@ fn G() { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %Method.ref: %C.Method.type = name_ref Method, @C.%C.Method.decl [concrete = constants.%C.Method] // CHECK:STDOUT: assign %ptr.var, -// CHECK:STDOUT: %.loc18_22: type = splice_block %MethodPtrType.ref [concrete = constants.%.659] { +// CHECK:STDOUT: %.loc30_22: type = splice_block %MethodPtrType.ref [concrete = constants.%.659] { // CHECK:STDOUT: %Cpp.ref: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %MethodPtrType.ref: type = name_ref MethodPtrType, constants.%.659 [concrete = constants.%.659] // CHECK:STDOUT: } @@ -447,10 +511,10 @@ fn G() { // CHECK:STDOUT: %ptr.patt: %pattern_type.4b7 = ref_binding_pattern ptr [concrete = constants.%ptr.patt] // CHECK:STDOUT: %ptr.var_patt: %pattern_type.4b7 = var_pattern %ptr.patt [concrete = constants.%ptr.var_patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.facet.loc18_3.1: %Destroy.type = facet_value constants.%.659, (constants.%DestroyImpl.impl_witness.381, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.f79] -// CHECK:STDOUT: %.loc18_3.1: %Destroy.type = converted constants.%.659, %Destroy.facet.loc18_3.1 [concrete = constants.%Destroy.facet.f79] -// CHECK:STDOUT: %Destroy.facet.loc18_3.2: %Destroy.type = facet_value constants.%.659, (constants.%DestroyImpl.impl_witness.381, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.f79] -// CHECK:STDOUT: %.loc18_3.2: %Destroy.type = converted constants.%.659, %Destroy.facet.loc18_3.2 [concrete = constants.%Destroy.facet.f79] +// CHECK:STDOUT: %Destroy.facet.loc30_3.1: %Destroy.type = facet_value constants.%.659, (constants.%DestroyImpl.impl_witness.381, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.f79] +// CHECK:STDOUT: %.loc30_3.1: %Destroy.type = converted constants.%.659, %Destroy.facet.loc30_3.1 [concrete = constants.%Destroy.facet.f79] +// CHECK:STDOUT: %Destroy.facet.loc30_3.2: %Destroy.type = facet_value constants.%.659, (constants.%DestroyImpl.impl_witness.381, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.f79] +// CHECK:STDOUT: %.loc30_3.2: %Destroy.type = converted constants.%.659, %Destroy.facet.loc30_3.2 [concrete = constants.%Destroy.facet.f79] // CHECK:STDOUT: // CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%ptr.var) // CHECK:STDOUT: @@ -459,10 +523,10 @@ fn G() { // CHECK:STDOUT: fn @C.Method__carbon_thunk(%self.param: ref %C, %_.param: ref %i32) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: -// CHECK:STDOUT: %.loc18_40.1: %C = acquire_value %self.param -// CHECK:STDOUT: %.loc18_40.2: %i32 = acquire_value %_.param +// CHECK:STDOUT: %.loc30_40.1: %C = acquire_value %self.param +// CHECK:STDOUT: %.loc30_40.2: %i32 = acquire_value %_.param // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc18(%self.param: ref %.659) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc30(%self.param: ref %.659) = "no_op"; // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interop/cpp/function/import/multiple_too_few_args_calls.carbon b/toolchain/check/testdata/interop/cpp/function/import/multiple_too_few_args_calls.carbon index c5e50ac26bd8..91a8c20fd2d8 100644 --- a/toolchain/check/testdata/interop/cpp/function/import/multiple_too_few_args_calls.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/multiple_too_few_args_calls.carbon @@ -22,14 +22,30 @@ void F2(X x); fn Call() { //@dump-sem-ir-begin - // CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE+4]]:3-8: error: no matching function for call to 'F1' [CppInteropParseError] - // CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE-7]]:6: note: candidate function not viable [CppInteropParseNote] - // CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE-8]]:9-11: note: requires single argument 'x', but no arguments were provided [CppInteropParseNoteReason] + // CHECK:STDERR: ╭─┤ fail_call_too_few_args.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ void F1(X x); + // CHECK:STDERR: · ┬ ─┬─ + // CHECK:STDERR: · ╰──────┤ candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: · ╰────┤ requires single argument 'x', but no arguments were provided + // CHECK:STDERR: · │ [CppInteropParseNoteReason] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Cpp.F1(); + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'F1' [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.F1(); - // CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE+4]]:3-8: error: no matching function for call to 'F2' [CppInteropParseError] - // CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE-11]]:6: note: candidate function not viable [CppInteropParseNote] - // CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE-12]]:9-11: note: requires single argument 'x', but no arguments were provided [CppInteropParseNoteReason] + // CHECK:STDERR: ╭─┤ fail_call_too_few_args.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ void F2(X x); + // CHECK:STDERR: · ┬ ─┬─ + // CHECK:STDERR: · ╰──────┤ candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: · ╰────┤ requires single argument 'x', but no arguments were provided + // CHECK:STDERR: · │ [CppInteropParseNoteReason] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Cpp.F2(); + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'F2' [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.F2(); //@dump-sem-ir-end @@ -57,9 +73,9 @@ fn Call() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Call() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Cpp.ref.loc16: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %Cpp.ref.loc24: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %F1.ref: %F1.cpp_overload_set.type = name_ref F1, imports.%F1.cpp_overload_set.value [concrete = constants.%F1.cpp_overload_set.value] -// CHECK:STDOUT: %Cpp.ref.loc21: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %Cpp.ref.loc37: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %F2.ref: %F2.cpp_overload_set.type = name_ref F2, imports.%F2.cpp_overload_set.value [concrete = constants.%F2.cpp_overload_set.value] // CHECK:STDOUT: // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/interop/cpp/function/import/overloads.carbon b/toolchain/check/testdata/interop/cpp/function/import/overloads.carbon index f8ceebfb848b..a629791b93f3 100644 --- a/toolchain/check/testdata/interop/cpp/function/import/overloads.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/overloads.carbon @@ -140,9 +140,23 @@ import Cpp library "int_literal.h"; fn F() { // TODO: get rid of the second error message here. // i128_max + 1 - // CHECK:STDERR: fail_import_large_int_literal.carbon:[[@LINE+4]]:44-82: error: integer value 170141183460469231731687303715884105728 too large to fit in a signed C++ integer type; requires 129 bits, but max is 128 [IntTooLargeForCppType] + // CHECK:STDERR: ╭─┤ fail_import_large_int_literal.carbon:[[@LINE+18]]:44 + // CHECK:STDERR: -> │ ...ed h: i128 = Cpp.int_literal_foo(170141183460469231731687303715884105728); + // CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: integer value 170141183460469231731687303715884105728 too large to fit + // CHECK:STDERR: · ┃ in a signed C++ integer type; requires 129 bits, but max is 128 + // CHECK:STDERR: · ┃ [IntTooLargeForCppType] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_import_large_int_literal.carbon:[[@LINE+2]]:44-82: error: call argument of type `Core.IntLiteral` is not supported [CppCallArgTypeNotSupported] + // CHECK:STDERR: ╭─┤ fail_import_large_int_literal.carbon:[[@LINE+9]]:44 + // CHECK:STDERR: -> │ ...ed h: i128 = Cpp.int_literal_foo(170141183460469231731687303715884105728); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: call argument of type + // CHECK:STDERR: · ┃ `Core.IntLiteral` is not + // CHECK:STDERR: · ┃ supported + // CHECK:STDERR: · ┃ [CppCallArgTypeNotSupported] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused h: i128 = Cpp.int_literal_foo(170141183460469231731687303715884105728); } @@ -174,8 +188,19 @@ library "[[@TEST_NAME]]"; import Cpp library "negative_literal_passed_to_unsigned.h"; fn F() { - // CHECK:STDERR: fail_import_negative_literal_passed_to_unsigned.carbon:[[@LINE+3]]:27-28: error: negative integer value -1 converted to unsigned type `u32` [NegativeIntInUnsignedType] - // CHECK:STDERR: ./negative_literal_passed_to_unsigned.h:2:39: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_import_negative_literal_passed_to_unsigned.carbon:[[@LINE+14]]:27 + // CHECK:STDERR: -> │ Cpp.neg_to_unsigned_foo(-1); + // CHECK:STDERR: · ┳━ + // CHECK:STDERR: · ┗━━┫ error: negative integer value -1 converted to + // CHECK:STDERR: · ┃ unsigned type `u32` + // CHECK:STDERR: · ┃ [NegativeIntInUnsignedType] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./negative_literal_passed_to_unsigned.h + // CHECK:STDERR: │ auto neg_to_unsigned_foo(unsigned int a) -> void; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.neg_to_unsigned_foo(-1); } @@ -202,8 +227,19 @@ library "[[@TEST_NAME]]"; import Cpp library "floating_point_literal.h"; fn F() { - // CHECK:STDERR: fail_import_large_floating_point_literal.carbon:[[@LINE+3]]:25-32: error: value 18*10^307 too large for floating-point type `f64` [FloatLiteralTooLargeForType] - // CHECK:STDERR: ./floating_point_literal.h:3:31: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_import_large_floating_point_literal.carbon:[[@LINE+14]]:25 + // CHECK:STDERR: -> │ Cpp.float_literal_foo(1.8e+308); + // CHECK:STDERR: · ┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: value 18*10^307 too large for floating-point + // CHECK:STDERR: · ┃ type `f64` + // CHECK:STDERR: · ┃ [FloatLiteralTooLargeForType] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./floating_point_literal.h + // CHECK:STDERR: │ auto float_literal_foo(double a) -> double; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.float_literal_foo(1.8e+308); } @@ -247,33 +283,110 @@ import Cpp library "struct_init.h"; fn MakeThreeFields() -> {.a: i32, .b: i32, .c: i32}; fn ThreeFields(value: {.a: i32, .b: i32, .c: i32}, ref reference: {.a: i32, .b: i32, .c: i32}) { - // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+4]]:23-46: error: cannot implicitly convert expression of type `{.a: Core.IntLiteral, .b: Core.IntLiteral, .c: Core.IntLiteral}` to `Cpp.ThreeFields` [ConversionFailure] - // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+3]]:23-46: note: type `{.a: Core.IntLiteral, .b: Core.IntLiteral, .c: Core.IntLiteral}` does not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: ./struct_init.h:10:34: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_todo_struct_init_nonempty.carbon:[[@LINE+20]]:23 + // CHECK:STDERR: -> │ Cpp.PassThreeFields({.a = 1, .b = 2, .c = 3}); + // CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: cannot implicitly convert expression of type + // CHECK:STDERR: · ┃ `{.a: Core.IntLiteral, .b: Core.IntLiteral, .c: Core.IntLiteral}` to + // CHECK:STDERR: · ┃ `Cpp.ThreeFields` + // CHECK:STDERR: · ┃ [ConversionFailure] + // CHECK:STDERR: · ╭─────────────────────────────────╯ + // CHECK:STDERR: · │ type `{.a: Core.IntLiteral, .b: Core.IntLiteral, .c: Core.IntLiteral}` does + // CHECK:STDERR: · │ not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./struct_init.h + // CHECK:STDERR: │ auto PassThreeFields(ThreeFields t) -> void; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.PassThreeFields({.a = 1, .b = 2, .c = 3}); - // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+4]]:23-27: error: cannot implicitly convert expression of type `{.a: i32, .b: i32, .c: i32}` to `Cpp.ThreeFields` [ConversionFailure] - // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+3]]:23-27: note: type `{.a: i32, .b: i32, .c: i32}` does not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: ./struct_init.h:10:34: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_todo_struct_init_nonempty.carbon:[[@LINE+19]]:23 + // CHECK:STDERR: -> │ Cpp.PassThreeFields(value); + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type + // CHECK:STDERR: · │ ┃ `{.a: i32, .b: i32, .c: i32}` to + // CHECK:STDERR: · │ ┃ `Cpp.ThreeFields` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `{.a: i32, .b: i32, .c: i32}` does not + // CHECK:STDERR: · │ implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.ThreeFields)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./struct_init.h + // CHECK:STDERR: │ auto PassThreeFields(ThreeFields t) -> void; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.PassThreeFields(value); - // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+4]]:23-31: error: cannot implicitly convert expression of type `{.a: i32, .b: i32, .c: i32}` to `Cpp.ThreeFields` [ConversionFailure] - // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+3]]:23-31: note: type `{.a: i32, .b: i32, .c: i32}` does not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: ./struct_init.h:10:34: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_todo_struct_init_nonempty.carbon:[[@LINE+19]]:23 + // CHECK:STDERR: -> │ Cpp.PassThreeFields(reference); + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type + // CHECK:STDERR: · │ ┃ `{.a: i32, .b: i32, .c: i32}` to + // CHECK:STDERR: · │ ┃ `Cpp.ThreeFields` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `{.a: i32, .b: i32, .c: i32}` does not + // CHECK:STDERR: · │ implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.ThreeFields)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./struct_init.h + // CHECK:STDERR: │ auto PassThreeFields(ThreeFields t) -> void; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.PassThreeFields(reference); - // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+4]]:23-39: error: cannot implicitly convert expression of type `{.a: i32, .b: i32, .c: i32}` to `Cpp.ThreeFields` [ConversionFailure] - // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+3]]:23-39: note: type `{.a: i32, .b: i32, .c: i32}` does not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: ./struct_init.h:10:34: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_todo_struct_init_nonempty.carbon:[[@LINE+19]]:23 + // CHECK:STDERR: -> │ Cpp.PassThreeFields(MakeThreeFields()); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type + // CHECK:STDERR: · │ ┃ `{.a: i32, .b: i32, .c: i32}` to + // CHECK:STDERR: · │ ┃ `Cpp.ThreeFields` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `{.a: i32, .b: i32, .c: i32}` does not + // CHECK:STDERR: · │ implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.ThreeFields)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./struct_init.h + // CHECK:STDERR: │ auto PassThreeFields(ThreeFields t) -> void; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.PassThreeFields(MakeThreeFields()); - // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+4]]:23-46: error: cannot implicitly convert expression of type `{.b: Core.IntLiteral, .c: Core.IntLiteral, .a: Core.IntLiteral}` to `Cpp.ThreeFields` [ConversionFailure] - // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+3]]:23-46: note: type `{.b: Core.IntLiteral, .c: Core.IntLiteral, .a: Core.IntLiteral}` does not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: ./struct_init.h:10:34: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_todo_struct_init_nonempty.carbon:[[@LINE+20]]:23 + // CHECK:STDERR: -> │ Cpp.PassThreeFields({.b = 1, .c = 2, .a = 3}); + // CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: cannot implicitly convert expression of type + // CHECK:STDERR: · ┃ `{.b: Core.IntLiteral, .c: Core.IntLiteral, .a: Core.IntLiteral}` to + // CHECK:STDERR: · ┃ `Cpp.ThreeFields` + // CHECK:STDERR: · ┃ [ConversionFailure] + // CHECK:STDERR: · ╭─────────────────────────────────╯ + // CHECK:STDERR: · │ type `{.b: Core.IntLiteral, .c: Core.IntLiteral, .a: Core.IntLiteral}` does + // CHECK:STDERR: · │ not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./struct_init.h + // CHECK:STDERR: │ auto PassThreeFields(ThreeFields t) -> void; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.PassThreeFields({.b = 1, .c = 2, .a = 3}); } @@ -285,15 +398,37 @@ library "[[@TEST_NAME]]"; import Cpp library "struct_init.h"; fn F() { - // CHECK:STDERR: fail_struct_init_field_mismatch.carbon:[[@LINE+4]]:3-21: error: no matching function for call to 'PassThreeFields' [CppInteropParseError] - // CHECK:STDERR: ./struct_init.h:10:6: note: candidate function not viable [CppInteropParseNote] - // CHECK:STDERR: ./struct_init.h:10:22-34: note: cannot convert initializer list argument to 'ThreeFields' [CppInteropParseNoteReason] + // CHECK:STDERR: ╭─┤ fail_struct_init_field_mismatch.carbon:[[@LINE+15]]:3 + // CHECK:STDERR: -> │ Cpp.PassThreeFields({.a = 1, .b = 2, .c = 3, .d = 4}); + // CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'PassThreeFields' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./struct_init.h + // CHECK:STDERR: │ auto PassThreeFields(ThreeFields t) -> void; + // CHECK:STDERR: · ┬ ┬──────────── + // CHECK:STDERR: · ╰──────────────────┤ candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: · ╰────┤ cannot convert initializer list argument to + // CHECK:STDERR: · │ 'ThreeFields' + // CHECK:STDERR: · │ [CppInteropParseNoteReason] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.PassThreeFields({.a = 1, .b = 2, .c = 3, .d = 4}); - // CHECK:STDERR: fail_struct_init_field_mismatch.carbon:[[@LINE+4]]:3-21: error: no matching function for call to 'PassThreeFields' [CppInteropParseError] - // CHECK:STDERR: ./struct_init.h:10:6: note: candidate function not viable [CppInteropParseNote] - // CHECK:STDERR: ./struct_init.h:10:22-34: note: cannot convert initializer list argument to 'ThreeFields' [CppInteropParseNoteReason] + // CHECK:STDERR: ╭─┤ fail_struct_init_field_mismatch.carbon:[[@LINE+15]]:3 + // CHECK:STDERR: -> │ Cpp.PassThreeFields({.a = 1, .x = 2, .c = 3}); + // CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'PassThreeFields' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./struct_init.h + // CHECK:STDERR: │ auto PassThreeFields(ThreeFields t) -> void; + // CHECK:STDERR: · ┬ ┬──────────── + // CHECK:STDERR: · ╰──────────────────┤ candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: · ╰────┤ cannot convert initializer list argument to + // CHECK:STDERR: · │ 'ThreeFields' + // CHECK:STDERR: · │ [CppInteropParseNoteReason] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.PassThreeFields({.a = 1, .x = 2, .c = 3}); } @@ -305,7 +440,12 @@ library "[[@TEST_NAME]]"; import Cpp library "struct_init.h"; fn F() { - // CHECK:STDERR: fail_struct_init_unsupported_field_name.carbon:[[@LINE+2]]:23-33: error: field name `base` cannot be mapped into C++ [CppCallFieldNameNotSupported] + // CHECK:STDERR: ╭─┤ fail_struct_init_unsupported_field_name.carbon:[[@LINE+7]]:23 + // CHECK:STDERR: -> │ Cpp.PassThreeFields({.base = 1}); + // CHECK:STDERR: · ━━━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: field name `base` cannot be mapped into C++ + // CHECK:STDERR: · ┃ [CppCallFieldNameNotSupported] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.PassThreeFields({.base = 1}); } @@ -322,27 +462,79 @@ import Cpp library "struct_init.h"; fn MakeEmpty() -> (); fn Empty(value: (), ref reference: ()) { - // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+4]]:20-21: error: cannot implicitly convert expression of type `()` to `Cpp.NoFields` [ConversionFailure] - // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+3]]:20-21: note: type `()` does not implement interface `Core.ImplicitAs(Cpp.NoFields)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: ./struct_init.h:4:28: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_struct_init_from_tuple.carbon:[[@LINE+17]]:20 + // CHECK:STDERR: -> │ Cpp.PassNoFields(()); + // CHECK:STDERR: · ┳━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `()` + // CHECK:STDERR: · │ ┃ to `Cpp.NoFields` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `()` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.NoFields)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./struct_init.h + // CHECK:STDERR: │ auto PassNoFields(NoFields s) -> void; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.PassNoFields(()); - // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+4]]:20-24: error: cannot implicitly convert expression of type `()` to `Cpp.NoFields` [ConversionFailure] - // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+3]]:20-24: note: type `()` does not implement interface `Core.ImplicitAs(Cpp.NoFields)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: ./struct_init.h:4:28: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_struct_init_from_tuple.carbon:[[@LINE+17]]:20 + // CHECK:STDERR: -> │ Cpp.PassNoFields(value); + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `()` + // CHECK:STDERR: · │ ┃ to `Cpp.NoFields` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `()` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.NoFields)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./struct_init.h + // CHECK:STDERR: │ auto PassNoFields(NoFields s) -> void; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.PassNoFields(value); - // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+4]]:20-28: error: cannot implicitly convert expression of type `()` to `Cpp.NoFields` [ConversionFailure] - // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+3]]:20-28: note: type `()` does not implement interface `Core.ImplicitAs(Cpp.NoFields)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: ./struct_init.h:4:28: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_struct_init_from_tuple.carbon:[[@LINE+17]]:20 + // CHECK:STDERR: -> │ Cpp.PassNoFields(reference); + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `()` + // CHECK:STDERR: · │ ┃ to `Cpp.NoFields` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `()` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.NoFields)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./struct_init.h + // CHECK:STDERR: │ auto PassNoFields(NoFields s) -> void; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.PassNoFields(reference); - // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+4]]:20-30: error: cannot implicitly convert expression of type `()` to `Cpp.NoFields` [ConversionFailure] - // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+3]]:20-30: note: type `()` does not implement interface `Core.ImplicitAs(Cpp.NoFields)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: ./struct_init.h:4:28: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_struct_init_from_tuple.carbon:[[@LINE+17]]:20 + // CHECK:STDERR: -> │ Cpp.PassNoFields(MakeEmpty()); + // CHECK:STDERR: · ┳━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `()` + // CHECK:STDERR: · │ ┃ to `Cpp.NoFields` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `()` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.NoFields)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./struct_init.h + // CHECK:STDERR: │ auto PassNoFields(NoFields s) -> void; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.PassNoFields(MakeEmpty()); } @@ -350,27 +542,83 @@ fn Empty(value: (), ref reference: ()) { fn MakeThreeFields() -> (i32, i32, i32); fn ThreeFields(value: (i32, i32, i32), ref reference: (i32, i32, i32)) { - // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+4]]:23-31: error: cannot implicitly convert expression of type `(Core.IntLiteral, Core.IntLiteral, Core.IntLiteral)` to `Cpp.ThreeFields` [ConversionFailure] - // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+3]]:23-31: note: type `(Core.IntLiteral, Core.IntLiteral, Core.IntLiteral)` does not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: ./struct_init.h:10:34: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_struct_init_from_tuple.carbon:[[@LINE+21]]:23 + // CHECK:STDERR: -> │ Cpp.PassThreeFields((1, 2, 3)); + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: cannot implicitly convert expression of type + // CHECK:STDERR: · ┃ `(Core.IntLiteral, Core.IntLiteral, Core.IntLiteral)` to + // CHECK:STDERR: · ┃ `Cpp.ThreeFields` + // CHECK:STDERR: · ┃ [ConversionFailure] + // CHECK:STDERR: · ╰──┤ type + // CHECK:STDERR: · │ `(Core.IntLiteral, Core.IntLiteral, Core.IntLiteral)` + // CHECK:STDERR: · │ does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.ThreeFields)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./struct_init.h + // CHECK:STDERR: │ auto PassThreeFields(ThreeFields t) -> void; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.PassThreeFields((1, 2, 3)); - // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+4]]:23-27: error: cannot implicitly convert expression of type `(i32, i32, i32)` to `Cpp.ThreeFields` [ConversionFailure] - // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+3]]:23-27: note: type `(i32, i32, i32)` does not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: ./struct_init.h:10:34: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_struct_init_from_tuple.carbon:[[@LINE+17]]:23 + // CHECK:STDERR: -> │ Cpp.PassThreeFields(value); + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type + // CHECK:STDERR: · │ ┃ `(i32, i32, i32)` to `Cpp.ThreeFields` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `(i32, i32, i32)` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.ThreeFields)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./struct_init.h + // CHECK:STDERR: │ auto PassThreeFields(ThreeFields t) -> void; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.PassThreeFields(value); - // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+4]]:23-31: error: cannot implicitly convert expression of type `(i32, i32, i32)` to `Cpp.ThreeFields` [ConversionFailure] - // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+3]]:23-31: note: type `(i32, i32, i32)` does not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: ./struct_init.h:10:34: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_struct_init_from_tuple.carbon:[[@LINE+17]]:23 + // CHECK:STDERR: -> │ Cpp.PassThreeFields(reference); + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type + // CHECK:STDERR: · │ ┃ `(i32, i32, i32)` to `Cpp.ThreeFields` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `(i32, i32, i32)` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.ThreeFields)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./struct_init.h + // CHECK:STDERR: │ auto PassThreeFields(ThreeFields t) -> void; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.PassThreeFields(reference); - // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+4]]:23-39: error: cannot implicitly convert expression of type `(i32, i32, i32)` to `Cpp.ThreeFields` [ConversionFailure] - // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+3]]:23-39: note: type `(i32, i32, i32)` does not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: ./struct_init.h:10:34: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_struct_init_from_tuple.carbon:[[@LINE+17]]:23 + // CHECK:STDERR: -> │ Cpp.PassThreeFields(MakeThreeFields()); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type + // CHECK:STDERR: · │ ┃ `(i32, i32, i32)` to `Cpp.ThreeFields` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `(i32, i32, i32)` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.ThreeFields)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./struct_init.h + // CHECK:STDERR: │ auto PassThreeFields(ThreeFields t) -> void; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.PassThreeFields(MakeThreeFields()); } @@ -393,15 +641,39 @@ import Cpp library "int_from_struct.h"; fn F() { // C++ permits `{}` to be used to initialize an int, but Carbon does not. - // CHECK:STDERR: fail_int_from_struct.carbon:[[@LINE+4]]:15-16: error: cannot implicitly convert expression of type `{}` to `i32` [ConversionFailure] - // CHECK:STDERR: fail_int_from_struct.carbon:[[@LINE+3]]:15-16: note: type `{}` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: ./int_from_struct.h:2:18: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_int_from_struct.carbon:[[@LINE+16]]:15 + // CHECK:STDERR: -> │ Cpp.PassInt({}); + // CHECK:STDERR: · ┳━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `{}` to + // CHECK:STDERR: · │ ┃ `i32` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `{}` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(i32)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./int_from_struct.h + // CHECK:STDERR: │ auto PassInt(int n) -> void; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.PassInt({}); - // CHECK:STDERR: fail_int_from_struct.carbon:[[@LINE+4]]:15-16: error: cannot implicitly convert expression of type `()` to `i32` [ConversionFailure] - // CHECK:STDERR: fail_int_from_struct.carbon:[[@LINE+3]]:15-16: note: type `()` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: ./int_from_struct.h:2:18: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_int_from_struct.carbon:[[@LINE+16]]:15 + // CHECK:STDERR: -> │ Cpp.PassInt(()); + // CHECK:STDERR: · ┳━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `()` to + // CHECK:STDERR: · │ ┃ `i32` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `()` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(i32)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./int_from_struct.h + // CHECK:STDERR: │ auto PassInt(int n) -> void; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.PassInt(()); } @@ -416,15 +688,41 @@ fn F() { // C++ overload resolution prefers to convert `{}` to `int` rather than to an // empty struct. So that's the overload we pick, even though we can't call it. - // CHECK:STDERR: fail_int_from_struct_overloaded.carbon:[[@LINE+4]]:22-23: error: cannot implicitly convert expression of type `{}` to `i32` [ConversionFailure] - // CHECK:STDERR: fail_int_from_struct_overloaded.carbon:[[@LINE+3]]:22-23: note: type `{}` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: ./int_from_struct.h:6:25: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_int_from_struct_overloaded.carbon:[[@LINE+17]]:22 + // CHECK:STDERR: -> │ Cpp.PassOverloaded({}); + // CHECK:STDERR: · ┳━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type + // CHECK:STDERR: · │ ┃ `{}` to `i32` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `{}` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(i32)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./int_from_struct.h + // CHECK:STDERR: │ auto PassOverloaded(int n) -> void; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.PassOverloaded({}); - // CHECK:STDERR: fail_int_from_struct_overloaded.carbon:[[@LINE+4]]:22-23: error: cannot implicitly convert expression of type `()` to `i32` [ConversionFailure] - // CHECK:STDERR: fail_int_from_struct_overloaded.carbon:[[@LINE+3]]:22-23: note: type `()` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: ./int_from_struct.h:6:25: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_int_from_struct_overloaded.carbon:[[@LINE+17]]:22 + // CHECK:STDERR: -> │ Cpp.PassOverloaded(()); + // CHECK:STDERR: · ┳━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type + // CHECK:STDERR: · │ ┃ `()` to `i32` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `()` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(i32)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./int_from_struct.h + // CHECK:STDERR: │ auto PassOverloaded(int n) -> void; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.PassOverloaded(()); } @@ -449,9 +747,19 @@ library "[[@TEST_NAME]]"; import Cpp library "nested_structs.h"; fn F() { - // CHECK:STDERR: fail_pass_nested_structs_inner_field_mismatch.carbon:[[@LINE+4]]:3-11: error: no matching function for call to 'TakeB' [CppInteropParseError] - // CHECK:STDERR: ./nested_structs.h:11:6: note: candidate function not viable [CppInteropParseNote] - // CHECK:STDERR: ./nested_structs.h:11:12: note: cannot convert initializer list argument to 'B' [CppInteropParseNoteReason] + // CHECK:STDERR: ╭─┤ fail_pass_nested_structs_inner_field_mismatch.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: -> │ Cpp.TakeB({.a = {.x = 1, .z = 2}, .n = 3}); + // CHECK:STDERR: · ━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'TakeB' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./nested_structs.h + // CHECK:STDERR: │ void TakeB(B); + // CHECK:STDERR: · ┬ ┬ + // CHECK:STDERR: · ╰────────┤ candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: · ╰────┤ cannot convert initializer list argument to 'B' + // CHECK:STDERR: · │ [CppInteropParseNoteReason] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.TakeB({.a = {.x = 1, .z = 2}, .n = 3}); } @@ -463,9 +771,24 @@ library "[[@TEST_NAME]]"; import Cpp library "nested_structs.h"; fn F() { - // CHECK:STDERR: fail_todo_pass_nested_structs.carbon:[[@LINE+4]]:13-43: error: cannot implicitly convert expression of type `{.a: {.x: Core.IntLiteral, .y: Core.IntLiteral}, .n: Core.IntLiteral}` to `Cpp.B` [ConversionFailure] - // CHECK:STDERR: fail_todo_pass_nested_structs.carbon:[[@LINE+3]]:13-43: note: type `{.a: {.x: Core.IntLiteral, .y: Core.IntLiteral}, .n: Core.IntLiteral}` does not implement interface `Core.ImplicitAs(Cpp.B)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: ./nested_structs.h:11:13: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_todo_pass_nested_structs.carbon:[[@LINE+19]]:13 + // CHECK:STDERR: -> │ Cpp.TakeB({.a = {.x = 1, .y = 2}, .n = 3}); + // CHECK:STDERR: · ━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: cannot implicitly convert expression of type + // CHECK:STDERR: · ┃ `{.a: {.x: Core.IntLiteral, .y: Core.IntLiteral}, .n: Core.IntLiteral}` + // CHECK:STDERR: · ┃ to `Cpp.B` + // CHECK:STDERR: · ┃ [ConversionFailure] + // CHECK:STDERR: · ╭──────────────────────────╯ + // CHECK:STDERR: · │ type `{.a: {.x: Core.IntLiteral, .y: Core.IntLiteral}, .n: Core.IntLiteral}` + // CHECK:STDERR: · │ does not implement interface `Core.ImplicitAs(Cpp.B)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./nested_structs.h + // CHECK:STDERR: │ void TakeB(B); + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.TakeB({.a = {.x = 1, .y = 2}, .n = 3}); } @@ -499,9 +822,22 @@ library "[[@TEST_NAME]]"; import Cpp library "signedness_change.h"; fn F() { - // CHECK:STDERR: fail_signedness_change_rejected.carbon:[[@LINE+4]]:22-29: error: cannot implicitly convert expression of type `i32` to `u32` [ConversionFailure] - // CHECK:STDERR: fail_signedness_change_rejected.carbon:[[@LINE+3]]:22-29: note: type `i32` does not implement interface `Core.ImplicitAs(u32)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: ./signedness_change.h:2:34: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_signedness_change_rejected.carbon:[[@LINE+17]]:22 + // CHECK:STDERR: -> │ Cpp.signedness_foo(1 as i32); + // CHECK:STDERR: · ┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type + // CHECK:STDERR: · │ ┃ `i32` to `u32` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `i32` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(u32)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./signedness_change.h + // CHECK:STDERR: │ auto signedness_foo(unsigned int a) -> void; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.signedness_foo(1 as i32); } @@ -517,9 +853,22 @@ library "[[@TEST_NAME]]"; import Cpp library "downsizing_rejected.h"; fn F() { - // CHECK:STDERR: fail_import_downsizing_rejected.carbon:[[@LINE+4]]:22-29: error: cannot implicitly convert expression of type `i32` to `i16` [ConversionFailure] - // CHECK:STDERR: fail_import_downsizing_rejected.carbon:[[@LINE+3]]:22-29: note: type `i32` does not implement interface `Core.ImplicitAs(i16)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: ./downsizing_rejected.h:2:27: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_import_downsizing_rejected.carbon:[[@LINE+17]]:22 + // CHECK:STDERR: -> │ Cpp.downsizing_foo(1 as i32); + // CHECK:STDERR: · ┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type + // CHECK:STDERR: · │ ┃ `i32` to `i16` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `i32` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(i16)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./downsizing_rejected.h + // CHECK:STDERR: │ auto downsizing_foo(short a) -> void; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.downsizing_foo(1 as i32); } @@ -539,9 +888,20 @@ library "[[@TEST_NAME]]"; import Cpp library "no_viable_function.h"; fn F() { - // CHECK:STDERR: fail_import_no_viable_function.carbon:[[@LINE+4]]:3-19: error: no matching function for call to 'no_viable_foo' [CppInteropParseError] - // CHECK:STDERR: ./no_viable_function.h:2:6: note: candidate function not viable [CppInteropParseNote] - // CHECK:STDERR: ./no_viable_function.h:2:20-33: note: requires 2 arguments, but 1 was provided [CppInteropParseNoteReason] + // CHECK:STDERR: ╭─┤ fail_import_no_viable_function.carbon:[[@LINE+15]]:3 + // CHECK:STDERR: -> │ Cpp.no_viable_foo(1 as i64); + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'no_viable_foo' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./no_viable_function.h + // CHECK:STDERR: │ auto no_viable_foo(short a, int b) -> void; + // CHECK:STDERR: · ┬ ───────┬────── + // CHECK:STDERR: · ╰───────────────────────┤ candidate function not viable + // CHECK:STDERR: · │ │ [CppInteropParseNote] + // CHECK:STDERR: · ╰────┤ requires 2 arguments, but 1 was provided + // CHECK:STDERR: · │ [CppInteropParseNoteReason] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.no_viable_foo(1 as i64); } @@ -562,9 +922,20 @@ library "[[@TEST_NAME]]"; import Cpp library "ambiguous_overload.h"; fn F() { - // CHECK:STDERR: fail_import_ambiguous_overload.carbon:[[@LINE+4]]:3-19: error: call to 'ambiguous_foo' is ambiguous [CppInteropParseError] - // CHECK:STDERR: ./ambiguous_overload.h:2:6: note: candidate function [CppInteropParseNote] - // CHECK:STDERR: ./ambiguous_overload.h:3:6: note: candidate function [CppInteropParseNote] + // CHECK:STDERR: ╭─┤ fail_import_ambiguous_overload.carbon:[[@LINE+15]]:3 + // CHECK:STDERR: -> │ Cpp.ambiguous_foo(1 as i64); + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: call to 'ambiguous_foo' is ambiguous + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./ambiguous_overload.h + // CHECK:STDERR: │ auto ambiguous_foo(short a) -> void; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ candidate function [CppInteropParseNote] + // CHECK:STDERR: │ auto ambiguous_foo(int a) -> void; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ candidate function [CppInteropParseNote] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.ambiguous_foo(1 as i64); } @@ -585,9 +956,20 @@ library "[[@TEST_NAME]]"; import Cpp library "deleted_function.h"; fn F() { - // CHECK:STDERR: fail_import_deleted_function.carbon:[[@LINE+4]]:3-17: error: call to deleted function 'deleted_foo' [CppInteropParseError] - // CHECK:STDERR: ./deleted_function.h:3:6: note: candidate function has been explicitly deleted [CppInteropParseNote] - // CHECK:STDERR: ./deleted_function.h:2:6: note: candidate function [CppInteropParseNote] + // CHECK:STDERR: ╭─┤ fail_import_deleted_function.carbon:[[@LINE+15]]:3 + // CHECK:STDERR: -> │ Cpp.deleted_foo(1 as i32); + // CHECK:STDERR: · ━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: call to deleted function 'deleted_foo' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./deleted_function.h + // CHECK:STDERR: │ auto deleted_foo(short a) -> void; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ candidate function [CppInteropParseNote] + // CHECK:STDERR: │ auto deleted_foo(int a) -> void = delete; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ candidate function has been explicitly deleted [CppInteropParseNote] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.deleted_foo(1 as i32); } @@ -605,8 +987,18 @@ interface I {} fn EchoValue[ValueT: I](unused generic value: ValueT) {} fn F() { - // CHECK:STDERR: fail_missing_impl.carbon:[[@LINE+3]]:3-33: error: cannot convert type `` into type implementing `I` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_missing_impl.carbon:[[@LINE-4]]:1-55: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_missing_impl.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn EchoValue[ValueT: I](unused generic value: ValueT) {} + // CHECK:STDERR: · ─────────────────────────┬───────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ EchoValue(Cpp.missing_impl_foo); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `` into type + // CHECK:STDERR: · ┃ implementing `I` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: EchoValue(Cpp.missing_impl_foo); } diff --git a/toolchain/check/testdata/interop/cpp/function/import/param_unsupported.carbon b/toolchain/check/testdata/interop/cpp/function/import/param_unsupported.carbon index 08a23c52762d..4ddaf74e25f0 100644 --- a/toolchain/check/testdata/interop/cpp/function/import/param_unsupported.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/param_unsupported.carbon @@ -26,7 +26,12 @@ import Cpp library "unsupported_primitive_type.h"; fn F() { //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_import_unsupported_primitive_type.carbon:[[@LINE+2]]:3-13: error: semantics TODO: `Unsupported: parameter type: _BitInt(23)` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_primitive_type.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ Cpp.foo(11); + // CHECK:STDERR: · ━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `Unsupported: parameter type: _BitInt(23)` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.foo(11); //@dump-sem-ir-end @@ -48,7 +53,12 @@ import Cpp library "unsupported_primitive_type_among_params.h"; fn F() { //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_import_unsupported_primitive_type_among_params.carbon:[[@LINE+2]]:3-16: error: semantics TODO: `Unsupported: parameter type: _BitInt(23)` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_primitive_type_among_params.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ Cpp.foo(1, 20); + // CHECK:STDERR: · ━━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `Unsupported: parameter type: _BitInt(23)` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.foo(1, 20); //@dump-sem-ir-end @@ -70,9 +80,19 @@ import Cpp library "int_param.h"; // This doesn't have a direct type mapping in `getIntTypeForBitwidth`. fn F(x: i512) { - // CHECK:STDERR: fail_large_int.carbon:[[@LINE+4]]:11: error: call argument of type `i512` is not supported [CppCallArgTypeNotSupported] + // CHECK:STDERR: ╭─┤ fail_large_int.carbon:[[@LINE+14]]:11 + // CHECK:STDERR: -> │ Cpp.foo(x); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: call argument of type `i512` is not supported + // CHECK:STDERR: · ┃ [CppCallArgTypeNotSupported] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: min_prelude/parts/int.carbon:10:1-26: error: semantics TODO: `interop with non-identifier package name` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ min_prelude/parts/int.carbon:10:1 + // CHECK:STDERR: -> │ class Int(N: IntLiteral) { + // CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `interop with non-identifier package name` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.foo(x); } @@ -85,7 +105,12 @@ import Cpp library "int_param.h"; // This doesn't fit as an embedded `IntId` value. fn F(x: i8388608) { - // CHECK:STDERR: fail_very_large_int.carbon:[[@LINE+2]]:11: error: call argument of type `i8388608` is not supported [CppCallArgTypeNotSupported] + // CHECK:STDERR: ╭─┤ fail_very_large_int.carbon:[[@LINE+7]]:11 + // CHECK:STDERR: -> │ Cpp.foo(x); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: call argument of type `i8388608` is not supported + // CHECK:STDERR: · ┃ [CppCallArgTypeNotSupported] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.foo(x); } diff --git a/toolchain/check/testdata/interop/cpp/function/import/pointer.carbon b/toolchain/check/testdata/interop/cpp/function/import/pointer.carbon index 8eb00c767e3f..152bbb19c888 100644 --- a/toolchain/check/testdata/interop/cpp/function/import/pointer.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/pointer.carbon @@ -43,9 +43,21 @@ fn G() -> const Cpp.NonNullableParamS; fn F() { var s: const Cpp.NonNullableParamS = G(); - // CHECK:STDERR: fail_import_non_nullable_pointer_param_using_const_value.carbon:[[@LINE+4]]:3-28: error: no matching function for call to 'non_nullable_param_foo' [CppInteropParseError] - // CHECK:STDERR: ./non_nullable_pointer_param.h:4:6: note: candidate function not viable [CppInteropParseNote] - // CHECK:STDERR: ./non_nullable_pointer_param.h:4:29-55: note: 1st argument ('const NonNullableParamS * _Nonnull') would lose const qualifier [CppInteropParseNoteReason] + // CHECK:STDERR: ╭─┤ fail_import_non_nullable_pointer_param_using_const_value.carbon:[[@LINE+16]]:3 + // CHECK:STDERR: -> │ Cpp.non_nullable_param_foo(&s); + // CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'non_nullable_param_foo' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./non_nullable_pointer_param.h + // CHECK:STDERR: │ auto non_nullable_param_foo(NonNullableParamS* _Nonnull) -> void; + // CHECK:STDERR: · ┬ ┬────────────────────────── + // CHECK:STDERR: · ╰─────────────────────────┤ candidate function not viable + // CHECK:STDERR: · │ │ [CppInteropParseNote] + // CHECK:STDERR: · ╰────┤ 1st argument ('const NonNullableParamS * + // CHECK:STDERR: · │ _Nonnull') would lose const qualifier + // CHECK:STDERR: · │ [CppInteropParseNoteReason] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.non_nullable_param_foo(&s); } @@ -413,8 +425,19 @@ import Cpp library "deduced_pointer_param.h"; fn F() { // This could return a null pointer, so should not be given the type `Cpp.DeducedPointerS*`. - // CHECK:STDERR: fail_import_deduced_pointer_param_as_optional_pointer.carbon:[[@LINE+3]]:40-78: error: cannot implicitly convert expression of type `Core.Optional(Cpp.DeducedPointerS* as Core.OptionalStorage)` to `Cpp.DeducedPointerS*` [ConversionFailure] - // CHECK:STDERR: fail_import_deduced_pointer_param_as_optional_pointer.carbon:[[@LINE+2]]:40-78: note: type `Core.Optional(Cpp.DeducedPointerS* as Core.OptionalStorage)` does not implement interface `Core.ImplicitAs(Cpp.DeducedPointerS*)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_import_deduced_pointer_param_as_optional_pointer.carbon:[[@LINE+14]]:40 + // CHECK:STDERR: -> │ let unused a: Cpp.DeducedPointerS* = Cpp.Indirect({} as Cpp.DeducedPointerS); + // CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: cannot implicitly convert expression of type + // CHECK:STDERR: · ┃ `Core.Optional(Cpp.DeducedPointerS* as Core.OptionalStorage)` to + // CHECK:STDERR: · ┃ `Cpp.DeducedPointerS*` + // CHECK:STDERR: · ┃ [ConversionFailure] + // CHECK:STDERR: · ╭─────────────────────────────────────────────────────────╯ + // CHECK:STDERR: · │ type `Core.Optional(Cpp.DeducedPointerS* as Core.OptionalStorage)` does not + // CHECK:STDERR: · │ implement interface `Core.ImplicitAs(Cpp.DeducedPointerS*)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused a: Cpp.DeducedPointerS* = Cpp.Indirect({} as Cpp.DeducedPointerS); } diff --git a/toolchain/check/testdata/interop/cpp/function/import/reference.carbon b/toolchain/check/testdata/interop/cpp/function/import/reference.carbon index b95df8c72663..78b47182a695 100644 --- a/toolchain/check/testdata/interop/cpp/function/import/reference.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/reference.carbon @@ -44,29 +44,69 @@ fn F() { //@dump-sem-ir-begin var v: Cpp.S; let s: Cpp.S = v; - // CHECK:STDERR: fail_param_lvalue_ref.carbon:[[@LINE+4]]:3-17: error: no matching function for call to 'TakesLValue' [CppInteropParseError] - // CHECK:STDERR: ./param_lvalue_ref.h:5:6: note: candidate function not viable [CppInteropParseNote] - // CHECK:STDERR: ./param_lvalue_ref.h:5:18-19: note: 1st argument ('const S') would lose const qualifier [CppInteropParseNoteReason] + // CHECK:STDERR: ╭─┤ fail_param_lvalue_ref.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: -> │ Cpp.TakesLValue(s); + // CHECK:STDERR: · ━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'TakesLValue' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./param_lvalue_ref.h + // CHECK:STDERR: │ auto TakesLValue(S&) -> void; + // CHECK:STDERR: · ┬ ─┬ + // CHECK:STDERR: · ╰───────────────┤ candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: · ╰────┤ 1st argument ('const S') would lose const qualifier + // CHECK:STDERR: · │ [CppInteropParseNoteReason] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.TakesLValue(s); - // CHECK:STDERR: fail_param_lvalue_ref.carbon:[[@LINE+4]]:3-17: error: no matching function for call to 'TakesLValue' [CppInteropParseError] - // CHECK:STDERR: ./param_lvalue_ref.h:5:6: note: candidate function not viable [CppInteropParseNote] - // CHECK:STDERR: ./param_lvalue_ref.h:5:18-19: note: 1st argument ('const S') would lose const qualifier [CppInteropParseNoteReason] + // CHECK:STDERR: ╭─┤ fail_param_lvalue_ref.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: -> │ Cpp.TakesLValue(s as const Cpp.S); + // CHECK:STDERR: · ━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'TakesLValue' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./param_lvalue_ref.h + // CHECK:STDERR: │ auto TakesLValue(S&) -> void; + // CHECK:STDERR: · ┬ ─┬ + // CHECK:STDERR: · ╰───────────────┤ candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: · ╰────┤ 1st argument ('const S') would lose const qualifier + // CHECK:STDERR: · │ [CppInteropParseNoteReason] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.TakesLValue(s as const Cpp.S); var t: Cpp.T; - // CHECK:STDERR: fail_param_lvalue_ref.carbon:[[@LINE+4]]:3-17: error: no matching function for call to 'TakesLValue' [CppInteropParseError] - // CHECK:STDERR: ./param_lvalue_ref.h:5:6: note: candidate function not viable [CppInteropParseNote] - // CHECK:STDERR: ./param_lvalue_ref.h:5:18-19: note: no known conversion from 'T' to 'S &' for 1st argument [CppInteropParseNoteReason] + // CHECK:STDERR: ╭─┤ fail_param_lvalue_ref.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: -> │ Cpp.TakesLValue(t); + // CHECK:STDERR: · ━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'TakesLValue' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./param_lvalue_ref.h + // CHECK:STDERR: │ auto TakesLValue(S&) -> void; + // CHECK:STDERR: · ┬ ─┬ + // CHECK:STDERR: · ╰───────────────┤ candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: · ╰────┤ no known conversion from 'T' to 'S &' for 1st argument + // CHECK:STDERR: · │ [CppInteropParseNoteReason] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.TakesLValue(t); var u: Cpp.S; - // CHECK:STDERR: fail_param_lvalue_ref.carbon:[[@LINE+4]]:3-17: error: no matching function for call to 'TakesLValue' [CppInteropParseError] - // CHECK:STDERR: ./param_lvalue_ref.h:5:6: note: candidate function not viable [CppInteropParseNote] - // CHECK:STDERR: ./param_lvalue_ref.h:5:18-19: note: 1st argument ('const S') would lose const qualifier [CppInteropParseNoteReason] + // CHECK:STDERR: ╭─┤ fail_param_lvalue_ref.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: -> │ Cpp.TakesLValue(u as const Cpp.S); + // CHECK:STDERR: · ━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'TakesLValue' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./param_lvalue_ref.h + // CHECK:STDERR: │ auto TakesLValue(S&) -> void; + // CHECK:STDERR: · ┬ ─┬ + // CHECK:STDERR: · ╰───────────────┤ candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: · ╰────┤ 1st argument ('const S') would lose const qualifier + // CHECK:STDERR: · │ [CppInteropParseNoteReason] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.TakesLValue(u as const Cpp.S); //@dump-sem-ir-end @@ -119,9 +159,19 @@ import Cpp library "param_rvalue_ref.h"; fn F() { let s: Cpp.S = {}; - // CHECK:STDERR: fail_param_value_arg_for_rvalue_ref.carbon:[[@LINE+4]]:3-17: error: no matching function for call to 'TakesRValue' [CppInteropParseError] - // CHECK:STDERR: ./param_rvalue_ref.h:5:6: note: candidate function not viable [CppInteropParseNote] - // CHECK:STDERR: ./param_rvalue_ref.h:5:18-20: note: 1st argument ('const S') would lose const qualifier [CppInteropParseNoteReason] + // CHECK:STDERR: ╭─┤ fail_param_value_arg_for_rvalue_ref.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: -> │ Cpp.TakesRValue(s); + // CHECK:STDERR: · ━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'TakesRValue' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./param_rvalue_ref.h + // CHECK:STDERR: │ auto TakesRValue(S&&) -> void; + // CHECK:STDERR: · ┬ ─┬─ + // CHECK:STDERR: · ╰───────────────┤ candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: · ╰────┤ 1st argument ('const S') would lose const qualifier + // CHECK:STDERR: · │ [CppInteropParseNoteReason] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.TakesRValue(s); } @@ -135,22 +185,52 @@ import Cpp library "param_rvalue_ref.h"; fn F() { //@dump-sem-ir-begin var s: Cpp.S; - // CHECK:STDERR: fail_param_rvalue_ref.carbon:[[@LINE+4]]:3-17: error: no matching function for call to 'TakesRValue' [CppInteropParseError] - // CHECK:STDERR: ./param_rvalue_ref.h:5:6: note: candidate function not viable [CppInteropParseNote] - // CHECK:STDERR: ./param_rvalue_ref.h:5:18-20: note: expects an rvalue for 1st argument [CppInteropParseNoteReason] + // CHECK:STDERR: ╭─┤ fail_param_rvalue_ref.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: -> │ Cpp.TakesRValue(s); + // CHECK:STDERR: · ━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'TakesRValue' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./param_rvalue_ref.h + // CHECK:STDERR: │ auto TakesRValue(S&&) -> void; + // CHECK:STDERR: · ┬ ─┬─ + // CHECK:STDERR: · ╰───────────────┤ candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: · ╰────┤ expects an rvalue for 1st argument + // CHECK:STDERR: · │ [CppInteropParseNoteReason] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.TakesRValue(s); var t: Cpp.T; - // CHECK:STDERR: fail_param_rvalue_ref.carbon:[[@LINE+4]]:3-17: error: no matching function for call to 'TakesRValue' [CppInteropParseError] - // CHECK:STDERR: ./param_rvalue_ref.h:5:6: note: candidate function not viable [CppInteropParseNote] - // CHECK:STDERR: ./param_rvalue_ref.h:5:18-20: note: no known conversion from 'T' to 'S' for 1st argument [CppInteropParseNoteReason] + // CHECK:STDERR: ╭─┤ fail_param_rvalue_ref.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: -> │ Cpp.TakesRValue(t); + // CHECK:STDERR: · ━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'TakesRValue' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./param_rvalue_ref.h + // CHECK:STDERR: │ auto TakesRValue(S&&) -> void; + // CHECK:STDERR: · ┬ ─┬─ + // CHECK:STDERR: · ╰───────────────┤ candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: · ╰────┤ no known conversion from 'T' to 'S' for 1st argument + // CHECK:STDERR: · │ [CppInteropParseNoteReason] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.TakesRValue(t); - // CHECK:STDERR: fail_param_rvalue_ref.carbon:[[@LINE+4]]:3-17: error: no matching function for call to 'TakesRValue' [CppInteropParseError] - // CHECK:STDERR: ./param_rvalue_ref.h:5:6: note: candidate function not viable [CppInteropParseNote] - // CHECK:STDERR: ./param_rvalue_ref.h:5:18-20: note: 1st argument ('const S') would lose const qualifier [CppInteropParseNoteReason] + // CHECK:STDERR: ╭─┤ fail_param_rvalue_ref.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: -> │ Cpp.TakesRValue(({} as Cpp.S) as const Cpp.S); + // CHECK:STDERR: · ━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'TakesRValue' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./param_rvalue_ref.h + // CHECK:STDERR: │ auto TakesRValue(S&&) -> void; + // CHECK:STDERR: · ┬ ─┬─ + // CHECK:STDERR: · ╰───────────────┤ candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: · ╰────┤ 1st argument ('const S') would lose const qualifier + // CHECK:STDERR: · │ [CppInteropParseNoteReason] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.TakesRValue(({} as Cpp.S) as const Cpp.S); //@dump-sem-ir-end @@ -205,9 +285,20 @@ import Cpp library "param_const_lvalue_ref.h"; fn F() { var t: Cpp.T; - // CHECK:STDERR: fail_call_param_const_lvalue_ref_with_wrong_type.carbon:[[@LINE+4]]:3-22: error: no matching function for call to 'TakesConstLValue' [CppInteropParseError] - // CHECK:STDERR: ./param_const_lvalue_ref.h:5:6: note: candidate function not viable [CppInteropParseNote] - // CHECK:STDERR: ./param_const_lvalue_ref.h:5:23-30: note: no known conversion from 'T' to 'const S' for 1st argument [CppInteropParseNoteReason] + // CHECK:STDERR: ╭─┤ fail_call_param_const_lvalue_ref_with_wrong_type.carbon:[[@LINE+15]]:3 + // CHECK:STDERR: -> │ Cpp.TakesConstLValue(t); + // CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'TakesConstLValue' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./param_const_lvalue_ref.h + // CHECK:STDERR: │ auto TakesConstLValue(const S&) -> void; + // CHECK:STDERR: · ┬ ┬─────── + // CHECK:STDERR: · ╰───────────────────┤ candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: · ╰────┤ no known conversion from 'T' to 'const S' for 1st + // CHECK:STDERR: · │ argument + // CHECK:STDERR: · │ [CppInteropParseNoteReason] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.TakesConstLValue(t); } @@ -260,16 +351,38 @@ import Cpp library "param_const_rvalue_ref.h"; fn F() { //@dump-sem-ir-begin var s: Cpp.S; - // CHECK:STDERR: fail_param_lvalue_ref_arg_const_rvalue_ref.carbon:[[@LINE+4]]:3-22: error: no matching function for call to 'TakesConstRValue' [CppInteropParseError] - // CHECK:STDERR: ./param_const_rvalue_ref.h:5:6: note: candidate function not viable [CppInteropParseNote] - // CHECK:STDERR: ./param_const_rvalue_ref.h:5:23-31: note: expects an rvalue for 1st argument [CppInteropParseNoteReason] + // CHECK:STDERR: ╭─┤ fail_param_lvalue_ref_arg_const_rvalue_ref.carbon:[[@LINE+15]]:3 + // CHECK:STDERR: -> │ Cpp.TakesConstRValue(s); + // CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'TakesConstRValue' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./param_const_rvalue_ref.h + // CHECK:STDERR: │ auto TakesConstRValue(const S&&) -> void; + // CHECK:STDERR: · ┬ ────┬──── + // CHECK:STDERR: · ╰───────────────────────┤ candidate function not viable + // CHECK:STDERR: · │ │ [CppInteropParseNote] + // CHECK:STDERR: · ╰────┤ expects an rvalue for 1st argument + // CHECK:STDERR: · │ [CppInteropParseNoteReason] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.TakesConstRValue(s); var t: Cpp.T; - // CHECK:STDERR: fail_param_lvalue_ref_arg_const_rvalue_ref.carbon:[[@LINE+4]]:3-22: error: no matching function for call to 'TakesConstRValue' [CppInteropParseError] - // CHECK:STDERR: ./param_const_rvalue_ref.h:5:6: note: candidate function not viable [CppInteropParseNote] - // CHECK:STDERR: ./param_const_rvalue_ref.h:5:23-31: note: no known conversion from 'T' to 'const S' for 1st argument [CppInteropParseNoteReason] + // CHECK:STDERR: ╭─┤ fail_param_lvalue_ref_arg_const_rvalue_ref.carbon:[[@LINE+15]]:3 + // CHECK:STDERR: -> │ Cpp.TakesConstRValue(t); + // CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'TakesConstRValue' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./param_const_rvalue_ref.h + // CHECK:STDERR: │ auto TakesConstRValue(const S&&) -> void; + // CHECK:STDERR: · ┬ ┬──────── + // CHECK:STDERR: · ╰───────────────────┤ candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: · ╰────┤ no known conversion from 'T' to 'const S' for 1st + // CHECK:STDERR: · │ argument + // CHECK:STDERR: · │ [CppInteropParseNoteReason] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.TakesConstRValue(t); //@dump-sem-ir-end @@ -348,8 +461,16 @@ library "[[@TEST_NAME]]"; import Cpp library "return_const_lvalue_ref.h"; fn F() { - // CHECK:STDERR: fail_call_return_const_lvalue_ref_const_correctness.carbon:[[@LINE+3]]:29-51: error: cannot implicitly convert expression of type `const Cpp.S` to `Cpp.S` [ConversionFailure] - // CHECK:STDERR: fail_call_return_const_lvalue_ref_const_correctness.carbon:[[@LINE+2]]:29-51: note: type `const Cpp.S` does not implement interface `Core.ImplicitAs(Cpp.S)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_call_return_const_lvalue_ref_const_correctness.carbon:[[@LINE+11]]:29 + // CHECK:STDERR: -> │ let unused ref s: Cpp.S = Cpp.ReturnConstLValue(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of + // CHECK:STDERR: · │ ┃ type `const Cpp.S` to `Cpp.S` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `const Cpp.S` does not implement + // CHECK:STDERR: · │ interface `Core.ImplicitAs(Cpp.S)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused ref s: Cpp.S = Cpp.ReturnConstLValue(); } @@ -423,8 +544,19 @@ template void TakeAnything_ExpectConstLRef_ByRef(T&&) { '''; fn PassConstRef(ref x: const XByRef) { - // CHECK:STDERR: fail_todo_forwarding_reference_by_ref.carbon:[[@LINE+3]]:42-46: error: `ref` tag is not an argument to a `ref` parameter [RefTagNoRefParam] - // CHECK:STDERR: fail_todo_forwarding_reference_by_ref.carbon:[[@LINE-7]]:65: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_todo_forwarding_reference_by_ref.carbon:[[@LINE+14]]:42 + // CHECK:STDERR: │ template void TakeAnything_ExpectConstLRef_ByRef(T&&) { + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╭───────────────────────────────────────────────────────────────╯ + // CHECK:STDERR: · │ initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Cpp.TakeAnything_ExpectConstLRef_ByRef(ref x); + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: `ref` tag is not an + // CHECK:STDERR: · ┃ argument to a `ref` + // CHECK:STDERR: · ┃ parameter + // CHECK:STDERR: · ┃ [RefTagNoRefParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.TakeAnything_ExpectConstLRef_ByRef(ref x); } @@ -607,28 +739,28 @@ fn PassConstRef(ref x: const XByRef) { // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %s.patt: %pattern_type.0f5 = value_binding_pattern s [concrete = constants.%s.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %Cpp.ref.loc14: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %TakesLValue.ref.loc14: %TakesLValue.cpp_overload_set.type = name_ref TakesLValue, imports.%TakesLValue.cpp_overload_set.value [concrete = constants.%TakesLValue.cpp_overload_set.value] -// CHECK:STDOUT: %s.ref.loc14: %S = name_ref s, %s -// CHECK:STDOUT: %Cpp.ref.loc20_3: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %TakesLValue.ref.loc20: %TakesLValue.cpp_overload_set.type = name_ref TakesLValue, imports.%TakesLValue.cpp_overload_set.value [concrete = constants.%TakesLValue.cpp_overload_set.value] -// CHECK:STDOUT: %s.ref.loc20: %S = name_ref s, %s -// CHECK:STDOUT: %Cpp.ref.loc20_30: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %S.ref.loc20: type = name_ref S, imports.%S.decl [concrete = constants.%S] -// CHECK:STDOUT: %const.loc20: type = const_type %S.ref.loc20 [concrete = constants.%const] -// CHECK:STDOUT: %.loc20_21.1: %const = as_compatible %s.ref.loc20 -// CHECK:STDOUT: %.loc20_21.2: %const = converted %s.ref.loc20, %.loc20_21.1 +// CHECK:STDOUT: %Cpp.ref.loc24: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %TakesLValue.ref.loc24: %TakesLValue.cpp_overload_set.type = name_ref TakesLValue, imports.%TakesLValue.cpp_overload_set.value [concrete = constants.%TakesLValue.cpp_overload_set.value] +// CHECK:STDOUT: %s.ref.loc24: %S = name_ref s, %s +// CHECK:STDOUT: %Cpp.ref.loc40_3: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %TakesLValue.ref.loc40: %TakesLValue.cpp_overload_set.type = name_ref TakesLValue, imports.%TakesLValue.cpp_overload_set.value [concrete = constants.%TakesLValue.cpp_overload_set.value] +// CHECK:STDOUT: %s.ref.loc40: %S = name_ref s, %s +// CHECK:STDOUT: %Cpp.ref.loc40_30: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %S.ref.loc40: type = name_ref S, imports.%S.decl [concrete = constants.%S] +// CHECK:STDOUT: %const.loc40: type = const_type %S.ref.loc40 [concrete = constants.%const] +// CHECK:STDOUT: %.loc40_21.1: %const = as_compatible %s.ref.loc40 +// CHECK:STDOUT: %.loc40_21.2: %const = converted %s.ref.loc40, %.loc40_21.1 // CHECK:STDOUT: %t.var: ref %T.ed0 = var_storage %t.var_patt -// CHECK:STDOUT: %DefaultOrUnformed.facet.loc22: %DefaultOrUnformed.type = facet_value constants.%T.ed0, (constants.%DefaultOrUnformed.impl_witness.307) [concrete = constants.%DefaultOrUnformed.facet.d8b] -// CHECK:STDOUT: %.loc22_15.1: %DefaultOrUnformed.type = converted constants.%T.ed0, %DefaultOrUnformed.facet.loc22 [concrete = constants.%DefaultOrUnformed.facet.d8b] -// CHECK:STDOUT: %as_type.loc22: type = facet_access_type %.loc22_15.1 [concrete = constants.%T.ed0] -// CHECK:STDOUT: %.loc22_15.2: type = converted %.loc22_15.1, %as_type.loc22 [concrete = constants.%T.ed0] +// CHECK:STDOUT: %DefaultOrUnformed.facet.loc42: %DefaultOrUnformed.type = facet_value constants.%T.ed0, (constants.%DefaultOrUnformed.impl_witness.307) [concrete = constants.%DefaultOrUnformed.facet.d8b] +// CHECK:STDOUT: %.loc42_15.1: %DefaultOrUnformed.type = converted constants.%T.ed0, %DefaultOrUnformed.facet.loc42 [concrete = constants.%DefaultOrUnformed.facet.d8b] +// CHECK:STDOUT: %as_type.loc42: type = facet_access_type %.loc42_15.1 [concrete = constants.%T.ed0] +// CHECK:STDOUT: %.loc42_15.2: type = converted %.loc42_15.1, %as_type.loc42 [concrete = constants.%T.ed0] // CHECK:STDOUT: -// CHECK:STDOUT: %.loc22_3.1: ref %T.ed0 = splice_block %t.var {} -// CHECK:STDOUT: %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc22: init %T.ed0 to %.loc22_3.1 = call %T.as_type.as.DefaultOrUnformed.impl.Op.specific_fn.2() -// CHECK:STDOUT: assign %t.var, %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc22 -// CHECK:STDOUT: %.loc22_13: type = splice_block %T.ref [concrete = constants.%T.ed0] { -// CHECK:STDOUT: %Cpp.ref.loc22: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %.loc42_3.1: ref %T.ed0 = splice_block %t.var {} +// CHECK:STDOUT: %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc42: init %T.ed0 to %.loc42_3.1 = call %T.as_type.as.DefaultOrUnformed.impl.Op.specific_fn.2() +// CHECK:STDOUT: assign %t.var, %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc42 +// CHECK:STDOUT: %.loc42_13: type = splice_block %T.ref [concrete = constants.%T.ed0] { +// CHECK:STDOUT: %Cpp.ref.loc42: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %T.ref: type = name_ref T, imports.%T.decl [concrete = constants.%T.ed0] // CHECK:STDOUT: } // CHECK:STDOUT: %t: ref %T.ed0 = wrapper_binding t, %t.var @@ -636,47 +768,47 @@ fn PassConstRef(ref x: const XByRef) { // CHECK:STDOUT: %t.patt: %pattern_type.5f6 = ref_binding_pattern t [concrete = constants.%t.patt.420] // CHECK:STDOUT: %t.var_patt: %pattern_type.5f6 = var_pattern %t.patt [concrete = constants.%t.var_patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %Cpp.ref.loc27: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %TakesLValue.ref.loc27: %TakesLValue.cpp_overload_set.type = name_ref TakesLValue, imports.%TakesLValue.cpp_overload_set.value [concrete = constants.%TakesLValue.cpp_overload_set.value] +// CHECK:STDOUT: %Cpp.ref.loc57: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %TakesLValue.ref.loc57: %TakesLValue.cpp_overload_set.type = name_ref TakesLValue, imports.%TakesLValue.cpp_overload_set.value [concrete = constants.%TakesLValue.cpp_overload_set.value] // CHECK:STDOUT: %t.ref: ref %T.ed0 = name_ref t, %t // CHECK:STDOUT: %u.var: ref %S = var_storage %u.var_patt -// CHECK:STDOUT: %DefaultOrUnformed.facet.loc29: %DefaultOrUnformed.type = facet_value constants.%S, (constants.%DefaultOrUnformed.impl_witness.e4a) [concrete = constants.%DefaultOrUnformed.facet.cbb] -// CHECK:STDOUT: %.loc29_15.1: %DefaultOrUnformed.type = converted constants.%S, %DefaultOrUnformed.facet.loc29 [concrete = constants.%DefaultOrUnformed.facet.cbb] -// CHECK:STDOUT: %as_type.loc29: type = facet_access_type %.loc29_15.1 [concrete = constants.%S] -// CHECK:STDOUT: %.loc29_15.2: type = converted %.loc29_15.1, %as_type.loc29 [concrete = constants.%S] +// CHECK:STDOUT: %DefaultOrUnformed.facet.loc59: %DefaultOrUnformed.type = facet_value constants.%S, (constants.%DefaultOrUnformed.impl_witness.e4a) [concrete = constants.%DefaultOrUnformed.facet.cbb] +// CHECK:STDOUT: %.loc59_15.1: %DefaultOrUnformed.type = converted constants.%S, %DefaultOrUnformed.facet.loc59 [concrete = constants.%DefaultOrUnformed.facet.cbb] +// CHECK:STDOUT: %as_type.loc59: type = facet_access_type %.loc59_15.1 [concrete = constants.%S] +// CHECK:STDOUT: %.loc59_15.2: type = converted %.loc59_15.1, %as_type.loc59 [concrete = constants.%S] // CHECK:STDOUT: -// CHECK:STDOUT: %.loc29_3.1: ref %S = splice_block %u.var {} -// CHECK:STDOUT: %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc29: init %S to %.loc29_3.1 = call %T.as_type.as.DefaultOrUnformed.impl.Op.specific_fn.3() -// CHECK:STDOUT: assign %u.var, %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc29 -// CHECK:STDOUT: %.loc29_13: type = splice_block %S.ref.loc29 [concrete = constants.%S] { -// CHECK:STDOUT: %Cpp.ref.loc29: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %S.ref.loc29: type = name_ref S, imports.%S.decl [concrete = constants.%S] +// CHECK:STDOUT: %.loc59_3.1: ref %S = splice_block %u.var {} +// CHECK:STDOUT: %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc59: init %S to %.loc59_3.1 = call %T.as_type.as.DefaultOrUnformed.impl.Op.specific_fn.3() +// CHECK:STDOUT: assign %u.var, %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc59 +// CHECK:STDOUT: %.loc59_13: type = splice_block %S.ref.loc59 [concrete = constants.%S] { +// CHECK:STDOUT: %Cpp.ref.loc59: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %S.ref.loc59: type = name_ref S, imports.%S.decl [concrete = constants.%S] // CHECK:STDOUT: } // CHECK:STDOUT: %u: ref %S = wrapper_binding u, %u.var // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %u.patt: %pattern_type.0f5 = ref_binding_pattern u [concrete = constants.%u.patt] // CHECK:STDOUT: %u.var_patt: %pattern_type.0f5 = var_pattern %u.patt [concrete = constants.%u.var_patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %Cpp.ref.loc34_3: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %TakesLValue.ref.loc34: %TakesLValue.cpp_overload_set.type = name_ref TakesLValue, imports.%TakesLValue.cpp_overload_set.value [concrete = constants.%TakesLValue.cpp_overload_set.value] +// CHECK:STDOUT: %Cpp.ref.loc74_3: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %TakesLValue.ref.loc74: %TakesLValue.cpp_overload_set.type = name_ref TakesLValue, imports.%TakesLValue.cpp_overload_set.value [concrete = constants.%TakesLValue.cpp_overload_set.value] // CHECK:STDOUT: %u.ref: ref %S = name_ref u, %u -// CHECK:STDOUT: %Cpp.ref.loc34_30: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %S.ref.loc34: type = name_ref S, imports.%S.decl [concrete = constants.%S] -// CHECK:STDOUT: %const.loc34: type = const_type %S.ref.loc34 [concrete = constants.%const] -// CHECK:STDOUT: %.loc34_21.1: ref %const = as_compatible %u.ref -// CHECK:STDOUT: %.loc34_21.2: ref %const = converted %u.ref, %.loc34_21.1 -// CHECK:STDOUT: %Destroy.facet.loc29_3.1: %Destroy.type = facet_value constants.%S, (constants.%DestroyImpl.impl_witness.b60, constants.%custom_witness.fe1878.1) [concrete = constants.%Destroy.facet.580] -// CHECK:STDOUT: %.loc29_3.2: %Destroy.type = converted constants.%S, %Destroy.facet.loc29_3.1 [concrete = constants.%Destroy.facet.580] -// CHECK:STDOUT: %Destroy.facet.loc29_3.2: %Destroy.type = facet_value constants.%S, (constants.%DestroyImpl.impl_witness.b60, constants.%custom_witness.fe1878.1) [concrete = constants.%Destroy.facet.580] -// CHECK:STDOUT: %.loc29_3.3: %Destroy.type = converted constants.%S, %Destroy.facet.loc29_3.2 [concrete = constants.%Destroy.facet.580] +// CHECK:STDOUT: %Cpp.ref.loc74_30: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %S.ref.loc74: type = name_ref S, imports.%S.decl [concrete = constants.%S] +// CHECK:STDOUT: %const.loc74: type = const_type %S.ref.loc74 [concrete = constants.%const] +// CHECK:STDOUT: %.loc74_21.1: ref %const = as_compatible %u.ref +// CHECK:STDOUT: %.loc74_21.2: ref %const = converted %u.ref, %.loc74_21.1 +// CHECK:STDOUT: %Destroy.facet.loc59_3.1: %Destroy.type = facet_value constants.%S, (constants.%DestroyImpl.impl_witness.b60, constants.%custom_witness.fe1878.1) [concrete = constants.%Destroy.facet.580] +// CHECK:STDOUT: %.loc59_3.2: %Destroy.type = converted constants.%S, %Destroy.facet.loc59_3.1 [concrete = constants.%Destroy.facet.580] +// CHECK:STDOUT: %Destroy.facet.loc59_3.2: %Destroy.type = facet_value constants.%S, (constants.%DestroyImpl.impl_witness.b60, constants.%custom_witness.fe1878.1) [concrete = constants.%Destroy.facet.580] +// CHECK:STDOUT: %.loc59_3.3: %Destroy.type = converted constants.%S, %Destroy.facet.loc59_3.2 [concrete = constants.%Destroy.facet.580] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc29: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%u.var) -// CHECK:STDOUT: %Destroy.facet.loc22_3.1: %Destroy.type = facet_value constants.%T.ed0, (constants.%DestroyImpl.impl_witness.68c, constants.%custom_witness.fe1878.2) [concrete = constants.%Destroy.facet.8f8] -// CHECK:STDOUT: %.loc22_3.2: %Destroy.type = converted constants.%T.ed0, %Destroy.facet.loc22_3.1 [concrete = constants.%Destroy.facet.8f8] -// CHECK:STDOUT: %Destroy.facet.loc22_3.2: %Destroy.type = facet_value constants.%T.ed0, (constants.%DestroyImpl.impl_witness.68c, constants.%custom_witness.fe1878.2) [concrete = constants.%Destroy.facet.8f8] -// CHECK:STDOUT: %.loc22_3.3: %Destroy.type = converted constants.%T.ed0, %Destroy.facet.loc22_3.2 [concrete = constants.%Destroy.facet.8f8] +// CHECK:STDOUT: %SelfDestruct.call.loc59: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%u.var) +// CHECK:STDOUT: %Destroy.facet.loc42_3.1: %Destroy.type = facet_value constants.%T.ed0, (constants.%DestroyImpl.impl_witness.68c, constants.%custom_witness.fe1878.2) [concrete = constants.%Destroy.facet.8f8] +// CHECK:STDOUT: %.loc42_3.2: %Destroy.type = converted constants.%T.ed0, %Destroy.facet.loc42_3.1 [concrete = constants.%Destroy.facet.8f8] +// CHECK:STDOUT: %Destroy.facet.loc42_3.2: %Destroy.type = facet_value constants.%T.ed0, (constants.%DestroyImpl.impl_witness.68c, constants.%custom_witness.fe1878.2) [concrete = constants.%Destroy.facet.8f8] +// CHECK:STDOUT: %.loc42_3.3: %Destroy.type = converted constants.%T.ed0, %Destroy.facet.loc42_3.2 [concrete = constants.%Destroy.facet.8f8] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc22: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%t.var) +// CHECK:STDOUT: %SelfDestruct.call.loc42: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%t.var) // CHECK:STDOUT: %Destroy.facet.loc8_3.1: %Destroy.type = facet_value constants.%S, (constants.%DestroyImpl.impl_witness.b60, constants.%custom_witness.fe1878.1) [concrete = constants.%Destroy.facet.580] // CHECK:STDOUT: %.loc8_3.2: %Destroy.type = converted constants.%S, %Destroy.facet.loc8_3.1 [concrete = constants.%Destroy.facet.580] // CHECK:STDOUT: %Destroy.facet.loc8_3.2: %Destroy.type = facet_value constants.%S, (constants.%DestroyImpl.impl_witness.b60, constants.%custom_witness.fe1878.1) [concrete = constants.%Destroy.facet.580] @@ -825,20 +957,20 @@ fn PassConstRef(ref x: const XByRef) { // CHECK:STDOUT: %s.patt: %pattern_type.0f5 = ref_binding_pattern s [concrete = constants.%s.patt] // CHECK:STDOUT: %s.var_patt: %pattern_type.0f5 = var_pattern %s.patt [concrete = constants.%s.var_patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %Cpp.ref.loc13: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %TakesRValue.ref.loc13: %TakesRValue.cpp_overload_set.type = name_ref TakesRValue, imports.%TakesRValue.cpp_overload_set.value [concrete = constants.%TakesRValue.cpp_overload_set.value] +// CHECK:STDOUT: %Cpp.ref.loc23: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %TakesRValue.ref.loc23: %TakesRValue.cpp_overload_set.type = name_ref TakesRValue, imports.%TakesRValue.cpp_overload_set.value [concrete = constants.%TakesRValue.cpp_overload_set.value] // CHECK:STDOUT: %s.ref: ref %S = name_ref s, %s // CHECK:STDOUT: %t.var: ref %T.ed0 = var_storage %t.var_patt -// CHECK:STDOUT: %DefaultOrUnformed.facet.loc15: %DefaultOrUnformed.type = facet_value constants.%T.ed0, (constants.%DefaultOrUnformed.impl_witness.307) [concrete = constants.%DefaultOrUnformed.facet.d8b] -// CHECK:STDOUT: %.loc15_15.1: %DefaultOrUnformed.type = converted constants.%T.ed0, %DefaultOrUnformed.facet.loc15 [concrete = constants.%DefaultOrUnformed.facet.d8b] -// CHECK:STDOUT: %as_type.loc15: type = facet_access_type %.loc15_15.1 [concrete = constants.%T.ed0] -// CHECK:STDOUT: %.loc15_15.2: type = converted %.loc15_15.1, %as_type.loc15 [concrete = constants.%T.ed0] +// CHECK:STDOUT: %DefaultOrUnformed.facet.loc25: %DefaultOrUnformed.type = facet_value constants.%T.ed0, (constants.%DefaultOrUnformed.impl_witness.307) [concrete = constants.%DefaultOrUnformed.facet.d8b] +// CHECK:STDOUT: %.loc25_15.1: %DefaultOrUnformed.type = converted constants.%T.ed0, %DefaultOrUnformed.facet.loc25 [concrete = constants.%DefaultOrUnformed.facet.d8b] +// CHECK:STDOUT: %as_type.loc25: type = facet_access_type %.loc25_15.1 [concrete = constants.%T.ed0] +// CHECK:STDOUT: %.loc25_15.2: type = converted %.loc25_15.1, %as_type.loc25 [concrete = constants.%T.ed0] // CHECK:STDOUT: -// CHECK:STDOUT: %.loc15_3.1: ref %T.ed0 = splice_block %t.var {} -// CHECK:STDOUT: %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc15: init %T.ed0 to %.loc15_3.1 = call %T.as_type.as.DefaultOrUnformed.impl.Op.specific_fn.2() -// CHECK:STDOUT: assign %t.var, %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc15 -// CHECK:STDOUT: %.loc15_13: type = splice_block %T.ref [concrete = constants.%T.ed0] { -// CHECK:STDOUT: %Cpp.ref.loc15: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %.loc25_3.1: ref %T.ed0 = splice_block %t.var {} +// CHECK:STDOUT: %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc25: init %T.ed0 to %.loc25_3.1 = call %T.as_type.as.DefaultOrUnformed.impl.Op.specific_fn.2() +// CHECK:STDOUT: assign %t.var, %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc25 +// CHECK:STDOUT: %.loc25_13: type = splice_block %T.ref [concrete = constants.%T.ed0] { +// CHECK:STDOUT: %Cpp.ref.loc25: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %T.ref: type = name_ref T, imports.%T.decl [concrete = constants.%T.ed0] // CHECK:STDOUT: } // CHECK:STDOUT: %t: ref %T.ed0 = wrapper_binding t, %t.var @@ -846,28 +978,28 @@ fn PassConstRef(ref x: const XByRef) { // CHECK:STDOUT: %t.patt: %pattern_type.5f6 = ref_binding_pattern t [concrete = constants.%t.patt.420] // CHECK:STDOUT: %t.var_patt: %pattern_type.5f6 = var_pattern %t.patt [concrete = constants.%t.var_patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %Cpp.ref.loc20: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %TakesRValue.ref.loc20: %TakesRValue.cpp_overload_set.type = name_ref TakesRValue, imports.%TakesRValue.cpp_overload_set.value [concrete = constants.%TakesRValue.cpp_overload_set.value] +// CHECK:STDOUT: %Cpp.ref.loc40: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %TakesRValue.ref.loc40: %TakesRValue.cpp_overload_set.type = name_ref TakesRValue, imports.%TakesRValue.cpp_overload_set.value [concrete = constants.%TakesRValue.cpp_overload_set.value] // CHECK:STDOUT: %t.ref: ref %T.ed0 = name_ref t, %t -// CHECK:STDOUT: %Cpp.ref.loc26_3: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %TakesRValue.ref.loc26: %TakesRValue.cpp_overload_set.type = name_ref TakesRValue, imports.%TakesRValue.cpp_overload_set.value [concrete = constants.%TakesRValue.cpp_overload_set.value] -// CHECK:STDOUT: %.loc26_21.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct.a40] -// CHECK:STDOUT: %Cpp.ref.loc26_26: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %S.ref.loc26_29: type = name_ref S, imports.%S.decl [concrete = constants.%S] -// CHECK:STDOUT: %.loc26_21.2: ref %S = temporary_storage -// CHECK:STDOUT: %.loc26_21.3: init %S to %.loc26_21.2 = class_init () [concrete = constants.%S.val] -// CHECK:STDOUT: %.loc26_23: init %S = converted %.loc26_21.1, %.loc26_21.3 [concrete = constants.%S.val] -// CHECK:STDOUT: %Cpp.ref.loc26_42: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %S.ref.loc26_45: type = name_ref S, imports.%S.decl [concrete = constants.%S] -// CHECK:STDOUT: %const: type = const_type %S.ref.loc26_45 [concrete = constants.%const] -// CHECK:STDOUT: %.loc26_33.1: init %const = as_compatible %.loc26_23 [concrete = constants.%empty_struct.674] -// CHECK:STDOUT: %.loc26_33.2: init %const = converted %.loc26_23, %.loc26_33.1 [concrete = constants.%empty_struct.674] -// CHECK:STDOUT: %Destroy.facet.loc15_3.1: %Destroy.type = facet_value constants.%T.ed0, (constants.%DestroyImpl.impl_witness.68c, constants.%custom_witness.fe1878.1) [concrete = constants.%Destroy.facet.8f8] -// CHECK:STDOUT: %.loc15_3.2: %Destroy.type = converted constants.%T.ed0, %Destroy.facet.loc15_3.1 [concrete = constants.%Destroy.facet.8f8] -// CHECK:STDOUT: %Destroy.facet.loc15_3.2: %Destroy.type = facet_value constants.%T.ed0, (constants.%DestroyImpl.impl_witness.68c, constants.%custom_witness.fe1878.1) [concrete = constants.%Destroy.facet.8f8] -// CHECK:STDOUT: %.loc15_3.3: %Destroy.type = converted constants.%T.ed0, %Destroy.facet.loc15_3.2 [concrete = constants.%Destroy.facet.8f8] +// CHECK:STDOUT: %Cpp.ref.loc56_3: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %TakesRValue.ref.loc56: %TakesRValue.cpp_overload_set.type = name_ref TakesRValue, imports.%TakesRValue.cpp_overload_set.value [concrete = constants.%TakesRValue.cpp_overload_set.value] +// CHECK:STDOUT: %.loc56_21.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct.a40] +// CHECK:STDOUT: %Cpp.ref.loc56_26: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %S.ref.loc56_29: type = name_ref S, imports.%S.decl [concrete = constants.%S] +// CHECK:STDOUT: %.loc56_21.2: ref %S = temporary_storage +// CHECK:STDOUT: %.loc56_21.3: init %S to %.loc56_21.2 = class_init () [concrete = constants.%S.val] +// CHECK:STDOUT: %.loc56_23: init %S = converted %.loc56_21.1, %.loc56_21.3 [concrete = constants.%S.val] +// CHECK:STDOUT: %Cpp.ref.loc56_42: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %S.ref.loc56_45: type = name_ref S, imports.%S.decl [concrete = constants.%S] +// CHECK:STDOUT: %const: type = const_type %S.ref.loc56_45 [concrete = constants.%const] +// CHECK:STDOUT: %.loc56_33.1: init %const = as_compatible %.loc56_23 [concrete = constants.%empty_struct.674] +// CHECK:STDOUT: %.loc56_33.2: init %const = converted %.loc56_23, %.loc56_33.1 [concrete = constants.%empty_struct.674] +// CHECK:STDOUT: %Destroy.facet.loc25_3.1: %Destroy.type = facet_value constants.%T.ed0, (constants.%DestroyImpl.impl_witness.68c, constants.%custom_witness.fe1878.1) [concrete = constants.%Destroy.facet.8f8] +// CHECK:STDOUT: %.loc25_3.2: %Destroy.type = converted constants.%T.ed0, %Destroy.facet.loc25_3.1 [concrete = constants.%Destroy.facet.8f8] +// CHECK:STDOUT: %Destroy.facet.loc25_3.2: %Destroy.type = facet_value constants.%T.ed0, (constants.%DestroyImpl.impl_witness.68c, constants.%custom_witness.fe1878.1) [concrete = constants.%Destroy.facet.8f8] +// CHECK:STDOUT: %.loc25_3.3: %Destroy.type = converted constants.%T.ed0, %Destroy.facet.loc25_3.2 [concrete = constants.%Destroy.facet.8f8] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc15: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%t.var) +// CHECK:STDOUT: %SelfDestruct.call.loc25: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%t.var) // CHECK:STDOUT: %Destroy.facet.loc8_3.1: %Destroy.type = facet_value constants.%S, (constants.%DestroyImpl.impl_witness.b60, constants.%custom_witness.fe1878.2) [concrete = constants.%Destroy.facet.580] // CHECK:STDOUT: %.loc8_3.2: %Destroy.type = converted constants.%S, %Destroy.facet.loc8_3.1 [concrete = constants.%Destroy.facet.580] // CHECK:STDOUT: %Destroy.facet.loc8_3.2: %Destroy.type = facet_value constants.%S, (constants.%DestroyImpl.impl_witness.b60, constants.%custom_witness.fe1878.2) [concrete = constants.%Destroy.facet.580] @@ -1213,20 +1345,20 @@ fn PassConstRef(ref x: const XByRef) { // CHECK:STDOUT: %s.patt: %pattern_type.0f5 = ref_binding_pattern s [concrete = constants.%s.patt] // CHECK:STDOUT: %s.var_patt: %pattern_type.0f5 = var_pattern %s.patt [concrete = constants.%s.var_patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %Cpp.ref.loc13: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %TakesConstRValue.ref.loc13: %TakesConstRValue.cpp_overload_set.type = name_ref TakesConstRValue, imports.%TakesConstRValue.cpp_overload_set.value [concrete = constants.%TakesConstRValue.cpp_overload_set.value] +// CHECK:STDOUT: %Cpp.ref.loc24: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %TakesConstRValue.ref.loc24: %TakesConstRValue.cpp_overload_set.type = name_ref TakesConstRValue, imports.%TakesConstRValue.cpp_overload_set.value [concrete = constants.%TakesConstRValue.cpp_overload_set.value] // CHECK:STDOUT: %s.ref: ref %S = name_ref s, %s // CHECK:STDOUT: %t.var: ref %T.ed0 = var_storage %t.var_patt -// CHECK:STDOUT: %DefaultOrUnformed.facet.loc15: %DefaultOrUnformed.type = facet_value constants.%T.ed0, (constants.%DefaultOrUnformed.impl_witness.307) [concrete = constants.%DefaultOrUnformed.facet.d8b] -// CHECK:STDOUT: %.loc15_15.1: %DefaultOrUnformed.type = converted constants.%T.ed0, %DefaultOrUnformed.facet.loc15 [concrete = constants.%DefaultOrUnformed.facet.d8b] -// CHECK:STDOUT: %as_type.loc15: type = facet_access_type %.loc15_15.1 [concrete = constants.%T.ed0] -// CHECK:STDOUT: %.loc15_15.2: type = converted %.loc15_15.1, %as_type.loc15 [concrete = constants.%T.ed0] +// CHECK:STDOUT: %DefaultOrUnformed.facet.loc26: %DefaultOrUnformed.type = facet_value constants.%T.ed0, (constants.%DefaultOrUnformed.impl_witness.307) [concrete = constants.%DefaultOrUnformed.facet.d8b] +// CHECK:STDOUT: %.loc26_15.1: %DefaultOrUnformed.type = converted constants.%T.ed0, %DefaultOrUnformed.facet.loc26 [concrete = constants.%DefaultOrUnformed.facet.d8b] +// CHECK:STDOUT: %as_type.loc26: type = facet_access_type %.loc26_15.1 [concrete = constants.%T.ed0] +// CHECK:STDOUT: %.loc26_15.2: type = converted %.loc26_15.1, %as_type.loc26 [concrete = constants.%T.ed0] // CHECK:STDOUT: -// CHECK:STDOUT: %.loc15_3.1: ref %T.ed0 = splice_block %t.var {} -// CHECK:STDOUT: %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc15: init %T.ed0 to %.loc15_3.1 = call %T.as_type.as.DefaultOrUnformed.impl.Op.specific_fn.2() -// CHECK:STDOUT: assign %t.var, %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc15 -// CHECK:STDOUT: %.loc15_13: type = splice_block %T.ref [concrete = constants.%T.ed0] { -// CHECK:STDOUT: %Cpp.ref.loc15: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %.loc26_3.1: ref %T.ed0 = splice_block %t.var {} +// CHECK:STDOUT: %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc26: init %T.ed0 to %.loc26_3.1 = call %T.as_type.as.DefaultOrUnformed.impl.Op.specific_fn.2() +// CHECK:STDOUT: assign %t.var, %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc26 +// CHECK:STDOUT: %.loc26_13: type = splice_block %T.ref [concrete = constants.%T.ed0] { +// CHECK:STDOUT: %Cpp.ref.loc26: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %T.ref: type = name_ref T, imports.%T.decl [concrete = constants.%T.ed0] // CHECK:STDOUT: } // CHECK:STDOUT: %t: ref %T.ed0 = wrapper_binding t, %t.var @@ -1234,15 +1366,15 @@ fn PassConstRef(ref x: const XByRef) { // CHECK:STDOUT: %t.patt: %pattern_type.5f6 = ref_binding_pattern t [concrete = constants.%t.patt.420] // CHECK:STDOUT: %t.var_patt: %pattern_type.5f6 = var_pattern %t.patt [concrete = constants.%t.var_patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %Cpp.ref.loc20: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %TakesConstRValue.ref.loc20: %TakesConstRValue.cpp_overload_set.type = name_ref TakesConstRValue, imports.%TakesConstRValue.cpp_overload_set.value [concrete = constants.%TakesConstRValue.cpp_overload_set.value] +// CHECK:STDOUT: %Cpp.ref.loc42: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %TakesConstRValue.ref.loc42: %TakesConstRValue.cpp_overload_set.type = name_ref TakesConstRValue, imports.%TakesConstRValue.cpp_overload_set.value [concrete = constants.%TakesConstRValue.cpp_overload_set.value] // CHECK:STDOUT: %t.ref: ref %T.ed0 = name_ref t, %t -// CHECK:STDOUT: %Destroy.facet.loc15_3.1: %Destroy.type = facet_value constants.%T.ed0, (constants.%DestroyImpl.impl_witness.68c, constants.%custom_witness.fe1878.1) [concrete = constants.%Destroy.facet.8f8] -// CHECK:STDOUT: %.loc15_3.2: %Destroy.type = converted constants.%T.ed0, %Destroy.facet.loc15_3.1 [concrete = constants.%Destroy.facet.8f8] -// CHECK:STDOUT: %Destroy.facet.loc15_3.2: %Destroy.type = facet_value constants.%T.ed0, (constants.%DestroyImpl.impl_witness.68c, constants.%custom_witness.fe1878.1) [concrete = constants.%Destroy.facet.8f8] -// CHECK:STDOUT: %.loc15_3.3: %Destroy.type = converted constants.%T.ed0, %Destroy.facet.loc15_3.2 [concrete = constants.%Destroy.facet.8f8] +// CHECK:STDOUT: %Destroy.facet.loc26_3.1: %Destroy.type = facet_value constants.%T.ed0, (constants.%DestroyImpl.impl_witness.68c, constants.%custom_witness.fe1878.1) [concrete = constants.%Destroy.facet.8f8] +// CHECK:STDOUT: %.loc26_3.2: %Destroy.type = converted constants.%T.ed0, %Destroy.facet.loc26_3.1 [concrete = constants.%Destroy.facet.8f8] +// CHECK:STDOUT: %Destroy.facet.loc26_3.2: %Destroy.type = facet_value constants.%T.ed0, (constants.%DestroyImpl.impl_witness.68c, constants.%custom_witness.fe1878.1) [concrete = constants.%Destroy.facet.8f8] +// CHECK:STDOUT: %.loc26_3.3: %Destroy.type = converted constants.%T.ed0, %Destroy.facet.loc26_3.2 [concrete = constants.%Destroy.facet.8f8] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc15: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%t.var) +// CHECK:STDOUT: %SelfDestruct.call.loc26: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%t.var) // CHECK:STDOUT: %Destroy.facet.loc8_3.1: %Destroy.type = facet_value constants.%S, (constants.%DestroyImpl.impl_witness.b60, constants.%custom_witness.fe1878.2) [concrete = constants.%Destroy.facet.580] // CHECK:STDOUT: %.loc8_3.2: %Destroy.type = converted constants.%S, %Destroy.facet.loc8_3.1 [concrete = constants.%Destroy.facet.580] // CHECK:STDOUT: %Destroy.facet.loc8_3.2: %Destroy.type = facet_value constants.%S, (constants.%DestroyImpl.impl_witness.b60, constants.%custom_witness.fe1878.2) [concrete = constants.%Destroy.facet.580] diff --git a/toolchain/check/testdata/interop/cpp/function/import/return.carbon b/toolchain/check/testdata/interop/cpp/function/import/return.carbon index f44fad4a74c4..ff9d6b362b45 100644 --- a/toolchain/check/testdata/interop/cpp/function/import/return.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/return.carbon @@ -48,7 +48,12 @@ auto UndeducedReturn(); '''; fn Call() { - // CHECK:STDERR: fail_return_undeduced_auto.carbon:[[@LINE+2]]:3-23: error: semantics TODO: `Unsupported: return type: auto` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_return_undeduced_auto.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ Cpp.UndeducedReturn(); + // CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `Unsupported: return type: auto` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.UndeducedReturn(); } diff --git a/toolchain/check/testdata/interop/cpp/function/import/struct.carbon b/toolchain/check/testdata/interop/cpp/function/import/struct.carbon index bdd07d5263cf..490731a6f29e 100644 --- a/toolchain/check/testdata/interop/cpp/function/import/struct.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/struct.carbon @@ -18,36 +18,88 @@ struct ForwardDeclaredStruct; +// CHECK:STDERR: ╷ ╭── included from: fail_import_decl_value_param_type.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./decl_value_param_type.h:[[@LINE+16]]:6 +// CHECK:STDERR: │ struct ForwardDeclaredStruct; +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ forward declaration of 'ForwardDeclaredStruct' [CppInteropParseNote] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ auto foo1(ForwardDeclaredStruct) -> void; +// CHECK:STDERR: · ━━┳━ +// CHECK:STDERR: · ┗━━┫ error: argument type 'ForwardDeclaredStruct' is incomplete +// CHECK:STDERR: · ┃ [CppInteropParseError] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ fail_import_decl_value_param_type.carbon +// CHECK:STDERR: │ Cpp.foo1(*p); +// CHECK:STDERR: · ──────┬───── +// CHECK:STDERR: · ╰──┤ in thunk for C++ function used here [InCppThunk] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: auto foo1(ForwardDeclaredStruct) -> void; +// CHECK:STDERR: ╷ ╭── included from: fail_import_decl_value_param_type.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./decl_value_param_type.h:[[@LINE+16]]:6 +// CHECK:STDERR: │ struct ForwardDeclaredStruct; +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ forward declaration of 'ForwardDeclaredStruct' [CppInteropParseNote] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ auto foo2(ForwardDeclaredStruct) -> void; +// CHECK:STDERR: · ━━┳━ +// CHECK:STDERR: · ┗━━┫ error: argument type 'ForwardDeclaredStruct' is incomplete +// CHECK:STDERR: · ┃ [CppInteropParseError] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ fail_import_decl_value_param_type.carbon +// CHECK:STDERR: │ Cpp.foo2(*p); +// CHECK:STDERR: · ──────┬───── +// CHECK:STDERR: · ╰──┤ in thunk for C++ function used here [InCppThunk] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: auto foo2(ForwardDeclaredStruct) -> void; // --- fail_import_decl_value_param_type.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: included from: fail_import_decl_value_param_type.carbon:[[@LINE+3]]:10 [InCppInclude] -// CHECK:STDERR: ./decl_value_param_type.h:4:6-9: error: argument type 'ForwardDeclaredStruct' is incomplete [CppInteropParseError] -// CHECK:STDERR: ./decl_value_param_type.h:2:8: note: forward declaration of 'ForwardDeclaredStruct' [CppInteropParseNote] import Cpp library "decl_value_param_type.h"; fn F(p: Cpp.ForwardDeclaredStruct*) { - // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE+5]]:3-14: note: in thunk for C++ function used here [InCppThunk] + // CHECK:STDERR: ╭─┤ fail_import_decl_value_param_type.carbon:[[@LINE+19]]:12 + // CHECK:STDERR: -> │ Cpp.foo1(*p); + // CHECK:STDERR: · ┳━ + // CHECK:STDERR: · ┗━━┫ error: forming value of incomplete type + // CHECK:STDERR: · ┃ `Cpp.ForwardDeclaredStruct` + // CHECK:STDERR: · ┃ [IncompleteTypeInValueConversion] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ ╭── included from: fail_import_decl_value_param_type.carbon [InCppInclude] + // CHECK:STDERR: ├─┤ ./decl_value_param_type.h + // CHECK:STDERR: │ struct ForwardDeclaredStruct; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ auto foo1(ForwardDeclaredStruct) -> void; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: included from: fail_import_decl_value_param_type.carbon:[[@LINE-5]]:10 [InCppInclude] - // CHECK:STDERR: ./decl_value_param_type.h:5:6-9: error: argument type 'ForwardDeclaredStruct' is incomplete [CppInteropParseError] - // CHECK:STDERR: ./decl_value_param_type.h:2:8: note: forward declaration of 'ForwardDeclaredStruct' [CppInteropParseNote] Cpp.foo1(*p); - // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE+12]]:3-14: note: in thunk for C++ function used here [InCppThunk] - // CHECK:STDERR: - // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE-3]]:12-13: error: forming value of incomplete type `Cpp.ForwardDeclaredStruct` [IncompleteTypeInValueConversion] - // CHECK:STDERR: included from: fail_import_decl_value_param_type.carbon:[[@LINE-12]]:10 [InCppInclude] - // CHECK:STDERR: ./decl_value_param_type.h:2:8: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: ./decl_value_param_type.h:4:32: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: - // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE+5]]:12-13: error: forming value of incomplete type `Cpp.ForwardDeclaredStruct` [IncompleteTypeInValueConversion] - // CHECK:STDERR: included from: fail_import_decl_value_param_type.carbon:[[@LINE-17]]:10 [InCppInclude] - // CHECK:STDERR: ./decl_value_param_type.h:2:8: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: ./decl_value_param_type.h:5:32: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_import_decl_value_param_type.carbon:[[@LINE+19]]:12 + // CHECK:STDERR: -> │ Cpp.foo2(*p); + // CHECK:STDERR: · ┳━ + // CHECK:STDERR: · ┗━━┫ error: forming value of incomplete type + // CHECK:STDERR: · ┃ `Cpp.ForwardDeclaredStruct` + // CHECK:STDERR: · ┃ [IncompleteTypeInValueConversion] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ ╭── included from: fail_import_decl_value_param_type.carbon [InCppInclude] + // CHECK:STDERR: ├─┤ ./decl_value_param_type.h + // CHECK:STDERR: │ struct ForwardDeclaredStruct; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ auto foo2(ForwardDeclaredStruct) -> void; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.foo2(*p); } @@ -84,22 +136,37 @@ struct NonCopyableStruct { NonCopyableStruct(const NonCopyableStruct&) = delete; }; +// CHECK:STDERR: ╷ ╭── included from: fail_import_non_copyable_param_type.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./non_copyable_param_type.h:[[@LINE+20]]:6 +// CHECK:STDERR: │ NonCopyableStruct(const NonCopyableStruct&) = delete; +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ 'NonCopyableStruct' has been explicitly marked deleted here +// CHECK:STDERR: · │ [CppInteropParseNote] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ auto foo_non_copyable(NonCopyableStruct) -> void; +// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━ ┬ +// CHECK:STDERR: · ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫ error: call to deleted constructor +// CHECK:STDERR: · │ ┃ of 'NonCopyableStruct' +// CHECK:STDERR: · │ ┃ [CppInteropParseError] +// CHECK:STDERR: · ╰────┤ passing argument to parameter here +// CHECK:STDERR: · │ [CppInteropParseNote] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ fail_import_non_copyable_param_type.carbon +// CHECK:STDERR: │ Cpp.foo_non_copyable(s); +// CHECK:STDERR: · ───────────┬─────────── +// CHECK:STDERR: · ╰──┤ in thunk for C++ function used here [InCppThunk] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: auto foo_non_copyable(NonCopyableStruct) -> void; // --- fail_import_non_copyable_param_type.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: included from: fail_import_non_copyable_param_type.carbon:[[@LINE+4]]:10 [InCppInclude] -// CHECK:STDERR: ./non_copyable_param_type.h:6:6-21: error: call to deleted constructor of 'NonCopyableStruct' [CppInteropParseError] -// CHECK:STDERR: ./non_copyable_param_type.h:3:3: note: 'NonCopyableStruct' has been explicitly marked deleted here [CppInteropParseNote] -// CHECK:STDERR: ./non_copyable_param_type.h:6:40: note: passing argument to parameter here [CppInteropParseNote] import Cpp library "non_copyable_param_type.h"; fn F(s: Cpp.NonCopyableStruct) { //@dump-sem-ir-begin - // CHECK:STDERR: fail_import_non_copyable_param_type.carbon:[[@LINE+2]]:3-25: note: in thunk for C++ function used here [InCppThunk] - // CHECK:STDERR: Cpp.foo_non_copyable(s); //@dump-sem-ir-end } @@ -283,9 +350,18 @@ library "[[@TEST_NAME]]"; import Cpp library "incomplete.h"; fn F() { - // CHECK:STDERR: fail_import_incomplete.carbon:[[@LINE+4]]:3-26: error: member access into incomplete class `Cpp.IncompleteStruct` [QualifiedExprInIncompleteClassScope] - // CHECK:STDERR: included from: fail_import_incomplete.carbon:[[@LINE-4]]:10 [InCppInclude] - // CHECK:STDERR: ./incomplete.h:2:8: note: class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ╭─┤ fail_import_incomplete.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: -> │ Cpp.IncompleteStruct.foo(); + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: member access into incomplete class `Cpp.IncompleteStruct` + // CHECK:STDERR: · ┃ [QualifiedExprInIncompleteClassScope] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ ╭── included from: fail_import_incomplete.carbon [InCppInclude] + // CHECK:STDERR: ├─┤ ./incomplete.h + // CHECK:STDERR: │ struct IncompleteStruct; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.IncompleteStruct.foo(); } @@ -342,6 +418,25 @@ fn F(s: Cpp.DefPointerParamStruct*) { struct DeclValueReturnStruct; +// CHECK:STDERR: ╷ ╭── included from: fail_import_decl_value_return_type.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./decl_value_return_type.h:[[@LINE+18]]:6 +// CHECK:STDERR: │ struct DeclValueReturnStruct; +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ forward declaration of 'DeclValueReturnStruct' [CppInteropParseNote] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ auto foo_decl_value_return() -> DeclValueReturnStruct; +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: calling 'foo_decl_value_return' with incomplete return type +// CHECK:STDERR: · │ ┃ 'DeclValueReturnStruct' +// CHECK:STDERR: · │ ┃ [CppInteropParseError] +// CHECK:STDERR: · ╰────┤ 'foo_decl_value_return' declared here [CppInteropParseNote] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ fail_import_decl_value_return_type.carbon +// CHECK:STDERR: │ Cpp.foo_decl_value_return(); +// CHECK:STDERR: · ─────────────┬───────────── +// CHECK:STDERR: · ╰──┤ in thunk for C++ function used here [InCppThunk] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: auto foo_decl_value_return() -> DeclValueReturnStruct; // --- fail_import_decl_value_return_type.carbon @@ -349,19 +444,26 @@ auto foo_decl_value_return() -> DeclValueReturnStruct; library "[[@TEST_NAME]]"; // TODO: We should only produce one error here. -// CHECK:STDERR: included from: fail_import_decl_value_return_type.carbon:[[@LINE+4]]:10 [InCppInclude] -// CHECK:STDERR: ./decl_value_return_type.h:4:6-26: error: calling 'foo_decl_value_return' with incomplete return type 'DeclValueReturnStruct' [CppInteropParseError] -// CHECK:STDERR: ./decl_value_return_type.h:4:6: note: 'foo_decl_value_return' declared here [CppInteropParseNote] -// CHECK:STDERR: ./decl_value_return_type.h:2:8: note: forward declaration of 'DeclValueReturnStruct' [CppInteropParseNote] import Cpp library "decl_value_return_type.h"; fn F() { - // CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE+7]]:3-29: note: in thunk for C++ function used here [InCppThunk] - // CHECK:STDERR: - // CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE+5]]:3-29: error: function returns incomplete type `Cpp.DeclValueReturnStruct` [IncompleteTypeInFunctionReturnType] - // CHECK:STDERR: included from: fail_import_decl_value_return_type.carbon:[[@LINE-6]]:10 [InCppInclude] - // CHECK:STDERR: ./decl_value_return_type.h:2:8: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: ./decl_value_return_type.h:4:33: note: return type declared here [IncompleteReturnTypeHere] + // CHECK:STDERR: ╭─┤ fail_import_decl_value_return_type.carbon:[[@LINE+18]]:3 + // CHECK:STDERR: -> │ Cpp.foo_decl_value_return(); + // CHECK:STDERR: · ━━━━━━┳━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: function returns incomplete type `Cpp.DeclValueReturnStruct` + // CHECK:STDERR: · ┃ [IncompleteTypeInFunctionReturnType] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ ╭── included from: fail_import_decl_value_return_type.carbon [InCppInclude] + // CHECK:STDERR: ├─┤ ./decl_value_return_type.h + // CHECK:STDERR: │ struct DeclValueReturnStruct; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ auto foo_decl_value_return() -> DeclValueReturnStruct; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ return type declared here + // CHECK:STDERR: · │ [IncompleteReturnTypeHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.foo_decl_value_return(); } @@ -500,7 +602,7 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%s.param: %NonCopyableStruct) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Cpp.ref.loc14: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %Cpp.ref.loc8: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %foo_non_copyable.ref: %foo_non_copyable.cpp_overload_set.type = name_ref foo_non_copyable, imports.%foo_non_copyable.cpp_overload_set.value [concrete = constants.%foo_non_copyable.cpp_overload_set.value] // CHECK:STDOUT: %s.ref: %NonCopyableStruct = name_ref s, %s // CHECK:STDOUT: %foo_non_copyable.call: init %empty_tuple.type = call imports.%foo_non_copyable.decl(%s.ref) diff --git a/toolchain/check/testdata/interop/cpp/function/import/template.carbon b/toolchain/check/testdata/interop/cpp/function/import/template.carbon index 7b6b429277e9..24e622fd925a 100644 --- a/toolchain/check/testdata/interop/cpp/function/import/template.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/template.carbon @@ -87,9 +87,21 @@ template void fn_arg_not_template_arg_f(); fn Call() { // We treat this as a function argument, even though that makes the call fail. - // CHECK:STDERR: fail_function_arg_not_template_arg.carbon:[[@LINE+4]]:3-31: error: no matching function for call to 'fn_arg_not_template_arg_f' [CppInteropParseError] - // CHECK:STDERR: fail_function_arg_not_template_arg.carbon:[[@LINE-6]]:22: note: candidate function template not viable [CppInteropParseNote] - // CHECK:STDERR: fail_function_arg_not_template_arg.carbon:[[@LINE-7]]:47-48: note: requires 0 arguments, but 1 was provided [CppInteropParseNoteReason] + // CHECK:STDERR: ╭─┤ fail_function_arg_not_template_arg.carbon:[[@LINE+16]]:3 + // CHECK:STDERR: │ template void fn_arg_not_template_arg_f(); + // CHECK:STDERR: · ┬ ┬─ + // CHECK:STDERR: · ╰───────────────────────────┤ candidate function template + // CHECK:STDERR: · │ │ not viable + // CHECK:STDERR: · │ │ [CppInteropParseNote] + // CHECK:STDERR: · ╰────┤ requires 0 arguments, but 1 + // CHECK:STDERR: · │ was provided + // CHECK:STDERR: · │ [CppInteropParseNoteReason] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Cpp.fn_arg_not_template_arg_f(1); + // CHECK:STDERR: · ━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'fn_arg_not_template_arg_f' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.fn_arg_not_template_arg_f(1); } diff --git a/toolchain/check/testdata/interop/cpp/function/import/union.carbon b/toolchain/check/testdata/interop/cpp/function/import/union.carbon index 46417878625a..e38d50aa470b 100644 --- a/toolchain/check/testdata/interop/cpp/function/import/union.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/union.carbon @@ -18,36 +18,88 @@ union ForwardDeclaredUnion; +// CHECK:STDERR: ╷ ╭── included from: fail_import_decl_value_param_type.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./decl_value_param_type.h:[[@LINE+16]]:6 +// CHECK:STDERR: │ union ForwardDeclaredUnion; +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ forward declaration of 'ForwardDeclaredUnion' [CppInteropParseNote] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ auto foo1(ForwardDeclaredUnion) -> void; +// CHECK:STDERR: · ━━┳━ +// CHECK:STDERR: · ┗━━┫ error: argument type 'ForwardDeclaredUnion' is incomplete +// CHECK:STDERR: · ┃ [CppInteropParseError] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ fail_import_decl_value_param_type.carbon +// CHECK:STDERR: │ Cpp.foo1(*p); +// CHECK:STDERR: · ──────┬───── +// CHECK:STDERR: · ╰──┤ in thunk for C++ function used here [InCppThunk] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: auto foo1(ForwardDeclaredUnion) -> void; +// CHECK:STDERR: ╷ ╭── included from: fail_import_decl_value_param_type.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./decl_value_param_type.h:[[@LINE+16]]:6 +// CHECK:STDERR: │ union ForwardDeclaredUnion; +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ forward declaration of 'ForwardDeclaredUnion' [CppInteropParseNote] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ auto foo2(ForwardDeclaredUnion) -> void; +// CHECK:STDERR: · ━━┳━ +// CHECK:STDERR: · ┗━━┫ error: argument type 'ForwardDeclaredUnion' is incomplete +// CHECK:STDERR: · ┃ [CppInteropParseError] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ fail_import_decl_value_param_type.carbon +// CHECK:STDERR: │ Cpp.foo2(*p); +// CHECK:STDERR: · ──────┬───── +// CHECK:STDERR: · ╰──┤ in thunk for C++ function used here [InCppThunk] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: auto foo2(ForwardDeclaredUnion) -> void; // --- fail_import_decl_value_param_type.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: included from: fail_import_decl_value_param_type.carbon:[[@LINE+3]]:10 [InCppInclude] -// CHECK:STDERR: ./decl_value_param_type.h:4:6-9: error: argument type 'ForwardDeclaredUnion' is incomplete [CppInteropParseError] -// CHECK:STDERR: ./decl_value_param_type.h:2:7: note: forward declaration of 'ForwardDeclaredUnion' [CppInteropParseNote] import Cpp library "decl_value_param_type.h"; fn F(p: Cpp.ForwardDeclaredUnion*) { - // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE+5]]:3-14: note: in thunk for C++ function used here [InCppThunk] + // CHECK:STDERR: ╭─┤ fail_import_decl_value_param_type.carbon:[[@LINE+19]]:12 + // CHECK:STDERR: -> │ Cpp.foo1(*p); + // CHECK:STDERR: · ┳━ + // CHECK:STDERR: · ┗━━┫ error: forming value of incomplete type + // CHECK:STDERR: · ┃ `Cpp.ForwardDeclaredUnion` + // CHECK:STDERR: · ┃ [IncompleteTypeInValueConversion] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ ╭── included from: fail_import_decl_value_param_type.carbon [InCppInclude] + // CHECK:STDERR: ├─┤ ./decl_value_param_type.h + // CHECK:STDERR: │ union ForwardDeclaredUnion; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ auto foo1(ForwardDeclaredUnion) -> void; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: included from: fail_import_decl_value_param_type.carbon:[[@LINE-5]]:10 [InCppInclude] - // CHECK:STDERR: ./decl_value_param_type.h:5:6-9: error: argument type 'ForwardDeclaredUnion' is incomplete [CppInteropParseError] - // CHECK:STDERR: ./decl_value_param_type.h:2:7: note: forward declaration of 'ForwardDeclaredUnion' [CppInteropParseNote] Cpp.foo1(*p); - // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE+12]]:3-14: note: in thunk for C++ function used here [InCppThunk] - // CHECK:STDERR: - // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE-3]]:12-13: error: forming value of incomplete type `Cpp.ForwardDeclaredUnion` [IncompleteTypeInValueConversion] - // CHECK:STDERR: included from: fail_import_decl_value_param_type.carbon:[[@LINE-12]]:10 [InCppInclude] - // CHECK:STDERR: ./decl_value_param_type.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: ./decl_value_param_type.h:4:31: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: - // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE+5]]:12-13: error: forming value of incomplete type `Cpp.ForwardDeclaredUnion` [IncompleteTypeInValueConversion] - // CHECK:STDERR: included from: fail_import_decl_value_param_type.carbon:[[@LINE-17]]:10 [InCppInclude] - // CHECK:STDERR: ./decl_value_param_type.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: ./decl_value_param_type.h:5:31: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_import_decl_value_param_type.carbon:[[@LINE+19]]:12 + // CHECK:STDERR: -> │ Cpp.foo2(*p); + // CHECK:STDERR: · ┳━ + // CHECK:STDERR: · ┗━━┫ error: forming value of incomplete type + // CHECK:STDERR: · ┃ `Cpp.ForwardDeclaredUnion` + // CHECK:STDERR: · ┃ [IncompleteTypeInValueConversion] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ ╭── included from: fail_import_decl_value_param_type.carbon [InCppInclude] + // CHECK:STDERR: ├─┤ ./decl_value_param_type.h + // CHECK:STDERR: │ union ForwardDeclaredUnion; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ auto foo2(ForwardDeclaredUnion) -> void; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.foo2(*p); } @@ -254,9 +306,18 @@ library "[[@TEST_NAME]]"; import Cpp library "incomplete.h"; fn F() { - // CHECK:STDERR: fail_import_incomplete.carbon:[[@LINE+4]]:3-25: error: member access into incomplete class `Cpp.IncompleteUnion` [QualifiedExprInIncompleteClassScope] - // CHECK:STDERR: included from: fail_import_incomplete.carbon:[[@LINE-4]]:10 [InCppInclude] - // CHECK:STDERR: ./incomplete.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ╭─┤ fail_import_incomplete.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: -> │ Cpp.IncompleteUnion.foo(); + // CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: member access into incomplete class `Cpp.IncompleteUnion` + // CHECK:STDERR: · ┃ [QualifiedExprInIncompleteClassScope] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ ╭── included from: fail_import_incomplete.carbon [InCppInclude] + // CHECK:STDERR: ├─┤ ./incomplete.h + // CHECK:STDERR: │ union IncompleteUnion; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.IncompleteUnion.foo(); } @@ -313,25 +374,51 @@ fn F(u: Cpp.DefPointerParamUnion*) { union DeclValueReturnUnion; +// CHECK:STDERR: ╷ ╭── included from: fail_import_decl_value_return_type.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./decl_value_return_type.h:[[@LINE+18]]:6 +// CHECK:STDERR: │ union DeclValueReturnUnion; +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ forward declaration of 'DeclValueReturnUnion' [CppInteropParseNote] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ auto foo_decl_value_return() -> DeclValueReturnUnion; +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: calling 'foo_decl_value_return' with incomplete return type +// CHECK:STDERR: · │ ┃ 'DeclValueReturnUnion' +// CHECK:STDERR: · │ ┃ [CppInteropParseError] +// CHECK:STDERR: · ╰────┤ 'foo_decl_value_return' declared here [CppInteropParseNote] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ fail_import_decl_value_return_type.carbon +// CHECK:STDERR: │ Cpp.foo_decl_value_return(); +// CHECK:STDERR: · ─────────────┬───────────── +// CHECK:STDERR: · ╰──┤ in thunk for C++ function used here [InCppThunk] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: auto foo_decl_value_return() -> DeclValueReturnUnion; // --- fail_import_decl_value_return_type.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: included from: fail_import_decl_value_return_type.carbon:[[@LINE+4]]:10 [InCppInclude] -// CHECK:STDERR: ./decl_value_return_type.h:4:6-26: error: calling 'foo_decl_value_return' with incomplete return type 'DeclValueReturnUnion' [CppInteropParseError] -// CHECK:STDERR: ./decl_value_return_type.h:4:6: note: 'foo_decl_value_return' declared here [CppInteropParseNote] -// CHECK:STDERR: ./decl_value_return_type.h:2:7: note: forward declaration of 'DeclValueReturnUnion' [CppInteropParseNote] import Cpp library "decl_value_return_type.h"; fn F() { - // CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE+7]]:3-29: note: in thunk for C++ function used here [InCppThunk] - // CHECK:STDERR: - // CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE+5]]:3-29: error: function returns incomplete type `Cpp.DeclValueReturnUnion` [IncompleteTypeInFunctionReturnType] - // CHECK:STDERR: included from: fail_import_decl_value_return_type.carbon:[[@LINE-6]]:10 [InCppInclude] - // CHECK:STDERR: ./decl_value_return_type.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere] - // CHECK:STDERR: ./decl_value_return_type.h:4:33: note: return type declared here [IncompleteReturnTypeHere] + // CHECK:STDERR: ╭─┤ fail_import_decl_value_return_type.carbon:[[@LINE+18]]:3 + // CHECK:STDERR: -> │ Cpp.foo_decl_value_return(); + // CHECK:STDERR: · ━━━━━━━┳━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: function returns incomplete type `Cpp.DeclValueReturnUnion` + // CHECK:STDERR: · ┃ [IncompleteTypeInFunctionReturnType] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ ╭── included from: fail_import_decl_value_return_type.carbon [InCppInclude] + // CHECK:STDERR: ├─┤ ./decl_value_return_type.h + // CHECK:STDERR: │ union DeclValueReturnUnion; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ auto foo_decl_value_return() -> DeclValueReturnUnion; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ return type declared here + // CHECK:STDERR: · │ [IncompleteReturnTypeHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.foo_decl_value_return(); } diff --git a/toolchain/check/testdata/interop/cpp/impls/as.carbon b/toolchain/check/testdata/interop/cpp/impls/as.carbon index 3becdfe2a5d7..e65cbedd1de6 100644 --- a/toolchain/check/testdata/interop/cpp/impls/as.carbon +++ b/toolchain/check/testdata/interop/cpp/impls/as.carbon @@ -112,8 +112,19 @@ import Cpp library "conversions.h"; fn ConstructorExplicit(s: Cpp.Source) { //@dump-sem-ir-begin - // CHECK:STDERR: fail_conditionally_explicit_implicit.carbon:[[@LINE+3]]:42: error: cannot implicitly convert expression of type `Source` to `Cpp.ConditionallyExplicit` [ConversionFailure] - // CHECK:STDERR: fail_conditionally_explicit_implicit.carbon:[[@LINE+2]]:42: note: type `Cpp.Source` does not implement interface `Core.ImplicitAs(Cpp.ConditionallyExplicit)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_conditionally_explicit_implicit.carbon:[[@LINE+14]]:42 + // CHECK:STDERR: -> │ let _: Cpp.ConditionallyExplicitTrue = s; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert + // CHECK:STDERR: · │ ┃ expression of type `Source` + // CHECK:STDERR: · │ ┃ to + // CHECK:STDERR: · │ ┃ `Cpp.ConditionallyExplicit` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╭────────────────────────────────────────╯ + // CHECK:STDERR: · │ type `Cpp.Source` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.ConditionallyExplicit)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: Cpp.ConditionallyExplicitTrue = s; //@dump-sem-ir-end @@ -560,9 +571,9 @@ fn ConversionExplicit(s: Cpp.ConditionallyExplicitFalse) { // CHECK:STDOUT: fn @ConstructorExplicit(%s.param: %Source) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %s.ref: %Source = name_ref s, %s -// CHECK:STDOUT: %.loc11_42: %ConditionallyExplicit.9d4 = converted %s.ref, [concrete = ] -// CHECK:STDOUT: %.loc11_13: type = splice_block %ConditionallyExplicitTrue.ref [concrete = constants.%ConditionallyExplicit.9d4] { -// CHECK:STDOUT: %Cpp.ref.loc11: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %.loc22_42: %ConditionallyExplicit.9d4 = converted %s.ref, [concrete = ] +// CHECK:STDOUT: %.loc22_13: type = splice_block %ConditionallyExplicitTrue.ref [concrete = constants.%ConditionallyExplicit.9d4] { +// CHECK:STDOUT: %Cpp.ref.loc22: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %ConditionallyExplicitTrue.ref: type = name_ref ConditionallyExplicitTrue, imports.%ConditionallyExplicit.decl.6ab [concrete = constants.%ConditionallyExplicit.9d4] // CHECK:STDOUT: } // CHECK:STDOUT: %_: %ConditionallyExplicit.9d4 = wrapper_binding _, [concrete = ] @@ -575,27 +586,27 @@ fn ConversionExplicit(s: Cpp.ConditionallyExplicitFalse) { // CHECK:STDOUT: fn @ConversionExplicit(%s.param: %ConditionallyExplicit.3cd) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %s.ref: %ConditionallyExplicit.3cd = name_ref s, %s -// CHECK:STDOUT: %.loc17_21.1: ref %Dest.980 = temporary_storage -// CHECK:STDOUT: %addr: %ptr.ca8 = addr_of %.loc17_21.1 +// CHECK:STDOUT: %.loc28_21.1: ref %Dest.980 = temporary_storage +// CHECK:STDOUT: %addr: %ptr.ca8 = addr_of %.loc28_21.1 // CHECK:STDOUT: %Dest__carbon_thunk.call: init %empty_tuple.type = call imports.%Dest__carbon_thunk.decl(%s.ref, %addr) -// CHECK:STDOUT: %.loc17_21.2: init %Dest.980 to %.loc17_21.1 = mark_in_place_init %Dest__carbon_thunk.call -// CHECK:STDOUT: %.loc17_21.3: init %Dest.980 = converted %s.ref, %.loc17_21.2 -// CHECK:STDOUT: %.loc17_21.4: ref %Dest.980 = temporary %.loc17_21.1, %.loc17_21.3 -// CHECK:STDOUT: %.loc17_21.5: %Dest.980 = acquire_value %.loc17_21.4 -// CHECK:STDOUT: %.loc17_13: type = splice_block %Dest.ref [concrete = constants.%Dest.980] { -// CHECK:STDOUT: %Cpp.ref.loc17: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %.loc28_21.2: init %Dest.980 to %.loc28_21.1 = mark_in_place_init %Dest__carbon_thunk.call +// CHECK:STDOUT: %.loc28_21.3: init %Dest.980 = converted %s.ref, %.loc28_21.2 +// CHECK:STDOUT: %.loc28_21.4: ref %Dest.980 = temporary %.loc28_21.1, %.loc28_21.3 +// CHECK:STDOUT: %.loc28_21.5: %Dest.980 = acquire_value %.loc28_21.4 +// CHECK:STDOUT: %.loc28_13: type = splice_block %Dest.ref [concrete = constants.%Dest.980] { +// CHECK:STDOUT: %Cpp.ref.loc28: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %Dest.ref: type = name_ref Dest, imports.%Dest.decl [concrete = constants.%Dest.980] // CHECK:STDOUT: } -// CHECK:STDOUT: %_: %Dest.980 = wrapper_binding _, %.loc17_21.5 +// CHECK:STDOUT: %_: %Dest.980 = wrapper_binding _, %.loc28_21.5 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %_.patt: %pattern_type.b72 = value_binding_pattern _ [concrete = constants.%_.patt.664] // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.facet.loc17_21.1: %Destroy.type = facet_value constants.%Dest.980, (constants.%DestroyImpl.impl_witness.771, constants.%custom_witness.576) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc17_21.6: %Destroy.type = converted constants.%Dest.980, %Destroy.facet.loc17_21.1 [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %Destroy.facet.loc17_21.2: %Destroy.type = facet_value constants.%Dest.980, (constants.%DestroyImpl.impl_witness.771, constants.%custom_witness.576) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc17_21.7: %Destroy.type = converted constants.%Dest.980, %Destroy.facet.loc17_21.2 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %Destroy.facet.loc28_21.1: %Destroy.type = facet_value constants.%Dest.980, (constants.%DestroyImpl.impl_witness.771, constants.%custom_witness.576) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc28_21.6: %Destroy.type = converted constants.%Dest.980, %Destroy.facet.loc28_21.1 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %Destroy.facet.loc28_21.2: %Destroy.type = facet_value constants.%Dest.980, (constants.%DestroyImpl.impl_witness.771, constants.%custom_witness.576) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc28_21.7: %Destroy.type = converted constants.%Dest.980, %Destroy.facet.loc28_21.2 [concrete = constants.%Destroy.facet] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc17_21.4) +// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc28_21.4) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interop/cpp/impls/copy.carbon b/toolchain/check/testdata/interop/cpp/impls/copy.carbon index 48bcbedda5b1..d86a2eff816c 100644 --- a/toolchain/check/testdata/interop/cpp/impls/copy.carbon +++ b/toolchain/check/testdata/interop/cpp/impls/copy.carbon @@ -83,54 +83,116 @@ library "[[@TEST_NAME]]"; import Cpp library "types.h"; fn CopyDeletedCopy(c: Cpp.DeletedCopy) -> Cpp.DeletedCopy { - // CHECK:STDERR: fail_copy_noncopyable.carbon:[[@LINE+3]]:10: error: attempt to use a deleted function [CppInteropParseError] - // CHECK:STDERR: ./types.h:14:3: note: 'DeletedCopy' has been explicitly marked deleted here [CppInteropParseNote] + // CHECK:STDERR: ╭─┤ fail_copy_noncopyable.carbon:[[@LINE+12]]:10 + // CHECK:STDERR: -> │ return c; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: attempt to use a deleted function [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./types.h + // CHECK:STDERR: │ DeletedCopy(const DeletedCopy&) = delete; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ 'DeletedCopy' has been explicitly marked deleted here + // CHECK:STDERR: · │ [CppInteropParseNote] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return c; } fn CopyMoveOnly(c: Cpp.MoveOnly) -> Cpp.MoveOnly { - // CHECK:STDERR: fail_copy_noncopyable.carbon:[[@LINE+3]]:10: error: attempt to use a deleted function [CppInteropParseError] - // CHECK:STDERR: ./types.h:19:3: note: copy constructor is implicitly deleted because 'MoveOnly' has a user-declared move constructor [CppInteropParseNote] + // CHECK:STDERR: ╭─┤ fail_copy_noncopyable.carbon:[[@LINE+13]]:10 + // CHECK:STDERR: -> │ return c; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: attempt to use a deleted function [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./types.h + // CHECK:STDERR: │ MoveOnly(MoveOnly&&); + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ copy constructor is implicitly deleted because 'MoveOnly' has a + // CHECK:STDERR: · │ user-declared move constructor + // CHECK:STDERR: · │ [CppInteropParseNote] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return c; } fn CopyDeletedMove(c: Cpp.DeletedMove) -> Cpp.DeletedMove { - // CHECK:STDERR: fail_copy_noncopyable.carbon:[[@LINE+3]]:10: error: attempt to use a deleted function [CppInteropParseError] - // CHECK:STDERR: ./types.h:24:3: note: copy constructor is implicitly deleted because 'DeletedMove' has a user-declared move constructor [CppInteropParseNote] + // CHECK:STDERR: ╭─┤ fail_copy_noncopyable.carbon:[[@LINE+13]]:10 + // CHECK:STDERR: -> │ return c; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: attempt to use a deleted function [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./types.h + // CHECK:STDERR: │ DeletedMove(DeletedMove&&) = delete; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ copy constructor is implicitly deleted because 'DeletedMove' has a + // CHECK:STDERR: · │ user-declared move constructor + // CHECK:STDERR: · │ [CppInteropParseNote] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return c; } fn CopyNonConstCopy(c: Cpp.NonConstCopy) -> Cpp.NonConstCopy { // TODO: List candidates here. - // CHECK:STDERR: fail_copy_noncopyable.carbon:[[@LINE+3]]:10: error: cannot copy value of type `NonConstCopy` [CopyOfUncopyableType] - // CHECK:STDERR: fail_copy_noncopyable.carbon:[[@LINE+2]]:10: note: type `Cpp.NonConstCopy` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_copy_noncopyable.carbon:[[@LINE+9]]:10 + // CHECK:STDERR: -> │ return c; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot copy value of type `NonConstCopy` + // CHECK:STDERR: · │ ┃ [CopyOfUncopyableType] + // CHECK:STDERR: · ╰────┤ type `Cpp.NonConstCopy` does not implement interface `Core.Copy` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return c; } fn CopyAmbiguousCopy(c: Cpp.AmbiguousCopy) -> Cpp.AmbiguousCopy { // TODO: List candidates here. - // CHECK:STDERR: fail_copy_noncopyable.carbon:[[@LINE+3]]:10: error: cannot copy value of type `AmbiguousCopy` [CopyOfUncopyableType] - // CHECK:STDERR: fail_copy_noncopyable.carbon:[[@LINE+2]]:10: note: type `Cpp.AmbiguousCopy` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_copy_noncopyable.carbon:[[@LINE+10]]:10 + // CHECK:STDERR: -> │ return c; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot copy value of type `AmbiguousCopy` + // CHECK:STDERR: · │ ┃ [CopyOfUncopyableType] + // CHECK:STDERR: · ╰────┤ type `Cpp.AmbiguousCopy` does not implement interface + // CHECK:STDERR: · │ `Core.Copy` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return c; } fn CopyPrivateCopy(c: Cpp.PrivateCopy) -> Cpp.PrivateCopy { // TODO: Note is missing location. - // CHECK:STDERR: fail_copy_noncopyable.carbon:[[@LINE+3]]:10: error: cannot access private member `PrivateCopy` of type `Cpp.PrivateCopy` [ClassInvalidMemberAccess] - // CHECK:STDERR: ./types.h:40:3: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_copy_noncopyable.carbon:[[@LINE+13]]:10 + // CHECK:STDERR: -> │ return c; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `PrivateCopy` of type + // CHECK:STDERR: · ┃ `Cpp.PrivateCopy` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./types.h + // CHECK:STDERR: │ PrivateCopy(const PrivateCopy&); + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return c; } fn CopyProtectedCopy(c: Cpp.ProtectedCopy) -> Cpp.ProtectedCopy { // TODO: Note is missing location. - // CHECK:STDERR: fail_copy_noncopyable.carbon:[[@LINE+3]]:10: error: cannot access protected member `ProtectedCopy` of type `Cpp.ProtectedCopy` [ClassInvalidMemberAccess] - // CHECK:STDERR: ./types.h:45:3: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_copy_noncopyable.carbon:[[@LINE+13]]:10 + // CHECK:STDERR: -> │ return c; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot access protected member `ProtectedCopy` of type + // CHECK:STDERR: · ┃ `Cpp.ProtectedCopy` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./types.h + // CHECK:STDERR: │ ProtectedCopy(const ProtectedCopy&); + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return c; } diff --git a/toolchain/check/testdata/interop/cpp/impls/cpp_range_for_iterate.carbon b/toolchain/check/testdata/interop/cpp/impls/cpp_range_for_iterate.carbon index 2656aeec533a..daa21270bc6e 100644 --- a/toolchain/check/testdata/interop/cpp/impls/cpp_range_for_iterate.carbon +++ b/toolchain/check/testdata/interop/cpp/impls/cpp_range_for_iterate.carbon @@ -148,16 +148,50 @@ namespace N { class MutableRange { struct Iterator {}; public: - // CHECK:STDERR: fail_todo_adl_returns_same_types_mutable.carbon:[[@LINE+5]]:15: error: value expression passed to reference parameter [ValueForRefParam] - // CHECK:STDERR: fail_todo_adl_returns_same_types_mutable.carbon:[[@LINE+4]]:34: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: cpp_range_for_iterate.carbon:10:3-29: note: while building thunk to match the signature of this function [ThunkSignature] - // CHECK:STDERR: cpp_range_for_iterate.carbon:21:33-63: note: initializing generic parameter `R` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_todo_adl_returns_same_types_mutable.carbon:[[@LINE+22]]:15 + // CHECK:STDERR: -> │ friend auto begin(MutableRange&) -> Iterator; + // CHECK:STDERR: · ┳ ┬ + // CHECK:STDERR: · ┗━━━━━━━━━━━━━━━━━━━━━┫ error: value expression passed to + // CHECK:STDERR: · │ ┃ reference parameter + // CHECK:STDERR: · │ ┃ [ValueForRefParam] + // CHECK:STDERR: · ╰────┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ cpp_range_for_iterate.carbon + // CHECK:STDERR: │ fn Begin(self) -> Iterator; + // CHECK:STDERR: · ─────────────┬───────────── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ fn AssertIsRange(unused generic R: IsRange where .Result = true) {} + // CHECK:STDERR: · ┬────────────────────────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `R` declared + // CHECK:STDERR: · │ here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: friend auto begin(MutableRange&) -> Iterator; - // CHECK:STDERR: fail_todo_adl_returns_same_types_mutable.carbon:[[@LINE+5]]:15: error: value expression passed to reference parameter [ValueForRefParam] - // CHECK:STDERR: fail_todo_adl_returns_same_types_mutable.carbon:[[@LINE+4]]:32: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: cpp_range_for_iterate.carbon:11:3-27: note: while building thunk to match the signature of this function [ThunkSignature] - // CHECK:STDERR: cpp_range_for_iterate.carbon:21:33-63: note: initializing generic parameter `R` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_todo_adl_returns_same_types_mutable.carbon:[[@LINE+22]]:15 + // CHECK:STDERR: -> │ friend auto end(MutableRange&) -> Iterator; + // CHECK:STDERR: · ┳ ┬ + // CHECK:STDERR: · ┗━━━━━━━━━━━━━━━━━━━┫ error: value expression passed to reference + // CHECK:STDERR: · │ ┃ parameter + // CHECK:STDERR: · │ ┃ [ValueForRefParam] + // CHECK:STDERR: · ╰────┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ cpp_range_for_iterate.carbon + // CHECK:STDERR: │ fn End(self) -> Sentinel; + // CHECK:STDERR: · ────────────┬──────────── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ fn AssertIsRange(unused generic R: IsRange where .Result = true) {} + // CHECK:STDERR: · ┬────────────────────────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `R` declared + // CHECK:STDERR: · │ here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: friend auto end(MutableRange&) -> Iterator; }; @@ -198,7 +232,12 @@ import Cpp inline '''c++ namespace N { class MutableRangeWithSentinel { struct Iterator { - // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+2]]:31: error: unknown type name 'ValueType' [CppInteropParseError] + // CHECK:STDERR: ╭─┤ fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+7]]:31 + // CHECK:STDERR: -> │ auto operator*() const -> ValueType&; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: unknown type name 'ValueType' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: auto operator*() const -> ValueType&; auto operator++() -> Iterator&; @@ -209,16 +248,52 @@ class MutableRangeWithSentinel { friend auto operator!=(Sentinel, Iterator) -> bool; }; public: - // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+5]]:15: error: value expression passed to reference parameter [ValueForRefParam] - // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+4]]:46: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: cpp_range_for_iterate.carbon:10:3-29: note: while building thunk to match the signature of this function [ThunkSignature] - // CHECK:STDERR: cpp_range_for_iterate.carbon:21:33-63: note: initializing generic parameter `R` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+23]]:15 + // CHECK:STDERR: -> │ friend auto begin(MutableRangeWithSentinel&) -> Iterator; + // CHECK:STDERR: · ┳ ┬ + // CHECK:STDERR: · ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫ error: value expression passed + // CHECK:STDERR: · │ ┃ to reference parameter + // CHECK:STDERR: · │ ┃ [ValueForRefParam] + // CHECK:STDERR: · ╰────┤ initializing function + // CHECK:STDERR: · │ parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ cpp_range_for_iterate.carbon + // CHECK:STDERR: │ fn Begin(self) -> Iterator; + // CHECK:STDERR: · ─────────────┬───────────── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ fn AssertIsRange(unused generic R: IsRange where .Result = true) {} + // CHECK:STDERR: · ┬────────────────────────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `R` declared + // CHECK:STDERR: · │ here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: friend auto begin(MutableRangeWithSentinel&) -> Iterator; - // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+5]]:15: error: value expression passed to reference parameter [ValueForRefParam] - // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+4]]:44: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: cpp_range_for_iterate.carbon:11:3-27: note: while building thunk to match the signature of this function [ThunkSignature] - // CHECK:STDERR: cpp_range_for_iterate.carbon:21:33-63: note: initializing generic parameter `R` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+23]]:15 + // CHECK:STDERR: -> │ friend auto end(MutableRangeWithSentinel&) -> Sentinel; + // CHECK:STDERR: · ┳ ┬ + // CHECK:STDERR: · ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫ error: value expression passed + // CHECK:STDERR: · │ ┃ to reference parameter + // CHECK:STDERR: · │ ┃ [ValueForRefParam] + // CHECK:STDERR: · ╰────┤ initializing function + // CHECK:STDERR: · │ parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ cpp_range_for_iterate.carbon + // CHECK:STDERR: │ fn End(self) -> Sentinel; + // CHECK:STDERR: · ────────────┬──────────── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ fn AssertIsRange(unused generic R: IsRange where .Result = true) {} + // CHECK:STDERR: · ┬────────────────────────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `R` declared + // CHECK:STDERR: · │ here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: friend auto end(MutableRangeWithSentinel&) -> Sentinel; }; @@ -240,16 +315,50 @@ class MutableAndConstRange { struct Iterator {}; struct ConstIterator {}; public: - // CHECK:STDERR: fail_todo_adl_overloads.carbon:[[@LINE+5]]:15: error: value expression passed to reference parameter [ValueForRefParam] - // CHECK:STDERR: fail_todo_adl_overloads.carbon:[[@LINE+4]]:42: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: cpp_range_for_iterate.carbon:10:3-29: note: while building thunk to match the signature of this function [ThunkSignature] - // CHECK:STDERR: cpp_range_for_iterate.carbon:21:33-63: note: initializing generic parameter `R` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_todo_adl_overloads.carbon:[[@LINE+22]]:15 + // CHECK:STDERR: -> │ friend auto begin(MutableAndConstRange&) -> Iterator; + // CHECK:STDERR: · ┳ ┬ + // CHECK:STDERR: · ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫ error: value expression passed to + // CHECK:STDERR: · │ ┃ reference parameter + // CHECK:STDERR: · │ ┃ [ValueForRefParam] + // CHECK:STDERR: · ╰────┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ cpp_range_for_iterate.carbon + // CHECK:STDERR: │ fn Begin(self) -> Iterator; + // CHECK:STDERR: · ─────────────┬───────────── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ fn AssertIsRange(unused generic R: IsRange where .Result = true) {} + // CHECK:STDERR: · ┬────────────────────────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `R` declared + // CHECK:STDERR: · │ here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: friend auto begin(MutableAndConstRange&) -> Iterator; - // CHECK:STDERR: fail_todo_adl_overloads.carbon:[[@LINE+5]]:15: error: value expression passed to reference parameter [ValueForRefParam] - // CHECK:STDERR: fail_todo_adl_overloads.carbon:[[@LINE+4]]:40: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: cpp_range_for_iterate.carbon:11:3-27: note: while building thunk to match the signature of this function [ThunkSignature] - // CHECK:STDERR: cpp_range_for_iterate.carbon:21:33-63: note: initializing generic parameter `R` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_todo_adl_overloads.carbon:[[@LINE+22]]:15 + // CHECK:STDERR: -> │ friend auto end(MutableAndConstRange&) -> Iterator; + // CHECK:STDERR: · ┳ ┬ + // CHECK:STDERR: · ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━┫ error: value expression passed to + // CHECK:STDERR: · │ ┃ reference parameter + // CHECK:STDERR: · │ ┃ [ValueForRefParam] + // CHECK:STDERR: · ╰────┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ cpp_range_for_iterate.carbon + // CHECK:STDERR: │ fn End(self) -> Sentinel; + // CHECK:STDERR: · ────────────┬──────────── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ fn AssertIsRange(unused generic R: IsRange where .Result = true) {} + // CHECK:STDERR: · ┬────────────────────────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `R` declared + // CHECK:STDERR: · │ here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: friend auto end(MutableAndConstRange&) -> Iterator; @@ -348,24 +457,87 @@ struct EndFunctionDeleted { '''; fn Test() { - // CHECK:STDERR: fail_deleted.carbon:[[@LINE+4]]:47: error: attempt to use a deleted function [CppInteropParseError] - // CHECK:STDERR: fail_deleted.carbon:[[@LINE-22]]:8: note: 'begin' has been explicitly marked deleted here [CppInteropParseNote] - // CHECK:STDERR: cpp_range_for_iterate.carbon:22:36-67: note: initializing generic parameter `S` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_deleted.carbon:[[@LINE+20]]:47 + // CHECK:STDERR: │ auto begin() = delete; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ 'begin' has been explicitly marked deleted here + // CHECK:STDERR: · │ [CppInteropParseNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Core.AssertIsNotRange(Cpp.BeginMethodDeleted); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: attempt to use a + // CHECK:STDERR: · ┃ deleted function + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ cpp_range_for_iterate.carbon + // CHECK:STDERR: │ fn AssertIsNotRange(unused generic S: IsRange where .Result = false) {} + // CHECK:STDERR: · ┬─────────────────────────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `S` + // CHECK:STDERR: · │ declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Core.AssertIsNotRange(Cpp.BeginMethodDeleted); - // CHECK:STDERR: fail_deleted.carbon:[[@LINE+4]]:45: error: attempt to use a deleted function [CppInteropParseError] - // CHECK:STDERR: fail_deleted.carbon:[[@LINE-21]]:8: note: 'end' has been explicitly marked deleted here [CppInteropParseNote] - // CHECK:STDERR: cpp_range_for_iterate.carbon:22:36-67: note: initializing generic parameter `S` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_deleted.carbon:[[@LINE+19]]:45 + // CHECK:STDERR: │ auto end() = delete; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ 'end' has been explicitly marked deleted here [CppInteropParseNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Core.AssertIsNotRange(Cpp.EndMethodDeleted); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: attempt to use a deleted + // CHECK:STDERR: · ┃ function + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ cpp_range_for_iterate.carbon + // CHECK:STDERR: │ fn AssertIsNotRange(unused generic S: IsRange where .Result = false) {} + // CHECK:STDERR: · ┬─────────────────────────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `S` + // CHECK:STDERR: · │ declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Core.AssertIsNotRange(Cpp.EndMethodDeleted); - // CHECK:STDERR: fail_deleted.carbon:[[@LINE+4]]:49: error: call to deleted function 'begin' [CppInteropParseError] - // CHECK:STDERR: fail_deleted.carbon:[[@LINE-22]]:15: note: candidate function has been explicitly deleted [CppInteropParseNote] - // CHECK:STDERR: cpp_range_for_iterate.carbon:22:36-67: note: initializing generic parameter `S` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_deleted.carbon:[[@LINE+20]]:49 + // CHECK:STDERR: │ friend auto begin(const BeginFunctionDeleted&) = delete; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ candidate function has been explicitly deleted + // CHECK:STDERR: · │ [CppInteropParseNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Core.AssertIsNotRange(Cpp.BeginFunctionDeleted); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: call to deleted + // CHECK:STDERR: · ┃ function 'begin' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ cpp_range_for_iterate.carbon + // CHECK:STDERR: │ fn AssertIsNotRange(unused generic S: IsRange where .Result = false) {} + // CHECK:STDERR: · ┬─────────────────────────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `S` + // CHECK:STDERR: · │ declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Core.AssertIsNotRange(Cpp.BeginFunctionDeleted); - // CHECK:STDERR: fail_deleted.carbon:[[@LINE+4]]:47: error: call to deleted function 'end' [CppInteropParseError] - // CHECK:STDERR: fail_deleted.carbon:[[@LINE-21]]:15: note: candidate function has been explicitly deleted [CppInteropParseNote] - // CHECK:STDERR: cpp_range_for_iterate.carbon:22:36-67: note: initializing generic parameter `S` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_deleted.carbon:[[@LINE+20]]:47 + // CHECK:STDERR: │ friend auto end(const EndFunctionDeleted&) = delete; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ candidate function has been explicitly deleted + // CHECK:STDERR: · │ [CppInteropParseNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Core.AssertIsNotRange(Cpp.EndFunctionDeleted); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: call to deleted + // CHECK:STDERR: · ┃ function 'end' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ cpp_range_for_iterate.carbon + // CHECK:STDERR: │ fn AssertIsNotRange(unused generic S: IsRange where .Result = false) {} + // CHECK:STDERR: · ┬─────────────────────────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `S` + // CHECK:STDERR: · │ declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Core.AssertIsNotRange(Cpp.EndFunctionDeleted); } diff --git a/toolchain/check/testdata/interop/cpp/impls/destroy.carbon b/toolchain/check/testdata/interop/cpp/impls/destroy.carbon index 272e5cbd62e3..f8e9c1d1d180 100644 --- a/toolchain/check/testdata/interop/cpp/impls/destroy.carbon +++ b/toolchain/check/testdata/interop/cpp/impls/destroy.carbon @@ -77,9 +77,24 @@ class Derived { fn DestroyClassWithProtectedBaseDestructor() { //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_destroy_protected_base_destructor.carbon:[[@LINE+4]]:3-23: error: cannot access protected member `` of type `Cpp.ProtectedDestructor` [ClassInvalidMemberAccess] - // CHECK:STDERR: ./types.h:33:3: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: min_prelude/parts/destroy.carbon:32:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_todo_destroy_protected_base_destructor.carbon:[[@LINE+19]]:3 + // CHECK:STDERR: -> │ var unused a: Derived = {.base = {}}; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access protected member `` of type + // CHECK:STDERR: · ┃ `Cpp.ProtectedDestructor` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./types.h + // CHECK:STDERR: │ ~ProtectedDestructor(); + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ min_prelude/parts/destroy.carbon + // CHECK:STDERR: │ fn SelfDestruct[T: Destroy](ref t: T) { + // CHECK:STDERR: · ───────────────────┬─────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused a: Derived = {.base = {}}; //@dump-sem-ir-end @@ -98,9 +113,24 @@ class Derived { fn DestroyClassWithPrivateBaseDestructor() { //@dump-sem-ir-begin // TODO: We should not allow this, as the destructor of the base class is private. - // CHECK:STDERR: fail_destroy_private_base_destructor.carbon:[[@LINE+4]]:3-23: error: cannot access private member `` of type `Cpp.PrivateDestructor` [ClassInvalidMemberAccess] - // CHECK:STDERR: ./types.h:28:3: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: min_prelude/parts/destroy.carbon:32:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_destroy_private_base_destructor.carbon:[[@LINE+19]]:3 + // CHECK:STDERR: -> │ var unused a: Derived = {.base = {}}; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `` of type + // CHECK:STDERR: · ┃ `Cpp.PrivateDestructor` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./types.h + // CHECK:STDERR: │ ~PrivateDestructor(); + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ min_prelude/parts/destroy.carbon + // CHECK:STDERR: │ fn SelfDestruct[T: Destroy](ref t: T) { + // CHECK:STDERR: · ───────────────────┬─────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused a: Derived = {.base = {}}; //@dump-sem-ir-end @@ -113,39 +143,112 @@ library "[[@TEST_NAME]]"; import Cpp library "types.h"; fn AmbiguousDestroy() { - // CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE+7]]:17-39: error: binding pattern has incomplete type `AmbiguousDestructor` in name binding declaration [IncompleteTypeInBindingDecl] - // CHECK:STDERR: included from: fail_destroy_nondestroyable.carbon:[[@LINE-4]]:10 [InCppInclude] - // CHECK:STDERR: ./types.h:13:7: note: destructor of class 'AmbiguousDestructorT<>' is ambiguous [CppInteropParseError] - // CHECK:STDERR: ./types.h:13:7: note: in instantiation of template class 'AmbiguousDestructorT<>' requested here [CppInteropParseNote] - // CHECK:STDERR: ./types.h:15:3: note: candidate function [CppInteropParseNote] - // CHECK:STDERR: ./types.h:16:3: note: candidate function [CppInteropParseNote] + // CHECK:STDERR: ╭─┤ fail_destroy_nondestroyable.carbon:[[@LINE+25]]:17 + // CHECK:STDERR: -> │ var unused a: Cpp.AmbiguousDestructor = {}; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: binding pattern has incomplete type + // CHECK:STDERR: · ┃ `AmbiguousDestructor` in name binding declaration + // CHECK:STDERR: · ┃ [IncompleteTypeInBindingDecl] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ ╭── included from: fail_destroy_nondestroyable.carbon [InCppInclude] + // CHECK:STDERR: ├─┤ ./types.h + // CHECK:STDERR: │ class AmbiguousDestructorT { + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ in instantiation of template class 'AmbiguousDestructorT<>' requested + // CHECK:STDERR: · │ │ here + // CHECK:STDERR: · │ │ [CppInteropParseNote] + // CHECK:STDERR: · ╰────┤ destructor of class 'AmbiguousDestructorT<>' is ambiguous + // CHECK:STDERR: · │ [CppInteropParseError] + // CHECK:STDERR: │ public: + // CHECK:STDERR: │ ~AmbiguousDestructorT() requires (N != 1); + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ candidate function [CppInteropParseNote] + // CHECK:STDERR: │ ~AmbiguousDestructorT() requires (N != 2); + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ candidate function [CppInteropParseNote] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused a: Cpp.AmbiguousDestructor = {}; } fn DeletedDestroy() { - // CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE+7]]:3: error: attempt to use a deleted function [CppInteropParseError] - // CHECK:STDERR: ./types.h:23:3: note: '~DeletedDestructor' has been explicitly marked deleted here [CppInteropParseNote] - // CHECK:STDERR: min_prelude/parts/destroy.carbon:32:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_destroy_nondestroyable.carbon:[[@LINE+32]]:3 + // CHECK:STDERR: -> │ var unused a: Cpp.DeletedDestructor = {}; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: attempt to use a deleted function [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./types.h + // CHECK:STDERR: │ ~DeletedDestructor() = delete; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ '~DeletedDestructor' has been explicitly marked deleted here + // CHECK:STDERR: · │ [CppInteropParseNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ min_prelude/parts/destroy.carbon + // CHECK:STDERR: │ fn SelfDestruct[T: Destroy](ref t: T) { + // CHECK:STDERR: · ───────────────────┬─────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE+3]]:3-37: error: cannot convert type `Cpp.DeletedDestructor` into type implementing `Core.Destroy` [ConversionFailureTypeToFacet] - // CHECK:STDERR: min_prelude/parts/destroy.carbon:32:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_destroy_nondestroyable.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: -> │ var unused a: Cpp.DeletedDestructor = {}; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.DeletedDestructor` into type implementing + // CHECK:STDERR: · ┃ `Core.Destroy` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ min_prelude/parts/destroy.carbon + // CHECK:STDERR: │ fn SelfDestruct[T: Destroy](ref t: T) { + // CHECK:STDERR: · ───────────────────┬─────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused a: Cpp.DeletedDestructor = {}; } fn PrivateDestroy() { - // CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE+4]]:3-37: error: cannot access private member `` of type `Cpp.PrivateDestructor` [ClassInvalidMemberAccess] - // CHECK:STDERR: ./types.h:28:3: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: min_prelude/parts/destroy.carbon:32:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_destroy_nondestroyable.carbon:[[@LINE+19]]:3 + // CHECK:STDERR: -> │ var unused a: Cpp.PrivateDestructor = {}; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `` of type + // CHECK:STDERR: · ┃ `Cpp.PrivateDestructor` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./types.h + // CHECK:STDERR: │ ~PrivateDestructor(); + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ min_prelude/parts/destroy.carbon + // CHECK:STDERR: │ fn SelfDestruct[T: Destroy](ref t: T) { + // CHECK:STDERR: · ───────────────────┬─────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused a: Cpp.PrivateDestructor = {}; } fn ProtectedDestroy() { - // CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE+4]]:3-39: error: cannot access protected member `` of type `Cpp.ProtectedDestructor` [ClassInvalidMemberAccess] - // CHECK:STDERR: ./types.h:33:3: note: declared here [ClassMemberDeclaration] - // CHECK:STDERR: min_prelude/parts/destroy.carbon:32:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_destroy_nondestroyable.carbon:[[@LINE+19]]:3 + // CHECK:STDERR: -> │ var unused a: Cpp.ProtectedDestructor = {}; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access protected member `` of type + // CHECK:STDERR: · ┃ `Cpp.ProtectedDestructor` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./types.h + // CHECK:STDERR: │ ~ProtectedDestructor(); + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ min_prelude/parts/destroy.carbon + // CHECK:STDERR: │ fn SelfDestruct[T: Destroy](ref t: T) { + // CHECK:STDERR: · ───────────────────┬─────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused a: Cpp.ProtectedDestructor = {}; } @@ -183,9 +286,23 @@ class AdaptNoDestroy { fn Make() -> AdaptNoDestroy; fn F() { - // CHECK:STDERR: fail_no_destroy.carbon:[[@LINE+4]]:3: error: attempt to use a deleted function [CppInteropParseError] - // CHECK:STDERR: ./types.h:23:3: note: '~DeletedDestructor' has been explicitly marked deleted here [CppInteropParseNote] - // CHECK:STDERR: min_prelude/parts/destroy.carbon:32:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_no_destroy.carbon:[[@LINE+18]]:3 + // CHECK:STDERR: -> │ var _: AdaptNoDestroy = Make(); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: attempt to use a deleted function [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./types.h + // CHECK:STDERR: │ ~DeletedDestructor() = delete; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ '~DeletedDestructor' has been explicitly marked deleted here + // CHECK:STDERR: · │ [CppInteropParseNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ min_prelude/parts/destroy.carbon + // CHECK:STDERR: │ fn SelfDestruct[T: Destroy](ref t: T) { + // CHECK:STDERR: · ───────────────────┬─────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var _: AdaptNoDestroy = Make(); } @@ -396,7 +513,7 @@ fn F() { // CHECK:STDOUT: %SubobjectDestroy.facet.e5d: %SubobjectDestroy.type = facet_value %ProtectedDestructor, (%custom_witness.fe1) [concrete] // CHECK:STDOUT: %DestroyImpl.impl_witness.721: = impl_witness imports.%DestroyImpl.impl_witness_table, @T.as_type.as.DestroyImpl.impl(%SubobjectDestroy.facet.e5d) [concrete] // CHECK:STDOUT: %Destroy.facet.fe4: %Destroy.type = facet_value %ProtectedDestructor, (%DestroyImpl.impl_witness.721, %custom_witness.fe1) [concrete] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.2: type = fn_type @SubobjectDestroy.WithSelf.Op.loc16_3.2 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.2: type = fn_type @SubobjectDestroy.WithSelf.Op.loc31_3.2 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.2: %SubobjectDestroy.WithSelf.Op.type.6870fd.2 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80ef6.2: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.2), @SubobjectDestroy [concrete] // CHECK:STDOUT: %SubobjectDestroy.facet.1fc: %SubobjectDestroy.type = facet_value %Derived, (%custom_witness.b80ef6.2) [concrete] @@ -412,52 +529,52 @@ fn F() { // CHECK:STDOUT: fn @DestroyClassWithProtectedBaseDestructor() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.var: ref %Derived = var_storage %a.var_patt -// CHECK:STDOUT: %.loc16_37.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct.a40] -// CHECK:STDOUT: %.loc16_38.1: %struct_type.base.f5e = struct_literal (%.loc16_37.1) [concrete = constants.%struct] -// CHECK:STDOUT: %.loc16_38.2: ref %.a6c = class_element_access %a.var, element0 -// CHECK:STDOUT: %.loc16_37.2: init %.a6c to %.loc16_38.2 = class_init () [concrete = constants.%empty_struct.ec1] -// CHECK:STDOUT: %.loc16_38.3: init %.a6c = converted %.loc16_37.1, %.loc16_37.2 [concrete = constants.%empty_struct.ec1] -// CHECK:STDOUT: %.loc16_38.4: init %ProtectedDestructor = as_compatible %.loc16_38.3 [concrete = constants.%ProtectedDestructor.val] -// CHECK:STDOUT: %.loc16_38.5: init %Derived to %a.var = class_init (%.loc16_38.4) [concrete = constants.%Derived.val] -// CHECK:STDOUT: %.loc16_3.1: init %Derived = converted %.loc16_38.1, %.loc16_38.5 [concrete = constants.%Derived.val] -// CHECK:STDOUT: assign %a.var, %.loc16_3.1 +// CHECK:STDOUT: %.loc31_37.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct.a40] +// CHECK:STDOUT: %.loc31_38.1: %struct_type.base.f5e = struct_literal (%.loc31_37.1) [concrete = constants.%struct] +// CHECK:STDOUT: %.loc31_38.2: ref %.a6c = class_element_access %a.var, element0 +// CHECK:STDOUT: %.loc31_37.2: init %.a6c to %.loc31_38.2 = class_init () [concrete = constants.%empty_struct.ec1] +// CHECK:STDOUT: %.loc31_38.3: init %.a6c = converted %.loc31_37.1, %.loc31_37.2 [concrete = constants.%empty_struct.ec1] +// CHECK:STDOUT: %.loc31_38.4: init %ProtectedDestructor = as_compatible %.loc31_38.3 [concrete = constants.%ProtectedDestructor.val] +// CHECK:STDOUT: %.loc31_38.5: init %Derived to %a.var = class_init (%.loc31_38.4) [concrete = constants.%Derived.val] +// CHECK:STDOUT: %.loc31_3.1: init %Derived = converted %.loc31_38.1, %.loc31_38.5 [concrete = constants.%Derived.val] +// CHECK:STDOUT: assign %a.var, %.loc31_3.1 // CHECK:STDOUT: %Derived.ref: type = name_ref Derived, file.%Derived.decl [concrete = constants.%Derived] // CHECK:STDOUT: %a: ref %Derived = wrapper_binding a, %a.var // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %a.patt: %pattern_type.746 = ref_binding_pattern a [concrete = constants.%a.patt] // CHECK:STDOUT: %a.var_patt: %pattern_type.746 = var_pattern %a.patt [concrete = constants.%a.var_patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.facet.loc16_3.1: %Destroy.type = facet_value constants.%Derived, (constants.%DestroyImpl.impl_witness.660, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.35d] -// CHECK:STDOUT: %.loc16_3.2: %Destroy.type = converted constants.%Derived, %Destroy.facet.loc16_3.1 [concrete = constants.%Destroy.facet.35d] -// CHECK:STDOUT: %Destroy.facet.loc16_3.2: %Destroy.type = facet_value constants.%Derived, (constants.%DestroyImpl.impl_witness.660, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.35d] -// CHECK:STDOUT: %.loc16_3.3: %Destroy.type = converted constants.%Derived, %Destroy.facet.loc16_3.2 [concrete = constants.%Destroy.facet.35d] +// CHECK:STDOUT: %Destroy.facet.loc31_3.1: %Destroy.type = facet_value constants.%Derived, (constants.%DestroyImpl.impl_witness.660, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.35d] +// CHECK:STDOUT: %.loc31_3.2: %Destroy.type = converted constants.%Derived, %Destroy.facet.loc31_3.1 [concrete = constants.%Destroy.facet.35d] +// CHECK:STDOUT: %Destroy.facet.loc31_3.2: %Destroy.type = facet_value constants.%Derived, (constants.%DestroyImpl.impl_witness.660, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.35d] +// CHECK:STDOUT: %.loc31_3.3: %Destroy.type = converted constants.%Derived, %Destroy.facet.loc31_3.2 [concrete = constants.%Destroy.facet.35d] // CHECK:STDOUT: // CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%a.var) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc16_3.1(%self.param: ref %struct_type.base.454) { +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc31_3.1(%self.param: ref %struct_type.base.454) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc16_3.1: ref %ProtectedDestructor = struct_access %self.param, element0 -// CHECK:STDOUT: %Destroy.facet.loc16_3.1: %Destroy.type = facet_value constants.%ProtectedDestructor, (constants.%DestroyImpl.impl_witness.721, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.fe4] -// CHECK:STDOUT: %.loc16_3.2: %Destroy.type = converted constants.%ProtectedDestructor, %Destroy.facet.loc16_3.1 [concrete = constants.%Destroy.facet.fe4] -// CHECK:STDOUT: %Destroy.facet.loc16_3.2: %Destroy.type = facet_value constants.%ProtectedDestructor, (constants.%DestroyImpl.impl_witness.721, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.fe4] -// CHECK:STDOUT: %.loc16_3.3: %Destroy.type = converted constants.%ProtectedDestructor, %Destroy.facet.loc16_3.2 [concrete = constants.%Destroy.facet.fe4] +// CHECK:STDOUT: %.loc31_3.1: ref %ProtectedDestructor = struct_access %self.param, element0 +// CHECK:STDOUT: %Destroy.facet.loc31_3.1: %Destroy.type = facet_value constants.%ProtectedDestructor, (constants.%DestroyImpl.impl_witness.721, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.fe4] +// CHECK:STDOUT: %.loc31_3.2: %Destroy.type = converted constants.%ProtectedDestructor, %Destroy.facet.loc31_3.1 [concrete = constants.%Destroy.facet.fe4] +// CHECK:STDOUT: %Destroy.facet.loc31_3.2: %Destroy.type = facet_value constants.%ProtectedDestructor, (constants.%DestroyImpl.impl_witness.721, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.fe4] +// CHECK:STDOUT: %.loc31_3.3: %Destroy.type = converted constants.%ProtectedDestructor, %Destroy.facet.loc31_3.2 [concrete = constants.%Destroy.facet.fe4] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc16_3.1) +// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc31_3.1) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc16_3.2(%self.param: ref %Derived) { +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc31_3.2(%self.param: ref %Derived) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %base.ref: %Derived.elem = name_ref base, @Derived.%.loc7 [concrete = @Derived.%.loc7] -// CHECK:STDOUT: %.loc16_3.1: ref %ProtectedDestructor = class_element_access %self.param, element0 -// CHECK:STDOUT: %Destroy.facet.loc16_3.1: %Destroy.type = facet_value constants.%ProtectedDestructor, (constants.%DestroyImpl.impl_witness.721, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.fe4] -// CHECK:STDOUT: %.loc16_3.2: %Destroy.type = converted constants.%ProtectedDestructor, %Destroy.facet.loc16_3.1 [concrete = constants.%Destroy.facet.fe4] -// CHECK:STDOUT: %Destroy.facet.loc16_3.2: %Destroy.type = facet_value constants.%ProtectedDestructor, (constants.%DestroyImpl.impl_witness.721, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.fe4] -// CHECK:STDOUT: %.loc16_3.3: %Destroy.type = converted constants.%ProtectedDestructor, %Destroy.facet.loc16_3.2 [concrete = constants.%Destroy.facet.fe4] +// CHECK:STDOUT: %.loc31_3.1: ref %ProtectedDestructor = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.facet.loc31_3.1: %Destroy.type = facet_value constants.%ProtectedDestructor, (constants.%DestroyImpl.impl_witness.721, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.fe4] +// CHECK:STDOUT: %.loc31_3.2: %Destroy.type = converted constants.%ProtectedDestructor, %Destroy.facet.loc31_3.1 [concrete = constants.%Destroy.facet.fe4] +// CHECK:STDOUT: %Destroy.facet.loc31_3.2: %Destroy.type = facet_value constants.%ProtectedDestructor, (constants.%DestroyImpl.impl_witness.721, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.fe4] +// CHECK:STDOUT: %.loc31_3.3: %Destroy.type = converted constants.%ProtectedDestructor, %Destroy.facet.loc31_3.2 [concrete = constants.%Destroy.facet.fe4] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc16_3.1) +// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc31_3.1) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -492,7 +609,7 @@ fn F() { // CHECK:STDOUT: %SubobjectDestroy.facet.be1: %SubobjectDestroy.type = facet_value %PrivateDestructor, (%custom_witness.fe1) [concrete] // CHECK:STDOUT: %DestroyImpl.impl_witness.a8a: = impl_witness imports.%DestroyImpl.impl_witness_table, @T.as_type.as.DestroyImpl.impl(%SubobjectDestroy.facet.be1) [concrete] // CHECK:STDOUT: %Destroy.facet.75a: %Destroy.type = facet_value %PrivateDestructor, (%DestroyImpl.impl_witness.a8a, %custom_witness.fe1) [concrete] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.2: type = fn_type @SubobjectDestroy.WithSelf.Op.loc17_3.2 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.2: type = fn_type @SubobjectDestroy.WithSelf.Op.loc32_3.2 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.2: %SubobjectDestroy.WithSelf.Op.type.6870fd.2 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80ef6.2: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.2), @SubobjectDestroy [concrete] // CHECK:STDOUT: %SubobjectDestroy.facet.1fc: %SubobjectDestroy.type = facet_value %Derived, (%custom_witness.b80ef6.2) [concrete] @@ -508,52 +625,52 @@ fn F() { // CHECK:STDOUT: fn @DestroyClassWithPrivateBaseDestructor() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.var: ref %Derived = var_storage %a.var_patt -// CHECK:STDOUT: %.loc17_37.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct.a40] -// CHECK:STDOUT: %.loc17_38.1: %struct_type.base.f5e = struct_literal (%.loc17_37.1) [concrete = constants.%struct] -// CHECK:STDOUT: %.loc17_38.2: ref %.c73 = class_element_access %a.var, element0 -// CHECK:STDOUT: %.loc17_37.2: init %.c73 to %.loc17_38.2 = class_init () [concrete = constants.%empty_struct.d8b] -// CHECK:STDOUT: %.loc17_38.3: init %.c73 = converted %.loc17_37.1, %.loc17_37.2 [concrete = constants.%empty_struct.d8b] -// CHECK:STDOUT: %.loc17_38.4: init %PrivateDestructor = as_compatible %.loc17_38.3 [concrete = constants.%PrivateDestructor.val] -// CHECK:STDOUT: %.loc17_38.5: init %Derived to %a.var = class_init (%.loc17_38.4) [concrete = constants.%Derived.val] -// CHECK:STDOUT: %.loc17_3.1: init %Derived = converted %.loc17_38.1, %.loc17_38.5 [concrete = constants.%Derived.val] -// CHECK:STDOUT: assign %a.var, %.loc17_3.1 +// CHECK:STDOUT: %.loc32_37.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct.a40] +// CHECK:STDOUT: %.loc32_38.1: %struct_type.base.f5e = struct_literal (%.loc32_37.1) [concrete = constants.%struct] +// CHECK:STDOUT: %.loc32_38.2: ref %.c73 = class_element_access %a.var, element0 +// CHECK:STDOUT: %.loc32_37.2: init %.c73 to %.loc32_38.2 = class_init () [concrete = constants.%empty_struct.d8b] +// CHECK:STDOUT: %.loc32_38.3: init %.c73 = converted %.loc32_37.1, %.loc32_37.2 [concrete = constants.%empty_struct.d8b] +// CHECK:STDOUT: %.loc32_38.4: init %PrivateDestructor = as_compatible %.loc32_38.3 [concrete = constants.%PrivateDestructor.val] +// CHECK:STDOUT: %.loc32_38.5: init %Derived to %a.var = class_init (%.loc32_38.4) [concrete = constants.%Derived.val] +// CHECK:STDOUT: %.loc32_3.1: init %Derived = converted %.loc32_38.1, %.loc32_38.5 [concrete = constants.%Derived.val] +// CHECK:STDOUT: assign %a.var, %.loc32_3.1 // CHECK:STDOUT: %Derived.ref: type = name_ref Derived, file.%Derived.decl [concrete = constants.%Derived] // CHECK:STDOUT: %a: ref %Derived = wrapper_binding a, %a.var // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %a.patt: %pattern_type.746 = ref_binding_pattern a [concrete = constants.%a.patt] // CHECK:STDOUT: %a.var_patt: %pattern_type.746 = var_pattern %a.patt [concrete = constants.%a.var_patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.facet.loc17_3.1: %Destroy.type = facet_value constants.%Derived, (constants.%DestroyImpl.impl_witness.660, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.35d] -// CHECK:STDOUT: %.loc17_3.2: %Destroy.type = converted constants.%Derived, %Destroy.facet.loc17_3.1 [concrete = constants.%Destroy.facet.35d] -// CHECK:STDOUT: %Destroy.facet.loc17_3.2: %Destroy.type = facet_value constants.%Derived, (constants.%DestroyImpl.impl_witness.660, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.35d] -// CHECK:STDOUT: %.loc17_3.3: %Destroy.type = converted constants.%Derived, %Destroy.facet.loc17_3.2 [concrete = constants.%Destroy.facet.35d] +// CHECK:STDOUT: %Destroy.facet.loc32_3.1: %Destroy.type = facet_value constants.%Derived, (constants.%DestroyImpl.impl_witness.660, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.35d] +// CHECK:STDOUT: %.loc32_3.2: %Destroy.type = converted constants.%Derived, %Destroy.facet.loc32_3.1 [concrete = constants.%Destroy.facet.35d] +// CHECK:STDOUT: %Destroy.facet.loc32_3.2: %Destroy.type = facet_value constants.%Derived, (constants.%DestroyImpl.impl_witness.660, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.35d] +// CHECK:STDOUT: %.loc32_3.3: %Destroy.type = converted constants.%Derived, %Destroy.facet.loc32_3.2 [concrete = constants.%Destroy.facet.35d] // CHECK:STDOUT: // CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%a.var) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc17_3.1(%self.param: ref %struct_type.base.9aa) { +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc32_3.1(%self.param: ref %struct_type.base.9aa) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc17_3.1: ref %PrivateDestructor = struct_access %self.param, element0 -// CHECK:STDOUT: %Destroy.facet.loc17_3.1: %Destroy.type = facet_value constants.%PrivateDestructor, (constants.%DestroyImpl.impl_witness.a8a, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.75a] -// CHECK:STDOUT: %.loc17_3.2: %Destroy.type = converted constants.%PrivateDestructor, %Destroy.facet.loc17_3.1 [concrete = constants.%Destroy.facet.75a] -// CHECK:STDOUT: %Destroy.facet.loc17_3.2: %Destroy.type = facet_value constants.%PrivateDestructor, (constants.%DestroyImpl.impl_witness.a8a, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.75a] -// CHECK:STDOUT: %.loc17_3.3: %Destroy.type = converted constants.%PrivateDestructor, %Destroy.facet.loc17_3.2 [concrete = constants.%Destroy.facet.75a] +// CHECK:STDOUT: %.loc32_3.1: ref %PrivateDestructor = struct_access %self.param, element0 +// CHECK:STDOUT: %Destroy.facet.loc32_3.1: %Destroy.type = facet_value constants.%PrivateDestructor, (constants.%DestroyImpl.impl_witness.a8a, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.75a] +// CHECK:STDOUT: %.loc32_3.2: %Destroy.type = converted constants.%PrivateDestructor, %Destroy.facet.loc32_3.1 [concrete = constants.%Destroy.facet.75a] +// CHECK:STDOUT: %Destroy.facet.loc32_3.2: %Destroy.type = facet_value constants.%PrivateDestructor, (constants.%DestroyImpl.impl_witness.a8a, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.75a] +// CHECK:STDOUT: %.loc32_3.3: %Destroy.type = converted constants.%PrivateDestructor, %Destroy.facet.loc32_3.2 [concrete = constants.%Destroy.facet.75a] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc17_3.1) +// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc32_3.1) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc17_3.2(%self.param: ref %Derived) { +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc32_3.2(%self.param: ref %Derived) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %base.ref: %Derived.elem = name_ref base, @Derived.%.loc7 [concrete = @Derived.%.loc7] -// CHECK:STDOUT: %.loc17_3.1: ref %PrivateDestructor = class_element_access %self.param, element0 -// CHECK:STDOUT: %Destroy.facet.loc17_3.1: %Destroy.type = facet_value constants.%PrivateDestructor, (constants.%DestroyImpl.impl_witness.a8a, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.75a] -// CHECK:STDOUT: %.loc17_3.2: %Destroy.type = converted constants.%PrivateDestructor, %Destroy.facet.loc17_3.1 [concrete = constants.%Destroy.facet.75a] -// CHECK:STDOUT: %Destroy.facet.loc17_3.2: %Destroy.type = facet_value constants.%PrivateDestructor, (constants.%DestroyImpl.impl_witness.a8a, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.75a] -// CHECK:STDOUT: %.loc17_3.3: %Destroy.type = converted constants.%PrivateDestructor, %Destroy.facet.loc17_3.2 [concrete = constants.%Destroy.facet.75a] +// CHECK:STDOUT: %.loc32_3.1: ref %PrivateDestructor = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.facet.loc32_3.1: %Destroy.type = facet_value constants.%PrivateDestructor, (constants.%DestroyImpl.impl_witness.a8a, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.75a] +// CHECK:STDOUT: %.loc32_3.2: %Destroy.type = converted constants.%PrivateDestructor, %Destroy.facet.loc32_3.1 [concrete = constants.%Destroy.facet.75a] +// CHECK:STDOUT: %Destroy.facet.loc32_3.2: %Destroy.type = facet_value constants.%PrivateDestructor, (constants.%DestroyImpl.impl_witness.a8a, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.75a] +// CHECK:STDOUT: %.loc32_3.3: %Destroy.type = converted constants.%PrivateDestructor, %Destroy.facet.loc32_3.2 [concrete = constants.%Destroy.facet.75a] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc17_3.1) +// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc32_3.1) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interop/cpp/impls/implicit_as.carbon b/toolchain/check/testdata/interop/cpp/impls/implicit_as.carbon index 3d93cd005a59..03a0804de165 100644 --- a/toolchain/check/testdata/interop/cpp/impls/implicit_as.carbon +++ b/toolchain/check/testdata/interop/cpp/impls/implicit_as.carbon @@ -92,8 +92,16 @@ import Cpp library "implicit_conversions.h"; fn NonConstConversionTest(s: Cpp.NonConstConversion) { //@dump-sem-ir-begin - // CHECK:STDERR: fail_expr_category.carbon:[[@LINE+3]]:21: error: cannot implicitly convert expression of type `NonConstConversion` to `Cpp.Dest` [ConversionFailure] - // CHECK:STDERR: fail_expr_category.carbon:[[@LINE+2]]:21: note: type `Cpp.NonConstConversion` does not implement interface `Core.ImplicitAs(Cpp.Dest)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_expr_category.carbon:[[@LINE+11]]:21 + // CHECK:STDERR: -> │ let _: Cpp.Dest = s; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type + // CHECK:STDERR: · │ ┃ `NonConstConversion` to `Cpp.Dest` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Cpp.NonConstConversion` does not implement + // CHECK:STDERR: · │ interface `Core.ImplicitAs(Cpp.Dest)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: Cpp.Dest = s; //@dump-sem-ir-end @@ -107,8 +115,20 @@ import Cpp library "implicit_conversions.h"; fn InaccessibleConstructorTest(s: Cpp.Source) { //@dump-sem-ir-begin - // CHECK:STDERR: fail_access.carbon:[[@LINE+3]]:40: error: cannot access private member `InaccessibleConstructor` of type `Cpp.InaccessibleConstructor` [ClassInvalidMemberAccess] - // CHECK:STDERR: ./implicit_conversions.h:21:3: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_access.carbon:[[@LINE+15]]:40 + // CHECK:STDERR: -> │ let _: Cpp.InaccessibleConstructor = s; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member + // CHECK:STDERR: · ┃ `InaccessibleConstructor` of + // CHECK:STDERR: · ┃ type + // CHECK:STDERR: · ┃ `Cpp.InaccessibleConstructor` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./implicit_conversions.h + // CHECK:STDERR: │ InaccessibleConstructor(Source); + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: Cpp.InaccessibleConstructor = s; //@dump-sem-ir-end @@ -116,8 +136,18 @@ fn InaccessibleConstructorTest(s: Cpp.Source) { fn InaccessibleConversionTest(s: Cpp.InaccessibleConversion) { //@dump-sem-ir-begin - // CHECK:STDERR: fail_access.carbon:[[@LINE+3]]:21: error: cannot access private member `` of type `Cpp.InaccessibleConversion` [ClassInvalidMemberAccess] - // CHECK:STDERR: ./implicit_conversions.h:26:3: note: declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╭─┤ fail_access.carbon:[[@LINE+13]]:21 + // CHECK:STDERR: -> │ let _: Cpp.Dest = s; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot access private member `` of + // CHECK:STDERR: · ┃ type `Cpp.InaccessibleConversion` + // CHECK:STDERR: · ┃ [ClassInvalidMemberAccess] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./implicit_conversions.h + // CHECK:STDERR: │ operator Dest() const; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: Cpp.Dest = s; //@dump-sem-ir-end @@ -131,8 +161,18 @@ import Cpp library "implicit_conversions.h"; fn DeletedConstructorTest(s: Cpp.Source) { //@dump-sem-ir-begin - // CHECK:STDERR: fail_deleted.carbon:[[@LINE+3]]:35: error: cannot implicitly convert expression of type `Source` to `Cpp.DeletedConstructor` [ConversionFailure] - // CHECK:STDERR: fail_deleted.carbon:[[@LINE+2]]:35: note: type `Cpp.Source` does not implement interface `Core.ImplicitAs(Cpp.DeletedConstructor)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_deleted.carbon:[[@LINE+13]]:35 + // CHECK:STDERR: -> │ let _: Cpp.DeletedConstructor = s; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert + // CHECK:STDERR: · │ ┃ expression of type `Source` to + // CHECK:STDERR: · │ ┃ `Cpp.DeletedConstructor` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╭─────────────────────────────────╯ + // CHECK:STDERR: · │ type `Cpp.Source` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.DeletedConstructor)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: Cpp.DeletedConstructor = s; //@dump-sem-ir-end @@ -140,8 +180,16 @@ fn DeletedConstructorTest(s: Cpp.Source) { fn DeletedConversionTest(s: Cpp.DeletedConversion) { //@dump-sem-ir-begin - // CHECK:STDERR: fail_deleted.carbon:[[@LINE+3]]:21: error: cannot implicitly convert expression of type `DeletedConversion` to `Cpp.Dest` [ConversionFailure] - // CHECK:STDERR: fail_deleted.carbon:[[@LINE+2]]:21: note: type `Cpp.DeletedConversion` does not implement interface `Core.ImplicitAs(Cpp.Dest)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_deleted.carbon:[[@LINE+11]]:21 + // CHECK:STDERR: -> │ let _: Cpp.Dest = s; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type + // CHECK:STDERR: · │ ┃ `DeletedConversion` to `Cpp.Dest` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Cpp.DeletedConversion` does not implement + // CHECK:STDERR: · │ interface `Core.ImplicitAs(Cpp.Dest)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: Cpp.Dest = s; //@dump-sem-ir-end @@ -155,8 +203,18 @@ import Cpp library "implicit_conversions.h"; fn ExplicitConstructorTest(s: Cpp.Source) { //@dump-sem-ir-begin - // CHECK:STDERR: fail_explicit.carbon:[[@LINE+3]]:36: error: cannot implicitly convert expression of type `Source` to `Cpp.ExplicitConstructor` [ConversionFailure] - // CHECK:STDERR: fail_explicit.carbon:[[@LINE+2]]:36: note: type `Cpp.Source` does not implement interface `Core.ImplicitAs(Cpp.ExplicitConstructor)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_explicit.carbon:[[@LINE+13]]:36 + // CHECK:STDERR: -> │ let _: Cpp.ExplicitConstructor = s; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert + // CHECK:STDERR: · │ ┃ expression of type `Source` to + // CHECK:STDERR: · │ ┃ `Cpp.ExplicitConstructor` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╭──────────────────────────────────╯ + // CHECK:STDERR: · │ type `Cpp.Source` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.ExplicitConstructor)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: Cpp.ExplicitConstructor = s; //@dump-sem-ir-end @@ -164,8 +222,16 @@ fn ExplicitConstructorTest(s: Cpp.Source) { fn ExplicitConversionTest(s: Cpp.ExplicitConversion) { //@dump-sem-ir-begin - // CHECK:STDERR: fail_explicit.carbon:[[@LINE+3]]:21: error: cannot implicitly convert expression of type `ExplicitConversion` to `Cpp.Dest` [ConversionFailure] - // CHECK:STDERR: fail_explicit.carbon:[[@LINE+2]]:21: note: type `Cpp.ExplicitConversion` does not implement interface `Core.ImplicitAs(Cpp.Dest)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_explicit.carbon:[[@LINE+11]]:21 + // CHECK:STDERR: -> │ let _: Cpp.Dest = s; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type + // CHECK:STDERR: · │ ┃ `ExplicitConversion` to `Cpp.Dest` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Cpp.ExplicitConversion` does not implement + // CHECK:STDERR: · │ interface `Core.ImplicitAs(Cpp.Dest)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: Cpp.Dest = s; //@dump-sem-ir-end @@ -191,9 +257,21 @@ import Cpp library "implicit_conversions.h"; fn IntConstructorTest(u: u32) { //@dump-sem-ir-begin - // CHECK:STDERR: fail_no_u32_to_int_conversion_in_carbon.carbon:[[@LINE+4]]:31: error: cannot implicitly convert expression of type `u32` to `i32` [ConversionFailure] - // CHECK:STDERR: fail_no_u32_to_int_conversion_in_carbon.carbon:[[@LINE+3]]:31: note: type `u32` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: ./implicit_conversions.h:38:21: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_no_u32_to_int_conversion_in_carbon.carbon:[[@LINE+16]]:31 + // CHECK:STDERR: -> │ let _: Cpp.IntConstructor = u; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression + // CHECK:STDERR: · │ ┃ of type `u32` to `i32` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `u32` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(i32)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./implicit_conversions.h + // CHECK:STDERR: │ IntConstructor(int); + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: Cpp.IntConstructor = u; //@dump-sem-ir-end @@ -263,16 +341,43 @@ import Cpp library "aggregate.h"; fn InitFromTuple() { //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_aggregate_from_tuple.carbon:[[@LINE+3]]:26-27: error: cannot implicitly convert expression of type `()` to `Cpp.Aggregate` [ConversionFailure] - // CHECK:STDERR: fail_todo_aggregate_from_tuple.carbon:[[@LINE+2]]:26-27: note: type `()` does not implement interface `Core.ImplicitAs(Cpp.Aggregate)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_todo_aggregate_from_tuple.carbon:[[@LINE+11]]:26 + // CHECK:STDERR: -> │ let _: Cpp.Aggregate = (); + // CHECK:STDERR: · ┳━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of + // CHECK:STDERR: · │ ┃ type `()` to `Cpp.Aggregate` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `()` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.Aggregate)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: Cpp.Aggregate = (); - // CHECK:STDERR: fail_todo_aggregate_from_tuple.carbon:[[@LINE+3]]:26-29: error: cannot implicitly convert expression of type `(Core.IntLiteral,)` to `Cpp.Aggregate` [ConversionFailure] - // CHECK:STDERR: fail_todo_aggregate_from_tuple.carbon:[[@LINE+2]]:26-29: note: type `(Core.IntLiteral,)` does not implement interface `Core.ImplicitAs(Cpp.Aggregate)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_todo_aggregate_from_tuple.carbon:[[@LINE+12]]:26 + // CHECK:STDERR: -> │ let _: Cpp.Aggregate = (1,); + // CHECK:STDERR: · ┳━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of + // CHECK:STDERR: · │ ┃ type `(Core.IntLiteral,)` to + // CHECK:STDERR: · │ ┃ `Cpp.Aggregate` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `(Core.IntLiteral,)` does not implement + // CHECK:STDERR: · │ interface `Core.ImplicitAs(Cpp.Aggregate)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: Cpp.Aggregate = (1,); - // CHECK:STDERR: fail_todo_aggregate_from_tuple.carbon:[[@LINE+3]]:26-31: error: cannot implicitly convert expression of type `(Core.IntLiteral, Core.IntLiteral)` to `Cpp.Aggregate` [ConversionFailure] - // CHECK:STDERR: fail_todo_aggregate_from_tuple.carbon:[[@LINE+2]]:26-31: note: type `(Core.IntLiteral, Core.IntLiteral)` does not implement interface `Core.ImplicitAs(Cpp.Aggregate)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_todo_aggregate_from_tuple.carbon:[[@LINE+13]]:26 + // CHECK:STDERR: -> │ let _: Cpp.Aggregate = (1, 2); + // CHECK:STDERR: · ┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of + // CHECK:STDERR: · │ ┃ type `(Core.IntLiteral, Core.IntLiteral)` + // CHECK:STDERR: · │ ┃ to `Cpp.Aggregate` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `(Core.IntLiteral, Core.IntLiteral)` does + // CHECK:STDERR: · │ not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.Aggregate)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: Cpp.Aggregate = (1, 2); //@dump-sem-ir-end @@ -286,16 +391,43 @@ import Cpp library "aggregate.h"; fn InitFromStruct() { //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_aggregate_from_struct.carbon:[[@LINE+3]]:26-27: error: cannot implicitly convert expression of type `{}` to `Cpp.Aggregate` [ConversionFailure] - // CHECK:STDERR: fail_todo_aggregate_from_struct.carbon:[[@LINE+2]]:26-27: note: type `{}` does not implement interface `Core.ImplicitAs(Cpp.Aggregate)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_todo_aggregate_from_struct.carbon:[[@LINE+11]]:26 + // CHECK:STDERR: -> │ let _: Cpp.Aggregate = {}; + // CHECK:STDERR: · ┳━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of + // CHECK:STDERR: · │ ┃ type `{}` to `Cpp.Aggregate` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `{}` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.Aggregate)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: Cpp.Aggregate = {}; - // CHECK:STDERR: fail_todo_aggregate_from_struct.carbon:[[@LINE+3]]:26-33: error: cannot implicitly convert expression of type `{.x: Core.IntLiteral}` to `Cpp.Aggregate` [ConversionFailure] - // CHECK:STDERR: fail_todo_aggregate_from_struct.carbon:[[@LINE+2]]:26-33: note: type `{.x: Core.IntLiteral}` does not implement interface `Core.ImplicitAs(Cpp.Aggregate)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_todo_aggregate_from_struct.carbon:[[@LINE+12]]:26 + // CHECK:STDERR: -> │ let _: Cpp.Aggregate = {.x = 1}; + // CHECK:STDERR: · ┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of + // CHECK:STDERR: · │ ┃ type `{.x: Core.IntLiteral}` to + // CHECK:STDERR: · │ ┃ `Cpp.Aggregate` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `{.x: Core.IntLiteral}` does not implement + // CHECK:STDERR: · │ interface `Core.ImplicitAs(Cpp.Aggregate)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: Cpp.Aggregate = {.x = 1}; - // CHECK:STDERR: fail_todo_aggregate_from_struct.carbon:[[@LINE+3]]:26-41: error: cannot implicitly convert expression of type `{.x: Core.IntLiteral, .y: Core.IntLiteral}` to `Cpp.Aggregate` [ConversionFailure] - // CHECK:STDERR: fail_todo_aggregate_from_struct.carbon:[[@LINE+2]]:26-41: note: type `{.x: Core.IntLiteral, .y: Core.IntLiteral}` does not implement interface `Core.ImplicitAs(Cpp.Aggregate)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_todo_aggregate_from_struct.carbon:[[@LINE+13]]:26 + // CHECK:STDERR: -> │ let _: Cpp.Aggregate = {.x = 1, .y = 2}; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: cannot implicitly convert expression of type + // CHECK:STDERR: · ┃ `{.x: Core.IntLiteral, .y: Core.IntLiteral}` to `Cpp.Aggregate` + // CHECK:STDERR: · ┃ [ConversionFailure] + // CHECK:STDERR: · ╰──┤ type `{.x: Core.IntLiteral, .y: Core.IntLiteral}` + // CHECK:STDERR: · │ does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.Aggregate)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: Cpp.Aggregate = {.x = 1, .y = 2}; //@dump-sem-ir-end @@ -323,16 +455,45 @@ import Cpp library "aggregate.h"; fn InitFromStruct() { //@dump-sem-ir-begin - // CHECK:STDERR: fail_non_aggregate_from_struct.carbon:[[@LINE+3]]:29-30: error: cannot implicitly convert expression of type `{}` to `Cpp.NonAggregate` [ConversionFailure] - // CHECK:STDERR: fail_non_aggregate_from_struct.carbon:[[@LINE+2]]:29-30: note: type `{}` does not implement interface `Core.ImplicitAs(Cpp.NonAggregate)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_non_aggregate_from_struct.carbon:[[@LINE+11]]:29 + // CHECK:STDERR: -> │ let _: Cpp.NonAggregate = {}; + // CHECK:STDERR: · ┳━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of + // CHECK:STDERR: · │ ┃ type `{}` to `Cpp.NonAggregate` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `{}` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.NonAggregate)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: Cpp.NonAggregate = {}; - // CHECK:STDERR: fail_non_aggregate_from_struct.carbon:[[@LINE+3]]:29-36: error: cannot implicitly convert expression of type `{.x: Core.IntLiteral}` to `Cpp.NonAggregate` [ConversionFailure] - // CHECK:STDERR: fail_non_aggregate_from_struct.carbon:[[@LINE+2]]:29-36: note: type `{.x: Core.IntLiteral}` does not implement interface `Core.ImplicitAs(Cpp.NonAggregate)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_non_aggregate_from_struct.carbon:[[@LINE+13]]:29 + // CHECK:STDERR: -> │ let _: Cpp.NonAggregate = {.x = 1}; + // CHECK:STDERR: · ┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of + // CHECK:STDERR: · │ ┃ type `{.x: Core.IntLiteral}` to + // CHECK:STDERR: · │ ┃ `Cpp.NonAggregate` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `{.x: Core.IntLiteral}` does not + // CHECK:STDERR: · │ implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.NonAggregate)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: Cpp.NonAggregate = {.x = 1}; - // CHECK:STDERR: fail_non_aggregate_from_struct.carbon:[[@LINE+3]]:29-44: error: cannot implicitly convert expression of type `{.x: Core.IntLiteral, .y: Core.IntLiteral}` to `Cpp.NonAggregate` [ConversionFailure] - // CHECK:STDERR: fail_non_aggregate_from_struct.carbon:[[@LINE+2]]:29-44: note: type `{.x: Core.IntLiteral, .y: Core.IntLiteral}` does not implement interface `Core.ImplicitAs(Cpp.NonAggregate)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_non_aggregate_from_struct.carbon:[[@LINE+14]]:29 + // CHECK:STDERR: -> │ let _: Cpp.NonAggregate = {.x = 1, .y = 2}; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: cannot implicitly convert expression of type + // CHECK:STDERR: · ┃ `{.x: Core.IntLiteral, .y: Core.IntLiteral}` to `Cpp.NonAggregate` + // CHECK:STDERR: · ┃ [ConversionFailure] + // CHECK:STDERR: · ╰──┤ type + // CHECK:STDERR: · │ `{.x: Core.IntLiteral, .y: Core.IntLiteral}` + // CHECK:STDERR: · │ does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.NonAggregate)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: Cpp.NonAggregate = {.x = 1, .y = 2}; //@dump-sem-ir-end @@ -519,9 +680,9 @@ fn InitFromStruct() { // CHECK:STDOUT: fn @NonConstConversionTest(%s.param: %NonConstConversion) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %s.ref: %NonConstConversion = name_ref s, %s -// CHECK:STDOUT: %.loc11_21: %Dest.980 = converted %s.ref, [concrete = ] -// CHECK:STDOUT: %.loc11_13: type = splice_block %Dest.ref [concrete = constants.%Dest.980] { -// CHECK:STDOUT: %Cpp.ref.loc11: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %.loc19_21: %Dest.980 = converted %s.ref, [concrete = ] +// CHECK:STDOUT: %.loc19_13: type = splice_block %Dest.ref [concrete = constants.%Dest.980] { +// CHECK:STDOUT: %Cpp.ref.loc19: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %Dest.ref: type = name_ref Dest, imports.%Dest.decl [concrete = constants.%Dest.980] // CHECK:STDOUT: } // CHECK:STDOUT: %_: %Dest.980 = wrapper_binding _, [concrete = ] @@ -599,56 +760,56 @@ fn InitFromStruct() { // CHECK:STDOUT: fn @InaccessibleConstructorTest(%s.param: %Source) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %s.ref: %Source = name_ref s, %s -// CHECK:STDOUT: %.loc11_40.1: ref %InaccessibleConstructor = temporary_storage -// CHECK:STDOUT: %.loc11_40.2: ref %Source = value_as_ref %s.ref -// CHECK:STDOUT: %addr.loc11_40.1: %ptr.5f6 = addr_of %.loc11_40.2 -// CHECK:STDOUT: %addr.loc11_40.2: %ptr.859 = addr_of %.loc11_40.1 -// CHECK:STDOUT: %InaccessibleConstructor__carbon_thunk.call: init %empty_tuple.type = call imports.%InaccessibleConstructor__carbon_thunk.decl(%addr.loc11_40.1, %addr.loc11_40.2) -// CHECK:STDOUT: %.loc11_40.3: init %InaccessibleConstructor to %.loc11_40.1 = mark_in_place_init %InaccessibleConstructor__carbon_thunk.call -// CHECK:STDOUT: %.loc11_40.4: init %InaccessibleConstructor = converted %s.ref, %.loc11_40.3 -// CHECK:STDOUT: %.loc11_40.5: ref %InaccessibleConstructor = temporary %.loc11_40.1, %.loc11_40.4 -// CHECK:STDOUT: %.loc11_40.6: %InaccessibleConstructor = acquire_value %.loc11_40.5 -// CHECK:STDOUT: %.loc11_13: type = splice_block %InaccessibleConstructor.ref [concrete = constants.%InaccessibleConstructor] { -// CHECK:STDOUT: %Cpp.ref.loc11: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %.loc23_40.1: ref %InaccessibleConstructor = temporary_storage +// CHECK:STDOUT: %.loc23_40.2: ref %Source = value_as_ref %s.ref +// CHECK:STDOUT: %addr.loc23_40.1: %ptr.5f6 = addr_of %.loc23_40.2 +// CHECK:STDOUT: %addr.loc23_40.2: %ptr.859 = addr_of %.loc23_40.1 +// CHECK:STDOUT: %InaccessibleConstructor__carbon_thunk.call: init %empty_tuple.type = call imports.%InaccessibleConstructor__carbon_thunk.decl(%addr.loc23_40.1, %addr.loc23_40.2) +// CHECK:STDOUT: %.loc23_40.3: init %InaccessibleConstructor to %.loc23_40.1 = mark_in_place_init %InaccessibleConstructor__carbon_thunk.call +// CHECK:STDOUT: %.loc23_40.4: init %InaccessibleConstructor = converted %s.ref, %.loc23_40.3 +// CHECK:STDOUT: %.loc23_40.5: ref %InaccessibleConstructor = temporary %.loc23_40.1, %.loc23_40.4 +// CHECK:STDOUT: %.loc23_40.6: %InaccessibleConstructor = acquire_value %.loc23_40.5 +// CHECK:STDOUT: %.loc23_13: type = splice_block %InaccessibleConstructor.ref [concrete = constants.%InaccessibleConstructor] { +// CHECK:STDOUT: %Cpp.ref.loc23: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %InaccessibleConstructor.ref: type = name_ref InaccessibleConstructor, imports.%InaccessibleConstructor.decl [concrete = constants.%InaccessibleConstructor] // CHECK:STDOUT: } -// CHECK:STDOUT: %_: %InaccessibleConstructor = wrapper_binding _, %.loc11_40.6 +// CHECK:STDOUT: %_: %InaccessibleConstructor = wrapper_binding _, %.loc23_40.6 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %_.patt: %pattern_type.824 = value_binding_pattern _ [concrete = constants.%_.patt.f1f] // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.facet.loc11_40.1: %Destroy.type = facet_value constants.%InaccessibleConstructor, (constants.%DestroyImpl.impl_witness.8e4, constants.%custom_witness.5760f4.1) [concrete = constants.%Destroy.facet.8e3] -// CHECK:STDOUT: %.loc11_40.7: %Destroy.type = converted constants.%InaccessibleConstructor, %Destroy.facet.loc11_40.1 [concrete = constants.%Destroy.facet.8e3] -// CHECK:STDOUT: %Destroy.facet.loc11_40.2: %Destroy.type = facet_value constants.%InaccessibleConstructor, (constants.%DestroyImpl.impl_witness.8e4, constants.%custom_witness.5760f4.1) [concrete = constants.%Destroy.facet.8e3] -// CHECK:STDOUT: %.loc11_40.8: %Destroy.type = converted constants.%InaccessibleConstructor, %Destroy.facet.loc11_40.2 [concrete = constants.%Destroy.facet.8e3] +// CHECK:STDOUT: %Destroy.facet.loc23_40.1: %Destroy.type = facet_value constants.%InaccessibleConstructor, (constants.%DestroyImpl.impl_witness.8e4, constants.%custom_witness.5760f4.1) [concrete = constants.%Destroy.facet.8e3] +// CHECK:STDOUT: %.loc23_40.7: %Destroy.type = converted constants.%InaccessibleConstructor, %Destroy.facet.loc23_40.1 [concrete = constants.%Destroy.facet.8e3] +// CHECK:STDOUT: %Destroy.facet.loc23_40.2: %Destroy.type = facet_value constants.%InaccessibleConstructor, (constants.%DestroyImpl.impl_witness.8e4, constants.%custom_witness.5760f4.1) [concrete = constants.%Destroy.facet.8e3] +// CHECK:STDOUT: %.loc23_40.8: %Destroy.type = converted constants.%InaccessibleConstructor, %Destroy.facet.loc23_40.2 [concrete = constants.%Destroy.facet.8e3] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc11_40.5) +// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc23_40.5) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @InaccessibleConversionTest(%s.param: %InaccessibleConversion) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %s.ref: %InaccessibleConversion = name_ref s, %s -// CHECK:STDOUT: %.loc20_21.1: ref %Dest = temporary_storage -// CHECK:STDOUT: %addr: %ptr.ca8 = addr_of %.loc20_21.1 +// CHECK:STDOUT: %.loc42_21.1: ref %Dest = temporary_storage +// CHECK:STDOUT: %addr: %ptr.ca8 = addr_of %.loc42_21.1 // CHECK:STDOUT: %Dest__carbon_thunk.call: init %empty_tuple.type = call imports.%Dest__carbon_thunk.decl(%s.ref, %addr) -// CHECK:STDOUT: %.loc20_21.2: init %Dest to %.loc20_21.1 = mark_in_place_init %Dest__carbon_thunk.call -// CHECK:STDOUT: %.loc20_21.3: init %Dest = converted %s.ref, %.loc20_21.2 -// CHECK:STDOUT: %.loc20_21.4: ref %Dest = temporary %.loc20_21.1, %.loc20_21.3 -// CHECK:STDOUT: %.loc20_21.5: %Dest = acquire_value %.loc20_21.4 -// CHECK:STDOUT: %.loc20_13: type = splice_block %Dest.ref [concrete = constants.%Dest] { -// CHECK:STDOUT: %Cpp.ref.loc20: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %.loc42_21.2: init %Dest to %.loc42_21.1 = mark_in_place_init %Dest__carbon_thunk.call +// CHECK:STDOUT: %.loc42_21.3: init %Dest = converted %s.ref, %.loc42_21.2 +// CHECK:STDOUT: %.loc42_21.4: ref %Dest = temporary %.loc42_21.1, %.loc42_21.3 +// CHECK:STDOUT: %.loc42_21.5: %Dest = acquire_value %.loc42_21.4 +// CHECK:STDOUT: %.loc42_13: type = splice_block %Dest.ref [concrete = constants.%Dest] { +// CHECK:STDOUT: %Cpp.ref.loc42: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %Dest.ref: type = name_ref Dest, imports.%Dest.decl [concrete = constants.%Dest] // CHECK:STDOUT: } -// CHECK:STDOUT: %_: %Dest = wrapper_binding _, %.loc20_21.5 +// CHECK:STDOUT: %_: %Dest = wrapper_binding _, %.loc42_21.5 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %_.patt: %pattern_type.b72 = value_binding_pattern _ [concrete = constants.%_.patt.664] // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.facet.loc20_21.1: %Destroy.type = facet_value constants.%Dest, (constants.%DestroyImpl.impl_witness.771, constants.%custom_witness.5760f4.2) [concrete = constants.%Destroy.facet.bbf] -// CHECK:STDOUT: %.loc20_21.6: %Destroy.type = converted constants.%Dest, %Destroy.facet.loc20_21.1 [concrete = constants.%Destroy.facet.bbf] -// CHECK:STDOUT: %Destroy.facet.loc20_21.2: %Destroy.type = facet_value constants.%Dest, (constants.%DestroyImpl.impl_witness.771, constants.%custom_witness.5760f4.2) [concrete = constants.%Destroy.facet.bbf] -// CHECK:STDOUT: %.loc20_21.7: %Destroy.type = converted constants.%Dest, %Destroy.facet.loc20_21.2 [concrete = constants.%Destroy.facet.bbf] +// CHECK:STDOUT: %Destroy.facet.loc42_21.1: %Destroy.type = facet_value constants.%Dest, (constants.%DestroyImpl.impl_witness.771, constants.%custom_witness.5760f4.2) [concrete = constants.%Destroy.facet.bbf] +// CHECK:STDOUT: %.loc42_21.6: %Destroy.type = converted constants.%Dest, %Destroy.facet.loc42_21.1 [concrete = constants.%Destroy.facet.bbf] +// CHECK:STDOUT: %Destroy.facet.loc42_21.2: %Destroy.type = facet_value constants.%Dest, (constants.%DestroyImpl.impl_witness.771, constants.%custom_witness.5760f4.2) [concrete = constants.%Destroy.facet.bbf] +// CHECK:STDOUT: %.loc42_21.7: %Destroy.type = converted constants.%Dest, %Destroy.facet.loc42_21.2 [concrete = constants.%Destroy.facet.bbf] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc20_21.4) +// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc42_21.4) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: @@ -683,9 +844,9 @@ fn InitFromStruct() { // CHECK:STDOUT: fn @DeletedConstructorTest(%s.param: %Source) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %s.ref: %Source = name_ref s, %s -// CHECK:STDOUT: %.loc11_35: %DeletedConstructor = converted %s.ref, [concrete = ] -// CHECK:STDOUT: %.loc11_13: type = splice_block %DeletedConstructor.ref [concrete = constants.%DeletedConstructor] { -// CHECK:STDOUT: %Cpp.ref.loc11: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %.loc21_35: %DeletedConstructor = converted %s.ref, [concrete = ] +// CHECK:STDOUT: %.loc21_13: type = splice_block %DeletedConstructor.ref [concrete = constants.%DeletedConstructor] { +// CHECK:STDOUT: %Cpp.ref.loc21: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %DeletedConstructor.ref: type = name_ref DeletedConstructor, imports.%DeletedConstructor.decl [concrete = constants.%DeletedConstructor] // CHECK:STDOUT: } // CHECK:STDOUT: %_: %DeletedConstructor = wrapper_binding _, [concrete = ] @@ -698,9 +859,9 @@ fn InitFromStruct() { // CHECK:STDOUT: fn @DeletedConversionTest(%s.param: %DeletedConversion) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %s.ref: %DeletedConversion = name_ref s, %s -// CHECK:STDOUT: %.loc20_21: %Dest.980 = converted %s.ref, [concrete = ] -// CHECK:STDOUT: %.loc20_13: type = splice_block %Dest.ref [concrete = constants.%Dest.980] { -// CHECK:STDOUT: %Cpp.ref.loc20: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %.loc38_21: %Dest.980 = converted %s.ref, [concrete = ] +// CHECK:STDOUT: %.loc38_13: type = splice_block %Dest.ref [concrete = constants.%Dest.980] { +// CHECK:STDOUT: %Cpp.ref.loc38: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %Dest.ref: type = name_ref Dest, imports.%Dest.decl [concrete = constants.%Dest.980] // CHECK:STDOUT: } // CHECK:STDOUT: %_: %Dest.980 = wrapper_binding _, [concrete = ] @@ -741,9 +902,9 @@ fn InitFromStruct() { // CHECK:STDOUT: fn @ExplicitConstructorTest(%s.param: %Source) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %s.ref: %Source = name_ref s, %s -// CHECK:STDOUT: %.loc11_36: %ExplicitConstructor = converted %s.ref, [concrete = ] -// CHECK:STDOUT: %.loc11_13: type = splice_block %ExplicitConstructor.ref [concrete = constants.%ExplicitConstructor] { -// CHECK:STDOUT: %Cpp.ref.loc11: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %.loc21_36: %ExplicitConstructor = converted %s.ref, [concrete = ] +// CHECK:STDOUT: %.loc21_13: type = splice_block %ExplicitConstructor.ref [concrete = constants.%ExplicitConstructor] { +// CHECK:STDOUT: %Cpp.ref.loc21: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %ExplicitConstructor.ref: type = name_ref ExplicitConstructor, imports.%ExplicitConstructor.decl [concrete = constants.%ExplicitConstructor] // CHECK:STDOUT: } // CHECK:STDOUT: %_: %ExplicitConstructor = wrapper_binding _, [concrete = ] @@ -756,9 +917,9 @@ fn InitFromStruct() { // CHECK:STDOUT: fn @ExplicitConversionTest(%s.param: %ExplicitConversion) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %s.ref: %ExplicitConversion = name_ref s, %s -// CHECK:STDOUT: %.loc20_21: %Dest.980 = converted %s.ref, [concrete = ] -// CHECK:STDOUT: %.loc20_13: type = splice_block %Dest.ref [concrete = constants.%Dest.980] { -// CHECK:STDOUT: %Cpp.ref.loc20: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %.loc38_21: %Dest.980 = converted %s.ref, [concrete = ] +// CHECK:STDOUT: %.loc38_13: type = splice_block %Dest.ref [concrete = constants.%Dest.980] { +// CHECK:STDOUT: %Cpp.ref.loc38: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %Dest.ref: type = name_ref Dest, imports.%Dest.decl [concrete = constants.%Dest.980] // CHECK:STDOUT: } // CHECK:STDOUT: %_: %Dest.980 = wrapper_binding _, [concrete = ] @@ -881,28 +1042,28 @@ fn InitFromStruct() { // CHECK:STDOUT: fn @IntConstructorTest(%u.param: %u32) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %u.ref: %u32 = name_ref u, %u -// CHECK:STDOUT: %.loc12_31.1: ref %IntConstructor = temporary_storage -// CHECK:STDOUT: %.loc12_31.2: %i32 = converted %u.ref, [concrete = ] -// CHECK:STDOUT: %addr: %ptr.100 = addr_of %.loc12_31.1 +// CHECK:STDOUT: %.loc24_31.1: ref %IntConstructor = temporary_storage +// CHECK:STDOUT: %.loc24_31.2: %i32 = converted %u.ref, [concrete = ] +// CHECK:STDOUT: %addr: %ptr.100 = addr_of %.loc24_31.1 // CHECK:STDOUT: %IntConstructor__carbon_thunk.call: init %empty_tuple.type = call imports.%IntConstructor__carbon_thunk.decl(, %addr) -// CHECK:STDOUT: %.loc12_31.3: init %IntConstructor to %.loc12_31.1 = mark_in_place_init %IntConstructor__carbon_thunk.call -// CHECK:STDOUT: %.loc12_31.4: init %IntConstructor = converted %u.ref, %.loc12_31.3 -// CHECK:STDOUT: %.loc12_31.5: ref %IntConstructor = temporary %.loc12_31.1, %.loc12_31.4 -// CHECK:STDOUT: %.loc12_31.6: %IntConstructor = acquire_value %.loc12_31.5 -// CHECK:STDOUT: %.loc12_13: type = splice_block %IntConstructor.ref [concrete = constants.%IntConstructor] { +// CHECK:STDOUT: %.loc24_31.3: init %IntConstructor to %.loc24_31.1 = mark_in_place_init %IntConstructor__carbon_thunk.call +// CHECK:STDOUT: %.loc24_31.4: init %IntConstructor = converted %u.ref, %.loc24_31.3 +// CHECK:STDOUT: %.loc24_31.5: ref %IntConstructor = temporary %.loc24_31.1, %.loc24_31.4 +// CHECK:STDOUT: %.loc24_31.6: %IntConstructor = acquire_value %.loc24_31.5 +// CHECK:STDOUT: %.loc24_13: type = splice_block %IntConstructor.ref [concrete = constants.%IntConstructor] { // CHECK:STDOUT: %Cpp.ref: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %IntConstructor.ref: type = name_ref IntConstructor, imports.%IntConstructor.decl [concrete = constants.%IntConstructor] // CHECK:STDOUT: } -// CHECK:STDOUT: %_: %IntConstructor = wrapper_binding _, %.loc12_31.6 +// CHECK:STDOUT: %_: %IntConstructor = wrapper_binding _, %.loc24_31.6 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %_.patt: %pattern_type.c4e = value_binding_pattern _ [concrete = constants.%_.patt.151] // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.facet.loc12_31.1: %Destroy.type = facet_value constants.%IntConstructor, (constants.%DestroyImpl.impl_witness.1d9, constants.%custom_witness.576) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc12_31.7: %Destroy.type = converted constants.%IntConstructor, %Destroy.facet.loc12_31.1 [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %Destroy.facet.loc12_31.2: %Destroy.type = facet_value constants.%IntConstructor, (constants.%DestroyImpl.impl_witness.1d9, constants.%custom_witness.576) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc12_31.8: %Destroy.type = converted constants.%IntConstructor, %Destroy.facet.loc12_31.2 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %Destroy.facet.loc24_31.1: %Destroy.type = facet_value constants.%IntConstructor, (constants.%DestroyImpl.impl_witness.1d9, constants.%custom_witness.576) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc24_31.7: %Destroy.type = converted constants.%IntConstructor, %Destroy.facet.loc24_31.1 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %Destroy.facet.loc24_31.2: %Destroy.type = facet_value constants.%IntConstructor, (constants.%DestroyImpl.impl_witness.1d9, constants.%custom_witness.576) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc24_31.8: %Destroy.type = converted constants.%IntConstructor, %Destroy.facet.loc24_31.2 [concrete = constants.%Destroy.facet] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc12_31.5) +// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc24_31.5) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1223,31 +1384,8 @@ fn InitFromStruct() { // CHECK:STDOUT: // CHECK:STDOUT: fn @InitFromTuple() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_27.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc11_27.2: %Aggregate = converted %.loc11_27.1, [concrete = ] -// CHECK:STDOUT: %.loc11_13: type = splice_block %Aggregate.ref.loc11 [concrete = constants.%Aggregate] { -// CHECK:STDOUT: %Cpp.ref.loc11: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %Aggregate.ref.loc11: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate] -// CHECK:STDOUT: } -// CHECK:STDOUT: %_.loc11: %Aggregate = wrapper_binding _, [concrete = ] -// CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %_.patt.loc11: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt] -// CHECK:STDOUT: } -// CHECK:STDOUT: %int_1.loc15: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] -// CHECK:STDOUT: %.loc15_29.1: %tuple.type.985 = tuple_literal (%int_1.loc15) [concrete = constants.%tuple.378] -// CHECK:STDOUT: %.loc15_29.2: %Aggregate = converted %.loc15_29.1, [concrete = ] -// CHECK:STDOUT: %.loc15_13: type = splice_block %Aggregate.ref.loc15 [concrete = constants.%Aggregate] { -// CHECK:STDOUT: %Cpp.ref.loc15: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %Aggregate.ref.loc15: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate] -// CHECK:STDOUT: } -// CHECK:STDOUT: %_.loc15: %Aggregate = wrapper_binding _, [concrete = ] -// CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %_.patt.loc15: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt] -// CHECK:STDOUT: } -// CHECK:STDOUT: %int_1.loc19: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] -// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2] -// CHECK:STDOUT: %.loc19_31.1: %tuple.type.f94 = tuple_literal (%int_1.loc19, %int_2) [concrete = constants.%tuple.ad8] -// CHECK:STDOUT: %.loc19_31.2: %Aggregate = converted %.loc19_31.1, [concrete = ] +// CHECK:STDOUT: %.loc19_27.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc19_27.2: %Aggregate = converted %.loc19_27.1, [concrete = ] // CHECK:STDOUT: %.loc19_13: type = splice_block %Aggregate.ref.loc19 [concrete = constants.%Aggregate] { // CHECK:STDOUT: %Cpp.ref.loc19: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %Aggregate.ref.loc19: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate] @@ -1256,6 +1394,29 @@ fn InitFromStruct() { // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %_.patt.loc19: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt] // CHECK:STDOUT: } +// CHECK:STDOUT: %int_1.loc32: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] +// CHECK:STDOUT: %.loc32_29.1: %tuple.type.985 = tuple_literal (%int_1.loc32) [concrete = constants.%tuple.378] +// CHECK:STDOUT: %.loc32_29.2: %Aggregate = converted %.loc32_29.1, [concrete = ] +// CHECK:STDOUT: %.loc32_13: type = splice_block %Aggregate.ref.loc32 [concrete = constants.%Aggregate] { +// CHECK:STDOUT: %Cpp.ref.loc32: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %Aggregate.ref.loc32: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate] +// CHECK:STDOUT: } +// CHECK:STDOUT: %_.loc32: %Aggregate = wrapper_binding _, [concrete = ] +// CHECK:STDOUT: name_binding_decl { +// CHECK:STDOUT: %_.patt.loc32: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt] +// CHECK:STDOUT: } +// CHECK:STDOUT: %int_1.loc46: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] +// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2] +// CHECK:STDOUT: %.loc46_31.1: %tuple.type.f94 = tuple_literal (%int_1.loc46, %int_2) [concrete = constants.%tuple.ad8] +// CHECK:STDOUT: %.loc46_31.2: %Aggregate = converted %.loc46_31.1, [concrete = ] +// CHECK:STDOUT: %.loc46_13: type = splice_block %Aggregate.ref.loc46 [concrete = constants.%Aggregate] { +// CHECK:STDOUT: %Cpp.ref.loc46: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %Aggregate.ref.loc46: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate] +// CHECK:STDOUT: } +// CHECK:STDOUT: %_.loc46: %Aggregate = wrapper_binding _, [concrete = ] +// CHECK:STDOUT: name_binding_decl { +// CHECK:STDOUT: %_.patt.loc46: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt] +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1286,31 +1447,8 @@ fn InitFromStruct() { // CHECK:STDOUT: // CHECK:STDOUT: fn @InitFromStruct() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_27.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc11_27.2: %Aggregate = converted %.loc11_27.1, [concrete = ] -// CHECK:STDOUT: %.loc11_13: type = splice_block %Aggregate.ref.loc11 [concrete = constants.%Aggregate] { -// CHECK:STDOUT: %Cpp.ref.loc11: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %Aggregate.ref.loc11: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate] -// CHECK:STDOUT: } -// CHECK:STDOUT: %_.loc11: %Aggregate = wrapper_binding _, [concrete = ] -// CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %_.patt.loc11: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt] -// CHECK:STDOUT: } -// CHECK:STDOUT: %int_1.loc15: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] -// CHECK:STDOUT: %.loc15_33.1: %struct_type.x = struct_literal (%int_1.loc15) [concrete = constants.%struct.147] -// CHECK:STDOUT: %.loc15_33.2: %Aggregate = converted %.loc15_33.1, [concrete = ] -// CHECK:STDOUT: %.loc15_13: type = splice_block %Aggregate.ref.loc15 [concrete = constants.%Aggregate] { -// CHECK:STDOUT: %Cpp.ref.loc15: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %Aggregate.ref.loc15: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate] -// CHECK:STDOUT: } -// CHECK:STDOUT: %_.loc15: %Aggregate = wrapper_binding _, [concrete = ] -// CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %_.patt.loc15: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt] -// CHECK:STDOUT: } -// CHECK:STDOUT: %int_1.loc19: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] -// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2] -// CHECK:STDOUT: %.loc19_41.1: %struct_type.x.y = struct_literal (%int_1.loc19, %int_2) [concrete = constants.%struct.004] -// CHECK:STDOUT: %.loc19_41.2: %Aggregate = converted %.loc19_41.1, [concrete = ] +// CHECK:STDOUT: %.loc19_27.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc19_27.2: %Aggregate = converted %.loc19_27.1, [concrete = ] // CHECK:STDOUT: %.loc19_13: type = splice_block %Aggregate.ref.loc19 [concrete = constants.%Aggregate] { // CHECK:STDOUT: %Cpp.ref.loc19: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %Aggregate.ref.loc19: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate] @@ -1319,6 +1457,29 @@ fn InitFromStruct() { // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %_.patt.loc19: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt] // CHECK:STDOUT: } +// CHECK:STDOUT: %int_1.loc32: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] +// CHECK:STDOUT: %.loc32_33.1: %struct_type.x = struct_literal (%int_1.loc32) [concrete = constants.%struct.147] +// CHECK:STDOUT: %.loc32_33.2: %Aggregate = converted %.loc32_33.1, [concrete = ] +// CHECK:STDOUT: %.loc32_13: type = splice_block %Aggregate.ref.loc32 [concrete = constants.%Aggregate] { +// CHECK:STDOUT: %Cpp.ref.loc32: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %Aggregate.ref.loc32: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate] +// CHECK:STDOUT: } +// CHECK:STDOUT: %_.loc32: %Aggregate = wrapper_binding _, [concrete = ] +// CHECK:STDOUT: name_binding_decl { +// CHECK:STDOUT: %_.patt.loc32: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt] +// CHECK:STDOUT: } +// CHECK:STDOUT: %int_1.loc46: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] +// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2] +// CHECK:STDOUT: %.loc46_41.1: %struct_type.x.y = struct_literal (%int_1.loc46, %int_2) [concrete = constants.%struct.004] +// CHECK:STDOUT: %.loc46_41.2: %Aggregate = converted %.loc46_41.1, [concrete = ] +// CHECK:STDOUT: %.loc46_13: type = splice_block %Aggregate.ref.loc46 [concrete = constants.%Aggregate] { +// CHECK:STDOUT: %Cpp.ref.loc46: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %Aggregate.ref.loc46: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate] +// CHECK:STDOUT: } +// CHECK:STDOUT: %_.loc46: %Aggregate = wrapper_binding _, [concrete = ] +// CHECK:STDOUT: name_binding_decl { +// CHECK:STDOUT: %_.patt.loc46: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt] +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1525,31 +1686,8 @@ fn InitFromStruct() { // CHECK:STDOUT: // CHECK:STDOUT: fn @InitFromStruct() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_30.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc11_30.2: %NonAggregate = converted %.loc11_30.1, [concrete = ] -// CHECK:STDOUT: %.loc11_13: type = splice_block %NonAggregate.ref.loc11 [concrete = constants.%NonAggregate] { -// CHECK:STDOUT: %Cpp.ref.loc11: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %NonAggregate.ref.loc11: type = name_ref NonAggregate, imports.%NonAggregate.decl [concrete = constants.%NonAggregate] -// CHECK:STDOUT: } -// CHECK:STDOUT: %_.loc11: %NonAggregate = wrapper_binding _, [concrete = ] -// CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %_.patt.loc11: %pattern_type.273 = value_binding_pattern _ [concrete = constants.%_.patt] -// CHECK:STDOUT: } -// CHECK:STDOUT: %int_1.loc15: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] -// CHECK:STDOUT: %.loc15_36.1: %struct_type.x = struct_literal (%int_1.loc15) [concrete = constants.%struct.147] -// CHECK:STDOUT: %.loc15_36.2: %NonAggregate = converted %.loc15_36.1, [concrete = ] -// CHECK:STDOUT: %.loc15_13: type = splice_block %NonAggregate.ref.loc15 [concrete = constants.%NonAggregate] { -// CHECK:STDOUT: %Cpp.ref.loc15: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %NonAggregate.ref.loc15: type = name_ref NonAggregate, imports.%NonAggregate.decl [concrete = constants.%NonAggregate] -// CHECK:STDOUT: } -// CHECK:STDOUT: %_.loc15: %NonAggregate = wrapper_binding _, [concrete = ] -// CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %_.patt.loc15: %pattern_type.273 = value_binding_pattern _ [concrete = constants.%_.patt] -// CHECK:STDOUT: } -// CHECK:STDOUT: %int_1.loc19: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] -// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2] -// CHECK:STDOUT: %.loc19_44.1: %struct_type.x.y = struct_literal (%int_1.loc19, %int_2) [concrete = constants.%struct.004] -// CHECK:STDOUT: %.loc19_44.2: %NonAggregate = converted %.loc19_44.1, [concrete = ] +// CHECK:STDOUT: %.loc19_30.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc19_30.2: %NonAggregate = converted %.loc19_30.1, [concrete = ] // CHECK:STDOUT: %.loc19_13: type = splice_block %NonAggregate.ref.loc19 [concrete = constants.%NonAggregate] { // CHECK:STDOUT: %Cpp.ref.loc19: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %NonAggregate.ref.loc19: type = name_ref NonAggregate, imports.%NonAggregate.decl [concrete = constants.%NonAggregate] @@ -1558,6 +1696,29 @@ fn InitFromStruct() { // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %_.patt.loc19: %pattern_type.273 = value_binding_pattern _ [concrete = constants.%_.patt] // CHECK:STDOUT: } +// CHECK:STDOUT: %int_1.loc33: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] +// CHECK:STDOUT: %.loc33_36.1: %struct_type.x = struct_literal (%int_1.loc33) [concrete = constants.%struct.147] +// CHECK:STDOUT: %.loc33_36.2: %NonAggregate = converted %.loc33_36.1, [concrete = ] +// CHECK:STDOUT: %.loc33_13: type = splice_block %NonAggregate.ref.loc33 [concrete = constants.%NonAggregate] { +// CHECK:STDOUT: %Cpp.ref.loc33: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %NonAggregate.ref.loc33: type = name_ref NonAggregate, imports.%NonAggregate.decl [concrete = constants.%NonAggregate] +// CHECK:STDOUT: } +// CHECK:STDOUT: %_.loc33: %NonAggregate = wrapper_binding _, [concrete = ] +// CHECK:STDOUT: name_binding_decl { +// CHECK:STDOUT: %_.patt.loc33: %pattern_type.273 = value_binding_pattern _ [concrete = constants.%_.patt] +// CHECK:STDOUT: } +// CHECK:STDOUT: %int_1.loc48: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] +// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2] +// CHECK:STDOUT: %.loc48_44.1: %struct_type.x.y = struct_literal (%int_1.loc48, %int_2) [concrete = constants.%struct.004] +// CHECK:STDOUT: %.loc48_44.2: %NonAggregate = converted %.loc48_44.1, [concrete = ] +// CHECK:STDOUT: %.loc48_13: type = splice_block %NonAggregate.ref.loc48 [concrete = constants.%NonAggregate] { +// CHECK:STDOUT: %Cpp.ref.loc48: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %NonAggregate.ref.loc48: type = name_ref NonAggregate, imports.%NonAggregate.decl [concrete = constants.%NonAggregate] +// CHECK:STDOUT: } +// CHECK:STDOUT: %_.loc48: %NonAggregate = wrapper_binding _, [concrete = ] +// CHECK:STDOUT: name_binding_decl { +// CHECK:STDOUT: %_.patt.loc48: %pattern_type.273 = value_binding_pattern _ [concrete = constants.%_.patt] +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interop/cpp/macros/invalid.carbon b/toolchain/check/testdata/interop/cpp/macros/invalid.carbon index 0c04c37e2e1a..506e797fd812 100644 --- a/toolchain/check/testdata/interop/cpp/macros/invalid.carbon +++ b/toolchain/check/testdata/interop/cpp/macros/invalid.carbon @@ -15,7 +15,11 @@ library "[[@TEST_NAME]]"; import Cpp inline ''' -// CHECK:STDERR: fail_macro_with_error.carbon:[[@LINE+2]]:1: error: unknown type name 'error' [CppInteropParseError] +// CHECK:STDERR: ╭─┤ fail_macro_with_error.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ error has_error; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: unknown type name 'error' [CppInteropParseError] +// CHECK:STDERR: ╰──── // CHECK:STDERR: error has_error; #define macro_with_error has_error.member @@ -23,10 +27,21 @@ error has_error; fn F() { //@dump-sem-ir-begin - // CHECK:STDERR: fail_macro_with_error.carbon:[[@LINE+5]]:3-22: error: failed to parse macro Cpp.macro_with_error to a valid constant expression [InCppMacroEvaluation] - // CHECK:STDERR: fail_macro_with_error.carbon:[[@LINE+4]]:3-22: note: in `Cpp` name lookup for `macro_with_error` [InCppNameLookup] + // CHECK:STDERR: ╭─┤ fail_macro_with_error.carbon:[[@LINE+16]]:3 + // CHECK:STDERR: -> │ Cpp.macro_with_error; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: failed to parse macro Cpp.macro_with_error to a valid constant + // CHECK:STDERR: · │ ┃ expression + // CHECK:STDERR: · │ ┃ [InCppMacroEvaluation] + // CHECK:STDERR: · ╰────┤ in `Cpp` name lookup for `macro_with_error` [InCppNameLookup] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_macro_with_error.carbon:[[@LINE+2]]:3-22: error: member name `macro_with_error` not found in `Cpp` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╭─┤ fail_macro_with_error.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ Cpp.macro_with_error; + // CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: member name `macro_with_error` not found in `Cpp` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.macro_with_error; //@dump-sem-ir-end diff --git a/toolchain/check/testdata/interop/cpp/macros/macros.carbon b/toolchain/check/testdata/interop/cpp/macros/macros.carbon index 194fe978e4ea..4d561fbb93f0 100644 --- a/toolchain/check/testdata/interop/cpp/macros/macros.carbon +++ b/toolchain/check/testdata/interop/cpp/macros/macros.carbon @@ -41,7 +41,6 @@ fn F() { } // --- bad_suffix.h -// CHECK:STDERR: expanded from macro defined at: ./bad_suffix.h:[[@LINE+1]]:24 [InCppMacroExpansion] #define CONFIG_VALUE 42f // --- fail_import_bad_suffix.carbon @@ -51,19 +50,35 @@ library "[[@TEST_NAME]]"; import Cpp library "bad_suffix.h"; fn F() { - // CHECK:STDERR: fail_import_bad_suffix.carbon:[[@LINE+8]]:6: error: invalid digit 'f' in decimal constant [CppInteropParseError] - // CHECK:STDERR: fail_import_bad_suffix.carbon:[[@LINE+7]]:3-18: note: in `Cpp` name lookup for `CONFIG_VALUE` [InCppNameLookup] + // CHECK:STDERR: ╷ ╭── expanded from macro defined at: ./bad_suffix.h [InCppMacroExpansion] + // CHECK:STDERR: ├─┤ fail_import_bad_suffix.carbon:[[@LINE+24]]:6 + // CHECK:STDERR: -> │ #define CONFIG_VALUE 42f + // CHECK:STDERR: · ───┳────┬─────── + // CHECK:STDERR: · ┗━━━━━━━┫ error: invalid digit 'f' in decimal constant + // CHECK:STDERR: · │ ┃ [CppInteropParseError] + // CHECK:STDERR: · ╰────┤ in `Cpp` name lookup for `CONFIG_VALUE` [InCppNameLookup] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_import_bad_suffix.carbon:[[@LINE+5]]:3-18: error: failed to parse macro Cpp.CONFIG_VALUE to a valid constant expression [InCppMacroEvaluation] - // CHECK:STDERR: fail_import_bad_suffix.carbon:[[@LINE+4]]:3-18: note: in `Cpp` name lookup for `CONFIG_VALUE` [InCppNameLookup] + // CHECK:STDERR: ╭─┤ fail_import_bad_suffix.carbon:[[@LINE+16]]:3 + // CHECK:STDERR: -> │ Cpp.CONFIG_VALUE; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: failed to parse macro Cpp.CONFIG_VALUE to a valid constant + // CHECK:STDERR: · │ ┃ expression + // CHECK:STDERR: · │ ┃ [InCppMacroEvaluation] + // CHECK:STDERR: · ╰────┤ in `Cpp` name lookup for `CONFIG_VALUE` [InCppNameLookup] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_import_bad_suffix.carbon:[[@LINE+2]]:3-18: error: member name `CONFIG_VALUE` not found in `Cpp` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╭─┤ fail_import_bad_suffix.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ Cpp.CONFIG_VALUE; + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: member name `CONFIG_VALUE` not found in `Cpp` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.CONFIG_VALUE; } // --- integer_literal_too_big.h -// CHECK:STDERR: expanded from macro defined at: ./integer_literal_too_big.h:[[@LINE+1]]:22 [InCppMacroExpansion] #define CONFIG_VALUE 18446744073709551616 // --- fail_import_integer_literal_too_big.carbon @@ -73,8 +88,15 @@ library "[[@TEST_NAME]]"; import Cpp library "integer_literal_too_big.h"; fn F() { - // CHECK:STDERR: fail_import_integer_literal_too_big.carbon:[[@LINE+3]]:6: error: integer literal is too large to be represented in any integer type [CppInteropParseError] - // CHECK:STDERR: fail_import_integer_literal_too_big.carbon:[[@LINE+2]]:3-18: note: in `Cpp` name lookup for `CONFIG_VALUE` [InCppNameLookup] + // CHECK:STDERR: ╷ ╭── expanded from macro defined at: ./integer_literal_too_big.h [InCppMacroExpansion] + // CHECK:STDERR: ├─┤ fail_import_integer_literal_too_big.carbon:[[@LINE+9]]:6 + // CHECK:STDERR: -> │ #define CONFIG_VALUE 18446744073709551616 + // CHECK:STDERR: · ───┳──────────── + // CHECK:STDERR: · ┗━━┫ error: integer literal is too large to be represented in any integer + // CHECK:STDERR: · │ ┃ type + // CHECK:STDERR: · │ ┃ [CppInteropParseError] + // CHECK:STDERR: · ╰────┤ in `Cpp` name lookup for `CONFIG_VALUE` [InCppNameLookup] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.CONFIG_VALUE; } @@ -86,7 +108,11 @@ library "[[@TEST_NAME]]"; import Cpp library "integer_literal_replacement_token.h"; fn F() { - // CHECK:STDERR: fail_assign_to_object_like_macro.carbon:[[@LINE+2]]:3-18: error: expression is not assignable [AssignmentToNonAssignable] + // CHECK:STDERR: ╭─┤ fail_assign_to_object_like_macro.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ Cpp.CONFIG_VALUE = 3; + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: expression is not assignable [AssignmentToNonAssignable] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.CONFIG_VALUE = 3; } @@ -106,7 +132,13 @@ import Cpp library "macro_in_nested_scope.h"; fn F() { let unused a: i32 = Cpp.CONFIG_VALUE; - // CHECK:STDERR: fail_import_macro_in_nested_scope.carbon:[[@LINE+2]]:23-40: error: member name `CONFIG_VALUE` not found in `Cpp.N` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╭─┤ fail_import_macro_in_nested_scope.carbon:[[@LINE+8]]:23 + // CHECK:STDERR: -> │ let unused b: i32 = Cpp.N.CONFIG_VALUE; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: member name `CONFIG_VALUE` not found in + // CHECK:STDERR: · ┃ `Cpp.N` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused b: i32 = Cpp.N.CONFIG_VALUE; } @@ -146,10 +178,20 @@ import Cpp library "no_replacement_token.h"; fn F() { // TODO: Get rid of the second error. - // CHECK:STDERR: fail_import_no_replacement_token.carbon:[[@LINE+5]]:3-16: error: semantics TODO: `Unsupported: macro with 0 replacement tokens` [SemanticsTodo] - // CHECK:STDERR: fail_import_no_replacement_token.carbon:[[@LINE+4]]:3-16: note: in `Cpp` name lookup for `MACRO_NAME` [InCppNameLookup] + // CHECK:STDERR: ╭─┤ fail_import_no_replacement_token.carbon:[[@LINE+15]]:3 + // CHECK:STDERR: -> │ Cpp.MACRO_NAME; + // CHECK:STDERR: · ━━━━┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `Unsupported: macro with 0 replacement tokens` + // CHECK:STDERR: · │ ┃ [SemanticsTodo] + // CHECK:STDERR: · ╰────┤ in `Cpp` name lookup for `MACRO_NAME` [InCppNameLookup] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_import_no_replacement_token.carbon:[[@LINE+2]]:3-16: error: member name `MACRO_NAME` not found in `Cpp` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╭─┤ fail_import_no_replacement_token.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ Cpp.MACRO_NAME; + // CHECK:STDERR: · ━━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: member name `MACRO_NAME` not found in `Cpp` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.MACRO_NAME; } @@ -264,22 +306,55 @@ library "[[@TEST_NAME]]"; import Cpp library "unsupported_string_literal_types.h"; fn F() { - // CHECK:STDERR: fail_import_unsupported_string_literal_types.carbon:[[@LINE+5]]:2-18: error: semantics TODO: `Unsupported: string literal type: const char16_t[6]` [SemanticsTodo] - // CHECK:STDERR: fail_import_unsupported_string_literal_types.carbon:[[@LINE+4]]:2-18: note: in `Cpp` name lookup for `Utf16Greeting` [InCppNameLookup] + // CHECK:STDERR: ╭─┤ fail_import_unsupported_string_literal_types.carbon:[[@LINE+16]]:2 + // CHECK:STDERR: -> │ Cpp.Utf16Greeting; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: + // CHECK:STDERR: · │ ┃ `Unsupported: string literal type: const char16_t[6]` + // CHECK:STDERR: · │ ┃ [SemanticsTodo] + // CHECK:STDERR: · ╰────┤ in `Cpp` name lookup for `Utf16Greeting` [InCppNameLookup] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_import_unsupported_string_literal_types.carbon:[[@LINE+2]]:2-18: error: member name `Utf16Greeting` not found in `Cpp` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╭─┤ fail_import_unsupported_string_literal_types.carbon:[[@LINE+7]]:2 + // CHECK:STDERR: -> │ Cpp.Utf16Greeting; + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: member name `Utf16Greeting` not found in `Cpp` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.Utf16Greeting; - // CHECK:STDERR: fail_import_unsupported_string_literal_types.carbon:[[@LINE+5]]:2-18: error: semantics TODO: `Unsupported: string literal type: const char32_t[6]` [SemanticsTodo] - // CHECK:STDERR: fail_import_unsupported_string_literal_types.carbon:[[@LINE+4]]:2-18: note: in `Cpp` name lookup for `Utf32Greeting` [InCppNameLookup] + // CHECK:STDERR: ╭─┤ fail_import_unsupported_string_literal_types.carbon:[[@LINE+16]]:2 + // CHECK:STDERR: -> │ Cpp.Utf32Greeting; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: + // CHECK:STDERR: · │ ┃ `Unsupported: string literal type: const char32_t[6]` + // CHECK:STDERR: · │ ┃ [SemanticsTodo] + // CHECK:STDERR: · ╰────┤ in `Cpp` name lookup for `Utf32Greeting` [InCppNameLookup] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_import_unsupported_string_literal_types.carbon:[[@LINE+2]]:2-18: error: member name `Utf32Greeting` not found in `Cpp` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╭─┤ fail_import_unsupported_string_literal_types.carbon:[[@LINE+7]]:2 + // CHECK:STDERR: -> │ Cpp.Utf32Greeting; + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: member name `Utf32Greeting` not found in `Cpp` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.Utf32Greeting; - // CHECK:STDERR: fail_import_unsupported_string_literal_types.carbon:[[@LINE+5]]:2-17: error: semantics TODO: `Unsupported: string literal type: const wchar_t[6]` [SemanticsTodo] - // CHECK:STDERR: fail_import_unsupported_string_literal_types.carbon:[[@LINE+4]]:2-17: note: in `Cpp` name lookup for `WideGreeting` [InCppNameLookup] + // CHECK:STDERR: ╭─┤ fail_import_unsupported_string_literal_types.carbon:[[@LINE+16]]:2 + // CHECK:STDERR: -> │ Cpp.WideGreeting; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: + // CHECK:STDERR: · │ ┃ `Unsupported: string literal type: const wchar_t[6]` + // CHECK:STDERR: · │ ┃ [SemanticsTodo] + // CHECK:STDERR: · ╰────┤ in `Cpp` name lookup for `WideGreeting` [InCppNameLookup] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_import_unsupported_string_literal_types.carbon:[[@LINE+2]]:2-17: error: member name `WideGreeting` not found in `Cpp` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╭─┤ fail_import_unsupported_string_literal_types.carbon:[[@LINE+7]]:2 + // CHECK:STDERR: -> │ Cpp.WideGreeting; + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: member name `WideGreeting` not found in `Cpp` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.WideGreeting; } @@ -293,10 +368,20 @@ import Cpp inline ''' '''; fn F() { - // CHECK:STDERR: fail_bad_string.carbon:[[@LINE+5]]:2-14: error: failed to parse macro Cpp.BadString to a valid constant expression [InCppMacroEvaluation] - // CHECK:STDERR: fail_bad_string.carbon:[[@LINE+4]]:2-14: note: in `Cpp` name lookup for `BadString` [InCppNameLookup] + // CHECK:STDERR: ╭─┤ fail_bad_string.carbon:[[@LINE+15]]:2 + // CHECK:STDERR: -> │ Cpp.BadString; + // CHECK:STDERR: · ━┳━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: failed to parse macro Cpp.BadString to a valid constant expression + // CHECK:STDERR: · │ ┃ [InCppMacroEvaluation] + // CHECK:STDERR: · ╰────┤ in `Cpp` name lookup for `BadString` [InCppNameLookup] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_bad_string.carbon:[[@LINE+2]]:2-14: error: member name `BadString` not found in `Cpp` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╭─┤ fail_bad_string.carbon:[[@LINE+7]]:2 + // CHECK:STDERR: -> │ Cpp.BadString; + // CHECK:STDERR: · ━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: member name `BadString` not found in `Cpp` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.BadString; } @@ -330,10 +415,21 @@ library "[[@TEST_NAME]]"; import Cpp library "unsupported_floating_point_literal_macro.h"; fn F() { - // CHECK:STDERR: fail_import_unsupported_floating_point_literal_macro.carbon:[[@LINE+5]]:3-18: error: semantics TODO: `Unsupported: macro evaluated to a constant of type: long double` [SemanticsTodo] - // CHECK:STDERR: fail_import_unsupported_floating_point_literal_macro.carbon:[[@LINE+4]]:3-18: note: in `Cpp` name lookup for `MyLongDouble` [InCppNameLookup] + // CHECK:STDERR: ╭─┤ fail_import_unsupported_floating_point_literal_macro.carbon:[[@LINE+16]]:3 + // CHECK:STDERR: -> │ Cpp.MyLongDouble; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: + // CHECK:STDERR: · │ ┃ `Unsupported: macro evaluated to a constant of type: long double` + // CHECK:STDERR: · │ ┃ [SemanticsTodo] + // CHECK:STDERR: · ╰────┤ in `Cpp` name lookup for `MyLongDouble` [InCppNameLookup] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_import_unsupported_floating_point_literal_macro.carbon:[[@LINE+2]]:3-18: error: member name `MyLongDouble` not found in `Cpp` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╭─┤ fail_import_unsupported_floating_point_literal_macro.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ Cpp.MyLongDouble; + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: member name `MyLongDouble` not found in `Cpp` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.MyLongDouble; } @@ -345,7 +441,11 @@ library "[[@TEST_NAME]]"; import Cpp library "floating_point_literal_macro.h"; fn F() { - // CHECK:STDERR: fail_import_assign_to_float.carbon:[[@LINE+2]]:3-14: error: expression is not assignable [AssignmentToNonAssignable] + // CHECK:STDERR: ╭─┤ fail_import_assign_to_float.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ Cpp.MyDouble = 1.0; + // CHECK:STDERR: · ━━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: expression is not assignable [AssignmentToNonAssignable] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.MyDouble = 1.0; } @@ -398,7 +498,6 @@ fn F() { // --- multiple_characters.h -// CHECK:STDERR: expanded from macro defined at: ./multiple_characters.h:[[@LINE+1]]:24 [InCppMacroExpansion] #define MULTIPLE_CHARS 'AB' // --- import_multiple_characters.carbon @@ -408,8 +507,15 @@ library "[[@TEST_NAME]]"; import Cpp library "multiple_characters.h"; fn F() { - // CHECK:STDERR: import_multiple_characters.carbon:[[@LINE+3]]:25: warning: multi-character character constant [CppInteropParseWarning] - // CHECK:STDERR: import_multiple_characters.carbon:[[@LINE+2]]:22-39: note: in `Cpp` name lookup for `MULTIPLE_CHARS` [InCppNameLookup] + // CHECK:STDERR: ╷ ╭── expanded from macro defined at: ./multiple_characters.h [InCppMacroExpansion] + // CHECK:STDERR: ├─┤ import_multiple_characters.carbon:[[@LINE+9]]:25 + // CHECK:STDERR: -> │ #define MULTIPLE_CHARS 'AB' + // CHECK:STDERR: · ───┳─────┬──────── + // CHECK:STDERR: · ┗━━━━━━━━┫ warning: multi-character character constant + // CHECK:STDERR: · │ ┃ [CppInteropParseWarning] + // CHECK:STDERR: · ╰────┤ in `Cpp` name lookup for `MULTIPLE_CHARS` + // CHECK:STDERR: · │ [InCppNameLookup] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused a: i32 = Cpp.MULTIPLE_CHARS; } @@ -427,22 +533,61 @@ library "[[@TEST_NAME]]"; import Cpp library "unsupported_character_literal_types.h"; fn F() { - // CHECK:STDERR: fail_unsupported_character_literal_types.carbon:[[@LINE+5]]:23-38: error: semantics TODO: `Unsupported: macro evaluated to a constant of type: char16_t` [SemanticsTodo] - // CHECK:STDERR: fail_unsupported_character_literal_types.carbon:[[@LINE+4]]:23-38: note: in `Cpp` name lookup for `M_UTF16_CHAR` [InCppNameLookup] + // CHECK:STDERR: ╭─┤ fail_unsupported_character_literal_types.carbon:[[@LINE+18]]:23 + // CHECK:STDERR: -> │ let unused a: char = Cpp.M_UTF16_CHAR; + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: semantics TODO: + // CHECK:STDERR: · ┃ `Unsupported: macro evaluated to a constant of type: char16_t` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: · ╰──┤ in `Cpp` name lookup for `M_UTF16_CHAR` + // CHECK:STDERR: · │ [InCppNameLookup] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_unsupported_character_literal_types.carbon:[[@LINE+2]]:23-38: error: member name `M_UTF16_CHAR` not found in `Cpp` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╭─┤ fail_unsupported_character_literal_types.carbon:[[@LINE+7]]:23 + // CHECK:STDERR: -> │ let unused a: char = Cpp.M_UTF16_CHAR; + // CHECK:STDERR: · ━┳━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: member name `M_UTF16_CHAR` not found in `Cpp` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused a: char = Cpp.M_UTF16_CHAR; - // CHECK:STDERR: fail_unsupported_character_literal_types.carbon:[[@LINE+5]]:23-38: error: semantics TODO: `Unsupported: macro evaluated to a constant of type: char32_t` [SemanticsTodo] - // CHECK:STDERR: fail_unsupported_character_literal_types.carbon:[[@LINE+4]]:23-38: note: in `Cpp` name lookup for `M_UTF32_CHAR` [InCppNameLookup] + // CHECK:STDERR: ╭─┤ fail_unsupported_character_literal_types.carbon:[[@LINE+18]]:23 + // CHECK:STDERR: -> │ let unused b: char = Cpp.M_UTF32_CHAR; + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: semantics TODO: + // CHECK:STDERR: · ┃ `Unsupported: macro evaluated to a constant of type: char32_t` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: · ╰──┤ in `Cpp` name lookup for `M_UTF32_CHAR` + // CHECK:STDERR: · │ [InCppNameLookup] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_unsupported_character_literal_types.carbon:[[@LINE+2]]:23-38: error: member name `M_UTF32_CHAR` not found in `Cpp` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╭─┤ fail_unsupported_character_literal_types.carbon:[[@LINE+7]]:23 + // CHECK:STDERR: -> │ let unused b: char = Cpp.M_UTF32_CHAR; + // CHECK:STDERR: · ━┳━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: member name `M_UTF32_CHAR` not found in `Cpp` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused b: char = Cpp.M_UTF32_CHAR; - // CHECK:STDERR: fail_unsupported_character_literal_types.carbon:[[@LINE+5]]:23-37: error: semantics TODO: `Unsupported: macro evaluated to a constant of type: wchar_t` [SemanticsTodo] - // CHECK:STDERR: fail_unsupported_character_literal_types.carbon:[[@LINE+4]]:23-37: note: in `Cpp` name lookup for `M_WIDE_CHAR` [InCppNameLookup] + // CHECK:STDERR: ╭─┤ fail_unsupported_character_literal_types.carbon:[[@LINE+18]]:23 + // CHECK:STDERR: -> │ let unused c: char = Cpp.M_WIDE_CHAR; + // CHECK:STDERR: · ━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: semantics TODO: + // CHECK:STDERR: · ┃ `Unsupported: macro evaluated to a constant of type: wchar_t` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: · ╰──┤ in `Cpp` name lookup for `M_WIDE_CHAR` + // CHECK:STDERR: · │ [InCppNameLookup] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_unsupported_character_literal_types.carbon:[[@LINE+2]]:23-37: error: member name `M_WIDE_CHAR` not found in `Cpp` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╭─┤ fail_unsupported_character_literal_types.carbon:[[@LINE+7]]:23 + // CHECK:STDERR: -> │ let unused c: char = Cpp.M_WIDE_CHAR; + // CHECK:STDERR: · ━━┳━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: member name `M_WIDE_CHAR` not found in `Cpp` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused c: char = Cpp.M_WIDE_CHAR; } @@ -454,7 +599,11 @@ library "[[@TEST_NAME]]"; import Cpp library "character_literals.h"; fn F() { - // CHECK:STDERR: fail_assign_to_character_literals.carbon:[[@LINE+2]]:2-16: error: expression is not assignable [AssignmentToNonAssignable] + // CHECK:STDERR: ╭─┤ fail_assign_to_character_literals.carbon:[[@LINE+6]]:2 + // CHECK:STDERR: -> │ Cpp.M_LOWERCASE = 'b'; + // CHECK:STDERR: · ━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: expression is not assignable [AssignmentToNonAssignable] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.M_LOWERCASE = 'b'; } @@ -506,7 +655,11 @@ library "[[@TEST_NAME]]"; import Cpp library "boolean_literal_macro.h"; fn F() { - // CHECK:STDERR: fail_assign_to_boolean_literal_macro.carbon:[[@LINE+2]]:2-11: error: expression is not assignable [AssignmentToNonAssignable] + // CHECK:STDERR: ╭─┤ fail_assign_to_boolean_literal_macro.carbon:[[@LINE+6]]:2 + // CHECK:STDERR: -> │ Cpp.M_TRUE = false; + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: expression is not assignable [AssignmentToNonAssignable] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.M_TRUE = false; } @@ -650,7 +803,12 @@ library "[[@TEST_NAME]]"; import Cpp library "macro_undefined.h"; fn F() { - // CHECK:STDERR: fail_macro_undefined.carbon:[[@LINE+2]]:23-37: error: member name `UNDEF_VALUE` not found in `Cpp` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╭─┤ fail_macro_undefined.carbon:[[@LINE+7]]:23 + // CHECK:STDERR: -> │ let unused a: i32 = Cpp.UNDEF_VALUE; + // CHECK:STDERR: · ━━┳━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: member name `UNDEF_VALUE` not found in `Cpp` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused a: i32 = Cpp.UNDEF_VALUE; } @@ -677,16 +835,23 @@ fn F() { // --- macro_defined_twice.h #define TWICE_DEF 1 +// CHECK:STDERR: ╷ ╭── included from: import_macro_defined_twice.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./macro_defined_twice.h:[[@LINE+10]]:9 +// CHECK:STDERR: │ #define TWICE_DEF 1 +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ previous definition is here [CppInteropParseNote] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ #define TWICE_DEF 2 +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ warning: 'TWICE_DEF' macro redefined [CppInteropParseWarning] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: #define TWICE_DEF 2 // --- import_macro_defined_twice.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: included from: import_macro_defined_twice.carbon:[[@LINE+4]]:10 [InCppInclude] -// CHECK:STDERR: ./macro_defined_twice.h:3:9: warning: 'TWICE_DEF' macro redefined [CppInteropParseWarning] -// CHECK:STDERR: ./macro_defined_twice.h:2:9: note: previous definition is here [CppInteropParseNote] -// CHECK:STDERR: import Cpp library "macro_defined_twice.h"; fn F() { @@ -710,7 +875,12 @@ library "[[@TEST_NAME]]"; import Cpp library "function_like_macros.h"; fn F() { - // CHECK:STDERR: fail_todo_import_function_like_macros.carbon:[[@LINE+2]]:23-29: error: member name `MAX` not found in `Cpp` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╭─┤ fail_todo_import_function_like_macros.carbon:[[@LINE+7]]:23 + // CHECK:STDERR: -> │ let unused a: i32 = Cpp.MAX(1,2); + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: member name `MAX` not found in `Cpp` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused a: i32 = Cpp.MAX(1,2); } @@ -730,7 +900,13 @@ library "[[@TEST_NAME]]"; import Cpp library "predefined_macros.h"; fn F() { - // CHECK:STDERR: fail_todo_import_predefined_macros.carbon:[[@LINE+2]]:30-41: error: member name `__LINE__` not found in `Cpp` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╭─┤ fail_todo_import_predefined_macros.carbon:[[@LINE+8]]:30 + // CHECK:STDERR: -> │ let unused line_num: i32 = Cpp.__LINE__; + // CHECK:STDERR: · ┳━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: member name `__LINE__` not found in + // CHECK:STDERR: · ┃ `Cpp` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused line_num: i32 = Cpp.__LINE__; } @@ -755,7 +931,12 @@ library "[[@TEST_NAME]]"; import Cpp library "header_guard_macros.h"; fn F() { - // CHECK:STDERR: fail_import_header_guard_macros.carbon:[[@LINE+2]]:3-27: error: member name `HEADER_GUARD_MACRO_H_` not found in `Cpp` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╭─┤ fail_import_header_guard_macros.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ Cpp.HEADER_GUARD_MACRO_H_; + // CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: member name `HEADER_GUARD_MACRO_H_` not found in `Cpp` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.HEADER_GUARD_MACRO_H_; } @@ -833,11 +1014,24 @@ Struct s; '''; fn F() { - // CHECK:STDERR: fail_todo_assign_array.carbon:[[@LINE+6]]:3-7: error: semantics TODO: `lvalue path contains an array type` [SemanticsTodo] - // CHECK:STDERR: fail_todo_assign_array.carbon:[[@LINE+5]]:3-7: note: in `Cpp` name lookup for `m` [InCppNameLookup] + // CHECK:STDERR: ╭─┤ fail_todo_assign_array.carbon:[[@LINE+19]]:3 + // CHECK:STDERR: -> │ Cpp.m = 2; + // CHECK:STDERR: · ━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `lvalue path contains an array type` + // CHECK:STDERR: · │ ┃ [SemanticsTodo] + // CHECK:STDERR: · ╰────┤ in `Cpp` name lookup for `m` [InCppNameLookup] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_todo_assign_array.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `Core.IntLiteral` to `array(i32, 3)` [ConversionFailure] - // CHECK:STDERR: fail_todo_assign_array.carbon:[[@LINE+2]]:3-11: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(array(i32, 3))` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_todo_assign_array.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: -> │ Cpp.m = 2; + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `Core.IntLiteral` to + // CHECK:STDERR: · │ ┃ `array(i32, 3)` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Core.IntLiteral` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(array(i32, 3))` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.m = 2; } @@ -855,10 +1049,20 @@ struct DerivedB : BaseA {} b_obj; '''; fn F() { - // CHECK:STDERR: fail_todo_assign_base_class_member.carbon:[[@LINE+5]]:3-7: error: semantics TODO: `lvalue path contains a base class subobject` [SemanticsTodo] - // CHECK:STDERR: fail_todo_assign_base_class_member.carbon:[[@LINE+4]]:3-7: note: in `Cpp` name lookup for `m` [InCppNameLookup] + // CHECK:STDERR: ╭─┤ fail_todo_assign_base_class_member.carbon:[[@LINE+15]]:3 + // CHECK:STDERR: -> │ Cpp.m = 2; + // CHECK:STDERR: · ━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `lvalue path contains a base class subobject` + // CHECK:STDERR: · │ ┃ [SemanticsTodo] + // CHECK:STDERR: · ╰────┤ in `Cpp` name lookup for `m` [InCppNameLookup] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_todo_assign_base_class_member.carbon:[[@LINE+2]]:3-7: error: member name `m` not found in `Cpp` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╭─┤ fail_todo_assign_base_class_member.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ Cpp.m = 2; + // CHECK:STDERR: · ━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: member name `m` not found in `Cpp` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.m = 2; } @@ -2050,7 +2254,7 @@ let _: C(1) = {} as C(Cpp.COUNT); // CHECK:STDOUT: %Cpp.ref: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: // CHECK:STDOUT: %TWICE_DEF.ref: %i32 = name_ref TWICE_DEF, constants.%int_2 [concrete = constants.%int_2] -// CHECK:STDOUT: %i32.loc12: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc8: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %a: %i32 = wrapper_binding a, %TWICE_DEF.ref // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %a.patt: %pattern_type.d94 = value_binding_pattern a [concrete = constants.%a.patt] diff --git a/toolchain/check/testdata/interop/cpp/namespace/export.carbon b/toolchain/check/testdata/interop/cpp/namespace/export.carbon index 2b7fcf11c904..a122763b72c6 100644 --- a/toolchain/check/testdata/interop/cpp/namespace/export.carbon +++ b/toolchain/check/testdata/interop/cpp/namespace/export.carbon @@ -64,7 +64,12 @@ class C {} inline Cpp ''' Carbon::C* p; -// CHECK:STDERR: fail_current_package_not_in_carbon.carbon:[[@LINE+2]]:25: error: expected namespace name [CppInteropParseError] +// CHECK:STDERR: ╭─┤ fail_current_package_not_in_carbon.carbon:[[@LINE+7]]:25 +// CHECK:STDERR: -> │ namespace Bad = Carbon::SelfPkg; +// CHECK:STDERR: · ───────╴╻ +// CHECK:STDERR: · ┗━━┫ error: expected namespace name +// CHECK:STDERR: · ┃ [CppInteropParseError] +// CHECK:STDERR: ╰──── // CHECK:STDERR: namespace Bad = Carbon::SelfPkg; '''; @@ -77,7 +82,12 @@ class C {} inline Cpp ''' Carbon::C* p; -// CHECK:STDERR: fail_main_package_not_in_carbon.carbon:[[@LINE+2]]:25: error: expected namespace name [CppInteropParseError] +// CHECK:STDERR: ╭─┤ fail_main_package_not_in_carbon.carbon:[[@LINE+7]]:25 +// CHECK:STDERR: -> │ namespace Bad = Carbon::Main; +// CHECK:STDERR: · ───────╴╻ +// CHECK:STDERR: · ┗━━┫ error: expected namespace name +// CHECK:STDERR: · ┃ [CppInteropParseError] +// CHECK:STDERR: ╰──── // CHECK:STDERR: namespace Bad = Carbon::Main; '''; diff --git a/toolchain/check/testdata/interop/cpp/namespace/import.carbon b/toolchain/check/testdata/interop/cpp/namespace/import.carbon index afbf961cb896..ec7e81086fa1 100644 --- a/toolchain/check/testdata/interop/cpp/namespace/import.carbon +++ b/toolchain/check/testdata/interop/cpp/namespace/import.carbon @@ -40,7 +40,12 @@ library "[[@TEST_NAME]]"; import Cpp library "single.h"; fn MyF() { - // CHECK:STDERR: fail_import_namespace_wrong_member_name.carbon:[[@LINE+2]]:3-26: error: member name `not_foo` not found in `Cpp.my_namespace` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╭─┤ fail_import_namespace_wrong_member_name.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ Cpp.my_namespace.not_foo(); + // CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: member name `not_foo` not found in `Cpp.my_namespace` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.my_namespace.not_foo(); } @@ -52,7 +57,12 @@ library "[[@TEST_NAME]]"; import Cpp library "single.h"; fn MyF() { - // CHECK:STDERR: fail_import_namespace_wrong_name.carbon:[[@LINE+2]]:3-22: error: member name `not_my_namespace` not found in `Cpp` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╭─┤ fail_import_namespace_wrong_name.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ Cpp.not_my_namespace.foo(); + // CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: member name `not_my_namespace` not found in `Cpp` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.not_my_namespace.foo(); } @@ -128,15 +138,33 @@ fn MyF() { // file split. // TODO: Pass a location into Clang when performing C++ name lookup so that // its error has a location attached. - // CHECK:STDERR: fail_import_inline_ambiguity.carbon:[[@LINE+5]]:3-7: error: name `error` not found [NameNotFound] + // CHECK:STDERR: ╭─┤ fail_import_inline_ambiguity.carbon:[[@LINE+25]]:3 + // CHECK:STDERR: -> │ error; + // CHECK:STDERR: · ━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: name `error` not found [NameNotFound] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: + // CHECK:STDERR: -> ╭─┤ + // CHECK:STDERR: · ┗━━┫ error: reference to 'N' is ambiguous [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ ./inline_ambiguity.h:2:11 + // CHECK:STDERR: │ namespace N { void foo(); } + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ candidate found by name lookup is 'N' [CppInteropParseNote] + // CHECK:STDERR: │ inline namespace { namespace N {} } + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ candidate found by name lookup is '(anonymous + // CHECK:STDERR: · │ namespace)::N' + // CHECK:STDERR: · │ [CppInteropParseNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ fail_import_inline_ambiguity.carbon + // CHECK:STDERR: │ Cpp.N.foo(); + // CHECK:STDERR: · ──┬── + // CHECK:STDERR: · ╰──┤ in `Cpp` name lookup for `N` [InCppNameLookup] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: error: reference to 'N' is ambiguous [CppInteropParseError] - // CHECK:STDERR: ./inline_ambiguity.h:2:11: note: candidate found by name lookup is 'N' [CppInteropParseNote] - // CHECK:STDERR: ./inline_ambiguity.h:3:30: note: candidate found by name lookup is '(anonymous namespace)::N' [CppInteropParseNote] error; - // CHECK:STDERR: fail_import_inline_ambiguity.carbon:[[@LINE+2]]:3-7: note: in `Cpp` name lookup for `N` [InCppNameLookup] - // CHECK:STDERR: Cpp.N.foo(); } @@ -177,7 +205,12 @@ library "[[@TEST_NAME]]"; import Cpp library "special_name.h"; fn MyF() { - // CHECK:STDERR: fail_import_special_name_call_unescpaed.carbon:[[@LINE+2]]:3-10: error: member name `base` not found in `Cpp` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╭─┤ fail_import_special_name_call_unescpaed.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ Cpp.base.foo(); + // CHECK:STDERR: · ━━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: member name `base` not found in `Cpp` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.base.foo(); } @@ -228,6 +261,15 @@ fn Use(y: Cpp.Y) -> i32 { library "[[@TEST_NAME]]"; +// CHECK:STDERR: ╷ ╭── imported from: fail_indirect_namespace_no_import.carbon [InImport] +// CHECK:STDERR: ├─┤ namespace_alias.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ import Cpp library "single.h"; +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: +// CHECK:STDERR: · ┃ `indirect import of C++ declaration with no direct Cpp import` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: import Cpp library "single.h"; alias MyNamespaceAlias = Cpp.my_namespace; @@ -240,9 +282,6 @@ fn CallFoo() { library "[[@TEST_NAME]]"; -// CHECK:STDERR: imported from: fail_indirect_namespace_no_import.carbon:[[@LINE+6]]:1 [InImport] -// CHECK:STDERR: namespace_alias.carbon:4:1-30: error: semantics TODO: `indirect import of C++ declaration with no direct Cpp import` [SemanticsTodo] -// CHECK:STDERR: // CHECK:STDERR: imported from: fail_indirect_namespace_no_import.carbon:[[@LINE+3]]:1 [InImport] // CHECK:STDERR: namespace_alias.carbon: error: semantics TODO: `indirect import of C++ declaration with no direct Cpp import` [SemanticsTodo] // CHECK:STDERR: @@ -251,11 +290,21 @@ import library "namespace_alias"; fn F() { // Imports are not implicitly re-exported, so lookup is expected to fail, // regardless of whether a lookup was performed in the imported file. - // CHECK:STDERR: fail_indirect_namespace_no_import.carbon:[[@LINE+2]]:3-22: error: member name `foo` not found in `Cpp.my_namespace` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╭─┤ fail_indirect_namespace_no_import.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ MyNamespaceAlias.foo(); + // CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: member name `foo` not found in `Cpp.my_namespace` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: MyNamespaceAlias.foo(); - // CHECK:STDERR: fail_indirect_namespace_no_import.carbon:[[@LINE+2]]:3-22: error: member name `bar` not found in `Cpp.my_namespace` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╭─┤ fail_indirect_namespace_no_import.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ MyNamespaceAlias.bar(); + // CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: member name `bar` not found in `Cpp.my_namespace` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: MyNamespaceAlias.bar(); } @@ -273,11 +322,21 @@ import Cpp; fn F() { // Imports are not implicitly re-exported, so name lookup is expected to // fail, regardless of whether a lookup was performed in the imported file. - // CHECK:STDERR: fail_indirect_namespace_no_local_decl.carbon:[[@LINE+2]]:3-22: error: member name `foo` not found in `Cpp.my_namespace` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╭─┤ fail_indirect_namespace_no_local_decl.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ MyNamespaceAlias.foo(); + // CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: member name `foo` not found in `Cpp.my_namespace` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: MyNamespaceAlias.foo(); - // CHECK:STDERR: fail_indirect_namespace_no_local_decl.carbon:[[@LINE+2]]:3-22: error: member name `bar` not found in `Cpp.my_namespace` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╭─┤ fail_indirect_namespace_no_local_decl.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ MyNamespaceAlias.bar(); + // CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: member name `bar` not found in `Cpp.my_namespace` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: MyNamespaceAlias.bar(); } @@ -311,7 +370,12 @@ namespace my_namespace { fn F() { // Cpp imports are not implicitly re-exported, so name lookup is expected to // fail. - // CHECK:STDERR: fail_indirect_namespace_different_contents_invalid.carbon:[[@LINE+2]]:3-22: error: member name `foo` not found in `Cpp.my_namespace` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╭─┤ fail_indirect_namespace_different_contents_invalid.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ MyNamespaceAlias.foo(); + // CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: member name `foo` not found in `Cpp.my_namespace` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: MyNamespaceAlias.foo(); } diff --git a/toolchain/check/testdata/interop/cpp/namespace/lookup_after_failure.carbon b/toolchain/check/testdata/interop/cpp/namespace/lookup_after_failure.carbon index 535994e9feb4..696c3666ce8c 100644 --- a/toolchain/check/testdata/interop/cpp/namespace/lookup_after_failure.carbon +++ b/toolchain/check/testdata/interop/cpp/namespace/lookup_after_failure.carbon @@ -30,17 +30,33 @@ using namespace Carbon::N; // triggering typo correction) and resolve to `Fallback`. Following the normal // Carbon name poisoning rules, these then trigger poisoning errors when those // names are defined in Carbon. -// CHECK:STDERR: fail_declare_after_poisoning.carbon:[[@LINE+1]]:10: error: name `LaterFn` used before it was declared [NameUseBeforeDecl] +// CHECK:STDERR: ╭─┤ fail_declare_after_poisoning.carbon:[[@LINE+11]]:10 +// CHECK:STDERR: -> │ int *a = LaterFn(); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: name `LaterFn` used before it was declared +// CHECK:STDERR: · ┃ [NameUseBeforeDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: │ fn LaterFn() -> i32; +// CHECK:STDERR: · ───┬─── +// CHECK:STDERR: · ╰──┤ declared here [NameUseBeforeDeclNote] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: int *a = LaterFn(); +// CHECK:STDERR: ╭─┤ fail_declare_after_poisoning.carbon:[[@LINE+11]]:10 +// CHECK:STDERR: -> │ int *b = LaterNestedFn(); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: name `LaterNestedFn` used before it was declared +// CHECK:STDERR: · ┃ [NameUseBeforeDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: │ fn N.LaterNestedFn() -> i32; +// CHECK:STDERR: · ──────┬────── +// CHECK:STDERR: · ╰──┤ declared here [NameUseBeforeDeclNote] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: int *b = LaterNestedFn(); '''; -// CHECK:STDERR: fail_declare_after_poisoning.carbon:[[@LINE+3]]:4-10: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: -// CHECK:STDERR: fail_declare_after_poisoning.carbon:[[@LINE-5]]:10: error: name `LaterNestedFn` used before it was declared [NameUseBeforeDecl] fn LaterFn() -> i32; -// CHECK:STDERR: fail_declare_after_poisoning.carbon:[[@LINE+2]]:6-18: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: fn N.LaterNestedFn() -> i32; inline Cpp ''' @@ -64,16 +80,30 @@ void TestLookupFailureInNested() { // second is a Carbon error for declaring a poisoned name. Normally we would // suppress the first error when we produce the second, but we don't do that // when the first error is produced by Clang. - // CHECK:STDERR: fail_declare_after_poisoning_with_lookup_failure.carbon:[[@LINE+3]]:19-31: error: no member named 'LaterInNested' in namespace 'Carbon::Nested' [CppInteropParseError] + // CHECK:STDERR: ╭─┤ fail_declare_after_poisoning_with_lookup_failure.carbon:[[@LINE+19]]:19 + // CHECK:STDERR: -> │ Carbon::Nested::LaterInNested(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no member named 'LaterInNested' in namespace + // CHECK:STDERR: · ┃ 'Carbon::Nested' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: + // CHECK:STDERR: ╭─┤ fail_declare_after_poisoning_with_lookup_failure.carbon:[[@LINE+11]]:19 + // CHECK:STDERR: -> │ Carbon::Nested::LaterInNested(); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: name `LaterInNested` used before it was declared + // CHECK:STDERR: · ┃ [NameUseBeforeDecl] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ fn Nested.LaterInNested() {} + // CHECK:STDERR: · ──────┬────── + // CHECK:STDERR: · ╰──┤ declared here [NameUseBeforeDeclNote] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_declare_after_poisoning_with_lookup_failure.carbon:[[@LINE+1]]:19: error: name `LaterInNested` used before it was declared [NameUseBeforeDecl] Carbon::Nested::LaterInNested(); Carbon::Nested::EarlyFn(); } '''; -// CHECK:STDERR: fail_declare_after_poisoning_with_lookup_failure.carbon:[[@LINE+2]]:11-23: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: fn Nested.LaterInNested() {} inline Cpp ''' @@ -98,9 +128,18 @@ inline Cpp ''' Carbon::ExportedType* p1 = nullptr; void TestTypoInCarbon() { - // CHECK:STDERR: fail_typo_in_carbon_namespace.carbon:[[@LINE+4]]:11: error: no type named 'ExportedTyp' in namespace 'Carbon'; did you mean 'ExportedType'? [CppInteropParseError] - // CHECK:STDERR: fail_typo_in_carbon_namespace.carbon:[[@LINE+3]]:11-21: note: replace with `ExportedType` [CppInteropFixItReplacement] - // CHECK:STDERR: fail_typo_in_carbon_namespace.carbon:[[@LINE-12]]:20: note: 'ExportedType' declared here [CppInteropParseNote] + // CHECK:STDERR: ╭─┤ fail_typo_in_carbon_namespace.carbon:[[@LINE+13]]:11 + // CHECK:STDERR: │ class ExportedType { + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ 'ExportedType' declared here [CppInteropParseNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Carbon::ExportedTyp* p_typo = p1; + // CHECK:STDERR: · ───────╴┎┬───────── + // CHECK:STDERR: · ┗━━━┫ error: no type named 'ExportedTyp' in namespace 'Carbon'; did + // CHECK:STDERR: · │ ┃ you mean 'ExportedType'? + // CHECK:STDERR: · │ ┃ [CppInteropParseError] + // CHECK:STDERR: · ╰────┤ replace with `ExportedType` [CppInteropFixItReplacement] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Carbon::ExportedTyp* p_typo = p1; @@ -109,7 +148,12 @@ void TestTypoInCarbon() { // subsequent name lookups still work properly. Carbon::EarlyFn(); Carbon::ExportedType* p2 = p1; - // CHECK:STDERR: fail_typo_in_carbon_namespace.carbon:[[@LINE+2]]:11-21: error: no member named 'NotDeclared' in namespace 'Carbon' [CppInteropParseError] + // CHECK:STDERR: ╭─┤ fail_typo_in_carbon_namespace.carbon:[[@LINE+7]]:11 + // CHECK:STDERR: -> │ Carbon::NotDeclared(); + // CHECK:STDERR: · ━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no member named 'NotDeclared' in namespace 'Carbon' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Carbon::NotDeclared(); } @@ -141,7 +185,13 @@ class MyClass { inline Cpp ''' void TestTypoInClass() { // TODO: It'd be nice if Clang's typo correction could correct this. - // CHECK:STDERR: fail_typo_in_carbon_class.carbon:[[@LINE+2]]:20-31: error: no member named 'StaticMetho1' in 'Carbon::Main::MyClass' [CppInteropParseError] + // CHECK:STDERR: ╭─┤ fail_typo_in_carbon_class.carbon:[[@LINE+8]]:20 + // CHECK:STDERR: -> │ Carbon::MyClass::StaticMetho1(); + // CHECK:STDERR: · ┳━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no member named 'StaticMetho1' in + // CHECK:STDERR: · ┃ 'Carbon::Main::MyClass' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Carbon::MyClass::StaticMetho1(); @@ -153,9 +203,20 @@ void TestTypoInClass() { static_assert(sizeof(Carbon::MyClass) == 4); // Typo correction does work once we've exported the name. - // CHECK:STDERR: fail_typo_in_carbon_class.carbon:[[@LINE+4]]:20-31: error: no member named 'StaticMetho1' in 'Carbon::Main::MyClass'; did you mean 'StaticMethod1'? [CppInteropParseError] - // CHECK:STDERR: fail_typo_in_carbon_class.carbon:[[@LINE+3]]:20-31: note: replace with `StaticMethod1` [CppInteropFixItReplacement] - // CHECK:STDERR: fail_typo_in_carbon_class.carbon:[[@LINE-22]]:21: note: 'StaticMethod1' declared here [CppInteropParseNote] + // CHECK:STDERR: ╭─┤ fail_typo_in_carbon_class.carbon:[[@LINE+15]]:20 + // CHECK:STDERR: │ fn StaticMethod1(); + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ 'StaticMethod1' declared here [CppInteropParseNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Carbon::MyClass::StaticMetho1(); + // CHECK:STDERR: · ┳━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no member named 'StaticMetho1' in + // CHECK:STDERR: · │ ┃ 'Carbon::Main::MyClass'; did you mean + // CHECK:STDERR: · │ ┃ 'StaticMethod1'? + // CHECK:STDERR: · │ ┃ [CppInteropParseError] + // CHECK:STDERR: · ╰────┤ replace with `StaticMethod1` + // CHECK:STDERR: · │ [CppInteropFixItReplacement] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Carbon::MyClass::StaticMetho1(); } diff --git a/toolchain/check/testdata/interop/cpp/namespace/roundtrip.carbon b/toolchain/check/testdata/interop/cpp/namespace/roundtrip.carbon index 1c5a0d2f020f..65f0fe3d1a38 100644 --- a/toolchain/check/testdata/interop/cpp/namespace/roundtrip.carbon +++ b/toolchain/check/testdata/interop/cpp/namespace/roundtrip.carbon @@ -68,7 +68,12 @@ void F(); void G() { // This is not found because it looks for the identifier `Cpp`, not the keyword `Cpp`. - // CHECK:STDERR: fail_carbon_cpp.carbon:[[@LINE+2]]:11: error: no member named 'Cpp' in namespace 'Carbon' [CppInteropParseError] + // CHECK:STDERR: ╭─┤ fail_carbon_cpp.carbon:[[@LINE+7]]:11 + // CHECK:STDERR: -> │ Carbon::Cpp::F(); + // CHECK:STDERR: · ───────╴╻ + // CHECK:STDERR: · ┗━━┫ error: no member named 'Cpp' in namespace 'Carbon' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Carbon::Cpp::F(); } @@ -85,9 +90,19 @@ inline Cpp ''' void FRaw(); void GRaw() { - // CHECK:STDERR: fail_carbon_raw_cpp.carbon:[[@LINE+4]]:16: error: semantics TODO: `interop with translation unit decl` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_carbon_raw_cpp.carbon:[[@LINE+14]]:16 + // CHECK:STDERR: -> │ Carbon::Cpp::FRaw(); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `interop with translation unit decl` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_carbon_raw_cpp.carbon:[[@LINE+2]]:11: error: no member named 'Cpp' in namespace 'Carbon' [CppInteropParseError] + // CHECK:STDERR: ╭─┤ fail_carbon_raw_cpp.carbon:[[@LINE+7]]:11 + // CHECK:STDERR: -> │ Carbon::Cpp::FRaw(); + // CHECK:STDERR: · ───────╴╻ + // CHECK:STDERR: · ┗━━┫ error: no member named 'Cpp' in namespace 'Carbon' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Carbon::Cpp::FRaw(); } diff --git a/toolchain/check/testdata/interop/cpp/operators/builtin_candidates.carbon b/toolchain/check/testdata/interop/cpp/operators/builtin_candidates.carbon index ac95e3fd4470..72349b52dab1 100644 --- a/toolchain/check/testdata/interop/cpp/operators/builtin_candidates.carbon +++ b/toolchain/check/testdata/interop/cpp/operators/builtin_candidates.carbon @@ -51,16 +51,44 @@ enum class EC { e1, e2, e3 }; '''; fn TestEnumClass(a: Cpp.EC, b: Cpp.EC) { - // CHECK:STDERR: fail_enum_class_bitwise_operators.carbon:[[@LINE+2]]:19-23: error: cannot access member of interface `Core.BitAndWith(Cpp.EC)` in type `Cpp.EC` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_enum_class_bitwise_operators.carbon:[[@LINE+9]]:19 + // CHECK:STDERR: -> │ let _: Cpp.EC = a & b; + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.BitAndWith(Cpp.EC)` in type `Cpp.EC` that + // CHECK:STDERR: · ┃ does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: Cpp.EC = a & b; - // CHECK:STDERR: fail_enum_class_bitwise_operators.carbon:[[@LINE+2]]:19-23: error: cannot access member of interface `Core.BitOrWith(Cpp.EC)` in type `Cpp.EC` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_enum_class_bitwise_operators.carbon:[[@LINE+9]]:19 + // CHECK:STDERR: -> │ let _: Cpp.EC = a | b; + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.BitOrWith(Cpp.EC)` in type `Cpp.EC` that + // CHECK:STDERR: · ┃ does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: Cpp.EC = a | b; - // CHECK:STDERR: fail_enum_class_bitwise_operators.carbon:[[@LINE+2]]:19-23: error: cannot access member of interface `Core.BitXorWith(Cpp.EC)` in type `Cpp.EC` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_enum_class_bitwise_operators.carbon:[[@LINE+9]]:19 + // CHECK:STDERR: -> │ let _: Cpp.EC = a ^ b; + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.BitXorWith(Cpp.EC)` in type `Cpp.EC` that + // CHECK:STDERR: · ┃ does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: Cpp.EC = a ^ b; - // CHECK:STDERR: fail_enum_class_bitwise_operators.carbon:[[@LINE+2]]:19-20: error: cannot access member of interface `Core.BitComplement` in type `Cpp.EC` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_enum_class_bitwise_operators.carbon:[[@LINE+9]]:19 + // CHECK:STDERR: -> │ let _: Cpp.EC = ^a; + // CHECK:STDERR: · ┳━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.BitComplement` in type `Cpp.EC` that does + // CHECK:STDERR: · ┃ not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: Cpp.EC = ^a; } @@ -137,105 +165,334 @@ struct ConvertibleToFloat { fn TestInteger(a: Cpp.ConvertibleToInt, b: Cpp.ConvertibleToInt) { // Test arithmetic. - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.AddWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:16 + // CHECK:STDERR: -> │ let _: i32 = a + b; + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.AddWith(Cpp.ConvertibleToInt)` in type + // CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that + // CHECK:STDERR: · ┃ interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: i32 = a + b; - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.SubWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:16 + // CHECK:STDERR: -> │ let _: i32 = a - b; + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.SubWith(Cpp.ConvertibleToInt)` in type + // CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that + // CHECK:STDERR: · ┃ interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: i32 = a - b; - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.MulWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:16 + // CHECK:STDERR: -> │ let _: i32 = a * b; + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.MulWith(Cpp.ConvertibleToInt)` in type + // CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that + // CHECK:STDERR: · ┃ interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: i32 = a * b; - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.DivWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:16 + // CHECK:STDERR: -> │ let _: i32 = a / b; + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.DivWith(Cpp.ConvertibleToInt)` in type + // CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that + // CHECK:STDERR: · ┃ interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: i32 = a / b; - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.ModWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:16 + // CHECK:STDERR: -> │ let _: i32 = a % b; + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.ModWith(Cpp.ConvertibleToInt)` in type + // CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that + // CHECK:STDERR: · ┃ interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: i32 = a % b; // Test bitwise. - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.BitAndWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:16 + // CHECK:STDERR: -> │ let _: i32 = a & b; + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.BitAndWith(Cpp.ConvertibleToInt)` in type + // CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that + // CHECK:STDERR: · ┃ interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: i32 = a & b; - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.BitOrWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:16 + // CHECK:STDERR: -> │ let _: i32 = a | b; + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.BitOrWith(Cpp.ConvertibleToInt)` in type + // CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that + // CHECK:STDERR: · ┃ interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: i32 = a | b; - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.BitXorWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:16 + // CHECK:STDERR: -> │ let _: i32 = a ^ b; + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.BitXorWith(Cpp.ConvertibleToInt)` in type + // CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that + // CHECK:STDERR: · ┃ interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: i32 = a ^ b; - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-21: error: cannot access member of interface `Core.LeftShiftWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:16 + // CHECK:STDERR: -> │ let _: i32 = a << b; + // CHECK:STDERR: · ┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.LeftShiftWith(Cpp.ConvertibleToInt)` in type + // CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that + // CHECK:STDERR: · ┃ interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: i32 = a << b; - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-21: error: cannot access member of interface `Core.RightShiftWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:16 + // CHECK:STDERR: -> │ let _: i32 = a >> b; + // CHECK:STDERR: · ┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.RightShiftWith(Cpp.ConvertibleToInt)` in type + // CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that + // CHECK:STDERR: · ┃ interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: i32 = a >> b; // Test comparison. - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-23: error: cannot access member of interface `Core.EqWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:18 + // CHECK:STDERR: -> │ let _: bool = (a == b); + // CHECK:STDERR: · ┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.EqWith(Cpp.ConvertibleToInt)` in type + // CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that + // CHECK:STDERR: · ┃ interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: bool = (a == b); - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-23: error: cannot access member of interface `Core.EqWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:18 + // CHECK:STDERR: -> │ let _: bool = (a != b); + // CHECK:STDERR: · ┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.EqWith(Cpp.ConvertibleToInt)` in type + // CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that + // CHECK:STDERR: · ┃ interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: bool = (a != b); - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.OrderedWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:18 + // CHECK:STDERR: -> │ let _: bool = (a < b); + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.OrderedWith(Cpp.ConvertibleToInt)` in type + // CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that + // CHECK:STDERR: · ┃ interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: bool = (a < b); - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-23: error: cannot access member of interface `Core.OrderedWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:18 + // CHECK:STDERR: -> │ let _: bool = (a <= b); + // CHECK:STDERR: · ┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.OrderedWith(Cpp.ConvertibleToInt)` in type + // CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that + // CHECK:STDERR: · ┃ interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: bool = (a <= b); - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.OrderedWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:18 + // CHECK:STDERR: -> │ let _: bool = (a > b); + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.OrderedWith(Cpp.ConvertibleToInt)` in type + // CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that + // CHECK:STDERR: · ┃ interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: bool = (a > b); - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-23: error: cannot access member of interface `Core.OrderedWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:18 + // CHECK:STDERR: -> │ let _: bool = (a >= b); + // CHECK:STDERR: · ┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.OrderedWith(Cpp.ConvertibleToInt)` in type + // CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that + // CHECK:STDERR: · ┃ interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: bool = (a >= b); // Test unary. - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-17: error: cannot access member of interface `Core.Negate` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+9]]:16 + // CHECK:STDERR: -> │ let _: i32 = -a; + // CHECK:STDERR: · ┳━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.Negate` in + // CHECK:STDERR: · ┃ type `Cpp.ConvertibleToInt` that does not implement + // CHECK:STDERR: · ┃ that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: i32 = -a; - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-17: error: cannot access member of interface `Core.BitComplement` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+9]]:16 + // CHECK:STDERR: -> │ let _: i32 = ^a; + // CHECK:STDERR: · ┳━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.BitComplement` in type `Cpp.ConvertibleToInt` + // CHECK:STDERR: · ┃ that does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: i32 = ^a; } fn TestFloat(a: Cpp.ConvertibleToFloat, b: Cpp.ConvertibleToFloat) { // Test arithmetic. - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.AddWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:16 + // CHECK:STDERR: -> │ let _: f32 = a + b; + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.AddWith(Cpp.ConvertibleToFloat)` in type + // CHECK:STDERR: · ┃ `Cpp.ConvertibleToFloat` that does not implement that + // CHECK:STDERR: · ┃ interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: f32 = a + b; - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.SubWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:16 + // CHECK:STDERR: -> │ let _: f32 = a - b; + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.SubWith(Cpp.ConvertibleToFloat)` in type + // CHECK:STDERR: · ┃ `Cpp.ConvertibleToFloat` that does not implement that + // CHECK:STDERR: · ┃ interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: f32 = a - b; - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.MulWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:16 + // CHECK:STDERR: -> │ let _: f32 = a * b; + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.MulWith(Cpp.ConvertibleToFloat)` in type + // CHECK:STDERR: · ┃ `Cpp.ConvertibleToFloat` that does not implement that + // CHECK:STDERR: · ┃ interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: f32 = a * b; - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.DivWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:16 + // CHECK:STDERR: -> │ let _: f32 = a / b; + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.DivWith(Cpp.ConvertibleToFloat)` in type + // CHECK:STDERR: · ┃ `Cpp.ConvertibleToFloat` that does not implement that + // CHECK:STDERR: · ┃ interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: f32 = a / b; // Test comparison. - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-23: error: cannot access member of interface `Core.EqWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:18 + // CHECK:STDERR: -> │ let _: bool = (a == b); + // CHECK:STDERR: · ┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.EqWith(Cpp.ConvertibleToFloat)` in type + // CHECK:STDERR: · ┃ `Cpp.ConvertibleToFloat` that does not implement + // CHECK:STDERR: · ┃ that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: bool = (a == b); - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-23: error: cannot access member of interface `Core.EqWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:18 + // CHECK:STDERR: -> │ let _: bool = (a != b); + // CHECK:STDERR: · ┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.EqWith(Cpp.ConvertibleToFloat)` in type + // CHECK:STDERR: · ┃ `Cpp.ConvertibleToFloat` that does not implement + // CHECK:STDERR: · ┃ that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: bool = (a != b); - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.OrderedWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:18 + // CHECK:STDERR: -> │ let _: bool = (a < b); + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.OrderedWith(Cpp.ConvertibleToFloat)` in type + // CHECK:STDERR: · ┃ `Cpp.ConvertibleToFloat` that does not implement + // CHECK:STDERR: · ┃ that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: bool = (a < b); - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-23: error: cannot access member of interface `Core.OrderedWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:18 + // CHECK:STDERR: -> │ let _: bool = (a <= b); + // CHECK:STDERR: · ┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.OrderedWith(Cpp.ConvertibleToFloat)` in type + // CHECK:STDERR: · ┃ `Cpp.ConvertibleToFloat` that does not implement + // CHECK:STDERR: · ┃ that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: bool = (a <= b); - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.OrderedWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:18 + // CHECK:STDERR: -> │ let _: bool = (a > b); + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.OrderedWith(Cpp.ConvertibleToFloat)` in type + // CHECK:STDERR: · ┃ `Cpp.ConvertibleToFloat` that does not implement + // CHECK:STDERR: · ┃ that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: bool = (a > b); - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-23: error: cannot access member of interface `Core.OrderedWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:18 + // CHECK:STDERR: -> │ let _: bool = (a >= b); + // CHECK:STDERR: · ┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.OrderedWith(Cpp.ConvertibleToFloat)` in type + // CHECK:STDERR: · ┃ `Cpp.ConvertibleToFloat` that does not implement + // CHECK:STDERR: · ┃ that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: bool = (a >= b); // Test unary. - // CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-17: error: cannot access member of interface `Core.Negate` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+9]]:16 + // CHECK:STDERR: -> │ let _: f32 = -a; + // CHECK:STDERR: · ┳━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.Negate` in + // CHECK:STDERR: · ┃ type `Cpp.ConvertibleToFloat` that does not implement + // CHECK:STDERR: · ┃ that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: f32 = -a; } diff --git a/toolchain/check/testdata/interop/cpp/operators/deref.carbon b/toolchain/check/testdata/interop/cpp/operators/deref.carbon index cda39133a7c0..f3cd6be0a02f 100644 --- a/toolchain/check/testdata/interop/cpp/operators/deref.carbon +++ b/toolchain/check/testdata/interop/cpp/operators/deref.carbon @@ -62,7 +62,13 @@ public: '''; fn TestDerefPass(var int_ptr: Cpp.MultiDeref) -> ref i32 { - // CHECK:STDERR: fail_todo_multi_deref.carbon:[[@LINE+2]]:10-41: error: semantics TODO: `operator* overload sets not implemented yet` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_multi_deref.carbon:[[@LINE+8]]:10 + // CHECK:STDERR: -> │ return int_ptr.(Core.CppUnsafeDeref.Op)(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: + // CHECK:STDERR: · ┃ `operator* overload sets not implemented yet` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return int_ptr.(Core.CppUnsafeDeref.Op)(); } @@ -89,7 +95,13 @@ public: '''; fn TestDerefPass(var int_ptr: Cpp.MaybeDeref(i32)) -> ref i32 { - // CHECK:STDERR: fail_todo_maybe_deref.carbon:[[@LINE+2]]:10-41: error: semantics TODO: `operator* overload sets not implemented yet` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_maybe_deref.carbon:[[@LINE+8]]:10 + // CHECK:STDERR: -> │ return int_ptr.(Core.CppUnsafeDeref.Op)(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: + // CHECK:STDERR: · ┃ `operator* overload sets not implemented yet` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return int_ptr.(Core.CppUnsafeDeref.Op)(); } @@ -103,7 +115,13 @@ class NotAPtr {}; '''; fn TestDerefFail(not_ptr: Cpp.NotAPtr) { - // CHECK:STDERR: fail_not_a_ptr.carbon:[[@LINE+2]]:3-34: error: cannot access member of interface `Core.CppUnsafeDeref` in type `Cpp.NotAPtr` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_not_a_ptr.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ not_ptr.(Core.CppUnsafeDeref.Op)(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.CppUnsafeDeref` in type + // CHECK:STDERR: · ┃ `Cpp.NotAPtr` that does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: not_ptr.(Core.CppUnsafeDeref.Op)(); } diff --git a/toolchain/check/testdata/interop/cpp/operators/eq_with.carbon b/toolchain/check/testdata/interop/cpp/operators/eq_with.carbon index efd5a2d74fe6..d3307c7f0288 100644 --- a/toolchain/check/testdata/interop/cpp/operators/eq_with.carbon +++ b/toolchain/check/testdata/interop/cpp/operators/eq_with.carbon @@ -93,13 +93,52 @@ library "[[@TEST_NAME]]"; import Cpp inline '''c++ struct NeqBoolish { auto operator==(NeqBoolish) const -> bool; - // CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+3]]:8: error: cannot implicitly convert expression of type `i32` to `bool` [ConversionFailure] - // CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+2]]:8: note: type `i32` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:14:3-51: note: while building thunk to match the signature of this function [ThunkSignature] + // CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+20]]:8 + // CHECK:STDERR: -> │ auto operator!=(NeqBoolish) const -> int; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `i32` to `bool` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `i32` does not implement interface `Core.ImplicitAs(bool)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) { + // CHECK:STDERR: · ─────────────────────────┬───────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ {{.*}}/prelude/operators/comparison.carbon + // CHECK:STDERR: │ default fn NotEqual(self, other: Other) -> bool { + // CHECK:STDERR: · ─────────────┬─────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: auto operator!=(NeqBoolish) const -> int; }; struct EqBoolish { + // CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+22]]:8 + // CHECK:STDERR: -> │ auto operator==(EqBoolish) const -> int*; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type + // CHECK:STDERR: · │ ┃ `Core.Optional(i32* as Core.OptionalStorage)` to `bool` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Core.Optional(i32* as Core.OptionalStorage)` does not + // CHECK:STDERR: · │ implement interface `Core.ImplicitAs(bool)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) { + // CHECK:STDERR: · ─────────────────────────┬───────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ {{.*}}/prelude/operators/comparison.carbon + // CHECK:STDERR: │ fn Equal(self, other: Other) -> bool; + // CHECK:STDERR: · ─────────────┬─────────────────────── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: auto operator==(EqBoolish) const -> int*; auto operator!=(EqBoolish) const -> bool; }; @@ -109,28 +148,55 @@ struct BothBoolish { False, True, }; + // CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+22]]:8 + // CHECK:STDERR: -> │ auto operator==(BothBoolish) const -> Result; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `Cpp.Result` to + // CHECK:STDERR: · │ ┃ `bool` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Cpp.Result` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(bool)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) { + // CHECK:STDERR: · ─────────────────────────┬───────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ {{.*}}/prelude/operators/comparison.carbon + // CHECK:STDERR: │ fn Equal(self, other: Other) -> bool; + // CHECK:STDERR: · ─────────────┬─────────────────────── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: auto operator==(BothBoolish) const -> Result; + // CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+22]]:8 + // CHECK:STDERR: -> │ auto operator!=(BothBoolish) const -> Result; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `Cpp.Result` to + // CHECK:STDERR: · │ ┃ `bool` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Cpp.Result` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(bool)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) { + // CHECK:STDERR: · ─────────────────────────┬───────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ {{.*}}/prelude/operators/comparison.carbon + // CHECK:STDERR: │ default fn NotEqual(self, other: Other) -> bool { + // CHECK:STDERR: · ─────────────┬─────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: auto operator!=(BothBoolish) const -> Result; }; '''; -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+17]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere] -// CHECK:STDERR: -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-16]]:8: error: cannot implicitly convert expression of type `Core.Optional(i32* as Core.OptionalStorage)` to `bool` [ConversionFailure] -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-17]]:8: note: type `Core.Optional(i32* as Core.OptionalStorage)` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:13:3-39: note: while building thunk to match the signature of this function [ThunkSignature] -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+12]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere] -// CHECK:STDERR: -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-12]]:8: error: cannot implicitly convert expression of type `Cpp.Result` to `bool` [ConversionFailure] -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-13]]:8: note: type `Cpp.Result` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:13:3-39: note: while building thunk to match the signature of this function [ThunkSignature] -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+7]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere] -// CHECK:STDERR: -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-16]]:8: error: cannot implicitly convert expression of type `Cpp.Result` to `bool` [ConversionFailure] -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-17]]:8: note: type `Cpp.Result` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:14:3-51: note: while building thunk to match the signature of this function [ThunkSignature] -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+2]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere] -// CHECK:STDERR: fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) { x == y; x != y; @@ -168,19 +234,45 @@ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) { } fn Test(default_eq_only: Cpp.DefaultEqOnly, - // CHECK:STDERR: fail_todo_comparison_rewrites.carbon:[[@LINE+2]]:33-56: error: member name `DefaultSpaceshipOnly` not found in `Cpp` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╭─┤ fail_todo_comparison_rewrites.carbon:[[@LINE+8]]:33 + // CHECK:STDERR: -> │ default_spaceship_only: Cpp.DefaultSpaceshipOnly, + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: member name `DefaultSpaceshipOnly` + // CHECK:STDERR: · ┃ not found in `Cpp` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: default_spaceship_only: Cpp.DefaultSpaceshipOnly, only_eq_declared: Cpp.OnlyEqDeclared) { - // CHECK:STDERR: fail_todo_comparison_rewrites.carbon:[[@LINE+3]]:3-42: error: semantics TODO: `Rewriting operator!= using operator== is not supported` [SemanticsTodo] - // CHECK:STDERR: fail_todo_comparison_rewrites.carbon:[[@LINE-11]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_todo_comparison_rewrites.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) { + // CHECK:STDERR: · ─────────────────────────┬───────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ EqWith(default_eq_only, default_eq_only); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: + // CHECK:STDERR: · ┃ `Rewriting operator!= using operator== is not supported` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: EqWith(default_eq_only, default_eq_only); EqWith(default_spaceship_only, default_spaceship_only); - // CHECK:STDERR: fail_todo_comparison_rewrites.carbon:[[@LINE+3]]:3-44: error: semantics TODO: `Rewriting operator!= using operator== is not supported` [SemanticsTodo] - // CHECK:STDERR: fail_todo_comparison_rewrites.carbon:[[@LINE-18]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_todo_comparison_rewrites.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) { + // CHECK:STDERR: · ─────────────────────────┬───────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ EqWith(only_eq_declared, only_eq_declared); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: + // CHECK:STDERR: · ┃ `Rewriting operator!= using operator== is not supported` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: EqWith(only_eq_declared, only_eq_declared); } @@ -235,46 +327,133 @@ fn Test(only_neq: Cpp.OnlyNeq, deleted_neq: Cpp.DeletedNeq, non_const_eq: Cpp.NonConstEq, a2: Cpp.A2, b2: Cpp.B2) { - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-28: error: cannot convert type `Cpp.OnlyNeq` into type implementing `Core.EqWith(Cpp.OnlyNeq)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-13]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) { + // CHECK:STDERR: · ─────────────────────────┬───────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ EqWith(only_neq, only_neq); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.OnlyNeq` into type implementing + // CHECK:STDERR: · ┃ `Core.EqWith(Cpp.OnlyNeq)` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: EqWith(only_neq, only_neq); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+4]]:10-35: error: name `only_non_default_spaceship` not found [NameNotFound] + // CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+16]]:10 + // CHECK:STDERR: -> │ EqWith(only_non_default_spaceship, only_non_default_spaceship); + // CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: name `only_non_default_spaceship` not found + // CHECK:STDERR: · ┃ [NameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+2]]:38-63: error: name `only_non_default_spaceship` not found [NameNotFound] + // CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+9]]:38 + // CHECK:STDERR: -> │ EqWith(only_non_default_spaceship, only_non_default_spaceship); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: name + // CHECK:STDERR: · ┃ `only_non_default_spaceship` + // CHECK:STDERR: · ┃ not found + // CHECK:STDERR: · ┃ [NameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: EqWith(only_non_default_spaceship, only_non_default_spaceship); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-50: error: cannot convert type `Cpp.NoRelevantMembers` into type implementing `Core.EqWith(Cpp.NoRelevantMembers)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-24]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) { + // CHECK:STDERR: · ─────────────────────────┬───────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ EqWith(no_relevant_members, no_relevant_members); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.NoRelevantMembers` into type implementing + // CHECK:STDERR: · ┃ `Core.EqWith(Cpp.NoRelevantMembers)` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: EqWith(no_relevant_members, no_relevant_members); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-42: error: cannot convert type `Cpp.EqReturnsVoid` into type implementing `Core.EqWith(Cpp.EqReturnsVoid)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-29]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) { + // CHECK:STDERR: · ─────────────────────────┬───────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ EqWith(eq_returns_void, eq_returns_void); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.EqReturnsVoid` into type implementing + // CHECK:STDERR: · ┃ `Core.EqWith(Cpp.EqReturnsVoid)` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: EqWith(eq_returns_void, eq_returns_void); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-44: error: cannot convert type `Cpp.NeqReturnsVoid` into type implementing `Core.EqWith(Cpp.NeqReturnsVoid)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-34]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) { + // CHECK:STDERR: · ─────────────────────────┬───────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ EqWith(neq_returns_void, neq_returns_void); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.NeqReturnsVoid` into type implementing + // CHECK:STDERR: · ┃ `Core.EqWith(Cpp.NeqReturnsVoid)` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: EqWith(neq_returns_void, neq_returns_void); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+5]]:34: error: overload resolution selected deleted operator '!=' [CppInteropParseError] - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-55]]:8: note: candidate function [CppInteropParseNote] - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-55]]:8: note: candidate function has been explicitly deleted [CppInteropParseNote] - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-41]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+20]]:34 + // CHECK:STDERR: │ auto operator==(DeletedNeq) const -> bool; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ candidate function [CppInteropParseNote] + // CHECK:STDERR: │ auto operator!=(DeletedNeq) const -> bool = delete; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ candidate function has been explicitly deleted [CppInteropParseNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) { + // CHECK:STDERR: · ─────────────────────────┬───────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ EqWith(deleted_neq, deleted_neq); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: overload resolution selected + // CHECK:STDERR: · ┃ deleted operator '!=' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: EqWith(deleted_neq, deleted_neq); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-36: error: semantics TODO: `Rewriting operator!= using operator== is not supported` [SemanticsTodo] - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-46]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) { + // CHECK:STDERR: · ─────────────────────────┬───────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ EqWith(non_const_eq, non_const_eq); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: + // CHECK:STDERR: · ┃ `Rewriting operator!= using operator== is not supported` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: EqWith(non_const_eq, non_const_eq); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-16: error: cannot convert type `Cpp.A2` into type implementing `Core.EqWith(Cpp.B2)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-51]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) { + // CHECK:STDERR: · ─────────────────────────┬───────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ EqWith(a2, b2); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.A2` into type implementing + // CHECK:STDERR: · ┃ `Core.EqWith(Cpp.B2)` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: EqWith(a2, b2); } diff --git a/toolchain/check/testdata/interop/cpp/operators/operators.carbon b/toolchain/check/testdata/interop/cpp/operators/operators.carbon index 9d4e5807736d..8cde962355a5 100644 --- a/toolchain/check/testdata/interop/cpp/operators/operators.carbon +++ b/toolchain/check/testdata/interop/cpp/operators/operators.carbon @@ -69,12 +69,25 @@ import Cpp library "prefix_inc_and_dec.h"; fn F() { var prefix: Cpp.Prefix = Cpp.Prefix.Prefix(); - // CHECK:STDERR: fail_prefix_calling_postfix.carbon:[[@LINE+4]]:9: error: expected `;` after expression statement [ExpectedExprSemi] + // CHECK:STDERR: ╭─┤ fail_prefix_calling_postfix.carbon:[[@LINE+13]]:9 + // CHECK:STDERR: -> │ prefix++; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `;` after expression statement [ExpectedExprSemi] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_prefix_calling_postfix.carbon:[[@LINE+2]]:3-11: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_prefix_calling_postfix.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ prefix++; + // CHECK:STDERR: · ━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `handle invalid parse trees in `check`` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: prefix++; - // CHECK:STDERR: fail_prefix_calling_postfix.carbon:[[@LINE+2]]:9: error: expected `;` after expression statement [ExpectedExprSemi] + // CHECK:STDERR: ╭─┤ fail_prefix_calling_postfix.carbon:[[@LINE+6]]:9 + // CHECK:STDERR: -> │ prefix--; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `;` after expression statement [ExpectedExprSemi] + // CHECK:STDERR: ╰──── // CHECK:STDERR: prefix--; } @@ -93,10 +106,22 @@ import Cpp library "postfix_inc_and_dec.h"; fn F() { var postfix: Cpp.Postfix = Cpp.Postfix.Postfix(); - // CHECK:STDERR: fail_postfix_calling_prefix.carbon:[[@LINE+2]]:3-11: error: cannot access member of interface `Core.Inc` in type `Cpp.Postfix` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_postfix_calling_prefix.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ ++postfix; + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.Inc` in type `Cpp.Postfix` + // CHECK:STDERR: · ┃ that does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: ++postfix; - // CHECK:STDERR: fail_postfix_calling_prefix.carbon:[[@LINE+2]]:3-11: error: cannot access member of interface `Core.Dec` in type `Cpp.Postfix` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_postfix_calling_prefix.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ --postfix; + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.Dec` in type `Cpp.Postfix` + // CHECK:STDERR: · ┃ that does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: --postfix; } @@ -211,8 +236,16 @@ fn F() { var c: Cpp.BinaryC = {}; // Simple assignment. - // CHECK:STDERR: fail_todo_import_assignment.carbon:[[@LINE+3]]:3-8: error: cannot implicitly convert expression of type `Core.IntLiteral` to `Cpp.BinaryC` [ConversionFailure] - // CHECK:STDERR: fail_todo_import_assignment.carbon:[[@LINE+2]]:3-8: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(Cpp.BinaryC)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_todo_import_assignment.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: -> │ c = 42; + // CHECK:STDERR: · ┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `Core.IntLiteral` to + // CHECK:STDERR: · │ ┃ `Cpp.BinaryC` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Core.IntLiteral` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.BinaryC)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: c = 42; } @@ -242,10 +275,26 @@ import Cpp library "binary_operators.h"; fn F() { let c1: Cpp.BinaryC = Cpp.BinaryC.BinaryC(); // TODO: Include a list of non-viable candidate operators with this diagnostic. - // CHECK:STDERR: fail_call_with_wrong_type.carbon:[[@LINE+2]]:32-37: error: cannot access member of interface `Core.AddWith(Core.IntLiteral)` in type `Cpp.BinaryC` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_call_with_wrong_type.carbon:[[@LINE+10]]:32 + // CHECK:STDERR: -> │ let unused c2: Cpp.BinaryC = c1 + 5; + // CHECK:STDERR: · ┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.AddWith(Core.IntLiteral)` in + // CHECK:STDERR: · ┃ type `Cpp.BinaryC` that does not + // CHECK:STDERR: · ┃ implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused c2: Cpp.BinaryC = c1 + 5; - // CHECK:STDERR: fail_call_with_wrong_type.carbon:[[@LINE+2]]:32-37: error: cannot access member of interface `Core.AddWith(Cpp.BinaryC)` in type `Core.IntLiteral` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_call_with_wrong_type.carbon:[[@LINE+10]]:32 + // CHECK:STDERR: -> │ let unused c3: Cpp.BinaryC = 6 + c1; + // CHECK:STDERR: · ┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.AddWith(Cpp.BinaryC)` in type + // CHECK:STDERR: · ┃ `Core.IntLiteral` that does not + // CHECK:STDERR: · ┃ implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused c3: Cpp.BinaryC = 6 + c1; } @@ -265,9 +314,20 @@ void operator+(AmbiguousC, short); '''; fn Test(c: Cpp.AmbiguousC) { - // CHECK:STDERR: fail_ambiguous.carbon:[[@LINE+4]]:5: error: use of overloaded operator '+' is ambiguous (with operand types 'const AmbiguousC' and 'int') [CppInteropParseError] - // CHECK:STDERR: fail_ambiguous.carbon:[[@LINE-6]]:6: note: candidate function [CppInteropParseNote] - // CHECK:STDERR: fail_ambiguous.carbon:[[@LINE-6]]:6: note: candidate function [CppInteropParseNote] + // CHECK:STDERR: ╭─┤ fail_ambiguous.carbon:[[@LINE+15]]:5 + // CHECK:STDERR: │ void operator+(AmbiguousC, char); + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ candidate function [CppInteropParseNote] + // CHECK:STDERR: │ void operator+(AmbiguousC, short); + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ candidate function [CppInteropParseNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ c + 1; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: use of overloaded operator '+' is ambiguous (with operand types + // CHECK:STDERR: · ┃ 'const AmbiguousC' and 'int') + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: c + 1; } @@ -283,10 +343,23 @@ void operator+(DeletedC, void*) = delete; '''; fn Test(c: Cpp.DeletedC) { - // CHECK:STDERR: fail_deleted.carbon:[[@LINE+5]]:5: error: overload resolution selected deleted operator '+' [CppInteropParseError] - // CHECK:STDERR: fail_deleted.carbon:[[@LINE-6]]:6: note: candidate function has been explicitly deleted [CppInteropParseNote] - // CHECK:STDERR: fail_deleted.carbon:[[@LINE-6]]:6: note: candidate function not viable [CppInteropParseNote] - // CHECK:STDERR: fail_deleted.carbon:[[@LINE-7]]:26-30: note: no known conversion from 'int' to 'void *' for 2nd argument [CppInteropParseNoteReason] + // CHECK:STDERR: ╭─┤ fail_deleted.carbon:[[@LINE+18]]:5 + // CHECK:STDERR: │ void operator+(DeletedC, int) = delete; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ candidate function has been explicitly deleted [CppInteropParseNote] + // CHECK:STDERR: │ void operator+(DeletedC, void*) = delete; + // CHECK:STDERR: · ┬ ┬──── + // CHECK:STDERR: · ╰──────────────────────┤ candidate function not viable + // CHECK:STDERR: · │ │ [CppInteropParseNote] + // CHECK:STDERR: · ╰────┤ no known conversion from 'int' to 'void *' for + // CHECK:STDERR: · │ 2nd argument + // CHECK:STDERR: · │ [CppInteropParseNoteReason] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ c + 1; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: overload resolution selected deleted operator '+' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: c + 1; } @@ -317,12 +390,26 @@ fn F() { let unused greater_than: bool = c1 > c2; // Rewrite. - // CHECK:STDERR: fail_todo_rewrite_spaceship.carbon:[[@LINE+2]]:32-38: error: semantics TODO: `Rewriting operator< using operator<=> is not supported` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_rewrite_spaceship.carbon:[[@LINE+9]]:32 + // CHECK:STDERR: -> │ let unused less_than: bool = c1 < c2; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: semantics TODO: + // CHECK:STDERR: · ┃ `Rewriting operator< using operator<=> is not supported` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused less_than: bool = c1 < c2; // Rewrite. - // CHECK:STDERR: fail_todo_rewrite_spaceship.carbon:[[@LINE+2]]:44-51: error: semantics TODO: `Rewriting operator>= using operator<=> is not supported` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_rewrite_spaceship.carbon:[[@LINE+9]]:44 + // CHECK:STDERR: -> │ let unused greater_than_or_equal: bool = c1 >= c2; + // CHECK:STDERR: · ━━━━┳━━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: semantics TODO: + // CHECK:STDERR: · ┃ `Rewriting operator>= using operator<=> is not supported` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused greater_than_or_equal: bool = c1 >= c2; @@ -346,9 +433,19 @@ auto operator<(CDel lhs, BaseDel rhs) -> bool; fn F(c: Cpp.CDel) -> bool { // Note that we mention `operator '<=>'` in the diagnostic. - // CHECK:STDERR: fail_rewrite_deleted.carbon:[[@LINE+4]]:12: error: overload resolution selected deleted operator '<=>' [CppInteropParseError] - // CHECK:STDERR: fail_rewrite_deleted.carbon:[[@LINE-7]]:6: note: candidate function has been explicitly deleted [CppInteropParseNote] - // CHECK:STDERR: fail_rewrite_deleted.carbon:[[@LINE-7]]:6: note: candidate function [CppInteropParseNote] + // CHECK:STDERR: ╭─┤ fail_rewrite_deleted.carbon:[[@LINE+14]]:12 + // CHECK:STDERR: │ auto operator<=>(CDel lhs, CDel rhs) -> std::strong_ordering = delete; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ candidate function has been explicitly deleted [CppInteropParseNote] + // CHECK:STDERR: │ auto operator<(CDel lhs, BaseDel rhs) -> bool; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ candidate function [CppInteropParseNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ return c < c; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: overload resolution selected deleted operator '<=>' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return c < c; } @@ -376,7 +473,14 @@ fn F() { let unused equal: bool = c1 == c2; // Rewrite. - // CHECK:STDERR: fail_todo_rewrite_equal.carbon:[[@LINE+2]]:32-39: error: semantics TODO: `Rewriting operator!= using operator== is not supported` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_rewrite_equal.carbon:[[@LINE+9]]:32 + // CHECK:STDERR: -> │ let unused not_equal: bool = c1 != c2; + // CHECK:STDERR: · ━━━━┳━━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: semantics TODO: + // CHECK:STDERR: · ┃ `Rewriting operator!= using operator== is not supported` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused not_equal: bool = c1 != c2; //@dump-sem-ir-end @@ -448,7 +552,17 @@ import Cpp library "plus_with_string_view_conversion.h"; fn F() { let s1: str = "hello"; let s2: str = "world"; - // CHECK:STDERR: fail_todo_import_plus_with_string_view_conversion.carbon:[[@LINE+2]]:46-52: error: cannot access member of interface `Core.AddWith(str)` in type `str` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_todo_import_plus_with_string_view_conversion.carbon:[[@LINE+12]]:46 + // CHECK:STDERR: -> │ let unused c: Cpp.StringViewConvertibleC = s1 + s2; + // CHECK:STDERR: · ┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of + // CHECK:STDERR: · ┃ interface + // CHECK:STDERR: · ┃ `Core.AddWith(str)` in + // CHECK:STDERR: · ┃ type `str` that does + // CHECK:STDERR: · ┃ not implement that + // CHECK:STDERR: · ┃ interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused c: Cpp.StringViewConvertibleC = s1 + s2; } @@ -493,31 +607,73 @@ fn F() { var c: Cpp.UnsupportedUnaryC = Cpp.UnsupportedUnaryC.UnsupportedUnaryC(); // Arithmetic. - // CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+6]]:36: error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+22]]:36 + // CHECK:STDERR: -> │ let plus: Cpp.UnsupportedUnaryC = +c; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected expression + // CHECK:STDERR: · ┃ [ExpectedExpr] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+4]]:37: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+15]]:37 + // CHECK:STDERR: -> │ let plus: Cpp.UnsupportedUnaryC = +c; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+2]]:38: error: whitespace missing after binary operator [BinaryOperatorRequiresWhitespace] + // CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+8]]:38 + // CHECK:STDERR: -> │ let plus: Cpp.UnsupportedUnaryC = +c; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: whitespace missing after binary + // CHECK:STDERR: · ┃ operator + // CHECK:STDERR: · ┃ [BinaryOperatorRequiresWhitespace] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let plus: Cpp.UnsupportedUnaryC = +c; // Increment and Decrement. - // CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+2]]:4: error: expected `;` after expression statement [ExpectedExprSemi] + // CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+6]]:4 + // CHECK:STDERR: -> │ c++; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `;` after expression statement [ExpectedExprSemi] + // CHECK:STDERR: ╰──── // CHECK:STDERR: c++; - // CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+2]]:4: error: expected `;` after expression statement [ExpectedExprSemi] + // CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+6]]:4 + // CHECK:STDERR: -> │ c--; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `;` after expression statement [ExpectedExprSemi] + // CHECK:STDERR: ╰──── // CHECK:STDERR: c--; // Bitwise. - // CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+4]]:41: error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+15]]:41 + // CHECK:STDERR: -> │ let not_value: Cpp.UnsupportedUnaryC = ~c; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected expression + // CHECK:STDERR: · ┃ [ExpectedExpr] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+2]]:41: error: `let` declarations must end with a `;` [ExpectedDeclSemi] + // CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+8]]:41 + // CHECK:STDERR: -> │ let not_value: Cpp.UnsupportedUnaryC = ~c; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: `let` declarations must end + // CHECK:STDERR: · ┃ with a `;` + // CHECK:STDERR: · ┃ [ExpectedDeclSemi] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let not_value: Cpp.UnsupportedUnaryC = ~c; // Logical. - // CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+2]]:51: error: `let` declarations must end with a `;` [ExpectedDeclSemi] + // CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+9]]:51 + // CHECK:STDERR: -> │ let not_result: Cpp.UnsupportedUnaryC = operator!(c1); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: `let` declarations + // CHECK:STDERR: · ┃ must end with a + // CHECK:STDERR: · ┃ `;` + // CHECK:STDERR: · ┃ [ExpectedDeclSemi] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let not_result: Cpp.UnsupportedUnaryC = operator!(c1); @@ -552,24 +708,80 @@ fn F() { var c1: Cpp.UnsupportedBinaryC = Cpp.UnsupportedBinaryC.UnsupportedBinaryC(); // Logical. - // CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+8]]:44-51: error: name `operator` not found [NameNotFound] + // CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+34]]:44 + // CHECK:STDERR: -> │ let and_result: Cpp.UnsupportedBinaryC = operator&&(c1, c2); + // CHECK:STDERR: · ┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: name `operator` not found + // CHECK:STDERR: · ┃ [NameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+6]]:52: error: whitespace missing around binary operator [BinaryOperatorRequiresWhitespace] + // CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+27]]:52 + // CHECK:STDERR: -> │ let and_result: Cpp.UnsupportedBinaryC = operator&&(c1, c2); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: whitespace + // CHECK:STDERR: · ┃ missing around + // CHECK:STDERR: · ┃ binary operator + // CHECK:STDERR: · ┃ [BinaryOperatorRequiresWhitespace] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+4]]:59-60: error: name `c2` not found [NameNotFound] + // CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+18]]:59 + // CHECK:STDERR: -> │ let and_result: Cpp.UnsupportedBinaryC = operator&&(c1, c2); + // CHECK:STDERR: · ┳━ + // CHECK:STDERR: · ┗━━┫ error: name `c2` + // CHECK:STDERR: · ┃ not found + // CHECK:STDERR: · ┃ [NameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+2]]:53: error: cannot take the address of non-reference expression [AddrOfNonRef] + // CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+10]]:53 + // CHECK:STDERR: -> │ let and_result: Cpp.UnsupportedBinaryC = operator&&(c1, c2); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot take the + // CHECK:STDERR: · ┃ address of + // CHECK:STDERR: · ┃ non-reference + // CHECK:STDERR: · ┃ expression + // CHECK:STDERR: · ┃ [AddrOfNonRef] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let and_result: Cpp.UnsupportedBinaryC = operator&&(c1, c2); - // CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+10]]:43-50: error: name `operator` not found [NameNotFound] + // CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+40]]:43 + // CHECK:STDERR: -> │ let or_result: Cpp.UnsupportedBinaryC = operator||(c1, c2); + // CHECK:STDERR: · ━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: name `operator` not found + // CHECK:STDERR: · ┃ [NameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+8]]:51: error: whitespace missing around binary operator [BinaryOperatorRequiresWhitespace] + // CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+33]]:51 + // CHECK:STDERR: -> │ let or_result: Cpp.UnsupportedBinaryC = operator||(c1, c2); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: whitespace missing + // CHECK:STDERR: · ┃ around binary + // CHECK:STDERR: · ┃ operator + // CHECK:STDERR: · ┃ [BinaryOperatorRequiresWhitespace] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+6]]:52: error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+24]]:52 + // CHECK:STDERR: -> │ let or_result: Cpp.UnsupportedBinaryC = operator||(c1, c2); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected + // CHECK:STDERR: · ┃ expression + // CHECK:STDERR: · ┃ [ExpectedExpr] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+4]]:52: error: whitespace missing around binary operator [BinaryOperatorRequiresWhitespace] + // CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+16]]:52 + // CHECK:STDERR: -> │ let or_result: Cpp.UnsupportedBinaryC = operator||(c1, c2); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: whitespace + // CHECK:STDERR: · ┃ missing around + // CHECK:STDERR: · ┃ binary operator + // CHECK:STDERR: · ┃ [BinaryOperatorRequiresWhitespace] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+2]]:52: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+7]]:52 + // CHECK:STDERR: -> │ let or_result: Cpp.UnsupportedBinaryC = operator||(c1, c2); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let or_result: Cpp.UnsupportedBinaryC = operator||(c1, c2); } @@ -654,7 +866,15 @@ fn F() { //@dump-sem-ir-begin let c1: Cpp.GlobalOpN.C = Cpp.GlobalOpN.C.C(); let c2: Cpp.GlobalOpN.C = Cpp.GlobalOpN.C.C(); - // CHECK:STDERR: fail_todo_import_operands_in_namespace_operator_in_global.carbon:[[@LINE+2]]:36-42: error: cannot access member of interface `Core.AddWith(Cpp.GlobalOpN.C)` in type `Cpp.GlobalOpN.C` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_todo_import_operands_in_namespace_operator_in_global.carbon:[[@LINE+10]]:36 + // CHECK:STDERR: -> │ let unused c3: Cpp.GlobalOpN.C = c1 + c2; + // CHECK:STDERR: · ┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.AddWith(Cpp.GlobalOpN.C)` + // CHECK:STDERR: · ┃ in type `Cpp.GlobalOpN.C` that + // CHECK:STDERR: · ┃ does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused c3: Cpp.GlobalOpN.C = c1 + c2; //@dump-sem-ir-end @@ -761,7 +981,15 @@ import Cpp library "not_found.h"; fn F() { let c1: Cpp.NoOperators = Cpp.NoOperators.NoOperators(); let c2: Cpp.NoOperators = Cpp.NoOperators.NoOperators(); - // CHECK:STDERR: fail_import_not_found.carbon:[[@LINE+2]]:36-42: error: cannot access member of interface `Core.AddWith(Cpp.NoOperators)` in type `Cpp.NoOperators` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_import_not_found.carbon:[[@LINE+10]]:36 + // CHECK:STDERR: -> │ let unused c3: Cpp.NoOperators = c1 + c2; + // CHECK:STDERR: · ┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.AddWith(Cpp.NoOperators)` + // CHECK:STDERR: · ┃ in type `Cpp.NoOperators` that + // CHECK:STDERR: · ┃ does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused c3: Cpp.NoOperators = c1 + c2; } @@ -784,9 +1012,20 @@ library "[[@TEST_NAME]]"; import Cpp library "incomplete.h"; fn F() { - // CHECK:STDERR: fail_import_incomplete_unary.carbon:[[@LINE+4]]:34-57: error: looking up a C++ operator with incomplete operand type `Cpp.Incomplete` [IncompleteOperandTypeInCppOperatorLookup] - // CHECK:STDERR: included from: fail_import_incomplete_unary.carbon:[[@LINE-4]]:10 [InCppInclude] - // CHECK:STDERR: ./incomplete.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ╭─┤ fail_import_incomplete_unary.carbon:[[@LINE+15]]:34 + // CHECK:STDERR: -> │ let unused result_unary: i32 = -*Cpp.CreateIncomplete(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: looking up a C++ operator with + // CHECK:STDERR: · ┃ incomplete operand type + // CHECK:STDERR: · ┃ `Cpp.Incomplete` + // CHECK:STDERR: · ┃ [IncompleteOperandTypeInCppOperatorLookup] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ ╭── included from: fail_import_incomplete_unary.carbon [InCppInclude] + // CHECK:STDERR: ├─┤ ./incomplete.h + // CHECK:STDERR: │ class Incomplete; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused result_unary: i32 = -*Cpp.CreateIncomplete(); } @@ -799,9 +1038,20 @@ import Cpp library "incomplete.h"; fn F() { var complete: Cpp.Complete = Cpp.Complete.Complete(); - // CHECK:STDERR: fail_import_incomplete_binary.carbon:[[@LINE+4]]:35-68: error: looking up a C++ operator with incomplete operand type `Cpp.Incomplete` [IncompleteOperandTypeInCppOperatorLookup] - // CHECK:STDERR: included from: fail_import_incomplete_binary.carbon:[[@LINE-5]]:10 [InCppInclude] - // CHECK:STDERR: ./incomplete.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ╭─┤ fail_import_incomplete_binary.carbon:[[@LINE+15]]:35 + // CHECK:STDERR: -> │ let unused result_binary: i32 = complete + *Cpp.CreateIncomplete(); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: looking up a C++ operator with + // CHECK:STDERR: · ┃ incomplete operand type + // CHECK:STDERR: · ┃ `Cpp.Incomplete` + // CHECK:STDERR: · ┃ [IncompleteOperandTypeInCppOperatorLookup] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ ╭── included from: fail_import_incomplete_binary.carbon [InCppInclude] + // CHECK:STDERR: ├─┤ ./incomplete.h + // CHECK:STDERR: │ class Incomplete; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused result_binary: i32 = complete + *Cpp.CreateIncomplete(); } @@ -825,8 +1075,17 @@ fn CreateIncomplete() -> Incomplete*; fn F() { var complete: Cpp.CompleteCpp = Cpp.CompleteCpp.CompleteCpp(); - // CHECK:STDERR: fail_incomplete_operand_carbon_type.carbon:[[@LINE+3]]:28-57: error: looking up a C++ operator with incomplete operand type `Incomplete` [IncompleteOperandTypeInCppOperatorLookup] - // CHECK:STDERR: fail_incomplete_operand_carbon_type.carbon:[[@LINE-6]]:1-17: note: class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ╭─┤ fail_incomplete_operand_carbon_type.carbon:[[@LINE+12]]:28 + // CHECK:STDERR: │ class Incomplete; + // CHECK:STDERR: · ────────┬──────── + // CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ let unused result: i32 = *CreateIncomplete() + complete; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: looking up a C++ operator with incomplete + // CHECK:STDERR: · ┃ operand type `Incomplete` + // CHECK:STDERR: · ┃ [IncompleteOperandTypeInCppOperatorLookup] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused result: i32 = *CreateIncomplete() + complete; } @@ -860,7 +1119,20 @@ library "[[@TEST_NAME]]"; import Cpp inline ''' template struct FailTemplateB {}; template struct FailTemplateA { - // CHECK:STDERR: fail_indirect_template_instantiation_error.carbon:[[@LINE+1]]:19: error: type 'int' cannot be used prior to '::' because it has no members [CppInteropParseError] + // CHECK:STDERR: ╭─┤ fail_indirect_template_instantiation_error.carbon:[[@LINE+14]]:19 + // CHECK:STDERR: -> │ friend typename T::error operator+(FailTemplateB, FailTem... + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: type 'int' cannot be used prior to '::' because it + // CHECK:STDERR: · ┃ has no members + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ return x + x; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ in instantiation of template class 'FailTemplateA' + // CHECK:STDERR: · │ requested here + // CHECK:STDERR: · │ [CppInteropParseNote] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: friend typename T::error operator+(FailTemplateB, FailTemplateB); }; @@ -868,9 +1140,14 @@ using FailTemplateX = FailTemplateB>; '''; fn F(x: Cpp.FailTemplateX) -> i32 { - // CHECK:STDERR: fail_indirect_template_instantiation_error.carbon:[[@LINE+4]]:12: note: in instantiation of template class 'FailTemplateA' requested here [CppInteropParseNote] - // CHECK:STDERR: - // CHECK:STDERR: fail_indirect_template_instantiation_error.carbon:[[@LINE+2]]:10-14: error: cannot access member of interface `Core.AddWith(Cpp.FailTemplateB)` in type `Cpp.FailTemplateB` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_indirect_template_instantiation_error.carbon:[[@LINE+9]]:10 + // CHECK:STDERR: -> │ return x + x; + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.AddWith(Cpp.FailTemplateB)` in type + // CHECK:STDERR: · ┃ `Cpp.FailTemplateB` that does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return x + x; } @@ -2152,7 +2429,7 @@ fn F() { // CHECK:STDOUT: %T.09f: %SubobjectDestroy.type = symbolic_binding T, 0 [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.type.dea: type = fn_type @T.as_type.as.DestroyImpl.impl.Op, @T.as_type.as.DestroyImpl.impl(%T.09f) [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.6e5: %T.as_type.as.DestroyImpl.impl.Op.type.dea = struct_value () [symbolic] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.687: type = fn_type @SubobjectDestroy.WithSelf.Op.loc32 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.687: type = fn_type @SubobjectDestroy.WithSelf.Op.loc46 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f: %SubobjectDestroy.WithSelf.Op.type.687 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f), @SubobjectDestroy [concrete] // CHECK:STDOUT: %SubobjectDestroy.facet.a87: %SubobjectDestroy.type = facet_value bool, (%custom_witness.b80) [concrete] @@ -2249,45 +2526,45 @@ fn F() { // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %greater_than.patt: %pattern_type.831 = value_binding_pattern greater_than [concrete = constants.%greater_than.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %c1.ref.loc24: ref %C = name_ref c1, %c1 -// CHECK:STDOUT: %c2.ref.loc24: ref %C = name_ref c2, %c2 -// CHECK:STDOUT: %.loc24: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %c1.ref.loc31: ref %C = name_ref c1, %c1 +// CHECK:STDOUT: %c2.ref.loc31: ref %C = name_ref c2, %c2 +// CHECK:STDOUT: %.loc31: type = type_literal bool [concrete = bool] // CHECK:STDOUT: %less_than: bool = wrapper_binding less_than, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %less_than.patt: %pattern_type.831 = value_binding_pattern less_than [concrete = constants.%less_than.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %c1.ref.loc29: ref %C = name_ref c1, %c1 -// CHECK:STDOUT: %c2.ref.loc29: ref %C = name_ref c2, %c2 -// CHECK:STDOUT: %.loc29: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %c1.ref.loc43: ref %C = name_ref c1, %c1 +// CHECK:STDOUT: %c2.ref.loc43: ref %C = name_ref c2, %c2 +// CHECK:STDOUT: %.loc43: type = type_literal bool [concrete = bool] // CHECK:STDOUT: %greater_than_or_equal: bool = wrapper_binding greater_than_or_equal, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %greater_than_or_equal.patt: %pattern_type.831 = value_binding_pattern greater_than_or_equal [concrete = constants.%greater_than_or_equal.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %c1.ref.loc32: ref %C = name_ref c1, %c1 -// CHECK:STDOUT: %c2.ref.loc32: ref %C = name_ref c2, %c2 -// CHECK:STDOUT: %.loc32_41.1: %C = acquire_value %c1.ref.loc32 -// CHECK:STDOUT: %.loc32_47.1: %C = acquire_value %c2.ref.loc32 -// CHECK:STDOUT: %.loc32_41.2: ref %C = value_as_ref %.loc32_41.1 -// CHECK:STDOUT: %addr.loc32_44.1: %ptr.0a2 = addr_of %.loc32_41.2 -// CHECK:STDOUT: %.loc32_47.2: ref %C = value_as_ref %.loc32_47.1 -// CHECK:STDOUT: %addr.loc32_44.2: %ptr.0a2 = addr_of %.loc32_47.2 -// CHECK:STDOUT: %.loc32_44.1: ref bool = temporary_storage -// CHECK:STDOUT: %addr.loc32_44.3: %ptr.bb2 = addr_of %.loc32_44.1 -// CHECK:STDOUT: %operator_LessEqual__carbon_thunk.call: init %empty_tuple.type = call imports.%operator_LessEqual__carbon_thunk.decl(%addr.loc32_44.1, %addr.loc32_44.2, %addr.loc32_44.3) -// CHECK:STDOUT: %.loc32_44.2: init bool to %.loc32_44.1 = mark_in_place_init %operator_LessEqual__carbon_thunk.call -// CHECK:STDOUT: %.loc32_44.3: ref bool = temporary %.loc32_44.1, %.loc32_44.2 -// CHECK:STDOUT: %.loc32_44.4: bool = acquire_value %.loc32_44.3 -// CHECK:STDOUT: %.loc32_34: type = type_literal bool [concrete = bool] -// CHECK:STDOUT: %less_than_or_equal: bool = wrapper_binding less_than_or_equal, %.loc32_44.4 +// CHECK:STDOUT: %c1.ref.loc46: ref %C = name_ref c1, %c1 +// CHECK:STDOUT: %c2.ref.loc46: ref %C = name_ref c2, %c2 +// CHECK:STDOUT: %.loc46_41.1: %C = acquire_value %c1.ref.loc46 +// CHECK:STDOUT: %.loc46_47.1: %C = acquire_value %c2.ref.loc46 +// CHECK:STDOUT: %.loc46_41.2: ref %C = value_as_ref %.loc46_41.1 +// CHECK:STDOUT: %addr.loc46_44.1: %ptr.0a2 = addr_of %.loc46_41.2 +// CHECK:STDOUT: %.loc46_47.2: ref %C = value_as_ref %.loc46_47.1 +// CHECK:STDOUT: %addr.loc46_44.2: %ptr.0a2 = addr_of %.loc46_47.2 +// CHECK:STDOUT: %.loc46_44.1: ref bool = temporary_storage +// CHECK:STDOUT: %addr.loc46_44.3: %ptr.bb2 = addr_of %.loc46_44.1 +// CHECK:STDOUT: %operator_LessEqual__carbon_thunk.call: init %empty_tuple.type = call imports.%operator_LessEqual__carbon_thunk.decl(%addr.loc46_44.1, %addr.loc46_44.2, %addr.loc46_44.3) +// CHECK:STDOUT: %.loc46_44.2: init bool to %.loc46_44.1 = mark_in_place_init %operator_LessEqual__carbon_thunk.call +// CHECK:STDOUT: %.loc46_44.3: ref bool = temporary %.loc46_44.1, %.loc46_44.2 +// CHECK:STDOUT: %.loc46_44.4: bool = acquire_value %.loc46_44.3 +// CHECK:STDOUT: %.loc46_34: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %less_than_or_equal: bool = wrapper_binding less_than_or_equal, %.loc46_44.4 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %less_than_or_equal.patt: %pattern_type.831 = value_binding_pattern less_than_or_equal [concrete = constants.%less_than_or_equal.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.facet.loc32_44.1: %Destroy.type = facet_value bool, (constants.%DestroyImpl.impl_witness.778, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet.e68] -// CHECK:STDOUT: %.loc32_44.5: %Destroy.type = converted bool, %Destroy.facet.loc32_44.1 [concrete = constants.%Destroy.facet.e68] -// CHECK:STDOUT: %Destroy.facet.loc32_44.2: %Destroy.type = facet_value bool, (constants.%DestroyImpl.impl_witness.778, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet.e68] -// CHECK:STDOUT: %.loc32_44.6: %Destroy.type = converted bool, %Destroy.facet.loc32_44.2 [concrete = constants.%Destroy.facet.e68] +// CHECK:STDOUT: %Destroy.facet.loc46_44.1: %Destroy.type = facet_value bool, (constants.%DestroyImpl.impl_witness.778, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet.e68] +// CHECK:STDOUT: %.loc46_44.5: %Destroy.type = converted bool, %Destroy.facet.loc46_44.1 [concrete = constants.%Destroy.facet.e68] +// CHECK:STDOUT: %Destroy.facet.loc46_44.2: %Destroy.type = facet_value bool, (constants.%DestroyImpl.impl_witness.778, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet.e68] +// CHECK:STDOUT: %.loc46_44.6: %Destroy.type = converted bool, %Destroy.facet.loc46_44.2 [concrete = constants.%Destroy.facet.e68] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc32: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%.loc32_44.3) +// CHECK:STDOUT: %SelfDestruct.call.loc46: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%.loc46_44.3) // CHECK:STDOUT: %Destroy.facet.loc19_38.1: %Destroy.type = facet_value bool, (constants.%DestroyImpl.impl_witness.778, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet.e68] // CHECK:STDOUT: %.loc19_38.5: %Destroy.type = converted bool, %Destroy.facet.loc19_38.1 [concrete = constants.%Destroy.facet.e68] // CHECK:STDOUT: %Destroy.facet.loc19_38.2: %Destroy.type = facet_value bool, (constants.%DestroyImpl.impl_witness.778, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet.e68] @@ -2309,7 +2586,7 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc32(%self.param: ref bool) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc46(%self.param: ref bool) = "no_op"; // CHECK:STDOUT: // CHECK:STDOUT: --- fail_todo_rewrite_equal.carbon // CHECK:STDOUT: @@ -2430,9 +2707,9 @@ fn F() { // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %equal.patt: %pattern_type.831 = value_binding_pattern equal [concrete = constants.%equal.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %c1.ref.loc21: ref %EqualC = name_ref c1, %c1 -// CHECK:STDOUT: %c2.ref.loc21: ref %EqualC = name_ref c2, %c2 -// CHECK:STDOUT: %.loc21: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %c1.ref.loc28: ref %EqualC = name_ref c1, %c1 +// CHECK:STDOUT: %c2.ref.loc28: ref %EqualC = name_ref c2, %c2 +// CHECK:STDOUT: %.loc28: type = type_literal bool [concrete = bool] // CHECK:STDOUT: %not_equal: bool = wrapper_binding not_equal, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %not_equal.patt: %pattern_type.831 = value_binding_pattern not_equal [concrete = constants.%not_equal.patt] @@ -2884,10 +3161,10 @@ fn F() { // CHECK:STDOUT: } // CHECK:STDOUT: %c1.ref: %C = name_ref c1, %c1 // CHECK:STDOUT: %c2.ref: %C = name_ref c2, %c2 -// CHECK:STDOUT: %.loc12: type = splice_block %C.ref.loc12 [concrete = constants.%C] { -// CHECK:STDOUT: %Cpp.ref.loc12: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %GlobalOpN.ref.loc12: = name_ref GlobalOpN, imports.%GlobalOpN [concrete = imports.%GlobalOpN] -// CHECK:STDOUT: %C.ref.loc12: type = name_ref C, imports.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %.loc20: type = splice_block %C.ref.loc20 [concrete = constants.%C] { +// CHECK:STDOUT: %Cpp.ref.loc20: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %GlobalOpN.ref.loc20: = name_ref GlobalOpN, imports.%GlobalOpN [concrete = imports.%GlobalOpN] +// CHECK:STDOUT: %C.ref.loc20: type = name_ref C, imports.%C.decl [concrete = constants.%C] // CHECK:STDOUT: } // CHECK:STDOUT: %c3: %C = wrapper_binding c3, [concrete = ] // CHECK:STDOUT: name_binding_decl { diff --git a/toolchain/check/testdata/interop/cpp/operators/ordered_with.carbon b/toolchain/check/testdata/interop/cpp/operators/ordered_with.carbon index a3f1470e2cab..61be3b75fa67 100644 --- a/toolchain/check/testdata/interop/cpp/operators/ordered_with.carbon +++ b/toolchain/check/testdata/interop/cpp/operators/ordered_with.carbon @@ -118,9 +118,26 @@ library "[[@TEST_NAME]]"; import Cpp inline '''c++ struct LessReturnsBoolish { - // CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+3]]:8: error: cannot implicitly convert expression of type `i32` to `bool` [ConversionFailure] - // CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+2]]:8: note: type `i32` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:28:3-38: note: while building thunk to match the signature of this function [ThunkSignature] + // CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+20]]:8 + // CHECK:STDERR: -> │ auto operator<(LessReturnsBoolish) const -> int; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `i32` to `bool` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `i32` does not implement interface `Core.ImplicitAs(bool)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) { + // CHECK:STDERR: · ─────────────────────────┬─────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ {{.*}}/prelude/operators/comparison.carbon + // CHECK:STDERR: │ fn Less(self, other: Other) -> bool; + // CHECK:STDERR: · ─────────────┬────────────────────── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: auto operator<(LessReturnsBoolish) const -> int; auto operator<=(LessReturnsBoolish) const -> bool; auto operator>(LessReturnsBoolish) const -> bool; @@ -129,6 +146,28 @@ struct LessReturnsBoolish { struct LessEqualReturnsBoolish { auto operator<(LessEqualReturnsBoolish) const -> bool; + // CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+22]]:8 + // CHECK:STDERR: -> │ auto operator<=(LessEqualReturnsBoolish) const -> int*; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type + // CHECK:STDERR: · │ ┃ `Core.Optional(i32* as Core.OptionalStorage)` to `bool` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Core.Optional(i32* as Core.OptionalStorage)` does not + // CHECK:STDERR: · │ implement interface `Core.ImplicitAs(bool)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) { + // CHECK:STDERR: · ─────────────────────────┬─────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ {{.*}}/prelude/operators/comparison.carbon + // CHECK:STDERR: │ fn LessOrEquivalent(self, other: Other) -> bool; + // CHECK:STDERR: · ─────────────┬────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: auto operator<=(LessEqualReturnsBoolish) const -> int*; auto operator>(LessEqualReturnsBoolish) const -> bool; auto operator>=(LessEqualReturnsBoolish) const -> bool; @@ -139,6 +178,28 @@ struct GreaterEqualReturnsBoolish { auto operator<(GreaterEqualReturnsBoolish) const -> bool; auto operator<=(GreaterEqualReturnsBoolish) const -> bool; auto operator>(GreaterEqualReturnsBoolish) const -> bool; + // CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+22]]:8 + // CHECK:STDERR: -> │ auto operator>=(GreaterEqualReturnsBoolish) const -> Result; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `Cpp.Result` to + // CHECK:STDERR: · │ ┃ `bool` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Cpp.Result` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(bool)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) { + // CHECK:STDERR: · ─────────────────────────┬─────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ {{.*}}/prelude/operators/comparison.carbon + // CHECK:STDERR: │ fn GreaterOrEquivalent(self, other: Other) -> bool; + // CHECK:STDERR: · ─────────────┬───────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: auto operator>=(GreaterEqualReturnsBoolish) const -> Result; }; @@ -154,45 +215,93 @@ struct GreaterReturnsBoolish { }; struct AllReturnBoolish { + // CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+20]]:8 + // CHECK:STDERR: -> │ auto operator<(AllReturnBoolish) const -> double; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `f64` to `bool` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `f64` does not implement interface `Core.ImplicitAs(bool)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) { + // CHECK:STDERR: · ─────────────────────────┬─────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ {{.*}}/prelude/operators/comparison.carbon + // CHECK:STDERR: │ fn Less(self, other: Other) -> bool; + // CHECK:STDERR: · ─────────────┬────────────────────── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: auto operator<(AllReturnBoolish) const -> double; + // CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+20]]:8 + // CHECK:STDERR: -> │ auto operator<=(AllReturnBoolish) const -> double; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `f64` to `bool` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `f64` does not implement interface `Core.ImplicitAs(bool)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) { + // CHECK:STDERR: · ─────────────────────────┬─────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ {{.*}}/prelude/operators/comparison.carbon + // CHECK:STDERR: │ fn LessOrEquivalent(self, other: Other) -> bool; + // CHECK:STDERR: · ─────────────┬────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: auto operator<=(AllReturnBoolish) const -> double; + // CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+20]]:8 + // CHECK:STDERR: -> │ auto operator>(AllReturnBoolish) const -> double; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `f64` to `bool` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `f64` does not implement interface `Core.ImplicitAs(bool)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) { + // CHECK:STDERR: · ─────────────────────────┬─────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ {{.*}}/prelude/operators/comparison.carbon + // CHECK:STDERR: │ fn Greater(self, other: Other) -> bool; + // CHECK:STDERR: · ─────────────┬───────────────────────── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: auto operator>(AllReturnBoolish) const -> double; + // CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+20]]:8 + // CHECK:STDERR: -> │ auto operator>=(AllReturnBoolish) const -> double; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `f64` to `bool` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `f64` does not implement interface `Core.ImplicitAs(bool)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) { + // CHECK:STDERR: · ─────────────────────────┬─────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ {{.*}}/prelude/operators/comparison.carbon + // CHECK:STDERR: │ fn GreaterOrEquivalent(self, other: Other) -> bool; + // CHECK:STDERR: · ─────────────┬───────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: auto operator>=(AllReturnBoolish) const -> double; }; '''; -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+32]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere] -// CHECK:STDERR: -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-34]]:8: error: cannot implicitly convert expression of type `Core.Optional(i32* as Core.OptionalStorage)` to `bool` [ConversionFailure] -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-35]]:8: note: type `Core.Optional(i32* as Core.OptionalStorage)` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:29:3-50: note: while building thunk to match the signature of this function [ThunkSignature] -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+27]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere] -// CHECK:STDERR: -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-29]]:8: error: cannot implicitly convert expression of type `Cpp.Result` to `bool` [ConversionFailure] -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-30]]:8: note: type `Cpp.Result` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:31:3-53: note: while building thunk to match the signature of this function [ThunkSignature] -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+22]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere] -// CHECK:STDERR: -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-19]]:8: error: cannot implicitly convert expression of type `f64` to `bool` [ConversionFailure] -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-20]]:8: note: type `f64` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:28:3-38: note: while building thunk to match the signature of this function [ThunkSignature] -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+17]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere] -// CHECK:STDERR: -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-23]]:8: error: cannot implicitly convert expression of type `f64` to `bool` [ConversionFailure] -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-24]]:8: note: type `f64` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:29:3-50: note: while building thunk to match the signature of this function [ThunkSignature] -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+12]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere] -// CHECK:STDERR: -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-27]]:8: error: cannot implicitly convert expression of type `f64` to `bool` [ConversionFailure] -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-28]]:8: note: type `f64` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:30:3-41: note: while building thunk to match the signature of this function [ThunkSignature] -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+7]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere] -// CHECK:STDERR: -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-31]]:8: error: cannot implicitly convert expression of type `f64` to `bool` [ConversionFailure] -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-32]]:8: note: type `f64` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:31:3-53: note: while building thunk to match the signature of this function [ThunkSignature] -// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+2]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere] -// CHECK:STDERR: fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) { x < y; x <= y; @@ -276,33 +385,93 @@ fn Test(missing_less: Cpp.MissingLess, no_relevant_members: Cpp.NoRelevantMembers, less_returns_void: Cpp.LessReturnsVoid, less_non_const: Cpp.LessNonConst) { - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-41: error: cannot convert type `Cpp.MissingLess` into type implementing `Core.OrderedWith(Cpp.MissingLess)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-15]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) { + // CHECK:STDERR: · ─────────────────────────┬─────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ OrderedWith(missing_less, missing_less); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.MissingLess` into type implementing + // CHECK:STDERR: · ┃ `Core.OrderedWith(Cpp.MissingLess)` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: OrderedWith(missing_less, missing_less); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-53: error: cannot convert type `Cpp.MissingLessEqual` into type implementing `Core.OrderedWith(Cpp.MissingLessEqual)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-20]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) { + // CHECK:STDERR: · ─────────────────────────┬─────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ OrderedWith(missing_less_equal, missing_less_equal); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.MissingLessEqual` into type implementing + // CHECK:STDERR: · ┃ `Core.OrderedWith(Cpp.MissingLessEqual)` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: OrderedWith(missing_less_equal, missing_less_equal); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-47: error: cannot convert type `Cpp.MissingGreater` into type implementing `Core.OrderedWith(Cpp.MissingGreater)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-25]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) { + // CHECK:STDERR: · ─────────────────────────┬─────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ OrderedWith(missing_greater, missing_greater); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.MissingGreater` into type implementing + // CHECK:STDERR: · ┃ `Core.OrderedWith(Cpp.MissingGreater)` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: OrderedWith(missing_greater, missing_greater); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-59: error: cannot convert type `Cpp.MissingGreaterEqual` into type implementing `Core.OrderedWith(Cpp.MissingGreaterEqual)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-30]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) { + // CHECK:STDERR: · ─────────────────────────┬─────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ OrderedWith(missing_greater_equal, missing_greater_equal); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.MissingGreaterEqual` into type + // CHECK:STDERR: · ┃ implementing `Core.OrderedWith(Cpp.MissingGreaterEqual)` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: OrderedWith(missing_greater_equal, missing_greater_equal); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-55: error: cannot convert type `Cpp.NoRelevantMembers` into type implementing `Core.OrderedWith(Cpp.NoRelevantMembers)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-35]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) { + // CHECK:STDERR: · ─────────────────────────┬─────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ OrderedWith(no_relevant_members, no_relevant_members); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.NoRelevantMembers` into type implementing + // CHECK:STDERR: · ┃ `Core.OrderedWith(Cpp.NoRelevantMembers)` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: OrderedWith(no_relevant_members, no_relevant_members); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-51: error: cannot convert type `Cpp.LessReturnsVoid` into type implementing `Core.OrderedWith(Cpp.LessReturnsVoid)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-40]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) { + // CHECK:STDERR: · ─────────────────────────┬─────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ OrderedWith(less_returns_void, less_returns_void); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.LessReturnsVoid` into type implementing + // CHECK:STDERR: · ┃ `Core.OrderedWith(Cpp.LessReturnsVoid)` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: OrderedWith(less_returns_void, less_returns_void); diff --git a/toolchain/check/testdata/interop/cpp/operators/spaceship.carbon b/toolchain/check/testdata/interop/cpp/operators/spaceship.carbon index 1f2ffc369b92..4ba1cf16fb21 100644 --- a/toolchain/check/testdata/interop/cpp/operators/spaceship.carbon +++ b/toolchain/check/testdata/interop/cpp/operators/spaceship.carbon @@ -152,31 +152,96 @@ fn Test(default_spaceship_only: Cpp.DefaultSpaceshipOnly, returns_partial_ordering: Cpp.ReturnsPartialOrdering, cross_type_lhs: Cpp.CrossTypeLhs, cross_type_rhs: Cpp.CrossTypeRhs) { - // CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE+3]]:3-56: error: semantics TODO: `Rewriting operator!= using operator== is not supported` [SemanticsTodo] - // CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE-23]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_todo_spaceship_rewrites.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) { + // CHECK:STDERR: · ─────────────────────────┬───────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ EqWith(default_spaceship_only, default_spaceship_only); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: + // CHECK:STDERR: · ┃ `Rewriting operator!= using operator== is not supported` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: EqWith(default_spaceship_only, default_spaceship_only); - // CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE+3]]:3-61: error: semantics TODO: `Rewriting operator< using operator<=> is not supported` [SemanticsTodo] - // CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE-21]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_todo_spaceship_rewrites.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) { + // CHECK:STDERR: · ─────────────────────────┬─────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ OrderedWith(default_spaceship_only, default_spaceship_only); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: + // CHECK:STDERR: · ┃ `Rewriting operator< using operator<=> is not supported` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: OrderedWith(default_spaceship_only, default_spaceship_only); - // CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE+3]]:3-63: error: semantics TODO: `Rewriting operator< using operator<=> is not supported` [SemanticsTodo] - // CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE-25]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_todo_spaceship_rewrites.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) { + // CHECK:STDERR: · ─────────────────────────┬─────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ OrderedWith(returns_strong_ordering, returns_strong_ordering); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: + // CHECK:STDERR: · ┃ `Rewriting operator< using operator<=> is not supported` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: OrderedWith(returns_strong_ordering, returns_strong_ordering); - // CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE+3]]:3-65: error: semantics TODO: `Rewriting operator< using operator<=> is not supported` [SemanticsTodo] - // CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE-29]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_todo_spaceship_rewrites.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) { + // CHECK:STDERR: · ─────────────────────────┬─────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ OrderedWith(returns_partial_ordering, returns_partial_ordering); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: + // CHECK:STDERR: · ┃ `Rewriting operator< using operator<=> is not supported` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: OrderedWith(returns_partial_ordering, returns_partial_ordering); - // CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE+3]]:3-45: error: semantics TODO: `Rewriting operator< using operator<=> is not supported` [SemanticsTodo] - // CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE-33]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_todo_spaceship_rewrites.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) { + // CHECK:STDERR: · ─────────────────────────┬─────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ OrderedWith(cross_type_lhs, cross_type_rhs); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: + // CHECK:STDERR: · ┃ `Rewriting operator< using operator<=> is not supported` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: OrderedWith(cross_type_lhs, cross_type_rhs); - // CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE+5]]:3-45: error: semantics TODO: `Rewriting operator< using operator<=> is not supported` [SemanticsTodo] - // CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE-37]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_todo_spaceship_rewrites.carbon:[[@LINE+20]]:3 + // CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) { + // CHECK:STDERR: · ─────────────────────────┬─────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ OrderedWith(cross_type_rhs, cross_type_lhs); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: + // CHECK:STDERR: · ┃ `Rewriting operator< using operator<=> is not supported` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE-28]]:9-54: warning: binding `returns_weak_ordering` unused [UnusedBinding] + // CHECK:STDERR: ╭─┤ fail_todo_spaceship_rewrites.carbon:[[@LINE-88]]:9 + // CHECK:STDERR: -> │ returns_weak_ordering: Cpp.ReturnsWeakOrdering, + // CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ warning: binding `returns_weak_ordering` unused + // CHECK:STDERR: · ┃ [UnusedBinding] + // CHECK:STDERR: ╰──── // CHECK:STDERR: OrderedWith(cross_type_rhs, cross_type_lhs); } @@ -190,8 +255,18 @@ import Cpp library "three_way_comparable_types.h"; fn EqWith[U: type, T: Core.EqWith(U)](unused x: T, unused y: U) {} fn Test(returns_strong_ordering: Cpp.ReturnsStrongOrdering) { - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-58: error: cannot convert type `Cpp.ReturnsStrongOrdering` into type implementing `Core.EqWith(Cpp.ReturnsStrongOrdering)` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-4]]:1-65: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](unused x: T, unused y: U) {} + // CHECK:STDERR: · ─────────────────────────┬─────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ EqWith(returns_strong_ordering, returns_strong_ordering); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.ReturnsStrongOrdering` into type + // CHECK:STDERR: · ┃ implementing `Core.EqWith(Cpp.ReturnsStrongOrdering)` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: EqWith(returns_strong_ordering, returns_strong_ordering); } diff --git a/toolchain/check/testdata/interop/cpp/primitive_types/arithmetic.carbon b/toolchain/check/testdata/interop/cpp/primitive_types/arithmetic.carbon index cbaa0828654f..4c2a621c126f 100644 --- a/toolchain/check/testdata/interop/cpp/primitive_types/arithmetic.carbon +++ b/toolchain/check/testdata/interop/cpp/primitive_types/arithmetic.carbon @@ -52,8 +52,15 @@ import Cpp; fn F() { //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_unsupported_types.carbon:[[@LINE+3]]:25-39: error: semantics TODO: `Unsupported: builtin type: long double` [SemanticsTodo] - // CHECK:STDERR: fail_todo_unsupported_types.carbon:[[@LINE+2]]:25-39: note: in `Cpp` name lookup for `long_double` [InCppNameLookup] + // CHECK:STDERR: ╭─┤ fail_todo_unsupported_types.carbon:[[@LINE+10]]:25 + // CHECK:STDERR: -> │ let cpp_long_double : Cpp.long_double = 1.0 as f64; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: + // CHECK:STDERR: · │ ┃ `Unsupported: builtin type: long double` + // CHECK:STDERR: · │ ┃ [SemanticsTodo] + // CHECK:STDERR: · ╰────┤ in `Cpp` name lookup for `long_double` + // CHECK:STDERR: · │ [InCppNameLookup] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let cpp_long_double : Cpp.long_double = 1.0 as f64; let unused carbon_long_double: f64 = cpp_long_double; @@ -67,7 +74,13 @@ library "[[@TEST_NAME]]"; import Cpp; fn F() { - // CHECK:STDERR: fail_not_builtin.carbon:[[@LINE+2]]:28-42: error: member name `not_builtin` not found in `Cpp` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╭─┤ fail_not_builtin.carbon:[[@LINE+8]]:28 + // CHECK:STDERR: -> │ let unused not_builtin : Cpp.not_builtin = 1; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: member name `not_builtin` not found in + // CHECK:STDERR: · ┃ `Cpp` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused not_builtin : Cpp.not_builtin = 1; } @@ -81,7 +94,13 @@ namespace MyNamespace {} '''; fn F() { - // CHECK:STDERR: fail_lookup_in_other_scopes.carbon:[[@LINE+2]]:21-40: error: member name `long` not found in `Cpp.MyNamespace` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╭─┤ fail_lookup_in_other_scopes.carbon:[[@LINE+8]]:21 + // CHECK:STDERR: -> │ let unused long : Cpp.MyNamespace.long = 1; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: member name `long` not found in + // CHECK:STDERR: · ┃ `Cpp.MyNamespace` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused long : Cpp.MyNamespace.long = 1; } @@ -493,21 +512,21 @@ fn F() { // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %float: Core.FloatLiteral = float_literal_value 10e-1 [concrete = constants.%float.6da] -// CHECK:STDOUT: %f64.loc11: type = type_literal constants.%f64.761 [concrete = constants.%f64.761] +// CHECK:STDOUT: %f64.loc18: type = type_literal constants.%f64.761 [concrete = constants.%f64.761] // CHECK:STDOUT: %impl.elem0: %.dac = impl_witness_access constants.%As.impl_witness.553, element0 [concrete = constants.%Core.FloatLiteral.as.As.impl.Convert.882] -// CHECK:STDOUT: %bound_method.loc11_47.1: = bound_method %float, %impl.elem0 [concrete = constants.%Core.FloatLiteral.as.As.impl.Convert.bound] +// CHECK:STDOUT: %bound_method.loc18_47.1: = bound_method %float, %impl.elem0 [concrete = constants.%Core.FloatLiteral.as.As.impl.Convert.bound] // CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Core.FloatLiteral.as.As.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.As.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc11_47.2: = bound_method %float, %specific_fn [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.FloatLiteral.as.As.impl.Convert.call: init %f64.761 = call %bound_method.loc11_47.2(%float) [concrete = constants.%float.a71] -// CHECK:STDOUT: %.loc11_47.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.As.impl.Convert.call [concrete = constants.%float.a71] -// CHECK:STDOUT: %.loc11_47.2: %f64.761 = converted %float, %.loc11_47.1 [concrete = constants.%float.a71] +// CHECK:STDOUT: %bound_method.loc18_47.2: = bound_method %float, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.FloatLiteral.as.As.impl.Convert.call: init %f64.761 = call %bound_method.loc18_47.2(%float) [concrete = constants.%float.a71] +// CHECK:STDOUT: %.loc18_47.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.As.impl.Convert.call [concrete = constants.%float.a71] +// CHECK:STDOUT: %.loc18_47.2: %f64.761 = converted %float, %.loc18_47.1 [concrete = constants.%float.a71] // CHECK:STDOUT: // CHECK:STDOUT: %cpp_long_double: = wrapper_binding cpp_long_double, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %cpp_long_double.patt: = value_binding_pattern cpp_long_double [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: %cpp_long_double.ref: = name_ref cpp_long_double, %cpp_long_double [concrete = ] -// CHECK:STDOUT: %f64.loc12: type = type_literal constants.%f64.761 [concrete = constants.%f64.761] +// CHECK:STDOUT: %f64.loc19: type = type_literal constants.%f64.761 [concrete = constants.%f64.761] // CHECK:STDOUT: %carbon_long_double: %f64.761 = wrapper_binding carbon_long_double, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %carbon_long_double.patt: %pattern_type.667 = value_binding_pattern carbon_long_double [concrete = constants.%carbon_long_double.patt] diff --git a/toolchain/check/testdata/interop/cpp/primitive_types/array.carbon b/toolchain/check/testdata/interop/cpp/primitive_types/array.carbon index f5057e6e3495..418944fe2402 100644 --- a/toolchain/check/testdata/interop/cpp/primitive_types/array.carbon +++ b/toolchain/check/testdata/interop/cpp/primitive_types/array.carbon @@ -63,7 +63,11 @@ library "[[@TEST_NAME]]"; import Cpp; -// CHECK:STDERR: fail_incomplete.carbon:[[@LINE+2]]:1-8: error: class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: ╭─┤ fail_incomplete.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ class C; +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: ╰──── // CHECK:STDERR: class C; @@ -71,8 +75,17 @@ fn F() -> array(C, 5)*; inline Cpp ''' void G() { - // CHECK:STDERR: fail_incomplete.carbon:[[@LINE+3]]:33: error: subscript of pointer to incomplete type 'Carbon::Main::C' [CppInteropParseError] - // CHECK:STDERR: fail_incomplete.carbon:[[@LINE-7]]:8: note: forward declaration of 'Carbon::Main::C' [CppInteropParseNote] + // CHECK:STDERR: ╭─┤ fail_incomplete.carbon:[[@LINE+12]]:33 + // CHECK:STDERR: │ class C; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ forward declaration of 'Carbon::Main::C' [CppInteropParseNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Carbon::C *p = &(*Carbon::F())[0]; + // CHECK:STDERR: · ─────────────╴╻ + // CHECK:STDERR: · ┗━━┫ error: subscript of pointer to incomplete + // CHECK:STDERR: · ┃ type 'Carbon::Main::C' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Carbon::C *p = &(*Carbon::F())[0]; } diff --git a/toolchain/check/testdata/interop/cpp/primitive_types/fail_todo_arithmetic_types_unmapped.carbon b/toolchain/check/testdata/interop/cpp/primitive_types/fail_todo_arithmetic_types_unmapped.carbon index b30023220cea..00e404b9e465 100644 --- a/toolchain/check/testdata/interop/cpp/primitive_types/fail_todo_arithmetic_types_unmapped.carbon +++ b/toolchain/check/testdata/interop/cpp/primitive_types/fail_todo_arithmetic_types_unmapped.carbon @@ -20,6 +20,12 @@ import Cpp inline ''' auto GetWC() -> wchar_t; '''; -// CHECK:STDERR: fail_todo_wide_char_t.carbon:[[@LINE+2]]:32-42: error: semantics TODO: `Unsupported: return type: wchar_t` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_todo_wide_char_t.carbon:[[@LINE+8]]:32 +// CHECK:STDERR: -> │ fn CallGetWC() -> u32 { return Cpp.GetWC(); } +// CHECK:STDERR: · ┳━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: +// CHECK:STDERR: · ┃ `Unsupported: return type: wchar_t` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn CallGetWC() -> u32 { return Cpp.GetWC(); } diff --git a/toolchain/check/testdata/interop/cpp/primitive_types/long_and_long_long.darwin.carbon b/toolchain/check/testdata/interop/cpp/primitive_types/long_and_long_long.darwin.carbon index 2163a4f4fad1..feb0d5ba124c 100644 --- a/toolchain/check/testdata/interop/cpp/primitive_types/long_and_long_long.darwin.carbon +++ b/toolchain/check/testdata/interop/cpp/primitive_types/long_and_long_long.darwin.carbon @@ -85,8 +85,17 @@ import Cpp; fn F() { let carbon_i64: i64 = 1; - // CHECK:STDERR: fail_implicit_conversion_i64_to_long.carbon:[[@LINE+3]]:35-44: error: cannot implicitly convert expression of type `i64` to `Cpp.long` [ConversionFailure] - // CHECK:STDERR: fail_implicit_conversion_i64_to_long.carbon:[[@LINE+2]]:35-44: note: type `i64` does not implement interface `Core.ImplicitAs(Cpp.long)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_implicit_conversion_i64_to_long.carbon:[[@LINE+12]]:35 + // CHECK:STDERR: -> │ let unused cpp_long: Cpp.long = carbon_i64; + // CHECK:STDERR: · ┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert + // CHECK:STDERR: · │ ┃ expression of type `i64` to + // CHECK:STDERR: · │ ┃ `Cpp.long` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `i64` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.long)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused cpp_long: Cpp.long = carbon_i64; } @@ -210,10 +219,22 @@ import Cpp; fn ComparisonsHeterogeneousLongAndI128() { let a: Cpp.long = 1; let b: i128 = 1; - // CHECK:STDERR: fail_todo_comparisons_heterogeneous_long_and_i128.carbon:[[@LINE+2]]:3-8: error: cannot access member of interface `Core.EqWith(i128)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_todo_comparisons_heterogeneous_long_and_i128.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ a == b; + // CHECK:STDERR: · ┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.EqWith(i128)` in type + // CHECK:STDERR: · ┃ `Cpp.long` that does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: a == b; - // CHECK:STDERR: fail_todo_comparisons_heterogeneous_long_and_i128.carbon:[[@LINE+2]]:3-8: error: cannot access member of interface `Core.EqWith(Cpp.long)` in type `i128` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_todo_comparisons_heterogeneous_long_and_i128.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ b == a; + // CHECK:STDERR: · ┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.EqWith(Cpp.long)` in type + // CHECK:STDERR: · ┃ `i128` that does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: b == a; } @@ -314,10 +335,24 @@ fn AssertSameType[T: type](unused a: T, unused b: T) {} fn ArithmeticHeterogeneousLongAndI128() { let x: Cpp.long = 1; let y: i128 = 1; - // CHECK:STDERR: fail_todo_arithmetic_heterogeneous_long_and_i128.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.AddWith(i128)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_todo_arithmetic_heterogeneous_long_and_i128.carbon:[[@LINE+9]]:18 + // CHECK:STDERR: -> │ AssertSameType(x + y, y); + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.AddWith(i128)` in type `Cpp.long` that does + // CHECK:STDERR: · ┃ not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: AssertSameType(x + y, y); - // CHECK:STDERR: fail_todo_arithmetic_heterogeneous_long_and_i128.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.AddWith(Cpp.long)` in type `i128` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_todo_arithmetic_heterogeneous_long_and_i128.carbon:[[@LINE+9]]:18 + // CHECK:STDERR: -> │ AssertSameType(y + x, y); + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.AddWith(Cpp.long)` in type `i128` that does + // CHECK:STDERR: · ┃ not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: AssertSameType(y + x, y); } @@ -420,10 +455,24 @@ fn BitWiseHeterogeneousLongAndI128() { let a: Cpp.long = 1; let b: i128 = 1; - // CHECK:STDERR: fail_todo_bitwise_heterogeneous_long_and_i128.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.BitAndWith(i128)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_todo_bitwise_heterogeneous_long_and_i128.carbon:[[@LINE+9]]:18 + // CHECK:STDERR: -> │ AssertSameType(a & b, b); + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.BitAndWith(i128)` in type `Cpp.long` that + // CHECK:STDERR: · ┃ does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: AssertSameType(a & b, b); - // CHECK:STDERR: fail_todo_bitwise_heterogeneous_long_and_i128.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.BitAndWith(Cpp.long)` in type `i128` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_todo_bitwise_heterogeneous_long_and_i128.carbon:[[@LINE+9]]:18 + // CHECK:STDERR: -> │ AssertSameType(b & a, b); + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.BitAndWith(Cpp.long)` in type `i128` that + // CHECK:STDERR: · ┃ does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: AssertSameType(b & a, b); } @@ -523,7 +572,13 @@ import Cpp; fn CompoundAssignmentHeterogeneousLongAndI64() { var a: Cpp.long = 1; - // CHECK:STDERR: fail_compound_assignment_heterogeneous_long_and_i64.carbon:[[@LINE+2]]:3-17: error: cannot access member of interface `Core.AddAssignWith(i64)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_compound_assignment_heterogeneous_long_and_i64.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ a += (1 as i64); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.AddAssignWith(i64)` in + // CHECK:STDERR: · ┃ type `Cpp.long` that does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: a += (1 as i64); } @@ -581,8 +636,17 @@ fn F() { // For portability reasons, this is not allowed even though `u64` // happens to fit in `unsigned long` on this target. - // CHECK:STDERR: fail_pass_u64_to_ulong.carbon:[[@LINE+3]]:53-62: error: cannot implicitly convert expression of type `u64` to `Cpp.unsigned_long` [ConversionFailure] - // CHECK:STDERR: fail_pass_u64_to_ulong.carbon:[[@LINE+2]]:53-62: note: type `u64` does not implement interface `Core.ImplicitAs(Cpp.unsigned_long)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_pass_u64_to_ulong.carbon:[[@LINE+12]]:53 + // CHECK:STDERR: -> │ let unused cpp_unsigned_long: Cpp.unsigned_long = carbon_u64; + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: cannot implicitly convert expression of type `u64` to + // CHECK:STDERR: · ┃ `Cpp.unsigned_long` + // CHECK:STDERR: · ┃ [ConversionFailure] + // CHECK:STDERR: · ╭────────────────────────────────────────────────────────╯ + // CHECK:STDERR: · │ type `u64` does not implement interface `Core.ImplicitAs(Cpp.unsigned_long)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused cpp_unsigned_long: Cpp.unsigned_long = carbon_u64; } diff --git a/toolchain/check/testdata/interop/cpp/primitive_types/long_and_long_long.llp64.carbon b/toolchain/check/testdata/interop/cpp/primitive_types/long_and_long_long.llp64.carbon index 6405c74ce92d..20b85cd213ca 100644 --- a/toolchain/check/testdata/interop/cpp/primitive_types/long_and_long_long.llp64.carbon +++ b/toolchain/check/testdata/interop/cpp/primitive_types/long_and_long_long.llp64.carbon @@ -79,8 +79,16 @@ import Cpp; fn F() { let cpp_long: Cpp.long = 1; - // CHECK:STDERR: fail_implicit_conversion_long_to_i32.carbon:[[@LINE+3]]:32-39: error: cannot implicitly convert expression of type `long` to `i32` [ConversionFailure] - // CHECK:STDERR: fail_implicit_conversion_long_to_i32.carbon:[[@LINE+2]]:32-39: note: type `Cpp.long` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_implicit_conversion_long_to_i32.carbon:[[@LINE+11]]:32 + // CHECK:STDERR: -> │ let unused carbon_i32: i32 = cpp_long; + // CHECK:STDERR: · ┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression + // CHECK:STDERR: · │ ┃ of type `long` to `i32` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Cpp.long` does not implement + // CHECK:STDERR: · │ interface `Core.ImplicitAs(i32)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused carbon_i32: i32 = cpp_long; } @@ -191,10 +199,22 @@ import Cpp; fn ComparisonsHeterogeneousLongAndI16() { let a: Cpp.long = 1; let b: i16 = 1; - // CHECK:STDERR: fail_todo_comparisons_heterogeneous_long_and_i16.carbon:[[@LINE+2]]:3-8: error: cannot access member of interface `Core.EqWith(i16)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_todo_comparisons_heterogeneous_long_and_i16.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ a == b; + // CHECK:STDERR: · ┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.EqWith(i16)` in type + // CHECK:STDERR: · ┃ `Cpp.long` that does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: a == b; - // CHECK:STDERR: fail_todo_comparisons_heterogeneous_long_and_i16.carbon:[[@LINE+2]]:3-8: error: cannot access member of interface `Core.EqWith(Cpp.long)` in type `i16` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_todo_comparisons_heterogeneous_long_and_i16.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ b == a; + // CHECK:STDERR: · ┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.EqWith(Cpp.long)` in type + // CHECK:STDERR: · ┃ `i16` that does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: b == a; } @@ -208,10 +228,22 @@ import Cpp; fn ComparisonsHeterogeneousLongAndI128() { let a: Cpp.long = 1; let b: i128 = 1; - // CHECK:STDERR: fail_todo_comparisons_heterogeneous_long_and_i128.carbon:[[@LINE+2]]:3-8: error: cannot access member of interface `Core.EqWith(i128)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_todo_comparisons_heterogeneous_long_and_i128.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ a == b; + // CHECK:STDERR: · ┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.EqWith(i128)` in type + // CHECK:STDERR: · ┃ `Cpp.long` that does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: a == b; - // CHECK:STDERR: fail_todo_comparisons_heterogeneous_long_and_i128.carbon:[[@LINE+2]]:3-8: error: cannot access member of interface `Core.EqWith(Cpp.long)` in type `i128` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_todo_comparisons_heterogeneous_long_and_i128.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ b == a; + // CHECK:STDERR: · ┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.EqWith(Cpp.long)` in type + // CHECK:STDERR: · ┃ `i128` that does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: b == a; } @@ -313,11 +345,25 @@ fn AssertSameType[T: type](unused a: T, unused b: T) {} fn ArithmeticHeterogeneousLongAndI16() { let x: Cpp.long = 1; let y: i16 = 1; - // CHECK:STDERR: fail_todo_arithmetic_heterogeneous_long_and_i16.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.AddWith(i16)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_todo_arithmetic_heterogeneous_long_and_i16.carbon:[[@LINE+9]]:18 + // CHECK:STDERR: -> │ AssertSameType(x + y, x); + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.AddWith(i16)` in type `Cpp.long` that does + // CHECK:STDERR: · ┃ not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: AssertSameType(x + y, x); - // CHECK:STDERR: fail_todo_arithmetic_heterogeneous_long_and_i16.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.AddWith(Cpp.long)` in type `i16` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_todo_arithmetic_heterogeneous_long_and_i16.carbon:[[@LINE+9]]:18 + // CHECK:STDERR: -> │ AssertSameType(y + x, x); + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.AddWith(Cpp.long)` in type `i16` that does + // CHECK:STDERR: · ┃ not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: AssertSameType(y + x, x); } @@ -333,11 +379,25 @@ fn AssertSameType[T: type](unused a: T, unused b: T) {} fn ArithmeticHeterogeneousLongAndI128() { let x: Cpp.long = 1; let y: i128 = 1; - // CHECK:STDERR: fail_todo_arithmetic_heterogeneous_long_and_i128.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.AddWith(i128)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_todo_arithmetic_heterogeneous_long_and_i128.carbon:[[@LINE+9]]:18 + // CHECK:STDERR: -> │ AssertSameType(x + y, y); + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.AddWith(i128)` in type `Cpp.long` that does + // CHECK:STDERR: · ┃ not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: AssertSameType(x + y, y); - // CHECK:STDERR: fail_todo_arithmetic_heterogeneous_long_and_i128.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.AddWith(Cpp.long)` in type `i128` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_todo_arithmetic_heterogeneous_long_and_i128.carbon:[[@LINE+9]]:18 + // CHECK:STDERR: -> │ AssertSameType(y + x, y); + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.AddWith(Cpp.long)` in type `i128` that does + // CHECK:STDERR: · ┃ not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: AssertSameType(y + x, y); } @@ -441,10 +501,24 @@ fn BitWiseHeterogeneousLongAndI16() { let a: Cpp.long = 1; let b: i16 = 1; - // CHECK:STDERR: fail_todo_bitwise_heterogeneous_long_and_i16.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.BitAndWith(i16)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_todo_bitwise_heterogeneous_long_and_i16.carbon:[[@LINE+9]]:18 + // CHECK:STDERR: -> │ AssertSameType(a & b, a); + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.BitAndWith(i16)` in type `Cpp.long` that does + // CHECK:STDERR: · ┃ not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: AssertSameType(a & b, a); - // CHECK:STDERR: fail_todo_bitwise_heterogeneous_long_and_i16.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.BitAndWith(Cpp.long)` in type `i16` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_todo_bitwise_heterogeneous_long_and_i16.carbon:[[@LINE+9]]:18 + // CHECK:STDERR: -> │ AssertSameType(b & a, a); + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.BitAndWith(Cpp.long)` in type `i16` that does + // CHECK:STDERR: · ┃ not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: AssertSameType(b & a, a); } @@ -461,10 +535,24 @@ fn BitWiseHeterogeneousLongAndI128() { let a: Cpp.long = 1; let b: i128 = 1; - // CHECK:STDERR: fail_todo_bitwise_heterogeneous_long_and_i128.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.BitAndWith(i128)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_todo_bitwise_heterogeneous_long_and_i128.carbon:[[@LINE+9]]:18 + // CHECK:STDERR: -> │ AssertSameType(a & b, b); + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.BitAndWith(i128)` in type `Cpp.long` that + // CHECK:STDERR: · ┃ does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: AssertSameType(a & b, b); - // CHECK:STDERR: fail_todo_bitwise_heterogeneous_long_and_i128.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.BitAndWith(Cpp.long)` in type `i128` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_todo_bitwise_heterogeneous_long_and_i128.carbon:[[@LINE+9]]:18 + // CHECK:STDERR: -> │ AssertSameType(b & a, b); + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.BitAndWith(Cpp.long)` in type `i128` that + // CHECK:STDERR: · ┃ does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: AssertSameType(b & a, b); } @@ -553,7 +641,13 @@ import Cpp; fn CompoundAssignmentHeterogeneousI16Long() { var a: Cpp.long = 1; - // CHECK:STDERR: fail_todo_compound_assignment_heterogeneous_long_and_i16.carbon:[[@LINE+2]]:3-17: error: cannot access member of interface `Core.AddAssignWith(i16)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_todo_compound_assignment_heterogeneous_long_and_i16.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ a += (1 as i16); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.AddAssignWith(i16)` in + // CHECK:STDERR: · ┃ type `Cpp.long` that does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: a += (1 as i16); } @@ -566,7 +660,13 @@ import Cpp; fn CompoundAssignmentHeterogeneousI64Long() { var a: Cpp.long = 1; - // CHECK:STDERR: fail_compound_assignment_heterogeneous_long_and_i64.carbon:[[@LINE+2]]:3-17: error: cannot access member of interface `Core.AddAssignWith(i64)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_compound_assignment_heterogeneous_long_and_i64.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ a += (1 as i64); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.AddAssignWith(i64)` in + // CHECK:STDERR: · ┃ type `Cpp.long` that does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: a += (1 as i64); } @@ -624,10 +724,22 @@ fn F() { // For portability reasons, this is not allowed even though `unsigned long` // happens to fit in `u32` on this target. - // CHECK:STDERR: fail_no_ulong_to_u32.carbon:[[@LINE+5]]:25-41: error: cannot implicitly convert expression of type `unsigned_long` to `u32` [ConversionFailure] - // CHECK:STDERR: fail_no_ulong_to_u32.carbon:[[@LINE+4]]:25-41: note: type `Cpp.unsigned_long` does not implement interface `Core.ImplicitAs(u32)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_no_ulong_to_u32.carbon:[[@LINE+17]]:25 + // CHECK:STDERR: -> │ let carbon_u32: u32 = cpp_unsigned_long; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type + // CHECK:STDERR: · │ ┃ `unsigned_long` to `u32` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Cpp.unsigned_long` does not implement + // CHECK:STDERR: · │ interface `Core.ImplicitAs(u32)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_no_ulong_to_u32.carbon:[[@LINE+2]]:7-21: warning: binding `carbon_u32` unused [UnusedBinding] + // CHECK:STDERR: ╭─┤ fail_no_ulong_to_u32.carbon:[[@LINE+6]]:7 + // CHECK:STDERR: -> │ let carbon_u32: u32 = cpp_unsigned_long; + // CHECK:STDERR: · ━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ warning: binding `carbon_u32` unused [UnusedBinding] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let carbon_u32: u32 = cpp_unsigned_long; } diff --git a/toolchain/check/testdata/interop/cpp/primitive_types/long_and_long_long.lp64.carbon b/toolchain/check/testdata/interop/cpp/primitive_types/long_and_long_long.lp64.carbon index e36d2eab4e90..7b938cba9ecb 100644 --- a/toolchain/check/testdata/interop/cpp/primitive_types/long_and_long_long.lp64.carbon +++ b/toolchain/check/testdata/interop/cpp/primitive_types/long_and_long_long.lp64.carbon @@ -78,8 +78,16 @@ import Cpp; fn F() { let cpp_long_long: Cpp.long_long = 1; - // CHECK:STDERR: fail_implicit_conversion_long_long_to_i64.carbon:[[@LINE+3]]:32-44: error: cannot implicitly convert expression of type `long_long` to `i64` [ConversionFailure] - // CHECK:STDERR: fail_implicit_conversion_long_long_to_i64.carbon:[[@LINE+2]]:32-44: note: type `Cpp.long_long` does not implement interface `Core.ImplicitAs(i64)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_implicit_conversion_long_long_to_i64.carbon:[[@LINE+11]]:32 + // CHECK:STDERR: -> │ let unused carbon_i64: i64 = cpp_long_long; + // CHECK:STDERR: · ┳━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression + // CHECK:STDERR: · │ ┃ of type `long_long` to `i64` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Cpp.long_long` does not implement + // CHECK:STDERR: · │ interface `Core.ImplicitAs(i64)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused carbon_i64: i64 = cpp_long_long; } @@ -177,10 +185,22 @@ import Cpp; fn ComparisonsHeterogeneousLongLongAndI32() { let a: Cpp.long_long = 1; let b: i32 = 1; - // CHECK:STDERR: fail_todo_comparisons_heterogeneous_long_long_and_i32.carbon:[[@LINE+2]]:3-8: error: cannot access member of interface `Core.EqWith(i32)` in type `Cpp.long_long` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_todo_comparisons_heterogeneous_long_long_and_i32.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ a == b; + // CHECK:STDERR: · ┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.EqWith(i32)` in type + // CHECK:STDERR: · ┃ `Cpp.long_long` that does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: a == b; - // CHECK:STDERR: fail_todo_comparisons_heterogeneous_long_long_and_i32.carbon:[[@LINE+2]]:3-8: error: cannot access member of interface `Core.EqWith(Cpp.long_long)` in type `i32` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_todo_comparisons_heterogeneous_long_long_and_i32.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ b == a; + // CHECK:STDERR: · ┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.EqWith(Cpp.long_long)` in + // CHECK:STDERR: · ┃ type `i32` that does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: b == a; } @@ -207,10 +227,22 @@ import Cpp; fn ComparisonsHeterogeneousLongLongAndI256() { let a: Cpp.long_long = 1; let b: i256 = 1; - // CHECK:STDERR: fail_todo_comparisons_heterogeneous_long_long_and_i256.carbon:[[@LINE+2]]:3-8: error: cannot access member of interface `Core.EqWith(i256)` in type `Cpp.long_long` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_todo_comparisons_heterogeneous_long_long_and_i256.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ a == b; + // CHECK:STDERR: · ┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.EqWith(i256)` in type + // CHECK:STDERR: · ┃ `Cpp.long_long` that does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: a == b; - // CHECK:STDERR: fail_todo_comparisons_heterogeneous_long_long_and_i256.carbon:[[@LINE+2]]:3-8: error: cannot access member of interface `Core.EqWith(Cpp.long_long)` in type `i256` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_todo_comparisons_heterogeneous_long_long_and_i256.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ b == a; + // CHECK:STDERR: · ┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.EqWith(Cpp.long_long)` in + // CHECK:STDERR: · ┃ type `i256` that does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: b == a; } @@ -295,11 +327,25 @@ fn AssertSameType[T: type](unused a: T, unused b: T) {} fn ArithmeticHeterogeneousLongLongAndI32() { let x: Cpp.long_long = 1; let y: i32 = 1; - // CHECK:STDERR: fail_todo_arithmetic_heterogeneous_long_long_and_i32.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.AddWith(i32)` in type `Cpp.long_long` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_todo_arithmetic_heterogeneous_long_long_and_i32.carbon:[[@LINE+9]]:18 + // CHECK:STDERR: -> │ AssertSameType(x + y, x); + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.AddWith(i32)` in type `Cpp.long_long` that + // CHECK:STDERR: · ┃ does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: AssertSameType(x + y, x); - // CHECK:STDERR: fail_todo_arithmetic_heterogeneous_long_long_and_i32.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.AddWith(Cpp.long_long)` in type `i32` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_todo_arithmetic_heterogeneous_long_long_and_i32.carbon:[[@LINE+9]]:18 + // CHECK:STDERR: -> │ AssertSameType(y + x, x); + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.AddWith(Cpp.long_long)` in type `i32` that + // CHECK:STDERR: · ┃ does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: AssertSameType(y + x, x); } @@ -401,10 +447,24 @@ fn BitWiseHeterogeneousLongLongAndI32() { let a: Cpp.long_long = 1; let b: i32 = 1; - // CHECK:STDERR: fail_todo_bitwise_heterogeneous_long_long_and_i32.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.BitAndWith(i32)` in type `Cpp.long_long` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_todo_bitwise_heterogeneous_long_long_and_i32.carbon:[[@LINE+9]]:18 + // CHECK:STDERR: -> │ AssertSameType(a & b, a); + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.BitAndWith(i32)` in type `Cpp.long_long` that + // CHECK:STDERR: · ┃ does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: AssertSameType(a & b, a); - // CHECK:STDERR: fail_todo_bitwise_heterogeneous_long_long_and_i32.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.BitAndWith(Cpp.long_long)` in type `i32` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_todo_bitwise_heterogeneous_long_long_and_i32.carbon:[[@LINE+9]]:18 + // CHECK:STDERR: -> │ AssertSameType(b & a, a); + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.BitAndWith(Cpp.long_long)` in type `i32` that + // CHECK:STDERR: · ┃ does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: AssertSameType(b & a, a); } @@ -509,7 +569,13 @@ import Cpp; fn CompoundAssignmentHeterogeneousLongLongAndI32() { var a: Cpp.long_long = 1; - // CHECK:STDERR: fail_todo_compound_assignment_heterogeneous_long_long_and_i32.carbon:[[@LINE+2]]:3-17: error: cannot access member of interface `Core.AddAssignWith(i32)` in type `Cpp.long_long` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_todo_compound_assignment_heterogeneous_long_long_and_i32.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ a += (1 as i32); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.AddAssignWith(i32)` in + // CHECK:STDERR: · ┃ type `Cpp.long_long` that does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: a += (1 as i32); } @@ -522,7 +588,13 @@ import Cpp; fn CompoundAssignmentHeterogeneousLongLongAndI128() { var a: Cpp.long_long = 1; - // CHECK:STDERR: fail_compound_assignment_heterogeneous_long_long_and_i128.carbon:[[@LINE+2]]:3-18: error: cannot access member of interface `Core.AddAssignWith(i128)` in type `Cpp.long_long` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_compound_assignment_heterogeneous_long_long_and_i128.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ a += (1 as i128); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.AddAssignWith(i128)` in + // CHECK:STDERR: · ┃ type `Cpp.long_long` that does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: a += (1 as i128); } @@ -580,10 +652,22 @@ fn F() { // For portability reasons, this is not allowed even though `unsigned long // long` happens to fit in `u64` on this target. - // CHECK:STDERR: fail_pass_ulonglong_to_u64.carbon:[[@LINE+5]]:25-46: error: cannot implicitly convert expression of type `unsigned_long_long` to `u64` [ConversionFailure] - // CHECK:STDERR: fail_pass_ulonglong_to_u64.carbon:[[@LINE+4]]:25-46: note: type `Cpp.unsigned_long_long` does not implement interface `Core.ImplicitAs(u64)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_pass_ulonglong_to_u64.carbon:[[@LINE+17]]:25 + // CHECK:STDERR: -> │ let carbon_u64: u64 = cpp_unsigned_long_long; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type + // CHECK:STDERR: · │ ┃ `unsigned_long_long` to `u64` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Cpp.unsigned_long_long` does not implement + // CHECK:STDERR: · │ interface `Core.ImplicitAs(u64)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_pass_ulonglong_to_u64.carbon:[[@LINE+2]]:7-21: warning: binding `carbon_u64` unused [UnusedBinding] + // CHECK:STDERR: ╭─┤ fail_pass_ulonglong_to_u64.carbon:[[@LINE+6]]:7 + // CHECK:STDERR: -> │ let carbon_u64: u64 = cpp_unsigned_long_long; + // CHECK:STDERR: · ━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ warning: binding `carbon_u64` unused [UnusedBinding] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let carbon_u64: u64 = cpp_unsigned_long_long; } diff --git a/toolchain/check/testdata/interop/cpp/primitive_types/void.carbon b/toolchain/check/testdata/interop/cpp/primitive_types/void.carbon index c0b7a3922ee0..7503864f5ab2 100644 --- a/toolchain/check/testdata/interop/cpp/primitive_types/void.carbon +++ b/toolchain/check/testdata/interop/cpp/primitive_types/void.carbon @@ -27,8 +27,18 @@ library "[[@TEST_NAME]]"; import Cpp; fn G() { - // CHECK:STDERR: fail_void_abstract.carbon:[[@LINE+3]]:17-24: error: binding pattern has abstract type `Cpp.void` in `var` pattern [AbstractTypeInVarPattern] - // CHECK:STDERR: {{.*}}/prelude/types/cpp/void.carbon:24:1-35: note: class was declared abstract here [ClassAbstractHere] + // CHECK:STDERR: ╭─┤ fail_void_abstract.carbon:[[@LINE+13]]:17 + // CHECK:STDERR: -> │ var unused x: Cpp.void; + // CHECK:STDERR: · ┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: binding pattern has abstract type `Cpp.void` in + // CHECK:STDERR: · ┃ `var` pattern + // CHECK:STDERR: · ┃ [AbstractTypeInVarPattern] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ {{.*}}/prelude/types/cpp/void.carbon + // CHECK:STDERR: │ abstract class CppCompat.VoidBase { + // CHECK:STDERR: · ─────────────────┬───────────────── + // CHECK:STDERR: · ╰──┤ class was declared abstract here [ClassAbstractHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused x: Cpp.void; } @@ -40,17 +50,35 @@ library "[[@TEST_NAME]]"; import Cpp inline "void F(int);"; fn G(v: Cpp.void) { - // CHECK:STDERR: fail_void_argument.carbon:[[@LINE+4]]:3-7: error: no matching function for call to 'F' [CppInteropParseError] - // CHECK:STDERR: fail_void_argument.carbon:[[@LINE-4]]:6: note: candidate function not viable [CppInteropParseNote] - // CHECK:STDERR: fail_void_argument.carbon:[[@LINE-5]]:8-10: note: cannot convert argument of incomplete type 'void' to 'int' for 1st argument [CppInteropParseNoteReason] + // CHECK:STDERR: ╭─┤ fail_void_argument.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ void F(int); + // CHECK:STDERR: · ┬ ┬── + // CHECK:STDERR: · ╰────┤ candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: · ╰────┤ cannot convert argument of incomplete type 'void' to 'int' for 1st + // CHECK:STDERR: · │ argument + // CHECK:STDERR: · │ [CppInteropParseNoteReason] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Cpp.F(v); + // CHECK:STDERR: · ━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'F' [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.F(v); } fn H(p: Cpp.void*) { - // CHECK:STDERR: fail_void_argument.carbon:[[@LINE+4]]:3-7: error: no matching function for call to 'F' [CppInteropParseError] - // CHECK:STDERR: fail_void_argument.carbon:[[@LINE-12]]:6: note: candidate function not viable [CppInteropParseNote] - // CHECK:STDERR: fail_void_argument.carbon:[[@LINE-13]]:8-10: note: cannot convert argument of incomplete type 'void' to 'int' for 1st argument [CppInteropParseNoteReason] + // CHECK:STDERR: ╭─┤ fail_void_argument.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ void F(int); + // CHECK:STDERR: · ┬ ┬── + // CHECK:STDERR: · ╰────┤ candidate function not viable [CppInteropParseNote] + // CHECK:STDERR: · ╰────┤ cannot convert argument of incomplete type 'void' to 'int' for 1st + // CHECK:STDERR: · │ argument + // CHECK:STDERR: · │ [CppInteropParseNoteReason] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Cpp.F(*p); + // CHECK:STDERR: · ━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'F' [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Cpp.F(*p); } diff --git a/toolchain/check/testdata/interop/cpp/primitive_types/void_pointer.carbon b/toolchain/check/testdata/interop/cpp/primitive_types/void_pointer.carbon index fba69818c580..fb9395561f7e 100644 --- a/toolchain/check/testdata/interop/cpp/primitive_types/void_pointer.carbon +++ b/toolchain/check/testdata/interop/cpp/primitive_types/void_pointer.carbon @@ -76,8 +76,16 @@ struct S {}; fn F(input: Cpp.void*) { //@dump-sem-ir-begin - // CHECK:STDERR: fail_explicit_as_from_void_pointer_to_cpp_class_pointer.carbon:[[@LINE+3]]:26-40: error: cannot convert expression of type `void*` to `Cpp.S*` with `as` [ConversionFailure] - // CHECK:STDERR: fail_explicit_as_from_void_pointer_to_cpp_class_pointer.carbon:[[@LINE+2]]:26-40: note: type `Cpp.void*` does not implement interface `Core.As(Cpp.S*)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_explicit_as_from_void_pointer_to_cpp_class_pointer.carbon:[[@LINE+11]]:26 + // CHECK:STDERR: -> │ let unused p: Cpp.S* = input as Cpp.S*; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `void*` + // CHECK:STDERR: · │ ┃ to `Cpp.S*` with `as` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Cpp.void*` does not implement interface + // CHECK:STDERR: · │ `Core.As(Cpp.S*)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused p: Cpp.S* = input as Cpp.S*; //@dump-sem-ir-end @@ -93,8 +101,16 @@ class C {} fn F(input: Cpp.void*) { //@dump-sem-ir-begin - // CHECK:STDERR: fail_explicit_as_from_void_pointer_to_carbon_class_pointer.carbon:[[@LINE+3]]:22-32: error: cannot convert expression of type `void*` to `C*` with `as` [ConversionFailure] - // CHECK:STDERR: fail_explicit_as_from_void_pointer_to_carbon_class_pointer.carbon:[[@LINE+2]]:22-32: note: type `Cpp.void*` does not implement interface `Core.As(C*)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_explicit_as_from_void_pointer_to_carbon_class_pointer.carbon:[[@LINE+11]]:22 + // CHECK:STDERR: -> │ let unused p: C* = input as C*; + // CHECK:STDERR: · ┳━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `void*` to + // CHECK:STDERR: · │ ┃ `C*` with `as` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Cpp.void*` does not implement interface + // CHECK:STDERR: · │ `Core.As(C*)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused p: C* = input as C*; //@dump-sem-ir-end @@ -398,14 +414,14 @@ fn F(input: Cpp.void*) { // CHECK:STDOUT: fn @F(%input.param: %ptr.00a) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %input.ref: %ptr.00a = name_ref input, %input -// CHECK:STDOUT: %Cpp.ref.loc13_35: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %S.ref.loc13_38: type = name_ref S, imports.%S.decl [concrete = constants.%S] -// CHECK:STDOUT: %ptr.loc13_40: type = ptr_type %S.ref.loc13_38 [concrete = constants.%ptr.037] -// CHECK:STDOUT: %.loc13_32: %ptr.037 = converted %input.ref, [concrete = ] -// CHECK:STDOUT: %.loc13_22: type = splice_block %ptr.loc13_22 [concrete = constants.%ptr.037] { -// CHECK:STDOUT: %Cpp.ref.loc13_17: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %S.ref.loc13_20: type = name_ref S, imports.%S.decl [concrete = constants.%S] -// CHECK:STDOUT: %ptr.loc13_22: type = ptr_type %S.ref.loc13_20 [concrete = constants.%ptr.037] +// CHECK:STDOUT: %Cpp.ref.loc21_35: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %S.ref.loc21_38: type = name_ref S, imports.%S.decl [concrete = constants.%S] +// CHECK:STDOUT: %ptr.loc21_40: type = ptr_type %S.ref.loc21_38 [concrete = constants.%ptr.037] +// CHECK:STDOUT: %.loc21_32: %ptr.037 = converted %input.ref, [concrete = ] +// CHECK:STDOUT: %.loc21_22: type = splice_block %ptr.loc21_22 [concrete = constants.%ptr.037] { +// CHECK:STDOUT: %Cpp.ref.loc21_17: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %S.ref.loc21_20: type = name_ref S, imports.%S.decl [concrete = constants.%S] +// CHECK:STDOUT: %ptr.loc21_22: type = ptr_type %S.ref.loc21_20 [concrete = constants.%ptr.037] // CHECK:STDOUT: } // CHECK:STDOUT: %p: %ptr.037 = wrapper_binding p, [concrete = ] // CHECK:STDOUT: name_binding_decl { @@ -429,12 +445,12 @@ fn F(input: Cpp.void*) { // CHECK:STDOUT: fn @F(%input.param: %ptr.00a) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %input.ref: %ptr.00a = name_ref input, %input -// CHECK:STDOUT: %C.ref.loc13_31: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %ptr.loc13_32: type = ptr_type %C.ref.loc13_31 [concrete = constants.%ptr.6b6] -// CHECK:STDOUT: %.loc13_28: %ptr.6b6 = converted %input.ref, [concrete = ] -// CHECK:STDOUT: %.loc13_18: type = splice_block %ptr.loc13_18 [concrete = constants.%ptr.6b6] { -// CHECK:STDOUT: %C.ref.loc13_17: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %ptr.loc13_18: type = ptr_type %C.ref.loc13_17 [concrete = constants.%ptr.6b6] +// CHECK:STDOUT: %C.ref.loc21_31: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %ptr.loc21_32: type = ptr_type %C.ref.loc21_31 [concrete = constants.%ptr.6b6] +// CHECK:STDOUT: %.loc21_28: %ptr.6b6 = converted %input.ref, [concrete = ] +// CHECK:STDOUT: %.loc21_18: type = splice_block %ptr.loc21_18 [concrete = constants.%ptr.6b6] { +// CHECK:STDOUT: %C.ref.loc21_17: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %ptr.loc21_18: type = ptr_type %C.ref.loc21_17 [concrete = constants.%ptr.6b6] // CHECK:STDOUT: } // CHECK:STDOUT: %p: %ptr.6b6 = wrapper_binding p, [concrete = ] // CHECK:STDOUT: name_binding_decl { diff --git a/toolchain/check/testdata/interop/cpp/range_for.carbon b/toolchain/check/testdata/interop/cpp/range_for.carbon index 59cfd669ad25..7694574152a6 100644 --- a/toolchain/check/testdata/interop/cpp/range_for.carbon +++ b/toolchain/check/testdata/interop/cpp/range_for.carbon @@ -243,22 +243,54 @@ class MutableRange { friend auto operator!=(Iterator, Iterator) -> bool; }; public: - // CHECK:STDERR: fail_todo_adl_returns_same_types_mutable.carbon:[[@LINE+3]]:15: error: value expression passed to reference parameter [ValueForRefParam] - // CHECK:STDERR: fail_todo_adl_returns_same_types_mutable.carbon:[[@LINE+2]]:34: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: {{.*}}/prelude/iterate.carbon:41:3-29: note: while building thunk to match the signature of this function [ThunkSignature] + // CHECK:STDERR: ╭─┤ fail_todo_adl_returns_same_types_mutable.carbon:[[@LINE+21]]:15 + // CHECK:STDERR: -> │ friend auto begin(MutableRange&) -> Iterator; + // CHECK:STDERR: · ┳ ┬ + // CHECK:STDERR: · ┗━━━━━━━━━━━━━━━━━━━━━┫ error: value expression passed to + // CHECK:STDERR: · │ ┃ reference parameter + // CHECK:STDERR: · │ ┃ [ValueForRefParam] + // CHECK:STDERR: · ╰────┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ fn TestIterate[R: Core.Iterate where .ElementType = f64](r: R) { + // CHECK:STDERR: · ─────────────────────────┬────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ {{.*}}/prelude/iterate.carbon + // CHECK:STDERR: │ fn Begin(self) -> Iterator; + // CHECK:STDERR: · ─────────────┬───────────── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: friend auto begin(MutableRange&) -> Iterator; + // CHECK:STDERR: ╭─┤ fail_todo_adl_returns_same_types_mutable.carbon:[[@LINE+21]]:15 + // CHECK:STDERR: -> │ friend auto end(MutableRange&) -> Iterator; + // CHECK:STDERR: · ┳ ┬ + // CHECK:STDERR: · ┗━━━━━━━━━━━━━━━━━━━┫ error: value expression passed to reference + // CHECK:STDERR: · │ ┃ parameter + // CHECK:STDERR: · │ ┃ [ValueForRefParam] + // CHECK:STDERR: · ╰────┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ fn TestIterate[R: Core.Iterate where .ElementType = f64](r: R) { + // CHECK:STDERR: · ─────────────────────────┬────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ {{.*}}/prelude/iterate.carbon + // CHECK:STDERR: │ fn End(self) -> Sentinel; + // CHECK:STDERR: · ────────────┬──────────── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: friend auto end(MutableRange&) -> Iterator; }; } // namespace N '''; -// CHECK:STDERR: fail_todo_adl_returns_same_types_mutable.carbon:[[@LINE+7]]:1-64: note: while deducing parameters of generic declared here [DeductionGenericHere] -// CHECK:STDERR: -// CHECK:STDERR: fail_todo_adl_returns_same_types_mutable.carbon:[[@LINE-7]]:15: error: value expression passed to reference parameter [ValueForRefParam] -// CHECK:STDERR: fail_todo_adl_returns_same_types_mutable.carbon:[[@LINE-8]]:32: note: initializing function parameter [InCallToFunctionParam] -// CHECK:STDERR: {{.*}}/prelude/iterate.carbon:42:3-27: note: while building thunk to match the signature of this function [ThunkSignature] -// CHECK:STDERR: fail_todo_adl_returns_same_types_mutable.carbon:[[@LINE+2]]:1-64: note: while deducing parameters of generic declared here [DeductionGenericHere] -// CHECK:STDERR: fn TestIterate[R: Core.Iterate where .ElementType = f64](r: R) { var sum: f64 = 0.0; @@ -355,22 +387,54 @@ class MutableRange { friend auto operator!=(Sentinel, Iterator) -> bool; }; public: - // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+3]]:15: error: value expression passed to reference parameter [ValueForRefParam] - // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+2]]:34: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: {{.*}}/prelude/iterate.carbon:41:3-29: note: while building thunk to match the signature of this function [ThunkSignature] + // CHECK:STDERR: ╭─┤ fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+21]]:15 + // CHECK:STDERR: -> │ friend auto begin(MutableRange&) -> Iterator; + // CHECK:STDERR: · ┳ ┬ + // CHECK:STDERR: · ┗━━━━━━━━━━━━━━━━━━━━━┫ error: value expression passed to + // CHECK:STDERR: · │ ┃ reference parameter + // CHECK:STDERR: · │ ┃ [ValueForRefParam] + // CHECK:STDERR: · ╰────┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ fn TestIterate[R: Core.Iterate where .ElementType = Cpp.DiffMutableADL.Val... + // CHECK:STDERR: · ─────────────────────────┬────────────────────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ {{.*}}/prelude/iterate.carbon + // CHECK:STDERR: │ fn Begin(self) -> Iterator; + // CHECK:STDERR: · ─────────────┬───────────── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: friend auto begin(MutableRange&) -> Iterator; + // CHECK:STDERR: ╭─┤ fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+21]]:15 + // CHECK:STDERR: -> │ friend auto end(MutableRange&) -> Sentinel; + // CHECK:STDERR: · ┳ ┬ + // CHECK:STDERR: · ┗━━━━━━━━━━━━━━━━━━━┫ error: value expression passed to reference + // CHECK:STDERR: · │ ┃ parameter + // CHECK:STDERR: · │ ┃ [ValueForRefParam] + // CHECK:STDERR: · ╰────┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ fn TestIterate[R: Core.Iterate where .ElementType = Cpp.DiffMutableADL.Val... + // CHECK:STDERR: · ─────────────────────────┬────────────────────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ {{.*}}/prelude/iterate.carbon + // CHECK:STDERR: │ fn End(self) -> Sentinel; + // CHECK:STDERR: · ────────────┬──────────── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: friend auto end(MutableRange&) -> Sentinel; }; } '''; -// CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+7]]:1-89: note: while deducing parameters of generic declared here [DeductionGenericHere] -// CHECK:STDERR: -// CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE-7]]:15: error: value expression passed to reference parameter [ValueForRefParam] -// CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE-8]]:32: note: initializing function parameter [InCallToFunctionParam] -// CHECK:STDERR: {{.*}}/prelude/iterate.carbon:42:3-27: note: while building thunk to match the signature of this function [ThunkSignature] -// CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+2]]:1-89: note: while deducing parameters of generic declared here [DeductionGenericHere] -// CHECK:STDERR: fn TestIterate[R: Core.Iterate where .ElementType = Cpp.DiffMutableADL.ValueType](r: R) { var sum: Cpp.DiffMutableADL.ValueType = Cpp.DiffMutableADL.ValueType.ValueType(); @@ -382,11 +446,33 @@ fn TestIterate[R: Core.Iterate where .ElementType = Cpp.DiffMutableADL.ValueType } fn TestIterateDriver(var m: Cpp.DiffMutableADL.MutableRange) { - // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+6]]:3-16: error: semantics TODO: `Rewriting operator== using operator== is not supported` [SemanticsTodo] - // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE-12]]:1-89: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+28]]:3 + // CHECK:STDERR: │ fn TestIterate[R: Core.Iterate where .ElementType = Cpp.DiffMutableADL.Val... + // CHECK:STDERR: · ─────────────────────────┬────────────────────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ TestIterate(m); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: + // CHECK:STDERR: · ┃ `Rewriting operator== using operator== is not supported` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+3]]:3-16: error: cannot convert type `Cpp.DiffMutableADL.MutableRange` into type implementing `Core.Iterate where .(Core.Iterate.ElementType) = Cpp.DiffMutableADL.ValueType as Core.Copy & Core.Destroy` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE-15]]:1-89: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+15]]:3 + // CHECK:STDERR: │ fn TestIterate[R: Core.Iterate where .ElementType = Cpp.DiffMutableADL.Val... + // CHECK:STDERR: · ─────────────────────────┬────────────────────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ TestIterate(m); + // CHECK:STDERR: · ━━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┏━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: cannot convert type `Cpp.DiffMutableADL.MutableRange` into type + // CHECK:STDERR: · ┃ implementing + // CHECK:STDERR: · ┃ `Core.Iterate where .(Core.Iterate.ElementType) = Cpp.DiffMutableADL.ValueType as Core.Copy & Core.Destroy` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: TestIterate(m); } @@ -395,7 +481,14 @@ fn TestRangeFor(var m: Cpp.DiffMutableADL.MutableRange) { var sum: Cpp.DiffMutableADL.ValueType = Cpp.DiffMutableADL.ValueType.ValueType(); //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+2]]:7-44: error: cannot access member of interface `Core.Iterate` in type `Cpp.DiffMutableADL.MutableRange` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+9]]:7 + // CHECK:STDERR: -> │ for (i: Cpp.DiffMutableADL.ValueType in m) { + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.Iterate` in type + // CHECK:STDERR: · ┃ `Cpp.DiffMutableADL.MutableRange` that does not implement that + // CHECK:STDERR: · ┃ interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: for (i: Cpp.DiffMutableADL.ValueType in m) { sum += i; @@ -428,10 +521,50 @@ class MutableAndConstRange { friend auto operator!=(ConstIterator, ConstIterator) -> bool; }; public: - // CHECK:STDERR: fail_todo_adl_overloads.carbon:[[@LINE+3]]:17: error: value expression passed to reference parameter [ValueForRefParam] - // CHECK:STDERR: fail_todo_adl_overloads.carbon:[[@LINE+2]]:44: note: initializing function parameter [InCallToFunctionParam] - // CHECK:STDERR: {{.*}}/prelude/iterate.carbon:41:3-29: note: while building thunk to match the signature of this function [ThunkSignature] + // CHECK:STDERR: ╭─┤ fail_todo_adl_overloads.carbon:[[@LINE+22]]:17 + // CHECK:STDERR: -> │ friend auto begin(MutableAndConstRange&) -> Iterator; + // CHECK:STDERR: · ┳ ┬ + // CHECK:STDERR: · ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫ error: value expression passed + // CHECK:STDERR: · │ ┃ to reference parameter + // CHECK:STDERR: · │ ┃ [ValueForRefParam] + // CHECK:STDERR: · ╰────┤ initializing function + // CHECK:STDERR: · │ parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ fn TestIterate[R: Core.Iterate where .ElementType = Cpp.OverloadADL.ValueT... + // CHECK:STDERR: · ─────────────────────────┬────────────────────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ {{.*}}/prelude/iterate.carbon + // CHECK:STDERR: │ fn Begin(self) -> Iterator; + // CHECK:STDERR: · ─────────────┬───────────── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: friend auto begin(MutableAndConstRange&) -> Iterator; + // CHECK:STDERR: ╭─┤ fail_todo_adl_overloads.carbon:[[@LINE+21]]:17 + // CHECK:STDERR: -> │ friend auto end(MutableAndConstRange&) -> Iterator; + // CHECK:STDERR: · ┳ ┬ + // CHECK:STDERR: · ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━┫ error: value expression passed to + // CHECK:STDERR: · │ ┃ reference parameter + // CHECK:STDERR: · │ ┃ [ValueForRefParam] + // CHECK:STDERR: · ╰────┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ fn TestIterate[R: Core.Iterate where .ElementType = Cpp.OverloadADL.ValueT... + // CHECK:STDERR: · ─────────────────────────┬────────────────────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ {{.*}}/prelude/iterate.carbon + // CHECK:STDERR: │ fn End(self) -> Sentinel; + // CHECK:STDERR: · ────────────┬──────────── + // CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function + // CHECK:STDERR: · │ [ThunkSignature] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: friend auto end(MutableAndConstRange&) -> Iterator; friend auto begin(const MutableAndConstRange&) -> ConstIterator; @@ -440,13 +573,6 @@ class MutableAndConstRange { } '''; -// CHECK:STDERR: fail_todo_adl_overloads.carbon:[[@LINE+7]]:1-86: note: while deducing parameters of generic declared here [DeductionGenericHere] -// CHECK:STDERR: -// CHECK:STDERR: fail_todo_adl_overloads.carbon:[[@LINE-10]]:17: error: value expression passed to reference parameter [ValueForRefParam] -// CHECK:STDERR: fail_todo_adl_overloads.carbon:[[@LINE-11]]:42: note: initializing function parameter [InCallToFunctionParam] -// CHECK:STDERR: {{.*}}/prelude/iterate.carbon:42:3-27: note: while building thunk to match the signature of this function [ThunkSignature] -// CHECK:STDERR: fail_todo_adl_overloads.carbon:[[@LINE+2]]:1-86: note: while deducing parameters of generic declared here [DeductionGenericHere] -// CHECK:STDERR: fn TestIterate[R: Core.Iterate where .ElementType = Cpp.OverloadADL.ValueType](r: R) { var sum: Cpp.OverloadADL.ValueType = Cpp.OverloadADL.ValueType.ValueType(); @@ -551,84 +677,265 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, var begin_function_deleted: Cpp.BeginFunctionDeleted, var end_function_deleted: Cpp.EndFunctionDeleted) { - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-20: error: cannot convert type `Cpp.NoBeginEnd` into type implementing `Core.Iterate` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-17]]:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn Test[R: Core.Iterate](unused r: R) {} + // CHECK:STDERR: · ───────────────────┬─────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Test(no_begin_end); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.NoBeginEnd` into type implementing + // CHECK:STDERR: · ┃ `Core.Iterate` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Test(no_begin_end); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-23: error: cannot convert type `Cpp.NoBeginMethod` into type implementing `Core.Iterate` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-22]]:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn Test[R: Core.Iterate](unused r: R) {} + // CHECK:STDERR: · ───────────────────┬─────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Test(no_begin_method); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.NoBeginMethod` into type implementing + // CHECK:STDERR: · ┃ `Core.Iterate` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Test(no_begin_method); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-21: error: cannot convert type `Cpp.NoEndMethod` into type implementing `Core.Iterate` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-27]]:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn Test[R: Core.Iterate](unused r: R) {} + // CHECK:STDERR: · ───────────────────┬─────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Test(no_end_method); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.NoEndMethod` into type implementing + // CHECK:STDERR: · ┃ `Core.Iterate` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Test(no_end_method); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-20: error: cannot convert type `Cpp.NoBeginADL` into type implementing `Core.Iterate` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-32]]:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn Test[R: Core.Iterate](unused r: R) {} + // CHECK:STDERR: · ───────────────────┬─────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Test(no_begin_adl); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.NoBeginADL` into type implementing + // CHECK:STDERR: · ┃ `Core.Iterate` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Test(no_begin_adl); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-18: error: cannot convert type `Cpp.NoEndADL` into type implementing `Core.Iterate` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-37]]:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn Test[R: Core.Iterate](unused r: R) {} + // CHECK:STDERR: · ───────────────────┬─────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Test(no_end_adl); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.NoEndADL` into type implementing + // CHECK:STDERR: · ┃ `Core.Iterate` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Test(no_end_adl); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-28: error: cannot convert type `Cpp.BeginMethodEndADL` into type implementing `Core.Iterate` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-42]]:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn Test[R: Core.Iterate](unused r: R) {} + // CHECK:STDERR: · ───────────────────┬─────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Test(begin_method_end_adl); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.BeginMethodEndADL` into type implementing + // CHECK:STDERR: · ┃ `Core.Iterate` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Test(begin_method_end_adl); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-28: error: cannot convert type `Cpp.BeginADLEndMethod` into type implementing `Core.Iterate` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-47]]:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn Test[R: Core.Iterate](unused r: R) {} + // CHECK:STDERR: · ───────────────────┬─────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Test(begin_adl_end_method); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.BeginADLEndMethod` into type implementing + // CHECK:STDERR: · ┃ `Core.Iterate` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Test(begin_adl_end_method); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-30: error: cannot convert type `Cpp.BeginFieldEndMethod` into type implementing `Core.Iterate` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-52]]:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn Test[R: Core.Iterate](unused r: R) {} + // CHECK:STDERR: · ───────────────────┬─────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Test(begin_field_end_method); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.BeginFieldEndMethod` into type + // CHECK:STDERR: · ┃ implementing `Core.Iterate` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Test(begin_field_end_method); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-30: error: cannot convert type `Cpp.BeginMethodEndField` into type implementing `Core.Iterate` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-57]]:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn Test[R: Core.Iterate](unused r: R) {} + // CHECK:STDERR: · ───────────────────┬─────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Test(begin_method_end_field); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.BeginMethodEndField` into type + // CHECK:STDERR: · ┃ implementing `Core.Iterate` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Test(begin_method_end_field); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+7]]:28: error: attempt to use a deleted function [CppInteropParseError] - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-82]]:8: note: 'begin' has been explicitly marked deleted here [CppInteropParseNote] - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-63]]:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+30]]:28 + // CHECK:STDERR: │ auto begin() = delete; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ 'begin' has been explicitly marked deleted here + // CHECK:STDERR: · │ [CppInteropParseNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ fn Test[R: Core.Iterate](unused r: R) {} + // CHECK:STDERR: · ───────────────────┬─────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Test(begin_method_deleted); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: attempt to use a deleted function + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-28: error: cannot convert type `Cpp.BeginMethodDeleted` into type implementing `Core.Iterate` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-66]]:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn Test[R: Core.Iterate](unused r: R) {} + // CHECK:STDERR: · ───────────────────┬─────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Test(begin_method_deleted); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.BeginMethodDeleted` into type + // CHECK:STDERR: · ┃ implementing `Core.Iterate` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Test(begin_method_deleted); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+7]]:26: error: attempt to use a deleted function [CppInteropParseError] - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-85]]:8: note: 'end' has been explicitly marked deleted here [CppInteropParseNote] - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-72]]:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+29]]:26 + // CHECK:STDERR: │ auto end() = delete; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ 'end' has been explicitly marked deleted here [CppInteropParseNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ fn Test[R: Core.Iterate](unused r: R) {} + // CHECK:STDERR: · ───────────────────┬─────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Test(end_method_deleted); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: attempt to use a deleted function + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-26: error: cannot convert type `Cpp.EndMethodDeleted` into type implementing `Core.Iterate` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-75]]:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn Test[R: Core.Iterate](unused r: R) {} + // CHECK:STDERR: · ───────────────────┬─────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Test(end_method_deleted); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.EndMethodDeleted` into type implementing + // CHECK:STDERR: · ┃ `Core.Iterate` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Test(end_method_deleted); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+7]]:30: error: call to deleted function 'begin' [CppInteropParseError] - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-90]]:15: note: candidate function has been explicitly deleted [CppInteropParseNote] - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-81]]:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+30]]:30 + // CHECK:STDERR: │ friend auto begin(const BeginFunctionDeleted&) = delete; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ candidate function has been explicitly deleted + // CHECK:STDERR: · │ [CppInteropParseNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ fn Test[R: Core.Iterate](unused r: R) {} + // CHECK:STDERR: · ───────────────────┬─────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Test(begin_function_deleted); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: call to deleted function 'begin' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-30: error: cannot convert type `Cpp.BeginFunctionDeleted` into type implementing `Core.Iterate` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-84]]:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn Test[R: Core.Iterate](unused r: R) {} + // CHECK:STDERR: · ───────────────────┬─────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Test(begin_function_deleted); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.BeginFunctionDeleted` into type + // CHECK:STDERR: · ┃ implementing `Core.Iterate` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Test(begin_function_deleted); - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+7]]:28: error: call to deleted function 'end' [CppInteropParseError] - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-93]]:15: note: candidate function has been explicitly deleted [CppInteropParseNote] - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-90]]:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+30]]:28 + // CHECK:STDERR: │ friend auto end(const EndFunctionDeleted&) = delete; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ candidate function has been explicitly deleted + // CHECK:STDERR: · │ [CppInteropParseNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ fn Test[R: Core.Iterate](unused r: R) {} + // CHECK:STDERR: · ───────────────────┬─────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Test(end_function_deleted); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: call to deleted function 'end' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-28: error: cannot convert type `Cpp.EndFunctionDeleted` into type implementing `Core.Iterate` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_never_valid.carbon:[[@LINE-93]]:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn Test[R: Core.Iterate](unused r: R) {} + // CHECK:STDERR: · ───────────────────┬─────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Test(end_function_deleted); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.EndFunctionDeleted` into type + // CHECK:STDERR: · ┃ implementing `Core.Iterate` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Test(end_function_deleted); } @@ -3112,7 +3419,7 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [concrete] // CHECK:STDOUT: %f64.761: type = class_type @Float, @Float(%int_64) [concrete] // CHECK:STDOUT: %pattern_type.667: type = pattern_type %f64.761 [concrete] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.2: type = fn_type @SubobjectDestroy.WithSelf.Op.loc32 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.2: type = fn_type @SubobjectDestroy.WithSelf.Op.loc64 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.2: %SubobjectDestroy.WithSelf.Op.type.6870fd.2 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80ef6.2: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.2), @SubobjectDestroy [concrete] // CHECK:STDOUT: %SubobjectDestroy.facet.47f: %SubobjectDestroy.type = facet_value %f64.761, (%custom_witness.b80ef6.2) [concrete] @@ -3170,10 +3477,10 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %Float.as.AddAssignWith.impl.Op.type.f20: type = fn_type @Float.as.AddAssignWith.impl.Op, @Float.as.AddAssignWith.impl(%int_64) [concrete] // CHECK:STDOUT: %Float.as.AddAssignWith.impl.Op.e04: %Float.as.AddAssignWith.impl.Op.type.f20 = struct_value () [concrete] // CHECK:STDOUT: %Float.as.AddAssignWith.impl.Op.specific_fn: = specific_function %Float.as.AddAssignWith.impl.Op.e04, @Float.as.AddAssignWith.impl.Op(%int_64) [concrete] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.4: type = fn_type @SubobjectDestroy.WithSelf.Op.loc36_19.2 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.4: type = fn_type @SubobjectDestroy.WithSelf.Op.loc68_19.2 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.4: %SubobjectDestroy.WithSelf.Op.type.6870fd.4 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80ef6.4: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.4), @SubobjectDestroy [concrete] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.5: type = fn_type @SubobjectDestroy.WithSelf.Op.loc36_19.3 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.5: type = fn_type @SubobjectDestroy.WithSelf.Op.loc68_19.3 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.5: %SubobjectDestroy.WithSelf.Op.type.6870fd.5 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80ef6.5: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.5), @SubobjectDestroy [concrete] // CHECK:STDOUT: %SubobjectDestroy.facet.a87: %SubobjectDestroy.type = facet_value bool, (%custom_witness.b80ef6.5) [concrete] @@ -3182,7 +3489,7 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %SubobjectDestroy.facet.708: %SubobjectDestroy.type = facet_value %MaybeUnformed.f92, (%custom_witness.b80ef6.4) [concrete] // CHECK:STDOUT: %DestroyImpl.impl_witness.6fa: = impl_witness imports.%DestroyImpl.impl_witness_table, @T.as_type.as.DestroyImpl.impl(%SubobjectDestroy.facet.708) [concrete] // CHECK:STDOUT: %Destroy.facet.489: %Destroy.type = facet_value %MaybeUnformed.f92, (%custom_witness.b80ef6.4, %DestroyImpl.impl_witness.6fa) [concrete] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.8: type = fn_type @SubobjectDestroy.WithSelf.Op.loc36_19.6 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.8: type = fn_type @SubobjectDestroy.WithSelf.Op.loc68_19.6 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.8: %SubobjectDestroy.WithSelf.Op.type.6870fd.8 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80ef6.8: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.8), @SubobjectDestroy [concrete] // CHECK:STDOUT: %SubobjectDestroy.facet.cdd: %SubobjectDestroy.type = facet_value %Optional.ebe, (%custom_witness.b80ef6.8) [concrete] @@ -3270,161 +3577,161 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %field_decl.bce: @DefaultOptionalStorage.%DefaultOptionalStorage.elem.1 (%DefaultOptionalStorage.elem.ff3) = field_decl value, element0, %Core.import_ref.45d in [concrete] {} // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @TestIterate(%R.loc32_17.2: %Iterate_where.type.a66) { +// CHECK:STDOUT: generic fn @TestIterate(%R.loc64_17.2: %Iterate_where.type.a66) { // CHECK:STDOUT: // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: -// CHECK:STDOUT: %Iterate.lookup_impl_witness: = lookup_impl_witness %R.loc32_17.1, @Iterate [symbolic = %Iterate.lookup_impl_witness (constants.%Iterate.lookup_impl_witness.6fa)] -// CHECK:STDOUT: %Iterate.facet.loc36_19.5: %Iterate.type = facet_value %R.as_type.loc32_61.1, (%Iterate.lookup_impl_witness) [symbolic = %Iterate.facet.loc36_19.5 (constants.%Iterate.facet.e8c)] -// CHECK:STDOUT: %Iterate.WithSelf.NewCursor.type: type = fn_type @Iterate.WithSelf.NewCursor, @Iterate.WithSelf(%Iterate.facet.loc36_19.5) [symbolic = %Iterate.WithSelf.NewCursor.type (constants.%Iterate.WithSelf.NewCursor.type.a57)] -// CHECK:STDOUT: %.loc36_19.23: type = fn_type_with_self_type %Iterate.WithSelf.NewCursor.type, %Iterate.facet.loc36_19.5 [symbolic = %.loc36_19.23 (constants.%.b10)] -// CHECK:STDOUT: %impl.elem2.loc36_19.2: @TestIterate.%.loc36_19.23 (%.b10) = impl_witness_access %Iterate.lookup_impl_witness, element2 [symbolic = %impl.elem2.loc36_19.2 (constants.%impl.elem2.81a)] -// CHECK:STDOUT: %specific_impl_fn.loc36_19.3: = specific_impl_function %impl.elem2.loc36_19.2, @Iterate.WithSelf.NewCursor(%Iterate.facet.loc36_19.5) [symbolic = %specific_impl_fn.loc36_19.3 (constants.%specific_impl_fn.6ec)] +// CHECK:STDOUT: %Iterate.lookup_impl_witness: = lookup_impl_witness %R.loc64_17.1, @Iterate [symbolic = %Iterate.lookup_impl_witness (constants.%Iterate.lookup_impl_witness.6fa)] +// CHECK:STDOUT: %Iterate.facet.loc68_19.5: %Iterate.type = facet_value %R.as_type.loc64_61.1, (%Iterate.lookup_impl_witness) [symbolic = %Iterate.facet.loc68_19.5 (constants.%Iterate.facet.e8c)] +// CHECK:STDOUT: %Iterate.WithSelf.NewCursor.type: type = fn_type @Iterate.WithSelf.NewCursor, @Iterate.WithSelf(%Iterate.facet.loc68_19.5) [symbolic = %Iterate.WithSelf.NewCursor.type (constants.%Iterate.WithSelf.NewCursor.type.a57)] +// CHECK:STDOUT: %.loc68_19.23: type = fn_type_with_self_type %Iterate.WithSelf.NewCursor.type, %Iterate.facet.loc68_19.5 [symbolic = %.loc68_19.23 (constants.%.b10)] +// CHECK:STDOUT: %impl.elem2.loc68_19.2: @TestIterate.%.loc68_19.23 (%.b10) = impl_witness_access %Iterate.lookup_impl_witness, element2 [symbolic = %impl.elem2.loc68_19.2 (constants.%impl.elem2.81a)] +// CHECK:STDOUT: %specific_impl_fn.loc68_19.3: = specific_impl_function %impl.elem2.loc68_19.2, @Iterate.WithSelf.NewCursor(%Iterate.facet.loc68_19.5) [symbolic = %specific_impl_fn.loc68_19.3 (constants.%specific_impl_fn.6ec)] // CHECK:STDOUT: -// CHECK:STDOUT: %Iterate.WithSelf.Next.type: type = fn_type @Iterate.WithSelf.Next, @Iterate.WithSelf(%Iterate.facet.loc36_19.5) [symbolic = %Iterate.WithSelf.Next.type (constants.%Iterate.WithSelf.Next.type.01e)] -// CHECK:STDOUT: %.loc36_19.24: type = fn_type_with_self_type %Iterate.WithSelf.Next.type, %Iterate.facet.loc36_19.5 [symbolic = %.loc36_19.24 (constants.%.063)] -// CHECK:STDOUT: %impl.elem3.loc36_19.2: @TestIterate.%.loc36_19.24 (%.063) = impl_witness_access %Iterate.lookup_impl_witness, element3 [symbolic = %impl.elem3.loc36_19.2 (constants.%impl.elem3.ae5)] -// CHECK:STDOUT: %specific_impl_fn.loc36_19.4: = specific_impl_function %impl.elem3.loc36_19.2, @Iterate.WithSelf.Next(%Iterate.facet.loc36_19.5) [symbolic = %specific_impl_fn.loc36_19.4 (constants.%specific_impl_fn.2e1)] +// CHECK:STDOUT: %Iterate.WithSelf.Next.type: type = fn_type @Iterate.WithSelf.Next, @Iterate.WithSelf(%Iterate.facet.loc68_19.5) [symbolic = %Iterate.WithSelf.Next.type (constants.%Iterate.WithSelf.Next.type.01e)] +// CHECK:STDOUT: %.loc68_19.24: type = fn_type_with_self_type %Iterate.WithSelf.Next.type, %Iterate.facet.loc68_19.5 [symbolic = %.loc68_19.24 (constants.%.063)] +// CHECK:STDOUT: %impl.elem3.loc68_19.2: @TestIterate.%.loc68_19.24 (%.063) = impl_witness_access %Iterate.lookup_impl_witness, element3 [symbolic = %impl.elem3.loc68_19.2 (constants.%impl.elem3.ae5)] +// CHECK:STDOUT: %specific_impl_fn.loc68_19.4: = specific_impl_function %impl.elem3.loc68_19.2, @Iterate.WithSelf.Next(%Iterate.facet.loc68_19.5) [symbolic = %specific_impl_fn.loc68_19.4 (constants.%specific_impl_fn.2e1)] // CHECK:STDOUT: // CHECK:STDOUT: -// CHECK:STDOUT: fn(%r.param: @TestIterate.%R.as_type.loc32_61.1 (%R.as_type)) { +// CHECK:STDOUT: fn(%r.param: @TestIterate.%R.as_type.loc64_61.1 (%R.as_type)) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %i.patt: %pattern_type.667 = value_binding_pattern i [concrete = constants.%i.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %r.ref: @TestIterate.%R.as_type.loc32_61.1 (%R.as_type) = name_ref r, %r -// CHECK:STDOUT: %impl.elem2.loc36_19.1: @TestIterate.%.loc36_19.23 (%.b10) = impl_witness_access constants.%Iterate.lookup_impl_witness.6fa, element2 [symbolic = %impl.elem2.loc36_19.2 (constants.%impl.elem2.81a)] -// CHECK:STDOUT: %bound_method.loc36_19.1: = bound_method %r.ref, %impl.elem2.loc36_19.1 -// CHECK:STDOUT: %Iterate.facet.loc36_19.1: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.6fa) [symbolic = %Iterate.facet.loc36_19.5 (constants.%Iterate.facet.e8c)] -// CHECK:STDOUT: %.loc36_19.1: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc36_19.1 [symbolic = %Iterate.facet.loc36_19.5 (constants.%Iterate.facet.e8c)] -// CHECK:STDOUT: %Iterate.facet.loc36_19.2: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.6fa) [symbolic = %Iterate.facet.loc36_19.5 (constants.%Iterate.facet.e8c)] -// CHECK:STDOUT: %.loc36_19.2: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc36_19.2 [symbolic = %Iterate.facet.loc36_19.5 (constants.%Iterate.facet.e8c)] -// CHECK:STDOUT: %specific_impl_fn.loc36_19.1: = specific_impl_function %impl.elem2.loc36_19.1, @Iterate.WithSelf.NewCursor(constants.%Iterate.facet.e8c) [symbolic = %specific_impl_fn.loc36_19.3 (constants.%specific_impl_fn.6ec)] -// CHECK:STDOUT: %bound_method.loc36_19.2: = bound_method %r.ref, %specific_impl_fn.loc36_19.1 +// CHECK:STDOUT: %r.ref: @TestIterate.%R.as_type.loc64_61.1 (%R.as_type) = name_ref r, %r +// CHECK:STDOUT: %impl.elem2.loc68_19.1: @TestIterate.%.loc68_19.23 (%.b10) = impl_witness_access constants.%Iterate.lookup_impl_witness.6fa, element2 [symbolic = %impl.elem2.loc68_19.2 (constants.%impl.elem2.81a)] +// CHECK:STDOUT: %bound_method.loc68_19.1: = bound_method %r.ref, %impl.elem2.loc68_19.1 +// CHECK:STDOUT: %Iterate.facet.loc68_19.1: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.6fa) [symbolic = %Iterate.facet.loc68_19.5 (constants.%Iterate.facet.e8c)] +// CHECK:STDOUT: %.loc68_19.1: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc68_19.1 [symbolic = %Iterate.facet.loc68_19.5 (constants.%Iterate.facet.e8c)] +// CHECK:STDOUT: %Iterate.facet.loc68_19.2: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.6fa) [symbolic = %Iterate.facet.loc68_19.5 (constants.%Iterate.facet.e8c)] +// CHECK:STDOUT: %.loc68_19.2: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc68_19.2 [symbolic = %Iterate.facet.loc68_19.5 (constants.%Iterate.facet.e8c)] +// CHECK:STDOUT: %specific_impl_fn.loc68_19.1: = specific_impl_function %impl.elem2.loc68_19.1, @Iterate.WithSelf.NewCursor(constants.%Iterate.facet.e8c) [symbolic = %specific_impl_fn.loc68_19.3 (constants.%specific_impl_fn.6ec)] +// CHECK:STDOUT: %bound_method.loc68_19.2: = bound_method %r.ref, %specific_impl_fn.loc68_19.1 // CHECK:STDOUT: %var: ref @TestIterate.%as_type (%as_type.deb) = var_storage invalid -// CHECK:STDOUT: %Iterate.WithSelf.NewCursor.call: init @TestIterate.%as_type (%as_type.deb) to %var = call %bound_method.loc36_19.2(%r.ref) +// CHECK:STDOUT: %Iterate.WithSelf.NewCursor.call: init @TestIterate.%as_type (%as_type.deb) to %var = call %bound_method.loc68_19.2(%r.ref) // CHECK:STDOUT: assign %var, %Iterate.WithSelf.NewCursor.call // CHECK:STDOUT: br !for.next // CHECK:STDOUT: // CHECK:STDOUT: !for.next: -// CHECK:STDOUT: %impl.elem3.loc36_19.1: @TestIterate.%.loc36_19.24 (%.063) = impl_witness_access constants.%Iterate.lookup_impl_witness.6fa, element3 [symbolic = %impl.elem3.loc36_19.2 (constants.%impl.elem3.ae5)] -// CHECK:STDOUT: %bound_method.loc36_19.3: = bound_method %r.ref, %impl.elem3.loc36_19.1 -// CHECK:STDOUT: %Iterate.facet.loc36_19.3: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.6fa) [symbolic = %Iterate.facet.loc36_19.5 (constants.%Iterate.facet.e8c)] -// CHECK:STDOUT: %.loc36_19.3: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc36_19.3 [symbolic = %Iterate.facet.loc36_19.5 (constants.%Iterate.facet.e8c)] -// CHECK:STDOUT: %Iterate.facet.loc36_19.4: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.6fa) [symbolic = %Iterate.facet.loc36_19.5 (constants.%Iterate.facet.e8c)] -// CHECK:STDOUT: %.loc36_19.4: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc36_19.4 [symbolic = %Iterate.facet.loc36_19.5 (constants.%Iterate.facet.e8c)] -// CHECK:STDOUT: %.loc36_19.5: %Destroy.type = converted constants.%as_type.deb, constants.%impl.elem1.7dd [symbolic = %impl.elem1 (constants.%impl.elem1.7dd)] -// CHECK:STDOUT: %.loc36_19.6: %Destroy.type = converted constants.%as_type.deb, constants.%impl.elem1.7dd [symbolic = %impl.elem1 (constants.%impl.elem1.7dd)] -// CHECK:STDOUT: %specific_impl_fn.loc36_19.2: = specific_impl_function %impl.elem3.loc36_19.1, @Iterate.WithSelf.Next(constants.%Iterate.facet.e8c) [symbolic = %specific_impl_fn.loc36_19.4 (constants.%specific_impl_fn.2e1)] -// CHECK:STDOUT: %bound_method.loc36_19.4: = bound_method %r.ref, %specific_impl_fn.loc36_19.2 -// CHECK:STDOUT: %.loc36_19.7: ref %Optional.ebe = temporary_storage -// CHECK:STDOUT: %Iterate.WithSelf.Next.call: init %Optional.ebe to %.loc36_19.7 = call %bound_method.loc36_19.4(%r.ref, %var) -// CHECK:STDOUT: %.loc36_19.8: ref %Optional.ebe = temporary %.loc36_19.7, %Iterate.WithSelf.Next.call -// CHECK:STDOUT: %.loc36_19.9: %Optional.HasValue.type.1cf = specific_constant imports.%Core.import_ref.c82, @Optional(constants.%OptionalStorage.facet.19f) [concrete = constants.%Optional.HasValue.768] -// CHECK:STDOUT: %HasValue.ref: %Optional.HasValue.type.1cf = name_ref HasValue, %.loc36_19.9 [concrete = constants.%Optional.HasValue.768] -// CHECK:STDOUT: %Optional.HasValue.bound: = bound_method %.loc36_19.8, %HasValue.ref +// CHECK:STDOUT: %impl.elem3.loc68_19.1: @TestIterate.%.loc68_19.24 (%.063) = impl_witness_access constants.%Iterate.lookup_impl_witness.6fa, element3 [symbolic = %impl.elem3.loc68_19.2 (constants.%impl.elem3.ae5)] +// CHECK:STDOUT: %bound_method.loc68_19.3: = bound_method %r.ref, %impl.elem3.loc68_19.1 +// CHECK:STDOUT: %Iterate.facet.loc68_19.3: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.6fa) [symbolic = %Iterate.facet.loc68_19.5 (constants.%Iterate.facet.e8c)] +// CHECK:STDOUT: %.loc68_19.3: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc68_19.3 [symbolic = %Iterate.facet.loc68_19.5 (constants.%Iterate.facet.e8c)] +// CHECK:STDOUT: %Iterate.facet.loc68_19.4: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.6fa) [symbolic = %Iterate.facet.loc68_19.5 (constants.%Iterate.facet.e8c)] +// CHECK:STDOUT: %.loc68_19.4: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc68_19.4 [symbolic = %Iterate.facet.loc68_19.5 (constants.%Iterate.facet.e8c)] +// CHECK:STDOUT: %.loc68_19.5: %Destroy.type = converted constants.%as_type.deb, constants.%impl.elem1.7dd [symbolic = %impl.elem1 (constants.%impl.elem1.7dd)] +// CHECK:STDOUT: %.loc68_19.6: %Destroy.type = converted constants.%as_type.deb, constants.%impl.elem1.7dd [symbolic = %impl.elem1 (constants.%impl.elem1.7dd)] +// CHECK:STDOUT: %specific_impl_fn.loc68_19.2: = specific_impl_function %impl.elem3.loc68_19.1, @Iterate.WithSelf.Next(constants.%Iterate.facet.e8c) [symbolic = %specific_impl_fn.loc68_19.4 (constants.%specific_impl_fn.2e1)] +// CHECK:STDOUT: %bound_method.loc68_19.4: = bound_method %r.ref, %specific_impl_fn.loc68_19.2 +// CHECK:STDOUT: %.loc68_19.7: ref %Optional.ebe = temporary_storage +// CHECK:STDOUT: %Iterate.WithSelf.Next.call: init %Optional.ebe to %.loc68_19.7 = call %bound_method.loc68_19.4(%r.ref, %var) +// CHECK:STDOUT: %.loc68_19.8: ref %Optional.ebe = temporary %.loc68_19.7, %Iterate.WithSelf.Next.call +// CHECK:STDOUT: %.loc68_19.9: %Optional.HasValue.type.1cf = specific_constant imports.%Core.import_ref.c82, @Optional(constants.%OptionalStorage.facet.19f) [concrete = constants.%Optional.HasValue.768] +// CHECK:STDOUT: %HasValue.ref: %Optional.HasValue.type.1cf = name_ref HasValue, %.loc68_19.9 [concrete = constants.%Optional.HasValue.768] +// CHECK:STDOUT: %Optional.HasValue.bound: = bound_method %.loc68_19.8, %HasValue.ref // CHECK:STDOUT: %Optional.HasValue.specific_fn: = specific_function %HasValue.ref, @Optional.HasValue(constants.%OptionalStorage.facet.19f) [concrete = constants.%Optional.HasValue.specific_fn.89a] -// CHECK:STDOUT: %bound_method.loc36_19.5: = bound_method %.loc36_19.8, %Optional.HasValue.specific_fn -// CHECK:STDOUT: %.loc36_19.10: %Optional.ebe = acquire_value %.loc36_19.8 -// CHECK:STDOUT: %Optional.HasValue.call: init bool = call %bound_method.loc36_19.5(%.loc36_19.10) -// CHECK:STDOUT: %.loc36_19.11: bool = value_of_initializer %Optional.HasValue.call -// CHECK:STDOUT: %.loc36_19.12: bool = converted %Optional.HasValue.call, %.loc36_19.11 -// CHECK:STDOUT: if %.loc36_19.12 br !for.body else br !for.done +// CHECK:STDOUT: %bound_method.loc68_19.5: = bound_method %.loc68_19.8, %Optional.HasValue.specific_fn +// CHECK:STDOUT: %.loc68_19.10: %Optional.ebe = acquire_value %.loc68_19.8 +// CHECK:STDOUT: %Optional.HasValue.call: init bool = call %bound_method.loc68_19.5(%.loc68_19.10) +// CHECK:STDOUT: %.loc68_19.11: bool = value_of_initializer %Optional.HasValue.call +// CHECK:STDOUT: %.loc68_19.12: bool = converted %Optional.HasValue.call, %.loc68_19.11 +// CHECK:STDOUT: if %.loc68_19.12 br !for.body else br !for.done // CHECK:STDOUT: // CHECK:STDOUT: !for.body: -// CHECK:STDOUT: %.loc36_19.13: %Optional.Get.type.b2d = specific_constant imports.%Core.import_ref.29e, @Optional(constants.%OptionalStorage.facet.19f) [concrete = constants.%Optional.Get.f12] -// CHECK:STDOUT: %Get.ref: %Optional.Get.type.b2d = name_ref Get, %.loc36_19.13 [concrete = constants.%Optional.Get.f12] -// CHECK:STDOUT: %Optional.Get.bound: = bound_method %.loc36_19.8, %Get.ref +// CHECK:STDOUT: %.loc68_19.13: %Optional.Get.type.b2d = specific_constant imports.%Core.import_ref.29e, @Optional(constants.%OptionalStorage.facet.19f) [concrete = constants.%Optional.Get.f12] +// CHECK:STDOUT: %Get.ref: %Optional.Get.type.b2d = name_ref Get, %.loc68_19.13 [concrete = constants.%Optional.Get.f12] +// CHECK:STDOUT: %Optional.Get.bound: = bound_method %.loc68_19.8, %Get.ref // CHECK:STDOUT: %Optional.Get.specific_fn: = specific_function %Get.ref, @Optional.Get(constants.%OptionalStorage.facet.19f) [concrete = constants.%Optional.Get.specific_fn.67e] -// CHECK:STDOUT: %bound_method.loc36_19.6: = bound_method %.loc36_19.8, %Optional.Get.specific_fn -// CHECK:STDOUT: %.loc36_19.14: %Optional.ebe = acquire_value %.loc36_19.8 -// CHECK:STDOUT: %Optional.Get.call: init %f64.761 = call %bound_method.loc36_19.6(%.loc36_19.14) -// CHECK:STDOUT: %.loc36_19.15: %f64.761 = value_of_initializer %Optional.Get.call -// CHECK:STDOUT: %.loc36_19.16: %f64.761 = converted %Optional.Get.call, %.loc36_19.15 -// CHECK:STDOUT: %f64.loc36: type = type_literal constants.%f64.761 [concrete = constants.%f64.761] -// CHECK:STDOUT: %i: %f64.761 = wrapper_binding i, %.loc36_19.16 +// CHECK:STDOUT: %bound_method.loc68_19.6: = bound_method %.loc68_19.8, %Optional.Get.specific_fn +// CHECK:STDOUT: %.loc68_19.14: %Optional.ebe = acquire_value %.loc68_19.8 +// CHECK:STDOUT: %Optional.Get.call: init %f64.761 = call %bound_method.loc68_19.6(%.loc68_19.14) +// CHECK:STDOUT: %.loc68_19.15: %f64.761 = value_of_initializer %Optional.Get.call +// CHECK:STDOUT: %.loc68_19.16: %f64.761 = converted %Optional.Get.call, %.loc68_19.15 +// CHECK:STDOUT: %f64.loc68: type = type_literal constants.%f64.761 [concrete = constants.%f64.761] +// CHECK:STDOUT: %i: %f64.761 = wrapper_binding i, %.loc68_19.16 // CHECK:STDOUT: %sum.ref: ref %f64.761 = name_ref sum, %sum // CHECK:STDOUT: %i.ref: %f64.761 = name_ref i, %i -// CHECK:STDOUT: %impl.elem0.loc37: %.48b = impl_witness_access constants.%AddAssignWith.impl_witness.5c7, element0 [concrete = constants.%Float.as.AddAssignWith.impl.Op.e04] -// CHECK:STDOUT: %bound_method.loc37_9.1: = bound_method %sum.ref, %impl.elem0.loc37 -// CHECK:STDOUT: %specific_fn.loc37: = specific_function %impl.elem0.loc37, @Float.as.AddAssignWith.impl.Op(constants.%int_64) [concrete = constants.%Float.as.AddAssignWith.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc37_9.2: = bound_method %sum.ref, %specific_fn.loc37 -// CHECK:STDOUT: %Float.as.AddAssignWith.impl.Op.call: init %empty_tuple.type = call %bound_method.loc37_9.2(%sum.ref, %i.ref) -// CHECK:STDOUT: %Destroy.facet.loc36_19.1: %Destroy.type = facet_value constants.%Optional.ebe, (constants.%custom_witness.b80ef6.8, constants.%DestroyImpl.impl_witness.6e5) [concrete = constants.%Destroy.facet.54d] -// CHECK:STDOUT: %.loc36_19.17: %Destroy.type = converted constants.%Optional.ebe, %Destroy.facet.loc36_19.1 [concrete = constants.%Destroy.facet.54d] -// CHECK:STDOUT: %Destroy.facet.loc36_19.2: %Destroy.type = facet_value constants.%Optional.ebe, (constants.%custom_witness.b80ef6.8, constants.%DestroyImpl.impl_witness.6e5) [concrete = constants.%Destroy.facet.54d] -// CHECK:STDOUT: %.loc36_19.18: %Destroy.type = converted constants.%Optional.ebe, %Destroy.facet.loc36_19.2 [concrete = constants.%Destroy.facet.54d] +// CHECK:STDOUT: %impl.elem0.loc69: %.48b = impl_witness_access constants.%AddAssignWith.impl_witness.5c7, element0 [concrete = constants.%Float.as.AddAssignWith.impl.Op.e04] +// CHECK:STDOUT: %bound_method.loc69_9.1: = bound_method %sum.ref, %impl.elem0.loc69 +// CHECK:STDOUT: %specific_fn.loc69: = specific_function %impl.elem0.loc69, @Float.as.AddAssignWith.impl.Op(constants.%int_64) [concrete = constants.%Float.as.AddAssignWith.impl.Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc69_9.2: = bound_method %sum.ref, %specific_fn.loc69 +// CHECK:STDOUT: %Float.as.AddAssignWith.impl.Op.call: init %empty_tuple.type = call %bound_method.loc69_9.2(%sum.ref, %i.ref) +// CHECK:STDOUT: %Destroy.facet.loc68_19.1: %Destroy.type = facet_value constants.%Optional.ebe, (constants.%custom_witness.b80ef6.8, constants.%DestroyImpl.impl_witness.6e5) [concrete = constants.%Destroy.facet.54d] +// CHECK:STDOUT: %.loc68_19.17: %Destroy.type = converted constants.%Optional.ebe, %Destroy.facet.loc68_19.1 [concrete = constants.%Destroy.facet.54d] +// CHECK:STDOUT: %Destroy.facet.loc68_19.2: %Destroy.type = facet_value constants.%Optional.ebe, (constants.%custom_witness.b80ef6.8, constants.%DestroyImpl.impl_witness.6e5) [concrete = constants.%Destroy.facet.54d] +// CHECK:STDOUT: %.loc68_19.18: %Destroy.type = converted constants.%Optional.ebe, %Destroy.facet.loc68_19.2 [concrete = constants.%Destroy.facet.54d] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc36_19.1: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%.loc36_19.8) +// CHECK:STDOUT: %SelfDestruct.call.loc68_19.1: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%.loc68_19.8) // CHECK:STDOUT: br !for.next // CHECK:STDOUT: // CHECK:STDOUT: !for.done: -// CHECK:STDOUT: %Destroy.facet.loc36_19.3: %Destroy.type = facet_value constants.%Optional.ebe, (constants.%custom_witness.b80ef6.8, constants.%DestroyImpl.impl_witness.6e5) [concrete = constants.%Destroy.facet.54d] -// CHECK:STDOUT: %.loc36_19.19: %Destroy.type = converted constants.%Optional.ebe, %Destroy.facet.loc36_19.3 [concrete = constants.%Destroy.facet.54d] -// CHECK:STDOUT: %Destroy.facet.loc36_19.4: %Destroy.type = facet_value constants.%Optional.ebe, (constants.%custom_witness.b80ef6.8, constants.%DestroyImpl.impl_witness.6e5) [concrete = constants.%Destroy.facet.54d] -// CHECK:STDOUT: %.loc36_19.20: %Destroy.type = converted constants.%Optional.ebe, %Destroy.facet.loc36_19.4 [concrete = constants.%Destroy.facet.54d] +// CHECK:STDOUT: %Destroy.facet.loc68_19.3: %Destroy.type = facet_value constants.%Optional.ebe, (constants.%custom_witness.b80ef6.8, constants.%DestroyImpl.impl_witness.6e5) [concrete = constants.%Destroy.facet.54d] +// CHECK:STDOUT: %.loc68_19.19: %Destroy.type = converted constants.%Optional.ebe, %Destroy.facet.loc68_19.3 [concrete = constants.%Destroy.facet.54d] +// CHECK:STDOUT: %Destroy.facet.loc68_19.4: %Destroy.type = facet_value constants.%Optional.ebe, (constants.%custom_witness.b80ef6.8, constants.%DestroyImpl.impl_witness.6e5) [concrete = constants.%Destroy.facet.54d] +// CHECK:STDOUT: %.loc68_19.20: %Destroy.type = converted constants.%Optional.ebe, %Destroy.facet.loc68_19.4 [concrete = constants.%Destroy.facet.54d] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc36_19.2: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%.loc36_19.8) -// CHECK:STDOUT: %.loc36_19.21: %Destroy.type = converted constants.%as_type.deb, constants.%impl.elem1.7dd [symbolic = %impl.elem1 (constants.%impl.elem1.7dd)] -// CHECK:STDOUT: %.loc36_19.22: %Destroy.type = converted constants.%as_type.deb, constants.%impl.elem1.7dd [symbolic = %impl.elem1 (constants.%impl.elem1.7dd)] +// CHECK:STDOUT: %SelfDestruct.call.loc68_19.2: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%.loc68_19.8) +// CHECK:STDOUT: %.loc68_19.21: %Destroy.type = converted constants.%as_type.deb, constants.%impl.elem1.7dd [symbolic = %impl.elem1 (constants.%impl.elem1.7dd)] +// CHECK:STDOUT: %.loc68_19.22: %Destroy.type = converted constants.%as_type.deb, constants.%impl.elem1.7dd [symbolic = %impl.elem1 (constants.%impl.elem1.7dd)] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc36_19.3: init %empty_tuple.type = call %SelfDestruct.specific_fn.3(%var) +// CHECK:STDOUT: %SelfDestruct.call.loc68_19.3: init %empty_tuple.type = call %SelfDestruct.specific_fn.3(%var) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc36_19.1(%self.param: ref %.ecc) { +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc68_19.1(%self.param: ref %.ecc) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc36_19.2(%self.param: ref %MaybeUnformed.f92) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc68_19.2(%self.param: ref %MaybeUnformed.f92) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc36_19.3(%self.param: ref bool) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc68_19.3(%self.param: ref bool) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc36_19.4(%self.param: ref %struct_type.value.has_value.e0a) { +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc68_19.4(%self.param: ref %struct_type.value.has_value.e0a) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc36_19.1: ref bool = struct_access %self.param, element1 -// CHECK:STDOUT: %Destroy.facet.loc36_19.1: %Destroy.type = facet_value bool, (constants.%custom_witness.b80ef6.5, constants.%DestroyImpl.impl_witness.778) [concrete = constants.%Destroy.facet.80c] -// CHECK:STDOUT: %.loc36_19.2: %Destroy.type = converted bool, %Destroy.facet.loc36_19.1 [concrete = constants.%Destroy.facet.80c] -// CHECK:STDOUT: %Destroy.facet.loc36_19.2: %Destroy.type = facet_value bool, (constants.%custom_witness.b80ef6.5, constants.%DestroyImpl.impl_witness.778) [concrete = constants.%Destroy.facet.80c] -// CHECK:STDOUT: %.loc36_19.3: %Destroy.type = converted bool, %Destroy.facet.loc36_19.2 [concrete = constants.%Destroy.facet.80c] +// CHECK:STDOUT: %.loc68_19.1: ref bool = struct_access %self.param, element1 +// CHECK:STDOUT: %Destroy.facet.loc68_19.1: %Destroy.type = facet_value bool, (constants.%custom_witness.b80ef6.5, constants.%DestroyImpl.impl_witness.778) [concrete = constants.%Destroy.facet.80c] +// CHECK:STDOUT: %.loc68_19.2: %Destroy.type = converted bool, %Destroy.facet.loc68_19.1 [concrete = constants.%Destroy.facet.80c] +// CHECK:STDOUT: %Destroy.facet.loc68_19.2: %Destroy.type = facet_value bool, (constants.%custom_witness.b80ef6.5, constants.%DestroyImpl.impl_witness.778) [concrete = constants.%Destroy.facet.80c] +// CHECK:STDOUT: %.loc68_19.3: %Destroy.type = converted bool, %Destroy.facet.loc68_19.2 [concrete = constants.%Destroy.facet.80c] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc36_19.1: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%.loc36_19.1) -// CHECK:STDOUT: %.loc36_19.4: ref %MaybeUnformed.f92 = struct_access %self.param, element0 -// CHECK:STDOUT: %Destroy.facet.loc36_19.3: %Destroy.type = facet_value constants.%MaybeUnformed.f92, (constants.%custom_witness.b80ef6.4, constants.%DestroyImpl.impl_witness.6fa) [concrete = constants.%Destroy.facet.489] -// CHECK:STDOUT: %.loc36_19.5: %Destroy.type = converted constants.%MaybeUnformed.f92, %Destroy.facet.loc36_19.3 [concrete = constants.%Destroy.facet.489] -// CHECK:STDOUT: %Destroy.facet.loc36_19.4: %Destroy.type = facet_value constants.%MaybeUnformed.f92, (constants.%custom_witness.b80ef6.4, constants.%DestroyImpl.impl_witness.6fa) [concrete = constants.%Destroy.facet.489] -// CHECK:STDOUT: %.loc36_19.6: %Destroy.type = converted constants.%MaybeUnformed.f92, %Destroy.facet.loc36_19.4 [concrete = constants.%Destroy.facet.489] +// CHECK:STDOUT: %SelfDestruct.call.loc68_19.1: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%.loc68_19.1) +// CHECK:STDOUT: %.loc68_19.4: ref %MaybeUnformed.f92 = struct_access %self.param, element0 +// CHECK:STDOUT: %Destroy.facet.loc68_19.3: %Destroy.type = facet_value constants.%MaybeUnformed.f92, (constants.%custom_witness.b80ef6.4, constants.%DestroyImpl.impl_witness.6fa) [concrete = constants.%Destroy.facet.489] +// CHECK:STDOUT: %.loc68_19.5: %Destroy.type = converted constants.%MaybeUnformed.f92, %Destroy.facet.loc68_19.3 [concrete = constants.%Destroy.facet.489] +// CHECK:STDOUT: %Destroy.facet.loc68_19.4: %Destroy.type = facet_value constants.%MaybeUnformed.f92, (constants.%custom_witness.b80ef6.4, constants.%DestroyImpl.impl_witness.6fa) [concrete = constants.%Destroy.facet.489] +// CHECK:STDOUT: %.loc68_19.6: %Destroy.type = converted constants.%MaybeUnformed.f92, %Destroy.facet.loc68_19.4 [concrete = constants.%Destroy.facet.489] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc36_19.2: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%.loc36_19.4) +// CHECK:STDOUT: %SelfDestruct.call.loc68_19.2: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%.loc68_19.4) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc36_19.5(%self.param: ref %DefaultOptionalStorage.f55) { +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc68_19.5(%self.param: ref %DefaultOptionalStorage.f55) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %has_value.ref: %DefaultOptionalStorage.elem.34a = name_ref has_value, imports.%Core.import_ref.9ce [concrete = imports.%field_decl.dbe] -// CHECK:STDOUT: %.loc36_19.1: ref bool = class_element_access %self.param, element1 -// CHECK:STDOUT: %Destroy.facet.loc36_19.1: %Destroy.type = facet_value bool, (constants.%custom_witness.b80ef6.5, constants.%DestroyImpl.impl_witness.778) [concrete = constants.%Destroy.facet.80c] -// CHECK:STDOUT: %.loc36_19.2: %Destroy.type = converted bool, %Destroy.facet.loc36_19.1 [concrete = constants.%Destroy.facet.80c] -// CHECK:STDOUT: %Destroy.facet.loc36_19.2: %Destroy.type = facet_value bool, (constants.%custom_witness.b80ef6.5, constants.%DestroyImpl.impl_witness.778) [concrete = constants.%Destroy.facet.80c] -// CHECK:STDOUT: %.loc36_19.3: %Destroy.type = converted bool, %Destroy.facet.loc36_19.2 [concrete = constants.%Destroy.facet.80c] +// CHECK:STDOUT: %.loc68_19.1: ref bool = class_element_access %self.param, element1 +// CHECK:STDOUT: %Destroy.facet.loc68_19.1: %Destroy.type = facet_value bool, (constants.%custom_witness.b80ef6.5, constants.%DestroyImpl.impl_witness.778) [concrete = constants.%Destroy.facet.80c] +// CHECK:STDOUT: %.loc68_19.2: %Destroy.type = converted bool, %Destroy.facet.loc68_19.1 [concrete = constants.%Destroy.facet.80c] +// CHECK:STDOUT: %Destroy.facet.loc68_19.2: %Destroy.type = facet_value bool, (constants.%custom_witness.b80ef6.5, constants.%DestroyImpl.impl_witness.778) [concrete = constants.%Destroy.facet.80c] +// CHECK:STDOUT: %.loc68_19.3: %Destroy.type = converted bool, %Destroy.facet.loc68_19.2 [concrete = constants.%Destroy.facet.80c] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc36_19.1: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%.loc36_19.1) +// CHECK:STDOUT: %SelfDestruct.call.loc68_19.1: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%.loc68_19.1) // CHECK:STDOUT: %value.ref: %DefaultOptionalStorage.elem.345 = name_ref value, imports.%Core.import_ref.e86 [concrete = imports.%field_decl.bce] -// CHECK:STDOUT: %.loc36_19.4: ref %MaybeUnformed.f92 = class_element_access %self.param, element0 -// CHECK:STDOUT: %Destroy.facet.loc36_19.3: %Destroy.type = facet_value constants.%MaybeUnformed.f92, (constants.%custom_witness.b80ef6.4, constants.%DestroyImpl.impl_witness.6fa) [concrete = constants.%Destroy.facet.489] -// CHECK:STDOUT: %.loc36_19.5: %Destroy.type = converted constants.%MaybeUnformed.f92, %Destroy.facet.loc36_19.3 [concrete = constants.%Destroy.facet.489] -// CHECK:STDOUT: %Destroy.facet.loc36_19.4: %Destroy.type = facet_value constants.%MaybeUnformed.f92, (constants.%custom_witness.b80ef6.4, constants.%DestroyImpl.impl_witness.6fa) [concrete = constants.%Destroy.facet.489] -// CHECK:STDOUT: %.loc36_19.6: %Destroy.type = converted constants.%MaybeUnformed.f92, %Destroy.facet.loc36_19.4 [concrete = constants.%Destroy.facet.489] +// CHECK:STDOUT: %.loc68_19.4: ref %MaybeUnformed.f92 = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.facet.loc68_19.3: %Destroy.type = facet_value constants.%MaybeUnformed.f92, (constants.%custom_witness.b80ef6.4, constants.%DestroyImpl.impl_witness.6fa) [concrete = constants.%Destroy.facet.489] +// CHECK:STDOUT: %.loc68_19.5: %Destroy.type = converted constants.%MaybeUnformed.f92, %Destroy.facet.loc68_19.3 [concrete = constants.%Destroy.facet.489] +// CHECK:STDOUT: %Destroy.facet.loc68_19.4: %Destroy.type = facet_value constants.%MaybeUnformed.f92, (constants.%custom_witness.b80ef6.4, constants.%DestroyImpl.impl_witness.6fa) [concrete = constants.%Destroy.facet.489] +// CHECK:STDOUT: %.loc68_19.6: %Destroy.type = converted constants.%MaybeUnformed.f92, %Destroy.facet.loc68_19.4 [concrete = constants.%Destroy.facet.489] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc36_19.2: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%.loc36_19.4) +// CHECK:STDOUT: %SelfDestruct.call.loc68_19.2: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%.loc68_19.4) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc36_19.6(%self.param: ref %Optional.ebe) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc68_19.6(%self.param: ref %Optional.ebe) = "no_op"; // CHECK:STDOUT: // CHECK:STDOUT: fn @TestRangeFor(%m.param: ref %MutableRange) { // CHECK:STDOUT: !entry: @@ -3434,118 +3741,118 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: } // CHECK:STDOUT: %m.ref: ref %MutableRange = name_ref m, %m // CHECK:STDOUT: %impl.elem2: %.03d = impl_witness_access constants.%Iterate.impl_witness.8a2, element2 [concrete = constants.%T.as_type.as.Iterate.impl.NewCursor.3c2] -// CHECK:STDOUT: %bound_method.loc50_19.1: = bound_method %m.ref, %impl.elem2 -// CHECK:STDOUT: %facet_value.loc50_19.1: %CppRange_where.type.d682d6.1 = facet_value constants.%MutableRange, (constants.%custom_witness.902, constants.%custom_witness.f01, constants.%DestroyImpl.impl_witness.256, constants.%custom_witness.0a8, constants.%custom_witness.491, constants.%custom_witness.068, constants.%custom_witness.b80ef6.2, constants.%DestroyImpl.impl_witness.a23, constants.%Copy.impl_witness.eac, constants.%custom_witness.f01, constants.%DestroyImpl.impl_witness.256) [concrete = constants.%facet_value.13f] -// CHECK:STDOUT: %.loc50_19.1: %CppRange_where.type.d682d6.1 = converted constants.%MutableRange, %facet_value.loc50_19.1 [concrete = constants.%facet_value.13f] -// CHECK:STDOUT: %facet_value.loc50_19.2: %CppRange_where.type.d682d6.1 = facet_value constants.%MutableRange, (constants.%custom_witness.902, constants.%custom_witness.f01, constants.%DestroyImpl.impl_witness.256, constants.%custom_witness.0a8, constants.%custom_witness.491, constants.%custom_witness.068, constants.%custom_witness.b80ef6.2, constants.%DestroyImpl.impl_witness.a23, constants.%Copy.impl_witness.eac, constants.%custom_witness.f01, constants.%DestroyImpl.impl_witness.256) [concrete = constants.%facet_value.13f] -// CHECK:STDOUT: %.loc50_19.2: %CppRange_where.type.d682d6.1 = converted constants.%MutableRange, %facet_value.loc50_19.2 [concrete = constants.%facet_value.13f] -// CHECK:STDOUT: %specific_fn.loc50_19.1: = specific_function %impl.elem2, @T.as_type.as.Iterate.impl.NewCursor(constants.%facet_value.13f) [concrete = constants.%T.as_type.as.Iterate.impl.NewCursor.specific_fn] -// CHECK:STDOUT: %bound_method.loc50_19.2: = bound_method %m.ref, %specific_fn.loc50_19.1 +// CHECK:STDOUT: %bound_method.loc82_19.1: = bound_method %m.ref, %impl.elem2 +// CHECK:STDOUT: %facet_value.loc82_19.1: %CppRange_where.type.d682d6.1 = facet_value constants.%MutableRange, (constants.%custom_witness.902, constants.%custom_witness.f01, constants.%DestroyImpl.impl_witness.256, constants.%custom_witness.0a8, constants.%custom_witness.491, constants.%custom_witness.068, constants.%custom_witness.b80ef6.2, constants.%DestroyImpl.impl_witness.a23, constants.%Copy.impl_witness.eac, constants.%custom_witness.f01, constants.%DestroyImpl.impl_witness.256) [concrete = constants.%facet_value.13f] +// CHECK:STDOUT: %.loc82_19.1: %CppRange_where.type.d682d6.1 = converted constants.%MutableRange, %facet_value.loc82_19.1 [concrete = constants.%facet_value.13f] +// CHECK:STDOUT: %facet_value.loc82_19.2: %CppRange_where.type.d682d6.1 = facet_value constants.%MutableRange, (constants.%custom_witness.902, constants.%custom_witness.f01, constants.%DestroyImpl.impl_witness.256, constants.%custom_witness.0a8, constants.%custom_witness.491, constants.%custom_witness.068, constants.%custom_witness.b80ef6.2, constants.%DestroyImpl.impl_witness.a23, constants.%Copy.impl_witness.eac, constants.%custom_witness.f01, constants.%DestroyImpl.impl_witness.256) [concrete = constants.%facet_value.13f] +// CHECK:STDOUT: %.loc82_19.2: %CppRange_where.type.d682d6.1 = converted constants.%MutableRange, %facet_value.loc82_19.2 [concrete = constants.%facet_value.13f] +// CHECK:STDOUT: %specific_fn.loc82_19.1: = specific_function %impl.elem2, @T.as_type.as.Iterate.impl.NewCursor(constants.%facet_value.13f) [concrete = constants.%T.as_type.as.Iterate.impl.NewCursor.specific_fn] +// CHECK:STDOUT: %bound_method.loc82_19.2: = bound_method %m.ref, %specific_fn.loc82_19.1 // CHECK:STDOUT: %var: ref %tuple.type.dd0 = var_storage invalid -// CHECK:STDOUT: %.loc50_18.1: %MutableRange = acquire_value %m.ref -// CHECK:STDOUT: %T.as_type.as.Iterate.impl.NewCursor.call: init %tuple.type.dd0 to %var = call %bound_method.loc50_19.2(%.loc50_18.1) +// CHECK:STDOUT: %.loc82_18.1: %MutableRange = acquire_value %m.ref +// CHECK:STDOUT: %T.as_type.as.Iterate.impl.NewCursor.call: init %tuple.type.dd0 to %var = call %bound_method.loc82_19.2(%.loc82_18.1) // CHECK:STDOUT: assign %var, %T.as_type.as.Iterate.impl.NewCursor.call // CHECK:STDOUT: br !for.next // CHECK:STDOUT: // CHECK:STDOUT: !for.next: // CHECK:STDOUT: %impl.elem3: %.ab45 = impl_witness_access constants.%Iterate.impl_witness.8a2, element3 [concrete = constants.%T.as_type.as.Iterate.impl.Next.bc3] -// CHECK:STDOUT: %bound_method.loc50_19.3: = bound_method %m.ref, %impl.elem3 -// CHECK:STDOUT: %facet_value.loc50_19.3: %CppRange_where.type.d682d6.1 = facet_value constants.%MutableRange, (constants.%custom_witness.902, constants.%custom_witness.f01, constants.%DestroyImpl.impl_witness.256, constants.%custom_witness.0a8, constants.%custom_witness.491, constants.%custom_witness.068, constants.%custom_witness.b80ef6.2, constants.%DestroyImpl.impl_witness.a23, constants.%Copy.impl_witness.eac, constants.%custom_witness.f01, constants.%DestroyImpl.impl_witness.256) [concrete = constants.%facet_value.13f] -// CHECK:STDOUT: %.loc50_19.3: %CppRange_where.type.d682d6.1 = converted constants.%MutableRange, %facet_value.loc50_19.3 [concrete = constants.%facet_value.13f] -// CHECK:STDOUT: %facet_value.loc50_19.4: %CppRange_where.type.d682d6.1 = facet_value constants.%MutableRange, (constants.%custom_witness.902, constants.%custom_witness.f01, constants.%DestroyImpl.impl_witness.256, constants.%custom_witness.0a8, constants.%custom_witness.491, constants.%custom_witness.068, constants.%custom_witness.b80ef6.2, constants.%DestroyImpl.impl_witness.a23, constants.%Copy.impl_witness.eac, constants.%custom_witness.f01, constants.%DestroyImpl.impl_witness.256) [concrete = constants.%facet_value.13f] -// CHECK:STDOUT: %.loc50_19.4: %CppRange_where.type.d682d6.1 = converted constants.%MutableRange, %facet_value.loc50_19.4 [concrete = constants.%facet_value.13f] -// CHECK:STDOUT: %specific_fn.loc50_19.2: = specific_function %impl.elem3, @T.as_type.as.Iterate.impl.Next(constants.%facet_value.13f) [concrete = constants.%T.as_type.as.Iterate.impl.Next.specific_fn] -// CHECK:STDOUT: %bound_method.loc50_19.4: = bound_method %m.ref, %specific_fn.loc50_19.2 -// CHECK:STDOUT: %.loc50_19.5: ref %Optional.ebe = temporary_storage -// CHECK:STDOUT: %.loc50_18.2: %MutableRange = acquire_value %m.ref -// CHECK:STDOUT: %T.as_type.as.Iterate.impl.Next.call: init %Optional.ebe to %.loc50_19.5 = call %bound_method.loc50_19.4(%.loc50_18.2, %var) -// CHECK:STDOUT: %.loc50_19.6: ref %Optional.ebe = temporary %.loc50_19.5, %T.as_type.as.Iterate.impl.Next.call -// CHECK:STDOUT: %.loc50_19.7: %Optional.HasValue.type.1cf = specific_constant imports.%Core.import_ref.c82, @Optional(constants.%OptionalStorage.facet.19f) [concrete = constants.%Optional.HasValue.768] -// CHECK:STDOUT: %HasValue.ref: %Optional.HasValue.type.1cf = name_ref HasValue, %.loc50_19.7 [concrete = constants.%Optional.HasValue.768] -// CHECK:STDOUT: %Optional.HasValue.bound: = bound_method %.loc50_19.6, %HasValue.ref +// CHECK:STDOUT: %bound_method.loc82_19.3: = bound_method %m.ref, %impl.elem3 +// CHECK:STDOUT: %facet_value.loc82_19.3: %CppRange_where.type.d682d6.1 = facet_value constants.%MutableRange, (constants.%custom_witness.902, constants.%custom_witness.f01, constants.%DestroyImpl.impl_witness.256, constants.%custom_witness.0a8, constants.%custom_witness.491, constants.%custom_witness.068, constants.%custom_witness.b80ef6.2, constants.%DestroyImpl.impl_witness.a23, constants.%Copy.impl_witness.eac, constants.%custom_witness.f01, constants.%DestroyImpl.impl_witness.256) [concrete = constants.%facet_value.13f] +// CHECK:STDOUT: %.loc82_19.3: %CppRange_where.type.d682d6.1 = converted constants.%MutableRange, %facet_value.loc82_19.3 [concrete = constants.%facet_value.13f] +// CHECK:STDOUT: %facet_value.loc82_19.4: %CppRange_where.type.d682d6.1 = facet_value constants.%MutableRange, (constants.%custom_witness.902, constants.%custom_witness.f01, constants.%DestroyImpl.impl_witness.256, constants.%custom_witness.0a8, constants.%custom_witness.491, constants.%custom_witness.068, constants.%custom_witness.b80ef6.2, constants.%DestroyImpl.impl_witness.a23, constants.%Copy.impl_witness.eac, constants.%custom_witness.f01, constants.%DestroyImpl.impl_witness.256) [concrete = constants.%facet_value.13f] +// CHECK:STDOUT: %.loc82_19.4: %CppRange_where.type.d682d6.1 = converted constants.%MutableRange, %facet_value.loc82_19.4 [concrete = constants.%facet_value.13f] +// CHECK:STDOUT: %specific_fn.loc82_19.2: = specific_function %impl.elem3, @T.as_type.as.Iterate.impl.Next(constants.%facet_value.13f) [concrete = constants.%T.as_type.as.Iterate.impl.Next.specific_fn] +// CHECK:STDOUT: %bound_method.loc82_19.4: = bound_method %m.ref, %specific_fn.loc82_19.2 +// CHECK:STDOUT: %.loc82_19.5: ref %Optional.ebe = temporary_storage +// CHECK:STDOUT: %.loc82_18.2: %MutableRange = acquire_value %m.ref +// CHECK:STDOUT: %T.as_type.as.Iterate.impl.Next.call: init %Optional.ebe to %.loc82_19.5 = call %bound_method.loc82_19.4(%.loc82_18.2, %var) +// CHECK:STDOUT: %.loc82_19.6: ref %Optional.ebe = temporary %.loc82_19.5, %T.as_type.as.Iterate.impl.Next.call +// CHECK:STDOUT: %.loc82_19.7: %Optional.HasValue.type.1cf = specific_constant imports.%Core.import_ref.c82, @Optional(constants.%OptionalStorage.facet.19f) [concrete = constants.%Optional.HasValue.768] +// CHECK:STDOUT: %HasValue.ref: %Optional.HasValue.type.1cf = name_ref HasValue, %.loc82_19.7 [concrete = constants.%Optional.HasValue.768] +// CHECK:STDOUT: %Optional.HasValue.bound: = bound_method %.loc82_19.6, %HasValue.ref // CHECK:STDOUT: %Optional.HasValue.specific_fn: = specific_function %HasValue.ref, @Optional.HasValue(constants.%OptionalStorage.facet.19f) [concrete = constants.%Optional.HasValue.specific_fn.89a] -// CHECK:STDOUT: %bound_method.loc50_19.5: = bound_method %.loc50_19.6, %Optional.HasValue.specific_fn -// CHECK:STDOUT: %.loc50_19.8: %Optional.ebe = acquire_value %.loc50_19.6 -// CHECK:STDOUT: %Optional.HasValue.call: init bool = call %bound_method.loc50_19.5(%.loc50_19.8) -// CHECK:STDOUT: %.loc50_19.9: bool = value_of_initializer %Optional.HasValue.call -// CHECK:STDOUT: %.loc50_19.10: bool = converted %Optional.HasValue.call, %.loc50_19.9 -// CHECK:STDOUT: if %.loc50_19.10 br !for.body else br !for.done +// CHECK:STDOUT: %bound_method.loc82_19.5: = bound_method %.loc82_19.6, %Optional.HasValue.specific_fn +// CHECK:STDOUT: %.loc82_19.8: %Optional.ebe = acquire_value %.loc82_19.6 +// CHECK:STDOUT: %Optional.HasValue.call: init bool = call %bound_method.loc82_19.5(%.loc82_19.8) +// CHECK:STDOUT: %.loc82_19.9: bool = value_of_initializer %Optional.HasValue.call +// CHECK:STDOUT: %.loc82_19.10: bool = converted %Optional.HasValue.call, %.loc82_19.9 +// CHECK:STDOUT: if %.loc82_19.10 br !for.body else br !for.done // CHECK:STDOUT: // CHECK:STDOUT: !for.body: -// CHECK:STDOUT: %.loc50_19.11: %Optional.Get.type.b2d = specific_constant imports.%Core.import_ref.29e, @Optional(constants.%OptionalStorage.facet.19f) [concrete = constants.%Optional.Get.f12] -// CHECK:STDOUT: %Get.ref: %Optional.Get.type.b2d = name_ref Get, %.loc50_19.11 [concrete = constants.%Optional.Get.f12] -// CHECK:STDOUT: %Optional.Get.bound: = bound_method %.loc50_19.6, %Get.ref +// CHECK:STDOUT: %.loc82_19.11: %Optional.Get.type.b2d = specific_constant imports.%Core.import_ref.29e, @Optional(constants.%OptionalStorage.facet.19f) [concrete = constants.%Optional.Get.f12] +// CHECK:STDOUT: %Get.ref: %Optional.Get.type.b2d = name_ref Get, %.loc82_19.11 [concrete = constants.%Optional.Get.f12] +// CHECK:STDOUT: %Optional.Get.bound: = bound_method %.loc82_19.6, %Get.ref // CHECK:STDOUT: %Optional.Get.specific_fn: = specific_function %Get.ref, @Optional.Get(constants.%OptionalStorage.facet.19f) [concrete = constants.%Optional.Get.specific_fn.67e] -// CHECK:STDOUT: %bound_method.loc50_19.6: = bound_method %.loc50_19.6, %Optional.Get.specific_fn -// CHECK:STDOUT: %.loc50_19.12: %Optional.ebe = acquire_value %.loc50_19.6 -// CHECK:STDOUT: %Optional.Get.call: init %f64.761 = call %bound_method.loc50_19.6(%.loc50_19.12) -// CHECK:STDOUT: %.loc50_19.13: %f64.761 = value_of_initializer %Optional.Get.call -// CHECK:STDOUT: %.loc50_19.14: %f64.761 = converted %Optional.Get.call, %.loc50_19.13 -// CHECK:STDOUT: %f64.loc50: type = type_literal constants.%f64.761 [concrete = constants.%f64.761] -// CHECK:STDOUT: %i: %f64.761 = wrapper_binding i, %.loc50_19.14 +// CHECK:STDOUT: %bound_method.loc82_19.6: = bound_method %.loc82_19.6, %Optional.Get.specific_fn +// CHECK:STDOUT: %.loc82_19.12: %Optional.ebe = acquire_value %.loc82_19.6 +// CHECK:STDOUT: %Optional.Get.call: init %f64.761 = call %bound_method.loc82_19.6(%.loc82_19.12) +// CHECK:STDOUT: %.loc82_19.13: %f64.761 = value_of_initializer %Optional.Get.call +// CHECK:STDOUT: %.loc82_19.14: %f64.761 = converted %Optional.Get.call, %.loc82_19.13 +// CHECK:STDOUT: %f64.loc82: type = type_literal constants.%f64.761 [concrete = constants.%f64.761] +// CHECK:STDOUT: %i: %f64.761 = wrapper_binding i, %.loc82_19.14 // CHECK:STDOUT: %sum.ref: ref %f64.761 = name_ref sum, %sum // CHECK:STDOUT: %i.ref: %f64.761 = name_ref i, %i -// CHECK:STDOUT: %impl.elem0.loc51: %.48b = impl_witness_access constants.%AddAssignWith.impl_witness.5c7, element0 [concrete = constants.%Float.as.AddAssignWith.impl.Op.e04] -// CHECK:STDOUT: %bound_method.loc51_9.1: = bound_method %sum.ref, %impl.elem0.loc51 -// CHECK:STDOUT: %specific_fn.loc51: = specific_function %impl.elem0.loc51, @Float.as.AddAssignWith.impl.Op(constants.%int_64) [concrete = constants.%Float.as.AddAssignWith.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc51_9.2: = bound_method %sum.ref, %specific_fn.loc51 -// CHECK:STDOUT: %Float.as.AddAssignWith.impl.Op.call: init %empty_tuple.type = call %bound_method.loc51_9.2(%sum.ref, %i.ref) -// CHECK:STDOUT: %Destroy.facet.loc50_19.1: %Destroy.type = facet_value constants.%Optional.ebe, (constants.%custom_witness.b80ef6.8, constants.%DestroyImpl.impl_witness.6e5) [concrete = constants.%Destroy.facet.54d] -// CHECK:STDOUT: %.loc50_19.15: %Destroy.type = converted constants.%Optional.ebe, %Destroy.facet.loc50_19.1 [concrete = constants.%Destroy.facet.54d] -// CHECK:STDOUT: %Destroy.facet.loc50_19.2: %Destroy.type = facet_value constants.%Optional.ebe, (constants.%custom_witness.b80ef6.8, constants.%DestroyImpl.impl_witness.6e5) [concrete = constants.%Destroy.facet.54d] -// CHECK:STDOUT: %.loc50_19.16: %Destroy.type = converted constants.%Optional.ebe, %Destroy.facet.loc50_19.2 [concrete = constants.%Destroy.facet.54d] +// CHECK:STDOUT: %impl.elem0.loc83: %.48b = impl_witness_access constants.%AddAssignWith.impl_witness.5c7, element0 [concrete = constants.%Float.as.AddAssignWith.impl.Op.e04] +// CHECK:STDOUT: %bound_method.loc83_9.1: = bound_method %sum.ref, %impl.elem0.loc83 +// CHECK:STDOUT: %specific_fn.loc83: = specific_function %impl.elem0.loc83, @Float.as.AddAssignWith.impl.Op(constants.%int_64) [concrete = constants.%Float.as.AddAssignWith.impl.Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc83_9.2: = bound_method %sum.ref, %specific_fn.loc83 +// CHECK:STDOUT: %Float.as.AddAssignWith.impl.Op.call: init %empty_tuple.type = call %bound_method.loc83_9.2(%sum.ref, %i.ref) +// CHECK:STDOUT: %Destroy.facet.loc82_19.1: %Destroy.type = facet_value constants.%Optional.ebe, (constants.%custom_witness.b80ef6.8, constants.%DestroyImpl.impl_witness.6e5) [concrete = constants.%Destroy.facet.54d] +// CHECK:STDOUT: %.loc82_19.15: %Destroy.type = converted constants.%Optional.ebe, %Destroy.facet.loc82_19.1 [concrete = constants.%Destroy.facet.54d] +// CHECK:STDOUT: %Destroy.facet.loc82_19.2: %Destroy.type = facet_value constants.%Optional.ebe, (constants.%custom_witness.b80ef6.8, constants.%DestroyImpl.impl_witness.6e5) [concrete = constants.%Destroy.facet.54d] +// CHECK:STDOUT: %.loc82_19.16: %Destroy.type = converted constants.%Optional.ebe, %Destroy.facet.loc82_19.2 [concrete = constants.%Destroy.facet.54d] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc50_19.1: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%.loc50_19.6) +// CHECK:STDOUT: %SelfDestruct.call.loc82_19.1: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%.loc82_19.6) // CHECK:STDOUT: br !for.next // CHECK:STDOUT: // CHECK:STDOUT: !for.done: -// CHECK:STDOUT: %Destroy.facet.loc50_19.3: %Destroy.type = facet_value constants.%Optional.ebe, (constants.%custom_witness.b80ef6.8, constants.%DestroyImpl.impl_witness.6e5) [concrete = constants.%Destroy.facet.54d] -// CHECK:STDOUT: %.loc50_19.17: %Destroy.type = converted constants.%Optional.ebe, %Destroy.facet.loc50_19.3 [concrete = constants.%Destroy.facet.54d] -// CHECK:STDOUT: %Destroy.facet.loc50_19.4: %Destroy.type = facet_value constants.%Optional.ebe, (constants.%custom_witness.b80ef6.8, constants.%DestroyImpl.impl_witness.6e5) [concrete = constants.%Destroy.facet.54d] -// CHECK:STDOUT: %.loc50_19.18: %Destroy.type = converted constants.%Optional.ebe, %Destroy.facet.loc50_19.4 [concrete = constants.%Destroy.facet.54d] +// CHECK:STDOUT: %Destroy.facet.loc82_19.3: %Destroy.type = facet_value constants.%Optional.ebe, (constants.%custom_witness.b80ef6.8, constants.%DestroyImpl.impl_witness.6e5) [concrete = constants.%Destroy.facet.54d] +// CHECK:STDOUT: %.loc82_19.17: %Destroy.type = converted constants.%Optional.ebe, %Destroy.facet.loc82_19.3 [concrete = constants.%Destroy.facet.54d] +// CHECK:STDOUT: %Destroy.facet.loc82_19.4: %Destroy.type = facet_value constants.%Optional.ebe, (constants.%custom_witness.b80ef6.8, constants.%DestroyImpl.impl_witness.6e5) [concrete = constants.%Destroy.facet.54d] +// CHECK:STDOUT: %.loc82_19.18: %Destroy.type = converted constants.%Optional.ebe, %Destroy.facet.loc82_19.4 [concrete = constants.%Destroy.facet.54d] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc50_19.2: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%.loc50_19.6) -// CHECK:STDOUT: %Destroy.facet.loc50_19.5: %Destroy.type = facet_value constants.%tuple.type.dd0, (constants.%custom_witness.b80ef6.9, constants.%DestroyImpl.impl_witness.1fa) [concrete = constants.%Destroy.facet.5f38] -// CHECK:STDOUT: %.loc50_19.19: %Destroy.type = converted constants.%tuple.type.dd0, %Destroy.facet.loc50_19.5 [concrete = constants.%Destroy.facet.5f38] -// CHECK:STDOUT: %Destroy.facet.loc50_19.6: %Destroy.type = facet_value constants.%tuple.type.dd0, (constants.%custom_witness.b80ef6.9, constants.%DestroyImpl.impl_witness.1fa) [concrete = constants.%Destroy.facet.5f38] -// CHECK:STDOUT: %.loc50_19.20: %Destroy.type = converted constants.%tuple.type.dd0, %Destroy.facet.loc50_19.6 [concrete = constants.%Destroy.facet.5f38] +// CHECK:STDOUT: %SelfDestruct.call.loc82_19.2: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%.loc82_19.6) +// CHECK:STDOUT: %Destroy.facet.loc82_19.5: %Destroy.type = facet_value constants.%tuple.type.dd0, (constants.%custom_witness.b80ef6.9, constants.%DestroyImpl.impl_witness.1fa) [concrete = constants.%Destroy.facet.5f38] +// CHECK:STDOUT: %.loc82_19.19: %Destroy.type = converted constants.%tuple.type.dd0, %Destroy.facet.loc82_19.5 [concrete = constants.%Destroy.facet.5f38] +// CHECK:STDOUT: %Destroy.facet.loc82_19.6: %Destroy.type = facet_value constants.%tuple.type.dd0, (constants.%custom_witness.b80ef6.9, constants.%DestroyImpl.impl_witness.1fa) [concrete = constants.%Destroy.facet.5f38] +// CHECK:STDOUT: %.loc82_19.20: %Destroy.type = converted constants.%tuple.type.dd0, %Destroy.facet.loc82_19.6 [concrete = constants.%Destroy.facet.5f38] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc50_19.3: init %empty_tuple.type = call %SelfDestruct.specific_fn.3(%var) +// CHECK:STDOUT: %SelfDestruct.call.loc82_19.3: init %empty_tuple.type = call %SelfDestruct.specific_fn.3(%var) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @TestIterate(constants.%R) { -// CHECK:STDOUT: %R.patt.loc32_17.2 => constants.%R.patt -// CHECK:STDOUT: %R.loc32_17.1 => constants.%R -// CHECK:STDOUT: %R.as_type.loc32_61.1 => constants.%R.as_type +// CHECK:STDOUT: %R.patt.loc64_17.2 => constants.%R.patt +// CHECK:STDOUT: %R.loc64_17.1 => constants.%R +// CHECK:STDOUT: %R.as_type.loc64_61.1 => constants.%R.as_type // CHECK:STDOUT: %pattern_type => constants.%pattern_type.c3b -// CHECK:STDOUT: %r.param_patt.loc32_59.2 => constants.%r.param_patt.304 -// CHECK:STDOUT: %r.patt.loc32_59.2 => constants.%r.patt.240 +// CHECK:STDOUT: %r.param_patt.loc64_59.2 => constants.%r.param_patt.304 +// CHECK:STDOUT: %r.patt.loc64_59.2 => constants.%r.patt.240 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @TestIterate(constants.%facet_value.5f7) { -// CHECK:STDOUT: %R.patt.loc32_17.2 => constants.%R.patt -// CHECK:STDOUT: %R.loc32_17.1 => constants.%facet_value.5f7 -// CHECK:STDOUT: %R.as_type.loc32_61.1 => constants.%MutableRange +// CHECK:STDOUT: %R.patt.loc64_17.2 => constants.%R.patt +// CHECK:STDOUT: %R.loc64_17.1 => constants.%facet_value.5f7 +// CHECK:STDOUT: %R.as_type.loc64_61.1 => constants.%MutableRange // CHECK:STDOUT: %pattern_type => constants.%pattern_type.992 -// CHECK:STDOUT: %r.param_patt.loc32_59.2 => constants.%r.param_patt.aeb -// CHECK:STDOUT: %r.patt.loc32_59.2 => constants.%r.patt.892 +// CHECK:STDOUT: %r.param_patt.loc64_59.2 => constants.%r.param_patt.aeb +// CHECK:STDOUT: %r.patt.loc64_59.2 => constants.%r.patt.892 // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete.loc32 => constants.%complete_type.357 +// CHECK:STDOUT: %require_complete.loc64 => constants.%complete_type.357 // CHECK:STDOUT: %Iterate.lookup_impl_witness => constants.%Iterate.impl_witness.8a2 -// CHECK:STDOUT: %Iterate.facet.loc36_19.5 => constants.%Iterate.facet.602 +// CHECK:STDOUT: %Iterate.facet.loc68_19.5 => constants.%Iterate.facet.602 // CHECK:STDOUT: %Iterate.WithSelf.NewCursor.type => constants.%Iterate.WithSelf.NewCursor.type.748 -// CHECK:STDOUT: %.loc36_19.23 => constants.%.03d -// CHECK:STDOUT: %impl.elem2.loc36_19.2 => constants.%T.as_type.as.Iterate.impl.NewCursor.3c2 -// CHECK:STDOUT: %specific_impl_fn.loc36_19.3 => constants.%T.as_type.as.Iterate.impl.NewCursor.specific_fn +// CHECK:STDOUT: %.loc68_19.23 => constants.%.03d +// CHECK:STDOUT: %impl.elem2.loc68_19.2 => constants.%T.as_type.as.Iterate.impl.NewCursor.3c2 +// CHECK:STDOUT: %specific_impl_fn.loc68_19.3 => constants.%T.as_type.as.Iterate.impl.NewCursor.specific_fn // CHECK:STDOUT: %impl.elem1 => constants.%Destroy.facet.5f38 // CHECK:STDOUT: %as_type => constants.%tuple.type.dd0 // CHECK:STDOUT: %require_complete.1 => constants.%complete_type.843 // CHECK:STDOUT: %Iterate.WithSelf.Next.type => constants.%Iterate.WithSelf.Next.type.b58 -// CHECK:STDOUT: %.loc36_19.24 => constants.%.ab45 -// CHECK:STDOUT: %impl.elem3.loc36_19.2 => constants.%T.as_type.as.Iterate.impl.Next.bc3 -// CHECK:STDOUT: %specific_impl_fn.loc36_19.4 => constants.%T.as_type.as.Iterate.impl.Next.specific_fn +// CHECK:STDOUT: %.loc68_19.24 => constants.%.ab45 +// CHECK:STDOUT: %impl.elem3.loc68_19.2 => constants.%T.as_type.as.Iterate.impl.Next.bc3 +// CHECK:STDOUT: %specific_impl_fn.loc68_19.4 => constants.%T.as_type.as.Iterate.impl.Next.specific_fn // CHECK:STDOUT: %SelfDestruct.specific_fn.5 => constants.%SelfDestruct.specific_fn.e1d // CHECK:STDOUT: } // CHECK:STDOUT: @@ -4171,10 +4478,10 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %Optional.Get.specific_fn: = specific_function %Optional.Get.707, @Optional.Get(%OptionalStorage.facet.86d) [concrete] // CHECK:STDOUT: %operator_PlusEqual__carbon_thunk.type: type = fn_type @operator_PlusEqual__carbon_thunk [concrete] // CHECK:STDOUT: %operator_PlusEqual__carbon_thunk: %operator_PlusEqual__carbon_thunk.type = struct_value () [concrete] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.3: type = fn_type @SubobjectDestroy.WithSelf.Op.loc41_44.2 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.3: type = fn_type @SubobjectDestroy.WithSelf.Op.loc73_44.2 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.3: %SubobjectDestroy.WithSelf.Op.type.6870fd.3 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80ef6.3: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.3), @SubobjectDestroy [concrete] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.4: type = fn_type @SubobjectDestroy.WithSelf.Op.loc41_44.3 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.4: type = fn_type @SubobjectDestroy.WithSelf.Op.loc73_44.3 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.4: %SubobjectDestroy.WithSelf.Op.type.6870fd.4 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80ef6.4: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.4), @SubobjectDestroy [concrete] // CHECK:STDOUT: %SubobjectDestroy.facet.a87: %SubobjectDestroy.type = facet_value bool, (%custom_witness.b80ef6.4) [concrete] @@ -4183,7 +4490,7 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %SubobjectDestroy.facet.e25: %SubobjectDestroy.type = facet_value %MaybeUnformed.149, (%custom_witness.b80ef6.3) [concrete] // CHECK:STDOUT: %DestroyImpl.impl_witness.faa: = impl_witness imports.%DestroyImpl.impl_witness_table, @T.as_type.as.DestroyImpl.impl(%SubobjectDestroy.facet.e25) [concrete] // CHECK:STDOUT: %Destroy.facet.6cf: %Destroy.type = facet_value %MaybeUnformed.149, (%custom_witness.b80ef6.3, %DestroyImpl.impl_witness.faa) [concrete] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.7: type = fn_type @SubobjectDestroy.WithSelf.Op.loc41_44.6 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.7: type = fn_type @SubobjectDestroy.WithSelf.Op.loc73_44.6 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.7: %SubobjectDestroy.WithSelf.Op.type.6870fd.7 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80ef6.7: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.7), @SubobjectDestroy [concrete] // CHECK:STDOUT: %SubobjectDestroy.facet.f77: %SubobjectDestroy.type = facet_value %Optional.35b, (%custom_witness.b80ef6.7) [concrete] @@ -4228,172 +4535,172 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %MutableRange.decl: type = class_decl @MutableRange [concrete = constants.%MutableRange] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @TestIterate(%R.loc37_17.2: %Iterate_where.type.ad0) { +// CHECK:STDOUT: generic fn @TestIterate(%R.loc69_17.2: %Iterate_where.type.ad0) { // CHECK:STDOUT: // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: -// CHECK:STDOUT: %Iterate.lookup_impl_witness: = lookup_impl_witness %R.loc37_17.1, @Iterate [symbolic = %Iterate.lookup_impl_witness (constants.%Iterate.lookup_impl_witness.afc)] -// CHECK:STDOUT: %Iterate.facet.loc41_44.5: %Iterate.type = facet_value %R.as_type.loc37_86.1, (%Iterate.lookup_impl_witness) [symbolic = %Iterate.facet.loc41_44.5 (constants.%Iterate.facet.942)] -// CHECK:STDOUT: %Iterate.WithSelf.NewCursor.type: type = fn_type @Iterate.WithSelf.NewCursor, @Iterate.WithSelf(%Iterate.facet.loc41_44.5) [symbolic = %Iterate.WithSelf.NewCursor.type (constants.%Iterate.WithSelf.NewCursor.type.73c)] -// CHECK:STDOUT: %.loc41_44.26: type = fn_type_with_self_type %Iterate.WithSelf.NewCursor.type, %Iterate.facet.loc41_44.5 [symbolic = %.loc41_44.26 (constants.%.848)] -// CHECK:STDOUT: %impl.elem2.loc41_44.2: @TestIterate.%.loc41_44.26 (%.848) = impl_witness_access %Iterate.lookup_impl_witness, element2 [symbolic = %impl.elem2.loc41_44.2 (constants.%impl.elem2.2ea)] -// CHECK:STDOUT: %specific_impl_fn.loc41_44.3: = specific_impl_function %impl.elem2.loc41_44.2, @Iterate.WithSelf.NewCursor(%Iterate.facet.loc41_44.5) [symbolic = %specific_impl_fn.loc41_44.3 (constants.%specific_impl_fn.105)] +// CHECK:STDOUT: %Iterate.lookup_impl_witness: = lookup_impl_witness %R.loc69_17.1, @Iterate [symbolic = %Iterate.lookup_impl_witness (constants.%Iterate.lookup_impl_witness.afc)] +// CHECK:STDOUT: %Iterate.facet.loc73_44.5: %Iterate.type = facet_value %R.as_type.loc69_86.1, (%Iterate.lookup_impl_witness) [symbolic = %Iterate.facet.loc73_44.5 (constants.%Iterate.facet.942)] +// CHECK:STDOUT: %Iterate.WithSelf.NewCursor.type: type = fn_type @Iterate.WithSelf.NewCursor, @Iterate.WithSelf(%Iterate.facet.loc73_44.5) [symbolic = %Iterate.WithSelf.NewCursor.type (constants.%Iterate.WithSelf.NewCursor.type.73c)] +// CHECK:STDOUT: %.loc73_44.26: type = fn_type_with_self_type %Iterate.WithSelf.NewCursor.type, %Iterate.facet.loc73_44.5 [symbolic = %.loc73_44.26 (constants.%.848)] +// CHECK:STDOUT: %impl.elem2.loc73_44.2: @TestIterate.%.loc73_44.26 (%.848) = impl_witness_access %Iterate.lookup_impl_witness, element2 [symbolic = %impl.elem2.loc73_44.2 (constants.%impl.elem2.2ea)] +// CHECK:STDOUT: %specific_impl_fn.loc73_44.3: = specific_impl_function %impl.elem2.loc73_44.2, @Iterate.WithSelf.NewCursor(%Iterate.facet.loc73_44.5) [symbolic = %specific_impl_fn.loc73_44.3 (constants.%specific_impl_fn.105)] // CHECK:STDOUT: -// CHECK:STDOUT: %Iterate.WithSelf.Next.type: type = fn_type @Iterate.WithSelf.Next, @Iterate.WithSelf(%Iterate.facet.loc41_44.5) [symbolic = %Iterate.WithSelf.Next.type (constants.%Iterate.WithSelf.Next.type.f8d)] -// CHECK:STDOUT: %.loc41_44.27: type = fn_type_with_self_type %Iterate.WithSelf.Next.type, %Iterate.facet.loc41_44.5 [symbolic = %.loc41_44.27 (constants.%.b21)] -// CHECK:STDOUT: %impl.elem3.loc41_44.2: @TestIterate.%.loc41_44.27 (%.b21) = impl_witness_access %Iterate.lookup_impl_witness, element3 [symbolic = %impl.elem3.loc41_44.2 (constants.%impl.elem3.509)] -// CHECK:STDOUT: %specific_impl_fn.loc41_44.4: = specific_impl_function %impl.elem3.loc41_44.2, @Iterate.WithSelf.Next(%Iterate.facet.loc41_44.5) [symbolic = %specific_impl_fn.loc41_44.4 (constants.%specific_impl_fn.ccf)] +// CHECK:STDOUT: %Iterate.WithSelf.Next.type: type = fn_type @Iterate.WithSelf.Next, @Iterate.WithSelf(%Iterate.facet.loc73_44.5) [symbolic = %Iterate.WithSelf.Next.type (constants.%Iterate.WithSelf.Next.type.f8d)] +// CHECK:STDOUT: %.loc73_44.27: type = fn_type_with_self_type %Iterate.WithSelf.Next.type, %Iterate.facet.loc73_44.5 [symbolic = %.loc73_44.27 (constants.%.b21)] +// CHECK:STDOUT: %impl.elem3.loc73_44.2: @TestIterate.%.loc73_44.27 (%.b21) = impl_witness_access %Iterate.lookup_impl_witness, element3 [symbolic = %impl.elem3.loc73_44.2 (constants.%impl.elem3.509)] +// CHECK:STDOUT: %specific_impl_fn.loc73_44.4: = specific_impl_function %impl.elem3.loc73_44.2, @Iterate.WithSelf.Next(%Iterate.facet.loc73_44.5) [symbolic = %specific_impl_fn.loc73_44.4 (constants.%specific_impl_fn.ccf)] // CHECK:STDOUT: // CHECK:STDOUT: -// CHECK:STDOUT: fn(%r.param: @TestIterate.%R.as_type.loc37_86.1 (%R.as_type)) { +// CHECK:STDOUT: fn(%r.param: @TestIterate.%R.as_type.loc69_86.1 (%R.as_type)) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %i.patt: %pattern_type.d2d = value_binding_pattern i [concrete = constants.%i.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %r.ref: @TestIterate.%R.as_type.loc37_86.1 (%R.as_type) = name_ref r, %r -// CHECK:STDOUT: %impl.elem2.loc41_44.1: @TestIterate.%.loc41_44.26 (%.848) = impl_witness_access constants.%Iterate.lookup_impl_witness.afc, element2 [symbolic = %impl.elem2.loc41_44.2 (constants.%impl.elem2.2ea)] -// CHECK:STDOUT: %bound_method.loc41_44.1: = bound_method %r.ref, %impl.elem2.loc41_44.1 -// CHECK:STDOUT: %Iterate.facet.loc41_44.1: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.afc) [symbolic = %Iterate.facet.loc41_44.5 (constants.%Iterate.facet.942)] -// CHECK:STDOUT: %.loc41_44.1: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc41_44.1 [symbolic = %Iterate.facet.loc41_44.5 (constants.%Iterate.facet.942)] -// CHECK:STDOUT: %Iterate.facet.loc41_44.2: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.afc) [symbolic = %Iterate.facet.loc41_44.5 (constants.%Iterate.facet.942)] -// CHECK:STDOUT: %.loc41_44.2: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc41_44.2 [symbolic = %Iterate.facet.loc41_44.5 (constants.%Iterate.facet.942)] -// CHECK:STDOUT: %specific_impl_fn.loc41_44.1: = specific_impl_function %impl.elem2.loc41_44.1, @Iterate.WithSelf.NewCursor(constants.%Iterate.facet.942) [symbolic = %specific_impl_fn.loc41_44.3 (constants.%specific_impl_fn.105)] -// CHECK:STDOUT: %bound_method.loc41_44.2: = bound_method %r.ref, %specific_impl_fn.loc41_44.1 +// CHECK:STDOUT: %r.ref: @TestIterate.%R.as_type.loc69_86.1 (%R.as_type) = name_ref r, %r +// CHECK:STDOUT: %impl.elem2.loc73_44.1: @TestIterate.%.loc73_44.26 (%.848) = impl_witness_access constants.%Iterate.lookup_impl_witness.afc, element2 [symbolic = %impl.elem2.loc73_44.2 (constants.%impl.elem2.2ea)] +// CHECK:STDOUT: %bound_method.loc73_44.1: = bound_method %r.ref, %impl.elem2.loc73_44.1 +// CHECK:STDOUT: %Iterate.facet.loc73_44.1: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.afc) [symbolic = %Iterate.facet.loc73_44.5 (constants.%Iterate.facet.942)] +// CHECK:STDOUT: %.loc73_44.1: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc73_44.1 [symbolic = %Iterate.facet.loc73_44.5 (constants.%Iterate.facet.942)] +// CHECK:STDOUT: %Iterate.facet.loc73_44.2: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.afc) [symbolic = %Iterate.facet.loc73_44.5 (constants.%Iterate.facet.942)] +// CHECK:STDOUT: %.loc73_44.2: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc73_44.2 [symbolic = %Iterate.facet.loc73_44.5 (constants.%Iterate.facet.942)] +// CHECK:STDOUT: %specific_impl_fn.loc73_44.1: = specific_impl_function %impl.elem2.loc73_44.1, @Iterate.WithSelf.NewCursor(constants.%Iterate.facet.942) [symbolic = %specific_impl_fn.loc73_44.3 (constants.%specific_impl_fn.105)] +// CHECK:STDOUT: %bound_method.loc73_44.2: = bound_method %r.ref, %specific_impl_fn.loc73_44.1 // CHECK:STDOUT: %var: ref @TestIterate.%as_type (%as_type.901) = var_storage invalid -// CHECK:STDOUT: %Iterate.WithSelf.NewCursor.call: init @TestIterate.%as_type (%as_type.901) to %var = call %bound_method.loc41_44.2(%r.ref) +// CHECK:STDOUT: %Iterate.WithSelf.NewCursor.call: init @TestIterate.%as_type (%as_type.901) to %var = call %bound_method.loc73_44.2(%r.ref) // CHECK:STDOUT: assign %var, %Iterate.WithSelf.NewCursor.call // CHECK:STDOUT: br !for.next // CHECK:STDOUT: // CHECK:STDOUT: !for.next: -// CHECK:STDOUT: %impl.elem3.loc41_44.1: @TestIterate.%.loc41_44.27 (%.b21) = impl_witness_access constants.%Iterate.lookup_impl_witness.afc, element3 [symbolic = %impl.elem3.loc41_44.2 (constants.%impl.elem3.509)] -// CHECK:STDOUT: %bound_method.loc41_44.3: = bound_method %r.ref, %impl.elem3.loc41_44.1 -// CHECK:STDOUT: %Iterate.facet.loc41_44.3: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.afc) [symbolic = %Iterate.facet.loc41_44.5 (constants.%Iterate.facet.942)] -// CHECK:STDOUT: %.loc41_44.3: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc41_44.3 [symbolic = %Iterate.facet.loc41_44.5 (constants.%Iterate.facet.942)] -// CHECK:STDOUT: %Iterate.facet.loc41_44.4: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.afc) [symbolic = %Iterate.facet.loc41_44.5 (constants.%Iterate.facet.942)] -// CHECK:STDOUT: %.loc41_44.4: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc41_44.4 [symbolic = %Iterate.facet.loc41_44.5 (constants.%Iterate.facet.942)] -// CHECK:STDOUT: %.loc41_44.5: %Destroy.type = converted constants.%as_type.901, constants.%impl.elem1.7d3 [symbolic = %impl.elem1 (constants.%impl.elem1.7d3)] -// CHECK:STDOUT: %.loc41_44.6: %Destroy.type = converted constants.%as_type.901, constants.%impl.elem1.7d3 [symbolic = %impl.elem1 (constants.%impl.elem1.7d3)] -// CHECK:STDOUT: %specific_impl_fn.loc41_44.2: = specific_impl_function %impl.elem3.loc41_44.1, @Iterate.WithSelf.Next(constants.%Iterate.facet.942) [symbolic = %specific_impl_fn.loc41_44.4 (constants.%specific_impl_fn.ccf)] -// CHECK:STDOUT: %bound_method.loc41_44.4: = bound_method %r.ref, %specific_impl_fn.loc41_44.2 -// CHECK:STDOUT: %.loc41_44.7: ref %Optional.35b = temporary_storage -// CHECK:STDOUT: %Iterate.WithSelf.Next.call: init %Optional.35b to %.loc41_44.7 = call %bound_method.loc41_44.4(%r.ref, %var) -// CHECK:STDOUT: %.loc41_44.8: ref %Optional.35b = temporary %.loc41_44.7, %Iterate.WithSelf.Next.call -// CHECK:STDOUT: %.loc41_44.9: %Optional.HasValue.type.5fc = specific_constant imports.%Core.import_ref.c82, @Optional(constants.%OptionalStorage.facet.86d) [concrete = constants.%Optional.HasValue.462] -// CHECK:STDOUT: %HasValue.ref: %Optional.HasValue.type.5fc = name_ref HasValue, %.loc41_44.9 [concrete = constants.%Optional.HasValue.462] -// CHECK:STDOUT: %Optional.HasValue.bound: = bound_method %.loc41_44.8, %HasValue.ref +// CHECK:STDOUT: %impl.elem3.loc73_44.1: @TestIterate.%.loc73_44.27 (%.b21) = impl_witness_access constants.%Iterate.lookup_impl_witness.afc, element3 [symbolic = %impl.elem3.loc73_44.2 (constants.%impl.elem3.509)] +// CHECK:STDOUT: %bound_method.loc73_44.3: = bound_method %r.ref, %impl.elem3.loc73_44.1 +// CHECK:STDOUT: %Iterate.facet.loc73_44.3: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.afc) [symbolic = %Iterate.facet.loc73_44.5 (constants.%Iterate.facet.942)] +// CHECK:STDOUT: %.loc73_44.3: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc73_44.3 [symbolic = %Iterate.facet.loc73_44.5 (constants.%Iterate.facet.942)] +// CHECK:STDOUT: %Iterate.facet.loc73_44.4: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.afc) [symbolic = %Iterate.facet.loc73_44.5 (constants.%Iterate.facet.942)] +// CHECK:STDOUT: %.loc73_44.4: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc73_44.4 [symbolic = %Iterate.facet.loc73_44.5 (constants.%Iterate.facet.942)] +// CHECK:STDOUT: %.loc73_44.5: %Destroy.type = converted constants.%as_type.901, constants.%impl.elem1.7d3 [symbolic = %impl.elem1 (constants.%impl.elem1.7d3)] +// CHECK:STDOUT: %.loc73_44.6: %Destroy.type = converted constants.%as_type.901, constants.%impl.elem1.7d3 [symbolic = %impl.elem1 (constants.%impl.elem1.7d3)] +// CHECK:STDOUT: %specific_impl_fn.loc73_44.2: = specific_impl_function %impl.elem3.loc73_44.1, @Iterate.WithSelf.Next(constants.%Iterate.facet.942) [symbolic = %specific_impl_fn.loc73_44.4 (constants.%specific_impl_fn.ccf)] +// CHECK:STDOUT: %bound_method.loc73_44.4: = bound_method %r.ref, %specific_impl_fn.loc73_44.2 +// CHECK:STDOUT: %.loc73_44.7: ref %Optional.35b = temporary_storage +// CHECK:STDOUT: %Iterate.WithSelf.Next.call: init %Optional.35b to %.loc73_44.7 = call %bound_method.loc73_44.4(%r.ref, %var) +// CHECK:STDOUT: %.loc73_44.8: ref %Optional.35b = temporary %.loc73_44.7, %Iterate.WithSelf.Next.call +// CHECK:STDOUT: %.loc73_44.9: %Optional.HasValue.type.5fc = specific_constant imports.%Core.import_ref.c82, @Optional(constants.%OptionalStorage.facet.86d) [concrete = constants.%Optional.HasValue.462] +// CHECK:STDOUT: %HasValue.ref: %Optional.HasValue.type.5fc = name_ref HasValue, %.loc73_44.9 [concrete = constants.%Optional.HasValue.462] +// CHECK:STDOUT: %Optional.HasValue.bound: = bound_method %.loc73_44.8, %HasValue.ref // CHECK:STDOUT: %Optional.HasValue.specific_fn: = specific_function %HasValue.ref, @Optional.HasValue(constants.%OptionalStorage.facet.86d) [concrete = constants.%Optional.HasValue.specific_fn] -// CHECK:STDOUT: %bound_method.loc41_44.5: = bound_method %.loc41_44.8, %Optional.HasValue.specific_fn -// CHECK:STDOUT: %.loc41_44.10: %Optional.35b = acquire_value %.loc41_44.8 -// CHECK:STDOUT: %Optional.HasValue.call: init bool = call %bound_method.loc41_44.5(%.loc41_44.10) -// CHECK:STDOUT: %.loc41_44.11: bool = value_of_initializer %Optional.HasValue.call -// CHECK:STDOUT: %.loc41_44.12: bool = converted %Optional.HasValue.call, %.loc41_44.11 -// CHECK:STDOUT: if %.loc41_44.12 br !for.body else br !for.done +// CHECK:STDOUT: %bound_method.loc73_44.5: = bound_method %.loc73_44.8, %Optional.HasValue.specific_fn +// CHECK:STDOUT: %.loc73_44.10: %Optional.35b = acquire_value %.loc73_44.8 +// CHECK:STDOUT: %Optional.HasValue.call: init bool = call %bound_method.loc73_44.5(%.loc73_44.10) +// CHECK:STDOUT: %.loc73_44.11: bool = value_of_initializer %Optional.HasValue.call +// CHECK:STDOUT: %.loc73_44.12: bool = converted %Optional.HasValue.call, %.loc73_44.11 +// CHECK:STDOUT: if %.loc73_44.12 br !for.body else br !for.done // CHECK:STDOUT: // CHECK:STDOUT: !for.body: -// CHECK:STDOUT: %.loc41_44.13: %Optional.Get.type.fad = specific_constant imports.%Core.import_ref.29e, @Optional(constants.%OptionalStorage.facet.86d) [concrete = constants.%Optional.Get.707] -// CHECK:STDOUT: %Get.ref: %Optional.Get.type.fad = name_ref Get, %.loc41_44.13 [concrete = constants.%Optional.Get.707] -// CHECK:STDOUT: %Optional.Get.bound: = bound_method %.loc41_44.8, %Get.ref +// CHECK:STDOUT: %.loc73_44.13: %Optional.Get.type.fad = specific_constant imports.%Core.import_ref.29e, @Optional(constants.%OptionalStorage.facet.86d) [concrete = constants.%Optional.Get.707] +// CHECK:STDOUT: %Get.ref: %Optional.Get.type.fad = name_ref Get, %.loc73_44.13 [concrete = constants.%Optional.Get.707] +// CHECK:STDOUT: %Optional.Get.bound: = bound_method %.loc73_44.8, %Get.ref // CHECK:STDOUT: %Optional.Get.specific_fn: = specific_function %Get.ref, @Optional.Get(constants.%OptionalStorage.facet.86d) [concrete = constants.%Optional.Get.specific_fn] -// CHECK:STDOUT: %bound_method.loc41_44.6: = bound_method %.loc41_44.8, %Optional.Get.specific_fn -// CHECK:STDOUT: %.loc41_44.14: ref %ValueType = temporary_storage -// CHECK:STDOUT: %.loc41_44.15: %Optional.35b = acquire_value %.loc41_44.8 -// CHECK:STDOUT: %Optional.Get.call: init %ValueType to %.loc41_44.14 = call %bound_method.loc41_44.6(%.loc41_44.15) -// CHECK:STDOUT: %.loc41_44.16: ref %ValueType = temporary %.loc41_44.14, %Optional.Get.call -// CHECK:STDOUT: %.loc41_44.17: %ValueType = acquire_value %.loc41_44.16 -// CHECK:STDOUT: %.loc41_29: type = splice_block %ValueType.ref.loc41 [concrete = constants.%ValueType] { -// CHECK:STDOUT: %Cpp.ref.loc41: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %DiffMutableADL.ref.loc41: = name_ref DiffMutableADL, imports.%DiffMutableADL [concrete = imports.%DiffMutableADL] -// CHECK:STDOUT: %ValueType.ref.loc41: type = name_ref ValueType, imports.%ValueType.decl [concrete = constants.%ValueType] +// CHECK:STDOUT: %bound_method.loc73_44.6: = bound_method %.loc73_44.8, %Optional.Get.specific_fn +// CHECK:STDOUT: %.loc73_44.14: ref %ValueType = temporary_storage +// CHECK:STDOUT: %.loc73_44.15: %Optional.35b = acquire_value %.loc73_44.8 +// CHECK:STDOUT: %Optional.Get.call: init %ValueType to %.loc73_44.14 = call %bound_method.loc73_44.6(%.loc73_44.15) +// CHECK:STDOUT: %.loc73_44.16: ref %ValueType = temporary %.loc73_44.14, %Optional.Get.call +// CHECK:STDOUT: %.loc73_44.17: %ValueType = acquire_value %.loc73_44.16 +// CHECK:STDOUT: %.loc73_29: type = splice_block %ValueType.ref.loc73 [concrete = constants.%ValueType] { +// CHECK:STDOUT: %Cpp.ref.loc73: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %DiffMutableADL.ref.loc73: = name_ref DiffMutableADL, imports.%DiffMutableADL [concrete = imports.%DiffMutableADL] +// CHECK:STDOUT: %ValueType.ref.loc73: type = name_ref ValueType, imports.%ValueType.decl [concrete = constants.%ValueType] // CHECK:STDOUT: } -// CHECK:STDOUT: %i: %ValueType = wrapper_binding i, %.loc41_44.17 +// CHECK:STDOUT: %i: %ValueType = wrapper_binding i, %.loc73_44.17 // CHECK:STDOUT: %sum.ref: ref %ValueType = name_ref sum, %sum // CHECK:STDOUT: %i.ref: %ValueType = name_ref i, %i -// CHECK:STDOUT: %.loc42_12: ref %ValueType = value_as_ref %i.ref -// CHECK:STDOUT: %addr.loc42: %ptr.9c6 = addr_of %.loc42_12 -// CHECK:STDOUT: %.loc42_9.1: %ptr.5f4 = as_compatible %addr.loc42 -// CHECK:STDOUT: %.loc42_9.2: %ptr.5f4 = converted %addr.loc42, %.loc42_9.1 -// CHECK:STDOUT: %operator_PlusEqual__carbon_thunk.call: ref %ValueType = call imports.%operator_PlusEqual__carbon_thunk.decl(%sum.ref, %.loc42_9.2) -// CHECK:STDOUT: %Destroy.facet.loc41_44.1: %Destroy.type = facet_value constants.%ValueType, (constants.%custom_witness.55b, constants.%DestroyImpl.impl_witness.7f1) [concrete = constants.%Destroy.facet.423] -// CHECK:STDOUT: %.loc41_44.18: %Destroy.type = converted constants.%ValueType, %Destroy.facet.loc41_44.1 [concrete = constants.%Destroy.facet.423] -// CHECK:STDOUT: %Destroy.facet.loc41_44.2: %Destroy.type = facet_value constants.%ValueType, (constants.%custom_witness.55b, constants.%DestroyImpl.impl_witness.7f1) [concrete = constants.%Destroy.facet.423] -// CHECK:STDOUT: %.loc41_44.19: %Destroy.type = converted constants.%ValueType, %Destroy.facet.loc41_44.2 [concrete = constants.%Destroy.facet.423] +// CHECK:STDOUT: %.loc74_12: ref %ValueType = value_as_ref %i.ref +// CHECK:STDOUT: %addr.loc74: %ptr.9c6 = addr_of %.loc74_12 +// CHECK:STDOUT: %.loc74_9.1: %ptr.5f4 = as_compatible %addr.loc74 +// CHECK:STDOUT: %.loc74_9.2: %ptr.5f4 = converted %addr.loc74, %.loc74_9.1 +// CHECK:STDOUT: %operator_PlusEqual__carbon_thunk.call: ref %ValueType = call imports.%operator_PlusEqual__carbon_thunk.decl(%sum.ref, %.loc74_9.2) +// CHECK:STDOUT: %Destroy.facet.loc73_44.1: %Destroy.type = facet_value constants.%ValueType, (constants.%custom_witness.55b, constants.%DestroyImpl.impl_witness.7f1) [concrete = constants.%Destroy.facet.423] +// CHECK:STDOUT: %.loc73_44.18: %Destroy.type = converted constants.%ValueType, %Destroy.facet.loc73_44.1 [concrete = constants.%Destroy.facet.423] +// CHECK:STDOUT: %Destroy.facet.loc73_44.2: %Destroy.type = facet_value constants.%ValueType, (constants.%custom_witness.55b, constants.%DestroyImpl.impl_witness.7f1) [concrete = constants.%Destroy.facet.423] +// CHECK:STDOUT: %.loc73_44.19: %Destroy.type = converted constants.%ValueType, %Destroy.facet.loc73_44.2 [concrete = constants.%Destroy.facet.423] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc41_44.1: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%.loc41_44.16) -// CHECK:STDOUT: %Destroy.facet.loc41_44.3: %Destroy.type = facet_value constants.%Optional.35b, (constants.%custom_witness.b80ef6.7, constants.%DestroyImpl.impl_witness.ed2) [concrete = constants.%Destroy.facet.610] -// CHECK:STDOUT: %.loc41_44.20: %Destroy.type = converted constants.%Optional.35b, %Destroy.facet.loc41_44.3 [concrete = constants.%Destroy.facet.610] -// CHECK:STDOUT: %Destroy.facet.loc41_44.4: %Destroy.type = facet_value constants.%Optional.35b, (constants.%custom_witness.b80ef6.7, constants.%DestroyImpl.impl_witness.ed2) [concrete = constants.%Destroy.facet.610] -// CHECK:STDOUT: %.loc41_44.21: %Destroy.type = converted constants.%Optional.35b, %Destroy.facet.loc41_44.4 [concrete = constants.%Destroy.facet.610] +// CHECK:STDOUT: %SelfDestruct.call.loc73_44.1: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%.loc73_44.16) +// CHECK:STDOUT: %Destroy.facet.loc73_44.3: %Destroy.type = facet_value constants.%Optional.35b, (constants.%custom_witness.b80ef6.7, constants.%DestroyImpl.impl_witness.ed2) [concrete = constants.%Destroy.facet.610] +// CHECK:STDOUT: %.loc73_44.20: %Destroy.type = converted constants.%Optional.35b, %Destroy.facet.loc73_44.3 [concrete = constants.%Destroy.facet.610] +// CHECK:STDOUT: %Destroy.facet.loc73_44.4: %Destroy.type = facet_value constants.%Optional.35b, (constants.%custom_witness.b80ef6.7, constants.%DestroyImpl.impl_witness.ed2) [concrete = constants.%Destroy.facet.610] +// CHECK:STDOUT: %.loc73_44.21: %Destroy.type = converted constants.%Optional.35b, %Destroy.facet.loc73_44.4 [concrete = constants.%Destroy.facet.610] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc41_44.2: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%.loc41_44.8) +// CHECK:STDOUT: %SelfDestruct.call.loc73_44.2: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%.loc73_44.8) // CHECK:STDOUT: br !for.next // CHECK:STDOUT: // CHECK:STDOUT: !for.done: -// CHECK:STDOUT: %Destroy.facet.loc41_44.5: %Destroy.type = facet_value constants.%Optional.35b, (constants.%custom_witness.b80ef6.7, constants.%DestroyImpl.impl_witness.ed2) [concrete = constants.%Destroy.facet.610] -// CHECK:STDOUT: %.loc41_44.22: %Destroy.type = converted constants.%Optional.35b, %Destroy.facet.loc41_44.5 [concrete = constants.%Destroy.facet.610] -// CHECK:STDOUT: %Destroy.facet.loc41_44.6: %Destroy.type = facet_value constants.%Optional.35b, (constants.%custom_witness.b80ef6.7, constants.%DestroyImpl.impl_witness.ed2) [concrete = constants.%Destroy.facet.610] -// CHECK:STDOUT: %.loc41_44.23: %Destroy.type = converted constants.%Optional.35b, %Destroy.facet.loc41_44.6 [concrete = constants.%Destroy.facet.610] +// CHECK:STDOUT: %Destroy.facet.loc73_44.5: %Destroy.type = facet_value constants.%Optional.35b, (constants.%custom_witness.b80ef6.7, constants.%DestroyImpl.impl_witness.ed2) [concrete = constants.%Destroy.facet.610] +// CHECK:STDOUT: %.loc73_44.22: %Destroy.type = converted constants.%Optional.35b, %Destroy.facet.loc73_44.5 [concrete = constants.%Destroy.facet.610] +// CHECK:STDOUT: %Destroy.facet.loc73_44.6: %Destroy.type = facet_value constants.%Optional.35b, (constants.%custom_witness.b80ef6.7, constants.%DestroyImpl.impl_witness.ed2) [concrete = constants.%Destroy.facet.610] +// CHECK:STDOUT: %.loc73_44.23: %Destroy.type = converted constants.%Optional.35b, %Destroy.facet.loc73_44.6 [concrete = constants.%Destroy.facet.610] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc41_44.3: init %empty_tuple.type = call %SelfDestruct.specific_fn.3(%.loc41_44.8) -// CHECK:STDOUT: %.loc41_44.24: %Destroy.type = converted constants.%as_type.901, constants.%impl.elem1.7d3 [symbolic = %impl.elem1 (constants.%impl.elem1.7d3)] -// CHECK:STDOUT: %.loc41_44.25: %Destroy.type = converted constants.%as_type.901, constants.%impl.elem1.7d3 [symbolic = %impl.elem1 (constants.%impl.elem1.7d3)] +// CHECK:STDOUT: %SelfDestruct.call.loc73_44.3: init %empty_tuple.type = call %SelfDestruct.specific_fn.3(%.loc73_44.8) +// CHECK:STDOUT: %.loc73_44.24: %Destroy.type = converted constants.%as_type.901, constants.%impl.elem1.7d3 [symbolic = %impl.elem1 (constants.%impl.elem1.7d3)] +// CHECK:STDOUT: %.loc73_44.25: %Destroy.type = converted constants.%as_type.901, constants.%impl.elem1.7d3 [symbolic = %impl.elem1 (constants.%impl.elem1.7d3)] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc41_44.4: init %empty_tuple.type = call %SelfDestruct.specific_fn.4(%var) +// CHECK:STDOUT: %SelfDestruct.call.loc73_44.4: init %empty_tuple.type = call %SelfDestruct.specific_fn.4(%var) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc41_44.1(%self.param: ref %.dd19) { +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc73_44.1(%self.param: ref %.dd19) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc41_44.2(%self.param: ref %MaybeUnformed.149) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc73_44.2(%self.param: ref %MaybeUnformed.149) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc41_44.3(%self.param: ref bool) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc73_44.3(%self.param: ref bool) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc41_44.4(%self.param: ref %struct_type.value.has_value.88e) { +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc73_44.4(%self.param: ref %struct_type.value.has_value.88e) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc41_44.1: ref bool = struct_access %self.param, element1 -// CHECK:STDOUT: %Destroy.facet.loc41_44.1: %Destroy.type = facet_value bool, (constants.%custom_witness.b80ef6.4, constants.%DestroyImpl.impl_witness.778) [concrete = constants.%Destroy.facet.80c] -// CHECK:STDOUT: %.loc41_44.2: %Destroy.type = converted bool, %Destroy.facet.loc41_44.1 [concrete = constants.%Destroy.facet.80c] -// CHECK:STDOUT: %Destroy.facet.loc41_44.2: %Destroy.type = facet_value bool, (constants.%custom_witness.b80ef6.4, constants.%DestroyImpl.impl_witness.778) [concrete = constants.%Destroy.facet.80c] -// CHECK:STDOUT: %.loc41_44.3: %Destroy.type = converted bool, %Destroy.facet.loc41_44.2 [concrete = constants.%Destroy.facet.80c] +// CHECK:STDOUT: %.loc73_44.1: ref bool = struct_access %self.param, element1 +// CHECK:STDOUT: %Destroy.facet.loc73_44.1: %Destroy.type = facet_value bool, (constants.%custom_witness.b80ef6.4, constants.%DestroyImpl.impl_witness.778) [concrete = constants.%Destroy.facet.80c] +// CHECK:STDOUT: %.loc73_44.2: %Destroy.type = converted bool, %Destroy.facet.loc73_44.1 [concrete = constants.%Destroy.facet.80c] +// CHECK:STDOUT: %Destroy.facet.loc73_44.2: %Destroy.type = facet_value bool, (constants.%custom_witness.b80ef6.4, constants.%DestroyImpl.impl_witness.778) [concrete = constants.%Destroy.facet.80c] +// CHECK:STDOUT: %.loc73_44.3: %Destroy.type = converted bool, %Destroy.facet.loc73_44.2 [concrete = constants.%Destroy.facet.80c] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc41_44.1: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%.loc41_44.1) -// CHECK:STDOUT: %.loc41_44.4: ref %MaybeUnformed.149 = struct_access %self.param, element0 -// CHECK:STDOUT: %Destroy.facet.loc41_44.3: %Destroy.type = facet_value constants.%MaybeUnformed.149, (constants.%custom_witness.b80ef6.3, constants.%DestroyImpl.impl_witness.faa) [concrete = constants.%Destroy.facet.6cf] -// CHECK:STDOUT: %.loc41_44.5: %Destroy.type = converted constants.%MaybeUnformed.149, %Destroy.facet.loc41_44.3 [concrete = constants.%Destroy.facet.6cf] -// CHECK:STDOUT: %Destroy.facet.loc41_44.4: %Destroy.type = facet_value constants.%MaybeUnformed.149, (constants.%custom_witness.b80ef6.3, constants.%DestroyImpl.impl_witness.faa) [concrete = constants.%Destroy.facet.6cf] -// CHECK:STDOUT: %.loc41_44.6: %Destroy.type = converted constants.%MaybeUnformed.149, %Destroy.facet.loc41_44.4 [concrete = constants.%Destroy.facet.6cf] +// CHECK:STDOUT: %SelfDestruct.call.loc73_44.1: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%.loc73_44.1) +// CHECK:STDOUT: %.loc73_44.4: ref %MaybeUnformed.149 = struct_access %self.param, element0 +// CHECK:STDOUT: %Destroy.facet.loc73_44.3: %Destroy.type = facet_value constants.%MaybeUnformed.149, (constants.%custom_witness.b80ef6.3, constants.%DestroyImpl.impl_witness.faa) [concrete = constants.%Destroy.facet.6cf] +// CHECK:STDOUT: %.loc73_44.5: %Destroy.type = converted constants.%MaybeUnformed.149, %Destroy.facet.loc73_44.3 [concrete = constants.%Destroy.facet.6cf] +// CHECK:STDOUT: %Destroy.facet.loc73_44.4: %Destroy.type = facet_value constants.%MaybeUnformed.149, (constants.%custom_witness.b80ef6.3, constants.%DestroyImpl.impl_witness.faa) [concrete = constants.%Destroy.facet.6cf] +// CHECK:STDOUT: %.loc73_44.6: %Destroy.type = converted constants.%MaybeUnformed.149, %Destroy.facet.loc73_44.4 [concrete = constants.%Destroy.facet.6cf] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc41_44.2: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%.loc41_44.4) +// CHECK:STDOUT: %SelfDestruct.call.loc73_44.2: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%.loc73_44.4) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc41_44.5(%self.param: ref %DefaultOptionalStorage.db0) { +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc73_44.5(%self.param: ref %DefaultOptionalStorage.db0) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %has_value.ref: %DefaultOptionalStorage.elem.21a = name_ref has_value, imports.%Core.import_ref.9ce [concrete = imports.%field_decl.dbe] -// CHECK:STDOUT: %.loc41_44.1: ref bool = class_element_access %self.param, element1 -// CHECK:STDOUT: %Destroy.facet.loc41_44.1: %Destroy.type = facet_value bool, (constants.%custom_witness.b80ef6.4, constants.%DestroyImpl.impl_witness.778) [concrete = constants.%Destroy.facet.80c] -// CHECK:STDOUT: %.loc41_44.2: %Destroy.type = converted bool, %Destroy.facet.loc41_44.1 [concrete = constants.%Destroy.facet.80c] -// CHECK:STDOUT: %Destroy.facet.loc41_44.2: %Destroy.type = facet_value bool, (constants.%custom_witness.b80ef6.4, constants.%DestroyImpl.impl_witness.778) [concrete = constants.%Destroy.facet.80c] -// CHECK:STDOUT: %.loc41_44.3: %Destroy.type = converted bool, %Destroy.facet.loc41_44.2 [concrete = constants.%Destroy.facet.80c] +// CHECK:STDOUT: %.loc73_44.1: ref bool = class_element_access %self.param, element1 +// CHECK:STDOUT: %Destroy.facet.loc73_44.1: %Destroy.type = facet_value bool, (constants.%custom_witness.b80ef6.4, constants.%DestroyImpl.impl_witness.778) [concrete = constants.%Destroy.facet.80c] +// CHECK:STDOUT: %.loc73_44.2: %Destroy.type = converted bool, %Destroy.facet.loc73_44.1 [concrete = constants.%Destroy.facet.80c] +// CHECK:STDOUT: %Destroy.facet.loc73_44.2: %Destroy.type = facet_value bool, (constants.%custom_witness.b80ef6.4, constants.%DestroyImpl.impl_witness.778) [concrete = constants.%Destroy.facet.80c] +// CHECK:STDOUT: %.loc73_44.3: %Destroy.type = converted bool, %Destroy.facet.loc73_44.2 [concrete = constants.%Destroy.facet.80c] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc41_44.1: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%.loc41_44.1) +// CHECK:STDOUT: %SelfDestruct.call.loc73_44.1: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%.loc73_44.1) // CHECK:STDOUT: %value.ref: %DefaultOptionalStorage.elem.649 = name_ref value, imports.%Core.import_ref.e86 [concrete = imports.%field_decl.bce] -// CHECK:STDOUT: %.loc41_44.4: ref %MaybeUnformed.149 = class_element_access %self.param, element0 -// CHECK:STDOUT: %Destroy.facet.loc41_44.3: %Destroy.type = facet_value constants.%MaybeUnformed.149, (constants.%custom_witness.b80ef6.3, constants.%DestroyImpl.impl_witness.faa) [concrete = constants.%Destroy.facet.6cf] -// CHECK:STDOUT: %.loc41_44.5: %Destroy.type = converted constants.%MaybeUnformed.149, %Destroy.facet.loc41_44.3 [concrete = constants.%Destroy.facet.6cf] -// CHECK:STDOUT: %Destroy.facet.loc41_44.4: %Destroy.type = facet_value constants.%MaybeUnformed.149, (constants.%custom_witness.b80ef6.3, constants.%DestroyImpl.impl_witness.faa) [concrete = constants.%Destroy.facet.6cf] -// CHECK:STDOUT: %.loc41_44.6: %Destroy.type = converted constants.%MaybeUnformed.149, %Destroy.facet.loc41_44.4 [concrete = constants.%Destroy.facet.6cf] +// CHECK:STDOUT: %.loc73_44.4: ref %MaybeUnformed.149 = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.facet.loc73_44.3: %Destroy.type = facet_value constants.%MaybeUnformed.149, (constants.%custom_witness.b80ef6.3, constants.%DestroyImpl.impl_witness.faa) [concrete = constants.%Destroy.facet.6cf] +// CHECK:STDOUT: %.loc73_44.5: %Destroy.type = converted constants.%MaybeUnformed.149, %Destroy.facet.loc73_44.3 [concrete = constants.%Destroy.facet.6cf] +// CHECK:STDOUT: %Destroy.facet.loc73_44.4: %Destroy.type = facet_value constants.%MaybeUnformed.149, (constants.%custom_witness.b80ef6.3, constants.%DestroyImpl.impl_witness.faa) [concrete = constants.%Destroy.facet.6cf] +// CHECK:STDOUT: %.loc73_44.6: %Destroy.type = converted constants.%MaybeUnformed.149, %Destroy.facet.loc73_44.4 [concrete = constants.%Destroy.facet.6cf] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc41_44.2: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%.loc41_44.4) +// CHECK:STDOUT: %SelfDestruct.call.loc73_44.2: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%.loc73_44.4) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc41_44.6(%self.param: ref %Optional.35b) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc73_44.6(%self.param: ref %Optional.35b) = "no_op"; // CHECK:STDOUT: // CHECK:STDOUT: fn @TestRangeFor(%m.param: ref %MutableRange) { // CHECK:STDOUT: !entry: @@ -4412,10 +4719,10 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: // CHECK:STDOUT: !for.body: // CHECK:STDOUT: %Get.ref: = name_ref Get, [concrete = ] -// CHECK:STDOUT: %.loc63: type = splice_block %ValueType.ref.loc63 [concrete = constants.%ValueType] { -// CHECK:STDOUT: %Cpp.ref.loc63: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %DiffMutableADL.ref.loc63: = name_ref DiffMutableADL, imports.%DiffMutableADL [concrete = imports.%DiffMutableADL] -// CHECK:STDOUT: %ValueType.ref.loc63: type = name_ref ValueType, imports.%ValueType.decl [concrete = constants.%ValueType] +// CHECK:STDOUT: %.loc124: type = splice_block %ValueType.ref.loc124 [concrete = constants.%ValueType] { +// CHECK:STDOUT: %Cpp.ref.loc124: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %DiffMutableADL.ref.loc124: = name_ref DiffMutableADL, imports.%DiffMutableADL [concrete = imports.%DiffMutableADL] +// CHECK:STDOUT: %ValueType.ref.loc124: type = name_ref ValueType, imports.%ValueType.decl [concrete = constants.%ValueType] // CHECK:STDOUT: } // CHECK:STDOUT: %i: %ValueType = wrapper_binding i, [concrete = ] // CHECK:STDOUT: %sum.ref: ref %ValueType = name_ref sum, %sum @@ -4427,12 +4734,12 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @TestIterate(constants.%R) { -// CHECK:STDOUT: %R.patt.loc37_17.2 => constants.%R.patt -// CHECK:STDOUT: %R.loc37_17.1 => constants.%R -// CHECK:STDOUT: %R.as_type.loc37_86.1 => constants.%R.as_type +// CHECK:STDOUT: %R.patt.loc69_17.2 => constants.%R.patt +// CHECK:STDOUT: %R.loc69_17.1 => constants.%R +// CHECK:STDOUT: %R.as_type.loc69_86.1 => constants.%R.as_type // CHECK:STDOUT: %pattern_type => constants.%pattern_type.2f7 -// CHECK:STDOUT: %r.param_patt.loc37_84.2 => constants.%r.param_patt -// CHECK:STDOUT: %r.patt.loc37_84.2 => constants.%r.patt +// CHECK:STDOUT: %r.param_patt.loc69_84.2 => constants.%r.param_patt +// CHECK:STDOUT: %r.patt.loc69_84.2 => constants.%r.patt // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_todo_adl_overloads.carbon @@ -4555,10 +4862,10 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %Optional.Get.specific_fn.132: = specific_function %Optional.Get.2ea, @Optional.Get(%OptionalStorage.facet.61a) [concrete] // CHECK:STDOUT: %operator_PlusEqual__carbon_thunk.type: type = fn_type @operator_PlusEqual__carbon_thunk [concrete] // CHECK:STDOUT: %operator_PlusEqual__carbon_thunk: %operator_PlusEqual__carbon_thunk.type = struct_value () [concrete] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.3: type = fn_type @SubobjectDestroy.WithSelf.Op.loc48_41.2 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.3: type = fn_type @SubobjectDestroy.WithSelf.Op.loc81_41.2 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.3: %SubobjectDestroy.WithSelf.Op.type.6870fd.3 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80ef6.3: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.3), @SubobjectDestroy [concrete] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.4: type = fn_type @SubobjectDestroy.WithSelf.Op.loc48_41.3 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.4: type = fn_type @SubobjectDestroy.WithSelf.Op.loc81_41.3 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.4: %SubobjectDestroy.WithSelf.Op.type.6870fd.4 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80ef6.4: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.4), @SubobjectDestroy [concrete] // CHECK:STDOUT: %SubobjectDestroy.facet.a87: %SubobjectDestroy.type = facet_value bool, (%custom_witness.b80ef6.4) [concrete] @@ -4567,7 +4874,7 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %SubobjectDestroy.facet.555: %SubobjectDestroy.type = facet_value %MaybeUnformed.4b9, (%custom_witness.b80ef6.3) [concrete] // CHECK:STDOUT: %DestroyImpl.impl_witness.e80: = impl_witness imports.%DestroyImpl.impl_witness_table, @T.as_type.as.DestroyImpl.impl(%SubobjectDestroy.facet.555) [concrete] // CHECK:STDOUT: %Destroy.facet.eca: %Destroy.type = facet_value %MaybeUnformed.4b9, (%custom_witness.b80ef6.3, %DestroyImpl.impl_witness.e80) [concrete] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.7: type = fn_type @SubobjectDestroy.WithSelf.Op.loc48_41.6 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.7: type = fn_type @SubobjectDestroy.WithSelf.Op.loc81_41.6 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.7: %SubobjectDestroy.WithSelf.Op.type.6870fd.7 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80ef6.7: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.7), @SubobjectDestroy [concrete] // CHECK:STDOUT: %SubobjectDestroy.facet.4ee: %SubobjectDestroy.type = facet_value %Optional.81f, (%custom_witness.b80ef6.7) [concrete] @@ -4665,172 +4972,172 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %MutableAndConstRange.decl: type = class_decl @MutableAndConstRange [concrete = constants.%MutableAndConstRange] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @TestIterate(%R.loc44_17.2: %Iterate_where.type.97a) { +// CHECK:STDOUT: generic fn @TestIterate(%R.loc77_17.2: %Iterate_where.type.97a) { // CHECK:STDOUT: // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: -// CHECK:STDOUT: %Iterate.lookup_impl_witness: = lookup_impl_witness %R.loc44_17.1, @Iterate [symbolic = %Iterate.lookup_impl_witness (constants.%Iterate.lookup_impl_witness.0da)] -// CHECK:STDOUT: %Iterate.facet.loc48_41.5: %Iterate.type = facet_value %R.as_type.loc44_83.1, (%Iterate.lookup_impl_witness) [symbolic = %Iterate.facet.loc48_41.5 (constants.%Iterate.facet.394)] -// CHECK:STDOUT: %Iterate.WithSelf.NewCursor.type: type = fn_type @Iterate.WithSelf.NewCursor, @Iterate.WithSelf(%Iterate.facet.loc48_41.5) [symbolic = %Iterate.WithSelf.NewCursor.type (constants.%Iterate.WithSelf.NewCursor.type.18c)] -// CHECK:STDOUT: %.loc48_41.26: type = fn_type_with_self_type %Iterate.WithSelf.NewCursor.type, %Iterate.facet.loc48_41.5 [symbolic = %.loc48_41.26 (constants.%.89f4)] -// CHECK:STDOUT: %impl.elem2.loc48_41.2: @TestIterate.%.loc48_41.26 (%.89f4) = impl_witness_access %Iterate.lookup_impl_witness, element2 [symbolic = %impl.elem2.loc48_41.2 (constants.%impl.elem2.f19)] -// CHECK:STDOUT: %specific_impl_fn.loc48_41.3: = specific_impl_function %impl.elem2.loc48_41.2, @Iterate.WithSelf.NewCursor(%Iterate.facet.loc48_41.5) [symbolic = %specific_impl_fn.loc48_41.3 (constants.%specific_impl_fn.51c)] +// CHECK:STDOUT: %Iterate.lookup_impl_witness: = lookup_impl_witness %R.loc77_17.1, @Iterate [symbolic = %Iterate.lookup_impl_witness (constants.%Iterate.lookup_impl_witness.0da)] +// CHECK:STDOUT: %Iterate.facet.loc81_41.5: %Iterate.type = facet_value %R.as_type.loc77_83.1, (%Iterate.lookup_impl_witness) [symbolic = %Iterate.facet.loc81_41.5 (constants.%Iterate.facet.394)] +// CHECK:STDOUT: %Iterate.WithSelf.NewCursor.type: type = fn_type @Iterate.WithSelf.NewCursor, @Iterate.WithSelf(%Iterate.facet.loc81_41.5) [symbolic = %Iterate.WithSelf.NewCursor.type (constants.%Iterate.WithSelf.NewCursor.type.18c)] +// CHECK:STDOUT: %.loc81_41.26: type = fn_type_with_self_type %Iterate.WithSelf.NewCursor.type, %Iterate.facet.loc81_41.5 [symbolic = %.loc81_41.26 (constants.%.89f4)] +// CHECK:STDOUT: %impl.elem2.loc81_41.2: @TestIterate.%.loc81_41.26 (%.89f4) = impl_witness_access %Iterate.lookup_impl_witness, element2 [symbolic = %impl.elem2.loc81_41.2 (constants.%impl.elem2.f19)] +// CHECK:STDOUT: %specific_impl_fn.loc81_41.3: = specific_impl_function %impl.elem2.loc81_41.2, @Iterate.WithSelf.NewCursor(%Iterate.facet.loc81_41.5) [symbolic = %specific_impl_fn.loc81_41.3 (constants.%specific_impl_fn.51c)] // CHECK:STDOUT: -// CHECK:STDOUT: %Iterate.WithSelf.Next.type: type = fn_type @Iterate.WithSelf.Next, @Iterate.WithSelf(%Iterate.facet.loc48_41.5) [symbolic = %Iterate.WithSelf.Next.type (constants.%Iterate.WithSelf.Next.type.f15)] -// CHECK:STDOUT: %.loc48_41.27: type = fn_type_with_self_type %Iterate.WithSelf.Next.type, %Iterate.facet.loc48_41.5 [symbolic = %.loc48_41.27 (constants.%.a1e)] -// CHECK:STDOUT: %impl.elem3.loc48_41.2: @TestIterate.%.loc48_41.27 (%.a1e) = impl_witness_access %Iterate.lookup_impl_witness, element3 [symbolic = %impl.elem3.loc48_41.2 (constants.%impl.elem3.88b)] -// CHECK:STDOUT: %specific_impl_fn.loc48_41.4: = specific_impl_function %impl.elem3.loc48_41.2, @Iterate.WithSelf.Next(%Iterate.facet.loc48_41.5) [symbolic = %specific_impl_fn.loc48_41.4 (constants.%specific_impl_fn.36a)] +// CHECK:STDOUT: %Iterate.WithSelf.Next.type: type = fn_type @Iterate.WithSelf.Next, @Iterate.WithSelf(%Iterate.facet.loc81_41.5) [symbolic = %Iterate.WithSelf.Next.type (constants.%Iterate.WithSelf.Next.type.f15)] +// CHECK:STDOUT: %.loc81_41.27: type = fn_type_with_self_type %Iterate.WithSelf.Next.type, %Iterate.facet.loc81_41.5 [symbolic = %.loc81_41.27 (constants.%.a1e)] +// CHECK:STDOUT: %impl.elem3.loc81_41.2: @TestIterate.%.loc81_41.27 (%.a1e) = impl_witness_access %Iterate.lookup_impl_witness, element3 [symbolic = %impl.elem3.loc81_41.2 (constants.%impl.elem3.88b)] +// CHECK:STDOUT: %specific_impl_fn.loc81_41.4: = specific_impl_function %impl.elem3.loc81_41.2, @Iterate.WithSelf.Next(%Iterate.facet.loc81_41.5) [symbolic = %specific_impl_fn.loc81_41.4 (constants.%specific_impl_fn.36a)] // CHECK:STDOUT: // CHECK:STDOUT: -// CHECK:STDOUT: fn(%r.param: @TestIterate.%R.as_type.loc44_83.1 (%R.as_type)) { +// CHECK:STDOUT: fn(%r.param: @TestIterate.%R.as_type.loc77_83.1 (%R.as_type)) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %i.patt: %pattern_type.e09 = value_binding_pattern i [concrete = constants.%i.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %r.ref: @TestIterate.%R.as_type.loc44_83.1 (%R.as_type) = name_ref r, %r -// CHECK:STDOUT: %impl.elem2.loc48_41.1: @TestIterate.%.loc48_41.26 (%.89f4) = impl_witness_access constants.%Iterate.lookup_impl_witness.0da, element2 [symbolic = %impl.elem2.loc48_41.2 (constants.%impl.elem2.f19)] -// CHECK:STDOUT: %bound_method.loc48_41.1: = bound_method %r.ref, %impl.elem2.loc48_41.1 -// CHECK:STDOUT: %Iterate.facet.loc48_41.1: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.0da) [symbolic = %Iterate.facet.loc48_41.5 (constants.%Iterate.facet.394)] -// CHECK:STDOUT: %.loc48_41.1: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc48_41.1 [symbolic = %Iterate.facet.loc48_41.5 (constants.%Iterate.facet.394)] -// CHECK:STDOUT: %Iterate.facet.loc48_41.2: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.0da) [symbolic = %Iterate.facet.loc48_41.5 (constants.%Iterate.facet.394)] -// CHECK:STDOUT: %.loc48_41.2: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc48_41.2 [symbolic = %Iterate.facet.loc48_41.5 (constants.%Iterate.facet.394)] -// CHECK:STDOUT: %specific_impl_fn.loc48_41.1: = specific_impl_function %impl.elem2.loc48_41.1, @Iterate.WithSelf.NewCursor(constants.%Iterate.facet.394) [symbolic = %specific_impl_fn.loc48_41.3 (constants.%specific_impl_fn.51c)] -// CHECK:STDOUT: %bound_method.loc48_41.2: = bound_method %r.ref, %specific_impl_fn.loc48_41.1 +// CHECK:STDOUT: %r.ref: @TestIterate.%R.as_type.loc77_83.1 (%R.as_type) = name_ref r, %r +// CHECK:STDOUT: %impl.elem2.loc81_41.1: @TestIterate.%.loc81_41.26 (%.89f4) = impl_witness_access constants.%Iterate.lookup_impl_witness.0da, element2 [symbolic = %impl.elem2.loc81_41.2 (constants.%impl.elem2.f19)] +// CHECK:STDOUT: %bound_method.loc81_41.1: = bound_method %r.ref, %impl.elem2.loc81_41.1 +// CHECK:STDOUT: %Iterate.facet.loc81_41.1: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.0da) [symbolic = %Iterate.facet.loc81_41.5 (constants.%Iterate.facet.394)] +// CHECK:STDOUT: %.loc81_41.1: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc81_41.1 [symbolic = %Iterate.facet.loc81_41.5 (constants.%Iterate.facet.394)] +// CHECK:STDOUT: %Iterate.facet.loc81_41.2: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.0da) [symbolic = %Iterate.facet.loc81_41.5 (constants.%Iterate.facet.394)] +// CHECK:STDOUT: %.loc81_41.2: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc81_41.2 [symbolic = %Iterate.facet.loc81_41.5 (constants.%Iterate.facet.394)] +// CHECK:STDOUT: %specific_impl_fn.loc81_41.1: = specific_impl_function %impl.elem2.loc81_41.1, @Iterate.WithSelf.NewCursor(constants.%Iterate.facet.394) [symbolic = %specific_impl_fn.loc81_41.3 (constants.%specific_impl_fn.51c)] +// CHECK:STDOUT: %bound_method.loc81_41.2: = bound_method %r.ref, %specific_impl_fn.loc81_41.1 // CHECK:STDOUT: %var: ref @TestIterate.%as_type (%as_type.71d) = var_storage invalid -// CHECK:STDOUT: %Iterate.WithSelf.NewCursor.call: init @TestIterate.%as_type (%as_type.71d) to %var = call %bound_method.loc48_41.2(%r.ref) +// CHECK:STDOUT: %Iterate.WithSelf.NewCursor.call: init @TestIterate.%as_type (%as_type.71d) to %var = call %bound_method.loc81_41.2(%r.ref) // CHECK:STDOUT: assign %var, %Iterate.WithSelf.NewCursor.call // CHECK:STDOUT: br !for.next // CHECK:STDOUT: // CHECK:STDOUT: !for.next: -// CHECK:STDOUT: %impl.elem3.loc48_41.1: @TestIterate.%.loc48_41.27 (%.a1e) = impl_witness_access constants.%Iterate.lookup_impl_witness.0da, element3 [symbolic = %impl.elem3.loc48_41.2 (constants.%impl.elem3.88b)] -// CHECK:STDOUT: %bound_method.loc48_41.3: = bound_method %r.ref, %impl.elem3.loc48_41.1 -// CHECK:STDOUT: %Iterate.facet.loc48_41.3: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.0da) [symbolic = %Iterate.facet.loc48_41.5 (constants.%Iterate.facet.394)] -// CHECK:STDOUT: %.loc48_41.3: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc48_41.3 [symbolic = %Iterate.facet.loc48_41.5 (constants.%Iterate.facet.394)] -// CHECK:STDOUT: %Iterate.facet.loc48_41.4: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.0da) [symbolic = %Iterate.facet.loc48_41.5 (constants.%Iterate.facet.394)] -// CHECK:STDOUT: %.loc48_41.4: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc48_41.4 [symbolic = %Iterate.facet.loc48_41.5 (constants.%Iterate.facet.394)] -// CHECK:STDOUT: %.loc48_41.5: %Destroy.type = converted constants.%as_type.71d, constants.%impl.elem1.626 [symbolic = %impl.elem1 (constants.%impl.elem1.626)] -// CHECK:STDOUT: %.loc48_41.6: %Destroy.type = converted constants.%as_type.71d, constants.%impl.elem1.626 [symbolic = %impl.elem1 (constants.%impl.elem1.626)] -// CHECK:STDOUT: %specific_impl_fn.loc48_41.2: = specific_impl_function %impl.elem3.loc48_41.1, @Iterate.WithSelf.Next(constants.%Iterate.facet.394) [symbolic = %specific_impl_fn.loc48_41.4 (constants.%specific_impl_fn.36a)] -// CHECK:STDOUT: %bound_method.loc48_41.4: = bound_method %r.ref, %specific_impl_fn.loc48_41.2 -// CHECK:STDOUT: %.loc48_41.7: ref %Optional.81f = temporary_storage -// CHECK:STDOUT: %Iterate.WithSelf.Next.call: init %Optional.81f to %.loc48_41.7 = call %bound_method.loc48_41.4(%r.ref, %var) -// CHECK:STDOUT: %.loc48_41.8: ref %Optional.81f = temporary %.loc48_41.7, %Iterate.WithSelf.Next.call -// CHECK:STDOUT: %.loc48_41.9: %Optional.HasValue.type.db4 = specific_constant imports.%Core.import_ref.c82, @Optional(constants.%OptionalStorage.facet.61a) [concrete = constants.%Optional.HasValue.97a] -// CHECK:STDOUT: %HasValue.ref: %Optional.HasValue.type.db4 = name_ref HasValue, %.loc48_41.9 [concrete = constants.%Optional.HasValue.97a] -// CHECK:STDOUT: %Optional.HasValue.bound: = bound_method %.loc48_41.8, %HasValue.ref +// CHECK:STDOUT: %impl.elem3.loc81_41.1: @TestIterate.%.loc81_41.27 (%.a1e) = impl_witness_access constants.%Iterate.lookup_impl_witness.0da, element3 [symbolic = %impl.elem3.loc81_41.2 (constants.%impl.elem3.88b)] +// CHECK:STDOUT: %bound_method.loc81_41.3: = bound_method %r.ref, %impl.elem3.loc81_41.1 +// CHECK:STDOUT: %Iterate.facet.loc81_41.3: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.0da) [symbolic = %Iterate.facet.loc81_41.5 (constants.%Iterate.facet.394)] +// CHECK:STDOUT: %.loc81_41.3: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc81_41.3 [symbolic = %Iterate.facet.loc81_41.5 (constants.%Iterate.facet.394)] +// CHECK:STDOUT: %Iterate.facet.loc81_41.4: %Iterate.type = facet_value constants.%R.as_type, (constants.%Iterate.lookup_impl_witness.0da) [symbolic = %Iterate.facet.loc81_41.5 (constants.%Iterate.facet.394)] +// CHECK:STDOUT: %.loc81_41.4: %Iterate.type = converted constants.%R.as_type, %Iterate.facet.loc81_41.4 [symbolic = %Iterate.facet.loc81_41.5 (constants.%Iterate.facet.394)] +// CHECK:STDOUT: %.loc81_41.5: %Destroy.type = converted constants.%as_type.71d, constants.%impl.elem1.626 [symbolic = %impl.elem1 (constants.%impl.elem1.626)] +// CHECK:STDOUT: %.loc81_41.6: %Destroy.type = converted constants.%as_type.71d, constants.%impl.elem1.626 [symbolic = %impl.elem1 (constants.%impl.elem1.626)] +// CHECK:STDOUT: %specific_impl_fn.loc81_41.2: = specific_impl_function %impl.elem3.loc81_41.1, @Iterate.WithSelf.Next(constants.%Iterate.facet.394) [symbolic = %specific_impl_fn.loc81_41.4 (constants.%specific_impl_fn.36a)] +// CHECK:STDOUT: %bound_method.loc81_41.4: = bound_method %r.ref, %specific_impl_fn.loc81_41.2 +// CHECK:STDOUT: %.loc81_41.7: ref %Optional.81f = temporary_storage +// CHECK:STDOUT: %Iterate.WithSelf.Next.call: init %Optional.81f to %.loc81_41.7 = call %bound_method.loc81_41.4(%r.ref, %var) +// CHECK:STDOUT: %.loc81_41.8: ref %Optional.81f = temporary %.loc81_41.7, %Iterate.WithSelf.Next.call +// CHECK:STDOUT: %.loc81_41.9: %Optional.HasValue.type.db4 = specific_constant imports.%Core.import_ref.c82, @Optional(constants.%OptionalStorage.facet.61a) [concrete = constants.%Optional.HasValue.97a] +// CHECK:STDOUT: %HasValue.ref: %Optional.HasValue.type.db4 = name_ref HasValue, %.loc81_41.9 [concrete = constants.%Optional.HasValue.97a] +// CHECK:STDOUT: %Optional.HasValue.bound: = bound_method %.loc81_41.8, %HasValue.ref // CHECK:STDOUT: %Optional.HasValue.specific_fn: = specific_function %HasValue.ref, @Optional.HasValue(constants.%OptionalStorage.facet.61a) [concrete = constants.%Optional.HasValue.specific_fn.92c] -// CHECK:STDOUT: %bound_method.loc48_41.5: = bound_method %.loc48_41.8, %Optional.HasValue.specific_fn -// CHECK:STDOUT: %.loc48_41.10: %Optional.81f = acquire_value %.loc48_41.8 -// CHECK:STDOUT: %Optional.HasValue.call: init bool = call %bound_method.loc48_41.5(%.loc48_41.10) -// CHECK:STDOUT: %.loc48_41.11: bool = value_of_initializer %Optional.HasValue.call -// CHECK:STDOUT: %.loc48_41.12: bool = converted %Optional.HasValue.call, %.loc48_41.11 -// CHECK:STDOUT: if %.loc48_41.12 br !for.body else br !for.done +// CHECK:STDOUT: %bound_method.loc81_41.5: = bound_method %.loc81_41.8, %Optional.HasValue.specific_fn +// CHECK:STDOUT: %.loc81_41.10: %Optional.81f = acquire_value %.loc81_41.8 +// CHECK:STDOUT: %Optional.HasValue.call: init bool = call %bound_method.loc81_41.5(%.loc81_41.10) +// CHECK:STDOUT: %.loc81_41.11: bool = value_of_initializer %Optional.HasValue.call +// CHECK:STDOUT: %.loc81_41.12: bool = converted %Optional.HasValue.call, %.loc81_41.11 +// CHECK:STDOUT: if %.loc81_41.12 br !for.body else br !for.done // CHECK:STDOUT: // CHECK:STDOUT: !for.body: -// CHECK:STDOUT: %.loc48_41.13: %Optional.Get.type.0d8 = specific_constant imports.%Core.import_ref.29e, @Optional(constants.%OptionalStorage.facet.61a) [concrete = constants.%Optional.Get.2ea] -// CHECK:STDOUT: %Get.ref: %Optional.Get.type.0d8 = name_ref Get, %.loc48_41.13 [concrete = constants.%Optional.Get.2ea] -// CHECK:STDOUT: %Optional.Get.bound: = bound_method %.loc48_41.8, %Get.ref +// CHECK:STDOUT: %.loc81_41.13: %Optional.Get.type.0d8 = specific_constant imports.%Core.import_ref.29e, @Optional(constants.%OptionalStorage.facet.61a) [concrete = constants.%Optional.Get.2ea] +// CHECK:STDOUT: %Get.ref: %Optional.Get.type.0d8 = name_ref Get, %.loc81_41.13 [concrete = constants.%Optional.Get.2ea] +// CHECK:STDOUT: %Optional.Get.bound: = bound_method %.loc81_41.8, %Get.ref // CHECK:STDOUT: %Optional.Get.specific_fn: = specific_function %Get.ref, @Optional.Get(constants.%OptionalStorage.facet.61a) [concrete = constants.%Optional.Get.specific_fn.132] -// CHECK:STDOUT: %bound_method.loc48_41.6: = bound_method %.loc48_41.8, %Optional.Get.specific_fn -// CHECK:STDOUT: %.loc48_41.14: ref %ValueType = temporary_storage -// CHECK:STDOUT: %.loc48_41.15: %Optional.81f = acquire_value %.loc48_41.8 -// CHECK:STDOUT: %Optional.Get.call: init %ValueType to %.loc48_41.14 = call %bound_method.loc48_41.6(%.loc48_41.15) -// CHECK:STDOUT: %.loc48_41.16: ref %ValueType = temporary %.loc48_41.14, %Optional.Get.call -// CHECK:STDOUT: %.loc48_41.17: %ValueType = acquire_value %.loc48_41.16 -// CHECK:STDOUT: %.loc48_26: type = splice_block %ValueType.ref.loc48 [concrete = constants.%ValueType] { -// CHECK:STDOUT: %Cpp.ref.loc48: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %OverloadADL.ref.loc48: = name_ref OverloadADL, imports.%OverloadADL [concrete = imports.%OverloadADL] -// CHECK:STDOUT: %ValueType.ref.loc48: type = name_ref ValueType, imports.%ValueType.decl [concrete = constants.%ValueType] +// CHECK:STDOUT: %bound_method.loc81_41.6: = bound_method %.loc81_41.8, %Optional.Get.specific_fn +// CHECK:STDOUT: %.loc81_41.14: ref %ValueType = temporary_storage +// CHECK:STDOUT: %.loc81_41.15: %Optional.81f = acquire_value %.loc81_41.8 +// CHECK:STDOUT: %Optional.Get.call: init %ValueType to %.loc81_41.14 = call %bound_method.loc81_41.6(%.loc81_41.15) +// CHECK:STDOUT: %.loc81_41.16: ref %ValueType = temporary %.loc81_41.14, %Optional.Get.call +// CHECK:STDOUT: %.loc81_41.17: %ValueType = acquire_value %.loc81_41.16 +// CHECK:STDOUT: %.loc81_26: type = splice_block %ValueType.ref.loc81 [concrete = constants.%ValueType] { +// CHECK:STDOUT: %Cpp.ref.loc81: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %OverloadADL.ref.loc81: = name_ref OverloadADL, imports.%OverloadADL [concrete = imports.%OverloadADL] +// CHECK:STDOUT: %ValueType.ref.loc81: type = name_ref ValueType, imports.%ValueType.decl [concrete = constants.%ValueType] // CHECK:STDOUT: } -// CHECK:STDOUT: %i: %ValueType = wrapper_binding i, %.loc48_41.17 +// CHECK:STDOUT: %i: %ValueType = wrapper_binding i, %.loc81_41.17 // CHECK:STDOUT: %sum.ref: ref %ValueType = name_ref sum, %sum // CHECK:STDOUT: %i.ref: %ValueType = name_ref i, %i -// CHECK:STDOUT: %.loc49_12: ref %ValueType = value_as_ref %i.ref -// CHECK:STDOUT: %addr.loc49: %ptr.6ed = addr_of %.loc49_12 -// CHECK:STDOUT: %.loc49_9.1: %ptr.403 = as_compatible %addr.loc49 -// CHECK:STDOUT: %.loc49_9.2: %ptr.403 = converted %addr.loc49, %.loc49_9.1 -// CHECK:STDOUT: %operator_PlusEqual__carbon_thunk.call: ref %ValueType = call imports.%operator_PlusEqual__carbon_thunk.decl(%sum.ref, %.loc49_9.2) -// CHECK:STDOUT: %Destroy.facet.loc48_41.1: %Destroy.type = facet_value constants.%ValueType, (constants.%custom_witness.656, constants.%DestroyImpl.impl_witness.4c3) [concrete = constants.%Destroy.facet.cac] -// CHECK:STDOUT: %.loc48_41.18: %Destroy.type = converted constants.%ValueType, %Destroy.facet.loc48_41.1 [concrete = constants.%Destroy.facet.cac] -// CHECK:STDOUT: %Destroy.facet.loc48_41.2: %Destroy.type = facet_value constants.%ValueType, (constants.%custom_witness.656, constants.%DestroyImpl.impl_witness.4c3) [concrete = constants.%Destroy.facet.cac] -// CHECK:STDOUT: %.loc48_41.19: %Destroy.type = converted constants.%ValueType, %Destroy.facet.loc48_41.2 [concrete = constants.%Destroy.facet.cac] +// CHECK:STDOUT: %.loc82_12: ref %ValueType = value_as_ref %i.ref +// CHECK:STDOUT: %addr.loc82: %ptr.6ed = addr_of %.loc82_12 +// CHECK:STDOUT: %.loc82_9.1: %ptr.403 = as_compatible %addr.loc82 +// CHECK:STDOUT: %.loc82_9.2: %ptr.403 = converted %addr.loc82, %.loc82_9.1 +// CHECK:STDOUT: %operator_PlusEqual__carbon_thunk.call: ref %ValueType = call imports.%operator_PlusEqual__carbon_thunk.decl(%sum.ref, %.loc82_9.2) +// CHECK:STDOUT: %Destroy.facet.loc81_41.1: %Destroy.type = facet_value constants.%ValueType, (constants.%custom_witness.656, constants.%DestroyImpl.impl_witness.4c3) [concrete = constants.%Destroy.facet.cac] +// CHECK:STDOUT: %.loc81_41.18: %Destroy.type = converted constants.%ValueType, %Destroy.facet.loc81_41.1 [concrete = constants.%Destroy.facet.cac] +// CHECK:STDOUT: %Destroy.facet.loc81_41.2: %Destroy.type = facet_value constants.%ValueType, (constants.%custom_witness.656, constants.%DestroyImpl.impl_witness.4c3) [concrete = constants.%Destroy.facet.cac] +// CHECK:STDOUT: %.loc81_41.19: %Destroy.type = converted constants.%ValueType, %Destroy.facet.loc81_41.2 [concrete = constants.%Destroy.facet.cac] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc48_41.1: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%.loc48_41.16) -// CHECK:STDOUT: %Destroy.facet.loc48_41.3: %Destroy.type = facet_value constants.%Optional.81f, (constants.%custom_witness.b80ef6.7, constants.%DestroyImpl.impl_witness.e67) [concrete = constants.%Destroy.facet.434] -// CHECK:STDOUT: %.loc48_41.20: %Destroy.type = converted constants.%Optional.81f, %Destroy.facet.loc48_41.3 [concrete = constants.%Destroy.facet.434] -// CHECK:STDOUT: %Destroy.facet.loc48_41.4: %Destroy.type = facet_value constants.%Optional.81f, (constants.%custom_witness.b80ef6.7, constants.%DestroyImpl.impl_witness.e67) [concrete = constants.%Destroy.facet.434] -// CHECK:STDOUT: %.loc48_41.21: %Destroy.type = converted constants.%Optional.81f, %Destroy.facet.loc48_41.4 [concrete = constants.%Destroy.facet.434] +// CHECK:STDOUT: %SelfDestruct.call.loc81_41.1: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%.loc81_41.16) +// CHECK:STDOUT: %Destroy.facet.loc81_41.3: %Destroy.type = facet_value constants.%Optional.81f, (constants.%custom_witness.b80ef6.7, constants.%DestroyImpl.impl_witness.e67) [concrete = constants.%Destroy.facet.434] +// CHECK:STDOUT: %.loc81_41.20: %Destroy.type = converted constants.%Optional.81f, %Destroy.facet.loc81_41.3 [concrete = constants.%Destroy.facet.434] +// CHECK:STDOUT: %Destroy.facet.loc81_41.4: %Destroy.type = facet_value constants.%Optional.81f, (constants.%custom_witness.b80ef6.7, constants.%DestroyImpl.impl_witness.e67) [concrete = constants.%Destroy.facet.434] +// CHECK:STDOUT: %.loc81_41.21: %Destroy.type = converted constants.%Optional.81f, %Destroy.facet.loc81_41.4 [concrete = constants.%Destroy.facet.434] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc48_41.2: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%.loc48_41.8) +// CHECK:STDOUT: %SelfDestruct.call.loc81_41.2: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%.loc81_41.8) // CHECK:STDOUT: br !for.next // CHECK:STDOUT: // CHECK:STDOUT: !for.done: -// CHECK:STDOUT: %Destroy.facet.loc48_41.5: %Destroy.type = facet_value constants.%Optional.81f, (constants.%custom_witness.b80ef6.7, constants.%DestroyImpl.impl_witness.e67) [concrete = constants.%Destroy.facet.434] -// CHECK:STDOUT: %.loc48_41.22: %Destroy.type = converted constants.%Optional.81f, %Destroy.facet.loc48_41.5 [concrete = constants.%Destroy.facet.434] -// CHECK:STDOUT: %Destroy.facet.loc48_41.6: %Destroy.type = facet_value constants.%Optional.81f, (constants.%custom_witness.b80ef6.7, constants.%DestroyImpl.impl_witness.e67) [concrete = constants.%Destroy.facet.434] -// CHECK:STDOUT: %.loc48_41.23: %Destroy.type = converted constants.%Optional.81f, %Destroy.facet.loc48_41.6 [concrete = constants.%Destroy.facet.434] +// CHECK:STDOUT: %Destroy.facet.loc81_41.5: %Destroy.type = facet_value constants.%Optional.81f, (constants.%custom_witness.b80ef6.7, constants.%DestroyImpl.impl_witness.e67) [concrete = constants.%Destroy.facet.434] +// CHECK:STDOUT: %.loc81_41.22: %Destroy.type = converted constants.%Optional.81f, %Destroy.facet.loc81_41.5 [concrete = constants.%Destroy.facet.434] +// CHECK:STDOUT: %Destroy.facet.loc81_41.6: %Destroy.type = facet_value constants.%Optional.81f, (constants.%custom_witness.b80ef6.7, constants.%DestroyImpl.impl_witness.e67) [concrete = constants.%Destroy.facet.434] +// CHECK:STDOUT: %.loc81_41.23: %Destroy.type = converted constants.%Optional.81f, %Destroy.facet.loc81_41.6 [concrete = constants.%Destroy.facet.434] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc48_41.3: init %empty_tuple.type = call %SelfDestruct.specific_fn.3(%.loc48_41.8) -// CHECK:STDOUT: %.loc48_41.24: %Destroy.type = converted constants.%as_type.71d, constants.%impl.elem1.626 [symbolic = %impl.elem1 (constants.%impl.elem1.626)] -// CHECK:STDOUT: %.loc48_41.25: %Destroy.type = converted constants.%as_type.71d, constants.%impl.elem1.626 [symbolic = %impl.elem1 (constants.%impl.elem1.626)] +// CHECK:STDOUT: %SelfDestruct.call.loc81_41.3: init %empty_tuple.type = call %SelfDestruct.specific_fn.3(%.loc81_41.8) +// CHECK:STDOUT: %.loc81_41.24: %Destroy.type = converted constants.%as_type.71d, constants.%impl.elem1.626 [symbolic = %impl.elem1 (constants.%impl.elem1.626)] +// CHECK:STDOUT: %.loc81_41.25: %Destroy.type = converted constants.%as_type.71d, constants.%impl.elem1.626 [symbolic = %impl.elem1 (constants.%impl.elem1.626)] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc48_41.4: init %empty_tuple.type = call %SelfDestruct.specific_fn.4(%var) +// CHECK:STDOUT: %SelfDestruct.call.loc81_41.4: init %empty_tuple.type = call %SelfDestruct.specific_fn.4(%var) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc48_41.1(%self.param: ref %.8f3) { +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc81_41.1(%self.param: ref %.8f3) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc48_41.2(%self.param: ref %MaybeUnformed.4b9) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc81_41.2(%self.param: ref %MaybeUnformed.4b9) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc48_41.3(%self.param: ref bool) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc81_41.3(%self.param: ref bool) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc48_41.4(%self.param: ref %struct_type.value.has_value.640) { +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc81_41.4(%self.param: ref %struct_type.value.has_value.640) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc48_41.1: ref bool = struct_access %self.param, element1 -// CHECK:STDOUT: %Destroy.facet.loc48_41.1: %Destroy.type = facet_value bool, (constants.%custom_witness.b80ef6.4, constants.%DestroyImpl.impl_witness.778) [concrete = constants.%Destroy.facet.80c] -// CHECK:STDOUT: %.loc48_41.2: %Destroy.type = converted bool, %Destroy.facet.loc48_41.1 [concrete = constants.%Destroy.facet.80c] -// CHECK:STDOUT: %Destroy.facet.loc48_41.2: %Destroy.type = facet_value bool, (constants.%custom_witness.b80ef6.4, constants.%DestroyImpl.impl_witness.778) [concrete = constants.%Destroy.facet.80c] -// CHECK:STDOUT: %.loc48_41.3: %Destroy.type = converted bool, %Destroy.facet.loc48_41.2 [concrete = constants.%Destroy.facet.80c] +// CHECK:STDOUT: %.loc81_41.1: ref bool = struct_access %self.param, element1 +// CHECK:STDOUT: %Destroy.facet.loc81_41.1: %Destroy.type = facet_value bool, (constants.%custom_witness.b80ef6.4, constants.%DestroyImpl.impl_witness.778) [concrete = constants.%Destroy.facet.80c] +// CHECK:STDOUT: %.loc81_41.2: %Destroy.type = converted bool, %Destroy.facet.loc81_41.1 [concrete = constants.%Destroy.facet.80c] +// CHECK:STDOUT: %Destroy.facet.loc81_41.2: %Destroy.type = facet_value bool, (constants.%custom_witness.b80ef6.4, constants.%DestroyImpl.impl_witness.778) [concrete = constants.%Destroy.facet.80c] +// CHECK:STDOUT: %.loc81_41.3: %Destroy.type = converted bool, %Destroy.facet.loc81_41.2 [concrete = constants.%Destroy.facet.80c] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc48_41.1: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%.loc48_41.1) -// CHECK:STDOUT: %.loc48_41.4: ref %MaybeUnformed.4b9 = struct_access %self.param, element0 -// CHECK:STDOUT: %Destroy.facet.loc48_41.3: %Destroy.type = facet_value constants.%MaybeUnformed.4b9, (constants.%custom_witness.b80ef6.3, constants.%DestroyImpl.impl_witness.e80) [concrete = constants.%Destroy.facet.eca] -// CHECK:STDOUT: %.loc48_41.5: %Destroy.type = converted constants.%MaybeUnformed.4b9, %Destroy.facet.loc48_41.3 [concrete = constants.%Destroy.facet.eca] -// CHECK:STDOUT: %Destroy.facet.loc48_41.4: %Destroy.type = facet_value constants.%MaybeUnformed.4b9, (constants.%custom_witness.b80ef6.3, constants.%DestroyImpl.impl_witness.e80) [concrete = constants.%Destroy.facet.eca] -// CHECK:STDOUT: %.loc48_41.6: %Destroy.type = converted constants.%MaybeUnformed.4b9, %Destroy.facet.loc48_41.4 [concrete = constants.%Destroy.facet.eca] +// CHECK:STDOUT: %SelfDestruct.call.loc81_41.1: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%.loc81_41.1) +// CHECK:STDOUT: %.loc81_41.4: ref %MaybeUnformed.4b9 = struct_access %self.param, element0 +// CHECK:STDOUT: %Destroy.facet.loc81_41.3: %Destroy.type = facet_value constants.%MaybeUnformed.4b9, (constants.%custom_witness.b80ef6.3, constants.%DestroyImpl.impl_witness.e80) [concrete = constants.%Destroy.facet.eca] +// CHECK:STDOUT: %.loc81_41.5: %Destroy.type = converted constants.%MaybeUnformed.4b9, %Destroy.facet.loc81_41.3 [concrete = constants.%Destroy.facet.eca] +// CHECK:STDOUT: %Destroy.facet.loc81_41.4: %Destroy.type = facet_value constants.%MaybeUnformed.4b9, (constants.%custom_witness.b80ef6.3, constants.%DestroyImpl.impl_witness.e80) [concrete = constants.%Destroy.facet.eca] +// CHECK:STDOUT: %.loc81_41.6: %Destroy.type = converted constants.%MaybeUnformed.4b9, %Destroy.facet.loc81_41.4 [concrete = constants.%Destroy.facet.eca] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc48_41.2: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%.loc48_41.4) +// CHECK:STDOUT: %SelfDestruct.call.loc81_41.2: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%.loc81_41.4) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc48_41.5(%self.param: ref %DefaultOptionalStorage.dff) { +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc81_41.5(%self.param: ref %DefaultOptionalStorage.dff) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %has_value.ref: %DefaultOptionalStorage.elem.6f9 = name_ref has_value, imports.%Core.import_ref.9ce [concrete = imports.%field_decl.dbe] -// CHECK:STDOUT: %.loc48_41.1: ref bool = class_element_access %self.param, element1 -// CHECK:STDOUT: %Destroy.facet.loc48_41.1: %Destroy.type = facet_value bool, (constants.%custom_witness.b80ef6.4, constants.%DestroyImpl.impl_witness.778) [concrete = constants.%Destroy.facet.80c] -// CHECK:STDOUT: %.loc48_41.2: %Destroy.type = converted bool, %Destroy.facet.loc48_41.1 [concrete = constants.%Destroy.facet.80c] -// CHECK:STDOUT: %Destroy.facet.loc48_41.2: %Destroy.type = facet_value bool, (constants.%custom_witness.b80ef6.4, constants.%DestroyImpl.impl_witness.778) [concrete = constants.%Destroy.facet.80c] -// CHECK:STDOUT: %.loc48_41.3: %Destroy.type = converted bool, %Destroy.facet.loc48_41.2 [concrete = constants.%Destroy.facet.80c] +// CHECK:STDOUT: %.loc81_41.1: ref bool = class_element_access %self.param, element1 +// CHECK:STDOUT: %Destroy.facet.loc81_41.1: %Destroy.type = facet_value bool, (constants.%custom_witness.b80ef6.4, constants.%DestroyImpl.impl_witness.778) [concrete = constants.%Destroy.facet.80c] +// CHECK:STDOUT: %.loc81_41.2: %Destroy.type = converted bool, %Destroy.facet.loc81_41.1 [concrete = constants.%Destroy.facet.80c] +// CHECK:STDOUT: %Destroy.facet.loc81_41.2: %Destroy.type = facet_value bool, (constants.%custom_witness.b80ef6.4, constants.%DestroyImpl.impl_witness.778) [concrete = constants.%Destroy.facet.80c] +// CHECK:STDOUT: %.loc81_41.3: %Destroy.type = converted bool, %Destroy.facet.loc81_41.2 [concrete = constants.%Destroy.facet.80c] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc48_41.1: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%.loc48_41.1) +// CHECK:STDOUT: %SelfDestruct.call.loc81_41.1: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%.loc81_41.1) // CHECK:STDOUT: %value.ref: %DefaultOptionalStorage.elem.2ce = name_ref value, imports.%Core.import_ref.e86 [concrete = imports.%field_decl.bce] -// CHECK:STDOUT: %.loc48_41.4: ref %MaybeUnformed.4b9 = class_element_access %self.param, element0 -// CHECK:STDOUT: %Destroy.facet.loc48_41.3: %Destroy.type = facet_value constants.%MaybeUnformed.4b9, (constants.%custom_witness.b80ef6.3, constants.%DestroyImpl.impl_witness.e80) [concrete = constants.%Destroy.facet.eca] -// CHECK:STDOUT: %.loc48_41.5: %Destroy.type = converted constants.%MaybeUnformed.4b9, %Destroy.facet.loc48_41.3 [concrete = constants.%Destroy.facet.eca] -// CHECK:STDOUT: %Destroy.facet.loc48_41.4: %Destroy.type = facet_value constants.%MaybeUnformed.4b9, (constants.%custom_witness.b80ef6.3, constants.%DestroyImpl.impl_witness.e80) [concrete = constants.%Destroy.facet.eca] -// CHECK:STDOUT: %.loc48_41.6: %Destroy.type = converted constants.%MaybeUnformed.4b9, %Destroy.facet.loc48_41.4 [concrete = constants.%Destroy.facet.eca] +// CHECK:STDOUT: %.loc81_41.4: ref %MaybeUnformed.4b9 = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.facet.loc81_41.3: %Destroy.type = facet_value constants.%MaybeUnformed.4b9, (constants.%custom_witness.b80ef6.3, constants.%DestroyImpl.impl_witness.e80) [concrete = constants.%Destroy.facet.eca] +// CHECK:STDOUT: %.loc81_41.5: %Destroy.type = converted constants.%MaybeUnformed.4b9, %Destroy.facet.loc81_41.3 [concrete = constants.%Destroy.facet.eca] +// CHECK:STDOUT: %Destroy.facet.loc81_41.4: %Destroy.type = facet_value constants.%MaybeUnformed.4b9, (constants.%custom_witness.b80ef6.3, constants.%DestroyImpl.impl_witness.e80) [concrete = constants.%Destroy.facet.eca] +// CHECK:STDOUT: %.loc81_41.6: %Destroy.type = converted constants.%MaybeUnformed.4b9, %Destroy.facet.loc81_41.4 [concrete = constants.%Destroy.facet.eca] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc48_41.2: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%.loc48_41.4) +// CHECK:STDOUT: %SelfDestruct.call.loc81_41.2: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%.loc81_41.4) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc48_41.6(%self.param: ref %Optional.81f) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc81_41.6(%self.param: ref %Optional.81f) = "no_op"; // CHECK:STDOUT: // CHECK:STDOUT: fn @TestRangeFor(%mc.param: ref %MutableAndConstRange) { // CHECK:STDOUT: !entry: @@ -4840,129 +5147,129 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: } // CHECK:STDOUT: %mc.ref: ref %MutableAndConstRange = name_ref mc, %mc // CHECK:STDOUT: %impl.elem2: %.227 = impl_witness_access constants.%Iterate.impl_witness.3b4, element2 [concrete = constants.%T.as_type.as.Iterate.impl.NewCursor.8e0] -// CHECK:STDOUT: %bound_method.loc62_42.1: = bound_method %mc.ref, %impl.elem2 -// CHECK:STDOUT: %facet_value.loc62_42.1: %CppRange_where.type.d682d6.1 = facet_value constants.%MutableAndConstRange, (constants.%custom_witness.660, constants.%custom_witness.992, constants.%DestroyImpl.impl_witness.52a, constants.%custom_witness.d56, constants.%custom_witness.68a, constants.%custom_witness.edd, constants.%custom_witness.656, constants.%DestroyImpl.impl_witness.4c3, constants.%custom_witness.1c5, constants.%custom_witness.992, constants.%DestroyImpl.impl_witness.52a) [concrete = constants.%facet_value.b85] -// CHECK:STDOUT: %.loc62_42.1: %CppRange_where.type.d682d6.1 = converted constants.%MutableAndConstRange, %facet_value.loc62_42.1 [concrete = constants.%facet_value.b85] -// CHECK:STDOUT: %facet_value.loc62_42.2: %CppRange_where.type.d682d6.1 = facet_value constants.%MutableAndConstRange, (constants.%custom_witness.660, constants.%custom_witness.992, constants.%DestroyImpl.impl_witness.52a, constants.%custom_witness.d56, constants.%custom_witness.68a, constants.%custom_witness.edd, constants.%custom_witness.656, constants.%DestroyImpl.impl_witness.4c3, constants.%custom_witness.1c5, constants.%custom_witness.992, constants.%DestroyImpl.impl_witness.52a) [concrete = constants.%facet_value.b85] -// CHECK:STDOUT: %.loc62_42.2: %CppRange_where.type.d682d6.1 = converted constants.%MutableAndConstRange, %facet_value.loc62_42.2 [concrete = constants.%facet_value.b85] -// CHECK:STDOUT: %specific_fn.loc62_42.1: = specific_function %impl.elem2, @T.as_type.as.Iterate.impl.NewCursor(constants.%facet_value.b85) [concrete = constants.%T.as_type.as.Iterate.impl.NewCursor.specific_fn] -// CHECK:STDOUT: %bound_method.loc62_42.2: = bound_method %mc.ref, %specific_fn.loc62_42.1 +// CHECK:STDOUT: %bound_method.loc95_42.1: = bound_method %mc.ref, %impl.elem2 +// CHECK:STDOUT: %facet_value.loc95_42.1: %CppRange_where.type.d682d6.1 = facet_value constants.%MutableAndConstRange, (constants.%custom_witness.660, constants.%custom_witness.992, constants.%DestroyImpl.impl_witness.52a, constants.%custom_witness.d56, constants.%custom_witness.68a, constants.%custom_witness.edd, constants.%custom_witness.656, constants.%DestroyImpl.impl_witness.4c3, constants.%custom_witness.1c5, constants.%custom_witness.992, constants.%DestroyImpl.impl_witness.52a) [concrete = constants.%facet_value.b85] +// CHECK:STDOUT: %.loc95_42.1: %CppRange_where.type.d682d6.1 = converted constants.%MutableAndConstRange, %facet_value.loc95_42.1 [concrete = constants.%facet_value.b85] +// CHECK:STDOUT: %facet_value.loc95_42.2: %CppRange_where.type.d682d6.1 = facet_value constants.%MutableAndConstRange, (constants.%custom_witness.660, constants.%custom_witness.992, constants.%DestroyImpl.impl_witness.52a, constants.%custom_witness.d56, constants.%custom_witness.68a, constants.%custom_witness.edd, constants.%custom_witness.656, constants.%DestroyImpl.impl_witness.4c3, constants.%custom_witness.1c5, constants.%custom_witness.992, constants.%DestroyImpl.impl_witness.52a) [concrete = constants.%facet_value.b85] +// CHECK:STDOUT: %.loc95_42.2: %CppRange_where.type.d682d6.1 = converted constants.%MutableAndConstRange, %facet_value.loc95_42.2 [concrete = constants.%facet_value.b85] +// CHECK:STDOUT: %specific_fn.loc95_42.1: = specific_function %impl.elem2, @T.as_type.as.Iterate.impl.NewCursor(constants.%facet_value.b85) [concrete = constants.%T.as_type.as.Iterate.impl.NewCursor.specific_fn] +// CHECK:STDOUT: %bound_method.loc95_42.2: = bound_method %mc.ref, %specific_fn.loc95_42.1 // CHECK:STDOUT: %var: ref %tuple.type.de6 = var_storage invalid -// CHECK:STDOUT: %.loc62_40.1: %MutableAndConstRange = acquire_value %mc.ref -// CHECK:STDOUT: %T.as_type.as.Iterate.impl.NewCursor.call: init %tuple.type.de6 to %var = call %bound_method.loc62_42.2(%.loc62_40.1) +// CHECK:STDOUT: %.loc95_40.1: %MutableAndConstRange = acquire_value %mc.ref +// CHECK:STDOUT: %T.as_type.as.Iterate.impl.NewCursor.call: init %tuple.type.de6 to %var = call %bound_method.loc95_42.2(%.loc95_40.1) // CHECK:STDOUT: assign %var, %T.as_type.as.Iterate.impl.NewCursor.call // CHECK:STDOUT: br !for.next // CHECK:STDOUT: // CHECK:STDOUT: !for.next: // CHECK:STDOUT: %impl.elem3: %.343 = impl_witness_access constants.%Iterate.impl_witness.3b4, element3 [concrete = constants.%T.as_type.as.Iterate.impl.Next.353] -// CHECK:STDOUT: %bound_method.loc62_42.3: = bound_method %mc.ref, %impl.elem3 -// CHECK:STDOUT: %facet_value.loc62_42.3: %CppRange_where.type.d682d6.1 = facet_value constants.%MutableAndConstRange, (constants.%custom_witness.660, constants.%custom_witness.992, constants.%DestroyImpl.impl_witness.52a, constants.%custom_witness.d56, constants.%custom_witness.68a, constants.%custom_witness.edd, constants.%custom_witness.656, constants.%DestroyImpl.impl_witness.4c3, constants.%custom_witness.1c5, constants.%custom_witness.992, constants.%DestroyImpl.impl_witness.52a) [concrete = constants.%facet_value.b85] -// CHECK:STDOUT: %.loc62_42.3: %CppRange_where.type.d682d6.1 = converted constants.%MutableAndConstRange, %facet_value.loc62_42.3 [concrete = constants.%facet_value.b85] -// CHECK:STDOUT: %facet_value.loc62_42.4: %CppRange_where.type.d682d6.1 = facet_value constants.%MutableAndConstRange, (constants.%custom_witness.660, constants.%custom_witness.992, constants.%DestroyImpl.impl_witness.52a, constants.%custom_witness.d56, constants.%custom_witness.68a, constants.%custom_witness.edd, constants.%custom_witness.656, constants.%DestroyImpl.impl_witness.4c3, constants.%custom_witness.1c5, constants.%custom_witness.992, constants.%DestroyImpl.impl_witness.52a) [concrete = constants.%facet_value.b85] -// CHECK:STDOUT: %.loc62_42.4: %CppRange_where.type.d682d6.1 = converted constants.%MutableAndConstRange, %facet_value.loc62_42.4 [concrete = constants.%facet_value.b85] -// CHECK:STDOUT: %specific_fn.loc62_42.2: = specific_function %impl.elem3, @T.as_type.as.Iterate.impl.Next(constants.%facet_value.b85) [concrete = constants.%T.as_type.as.Iterate.impl.Next.specific_fn] -// CHECK:STDOUT: %bound_method.loc62_42.4: = bound_method %mc.ref, %specific_fn.loc62_42.2 -// CHECK:STDOUT: %.loc62_42.5: ref %Optional.81f = temporary_storage -// CHECK:STDOUT: %.loc62_40.2: %MutableAndConstRange = acquire_value %mc.ref -// CHECK:STDOUT: %T.as_type.as.Iterate.impl.Next.call: init %Optional.81f to %.loc62_42.5 = call %bound_method.loc62_42.4(%.loc62_40.2, %var) -// CHECK:STDOUT: %.loc62_42.6: ref %Optional.81f = temporary %.loc62_42.5, %T.as_type.as.Iterate.impl.Next.call -// CHECK:STDOUT: %.loc62_42.7: %Optional.HasValue.type.db4 = specific_constant imports.%Core.import_ref.c82, @Optional(constants.%OptionalStorage.facet.61a) [concrete = constants.%Optional.HasValue.97a] -// CHECK:STDOUT: %HasValue.ref: %Optional.HasValue.type.db4 = name_ref HasValue, %.loc62_42.7 [concrete = constants.%Optional.HasValue.97a] -// CHECK:STDOUT: %Optional.HasValue.bound: = bound_method %.loc62_42.6, %HasValue.ref +// CHECK:STDOUT: %bound_method.loc95_42.3: = bound_method %mc.ref, %impl.elem3 +// CHECK:STDOUT: %facet_value.loc95_42.3: %CppRange_where.type.d682d6.1 = facet_value constants.%MutableAndConstRange, (constants.%custom_witness.660, constants.%custom_witness.992, constants.%DestroyImpl.impl_witness.52a, constants.%custom_witness.d56, constants.%custom_witness.68a, constants.%custom_witness.edd, constants.%custom_witness.656, constants.%DestroyImpl.impl_witness.4c3, constants.%custom_witness.1c5, constants.%custom_witness.992, constants.%DestroyImpl.impl_witness.52a) [concrete = constants.%facet_value.b85] +// CHECK:STDOUT: %.loc95_42.3: %CppRange_where.type.d682d6.1 = converted constants.%MutableAndConstRange, %facet_value.loc95_42.3 [concrete = constants.%facet_value.b85] +// CHECK:STDOUT: %facet_value.loc95_42.4: %CppRange_where.type.d682d6.1 = facet_value constants.%MutableAndConstRange, (constants.%custom_witness.660, constants.%custom_witness.992, constants.%DestroyImpl.impl_witness.52a, constants.%custom_witness.d56, constants.%custom_witness.68a, constants.%custom_witness.edd, constants.%custom_witness.656, constants.%DestroyImpl.impl_witness.4c3, constants.%custom_witness.1c5, constants.%custom_witness.992, constants.%DestroyImpl.impl_witness.52a) [concrete = constants.%facet_value.b85] +// CHECK:STDOUT: %.loc95_42.4: %CppRange_where.type.d682d6.1 = converted constants.%MutableAndConstRange, %facet_value.loc95_42.4 [concrete = constants.%facet_value.b85] +// CHECK:STDOUT: %specific_fn.loc95_42.2: = specific_function %impl.elem3, @T.as_type.as.Iterate.impl.Next(constants.%facet_value.b85) [concrete = constants.%T.as_type.as.Iterate.impl.Next.specific_fn] +// CHECK:STDOUT: %bound_method.loc95_42.4: = bound_method %mc.ref, %specific_fn.loc95_42.2 +// CHECK:STDOUT: %.loc95_42.5: ref %Optional.81f = temporary_storage +// CHECK:STDOUT: %.loc95_40.2: %MutableAndConstRange = acquire_value %mc.ref +// CHECK:STDOUT: %T.as_type.as.Iterate.impl.Next.call: init %Optional.81f to %.loc95_42.5 = call %bound_method.loc95_42.4(%.loc95_40.2, %var) +// CHECK:STDOUT: %.loc95_42.6: ref %Optional.81f = temporary %.loc95_42.5, %T.as_type.as.Iterate.impl.Next.call +// CHECK:STDOUT: %.loc95_42.7: %Optional.HasValue.type.db4 = specific_constant imports.%Core.import_ref.c82, @Optional(constants.%OptionalStorage.facet.61a) [concrete = constants.%Optional.HasValue.97a] +// CHECK:STDOUT: %HasValue.ref: %Optional.HasValue.type.db4 = name_ref HasValue, %.loc95_42.7 [concrete = constants.%Optional.HasValue.97a] +// CHECK:STDOUT: %Optional.HasValue.bound: = bound_method %.loc95_42.6, %HasValue.ref // CHECK:STDOUT: %Optional.HasValue.specific_fn: = specific_function %HasValue.ref, @Optional.HasValue(constants.%OptionalStorage.facet.61a) [concrete = constants.%Optional.HasValue.specific_fn.92c] -// CHECK:STDOUT: %bound_method.loc62_42.5: = bound_method %.loc62_42.6, %Optional.HasValue.specific_fn -// CHECK:STDOUT: %.loc62_42.8: %Optional.81f = acquire_value %.loc62_42.6 -// CHECK:STDOUT: %Optional.HasValue.call: init bool = call %bound_method.loc62_42.5(%.loc62_42.8) -// CHECK:STDOUT: %.loc62_42.9: bool = value_of_initializer %Optional.HasValue.call -// CHECK:STDOUT: %.loc62_42.10: bool = converted %Optional.HasValue.call, %.loc62_42.9 -// CHECK:STDOUT: if %.loc62_42.10 br !for.body else br !for.done +// CHECK:STDOUT: %bound_method.loc95_42.5: = bound_method %.loc95_42.6, %Optional.HasValue.specific_fn +// CHECK:STDOUT: %.loc95_42.8: %Optional.81f = acquire_value %.loc95_42.6 +// CHECK:STDOUT: %Optional.HasValue.call: init bool = call %bound_method.loc95_42.5(%.loc95_42.8) +// CHECK:STDOUT: %.loc95_42.9: bool = value_of_initializer %Optional.HasValue.call +// CHECK:STDOUT: %.loc95_42.10: bool = converted %Optional.HasValue.call, %.loc95_42.9 +// CHECK:STDOUT: if %.loc95_42.10 br !for.body else br !for.done // CHECK:STDOUT: // CHECK:STDOUT: !for.body: -// CHECK:STDOUT: %.loc62_42.11: %Optional.Get.type.0d8 = specific_constant imports.%Core.import_ref.29e, @Optional(constants.%OptionalStorage.facet.61a) [concrete = constants.%Optional.Get.2ea] -// CHECK:STDOUT: %Get.ref: %Optional.Get.type.0d8 = name_ref Get, %.loc62_42.11 [concrete = constants.%Optional.Get.2ea] -// CHECK:STDOUT: %Optional.Get.bound: = bound_method %.loc62_42.6, %Get.ref +// CHECK:STDOUT: %.loc95_42.11: %Optional.Get.type.0d8 = specific_constant imports.%Core.import_ref.29e, @Optional(constants.%OptionalStorage.facet.61a) [concrete = constants.%Optional.Get.2ea] +// CHECK:STDOUT: %Get.ref: %Optional.Get.type.0d8 = name_ref Get, %.loc95_42.11 [concrete = constants.%Optional.Get.2ea] +// CHECK:STDOUT: %Optional.Get.bound: = bound_method %.loc95_42.6, %Get.ref // CHECK:STDOUT: %Optional.Get.specific_fn: = specific_function %Get.ref, @Optional.Get(constants.%OptionalStorage.facet.61a) [concrete = constants.%Optional.Get.specific_fn.132] -// CHECK:STDOUT: %bound_method.loc62_42.6: = bound_method %.loc62_42.6, %Optional.Get.specific_fn -// CHECK:STDOUT: %.loc62_42.12: ref %ValueType = temporary_storage -// CHECK:STDOUT: %.loc62_42.13: %Optional.81f = acquire_value %.loc62_42.6 -// CHECK:STDOUT: %Optional.Get.call: init %ValueType to %.loc62_42.12 = call %bound_method.loc62_42.6(%.loc62_42.13) -// CHECK:STDOUT: %.loc62_42.14: ref %ValueType = temporary %.loc62_42.12, %Optional.Get.call -// CHECK:STDOUT: %.loc62_42.15: %ValueType = acquire_value %.loc62_42.14 -// CHECK:STDOUT: %.loc62_26: type = splice_block %ValueType.ref.loc62 [concrete = constants.%ValueType] { -// CHECK:STDOUT: %Cpp.ref.loc62: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %OverloadADL.ref.loc62: = name_ref OverloadADL, imports.%OverloadADL [concrete = imports.%OverloadADL] -// CHECK:STDOUT: %ValueType.ref.loc62: type = name_ref ValueType, imports.%ValueType.decl [concrete = constants.%ValueType] +// CHECK:STDOUT: %bound_method.loc95_42.6: = bound_method %.loc95_42.6, %Optional.Get.specific_fn +// CHECK:STDOUT: %.loc95_42.12: ref %ValueType = temporary_storage +// CHECK:STDOUT: %.loc95_42.13: %Optional.81f = acquire_value %.loc95_42.6 +// CHECK:STDOUT: %Optional.Get.call: init %ValueType to %.loc95_42.12 = call %bound_method.loc95_42.6(%.loc95_42.13) +// CHECK:STDOUT: %.loc95_42.14: ref %ValueType = temporary %.loc95_42.12, %Optional.Get.call +// CHECK:STDOUT: %.loc95_42.15: %ValueType = acquire_value %.loc95_42.14 +// CHECK:STDOUT: %.loc95_26: type = splice_block %ValueType.ref.loc95 [concrete = constants.%ValueType] { +// CHECK:STDOUT: %Cpp.ref.loc95: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %OverloadADL.ref.loc95: = name_ref OverloadADL, imports.%OverloadADL [concrete = imports.%OverloadADL] +// CHECK:STDOUT: %ValueType.ref.loc95: type = name_ref ValueType, imports.%ValueType.decl [concrete = constants.%ValueType] // CHECK:STDOUT: } -// CHECK:STDOUT: %i: %ValueType = wrapper_binding i, %.loc62_42.15 +// CHECK:STDOUT: %i: %ValueType = wrapper_binding i, %.loc95_42.15 // CHECK:STDOUT: %sum.ref: ref %ValueType = name_ref sum, %sum // CHECK:STDOUT: %i.ref: %ValueType = name_ref i, %i -// CHECK:STDOUT: %.loc63_12: ref %ValueType = value_as_ref %i.ref -// CHECK:STDOUT: %addr.loc63: %ptr.6ed = addr_of %.loc63_12 -// CHECK:STDOUT: %.loc63_9.1: %ptr.403 = as_compatible %addr.loc63 -// CHECK:STDOUT: %.loc63_9.2: %ptr.403 = converted %addr.loc63, %.loc63_9.1 -// CHECK:STDOUT: %operator_PlusEqual__carbon_thunk.call: ref %ValueType = call imports.%operator_PlusEqual__carbon_thunk.decl(%sum.ref, %.loc63_9.2) -// CHECK:STDOUT: %Destroy.facet.loc62_42.1: %Destroy.type = facet_value constants.%ValueType, (constants.%custom_witness.656, constants.%DestroyImpl.impl_witness.4c3) [concrete = constants.%Destroy.facet.cac] -// CHECK:STDOUT: %.loc62_42.16: %Destroy.type = converted constants.%ValueType, %Destroy.facet.loc62_42.1 [concrete = constants.%Destroy.facet.cac] -// CHECK:STDOUT: %Destroy.facet.loc62_42.2: %Destroy.type = facet_value constants.%ValueType, (constants.%custom_witness.656, constants.%DestroyImpl.impl_witness.4c3) [concrete = constants.%Destroy.facet.cac] -// CHECK:STDOUT: %.loc62_42.17: %Destroy.type = converted constants.%ValueType, %Destroy.facet.loc62_42.2 [concrete = constants.%Destroy.facet.cac] +// CHECK:STDOUT: %.loc96_12: ref %ValueType = value_as_ref %i.ref +// CHECK:STDOUT: %addr.loc96: %ptr.6ed = addr_of %.loc96_12 +// CHECK:STDOUT: %.loc96_9.1: %ptr.403 = as_compatible %addr.loc96 +// CHECK:STDOUT: %.loc96_9.2: %ptr.403 = converted %addr.loc96, %.loc96_9.1 +// CHECK:STDOUT: %operator_PlusEqual__carbon_thunk.call: ref %ValueType = call imports.%operator_PlusEqual__carbon_thunk.decl(%sum.ref, %.loc96_9.2) +// CHECK:STDOUT: %Destroy.facet.loc95_42.1: %Destroy.type = facet_value constants.%ValueType, (constants.%custom_witness.656, constants.%DestroyImpl.impl_witness.4c3) [concrete = constants.%Destroy.facet.cac] +// CHECK:STDOUT: %.loc95_42.16: %Destroy.type = converted constants.%ValueType, %Destroy.facet.loc95_42.1 [concrete = constants.%Destroy.facet.cac] +// CHECK:STDOUT: %Destroy.facet.loc95_42.2: %Destroy.type = facet_value constants.%ValueType, (constants.%custom_witness.656, constants.%DestroyImpl.impl_witness.4c3) [concrete = constants.%Destroy.facet.cac] +// CHECK:STDOUT: %.loc95_42.17: %Destroy.type = converted constants.%ValueType, %Destroy.facet.loc95_42.2 [concrete = constants.%Destroy.facet.cac] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc62_42.1: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%.loc62_42.14) -// CHECK:STDOUT: %Destroy.facet.loc62_42.3: %Destroy.type = facet_value constants.%Optional.81f, (constants.%custom_witness.b80ef6.7, constants.%DestroyImpl.impl_witness.e67) [concrete = constants.%Destroy.facet.434] -// CHECK:STDOUT: %.loc62_42.18: %Destroy.type = converted constants.%Optional.81f, %Destroy.facet.loc62_42.3 [concrete = constants.%Destroy.facet.434] -// CHECK:STDOUT: %Destroy.facet.loc62_42.4: %Destroy.type = facet_value constants.%Optional.81f, (constants.%custom_witness.b80ef6.7, constants.%DestroyImpl.impl_witness.e67) [concrete = constants.%Destroy.facet.434] -// CHECK:STDOUT: %.loc62_42.19: %Destroy.type = converted constants.%Optional.81f, %Destroy.facet.loc62_42.4 [concrete = constants.%Destroy.facet.434] +// CHECK:STDOUT: %SelfDestruct.call.loc95_42.1: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%.loc95_42.14) +// CHECK:STDOUT: %Destroy.facet.loc95_42.3: %Destroy.type = facet_value constants.%Optional.81f, (constants.%custom_witness.b80ef6.7, constants.%DestroyImpl.impl_witness.e67) [concrete = constants.%Destroy.facet.434] +// CHECK:STDOUT: %.loc95_42.18: %Destroy.type = converted constants.%Optional.81f, %Destroy.facet.loc95_42.3 [concrete = constants.%Destroy.facet.434] +// CHECK:STDOUT: %Destroy.facet.loc95_42.4: %Destroy.type = facet_value constants.%Optional.81f, (constants.%custom_witness.b80ef6.7, constants.%DestroyImpl.impl_witness.e67) [concrete = constants.%Destroy.facet.434] +// CHECK:STDOUT: %.loc95_42.19: %Destroy.type = converted constants.%Optional.81f, %Destroy.facet.loc95_42.4 [concrete = constants.%Destroy.facet.434] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc62_42.2: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%.loc62_42.6) +// CHECK:STDOUT: %SelfDestruct.call.loc95_42.2: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%.loc95_42.6) // CHECK:STDOUT: br !for.next // CHECK:STDOUT: // CHECK:STDOUT: !for.done: -// CHECK:STDOUT: %Destroy.facet.loc62_42.5: %Destroy.type = facet_value constants.%Optional.81f, (constants.%custom_witness.b80ef6.7, constants.%DestroyImpl.impl_witness.e67) [concrete = constants.%Destroy.facet.434] -// CHECK:STDOUT: %.loc62_42.20: %Destroy.type = converted constants.%Optional.81f, %Destroy.facet.loc62_42.5 [concrete = constants.%Destroy.facet.434] -// CHECK:STDOUT: %Destroy.facet.loc62_42.6: %Destroy.type = facet_value constants.%Optional.81f, (constants.%custom_witness.b80ef6.7, constants.%DestroyImpl.impl_witness.e67) [concrete = constants.%Destroy.facet.434] -// CHECK:STDOUT: %.loc62_42.21: %Destroy.type = converted constants.%Optional.81f, %Destroy.facet.loc62_42.6 [concrete = constants.%Destroy.facet.434] +// CHECK:STDOUT: %Destroy.facet.loc95_42.5: %Destroy.type = facet_value constants.%Optional.81f, (constants.%custom_witness.b80ef6.7, constants.%DestroyImpl.impl_witness.e67) [concrete = constants.%Destroy.facet.434] +// CHECK:STDOUT: %.loc95_42.20: %Destroy.type = converted constants.%Optional.81f, %Destroy.facet.loc95_42.5 [concrete = constants.%Destroy.facet.434] +// CHECK:STDOUT: %Destroy.facet.loc95_42.6: %Destroy.type = facet_value constants.%Optional.81f, (constants.%custom_witness.b80ef6.7, constants.%DestroyImpl.impl_witness.e67) [concrete = constants.%Destroy.facet.434] +// CHECK:STDOUT: %.loc95_42.21: %Destroy.type = converted constants.%Optional.81f, %Destroy.facet.loc95_42.6 [concrete = constants.%Destroy.facet.434] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc62_42.3: init %empty_tuple.type = call %SelfDestruct.specific_fn.3(%.loc62_42.6) -// CHECK:STDOUT: %Destroy.facet.loc62_42.7: %Destroy.type = facet_value constants.%tuple.type.de6, (constants.%custom_witness.b80ef6.8, constants.%DestroyImpl.impl_witness.2c4) [concrete = constants.%Destroy.facet.a88] -// CHECK:STDOUT: %.loc62_42.22: %Destroy.type = converted constants.%tuple.type.de6, %Destroy.facet.loc62_42.7 [concrete = constants.%Destroy.facet.a88] -// CHECK:STDOUT: %Destroy.facet.loc62_42.8: %Destroy.type = facet_value constants.%tuple.type.de6, (constants.%custom_witness.b80ef6.8, constants.%DestroyImpl.impl_witness.2c4) [concrete = constants.%Destroy.facet.a88] -// CHECK:STDOUT: %.loc62_42.23: %Destroy.type = converted constants.%tuple.type.de6, %Destroy.facet.loc62_42.8 [concrete = constants.%Destroy.facet.a88] +// CHECK:STDOUT: %SelfDestruct.call.loc95_42.3: init %empty_tuple.type = call %SelfDestruct.specific_fn.3(%.loc95_42.6) +// CHECK:STDOUT: %Destroy.facet.loc95_42.7: %Destroy.type = facet_value constants.%tuple.type.de6, (constants.%custom_witness.b80ef6.8, constants.%DestroyImpl.impl_witness.2c4) [concrete = constants.%Destroy.facet.a88] +// CHECK:STDOUT: %.loc95_42.22: %Destroy.type = converted constants.%tuple.type.de6, %Destroy.facet.loc95_42.7 [concrete = constants.%Destroy.facet.a88] +// CHECK:STDOUT: %Destroy.facet.loc95_42.8: %Destroy.type = facet_value constants.%tuple.type.de6, (constants.%custom_witness.b80ef6.8, constants.%DestroyImpl.impl_witness.2c4) [concrete = constants.%Destroy.facet.a88] +// CHECK:STDOUT: %.loc95_42.23: %Destroy.type = converted constants.%tuple.type.de6, %Destroy.facet.loc95_42.8 [concrete = constants.%Destroy.facet.a88] // CHECK:STDOUT: -// CHECK:STDOUT: %SelfDestruct.call.loc62_42.4: init %empty_tuple.type = call %SelfDestruct.specific_fn.4(%var) +// CHECK:STDOUT: %SelfDestruct.call.loc95_42.4: init %empty_tuple.type = call %SelfDestruct.specific_fn.4(%var) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @TestIterate(constants.%R) { -// CHECK:STDOUT: %R.patt.loc44_17.2 => constants.%R.patt -// CHECK:STDOUT: %R.loc44_17.1 => constants.%R -// CHECK:STDOUT: %R.as_type.loc44_83.1 => constants.%R.as_type +// CHECK:STDOUT: %R.patt.loc77_17.2 => constants.%R.patt +// CHECK:STDOUT: %R.loc77_17.1 => constants.%R +// CHECK:STDOUT: %R.as_type.loc77_83.1 => constants.%R.as_type // CHECK:STDOUT: %pattern_type => constants.%pattern_type.2ae -// CHECK:STDOUT: %r.param_patt.loc44_81.2 => constants.%r.param_patt.91c -// CHECK:STDOUT: %r.patt.loc44_81.2 => constants.%r.patt.03a +// CHECK:STDOUT: %r.param_patt.loc77_81.2 => constants.%r.param_patt.91c +// CHECK:STDOUT: %r.patt.loc77_81.2 => constants.%r.patt.03a // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @TestIterate(constants.%facet_value.62f) { -// CHECK:STDOUT: %R.patt.loc44_17.2 => constants.%R.patt -// CHECK:STDOUT: %R.loc44_17.1 => constants.%facet_value.62f -// CHECK:STDOUT: %R.as_type.loc44_83.1 => constants.%MutableAndConstRange +// CHECK:STDOUT: %R.patt.loc77_17.2 => constants.%R.patt +// CHECK:STDOUT: %R.loc77_17.1 => constants.%facet_value.62f +// CHECK:STDOUT: %R.as_type.loc77_83.1 => constants.%MutableAndConstRange // CHECK:STDOUT: %pattern_type => constants.%pattern_type.fdb -// CHECK:STDOUT: %r.param_patt.loc44_81.2 => constants.%r.param_patt.3a6 -// CHECK:STDOUT: %r.patt.loc44_81.2 => constants.%r.patt.403 +// CHECK:STDOUT: %r.param_patt.loc77_81.2 => constants.%r.param_patt.3a6 +// CHECK:STDOUT: %r.patt.loc77_81.2 => constants.%r.patt.403 // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete.loc44 => constants.%complete_type.357 +// CHECK:STDOUT: %require_complete.loc77 => constants.%complete_type.357 // CHECK:STDOUT: %Iterate.lookup_impl_witness => constants.%Iterate.impl_witness.3b4 -// CHECK:STDOUT: %Iterate.facet.loc48_41.5 => constants.%Iterate.facet.748 +// CHECK:STDOUT: %Iterate.facet.loc81_41.5 => constants.%Iterate.facet.748 // CHECK:STDOUT: %Iterate.WithSelf.NewCursor.type => constants.%Iterate.WithSelf.NewCursor.type.24a -// CHECK:STDOUT: %.loc48_41.26 => constants.%.227 -// CHECK:STDOUT: %impl.elem2.loc48_41.2 => constants.%T.as_type.as.Iterate.impl.NewCursor.8e0 -// CHECK:STDOUT: %specific_impl_fn.loc48_41.3 => constants.%T.as_type.as.Iterate.impl.NewCursor.specific_fn +// CHECK:STDOUT: %.loc81_41.26 => constants.%.227 +// CHECK:STDOUT: %impl.elem2.loc81_41.2 => constants.%T.as_type.as.Iterate.impl.NewCursor.8e0 +// CHECK:STDOUT: %specific_impl_fn.loc81_41.3 => constants.%T.as_type.as.Iterate.impl.NewCursor.specific_fn // CHECK:STDOUT: %impl.elem1 => constants.%Destroy.facet.a88 // CHECK:STDOUT: %as_type => constants.%tuple.type.de6 // CHECK:STDOUT: %require_complete.1 => constants.%complete_type.95d // CHECK:STDOUT: %Iterate.WithSelf.Next.type => constants.%Iterate.WithSelf.Next.type.f69 -// CHECK:STDOUT: %.loc48_41.27 => constants.%.343 -// CHECK:STDOUT: %impl.elem3.loc48_41.2 => constants.%T.as_type.as.Iterate.impl.Next.353 -// CHECK:STDOUT: %specific_impl_fn.loc48_41.4 => constants.%T.as_type.as.Iterate.impl.Next.specific_fn +// CHECK:STDOUT: %.loc81_41.27 => constants.%.343 +// CHECK:STDOUT: %impl.elem3.loc81_41.2 => constants.%T.as_type.as.Iterate.impl.Next.353 +// CHECK:STDOUT: %specific_impl_fn.loc81_41.4 => constants.%T.as_type.as.Iterate.impl.Next.specific_fn // CHECK:STDOUT: %SelfDestruct.specific_fn.6 => constants.%SelfDestruct.specific_fn.28f // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interop/cpp/template/argument_count.carbon b/toolchain/check/testdata/interop/cpp/template/argument_count.carbon index 8764af56583d..6fa7290e9ec5 100644 --- a/toolchain/check/testdata/interop/cpp/template/argument_count.carbon +++ b/toolchain/check/testdata/interop/cpp/template/argument_count.carbon @@ -45,8 +45,19 @@ library "[[@TEST_NAME]]"; import Cpp library "templates.h"; -// CHECK:STDERR: fail_too_few_arguments.carbon:[[@LINE+3]]:26: error: too few template arguments for class template 'TwoTypes' [CppInteropParseError] -// CHECK:STDERR: ./templates.h:5:41: note: template is declared here [CppInteropParseNote] +// CHECK:STDERR: ╭─┤ fail_too_few_arguments.carbon:[[@LINE+14]]:26 +// CHECK:STDERR: -> │ var x: Cpp.TwoTypes(Cpp.A); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: too few template arguments for class +// CHECK:STDERR: · ┃ template 'TwoTypes' +// CHECK:STDERR: · ┃ [CppInteropParseError] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ ./templates.h +// CHECK:STDERR: │ template struct TwoTypes {}; +// CHECK:STDERR: · ──────────────────────────────── ┬ +// CHECK:STDERR: · ╰──┤ template is declared here +// CHECK:STDERR: · │ [CppInteropParseNote] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: Cpp.TwoTypes(Cpp.A); @@ -56,8 +67,19 @@ library "[[@TEST_NAME]]"; import Cpp library "templates.h"; -// CHECK:STDERR: fail_too_many_arguments.carbon:[[@LINE+3]]:38-40: error: too many template arguments for class template 'TwoTypes' [CppInteropParseError] -// CHECK:STDERR: ./templates.h:5:41: note: template is declared here [CppInteropParseNote] +// CHECK:STDERR: ╭─┤ fail_too_many_arguments.carbon:[[@LINE+14]]:38 +// CHECK:STDERR: -> │ var x: Cpp.TwoTypes(Cpp.A, Cpp.A, Cpp.A); +// CHECK:STDERR: · ┳━━ +// CHECK:STDERR: · ┗━━┫ error: too many template arguments for +// CHECK:STDERR: · ┃ class template 'TwoTypes' +// CHECK:STDERR: · ┃ [CppInteropParseError] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ ./templates.h +// CHECK:STDERR: │ template struct TwoTypes {}; +// CHECK:STDERR: · ──────────────────────────────── ┬ +// CHECK:STDERR: · ╰──┤ template is declared here +// CHECK:STDERR: · │ [CppInteropParseNote] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: Cpp.TwoTypes(Cpp.A, Cpp.A, Cpp.A); @@ -88,13 +110,39 @@ library "[[@TEST_NAME]]"; import Cpp library "templates.h"; -// CHECK:STDERR: fail_fixed_size_pack_wrong_size.carbon:[[@LINE+3]]:57: error: too few template arguments for class template 'Inner' [CppInteropParseError] -// CHECK:STDERR: ./templates.h:15:33: note: template is declared here [CppInteropParseNote] +// CHECK:STDERR: ╭─┤ fail_fixed_size_pack_wrong_size.carbon:[[@LINE+18]]:57 +// CHECK:STDERR: -> │ var too_few: Cpp.FixedSizePack(Cpp.A, Cpp.A).Inner(Cpp.B); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: too few +// CHECK:STDERR: · ┃ template +// CHECK:STDERR: · ┃ arguments +// CHECK:STDERR: · ┃ for class +// CHECK:STDERR: · ┃ template +// CHECK:STDERR: · ┃ 'Inner' +// CHECK:STDERR: · ┃ [CppInteropParseError] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ ./templates.h +// CHECK:STDERR: │ template ...U> struct Inner {}; +// CHECK:STDERR: · ────────────────────── ┬ +// CHECK:STDERR: · ╰──┤ template is declared here +// CHECK:STDERR: · │ [CppInteropParseNote] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var too_few: Cpp.FixedSizePack(Cpp.A, Cpp.A).Inner(Cpp.B); -// CHECK:STDERR: fail_fixed_size_pack_wrong_size.carbon:[[@LINE+3]]:70-72: error: too many template arguments for class template 'Inner' [CppInteropParseError] -// CHECK:STDERR: ./templates.h:15:33: note: template is declared here [CppInteropParseNote] +// CHECK:STDERR: ╭─┤ fail_fixed_size_pack_wrong_size.carbon:[[@LINE+14]]:70 +// CHECK:STDERR: -> │ var too_many: Cpp.FixedSizePack(Cpp.A, Cpp.A).Inner(Cpp.B, Cpp.B, Cpp.B); +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: too many template arguments for class template 'Inner' +// CHECK:STDERR: · ┃ [CppInteropParseError] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ ./templates.h +// CHECK:STDERR: │ template ...U> struct Inner {}; +// CHECK:STDERR: · ────────────────────── ┬ +// CHECK:STDERR: · ╰──┤ template is declared here +// CHECK:STDERR: · │ [CppInteropParseNote] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var too_many: Cpp.FixedSizePack(Cpp.A, Cpp.A).Inner(Cpp.B, Cpp.B, Cpp.B); diff --git a/toolchain/check/testdata/interop/cpp/template/fail_todo_bidirectional_intorp_too_deep.carbon b/toolchain/check/testdata/interop/cpp/template/fail_todo_bidirectional_intorp_too_deep.carbon index 285b15a69925..5852243d5bc9 100644 --- a/toolchain/check/testdata/interop/cpp/template/fail_todo_bidirectional_intorp_too_deep.carbon +++ b/toolchain/check/testdata/interop/cpp/template/fail_todo_bidirectional_intorp_too_deep.carbon @@ -23,7 +23,13 @@ fn CarbonSide[template T: type](p: T) -> T; inline Cpp '''c++ template -// CHECK:STDERR: fail_todo_bidirectional_intorp_too_deep.carbon:[[@LINE+2]]:6: error: semantics TODO: `maximum depth for bidirectional Carbon/C++ interop is 10` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_todo_bidirectional_intorp_too_deep.carbon:[[@LINE+8]]:6 +// CHECK:STDERR: -> │ auto AddTypeWrapper(T x) -> T { +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: +// CHECK:STDERR: · ┃ `maximum depth for bidirectional Carbon/C++ interop is 10` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: auto AddTypeWrapper(T x) -> T { // Calls into to Carbon, adding a layer of Wrap(...) to the type T that diff --git a/toolchain/check/testdata/interop/cpp/template/non_type_param.carbon b/toolchain/check/testdata/interop/cpp/template/non_type_param.carbon index 2baa309b3ede..b379e82b6540 100644 --- a/toolchain/check/testdata/interop/cpp/template/non_type_param.carbon +++ b/toolchain/check/testdata/interop/cpp/template/non_type_param.carbon @@ -41,8 +41,16 @@ library "[[@TEST_NAME]]"; import Cpp library "templates.h"; -// CHECK:STDERR: fail_int_param_mismatch.carbon:[[@LINE+3]]:1-22: error: cannot implicitly convert expression of type `Cpp.Simple` to `Cpp.Simple` [ConversionFailure] -// CHECK:STDERR: fail_int_param_mismatch.carbon:[[@LINE+2]]:1-22: note: type `Cpp.Simple` does not implement interface `Core.ImplicitAs(Cpp.Simple)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_int_param_mismatch.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: -> │ var s: Cpp.Simple(456) = Cpp.MakeSimple123(); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `Cpp.Simple` to +// CHECK:STDERR: · │ ┃ `Cpp.Simple` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╰────┤ type `Cpp.Simple` does not implement interface +// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.Simple)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var s: Cpp.Simple(456) = Cpp.MakeSimple123(); @@ -135,8 +143,16 @@ library "[[@TEST_NAME]]"; import Cpp library "templates.h"; -// CHECK:STDERR: fail_type_argument.carbon:[[@LINE+3]]:26-30: error: cannot implicitly convert expression of type `type` to `i32` [ConversionFailure] -// CHECK:STDERR: fail_type_argument.carbon:[[@LINE+2]]:26-30: note: type `type` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_type_argument.carbon:[[@LINE+11]]:26 +// CHECK:STDERR: -> │ var x: Cpp.TwoNonType(1, Cpp.A) = {}; +// CHECK:STDERR: · ┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of +// CHECK:STDERR: · │ ┃ type `type` to `i32` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╰────┤ type `type` does not implement interface +// CHECK:STDERR: · │ `Core.ImplicitAs(i32)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: Cpp.TwoNonType(1, Cpp.A) = {}; @@ -148,8 +164,16 @@ import Cpp library "templates.h"; var n: i32; -// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+3]]:26-27: error: cannot implicitly convert expression of type `i32*` to `i32` [ConversionFailure] -// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+2]]:26-27: note: type `i32*` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_no_conversion.carbon:[[@LINE+11]]:26 +// CHECK:STDERR: -> │ var x: Cpp.TwoNonType(1, &n) = {}; +// CHECK:STDERR: · ┳━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of +// CHECK:STDERR: · │ ┃ type `i32*` to `i32` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╰────┤ type `i32*` does not implement interface +// CHECK:STDERR: · │ `Core.ImplicitAs(i32)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: Cpp.TwoNonType(1, &n) = {}; diff --git a/toolchain/check/testdata/interop/cpp/template/template_template_param.carbon b/toolchain/check/testdata/interop/cpp/template/template_template_param.carbon index 43b2f60ff793..ea73be4f32d1 100644 --- a/toolchain/check/testdata/interop/cpp/template/template_template_param.carbon +++ b/toolchain/check/testdata/interop/cpp/template/template_template_param.carbon @@ -36,10 +36,33 @@ library "[[@TEST_NAME]]"; import Cpp library "templates.h"; //@dump-sem-ir-begin -// CHECK:STDERR: fail_template_mismatch.carbon:[[@LINE+5]]:35: error: too few template arguments for class template 'C' [CppInteropParseError] -// CHECK:STDERR: fail_template_mismatch.carbon:[[@LINE+4]]:35: note: template template argument has different template parameters than its corresponding template template parameter [CppInteropParseNote] -// CHECK:STDERR: ./templates.h:6:66: note: previous template template parameter is here [CppInteropParseNote] -// CHECK:STDERR: ./templates.h:4:37: note: template is declared here [CppInteropParseNote] +// CHECK:STDERR: ╭─┤ fail_template_mismatch.carbon:[[@LINE+28]]:35 +// CHECK:STDERR: -> │ var x: Cpp.TwoTemplates(Cpp.A, Cpp.C); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: too few template arguments for +// CHECK:STDERR: · │ ┃ class template 'C' +// CHECK:STDERR: · │ ┃ [CppInteropParseError] +// CHECK:STDERR: · ╰────┤ template template argument has +// CHECK:STDERR: · │ different template parameters than its +// CHECK:STDERR: · │ corresponding template template +// CHECK:STDERR: · │ parameter +// CHECK:STDERR: · │ [CppInteropParseNote] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ ./templates.h +// CHECK:STDERR: │ template struct C {}; +// CHECK:STDERR: · ──────────────────────────── ┬ +// CHECK:STDERR: · ╰──┤ template is declared here +// CHECK:STDERR: · │ [CppInteropParseNote] +// CHECK:STDERR: │ +// CHECK:STDERR: │ template typename, template typename> +// CHECK:STDERR: · ────────────────── ┬ +// CHECK:STDERR: · ╰──┤ previous +// CHECK:STDERR: · │ template +// CHECK:STDERR: · │ template +// CHECK:STDERR: · │ parameter +// CHECK:STDERR: · │ is here +// CHECK:STDERR: · │ [CppInteropParseNote] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: Cpp.TwoTemplates(Cpp.A, Cpp.C); //@dump-sem-ir-end @@ -52,7 +75,14 @@ import Cpp library "templates.h"; class X {} -// CHECK:STDERR: fail_type_argument.carbon:[[@LINE+2]]:32: error: template argument for template template parameter must be a class template or type alias template [CppInteropParseError] +// CHECK:STDERR: ╭─┤ fail_type_argument.carbon:[[@LINE+9]]:32 +// CHECK:STDERR: -> │ var x: Cpp.TwoTemplates(Cpp.A, X); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: template argument for template +// CHECK:STDERR: · ┃ template parameter must be a class +// CHECK:STDERR: · ┃ template or type alias template +// CHECK:STDERR: · ┃ [CppInteropParseError] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: Cpp.TwoTemplates(Cpp.A, X); @@ -62,7 +92,14 @@ library "[[@TEST_NAME]]"; import Cpp library "templates.h"; -// CHECK:STDERR: fail_non_type_argument.carbon:[[@LINE+2]]:32: error: template argument for template template parameter must be a class template or type alias template [CppInteropParseError] +// CHECK:STDERR: ╭─┤ fail_non_type_argument.carbon:[[@LINE+9]]:32 +// CHECK:STDERR: -> │ var x: Cpp.TwoTemplates(Cpp.A, true); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: template argument for template +// CHECK:STDERR: · ┃ template parameter must be a class +// CHECK:STDERR: · ┃ template or type alias template +// CHECK:STDERR: · ┃ [CppInteropParseError] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: Cpp.TwoTemplates(Cpp.A, true); diff --git a/toolchain/check/testdata/interop/cpp/template/type_param.carbon b/toolchain/check/testdata/interop/cpp/template/type_param.carbon index c4ceddde8e95..3bf997bb9673 100644 --- a/toolchain/check/testdata/interop/cpp/template/type_param.carbon +++ b/toolchain/check/testdata/interop/cpp/template/type_param.carbon @@ -43,8 +43,16 @@ library "[[@TEST_NAME]]"; import Cpp library "templates.h"; -// CHECK:STDERR: fail_non_type_argument.carbon:[[@LINE+3]]:28-31: error: cannot implicitly convert non-type value of type `bool` to `type` [ConversionFailureNonTypeToFacet] -// CHECK:STDERR: fail_non_type_argument.carbon:[[@LINE+2]]:28-31: note: type `bool` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_non_type_argument.carbon:[[@LINE+11]]:28 +// CHECK:STDERR: -> │ var x: Cpp.TwoTypes(Cpp.A, true); +// CHECK:STDERR: · ┳━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert non-type value +// CHECK:STDERR: · │ ┃ of type `bool` to `type` +// CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet] +// CHECK:STDERR: · ╰────┤ type `bool` does not implement interface +// CHECK:STDERR: · │ `Core.ImplicitAs(type)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: Cpp.TwoTypes(Cpp.A, true); @@ -54,7 +62,13 @@ library "[[@TEST_NAME]]"; import Cpp library "templates.h"; -// CHECK:STDERR: fail_unsupported_type.carbon:[[@LINE+2]]:28-29: error: semantics TODO: `unsupported type used as template argument` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_unsupported_type.carbon:[[@LINE+8]]:28 +// CHECK:STDERR: -> │ var x: Cpp.TwoTypes(Cpp.A, {}); +// CHECK:STDERR: · ━┳ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: semantics TODO: `unsupported type used as template argument` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: Cpp.TwoTypes(Cpp.A, {}); diff --git a/toolchain/check/testdata/interop/cpp/var/export/var.carbon b/toolchain/check/testdata/interop/cpp/var/export/var.carbon index 48d1c11b05d3..cb395fda3fef 100644 --- a/toolchain/check/testdata/interop/cpp/var/export/var.carbon +++ b/toolchain/check/testdata/interop/cpp/var/export/var.carbon @@ -28,13 +28,23 @@ library "[[@TEST_NAME]]"; import Cpp; -// CHECK:STDERR: fail_var_unsupported_type.carbon:[[@LINE+2]]:5-21: error: semantics TODO: `failed to map Carbon type to C++` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_var_unsupported_type.carbon:[[@LINE+7]]:5 +// CHECK:STDERR: -> │ var unsupported_x: () = (); +// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `failed to map Carbon type to C++` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var unsupported_x: () = (); inline Cpp ''' void F() { - // CHECK:STDERR: fail_var_unsupported_type.carbon:[[@LINE+2]]:11-23: error: no member named 'unsupported_x' in namespace 'Carbon' [CppInteropParseError] + // CHECK:STDERR: ╭─┤ fail_var_unsupported_type.carbon:[[@LINE+7]]:11 + // CHECK:STDERR: -> │ Carbon::unsupported_x; + // CHECK:STDERR: · ━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no member named 'unsupported_x' in namespace 'Carbon' + // CHECK:STDERR: · ┃ [CppInteropParseError] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Carbon::unsupported_x; } diff --git a/toolchain/check/testdata/interop/cpp/var/import/global.carbon b/toolchain/check/testdata/interop/cpp/var/import/global.carbon index 48ca8f086828..c7907d27ad6c 100644 --- a/toolchain/check/testdata/interop/cpp/var/import/global.carbon +++ b/toolchain/check/testdata/interop/cpp/var/import/global.carbon @@ -41,6 +41,21 @@ fn MyF() { // --- unsupported_type.h +// CHECK:STDERR: ╷ ╭── included from: fail_import_unsupported_type.carbon [InCppInclude] +// CHECK:STDERR: ├─┤ ./unsupported_type.h:[[@LINE+14]]:7 +// CHECK:STDERR: -> │ using UnusupportedType = _BitInt(23); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: +// CHECK:STDERR: · ┃ `Unsupported: Type declaration: UnusupportedType` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ fail_import_unsupported_type.carbon +// CHECK:STDERR: │ let unused local: Cpp.UnusupportedType = Cpp.unsupported_global; +// CHECK:STDERR: · ──────────┬───────── +// CHECK:STDERR: · ╰──┤ in `Cpp` name lookup for `UnusupportedType` +// CHECK:STDERR: · │ [InCppNameLookup] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: using UnusupportedType = _BitInt(23); UnusupportedType unsupported_global; @@ -48,15 +63,19 @@ UnusupportedType unsupported_global; library "[[@TEST_NAME]]"; -// CHECK:STDERR: included from: fail_import_unsupported_type.carbon:[[@LINE+2]]:10 [InCppInclude] -// CHECK:STDERR: ./unsupported_type.h:2:7: error: semantics TODO: `Unsupported: Type declaration: UnusupportedType` [SemanticsTodo] import Cpp library "unsupported_type.h"; fn MyF() { - // CHECK:STDERR: fail_import_unsupported_type.carbon:[[@LINE+5]]:21-40: note: in `Cpp` name lookup for `UnusupportedType` [InCppNameLookup] - // CHECK:STDERR: - // CHECK:STDERR: fail_import_unsupported_type.carbon:[[@LINE+3]]:44-65: error: semantics TODO: `Unsupported: var type: UnusupportedType` [SemanticsTodo] - // CHECK:STDERR: fail_import_unsupported_type.carbon:[[@LINE+2]]:44-65: note: in `Cpp` name lookup for `unsupported_global` [InCppNameLookup] + // CHECK:STDERR: ╭─┤ fail_import_unsupported_type.carbon:[[@LINE+11]]:44 + // CHECK:STDERR: -> │ let unused local: Cpp.UnusupportedType = Cpp.unsupported_global; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: semantics TODO: `Unsupported: var type: UnusupportedType` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: · ╰──┤ in `Cpp` name lookup for + // CHECK:STDERR: · │ `unsupported_global` + // CHECK:STDERR: · │ [InCppNameLookup] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused local: Cpp.UnusupportedType = Cpp.unsupported_global; } @@ -212,10 +231,10 @@ fn MyF() { // CHECK:STDOUT: // CHECK:STDOUT: fn @MyF() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Cpp.ref.loc14_44: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %Cpp.ref.loc18_44: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %unsupported_global.ref: = name_ref unsupported_global, [concrete = ] // CHECK:STDOUT: %.1: = splice_block [concrete = ] { -// CHECK:STDOUT: %Cpp.ref.loc14_21: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %Cpp.ref.loc18_21: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %UnusupportedType.ref: = name_ref UnusupportedType, [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: %local: = wrapper_binding local, [concrete = ] diff --git a/toolchain/check/testdata/lambda/lambda.carbon b/toolchain/check/testdata/lambda/lambda.carbon index ca9e183879c4..5dd3befbda1f 100644 --- a/toolchain/check/testdata/lambda/lambda.carbon +++ b/toolchain/check/testdata/lambda/lambda.carbon @@ -184,8 +184,20 @@ fn PassToTemplate[template F: type](f: F) { f(42); } alias id_fn = fn (x: i32) -> i32 { return x; }; fn TestAsTemplateArgument() { - // CHECK:STDERR: fail_todo_as_non_constant_template_argument.carbon:[[@LINE+3]]:3-16: error: unable to monomorphize specific `PassToTemplate()` [ResolvingSpecificHere] - // CHECK:STDERR: fail_todo_as_non_constant_template_argument.carbon:[[@LINE-6]]:45-49: note: value of type `` is not callable [CallToNonCallable] + // CHECK:STDERR: ╭─┤ fail_todo_as_non_constant_template_argument.carbon:[[@LINE+15]]:3 + // CHECK:STDERR: │ fn PassToTemplate[template F: type](f: F) { f(42); } + // CHECK:STDERR: · ┬──── + // CHECK:STDERR: · ╰──┤ value of type + // CHECK:STDERR: · │ `` + // CHECK:STDERR: · │ is not callable + // CHECK:STDERR: · │ [CallToNonCallable] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ PassToTemplate(id_fn); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: unable to monomorphize specific + // CHECK:STDERR: · ┃ `PassToTemplate()` + // CHECK:STDERR: · ┃ [ResolvingSpecificHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: PassToTemplate(id_fn); } @@ -203,20 +215,41 @@ library "[[@TEST_NAME]]"; class C { fn M() { - // CHECK:STDERR: fail_self.carbon:[[@LINE+2]]:17-26: error: `self` parameter in function expression [SelfParameterInLambda] + // CHECK:STDERR: ╭─┤ fail_self.carbon:[[@LINE+7]]:17 + // CHECK:STDERR: -> │ (fn (unused self: Self) {}); + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: `self` parameter in function expression + // CHECK:STDERR: · ┃ [SelfParameterInLambda] + // CHECK:STDERR: ╰──── // CHECK:STDERR: (fn (unused self: Self) {}); - // CHECK:STDERR: fail_self.carbon:[[@LINE+2]]:17-26: error: `self` must be declared in the explicit parameter list [SelfInImplicitParamList] + // CHECK:STDERR: ╭─┤ fail_self.carbon:[[@LINE+8]]:17 + // CHECK:STDERR: -> │ (fn [unused self: Self]() {}); + // CHECK:STDERR: · ┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: `self` must be declared in the explicit parameter + // CHECK:STDERR: · ┃ list + // CHECK:STDERR: · ┃ [SelfInImplicitParamList] + // CHECK:STDERR: ╰──── // CHECK:STDERR: (fn [unused self: Self]() {}); } } fn F() { - // CHECK:STDERR: fail_self.carbon:[[@LINE+2]]:15-23: error: `self` parameter in function expression [SelfParameterInLambda] + // CHECK:STDERR: ╭─┤ fail_self.carbon:[[@LINE+7]]:15 + // CHECK:STDERR: -> │ (fn (unused self: i32) {}); + // CHECK:STDERR: · ━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: `self` parameter in function expression + // CHECK:STDERR: · ┃ [SelfParameterInLambda] + // CHECK:STDERR: ╰──── // CHECK:STDERR: (fn (unused self: i32) {}); - // CHECK:STDERR: fail_self.carbon:[[@LINE+2]]:30-38: error: `self` parameter in function expression [SelfParameterInLambda] + // CHECK:STDERR: ╭─┤ fail_self.carbon:[[@LINE+7]]:30 + // CHECK:STDERR: -> │ (fn (unused x: i32, unused self: i32) {}); + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: `self` parameter in function expression + // CHECK:STDERR: · ┃ [SelfParameterInLambda] + // CHECK:STDERR: ╰──── // CHECK:STDERR: (fn (unused x: i32, unused self: i32) {}); } @@ -225,21 +258,50 @@ fn F() { library "[[@TEST_NAME]]"; fn Outer() -> i32 { - // CHECK:STDERR: fail_return.carbon:[[@LINE+2]]:18: error: missing `return` at end of function with declared return type [MissingReturnStatement] + // CHECK:STDERR: ╭─┤ fail_return.carbon:[[@LINE+8]]:18 + // CHECK:STDERR: -> │ (fn () -> i32 {}); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: missing `return` at end of function with declared + // CHECK:STDERR: · ┃ return type + // CHECK:STDERR: · ┃ [MissingReturnStatement] + // CHECK:STDERR: ╰──── // CHECK:STDERR: (fn () -> i32 {}); - // CHECK:STDERR: fail_return.carbon:[[@LINE+3]]:20-28: error: cannot implicitly convert expression of type `Core.IntLiteral` to `bool` [ConversionFailure] - // CHECK:STDERR: fail_return.carbon:[[@LINE+2]]:20-28: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_return.carbon:[[@LINE+11]]:20 + // CHECK:STDERR: -> │ (fn () -> bool { return 1; }); + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type + // CHECK:STDERR: · │ ┃ `Core.IntLiteral` to `bool` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Core.IntLiteral` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(bool)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: (fn () -> bool { return 1; }); - // CHECK:STDERR: fail_return.carbon:[[@LINE+3]]:12-20: error: no return expression should be provided in this context [ReturnStatementDisallowExpr] - // CHECK:STDERR: fail_return.carbon:[[@LINE+2]]:4-10: note: there was no return type provided [ReturnTypeOmittedNote] + // CHECK:STDERR: ╭─┤ fail_return.carbon:[[@LINE+8]]:12 + // CHECK:STDERR: -> │ (fn () { return 1; }); + // CHECK:STDERR: · ───┬─── ━━┳━━━━━━ + // CHECK:STDERR: · │ ┗━━┫ error: no return expression should be provided in this context + // CHECK:STDERR: · │ ┃ [ReturnStatementDisallowExpr] + // CHECK:STDERR: · ╰───────────┤ there was no return type provided [ReturnTypeOmittedNote] + // CHECK:STDERR: ╰──── // CHECK:STDERR: (fn () { return 1; }); - // CHECK:STDERR: fail_return.carbon:[[@LINE+2]]:10-15: error: cannot specify a return type with `=>` [ReturnTypeInTerseFunction] + // CHECK:STDERR: ╭─┤ fail_return.carbon:[[@LINE+7]]:10 + // CHECK:STDERR: -> │ (fn () -> i32 => 0); + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: cannot specify a return type with `=>` + // CHECK:STDERR: · ┃ [ReturnTypeInTerseFunction] + // CHECK:STDERR: ╰──── // CHECK:STDERR: (fn () -> i32 => 0); - // CHECK:STDERR: fail_return.carbon:[[@LINE+2]]:20-36: error: cannot specify a return form with `=>` [ReturnTypeInTerseFunction] + // CHECK:STDERR: ╭─┤ fail_return.carbon:[[@LINE+7]]:20 + // CHECK:STDERR: -> │ (fn (ref x: i32) ->? form(ref i32) => x); + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot specify a return form with `=>` + // CHECK:STDERR: · ┃ [ReturnTypeInTerseFunction] + // CHECK:STDERR: ╰──── // CHECK:STDERR: (fn (ref x: i32) ->? form(ref i32) => x); @@ -250,21 +312,47 @@ fn Outer() -> i32 { library "[[@TEST_NAME]]"; fn F() { - // CHECK:STDERR: fail_unused.carbon:[[@LINE+3]]:8-13: warning: binding `x` unused [UnusedBinding] + // CHECK:STDERR: ╭─┤ fail_unused.carbon:[[@LINE+17]]:8 + // CHECK:STDERR: -> │ (fn (x: i32, unused y: i32) -> i32 { + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ warning: binding `x` unused [UnusedBinding] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: + // CHECK:STDERR: ╭─┤ fail_unused.carbon:[[@LINE+11]]:23 + // CHECK:STDERR: -> │ (fn (x: i32, unused y: i32) -> i32 { + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: variable `y` marked `unused` but used + // CHECK:STDERR: · ┃ [UnusedButUsed] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ return y; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ usage here [UnusedButUsedHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_unused.carbon:[[@LINE+1]]:23-28: error: variable `y` marked `unused` but used [UnusedButUsed] (fn (x: i32, unused y: i32) -> i32 { + // CHECK:STDERR: ╭─┤ fail_unused.carbon:[[@LINE+6]]:9 + // CHECK:STDERR: -> │ let z: i32 = 1; + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ warning: binding `z` unused [UnusedBinding] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: let z: i32 = 1; - // CHECK:STDERR: fail_unused.carbon:[[@LINE+4]]:12: note: usage here [UnusedButUsedHere] - // CHECK:STDERR: - // CHECK:STDERR: fail_unused.carbon:[[@LINE-3]]:9-14: warning: binding `z` unused [UnusedBinding] - // CHECK:STDERR: return y; }); - // CHECK:STDERR: fail_unused.carbon:[[@LINE+5]]:8-13: warning: binding `x` unused [UnusedBinding] + // CHECK:STDERR: ╭─┤ fail_unused.carbon:[[@LINE+15]]:8 + // CHECK:STDERR: -> │ (fn (x: i32, unused y: i32) => y); + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ warning: binding `x` unused [UnusedBinding] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_unused.carbon:[[@LINE+3]]:23-28: error: variable `y` marked `unused` but used [UnusedButUsed] - // CHECK:STDERR: fail_unused.carbon:[[@LINE+2]]:34: note: usage here [UnusedButUsedHere] + // CHECK:STDERR: ╭─┤ fail_unused.carbon:[[@LINE+9]]:23 + // CHECK:STDERR: -> │ (fn (x: i32, unused y: i32) => y); + // CHECK:STDERR: · ━━━┳━━ ┬ + // CHECK:STDERR: · ┗━━━━━━━━━━┫ error: variable `y` marked `unused` but + // CHECK:STDERR: · │ ┃ used + // CHECK:STDERR: · │ ┃ [UnusedButUsed] + // CHECK:STDERR: · ╰────┤ usage here [UnusedButUsedHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: (fn (x: i32, unused y: i32) => y); } @@ -275,12 +363,21 @@ library "[[@TEST_NAME]]"; fn F() { while (true) { (fn () { - // CHECK:STDERR: fail_break_continue.carbon:[[@LINE+2]]:7-11: error: `break` can only be used in a loop [BreakOutsideLoop] + // CHECK:STDERR: ╭─┤ fail_break_continue.carbon:[[@LINE+6]]:7 + // CHECK:STDERR: -> │ break; + // CHECK:STDERR: · ━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: `break` can only be used in a loop [BreakOutsideLoop] + // CHECK:STDERR: ╰──── // CHECK:STDERR: break; }); (fn () { - // CHECK:STDERR: fail_break_continue.carbon:[[@LINE+2]]:7-14: error: `continue` can only be used in a loop [ContinueOutsideLoop] + // CHECK:STDERR: ╭─┤ fail_break_continue.carbon:[[@LINE+7]]:7 + // CHECK:STDERR: -> │ continue; + // CHECK:STDERR: · ━━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: `continue` can only be used in a loop + // CHECK:STDERR: · ┃ [ContinueOutsideLoop] + // CHECK:STDERR: ╰──── // CHECK:STDERR: continue; }); @@ -292,8 +389,17 @@ fn F() { library "[[@TEST_NAME]]"; fn F() { - // CHECK:STDERR: fail_default_values.carbon:[[@LINE+3]]:34-39: error: this pattern is missing a required default value [RequiredPatternDefaultValueMissing] - // CHECK:STDERR: fail_default_values.carbon:[[@LINE+2]]:15-20: note: all patterns to the right of this first pattern with a default value must also specify a default value [RequiredPatternDefaultValueFirstDefault] + // CHECK:STDERR: ╭─┤ fail_default_values.carbon:[[@LINE+12]]:34 + // CHECK:STDERR: -> │ (fn (unused x: i32 = 1, unused y: i32) {}); + // CHECK:STDERR: · ───┬── ┳━━━━━ + // CHECK:STDERR: · │ ┗━━┫ error: this pattern is missing a required + // CHECK:STDERR: · │ ┃ default value + // CHECK:STDERR: · │ ┃ [RequiredPatternDefaultValueMissing] + // CHECK:STDERR: · ╰────────────────────┤ all patterns to the right of this first + // CHECK:STDERR: · │ pattern with a default value must also + // CHECK:STDERR: · │ specify a default value + // CHECK:STDERR: · │ [RequiredPatternDefaultValueFirstDefault] + // CHECK:STDERR: ╰──── // CHECK:STDERR: (fn (unused x: i32 = 1, unused y: i32) {}); } @@ -304,18 +410,50 @@ library "[[@TEST_NAME]]"; class Incomplete; fn F() { - // CHECK:STDERR: fail_incomplete_type.carbon:[[@LINE+3]]:15-27: error: parameter has incomplete type `Incomplete` in function definition [IncompleteTypeInFunctionParam] - // CHECK:STDERR: fail_incomplete_type.carbon:[[@LINE-4]]:1-17: note: class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ╭─┤ fail_incomplete_type.carbon:[[@LINE+12]]:15 + // CHECK:STDERR: │ class Incomplete; + // CHECK:STDERR: · ────────┬──────── + // CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ (fn (unused x: Incomplete) {}); + // CHECK:STDERR: · ┳━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: parameter has incomplete type `Incomplete` in function + // CHECK:STDERR: · ┃ definition + // CHECK:STDERR: · ┃ [IncompleteTypeInFunctionParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: (fn (unused x: Incomplete) {}); - // CHECK:STDERR: fail_incomplete_type.carbon:[[@LINE+5]]:10-22: error: function returns incomplete type `Incomplete` [IncompleteTypeInFunctionReturnType] - // CHECK:STDERR: fail_incomplete_type.carbon:[[@LINE-8]]:1-17: note: class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ╭─┤ fail_incomplete_type.carbon:[[@LINE+19]]:10 + // CHECK:STDERR: │ class Incomplete; + // CHECK:STDERR: · ────────┬──────── + // CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ (fn () -> Incomplete {}); + // CHECK:STDERR: · ━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: function returns incomplete type `Incomplete` + // CHECK:STDERR: · ┃ [IncompleteTypeInFunctionReturnType] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_incomplete_type.carbon:[[@LINE+2]]:25: error: missing `return` at end of function with declared return type [MissingReturnStatement] + // CHECK:STDERR: ╭─┤ fail_incomplete_type.carbon:[[@LINE+8]]:25 + // CHECK:STDERR: -> │ (fn () -> Incomplete {}); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: missing `return` at end of function with + // CHECK:STDERR: · ┃ declared return type + // CHECK:STDERR: · ┃ [MissingReturnStatement] + // CHECK:STDERR: ╰──── // CHECK:STDERR: (fn () -> Incomplete {}); - // CHECK:STDERR: fail_incomplete_type.carbon:[[@LINE+3]]:27-28: error: function returns incomplete type `Incomplete` [IncompleteTypeInFunctionReturnType] - // CHECK:STDERR: fail_incomplete_type.carbon:[[@LINE-14]]:1-17: note: class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ╭─┤ fail_incomplete_type.carbon:[[@LINE+12]]:27 + // CHECK:STDERR: │ class Incomplete; + // CHECK:STDERR: · ────────┬──────── + // CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ (fn (p: Incomplete*) => *p); + // CHECK:STDERR: · ┳━ + // CHECK:STDERR: · ┗━━┫ error: function returns incomplete type + // CHECK:STDERR: · ┃ `Incomplete` + // CHECK:STDERR: · ┃ [IncompleteTypeInFunctionReturnType] + // CHECK:STDERR: ╰──── // CHECK:STDERR: (fn (p: Incomplete*) => *p); } @@ -324,8 +462,16 @@ fn F() { library "[[@TEST_NAME]]"; fn F() { - // CHECK:STDERR: fail_conversion.carbon:[[@LINE+3]]:16-22: error: cannot implicitly convert expression of type `` to `i32` [ConversionFailure] - // CHECK:STDERR: fail_conversion.carbon:[[@LINE+2]]:16-22: note: type `` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_conversion.carbon:[[@LINE+11]]:16 + // CHECK:STDERR: -> │ let _: i32 = fn () {}; + // CHECK:STDERR: · ┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type + // CHECK:STDERR: · │ ┃ `` to `i32` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `` does not implement + // CHECK:STDERR: · │ interface `Core.ImplicitAs(i32)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: i32 = fn () {}; } @@ -334,13 +480,28 @@ fn F() { library "[[@TEST_NAME]]"; fn F() { - // CHECK:STDERR: fail_todo_positional_params.carbon:[[@LINE+2]]:4-7: error: semantics TODO: `function with positional parameters` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_positional_params.carbon:[[@LINE+7]]:4 + // CHECK:STDERR: -> │ (fn {}); + // CHECK:STDERR: · ━━┳━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `function with positional parameters` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: (fn {}); - // CHECK:STDERR: fail_todo_positional_params.carbon:[[@LINE+2]]:4-14: error: semantics TODO: `function with positional parameters` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_positional_params.carbon:[[@LINE+7]]:4 + // CHECK:STDERR: -> │ (fn -> i32 { return 0; }); + // CHECK:STDERR: · ━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `function with positional parameters` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: (fn -> i32 { return 0; }); - // CHECK:STDERR: fail_todo_positional_params.carbon:[[@LINE+2]]:4-8: error: semantics TODO: `function with positional parameters` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_positional_params.carbon:[[@LINE+7]]:4 + // CHECK:STDERR: -> │ (fn => 0); + // CHECK:STDERR: · ━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `function with positional parameters` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: (fn => 0); } diff --git a/toolchain/check/testdata/let/compile_time_bindings.carbon b/toolchain/check/testdata/let/compile_time_bindings.carbon index ebcfe7ccf235..5f41c8a39d1f 100644 --- a/toolchain/check/testdata/let/compile_time_bindings.carbon +++ b/toolchain/check/testdata/let/compile_time_bindings.carbon @@ -22,7 +22,14 @@ library "[[@TEST_NAME]]"; class C { fn F() -> () { return x; } - // CHECK:STDERR: fail_let_after.carbon:[[@LINE+2]]:15-19: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_let_after.carbon:[[@LINE+9]]:15 + // CHECK:STDERR: -> │ let generic x: () = (); + // CHECK:STDERR: · ━━┳━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: semantics TODO: + // CHECK:STDERR: · ┃ ``let` compile time binding outside function or interface` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let generic x: () = (); } @@ -32,7 +39,14 @@ class C { library "[[@TEST_NAME]]"; class C { - // CHECK:STDERR: fail_let_before.carbon:[[@LINE+2]]:15-19: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_let_before.carbon:[[@LINE+9]]:15 + // CHECK:STDERR: -> │ let generic x: () = (); + // CHECK:STDERR: · ━━┳━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: semantics TODO: + // CHECK:STDERR: · ┃ ``let` compile time binding outside function or interface` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let generic x: () = (); fn F() -> () { return x; } @@ -43,7 +57,14 @@ class C { library "[[@TEST_NAME]]"; class C { - // CHECK:STDERR: fail_multiple_lets.carbon:[[@LINE+2]]:15-19: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_multiple_lets.carbon:[[@LINE+9]]:15 + // CHECK:STDERR: -> │ let generic a: () = (); + // CHECK:STDERR: · ━━┳━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: semantics TODO: + // CHECK:STDERR: · ┃ ``let` compile time binding outside function or interface` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let generic a: () = (); fn F(generic b: ((),)) { @@ -54,9 +75,23 @@ class C { var unused c1: ((), ()) = c; var unused d1: ((), (), ()) = d; } - // CHECK:STDERR: fail_multiple_lets.carbon:[[@LINE+4]]:15-29: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_multiple_lets.carbon:[[@LINE+18]]:15 + // CHECK:STDERR: -> │ let generic d: ((), (), ()) = ((), (), ()); + // CHECK:STDERR: · ━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: semantics TODO: + // CHECK:STDERR: · ┃ ``let` compile time binding outside function or interface` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_multiple_lets.carbon:[[@LINE-9]]:17-27: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_multiple_lets.carbon:[[@LINE-16]]:17 + // CHECK:STDERR: -> │ let generic c: ((), ()) = ((), ()); + // CHECK:STDERR: · ━━━━━┳━━━━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: semantics TODO: + // CHECK:STDERR: · ┃ `local generic `let` bindings are currently unsupported` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let generic d: ((), (), ()) = ((), (), ()); } @@ -67,9 +102,22 @@ library "[[@TEST_NAME]]"; class C { fn F() -> () { return x; } - // CHECK:STDERR: fail_invalid_let_after.carbon:[[@LINE+4]]:15-19: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_invalid_let_after.carbon:[[@LINE+17]]:15 + // CHECK:STDERR: -> │ let generic x: (); + // CHECK:STDERR: · ━━┳━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: semantics TODO: + // CHECK:STDERR: · ┃ ``let` compile time binding outside function or interface` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_invalid_let_after.carbon:[[@LINE+2]]:20: error: expected `=`; `let` declaration must have an initializer [ExpectedInitializerAfterLet] + // CHECK:STDERR: ╭─┤ fail_invalid_let_after.carbon:[[@LINE+8]]:20 + // CHECK:STDERR: -> │ let generic x: (); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `=`; `let` declaration must have an + // CHECK:STDERR: · ┃ initializer + // CHECK:STDERR: · ┃ [ExpectedInitializerAfterLet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let generic x: (); } @@ -79,7 +127,14 @@ class C { library "[[@TEST_NAME]]"; fn F() -> i32 { - // CHECK:STDERR: fail_todo_use_in_function.carbon:[[@LINE+2]]:15-23: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_use_in_function.carbon:[[@LINE+9]]:15 + // CHECK:STDERR: -> │ let generic Zero: i32 = 0; + // CHECK:STDERR: · ━━━━┳━━━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: semantics TODO: + // CHECK:STDERR: · ┃ `local generic `let` bindings are currently unsupported` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let generic Zero: i32 = 0; return Zero; @@ -91,7 +146,14 @@ library "[[@TEST_NAME]]"; fn F() -> i32 { if (true) { - // CHECK:STDERR: fail_todo_use_in_block.carbon:[[@LINE+2]]:17-25: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_use_in_block.carbon:[[@LINE+9]]:17 + // CHECK:STDERR: -> │ let generic Zero: i32 = 0; + // CHECK:STDERR: · ━━━━┳━━━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: semantics TODO: + // CHECK:STDERR: · ┃ `local generic `let` bindings are currently unsupported` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let generic Zero: i32 = 0; return Zero; @@ -113,10 +175,22 @@ interface I { library "[[@TEST_NAME]]"; class I { - // CHECK:STDERR: fail_return_in_class.carbon:[[@LINE+2]]:15-21: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_return_in_class.carbon:[[@LINE+9]]:15 + // CHECK:STDERR: -> │ let generic T: type = i32; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: semantics TODO: + // CHECK:STDERR: · ┃ ``let` compile time binding outside function or interface` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let generic T: type = i32; - // CHECK:STDERR: fail_return_in_class.carbon:[[@LINE+2]]:13: error: cannot evaluate type expression [TypeExprEvaluationFailure] + // CHECK:STDERR: ╭─┤ fail_return_in_class.carbon:[[@LINE+7]]:13 + // CHECK:STDERR: -> │ fn F() -> T; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot evaluate type expression + // CHECK:STDERR: · ┃ [TypeExprEvaluationFailure] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn F() -> T; } @@ -125,10 +199,22 @@ class I { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_return_in_package_scope.carbon:[[@LINE+2]]:13-19: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_return_in_package_scope.carbon:[[@LINE+9]]:13 +// CHECK:STDERR: -> │ let generic T: type = i32; +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: semantics TODO: +// CHECK:STDERR: · ┃ ``let` compile time binding outside function or interface` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let generic T: type = i32; -// CHECK:STDERR: fail_return_in_package_scope.carbon:[[@LINE+2]]:11: error: cannot evaluate type expression [TypeExprEvaluationFailure] +// CHECK:STDERR: ╭─┤ fail_return_in_package_scope.carbon:[[@LINE+7]]:11 +// CHECK:STDERR: -> │ fn F() -> T; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: cannot evaluate type expression +// CHECK:STDERR: · ┃ [TypeExprEvaluationFailure] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F() -> T; @@ -139,7 +225,14 @@ library "[[@TEST_NAME]]"; interface Empty {} impl i32 as Empty { - // CHECK:STDERR: fail_use_in_impl.carbon:[[@LINE+2]]:15-23: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_use_in_impl.carbon:[[@LINE+9]]:15 + // CHECK:STDERR: -> │ let generic Zero: i32 = 0; + // CHECK:STDERR: · ━━━━┳━━━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: semantics TODO: + // CHECK:STDERR: · ┃ ``let` compile time binding outside function or interface` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let generic Zero: i32 = 0; } @@ -190,15 +283,15 @@ impl i32 as Empty { // CHECK:STDOUT: %return.param: ref %empty_tuple.type = out_param call_param0 // CHECK:STDOUT: %return: ref %empty_tuple.type = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8_24.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc15_24.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_24.2: %empty_tuple.type = converted %.loc8_24.1, %empty_tuple [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_19.1: type = splice_block %.loc8_19.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc15_24.2: %empty_tuple.type = converted %.loc15_24.1, %empty_tuple [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc15_19.1: type = splice_block %.loc15_19.3 [concrete = constants.%empty_tuple.type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc8_19.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_19.3: type = converted %.loc8_19.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc15_19.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc15_19.3: type = converted %.loc15_19.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %x: %empty_tuple.type = wrapper_binding x, %.loc8_24.2 +// CHECK:STDOUT: %x: %empty_tuple.type = wrapper_binding x, %.loc15_24.2 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %x.patt: %pattern_type = value_binding_pattern x [concrete = constants.%x.patt] // CHECK:STDOUT: } @@ -255,25 +348,25 @@ impl i32 as Empty { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %.loc7_24.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc14_24.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc7_24.2: %empty_tuple.type = converted %.loc7_24.1, %empty_tuple [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc7_19.1: type = splice_block %.loc7_19.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc14_24.2: %empty_tuple.type = converted %.loc14_24.1, %empty_tuple [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc14_19.1: type = splice_block %.loc14_19.3 [concrete = constants.%empty_tuple.type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc7_19.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc7_19.3: type = converted %.loc7_19.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc14_19.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc14_19.3: type = converted %.loc14_19.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %x: %empty_tuple.type = wrapper_binding x, %.loc7_24.2 +// CHECK:STDOUT: %x: %empty_tuple.type = wrapper_binding x, %.loc14_24.2 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %x.patt: %pattern_type = value_binding_pattern x [concrete = constants.%x.patt] // CHECK:STDOUT: } // CHECK:STDOUT: %C.F.decl: %C.F.type = fn_decl @C.F [concrete = constants.%C.F] { // CHECK:STDOUT: %return.param_patt: %pattern_type = out_param_pattern [concrete = constants.%return.param_patt] -// CHECK:STDOUT: %return.patt: %pattern_type = return_slot_pattern %return.param_patt, %.loc8_14.2 [concrete = constants.%return.patt] +// CHECK:STDOUT: %return.patt: %pattern_type = return_slot_pattern %return.param_patt, %.loc15_14.2 [concrete = constants.%return.patt] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc8_14.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_14.2: type = converted %.loc8_14.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %.loc8_14.3: Core.Form = init_form %.loc8_14.2 [concrete = constants.%.262] +// CHECK:STDOUT: %.loc15_14.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc15_14.2: type = converted %.loc15_14.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc15_14.3: Core.Form = init_form %.loc15_14.2 [concrete = constants.%.262] // CHECK:STDOUT: %return.param: ref %empty_tuple.type = out_param call_param0 // CHECK:STDOUT: %return: ref %empty_tuple.type = return_slot %return.param // CHECK:STDOUT: } @@ -289,9 +382,9 @@ impl i32 as Empty { // CHECK:STDOUT: fn @C.F() -> out %return.param: %empty_tuple.type { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %x.ref: %empty_tuple.type = name_ref x, @C.%x -// CHECK:STDOUT: %.loc8_25: init %empty_tuple.type = tuple_init () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_26: init %empty_tuple.type = converted %x.ref, %.loc8_25 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: return %.loc8_26 +// CHECK:STDOUT: %.loc15_25: init %empty_tuple.type = tuple_init () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc15_26: init %empty_tuple.type = converted %x.ref, %.loc15_25 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: return %.loc15_26 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_multiple_lets.carbon @@ -320,54 +413,54 @@ impl i32 as Empty { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %.loc7_24.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %empty_tuple.loc7: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc7_24.2: %empty_tuple.type = converted %.loc7_24.1, %empty_tuple.loc7 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc7_19.1: type = splice_block %.loc7_19.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.Self.frozen.loc7: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc7_19.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc7_19.3: type = converted %.loc7_19.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc14_24.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %empty_tuple.loc14: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc14_24.2: %empty_tuple.type = converted %.loc14_24.1, %empty_tuple.loc14 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc14_19.1: type = splice_block %.loc14_19.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.Self.frozen.loc14: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc14_19.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc14_19.3: type = converted %.loc14_19.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %a: %empty_tuple.type = wrapper_binding a, %.loc7_24.2 +// CHECK:STDOUT: %a: %empty_tuple.type = wrapper_binding a, %.loc14_24.2 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %a.patt: %pattern_type.cb1 = value_binding_pattern a [concrete = constants.%a.patt] // CHECK:STDOUT: } // CHECK:STDOUT: %C.F.decl: %C.F.type = fn_decl @C.F [concrete = constants.%C.F] { -// CHECK:STDOUT: %b.patt.loc8_17.1: %pattern_type.559 = symbolic_binding_pattern b, 0 [symbolic = %b.patt.loc8_17.2 (constants.%b.patt)] +// CHECK:STDOUT: %b.patt.loc15_17.1: %pattern_type.559 = symbolic_binding_pattern b, 0 [symbolic = %b.patt.loc15_17.2 (constants.%b.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc8_23.1: type = splice_block %.loc8_23.4 [concrete = constants.%tuple.type.9fb] { +// CHECK:STDOUT: %.loc15_23.1: type = splice_block %.loc15_23.4 [concrete = constants.%tuple.type.9fb] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc8_21: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_23.2: %tuple.type.9fb = tuple_literal (%.loc8_21) [concrete = constants.%tuple.f41] -// CHECK:STDOUT: %.loc8_23.3: type = converted constants.%empty_tuple, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %.loc8_23.4: type = converted %.loc8_23.2, constants.%tuple.type.9fb [concrete = constants.%tuple.type.9fb] +// CHECK:STDOUT: %.loc15_21: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc15_23.2: %tuple.type.9fb = tuple_literal (%.loc15_21) [concrete = constants.%tuple.f41] +// CHECK:STDOUT: %.loc15_23.3: type = converted constants.%empty_tuple, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc15_23.4: type = converted %.loc15_23.2, constants.%tuple.type.9fb [concrete = constants.%tuple.type.9fb] // CHECK:STDOUT: } -// CHECK:STDOUT: %b.loc8_17.2: %tuple.type.9fb = symbolic_binding b, 0 [symbolic = %b.loc8_17.1 (constants.%b)] +// CHECK:STDOUT: %b.loc15_17.2: %tuple.type.9fb = symbolic_binding b, 0 [symbolic = %b.loc15_17.1 (constants.%b)] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc20_35: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc20_39: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc20_43: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc20_44.1: %tuple.type.2d5 = tuple_literal (%.loc20_35, %.loc20_39, %.loc20_43) [concrete = constants.%tuple.7e4] -// CHECK:STDOUT: %empty_tuple.loc20_35: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc20_44.2: %empty_tuple.type = converted %.loc20_35, %empty_tuple.loc20_35 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %empty_tuple.loc20_39: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc20_44.3: %empty_tuple.type = converted %.loc20_39, %empty_tuple.loc20_39 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %empty_tuple.loc20_43: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc20_44.4: %empty_tuple.type = converted %.loc20_43, %empty_tuple.loc20_43 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %tuple: %tuple.type.2d5 = tuple_value (%.loc20_44.2, %.loc20_44.3, %.loc20_44.4) [concrete = constants.%tuple.7e4] -// CHECK:STDOUT: %.loc20_44.5: %tuple.type.2d5 = converted %.loc20_44.1, %tuple [concrete = constants.%tuple.7e4] -// CHECK:STDOUT: %.loc20_29.1: type = splice_block %.loc20_29.6 [concrete = constants.%tuple.type.2d5] { -// CHECK:STDOUT: %.Self.frozen.loc20: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc20_20: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc20_24: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc20_28: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc20_29.2: %tuple.type.2d5 = tuple_literal (%.loc20_20, %.loc20_24, %.loc20_28) [concrete = constants.%tuple.7e4] -// CHECK:STDOUT: %.loc20_29.3: type = converted constants.%empty_tuple, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %.loc20_29.4: type = converted constants.%empty_tuple, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %.loc20_29.5: type = converted constants.%empty_tuple, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %.loc20_29.6: type = converted %.loc20_29.2, constants.%tuple.type.2d5 [concrete = constants.%tuple.type.2d5] +// CHECK:STDOUT: %.loc41_35: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc41_39: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc41_43: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc41_44.1: %tuple.type.2d5 = tuple_literal (%.loc41_35, %.loc41_39, %.loc41_43) [concrete = constants.%tuple.7e4] +// CHECK:STDOUT: %empty_tuple.loc41_35: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc41_44.2: %empty_tuple.type = converted %.loc41_35, %empty_tuple.loc41_35 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %empty_tuple.loc41_39: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc41_44.3: %empty_tuple.type = converted %.loc41_39, %empty_tuple.loc41_39 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %empty_tuple.loc41_43: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc41_44.4: %empty_tuple.type = converted %.loc41_43, %empty_tuple.loc41_43 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %tuple: %tuple.type.2d5 = tuple_value (%.loc41_44.2, %.loc41_44.3, %.loc41_44.4) [concrete = constants.%tuple.7e4] +// CHECK:STDOUT: %.loc41_44.5: %tuple.type.2d5 = converted %.loc41_44.1, %tuple [concrete = constants.%tuple.7e4] +// CHECK:STDOUT: %.loc41_29.1: type = splice_block %.loc41_29.6 [concrete = constants.%tuple.type.2d5] { +// CHECK:STDOUT: %.Self.frozen.loc41: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc41_20: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc41_24: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc41_28: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc41_29.2: %tuple.type.2d5 = tuple_literal (%.loc41_20, %.loc41_24, %.loc41_28) [concrete = constants.%tuple.7e4] +// CHECK:STDOUT: %.loc41_29.3: type = converted constants.%empty_tuple, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc41_29.4: type = converted constants.%empty_tuple, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc41_29.5: type = converted constants.%empty_tuple, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc41_29.6: type = converted %.loc41_29.2, constants.%tuple.type.2d5 [concrete = constants.%tuple.type.2d5] // CHECK:STDOUT: } -// CHECK:STDOUT: %d: %tuple.type.2d5 = wrapper_binding d, %.loc20_44.5 +// CHECK:STDOUT: %d: %tuple.type.2d5 = wrapper_binding d, %.loc41_44.5 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %d.patt: %pattern_type.8c1 = value_binding_pattern d [concrete = constants.%d.patt] // CHECK:STDOUT: } @@ -381,16 +474,16 @@ impl i32 as Empty { // CHECK:STDOUT: .d = %d // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @C.F(%b.loc8_17.2: %tuple.type.9fb) { -// CHECK:STDOUT: %b.patt.loc8_17.2: %pattern_type.559 = symbolic_binding_pattern b, 0 [symbolic = %b.patt.loc8_17.2 (constants.%b.patt)] -// CHECK:STDOUT: %b.loc8_17.1: %tuple.type.9fb = symbolic_binding b, 0 [symbolic = %b.loc8_17.1 (constants.%b)] +// CHECK:STDOUT: generic fn @C.F(%b.loc15_17.2: %tuple.type.9fb) { +// CHECK:STDOUT: %b.patt.loc15_17.2: %pattern_type.559 = symbolic_binding_pattern b, 0 [symbolic = %b.patt.loc15_17.2 (constants.%b.patt)] +// CHECK:STDOUT: %b.loc15_17.1: %tuple.type.9fb = symbolic_binding b, 0 [symbolic = %b.loc15_17.1 (constants.%b)] // CHECK:STDOUT: // CHECK:STDOUT: fn(); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @C.F(constants.%b) { -// CHECK:STDOUT: %b.patt.loc8_17.2 => constants.%b.patt -// CHECK:STDOUT: %b.loc8_17.1 => constants.%b +// CHECK:STDOUT: %b.patt.loc15_17.2 => constants.%b.patt +// CHECK:STDOUT: %b.loc15_17.1 => constants.%b // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_invalid_let_after.carbon @@ -447,12 +540,12 @@ impl i32 as Empty { // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C // CHECK:STDOUT: .F = %C.F.decl -// CHECK:STDOUT: .x = .inst{{[0-9A-F]+}}.loc10_16 +// CHECK:STDOUT: .x = .inst{{[0-9A-F]+}}.loc23_16 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @C.F() -> out %return.param: %empty_tuple.type { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %x.ref: %empty_tuple.type = name_ref x, .inst{{[0-9A-F]+}}.loc10_16 +// CHECK:STDOUT: %x.ref: %empty_tuple.type = name_ref x, .inst{{[0-9A-F]+}}.loc23_16 // CHECK:STDOUT: %.loc5_25: init %empty_tuple.type = tuple_init () [concrete = constants.%empty_tuple] // CHECK:STDOUT: %.loc5_26: init %empty_tuple.type = converted %x.ref, %.loc5_25 [concrete = constants.%empty_tuple] // CHECK:STDOUT: return %.loc5_26 @@ -611,9 +704,9 @@ impl i32 as Empty { // CHECK:STDOUT: // CHECK:STDOUT: class @I { // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %.loc7_18.1: type = splice_block %.loc7_18.2 [concrete = type] { +// CHECK:STDOUT: %.loc14_18.1: type = splice_block %.loc14_18.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc7_18.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc14_18.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } // CHECK:STDOUT: %T: type = wrapper_binding T, %i32 // CHECK:STDOUT: name_binding_decl { @@ -667,9 +760,9 @@ impl i32 as Empty { // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %.loc6_16.1: type = splice_block %.loc6_16.2 [concrete = type] { +// CHECK:STDOUT: %.loc13_16.1: type = splice_block %.loc13_16.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc6_16.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc13_16.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } // CHECK:STDOUT: %T: type = wrapper_binding T, @__global_init.%i32 // CHECK:STDOUT: name_binding_decl { @@ -767,17 +860,17 @@ impl i32 as Empty { // CHECK:STDOUT: impl @i32.as.Empty.impl: %i32.loc6 as %Empty.ref { // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] // CHECK:STDOUT: %impl.elem0: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc9_27.1: = bound_method %int_0, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %bound_method.loc16_27.1: = bound_method %int_0, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] // CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc9_27.2: = bound_method %int_0, %specific_fn [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc9_27.2(%int_0) [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc9_27.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc9_27.2: %i32 = converted %int_0, %.loc9_27.1 [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc9_21: type = splice_block %i32.loc9 [concrete = constants.%i32] { +// CHECK:STDOUT: %bound_method.loc16_27.2: = bound_method %int_0, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc16_27.2(%int_0) [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc16_27.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc16_27.2: %i32 = converted %int_0, %.loc16_27.1 [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc16_21: type = splice_block %i32.loc16 [concrete = constants.%i32] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %i32.loc9: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc16: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: } -// CHECK:STDOUT: %Zero: %i32 = wrapper_binding Zero, %.loc9_27.2 +// CHECK:STDOUT: %Zero: %i32 = wrapper_binding Zero, %.loc16_27.2 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %Zero.patt: %pattern_type.d94 = value_binding_pattern Zero [concrete = constants.%Zero.patt] // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/let/convert.carbon b/toolchain/check/testdata/let/convert.carbon index d6a6d0141154..13e817f7f979 100644 --- a/toolchain/check/testdata/let/convert.carbon +++ b/toolchain/check/testdata/let/convert.carbon @@ -30,10 +30,22 @@ library "[[@TEST_NAME]]"; fn G() { var a: i32 = 0; let unused n: i32 = a; - // CHECK:STDERR: fail_let_bound_to_ref_not_mutable.carbon:[[@LINE+5]]:3: error: expression is not assignable [AssignmentToNonAssignable] + // CHECK:STDERR: ╭─┤ fail_let_bound_to_ref_not_mutable.carbon:[[@LINE+17]]:3 + // CHECK:STDERR: -> │ n = 1; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expression is not assignable [AssignmentToNonAssignable] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_let_bound_to_ref_not_mutable.carbon:[[@LINE-3]]:14-19: error: variable `n` marked `unused` but used [UnusedButUsed] - // CHECK:STDERR: fail_let_bound_to_ref_not_mutable.carbon:[[@LINE+2]]:3: note: usage here [UnusedButUsedHere] + // CHECK:STDERR: ╭─┤ fail_let_bound_to_ref_not_mutable.carbon:[[@LINE-7]]:14 + // CHECK:STDERR: -> │ let unused n: i32 = a; + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: variable `n` marked `unused` but used + // CHECK:STDERR: · ┃ [UnusedButUsed] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ n = 1; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ usage here [UnusedButUsedHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: n = 1; } diff --git a/toolchain/check/testdata/let/fail_duplicate_decl.carbon b/toolchain/check/testdata/let/fail_duplicate_decl.carbon index 50fe3d377a47..fe163e11f37e 100644 --- a/toolchain/check/testdata/let/fail_duplicate_decl.carbon +++ b/toolchain/check/testdata/let/fail_duplicate_decl.carbon @@ -14,8 +14,16 @@ fn F() { let unused a: i32 = 1; - // CHECK:STDERR: fail_duplicate_decl.carbon:[[@LINE+3]]:14: error: duplicate name `a` being declared in the same scope [NameDeclDuplicate] - // CHECK:STDERR: fail_duplicate_decl.carbon:[[@LINE-2]]:14-19: note: name is previously declared here [NameDeclPrevious] + // CHECK:STDERR: ╭─┤ fail_duplicate_decl.carbon:[[@LINE+11]]:14 + // CHECK:STDERR: │ let unused a: i32 = 1; + // CHECK:STDERR: · ───┬── + // CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ let unused a: i32 = 2; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: duplicate name `a` being declared in the same scope + // CHECK:STDERR: · ┃ [NameDeclDuplicate] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused a: i32 = 2; } @@ -94,17 +102,17 @@ fn F() { // CHECK:STDOUT: %a.patt.loc16: %pattern_type.d94 = value_binding_pattern a [concrete = constants.%a.patt.4135b0.1] // CHECK:STDOUT: } // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] -// CHECK:STDOUT: %impl.elem0.loc20: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc20_23.1: = bound_method %int_2, %impl.elem0.loc20 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.8a6] -// CHECK:STDOUT: %specific_fn.loc20: = specific_function %impl.elem0.loc20, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc20_23.2: = bound_method %int_2, %specific_fn.loc20 [concrete = constants.%bound_method.a55] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc20: init %i32 = call %bound_method.loc20_23.2(%int_2) [concrete = constants.%int_2.2e0] -// CHECK:STDOUT: %.loc20_23.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc20 [concrete = constants.%int_2.2e0] -// CHECK:STDOUT: %.loc20_23.2: %i32 = converted %int_2, %.loc20_23.1 [concrete = constants.%int_2.2e0] -// CHECK:STDOUT: %i32.loc20: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %a.loc20: %i32 = wrapper_binding a, %.loc20_23.2 +// CHECK:STDOUT: %impl.elem0.loc28: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc28_23.1: = bound_method %int_2, %impl.elem0.loc28 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.8a6] +// CHECK:STDOUT: %specific_fn.loc28: = specific_function %impl.elem0.loc28, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc28_23.2: = bound_method %int_2, %specific_fn.loc28 [concrete = constants.%bound_method.a55] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc28: init %i32 = call %bound_method.loc28_23.2(%int_2) [concrete = constants.%int_2.2e0] +// CHECK:STDOUT: %.loc28_23.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc28 [concrete = constants.%int_2.2e0] +// CHECK:STDOUT: %.loc28_23.2: %i32 = converted %int_2, %.loc28_23.1 [concrete = constants.%int_2.2e0] +// CHECK:STDOUT: %i32.loc28: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %a.loc28: %i32 = wrapper_binding a, %.loc28_23.2 // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %a.patt.loc20: %pattern_type.d94 = value_binding_pattern a [concrete = constants.%a.patt.4135b0.2] +// CHECK:STDOUT: %a.patt.loc28: %pattern_type.d94 = value_binding_pattern a [concrete = constants.%a.patt.4135b0.2] // CHECK:STDOUT: } // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/let/fail_generic.carbon b/toolchain/check/testdata/let/fail_generic.carbon index ec776232a745..9f5a37adb7e7 100644 --- a/toolchain/check/testdata/let/fail_generic.carbon +++ b/toolchain/check/testdata/let/fail_generic.carbon @@ -14,7 +14,14 @@ // TODO: Should this be valid? fn F(unused a: i32) -> i32 { - // CHECK:STDERR: fail_generic.carbon:[[@LINE+2]]:15-21: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_generic.carbon:[[@LINE+9]]:15 + // CHECK:STDERR: -> │ let generic T: type = i32; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: semantics TODO: + // CHECK:STDERR: · ┃ `local generic `let` bindings are currently unsupported` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let generic T: type = i32; let x: T = 5; diff --git a/toolchain/check/testdata/let/fail_generic_import.carbon b/toolchain/check/testdata/let/fail_generic_import.carbon index 6d4939177ade..790f6b7b51f4 100644 --- a/toolchain/check/testdata/let/fail_generic_import.carbon +++ b/toolchain/check/testdata/let/fail_generic_import.carbon @@ -16,7 +16,14 @@ package Implicit; -// CHECK:STDERR: fail_implicit.carbon:[[@LINE+2]]:13-19: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_implicit.carbon:[[@LINE+9]]:13 +// CHECK:STDERR: -> │ let generic T: type = i32; +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: semantics TODO: +// CHECK:STDERR: · ┃ ``let` compile time binding outside function or interface` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let generic T: type = i32; @@ -25,7 +32,11 @@ let generic T: type = i32; impl package Implicit; // TODO: Should this be valid? -// CHECK:STDERR: fail_implicit.impl.carbon:[[@LINE+2]]:8: error: cannot evaluate type expression [TypeExprEvaluationFailure] +// CHECK:STDERR: ╭─┤ fail_implicit.impl.carbon:[[@LINE+6]]:8 +// CHECK:STDERR: -> │ let a: T = 0; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: cannot evaluate type expression [TypeExprEvaluationFailure] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let a: T = 0; @@ -57,9 +68,9 @@ let a: T = 0; // CHECK:STDOUT: .T = %T // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %.loc6_16.1: type = splice_block %.loc6_16.2 [concrete = type] { +// CHECK:STDOUT: %.loc13_16.1: type = splice_block %.loc13_16.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc6_16.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc13_16.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } // CHECK:STDOUT: %T: type = wrapper_binding T, @__global_init.%i32 // CHECK:STDOUT: name_binding_decl { diff --git a/toolchain/check/testdata/let/fail_missing_value.carbon b/toolchain/check/testdata/let/fail_missing_value.carbon index bcd6162d3c54..db5b3a63dc4f 100644 --- a/toolchain/check/testdata/let/fail_missing_value.carbon +++ b/toolchain/check/testdata/let/fail_missing_value.carbon @@ -12,12 +12,23 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/let/fail_missing_value.carbon -// CHECK:STDERR: fail_missing_value.carbon:[[@LINE+2]]:11: error: expected `=`; `let` declaration must have an initializer [ExpectedInitializerAfterLet] +// CHECK:STDERR: ╭─┤ fail_missing_value.carbon:[[@LINE+7]]:11 +// CHECK:STDERR: -> │ let n: i32; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `=`; `let` declaration must have an initializer +// CHECK:STDERR: · ┃ [ExpectedInitializerAfterLet] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let n: i32; fn F() { - // CHECK:STDERR: fail_missing_value.carbon:[[@LINE+2]]:20: error: expected `=`; `let` declaration must have an initializer [ExpectedInitializerAfterLet] + // CHECK:STDERR: ╭─┤ fail_missing_value.carbon:[[@LINE+8]]:20 + // CHECK:STDERR: -> │ let unused n: i32; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `=`; `let` declaration must have an + // CHECK:STDERR: · ┃ initializer + // CHECK:STDERR: · ┃ [ExpectedInitializerAfterLet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused n: i32; } @@ -49,7 +60,7 @@ fn F() { // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [concrete] { // CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .n = .inst{{[0-9A-F]+}}.loc17_6 +// CHECK:STDOUT: .n = .inst{{[0-9A-F]+}}.loc22_6 // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core diff --git a/toolchain/check/testdata/let/fail_modifiers.carbon b/toolchain/check/testdata/let/fail_modifiers.carbon index 8915b715061a..cd7e3d523484 100644 --- a/toolchain/check/testdata/let/fail_modifiers.carbon +++ b/toolchain/check/testdata/let/fail_modifiers.carbon @@ -12,47 +12,105 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/let/fail_modifiers.carbon -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-9: error: `protected` not allowed; requires class scope [ModifierProtectedNotAllowed] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ protected let b: i32 = 1; +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: `protected` not allowed; requires class scope +// CHECK:STDERR: · ┃ [ModifierProtectedNotAllowed] +// CHECK:STDERR: ╰──── // CHECK:STDERR: protected let b: i32 = 1; -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-7: error: `default` not allowed; requires interface scope [ModifierRequiresInterface] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ default let c: i32 = 1; +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: `default` not allowed; requires interface scope +// CHECK:STDERR: · ┃ [ModifierRequiresInterface] +// CHECK:STDERR: ╰──── // CHECK:STDERR: default let c: i32 = 1; -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-5: error: `final` not allowed; requires interface scope [ModifierRequiresInterface] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ final let d: i32 = 1; +// CHECK:STDERR: · ━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: `final` not allowed; requires interface scope +// CHECK:STDERR: · ┃ [ModifierRequiresInterface] +// CHECK:STDERR: ╰──── // CHECK:STDERR: final let d: i32 = 1; -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-7: error: `virtual` not allowed on `let` declaration [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ virtual let e: i32 = 1; +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: `virtual` not allowed on `let` declaration +// CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╰──── // CHECK:STDERR: virtual let e: i32 = 1; -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+5]]:9-13: error: `final` not allowed on declaration with `default` [ModifierNotAllowedWith] -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1-7: note: `default` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+15]]:9 +// CHECK:STDERR: -> │ default final let f: i32 = 1; +// CHECK:STDERR: · ───┬─── ━━┳━━ +// CHECK:STDERR: · │ ┗━━┫ error: `final` not allowed on declaration with `default` +// CHECK:STDERR: · │ ┃ [ModifierNotAllowedWith] +// CHECK:STDERR: · ╰───────────┤ `default` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-7: error: `default` not allowed; requires interface scope [ModifierRequiresInterface] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ default final let f: i32 = 1; +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: `default` not allowed; requires interface scope +// CHECK:STDERR: · ┃ [ModifierRequiresInterface] +// CHECK:STDERR: ╰──── // CHECK:STDERR: default final let f: i32 = 1; -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+5]]:9-15: error: `default` repeated on declaration [ModifierRepeated] -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1-7: note: `default` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+14]]:9 +// CHECK:STDERR: -> │ default default let g: i32 = 1; +// CHECK:STDERR: · ───┬─── ━━━┳━━━ +// CHECK:STDERR: · │ ┗━━┫ error: `default` repeated on declaration [ModifierRepeated] +// CHECK:STDERR: · ╰────────────┤ `default` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-7: error: `default` not allowed; requires interface scope [ModifierRequiresInterface] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ default default let g: i32 = 1; +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: `default` not allowed; requires interface scope +// CHECK:STDERR: · ┃ [ModifierRequiresInterface] +// CHECK:STDERR: ╰──── // CHECK:STDERR: default default let g: i32 = 1; -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+5]]:11-17: error: `private` not allowed on declaration with `protected` [ModifierNotAllowedWith] -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1-9: note: `protected` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+15]]:11 +// CHECK:STDERR: -> │ protected private let h: i32 = 1; +// CHECK:STDERR: · ────┬──── ━━━┳━━━ +// CHECK:STDERR: · │ ┗━━┫ error: `private` not allowed on declaration with `protected` +// CHECK:STDERR: · │ ┃ [ModifierNotAllowedWith] +// CHECK:STDERR: · ╰─────────────┤ `protected` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-9: error: `protected` not allowed; requires class scope [ModifierProtectedNotAllowed] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ protected private let h: i32 = 1; +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: `protected` not allowed; requires class scope +// CHECK:STDERR: · ┃ [ModifierProtectedNotAllowed] +// CHECK:STDERR: ╰──── // CHECK:STDERR: protected private let h: i32 = 1; -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+5]]:11-19: error: `protected` repeated on declaration [ModifierRepeated] -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1-9: note: `protected` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+14]]:11 +// CHECK:STDERR: -> │ protected protected let i: i32 = 1; +// CHECK:STDERR: · ────┬──── ━━━━┳━━━━ +// CHECK:STDERR: · │ ┗━━┫ error: `protected` repeated on declaration [ModifierRepeated] +// CHECK:STDERR: · ╰──────────────┤ `protected` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-9: error: `protected` not allowed; requires class scope [ModifierProtectedNotAllowed] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ protected protected let i: i32 = 1; +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: `protected` not allowed; requires class scope +// CHECK:STDERR: · ┃ [ModifierProtectedNotAllowed] +// CHECK:STDERR: ╰──── // CHECK:STDERR: protected protected let i: i32 = 1; @@ -118,99 +176,99 @@ protected protected let i: i32 = 1; // CHECK:STDOUT: .i [protected] = %i // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %impl.elem0.loc17: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc17_24.1: = bound_method @__global_init.%int_1.loc17, %impl.elem0.loc17 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] -// CHECK:STDOUT: %specific_fn.loc17: = specific_function %impl.elem0.loc17, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc17_24.2: = bound_method @__global_init.%int_1.loc17, %specific_fn.loc17 [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc17: init %i32 = call %bound_method.loc17_24.2(@__global_init.%int_1.loc17) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc17_24.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc17 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc17_24.2: %i32 = converted @__global_init.%int_1.loc17, %.loc17_24.1 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %i32.loc17: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %b: %i32 = wrapper_binding b, %.loc17_24.2 +// CHECK:STDOUT: %impl.elem0.loc22: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc22_24.1: = bound_method @__global_init.%int_1.loc22, %impl.elem0.loc22 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %specific_fn.loc22: = specific_function %impl.elem0.loc22, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc22_24.2: = bound_method @__global_init.%int_1.loc22, %specific_fn.loc22 [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc22: init %i32 = call %bound_method.loc22_24.2(@__global_init.%int_1.loc22) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc22_24.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc22 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc22_24.2: %i32 = converted @__global_init.%int_1.loc22, %.loc22_24.1 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %i32.loc22: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %b: %i32 = wrapper_binding b, %.loc22_24.2 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %b.patt: %pattern_type.d94 = value_binding_pattern b [concrete = constants.%b.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %impl.elem0.loc21: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc21_22.1: = bound_method @__global_init.%int_1.loc21, %impl.elem0.loc21 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] -// CHECK:STDOUT: %specific_fn.loc21: = specific_function %impl.elem0.loc21, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc21_22.2: = bound_method @__global_init.%int_1.loc21, %specific_fn.loc21 [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc21: init %i32 = call %bound_method.loc21_22.2(@__global_init.%int_1.loc21) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc21_22.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc21 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc21_22.2: %i32 = converted @__global_init.%int_1.loc21, %.loc21_22.1 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %i32.loc21: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %c: %i32 = wrapper_binding c, %.loc21_22.2 +// CHECK:STDOUT: %impl.elem0.loc31: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc31_22.1: = bound_method @__global_init.%int_1.loc31, %impl.elem0.loc31 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %specific_fn.loc31: = specific_function %impl.elem0.loc31, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc31_22.2: = bound_method @__global_init.%int_1.loc31, %specific_fn.loc31 [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc31: init %i32 = call %bound_method.loc31_22.2(@__global_init.%int_1.loc31) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc31_22.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc31 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc31_22.2: %i32 = converted @__global_init.%int_1.loc31, %.loc31_22.1 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %i32.loc31: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %c: %i32 = wrapper_binding c, %.loc31_22.2 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %c.patt: %pattern_type.d94 = value_binding_pattern c [concrete = constants.%c.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %impl.elem0.loc25: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc25_20.1: = bound_method @__global_init.%int_1.loc25, %impl.elem0.loc25 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] -// CHECK:STDOUT: %specific_fn.loc25: = specific_function %impl.elem0.loc25, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc25_20.2: = bound_method @__global_init.%int_1.loc25, %specific_fn.loc25 [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc25: init %i32 = call %bound_method.loc25_20.2(@__global_init.%int_1.loc25) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc25_20.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc25 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc25_20.2: %i32 = converted @__global_init.%int_1.loc25, %.loc25_20.1 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %i32.loc25: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %d: %i32 = wrapper_binding d, %.loc25_20.2 +// CHECK:STDOUT: %impl.elem0.loc40: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc40_20.1: = bound_method @__global_init.%int_1.loc40, %impl.elem0.loc40 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %specific_fn.loc40: = specific_function %impl.elem0.loc40, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc40_20.2: = bound_method @__global_init.%int_1.loc40, %specific_fn.loc40 [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc40: init %i32 = call %bound_method.loc40_20.2(@__global_init.%int_1.loc40) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc40_20.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc40 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc40_20.2: %i32 = converted @__global_init.%int_1.loc40, %.loc40_20.1 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %i32.loc40: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %d: %i32 = wrapper_binding d, %.loc40_20.2 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %d.patt: %pattern_type.d94 = value_binding_pattern d [concrete = constants.%d.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %impl.elem0.loc29: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc29_22.1: = bound_method @__global_init.%int_1.loc29, %impl.elem0.loc29 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] -// CHECK:STDOUT: %specific_fn.loc29: = specific_function %impl.elem0.loc29, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc29_22.2: = bound_method @__global_init.%int_1.loc29, %specific_fn.loc29 [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc29: init %i32 = call %bound_method.loc29_22.2(@__global_init.%int_1.loc29) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc29_22.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc29 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc29_22.2: %i32 = converted @__global_init.%int_1.loc29, %.loc29_22.1 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %i32.loc29: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %e: %i32 = wrapper_binding e, %.loc29_22.2 +// CHECK:STDOUT: %impl.elem0.loc49: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc49_22.1: = bound_method @__global_init.%int_1.loc49, %impl.elem0.loc49 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %specific_fn.loc49: = specific_function %impl.elem0.loc49, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc49_22.2: = bound_method @__global_init.%int_1.loc49, %specific_fn.loc49 [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc49: init %i32 = call %bound_method.loc49_22.2(@__global_init.%int_1.loc49) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc49_22.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc49 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc49_22.2: %i32 = converted @__global_init.%int_1.loc49, %.loc49_22.1 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %i32.loc49: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %e: %i32 = wrapper_binding e, %.loc49_22.2 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %e.patt: %pattern_type.d94 = value_binding_pattern e [concrete = constants.%e.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %impl.elem0.loc36: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc36_28.1: = bound_method @__global_init.%int_1.loc36, %impl.elem0.loc36 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] -// CHECK:STDOUT: %specific_fn.loc36: = specific_function %impl.elem0.loc36, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc36_28.2: = bound_method @__global_init.%int_1.loc36, %specific_fn.loc36 [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc36: init %i32 = call %bound_method.loc36_28.2(@__global_init.%int_1.loc36) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc36_28.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc36 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc36_28.2: %i32 = converted @__global_init.%int_1.loc36, %.loc36_28.1 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %i32.loc36: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %f: %i32 = wrapper_binding f, %.loc36_28.2 +// CHECK:STDOUT: %impl.elem0.loc66: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc66_28.1: = bound_method @__global_init.%int_1.loc66, %impl.elem0.loc66 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %specific_fn.loc66: = specific_function %impl.elem0.loc66, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc66_28.2: = bound_method @__global_init.%int_1.loc66, %specific_fn.loc66 [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc66: init %i32 = call %bound_method.loc66_28.2(@__global_init.%int_1.loc66) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc66_28.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc66 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc66_28.2: %i32 = converted @__global_init.%int_1.loc66, %.loc66_28.1 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %i32.loc66: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %f: %i32 = wrapper_binding f, %.loc66_28.2 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %f.patt: %pattern_type.d94 = value_binding_pattern f [concrete = constants.%f.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %impl.elem0.loc43: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc43_30.1: = bound_method @__global_init.%int_1.loc43, %impl.elem0.loc43 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] -// CHECK:STDOUT: %specific_fn.loc43: = specific_function %impl.elem0.loc43, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc43_30.2: = bound_method @__global_init.%int_1.loc43, %specific_fn.loc43 [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc43: init %i32 = call %bound_method.loc43_30.2(@__global_init.%int_1.loc43) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc43_30.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc43 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc43_30.2: %i32 = converted @__global_init.%int_1.loc43, %.loc43_30.1 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %i32.loc43: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %g: %i32 = wrapper_binding g, %.loc43_30.2 +// CHECK:STDOUT: %impl.elem0.loc82: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc82_30.1: = bound_method @__global_init.%int_1.loc82, %impl.elem0.loc82 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %specific_fn.loc82: = specific_function %impl.elem0.loc82, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc82_30.2: = bound_method @__global_init.%int_1.loc82, %specific_fn.loc82 [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc82: init %i32 = call %bound_method.loc82_30.2(@__global_init.%int_1.loc82) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc82_30.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc82 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc82_30.2: %i32 = converted @__global_init.%int_1.loc82, %.loc82_30.1 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %i32.loc82: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %g: %i32 = wrapper_binding g, %.loc82_30.2 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %g.patt: %pattern_type.d94 = value_binding_pattern g [concrete = constants.%g.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %impl.elem0.loc50: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc50_32.1: = bound_method @__global_init.%int_1.loc50, %impl.elem0.loc50 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] -// CHECK:STDOUT: %specific_fn.loc50: = specific_function %impl.elem0.loc50, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc50_32.2: = bound_method @__global_init.%int_1.loc50, %specific_fn.loc50 [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc50: init %i32 = call %bound_method.loc50_32.2(@__global_init.%int_1.loc50) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc50_32.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc50 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc50_32.2: %i32 = converted @__global_init.%int_1.loc50, %.loc50_32.1 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %i32.loc50: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %h: %i32 = wrapper_binding h, %.loc50_32.2 +// CHECK:STDOUT: %impl.elem0.loc99: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc99_32.1: = bound_method @__global_init.%int_1.loc99, %impl.elem0.loc99 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %specific_fn.loc99: = specific_function %impl.elem0.loc99, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc99_32.2: = bound_method @__global_init.%int_1.loc99, %specific_fn.loc99 [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc99: init %i32 = call %bound_method.loc99_32.2(@__global_init.%int_1.loc99) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc99_32.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc99 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc99_32.2: %i32 = converted @__global_init.%int_1.loc99, %.loc99_32.1 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %i32.loc99: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %h: %i32 = wrapper_binding h, %.loc99_32.2 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %h.patt: %pattern_type.d94 = value_binding_pattern h [concrete = constants.%h.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %impl.elem0.loc57: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc57_34.1: = bound_method @__global_init.%int_1.loc57, %impl.elem0.loc57 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] -// CHECK:STDOUT: %specific_fn.loc57: = specific_function %impl.elem0.loc57, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc57_34.2: = bound_method @__global_init.%int_1.loc57, %specific_fn.loc57 [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc57: init %i32 = call %bound_method.loc57_34.2(@__global_init.%int_1.loc57) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc57_34.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc57 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc57_34.2: %i32 = converted @__global_init.%int_1.loc57, %.loc57_34.1 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %i32.loc57: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %i: %i32 = wrapper_binding i, %.loc57_34.2 +// CHECK:STDOUT: %impl.elem0.loc115: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc115_34.1: = bound_method @__global_init.%int_1.loc115, %impl.elem0.loc115 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %specific_fn.loc115: = specific_function %impl.elem0.loc115, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc115_34.2: = bound_method @__global_init.%int_1.loc115, %specific_fn.loc115 [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc115: init %i32 = call %bound_method.loc115_34.2(@__global_init.%int_1.loc115) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc115_34.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc115 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc115_34.2: %i32 = converted @__global_init.%int_1.loc115, %.loc115_34.1 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %i32.loc115: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i: %i32 = wrapper_binding i, %.loc115_34.2 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %i.patt: %pattern_type.d94 = value_binding_pattern i [concrete = constants.%i.patt] // CHECK:STDOUT: } @@ -218,14 +276,14 @@ protected protected let i: i32 = 1; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %int_1.loc17: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %int_1.loc21: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %int_1.loc25: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %int_1.loc29: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %int_1.loc36: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %int_1.loc43: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %int_1.loc50: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %int_1.loc57: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %int_1.loc22: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %int_1.loc31: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %int_1.loc40: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %int_1.loc49: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %int_1.loc66: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %int_1.loc82: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %int_1.loc99: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %int_1.loc115: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/let/fail_use_in_init.carbon b/toolchain/check/testdata/let/fail_use_in_init.carbon index 38820ce3a9ce..de12cd57be27 100644 --- a/toolchain/check/testdata/let/fail_use_in_init.carbon +++ b/toolchain/check/testdata/let/fail_use_in_init.carbon @@ -13,10 +13,20 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/let/fail_use_in_init.carbon fn F() { - // CHECK:STDERR: fail_use_in_init.carbon:[[@LINE+5]]:23: error: `a` used before initialization [UsedBeforeInitialization] + // CHECK:STDERR: ╭─┤ fail_use_in_init.carbon:[[@LINE+15]]:23 + // CHECK:STDERR: -> │ let unused a: i32 = a; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: `a` used before initialization + // CHECK:STDERR: · ┃ [UsedBeforeInitialization] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_use_in_init.carbon:[[@LINE+3]]:14-19: error: variable `a` marked `unused` but used [UnusedButUsed] - // CHECK:STDERR: fail_use_in_init.carbon:[[@LINE+2]]:23: note: usage here [UnusedButUsedHere] + // CHECK:STDERR: ╭─┤ fail_use_in_init.carbon:[[@LINE+8]]:14 + // CHECK:STDERR: -> │ let unused a: i32 = a; + // CHECK:STDERR: · ━━━┳━━ ┬ + // CHECK:STDERR: · ┗━━━━━━━━┫ error: variable `a` marked `unused` but used + // CHECK:STDERR: · │ ┃ [UnusedButUsed] + // CHECK:STDERR: · ╰────┤ usage here [UnusedButUsedHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused a: i32 = a; } diff --git a/toolchain/check/testdata/let/form.carbon b/toolchain/check/testdata/let/form.carbon index 9a1c65a01c58..b50dce61f4f4 100644 --- a/toolchain/check/testdata/let/form.carbon +++ b/toolchain/check/testdata/let/form.carbon @@ -13,9 +13,21 @@ // --- fail_todo_form_binding.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_todo_form_binding.carbon:[[@LINE+5]]:9-10: error: cannot implicitly convert expression of type `()` to `Core.Form` [ConversionFailure] -// CHECK:STDERR: fail_todo_form_binding.carbon:[[@LINE+4]]:9-10: note: type `()` does not implement interface `Core.ImplicitAs(Core.Form)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_todo_form_binding.carbon:[[@LINE+17]]:9 +// CHECK:STDERR: -> │ let x:? () = (); +// CHECK:STDERR: · ┳━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `()` to +// CHECK:STDERR: · │ ┃ `Core.Form` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╰────┤ type `()` does not implement interface +// CHECK:STDERR: · │ `Core.ImplicitAs(Core.Form)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_todo_form_binding.carbon:[[@LINE+2]]:5-10: error: semantics TODO: `support local form bindings` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_todo_form_binding.carbon:[[@LINE+6]]:5 +// CHECK:STDERR: -> │ let x:? () = (); +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `support local form bindings` [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let x:? () = (); diff --git a/toolchain/check/testdata/let/generic.carbon b/toolchain/check/testdata/let/generic.carbon index c4662ec36652..205f19257336 100644 --- a/toolchain/check/testdata/let/generic.carbon +++ b/toolchain/check/testdata/let/generic.carbon @@ -16,7 +16,14 @@ library "[[@TEST_NAME]]"; fn F() { - // CHECK:STDERR: fail_todo_type.carbon:[[@LINE+2]]:15-21: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_type.carbon:[[@LINE+9]]:15 + // CHECK:STDERR: -> │ let generic T: type = i32; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: semantics TODO: + // CHECK:STDERR: · ┃ `local generic `let` bindings are currently unsupported` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let generic T: type = i32; var p: T*; @@ -27,7 +34,14 @@ fn F() { library "[[@TEST_NAME]]"; fn F(a: i32) -> i32 { - // CHECK:STDERR: fail_todo_assignment.carbon:[[@LINE+2]]:15-21: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_assignment.carbon:[[@LINE+9]]:15 + // CHECK:STDERR: -> │ let generic T: type = i32; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: semantics TODO: + // CHECK:STDERR: · ┃ `local generic `let` bindings are currently unsupported` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let generic T: type = i32; let x: T = 5; diff --git a/toolchain/check/testdata/let/generic_import.carbon b/toolchain/check/testdata/let/generic_import.carbon index ad5b2267aef7..989418022507 100644 --- a/toolchain/check/testdata/let/generic_import.carbon +++ b/toolchain/check/testdata/let/generic_import.carbon @@ -16,7 +16,14 @@ package Implicit; -// CHECK:STDERR: fail_implicit.carbon:[[@LINE+2]]:13-19: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_implicit.carbon:[[@LINE+9]]:13 +// CHECK:STDERR: -> │ let generic T: type = i32; +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: semantics TODO: +// CHECK:STDERR: · ┃ ``let` compile time binding outside function or interface` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let generic T: type = i32; @@ -24,10 +31,18 @@ let generic T: type = i32; impl package Implicit; -// CHECK:STDERR: fail_implicit.impl.carbon:[[@LINE+2]]:8-9: error: cannot evaluate type expression [TypeExprEvaluationFailure] +// CHECK:STDERR: ╭─┤ fail_implicit.impl.carbon:[[@LINE+6]]:8 +// CHECK:STDERR: -> │ var a: T*; +// CHECK:STDERR: · ━┳ +// CHECK:STDERR: · ┗━━┫ error: cannot evaluate type expression [TypeExprEvaluationFailure] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var a: T*; -// CHECK:STDERR: fail_implicit.impl.carbon:[[@LINE+2]]:8: error: cannot evaluate type expression [TypeExprEvaluationFailure] +// CHECK:STDERR: ╭─┤ fail_implicit.impl.carbon:[[@LINE+6]]:8 +// CHECK:STDERR: -> │ var b: T = *a; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: cannot evaluate type expression [TypeExprEvaluationFailure] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var b: T = *a; @@ -59,9 +74,9 @@ var b: T = *a; // CHECK:STDOUT: .T = %T // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %.loc6_16.1: type = splice_block %.loc6_16.2 [concrete = type] { +// CHECK:STDOUT: %.loc13_16.1: type = splice_block %.loc13_16.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc6_16.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc13_16.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } // CHECK:STDOUT: %T: type = wrapper_binding T, @__global_init.%i32 // CHECK:STDOUT: name_binding_decl { @@ -100,8 +115,8 @@ var b: T = *a; // CHECK:STDOUT: %default.import = import // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %a.var: ref = var_storage %a.var_patt [concrete = ] -// CHECK:STDOUT: %.loc6: type = splice_block %ptr [concrete = ] { -// CHECK:STDOUT: %T.ref.loc6: type = name_ref T, imports.%Implicit.T +// CHECK:STDOUT: %.loc10: type = splice_block %ptr [concrete = ] { +// CHECK:STDOUT: %T.ref.loc10: type = name_ref T, imports.%Implicit.T // CHECK:STDOUT: %ptr: type = ptr_type [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: %a: = wrapper_binding a, [concrete = ] @@ -110,7 +125,7 @@ var b: T = *a; // CHECK:STDOUT: %a.var_patt: = var_pattern %a.patt [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: %b.var: ref = var_storage %b.var_patt [concrete = ] -// CHECK:STDOUT: %T.ref.loc9: type = name_ref T, imports.%Implicit.T +// CHECK:STDOUT: %T.ref.loc17: type = name_ref T, imports.%Implicit.T // CHECK:STDOUT: %b: = wrapper_binding b, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %b.patt: = ref_binding_pattern b [concrete = ] @@ -122,7 +137,7 @@ var b: T = *a; // CHECK:STDOUT: !entry: // CHECK:STDOUT: assign file.%a.var, // CHECK:STDOUT: %a.ref: = name_ref a, file.%a [concrete = ] -// CHECK:STDOUT: %.loc9: ref = deref [concrete = ] +// CHECK:STDOUT: %.loc17: ref = deref [concrete = ] // CHECK:STDOUT: assign file.%b.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/let/import_access.carbon b/toolchain/check/testdata/let/import_access.carbon index 141f71bafcb8..3a112f409312 100644 --- a/toolchain/check/testdata/let/import_access.carbon +++ b/toolchain/check/testdata/let/import_access.carbon @@ -38,7 +38,11 @@ package Test library "[[@TEST_NAME]]"; import library "def"; -// CHECK:STDERR: fail_local_def.carbon:[[@LINE+2]]:14: error: name `v` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_local_def.carbon:[[@LINE+6]]:14 +// CHECK:STDERR: -> │ let v2: () = v; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: name `v` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let v2: () = v; @@ -48,7 +52,12 @@ package Other library "[[@TEST_NAME]]"; import Test library "def"; -// CHECK:STDERR: fail_other_def.carbon:[[@LINE+2]]:14-19: error: member name `v` not found in `Test` [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╭─┤ fail_other_def.carbon:[[@LINE+7]]:14 +// CHECK:STDERR: -> │ let v2: () = Test.v; +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: member name `v` not found in `Test` +// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let v2: () = Test.v; @@ -137,9 +146,9 @@ let v2: () = Test.v; // CHECK:STDOUT: .v = // CHECK:STDOUT: } // CHECK:STDOUT: %default.import = import -// CHECK:STDOUT: %.loc8_10.1: type = splice_block %.loc8_10.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc8_10.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_10.3: type = converted %.loc8_10.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc12_10.1: type = splice_block %.loc12_10.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc12_10.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc12_10.3: type = converted %.loc12_10.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %v2: %empty_tuple.type = wrapper_binding v2, [concrete = ] // CHECK:STDOUT: name_binding_decl { @@ -176,9 +185,9 @@ let v2: () = Test.v; // CHECK:STDOUT: .v2 = %v2 // CHECK:STDOUT: } // CHECK:STDOUT: %Test.import = import Test -// CHECK:STDOUT: %.loc8_10.1: type = splice_block %.loc8_10.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc8_10.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_10.3: type = converted %.loc8_10.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc13_10.1: type = splice_block %.loc13_10.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc13_10.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc13_10.3: type = converted %.loc13_10.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %v2: %empty_tuple.type = wrapper_binding v2, [concrete = ] // CHECK:STDOUT: name_binding_decl { diff --git a/toolchain/check/testdata/let/local.carbon b/toolchain/check/testdata/let/local.carbon index 17666bbf368c..fd3a7383caf5 100644 --- a/toolchain/check/testdata/let/local.carbon +++ b/toolchain/check/testdata/let/local.carbon @@ -29,7 +29,14 @@ fn F(_: C) {} fn CallF() { //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_symbolic.carbon:[[@LINE+2]]:15-18: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_symbolic.carbon:[[@LINE+9]]:15 + // CHECK:STDERR: -> │ let generic c: C = {}; + // CHECK:STDERR: · ━━┳━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: semantics TODO: + // CHECK:STDERR: · ┃ `local generic `let` bindings are currently unsupported` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let generic c: C = {}; F(c); diff --git a/toolchain/check/testdata/let/ref.carbon b/toolchain/check/testdata/let/ref.carbon index 43e984ac711d..3692aadff98f 100644 --- a/toolchain/check/testdata/let/ref.carbon +++ b/toolchain/check/testdata/let/ref.carbon @@ -27,7 +27,13 @@ fn F(a: i32) { library "[[@TEST_NAME]]"; fn F(a: i32) { - // CHECK:STDERR: fail_ref_to_value.carbon:[[@LINE+2]]:27: error: cannot bind durable reference to non-reference value of type `i32` [ConversionFailureNonRefToRef] + // CHECK:STDERR: ╭─┤ fail_ref_to_value.carbon:[[@LINE+8]]:27 + // CHECK:STDERR: -> │ let unused ref b: i32 = a; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot bind durable reference to + // CHECK:STDERR: · ┃ non-reference value of type `i32` + // CHECK:STDERR: · ┃ [ConversionFailureNonRefToRef] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused ref b: i32 = a; } @@ -39,7 +45,13 @@ library "[[@TEST_NAME]]"; fn G() -> i32; fn F() { - // CHECK:STDERR: fail_ref_to_temporary.carbon:[[@LINE+2]]:27-29: error: cannot bind durable reference to non-reference value of type `i32` [ConversionFailureNonRefToRef] + // CHECK:STDERR: ╭─┤ fail_ref_to_temporary.carbon:[[@LINE+8]]:27 + // CHECK:STDERR: -> │ let unused ref a: i32 = G(); + // CHECK:STDERR: · ┳━━ + // CHECK:STDERR: · ┗━━┫ error: cannot bind durable reference to + // CHECK:STDERR: · ┃ non-reference value of type `i32` + // CHECK:STDERR: · ┃ [ConversionFailureNonRefToRef] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused ref a: i32 = G(); } diff --git a/toolchain/check/testdata/main_run/fail_mismatch_params.carbon b/toolchain/check/testdata/main_run/fail_mismatch_params.carbon index 8d3d55aba1b0..c7288c0ac670 100644 --- a/toolchain/check/testdata/main_run/fail_mismatch_params.carbon +++ b/toolchain/check/testdata/main_run/fail_mismatch_params.carbon @@ -14,7 +14,13 @@ library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_argc.carbon:[[@LINE+2]]:1-23: error: invalid parameters for `Main.Run` function; expected `()` or `(argc: i32, argv: Core.Optional(char*)*)` [InvalidMainRunParameters] +// CHECK:STDERR: ╭─┤ fail_bad_argc.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ fn Run(unused n: i64) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid parameters for `Main.Run` function; expected `()` or +// CHECK:STDERR: · ┃ `(argc: i32, argv: Core.Optional(char*)*)` +// CHECK:STDERR: · ┃ [InvalidMainRunParameters] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Run(unused n: i64) {} @@ -22,7 +28,13 @@ fn Run(unused n: i64) {} library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_argv.carbon:[[@LINE+2]]:1-38: error: invalid parameters for `Main.Run` function; expected `()` or `(argc: i32, argv: Core.Optional(char*)*)` [InvalidMainRunParameters] +// CHECK:STDERR: ╭─┤ fail_bad_argv.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ fn Run(unused n: i32, unused p: i32) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid parameters for `Main.Run` function; expected `()` or +// CHECK:STDERR: · ┃ `(argc: i32, argv: Core.Optional(char*)*)` +// CHECK:STDERR: · ┃ [InvalidMainRunParameters] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Run(unused n: i32, unused p: i32) {} @@ -30,6 +42,12 @@ fn Run(unused n: i32, unused p: i32) {} library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_too_many_params.carbon:[[@LINE+2]]:1-55: error: invalid parameters for `Main.Run` function; expected `()` or `(argc: i32, argv: Core.Optional(char*)*)` [InvalidMainRunParameters] +// CHECK:STDERR: ╭─┤ fail_too_many_params.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ fn Run(unused n: i32, unused p: i32*, unused q: i32*) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid parameters for `Main.Run` function; expected `()` or +// CHECK:STDERR: · ┃ `(argc: i32, argv: Core.Optional(char*)*)` +// CHECK:STDERR: · ┃ [InvalidMainRunParameters] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Run(unused n: i32, unused p: i32*, unused q: i32*) {} diff --git a/toolchain/check/testdata/main_run/fail_mismatch_return.carbon b/toolchain/check/testdata/main_run/fail_mismatch_return.carbon index 9256b578c8b3..0d6789ece6f5 100644 --- a/toolchain/check/testdata/main_run/fail_mismatch_return.carbon +++ b/toolchain/check/testdata/main_run/fail_mismatch_return.carbon @@ -10,7 +10,13 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/main_run/fail_mismatch_return.carbon -// CHECK:STDERR: fail_mismatch_return.carbon:[[@LINE+2]]:1-17: error: invalid return type for `Main.Run` function; expected `fn (...)` or `fn (...) -> i32` [InvalidMainRunReturnType] +// CHECK:STDERR: ╭─┤ fail_mismatch_return.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ fn Run() -> f64 { +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid return type for `Main.Run` function; expected `fn (...)` or +// CHECK:STDERR: · ┃ `fn (...) -> i32` +// CHECK:STDERR: · ┃ [InvalidMainRunReturnType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Run() -> f64 { return 0.0; diff --git a/toolchain/check/testdata/main_run/fail_mismatch_return_auto.carbon b/toolchain/check/testdata/main_run/fail_mismatch_return_auto.carbon index e4759512e5c5..84a07ff2fa64 100644 --- a/toolchain/check/testdata/main_run/fail_mismatch_return_auto.carbon +++ b/toolchain/check/testdata/main_run/fail_mismatch_return_auto.carbon @@ -10,7 +10,13 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/main_run/fail_mismatch_return_auto.carbon -// CHECK:STDERR: fail_mismatch_return_auto.carbon:[[@LINE+2]]:1-18: error: invalid return type for `Main.Run` function; expected `fn (...)` or `fn (...) -> i32` [InvalidMainRunReturnType] +// CHECK:STDERR: ╭─┤ fail_mismatch_return_auto.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ fn Run() -> auto { +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid return type for `Main.Run` function; expected `fn (...)` or +// CHECK:STDERR: · ┃ `fn (...) -> i32` +// CHECK:STDERR: · ┃ [InvalidMainRunReturnType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Run() -> auto { return 0.0; diff --git a/toolchain/check/testdata/match_first/basic.carbon b/toolchain/check/testdata/match_first/basic.carbon index 15aeafa81c25..3d0c72b50015 100644 --- a/toolchain/check/testdata/match_first/basic.carbon +++ b/toolchain/check/testdata/match_first/basic.carbon @@ -54,8 +54,17 @@ library "[[@TEST_NAME]]"; interface Z {} match_first { - // CHECK:STDERR: fail_final_inside.carbon:[[@LINE+3]]:3-22: error: `final impl` in `match_first` block [FinalImplInMatchFirst] - // CHECK:STDERR: fail_final_inside.carbon:[[@LINE-2]]:1-13: note: the `match_first` block can be modified as `final` instead [FinalImplInMatchFirstNote] + // CHECK:STDERR: ╭─┤ fail_final_inside.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ match_first { + // CHECK:STDERR: · ──────┬────── + // CHECK:STDERR: · ╰──┤ the `match_first` block can be modified as `final` instead + // CHECK:STDERR: · │ [FinalImplInMatchFirstNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ final impl () as Z {} + // CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: `final impl` in `match_first` block + // CHECK:STDERR: · ┃ [FinalImplInMatchFirst] + // CHECK:STDERR: ╰──── // CHECK:STDERR: final impl () as Z {} } @@ -65,7 +74,11 @@ library "[[@TEST_NAME]]"; interface Z {} -// CHECK:STDERR: fail_final_redecl.carbon:[[@LINE+2]]:1-19: error: impl declared but not defined [ImplMissingDefinition] +// CHECK:STDERR: ╭─┤ fail_final_redecl.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ final impl () as Z; +// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: impl declared but not defined [ImplMissingDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: final impl () as Z; match_first { @@ -85,7 +98,11 @@ match_first { // This is not seen as a redecl of the `final impl`. It's not valid to write // an `impl` in `match_first` that overlaps a `final impl`, but we already // have a diagnostic. - // CHECK:STDERR: fail_final_redecl_defined_once.carbon:[[@LINE+2]]:3-15: error: impl declared but not defined [ImplMissingDefinition] + // CHECK:STDERR: ╭─┤ fail_final_redecl_defined_once.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ impl () as Z; + // CHECK:STDERR: · ━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: impl declared but not defined [ImplMissingDefinition] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as Z; } @@ -100,8 +117,16 @@ match_first { // This is not seen as a redecl of the `final impl`. It's not valid to write // an `impl` in `match_first` that overlaps a `final impl`, but we already // have a diagnostic. - // CHECK:STDERR: fail_final_redecl_defined_twice.carbon:[[@LINE+3]]:3-16: error: `impl` will never be used [ImplFinalOverlapsNonFinal] - // CHECK:STDERR: fail_final_redecl_defined_twice.carbon:[[@LINE-6]]:1-20: note: `final impl` declared here would always be used instead [ImplFinalOverlapsNonFinalNote] + // CHECK:STDERR: ╭─┤ fail_final_redecl_defined_twice.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ final impl () as Z {} + // CHECK:STDERR: · ──────────┬───────── + // CHECK:STDERR: · ╰──┤ `final impl` declared here would always be used instead + // CHECK:STDERR: · │ [ImplFinalOverlapsNonFinalNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ impl () as Z {} + // CHECK:STDERR: · ━━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: `impl` will never be used [ImplFinalOverlapsNonFinal] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as Z {} } @@ -116,8 +141,17 @@ match_first { // This _is_ seen as a redecl of the `final impl`. It's not valid to write // an `impl` in `match_first` that overlaps a `final impl`, but we already // have a diagnostic. - // CHECK:STDERR: fail_final_final_redecl.carbon:[[@LINE+3]]:3-22: error: `final impl` in `match_first` block [FinalImplInMatchFirst] - // CHECK:STDERR: fail_final_final_redecl.carbon:[[@LINE-5]]:1-13: note: the `match_first` block can be modified as `final` instead [FinalImplInMatchFirstNote] + // CHECK:STDERR: ╭─┤ fail_final_final_redecl.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ match_first { + // CHECK:STDERR: · ──────┬────── + // CHECK:STDERR: · ╰──┤ the `match_first` block can be modified as `final` instead + // CHECK:STDERR: · │ [FinalImplInMatchFirstNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ final impl () as Z {} + // CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: `final impl` in `match_first` block + // CHECK:STDERR: · ┃ [FinalImplInMatchFirst] + // CHECK:STDERR: ╰──── // CHECK:STDERR: final impl () as Z {} } @@ -185,8 +219,15 @@ interface Z {} impl () as Z {} match_first { - // CHECK:STDERR: fail_redecl_with_definition_after_defined.carbon:[[@LINE+3]]:3-16: error: redefinition of `impl () as Z` [ImplRedefinition] - // CHECK:STDERR: fail_redecl_with_definition_after_defined.carbon:[[@LINE-3]]:1-14: note: previous definition was here [ImplPreviousDefinition] + // CHECK:STDERR: ╭─┤ fail_redecl_with_definition_after_defined.carbon:[[@LINE+10]]:3 + // CHECK:STDERR: │ impl () as Z {} + // CHECK:STDERR: · ───────┬────── + // CHECK:STDERR: · ╰──┤ previous definition was here [ImplPreviousDefinition] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ impl () as Z {} + // CHECK:STDERR: · ━━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: redefinition of `impl () as Z` [ImplRedefinition] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as Z {} } @@ -218,8 +259,16 @@ library "[[@TEST_NAME]]"; interface Z {} interface Y { - // CHECK:STDERR: fail_inside_interface.carbon:[[@LINE+3]]:3-15: error: found `match_first` in invalid scope; expected namespace or class [MatchFirstInWrongScope] - // CHECK:STDERR: fail_inside_interface.carbon:[[@LINE-2]]:1-13: note: in enclosing scope here [MatchFirstInWrongScopeNote] + // CHECK:STDERR: ╭─┤ fail_inside_interface.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ interface Y { + // CHECK:STDERR: · ──────┬────── + // CHECK:STDERR: · ╰──┤ in enclosing scope here [MatchFirstInWrongScopeNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ match_first { + // CHECK:STDERR: · ━┳━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: found `match_first` in invalid scope; expected namespace or class + // CHECK:STDERR: · ┃ [MatchFirstInWrongScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: match_first { impl Self as Z {} @@ -232,8 +281,16 @@ library "[[@TEST_NAME]]"; interface Z {} constraint N { - // CHECK:STDERR: fail_inside_constraint.carbon:[[@LINE+3]]:3-15: error: found `match_first` in invalid scope; expected namespace or class [MatchFirstInWrongScope] - // CHECK:STDERR: fail_inside_constraint.carbon:[[@LINE-2]]:1-14: note: in enclosing scope here [MatchFirstInWrongScopeNote] + // CHECK:STDERR: ╭─┤ fail_inside_constraint.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ constraint N { + // CHECK:STDERR: · ───────┬────── + // CHECK:STDERR: · ╰──┤ in enclosing scope here [MatchFirstInWrongScopeNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ match_first { + // CHECK:STDERR: · ━┳━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: found `match_first` in invalid scope; expected namespace or class + // CHECK:STDERR: · ┃ [MatchFirstInWrongScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: match_first { impl Self as Z {} @@ -246,8 +303,15 @@ library "[[@TEST_NAME]]"; interface Z {} match_first { - // CHECK:STDERR: fail_inside_match_first.carbon:[[@LINE+3]]:3-15: error: found `match_first` in invalid scope; expected namespace or class [MatchFirstInWrongScope] - // CHECK:STDERR: fail_inside_match_first.carbon: note: in enclosing scope here [MatchFirstInWrongScopeNote] + // CHECK:STDERR: ╭─┤ fail_inside_match_first.carbon:[[@LINE+10]]:3 + // CHECK:STDERR: -> │ match_first { + // CHECK:STDERR: · ━┳━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: found `match_first` in invalid scope; expected namespace or class + // CHECK:STDERR: · ┃ [MatchFirstInWrongScope] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ fail_inside_match_first.carbon + // CHECK:STDERR: · ╰──┤ in enclosing scope here [MatchFirstInWrongScopeNote] + // CHECK:STDERR: ╰──── // CHECK:STDERR: match_first { impl () as Z {} @@ -261,8 +325,16 @@ interface Z {} match_first { impl () as Z; - // CHECK:STDERR: fail_redecl_in_same_block.carbon:[[@LINE+3]]:3-15: error: impl declared in `match_first` more than once [ImplInTwoMatchFirst] - // CHECK:STDERR: fail_redecl_in_same_block.carbon:[[@LINE-2]]:3-15: note: previous declaration here [ImplInTwoMatchFirstNote] + // CHECK:STDERR: ╭─┤ fail_redecl_in_same_block.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ impl () as Z; + // CHECK:STDERR: · ──────┬────── + // CHECK:STDERR: · ╰──┤ previous declaration here [ImplInTwoMatchFirstNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ impl () as Z; + // CHECK:STDERR: · ━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: impl declared in `match_first` more than once + // CHECK:STDERR: · ┃ [ImplInTwoMatchFirst] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as Z; } @@ -275,8 +347,16 @@ interface Z {} match_first { impl () as Z; - // CHECK:STDERR: fail_defined_in_same_block.carbon:[[@LINE+3]]:3-16: error: impl declared in `match_first` more than once [ImplInTwoMatchFirst] - // CHECK:STDERR: fail_defined_in_same_block.carbon:[[@LINE-2]]:3-15: note: previous declaration here [ImplInTwoMatchFirstNote] + // CHECK:STDERR: ╭─┤ fail_defined_in_same_block.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ impl () as Z; + // CHECK:STDERR: · ──────┬────── + // CHECK:STDERR: · ╰──┤ previous declaration here [ImplInTwoMatchFirstNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ impl () as Z {} + // CHECK:STDERR: · ━━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: impl declared in `match_first` more than once + // CHECK:STDERR: · ┃ [ImplInTwoMatchFirst] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as Z {} } @@ -288,8 +368,16 @@ interface Z {} match_first { impl () as Z {} - // CHECK:STDERR: fail_redecl_after_defined_in_same_block.carbon:[[@LINE+3]]:3-15: error: impl declared in `match_first` more than once [ImplInTwoMatchFirst] - // CHECK:STDERR: fail_redecl_after_defined_in_same_block.carbon:[[@LINE-2]]:3-16: note: previous declaration here [ImplInTwoMatchFirstNote] + // CHECK:STDERR: ╭─┤ fail_redecl_after_defined_in_same_block.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ impl () as Z {} + // CHECK:STDERR: · ───────┬────── + // CHECK:STDERR: · ╰──┤ previous declaration here [ImplInTwoMatchFirstNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ impl () as Z; + // CHECK:STDERR: · ━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: impl declared in `match_first` more than once + // CHECK:STDERR: · ┃ [ImplInTwoMatchFirst] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as Z; } @@ -303,8 +391,16 @@ impl () as Z {} match_first { impl () as Z; // TODO: This "previous declaration" location is wrong. The redecl came after. - // CHECK:STDERR: fail_two_redecl_in_same_block.carbon:[[@LINE+3]]:3-15: error: impl declared in `match_first` more than once [ImplInTwoMatchFirst] - // CHECK:STDERR: fail_two_redecl_in_same_block.carbon:[[@LINE-3]]:3-15: note: previous declaration here [ImplInTwoMatchFirstNote] + // CHECK:STDERR: ╭─┤ fail_two_redecl_in_same_block.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ impl () as Z; + // CHECK:STDERR: · ──────┬────── + // CHECK:STDERR: · ╰──┤ previous declaration here [ImplInTwoMatchFirstNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ impl () as Z; + // CHECK:STDERR: · ━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: impl declared in `match_first` more than once + // CHECK:STDERR: · ┃ [ImplInTwoMatchFirst] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as Z; } @@ -318,8 +414,16 @@ match_first { impl () as Z; } match_first { - // CHECK:STDERR: fail_redecl_in_different_block.carbon:[[@LINE+3]]:3-15: error: impl declared in `match_first` more than once [ImplInTwoMatchFirst] - // CHECK:STDERR: fail_redecl_in_different_block.carbon:[[@LINE-4]]:3-15: note: previous declaration here [ImplInTwoMatchFirstNote] + // CHECK:STDERR: ╭─┤ fail_redecl_in_different_block.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ impl () as Z; + // CHECK:STDERR: · ──────┬────── + // CHECK:STDERR: · ╰──┤ previous declaration here [ImplInTwoMatchFirstNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ impl () as Z; + // CHECK:STDERR: · ━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: impl declared in `match_first` more than once + // CHECK:STDERR: · ┃ [ImplInTwoMatchFirst] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as Z; } @@ -334,8 +438,16 @@ match_first { impl () as Z {} } match_first { - // CHECK:STDERR: fail_redecl_defined_in_different_block_firset.carbon:[[@LINE+3]]:3-15: error: impl declared in `match_first` more than once [ImplInTwoMatchFirst] - // CHECK:STDERR: fail_redecl_defined_in_different_block_firset.carbon:[[@LINE-4]]:3-16: note: previous declaration here [ImplInTwoMatchFirstNote] + // CHECK:STDERR: ╭─┤ fail_redecl_defined_in_different_block_firset.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ impl () as Z {} + // CHECK:STDERR: · ───────┬────── + // CHECK:STDERR: · ╰──┤ previous declaration here [ImplInTwoMatchFirstNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ impl () as Z; + // CHECK:STDERR: · ━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: impl declared in `match_first` more than once + // CHECK:STDERR: · ┃ [ImplInTwoMatchFirst] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as Z; } @@ -349,8 +461,16 @@ match_first { impl () as Z; } match_first { - // CHECK:STDERR: fail_redecl_defined_in_different_block_second.carbon:[[@LINE+3]]:3-16: error: impl declared in `match_first` more than once [ImplInTwoMatchFirst] - // CHECK:STDERR: fail_redecl_defined_in_different_block_second.carbon:[[@LINE-4]]:3-15: note: previous declaration here [ImplInTwoMatchFirstNote] + // CHECK:STDERR: ╭─┤ fail_redecl_defined_in_different_block_second.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ impl () as Z; + // CHECK:STDERR: · ──────┬────── + // CHECK:STDERR: · ╰──┤ previous declaration here [ImplInTwoMatchFirstNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ impl () as Z {} + // CHECK:STDERR: · ━━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: impl declared in `match_first` more than once + // CHECK:STDERR: · ┃ [ImplInTwoMatchFirst] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl () as Z {} } diff --git a/toolchain/check/testdata/match_first/prioritization.carbon b/toolchain/check/testdata/match_first/prioritization.carbon index 7ddc44702133..e177f4b98c17 100644 --- a/toolchain/check/testdata/match_first/prioritization.carbon +++ b/toolchain/check/testdata/match_first/prioritization.carbon @@ -34,8 +34,18 @@ interface Y {} interface X {} impl forall [T: Y] T as Z where .Z1 = {.y: type} {} -// CHECK:STDERR: fail_overlap_not_allowed_in_different_match_first.carbon:[[@LINE+3]]:1-50: error: found non-final `impl` with the same type structure as another non-final `impl` [ImplNonFinalSameTypeStructure] -// CHECK:STDERR: fail_overlap_not_allowed_in_different_match_first.carbon:[[@LINE-2]]:1-50: note: other `impl` here [ImplNonFinalSameTypeStructureNote] +// CHECK:STDERR: ╭─┤ fail_overlap_not_allowed_in_different_match_first.carbon:[[@LINE+13]]:1 +// CHECK:STDERR: │ impl forall [T: Y] T as Z where .Z1 = {.y: type} {} +// CHECK:STDERR: · ─────────────────────────┬──────────────────────── +// CHECK:STDERR: · ╰──┤ other `impl` here +// CHECK:STDERR: · │ [ImplNonFinalSameTypeStructureNote] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ impl forall [T: X] T as Z where .Z1 = {.x: type} {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: found non-final `impl` with the same type structure as another +// CHECK:STDERR: · ┃ non-final `impl` +// CHECK:STDERR: · ┃ [ImplNonFinalSameTypeStructure] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [T: X] T as Z where .Z1 = {.x: type} {} @@ -150,7 +160,12 @@ fn F() { impl C as X {} // Since C impls X and Y, the first one in the match_first block // should be selected, which is the .y impl. So this should fail. - // CHECK:STDERR: fail_prioritization_does_not_choose_second_declarared.carbon:[[@LINE+2]]:3-13: error: struct `{.y: type}` has no field named `x` [StructInitUnexpectedFieldInLiteral] + // CHECK:STDERR: ╭─┤ fail_prioritization_does_not_choose_second_declarared.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ {.x = type} as C.(Z.Z1); + // CHECK:STDERR: · ━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: struct `{.y: type}` has no field named `x` + // CHECK:STDERR: · ┃ [StructInitUnexpectedFieldInLiteral] + // CHECK:STDERR: ╰──── // CHECK:STDERR: {.x = type} as C.(Z.Z1); } @@ -178,7 +193,12 @@ fn F() { impl C as X {} // Since C impls X and Y, the first one in the match_first block // should be selected, which is the .x impl. So this should fail. - // CHECK:STDERR: fail_prioritization_does_not_choose_first_declarared.carbon:[[@LINE+2]]:3-13: error: struct `{.x: type}` has no field named `y` [StructInitUnexpectedFieldInLiteral] + // CHECK:STDERR: ╭─┤ fail_prioritization_does_not_choose_first_declarared.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ {.y = type} as C.(Z.Z1); + // CHECK:STDERR: · ━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: struct `{.x: type}` has no field named `y` + // CHECK:STDERR: · ┃ [StructInitUnexpectedFieldInLiteral] + // CHECK:STDERR: ╰──── // CHECK:STDERR: {.y = type} as C.(Z.Z1); } @@ -249,7 +269,12 @@ match_first { fn F[U: type where .Self impls X and .Self impls Y]() { // The impls are not final, so we can't use the concrete `.Z1` value provided // by the impls here. This conversion should fail. - // CHECK:STDERR: fail_match_first_does_not_imply_final.carbon:[[@LINE+2]]:3-25: error: `Core.As` implicitly referenced here, but package `Core` not found [CoreNotFound] + // CHECK:STDERR: ╭─┤ fail_match_first_does_not_imply_final.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ {.y = type} as U.(Z.Z1); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: `Core.As` implicitly referenced here, but package `Core` not found + // CHECK:STDERR: · ┃ [CoreNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: {.y = type} as U.(Z.Z1); } @@ -363,7 +388,12 @@ match_first { fn F(generic T: Y) { // This query is not concrete, so the impl will not give a final witness, so // we can't use the rewrite constraint's RHS here. - // CHECK:STDERR: fail_non_final_match_first_is_not_final.carbon:[[@LINE+2]]:3-32: error: `Core.As` implicitly referenced here, but package `Core` not found [CoreNotFound] + // CHECK:STDERR: ╭─┤ fail_non_final_match_first_is_not_final.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ {.y = type} as ().(Z(C(T)).Z1); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: `Core.As` implicitly referenced here, but package `Core` not found + // CHECK:STDERR: · ┃ [CoreNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: {.y = type} as ().(Z(C(T)).Z1); } @@ -425,7 +455,12 @@ final match_first { fn F(generic T: type) { // Could match C(T) later, but doesn't yet. So it's not considered final. - // CHECK:STDERR: fail_final_overlapping_query_in_match_first.carbon:[[@LINE+2]]:3-29: error: `Core.As` implicitly referenced here, but package `Core` not found [CoreNotFound] + // CHECK:STDERR: ╭─┤ fail_final_overlapping_query_in_match_first.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ {.t = type} as ().(Z(T).Z1); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: `Core.As` implicitly referenced here, but package `Core` not found + // CHECK:STDERR: · ┃ [CoreNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: {.t = type} as ().(Z(T).Z1); } @@ -452,7 +487,12 @@ final match_first { fn F(generic T: type) { // Could match C(T) later, but doesn't yet. So it's not considered final. - // CHECK:STDERR: fail_final_overlapping_query_in_match_first_reverse_order.carbon:[[@LINE+2]]:3-29: error: `Core.As` implicitly referenced here, but package `Core` not found [CoreNotFound] + // CHECK:STDERR: ╭─┤ fail_final_overlapping_query_in_match_first_reverse_order.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ {.t = type} as ().(Z(T).Z1); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: `Core.As` implicitly referenced here, but package `Core` not found + // CHECK:STDERR: · ┃ [CoreNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: {.t = type} as ().(Z(T).Z1); } diff --git a/toolchain/check/testdata/named_constraint/basic.carbon b/toolchain/check/testdata/named_constraint/basic.carbon index cb60d1cb06ac..d2e8e84338e3 100644 --- a/toolchain/check/testdata/named_constraint/basic.carbon +++ b/toolchain/check/testdata/named_constraint/basic.carbon @@ -29,8 +29,17 @@ library "[[@TEST_NAME]]"; class ForwardDeclared; -// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE+3]]:12-26: error: duplicate name `ForwardDeclared` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: fail_name_conflict.carbon:[[@LINE-3]]:1-22: note: name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╭─┤ fail_name_conflict.carbon:[[@LINE+12]]:12 +// CHECK:STDERR: │ class ForwardDeclared; +// CHECK:STDERR: · ───────────┬────────── +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ constraint ForwardDeclared {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `ForwardDeclared` being declared in the +// CHECK:STDERR: · ┃ same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ╰──── // CHECK:STDERR: constraint ForwardDeclared {} @@ -39,8 +48,15 @@ library "[[@TEST_NAME]]"; constraint Declared {} -// CHECK:STDERR: fail_defined_twice.carbon:[[@LINE+3]]:1-21: error: redefinition of `constraint Declared` [RedeclRedef] -// CHECK:STDERR: fail_defined_twice.carbon:[[@LINE-3]]:1-21: note: previously defined here [RedeclPrevDef] +// CHECK:STDERR: ╭─┤ fail_defined_twice.carbon:[[@LINE+10]]:1 +// CHECK:STDERR: │ constraint Declared {} +// CHECK:STDERR: · ──────────┬────────── +// CHECK:STDERR: · ╰──┤ previously defined here [RedeclPrevDef] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ constraint Declared {} +// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redefinition of `constraint Declared` [RedeclRedef] +// CHECK:STDERR: ╰──── // CHECK:STDERR: constraint Declared {} diff --git a/toolchain/check/testdata/named_constraint/extend_name_lookup.carbon b/toolchain/check/testdata/named_constraint/extend_name_lookup.carbon index 3e998e9c9df4..59ad8891e5dd 100644 --- a/toolchain/check/testdata/named_constraint/extend_name_lookup.carbon +++ b/toolchain/check/testdata/named_constraint/extend_name_lookup.carbon @@ -42,7 +42,12 @@ constraint W { fn F(generic T: W) { // Does not extend Z. interface Y { fn YF(); } - // CHECK:STDERR: fail_name_lookup_in_constraint_does_not_extend.carbon:[[@LINE+2]]:3-6: error: member name `ZF` not found in `W` [MemberNameNotFoundInSpecificScope] + // CHECK:STDERR: ╭─┤ fail_name_lookup_in_constraint_does_not_extend.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ T.ZF(); + // CHECK:STDERR: · ━━┳━ + // CHECK:STDERR: · ┗━━┫ error: member name `ZF` not found in `W` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInSpecificScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: T.ZF(); } @@ -80,11 +85,19 @@ constraint W { fn F(generic T: type where .Self impls W) { // T does not extend Z. - // CHECK:STDERR: fail_name_lookup_in_facet_type_does_not_extend.carbon:[[@LINE+2]]:3-6: error: member name `ZF` not found [MemberNameNotFound] + // CHECK:STDERR: ╭─┤ fail_name_lookup_in_facet_type_does_not_extend.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ T.ZF(); + // CHECK:STDERR: · ━━┳━ + // CHECK:STDERR: · ┗━━┫ error: member name `ZF` not found [MemberNameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: T.ZF(); // T does not extend Y. - // CHECK:STDERR: fail_name_lookup_in_facet_type_does_not_extend.carbon:[[@LINE+2]]:3-6: error: member name `YF` not found [MemberNameNotFound] + // CHECK:STDERR: ╭─┤ fail_name_lookup_in_facet_type_does_not_extend.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ T.YF(); + // CHECK:STDERR: · ━━┳━ + // CHECK:STDERR: · ┗━━┫ error: member name `YF` not found [MemberNameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: T.YF(); } diff --git a/toolchain/check/testdata/named_constraint/generic.carbon b/toolchain/check/testdata/named_constraint/generic.carbon index 0e2c88b95d77..fded4ea00827 100644 --- a/toolchain/check/testdata/named_constraint/generic.carbon +++ b/toolchain/check/testdata/named_constraint/generic.carbon @@ -26,8 +26,21 @@ constraint ForwardDeclaredGeneric(T: type) {} library "[[@TEST_NAME]]"; constraint ForwardDeclaredGeneric(T: ()); -// CHECK:STDERR: fail_mismatched_generic_param_types.carbon:[[@LINE+3]]:35-41: error: type `` of parameter 1 in redeclaration differs from previous parameter type `` [RedeclParamDiffersType] -// CHECK:STDERR: fail_mismatched_generic_param_types.carbon:[[@LINE-2]]:35-39: note: previous declaration's corresponding parameter here [RedeclParamPrevious] +// CHECK:STDERR: ╭─┤ fail_mismatched_generic_param_types.carbon:[[@LINE+16]]:35 +// CHECK:STDERR: │ constraint ForwardDeclaredGeneric(T: ()); +// CHECK:STDERR: · ┬──── +// CHECK:STDERR: · ╰──┤ previous declaration's corresponding +// CHECK:STDERR: · │ parameter here +// CHECK:STDERR: · │ [RedeclParamPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ constraint ForwardDeclaredGeneric(T: type) {} +// CHECK:STDERR: · ┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: type `` of +// CHECK:STDERR: · ┃ parameter 1 in redeclaration +// CHECK:STDERR: · ┃ differs from previous parameter +// CHECK:STDERR: · ┃ type `` +// CHECK:STDERR: · ┃ [RedeclParamDiffersType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: constraint ForwardDeclaredGeneric(T: type) {} @@ -35,8 +48,17 @@ constraint ForwardDeclaredGeneric(T: type) {} library "[[@TEST_NAME]]"; constraint ForwardDeclaredGeneric(T: type, U: type); -// CHECK:STDERR: fail_mismatched_generic_param_arity.carbon:[[@LINE+3]]:1-44: error: redeclaration differs because of parameter count of 1 [RedeclParamCountDiffers] -// CHECK:STDERR: fail_mismatched_generic_param_arity.carbon:[[@LINE-2]]:1-52: note: previously declared with parameter count of 2 [RedeclParamCountPrevious] +// CHECK:STDERR: ╭─┤ fail_mismatched_generic_param_arity.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: │ constraint ForwardDeclaredGeneric(T: type, U: type); +// CHECK:STDERR: · ──────────────────────────┬───────────────────────── +// CHECK:STDERR: · ╰──┤ previously declared with parameter count of 2 +// CHECK:STDERR: · │ [RedeclParamCountPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ constraint ForwardDeclaredGeneric(T: type) {} +// CHECK:STDERR: · ━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration differs because of parameter count of 1 +// CHECK:STDERR: · ┃ [RedeclParamCountDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: constraint ForwardDeclaredGeneric(T: type) {} @@ -44,8 +66,15 @@ constraint ForwardDeclaredGeneric(T: type) {} library "[[@TEST_NAME]]"; constraint Generic(T: type) {} -// CHECK:STDERR: fail_inside_definition.carbon:[[@LINE+3]]:1-29: error: redefinition of `constraint Generic` [RedeclRedef] -// CHECK:STDERR: fail_inside_definition.carbon:[[@LINE-2]]:1-29: note: previously defined here [RedeclPrevDef] +// CHECK:STDERR: ╭─┤ fail_inside_definition.carbon:[[@LINE+10]]:1 +// CHECK:STDERR: │ constraint Generic(T: type) {} +// CHECK:STDERR: · ──────────────┬────────────── +// CHECK:STDERR: · ╰──┤ previously defined here [RedeclPrevDef] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ constraint Generic(T: type) {} +// CHECK:STDERR: · ━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redefinition of `constraint Generic` [RedeclRedef] +// CHECK:STDERR: ╰──── // CHECK:STDERR: constraint Generic(T: type) {} @@ -54,8 +83,17 @@ library "[[@TEST_NAME]]"; constraint Generic(T: type) {} -// CHECK:STDERR: fail_args_count_mismatch.carbon:[[@LINE+3]]:24-38: error: 2 arguments passed to generic constraint expecting 1 argument [CallArgCountMismatch] -// CHECK:STDERR: fail_args_count_mismatch.carbon:[[@LINE-3]]:1-29: note: calling generic constraint declared here [InCallToEntity] +// CHECK:STDERR: ╭─┤ fail_args_count_mismatch.carbon:[[@LINE+12]]:24 +// CHECK:STDERR: │ constraint Generic(T: type) {} +// CHECK:STDERR: · ──────────────┬────────────── +// CHECK:STDERR: · ╰──┤ calling generic constraint declared here [InCallToEntity] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn F(unused generic T: Generic((), ())) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: 2 arguments passed to generic constraint +// CHECK:STDERR: · ┃ expecting 1 argument +// CHECK:STDERR: · ┃ [CallArgCountMismatch] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused generic T: Generic((), ())) {} diff --git a/toolchain/check/testdata/named_constraint/import_constraint_decl.carbon b/toolchain/check/testdata/named_constraint/import_constraint_decl.carbon index 4f668208e190..34bef1746541 100644 --- a/toolchain/check/testdata/named_constraint/import_constraint_decl.carbon +++ b/toolchain/check/testdata/named_constraint/import_constraint_decl.carbon @@ -39,9 +39,19 @@ library "[[@TEST_NAME]]"; import library "a"; class C {} -// CHECK:STDERR: fail_import_not_identified.carbon:[[@LINE+4]]:1-12: error: facet type `A` cannot be identified in `impl as` [ImplOfUnidentifiedFacetType] -// CHECK:STDERR: imported from: fail_import_not_identified.carbon:[[@LINE-4]]:1 [InImport] -// CHECK:STDERR: a.carbon:3:1-13: note: constraint was forward declared here [NamedConstraintForwardDeclaredHere] +// CHECK:STDERR: ╭─┤ fail_import_not_identified.carbon:[[@LINE+14]]:1 +// CHECK:STDERR: -> │ impl C as A; +// CHECK:STDERR: · ━━━━━━┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: facet type `A` cannot be identified in `impl as` +// CHECK:STDERR: · ┃ [ImplOfUnidentifiedFacetType] +// CHECK:STDERR: ┆ +// CHECK:STDERR: │ ╭── imported from: fail_import_not_identified.carbon [InImport] +// CHECK:STDERR: ├─┤ a.carbon +// CHECK:STDERR: │ constraint A; +// CHECK:STDERR: · ──────┬────── +// CHECK:STDERR: · ╰──┤ constraint was forward declared here +// CHECK:STDERR: · │ [NamedConstraintForwardDeclaredHere] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl C as A; diff --git a/toolchain/check/testdata/named_constraint/incomplete.carbon b/toolchain/check/testdata/named_constraint/incomplete.carbon index 62fe47fb0a75..d494cf4b6563 100644 --- a/toolchain/check/testdata/named_constraint/incomplete.carbon +++ b/toolchain/check/testdata/named_constraint/incomplete.carbon @@ -19,7 +19,13 @@ interface Z {} // not able to provide any witness for an impl lookup on that facet. constraint N; fn F(generic T: N) { - // CHECK:STDERR: fail_incomplete_constraint_in_impl_lookup.carbon:[[@LINE+2]]:3-8: error: cannot convert type `T` that implements `N` into type implementing `Z` [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╭─┤ fail_incomplete_constraint_in_impl_lookup.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ T as Z; + // CHECK:STDERR: · ┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `T` that implements `N` into type implementing + // CHECK:STDERR: · ┃ `Z` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: T as Z; } @@ -38,7 +44,12 @@ impl forall [T: N] T as Z {} class C; fn F() { - // CHECK:STDERR: fail_does_not_diagnose_identify_failure_in_deduce.carbon:[[@LINE+2]]:3-8: error: cannot convert type `C` into type implementing `Z` [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╭─┤ fail_does_not_diagnose_identify_failure_in_deduce.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ C as Z; + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `C` into type implementing `Z` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: C as Z; } @@ -72,9 +83,22 @@ fn AsZ(unused generic T: Z) {} fn F() { // Converting to facet type `Z` requires `Z` to be identified. - // CHECK:STDERR: fail_impl_lookup_target_not_identified.carbon:[[@LINE+4]]:3-9: error: facet type `Z` can not be identified [ImplLookupInUnidentifiedFacetType] - // CHECK:STDERR: fail_impl_lookup_target_not_identified.carbon:[[@LINE-7]]:1-13: note: constraint was forward declared here [NamedConstraintForwardDeclaredHere] - // CHECK:STDERR: fail_impl_lookup_target_not_identified.carbon:[[@LINE-6]]:23-26: note: initializing generic parameter `T` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_impl_lookup_target_not_identified.carbon:[[@LINE+17]]:3 + // CHECK:STDERR: │ constraint Z; + // CHECK:STDERR: · ──────┬────── + // CHECK:STDERR: · ╰──┤ constraint was forward declared here + // CHECK:STDERR: · │ [NamedConstraintForwardDeclaredHere] + // CHECK:STDERR: │ + // CHECK:STDERR: │ fn AsZ(unused generic T: Z) {} + // CHECK:STDERR: · ──┬─ + // CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ AsZ(()); + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: facet type `Z` can not be identified + // CHECK:STDERR: · ┃ [ImplLookupInUnidentifiedFacetType] + // CHECK:STDERR: ╰──── // CHECK:STDERR: AsZ(()); } @@ -97,12 +121,34 @@ interface Z {} interface X { let XZ: Z; } constraint W { require impls Z; - // CHECK:STDERR: fail_incomplete_self.carbon:[[@LINE+7]]:31-47: error: function returns incomplete type `W` [IncompleteTypeInFunctionReturnType] - // CHECK:STDERR: fail_incomplete_self.carbon:[[@LINE-3]]:1-14: note: constraint is currently being defined [NamedConstraintIncompleteWithinDefinition] - // CHECK:STDERR: fail_incomplete_self.carbon:[[@LINE-11]]:44-47: note: return type declared here [IncompleteReturnTypeHere] + // CHECK:STDERR: ╭─┤ fail_incomplete_self.carbon:[[@LINE+29]]:31 + // CHECK:STDERR: │ eval fn ReturnFacet[T: type](generic U: T) -> T; + // CHECK:STDERR: · ──┬─ + // CHECK:STDERR: · ╰──┤ return type declared here + // CHECK:STDERR: · │ [IncompleteReturnTypeHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ constraint W { + // CHECK:STDERR: · ───────┬────── + // CHECK:STDERR: · ╰──┤ constraint is currently being defined + // CHECK:STDERR: · │ [NamedConstraintIncompleteWithinDefinition] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ require impls X where .XZ = ReturnFacet(Self); + // CHECK:STDERR: · ━━┳━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: function returns incomplete type `W` + // CHECK:STDERR: · ┃ [IncompleteTypeInFunctionReturnType] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_incomplete_self.carbon:[[@LINE+3]]:31-41: error: use of undefined generic function [MissingGenericFunctionDefinition] - // CHECK:STDERR: fail_incomplete_self.carbon:[[@LINE-14]]:1-48: note: generic function declared here [MissingGenericFunctionDefinitionHere] + // CHECK:STDERR: ╭─┤ fail_incomplete_self.carbon:[[@LINE+12]]:31 + // CHECK:STDERR: │ eval fn ReturnFacet[T: type](generic U: T) -> T; + // CHECK:STDERR: · ────────────────────────┬─────────────────────── + // CHECK:STDERR: · ╰──┤ generic function declared here + // CHECK:STDERR: · │ [MissingGenericFunctionDefinitionHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ require impls X where .XZ = ReturnFacet(Self); + // CHECK:STDERR: · ━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: use of undefined generic function + // CHECK:STDERR: · ┃ [MissingGenericFunctionDefinition] + // CHECK:STDERR: ╰──── // CHECK:STDERR: require impls X where .XZ = ReturnFacet(Self); } diff --git a/toolchain/check/testdata/named_constraint/invalid_members.carbon b/toolchain/check/testdata/named_constraint/invalid_members.carbon index 7a94adbce848..2cafc485517a 100644 --- a/toolchain/check/testdata/named_constraint/invalid_members.carbon +++ b/toolchain/check/testdata/named_constraint/invalid_members.carbon @@ -36,9 +36,18 @@ constraint E { // --- fail_todo_invalid_var_template.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_todo_invalid_var_template.carbon:[[@LINE+4]]:1-8: error: unrecognized declaration introducer [UnrecognizedDecl] +// CHECK:STDERR: ╭─┤ fail_todo_invalid_var_template.carbon:[[@LINE+13]]:1 +// CHECK:STDERR: -> │ template constraint E { +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: unrecognized declaration introducer [UnrecognizedDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_todo_invalid_var_template.carbon:[[@LINE+2]]:1-8: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_todo_invalid_var_template.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ template constraint E { +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `handle invalid parse trees in `check`` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: template constraint E { // TODO: Any var in a constraint is an error. @@ -56,9 +65,18 @@ constraint E { // --- fail_todo_invalid_let_template.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_todo_invalid_let_template.carbon:[[@LINE+4]]:1-8: error: unrecognized declaration introducer [UnrecognizedDecl] +// CHECK:STDERR: ╭─┤ fail_todo_invalid_let_template.carbon:[[@LINE+13]]:1 +// CHECK:STDERR: -> │ template constraint E { +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: unrecognized declaration introducer [UnrecognizedDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_todo_invalid_let_template.carbon:[[@LINE+2]]:1-8: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_todo_invalid_let_template.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ template constraint E { +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `handle invalid parse trees in `check`` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: template constraint E { // TODO: Any let in a constraint is an error. diff --git a/toolchain/check/testdata/named_constraint/require.carbon b/toolchain/check/testdata/named_constraint/require.carbon index 362367384b9c..4cf1953ec488 100644 --- a/toolchain/check/testdata/named_constraint/require.carbon +++ b/toolchain/check/testdata/named_constraint/require.carbon @@ -102,7 +102,12 @@ constraint Z { fn F(generic T: Z) { // This should fail name lookup since Z does not extend Y. // - // CHECK:STDERR: fail_implicit_self_no_extend_name_lookup_fails.carbon:[[@LINE+2]]:3-6: error: member name `YY` not found in `Z` [MemberNameNotFoundInSpecificScope] + // CHECK:STDERR: ╭─┤ fail_implicit_self_no_extend_name_lookup_fails.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ T.YY(); + // CHECK:STDERR: · ━━┳━ + // CHECK:STDERR: · ┗━━┫ error: member name `YY` not found in `Z` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInSpecificScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: T.YY(); } @@ -121,7 +126,12 @@ constraint Z { fn F(generic T: Z) { // This should fail name lookup since Z does not extend Y. // - // CHECK:STDERR: fail_explicit_self_no_extend_name_lookup_fails.carbon:[[@LINE+2]]:3-6: error: member name `YY` not found in `Z` [MemberNameNotFoundInSpecificScope] + // CHECK:STDERR: ╭─┤ fail_explicit_self_no_extend_name_lookup_fails.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ T.YY(); + // CHECK:STDERR: · ━━┳━ + // CHECK:STDERR: · ┗━━┫ error: member name `YY` not found in `Z` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInSpecificScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: T.YY(); } @@ -157,8 +167,18 @@ constraint Y; //@dump-sem-ir-begin constraint Z { - // CHECK:STDERR: fail_require_impls_incomplete_constraint.carbon:[[@LINE+3]]:17: error: facet type `Y` cannot be identified in `require` declaration [RequireImplsUnidentifiedFacetType] - // CHECK:STDERR: fail_require_impls_incomplete_constraint.carbon:[[@LINE-5]]:1-13: note: constraint was forward declared here [NamedConstraintForwardDeclaredHere] + // CHECK:STDERR: ╭─┤ fail_require_impls_incomplete_constraint.carbon:[[@LINE+13]]:17 + // CHECK:STDERR: │ constraint Y; + // CHECK:STDERR: · ──────┬────── + // CHECK:STDERR: · ╰──┤ constraint was forward declared here + // CHECK:STDERR: · │ [NamedConstraintForwardDeclaredHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ require impls Y; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: facet type `Y` cannot be identified in `require` + // CHECK:STDERR: · ┃ declaration + // CHECK:STDERR: · ┃ [RequireImplsUnidentifiedFacetType] + // CHECK:STDERR: ╰──── // CHECK:STDERR: require impls Y; } @@ -168,7 +188,13 @@ constraint Z { library "[[@TEST_NAME]]"; constraint Z { - // CHECK:STDERR: fail_require_impls_incomplete_self.carbon:[[@LINE+2]]:17: error: facet type in `require` declaration refers to the named constraint `Z` from within its definition [RequireImplsReferenceCycle] + // CHECK:STDERR: ╭─┤ fail_require_impls_incomplete_self.carbon:[[@LINE+8]]:17 + // CHECK:STDERR: -> │ require impls Z; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: facet type in `require` declaration refers to the + // CHECK:STDERR: · ┃ named constraint `Z` from within its definition + // CHECK:STDERR: · ┃ [RequireImplsReferenceCycle] + // CHECK:STDERR: ╰──── // CHECK:STDERR: require impls Z; } @@ -180,7 +206,13 @@ constraint Z; alias Y = Z; constraint Z { - // CHECK:STDERR: fail_require_impls_incomplete_self_through_alias.carbon:[[@LINE+2]]:17: error: facet type in `require` declaration refers to the named constraint `Z` from within its definition [RequireImplsReferenceCycle] + // CHECK:STDERR: ╭─┤ fail_require_impls_incomplete_self_through_alias.carbon:[[@LINE+8]]:17 + // CHECK:STDERR: -> │ require impls Y; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: facet type in `require` declaration refers to the + // CHECK:STDERR: · ┃ named constraint `Z` from within its definition + // CHECK:STDERR: · ┃ [RequireImplsReferenceCycle] + // CHECK:STDERR: ╰──── // CHECK:STDERR: require impls Y; } @@ -191,7 +223,13 @@ library "[[@TEST_NAME]]"; constraint Z; constraint Z { - // CHECK:STDERR: fail_require_impls_incomplete_self_forward_declared.carbon:[[@LINE+2]]:17: error: facet type in `require` declaration refers to the named constraint `Z` from within its definition [RequireImplsReferenceCycle] + // CHECK:STDERR: ╭─┤ fail_require_impls_incomplete_self_forward_declared.carbon:[[@LINE+8]]:17 + // CHECK:STDERR: -> │ require impls Z; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: facet type in `require` declaration refers to the + // CHECK:STDERR: · ┃ named constraint `Z` from within its definition + // CHECK:STDERR: · ┃ [RequireImplsReferenceCycle] + // CHECK:STDERR: ╰──── // CHECK:STDERR: require impls Z; } @@ -200,7 +238,13 @@ constraint Z { library "[[@TEST_NAME]]"; constraint Z { - // CHECK:STDERR: fail_require_impls_incomplete_self_in_period_self_impls.carbon:[[@LINE+2]]:17-40: error: facet type in `require` declaration refers to the named constraint `Z` from within its definition [RequireImplsReferenceCycle] + // CHECK:STDERR: ╭─┤ fail_require_impls_incomplete_self_in_period_self_impls.carbon:[[@LINE+8]]:17 + // CHECK:STDERR: -> │ require impls type where .Self impls Z; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: facet type in `require` declaration refers to the + // CHECK:STDERR: · ┃ named constraint `Z` from within its definition + // CHECK:STDERR: · ┃ [RequireImplsReferenceCycle] + // CHECK:STDERR: ╰──── // CHECK:STDERR: require impls type where .Self impls Z; } @@ -210,7 +254,13 @@ library "[[@TEST_NAME]]"; class C(T: type); constraint Z { - // CHECK:STDERR: fail_require_impls_incomplete_self_in_class_impls.carbon:[[@LINE+2]]:17-43: error: facet type in `require` declaration refers to the named constraint `Z` from within its definition [RequireImplsReferenceCycle] + // CHECK:STDERR: ╭─┤ fail_require_impls_incomplete_self_in_class_impls.carbon:[[@LINE+8]]:17 + // CHECK:STDERR: -> │ require impls type where C(.Self) impls Z; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: facet type in `require` declaration refers to the + // CHECK:STDERR: · ┃ named constraint `Z` from within its definition + // CHECK:STDERR: · ┃ [RequireImplsReferenceCycle] + // CHECK:STDERR: ╰──── // CHECK:STDERR: require impls type where C(.Self) impls Z; } @@ -221,8 +271,18 @@ library "[[@TEST_NAME]]"; constraint Z; constraint Y { - // CHECK:STDERR: fail_require_impls_incomplete_indirect.carbon:[[@LINE+3]]:17: error: facet type `Z` cannot be identified in `require` declaration [RequireImplsUnidentifiedFacetType] - // CHECK:STDERR: fail_require_impls_incomplete_indirect.carbon:[[@LINE-4]]:1-13: note: constraint was forward declared here [NamedConstraintForwardDeclaredHere] + // CHECK:STDERR: ╭─┤ fail_require_impls_incomplete_indirect.carbon:[[@LINE+13]]:17 + // CHECK:STDERR: │ constraint Z; + // CHECK:STDERR: · ──────┬────── + // CHECK:STDERR: · ╰──┤ constraint was forward declared here + // CHECK:STDERR: · │ [NamedConstraintForwardDeclaredHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ require impls Z; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: facet type `Z` cannot be identified in `require` + // CHECK:STDERR: · ┃ declaration + // CHECK:STDERR: · ┃ [RequireImplsUnidentifiedFacetType] + // CHECK:STDERR: ╰──── // CHECK:STDERR: require impls Z; } @@ -235,7 +295,13 @@ constraint Z { library "[[@TEST_NAME]]"; constraint Z(T: type) { - // CHECK:STDERR: fail_require_impls_incomplete_self_specific.carbon:[[@LINE+2]]:19-25: error: facet type in `require` declaration refers to the named constraint `Z` from within its definition [RequireImplsReferenceCycle] + // CHECK:STDERR: ╭─┤ fail_require_impls_incomplete_self_specific.carbon:[[@LINE+8]]:19 + // CHECK:STDERR: -> │ require T impls Z(Self); + // CHECK:STDERR: · ┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: facet type in `require` declaration refers to the + // CHECK:STDERR: · ┃ named constraint `Z` from within its definition + // CHECK:STDERR: · ┃ [RequireImplsReferenceCycle] + // CHECK:STDERR: ╰──── // CHECK:STDERR: require T impls Z(Self); } @@ -253,7 +319,14 @@ constraint Z(T: type) { // it would appear in the type structure used for impl lookup (so inside a // `where` does not count). But they don't. // - // CHECK:STDERR: fail_require_impls_without_self.carbon:[[@LINE+2]]:3-37: error: no `Self` reference found in `require` declaration; `Self` must appear in the self-type or as a generic argument for each required interface, but found interface `Y` without a `Self` argument [RequireImplsMissingSelf] + // CHECK:STDERR: ╭─┤ fail_require_impls_without_self.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ require T impls Y where .Y1 = Self; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no `Self` reference found in `require` declaration; `Self` must + // CHECK:STDERR: · ┃ appear in the self-type or as a generic argument for each required + // CHECK:STDERR: · ┃ interface, but found interface `Y` without a `Self` argument + // CHECK:STDERR: · ┃ [RequireImplsMissingSelf] + // CHECK:STDERR: ╰──── // CHECK:STDERR: require T impls Y where .Y1 = Self; } @@ -267,7 +340,14 @@ interface Y(T: type) {} constraint Z(T: type) { // Self is in one interface but not the other. // - // CHECK:STDERR: fail_require_impls_without_self_in_one_interface.carbon:[[@LINE+2]]:3-34: error: no `Self` reference found in `require` declaration; `Self` must appear in the self-type or as a generic argument for each required interface, but found interface `Y({})` without a `Self` argument [RequireImplsMissingSelf] + // CHECK:STDERR: ╭─┤ fail_require_impls_without_self_in_one_interface.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ require T impls Y(Self) & Y({}); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no `Self` reference found in `require` declaration; `Self` must + // CHECK:STDERR: · ┃ appear in the self-type or as a generic argument for each required + // CHECK:STDERR: · ┃ interface, but found interface `Y({})` without a `Self` argument + // CHECK:STDERR: · ┃ [RequireImplsMissingSelf] + // CHECK:STDERR: ╰──── // CHECK:STDERR: require T impls Y(Self) & Y({}); } @@ -280,9 +360,23 @@ interface Y(T: type) {} constraint Z(T: type) { // Self does not appear in either interface, we should get an error for each. // - // CHECK:STDERR: fail_require_impls_without_self_in_multiple_interfaces.carbon:[[@LINE+4]]:3-32: error: no `Self` reference found in `require` declaration; `Self` must appear in the self-type or as a generic argument for each required interface, but found interface `Y(())` without a `Self` argument [RequireImplsMissingSelf] + // CHECK:STDERR: ╭─┤ fail_require_impls_without_self_in_multiple_interfaces.carbon:[[@LINE+18]]:3 + // CHECK:STDERR: -> │ require T impls Y(()) & Y({}); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no `Self` reference found in `require` declaration; `Self` must + // CHECK:STDERR: · ┃ appear in the self-type or as a generic argument for each required + // CHECK:STDERR: · ┃ interface, but found interface `Y(())` without a `Self` argument + // CHECK:STDERR: · ┃ [RequireImplsMissingSelf] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_require_impls_without_self_in_multiple_interfaces.carbon:[[@LINE+2]]:3-32: error: no `Self` reference found in `require` declaration; `Self` must appear in the self-type or as a generic argument for each required interface, but found interface `Y({})` without a `Self` argument [RequireImplsMissingSelf] + // CHECK:STDERR: ╭─┤ fail_require_impls_without_self_in_multiple_interfaces.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ require T impls Y(()) & Y({}); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no `Self` reference found in `require` declaration; `Self` must + // CHECK:STDERR: · ┃ appear in the self-type or as a generic argument for each required + // CHECK:STDERR: · ┃ interface, but found interface `Y({})` without a `Self` argument + // CHECK:STDERR: · ┃ [RequireImplsMissingSelf] + // CHECK:STDERR: ╰──── // CHECK:STDERR: require T impls Y(()) & Y({}); } @@ -291,7 +385,14 @@ constraint Z(T: type) { library "[[@TEST_NAME]]"; constraint Z(T: type) { - // CHECK:STDERR: fail_self_impls_self.carbon:[[@LINE+2]]:17-20: error: `require` declaration constrained by a non-facet type; expected an `interface` or `constraint` name after `impls` [RequireImplsMissingFacetType] + // CHECK:STDERR: ╭─┤ fail_self_impls_self.carbon:[[@LINE+9]]:17 + // CHECK:STDERR: -> │ require impls Self; + // CHECK:STDERR: · ┳━━━ + // CHECK:STDERR: · ┗━━┫ error: `require` declaration constrained by a non-facet + // CHECK:STDERR: · ┃ type; expected an `interface` or `constraint` name + // CHECK:STDERR: · ┃ after `impls` + // CHECK:STDERR: · ┃ [RequireImplsMissingFacetType] + // CHECK:STDERR: ╰──── // CHECK:STDERR: require impls Self; } @@ -302,7 +403,14 @@ library "[[@TEST_NAME]]"; class C(T: type) {} constraint Z(T: type) { - // CHECK:STDERR: fail_impls_type.carbon:[[@LINE+2]]:19-25: error: `require` declaration constrained by a non-facet type; expected an `interface` or `constraint` name after `impls` [RequireImplsMissingFacetType] + // CHECK:STDERR: ╭─┤ fail_impls_type.carbon:[[@LINE+9]]:19 + // CHECK:STDERR: -> │ require T impls C(Self); + // CHECK:STDERR: · ┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: `require` declaration constrained by a non-facet + // CHECK:STDERR: · ┃ type; expected an `interface` or `constraint` name + // CHECK:STDERR: · ┃ after `impls` + // CHECK:STDERR: · ┃ [RequireImplsMissingFacetType] + // CHECK:STDERR: ╰──── // CHECK:STDERR: require T impls C(Self); } @@ -313,8 +421,16 @@ library "[[@TEST_NAME]]"; interface Y {} constraint Z(T: type) { - // CHECK:STDERR: fail_non_type_impls.carbon:[[@LINE+3]]:11: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet] - // CHECK:STDERR: fail_non_type_impls.carbon:[[@LINE+2]]:11: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_non_type_impls.carbon:[[@LINE+11]]:11 + // CHECK:STDERR: -> │ require 1 impls Y; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert non-type value of type + // CHECK:STDERR: · │ ┃ `Core.IntLiteral` to `type` + // CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: · ╰────┤ type `Core.IntLiteral` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(type)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: require 1 impls Y; } @@ -325,7 +441,14 @@ library "[[@TEST_NAME]]"; interface Y {} constraint Z(T: type) { - // CHECK:STDERR: fail_impls_non_type.carbon:[[@LINE+2]]:17: error: `require` declaration constrained by a non-facet type; expected an `interface` or `constraint` name after `impls` [RequireImplsMissingFacetType] + // CHECK:STDERR: ╭─┤ fail_impls_non_type.carbon:[[@LINE+9]]:17 + // CHECK:STDERR: -> │ require impls 1; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: `require` declaration constrained by a non-facet + // CHECK:STDERR: · ┃ type; expected an `interface` or `constraint` name + // CHECK:STDERR: · ┃ after `impls` + // CHECK:STDERR: · ┃ [RequireImplsMissingFacetType] + // CHECK:STDERR: ╰──── // CHECK:STDERR: require impls 1; } @@ -374,7 +497,12 @@ fn F() { // N requires () impls Z(Self) which is Z(()) for this query, but it impls // Z({}). // - // CHECK:STDERR: fail_require_different_self.carbon:[[@LINE+2]]:3-9: error: cannot convert type `()` into type implementing `N` [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╭─┤ fail_require_different_self.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ () as N; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `()` into type implementing `N` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: () as N; } @@ -393,7 +521,12 @@ impl () as Z(()) {} fn F() { // N requires () impls Z({}) but it impls Z(()). // - // CHECK:STDERR: fail_require_different_parameter.carbon:[[@LINE+2]]:3-9: error: cannot convert type `()` into type implementing `N` [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╭─┤ fail_require_different_parameter.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ () as N; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `()` into type implementing `N` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: () as N; } @@ -445,7 +578,14 @@ constraint N { // `M(T)` does not make use of the `T`, which is assigned `Self`, so we end up // without any interface specific referencing the `Self` of `N`. // - // CHECK:STDERR: fail_require_different_type_impls_nested_constraint_without_reference_to_outer_self.carbon:[[@LINE+2]]:3-27: error: no `Self` reference found in `require` declaration; `Self` must appear in the self-type or as a generic argument for each required interface, but found interface `Z({})` without a `Self` argument [RequireImplsMissingSelf] + // CHECK:STDERR: ╭─┤ fail_require_different_type_impls_nested_constraint_without_reference_to_outer_self.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ require {} impls M(Self); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no `Self` reference found in `require` declaration; `Self` must + // CHECK:STDERR: · ┃ appear in the self-type or as a generic argument for each required + // CHECK:STDERR: · ┃ interface, but found interface `Z({})` without a `Self` argument + // CHECK:STDERR: · ┃ [RequireImplsMissingSelf] + // CHECK:STDERR: ╰──── // CHECK:STDERR: require {} impls M(Self); } @@ -459,7 +599,14 @@ constraint N { // `M(T)` does not make use of the `T`, which is assigned `Self`, so we end up // without any interface specific referencing the `Self` of `N`. // - // CHECK:STDERR: fail_require_different_type_impls_nested_constraint_empty.carbon:[[@LINE+2]]:3-27: error: no `Self` reference found in `require` declaration; `Self` must appear in the self-type or as a generic argument for each required interface, but no interfaces were found [RequireImplsMissingSelfEmptyFacetType] + // CHECK:STDERR: ╭─┤ fail_require_different_type_impls_nested_constraint_empty.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ require {} impls M(Self); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no `Self` reference found in `require` declaration; `Self` must + // CHECK:STDERR: · ┃ appear in the self-type or as a generic argument for each required + // CHECK:STDERR: · ┃ interface, but no interfaces were found + // CHECK:STDERR: · ┃ [RequireImplsMissingSelfEmptyFacetType] + // CHECK:STDERR: ╰──── // CHECK:STDERR: require {} impls M(Self); } @@ -479,7 +626,12 @@ fn F() { // N requires {} impls Z(Self) which is Z(()) for this query, but it impls // Z({}). // - // CHECK:STDERR: fail_require_different_type_impls_different_parameter.carbon:[[@LINE+2]]:3-9: error: cannot convert type `()` into type implementing `N` [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╭─┤ fail_require_different_type_impls_different_parameter.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ () as N; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `()` into type implementing `N` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: () as N; } @@ -535,7 +687,12 @@ constraint N { impl {} as Z(()) where .X = {} {} fn F() { - // CHECK:STDERR: fail_require_with_mismatching_rewrite_constraint.carbon:[[@LINE+2]]:3-9: error: cannot convert type `()` into type implementing `N` [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╭─┤ fail_require_with_mismatching_rewrite_constraint.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ () as N; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `()` into type implementing `N` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: () as N; } @@ -555,7 +712,12 @@ constraint N(T: type) { impl {} as Z(()) where .X = () {} fn F() { - // CHECK:STDERR: fail_require_with_mismatching_rewrite_constraint_period_self.carbon:[[@LINE+2]]:3-13: error: cannot convert type `()` into type implementing `N({})` [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╭─┤ fail_require_with_mismatching_rewrite_constraint_period_self.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ () as N({}); + // CHECK:STDERR: · ━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `()` into type implementing `N({})` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: () as N({}); } @@ -575,7 +737,13 @@ constraint N { fn F(generic _: N) {} fn G(generic T: Z) { - // CHECK:STDERR: fail_require_with_period_self_impls_not_satisfied.carbon:[[@LINE+2]]:3-8: error: cannot convert type `T` that implements `Z` into type implementing `N` [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╭─┤ fail_require_with_period_self_impls_not_satisfied.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ T as N; + // CHECK:STDERR: · ┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `T` that implements `Z` into type implementing + // CHECK:STDERR: · ┃ `N` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: T as N; } @@ -615,7 +783,13 @@ constraint N { fn F(generic _: N) {} fn G(generic T: Z) { - // CHECK:STDERR: fail_require_with_specific_period_self_not_satisfied.carbon:[[@LINE+2]]:3-8: error: cannot convert type `T` that implements `Z` into type implementing `N` [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╭─┤ fail_require_with_specific_period_self_not_satisfied.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ T as N; + // CHECK:STDERR: · ┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `T` that implements `Z` into type implementing + // CHECK:STDERR: · ┃ `N` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: T as N; } @@ -674,7 +848,14 @@ constraint N { // it is not `Self`. Since `Self` is not directly part of the type structure, // we don't accept this require decl. // - // CHECK:STDERR: fail_self_in_compound_member_access_is_not_in_type_structure.carbon:[[@LINE+2]]:3-33: error: no `Self` reference found in `require` declaration; `Self` must appear in the self-type or as a generic argument for each required interface, but found interface `Y` without a `Self` argument [RequireImplsMissingSelf] + // CHECK:STDERR: ╭─┤ fail_self_in_compound_member_access_is_not_in_type_structure.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ require C.(Z(Self).Z1) impls Y; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: no `Self` reference found in `require` declaration; `Self` must + // CHECK:STDERR: · ┃ appear in the self-type or as a generic argument for each required + // CHECK:STDERR: · ┃ interface, but found interface `Y` without a `Self` argument + // CHECK:STDERR: · ┃ [RequireImplsMissingSelf] + // CHECK:STDERR: ╰──── // CHECK:STDERR: require C.(Z(Self).Z1) impls Y; } @@ -688,7 +869,12 @@ interface Z { } constraint N { - // CHECK:STDERR: fail_rewrite_cycle.carbon:[[@LINE+2]]:17-47: error: found cycle in facet type constraint for `.(Z.Z2)` [FacetTypeConstraintCycle] + // CHECK:STDERR: ╭─┤ fail_rewrite_cycle.carbon:[[@LINE+7]]:17 + // CHECK:STDERR: -> │ require impls Z where .Z1 = .Z2 and .Z2 = .Z1; + // CHECK:STDERR: · ━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: found cycle in facet type constraint for `.(Z.Z2)` + // CHECK:STDERR: · ┃ [FacetTypeConstraintCycle] + // CHECK:STDERR: ╰──── // CHECK:STDERR: require impls Z where .Z1 = .Z2 and .Z2 = .Z1; } diff --git a/toolchain/check/testdata/named_constraint/require_invalid_modifiers.carbon b/toolchain/check/testdata/named_constraint/require_invalid_modifiers.carbon index 751a38b0b5d2..5c2f24ef557f 100644 --- a/toolchain/check/testdata/named_constraint/require_invalid_modifiers.carbon +++ b/toolchain/check/testdata/named_constraint/require_invalid_modifiers.carbon @@ -16,7 +16,12 @@ library "[[@TEST_NAME]]"; interface Y {} constraint Z { - // CHECK:STDERR: fail_abstract_require.carbon:[[@LINE+2]]:3-10: error: `abstract` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╭─┤ fail_abstract_require.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ abstract require impls Y; + // CHECK:STDERR: · ━━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: `abstract` not allowed on `require` declaration + // CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: abstract require impls Y; } @@ -27,7 +32,12 @@ library "[[@TEST_NAME]]"; interface Y {} constraint Z { - // CHECK:STDERR: fail_base_require.carbon:[[@LINE+2]]:3-6: error: `base` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╭─┤ fail_base_require.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ base require impls Y; + // CHECK:STDERR: · ━━┳━ + // CHECK:STDERR: · ┗━━┫ error: `base` not allowed on `require` declaration + // CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: base require impls Y; } @@ -38,7 +48,12 @@ library "[[@TEST_NAME]]"; interface Y {} constraint Z { - // CHECK:STDERR: fail_default_require.carbon:[[@LINE+2]]:3-9: error: `default` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╭─┤ fail_default_require.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ default require impls Y; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: `default` not allowed on `require` declaration + // CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: default require impls Y; } @@ -49,7 +64,12 @@ library "[[@TEST_NAME]]"; interface Y {} constraint Z { - // CHECK:STDERR: fail_extern_require.carbon:[[@LINE+2]]:3-8: error: `extern` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╭─┤ fail_extern_require.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ extern require impls Y; + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: `extern` not allowed on `require` declaration + // CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extern require impls Y; } @@ -60,7 +80,12 @@ library "[[@TEST_NAME]]"; interface Y {} constraint Z { - // CHECK:STDERR: fail_final_require.carbon:[[@LINE+2]]:3-7: error: `final` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╭─┤ fail_final_require.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ final require impls Y; + // CHECK:STDERR: · ━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: `final` not allowed on `require` declaration + // CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: final require impls Y; } @@ -71,7 +96,12 @@ library "[[@TEST_NAME]]"; interface Y {} constraint Z { - // CHECK:STDERR: fail_impl_require.carbon:[[@LINE+2]]:3-6: error: `impl` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╭─┤ fail_impl_require.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ impl require impls Y; + // CHECK:STDERR: · ━━┳━ + // CHECK:STDERR: · ┗━━┫ error: `impl` not allowed on `require` declaration + // CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl require impls Y; } @@ -82,7 +112,12 @@ library "[[@TEST_NAME]]"; interface Y {} constraint Z { - // CHECK:STDERR: fail_override_require.carbon:[[@LINE+2]]:3-10: error: `override` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╭─┤ fail_override_require.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ override require impls Y; + // CHECK:STDERR: · ━━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: `override` not allowed on `require` declaration + // CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: override require impls Y; } @@ -93,9 +128,18 @@ library "[[@TEST_NAME]]"; interface Y {} constraint Z { - // CHECK:STDERR: fail_returned_require.carbon:[[@LINE+4]]:3-10: error: unrecognized declaration introducer [UnrecognizedDecl] + // CHECK:STDERR: ╭─┤ fail_returned_require.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: -> │ returned require impls Y; + // CHECK:STDERR: · ━━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: unrecognized declaration introducer [UnrecognizedDecl] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_returned_require.carbon:[[@LINE+2]]:3-10: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_returned_require.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ returned require impls Y; + // CHECK:STDERR: · ━━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `handle invalid parse trees in `check`` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: returned require impls Y; } @@ -106,7 +150,12 @@ library "[[@TEST_NAME]]"; interface Y {} constraint Z { - // CHECK:STDERR: fail_private_require.carbon:[[@LINE+2]]:3-9: error: `private` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╭─┤ fail_private_require.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ private require impls Y; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: `private` not allowed on `require` declaration + // CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: private require impls Y; } @@ -117,7 +166,12 @@ library "[[@TEST_NAME]]"; interface Y {} constraint Z { - // CHECK:STDERR: fail_protected_require.carbon:[[@LINE+2]]:3-11: error: `protected` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╭─┤ fail_protected_require.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ protected require impls Y; + // CHECK:STDERR: · ━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: `protected` not allowed on `require` declaration + // CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: protected require impls Y; } @@ -128,7 +182,12 @@ library "[[@TEST_NAME]]"; interface Y {} constraint Z { - // CHECK:STDERR: fail_override_virtual.carbon:[[@LINE+2]]:3-9: error: `virtual` not allowed on `require` declaration [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╭─┤ fail_override_virtual.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ virtual require impls Y; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: `virtual` not allowed on `require` declaration + // CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] + // CHECK:STDERR: ╰──── // CHECK:STDERR: virtual require impls Y; } diff --git a/toolchain/check/testdata/namespace/fail_conflict_after_merge.carbon b/toolchain/check/testdata/namespace/fail_conflict_after_merge.carbon index 903071ae688b..cf01163ae45d 100644 --- a/toolchain/check/testdata/namespace/fail_conflict_after_merge.carbon +++ b/toolchain/check/testdata/namespace/fail_conflict_after_merge.carbon @@ -28,8 +28,17 @@ import library "namespace"; // imported declaration. namespace NS; -// CHECK:STDERR: fail_conflict.carbon:[[@LINE+3]]:4-5: error: duplicate name `NS` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: namespace.carbon:4:1-13: note: name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╭─┤ fail_conflict.carbon:[[@LINE+12]]:4 +// CHECK:STDERR: -> │ fn NS(); +// CHECK:STDERR: · ━┳ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `NS` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ namespace.carbon +// CHECK:STDERR: │ namespace NS; +// CHECK:STDERR: · ──────┬────── +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn NS(); @@ -37,8 +46,17 @@ fn NS(); // we don't move it. namespace NS; -// CHECK:STDERR: fail_conflict.carbon:[[@LINE+3]]:4-5: error: duplicate name `NS` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: namespace.carbon:4:1-13: note: name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╭─┤ fail_conflict.carbon:[[@LINE+12]]:4 +// CHECK:STDERR: -> │ fn NS(); +// CHECK:STDERR: · ━┳ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `NS` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ namespace.carbon +// CHECK:STDERR: │ namespace NS; +// CHECK:STDERR: · ──────┬────── +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn NS(); @@ -64,9 +82,9 @@ fn NS(); // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: type: type = facet_type [concrete] -// CHECK:STDOUT: %NS.type.20a02b.1: type = fn_type @NS.loc13 [concrete] +// CHECK:STDOUT: %NS.type.20a02b.1: type = fn_type @NS.loc22 [concrete] // CHECK:STDOUT: %NS.bab1af.1: %NS.type.20a02b.1 = struct_value () [concrete] -// CHECK:STDOUT: %NS.type.20a02b.2: type = fn_type @NS.loc22 [concrete] +// CHECK:STDOUT: %NS.type.20a02b.2: type = fn_type @NS.loc40 [concrete] // CHECK:STDOUT: %NS.bab1af.2: %NS.type.20a02b.2 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -87,12 +105,12 @@ fn NS(); // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %default.import = import // CHECK:STDOUT: %NS.loc8: = namespace imports.%Example.NS, [concrete] {} -// CHECK:STDOUT: %NS.decl.loc13: %NS.type.20a02b.1 = fn_decl @NS.loc13 [concrete = constants.%NS.bab1af.1] {} {} -// CHECK:STDOUT: %NS.loc17: = namespace imports.%Example.NS, [concrete] {} -// CHECK:STDOUT: %NS.decl.loc22: %NS.type.20a02b.2 = fn_decl @NS.loc22 [concrete = constants.%NS.bab1af.2] {} {} +// CHECK:STDOUT: %NS.decl.loc22: %NS.type.20a02b.1 = fn_decl @NS.loc22 [concrete = constants.%NS.bab1af.1] {} {} +// CHECK:STDOUT: %NS.loc26: = namespace imports.%Example.NS, [concrete] {} +// CHECK:STDOUT: %NS.decl.loc40: %NS.type.20a02b.2 = fn_decl @NS.loc40 [concrete = constants.%NS.bab1af.2] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @NS.loc13(); -// CHECK:STDOUT: // CHECK:STDOUT: fn @NS.loc22(); // CHECK:STDOUT: +// CHECK:STDOUT: fn @NS.loc40(); +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_first.carbon b/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_first.carbon index cfe000ea66e6..e8ff0a8ebb0d 100644 --- a/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_first.carbon +++ b/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_first.carbon @@ -24,8 +24,17 @@ package Example; import library "namespace"; -// CHECK:STDERR: fail_conflict.carbon:[[@LINE+3]]:4-5: error: duplicate name `NS` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: namespace.carbon:4:1-13: note: name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╭─┤ fail_conflict.carbon:[[@LINE+12]]:4 +// CHECK:STDERR: -> │ fn NS(); +// CHECK:STDERR: · ━┳ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `NS` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ namespace.carbon +// CHECK:STDERR: │ namespace NS; +// CHECK:STDERR: · ──────┬────── +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn NS(); diff --git a/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_nested.carbon b/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_nested.carbon index 5ac902ca020d..c6aebbad2b64 100644 --- a/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_nested.carbon +++ b/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_nested.carbon @@ -20,12 +20,29 @@ namespace Nested; // --- fail_conflict.carbon import Other; -// CHECK:STDERR: fail_conflict.carbon:[[@LINE+3]]:11-15: error: duplicate name `Other` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: fail_conflict.carbon:[[@LINE-2]]:1-13: note: name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╭─┤ fail_conflict.carbon:[[@LINE+11]]:11 +// CHECK:STDERR: │ import Other; +// CHECK:STDERR: · ──────┬────── +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ namespace Other; +// CHECK:STDERR: · ━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `Other` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ╰──── // CHECK:STDERR: namespace Other; -// CHECK:STDERR: fail_conflict.carbon:[[@LINE+3]]:10-15: error: imported packages cannot be used for declarations [QualifiedDeclOutsidePackage] -// CHECK:STDERR: fn.carbon:3:1-17: note: package imported here [QualifiedDeclOutsidePackageSource] +// CHECK:STDERR: ╭─┤ fail_conflict.carbon:[[@LINE+12]]:10 +// CHECK:STDERR: -> │ fn Other.Nested.F(); +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: imported packages cannot be used for declarations +// CHECK:STDERR: · ┃ [QualifiedDeclOutsidePackage] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ fn.carbon +// CHECK:STDERR: │ namespace Nested; +// CHECK:STDERR: · ────────┬──────── +// CHECK:STDERR: · ╰──┤ package imported here [QualifiedDeclOutsidePackageSource] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Other.Nested.F(); diff --git a/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_second.carbon b/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_second.carbon index 4189d472837a..02fc1afd8325 100644 --- a/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_second.carbon +++ b/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_second.carbon @@ -24,13 +24,32 @@ package Example; import library "fn"; -// CHECK:STDERR: fail_conflict.carbon:[[@LINE+3]]:11-12: error: duplicate name `NS` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: fn.carbon:4:1-8: note: name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╭─┤ fail_conflict.carbon:[[@LINE+12]]:11 +// CHECK:STDERR: -> │ namespace NS; +// CHECK:STDERR: · ━┳ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `NS` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ fn.carbon +// CHECK:STDERR: │ fn NS(); +// CHECK:STDERR: · ────┬─── +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: namespace NS; -// CHECK:STDERR: fail_conflict.carbon:[[@LINE+3]]:4-5: error: name qualifiers are only allowed for entities that provide a scope [QualifiedNameInNonScope] -// CHECK:STDERR: fn.carbon:4:1-8: note: referenced non-scope entity declared here [QualifiedNameNonScopeEntity] +// CHECK:STDERR: ╭─┤ fail_conflict.carbon:[[@LINE+13]]:4 +// CHECK:STDERR: -> │ fn NS.Foo(); +// CHECK:STDERR: · ┳━ +// CHECK:STDERR: · ┗━━┫ error: name qualifiers are only allowed for entities that provide a +// CHECK:STDERR: · ┃ scope +// CHECK:STDERR: · ┃ [QualifiedNameInNonScope] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ fn.carbon +// CHECK:STDERR: │ fn NS(); +// CHECK:STDERR: · ────┬─── +// CHECK:STDERR: · ╰──┤ referenced non-scope entity declared here [QualifiedNameNonScopeEntity] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn NS.Foo(); @@ -85,7 +104,7 @@ fn NS.Foo(); // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %default.import = import -// CHECK:STDOUT: %.loc9: = namespace [concrete] {} +// CHECK:STDOUT: %.loc18: = namespace [concrete] {} // CHECK:STDOUT: %Foo.decl: %Foo.type = fn_decl @Foo [concrete = constants.%Foo] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_first.carbon b/toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_first.carbon index 386cdb960aa6..19a6f834b2a0 100644 --- a/toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_first.carbon +++ b/toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_first.carbon @@ -23,16 +23,25 @@ fn NS.Foo() {} package Example library "[[@TEST_NAME]]"; +// CHECK:STDERR: ╷ ╭── imported from: fail_conflict.carbon [InImport] +// CHECK:STDERR: ├─┤ fn.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: -> │ fn NS() {} +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `NS` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ namespace.carbon +// CHECK:STDERR: │ namespace NS; +// CHECK:STDERR: · ──────┬────── +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: fn NS() {} // --- fail_conflict.carbon package Example library "[[@TEST_NAME]]"; -// CHECK:STDERR: imported from: fail_conflict.carbon:[[@LINE+4]]:1 [InImport] -// CHECK:STDERR: fn.carbon:4:1-9: error: duplicate name `NS` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: namespace.carbon:4:1-13: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: import library "namespace"; import library "fn"; diff --git a/toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_second.carbon b/toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_second.carbon index 6ecdac04924b..639404f31458 100644 --- a/toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_second.carbon +++ b/toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_second.carbon @@ -22,6 +22,19 @@ fn NS() {} package Example library "[[@TEST_NAME]]"; +// CHECK:STDERR: ╷ ╭── imported from: fail_conflict.carbon [InImport] +// CHECK:STDERR: ├─┤ namespace.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: -> │ namespace NS; +// CHECK:STDERR: · ━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `NS` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ fn.carbon +// CHECK:STDERR: │ fn NS() {} +// CHECK:STDERR: · ────┬──── +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: namespace NS; fn NS.Foo() {} @@ -29,10 +42,6 @@ fn NS.Foo() {} package Example library "[[@TEST_NAME]]"; -// CHECK:STDERR: imported from: fail_conflict.carbon:[[@LINE+4]]:1 [InImport] -// CHECK:STDERR: namespace.carbon:4:1-13: error: duplicate name `NS` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: fn.carbon:4:1-9: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: import library "fn"; import library "namespace"; diff --git a/toolchain/check/testdata/namespace/fail_decl_in_alias.carbon b/toolchain/check/testdata/namespace/fail_decl_in_alias.carbon index 8bbc01289e0d..312f2f5b9590 100644 --- a/toolchain/check/testdata/namespace/fail_decl_in_alias.carbon +++ b/toolchain/check/testdata/namespace/fail_decl_in_alias.carbon @@ -17,8 +17,18 @@ namespace NS; alias ns = NS; // Aliases can't be used when declaring names. -// CHECK:STDERR: fail_decl_in_alias.carbon:[[@LINE+3]]:4-5: error: name qualifiers are only allowed for entities that provide a scope [QualifiedNameInNonScope] -// CHECK:STDERR: fail_decl_in_alias.carbon:[[@LINE-4]]:7-8: note: referenced non-scope entity declared here [QualifiedNameNonScopeEntity] +// CHECK:STDERR: ╭─┤ fail_decl_in_alias.carbon:[[@LINE+13]]:4 +// CHECK:STDERR: │ alias ns = NS; +// CHECK:STDERR: · ─┬ +// CHECK:STDERR: · ╰──┤ referenced non-scope entity declared here +// CHECK:STDERR: · │ [QualifiedNameNonScopeEntity] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn ns.A() -> i32 { return 0; } +// CHECK:STDERR: · ┳━ +// CHECK:STDERR: · ┗━━┫ error: name qualifiers are only allowed for entities that provide a +// CHECK:STDERR: · ┃ scope +// CHECK:STDERR: · ┃ [QualifiedNameInNonScope] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn ns.A() -> i32 { return 0; } @@ -83,7 +93,7 @@ fn ns.A() -> i32 { return 0; } // CHECK:STDOUT: %return.patt: %pattern_type.d94 = return_slot_pattern %return.param_patt, %i32 [concrete = constants.%return.patt.6fa] // CHECK:STDOUT: } { // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %.loc23_14: Core.Form = init_form %i32 [concrete = constants.%.0b3] +// CHECK:STDOUT: %.loc33_14: Core.Form = init_form %i32 [concrete = constants.%.0b3] // CHECK:STDOUT: %return.param: ref %i32 = out_param call_param0 // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param // CHECK:STDOUT: } @@ -93,11 +103,11 @@ fn ns.A() -> i32 { return 0; } // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] // CHECK:STDOUT: %impl.elem0: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc23_28.1: = bound_method %int_0, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %bound_method.loc33_28.1: = bound_method %int_0, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] // CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc23_28.2: = bound_method %int_0, %specific_fn [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc23_28.2(%int_0) [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc23_28: init %i32 = converted %int_0, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_0.753] -// CHECK:STDOUT: return %.loc23_28 +// CHECK:STDOUT: %bound_method.loc33_28.2: = bound_method %int_0, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc33_28.2(%int_0) [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc33_28: init %i32 = converted %int_0, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_0.753] +// CHECK:STDOUT: return %.loc33_28 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/namespace/fail_duplicate.carbon b/toolchain/check/testdata/namespace/fail_duplicate.carbon index 6c858d67daee..d0ae524e22d1 100644 --- a/toolchain/check/testdata/namespace/fail_duplicate.carbon +++ b/toolchain/check/testdata/namespace/fail_duplicate.carbon @@ -17,8 +17,15 @@ namespace Foo; fn Foo.Baz() { } -// CHECK:STDERR: fail_duplicate.carbon:[[@LINE+3]]:1-14: error: redefinition of `fn Baz` [RedeclRedef] -// CHECK:STDERR: fail_duplicate.carbon:[[@LINE-4]]:1-14: note: previously defined here [RedeclPrevDef] +// CHECK:STDERR: ╭─┤ fail_duplicate.carbon:[[@LINE+10]]:1 +// CHECK:STDERR: │ fn Foo.Baz() { +// CHECK:STDERR: · ───────┬────── +// CHECK:STDERR: · ╰──┤ previously defined here [RedeclPrevDef] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn Foo.Baz() { +// CHECK:STDERR: · ━━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redefinition of `fn Baz` [RedeclRedef] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Foo.Baz() { } @@ -29,7 +36,7 @@ fn Foo.Baz() { // CHECK:STDOUT: type: type = facet_type [concrete] // CHECK:STDOUT: %Baz.type.280a69.1: type = fn_type @Baz.loc17 [concrete] // CHECK:STDOUT: %Baz.f49bdd.1: %Baz.type.280a69.1 = struct_value () [concrete] -// CHECK:STDOUT: %Baz.type.280a69.2: type = fn_type @Baz.loc23 [concrete] +// CHECK:STDOUT: %Baz.type.280a69.2: type = fn_type @Baz.loc30 [concrete] // CHECK:STDOUT: %Baz.f49bdd.2: %Baz.type.280a69.2 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -50,7 +57,7 @@ fn Foo.Baz() { // CHECK:STDOUT: .Baz = %Baz.decl.loc17 // CHECK:STDOUT: } // CHECK:STDOUT: %Baz.decl.loc17: %Baz.type.280a69.1 = fn_decl @Baz.loc17 [concrete = constants.%Baz.f49bdd.1] {} {} -// CHECK:STDOUT: %Baz.decl.loc23: %Baz.type.280a69.2 = fn_decl @Baz.loc23 [concrete = constants.%Baz.f49bdd.2] {} {} +// CHECK:STDOUT: %Baz.decl.loc30: %Baz.type.280a69.2 = fn_decl @Baz.loc30 [concrete = constants.%Baz.f49bdd.2] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Baz.loc17() { @@ -58,7 +65,7 @@ fn Foo.Baz() { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Baz.loc23() { +// CHECK:STDOUT: fn @Baz.loc30() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/namespace/fail_modifiers.carbon b/toolchain/check/testdata/namespace/fail_modifiers.carbon index 4ba570a4fc3a..787c62a9d749 100644 --- a/toolchain/check/testdata/namespace/fail_modifiers.carbon +++ b/toolchain/check/testdata/namespace/fail_modifiers.carbon @@ -12,28 +12,74 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/namespace/fail_modifiers.carbon -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+15]]:25-28: error: `base` not allowed on declaration with `abstract` [ModifierNotAllowedWith] -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+14]]:16-23: note: `abstract` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+51]]:25 +// CHECK:STDERR: -> │ private extern abstract base default final namespace A; +// CHECK:STDERR: · ────┬─── ┳━━━ +// CHECK:STDERR: · │ ┗━━┫ error: `base` not allowed on declaration with +// CHECK:STDERR: · │ ┃ `abstract` +// CHECK:STDERR: · │ ┃ [ModifierNotAllowedWith] +// CHECK:STDERR: · ╰─────────┤ `abstract` previously appeared here +// CHECK:STDERR: · │ [ModifierPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+12]]:30-36: error: `default` not allowed on declaration with `abstract` [ModifierNotAllowedWith] -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+11]]:16-23: note: `abstract` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+41]]:30 +// CHECK:STDERR: -> │ private extern abstract base default final namespace A; +// CHECK:STDERR: · ────┬─── ┳━━━━━━ +// CHECK:STDERR: · │ ┗━━┫ error: `default` not allowed on declaration +// CHECK:STDERR: · │ ┃ with `abstract` +// CHECK:STDERR: · │ ┃ [ModifierNotAllowedWith] +// CHECK:STDERR: · ╰──────────────┤ `abstract` previously appeared here +// CHECK:STDERR: · │ [ModifierPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+9]]:38-42: error: `final` not allowed on declaration with `abstract` [ModifierNotAllowedWith] -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+8]]:16-23: note: `abstract` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+31]]:38 +// CHECK:STDERR: -> │ private extern abstract base default final namespace A; +// CHECK:STDERR: · ────┬─── ┳━━━━ +// CHECK:STDERR: · │ ┗━━┫ error: `final` not allowed on +// CHECK:STDERR: · │ ┃ declaration with `abstract` +// CHECK:STDERR: · │ ┃ [ModifierNotAllowedWith] +// CHECK:STDERR: · ╰──────────────────────┤ `abstract` previously appeared here +// CHECK:STDERR: · │ [ModifierPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+6]]:1-7: error: `private` not allowed on `namespace` declaration [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+21]]:1 +// CHECK:STDERR: -> │ private extern abstract base default final namespace A; +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: `private` not allowed on `namespace` declaration +// CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:9-14: error: `extern` not allowed on `namespace` declaration [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+14]]:9 +// CHECK:STDERR: -> │ private extern abstract base default final namespace A; +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: `extern` not allowed on `namespace` declaration +// CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:16-23: error: `abstract` not allowed on `namespace` declaration [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+7]]:16 +// CHECK:STDERR: -> │ private extern abstract base default final namespace A; +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: `abstract` not allowed on `namespace` declaration +// CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╰──── // CHECK:STDERR: private extern abstract base default final namespace A; -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-4: error: `impl` not allowed on `namespace` declaration [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ impl namespace B; +// CHECK:STDERR: · ━━┳━ +// CHECK:STDERR: · ┗━━┫ error: `impl` not allowed on `namespace` declaration +// CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl namespace B; -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-6: error: `extern` not allowed on `namespace` declaration [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ extern namespace C; +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: `extern` not allowed on `namespace` declaration +// CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╰──── // CHECK:STDERR: extern namespace C; diff --git a/toolchain/check/testdata/namespace/fail_not_top_level.carbon b/toolchain/check/testdata/namespace/fail_not_top_level.carbon index 2c169ee5e4db..3aff9e63a9f3 100644 --- a/toolchain/check/testdata/namespace/fail_not_top_level.carbon +++ b/toolchain/check/testdata/namespace/fail_not_top_level.carbon @@ -13,21 +13,36 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/namespace/fail_not_top_level.carbon fn F() { - // CHECK:STDERR: fail_not_top_level.carbon:[[@LINE+2]]:3-14: error: `namespace` declaration not at top level [NamespaceDeclNotAtTopLevel] + // CHECK:STDERR: ╭─┤ fail_not_top_level.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ namespace N; + // CHECK:STDERR: · ━━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: `namespace` declaration not at top level + // CHECK:STDERR: · ┃ [NamespaceDeclNotAtTopLevel] + // CHECK:STDERR: ╰──── // CHECK:STDERR: namespace N; fn N.F() {} } class C { - // CHECK:STDERR: fail_not_top_level.carbon:[[@LINE+2]]:3-14: error: `namespace` declaration not at top level [NamespaceDeclNotAtTopLevel] + // CHECK:STDERR: ╭─┤ fail_not_top_level.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ namespace N; + // CHECK:STDERR: · ━━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: `namespace` declaration not at top level + // CHECK:STDERR: · ┃ [NamespaceDeclNotAtTopLevel] + // CHECK:STDERR: ╰──── // CHECK:STDERR: namespace N; fn N.F() {} } interface I { - // CHECK:STDERR: fail_not_top_level.carbon:[[@LINE+2]]:3-14: error: `namespace` declaration not at top level [NamespaceDeclNotAtTopLevel] + // CHECK:STDERR: ╭─┤ fail_not_top_level.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ namespace N; + // CHECK:STDERR: · ━━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: `namespace` declaration not at top level + // CHECK:STDERR: · ┃ [NamespaceDeclNotAtTopLevel] + // CHECK:STDERR: ╰──── // CHECK:STDERR: namespace N; fn N.I() {} @@ -39,16 +54,16 @@ interface I { // CHECK:STDOUT: type: type = facet_type [concrete] // CHECK:STDOUT: %F.type.eb3: type = fn_type @F.loc15 [concrete] // CHECK:STDOUT: %F.708: %F.type.eb3 = struct_value () [concrete] -// CHECK:STDOUT: %F.type.23e: type = fn_type @F.loc19 [concrete] +// CHECK:STDOUT: %F.type.23e: type = fn_type @F.loc24 [concrete] // CHECK:STDOUT: %F.7e0: %F.type.23e = struct_value () [concrete] // CHECK:STDOUT: %C: type = class_type @C [concrete] -// CHECK:STDOUT: %F.type.4e3: type = fn_type @F.loc26 [concrete] +// CHECK:STDOUT: %F.type.4e3: type = fn_type @F.loc36 [concrete] // CHECK:STDOUT: %F.57d: %F.type.4e3 = struct_value () [concrete] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] -// CHECK:STDOUT: %I.type.8e7: type = facet_type <@I.loc29> [concrete] +// CHECK:STDOUT: %I.type.8e7: type = facet_type <@I.loc39> [concrete] // CHECK:STDOUT: %Self: %I.type.8e7 = symbolic_binding Self, 0 [symbolic] -// CHECK:STDOUT: %I.type.237: type = fn_type @I.loc33, @I.WithSelf(%Self) [symbolic] +// CHECK:STDOUT: %I.type.237: type = fn_type @I.loc48, @I.WithSelf(%Self) [symbolic] // CHECK:STDOUT: %I: %I.type.237 = struct_value () [symbolic] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -69,18 +84,18 @@ interface I { // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %F.decl: %F.type.eb3 = fn_decl @F.loc15 [concrete = constants.%F.708] {} {} // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {} -// CHECK:STDOUT: %I.decl: type = interface_decl @I.loc29 [concrete = constants.%I.type.8e7] {} {} +// CHECK:STDOUT: %I.decl: type = interface_decl @I.loc39 [concrete = constants.%I.type.8e7] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: interface @I.loc29 { +// CHECK:STDOUT: interface @I.loc39 { // CHECK:STDOUT: %Self: %I.type.8e7 = symbolic_binding Self, 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %I.WithSelf.decl = interface_with_self_decl @I.loc29 [concrete] +// CHECK:STDOUT: %I.WithSelf.decl = interface_with_self_decl @I.loc39 [concrete] // CHECK:STDOUT: // CHECK:STDOUT: !with Self: // CHECK:STDOUT: %N: = namespace [concrete] { // CHECK:STDOUT: .I = %I.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %I.decl: @I.WithSelf.%I.type (%I.type.237) = fn_decl @I.loc33 [symbolic = @I.WithSelf.%I (constants.%I)] {} {} +// CHECK:STDOUT: %I.decl: @I.WithSelf.%I.type (%I.type.237) = fn_decl @I.loc48 [symbolic = @I.WithSelf.%I (constants.%I)] {} {} // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self @@ -94,7 +109,7 @@ interface I { // CHECK:STDOUT: %N: = namespace [concrete] { // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %F.decl: %F.type.4e3 = fn_decl @F.loc26 [concrete = constants.%F.57d] {} {} +// CHECK:STDOUT: %F.decl: %F.type.4e3 = fn_decl @F.loc36 [concrete = constants.%F.57d] {} {} // CHECK:STDOUT: %complete_type: = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type] // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: @@ -108,21 +123,21 @@ interface I { // CHECK:STDOUT: %N: = namespace [concrete] { // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %F.decl: %F.type.23e = fn_decl @F.loc19 [concrete = constants.%F.7e0] {} {} +// CHECK:STDOUT: %F.decl: %F.type.23e = fn_decl @F.loc24 [concrete = constants.%F.7e0] {} {} // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.loc19() { +// CHECK:STDOUT: fn @F.loc24() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.loc26() { +// CHECK:STDOUT: fn @F.loc36() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @I.loc33(@I.loc29.%Self: %I.type.8e7) { +// CHECK:STDOUT: generic fn @I.loc48(@I.loc39.%Self: %I.type.8e7) { // CHECK:STDOUT: !definition: // CHECK:STDOUT: // CHECK:STDOUT: fn() { @@ -138,5 +153,5 @@ interface I { // CHECK:STDOUT: %I => constants.%I // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @I.loc33(constants.%Self) {} +// CHECK:STDOUT: specific @I.loc48(constants.%Self) {} // CHECK:STDOUT: diff --git a/toolchain/check/testdata/namespace/fail_params.carbon b/toolchain/check/testdata/namespace/fail_params.carbon index 71d579cdc855..75d6c323bde8 100644 --- a/toolchain/check/testdata/namespace/fail_params.carbon +++ b/toolchain/check/testdata/namespace/fail_params.carbon @@ -12,26 +12,49 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/namespace/fail_params.carbon -// CHECK:STDERR: fail_params.carbon:[[@LINE+2]]:12-13: error: `namespace` declaration cannot have parameters [UnexpectedDeclNameParams] +// CHECK:STDERR: ╭─┤ fail_params.carbon:[[@LINE+7]]:12 +// CHECK:STDERR: -> │ namespace A(); +// CHECK:STDERR: · ━┳ +// CHECK:STDERR: · ┗━━┫ error: `namespace` declaration cannot have parameters +// CHECK:STDERR: · ┃ [UnexpectedDeclNameParams] +// CHECK:STDERR: ╰──── // CHECK:STDERR: namespace A(); // Parameters are ignored for error recovery. fn A.F() {} -// CHECK:STDERR: fail_params.carbon:[[@LINE+2]]:12-20: error: `namespace` declaration cannot have parameters [UnexpectedDeclNameParams] +// CHECK:STDERR: ╭─┤ fail_params.carbon:[[@LINE+7]]:12 +// CHECK:STDERR: -> │ namespace B(T: type); +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: `namespace` declaration cannot have parameters +// CHECK:STDERR: · ┃ [UnexpectedDeclNameParams] +// CHECK:STDERR: ╰──── // CHECK:STDERR: namespace B(T: type); interface I(T: type) {} -// CHECK:STDERR: fail_params.carbon:[[@LINE+2]]:12-20: error: `namespace` declaration cannot have parameters [UnexpectedDeclNameParams] +// CHECK:STDERR: ╭─┤ fail_params.carbon:[[@LINE+7]]:12 +// CHECK:STDERR: -> │ namespace C[T: type](U: I(T)); +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: `namespace` declaration cannot have parameters +// CHECK:STDERR: · ┃ [UnexpectedDeclNameParams] +// CHECK:STDERR: ╰──── // CHECK:STDERR: namespace C[T: type](U: I(T)); namespace D; -// CHECK:STDERR: fail_params.carbon:[[@LINE+3]]:4: error: redeclaration differs because of parameter list [RedeclParamListDiffers] -// CHECK:STDERR: fail_params.carbon:[[@LINE-2]]:1-12: note: previously declared without parameter list [RedeclParamListPrevious] +// CHECK:STDERR: ╭─┤ fail_params.carbon:[[@LINE+11]]:4 +// CHECK:STDERR: │ namespace D; +// CHECK:STDERR: · ──────┬───── +// CHECK:STDERR: · ╰──┤ previously declared without parameter list [RedeclParamListPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn D(unused T: type).F() {} +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: redeclaration differs because of parameter list +// CHECK:STDERR: · ┃ [RedeclParamListDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn D(unused T: type).F() {} @@ -39,7 +62,7 @@ fn D(unused T: type).F() {} // CHECK:STDOUT: // CHECK:STDOUT: constants { // CHECK:STDOUT: type: type = facet_type [concrete] -// CHECK:STDOUT: %F.type.14e: type = fn_type @F.loc20 [concrete] +// CHECK:STDOUT: %F.type.14e: type = fn_type @F.loc25 [concrete] // CHECK:STDOUT: %F.19f: %F.type.14e = struct_value () [concrete] // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self] // CHECK:STDOUT: %pattern_type.9a5: type = pattern_type type [concrete] @@ -51,7 +74,7 @@ fn D(unused T: type).F() {} // CHECK:STDOUT: %Self: %I.type.184 = symbolic_binding Self, 1 [symbolic] // CHECK:STDOUT: %U: %I.type.184 = symbolic_binding U, 1 [symbolic] // CHECK:STDOUT: %T.67db0b.2: type = symbolic_binding T, 0 [symbolic] -// CHECK:STDOUT: %F.type.eb3: type = fn_type @F.loc36 [concrete] +// CHECK:STDOUT: %F.type.eb3: type = fn_type @F.loc59 [concrete] // CHECK:STDOUT: %F.708: %F.type.eb3 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -73,76 +96,76 @@ fn D(unused T: type).F() {} // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %A: = namespace [concrete] { -// CHECK:STDOUT: .F = %F.decl.loc20 +// CHECK:STDOUT: .F = %F.decl.loc25 // CHECK:STDOUT: } -// CHECK:STDOUT: %F.decl.loc20: %F.type.14e = fn_decl @F.loc20 [concrete = constants.%F.19f] {} {} -// CHECK:STDOUT: %.loc24_16.1: type = splice_block %.loc24_16.2 [concrete = type] { -// CHECK:STDOUT: %.Self.frozen.loc24: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc24_16.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %F.decl.loc25: %F.type.14e = fn_decl @F.loc25 [concrete = constants.%F.19f] {} {} +// CHECK:STDOUT: %.loc34_16.1: type = splice_block %.loc34_16.2 [concrete = type] { +// CHECK:STDOUT: %.Self.frozen.loc34: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc34_16.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc24: type = symbolic_binding T, 0 [symbolic = constants.%T.67db0b.1] +// CHECK:STDOUT: %T.loc34: type = symbolic_binding T, 0 [symbolic = constants.%T.67db0b.1] // CHECK:STDOUT: %B: = namespace [concrete] {} // CHECK:STDOUT: %I.decl: %I.type.335 = interface_decl @I [concrete = constants.%I.generic] { -// CHECK:STDOUT: %T.patt.loc26_14.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc26_14.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.patt.loc36_14.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc36_14.2 (constants.%T.patt)] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc26_16.1: type = splice_block %.loc26_16.2 [concrete = type] { +// CHECK:STDOUT: %.loc36_16.1: type = splice_block %.loc36_16.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc26_16.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc36_16.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc26_14.2: type = symbolic_binding T, 0 [symbolic = %T.loc26_14.1 (constants.%T.67db0b.1)] +// CHECK:STDOUT: %T.loc36_14.2: type = symbolic_binding T, 0 [symbolic = %T.loc36_14.1 (constants.%T.67db0b.1)] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc30_16.1: type = splice_block %.loc30_16.2 [concrete = type] { -// CHECK:STDOUT: %.Self.frozen.loc30_14: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc30_16.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc45_16.1: type = splice_block %.loc45_16.2 [concrete = type] { +// CHECK:STDOUT: %.Self.frozen.loc45_14: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc45_16.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc30: type = symbolic_binding T, 0 [symbolic = constants.%T.67db0b.1] -// CHECK:STDOUT: %.loc30_28: type = splice_block %I.type [symbolic = constants.%I.type.184] { -// CHECK:STDOUT: %.Self.frozen.loc30_23: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %T.loc45: type = symbolic_binding T, 0 [symbolic = constants.%T.67db0b.1] +// CHECK:STDOUT: %.loc45_28: type = splice_block %I.type [symbolic = constants.%I.type.184] { +// CHECK:STDOUT: %.Self.frozen.loc45_23: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %I.ref: %I.type.335 = name_ref I, %I.decl [concrete = constants.%I.generic] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc30 [symbolic = constants.%T.67db0b.1] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc45 [symbolic = constants.%T.67db0b.1] // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(constants.%T.67db0b.1)> [symbolic = constants.%I.type.184] // CHECK:STDOUT: } // CHECK:STDOUT: %U: %I.type.184 = symbolic_binding U, 1 [symbolic = constants.%U] // CHECK:STDOUT: %C: = namespace [concrete] {} // CHECK:STDOUT: %D: = namespace [concrete] {} -// CHECK:STDOUT: %F.decl.loc36: %F.type.eb3 = fn_decl @F.loc36 [concrete = constants.%F.708] {} { -// CHECK:STDOUT: %.loc36_16.1: type = splice_block %.loc36_16.2 [concrete = type] { +// CHECK:STDOUT: %F.decl.loc59: %F.type.eb3 = fn_decl @F.loc59 [concrete = constants.%F.708] {} { +// CHECK:STDOUT: %.loc59_16.1: type = splice_block %.loc59_16.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc36_16.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc59_16.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc36_14.3: type = symbolic_binding T, 0 [symbolic = %T.loc36_14.2 (constants.%T.67db0b.2)] +// CHECK:STDOUT: %T.loc59_14.3: type = symbolic_binding T, 0 [symbolic = %T.loc59_14.2 (constants.%T.67db0b.2)] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic interface @I(%T.loc26_14.2: type) { -// CHECK:STDOUT: %T.patt.loc26_14.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc26_14.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc26_14.1: type = symbolic_binding T, 0 [symbolic = %T.loc26_14.1 (constants.%T.67db0b.1)] +// CHECK:STDOUT: generic interface @I(%T.loc36_14.2: type) { +// CHECK:STDOUT: %T.patt.loc36_14.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc36_14.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc36_14.1: type = symbolic_binding T, 0 [symbolic = %T.loc36_14.1 (constants.%T.67db0b.1)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%T.loc26_14.1)> [symbolic = %I.type (constants.%I.type.184)] -// CHECK:STDOUT: %Self.loc26_22.2: @I.%I.type (%I.type.184) = symbolic_binding Self, 1 [symbolic = %Self.loc26_22.2 (constants.%Self)] +// CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%T.loc36_14.1)> [symbolic = %I.type (constants.%I.type.184)] +// CHECK:STDOUT: %Self.loc36_22.2: @I.%I.type (%I.type.184) = symbolic_binding Self, 1 [symbolic = %Self.loc36_22.2 (constants.%Self)] // CHECK:STDOUT: // CHECK:STDOUT: interface { -// CHECK:STDOUT: %Self.loc26_22.1: @I.%I.type (%I.type.184) = symbolic_binding Self, 1 [symbolic = %Self.loc26_22.2 (constants.%Self)] +// CHECK:STDOUT: %Self.loc36_22.1: @I.%I.type (%I.type.184) = symbolic_binding Self, 1 [symbolic = %Self.loc36_22.2 (constants.%Self)] // CHECK:STDOUT: %I.WithSelf.decl = interface_with_self_decl @I [concrete] // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.loc26_22.1 +// CHECK:STDOUT: .Self = %Self.loc36_22.1 // CHECK:STDOUT: witness = () // CHECK:STDOUT: // CHECK:STDOUT: !requires: // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.loc20() { +// CHECK:STDOUT: fn @F.loc25() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @F.loc36(%T.loc36_14.3: type) { +// CHECK:STDOUT: generic fn @F.loc59(%T.loc59_14.3: type) { // CHECK:STDOUT: %T.patt: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt (constants.%T.patt)] -// CHECK:STDOUT: %T.loc36_14.1: type = symbolic_binding T, 0 [symbolic = %T.loc36_14.1 (constants.%T.67db0b.1)] -// CHECK:STDOUT: %T.loc36_14.2: type = symbolic_binding T, 0 [symbolic = %T.loc36_14.2 (constants.%T.67db0b.2)] +// CHECK:STDOUT: %T.loc59_14.1: type = symbolic_binding T, 0 [symbolic = %T.loc59_14.1 (constants.%T.67db0b.1)] +// CHECK:STDOUT: %T.loc59_14.2: type = symbolic_binding T, 0 [symbolic = %T.loc59_14.2 (constants.%T.67db0b.2)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: @@ -153,15 +176,15 @@ fn D(unused T: type).F() {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @I(constants.%T.67db0b.1) { -// CHECK:STDOUT: %T.patt.loc26_14.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc26_14.1 => constants.%T.67db0b.1 +// CHECK:STDOUT: %T.patt.loc36_14.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc36_14.1 => constants.%T.67db0b.1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @I.WithSelf(constants.%T.67db0b.1, constants.%Self) {} // CHECK:STDOUT: -// CHECK:STDOUT: specific @F.loc36(constants.%T.67db0b.2) { +// CHECK:STDOUT: specific @F.loc59(constants.%T.67db0b.2) { // CHECK:STDOUT: %T.patt => constants.%T.patt -// CHECK:STDOUT: %T.loc36_14.1 => constants.%T.67db0b.2 -// CHECK:STDOUT: %T.loc36_14.2 => constants.%T.67db0b.2 +// CHECK:STDOUT: %T.loc59_14.1 => constants.%T.67db0b.2 +// CHECK:STDOUT: %T.loc59_14.2 => constants.%T.67db0b.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/namespace/fail_unresolved_scope.carbon b/toolchain/check/testdata/namespace/fail_unresolved_scope.carbon index bc16f7c81bc5..604d89ac0198 100644 --- a/toolchain/check/testdata/namespace/fail_unresolved_scope.carbon +++ b/toolchain/check/testdata/namespace/fail_unresolved_scope.carbon @@ -12,7 +12,11 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/namespace/fail_unresolved_scope.carbon -// CHECK:STDERR: fail_unresolved_scope.carbon:[[@LINE+2]]:4-6: error: name `Foo` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_unresolved_scope.carbon:[[@LINE+6]]:4 +// CHECK:STDERR: -> │ fn Foo.Baz() { +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┗━━┫ error: name `Foo` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Foo.Baz() { } diff --git a/toolchain/check/testdata/namespace/imported_indirect.carbon b/toolchain/check/testdata/namespace/imported_indirect.carbon index 97a4ca43549f..725501216c20 100644 --- a/toolchain/check/testdata/namespace/imported_indirect.carbon +++ b/toolchain/check/testdata/namespace/imported_indirect.carbon @@ -56,11 +56,24 @@ package Same library "[[@TEST_NAME]]"; import library "b"; -// CHECK:STDERR: fail_named_indirectly_same_package.carbon:[[@LINE+6]]:10-12: error: function returns incomplete type `A.C` [IncompleteTypeInFunctionReturnType] -// CHECK:STDERR: imported from: fail_named_indirectly_same_package.carbon:[[@LINE-3]]:1 [InImport] -// CHECK:STDERR: imported from: b.carbon:3:1 [InImport] -// CHECK:STDERR: a.carbon:6:1-10: note: class was forward declared here [ClassForwardDeclaredHere] -// CHECK:STDERR: b.carbon:7:8-13: note: return type declared here [IncompleteReturnTypeHere] +// CHECK:STDERR: ╭─┤ fail_named_indirectly_same_package.carbon:[[@LINE+19]]:10 +// CHECK:STDERR: -> │ fn G() { F(); } +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┗━━┫ error: function returns incomplete type `A.C` +// CHECK:STDERR: · ┃ [IncompleteTypeInFunctionReturnType] +// CHECK:STDERR: ┆ +// CHECK:STDERR: │ ╭── imported from: fail_named_indirectly_same_package.carbon [InImport] +// CHECK:STDERR: │ ├── imported from: b.carbon [InImport] +// CHECK:STDERR: ├─┤ a.carbon +// CHECK:STDERR: │ class A.C; +// CHECK:STDERR: · ─────┬──── +// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ b.carbon +// CHECK:STDERR: │ fn F() -> A.C; +// CHECK:STDERR: · ───┬── +// CHECK:STDERR: · ╰──┤ return type declared here [IncompleteReturnTypeHere] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn G() { F(); } @@ -70,11 +83,24 @@ package Other library "[[@TEST_NAME]]"; import Same library "b"; -// CHECK:STDERR: fail_named_indirectly_different_package.carbon:[[@LINE+6]]:10-17: error: function returns incomplete type `Same.A.C` [IncompleteTypeInFunctionReturnType] -// CHECK:STDERR: imported from: fail_named_indirectly_different_package.carbon:[[@LINE-3]]:1 [InImport] -// CHECK:STDERR: imported from: b.carbon:3:1 [InImport] -// CHECK:STDERR: a.carbon:6:1-10: note: class was forward declared here [ClassForwardDeclaredHere] -// CHECK:STDERR: b.carbon:7:8-13: note: return type declared here [IncompleteReturnTypeHere] +// CHECK:STDERR: ╭─┤ fail_named_indirectly_different_package.carbon:[[@LINE+19]]:10 +// CHECK:STDERR: -> │ fn G() { Same.F(); } +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: function returns incomplete type `Same.A.C` +// CHECK:STDERR: · ┃ [IncompleteTypeInFunctionReturnType] +// CHECK:STDERR: ┆ +// CHECK:STDERR: │ ╭── imported from: fail_named_indirectly_different_package.carbon [InImport] +// CHECK:STDERR: │ ├── imported from: b.carbon [InImport] +// CHECK:STDERR: ├─┤ a.carbon +// CHECK:STDERR: │ class A.C; +// CHECK:STDERR: · ─────┬──── +// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ b.carbon +// CHECK:STDERR: │ fn F() -> A.C; +// CHECK:STDERR: · ───┬── +// CHECK:STDERR: · ╰──┤ return type declared here [IncompleteReturnTypeHere] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn G() { Same.F(); } diff --git a/toolchain/check/testdata/namespace/name_poisoning.carbon b/toolchain/check/testdata/namespace/name_poisoning.carbon index 803caf666710..4753712d2666 100644 --- a/toolchain/check/testdata/namespace/name_poisoning.carbon +++ b/toolchain/check/testdata/namespace/name_poisoning.carbon @@ -46,12 +46,20 @@ namespace N1; // Use `package.N1` and poison `N2.N1`. namespace N2; -// CHECK:STDERR: fail_declare_after_poison.carbon:[[@LINE+1]]:15-16: error: name `N1` used before it was declared [NameUseBeforeDecl] +// CHECK:STDERR: ╭─┤ fail_declare_after_poison.carbon:[[@LINE+11]]:15 +// CHECK:STDERR: -> │ alias N2.N3 = N1; +// CHECK:STDERR: · ━┳ +// CHECK:STDERR: · ┗━━┫ error: name `N1` used before it was declared +// CHECK:STDERR: · ┃ [NameUseBeforeDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: │ namespace N2.N1; +// CHECK:STDERR: · ─┬ +// CHECK:STDERR: · ╰──┤ declared here [NameUseBeforeDeclNote] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: alias N2.N3 = N1; // Failure: N2.N1 declared after it was poisoned. -// CHECK:STDERR: fail_declare_after_poison.carbon:[[@LINE+2]]:14-15: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: namespace N2.N1; // --- fail_use_poison.carbon @@ -64,7 +72,12 @@ namespace N1; namespace N2; alias N2.N3 = N1; -// CHECK:STDERR: fail_use_poison.carbon:[[@LINE+2]]:15-19: error: member name `N1` not found in `N2` [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╭─┤ fail_use_poison.carbon:[[@LINE+7]]:15 +// CHECK:STDERR: -> │ alias N2.N4 = N2.N1; +// CHECK:STDERR: · ━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: member name `N1` not found in `N2` +// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╰──── // CHECK:STDERR: alias N2.N4 = N2.N1; @@ -76,15 +89,28 @@ namespace N1; // Use `package.N1` and poison `N2.N1`. namespace N2; -// CHECK:STDERR: fail_use_declaration_after_poison.carbon:[[@LINE+1]]:15-16: error: name `N1` used before it was declared [NameUseBeforeDecl] +// CHECK:STDERR: ╭─┤ fail_use_declaration_after_poison.carbon:[[@LINE+11]]:15 +// CHECK:STDERR: -> │ alias N2.N3 = N1; +// CHECK:STDERR: · ━┳ +// CHECK:STDERR: · ┗━━┫ error: name `N1` used before it was declared +// CHECK:STDERR: · ┃ [NameUseBeforeDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: │ namespace N2.N1; +// CHECK:STDERR: · ─┬ +// CHECK:STDERR: · ╰──┤ declared here [NameUseBeforeDeclNote] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: alias N2.N3 = N1; // Failure: `N2.N1` declared after it was poisoned. -// CHECK:STDERR: fail_use_declaration_after_poison.carbon:[[@LINE+2]]:14-15: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: namespace N2.N1; -// CHECK:STDERR: fail_use_declaration_after_poison.carbon:[[@LINE+2]]:15-19: error: member name `N1` not found in `N2` [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╭─┤ fail_use_declaration_after_poison.carbon:[[@LINE+7]]:15 +// CHECK:STDERR: -> │ alias N2.N4 = N2.N1; +// CHECK:STDERR: · ━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: member name `N1` not found in `N2` +// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╰──── // CHECK:STDERR: alias N2.N4 = N2.N1; @@ -93,8 +119,13 @@ alias N2.N4 = N2.N1; namespace N1; namespace N2; -// CHECK:STDERR: fail_alias.carbon:[[@LINE+3]]:15-16: error: name `N1` used before it was declared [NameUseBeforeDecl] -// CHECK:STDERR: fail_alias.carbon:[[@LINE+2]]:10-11: note: declared here [NameUseBeforeDeclNote] +// CHECK:STDERR: ╭─┤ fail_alias.carbon:[[@LINE+8]]:15 +// CHECK:STDERR: -> │ alias N2.N1 = N1; +// CHECK:STDERR: · ─┬ ━┳ +// CHECK:STDERR: · │ ┗━━┫ error: name `N1` used before it was declared +// CHECK:STDERR: · │ ┃ [NameUseBeforeDecl] +// CHECK:STDERR: · ╰─────────┤ declared here [NameUseBeforeDeclNote] +// CHECK:STDERR: ╰──── // CHECK:STDERR: alias N2.N1 = N1; @@ -110,19 +141,43 @@ namespace N2.N3.N4; // * `N2.N1` // * `N2.N3.N1` // * `N2.N3.N4.N1` -// CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+1]]:21-22: error: name `N1` used before it was declared [NameUseBeforeDecl] +// CHECK:STDERR: ╭─┤ fail_poison_multiple_scopes.carbon:[[@LINE+33]]:21 +// CHECK:STDERR: -> │ alias N2.N3.N4.N5 = N1; +// CHECK:STDERR: · ━┳ +// CHECK:STDERR: · ┗━━┫ error: name `N1` used before it was declared +// CHECK:STDERR: · ┃ [NameUseBeforeDecl] +// CHECK:STDERR: │ +// CHECK:STDERR: │ namespace N2.N3.N4.N1; +// CHECK:STDERR: · ─┬ +// CHECK:STDERR: · ╰──┤ declared here [NameUseBeforeDeclNote] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: +// CHECK:STDERR: ╭─┤ fail_poison_multiple_scopes.carbon:[[@LINE+22]]:21 +// CHECK:STDERR: -> │ alias N2.N3.N4.N5 = N1; +// CHECK:STDERR: · ━┳ +// CHECK:STDERR: · ┗━━┫ error: name `N1` used before it was declared +// CHECK:STDERR: · ┃ [NameUseBeforeDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: │ namespace N2.N3.N1; +// CHECK:STDERR: · ─┬ +// CHECK:STDERR: · ╰──┤ declared here [NameUseBeforeDeclNote] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: +// CHECK:STDERR: ╭─┤ fail_poison_multiple_scopes.carbon:[[@LINE+11]]:21 +// CHECK:STDERR: -> │ alias N2.N3.N4.N5 = N1; +// CHECK:STDERR: · ━┳ +// CHECK:STDERR: · ┗━━┫ error: name `N1` used before it was declared +// CHECK:STDERR: · ┃ [NameUseBeforeDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: │ namespace N2.N1; +// CHECK:STDERR: · ─┬ +// CHECK:STDERR: · ╰──┤ declared here [NameUseBeforeDeclNote] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: alias N2.N3.N4.N5 = N1; -// CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+3]]:20-21: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: -// CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE-4]]:21-22: error: name `N1` used before it was declared [NameUseBeforeDecl] namespace N2.N3.N4.N1; -// CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+3]]:17-18: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: -// CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE-8]]:21-22: error: name `N1` used before it was declared [NameUseBeforeDecl] namespace N2.N3.N1; -// CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+2]]:14-15: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: namespace N2.N1; // --- ignored_poison_in_import.carbon @@ -146,16 +201,36 @@ library "[[@TEST_NAME]]"; namespace N1; // `N1.N3` poisoned when not found. -// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+3]]:15-16: error: name `N3` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_poison_when_lookup_fails.carbon:[[@LINE+28]]:15 +// CHECK:STDERR: -> │ alias N1.N2 = N3; +// CHECK:STDERR: · ━┳ +// CHECK:STDERR: · ┗━━┫ error: name `N3` not found [NameNotFound] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: +// CHECK:STDERR: ╭─┤ fail_poison_when_lookup_fails.carbon:[[@LINE+22]]:15 +// CHECK:STDERR: -> │ alias N1.N2 = N3; +// CHECK:STDERR: · ━┳ +// CHECK:STDERR: · ┗━━┫ error: name `N3` used before it was declared +// CHECK:STDERR: · ┃ [NameUseBeforeDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: │ namespace N3; +// CHECK:STDERR: · ─┬ +// CHECK:STDERR: · ╰──┤ declared here [NameUseBeforeDeclNote] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: +// CHECK:STDERR: ╭─┤ fail_poison_when_lookup_fails.carbon:[[@LINE+11]]:15 +// CHECK:STDERR: -> │ alias N1.N2 = N3; +// CHECK:STDERR: · ━┳ +// CHECK:STDERR: · ┗━━┫ error: name `N3` used before it was declared +// CHECK:STDERR: · ┃ [NameUseBeforeDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: │ namespace N1.N3; +// CHECK:STDERR: · ─┬ +// CHECK:STDERR: · ╰──┤ declared here [NameUseBeforeDeclNote] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+1]]:15-16: error: name `N3` used before it was declared [NameUseBeforeDecl] alias N1.N2 = N3; // TODO: We should ideally only produce one diagnostic here. -// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+3]]:11-12: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: -// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE-5]]:15-16: error: name `N3` used before it was declared [NameUseBeforeDecl] namespace N3; -// CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+2]]:14-15: note: declared here [NameUseBeforeDeclNote] -// CHECK:STDERR: namespace N1.N3; diff --git a/toolchain/check/testdata/operators/builtin/bit_and.carbon b/toolchain/check/testdata/operators/builtin/bit_and.carbon index e8369b473764..2ae15303b53e 100644 --- a/toolchain/check/testdata/operators/builtin/bit_and.carbon +++ b/toolchain/check/testdata/operators/builtin/bit_and.carbon @@ -26,15 +26,35 @@ interface I {} class J {} class K {} -// CHECK:STDERR: fail_bit_and_non_facet_types.carbon:[[@LINE+2]]:10-14: error: non-facet type `J` combined with `&` operator [FacetTypeRequiredForTypeAndOperator] +// CHECK:STDERR: ╭─┤ fail_bit_and_non_facet_types.carbon:[[@LINE+7]]:10 +// CHECK:STDERR: -> │ fn F1[T: I & J](unused t: T) {} +// CHECK:STDERR: · ━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: non-facet type `J` combined with `&` operator +// CHECK:STDERR: · ┃ [FacetTypeRequiredForTypeAndOperator] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F1[T: I & J](unused t: T) {} -// CHECK:STDERR: fail_bit_and_non_facet_types.carbon:[[@LINE+2]]:10-14: error: non-facet type `J` combined with `&` operator [FacetTypeRequiredForTypeAndOperator] +// CHECK:STDERR: ╭─┤ fail_bit_and_non_facet_types.carbon:[[@LINE+7]]:10 +// CHECK:STDERR: -> │ fn F2[T: J & I](unused t: T) {} +// CHECK:STDERR: · ━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: non-facet type `J` combined with `&` operator +// CHECK:STDERR: · ┃ [FacetTypeRequiredForTypeAndOperator] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F2[T: J & I](unused t: T) {} -// CHECK:STDERR: fail_bit_and_non_facet_types.carbon:[[@LINE+4]]:10-14: error: non-facet type `J` combined with `&` operator [FacetTypeRequiredForTypeAndOperator] +// CHECK:STDERR: ╭─┤ fail_bit_and_non_facet_types.carbon:[[@LINE+14]]:10 +// CHECK:STDERR: -> │ fn F3[T: J & K](unused t: T) {} +// CHECK:STDERR: · ━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: non-facet type `J` combined with `&` operator +// CHECK:STDERR: · ┃ [FacetTypeRequiredForTypeAndOperator] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_bit_and_non_facet_types.carbon:[[@LINE+2]]:10-14: error: non-facet type `K` combined with `&` operator [FacetTypeRequiredForTypeAndOperator] +// CHECK:STDERR: ╭─┤ fail_bit_and_non_facet_types.carbon:[[@LINE+7]]:10 +// CHECK:STDERR: -> │ fn F3[T: J & K](unused t: T) {} +// CHECK:STDERR: · ━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: non-facet type `K` combined with `&` operator +// CHECK:STDERR: · ┃ [FacetTypeRequiredForTypeAndOperator] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F3[T: J & K](unused t: T) {} @@ -60,7 +80,13 @@ class J { adapt {}; } fn F() { let a: J = {} as J; let b: J = {} as J; - // CHECK:STDERR: fail_bit_and_values_no_impl.carbon:[[@LINE+2]]:3-7: error: cannot access member of interface `Core.BitAndWith(J)` in type `J` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_bit_and_values_no_impl.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ a & b; + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.BitAndWith(J)` in type `J` + // CHECK:STDERR: · ┃ that does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: a & b; } diff --git a/toolchain/check/testdata/operators/builtin/fail_and_or_not_in_function.carbon b/toolchain/check/testdata/operators/builtin/fail_and_or_not_in_function.carbon index 806a9ee60d4f..a8d1e9607a80 100644 --- a/toolchain/check/testdata/operators/builtin/fail_and_or_not_in_function.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_and_or_not_in_function.carbon @@ -22,7 +22,14 @@ fn F(b: bool) -> type { } // TODO: Short-circuit operators should be permitted outside functions. -// CHECK:STDERR: fail_and.carbon:[[@LINE+2]]:13-25: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_and.carbon:[[@LINE+9]]:13 +// CHECK:STDERR: -> │ var and_: F(true and true); +// CHECK:STDERR: · ━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: semantics TODO: +// CHECK:STDERR: · ┃ `Control flow expressions are currently only supported inside functions.` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var and_: F(true and true); @@ -30,9 +37,23 @@ var and_: F(true and true); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_and_val.carbon:[[@LINE+4]]:21-28: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_and_val.carbon:[[@LINE+18]]:21 +// CHECK:STDERR: -> │ var and_val: bool = true and true; +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: semantics TODO: +// CHECK:STDERR: · ┃ `Control flow expressions are currently only supported inside functions.` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_and_val.carbon:[[@LINE+2]]:21-33: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_and_val.carbon:[[@LINE+9]]:21 +// CHECK:STDERR: -> │ var and_val: bool = true and true; +// CHECK:STDERR: · ━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: semantics TODO: +// CHECK:STDERR: · ┃ `Control flow expressions are currently only supported inside functions.` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var and_val: bool = true and true; @@ -45,7 +66,14 @@ fn F(b: bool) -> type { return if b then i32 else f64; } -// CHECK:STDERR: fail_or.carbon:[[@LINE+2]]:12-23: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_or.carbon:[[@LINE+9]]:12 +// CHECK:STDERR: -> │ var or_: F(true or true); +// CHECK:STDERR: · ━━━━━━┳━━━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: semantics TODO: +// CHECK:STDERR: · ┃ `Control flow expressions are currently only supported inside functions.` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var or_: F(true or true); @@ -53,9 +81,23 @@ var or_: F(true or true); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_or_val.carbon:[[@LINE+4]]:20-26: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_or_val.carbon:[[@LINE+18]]:20 +// CHECK:STDERR: -> │ var or_val: bool = true or true; +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: semantics TODO: +// CHECK:STDERR: · ┃ `Control flow expressions are currently only supported inside functions.` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_or_val.carbon:[[@LINE+2]]:20-31: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_or_val.carbon:[[@LINE+9]]:20 +// CHECK:STDERR: -> │ var or_val: bool = true or true; +// CHECK:STDERR: · ━━━━━━┳━━━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: semantics TODO: +// CHECK:STDERR: · ┃ `Control flow expressions are currently only supported inside functions.` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var or_val: bool = true or true; @@ -67,7 +109,14 @@ base class C(B: bool) {} fn F() { class B { - // CHECK:STDERR: fail_nested.carbon:[[@LINE+2]]:20-32: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_nested.carbon:[[@LINE+9]]:20 + // CHECK:STDERR: -> │ extend base: C(true or false); + // CHECK:STDERR: · ━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: semantics TODO: + // CHECK:STDERR: · ┃ `Control flow expressions are currently only supported inside functions.` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend base: C(true or false); } @@ -187,10 +236,10 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: class @B { // CHECK:STDOUT: %C.ref: %C.type = name_ref C, .inst{{[0-9A-F]+}}.loc4_23 [concrete = constants.%C.generic] -// CHECK:STDOUT: %true.loc10_20: bool = bool_literal true [concrete = constants.%true] -// CHECK:STDOUT: %.loc10: bool = not %true.loc10_20 [concrete = constants.%false] -// CHECK:STDOUT: %true.loc10_25: bool = bool_literal true [concrete = constants.%true] -// CHECK:STDOUT: if %.loc10 br !or.rhs else br !or.result(%true.loc10_25) +// CHECK:STDOUT: %true.loc17_20: bool = bool_literal true [concrete = constants.%true] +// CHECK:STDOUT: %.loc17: bool = not %true.loc17_20 [concrete = constants.%false] +// CHECK:STDOUT: %true.loc17_25: bool = bool_literal true [concrete = constants.%true] +// CHECK:STDOUT: if %.loc17 br !or.rhs else br !or.result(%true.loc17_25) // CHECK:STDOUT: complete_type_witness = invalid // CHECK:STDOUT: // CHECK:STDOUT: !members: diff --git a/toolchain/check/testdata/operators/builtin/fail_and_or_partial_constant.carbon b/toolchain/check/testdata/operators/builtin/fail_and_or_partial_constant.carbon index f2fd4f46b800..ed049d2881d7 100644 --- a/toolchain/check/testdata/operators/builtin/fail_and_or_partial_constant.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_and_or_partial_constant.carbon @@ -17,10 +17,20 @@ package FailNonConstantResult; fn PartialConstant(x: bool) { - // CHECK:STDERR: fail_non_constant_result.carbon:[[@LINE+2]]:17-47: error: cannot evaluate type expression [TypeExprEvaluationFailure] + // CHECK:STDERR: ╭─┤ fail_non_constant_result.carbon:[[@LINE+7]]:17 + // CHECK:STDERR: -> │ var unused a: if true and x then bool else (); + // CHECK:STDERR: · ━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot evaluate type expression + // CHECK:STDERR: · ┃ [TypeExprEvaluationFailure] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused a: if true and x then bool else (); - // CHECK:STDERR: fail_non_constant_result.carbon:[[@LINE+2]]:17-47: error: cannot evaluate type expression [TypeExprEvaluationFailure] + // CHECK:STDERR: ╭─┤ fail_non_constant_result.carbon:[[@LINE+7]]:17 + // CHECK:STDERR: -> │ var unused b: if false or x then bool else (); + // CHECK:STDERR: · ━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot evaluate type expression + // CHECK:STDERR: · ┃ [TypeExprEvaluationFailure] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused b: if false or x then bool else (); } @@ -32,10 +42,20 @@ package FailDespiteKnownResult; fn KnownValueButNonConstantCondition(x: bool) { // We choose not to give these cases constant values, even though we could, // because they notionally involve evaluating a non-constant condition. - // CHECK:STDERR: fail_despite_known_result.carbon:[[@LINE+2]]:17-48: error: cannot evaluate type expression [TypeExprEvaluationFailure] + // CHECK:STDERR: ╭─┤ fail_despite_known_result.carbon:[[@LINE+7]]:17 + // CHECK:STDERR: -> │ var unused c: if x and false then bool else (); + // CHECK:STDERR: · ━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot evaluate type expression + // CHECK:STDERR: · ┃ [TypeExprEvaluationFailure] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused c: if x and false then bool else (); - // CHECK:STDERR: fail_despite_known_result.carbon:[[@LINE+2]]:17-46: error: cannot evaluate type expression [TypeExprEvaluationFailure] + // CHECK:STDERR: ╭─┤ fail_despite_known_result.carbon:[[@LINE+7]]:17 + // CHECK:STDERR: -> │ var unused d: if x or true then bool else (); + // CHECK:STDERR: · ━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot evaluate type expression + // CHECK:STDERR: · ┃ [TypeExprEvaluationFailure] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused d: if x or true then bool else (); } @@ -88,35 +108,35 @@ fn KnownValueButNonConstantCondition(x: bool) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.var: ref = var_storage %a.var_patt [concrete = ] // CHECK:STDOUT: assign %a.var, -// CHECK:STDOUT: br !.loc7_20 +// CHECK:STDOUT: br !.loc12_20 // CHECK:STDOUT: -// CHECK:STDOUT: !.loc7_20: -// CHECK:STDOUT: %true.loc7: bool = bool_literal true [concrete = constants.%true] -// CHECK:STDOUT: %false.loc7: bool = bool_literal false [concrete = constants.%false] -// CHECK:STDOUT: if %true.loc7 br !and.rhs else br !and.result(%false.loc7) +// CHECK:STDOUT: !.loc12_20: +// CHECK:STDOUT: %true.loc12: bool = bool_literal true [concrete = constants.%true] +// CHECK:STDOUT: %false.loc12: bool = bool_literal false [concrete = constants.%false] +// CHECK:STDOUT: if %true.loc12 br !and.rhs else br !and.result(%false.loc12) // CHECK:STDOUT: // CHECK:STDOUT: !and.rhs: -// CHECK:STDOUT: %x.ref.loc7: bool = name_ref x, %x -// CHECK:STDOUT: br !and.result(%x.ref.loc7) +// CHECK:STDOUT: %x.ref.loc12: bool = name_ref x, %x +// CHECK:STDOUT: br !and.result(%x.ref.loc12) // CHECK:STDOUT: // CHECK:STDOUT: !and.result: -// CHECK:STDOUT: %.loc7_25: bool = block_arg !and.result -// CHECK:STDOUT: if %.loc7_25 br !if.expr.then.loc7 else br !if.expr.else.loc7 +// CHECK:STDOUT: %.loc12_25: bool = block_arg !and.result +// CHECK:STDOUT: if %.loc12_25 br !if.expr.then.loc12 else br !if.expr.else.loc12 // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc7: -// CHECK:STDOUT: %.loc7_36: type = type_literal bool [concrete = bool] -// CHECK:STDOUT: br !if.expr.result.loc7(%.loc7_36) +// CHECK:STDOUT: !if.expr.then.loc12: +// CHECK:STDOUT: %.loc12_36: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: br !if.expr.result.loc12(%.loc12_36) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc7: -// CHECK:STDOUT: %.loc7_47: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc7_41: type = converted %.loc7_47, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: br !if.expr.result.loc7(%.loc7_41) +// CHECK:STDOUT: !if.expr.else.loc12: +// CHECK:STDOUT: %.loc12_47: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc12_41: type = converted %.loc12_47, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: br !if.expr.result.loc12(%.loc12_41) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc7: -// CHECK:STDOUT: %.loc7_17: type = block_arg !if.expr.result.loc7 -// CHECK:STDOUT: br !.loc7_15 +// CHECK:STDOUT: !if.expr.result.loc12: +// CHECK:STDOUT: %.loc12_17: type = block_arg !if.expr.result.loc12 +// CHECK:STDOUT: br !.loc12_15 // CHECK:STDOUT: -// CHECK:STDOUT: !.loc7_15: +// CHECK:STDOUT: !.loc12_15: // CHECK:STDOUT: %a: = wrapper_binding a, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %a.patt: = ref_binding_pattern a [concrete = ] @@ -124,36 +144,36 @@ fn KnownValueButNonConstantCondition(x: bool) { // CHECK:STDOUT: } // CHECK:STDOUT: %b.var: ref = var_storage %b.var_patt [concrete = ] // CHECK:STDOUT: assign %b.var, -// CHECK:STDOUT: br !.loc10_20 +// CHECK:STDOUT: br !.loc20_20 // CHECK:STDOUT: -// CHECK:STDOUT: !.loc10_20: -// CHECK:STDOUT: %false.loc10: bool = bool_literal false [concrete = constants.%false] -// CHECK:STDOUT: %.loc10_26.1: bool = not %false.loc10 [concrete = constants.%true] -// CHECK:STDOUT: %true.loc10: bool = bool_literal true [concrete = constants.%true] -// CHECK:STDOUT: if %.loc10_26.1 br !or.rhs else br !or.result(%true.loc10) +// CHECK:STDOUT: !.loc20_20: +// CHECK:STDOUT: %false.loc20: bool = bool_literal false [concrete = constants.%false] +// CHECK:STDOUT: %.loc20_26.1: bool = not %false.loc20 [concrete = constants.%true] +// CHECK:STDOUT: %true.loc20: bool = bool_literal true [concrete = constants.%true] +// CHECK:STDOUT: if %.loc20_26.1 br !or.rhs else br !or.result(%true.loc20) // CHECK:STDOUT: // CHECK:STDOUT: !or.rhs: -// CHECK:STDOUT: %x.ref.loc10: bool = name_ref x, %x -// CHECK:STDOUT: br !or.result(%x.ref.loc10) +// CHECK:STDOUT: %x.ref.loc20: bool = name_ref x, %x +// CHECK:STDOUT: br !or.result(%x.ref.loc20) // CHECK:STDOUT: // CHECK:STDOUT: !or.result: -// CHECK:STDOUT: %.loc10_26.2: bool = block_arg !or.result -// CHECK:STDOUT: if %.loc10_26.2 br !if.expr.then.loc10 else br !if.expr.else.loc10 +// CHECK:STDOUT: %.loc20_26.2: bool = block_arg !or.result +// CHECK:STDOUT: if %.loc20_26.2 br !if.expr.then.loc20 else br !if.expr.else.loc20 // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc10: -// CHECK:STDOUT: %.loc10_36: type = type_literal bool [concrete = bool] -// CHECK:STDOUT: br !if.expr.result.loc10(%.loc10_36) +// CHECK:STDOUT: !if.expr.then.loc20: +// CHECK:STDOUT: %.loc20_36: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: br !if.expr.result.loc20(%.loc20_36) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc10: -// CHECK:STDOUT: %.loc10_47: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc10_41: type = converted %.loc10_47, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: br !if.expr.result.loc10(%.loc10_41) +// CHECK:STDOUT: !if.expr.else.loc20: +// CHECK:STDOUT: %.loc20_47: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc20_41: type = converted %.loc20_47, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: br !if.expr.result.loc20(%.loc20_41) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc10: -// CHECK:STDOUT: %.loc10_17: type = block_arg !if.expr.result.loc10 -// CHECK:STDOUT: br !.loc10_15 +// CHECK:STDOUT: !if.expr.result.loc20: +// CHECK:STDOUT: %.loc20_17: type = block_arg !if.expr.result.loc20 +// CHECK:STDOUT: br !.loc20_15 // CHECK:STDOUT: -// CHECK:STDOUT: !.loc10_15: +// CHECK:STDOUT: !.loc20_15: // CHECK:STDOUT: %b: = wrapper_binding b, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %b.patt: = ref_binding_pattern b [concrete = ] @@ -210,35 +230,35 @@ fn KnownValueButNonConstantCondition(x: bool) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %c.var: ref = var_storage %c.var_patt [concrete = ] // CHECK:STDOUT: assign %c.var, -// CHECK:STDOUT: br !.loc9_20 +// CHECK:STDOUT: br !.loc14_20 // CHECK:STDOUT: -// CHECK:STDOUT: !.loc9_20: -// CHECK:STDOUT: %x.ref.loc9: bool = name_ref x, %x -// CHECK:STDOUT: %false.loc9_22: bool = bool_literal false [concrete = constants.%false] -// CHECK:STDOUT: if %x.ref.loc9 br !and.rhs else br !and.result(%false.loc9_22) +// CHECK:STDOUT: !.loc14_20: +// CHECK:STDOUT: %x.ref.loc14: bool = name_ref x, %x +// CHECK:STDOUT: %false.loc14_22: bool = bool_literal false [concrete = constants.%false] +// CHECK:STDOUT: if %x.ref.loc14 br !and.rhs else br !and.result(%false.loc14_22) // CHECK:STDOUT: // CHECK:STDOUT: !and.rhs: -// CHECK:STDOUT: %false.loc9_26: bool = bool_literal false [concrete = constants.%false] -// CHECK:STDOUT: br !and.result(%false.loc9_26) +// CHECK:STDOUT: %false.loc14_26: bool = bool_literal false [concrete = constants.%false] +// CHECK:STDOUT: br !and.result(%false.loc14_26) // CHECK:STDOUT: // CHECK:STDOUT: !and.result: -// CHECK:STDOUT: %.loc9_22: bool = block_arg !and.result -// CHECK:STDOUT: if %.loc9_22 br !if.expr.then.loc9 else br !if.expr.else.loc9 +// CHECK:STDOUT: %.loc14_22: bool = block_arg !and.result +// CHECK:STDOUT: if %.loc14_22 br !if.expr.then.loc14 else br !if.expr.else.loc14 // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc9: -// CHECK:STDOUT: %.loc9_37: type = type_literal bool [concrete = bool] -// CHECK:STDOUT: br !if.expr.result.loc9(%.loc9_37) +// CHECK:STDOUT: !if.expr.then.loc14: +// CHECK:STDOUT: %.loc14_37: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: br !if.expr.result.loc14(%.loc14_37) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc9: -// CHECK:STDOUT: %.loc9_48: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc9_42: type = converted %.loc9_48, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: br !if.expr.result.loc9(%.loc9_42) +// CHECK:STDOUT: !if.expr.else.loc14: +// CHECK:STDOUT: %.loc14_48: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc14_42: type = converted %.loc14_48, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: br !if.expr.result.loc14(%.loc14_42) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc9: -// CHECK:STDOUT: %.loc9_17: type = block_arg !if.expr.result.loc9 -// CHECK:STDOUT: br !.loc9_15 +// CHECK:STDOUT: !if.expr.result.loc14: +// CHECK:STDOUT: %.loc14_17: type = block_arg !if.expr.result.loc14 +// CHECK:STDOUT: br !.loc14_15 // CHECK:STDOUT: -// CHECK:STDOUT: !.loc9_15: +// CHECK:STDOUT: !.loc14_15: // CHECK:STDOUT: %c: = wrapper_binding c, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %c.patt: = ref_binding_pattern c [concrete = ] @@ -246,36 +266,36 @@ fn KnownValueButNonConstantCondition(x: bool) { // CHECK:STDOUT: } // CHECK:STDOUT: %d.var: ref = var_storage %d.var_patt [concrete = ] // CHECK:STDOUT: assign %d.var, -// CHECK:STDOUT: br !.loc12_20 +// CHECK:STDOUT: br !.loc22_20 // CHECK:STDOUT: -// CHECK:STDOUT: !.loc12_20: -// CHECK:STDOUT: %x.ref.loc12: bool = name_ref x, %x -// CHECK:STDOUT: %.loc12_22.1: bool = not %x.ref.loc12 -// CHECK:STDOUT: %true.loc12_22: bool = bool_literal true [concrete = constants.%true] -// CHECK:STDOUT: if %.loc12_22.1 br !or.rhs else br !or.result(%true.loc12_22) +// CHECK:STDOUT: !.loc22_20: +// CHECK:STDOUT: %x.ref.loc22: bool = name_ref x, %x +// CHECK:STDOUT: %.loc22_22.1: bool = not %x.ref.loc22 +// CHECK:STDOUT: %true.loc22_22: bool = bool_literal true [concrete = constants.%true] +// CHECK:STDOUT: if %.loc22_22.1 br !or.rhs else br !or.result(%true.loc22_22) // CHECK:STDOUT: // CHECK:STDOUT: !or.rhs: -// CHECK:STDOUT: %true.loc12_25: bool = bool_literal true [concrete = constants.%true] -// CHECK:STDOUT: br !or.result(%true.loc12_25) +// CHECK:STDOUT: %true.loc22_25: bool = bool_literal true [concrete = constants.%true] +// CHECK:STDOUT: br !or.result(%true.loc22_25) // CHECK:STDOUT: // CHECK:STDOUT: !or.result: -// CHECK:STDOUT: %.loc12_22.2: bool = block_arg !or.result -// CHECK:STDOUT: if %.loc12_22.2 br !if.expr.then.loc12 else br !if.expr.else.loc12 +// CHECK:STDOUT: %.loc22_22.2: bool = block_arg !or.result +// CHECK:STDOUT: if %.loc22_22.2 br !if.expr.then.loc22 else br !if.expr.else.loc22 // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc12: -// CHECK:STDOUT: %.loc12_35: type = type_literal bool [concrete = bool] -// CHECK:STDOUT: br !if.expr.result.loc12(%.loc12_35) +// CHECK:STDOUT: !if.expr.then.loc22: +// CHECK:STDOUT: %.loc22_35: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: br !if.expr.result.loc22(%.loc22_35) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc12: -// CHECK:STDOUT: %.loc12_46: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc12_40: type = converted %.loc12_46, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: br !if.expr.result.loc12(%.loc12_40) +// CHECK:STDOUT: !if.expr.else.loc22: +// CHECK:STDOUT: %.loc22_46: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc22_40: type = converted %.loc22_46, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: br !if.expr.result.loc22(%.loc22_40) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc12: -// CHECK:STDOUT: %.loc12_17: type = block_arg !if.expr.result.loc12 -// CHECK:STDOUT: br !.loc12_15 +// CHECK:STDOUT: !if.expr.result.loc22: +// CHECK:STDOUT: %.loc22_17: type = block_arg !if.expr.result.loc22 +// CHECK:STDOUT: br !.loc22_15 // CHECK:STDOUT: -// CHECK:STDOUT: !.loc12_15: +// CHECK:STDOUT: !.loc22_15: // CHECK:STDOUT: %d: = wrapper_binding d, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %d.patt: = ref_binding_pattern d [concrete = ] diff --git a/toolchain/check/testdata/operators/builtin/fail_assignment_to_error.carbon b/toolchain/check/testdata/operators/builtin/fail_assignment_to_error.carbon index 1cd66639f789..c0f016edc49c 100644 --- a/toolchain/check/testdata/operators/builtin/fail_assignment_to_error.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_assignment_to_error.carbon @@ -13,10 +13,18 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/builtin/fail_assignment_to_error.carbon fn Main() { - // CHECK:STDERR: fail_assignment_to_error.carbon:[[@LINE+2]]:3-12: error: name `undeclared` not found [NameNotFound] + // CHECK:STDERR: ╭─┤ fail_assignment_to_error.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ undeclared = 42; + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: name `undeclared` not found [NameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: undeclared = 42; - // CHECK:STDERR: fail_assignment_to_error.carbon:[[@LINE+2]]:4-18: error: name `also_undeclared` not found [NameNotFound] + // CHECK:STDERR: ╭─┤ fail_assignment_to_error.carbon:[[@LINE+6]]:4 + // CHECK:STDERR: -> │ *also_undeclared = 42; + // CHECK:STDERR: · ━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: name `also_undeclared` not found [NameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: *also_undeclared = 42; } @@ -51,12 +59,12 @@ fn Main() { // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %undeclared.ref: = name_ref undeclared, [concrete = ] -// CHECK:STDOUT: %int_42.loc18: Core.IntLiteral = int_value 42 [concrete = constants.%int_42] +// CHECK:STDOUT: %int_42.loc22: Core.IntLiteral = int_value 42 [concrete = constants.%int_42] // CHECK:STDOUT: assign %undeclared.ref, // CHECK:STDOUT: %also_undeclared.ref: = name_ref also_undeclared, [concrete = ] -// CHECK:STDOUT: %.loc21: ref = deref [concrete = ] -// CHECK:STDOUT: %int_42.loc21: Core.IntLiteral = int_value 42 [concrete = constants.%int_42] -// CHECK:STDOUT: assign %.loc21, +// CHECK:STDOUT: %.loc29: ref = deref [concrete = ] +// CHECK:STDOUT: %int_42.loc29: Core.IntLiteral = int_value 42 [concrete = constants.%int_42] +// CHECK:STDOUT: assign %.loc29, // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/builtin/fail_assignment_to_non_assignable.carbon b/toolchain/check/testdata/operators/builtin/fail_assignment_to_non_assignable.carbon index 816a3043b61d..2f843beb6bf6 100644 --- a/toolchain/check/testdata/operators/builtin/fail_assignment_to_non_assignable.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_assignment_to_non_assignable.carbon @@ -15,32 +15,66 @@ fn F() -> i32; fn Main() { - // CHECK:STDERR: fail_assignment_to_non_assignable.carbon:[[@LINE+2]]:3: error: expression is not assignable [AssignmentToNonAssignable] + // CHECK:STDERR: ╭─┤ fail_assignment_to_non_assignable.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ 1 = 2; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expression is not assignable [AssignmentToNonAssignable] + // CHECK:STDERR: ╰──── // CHECK:STDERR: 1 = 2; - // CHECK:STDERR: fail_assignment_to_non_assignable.carbon:[[@LINE+2]]:3-5: error: expression is not assignable [AssignmentToNonAssignable] + // CHECK:STDERR: ╭─┤ fail_assignment_to_non_assignable.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ F() = 1; + // CHECK:STDERR: · ━┳━ + // CHECK:STDERR: · ┗━━┫ error: expression is not assignable [AssignmentToNonAssignable] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F() = 1; - // CHECK:STDERR: fail_assignment_to_non_assignable.carbon:[[@LINE+2]]:3-8: error: expression is not assignable [AssignmentToNonAssignable] + // CHECK:STDERR: ╭─┤ fail_assignment_to_non_assignable.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ (1, 2) = (3, 4); + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: expression is not assignable [AssignmentToNonAssignable] + // CHECK:STDERR: ╰──── // CHECK:STDERR: (1, 2) = (3, 4); var n: i32 = 0; - // CHECK:STDERR: fail_assignment_to_non_assignable.carbon:[[@LINE+2]]:3-8: error: expression is not assignable [AssignmentToNonAssignable] + // CHECK:STDERR: ╭─┤ fail_assignment_to_non_assignable.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ (n, n) = (1, 2); + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: expression is not assignable [AssignmentToNonAssignable] + // CHECK:STDERR: ╰──── // CHECK:STDERR: (n, n) = (1, 2); - // CHECK:STDERR: fail_assignment_to_non_assignable.carbon:[[@LINE+2]]:3-5: error: expression is not assignable [AssignmentToNonAssignable] + // CHECK:STDERR: ╭─┤ fail_assignment_to_non_assignable.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ i32 = i32*; + // CHECK:STDERR: · ━┳━ + // CHECK:STDERR: · ┗━━┫ error: expression is not assignable [AssignmentToNonAssignable] + // CHECK:STDERR: ╰──── // CHECK:STDERR: i32 = i32*; - // CHECK:STDERR: fail_assignment_to_non_assignable.carbon:[[@LINE+2]]:3-18: error: expression is not assignable [AssignmentToNonAssignable] + // CHECK:STDERR: ╭─┤ fail_assignment_to_non_assignable.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ {.x = 1, .y = 2} = {.x = 3, .y = 4}; + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: expression is not assignable [AssignmentToNonAssignable] + // CHECK:STDERR: ╰──── // CHECK:STDERR: {.x = 1, .y = 2} = {.x = 3, .y = 4}; - // CHECK:STDERR: fail_assignment_to_non_assignable.carbon:[[@LINE+2]]:3-25: error: expression is not assignable [AssignmentToNonAssignable] + // CHECK:STDERR: ╭─┤ fail_assignment_to_non_assignable.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ (if true then 1 else 2) = 3; + // CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: expression is not assignable + // CHECK:STDERR: · ┃ [AssignmentToNonAssignable] + // CHECK:STDERR: ╰──── // CHECK:STDERR: (if true then 1 else 2) = 3; // Under #911, if expressions are never reference expressions. var a: i32; - // CHECK:STDERR: fail_assignment_to_non_assignable.carbon:[[@LINE+2]]:3-25: error: expression is not assignable [AssignmentToNonAssignable] + // CHECK:STDERR: ╭─┤ fail_assignment_to_non_assignable.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ (if true then a else a) = 10; + // CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: expression is not assignable + // CHECK:STDERR: · ┃ [AssignmentToNonAssignable] + // CHECK:STDERR: ╰──── // CHECK:STDERR: (if true then a else a) = 10; } @@ -143,7 +177,7 @@ fn Main() { // CHECK:STDOUT: %T.09f: %SubobjectDestroy.type = symbolic_binding T, 0 [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.type.dea: type = fn_type @T.as_type.as.DestroyImpl.impl.Op, @T.as_type.as.DestroyImpl.impl(%T.09f) [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.6e5: %T.as_type.as.DestroyImpl.impl.Op.type.dea = struct_value () [symbolic] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.687: type = fn_type @SubobjectDestroy.WithSelf.Op.loc42 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.687: type = fn_type @SubobjectDestroy.WithSelf.Op.loc71 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f: %SubobjectDestroy.WithSelf.Op.type.687 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f), @SubobjectDestroy [concrete] // CHECK:STDOUT: %SubobjectDestroy.facet.49a: %SubobjectDestroy.type = facet_value %i32, (%custom_witness.b80) [concrete] @@ -202,201 +236,201 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %int_1.loc20: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %int_2.loc20: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] -// CHECK:STDOUT: %impl.elem0.loc20: %.1b2 = impl_witness_access constants.%Copy.impl_witness.0b3, element0 [concrete = constants.%Core.IntLiteral.as.Copy.impl.Op] -// CHECK:STDOUT: %bound_method.loc20: = bound_method %int_2.loc20, %impl.elem0.loc20 [concrete = constants.%Core.IntLiteral.as.Copy.impl.Op.bound.e21] -// CHECK:STDOUT: %Core.IntLiteral.as.Copy.impl.Op.call.loc20: init Core.IntLiteral = call %bound_method.loc20(%int_2.loc20) [concrete = constants.%int_2.ecc] -// CHECK:STDOUT: assign %int_1.loc20, %Core.IntLiteral.as.Copy.impl.Op.call.loc20 +// CHECK:STDOUT: %int_1.loc24: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %int_2.loc24: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] +// CHECK:STDOUT: %impl.elem0.loc24: %.1b2 = impl_witness_access constants.%Copy.impl_witness.0b3, element0 [concrete = constants.%Core.IntLiteral.as.Copy.impl.Op] +// CHECK:STDOUT: %bound_method.loc24: = bound_method %int_2.loc24, %impl.elem0.loc24 [concrete = constants.%Core.IntLiteral.as.Copy.impl.Op.bound.e21] +// CHECK:STDOUT: %Core.IntLiteral.as.Copy.impl.Op.call.loc24: init Core.IntLiteral = call %bound_method.loc24(%int_2.loc24) [concrete = constants.%int_2.ecc] +// CHECK:STDOUT: assign %int_1.loc24, %Core.IntLiteral.as.Copy.impl.Op.call.loc24 // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] // CHECK:STDOUT: %F.call: init %i32 = call %F.ref() -// CHECK:STDOUT: %int_1.loc23: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %impl.elem0.loc23: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc23_7.1: = bound_method %int_1.loc23, %impl.elem0.loc23 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282] -// CHECK:STDOUT: %specific_fn.loc23: = specific_function %impl.elem0.loc23, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc23_7.2: = bound_method %int_1.loc23, %specific_fn.loc23 [concrete = constants.%bound_method.3bd] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc23: init %i32 = call %bound_method.loc23_7.2(%int_1.loc23) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc23: init %i32 = converted %int_1.loc23, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc23 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: assign %F.call, %.loc23 -// CHECK:STDOUT: %int_1.loc26: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %int_2.loc26: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] -// CHECK:STDOUT: %.loc26_8.1: %tuple.type.f94 = tuple_literal (%int_1.loc26, %int_2.loc26) [concrete = constants.%tuple.ad8] -// CHECK:STDOUT: %int_3.loc26: Core.IntLiteral = int_value 3 [concrete = constants.%int_3.1ba] -// CHECK:STDOUT: %int_4.loc26: Core.IntLiteral = int_value 4 [concrete = constants.%int_4] -// CHECK:STDOUT: %.loc26_17.1: %tuple.type.f94 = tuple_literal (%int_3.loc26, %int_4.loc26) [concrete = constants.%tuple.302] -// CHECK:STDOUT: %impl.elem0.loc26_13: %.1b2 = impl_witness_access constants.%Copy.impl_witness.0b3, element0 [concrete = constants.%Core.IntLiteral.as.Copy.impl.Op] -// CHECK:STDOUT: %bound_method.loc26_13: = bound_method %int_3.loc26, %impl.elem0.loc26_13 [concrete = constants.%Core.IntLiteral.as.Copy.impl.Op.bound.64e] -// CHECK:STDOUT: %Core.IntLiteral.as.Copy.impl.Op.call.loc26_13: init Core.IntLiteral = call %bound_method.loc26_13(%int_3.loc26) [concrete = constants.%int_3.1ba] -// CHECK:STDOUT: %tuple.elem0.loc26: Core.IntLiteral = tuple_access %.loc26_8.1, element0 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %.loc26_17.2: init Core.IntLiteral to %tuple.elem0.loc26 = in_place_init %Core.IntLiteral.as.Copy.impl.Op.call.loc26_13 [concrete = constants.%int_3.1ba] -// CHECK:STDOUT: %impl.elem0.loc26_16: %.1b2 = impl_witness_access constants.%Copy.impl_witness.0b3, element0 [concrete = constants.%Core.IntLiteral.as.Copy.impl.Op] -// CHECK:STDOUT: %bound_method.loc26_16: = bound_method %int_4.loc26, %impl.elem0.loc26_16 [concrete = constants.%Core.IntLiteral.as.Copy.impl.Op.bound.50f] -// CHECK:STDOUT: %Core.IntLiteral.as.Copy.impl.Op.call.loc26_16: init Core.IntLiteral = call %bound_method.loc26_16(%int_4.loc26) [concrete = constants.%int_4] -// CHECK:STDOUT: %tuple.elem1.loc26: Core.IntLiteral = tuple_access %.loc26_8.1, element1 [concrete = constants.%int_2.ecc] -// CHECK:STDOUT: %.loc26_17.3: init Core.IntLiteral to %tuple.elem1.loc26 = in_place_init %Core.IntLiteral.as.Copy.impl.Op.call.loc26_16 [concrete = constants.%int_4] -// CHECK:STDOUT: %.loc26_17.4: init %tuple.type.f94 to %.loc26_8.1 = tuple_init (%.loc26_17.2, %.loc26_17.3) [concrete = constants.%tuple.302] -// CHECK:STDOUT: %.loc26_10: init %tuple.type.f94 = converted %.loc26_17.1, %.loc26_17.4 [concrete = constants.%tuple.302] -// CHECK:STDOUT: assign %.loc26_8.1, %.loc26_10 -// CHECK:STDOUT: %tuple.loc26: %tuple.type.f94 = tuple_value (%int_1.loc26, %int_2.loc26) [concrete = constants.%tuple.ad8] -// CHECK:STDOUT: %.loc26_8.2: %tuple.type.f94 = converted %.loc26_8.1, %tuple.loc26 [concrete = constants.%tuple.ad8] +// CHECK:STDOUT: %int_1.loc31: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %impl.elem0.loc31: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc31_7.1: = bound_method %int_1.loc31, %impl.elem0.loc31 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282] +// CHECK:STDOUT: %specific_fn.loc31: = specific_function %impl.elem0.loc31, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc31_7.2: = bound_method %int_1.loc31, %specific_fn.loc31 [concrete = constants.%bound_method.3bd] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc31: init %i32 = call %bound_method.loc31_7.2(%int_1.loc31) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc31: init %i32 = converted %int_1.loc31, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc31 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: assign %F.call, %.loc31 +// CHECK:STDOUT: %int_1.loc38: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %int_2.loc38: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] +// CHECK:STDOUT: %.loc38_8.1: %tuple.type.f94 = tuple_literal (%int_1.loc38, %int_2.loc38) [concrete = constants.%tuple.ad8] +// CHECK:STDOUT: %int_3.loc38: Core.IntLiteral = int_value 3 [concrete = constants.%int_3.1ba] +// CHECK:STDOUT: %int_4.loc38: Core.IntLiteral = int_value 4 [concrete = constants.%int_4] +// CHECK:STDOUT: %.loc38_17.1: %tuple.type.f94 = tuple_literal (%int_3.loc38, %int_4.loc38) [concrete = constants.%tuple.302] +// CHECK:STDOUT: %impl.elem0.loc38_13: %.1b2 = impl_witness_access constants.%Copy.impl_witness.0b3, element0 [concrete = constants.%Core.IntLiteral.as.Copy.impl.Op] +// CHECK:STDOUT: %bound_method.loc38_13: = bound_method %int_3.loc38, %impl.elem0.loc38_13 [concrete = constants.%Core.IntLiteral.as.Copy.impl.Op.bound.64e] +// CHECK:STDOUT: %Core.IntLiteral.as.Copy.impl.Op.call.loc38_13: init Core.IntLiteral = call %bound_method.loc38_13(%int_3.loc38) [concrete = constants.%int_3.1ba] +// CHECK:STDOUT: %tuple.elem0.loc38: Core.IntLiteral = tuple_access %.loc38_8.1, element0 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %.loc38_17.2: init Core.IntLiteral to %tuple.elem0.loc38 = in_place_init %Core.IntLiteral.as.Copy.impl.Op.call.loc38_13 [concrete = constants.%int_3.1ba] +// CHECK:STDOUT: %impl.elem0.loc38_16: %.1b2 = impl_witness_access constants.%Copy.impl_witness.0b3, element0 [concrete = constants.%Core.IntLiteral.as.Copy.impl.Op] +// CHECK:STDOUT: %bound_method.loc38_16: = bound_method %int_4.loc38, %impl.elem0.loc38_16 [concrete = constants.%Core.IntLiteral.as.Copy.impl.Op.bound.50f] +// CHECK:STDOUT: %Core.IntLiteral.as.Copy.impl.Op.call.loc38_16: init Core.IntLiteral = call %bound_method.loc38_16(%int_4.loc38) [concrete = constants.%int_4] +// CHECK:STDOUT: %tuple.elem1.loc38: Core.IntLiteral = tuple_access %.loc38_8.1, element1 [concrete = constants.%int_2.ecc] +// CHECK:STDOUT: %.loc38_17.3: init Core.IntLiteral to %tuple.elem1.loc38 = in_place_init %Core.IntLiteral.as.Copy.impl.Op.call.loc38_16 [concrete = constants.%int_4] +// CHECK:STDOUT: %.loc38_17.4: init %tuple.type.f94 to %.loc38_8.1 = tuple_init (%.loc38_17.2, %.loc38_17.3) [concrete = constants.%tuple.302] +// CHECK:STDOUT: %.loc38_10: init %tuple.type.f94 = converted %.loc38_17.1, %.loc38_17.4 [concrete = constants.%tuple.302] +// CHECK:STDOUT: assign %.loc38_8.1, %.loc38_10 +// CHECK:STDOUT: %tuple.loc38: %tuple.type.f94 = tuple_value (%int_1.loc38, %int_2.loc38) [concrete = constants.%tuple.ad8] +// CHECK:STDOUT: %.loc38_8.2: %tuple.type.f94 = converted %.loc38_8.1, %tuple.loc38 [concrete = constants.%tuple.ad8] // CHECK:STDOUT: %n.var: ref %i32 = var_storage %n.var_patt // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] -// CHECK:STDOUT: %impl.elem0.loc27: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc27_3.1: = bound_method %int_0, %impl.elem0.loc27 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.762] -// CHECK:STDOUT: %specific_fn.loc27: = specific_function %impl.elem0.loc27, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc27_3.2: = bound_method %int_0, %specific_fn.loc27 [concrete = constants.%bound_method.036] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc27: init %i32 = call %bound_method.loc27_3.2(%int_0) [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc27_3.1: init %i32 = converted %int_0, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc27 [concrete = constants.%int_0.753] -// CHECK:STDOUT: assign %n.var, %.loc27_3.1 -// CHECK:STDOUT: %i32.loc27: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %impl.elem0.loc39: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc39_3.1: = bound_method %int_0, %impl.elem0.loc39 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.762] +// CHECK:STDOUT: %specific_fn.loc39: = specific_function %impl.elem0.loc39, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc39_3.2: = bound_method %int_0, %specific_fn.loc39 [concrete = constants.%bound_method.036] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc39: init %i32 = call %bound_method.loc39_3.2(%int_0) [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc39_3.1: init %i32 = converted %int_0, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc39 [concrete = constants.%int_0.753] +// CHECK:STDOUT: assign %n.var, %.loc39_3.1 +// CHECK:STDOUT: %i32.loc39: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %n: ref %i32 = wrapper_binding n, %n.var // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %n.patt: %pattern_type.d94 = ref_binding_pattern n [concrete = constants.%n.patt] // CHECK:STDOUT: %n.var_patt: %pattern_type.d94 = var_pattern %n.patt [concrete = constants.%n.var_patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %n.ref.loc30_4: ref %i32 = name_ref n, %n -// CHECK:STDOUT: %n.ref.loc30_7: ref %i32 = name_ref n, %n -// CHECK:STDOUT: %.loc30_8.1: %tuple.type.35f = tuple_literal (%n.ref.loc30_4, %n.ref.loc30_7) -// CHECK:STDOUT: %int_1.loc30: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %int_2.loc30: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] -// CHECK:STDOUT: %.loc30_17.1: %tuple.type.f94 = tuple_literal (%int_1.loc30, %int_2.loc30) [concrete = constants.%tuple.ad8] -// CHECK:STDOUT: %impl.elem0.loc30_17.1: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc30_17.1: = bound_method %int_1.loc30, %impl.elem0.loc30_17.1 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282] -// CHECK:STDOUT: %specific_fn.loc30_17.1: = specific_function %impl.elem0.loc30_17.1, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc30_17.2: = bound_method %int_1.loc30, %specific_fn.loc30_17.1 [concrete = constants.%bound_method.3bd] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc30_17.1: init %i32 = call %bound_method.loc30_17.2(%int_1.loc30) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc30_17.2: init %i32 = converted %int_1.loc30, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc30_17.1 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %tuple.elem0.loc30: %i32 = tuple_access %.loc30_8.1, element0 -// CHECK:STDOUT: %.loc30_17.3: init %i32 to %tuple.elem0.loc30 = in_place_init %.loc30_17.2 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %impl.elem0.loc30_17.2: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc30_17.3: = bound_method %int_2.loc30, %impl.elem0.loc30_17.2 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.8a6] -// CHECK:STDOUT: %specific_fn.loc30_17.2: = specific_function %impl.elem0.loc30_17.2, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc30_17.4: = bound_method %int_2.loc30, %specific_fn.loc30_17.2 [concrete = constants.%bound_method.a55] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc30_17.2: init %i32 = call %bound_method.loc30_17.4(%int_2.loc30) [concrete = constants.%int_2.2e0] -// CHECK:STDOUT: %.loc30_17.4: init %i32 = converted %int_2.loc30, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc30_17.2 [concrete = constants.%int_2.2e0] -// CHECK:STDOUT: %tuple.elem1.loc30: %i32 = tuple_access %.loc30_8.1, element1 -// CHECK:STDOUT: %.loc30_17.5: init %i32 to %tuple.elem1.loc30 = in_place_init %.loc30_17.4 [concrete = constants.%int_2.2e0] -// CHECK:STDOUT: %.loc30_17.6: init %tuple.type.35f to %.loc30_8.1 = tuple_init (%.loc30_17.3, %.loc30_17.5) [concrete = constants.%tuple.380] -// CHECK:STDOUT: %.loc30_10: init %tuple.type.35f = converted %.loc30_17.1, %.loc30_17.6 [concrete = constants.%tuple.380] -// CHECK:STDOUT: assign %.loc30_8.1, %.loc30_10 -// CHECK:STDOUT: %.loc30_4: %i32 = acquire_value %n.ref.loc30_4 -// CHECK:STDOUT: %.loc30_7: %i32 = acquire_value %n.ref.loc30_7 -// CHECK:STDOUT: %tuple.loc30: %tuple.type.35f = tuple_value (%.loc30_4, %.loc30_7) -// CHECK:STDOUT: %.loc30_8.2: %tuple.type.35f = converted %.loc30_8.1, %tuple.loc30 -// CHECK:STDOUT: %i32.loc33_3: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %i32.loc33_9: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %ptr: type = ptr_type %i32.loc33_9 [concrete = constants.%ptr.a17] -// CHECK:STDOUT: %impl.elem0.loc33: %.cd2 = impl_witness_access constants.%Copy.impl_witness.f3e, element0 [concrete = constants.%type.as.Copy.impl.Op] -// CHECK:STDOUT: %bound_method.loc33: = bound_method %ptr, %impl.elem0.loc33 [concrete = constants.%type.as.Copy.impl.Op.bound] -// CHECK:STDOUT: %type.as.Copy.impl.Op.call: init type = call %bound_method.loc33(%ptr) [concrete = constants.%ptr.a17] -// CHECK:STDOUT: assign %i32.loc33_3, %type.as.Copy.impl.Op.call -// CHECK:STDOUT: %int_1.loc36: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %int_2.loc36: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] -// CHECK:STDOUT: %.loc36_18.1: %struct_type.x.y = struct_literal (%int_1.loc36, %int_2.loc36) [concrete = constants.%struct.004] -// CHECK:STDOUT: %int_3.loc36: Core.IntLiteral = int_value 3 [concrete = constants.%int_3.1ba] -// CHECK:STDOUT: %int_4.loc36: Core.IntLiteral = int_value 4 [concrete = constants.%int_4] -// CHECK:STDOUT: %.loc36_37.1: %struct_type.x.y = struct_literal (%int_3.loc36, %int_4.loc36) [concrete = constants.%struct.a0d] -// CHECK:STDOUT: %impl.elem0.loc36_28: %.1b2 = impl_witness_access constants.%Copy.impl_witness.0b3, element0 [concrete = constants.%Core.IntLiteral.as.Copy.impl.Op] -// CHECK:STDOUT: %bound_method.loc36_28: = bound_method %int_3.loc36, %impl.elem0.loc36_28 [concrete = constants.%Core.IntLiteral.as.Copy.impl.Op.bound.64e] -// CHECK:STDOUT: %Core.IntLiteral.as.Copy.impl.Op.call.loc36_28: init Core.IntLiteral = call %bound_method.loc36_28(%int_3.loc36) [concrete = constants.%int_3.1ba] -// CHECK:STDOUT: %.loc36_37.2: Core.IntLiteral = struct_access %.loc36_18.1, element0 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %.loc36_37.3: init Core.IntLiteral to %.loc36_37.2 = in_place_init %Core.IntLiteral.as.Copy.impl.Op.call.loc36_28 [concrete = constants.%int_3.1ba] -// CHECK:STDOUT: %impl.elem0.loc36_36: %.1b2 = impl_witness_access constants.%Copy.impl_witness.0b3, element0 [concrete = constants.%Core.IntLiteral.as.Copy.impl.Op] -// CHECK:STDOUT: %bound_method.loc36_36: = bound_method %int_4.loc36, %impl.elem0.loc36_36 [concrete = constants.%Core.IntLiteral.as.Copy.impl.Op.bound.50f] -// CHECK:STDOUT: %Core.IntLiteral.as.Copy.impl.Op.call.loc36_36: init Core.IntLiteral = call %bound_method.loc36_36(%int_4.loc36) [concrete = constants.%int_4] -// CHECK:STDOUT: %.loc36_37.4: Core.IntLiteral = struct_access %.loc36_18.1, element1 [concrete = constants.%int_2.ecc] -// CHECK:STDOUT: %.loc36_37.5: init Core.IntLiteral to %.loc36_37.4 = in_place_init %Core.IntLiteral.as.Copy.impl.Op.call.loc36_36 [concrete = constants.%int_4] -// CHECK:STDOUT: %.loc36_37.6: init %struct_type.x.y to %.loc36_18.1 = struct_init (%.loc36_37.3, %.loc36_37.5) [concrete = constants.%struct.a0d] -// CHECK:STDOUT: %.loc36_20: init %struct_type.x.y = converted %.loc36_37.1, %.loc36_37.6 [concrete = constants.%struct.a0d] -// CHECK:STDOUT: assign %.loc36_18.1, %.loc36_20 -// CHECK:STDOUT: %struct: %struct_type.x.y = struct_value (%int_1.loc36, %int_2.loc36) [concrete = constants.%struct.004] -// CHECK:STDOUT: %.loc36_18.2: %struct_type.x.y = converted %.loc36_18.1, %struct [concrete = constants.%struct.004] -// CHECK:STDOUT: %true.loc39: bool = bool_literal true [concrete = constants.%true] -// CHECK:STDOUT: if %true.loc39 br !if.expr.then.loc39 else br !if.expr.else.loc39 +// CHECK:STDOUT: %n.ref.loc46_4: ref %i32 = name_ref n, %n +// CHECK:STDOUT: %n.ref.loc46_7: ref %i32 = name_ref n, %n +// CHECK:STDOUT: %.loc46_8.1: %tuple.type.35f = tuple_literal (%n.ref.loc46_4, %n.ref.loc46_7) +// CHECK:STDOUT: %int_1.loc46: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %int_2.loc46: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] +// CHECK:STDOUT: %.loc46_17.1: %tuple.type.f94 = tuple_literal (%int_1.loc46, %int_2.loc46) [concrete = constants.%tuple.ad8] +// CHECK:STDOUT: %impl.elem0.loc46_17.1: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc46_17.1: = bound_method %int_1.loc46, %impl.elem0.loc46_17.1 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282] +// CHECK:STDOUT: %specific_fn.loc46_17.1: = specific_function %impl.elem0.loc46_17.1, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc46_17.2: = bound_method %int_1.loc46, %specific_fn.loc46_17.1 [concrete = constants.%bound_method.3bd] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc46_17.1: init %i32 = call %bound_method.loc46_17.2(%int_1.loc46) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc46_17.2: init %i32 = converted %int_1.loc46, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc46_17.1 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %tuple.elem0.loc46: %i32 = tuple_access %.loc46_8.1, element0 +// CHECK:STDOUT: %.loc46_17.3: init %i32 to %tuple.elem0.loc46 = in_place_init %.loc46_17.2 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %impl.elem0.loc46_17.2: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc46_17.3: = bound_method %int_2.loc46, %impl.elem0.loc46_17.2 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.8a6] +// CHECK:STDOUT: %specific_fn.loc46_17.2: = specific_function %impl.elem0.loc46_17.2, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc46_17.4: = bound_method %int_2.loc46, %specific_fn.loc46_17.2 [concrete = constants.%bound_method.a55] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc46_17.2: init %i32 = call %bound_method.loc46_17.4(%int_2.loc46) [concrete = constants.%int_2.2e0] +// CHECK:STDOUT: %.loc46_17.4: init %i32 = converted %int_2.loc46, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc46_17.2 [concrete = constants.%int_2.2e0] +// CHECK:STDOUT: %tuple.elem1.loc46: %i32 = tuple_access %.loc46_8.1, element1 +// CHECK:STDOUT: %.loc46_17.5: init %i32 to %tuple.elem1.loc46 = in_place_init %.loc46_17.4 [concrete = constants.%int_2.2e0] +// CHECK:STDOUT: %.loc46_17.6: init %tuple.type.35f to %.loc46_8.1 = tuple_init (%.loc46_17.3, %.loc46_17.5) [concrete = constants.%tuple.380] +// CHECK:STDOUT: %.loc46_10: init %tuple.type.35f = converted %.loc46_17.1, %.loc46_17.6 [concrete = constants.%tuple.380] +// CHECK:STDOUT: assign %.loc46_8.1, %.loc46_10 +// CHECK:STDOUT: %.loc46_4: %i32 = acquire_value %n.ref.loc46_4 +// CHECK:STDOUT: %.loc46_7: %i32 = acquire_value %n.ref.loc46_7 +// CHECK:STDOUT: %tuple.loc46: %tuple.type.35f = tuple_value (%.loc46_4, %.loc46_7) +// CHECK:STDOUT: %.loc46_8.2: %tuple.type.35f = converted %.loc46_8.1, %tuple.loc46 +// CHECK:STDOUT: %i32.loc53_3: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc53_9: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %ptr: type = ptr_type %i32.loc53_9 [concrete = constants.%ptr.a17] +// CHECK:STDOUT: %impl.elem0.loc53: %.cd2 = impl_witness_access constants.%Copy.impl_witness.f3e, element0 [concrete = constants.%type.as.Copy.impl.Op] +// CHECK:STDOUT: %bound_method.loc53: = bound_method %ptr, %impl.elem0.loc53 [concrete = constants.%type.as.Copy.impl.Op.bound] +// CHECK:STDOUT: %type.as.Copy.impl.Op.call: init type = call %bound_method.loc53(%ptr) [concrete = constants.%ptr.a17] +// CHECK:STDOUT: assign %i32.loc53_3, %type.as.Copy.impl.Op.call +// CHECK:STDOUT: %int_1.loc60: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %int_2.loc60: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] +// CHECK:STDOUT: %.loc60_18.1: %struct_type.x.y = struct_literal (%int_1.loc60, %int_2.loc60) [concrete = constants.%struct.004] +// CHECK:STDOUT: %int_3.loc60: Core.IntLiteral = int_value 3 [concrete = constants.%int_3.1ba] +// CHECK:STDOUT: %int_4.loc60: Core.IntLiteral = int_value 4 [concrete = constants.%int_4] +// CHECK:STDOUT: %.loc60_37.1: %struct_type.x.y = struct_literal (%int_3.loc60, %int_4.loc60) [concrete = constants.%struct.a0d] +// CHECK:STDOUT: %impl.elem0.loc60_28: %.1b2 = impl_witness_access constants.%Copy.impl_witness.0b3, element0 [concrete = constants.%Core.IntLiteral.as.Copy.impl.Op] +// CHECK:STDOUT: %bound_method.loc60_28: = bound_method %int_3.loc60, %impl.elem0.loc60_28 [concrete = constants.%Core.IntLiteral.as.Copy.impl.Op.bound.64e] +// CHECK:STDOUT: %Core.IntLiteral.as.Copy.impl.Op.call.loc60_28: init Core.IntLiteral = call %bound_method.loc60_28(%int_3.loc60) [concrete = constants.%int_3.1ba] +// CHECK:STDOUT: %.loc60_37.2: Core.IntLiteral = struct_access %.loc60_18.1, element0 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %.loc60_37.3: init Core.IntLiteral to %.loc60_37.2 = in_place_init %Core.IntLiteral.as.Copy.impl.Op.call.loc60_28 [concrete = constants.%int_3.1ba] +// CHECK:STDOUT: %impl.elem0.loc60_36: %.1b2 = impl_witness_access constants.%Copy.impl_witness.0b3, element0 [concrete = constants.%Core.IntLiteral.as.Copy.impl.Op] +// CHECK:STDOUT: %bound_method.loc60_36: = bound_method %int_4.loc60, %impl.elem0.loc60_36 [concrete = constants.%Core.IntLiteral.as.Copy.impl.Op.bound.50f] +// CHECK:STDOUT: %Core.IntLiteral.as.Copy.impl.Op.call.loc60_36: init Core.IntLiteral = call %bound_method.loc60_36(%int_4.loc60) [concrete = constants.%int_4] +// CHECK:STDOUT: %.loc60_37.4: Core.IntLiteral = struct_access %.loc60_18.1, element1 [concrete = constants.%int_2.ecc] +// CHECK:STDOUT: %.loc60_37.5: init Core.IntLiteral to %.loc60_37.4 = in_place_init %Core.IntLiteral.as.Copy.impl.Op.call.loc60_36 [concrete = constants.%int_4] +// CHECK:STDOUT: %.loc60_37.6: init %struct_type.x.y to %.loc60_18.1 = struct_init (%.loc60_37.3, %.loc60_37.5) [concrete = constants.%struct.a0d] +// CHECK:STDOUT: %.loc60_20: init %struct_type.x.y = converted %.loc60_37.1, %.loc60_37.6 [concrete = constants.%struct.a0d] +// CHECK:STDOUT: assign %.loc60_18.1, %.loc60_20 +// CHECK:STDOUT: %struct: %struct_type.x.y = struct_value (%int_1.loc60, %int_2.loc60) [concrete = constants.%struct.004] +// CHECK:STDOUT: %.loc60_18.2: %struct_type.x.y = converted %.loc60_18.1, %struct [concrete = constants.%struct.004] +// CHECK:STDOUT: %true.loc68: bool = bool_literal true [concrete = constants.%true] +// CHECK:STDOUT: if %true.loc68 br !if.expr.then.loc68 else br !if.expr.else.loc68 // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc39: -// CHECK:STDOUT: %int_1.loc39: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %impl.elem0.loc39_12: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc39_12.1: = bound_method %int_1.loc39, %impl.elem0.loc39_12 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282] -// CHECK:STDOUT: %specific_fn.loc39_12: = specific_function %impl.elem0.loc39_12, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc39_12.2: = bound_method %int_1.loc39, %specific_fn.loc39_12 [concrete = constants.%bound_method.3bd] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc39_12: init %i32 = call %bound_method.loc39_12.2(%int_1.loc39) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc39_12.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc39_12 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc39_12.2: %i32 = converted %int_1.loc39, %.loc39_12.1 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: br !if.expr.result.loc39(%.loc39_12.2) +// CHECK:STDOUT: !if.expr.then.loc68: +// CHECK:STDOUT: %int_1.loc68: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %impl.elem0.loc68_12: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc68_12.1: = bound_method %int_1.loc68, %impl.elem0.loc68_12 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282] +// CHECK:STDOUT: %specific_fn.loc68_12: = specific_function %impl.elem0.loc68_12, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc68_12.2: = bound_method %int_1.loc68, %specific_fn.loc68_12 [concrete = constants.%bound_method.3bd] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc68_12: init %i32 = call %bound_method.loc68_12.2(%int_1.loc68) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc68_12.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc68_12 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc68_12.2: %i32 = converted %int_1.loc68, %.loc68_12.1 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: br !if.expr.result.loc68(%.loc68_12.2) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc39: -// CHECK:STDOUT: %int_2.loc39: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] -// CHECK:STDOUT: %impl.elem0.loc39_19: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc39_19.1: = bound_method %int_2.loc39, %impl.elem0.loc39_19 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.8a6] -// CHECK:STDOUT: %specific_fn.loc39_19: = specific_function %impl.elem0.loc39_19, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc39_19.2: = bound_method %int_2.loc39, %specific_fn.loc39_19 [concrete = constants.%bound_method.a55] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc39_19: init %i32 = call %bound_method.loc39_19.2(%int_2.loc39) [concrete = constants.%int_2.2e0] -// CHECK:STDOUT: %.loc39_19.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc39_19 [concrete = constants.%int_2.2e0] -// CHECK:STDOUT: %.loc39_19.2: %i32 = converted %int_2.loc39, %.loc39_19.1 [concrete = constants.%int_2.2e0] -// CHECK:STDOUT: br !if.expr.result.loc39(%.loc39_19.2) +// CHECK:STDOUT: !if.expr.else.loc68: +// CHECK:STDOUT: %int_2.loc68: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] +// CHECK:STDOUT: %impl.elem0.loc68_19: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc68_19.1: = bound_method %int_2.loc68, %impl.elem0.loc68_19 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.8a6] +// CHECK:STDOUT: %specific_fn.loc68_19: = specific_function %impl.elem0.loc68_19, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc68_19.2: = bound_method %int_2.loc68, %specific_fn.loc68_19 [concrete = constants.%bound_method.a55] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc68_19: init %i32 = call %bound_method.loc68_19.2(%int_2.loc68) [concrete = constants.%int_2.2e0] +// CHECK:STDOUT: %.loc68_19.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc68_19 [concrete = constants.%int_2.2e0] +// CHECK:STDOUT: %.loc68_19.2: %i32 = converted %int_2.loc68, %.loc68_19.1 [concrete = constants.%int_2.2e0] +// CHECK:STDOUT: br !if.expr.result.loc68(%.loc68_19.2) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc39: -// CHECK:STDOUT: %.loc39_4: %i32 = block_arg !if.expr.result.loc39 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %int_3.loc39: Core.IntLiteral = int_value 3 [concrete = constants.%int_3.1ba] -// CHECK:STDOUT: %impl.elem0.loc39_27: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc39_27.1: = bound_method %int_3.loc39, %impl.elem0.loc39_27 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.b3c] -// CHECK:STDOUT: %specific_fn.loc39_27: = specific_function %impl.elem0.loc39_27, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc39_27.2: = bound_method %int_3.loc39, %specific_fn.loc39_27 [concrete = constants.%bound_method.fb0] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc39_27: init %i32 = call %bound_method.loc39_27.2(%int_3.loc39) [concrete = constants.%int_3.9f3] -// CHECK:STDOUT: %.loc39_27: init %i32 = converted %int_3.loc39, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc39_27 [concrete = constants.%int_3.9f3] -// CHECK:STDOUT: assign %.loc39_4, %.loc39_27 +// CHECK:STDOUT: !if.expr.result.loc68: +// CHECK:STDOUT: %.loc68_4: %i32 = block_arg !if.expr.result.loc68 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %int_3.loc68: Core.IntLiteral = int_value 3 [concrete = constants.%int_3.1ba] +// CHECK:STDOUT: %impl.elem0.loc68_27: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc68_27.1: = bound_method %int_3.loc68, %impl.elem0.loc68_27 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.b3c] +// CHECK:STDOUT: %specific_fn.loc68_27: = specific_function %impl.elem0.loc68_27, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc68_27.2: = bound_method %int_3.loc68, %specific_fn.loc68_27 [concrete = constants.%bound_method.fb0] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc68_27: init %i32 = call %bound_method.loc68_27.2(%int_3.loc68) [concrete = constants.%int_3.9f3] +// CHECK:STDOUT: %.loc68_27: init %i32 = converted %int_3.loc68, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc68_27 [concrete = constants.%int_3.9f3] +// CHECK:STDOUT: assign %.loc68_4, %.loc68_27 // CHECK:STDOUT: %a.var: ref %i32 = var_storage %a.var_patt // CHECK:STDOUT: %DefaultOrUnformed.facet: %DefaultOrUnformed.type = facet_value constants.%i32, (constants.%DefaultOrUnformed.impl_witness.29f) [concrete = constants.%DefaultOrUnformed.facet] -// CHECK:STDOUT: %.loc42_13.1: %DefaultOrUnformed.type = converted constants.%i32, %DefaultOrUnformed.facet [concrete = constants.%DefaultOrUnformed.facet] -// CHECK:STDOUT: %as_type: type = facet_access_type %.loc42_13.1 [concrete = constants.%i32] -// CHECK:STDOUT: %.loc42_13.2: type = converted %.loc42_13.1, %as_type [concrete = constants.%i32] +// CHECK:STDOUT: %.loc71_13.1: %DefaultOrUnformed.type = converted constants.%i32, %DefaultOrUnformed.facet [concrete = constants.%DefaultOrUnformed.facet] +// CHECK:STDOUT: %as_type: type = facet_access_type %.loc71_13.1 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc71_13.2: type = converted %.loc71_13.1, %as_type [concrete = constants.%i32] // CHECK:STDOUT: %T.as.DefaultOrUnformed.impl.Op.specific_fn: = specific_function constants.%T.as.DefaultOrUnformed.impl.Op.720, @T.as.DefaultOrUnformed.impl.Op(constants.%i32) [concrete = constants.%T.as.DefaultOrUnformed.impl.Op.specific_fn] // CHECK:STDOUT: %T.as.DefaultOrUnformed.impl.Op.call: init %i32 = call %T.as.DefaultOrUnformed.impl.Op.specific_fn() // CHECK:STDOUT: assign %a.var, %T.as.DefaultOrUnformed.impl.Op.call -// CHECK:STDOUT: %i32.loc42: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc71: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %a: ref %i32 = wrapper_binding a, %a.var // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %a.patt: %pattern_type.d94 = ref_binding_pattern a [concrete = constants.%a.patt] // CHECK:STDOUT: %a.var_patt: %pattern_type.d94 = var_pattern %a.patt [concrete = constants.%a.var_patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %true.loc45: bool = bool_literal true [concrete = constants.%true] -// CHECK:STDOUT: if %true.loc45 br !if.expr.then.loc45 else br !if.expr.else.loc45 +// CHECK:STDOUT: %true.loc79: bool = bool_literal true [concrete = constants.%true] +// CHECK:STDOUT: if %true.loc79 br !if.expr.then.loc79 else br !if.expr.else.loc79 // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc45: -// CHECK:STDOUT: %a.ref.loc45_17: ref %i32 = name_ref a, %a -// CHECK:STDOUT: %.loc45_17: %i32 = acquire_value %a.ref.loc45_17 -// CHECK:STDOUT: br !if.expr.result.loc45(%.loc45_17) +// CHECK:STDOUT: !if.expr.then.loc79: +// CHECK:STDOUT: %a.ref.loc79_17: ref %i32 = name_ref a, %a +// CHECK:STDOUT: %.loc79_17: %i32 = acquire_value %a.ref.loc79_17 +// CHECK:STDOUT: br !if.expr.result.loc79(%.loc79_17) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc45: -// CHECK:STDOUT: %a.ref.loc45_24: ref %i32 = name_ref a, %a -// CHECK:STDOUT: %.loc45_24: %i32 = acquire_value %a.ref.loc45_24 -// CHECK:STDOUT: br !if.expr.result.loc45(%.loc45_24) +// CHECK:STDOUT: !if.expr.else.loc79: +// CHECK:STDOUT: %a.ref.loc79_24: ref %i32 = name_ref a, %a +// CHECK:STDOUT: %.loc79_24: %i32 = acquire_value %a.ref.loc79_24 +// CHECK:STDOUT: br !if.expr.result.loc79(%.loc79_24) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc45: -// CHECK:STDOUT: %.loc45_4: %i32 = block_arg !if.expr.result.loc45 +// CHECK:STDOUT: !if.expr.result.loc79: +// CHECK:STDOUT: %.loc79_4: %i32 = block_arg !if.expr.result.loc79 // CHECK:STDOUT: %int_10: Core.IntLiteral = int_value 10 [concrete = constants.%int_10.64f] -// CHECK:STDOUT: %impl.elem0.loc45: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc45_27.1: = bound_method %int_10, %impl.elem0.loc45 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.02d] -// CHECK:STDOUT: %specific_fn.loc45: = specific_function %impl.elem0.loc45, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc45_27.2: = bound_method %int_10, %specific_fn.loc45 [concrete = constants.%bound_method.002] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc45: init %i32 = call %bound_method.loc45_27.2(%int_10) [concrete = constants.%int_10.6a3] -// CHECK:STDOUT: %.loc45_27: init %i32 = converted %int_10, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc45 [concrete = constants.%int_10.6a3] -// CHECK:STDOUT: assign %.loc45_4, %.loc45_27 -// CHECK:STDOUT: %Destroy.facet.loc42_3.1: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc42_3.1: %Destroy.type = converted constants.%i32, %Destroy.facet.loc42_3.1 [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %Destroy.facet.loc42_3.2: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc42_3.2: %Destroy.type = converted constants.%i32, %Destroy.facet.loc42_3.2 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %impl.elem0.loc79: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc79_27.1: = bound_method %int_10, %impl.elem0.loc79 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.02d] +// CHECK:STDOUT: %specific_fn.loc79: = specific_function %impl.elem0.loc79, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc79_27.2: = bound_method %int_10, %specific_fn.loc79 [concrete = constants.%bound_method.002] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc79: init %i32 = call %bound_method.loc79_27.2(%int_10) [concrete = constants.%int_10.6a3] +// CHECK:STDOUT: %.loc79_27: init %i32 = converted %int_10, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc79 [concrete = constants.%int_10.6a3] +// CHECK:STDOUT: assign %.loc79_4, %.loc79_27 +// CHECK:STDOUT: %Destroy.facet.loc71_3.1: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc71_3.1: %Destroy.type = converted constants.%i32, %Destroy.facet.loc71_3.1 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %Destroy.facet.loc71_3.2: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc71_3.2: %Destroy.type = converted constants.%i32, %Destroy.facet.loc71_3.2 [concrete = constants.%Destroy.facet] // CHECK:STDOUT: %SelfDestruct.specific_fn.1: = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet) [concrete = constants.%SelfDestruct.specific_fn] -// CHECK:STDOUT: %SelfDestruct.call.loc42: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%a.var) -// CHECK:STDOUT: %Destroy.facet.loc27_3.1: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc27_3.2: %Destroy.type = converted constants.%i32, %Destroy.facet.loc27_3.1 [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %Destroy.facet.loc27_3.2: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc27_3.3: %Destroy.type = converted constants.%i32, %Destroy.facet.loc27_3.2 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %SelfDestruct.call.loc71: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%a.var) +// CHECK:STDOUT: %Destroy.facet.loc39_3.1: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc39_3.2: %Destroy.type = converted constants.%i32, %Destroy.facet.loc39_3.1 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %Destroy.facet.loc39_3.2: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc39_3.3: %Destroy.type = converted constants.%i32, %Destroy.facet.loc39_3.2 [concrete = constants.%Destroy.facet] // CHECK:STDOUT: %SelfDestruct.specific_fn.2: = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet) [concrete = constants.%SelfDestruct.specific_fn] -// CHECK:STDOUT: %SelfDestruct.call.loc27: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%n.var) +// CHECK:STDOUT: %SelfDestruct.call.loc39: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%n.var) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc42(%self.param: ref %i32) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc71(%self.param: ref %i32) = "no_op"; // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/builtin/fail_redundant_compound_access.carbon b/toolchain/check/testdata/operators/builtin/fail_redundant_compound_access.carbon index f7cb33d35c1f..d4385f869f0b 100644 --- a/toolchain/check/testdata/operators/builtin/fail_redundant_compound_access.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_redundant_compound_access.carbon @@ -16,10 +16,22 @@ fn F() -> i32 { return 0; } fn Main() { var a: i32 = 3; - // CHECK:STDERR: fail_redundant_compound_access.carbon:[[@LINE+2]]:7-11: error: member name of type `i32` in compound member access is not an instance member or an interface member [CompoundMemberAccessDoesNotUseBase] + // CHECK:STDERR: ╭─┤ fail_redundant_compound_access.carbon:[[@LINE+8]]:7 + // CHECK:STDERR: -> │ a = a.(a); + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: member name of type `i32` in compound member access is not an + // CHECK:STDERR: · ┃ instance member or an interface member + // CHECK:STDERR: · ┃ [CompoundMemberAccessDoesNotUseBase] + // CHECK:STDERR: ╰──── // CHECK:STDERR: a = a.(a); - // CHECK:STDERR: fail_redundant_compound_access.carbon:[[@LINE+2]]:7-11: error: member name of type `` in compound member access is not an instance member or an interface member [CompoundMemberAccessDoesNotUseBase] + // CHECK:STDERR: ╭─┤ fail_redundant_compound_access.carbon:[[@LINE+8]]:7 + // CHECK:STDERR: -> │ a = a.(F)(); + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: member name of type `` in compound member access is + // CHECK:STDERR: · ┃ not an instance member or an interface member + // CHECK:STDERR: · ┃ [CompoundMemberAccessDoesNotUseBase] + // CHECK:STDERR: ╰──── // CHECK:STDERR: a = a.(F)(); } @@ -160,21 +172,21 @@ fn Main() { // CHECK:STDOUT: %a.patt: %pattern_type.d94 = ref_binding_pattern a [concrete = constants.%a.patt] // CHECK:STDOUT: %a.var_patt: %pattern_type.d94 = var_pattern %a.patt [concrete = constants.%a.var_patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %a.ref.loc21_3: ref %i32 = name_ref a, %a -// CHECK:STDOUT: %a.ref.loc21_7: ref %i32 = name_ref a, %a -// CHECK:STDOUT: %a.ref.loc21_10: ref %i32 = name_ref a, %a -// CHECK:STDOUT: %.loc21: %i32 = acquire_value %a.ref.loc21_10 -// CHECK:STDOUT: %impl.elem0.loc21: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae] -// CHECK:STDOUT: %bound_method.loc21_10.1: = bound_method %.loc21, %impl.elem0.loc21 -// CHECK:STDOUT: %specific_fn.loc21: = specific_function %impl.elem0.loc21, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc21_10.2: = bound_method %.loc21, %specific_fn.loc21 -// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc21_10.2(%.loc21) -// CHECK:STDOUT: assign %a.ref.loc21_3, %Int.as.Copy.impl.Op.call -// CHECK:STDOUT: %a.ref.loc24_3: ref %i32 = name_ref a, %a -// CHECK:STDOUT: %a.ref.loc24_7: ref %i32 = name_ref a, %a +// CHECK:STDOUT: %a.ref.loc27_3: ref %i32 = name_ref a, %a +// CHECK:STDOUT: %a.ref.loc27_7: ref %i32 = name_ref a, %a +// CHECK:STDOUT: %a.ref.loc27_10: ref %i32 = name_ref a, %a +// CHECK:STDOUT: %.loc27: %i32 = acquire_value %a.ref.loc27_10 +// CHECK:STDOUT: %impl.elem0.loc27: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae] +// CHECK:STDOUT: %bound_method.loc27_10.1: = bound_method %.loc27, %impl.elem0.loc27 +// CHECK:STDOUT: %specific_fn.loc27: = specific_function %impl.elem0.loc27, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc27_10.2: = bound_method %.loc27, %specific_fn.loc27 +// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc27_10.2(%.loc27) +// CHECK:STDOUT: assign %a.ref.loc27_3, %Int.as.Copy.impl.Op.call +// CHECK:STDOUT: %a.ref.loc36_3: ref %i32 = name_ref a, %a +// CHECK:STDOUT: %a.ref.loc36_7: ref %i32 = name_ref a, %a // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] // CHECK:STDOUT: %F.call: init %i32 = call %F.ref() -// CHECK:STDOUT: assign %a.ref.loc24_3, %F.call +// CHECK:STDOUT: assign %a.ref.loc36_3, %F.call // CHECK:STDOUT: %Destroy.facet.loc18_3.1: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] // CHECK:STDOUT: %.loc18_3.2: %Destroy.type = converted constants.%i32, %Destroy.facet.loc18_3.1 [concrete = constants.%Destroy.facet] // CHECK:STDOUT: %Destroy.facet.loc18_3.2: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] diff --git a/toolchain/check/testdata/operators/builtin/fail_type_mismatch.carbon b/toolchain/check/testdata/operators/builtin/fail_type_mismatch.carbon index 2e0d16aeb850..19dab190d89e 100644 --- a/toolchain/check/testdata/operators/builtin/fail_type_mismatch.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_type_mismatch.carbon @@ -13,8 +13,16 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/builtin/fail_type_mismatch.carbon fn Main() { - // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+3]]:24-29: error: cannot implicitly convert expression of type `Core.IntLiteral` to `bool` [ConversionFailure] - // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+2]]:24-29: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_type_mismatch.carbon:[[@LINE+11]]:24 + // CHECK:STDERR: -> │ var unused x: bool = not 12; + // CHECK:STDERR: · ┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type + // CHECK:STDERR: · │ ┃ `Core.IntLiteral` to `bool` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Core.IntLiteral` does not implement + // CHECK:STDERR: · │ interface `Core.ImplicitAs(bool)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused x: bool = not 12; } @@ -39,7 +47,7 @@ fn Main() { // CHECK:STDOUT: %T.09f: %SubobjectDestroy.type = symbolic_binding T, 0 [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.type.dea: type = fn_type @T.as_type.as.DestroyImpl.impl.Op, @T.as_type.as.DestroyImpl.impl(%T.09f) [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.6e5: %T.as_type.as.DestroyImpl.impl.Op.type.dea = struct_value () [symbolic] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.687: type = fn_type @SubobjectDestroy.WithSelf.Op.loc19 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.687: type = fn_type @SubobjectDestroy.WithSelf.Op.loc27 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f: %SubobjectDestroy.WithSelf.Op.type.687 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f), @SubobjectDestroy [concrete] // CHECK:STDOUT: %SubobjectDestroy.facet.a87: %SubobjectDestroy.type = facet_value bool, (%custom_witness.b80) [concrete] @@ -76,23 +84,23 @@ fn Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %x.var: ref bool = var_storage %x.var_patt // CHECK:STDOUT: %int_12: Core.IntLiteral = int_value 12 [concrete = constants.%int_12] -// CHECK:STDOUT: %.loc19_24.1: bool = converted %int_12, [concrete = ] -// CHECK:STDOUT: %.loc19_24.2: = not [concrete = ] +// CHECK:STDOUT: %.loc27_24.1: bool = converted %int_12, [concrete = ] +// CHECK:STDOUT: %.loc27_24.2: = not [concrete = ] // CHECK:STDOUT: assign %x.var, -// CHECK:STDOUT: %.loc19_17: type = type_literal bool [concrete = bool] +// CHECK:STDOUT: %.loc27_17: type = type_literal bool [concrete = bool] // CHECK:STDOUT: %x: ref bool = wrapper_binding x, %x.var // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %x.patt: %pattern_type.831 = ref_binding_pattern x [concrete = constants.%x.patt] // CHECK:STDOUT: %x.var_patt: %pattern_type.831 = var_pattern %x.patt [concrete = constants.%x.var_patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.facet.loc19_3.1: %Destroy.type = facet_value bool, (constants.%DestroyImpl.impl_witness.778, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc19_3.1: %Destroy.type = converted bool, %Destroy.facet.loc19_3.1 [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %Destroy.facet.loc19_3.2: %Destroy.type = facet_value bool, (constants.%DestroyImpl.impl_witness.778, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc19_3.2: %Destroy.type = converted bool, %Destroy.facet.loc19_3.2 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %Destroy.facet.loc27_3.1: %Destroy.type = facet_value bool, (constants.%DestroyImpl.impl_witness.778, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc27_3.1: %Destroy.type = converted bool, %Destroy.facet.loc27_3.1 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %Destroy.facet.loc27_3.2: %Destroy.type = facet_value bool, (constants.%DestroyImpl.impl_witness.778, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc27_3.2: %Destroy.type = converted bool, %Destroy.facet.loc27_3.2 [concrete = constants.%Destroy.facet] // CHECK:STDOUT: %SelfDestruct.specific_fn: = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet) [concrete = constants.%SelfDestruct.specific_fn] // CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%x.var) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc19(%self.param: ref bool) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc27(%self.param: ref bool) = "no_op"; // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/builtin/fail_type_mismatch_assignment.carbon b/toolchain/check/testdata/operators/builtin/fail_type_mismatch_assignment.carbon index 0bb40fe78449..44d0d83c2850 100644 --- a/toolchain/check/testdata/operators/builtin/fail_type_mismatch_assignment.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_type_mismatch_assignment.carbon @@ -14,8 +14,16 @@ fn Main() { var a: i32 = 3; - // CHECK:STDERR: fail_type_mismatch_assignment.carbon:[[@LINE+3]]:3-9: error: cannot implicitly convert expression of type `Core.FloatLiteral` to `i32` [ConversionFailure] - // CHECK:STDERR: fail_type_mismatch_assignment.carbon:[[@LINE+2]]:3-9: note: type `Core.FloatLiteral` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_type_mismatch_assignment.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: -> │ a = 5.6; + // CHECK:STDERR: · ┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `Core.FloatLiteral` + // CHECK:STDERR: · │ ┃ to `i32` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Core.FloatLiteral` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(i32)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: a = 5.6; } @@ -113,7 +121,7 @@ fn Main() { // CHECK:STDOUT: } // CHECK:STDOUT: %a.ref: ref %i32 = name_ref a, %a // CHECK:STDOUT: %float: Core.FloatLiteral = float_literal_value 56e-1 [concrete = constants.%float] -// CHECK:STDOUT: %.loc20: %i32 = converted %float, [concrete = ] +// CHECK:STDOUT: %.loc28: %i32 = converted %float, [concrete = ] // CHECK:STDOUT: assign %a.ref, // CHECK:STDOUT: %Destroy.facet.loc16_3.1: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] // CHECK:STDOUT: %.loc16_3.2: %Destroy.type = converted constants.%i32, %Destroy.facet.loc16_3.1 [concrete = constants.%Destroy.facet] diff --git a/toolchain/check/testdata/operators/builtin/fail_type_mismatch_once.carbon b/toolchain/check/testdata/operators/builtin/fail_type_mismatch_once.carbon index eb8a869de7e3..212194cd0f30 100644 --- a/toolchain/check/testdata/operators/builtin/fail_type_mismatch_once.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_type_mismatch_once.carbon @@ -15,7 +15,14 @@ fn Main() -> i32 { // The following line has two mismatches, but after the first, it shouldn't // keep erroring. - // CHECK:STDERR: fail_type_mismatch_once.carbon:[[@LINE+2]]:10-17: error: cannot access member of interface `Core.AddWith(Core.FloatLiteral)` in type `{}` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_type_mismatch_once.carbon:[[@LINE+9]]:10 + // CHECK:STDERR: -> │ return {} + 3.4 + 12; + // CHECK:STDERR: · ┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.AddWith(Core.FloatLiteral)` in type `{}` that does + // CHECK:STDERR: · ┃ not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return {} + 3.4 + 12; } @@ -72,7 +79,7 @@ fn Main() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> out %return.param: %i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc20: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc27: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] // CHECK:STDOUT: %float: Core.FloatLiteral = float_literal_value 34e-1 [concrete = constants.%float] // CHECK:STDOUT: %int_12: Core.IntLiteral = int_value 12 [concrete = constants.%int_12] // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/operators/builtin/fail_unimplemented_op.carbon b/toolchain/check/testdata/operators/builtin/fail_unimplemented_op.carbon index ef63f2b34394..fe996c028bfc 100644 --- a/toolchain/check/testdata/operators/builtin/fail_unimplemented_op.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_unimplemented_op.carbon @@ -13,7 +13,14 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/builtin/fail_unimplemented_op.carbon fn Main() -> i32 { - // CHECK:STDERR: fail_unimplemented_op.carbon:[[@LINE+2]]:10-16: error: cannot access member of interface `Core.AddWith(Core.IntLiteral)` in type `{}` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_unimplemented_op.carbon:[[@LINE+9]]:10 + // CHECK:STDERR: -> │ return {} + 34; + // CHECK:STDERR: · ┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface + // CHECK:STDERR: · ┃ `Core.AddWith(Core.IntLiteral)` in type `{}` that does not + // CHECK:STDERR: · ┃ implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return {} + 34; } @@ -69,7 +76,7 @@ fn Main() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> out %return.param: %i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc18: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc25: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] // CHECK:STDOUT: %int_34: Core.IntLiteral = int_value 34 [concrete = constants.%int_34] // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/operators/builtin/ref.carbon b/toolchain/check/testdata/operators/builtin/ref.carbon index 9144cc0f3332..9028a39cff18 100644 --- a/toolchain/check/testdata/operators/builtin/ref.carbon +++ b/toolchain/check/testdata/operators/builtin/ref.carbon @@ -17,7 +17,12 @@ library "[[@TEST_NAME]]"; fn F() { var x: () = (); - // CHECK:STDERR: fail_discarded_ref.carbon:[[@LINE+2]]:3-7: error: `ref` tag is not an argument to a `ref` parameter [RefTagNoRefParam] + // CHECK:STDERR: ╭─┤ fail_discarded_ref.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ ref x; + // CHECK:STDERR: · ━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: `ref` tag is not an argument to a `ref` parameter + // CHECK:STDERR: · ┃ [RefTagNoRefParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: ref x; } @@ -28,10 +33,22 @@ library "[[@TEST_NAME]]"; fn F() { var x: () = (); - // CHECK:STDERR: fail_ref_out_of_place.carbon:[[@LINE+2]]:22-26: error: `ref` tag is not an argument to a `ref` parameter [RefTagNoRefParam] + // CHECK:STDERR: ╭─┤ fail_ref_out_of_place.carbon:[[@LINE+8]]:22 + // CHECK:STDERR: -> │ let unused y: () = ref x; + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: `ref` tag is not an argument to a `ref` + // CHECK:STDERR: · ┃ parameter + // CHECK:STDERR: · ┃ [RefTagNoRefParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused y: () = ref x; - // CHECK:STDERR: fail_ref_out_of_place.carbon:[[@LINE+2]]:23-27: error: `ref` tag is not an argument to a `ref` parameter [RefTagNoRefParam] + // CHECK:STDERR: ╭─┤ fail_ref_out_of_place.carbon:[[@LINE+8]]:23 + // CHECK:STDERR: -> │ let unused z: () = (ref x); + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: `ref` tag is not an argument to a `ref` + // CHECK:STDERR: · ┃ parameter + // CHECK:STDERR: · ┃ [RefTagNoRefParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused z: () = (ref x); } diff --git a/toolchain/check/testdata/operators/overloaded/eq.carbon b/toolchain/check/testdata/operators/overloaded/eq.carbon index 7023f0009e75..e9d0c520eb8e 100644 --- a/toolchain/check/testdata/operators/overloaded/eq.carbon +++ b/toolchain/check/testdata/operators/overloaded/eq.carbon @@ -54,13 +54,25 @@ package FailNoImpl; class D {}; fn TestEqual(a: D, b: D) -> bool { - // CHECK:STDERR: fail_no_impl.carbon:[[@LINE+2]]:10-15: error: cannot access member of interface `Core.EqWith(D)` in type `D` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_no_impl.carbon:[[@LINE+8]]:10 + // CHECK:STDERR: -> │ return a == b; + // CHECK:STDERR: · ┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.EqWith(D)` in type + // CHECK:STDERR: · ┃ `D` that does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return a == b; } fn TestNotEqual(a: D, b: D) -> bool { - // CHECK:STDERR: fail_no_impl.carbon:[[@LINE+2]]:10-15: error: cannot access member of interface `Core.EqWith(D)` in type `D` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_no_impl.carbon:[[@LINE+8]]:10 + // CHECK:STDERR: -> │ return a != b; + // CHECK:STDERR: · ┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.EqWith(D)` in type + // CHECK:STDERR: · ┃ `D` that does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return a != b; } @@ -78,13 +90,25 @@ impl C as Core.EqWith(C) { } fn TestRhsBad(a: C, b: D) -> bool { - // CHECK:STDERR: fail_no_impl_for_args.carbon:[[@LINE+2]]:10-15: error: cannot access member of interface `Core.EqWith(D)` in type `C` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_no_impl_for_args.carbon:[[@LINE+8]]:10 + // CHECK:STDERR: -> │ return a == b; + // CHECK:STDERR: · ┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.EqWith(D)` in type + // CHECK:STDERR: · ┃ `C` that does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return a == b; } fn TestLhsBad(a: D, b: C) -> bool { - // CHECK:STDERR: fail_no_impl_for_args.carbon:[[@LINE+2]]:10-15: error: cannot access member of interface `Core.EqWith(C)` in type `D` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_no_impl_for_args.carbon:[[@LINE+8]]:10 + // CHECK:STDERR: -> │ return a != b; + // CHECK:STDERR: · ┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.EqWith(C)` in type + // CHECK:STDERR: · ┃ `D` that does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return a != b; } diff --git a/toolchain/check/testdata/operators/overloaded/fail_assign_non_ref.carbon b/toolchain/check/testdata/operators/overloaded/fail_assign_non_ref.carbon index 60b1e5128307..3ee5f89a367f 100644 --- a/toolchain/check/testdata/operators/overloaded/fail_assign_non_ref.carbon +++ b/toolchain/check/testdata/operators/overloaded/fail_assign_non_ref.carbon @@ -24,15 +24,30 @@ impl C as Core.AddAssignWith(C) { } fn TestIncNonRef(a: C) { - // CHECK:STDERR: fail_assign_non_ref.carbon:[[@LINE+3]]:5: error: value expression passed to reference parameter [ValueForRefParam] - // CHECK:STDERR: fail_assign_non_ref.carbon:[[@LINE-8]]:9-19: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_assign_non_ref.carbon:[[@LINE+11]]:5 + // CHECK:STDERR: │ fn Op(ref self: C); + // CHECK:STDERR: · ─────┬───── + // CHECK:STDERR: · ╰──┤ initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ ++a; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: value expression passed to reference parameter + // CHECK:STDERR: · ┃ [ValueForRefParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: ++a; } fn TestAddAssignNonRef(a: C, b: C) { - // CHECK:STDERR: fail_assign_non_ref.carbon:[[@LINE+3]]:3: error: value expression passed to reference parameter [ValueForRefParam] - // CHECK:STDERR: fail_assign_non_ref.carbon:[[@LINE-12]]:9-19: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_assign_non_ref.carbon:[[@LINE+10]]:3 + // CHECK:STDERR: │ fn Op(ref self: C, other: C); + // CHECK:STDERR: · ─────┬───── + // CHECK:STDERR: · ╰──┤ initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ a += b; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: value expression passed to reference parameter [ValueForRefParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: a += b; } @@ -127,10 +142,10 @@ fn TestAddAssignNonRef(a: C, b: C) { // CHECK:STDOUT: %b.patt: %pattern_type.4a7 = wrapper_binding_pattern b, %b.param_patt [concrete = constants.%b.patt] // CHECK:STDOUT: } { // CHECK:STDOUT: %a.param: %C = value_param call_param0 -// CHECK:STDOUT: %C.ref.loc33_27: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %C.ref.loc41_27: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %a: %C = wrapper_binding a, %a.param // CHECK:STDOUT: %b.param: %C = value_param call_param1 -// CHECK:STDOUT: %C.ref.loc33_33: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %C.ref.loc41_33: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %b: %C = wrapper_binding b, %b.param // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/operators/overloaded/fail_error_recovery.carbon b/toolchain/check/testdata/operators/overloaded/fail_error_recovery.carbon index b30c4ec17f80..fde2ec1cd3bd 100644 --- a/toolchain/check/testdata/operators/overloaded/fail_error_recovery.carbon +++ b/toolchain/check/testdata/operators/overloaded/fail_error_recovery.carbon @@ -16,13 +16,21 @@ // `` doesn't implement an operator. fn F() { - // CHECK:STDERR: fail_error_recovery.carbon:[[@LINE+2]]:3-12: error: name `undeclared` not found [NameNotFound] + // CHECK:STDERR: ╭─┤ fail_error_recovery.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ undeclared + 1; + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: name `undeclared` not found [NameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: undeclared + 1; } fn G(n: i32) { - // CHECK:STDERR: fail_error_recovery.carbon:[[@LINE+2]]:7-16: error: name `undeclared` not found [NameNotFound] + // CHECK:STDERR: ╭─┤ fail_error_recovery.carbon:[[@LINE+6]]:7 + // CHECK:STDERR: -> │ n + undeclared; + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: name `undeclared` not found [NameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: n + undeclared; } diff --git a/toolchain/check/testdata/operators/overloaded/fail_no_impl.carbon b/toolchain/check/testdata/operators/overloaded/fail_no_impl.carbon index 42b0276ff11d..b9bdd4ffb1bf 100644 --- a/toolchain/check/testdata/operators/overloaded/fail_no_impl.carbon +++ b/toolchain/check/testdata/operators/overloaded/fail_no_impl.carbon @@ -17,23 +17,47 @@ package User; class C {}; fn TestUnary(a: C) -> C { - // CHECK:STDERR: fail_no_impl.carbon:[[@LINE+2]]:10-11: error: cannot access member of interface `Core.Negate` in type `C` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_no_impl.carbon:[[@LINE+8]]:10 + // CHECK:STDERR: -> │ return -a; + // CHECK:STDERR: · ┳━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.Negate` in type `C` + // CHECK:STDERR: · ┃ that does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return -a; } fn TestBinary(a: C, b: C) -> C { - // CHECK:STDERR: fail_no_impl.carbon:[[@LINE+2]]:10-14: error: cannot access member of interface `Core.AddWith(C)` in type `C` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_no_impl.carbon:[[@LINE+8]]:10 + // CHECK:STDERR: -> │ return a + b; + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.AddWith(C)` in type + // CHECK:STDERR: · ┃ `C` that does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return a + b; } fn TestRef(b: C) { var a: C = {}; - // CHECK:STDERR: fail_no_impl.carbon:[[@LINE+2]]:3-8: error: cannot access member of interface `Core.AddAssignWith(C)` in type `C` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_no_impl.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ a += b; + // CHECK:STDERR: · ┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.AddAssignWith(C)` in type + // CHECK:STDERR: · ┃ `C` that does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: a += b; - // CHECK:STDERR: fail_no_impl.carbon:[[@LINE+2]]:3-5: error: cannot access member of interface `Core.Inc` in type `C` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_no_impl.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ ++a; + // CHECK:STDERR: · ┳━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.Inc` in type `C` that does + // CHECK:STDERR: · ┃ not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: ++a; } @@ -77,7 +101,7 @@ fn TestRef(b: C) { // CHECK:STDOUT: %T.09f: %SubobjectDestroy.type = symbolic_binding T, 0 [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.type.dea: type = fn_type @T.as_type.as.DestroyImpl.impl.Op, @T.as_type.as.DestroyImpl.impl(%T.09f) [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.6e5: %T.as_type.as.DestroyImpl.impl.Op.type.dea = struct_value () [symbolic] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.2: type = fn_type @SubobjectDestroy.WithSelf.Op.loc32_3.2 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.2: type = fn_type @SubobjectDestroy.WithSelf.Op.loc44_3.2 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.2: %SubobjectDestroy.WithSelf.Op.type.6870fd.2 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80ef6.2: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.2), @SubobjectDestroy [concrete] // CHECK:STDOUT: %SubobjectDestroy.facet.076: %SubobjectDestroy.type = facet_value %C, (%custom_witness.b80ef6.2) [concrete] @@ -135,15 +159,15 @@ fn TestRef(b: C) { // CHECK:STDOUT: %b.param_patt: %pattern_type.4a7 = value_param_pattern [concrete = constants.%b.param_patt] // CHECK:STDOUT: %b.patt: %pattern_type.4a7 = wrapper_binding_pattern b, %b.param_patt [concrete = constants.%b.patt] // CHECK:STDOUT: %return.param_patt: %pattern_type.4a7 = out_param_pattern [concrete = constants.%return.param_patt.415] -// CHECK:STDOUT: %return.patt: %pattern_type.4a7 = return_slot_pattern %return.param_patt, %C.ref.loc25_30 [concrete = constants.%return.patt.340] +// CHECK:STDOUT: %return.patt: %pattern_type.4a7 = return_slot_pattern %return.param_patt, %C.ref.loc31_30 [concrete = constants.%return.patt.340] // CHECK:STDOUT: } { -// CHECK:STDOUT: %C.ref.loc25_30: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %.loc25: Core.Form = init_form %C.ref.loc25_30 [concrete = constants.%.79c] +// CHECK:STDOUT: %C.ref.loc31_30: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %.loc31: Core.Form = init_form %C.ref.loc31_30 [concrete = constants.%.79c] // CHECK:STDOUT: %a.param: %C = value_param call_param0 -// CHECK:STDOUT: %C.ref.loc25_18: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %C.ref.loc31_18: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %a: %C = wrapper_binding a, %a.param // CHECK:STDOUT: %b.param: %C = value_param call_param1 -// CHECK:STDOUT: %C.ref.loc25_24: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %C.ref.loc31_24: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %b: %C = wrapper_binding b, %b.param // CHECK:STDOUT: %return.param: ref %C = out_param call_param2 // CHECK:STDOUT: %return: ref %C = return_slot %return.param @@ -153,7 +177,7 @@ fn TestRef(b: C) { // CHECK:STDOUT: %b.patt: %pattern_type.4a7 = wrapper_binding_pattern b, %b.param_patt [concrete = constants.%b.patt] // CHECK:STDOUT: } { // CHECK:STDOUT: %b.param: %C = value_param call_param0 -// CHECK:STDOUT: %C.ref.loc31: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %C.ref.loc43: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %b: %C = wrapper_binding b, %b.param // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -182,29 +206,29 @@ fn TestRef(b: C) { // CHECK:STDOUT: fn @TestRef(%b.param: %C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.var: ref %C = var_storage %a.var_patt -// CHECK:STDOUT: %.loc32_15.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc32_15.2: init %C to %a.var = class_init () [concrete = constants.%C.val] -// CHECK:STDOUT: %.loc32_3.1: init %C = converted %.loc32_15.1, %.loc32_15.2 [concrete = constants.%C.val] -// CHECK:STDOUT: assign %a.var, %.loc32_3.1 -// CHECK:STDOUT: %C.ref.loc32: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %.loc44_15.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc44_15.2: init %C to %a.var = class_init () [concrete = constants.%C.val] +// CHECK:STDOUT: %.loc44_3.1: init %C = converted %.loc44_15.1, %.loc44_15.2 [concrete = constants.%C.val] +// CHECK:STDOUT: assign %a.var, %.loc44_3.1 +// CHECK:STDOUT: %C.ref.loc44: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %a: ref %C = wrapper_binding a, %a.var // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %a.patt: %pattern_type.4a7 = ref_binding_pattern a [concrete = constants.%a.patt.28f] // CHECK:STDOUT: %a.var_patt: %pattern_type.4a7 = var_pattern %a.patt [concrete = constants.%a.var_patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %a.ref.loc35: ref %C = name_ref a, %a +// CHECK:STDOUT: %a.ref.loc53: ref %C = name_ref a, %a // CHECK:STDOUT: %b.ref: %C = name_ref b, %b -// CHECK:STDOUT: %a.ref.loc38: ref %C = name_ref a, %a -// CHECK:STDOUT: %Destroy.facet.loc32_3.1: %Destroy.type = facet_value constants.%C, (constants.%DestroyImpl.impl_witness.6fa, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc32_3.2: %Destroy.type = converted constants.%C, %Destroy.facet.loc32_3.1 [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %Destroy.facet.loc32_3.2: %Destroy.type = facet_value constants.%C, (constants.%DestroyImpl.impl_witness.6fa, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc32_3.3: %Destroy.type = converted constants.%C, %Destroy.facet.loc32_3.2 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %a.ref.loc62: ref %C = name_ref a, %a +// CHECK:STDOUT: %Destroy.facet.loc44_3.1: %Destroy.type = facet_value constants.%C, (constants.%DestroyImpl.impl_witness.6fa, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc44_3.2: %Destroy.type = converted constants.%C, %Destroy.facet.loc44_3.1 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %Destroy.facet.loc44_3.2: %Destroy.type = facet_value constants.%C, (constants.%DestroyImpl.impl_witness.6fa, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc44_3.3: %Destroy.type = converted constants.%C, %Destroy.facet.loc44_3.2 [concrete = constants.%Destroy.facet] // CHECK:STDOUT: %SelfDestruct.specific_fn: = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet) [concrete = constants.%SelfDestruct.specific_fn] // CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%a.var) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc32_3.1(%self.param: ref %empty_struct_type) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc44_3.1(%self.param: ref %empty_struct_type) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc32_3.2(%self.param: ref %C) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc44_3.2(%self.param: ref %C) = "no_op"; // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/fail_no_impl_for_arg.carbon b/toolchain/check/testdata/operators/overloaded/fail_no_impl_for_arg.carbon index 4f46c8207265..fabe41b0c979 100644 --- a/toolchain/check/testdata/operators/overloaded/fail_no_impl_for_arg.carbon +++ b/toolchain/check/testdata/operators/overloaded/fail_no_impl_for_arg.carbon @@ -26,7 +26,13 @@ fn Test(a: C, b: D, z: bool) -> C { if (z) { return a + a; } else { - // CHECK:STDERR: fail_no_impl_for_arg.carbon:[[@LINE+2]]:12-16: error: cannot access member of interface `Core.AddWith(D)` in type `C` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_no_impl_for_arg.carbon:[[@LINE+8]]:12 + // CHECK:STDERR: -> │ return a + b; + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.AddWith(D)` in + // CHECK:STDERR: · ┃ type `C` that does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return a + b; } @@ -37,7 +43,13 @@ fn TestAssign(b: D) { a += a; - // CHECK:STDERR: fail_no_impl_for_arg.carbon:[[@LINE+2]]:3-8: error: cannot access member of interface `Core.AddAssignWith(D)` in type `C` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_no_impl_for_arg.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ a += b; + // CHECK:STDERR: · ┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.AddAssignWith(D)` in type + // CHECK:STDERR: · ┃ `C` that does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: a += b; } diff --git a/toolchain/check/testdata/operators/overloaded/index.carbon b/toolchain/check/testdata/operators/overloaded/index.carbon index ce4e5befaec1..d79493112655 100644 --- a/toolchain/check/testdata/operators/overloaded/index.carbon +++ b/toolchain/check/testdata/operators/overloaded/index.carbon @@ -25,9 +25,17 @@ library "[[@TEST_NAME]]"; import Core library "core_wrong_index_with"; //@dump-sem-ir-begin -// CHECK:STDERR: fail_wrong_index_with.carbon:[[@LINE+4]]:10-13: error: value of type `type` is not callable [CallToNonCallable] +// CHECK:STDERR: ╭─┤ fail_wrong_index_with.carbon:[[@LINE+12]]:10 +// CHECK:STDERR: -> │ fn F() { 0[1]; } +// CHECK:STDERR: · ━━┳━ +// CHECK:STDERR: · ┗━━┫ error: value of type `type` is not callable [CallToNonCallable] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_wrong_index_with.carbon:[[@LINE+2]]:10-13: error: value of type `type` is not callable [CallToNonCallable] +// CHECK:STDERR: ╭─┤ fail_wrong_index_with.carbon:[[@LINE+6]]:10 +// CHECK:STDERR: -> │ fn F() { 0[1]; } +// CHECK:STDERR: · ━━┳━ +// CHECK:STDERR: · ┗━━┫ error: value of type `type` is not callable [CallToNonCallable] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F() { 0[1]; } //@dump-sem-ir-end @@ -37,9 +45,21 @@ fn F() { 0[1]; } library "[[@TEST_NAME]]"; //@dump-sem-ir-begin -// CHECK:STDERR: fail_missing_index_with.carbon:[[@LINE+4]]:10-13: error: name `Core.IndirectIndexWith` implicitly referenced here, but not found [CoreNameNotFound] +// CHECK:STDERR: ╭─┤ fail_missing_index_with.carbon:[[@LINE+16]]:10 +// CHECK:STDERR: -> │ fn F() { 0[1]; } +// CHECK:STDERR: · ┳━━━ +// CHECK:STDERR: · ┗━━┫ error: name `Core.IndirectIndexWith` implicitly referenced here, +// CHECK:STDERR: · ┃ but not found +// CHECK:STDERR: · ┃ [CoreNameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_missing_index_with.carbon:[[@LINE+2]]:10-13: error: name `Core.IndexWith` implicitly referenced here, but not found [CoreNameNotFound] +// CHECK:STDERR: ╭─┤ fail_missing_index_with.carbon:[[@LINE+8]]:10 +// CHECK:STDERR: -> │ fn F() { 0[1]; } +// CHECK:STDERR: · ┳━━━ +// CHECK:STDERR: · ┗━━┫ error: name `Core.IndexWith` implicitly referenced here, but not +// CHECK:STDERR: · ┃ found +// CHECK:STDERR: · ┃ [CoreNameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F() { 0[1]; } //@dump-sem-ir-end @@ -74,11 +94,26 @@ impl C as Core.IndexWith((), ()) { fn F() { let c: C = {}; - // CHECK:STDERR: fail_wrong_arg_count.carbon:[[@LINE+3]]:3-7: error: 1 argument passed to generic interface expecting 2 arguments [CallArgCountMismatch] - // CHECK:STDERR: core_wrong_arg_count.carbon:4:1-61: note: calling generic interface declared here [InCallToEntity] + // CHECK:STDERR: ╭─┤ fail_wrong_arg_count.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: -> │ c[()]; + // CHECK:STDERR: · ━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: 1 argument passed to generic interface expecting 2 arguments + // CHECK:STDERR: · ┃ [CallArgCountMismatch] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ core_wrong_arg_count.carbon + // CHECK:STDERR: │ interface IndexWith(SubscriptType: type, ElementType: type) { + // CHECK:STDERR: · ──────────────────────────────┬────────────────────────────── + // CHECK:STDERR: · ╰──┤ calling generic interface declared here + // CHECK:STDERR: · │ [InCallToEntity] + // CHECK:STDERR: ╰──── // CHECK:STDERR: c[()]; - // CHECK:STDERR: fail_wrong_arg_count.carbon:[[@LINE+2]]:3: error: missing `//@dump-sem-ir-begin` to match `//@dump-sem-ir-end` [DumpSemIRRangeMissingBegin] + // CHECK:STDERR: ╭─┤ fail_wrong_arg_count.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ //@dump-sem-ir-end + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: missing `//@dump-sem-ir-begin` to match `//@dump-sem-ir-end` + // CHECK:STDERR: · ┃ [DumpSemIRRangeMissingBegin] + // CHECK:STDERR: ╰──── // CHECK:STDERR: //@dump-sem-ir-end } diff --git a/toolchain/check/testdata/operators/overloaded/index_with_prelude.carbon b/toolchain/check/testdata/operators/overloaded/index_with_prelude.carbon index b2d8ab2152d6..3966e623271e 100644 --- a/toolchain/check/testdata/operators/overloaded/index_with_prelude.carbon +++ b/toolchain/check/testdata/operators/overloaded/index_with_prelude.carbon @@ -62,7 +62,14 @@ impl C as Core.IndexWith(SubscriptType) where .ElementType = ElementType { } let c: C = {}; -// CHECK:STDERR: fail_invalid_subscript_type.carbon:[[@LINE+2]]:22-25: error: cannot access member of interface `Core.IndexWith(Core.IntLiteral)` in type `C` that does not implement that interface [MissingImplInMemberAccess] +// CHECK:STDERR: ╭─┤ fail_invalid_subscript_type.carbon:[[@LINE+9]]:22 +// CHECK:STDERR: -> │ let x: ElementType = c[0]; +// CHECK:STDERR: · ┳━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface +// CHECK:STDERR: · ┃ `Core.IndexWith(Core.IntLiteral)` in type `C` +// CHECK:STDERR: · ┃ that does not implement that interface +// CHECK:STDERR: · ┃ [MissingImplInMemberAccess] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let x: ElementType = c[0]; @@ -73,7 +80,14 @@ library "[[@TEST_NAME]]"; class C { } let c: C = {}; -// CHECK:STDERR: fail_index_with_not_implemented.carbon:[[@LINE+2]]:14-17: error: cannot access member of interface `Core.IndexWith(Core.IntLiteral)` in type `C` that does not implement that interface [MissingImplInMemberAccess] +// CHECK:STDERR: ╭─┤ fail_index_with_not_implemented.carbon:[[@LINE+9]]:14 +// CHECK:STDERR: -> │ let x: i32 = c[0]; +// CHECK:STDERR: · ┳━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface +// CHECK:STDERR: · ┃ `Core.IndexWith(Core.IntLiteral)` in type `C` that does +// CHECK:STDERR: · ┃ not implement that interface +// CHECK:STDERR: · ┃ [MissingImplInMemberAccess] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let x: i32 = c[0]; diff --git a/toolchain/check/testdata/operators/overloaded/indirect_index_with.carbon b/toolchain/check/testdata/operators/overloaded/indirect_index_with.carbon index 0e1987a76601..4b435f3f184c 100644 --- a/toolchain/check/testdata/operators/overloaded/indirect_index_with.carbon +++ b/toolchain/check/testdata/operators/overloaded/indirect_index_with.carbon @@ -89,7 +89,13 @@ library "[[@TEST_NAME]]"; import library "types"; fn F(c: CNonCopy, s: SubscriptType) { - // CHECK:STDERR: fail_at_non_copyable.carbon:[[@LINE+2]]:3-38: error: cannot access member of interface `Core.IndexWith(SubscriptType)` in type `CNonCopy` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_at_non_copyable.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ c.(Core.IndexWith(SubscriptType).At)(s); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.IndexWith(SubscriptType)` + // CHECK:STDERR: · ┃ in type `CNonCopy` that does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: c.(Core.IndexWith(SubscriptType).At)(s); } diff --git a/toolchain/check/testdata/operators/overloaded/ordered.carbon b/toolchain/check/testdata/operators/overloaded/ordered.carbon index 5d53b2e9dbfb..2a28d3223d85 100644 --- a/toolchain/check/testdata/operators/overloaded/ordered.carbon +++ b/toolchain/check/testdata/operators/overloaded/ordered.carbon @@ -75,25 +75,49 @@ package FailNoImpl; class D {}; fn TestLess(a: D, b: D) -> bool { - // CHECK:STDERR: fail_no_impl.carbon:[[@LINE+2]]:10-14: error: cannot access member of interface `Core.OrderedWith(D)` in type `D` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_no_impl.carbon:[[@LINE+8]]:10 + // CHECK:STDERR: -> │ return a < b; + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.OrderedWith(D)` in + // CHECK:STDERR: · ┃ type `D` that does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return a < b; } fn TestLessEqual(a: D, b: D) -> bool { - // CHECK:STDERR: fail_no_impl.carbon:[[@LINE+2]]:10-15: error: cannot access member of interface `Core.OrderedWith(D)` in type `D` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_no_impl.carbon:[[@LINE+8]]:10 + // CHECK:STDERR: -> │ return a <= b; + // CHECK:STDERR: · ┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.OrderedWith(D)` in + // CHECK:STDERR: · ┃ type `D` that does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return a <= b; } fn TestGreater(a: D, b: D) -> bool { - // CHECK:STDERR: fail_no_impl.carbon:[[@LINE+2]]:10-14: error: cannot access member of interface `Core.OrderedWith(D)` in type `D` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_no_impl.carbon:[[@LINE+8]]:10 + // CHECK:STDERR: -> │ return a > b; + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.OrderedWith(D)` in + // CHECK:STDERR: · ┃ type `D` that does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return a > b; } fn TestGreaterEqual(a: D, b: D) -> bool { - // CHECK:STDERR: fail_no_impl.carbon:[[@LINE+2]]:10-15: error: cannot access member of interface `Core.OrderedWith(D)` in type `D` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_no_impl.carbon:[[@LINE+8]]:10 + // CHECK:STDERR: -> │ return a >= b; + // CHECK:STDERR: · ┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.OrderedWith(D)` in + // CHECK:STDERR: · ┃ type `D` that does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return a >= b; } diff --git a/toolchain/check/testdata/operators/overloaded/string_indexing.carbon b/toolchain/check/testdata/operators/overloaded/string_indexing.carbon index f166889682b1..1706acf08057 100644 --- a/toolchain/check/testdata/operators/overloaded/string_indexing.carbon +++ b/toolchain/check/testdata/operators/overloaded/string_indexing.carbon @@ -14,7 +14,12 @@ library "[[@TEST_NAME]]"; fn TestLiteralNegativeIndex() { - // CHECK:STDERR: fail_literal_negative_index.carbon:[[@LINE+2]]:24-33: error: index `-1` is negative [StringAtIndexNegative] + // CHECK:STDERR: ╭─┤ fail_literal_negative_index.carbon:[[@LINE+7]]:24 + // CHECK:STDERR: -> │ let unused c: char = "Test"[-1]; + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: index `-1` is negative + // CHECK:STDERR: · ┃ [StringAtIndexNegative] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused c: char = "Test"[-1]; } @@ -23,7 +28,13 @@ fn TestLiteralNegativeIndex() { library "[[@TEST_NAME]]"; fn TestLiteralOutOfBounds() { - // CHECK:STDERR: fail_literal_out_of_bounds.carbon:[[@LINE+2]]:24-32: error: string index `4` is out of bounds; string has length 4 [StringAtIndexOutOfBounds] + // CHECK:STDERR: ╭─┤ fail_literal_out_of_bounds.carbon:[[@LINE+8]]:24 + // CHECK:STDERR: -> │ let unused c: char = "Test"[4]; + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: string index `4` is out of bounds; string has + // CHECK:STDERR: · ┃ length 4 + // CHECK:STDERR: · ┃ [StringAtIndexOutOfBounds] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused c: char = "Test"[4]; } @@ -34,7 +45,13 @@ library "[[@TEST_NAME]]"; fn TestWrongType() { class C{} //@dump-sem-ir-begin - // CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+2]]:3-11: error: cannot access member of interface `Core.IndexWith(type)` in type `str` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: ╭─┤ fail_wrong_type.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ "Test"[C]; + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.IndexWith(type)` in type + // CHECK:STDERR: · ┃ `str` that does not implement that interface + // CHECK:STDERR: · ┃ [MissingImplInMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: "Test"[C]; //@dump-sem-ir-end @@ -43,15 +60,30 @@ fn TestWrongType() { // --- fail_bad_decl.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-34: error: invalid signature for builtin function "string.at" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn At(s: str, index: i64) -> i32 = "string.at"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "string.at" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn At(s: str, index: i64) -> i32 = "string.at"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-24: error: invalid signature for builtin function "string.at" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn At2(s: str) -> char = "string.at"; +// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "string.at" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn At2(s: str) -> char = "string.at"; -// CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+2]]:1-36: error: invalid signature for builtin function "string.at" [InvalidBuiltinSignature] +// CHECK:STDERR: ╭─┤ fail_bad_decl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ fn At3(s: i32, index: i64) -> char = "string.at"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid signature for builtin function "string.at" +// CHECK:STDERR: · ┃ [InvalidBuiltinSignature] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn At3(s: i32, index: i64) -> char = "string.at"; diff --git a/toolchain/check/testdata/package_expr/not_found.carbon b/toolchain/check/testdata/package_expr/not_found.carbon index bb6c2daaf0d5..9bde59fd9738 100644 --- a/toolchain/check/testdata/package_expr/not_found.carbon +++ b/toolchain/check/testdata/package_expr/not_found.carbon @@ -14,7 +14,12 @@ library "[[@TEST_NAME]]"; fn F() { - // CHECK:STDERR: fail_direct.carbon:[[@LINE+2]]:23-31: error: member name `x` not found in `Main` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╭─┤ fail_direct.carbon:[[@LINE+7]]:23 + // CHECK:STDERR: -> │ var unused y: i32 = package.x; + // CHECK:STDERR: · ━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: member name `x` not found in `Main` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused y: i32 = package.x; } @@ -25,7 +30,12 @@ library "[[@TEST_NAME]]"; private interface Private {} fn F() { - // CHECK:STDERR: fail_nested.carbon:[[@LINE+2]]:3-30: error: member name `DoesNotExist` not found in `Private` [MemberNameNotFoundInSpecificScope] + // CHECK:STDERR: ╭─┤ fail_nested.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ package.Private.DoesNotExist; + // CHECK:STDERR: · ━━━━━━━━━━━━━━┳━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: member name `DoesNotExist` not found in `Private` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInSpecificScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: package.Private.DoesNotExist; } diff --git a/toolchain/check/testdata/packages/core_name_poisoning.carbon b/toolchain/check/testdata/packages/core_name_poisoning.carbon index 5fdd0e7d7e9e..4df51e1061ec 100644 --- a/toolchain/check/testdata/packages/core_name_poisoning.carbon +++ b/toolchain/check/testdata/packages/core_name_poisoning.carbon @@ -14,7 +14,13 @@ library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_implicitly_poison_core.carbon:[[@LINE+2]]:9-12: error: `Core.Bool` implicitly referenced here, but package `Core` not found [CoreNotFound] +// CHECK:STDERR: ╭─┤ fail_implicitly_poison_core.carbon:[[@LINE+8]]:9 +// CHECK:STDERR: -> │ fn F(x: bool); +// CHECK:STDERR: · ┳━━━ +// CHECK:STDERR: · ┗━━┫ error: `Core.Bool` implicitly referenced here, but package `Core` +// CHECK:STDERR: · ┃ not found +// CHECK:STDERR: · ┃ [CoreNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(x: bool); @@ -25,7 +31,12 @@ class r#Core {} package Core library "[[@TEST_NAME]]"; // This introduces a poisoned name in `Core`. -// CHECK:STDERR: fail_poisoned_core.carbon:[[@LINE+2]]:8-10: error: name `Core.Int` implicitly referenced here, but not found [CoreNameNotFound] +// CHECK:STDERR: ╭─┤ fail_poisoned_core.carbon:[[@LINE+7]]:8 +// CHECK:STDERR: -> │ var x: i32; +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┗━━┫ error: name `Core.Int` implicitly referenced here, but not found +// CHECK:STDERR: · ┃ [CoreNameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: i32; @@ -36,6 +47,11 @@ library "[[@TEST_NAME]]"; import Core library "poisoned_core"; // This accesses the poisoned name in `Core`. -// CHECK:STDERR: fail_use_poisoned_core.carbon:[[@LINE+2]]:9-11: error: name `Core.Int` implicitly referenced here, but not found [CoreNameNotFound] +// CHECK:STDERR: ╭─┤ fail_use_poisoned_core.carbon:[[@LINE+7]]:9 +// CHECK:STDERR: -> │ fn F(b: i32); +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┗━━┫ error: name `Core.Int` implicitly referenced here, but not found +// CHECK:STDERR: · ┃ [CoreNameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(b: i32); diff --git a/toolchain/check/testdata/packages/cross_package_export.carbon b/toolchain/check/testdata/packages/cross_package_export.carbon index 3ce1b438e024..db45cbb9ddbf 100644 --- a/toolchain/check/testdata/packages/cross_package_export.carbon +++ b/toolchain/check/testdata/packages/cross_package_export.carbon @@ -20,6 +20,24 @@ package Other library "[[@TEST_NAME]]"; +// CHECK:STDERR: ╷ ╭── imported from: fail_conflict_on_export_import.carbon [InImport] +// CHECK:STDERR: ├─┤ base.carbon:[[@LINE+17]]:1 +// CHECK:STDERR: -> │ class C { +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `C` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ conflict.carbon +// CHECK:STDERR: │ fn C() {} +// CHECK:STDERR: · ────┬─── +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ fail_conflict_on_export_import.carbon +// CHECK:STDERR: │ alias C = Other.C; +// CHECK:STDERR: · ───┬─── +// CHECK:STDERR: · ╰──┤ in name lookup for `C` [InNameLookup] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: class C { var x: (); }; @@ -28,6 +46,24 @@ class C { package Other library "[[@TEST_NAME]]"; +// CHECK:STDERR: ╷ ╭── imported from: fail_conflict_on_export_name.carbon [InImport] +// CHECK:STDERR: ├─┤ conflict.carbon:[[@LINE+17]]:1 +// CHECK:STDERR: -> │ fn C() {} +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `C` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ base.carbon +// CHECK:STDERR: │ class C { +// CHECK:STDERR: · ────┬──── +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ fail_conflict_on_export_name.carbon +// CHECK:STDERR: │ alias C = Other.C; +// CHECK:STDERR: · ───┬─── +// CHECK:STDERR: · ╰──┤ in name lookup for `C` [InNameLookup] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: fn C() {} // --- export_import.carbon @@ -157,28 +193,18 @@ import Other library "conflict"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: imported from: fail_conflict_on_export_import.carbon:[[@LINE+3]]:1 [InImport] -// CHECK:STDERR: base.carbon:4:1-9: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: conflict.carbon:4:1-8: note: name is previously declared here [NameDeclPrevious] import Other library "export_import"; import Other library "conflict"; -// CHECK:STDERR: fail_conflict_on_export_import.carbon:[[@LINE+2]]:11-17: note: in name lookup for `C` [InNameLookup] -// CHECK:STDERR: alias C = Other.C; // --- fail_conflict_on_export_name.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: imported from: fail_conflict_on_export_name.carbon:[[@LINE+3]]:1 [InImport] -// CHECK:STDERR: conflict.carbon:4:1-8: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: base.carbon:4:1-9: note: name is previously declared here [NameDeclPrevious] import Other library "export_name"; import Other library "conflict"; -// CHECK:STDERR: fail_conflict_on_export_name.carbon:[[@LINE+2]]:11-17: note: in name lookup for `C` [InNameLookup] -// CHECK:STDERR: alias C = Other.C; // CHECK:STDOUT: --- base.carbon @@ -201,9 +227,9 @@ alias C = Other.C; // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %field_decl: %C.elem = field_decl x, element0, %.loc5_11.2 in [concrete] { -// CHECK:STDOUT: %.loc5_11.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc5_11.2: type = converted %.loc5_11.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %field_decl: %C.elem = field_decl x, element0, %.loc23_11.2 in [concrete] { +// CHECK:STDOUT: %.loc23_11.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc23_11.2: type = converted %.loc23_11.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %complete_type: = complete_type_witness constants.%struct_type.x [concrete = constants.%complete_type] // CHECK:STDOUT: complete_type_witness = %complete_type @@ -284,9 +310,9 @@ alias C = Other.C; // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Other.C: type = import_ref Other//base, C, loaded [concrete = constants.%C] -// CHECK:STDOUT: %Other.import_ref.56d: = import_ref Other//base, loc6_1, loaded [concrete = constants.%complete_type] +// CHECK:STDOUT: %Other.import_ref.56d: = import_ref Other//base, loc24_1, loaded [concrete = constants.%complete_type] // CHECK:STDOUT: %Other.import_ref.0cc = import_ref Other//base, inst{{[0-9A-F]+}} [no loc], unloaded -// CHECK:STDOUT: %Other.import_ref.d09 = import_ref Other//base, loc5_8, unloaded +// CHECK:STDOUT: %Other.import_ref.d09 = import_ref Other//base, loc23_8, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -317,9 +343,9 @@ alias C = Other.C; // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Other.C: type = import_ref Other//base, C, loaded [concrete = constants.%C] -// CHECK:STDOUT: %Other.import_ref.56d: = import_ref Other//base, loc6_1, loaded [concrete = constants.%complete_type] +// CHECK:STDOUT: %Other.import_ref.56d: = import_ref Other//base, loc24_1, loaded [concrete = constants.%complete_type] // CHECK:STDOUT: %Other.import_ref.0cc = import_ref Other//base, inst{{[0-9A-F]+}} [no loc], unloaded -// CHECK:STDOUT: %Other.import_ref.d09 = import_ref Other//base, loc5_8, unloaded +// CHECK:STDOUT: %Other.import_ref.d09 = import_ref Other//base, loc23_8, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -395,9 +421,9 @@ alias C = Other.C; // CHECK:STDOUT: import Other//base // CHECK:STDOUT: } // CHECK:STDOUT: %Other.C: type = import_ref Other//base, C, loaded [concrete = constants.%C] -// CHECK:STDOUT: %Other.import_ref.56d: = import_ref Other//base, loc6_1, loaded [concrete = constants.%complete_type] +// CHECK:STDOUT: %Other.import_ref.56d: = import_ref Other//base, loc24_1, loaded [concrete = constants.%complete_type] // CHECK:STDOUT: %Other.import_ref.0cc = import_ref Other//base, inst{{[0-9A-F]+}} [no loc], unloaded -// CHECK:STDOUT: %Other.import_ref.d09 = import_ref Other//base, loc5_8, unloaded +// CHECK:STDOUT: %Other.import_ref.d09 = import_ref Other//base, loc23_8, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -465,9 +491,9 @@ alias C = Other.C; // CHECK:STDOUT: import Other//base // CHECK:STDOUT: } // CHECK:STDOUT: %Other.C: type = import_ref Other//base, C, loaded [concrete = constants.%C] -// CHECK:STDOUT: %Other.import_ref.56d: = import_ref Other//base, loc6_1, loaded [concrete = constants.%complete_type] +// CHECK:STDOUT: %Other.import_ref.56d: = import_ref Other//base, loc24_1, loaded [concrete = constants.%complete_type] // CHECK:STDOUT: %Other.import_ref.0cc = import_ref Other//base, inst{{[0-9A-F]+}} [no loc], unloaded -// CHECK:STDOUT: %Other.import_ref.d09 = import_ref Other//base, loc5_8, unloaded +// CHECK:STDOUT: %Other.import_ref.d09 = import_ref Other//base, loc23_8, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -535,9 +561,9 @@ alias C = Other.C; // CHECK:STDOUT: import Other//base // CHECK:STDOUT: } // CHECK:STDOUT: %Other.C: type = import_ref Other//base, C, loaded [concrete = constants.%C] -// CHECK:STDOUT: %Other.import_ref.56d: = import_ref Other//base, loc6_1, loaded [concrete = constants.%complete_type] +// CHECK:STDOUT: %Other.import_ref.56d: = import_ref Other//base, loc24_1, loaded [concrete = constants.%complete_type] // CHECK:STDOUT: %Other.import_ref.0cc = import_ref Other//base, inst{{[0-9A-F]+}} [no loc], unloaded -// CHECK:STDOUT: %Other.import_ref.d09 = import_ref Other//base, loc5_8, unloaded +// CHECK:STDOUT: %Other.import_ref.d09 = import_ref Other//base, loc23_8, unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { diff --git a/toolchain/check/testdata/packages/cross_package_import.carbon b/toolchain/check/testdata/packages/cross_package_import.carbon index 2e8795edee27..1b1300db5c38 100644 --- a/toolchain/check/testdata/packages/cross_package_import.carbon +++ b/toolchain/check/testdata/packages/cross_package_import.carbon @@ -26,12 +26,48 @@ fn F() {} package Other library "[[@TEST_NAME]]"; +// CHECK:STDERR: ╷ ╭── imported from: fail_todo_main_use_other_extern.carbon [InImport] +// CHECK:STDERR: ├─┤ other_fn_extern.carbon:[[@LINE+17]]:1 +// CHECK:STDERR: -> │ extern fn F(); +// CHECK:STDERR: · ━━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `F` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ other_fn.carbon +// CHECK:STDERR: │ fn F() {} +// CHECK:STDERR: · ────┬─── +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ fail_todo_main_use_other_extern.carbon +// CHECK:STDERR: │ Other.F(); +// CHECK:STDERR: · ───┬─── +// CHECK:STDERR: · ╰──┤ in name lookup for `F` [InNameLookup] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: extern fn F(); // --- other_fn_conflict.carbon package Other library "[[@TEST_NAME]]"; +// CHECK:STDERR: ╷ ╭── imported from: fail_main_use_other_ambiguous.carbon [InImport] +// CHECK:STDERR: ├─┤ other_fn_conflict.carbon:[[@LINE+17]]:1 +// CHECK:STDERR: -> │ fn F(unused x: ()) {} +// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `F` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ other_fn.carbon +// CHECK:STDERR: │ fn F() {} +// CHECK:STDERR: · ────┬─── +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ fail_main_use_other_ambiguous.carbon +// CHECK:STDERR: │ Other.F(); +// CHECK:STDERR: · ───┬─── +// CHECK:STDERR: · ╰──┤ in name lookup for `F` [InNameLookup] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: fn F(unused x: ()) {} // --- other_fn2.carbon @@ -74,15 +110,10 @@ fn Run() { library "[[@TEST_NAME]]"; -// CHECK:STDERR: imported from: fail_todo_main_use_other_extern.carbon:[[@LINE+3]]:1 [InImport] -// CHECK:STDERR: other_fn_extern.carbon:4:1-14: error: duplicate name `F` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: other_fn.carbon:4:1-8: note: name is previously declared here [NameDeclPrevious] import Other library "other_fn"; import Other library "other_fn_extern"; fn Run() { - // CHECK:STDERR: fail_todo_main_use_other_extern.carbon:[[@LINE+2]]:3-9: note: in name lookup for `F` [InNameLookup] - // CHECK:STDERR: Other.F(); } @@ -97,15 +128,10 @@ import Other library "other_fn_conflict"; library "[[@TEST_NAME]]"; -// CHECK:STDERR: imported from: fail_main_use_other_ambiguous.carbon:[[@LINE+3]]:1 [InImport] -// CHECK:STDERR: other_fn_conflict.carbon:4:1-20: error: duplicate name `F` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: other_fn.carbon:4:1-8: note: name is previously declared here [NameDeclPrevious] import Other library "other_fn"; import Other library "other_fn_conflict"; fn Run() { - // CHECK:STDERR: fail_main_use_other_ambiguous.carbon:[[@LINE+2]]:3-9: note: in name lookup for `F` [InNameLookup] - // CHECK:STDERR: Other.F(); } @@ -114,13 +140,30 @@ fn Run() { library "[[@TEST_NAME]]"; import library "main_other_ns"; -// CHECK:STDERR: fail_main_namespace_conflict.carbon:[[@LINE+3]]:1-32: error: duplicate name `Other` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: main_other_ns.carbon:4:1-16: note: name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╭─┤ fail_main_namespace_conflict.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: -> │ import Other library "other_fn"; +// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `Other` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ main_other_ns.carbon +// CHECK:STDERR: │ namespace Other; +// CHECK:STDERR: · ────────┬─────── +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import Other library "other_fn"; -// CHECK:STDERR: fail_main_namespace_conflict.carbon:[[@LINE+3]]:1-14: error: redeclaration of `fn F` is redundant [RedeclRedundant] -// CHECK:STDERR: other_fn.carbon:4:1-8: note: previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╭─┤ fail_main_namespace_conflict.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: -> │ fn Other.F() {} +// CHECK:STDERR: · ━━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration of `fn F` is redundant [RedeclRedundant] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ other_fn.carbon +// CHECK:STDERR: │ fn F() {} +// CHECK:STDERR: · ────┬─── +// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Other.F() {} @@ -130,8 +173,16 @@ library "[[@TEST_NAME]]"; import Other library "other_fn"; -// CHECK:STDERR: fail_main_reopen_other.carbon:[[@LINE+3]]:11-15: error: duplicate name `Other` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: fail_main_reopen_other.carbon:[[@LINE-3]]:1-32: note: name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╭─┤ fail_main_reopen_other.carbon:[[@LINE+11]]:11 +// CHECK:STDERR: │ import Other library "other_fn"; +// CHECK:STDERR: · ────────────────┬─────────────── +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ namespace Other; +// CHECK:STDERR: · ━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `Other` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ╰──── // CHECK:STDERR: namespace Other; @@ -144,8 +195,16 @@ library "[[@TEST_NAME]]"; import Other library "other_fn"; -// CHECK:STDERR: fail_main_reopen_other_nested.carbon:[[@LINE+3]]:11-15: error: imported packages cannot be used for declarations [QualifiedDeclOutsidePackage] -// CHECK:STDERR: fail_main_reopen_other_nested.carbon:[[@LINE-3]]:1-32: note: package imported here [QualifiedDeclOutsidePackageSource] +// CHECK:STDERR: ╭─┤ fail_main_reopen_other_nested.carbon:[[@LINE+11]]:11 +// CHECK:STDERR: │ import Other library "other_fn"; +// CHECK:STDERR: · ────────────────┬─────────────── +// CHECK:STDERR: · ╰──┤ package imported here [QualifiedDeclOutsidePackageSource] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ namespace Other.Nested; +// CHECK:STDERR: · ━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: imported packages cannot be used for declarations +// CHECK:STDERR: · ┃ [QualifiedDeclOutsidePackage] +// CHECK:STDERR: ╰──── // CHECK:STDERR: namespace Other.Nested; @@ -158,8 +217,16 @@ library "[[@TEST_NAME]]"; import Other library "other_fn"; -// CHECK:STDERR: fail_main_add_to_other.carbon:[[@LINE+3]]:4-8: error: imported packages cannot be used for declarations [QualifiedDeclOutsidePackage] -// CHECK:STDERR: fail_main_add_to_other.carbon:[[@LINE-3]]:1-32: note: package imported here [QualifiedDeclOutsidePackageSource] +// CHECK:STDERR: ╭─┤ fail_main_add_to_other.carbon:[[@LINE+11]]:4 +// CHECK:STDERR: │ import Other library "other_fn"; +// CHECK:STDERR: · ────────────────┬─────────────── +// CHECK:STDERR: · ╰──┤ package imported here [QualifiedDeclOutsidePackageSource] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn Other.G() {} +// CHECK:STDERR: · ━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: imported packages cannot be used for declarations +// CHECK:STDERR: · ┃ [QualifiedDeclOutsidePackage] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Other.G() {} @@ -169,7 +236,12 @@ library "[[@TEST_NAME]]"; import Other library "other_fn_use"; -// CHECK:STDERR: fail_use_other_fn_use.carbon:[[@LINE+2]]:13-19: error: member name `F` not found in `Other` [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╭─┤ fail_use_other_fn_use.carbon:[[@LINE+7]]:13 +// CHECK:STDERR: -> │ fn UseF() { Other.F(); } +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: member name `F` not found in `Other` +// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn UseF() { Other.F(); } @@ -232,9 +304,9 @@ fn UseF() { Other.F(); } // CHECK:STDOUT: %x.patt: %pattern_type = wrapper_binding_pattern x, %x.param_patt [concrete = constants.%x.patt] // CHECK:STDOUT: } { // CHECK:STDOUT: %x.param: %empty_tuple.type = value_param call_param0 -// CHECK:STDOUT: %.loc4_17.1: type = splice_block %.loc4_17.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc4_17.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc4_17.3: type = converted %.loc4_17.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc22_17.1: type = splice_block %.loc22_17.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc22_17.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc22_17.3: type = converted %.loc22_17.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %x: %empty_tuple.type = wrapper_binding x, %x.param // CHECK:STDOUT: } @@ -455,7 +527,7 @@ fn UseF() { Other.F(); } // CHECK:STDOUT: type: type = facet_type [concrete] // CHECK:STDOUT: %F.type.2a8c71.1: type = fn_type @F.1 [concrete] // CHECK:STDOUT: %F.1be9f8.1: %F.type.2a8c71.1 = struct_value () [concrete] -// CHECK:STDOUT: %F.type.2a8c71.2: type = fn_type @F.loc13 [concrete] +// CHECK:STDOUT: %F.type.2a8c71.2: type = fn_type @F.loc30 [concrete] // CHECK:STDOUT: %F.1be9f8.2: %F.type.2a8c71.2 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -474,12 +546,12 @@ fn UseF() { Other.F(); } // CHECK:STDOUT: } // CHECK:STDOUT: %default.import = import // CHECK:STDOUT: %Other.import = import Other -// CHECK:STDOUT: %F.decl: %F.type.2a8c71.2 = fn_decl @F.loc13 [concrete = constants.%F.1be9f8.2] {} {} +// CHECK:STDOUT: %F.decl: %F.type.2a8c71.2 = fn_decl @F.loc30 [concrete = constants.%F.1be9f8.2] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F.1 [from "other_fn.carbon"]; // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.loc13() { +// CHECK:STDOUT: fn @F.loc30() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/packages/export_import.carbon b/toolchain/check/testdata/packages/export_import.carbon index 705312a42d83..fca7ade2bfe7 100644 --- a/toolchain/check/testdata/packages/export_import.carbon +++ b/toolchain/check/testdata/packages/export_import.carbon @@ -76,9 +76,18 @@ var c: C = {.x = ()}; impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_export_in_impl.impl.carbon:[[@LINE+4]]:1-6: error: `export` is only allowed in API files [ExportFromImpl] +// CHECK:STDERR: ╭─┤ fail_export_in_impl.impl.carbon:[[@LINE+13]]:1 +// CHECK:STDERR: -> │ export import library "base"; +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: `export` is only allowed in API files [ExportFromImpl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_export_in_impl.impl.carbon:[[@LINE+2]]:1-29: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_export_in_impl.impl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ export import library "base"; +// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `handle invalid parse trees in `check`` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: export import library "base"; @@ -148,7 +157,11 @@ library "[[@TEST_NAME]]"; import library "non_export"; -// CHECK:STDERR: fail_use_non_export.carbon:[[@LINE+2]]:15: error: name `C` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_use_non_export.carbon:[[@LINE+6]]:15 +// CHECK:STDERR: -> │ alias Local = C; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: name `C` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: alias Local = C; @@ -173,10 +186,18 @@ var indirect_c: C = {.x = ()}; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_export_poisoned.carbon:[[@LINE+2]]:11-16: error: name `Poison` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_export_poisoned.carbon:[[@LINE+6]]:11 +// CHECK:STDERR: -> │ fn F() -> Poison; +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: name `Poison` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F() -> Poison; -// CHECK:STDERR: fail_export_poisoned.carbon:[[@LINE+2]]:1-14: error: name `Poison` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_export_poisoned.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ export Poison; +// CHECK:STDERR: · ━━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: name `Poison` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: export Poison; diff --git a/toolchain/check/testdata/packages/export_mixed.carbon b/toolchain/check/testdata/packages/export_mixed.carbon index c10732c0ef37..5729a5f9122c 100644 --- a/toolchain/check/testdata/packages/export_mixed.carbon +++ b/toolchain/check/testdata/packages/export_mixed.carbon @@ -92,7 +92,11 @@ library "[[@TEST_NAME]]"; import library "export_import_then_name"; import library "export_name_then_import"; -// CHECK:STDERR: fail_nonexport_use_both.carbon:[[@LINE+2]]:8: error: name `D` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_nonexport_use_both.carbon:[[@LINE+6]]:8 +// CHECK:STDERR: -> │ var d: D = {.y = ()}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: name `D` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var d: D = {.y = ()}; @@ -480,8 +484,8 @@ var d: D = {.y = ()}; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc9_19: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc9_20: %struct_type.y = struct_literal (%.loc9_19) [concrete = constants.%struct] +// CHECK:STDOUT: %.loc13_19: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc13_20: %struct_type.y = struct_literal (%.loc13_19) [concrete = constants.%struct] // CHECK:STDOUT: assign file.%d.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/packages/export_name.carbon b/toolchain/check/testdata/packages/export_name.carbon index cc36d91b71ac..032a70cf2dd4 100644 --- a/toolchain/check/testdata/packages/export_name.carbon +++ b/toolchain/check/testdata/packages/export_name.carbon @@ -91,8 +91,17 @@ library "[[@TEST_NAME]]"; import library "base"; -// CHECK:STDERR: fail_export_ns.carbon:[[@LINE+3]]:1-10: error: only imported entities are valid for `export` [ExportNotImportedEntity] -// CHECK:STDERR: base.carbon:8:1-13: note: name is declared here [ExportNotImportedEntitySource] +// CHECK:STDERR: ╭─┤ fail_export_ns.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: -> │ export NS; +// CHECK:STDERR: · ━━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: only imported entities are valid for `export` +// CHECK:STDERR: · ┃ [ExportNotImportedEntity] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ base.carbon +// CHECK:STDERR: │ namespace NS; +// CHECK:STDERR: · ──────┬────── +// CHECK:STDERR: · ╰──┤ name is declared here [ExportNotImportedEntitySource] +// CHECK:STDERR: ╰──── // CHECK:STDERR: export NS; @@ -102,8 +111,16 @@ library "[[@TEST_NAME]]"; class Local {} -// CHECK:STDERR: fail_export_decl.carbon:[[@LINE+3]]:1-13: error: only imported entities are valid for `export` [ExportNotImportedEntity] -// CHECK:STDERR: fail_export_decl.carbon:[[@LINE-3]]:1-13: note: name is declared here [ExportNotImportedEntitySource] +// CHECK:STDERR: ╭─┤ fail_export_decl.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: │ class Local {} +// CHECK:STDERR: · ──────┬────── +// CHECK:STDERR: · ╰──┤ name is declared here [ExportNotImportedEntitySource] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ export Local; +// CHECK:STDERR: · ━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: only imported entities are valid for `export` +// CHECK:STDERR: · ┃ [ExportNotImportedEntity] +// CHECK:STDERR: ╰──── // CHECK:STDERR: export Local; @@ -113,8 +130,18 @@ library "[[@TEST_NAME]]"; import library "base"; -// CHECK:STDERR: fail_export_member.carbon:[[@LINE+3]]:8: error: name qualifiers are only allowed for entities that provide a scope [QualifiedNameInNonScope] -// CHECK:STDERR: base.carbon:4:1-9: note: referenced non-scope entity declared here [QualifiedNameNonScopeEntity] +// CHECK:STDERR: ╭─┤ fail_export_member.carbon:[[@LINE+13]]:8 +// CHECK:STDERR: -> │ export C.x; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: name qualifiers are only allowed for entities that provide a +// CHECK:STDERR: · ┃ scope +// CHECK:STDERR: · ┃ [QualifiedNameInNonScope] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ base.carbon +// CHECK:STDERR: │ class C { +// CHECK:STDERR: · ────┬──── +// CHECK:STDERR: · ╰──┤ referenced non-scope entity declared here [QualifiedNameNonScopeEntity] +// CHECK:STDERR: ╰──── // CHECK:STDERR: export C.x; @@ -144,10 +171,18 @@ library "[[@TEST_NAME]]"; import library "not_reexporting"; -// CHECK:STDERR: fail_use_not_reexporting.carbon:[[@LINE+2]]:15: error: name `C` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_use_not_reexporting.carbon:[[@LINE+6]]:15 +// CHECK:STDERR: -> │ alias Local = C; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: name `C` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: alias Local = C; -// CHECK:STDERR: fail_use_not_reexporting.carbon:[[@LINE+2]]:17-18: error: name `NS` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_use_not_reexporting.carbon:[[@LINE+6]]:17 +// CHECK:STDERR: -> │ alias NSLocal = NS.NSC; +// CHECK:STDERR: · ━┳ +// CHECK:STDERR: · ┗━━┫ error: name `NS` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: alias NSLocal = NS.NSC; @@ -158,8 +193,15 @@ library "[[@TEST_NAME]]"; import library "base"; export C; -// CHECK:STDERR: repeat_export.carbon:[[@LINE+3]]:1-9: warning: `export` matches previous `export` [ExportRedundant] -// CHECK:STDERR: repeat_export.carbon:[[@LINE-2]]:1-9: note: previous `export` here [ExportPrevious] +// CHECK:STDERR: ╭─┤ repeat_export.carbon:[[@LINE+10]]:1 +// CHECK:STDERR: │ export C; +// CHECK:STDERR: · ────┬──── +// CHECK:STDERR: · ╰──┤ previous `export` here [ExportPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ export C; +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ warning: `export` matches previous `export` [ExportRedundant] +// CHECK:STDERR: ╰──── // CHECK:STDERR: export C; @@ -177,7 +219,12 @@ library "[[@TEST_NAME]]"; import library "base"; -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-7: error: `private` not allowed on `export` declaration [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ private export C; +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: `private` not allowed on `export` declaration +// CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╰──── // CHECK:STDERR: private export C; diff --git a/toolchain/check/testdata/packages/fail_api_not_found.carbon b/toolchain/check/testdata/packages/fail_api_not_found.carbon index ffd5223a2202..3e0492bf613b 100644 --- a/toolchain/check/testdata/packages/fail_api_not_found.carbon +++ b/toolchain/check/testdata/packages/fail_api_not_found.carbon @@ -14,19 +14,33 @@ // --- fail_no_api.impl.carbon -// CHECK:STDERR: fail_no_api.impl.carbon:[[@LINE+2]]:1-17: error: corresponding API for 'Foo' not found [LibraryApiNotFound] +// CHECK:STDERR: ╭─┤ fail_no_api.impl.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ impl package Foo; +// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: corresponding API for 'Foo' not found [LibraryApiNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl package Foo; // --- fail_no_api_lib.impl.carbon -// CHECK:STDERR: fail_no_api_lib.impl.carbon:[[@LINE+2]]:1-38: error: corresponding API for 'Foo//no_api_lib' not found [LibraryApiNotFound] +// CHECK:STDERR: ╭─┤ fail_no_api_lib.impl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ impl package Foo library "no_api_lib"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: corresponding API for 'Foo//no_api_lib' not found +// CHECK:STDERR: · ┃ [LibraryApiNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl package Foo library "[[@TEST_NAME]]"; // --- fail_no_api_main_lib.impl.carbon -// CHECK:STDERR: fail_no_api_main_lib.impl.carbon:[[@LINE+2]]:1-31: error: corresponding API for 'Main//no_api_main_lib' not found [LibraryApiNotFound] +// CHECK:STDERR: ╭─┤ fail_no_api_main_lib.impl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ impl library "no_api_main_lib"; +// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: corresponding API for 'Main//no_api_main_lib' not found +// CHECK:STDERR: · ┃ [LibraryApiNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl library "[[@TEST_NAME]]"; diff --git a/toolchain/check/testdata/packages/fail_conflict_no_namespaces.carbon b/toolchain/check/testdata/packages/fail_conflict_no_namespaces.carbon index 7f2b7eceada3..9a75f15e863f 100644 --- a/toolchain/check/testdata/packages/fail_conflict_no_namespaces.carbon +++ b/toolchain/check/testdata/packages/fail_conflict_no_namespaces.carbon @@ -22,16 +22,25 @@ fn Foo(); package Example library "[[@TEST_NAME]]"; +// CHECK:STDERR: ╷ ╭── imported from: fail_conflict.carbon [InImport] +// CHECK:STDERR: ├─┤ var.carbon:[[@LINE+12]]:5 +// CHECK:STDERR: -> │ var Foo: i32; +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `Foo` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ fn.carbon +// CHECK:STDERR: │ fn Foo(); +// CHECK:STDERR: · ────┬──── +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: var Foo: i32; // --- fail_conflict.carbon package Example library "[[@TEST_NAME]]"; -// CHECK:STDERR: imported from: fail_conflict.carbon:[[@LINE+4]]:1 [InImport] -// CHECK:STDERR: var.carbon:4:5-12: error: duplicate name `Foo` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: fn.carbon:4:1-9: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: import library "fn"; import library "var"; @@ -114,9 +123,9 @@ import library "var"; // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %DefaultOrUnformed.facet: %DefaultOrUnformed.type = facet_value constants.%i32, (constants.%DefaultOrUnformed.impl_witness.29f) [concrete = constants.%DefaultOrUnformed.facet] -// CHECK:STDOUT: %.loc4_13.1: %DefaultOrUnformed.type = converted constants.%i32, %DefaultOrUnformed.facet [concrete = constants.%DefaultOrUnformed.facet] -// CHECK:STDOUT: %as_type: type = facet_access_type %.loc4_13.1 [concrete = constants.%i32] -// CHECK:STDOUT: %.loc4_13.2: type = converted %.loc4_13.1, %as_type [concrete = constants.%i32] +// CHECK:STDOUT: %.loc17_13.1: %DefaultOrUnformed.type = converted constants.%i32, %DefaultOrUnformed.facet [concrete = constants.%DefaultOrUnformed.facet] +// CHECK:STDOUT: %as_type: type = facet_access_type %.loc17_13.1 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc17_13.2: type = converted %.loc17_13.1, %as_type [concrete = constants.%i32] // CHECK:STDOUT: %T.as.DefaultOrUnformed.impl.Op.specific_fn: = specific_function constants.%T.as.DefaultOrUnformed.impl.Op.720, @T.as.DefaultOrUnformed.impl.Op(constants.%i32) [concrete = constants.%T.as.DefaultOrUnformed.impl.Op.specific_fn] // CHECK:STDOUT: %T.as.DefaultOrUnformed.impl.Op.call: init %i32 = call %T.as.DefaultOrUnformed.impl.Op.specific_fn() // CHECK:STDOUT: assign file.%Foo.var, %T.as.DefaultOrUnformed.impl.Op.call diff --git a/toolchain/check/testdata/packages/fail_cycle.carbon b/toolchain/check/testdata/packages/fail_cycle.carbon index 52ebf65b495d..40acc2f57fda 100644 --- a/toolchain/check/testdata/packages/fail_cycle.carbon +++ b/toolchain/check/testdata/packages/fail_cycle.carbon @@ -16,7 +16,12 @@ package A; -// CHECK:STDERR: fail_a.carbon:[[@LINE+2]]:1-9: error: import cannot be used due to a cycle; cycle must be fixed to import [ImportCycleDetected] +// CHECK:STDERR: ╭─┤ fail_a.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ import B; +// CHECK:STDERR: · ━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: import cannot be used due to a cycle; cycle must be fixed to import +// CHECK:STDERR: · ┃ [ImportCycleDetected] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import B; @@ -24,7 +29,12 @@ import B; package B; -// CHECK:STDERR: fail_b.carbon:[[@LINE+2]]:1-9: error: import cannot be used due to a cycle; cycle must be fixed to import [ImportCycleDetected] +// CHECK:STDERR: ╭─┤ fail_b.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ import C; +// CHECK:STDERR: · ━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: import cannot be used due to a cycle; cycle must be fixed to import +// CHECK:STDERR: · ┃ [ImportCycleDetected] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import C; @@ -32,13 +42,23 @@ import C; package C; -// CHECK:STDERR: fail_c.carbon:[[@LINE+2]]:1-9: error: import cannot be used due to a cycle; cycle must be fixed to import [ImportCycleDetected] +// CHECK:STDERR: ╭─┤ fail_c.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ import A; +// CHECK:STDERR: · ━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: import cannot be used due to a cycle; cycle must be fixed to import +// CHECK:STDERR: · ┃ [ImportCycleDetected] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import A; // --- fail_c.impl.carbon -// CHECK:STDERR: fail_c.impl.carbon:[[@LINE+2]]:1-15: error: import cannot be used due to a cycle; cycle must be fixed to import [ImportCycleDetected] +// CHECK:STDERR: ╭─┤ fail_c.impl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ impl package C; +// CHECK:STDERR: · ━┳━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: import cannot be used due to a cycle; cycle must be fixed to import +// CHECK:STDERR: · ┃ [ImportCycleDetected] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl package C; @@ -46,7 +66,12 @@ impl package C; package CycleChild; -// CHECK:STDERR: fail_cycle_child.carbon:[[@LINE+2]]:1-9: error: import cannot be used due to a cycle; cycle must be fixed to import [ImportCycleDetected] +// CHECK:STDERR: ╭─┤ fail_cycle_child.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ import B; +// CHECK:STDERR: · ━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: import cannot be used due to a cycle; cycle must be fixed to import +// CHECK:STDERR: · ┃ [ImportCycleDetected] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import B; diff --git a/toolchain/check/testdata/packages/fail_duplicate_api.carbon b/toolchain/check/testdata/packages/fail_duplicate_api.carbon index 7394db4e53c5..6fd00cf4ff82 100644 --- a/toolchain/check/testdata/packages/fail_duplicate_api.carbon +++ b/toolchain/check/testdata/packages/fail_duplicate_api.carbon @@ -24,7 +24,12 @@ library "lib"; // --- fail_main_lib2.carbon -// CHECK:STDERR: fail_main_lib2.carbon:[[@LINE+2]]:1-14: error: library's API previously provided by `main_lib1.carbon` [DuplicateLibraryApi] +// CHECK:STDERR: ╭─┤ fail_main_lib2.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ library "lib"; +// CHECK:STDERR: · ━━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: library's API previously provided by `main_lib1.carbon` +// CHECK:STDERR: · ┃ [DuplicateLibraryApi] +// CHECK:STDERR: ╰──── // CHECK:STDERR: library "lib"; @@ -34,7 +39,12 @@ package Package; // --- fail_package2.carbon -// CHECK:STDERR: fail_package2.carbon:[[@LINE+2]]:1-16: error: library's API previously provided by `package1.carbon` [DuplicateLibraryApi] +// CHECK:STDERR: ╭─┤ fail_package2.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ package Package; +// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: library's API previously provided by `package1.carbon` +// CHECK:STDERR: · ┃ [DuplicateLibraryApi] +// CHECK:STDERR: ╰──── // CHECK:STDERR: package Package; @@ -44,7 +54,12 @@ package Package library "lib"; // --- fail_package_lib2.carbon -// CHECK:STDERR: fail_package_lib2.carbon:[[@LINE+2]]:1-30: error: library's API previously provided by `package_lib1.carbon` [DuplicateLibraryApi] +// CHECK:STDERR: ╭─┤ fail_package_lib2.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ package Package library "lib"; +// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: library's API previously provided by `package_lib1.carbon` +// CHECK:STDERR: · ┃ [DuplicateLibraryApi] +// CHECK:STDERR: ╰──── // CHECK:STDERR: package Package library "lib"; diff --git a/toolchain/check/testdata/packages/fail_export_name_member.carbon b/toolchain/check/testdata/packages/fail_export_name_member.carbon index 50d2b18aa311..d5d210f86ce4 100644 --- a/toolchain/check/testdata/packages/fail_export_name_member.carbon +++ b/toolchain/check/testdata/packages/fail_export_name_member.carbon @@ -28,8 +28,18 @@ import library "a"; // TODO: This diagnostic doesn't clearly explain the problem. We should instead // say something like: Only namespace-scope names can be exported. -// CHECK:STDERR: fail_b.carbon:[[@LINE+3]]:8: error: name qualifiers are only allowed for entities that provide a scope [QualifiedNameInNonScope] -// CHECK:STDERR: a.carbon:4:1-9: note: referenced non-scope entity declared here [QualifiedNameNonScopeEntity] +// CHECK:STDERR: ╭─┤ fail_b.carbon:[[@LINE+13]]:8 +// CHECK:STDERR: -> │ export C.n; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: name qualifiers are only allowed for entities that provide a +// CHECK:STDERR: · ┃ scope +// CHECK:STDERR: · ┃ [QualifiedNameInNonScope] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ a.carbon +// CHECK:STDERR: │ class C { +// CHECK:STDERR: · ────┬──── +// CHECK:STDERR: · ╰──┤ referenced non-scope entity declared here [QualifiedNameNonScopeEntity] +// CHECK:STDERR: ╰──── // CHECK:STDERR: export C.n; diff --git a/toolchain/check/testdata/packages/fail_export_name_params.carbon b/toolchain/check/testdata/packages/fail_export_name_params.carbon index 2d63a830a0a5..88457b2c8eaf 100644 --- a/toolchain/check/testdata/packages/fail_export_name_params.carbon +++ b/toolchain/check/testdata/packages/fail_export_name_params.carbon @@ -27,7 +27,12 @@ import library "a"; export C1; -// CHECK:STDERR: fail_b.carbon:[[@LINE+2]]:10-18: error: `export` declaration cannot have parameters [UnexpectedDeclNameParams] +// CHECK:STDERR: ╭─┤ fail_b.carbon:[[@LINE+7]]:10 +// CHECK:STDERR: -> │ export C2(T: type); +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: `export` declaration cannot have parameters +// CHECK:STDERR: · ┃ [UnexpectedDeclNameParams] +// CHECK:STDERR: ╰──── // CHECK:STDERR: export C2(T: type); @@ -122,9 +127,9 @@ export C2(T: type); // CHECK:STDOUT: } // CHECK:STDOUT: %default.import = import // CHECK:STDOUT: %C1: %C1.type = export C1, imports.%Foo.C1 [concrete = constants.%C1.generic] -// CHECK:STDOUT: %.loc10_14.1: type = splice_block %.loc10_14.2 [concrete = type] { +// CHECK:STDOUT: %.loc15_14.1: type = splice_block %.loc15_14.2 [concrete = type] { // CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc10_14.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc15_14.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic = constants.%T] // CHECK:STDOUT: %C2: %C2.type = export C2, imports.%Foo.C2 [concrete = constants.%C2.generic] diff --git a/toolchain/check/testdata/packages/fail_extension.carbon b/toolchain/check/testdata/packages/fail_extension.carbon index b2e1d587e0f1..6b3c3e280c4e 100644 --- a/toolchain/check/testdata/packages/fail_extension.carbon +++ b/toolchain/check/testdata/packages/fail_extension.carbon @@ -24,49 +24,90 @@ // --- fail_main_lib.incorrect -// CHECK:STDERR: fail_main_lib.incorrect:[[@LINE+2]]:1-19: error: file extension of `.carbon` required for api [IncorrectExtension] +// CHECK:STDERR: ╭─┤ fail_main_lib.incorrect:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ library "main_lib"; +// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: file extension of `.carbon` required for api +// CHECK:STDERR: · ┃ [IncorrectExtension] +// CHECK:STDERR: ╰──── // CHECK:STDERR: library "[[@TEST_NAME]]"; // --- fail_main_lib.impl.incorrect -// CHECK:STDERR: fail_main_lib.impl.incorrect:[[@LINE+2]]:1-24: error: file extension of `.impl.carbon` required for `impl` [IncorrectExtension] +// CHECK:STDERR: ╭─┤ fail_main_lib.impl.incorrect:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ impl library "main_lib"; +// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: file extension of `.impl.carbon` required for `impl` +// CHECK:STDERR: · ┃ [IncorrectExtension] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl library "[[@TEST_NAME]]"; // --- fail_package.incorrect -// CHECK:STDERR: fail_package.incorrect:[[@LINE+2]]:1-16: error: file extension of `.carbon` required for api [IncorrectExtension] +// CHECK:STDERR: ╭─┤ fail_package.incorrect:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ package Package; +// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: file extension of `.carbon` required for api +// CHECK:STDERR: · ┃ [IncorrectExtension] +// CHECK:STDERR: ╰──── // CHECK:STDERR: package Package; // --- fail_package_impl.incorrect -// CHECK:STDERR: fail_package_impl.incorrect:[[@LINE+2]]:1-21: error: file extension of `.impl.carbon` required for `impl` [IncorrectExtension] +// CHECK:STDERR: ╭─┤ fail_package_impl.incorrect:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ impl package Package; +// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: file extension of `.impl.carbon` required for `impl` +// CHECK:STDERR: · ┃ [IncorrectExtension] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl package Package; // --- fail_package_lib.incorrect -// CHECK:STDERR: fail_package_lib.incorrect:[[@LINE+2]]:1-38: error: file extension of `.carbon` required for api [IncorrectExtension] +// CHECK:STDERR: ╭─┤ fail_package_lib.incorrect:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ package Package library "package_lib"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: file extension of `.carbon` required for api +// CHECK:STDERR: · ┃ [IncorrectExtension] +// CHECK:STDERR: ╰──── // CHECK:STDERR: package Package library "[[@TEST_NAME]]"; // --- fail_package_lib.impl.incorrect -// CHECK:STDERR: fail_package_lib.impl.incorrect:[[@LINE+2]]:1-43: error: file extension of `.impl.carbon` required for `impl` [IncorrectExtension] +// CHECK:STDERR: ╭─┤ fail_package_lib.impl.incorrect:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ impl package Package library "package_lib"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: file extension of `.impl.carbon` required for `impl` +// CHECK:STDERR: · ┃ [IncorrectExtension] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl package Package library "[[@TEST_NAME]]"; // --- fail_swapped_ext.impl.carbon -// CHECK:STDERR: fail_swapped_ext.impl.carbon:[[@LINE+2]]:1-19: error: file extension of `.carbon` required for api; `.impl.carbon` names an `impl` file [IncorrectExtension] +// CHECK:STDERR: ╭─┤ fail_swapped_ext.impl.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ package SwappedExt; +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: file extension of `.carbon` required for api; `.impl.carbon` names +// CHECK:STDERR: · ┃ an `impl` file +// CHECK:STDERR: · ┃ [IncorrectExtension] +// CHECK:STDERR: ╰──── // CHECK:STDERR: package SwappedExt; // --- fail_swapped_ext.carbon -// CHECK:STDERR: fail_swapped_ext.carbon:[[@LINE+2]]:1-24: error: file extension of `.impl.carbon` required for `impl` [IncorrectExtension] +// CHECK:STDERR: ╭─┤ fail_swapped_ext.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ impl package SwappedExt; +// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: file extension of `.impl.carbon` required for `impl` +// CHECK:STDERR: · ┃ [IncorrectExtension] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl package SwappedExt; @@ -93,8 +134,8 @@ impl package SwappedExt; // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [concrete] {} -// CHECK:STDOUT: %default.import.loc4_24.1 = import -// CHECK:STDOUT: %default.import.loc4_24.2 = import +// CHECK:STDOUT: %default.import.loc9_24.1 = import +// CHECK:STDOUT: %default.import.loc9_24.2 = import // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_package.incorrect diff --git a/toolchain/check/testdata/packages/fail_import_default.carbon b/toolchain/check/testdata/packages/fail_import_default.carbon index 865cf85026ce..ab54130e99a4 100644 --- a/toolchain/check/testdata/packages/fail_import_default.carbon +++ b/toolchain/check/testdata/packages/fail_import_default.carbon @@ -16,7 +16,11 @@ package A; -// CHECK:STDERR: fail_default_api.carbon:[[@LINE+2]]:1-23: error: file cannot import itself [ImportSelf] +// CHECK:STDERR: ╭─┤ fail_default_api.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ import library default; +// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: file cannot import itself [ImportSelf] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import library default; @@ -24,13 +28,25 @@ import library default; impl package A; -// CHECK:STDERR: fail_default.impl.carbon:[[@LINE+2]]:1-23: error: explicit import of `api` from `impl` file is redundant with implicit import [ExplicitImportApi] +// CHECK:STDERR: ╭─┤ fail_default.impl.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ import library default; +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: explicit import of `api` from `impl` file is redundant with implicit +// CHECK:STDERR: · ┃ import +// CHECK:STDERR: · ┃ [ExplicitImportApi] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import library default; // --- fail_main_import_default.carbon -// CHECK:STDERR: fail_main_import_default.carbon:[[@LINE+2]]:1-23: error: explicit import of `api` from `impl` file is redundant with implicit import [ExplicitImportApi] +// CHECK:STDERR: ╭─┤ fail_main_import_default.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ import library default; +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: explicit import of `api` from `impl` file is redundant with implicit +// CHECK:STDERR: · ┃ import +// CHECK:STDERR: · ┃ [ExplicitImportApi] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import library default; @@ -38,7 +54,11 @@ import library default; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_main_lib_import_default.carbon:[[@LINE+2]]:1-23: error: cannot import `Main//default` [ImportMainDefaultLibrary] +// CHECK:STDERR: ╭─┤ fail_main_lib_import_default.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ import library default; +// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot import `Main//default` [ImportMainDefaultLibrary] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import library default; diff --git a/toolchain/check/testdata/packages/fail_import_inline_not_cpp.carbon b/toolchain/check/testdata/packages/fail_import_inline_not_cpp.carbon index 10e5986a2611..932fa109d171 100644 --- a/toolchain/check/testdata/packages/fail_import_inline_not_cpp.carbon +++ b/toolchain/check/testdata/packages/fail_import_inline_not_cpp.carbon @@ -10,6 +10,11 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/packages/fail_import_inline_not_cpp.carbon -// CHECK:STDERR: fail_import_inline_not_cpp.carbon:[[@LINE+2]]:1-36: error: `inline` import not in package `Cpp` [InlineImportNotCpp] +// CHECK:STDERR: ╭─┤ fail_import_inline_not_cpp.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ import NotCpp inline "not C++ code"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `inline` import not in package `Cpp` +// CHECK:STDERR: · ┃ [InlineImportNotCpp] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import NotCpp inline "not C++ code"; diff --git a/toolchain/check/testdata/packages/fail_import_invalid.carbon b/toolchain/check/testdata/packages/fail_import_invalid.carbon index 399a9284bca1..d1ffdfb7a995 100644 --- a/toolchain/check/testdata/packages/fail_import_invalid.carbon +++ b/toolchain/check/testdata/packages/fail_import_invalid.carbon @@ -14,11 +14,21 @@ // --- fail_main.carbon -// CHECK:STDERR: fail_main.carbon:[[@LINE+2]]:1-12: error: imports from the current package must omit the package name [ImportCurrentPackageByName] +// CHECK:STDERR: ╭─┤ fail_main.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ import Main; +// CHECK:STDERR: · ━━━━━━┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: imports from the current package must omit the package name +// CHECK:STDERR: · ┃ [ImportCurrentPackageByName] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import Main; -// CHECK:STDERR: fail_main.carbon:[[@LINE+2]]:1-26: error: imports from the current package must omit the package name [ImportCurrentPackageByName] +// CHECK:STDERR: ╭─┤ fail_main.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ import Main library "lib"; +// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: imports from the current package must omit the package name +// CHECK:STDERR: · ┃ [ImportCurrentPackageByName] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import Main library "lib"; @@ -26,11 +36,20 @@ import Main library "lib"; package NotMain; -// CHECK:STDERR: fail_not_main.carbon:[[@LINE+2]]:1-12: error: cannot import `Main` from other packages [ImportMainPackage] +// CHECK:STDERR: ╭─┤ fail_not_main.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ import Main; +// CHECK:STDERR: · ━━━━━━┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot import `Main` from other packages [ImportMainPackage] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import Main; -// CHECK:STDERR: fail_not_main.carbon:[[@LINE+2]]:1-26: error: cannot import `Main` from other packages [ImportMainPackage] +// CHECK:STDERR: ╭─┤ fail_not_main.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ import Main library "lib"; +// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot import `Main` from other packages +// CHECK:STDERR: · ┃ [ImportMainPackage] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import Main library "lib"; @@ -38,7 +57,11 @@ import Main library "lib"; package This; -// CHECK:STDERR: fail_this.carbon:[[@LINE+2]]:1-12: error: file cannot import itself [ImportSelf] +// CHECK:STDERR: ╭─┤ fail_this.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ import This; +// CHECK:STDERR: · ━━━━━━┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: file cannot import itself [ImportSelf] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import This; @@ -46,7 +69,11 @@ import This; package This library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_this_lib.carbon:[[@LINE+2]]:1-26: error: file cannot import itself [ImportSelf] +// CHECK:STDERR: ╭─┤ fail_this_lib.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ import library "this_lib"; +// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: file cannot import itself [ImportSelf] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import library "this_lib"; @@ -58,7 +85,13 @@ package Implicit; impl package Implicit; -// CHECK:STDERR: fail_implicit.impl.carbon:[[@LINE+2]]:1-16: error: explicit import of `api` from `impl` file is redundant with implicit import [ExplicitImportApi] +// CHECK:STDERR: ╭─┤ fail_implicit.impl.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ import Implicit; +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: explicit import of `api` from `impl` file is redundant with implicit +// CHECK:STDERR: · ┃ import +// CHECK:STDERR: · ┃ [ExplicitImportApi] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import Implicit; @@ -70,14 +103,24 @@ package Implicit library "[[@TEST_NAME]]"; impl package Implicit library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_implicit_lib.impl.carbon:[[@LINE+2]]:1-39: error: explicit import of `api` from `impl` file is redundant with implicit import [ExplicitImportApi] +// CHECK:STDERR: ╭─┤ fail_implicit_lib.impl.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ import Implicit library "implicit_lib"; +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: explicit import of `api` from `impl` file is redundant with implicit +// CHECK:STDERR: · ┃ import +// CHECK:STDERR: · ┃ [ExplicitImportApi] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import Implicit library "implicit_lib"; // --- fail_not_found.carbon package NotFound; -// CHECK:STDERR: fail_not_found.carbon:[[@LINE+2]]:1-22: error: imported API 'ImportNotFound' not found [ImportNotFound] +// CHECK:STDERR: ╭─┤ fail_not_found.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ import ImportNotFound; +// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: imported API 'ImportNotFound' not found [ImportNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import ImportNotFound; diff --git a/toolchain/check/testdata/packages/fail_import_repeat.carbon b/toolchain/check/testdata/packages/fail_import_repeat.carbon index 6570866751e3..b3ce4f918cf7 100644 --- a/toolchain/check/testdata/packages/fail_import_repeat.carbon +++ b/toolchain/check/testdata/packages/fail_import_repeat.carbon @@ -27,20 +27,41 @@ library "[[@TEST_NAME]]"; // --- fail_import.carbon import Api; -// CHECK:STDERR: fail_import.carbon:[[@LINE+3]]:1-11: error: library imported more than once [RepeatedImport] -// CHECK:STDERR: fail_import.carbon:[[@LINE-2]]:1-11: note: first import here [FirstImported] +// CHECK:STDERR: ╭─┤ fail_import.carbon:[[@LINE+10]]:1 +// CHECK:STDERR: │ import Api; +// CHECK:STDERR: · ─────┬───── +// CHECK:STDERR: · ╰──┤ first import here [FirstImported] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ import Api; +// CHECK:STDERR: · ━━━━━┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: library imported more than once [RepeatedImport] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import Api; import Api library "api_lib"; -// CHECK:STDERR: fail_import.carbon:[[@LINE+3]]:1-29: error: library imported more than once [RepeatedImport] -// CHECK:STDERR: fail_import.carbon:[[@LINE-2]]:1-29: note: first import here [FirstImported] +// CHECK:STDERR: ╭─┤ fail_import.carbon:[[@LINE+10]]:1 +// CHECK:STDERR: │ import Api library "api_lib"; +// CHECK:STDERR: · ──────────────┬────────────── +// CHECK:STDERR: · ╰──┤ first import here [FirstImported] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ import Api library "api_lib"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: library imported more than once [RepeatedImport] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import Api library "api_lib"; import library "main_lib"; -// CHECK:STDERR: fail_import.carbon:[[@LINE+3]]:1-26: error: library imported more than once [RepeatedImport] -// CHECK:STDERR: fail_import.carbon:[[@LINE-2]]:1-26: note: first import here [FirstImported] +// CHECK:STDERR: ╭─┤ fail_import.carbon:[[@LINE+10]]:1 +// CHECK:STDERR: │ import library "main_lib"; +// CHECK:STDERR: · ─────────────┬──────────── +// CHECK:STDERR: · ╰──┤ first import here [FirstImported] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ import library "main_lib"; +// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: library imported more than once [RepeatedImport] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import library "main_lib"; @@ -49,8 +70,15 @@ import library "main_lib"; package Api library "[[@TEST_NAME]]"; import library default; -// CHECK:STDERR: fail_default_import.carbon:[[@LINE+3]]:1-23: error: library imported more than once [RepeatedImport] -// CHECK:STDERR: fail_default_import.carbon:[[@LINE-2]]:1-23: note: first import here [FirstImported] +// CHECK:STDERR: ╭─┤ fail_default_import.carbon:[[@LINE+10]]:1 +// CHECK:STDERR: │ import library default; +// CHECK:STDERR: · ───────────┬─────────── +// CHECK:STDERR: · ╰──┤ first import here [FirstImported] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ import library default; +// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: library imported more than once [RepeatedImport] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import library default; diff --git a/toolchain/check/testdata/packages/fail_import_type_error.carbon b/toolchain/check/testdata/packages/fail_import_type_error.carbon index 703c80ff411c..8017b8859ada 100644 --- a/toolchain/check/testdata/packages/fail_import_type_error.carbon +++ b/toolchain/check/testdata/packages/fail_import_type_error.carbon @@ -16,16 +16,32 @@ package Implicit; -// CHECK:STDERR: fail_implicit.carbon:[[@LINE+2]]:12: error: name `x` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_implicit.carbon:[[@LINE+6]]:12 +// CHECK:STDERR: -> │ var a_ref: x; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: name `x` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var a_ref: x; -// CHECK:STDERR: fail_implicit.carbon:[[@LINE+2]]:18: error: name `x` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_implicit.carbon:[[@LINE+6]]:18 +// CHECK:STDERR: -> │ var b_ref: {.a = x}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: name `x` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var b_ref: {.a = x}; -// CHECK:STDERR: fail_implicit.carbon:[[@LINE+2]]:13: error: name `x` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_implicit.carbon:[[@LINE+6]]:13 +// CHECK:STDERR: -> │ var c_ref: (x,); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: name `x` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var c_ref: (x,); -// CHECK:STDERR: fail_implicit.carbon:[[@LINE+2]]:12: error: name `x` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_implicit.carbon:[[@LINE+6]]:12 +// CHECK:STDERR: -> │ var d_ref: x*; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: name `x` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var d_ref: x*; @@ -64,7 +80,7 @@ var d: i32 = d_ref; // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %a_ref.var: ref = var_storage %a_ref.var_patt [concrete = ] -// CHECK:STDOUT: %x.ref.loc6: = name_ref x, [concrete = ] +// CHECK:STDOUT: %x.ref.loc10: = name_ref x, [concrete = ] // CHECK:STDOUT: %a_ref: = wrapper_binding a_ref, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %a_ref.patt: = ref_binding_pattern a_ref [concrete = ] @@ -72,8 +88,8 @@ var d: i32 = d_ref; // CHECK:STDOUT: } // CHECK:STDOUT: %b_ref.var: ref = var_storage %b_ref.var_patt [concrete = ] // CHECK:STDOUT: %.1: = splice_block [concrete = ] { -// CHECK:STDOUT: %x.ref.loc9: = name_ref x, [concrete = ] -// CHECK:STDOUT: %.loc9: = struct_literal (%x.ref.loc9) [concrete = ] +// CHECK:STDOUT: %x.ref.loc17: = name_ref x, [concrete = ] +// CHECK:STDOUT: %.loc17: = struct_literal (%x.ref.loc17) [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: %b_ref: = wrapper_binding b_ref, [concrete = ] // CHECK:STDOUT: name_binding_decl { @@ -82,8 +98,8 @@ var d: i32 = d_ref; // CHECK:STDOUT: } // CHECK:STDOUT: %c_ref.var: ref = var_storage %c_ref.var_patt [concrete = ] // CHECK:STDOUT: %.2: = splice_block [concrete = ] { -// CHECK:STDOUT: %x.ref.loc12: = name_ref x, [concrete = ] -// CHECK:STDOUT: %.loc12: = tuple_literal (%x.ref.loc12) [concrete = ] +// CHECK:STDOUT: %x.ref.loc24: = name_ref x, [concrete = ] +// CHECK:STDOUT: %.loc24: = tuple_literal (%x.ref.loc24) [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: %c_ref: = wrapper_binding c_ref, [concrete = ] // CHECK:STDOUT: name_binding_decl { @@ -91,8 +107,8 @@ var d: i32 = d_ref; // CHECK:STDOUT: %c_ref.var_patt: = var_pattern %c_ref.patt [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: %d_ref.var: ref = var_storage %d_ref.var_patt [concrete = ] -// CHECK:STDOUT: %.loc15: type = splice_block %ptr [concrete = ] { -// CHECK:STDOUT: %x.ref.loc15: = name_ref x, [concrete = ] +// CHECK:STDOUT: %.loc31: type = splice_block %ptr [concrete = ] { +// CHECK:STDOUT: %x.ref.loc31: = name_ref x, [concrete = ] // CHECK:STDOUT: %ptr: type = ptr_type [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: %d_ref: = wrapper_binding d_ref, [concrete = ] diff --git a/toolchain/check/testdata/packages/fail_modifiers.carbon b/toolchain/check/testdata/packages/fail_modifiers.carbon index 27147ca27c02..7f4bf30557a5 100644 --- a/toolchain/check/testdata/packages/fail_modifiers.carbon +++ b/toolchain/check/testdata/packages/fail_modifiers.carbon @@ -12,70 +12,152 @@ // --- fail_extend_package.carbon -// CHECK:STDERR: fail_extend_package.carbon:[[@LINE+2]]:1-6: error: `extend` not allowed on `package` declaration [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╭─┤ fail_extend_package.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ extend package ExtendPackage; +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: `extend` not allowed on `package` declaration +// CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╰──── // CHECK:STDERR: extend package ExtendPackage; // --- fail_export_package.carbon -// CHECK:STDERR: fail_export_package.carbon:[[@LINE+2]]:1-6: error: `export` not allowed on `package` declaration [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╭─┤ fail_export_package.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ export package ExportPackage; +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: `export` not allowed on `package` declaration +// CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╰──── // CHECK:STDERR: export package ExportPackage; // --- fail_final_package.carbon -// CHECK:STDERR: fail_final_package.carbon:[[@LINE+4]]:1-28: error: library's API previously provided by `fail_extend_package.carbon` [DuplicateLibraryApi] +// CHECK:STDERR: ╭─┤ fail_final_package.carbon:[[@LINE+14]]:1 +// CHECK:STDERR: -> │ final package ExtendPackage; +// CHECK:STDERR: · ━━━┳━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: library's API previously provided by `fail_extend_package.carbon` +// CHECK:STDERR: · ┃ [DuplicateLibraryApi] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_final_package.carbon:[[@LINE+2]]:1-5: error: `final` not allowed on `package` declaration [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╭─┤ fail_final_package.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ final package ExtendPackage; +// CHECK:STDERR: · ━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: `final` not allowed on `package` declaration +// CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╰──── // CHECK:STDERR: final package ExtendPackage; // --- fail_virtual_package.carbon -// CHECK:STDERR: fail_virtual_package.carbon:[[@LINE+2]]:1-7: error: `virtual` not allowed on `package` declaration [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╭─┤ fail_virtual_package.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ virtual package VirtualPackage; +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: `virtual` not allowed on `package` declaration +// CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╰──── // CHECK:STDERR: virtual package VirtualPackage; // --- fail_private_package.carbon -// CHECK:STDERR: fail_private_package.carbon:[[@LINE+2]]:1-7: error: `private` not allowed on `package` declaration [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╭─┤ fail_private_package.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ private package PrivatePackage; +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: `private` not allowed on `package` declaration +// CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╰──── // CHECK:STDERR: private package PrivatePackage; // --- fail_export_library.carbon -// CHECK:STDERR: fail_export_library.carbon:[[@LINE+2]]:1-6: error: `export` not allowed on `library` declaration [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╭─┤ fail_export_library.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ export library "export_library"; +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: `export` not allowed on `library` declaration +// CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╰──── // CHECK:STDERR: export library "export_library"; // --- fail_import_modifiers.carbon -// CHECK:STDERR: fail_import_modifiers.carbon:[[@LINE+4]]:1-23: error: imported API 'ImplImport' not found [ImportNotFound] +// CHECK:STDERR: ╭─┤ fail_import_modifiers.carbon:[[@LINE+13]]:1 +// CHECK:STDERR: -> │ impl import ImplImport; +// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: imported API 'ImplImport' not found [ImportNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_import_modifiers.carbon:[[@LINE+2]]:1-4: error: `impl` not allowed on `import` declaration [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╭─┤ fail_import_modifiers.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ impl import ImplImport; +// CHECK:STDERR: · ━━┳━ +// CHECK:STDERR: · ┗━━┫ error: `impl` not allowed on `import` declaration +// CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl import ImplImport; -// CHECK:STDERR: fail_import_modifiers.carbon:[[@LINE+4]]:1-27: error: imported API 'ExtendImport' not found [ImportNotFound] +// CHECK:STDERR: ╭─┤ fail_import_modifiers.carbon:[[@LINE+13]]:1 +// CHECK:STDERR: -> │ extend import ExtendImport; +// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: imported API 'ExtendImport' not found [ImportNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_import_modifiers.carbon:[[@LINE+2]]:1-6: error: `extend` not allowed on `import` declaration [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╭─┤ fail_import_modifiers.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ extend import ExtendImport; +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: `extend` not allowed on `import` declaration +// CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╰──── // CHECK:STDERR: extend import ExtendImport; -// CHECK:STDERR: fail_import_modifiers.carbon:[[@LINE+4]]:1-29: error: imported API 'VirtualImport' not found [ImportNotFound] +// CHECK:STDERR: ╭─┤ fail_import_modifiers.carbon:[[@LINE+14]]:1 +// CHECK:STDERR: -> │ virtual import VirtualImport; +// CHECK:STDERR: · ━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: imported API 'VirtualImport' not found +// CHECK:STDERR: · ┃ [ImportNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_import_modifiers.carbon:[[@LINE+2]]:1-7: error: `virtual` not allowed on `import` declaration [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╭─┤ fail_import_modifiers.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ virtual import VirtualImport; +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: `virtual` not allowed on `import` declaration +// CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╰──── // CHECK:STDERR: virtual import VirtualImport; -// CHECK:STDERR: fail_import_modifiers.carbon:[[@LINE+4]]:1-23: error: imported API 'BaseImport' not found [ImportNotFound] +// CHECK:STDERR: ╭─┤ fail_import_modifiers.carbon:[[@LINE+13]]:1 +// CHECK:STDERR: -> │ base import BaseImport; +// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: imported API 'BaseImport' not found [ImportNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_import_modifiers.carbon:[[@LINE+2]]:1-4: error: `base` not allowed on `import` declaration [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╭─┤ fail_import_modifiers.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ base import BaseImport; +// CHECK:STDERR: · ━━┳━ +// CHECK:STDERR: · ┗━━┫ error: `base` not allowed on `import` declaration +// CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╰──── // CHECK:STDERR: base import BaseImport; -// CHECK:STDERR: fail_import_modifiers.carbon:[[@LINE+4]]:1-29: error: imported API 'PrivateImport' not found [ImportNotFound] +// CHECK:STDERR: ╭─┤ fail_import_modifiers.carbon:[[@LINE+14]]:1 +// CHECK:STDERR: -> │ private import PrivateImport; +// CHECK:STDERR: · ━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: imported API 'PrivateImport' not found +// CHECK:STDERR: · ┃ [ImportNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_import_modifiers.carbon:[[@LINE+2]]:1-7: error: `private` not allowed on `import` declaration [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╭─┤ fail_import_modifiers.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ private import PrivateImport; +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: `private` not allowed on `import` declaration +// CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╰──── // CHECK:STDERR: private import PrivateImport; diff --git a/toolchain/check/testdata/packages/fail_name_with_import_failure.carbon b/toolchain/check/testdata/packages/fail_name_with_import_failure.carbon index f0dc44c5ee4a..4bd53b003ffd 100644 --- a/toolchain/check/testdata/packages/fail_name_with_import_failure.carbon +++ b/toolchain/check/testdata/packages/fail_name_with_import_failure.carbon @@ -14,7 +14,12 @@ // --- fail_implicit.impl.carbon -// CHECK:STDERR: fail_implicit.impl.carbon:[[@LINE+2]]:1-22: error: corresponding API for 'Implicit' not found [LibraryApiNotFound] +// CHECK:STDERR: ╭─┤ fail_implicit.impl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ impl package Implicit; +// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: corresponding API for 'Implicit' not found +// CHECK:STDERR: · ┃ [LibraryApiNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl package Implicit; @@ -39,9 +44,9 @@ var a: () = A(); // CHECK:STDOUT: } // CHECK:STDOUT: %default.import = import // CHECK:STDOUT: %a.var: ref %empty_tuple.type = var_storage %a.var_patt [concrete] -// CHECK:STDOUT: %.loc6_9.1: type = splice_block %.loc6_9.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc6_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc6_9.3: type = converted %.loc6_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc11_9.1: type = splice_block %.loc11_9.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc11_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc11_9.3: type = converted %.loc11_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %a: ref %empty_tuple.type = wrapper_binding a, %a.var [concrete = %a.var] // CHECK:STDOUT: name_binding_decl { diff --git a/toolchain/check/testdata/packages/implicit_imports_entities.carbon b/toolchain/check/testdata/packages/implicit_imports_entities.carbon index 5b95123172b7..013a0b4ff5ba 100644 --- a/toolchain/check/testdata/packages/implicit_imports_entities.carbon +++ b/toolchain/check/testdata/packages/implicit_imports_entities.carbon @@ -131,14 +131,23 @@ var o1: Other.O1 = {}; library "[[@TEST_NAME]]"; +// CHECK:STDERR: ╷ ╭── imported from: fail_import_conflict.impl.carbon [InImport] +// CHECK:STDERR: ├─┤ import_conflict.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: -> │ import Other library "o1"; +// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `Other` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ local_other.carbon +// CHECK:STDERR: │ class Other {} +// CHECK:STDERR: · ──────┬────── +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: import Other library "o1"; // --- fail_import_conflict.impl.carbon -// CHECK:STDERR: imported from: fail_import_conflict.impl.carbon:[[@LINE+4]]:1 [InImport] -// CHECK:STDERR: import_conflict.carbon:4:1-26: error: duplicate name `Other` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: local_other.carbon:4:1-13: note: name is previously declared here [NameDeclPrevious] -// CHECK:STDERR: impl library "[[@TEST_NAME]]"; import library "local_other"; @@ -153,8 +162,17 @@ import library "local_other"; impl library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_import_conflict_reverse.impl.carbon:[[@LINE+3]]:1-26: error: duplicate name `Other` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: local_other.carbon:4:1-13: note: name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╭─┤ fail_import_conflict_reverse.impl.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: -> │ import Other library "o1"; +// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `Other` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ local_other.carbon +// CHECK:STDERR: │ class Other {} +// CHECK:STDERR: · ──────┬────── +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import Other library "o1"; @@ -748,8 +766,8 @@ import Other library "o1"; // CHECK:STDOUT: package: = namespace [concrete] { // CHECK:STDOUT: .Other = imports.%Other // CHECK:STDOUT: } -// CHECK:STDOUT: %default.import.loc6_31.1 = import -// CHECK:STDOUT: %default.import.loc6_31.2 = import +// CHECK:STDOUT: %default.import.loc2_31.1 = import +// CHECK:STDOUT: %default.import.loc2_31.2 = import // CHECK:STDOUT: %Other.import = import Other // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/packages/missing_prelude.carbon b/toolchain/check/testdata/packages/missing_prelude.carbon index 50bcc38aa81c..b99570058baa 100644 --- a/toolchain/check/testdata/packages/missing_prelude.carbon +++ b/toolchain/check/testdata/packages/missing_prelude.carbon @@ -16,7 +16,13 @@ library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_missing_prelude.carbon:[[@LINE+2]]:8-10: error: `Core.Int` implicitly referenced here, but package `Core` not found [CoreNotFound] +// CHECK:STDERR: ╭─┤ fail_missing_prelude.carbon:[[@LINE+8]]:8 +// CHECK:STDERR: -> │ var n: i32; +// CHECK:STDERR: · ┳━━ +// CHECK:STDERR: · ┗━━┫ error: `Core.Int` implicitly referenced here, but package `Core` not +// CHECK:STDERR: · ┃ found +// CHECK:STDERR: · ┃ [CoreNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var n: i32; @@ -30,7 +36,12 @@ library "[[@TEST_NAME]]"; import Core library "prelude_empty"; -// CHECK:STDERR: fail_missing_prelude_member.carbon:[[@LINE+2]]:8-10: error: name `Core.Int` implicitly referenced here, but not found [CoreNameNotFound] +// CHECK:STDERR: ╭─┤ fail_missing_prelude_member.carbon:[[@LINE+7]]:8 +// CHECK:STDERR: -> │ var n: i32; +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┗━━┫ error: name `Core.Int` implicitly referenced here, but not found +// CHECK:STDERR: · ┃ [CoreNameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var n: i32; @@ -53,11 +64,27 @@ library "[[@TEST_NAME]]"; import Core library "prelude_fake_int"; // We don't really care whether this works, but it shouldn't crash or otherwise misbehave. -// CHECK:STDERR: fail_use_fake_int.carbon:[[@LINE+6]]:17-19: error: cannot implicitly convert non-type value of type `Core.X` to `type` [ConversionFailureNonTypeToFacet] -// CHECK:STDERR: fail_use_fake_int.carbon:[[@LINE+5]]:17-19: note: type `Core.X` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_use_fake_int.carbon:[[@LINE+22]]:17 +// CHECK:STDERR: -> │ let n: Core.X = i32; +// CHECK:STDERR: · ┳━━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert non-type value of type +// CHECK:STDERR: · │ ┃ `Core.X` to `type` +// CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet] +// CHECK:STDERR: · ╰────┤ type `Core.X` does not implement interface +// CHECK:STDERR: · │ `Core.ImplicitAs(type)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_use_fake_int.carbon:[[@LINE+3]]:17-19: error: cannot implicitly convert expression of type `type` to `Core.X` [ConversionFailure] -// CHECK:STDERR: fail_use_fake_int.carbon:[[@LINE+2]]:17-19: note: type `type` does not implement interface `Core.ImplicitAs(Core.X)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_use_fake_int.carbon:[[@LINE+11]]:17 +// CHECK:STDERR: -> │ let n: Core.X = i32; +// CHECK:STDERR: · ┳━━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `type` +// CHECK:STDERR: · │ ┃ to `Core.X` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╰────┤ type `type` does not implement interface +// CHECK:STDERR: · │ `Core.ImplicitAs(Core.X)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let n: Core.X = i32; @@ -75,18 +102,40 @@ let n: i32 = {}; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_prelude_as_namespace.carbon:[[@LINE+2]]:11-14: error: `namespace` introducer should be followed by a name; prefix reserved word with `r#` to form a valid identifier [ExpectedDeclName] +// CHECK:STDERR: ╭─┤ fail_prelude_as_namespace.carbon:[[@LINE+8]]:11 +// CHECK:STDERR: -> │ namespace Core; +// CHECK:STDERR: · ┳━━━ +// CHECK:STDERR: · ┗━━┫ error: `namespace` introducer should be followed by a name; +// CHECK:STDERR: · ┃ prefix reserved word with `r#` to form a valid identifier +// CHECK:STDERR: · ┃ [ExpectedDeclName] +// CHECK:STDERR: ╰──── // CHECK:STDERR: namespace Core; -// CHECK:STDERR: fail_prelude_as_namespace.carbon:[[@LINE+4]]:4-7: error: `fn` introducer should be followed by a name; prefix reserved word with `r#` to form a valid identifier [ExpectedDeclName] +// CHECK:STDERR: ╭─┤ fail_prelude_as_namespace.carbon:[[@LINE+14]]:4 +// CHECK:STDERR: -> │ fn Core.Int[T: type](generic N: T) -> {} { return {}; } +// CHECK:STDERR: · ┳━━━ +// CHECK:STDERR: · ┗━━┫ error: `fn` introducer should be followed by a name; prefix reserved +// CHECK:STDERR: · ┃ word with `r#` to form a valid identifier +// CHECK:STDERR: · ┃ [ExpectedDeclName] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_prelude_as_namespace.carbon:[[@LINE+2]]:30-33: warning: binding `N` unused [UnusedBinding] +// CHECK:STDERR: ╭─┤ fail_prelude_as_namespace.carbon:[[@LINE+6]]:30 +// CHECK:STDERR: -> │ fn Core.Int[T: type](generic N: T) -> {} { return {}; } +// CHECK:STDERR: · ━━┳━ +// CHECK:STDERR: · ┗━━┫ warning: binding `N` unused [UnusedBinding] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Core.Int[T: type](generic N: T) -> {} { return {}; } // Make sure use of `i32` doesn't crash after above errors. -// CHECK:STDERR: fail_prelude_as_namespace.carbon:[[@LINE+2]]:15-17: error: `Core.Int` implicitly referenced here, but package `Core` not found [CoreNotFound] +// CHECK:STDERR: ╭─┤ fail_prelude_as_namespace.carbon:[[@LINE+8]]:15 +// CHECK:STDERR: -> │ let n: type = i32; +// CHECK:STDERR: · ┳━━ +// CHECK:STDERR: · ┗━━┫ error: `Core.Int` implicitly referenced here, but package +// CHECK:STDERR: · ┃ `Core` not found +// CHECK:STDERR: · ┃ [CoreNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let n: type = i32; @@ -94,13 +143,25 @@ let n: type = i32; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_prelude_as_class.carbon:[[@LINE+2]]:7-10: error: `class` introducer should be followed by a name; prefix reserved word with `r#` to form a valid identifier [ExpectedDeclName] +// CHECK:STDERR: ╭─┤ fail_prelude_as_class.carbon:[[@LINE+8]]:7 +// CHECK:STDERR: -> │ class Core { +// CHECK:STDERR: · ┳━━━ +// CHECK:STDERR: · ┗━━┫ error: `class` introducer should be followed by a name; prefix +// CHECK:STDERR: · ┃ reserved word with `r#` to form a valid identifier +// CHECK:STDERR: · ┃ [ExpectedDeclName] +// CHECK:STDERR: ╰──── // CHECK:STDERR: class Core { fn Int[T: type](generic _: T) -> {} { return {}; } } -// CHECK:STDERR: fail_prelude_as_class.carbon:[[@LINE+2]]:15-17: error: `Core.Int` implicitly referenced here, but package `Core` not found [CoreNotFound] +// CHECK:STDERR: ╭─┤ fail_prelude_as_class.carbon:[[@LINE+8]]:15 +// CHECK:STDERR: -> │ let n: type = i32; +// CHECK:STDERR: · ┳━━ +// CHECK:STDERR: · ┗━━┫ error: `Core.Int` implicitly referenced here, but package +// CHECK:STDERR: · ┃ `Core` not found +// CHECK:STDERR: · ┃ [CoreNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let n: type = i32; @@ -116,7 +177,7 @@ let n: type = i32; // CHECK:STDOUT: .n = %n // CHECK:STDOUT: } // CHECK:STDOUT: %n.var: ref = var_storage %n.var_patt [concrete = ] -// CHECK:STDOUT: %.loc6: type = type_literal [concrete = ] +// CHECK:STDOUT: %.loc12: type = type_literal [concrete = ] // CHECK:STDOUT: %n: = wrapper_binding n, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %n.patt: = ref_binding_pattern n [concrete = ] @@ -156,7 +217,7 @@ let n: type = i32; // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %n.var: ref = var_storage %n.var_patt [concrete = ] -// CHECK:STDOUT: %.loc8: type = type_literal [concrete = ] +// CHECK:STDOUT: %.loc13: type = type_literal [concrete = ] // CHECK:STDOUT: %n: = wrapper_binding n, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %n.patt: = ref_binding_pattern n [concrete = ] @@ -445,8 +506,8 @@ let n: type = i32; // CHECK:STDOUT: .n = %n // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %.loc13_17: %X = converted @__global_init.%.loc13_17.3, [concrete = ] -// CHECK:STDOUT: %.loc13_12: type = splice_block %X.ref [concrete = constants.%X] { +// CHECK:STDOUT: %.loc29_17: %X = converted @__global_init.%.loc29_17.3, [concrete = ] +// CHECK:STDOUT: %.loc29_12: type = splice_block %X.ref [concrete = constants.%X] { // CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [concrete = imports.%Core] // CHECK:STDOUT: %X.ref: type = name_ref X, imports.%Core.X [concrete = constants.%X] // CHECK:STDOUT: } @@ -512,10 +573,10 @@ let n: type = i32; // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Int.specific_fn: = specific_function constants.%Int, @Int(Core.IntLiteral, constants.%int_32) [concrete = constants.%Int.specific_fn] -// CHECK:STDOUT: %.loc13_17.1: ref %X = temporary_storage -// CHECK:STDOUT: %Int.call: init %X to %.loc13_17.1 = call %Int.specific_fn() -// CHECK:STDOUT: %.loc13_17.2: type = converted %Int.call, [concrete = ] -// CHECK:STDOUT: %.loc13_17.3: type = type_literal [concrete = ] +// CHECK:STDOUT: %.loc29_17.1: ref %X = temporary_storage +// CHECK:STDOUT: %Int.call: init %X to %.loc29_17.1 = call %Int.specific_fn() +// CHECK:STDOUT: %.loc29_17.2: type = converted %Int.call, [concrete = ] +// CHECK:STDOUT: %.loc29_17.3: type = type_literal [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -730,64 +791,64 @@ let n: type = i32; // CHECK:STDOUT: .Int = %Int.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Int.decl: %Int.type = fn_decl @Int [concrete = constants.%Int] { -// CHECK:STDOUT: %T.patt.loc12_14.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc12_14.2 (constants.%T.patt)] -// CHECK:STDOUT: %N.patt.loc12_31.1: @Int.%pattern_type (%pattern_type.51d) = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc12_31.2 (constants.%N.patt)] +// CHECK:STDOUT: %T.patt.loc28_14.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc28_14.2 (constants.%T.patt)] +// CHECK:STDOUT: %N.patt.loc28_31.1: @Int.%pattern_type (%pattern_type.51d) = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc28_31.2 (constants.%N.patt)] // CHECK:STDOUT: %return.param_patt: %pattern_type.a96 = out_param_pattern [concrete = constants.%return.param_patt] -// CHECK:STDOUT: %return.patt: %pattern_type.a96 = return_slot_pattern %return.param_patt, %.loc12_40.2 [concrete = constants.%return.patt] +// CHECK:STDOUT: %return.patt: %pattern_type.a96 = return_slot_pattern %return.param_patt, %.loc28_40.2 [concrete = constants.%return.patt] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc12_40.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc12_40.2: type = converted %.loc12_40.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %.loc12_40.3: Core.Form = init_form %.loc12_40.2 [concrete = constants.%.469] -// CHECK:STDOUT: %.loc12_16.1: type = splice_block %.loc12_16.2 [concrete = type] { -// CHECK:STDOUT: %.Self.frozen.loc12_14: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc12_16.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc28_40.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc28_40.2: type = converted %.loc28_40.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc28_40.3: Core.Form = init_form %.loc28_40.2 [concrete = constants.%.469] +// CHECK:STDOUT: %.loc28_16.1: type = splice_block %.loc28_16.2 [concrete = type] { +// CHECK:STDOUT: %.Self.frozen.loc28_14: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc28_16.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc12_14.2: type = symbolic_binding T, 0 [symbolic = %T.loc12_14.1 (constants.%T)] -// CHECK:STDOUT: %.loc12_33: type = splice_block %T.ref [symbolic = %T.loc12_14.1 (constants.%T)] { -// CHECK:STDOUT: %.Self.frozen.loc12_31: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc12_14.2 [symbolic = %T.loc12_14.1 (constants.%T)] +// CHECK:STDOUT: %T.loc28_14.2: type = symbolic_binding T, 0 [symbolic = %T.loc28_14.1 (constants.%T)] +// CHECK:STDOUT: %.loc28_33: type = splice_block %T.ref [symbolic = %T.loc28_14.1 (constants.%T)] { +// CHECK:STDOUT: %.Self.frozen.loc28_31: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc28_14.2 [symbolic = %T.loc28_14.1 (constants.%T)] // CHECK:STDOUT: } -// CHECK:STDOUT: %N.loc12_31.2: @Int.%T.loc12_14.1 (%T) = symbolic_binding N, 1 [symbolic = %N.loc12_31.1 (constants.%N)] +// CHECK:STDOUT: %N.loc28_31.2: @Int.%T.loc28_14.1 (%T) = symbolic_binding N, 1 [symbolic = %N.loc28_31.1 (constants.%N)] // CHECK:STDOUT: %return.param: ref %empty_struct_type = out_param call_param0 // CHECK:STDOUT: %return: ref %empty_struct_type = return_slot %return.param // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc17: type = type_literal type [concrete = type] -// CHECK:STDOUT: %n: type = wrapper_binding n, @__global_init.%.loc17 [concrete = ] +// CHECK:STDOUT: %.loc39: type = type_literal type [concrete = type] +// CHECK:STDOUT: %n: type = wrapper_binding n, @__global_init.%.loc39 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %n.patt: %pattern_type.9a5 = value_binding_pattern n [concrete = constants.%n.patt] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Int(%T.loc12_14.2: type, %N.loc12_31.2: @Int.%T.loc12_14.1 (%T)) { -// CHECK:STDOUT: %T.patt.loc12_14.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc12_14.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc12_14.1: type = symbolic_binding T, 0 [symbolic = %T.loc12_14.1 (constants.%T)] -// CHECK:STDOUT: %pattern_type: type = pattern_type %T.loc12_14.1 [symbolic = %pattern_type (constants.%pattern_type.51d)] -// CHECK:STDOUT: %N.patt.loc12_31.2: @Int.%pattern_type (%pattern_type.51d) = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc12_31.2 (constants.%N.patt)] -// CHECK:STDOUT: %N.loc12_31.1: @Int.%T.loc12_14.1 (%T) = symbolic_binding N, 1 [symbolic = %N.loc12_31.1 (constants.%N)] +// CHECK:STDOUT: generic fn @Int(%T.loc28_14.2: type, %N.loc28_31.2: @Int.%T.loc28_14.1 (%T)) { +// CHECK:STDOUT: %T.patt.loc28_14.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc28_14.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc28_14.1: type = symbolic_binding T, 0 [symbolic = %T.loc28_14.1 (constants.%T)] +// CHECK:STDOUT: %pattern_type: type = pattern_type %T.loc28_14.1 [symbolic = %pattern_type (constants.%pattern_type.51d)] +// CHECK:STDOUT: %N.patt.loc28_31.2: @Int.%pattern_type (%pattern_type.51d) = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc28_31.2 (constants.%N.patt)] +// CHECK:STDOUT: %N.loc28_31.1: @Int.%T.loc28_14.1 (%T) = symbolic_binding N, 1 [symbolic = %N.loc28_31.1 (constants.%N)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: // CHECK:STDOUT: fn() -> out %return.param: %empty_struct_type { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc12_52.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc12_52.2: init %empty_struct_type = struct_init () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc12_53: init %empty_struct_type = converted %.loc12_52.1, %.loc12_52.2 [concrete = constants.%empty_struct] -// CHECK:STDOUT: return %.loc12_53 +// CHECK:STDOUT: %.loc28_52.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc28_52.2: init %empty_struct_type = struct_init () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc28_53: init %empty_struct_type = converted %.loc28_52.1, %.loc28_52.2 [concrete = constants.%empty_struct] +// CHECK:STDOUT: return %.loc28_53 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc17: type = type_literal [concrete = ] +// CHECK:STDOUT: %.loc39: type = type_literal [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Int(constants.%T, constants.%N) { -// CHECK:STDOUT: %T.patt.loc12_14.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc12_14.1 => constants.%T +// CHECK:STDOUT: %T.patt.loc28_14.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc28_14.1 => constants.%T // CHECK:STDOUT: %pattern_type => constants.%pattern_type.51d -// CHECK:STDOUT: %N.patt.loc12_31.2 => constants.%N.patt -// CHECK:STDOUT: %N.loc12_31.1 => constants.%N +// CHECK:STDOUT: %N.patt.loc28_31.2 => constants.%N.patt +// CHECK:STDOUT: %N.loc28_31.1 => constants.%N // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_prelude_as_class.carbon @@ -820,8 +881,8 @@ let n: type = i32; // CHECK:STDOUT: .n = %n // CHECK:STDOUT: } // CHECK:STDOUT: %Core.decl: type = class_decl @Core [concrete = constants.%Core] {} {} -// CHECK:STDOUT: %.loc12: type = type_literal type [concrete = type] -// CHECK:STDOUT: %n: type = wrapper_binding n, @__global_init.%.loc12 [concrete = ] +// CHECK:STDOUT: %.loc24: type = type_literal type [concrete = type] +// CHECK:STDOUT: %n: type = wrapper_binding n, @__global_init.%.loc24 [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %n.patt: %pattern_type.9a5 = value_binding_pattern n [concrete = constants.%n.patt] // CHECK:STDOUT: } @@ -829,24 +890,24 @@ let n: type = i32; // CHECK:STDOUT: // CHECK:STDOUT: class @Core { // CHECK:STDOUT: %Core.Int.decl: %Core.Int.type = fn_decl @Core.Int [concrete = constants.%Core.Int] { -// CHECK:STDOUT: %T.patt.loc7_11.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc7_11.2 (constants.%T.patt)] -// CHECK:STDOUT: %_.patt.loc7_28.1: @Core.Int.%pattern_type (%pattern_type.51d) = symbolic_binding_pattern _, 1 [symbolic = %_.patt.loc7_28.2 (constants.%_.patt)] +// CHECK:STDOUT: %T.patt.loc13_11.1: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc13_11.2 (constants.%T.patt)] +// CHECK:STDOUT: %_.patt.loc13_28.1: @Core.Int.%pattern_type (%pattern_type.51d) = symbolic_binding_pattern _, 1 [symbolic = %_.patt.loc13_28.2 (constants.%_.patt)] // CHECK:STDOUT: %return.param_patt: %pattern_type.a96 = out_param_pattern [concrete = constants.%return.param_patt] -// CHECK:STDOUT: %return.patt: %pattern_type.a96 = return_slot_pattern %return.param_patt, %.loc7_37.2 [concrete = constants.%return.patt] +// CHECK:STDOUT: %return.patt: %pattern_type.a96 = return_slot_pattern %return.param_patt, %.loc13_37.2 [concrete = constants.%return.patt] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc7_37.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc7_37.2: type = converted %.loc7_37.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] -// CHECK:STDOUT: %.loc7_37.3: Core.Form = init_form %.loc7_37.2 [concrete = constants.%.469] -// CHECK:STDOUT: %.loc7_13.1: type = splice_block %.loc7_13.2 [concrete = type] { -// CHECK:STDOUT: %.Self.frozen.loc7_11: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc7_13.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc13_37.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc13_37.2: type = converted %.loc13_37.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc13_37.3: Core.Form = init_form %.loc13_37.2 [concrete = constants.%.469] +// CHECK:STDOUT: %.loc13_13.1: type = splice_block %.loc13_13.2 [concrete = type] { +// CHECK:STDOUT: %.Self.frozen.loc13_11: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc13_13.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc7_11.2: type = symbolic_binding T, 0 [symbolic = %T.loc7_11.1 (constants.%T)] -// CHECK:STDOUT: %.loc7_30: type = splice_block %T.ref [symbolic = %T.loc7_11.1 (constants.%T)] { -// CHECK:STDOUT: %.Self.frozen.loc7_28: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc7_11.2 [symbolic = %T.loc7_11.1 (constants.%T)] +// CHECK:STDOUT: %T.loc13_11.2: type = symbolic_binding T, 0 [symbolic = %T.loc13_11.1 (constants.%T)] +// CHECK:STDOUT: %.loc13_30: type = splice_block %T.ref [symbolic = %T.loc13_11.1 (constants.%T)] { +// CHECK:STDOUT: %.Self.frozen.loc13_28: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc13_11.2 [symbolic = %T.loc13_11.1 (constants.%T)] // CHECK:STDOUT: } -// CHECK:STDOUT: %_.loc7_28.2: @Core.Int.%T.loc7_11.1 (%T) = symbolic_binding _, 1 [symbolic = %_.loc7_28.1 (constants.%_)] +// CHECK:STDOUT: %_.loc13_28.2: @Core.Int.%T.loc13_11.1 (%T) = symbolic_binding _, 1 [symbolic = %_.loc13_28.1 (constants.%_)] // CHECK:STDOUT: %return.param: ref %empty_struct_type = out_param call_param0 // CHECK:STDOUT: %return: ref %empty_struct_type = return_slot %return.param // CHECK:STDOUT: } @@ -858,35 +919,35 @@ let n: type = i32; // CHECK:STDOUT: .Int = %Core.Int.decl // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Core.Int(%T.loc7_11.2: type, %_.loc7_28.2: @Core.Int.%T.loc7_11.1 (%T)) { -// CHECK:STDOUT: %T.patt.loc7_11.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc7_11.2 (constants.%T.patt)] -// CHECK:STDOUT: %T.loc7_11.1: type = symbolic_binding T, 0 [symbolic = %T.loc7_11.1 (constants.%T)] -// CHECK:STDOUT: %pattern_type: type = pattern_type %T.loc7_11.1 [symbolic = %pattern_type (constants.%pattern_type.51d)] -// CHECK:STDOUT: %_.patt.loc7_28.2: @Core.Int.%pattern_type (%pattern_type.51d) = symbolic_binding_pattern _, 1 [symbolic = %_.patt.loc7_28.2 (constants.%_.patt)] -// CHECK:STDOUT: %_.loc7_28.1: @Core.Int.%T.loc7_11.1 (%T) = symbolic_binding _, 1 [symbolic = %_.loc7_28.1 (constants.%_)] +// CHECK:STDOUT: generic fn @Core.Int(%T.loc13_11.2: type, %_.loc13_28.2: @Core.Int.%T.loc13_11.1 (%T)) { +// CHECK:STDOUT: %T.patt.loc13_11.2: %pattern_type.9a5 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc13_11.2 (constants.%T.patt)] +// CHECK:STDOUT: %T.loc13_11.1: type = symbolic_binding T, 0 [symbolic = %T.loc13_11.1 (constants.%T)] +// CHECK:STDOUT: %pattern_type: type = pattern_type %T.loc13_11.1 [symbolic = %pattern_type (constants.%pattern_type.51d)] +// CHECK:STDOUT: %_.patt.loc13_28.2: @Core.Int.%pattern_type (%pattern_type.51d) = symbolic_binding_pattern _, 1 [symbolic = %_.patt.loc13_28.2 (constants.%_.patt)] +// CHECK:STDOUT: %_.loc13_28.1: @Core.Int.%T.loc13_11.1 (%T) = symbolic_binding _, 1 [symbolic = %_.loc13_28.1 (constants.%_)] // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: // CHECK:STDOUT: fn() -> out %return.param: %empty_struct_type { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_49.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc7_49.2: init %empty_struct_type = struct_init () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc7_50: init %empty_struct_type = converted %.loc7_49.1, %.loc7_49.2 [concrete = constants.%empty_struct] -// CHECK:STDOUT: return %.loc7_50 +// CHECK:STDOUT: %.loc13_49.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc13_49.2: init %empty_struct_type = struct_init () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc13_50: init %empty_struct_type = converted %.loc13_49.1, %.loc13_49.2 [concrete = constants.%empty_struct] +// CHECK:STDOUT: return %.loc13_50 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc12: type = type_literal [concrete = ] +// CHECK:STDOUT: %.loc24: type = type_literal [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: specific @Core.Int(constants.%T, constants.%_) { -// CHECK:STDOUT: %T.patt.loc7_11.2 => constants.%T.patt -// CHECK:STDOUT: %T.loc7_11.1 => constants.%T +// CHECK:STDOUT: %T.patt.loc13_11.2 => constants.%T.patt +// CHECK:STDOUT: %T.loc13_11.1 => constants.%T // CHECK:STDOUT: %pattern_type => constants.%pattern_type.51d -// CHECK:STDOUT: %_.patt.loc7_28.2 => constants.%_.patt -// CHECK:STDOUT: %_.loc7_28.1 => constants.%_ +// CHECK:STDOUT: %_.patt.loc13_28.2 => constants.%_.patt +// CHECK:STDOUT: %_.loc13_28.1 => constants.%_ // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/packages/raw_core.carbon b/toolchain/check/testdata/packages/raw_core.carbon index 890a6e97b8e2..2ee6d8c42d00 100644 --- a/toolchain/check/testdata/packages/raw_core.carbon +++ b/toolchain/check/testdata/packages/raw_core.carbon @@ -34,11 +34,21 @@ library "[[@TEST_NAME]]"; import r#Core; -// CHECK:STDERR: fail_raw_core_not_core.carbon:[[@LINE+2]]:10-15: error: member name `F` not found in `Core` [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╭─┤ fail_raw_core_not_core.carbon:[[@LINE+7]]:10 +// CHECK:STDERR: -> │ fn G() { Core.F(); } +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: member name `F` not found in `Core` +// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn G() { Core.F(); } -// CHECK:STDERR: fail_raw_core_not_core.carbon:[[@LINE+2]]:10-19: error: member name `Int` not found in `r#Core` [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╭─┤ fail_raw_core_not_core.carbon:[[@LINE+7]]:10 +// CHECK:STDERR: -> │ fn H() { r#Core.Int(32); } +// CHECK:STDERR: · ━━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: member name `Int` not found in `r#Core` +// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn H() { r#Core.Int(32); } diff --git a/toolchain/check/testdata/packages/restricted_package_names.carbon b/toolchain/check/testdata/packages/restricted_package_names.carbon index b1d1015b2d0f..0b913eab09c5 100644 --- a/toolchain/check/testdata/packages/restricted_package_names.carbon +++ b/toolchain/check/testdata/packages/restricted_package_names.carbon @@ -19,26 +19,46 @@ package main; // --- fail_main.carbon -// CHECK:STDERR: fail_main.carbon:[[@LINE+2]]:1-13: error: `Main//default` must omit `package` declaration [ExplicitMainPackage] +// CHECK:STDERR: ╭─┤ fail_main.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ package Main; +// CHECK:STDERR: · ━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `Main//default` must omit `package` declaration +// CHECK:STDERR: · ┃ [ExplicitMainPackage] +// CHECK:STDERR: ╰──── // CHECK:STDERR: package Main; // --- fail_main_impl.carbon -// CHECK:STDERR: fail_main_impl.carbon:[[@LINE+2]]:1-18: error: `Main//default` must omit `package` declaration [ExplicitMainPackage] +// CHECK:STDERR: ╭─┤ fail_main_impl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ impl package Main; +// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `Main//default` must omit `package` declaration +// CHECK:STDERR: · ┃ [ExplicitMainPackage] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl package Main; // --- fail_raw_main.carbon // `Main` isn't a keyword, so this fails the same way. -// CHECK:STDERR: fail_raw_main.carbon:[[@LINE+2]]:1-15: error: `Main//default` must omit `package` declaration [ExplicitMainPackage] +// CHECK:STDERR: ╭─┤ fail_raw_main.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ package r#Main; +// CHECK:STDERR: · ━━━━━━━┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `Main//default` must omit `package` declaration +// CHECK:STDERR: · ┃ [ExplicitMainPackage] +// CHECK:STDERR: ╰──── // CHECK:STDERR: package r#Main; // --- fail_main_lib.carbon -// CHECK:STDERR: fail_main_lib.carbon:[[@LINE+2]]:1-32: error: use `library` declaration in `Main` package libraries [ExplicitMainLibrary] +// CHECK:STDERR: ╭─┤ fail_main_lib.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ package Main library "main_lib"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: use `library` declaration in `Main` package libraries +// CHECK:STDERR: · ┃ [ExplicitMainLibrary] +// CHECK:STDERR: ╰──── // CHECK:STDERR: package Main library "[[@TEST_NAME]]"; @@ -49,13 +69,23 @@ package cpp; // --- fail_cpp.carbon -// CHECK:STDERR: fail_cpp.carbon:[[@LINE+2]]:1-12: error: `Cpp` cannot be used by a `package` declaration [CppPackageDeclaration] +// CHECK:STDERR: ╭─┤ fail_cpp.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ package Cpp; +// CHECK:STDERR: · ━━━━━━┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `Cpp` cannot be used by a `package` declaration +// CHECK:STDERR: · ┃ [CppPackageDeclaration] +// CHECK:STDERR: ╰──── // CHECK:STDERR: package Cpp; // --- fail_cpp.impl.carbon -// CHECK:STDERR: fail_cpp.impl.carbon:[[@LINE+2]]:1-17: error: `Cpp` cannot be used by a `package` declaration [CppPackageDeclaration] +// CHECK:STDERR: ╭─┤ fail_cpp.impl.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ impl package Cpp; +// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `Cpp` cannot be used by a `package` declaration +// CHECK:STDERR: · ┃ [CppPackageDeclaration] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl package Cpp; @@ -65,7 +95,12 @@ package r#Cpp; // --- fail_cpp_lib.carbon -// CHECK:STDERR: fail_cpp_lib.carbon:[[@LINE+2]]:1-30: error: `Cpp` cannot be used by a `package` declaration [CppPackageDeclaration] +// CHECK:STDERR: ╭─┤ fail_cpp_lib.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ package Cpp library "cpp_lib"; +// CHECK:STDERR: · ━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `Cpp` cannot be used by a `package` declaration +// CHECK:STDERR: · ┃ [CppPackageDeclaration] +// CHECK:STDERR: ╰──── // CHECK:STDERR: package Cpp library "[[@TEST_NAME]]"; diff --git a/toolchain/check/testdata/patterns/expression.carbon b/toolchain/check/testdata/patterns/expression.carbon index fbd624976309..2be74cfe4b8b 100644 --- a/toolchain/check/testdata/patterns/expression.carbon +++ b/toolchain/check/testdata/patterns/expression.carbon @@ -16,7 +16,11 @@ library "[[@TEST_NAME]]"; // TODO: We should reject this for using a refutable pattern in an irrefutable pattern context. let a: () = (); -// CHECK:STDERR: fail_todo_let.carbon:[[@LINE+2]]:5: error: semantics TODO: `expression pattern` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_todo_let.carbon:[[@LINE+6]]:5 +// CHECK:STDERR: -> │ let a = (); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `expression pattern` [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let a = (); @@ -26,7 +30,11 @@ library "[[@TEST_NAME]]"; // TODO: We should reject this for using a refutable pattern in an irrefutable pattern context. let a: () = (); -// CHECK:STDERR: fail_todo_in_tuple.carbon:[[@LINE+2]]:13: error: semantics TODO: `expression pattern` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_todo_in_tuple.carbon:[[@LINE+6]]:13 +// CHECK:STDERR: -> │ let (b: (), a, c: ()) = ((), (), ()); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `expression pattern` [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let (b: (), a, c: ()) = ((), (), ()); @@ -36,7 +44,11 @@ library "[[@TEST_NAME]]"; // TODO: We should reject this for using a refutable pattern in an irrefutable pattern context. let a: () = (); -// CHECK:STDERR: fail_todo_in_function_param.carbon:[[@LINE+2]]:6: error: semantics TODO: `expression pattern` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_todo_in_function_param.carbon:[[@LINE+6]]:6 +// CHECK:STDERR: -> │ fn F(a) {} +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `expression pattern` [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(a) {} @@ -49,7 +61,11 @@ let a: () = (); // pattern contexts. // Note that this is a parenthesized zero-tuple expression pattern, not a // one-tuple pattern containing a zero-tuple. -// CHECK:STDERR: fail_todo_parens.carbon:[[@LINE+2]]:6: error: semantics TODO: `expression pattern` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_todo_parens.carbon:[[@LINE+6]]:6 +// CHECK:STDERR: -> │ let (a) = (); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `expression pattern` [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let (a) = (); @@ -61,9 +77,20 @@ fn F() { // TODO: Replace this with a valid expression pattern once we support refutable // pattern contexts. //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_control_flow.carbon:[[@LINE+4]]:8-35: error: semantics TODO: `expression pattern` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_control_flow.carbon:[[@LINE+15]]:8 + // CHECK:STDERR: -> │ let (if true then true else false, true and true) = (true, true); + // CHECK:STDERR: · ━━━━━━━━━━━━━━┳━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `expression pattern` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_todo_control_flow.carbon:[[@LINE+2]]:38-50: error: semantics TODO: `expression pattern` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_control_flow.carbon:[[@LINE+8]]:38 + // CHECK:STDERR: -> │ let (if true then true else false, true and true) = (true, true); + // CHECK:STDERR: · ┳━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: + // CHECK:STDERR: · ┃ `expression pattern` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let (if true then true else false, true and true) = (true, true); //@dump-sem-ir-end @@ -78,46 +105,46 @@ fn F() { // CHECK:STDOUT: %pattern_type.831: type = pattern_type bool [concrete] // CHECK:STDOUT: %tuple.type: type = tuple_type (bool, bool) [concrete] // CHECK:STDOUT: %pattern_type.860: type = pattern_type %tuple.type [concrete] -// CHECK:STDOUT: %.108: %pattern_type.860 = tuple_pattern (@F.%expr_patt.loc12_26, @F.%expr_patt.loc12_43) [concrete] +// CHECK:STDOUT: %.108: %pattern_type.860 = tuple_pattern (@F.%expr_patt.loc23_26, @F.%expr_patt.loc23_43) [concrete] // CHECK:STDOUT: %tuple: %tuple.type = tuple_value (%true, %true) [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %true.loc12_56: bool = bool_literal true [concrete = constants.%true] -// CHECK:STDOUT: %true.loc12_62: bool = bool_literal true [concrete = constants.%true] -// CHECK:STDOUT: %.loc12_66: %tuple.type = tuple_literal (%true.loc12_56, %true.loc12_62) [concrete = constants.%tuple] +// CHECK:STDOUT: %true.loc23_56: bool = bool_literal true [concrete = constants.%true] +// CHECK:STDOUT: %true.loc23_62: bool = bool_literal true [concrete = constants.%true] +// CHECK:STDOUT: %.loc23_66: %tuple.type = tuple_literal (%true.loc23_56, %true.loc23_62) [concrete = constants.%tuple] // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %expr_patt.loc12_26: %pattern_type.831 = expr_pattern %.loc12_8 in [concrete] { -// CHECK:STDOUT: %true.loc12_11: bool = bool_literal true [concrete = constants.%true] -// CHECK:STDOUT: if %true.loc12_11 br !if.expr.then else br !if.expr.else +// CHECK:STDOUT: %expr_patt.loc23_26: %pattern_type.831 = expr_pattern %.loc23_8 in [concrete] { +// CHECK:STDOUT: %true.loc23_11: bool = bool_literal true [concrete = constants.%true] +// CHECK:STDOUT: if %true.loc23_11 br !if.expr.then else br !if.expr.else // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then: -// CHECK:STDOUT: %true.loc12_21: bool = bool_literal true [concrete = constants.%true] -// CHECK:STDOUT: br !if.expr.result(%true.loc12_21) +// CHECK:STDOUT: %true.loc23_21: bool = bool_literal true [concrete = constants.%true] +// CHECK:STDOUT: br !if.expr.result(%true.loc23_21) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else: -// CHECK:STDOUT: %false.loc12_31: bool = bool_literal false [concrete = constants.%false] -// CHECK:STDOUT: br !if.expr.result(%false.loc12_31) +// CHECK:STDOUT: %false.loc23_31: bool = bool_literal false [concrete = constants.%false] +// CHECK:STDOUT: br !if.expr.result(%false.loc23_31) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result: -// CHECK:STDOUT: %.loc12_8: bool = block_arg !if.expr.result [concrete = constants.%true] +// CHECK:STDOUT: %.loc23_8: bool = block_arg !if.expr.result [concrete = constants.%true] // CHECK:STDOUT: // CHECK:STDOUT: } -// CHECK:STDOUT: %expr_patt.loc12_43: %pattern_type.831 = expr_pattern %.loc12_43 in [concrete] { -// CHECK:STDOUT: %true.loc12_38: bool = bool_literal true [concrete = constants.%true] -// CHECK:STDOUT: %false.loc12_43: bool = bool_literal false [concrete = constants.%false] -// CHECK:STDOUT: if %true.loc12_38 br !and.rhs else br !.loc12(%false.loc12_43) +// CHECK:STDOUT: %expr_patt.loc23_43: %pattern_type.831 = expr_pattern %.loc23_43 in [concrete] { +// CHECK:STDOUT: %true.loc23_38: bool = bool_literal true [concrete = constants.%true] +// CHECK:STDOUT: %false.loc23_43: bool = bool_literal false [concrete = constants.%false] +// CHECK:STDOUT: if %true.loc23_38 br !and.rhs else br !.loc23(%false.loc23_43) // CHECK:STDOUT: // CHECK:STDOUT: !and.rhs: -// CHECK:STDOUT: %true.loc12_47: bool = bool_literal true [concrete = constants.%true] -// CHECK:STDOUT: br !.loc12(%true.loc12_47) +// CHECK:STDOUT: %true.loc23_47: bool = bool_literal true [concrete = constants.%true] +// CHECK:STDOUT: br !.loc23(%true.loc23_47) // CHECK:STDOUT: -// CHECK:STDOUT: !.loc12: -// CHECK:STDOUT: %.loc12_43: bool = block_arg !.loc12 [concrete = constants.%true] +// CHECK:STDOUT: !.loc23: +// CHECK:STDOUT: %.loc23_43: bool = block_arg !.loc23 [concrete = constants.%true] // CHECK:STDOUT: // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc12_51: %pattern_type.860 = tuple_pattern (%expr_patt.loc12_26, %expr_patt.loc12_43) [concrete = constants.%.108] +// CHECK:STDOUT: %.loc23_51: %pattern_type.860 = tuple_pattern (%expr_patt.loc23_26, %expr_patt.loc23_43) [concrete = constants.%.108] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/patterns/struct.carbon b/toolchain/check/testdata/patterns/struct.carbon index 6c7dfe4e287d..3f5da40ad57e 100644 --- a/toolchain/check/testdata/patterns/struct.carbon +++ b/toolchain/check/testdata/patterns/struct.carbon @@ -135,7 +135,12 @@ let {a: i32, .b = c: bool} = {.b = true, .a = 1}; library "[[@TEST_NAME]]"; //@dump-sem-ir-begin -// CHECK:STDERR: fail_todo_underscore.carbon:[[@LINE+2]]:19: error: semantics TODO: `Struct pattern underscore field` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_todo_underscore.carbon:[[@LINE+7]]:19 +// CHECK:STDERR: -> │ let {.a = x: i32, _} = {.a = 1, .b = ()}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `Struct pattern underscore field` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let {.a = x: i32, _} = {.a = 1, .b = ()}; let {.a = y: i32, _,} = {.a = 1, .b = ()}; @@ -146,7 +151,12 @@ let {.a = y: i32, _,} = {.a = 1, .b = ()}; library "[[@TEST_NAME]]"; //@dump-sem-ir-begin -// CHECK:STDERR: fail_no_matching_field.carbon:[[@LINE+2]]:20-28: error: struct `{.a: ()}` has no field named `b` [StructInitUnexpectedFieldInLiteral] +// CHECK:STDERR: ╭─┤ fail_no_matching_field.carbon:[[@LINE+7]]:20 +// CHECK:STDERR: -> │ let {.a = x: ()} = {.b = ()}; +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: struct `{.a: ()}` has no field named `b` +// CHECK:STDERR: · ┃ [StructInitUnexpectedFieldInLiteral] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let {.a = x: ()} = {.b = ()}; //@dump-sem-ir-end @@ -156,7 +166,14 @@ let {.a = x: ()} = {.b = ()}; library "[[@TEST_NAME]]"; var s: {.a: (), .b: ()} = {.a = (), .b = ()}; //@dump-sem-ir-begin -// CHECK:STDERR: fail_no_matching_field_ref.carbon:[[@LINE+2]]:20: error: cannot convert from struct type `{.a: (), .b: ()}` to `{.c: ()}`: unexpected field `a` in source type [StructInitUnexpectedFieldInConversion] +// CHECK:STDERR: ╭─┤ fail_no_matching_field_ref.carbon:[[@LINE+9]]:20 +// CHECK:STDERR: -> │ let {.c = x: ()} = s; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: cannot convert from struct type +// CHECK:STDERR: · ┃ `{.a: (), .b: ()}` to `{.c: ()}`: unexpected +// CHECK:STDERR: · ┃ field `a` in source type +// CHECK:STDERR: · ┃ [StructInitUnexpectedFieldInConversion] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let {.c = x: ()} = s; //@dump-sem-ir-end @@ -167,7 +184,12 @@ let {.c = x: ()} = s; library "[[@TEST_NAME]]"; //@dump-sem-ir-begin -// CHECK:STDERR: fail_unhandled_field.carbon:[[@LINE+2]]:20-39: error: struct `{.a: ()}` has no field named `b` [StructInitUnexpectedFieldInLiteral] +// CHECK:STDERR: ╭─┤ fail_unhandled_field.carbon:[[@LINE+7]]:20 +// CHECK:STDERR: -> │ let {.a = x: ()} = {.a = (), .b = true}; +// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: struct `{.a: ()}` has no field named `b` +// CHECK:STDERR: · ┃ [StructInitUnexpectedFieldInLiteral] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let {.a = x: ()} = {.a = (), .b = true}; //@dump-sem-ir-end @@ -177,8 +199,13 @@ let {.a = x: ()} = {.a = (), .b = true}; library "[[@TEST_NAME]]"; //@dump-sem-ir-begin -// CHECK:STDERR: fail_duplicate_field_name.carbon:[[@LINE+3]]:19: error: duplicated field name `a` in struct pattern [StructNameDuplicate] -// CHECK:STDERR: fail_duplicate_field_name.carbon:[[@LINE+2]]:7: note: field with the same name here [StructNamePrevious] +// CHECK:STDERR: ╭─┤ fail_duplicate_field_name.carbon:[[@LINE+8]]:19 +// CHECK:STDERR: -> │ let {.a = b: (), .a = c: ()} = {.a = ()}; +// CHECK:STDERR: · ┬ ┳ +// CHECK:STDERR: · │ ┗━━┫ error: duplicated field name `a` in struct pattern +// CHECK:STDERR: · │ ┃ [StructNameDuplicate] +// CHECK:STDERR: · ╰────────────────┤ field with the same name here [StructNamePrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let {.a = b: (), .a = c: ()} = {.a = ()}; //@dump-sem-ir-end @@ -188,11 +215,21 @@ let {.a = b: (), .a = c: ()} = {.a = ()}; library "[[@TEST_NAME]]"; //@dump-sem-ir-begin -// CHECK:STDERR: fail_duplicate_field_name_shorthand.carbon:[[@LINE+6]]:13: error: duplicate name `a` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: fail_duplicate_field_name_shorthand.carbon:[[@LINE+5]]:6-10: note: name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╭─┤ fail_duplicate_field_name_shorthand.carbon:[[@LINE+16]]:13 +// CHECK:STDERR: -> │ let {a: (), a: ()} = {.a = ()}; +// CHECK:STDERR: · ──┬── ┳ +// CHECK:STDERR: · │ ┗━━┫ error: duplicate name `a` being declared in the same scope +// CHECK:STDERR: · │ ┃ [NameDeclDuplicate] +// CHECK:STDERR: · ╰─────────┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_duplicate_field_name_shorthand.carbon:[[@LINE+3]]:13: error: duplicated field name `a` in struct pattern [StructNameDuplicate] -// CHECK:STDERR: fail_duplicate_field_name_shorthand.carbon:[[@LINE+2]]:6: note: field with the same name here [StructNamePrevious] +// CHECK:STDERR: ╭─┤ fail_duplicate_field_name_shorthand.carbon:[[@LINE+8]]:13 +// CHECK:STDERR: -> │ let {a: (), a: ()} = {.a = ()}; +// CHECK:STDERR: · ┬ ┳ +// CHECK:STDERR: · │ ┗━━┫ error: duplicated field name `a` in struct pattern +// CHECK:STDERR: · │ ┃ [StructNameDuplicate] +// CHECK:STDERR: · ╰───────────┤ field with the same name here [StructNamePrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let {a: (), a: ()} = {.a = ()}; //@dump-sem-ir-end @@ -202,8 +239,13 @@ let {a: (), a: ()} = {.a = ()}; library "[[@TEST_NAME]]"; //@dump-sem-ir-begin -// CHECK:STDERR: fail_duplicate_field_name_mixed_syntax.carbon:[[@LINE+3]]:18: error: duplicated field name `a` in struct pattern [StructNameDuplicate] -// CHECK:STDERR: fail_duplicate_field_name_mixed_syntax.carbon:[[@LINE+2]]:7: note: field with the same name here [StructNamePrevious] +// CHECK:STDERR: ╭─┤ fail_duplicate_field_name_mixed_syntax.carbon:[[@LINE+8]]:18 +// CHECK:STDERR: -> │ let {.a = b: (), a: ()} = {.a = ()}; +// CHECK:STDERR: · ┬ ┳ +// CHECK:STDERR: · │ ┗━━┫ error: duplicated field name `a` in struct pattern +// CHECK:STDERR: · │ ┃ [StructNameDuplicate] +// CHECK:STDERR: · ╰───────────────┤ field with the same name here [StructNamePrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let {.a = b: (), a: ()} = {.a = ()}; //@dump-sem-ir-end @@ -214,7 +256,12 @@ library "[[@TEST_NAME]]"; //@dump-sem-ir-begin class C{ - // CHECK:STDERR: fail_in_class_var.carbon:[[@LINE+2]]:9-20: error: found struct pattern in class member var declaration [FieldWithStructPattern] + // CHECK:STDERR: ╭─┤ fail_in_class_var.carbon:[[@LINE+7]]:9 + // CHECK:STDERR: -> │ var {.a = x: ()}; + // CHECK:STDERR: · ━━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: found struct pattern in class member var declaration + // CHECK:STDERR: · ┃ [FieldWithStructPattern] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var {.a = x: ()}; } @@ -225,7 +272,12 @@ class C{ library "[[@TEST_NAME]]"; //@dump-sem-ir-begin class C{ - // CHECK:STDERR: fail_in_class_let.carbon:[[@LINE+2]]:9-20: error: found struct pattern in class member let declaration [FieldWithStructPattern] + // CHECK:STDERR: ╭─┤ fail_in_class_let.carbon:[[@LINE+7]]:9 + // CHECK:STDERR: -> │ let {.a = x: ()} = {.a = ()}; + // CHECK:STDERR: · ━━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: found struct pattern in class member let declaration + // CHECK:STDERR: · ┃ [FieldWithStructPattern] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let {.a = x: ()} = {.a = ()}; } @@ -235,8 +287,16 @@ class C{ library "[[@TEST_NAME]]"; //@dump-sem-ir-begin -// CHECK:STDERR: fail_incorrect_field_type.carbon:[[@LINE+3]]:20-28: error: cannot implicitly convert expression of type `{}` to `()` [ConversionFailure] -// CHECK:STDERR: fail_incorrect_field_type.carbon:[[@LINE+2]]:20-28: note: type `{}` does not implement interface `Core.ImplicitAs(())` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_incorrect_field_type.carbon:[[@LINE+11]]:20 +// CHECK:STDERR: -> │ let {.a = x: ()} = {.a = {}}; +// CHECK:STDERR: · ┳━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `{}` +// CHECK:STDERR: · │ ┃ to `()` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╰────┤ type `{}` does not implement interface +// CHECK:STDERR: · │ `Core.ImplicitAs(())` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let {.a = x: ()} = {.a = {}}; //@dump-sem-ir-end @@ -245,8 +305,16 @@ let {.a = x: ()} = {.a = {}}; library "[[@TEST_NAME]]"; //@dump-sem-ir-begin -// CHECK:STDERR: fail_incorrect_scrutinee_type.carbon:[[@LINE+3]]:5-16: error: cannot implicitly convert expression of type `((), ())` to `{.a: ()}` [ConversionFailure] -// CHECK:STDERR: fail_incorrect_scrutinee_type.carbon:[[@LINE+2]]:5-16: note: type `((), ())` does not implement interface `Core.ImplicitAs({.a: ()})` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_incorrect_scrutinee_type.carbon:[[@LINE+11]]:5 +// CHECK:STDERR: -> │ let {.a = x: ()} = ((), ()); +// CHECK:STDERR: · ┳━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `((), ())` to +// CHECK:STDERR: · │ ┃ `{.a: ()}` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╰────┤ type `((), ())` does not implement interface +// CHECK:STDERR: · │ `Core.ImplicitAs({.a: ()})` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let {.a = x: ()} = ((), ()); //@dump-sem-ir-end @@ -1046,14 +1114,14 @@ let {.a = x: ()} = ((), ()); // CHECK:STDOUT: file { // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %x.patt: %pattern_type.cb1 = value_binding_pattern x [concrete = constants.%x.patt] -// CHECK:STDOUT: %.loc7: %pattern_type.e85 = struct_pattern (%x.patt) [concrete = constants.%.298] +// CHECK:STDOUT: %.loc12: %pattern_type.e85 = struct_pattern (%x.patt) [concrete = constants.%.298] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_27: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc7_28: %struct_type.b = struct_literal (%.loc7_27) [concrete = constants.%struct] +// CHECK:STDOUT: %.loc12_27: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc12_28: %struct_type.b = struct_literal (%.loc12_27) [concrete = constants.%struct] // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1073,7 +1141,7 @@ let {.a = x: ()} = ((), ()); // CHECK:STDOUT: file { // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %x.patt: %pattern_type.cb1 = value_binding_pattern x [concrete = constants.%x.patt] -// CHECK:STDOUT: %.loc7: %pattern_type.810 = struct_pattern (%x.patt) [concrete = constants.%.9cb] +// CHECK:STDOUT: %.loc14: %pattern_type.810 = struct_pattern (%x.patt) [concrete = constants.%.9cb] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1103,15 +1171,15 @@ let {.a = x: ()} = ((), ()); // CHECK:STDOUT: file { // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %x.patt: %pattern_type.cb1 = value_binding_pattern x [concrete = constants.%x.patt] -// CHECK:STDOUT: %.loc7: %pattern_type.e85 = struct_pattern (%x.patt) [concrete = constants.%.298] +// CHECK:STDOUT: %.loc12: %pattern_type.e85 = struct_pattern (%x.patt) [concrete = constants.%.298] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_27: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc12_27: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] // CHECK:STDOUT: %true: bool = bool_literal true [concrete = constants.%true] -// CHECK:STDOUT: %.loc7_39: %struct_type.a.b = struct_literal (%.loc7_27, %true) [concrete = constants.%struct] +// CHECK:STDOUT: %.loc12_39: %struct_type.a.b = struct_literal (%.loc12_27, %true) [concrete = constants.%struct] // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1137,8 +1205,8 @@ let {.a = x: ()} = ((), ()); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8_39: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_40: %struct_type.a = struct_literal (%.loc8_39) [concrete = constants.%struct] +// CHECK:STDOUT: %.loc13_39: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc13_40: %struct_type.a = struct_literal (%.loc13_39) [concrete = constants.%struct] // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1156,15 +1224,15 @@ let {.a = x: ()} = ((), ()); // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %a.patt.loc11_7: %pattern_type = value_binding_pattern a [concrete = constants.%a.patt] -// CHECK:STDOUT: %a.patt.loc11_14: %pattern_type = value_binding_pattern a [concrete = constants.%a.patt] +// CHECK:STDOUT: %a.patt.loc21_7: %pattern_type = value_binding_pattern a [concrete = constants.%a.patt] +// CHECK:STDOUT: %a.patt.loc21_14: %pattern_type = value_binding_pattern a [concrete = constants.%a.patt] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_29: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc11_30: %struct_type.a = struct_literal (%.loc11_29) [concrete = constants.%struct] +// CHECK:STDOUT: %.loc21_29: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc21_30: %struct_type.a = struct_literal (%.loc21_29) [concrete = constants.%struct] // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1190,8 +1258,8 @@ let {.a = x: ()} = ((), ()); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8_34: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_35: %struct_type.a = struct_literal (%.loc8_34) [concrete = constants.%struct] +// CHECK:STDOUT: %.loc13_34: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc13_35: %struct_type.a = struct_literal (%.loc13_34) [concrete = constants.%struct] // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1207,7 +1275,7 @@ let {.a = x: ()} = ((), ()); // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C -// CHECK:STDOUT: .x = .inst{{[0-9A-F]+}}.loc8_16 +// CHECK:STDOUT: .x = .inst{{[0-9A-F]+}}.loc13_16 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_in_class_let.carbon @@ -1222,7 +1290,7 @@ let {.a = x: ()} = ((), ()); // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C -// CHECK:STDOUT: .x = .inst{{[0-9A-F]+}}.loc7_16 +// CHECK:STDOUT: .x = .inst{{[0-9A-F]+}}.loc12_16 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_incorrect_field_type.carbon @@ -1242,17 +1310,17 @@ let {.a = x: ()} = ((), ()); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { -// CHECK:STDOUT: %.loc7_28: %empty_tuple.type = converted @__global_init.%.loc7_27, [concrete = ] +// CHECK:STDOUT: %.loc15_28: %empty_tuple.type = converted @__global_init.%.loc15_27, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %x.patt: %pattern_type.cb1 = value_binding_pattern x [concrete = constants.%x.patt] -// CHECK:STDOUT: %.loc7_16: %pattern_type.e85 = struct_pattern (%x.patt) [concrete = constants.%.298] +// CHECK:STDOUT: %.loc15_16: %pattern_type.e85 = struct_pattern (%x.patt) [concrete = constants.%.298] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_27: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc7_28: %struct_type.a.225 = struct_literal (%.loc7_27) [concrete = constants.%struct] +// CHECK:STDOUT: %.loc15_27: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc15_28: %struct_type.a.225 = struct_literal (%.loc15_27) [concrete = constants.%struct] // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1272,18 +1340,18 @@ let {.a = x: ()} = ((), ()); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { -// CHECK:STDOUT: %.loc7_16.1: %struct_type.a = converted @__global_init.%.loc7_27, [concrete = ] +// CHECK:STDOUT: %.loc15_16.1: %struct_type.a = converted @__global_init.%.loc15_27, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %x.patt: %pattern_type.cb1 = value_binding_pattern x [concrete = constants.%x.patt] -// CHECK:STDOUT: %.loc7_16.2: %pattern_type.e85 = struct_pattern (%x.patt) [concrete = constants.%.298] +// CHECK:STDOUT: %.loc15_16.2: %pattern_type.e85 = struct_pattern (%x.patt) [concrete = constants.%.298] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_22: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc7_26: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc7_27: %tuple.type = tuple_literal (%.loc7_22, %.loc7_26) [concrete = constants.%tuple] +// CHECK:STDOUT: %.loc15_22: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc15_26: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc15_27: %tuple.type = tuple_literal (%.loc15_22, %.loc15_26) [concrete = constants.%tuple] // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/patterns/underscore.carbon b/toolchain/check/testdata/patterns/underscore.carbon index 00c6ef4555e3..23651c56b7b9 100644 --- a/toolchain/check/testdata/patterns/underscore.carbon +++ b/toolchain/check/testdata/patterns/underscore.carbon @@ -56,8 +56,17 @@ library "[[@TEST_NAME]]"; fn F(generic _: type); fn G() { - // CHECK:STDERR: fail_function_generic_undefined.carbon:[[@LINE+3]]:3: error: use of undefined generic function [MissingGenericFunctionDefinition] - // CHECK:STDERR: fail_function_generic_undefined.carbon:[[@LINE-4]]:1-22: note: generic function declared here [MissingGenericFunctionDefinitionHere] + // CHECK:STDERR: ╭─┤ fail_function_generic_undefined.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn F(generic _: type); + // CHECK:STDERR: · ───────────┬────────── + // CHECK:STDERR: · ╰──┤ generic function declared here + // CHECK:STDERR: · │ [MissingGenericFunctionDefinitionHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ F({}); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: use of undefined generic function + // CHECK:STDERR: · ┃ [MissingGenericFunctionDefinition] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F({}); } @@ -75,7 +84,12 @@ fn G[_: type]() {} library "[[@TEST_NAME]]"; class C { - // CHECK:STDERR: fail_class.carbon:[[@LINE+2]]:7-11: error: expected identifier in field declaration [FieldNamedUnderscore] + // CHECK:STDERR: ╭─┤ fail_class.carbon:[[@LINE+7]]:7 + // CHECK:STDERR: -> │ var _: (); + // CHECK:STDERR: · ━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: expected identifier in field declaration + // CHECK:STDERR: · ┃ [FieldNamedUnderscore] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var _: (); } @@ -84,11 +98,25 @@ class C { fn F() -> {} { let _: {} = {}; - // CHECK:STDERR: fail_use.carbon:[[@LINE+6]]:9: error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╭─┤ fail_use.carbon:[[@LINE+20]]:9 + // CHECK:STDERR: -> │ return _; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_use.carbon:[[@LINE+4]]:9: error: `return` statements must end with a `;` [ExpectedStatementSemi] + // CHECK:STDERR: ╭─┤ fail_use.carbon:[[@LINE+14]]:9 + // CHECK:STDERR: -> │ return _; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: `return` statements must end with a `;` + // CHECK:STDERR: · ┃ [ExpectedStatementSemi] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_use.carbon:[[@LINE+2]]:10: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_use.carbon:[[@LINE+7]]:10 + // CHECK:STDERR: -> │ return _; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `handle invalid parse trees in `check`` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return _; } @@ -420,8 +448,8 @@ fn F() -> {} { // CHECK:STDOUT: fn @G() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] -// CHECK:STDOUT: %.loc10_6: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc10_7: type = converted %.loc10_6, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc19_6: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc19_7: type = converted %.loc19_6, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: %F.specific_fn: = specific_function %F.ref, @F(constants.%empty_struct_type) [concrete = constants.%F.specific_fn] // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.specific_fn() // CHECK:STDOUT: return @@ -543,9 +571,9 @@ fn F() -> {} { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %field_decl: %C.elem = field_decl _, element0, %.loc7_11.2 in [concrete] { -// CHECK:STDOUT: %.loc7_11.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc7_11.2: type = converted %.loc7_11.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %field_decl: %C.elem = field_decl _, element0, %.loc12_11.2 in [concrete] { +// CHECK:STDOUT: %.loc12_11.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc12_11.2: type = converted %.loc12_11.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %complete_type: = complete_type_witness constants.%struct_type._ [concrete = constants.%complete_type] // CHECK:STDOUT: complete_type_witness = %complete_type diff --git a/toolchain/check/testdata/patterns/unused.carbon b/toolchain/check/testdata/patterns/unused.carbon index d4d5ff551130..ee1094f14569 100644 --- a/toolchain/check/testdata/patterns/unused.carbon +++ b/toolchain/check/testdata/patterns/unused.carbon @@ -58,7 +58,11 @@ fn RefParamUnused(unused ref y: i32) { library "[[@TEST_NAME]]"; fn F() { - // CHECK:STDERR: local_let_named_not_used.carbon:[[@LINE+2]]:7-12: warning: binding `x` unused [UnusedBinding] + // CHECK:STDERR: ╭─┤ local_let_named_not_used.carbon:[[@LINE+6]]:7 + // CHECK:STDERR: -> │ let x: i32 = 0; + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ warning: binding `x` unused [UnusedBinding] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let x: i32 = 0; } @@ -67,7 +71,11 @@ fn F() { library "[[@TEST_NAME]]"; fn F() { - // CHECK:STDERR: local_var_named_not_used.carbon:[[@LINE+2]]:7-12: warning: binding `a` unused [UnusedBinding] + // CHECK:STDERR: ╭─┤ local_var_named_not_used.carbon:[[@LINE+6]]:7 + // CHECK:STDERR: -> │ var a: i32 = 0; + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ warning: binding `a` unused [UnusedBinding] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var a: i32 = 0; } @@ -78,7 +86,11 @@ library "[[@TEST_NAME]]"; fn F() { var x: i32 = 0; if (true) { - // CHECK:STDERR: local_var_shadowed_not_used.carbon:[[@LINE+2]]:9-14: warning: binding `x` unused [UnusedBinding] + // CHECK:STDERR: ╭─┤ local_var_shadowed_not_used.carbon:[[@LINE+6]]:9 + // CHECK:STDERR: -> │ var x: i32 = 1; + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ warning: binding `x` unused [UnusedBinding] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var x: i32 = 1; } @@ -88,7 +100,11 @@ fn F() { // --- param_let_named_not_used.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: param_let_named_not_used.carbon:[[@LINE+2]]:6-11: warning: binding `p` unused [UnusedBinding] +// CHECK:STDERR: ╭─┤ param_let_named_not_used.carbon:[[@LINE+6]]:6 +// CHECK:STDERR: -> │ fn F(p: i32) { +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┗━━┫ warning: binding `p` unused [UnusedBinding] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(p: i32) { } @@ -96,7 +112,11 @@ fn F(p: i32) { // --- param_ref_named_not_used.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: param_ref_named_not_used.carbon:[[@LINE+2]]:6-15: warning: binding `y` unused [UnusedBinding] +// CHECK:STDERR: ╭─┤ param_ref_named_not_used.carbon:[[@LINE+6]]:6 +// CHECK:STDERR: -> │ fn F(ref y: i32) { +// CHECK:STDERR: · ━━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ warning: binding `y` unused [UnusedBinding] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(ref y: i32) { } @@ -104,10 +124,17 @@ fn F(ref y: i32) { // --- fail_read_from_param_unused_ref.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_read_from_param_unused_ref.carbon:[[@LINE+1]]:26-35: error: variable `y` marked `unused` but used [UnusedButUsed] +// CHECK:STDERR: ╭─┤ fail_read_from_param_unused_ref.carbon:[[@LINE+10]]:26 +// CHECK:STDERR: -> │ fn RefParamUnused(unused ref y: i32) { +// CHECK:STDERR: · ━━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: variable `y` marked `unused` but used +// CHECK:STDERR: · ┃ [UnusedButUsed] +// CHECK:STDERR: │ var _: i32 = y; +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ usage here [UnusedButUsedHere] +// CHECK:STDERR: ╰──── +// CHECK:STDERR: fn RefParamUnused(unused ref y: i32) { - // CHECK:STDERR: fail_read_from_param_unused_ref.carbon:[[@LINE+2]]:16: note: usage here [UnusedButUsedHere] - // CHECK:STDERR: var _: i32 = y; } @@ -115,8 +142,13 @@ fn RefParamUnused(unused ref y: i32) { library "[[@TEST_NAME]]"; fn F() -> i32 { - // CHECK:STDERR: fail_unused_returned_var.carbon:[[@LINE+3]]:23-28: error: variable `x` marked `unused` but used [UnusedButUsed] - // CHECK:STDERR: fail_unused_returned_var.carbon:[[@LINE+2]]:23-28: note: usage here [UnusedButUsedHere] + // CHECK:STDERR: ╭─┤ fail_unused_returned_var.carbon:[[@LINE+8]]:23 + // CHECK:STDERR: -> │ returned var unused x: i32 = 0; + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: variable `x` marked `unused` but used + // CHECK:STDERR: · │ ┃ [UnusedButUsed] + // CHECK:STDERR: · ╰────┤ usage here [UnusedButUsedHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: returned var unused x: i32 = 0; return var; @@ -127,10 +159,17 @@ library "[[@TEST_NAME]]"; fn F(x: i32) { var _: i32 = x; - // CHECK:STDERR: fail_read_from_unused_local_var.carbon:[[@LINE+1]]:14-19: error: variable `y` marked `unused` but used [UnusedButUsed] - var unused y: i32 = x; - // CHECK:STDERR: fail_read_from_unused_local_var.carbon:[[@LINE+2]]:23: note: usage here [UnusedButUsedHere] + // CHECK:STDERR: ╭─┤ fail_read_from_unused_local_var.carbon:[[@LINE+10]]:14 + // CHECK:STDERR: -> │ var unused y: i32 = x; + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: variable `y` marked `unused` but used + // CHECK:STDERR: · ┃ [UnusedButUsed] + // CHECK:STDERR: │ var unused z: i32 = y; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ usage here [UnusedButUsedHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: + var unused y: i32 = x; var unused z: i32 = y; } @@ -139,7 +178,11 @@ library "[[@TEST_NAME]]"; fn F() -> i32 { var x: i32 = 3; - // CHECK:STDERR: fail_todo_match.carbon:[[@LINE+2]]:3-7: error: semantics TODO: `HandleMatchIntroducer` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_match.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ match (f(x)) { + // CHECK:STDERR: · ━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `HandleMatchIntroducer` [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: match (f(x)) { case unused var (a: i32, b: i32) => { return 0; } @@ -154,7 +197,12 @@ fn F() -> i32 { // --- fail_unused_decl.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_unused_decl.carbon:[[@LINE+2]]:13-18: error: `unused` modifier without a definition [UnusedModifierWithoutDefinition] +// CHECK:STDERR: ╭─┤ fail_unused_decl.carbon:[[@LINE+7]]:13 +// CHECK:STDERR: -> │ fn F(unused x: i32); +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: `unused` modifier without a definition +// CHECK:STDERR: · ┃ [UnusedModifierWithoutDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused x: i32); @@ -162,7 +210,12 @@ fn F(unused x: i32); library "[[@TEST_NAME]]"; class C { - // CHECK:STDERR: fail_unused_self_decl.carbon:[[@LINE+2]]:15-18: error: `unused` modifier without a definition [UnusedModifierWithoutDefinition] + // CHECK:STDERR: ╭─┤ fail_unused_self_decl.carbon:[[@LINE+7]]:15 + // CHECK:STDERR: -> │ fn F(unused self); + // CHECK:STDERR: · ━━┳━ + // CHECK:STDERR: · ┗━━┫ error: `unused` modifier without a definition + // CHECK:STDERR: · ┃ [UnusedModifierWithoutDefinition] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused self); } @@ -173,14 +226,29 @@ library "[[@TEST_NAME]]"; // The `unused` modifier is rejected without a definition for any implicit // parameter, both a compile-time binding and `self`. -// CHECK:STDERR: fail_unused_implicit_param_decl.carbon:[[@LINE+2]]:13-19: error: `unused` modifier without a definition [UnusedModifierWithoutDefinition] +// CHECK:STDERR: ╭─┤ fail_unused_implicit_param_decl.carbon:[[@LINE+7]]:13 +// CHECK:STDERR: -> │ fn F[unused T: type](); +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: `unused` modifier without a definition +// CHECK:STDERR: · ┃ [UnusedModifierWithoutDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F[unused T: type](); class C { - // CHECK:STDERR: fail_unused_implicit_param_decl.carbon:[[@LINE+4]]:15-24: error: `self` must be declared in the explicit parameter list [SelfInImplicitParamList] + // CHECK:STDERR: ╭─┤ fail_unused_implicit_param_decl.carbon:[[@LINE+14]]:15 + // CHECK:STDERR: -> │ fn G[unused self: Self](); + // CHECK:STDERR: · ┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: `self` must be declared in the explicit parameter list + // CHECK:STDERR: · ┃ [SelfInImplicitParamList] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_unused_implicit_param_decl.carbon:[[@LINE+2]]:15-24: error: `unused` modifier without a definition [UnusedModifierWithoutDefinition] + // CHECK:STDERR: ╭─┤ fail_unused_implicit_param_decl.carbon:[[@LINE+7]]:15 + // CHECK:STDERR: -> │ fn G[unused self: Self](); + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: `unused` modifier without a definition + // CHECK:STDERR: · ┃ [UnusedModifierWithoutDefinition] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn G[unused self: Self](); } @@ -189,10 +257,17 @@ class C { library "[[@TEST_NAME]]"; fn F() { - // CHECK:STDERR: fail_multiple_uses_of_unused.carbon:[[@LINE+1]]:14-19: error: variable `x` marked `unused` but used [UnusedButUsed] - var unused x: i32 = 0; - // CHECK:STDERR: fail_multiple_uses_of_unused.carbon:[[@LINE+2]]:3: note: usage here [UnusedButUsedHere] + // CHECK:STDERR: ╭─┤ fail_multiple_uses_of_unused.carbon:[[@LINE+10]]:14 + // CHECK:STDERR: -> │ var unused x: i32 = 0; + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: variable `x` marked `unused` but used + // CHECK:STDERR: · ┃ [UnusedButUsed] + // CHECK:STDERR: │ x; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ usage here [UnusedButUsedHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: + var unused x: i32 = 0; x; x; } @@ -201,8 +276,17 @@ fn F() { library "[[@TEST_NAME]]"; fn F(x: i32); -// CHECK:STDERR: fail_unused_does_not_affect_redeclaration.carbon:[[@LINE+3]]:13-18: error: redeclaration differs at parameter 1 [RedeclParamDiffers] -// CHECK:STDERR: fail_unused_does_not_affect_redeclaration.carbon:[[@LINE-2]]:6-11: note: previous declaration's corresponding parameter here [RedeclParamPrevious] +// CHECK:STDERR: ╭─┤ fail_unused_does_not_affect_redeclaration.carbon:[[@LINE+12]]:13 +// CHECK:STDERR: │ fn F(x: i32); +// CHECK:STDERR: · ───┬── +// CHECK:STDERR: · ╰──┤ previous declaration's corresponding parameter here +// CHECK:STDERR: · │ [RedeclParamPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn F(unused y: i32) {} +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: redeclaration differs at parameter 1 +// CHECK:STDERR: · ┃ [RedeclParamDiffers] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused y: i32) {} @@ -232,13 +316,27 @@ library "[[@TEST_NAME]]"; fn F(generic T: type); -// CHECK:STDERR: fail_todo_unused_generic.carbon:[[@LINE+2]]:21-27: error: semantics TODO: `generic redeclaration differs from previous declaration` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_todo_unused_generic.carbon:[[@LINE+9]]:21 +// CHECK:STDERR: -> │ fn F(unused generic T: type) {} +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: semantics TODO: +// CHECK:STDERR: · ┃ `generic redeclaration differs from previous declaration` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused generic T: type) {} class C(T: type); -// CHECK:STDERR: fail_todo_unused_generic.carbon:[[@LINE+2]]:16-22: error: semantics TODO: `generic redeclaration differs from previous declaration` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_todo_unused_generic.carbon:[[@LINE+9]]:16 +// CHECK:STDERR: -> │ class C(unused T: type) {} +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: semantics TODO: +// CHECK:STDERR: · ┃ `generic redeclaration differs from previous declaration` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: class C(unused T: type) {} @@ -246,14 +344,30 @@ class C(unused T: type) {} library "[[@TEST_NAME]]"; fn F() { - // CHECK:STDERR: fail_unused_let_multiple_uses.carbon:[[@LINE+1]]:14-19: error: variable `x` marked `unused` but used [UnusedButUsed] - let unused x: i32 = 0; - // CHECK:STDERR: fail_unused_let_multiple_uses.carbon:[[@LINE+4]]:16: note: usage here [UnusedButUsedHere] + // CHECK:STDERR: ╭─┤ fail_unused_let_multiple_uses.carbon:[[@LINE+11]]:14 + // CHECK:STDERR: -> │ let unused x: i32 = 0; + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: variable `x` marked `unused` but used + // CHECK:STDERR: · ┃ [UnusedButUsed] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ var y: i32 = x; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ usage here [UnusedButUsedHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_unused_let_multiple_uses.carbon:[[@LINE+2]]:7-12: warning: binding `y` unused [UnusedBinding] + let unused x: i32 = 0; + // CHECK:STDERR: ╭─┤ fail_unused_let_multiple_uses.carbon:[[@LINE+6]]:7 + // CHECK:STDERR: -> │ var y: i32 = x; + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ warning: binding `y` unused [UnusedBinding] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var y: i32 = x; - // CHECK:STDERR: fail_unused_let_multiple_uses.carbon:[[@LINE+2]]:7-12: warning: binding `z` unused [UnusedBinding] + // CHECK:STDERR: ╭─┤ fail_unused_let_multiple_uses.carbon:[[@LINE+6]]:7 + // CHECK:STDERR: -> │ var z: i32 = x; + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ warning: binding `z` unused [UnusedBinding] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var z: i32 = x; } @@ -262,10 +376,18 @@ fn F() { library "[[@TEST_NAME]]"; fn F() { - // CHECK:STDERR: multiple_unused_bindings.carbon:[[@LINE+2]]:7-12: warning: binding `x` unused [UnusedBinding] + // CHECK:STDERR: ╭─┤ multiple_unused_bindings.carbon:[[@LINE+6]]:7 + // CHECK:STDERR: -> │ var x: i32 = 0; + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ warning: binding `x` unused [UnusedBinding] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var x: i32 = 0; - // CHECK:STDERR: multiple_unused_bindings.carbon:[[@LINE+2]]:7-12: warning: binding `y` unused [UnusedBinding] + // CHECK:STDERR: ╭─┤ multiple_unused_bindings.carbon:[[@LINE+6]]:7 + // CHECK:STDERR: -> │ var y: i32 = 0; + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ warning: binding `y` unused [UnusedBinding] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var y: i32 = 0; } @@ -274,15 +396,31 @@ fn F() { library "[[@TEST_NAME]]"; fn F() -> i32 { - // CHECK:STDERR: fail_unused_tuple.carbon:[[@LINE+1]]:14-19: error: variable `a` marked `unused` but used [UnusedButUsed] + // CHECK:STDERR: ╭─┤ fail_unused_tuple.carbon:[[@LINE+11]]:14 + // CHECK:STDERR: -> │ let unused (a: i32, + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: variable `a` marked `unused` but used + // CHECK:STDERR: · ┃ [UnusedButUsed] + // CHECK:STDERR: ┆ + // CHECK:STDERR: │ let i: i32 = a; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ usage here [UnusedButUsedHere] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: let unused (a: i32, + // CHECK:STDERR: ╭─┤ fail_unused_tuple.carbon:[[@LINE+11]]:14 + // CHECK:STDERR: -> │ b: i32) = (1, 2); + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: variable `b` marked `unused` but used + // CHECK:STDERR: · ┃ [UnusedButUsed] + // CHECK:STDERR: │ let i: i32 = a; + // CHECK:STDERR: │ let unused j: i32 = b; + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ usage here [UnusedButUsedHere] + // CHECK:STDERR: ╰──── + // CHECK:STDERR: b: i32) = (1, 2); - // CHECK:STDERR: fail_unused_tuple.carbon:[[@LINE+3]]:15: note: usage here [UnusedButUsedHere] - // CHECK:STDERR: - // CHECK:STDERR: fail_unused_tuple.carbon:[[@LINE-3]]:14-19: error: variable `b` marked `unused` but used [UnusedButUsed] let i: i32 = a; - // CHECK:STDERR: fail_unused_tuple.carbon:[[@LINE+2]]:22: note: usage here [UnusedButUsedHere] - // CHECK:STDERR: let unused j: i32 = b; return i; } diff --git a/toolchain/check/testdata/patterns/unused_underscore.carbon b/toolchain/check/testdata/patterns/unused_underscore.carbon index 50094d2712a0..ea54e0077f85 100644 --- a/toolchain/check/testdata/patterns/unused_underscore.carbon +++ b/toolchain/check/testdata/patterns/unused_underscore.carbon @@ -11,11 +11,21 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/patterns/unused_underscore.carbon fn F() { - // CHECK:STDERR: unused_underscore.carbon:[[@LINE+2]]:7-19: warning: `unused` modifier on pattern without bindings [UnusedPatternNoBindings] + // CHECK:STDERR: ╭─┤ unused_underscore.carbon:[[@LINE+7]]:7 + // CHECK:STDERR: -> │ var unused _: i32 = 1; + // CHECK:STDERR: · ━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ warning: `unused` modifier on pattern without bindings + // CHECK:STDERR: · ┃ [UnusedPatternNoBindings] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused _: i32 = 1; - // CHECK:STDERR: unused_underscore.carbon:[[@LINE+2]]:7-29: warning: `unused` modifier on pattern without bindings [UnusedPatternNoBindings] + // CHECK:STDERR: ╭─┤ unused_underscore.carbon:[[@LINE+7]]:7 + // CHECK:STDERR: -> │ let unused (_: i32, _: i32) = (1, 1); + // CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ warning: `unused` modifier on pattern without bindings + // CHECK:STDERR: · ┃ [UnusedPatternNoBindings] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let unused (_: i32, _: i32) = (1, 1); } diff --git a/toolchain/check/testdata/pointer/convert_qualifiers.carbon b/toolchain/check/testdata/pointer/convert_qualifiers.carbon index 382283b2df3c..5b36d6442220 100644 --- a/toolchain/check/testdata/pointer/convert_qualifiers.carbon +++ b/toolchain/check/testdata/pointer/convert_qualifiers.carbon @@ -47,9 +47,21 @@ class X {} fn TakeNonConst(p: X*); -// CHECK:STDERR: fail_removed_qualifiers.carbon:[[@LINE+4]]:38: error: cannot implicitly convert expression of type `const X*` to `X*` [ConversionFailure] -// CHECK:STDERR: fail_removed_qualifiers.carbon:[[@LINE+3]]:38: note: type `const X*` does not implement interface `Core.ImplicitAs(X*)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: fail_removed_qualifiers.carbon:[[@LINE-4]]:17-21: note: initializing function parameter [InCallToFunctionParam] +// CHECK:STDERR: ╭─┤ fail_removed_qualifiers.carbon:[[@LINE+16]]:38 +// CHECK:STDERR: │ fn TakeNonConst(p: X*); +// CHECK:STDERR: · ──┬── +// CHECK:STDERR: · ╰──┤ initializing function parameter [InCallToFunctionParam] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn Const(p: const X*) { TakeNonConst(p); } +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert +// CHECK:STDERR: · │ ┃ expression of type `const X*` +// CHECK:STDERR: · │ ┃ to `X*` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╰────┤ type `const X*` does not implement +// CHECK:STDERR: · │ interface `Core.ImplicitAs(X*)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Const(p: const X*) { TakeNonConst(p); } @@ -65,9 +77,21 @@ fn TakeConstConst(p: const (const X*)*); fn NonConstNonConst(p: X**) { //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_nested_qualifiers.carbon:[[@LINE+4]]:18: error: cannot implicitly convert expression of type `X**` to `const (const X*)*` [ConversionFailure] - // CHECK:STDERR: fail_todo_nested_qualifiers.carbon:[[@LINE+3]]:18: note: type `X**` does not implement interface `Core.ImplicitAs(const (const X*)*)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: fail_todo_nested_qualifiers.carbon:[[@LINE-8]]:19-38: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_todo_nested_qualifiers.carbon:[[@LINE+16]]:18 + // CHECK:STDERR: │ fn TakeConstConst(p: const (const X*)*); + // CHECK:STDERR: · ──────────┬───────── + // CHECK:STDERR: · ╰──┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ TakeConstConst(p); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `X**` + // CHECK:STDERR: · │ ┃ to `const (const X*)*` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `X**` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(const (const X*)*)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: TakeConstConst(p); //@dump-sem-ir-end @@ -75,9 +99,21 @@ fn NonConstNonConst(p: X**) { fn ConstNonConst(p: const (X*)*) { //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_nested_qualifiers.carbon:[[@LINE+4]]:18: error: cannot implicitly convert expression of type `const (X*)*` to `const (const X*)*` [ConversionFailure] - // CHECK:STDERR: fail_todo_nested_qualifiers.carbon:[[@LINE+3]]:18: note: type `const (X*)*` does not implement interface `Core.ImplicitAs(const (const X*)*)` [MissingImplInMemberAccessInContext] - // CHECK:STDERR: fail_todo_nested_qualifiers.carbon:[[@LINE-18]]:19-38: note: initializing function parameter [InCallToFunctionParam] + // CHECK:STDERR: ╭─┤ fail_todo_nested_qualifiers.carbon:[[@LINE+16]]:18 + // CHECK:STDERR: │ fn TakeConstConst(p: const (const X*)*); + // CHECK:STDERR: · ──────────┬───────── + // CHECK:STDERR: · ╰──┤ initializing function parameter + // CHECK:STDERR: · │ [InCallToFunctionParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ TakeConstConst(p); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type + // CHECK:STDERR: · │ ┃ `const (X*)*` to `const (const X*)*` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `const (X*)*` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(const (const X*)*)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: TakeConstConst(p); //@dump-sem-ir-end @@ -91,9 +127,23 @@ class X {} fn TakeNonConstConst(p: (const X*)*); -// CHECK:STDERR: fail_nested_added_qualifiers.carbon:[[@LINE+4]]:49: error: cannot implicitly convert expression of type `X**` to `const X**` [ConversionFailure] -// CHECK:STDERR: fail_nested_added_qualifiers.carbon:[[@LINE+3]]:49: note: type `X**` does not implement interface `Core.ImplicitAs(const X**)` [MissingImplInMemberAccessInContext] -// CHECK:STDERR: fail_nested_added_qualifiers.carbon:[[@LINE-4]]:22-35: note: initializing function parameter [InCallToFunctionParam] +// CHECK:STDERR: ╭─┤ fail_nested_added_qualifiers.carbon:[[@LINE+18]]:49 +// CHECK:STDERR: │ fn TakeNonConstConst(p: (const X*)*); +// CHECK:STDERR: · ───────┬────── +// CHECK:STDERR: · ╰──┤ initializing function parameter +// CHECK:STDERR: · │ [InCallToFunctionParam] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ fn NonConstNonConst(p: X**) { TakeNonConstConst(p); } +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly +// CHECK:STDERR: · │ ┃ convert expression +// CHECK:STDERR: · │ ┃ of type `X**` to +// CHECK:STDERR: · │ ┃ `const X**` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╭───────────────────────────────────────────────╯ +// CHECK:STDERR: · │ type `X**` does not implement interface `Core.ImplicitAs(const X**)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn NonConstNonConst(p: X**) { TakeNonConstConst(p); } @@ -170,7 +220,7 @@ fn NonConstNonConst(p: X**) { TakeNonConstConst(p); } // CHECK:STDOUT: !entry: // CHECK:STDOUT: %TakeConstConst.ref: %TakeConstConst.type = name_ref TakeConstConst, file.%TakeConstConst.decl [concrete = constants.%TakeConstConst] // CHECK:STDOUT: %p.ref: %ptr.9ae = name_ref p, %p -// CHECK:STDOUT: %.loc16: %ptr.b53 = converted %p.ref, [concrete = ] +// CHECK:STDOUT: %.loc28: %ptr.b53 = converted %p.ref, [concrete = ] // CHECK:STDOUT: %TakeConstConst.call: init %empty_tuple.type = call %TakeConstConst.ref() // CHECK:STDOUT: // CHECK:STDOUT: } @@ -179,7 +229,7 @@ fn NonConstNonConst(p: X**) { TakeNonConstConst(p); } // CHECK:STDOUT: !entry: // CHECK:STDOUT: %TakeConstConst.ref: %TakeConstConst.type = name_ref TakeConstConst, file.%TakeConstConst.decl [concrete = constants.%TakeConstConst] // CHECK:STDOUT: %p.ref: %ptr.060 = name_ref p, %p -// CHECK:STDOUT: %.loc26: %ptr.b53 = converted %p.ref, [concrete = ] +// CHECK:STDOUT: %.loc50: %ptr.b53 = converted %p.ref, [concrete = ] // CHECK:STDOUT: %TakeConstConst.call: init %empty_tuple.type = call %TakeConstConst.ref() // CHECK:STDOUT: // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/pointer/fail_address_of_error.carbon b/toolchain/check/testdata/pointer/fail_address_of_error.carbon index ef1677c972c0..aa3f364a28de 100644 --- a/toolchain/check/testdata/pointer/fail_address_of_error.carbon +++ b/toolchain/check/testdata/pointer/fail_address_of_error.carbon @@ -13,12 +13,24 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/pointer/fail_address_of_error.carbon fn Test() { - // CHECK:STDERR: fail_address_of_error.carbon:[[@LINE+2]]:4-13: error: name `undeclared` not found [NameNotFound] + // CHECK:STDERR: ╭─┤ fail_address_of_error.carbon:[[@LINE+6]]:4 + // CHECK:STDERR: -> │ &undeclared; + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: name `undeclared` not found [NameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: &undeclared; - // CHECK:STDERR: fail_address_of_error.carbon:[[@LINE+4]]:6-15: error: name `undeclared` not found [NameNotFound] + // CHECK:STDERR: ╭─┤ fail_address_of_error.carbon:[[@LINE+12]]:6 + // CHECK:STDERR: -> │ &(&undeclared); + // CHECK:STDERR: · ━━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: name `undeclared` not found [NameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_address_of_error.carbon:[[@LINE+2]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] + // CHECK:STDERR: ╭─┤ fail_address_of_error.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ &(&undeclared); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot take the address of non-reference expression [AddrOfNonRef] + // CHECK:STDERR: ╰──── // CHECK:STDERR: &(&undeclared); } @@ -50,11 +62,11 @@ fn Test() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Test() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %undeclared.ref.loc18: = name_ref undeclared, [concrete = ] -// CHECK:STDOUT: %addr.loc18: = addr_of %undeclared.ref.loc18 [concrete = ] -// CHECK:STDOUT: %undeclared.ref.loc23: = name_ref undeclared, [concrete = ] -// CHECK:STDOUT: %addr.loc23_5: = addr_of %undeclared.ref.loc23 [concrete = ] -// CHECK:STDOUT: %addr.loc23_3: = addr_of [concrete = ] +// CHECK:STDOUT: %undeclared.ref.loc22: = name_ref undeclared, [concrete = ] +// CHECK:STDOUT: %addr.loc22: = addr_of %undeclared.ref.loc22 [concrete = ] +// CHECK:STDOUT: %undeclared.ref.loc35: = name_ref undeclared, [concrete = ] +// CHECK:STDOUT: %addr.loc35_5: = addr_of %undeclared.ref.loc35 [concrete = ] +// CHECK:STDOUT: %addr.loc35_3: = addr_of [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/pointer/fail_address_of_value.carbon b/toolchain/check/testdata/pointer/fail_address_of_value.carbon index efe3d9fffe17..f8bfd6145f84 100644 --- a/toolchain/check/testdata/pointer/fail_address_of_value.carbon +++ b/toolchain/check/testdata/pointer/fail_address_of_value.carbon @@ -15,61 +15,119 @@ fn G() -> i32; fn H() -> {.a: i32}; fn AddressOfLiteral() { - // CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+2]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] + // CHECK:STDERR: ╭─┤ fail_address_of_value.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ &0; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot take the address of non-reference expression [AddrOfNonRef] + // CHECK:STDERR: ╰──── // CHECK:STDERR: &0; - // CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+2]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] + // CHECK:STDERR: ╭─┤ fail_address_of_value.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ &true; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot take the address of non-reference expression [AddrOfNonRef] + // CHECK:STDERR: ╰──── // CHECK:STDERR: &true; - // CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+2]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] + // CHECK:STDERR: ╭─┤ fail_address_of_value.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ &1.0; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot take the address of non-reference expression [AddrOfNonRef] + // CHECK:STDERR: ╰──── // CHECK:STDERR: &1.0; - // CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+2]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] + // CHECK:STDERR: ╭─┤ fail_address_of_value.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ &"Hello"; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot take the address of non-reference expression [AddrOfNonRef] + // CHECK:STDERR: ╰──── // CHECK:STDERR: &"Hello"; - // CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+2]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] + // CHECK:STDERR: ╭─┤ fail_address_of_value.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ &(1, 2); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot take the address of non-reference expression [AddrOfNonRef] + // CHECK:STDERR: ╰──── // CHECK:STDERR: &(1, 2); - // CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+2]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] + // CHECK:STDERR: ╭─┤ fail_address_of_value.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ &{.a = 5}; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot take the address of non-reference expression [AddrOfNonRef] + // CHECK:STDERR: ╰──── // CHECK:STDERR: &{.a = 5}; } fn AddressOfOperator() { - // CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+2]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] + // CHECK:STDERR: ╭─┤ fail_address_of_value.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ &(true and false); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot take the address of non-reference expression [AddrOfNonRef] + // CHECK:STDERR: ╰──── // CHECK:STDERR: &(true and false); - // CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+2]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] + // CHECK:STDERR: ╭─┤ fail_address_of_value.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ &H().a; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot take the address of non-reference expression [AddrOfNonRef] + // CHECK:STDERR: ╰──── // CHECK:STDERR: &H().a; - // CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+2]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] + // CHECK:STDERR: ╭─┤ fail_address_of_value.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ &(not true); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot take the address of non-reference expression [AddrOfNonRef] + // CHECK:STDERR: ╰──── // CHECK:STDERR: &(not true); } fn AddressOfCall() { - // CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+2]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] + // CHECK:STDERR: ╭─┤ fail_address_of_value.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ &G(); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot take the address of non-reference expression [AddrOfNonRef] + // CHECK:STDERR: ╰──── // CHECK:STDERR: &G(); } fn AddressOfType() { - // CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+2]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] + // CHECK:STDERR: ╭─┤ fail_address_of_value.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ &i32; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot take the address of non-reference expression [AddrOfNonRef] + // CHECK:STDERR: ╰──── // CHECK:STDERR: &i32; - // CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+2]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] + // CHECK:STDERR: ╭─┤ fail_address_of_value.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ &(const i32*); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot take the address of non-reference expression [AddrOfNonRef] + // CHECK:STDERR: ╰──── // CHECK:STDERR: &(const i32*); } fn AddressOfTupleElementValue() { - // CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+2]]:3: error: cannot take the address of non-reference expression [AddrOfNonRef] + // CHECK:STDERR: ╭─┤ fail_address_of_value.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ &((1, 2).0); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot take the address of non-reference expression [AddrOfNonRef] + // CHECK:STDERR: ╰──── // CHECK:STDERR: &((1, 2).0); } fn AddressOfParam(param: i32) { - // CHECK:STDERR: fail_address_of_value.carbon:[[@LINE+2]]:33: error: cannot take the address of non-reference expression [AddrOfNonRef] + // CHECK:STDERR: ╭─┤ fail_address_of_value.carbon:[[@LINE+8]]:33 + // CHECK:STDERR: -> │ var unused param_addr: i32* = ¶m; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot take the address of + // CHECK:STDERR: · ┃ non-reference expression + // CHECK:STDERR: · ┃ [AddrOfNonRef] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused param_addr: i32* = ¶m; } diff --git a/toolchain/check/testdata/pointer/fail_deref_error.carbon b/toolchain/check/testdata/pointer/fail_deref_error.carbon index 7c1ce55f8047..1c88a05c8f5d 100644 --- a/toolchain/check/testdata/pointer/fail_deref_error.carbon +++ b/toolchain/check/testdata/pointer/fail_deref_error.carbon @@ -12,10 +12,18 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/pointer/fail_deref_error.carbon -// CHECK:STDERR: fail_deref_error.carbon:[[@LINE+2]]:15-24: error: name `undeclared` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_deref_error.carbon:[[@LINE+6]]:15 +// CHECK:STDERR: -> │ let n: i32 = *undeclared; +// CHECK:STDERR: · ━━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: name `undeclared` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let n: i32 = *undeclared; -// CHECK:STDERR: fail_deref_error.carbon:[[@LINE+2]]:15-24: error: name `undeclared` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_deref_error.carbon:[[@LINE+6]]:15 +// CHECK:STDERR: -> │ let n2: i32 = undeclared->foo; +// CHECK:STDERR: · ━━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: name `undeclared` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let n2: i32 = undeclared->foo; @@ -49,12 +57,12 @@ let n2: i32 = undeclared->foo; // CHECK:STDOUT: .n2 = %n2 // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %i32.loc17: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc21: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %n: %i32 = wrapper_binding n, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %n.patt: %pattern_type.d94 = value_binding_pattern n [concrete = constants.%n.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %i32.loc20: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc28: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %n2: %i32 = wrapper_binding n2, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %n2.patt: %pattern_type.d94 = value_binding_pattern n2 [concrete = constants.%n2.patt] @@ -63,10 +71,10 @@ let n2: i32 = undeclared->foo; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %undeclared.ref.loc17: = name_ref undeclared, [concrete = ] -// CHECK:STDOUT: %.loc17: ref = deref [concrete = ] -// CHECK:STDOUT: %undeclared.ref.loc20: = name_ref undeclared, [concrete = ] -// CHECK:STDOUT: %.loc20: ref = deref [concrete = ] +// CHECK:STDOUT: %undeclared.ref.loc21: = name_ref undeclared, [concrete = ] +// CHECK:STDOUT: %.loc21: ref = deref [concrete = ] +// CHECK:STDOUT: %undeclared.ref.loc28: = name_ref undeclared, [concrete = ] +// CHECK:STDOUT: %.loc28: ref = deref [concrete = ] // CHECK:STDOUT: %foo.ref: = name_ref foo, [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/pointer/fail_deref_function.carbon b/toolchain/check/testdata/pointer/fail_deref_function.carbon index 6c975dd282d0..32ecaeecc2c0 100644 --- a/toolchain/check/testdata/pointer/fail_deref_function.carbon +++ b/toolchain/check/testdata/pointer/fail_deref_function.carbon @@ -13,10 +13,20 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/pointer/fail_deref_function.carbon fn A() { - // CHECK:STDERR: fail_deref_function.carbon:[[@LINE+2]]:3: error: cannot dereference operand of non-pointer type `` [DerefOfNonPointer] + // CHECK:STDERR: ╭─┤ fail_deref_function.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ *A; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot dereference operand of non-pointer type `` + // CHECK:STDERR: · ┃ [DerefOfNonPointer] + // CHECK:STDERR: ╰──── // CHECK:STDERR: *A; - // CHECK:STDERR: fail_deref_function.carbon:[[@LINE+2]]:4-5: error: cannot apply `->` operator to non-pointer type `` [ArrowOperatorOfNonPointer] + // CHECK:STDERR: ╭─┤ fail_deref_function.carbon:[[@LINE+7]]:4 + // CHECK:STDERR: -> │ A->foo; + // CHECK:STDERR: · ━┳ + // CHECK:STDERR: · ┗━━┫ error: cannot apply `->` operator to non-pointer type `` + // CHECK:STDERR: · ┃ [ArrowOperatorOfNonPointer] + // CHECK:STDERR: ╰──── // CHECK:STDERR: A->foo; } @@ -47,10 +57,10 @@ fn A() { // CHECK:STDOUT: // CHECK:STDOUT: fn @A() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %A.ref.loc18: %A.type = name_ref A, file.%A.decl [concrete = constants.%A] -// CHECK:STDOUT: %.loc18: ref = deref %A.ref.loc18 [concrete = ] -// CHECK:STDOUT: %A.ref.loc21: %A.type = name_ref A, file.%A.decl [concrete = constants.%A] -// CHECK:STDOUT: %.loc21: ref = deref %A.ref.loc21 [concrete = ] +// CHECK:STDOUT: %A.ref.loc23: %A.type = name_ref A, file.%A.decl [concrete = constants.%A] +// CHECK:STDOUT: %.loc23: ref = deref %A.ref.loc23 [concrete = ] +// CHECK:STDOUT: %A.ref.loc31: %A.type = name_ref A, file.%A.decl [concrete = constants.%A] +// CHECK:STDOUT: %.loc31: ref = deref %A.ref.loc31 [concrete = ] // CHECK:STDOUT: %foo.ref: = name_ref foo, [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/pointer/fail_deref_namespace.carbon b/toolchain/check/testdata/pointer/fail_deref_namespace.carbon index 14a8c3f878e7..f3de06cd60d7 100644 --- a/toolchain/check/testdata/pointer/fail_deref_namespace.carbon +++ b/toolchain/check/testdata/pointer/fail_deref_namespace.carbon @@ -15,10 +15,18 @@ namespace A; fn F() { - // CHECK:STDERR: fail_deref_namespace.carbon:[[@LINE+2]]:4: error: expression cannot be used as a value [UseOfNonExprAsValue] + // CHECK:STDERR: ╭─┤ fail_deref_namespace.carbon:[[@LINE+6]]:4 + // CHECK:STDERR: -> │ *A; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expression cannot be used as a value [UseOfNonExprAsValue] + // CHECK:STDERR: ╰──── // CHECK:STDERR: *A; - // CHECK:STDERR: fail_deref_namespace.carbon:[[@LINE+2]]:3: error: expression cannot be used as a value [UseOfNonExprAsValue] + // CHECK:STDERR: ╭─┤ fail_deref_namespace.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ A->foo; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expression cannot be used as a value [UseOfNonExprAsValue] + // CHECK:STDERR: ╰──── // CHECK:STDERR: A->foo; } @@ -51,10 +59,10 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %A.ref.loc20: = name_ref A, file.%A [concrete = file.%A] -// CHECK:STDOUT: %.loc20: ref = deref [concrete = ] -// CHECK:STDOUT: %A.ref.loc23: = name_ref A, file.%A [concrete = file.%A] -// CHECK:STDOUT: %.loc23: ref = deref [concrete = ] +// CHECK:STDOUT: %A.ref.loc24: = name_ref A, file.%A [concrete = file.%A] +// CHECK:STDOUT: %.loc24: ref = deref [concrete = ] +// CHECK:STDOUT: %A.ref.loc31: = name_ref A, file.%A [concrete = file.%A] +// CHECK:STDOUT: %.loc31: ref = deref [concrete = ] // CHECK:STDOUT: %foo.ref: = name_ref foo, [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/pointer/fail_deref_not_pointer.carbon b/toolchain/check/testdata/pointer/fail_deref_not_pointer.carbon index 2cfdb1ad20a5..fdb07a2836bc 100644 --- a/toolchain/check/testdata/pointer/fail_deref_not_pointer.carbon +++ b/toolchain/check/testdata/pointer/fail_deref_not_pointer.carbon @@ -13,22 +13,52 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/pointer/fail_deref_not_pointer.carbon fn Deref(n: i32) { - // CHECK:STDERR: fail_deref_not_pointer.carbon:[[@LINE+2]]:3: error: cannot dereference operand of non-pointer type `i32` [DerefOfNonPointer] + // CHECK:STDERR: ╭─┤ fail_deref_not_pointer.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ *n; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot dereference operand of non-pointer type `i32` + // CHECK:STDERR: · ┃ [DerefOfNonPointer] + // CHECK:STDERR: ╰──── // CHECK:STDERR: *n; - // CHECK:STDERR: fail_deref_not_pointer.carbon:[[@LINE+2]]:4-5: error: cannot apply `->` operator to non-pointer type `i32` [ArrowOperatorOfNonPointer] + // CHECK:STDERR: ╭─┤ fail_deref_not_pointer.carbon:[[@LINE+7]]:4 + // CHECK:STDERR: -> │ n->foo; + // CHECK:STDERR: · ━┳ + // CHECK:STDERR: · ┗━━┫ error: cannot apply `->` operator to non-pointer type `i32` + // CHECK:STDERR: · ┃ [ArrowOperatorOfNonPointer] + // CHECK:STDERR: ╰──── // CHECK:STDERR: n->foo; - // CHECK:STDERR: fail_deref_not_pointer.carbon:[[@LINE+2]]:3: error: cannot dereference operand of non-pointer type `()` [DerefOfNonPointer] + // CHECK:STDERR: ╭─┤ fail_deref_not_pointer.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ *(); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot dereference operand of non-pointer type `()` + // CHECK:STDERR: · ┃ [DerefOfNonPointer] + // CHECK:STDERR: ╰──── // CHECK:STDERR: *(); - // CHECK:STDERR: fail_deref_not_pointer.carbon:[[@LINE+2]]:5-6: error: cannot apply `->` operator to non-pointer type `()` [ArrowOperatorOfNonPointer] + // CHECK:STDERR: ╭─┤ fail_deref_not_pointer.carbon:[[@LINE+7]]:5 + // CHECK:STDERR: -> │ ()->foo; + // CHECK:STDERR: · ━┳ + // CHECK:STDERR: · ┗━━┫ error: cannot apply `->` operator to non-pointer type `()` + // CHECK:STDERR: · ┃ [ArrowOperatorOfNonPointer] + // CHECK:STDERR: ╰──── // CHECK:STDERR: ()->foo; - // CHECK:STDERR: fail_deref_not_pointer.carbon:[[@LINE+2]]:3: error: cannot dereference operand of non-pointer type `{}` [DerefOfNonPointer] + // CHECK:STDERR: ╭─┤ fail_deref_not_pointer.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ *{}; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot dereference operand of non-pointer type `{}` + // CHECK:STDERR: · ┃ [DerefOfNonPointer] + // CHECK:STDERR: ╰──── // CHECK:STDERR: *{}; - // CHECK:STDERR: fail_deref_not_pointer.carbon:[[@LINE+2]]:5-6: error: cannot apply `->` operator to non-pointer type `{}` [ArrowOperatorOfNonPointer] + // CHECK:STDERR: ╭─┤ fail_deref_not_pointer.carbon:[[@LINE+7]]:5 + // CHECK:STDERR: -> │ {}->foo; + // CHECK:STDERR: · ━┳ + // CHECK:STDERR: · ┗━━┫ error: cannot apply `->` operator to non-pointer type `{}` + // CHECK:STDERR: · ┃ [ArrowOperatorOfNonPointer] + // CHECK:STDERR: ╰──── // CHECK:STDERR: {}->foo; } @@ -79,29 +109,29 @@ fn Deref(n: i32) { // CHECK:STDOUT: // CHECK:STDOUT: fn @Deref(%n.param: %i32) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %n.ref.loc18: %i32 = name_ref n, %n -// CHECK:STDOUT: %.loc18: ref = deref %n.ref.loc18 -// CHECK:STDOUT: %n.ref.loc21: %i32 = name_ref n, %n -// CHECK:STDOUT: %.loc21: ref = deref %n.ref.loc21 -// CHECK:STDOUT: %foo.ref.loc21: = name_ref foo, [concrete = ] -// CHECK:STDOUT: %.loc24_5.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %empty_tuple.loc24: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc24_5.2: %empty_tuple.type = converted %.loc24_5.1, %empty_tuple.loc24 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc24_3: ref = deref %.loc24_5.2 [concrete = ] -// CHECK:STDOUT: %.loc27_4.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %empty_tuple.loc27: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc27_4.2: %empty_tuple.type = converted %.loc27_4.1, %empty_tuple.loc27 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc27_5: ref = deref %.loc27_4.2 [concrete = ] -// CHECK:STDOUT: %foo.ref.loc27: = name_ref foo, [concrete = ] -// CHECK:STDOUT: %.loc30_5.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %empty_struct.loc30: %empty_struct_type = struct_value () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc30_5.2: %empty_struct_type = converted %.loc30_5.1, %empty_struct.loc30 [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc30_3: ref = deref %.loc30_5.2 [concrete = ] -// CHECK:STDOUT: %.loc33_4.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %empty_struct.loc33: %empty_struct_type = struct_value () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc33_4.2: %empty_struct_type = converted %.loc33_4.1, %empty_struct.loc33 [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc33_5: ref = deref %.loc33_4.2 [concrete = ] -// CHECK:STDOUT: %foo.ref.loc33: = name_ref foo, [concrete = ] +// CHECK:STDOUT: %n.ref.loc23: %i32 = name_ref n, %n +// CHECK:STDOUT: %.loc23: ref = deref %n.ref.loc23 +// CHECK:STDOUT: %n.ref.loc31: %i32 = name_ref n, %n +// CHECK:STDOUT: %.loc31: ref = deref %n.ref.loc31 +// CHECK:STDOUT: %foo.ref.loc31: = name_ref foo, [concrete = ] +// CHECK:STDOUT: %.loc39_5.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %empty_tuple.loc39: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc39_5.2: %empty_tuple.type = converted %.loc39_5.1, %empty_tuple.loc39 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc39_3: ref = deref %.loc39_5.2 [concrete = ] +// CHECK:STDOUT: %.loc47_4.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %empty_tuple.loc47: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc47_4.2: %empty_tuple.type = converted %.loc47_4.1, %empty_tuple.loc47 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc47_5: ref = deref %.loc47_4.2 [concrete = ] +// CHECK:STDOUT: %foo.ref.loc47: = name_ref foo, [concrete = ] +// CHECK:STDOUT: %.loc55_5.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %empty_struct.loc55: %empty_struct_type = struct_value () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc55_5.2: %empty_struct_type = converted %.loc55_5.1, %empty_struct.loc55 [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc55_3: ref = deref %.loc55_5.2 [concrete = ] +// CHECK:STDOUT: %.loc63_4.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %empty_struct.loc63: %empty_struct_type = struct_value () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc63_4.2: %empty_struct_type = converted %.loc63_4.1, %empty_struct.loc63 [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc63_5: ref = deref %.loc63_4.2 [concrete = ] +// CHECK:STDOUT: %foo.ref.loc63: = name_ref foo, [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/pointer/fail_deref_type.carbon b/toolchain/check/testdata/pointer/fail_deref_type.carbon index b87332d108d8..06e6aa954903 100644 --- a/toolchain/check/testdata/pointer/fail_deref_type.carbon +++ b/toolchain/check/testdata/pointer/fail_deref_type.carbon @@ -12,11 +12,22 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/pointer/fail_deref_type.carbon -// CHECK:STDERR: fail_deref_type.carbon:[[@LINE+3]]:8: error: cannot dereference operand of non-pointer type `type` [DerefOfNonPointer] -// CHECK:STDERR: fail_deref_type.carbon:[[@LINE+2]]:8: note: to form a pointer type, write the `*` after the pointee type [DerefOfType] +// CHECK:STDERR: ╭─┤ fail_deref_type.carbon:[[@LINE+9]]:8 +// CHECK:STDERR: -> │ var p: *i32; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: cannot dereference operand of non-pointer type `type` +// CHECK:STDERR: · │ ┃ [DerefOfNonPointer] +// CHECK:STDERR: · ╰────┤ to form a pointer type, write the `*` after the pointee type +// CHECK:STDERR: · │ [DerefOfType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var p: *i32; -// CHECK:STDERR: fail_deref_type.carbon:[[@LINE+2]]:12-13: error: cannot apply `->` operator to non-pointer type `type` [ArrowOperatorOfNonPointer] +// CHECK:STDERR: ╭─┤ fail_deref_type.carbon:[[@LINE+7]]:12 +// CHECK:STDERR: -> │ var p2: i32->foo; +// CHECK:STDERR: · ━┳ +// CHECK:STDERR: · ┗━━┫ error: cannot apply `->` operator to non-pointer type `type` +// CHECK:STDERR: · ┃ [ArrowOperatorOfNonPointer] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var p2: i32->foo; @@ -48,8 +59,8 @@ var p2: i32->foo; // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %p.var: ref = var_storage %p.var_patt [concrete = ] // CHECK:STDOUT: %.1: = splice_block [concrete = ] { -// CHECK:STDOUT: %i32.loc18: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %.loc18: ref = deref %i32.loc18 [concrete = ] +// CHECK:STDOUT: %i32.loc24: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc24: ref = deref %i32.loc24 [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: %p: = wrapper_binding p, [concrete = ] // CHECK:STDOUT: name_binding_decl { @@ -58,8 +69,8 @@ var p2: i32->foo; // CHECK:STDOUT: } // CHECK:STDOUT: %p2.var: ref = var_storage %p2.var_patt [concrete = ] // CHECK:STDOUT: %.2: = splice_block [concrete = ] { -// CHECK:STDOUT: %i32.loc21: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %.loc21: ref = deref %i32.loc21 [concrete = ] +// CHECK:STDOUT: %i32.loc32: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc32: ref = deref %i32.loc32 [concrete = ] // CHECK:STDOUT: %foo.ref: = name_ref foo, [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: %p2: = wrapper_binding p2, [concrete = ] diff --git a/toolchain/check/testdata/pointer/fail_type_mismatch.carbon b/toolchain/check/testdata/pointer/fail_type_mismatch.carbon index 45204876618a..69a76bc6b026 100644 --- a/toolchain/check/testdata/pointer/fail_type_mismatch.carbon +++ b/toolchain/check/testdata/pointer/fail_type_mismatch.carbon @@ -13,8 +13,16 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/pointer/fail_type_mismatch.carbon fn ConstMismatch(p: const {}*) -> const ({}*) { - // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `const {}*` to `const ({}*)` [ConversionFailure] - // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+2]]:3-11: note: type `const {}*` does not implement interface `Core.ImplicitAs(const ({}*))` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_type_mismatch.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: -> │ return p; + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `const {}*` to + // CHECK:STDERR: · │ ┃ `const ({}*)` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `const {}*` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(const ({}*))` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return p; } @@ -84,7 +92,7 @@ fn ConstMismatch(p: const {}*) -> const ({}*) { // CHECK:STDOUT: fn @ConstMismatch(%p.param: %ptr.bf9) -> out %return.param: %const.987 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: %ptr.bf9 = name_ref p, %p -// CHECK:STDOUT: %.loc19: %const.987 = converted %p.ref, [concrete = ] +// CHECK:STDOUT: %.loc27: %const.987 = converted %p.ref, [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/primitives/float_conversions.carbon b/toolchain/check/testdata/primitives/float_conversions.carbon index 6a3fa9237acc..6d05e85c64fd 100644 --- a/toolchain/check/testdata/primitives/float_conversions.carbon +++ b/toolchain/check/testdata/primitives/float_conversions.carbon @@ -48,15 +48,35 @@ fn F() { // --- fail_int_literal_to_float_lossy.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_int_literal_to_float_lossy.carbon:[[@LINE+2]]:14-22: error: integer value 123456789 cannot be represented exactly in floating-point type `f32` [IntLossyConversionToFloat] +// CHECK:STDERR: ╭─┤ fail_int_literal_to_float_lossy.carbon:[[@LINE+8]]:14 +// CHECK:STDERR: -> │ let a: f32 = 123456789; +// CHECK:STDERR: · ┳━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: integer value 123456789 cannot be represented exactly +// CHECK:STDERR: · ┃ in floating-point type `f32` +// CHECK:STDERR: · ┃ [IntLossyConversionToFloat] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let a: f32 = 123456789; -// CHECK:STDERR: fail_int_literal_to_float_lossy.carbon:[[@LINE+2]]:14-22: error: integer value 100000001 cannot be represented exactly in floating-point type `f32` [IntLossyConversionToFloat] +// CHECK:STDERR: ╭─┤ fail_int_literal_to_float_lossy.carbon:[[@LINE+8]]:14 +// CHECK:STDERR: -> │ let b: f32 = 100000001; +// CHECK:STDERR: · ┳━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: integer value 100000001 cannot be represented exactly +// CHECK:STDERR: · ┃ in floating-point type `f32` +// CHECK:STDERR: · ┃ [IntLossyConversionToFloat] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let b: f32 = 100000001; -// CHECK:STDERR: fail_int_literal_to_float_lossy.carbon:[[@LINE+2]]:14-114: error: integer value 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 too large for floating-point type `f32` [IntTooLargeForFloatType] +// CHECK:STDERR: ╭─┤ fail_int_literal_to_float_lossy.carbon:[[@LINE+10]]:14 +// CHECK:STDERR: -> │ let c: f32 = 1000000000000000000000000000000000000000000000000000000000000... +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: integer value +// CHECK:STDERR: · ┃ 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +// CHECK:STDERR: · ┃ too large for floating-point type `f32` +// CHECK:STDERR: · ┃ [IntTooLargeForFloatType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let c: f32 = 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000; @@ -87,13 +107,28 @@ import library "test_helpers"; fn F(f: f32) { // Lossy explicit conversion using `as` not permitted. - // CHECK:STDERR: fail_float_as_int.carbon:[[@LINE+3]]:16-27: error: cannot convert expression of type `Core.FloatLiteral` to `i32` with `as` [ConversionFailure] - // CHECK:STDERR: fail_float_as_int.carbon:[[@LINE+2]]:16-27: note: type `Core.FloatLiteral` does not implement interface `Core.As(i32)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_float_as_int.carbon:[[@LINE+11]]:16 + // CHECK:STDERR: -> │ let _: i32 = 12.34 as i32; + // CHECK:STDERR: · ┳━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `Core.FloatLiteral` + // CHECK:STDERR: · │ ┃ to `i32` with `as` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Core.FloatLiteral` does not implement interface + // CHECK:STDERR: · │ `Core.As(i32)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: i32 = 12.34 as i32; - // CHECK:STDERR: fail_float_as_int.carbon:[[@LINE+3]]:16-23: error: cannot convert expression of type `f32` to `i32` with `as` [ConversionFailure] - // CHECK:STDERR: fail_float_as_int.carbon:[[@LINE+2]]:16-23: note: type `f32` does not implement interface `Core.As(i32)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_float_as_int.carbon:[[@LINE+10]]:16 + // CHECK:STDERR: -> │ let _: i32 = f as i32; + // CHECK:STDERR: · ┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `f32` to `i32` with + // CHECK:STDERR: · │ ┃ `as` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `f32` does not implement interface `Core.As(i32)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: i32 = f as i32; } @@ -119,8 +154,16 @@ library "[[@TEST_NAME]]"; fn F(x: f64) { // Implicit narrowing conversion (f64 -> f32) is not permitted. - // CHECK:STDERR: fail_float_to_float_narrowing.carbon:[[@LINE+3]]:16: error: cannot implicitly convert expression of type `f64` to `f32` [ConversionFailure] - // CHECK:STDERR: fail_float_to_float_narrowing.carbon:[[@LINE+2]]:16: note: type `f64` does not implement interface `Core.ImplicitAs(f32)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_float_to_float_narrowing.carbon:[[@LINE+11]]:16 + // CHECK:STDERR: -> │ let _: f32 = x; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `f64` to + // CHECK:STDERR: · │ ┃ `f32` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `f64` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(f32)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: f32 = x; } diff --git a/toolchain/check/testdata/primitives/int_conversions.carbon b/toolchain/check/testdata/primitives/int_conversions.carbon index d95bed8fc2a6..f3c479de32fc 100644 --- a/toolchain/check/testdata/primitives/int_conversions.carbon +++ b/toolchain/check/testdata/primitives/int_conversions.carbon @@ -28,8 +28,14 @@ library "[[@TEST_NAME]]"; fn TestFailures() { var a: i64 = 1; - // CHECK:STDERR: fail_narrow_i64_to_i32.carbon:[[@LINE+3]]:3-19: error: cannot implicitly convert expression of type `i64` to `i32` [ConversionFailure] - // CHECK:STDERR: fail_narrow_i64_to_i32.carbon:[[@LINE+2]]:3-19: note: type `i64` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_narrow_i64_to_i32.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ var unused b: i32 = a; + // CHECK:STDERR: · ━━━━━━━┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `i64` to `i32` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `i64` does not implement interface `Core.ImplicitAs(i32)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused b: i32 = a; } @@ -40,8 +46,14 @@ library "[[@TEST_NAME]]"; fn TestFailures() { var w: u64 = 1; - // CHECK:STDERR: fail_narrow_u64_to_u32.carbon:[[@LINE+3]]:3-19: error: cannot implicitly convert expression of type `u64` to `u32` [ConversionFailure] - // CHECK:STDERR: fail_narrow_u64_to_u32.carbon:[[@LINE+2]]:3-19: note: type `u64` does not implement interface `Core.ImplicitAs(u32)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_narrow_u64_to_u32.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ var unused x: u32 = w; + // CHECK:STDERR: · ━━━━━━━┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `u64` to `u32` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `u64` does not implement interface `Core.ImplicitAs(u32)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused x: u32 = w; } @@ -76,10 +88,23 @@ library "[[@TEST_NAME]]"; fn TestCppCompat() { var a: Core.CppCompat.Long32 = 1; - // CHECK:STDERR: fail_todo_cpp_compat_widen_long32_to_i33.carbon:[[@LINE+5]]:17-19: error: bit width of integer type literal must be a multiple of 8; use `Core.Int(33)` instead [IntWidthNotMultipleOf8] + // CHECK:STDERR: ╭─┤ fail_todo_cpp_compat_widen_long32_to_i33.carbon:[[@LINE+18]]:17 + // CHECK:STDERR: -> │ var unused b: i33 = a; + // CHECK:STDERR: · ┳━━ + // CHECK:STDERR: · ┗━━┫ error: bit width of integer type literal must be a multiple + // CHECK:STDERR: · ┃ of 8; use `Core.Int(33)` instead + // CHECK:STDERR: · ┃ [IntWidthNotMultipleOf8] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_todo_cpp_compat_widen_long32_to_i33.carbon:[[@LINE+3]]:3-19: error: cannot implicitly convert expression of type `Long32` to `i33` [ConversionFailure] - // CHECK:STDERR: fail_todo_cpp_compat_widen_long32_to_i33.carbon:[[@LINE+2]]:3-19: note: type `Core.CppCompat.Long32` does not implement interface `Core.ImplicitAs(i33)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_todo_cpp_compat_widen_long32_to_i33.carbon:[[@LINE+10]]:3 + // CHECK:STDERR: -> │ var unused b: i33 = a; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `Long32` to `i33` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Core.CppCompat.Long32` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(i33)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused b: i33 = a; } @@ -90,10 +115,23 @@ library "[[@TEST_NAME]]"; fn TestCppCompat() { var c: Core.CppCompat.Long64 = 1; - // CHECK:STDERR: fail_todo_cpp_compat_widen_long64_to_i65.carbon:[[@LINE+5]]:17-19: error: bit width of integer type literal must be a multiple of 8; use `Core.Int(65)` instead [IntWidthNotMultipleOf8] + // CHECK:STDERR: ╭─┤ fail_todo_cpp_compat_widen_long64_to_i65.carbon:[[@LINE+18]]:17 + // CHECK:STDERR: -> │ var unused d: i65 = c; + // CHECK:STDERR: · ┳━━ + // CHECK:STDERR: · ┗━━┫ error: bit width of integer type literal must be a multiple + // CHECK:STDERR: · ┃ of 8; use `Core.Int(65)` instead + // CHECK:STDERR: · ┃ [IntWidthNotMultipleOf8] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_todo_cpp_compat_widen_long64_to_i65.carbon:[[@LINE+3]]:3-19: error: cannot implicitly convert expression of type `Long64` to `i65` [ConversionFailure] - // CHECK:STDERR: fail_todo_cpp_compat_widen_long64_to_i65.carbon:[[@LINE+2]]:3-19: note: type `Core.CppCompat.Long64` does not implement interface `Core.ImplicitAs(i65)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_todo_cpp_compat_widen_long64_to_i65.carbon:[[@LINE+10]]:3 + // CHECK:STDERR: -> │ var unused d: i65 = c; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `Long64` to `i65` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Core.CppCompat.Long64` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(i65)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused d: i65 = c; } @@ -104,10 +142,23 @@ library "[[@TEST_NAME]]"; fn TestCppCompat() { var e: Core.CppCompat.LongLong64 = 1; - // CHECK:STDERR: fail_todo_cpp_compat_widen_longlong64_to_i65.carbon:[[@LINE+5]]:17-19: error: bit width of integer type literal must be a multiple of 8; use `Core.Int(65)` instead [IntWidthNotMultipleOf8] + // CHECK:STDERR: ╭─┤ fail_todo_cpp_compat_widen_longlong64_to_i65.carbon:[[@LINE+18]]:17 + // CHECK:STDERR: -> │ var unused f: i65 = e; + // CHECK:STDERR: · ┳━━ + // CHECK:STDERR: · ┗━━┫ error: bit width of integer type literal must be a multiple + // CHECK:STDERR: · ┃ of 8; use `Core.Int(65)` instead + // CHECK:STDERR: · ┃ [IntWidthNotMultipleOf8] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_todo_cpp_compat_widen_longlong64_to_i65.carbon:[[@LINE+3]]:3-19: error: cannot implicitly convert expression of type `LongLong64` to `i65` [ConversionFailure] - // CHECK:STDERR: fail_todo_cpp_compat_widen_longlong64_to_i65.carbon:[[@LINE+2]]:3-19: note: type `Core.CppCompat.LongLong64` does not implement interface `Core.ImplicitAs(i65)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_todo_cpp_compat_widen_longlong64_to_i65.carbon:[[@LINE+10]]:3 + // CHECK:STDERR: -> │ var unused f: i65 = e; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `LongLong64` to `i65` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Core.CppCompat.LongLong64` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(i65)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused f: i65 = e; } @@ -118,10 +169,23 @@ library "[[@TEST_NAME]]"; fn TestCppCompat() { var g: Core.CppCompat.ULong32 = 1; - // CHECK:STDERR: fail_todo_cpp_compat_widen_ulong32_to_u33.carbon:[[@LINE+5]]:17-19: error: bit width of integer type literal must be a multiple of 8; use `Core.UInt(33)` instead [IntWidthNotMultipleOf8] + // CHECK:STDERR: ╭─┤ fail_todo_cpp_compat_widen_ulong32_to_u33.carbon:[[@LINE+18]]:17 + // CHECK:STDERR: -> │ var unused h: u33 = g; + // CHECK:STDERR: · ┳━━ + // CHECK:STDERR: · ┗━━┫ error: bit width of integer type literal must be a multiple + // CHECK:STDERR: · ┃ of 8; use `Core.UInt(33)` instead + // CHECK:STDERR: · ┃ [IntWidthNotMultipleOf8] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_todo_cpp_compat_widen_ulong32_to_u33.carbon:[[@LINE+3]]:3-19: error: cannot implicitly convert expression of type `ULong32` to `u33` [ConversionFailure] - // CHECK:STDERR: fail_todo_cpp_compat_widen_ulong32_to_u33.carbon:[[@LINE+2]]:3-19: note: type `Core.CppCompat.ULong32` does not implement interface `Core.ImplicitAs(u33)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_todo_cpp_compat_widen_ulong32_to_u33.carbon:[[@LINE+10]]:3 + // CHECK:STDERR: -> │ var unused h: u33 = g; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `ULong32` to `u33` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Core.CppCompat.ULong32` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(u33)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused h: u33 = g; } @@ -132,10 +196,23 @@ library "[[@TEST_NAME]]"; fn TestCppCompat() { var i: Core.CppCompat.ULong64 = 1; - // CHECK:STDERR: fail_todo_cpp_compat_widen_ulong64_to_u65.carbon:[[@LINE+5]]:17-19: error: bit width of integer type literal must be a multiple of 8; use `Core.UInt(65)` instead [IntWidthNotMultipleOf8] + // CHECK:STDERR: ╭─┤ fail_todo_cpp_compat_widen_ulong64_to_u65.carbon:[[@LINE+18]]:17 + // CHECK:STDERR: -> │ var unused j: u65 = i; + // CHECK:STDERR: · ┳━━ + // CHECK:STDERR: · ┗━━┫ error: bit width of integer type literal must be a multiple + // CHECK:STDERR: · ┃ of 8; use `Core.UInt(65)` instead + // CHECK:STDERR: · ┃ [IntWidthNotMultipleOf8] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_todo_cpp_compat_widen_ulong64_to_u65.carbon:[[@LINE+3]]:3-19: error: cannot implicitly convert expression of type `ULong64` to `u65` [ConversionFailure] - // CHECK:STDERR: fail_todo_cpp_compat_widen_ulong64_to_u65.carbon:[[@LINE+2]]:3-19: note: type `Core.CppCompat.ULong64` does not implement interface `Core.ImplicitAs(u65)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_todo_cpp_compat_widen_ulong64_to_u65.carbon:[[@LINE+10]]:3 + // CHECK:STDERR: -> │ var unused j: u65 = i; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `ULong64` to `u65` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Core.CppCompat.ULong64` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(u65)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused j: u65 = i; } @@ -146,10 +223,24 @@ library "[[@TEST_NAME]]"; fn TestCppCompat() { var k: Core.CppCompat.ULongLong64 = 1; - // CHECK:STDERR: fail_todo_cpp_compat_widen_ulonglong64_to_u65.carbon:[[@LINE+5]]:17-19: error: bit width of integer type literal must be a multiple of 8; use `Core.UInt(65)` instead [IntWidthNotMultipleOf8] + // CHECK:STDERR: ╭─┤ fail_todo_cpp_compat_widen_ulonglong64_to_u65.carbon:[[@LINE+19]]:17 + // CHECK:STDERR: -> │ var unused l: u65 = k; + // CHECK:STDERR: · ┳━━ + // CHECK:STDERR: · ┗━━┫ error: bit width of integer type literal must be a multiple + // CHECK:STDERR: · ┃ of 8; use `Core.UInt(65)` instead + // CHECK:STDERR: · ┃ [IntWidthNotMultipleOf8] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_todo_cpp_compat_widen_ulonglong64_to_u65.carbon:[[@LINE+3]]:3-19: error: cannot implicitly convert expression of type `ULongLong64` to `u65` [ConversionFailure] - // CHECK:STDERR: fail_todo_cpp_compat_widen_ulonglong64_to_u65.carbon:[[@LINE+2]]:3-19: note: type `Core.CppCompat.ULongLong64` does not implement interface `Core.ImplicitAs(u65)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_todo_cpp_compat_widen_ulonglong64_to_u65.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: -> │ var unused l: u65 = k; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `ULongLong64` to + // CHECK:STDERR: · │ ┃ `u65` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Core.CppCompat.ULongLong64` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(u65)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused l: u65 = k; } @@ -161,8 +252,15 @@ library "[[@TEST_NAME]]"; fn TestCppCompat() { // Long32 is slightly wider than i32. var a: Core.CppCompat.Long32 = 1; - // CHECK:STDERR: fail_cpp_compat_narrow_long32_to_i32.carbon:[[@LINE+3]]:3-19: error: cannot implicitly convert expression of type `Long32` to `i32` [ConversionFailure] - // CHECK:STDERR: fail_cpp_compat_narrow_long32_to_i32.carbon:[[@LINE+2]]:3-19: note: type `Core.CppCompat.Long32` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_cpp_compat_narrow_long32_to_i32.carbon:[[@LINE+10]]:3 + // CHECK:STDERR: -> │ var unused b: i32 = a; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `Long32` to `i32` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Core.CppCompat.Long32` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(i32)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused b: i32 = a; } @@ -174,8 +272,16 @@ library "[[@TEST_NAME]]"; fn TestCppCompat() { // i64 is slightly wider than Long64. var c: i64 = 1; - // CHECK:STDERR: fail_cpp_compat_narrow_i64_to_long64.carbon:[[@LINE+3]]:3-37: error: cannot implicitly convert expression of type `i64` to `Core.CppCompat.Long64` [ConversionFailure] - // CHECK:STDERR: fail_cpp_compat_narrow_i64_to_long64.carbon:[[@LINE+2]]:3-37: note: type `i64` does not implement interface `Core.ImplicitAs(Core.CppCompat.Long64)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_cpp_compat_narrow_i64_to_long64.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: -> │ var unused d: Core.CppCompat.Long64 = c; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `i64` to + // CHECK:STDERR: · │ ┃ `Core.CppCompat.Long64` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `i64` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(Core.CppCompat.Long64)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused d: Core.CppCompat.Long64 = c; } @@ -187,8 +293,15 @@ library "[[@TEST_NAME]]"; fn TestCppCompat() { // LongLong64 is slightly wider than i64. var e: Core.CppCompat.LongLong64 = 1; - // CHECK:STDERR: fail_cpp_compat_narrow_longlong64_to_i64.carbon:[[@LINE+3]]:3-19: error: cannot implicitly convert expression of type `LongLong64` to `i64` [ConversionFailure] - // CHECK:STDERR: fail_cpp_compat_narrow_longlong64_to_i64.carbon:[[@LINE+2]]:3-19: note: type `Core.CppCompat.LongLong64` does not implement interface `Core.ImplicitAs(i64)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_cpp_compat_narrow_longlong64_to_i64.carbon:[[@LINE+10]]:3 + // CHECK:STDERR: -> │ var unused f: i64 = e; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `LongLong64` to `i64` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Core.CppCompat.LongLong64` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(i64)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused f: i64 = e; } @@ -200,8 +313,15 @@ library "[[@TEST_NAME]]"; fn TestCppCompat() { // ULong32 is slightly wider than u32. var g: Core.CppCompat.ULong32 = 1; - // CHECK:STDERR: fail_cpp_compat_narrow_ulong32_to_u32.carbon:[[@LINE+3]]:3-19: error: cannot implicitly convert expression of type `ULong32` to `u32` [ConversionFailure] - // CHECK:STDERR: fail_cpp_compat_narrow_ulong32_to_u32.carbon:[[@LINE+2]]:3-19: note: type `Core.CppCompat.ULong32` does not implement interface `Core.ImplicitAs(u32)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_cpp_compat_narrow_ulong32_to_u32.carbon:[[@LINE+10]]:3 + // CHECK:STDERR: -> │ var unused h: u32 = g; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `ULong32` to `u32` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Core.CppCompat.ULong32` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(u32)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused h: u32 = g; } @@ -213,8 +333,16 @@ library "[[@TEST_NAME]]"; fn TestCppCompat() { // u64 is slightly wider than ULong64. var i: u64 = 1; - // CHECK:STDERR: fail_cpp_compat_narrow_u64_to_ulong64.carbon:[[@LINE+3]]:3-38: error: cannot implicitly convert expression of type `u64` to `Core.CppCompat.ULong64` [ConversionFailure] - // CHECK:STDERR: fail_cpp_compat_narrow_u64_to_ulong64.carbon:[[@LINE+2]]:3-38: note: type `u64` does not implement interface `Core.ImplicitAs(Core.CppCompat.ULong64)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_cpp_compat_narrow_u64_to_ulong64.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: -> │ var unused j: Core.CppCompat.ULong64 = i; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `u64` to + // CHECK:STDERR: · │ ┃ `Core.CppCompat.ULong64` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `u64` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(Core.CppCompat.ULong64)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused j: Core.CppCompat.ULong64 = i; } @@ -226,8 +354,16 @@ library "[[@TEST_NAME]]"; fn TestCppCompat() { // ULongLong64 is slightly wider than u64. var k: Core.CppCompat.ULongLong64 = 1; - // CHECK:STDERR: fail_cpp_compat_narrow_ulonglong64_to_u64.carbon:[[@LINE+3]]:3-19: error: cannot implicitly convert expression of type `ULongLong64` to `u64` [ConversionFailure] - // CHECK:STDERR: fail_cpp_compat_narrow_ulonglong64_to_u64.carbon:[[@LINE+2]]:3-19: note: type `Core.CppCompat.ULongLong64` does not implement interface `Core.ImplicitAs(u64)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_cpp_compat_narrow_ulonglong64_to_u64.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: -> │ var unused l: u64 = k; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `ULongLong64` to + // CHECK:STDERR: · │ ┃ `u64` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Core.CppCompat.ULongLong64` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(u64)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused l: u64 = k; } @@ -247,8 +383,14 @@ library "[[@TEST_NAME]]"; fn TestMixedSign() { var a: i32 = 1; - // CHECK:STDERR: fail_narrow_sign_change_i32_to_u32.carbon:[[@LINE+3]]:3-19: error: cannot implicitly convert expression of type `i32` to `u32` [ConversionFailure] - // CHECK:STDERR: fail_narrow_sign_change_i32_to_u32.carbon:[[@LINE+2]]:3-19: note: type `i32` does not implement interface `Core.ImplicitAs(u32)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_narrow_sign_change_i32_to_u32.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ var unused b: u32 = a; + // CHECK:STDERR: · ━━━━━━━┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `i32` to `u32` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `i32` does not implement interface `Core.ImplicitAs(u32)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused b: u32 = a; } @@ -259,8 +401,14 @@ library "[[@TEST_NAME]]"; fn TestMixedSign() { var c: u32 = 1; - // CHECK:STDERR: fail_narrow_sign_change_u32_to_i32.carbon:[[@LINE+3]]:3-19: error: cannot implicitly convert expression of type `u32` to `i32` [ConversionFailure] - // CHECK:STDERR: fail_narrow_sign_change_u32_to_i32.carbon:[[@LINE+2]]:3-19: note: type `u32` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_narrow_sign_change_u32_to_i32.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ var unused d: i32 = c; + // CHECK:STDERR: · ━━━━━━━┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `u32` to `i32` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `u32` does not implement interface `Core.ImplicitAs(i32)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused d: i32 = c; } @@ -271,8 +419,14 @@ library "[[@TEST_NAME]]"; fn TestMixedSign() { var g: i32 = 1; - // CHECK:STDERR: fail_narrow_sign_change_i32_to_u64.carbon:[[@LINE+3]]:3-19: error: cannot implicitly convert expression of type `i32` to `u64` [ConversionFailure] - // CHECK:STDERR: fail_narrow_sign_change_i32_to_u64.carbon:[[@LINE+2]]:3-19: note: type `i32` does not implement interface `Core.ImplicitAs(u64)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_narrow_sign_change_i32_to_u64.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ var unused h: u64 = g; + // CHECK:STDERR: · ━━━━━━━┳━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `i32` to `u64` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `i32` does not implement interface `Core.ImplicitAs(u64)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused h: u64 = g; } @@ -297,8 +451,14 @@ library "[[@TEST_NAME]]"; fn TestArbitraryWidth() { var a: Core.Int(33) = 1; - // CHECK:STDERR: fail_narrow_arbitrary_width_i33_to_i32.carbon:[[@LINE+3]]:3-28: error: cannot implicitly convert expression of type `i33` to `i32` [ConversionFailure] - // CHECK:STDERR: fail_narrow_arbitrary_width_i33_to_i32.carbon:[[@LINE+2]]:3-28: note: type `i33` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_narrow_arbitrary_width_i33_to_i32.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ var unused b: Core.Int(32) = a; + // CHECK:STDERR: · ━━━━━━━┳━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `i33` to `i32` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `i33` does not implement interface `Core.ImplicitAs(i32)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused b: Core.Int(32) = a; } @@ -309,8 +469,14 @@ library "[[@TEST_NAME]]"; fn TestArbitraryWidth() { var d: Core.UInt(33) = 1; - // CHECK:STDERR: fail_narrow_arbitrary_width_u33_to_u32.carbon:[[@LINE+3]]:3-29: error: cannot implicitly convert expression of type `u33` to `u32` [ConversionFailure] - // CHECK:STDERR: fail_narrow_arbitrary_width_u33_to_u32.carbon:[[@LINE+2]]:3-29: note: type `u33` does not implement interface `Core.ImplicitAs(u32)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_narrow_arbitrary_width_u33_to_u32.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ var unused e: Core.UInt(32) = d; + // CHECK:STDERR: · ━━━━━━━┳━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `u33` to `u32` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `u33` does not implement interface `Core.ImplicitAs(u32)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused e: Core.UInt(32) = d; } @@ -321,8 +487,14 @@ library "[[@TEST_NAME]]"; fn TestArbitraryWidth() { var a: Core.Int(33) = 1; - // CHECK:STDERR: fail_narrow_arbitrary_width_i33_to_u34.carbon:[[@LINE+3]]:3-29: error: cannot implicitly convert expression of type `i33` to `u34` [ConversionFailure] - // CHECK:STDERR: fail_narrow_arbitrary_width_i33_to_u34.carbon:[[@LINE+2]]:3-29: note: type `i33` does not implement interface `Core.ImplicitAs(u34)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_narrow_arbitrary_width_i33_to_u34.carbon:[[@LINE+9]]:3 + // CHECK:STDERR: -> │ var unused g: Core.UInt(34) = a; + // CHECK:STDERR: · ━━━━━━━┳━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `i33` to `u34` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `i33` does not implement interface `Core.ImplicitAs(u34)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused g: Core.UInt(34) = a; } diff --git a/toolchain/check/testdata/primitives/numeric_literals.carbon b/toolchain/check/testdata/primitives/numeric_literals.carbon index f5b169c11893..6ba650dc4b08 100644 --- a/toolchain/check/testdata/primitives/numeric_literals.carbon +++ b/toolchain/check/testdata/primitives/numeric_literals.carbon @@ -43,7 +43,13 @@ fn F() { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_overflow_very_large.carbon:[[@LINE+2]]:14-33: error: integer value 39999999999999999993 too large for type `i32` [IntTooLargeForType] +// CHECK:STDERR: ╭─┤ fail_overflow_very_large.carbon:[[@LINE+8]]:14 +// CHECK:STDERR: -> │ let a: i32 = 39999999999999999993; +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: integer value 39999999999999999993 too large for type +// CHECK:STDERR: · ┃ `i32` +// CHECK:STDERR: · ┃ [IntTooLargeForType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let a: i32 = 39999999999999999993; @@ -51,7 +57,12 @@ let a: i32 = 39999999999999999993; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_overflow_boundary.carbon:[[@LINE+2]]:14-26: error: integer value 2147483648 too large for type `i32` [IntTooLargeForType] +// CHECK:STDERR: ╭─┤ fail_overflow_boundary.carbon:[[@LINE+7]]:14 +// CHECK:STDERR: -> │ let b: i32 = 2_147_483_648; +// CHECK:STDERR: · ━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: integer value 2147483648 too large for type `i32` +// CHECK:STDERR: · ┃ [IntTooLargeForType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let b: i32 = 2_147_483_648; @@ -59,7 +70,12 @@ let b: i32 = 2_147_483_648; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_overflow_boundary_hex.carbon:[[@LINE+2]]:14-24: error: integer value 2147483648 too large for type `i32` [IntTooLargeForType] +// CHECK:STDERR: ╭─┤ fail_overflow_boundary_hex.carbon:[[@LINE+7]]:14 +// CHECK:STDERR: -> │ let c: i32 = 0x8000_0000; +// CHECK:STDERR: · ━━━━━┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: integer value 2147483648 too large for type `i32` +// CHECK:STDERR: · ┃ [IntTooLargeForType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let c: i32 = 0x8000_0000; @@ -86,7 +102,15 @@ let max_rounds_down_hex: f64 = 0x1.FFFFFFFFFFFFF7FFFFFFFFFFp+1023; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_overflow_very_large_mantissa.carbon:[[@LINE+2]]:22-98: error: value 399999999999999999999999999999999999999999999999999999999999999999999990*10^237 too large for floating-point type `f64` [FloatLiteralTooLargeForType] +// CHECK:STDERR: ╭─┤ fail_overflow_very_large_mantissa.carbon:[[@LINE+10]]:22 +// CHECK:STDERR: -> │ ... too_large: f64 = 39999999999999999999999999999999999999999999999999999999... +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: value +// CHECK:STDERR: · ┃ 399999999999999999999999999999999999999999999999999999999999999999999990*10^237 +// CHECK:STDERR: · ┃ too large for floating-point type `f64` +// CHECK:STDERR: · ┃ [FloatLiteralTooLargeForType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let too_large: f64 = 39999999999999999999999999999999999999999999999999999999999999999999999.0e238; @@ -97,15 +121,37 @@ let max_plus_one: f64 = 17976931348623157081452742373170435679807056752584499659 let max_plus_a_bit_hex: f64 = 0x1.FFFFFFFFFFFFF00000000000000000000001p+1023; // The smallest number that would round to having an over-large exponent. -// CHECK:STDERR: fail_overflow_very_large_mantissa.carbon:[[@LINE+2]]:30-340: error: value 1797693134862315807937289714053034150799341327100378269361737789804449682927647509466490179775872070963302864166928879109465555478519404026306574886715058206819089020007083836762738548458177115317644757302700698555713669596228429148198608349364752927190741684443655107043427115596995080930428801779041744977920*10^-1 too large for floating-point type `f64` [FloatLiteralTooLargeForType] +// CHECK:STDERR: ╭─┤ fail_overflow_very_large_mantissa.carbon:[[@LINE+10]]:30 +// CHECK:STDERR: -> │ ...nds_to_inf: f64 = 17976931348623158079372897140530341507993413271003782693... +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: value +// CHECK:STDERR: · ┃ 1797693134862315807937289714053034150799341327100378269361737789804449682927647509466490179775872070963302864166928879109465555478519404026306574886715058206819089020007083836762738548458177115317644757302700698555713669596228429148198608349364752927190741684443655107043427115596995080930428801779041744977920*10^-1 +// CHECK:STDERR: · ┃ too large for floating-point type `f64` +// CHECK:STDERR: · ┃ [FloatLiteralTooLargeForType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let min_rounds_to_inf: f64 = 179769313486231580793728971405303415079934132710037826936173778980444968292764750946649017977587207096330286416692887910946555547851940402630657488671505820681908902000708383676273854845817711531764475730270069855571366959622842914819860834936475292719074168444365510704342711559699508093042880177904174497792.0; -// CHECK:STDERR: fail_overflow_very_large_mantissa.carbon:[[@LINE+2]]:41-117: error: value 179769313486231580793728971405303415079934132710037826936173778980444969*10^237 too large for floating-point type `f64` [FloatLiteralTooLargeForType] +// CHECK:STDERR: ╭─┤ fail_overflow_very_large_mantissa.carbon:[[@LINE+10]]:41 +// CHECK:STDERR: -> │ ...rounded_up: f64 = 17976931348623158079372897140530341507993413271003782693... +// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: value +// CHECK:STDERR: · ┃ 179769313486231580793728971405303415079934132710037826936173778980444969*10^237 +// CHECK:STDERR: · ┃ too large for floating-point type `f64` +// CHECK:STDERR: · ┃ [FloatLiteralTooLargeForType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let min_rounds_to_inf_rounded_up: f64 = 17976931348623158079372897140530341507993413271003782693617377898044496.9e238; -// CHECK:STDERR: fail_overflow_very_large_mantissa.carbon:[[@LINE+2]]:34-57: error: value 144115188075855864*2^967 too large for floating-point type `f64` [FloatLiteralTooLargeForType] +// CHECK:STDERR: ╭─┤ fail_overflow_very_large_mantissa.carbon:[[@LINE+8]]:34 +// CHECK:STDERR: -> │ let min_rounds_to_inf_hex: f64 = 0x1.FFFFFFFFFFFFF8p+1023; +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: value 144115188075855864*2^967 too +// CHECK:STDERR: · ┃ large for floating-point type `f64` +// CHECK:STDERR: · ┃ [FloatLiteralTooLargeForType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let min_rounds_to_inf_hex: f64 = 0x1.FFFFFFFFFFFFF8p+1023; @@ -113,7 +159,13 @@ let min_rounds_to_inf_hex: f64 = 0x1.FFFFFFFFFFFFF8p+1023; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_overflow_very_large_exponent.carbon:[[@LINE+2]]:14-37: error: value 50*10^39999999999999999992 too large for floating-point type `f64` [FloatLiteralTooLargeForType] +// CHECK:STDERR: ╭─┤ fail_overflow_very_large_exponent.carbon:[[@LINE+8]]:14 +// CHECK:STDERR: -> │ let e: f64 = 5.0e39999999999999999993; +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: value 50*10^39999999999999999992 too large for +// CHECK:STDERR: · ┃ floating-point type `f64` +// CHECK:STDERR: · ┃ [FloatLiteralTooLargeForType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let e: f64 = 5.0e39999999999999999993; diff --git a/toolchain/check/testdata/primitives/string_literals.carbon b/toolchain/check/testdata/primitives/string_literals.carbon index 262e3995f4cb..2c421f31e030 100644 --- a/toolchain/check/testdata/primitives/string_literals.carbon +++ b/toolchain/check/testdata/primitives/string_literals.carbon @@ -15,7 +15,12 @@ library "[[@TEST_NAME]]"; fn F() { - // CHECK:STDERR: fail_no_string.carbon:[[@LINE+2]]:3-9: error: name `Core.String` implicitly referenced here, but not found [CoreNameNotFound] + // CHECK:STDERR: ╭─┤ fail_no_string.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ "hello"; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: name `Core.String` implicitly referenced here, but not found + // CHECK:STDERR: · ┃ [CoreNameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: "hello"; } @@ -35,7 +40,12 @@ class String { import Core library "unusual_string"; -// CHECK:STDERR: fail_use_unusual_string.carbon:[[@LINE+2]]:14-20: error: unexpected representation for type `str` [StringLiteralTypeUnexpected] +// CHECK:STDERR: ╭─┤ fail_use_unusual_string.carbon:[[@LINE+7]]:14 +// CHECK:STDERR: -> │ let x: str = "hello"; +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: unexpected representation for type `str` +// CHECK:STDERR: · ┃ [StringLiteralTypeUnexpected] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let x: str = "hello"; @@ -52,8 +62,16 @@ library "[[@TEST_NAME]]"; import Core library "incomplete_string"; fn F() { - // CHECK:STDERR: fail_use_incomplete_string.carbon:[[@LINE+3]]:3-9: error: type `Core.String` is incomplete [StringLiteralTypeIncomplete] - // CHECK:STDERR: incomplete_string.carbon:4:1-13: note: class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ╭─┤ fail_use_incomplete_string.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: -> │ "hello"; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: type `Core.String` is incomplete [StringLiteralTypeIncomplete] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ incomplete_string.carbon + // CHECK:STDERR: │ class String; + // CHECK:STDERR: · ──────┬────── + // CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: "hello"; } @@ -88,7 +106,11 @@ library "[[@TEST_NAME]]"; import Core library "small_string"; //@dump-sem-ir-begin -// CHECK:STDERR: fail_overfill_small_string.carbon:[[@LINE+2]]:14-276: error: string literal is too long [StringLiteralTooLong] +// CHECK:STDERR: ╭─┤ fail_overfill_small_string.carbon:[[@LINE+6]]:14 +// CHECK:STDERR: -> │ let x: str = ''' +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┗━━┫ error: string literal is too long [StringLiteralTooLong] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let x: str = ''' A string so long its size does not fit in `u8`. This results in an error, diff --git a/toolchain/check/testdata/primitives/type_literals.carbon b/toolchain/check/testdata/primitives/type_literals.carbon index 0c90ceb2f044..1d90fee5a39d 100644 --- a/toolchain/check/testdata/primitives/type_literals.carbon +++ b/toolchain/check/testdata/primitives/type_literals.carbon @@ -67,90 +67,265 @@ var test_type: type = i32; // --- fail_iN_bad_width.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_iN_bad_width.carbon:[[@LINE+2]]:14-15: error: name `i0` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_iN_bad_width.carbon:[[@LINE+6]]:14 +// CHECK:STDERR: -> │ var test_i0: i0; +// CHECK:STDERR: · ━┳ +// CHECK:STDERR: · ┗━━┫ error: name `i0` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var test_i0: i0; -// CHECK:STDERR: fail_iN_bad_width.carbon:[[@LINE+2]]:14-15: error: bit width of integer type literal must be a multiple of 8; use `Core.Int(1)` instead [IntWidthNotMultipleOf8] +// CHECK:STDERR: ╭─┤ fail_iN_bad_width.carbon:[[@LINE+8]]:14 +// CHECK:STDERR: -> │ var test_i1: i1; +// CHECK:STDERR: · ┳━ +// CHECK:STDERR: · ┗━━┫ error: bit width of integer type literal must be a multiple of +// CHECK:STDERR: · ┃ 8; use `Core.Int(1)` instead +// CHECK:STDERR: · ┃ [IntWidthNotMultipleOf8] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var test_i1: i1; -// CHECK:STDERR: fail_iN_bad_width.carbon:[[@LINE+2]]:15-17: error: bit width of integer type literal must be a multiple of 8; use `Core.Int(15)` instead [IntWidthNotMultipleOf8] +// CHECK:STDERR: ╭─┤ fail_iN_bad_width.carbon:[[@LINE+8]]:15 +// CHECK:STDERR: -> │ var test_i15: i15; +// CHECK:STDERR: · ┳━━ +// CHECK:STDERR: · ┗━━┫ error: bit width of integer type literal must be a multiple +// CHECK:STDERR: · ┃ of 8; use `Core.Int(15)` instead +// CHECK:STDERR: · ┃ [IntWidthNotMultipleOf8] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var test_i15: i15; -// CHECK:STDERR: fail_iN_bad_width.carbon:[[@LINE+2]]:14-15: error: bit width of integer type literal must be a multiple of 8; use `Core.Int(4)` instead [IntWidthNotMultipleOf8] +// CHECK:STDERR: ╭─┤ fail_iN_bad_width.carbon:[[@LINE+8]]:14 +// CHECK:STDERR: -> │ var test_i4: i4; +// CHECK:STDERR: · ┳━ +// CHECK:STDERR: · ┗━━┫ error: bit width of integer type literal must be a multiple of +// CHECK:STDERR: · ┃ 8; use `Core.Int(4)` instead +// CHECK:STDERR: · ┃ [IntWidthNotMultipleOf8] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var test_i4: i4; -// CHECK:STDERR: fail_iN_bad_width.carbon:[[@LINE+2]]:15-17: error: bit width of integer type literal must be a multiple of 8; use `Core.Int(12)` instead [IntWidthNotMultipleOf8] +// CHECK:STDERR: ╭─┤ fail_iN_bad_width.carbon:[[@LINE+8]]:15 +// CHECK:STDERR: -> │ var test_i12: i12; +// CHECK:STDERR: · ┳━━ +// CHECK:STDERR: · ┗━━┫ error: bit width of integer type literal must be a multiple +// CHECK:STDERR: · ┃ of 8; use `Core.Int(12)` instead +// CHECK:STDERR: · ┃ [IntWidthNotMultipleOf8] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var test_i12: i12; -// CHECK:STDERR: fail_iN_bad_width.carbon:[[@LINE+3]]:23-33: error: binding pattern has incomplete type `i1000000000` in name binding declaration [IncompleteTypeInBindingDecl] -// CHECK:STDERR: min_prelude/parts/int.carbon:11:9-18: note: integer type width of 1000000000 is greater than the maximum supported width of 8388608 [IntWidthTooLarge] +// CHECK:STDERR: ╭─┤ fail_iN_bad_width.carbon:[[@LINE+15]]:23 +// CHECK:STDERR: -> │ var test_i1000000000: i1000000000; +// CHECK:STDERR: · ┳━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: binding pattern has incomplete type +// CHECK:STDERR: · ┃ `i1000000000` in name binding declaration +// CHECK:STDERR: · ┃ [IncompleteTypeInBindingDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ min_prelude/parts/int.carbon +// CHECK:STDERR: │ adapt MakeInt(N); +// CHECK:STDERR: · ┬───────── +// CHECK:STDERR: · ╰──┤ integer type width of 1000000000 is greater than the maximum +// CHECK:STDERR: · │ supported width of 8388608 +// CHECK:STDERR: · │ [IntWidthTooLarge] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var test_i1000000000: i1000000000; // TODO: This diagnostic is not very good. -// CHECK:STDERR: fail_iN_bad_width.carbon:[[@LINE+4]]:33-53: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_iN_bad_width.carbon:[[@LINE+16]]:33 +// CHECK:STDERR: -> │ var test_i10000000000000000000: i10000000000000000000; +// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_iN_bad_width.carbon:[[@LINE+2]]:34: error: found a type literal with a bit width using 20 digits, which is greater than the limit of 18 [TooManyTypeBitWidthDigits] +// CHECK:STDERR: ╭─┤ fail_iN_bad_width.carbon:[[@LINE+9]]:34 +// CHECK:STDERR: -> │ var test_i10000000000000000000: i10000000000000000000; +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: found a type literal with a bit +// CHECK:STDERR: · ┃ width using 20 digits, which is +// CHECK:STDERR: · ┃ greater than the limit of 18 +// CHECK:STDERR: · ┃ [TooManyTypeBitWidthDigits] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var test_i10000000000000000000: i10000000000000000000; // --- fail_uN_bad_width.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_uN_bad_width.carbon:[[@LINE+2]]:14-15: error: name `u0` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_uN_bad_width.carbon:[[@LINE+6]]:14 +// CHECK:STDERR: -> │ var test_u0: u0; +// CHECK:STDERR: · ━┳ +// CHECK:STDERR: · ┗━━┫ error: name `u0` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var test_u0: u0; -// CHECK:STDERR: fail_uN_bad_width.carbon:[[@LINE+2]]:14-15: error: bit width of integer type literal must be a multiple of 8; use `Core.UInt(1)` instead [IntWidthNotMultipleOf8] +// CHECK:STDERR: ╭─┤ fail_uN_bad_width.carbon:[[@LINE+8]]:14 +// CHECK:STDERR: -> │ var test_u1: u1; +// CHECK:STDERR: · ┳━ +// CHECK:STDERR: · ┗━━┫ error: bit width of integer type literal must be a multiple of +// CHECK:STDERR: · ┃ 8; use `Core.UInt(1)` instead +// CHECK:STDERR: · ┃ [IntWidthNotMultipleOf8] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var test_u1: u1; -// CHECK:STDERR: fail_uN_bad_width.carbon:[[@LINE+2]]:15-17: error: bit width of integer type literal must be a multiple of 8; use `Core.UInt(15)` instead [IntWidthNotMultipleOf8] +// CHECK:STDERR: ╭─┤ fail_uN_bad_width.carbon:[[@LINE+8]]:15 +// CHECK:STDERR: -> │ var test_u15: u15; +// CHECK:STDERR: · ┳━━ +// CHECK:STDERR: · ┗━━┫ error: bit width of integer type literal must be a multiple +// CHECK:STDERR: · ┃ of 8; use `Core.UInt(15)` instead +// CHECK:STDERR: · ┃ [IntWidthNotMultipleOf8] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var test_u15: u15; -// CHECK:STDERR: fail_uN_bad_width.carbon:[[@LINE+2]]:14-15: error: bit width of integer type literal must be a multiple of 8; use `Core.UInt(4)` instead [IntWidthNotMultipleOf8] +// CHECK:STDERR: ╭─┤ fail_uN_bad_width.carbon:[[@LINE+8]]:14 +// CHECK:STDERR: -> │ var test_u4: u4; +// CHECK:STDERR: · ┳━ +// CHECK:STDERR: · ┗━━┫ error: bit width of integer type literal must be a multiple of +// CHECK:STDERR: · ┃ 8; use `Core.UInt(4)` instead +// CHECK:STDERR: · ┃ [IntWidthNotMultipleOf8] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var test_u4: u4; -// CHECK:STDERR: fail_uN_bad_width.carbon:[[@LINE+2]]:15-17: error: bit width of integer type literal must be a multiple of 8; use `Core.UInt(12)` instead [IntWidthNotMultipleOf8] +// CHECK:STDERR: ╭─┤ fail_uN_bad_width.carbon:[[@LINE+8]]:15 +// CHECK:STDERR: -> │ var test_u12: u12; +// CHECK:STDERR: · ┳━━ +// CHECK:STDERR: · ┗━━┫ error: bit width of integer type literal must be a multiple +// CHECK:STDERR: · ┃ of 8; use `Core.UInt(12)` instead +// CHECK:STDERR: · ┃ [IntWidthNotMultipleOf8] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var test_u12: u12; -// CHECK:STDERR: fail_uN_bad_width.carbon:[[@LINE+3]]:23-33: error: binding pattern has incomplete type `u1000000000` in name binding declaration [IncompleteTypeInBindingDecl] -// CHECK:STDERR: min_prelude/parts/uint.carbon:11:9-19: note: integer type width of 1000000000 is greater than the maximum supported width of 8388608 [IntWidthTooLarge] +// CHECK:STDERR: ╭─┤ fail_uN_bad_width.carbon:[[@LINE+15]]:23 +// CHECK:STDERR: -> │ var test_u1000000000: u1000000000; +// CHECK:STDERR: · ┳━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: binding pattern has incomplete type +// CHECK:STDERR: · ┃ `u1000000000` in name binding declaration +// CHECK:STDERR: · ┃ [IncompleteTypeInBindingDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ min_prelude/parts/uint.carbon +// CHECK:STDERR: │ adapt MakeUInt(N); +// CHECK:STDERR: · ┬────────── +// CHECK:STDERR: · ╰──┤ integer type width of 1000000000 is greater than the maximum +// CHECK:STDERR: · │ supported width of 8388608 +// CHECK:STDERR: · │ [IntWidthTooLarge] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var test_u1000000000: u1000000000; // TODO: This diagnostic is not very good. -// CHECK:STDERR: fail_uN_bad_width.carbon:[[@LINE+4]]:33-53: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_uN_bad_width.carbon:[[@LINE+16]]:33 +// CHECK:STDERR: -> │ var test_u10000000000000000000: u10000000000000000000; +// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_uN_bad_width.carbon:[[@LINE+2]]:34: error: found a type literal with a bit width using 20 digits, which is greater than the limit of 18 [TooManyTypeBitWidthDigits] +// CHECK:STDERR: ╭─┤ fail_uN_bad_width.carbon:[[@LINE+9]]:34 +// CHECK:STDERR: -> │ var test_u10000000000000000000: u10000000000000000000; +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: found a type literal with a bit +// CHECK:STDERR: · ┃ width using 20 digits, which is +// CHECK:STDERR: · ┃ greater than the limit of 18 +// CHECK:STDERR: · ┃ [TooManyTypeBitWidthDigits] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var test_u10000000000000000000: u10000000000000000000; // --- fail_fN_bad_width.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_fN_bad_width.carbon:[[@LINE+2]]:14-15: error: name `f0` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_fN_bad_width.carbon:[[@LINE+6]]:14 +// CHECK:STDERR: -> │ var test_f0: f0; +// CHECK:STDERR: · ━┳ +// CHECK:STDERR: · ┗━━┫ error: name `f0` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var test_f0: f0; -// CHECK:STDERR: fail_fN_bad_width.carbon:[[@LINE+3]]:14-15: error: binding pattern has incomplete type `f1` in name binding declaration [IncompleteTypeInBindingDecl] -// CHECK:STDERR: min_prelude/parts/float.carbon:12:9-20: note: unsupported floating-point bit width 1 [CompileTimeFloatBitWidth] +// CHECK:STDERR: ╭─┤ fail_fN_bad_width.carbon:[[@LINE+14]]:14 +// CHECK:STDERR: -> │ var test_f1: f1; +// CHECK:STDERR: · ┳━ +// CHECK:STDERR: · ┗━━┫ error: binding pattern has incomplete type `f1` in name +// CHECK:STDERR: · ┃ binding declaration +// CHECK:STDERR: · ┃ [IncompleteTypeInBindingDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ min_prelude/parts/float.carbon +// CHECK:STDERR: │ adapt MakeFloat(N); +// CHECK:STDERR: · ──────┬───── +// CHECK:STDERR: · ╰──┤ unsupported floating-point bit width 1 +// CHECK:STDERR: · │ [CompileTimeFloatBitWidth] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var test_f1: f1; -// CHECK:STDERR: fail_fN_bad_width.carbon:[[@LINE+3]]:15-17: error: binding pattern has incomplete type `f15` in name binding declaration [IncompleteTypeInBindingDecl] -// CHECK:STDERR: min_prelude/parts/float.carbon:12:9-20: note: unsupported floating-point bit width 15 [CompileTimeFloatBitWidth] +// CHECK:STDERR: ╭─┤ fail_fN_bad_width.carbon:[[@LINE+14]]:15 +// CHECK:STDERR: -> │ var test_f15: f15; +// CHECK:STDERR: · ┳━━ +// CHECK:STDERR: · ┗━━┫ error: binding pattern has incomplete type `f15` in name +// CHECK:STDERR: · ┃ binding declaration +// CHECK:STDERR: · ┃ [IncompleteTypeInBindingDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ min_prelude/parts/float.carbon +// CHECK:STDERR: │ adapt MakeFloat(N); +// CHECK:STDERR: · ──────┬───── +// CHECK:STDERR: · ╰──┤ unsupported floating-point bit width 15 +// CHECK:STDERR: · │ [CompileTimeFloatBitWidth] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var test_f15: f15; // TODO: Decide if we want to expose the x87 80-bit floating point type this way. -// CHECK:STDERR: fail_fN_bad_width.carbon:[[@LINE+3]]:15-17: error: binding pattern has incomplete type `f80` in name binding declaration [IncompleteTypeInBindingDecl] -// CHECK:STDERR: min_prelude/parts/float.carbon:12:9-20: note: unsupported floating-point bit width 80 [CompileTimeFloatBitWidth] +// CHECK:STDERR: ╭─┤ fail_fN_bad_width.carbon:[[@LINE+14]]:15 +// CHECK:STDERR: -> │ var test_f80: f80; +// CHECK:STDERR: · ┳━━ +// CHECK:STDERR: · ┗━━┫ error: binding pattern has incomplete type `f80` in name +// CHECK:STDERR: · ┃ binding declaration +// CHECK:STDERR: · ┃ [IncompleteTypeInBindingDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ min_prelude/parts/float.carbon +// CHECK:STDERR: │ adapt MakeFloat(N); +// CHECK:STDERR: · ──────┬───── +// CHECK:STDERR: · ╰──┤ unsupported floating-point bit width 80 +// CHECK:STDERR: · │ [CompileTimeFloatBitWidth] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var test_f80: f80; -// CHECK:STDERR: fail_fN_bad_width.carbon:[[@LINE+3]]:16-19: error: binding pattern has incomplete type `f100` in name binding declaration [IncompleteTypeInBindingDecl] -// CHECK:STDERR: min_prelude/parts/float.carbon:12:9-20: note: unsupported floating-point bit width 100 [CompileTimeFloatBitWidth] +// CHECK:STDERR: ╭─┤ fail_fN_bad_width.carbon:[[@LINE+14]]:16 +// CHECK:STDERR: -> │ var test_f100: f100; +// CHECK:STDERR: · ┳━━━ +// CHECK:STDERR: · ┗━━┫ error: binding pattern has incomplete type `f100` in name +// CHECK:STDERR: · ┃ binding declaration +// CHECK:STDERR: · ┃ [IncompleteTypeInBindingDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ min_prelude/parts/float.carbon +// CHECK:STDERR: │ adapt MakeFloat(N); +// CHECK:STDERR: · ──────┬───── +// CHECK:STDERR: · ╰──┤ unsupported floating-point bit width 100 +// CHECK:STDERR: · │ [CompileTimeFloatBitWidth] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var test_f100: f100; -// CHECK:STDERR: fail_fN_bad_width.carbon:[[@LINE+3]]:23-33: error: binding pattern has incomplete type `f1000000000` in name binding declaration [IncompleteTypeInBindingDecl] -// CHECK:STDERR: min_prelude/parts/float.carbon:12:9-20: note: unsupported floating-point bit width 1000000000 [CompileTimeFloatBitWidth] +// CHECK:STDERR: ╭─┤ fail_fN_bad_width.carbon:[[@LINE+14]]:23 +// CHECK:STDERR: -> │ var test_f1000000000: f1000000000; +// CHECK:STDERR: · ┳━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: binding pattern has incomplete type +// CHECK:STDERR: · ┃ `f1000000000` in name binding declaration +// CHECK:STDERR: · ┃ [IncompleteTypeInBindingDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ min_prelude/parts/float.carbon +// CHECK:STDERR: │ adapt MakeFloat(N); +// CHECK:STDERR: · ──────┬───── +// CHECK:STDERR: · ╰──┤ unsupported floating-point bit width 1000000000 +// CHECK:STDERR: · │ [CompileTimeFloatBitWidth] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var test_f1000000000: f1000000000; -// CHECK:STDERR: fail_fN_bad_width.carbon:[[@LINE+3]]:26-39: error: binding pattern has incomplete type `f1000000000000` in name binding declaration [IncompleteTypeInBindingDecl] -// CHECK:STDERR: min_prelude/parts/float.carbon:12:9-20: note: unsupported floating-point bit width 1000000000000 [CompileTimeFloatBitWidth] +// CHECK:STDERR: ╭─┤ fail_fN_bad_width.carbon:[[@LINE+15]]:26 +// CHECK:STDERR: -> │ var test_f1000000000000: f1000000000000; +// CHECK:STDERR: · ┳━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: binding pattern has incomplete type +// CHECK:STDERR: · ┃ `f1000000000000` in name binding +// CHECK:STDERR: · ┃ declaration +// CHECK:STDERR: · ┃ [IncompleteTypeInBindingDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ min_prelude/parts/float.carbon +// CHECK:STDERR: │ adapt MakeFloat(N); +// CHECK:STDERR: · ──────┬───── +// CHECK:STDERR: · ╰──┤ unsupported floating-point bit width 1000000000000 +// CHECK:STDERR: · │ [CompileTimeFloatBitWidth] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var test_f1000000000000: f1000000000000; @@ -158,8 +333,16 @@ var test_f1000000000000: f1000000000000; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_non_type_as_type.carbon:[[@LINE+3]]:1-11: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet] -// CHECK:STDERR: fail_non_type_as_type.carbon:[[@LINE+2]]:1-11: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_non_type_as_type.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: -> │ var x: type = 42; +// CHECK:STDERR: · ┳━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert non-type value of type `Core.IntLiteral` +// CHECK:STDERR: · │ ┃ to `type` +// CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet] +// CHECK:STDERR: · ╰────┤ type `Core.IntLiteral` does not implement interface +// CHECK:STDERR: · │ `Core.ImplicitAs(type)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: type = 42; @@ -169,33 +352,69 @@ library "[[@TEST_NAME]]"; // Ensure that type literals get stringified properly. -// CHECK:STDERR: fail_stringify_type_literals.carbon:[[@LINE+3]]:1-17: error: cannot implicitly convert expression of type `()` to `i32` [ConversionFailure] -// CHECK:STDERR: fail_stringify_type_literals.carbon:[[@LINE+2]]:1-17: note: type `()` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_stringify_type_literals.carbon:[[@LINE+9]]:1 +// CHECK:STDERR: -> │ var test_i32: i32 = (); +// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `()` to `i32` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╰────┤ type `()` does not implement interface `Core.ImplicitAs(i32)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var test_i32: i32 = (); -// CHECK:STDERR: fail_stringify_type_literals.carbon:[[@LINE+3]]:1-17: error: cannot implicitly convert expression of type `()` to `f32` [ConversionFailure] -// CHECK:STDERR: fail_stringify_type_literals.carbon:[[@LINE+2]]:1-17: note: type `()` does not implement interface `Core.ImplicitAs(f32)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_stringify_type_literals.carbon:[[@LINE+9]]:1 +// CHECK:STDERR: -> │ var test_f32: f32 = (); +// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `()` to `f32` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╰────┤ type `()` does not implement interface `Core.ImplicitAs(f32)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var test_f32: f32 = (); -// CHECK:STDERR: fail_stringify_type_literals.carbon:[[@LINE+3]]:1-17: error: cannot implicitly convert expression of type `()` to `u32` [ConversionFailure] -// CHECK:STDERR: fail_stringify_type_literals.carbon:[[@LINE+2]]:1-17: note: type `()` does not implement interface `Core.ImplicitAs(u32)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_stringify_type_literals.carbon:[[@LINE+9]]:1 +// CHECK:STDERR: -> │ var test_u32: u32 = (); +// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `()` to `u32` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╰────┤ type `()` does not implement interface `Core.ImplicitAs(u32)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var test_u32: u32 = (); -// CHECK:STDERR: fail_stringify_type_literals.carbon:[[@LINE+3]]:1-19: error: cannot implicitly convert expression of type `()` to `bool` [ConversionFailure] -// CHECK:STDERR: fail_stringify_type_literals.carbon:[[@LINE+2]]:1-19: note: type `()` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_stringify_type_literals.carbon:[[@LINE+9]]:1 +// CHECK:STDERR: -> │ var test_bool: bool = (); +// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `()` to `bool` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╰────┤ type `()` does not implement interface `Core.ImplicitAs(bool)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var test_bool: bool = (); -// CHECK:STDERR: fail_stringify_type_literals.carbon:[[@LINE+3]]:1-19: error: cannot implicitly convert expression of type `()` to `char` [ConversionFailure] -// CHECK:STDERR: fail_stringify_type_literals.carbon:[[@LINE+2]]:1-19: note: type `()` does not implement interface `Core.ImplicitAs(char)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_stringify_type_literals.carbon:[[@LINE+9]]:1 +// CHECK:STDERR: -> │ var test_char: char = (); +// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `()` to `char` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╰────┤ type `()` does not implement interface `Core.ImplicitAs(char)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var test_char: char = (); -// CHECK:STDERR: fail_stringify_type_literals.carbon:[[@LINE+3]]:1-17: error: cannot implicitly convert expression of type `()` to `str` [ConversionFailure] -// CHECK:STDERR: fail_stringify_type_literals.carbon:[[@LINE+2]]:1-17: note: type `()` does not implement interface `Core.ImplicitAs(str)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_stringify_type_literals.carbon:[[@LINE+9]]:1 +// CHECK:STDERR: -> │ var test_str: str = (); +// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `()` to `str` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╰────┤ type `()` does not implement interface `Core.ImplicitAs(str)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var test_str: str = (); diff --git a/toolchain/check/testdata/return/fail_call_in_type.carbon b/toolchain/check/testdata/return/fail_call_in_type.carbon index 7c359ab9935b..a41068e8c7f9 100644 --- a/toolchain/check/testdata/return/fail_call_in_type.carbon +++ b/toolchain/check/testdata/return/fail_call_in_type.carbon @@ -15,7 +15,12 @@ // TODO: Some variant of this should work, once compile-time function calls are // supported. fn ReturnType() -> type { return i32; } -// CHECK:STDERR: fail_call_in_type.carbon:[[@LINE+2]]:13-24: error: cannot evaluate type expression [TypeExprEvaluationFailure] +// CHECK:STDERR: ╭─┤ fail_call_in_type.carbon:[[@LINE+7]]:13 +// CHECK:STDERR: -> │ fn Six() -> ReturnType() { return 6; } +// CHECK:STDERR: · ━━━━━━┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot evaluate type expression +// CHECK:STDERR: · ┃ [TypeExprEvaluationFailure] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Six() -> ReturnType() { return 6; } @@ -80,8 +85,8 @@ fn Six() -> ReturnType() { return 6; } // CHECK:STDOUT: } { // CHECK:STDOUT: %ReturnType.ref: %ReturnType.type = name_ref ReturnType, file.%ReturnType.decl [concrete = constants.%ReturnType] // CHECK:STDOUT: %ReturnType.call: init type = call %ReturnType.ref() -// CHECK:STDOUT: %.loc20_24.1: type = value_of_initializer %ReturnType.call -// CHECK:STDOUT: %.loc20_24.2: type = converted %ReturnType.call, %.loc20_24.1 +// CHECK:STDOUT: %.loc25_24.1: type = value_of_initializer %ReturnType.call +// CHECK:STDOUT: %.loc25_24.2: type = converted %ReturnType.call, %.loc25_24.1 // CHECK:STDOUT: %return: = return_slot // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/return/fail_error_in_type.carbon b/toolchain/check/testdata/return/fail_error_in_type.carbon index 29c9795e8b38..629ab1873d8e 100644 --- a/toolchain/check/testdata/return/fail_error_in_type.carbon +++ b/toolchain/check/testdata/return/fail_error_in_type.carbon @@ -12,7 +12,11 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/fail_error_in_type.carbon -// CHECK:STDERR: fail_error_in_type.carbon:[[@LINE+2]]:13: error: name `x` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_error_in_type.carbon:[[@LINE+6]]:13 +// CHECK:STDERR: -> │ fn Six() -> x; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: name `x` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Six() -> x; diff --git a/toolchain/check/testdata/return/fail_let_in_type.carbon b/toolchain/check/testdata/return/fail_let_in_type.carbon index 897866bab309..aaa56c2acc51 100644 --- a/toolchain/check/testdata/return/fail_let_in_type.carbon +++ b/toolchain/check/testdata/return/fail_let_in_type.carbon @@ -13,23 +13,51 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/fail_let_in_type.carbon let x: type = i32; -// CHECK:STDERR: fail_let_in_type.carbon:[[@LINE+2]]:13: error: cannot evaluate type expression [TypeExprEvaluationFailure] +// CHECK:STDERR: ╭─┤ fail_let_in_type.carbon:[[@LINE+7]]:13 +// CHECK:STDERR: -> │ fn Six() -> x { return 6; } +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: cannot evaluate type expression +// CHECK:STDERR: · ┃ [TypeExprEvaluationFailure] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Six() -> x { return 6; } // TODO: This should probably work. -// CHECK:STDERR: fail_let_in_type.carbon:[[@LINE+2]]:13-19: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_let_in_type.carbon:[[@LINE+9]]:13 +// CHECK:STDERR: -> │ let generic y: type = i32; +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: semantics TODO: +// CHECK:STDERR: · ┃ ``let` compile time binding outside function or interface` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let generic y: type = i32; -// CHECK:STDERR: fail_let_in_type.carbon:[[@LINE+2]]:19: error: cannot evaluate type expression [TypeExprEvaluationFailure] +// CHECK:STDERR: ╭─┤ fail_let_in_type.carbon:[[@LINE+7]]:19 +// CHECK:STDERR: -> │ fn HalfDozen() -> y { return 6; } +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: cannot evaluate type expression +// CHECK:STDERR: · ┃ [TypeExprEvaluationFailure] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn HalfDozen() -> y { return 6; } // TODO: This should work. -// CHECK:STDERR: fail_let_in_type.carbon:[[@LINE+2]]:5-20: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_let_in_type.carbon:[[@LINE+8]]:5 +// CHECK:STDERR: -> │ let template z: type = i32; +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: +// CHECK:STDERR: · ┃ ``let` compile time binding outside function or interface` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let template z: type = i32; -// CHECK:STDERR: fail_let_in_type.carbon:[[@LINE+2]]:28: error: cannot evaluate type expression [TypeExprEvaluationFailure] +// CHECK:STDERR: ╭─┤ fail_let_in_type.carbon:[[@LINE+7]]:28 +// CHECK:STDERR: -> │ fn FirstPerfectNumber() -> z { return 6; } +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: cannot evaluate type expression +// CHECK:STDERR: · ┃ [TypeExprEvaluationFailure] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn FirstPerfectNumber() -> z { return 6; } @@ -86,11 +114,11 @@ fn FirstPerfectNumber() -> z { return 6; } // CHECK:STDOUT: %x.ref: type = name_ref x, file.%x // CHECK:STDOUT: %return: = return_slot // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc23_16.1: type = splice_block %.loc23_16.2 [concrete = type] { -// CHECK:STDOUT: %.Self.frozen.loc23: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc23_16.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc35_16.1: type = splice_block %.loc35_16.2 [concrete = type] { +// CHECK:STDOUT: %.Self.frozen.loc35: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc35_16.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %y: type = wrapper_binding y, @__global_init.%i32.loc23 +// CHECK:STDOUT: %y: type = wrapper_binding y, @__global_init.%i32.loc35 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %y.patt: %pattern_type.9a5 = value_binding_pattern y [concrete = constants.%y.patt] // CHECK:STDOUT: } @@ -100,11 +128,11 @@ fn FirstPerfectNumber() -> z { return 6; } // CHECK:STDOUT: %y.ref: type = name_ref y, file.%y // CHECK:STDOUT: %return: = return_slot // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc31_17.1: type = splice_block %.loc31_17.2 [concrete = type] { -// CHECK:STDOUT: %.Self.frozen.loc31: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc31_17.2: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.loc54_17.1: type = splice_block %.loc54_17.2 [concrete = type] { +// CHECK:STDOUT: %.Self.frozen.loc54: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc54_17.2: type = type_literal type [concrete = type] // CHECK:STDOUT: } -// CHECK:STDOUT: %z: type = wrapper_binding z, @__global_init.%i32.loc31 +// CHECK:STDOUT: %z: type = wrapper_binding z, @__global_init.%i32.loc54 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %z.patt: %pattern_type.9a5 = value_binding_pattern z [concrete = constants.%z.patt] // CHECK:STDOUT: } @@ -137,8 +165,8 @@ fn FirstPerfectNumber() -> z { return 6; } // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %i32.loc15: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %i32.loc23: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %i32.loc31: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc35: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc54: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/fail_missing_return.carbon b/toolchain/check/testdata/return/fail_missing_return.carbon index 51e4aef82afa..70eed33be7f5 100644 --- a/toolchain/check/testdata/return/fail_missing_return.carbon +++ b/toolchain/check/testdata/return/fail_missing_return.carbon @@ -13,7 +13,12 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/fail_missing_return.carbon fn Main() -> i32 { -// CHECK:STDERR: fail_missing_return.carbon:[[@LINE+2]]:1: error: missing `return` at end of function with declared return type [MissingReturnStatement] +// CHECK:STDERR: ╭─┤ fail_missing_return.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ } +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: missing `return` at end of function with declared return type +// CHECK:STDERR: · ┃ [MissingReturnStatement] +// CHECK:STDERR: ╰──── // CHECK:STDERR: } diff --git a/toolchain/check/testdata/return/fail_missing_return_empty_tuple.carbon b/toolchain/check/testdata/return/fail_missing_return_empty_tuple.carbon index fd98863c0cd5..c1639afc7536 100644 --- a/toolchain/check/testdata/return/fail_missing_return_empty_tuple.carbon +++ b/toolchain/check/testdata/return/fail_missing_return_empty_tuple.carbon @@ -13,7 +13,12 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/fail_missing_return_empty_tuple.carbon fn F() -> () { -// CHECK:STDERR: fail_missing_return_empty_tuple.carbon:[[@LINE+2]]:1: error: missing `return` at end of function with declared return type [MissingReturnStatement] +// CHECK:STDERR: ╭─┤ fail_missing_return_empty_tuple.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ } +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: missing `return` at end of function with declared return type +// CHECK:STDERR: · ┃ [MissingReturnStatement] +// CHECK:STDERR: ╰──── // CHECK:STDERR: } diff --git a/toolchain/check/testdata/return/fail_ref_return.carbon b/toolchain/check/testdata/return/fail_ref_return.carbon index e16a814fa3ef..0f9339046ed9 100644 --- a/toolchain/check/testdata/return/fail_ref_return.carbon +++ b/toolchain/check/testdata/return/fail_ref_return.carbon @@ -11,7 +11,12 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/fail_ref_return.carbon fn F() -> ref i32 { - // CHECK:STDERR: fail_ref_return.carbon:[[@LINE+2]]:3-11: error: cannot bind durable reference to non-reference value of type `i32` [ConversionFailureNonRefToRef] + // CHECK:STDERR: ╭─┤ fail_ref_return.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ return 0; + // CHECK:STDERR: · ┳━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot bind durable reference to non-reference value of type `i32` + // CHECK:STDERR: · ┃ [ConversionFailureNonRefToRef] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return 0; } diff --git a/toolchain/check/testdata/return/fail_return_var_no_returned_var.carbon b/toolchain/check/testdata/return/fail_return_var_no_returned_var.carbon index b3ed67e000a8..6a3e37f1d8bc 100644 --- a/toolchain/check/testdata/return/fail_return_var_no_returned_var.carbon +++ b/toolchain/check/testdata/return/fail_return_var_no_returned_var.carbon @@ -13,7 +13,12 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/fail_return_var_no_returned_var.carbon fn Procedure() -> {} { - // CHECK:STDERR: fail_return_var_no_returned_var.carbon:[[@LINE+2]]:3-13: error: `return var;` with no `returned var` in scope [ReturnVarWithNoReturnedVar] + // CHECK:STDERR: ╭─┤ fail_return_var_no_returned_var.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ return var; + // CHECK:STDERR: · ━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: `return var;` with no `returned var` in scope + // CHECK:STDERR: · ┃ [ReturnVarWithNoReturnedVar] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return var; } diff --git a/toolchain/check/testdata/return/fail_return_with_returned_var.carbon b/toolchain/check/testdata/return/fail_return_with_returned_var.carbon index ba6977ba1569..5ef78ca56c70 100644 --- a/toolchain/check/testdata/return/fail_return_with_returned_var.carbon +++ b/toolchain/check/testdata/return/fail_return_with_returned_var.carbon @@ -14,8 +14,16 @@ fn F() -> i32 { returned var v: i32 = 0; - // CHECK:STDERR: fail_return_with_returned_var.carbon:[[@LINE+3]]:3-11: error: can only `return var;` in the scope of a `returned var` [ReturnExprWithReturnedVar] - // CHECK:STDERR: fail_return_with_returned_var.carbon:[[@LINE-2]]:16-21: note: `returned var` was declared here [ReturnedVarHere] + // CHECK:STDERR: ╭─┤ fail_return_with_returned_var.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ returned var v: i32 = 0; + // CHECK:STDERR: · ───┬── + // CHECK:STDERR: · ╰──┤ `returned var` was declared here [ReturnedVarHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ return 1; + // CHECK:STDERR: · ━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: can only `return var;` in the scope of a `returned var` + // CHECK:STDERR: · ┃ [ReturnExprWithReturnedVar] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return 1; } @@ -23,8 +31,16 @@ fn F() -> i32 { class C { var a: i32; var b: i32; } fn G() -> C { returned var c: C = {.a = 1, .b = 2}; - // CHECK:STDERR: fail_return_with_returned_var.carbon:[[@LINE+3]]:3-11: error: can only `return var;` in the scope of a `returned var` [ReturnExprWithReturnedVar] - // CHECK:STDERR: fail_return_with_returned_var.carbon:[[@LINE-2]]:16-19: note: `returned var` was declared here [ReturnedVarHere] + // CHECK:STDERR: ╭─┤ fail_return_with_returned_var.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ returned var c: C = {.a = 1, .b = 2}; + // CHECK:STDERR: · ──┬─ + // CHECK:STDERR: · ╰──┤ `returned var` was declared here [ReturnedVarHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ return c; + // CHECK:STDERR: · ━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: can only `return var;` in the scope of a `returned var` + // CHECK:STDERR: · ┃ [ReturnExprWithReturnedVar] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return c; } @@ -139,29 +155,29 @@ fn G() -> C { // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {} // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] { // CHECK:STDOUT: %return.param_patt: %pattern_type.98b = out_param_pattern [concrete = constants.%return.param_patt.89a] -// CHECK:STDOUT: %return.patt: %pattern_type.98b = return_slot_pattern %return.param_patt, %C.ref.loc24 [concrete = constants.%return.patt.e4a] +// CHECK:STDOUT: %return.patt: %pattern_type.98b = return_slot_pattern %return.param_patt, %C.ref.loc32 [concrete = constants.%return.patt.e4a] // CHECK:STDOUT: } { -// CHECK:STDOUT: %C.ref.loc24: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %.loc24: Core.Form = init_form %C.ref.loc24 [concrete = constants.%.a44] +// CHECK:STDOUT: %C.ref.loc32: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %.loc32: Core.Form = init_form %C.ref.loc32 [concrete = constants.%.a44] // CHECK:STDOUT: %return.param: ref %C = out_param call_param0 // CHECK:STDOUT: %return: ref %C = return_slot %return.param // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %field_decl.loc23_16: %C.elem = field_decl a, element0, %i32.loc23_18 in [concrete] { -// CHECK:STDOUT: %i32.loc23_18: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %field_decl.loc31_16: %C.elem = field_decl a, element0, %i32.loc31_18 in [concrete] { +// CHECK:STDOUT: %i32.loc31_18: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: } -// CHECK:STDOUT: %field_decl.loc23_28: %C.elem = field_decl b, element1, %i32.loc23_30 in [concrete] { -// CHECK:STDOUT: %i32.loc23_30: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %field_decl.loc31_28: %C.elem = field_decl b, element1, %i32.loc31_30 in [concrete] { +// CHECK:STDOUT: %i32.loc31_30: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: } // CHECK:STDOUT: %complete_type: = complete_type_witness constants.%struct_type.a.b.250 [concrete = constants.%complete_type.eb8] // CHECK:STDOUT: complete_type_witness = %complete_type // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C -// CHECK:STDOUT: .a = %field_decl.loc23_16 -// CHECK:STDOUT: .b = %field_decl.loc23_28 +// CHECK:STDOUT: .a = %field_decl.loc31_16 +// CHECK:STDOUT: .b = %field_decl.loc31_28 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> out %return.param: %i32 { @@ -197,27 +213,27 @@ fn G() -> C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] -// CHECK:STDOUT: %.loc25_38.1: %struct_type.a.b.cfd = struct_literal (%int_1, %int_2) [concrete = constants.%struct] -// CHECK:STDOUT: %impl.elem0.loc25_38.1: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc25_38.1: = bound_method %int_1, %impl.elem0.loc25_38.1 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282] -// CHECK:STDOUT: %specific_fn.loc25_38.1: = specific_function %impl.elem0.loc25_38.1, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc25_38.2: = bound_method %int_1, %specific_fn.loc25_38.1 [concrete = constants.%bound_method.3bd] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc25_38.1: init %i32 = call %bound_method.loc25_38.2(%int_1) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc25_38.2: init %i32 = converted %int_1, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc25_38.1 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc25_38.3: ref %i32 = class_element_access %return.param, element0 -// CHECK:STDOUT: %.loc25_38.4: init %i32 to %.loc25_38.3 = in_place_init %.loc25_38.2 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %impl.elem0.loc25_38.2: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc25_38.3: = bound_method %int_2, %impl.elem0.loc25_38.2 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.8a6] -// CHECK:STDOUT: %specific_fn.loc25_38.2: = specific_function %impl.elem0.loc25_38.2, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc25_38.4: = bound_method %int_2, %specific_fn.loc25_38.2 [concrete = constants.%bound_method.a55] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc25_38.2: init %i32 = call %bound_method.loc25_38.4(%int_2) [concrete = constants.%int_2.2e0] -// CHECK:STDOUT: %.loc25_38.5: init %i32 = converted %int_2, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc25_38.2 [concrete = constants.%int_2.2e0] -// CHECK:STDOUT: %.loc25_38.6: ref %i32 = class_element_access %return.param, element1 -// CHECK:STDOUT: %.loc25_38.7: init %i32 to %.loc25_38.6 = in_place_init %.loc25_38.5 [concrete = constants.%int_2.2e0] -// CHECK:STDOUT: %.loc25_38.8: init %C to %return.param = class_init (%.loc25_38.4, %.loc25_38.7) [concrete = constants.%C.val] -// CHECK:STDOUT: %.loc25_12: init %C = converted %.loc25_38.1, %.loc25_38.8 [concrete = constants.%C.val] -// CHECK:STDOUT: assign %return.param, %.loc25_12 -// CHECK:STDOUT: %C.ref.loc25: type = name_ref C, file.%C.decl [concrete = constants.%C] +// CHECK:STDOUT: %.loc33_38.1: %struct_type.a.b.cfd = struct_literal (%int_1, %int_2) [concrete = constants.%struct] +// CHECK:STDOUT: %impl.elem0.loc33_38.1: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc33_38.1: = bound_method %int_1, %impl.elem0.loc33_38.1 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282] +// CHECK:STDOUT: %specific_fn.loc33_38.1: = specific_function %impl.elem0.loc33_38.1, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc33_38.2: = bound_method %int_1, %specific_fn.loc33_38.1 [concrete = constants.%bound_method.3bd] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc33_38.1: init %i32 = call %bound_method.loc33_38.2(%int_1) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc33_38.2: init %i32 = converted %int_1, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc33_38.1 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc33_38.3: ref %i32 = class_element_access %return.param, element0 +// CHECK:STDOUT: %.loc33_38.4: init %i32 to %.loc33_38.3 = in_place_init %.loc33_38.2 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %impl.elem0.loc33_38.2: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc33_38.3: = bound_method %int_2, %impl.elem0.loc33_38.2 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.8a6] +// CHECK:STDOUT: %specific_fn.loc33_38.2: = specific_function %impl.elem0.loc33_38.2, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc33_38.4: = bound_method %int_2, %specific_fn.loc33_38.2 [concrete = constants.%bound_method.a55] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc33_38.2: init %i32 = call %bound_method.loc33_38.4(%int_2) [concrete = constants.%int_2.2e0] +// CHECK:STDOUT: %.loc33_38.5: init %i32 = converted %int_2, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc33_38.2 [concrete = constants.%int_2.2e0] +// CHECK:STDOUT: %.loc33_38.6: ref %i32 = class_element_access %return.param, element1 +// CHECK:STDOUT: %.loc33_38.7: init %i32 to %.loc33_38.6 = in_place_init %.loc33_38.5 [concrete = constants.%int_2.2e0] +// CHECK:STDOUT: %.loc33_38.8: init %C to %return.param = class_init (%.loc33_38.4, %.loc33_38.7) [concrete = constants.%C.val] +// CHECK:STDOUT: %.loc33_12: init %C = converted %.loc33_38.1, %.loc33_38.8 [concrete = constants.%C.val] +// CHECK:STDOUT: assign %return.param, %.loc33_12 +// CHECK:STDOUT: %C.ref.loc33: type = name_ref C, file.%C.decl [concrete = constants.%C] // CHECK:STDOUT: %c: ref %C = wrapper_binding c, %return.param // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %c.patt: %pattern_type.98b = ref_binding_pattern c [concrete = constants.%c.patt] diff --git a/toolchain/check/testdata/return/fail_returned_var_form.carbon b/toolchain/check/testdata/return/fail_returned_var_form.carbon index 12d09424bea0..38a7817e970b 100644 --- a/toolchain/check/testdata/return/fail_returned_var_form.carbon +++ b/toolchain/check/testdata/return/fail_returned_var_form.carbon @@ -12,8 +12,17 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/fail_returned_var_form.carbon fn Mismatch() -> ref () { - // CHECK:STDERR: fail_returned_var_form.carbon:[[@LINE+3]]:3-10: error: `returned var` declaration in function with non-initializing return form [ReturnedVarNotInit] - // CHECK:STDERR: fail_returned_var_form.carbon:[[@LINE-2]]:18-23: note: return form declared here [ReturnFormHereNote] + // CHECK:STDERR: ╭─┤ fail_returned_var_form.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn Mismatch() -> ref () { + // CHECK:STDERR: · ───┬── + // CHECK:STDERR: · ╰──┤ return form declared here [ReturnFormHereNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ returned var v: () = (); + // CHECK:STDERR: · ┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: `returned var` declaration in function with non-initializing + // CHECK:STDERR: · ┃ return form + // CHECK:STDERR: · ┃ [ReturnedVarNotInit] + // CHECK:STDERR: ╰──── // CHECK:STDERR: returned var v: () = (); return var; diff --git a/toolchain/check/testdata/return/fail_returned_var_no_return_type.carbon b/toolchain/check/testdata/return/fail_returned_var_no_return_type.carbon index e8dabc0eccca..f96fad640a98 100644 --- a/toolchain/check/testdata/return/fail_returned_var_no_return_type.carbon +++ b/toolchain/check/testdata/return/fail_returned_var_no_return_type.carbon @@ -17,8 +17,16 @@ library "[[@TEST_NAME]]"; fn Procedure() { - // CHECK:STDERR: fail_procedure_with_returned_var.carbon:[[@LINE+3]]:3-10: error: cannot declare a `returned var` in this function [ReturnedVarWithNoReturnType] - // CHECK:STDERR: fail_procedure_with_returned_var.carbon:[[@LINE-2]]:1-16: note: there was no return type provided [ReturnTypeOmittedNote] + // CHECK:STDERR: ╭─┤ fail_procedure_with_returned_var.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ fn Procedure() { + // CHECK:STDERR: · ────────┬─────── + // CHECK:STDERR: · ╰──┤ there was no return type provided [ReturnTypeOmittedNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ returned var unused v: () = (); + // CHECK:STDERR: · ━━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot declare a `returned var` in this function + // CHECK:STDERR: · ┃ [ReturnedVarWithNoReturnType] + // CHECK:STDERR: ╰──── // CHECK:STDERR: returned var unused v: () = (); return; @@ -29,11 +37,24 @@ fn Procedure() { library "[[@TEST_NAME]]"; fn ForgotReturnType() { - // CHECK:STDERR: fail_forgot_return_type.carbon:[[@LINE+3]]:3-10: error: cannot declare a `returned var` in this function [ReturnedVarWithNoReturnType] - // CHECK:STDERR: fail_forgot_return_type.carbon:[[@LINE-2]]:1-23: note: there was no return type provided [ReturnTypeOmittedNote] + // CHECK:STDERR: ╭─┤ fail_forgot_return_type.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ fn ForgotReturnType() { + // CHECK:STDERR: · ───────────┬─────────── + // CHECK:STDERR: · ╰──┤ there was no return type provided [ReturnTypeOmittedNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ returned var unused v: () = (); + // CHECK:STDERR: · ━━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot declare a `returned var` in this function + // CHECK:STDERR: · ┃ [ReturnedVarWithNoReturnType] + // CHECK:STDERR: ╰──── // CHECK:STDERR: returned var unused v: () = (); - // CHECK:STDERR: fail_forgot_return_type.carbon:[[@LINE+2]]:3-13: error: `return var;` with no `returned var` in scope [ReturnVarWithNoReturnedVar] + // CHECK:STDERR: ╭─┤ fail_forgot_return_type.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ return var; + // CHECK:STDERR: · ━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: `return var;` with no `returned var` in scope + // CHECK:STDERR: · ┃ [ReturnVarWithNoReturnedVar] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return var; } @@ -56,7 +77,7 @@ fn ForgotReturnType() { // CHECK:STDOUT: %T.09f: %SubobjectDestroy.type = symbolic_binding T, 0 [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.type.dea: type = fn_type @T.as_type.as.DestroyImpl.impl.Op, @T.as_type.as.DestroyImpl.impl(%T.09f) [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.6e5: %T.as_type.as.DestroyImpl.impl.Op.type.dea = struct_value () [symbolic] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.687: type = fn_type @SubobjectDestroy.WithSelf.Op.loc8 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.687: type = fn_type @SubobjectDestroy.WithSelf.Op.loc16 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f: %SubobjectDestroy.WithSelf.Op.type.687 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f), @SubobjectDestroy [concrete] // CHECK:STDOUT: %SubobjectDestroy.facet.f89: %SubobjectDestroy.type = facet_value %empty_tuple.type, (%custom_witness.b80) [concrete] @@ -88,29 +109,29 @@ fn ForgotReturnType() { // CHECK:STDOUT: fn @Procedure() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %v.var: ref %empty_tuple.type = var_storage %v.var_patt -// CHECK:STDOUT: %.loc8_32.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_32.2: init %empty_tuple.type = tuple_init () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_12.1: init %empty_tuple.type = converted %.loc8_32.1, %.loc8_32.2 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: assign %v.var, %.loc8_12.1 -// CHECK:STDOUT: %.loc8_27.1: type = splice_block %.loc8_27.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc8_27.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_27.3: type = converted %.loc8_27.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc16_32.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc16_32.2: init %empty_tuple.type = tuple_init () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc16_12.1: init %empty_tuple.type = converted %.loc16_32.1, %.loc16_32.2 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: assign %v.var, %.loc16_12.1 +// CHECK:STDOUT: %.loc16_27.1: type = splice_block %.loc16_27.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc16_27.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc16_27.3: type = converted %.loc16_27.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %v: ref %empty_tuple.type = wrapper_binding v, %v.var // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %v.patt: %pattern_type.cb1 = ref_binding_pattern v [concrete = constants.%v.patt] // CHECK:STDOUT: %v.var_patt: %pattern_type.cb1 = var_pattern %v.patt [concrete = constants.%v.var_patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.facet.loc8_12.1: %Destroy.type = facet_value constants.%empty_tuple.type, (constants.%DestroyImpl.impl_witness.674, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc8_12.2: %Destroy.type = converted constants.%empty_tuple.type, %Destroy.facet.loc8_12.1 [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %Destroy.facet.loc8_12.2: %Destroy.type = facet_value constants.%empty_tuple.type, (constants.%DestroyImpl.impl_witness.674, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc8_12.3: %Destroy.type = converted constants.%empty_tuple.type, %Destroy.facet.loc8_12.2 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %Destroy.facet.loc16_12.1: %Destroy.type = facet_value constants.%empty_tuple.type, (constants.%DestroyImpl.impl_witness.674, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc16_12.2: %Destroy.type = converted constants.%empty_tuple.type, %Destroy.facet.loc16_12.1 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %Destroy.facet.loc16_12.2: %Destroy.type = facet_value constants.%empty_tuple.type, (constants.%DestroyImpl.impl_witness.674, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc16_12.3: %Destroy.type = converted constants.%empty_tuple.type, %Destroy.facet.loc16_12.2 [concrete = constants.%Destroy.facet] // CHECK:STDOUT: %SelfDestruct.specific_fn: = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet) [concrete = constants.%SelfDestruct.specific_fn] // CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%v.var) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc8(%self.param: ref %empty_tuple.type) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc16(%self.param: ref %empty_tuple.type) = "no_op"; // CHECK:STDOUT: // CHECK:STDOUT: --- fail_forgot_return_type.carbon // CHECK:STDOUT: @@ -130,7 +151,7 @@ fn ForgotReturnType() { // CHECK:STDOUT: %T.09f: %SubobjectDestroy.type = symbolic_binding T, 0 [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.type.dea: type = fn_type @T.as_type.as.DestroyImpl.impl.Op, @T.as_type.as.DestroyImpl.impl(%T.09f) [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.6e5: %T.as_type.as.DestroyImpl.impl.Op.type.dea = struct_value () [symbolic] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.687: type = fn_type @SubobjectDestroy.WithSelf.Op.loc8 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.687: type = fn_type @SubobjectDestroy.WithSelf.Op.loc16 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f: %SubobjectDestroy.WithSelf.Op.type.687 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f), @SubobjectDestroy [concrete] // CHECK:STDOUT: %SubobjectDestroy.facet.f89: %SubobjectDestroy.type = facet_value %empty_tuple.type, (%custom_witness.b80) [concrete] @@ -162,27 +183,27 @@ fn ForgotReturnType() { // CHECK:STDOUT: fn @ForgotReturnType() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %v.var: ref %empty_tuple.type = var_storage %v.var_patt -// CHECK:STDOUT: %.loc8_32.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_32.2: init %empty_tuple.type = tuple_init () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_12.1: init %empty_tuple.type = converted %.loc8_32.1, %.loc8_32.2 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: assign %v.var, %.loc8_12.1 -// CHECK:STDOUT: %.loc8_27.1: type = splice_block %.loc8_27.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc8_27.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_27.3: type = converted %.loc8_27.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc16_32.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc16_32.2: init %empty_tuple.type = tuple_init () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc16_12.1: init %empty_tuple.type = converted %.loc16_32.1, %.loc16_32.2 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: assign %v.var, %.loc16_12.1 +// CHECK:STDOUT: %.loc16_27.1: type = splice_block %.loc16_27.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc16_27.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc16_27.3: type = converted %.loc16_27.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %v: ref %empty_tuple.type = wrapper_binding v, %v.var // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %v.patt: %pattern_type.cb1 = ref_binding_pattern v [concrete = constants.%v.patt] // CHECK:STDOUT: %v.var_patt: %pattern_type.cb1 = var_pattern %v.patt [concrete = constants.%v.var_patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.facet.loc8_12.1: %Destroy.type = facet_value constants.%empty_tuple.type, (constants.%DestroyImpl.impl_witness.674, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc8_12.2: %Destroy.type = converted constants.%empty_tuple.type, %Destroy.facet.loc8_12.1 [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %Destroy.facet.loc8_12.2: %Destroy.type = facet_value constants.%empty_tuple.type, (constants.%DestroyImpl.impl_witness.674, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc8_12.3: %Destroy.type = converted constants.%empty_tuple.type, %Destroy.facet.loc8_12.2 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %Destroy.facet.loc16_12.1: %Destroy.type = facet_value constants.%empty_tuple.type, (constants.%DestroyImpl.impl_witness.674, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc16_12.2: %Destroy.type = converted constants.%empty_tuple.type, %Destroy.facet.loc16_12.1 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %Destroy.facet.loc16_12.2: %Destroy.type = facet_value constants.%empty_tuple.type, (constants.%DestroyImpl.impl_witness.674, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc16_12.3: %Destroy.type = converted constants.%empty_tuple.type, %Destroy.facet.loc16_12.2 [concrete = constants.%Destroy.facet] // CHECK:STDOUT: %SelfDestruct.specific_fn: = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet) [concrete = constants.%SelfDestruct.specific_fn] // CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%v.var) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc8(%self.param: ref %empty_tuple.type) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc16(%self.param: ref %empty_tuple.type) = "no_op"; // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/fail_returned_var_shadow.carbon b/toolchain/check/testdata/return/fail_returned_var_shadow.carbon index 872d11d322b0..31bcc2289dee 100644 --- a/toolchain/check/testdata/return/fail_returned_var_shadow.carbon +++ b/toolchain/check/testdata/return/fail_returned_var_shadow.carbon @@ -15,8 +15,17 @@ fn SameScope() -> i32 { if (true) { returned var v: i32 = 0; - // CHECK:STDERR: fail_returned_var_shadow.carbon:[[@LINE+3]]:25-30: error: cannot declare a `returned var` in the scope of another `returned var` [ReturnedVarShadowed] - // CHECK:STDERR: fail_returned_var_shadow.carbon:[[@LINE-2]]:18-23: note: `returned var` was declared here [ReturnedVarHere] + // CHECK:STDERR: ╭─┤ fail_returned_var_shadow.carbon:[[@LINE+12]]:25 + // CHECK:STDERR: │ returned var v: i32 = 0; + // CHECK:STDERR: · ───┬── + // CHECK:STDERR: · ╰──┤ `returned var` was declared here [ReturnedVarHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ returned var unused w: i32 = 1; + // CHECK:STDERR: · ┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot declare a `returned var` in the scope + // CHECK:STDERR: · ┃ of another `returned var` + // CHECK:STDERR: · ┃ [ReturnedVarShadowed] + // CHECK:STDERR: ╰──── // CHECK:STDERR: returned var unused w: i32 = 1; } @@ -27,8 +36,17 @@ fn DifferentScopes() -> i32 { if (true) { returned var v: i32 = 0; if (true) { - // CHECK:STDERR: fail_returned_var_shadow.carbon:[[@LINE+3]]:27-32: error: cannot declare a `returned var` in the scope of another `returned var` [ReturnedVarShadowed] - // CHECK:STDERR: fail_returned_var_shadow.carbon:[[@LINE-3]]:18-23: note: `returned var` was declared here [ReturnedVarHere] + // CHECK:STDERR: ╭─┤ fail_returned_var_shadow.carbon:[[@LINE+12]]:27 + // CHECK:STDERR: │ returned var v: i32 = 0; + // CHECK:STDERR: · ───┬── + // CHECK:STDERR: · ╰──┤ `returned var` was declared here [ReturnedVarHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ returned var unused w: i32 = 1; + // CHECK:STDERR: · ┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot declare a `returned var` in the + // CHECK:STDERR: · ┃ scope of another `returned var` + // CHECK:STDERR: · ┃ [ReturnedVarShadowed] + // CHECK:STDERR: ╰──── // CHECK:STDERR: returned var unused w: i32 = 1; } @@ -84,7 +102,7 @@ fn DifferentScopes() -> i32 { // CHECK:STDOUT: %T.09f: %SubobjectDestroy.type = symbolic_binding T, 0 [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.type.dea: type = fn_type @T.as_type.as.DestroyImpl.impl.Op, @T.as_type.as.DestroyImpl.impl(%T.09f) [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.6e5: %T.as_type.as.DestroyImpl.impl.Op.type.dea = struct_value () [symbolic] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.687: type = fn_type @SubobjectDestroy.WithSelf.Op.loc21 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.687: type = fn_type @SubobjectDestroy.WithSelf.Op.loc30 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f: %SubobjectDestroy.WithSelf.Op.type.687 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f), @SubobjectDestroy [concrete] // CHECK:STDOUT: %SubobjectDestroy.facet.49a: %SubobjectDestroy.type = facet_value %i32, (%custom_witness.b80) [concrete] @@ -132,10 +150,10 @@ fn DifferentScopes() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: %DifferentScopes.decl: %DifferentScopes.type = fn_decl @DifferentScopes [concrete = constants.%DifferentScopes] { // CHECK:STDOUT: %return.param_patt: %pattern_type.d94 = out_param_pattern [concrete = constants.%return.param_patt.299] -// CHECK:STDOUT: %return.patt: %pattern_type.d94 = return_slot_pattern %return.param_patt, %i32.loc26 [concrete = constants.%return.patt.6fa] +// CHECK:STDOUT: %return.patt: %pattern_type.d94 = return_slot_pattern %return.param_patt, %i32.loc35 [concrete = constants.%return.patt.6fa] // CHECK:STDOUT: } { -// CHECK:STDOUT: %i32.loc26: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %.loc26: Core.Form = init_form %i32.loc26 [concrete = constants.%.0b3] +// CHECK:STDOUT: %i32.loc35: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc35: Core.Form = init_form %i32.loc35 [concrete = constants.%.0b3] // CHECK:STDOUT: %return.param: ref %i32 = out_param call_param0 // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param // CHECK:STDOUT: } @@ -164,25 +182,25 @@ fn DifferentScopes() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: %w.var: ref %i32 = var_storage %w.var_patt // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %impl.elem0.loc21: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc21_14.1: = bound_method %int_1, %impl.elem0.loc21 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282] -// CHECK:STDOUT: %specific_fn.loc21: = specific_function %impl.elem0.loc21, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc21_14.2: = bound_method %int_1, %specific_fn.loc21 [concrete = constants.%bound_method.3bd] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc21: init %i32 = call %bound_method.loc21_14.2(%int_1) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc21_14.1: init %i32 = converted %int_1, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc21 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: assign %w.var, %.loc21_14.1 -// CHECK:STDOUT: %i32.loc21: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %impl.elem0.loc30: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc30_14.1: = bound_method %int_1, %impl.elem0.loc30 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282] +// CHECK:STDOUT: %specific_fn.loc30: = specific_function %impl.elem0.loc30, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc30_14.2: = bound_method %int_1, %specific_fn.loc30 [concrete = constants.%bound_method.3bd] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc30: init %i32 = call %bound_method.loc30_14.2(%int_1) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc30_14.1: init %i32 = converted %int_1, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc30 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: assign %w.var, %.loc30_14.1 +// CHECK:STDOUT: %i32.loc30: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %w: ref %i32 = wrapper_binding w, %w.var // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %w.patt: %pattern_type.d94 = ref_binding_pattern w [concrete = constants.%w.patt.26cad8.1] // CHECK:STDOUT: %w.var_patt: %pattern_type.d94 = var_pattern %w.patt [concrete = constants.%w.var_patt.4a607a.1] // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.facet.loc21_14.1: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc21_14.2: %Destroy.type = converted constants.%i32, %Destroy.facet.loc21_14.1 [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %Destroy.facet.loc21_14.2: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc21_14.3: %Destroy.type = converted constants.%i32, %Destroy.facet.loc21_14.2 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %Destroy.facet.loc30_14.1: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc30_14.2: %Destroy.type = converted constants.%i32, %Destroy.facet.loc30_14.1 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %Destroy.facet.loc30_14.2: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc30_14.3: %Destroy.type = converted constants.%i32, %Destroy.facet.loc30_14.2 [concrete = constants.%Destroy.facet] // CHECK:STDOUT: %SelfDestruct.specific_fn.1: = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet) [concrete = constants.%SelfDestruct.specific_fn] -// CHECK:STDOUT: %SelfDestruct.call.loc21: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%w.var) +// CHECK:STDOUT: %SelfDestruct.call.loc30: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%w.var) // CHECK:STDOUT: %Destroy.facet.loc17_14.1: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] // CHECK:STDOUT: %.loc17_14.2: %Destroy.type = converted constants.%i32, %Destroy.facet.loc17_14.1 [concrete = constants.%Destroy.facet] // CHECK:STDOUT: %Destroy.facet.loc17_14.2: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] @@ -192,83 +210,83 @@ fn DifferentScopes() -> i32 { // CHECK:STDOUT: br !if.else // CHECK:STDOUT: // CHECK:STDOUT: !if.else: -// CHECK:STDOUT: %int_0.loc23: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] -// CHECK:STDOUT: %impl.elem0.loc23: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc23_11.1: = bound_method %int_0.loc23, %impl.elem0.loc23 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.762] -// CHECK:STDOUT: %specific_fn.loc23: = specific_function %impl.elem0.loc23, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc23_11.2: = bound_method %int_0.loc23, %specific_fn.loc23 [concrete = constants.%bound_method.036] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc23: init %i32 = call %bound_method.loc23_11.2(%int_0.loc23) [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc23: init %i32 = converted %int_0.loc23, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc23 [concrete = constants.%int_0.753] -// CHECK:STDOUT: return %.loc23 +// CHECK:STDOUT: %int_0.loc32: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] +// CHECK:STDOUT: %impl.elem0.loc32: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc32_11.1: = bound_method %int_0.loc32, %impl.elem0.loc32 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.762] +// CHECK:STDOUT: %specific_fn.loc32: = specific_function %impl.elem0.loc32, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc32_11.2: = bound_method %int_0.loc32, %specific_fn.loc32 [concrete = constants.%bound_method.036] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc32: init %i32 = call %bound_method.loc32_11.2(%int_0.loc32) [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc32: init %i32 = converted %int_0.loc32, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc32 [concrete = constants.%int_0.753] +// CHECK:STDOUT: return %.loc32 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc21(%self.param: ref %i32) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc30(%self.param: ref %i32) = "no_op"; // CHECK:STDOUT: // CHECK:STDOUT: fn @DifferentScopes() -> out %return.param: %i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %true.loc27: bool = bool_literal true [concrete = constants.%true] -// CHECK:STDOUT: if %true.loc27 br !if.then.loc27 else br !if.else.loc27 +// CHECK:STDOUT: %true.loc36: bool = bool_literal true [concrete = constants.%true] +// CHECK:STDOUT: if %true.loc36 br !if.then.loc36 else br !if.else.loc36 // CHECK:STDOUT: -// CHECK:STDOUT: !if.then.loc27: +// CHECK:STDOUT: !if.then.loc36: // CHECK:STDOUT: %v.var: ref %i32 = var_storage %v.var_patt -// CHECK:STDOUT: %int_0.loc28: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] -// CHECK:STDOUT: %impl.elem0.loc28: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc28_14.1: = bound_method %int_0.loc28, %impl.elem0.loc28 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.762] -// CHECK:STDOUT: %specific_fn.loc28: = specific_function %impl.elem0.loc28, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc28_14.2: = bound_method %int_0.loc28, %specific_fn.loc28 [concrete = constants.%bound_method.036] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc28: init %i32 = call %bound_method.loc28_14.2(%int_0.loc28) [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc28_14.1: init %i32 = converted %int_0.loc28, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc28 [concrete = constants.%int_0.753] -// CHECK:STDOUT: assign %v.var, %.loc28_14.1 -// CHECK:STDOUT: %i32.loc28: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %int_0.loc37: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] +// CHECK:STDOUT: %impl.elem0.loc37: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc37_14.1: = bound_method %int_0.loc37, %impl.elem0.loc37 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.762] +// CHECK:STDOUT: %specific_fn.loc37: = specific_function %impl.elem0.loc37, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc37_14.2: = bound_method %int_0.loc37, %specific_fn.loc37 [concrete = constants.%bound_method.036] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc37: init %i32 = call %bound_method.loc37_14.2(%int_0.loc37) [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc37_14.1: init %i32 = converted %int_0.loc37, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc37 [concrete = constants.%int_0.753] +// CHECK:STDOUT: assign %v.var, %.loc37_14.1 +// CHECK:STDOUT: %i32.loc37: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %v: ref %i32 = wrapper_binding v, %v.var // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %v.patt: %pattern_type.d94 = ref_binding_pattern v [concrete = constants.%v.patt] // CHECK:STDOUT: %v.var_patt: %pattern_type.d94 = var_pattern %v.patt [concrete = constants.%v.var_patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %true.loc29: bool = bool_literal true [concrete = constants.%true] -// CHECK:STDOUT: if %true.loc29 br !if.then.loc29 else br !if.else.loc29 +// CHECK:STDOUT: %true.loc38: bool = bool_literal true [concrete = constants.%true] +// CHECK:STDOUT: if %true.loc38 br !if.then.loc38 else br !if.else.loc38 // CHECK:STDOUT: -// CHECK:STDOUT: !if.then.loc29: +// CHECK:STDOUT: !if.then.loc38: // CHECK:STDOUT: %w.var: ref %i32 = var_storage %w.var_patt // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %impl.elem0.loc33: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc33_16.1: = bound_method %int_1, %impl.elem0.loc33 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282] -// CHECK:STDOUT: %specific_fn.loc33: = specific_function %impl.elem0.loc33, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc33_16.2: = bound_method %int_1, %specific_fn.loc33 [concrete = constants.%bound_method.3bd] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc33: init %i32 = call %bound_method.loc33_16.2(%int_1) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc33_16.1: init %i32 = converted %int_1, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc33 [concrete = constants.%int_1.68a] -// CHECK:STDOUT: assign %w.var, %.loc33_16.1 -// CHECK:STDOUT: %i32.loc33: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %impl.elem0.loc51: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc51_16.1: = bound_method %int_1, %impl.elem0.loc51 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282] +// CHECK:STDOUT: %specific_fn.loc51: = specific_function %impl.elem0.loc51, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc51_16.2: = bound_method %int_1, %specific_fn.loc51 [concrete = constants.%bound_method.3bd] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc51: init %i32 = call %bound_method.loc51_16.2(%int_1) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc51_16.1: init %i32 = converted %int_1, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc51 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: assign %w.var, %.loc51_16.1 +// CHECK:STDOUT: %i32.loc51: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %w: ref %i32 = wrapper_binding w, %w.var // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %w.patt: %pattern_type.d94 = ref_binding_pattern w [concrete = constants.%w.patt.26cad8.2] // CHECK:STDOUT: %w.var_patt: %pattern_type.d94 = var_pattern %w.patt [concrete = constants.%w.var_patt.4a607a.2] // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.facet.loc33_16.1: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc33_16.2: %Destroy.type = converted constants.%i32, %Destroy.facet.loc33_16.1 [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %Destroy.facet.loc33_16.2: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc33_16.3: %Destroy.type = converted constants.%i32, %Destroy.facet.loc33_16.2 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %Destroy.facet.loc51_16.1: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc51_16.2: %Destroy.type = converted constants.%i32, %Destroy.facet.loc51_16.1 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %Destroy.facet.loc51_16.2: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc51_16.3: %Destroy.type = converted constants.%i32, %Destroy.facet.loc51_16.2 [concrete = constants.%Destroy.facet] // CHECK:STDOUT: %SelfDestruct.specific_fn.1: = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet) [concrete = constants.%SelfDestruct.specific_fn] -// CHECK:STDOUT: %SelfDestruct.call.loc33: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%w.var) -// CHECK:STDOUT: br !if.else.loc29 +// CHECK:STDOUT: %SelfDestruct.call.loc51: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%w.var) +// CHECK:STDOUT: br !if.else.loc38 // CHECK:STDOUT: -// CHECK:STDOUT: !if.else.loc29: -// CHECK:STDOUT: %Destroy.facet.loc28_14.1: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc28_14.2: %Destroy.type = converted constants.%i32, %Destroy.facet.loc28_14.1 [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %Destroy.facet.loc28_14.2: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc28_14.3: %Destroy.type = converted constants.%i32, %Destroy.facet.loc28_14.2 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: !if.else.loc38: +// CHECK:STDOUT: %Destroy.facet.loc37_14.1: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc37_14.2: %Destroy.type = converted constants.%i32, %Destroy.facet.loc37_14.1 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %Destroy.facet.loc37_14.2: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc37_14.3: %Destroy.type = converted constants.%i32, %Destroy.facet.loc37_14.2 [concrete = constants.%Destroy.facet] // CHECK:STDOUT: %SelfDestruct.specific_fn.2: = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet) [concrete = constants.%SelfDestruct.specific_fn] -// CHECK:STDOUT: %SelfDestruct.call.loc28: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%v.var) -// CHECK:STDOUT: br !if.else.loc27 +// CHECK:STDOUT: %SelfDestruct.call.loc37: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%v.var) +// CHECK:STDOUT: br !if.else.loc36 // CHECK:STDOUT: -// CHECK:STDOUT: !if.else.loc27: -// CHECK:STDOUT: %int_0.loc36: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] -// CHECK:STDOUT: %impl.elem0.loc36: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc36_11.1: = bound_method %int_0.loc36, %impl.elem0.loc36 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.762] -// CHECK:STDOUT: %specific_fn.loc36: = specific_function %impl.elem0.loc36, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc36_11.2: = bound_method %int_0.loc36, %specific_fn.loc36 [concrete = constants.%bound_method.036] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc36: init %i32 = call %bound_method.loc36_11.2(%int_0.loc36) [concrete = constants.%int_0.753] -// CHECK:STDOUT: %.loc36: init %i32 = converted %int_0.loc36, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc36 [concrete = constants.%int_0.753] -// CHECK:STDOUT: return %.loc36 +// CHECK:STDOUT: !if.else.loc36: +// CHECK:STDOUT: %int_0.loc54: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] +// CHECK:STDOUT: %impl.elem0.loc54: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] +// CHECK:STDOUT: %bound_method.loc54_11.1: = bound_method %int_0.loc54, %impl.elem0.loc54 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.762] +// CHECK:STDOUT: %specific_fn.loc54: = specific_function %impl.elem0.loc54, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc54_11.2: = bound_method %int_0.loc54, %specific_fn.loc54 [concrete = constants.%bound_method.036] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc54: init %i32 = call %bound_method.loc54_11.2(%int_0.loc54) [concrete = constants.%int_0.753] +// CHECK:STDOUT: %.loc54: init %i32 = converted %int_0.loc54, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc54 [concrete = constants.%int_0.753] +// CHECK:STDOUT: return %.loc54 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/fail_returned_var_type.carbon b/toolchain/check/testdata/return/fail_returned_var_type.carbon index ba79dbf98861..307015c5d043 100644 --- a/toolchain/check/testdata/return/fail_returned_var_type.carbon +++ b/toolchain/check/testdata/return/fail_returned_var_type.carbon @@ -13,8 +13,17 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/fail_returned_var_type.carbon fn Mismatch() -> i32 { - // CHECK:STDERR: fail_returned_var_type.carbon:[[@LINE+3]]:19-21: error: type `f64` of `returned var` does not match return type of enclosing function [ReturnedVarWrongType] - // CHECK:STDERR: fail_returned_var_type.carbon:[[@LINE-2]]:18-20: note: return type of function is `i32` [ReturnTypeHereNote] + // CHECK:STDERR: ╭─┤ fail_returned_var_type.carbon:[[@LINE+12]]:19 + // CHECK:STDERR: │ fn Mismatch() -> i32 { + // CHECK:STDERR: · ─┬─ + // CHECK:STDERR: · ╰──┤ return type of function is `i32` [ReturnTypeHereNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ returned var v: f64 = 0.0; + // CHECK:STDERR: · ┳━━ + // CHECK:STDERR: · ┗━━┫ error: type `f64` of `returned var` does not match return + // CHECK:STDERR: · ┃ type of enclosing function + // CHECK:STDERR: · ┃ [ReturnedVarWrongType] + // CHECK:STDERR: ╰──── // CHECK:STDERR: returned var v: f64 = 0.0; return var; @@ -66,7 +75,7 @@ fn Mismatch() -> i32 { // CHECK:STDOUT: %T.09f: %SubobjectDestroy.type = symbolic_binding T, 0 [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.type.dea: type = fn_type @T.as_type.as.DestroyImpl.impl.Op, @T.as_type.as.DestroyImpl.impl(%T.09f) [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.6e5: %T.as_type.as.DestroyImpl.impl.Op.type.dea = struct_value () [symbolic] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.687: type = fn_type @SubobjectDestroy.WithSelf.Op.loc19 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.687: type = fn_type @SubobjectDestroy.WithSelf.Op.loc28 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f: %SubobjectDestroy.WithSelf.Op.type.687 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f), @SubobjectDestroy [concrete] // CHECK:STDOUT: %SubobjectDestroy.facet.47f: %SubobjectDestroy.type = facet_value %f64.761, (%custom_witness.b80) [concrete] @@ -116,27 +125,27 @@ fn Mismatch() -> i32 { // CHECK:STDOUT: %v.var: ref %f64.761 = var_storage %v.var_patt // CHECK:STDOUT: %float: Core.FloatLiteral = float_literal_value 0e-1 [concrete = constants.%float.1f7] // CHECK:STDOUT: %impl.elem0: %.b5b = impl_witness_access constants.%ImplicitAs.impl_witness.1d6, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.9d0] -// CHECK:STDOUT: %bound_method.loc19_12.1: = bound_method %float, %impl.elem0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %bound_method.loc28_12.1: = bound_method %float, %impl.elem0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound] // CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc19_12.2: = bound_method %float, %specific_fn [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call: init %f64.761 = call %bound_method.loc19_12.2(%float) [concrete = constants.%float.73e] -// CHECK:STDOUT: %.loc19_12.1: init %f64.761 = converted %float, %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%float.73e] -// CHECK:STDOUT: assign %v.var, %.loc19_12.1 +// CHECK:STDOUT: %bound_method.loc28_12.2: = bound_method %float, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call: init %f64.761 = call %bound_method.loc28_12.2(%float) [concrete = constants.%float.73e] +// CHECK:STDOUT: %.loc28_12.1: init %f64.761 = converted %float, %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%float.73e] +// CHECK:STDOUT: assign %v.var, %.loc28_12.1 // CHECK:STDOUT: %f64: type = type_literal constants.%f64.761 [concrete = constants.%f64.761] // CHECK:STDOUT: %v: ref %f64.761 = wrapper_binding v, %v.var // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %v.patt: %pattern_type.667 = ref_binding_pattern v [concrete = constants.%v.patt] // CHECK:STDOUT: %v.var_patt: %pattern_type.667 = var_pattern %v.patt [concrete = constants.%v.var_patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc19_17: %f64.761 = acquire_value %v -// CHECK:STDOUT: %Destroy.facet.loc19_12.1: %Destroy.type = facet_value constants.%f64.761, (constants.%DestroyImpl.impl_witness.a23, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc19_12.2: %Destroy.type = converted constants.%f64.761, %Destroy.facet.loc19_12.1 [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %Destroy.facet.loc19_12.2: %Destroy.type = facet_value constants.%f64.761, (constants.%DestroyImpl.impl_witness.a23, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc19_12.3: %Destroy.type = converted constants.%f64.761, %Destroy.facet.loc19_12.2 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc28_17: %f64.761 = acquire_value %v +// CHECK:STDOUT: %Destroy.facet.loc28_12.1: %Destroy.type = facet_value constants.%f64.761, (constants.%DestroyImpl.impl_witness.a23, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc28_12.2: %Destroy.type = converted constants.%f64.761, %Destroy.facet.loc28_12.1 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %Destroy.facet.loc28_12.2: %Destroy.type = facet_value constants.%f64.761, (constants.%DestroyImpl.impl_witness.a23, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc28_12.3: %Destroy.type = converted constants.%f64.761, %Destroy.facet.loc28_12.2 [concrete = constants.%Destroy.facet] // CHECK:STDOUT: %SelfDestruct.specific_fn: = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet) [concrete = constants.%SelfDestruct.specific_fn] // CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%v.var) -// CHECK:STDOUT: return %.loc19_17 +// CHECK:STDOUT: return %.loc28_17 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc19(%self.param: ref %f64.761) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc28(%self.param: ref %f64.761) = "no_op"; // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/fail_type_mismatch.carbon b/toolchain/check/testdata/return/fail_type_mismatch.carbon index d326acf2410e..30fbce9012fe 100644 --- a/toolchain/check/testdata/return/fail_type_mismatch.carbon +++ b/toolchain/check/testdata/return/fail_type_mismatch.carbon @@ -13,8 +13,16 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/fail_type_mismatch.carbon fn Main() -> i32 { - // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+3]]:3-13: error: cannot implicitly convert expression of type `Core.FloatLiteral` to `i32` [ConversionFailure] - // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+2]]:3-13: note: type `Core.FloatLiteral` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_type_mismatch.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: -> │ return 1.0; + // CHECK:STDERR: · ┳━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `Core.FloatLiteral` + // CHECK:STDERR: · │ ┃ to `i32` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `Core.FloatLiteral` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(i32)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return 1.0; } @@ -69,7 +77,7 @@ fn Main() -> i32 { // CHECK:STDOUT: fn @Main() -> out %return.param: %i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %float: Core.FloatLiteral = float_literal_value 10e-1 [concrete = constants.%float] -// CHECK:STDOUT: %.loc19: %i32 = converted %float, [concrete = ] +// CHECK:STDOUT: %.loc27: %i32 = converted %float, [concrete = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/fail_value_disallowed.carbon b/toolchain/check/testdata/return/fail_value_disallowed.carbon index 21a7a11b5e34..07695023a2d4 100644 --- a/toolchain/check/testdata/return/fail_value_disallowed.carbon +++ b/toolchain/check/testdata/return/fail_value_disallowed.carbon @@ -13,8 +13,16 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/fail_value_disallowed.carbon fn Main() { - // CHECK:STDERR: fail_value_disallowed.carbon:[[@LINE+3]]:3-11: error: no return expression should be provided in this context [ReturnStatementDisallowExpr] - // CHECK:STDERR: fail_value_disallowed.carbon:[[@LINE-2]]:1-11: note: there was no return type provided [ReturnTypeOmittedNote] + // CHECK:STDERR: ╭─┤ fail_value_disallowed.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ fn Main() { + // CHECK:STDERR: · ─────┬───── + // CHECK:STDERR: · ╰──┤ there was no return type provided [ReturnTypeOmittedNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ return 0; + // CHECK:STDERR: · ━━━━┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: no return expression should be provided in this context + // CHECK:STDERR: · ┃ [ReturnStatementDisallowExpr] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return 0; } diff --git a/toolchain/check/testdata/return/fail_value_missing.carbon b/toolchain/check/testdata/return/fail_value_missing.carbon index 329c035289b2..1402d03e6449 100644 --- a/toolchain/check/testdata/return/fail_value_missing.carbon +++ b/toolchain/check/testdata/return/fail_value_missing.carbon @@ -13,8 +13,15 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/fail_value_missing.carbon fn Main() -> i32 { - // CHECK:STDERR: fail_value_missing.carbon:[[@LINE+3]]:3-9: error: missing return value [ReturnStatementMissingExpr] - // CHECK:STDERR: fail_value_missing.carbon:[[@LINE-2]]:14-16: note: return type of function is `i32` [ReturnTypeHereNote] + // CHECK:STDERR: ╭─┤ fail_value_missing.carbon:[[@LINE+10]]:3 + // CHECK:STDERR: │ fn Main() -> i32 { + // CHECK:STDERR: · ─┬─ + // CHECK:STDERR: · ╰──┤ return type of function is `i32` [ReturnTypeHereNote] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ return; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: missing return value [ReturnStatementMissingExpr] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return; } diff --git a/toolchain/check/testdata/return/fail_var_in_type.carbon b/toolchain/check/testdata/return/fail_var_in_type.carbon index 629f5228b27c..fb2b3a507d82 100644 --- a/toolchain/check/testdata/return/fail_var_in_type.carbon +++ b/toolchain/check/testdata/return/fail_var_in_type.carbon @@ -13,7 +13,12 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/fail_var_in_type.carbon var x: type = i32; -// CHECK:STDERR: fail_var_in_type.carbon:[[@LINE+2]]:13: error: cannot evaluate type expression [TypeExprEvaluationFailure] +// CHECK:STDERR: ╭─┤ fail_var_in_type.carbon:[[@LINE+7]]:13 +// CHECK:STDERR: -> │ fn Six() -> x { return 6; } +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: cannot evaluate type expression +// CHECK:STDERR: · ┃ [TypeExprEvaluationFailure] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Six() -> x { return 6; } @@ -72,7 +77,7 @@ fn Six() -> x { return 6; } // CHECK:STDOUT: %return.patt: = return_slot_pattern , [concrete = ] // CHECK:STDOUT: } { // CHECK:STDOUT: %x.ref: ref type = name_ref x, file.%x [concrete = file.%x.var] -// CHECK:STDOUT: %.loc18: type = acquire_value %x.ref +// CHECK:STDOUT: %.loc23: type = acquire_value %x.ref // CHECK:STDOUT: %return: = return_slot // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/struct/fail_access_into_invalid.carbon b/toolchain/check/testdata/struct/fail_access_into_invalid.carbon index b398c015e567..bd7d57c4b838 100644 --- a/toolchain/check/testdata/struct/fail_access_into_invalid.carbon +++ b/toolchain/check/testdata/struct/fail_access_into_invalid.carbon @@ -13,7 +13,11 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/fail_access_into_invalid.carbon -// CHECK:STDERR: fail_access_into_invalid.carbon:[[@LINE+2]]:10: error: name `a` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_access_into_invalid.carbon:[[@LINE+6]]:10 +// CHECK:STDERR: -> │ fn F() { a.b; } +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: name `a` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F() { a.b; } diff --git a/toolchain/check/testdata/struct/fail_assign_empty.carbon b/toolchain/check/testdata/struct/fail_assign_empty.carbon index 3319fe8cf076..4a6919d80ad2 100644 --- a/toolchain/check/testdata/struct/fail_assign_empty.carbon +++ b/toolchain/check/testdata/struct/fail_assign_empty.carbon @@ -12,7 +12,13 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/fail_assign_empty.carbon -// CHECK:STDERR: fail_assign_empty.carbon:[[@LINE+2]]:20-21: error: missing value for field `a` in struct initialization [StructInitMissingFieldInLiteral] +// CHECK:STDERR: ╭─┤ fail_assign_empty.carbon:[[@LINE+8]]:20 +// CHECK:STDERR: -> │ var x: {.a: i32} = {}; +// CHECK:STDERR: · ┳━ +// CHECK:STDERR: · ┗━━┫ error: missing value for field `a` in struct +// CHECK:STDERR: · ┃ initialization +// CHECK:STDERR: · ┃ [StructInitMissingFieldInLiteral] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: {.a: i32} = {}; @@ -48,7 +54,7 @@ var x: {.a: i32} = {}; // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %x.var: ref %struct_type.a = var_storage %x.var_patt [concrete] -// CHECK:STDOUT: %.loc17: type = splice_block %struct_type.a [concrete = constants.%struct_type.a] { +// CHECK:STDOUT: %.loc23: type = splice_block %struct_type.a [concrete = constants.%struct_type.a] { // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %i32} [concrete = constants.%struct_type.a] // CHECK:STDOUT: } @@ -61,7 +67,7 @@ var x: {.a: i32} = {}; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc17: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc23: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/struct/fail_assign_nested.carbon b/toolchain/check/testdata/struct/fail_assign_nested.carbon index e53cbb29757c..64e958f357f5 100644 --- a/toolchain/check/testdata/struct/fail_assign_nested.carbon +++ b/toolchain/check/testdata/struct/fail_assign_nested.carbon @@ -12,7 +12,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/fail_assign_nested.carbon -// CHECK:STDERR: fail_assign_nested.carbon:[[@LINE+2]]:19-27: error: struct `{.a: {}}` has no field named `b` [StructInitUnexpectedFieldInLiteral] +// CHECK:STDERR: ╭─┤ fail_assign_nested.carbon:[[@LINE+7]]:19 +// CHECK:STDERR: -> │ var x: {.a: {}} = {.b = {}}; +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: struct `{.a: {}}` has no field named `b` +// CHECK:STDERR: · ┃ [StructInitUnexpectedFieldInLiteral] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: {.a: {}} = {.b = {}}; @@ -35,9 +40,9 @@ var x: {.a: {}} = {.b = {}}; // CHECK:STDOUT: .x = %x // CHECK:STDOUT: } // CHECK:STDOUT: %x.var: ref %struct_type.a.225 = var_storage %x.var_patt [concrete] -// CHECK:STDOUT: %.loc17_15: type = splice_block %struct_type.a [concrete = constants.%struct_type.a.225] { -// CHECK:STDOUT: %.loc17_14.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc17_14.2: type = converted %.loc17_14.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc22_15: type = splice_block %struct_type.a [concrete = constants.%struct_type.a.225] { +// CHECK:STDOUT: %.loc22_14.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc22_14.2: type = converted %.loc22_14.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %empty_struct_type} [concrete = constants.%struct_type.a.225] // CHECK:STDOUT: } // CHECK:STDOUT: %x: ref %struct_type.a.225 = wrapper_binding x, %x.var [concrete = %x.var] @@ -49,8 +54,8 @@ var x: {.a: {}} = {.b = {}}; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc17_26: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc17_27: %struct_type.b.347 = struct_literal (%.loc17_26) [concrete = constants.%struct] +// CHECK:STDOUT: %.loc22_26: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc22_27: %struct_type.b.347 = struct_literal (%.loc22_26) [concrete = constants.%struct] // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/struct/fail_assign_to_empty.carbon b/toolchain/check/testdata/struct/fail_assign_to_empty.carbon index 28f46ea26190..f87e60b1a1a3 100644 --- a/toolchain/check/testdata/struct/fail_assign_to_empty.carbon +++ b/toolchain/check/testdata/struct/fail_assign_to_empty.carbon @@ -12,7 +12,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/fail_assign_to_empty.carbon -// CHECK:STDERR: fail_assign_to_empty.carbon:[[@LINE+2]]:13-20: error: struct `{}` has no field named `a` [StructInitUnexpectedFieldInLiteral] +// CHECK:STDERR: ╭─┤ fail_assign_to_empty.carbon:[[@LINE+7]]:13 +// CHECK:STDERR: -> │ var x: {} = {.a = 1}; +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: struct `{}` has no field named `a` +// CHECK:STDERR: · ┃ [StructInitUnexpectedFieldInLiteral] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: {} = {.a = 1}; @@ -44,9 +49,9 @@ var x: {} = {.a = 1}; // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %x.var: ref %empty_struct_type = var_storage %x.var_patt [concrete] -// CHECK:STDOUT: %.loc17_9.1: type = splice_block %.loc17_9.3 [concrete = constants.%empty_struct_type] { -// CHECK:STDOUT: %.loc17_9.2: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc17_9.3: type = converted %.loc17_9.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc22_9.1: type = splice_block %.loc22_9.3 [concrete = constants.%empty_struct_type] { +// CHECK:STDOUT: %.loc22_9.2: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc22_9.3: type = converted %.loc22_9.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: } // CHECK:STDOUT: %x: ref %empty_struct_type = wrapper_binding x, %x.var [concrete = %x.var] // CHECK:STDOUT: name_binding_decl { @@ -58,7 +63,7 @@ var x: {} = {.a = 1}; // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] -// CHECK:STDOUT: %.loc17: %struct_type.a = struct_literal (%int_1) [concrete = constants.%struct] +// CHECK:STDOUT: %.loc22: %struct_type.a = struct_literal (%int_1) [concrete = constants.%struct] // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/struct/fail_duplicate_name.carbon b/toolchain/check/testdata/struct/fail_duplicate_name.carbon index 90f2c69b91a7..6b4e59ad5171 100644 --- a/toolchain/check/testdata/struct/fail_duplicate_name.carbon +++ b/toolchain/check/testdata/struct/fail_duplicate_name.carbon @@ -12,28 +12,61 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/fail_duplicate_name.carbon -// CHECK:STDERR: fail_duplicate_name.carbon:[[@LINE+3]]:42-44: error: duplicated field name `abc` in struct type literal [StructNameDuplicate] -// CHECK:STDERR: fail_duplicate_name.carbon:[[@LINE+2]]:22-24: note: field with the same name here [StructNamePrevious] +// CHECK:STDERR: ╭─┤ fail_duplicate_name.carbon:[[@LINE+10]]:42 +// CHECK:STDERR: -> │ fn F() -> {.d: i32, .abc: i32, .e: i32, .abc: i32, .f: i32}; +// CHECK:STDERR: · ─┬─ ┳━━ +// CHECK:STDERR: · │ ┗━━┫ error: duplicated field name `abc` +// CHECK:STDERR: · │ ┃ in struct type literal +// CHECK:STDERR: · │ ┃ [StructNameDuplicate] +// CHECK:STDERR: · ╰───────────────────────┤ field with the same name here +// CHECK:STDERR: · │ [StructNamePrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F() -> {.d: i32, .abc: i32, .e: i32, .abc: i32, .f: i32}; -// CHECK:STDERR: fail_duplicate_name.carbon:[[@LINE+3]]:19: error: duplicated field name `a` in struct type literal [StructNameDuplicate] -// CHECK:STDERR: fail_duplicate_name.carbon:[[@LINE+2]]:10: note: field with the same name here [StructNamePrevious] +// CHECK:STDERR: ╭─┤ fail_duplicate_name.carbon:[[@LINE+8]]:19 +// CHECK:STDERR: -> │ let v: {.a: i32, .a: i32} = {.a = 1}; +// CHECK:STDERR: · ┬ ┳ +// CHECK:STDERR: · │ ┗━━┫ error: duplicated field name `a` in struct type literal +// CHECK:STDERR: · │ ┃ [StructNameDuplicate] +// CHECK:STDERR: · ╰─────────────┤ field with the same name here [StructNamePrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let v: {.a: i32, .a: i32} = {.a = 1}; -// CHECK:STDERR: fail_duplicate_name.carbon:[[@LINE+3]]:26-28: error: duplicated field name `def` in struct literal [StructNameDuplicate] -// CHECK:STDERR: fail_duplicate_name.carbon:[[@LINE+2]]:16-18: note: field with the same name here [StructNamePrevious] +// CHECK:STDERR: ╭─┤ fail_duplicate_name.carbon:[[@LINE+10]]:26 +// CHECK:STDERR: -> │ let w: i32 = {.def = 1, .def = 2}.def; +// CHECK:STDERR: · ─┬─ ┳━━ +// CHECK:STDERR: · │ ┗━━┫ error: duplicated field name `def` in struct +// CHECK:STDERR: · │ ┃ literal +// CHECK:STDERR: · │ ┃ [StructNameDuplicate] +// CHECK:STDERR: · ╰─────────────┤ field with the same name here +// CHECK:STDERR: · │ [StructNamePrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let w: i32 = {.def = 1, .def = 2}.def; -// CHECK:STDERR: fail_duplicate_name.carbon:[[@LINE+3]]:30: error: duplicated field name `a` in struct literal [StructNameDuplicate] -// CHECK:STDERR: fail_duplicate_name.carbon:[[@LINE+2]]:22: note: field with the same name here [StructNamePrevious] +// CHECK:STDERR: ╭─┤ fail_duplicate_name.carbon:[[@LINE+10]]:30 +// CHECK:STDERR: -> │ var x: {.a: i32} = {.a = 1, .a = 2}; +// CHECK:STDERR: · ┬ ┳ +// CHECK:STDERR: · │ ┗━━┫ error: duplicated field name `a` in struct +// CHECK:STDERR: · │ ┃ literal +// CHECK:STDERR: · │ ┃ [StructNameDuplicate] +// CHECK:STDERR: · ╰────────────┤ field with the same name here +// CHECK:STDERR: · │ [StructNamePrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: {.a: i32} = {.a = 1, .a = 2}; -// CHECK:STDERR: fail_duplicate_name.carbon:[[@LINE+3]]:39: error: duplicated field name `b` in struct literal [StructNameDuplicate] -// CHECK:STDERR: fail_duplicate_name.carbon:[[@LINE+2]]:31: note: field with the same name here [StructNamePrevious] +// CHECK:STDERR: ╭─┤ fail_duplicate_name.carbon:[[@LINE+10]]:39 +// CHECK:STDERR: -> │ var y: {.b: i32, .c: i32} = {.b = 3, .b = 4}; +// CHECK:STDERR: · ┬ ┳ +// CHECK:STDERR: · │ ┗━━┫ error: duplicated field name `b` in +// CHECK:STDERR: · │ ┃ struct literal +// CHECK:STDERR: · │ ┃ [StructNameDuplicate] +// CHECK:STDERR: · ╰────────────┤ field with the same name here +// CHECK:STDERR: · │ [StructNamePrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var y: {.b: i32, .c: i32} = {.b = 3, .b = 4}; @@ -87,29 +120,29 @@ var y: {.b: i32, .c: i32} = {.b = 3, .b = 4}; // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] { // CHECK:STDOUT: %return.patt: = return_slot_pattern , [concrete = ] // CHECK:STDOUT: } { -// CHECK:STDOUT: %i32.loc18_16: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %i32.loc18_27: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %i32.loc18_36: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %i32.loc18_47: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %i32.loc18_56: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc25_16: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc25_27: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc25_36: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc25_47: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc25_56: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %return: = return_slot // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = splice_block [concrete = ] { -// CHECK:STDOUT: %i32.loc23_13: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %i32.loc23_22: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc35_13: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc35_22: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: } // CHECK:STDOUT: %v: = wrapper_binding v, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %v.patt: = value_binding_pattern v [concrete = ] // CHECK:STDOUT: } -// CHECK:STDOUT: %i32.loc28: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc47: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %w: %i32 = wrapper_binding w, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %w.patt: %pattern_type.d94 = value_binding_pattern w [concrete = constants.%w.patt] // CHECK:STDOUT: } // CHECK:STDOUT: %x.var: ref %struct_type.a.15e = var_storage %x.var_patt [concrete] -// CHECK:STDOUT: %.loc33: type = splice_block %struct_type.a [concrete = constants.%struct_type.a.15e] { -// CHECK:STDOUT: %i32.loc33: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc59: type = splice_block %struct_type.a [concrete = constants.%struct_type.a.15e] { +// CHECK:STDOUT: %i32.loc59: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %i32} [concrete = constants.%struct_type.a.15e] // CHECK:STDOUT: } // CHECK:STDOUT: %x: ref %struct_type.a.15e = wrapper_binding x, %x.var [concrete = %x.var] @@ -118,9 +151,9 @@ var y: {.b: i32, .c: i32} = {.b = 3, .b = 4}; // CHECK:STDOUT: %x.var_patt: %pattern_type.243 = var_pattern %x.patt [concrete = constants.%x.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %y.var: ref %struct_type.b.c = var_storage %y.var_patt [concrete] -// CHECK:STDOUT: %.loc38: type = splice_block %struct_type.b.c [concrete = constants.%struct_type.b.c] { -// CHECK:STDOUT: %i32.loc38_13: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %i32.loc38_22: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc71: type = splice_block %struct_type.b.c [concrete = constants.%struct_type.b.c] { +// CHECK:STDOUT: %i32.loc71_13: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc71_22: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.b.c: type = struct_type {.b: %i32, .c: %i32} [concrete = constants.%struct_type.b.c] // CHECK:STDOUT: } // CHECK:STDOUT: %y: ref %struct_type.b.c = wrapper_binding y, %y.var [concrete = %y.var] @@ -134,13 +167,13 @@ var y: {.b: i32, .c: i32} = {.b = 3, .b = 4}; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %int_1.loc23: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] -// CHECK:STDOUT: %.loc23: %struct_type.a.a6c = struct_literal (%int_1.loc23) [concrete = constants.%struct] -// CHECK:STDOUT: %int_1.loc28: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] -// CHECK:STDOUT: %int_2.loc28: Core.IntLiteral = int_value 2 [concrete = constants.%int_2] +// CHECK:STDOUT: %int_1.loc35: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] +// CHECK:STDOUT: %.loc35: %struct_type.a.a6c = struct_literal (%int_1.loc35) [concrete = constants.%struct] +// CHECK:STDOUT: %int_1.loc47: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] +// CHECK:STDOUT: %int_2.loc47: Core.IntLiteral = int_value 2 [concrete = constants.%int_2] // CHECK:STDOUT: %def.ref: = name_ref def, [concrete = ] -// CHECK:STDOUT: %int_1.loc33: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] -// CHECK:STDOUT: %int_2.loc33: Core.IntLiteral = int_value 2 [concrete = constants.%int_2] +// CHECK:STDOUT: %int_1.loc59: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] +// CHECK:STDOUT: %int_2.loc59: Core.IntLiteral = int_value 2 [concrete = constants.%int_2] // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3] // CHECK:STDOUT: %int_4: Core.IntLiteral = int_value 4 [concrete = constants.%int_4] diff --git a/toolchain/check/testdata/struct/fail_field_name_mismatch.carbon b/toolchain/check/testdata/struct/fail_field_name_mismatch.carbon index 745c5e600218..37cf4e1d20cc 100644 --- a/toolchain/check/testdata/struct/fail_field_name_mismatch.carbon +++ b/toolchain/check/testdata/struct/fail_field_name_mismatch.carbon @@ -13,15 +13,33 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/fail_field_name_mismatch.carbon var a: {.a: i32} = {.a = 1 }; -// CHECK:STDERR: fail_field_name_mismatch.carbon:[[@LINE+2]]:29: error: cannot convert from struct type `{.a: i32}` to `{.a: i32, .b: i32}`: missing field `b` in source type [StructInitMissingFieldInConversion] +// CHECK:STDERR: ╭─┤ fail_field_name_mismatch.carbon:[[@LINE+9]]:29 +// CHECK:STDERR: -> │ var b: {.a: i32, .b: i32} = a; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: cannot convert from struct type +// CHECK:STDERR: · ┃ `{.a: i32}` to `{.a: i32, .b: i32}`: +// CHECK:STDERR: · ┃ missing field `b` in source type +// CHECK:STDERR: · ┃ [StructInitMissingFieldInConversion] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var b: {.a: i32, .b: i32} = a; -// CHECK:STDERR: fail_field_name_mismatch.carbon:[[@LINE+2]]:20-27: error: struct `{.a: i32}` has no field named `b` [StructInitUnexpectedFieldInLiteral] +// CHECK:STDERR: ╭─┤ fail_field_name_mismatch.carbon:[[@LINE+7]]:20 +// CHECK:STDERR: -> │ var x: {.a: i32} = {.b = 1}; +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: struct `{.a: i32}` has no field named `b` +// CHECK:STDERR: · ┃ [StructInitUnexpectedFieldInLiteral] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: {.a: i32} = {.b = 1}; -// CHECK:STDERR: fail_field_name_mismatch.carbon:[[@LINE+2]]:20: error: cannot convert from struct type `{.a: i32}` to `{.b: i32}`: unexpected field `a` in source type [StructInitUnexpectedFieldInConversion] +// CHECK:STDERR: ╭─┤ fail_field_name_mismatch.carbon:[[@LINE+8]]:20 +// CHECK:STDERR: -> │ var y: {.b: i32} = x; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: cannot convert from struct type `{.a: i32}` to +// CHECK:STDERR: · ┃ `{.b: i32}`: unexpected field `a` in source type +// CHECK:STDERR: · ┃ [StructInitUnexpectedFieldInConversion] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var y: {.b: i32} = x; @@ -121,9 +139,9 @@ var y: {.b: i32} = x; // CHECK:STDOUT: %a.var_patt: %pattern_type.243 = var_pattern %a.patt [concrete = constants.%a.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %b.var: ref %struct_type.a.b = var_storage %b.var_patt [concrete] -// CHECK:STDOUT: %.loc18: type = splice_block %struct_type.a.b [concrete = constants.%struct_type.a.b] { -// CHECK:STDOUT: %i32.loc18_13: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %i32.loc18_22: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc25: type = splice_block %struct_type.a.b [concrete = constants.%struct_type.a.b] { +// CHECK:STDOUT: %i32.loc25_13: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc25_22: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.a.b: type = struct_type {.a: %i32, .b: %i32} [concrete = constants.%struct_type.a.b] // CHECK:STDOUT: } // CHECK:STDOUT: %b: ref %struct_type.a.b = wrapper_binding b, %b.var [concrete = %b.var] @@ -132,9 +150,9 @@ var y: {.b: i32} = x; // CHECK:STDOUT: %b.var_patt: %pattern_type.290 = var_pattern %b.patt [concrete = constants.%b.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %x.var: ref %struct_type.a.15e = var_storage %x.var_patt [concrete] -// CHECK:STDOUT: %.loc22: type = splice_block %struct_type.a.loc22 [concrete = constants.%struct_type.a.15e] { -// CHECK:STDOUT: %i32.loc22: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %struct_type.a.loc22: type = struct_type {.a: %i32} [concrete = constants.%struct_type.a.15e] +// CHECK:STDOUT: %.loc34: type = splice_block %struct_type.a.loc34 [concrete = constants.%struct_type.a.15e] { +// CHECK:STDOUT: %i32.loc34: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %struct_type.a.loc34: type = struct_type {.a: %i32} [concrete = constants.%struct_type.a.15e] // CHECK:STDOUT: } // CHECK:STDOUT: %x: ref %struct_type.a.15e = wrapper_binding x, %x.var [concrete = %x.var] // CHECK:STDOUT: name_binding_decl { @@ -142,8 +160,8 @@ var y: {.b: i32} = x; // CHECK:STDOUT: %x.var_patt: %pattern_type.243 = var_pattern %x.patt [concrete = constants.%x.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %y.var: ref %struct_type.b.5bf = var_storage %y.var_patt [concrete] -// CHECK:STDOUT: %.loc26: type = splice_block %struct_type.b [concrete = constants.%struct_type.b.5bf] { -// CHECK:STDOUT: %i32.loc26: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc44: type = splice_block %struct_type.b [concrete = constants.%struct_type.b.5bf] { +// CHECK:STDOUT: %i32.loc44: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.b: type = struct_type {.b: %i32} [concrete = constants.%struct_type.b.5bf] // CHECK:STDOUT: } // CHECK:STDOUT: %y: ref %struct_type.b.5bf = wrapper_binding y, %y.var [concrete = %y.var] @@ -167,18 +185,18 @@ var y: {.b: i32} = x; // CHECK:STDOUT: %.loc15_1: init %struct_type.a.15e = converted %.loc15_28.1, %.loc15_28.3 [concrete = constants.%struct.570] // CHECK:STDOUT: assign file.%a.var, %.loc15_1 // CHECK:STDOUT: %a.ref: ref %struct_type.a.15e = name_ref a, file.%a [concrete = file.%a.var] -// CHECK:STDOUT: %.loc18_29.1: ref %i32 = struct_access %a.ref, element0 [concrete = constants.%.c96] -// CHECK:STDOUT: %.loc18_29.2: %i32 = acquire_value %.loc18_29.1 -// CHECK:STDOUT: %impl.elem0.loc18: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae] -// CHECK:STDOUT: %bound_method.loc18_29.1: = bound_method %.loc18_29.2, %impl.elem0.loc18 -// CHECK:STDOUT: %specific_fn.loc18: = specific_function %impl.elem0.loc18, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] -// CHECK:STDOUT: %bound_method.loc18_29.2: = bound_method %.loc18_29.2, %specific_fn.loc18 -// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc18_29.2(%.loc18_29.2) -// CHECK:STDOUT: %.loc18_29.3: ref %i32 = struct_access file.%b.var, element0 [concrete = constants.%.b5f] -// CHECK:STDOUT: %.loc18_29.4: init %i32 to %.loc18_29.3 = in_place_init %Int.as.Copy.impl.Op.call +// CHECK:STDOUT: %.loc25_29.1: ref %i32 = struct_access %a.ref, element0 [concrete = constants.%.c96] +// CHECK:STDOUT: %.loc25_29.2: %i32 = acquire_value %.loc25_29.1 +// CHECK:STDOUT: %impl.elem0.loc25: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae] +// CHECK:STDOUT: %bound_method.loc25_29.1: = bound_method %.loc25_29.2, %impl.elem0.loc25 +// CHECK:STDOUT: %specific_fn.loc25: = specific_function %impl.elem0.loc25, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc25_29.2: = bound_method %.loc25_29.2, %specific_fn.loc25 +// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc25_29.2(%.loc25_29.2) +// CHECK:STDOUT: %.loc25_29.3: ref %i32 = struct_access file.%b.var, element0 [concrete = constants.%.b5f] +// CHECK:STDOUT: %.loc25_29.4: init %i32 to %.loc25_29.3 = in_place_init %Int.as.Copy.impl.Op.call // CHECK:STDOUT: assign file.%b.var, -// CHECK:STDOUT: %int_1.loc22: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %.loc22: %struct_type.b.a15 = struct_literal (%int_1.loc22) [concrete = constants.%struct.62b] +// CHECK:STDOUT: %int_1.loc34: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %.loc34: %struct_type.b.a15 = struct_literal (%int_1.loc34) [concrete = constants.%struct.62b] // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: %x.ref: ref %struct_type.a.15e = name_ref x, file.%x [concrete = file.%x.var] // CHECK:STDOUT: assign file.%y.var, diff --git a/toolchain/check/testdata/struct/fail_field_type_mismatch.carbon b/toolchain/check/testdata/struct/fail_field_type_mismatch.carbon index 34bbe412927d..6181ed69db0b 100644 --- a/toolchain/check/testdata/struct/fail_field_type_mismatch.carbon +++ b/toolchain/check/testdata/struct/fail_field_type_mismatch.carbon @@ -12,7 +12,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/fail_field_type_mismatch.carbon -// CHECK:STDERR: fail_field_type_mismatch.carbon:[[@LINE+2]]:20-29: error: struct `{.a: i32}` has no field named `b` [StructInitUnexpectedFieldInLiteral] +// CHECK:STDERR: ╭─┤ fail_field_type_mismatch.carbon:[[@LINE+7]]:20 +// CHECK:STDERR: -> │ var x: {.a: i32} = {.b = 1.0}; +// CHECK:STDERR: · ━━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: struct `{.a: i32}` has no field named `b` +// CHECK:STDERR: · ┃ [StructInitUnexpectedFieldInLiteral] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: {.a: i32} = {.b = 1.0}; @@ -49,7 +54,7 @@ var x: {.a: i32} = {.b = 1.0}; // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %x.var: ref %struct_type.a = var_storage %x.var_patt [concrete] -// CHECK:STDOUT: %.loc17: type = splice_block %struct_type.a [concrete = constants.%struct_type.a] { +// CHECK:STDOUT: %.loc22: type = splice_block %struct_type.a [concrete = constants.%struct_type.a] { // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %i32} [concrete = constants.%struct_type.a] // CHECK:STDOUT: } @@ -63,7 +68,7 @@ var x: {.a: i32} = {.b = 1.0}; // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %float: Core.FloatLiteral = float_literal_value 10e-1 [concrete = constants.%float] -// CHECK:STDOUT: %.loc17: %struct_type.b = struct_literal (%float) [concrete = constants.%struct] +// CHECK:STDOUT: %.loc22: %struct_type.b = struct_literal (%float) [concrete = constants.%struct] // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/struct/fail_keyword_name.carbon b/toolchain/check/testdata/struct/fail_keyword_name.carbon index d51d96d256a3..61c7b071d2ed 100644 --- a/toolchain/check/testdata/struct/fail_keyword_name.carbon +++ b/toolchain/check/testdata/struct/fail_keyword_name.carbon @@ -10,14 +10,32 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/fail_keyword_name.carbon -// CHECK:STDERR: fail_keyword_name.carbon:[[@LINE+2]]:13-17: error: expected identifier after `.`; prefix reserved word with `r#` to form a valid identifier [ExpectedIdentifierAfterPeriodOrArrow] +// CHECK:STDERR: ╭─┤ fail_keyword_name.carbon:[[@LINE+8]]:13 +// CHECK:STDERR: -> │ fn F() -> {.class: i32}; +// CHECK:STDERR: · ┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: expected identifier after `.`; prefix reserved word with +// CHECK:STDERR: · ┃ `r#` to form a valid identifier +// CHECK:STDERR: · ┃ [ExpectedIdentifierAfterPeriodOrArrow] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F() -> {.class: i32}; -// CHECK:STDERR: fail_keyword_name.carbon:[[@LINE+2]]:13-18: error: expected identifier after `.`; prefix reserved word with `r#` to form a valid identifier [ExpectedIdentifierAfterPeriodOrArrow] +// CHECK:STDERR: ╭─┤ fail_keyword_name.carbon:[[@LINE+8]]:13 +// CHECK:STDERR: -> │ fn G() -> {.return: i32} { +// CHECK:STDERR: · ┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: expected identifier after `.`; prefix reserved word with +// CHECK:STDERR: · ┃ `r#` to form a valid identifier +// CHECK:STDERR: · ┃ [ExpectedIdentifierAfterPeriodOrArrow] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn G() -> {.return: i32} { - // CHECK:STDERR: fail_keyword_name.carbon:[[@LINE+2]]:12-17: error: expected identifier after `.`; prefix reserved word with `r#` to form a valid identifier [ExpectedIdentifierAfterPeriodOrArrow] + // CHECK:STDERR: ╭─┤ fail_keyword_name.carbon:[[@LINE+8]]:12 + // CHECK:STDERR: -> │ return {.return = 5}; + // CHECK:STDERR: · ┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: expected identifier after `.`; prefix reserved word with + // CHECK:STDERR: · ┃ `r#` to form a valid identifier + // CHECK:STDERR: · ┃ [ExpectedIdentifierAfterPeriodOrArrow] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return {.return = 5}; }; diff --git a/toolchain/check/testdata/struct/fail_member_access_type.carbon b/toolchain/check/testdata/struct/fail_member_access_type.carbon index 300c66d05c4c..ccbab1673044 100644 --- a/toolchain/check/testdata/struct/fail_member_access_type.carbon +++ b/toolchain/check/testdata/struct/fail_member_access_type.carbon @@ -13,7 +13,12 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/fail_member_access_type.carbon var x: {.a: f64} = {.a = 4.0}; -// CHECK:STDERR: fail_member_access_type.carbon:[[@LINE+2]]:14-16: error: type `{.a: f64}` does not have a member `b` [QualifiedExprNameNotFound] +// CHECK:STDERR: ╭─┤ fail_member_access_type.carbon:[[@LINE+7]]:14 +// CHECK:STDERR: -> │ var y: i32 = x.b; +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┗━━┫ error: type `{.a: f64}` does not have a member `b` +// CHECK:STDERR: · ┃ [QualifiedExprNameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var y: i32 = x.b; diff --git a/toolchain/check/testdata/struct/fail_member_of_function.carbon b/toolchain/check/testdata/struct/fail_member_of_function.carbon index e92e39b50fa8..8a3e84dcf453 100644 --- a/toolchain/check/testdata/struct/fail_member_of_function.carbon +++ b/toolchain/check/testdata/struct/fail_member_of_function.carbon @@ -13,7 +13,12 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/fail_member_of_function.carbon fn A() { - // CHECK:STDERR: fail_member_of_function.carbon:[[@LINE+2]]:3-5: error: type `` does not support qualified expressions [QualifiedExprUnsupported] + // CHECK:STDERR: ╭─┤ fail_member_of_function.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ A.y; + // CHECK:STDERR: · ━┳━ + // CHECK:STDERR: · ┗━━┫ error: type `` does not support qualified expressions + // CHECK:STDERR: · ┃ [QualifiedExprUnsupported] + // CHECK:STDERR: ╰──── // CHECK:STDERR: A.y; } diff --git a/toolchain/check/testdata/struct/fail_nested_incomplete.carbon b/toolchain/check/testdata/struct/fail_nested_incomplete.carbon index e520b5fed16f..91e5919271f7 100644 --- a/toolchain/check/testdata/struct/fail_nested_incomplete.carbon +++ b/toolchain/check/testdata/struct/fail_nested_incomplete.carbon @@ -14,8 +14,17 @@ class Incomplete; -// CHECK:STDERR: fail_nested_incomplete.carbon:[[@LINE+3]]:8-23: error: binding pattern has incomplete type `{.a: Incomplete}` in name binding declaration [IncompleteTypeInBindingDecl] -// CHECK:STDERR: fail_nested_incomplete.carbon:[[@LINE-3]]:1-17: note: class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: ╭─┤ fail_nested_incomplete.carbon:[[@LINE+12]]:8 +// CHECK:STDERR: │ class Incomplete; +// CHECK:STDERR: · ────────┬──────── +// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ var s: {.a: Incomplete}; +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: binding pattern has incomplete type `{.a: Incomplete}` in +// CHECK:STDERR: · ┃ name binding declaration +// CHECK:STDERR: · ┃ [IncompleteTypeInBindingDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var s: {.a: Incomplete}; @@ -41,8 +50,8 @@ var p: Incomplete* = &s.a; // CHECK:STDOUT: } // CHECK:STDOUT: %Incomplete.decl: type = class_decl @Incomplete [concrete = constants.%Incomplete] {} {} // CHECK:STDOUT: %s.var: ref = var_storage %s.var_patt [concrete = ] -// CHECK:STDOUT: %.loc20: type = splice_block %struct_type.a [concrete = constants.%struct_type.a] { -// CHECK:STDOUT: %Incomplete.ref.loc20: type = name_ref Incomplete, %Incomplete.decl [concrete = constants.%Incomplete] +// CHECK:STDOUT: %.loc29: type = splice_block %struct_type.a [concrete = constants.%struct_type.a] { +// CHECK:STDOUT: %Incomplete.ref.loc29: type = name_ref Incomplete, %Incomplete.decl [concrete = constants.%Incomplete] // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %Incomplete} [concrete = constants.%struct_type.a] // CHECK:STDOUT: } // CHECK:STDOUT: %s: = wrapper_binding s, [concrete = ] @@ -51,9 +60,9 @@ var p: Incomplete* = &s.a; // CHECK:STDOUT: %s.var_patt: = var_pattern %s.patt [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: %p.var: ref %ptr = var_storage %p.var_patt [concrete] -// CHECK:STDOUT: %.loc22: type = splice_block %ptr [concrete = constants.%ptr] { -// CHECK:STDOUT: %Incomplete.ref.loc22: type = name_ref Incomplete, %Incomplete.decl [concrete = constants.%Incomplete] -// CHECK:STDOUT: %ptr: type = ptr_type %Incomplete.ref.loc22 [concrete = constants.%ptr] +// CHECK:STDOUT: %.loc31: type = splice_block %ptr [concrete = constants.%ptr] { +// CHECK:STDOUT: %Incomplete.ref.loc31: type = name_ref Incomplete, %Incomplete.decl [concrete = constants.%Incomplete] +// CHECK:STDOUT: %ptr: type = ptr_type %Incomplete.ref.loc31 [concrete = constants.%ptr] // CHECK:STDOUT: } // CHECK:STDOUT: %p: ref %ptr = wrapper_binding p, %p.var [concrete = %p.var] // CHECK:STDOUT: name_binding_decl { diff --git a/toolchain/check/testdata/struct/fail_non_member_access.carbon b/toolchain/check/testdata/struct/fail_non_member_access.carbon index 38814e3b2db5..c925bddfd9e5 100644 --- a/toolchain/check/testdata/struct/fail_non_member_access.carbon +++ b/toolchain/check/testdata/struct/fail_non_member_access.carbon @@ -13,7 +13,12 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/fail_non_member_access.carbon var x: {.a: i32} = {.a = 4}; -// CHECK:STDERR: fail_non_member_access.carbon:[[@LINE+2]]:14-16: error: type `{.a: i32}` does not have a member `b` [QualifiedExprNameNotFound] +// CHECK:STDERR: ╭─┤ fail_non_member_access.carbon:[[@LINE+7]]:14 +// CHECK:STDERR: -> │ var y: i32 = x.b; +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┗━━┫ error: type `{.a: i32}` does not have a member `b` +// CHECK:STDERR: · ┃ [QualifiedExprNameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var y: i32 = x.b; @@ -85,7 +90,7 @@ var y: i32 = x.b; // CHECK:STDOUT: %x.var_patt: %pattern_type.243 = var_pattern %x.patt [concrete = constants.%x.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %y.var: ref %i32 = var_storage %y.var_patt [concrete] -// CHECK:STDOUT: %i32.loc18: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc23: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %y: ref %i32 = wrapper_binding y, %y.var [concrete = %y.var] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %y.patt: %pattern_type.d94 = ref_binding_pattern y [concrete = constants.%y.patt] diff --git a/toolchain/check/testdata/struct/fail_too_few_values.carbon b/toolchain/check/testdata/struct/fail_too_few_values.carbon index e30d85b3e617..20a3dc88e178 100644 --- a/toolchain/check/testdata/struct/fail_too_few_values.carbon +++ b/toolchain/check/testdata/struct/fail_too_few_values.carbon @@ -12,7 +12,13 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/fail_too_few_values.carbon -// CHECK:STDERR: fail_too_few_values.carbon:[[@LINE+2]]:29-36: error: missing value for field `b` in struct initialization [StructInitMissingFieldInLiteral] +// CHECK:STDERR: ╭─┤ fail_too_few_values.carbon:[[@LINE+8]]:29 +// CHECK:STDERR: -> │ var x: {.a: i32, .b: i32} = {.a = 1}; +// CHECK:STDERR: · ┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: missing value for field `b` in struct +// CHECK:STDERR: · ┃ initialization +// CHECK:STDERR: · ┃ [StructInitMissingFieldInLiteral] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: {.a: i32, .b: i32} = {.a = 1}; @@ -70,9 +76,9 @@ var x: {.a: i32, .b: i32} = {.a = 1}; // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %x.var: ref %struct_type.a.b = var_storage %x.var_patt [concrete] -// CHECK:STDOUT: %.loc17: type = splice_block %struct_type.a.b [concrete = constants.%struct_type.a.b] { -// CHECK:STDOUT: %i32.loc17_13: type = type_literal constants.%i32 [concrete = constants.%i32] -// CHECK:STDOUT: %i32.loc17_22: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %.loc23: type = splice_block %struct_type.a.b [concrete = constants.%struct_type.a.b] { +// CHECK:STDOUT: %i32.loc23_13: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i32.loc23_22: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.a.b: type = struct_type {.a: %i32, .b: %i32} [concrete = constants.%struct_type.a.b] // CHECK:STDOUT: } // CHECK:STDOUT: %x: ref %struct_type.a.b = wrapper_binding x, %x.var [concrete = %x.var] @@ -85,15 +91,15 @@ var x: {.a: i32, .b: i32} = {.a = 1}; // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %.loc17_36.1: %struct_type.a = struct_literal (%int_1) [concrete = constants.%struct] +// CHECK:STDOUT: %.loc23_36.1: %struct_type.a = struct_literal (%int_1) [concrete = constants.%struct] // CHECK:STDOUT: %impl.elem0: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60] -// CHECK:STDOUT: %bound_method.loc17_36.1: = bound_method %int_1, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] +// CHECK:STDOUT: %bound_method.loc23_36.1: = bound_method %int_1, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound] // CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc17_36.2: = bound_method %int_1, %specific_fn [concrete = constants.%bound_method] -// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc17_36.2(%int_1) [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc17_36.2: init %i32 = converted %int_1, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_1.68a] -// CHECK:STDOUT: %.loc17_36.3: ref %i32 = struct_access file.%x.var, element0 [concrete = constants.%.082] -// CHECK:STDOUT: %.loc17_36.4: init %i32 to %.loc17_36.3 = in_place_init %.loc17_36.2 [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %bound_method.loc23_36.2: = bound_method %int_1, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc23_36.2(%int_1) [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc23_36.2: init %i32 = converted %int_1, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_1.68a] +// CHECK:STDOUT: %.loc23_36.3: ref %i32 = struct_access file.%x.var, element0 [concrete = constants.%.082] +// CHECK:STDOUT: %.loc23_36.4: init %i32 to %.loc23_36.3 = in_place_init %.loc23_36.2 [concrete = constants.%int_1.68a] // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/struct/fail_type_assign.carbon b/toolchain/check/testdata/struct/fail_type_assign.carbon index b593323d295d..9efc1d3ebed4 100644 --- a/toolchain/check/testdata/struct/fail_type_assign.carbon +++ b/toolchain/check/testdata/struct/fail_type_assign.carbon @@ -12,8 +12,14 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/fail_type_assign.carbon -// CHECK:STDERR: fail_type_assign.carbon:[[@LINE+3]]:1-16: error: cannot implicitly convert expression of type `type` to `{.a: i32}` [ConversionFailure] -// CHECK:STDERR: fail_type_assign.carbon:[[@LINE+2]]:1-16: note: type `type` does not implement interface `Core.ImplicitAs({.a: i32})` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_type_assign.carbon:[[@LINE+9]]:1 +// CHECK:STDERR: -> │ var x: {.a: i32} = {.a: i32}; +// CHECK:STDERR: · ━━┳━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `type` to `{.a: i32}` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╰────┤ type `type` does not implement interface `Core.ImplicitAs({.a: i32})` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: {.a: i32} = {.a: i32}; @@ -51,7 +57,7 @@ var x: {.a: i32} = {.a: i32}; // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %x.var: ref %struct_type.a = var_storage %x.var_patt [concrete] -// CHECK:STDOUT: %.loc18: type = splice_block %struct_type.a [concrete = constants.%struct_type.a] { +// CHECK:STDOUT: %.loc24: type = splice_block %struct_type.a [concrete = constants.%struct_type.a] { // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %i32} [concrete = constants.%struct_type.a] // CHECK:STDOUT: } @@ -66,7 +72,7 @@ var x: {.a: i32} = {.a: i32}; // CHECK:STDOUT: !entry: // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %i32} [concrete = constants.%struct_type.a] -// CHECK:STDOUT: %.loc18: %struct_type.a = converted %struct_type.a, [concrete = ] +// CHECK:STDOUT: %.loc24: %struct_type.a = converted %struct_type.a, [concrete = ] // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/struct/fail_value_as_type.carbon b/toolchain/check/testdata/struct/fail_value_as_type.carbon index a127613757a2..b8a360e4d3e0 100644 --- a/toolchain/check/testdata/struct/fail_value_as_type.carbon +++ b/toolchain/check/testdata/struct/fail_value_as_type.carbon @@ -12,8 +12,16 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/fail_value_as_type.carbon -// CHECK:STDERR: fail_value_as_type.carbon:[[@LINE+3]]:8-15: error: cannot implicitly convert non-type value of type `{.a: Core.IntLiteral}` to `type` [ConversionFailureNonTypeToFacet] -// CHECK:STDERR: fail_value_as_type.carbon:[[@LINE+2]]:8-15: note: type `{.a: Core.IntLiteral}` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_value_as_type.carbon:[[@LINE+11]]:8 +// CHECK:STDERR: -> │ var x: {.a = 1}; +// CHECK:STDERR: · ┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert non-type value of type +// CHECK:STDERR: · │ ┃ `{.a: Core.IntLiteral}` to `type` +// CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet] +// CHECK:STDERR: · ╰────┤ type `{.a: Core.IntLiteral}` does not implement interface +// CHECK:STDERR: · │ `Core.ImplicitAs(type)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: {.a = 1}; @@ -46,8 +54,8 @@ var x: {.a = 1}; // CHECK:STDOUT: %x.var: ref = var_storage %x.var_patt [concrete = ] // CHECK:STDOUT: %.1: = splice_block [concrete = ] { // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] -// CHECK:STDOUT: %.loc18_15.1: %struct_type.a = struct_literal (%int_1) [concrete = constants.%struct] -// CHECK:STDOUT: %.loc18_15.2: type = converted %.loc18_15.1, [concrete = ] +// CHECK:STDOUT: %.loc26_15.1: %struct_type.a = struct_literal (%int_1) [concrete = constants.%struct] +// CHECK:STDOUT: %.loc26_15.2: type = converted %.loc26_15.1, [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: %x: = wrapper_binding x, [concrete = ] // CHECK:STDOUT: name_binding_decl { diff --git a/toolchain/check/testdata/struct/import.carbon b/toolchain/check/testdata/struct/import.carbon index c15864d6fcb6..52ab183878b9 100644 --- a/toolchain/check/testdata/struct/import.carbon +++ b/toolchain/check/testdata/struct/import.carbon @@ -34,16 +34,34 @@ var c: C({.a = 1, .b = 2}) = F(); // --- fail_bad_type.impl.carbon impl package Implicit; -// CHECK:STDERR: fail_bad_type.impl.carbon:[[@LINE+3]]:14-29: error: struct `{.a: i32, .b: i32}` has no field named `c` [StructInitUnexpectedFieldInLiteral] -// CHECK:STDERR: implicit.carbon:8:9-29: note: initializing generic parameter `S` declared here [InitializingGenericParam] +// CHECK:STDERR: ╭─┤ fail_bad_type.impl.carbon:[[@LINE+13]]:14 +// CHECK:STDERR: -> │ var c_bad: C({.c = 1, .d = 2}) = F(); +// CHECK:STDERR: · ━━━━━┳━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: struct `{.a: i32, .b: i32}` has no field named `c` +// CHECK:STDERR: · ┃ [StructInitUnexpectedFieldInLiteral] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ implicit.carbon +// CHECK:STDERR: │ class C(S: {.a: i32, .b: i32}) {} +// CHECK:STDERR: · ──────────┬────────── +// CHECK:STDERR: · ╰──┤ initializing generic parameter `S` declared here +// CHECK:STDERR: · │ [InitializingGenericParam] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var c_bad: C({.c = 1, .d = 2}) = F(); // --- fail_bad_value.impl.carbon impl package Implicit; -// CHECK:STDERR: fail_bad_value.impl.carbon:[[@LINE+3]]:1-30: error: cannot implicitly convert expression of type `C({.a = 1, .b = 2})` to `C({.a = 3, .b = 4})` [ConversionFailure] -// CHECK:STDERR: fail_bad_value.impl.carbon:[[@LINE+2]]:1-30: note: type `C({.a = 1, .b = 2})` does not implement interface `Core.ImplicitAs(C({.a = 3, .b = 4}))` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_bad_value.impl.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: -> │ var c_bad: C({.a = 3, .b = 4}) = F(); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `C({.a = 1, .b = 2})` +// CHECK:STDERR: · │ ┃ to `C({.a = 3, .b = 4})` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╰────┤ type `C({.a = 1, .b = 2})` does not implement interface +// CHECK:STDERR: · │ `Core.ImplicitAs(C({.a = 3, .b = 4}))` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var c_bad: C({.a = 3, .b = 4}) = F(); diff --git a/toolchain/check/testdata/tuple/class_tuples.carbon b/toolchain/check/testdata/tuple/class_tuples.carbon index af79313cf6fb..ec0f81d56a48 100644 --- a/toolchain/check/testdata/tuple/class_tuples.carbon +++ b/toolchain/check/testdata/tuple/class_tuples.carbon @@ -21,8 +21,16 @@ class D {} var c: C; var d: D; -// CHECK:STDERR: fail_element_type_mismatch.carbon:[[@LINE+3]]:19-24: error: cannot implicitly convert expression of type `C` to `C*` [ConversionFailure] -// CHECK:STDERR: fail_element_type_mismatch.carbon:[[@LINE+2]]:19-24: note: type `C` does not implement interface `Core.ImplicitAs(C*)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_element_type_mismatch.carbon:[[@LINE+11]]:19 +// CHECK:STDERR: -> │ var x: (C*, C*) = (c, d); +// CHECK:STDERR: · ┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `C` +// CHECK:STDERR: · │ ┃ to `C*` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╰────┤ type `C` does not implement interface +// CHECK:STDERR: · │ `Core.ImplicitAs(C*)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: (C*, C*) = (c, d); @@ -32,8 +40,17 @@ library "[[@TEST_NAME]]"; class Complete {} class Incomplete; -// CHECK:STDERR: fail_nested_incomplete.carbon:[[@LINE+3]]:8-29: error: binding pattern has incomplete type `(Complete, Incomplete)` in name binding declaration [IncompleteTypeInBindingDecl] -// CHECK:STDERR: fail_nested_incomplete.carbon:[[@LINE-3]]:1-17: note: class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: ╭─┤ fail_nested_incomplete.carbon:[[@LINE+12]]:8 +// CHECK:STDERR: │ class Incomplete; +// CHECK:STDERR: · ────────┬──────── +// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ var t: (Complete, Incomplete); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: binding pattern has incomplete type `(Complete, Incomplete)` +// CHECK:STDERR: · ┃ in name binding declaration +// CHECK:STDERR: · ┃ [IncompleteTypeInBindingDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var t: (Complete, Incomplete); @@ -44,8 +61,16 @@ library "[[@TEST_NAME]]"; class C {} -// CHECK:STDERR: fail_type_assign.carbon:[[@LINE+3]]:16-20: error: cannot implicitly convert expression of type `type` to `C` [ConversionFailure] -// CHECK:STDERR: fail_type_assign.carbon:[[@LINE+2]]:16-20: note: type `type` does not implement interface `Core.ImplicitAs(C)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_type_assign.carbon:[[@LINE+11]]:16 +// CHECK:STDERR: -> │ var x: (C, ) = (C, ); +// CHECK:STDERR: · ┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `type` +// CHECK:STDERR: · │ ┃ to `C` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╰────┤ type `type` does not implement interface +// CHECK:STDERR: · │ `Core.ImplicitAs(C)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: (C, ) = (C, ); @@ -55,7 +80,14 @@ library "[[@TEST_NAME]]"; class C {} var c: C; -// CHECK:STDERR: fail_value_as_type.carbon:[[@LINE+3]]:8: error: cannot implicitly convert non-type value of type `C` to `type` [ConversionFailureNonTypeToFacet] -// CHECK:STDERR: fail_value_as_type.carbon:[[@LINE+2]]:8: note: type `C` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_value_as_type.carbon:[[@LINE+10]]:8 +// CHECK:STDERR: -> │ var x: c; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert non-type value of type `C` to +// CHECK:STDERR: · │ ┃ `type` +// CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet] +// CHECK:STDERR: · ╰────┤ type `C` does not implement interface `Core.ImplicitAs(type)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: c; diff --git a/toolchain/check/testdata/tuple/element_access.carbon b/toolchain/check/testdata/tuple/element_access.carbon index ba80e4e1d191..e347e6be27ae 100644 --- a/toolchain/check/testdata/tuple/element_access.carbon +++ b/toolchain/check/testdata/tuple/element_access.carbon @@ -93,7 +93,11 @@ fn Run() -> i32 { library "[[@TEST_NAME]]"; var a: (i32, i32) = (12, 6); -// CHECK:STDERR: fail_access_error.carbon:[[@LINE+2]]:17-20: error: name `oops` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_access_error.carbon:[[@LINE+6]]:17 +// CHECK:STDERR: -> │ var b: i32 = a.(oops); +// CHECK:STDERR: · ━━┳━ +// CHECK:STDERR: · ┗━━┫ error: name `oops` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var b: i32 = a.(oops); @@ -103,7 +107,12 @@ library "[[@TEST_NAME]]"; fn F() {} fn Run() { - // CHECK:STDERR: fail_empty_access.carbon:[[@LINE+2]]:3-7: error: tuple element index `0` is past the end of type `()` [TupleIndexOutOfBounds] + // CHECK:STDERR: ╭─┤ fail_empty_access.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ F().0; + // CHECK:STDERR: · ━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: tuple element index `0` is past the end of type `()` + // CHECK:STDERR: · ┃ [TupleIndexOutOfBounds] + // CHECK:STDERR: ╰──── // CHECK:STDERR: F().0; } @@ -113,10 +122,22 @@ library "[[@TEST_NAME]]"; var a: (i32,) = (12,); var b: (i32,) = a; -// CHECK:STDERR: fail_large_index.carbon:[[@LINE+2]]:14-16: error: tuple element index `1` is past the end of type `(i32,)` [TupleIndexOutOfBounds] +// CHECK:STDERR: ╭─┤ fail_large_index.carbon:[[@LINE+8]]:14 +// CHECK:STDERR: -> │ var c: i32 = b.1; +// CHECK:STDERR: · ┳━━ +// CHECK:STDERR: · ┗━━┫ error: tuple element index `1` is past the end of type +// CHECK:STDERR: · ┃ `(i32,)` +// CHECK:STDERR: · ┃ [TupleIndexOutOfBounds] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var c: i32 = b.1; -// CHECK:STDERR: fail_large_index.carbon:[[@LINE+2]]:14-28: error: tuple element index `2147483647` is past the end of type `(i32,)` [TupleIndexOutOfBounds] +// CHECK:STDERR: ╭─┤ fail_large_index.carbon:[[@LINE+8]]:14 +// CHECK:STDERR: -> │ var d: i32 = b.(0x7FFF_FFFF); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: tuple element index `2147483647` is past the end of +// CHECK:STDERR: · ┃ type `(i32,)` +// CHECK:STDERR: · ┃ [TupleIndexOutOfBounds] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var d: i32 = b.(0x7FFF_FFFF); @@ -124,7 +145,13 @@ var d: i32 = b.(0x7FFF_FFFF); library "[[@TEST_NAME]]"; var a: (i32, i32) = (12, 6); -// CHECK:STDERR: fail_negative_indexing.carbon:[[@LINE+2]]:14-20: error: tuple element index `-10` is past the end of type `(i32, i32)` [TupleIndexOutOfBounds] +// CHECK:STDERR: ╭─┤ fail_negative_indexing.carbon:[[@LINE+8]]:14 +// CHECK:STDERR: -> │ var b: i32 = a.(-10); +// CHECK:STDERR: · ┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: tuple element index `-10` is past the end of type +// CHECK:STDERR: · ┃ `(i32, i32)` +// CHECK:STDERR: · ┃ [TupleIndexOutOfBounds] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var b: i32 = a.(-10); @@ -133,10 +160,25 @@ library "[[@TEST_NAME]]"; var a: (i32, i32) = (2, 3); var b: i32 = 0; -// CHECK:STDERR: fail_non_deterministic_type.carbon:[[@LINE+5]]:17: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction] -// CHECK:STDERR: min_prelude/parts/int.carbon:27:3-34: note: compile-time-only function declared here [CompTimeOnlyFunctionHere] +// CHECK:STDERR: ╭─┤ fail_non_deterministic_type.carbon:[[@LINE+20]]:17 +// CHECK:STDERR: -> │ var c: i32 = a.(b); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: non-constant call to compile-time-only function +// CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ min_prelude/parts/int.carbon +// CHECK:STDERR: │ fn Convert(self) -> IntLiteral = "int.convert_checked"; +// CHECK:STDERR: · ────────────────┬─────────────── +// CHECK:STDERR: · ╰──┤ compile-time-only function declared here +// CHECK:STDERR: · │ [CompTimeOnlyFunctionHere] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_non_deterministic_type.carbon:[[@LINE+2]]:14-18: error: tuple index must be a constant [TupleIndexNotConstant] +// CHECK:STDERR: ╭─┤ fail_non_deterministic_type.carbon:[[@LINE+7]]:14 +// CHECK:STDERR: -> │ var c: i32 = a.(b); +// CHECK:STDERR: · ━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: tuple index must be a constant +// CHECK:STDERR: · ┃ [TupleIndexNotConstant] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var c: i32 = a.(b); @@ -144,8 +186,16 @@ var c: i32 = a.(b); library "[[@TEST_NAME]]"; var a: (i32, i32) = (12, 6); -// CHECK:STDERR: fail_non_int_indexing.carbon:[[@LINE+3]]:17-19: error: cannot implicitly convert expression of type `Core.FloatLiteral` to `Core.IntLiteral` [ConversionFailure] -// CHECK:STDERR: fail_non_int_indexing.carbon:[[@LINE+2]]:17-19: note: type `Core.FloatLiteral` does not implement interface `Core.ImplicitAs(Core.IntLiteral)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_non_int_indexing.carbon:[[@LINE+11]]:17 +// CHECK:STDERR: -> │ var b: i32 = a.(2.6); +// CHECK:STDERR: · ┳━━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type +// CHECK:STDERR: · │ ┃ `Core.FloatLiteral` to `Core.IntLiteral` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╰────┤ type `Core.FloatLiteral` does not implement interface +// CHECK:STDERR: · │ `Core.ImplicitAs(Core.IntLiteral)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var b: i32 = a.(2.6); @@ -154,7 +204,14 @@ library "[[@TEST_NAME]]"; fn Main() { var non_tuple: array(i32, 2) = (5, 5); - // CHECK:STDERR: fail_non_tuple_access.carbon:[[@LINE+2]]:27-37: error: type `array(i32, 2)` does not support tuple indexing; only tuples can be indexed that way [TupleIndexOnANonTupleType] + // CHECK:STDERR: ╭─┤ fail_non_tuple_access.carbon:[[@LINE+9]]:27 + // CHECK:STDERR: -> │ var unused first: i32 = non_tuple.0; + // CHECK:STDERR: · ┳━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: type `array(i32, 2)` does not support + // CHECK:STDERR: · ┃ tuple indexing; only tuples can be indexed + // CHECK:STDERR: · ┃ that way + // CHECK:STDERR: · ┃ [TupleIndexOnANonTupleType] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused first: i32 = non_tuple.0; } @@ -163,7 +220,13 @@ fn Main() { library "[[@TEST_NAME]]"; var a: (i32, i32) = (12, 6); -// CHECK:STDERR: fail_out_of_bound_access.carbon:[[@LINE+2]]:14-16: error: tuple element index `2` is past the end of type `(i32, i32)` [TupleIndexOutOfBounds] +// CHECK:STDERR: ╭─┤ fail_out_of_bound_access.carbon:[[@LINE+8]]:14 +// CHECK:STDERR: -> │ var b: i32 = a.2; +// CHECK:STDERR: · ┳━━ +// CHECK:STDERR: · ┗━━┫ error: tuple element index `2` is past the end of type +// CHECK:STDERR: · ┃ `(i32, i32)` +// CHECK:STDERR: · ┃ [TupleIndexOutOfBounds] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var b: i32 = a.2; @@ -171,7 +234,13 @@ var b: i32 = a.2; library "[[@TEST_NAME]]"; var a: (i32, i32) = (12, 34); -// CHECK:STDERR: fail_out_of_bound_not_literal.carbon:[[@LINE+2]]:14-35: error: tuple element index `2` is past the end of type `(i32, i32)` [TupleIndexOutOfBounds] +// CHECK:STDERR: ╭─┤ fail_out_of_bound_not_literal.carbon:[[@LINE+8]]:14 +// CHECK:STDERR: -> │ var b: i32 = a.({.index = 2}.index); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: tuple element index `2` is past the end of type +// CHECK:STDERR: · ┃ `(i32, i32)` +// CHECK:STDERR: · ┃ [TupleIndexOutOfBounds] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var b: i32 = a.({.index = 2}.index); diff --git a/toolchain/check/testdata/tuple/import.carbon b/toolchain/check/testdata/tuple/import.carbon index deb1cf65b81a..7d4963cb16de 100644 --- a/toolchain/check/testdata/tuple/import.carbon +++ b/toolchain/check/testdata/tuple/import.carbon @@ -35,8 +35,19 @@ var c: C((1, 2)) = F(); impl package Implicit; -// CHECK:STDERR: fail_bad_type.impl.carbon:[[@LINE+3]]:14-22: error: cannot initialize tuple of 2 elements from tuple with 3 elements [TupleInitElementCountMismatch] -// CHECK:STDERR: implicit.carbon:7:9-21: note: initializing generic parameter `X` declared here [InitializingGenericParam] +// CHECK:STDERR: ╭─┤ fail_bad_type.impl.carbon:[[@LINE+14]]:14 +// CHECK:STDERR: -> │ var c_bad: C((1, 2, 3)) = F(); +// CHECK:STDERR: · ┳━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot initialize tuple of 2 elements from tuple with 3 +// CHECK:STDERR: · ┃ elements +// CHECK:STDERR: · ┃ [TupleInitElementCountMismatch] +// CHECK:STDERR: ┆ +// CHECK:STDERR: ├─┤ implicit.carbon +// CHECK:STDERR: │ class C(X: (i32, i32)) {} +// CHECK:STDERR: · ──────┬────── +// CHECK:STDERR: · ╰──┤ initializing generic parameter `X` declared here +// CHECK:STDERR: · │ [InitializingGenericParam] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var c_bad: C((1, 2, 3)) = F(); @@ -44,8 +55,16 @@ var c_bad: C((1, 2, 3)) = F(); impl package Implicit; -// CHECK:STDERR: fail_bad_value.impl.carbon:[[@LINE+3]]:1-20: error: cannot implicitly convert expression of type `C((1, 2))` to `C((3, 4))` [ConversionFailure] -// CHECK:STDERR: fail_bad_value.impl.carbon:[[@LINE+2]]:1-20: note: type `C((1, 2))` does not implement interface `Core.ImplicitAs(C((3, 4)))` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_bad_value.impl.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: -> │ var c_bad: C((3, 4)) = F(); +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `C((1, 2))` to +// CHECK:STDERR: · │ ┃ `C((3, 4))` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╰────┤ type `C((1, 2))` does not implement interface +// CHECK:STDERR: · │ `Core.ImplicitAs(C((3, 4)))` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var c_bad: C((3, 4)) = F(); diff --git a/toolchain/check/testdata/tuple/size_mismatch.carbon b/toolchain/check/testdata/tuple/size_mismatch.carbon index 4939d4e71f4b..b3ddcee13ecf 100644 --- a/toolchain/check/testdata/tuple/size_mismatch.carbon +++ b/toolchain/check/testdata/tuple/size_mismatch.carbon @@ -13,27 +13,51 @@ // --- fail_assign_from_empty.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_assign_from_empty.carbon:[[@LINE+2]]:16-17: error: cannot initialize tuple of 1 element from tuple with 0 elements [TupleInitElementCountMismatch] +// CHECK:STDERR: ╭─┤ fail_assign_from_empty.carbon:[[@LINE+8]]:16 +// CHECK:STDERR: -> │ var x: ((),) = (); +// CHECK:STDERR: · ┳━ +// CHECK:STDERR: · ┗━━┫ error: cannot initialize tuple of 1 element from tuple with +// CHECK:STDERR: · ┃ 0 elements +// CHECK:STDERR: · ┃ [TupleInitElementCountMismatch] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: ((),) = (); // --- fail_assign_to_empty.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_assign_to_empty.carbon:[[@LINE+2]]:13-17: error: cannot initialize tuple of 0 elements from tuple with 1 element [TupleInitElementCountMismatch] +// CHECK:STDERR: ╭─┤ fail_assign_to_empty.carbon:[[@LINE+8]]:13 +// CHECK:STDERR: -> │ var x: () = ((),); +// CHECK:STDERR: · ┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot initialize tuple of 0 elements from tuple with 1 +// CHECK:STDERR: · ┃ element +// CHECK:STDERR: · ┃ [TupleInitElementCountMismatch] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: () = ((),); // --- fail_assign_nested.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_assign_nested.carbon:[[@LINE+2]]:32-43: error: cannot initialize tuple of 2 elements from tuple with 3 elements [TupleInitElementCountMismatch] +// CHECK:STDERR: ╭─┤ fail_assign_nested.carbon:[[@LINE+8]]:32 +// CHECK:STDERR: -> │ var x: (((), ()), ((), ())) = (((), (), ()), ((), (), ())); +// CHECK:STDERR: · ┳━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot initialize tuple of 2 elements +// CHECK:STDERR: · ┃ from tuple with 3 elements +// CHECK:STDERR: · ┃ [TupleInitElementCountMismatch] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: (((), ()), ((), ())) = (((), (), ()), ((), (), ())); // --- fail_too_few_elements.carbon library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_too_few_elements.carbon:[[@LINE+2]]:19-24: error: cannot initialize tuple of 2 elements from tuple with 1 element [TupleInitElementCountMismatch] +// CHECK:STDERR: ╭─┤ fail_too_few_elements.carbon:[[@LINE+8]]:19 +// CHECK:STDERR: -> │ var x: ((), ()) = ((), ); +// CHECK:STDERR: · ┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot initialize tuple of 2 elements from tuple +// CHECK:STDERR: · ┃ with 1 element +// CHECK:STDERR: · ┃ [TupleInitElementCountMismatch] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: ((), ()) = ((), ); diff --git a/toolchain/check/testdata/tuple/tuple_pattern.carbon b/toolchain/check/testdata/tuple/tuple_pattern.carbon index afc6c8b8b4f1..e4ec69ccc7eb 100644 --- a/toolchain/check/testdata/tuple/tuple_pattern.carbon +++ b/toolchain/check/testdata/tuple/tuple_pattern.carbon @@ -72,7 +72,12 @@ let (x: {}, y: {}) = ({}, {}); library "[[@TEST_NAME]]"; class C { - // CHECK:STDERR: fail_in_class.carbon:[[@LINE+2]]:20: error: found tuple pattern in class `var` decl [FieldWithTuplePattern] + // CHECK:STDERR: ╭─┤ fail_in_class.carbon:[[@LINE+7]]:20 + // CHECK:STDERR: -> │ var (x: {}, y: {}); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: found tuple pattern in class `var` decl + // CHECK:STDERR: · ┃ [FieldWithTuplePattern] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var (x: {}, y: {}); } @@ -81,11 +86,21 @@ class C { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_initializer_mismatch.carbon:[[@LINE+2]]:5-18: error: tuple pattern expects 2 elements, but tuple literal has 1 [TuplePatternSizeDoesntMatchLiteral] +// CHECK:STDERR: ╭─┤ fail_initializer_mismatch.carbon:[[@LINE+7]]:5 +// CHECK:STDERR: -> │ let (x: {}, y: {}) = ({},); +// CHECK:STDERR: · ━━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: tuple pattern expects 2 elements, but tuple literal has 1 +// CHECK:STDERR: · ┃ [TuplePatternSizeDoesntMatchLiteral] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let (x: {}, y: {}) = ({},); -// CHECK:STDERR: fail_initializer_mismatch.carbon:[[@LINE+2]]:5-18: error: tuple pattern expects 2 elements, but tuple literal has 3 [TuplePatternSizeDoesntMatchLiteral] +// CHECK:STDERR: ╭─┤ fail_initializer_mismatch.carbon:[[@LINE+7]]:5 +// CHECK:STDERR: -> │ let (a: {}, b: {}) = ({}, {}, {}); +// CHECK:STDERR: · ━━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: tuple pattern expects 2 elements, but tuple literal has 3 +// CHECK:STDERR: · ┃ [TuplePatternSizeDoesntMatchLiteral] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let (a: {}, b: {}) = ({}, {}, {}); diff --git a/toolchain/check/testdata/typeof/basics.carbon b/toolchain/check/testdata/typeof/basics.carbon index 6b7d6e6d5e85..3d698da7e49a 100644 --- a/toolchain/check/testdata/typeof/basics.carbon +++ b/toolchain/check/testdata/typeof/basics.carbon @@ -61,7 +61,14 @@ fn F(a: bool, b: bool) { library "[[@TEST_NAME]]"; let a: bool = true; -// CHECK:STDERR: fail_todo_control_flow_file_scope.carbon:[[@LINE+2]]:15-20: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_todo_control_flow_file_scope.carbon:[[@LINE+9]]:15 +// CHECK:STDERR: -> │ let b: typeof(a or a) = false; +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: semantics TODO: +// CHECK:STDERR: · ┃ `Control flow expressions are currently only supported inside functions.` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let b: typeof(a or a) = false; @@ -100,8 +107,17 @@ class C {} fn G[T: type](x: T, unused y: typeof(x)) {} fn Call() { - // CHECK:STDERR: fail_generic_mismatch.carbon:[[@LINE+3]]:3-18: error: inconsistent deductions for value of generic parameter `T` [DeductionInconsistent] - // CHECK:STDERR: fail_generic_mismatch.carbon:[[@LINE-4]]:1-42: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_generic_mismatch.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn G[T: type](x: T, unused y: typeof(x)) {} + // CHECK:STDERR: · ─────────────────────┬──────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ G(true, {} as C); + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: inconsistent deductions for value of generic parameter `T` + // CHECK:STDERR: · ┃ [DeductionInconsistent] + // CHECK:STDERR: ╰──── // CHECK:STDERR: G(true, {} as C); } @@ -110,7 +126,11 @@ fn Call() { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_undeclared.carbon:[[@LINE+2]]:15-24: error: name `undeclared` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_undeclared.carbon:[[@LINE+6]]:15 +// CHECK:STDERR: -> │ var x: typeof(undeclared); +// CHECK:STDERR: · ━━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: name `undeclared` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: typeof(undeclared); diff --git a/toolchain/check/testdata/var/fail_duplicate_decl.carbon b/toolchain/check/testdata/var/fail_duplicate_decl.carbon index bfe854249ac2..eb76e5496388 100644 --- a/toolchain/check/testdata/var/fail_duplicate_decl.carbon +++ b/toolchain/check/testdata/var/fail_duplicate_decl.carbon @@ -16,8 +16,16 @@ fn Main() { var unused x: () = (); - // CHECK:STDERR: fail_basic.carbon:[[@LINE+3]]:14: error: duplicate name `x` being declared in the same scope [NameDeclDuplicate] - // CHECK:STDERR: fail_basic.carbon:[[@LINE-2]]:14-18: note: name is previously declared here [NameDeclPrevious] + // CHECK:STDERR: ╭─┤ fail_basic.carbon:[[@LINE+11]]:14 + // CHECK:STDERR: │ var unused x: () = (); + // CHECK:STDERR: · ──┬── + // CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ var unused x: () = (); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: duplicate name `x` being declared in the same scope + // CHECK:STDERR: · ┃ [NameDeclDuplicate] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused x: () = (); } @@ -42,7 +50,7 @@ fn Main() { // CHECK:STDOUT: %T.09f: %SubobjectDestroy.type = symbolic_binding T, 0 [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.type.dea: type = fn_type @T.as_type.as.DestroyImpl.impl.Op, @T.as_type.as.DestroyImpl.impl(%T.09f) [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.6e5: %T.as_type.as.DestroyImpl.impl.Op.type.dea = struct_value () [symbolic] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.687: type = fn_type @SubobjectDestroy.WithSelf.Op.loc7 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.687: type = fn_type @SubobjectDestroy.WithSelf.Op.loc15 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f: %SubobjectDestroy.WithSelf.Op.type.687 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f), @SubobjectDestroy [concrete] // CHECK:STDOUT: %SubobjectDestroy.facet.f89: %SubobjectDestroy.type = facet_value %empty_tuple.type, (%custom_witness.b80) [concrete] @@ -87,26 +95,26 @@ fn Main() { // CHECK:STDOUT: %x.patt.loc3: %pattern_type.cb1 = ref_binding_pattern x [concrete = constants.%x.patt.06838d.1] // CHECK:STDOUT: %x.var_patt.loc3: %pattern_type.cb1 = var_pattern %x.patt.loc3 [concrete = constants.%x.var_patt.28d573.1] // CHECK:STDOUT: } -// CHECK:STDOUT: %x.var.loc7: ref %empty_tuple.type = var_storage %x.var_patt.loc7 -// CHECK:STDOUT: %.loc7_23.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc7_23.2: init %empty_tuple.type = tuple_init () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc7_3.1: init %empty_tuple.type = converted %.loc7_23.1, %.loc7_23.2 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: assign %x.var.loc7, %.loc7_3.1 -// CHECK:STDOUT: %.loc7_18.1: type = splice_block %.loc7_18.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc7_18.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc7_18.3: type = converted %.loc7_18.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %x.var.loc15: ref %empty_tuple.type = var_storage %x.var_patt.loc15 +// CHECK:STDOUT: %.loc15_23.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc15_23.2: init %empty_tuple.type = tuple_init () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc15_3.1: init %empty_tuple.type = converted %.loc15_23.1, %.loc15_23.2 [concrete = constants.%empty_tuple] +// CHECK:STDOUT: assign %x.var.loc15, %.loc15_3.1 +// CHECK:STDOUT: %.loc15_18.1: type = splice_block %.loc15_18.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc15_18.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc15_18.3: type = converted %.loc15_18.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } -// CHECK:STDOUT: %x.loc7: ref %empty_tuple.type = wrapper_binding x, %x.var.loc7 +// CHECK:STDOUT: %x.loc15: ref %empty_tuple.type = wrapper_binding x, %x.var.loc15 // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %x.patt.loc7: %pattern_type.cb1 = ref_binding_pattern x [concrete = constants.%x.patt.06838d.2] -// CHECK:STDOUT: %x.var_patt.loc7: %pattern_type.cb1 = var_pattern %x.patt.loc7 [concrete = constants.%x.var_patt.28d573.2] +// CHECK:STDOUT: %x.patt.loc15: %pattern_type.cb1 = ref_binding_pattern x [concrete = constants.%x.patt.06838d.2] +// CHECK:STDOUT: %x.var_patt.loc15: %pattern_type.cb1 = var_pattern %x.patt.loc15 [concrete = constants.%x.var_patt.28d573.2] // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.facet.loc7_3.1: %Destroy.type = facet_value constants.%empty_tuple.type, (constants.%DestroyImpl.impl_witness.674, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc7_3.2: %Destroy.type = converted constants.%empty_tuple.type, %Destroy.facet.loc7_3.1 [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %Destroy.facet.loc7_3.2: %Destroy.type = facet_value constants.%empty_tuple.type, (constants.%DestroyImpl.impl_witness.674, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc7_3.3: %Destroy.type = converted constants.%empty_tuple.type, %Destroy.facet.loc7_3.2 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %Destroy.facet.loc15_3.1: %Destroy.type = facet_value constants.%empty_tuple.type, (constants.%DestroyImpl.impl_witness.674, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc15_3.2: %Destroy.type = converted constants.%empty_tuple.type, %Destroy.facet.loc15_3.1 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %Destroy.facet.loc15_3.2: %Destroy.type = facet_value constants.%empty_tuple.type, (constants.%DestroyImpl.impl_witness.674, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc15_3.3: %Destroy.type = converted constants.%empty_tuple.type, %Destroy.facet.loc15_3.2 [concrete = constants.%Destroy.facet] // CHECK:STDOUT: %SelfDestruct.specific_fn.1: = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet) [concrete = constants.%SelfDestruct.specific_fn] -// CHECK:STDOUT: %SelfDestruct.call.loc7: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%x.var.loc7) +// CHECK:STDOUT: %SelfDestruct.call.loc15: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%x.var.loc15) // CHECK:STDOUT: %Destroy.facet.loc3_3.1: %Destroy.type = facet_value constants.%empty_tuple.type, (constants.%DestroyImpl.impl_witness.674, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] // CHECK:STDOUT: %.loc3_3.2: %Destroy.type = converted constants.%empty_tuple.type, %Destroy.facet.loc3_3.1 [concrete = constants.%Destroy.facet] // CHECK:STDOUT: %Destroy.facet.loc3_3.2: %Destroy.type = facet_value constants.%empty_tuple.type, (constants.%DestroyImpl.impl_witness.674, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] @@ -116,5 +124,5 @@ fn Main() { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc7(%self.param: ref %empty_tuple.type) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc15(%self.param: ref %empty_tuple.type) = "no_op"; // CHECK:STDOUT: diff --git a/toolchain/check/testdata/var/fail_generic.carbon b/toolchain/check/testdata/var/fail_generic.carbon index e37cd55a7117..96d2435f832f 100644 --- a/toolchain/check/testdata/var/fail_generic.carbon +++ b/toolchain/check/testdata/var/fail_generic.carbon @@ -13,9 +13,20 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/var/fail_generic.carbon fn Main() { - // CHECK:STDERR: fail_generic.carbon:[[@LINE+4]]:15-19: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_generic.carbon:[[@LINE+15]]:15 + // CHECK:STDERR: -> │ var generic x: () = (); + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: + // CHECK:STDERR: · ┃ `handle invalid parse trees in `check`` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_generic.carbon:[[@LINE+2]]:21: error: found generic binding inside `var` pattern [NonRegularBindingInVarDecl] + // CHECK:STDERR: ╭─┤ fail_generic.carbon:[[@LINE+7]]:21 + // CHECK:STDERR: -> │ var generic x: () = (); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: found generic binding inside `var` pattern + // CHECK:STDERR: · ┃ [NonRegularBindingInVarDecl] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var generic x: () = (); } diff --git a/toolchain/check/testdata/var/fail_init_type_mismatch.carbon b/toolchain/check/testdata/var/fail_init_type_mismatch.carbon index 4183cf8b593e..9737eb666017 100644 --- a/toolchain/check/testdata/var/fail_init_type_mismatch.carbon +++ b/toolchain/check/testdata/var/fail_init_type_mismatch.carbon @@ -12,8 +12,14 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/var/fail_init_type_mismatch.carbon -// CHECK:STDERR: fail_init_type_mismatch.carbon:[[@LINE+3]]:1-9: error: cannot implicitly convert expression of type `()` to `{}` [ConversionFailure] -// CHECK:STDERR: fail_init_type_mismatch.carbon:[[@LINE+2]]:1-9: note: type `()` does not implement interface `Core.ImplicitAs({})` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_init_type_mismatch.carbon:[[@LINE+9]]:1 +// CHECK:STDERR: -> │ var x: {} = (); +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `()` to `{}` +// CHECK:STDERR: · │ ┃ [ConversionFailure] +// CHECK:STDERR: · ╰────┤ type `()` does not implement interface `Core.ImplicitAs({})` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: {} = (); @@ -48,9 +54,9 @@ var x: {} = (); // CHECK:STDOUT: } // CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %x.var: ref %empty_struct_type = var_storage %x.var_patt [concrete] -// CHECK:STDOUT: %.loc18_9.1: type = splice_block %.loc18_9.3 [concrete = constants.%empty_struct_type] { -// CHECK:STDOUT: %.loc18_9.2: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc18_9.3: type = converted %.loc18_9.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc24_9.1: type = splice_block %.loc24_9.3 [concrete = constants.%empty_struct_type] { +// CHECK:STDOUT: %.loc24_9.2: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc24_9.3: type = converted %.loc24_9.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: } // CHECK:STDOUT: %x: ref %empty_struct_type = wrapper_binding x, %x.var [concrete = %x.var] // CHECK:STDOUT: name_binding_decl { @@ -61,8 +67,8 @@ var x: {} = (); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc18_14: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc18_1: %empty_struct_type = converted %.loc18_14, [concrete = ] +// CHECK:STDOUT: %.loc24_14: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc24_1: %empty_struct_type = converted %.loc24_14, [concrete = ] // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/var/fail_init_with_self.carbon b/toolchain/check/testdata/var/fail_init_with_self.carbon index 27891a9cdea1..8a259c0ab07e 100644 --- a/toolchain/check/testdata/var/fail_init_with_self.carbon +++ b/toolchain/check/testdata/var/fail_init_with_self.carbon @@ -15,10 +15,20 @@ // --- fail_basic.carbon fn Main() { - // CHECK:STDERR: fail_basic.carbon:[[@LINE+5]]:22: error: `x` used before initialization [UsedBeforeInitialization] + // CHECK:STDERR: ╭─┤ fail_basic.carbon:[[@LINE+15]]:22 + // CHECK:STDERR: -> │ var unused x: () = x; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: `x` used before initialization + // CHECK:STDERR: · ┃ [UsedBeforeInitialization] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_basic.carbon:[[@LINE+3]]:14-18: error: variable `x` marked `unused` but used [UnusedButUsed] - // CHECK:STDERR: fail_basic.carbon:[[@LINE+2]]:22: note: usage here [UnusedButUsedHere] + // CHECK:STDERR: ╭─┤ fail_basic.carbon:[[@LINE+8]]:14 + // CHECK:STDERR: -> │ var unused x: () = x; + // CHECK:STDERR: · ━━┳━━ ┬ + // CHECK:STDERR: · ┗━━━━━━━━┫ error: variable `x` marked `unused` but used + // CHECK:STDERR: · │ ┃ [UnusedButUsed] + // CHECK:STDERR: · ╰────┤ usage here [UnusedButUsedHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused x: () = x; } @@ -41,7 +51,7 @@ fn Main() { // CHECK:STDOUT: %T.09f: %SubobjectDestroy.type = symbolic_binding T, 0 [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.type.dea: type = fn_type @T.as_type.as.DestroyImpl.impl.Op, @T.as_type.as.DestroyImpl.impl(%T.09f) [symbolic] // CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.6e5: %T.as_type.as.DestroyImpl.impl.Op.type.dea = struct_value () [symbolic] -// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.687: type = fn_type @SubobjectDestroy.WithSelf.Op.loc8 [concrete] +// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.687: type = fn_type @SubobjectDestroy.WithSelf.Op.loc18 [concrete] // CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f: %SubobjectDestroy.WithSelf.Op.type.687 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.b80: = custom_witness (%SubobjectDestroy.WithSelf.Op.30f), @SubobjectDestroy [concrete] // CHECK:STDOUT: %SubobjectDestroy.facet.f89: %SubobjectDestroy.type = facet_value %empty_tuple.type, (%custom_witness.b80) [concrete] @@ -75,23 +85,23 @@ fn Main() { // CHECK:STDOUT: %x.var: ref %empty_tuple.type = var_storage %x.var_patt // CHECK:STDOUT: %x.ref: = name_ref x, [concrete = ] // CHECK:STDOUT: assign %x.var, -// CHECK:STDOUT: %.loc8_18.1: type = splice_block %.loc8_18.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc8_18.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_18.3: type = converted %.loc8_18.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc18_18.1: type = splice_block %.loc18_18.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc18_18.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc18_18.3: type = converted %.loc18_18.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %x: ref %empty_tuple.type = wrapper_binding x, %x.var // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %x.patt: %pattern_type.cb1 = ref_binding_pattern x [concrete = constants.%x.patt] // CHECK:STDOUT: %x.var_patt: %pattern_type.cb1 = var_pattern %x.patt [concrete = constants.%x.var_patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.facet.loc8_3.1: %Destroy.type = facet_value constants.%empty_tuple.type, (constants.%DestroyImpl.impl_witness.674, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc8_3.1: %Destroy.type = converted constants.%empty_tuple.type, %Destroy.facet.loc8_3.1 [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %Destroy.facet.loc8_3.2: %Destroy.type = facet_value constants.%empty_tuple.type, (constants.%DestroyImpl.impl_witness.674, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] -// CHECK:STDOUT: %.loc8_3.2: %Destroy.type = converted constants.%empty_tuple.type, %Destroy.facet.loc8_3.2 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %Destroy.facet.loc18_3.1: %Destroy.type = facet_value constants.%empty_tuple.type, (constants.%DestroyImpl.impl_witness.674, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc18_3.1: %Destroy.type = converted constants.%empty_tuple.type, %Destroy.facet.loc18_3.1 [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %Destroy.facet.loc18_3.2: %Destroy.type = facet_value constants.%empty_tuple.type, (constants.%DestroyImpl.impl_witness.674, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet] +// CHECK:STDOUT: %.loc18_3.2: %Destroy.type = converted constants.%empty_tuple.type, %Destroy.facet.loc18_3.2 [concrete = constants.%Destroy.facet] // CHECK:STDOUT: %SelfDestruct.specific_fn: = specific_function constants.%SelfDestruct, @SelfDestruct(constants.%Destroy.facet) [concrete = constants.%SelfDestruct.specific_fn] // CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%x.var) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc8(%self.param: ref %empty_tuple.type) = "no_op"; +// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc18(%self.param: ref %empty_tuple.type) = "no_op"; // CHECK:STDOUT: diff --git a/toolchain/check/testdata/var/fail_lookup_outside_scope.carbon b/toolchain/check/testdata/var/fail_lookup_outside_scope.carbon index a983fff32094..d07f31614b82 100644 --- a/toolchain/check/testdata/var/fail_lookup_outside_scope.carbon +++ b/toolchain/check/testdata/var/fail_lookup_outside_scope.carbon @@ -16,6 +16,10 @@ fn Main() { var unused x: (); } -// CHECK:STDERR: fail_basic.carbon:[[@LINE+2]]:13: error: name `x` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_basic.carbon:[[@LINE+6]]:13 +// CHECK:STDERR: -> │ var y: () = x; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: name `x` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var y: () = x; diff --git a/toolchain/check/testdata/var/fail_modifiers.carbon b/toolchain/check/testdata/var/fail_modifiers.carbon index 50af15f184fe..4b95ec24cd70 100644 --- a/toolchain/check/testdata/var/fail_modifiers.carbon +++ b/toolchain/check/testdata/var/fail_modifiers.carbon @@ -10,22 +10,46 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/var/fail_modifiers.carbon -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-9: error: `protected` not allowed; requires class scope [ModifierProtectedNotAllowed] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ protected var b: () = (); +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: `protected` not allowed; requires class scope +// CHECK:STDERR: · ┃ [ModifierProtectedNotAllowed] +// CHECK:STDERR: ╰──── // CHECK:STDERR: protected var b: () = (); -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+3]]:9-17: error: `protected` not allowed on declaration with `private` [ModifierNotAllowedWith] -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-7: note: `private` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+8]]:9 +// CHECK:STDERR: -> │ private protected var c: () = (); +// CHECK:STDERR: · ───┬─── ━━━━┳━━━━ +// CHECK:STDERR: · │ ┗━━┫ error: `protected` not allowed on declaration with `private` +// CHECK:STDERR: · │ ┃ [ModifierNotAllowedWith] +// CHECK:STDERR: · ╰─────────────┤ `private` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: private protected var c: () = (); -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+5]]:11-19: error: `protected` repeated on declaration [ModifierRepeated] -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1-9: note: `protected` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+14]]:11 +// CHECK:STDERR: -> │ protected protected var d: () = (); +// CHECK:STDERR: · ────┬──── ━━━━┳━━━━ +// CHECK:STDERR: · │ ┗━━┫ error: `protected` repeated on declaration [ModifierRepeated] +// CHECK:STDERR: · ╰──────────────┤ `protected` previously appeared here [ModifierPrevious] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-9: error: `protected` not allowed; requires class scope [ModifierProtectedNotAllowed] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ protected protected var d: () = (); +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: `protected` not allowed; requires class scope +// CHECK:STDERR: · ┃ [ModifierProtectedNotAllowed] +// CHECK:STDERR: ╰──── // CHECK:STDERR: protected protected var d: () = (); -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:1-8: error: `abstract` not allowed on `var` declaration [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ abstract var e: () = (); +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: `abstract` not allowed on `var` declaration +// CHECK:STDERR: · ┃ [ModifierNotAllowedOnDeclaration] +// CHECK:STDERR: ╰──── // CHECK:STDERR: abstract var e: () = (); diff --git a/toolchain/check/testdata/var/fail_namespace_conflict.carbon b/toolchain/check/testdata/var/fail_namespace_conflict.carbon index fc19dbff494b..3b9d451a9177 100644 --- a/toolchain/check/testdata/var/fail_namespace_conflict.carbon +++ b/toolchain/check/testdata/var/fail_namespace_conflict.carbon @@ -12,12 +12,28 @@ namespace A; -// CHECK:STDERR: fail_namespace_conflict.carbon:[[@LINE+3]]:5: error: duplicate name `A` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: fail_namespace_conflict.carbon:[[@LINE-3]]:1-12: note: name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╭─┤ fail_namespace_conflict.carbon:[[@LINE+11]]:5 +// CHECK:STDERR: │ namespace A; +// CHECK:STDERR: · ──────┬───── +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ var A: (); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `A` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var A: (); -// CHECK:STDERR: fail_namespace_conflict.carbon:[[@LINE+3]]:5: error: duplicate name `A` being declared in the same scope [NameDeclDuplicate] -// CHECK:STDERR: fail_namespace_conflict.carbon:[[@LINE-8]]:1-12: note: name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ╭─┤ fail_namespace_conflict.carbon:[[@LINE+11]]:5 +// CHECK:STDERR: │ namespace A; +// CHECK:STDERR: · ──────┬───── +// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ var A: () = (); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: duplicate name `A` being declared in the same scope +// CHECK:STDERR: · ┃ [NameDeclDuplicate] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var A: () = (); diff --git a/toolchain/check/testdata/var/fail_not_copyable.carbon b/toolchain/check/testdata/var/fail_not_copyable.carbon index b1ae9bc915d7..e06dd6bc6874 100644 --- a/toolchain/check/testdata/var/fail_not_copyable.carbon +++ b/toolchain/check/testdata/var/fail_not_copyable.carbon @@ -15,8 +15,14 @@ class X { fn F(x: X) { // TODO: Decide on rules for when classes are copyable. - // CHECK:STDERR: fail_not_copyable.carbon:[[@LINE+3]]:21: error: cannot copy value of type `X` [CopyOfUncopyableType] - // CHECK:STDERR: fail_not_copyable.carbon:[[@LINE+2]]:21: note: type `X` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_not_copyable.carbon:[[@LINE+9]]:21 + // CHECK:STDERR: -> │ var unused y: X = x; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot copy value of type `X` + // CHECK:STDERR: · │ ┃ [CopyOfUncopyableType] + // CHECK:STDERR: · ╰────┤ type `X` does not implement interface `Core.Copy` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused y: X = x; } diff --git a/toolchain/check/testdata/var/fail_storage_is_literal.carbon b/toolchain/check/testdata/var/fail_storage_is_literal.carbon index ed900b32f39b..506773dc0779 100644 --- a/toolchain/check/testdata/var/fail_storage_is_literal.carbon +++ b/toolchain/check/testdata/var/fail_storage_is_literal.carbon @@ -13,8 +13,16 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/var/fail_storage_is_literal.carbon fn Main() { - // CHECK:STDERR: fail_storage_is_literal.carbon:[[@LINE+3]]:17: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet] - // CHECK:STDERR: fail_storage_is_literal.carbon:[[@LINE+2]]:17: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_storage_is_literal.carbon:[[@LINE+11]]:17 + // CHECK:STDERR: -> │ var unused x: 1 = 1; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert non-type value of type + // CHECK:STDERR: · │ ┃ `Core.IntLiteral` to `type` + // CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet] + // CHECK:STDERR: · ╰────┤ type `Core.IntLiteral` does not implement interface + // CHECK:STDERR: · │ `Core.ImplicitAs(type)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused x: 1 = 1; } @@ -55,11 +63,11 @@ fn Main() { // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %x.var: ref = var_storage %x.var_patt [concrete = ] -// CHECK:STDOUT: %int_1.loc19_21: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] +// CHECK:STDOUT: %int_1.loc27_21: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] // CHECK:STDOUT: assign %x.var, // CHECK:STDOUT: %.1: = splice_block [concrete = ] { -// CHECK:STDOUT: %int_1.loc19_17: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] -// CHECK:STDOUT: %.loc19: type = converted %int_1.loc19_17, [concrete = ] +// CHECK:STDOUT: %int_1.loc27_17: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] +// CHECK:STDOUT: %.loc27: type = converted %int_1.loc27_17, [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: %x: = wrapper_binding x, [concrete = ] // CHECK:STDOUT: name_binding_decl { diff --git a/toolchain/check/testdata/var/fail_todo_control_flow_init.carbon b/toolchain/check/testdata/var/fail_todo_control_flow_init.carbon index 63f8582a1122..75ca35c5b8cf 100644 --- a/toolchain/check/testdata/var/fail_todo_control_flow_init.carbon +++ b/toolchain/check/testdata/var/fail_todo_control_flow_init.carbon @@ -16,11 +16,32 @@ library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_if_true.carbon:[[@LINE+6]]:13-19: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_if_true.carbon:[[@LINE+27]]:13 +// CHECK:STDERR: -> │ var x: () = if true then () else (); +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: semantics TODO: +// CHECK:STDERR: · ┃ `Control flow expressions are currently only supported inside functions.` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_if_true.carbon:[[@LINE+4]]:21-27: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_if_true.carbon:[[@LINE+18]]:21 +// CHECK:STDERR: -> │ var x: () = if true then () else (); +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: semantics TODO: +// CHECK:STDERR: · ┃ `Control flow expressions are currently only supported inside functions.` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_if_true.carbon:[[@LINE+2]]:13-35: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_if_true.carbon:[[@LINE+9]]:13 +// CHECK:STDERR: -> │ var x: () = if true then () else (); +// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: semantics TODO: +// CHECK:STDERR: · ┃ `Control flow expressions are currently only supported inside functions.` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: () = if true then () else (); @@ -28,11 +49,32 @@ var x: () = if true then () else (); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_if_false.carbon:[[@LINE+6]]:14-21: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_if_false.carbon:[[@LINE+27]]:14 +// CHECK:STDERR: -> │ var x2: () = if false then () else (); +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: semantics TODO: +// CHECK:STDERR: · ┃ `Control flow expressions are currently only supported inside functions.` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_if_false.carbon:[[@LINE+4]]:23-29: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_if_false.carbon:[[@LINE+18]]:23 +// CHECK:STDERR: -> │ var x2: () = if false then () else (); +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: semantics TODO: +// CHECK:STDERR: · ┃ `Control flow expressions are currently only supported inside functions.` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_if_false.carbon:[[@LINE+2]]:14-37: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_if_false.carbon:[[@LINE+9]]:14 +// CHECK:STDERR: -> │ var x2: () = if false then () else (); +// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: semantics TODO: +// CHECK:STDERR: · ┃ `Control flow expressions are currently only supported inside functions.` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x2: () = if false then () else (); @@ -40,9 +82,23 @@ var x2: () = if false then () else (); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_true_or_false.carbon:[[@LINE+4]]:15-21: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_true_or_false.carbon:[[@LINE+18]]:15 +// CHECK:STDERR: -> │ var y: bool = true or false; +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: semantics TODO: +// CHECK:STDERR: · ┃ `Control flow expressions are currently only supported inside functions.` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_true_or_false.carbon:[[@LINE+2]]:15-27: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_true_or_false.carbon:[[@LINE+9]]:15 +// CHECK:STDERR: -> │ var y: bool = true or false; +// CHECK:STDERR: · ━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: semantics TODO: +// CHECK:STDERR: · ┃ `Control flow expressions are currently only supported inside functions.` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var y: bool = true or false; @@ -50,9 +106,23 @@ var y: bool = true or false; library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_false_or_true.carbon:[[@LINE+4]]:16-23: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_false_or_true.carbon:[[@LINE+18]]:16 +// CHECK:STDERR: -> │ var y2: bool = false or true; +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: semantics TODO: +// CHECK:STDERR: · ┃ `Control flow expressions are currently only supported inside functions.` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_false_or_true.carbon:[[@LINE+2]]:16-28: error: semantics TODO: `Control flow expressions are currently only supported inside functions.` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_false_or_true.carbon:[[@LINE+9]]:16 +// CHECK:STDERR: -> │ var y2: bool = false or true; +// CHECK:STDERR: · ━━━━━━┳━━━━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: semantics TODO: +// CHECK:STDERR: · ┃ `Control flow expressions are currently only supported inside functions.` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var y2: bool = false or true; diff --git a/toolchain/check/testdata/var/import_access.carbon b/toolchain/check/testdata/var/import_access.carbon index 6edc9c5684a8..8f69f26282b4 100644 --- a/toolchain/check/testdata/var/import_access.carbon +++ b/toolchain/check/testdata/var/import_access.carbon @@ -38,7 +38,11 @@ package Test library "[[@TEST_NAME]]"; import library "def"; -// CHECK:STDERR: fail_local_def.carbon:[[@LINE+2]]:14: error: name `v` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_local_def.carbon:[[@LINE+6]]:14 +// CHECK:STDERR: -> │ var v2: () = v; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: name `v` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var v2: () = v; @@ -48,7 +52,12 @@ package Other library "[[@TEST_NAME]]"; import Test library "def"; -// CHECK:STDERR: fail_other_def.carbon:[[@LINE+2]]:14-19: error: member name `v` not found in `Test` [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╭─┤ fail_other_def.carbon:[[@LINE+7]]:14 +// CHECK:STDERR: -> │ var v2: () = Test.v; +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: member name `v` not found in `Test` +// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var v2: () = Test.v; @@ -152,9 +161,9 @@ var v2: () = Test.v; // CHECK:STDOUT: } // CHECK:STDOUT: %default.import = import // CHECK:STDOUT: %v2.var: ref %empty_tuple.type = var_storage %v2.var_patt [concrete] -// CHECK:STDOUT: %.loc8_10.1: type = splice_block %.loc8_10.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc8_10.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_10.3: type = converted %.loc8_10.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc12_10.1: type = splice_block %.loc12_10.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc12_10.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc12_10.3: type = converted %.loc12_10.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %v2: ref %empty_tuple.type = wrapper_binding v2, %v2.var [concrete = %v2.var] // CHECK:STDOUT: name_binding_decl { @@ -195,9 +204,9 @@ var v2: () = Test.v; // CHECK:STDOUT: } // CHECK:STDOUT: %Test.import = import Test // CHECK:STDOUT: %v2.var: ref %empty_tuple.type = var_storage %v2.var_patt [concrete] -// CHECK:STDOUT: %.loc8_10.1: type = splice_block %.loc8_10.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc8_10.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_10.3: type = converted %.loc8_10.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] +// CHECK:STDOUT: %.loc13_10.1: type = splice_block %.loc13_10.3 [concrete = constants.%empty_tuple.type] { +// CHECK:STDOUT: %.loc13_10.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] +// CHECK:STDOUT: %.loc13_10.3: type = converted %.loc13_10.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] // CHECK:STDOUT: } // CHECK:STDOUT: %v2: ref %empty_tuple.type = wrapper_binding v2, %v2.var [concrete = %v2.var] // CHECK:STDOUT: name_binding_decl { diff --git a/toolchain/check/testdata/var/initialization.carbon b/toolchain/check/testdata/var/initialization.carbon index 44f273c8efc8..727d062a03eb 100644 --- a/toolchain/check/testdata/var/initialization.carbon +++ b/toolchain/check/testdata/var/initialization.carbon @@ -55,7 +55,13 @@ import Core; class A {} fn Main() { - // CHECK:STDERR: fail_uninitialized_no_impl.carbon:[[@LINE+2]]:3-18: error: cannot convert type `A` into type implementing `Core.DefaultOrUnformed` [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╭─┤ fail_uninitialized_no_impl.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ var unused x: A; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `A` into type implementing + // CHECK:STDERR: · ┃ `Core.DefaultOrUnformed` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var unused x: A; } diff --git a/toolchain/check/testdata/var/var_pattern.carbon b/toolchain/check/testdata/var/var_pattern.carbon index 3340d7cfe32f..5c869e5792ee 100644 --- a/toolchain/check/testdata/var/var_pattern.carbon +++ b/toolchain/check/testdata/var/var_pattern.carbon @@ -82,9 +82,20 @@ fn G() { library "[[@TEST_NAME]]"; fn F() { - // CHECK:STDERR: fail_nested.carbon:[[@LINE+4]]:41-43: error: `var` nested within another `var` [NestedVar] + // CHECK:STDERR: ╭─┤ fail_nested.carbon:[[@LINE+15]]:41 + // CHECK:STDERR: -> │ let (unused x: (), var (unused y: (), var unused z: ())) = ((), ((), ())); + // CHECK:STDERR: · ┳━━ + // CHECK:STDERR: · ┗━━┫ error: `var` nested within another + // CHECK:STDERR: · ┃ `var` + // CHECK:STDERR: · ┃ [NestedVar] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_nested.carbon:[[@LINE+2]]:41-56: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_nested.carbon:[[@LINE+7]]:41 + // CHECK:STDERR: -> │ let (unused x: (), var (unused y: (), var unused z: ())) = ((), ((), ())); + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let (unused x: (), var (unused y: (), var unused z: ())) = ((), ((), ())); } @@ -94,9 +105,20 @@ fn F() { library "[[@TEST_NAME]]"; fn f() { - // CHECK:STDERR: fail_compile_time.carbon:[[@LINE+4]]:15-21: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_compile_time.carbon:[[@LINE+15]]:15 + // CHECK:STDERR: -> │ var generic T: type; + // CHECK:STDERR: · ┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: + // CHECK:STDERR: · ┃ `handle invalid parse trees in `check`` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_compile_time.carbon:[[@LINE+2]]:22: error: found generic binding inside `var` pattern [NonRegularBindingInVarDecl] + // CHECK:STDERR: ╭─┤ fail_compile_time.carbon:[[@LINE+7]]:22 + // CHECK:STDERR: -> │ var generic T: type; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: found generic binding inside `var` pattern + // CHECK:STDERR: · ┃ [NonRegularBindingInVarDecl] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var generic T: type; let (x: (), generic T: type) = ((), ()); @@ -106,11 +128,21 @@ fn f() { library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_implicit.carbon:[[@LINE+2]]:10-14: error: implicit parameters of functions must be constant [ImplictParamMustBeConstant] +// CHECK:STDERR: ╭─┤ fail_implicit.carbon:[[@LINE+7]]:10 +// CHECK:STDERR: -> │ fn F[var u: ()](); +// CHECK:STDERR: · ━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: implicit parameters of functions must be constant +// CHECK:STDERR: · ┃ [ImplictParamMustBeConstant] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F[var u: ()](); -// CHECK:STDERR: fail_implicit.carbon:[[@LINE+2]]:10-16: error: implicit parameters of functions must be constant [ImplictParamMustBeConstant] +// CHECK:STDERR: ╭─┤ fail_implicit.carbon:[[@LINE+7]]:10 +// CHECK:STDERR: -> │ fn G[var T: type](); +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: implicit parameters of functions must be constant +// CHECK:STDERR: · ┃ [ImplictParamMustBeConstant] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn G[var T: type](); diff --git a/toolchain/check/testdata/variadics/pack_expansion.carbon b/toolchain/check/testdata/variadics/pack_expansion.carbon index 2e572cfdd762..1becc8403e93 100644 --- a/toolchain/check/testdata/variadics/pack_expansion.carbon +++ b/toolchain/check/testdata/variadics/pack_expansion.carbon @@ -14,7 +14,11 @@ library "[[@TEST_NAME]]"; fn F() { - // CHECK:STDERR: fail_todo_pack_expansion_statement.carbon:[[@LINE+2]]:3-5: error: semantics TODO: `HandlePackExpansionStart` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_pack_expansion_statement.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ ... F(); + // CHECK:STDERR: · ━┳━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `HandlePackExpansionStart` [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: ... F(); } @@ -23,7 +27,11 @@ fn F() { library "[[@TEST_NAME]]"; fn F(x: (i32, i32)) { - // CHECK:STDERR: fail_todo_expand.carbon:[[@LINE+2]]:3-10: error: semantics TODO: `HandlePrefixOperatorExpand` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_expand.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ expand x; + // CHECK:STDERR: · ━━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: semantics TODO: `HandlePrefixOperatorExpand` [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: expand x; } diff --git a/toolchain/check/testdata/where_expr/constraints.carbon b/toolchain/check/testdata/where_expr/constraints.carbon index 1231881f2be3..d3b5ecf0355a 100644 --- a/toolchain/check/testdata/where_expr/constraints.carbon +++ b/toolchain/check/testdata/where_expr/constraints.carbon @@ -36,7 +36,12 @@ interface I {} // Because there's an error inside the `where`, the constant value of the // `where` should be an error also. // -// CHECK:STDERR: fail_self_impls_error.carbon:[[@LINE+2]]:37: error: name `J` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_self_impls_error.carbon:[[@LINE+7]]:37 +// CHECK:STDERR: -> │ fn F(generic T: I where .Self impls J); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: name `J` not found +// CHECK:STDERR: · ┃ [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic T: I where .Self impls J); //@dump-sem-ir-end @@ -79,8 +84,18 @@ fn AssociatedTypeImpls(generic W: K where .Associated impls M); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_left_of_impls_non_type.carbon:[[@LINE+3]]:39: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet] -// CHECK:STDERR: fail_left_of_impls_non_type.carbon:[[@LINE+2]]:39: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_left_of_impls_non_type.carbon:[[@LINE+13]]:39 +// CHECK:STDERR: -> │ fn NonTypeImpls(generic U: type where 7 impls type); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert +// CHECK:STDERR: · │ ┃ non-type value of type +// CHECK:STDERR: · │ ┃ `Core.IntLiteral` to `type` +// CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet] +// CHECK:STDERR: · ╰────┤ type `Core.IntLiteral` does not +// CHECK:STDERR: · │ implement interface +// CHECK:STDERR: · │ `Core.ImplicitAs(type)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn NonTypeImpls(generic U: type where 7 impls type); @@ -88,8 +103,21 @@ fn NonTypeImpls(generic U: type where 7 impls type); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_right_of_impls_non_type.carbon:[[@LINE+3]]:51: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet] -// CHECK:STDERR: fail_right_of_impls_non_type.carbon:[[@LINE+2]]:51: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_right_of_impls_non_type.carbon:[[@LINE+16]]:51 +// CHECK:STDERR: -> │ fn ImplsNonType(generic U: type where .Self impls 7); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: cannot implicitly +// CHECK:STDERR: · │ ┃ convert non-type +// CHECK:STDERR: · │ ┃ value of type +// CHECK:STDERR: · │ ┃ `Core.IntLiteral` +// CHECK:STDERR: · │ ┃ to `type` +// CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet] +// CHECK:STDERR: · ╰────┤ type `Core.IntLiteral` +// CHECK:STDERR: · │ does not implement +// CHECK:STDERR: · │ interface +// CHECK:STDERR: · │ `Core.ImplicitAs(type)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn ImplsNonType(generic U: type where .Self impls 7); @@ -97,7 +125,17 @@ fn ImplsNonType(generic U: type where .Self impls 7); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_right_of_impls_non_facet_type.carbon:[[@LINE+2]]:58-60: error: right argument of `impls` requirement must be a facet type [ImplsOnNonFacetType] +// CHECK:STDERR: ╭─┤ fail_right_of_impls_non_facet_type.carbon:[[@LINE+12]]:58 +// CHECK:STDERR: -> │ fn ImplsOfNonFacetType(generic U: type where .Self impls i32); +// CHECK:STDERR: · ┳━━ +// CHECK:STDERR: · ┗━━┫ error: right +// CHECK:STDERR: · ┃ argument of +// CHECK:STDERR: · ┃ `impls` +// CHECK:STDERR: · ┃ requirement +// CHECK:STDERR: · ┃ must be a +// CHECK:STDERR: · ┃ facet type +// CHECK:STDERR: · ┃ [ImplsOnNonFacetType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn ImplsOfNonFacetType(generic U: type where .Self impls i32); @@ -105,7 +143,16 @@ fn ImplsOfNonFacetType(generic U: type where .Self impls i32); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_right_of_impls_non_facet_type_without_period_self.carbon:[[@LINE+2]]:55-57: error: right argument of `impls` requirement must be a facet type [ImplsOnNonFacetType] +// CHECK:STDERR: ╭─┤ fail_right_of_impls_non_facet_type_without_period_self.carbon:[[@LINE+11]]:55 +// CHECK:STDERR: -> │ fn ImplsOfNonFacetType(generic U: type where () impls i32); +// CHECK:STDERR: · ┳━━ +// CHECK:STDERR: · ┗━━┫ error: right argument +// CHECK:STDERR: · ┃ of `impls` +// CHECK:STDERR: · ┃ requirement +// CHECK:STDERR: · ┃ must be a +// CHECK:STDERR: · ┃ facet type +// CHECK:STDERR: · ┃ [ImplsOnNonFacetType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn ImplsOfNonFacetType(generic U: type where () impls i32); @@ -120,8 +167,19 @@ class C {} impl C as J {} fn DoesNotImplI() { - // CHECK:STDERR: fail_enforce_impls_constraint.carbon:[[@LINE+3]]:3-10: error: cannot convert type `C` into type implementing `J where .Self impls I` [ConversionFailureTypeToFacet] - // CHECK:STDERR: state_constraints.carbon:14:18-41: note: initializing generic parameter `V` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_enforce_impls_constraint.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: -> │ Impls(C); + // CHECK:STDERR: · ┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `C` into type implementing + // CHECK:STDERR: · ┃ `J where .Self impls I` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ state_constraints.carbon + // CHECK:STDERR: │ fn Impls(generic V: J where .Self impls I); + // CHECK:STDERR: · ──────────┬───────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `V` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Impls(C); } @@ -141,8 +199,18 @@ fn EmptyStruct(unused generic Y: J where .Self == {}) {} // now there is no support for `==` constraints so it rejects it as an // "other currently unsupported constraint." fn NotEmptyStruct() { - // CHECK:STDERR: fail_todo_enforce_equality_constraint.carbon:[[@LINE+3]]:3-16: error: cannot convert type `C` into type implementing `J where...` [ConversionFailureTypeToFacet] - // CHECK:STDERR: fail_todo_enforce_equality_constraint.carbon:[[@LINE-7]]:31-52: note: initializing generic parameter `Y` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_todo_enforce_equality_constraint.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn EmptyStruct(unused generic Y: J where .Self == {}) {} + // CHECK:STDERR: · ┬───────────────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `Y` declared + // CHECK:STDERR: · │ here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ EmptyStruct(C); + // CHECK:STDERR: · ━━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `C` into type implementing `J where...` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: EmptyStruct(C); } @@ -152,7 +220,12 @@ fn NotEmptyStruct() { library "[[@TEST_NAME]]"; //@dump-sem-ir-begin -// CHECK:STDERR: fail_error_in_constraint.carbon:[[@LINE+2]]:48: error: name `I` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_error_in_constraint.carbon:[[@LINE+7]]:48 +// CHECK:STDERR: -> │ fn WithError(generic U: type where .Self impls I); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: name `I` not found +// CHECK:STDERR: · ┃ [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn WithError(generic U: type where .Self impls I); //@dump-sem-ir-end @@ -283,24 +356,24 @@ fn F() { // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] { // CHECK:STDOUT: %T.patt: = symbolic_binding_pattern T, 0 [concrete = ] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc12_19.1: type = splice_block %.loc12_19.2 [concrete = ] { -// CHECK:STDOUT: %.Self.frozen.loc12_15: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen.e58] +// CHECK:STDOUT: %.loc17_19.1: type = splice_block %.loc17_19.2 [concrete = ] { +// CHECK:STDOUT: %.Self.frozen.loc17_15: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen.e58] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type] -// CHECK:STDOUT: %.Self.frozen.loc12_19: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen.3a0] +// CHECK:STDOUT: %.Self.frozen.loc17_19: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen.3a0] // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] -// CHECK:STDOUT: %.Self.ref.loc12_25.1: %I.type = name_ref .Self, %.Self.frozen.loc12_19 [symbolic_self = constants.%.Self.frozen.3a0] +// CHECK:STDOUT: %.Self.ref.loc17_25.1: %I.type = name_ref .Self, %.Self.frozen.loc17_19 [symbolic_self = constants.%.Self.frozen.3a0] // CHECK:STDOUT: %J.ref: = name_ref J, [concrete = ] -// CHECK:STDOUT: %.Self.as_type.loc12_25.1: type = facet_access_type %.Self.ref.loc12_25.1 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %.loc12_25.1: type = converted %.Self.ref.loc12_25.1, %.Self.as_type.loc12_25.1 [symbolic_self = constants.%.Self.frozen.as_type] -// CHECK:STDOUT: %impls.loc12_31.1 = requirement_impls %.loc12_25.1, [concrete] +// CHECK:STDOUT: %.Self.as_type.loc17_25.1: type = facet_access_type %.Self.ref.loc17_25.1 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %.loc17_25.1: type = converted %.Self.ref.loc17_25.1, %.Self.as_type.loc17_25.1 [symbolic_self = constants.%.Self.frozen.as_type] +// CHECK:STDOUT: %impls.loc17_31.1 = requirement_impls %.loc17_25.1, [concrete] // CHECK:STDOUT: %.Self: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %.Self.ref.loc12_25.2: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %.Self.as_type.loc12_25.2: type = facet_access_type %.Self.ref.loc12_25.2 [symbolic_self = constants.%.Self.as_type] -// CHECK:STDOUT: %.loc12_25.2: type = converted %.Self.ref.loc12_25.1, %.Self.as_type.loc12_25.2 [symbolic_self = constants.%.Self.as_type] -// CHECK:STDOUT: %impls.loc12_31.2 = requirement_impls %.loc12_25.2, [concrete] -// CHECK:STDOUT: %.loc12_19.2: type = where_expr [concrete = ] { +// CHECK:STDOUT: %.Self.ref.loc17_25.2: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self] +// CHECK:STDOUT: %.Self.as_type.loc17_25.2: type = facet_access_type %.Self.ref.loc17_25.2 [symbolic_self = constants.%.Self.as_type] +// CHECK:STDOUT: %.loc17_25.2: type = converted %.Self.ref.loc17_25.1, %.Self.as_type.loc17_25.2 [symbolic_self = constants.%.Self.as_type] +// CHECK:STDOUT: %impls.loc17_31.2 = requirement_impls %.loc17_25.2, [concrete] +// CHECK:STDOUT: %.loc17_19.2: type = where_expr [concrete = ] { // CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %I.ref [concrete] -// CHECK:STDOUT: %impls.loc12_31.2 = requirement_impls %.loc12_25.2, [concrete] +// CHECK:STDOUT: %impls.loc17_31.2 = requirement_impls %.loc17_25.2, [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: %T: = symbolic_binding T, 0 [concrete = ] @@ -560,20 +633,20 @@ fn F() { // CHECK:STDOUT: %WithError.decl: %WithError.type = fn_decl @WithError [concrete = constants.%WithError] { // CHECK:STDOUT: %U.patt: = symbolic_binding_pattern U, 0 [concrete = ] // CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc7_30.1: type = splice_block %.loc7_30.2 [concrete = ] { -// CHECK:STDOUT: %.Self.frozen.loc7_23: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc7_25: type = type_literal type [concrete = type] -// CHECK:STDOUT: %.Self.frozen.loc7_30: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %.loc7_25 [concrete] -// CHECK:STDOUT: %.Self.ref.loc7_36.1: type = name_ref .Self, %.Self.frozen.loc7_30 [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc12_30.1: type = splice_block %.loc12_30.2 [concrete = ] { +// CHECK:STDOUT: %.Self.frozen.loc12_23: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %.loc12_25: type = type_literal type [concrete = type] +// CHECK:STDOUT: %.Self.frozen.loc12_30: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] +// CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %.loc12_25 [concrete] +// CHECK:STDOUT: %.Self.ref.loc12_36.1: type = name_ref .Self, %.Self.frozen.loc12_30 [symbolic_self = constants.%.Self.frozen] // CHECK:STDOUT: %I.ref: = name_ref I, [concrete = ] -// CHECK:STDOUT: %impls.loc7_42.1 = requirement_impls %.Self.ref.loc7_36.1, [concrete] +// CHECK:STDOUT: %impls.loc12_42.1 = requirement_impls %.Self.ref.loc12_36.1, [concrete] // CHECK:STDOUT: %.Self: type = symbolic_binding .Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %.Self.ref.loc7_36.2: type = name_ref .Self, %.Self [symbolic_self = constants.%.Self] -// CHECK:STDOUT: %impls.loc7_42.2 = requirement_impls %.Self.ref.loc7_36.2, [concrete] -// CHECK:STDOUT: %.loc7_30.2: type = where_expr [concrete = ] { -// CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %.loc7_25 [concrete] -// CHECK:STDOUT: %impls.loc7_42.2 = requirement_impls %.Self.ref.loc7_36.2, [concrete] +// CHECK:STDOUT: %.Self.ref.loc12_36.2: type = name_ref .Self, %.Self [symbolic_self = constants.%.Self] +// CHECK:STDOUT: %impls.loc12_42.2 = requirement_impls %.Self.ref.loc12_36.2, [concrete] +// CHECK:STDOUT: %.loc12_30.2: type = where_expr [concrete = ] { +// CHECK:STDOUT: %base_facet_type = requirement_base_facet_type %.loc12_25 [concrete] +// CHECK:STDOUT: %impls.loc12_42.2 = requirement_impls %.Self.ref.loc12_36.2, [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: %U: = symbolic_binding U, 0 [concrete = ] diff --git a/toolchain/check/testdata/where_expr/designator.carbon b/toolchain/check/testdata/where_expr/designator.carbon index a7ee0cf15dd7..63a184785bff 100644 --- a/toolchain/check/testdata/where_expr/designator.carbon +++ b/toolchain/check/testdata/where_expr/designator.carbon @@ -34,7 +34,13 @@ interface J { let Member: type; } -// CHECK:STDERR: fail_wrong_member.carbon:[[@LINE+2]]:38-46: error: member name `Mismatch` not found in `J` [MemberNameNotFoundInSpecificScope] +// CHECK:STDERR: ╭─┤ fail_wrong_member.carbon:[[@LINE+8]]:38 +// CHECK:STDERR: -> │ fn PeriodMismatch(generic W: J where .Mismatch = {}); +// CHECK:STDERR: · ┳━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: member name `Mismatch` not +// CHECK:STDERR: · ┃ found in `J` +// CHECK:STDERR: · ┃ [MemberNameNotFoundInSpecificScope] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn PeriodMismatch(generic W: J where .Mismatch = {}); @@ -44,8 +50,15 @@ library "[[@TEST_NAME]]"; fn Foo() -> () { var unused x: (); - // CHECK:STDERR: fail_designator_matches_var.carbon:[[@LINE+3]]:10-11: error: name `.Self` not found [NameNotFound] - // CHECK:STDERR: fail_designator_matches_var.carbon: note: designator may only be used when `.Self` is in scope [NoPeriodSelfForDesignator] + // CHECK:STDERR: ╭─┤ fail_designator_matches_var.carbon:[[@LINE+10]]:10 + // CHECK:STDERR: -> │ return .x; + // CHECK:STDERR: · ━┳ + // CHECK:STDERR: · ┗━━┫ error: name `.Self` not found [NameNotFound] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ fail_designator_matches_var.carbon + // CHECK:STDERR: · ╰──┤ designator may only be used when `.Self` is in scope + // CHECK:STDERR: · │ [NoPeriodSelfForDesignator] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return .x; } @@ -55,8 +68,15 @@ fn Foo() -> () { library "[[@TEST_NAME]]"; fn Bar() -> () { - // CHECK:STDERR: fail_unknown_designator.carbon:[[@LINE+3]]:10-15: error: name `.Self` not found [NameNotFound] - // CHECK:STDERR: fail_unknown_designator.carbon: note: designator may only be used when `.Self` is in scope [NoPeriodSelfForDesignator] + // CHECK:STDERR: ╭─┤ fail_unknown_designator.carbon:[[@LINE+10]]:10 + // CHECK:STDERR: -> │ return .undef; + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: name `.Self` not found [NameNotFound] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ fail_unknown_designator.carbon + // CHECK:STDERR: · ╰──┤ designator may only be used when `.Self` is in scope + // CHECK:STDERR: · │ [NoPeriodSelfForDesignator] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return .undef; } @@ -66,7 +86,11 @@ fn Bar() -> () { library "[[@TEST_NAME]]"; class C { - // CHECK:STDERR: fail_dot_self_method_return_value.carbon:[[@LINE+2]]:27-31: error: name `.Self` not found [NameNotFound] + // CHECK:STDERR: ╭─┤ fail_dot_self_method_return_value.carbon:[[@LINE+6]]:27 + // CHECK:STDERR: -> │ fn F() -> Self { return .Self; } + // CHECK:STDERR: · ━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: name `.Self` not found [NameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn F() -> Self { return .Self; } } @@ -76,7 +100,11 @@ class C { library "[[@TEST_NAME]]"; class D { - // CHECK:STDERR: fail_dot_self_method_return_type.carbon:[[@LINE+2]]:13-17: error: name `.Self` not found [NameNotFound] + // CHECK:STDERR: ╭─┤ fail_dot_self_method_return_type.carbon:[[@LINE+6]]:13 + // CHECK:STDERR: -> │ fn G() -> .Self { return Self; } + // CHECK:STDERR: · ━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: name `.Self` not found [NameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn G() -> .Self { return Self; } } @@ -86,7 +114,18 @@ library "[[@TEST_NAME]]"; interface I {} -// CHECK:STDERR: fail_impls_constraint_does_not_constrain_self.carbon:[[@LINE+2]]:52-60: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] +// CHECK:STDERR: ╭─┤ fail_impls_constraint_does_not_constrain_self.carbon:[[@LINE+13]]:52 +// CHECK:STDERR: -> │ fn F(generic U: type, unused generic T: type where U impls I) {} +// CHECK:STDERR: · ┳━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: constraint in +// CHECK:STDERR: · ┃ `where` clause +// CHECK:STDERR: · ┃ without a +// CHECK:STDERR: · ┃ designator; +// CHECK:STDERR: · ┃ expected `.Self` +// CHECK:STDERR: · ┃ or a member +// CHECK:STDERR: · ┃ access like `.M` +// CHECK:STDERR: · ┃ [WhereWithoutDesignator] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic U: type, unused generic T: type where U impls I) {} @@ -97,7 +136,17 @@ interface I { let X: type; } -// CHECK:STDERR: fail_equality_constraint_does_not_constrain_self.carbon:[[@LINE+2]]:49-57: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] +// CHECK:STDERR: ╭─┤ fail_equality_constraint_does_not_constrain_self.carbon:[[@LINE+12]]:49 +// CHECK:STDERR: -> │ fn F(generic U: I, unused generic T: type where U.X == ()) {} +// CHECK:STDERR: · ┳━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: constraint in +// CHECK:STDERR: · ┃ `where` clause +// CHECK:STDERR: · ┃ without a +// CHECK:STDERR: · ┃ designator; expected +// CHECK:STDERR: · ┃ `.Self` or a member +// CHECK:STDERR: · ┃ access like `.M` +// CHECK:STDERR: · ┃ [WhereWithoutDesignator] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic U: I, unused generic T: type where U.X == ()) {} @@ -108,9 +157,26 @@ interface I { let X: type; } -// CHECK:STDERR: fail_combined_constraint_does_not_constrain_self.carbon:[[@LINE+4]]:49-57: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] +// CHECK:STDERR: ╭─┤ fail_combined_constraint_does_not_constrain_self.carbon:[[@LINE+21]]:49 +// CHECK:STDERR: -> │ fn F(generic U: I, unused generic T: type where U impls I and U.X == ()) {} +// CHECK:STDERR: · ┳━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: constraint in +// CHECK:STDERR: · ┃ `where` clause +// CHECK:STDERR: · ┃ without a +// CHECK:STDERR: · ┃ designator; expected +// CHECK:STDERR: · ┃ `.Self` or a member +// CHECK:STDERR: · ┃ access like `.M` +// CHECK:STDERR: · ┃ [WhereWithoutDesignator] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_combined_constraint_does_not_constrain_self.carbon:[[@LINE+2]]:63-71: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] +// CHECK:STDERR: ╭─┤ fail_combined_constraint_does_not_constrain_self.carbon:[[@LINE+9]]:63 +// CHECK:STDERR: -> │ fn F(generic U: I, unused generic T: type where U impls I and U.X == ()) {} +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: constraint in `where` clause without a designator; expected `.Self` or +// CHECK:STDERR: · ┃ a member access like `.M` +// CHECK:STDERR: · ┃ [WhereWithoutDesignator] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic U: I, unused generic T: type where U impls I and U.X == ()) {} @@ -134,7 +200,18 @@ class A(T: type); class B; class C; -// CHECK:STDERR: fail_where_without_designator_in_one_equiv_constraint.carbon:[[@LINE+2]]:53-61: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] +// CHECK:STDERR: ╭─┤ fail_where_without_designator_in_one_equiv_constraint.carbon:[[@LINE+13]]:53 +// CHECK:STDERR: -> │ fn F(unused generic T: type where A(.Self) == B and A(B) == B) {} +// CHECK:STDERR: · ┳━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: constraint in +// CHECK:STDERR: · ┃ `where` clause +// CHECK:STDERR: · ┃ without a +// CHECK:STDERR: · ┃ designator; +// CHECK:STDERR: · ┃ expected `.Self` +// CHECK:STDERR: · ┃ or a member +// CHECK:STDERR: · ┃ access like `.M` +// CHECK:STDERR: · ┃ [WhereWithoutDesignator] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused generic T: type where A(.Self) == B and A(B) == B) {} @@ -142,7 +219,16 @@ interface Z { let Z0: type; } -// CHECK:STDERR: fail_where_without_designator_in_one_equiv_constraint.carbon:[[@LINE+2]]:48-56: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] +// CHECK:STDERR: ╭─┤ fail_where_without_designator_in_one_equiv_constraint.carbon:[[@LINE+11]]:48 +// CHECK:STDERR: -> │ fn G(unused generic T: Z where A(.Z0) == B and A(B) == B) {} +// CHECK:STDERR: · ┳━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: constraint in `where` +// CHECK:STDERR: · ┃ clause without a +// CHECK:STDERR: · ┃ designator; expected +// CHECK:STDERR: · ┃ `.Self` or a member +// CHECK:STDERR: · ┃ access like `.M` +// CHECK:STDERR: · ┃ [WhereWithoutDesignator] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn G(unused generic T: Z where A(.Z0) == B and A(B) == B) {} @@ -164,7 +250,15 @@ interface I {} interface J(T: type) {} class C; -// CHECK:STDERR: fail_where_without_self_designator_in_type.carbon:[[@LINE+2]]:35-46: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] +// CHECK:STDERR: ╭─┤ fail_where_without_self_designator_in_type.carbon:[[@LINE+10]]:35 +// CHECK:STDERR: -> │ fn F(unused generic T: type where C impls type) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: constraint in `where` clause +// CHECK:STDERR: · ┃ without a designator; expected +// CHECK:STDERR: · ┃ `.Self` or a member access like +// CHECK:STDERR: · ┃ `.M` +// CHECK:STDERR: · ┃ [WhereWithoutDesignator] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused generic T: type where C impls type) {} @@ -177,7 +271,15 @@ interface I {} interface J(T: type) {} class C; -// CHECK:STDERR: fail_where_without_self_designator_in_one_impls_interface.carbon:[[@LINE+2]]:35-56: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] +// CHECK:STDERR: ╭─┤ fail_where_without_self_designator_in_one_impls_interface.carbon:[[@LINE+10]]:35 +// CHECK:STDERR: -> │ fn F(unused generic T: type where C impls (I & J(.Self))) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: constraint in `where` clause +// CHECK:STDERR: · ┃ without a designator; expected +// CHECK:STDERR: · ┃ `.Self` or a member access like +// CHECK:STDERR: · ┃ `.M` +// CHECK:STDERR: · ┃ [WhereWithoutDesignator] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused generic T: type where C impls (I & J(.Self))) {} @@ -191,7 +293,14 @@ interface I {} interface J(T: type) {} class C; -// CHECK:STDERR: fail_where_without_member_designator_in_one_impls_interface.carbon:[[@LINE+2]]:32-51: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] +// CHECK:STDERR: ╭─┤ fail_where_without_member_designator_in_one_impls_interface.carbon:[[@LINE+9]]:32 +// CHECK:STDERR: -> │ fn F(unused generic T: Z where C impls (I & J(.Z0))) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: constraint in `where` clause without +// CHECK:STDERR: · ┃ a designator; expected `.Self` or a +// CHECK:STDERR: · ┃ member access like `.M` +// CHECK:STDERR: · ┃ [WhereWithoutDesignator] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused generic T: Z where C impls (I & J(.Z0))) {} @@ -206,7 +315,15 @@ constraint K(T: type) { } class C; -// CHECK:STDERR: fail_where_without_self_designator_in_one_impls_named_constraint.carbon:[[@LINE+2]]:35-56: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] +// CHECK:STDERR: ╭─┤ fail_where_without_self_designator_in_one_impls_named_constraint.carbon:[[@LINE+10]]:35 +// CHECK:STDERR: -> │ fn F(unused generic T: type where C impls (I & K(.Self))) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: constraint in `where` clause +// CHECK:STDERR: · ┃ without a designator; expected +// CHECK:STDERR: · ┃ `.Self` or a member access like +// CHECK:STDERR: · ┃ `.M` +// CHECK:STDERR: · ┃ [WhereWithoutDesignator] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused generic T: type where C impls (I & K(.Self))) {} @@ -224,7 +341,14 @@ constraint K(T: type) { class C; -// CHECK:STDERR: fail_where_without_member_designator_in_one_impls_named_constraint.carbon:[[@LINE+2]]:32-51: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] +// CHECK:STDERR: ╭─┤ fail_where_without_member_designator_in_one_impls_named_constraint.carbon:[[@LINE+9]]:32 +// CHECK:STDERR: -> │ fn F(unused generic T: Z where C impls (I & K(.Z0))) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: constraint in `where` clause without +// CHECK:STDERR: · ┃ a designator; expected `.Self` or a +// CHECK:STDERR: · ┃ member access like `.M` +// CHECK:STDERR: · ┃ [WhereWithoutDesignator] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused generic T: Z where C impls (I & K(.Z0))) {} @@ -313,7 +437,14 @@ class C; eval fn E(generic _: type) -> type { return C; } -// CHECK:STDERR: fail_fn_call_returns_type_without_self_in_same_type.carbon:[[@LINE+2]]:32-44: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] +// CHECK:STDERR: ╭─┤ fail_fn_call_returns_type_without_self_in_same_type.carbon:[[@LINE+9]]:32 +// CHECK:STDERR: -> │ fn F(unused generic T: I where C == E(.Self)) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: constraint in `where` clause without +// CHECK:STDERR: · ┃ a designator; expected `.Self` or a +// CHECK:STDERR: · ┃ member access like `.M` +// CHECK:STDERR: · ┃ [WhereWithoutDesignator] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused generic T: I where C == E(.Self)) {} @@ -325,7 +456,14 @@ class C; eval fn E(generic _: type) -> type { return C; } -// CHECK:STDERR: fail_fn_call_returns_type_without_self_in_impls.carbon:[[@LINE+2]]:40-47: error: right argument of `impls` requirement must be a facet type [ImplsOnNonFacetType] +// CHECK:STDERR: ╭─┤ fail_fn_call_returns_type_without_self_in_impls.carbon:[[@LINE+9]]:40 +// CHECK:STDERR: -> │ fn F(unused generic T: I where C impls E(.Self)) {} +// CHECK:STDERR: · ┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: right argument of `impls` +// CHECK:STDERR: · ┃ requirement must be a facet +// CHECK:STDERR: · ┃ type +// CHECK:STDERR: · ┃ [ImplsOnNonFacetType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused generic T: I where C impls E(.Self)) {} @@ -342,7 +480,14 @@ eval fn E(generic T: type) -> type { return T; } // value. As such, we can't tell at the time of checking the facet type if // `E(.Self)` resolves to an expression containing a designator. -// CHECK:STDERR: fail_fn_call_returns_type_with_self_in_same_type.carbon:[[@LINE+2]]:32-44: error: constraint in `where` clause without a designator; expected `.Self` or a member access like `.M` [WhereWithoutDesignator] +// CHECK:STDERR: ╭─┤ fail_fn_call_returns_type_with_self_in_same_type.carbon:[[@LINE+9]]:32 +// CHECK:STDERR: -> │ fn F(unused generic T: I where C == E(.Self)) {} +// CHECK:STDERR: · ┳━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: constraint in `where` clause without +// CHECK:STDERR: · ┃ a designator; expected `.Self` or a +// CHECK:STDERR: · ┃ member access like `.M` +// CHECK:STDERR: · ┃ [WhereWithoutDesignator] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused generic T: I where C == E(.Self)) {} @@ -359,7 +504,14 @@ eval fn E(generic T: type) -> type { return T; } // value. As such, we can't tell at the time of checking the facet type if // `E(.Self)` resolves to an expression containing a designator. -// CHECK:STDERR: fail_fn_call_returns_type_with_self_in_impls.carbon:[[@LINE+2]]:40-47: error: right argument of `impls` requirement must be a facet type [ImplsOnNonFacetType] +// CHECK:STDERR: ╭─┤ fail_fn_call_returns_type_with_self_in_impls.carbon:[[@LINE+9]]:40 +// CHECK:STDERR: -> │ fn F(unused generic T: I where C impls E(.Self)) {} +// CHECK:STDERR: · ┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: right argument of `impls` +// CHECK:STDERR: · ┃ requirement must be a facet +// CHECK:STDERR: · ┃ type +// CHECK:STDERR: · ┃ [ImplsOnNonFacetType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(unused generic T: I where C impls E(.Self)) {} @@ -381,7 +533,12 @@ class C(T: type); // TODO: Once we can write a generic alias, this should pass. -// CHECK:STDERR: fail_todo_generic_alias_preserves_self.carbon:[[@LINE+2]]:8-16: error: `alias` declaration cannot have parameters [UnexpectedDeclNameParams] +// CHECK:STDERR: ╭─┤ fail_todo_generic_alias_preserves_self.carbon:[[@LINE+7]]:8 +// CHECK:STDERR: -> │ alias A(U: type) = C(U); +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: `alias` declaration cannot have parameters +// CHECK:STDERR: · ┃ [UnexpectedDeclNameParams] +// CHECK:STDERR: ╰──── // CHECK:STDERR: alias A(U: type) = C(U); @@ -393,7 +550,12 @@ library "[[@TEST_NAME]]"; interface I {} class C; -// CHECK:STDERR: fail_generic_alias_without_self.carbon:[[@LINE+2]]:8-16: error: `alias` declaration cannot have parameters [UnexpectedDeclNameParams] +// CHECK:STDERR: ╭─┤ fail_generic_alias_without_self.carbon:[[@LINE+7]]:8 +// CHECK:STDERR: -> │ alias A(U: type) = C; +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: `alias` declaration cannot have parameters +// CHECK:STDERR: · ┃ [UnexpectedDeclNameParams] +// CHECK:STDERR: ╰──── // CHECK:STDERR: alias A(U: type) = C; diff --git a/toolchain/check/testdata/where_expr/dot_self_impls.carbon b/toolchain/check/testdata/where_expr/dot_self_impls.carbon index 5c2d1275a321..299806d9ea11 100644 --- a/toolchain/check/testdata/where_expr/dot_self_impls.carbon +++ b/toolchain/check/testdata/where_expr/dot_self_impls.carbon @@ -72,7 +72,12 @@ interface J { } fn INotJ(generic T: I where .Self impls J) { - // CHECK:STDERR: fail_name_lookup_through_where_self_impls.carbon:[[@LINE+2]]:3-5: error: member name `G` not found in `I` [MemberNameNotFoundInSpecificScope] + // CHECK:STDERR: ╭─┤ fail_name_lookup_through_where_self_impls.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ T.G(); + // CHECK:STDERR: · ━┳━ + // CHECK:STDERR: · ┗━━┫ error: member name `G` not found in `I` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInSpecificScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: T.G(); } @@ -85,7 +90,11 @@ interface J { } fn TypeNotJ(generic T: type where .Self impls J) { - // CHECK:STDERR: fail_name_lookup_with_type.carbon:[[@LINE+2]]:3-5: error: member name `G` not found [MemberNameNotFound] + // CHECK:STDERR: ╭─┤ fail_name_lookup_with_type.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ T.G(); + // CHECK:STDERR: · ━┳━ + // CHECK:STDERR: · ┗━━┫ error: member name `G` not found [MemberNameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: T.G(); } @@ -97,11 +106,21 @@ interface A {} interface B { fn Bfn(); } fn F(generic T: A & B) { - // CHECK:STDERR: fail_facet_type_simple_member_access.carbon:[[@LINE+2]]:6-32: error: member name `Bfn` not found in `A` [MemberNameNotFoundInSpecificScope] + // CHECK:STDERR: ╭─┤ fail_facet_type_simple_member_access.carbon:[[@LINE+7]]:6 + // CHECK:STDERR: -> │ T.((A where .Self impls B).Bfn)(); + // CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: member name `Bfn` not found in `A` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInSpecificScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: T.((A where .Self impls B).Bfn)(); - // CHECK:STDERR: fail_facet_type_simple_member_access.carbon:[[@LINE+2]]:3-29: error: member name `Bfn` not found in `A` [MemberNameNotFoundInSpecificScope] + // CHECK:STDERR: ╭─┤ fail_facet_type_simple_member_access.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ (A where .Self impls B).Bfn; + // CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: member name `Bfn` not found in `A` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInSpecificScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: (A where .Self impls B).Bfn; } @@ -120,11 +139,21 @@ interface J { } fn INotJ[T: I where .Self impls J](x: T) { - // CHECK:STDERR: fail_name_lookup_instance.carbon:[[@LINE+2]]:3-16: error: member name `GNonInstance` not found in `I` [MemberNameNotFoundInSpecificScope] + // CHECK:STDERR: ╭─┤ fail_name_lookup_instance.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ x.GNonInstance(); + // CHECK:STDERR: · ━━━━━━━┳━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: member name `GNonInstance` not found in `I` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInSpecificScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: x.GNonInstance(); - // CHECK:STDERR: fail_name_lookup_instance.carbon:[[@LINE+2]]:3-9: error: member name `GSelf` not found in `I` [MemberNameNotFoundInSpecificScope] + // CHECK:STDERR: ╭─┤ fail_name_lookup_instance.carbon:[[@LINE+7]]:3 + // CHECK:STDERR: -> │ x.GSelf(); + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: member name `GSelf` not found in `I` + // CHECK:STDERR: · ┃ [MemberNameNotFoundInSpecificScope] + // CHECK:STDERR: ╰──── // CHECK:STDERR: x.GSelf(); } @@ -176,21 +205,48 @@ interface J { let B: type; } fn Test() { // TODO: This should pass. - // CHECK:STDERR: fail_todo_compare_equal_with_rewrite.carbon:[[@LINE+3]]:3-41: error: inconsistent deductions for value of generic parameter `T` [DeductionInconsistent] - // CHECK:STDERR: fail_todo_compare_equal_with_rewrite.carbon:[[@LINE-17]]:1-70: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_todo_compare_equal_with_rewrite.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn AssertSame[T: type](unused a: WrapType(T), unused b: WrapType(T)) {} + // CHECK:STDERR: · ─────────────────────────┬──────────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ AssertSame(Type((I where .A = ()) & J), + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: inconsistent deductions for value of generic parameter `T` + // CHECK:STDERR: · ┃ [DeductionInconsistent] + // CHECK:STDERR: ╰──── // CHECK:STDERR: AssertSame(Type((I where .A = ()) & J), Type(I & J where .A = ())); // TODO: This should pass. - // CHECK:STDERR: fail_todo_compare_equal_with_rewrite.carbon:[[@LINE+3]]:3-41: error: inconsistent deductions for value of generic parameter `T` [DeductionInconsistent] - // CHECK:STDERR: fail_todo_compare_equal_with_rewrite.carbon:[[@LINE-23]]:1-70: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_todo_compare_equal_with_rewrite.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn AssertSame[T: type](unused a: WrapType(T), unused b: WrapType(T)) {} + // CHECK:STDERR: · ─────────────────────────┬──────────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ AssertSame(Type(I & (J where .B = {})), + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: inconsistent deductions for value of generic parameter `T` + // CHECK:STDERR: · ┃ [DeductionInconsistent] + // CHECK:STDERR: ╰──── // CHECK:STDERR: AssertSame(Type(I & (J where .B = {})), Type(I & J where .B = {})); // TODO: This should pass. - // CHECK:STDERR: fail_todo_compare_equal_with_rewrite.carbon:[[@LINE+3]]:3-57: error: inconsistent deductions for value of generic parameter `T` [DeductionInconsistent] - // CHECK:STDERR: fail_todo_compare_equal_with_rewrite.carbon:[[@LINE-30]]:1-70: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_todo_compare_equal_with_rewrite.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn AssertSame[T: type](unused a: WrapType(T), unused b: WrapType(T)) {} + // CHECK:STDERR: · ─────────────────────────┬──────────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ AssertSame(Type((I where .A = ()) & (J where .B = {})), + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: inconsistent deductions for value of generic parameter `T` + // CHECK:STDERR: · ┃ [DeductionInconsistent] + // CHECK:STDERR: ╰──── // CHECK:STDERR: AssertSame(Type((I where .A = ()) & (J where .B = {})), Type(I & J where .A = () and .B = {})); @@ -207,8 +263,17 @@ interface I {} interface J {} fn Test() { - // CHECK:STDERR: fail_compare_not_equal.carbon:[[@LINE+3]]:3-64: error: inconsistent deductions for value of generic parameter `T` [DeductionInconsistent] - // CHECK:STDERR: fail_compare_not_equal.carbon:[[@LINE-8]]:1-64: note: while deducing parameters of generic declared here [DeductionGenericHere] + // CHECK:STDERR: ╭─┤ fail_compare_not_equal.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ fn Same[T: type](unused a: WrapType(T), unused b: WrapType(T)) {} + // CHECK:STDERR: · ─────────────────────────┬────────────────────────────────────── + // CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here + // CHECK:STDERR: · │ [DeductionGenericHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ Same(Type(I where .Self impls J), Type(J where .Self impls I)); + // CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: inconsistent deductions for value of generic parameter `T` + // CHECK:STDERR: · ┃ [DeductionInconsistent] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Same(Type(I where .Self impls J), Type(J where .Self impls I)); } diff --git a/toolchain/check/testdata/where_expr/equal_rewrite.carbon b/toolchain/check/testdata/where_expr/equal_rewrite.carbon index c3a7c07fb190..3f72ec64179b 100644 --- a/toolchain/check/testdata/where_expr/equal_rewrite.carbon +++ b/toolchain/check/testdata/where_expr/equal_rewrite.carbon @@ -83,8 +83,19 @@ interface O { fn WithInteger(unused generic Q: O where .P = i32) {} fn WithBool(generic R: O where .P = bool) { - // CHECK:STDERR: fail_rewrites_mismatch_right.carbon:[[@LINE+3]]:3-16: error: cannot convert type `R` that implements `O where .(O.P) = bool` into type implementing `O where .(O.P) = i32` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_rewrites_mismatch_right.carbon:[[@LINE-4]]:31-49: note: initializing generic parameter `Q` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_rewrites_mismatch_right.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: │ fn WithInteger(unused generic Q: O where .P = i32) {} + // CHECK:STDERR: · ┬────────────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `Q` declared + // CHECK:STDERR: · │ here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ WithInteger(R); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `R` that implements `O where .(O.P) = bool` + // CHECK:STDERR: · ┃ into type implementing `O where .(O.P) = i32` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: WithInteger(R); } @@ -101,8 +112,18 @@ interface S { fn WithT(unused generic V: S where .T = ()) {} fn WithU(generic W: S where .U = ()) { - // CHECK:STDERR: fail_rewrites_mismatch_left.carbon:[[@LINE+3]]:3-10: error: cannot convert type `W` that implements `S where .(S.U) = ()` into type implementing `S where .(S.T) = ()` [ConversionFailureFacetToFacet] - // CHECK:STDERR: fail_rewrites_mismatch_left.carbon:[[@LINE-4]]:25-42: note: initializing generic parameter `V` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_rewrites_mismatch_left.carbon:[[@LINE+13]]:3 + // CHECK:STDERR: │ fn WithT(unused generic V: S where .T = ()) {} + // CHECK:STDERR: · ───┬────────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `V` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ WithT(W); + // CHECK:STDERR: · ┳━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `W` that implements `S where .(S.U) = ()` into + // CHECK:STDERR: · ┃ type implementing `S where .(S.T) = ()` + // CHECK:STDERR: · ┃ [ConversionFailureFacetToFacet] + // CHECK:STDERR: ╰──── // CHECK:STDERR: WithT(W); } @@ -115,13 +136,35 @@ import library "equal_constraint"; import library "nested_rewrites"; fn Calls() { - // CHECK:STDERR: fail_import_rewrites.carbon:[[@LINE+3]]:3-13: error: cannot convert type `bool` into type implementing `N where .(N.P) = {}` [ConversionFailureTypeToFacet] - // CHECK:STDERR: equal_constraint.carbon:9:18-35: note: initializing generic parameter `T` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_import_rewrites.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: -> │ Equal(bool); + // CHECK:STDERR: · ┳━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `bool` into type implementing + // CHECK:STDERR: · ┃ `N where .(N.P) = {}` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ equal_constraint.carbon + // CHECK:STDERR: │ fn Equal(generic T: N where .P = {}); + // CHECK:STDERR: · ─────────┬──────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Equal(bool); - // CHECK:STDERR: fail_import_rewrites.carbon:[[@LINE+3]]:3-20: error: cannot convert type `i32` into type implementing `A where .(A.C) = () and .(A.B) = bool` [ConversionFailureTypeToFacet] - // CHECK:STDERR: nested_rewrites.carbon:10:26-61: note: initializing generic parameter `D` declared here [InitializingGenericParam] + // CHECK:STDERR: ╭─┤ fail_import_rewrites.carbon:[[@LINE+14]]:3 + // CHECK:STDERR: -> │ NestedRewrite(i32); + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: cannot convert type `i32` into type implementing + // CHECK:STDERR: · ┃ `A where .(A.C) = () and .(A.B) = bool` + // CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] + // CHECK:STDERR: ┆ + // CHECK:STDERR: ├─┤ nested_rewrites.carbon + // CHECK:STDERR: │ fn NestedRewrite(generic D: (A where .B = bool) where .C = ()); + // CHECK:STDERR: · ──┬───────────────────────────────── + // CHECK:STDERR: · ╰──┤ initializing generic parameter `D` declared here + // CHECK:STDERR: · │ [InitializingGenericParam] + // CHECK:STDERR: ╰──── // CHECK:STDERR: NestedRewrite(i32); } @@ -135,8 +178,19 @@ interface I { } // `2` can't be converted to the type of `I.Member` -// CHECK:STDERR: fail_check_rewrite_constraints.carbon:[[@LINE+3]]:53: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet] -// CHECK:STDERR: fail_check_rewrite_constraints.carbon:[[@LINE+2]]:53: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╭─┤ fail_check_rewrite_constraints.carbon:[[@LINE+14]]:53 +// CHECK:STDERR: -> │ fn RewriteTypeMismatch(generic X: I where .Member = 2); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: cannot implicitly convert non-type value of type `Core.IntLiteral` to +// CHECK:STDERR: · ┃ `type` +// CHECK:STDERR: · ┃ [ConversionFailureNonTypeToFacet] +// CHECK:STDERR: · ╰──┤ type `Core.IntLiteral` +// CHECK:STDERR: · │ does not implement +// CHECK:STDERR: · │ interface +// CHECK:STDERR: · │ `Core.ImplicitAs(type)` +// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn RewriteTypeMismatch(generic X: I where .Member = 2); @@ -149,7 +203,14 @@ class D {} impl D as A {} fn F() { - // CHECK:STDERR: fail_todo_let.carbon:[[@LINE+2]]:15-41: error: semantics TODO: `local generic `let` bindings are currently unsupported` [SemanticsTodo] + // CHECK:STDERR: ╭─┤ fail_todo_let.carbon:[[@LINE+9]]:15 + // CHECK:STDERR: -> │ let generic E: type where .Self impls A = D; + // CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━━ + // CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━┛ + // CHECK:STDERR: · ┃ error: semantics TODO: + // CHECK:STDERR: · ┃ `local generic `let` bindings are currently unsupported` + // CHECK:STDERR: · ┃ [SemanticsTodo] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let generic E: type where .Self impls A = D; } @@ -162,7 +223,14 @@ interface A {} class D {} impl D as A {} // TODO: Compile-time binding are not yet supported at file scope. -// CHECK:STDERR: fail_todo_let_compile_time.carbon:[[@LINE+2]]:13-39: error: semantics TODO: ``let` compile time binding outside function or interface` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_todo_let_compile_time.carbon:[[@LINE+9]]:13 +// CHECK:STDERR: -> │ let generic B: type where .Self impls A = D; +// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: semantics TODO: +// CHECK:STDERR: · ┃ ``let` compile time binding outside function or interface` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let generic B: type where .Self impls A = D; @@ -177,15 +245,36 @@ interface E { // Testing how these types get stringified in error messages. // TODO: This should be a compile-time binding, once that is supported. -// CHECK:STDERR: fail_type_does_not_implement_where.carbon:[[@LINE+2]]:42-44: error: cannot convert type `f64` into type implementing `E where .(E.F) = bool and .(E.G) = ()` [ConversionFailureTypeToFacet] +// CHECK:STDERR: ╭─┤ fail_type_does_not_implement_where.carbon:[[@LINE+9]]:42 +// CHECK:STDERR: -> │ let H: (E where .F = bool and .G = ()) = f64; +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: cannot convert type `f64` into type implementing +// CHECK:STDERR: · ┃ `E where .(E.F) = bool and .(E.G) = ()` +// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let H: (E where .F = bool and .G = ()) = f64; -// CHECK:STDERR: fail_type_does_not_implement_where.carbon:[[@LINE+2]]:45-48: error: cannot convert type `bool` into type implementing `E where .(E.F) = {} and .(E.G) = i32` [ConversionFailureTypeToFacet] +// CHECK:STDERR: ╭─┤ fail_type_does_not_implement_where.carbon:[[@LINE+9]]:45 +// CHECK:STDERR: -> │ let J: ((E where .F = {}) where .G = i32) = bool; +// CHECK:STDERR: · ━━┳━ +// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ +// CHECK:STDERR: · ┃ error: cannot convert type `bool` into type implementing +// CHECK:STDERR: · ┃ `E where .(E.F) = {} and .(E.G) = i32` +// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let J: ((E where .F = {}) where .G = i32) = bool; -// CHECK:STDERR: fail_type_does_not_implement_where.carbon:[[@LINE+2]]:33-36: error: cannot convert type `bool` into type implementing `E where .(E.F) = .(E.G)` [ConversionFailureTypeToFacet] +// CHECK:STDERR: ╭─┤ fail_type_does_not_implement_where.carbon:[[@LINE+9]]:33 +// CHECK:STDERR: -> │ let K: (E where .F = .Self.G) = bool; +// CHECK:STDERR: · ┳━━━ +// CHECK:STDERR: · ┗━━┫ error: cannot convert type `bool` into type +// CHECK:STDERR: · ┃ implementing +// CHECK:STDERR: · ┃ `E where .(E.F) = .(E.G)` +// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let K: (E where .F = .Self.G) = bool; diff --git a/toolchain/check/testdata/where_expr/fail_not_facet.carbon b/toolchain/check/testdata/where_expr/fail_not_facet.carbon index 22d42694d842..252340f954f7 100644 --- a/toolchain/check/testdata/where_expr/fail_not_facet.carbon +++ b/toolchain/check/testdata/where_expr/fail_not_facet.carbon @@ -14,7 +14,13 @@ library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_left_where_not_facet.carbon:[[@LINE+2]]:17-19: error: left argument of `where` operator must be a facet type [WhereOnNonFacetType] +// CHECK:STDERR: ╭─┤ fail_left_where_not_facet.carbon:[[@LINE+8]]:17 +// CHECK:STDERR: -> │ fn F(generic T: i32 where .Self == bool); +// CHECK:STDERR: · ┳━━ +// CHECK:STDERR: · ┗━━┫ error: left argument of `where` operator must be a facet +// CHECK:STDERR: · ┃ type +// CHECK:STDERR: · ┃ [WhereOnNonFacetType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic T: i32 where .Self == bool); @@ -22,7 +28,11 @@ fn F(generic T: i32 where .Self == bool); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_left_where_unknown.carbon:[[@LINE+2]]:17-28: error: name `NOT_DECLARED` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_left_where_unknown.carbon:[[@LINE+6]]:17 +// CHECK:STDERR: -> │ fn G(generic U: NOT_DECLARED where .Self == bool); +// CHECK:STDERR: · ━━━━━━┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: name `NOT_DECLARED` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn G(generic U: NOT_DECLARED where .Self == bool); @@ -30,6 +40,10 @@ fn G(generic U: NOT_DECLARED where .Self == bool); library "[[@TEST_NAME]]"; -// CHECK:STDERR: fail_var.carbon:[[@LINE+2]]:8: error: name `e` not found [NameNotFound] +// CHECK:STDERR: ╭─┤ fail_var.carbon:[[@LINE+6]]:8 +// CHECK:STDERR: -> │ var v: e where .x = 3; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: name `e` not found [NameNotFound] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var v: e where .x = 3; diff --git a/toolchain/check/testdata/while/while.carbon b/toolchain/check/testdata/while/while.carbon index 0919220f19f1..1b52fa6b9be0 100644 --- a/toolchain/check/testdata/while/while.carbon +++ b/toolchain/check/testdata/while/while.carbon @@ -80,8 +80,14 @@ fn While() { library "[[@TEST_NAME]]"; fn While() { - // CHECK:STDERR: fail_bad_condition.carbon:[[@LINE+3]]:9-12: error: cannot implicitly convert expression of type `{}` to `bool` [ConversionFailure] - // CHECK:STDERR: fail_bad_condition.carbon:[[@LINE+2]]:9-12: note: type `{}` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╭─┤ fail_bad_condition.carbon:[[@LINE+9]]:9 + // CHECK:STDERR: -> │ while ({}) {} + // CHECK:STDERR: · ━┳━━ + // CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `{}` to `bool` + // CHECK:STDERR: · │ ┃ [ConversionFailure] + // CHECK:STDERR: · ╰────┤ type `{}` does not implement interface `Core.ImplicitAs(bool)` + // CHECK:STDERR: · │ [MissingImplInMemberAccessInContext] + // CHECK:STDERR: ╰──── // CHECK:STDERR: while ({}) {} } @@ -90,20 +96,36 @@ fn While() { library "[[@TEST_NAME]]"; fn While() { - // CHECK:STDERR: fail_bad_break_continue.carbon:[[@LINE+2]]:3-10: error: `continue` can only be used in a loop [ContinueOutsideLoop] + // CHECK:STDERR: ╭─┤ fail_bad_break_continue.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ continue; + // CHECK:STDERR: · ━━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: `continue` can only be used in a loop [ContinueOutsideLoop] + // CHECK:STDERR: ╰──── // CHECK:STDERR: continue; - // CHECK:STDERR: fail_bad_break_continue.carbon:[[@LINE+2]]:3-7: error: `break` can only be used in a loop [BreakOutsideLoop] + // CHECK:STDERR: ╭─┤ fail_bad_break_continue.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ break; + // CHECK:STDERR: · ━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: `break` can only be used in a loop [BreakOutsideLoop] + // CHECK:STDERR: ╰──── // CHECK:STDERR: break; while (false) { continue; break; } - // CHECK:STDERR: fail_bad_break_continue.carbon:[[@LINE+2]]:3-10: error: `continue` can only be used in a loop [ContinueOutsideLoop] + // CHECK:STDERR: ╭─┤ fail_bad_break_continue.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ continue; + // CHECK:STDERR: · ━━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: `continue` can only be used in a loop [ContinueOutsideLoop] + // CHECK:STDERR: ╰──── // CHECK:STDERR: continue; - // CHECK:STDERR: fail_bad_break_continue.carbon:[[@LINE+2]]:3-7: error: `break` can only be used in a loop [BreakOutsideLoop] + // CHECK:STDERR: ╭─┤ fail_bad_break_continue.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ break; + // CHECK:STDERR: · ━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: `break` can only be used in a loop [BreakOutsideLoop] + // CHECK:STDERR: ╰──── // CHECK:STDERR: break; } diff --git a/toolchain/diagnostics/renderer.cpp b/toolchain/diagnostics/renderer.cpp index f3fa8c1e090a..eb70d0d9b351 100644 --- a/toolchain/diagnostics/renderer.cpp +++ b/toolchain/diagnostics/renderer.cpp @@ -1752,25 +1752,29 @@ static auto DrawLeadingLabelLine(Buffer& buffer, int x, int underline_y, LineEnd::Edge, LineEnd::Center, weight); } -// Draws `number` in the columns before the frame, or nothing when there is no -// line to name. +// Draws `number` in the columns before the frame when `numbered` is set, and +// nothing when there is no line to name. // // `points_here` is the leading part when its text is placed under this line. -// It draws `->` in the margin and colors the number to match the level word. +// It draws `->` in the margin, whether or not the line is numbered, and colors +// the number to match the level word. // Every other number keeps the frame's color, so the line to begin reading at // is the one that stands out from the frame. static auto DrawLineNumber(Buffer& buffer, int frame_x, int y, int number, - const PreparedPart* points_here) -> void { + bool numbered, const PreparedPart* points_here) + -> void { if (number <= 0) { return; } - std::string text = std::to_string(number); // The line the problem is on takes the leading part's color and weight, and // every other line number is left as light as the frame it belongs to, so // that the one being reported is the one that stands out rather than every // number competing with it. Style style = points_here ? points_here->style : FrameStyle().Bold(false); - buffer.DrawText(frame_x - 1 - text.size(), y, text, style); + if (numbered) { + std::string text = std::to_string(number); + buffer.DrawText(frame_x - 1 - text.size(), y, text, style); + } if (points_here) { buffer.DrawText(0, y, LineArrow, style); } @@ -1960,6 +1964,25 @@ auto Renderer::Render(Terminal::OutputBufferRef out, return; } + // Golden files use `LineNumbers::First`. Autoupdate rewrites only the first + // location row's line number as a `[[@LINE...]]` offset, and any other line + // number in a golden would change whenever a `CHECK` line is added above the + // line it names. So only that row keeps its line and column, every other + // location is reduced to its file name, and `FrameRenderer` omits the + // gutter's numbers. The rows and layout don't change. The compact form above + // keeps every line number, because autoupdate rewrites the location that + // starts each of its lines as an offset. + if (line_numbers_ == LineNumbers::First) { + bool location_kept = false; + for (PreparedPart& part : parts) { + if (HasLocationRow(part) && !location_kept && !part.location.empty()) { + location_kept = true; + } else { + part.location = FormatLocation({.filename = part.file}); + } + } + } + RenderFramed(out, parts, leading, diagnostic.level, frame_x, content_x, source_columns, columns); } @@ -1970,14 +1993,15 @@ namespace { class FrameRenderer { public: FrameRenderer(Buffer& buffer, Charset charset, int frame_x, int content_x, - int columns, Style dotted_frame_style) + int columns, Style dotted_frame_style, bool numbered) : buffer_(&buffer), glyphs_(Glyphs::For(charset)), charset_(charset), frame_x_(frame_x), content_x_(content_x), columns_(columns), - dotted_frame_style_(dotted_frame_style) {} + dotted_frame_style_(dotted_frame_style), + numbered_(numbered) {} // Draws `rows` from the buffer's first row, followed by the closing rule. auto Draw(llvm::ArrayRef rows) -> void; @@ -2043,6 +2067,9 @@ class FrameRenderer { // line's number also take. Style dotted_frame_style_; + // Whether source rows are drawn with their line numbers. + bool numbered_; + // The row the underlines were drawn on, which every label below it connects // back up to. A label can be several rows down from it, since the labels on // one underline row stack. @@ -2132,7 +2159,8 @@ auto FrameRenderer::DrawPath(const PreparedPart& part, int y) -> int { } auto FrameRenderer::DrawSource(const Row& row, int y) -> int { - DrawLineNumber(*buffer_, frame_x_, y, row.line_number, row.points_here); + DrawLineNumber(*buffer_, frame_x_, y, row.line_number, numbered_, + row.points_here); buffer_->DrawText(content_x_, y, row.text, Style()); return y + 1; } @@ -2327,7 +2355,8 @@ auto Renderer::RenderFramed(Terminal::OutputBufferRef out, .LayOut(); FrameRenderer(buffer, capabilities_.charset, frame_x, content_x, columns, - UnderlineStyle(parts[leading].style)) + UnderlineStyle(parts[leading].style), + /*numbered=*/line_numbers_ == LineNumbers::All) .Draw(rows); buffer.Render(out, capabilities_.color_mode); } diff --git a/toolchain/diagnostics/renderer.h b/toolchain/diagnostics/renderer.h index ec9e99ef5e67..fba521ba6309 100644 --- a/toolchain/diagnostics/renderer.h +++ b/toolchain/diagnostics/renderer.h @@ -5,6 +5,7 @@ #ifndef CARBON_TOOLCHAIN_DIAGNOSTICS_RENDERER_H_ #define CARBON_TOOLCHAIN_DIAGNOSTICS_RENDERER_H_ +#include #include #include "common/ostream.h" @@ -19,6 +20,17 @@ namespace Internal { struct PreparedPart; } // namespace Internal +// Which line numbers the framed form shows. +enum class LineNumbers : int8_t { + // Every line of source is numbered, and every location has its line and + // column. + All, + // Only the first location row that has a location keeps its line and + // column. The gutter has no numbers, and every other location shows only its + // file name. + First, +}; + // Draws diagnostics for a terminal. // // A diagnostic renders as one frame holding a snippet of each file it points @@ -73,9 +85,20 @@ class Renderer { // Sets whether diagnostics show snippets of the source they point at. With // them off, every diagnostic takes the compact form: one line per part, led // by its location and the extent of its range, positioned against nothing, - // which is what a build log and a golden file want. + // which suits a build log. auto set_snippets(bool value) -> void { snippets_ = value; } + // Sets which line numbers the framed form shows. The layout is the same + // either way. + // + // `LineNumbers::First` is for golden files. Adding a `CHECK` line changes the + // number of every source line below it, so a golden can only hold a line + // number as a `[[@LINE...]]` offset from its `CHECK` line. Autoupdate writes + // that offset for the first location row only: it doesn't rewrite gutter + // numbers, and a frame's `CHECK` lines are all in that row's file, so a + // location in another file has no offset from them. + auto set_line_numbers(LineNumbers value) -> void { line_numbers_ = value; } + auto set_capabilities(const Terminal::Capabilities& capabilities) -> void { capabilities_ = capabilities; } @@ -95,6 +118,7 @@ class Renderer { Terminal::Capabilities capabilities_; bool include_kind_ = false; bool snippets_ = true; + LineNumbers line_numbers_ = LineNumbers::All; }; // Returns `loc` as `::`, with the parts that are diff --git a/toolchain/diagnostics/renderer_fuzzer.cpp b/toolchain/diagnostics/renderer_fuzzer.cpp index 46c4c94682ba..1be54b333f4e 100644 --- a/toolchain/diagnostics/renderer_fuzzer.cpp +++ b/toolchain/diagnostics/renderer_fuzzer.cpp @@ -156,12 +156,15 @@ extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) { // The contract is that no shape of diagnostic, however malformed, is ever the // reason a compiler dies while reporting a problem. Every form has to hold to - // it, so both are drawn; a crash in either is a crash in the error path. + // it, so all of them are drawn; a crash in any is a crash in the error path. for (bool snippets : {true, false}) { - renderer.set_snippets(snippets); - llvm::SmallString<256> rendered; - Terminal::OutputBufferRef out(rendered); - renderer.Render(out, diagnostic); + for (LineNumbers line_numbers : {LineNumbers::All, LineNumbers::First}) { + renderer.set_snippets(snippets); + renderer.set_line_numbers(line_numbers); + llvm::SmallString<256> rendered; + Terminal::OutputBufferRef out(rendered); + renderer.Render(out, diagnostic); + } } return 0; diff --git a/toolchain/diagnostics/renderer_test.cpp b/toolchain/diagnostics/renderer_test.cpp index e765fe249de8..481433309033 100644 --- a/toolchain/diagnostics/renderer_test.cpp +++ b/toolchain/diagnostics/renderer_test.cpp @@ -91,15 +91,23 @@ static auto Narrow() -> Terminal::Capabilities { // Renders `diagnostic` for `capabilities`. static auto Render(const Terminal::Capabilities& capabilities, - const Diagnostic& diagnostic, bool snippets = true) - -> std::string { + const Diagnostic& diagnostic, bool snippets = true, + LineNumbers line_numbers = LineNumbers::All) -> std::string { Renderer renderer(capabilities); renderer.set_snippets(snippets); + renderer.set_line_numbers(line_numbers); llvm::SmallString<256> bytes; renderer.Render(bytes, diagnostic); return std::string(bytes); } +// Renders `diagnostic` framed, with `LineNumbers::First`. +static auto RenderUnnumbered(const Terminal::Capabilities& capabilities, + const Diagnostic& diagnostic) -> std::string { + return Render(capabilities, diagnostic, /*snippets=*/true, + LineNumbers::First); +} + // Renders a diagnostic with a single message at `level`. static auto RenderOne(const Terminal::Capabilities& capabilities, Level level, Loc loc, llvm::StringRef text) -> std::string { @@ -1166,6 +1174,106 @@ TEST(RendererTest, FirstContextMessageTakesTheDiagnosticLevel) { "note: the problem\n")); } +TEST(RendererTest, UnnumberedGutterStillPointsToTheReportedLine) { + Diagnostic diagnostic = { + .level = Level::Error, + .message = MakeMessage(At(3, 1, 2), "bad"), + .labels = {MakeLabel(LabelCategory::Info, At(1, 1, 2), "here")}}; + // The same rows in the same columns as `MergedShowsASingleSkippedLine`, + // with no numbers in the gutter. The `->` still points to the reported line. + EXPECT_THAT(RenderUnnumbered(Plain(), diagnostic), + Eq(" .-| foo.carbon:3:1\n" + " | fn Run0() {}\n" + " : -.\n" + " : '--| here\n" + " |\n" + "-> | fn Main() {\n" + " : ^^\n" + " : '--| error: bad\n" + " '----\n" + "")); +} + +TEST(RendererTest, UnnumberedFramesNameALaterFileAlone) { + Loc other = {.filename = "bar.carbon", + .line = "class C {", + .line_number = 9, + .column_number = 1, + .length = 9}; + Diagnostic diagnostic = { + .level = Level::Error, + .message = MakeMessage(At(4, 3, 7), "bad"), + .labels = {MakeLabel(LabelCategory::Info, other, "declared here")}}; + EXPECT_THAT(RenderUnnumbered(Plain(), diagnostic), + Eq(" .-| foo.carbon:4:3\n" + "-> | Run0(1);\n" + " : ^^^^^^^\n" + " : '--| error: bad\n" + " :\n" + " |-| bar.carbon\n" + " | class C {\n" + " : ----.----\n" + " : '--| declared here\n" + " '----\n" + "")); +} + +TEST(RendererTest, UnnumberedPathStepsKeepOnlyTheirFiles) { + Loc import_loc = {.filename = "c.carbon", + .line = "import library \"a\";", + .line_number = 1, + .column_number = 1, + .length = 6}; + Loc reported = {.filename = "a.carbon", + .line = "class Shape {}", + .line_number = 3, + .column_number = 1, + .length = 14}; + Diagnostic diagnostic = { + .level = Level::Error, + .message = MakeMessage(reported, "duplicate name", + {MakeOrigin(import_loc, "in import")})}; + // The step is drawn above the message's location row, but only the location + // row keeps its full location. + EXPECT_THAT(RenderUnnumbered(Plain(), diagnostic), + Eq(" | .-- in import: c.carbon\n" + " |-| a.carbon:3:1\n" + "-> | class Shape {}\n" + " : ^^^^^^^^^^^^^^\n" + " : '--| error: duplicate name\n" + " '----\n" + "")); +} + +TEST(RendererTest, UnnumberedFramesKeepTheFirstLocationRowsLocation) { + Diagnostic diagnostic = { + .level = Level::Error, + .message = MakeMessage({}, "bad"), + .labels = {MakeLabel(LabelCategory::Info, At(4, 3, 7), "here")}}; + // The message has no location, so its location row shows `` and + // gets the `->`. The label's location row is the first with a location, so it + // keeps that location in full; only the gutter's number is withheld. + EXPECT_THAT(Render(Plain(), diagnostic), Eq("-> .-| \n" + " : '--| error: bad\n" + " :\n" + " |-| foo.carbon:4:3\n" + " 4 | Run0(1);\n" + " : ---.---\n" + " : '--| here\n" + " '----\n" + "")); + EXPECT_THAT(RenderUnnumbered(Plain(), diagnostic), + Eq("-> .-| \n" + " : '--| error: bad\n" + " :\n" + " |-| foo.carbon:4:3\n" + " | Run0(1);\n" + " : ---.---\n" + " : '--| here\n" + " '----\n" + "")); +} + TEST(RendererTest, KindIsIncludedWhenAsked) { Renderer renderer(Plain()); renderer.set_include_kind(true); @@ -2508,6 +2616,22 @@ TEST(RendererTest, AControlByteInAFilenameCannotBreakTheFrame) { EXPECT_THAT(rendered, Not(HasSubstr("\n\n"))) << rendered; } +TEST(RendererTest, AControlByteInAnUnnumberedFilenameCannotBreakTheFrame) { + // With `LineNumbers::First`, a second file's location row shows only its + // filename, and the newline in the filename is drawn as a space. + Loc other = {.filename = "ab\ncd.carbon", + .line = "class C {", + .line_number = 9, + .column_number = 1, + .length = 9}; + Diagnostic diagnostic = { + .level = Level::Error, + .message = MakeMessage(At(4, 3, 7), "bad"), + .labels = {MakeLabel(LabelCategory::Info, other, "declared here")}}; + std::string rendered = RenderUnnumbered(Plain(), diagnostic); + EXPECT_THAT(rendered, HasSubstr("|-| ab cd.carbon\n")) << rendered; +} + TEST(RendererTest, AMergedPairWithoutFileTextStillElides) { // A single skipped line is shown in place of an elision row, but only when // `Loc::file_text` offers a way to find it; without it the elision row says diff --git a/toolchain/diagnostics/stream_consumer.h b/toolchain/diagnostics/stream_consumer.h index c236137439cf..b119063c5002 100644 --- a/toolchain/diagnostics/stream_consumer.h +++ b/toolchain/diagnostics/stream_consumer.h @@ -38,6 +38,9 @@ class StreamConsumer : public Consumer { auto set_diagnostic_snippets(bool value) -> void { renderer_.set_snippets(value); } + auto set_diagnostic_line_numbers(LineNumbers value) -> void { + renderer_.set_line_numbers(value); + } private: llvm::raw_ostream* stream_; diff --git a/toolchain/diagnostics/testdata/fail_rendering.carbon b/toolchain/diagnostics/testdata/fail_rendering.carbon index 33f63bd4a49c..90735c606b08 100644 --- a/toolchain/diagnostics/testdata/fail_rendering.carbon +++ b/toolchain/diagnostics/testdata/fail_rendering.carbon @@ -4,7 +4,7 @@ // // INCLUDE-FILE: toolchain/testing/testdata/min_prelude/int.carbon // -// ARGS: --include-diagnostic-kind --diagnostic-snippets compile --phase=check %s +// ARGS: --include-diagnostic-kind --diagnostic-snippets --terminal-unicode=never compile --phase=check %s // // AUTOUPDATE // TIP: To test this file alone, run: @@ -12,8 +12,9 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/diagnostics/testdata/fail_rendering.carbon -// Covers how diagnostics are drawn, which the rest of the test suite turns off. -// See /toolchain/docs/diagnostics_rendering.md. +// Covers the numbered ASCII form a plain stream gets. Other file tests capture +// box drawing, and those outside this directory have no line numbers. See +// /toolchain/docs/diagnostics_rendering.md. // --- fail_one_message.carbon diff --git a/toolchain/docs/diagnostics_rendering.md b/toolchain/docs/diagnostics_rendering.md index c730d269e63f..9bbc2496192f 100644 --- a/toolchain/docs/diagnostics_rendering.md +++ b/toolchain/docs/diagnostics_rendering.md @@ -58,10 +58,9 @@ The audience for a rendered diagnostic is a person glancing at an error. Editors get diagnostics from the [language server](/toolchain/language_server) as structure, so editor integration is out of scope, and so is what a complete build should give an agent, which is a separate question. A build log gets one -line per fact from [`--no-diagnostic-snippets`](#the-compact-form), and a golden -test file gets the drawing without the parts that a moved line would re-render, -from -[`--no-diagnostic-line-numbers`](#testing). +line per fact from [`--no-diagnostic-snippets`](#the-compact-form), and golden +test files use [`--diagnostic-line-numbers=first`](#testing), which drops the +line numbers that change when a line moves. ## What a diagnostic is made of @@ -720,9 +719,10 @@ interleaves with another writer. `COLORFGBG` by default and assumed dark otherwise. - `--no-diagnostic-snippets` renders every diagnostic in [the compact form](#the-compact-form). -- `--no-diagnostic-line-numbers` withholds the gutter's numbers and names any - later file without a position, leaving the layout the same as the numbered - one. This is the form [golden files capture](#testing). +- `--diagnostic-line-numbers=first` keeps the line and column only in the + first location row. The gutter has no numbers, and every later location + shows only its filename. The layout doesn't change. + [Golden files](#testing) use this form. - `--include-diagnostic-kind` appends each part's kind, `[NameNotFound]`, dim. Tests match on it. @@ -738,12 +738,13 @@ renders without crashing. File tests cover the rendering end to end. `toolchain/diagnostics/testdata` keeps full numbering, and its `fail_rendering.carbon` checks the ASCII form. Every other `file_test` runs with `--terminal-unicode=always` and -`--no-diagnostic-line-numbers`, so its goldens are the frames nearly every -terminal gets, with one location apiece, the leading location row's, which -autoupdate maintains as a `[[@LINE...]]` offset. Full numbering would make a -golden depend on the positions of its own `CHECK` lines, and a location row in a -second file names lines no offset can express. The rows above the leading -location row, the path, take its location in +`--diagnostic-line-numbers=first`. Its goldens show the box drawing that nearly +every terminal supports, and one line number per frame, in the leading location +row, which autoupdate rewrites as a `[[@LINE...]]` offset. Adding a `CHECK` line +changes the number of every source line below it, which would change the +gutter's numbers. A frame's `CHECK` lines are all in the leading location row's +file, so a location in another file has no offset from them. The rows above the +leading location row, the path, take its location in `ToolchainFileTest::FinalizeCheckLines` so a frame moves as one block. Goldens differ from what a user sees in two ways: every file test also passes diff --git a/toolchain/driver/driver.cpp b/toolchain/driver/driver.cpp index 1e6a634b3430..1f36715ebbb5 100644 --- a/toolchain/driver/driver.cpp +++ b/toolchain/driver/driver.cpp @@ -12,6 +12,7 @@ #include "common/command_line.h" #include "common/pretty_stack_trace_function.h" #include "common/version.h" +#include "toolchain/diagnostics/renderer.h" #include "toolchain/diagnostics/stream_consumer.h" #include "toolchain/driver/build_runtimes_subcommand.h" #include "toolchain/driver/build_subcommand.h" @@ -36,6 +37,8 @@ struct Options { bool fuzzing = false; bool include_diagnostic_kind = false; bool diagnostic_snippets = true; + Diagnostics::LineNumbers diagnostic_line_numbers = + Diagnostics::LineNumbers::All; bool threads = true; bool build_runtimes_on_demand = false; @@ -148,7 +151,7 @@ By default a diagnostic shows one view of each file it points into, with the lines between its ranges elided, so a message and a label near it read as one piece of code. `--no-diagnostic-snippets` drops that: each part of a diagnostic is one line, led by its location and the extent of its range, positioned -against nothing, which is what a build log and a golden file want. +against nothing, which suits a build log. )""", }, [&](auto& arg_b) { @@ -156,6 +159,31 @@ against nothing, which is what a build log and a golden file want. arg_b.Set(&diagnostic_snippets); }); + b.AddOneOfOption( + { + .name = "diagnostic-line-numbers", + .value_name = "(all|first)", + .help = R"""( +Which line numbers diagnostics show. + +By default every line of source shown is numbered, and every location has its +line and column. With `first`, only the first location in each diagnostic keeps +its line and column, normally the one it is reported at. The lines of source are +unnumbered, and every other location shows only its file name. Golden test +files use `first` so that their expected output doesn't change when lines of a +test move. +)""", + }, + [&](auto& arg_b) { + arg_b.SetOneOf( + { + arg_b.OneOfValue("all", Diagnostics::LineNumbers::All) + .Default(true), + arg_b.OneOfValue("first", Diagnostics::LineNumbers::First), + }, + &diagnostic_line_numbers); + }); + b.AddOneOfOption( { .name = "terminal-background", @@ -358,6 +386,7 @@ auto Driver::RunCommand(llvm::ArrayRef args) -> DriverResult { // flag and render for whatever is behind the error stream. consumer.set_include_diagnostic_kind(options.include_diagnostic_kind); consumer.set_diagnostic_snippets(options.diagnostic_snippets); + consumer.set_diagnostic_line_numbers(options.diagnostic_line_numbers); consumer.set_capabilities(ErrorCapabilities(options.terminal)); if (env.installation->error()) { diff --git a/toolchain/driver/testdata/fail_errors_in_two_files.carbon b/toolchain/driver/testdata/fail_errors_in_two_files.carbon index cd8c27ba24b3..848c0b2e0ba8 100644 --- a/toolchain/driver/testdata/fail_errors_in_two_files.carbon +++ b/toolchain/driver/testdata/fail_errors_in_two_files.carbon @@ -26,8 +26,20 @@ var x = 3a; // --- AUTOUPDATE-SPLIT -// CHECK:STDERR: fail_file1.carbon:2:24: error: opening symbol without a corresponding closing symbol -// CHECK:STDERR: fail_file1.carbon:4:1: note: possibly missing `}` here +// CHECK:STDERR: ╭─┤ fail_file1.carbon:2:24 +// CHECK:STDERR: -> │ fn run(String program) { +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: opening symbol without a corresponding +// CHECK:STDERR: · ┃ closing symbol +// CHECK:STDERR: │ return True; +// CHECK:STDERR: │ +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ possibly missing `}` here +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_file2.carbon:2:10: error: invalid digit 'a' in decimal numeric literal +// CHECK:STDERR: ╭─┤ fail_file2.carbon:2:10 +// CHECK:STDERR: -> │ var x = 3a; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: invalid digit 'a' in decimal numeric literal +// CHECK:STDERR: ╰──── // CHECK:STDERR: diff --git a/toolchain/driver/testdata/fail_errors_sorted.carbon b/toolchain/driver/testdata/fail_errors_sorted.carbon index e061506121d6..53cc21429e81 100644 --- a/toolchain/driver/testdata/fail_errors_sorted.carbon +++ b/toolchain/driver/testdata/fail_errors_sorted.carbon @@ -24,8 +24,20 @@ var x = 3a; // --- AUTOUPDATE-SPLIT -// CHECK:STDERR: fail_errors_sorted.carbon:2:24: error: opening symbol without a corresponding closing symbol -// CHECK:STDERR: fail_errors_sorted.carbon:4:1: note: possibly missing `}` here +// CHECK:STDERR: ╭─┤ fail_errors_sorted.carbon:2:24 +// CHECK:STDERR: -> │ fn run(String program) { +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: opening symbol without a corresponding +// CHECK:STDERR: · ┃ closing symbol +// CHECK:STDERR: │ return True; +// CHECK:STDERR: │ +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ possibly missing `}` here +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_errors_sorted.carbon:5:10: error: invalid digit 'a' in decimal numeric literal +// CHECK:STDERR: ╭─┤ fail_errors_sorted.carbon:5:10 +// CHECK:STDERR: -> │ var x = 3a; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: invalid digit 'a' in decimal numeric literal +// CHECK:STDERR: ╰──── // CHECK:STDERR: diff --git a/toolchain/driver/testdata/fail_errors_streamed.carbon b/toolchain/driver/testdata/fail_errors_streamed.carbon index ab622131a79c..13ecaaeb0422 100644 --- a/toolchain/driver/testdata/fail_errors_streamed.carbon +++ b/toolchain/driver/testdata/fail_errors_streamed.carbon @@ -13,9 +13,21 @@ fn run(String program) { return True; -// CHECK:STDERR: fail_errors_streamed.carbon:[[@LINE+5]]:10: error: invalid digit 'a' in decimal numeric literal +// CHECK:STDERR: ╭─┤ fail_errors_streamed.carbon:[[@LINE+17]]:10 +// CHECK:STDERR: -> │ var x = 3a; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: invalid digit 'a' in decimal numeric literal +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_errors_streamed.carbon:[[@LINE-5]]:24: error: opening symbol without a corresponding closing symbol -// CHECK:STDERR: fail_errors_streamed.carbon:[[@LINE-4]]:1: note: possibly missing `}` here +// CHECK:STDERR: ╭─┤ fail_errors_streamed.carbon:[[@LINE-9]]:24 +// CHECK:STDERR: -> │ fn run(String program) { +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: opening symbol without a corresponding +// CHECK:STDERR: · ┃ closing symbol +// CHECK:STDERR: │ return True; +// CHECK:STDERR: │ +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ possibly missing `}` here +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x = 3a; diff --git a/toolchain/driver/testdata/fail_flush_errors.carbon b/toolchain/driver/testdata/fail_flush_errors.carbon index 655e75486ea6..1ac0ecc6a159 100644 --- a/toolchain/driver/testdata/fail_flush_errors.carbon +++ b/toolchain/driver/testdata/fail_flush_errors.carbon @@ -16,23 +16,41 @@ fn F() { // Create diagnostics containing string references, and trigger reallocation // of the string table. - // CHECK:STDERR: fail_flush_errors.carbon:[[@LINE+2]]:3-13: error: name `undeclared1` not found [NameNotFound] + // CHECK:STDERR: ╭─┤ fail_flush_errors.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ undeclared1; + // CHECK:STDERR: · ━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: name `undeclared1` not found [NameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: undeclared1; // Add the name into the string table from the tokenized buffer's string // literal storage. Use a hex escape to ensure that the tokenized buffer // allocates separate storage for the result. - // CHECK:STDERR: fail_flush_errors.carbon:[[@LINE+2]]:3-18: error: `Core.String` implicitly referenced here, but package `Core` not found [CoreNotFound] + // CHECK:STDERR: ╭─┤ fail_flush_errors.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ "undec\x6Cared2"; + // CHECK:STDERR: · ┳━━━━━━━━━━━━━━━ + // CHECK:STDERR: · ┗━━┫ error: `Core.String` implicitly referenced here, but package `Core` not + // CHECK:STDERR: · ┃ found + // CHECK:STDERR: · ┃ [CoreNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: "undec\x6Cared2"; - // CHECK:STDERR: fail_flush_errors.carbon:[[@LINE+2]]:3-13: error: name `undeclared2` not found [NameNotFound] + // CHECK:STDERR: ╭─┤ fail_flush_errors.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ undeclared2; + // CHECK:STDERR: · ━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: name `undeclared2` not found [NameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: undeclared2; // Add the name into the string table via a declaration rather than an expression. if (true) { let unused undeclared3: () = (); } - // CHECK:STDERR: fail_flush_errors.carbon:[[@LINE+2]]:3-13: error: name `undeclared3` not found [NameNotFound] + // CHECK:STDERR: ╭─┤ fail_flush_errors.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ undeclared3; + // CHECK:STDERR: · ━━━━━┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: name `undeclared3` not found [NameNotFound] + // CHECK:STDERR: ╰──── // CHECK:STDERR: undeclared3; } diff --git a/toolchain/format/testdata/basics/fail_invalid_comment.carbon b/toolchain/format/testdata/basics/fail_invalid_comment.carbon index 02adf80ba973..337659401d6a 100644 --- a/toolchain/format/testdata/basics/fail_invalid_comment.carbon +++ b/toolchain/format/testdata/basics/fail_invalid_comment.carbon @@ -14,7 +14,12 @@ // --- AUTOUPDATE-SPLIT -// CHECK:STDERR: fail_test.carbon:2:3: error: whitespace is required after '//' [NoWhitespaceAfterCommentIntroducer] +// CHECK:STDERR: ╭─┤ fail_test.carbon:2:3 +// CHECK:STDERR: -> │ //f +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: whitespace is required after '//' +// CHECK:STDERR: · ┃ [NoWhitespaceAfterCommentIntroducer] +// CHECK:STDERR: ╰──── // CHECK:STDERR: // CHECK:STDOUT: // CHECK:STDOUT: //f diff --git a/toolchain/lex/testdata/char_literals.carbon b/toolchain/lex/testdata/char_literals.carbon index 4f91bc9907ca..8b56f01b4d3d 100644 --- a/toolchain/lex/testdata/char_literals.carbon +++ b/toolchain/lex/testdata/char_literals.carbon @@ -33,84 +33,162 @@ // CHECK:STDOUT: - filename: fail_invalid.carbon // CHECK:STDOUT: tokens: -// CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:1: error: escape sequence `\x` in character literal; specify as escape sequence `\u{70}` [CharLiteralHexEscape] +// CHECK:STDERR: ╭─┤ fail_invalid.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ '\x70' +// CHECK:STDERR: · ┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: escape sequence `\x` in character literal; specify as escape +// CHECK:STDERR: · ┃ sequence `\u{70}` +// CHECK:STDERR: · ┃ [CharLiteralHexEscape] +// CHECK:STDERR: ╰──── // CHECK:STDERR: '\x70' // CHECK:STDOUT: - { index: 1, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "'\\x70'", has_leading_space: true } -// CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:1: error: incomplete UTF-8 [CharLiteralUnderflow] +// CHECK:STDERR: ╭─┤ fail_invalid.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ '\xC3' +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: incomplete UTF-8 [CharLiteralUnderflow] +// CHECK:STDERR: ╰──── // CHECK:STDERR: '\xC3' // CHECK:STDOUT: - { index: 2, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "'\\xC3'", has_leading_space: true } -// CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:1: error: escape sequence `\x` in character literal; specify as escape sequence `\u{E9}` [CharLiteralHexEscape] +// CHECK:STDERR: ╭─┤ fail_invalid.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ '\xC3\xA9' +// CHECK:STDERR: · ┳━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: escape sequence `\x` in character literal; specify as escape +// CHECK:STDERR: · ┃ sequence `\u{E9}` +// CHECK:STDERR: · ┃ [CharLiteralHexEscape] +// CHECK:STDERR: ╰──── // CHECK:STDERR: '\xC3\xA9' // CHECK:STDOUT: - { index: 3, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "'\\xC3\\xA9'", has_leading_space: true } -// CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:1: error: invalid UTF-8 character [CharLiteralInvalidUTF8] +// CHECK:STDERR: ╭─┤ fail_invalid.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ '\xC3\xFF' +// CHECK:STDERR: · ━━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid UTF-8 character [CharLiteralInvalidUTF8] +// CHECK:STDERR: ╰──── // CHECK:STDERR: '\xC3\xFF' // CHECK:STDOUT: - { index: 4, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "'\\xC3\\xFF'", has_leading_space: true } -// CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:2: error: empty character literal [CharLiteralEmpty] +// CHECK:STDERR: ╭─┤ fail_invalid.carbon:[[@LINE+6]]:2 +// CHECK:STDERR: -> │ '' +// CHECK:STDERR: · ━┳ +// CHECK:STDERR: · ┗━━┫ error: empty character literal [CharLiteralEmpty] +// CHECK:STDERR: ╰──── // CHECK:STDERR: '' // CHECK:STDOUT: - { index: 5, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "''", has_leading_space: true } -// CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:1: error: too many characters [CharLiteralOverflow] +// CHECK:STDERR: ╭─┤ fail_invalid.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ 'abcde' +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: too many characters [CharLiteralOverflow] +// CHECK:STDERR: ╰──── // CHECK:STDERR: 'abcde' // CHECK:STDOUT: - { index: 6, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "'abcde'", has_leading_space: true } -// CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:1: error: unexpected `#` before character literal [CharLiteralRaw] +// CHECK:STDERR: ╭─┤ fail_invalid.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ #'a'# +// CHECK:STDERR: · ━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: unexpected `#` before character literal [CharLiteralRaw] +// CHECK:STDERR: ╰──── // CHECK:STDERR: #'a'# // CHECK:STDOUT: - { index: 7, kind: "CharLiteral", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "#'a'#", has_leading_space: true } -// CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:1: error: unexpected `#` before character literal [CharLiteralRaw] +// CHECK:STDERR: ╭─┤ fail_invalid.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ #'\'# +// CHECK:STDERR: · ━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: unexpected `#` before character literal [CharLiteralRaw] +// CHECK:STDERR: ╰──── // CHECK:STDERR: #'\'# // CHECK:STDOUT: - { index: 8, kind: "CharLiteral", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "#'\\'#", has_leading_space: true } -// CHECK:STDERR: fail_invalid.carbon:[[@LINE+4]]:1: error: unexpected `#` before character literal [CharLiteralRaw] +// CHECK:STDERR: ╭─┤ fail_invalid.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: -> │ ##''## +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: unexpected `#` before character literal [CharLiteralRaw] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:4: error: empty character literal [CharLiteralEmpty] +// CHECK:STDERR: ╭─┤ fail_invalid.carbon:[[@LINE+6]]:4 +// CHECK:STDERR: -> │ ##''## +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: empty character literal [CharLiteralEmpty] +// CHECK:STDERR: ╰──── // CHECK:STDERR: ##''## // CHECK:STDOUT: - { index: 9, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "##''##", has_leading_space: true } -// CHECK:STDERR: fail_invalid.carbon:[[@LINE+4]]:1: error: unexpected `#` before character literal [CharLiteralRaw] +// CHECK:STDERR: ╭─┤ fail_invalid.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: -> │ #'foo\'# +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: unexpected `#` before character literal [CharLiteralRaw] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:1: error: too many characters [CharLiteralOverflow] +// CHECK:STDERR: ╭─┤ fail_invalid.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ #'foo\'# +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: too many characters [CharLiteralOverflow] +// CHECK:STDERR: ╰──── // CHECK:STDERR: #'foo\'# // CHECK:STDOUT: - { index: 10, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "#'foo\\'#", has_leading_space: true } -// CHECK:STDERR: fail_invalid.carbon:[[@LINE+4]]:1: error: unexpected `#` before character literal [CharLiteralRaw] +// CHECK:STDERR: ╭─┤ fail_invalid.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: -> │ ##'#\'## +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: unexpected `#` before character literal [CharLiteralRaw] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:1: error: too many characters [CharLiteralOverflow] +// CHECK:STDERR: ╭─┤ fail_invalid.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ ##'#\'## +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: too many characters [CharLiteralOverflow] +// CHECK:STDERR: ╰──── // CHECK:STDERR: ##'#\'## // CHECK:STDOUT: - { index: 11, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "##'#\\'##", has_leading_space: true } -// CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:2: error: character literal is missing a terminator [UnterminatedString] +// CHECK:STDERR: ╭─┤ fail_invalid.carbon:[[@LINE+6]]:2 +// CHECK:STDERR: -> │ ' +// CHECK:STDERR: · ╴╻ +// CHECK:STDERR: · ┗━━┫ error: character literal is missing a terminator [UnterminatedString] +// CHECK:STDERR: ╰──── // CHECK:STDERR: ' // CHECK:STDOUT: - { index: 12, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "'", has_leading_space: true } -// CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:4: error: character literal is missing a terminator [UnterminatedString] +// CHECK:STDERR: ╭─┤ fail_invalid.carbon:[[@LINE+6]]:4 +// CHECK:STDERR: -> │ '\' +// CHECK:STDERR: · ──╴╻ +// CHECK:STDERR: · ┗━━┫ error: character literal is missing a terminator [UnterminatedString] +// CHECK:STDERR: ╰──── // CHECK:STDERR: '\' // CHECK:STDOUT: - { index: 13, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "'\\'", has_leading_space: true } -// CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:3: error: character literal is missing a terminator [UnterminatedString] +// CHECK:STDERR: ╭─┤ fail_invalid.carbon:[[@LINE+6]]:3 +// CHECK:STDERR: -> │ '\ +// CHECK:STDERR: · ─╴╻ +// CHECK:STDERR: · ┗━━┫ error: character literal is missing a terminator [UnterminatedString] +// CHECK:STDERR: ╰──── // CHECK:STDERR: '\ // CHECK:STDOUT: - { index: 14, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "'\\", has_leading_space: true } // This literal contains a raw tab character. -// CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:2: error: whitespace other than plain space must be expressed with an escape sequence in a string literal [InvalidHorizontalWhitespaceInString] +// CHECK:STDERR: ╭─┤ fail_invalid.carbon:[[@LINE+8]]:2 +// CHECK:STDERR: -> │ ' ' +// CHECK:STDERR: · ┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: whitespace other than plain space must be expressed with an escape +// CHECK:STDERR: · ┃ sequence in a string literal +// CHECK:STDERR: · ┃ [InvalidHorizontalWhitespaceInString] +// CHECK:STDERR: ╰──── // CHECK:STDERR: ' ' // CHECK:STDOUT: - { index: 15, kind: "CharLiteral", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "'\t'", has_leading_space: true } diff --git a/toolchain/lex/testdata/dollar_int_literals.carbon b/toolchain/lex/testdata/dollar_int_literals.carbon index c4e9d6b84c14..d738ae8d17cd 100644 --- a/toolchain/lex/testdata/dollar_int_literals.carbon +++ b/toolchain/lex/testdata/dollar_int_literals.carbon @@ -26,52 +26,110 @@ $999999999999 // CHECK:STDOUT: - filename: fail_invalid.carbon // CHECK:STDOUT: tokens: -// CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:2: error: expected digits after `$` [DollarIntLiteralMissingNumber] +// CHECK:STDERR: ╭─┤ fail_invalid.carbon:[[@LINE+6]]:2 +// CHECK:STDERR: -> │ $ +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected digits after `$` [DollarIntLiteralMissingNumber] +// CHECK:STDERR: ╰──── // CHECK:STDERR: $ // CHECK:STDOUT: - { index: 1, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "$", has_leading_space: true } -// CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:2: error: expected digits after `$` [DollarIntLiteralMissingNumber] +// CHECK:STDERR: ╭─┤ fail_invalid.carbon:[[@LINE+6]]:2 +// CHECK:STDERR: -> │ $ 1 +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected digits after `$` [DollarIntLiteralMissingNumber] +// CHECK:STDERR: ╰──── // CHECK:STDERR: $ 1 // CHECK:STDOUT: - { index: 2, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "$", has_leading_space: true } // CHECK:STDOUT: - { index: 3, kind: "IntLiteral", line: {{ *}}[[@LINE-2]], column: 3, indent: 1, spelling: "1", value: "1", has_leading_space: true } -// CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:2: error: positional parameters can only contain digits after `$` [InvalidCharacterInDollarIntLiteral] +// CHECK:STDERR: ╭─┤ fail_invalid.carbon:[[@LINE+7]]:2 +// CHECK:STDERR: -> │ $foo +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: positional parameters can only contain digits after `$` +// CHECK:STDERR: · ┃ [InvalidCharacterInDollarIntLiteral] +// CHECK:STDERR: ╰──── // CHECK:STDERR: $foo // CHECK:STDOUT: - { index: 4, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "$foo", has_leading_space: true } -// CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:2: error: positional parameters can only contain digits after `$` [InvalidCharacterInDollarIntLiteral] +// CHECK:STDERR: ╭─┤ fail_invalid.carbon:[[@LINE+7]]:2 +// CHECK:STDERR: -> │ $1a32 +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: positional parameters can only contain digits after `$` +// CHECK:STDERR: · ┃ [InvalidCharacterInDollarIntLiteral] +// CHECK:STDERR: ╰──── // CHECK:STDERR: $1a32 // CHECK:STDOUT: - { index: 5, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "$1a32", has_leading_space: true } -// CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:2: error: leading zeroes are not allowed in positional parameters [DollarIntLiteralLeadingZero] +// CHECK:STDERR: ╭─┤ fail_invalid.carbon:[[@LINE+7]]:2 +// CHECK:STDERR: -> │ $00 +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: leading zeroes are not allowed in positional parameters +// CHECK:STDERR: · ┃ [DollarIntLiteralLeadingZero] +// CHECK:STDERR: ╰──── // CHECK:STDERR: $00 // CHECK:STDOUT: - { index: 6, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "$00", has_leading_space: true } -// CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:2: error: leading zeroes are not allowed in positional parameters [DollarIntLiteralLeadingZero] +// CHECK:STDERR: ╭─┤ fail_invalid.carbon:[[@LINE+7]]:2 +// CHECK:STDERR: -> │ $025321 +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: leading zeroes are not allowed in positional parameters +// CHECK:STDERR: · ┃ [DollarIntLiteralLeadingZero] +// CHECK:STDERR: ╰──── // CHECK:STDERR: $025321 // CHECK:STDOUT: - { index: 7, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "$025321", has_leading_space: true } -// CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:2: error: leading zeroes are not allowed in positional parameters [DollarIntLiteralLeadingZero] +// CHECK:STDERR: ╭─┤ fail_invalid.carbon:[[@LINE+7]]:2 +// CHECK:STDERR: -> │ $0x12 +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: leading zeroes are not allowed in positional parameters +// CHECK:STDERR: · ┃ [DollarIntLiteralLeadingZero] +// CHECK:STDERR: ╰──── // CHECK:STDERR: $0x12 // CHECK:STDOUT: - { index: 8, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "$0x12", has_leading_space: true } -// CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:2: error: leading zeroes are not allowed in positional parameters [DollarIntLiteralLeadingZero] +// CHECK:STDERR: ╭─┤ fail_invalid.carbon:[[@LINE+7]]:2 +// CHECK:STDERR: -> │ $0b1100 +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: leading zeroes are not allowed in positional parameters +// CHECK:STDERR: · ┃ [DollarIntLiteralLeadingZero] +// CHECK:STDERR: ╰──── // CHECK:STDERR: $0b1100 // CHECK:STDOUT: - { index: 9, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "$0b1100", has_leading_space: true } -// CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:2: error: invalid digit '$' in decimal numeric literal [InvalidDigit] +// CHECK:STDERR: ╭─┤ fail_invalid.carbon:[[@LINE+6]]:2 +// CHECK:STDERR: -> │ 2$63 +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: invalid digit '$' in decimal numeric literal [InvalidDigit] +// CHECK:STDERR: ╰──── // CHECK:STDERR: 2$63 // CHECK:STDOUT: - { index: 10, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "2$63", has_leading_space: true } -// CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:4: error: `$` is only allowed at the start of a positional parameter [CharacterOnlyAllowedAtStart] +// CHECK:STDERR: ╭─┤ fail_invalid.carbon:[[@LINE+7]]:4 +// CHECK:STDERR: -> │ abc$37 +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `$` is only allowed at the start of a positional parameter +// CHECK:STDERR: · ┃ [CharacterOnlyAllowedAtStart] +// CHECK:STDERR: ╰──── // CHECK:STDERR: abc$37 // CHECK:STDOUT: - { index: 11, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "abc$37" } -// CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:6: error: `$` is only allowed at the start of a positional parameter [CharacterOnlyAllowedAtStart] +// CHECK:STDERR: ╭─┤ fail_invalid.carbon:[[@LINE+7]]:6 +// CHECK:STDERR: -> │ r#foo$0 +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `$` is only allowed at the start of a positional parameter +// CHECK:STDERR: · ┃ [CharacterOnlyAllowedAtStart] +// CHECK:STDERR: ╰──── // CHECK:STDERR: r#foo$0 // CHECK:STDOUT: - { index: 12, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "r#foo$0" } -// CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:2: error: found a positional parameter using 19 digits, which is greater than the limit of 18 [TooManyDollarIntDigits] +// CHECK:STDERR: ╭─┤ fail_invalid.carbon:[[@LINE+8]]:2 +// CHECK:STDERR: -> │ $9999999999999999999 +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: found a positional parameter using 19 digits, which is greater than +// CHECK:STDERR: · ┃ the limit of 18 +// CHECK:STDERR: · ┃ [TooManyDollarIntDigits] +// CHECK:STDERR: ╰──── // CHECK:STDERR: $9999999999999999999 // CHECK:STDOUT: - { index: 13, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "$9999999999999999999", has_leading_space: true } diff --git a/toolchain/lex/testdata/dump_sem_ir_range.carbon b/toolchain/lex/testdata/dump_sem_ir_range.carbon index 8884b39477e1..8ec54cc5415f 100644 --- a/toolchain/lex/testdata/dump_sem_ir_range.carbon +++ b/toolchain/lex/testdata/dump_sem_ir_range.carbon @@ -63,7 +63,12 @@ e // CHECK:STDOUT: - filename: fail_extra_text.carbon // CHECK:STDOUT: tokens: -// CHECK:STDERR: fail_extra_text.carbon:[[@LINE+2]]:3: error: whitespace is required after '//' [NoWhitespaceAfterCommentIntroducer] +// CHECK:STDERR: ╭─┤ fail_extra_text.carbon:[[@LINE+7]]:3 +// CHECK:STDERR: -> │ //@dump-sem-ir-begin more text +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: whitespace is required after '//' +// CHECK:STDERR: · ┃ [NoWhitespaceAfterCommentIntroducer] +// CHECK:STDERR: ╰──── // CHECK:STDERR: //@dump-sem-ir-begin more text @@ -74,14 +79,24 @@ e // CHECK:STDOUT: - {begin: 1, end: 0} //@dump-sem-ir-begin -// CHECK:STDERR: fail_start_only.carbon:[[@LINE+2]]:1: error: missing `//@dump-sem-ir-end` to match `//@dump-sem-ir-begin` [DumpSemIRRangeMissingEnd] +// CHECK:STDERR: ╭─┤ fail_start_only.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: missing `//@dump-sem-ir-end` to match `//@dump-sem-ir-begin` +// CHECK:STDERR: · ┃ [DumpSemIRRangeMissingEnd] +// CHECK:STDERR: ╰──── // CHECK:STDERR: // --- fail_end_only.carbon // CHECK:STDOUT: - filename: fail_end_only.carbon // CHECK:STDOUT: tokens: -// CHECK:STDERR: fail_end_only.carbon:[[@LINE+2]]:1: error: missing `//@dump-sem-ir-begin` to match `//@dump-sem-ir-end` [DumpSemIRRangeMissingBegin] +// CHECK:STDERR: ╭─┤ fail_end_only.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ //@dump-sem-ir-end +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: missing `//@dump-sem-ir-begin` to match `//@dump-sem-ir-end` +// CHECK:STDERR: · ┃ [DumpSemIRRangeMissingBegin] +// CHECK:STDERR: ╰──── // CHECK:STDERR: //@dump-sem-ir-end @@ -94,7 +109,12 @@ a //@dump-sem-ir-begin b // CHECK:STDOUT: - { index: 2, kind: "Identifier", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "b", identifier: 1, has_leading_space: true } -// CHECK:STDERR: fail_misordered.carbon:[[@LINE+2]]:1: error: missing `//@dump-sem-ir-end` to match `//@dump-sem-ir-begin` [DumpSemIRRangeMissingEnd] +// CHECK:STDERR: ╭─┤ fail_misordered.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ //@dump-sem-ir-begin +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: missing `//@dump-sem-ir-end` to match `//@dump-sem-ir-begin` +// CHECK:STDERR: · ┃ [DumpSemIRRangeMissingEnd] +// CHECK:STDERR: ╰──── // CHECK:STDERR: //@dump-sem-ir-begin c @@ -102,7 +122,12 @@ c //@dump-sem-ir-end d // CHECK:STDOUT: - { index: 4, kind: "Identifier", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "d", identifier: 3, has_leading_space: true } -// CHECK:STDERR: fail_misordered.carbon:[[@LINE+2]]:1: error: missing `//@dump-sem-ir-begin` to match `//@dump-sem-ir-end` [DumpSemIRRangeMissingBegin] +// CHECK:STDERR: ╭─┤ fail_misordered.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ //@dump-sem-ir-end +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: missing `//@dump-sem-ir-begin` to match `//@dump-sem-ir-end` +// CHECK:STDERR: · ┃ [DumpSemIRRangeMissingBegin] +// CHECK:STDERR: ╰──── // CHECK:STDERR: //@dump-sem-ir-end e @@ -130,5 +155,11 @@ d // CHECK:STDOUT: - {begin: 2, end: 2} // CHECK:STDOUT: - {begin: 4, end: 4} -// CHECK:STDERR: fail_count_mismatch.carbon:[[@LINE+1]]:17: error: missing `//@dump-sem-ir-end` to match `//@dump-sem-ir-begin` [DumpSemIRRangeMissingEnd] +// CHECK:STDERR: ╭─┤ fail_count_mismatch.carbon:[[@LINE+7]]:17 +// CHECK:STDERR: -> │ // CHECK:STDERR: +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: missing `//@dump-sem-ir-end` to match +// CHECK:STDERR: · ┃ `//@dump-sem-ir-begin` +// CHECK:STDERR: · ┃ [DumpSemIRRangeMissingEnd] +// CHECK:STDERR: ╰──── // CHECK:STDERR: diff --git a/toolchain/lex/testdata/fail_bad_comment_introducers.carbon b/toolchain/lex/testdata/fail_bad_comment_introducers.carbon index 613067ddbe29..452df0390827 100644 --- a/toolchain/lex/testdata/fail_bad_comment_introducers.carbon +++ b/toolchain/lex/testdata/fail_bad_comment_introducers.carbon @@ -10,24 +10,44 @@ // // Comments have to have whitespace after `//` currently. -// CHECK:STDERR: fail_bad_comment_introducers.carbon:[[@LINE+2]]:3: error: whitespace is required after '//' [NoWhitespaceAfterCommentIntroducer] +// CHECK:STDERR: ╭─┤ fail_bad_comment_introducers.carbon:[[@LINE+7]]:3 +// CHECK:STDERR: -> │ //abc +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: whitespace is required after '//' +// CHECK:STDERR: · ┃ [NoWhitespaceAfterCommentIntroducer] +// CHECK:STDERR: ╰──── // CHECK:STDERR: //abc - // CHECK:STDERR: fail_bad_comment_introducers.carbon:[[@LINE+2]]:7: error: whitespace is required after '//' [NoWhitespaceAfterCommentIntroducer] + // CHECK:STDERR: ╭─┤ fail_bad_comment_introducers.carbon:[[@LINE+7]]:7 + // CHECK:STDERR: -> │ //indented + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: whitespace is required after '//' + // CHECK:STDERR: · ┃ [NoWhitespaceAfterCommentIntroducer] + // CHECK:STDERR: ╰──── // CHECK:STDERR: //indented // We only want to diagnose these on the first line of a block of similarly // indented comments. -// CHECK:STDERR: fail_bad_comment_introducers.carbon:[[@LINE+2]]:3: error: whitespace is required after '//' [NoWhitespaceAfterCommentIntroducer] +// CHECK:STDERR: ╭─┤ fail_bad_comment_introducers.carbon:[[@LINE+7]]:3 +// CHECK:STDERR: -> │ //abc +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: whitespace is required after '//' +// CHECK:STDERR: · ┃ [NoWhitespaceAfterCommentIntroducer] +// CHECK:STDERR: ╰──── // CHECK:STDERR: //abc //123 //dce - // CHECK:STDERR: fail_bad_comment_introducers.carbon:[[@LINE+2]]:11: error: whitespace is required after '//' [NoWhitespaceAfterCommentIntroducer] + // CHECK:STDERR: ╭─┤ fail_bad_comment_introducers.carbon:[[@LINE+7]]:11 + // CHECK:STDERR: -> │ //indented block + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: whitespace is required after '//' + // CHECK:STDERR: · ┃ [NoWhitespaceAfterCommentIntroducer] + // CHECK:STDERR: ╰──── // CHECK:STDERR: //indented block //indented block @@ -37,7 +57,15 @@ // As we have specialized code to scan short indented comment blocks, make sure // the behavior is preserved even for (absurdly) large indents. - // CHECK:STDERR: fail_bad_comment_introducers.carbon:[[@LINE+2]]:83: error: whitespace is required after '//' [NoWhitespaceAfterCommentIntroducer] + // CHECK:STDERR: ╭─┤ fail_bad_comment_introducers.carbon:[[@LINE+10]]:83 + // CHECK:STDERR: -> │ ... //very indented block + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: whitespace + // CHECK:STDERR: · ┃ is + // CHECK:STDERR: · ┃ required + // CHECK:STDERR: · ┃ after '//' + // CHECK:STDERR: · ┃ [NoWhitespaceAfterCommentIntroducer] + // CHECK:STDERR: ╰──── // CHECK:STDERR: //very indented block //very indented block diff --git a/toolchain/lex/testdata/fail_bad_comment_introducers_mid_block_indent_change.carbon b/toolchain/lex/testdata/fail_bad_comment_introducers_mid_block_indent_change.carbon index 66415e15d4f7..c59f0d4812d8 100644 --- a/toolchain/lex/testdata/fail_bad_comment_introducers_mid_block_indent_change.carbon +++ b/toolchain/lex/testdata/fail_bad_comment_introducers_mid_block_indent_change.carbon @@ -23,11 +23,26 @@ // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lex/testdata/fail_bad_comment_introducers_mid_block_indent_change.carbon // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lex/testdata/fail_bad_comment_introducers_mid_block_indent_change.carbon -// CHECK:STDERR: fail_bad_comment_introducers_mid_block_indent_change.carbon:[[@LINE-17]]:3: error: whitespace is required after '//' [NoWhitespaceAfterCommentIntroducer] +// CHECK:STDERR: ╭─┤ fail_bad_comment_introducers_mid_block_indent_change.carbon:[[@LINE-17]]:3 +// CHECK:STDERR: -> │ //abc +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: whitespace is required after '//' +// CHECK:STDERR: · ┃ [NoWhitespaceAfterCommentIntroducer] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_bad_comment_introducers_mid_block_indent_change.carbon:[[@LINE-16]]:5: error: whitespace is required after '//' [NoWhitespaceAfterCommentIntroducer] +// CHECK:STDERR: ╭─┤ fail_bad_comment_introducers_mid_block_indent_change.carbon:[[@LINE-21]]:5 +// CHECK:STDERR: -> │ //abc +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: whitespace is required after '//' +// CHECK:STDERR: · ┃ [NoWhitespaceAfterCommentIntroducer] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_bad_comment_introducers_mid_block_indent_change.carbon:[[@LINE-15]]:3: error: whitespace is required after '//' [NoWhitespaceAfterCommentIntroducer] +// CHECK:STDERR: ╭─┤ fail_bad_comment_introducers_mid_block_indent_change.carbon:[[@LINE-25]]:3 +// CHECK:STDERR: -> │ //abc +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: whitespace is required after '//' +// CHECK:STDERR: · ┃ [NoWhitespaceAfterCommentIntroducer] +// CHECK:STDERR: ╰──── // CHECK:STDERR: // CHECK:STDOUT: - filename: fail_bad_comment_introducers_mid_block_indent_change.carbon diff --git a/toolchain/lex/testdata/fail_bad_raw_identifier.carbon b/toolchain/lex/testdata/fail_bad_raw_identifier.carbon index bc1c6a1472d0..77e6bc3eeb25 100644 --- a/toolchain/lex/testdata/fail_bad_raw_identifier.carbon +++ b/toolchain/lex/testdata/fail_bad_raw_identifier.carbon @@ -14,14 +14,24 @@ // Missing the character after `#`. -// CHECK:STDERR: fail_bad_raw_identifier.carbon:[[@LINE+2]]:2: error: encountered unrecognized characters while parsing [UnrecognizedCharacters] +// CHECK:STDERR: ╭─┤ fail_bad_raw_identifier.carbon:[[@LINE+7]]:2 +// CHECK:STDERR: -> │ r# +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: encountered unrecognized characters while parsing +// CHECK:STDERR: · ┃ [UnrecognizedCharacters] +// CHECK:STDERR: ╰──── // CHECK:STDERR: r# // CHECK:STDOUT: - { index: 1, kind: "Identifier", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "r", identifier: 0, has_leading_space: true } // CHECK:STDOUT: - { index: 2, kind: "Error", line: {{ *}}[[@LINE-2]], column: 2, indent: 1, spelling: "#" } // Not a valid identifier. -// CHECK:STDERR: fail_bad_raw_identifier.carbon:[[@LINE+2]]:2: error: encountered unrecognized characters while parsing [UnrecognizedCharacters] +// CHECK:STDERR: ╭─┤ fail_bad_raw_identifier.carbon:[[@LINE+7]]:2 +// CHECK:STDERR: -> │ r#3 +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: encountered unrecognized characters while parsing +// CHECK:STDERR: · ┃ [UnrecognizedCharacters] +// CHECK:STDERR: ╰──── // CHECK:STDERR: r#3 // CHECK:STDOUT: - { index: 3, kind: "Identifier", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "r", identifier: 0, has_leading_space: true } @@ -29,14 +39,24 @@ r#3 // CHECK:STDOUT: - { index: 5, kind: "IntLiteral", line: {{ *}}[[@LINE-3]], column: 3, indent: 1, spelling: "3", value: "3" } // Non ascii start to identifier. -// CHECK:STDERR: fail_bad_raw_identifier.carbon:[[@LINE+2]]:2: error: encountered unrecognized characters while parsing [UnrecognizedCharacters] +// CHECK:STDERR: ╭─┤ fail_bad_raw_identifier.carbon:[[@LINE+7]]:2 +// CHECK:STDERR: -> │ r#á +// CHECK:STDERR: · ━┳ +// CHECK:STDERR: · ┗━━┫ error: encountered unrecognized characters while parsing +// CHECK:STDERR: · ┃ [UnrecognizedCharacters] +// CHECK:STDERR: ╰──── // CHECK:STDERR: r#á // CHECK:STDOUT: - { index: 6, kind: "Identifier", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "r", identifier: 0, has_leading_space: true } // CHECK:STDOUT: - { index: 7, kind: "Error", line: {{ *}}[[@LINE-2]], column: 2, indent: 1, spelling: "#\xC3\xA1" } // Raw `r` identifier doesn't start a second raw identifier. -// CHECK:STDERR: fail_bad_raw_identifier.carbon:[[@LINE+2]]:4: error: encountered unrecognized characters while parsing [UnrecognizedCharacters] +// CHECK:STDERR: ╭─┤ fail_bad_raw_identifier.carbon:[[@LINE+7]]:4 +// CHECK:STDERR: -> │ r#r#foo +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: encountered unrecognized characters while parsing +// CHECK:STDERR: · ┃ [UnrecognizedCharacters] +// CHECK:STDERR: ╰──── // CHECK:STDERR: r#r#foo // CHECK:STDOUT: - { index: 8, kind: "Identifier", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "r#r", identifier: 0, has_leading_space: true } @@ -44,7 +64,12 @@ r#r#foo // CHECK:STDOUT: - { index: 10, kind: "Identifier", line: {{ *}}[[@LINE-3]], column: 5, indent: 1, spelling: "foo", identifier: 1 } // Other identifier characters don't start a raw identifier. -// CHECK:STDERR: fail_bad_raw_identifier.carbon:[[@LINE+2]]:2: error: encountered unrecognized characters while parsing [UnrecognizedCharacters] +// CHECK:STDERR: ╭─┤ fail_bad_raw_identifier.carbon:[[@LINE+7]]:2 +// CHECK:STDERR: -> │ s#foo +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: encountered unrecognized characters while parsing +// CHECK:STDERR: · ┃ [UnrecognizedCharacters] +// CHECK:STDERR: ╰──── // CHECK:STDERR: s#foo // CHECK:STDOUT: - { index: 11, kind: "Identifier", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "s", identifier: 2, has_leading_space: true } @@ -52,7 +77,12 @@ s#foo // CHECK:STDOUT: - { index: 13, kind: "Identifier", line: {{ *}}[[@LINE-3]], column: 3, indent: 1, spelling: "foo", identifier: 1 } // Identifier ending in `r` doesn't start a raw identifier. -// CHECK:STDERR: fail_bad_raw_identifier.carbon:[[@LINE+2]]:4: error: encountered unrecognized characters while parsing [UnrecognizedCharacters] +// CHECK:STDERR: ╭─┤ fail_bad_raw_identifier.carbon:[[@LINE+7]]:4 +// CHECK:STDERR: -> │ arr#foo +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: encountered unrecognized characters while parsing +// CHECK:STDERR: · ┃ [UnrecognizedCharacters] +// CHECK:STDERR: ╰──── // CHECK:STDERR: arr#foo // CHECK:STDOUT: - { index: 14, kind: "Identifier", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "arr", identifier: 3, has_leading_space: true } @@ -60,7 +90,12 @@ arr#foo // CHECK:STDOUT: - { index: 16, kind: "Identifier", line: {{ *}}[[@LINE-3]], column: 5, indent: 1, spelling: "foo", identifier: 1 } // Whitespace between `r` and `#` isn't allowed. -// CHECK:STDERR: fail_bad_raw_identifier.carbon:[[@LINE+2]]:3: error: encountered unrecognized characters while parsing [UnrecognizedCharacters] +// CHECK:STDERR: ╭─┤ fail_bad_raw_identifier.carbon:[[@LINE+7]]:3 +// CHECK:STDERR: -> │ r #foo +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: encountered unrecognized characters while parsing +// CHECK:STDERR: · ┃ [UnrecognizedCharacters] +// CHECK:STDERR: ╰──── // CHECK:STDERR: r #foo // CHECK:STDOUT: - { index: 17, kind: "Identifier", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "r", identifier: 0, has_leading_space: true } @@ -77,7 +112,12 @@ r#"hello"# // CHECK:STDOUT: tokens: // Ensure that we correctly handle a `#` as the first token in the file. -// CHECK:STDERR: fail_hash_at_start_of_file.carbon:[[@LINE+2]]:1: error: encountered unrecognized characters while parsing [UnrecognizedCharacters] +// CHECK:STDERR: ╭─┤ fail_hash_at_start_of_file.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ #foo +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: encountered unrecognized characters while parsing +// CHECK:STDERR: · ┃ [UnrecognizedCharacters] +// CHECK:STDERR: ╰──── // CHECK:STDERR: #foo // CHECK:STDOUT: - { index: 1, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "#", has_leading_space: true } diff --git a/toolchain/lex/testdata/fail_block_string_second_line.carbon b/toolchain/lex/testdata/fail_block_string_second_line.carbon index b0b29d56344f..5469156f7714 100644 --- a/toolchain/lex/testdata/fail_block_string_second_line.carbon +++ b/toolchain/lex/testdata/fail_block_string_second_line.carbon @@ -13,13 +13,19 @@ var s: str = ''' // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lex/testdata/fail_block_string_second_line.carbon // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lex/testdata/fail_block_string_second_line.carbon -// CHECK:STDERR: fail_block_string_second_line.carbon:[[@LINE-10]]:3: error: only whitespace is permitted before the closing `'''` of a multi-line string [ContentBeforeStringTerminator] +// CHECK:STDERR: ╭─┤ fail_block_string_second_line.carbon:[[@LINE-10]]:3 +// CHECK:STDERR: -> │ error here: ''' +// CHECK:STDERR: · ┳━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: only whitespace is permitted before the closing `'''` of a +// CHECK:STDERR: · ┃ multi-line string +// CHECK:STDERR: · ┃ [ContentBeforeStringTerminator] +// CHECK:STDERR: ╰──── // CHECK:STDERR: // CHECK:STDOUT: - filename: fail_block_string_second_line.carbon // CHECK:STDOUT: tokens: -// CHECK:STDOUT: - { index: 1, kind: "Var", line: {{ *}}[[@LINE-15]], column: 1, indent: 1, spelling: "var", has_leading_space: true } -// CHECK:STDOUT: - { index: 2, kind: "Identifier", line: {{ *}}[[@LINE-16]], column: 5, indent: 1, spelling: "s", identifier: 0, has_leading_space: true } -// CHECK:STDOUT: - { index: 3, kind: "Colon", line: {{ *}}[[@LINE-17]], column: 6, indent: 1, spelling: ":" } -// CHECK:STDOUT: - { index: 4, kind: "Str", line: {{ *}}[[@LINE-18]], column: 8, indent: 1, spelling: "str", has_leading_space: true } -// CHECK:STDOUT: - { index: 5, kind: "Equal", line: {{ *}}[[@LINE-19]], column: 12, indent: 1, spelling: "=", has_leading_space: true } -// CHECK:STDOUT: - { index: 6, kind: "StringLiteral", line: {{ *}}[[@LINE-20]], column: 14, indent: 1, spelling: "'''\n error here: '''", value: "error here: ", has_leading_space: true } +// CHECK:STDOUT: - { index: 1, kind: "Var", line: {{ *}}[[@LINE-21]], column: 1, indent: 1, spelling: "var", has_leading_space: true } +// CHECK:STDOUT: - { index: 2, kind: "Identifier", line: {{ *}}[[@LINE-22]], column: 5, indent: 1, spelling: "s", identifier: 0, has_leading_space: true } +// CHECK:STDOUT: - { index: 3, kind: "Colon", line: {{ *}}[[@LINE-23]], column: 6, indent: 1, spelling: ":" } +// CHECK:STDOUT: - { index: 4, kind: "Str", line: {{ *}}[[@LINE-24]], column: 8, indent: 1, spelling: "str", has_leading_space: true } +// CHECK:STDOUT: - { index: 5, kind: "Equal", line: {{ *}}[[@LINE-25]], column: 12, indent: 1, spelling: "=", has_leading_space: true } +// CHECK:STDOUT: - { index: 6, kind: "StringLiteral", line: {{ *}}[[@LINE-26]], column: 14, indent: 1, spelling: "'''\n error here: '''", value: "error here: ", has_leading_space: true } diff --git a/toolchain/lex/testdata/fail_char_literals_bad_encoding.carbon b/toolchain/lex/testdata/fail_char_literals_bad_encoding.carbon index bf391fb979a9..d9fc70795868 100644 --- a/toolchain/lex/testdata/fail_char_literals_bad_encoding.carbon +++ b/toolchain/lex/testdata/fail_char_literals_bad_encoding.carbon @@ -13,71 +13,131 @@ // Be careful when operating on this file: it contains invalid UTF-8 sequences // and Unicode control characters, and text editors are likely to corrupt it. -// CHECK:STDERR: fail_char_literals_bad_encoding.carbon:[[@LINE+2]]:1: error: control character in character literal; specify as escape sequence `\u{00}` [CharLiteralControlCharacter] +// CHECK:STDERR: ╭─┤ fail_char_literals_bad_encoding.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ '<00>' +// CHECK:STDERR: · ┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: control character in character literal; specify as escape sequence +// CHECK:STDERR: · ┃ `\u{00}` +// CHECK:STDERR: · ┃ [CharLiteralControlCharacter] +// CHECK:STDERR: ╰──── // CHECK:STDERR: '[[@0x00]]' // CHECK:STDOUT: - { index: 1, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "'\x00'", has_leading_space: true } -// CHECK:STDERR: fail_char_literals_bad_encoding.carbon:[[@LINE+2]]:1: error: control character in character literal; specify as escape sequence `\u{01}` [CharLiteralControlCharacter] +// CHECK:STDERR: ╭─┤ fail_char_literals_bad_encoding.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ '<01>' +// CHECK:STDERR: · ┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: control character in character literal; specify as escape sequence +// CHECK:STDERR: · ┃ `\u{01}` +// CHECK:STDERR: · ┃ [CharLiteralControlCharacter] +// CHECK:STDERR: ╰──── // CHECK:STDERR: '[[@0x01]]' // CHECK:STDOUT: - { index: 2, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "'\x01'", has_leading_space: true } -// CHECK:STDERR: fail_char_literals_bad_encoding.carbon:[[@LINE+2]]:1: error: control character in character literal; specify as escape sequence `\u{1F}` [CharLiteralControlCharacter] +// CHECK:STDERR: ╭─┤ fail_char_literals_bad_encoding.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ '<1F>' +// CHECK:STDERR: · ┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: control character in character literal; specify as escape sequence +// CHECK:STDERR: · ┃ `\u{1F}` +// CHECK:STDERR: · ┃ [CharLiteralControlCharacter] +// CHECK:STDERR: ╰──── // CHECK:STDERR: '[[@0x1F]]' // CHECK:STDOUT: - { index: 3, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "'\x1F'", has_leading_space: true } -// CHECK:STDERR: fail_char_literals_bad_encoding.carbon:[[@LINE+2]]:1: error: control character in character literal; specify as escape sequence `\u{7F}` [CharLiteralControlCharacter] +// CHECK:STDERR: ╭─┤ fail_char_literals_bad_encoding.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ '<7F>' +// CHECK:STDERR: · ┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: control character in character literal; specify as escape sequence +// CHECK:STDERR: · ┃ `\u{7F}` +// CHECK:STDERR: · ┃ [CharLiteralControlCharacter] +// CHECK:STDERR: ╰──── // CHECK:STDERR: '[[@0x7F]]' // CHECK:STDOUT: - { index: 4, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "'\x7F'", has_leading_space: true } // 0xC2 0x80 is U+0080. -// CHECK:STDERR: fail_char_literals_bad_encoding.carbon:[[@LINE+2]]:1: error: control character in character literal; specify as escape sequence `\u{80}` [CharLiteralControlCharacter] +// CHECK:STDERR: ╭─┤ fail_char_literals_bad_encoding.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ '�' +// CHECK:STDERR: · ┳━━ +// CHECK:STDERR: · ┗━━┫ error: control character in character literal; specify as escape sequence +// CHECK:STDERR: · ┃ `\u{80}` +// CHECK:STDERR: · ┃ [CharLiteralControlCharacter] +// CHECK:STDERR: ╰──── // CHECK:STDERR: '[[@0xC2]][[@0x80]]' // CHECK:STDOUT: - { index: 5, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "'\xC2\x80'", has_leading_space: true } // 0xC2 0x9F is U+009F. -// CHECK:STDERR: fail_char_literals_bad_encoding.carbon:[[@LINE+2]]:1: error: control character in character literal; specify as escape sequence `\u{9F}` [CharLiteralControlCharacter] +// CHECK:STDERR: ╭─┤ fail_char_literals_bad_encoding.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ '�' +// CHECK:STDERR: · ┳━━ +// CHECK:STDERR: · ┗━━┫ error: control character in character literal; specify as escape sequence +// CHECK:STDERR: · ┃ `\u{9F}` +// CHECK:STDERR: · ┃ [CharLiteralControlCharacter] +// CHECK:STDERR: ╰──── // CHECK:STDERR: '[[@0xC2]][[@0x9F]]' // CHECK:STDOUT: - { index: 6, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "'\xC2\x9F'", has_leading_space: true } // 0xC3 is invalid UTF-8 due to having a lead byte with no trail byte. -// CHECK:STDERR: fail_char_literals_bad_encoding.carbon:[[@LINE+2]]:1: error: incomplete UTF-8 [CharLiteralUnderflow] +// CHECK:STDERR: ╭─┤ fail_char_literals_bad_encoding.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ '�' +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┗━━┫ error: incomplete UTF-8 [CharLiteralUnderflow] +// CHECK:STDERR: ╰──── // CHECK:STDERR: '[[@0xC3]]' // CHECK:STDOUT: - { index: 7, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "'\xC3'", has_leading_space: true } // 0xC3 0xC3 is invalid UTF-8 due to having two lead bytes in a row. -// CHECK:STDERR: fail_char_literals_bad_encoding.carbon:[[@LINE+2]]:1: error: invalid UTF-8 character [CharLiteralInvalidUTF8] +// CHECK:STDERR: ╭─┤ fail_char_literals_bad_encoding.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ '��' +// CHECK:STDERR: · ━━┳━ +// CHECK:STDERR: · ┗━━┫ error: invalid UTF-8 character [CharLiteralInvalidUTF8] +// CHECK:STDERR: ╰──── // CHECK:STDERR: '[[@0xC3]][[@0xC3]]' // CHECK:STDOUT: - { index: 8, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "'\xC3\xC3'", has_leading_space: true } // This is invalid UTF-8 due to being too large. -// CHECK:STDERR: fail_char_literals_bad_encoding.carbon:[[@LINE+2]]:1: error: invalid UTF-8 character [CharLiteralInvalidUTF8] +// CHECK:STDERR: ╭─┤ fail_char_literals_bad_encoding.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ '���������' +// CHECK:STDERR: · ━━━━━┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid UTF-8 character [CharLiteralInvalidUTF8] +// CHECK:STDERR: ╰──── // CHECK:STDERR: '[[@0xFF]][[@0x80]][[@0x80]][[@0x80]][[@0x80]][[@0x80]][[@0x80]][[@0x80]][[@0x80]]' // CHECK:STDOUT: - { index: 9, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "'\xFF\x80\x80\x80\x80\x80\x80\x80\x80'", has_leading_space: true } // 0xED 0xA0 0x80 would be U+D800 but is invalid UTF-8 due to encoding a high surrogate value. -// CHECK:STDERR: fail_char_literals_bad_encoding.carbon:[[@LINE+2]]:1: error: invalid UTF-8 character [CharLiteralInvalidUTF8] +// CHECK:STDERR: ╭─┤ fail_char_literals_bad_encoding.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ '���' +// CHECK:STDERR: · ━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: invalid UTF-8 character [CharLiteralInvalidUTF8] +// CHECK:STDERR: ╰──── // CHECK:STDERR: '[[@0xED]][[@0xA0]][[@0x80]]' // CHECK:STDOUT: - { index: 10, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "'\xED\xA0\x80'", has_leading_space: true } // 0xED 0xBF 0xBF would be U+DFFF but is invalid UTF-8 due to encoding a low surrogate value. -// CHECK:STDERR: fail_char_literals_bad_encoding.carbon:[[@LINE+2]]:1: error: invalid UTF-8 character [CharLiteralInvalidUTF8] +// CHECK:STDERR: ╭─┤ fail_char_literals_bad_encoding.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ '���' +// CHECK:STDERR: · ━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: invalid UTF-8 character [CharLiteralInvalidUTF8] +// CHECK:STDERR: ╰──── // CHECK:STDERR: '[[@0xED]][[@0xBF]][[@0xBF]]' // CHECK:STDOUT: - { index: 11, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "'\xED\xBF\xBF'", has_leading_space: true } // 0xED 0xA0 0xBD 0xED 0xBA 0x80 would be U+D83D U+DE80, but those are both surrogates. // Treated as UTF-16, that would in turn produce U+1F680. But we don't do that. -// CHECK:STDERR: fail_char_literals_bad_encoding.carbon:[[@LINE+2]]:1: error: invalid UTF-8 character [CharLiteralInvalidUTF8] +// CHECK:STDERR: ╭─┤ fail_char_literals_bad_encoding.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ '������' +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid UTF-8 character [CharLiteralInvalidUTF8] +// CHECK:STDERR: ╰──── // CHECK:STDERR: '[[@0xED]][[@0xA0]][[@0xBD]][[@0xED]][[@0xBA]][[@0x80]]' // CHECK:STDOUT: - { index: 12, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "'\xED\xA0\xBD\xED\xBA\x80'", has_leading_space: true } diff --git a/toolchain/lex/testdata/fail_malformed_escapes.carbon b/toolchain/lex/testdata/fail_malformed_escapes.carbon index 85d922ba34ef..326e975f0ed6 100644 --- a/toolchain/lex/testdata/fail_malformed_escapes.carbon +++ b/toolchain/lex/testdata/fail_malformed_escapes.carbon @@ -15,7 +15,13 @@ // CHECK:STDOUT: - filename: fail_hex_escape_wrong_digit.carbon // CHECK:STDOUT: tokens: -// CHECK:STDERR: fail_hex_escape_wrong_digit.carbon:[[@LINE+2]]:4: error: escape sequence `\x` must be followed by two uppercase hexadecimal digits, for example `\x0F` [HexadecimalEscapeMissingDigits] +// CHECK:STDERR: ╭─┤ fail_hex_escape_wrong_digit.carbon:[[@LINE+8]]:4 +// CHECK:STDERR: -> │ "\xG1" +// CHECK:STDERR: · ─╴╻ +// CHECK:STDERR: · ┗━━┫ error: escape sequence `\x` must be followed by two uppercase +// CHECK:STDERR: · ┃ hexadecimal digits, for example `\x0F` +// CHECK:STDERR: · ┃ [HexadecimalEscapeMissingDigits] +// CHECK:STDERR: ╰──── // CHECK:STDERR: "\xG1" // CHECK:STDOUT: - { index: 1, kind: "StringLiteral", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "\"\\xG1\"", value: "xG1", has_leading_space: true } @@ -24,7 +30,13 @@ // CHECK:STDOUT: - filename: fail_hex_escape_one_digit.carbon // CHECK:STDOUT: tokens: -// CHECK:STDERR: fail_hex_escape_one_digit.carbon:[[@LINE+2]]:5: error: escape sequence `\x` must be followed by two uppercase hexadecimal digits, for example `\x0F` [HexadecimalEscapeMissingDigits] +// CHECK:STDERR: ╭─┤ fail_hex_escape_one_digit.carbon:[[@LINE+8]]:5 +// CHECK:STDERR: -> │ "\x0g" +// CHECK:STDERR: · ──╴╻ +// CHECK:STDERR: · ┗━━┫ error: escape sequence `\x` must be followed by two uppercase +// CHECK:STDERR: · ┃ hexadecimal digits, for example `\x0F` +// CHECK:STDERR: · ┃ [HexadecimalEscapeMissingDigits] +// CHECK:STDERR: ╰──── // CHECK:STDERR: "\x0g" // CHECK:STDOUT: - { index: 1, kind: "StringLiteral", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "\"\\x0g\"", value: "x0g", has_leading_space: true } @@ -33,7 +45,13 @@ // CHECK:STDOUT: - filename: fail_unicode_escape_empty_braces.carbon // CHECK:STDOUT: tokens: -// CHECK:STDERR: fail_unicode_escape_empty_braces.carbon:[[@LINE+2]]:5: error: escape sequence `\u` must be followed by a braced sequence of uppercase hexadecimal digits, for example `\u{70AD}}` [UnicodeEscapeMissingBracedDigits] +// CHECK:STDERR: ╭─┤ fail_unicode_escape_empty_braces.carbon:[[@LINE+8]]:5 +// CHECK:STDERR: -> │ "\u{}" +// CHECK:STDERR: · ──╴╻ +// CHECK:STDERR: · ┗━━┫ error: escape sequence `\u` must be followed by a braced sequence of +// CHECK:STDERR: · ┃ uppercase hexadecimal digits, for example `\u{70AD}}` +// CHECK:STDERR: · ┃ [UnicodeEscapeMissingBracedDigits] +// CHECK:STDERR: ╰──── // CHECK:STDERR: "\u{}" // CHECK:STDOUT: - { index: 1, kind: "StringLiteral", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "\"\\u{}\"", value: "u{}", has_leading_space: true } @@ -42,7 +60,13 @@ // CHECK:STDOUT: - filename: fail_unicode_escape_unclosed.carbon // CHECK:STDOUT: tokens: -// CHECK:STDERR: fail_unicode_escape_unclosed.carbon:[[@LINE+2]]:7: error: escape sequence `\u` must be followed by a braced sequence of uppercase hexadecimal digits, for example `\u{70AD}}` [UnicodeEscapeMissingBracedDigits] +// CHECK:STDERR: ╭─┤ fail_unicode_escape_unclosed.carbon:[[@LINE+8]]:7 +// CHECK:STDERR: -> │ "\u{12" +// CHECK:STDERR: · ────╴╻ +// CHECK:STDERR: · ┗━━┫ error: escape sequence `\u` must be followed by a braced sequence of +// CHECK:STDERR: · ┃ uppercase hexadecimal digits, for example `\u{70AD}}` +// CHECK:STDERR: · ┃ [UnicodeEscapeMissingBracedDigits] +// CHECK:STDERR: ╰──── // CHECK:STDERR: "\u{12" // CHECK:STDOUT: - { index: 1, kind: "StringLiteral", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "\"\\u{12\"", value: "u{12", has_leading_space: true } diff --git a/toolchain/lex/testdata/fail_mismatched_brackets.carbon b/toolchain/lex/testdata/fail_mismatched_brackets.carbon index 9c665711d712..e4b16df5ab6f 100644 --- a/toolchain/lex/testdata/fail_mismatched_brackets.carbon +++ b/toolchain/lex/testdata/fail_mismatched_brackets.carbon @@ -21,20 +21,35 @@ // rather than guessed at. The trailing `[` is closed immediately, since there's // nothing left for it to contain. -// CHECK:STDERR: fail_top_level_brackets.carbon:[[@LINE+2]]:1: error: closing symbol without a corresponding opening symbol [UnmatchedClosing] +// CHECK:STDERR: ╭─┤ fail_top_level_brackets.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ } +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: closing symbol without a corresponding opening symbol +// CHECK:STDERR: · ┃ [UnmatchedClosing] +// CHECK:STDERR: ╰──── // CHECK:STDERR: } // CHECK:STDOUT: - { index: 1, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "}", has_leading_space: true } -// CHECK:STDERR: fail_top_level_brackets.carbon:[[@LINE+2]]:3: error: closing symbol without a corresponding opening symbol [UnmatchedClosing] +// CHECK:STDERR: ╭─┤ fail_top_level_brackets.carbon:[[@LINE+7]]:3 +// CHECK:STDERR: -> │ ( } ) +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: closing symbol without a corresponding opening symbol +// CHECK:STDERR: · ┃ [UnmatchedClosing] +// CHECK:STDERR: ╰──── // CHECK:STDERR: ( } ) // CHECK:STDOUT: - { index: 2, kind: "OpenParen", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "(", closing_token: 4, has_leading_space: true } // CHECK:STDOUT: - { index: 3, kind: "Error", line: {{ *}}[[@LINE-2]], column: 3, indent: 1, spelling: "}", has_leading_space: true } // CHECK:STDOUT: - { index: 4, kind: "CloseParen", line: {{ *}}[[@LINE-3]], column: 5, indent: 1, spelling: ")", opening_token: 2, has_leading_space: true } -// CHECK:STDERR: fail_top_level_brackets.carbon:[[@LINE+3]]:1: error: opening symbol without a corresponding closing symbol [UnmatchedOpening] -// CHECK:STDERR: fail_top_level_brackets.carbon:[[@LINE+2]]:2: note: possibly missing `]` here [PossiblyMissingBracketHere] +// CHECK:STDERR: ╭─┤ fail_top_level_brackets.carbon:[[@LINE+8]]:1 +// CHECK:STDERR: -> │ [ +// CHECK:STDERR: · ╻╷ +// CHECK:STDERR: · ┗━━━┫ error: opening symbol without a corresponding closing symbol +// CHECK:STDERR: · │ ┃ [UnmatchedOpening] +// CHECK:STDERR: · ╰────┤ possibly missing `]` here [PossiblyMissingBracketHere] +// CHECK:STDERR: ╰──── // CHECK:STDERR: [ // CHECK:STDOUT: - { index: 5, kind: "OpenSquareBracket", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "[", closing_token: 6, has_leading_space: true } @@ -53,8 +68,15 @@ fn F() { // CHECK:STDOUT: - { index: 3, kind: "OpenParen", line: {{ *}}[[@LINE-3]], column: 5, indent: 1, spelling: "(", closing_token: 4 } // CHECK:STDOUT: - { index: 4, kind: "CloseParen", line: {{ *}}[[@LINE-4]], column: 6, indent: 1, spelling: ")", opening_token: 3 } // CHECK:STDOUT: - { index: 5, kind: "OpenCurlyBrace", line: {{ *}}[[@LINE-5]], column: 8, indent: 1, spelling: "{", closing_token: 17, has_leading_space: true } - // CHECK:STDERR: fail_semi_in_paren.carbon:[[@LINE+3]]:16: error: opening symbol without a corresponding closing symbol [UnmatchedOpening] - // CHECK:STDERR: fail_semi_in_paren.carbon:[[@LINE+2]]:22: note: possibly missing `)` here [PossiblyMissingBracketHere] + // CHECK:STDERR: ╭─┤ fail_semi_in_paren.carbon:[[@LINE+10]]:16 + // CHECK:STDERR: -> │ var x: i32 = (1 + 2; + // CHECK:STDERR: · ┳ ┬ + // CHECK:STDERR: · ┗━━━━━━━━┫ error: opening symbol without a corresponding closing + // CHECK:STDERR: · │ ┃ symbol + // CHECK:STDERR: · │ ┃ [UnmatchedOpening] + // CHECK:STDERR: · ╰────┤ possibly missing `)` here + // CHECK:STDERR: · │ [PossiblyMissingBracketHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var x: i32 = (1 + 2; // CHECK:STDOUT: - { index: 6, kind: "Var", line: {{ *}}[[@LINE-1]], column: 3, indent: 3, spelling: "var", has_leading_space: true } @@ -77,8 +99,14 @@ fn F() { // As above, at the top level rather than inside a function. -// CHECK:STDERR: fail_scope_in_paren.carbon:[[@LINE+3]]:14: error: opening symbol without a corresponding closing symbol [UnmatchedOpening] -// CHECK:STDERR: fail_scope_in_paren.carbon:[[@LINE+2]]:20: note: possibly missing `)` here [PossiblyMissingBracketHere] +// CHECK:STDERR: ╭─┤ fail_scope_in_paren.carbon:[[@LINE+9]]:14 +// CHECK:STDERR: -> │ var x: i32 = (1 + 2; +// CHECK:STDERR: · ┳ ┬ +// CHECK:STDERR: · ┗━━━━━━━━┫ error: opening symbol without a corresponding closing +// CHECK:STDERR: · │ ┃ symbol +// CHECK:STDERR: · │ ┃ [UnmatchedOpening] +// CHECK:STDERR: · ╰────┤ possibly missing `)` here [PossiblyMissingBracketHere] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: i32 = (1 + 2; // CHECK:STDOUT: - { index: 1, kind: "Var", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "var", has_leading_space: true } @@ -115,8 +143,13 @@ fn F() { // CHECK:STDOUT: - { index: 3, kind: "OpenParen", line: {{ *}}[[@LINE-3]], column: 5, indent: 1, spelling: "(", closing_token: 4 } // CHECK:STDOUT: - { index: 4, kind: "CloseParen", line: {{ *}}[[@LINE-4]], column: 6, indent: 1, spelling: ")", opening_token: 3 } // CHECK:STDOUT: - { index: 5, kind: "OpenCurlyBrace", line: {{ *}}[[@LINE-5]], column: 8, indent: 1, spelling: "{", closing_token: 16, has_leading_space: true } - // CHECK:STDERR: fail_close_paren_before_brace.carbon:[[@LINE+3]]:6: error: opening symbol without a corresponding closing symbol [UnmatchedOpening] - // CHECK:STDERR: fail_close_paren_before_brace.carbon:[[@LINE+2]]:8: note: possibly missing `)` here [PossiblyMissingBracketHere] + // CHECK:STDERR: ╭─┤ fail_close_paren_before_brace.carbon:[[@LINE+8]]:6 + // CHECK:STDERR: -> │ if (C { + // CHECK:STDERR: · ┳ ┬ + // CHECK:STDERR: · ┗━━━━┫ error: opening symbol without a corresponding closing symbol + // CHECK:STDERR: · │ ┃ [UnmatchedOpening] + // CHECK:STDERR: · ╰────┤ possibly missing `)` here [PossiblyMissingBracketHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: if (C { // CHECK:STDOUT: - { index: 6, kind: "If", line: {{ *}}[[@LINE-1]], column: 3, indent: 3, spelling: "if", has_leading_space: true } @@ -141,8 +174,13 @@ fn F() { // `->` structures a declaration rather than an expression, so a parameter // list's paren must have closed before it. -// CHECK:STDERR: fail_close_paren_before_arrow.carbon:[[@LINE+3]]:5: error: opening symbol without a corresponding closing symbol [UnmatchedOpening] -// CHECK:STDERR: fail_close_paren_before_arrow.carbon:[[@LINE+2]]:12: note: possibly missing `)` here [PossiblyMissingBracketHere] +// CHECK:STDERR: ╭─┤ fail_close_paren_before_arrow.carbon:[[@LINE+8]]:5 +// CHECK:STDERR: -> │ fn F(x: i32 -> i32 { +// CHECK:STDERR: · ┳ ┬ +// CHECK:STDERR: · ┗━━━━━━━━━┫ error: opening symbol without a corresponding closing symbol +// CHECK:STDERR: · │ ┃ [UnmatchedOpening] +// CHECK:STDERR: · ╰────┤ possibly missing `)` here [PossiblyMissingBracketHere] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(x: i32 -> i32 { // CHECK:STDOUT: - { index: 1, kind: "Fn", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "fn", has_leading_space: true } @@ -176,8 +214,13 @@ fn F() { // CHECK:STDOUT: - { index: 3, kind: "OpenParen", line: {{ *}}[[@LINE-3]], column: 5, indent: 1, spelling: "(", closing_token: 4 } // CHECK:STDOUT: - { index: 4, kind: "CloseParen", line: {{ *}}[[@LINE-4]], column: 6, indent: 1, spelling: ")", opening_token: 3 } // CHECK:STDOUT: - { index: 5, kind: "OpenCurlyBrace", line: {{ *}}[[@LINE-5]], column: 8, indent: 1, spelling: "{", closing_token: 13, has_leading_space: true } - // CHECK:STDERR: fail_close_paren_at_wide_gap.carbon:[[@LINE+3]]:4: error: opening symbol without a corresponding closing symbol [UnmatchedOpening] - // CHECK:STDERR: fail_close_paren_at_wide_gap.carbon:[[@LINE+2]]:6: note: possibly missing `)` here [PossiblyMissingBracketHere] + // CHECK:STDERR: ╭─┤ fail_close_paren_at_wide_gap.carbon:[[@LINE+8]]:4 + // CHECK:STDERR: -> │ G(1 + 2; + // CHECK:STDERR: · ┳ ┬ + // CHECK:STDERR: · ┗━━━━┫ error: opening symbol without a corresponding closing symbol + // CHECK:STDERR: · │ ┃ [UnmatchedOpening] + // CHECK:STDERR: · ╰────┤ possibly missing `)` here [PossiblyMissingBracketHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: G(1 + 2; // CHECK:STDOUT: - { index: 6, kind: "Identifier", line: {{ *}}[[@LINE-1]], column: 3, indent: 3, spelling: "G", identifier: 1, has_leading_space: true } @@ -202,14 +245,35 @@ fn F() { // CHECK:STDOUT: - { index: 3, kind: "OpenParen", line: {{ *}}[[@LINE-3]], column: 5, indent: 1, spelling: "(", closing_token: 4 } // CHECK:STDOUT: - { index: 4, kind: "CloseParen", line: {{ *}}[[@LINE-4]], column: 6, indent: 1, spelling: ")", opening_token: 3 } // CHECK:STDOUT: - { index: 5, kind: "OpenCurlyBrace", line: {{ *}}[[@LINE-5]], column: 8, indent: 1, spelling: "{", closing_token: 22, has_leading_space: true } - // CHECK:STDERR: fail_paren_cascade.carbon:[[@LINE+9]]:17: error: opening symbol without a corresponding closing symbol [UnmatchedOpening] - // CHECK:STDERR: fail_paren_cascade.carbon:[[@LINE+8]]:23: note: possibly missing `)` here [PossiblyMissingBracketHere] + // CHECK:STDERR: ╭─┤ fail_paren_cascade.carbon:[[@LINE+30]]:17 + // CHECK:STDERR: -> │ var x: i32 = G(H(I(1; + // CHECK:STDERR: · ┳ ┬ + // CHECK:STDERR: · ┗━━━━━━━━┫ error: opening symbol without a corresponding closing + // CHECK:STDERR: · │ ┃ symbol + // CHECK:STDERR: · │ ┃ [UnmatchedOpening] + // CHECK:STDERR: · ╰────┤ possibly missing `)` here + // CHECK:STDERR: · │ [PossiblyMissingBracketHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_paren_cascade.carbon:[[@LINE+6]]:19: error: opening symbol without a corresponding closing symbol [UnmatchedOpening] - // CHECK:STDERR: fail_paren_cascade.carbon:[[@LINE+5]]:23: note: possibly missing `)` here [PossiblyMissingBracketHere] + // CHECK:STDERR: ╭─┤ fail_paren_cascade.carbon:[[@LINE+20]]:19 + // CHECK:STDERR: -> │ var x: i32 = G(H(I(1; + // CHECK:STDERR: · ┳ ┬ + // CHECK:STDERR: · ┗━━━━━━┫ error: opening symbol without a corresponding closing + // CHECK:STDERR: · │ ┃ symbol + // CHECK:STDERR: · │ ┃ [UnmatchedOpening] + // CHECK:STDERR: · ╰────┤ possibly missing `)` here + // CHECK:STDERR: · │ [PossiblyMissingBracketHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_paren_cascade.carbon:[[@LINE+3]]:21: error: opening symbol without a corresponding closing symbol [UnmatchedOpening] - // CHECK:STDERR: fail_paren_cascade.carbon:[[@LINE+2]]:23: note: possibly missing `)` here [PossiblyMissingBracketHere] + // CHECK:STDERR: ╭─┤ fail_paren_cascade.carbon:[[@LINE+10]]:21 + // CHECK:STDERR: -> │ var x: i32 = G(H(I(1; + // CHECK:STDERR: · ┳ ┬ + // CHECK:STDERR: · ┗━━━━┫ error: opening symbol without a corresponding closing + // CHECK:STDERR: · │ ┃ symbol + // CHECK:STDERR: · │ ┃ [UnmatchedOpening] + // CHECK:STDERR: · ╰────┤ possibly missing `)` here + // CHECK:STDERR: · │ [PossiblyMissingBracketHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var x: i32 = G(H(I(1; // CHECK:STDOUT: - { index: 6, kind: "Var", line: {{ *}}[[@LINE-1]], column: 3, indent: 3, spelling: "var", has_leading_space: true } @@ -244,8 +308,15 @@ fn F() { // CHECK:STDOUT: - { index: 3, kind: "OpenParen", line: {{ *}}[[@LINE-3]], column: 5, indent: 1, spelling: "(", closing_token: 4 } // CHECK:STDOUT: - { index: 4, kind: "CloseParen", line: {{ *}}[[@LINE-4]], column: 6, indent: 1, spelling: ")", opening_token: 3 } // CHECK:STDOUT: - { index: 5, kind: "OpenCurlyBrace", line: {{ *}}[[@LINE-5]], column: 8, indent: 1, spelling: "{", closing_token: 23, has_leading_space: true } - // CHECK:STDERR: fail_close_struct_before_semi.carbon:[[@LINE+3]]:17: error: opening symbol without a corresponding closing symbol [UnmatchedOpening] - // CHECK:STDERR: fail_close_struct_before_semi.carbon:[[@LINE+2]]:32: note: possibly missing `}` here [PossiblyMissingBracketHere] + // CHECK:STDERR: ╭─┤ fail_close_struct_before_semi.carbon:[[@LINE+10]]:17 + // CHECK:STDERR: -> │ var x: auto = {.a = 1, .b = 2; + // CHECK:STDERR: · ┳ ┬ + // CHECK:STDERR: · ┗━━━━━━━━━━━━━━━━━┫ error: opening symbol without a + // CHECK:STDERR: · │ ┃ corresponding closing symbol + // CHECK:STDERR: · │ ┃ [UnmatchedOpening] + // CHECK:STDERR: · ╰────┤ possibly missing `}` here + // CHECK:STDERR: · │ [PossiblyMissingBracketHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var x: auto = {.a = 1, .b = 2; // CHECK:STDOUT: - { index: 6, kind: "Var", line: {{ *}}[[@LINE-1]], column: 3, indent: 3, spelling: "var", has_leading_space: true } @@ -283,11 +354,25 @@ fn F() { // CHECK:STDOUT: - { index: 3, kind: "OpenParen", line: {{ *}}[[@LINE-3]], column: 5, indent: 1, spelling: "(", closing_token: 4 } // CHECK:STDOUT: - { index: 4, kind: "CloseParen", line: {{ *}}[[@LINE-4]], column: 6, indent: 1, spelling: ")", opening_token: 3 } // CHECK:STDOUT: - { index: 5, kind: "OpenCurlyBrace", line: {{ *}}[[@LINE-5]], column: 8, indent: 1, spelling: "{", closing_token: 19, has_leading_space: true } - // CHECK:STDERR: fail_mismatched_kinds.carbon:[[@LINE+6]]:16: error: opening symbol without a corresponding closing symbol [UnmatchedOpening] - // CHECK:STDERR: fail_mismatched_kinds.carbon:[[@LINE+5]]:22: note: possibly missing `)` here [PossiblyMissingBracketHere] + // CHECK:STDERR: ╭─┤ fail_mismatched_kinds.carbon:[[@LINE+20]]:16 + // CHECK:STDERR: -> │ var x: i32 = (1 + 2}; + // CHECK:STDERR: · ┳ ┬ + // CHECK:STDERR: · ┗━━━━━━━━┫ error: opening symbol without a corresponding closing + // CHECK:STDERR: · │ ┃ symbol + // CHECK:STDERR: · │ ┃ [UnmatchedOpening] + // CHECK:STDERR: · ╰────┤ possibly missing `)` here + // CHECK:STDERR: · │ [PossiblyMissingBracketHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_mismatched_kinds.carbon:[[@LINE+3]]:22: error: closing symbol without a corresponding opening symbol [UnmatchedClosing] - // CHECK:STDERR: fail_mismatched_kinds.carbon:[[@LINE+2]]:22: note: possibly missing `{` here [PossiblyMissingBracketHere] + // CHECK:STDERR: ╭─┤ fail_mismatched_kinds.carbon:[[@LINE+10]]:22 + // CHECK:STDERR: -> │ var x: i32 = (1 + 2}; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: closing symbol without a corresponding opening + // CHECK:STDERR: · │ ┃ symbol + // CHECK:STDERR: · │ ┃ [UnmatchedClosing] + // CHECK:STDERR: · ╰────┤ possibly missing `{` here + // CHECK:STDERR: · │ [PossiblyMissingBracketHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var x: i32 = (1 + 2}; // CHECK:STDOUT: - { index: 6, kind: "Var", line: {{ *}}[[@LINE-1]], column: 3, indent: 3, spelling: "var", has_leading_space: true } @@ -319,8 +404,13 @@ fn F() { // CHECK:STDOUT: - { index: 3, kind: "OpenParen", line: {{ *}}[[@LINE-3]], column: 5, indent: 1, spelling: "(", closing_token: 4 } // CHECK:STDOUT: - { index: 4, kind: "CloseParen", line: {{ *}}[[@LINE-4]], column: 6, indent: 1, spelling: ")", opening_token: 3 } // CHECK:STDOUT: - { index: 5, kind: "OpenCurlyBrace", line: {{ *}}[[@LINE-5]], column: 8, indent: 1, spelling: "{", closing_token: 18, has_leading_space: true } - // CHECK:STDERR: fail_missing_open_paren_after_if.carbon:[[@LINE+3]]:11: error: closing symbol without a corresponding opening symbol [UnmatchedClosing] - // CHECK:STDERR: fail_missing_open_paren_after_if.carbon:[[@LINE+2]]:6: note: possibly missing `(` here [PossiblyMissingBracketHere] + // CHECK:STDERR: ╭─┤ fail_missing_open_paren_after_if.carbon:[[@LINE+8]]:11 + // CHECK:STDERR: -> │ if C > 0) { + // CHECK:STDERR: · ┬ ┳ + // CHECK:STDERR: · │ ┗━━┫ error: closing symbol without a corresponding opening symbol + // CHECK:STDERR: · │ ┃ [UnmatchedClosing] + // CHECK:STDERR: · ╰─────────┤ possibly missing `(` here [PossiblyMissingBracketHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: if C > 0) { // CHECK:STDOUT: - { index: 6, kind: "If", line: {{ *}}[[@LINE-1]], column: 3, indent: 3, spelling: "if", has_leading_space: true } @@ -346,8 +436,14 @@ fn F() { // As above for `forall`, which wants a `[` rather than a `(`. -// CHECK:STDERR: fail_missing_open_square_after_forall.carbon:[[@LINE+3]]:20: error: closing symbol without a corresponding opening symbol [UnmatchedClosing] -// CHECK:STDERR: fail_missing_open_square_after_forall.carbon:[[@LINE+2]]:13: note: possibly missing `[` here [PossiblyMissingBracketHere] +// CHECK:STDERR: ╭─┤ fail_missing_open_square_after_forall.carbon:[[@LINE+9]]:20 +// CHECK:STDERR: -> │ impl forall T: type] X as Y { +// CHECK:STDERR: · ┬ ┳ +// CHECK:STDERR: · │ ┗━━┫ error: closing symbol without a corresponding opening +// CHECK:STDERR: · │ ┃ symbol +// CHECK:STDERR: · │ ┃ [UnmatchedClosing] +// CHECK:STDERR: · ╰───────────┤ possibly missing `[` here [PossiblyMissingBracketHere] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall T: type] X as Y { // CHECK:STDOUT: - { index: 1, kind: "Impl", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "impl", has_leading_space: true } @@ -386,8 +482,16 @@ fn F() { thing2; // CHECK:STDOUT: - { index: 11, kind: "Identifier", line: {{ *}}[[@LINE-1]], column: 5, indent: 5, spelling: "thing2", identifier: 2 } // CHECK:STDOUT: - { index: 12, kind: "Semi", line: {{ *}}[[@LINE-2]], column: 11, indent: 5, spelling: ";" } - // CHECK:STDERR: fail_missing_brace_after_if.carbon:[[@LINE+3]]:3: error: closing symbol without a corresponding opening symbol [UnmatchedClosing] - // CHECK:STDERR: fail_missing_brace_after_if.carbon:[[@LINE-10]]:14: note: possibly missing `{` here [PossiblyMissingBracketHere] + // CHECK:STDERR: ╭─┤ fail_missing_brace_after_if.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ if (thing1) + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ possibly missing `{` here [PossiblyMissingBracketHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ } + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: closing symbol without a corresponding opening symbol + // CHECK:STDERR: · ┃ [UnmatchedClosing] + // CHECK:STDERR: ╰──── // CHECK:STDERR: } // CHECK:STDOUT: - { index: 13, kind: "CloseCurlyBrace", line: {{ *}}[[@LINE-1]], column: 3, indent: 3, spelling: "}", opening_token: 10, has_leading_space: true } @@ -426,8 +530,16 @@ fn F[T: type] // CHECK:STDOUT: - { index: 19, kind: "OpenParen", line: {{ *}}[[@LINE-2]], column: 6, indent: 3, spelling: "(", closing_token: 20 } // CHECK:STDOUT: - { index: 20, kind: "CloseParen", line: {{ *}}[[@LINE-3]], column: 7, indent: 3, spelling: ")", opening_token: 19 } // CHECK:STDOUT: - { index: 21, kind: "Semi", line: {{ *}}[[@LINE-4]], column: 8, indent: 3, spelling: ";" } -// CHECK:STDERR: fail_missing_brace_multi_line_header.carbon:[[@LINE+3]]:1: error: closing symbol without a corresponding opening symbol [UnmatchedClosing] -// CHECK:STDERR: fail_missing_brace_multi_line_header.carbon:[[@LINE-18]]:11: note: possibly missing `{` here [PossiblyMissingBracketHere] +// CHECK:STDERR: ╭─┤ fail_missing_brace_multi_line_header.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: │ (x: T) +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ possibly missing `{` here [PossiblyMissingBracketHere] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ } +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: closing symbol without a corresponding opening symbol +// CHECK:STDERR: · ┃ [UnmatchedClosing] +// CHECK:STDERR: ╰──── // CHECK:STDERR: } // CHECK:STDOUT: - { index: 22, kind: "CloseCurlyBrace", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "}", opening_token: 13, has_leading_space: true } @@ -445,8 +557,14 @@ fn F() { // CHECK:STDOUT: - { index: 3, kind: "OpenParen", line: {{ *}}[[@LINE-3]], column: 5, indent: 1, spelling: "(", closing_token: 4 } // CHECK:STDOUT: - { index: 4, kind: "CloseParen", line: {{ *}}[[@LINE-4]], column: 6, indent: 1, spelling: ")", opening_token: 3 } // CHECK:STDOUT: - { index: 5, kind: "OpenCurlyBrace", line: {{ *}}[[@LINE-5]], column: 8, indent: 1, spelling: "{", closing_token: 16, has_leading_space: true } - // CHECK:STDERR: fail_missing_open_paren_at_leaf.carbon:[[@LINE+3]]:19: error: closing symbol without a corresponding opening symbol [UnmatchedClosing] - // CHECK:STDERR: fail_missing_open_paren_at_leaf.carbon:[[@LINE+2]]:18: note: possibly missing `(` here [PossiblyMissingBracketHere] + // CHECK:STDERR: ╭─┤ fail_missing_open_paren_at_leaf.carbon:[[@LINE+9]]:19 + // CHECK:STDERR: -> │ var x: i32 = G 1); + // CHECK:STDERR: · ╷╻ + // CHECK:STDERR: · │┗━━┫ error: closing symbol without a corresponding opening + // CHECK:STDERR: · │ ┃ symbol + // CHECK:STDERR: · │ ┃ [UnmatchedClosing] + // CHECK:STDERR: · ╰─────┤ possibly missing `(` here [PossiblyMissingBracketHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var x: i32 = G 1); // CHECK:STDOUT: - { index: 6, kind: "Var", line: {{ *}}[[@LINE-1]], column: 3, indent: 3, spelling: "var", has_leading_space: true } @@ -475,7 +593,13 @@ fn F() { // CHECK:STDOUT: - { index: 3, kind: "OpenParen", line: {{ *}}[[@LINE-3]], column: 5, indent: 1, spelling: "(", closing_token: 4 } // CHECK:STDOUT: - { index: 4, kind: "CloseParen", line: {{ *}}[[@LINE-4]], column: 6, indent: 1, spelling: ")", opening_token: 3 } // CHECK:STDOUT: - { index: 5, kind: "OpenCurlyBrace", line: {{ *}}[[@LINE-5]], column: 8, indent: 1, spelling: "{", closing_token: 17, has_leading_space: true } - // CHECK:STDERR: fail_unmatched_closer.carbon:[[@LINE+2]]:20: error: closing symbol without a corresponding opening symbol [UnmatchedClosing] + // CHECK:STDERR: ╭─┤ fail_unmatched_closer.carbon:[[@LINE+8]]:20 + // CHECK:STDERR: -> │ var x: i32 = G(x)); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: closing symbol without a corresponding opening + // CHECK:STDERR: · ┃ symbol + // CHECK:STDERR: · ┃ [UnmatchedClosing] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var x: i32 = G(x)); // CHECK:STDOUT: - { index: 6, kind: "Var", line: {{ *}}[[@LINE-1]], column: 3, indent: 3, spelling: "var", has_leading_space: true } @@ -505,8 +629,13 @@ fn F() { // CHECK:STDOUT: - { index: 3, kind: "OpenParen", line: {{ *}}[[@LINE-3]], column: 5, indent: 1, spelling: "(", closing_token: 4 } // CHECK:STDOUT: - { index: 4, kind: "CloseParen", line: {{ *}}[[@LINE-4]], column: 6, indent: 1, spelling: ")", opening_token: 3 } // CHECK:STDOUT: - { index: 5, kind: "OpenCurlyBrace", line: {{ *}}[[@LINE-5]], column: 8, indent: 1, spelling: "{", closing_token: 13, has_leading_space: true } - // CHECK:STDERR: fail_two_damaged_regions.carbon:[[@LINE+3]]:4: error: opening symbol without a corresponding closing symbol [UnmatchedOpening] - // CHECK:STDERR: fail_two_damaged_regions.carbon:[[@LINE+2]]:6: note: possibly missing `)` here [PossiblyMissingBracketHere] + // CHECK:STDERR: ╭─┤ fail_two_damaged_regions.carbon:[[@LINE+8]]:4 + // CHECK:STDERR: -> │ G(1 + 2; + // CHECK:STDERR: · ┳ ┬ + // CHECK:STDERR: · ┗━━━━┫ error: opening symbol without a corresponding closing symbol + // CHECK:STDERR: · │ ┃ [UnmatchedOpening] + // CHECK:STDERR: · ╰────┤ possibly missing `)` here [PossiblyMissingBracketHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: G(1 + 2; // CHECK:STDOUT: - { index: 6, kind: "Identifier", line: {{ *}}[[@LINE-1]], column: 3, indent: 3, spelling: "G", identifier: 1, has_leading_space: true } @@ -525,8 +654,15 @@ fn H() { // CHECK:STDOUT: - { index: 16, kind: "OpenParen", line: {{ *}}[[@LINE-3]], column: 5, indent: 1, spelling: "(", closing_token: 17 } // CHECK:STDOUT: - { index: 17, kind: "CloseParen", line: {{ *}}[[@LINE-4]], column: 6, indent: 1, spelling: ")", opening_token: 16 } // CHECK:STDOUT: - { index: 18, kind: "OpenCurlyBrace", line: {{ *}}[[@LINE-5]], column: 8, indent: 1, spelling: "{", closing_token: 31, has_leading_space: true } - // CHECK:STDERR: fail_two_damaged_regions.carbon:[[@LINE+3]]:17: error: opening symbol without a corresponding closing symbol [UnmatchedOpening] - // CHECK:STDERR: fail_two_damaged_regions.carbon:[[@LINE+2]]:24: note: possibly missing `}` here [PossiblyMissingBracketHere] + // CHECK:STDERR: ╭─┤ fail_two_damaged_regions.carbon:[[@LINE+10]]:17 + // CHECK:STDERR: -> │ var y: auto = {.a = 3; + // CHECK:STDERR: · ┳ ┬ + // CHECK:STDERR: · ┗━━━━━━━━━┫ error: opening symbol without a corresponding + // CHECK:STDERR: · │ ┃ closing symbol + // CHECK:STDERR: · │ ┃ [UnmatchedOpening] + // CHECK:STDERR: · ╰────┤ possibly missing `}` here + // CHECK:STDERR: · │ [PossiblyMissingBracketHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var y: auto = {.a = 3; // CHECK:STDOUT: - { index: 19, kind: "Var", line: {{ *}}[[@LINE-1]], column: 3, indent: 3, spelling: "var", has_leading_space: true } diff --git a/toolchain/lex/testdata/fail_mismatched_brackets_at_start_of_file.carbon b/toolchain/lex/testdata/fail_mismatched_brackets_at_start_of_file.carbon index e5394fe2a69a..4b034e0f17b3 100644 --- a/toolchain/lex/testdata/fail_mismatched_brackets_at_start_of_file.carbon +++ b/toolchain/lex/testdata/fail_mismatched_brackets_at_start_of_file.carbon @@ -18,12 +18,27 @@ // --- AUTOUPDATE-SPLIT -// CHECK:STDERR: fail_mismatch_at_start_of_file.carbon:1:1: error: opening symbol without a corresponding closing symbol [UnmatchedOpening] +// CHECK:STDERR: ╭─┤ fail_mismatch_at_start_of_file.carbon:1:1 +// CHECK:STDERR: -> │ (}var( +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: opening symbol without a corresponding closing symbol +// CHECK:STDERR: · ┃ [UnmatchedOpening] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_mismatch_at_start_of_file.carbon:1:2: error: closing symbol without a corresponding opening symbol [UnmatchedClosing] +// CHECK:STDERR: ╭─┤ fail_mismatch_at_start_of_file.carbon:1:2 +// CHECK:STDERR: -> │ (}var( +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: closing symbol without a corresponding opening symbol +// CHECK:STDERR: · ┃ [UnmatchedClosing] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_mismatch_at_start_of_file.carbon:1:6: error: opening symbol without a corresponding closing symbol [UnmatchedOpening] -// CHECK:STDERR: fail_mismatch_at_start_of_file.carbon:1:7: note: possibly missing `)` here [PossiblyMissingBracketHere] +// CHECK:STDERR: ╭─┤ fail_mismatch_at_start_of_file.carbon:1:6 +// CHECK:STDERR: -> │ (}var( +// CHECK:STDERR: · ╻╷ +// CHECK:STDERR: · ┗━━━┫ error: opening symbol without a corresponding closing symbol +// CHECK:STDERR: · │ ┃ [UnmatchedOpening] +// CHECK:STDERR: · ╰────┤ possibly missing `)` here [PossiblyMissingBracketHere] +// CHECK:STDERR: ╰──── // CHECK:STDERR: // CHECK:STDOUT: - filename: fail_mismatch_at_start_of_file.carbon // CHECK:STDOUT: tokens: diff --git a/toolchain/lex/testdata/fail_mismatched_brackets_close_brace.carbon b/toolchain/lex/testdata/fail_mismatched_brackets_close_brace.carbon index f15ceddc062c..b28d637b38b8 100644 --- a/toolchain/lex/testdata/fail_mismatched_brackets_close_brace.carbon +++ b/toolchain/lex/testdata/fail_mismatched_brackets_close_brace.carbon @@ -61,17 +61,49 @@ fn F() { // --- AUTOUPDATE-SPLIT -// CHECK:STDERR: fail_dedent_inside_scope.carbon:7:10: error: opening symbol without a corresponding closing symbol [UnmatchedOpening] -// CHECK:STDERR: fail_dedent_inside_scope.carbon:9:3: note: possibly missing `}` here [PossiblyMissingBracketHere] +// CHECK:STDERR: ╭─┤ fail_dedent_inside_scope.carbon:7:10 +// CHECK:STDERR: -> │ if (x) { +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: opening symbol without a corresponding closing symbol +// CHECK:STDERR: · ┃ [UnmatchedOpening] +// CHECK:STDERR: │ foo(); +// CHECK:STDERR: │ bar(); +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ possibly missing `}` here [PossiblyMissingBracketHere] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_missing_brace_before_else.carbon:8:10: error: opening symbol without a corresponding closing symbol [UnmatchedOpening] -// CHECK:STDERR: fail_missing_brace_before_else.carbon:10:3: note: possibly missing `}` here [PossiblyMissingBracketHere] +// CHECK:STDERR: ╭─┤ fail_missing_brace_before_else.carbon:8:10 +// CHECK:STDERR: -> │ if (C) { +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: opening symbol without a corresponding closing symbol +// CHECK:STDERR: · ┃ [UnmatchedOpening] +// CHECK:STDERR: │ G(); +// CHECK:STDERR: │ else { +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ possibly missing `}` here [PossiblyMissingBracketHere] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_missing_brace_in_class.carbon:5:9: error: opening symbol without a corresponding closing symbol [UnmatchedOpening] -// CHECK:STDERR: fail_missing_brace_in_class.carbon:7:1: note: possibly missing `}` here [PossiblyMissingBracketHere] +// CHECK:STDERR: ╭─┤ fail_missing_brace_in_class.carbon:5:9 +// CHECK:STDERR: -> │ class C { +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: opening symbol without a corresponding closing symbol +// CHECK:STDERR: · ┃ [UnmatchedOpening] +// CHECK:STDERR: │ var a: i32; +// CHECK:STDERR: │ fn F() { +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ possibly missing `}` here [PossiblyMissingBracketHere] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_unclosed_at_eof.carbon:4:8: error: opening symbol without a corresponding closing symbol [UnmatchedOpening] -// CHECK:STDERR: fail_unclosed_at_eof.carbon:6:1: note: possibly missing `}` here [PossiblyMissingBracketHere] +// CHECK:STDERR: ╭─┤ fail_unclosed_at_eof.carbon:4:8 +// CHECK:STDERR: -> │ fn F() { +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: opening symbol without a corresponding closing symbol +// CHECK:STDERR: · ┃ [UnmatchedOpening] +// CHECK:STDERR: │ var x: i32 = 1; +// CHECK:STDERR: │ +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ possibly missing `}` here [PossiblyMissingBracketHere] +// CHECK:STDERR: ╰──── // CHECK:STDERR: // CHECK:STDOUT: - filename: fail_dedent_inside_scope.carbon // CHECK:STDOUT: tokens: diff --git a/toolchain/lex/testdata/fail_mismatched_brackets_line_end.carbon b/toolchain/lex/testdata/fail_mismatched_brackets_line_end.carbon index 0647eab6b1b2..f8eb296ca4b0 100644 --- a/toolchain/lex/testdata/fail_mismatched_brackets_line_end.carbon +++ b/toolchain/lex/testdata/fail_mismatched_brackets_line_end.carbon @@ -29,8 +29,16 @@ fn F() { // CHECK:STDOUT: - { index: 12, kind: "OpenParen", line: {{ *}}[[@LINE-2]], column: 6, indent: 5, spelling: "(", closing_token: 13 } // CHECK:STDOUT: - { index: 13, kind: "CloseParen", line: {{ *}}[[@LINE-3]], column: 7, indent: 5, spelling: ")", opening_token: 12 } // CHECK:STDOUT: - { index: 14, kind: "Semi", line: {{ *}}[[@LINE-4]], column: 8, indent: 5, spelling: ";" } - // CHECK:STDERR: fail_mismatched_brackets_line_end.carbon:[[@LINE+3]]:3: error: closing symbol without a corresponding opening symbol [UnmatchedClosing] - // CHECK:STDERR: fail_mismatched_brackets_line_end.carbon:[[@LINE-12]]:12: note: possibly missing `{` here [PossiblyMissingBracketHere] + // CHECK:STDERR: ╭─┤ fail_mismatched_brackets_line_end.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ if (true) // A comment. + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ possibly missing `{` here [PossiblyMissingBracketHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ } + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: closing symbol without a corresponding opening symbol + // CHECK:STDERR: · ┃ [UnmatchedClosing] + // CHECK:STDERR: ╰──── // CHECK:STDERR: } // CHECK:STDOUT: - { index: 15, kind: "CloseCurlyBrace", line: {{ *}}[[@LINE-1]], column: 3, indent: 3, spelling: "}", opening_token: 10, has_leading_space: true } diff --git a/toolchain/lex/testdata/fail_multifile.carbon b/toolchain/lex/testdata/fail_multifile.carbon index 7829ec6a89db..2c1c8013069b 100644 --- a/toolchain/lex/testdata/fail_multifile.carbon +++ b/toolchain/lex/testdata/fail_multifile.carbon @@ -11,7 +11,11 @@ // --- fail_a.carbon // CHECK:STDOUT: - filename: fail_a.carbon // CHECK:STDOUT: tokens: -// CHECK:STDERR: fail_a.carbon:[[@LINE+2]]:3: error: empty digit sequence in numeric literal [EmptyDigitSequence] +// CHECK:STDERR: ╭─┤ fail_a.carbon:[[@LINE+6]]:3 +// CHECK:STDERR: -> │ 1.a +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: empty digit sequence in numeric literal [EmptyDigitSequence] +// CHECK:STDERR: ╰──── // CHECK:STDERR: 1.a // CHECK:STDOUT: - { index: 1, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "1.a", has_leading_space: true } @@ -19,7 +23,11 @@ // --- fail_b.carbon // CHECK:STDOUT: - filename: fail_b.carbon // CHECK:STDOUT: tokens: -// CHECK:STDERR: fail_b.carbon:[[@LINE+2]]:3: error: empty digit sequence in numeric literal [EmptyDigitSequence] +// CHECK:STDERR: ╭─┤ fail_b.carbon:[[@LINE+6]]:3 +// CHECK:STDERR: -> │ 2.b +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: empty digit sequence in numeric literal [EmptyDigitSequence] +// CHECK:STDERR: ╰──── // CHECK:STDERR: 2.b // CHECK:STDOUT: - { index: 1, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "2.b", has_leading_space: true } diff --git a/toolchain/lex/testdata/fail_multiline_string_introducer.carbon b/toolchain/lex/testdata/fail_multiline_string_introducer.carbon index 9823d0d0a715..6c6f92077dca 100644 --- a/toolchain/lex/testdata/fail_multiline_string_introducer.carbon +++ b/toolchain/lex/testdata/fail_multiline_string_introducer.carbon @@ -16,7 +16,14 @@ // A `'''` in the middle of a line cannot close a block string literal, so a // single-line use is a malformed introducer. -// CHECK:STDERR: fail_multiline_string_introducer.carbon:[[@LINE+2]]:17: error: invalid multi-line string literal introducer; a file type indicator may not contain `'`, `#`, or `"`, and the content must begin on a new line [MultiLineStringInvalidIntroducer] +// CHECK:STDERR: ╭─┤ fail_multiline_string_introducer.carbon:[[@LINE+9]]:17 +// CHECK:STDERR: -> │ var s: String = '''not multi-line'''; +// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid multi-line string literal introducer; a file +// CHECK:STDERR: · ┃ type indicator may not contain `'`, `#`, or `"`, and +// CHECK:STDERR: · ┃ the content must begin on a new line +// CHECK:STDERR: · ┃ [MultiLineStringInvalidIntroducer] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var s: String = '''not multi-line'''; // CHECK:STDOUT: - { index: 1, kind: "Var", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "var", has_leading_space: true } @@ -28,7 +35,14 @@ var s: String = '''not multi-line'''; // A file type indicator may not contain `#`. The error covers the introducer // line and lexing continues on the next line. -// CHECK:STDERR: fail_multiline_string_introducer.carbon:[[@LINE+2]]:17: error: invalid multi-line string literal introducer; a file type indicator may not contain `'`, `#`, or `"`, and the content must begin on a new line [MultiLineStringInvalidIntroducer] +// CHECK:STDERR: ╭─┤ fail_multiline_string_introducer.carbon:[[@LINE+9]]:17 +// CHECK:STDERR: -> │ var t: String = '''bad#type +// CHECK:STDERR: · ┳━━━━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: invalid multi-line string literal introducer; a file +// CHECK:STDERR: · ┃ type indicator may not contain `'`, `#`, or `"`, and +// CHECK:STDERR: · ┃ the content must begin on a new line +// CHECK:STDERR: · ┃ [MultiLineStringInvalidIntroducer] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var t: String = '''bad#type // CHECK:STDOUT: - { index: 7, kind: "Var", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "var", has_leading_space: true } diff --git a/toolchain/lex/testdata/multiline_string_literals.carbon b/toolchain/lex/testdata/multiline_string_literals.carbon index e85910c6a2d6..1da4ddd62619 100644 --- a/toolchain/lex/testdata/multiline_string_literals.carbon +++ b/toolchain/lex/testdata/multiline_string_literals.carbon @@ -37,10 +37,23 @@ var s: String = '''py // A trailing comment with ', #, and " in it. // --- AUTOUPDATE-SPLIT -// CHECK:STDERR: fail_indent_mismatch.carbon:3:1: error: indentation does not match that of the closing `'''` in multi-line string literal [MismatchedIndentInString] -// CHECK:STDERR: fail_indent_mismatch.carbon:4:1-2: note: closing `'''` is indented to here [ClosingDelimiterIndent] +// CHECK:STDERR: ╭─┤ fail_indent_mismatch.carbon:3:1 +// CHECK:STDERR: -> │ a +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: indentation does not match that of the closing `'''` in multi-line +// CHECK:STDERR: · ┃ string literal +// CHECK:STDERR: · ┃ [MismatchedIndentInString] +// CHECK:STDERR: │ ''' +// CHECK:STDERR: · ─┬ +// CHECK:STDERR: · ╰──┤ closing `'''` is indented to here [ClosingDelimiterIndent] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_quotes.carbon:2:1: error: use `'''` delimiters for a multi-line string literal, not `"""` [MultiLineStringWithDoubleQuotes] +// CHECK:STDERR: ╭─┤ fail_quotes.carbon:2:1 +// CHECK:STDERR: -> │ """ +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┗━━┫ error: use `'''` delimiters for a multi-line string literal, not `"""` +// CHECK:STDERR: · ┃ [MultiLineStringWithDoubleQuotes] +// CHECK:STDERR: ╰──── // CHECK:STDERR: // CHECK:STDOUT: - filename: fail_indent_mismatch.carbon // CHECK:STDOUT: tokens: diff --git a/toolchain/lex/testdata/numeric_literals.carbon b/toolchain/lex/testdata/numeric_literals.carbon index 768876a73d4c..90a51c622eb3 100644 --- a/toolchain/lex/testdata/numeric_literals.carbon +++ b/toolchain/lex/testdata/numeric_literals.carbon @@ -101,7 +101,12 @@ fn F() { // CHECK:STDOUT: - filename: fail_binary_real.carbon // CHECK:STDOUT: tokens: -// CHECK:STDERR: fail_binary_real.carbon:[[@LINE+2]]:4: error: binary real number literals are not supported [InvalidRealLiteralRadix] +// CHECK:STDERR: ╭─┤ fail_binary_real.carbon:[[@LINE+7]]:4 +// CHECK:STDERR: -> │ 0b1.0 +// CHECK:STDERR: · ━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: binary real number literals are not supported +// CHECK:STDERR: · ┃ [InvalidRealLiteralRadix] +// CHECK:STDERR: ╰──── // CHECK:STDERR: 0b1.0 // CHECK:STDOUT: - { index: 1, kind: "RealLiteral", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "0b1.0", value: "2*2^-1", has_leading_space: true } @@ -110,7 +115,12 @@ fn F() { // CHECK:STDOUT: - filename: fail_octal_real.carbon // CHECK:STDOUT: tokens: -// CHECK:STDERR: fail_octal_real.carbon:[[@LINE+2]]:4: error: octal real number literals are not supported [InvalidRealLiteralRadix] +// CHECK:STDERR: ╭─┤ fail_octal_real.carbon:[[@LINE+7]]:4 +// CHECK:STDERR: -> │ 0o1.0 +// CHECK:STDERR: · ━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: octal real number literals are not supported +// CHECK:STDERR: · ┃ [InvalidRealLiteralRadix] +// CHECK:STDERR: ╰──── // CHECK:STDERR: 0o1.0 // CHECK:STDOUT: - { index: 1, kind: "RealLiteral", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "0o1.0", value: "8*2^-3", has_leading_space: true } @@ -120,7 +130,11 @@ fn F() { // CHECK:STDOUT: - filename: fail_wrong_real_exponent.carbon // CHECK:STDOUT: tokens: -// CHECK:STDERR: fail_wrong_real_exponent.carbon:[[@LINE+2]]:4: error: expected 'e' to introduce exponent [WrongRealLiteralExponent] +// CHECK:STDERR: ╭─┤ fail_wrong_real_exponent.carbon:[[@LINE+6]]:4 +// CHECK:STDERR: -> │ 1.0r3 +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected 'e' to introduce exponent [WrongRealLiteralExponent] +// CHECK:STDERR: ╰──── // CHECK:STDERR: 1.0r3 // CHECK:STDOUT: - { index: 1, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "1.0r3", has_leading_space: true } @@ -129,7 +143,11 @@ fn F() { // CHECK:STDOUT: - filename: fail_invalid_digit.carbon // CHECK:STDOUT: tokens: -// CHECK:STDERR: fail_invalid_digit.carbon:[[@LINE+2]]:4: error: invalid digit 'a' in hexadecimal numeric literal [InvalidDigit] +// CHECK:STDERR: ╭─┤ fail_invalid_digit.carbon:[[@LINE+6]]:4 +// CHECK:STDERR: -> │ 0x1a +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: invalid digit 'a' in hexadecimal numeric literal [InvalidDigit] +// CHECK:STDERR: ╰──── // CHECK:STDERR: 0x1a // CHECK:STDOUT: - { index: 1, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "0x1a", has_leading_space: true } @@ -138,7 +156,12 @@ fn F() { // CHECK:STDOUT: - filename: fail_invalid_separator.carbon // CHECK:STDOUT: tokens: -// CHECK:STDERR: fail_invalid_separator.carbon:[[@LINE+2]]:3: error: misplaced digit separator in numeric literal [InvalidDigitSeparator] +// CHECK:STDERR: ╭─┤ fail_invalid_separator.carbon:[[@LINE+7]]:3 +// CHECK:STDERR: -> │ 1__2 +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: misplaced digit separator in numeric literal +// CHECK:STDERR: · ┃ [InvalidDigitSeparator] +// CHECK:STDERR: ╰──── // CHECK:STDERR: 1__2 // CHECK:STDOUT: - { index: 1, kind: "IntLiteral", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "1__2", value: "12", has_leading_space: true } @@ -146,7 +169,12 @@ fn F() { // --- fail_fraction_separator.carbon // CHECK:STDOUT: - filename: fail_fraction_separator.carbon // CHECK:STDOUT: tokens: -// CHECK:STDERR: fail_fraction_separator.carbon:[[@LINE+2]]:7: error: misplaced digit separator in numeric literal [InvalidDigitSeparator] +// CHECK:STDERR: ╭─┤ fail_fraction_separator.carbon:[[@LINE+7]]:7 +// CHECK:STDERR: -> │ 1.0000_0000 +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: misplaced digit separator in numeric literal +// CHECK:STDERR: · ┃ [InvalidDigitSeparator] +// CHECK:STDERR: ╰──── // CHECK:STDERR: 1.0000_0000 // CHECK:STDOUT: - { index: 1, kind: "RealLiteral", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "1.0000_0000", value: "100000000*10^-9", has_leading_space: true } @@ -154,7 +182,12 @@ fn F() { // --- fail_fraction_separator_at_end.carbon // CHECK:STDOUT: - filename: fail_fraction_separator_at_end.carbon // CHECK:STDOUT: tokens: -// CHECK:STDERR: fail_fraction_separator_at_end.carbon:[[@LINE+2]]:6: error: misplaced digit separator in numeric literal [InvalidDigitSeparator] +// CHECK:STDERR: ╭─┤ fail_fraction_separator_at_end.carbon:[[@LINE+7]]:6 +// CHECK:STDERR: -> │ 1.000_ +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: misplaced digit separator in numeric literal +// CHECK:STDERR: · ┃ [InvalidDigitSeparator] +// CHECK:STDERR: ╰──── // CHECK:STDERR: 1.000_ // CHECK:STDOUT: - { index: 1, kind: "RealLiteral", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "1.000_", value: "1000*10^-4", has_leading_space: true } @@ -163,7 +196,11 @@ fn F() { // CHECK:STDOUT: - filename: fail_unknown_base.carbon // CHECK:STDOUT: tokens: -// CHECK:STDERR: fail_unknown_base.carbon:[[@LINE+2]]:1: error: unknown base specifier in numeric literal [UnknownBaseSpecifier] +// CHECK:STDERR: ╭─┤ fail_unknown_base.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ 05 +// CHECK:STDERR: · ━┳ +// CHECK:STDERR: · ┗━━┫ error: unknown base specifier in numeric literal [UnknownBaseSpecifier] +// CHECK:STDERR: ╰──── // CHECK:STDERR: 05 // CHECK:STDOUT: - { index: 1, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "05", has_leading_space: true } diff --git a/toolchain/lex/testdata/string_literals.carbon b/toolchain/lex/testdata/string_literals.carbon index 6a36886b4eaa..371e788e6e98 100644 --- a/toolchain/lex/testdata/string_literals.carbon +++ b/toolchain/lex/testdata/string_literals.carbon @@ -12,7 +12,13 @@ // CHECK:STDOUT: - filename: fail_decimal_escape.carbon // CHECK:STDOUT: tokens: -// CHECK:STDERR: fail_decimal_escape.carbon:[[@LINE+2]]:2: error: decimal digit follows `\0` escape sequence. Use `\x00` instead of `\0` if the next character is a digit [DecimalEscapeSequence] +// CHECK:STDERR: ╭─┤ fail_decimal_escape.carbon:[[@LINE+8]]:2 +// CHECK:STDERR: -> │ "\01" +// CHECK:STDERR: · ┳━━ +// CHECK:STDERR: · ┗━━┫ error: decimal digit follows `\0` escape sequence. Use `\x00` instead of +// CHECK:STDERR: · ┃ `\0` if the next character is a digit +// CHECK:STDERR: · ┃ [DecimalEscapeSequence] +// CHECK:STDERR: ╰──── // CHECK:STDERR: "\01" // CHECK:STDOUT: - { index: 1, kind: "StringLiteral", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "\"\\01\"", value: "\x001", has_leading_space: true } @@ -21,7 +27,11 @@ // CHECK:STDOUT: - filename: fail_unterminated.carbon // CHECK:STDOUT: tokens: -// CHECK:STDERR: fail_unterminated.carbon:[[@LINE+2]]:3: error: string literal is missing a terminator [UnterminatedString] +// CHECK:STDERR: ╭─┤ fail_unterminated.carbon:[[@LINE+6]]:3 +// CHECK:STDERR: -> │ "s +// CHECK:STDERR: · ─╴╻ +// CHECK:STDERR: · ┗━━┫ error: string literal is missing a terminator [UnterminatedString] +// CHECK:STDERR: ╰──── // CHECK:STDERR: "s // CHECK:STDOUT: - { index: 1, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "\"s", has_leading_space: true } @@ -31,7 +41,11 @@ // CHECK:STDOUT: - filename: fail_unknown_escape.carbon // CHECK:STDOUT: tokens: -// CHECK:STDERR: fail_unknown_escape.carbon:[[@LINE+2]]:2: error: unrecognized escape sequence `w` [UnknownEscapeSequence] +// CHECK:STDERR: ╭─┤ fail_unknown_escape.carbon:[[@LINE+6]]:2 +// CHECK:STDERR: -> │ "\w" +// CHECK:STDERR: · ━┳ +// CHECK:STDERR: · ┗━━┫ error: unrecognized escape sequence `w` [UnknownEscapeSequence] +// CHECK:STDERR: ╰──── // CHECK:STDERR: "\w" // CHECK:STDOUT: - { index: 1, kind: "StringLiteral", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "\"\\w\"", value: "w", has_leading_space: true } @@ -40,7 +54,11 @@ // CHECK:STDOUT: - filename: fail_raw_unknown_escape.carbon // CHECK:STDOUT: tokens: -// CHECK:STDERR: fail_raw_unknown_escape.carbon:[[@LINE+2]]:3: error: unrecognized escape sequence `w` [UnknownEscapeSequence] +// CHECK:STDERR: ╭─┤ fail_raw_unknown_escape.carbon:[[@LINE+6]]:3 +// CHECK:STDERR: -> │ #"\#w"# +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┗━━┫ error: unrecognized escape sequence `w` [UnknownEscapeSequence] +// CHECK:STDERR: ╰──── // CHECK:STDERR: #"\#w"# // CHECK:STDOUT: - { index: 1, kind: "StringLiteral", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "#\"\\#w\"#", value: "w", has_leading_space: true } @@ -49,7 +67,13 @@ // CHECK:STDOUT: - filename: fail_unicode_escape_missing_braced_digits.carbon // CHECK:STDOUT: tokens: -// CHECK:STDERR: fail_unicode_escape_missing_braced_digits.carbon:[[@LINE+2]]:4: error: escape sequence `\u` must be followed by a braced sequence of uppercase hexadecimal digits, for example `\u{70AD}}` [UnicodeEscapeMissingBracedDigits] +// CHECK:STDERR: ╭─┤ fail_unicode_escape_missing_braced_digits.carbon:[[@LINE+8]]:4 +// CHECK:STDERR: -> │ "\u" +// CHECK:STDERR: · ─╴╻ +// CHECK:STDERR: · ┗━━┫ error: escape sequence `\u` must be followed by a braced sequence of +// CHECK:STDERR: · ┃ uppercase hexadecimal digits, for example `\u{70AD}}` +// CHECK:STDERR: · ┃ [UnicodeEscapeMissingBracedDigits] +// CHECK:STDERR: ╰──── // CHECK:STDERR: "\u" // CHECK:STDOUT: - { index: 1, kind: "StringLiteral", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "\"\\u\"", value: "u", has_leading_space: true } @@ -58,7 +82,13 @@ // CHECK:STDOUT: - filename: fail_hex_escape_missing_digits.carbon // CHECK:STDOUT: tokens: -// CHECK:STDERR: fail_hex_escape_missing_digits.carbon:[[@LINE+2]]:4: error: escape sequence `\x` must be followed by two uppercase hexadecimal digits, for example `\x0F` [HexadecimalEscapeMissingDigits] +// CHECK:STDERR: ╭─┤ fail_hex_escape_missing_digits.carbon:[[@LINE+8]]:4 +// CHECK:STDERR: -> │ "\x" +// CHECK:STDERR: · ─╴╻ +// CHECK:STDERR: · ┗━━┫ error: escape sequence `\x` must be followed by two uppercase +// CHECK:STDERR: · ┃ hexadecimal digits, for example `\x0F` +// CHECK:STDERR: · ┃ [HexadecimalEscapeMissingDigits] +// CHECK:STDERR: ╰──── // CHECK:STDERR: "\x" // CHECK:STDOUT: - { index: 1, kind: "StringLiteral", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "\"\\x\"", value: "x", has_leading_space: true } @@ -67,7 +97,13 @@ // CHECK:STDOUT: - filename: fail_literal_tab_in_string.carbon // CHECK:STDOUT: tokens: -// CHECK:STDERR: fail_literal_tab_in_string.carbon:[[@LINE+2]]:2: error: whitespace other than plain space must be expressed with an escape sequence in a string literal [InvalidHorizontalWhitespaceInString] +// CHECK:STDERR: ╭─┤ fail_literal_tab_in_string.carbon:[[@LINE+8]]:2 +// CHECK:STDERR: -> │ " " +// CHECK:STDERR: · ┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: whitespace other than plain space must be expressed with an escape +// CHECK:STDERR: · ┃ sequence in a string literal +// CHECK:STDERR: · ┃ [InvalidHorizontalWhitespaceInString] +// CHECK:STDERR: ╰──── // CHECK:STDERR: " " // CHECK:STDOUT: - { index: 1, kind: "StringLiteral", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "\"\t\"", value: "\t", has_leading_space: true } @@ -76,7 +112,13 @@ // CHECK:STDOUT: - filename: fail_unicode_surrogate.carbon // CHECK:STDOUT: tokens: -// CHECK:STDERR: fail_unicode_surrogate.carbon:[[@LINE+2]]:5: error: code point specified by `\u{...}}` escape is a surrogate character [UnicodeEscapeSurrogate] +// CHECK:STDERR: ╭─┤ fail_unicode_surrogate.carbon:[[@LINE+8]]:5 +// CHECK:STDERR: -> │ "\u{D800}" +// CHECK:STDERR: · ┳━━━ +// CHECK:STDERR: · ┗━━┫ error: code point specified by `\u{...}}` escape is a surrogate +// CHECK:STDERR: · ┃ character +// CHECK:STDERR: · ┃ [UnicodeEscapeSurrogate] +// CHECK:STDERR: ╰──── // CHECK:STDERR: "\u{D800}" // CHECK:STDOUT: - { index: 1, kind: "StringLiteral", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "\"\\u{D800}\"", value: "u{D800}", has_leading_space: true } @@ -85,7 +127,13 @@ // CHECK:STDOUT: - filename: fail_unicode_length.carbon // CHECK:STDOUT: tokens: -// CHECK:STDERR: fail_unicode_length.carbon:[[@LINE+2]]:5: error: code point specified by `\u{...}}` escape is greater than 0x10FFFF [UnicodeEscapeTooLarge] +// CHECK:STDERR: ╭─┤ fail_unicode_length.carbon:[[@LINE+8]]:5 +// CHECK:STDERR: -> │ "\u{FFFFFFFF}" +// CHECK:STDERR: · ┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: code point specified by `\u{...}}` escape is greater than +// CHECK:STDERR: · ┃ 0x10FFFF +// CHECK:STDERR: · ┃ [UnicodeEscapeTooLarge] +// CHECK:STDERR: ╰──── // CHECK:STDERR: "\u{FFFFFFFF}" // CHECK:STDOUT: - { index: 1, kind: "StringLiteral", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "\"\\u{FFFFFFFF}\"", value: "u{FFFFFFFF}", has_leading_space: true } diff --git a/toolchain/lower/testdata/basics/fail_before_lowering.carbon b/toolchain/lower/testdata/basics/fail_before_lowering.carbon index fa946f73a4c7..bb32603550e0 100644 --- a/toolchain/lower/testdata/basics/fail_before_lowering.carbon +++ b/toolchain/lower/testdata/basics/fail_before_lowering.carbon @@ -12,8 +12,17 @@ // This validates that earlier errors prevent lowering, without crashing. -// CHECK:STDERR: fail_before_lowering.carbon:[[@LINE+4]]:1: error: unrecognized declaration introducer [UnrecognizedDecl] +// CHECK:STDERR: ╭─┤ fail_before_lowering.carbon:[[@LINE+13]]:1 +// CHECK:STDERR: -> │ a; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: unrecognized declaration introducer [UnrecognizedDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_before_lowering.carbon:[[@LINE+2]]:1: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo] +// CHECK:STDERR: ╭─┤ fail_before_lowering.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ a; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `handle invalid parse trees in `check`` +// CHECK:STDERR: · ┃ [SemanticsTodo] +// CHECK:STDERR: ╰──── // CHECK:STDERR: a; diff --git a/toolchain/parse/testdata/alias/fail_syntax.carbon b/toolchain/parse/testdata/alias/fail_syntax.carbon index 178bd5751cf9..1710486d7e4c 100644 --- a/toolchain/parse/testdata/alias/fail_syntax.carbon +++ b/toolchain/parse/testdata/alias/fail_syntax.carbon @@ -8,49 +8,101 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/alias/fail_syntax.carbon -// CHECK:STDERR: fail_syntax.carbon:[[@LINE+2]]:6: error: `alias` introducer should be followed by a name [ExpectedDeclName] +// CHECK:STDERR: ╭─┤ fail_syntax.carbon:[[@LINE+7]]:6 +// CHECK:STDERR: -> │ alias = b; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `alias` introducer should be followed by a name +// CHECK:STDERR: · ┃ [ExpectedDeclName] +// CHECK:STDERR: ╰──── // CHECK:STDERR: alias = b; -// CHECK:STDERR: fail_syntax.carbon:[[@LINE+2]]:8: error: `alias` requires a `=` for the source [ExpectedAliasInitializer] +// CHECK:STDERR: ╭─┤ fail_syntax.carbon:[[@LINE+7]]:8 +// CHECK:STDERR: -> │ alias a b; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `alias` requires a `=` for the source +// CHECK:STDERR: · ┃ [ExpectedAliasInitializer] +// CHECK:STDERR: ╰──── // CHECK:STDERR: alias a b; -// CHECK:STDERR: fail_syntax.carbon:[[@LINE+2]]:10: error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╭─┤ fail_syntax.carbon:[[@LINE+6]]:10 +// CHECK:STDERR: -> │ alias a =; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: alias a =; -// CHECK:STDERR: fail_syntax.carbon:[[@LINE+2]]:8: error: `alias` requires a `=` for the source [ExpectedAliasInitializer] +// CHECK:STDERR: ╭─┤ fail_syntax.carbon:[[@LINE+7]]:8 +// CHECK:STDERR: -> │ alias a; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `alias` requires a `=` for the source +// CHECK:STDERR: · ┃ [ExpectedAliasInitializer] +// CHECK:STDERR: ╰──── // CHECK:STDERR: alias a; -// CHECK:STDERR: fail_syntax.carbon:[[@LINE+2]]:6: error: `alias` introducer should be followed by a name [ExpectedDeclName] +// CHECK:STDERR: ╭─┤ fail_syntax.carbon:[[@LINE+7]]:6 +// CHECK:STDERR: -> │ alias =; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `alias` introducer should be followed by a name +// CHECK:STDERR: · ┃ [ExpectedDeclName] +// CHECK:STDERR: ╰──── // CHECK:STDERR: alias =; -// CHECK:STDERR: fail_syntax.carbon:[[@LINE+2]]:8: error: `alias` requires a `=` for the source [ExpectedAliasInitializer] +// CHECK:STDERR: ╭─┤ fail_syntax.carbon:[[@LINE+7]]:8 +// CHECK:STDERR: -> │ alias a b c = d; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `alias` requires a `=` for the source +// CHECK:STDERR: · ┃ [ExpectedAliasInitializer] +// CHECK:STDERR: ╰──── // CHECK:STDERR: alias a b c = d; -// CHECK:STDERR: fail_syntax.carbon:[[@LINE+2]]:12: error: `alias` declarations must end with a `;` [ExpectedDeclSemi] +// CHECK:STDERR: ╭─┤ fail_syntax.carbon:[[@LINE+7]]:12 +// CHECK:STDERR: -> │ alias a = b c d; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `alias` declarations must end with a `;` +// CHECK:STDERR: · ┃ [ExpectedDeclSemi] +// CHECK:STDERR: ╰──── // CHECK:STDERR: alias a = b c d; fn F() { - // CHECK:STDERR: fail_syntax.carbon:[[@LINE+2]]:8: error: `alias` introducer should be followed by a name [ExpectedDeclName] + // CHECK:STDERR: ╭─┤ fail_syntax.carbon:[[@LINE+7]]:8 + // CHECK:STDERR: -> │ alias; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: `alias` introducer should be followed by a name + // CHECK:STDERR: · ┃ [ExpectedDeclName] + // CHECK:STDERR: ╰──── // CHECK:STDERR: alias; - // CHECK:STDERR: fail_syntax.carbon:[[@LINE+2]]:12: error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╭─┤ fail_syntax.carbon:[[@LINE+6]]:12 + // CHECK:STDERR: -> │ alias a =; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╰──── // CHECK:STDERR: alias a =; - // CHECK:STDERR: fail_syntax.carbon:[[@LINE+2]]:12: error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╭─┤ fail_syntax.carbon:[[@LINE+6]]:12 + // CHECK:STDERR: -> │ alias a = + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╰──── // CHECK:STDERR: alias a = } -// CHECK:STDERR: fail_syntax.carbon:[[@LINE+2]]:12: error: `alias` declarations must end with a `;` [ExpectedDeclSemi] +// CHECK:STDERR: ╭─┤ fail_syntax.carbon:[[@LINE+7]]:12 +// CHECK:STDERR: -> │ alias a = b +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `alias` declarations must end with a `;` +// CHECK:STDERR: · ┃ [ExpectedDeclSemi] +// CHECK:STDERR: ╰──── // CHECK:STDERR: alias a = b diff --git a/toolchain/parse/testdata/array/fail_syntax.carbon b/toolchain/parse/testdata/array/fail_syntax.carbon index 5159d9316bf4..d7d40cc86f10 100644 --- a/toolchain/parse/testdata/array/fail_syntax.carbon +++ b/toolchain/parse/testdata/array/fail_syntax.carbon @@ -10,76 +10,164 @@ // --- fail_no_comma.carbon -// CHECK:STDERR: fail_no_comma.carbon:[[@LINE+4]]:17: error: expected `,` in `array(Type, Count)` [ExpectedArrayComma] +// CHECK:STDERR: ╭─┤ fail_no_comma.carbon:[[@LINE+13]]:17 +// CHECK:STDERR: -> │ var x: array(i32); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `,` in `array(Type, Count)` +// CHECK:STDERR: · ┃ [ExpectedArrayComma] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_no_comma.carbon:[[@LINE+2]]:17: error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╭─┤ fail_no_comma.carbon:[[@LINE+6]]:17 +// CHECK:STDERR: -> │ var x: array(i32); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: array(i32); // --- fail_invalid_char.carbon -// CHECK:STDERR: fail_invalid_char.carbon:[[@LINE+9]]:17: error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╭─┤ fail_invalid_char.carbon:[[@LINE+26]]:17 +// CHECK:STDERR: -> │ fn X() -> array(:); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_invalid_char.carbon:[[@LINE+7]]:17: error: expected `,` in `array(Type, Count)` [ExpectedArrayComma] +// CHECK:STDERR: ╭─┤ fail_invalid_char.carbon:[[@LINE+20]]:17 +// CHECK:STDERR: -> │ fn X() -> array(:); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `,` in `array(Type, Count)` +// CHECK:STDERR: · ┃ [ExpectedArrayComma] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_invalid_char.carbon:[[@LINE+5]]:17: error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╭─┤ fail_invalid_char.carbon:[[@LINE+13]]:17 +// CHECK:STDERR: -> │ fn X() -> array(:); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_invalid_char.carbon:[[@LINE+3]]:17: error: unexpected tokens before `)` [ExpectedCloseSymbol] -// CHECK:STDERR: fail_invalid_char.carbon:[[@LINE+2]]:16: note: matching this `(` [GroupOpenedHere] +// CHECK:STDERR: ╭─┤ fail_invalid_char.carbon:[[@LINE+7]]:17 +// CHECK:STDERR: -> │ fn X() -> array(:); +// CHECK:STDERR: · ╷╻ +// CHECK:STDERR: · │┗━━┫ error: unexpected tokens before `)` [ExpectedCloseSymbol] +// CHECK:STDERR: · ╰─────┤ matching this `(` [GroupOpenedHere] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn X() -> array(:); // --- fail_unlexed_expr.carbon -// CHECK:STDERR: fail_unlexed_expr.carbon:[[@LINE+7]]:14: error: encountered unrecognized characters while parsing [UnrecognizedCharacters] +// CHECK:STDERR: ╭─┤ fail_unlexed_expr.carbon:[[@LINE+21]]:14 +// CHECK:STDERR: -> │ var y: array(`); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: encountered unrecognized characters while parsing +// CHECK:STDERR: · ┃ [UnrecognizedCharacters] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_unlexed_expr.carbon:[[@LINE+5]]:14: error: expected `,` in `array(Type, Count)` [ExpectedArrayComma] +// CHECK:STDERR: ╭─┤ fail_unlexed_expr.carbon:[[@LINE+14]]:14 +// CHECK:STDERR: -> │ var y: array(`); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `,` in `array(Type, Count)` +// CHECK:STDERR: · ┃ [ExpectedArrayComma] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_unlexed_expr.carbon:[[@LINE+3]]:14: error: unexpected tokens before `)` [ExpectedCloseSymbol] -// CHECK:STDERR: fail_unlexed_expr.carbon:[[@LINE+2]]:13: note: matching this `(` [GroupOpenedHere] +// CHECK:STDERR: ╭─┤ fail_unlexed_expr.carbon:[[@LINE+7]]:14 +// CHECK:STDERR: -> │ var y: array(`); +// CHECK:STDERR: · ╷╻ +// CHECK:STDERR: · │┗━━┫ error: unexpected tokens before `)` [ExpectedCloseSymbol] +// CHECK:STDERR: · ╰─────┤ matching this `(` [GroupOpenedHere] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var y: array(`); // --- fail_no_open_paren.carbon -// CHECK:STDERR: fail_no_open_paren.carbon:[[@LINE+2]]:14: error: expected `(` after `array` [ExpectedParenAfter] +// CHECK:STDERR: ╭─┤ fail_no_open_paren.carbon:[[@LINE+6]]:14 +// CHECK:STDERR: -> │ var x: array i32, 1; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `(` after `array` [ExpectedParenAfter] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: array i32, 1; // --- fail_no_close_paren.carbon -// CHECK:STDERR: fail_no_close_paren.carbon:[[@LINE+5]]:13: error: opening symbol without a corresponding closing symbol [UnmatchedOpening] -// CHECK:STDERR: fail_no_close_paren.carbon:[[@LINE+4]]:18: note: possibly missing `)` here [PossiblyMissingBracketHere] +// CHECK:STDERR: ╭─┤ fail_no_close_paren.carbon:[[@LINE+15]]:13 +// CHECK:STDERR: -> │ var x: array(i32,; +// CHECK:STDERR: · ┳ ┬ +// CHECK:STDERR: · ┗━━━━━━━┫ error: opening symbol without a corresponding closing +// CHECK:STDERR: · │ ┃ symbol +// CHECK:STDERR: · │ ┃ [UnmatchedOpening] +// CHECK:STDERR: · ╰────┤ possibly missing `)` here [PossiblyMissingBracketHere] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_no_close_paren.carbon:[[@LINE+2]]:18: error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╭─┤ fail_no_close_paren.carbon:[[@LINE+6]]:18 +// CHECK:STDERR: -> │ var x: array(i32,; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: array(i32,; // --- fail_no_length.carbon -// CHECK:STDERR: fail_no_length.carbon:[[@LINE+2]]:18: error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╭─┤ fail_no_length.carbon:[[@LINE+6]]:18 +// CHECK:STDERR: -> │ var x: array(i32,); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: array(i32,); // --- fail_no_params.carbon -// CHECK:STDERR: fail_no_params.carbon:[[@LINE+6]]:14: error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╭─┤ fail_no_params.carbon:[[@LINE+19]]:14 +// CHECK:STDERR: -> │ var x: array(); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_no_params.carbon:[[@LINE+4]]:14: error: expected `,` in `array(Type, Count)` [ExpectedArrayComma] +// CHECK:STDERR: ╭─┤ fail_no_params.carbon:[[@LINE+13]]:14 +// CHECK:STDERR: -> │ var x: array(); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `,` in `array(Type, Count)` +// CHECK:STDERR: · ┃ [ExpectedArrayComma] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_no_params.carbon:[[@LINE+2]]:14: error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╭─┤ fail_no_params.carbon:[[@LINE+6]]:14 +// CHECK:STDERR: -> │ var x: array(); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: array(); // --- fail_keyword_alone.carbon -// CHECK:STDERR: fail_keyword_alone.carbon:[[@LINE+8]]:13: error: expected `(` after `array` [ExpectedParenAfter] +// CHECK:STDERR: ╭─┤ fail_keyword_alone.carbon:[[@LINE+25]]:13 +// CHECK:STDERR: -> │ var x: array; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `(` after `array` [ExpectedParenAfter] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_keyword_alone.carbon:[[@LINE+6]]:13: error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╭─┤ fail_keyword_alone.carbon:[[@LINE+19]]:13 +// CHECK:STDERR: -> │ var x: array; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_keyword_alone.carbon:[[@LINE+4]]:13: error: expected `,` in `array(Type, Count)` [ExpectedArrayComma] +// CHECK:STDERR: ╭─┤ fail_keyword_alone.carbon:[[@LINE+13]]:13 +// CHECK:STDERR: -> │ var x: array; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `,` in `array(Type, Count)` +// CHECK:STDERR: · ┃ [ExpectedArrayComma] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_keyword_alone.carbon:[[@LINE+2]]:13: error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╭─┤ fail_keyword_alone.carbon:[[@LINE+6]]:13 +// CHECK:STDERR: -> │ var x: array; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: array; diff --git a/toolchain/parse/testdata/basics/fail_bracket_recovery.carbon b/toolchain/parse/testdata/basics/fail_bracket_recovery.carbon index 1678d138014d..f367925a0908 100644 --- a/toolchain/parse/testdata/basics/fail_bracket_recovery.carbon +++ b/toolchain/parse/testdata/basics/fail_bracket_recovery.carbon @@ -11,18 +11,42 @@ // This is a valid parse tree even though the lex errors. fn F() { var a: array(i32, 3) = (0, 1, 2); - // CHECK:STDERR: fail_bracket_recovery.carbon:[[@LINE+3]]:5: error: opening symbol without a corresponding closing symbol [UnmatchedOpening] - // CHECK:STDERR: fail_bracket_recovery.carbon:[[@LINE+2]]:7: note: possibly missing `]` here [PossiblyMissingBracketHere] + // CHECK:STDERR: ╭─┤ fail_bracket_recovery.carbon:[[@LINE+8]]:5 + // CHECK:STDERR: -> │ (a[1) + 1; + // CHECK:STDERR: · ┳ ┬ + // CHECK:STDERR: · ┗━━━━┫ error: opening symbol without a corresponding closing symbol + // CHECK:STDERR: · │ ┃ [UnmatchedOpening] + // CHECK:STDERR: · ╰────┤ possibly missing `]` here [PossiblyMissingBracketHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: (a[1) + 1; - // CHECK:STDERR: fail_bracket_recovery.carbon:[[@LINE+9]]:15: error: opening symbol without a corresponding closing symbol [UnmatchedOpening] - // CHECK:STDERR: fail_bracket_recovery.carbon:[[@LINE+8]]:16: note: possibly missing `)` here [PossiblyMissingBracketHere] + // CHECK:STDERR: ╭─┤ fail_bracket_recovery.carbon:[[@LINE+28]]:15 + // CHECK:STDERR: -> │ var x: {.y: (} = {.y = ((}; + // CHECK:STDERR: · ╻╷ + // CHECK:STDERR: · ┗━━━┫ error: opening symbol without a corresponding closing symbol + // CHECK:STDERR: · │ ┃ [UnmatchedOpening] + // CHECK:STDERR: · ╰────┤ possibly missing `)` here [PossiblyMissingBracketHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_bracket_recovery.carbon:[[@LINE+6]]:26: error: opening symbol without a corresponding closing symbol [UnmatchedOpening] - // CHECK:STDERR: fail_bracket_recovery.carbon:[[@LINE+5]]:28: note: possibly missing `)` here [PossiblyMissingBracketHere] + // CHECK:STDERR: ╭─┤ fail_bracket_recovery.carbon:[[@LINE+20]]:26 + // CHECK:STDERR: -> │ var x: {.y: (} = {.y = ((}; + // CHECK:STDERR: · ┳ ┬ + // CHECK:STDERR: · ┗━━━━┫ error: opening symbol without a corresponding + // CHECK:STDERR: · │ ┃ closing symbol + // CHECK:STDERR: · │ ┃ [UnmatchedOpening] + // CHECK:STDERR: · ╰────┤ possibly missing `)` here + // CHECK:STDERR: · │ [PossiblyMissingBracketHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_bracket_recovery.carbon:[[@LINE+3]]:27: error: opening symbol without a corresponding closing symbol [UnmatchedOpening] - // CHECK:STDERR: fail_bracket_recovery.carbon:[[@LINE+2]]:28: note: possibly missing `)` here [PossiblyMissingBracketHere] + // CHECK:STDERR: ╭─┤ fail_bracket_recovery.carbon:[[@LINE+10]]:27 + // CHECK:STDERR: -> │ var x: {.y: (} = {.y = ((}; + // CHECK:STDERR: · ╻╷ + // CHECK:STDERR: · ┗━━━┫ error: opening symbol without a corresponding + // CHECK:STDERR: · │ ┃ closing symbol + // CHECK:STDERR: · │ ┃ [UnmatchedOpening] + // CHECK:STDERR: · ╰────┤ possibly missing `)` here + // CHECK:STDERR: · │ [PossiblyMissingBracketHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var x: {.y: (} = {.y = ((}; } diff --git a/toolchain/parse/testdata/basics/fail_invalid_designators.carbon b/toolchain/parse/testdata/basics/fail_invalid_designators.carbon index 9e834a793121..f9d6921be04a 100644 --- a/toolchain/parse/testdata/basics/fail_invalid_designators.carbon +++ b/toolchain/parse/testdata/basics/fail_invalid_designators.carbon @@ -10,10 +10,21 @@ // NOTE: Move to its own directory when more tests are added. fn F() { - // CHECK:STDERR: fail_invalid_designators.carbon:[[@LINE+2]]:5: error: expected identifier after `.` [ExpectedIdentifierAfterPeriodOrArrow] + // CHECK:STDERR: ╭─┤ fail_invalid_designators.carbon:[[@LINE+7]]:5 + // CHECK:STDERR: -> │ a.; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected identifier after `.` + // CHECK:STDERR: · ┃ [ExpectedIdentifierAfterPeriodOrArrow] + // CHECK:STDERR: ╰──── // CHECK:STDERR: a.; - // CHECK:STDERR: fail_invalid_designators.carbon:[[@LINE+2]]:5-6: error: expected identifier after `.`; prefix reserved word with `r#` to form a valid identifier [ExpectedIdentifierAfterPeriodOrArrow] + // CHECK:STDERR: ╭─┤ fail_invalid_designators.carbon:[[@LINE+8]]:5 + // CHECK:STDERR: -> │ a.fn; + // CHECK:STDERR: · ┳━ + // CHECK:STDERR: · ┗━━┫ error: expected identifier after `.`; prefix reserved word with `r#` to + // CHECK:STDERR: · ┃ form a valid identifier + // CHECK:STDERR: · ┃ [ExpectedIdentifierAfterPeriodOrArrow] + // CHECK:STDERR: ╰──── // CHECK:STDERR: a.fn; } diff --git a/toolchain/parse/testdata/basics/fail_missing_token_locations.carbon b/toolchain/parse/testdata/basics/fail_missing_token_locations.carbon index 46a7ab445eb2..c6ae275dd7c9 100644 --- a/toolchain/parse/testdata/basics/fail_missing_token_locations.carbon +++ b/toolchain/parse/testdata/basics/fail_missing_token_locations.carbon @@ -11,7 +11,12 @@ // --- fail_semi_before_comment.carbon // The `;` goes after the `1`, before the spaces and the comment. -// CHECK:STDERR: fail_semi_before_comment.carbon:[[@LINE+2]]:15: error: `var` declarations must end with a `;` [ExpectedDeclSemi] +// CHECK:STDERR: ╭─┤ fail_semi_before_comment.carbon:[[@LINE+7]]:15 +// CHECK:STDERR: -> │ var x: i32 = 1 // The value. +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `var` declarations must end with a `;` +// CHECK:STDERR: · ┃ [ExpectedDeclSemi] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: i32 = 1 // The value. var y: i32 = 2; @@ -19,9 +24,18 @@ var y: i32 = 2; // --- fail_expr_at_line_end.carbon fn F() { - // CHECK:STDERR: fail_expr_at_line_end.carbon:[[@LINE+4]]:15: error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╭─┤ fail_expr_at_line_end.carbon:[[@LINE+13]]:15 + // CHECK:STDERR: -> │ var x: i32 = + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_expr_at_line_end.carbon:[[@LINE+2]]:15: error: `var` declarations must end with a `;` [ExpectedDeclSemi] + // CHECK:STDERR: ╭─┤ fail_expr_at_line_end.carbon:[[@LINE+7]]:15 + // CHECK:STDERR: -> │ var x: i32 = + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: `var` declarations must end with a `;` + // CHECK:STDERR: · ┃ [ExpectedDeclSemi] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var x: i32 = var y: i32 = 2; @@ -33,7 +47,11 @@ fn F() { // than at the end of the line before. fn F() { var x: i32 = 1; - // CHECK:STDERR: fail_expr_at_statement_start.carbon:[[@LINE+2]]:3: error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╭─┤ fail_expr_at_statement_start.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ = 3; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╰──── // CHECK:STDERR: = 3; } diff --git a/toolchain/parse/testdata/basics/fail_modifiers_before_semi.carbon b/toolchain/parse/testdata/basics/fail_modifiers_before_semi.carbon index 564f9f45a632..5b2114305d2d 100644 --- a/toolchain/parse/testdata/basics/fail_modifiers_before_semi.carbon +++ b/toolchain/parse/testdata/basics/fail_modifiers_before_semi.carbon @@ -8,7 +8,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/basics/fail_modifiers_before_semi.carbon -// CHECK:STDERR: fail_modifiers_before_semi.carbon:[[@LINE+2]]:18: error: unrecognized declaration introducer [UnrecognizedDecl] +// CHECK:STDERR: ╭─┤ fail_modifiers_before_semi.carbon:[[@LINE+7]]:18 +// CHECK:STDERR: -> │ protected virtual; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: unrecognized declaration introducer +// CHECK:STDERR: · ┃ [UnrecognizedDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: protected virtual; diff --git a/toolchain/parse/testdata/basics/fail_no_intro_with_semi.carbon b/toolchain/parse/testdata/basics/fail_no_intro_with_semi.carbon index c359be7285bc..3f7781d6f351 100644 --- a/toolchain/parse/testdata/basics/fail_no_intro_with_semi.carbon +++ b/toolchain/parse/testdata/basics/fail_no_intro_with_semi.carbon @@ -8,7 +8,11 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/basics/fail_no_intro_with_semi.carbon -// CHECK:STDERR: fail_no_intro_with_semi.carbon:[[@LINE+2]]:1-3: error: unrecognized declaration introducer [UnrecognizedDecl] +// CHECK:STDERR: ╭─┤ fail_no_intro_with_semi.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ foo; +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┗━━┫ error: unrecognized declaration introducer [UnrecognizedDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: foo; diff --git a/toolchain/parse/testdata/basics/fail_no_intro_without_semi.carbon b/toolchain/parse/testdata/basics/fail_no_intro_without_semi.carbon index ace13cf3a88b..8962bf0dc1f9 100644 --- a/toolchain/parse/testdata/basics/fail_no_intro_without_semi.carbon +++ b/toolchain/parse/testdata/basics/fail_no_intro_without_semi.carbon @@ -8,7 +8,11 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/basics/fail_no_intro_without_semi.carbon -// CHECK:STDERR: fail_no_intro_without_semi.carbon:[[@LINE+2]]:1-3: error: unrecognized declaration introducer [UnrecognizedDecl] +// CHECK:STDERR: ╭─┤ fail_no_intro_without_semi.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ foo bar baz +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┗━━┫ error: unrecognized declaration introducer [UnrecognizedDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: foo bar baz diff --git a/toolchain/parse/testdata/basics/fail_paren_match_regression.carbon b/toolchain/parse/testdata/basics/fail_paren_match_regression.carbon index a409f6338228..a098677f9de0 100644 --- a/toolchain/parse/testdata/basics/fail_paren_match_regression.carbon +++ b/toolchain/parse/testdata/basics/fail_paren_match_regression.carbon @@ -8,11 +8,24 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/basics/fail_paren_match_regression.carbon -// CHECK:STDERR: fail_paren_match_regression.carbon:[[@LINE+6]]:4: error: expected pattern [ExpectedPattern] +// CHECK:STDERR: ╭─┤ fail_paren_match_regression.carbon:[[@LINE+19]]:4 +// CHECK:STDERR: -> │ var = (foo {}) +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected pattern [ExpectedPattern] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_paren_match_regression.carbon:[[@LINE+4]]:11: error: expected `,` or `)` [UnexpectedTokenAfterListElement] +// CHECK:STDERR: ╭─┤ fail_paren_match_regression.carbon:[[@LINE+13]]:11 +// CHECK:STDERR: -> │ var = (foo {}) +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `,` or `)` [UnexpectedTokenAfterListElement] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_paren_match_regression.carbon:[[@LINE+2]]:15: error: `var` declarations must end with a `;` [ExpectedDeclSemi] +// CHECK:STDERR: ╭─┤ fail_paren_match_regression.carbon:[[@LINE+7]]:15 +// CHECK:STDERR: -> │ var = (foo {}) +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `var` declarations must end with a `;` +// CHECK:STDERR: · ┃ [ExpectedDeclSemi] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var = (foo {}) diff --git a/toolchain/parse/testdata/basics/form_literals.carbon b/toolchain/parse/testdata/basics/form_literals.carbon index c987437c4801..09d088aa99a2 100644 --- a/toolchain/parse/testdata/basics/form_literals.carbon +++ b/toolchain/parse/testdata/basics/form_literals.carbon @@ -21,35 +21,84 @@ fn VarReturn() ->? form(ref i32); // --- fail_invalid_form_literal.carbon fn F() { - // CHECK:STDERR: fail_invalid_form_literal.carbon:[[@LINE+2]]:7: error: expected `(` after `form` [ExpectedParenAfter] + // CHECK:STDERR: ╭─┤ fail_invalid_form_literal.carbon:[[@LINE+6]]:7 + // CHECK:STDERR: -> │ form; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `(` after `form` [ExpectedParenAfter] + // CHECK:STDERR: ╰──── // CHECK:STDERR: form; - // CHECK:STDERR: fail_invalid_form_literal.carbon:[[@LINE+4]]:8: error: expected `ref`, `var`, or `val` after `form(` [ExpectedCategoryModifier] + // CHECK:STDERR: ╭─┤ fail_invalid_form_literal.carbon:[[@LINE+13]]:8 + // CHECK:STDERR: -> │ form(); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `ref`, `var`, or `val` after `form(` + // CHECK:STDERR: · ┃ [ExpectedCategoryModifier] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_invalid_form_literal.carbon:[[@LINE+2]]:8: error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╭─┤ fail_invalid_form_literal.carbon:[[@LINE+6]]:8 + // CHECK:STDERR: -> │ form(); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╰──── // CHECK:STDERR: form(); - // CHECK:STDERR: fail_invalid_form_literal.carbon:[[@LINE+2]]:8: error: expected `ref`, `var`, or `val` after `form(` [ExpectedCategoryModifier] + // CHECK:STDERR: ╭─┤ fail_invalid_form_literal.carbon:[[@LINE+7]]:8 + // CHECK:STDERR: -> │ form(i32); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `ref`, `var`, or `val` after `form(` + // CHECK:STDERR: · ┃ [ExpectedCategoryModifier] + // CHECK:STDERR: ╰──── // CHECK:STDERR: form(i32); - // CHECK:STDERR: fail_invalid_form_literal.carbon:[[@LINE+5]]:8: error: expected `ref`, `var`, or `val` after `form(` [ExpectedCategoryModifier] + // CHECK:STDERR: ╭─┤ fail_invalid_form_literal.carbon:[[@LINE+15]]:8 + // CHECK:STDERR: -> │ form(whole lot of nonsense); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `ref`, `var`, or `val` after `form(` + // CHECK:STDERR: · ┃ [ExpectedCategoryModifier] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_invalid_form_literal.carbon:[[@LINE+3]]:14-28: error: unexpected tokens before `)` [ExpectedCloseSymbol] - // CHECK:STDERR: fail_invalid_form_literal.carbon:[[@LINE+2]]:7: note: matching this `(` [GroupOpenedHere] + // CHECK:STDERR: ╭─┤ fail_invalid_form_literal.carbon:[[@LINE+8]]:14 + // CHECK:STDERR: -> │ form(whole lot of nonsense); + // CHECK:STDERR: · ┬ ━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · │ ┗━━┫ error: unexpected tokens before `)` + // CHECK:STDERR: · │ ┃ [ExpectedCloseSymbol] + // CHECK:STDERR: · ╰──────────────────┤ matching this `(` [GroupOpenedHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: form(whole lot of nonsense); - // CHECK:STDERR: fail_invalid_form_literal.carbon:[[@LINE+3]]:18-32: error: unexpected tokens before `)` [ExpectedCloseSymbol] - // CHECK:STDERR: fail_invalid_form_literal.carbon:[[@LINE+2]]:7: note: matching this `(` [GroupOpenedHere] + // CHECK:STDERR: ╭─┤ fail_invalid_form_literal.carbon:[[@LINE+8]]:18 + // CHECK:STDERR: -> │ form(var whole lot of nonsense); + // CHECK:STDERR: · ┬ ━━━━━━━┳━━━━━━━ + // CHECK:STDERR: · │ ┗━━┫ error: unexpected tokens before `)` + // CHECK:STDERR: · │ ┃ [ExpectedCloseSymbol] + // CHECK:STDERR: · ╰──────────────────────┤ matching this `(` [GroupOpenedHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: form(var whole lot of nonsense); - // CHECK:STDERR: fail_invalid_form_literal.carbon:[[@LINE+4]]:8: error: expected `(` after `form` [ExpectedParenAfter] + // CHECK:STDERR: ╭─┤ fail_invalid_form_literal.carbon:[[@LINE+12]]:8 + // CHECK:STDERR: -> │ form whole lot of nonsense; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `(` after `form` [ExpectedParenAfter] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_invalid_form_literal.carbon:[[@LINE+2]]:7: error: expected `;` after expression statement [ExpectedExprSemi] + // CHECK:STDERR: ╭─┤ fail_invalid_form_literal.carbon:[[@LINE+6]]:7 + // CHECK:STDERR: -> │ form whole lot of nonsense; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `;` after expression statement [ExpectedExprSemi] + // CHECK:STDERR: ╰──── // CHECK:STDERR: form whole lot of nonsense; - // CHECK:STDERR: fail_invalid_form_literal.carbon:[[@LINE+4]]:8: error: expected `(` after `form` [ExpectedParenAfter] + // CHECK:STDERR: ╭─┤ fail_invalid_form_literal.carbon:[[@LINE+12]]:8 + // CHECK:STDERR: -> │ form var whole lot of nonsense; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `(` after `form` [ExpectedParenAfter] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_invalid_form_literal.carbon:[[@LINE+2]]:7: error: expected `;` after expression statement [ExpectedExprSemi] + // CHECK:STDERR: ╭─┤ fail_invalid_form_literal.carbon:[[@LINE+6]]:7 + // CHECK:STDERR: -> │ form var whole lot of nonsense; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `;` after expression statement [ExpectedExprSemi] + // CHECK:STDERR: ╰──── // CHECK:STDERR: form var whole lot of nonsense; } diff --git a/toolchain/parse/testdata/basics/multiline_string_recovery.carbon b/toolchain/parse/testdata/basics/multiline_string_recovery.carbon index b00250517b89..980ff0b06eb5 100644 --- a/toolchain/parse/testdata/basics/multiline_string_recovery.carbon +++ b/toolchain/parse/testdata/basics/multiline_string_recovery.carbon @@ -18,7 +18,12 @@ fn F() { // The error skips past the string literal's group and the tokens after the // closing delimiter, ending the declaration at the `;` so that the following // declaration parses cleanly. - // CHECK:STDERR: fail_string_in_skipped_group.carbon:[[@LINE+2]]:19: error: `var` declarations must end with a `;` [ExpectedDeclSemi] + // CHECK:STDERR: ╭─┤ fail_string_in_skipped_group.carbon:[[@LINE+7]]:19 + // CHECK:STDERR: -> │ var x: i32 = bad bad (''' + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: `var` declarations must end with a `;` + // CHECK:STDERR: · ┃ [ExpectedDeclSemi] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var x: i32 = bad bad (''' str diff --git a/toolchain/parse/testdata/basics/multiline_token.carbon b/toolchain/parse/testdata/basics/multiline_token.carbon index 7fa5f0ed8202..c7c97b9ab235 100644 --- a/toolchain/parse/testdata/basics/multiline_token.carbon +++ b/toolchain/parse/testdata/basics/multiline_token.carbon @@ -12,7 +12,11 @@ // --- fail_multiline_token.carbon -// CHECK:STDERR: fail_multiline_token.carbon:[[@LINE+2]]:1-13: error: unrecognized declaration introducer [UnrecognizedDecl] +// CHECK:STDERR: ╭─┤ fail_multiline_token.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ ''' +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┗━━┫ error: unrecognized declaration introducer [UnrecognizedDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: ''' hello diff --git a/toolchain/parse/testdata/choice/fail_alternative_with_implicit_params.carbon b/toolchain/parse/testdata/choice/fail_alternative_with_implicit_params.carbon index 28b2cab3d720..8eeaf910e0da 100644 --- a/toolchain/parse/testdata/choice/fail_alternative_with_implicit_params.carbon +++ b/toolchain/parse/testdata/choice/fail_alternative_with_implicit_params.carbon @@ -9,7 +9,11 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/choice/fail_alternative_with_implicit_params.carbon choice X { - // CHECK:STDERR: fail_alternative_with_implicit_params.carbon:[[@LINE+2]]:4: error: expected `,` or `}` [UnexpectedTokenAfterListElement] + // CHECK:STDERR: ╭─┤ fail_alternative_with_implicit_params.carbon:[[@LINE+6]]:4 + // CHECK:STDERR: -> │ A[T: type](value: T) + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `,` or `}` [UnexpectedTokenAfterListElement] + // CHECK:STDERR: ╰──── // CHECK:STDERR: A[T: type](value: T) } diff --git a/toolchain/parse/testdata/choice/fail_invalid_alternative_identifier.carbon b/toolchain/parse/testdata/choice/fail_invalid_alternative_identifier.carbon index 5a45391dc39b..e66e74ef0ee3 100644 --- a/toolchain/parse/testdata/choice/fail_invalid_alternative_identifier.carbon +++ b/toolchain/parse/testdata/choice/fail_invalid_alternative_identifier.carbon @@ -9,10 +9,19 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/choice/fail_invalid_alternative_identifier.carbon choice InvalidAlternativeIdentifier { - // CHECK:STDERR: fail_invalid_alternative_identifier.carbon:[[@LINE+2]]:5: error: expected choice alternative name [ExpectedChoiceAlternativeName] + // CHECK:STDERR: ╭─┤ fail_invalid_alternative_identifier.carbon:[[@LINE+6]]:5 + // CHECK:STDERR: -> │ ,Some, + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected choice alternative name [ExpectedChoiceAlternativeName] + // CHECK:STDERR: ╰──── // CHECK:STDERR: ,Some, - // CHECK:STDERR: fail_invalid_alternative_identifier.carbon:[[@LINE+2]]:5-6: error: expected choice alternative name [ExpectedChoiceAlternativeName] + // CHECK:STDERR: ╭─┤ fail_invalid_alternative_identifier.carbon:[[@LINE+7]]:5 + // CHECK:STDERR: -> │ 42, + // CHECK:STDERR: · ━┳ + // CHECK:STDERR: · ┗━━┫ error: expected choice alternative name + // CHECK:STDERR: · ┃ [ExpectedChoiceAlternativeName] + // CHECK:STDERR: ╰──── // CHECK:STDERR: 42, Other diff --git a/toolchain/parse/testdata/choice/fail_invalid_braces.carbon b/toolchain/parse/testdata/choice/fail_invalid_braces.carbon index 01cce8bcc5ff..0aef677cee45 100644 --- a/toolchain/parse/testdata/choice/fail_invalid_braces.carbon +++ b/toolchain/parse/testdata/choice/fail_invalid_braces.carbon @@ -8,11 +8,20 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/choice/fail_invalid_braces.carbon -// CHECK:STDERR: fail_invalid_braces.carbon:[[@LINE+2]]:22: error: choice definition expected [ExpectedChoiceDefinition] +// CHECK:STDERR: ╭─┤ fail_invalid_braces.carbon:[[@LINE+7]]:22 +// CHECK:STDERR: -> │ choice InvalidBraces | +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: choice definition expected +// CHECK:STDERR: · ┃ [ExpectedChoiceDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: choice InvalidBraces | Some -// CHECK:STDERR: fail_invalid_braces.carbon:[[@LINE+2]]:1: error: unrecognized declaration introducer [UnrecognizedDecl] +// CHECK:STDERR: ╭─┤ fail_invalid_braces.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ | +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: unrecognized declaration introducer [UnrecognizedDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: | diff --git a/toolchain/parse/testdata/choice/fail_keyword_alternative_name.carbon b/toolchain/parse/testdata/choice/fail_keyword_alternative_name.carbon index 155665aec6c3..65d9047de621 100644 --- a/toolchain/parse/testdata/choice/fail_keyword_alternative_name.carbon +++ b/toolchain/parse/testdata/choice/fail_keyword_alternative_name.carbon @@ -9,7 +9,13 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/choice/fail_keyword_alternative_name.carbon choice C { - // CHECK:STDERR: fail_keyword_alternative_name.carbon:[[@LINE+2]]:3-7: error: expected choice alternative name; prefix reserved word with `r#` to form a valid identifier [ExpectedChoiceAlternativeName] + // CHECK:STDERR: ╭─┤ fail_keyword_alternative_name.carbon:[[@LINE+8]]:3 + // CHECK:STDERR: -> │ class, + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: expected choice alternative name; prefix reserved word with `r#` + // CHECK:STDERR: · ┃ to form a valid identifier + // CHECK:STDERR: · ┃ [ExpectedChoiceAlternativeName] + // CHECK:STDERR: ╰──── // CHECK:STDERR: class, Other diff --git a/toolchain/parse/testdata/choice/fail_missing_definition.carbon b/toolchain/parse/testdata/choice/fail_missing_definition.carbon index df49064c5767..7334dde3177e 100644 --- a/toolchain/parse/testdata/choice/fail_missing_definition.carbon +++ b/toolchain/parse/testdata/choice/fail_missing_definition.carbon @@ -8,7 +8,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/choice/fail_missing_definition.carbon -// CHECK:STDERR: fail_missing_definition.carbon:[[@LINE+2]]:25: error: choice definition expected [ExpectedChoiceDefinition] +// CHECK:STDERR: ╭─┤ fail_missing_definition.carbon:[[@LINE+7]]:25 +// CHECK:STDERR: -> │ choice MissingDefinition; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: choice definition expected +// CHECK:STDERR: · ┃ [ExpectedChoiceDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: choice MissingDefinition; diff --git a/toolchain/parse/testdata/choice/fail_missing_definition_parameterized.carbon b/toolchain/parse/testdata/choice/fail_missing_definition_parameterized.carbon index 35046c9c10e4..e9c2d2b2e1c0 100644 --- a/toolchain/parse/testdata/choice/fail_missing_definition_parameterized.carbon +++ b/toolchain/parse/testdata/choice/fail_missing_definition_parameterized.carbon @@ -8,7 +8,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/choice/fail_missing_definition_parameterized.carbon -// CHECK:STDERR: fail_missing_definition_parameterized.carbon:[[@LINE+2]]:34: error: choice definition expected [ExpectedChoiceDefinition] +// CHECK:STDERR: ╭─┤ fail_missing_definition_parameterized.carbon:[[@LINE+7]]:34 +// CHECK:STDERR: -> │ choice MissingDefinition(T: type); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: choice definition expected +// CHECK:STDERR: · ┃ [ExpectedChoiceDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: choice MissingDefinition(T: type); diff --git a/toolchain/parse/testdata/choice/fail_qualified_alternative_name.carbon b/toolchain/parse/testdata/choice/fail_qualified_alternative_name.carbon index 0f3fda19cba2..042eb2e14749 100644 --- a/toolchain/parse/testdata/choice/fail_qualified_alternative_name.carbon +++ b/toolchain/parse/testdata/choice/fail_qualified_alternative_name.carbon @@ -9,7 +9,11 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/choice/fail_qualified_alternative_name.carbon choice X { - // CHECK:STDERR: fail_qualified_alternative_name.carbon:[[@LINE+2]]:4: error: expected `,` or `}` [UnexpectedTokenAfterListElement] + // CHECK:STDERR: ╭─┤ fail_qualified_alternative_name.carbon:[[@LINE+6]]:4 + // CHECK:STDERR: -> │ A.B + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `,` or `}` [UnexpectedTokenAfterListElement] + // CHECK:STDERR: ╰──── // CHECK:STDERR: A.B } diff --git a/toolchain/parse/testdata/class/adapt.carbon b/toolchain/parse/testdata/class/adapt.carbon index 545375ea4af6..a223ab3c737f 100644 --- a/toolchain/parse/testdata/class/adapt.carbon +++ b/toolchain/parse/testdata/class/adapt.carbon @@ -36,25 +36,41 @@ adapt i32; // --- fail_bad_syntax.carbon class A { - // CHECK:STDERR: fail_bad_syntax.carbon:[[@LINE+2]]:10: error: `adapt` declarations must end with a `;` [ExpectedDeclSemi] + // CHECK:STDERR: ╭─┤ fail_bad_syntax.carbon:[[@LINE+6]]:10 + // CHECK:STDERR: -> │ adapt 1 trailing_token; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: `adapt` declarations must end with a `;` [ExpectedDeclSemi] + // CHECK:STDERR: ╰──── // CHECK:STDERR: adapt 1 trailing_token; } class B { - // CHECK:STDERR: fail_bad_syntax.carbon:[[@LINE+2]]:8: error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╭─┤ fail_bad_syntax.carbon:[[@LINE+6]]:8 + // CHECK:STDERR: -> │ adapt; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╰──── // CHECK:STDERR: adapt; } class C { - // CHECK:STDERR: fail_bad_syntax.carbon:[[@LINE+2]]:8: error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╭─┤ fail_bad_syntax.carbon:[[@LINE+6]]:8 + // CHECK:STDERR: -> │ adapt + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╰──── // CHECK:STDERR: adapt } class D { - // CHECK:STDERR: fail_bad_syntax.carbon:[[@LINE+2]]:8: error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╭─┤ fail_bad_syntax.carbon:[[@LINE+6]]:8 + // CHECK:STDERR: -> │ adapt class; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╰──── // CHECK:STDERR: adapt class; } diff --git a/toolchain/parse/testdata/class/fail_base.carbon b/toolchain/parse/testdata/class/fail_base.carbon index f831eb8b804f..7ce4780102a9 100644 --- a/toolchain/parse/testdata/class/fail_base.carbon +++ b/toolchain/parse/testdata/class/fail_base.carbon @@ -9,19 +9,36 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/class/fail_base.carbon class A { - // CHECK:STDERR: fail_base.carbon:[[@LINE+2]]:7: error: `class` or `:` expected after `base` [ExpectedAfterBase] + // CHECK:STDERR: ╭─┤ fail_base.carbon:[[@LINE+6]]:7 + // CHECK:STDERR: -> │ base; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: `class` or `:` expected after `base` [ExpectedAfterBase] + // CHECK:STDERR: ╰──── // CHECK:STDERR: base; - // CHECK:STDERR: fail_base.carbon:[[@LINE+2]]:7: error: `class` or `:` expected after `base` [ExpectedAfterBase] + // CHECK:STDERR: ╭─┤ fail_base.carbon:[[@LINE+6]]:7 + // CHECK:STDERR: -> │ base calss X {} + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: `class` or `:` expected after `base` [ExpectedAfterBase] + // CHECK:STDERR: ╰──── // CHECK:STDERR: base calss X {} - // CHECK:STDERR: fail_base.carbon:[[@LINE+2]]:8: error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╭─┤ fail_base.carbon:[[@LINE+6]]:8 + // CHECK:STDERR: -> │ base: ; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╰──── // CHECK:STDERR: base: ; - // CHECK:STDERR: fail_base.carbon:[[@LINE+2]]:12: error: `base` declarations must end with a `;` [ExpectedDeclSemi] + // CHECK:STDERR: ╭─┤ fail_base.carbon:[[@LINE+7]]:12 + // CHECK:STDERR: -> │ base: { } + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: `base` declarations must end with a `;` + // CHECK:STDERR: · ┃ [ExpectedDeclSemi] + // CHECK:STDERR: ╰──── // CHECK:STDERR: base: { } // We should resume parsing here after the previous error. @@ -31,7 +48,12 @@ class A { base class Foo {} class B { - // CHECK:STDERR: fail_base.carbon:[[@LINE+2]]:14: error: `class` or `:` expected after `base` [ExpectedAfterBase] + // CHECK:STDERR: ╭─┤ fail_base.carbon:[[@LINE+7]]:14 + // CHECK:STDERR: -> │ extend base Foo; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: `class` or `:` expected after `base` + // CHECK:STDERR: · ┃ [ExpectedAfterBase] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend base Foo; } diff --git a/toolchain/parse/testdata/class/fail_modifiers.carbon b/toolchain/parse/testdata/class/fail_modifiers.carbon index 44f2227f6caf..2769d5aaea05 100644 --- a/toolchain/parse/testdata/class/fail_modifiers.carbon +++ b/toolchain/parse/testdata/class/fail_modifiers.carbon @@ -10,20 +10,35 @@ // --- fail_virtual_class.carbon -// CHECK:STDERR: fail_virtual_class.carbon:[[@LINE+2]]:16: error: `virtual` declarations must either end with a `;` or have a `{ ... }` block for a definition [ExpectedDeclSemiOrDefinition] +// CHECK:STDERR: ╭─┤ fail_virtual_class.carbon:[[@LINE+8]]:16 +// CHECK:STDERR: -> │ virtual class B +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `virtual` declarations must either end with a `;` or +// CHECK:STDERR: · ┃ have a `{ ... }` block for a definition +// CHECK:STDERR: · ┃ [ExpectedDeclSemiOrDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: virtual class B // --- fail_impl_class.carbon -// CHECK:STDERR: fail_impl_class.carbon:[[@LINE+2]]:11: error: `impl` introducer should be followed by a name [ExpectedDeclName] +// CHECK:STDERR: ╭─┤ fail_impl_class.carbon:[[@LINE+7]]:11 +// CHECK:STDERR: -> │ impl class +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `impl` introducer should be followed by a name +// CHECK:STDERR: · ┃ [ExpectedDeclName] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl class // --- fail_extend_adapt_base.carbon class C { - // CHECK:STDERR: fail_extend_adapt_base.carbon:[[@LINE+2]]:15: error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╭─┤ fail_extend_adapt_base.carbon:[[@LINE+6]]:15 + // CHECK:STDERR: -> │ extend adapt base B; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╰──── // CHECK:STDERR: extend adapt base B; } diff --git a/toolchain/parse/testdata/class/fail_var_name.carbon b/toolchain/parse/testdata/class/fail_var_name.carbon index ee8d74385137..1589b1aa7efa 100644 --- a/toolchain/parse/testdata/class/fail_var_name.carbon +++ b/toolchain/parse/testdata/class/fail_var_name.carbon @@ -9,39 +9,73 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/class/fail_var_name.carbon class C { - // CHECK:STDERR: fail_var_name.carbon:[[@LINE+2]]:6: error: expected pattern [ExpectedPattern] + // CHECK:STDERR: ╭─┤ fail_var_name.carbon:[[@LINE+6]]:6 + // CHECK:STDERR: -> │ var; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected pattern [ExpectedPattern] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var; var name; - // CHECK:STDERR: fail_var_name.carbon:[[@LINE+2]]:6: error: expected pattern [ExpectedPattern] + // CHECK:STDERR: ╭─┤ fail_var_name.carbon:[[@LINE+6]]:6 + // CHECK:STDERR: -> │ var :; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected pattern [ExpectedPattern] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var :; - // CHECK:STDERR: fail_var_name.carbon:[[@LINE+2]]:6: error: expected pattern [ExpectedPattern] + // CHECK:STDERR: ╭─┤ fail_var_name.carbon:[[@LINE+6]]:6 + // CHECK:STDERR: -> │ var : C; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected pattern [ExpectedPattern] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var : C; - // CHECK:STDERR: fail_var_name.carbon:[[@LINE+2]]:12: error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╭─┤ fail_var_name.carbon:[[@LINE+6]]:12 + // CHECK:STDERR: -> │ var name:; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var name:; - // CHECK:STDERR: fail_var_name.carbon:[[@LINE+2]]:11: error: `var` declarations must end with a `;` [ExpectedDeclSemi] + // CHECK:STDERR: ╭─┤ fail_var_name.carbon:[[@LINE+6]]:11 + // CHECK:STDERR: -> │ var name C; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: `var` declarations must end with a `;` [ExpectedDeclSemi] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var name C; - // CHECK:STDERR: fail_var_name.carbon:[[@LINE+2]]:14: error: `var` declarations must end with a `;` [ExpectedDeclSemi] + // CHECK:STDERR: ╭─┤ fail_var_name.carbon:[[@LINE+7]]:14 + // CHECK:STDERR: -> │ var name: C C; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: `var` declarations must end with a `;` + // CHECK:STDERR: · ┃ [ExpectedDeclSemi] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var name: C C; var self: C; - // CHECK:STDERR: fail_var_name.carbon:[[@LINE+2]]:11: error: `var` declarations must end with a `;` [ExpectedDeclSemi] + // CHECK:STDERR: ╭─┤ fail_var_name.carbon:[[@LINE+6]]:11 + // CHECK:STDERR: -> │ var name name: C; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: `var` declarations must end with a `;` [ExpectedDeclSemi] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var name name: C; - // CHECK:STDERR: fail_var_name.carbon:[[@LINE+2]]:22: error: found generic binding inside `var` pattern [NonRegularBindingInVarDecl] + // CHECK:STDERR: ╭─┤ fail_var_name.carbon:[[@LINE+7]]:22 + // CHECK:STDERR: -> │ var generic name: C; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: found generic binding inside `var` pattern + // CHECK:STDERR: · ┃ [NonRegularBindingInVarDecl] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var generic name: C; } diff --git a/toolchain/parse/testdata/class/friend.carbon b/toolchain/parse/testdata/class/friend.carbon index 29abf9f118bb..737f9cf556e3 100644 --- a/toolchain/parse/testdata/class/friend.carbon +++ b/toolchain/parse/testdata/class/friend.carbon @@ -17,7 +17,12 @@ class Foo { // --- fail_todo_qualified.carbon class Baz { - // CHECK:STDERR: fail_todo_qualified.carbon:[[@LINE+2]]:11: error: `friend` declarations must end with a `;` [ExpectedDeclSemi] + // CHECK:STDERR: ╭─┤ fail_todo_qualified.carbon:[[@LINE+7]]:11 + // CHECK:STDERR: -> │ friend P.Q; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: `friend` declarations must end with a `;` + // CHECK:STDERR: · ┃ [ExpectedDeclSemi] + // CHECK:STDERR: ╰──── // CHECK:STDERR: friend P.Q; } @@ -25,31 +30,57 @@ class Baz { // --- fail_bad_syntax.carbon class A { - // CHECK:STDERR: fail_bad_syntax.carbon:[[@LINE+2]]:9: error: expected identifier for friend declaration [ExpectedIdentifierForFriend] + // CHECK:STDERR: ╭─┤ fail_bad_syntax.carbon:[[@LINE+7]]:9 + // CHECK:STDERR: -> │ friend; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected identifier for friend declaration + // CHECK:STDERR: · ┃ [ExpectedIdentifierForFriend] + // CHECK:STDERR: ╰──── // CHECK:STDERR: friend; } class B { - // CHECK:STDERR: fail_bad_syntax.carbon:[[@LINE+2]]:11: error: `friend` declarations must end with a `;` [ExpectedDeclSemi] + // CHECK:STDERR: ╭─┤ fail_bad_syntax.carbon:[[@LINE+7]]:11 + // CHECK:STDERR: -> │ friend X extra_token; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: `friend` declarations must end with a `;` + // CHECK:STDERR: · ┃ [ExpectedDeclSemi] + // CHECK:STDERR: ╰──── // CHECK:STDERR: friend X extra_token; } class C { - // CHECK:STDERR: fail_bad_syntax.carbon:[[@LINE+2]]:9: error: expected identifier for friend declaration [ExpectedIdentifierForFriend] + // CHECK:STDERR: ╭─┤ fail_bad_syntax.carbon:[[@LINE+7]]:9 + // CHECK:STDERR: -> │ friend + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected identifier for friend declaration + // CHECK:STDERR: · ┃ [ExpectedIdentifierForFriend] + // CHECK:STDERR: ╰──── // CHECK:STDERR: friend } class D { - // CHECK:STDERR: fail_bad_syntax.carbon:[[@LINE+2]]:11: error: `friend` declarations must end with a `;` [ExpectedDeclSemi] + // CHECK:STDERR: ╭─┤ fail_bad_syntax.carbon:[[@LINE+7]]:11 + // CHECK:STDERR: -> │ friend X + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: `friend` declarations must end with a `;` + // CHECK:STDERR: · ┃ [ExpectedDeclSemi] + // CHECK:STDERR: ╰──── // CHECK:STDERR: friend X } class E { - // CHECK:STDERR: fail_bad_syntax.carbon:[[@LINE+2]]:10-14: error: expected identifier for friend declaration; prefix reserved word with `r#` to form a valid identifier [ExpectedIdentifierForFriend] + // CHECK:STDERR: ╭─┤ fail_bad_syntax.carbon:[[@LINE+8]]:10 + // CHECK:STDERR: -> │ friend class; + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: expected identifier for friend declaration; prefix reserved + // CHECK:STDERR: · ┃ word with `r#` to form a valid identifier + // CHECK:STDERR: · ┃ [ExpectedIdentifierForFriend] + // CHECK:STDERR: ╰──── // CHECK:STDERR: friend class; } diff --git a/toolchain/parse/testdata/dump_format/pretty.carbon b/toolchain/parse/testdata/dump_format/pretty.carbon index c9f1d0be5068..f00d36a15bd6 100644 --- a/toolchain/parse/testdata/dump_format/pretty.carbon +++ b/toolchain/parse/testdata/dump_format/pretty.carbon @@ -11,7 +11,12 @@ // --- fail_pretty.carbon -// CHECK:STDERR: fail_pretty.carbon:[[@LINE+2]]:9: error: expected `.field: field_type` or `.field = value` [ExpectedStructLiteralField] +// CHECK:STDERR: ╭─┤ fail_pretty.carbon:[[@LINE+7]]:9 +// CHECK:STDERR: -> │ var x: {,} = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `.field: field_type` or `.field = value` +// CHECK:STDERR: · ┃ [ExpectedStructLiteralField] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: {,} = {}; diff --git a/toolchain/parse/testdata/dump_format/yaml_postorder.carbon b/toolchain/parse/testdata/dump_format/yaml_postorder.carbon index 0754f45a1fb2..607365c944f2 100644 --- a/toolchain/parse/testdata/dump_format/yaml_postorder.carbon +++ b/toolchain/parse/testdata/dump_format/yaml_postorder.carbon @@ -11,7 +11,12 @@ // --- fail_yaml_postorder.carbon -// CHECK:STDERR: fail_yaml_postorder.carbon:[[@LINE+2]]:9: error: expected `.field: field_type` or `.field = value` [ExpectedStructLiteralField] +// CHECK:STDERR: ╭─┤ fail_yaml_postorder.carbon:[[@LINE+7]]:9 +// CHECK:STDERR: -> │ var x: {,} = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `.field: field_type` or `.field = value` +// CHECK:STDERR: · ┃ [ExpectedStructLiteralField] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: {,} = {}; diff --git a/toolchain/parse/testdata/dump_format/yaml_preorder.carbon b/toolchain/parse/testdata/dump_format/yaml_preorder.carbon index 0e41134c1755..beab5abb243c 100644 --- a/toolchain/parse/testdata/dump_format/yaml_preorder.carbon +++ b/toolchain/parse/testdata/dump_format/yaml_preorder.carbon @@ -11,7 +11,12 @@ // --- fail_yaml_preorder.carbon -// CHECK:STDERR: fail_yaml_preorder.carbon:[[@LINE+2]]:9: error: expected `.field: field_type` or `.field = value` [ExpectedStructLiteralField] +// CHECK:STDERR: ╭─┤ fail_yaml_preorder.carbon:[[@LINE+7]]:9 +// CHECK:STDERR: -> │ var x: {,} = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `.field: field_type` or `.field = value` +// CHECK:STDERR: · ┃ [ExpectedStructLiteralField] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: {,} = {}; diff --git a/toolchain/parse/testdata/for/fail_colon_instead_of_in.carbon b/toolchain/parse/testdata/for/fail_colon_instead_of_in.carbon index 0a040ab1f65d..8e781d31078c 100644 --- a/toolchain/parse/testdata/for/fail_colon_instead_of_in.carbon +++ b/toolchain/parse/testdata/for/fail_colon_instead_of_in.carbon @@ -9,7 +9,12 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/for/fail_colon_instead_of_in.carbon fn foo() { - // CHECK:STDERR: fail_colon_instead_of_in.carbon:[[@LINE+2]]:19: error: `:` should be replaced by `in` [ExpectedInNotColon] + // CHECK:STDERR: ╭─┤ fail_colon_instead_of_in.carbon:[[@LINE+7]]:19 + // CHECK:STDERR: -> │ for (var x: i32 : y) { + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: `:` should be replaced by `in` + // CHECK:STDERR: · ┃ [ExpectedInNotColon] + // CHECK:STDERR: ╰──── // CHECK:STDERR: for (var x: i32 : y) { Print(x); diff --git a/toolchain/parse/testdata/for/fail_missing_cond.carbon b/toolchain/parse/testdata/for/fail_missing_cond.carbon index af2a96501042..54fbcfd2160d 100644 --- a/toolchain/parse/testdata/for/fail_missing_cond.carbon +++ b/toolchain/parse/testdata/for/fail_missing_cond.carbon @@ -9,17 +9,37 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/for/fail_missing_cond.carbon fn F() { - // CHECK:STDERR: fail_missing_cond.carbon:[[@LINE+2]]:7: error: expected `(` after `for` [ExpectedParenAfter] + // CHECK:STDERR: ╭─┤ fail_missing_cond.carbon:[[@LINE+6]]:7 + // CHECK:STDERR: -> │ for { + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `(` after `for` [ExpectedParenAfter] + // CHECK:STDERR: ╰──── // CHECK:STDERR: for { - // CHECK:STDERR: fail_missing_cond.carbon:[[@LINE+6]]:4: error: expected `in` after loop pattern [ExpectedIn] + // CHECK:STDERR: ╭─┤ fail_missing_cond.carbon:[[@LINE+18]]:4 + // CHECK:STDERR: -> │ } + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `in` after loop pattern [ExpectedIn] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_missing_cond.carbon:[[@LINE+4]]:4: error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╭─┤ fail_missing_cond.carbon:[[@LINE+12]]:4 + // CHECK:STDERR: -> │ } + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_missing_cond.carbon:[[@LINE+2]]:4: error: expected braced code block [ExpectedCodeBlock] + // CHECK:STDERR: ╭─┤ fail_missing_cond.carbon:[[@LINE+6]]:4 + // CHECK:STDERR: -> │ } + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected braced code block [ExpectedCodeBlock] + // CHECK:STDERR: ╰──── // CHECK:STDERR: } -// CHECK:STDERR: fail_missing_cond.carbon:[[@LINE+2]]:1: error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╭─┤ fail_missing_cond.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ } +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: } diff --git a/toolchain/parse/testdata/for/fail_missing_in.carbon b/toolchain/parse/testdata/for/fail_missing_in.carbon index f518f8f2e526..38ebc4a396f3 100644 --- a/toolchain/parse/testdata/for/fail_missing_in.carbon +++ b/toolchain/parse/testdata/for/fail_missing_in.carbon @@ -9,7 +9,11 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/for/fail_missing_in.carbon fn foo() { - // CHECK:STDERR: fail_missing_in.carbon:[[@LINE+2]]:18: error: expected `in` after loop pattern [ExpectedIn] + // CHECK:STDERR: ╭─┤ fail_missing_in.carbon:[[@LINE+6]]:18 + // CHECK:STDERR: -> │ for (var x: i32 y) { + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `in` after loop pattern [ExpectedIn] + // CHECK:STDERR: ╰──── // CHECK:STDERR: for (var x: i32 y) { Print(x); diff --git a/toolchain/parse/testdata/for/fail_returned_var.carbon b/toolchain/parse/testdata/for/fail_returned_var.carbon index b1de2950bd98..e47c46e7b0a5 100644 --- a/toolchain/parse/testdata/for/fail_returned_var.carbon +++ b/toolchain/parse/testdata/for/fail_returned_var.carbon @@ -9,7 +9,11 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/for/fail_returned_var.carbon fn foo() -> i32 { - // CHECK:STDERR: fail_returned_var.carbon:[[@LINE+2]]:8: error: expected pattern [ExpectedPattern] + // CHECK:STDERR: ╭─┤ fail_returned_var.carbon:[[@LINE+6]]:8 + // CHECK:STDERR: -> │ for (returned var x: i32 in y) { + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected pattern [ExpectedPattern] + // CHECK:STDERR: ╰──── // CHECK:STDERR: for (returned var x: i32 in y) { return var; diff --git a/toolchain/parse/testdata/for/fail_square_brackets.carbon b/toolchain/parse/testdata/for/fail_square_brackets.carbon index 43fe2d96100b..86f03d0e9392 100644 --- a/toolchain/parse/testdata/for/fail_square_brackets.carbon +++ b/toolchain/parse/testdata/for/fail_square_brackets.carbon @@ -9,15 +9,35 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/for/fail_square_brackets.carbon fn F() { - // CHECK:STDERR: fail_square_brackets.carbon:[[@LINE+10]]:7: error: expected `(` after `for` [ExpectedParenAfter] + // CHECK:STDERR: ╭─┤ fail_square_brackets.carbon:[[@LINE+30]]:7 + // CHECK:STDERR: -> │ for [] { + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `(` after `for` [ExpectedParenAfter] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_square_brackets.carbon:[[@LINE+8]]:6: error: expected pattern [ExpectedPattern] + // CHECK:STDERR: ╭─┤ fail_square_brackets.carbon:[[@LINE+24]]:6 + // CHECK:STDERR: -> │ for [] { + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected pattern [ExpectedPattern] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_square_brackets.carbon:[[@LINE+6]]:6: error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╭─┤ fail_square_brackets.carbon:[[@LINE+18]]:6 + // CHECK:STDERR: -> │ for [] { + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_square_brackets.carbon:[[@LINE+4]]:7: error: expected braced code block [ExpectedCodeBlock] + // CHECK:STDERR: ╭─┤ fail_square_brackets.carbon:[[@LINE+12]]:7 + // CHECK:STDERR: -> │ for [] { + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected braced code block [ExpectedCodeBlock] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_square_brackets.carbon:[[@LINE+2]]:7: error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╭─┤ fail_square_brackets.carbon:[[@LINE+6]]:7 + // CHECK:STDERR: -> │ for [] { + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╰──── // CHECK:STDERR: for [] { } diff --git a/toolchain/parse/testdata/function/declaration.carbon b/toolchain/parse/testdata/function/declaration.carbon index 55b93c391ef4..7d5f7a0e944c 100644 --- a/toolchain/parse/testdata/function/declaration.carbon +++ b/toolchain/parse/testdata/function/declaration.carbon @@ -45,44 +45,79 @@ private override default fn I(); // --- fail_identifier_instead_of_sig.carbon -// CHECK:STDERR: fail_identifier_instead_of_sig.carbon:[[@LINE+2]]:7: error: `fn` declarations must either end with a `;` or have a `{ ... }` block for a definition [ExpectedDeclSemiOrDefinition] +// CHECK:STDERR: ╭─┤ fail_identifier_instead_of_sig.carbon:[[@LINE+8]]:7 +// CHECK:STDERR: -> │ fn foo bar; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `fn` declarations must either end with a `;` or have a +// CHECK:STDERR: · ┃ `{ ... }` block for a definition +// CHECK:STDERR: · ┃ [ExpectedDeclSemiOrDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn foo bar; // --- fail_missing_implicit_close.carbon -// CHECK:STDERR: fail_missing_implicit_close.carbon:[[@LINE+3]]:7: error: opening symbol without a corresponding closing symbol [UnmatchedOpening] -// CHECK:STDERR: fail_missing_implicit_close.carbon:[[@LINE+2]]:10: note: possibly missing `]` here [PossiblyMissingBracketHere] +// CHECK:STDERR: ╭─┤ fail_missing_implicit_close.carbon:[[@LINE+8]]:7 +// CHECK:STDERR: -> │ fn Div[(); +// CHECK:STDERR: · ┳ ┬ +// CHECK:STDERR: · ┗━━━━━┫ error: opening symbol without a corresponding closing symbol +// CHECK:STDERR: · │ ┃ [UnmatchedOpening] +// CHECK:STDERR: · ╰────┤ possibly missing `]` here [PossiblyMissingBracketHere] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn Div[(); // --- fail_missing_name.carbon -// CHECK:STDERR: fail_missing_name.carbon:[[@LINE+2]]:3: error: `fn` introducer should be followed by a name [ExpectedDeclName] +// CHECK:STDERR: ╭─┤ fail_missing_name.carbon:[[@LINE+6]]:3 +// CHECK:STDERR: -> │ fn (); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `fn` introducer should be followed by a name [ExpectedDeclName] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn (); // --- fail_no_sig_or_semi.carbon -// CHECK:STDERR: fail_no_sig_or_semi.carbon:[[@LINE+2]]:7: error: `fn` declarations must either end with a `;` or have a `{ ... }` block for a definition [ExpectedDeclSemiOrDefinition] +// CHECK:STDERR: ╭─┤ fail_no_sig_or_semi.carbon:[[@LINE+8]]:7 +// CHECK:STDERR: -> │ fn foo +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `fn` declarations must either end with a `;` or have a +// CHECK:STDERR: · ┃ `{ ... }` block for a definition +// CHECK:STDERR: · ┃ [ExpectedDeclSemiOrDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn foo // --- fail_only_fn_and_semi.carbon -// CHECK:STDERR: fail_only_fn_and_semi.carbon:[[@LINE+2]]:3: error: `fn` introducer should be followed by a name [ExpectedDeclName] +// CHECK:STDERR: ╭─┤ fail_only_fn_and_semi.carbon:[[@LINE+6]]:3 +// CHECK:STDERR: -> │ fn; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `fn` introducer should be followed by a name [ExpectedDeclName] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn; // --- fail_repeated_fn_and_semi.carbon -// CHECK:STDERR: fail_repeated_fn_and_semi.carbon:[[@LINE+2]]:4-5: error: `fn` introducer should be followed by a name; prefix reserved word with `r#` to form a valid identifier [ExpectedDeclName] +// CHECK:STDERR: ╭─┤ fail_repeated_fn_and_semi.carbon:[[@LINE+8]]:4 +// CHECK:STDERR: -> │ fn fn; +// CHECK:STDERR: · ┳━ +// CHECK:STDERR: · ┗━━┫ error: `fn` introducer should be followed by a name; prefix reserved +// CHECK:STDERR: · ┃ word with `r#` to form a valid identifier +// CHECK:STDERR: · ┃ [ExpectedDeclName] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn fn; // --- fail_skip_indented_newline_until_outdent.carbon - // CHECK:STDERR: fail_skip_indented_newline_until_outdent.carbon:[[@LINE+2]]:5: error: `fn` introducer should be followed by a name [ExpectedDeclName] + // CHECK:STDERR: ╭─┤ fail_skip_indented_newline_until_outdent.carbon:[[@LINE+6]]:5 + // CHECK:STDERR: -> │ fn (x, + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: `fn` introducer should be followed by a name [ExpectedDeclName] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn (x, y, @@ -91,7 +126,11 @@ fn F(); // --- fail_skip_indented_newline_with_semi.carbon -// CHECK:STDERR: fail_skip_indented_newline_with_semi.carbon:[[@LINE+2]]:3: error: `fn` introducer should be followed by a name [ExpectedDeclName] +// CHECK:STDERR: ╭─┤ fail_skip_indented_newline_with_semi.carbon:[[@LINE+6]]:3 +// CHECK:STDERR: -> │ fn (x, +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `fn` introducer should be followed by a name [ExpectedDeclName] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn (x, y, @@ -100,7 +139,11 @@ fn F(); // --- fail_skip_indented_newline_without_semi.carbon -// CHECK:STDERR: fail_skip_indented_newline_without_semi.carbon:[[@LINE+2]]:3: error: `fn` introducer should be followed by a name [ExpectedDeclName] +// CHECK:STDERR: ╭─┤ fail_skip_indented_newline_without_semi.carbon:[[@LINE+6]]:3 +// CHECK:STDERR: -> │ fn (x, +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `fn` introducer should be followed by a name [ExpectedDeclName] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn (x, y, @@ -109,14 +152,22 @@ fn F(); // --- fail_skip_to_newline_without_semi.carbon -// CHECK:STDERR: fail_skip_to_newline_without_semi.carbon:[[@LINE+2]]:3: error: `fn` introducer should be followed by a name [ExpectedDeclName] +// CHECK:STDERR: ╭─┤ fail_skip_to_newline_without_semi.carbon:[[@LINE+6]]:3 +// CHECK:STDERR: -> │ fn () +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `fn` introducer should be followed by a name [ExpectedDeclName] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn () fn F(); // --- fail_skip_without_semi_to_curly.carbon -// CHECK:STDERR: fail_skip_without_semi_to_curly.carbon:[[@LINE+2]]:1-6: error: unrecognized declaration introducer [UnrecognizedDecl] +// CHECK:STDERR: ╭─┤ fail_skip_without_semi_to_curly.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ struct X { fn () } +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: unrecognized declaration introducer [UnrecognizedDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: struct X { fn () } fn F(); @@ -127,7 +178,11 @@ fn foo(bar); // --- fail_without_name_and_many_tokens_in_params.carbon -// CHECK:STDERR: fail_without_name_and_many_tokens_in_params.carbon:[[@LINE+2]]:3: error: `fn` introducer should be followed by a name [ExpectedDeclName] +// CHECK:STDERR: ╭─┤ fail_without_name_and_many_tokens_in_params.carbon:[[@LINE+6]]:3 +// CHECK:STDERR: -> │ fn (a tokens c d e f g h i j k l m n o p q r s t u v w x y z); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `fn` introducer should be followed by a name [ExpectedDeclName] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn (a tokens c d e f g h i j k l m n o p q r s t u v w x y z); @@ -138,13 +193,23 @@ fn ComplexFormParam(x:? X.Y(Z)); // --- fail_ref_on_form_parameter.carbon -// CHECK:STDERR: fail_ref_on_form_parameter.carbon:[[@LINE+2]]:6-8: error: `ref` is only allowed on a runtime binding [ExpectedRuntimeBindingPatternAfterRef] +// CHECK:STDERR: ╭─┤ fail_ref_on_form_parameter.carbon:[[@LINE+7]]:6 +// CHECK:STDERR: -> │ fn F(ref x:? Form); +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┗━━┫ error: `ref` is only allowed on a runtime binding +// CHECK:STDERR: · ┃ [ExpectedRuntimeBindingPatternAfterRef] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(ref x:? Form); // --- fail_form_within_var.carbon -// CHECK:STDERR: fail_form_within_var.carbon:[[@LINE+2]]:26: error: found `:?` binding inside `var` pattern [NonRegularBindingInVarDecl] +// CHECK:STDERR: ╭─┤ fail_form_within_var.carbon:[[@LINE+7]]:26 +// CHECK:STDERR: -> │ fn FormInVar(var x:? Form); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: found `:?` binding inside `var` pattern +// CHECK:STDERR: · ┃ [NonRegularBindingInVarDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn FormInVar(var x:? Form); @@ -161,7 +226,11 @@ let a: auto = fn -> ref u32 { return 0; }; // --- fail_ref_return_missing_type.carbon -// CHECK:STDERR: fail_ref_return_missing_type.carbon:[[@LINE+2]]:22: error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╭─┤ fail_ref_return_missing_type.carbon:[[@LINE+6]]:22 +// CHECK:STDERR: -> │ fn RefReturn() -> ref; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn RefReturn() -> ref; @@ -175,7 +244,11 @@ let b: auto = fn -> var u32 { return 0; }; // --- fail_val_return_missing_type.carbon -// CHECK:STDERR: fail_val_return_missing_type.carbon:[[@LINE+2]]:22: error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╭─┤ fail_val_return_missing_type.carbon:[[@LINE+6]]:22 +// CHECK:STDERR: -> │ fn ValReturn() -> val; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn ValReturn() -> val; diff --git a/toolchain/parse/testdata/function/definition.carbon b/toolchain/parse/testdata/function/definition.carbon index bcb751bc9d35..b3bf50fb00ff 100644 --- a/toolchain/parse/testdata/function/definition.carbon +++ b/toolchain/parse/testdata/function/definition.carbon @@ -35,7 +35,11 @@ fn foo() -> f64 { fn F() { // Note: this might become valid depending on the expression syntax. This test // shouldn't be taken as a sign it should remain invalid. - // CHECK:STDERR: fail_identifier_in_statements.carbon:[[@LINE+2]]:6: error: expected `;` after expression statement [ExpectedExprSemi] + // CHECK:STDERR: ╭─┤ fail_identifier_in_statements.carbon:[[@LINE+6]]:6 + // CHECK:STDERR: -> │ bar + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `;` after expression statement [ExpectedExprSemi] + // CHECK:STDERR: ╰──── // CHECK:STDERR: bar } @@ -59,19 +63,34 @@ impl T as I { // --- fail_builtin_identifier.carbon -// CHECK:STDERR: fail_builtin_identifier.carbon:[[@LINE+2]]:17: error: expected builtin function name after `=` [ExpectedBuiltinName] +// CHECK:STDERR: ╭─┤ fail_builtin_identifier.carbon:[[@LINE+7]]:17 +// CHECK:STDERR: -> │ fn NotString() = banana; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected builtin function name after `=` +// CHECK:STDERR: · ┃ [ExpectedBuiltinName] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn NotString() = banana; // --- fail_builtin_two_strings.carbon -// CHECK:STDERR: fail_builtin_two_strings.carbon:[[@LINE+2]]:31: error: `fn` declarations must end with a `;` [ExpectedDeclSemi] +// CHECK:STDERR: ╭─┤ fail_builtin_two_strings.carbon:[[@LINE+7]]:31 +// CHECK:STDERR: -> │ fn JunkAfterString() = "hello" "world"; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `fn` declarations must end with a `;` +// CHECK:STDERR: · ┃ [ExpectedDeclSemi] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn JunkAfterString() = "hello" "world"; // --- fail_builtin_spurious_equals.carbon -// CHECK:STDERR: fail_builtin_spurious_equals.carbon:[[@LINE+2]]:22: error: expected builtin function name after `=` [ExpectedBuiltinName] +// CHECK:STDERR: ╭─┤ fail_builtin_spurious_equals.carbon:[[@LINE+7]]:22 +// CHECK:STDERR: -> │ fn SpuriousEquals() = { } +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected builtin function name after `=` +// CHECK:STDERR: · ┃ [ExpectedBuiltinName] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn SpuriousEquals() = { } fn TestRecoveryFromSpuriousEquals(); diff --git a/toolchain/parse/testdata/function/extern.carbon b/toolchain/parse/testdata/function/extern.carbon index 80561b767b4e..3db711231db8 100644 --- a/toolchain/parse/testdata/function/extern.carbon +++ b/toolchain/parse/testdata/function/extern.carbon @@ -22,15 +22,32 @@ extern library default fn G(); // --- fail_name_missing.carbon -// CHECK:STDERR: fail_name_missing.carbon:[[@LINE+2]]:15: error: expected `default` or a string literal to specify the library name [ExpectedLibraryNameOrDefault] +// CHECK:STDERR: ╭─┤ fail_name_missing.carbon:[[@LINE+8]]:15 +// CHECK:STDERR: -> │ extern library fn G(); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `default` or a string literal to specify the +// CHECK:STDERR: · ┃ library name +// CHECK:STDERR: · ┃ [ExpectedLibraryNameOrDefault] +// CHECK:STDERR: ╰──── // CHECK:STDERR: extern library fn G(); // --- fail_identifier.carbon -// CHECK:STDERR: fail_identifier.carbon:[[@LINE+4]]:15: error: expected `default` or a string literal to specify the library name [ExpectedLibraryNameOrDefault] +// CHECK:STDERR: ╭─┤ fail_identifier.carbon:[[@LINE+15]]:15 +// CHECK:STDERR: -> │ extern library foo fn G(); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `default` or a string literal to specify the +// CHECK:STDERR: · ┃ library name +// CHECK:STDERR: · ┃ [ExpectedLibraryNameOrDefault] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_identifier.carbon:[[@LINE+2]]:16-18: error: unrecognized declaration introducer [UnrecognizedDecl] +// CHECK:STDERR: ╭─┤ fail_identifier.carbon:[[@LINE+7]]:16 +// CHECK:STDERR: -> │ extern library foo fn G(); +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┗━━┫ error: unrecognized declaration introducer +// CHECK:STDERR: · ┃ [UnrecognizedDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: extern library foo fn G(); diff --git a/toolchain/parse/testdata/function/fail_template_form_param.carbon b/toolchain/parse/testdata/function/fail_template_form_param.carbon index eced4ea180d3..92aa65ae9257 100644 --- a/toolchain/parse/testdata/function/fail_template_form_param.carbon +++ b/toolchain/parse/testdata/function/fail_template_form_param.carbon @@ -9,7 +9,12 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/function/fail_template_form_param.carbon // `template` cannot be combined with a `:?` form binding. -// CHECK:STDERR: fail_template_form_param.carbon:[[@LINE+2]]:6-13: error: `template` is only allowed on a generic binding [ExpectedGenericBindingPatternAfterTemplate] +// CHECK:STDERR: ╭─┤ fail_template_form_param.carbon:[[@LINE+7]]:6 +// CHECK:STDERR: -> │ fn F(template x:? Form); +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: `template` is only allowed on a generic binding +// CHECK:STDERR: · ┃ [ExpectedGenericBindingPatternAfterTemplate] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(template x:? Form); diff --git a/toolchain/parse/testdata/generics/generic_params/fail_template_no_param.carbon b/toolchain/parse/testdata/generics/generic_params/fail_template_no_param.carbon index ec1fd91c2513..279dc96cf57a 100644 --- a/toolchain/parse/testdata/generics/generic_params/fail_template_no_param.carbon +++ b/toolchain/parse/testdata/generics/generic_params/fail_template_no_param.carbon @@ -10,19 +10,35 @@ // --- fail_template_before_type.carbon -// CHECK:STDERR: fail_template_before_type.carbon:[[@LINE+2]]:14: error: expected name in binding pattern [ExpectedBindingPattern] +// CHECK:STDERR: ╭─┤ fail_template_before_type.carbon:[[@LINE+7]]:14 +// CHECK:STDERR: -> │ fn A(template i32); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected name in binding pattern +// CHECK:STDERR: · ┃ [ExpectedBindingPattern] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn A(template i32); // --- fail_template_no_name.carbon -// CHECK:STDERR: fail_template_no_name.carbon:[[@LINE+2]]:14: error: expected name in binding pattern [ExpectedBindingPattern] +// CHECK:STDERR: ╭─┤ fail_template_no_name.carbon:[[@LINE+7]]:14 +// CHECK:STDERR: -> │ fn C(template); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected name in binding pattern +// CHECK:STDERR: · ┃ [ExpectedBindingPattern] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn C(template); // --- fail_reserved_word_after_generic.carbon -// CHECK:STDERR: fail_reserved_word_after_generic.carbon:[[@LINE+2]]:14-21: error: expected name in binding pattern; prefix reserved word with `r#` to form a valid identifier [ExpectedBindingPattern] +// CHECK:STDERR: ╭─┤ fail_reserved_word_after_generic.carbon:[[@LINE+8]]:14 +// CHECK:STDERR: -> │ fn E(generic template: i32); +// CHECK:STDERR: · ┳━━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: expected name in binding pattern; prefix reserved word +// CHECK:STDERR: · ┃ with `r#` to form a valid identifier +// CHECK:STDERR: · ┃ [ExpectedBindingPattern] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn E(generic template: i32); diff --git a/toolchain/parse/testdata/generics/generic_params/self.carbon b/toolchain/parse/testdata/generics/generic_params/self.carbon index e2da4084c78d..f8bb3c64b3ac 100644 --- a/toolchain/parse/testdata/generics/generic_params/self.carbon +++ b/toolchain/parse/testdata/generics/generic_params/self.carbon @@ -18,10 +18,20 @@ class C { // --- fail_todo_generic_self_no_type.carbon class C { - // CHECK:STDERR: fail_todo_generic_self_no_type.carbon:[[@LINE+2]]:20: error: expected `:` or `:?` in binding pattern [ExpectedBindingPattern] + // CHECK:STDERR: ╭─┤ fail_todo_generic_self_no_type.carbon:[[@LINE+7]]:20 + // CHECK:STDERR: -> │ fn A(generic self); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `:` or `:?` in binding pattern + // CHECK:STDERR: · ┃ [ExpectedBindingPattern] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn A(generic self); - // CHECK:STDERR: fail_todo_generic_self_no_type.carbon:[[@LINE+2]]:21: error: expected `:` or `:?` in binding pattern [ExpectedBindingPattern] + // CHECK:STDERR: ╭─┤ fail_todo_generic_self_no_type.carbon:[[@LINE+7]]:21 + // CHECK:STDERR: -> │ fn B(template self); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `:` or `:?` in binding pattern + // CHECK:STDERR: · ┃ [ExpectedBindingPattern] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn B(template self); } diff --git a/toolchain/parse/testdata/generics/generic_params/template.carbon b/toolchain/parse/testdata/generics/generic_params/template.carbon index 36b9af6bef5b..017c8324622f 100644 --- a/toolchain/parse/testdata/generics/generic_params/template.carbon +++ b/toolchain/parse/testdata/generics/generic_params/template.carbon @@ -14,15 +14,29 @@ fn foo(template a: i32); // --- fail_template_ref.carbon -// CHECK:STDERR: fail_template_ref.carbon:[[@LINE+2]]:17-19: error: `ref` is only allowed on a runtime binding [ExpectedRuntimeBindingPatternAfterRef] +// CHECK:STDERR: ╭─┤ fail_template_ref.carbon:[[@LINE+7]]:17 +// CHECK:STDERR: -> │ fn foo(template ref a: i32); +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┗━━┫ error: `ref` is only allowed on a runtime binding +// CHECK:STDERR: · ┃ [ExpectedRuntimeBindingPatternAfterRef] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn foo(template ref a: i32); -// CHECK:STDERR: fail_template_ref.carbon:[[@LINE+2]]:17-19: error: `ref` is only allowed on a runtime binding [ExpectedRuntimeBindingPatternAfterRef] +// CHECK:STDERR: ╭─┤ fail_template_ref.carbon:[[@LINE+7]]:17 +// CHECK:STDERR: -> │ fn foo(template ref a: i32); +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┗━━┫ error: `ref` is only allowed on a runtime binding +// CHECK:STDERR: · ┃ [ExpectedRuntimeBindingPatternAfterRef] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn foo(template ref a: i32); -// CHECK:STDERR: fail_template_ref.carbon:[[@LINE+2]]:11: error: expected name in binding pattern [ExpectedBindingPattern] +// CHECK:STDERR: ╭─┤ fail_template_ref.carbon:[[@LINE+6]]:11 +// CHECK:STDERR: -> │ fn foo(ref template a: i32); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected name in binding pattern [ExpectedBindingPattern] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn foo(ref template a: i32); diff --git a/toolchain/parse/testdata/generics/impl/fail_impl.carbon b/toolchain/parse/testdata/generics/impl/fail_impl.carbon index 7c2448e7b623..14a5f48a1e9b 100644 --- a/toolchain/parse/testdata/generics/impl/fail_impl.carbon +++ b/toolchain/parse/testdata/generics/impl/fail_impl.carbon @@ -8,61 +8,132 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/impl/fail_impl.carbon -// CHECK:STDERR: fail_impl.carbon:[[@LINE+2]]:9: error: expected `as` in `impl` declaration [ImplExpectedAs] +// CHECK:STDERR: ╭─┤ fail_impl.carbon:[[@LINE+6]]:9 +// CHECK:STDERR: -> │ impl foo bar; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `as` in `impl` declaration [ImplExpectedAs] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl foo bar; -// CHECK:STDERR: fail_impl.carbon:[[@LINE+2]]:12: error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╭─┤ fail_impl.carbon:[[@LINE+6]]:12 +// CHECK:STDERR: -> │ impl i32 as; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl i32 as; -// CHECK:STDERR: fail_impl.carbon:[[@LINE+2]]:17: error: `impl` declarations must either end with a `;` or have a `{ ... }` block for a definition [ExpectedDeclSemiOrDefinition] +// CHECK:STDERR: ╭─┤ fail_impl.carbon:[[@LINE+8]]:17 +// CHECK:STDERR: -> │ impl bool as bar unexpected; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `impl` declarations must either end with a `;` or +// CHECK:STDERR: · ┃ have a `{ ... }` block for a definition +// CHECK:STDERR: · ┃ [ExpectedDeclSemiOrDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl bool as bar unexpected; -// CHECK:STDERR: fail_impl.carbon:[[@LINE+2]]:5: error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╭─┤ fail_impl.carbon:[[@LINE+6]]:5 +// CHECK:STDERR: -> │ impl return as A; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl return as A; -// CHECK:STDERR: fail_impl.carbon:[[@LINE+2]]:5: error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╭─┤ fail_impl.carbon:[[@LINE+6]]:5 +// CHECK:STDERR: -> │ impl return B; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl return B; -// CHECK:STDERR: fail_impl.carbon:[[@LINE+4]]:13: error: expected `[` after `forall` in `impl` declaration [ImplExpectedAfterForall] +// CHECK:STDERR: ╭─┤ fail_impl.carbon:[[@LINE+13]]:13 +// CHECK:STDERR: -> │ impl forall f32; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `[` after `forall` in `impl` declaration +// CHECK:STDERR: · ┃ [ImplExpectedAfterForall] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_impl.carbon:[[@LINE+2]]:16: error: expected `as` in `impl` declaration [ImplExpectedAs] +// CHECK:STDERR: ╭─┤ fail_impl.carbon:[[@LINE+6]]:16 +// CHECK:STDERR: -> │ impl forall f32; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `as` in `impl` declaration [ImplExpectedAs] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall f32; -// CHECK:STDERR: fail_impl.carbon:[[@LINE+2]]:19: error: expected `as` in `impl` declaration [ImplExpectedAs] +// CHECK:STDERR: ╭─┤ fail_impl.carbon:[[@LINE+7]]:19 +// CHECK:STDERR: -> │ impl forall [] u32; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `as` in `impl` declaration +// CHECK:STDERR: · ┃ [ImplExpectedAs] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [] u32; -// CHECK:STDERR: fail_impl.carbon:[[@LINE+2]]:25: error: expected `as` in `impl` declaration [ImplExpectedAs] +// CHECK:STDERR: ╭─┤ fail_impl.carbon:[[@LINE+7]]:25 +// CHECK:STDERR: -> │ impl forall [invalid] i8; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `as` in `impl` declaration +// CHECK:STDERR: · ┃ [ImplExpectedAs] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [invalid] i8; -// CHECK:STDERR: fail_impl.carbon:[[@LINE+2]]:13: error: expected `[` after `forall` in `impl` declaration [ImplExpectedAfterForall] +// CHECK:STDERR: ╭─┤ fail_impl.carbon:[[@LINE+7]]:13 +// CHECK:STDERR: -> │ impl forall f16 as Quux; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `[` after `forall` in `impl` declaration +// CHECK:STDERR: · ┃ [ImplExpectedAfterForall] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall f16 as Quux; -// CHECK:STDERR: fail_impl.carbon:[[@LINE+2]]:26: error: expected `as` in `impl` declaration [ImplExpectedAs] +// CHECK:STDERR: ╭─┤ fail_impl.carbon:[[@LINE+7]]:26 +// CHECK:STDERR: -> │ impl forall [T: type] str; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `as` in `impl` declaration +// CHECK:STDERR: · ┃ [ImplExpectedAs] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [T: type] str; -// CHECK:STDERR: fail_impl.carbon:[[@LINE+2]]:24: error: expected `as` in `impl` declaration [ImplExpectedAs] +// CHECK:STDERR: ╭─┤ fail_impl.carbon:[[@LINE+7]]:24 +// CHECK:STDERR: -> │ impl forall [T: type] T missing_as; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `as` in `impl` declaration +// CHECK:STDERR: · ┃ [ImplExpectedAs] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [T: type] T missing_as; -// CHECK:STDERR: fail_impl.carbon:[[@LINE+2]]:37: error: `impl` declarations must either end with a `;` or have a `{ ... }` block for a definition [ExpectedDeclSemiOrDefinition] +// CHECK:STDERR: ╭─┤ fail_impl.carbon:[[@LINE+9]]:37 +// CHECK:STDERR: -> │ impl forall [T: type] T as Interface extra; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `impl` declarations must either +// CHECK:STDERR: · ┃ end with a `;` or have a +// CHECK:STDERR: · ┃ `{ ... }` block for a definition +// CHECK:STDERR: · ┃ [ExpectedDeclSemiOrDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl forall [T: type] T as Interface extra; -// CHECK:STDERR: fail_impl.carbon:[[@LINE+2]]:5: error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╭─┤ fail_impl.carbon:[[@LINE+6]]:5 +// CHECK:STDERR: -> │ impl; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl; -// CHECK:STDERR: fail_impl.carbon:[[@LINE+2]]:5: error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╭─┤ fail_impl.carbon:[[@LINE+6]]:5 +// CHECK:STDERR: -> │ impl +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: impl diff --git a/toolchain/parse/testdata/generics/impl/fail_out_of_line_member.carbon b/toolchain/parse/testdata/generics/impl/fail_out_of_line_member.carbon index a84986b86cc0..46bfa2f370a2 100644 --- a/toolchain/parse/testdata/generics/impl/fail_out_of_line_member.carbon +++ b/toolchain/parse/testdata/generics/impl/fail_out_of_line_member.carbon @@ -18,7 +18,11 @@ impl bool as Interface { fn F(); } -// CHECK:STDERR: fail_out_of_line_member.carbon:[[@LINE+2]]:3: error: `fn` introducer should be followed by a name [ExpectedDeclName] +// CHECK:STDERR: ╭─┤ fail_out_of_line_member.carbon:[[@LINE+6]]:3 +// CHECK:STDERR: -> │ fn (bool as Interface).F() {} +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `fn` introducer should be followed by a name [ExpectedDeclName] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn (bool as Interface).F() {} @@ -28,7 +32,11 @@ class C { } } -// CHECK:STDERR: fail_out_of_line_member.carbon:[[@LINE+2]]:6: error: `.` should be followed by a name [ExpectedDeclNameAfterPeriod] +// CHECK:STDERR: ╭─┤ fail_out_of_line_member.carbon:[[@LINE+6]]:6 +// CHECK:STDERR: -> │ fn C.(Self as Interface).F() {} +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `.` should be followed by a name [ExpectedDeclNameAfterPeriod] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn C.(Self as Interface).F() {} diff --git a/toolchain/parse/testdata/generics/impl/match_first.carbon b/toolchain/parse/testdata/generics/impl/match_first.carbon index 148bff8ae634..2eedc5eca524 100644 --- a/toolchain/parse/testdata/generics/impl/match_first.carbon +++ b/toolchain/parse/testdata/generics/impl/match_first.carbon @@ -14,13 +14,23 @@ match_first {} // --- fail_missing_braces.carbon -// CHECK:STDERR: fail_missing_braces.carbon:[[@LINE+2]]:12: error: expected `{` after `match_first` [ExpectedCurlyBraceAfter] +// CHECK:STDERR: ╭─┤ fail_missing_braces.carbon:[[@LINE+7]]:12 +// CHECK:STDERR: -> │ match_first; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `{` after `match_first` +// CHECK:STDERR: · ┃ [ExpectedCurlyBraceAfter] +// CHECK:STDERR: ╰──── // CHECK:STDERR: match_first; // --- fail_eof.carbon -// CHECK:STDERR: fail_eof.carbon:[[@LINE+2]]:12: error: expected `{` after `match_first` [ExpectedCurlyBraceAfter] +// CHECK:STDERR: ╭─┤ fail_eof.carbon:[[@LINE+7]]:12 +// CHECK:STDERR: -> │ match_first +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `{` after `match_first` +// CHECK:STDERR: · ┃ [ExpectedCurlyBraceAfter] +// CHECK:STDERR: ╰──── // CHECK:STDERR: match_first diff --git a/toolchain/parse/testdata/generics/interface/fail_associated_constants.carbon b/toolchain/parse/testdata/generics/interface/fail_associated_constants.carbon index a9c5c2ed6aeb..1a5108066470 100644 --- a/toolchain/parse/testdata/generics/interface/fail_associated_constants.carbon +++ b/toolchain/parse/testdata/generics/interface/fail_associated_constants.carbon @@ -13,7 +13,12 @@ library "[[@TEST_NAME]]"; interface I { - // CHECK:STDERR: fail_tuple_pattern.carbon:[[@LINE+2]]:6: error: expected identifier in associated constant declaration [ExpectedAssociatedConstantIdentifier] + // CHECK:STDERR: ╭─┤ fail_tuple_pattern.carbon:[[@LINE+7]]:6 + // CHECK:STDERR: -> │ let (T: type, U: type); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected identifier in associated constant declaration + // CHECK:STDERR: · ┃ [ExpectedAssociatedConstantIdentifier] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let (T: type, U: type); } @@ -23,7 +28,12 @@ interface I { library "[[@TEST_NAME]]"; interface I { - // CHECK:STDERR: fail_tuple_pattern_with_default.carbon:[[@LINE+2]]:14: error: expected identifier in associated constant declaration [ExpectedAssociatedConstantIdentifier] + // CHECK:STDERR: ╭─┤ fail_tuple_pattern_with_default.carbon:[[@LINE+7]]:14 + // CHECK:STDERR: -> │ default let (T: type, U: type) = ({}, {}); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected identifier in associated constant declaration + // CHECK:STDERR: · ┃ [ExpectedAssociatedConstantIdentifier] + // CHECK:STDERR: ╰──── // CHECK:STDERR: default let (T: type, U: type) = ({}, {}); } @@ -33,7 +43,12 @@ interface I { library "[[@TEST_NAME]]"; interface I { - // CHECK:STDERR: fail_var_pattern.carbon:[[@LINE+2]]:6: error: expected identifier in associated constant declaration [ExpectedAssociatedConstantIdentifier] + // CHECK:STDERR: ╭─┤ fail_var_pattern.carbon:[[@LINE+7]]:6 + // CHECK:STDERR: -> │ let var T: type; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected identifier in associated constant declaration + // CHECK:STDERR: · ┃ [ExpectedAssociatedConstantIdentifier] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let var T: type; } @@ -43,7 +58,12 @@ interface I { library "[[@TEST_NAME]]"; interface I { - // CHECK:STDERR: fail_var_pattern_with_default.carbon:[[@LINE+2]]:14: error: expected identifier in associated constant declaration [ExpectedAssociatedConstantIdentifier] + // CHECK:STDERR: ╭─┤ fail_var_pattern_with_default.carbon:[[@LINE+7]]:14 + // CHECK:STDERR: -> │ default let var T: type = {}; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected identifier in associated constant declaration + // CHECK:STDERR: · ┃ [ExpectedAssociatedConstantIdentifier] + // CHECK:STDERR: ╰──── // CHECK:STDERR: default let var T: type = {}; } @@ -53,7 +73,12 @@ interface I { library "[[@TEST_NAME]]"; interface I { - // CHECK:STDERR: fail_not_constant.carbon:[[@LINE+2]]:7-13: error: phase keyword is not allowed on an associated constant [PhaseKeywordInAssociatedConstant] + // CHECK:STDERR: ╭─┤ fail_not_constant.carbon:[[@LINE+7]]:7 + // CHECK:STDERR: -> │ let runtime a: {.b: ()}; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: phase keyword is not allowed on an associated constant + // CHECK:STDERR: · ┃ [PhaseKeywordInAssociatedConstant] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let runtime a: {.b: ()}; } @@ -63,7 +88,12 @@ interface I { library "[[@TEST_NAME]]"; interface I { - // CHECK:STDERR: fail_template.carbon:[[@LINE+2]]:7-14: error: phase keyword is not allowed on an associated constant [PhaseKeywordInAssociatedConstant] + // CHECK:STDERR: ╭─┤ fail_template.carbon:[[@LINE+7]]:7 + // CHECK:STDERR: -> │ let template T: type; + // CHECK:STDERR: · ━━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: phase keyword is not allowed on an associated constant + // CHECK:STDERR: · ┃ [PhaseKeywordInAssociatedConstant] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let template T: type; } @@ -73,7 +103,12 @@ interface I { library "[[@TEST_NAME]]"; interface I { - // CHECK:STDERR: fail_generic.carbon:[[@LINE+2]]:7-13: error: phase keyword is not allowed on an associated constant [PhaseKeywordInAssociatedConstant] + // CHECK:STDERR: ╭─┤ fail_generic.carbon:[[@LINE+7]]:7 + // CHECK:STDERR: -> │ let generic a: type; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: phase keyword is not allowed on an associated constant + // CHECK:STDERR: · ┃ [PhaseKeywordInAssociatedConstant] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let generic a: type; } @@ -83,7 +118,13 @@ interface I { library "[[@TEST_NAME]]"; interface I { - // CHECK:STDERR: fail_underscore.carbon:[[@LINE+2]]:7: error: expected identifier in associated constant declaration; prefix reserved word with `r#` to form a valid identifier [ExpectedAssociatedConstantIdentifier] + // CHECK:STDERR: ╭─┤ fail_underscore.carbon:[[@LINE+8]]:7 + // CHECK:STDERR: -> │ let _: {}; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected identifier in associated constant declaration; prefix + // CHECK:STDERR: · ┃ reserved word with `r#` to form a valid identifier + // CHECK:STDERR: · ┃ [ExpectedAssociatedConstantIdentifier] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let _: {}; } @@ -93,7 +134,12 @@ interface I { library "[[@TEST_NAME]]"; interface I { - // CHECK:STDERR: fail_missing_colon.carbon:[[@LINE+2]]:8: error: expected `:` in associated constant declaration [ExpectedAssociatedConstantColon] + // CHECK:STDERR: ╭─┤ fail_missing_colon.carbon:[[@LINE+7]]:8 + // CHECK:STDERR: -> │ let a; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `:` in associated constant declaration + // CHECK:STDERR: · ┃ [ExpectedAssociatedConstantColon] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let a; } diff --git a/toolchain/parse/testdata/generics/interface/fail_missing_name.carbon b/toolchain/parse/testdata/generics/interface/fail_missing_name.carbon index ef8d6e52b3b6..2b8e55cb0a17 100644 --- a/toolchain/parse/testdata/generics/interface/fail_missing_name.carbon +++ b/toolchain/parse/testdata/generics/interface/fail_missing_name.carbon @@ -8,7 +8,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/interface/fail_missing_name.carbon -// CHECK:STDERR: fail_missing_name.carbon:[[@LINE+2]]:10: error: `interface` introducer should be followed by a name [ExpectedDeclName] +// CHECK:STDERR: ╭─┤ fail_missing_name.carbon:[[@LINE+7]]:10 +// CHECK:STDERR: -> │ interface { +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `interface` introducer should be followed by a name +// CHECK:STDERR: · ┃ [ExpectedDeclName] +// CHECK:STDERR: ╰──── // CHECK:STDERR: interface { } diff --git a/toolchain/parse/testdata/generics/interface/fail_missing_open_curly.carbon b/toolchain/parse/testdata/generics/interface/fail_missing_open_curly.carbon index c2098ec37525..061b4b59f6fc 100644 --- a/toolchain/parse/testdata/generics/interface/fail_missing_open_curly.carbon +++ b/toolchain/parse/testdata/generics/interface/fail_missing_open_curly.carbon @@ -8,11 +8,23 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/interface/fail_missing_open_curly.carbon -// CHECK:STDERR: fail_missing_open_curly.carbon:[[@LINE+2]]:14: error: `interface` declarations must either end with a `;` or have a `{ ... }` block for a definition [ExpectedDeclSemiOrDefinition] +// CHECK:STDERR: ╭─┤ fail_missing_open_curly.carbon:[[@LINE+8]]:14 +// CHECK:STDERR: -> │ interface Bar Baz {} +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `interface` declarations must either end with a `;` or +// CHECK:STDERR: · ┃ have a `{ ... }` block for a definition +// CHECK:STDERR: · ┃ [ExpectedDeclSemiOrDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: interface Bar Baz {} -// CHECK:STDERR: fail_missing_open_curly.carbon:[[@LINE+2]]:14: error: `interface` declarations must either end with a `;` or have a `{ ... }` block for a definition [ExpectedDeclSemiOrDefinition] +// CHECK:STDERR: ╭─┤ fail_missing_open_curly.carbon:[[@LINE+8]]:14 +// CHECK:STDERR: -> │ interface Foo +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `interface` declarations must either end with a `;` or +// CHECK:STDERR: · ┃ have a `{ ... }` block for a definition +// CHECK:STDERR: · ┃ [ExpectedDeclSemiOrDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: interface Foo diff --git a/toolchain/parse/testdata/generics/interface/fail_self_param_syntax.carbon b/toolchain/parse/testdata/generics/interface/fail_self_param_syntax.carbon index 6715f0ff8492..d355069072da 100644 --- a/toolchain/parse/testdata/generics/interface/fail_self_param_syntax.carbon +++ b/toolchain/parse/testdata/generics/interface/fail_self_param_syntax.carbon @@ -9,7 +9,11 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/interface/fail_self_param_syntax.carbon interface Foo { - // CHECK:STDERR: fail_self_param_syntax.carbon:[[@LINE+2]]:12: error: expected `,` or `]` [UnexpectedTokenAfterListElement] + // CHECK:STDERR: ╭─┤ fail_self_param_syntax.carbon:[[@LINE+6]]:12 + // CHECK:STDERR: -> │ fn Sub[me Self](b: Self) -> Self; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `,` or `]` [UnexpectedTokenAfterListElement] + // CHECK:STDERR: ╰──── // CHECK:STDERR: fn Sub[me Self](b: Self) -> Self; diff --git a/toolchain/parse/testdata/generics/interface/require.carbon b/toolchain/parse/testdata/generics/interface/require.carbon index 2ea6422baf99..cb3438710867 100644 --- a/toolchain/parse/testdata/generics/interface/require.carbon +++ b/toolchain/parse/testdata/generics/interface/require.carbon @@ -61,7 +61,12 @@ interface Z { interface Y {} interface Z { - // CHECK:STDERR: fail_missing_impls.carbon:[[@LINE+2]]:12: error: expected `impls` in `require` declaration [RequireExpectedImpls] + // CHECK:STDERR: ╭─┤ fail_missing_impls.carbon:[[@LINE+7]]:12 + // CHECK:STDERR: -> │ require Y; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `impls` in `require` declaration + // CHECK:STDERR: · ┃ [RequireExpectedImpls] + // CHECK:STDERR: ╰──── // CHECK:STDERR: require Y; } @@ -71,7 +76,11 @@ interface Z { interface Y {} interface Z { - // CHECK:STDERR: fail_wrong_keyword.carbon:[[@LINE+2]]:10: error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╭─┤ fail_wrong_keyword.carbon:[[@LINE+6]]:10 + // CHECK:STDERR: -> │ require as Y; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╰──── // CHECK:STDERR: require as Y; } @@ -81,7 +90,12 @@ interface Z { interface Y {} interface Z { - // CHECK:STDERR: fail_as_in_self.carbon:[[@LINE+2]]:15: error: expected `impls` in `require` declaration [RequireExpectedImpls] + // CHECK:STDERR: ╭─┤ fail_as_in_self.carbon:[[@LINE+7]]:15 + // CHECK:STDERR: -> │ require Self as Y impls Y; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `impls` in `require` declaration + // CHECK:STDERR: · ┃ [RequireExpectedImpls] + // CHECK:STDERR: ╰──── // CHECK:STDERR: require Self as Y impls Y; } diff --git a/toolchain/parse/testdata/generics/named_constraint/fail_incomplete.carbon b/toolchain/parse/testdata/generics/named_constraint/fail_incomplete.carbon index 1aa0e435248e..312f926dc898 100644 --- a/toolchain/parse/testdata/generics/named_constraint/fail_incomplete.carbon +++ b/toolchain/parse/testdata/generics/named_constraint/fail_incomplete.carbon @@ -8,11 +8,21 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/named_constraint/fail_incomplete.carbon -// CHECK:STDERR: fail_incomplete.carbon:[[@LINE+2]]:11: error: `constraint` introducer should be followed by a name [ExpectedDeclName] +// CHECK:STDERR: ╭─┤ fail_incomplete.carbon:[[@LINE+7]]:11 +// CHECK:STDERR: -> │ constraint "Foo" +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `constraint` introducer should be followed by a name +// CHECK:STDERR: · ┃ [ExpectedDeclName] +// CHECK:STDERR: ╰──── // CHECK:STDERR: constraint "Foo" -// CHECK:STDERR: fail_incomplete.carbon:[[@LINE+2]]:11: error: `constraint` introducer should be followed by a name [ExpectedDeclName] +// CHECK:STDERR: ╭─┤ fail_incomplete.carbon:[[@LINE+7]]:11 +// CHECK:STDERR: -> │ constraint +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `constraint` introducer should be followed by a name +// CHECK:STDERR: · ┃ [ExpectedDeclName] +// CHECK:STDERR: ╰──── // CHECK:STDERR: constraint diff --git a/toolchain/parse/testdata/generics/named_constraint/template_constraint.carbon b/toolchain/parse/testdata/generics/named_constraint/template_constraint.carbon index 11975a5ad5b4..8f75b2f4029d 100644 --- a/toolchain/parse/testdata/generics/named_constraint/template_constraint.carbon +++ b/toolchain/parse/testdata/generics/named_constraint/template_constraint.carbon @@ -10,7 +10,11 @@ // --- fail_todo_template_constraint.carbon -// CHECK:STDERR: fail_todo_template_constraint.carbon:[[@LINE+2]]:1-8: error: unrecognized declaration introducer [UnrecognizedDecl] +// CHECK:STDERR: ╭─┤ fail_todo_template_constraint.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ template constraint Foo { +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: unrecognized declaration introducer [UnrecognizedDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: template constraint Foo { // TODO: Add a require statement. @@ -18,7 +22,11 @@ template constraint Foo { fn DefinedMethod() {} } -// CHECK:STDERR: fail_todo_template_constraint.carbon:[[@LINE+2]]:1-8: error: unrecognized declaration introducer [UnrecognizedDecl] +// CHECK:STDERR: ╭─┤ fail_todo_template_constraint.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ template constraint ForwardDeclared; +// CHECK:STDERR: · ━━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: unrecognized declaration introducer [UnrecognizedDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: template constraint ForwardDeclared; diff --git a/toolchain/parse/testdata/generics/params/fail_redundant_phase_keyword.carbon b/toolchain/parse/testdata/generics/params/fail_redundant_phase_keyword.carbon index fe70718ceadd..1a7f7a32a90f 100644 --- a/toolchain/parse/testdata/generics/params/fail_redundant_phase_keyword.carbon +++ b/toolchain/parse/testdata/generics/params/fail_redundant_phase_keyword.carbon @@ -10,31 +10,60 @@ // --- fail_redundant_generic_deduced.carbon -// CHECK:STDERR: fail_redundant_generic_deduced.carbon:[[@LINE+2]]:6-12: error: `generic` is redundant here; this binding is a checked generic by default [RedundantGenericModifier] +// CHECK:STDERR: ╭─┤ fail_redundant_generic_deduced.carbon:[[@LINE+8]]:6 +// CHECK:STDERR: -> │ fn F[generic T: type](); +// CHECK:STDERR: · ┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `generic` is redundant here; this binding is a checked generic +// CHECK:STDERR: · ┃ by default +// CHECK:STDERR: · ┃ [RedundantGenericModifier] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F[generic T: type](); // --- fail_redundant_generic_class_param.carbon -// CHECK:STDERR: fail_redundant_generic_class_param.carbon:[[@LINE+2]]:9-15: error: `generic` is redundant here; this binding is a checked generic by default [RedundantGenericModifier] +// CHECK:STDERR: ╭─┤ fail_redundant_generic_class_param.carbon:[[@LINE+8]]:9 +// CHECK:STDERR: -> │ class C(generic T: type) {} +// CHECK:STDERR: · ┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `generic` is redundant here; this binding is a checked +// CHECK:STDERR: · ┃ generic by default +// CHECK:STDERR: · ┃ [RedundantGenericModifier] +// CHECK:STDERR: ╰──── // CHECK:STDERR: class C(generic T: type) {} // --- fail_redundant_runtime_explicit.carbon -// CHECK:STDERR: fail_redundant_runtime_explicit.carbon:[[@LINE+2]]:6-12: error: `runtime` is redundant here; this binding is runtime by default [RedundantRuntimeModifier] +// CHECK:STDERR: ╭─┤ fail_redundant_runtime_explicit.carbon:[[@LINE+7]]:6 +// CHECK:STDERR: -> │ fn G(runtime x: i32); +// CHECK:STDERR: · ┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `runtime` is redundant here; this binding is runtime by default +// CHECK:STDERR: · ┃ [RedundantRuntimeModifier] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn G(runtime x: i32); // --- fail_redundant_generic_qualified.carbon -// CHECK:STDERR: fail_redundant_generic_qualified.carbon:[[@LINE+2]]:8-14: error: `generic` is redundant here; this binding is a checked generic by default [RedundantGenericModifier] +// CHECK:STDERR: ╭─┤ fail_redundant_generic_qualified.carbon:[[@LINE+8]]:8 +// CHECK:STDERR: -> │ fn C.F[generic T: type](); +// CHECK:STDERR: · ┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `generic` is redundant here; this binding is a checked +// CHECK:STDERR: · ┃ generic by default +// CHECK:STDERR: · ┃ [RedundantGenericModifier] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn C.F[generic T: type](); // --- fail_redundant_runtime_qualified.carbon -// CHECK:STDERR: fail_redundant_runtime_qualified.carbon:[[@LINE+2]]:8-14: error: `runtime` is redundant here; this binding is runtime by default [RedundantRuntimeModifier] +// CHECK:STDERR: ╭─┤ fail_redundant_runtime_qualified.carbon:[[@LINE+8]]:8 +// CHECK:STDERR: -> │ fn C.G(runtime x: i32); +// CHECK:STDERR: · ┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `runtime` is redundant here; this binding is runtime by +// CHECK:STDERR: · ┃ default +// CHECK:STDERR: · ┃ [RedundantRuntimeModifier] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn C.G(runtime x: i32); diff --git a/toolchain/parse/testdata/generics/params/fail_unused_after_phase_keyword.carbon b/toolchain/parse/testdata/generics/params/fail_unused_after_phase_keyword.carbon index 29c8f371356c..6e12aff8c628 100644 --- a/toolchain/parse/testdata/generics/params/fail_unused_after_phase_keyword.carbon +++ b/toolchain/parse/testdata/generics/params/fail_unused_after_phase_keyword.carbon @@ -10,19 +10,34 @@ // --- fail_generic_before_unused.carbon -// CHECK:STDERR: fail_generic_before_unused.carbon:[[@LINE+2]]:14-19: error: `unused` must be written before `generic` [UnusedAfterBindingModifier] +// CHECK:STDERR: ╭─┤ fail_generic_before_unused.carbon:[[@LINE+7]]:14 +// CHECK:STDERR: -> │ fn F(generic unused T: type); +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: `unused` must be written before `generic` +// CHECK:STDERR: · ┃ [UnusedAfterBindingModifier] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(generic unused T: type); // --- fail_runtime_before_unused.carbon -// CHECK:STDERR: fail_runtime_before_unused.carbon:[[@LINE+2]]:14-19: error: `unused` must be written before `runtime` [UnusedAfterBindingModifier] +// CHECK:STDERR: ╭─┤ fail_runtime_before_unused.carbon:[[@LINE+7]]:14 +// CHECK:STDERR: -> │ fn G[runtime unused T: type](); +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: `unused` must be written before `runtime` +// CHECK:STDERR: · ┃ [UnusedAfterBindingModifier] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn G[runtime unused T: type](); // --- fail_redundant_runtime_before_unused.carbon -// CHECK:STDERR: fail_redundant_runtime_before_unused.carbon:[[@LINE+2]]:6-12: error: `runtime` is redundant here; this binding is runtime by default [RedundantRuntimeModifier] +// CHECK:STDERR: ╭─┤ fail_redundant_runtime_before_unused.carbon:[[@LINE+7]]:6 +// CHECK:STDERR: -> │ fn H(runtime unused x: i32); +// CHECK:STDERR: · ┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `runtime` is redundant here; this binding is runtime by default +// CHECK:STDERR: · ┃ [RedundantRuntimeModifier] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn H(runtime unused x: i32); diff --git a/toolchain/parse/testdata/if/fail_else_unbraced.carbon b/toolchain/parse/testdata/if/fail_else_unbraced.carbon index 1050630e32c3..d3816f962fff 100644 --- a/toolchain/parse/testdata/if/fail_else_unbraced.carbon +++ b/toolchain/parse/testdata/if/fail_else_unbraced.carbon @@ -9,18 +9,34 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/if/fail_else_unbraced.carbon fn F() { - // CHECK:STDERR: fail_else_unbraced.carbon:[[@LINE+2]]:9: error: expected braced code block [ExpectedCodeBlock] + // CHECK:STDERR: ╭─┤ fail_else_unbraced.carbon:[[@LINE+6]]:9 + // CHECK:STDERR: -> │ if (a) + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected braced code block [ExpectedCodeBlock] + // CHECK:STDERR: ╰──── // CHECK:STDERR: if (a) - // CHECK:STDERR: fail_else_unbraced.carbon:[[@LINE+2]]:11: error: expected braced code block [ExpectedCodeBlock] + // CHECK:STDERR: ╭─┤ fail_else_unbraced.carbon:[[@LINE+6]]:11 + // CHECK:STDERR: -> │ if (b) + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected braced code block [ExpectedCodeBlock] + // CHECK:STDERR: ╰──── // CHECK:STDERR: if (b) c; - // CHECK:STDERR: fail_else_unbraced.carbon:[[@LINE+2]]:9: error: expected braced code block [ExpectedCodeBlock] + // CHECK:STDERR: ╭─┤ fail_else_unbraced.carbon:[[@LINE+6]]:9 + // CHECK:STDERR: -> │ else + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected braced code block [ExpectedCodeBlock] + // CHECK:STDERR: ╰──── // CHECK:STDERR: else d; - // CHECK:STDERR: fail_else_unbraced.carbon:[[@LINE+2]]:7: error: expected braced code block [ExpectedCodeBlock] + // CHECK:STDERR: ╭─┤ fail_else_unbraced.carbon:[[@LINE+6]]:7 + // CHECK:STDERR: -> │ else + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected braced code block [ExpectedCodeBlock] + // CHECK:STDERR: ╰──── // CHECK:STDERR: else e; diff --git a/toolchain/parse/testdata/if/fail_errors.carbon b/toolchain/parse/testdata/if/fail_errors.carbon index 3b1a5ecfedc6..6ab4424a3d70 100644 --- a/toolchain/parse/testdata/if/fail_errors.carbon +++ b/toolchain/parse/testdata/if/fail_errors.carbon @@ -9,20 +9,40 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/if/fail_errors.carbon fn F() { - // CHECK:STDERR: fail_errors.carbon:[[@LINE+2]]:6: error: expected `(` after `if` [ExpectedParenAfter] + // CHECK:STDERR: ╭─┤ fail_errors.carbon:[[@LINE+6]]:6 + // CHECK:STDERR: -> │ if a {} + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `(` after `if` [ExpectedParenAfter] + // CHECK:STDERR: ╰──── // CHECK:STDERR: if a {} - // CHECK:STDERR: fail_errors.carbon:[[@LINE+2]]:7: error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╭─┤ fail_errors.carbon:[[@LINE+6]]:7 + // CHECK:STDERR: -> │ if () {} + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╰──── // CHECK:STDERR: if () {} - // CHECK:STDERR: fail_errors.carbon:[[@LINE+3]]:9: error: unexpected tokens before `)` [ExpectedCloseSymbol] - // CHECK:STDERR: fail_errors.carbon:[[@LINE+2]]:6: note: matching this `(` [GroupOpenedHere] + // CHECK:STDERR: ╭─┤ fail_errors.carbon:[[@LINE+7]]:9 + // CHECK:STDERR: -> │ if (b c) {} + // CHECK:STDERR: · ┬ ┳ + // CHECK:STDERR: · │ ┗━━┫ error: unexpected tokens before `)` [ExpectedCloseSymbol] + // CHECK:STDERR: · ╰───────┤ matching this `(` [GroupOpenedHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: if (b c) {} - // CHECK:STDERR: fail_errors.carbon:[[@LINE+2]]:9: error: expected braced code block [ExpectedCodeBlock] + // CHECK:STDERR: ╭─┤ fail_errors.carbon:[[@LINE+6]]:9 + // CHECK:STDERR: -> │ if (d) + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected braced code block [ExpectedCodeBlock] + // CHECK:STDERR: ╰──── // CHECK:STDERR: if (d) -// CHECK:STDERR: fail_errors.carbon:[[@LINE+2]]:1: error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╭─┤ fail_errors.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ } +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: } diff --git a/toolchain/parse/testdata/if/fail_missing_cond.carbon b/toolchain/parse/testdata/if/fail_missing_cond.carbon index 0e5726748abf..526d12dca8d0 100644 --- a/toolchain/parse/testdata/if/fail_missing_cond.carbon +++ b/toolchain/parse/testdata/if/fail_missing_cond.carbon @@ -9,7 +9,11 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/if/fail_missing_cond.carbon fn F() { - // CHECK:STDERR: fail_missing_cond.carbon:[[@LINE+2]]:6: error: expected `(` after `if` [ExpectedParenAfter] + // CHECK:STDERR: ╭─┤ fail_missing_cond.carbon:[[@LINE+6]]:6 + // CHECK:STDERR: -> │ if { + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `(` after `if` [ExpectedParenAfter] + // CHECK:STDERR: ╰──── // CHECK:STDERR: if { } diff --git a/toolchain/parse/testdata/if/fail_square_brackets.carbon b/toolchain/parse/testdata/if/fail_square_brackets.carbon index 6db4282a1578..39bb6ce02e2c 100644 --- a/toolchain/parse/testdata/if/fail_square_brackets.carbon +++ b/toolchain/parse/testdata/if/fail_square_brackets.carbon @@ -9,13 +9,29 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/if/fail_square_brackets.carbon fn F() { - // CHECK:STDERR: fail_square_brackets.carbon:[[@LINE+8]]:6: error: expected `(` after `if` [ExpectedParenAfter] + // CHECK:STDERR: ╭─┤ fail_square_brackets.carbon:[[@LINE+24]]:6 + // CHECK:STDERR: -> │ if [] {} + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `(` after `if` [ExpectedParenAfter] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_square_brackets.carbon:[[@LINE+6]]:5: error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╭─┤ fail_square_brackets.carbon:[[@LINE+18]]:5 + // CHECK:STDERR: -> │ if [] {} + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_square_brackets.carbon:[[@LINE+4]]:6: error: expected braced code block [ExpectedCodeBlock] + // CHECK:STDERR: ╭─┤ fail_square_brackets.carbon:[[@LINE+12]]:6 + // CHECK:STDERR: -> │ if [] {} + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected braced code block [ExpectedCodeBlock] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_square_brackets.carbon:[[@LINE+2]]:6: error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╭─┤ fail_square_brackets.carbon:[[@LINE+6]]:6 + // CHECK:STDERR: -> │ if [] {} + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╰──── // CHECK:STDERR: if [] {} } diff --git a/toolchain/parse/testdata/if/fail_unbraced.carbon b/toolchain/parse/testdata/if/fail_unbraced.carbon index c4ca19e5e45f..ab826d248b15 100644 --- a/toolchain/parse/testdata/if/fail_unbraced.carbon +++ b/toolchain/parse/testdata/if/fail_unbraced.carbon @@ -10,13 +10,25 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/if/fail_unbraced.carbon fn F() { - // CHECK:STDERR: fail_unbraced.carbon:[[@LINE+2]]:9: error: expected braced code block [ExpectedCodeBlock] + // CHECK:STDERR: ╭─┤ fail_unbraced.carbon:[[@LINE+6]]:9 + // CHECK:STDERR: -> │ if (a) + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected braced code block [ExpectedCodeBlock] + // CHECK:STDERR: ╰──── // CHECK:STDERR: if (a) - // CHECK:STDERR: fail_unbraced.carbon:[[@LINE+2]]:11: error: expected braced code block [ExpectedCodeBlock] + // CHECK:STDERR: ╭─┤ fail_unbraced.carbon:[[@LINE+6]]:11 + // CHECK:STDERR: -> │ if (b) + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected braced code block [ExpectedCodeBlock] + // CHECK:STDERR: ╰──── // CHECK:STDERR: if (b) - // CHECK:STDERR: fail_unbraced.carbon:[[@LINE+2]]:13: error: expected braced code block [ExpectedCodeBlock] + // CHECK:STDERR: ╭─┤ fail_unbraced.carbon:[[@LINE+6]]:13 + // CHECK:STDERR: -> │ if (c) + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected braced code block [ExpectedCodeBlock] + // CHECK:STDERR: ╰──── // CHECK:STDERR: if (c) d; diff --git a/toolchain/parse/testdata/if_expr/fail_condition_missing.carbon b/toolchain/parse/testdata/if_expr/fail_condition_missing.carbon index ee4a6ed7df58..913b17218f43 100644 --- a/toolchain/parse/testdata/if_expr/fail_condition_missing.carbon +++ b/toolchain/parse/testdata/if_expr/fail_condition_missing.carbon @@ -9,7 +9,11 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/if_expr/fail_condition_missing.carbon fn F() { - // CHECK:STDERR: fail_condition_missing.carbon:[[@LINE+2]]:18: error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╭─┤ fail_condition_missing.carbon:[[@LINE+6]]:18 + // CHECK:STDERR: -> │ var n: i32 = if; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var n: i32 = if; } diff --git a/toolchain/parse/testdata/if_expr/fail_else_expr_missing.carbon b/toolchain/parse/testdata/if_expr/fail_else_expr_missing.carbon index 2425aa4708c3..c78ffb239c02 100644 --- a/toolchain/parse/testdata/if_expr/fail_else_expr_missing.carbon +++ b/toolchain/parse/testdata/if_expr/fail_else_expr_missing.carbon @@ -9,7 +9,11 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/if_expr/fail_else_expr_missing.carbon fn F() { - // CHECK:STDERR: fail_else_expr_missing.carbon:[[@LINE+2]]:35: error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╭─┤ fail_else_expr_missing.carbon:[[@LINE+6]]:35 + // CHECK:STDERR: -> │ var n: i32 = if true then 1 else; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var n: i32 = if true then 1 else; } diff --git a/toolchain/parse/testdata/if_expr/fail_else_missing.carbon b/toolchain/parse/testdata/if_expr/fail_else_missing.carbon index 838b30caf2f3..167f98aadc4c 100644 --- a/toolchain/parse/testdata/if_expr/fail_else_missing.carbon +++ b/toolchain/parse/testdata/if_expr/fail_else_missing.carbon @@ -9,7 +9,12 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/if_expr/fail_else_missing.carbon fn F() { - // CHECK:STDERR: fail_else_missing.carbon:[[@LINE+2]]:30: error: expected `else` after `if ... then ...` [ExpectedElseAfterIf] + // CHECK:STDERR: ╭─┤ fail_else_missing.carbon:[[@LINE+7]]:30 + // CHECK:STDERR: -> │ var n: i32 = if true then 1; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `else` after `if ... then ...` + // CHECK:STDERR: · ┃ [ExpectedElseAfterIf] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var n: i32 = if true then 1; } diff --git a/toolchain/parse/testdata/if_expr/fail_then_expr_missing.carbon b/toolchain/parse/testdata/if_expr/fail_then_expr_missing.carbon index a59928163517..2ce484ec2833 100644 --- a/toolchain/parse/testdata/if_expr/fail_then_expr_missing.carbon +++ b/toolchain/parse/testdata/if_expr/fail_then_expr_missing.carbon @@ -9,7 +9,11 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/if_expr/fail_then_expr_missing.carbon fn F() { - // CHECK:STDERR: fail_then_expr_missing.carbon:[[@LINE+2]]:28: error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╭─┤ fail_then_expr_missing.carbon:[[@LINE+6]]:28 + // CHECK:STDERR: -> │ var n: i32 = if true then; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var n: i32 = if true then; } diff --git a/toolchain/parse/testdata/if_expr/fail_then_missing.carbon b/toolchain/parse/testdata/if_expr/fail_then_missing.carbon index bf342f9ef624..6303fb0e9ddb 100644 --- a/toolchain/parse/testdata/if_expr/fail_then_missing.carbon +++ b/toolchain/parse/testdata/if_expr/fail_then_missing.carbon @@ -9,7 +9,12 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/if_expr/fail_then_missing.carbon fn F() { - // CHECK:STDERR: fail_then_missing.carbon:[[@LINE+2]]:23: error: expected `then` after `if` condition [ExpectedThenAfterIf] + // CHECK:STDERR: ╭─┤ fail_then_missing.carbon:[[@LINE+7]]:23 + // CHECK:STDERR: -> │ var n: i32 = if true; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `then` after `if` condition + // CHECK:STDERR: · ┃ [ExpectedThenAfterIf] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var n: i32 = if true; } diff --git a/toolchain/parse/testdata/if_expr/fail_top_level_if.carbon b/toolchain/parse/testdata/if_expr/fail_top_level_if.carbon index b0431453816d..efa5272468bb 100644 --- a/toolchain/parse/testdata/if_expr/fail_top_level_if.carbon +++ b/toolchain/parse/testdata/if_expr/fail_top_level_if.carbon @@ -9,11 +9,23 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/if_expr/fail_top_level_if.carbon fn F() { - // CHECK:STDERR: fail_top_level_if.carbon:[[@LINE+6]]:6: error: expected `(` after `if` [ExpectedParenAfter] + // CHECK:STDERR: ╭─┤ fail_top_level_if.carbon:[[@LINE+18]]:6 + // CHECK:STDERR: -> │ if true then 1 else 2; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `(` after `if` [ExpectedParenAfter] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_top_level_if.carbon:[[@LINE+4]]:11: error: expected braced code block [ExpectedCodeBlock] + // CHECK:STDERR: ╭─┤ fail_top_level_if.carbon:[[@LINE+12]]:11 + // CHECK:STDERR: -> │ if true then 1 else 2; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected braced code block [ExpectedCodeBlock] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_top_level_if.carbon:[[@LINE+2]]:11-14: error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╭─┤ fail_top_level_if.carbon:[[@LINE+6]]:11 + // CHECK:STDERR: -> │ if true then 1 else 2; + // CHECK:STDERR: · ━━┳━ + // CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╰──── // CHECK:STDERR: if true then 1 else 2; } diff --git a/toolchain/parse/testdata/index/fail_empty_expr.carbon b/toolchain/parse/testdata/index/fail_empty_expr.carbon index 6fbe830ea996..db9915d8c4c4 100644 --- a/toolchain/parse/testdata/index/fail_empty_expr.carbon +++ b/toolchain/parse/testdata/index/fail_empty_expr.carbon @@ -8,7 +8,11 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/index/fail_empty_expr.carbon -// CHECK:STDERR: fail_empty_expr.carbon:[[@LINE+2]]:16: error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╭─┤ fail_empty_expr.carbon:[[@LINE+6]]:16 +// CHECK:STDERR: -> │ var v: i32 = t[]; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var v: i32 = t[]; diff --git a/toolchain/parse/testdata/index/fail_malformed_expr.carbon b/toolchain/parse/testdata/index/fail_malformed_expr.carbon index eedfb47133be..7813c2cb6520 100644 --- a/toolchain/parse/testdata/index/fail_malformed_expr.carbon +++ b/toolchain/parse/testdata/index/fail_malformed_expr.carbon @@ -8,8 +8,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/index/fail_malformed_expr.carbon -// CHECK:STDERR: fail_malformed_expr.carbon:[[@LINE+3]]:17: error: unexpected tokens before `]` [ExpectedCloseSymbol] -// CHECK:STDERR: fail_malformed_expr.carbon:[[@LINE+2]]:15: note: matching this `[` [GroupOpenedHere] +// CHECK:STDERR: ╭─┤ fail_malformed_expr.carbon:[[@LINE+7]]:17 +// CHECK:STDERR: -> │ var v: i32 = t[0,]; +// CHECK:STDERR: · ┬ ┳ +// CHECK:STDERR: · │ ┗━━┫ error: unexpected tokens before `]` [ExpectedCloseSymbol] +// CHECK:STDERR: · ╰──────┤ matching this `[` [GroupOpenedHere] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var v: i32 = t[0,]; diff --git a/toolchain/parse/testdata/lambda/lambda.carbon b/toolchain/parse/testdata/lambda/lambda.carbon index 34d6ebdf7c22..9836cb6d4fb2 100644 --- a/toolchain/parse/testdata/lambda/lambda.carbon +++ b/toolchain/parse/testdata/lambda/lambda.carbon @@ -20,24 +20,56 @@ var d: auto = fn (ref x: i32) ->? ref i32 { return x; }; // Tests that the compiler does not crash when a LambdaIntroducer (`fn`) // is left unconsumed inside an invalid binary operator sequence. -// CHECK:STDERR: fail_unconsumed_lambda_introducer.carbon:[[@LINE+12]]:10: error: whitespace missing around binary operator [BinaryOperatorRequiresWhitespace] +// CHECK:STDERR: ╭─┤ fail_unconsumed_lambda_introducer.carbon:[[@LINE+40]]:10 +// CHECK:STDERR: -> │ require j%-fn->> +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: whitespace missing around binary operator +// CHECK:STDERR: · ┃ [BinaryOperatorRequiresWhitespace] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_unconsumed_lambda_introducer.carbon:[[@LINE+10]]:16: error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╭─┤ fail_unconsumed_lambda_introducer.carbon:[[@LINE+33]]:16 +// CHECK:STDERR: -> │ require j%-fn->> +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_unconsumed_lambda_introducer.carbon:[[@LINE+8]]:16: error: whitespace missing before binary operator [BinaryOperatorRequiresWhitespace] +// CHECK:STDERR: ╭─┤ fail_unconsumed_lambda_introducer.carbon:[[@LINE+27]]:16 +// CHECK:STDERR: -> │ require j%-fn->> +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: whitespace missing before binary operator +// CHECK:STDERR: · ┃ [BinaryOperatorRequiresWhitespace] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_unconsumed_lambda_introducer.carbon:[[@LINE+6]]:17: error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╭─┤ fail_unconsumed_lambda_introducer.carbon:[[@LINE+20]]:17 +// CHECK:STDERR: -> │ require j%-fn->> +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_unconsumed_lambda_introducer.carbon:[[@LINE+4]]:17: error: expected `{` after return type [ExpectedLambdaBodyAfterReturnType] +// CHECK:STDERR: ╭─┤ fail_unconsumed_lambda_introducer.carbon:[[@LINE+14]]:17 +// CHECK:STDERR: -> │ require j%-fn->> +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `{` after return type +// CHECK:STDERR: · ┃ [ExpectedLambdaBodyAfterReturnType] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_unconsumed_lambda_introducer.carbon:[[@LINE+2]]:17: error: expected `impls` in `require` declaration [RequireExpectedImpls] +// CHECK:STDERR: ╭─┤ fail_unconsumed_lambda_introducer.carbon:[[@LINE+7]]:17 +// CHECK:STDERR: -> │ require j%-fn->> +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `impls` in `require` declaration +// CHECK:STDERR: · ┃ [RequireExpectedImpls] +// CHECK:STDERR: ╰──── // CHECK:STDERR: require j%-fn->> // --- fail_expected_body.carbon fn F() { - // CHECK:STDERR: fail_expected_body.carbon:[[@LINE+2]]:19: error: expected `->`, `=>`, or `{` [ExpectedLambdaBody] + // CHECK:STDERR: ╭─┤ fail_expected_body.carbon:[[@LINE+6]]:19 + // CHECK:STDERR: -> │ var x: auto = fn ; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `->`, `=>`, or `{` [ExpectedLambdaBody] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var x: auto = fn ; } @@ -45,7 +77,12 @@ fn F() { // --- fail_expected_body_after_return_type.carbon fn G() { - // CHECK:STDERR: fail_expected_body_after_return_type.carbon:[[@LINE+2]]:26: error: expected `{` after return type [ExpectedLambdaBodyAfterReturnType] + // CHECK:STDERR: ╭─┤ fail_expected_body_after_return_type.carbon:[[@LINE+7]]:26 + // CHECK:STDERR: -> │ var x: auto = fn -> i32 ; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `{` after return type + // CHECK:STDERR: · ┃ [ExpectedLambdaBodyAfterReturnType] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var x: auto = fn -> i32 ; } diff --git a/toolchain/parse/testdata/let/expression_pattern_precedence.carbon b/toolchain/parse/testdata/let/expression_pattern_precedence.carbon index 9eeb98ee70cb..d4abd041bf1c 100644 --- a/toolchain/parse/testdata/let/expression_pattern_precedence.carbon +++ b/toolchain/parse/testdata/let/expression_pattern_precedence.carbon @@ -21,7 +21,11 @@ fn F() { // --- fail_relational.carbon fn G() { - // CHECK:STDERR: fail_relational.carbon:[[@LINE+2]]:8: error: `let` declarations must end with a `;` [ExpectedDeclSemi] + // CHECK:STDERR: ╭─┤ fail_relational.carbon:[[@LINE+6]]:8 + // CHECK:STDERR: -> │ let a == b = c; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: `let` declarations must end with a `;` [ExpectedDeclSemi] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let a == b = c; } @@ -29,7 +33,11 @@ fn G() { // --- fail_logical.carbon fn H() { - // CHECK:STDERR: fail_logical.carbon:[[@LINE+2]]:8: error: `let` declarations must end with a `;` [ExpectedDeclSemi] + // CHECK:STDERR: ╭─┤ fail_logical.carbon:[[@LINE+6]]:8 + // CHECK:STDERR: -> │ let a and b = c; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: `let` declarations must end with a `;` [ExpectedDeclSemi] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let a and b = c; } @@ -37,7 +45,12 @@ fn H() { // --- fail_if.carbon fn I() { - // CHECK:STDERR: fail_if.carbon:[[@LINE+2]]:7-8: error: parentheses are required around this unary `if` operator [UnaryOperatorRequiresParentheses] + // CHECK:STDERR: ╭─┤ fail_if.carbon:[[@LINE+7]]:7 + // CHECK:STDERR: -> │ let if true then 1 else 2 = 3; + // CHECK:STDERR: · ━┳ + // CHECK:STDERR: · ┗━━┫ error: parentheses are required around this unary `if` operator + // CHECK:STDERR: · ┃ [UnaryOperatorRequiresParentheses] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let if true then 1 else 2 = 3; } diff --git a/toolchain/parse/testdata/let/fail_bad_name.carbon b/toolchain/parse/testdata/let/fail_bad_name.carbon index 0ae8c0c1ddb7..b11e70aa6127 100644 --- a/toolchain/parse/testdata/let/fail_bad_name.carbon +++ b/toolchain/parse/testdata/let/fail_bad_name.carbon @@ -8,7 +8,11 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/let/fail_bad_name.carbon -// CHECK:STDERR: fail_bad_name.carbon:[[@LINE+2]]:4: error: expected pattern [ExpectedPattern] +// CHECK:STDERR: ╭─┤ fail_bad_name.carbon:[[@LINE+6]]:4 +// CHECK:STDERR: -> │ let ? = 4; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected pattern [ExpectedPattern] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let ? = 4; diff --git a/toolchain/parse/testdata/let/fail_empty.carbon b/toolchain/parse/testdata/let/fail_empty.carbon index b1bb393826f9..cc374ce1e14a 100644 --- a/toolchain/parse/testdata/let/fail_empty.carbon +++ b/toolchain/parse/testdata/let/fail_empty.carbon @@ -8,7 +8,11 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/let/fail_empty.carbon -// CHECK:STDERR: fail_empty.carbon:[[@LINE+2]]:4: error: expected pattern [ExpectedPattern] +// CHECK:STDERR: ╭─┤ fail_empty.carbon:[[@LINE+6]]:4 +// CHECK:STDERR: -> │ let; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected pattern [ExpectedPattern] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let; diff --git a/toolchain/parse/testdata/let/fail_generic_ref.carbon b/toolchain/parse/testdata/let/fail_generic_ref.carbon index b402717bd796..9515922abc74 100644 --- a/toolchain/parse/testdata/let/fail_generic_ref.carbon +++ b/toolchain/parse/testdata/let/fail_generic_ref.carbon @@ -8,7 +8,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/let/fail_generic_ref.carbon -// CHECK:STDERR: fail_generic_ref.carbon:[[@LINE+2]]:13-15: error: `ref` is only allowed on a runtime binding [ExpectedRuntimeBindingPatternAfterRef] +// CHECK:STDERR: ╭─┤ fail_generic_ref.carbon:[[@LINE+7]]:13 +// CHECK:STDERR: -> │ let generic ref X: i32 = 0; +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┗━━┫ error: `ref` is only allowed on a runtime binding +// CHECK:STDERR: · ┃ [ExpectedRuntimeBindingPatternAfterRef] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let generic ref X: i32 = 0; diff --git a/toolchain/parse/testdata/let/fail_let_struct_identifier_only.carbon b/toolchain/parse/testdata/let/fail_let_struct_identifier_only.carbon index 59d4f5ea45bf..304d79ab11ad 100644 --- a/toolchain/parse/testdata/let/fail_let_struct_identifier_only.carbon +++ b/toolchain/parse/testdata/let/fail_let_struct_identifier_only.carbon @@ -8,7 +8,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/let/fail_let_struct_identifier_only.carbon -// CHECK:STDERR: fail_let_struct_identifier_only.carbon:[[@LINE+2]]:7: error: expected `:` or `:?` in binding pattern [ExpectedBindingPattern] +// CHECK:STDERR: ╭─┤ fail_let_struct_identifier_only.carbon:[[@LINE+7]]:7 +// CHECK:STDERR: -> │ let {s}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `:` or `:?` in binding pattern +// CHECK:STDERR: · ┃ [ExpectedBindingPattern] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let {s}; diff --git a/toolchain/parse/testdata/let/fail_missing_name.carbon b/toolchain/parse/testdata/let/fail_missing_name.carbon index 1651069358e2..f21c2f78cb84 100644 --- a/toolchain/parse/testdata/let/fail_missing_name.carbon +++ b/toolchain/parse/testdata/let/fail_missing_name.carbon @@ -10,13 +10,21 @@ // --- fail_runtime_binding.carbon -// CHECK:STDERR: fail_runtime_binding.carbon:[[@LINE+2]]:4: error: expected pattern [ExpectedPattern] +// CHECK:STDERR: ╭─┤ fail_runtime_binding.carbon:[[@LINE+6]]:4 +// CHECK:STDERR: -> │ let : i32 = 4; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected pattern [ExpectedPattern] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let : i32 = 4; // --- fail_compiletime_binding.carbon -// CHECK:STDERR: fail_compiletime_binding.carbon:[[@LINE+2]]:12: error: expected name in binding pattern [ExpectedBindingPattern] +// CHECK:STDERR: ╭─┤ fail_compiletime_binding.carbon:[[@LINE+6]]:12 +// CHECK:STDERR: -> │ let generic : bool = true; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected name in binding pattern [ExpectedBindingPattern] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let generic : bool = true; diff --git a/toolchain/parse/testdata/let/fail_no_semi.carbon b/toolchain/parse/testdata/let/fail_no_semi.carbon index fb651f9d9b53..f921aedf444d 100644 --- a/toolchain/parse/testdata/let/fail_no_semi.carbon +++ b/toolchain/parse/testdata/let/fail_no_semi.carbon @@ -8,9 +8,17 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/let/fail_no_semi.carbon -// CHECK:STDERR: fail_no_semi.carbon:[[@LINE+4]]:4: error: expected pattern [ExpectedPattern] +// CHECK:STDERR: ╭─┤ fail_no_semi.carbon:[[@LINE+12]]:4 +// CHECK:STDERR: -> │ let +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected pattern [ExpectedPattern] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_no_semi.carbon:[[@LINE+2]]:4: error: `let` declarations must end with a `;` [ExpectedDeclSemi] +// CHECK:STDERR: ╭─┤ fail_no_semi.carbon:[[@LINE+6]]:4 +// CHECK:STDERR: -> │ let +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `let` declarations must end with a `;` [ExpectedDeclSemi] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let diff --git a/toolchain/parse/testdata/match/fail_cases_after_default.carbon b/toolchain/parse/testdata/match/fail_cases_after_default.carbon index 5f8380e98094..7303c33e445c 100644 --- a/toolchain/parse/testdata/match/fail_cases_after_default.carbon +++ b/toolchain/parse/testdata/match/fail_cases_after_default.carbon @@ -12,13 +12,28 @@ fn f() -> i32 { var x: i32 = 3; match (x) { default => { return 1; } - // CHECK:STDERR: fail_cases_after_default.carbon:[[@LINE+2]]:5-8: error: unreachable case; `case` occurs after the `default` [UnreachableMatchCase] + // CHECK:STDERR: ╭─┤ fail_cases_after_default.carbon:[[@LINE+7]]:5 + // CHECK:STDERR: -> │ case a: i32 => { return 2; } + // CHECK:STDERR: · ━━┳━ + // CHECK:STDERR: · ┗━━┫ error: unreachable case; `case` occurs after the `default` + // CHECK:STDERR: · ┃ [UnreachableMatchCase] + // CHECK:STDERR: ╰──── // CHECK:STDERR: case a: i32 => { return 2; } - // CHECK:STDERR: fail_cases_after_default.carbon:[[@LINE+2]]:5-11: error: unreachable case; `default` occurs after the `default` [UnreachableMatchCase] + // CHECK:STDERR: ╭─┤ fail_cases_after_default.carbon:[[@LINE+7]]:5 + // CHECK:STDERR: -> │ default => { return 3; } + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: unreachable case; `default` occurs after the `default` + // CHECK:STDERR: · ┃ [UnreachableMatchCase] + // CHECK:STDERR: ╰──── // CHECK:STDERR: default => { return 3; } - // CHECK:STDERR: fail_cases_after_default.carbon:[[@LINE+2]]:5-8: error: unreachable case; `case` occurs after the `default` [UnreachableMatchCase] + // CHECK:STDERR: ╭─┤ fail_cases_after_default.carbon:[[@LINE+7]]:5 + // CHECK:STDERR: -> │ case (a: i32) if (a == 4) => { return 4; } + // CHECK:STDERR: · ━━┳━ + // CHECK:STDERR: · ┗━━┫ error: unreachable case; `case` occurs after the `default` + // CHECK:STDERR: · ┃ [UnreachableMatchCase] + // CHECK:STDERR: ╰──── // CHECK:STDERR: case (a: i32) if (a == 4) => { return 4; } } diff --git a/toolchain/parse/testdata/match/fail_missing_case_arrow.carbon b/toolchain/parse/testdata/match/fail_missing_case_arrow.carbon index 688c204fb671..fea562be5243 100644 --- a/toolchain/parse/testdata/match/fail_missing_case_arrow.carbon +++ b/toolchain/parse/testdata/match/fail_missing_case_arrow.carbon @@ -10,10 +10,20 @@ fn f() -> i32 { match (3) { - // CHECK:STDERR: fail_missing_case_arrow.carbon:[[@LINE+2]]:16: error: expected `=>` introducing statement block [ExpectedMatchCaseArrow] + // CHECK:STDERR: ╭─┤ fail_missing_case_arrow.carbon:[[@LINE+7]]:16 + // CHECK:STDERR: -> │ case x: i32 { return 2; } + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `=>` introducing statement block + // CHECK:STDERR: · ┃ [ExpectedMatchCaseArrow] + // CHECK:STDERR: ╰──── // CHECK:STDERR: case x: i32 { return 2; } - // CHECK:STDERR: fail_missing_case_arrow.carbon:[[@LINE+2]]:28: error: expected `=>` introducing statement block [ExpectedMatchCaseArrow] + // CHECK:STDERR: ╭─┤ fail_missing_case_arrow.carbon:[[@LINE+7]]:28 + // CHECK:STDERR: -> │ case x: i32 if (x == 3) { return 3; } + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `=>` introducing statement block + // CHECK:STDERR: · ┃ [ExpectedMatchCaseArrow] + // CHECK:STDERR: ╰──── // CHECK:STDERR: case x: i32 if (x == 3) { return 3; } } diff --git a/toolchain/parse/testdata/match/fail_missing_case_pattern.carbon b/toolchain/parse/testdata/match/fail_missing_case_pattern.carbon index d80d96df4008..3410ab6716f5 100644 --- a/toolchain/parse/testdata/match/fail_missing_case_pattern.carbon +++ b/toolchain/parse/testdata/match/fail_missing_case_pattern.carbon @@ -10,7 +10,11 @@ fn f() -> i32 { match (3) { - // CHECK:STDERR: fail_missing_case_pattern.carbon:[[@LINE+2]]:9: error: expected pattern [ExpectedPattern] + // CHECK:STDERR: ╭─┤ fail_missing_case_pattern.carbon:[[@LINE+6]]:9 + // CHECK:STDERR: -> │ case => { return 2; } + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected pattern [ExpectedPattern] + // CHECK:STDERR: ╰──── // CHECK:STDERR: case => { return 2; } } diff --git a/toolchain/parse/testdata/match/fail_missing_case_statements_block.carbon b/toolchain/parse/testdata/match/fail_missing_case_statements_block.carbon index 2f0af02a9f71..51106a190d62 100644 --- a/toolchain/parse/testdata/match/fail_missing_case_statements_block.carbon +++ b/toolchain/parse/testdata/match/fail_missing_case_statements_block.carbon @@ -10,7 +10,11 @@ fn f() -> i32 { match (3) { - // CHECK:STDERR: fail_missing_case_statements_block.carbon:[[@LINE+2]]:19: error: expected `{` after `=>` [ExpectedMatchCaseBlock] + // CHECK:STDERR: ╭─┤ fail_missing_case_statements_block.carbon:[[@LINE+6]]:19 + // CHECK:STDERR: -> │ case x: i32 => + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `{` after `=>` [ExpectedMatchCaseBlock] + // CHECK:STDERR: ╰──── // CHECK:STDERR: case x: i32 => default => { return 3; } diff --git a/toolchain/parse/testdata/match/fail_missing_cases.carbon b/toolchain/parse/testdata/match/fail_missing_cases.carbon index dd8240261567..9454fb0eaa58 100644 --- a/toolchain/parse/testdata/match/fail_missing_cases.carbon +++ b/toolchain/parse/testdata/match/fail_missing_cases.carbon @@ -10,7 +10,11 @@ fn f() -> i32 { - // CHECK:STDERR: fail_missing_cases.carbon:[[@LINE+2]]:14: error: expected cases [ExpectedMatchCases] + // CHECK:STDERR: ╭─┤ fail_missing_cases.carbon:[[@LINE+6]]:14 + // CHECK:STDERR: -> │ match (3) {} + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected cases [ExpectedMatchCases] + // CHECK:STDERR: ╰──── // CHECK:STDERR: match (3) {} return 0; diff --git a/toolchain/parse/testdata/match/fail_missing_cases_block.carbon b/toolchain/parse/testdata/match/fail_missing_cases_block.carbon index 905f068673f2..4db8ad0bd566 100644 --- a/toolchain/parse/testdata/match/fail_missing_cases_block.carbon +++ b/toolchain/parse/testdata/match/fail_missing_cases_block.carbon @@ -9,7 +9,12 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/match/fail_missing_cases_block.carbon fn f() -> i32 { - // CHECK:STDERR: fail_missing_cases_block.carbon:[[@LINE+2]]:12: error: expected `{` starting block with cases [ExpectedMatchCasesBlock] + // CHECK:STDERR: ╭─┤ fail_missing_cases_block.carbon:[[@LINE+7]]:12 + // CHECK:STDERR: -> │ match (1) + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `{` starting block with cases + // CHECK:STDERR: · ┃ [ExpectedMatchCasesBlock] + // CHECK:STDERR: ╰──── // CHECK:STDERR: match (1) return 0; diff --git a/toolchain/parse/testdata/match/fail_missing_default_arrow.carbon b/toolchain/parse/testdata/match/fail_missing_default_arrow.carbon index da9d66409924..b1ce895831a3 100644 --- a/toolchain/parse/testdata/match/fail_missing_default_arrow.carbon +++ b/toolchain/parse/testdata/match/fail_missing_default_arrow.carbon @@ -10,7 +10,12 @@ fn f() -> i32 { match (3) { - // CHECK:STDERR: fail_missing_default_arrow.carbon:[[@LINE+2]]:12: error: expected `=>` introducing statement block [ExpectedMatchCaseArrow] + // CHECK:STDERR: ╭─┤ fail_missing_default_arrow.carbon:[[@LINE+7]]:12 + // CHECK:STDERR: -> │ default { return 1; } + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `=>` introducing statement block + // CHECK:STDERR: · ┃ [ExpectedMatchCaseArrow] + // CHECK:STDERR: ╰──── // CHECK:STDERR: default { return 1; } } diff --git a/toolchain/parse/testdata/match/fail_missing_default_statements_block.carbon b/toolchain/parse/testdata/match/fail_missing_default_statements_block.carbon index 166760dd1419..0ac2ba955f81 100644 --- a/toolchain/parse/testdata/match/fail_missing_default_statements_block.carbon +++ b/toolchain/parse/testdata/match/fail_missing_default_statements_block.carbon @@ -10,7 +10,11 @@ fn f() -> i32 { match (3) { - // CHECK:STDERR: fail_missing_default_statements_block.carbon:[[@LINE+2]]:15: error: expected `{` after `=>` [ExpectedMatchCaseBlock] + // CHECK:STDERR: ╭─┤ fail_missing_default_statements_block.carbon:[[@LINE+6]]:15 + // CHECK:STDERR: -> │ default => + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `{` after `=>` [ExpectedMatchCaseBlock] + // CHECK:STDERR: ╰──── // CHECK:STDERR: default => } diff --git a/toolchain/parse/testdata/match/fail_missing_guard_close_paren.carbon b/toolchain/parse/testdata/match/fail_missing_guard_close_paren.carbon index f5145fe20593..1aa2fe280dee 100644 --- a/toolchain/parse/testdata/match/fail_missing_guard_close_paren.carbon +++ b/toolchain/parse/testdata/match/fail_missing_guard_close_paren.carbon @@ -10,10 +10,22 @@ fn f() -> i32 { match (true) { - // CHECK:STDERR: fail_missing_guard_close_paren.carbon:[[@LINE+5]]:21: error: opening symbol without a corresponding closing symbol [UnmatchedOpening] - // CHECK:STDERR: fail_missing_guard_close_paren.carbon:[[@LINE+4]]:30: note: possibly missing `)` here [PossiblyMissingBracketHere] + // CHECK:STDERR: ╭─┤ fail_missing_guard_close_paren.carbon:[[@LINE+17]]:21 + // CHECK:STDERR: -> │ case x: bool if (false => { return 1; } + // CHECK:STDERR: · ┳ ┬ + // CHECK:STDERR: · ┗━━━━━━━━━━━┫ error: opening symbol without a corresponding + // CHECK:STDERR: · │ ┃ closing symbol + // CHECK:STDERR: · │ ┃ [UnmatchedOpening] + // CHECK:STDERR: · ╰────┤ possibly missing `)` here + // CHECK:STDERR: · │ [PossiblyMissingBracketHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_missing_guard_close_paren.carbon:[[@LINE+2]]:27: error: expected `)` [ExpectedMatchCaseGuardCloseParen] + // CHECK:STDERR: ╭─┤ fail_missing_guard_close_paren.carbon:[[@LINE+7]]:27 + // CHECK:STDERR: -> │ case x: bool if (false => { return 1; } + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `)` + // CHECK:STDERR: · ┃ [ExpectedMatchCaseGuardCloseParen] + // CHECK:STDERR: ╰──── // CHECK:STDERR: case x: bool if (false => { return 1; } } diff --git a/toolchain/parse/testdata/match/fail_missing_guard_open_paren.carbon b/toolchain/parse/testdata/match/fail_missing_guard_open_paren.carbon index 210fd99c6433..ed1407fd909b 100644 --- a/toolchain/parse/testdata/match/fail_missing_guard_open_paren.carbon +++ b/toolchain/parse/testdata/match/fail_missing_guard_open_paren.carbon @@ -10,8 +10,15 @@ fn f() -> i32 { match (true) { - // CHECK:STDERR: fail_missing_guard_open_paren.carbon:[[@LINE+3]]:26: error: closing symbol without a corresponding opening symbol [UnmatchedClosing] - // CHECK:STDERR: fail_missing_guard_open_paren.carbon:[[@LINE+2]]:21: note: possibly missing `(` here [PossiblyMissingBracketHere] + // CHECK:STDERR: ╭─┤ fail_missing_guard_open_paren.carbon:[[@LINE+10]]:26 + // CHECK:STDERR: -> │ case x: bool if false) => { return 1; } + // CHECK:STDERR: · ┬ ┳ + // CHECK:STDERR: · │ ┗━━┫ error: closing symbol without a corresponding + // CHECK:STDERR: · │ ┃ opening symbol + // CHECK:STDERR: · │ ┃ [UnmatchedClosing] + // CHECK:STDERR: · ╰─────────┤ possibly missing `(` here + // CHECK:STDERR: · │ [PossiblyMissingBracketHere] + // CHECK:STDERR: ╰──── // CHECK:STDERR: case x: bool if false) => { return 1; } } diff --git a/toolchain/parse/testdata/match/fail_missing_guard_parens_only_parse_errors.carbon b/toolchain/parse/testdata/match/fail_missing_guard_parens_only_parse_errors.carbon index 7cbeb415eacc..fec7c89aa881 100644 --- a/toolchain/parse/testdata/match/fail_missing_guard_parens_only_parse_errors.carbon +++ b/toolchain/parse/testdata/match/fail_missing_guard_parens_only_parse_errors.carbon @@ -10,11 +10,21 @@ fn f() -> i32 { match (true) { - // CHECK:STDERR: fail_missing_guard_parens_only_parse_errors.carbon:[[@LINE+2]]:32: error: expected `)` [ExpectedMatchCaseGuardCloseParen] + // CHECK:STDERR: ╭─┤ fail_missing_guard_parens_only_parse_errors.carbon:[[@LINE+7]]:32 + // CHECK:STDERR: -> │ case x: bool if (x == false => { return 1; } + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `)` + // CHECK:STDERR: · ┃ [ExpectedMatchCaseGuardCloseParen] + // CHECK:STDERR: ╰──── // CHECK:STDERR: case x: bool if (x == false => { return 1; } case y: bool if (not y) => { return 2; } - // CHECK:STDERR: fail_missing_guard_parens_only_parse_errors.carbon:[[@LINE+2]]:21: error: expected `(` after `if` [ExpectedMatchCaseGuardOpenParen] + // CHECK:STDERR: ╭─┤ fail_missing_guard_parens_only_parse_errors.carbon:[[@LINE+7]]:21 + // CHECK:STDERR: -> │ case z: bool if true or false) => { return 3; } + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `(` after `if` + // CHECK:STDERR: · ┃ [ExpectedMatchCaseGuardOpenParen] + // CHECK:STDERR: ╰──── // CHECK:STDERR: case z: bool if true or false) => { return 3; } } diff --git a/toolchain/parse/testdata/match/fail_missing_matched_expr.carbon b/toolchain/parse/testdata/match/fail_missing_matched_expr.carbon index baf5ffe59a41..14f8d07a9879 100644 --- a/toolchain/parse/testdata/match/fail_missing_matched_expr.carbon +++ b/toolchain/parse/testdata/match/fail_missing_matched_expr.carbon @@ -9,7 +9,11 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/match/fail_missing_matched_expr.carbon fn f() -> i32 { - // CHECK:STDERR: fail_missing_matched_expr.carbon:[[@LINE+2]]:9: error: expected `(` after `match` [ExpectedParenAfter] + // CHECK:STDERR: ╭─┤ fail_missing_matched_expr.carbon:[[@LINE+6]]:9 + // CHECK:STDERR: -> │ match { + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `(` after `match` [ExpectedParenAfter] + // CHECK:STDERR: ╰──── // CHECK:STDERR: match { default => { return 1; } diff --git a/toolchain/parse/testdata/match/fail_unexpected_tokens_in_cases_block.carbon b/toolchain/parse/testdata/match/fail_unexpected_tokens_in_cases_block.carbon index 3990c9313f75..4fc6a2b1a05e 100644 --- a/toolchain/parse/testdata/match/fail_unexpected_tokens_in_cases_block.carbon +++ b/toolchain/parse/testdata/match/fail_unexpected_tokens_in_cases_block.carbon @@ -11,29 +11,59 @@ fn f() -> i32 { var x: i32 = 3; match (x) { - // CHECK:STDERR: fail_unexpected_tokens_in_cases_block.carbon:[[@LINE+2]]:5-7: error: unexpected `let`; expected `case`, `default` or `}` [UnexpectedTokenInMatchCasesBlock] + // CHECK:STDERR: ╭─┤ fail_unexpected_tokens_in_cases_block.carbon:[[@LINE+7]]:5 + // CHECK:STDERR: -> │ let u: i32 = + // CHECK:STDERR: · ━┳━ + // CHECK:STDERR: · ┗━━┫ error: unexpected `let`; expected `case`, `default` or `}` + // CHECK:STDERR: · ┃ [UnexpectedTokenInMatchCasesBlock] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let u: i32 = case y: i32 if (y > 2) => { return 1; } - // CHECK:STDERR: fail_unexpected_tokens_in_cases_block.carbon:[[@LINE+2]]:5-6: error: unexpected `if`; expected `case`, `default` or `}` [UnexpectedTokenInMatchCasesBlock] + // CHECK:STDERR: ╭─┤ fail_unexpected_tokens_in_cases_block.carbon:[[@LINE+7]]:5 + // CHECK:STDERR: -> │ if (true) { + // CHECK:STDERR: · ━┳ + // CHECK:STDERR: · ┗━━┫ error: unexpected `if`; expected `case`, `default` or `}` + // CHECK:STDERR: · ┃ [UnexpectedTokenInMatchCasesBlock] + // CHECK:STDERR: ╰──── // CHECK:STDERR: if (true) { return 2; } - // CHECK:STDERR: fail_unexpected_tokens_in_cases_block.carbon:[[@LINE+2]]:5-7: error: unexpected `var`; expected `case`, `default` or `}` [UnexpectedTokenInMatchCasesBlock] + // CHECK:STDERR: ╭─┤ fail_unexpected_tokens_in_cases_block.carbon:[[@LINE+7]]:5 + // CHECK:STDERR: -> │ var w + // CHECK:STDERR: · ━┳━ + // CHECK:STDERR: · ┗━━┫ error: unexpected `var`; expected `case`, `default` or `}` + // CHECK:STDERR: · ┃ [UnexpectedTokenInMatchCasesBlock] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var w case z: i32 if (z == 3) => { return 3; } - // CHECK:STDERR: fail_unexpected_tokens_in_cases_block.carbon:[[@LINE+2]]:5: error: unexpected `{`; expected `case`, `default` or `}` [UnexpectedTokenInMatchCasesBlock] + // CHECK:STDERR: ╭─┤ fail_unexpected_tokens_in_cases_block.carbon:[[@LINE+7]]:5 + // CHECK:STDERR: -> │ { + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: unexpected `{`; expected `case`, `default` or `}` + // CHECK:STDERR: · ┃ [UnexpectedTokenInMatchCasesBlock] + // CHECK:STDERR: ╰──── // CHECK:STDERR: { break; } default => { return 3; } - // CHECK:STDERR: fail_unexpected_tokens_in_cases_block.carbon:[[@LINE+2]]:5-10: error: unexpected `return`; expected `case`, `default` or `}` [UnexpectedTokenInMatchCasesBlock] + // CHECK:STDERR: ╭─┤ fail_unexpected_tokens_in_cases_block.carbon:[[@LINE+7]]:5 + // CHECK:STDERR: -> │ return 1; + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: unexpected `return`; expected `case`, `default` or `}` + // CHECK:STDERR: · ┃ [UnexpectedTokenInMatchCasesBlock] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return 1; - // CHECK:STDERR: fail_unexpected_tokens_in_cases_block.carbon:[[@LINE+2]]:5: error: unexpected `(`; expected `case`, `default` or `}` [UnexpectedTokenInMatchCasesBlock] + // CHECK:STDERR: ╭─┤ fail_unexpected_tokens_in_cases_block.carbon:[[@LINE+7]]:5 + // CHECK:STDERR: -> │ ((), (), ()) + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: unexpected `(`; expected `case`, `default` or `}` + // CHECK:STDERR: · ┃ [UnexpectedTokenInMatchCasesBlock] + // CHECK:STDERR: ╰──── // CHECK:STDERR: ((), (), ()) } diff --git a/toolchain/parse/testdata/member_access/fail_keyword.carbon b/toolchain/parse/testdata/member_access/fail_keyword.carbon index ed9fea35ff29..2ca865c6a7f7 100644 --- a/toolchain/parse/testdata/member_access/fail_keyword.carbon +++ b/toolchain/parse/testdata/member_access/fail_keyword.carbon @@ -9,22 +9,58 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/member_access/fail_keyword.carbon fn F() { - // CHECK:STDERR: fail_keyword.carbon:[[@LINE+2]]:5-8: error: expected identifier after `.`; prefix reserved word with `r#` to form a valid identifier [ExpectedIdentifierAfterPeriodOrArrow] + // CHECK:STDERR: ╭─┤ fail_keyword.carbon:[[@LINE+8]]:5 + // CHECK:STDERR: -> │ a.self; + // CHECK:STDERR: · ┳━━━ + // CHECK:STDERR: · ┗━━┫ error: expected identifier after `.`; prefix reserved word with `r#` to + // CHECK:STDERR: · ┃ form a valid identifier + // CHECK:STDERR: · ┃ [ExpectedIdentifierAfterPeriodOrArrow] + // CHECK:STDERR: ╰──── // CHECK:STDERR: a.self; - // CHECK:STDERR: fail_keyword.carbon:[[@LINE+2]]:5-8: error: expected identifier after `.`; prefix reserved word with `r#` to form a valid identifier [ExpectedIdentifierAfterPeriodOrArrow] + // CHECK:STDERR: ╭─┤ fail_keyword.carbon:[[@LINE+8]]:5 + // CHECK:STDERR: -> │ a.Self; + // CHECK:STDERR: · ┳━━━ + // CHECK:STDERR: · ┗━━┫ error: expected identifier after `.`; prefix reserved word with `r#` to + // CHECK:STDERR: · ┃ form a valid identifier + // CHECK:STDERR: · ┃ [ExpectedIdentifierAfterPeriodOrArrow] + // CHECK:STDERR: ╰──── // CHECK:STDERR: a.Self; - // CHECK:STDERR: fail_keyword.carbon:[[@LINE+2]]:5-7: error: expected identifier after `.`; prefix reserved word with `r#` to form a valid identifier [ExpectedIdentifierAfterPeriodOrArrow] + // CHECK:STDERR: ╭─┤ fail_keyword.carbon:[[@LINE+8]]:5 + // CHECK:STDERR: -> │ a.for; + // CHECK:STDERR: · ┳━━ + // CHECK:STDERR: · ┗━━┫ error: expected identifier after `.`; prefix reserved word with `r#` to + // CHECK:STDERR: · ┃ form a valid identifier + // CHECK:STDERR: · ┃ [ExpectedIdentifierAfterPeriodOrArrow] + // CHECK:STDERR: ╰──── // CHECK:STDERR: a.for; - // CHECK:STDERR: fail_keyword.carbon:[[@LINE+2]]:6-9: error: expected identifier after `->`; prefix reserved word with `r#` to form a valid identifier [ExpectedIdentifierAfterPeriodOrArrow] + // CHECK:STDERR: ╭─┤ fail_keyword.carbon:[[@LINE+8]]:6 + // CHECK:STDERR: -> │ p->self; + // CHECK:STDERR: · ┳━━━ + // CHECK:STDERR: · ┗━━┫ error: expected identifier after `->`; prefix reserved word with `r#` + // CHECK:STDERR: · ┃ to form a valid identifier + // CHECK:STDERR: · ┃ [ExpectedIdentifierAfterPeriodOrArrow] + // CHECK:STDERR: ╰──── // CHECK:STDERR: p->self; - // CHECK:STDERR: fail_keyword.carbon:[[@LINE+2]]:6-9: error: expected identifier after `->`; prefix reserved word with `r#` to form a valid identifier [ExpectedIdentifierAfterPeriodOrArrow] + // CHECK:STDERR: ╭─┤ fail_keyword.carbon:[[@LINE+8]]:6 + // CHECK:STDERR: -> │ p->Self; + // CHECK:STDERR: · ┳━━━ + // CHECK:STDERR: · ┗━━┫ error: expected identifier after `->`; prefix reserved word with `r#` + // CHECK:STDERR: · ┃ to form a valid identifier + // CHECK:STDERR: · ┃ [ExpectedIdentifierAfterPeriodOrArrow] + // CHECK:STDERR: ╰──── // CHECK:STDERR: p->Self; - // CHECK:STDERR: fail_keyword.carbon:[[@LINE+2]]:6-10: error: expected identifier after `->`; prefix reserved word with `r#` to form a valid identifier [ExpectedIdentifierAfterPeriodOrArrow] + // CHECK:STDERR: ╭─┤ fail_keyword.carbon:[[@LINE+8]]:6 + // CHECK:STDERR: -> │ p->while; + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: expected identifier after `->`; prefix reserved word with `r#` + // CHECK:STDERR: · ┃ to form a valid identifier + // CHECK:STDERR: · ┃ [ExpectedIdentifierAfterPeriodOrArrow] + // CHECK:STDERR: ╰──── // CHECK:STDERR: p->while; } diff --git a/toolchain/parse/testdata/namespace/fail_arrow.carbon b/toolchain/parse/testdata/namespace/fail_arrow.carbon index 2fc73826c808..b83ee21bae0e 100644 --- a/toolchain/parse/testdata/namespace/fail_arrow.carbon +++ b/toolchain/parse/testdata/namespace/fail_arrow.carbon @@ -10,7 +10,13 @@ namespace Foo; -// CHECK:STDERR: fail_arrow.carbon:[[@LINE+2]]:10: error: `class` declarations must either end with a `;` or have a `{ ... }` block for a definition [ExpectedDeclSemiOrDefinition] +// CHECK:STDERR: ╭─┤ fail_arrow.carbon:[[@LINE+8]]:10 +// CHECK:STDERR: -> │ class Foo->Bar {} +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `class` declarations must either end with a `;` or have a +// CHECK:STDERR: · ┃ `{ ... }` block for a definition +// CHECK:STDERR: · ┃ [ExpectedDeclSemiOrDefinition] +// CHECK:STDERR: ╰──── // CHECK:STDERR: class Foo->Bar {} diff --git a/toolchain/parse/testdata/namespace/fail_incomplete.carbon b/toolchain/parse/testdata/namespace/fail_incomplete.carbon index 468306b7104c..7f019751c907 100644 --- a/toolchain/parse/testdata/namespace/fail_incomplete.carbon +++ b/toolchain/parse/testdata/namespace/fail_incomplete.carbon @@ -8,27 +8,57 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/namespace/fail_incomplete.carbon -// CHECK:STDERR: fail_incomplete.carbon:[[@LINE+2]]:10: error: `namespace` introducer should be followed by a name [ExpectedDeclName] +// CHECK:STDERR: ╭─┤ fail_incomplete.carbon:[[@LINE+7]]:10 +// CHECK:STDERR: -> │ namespace 123 +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `namespace` introducer should be followed by a name +// CHECK:STDERR: · ┃ [ExpectedDeclName] +// CHECK:STDERR: ╰──── // CHECK:STDERR: namespace 123 -// CHECK:STDERR: fail_incomplete.carbon:[[@LINE+2]]:10: error: `namespace` introducer should be followed by a name [ExpectedDeclName] +// CHECK:STDERR: ╭─┤ fail_incomplete.carbon:[[@LINE+7]]:10 +// CHECK:STDERR: -> │ namespace "" +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `namespace` introducer should be followed by a name +// CHECK:STDERR: · ┃ [ExpectedDeclName] +// CHECK:STDERR: ╰──── // CHECK:STDERR: namespace "" -// CHECK:STDERR: fail_incomplete.carbon:[[@LINE+2]]:10: error: `namespace` introducer should be followed by a name [ExpectedDeclName] +// CHECK:STDERR: ╭─┤ fail_incomplete.carbon:[[@LINE+7]]:10 +// CHECK:STDERR: -> │ namespace + +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `namespace` introducer should be followed by a name +// CHECK:STDERR: · ┃ [ExpectedDeclName] +// CHECK:STDERR: ╰──── // CHECK:STDERR: namespace + -// CHECK:STDERR: fail_incomplete.carbon:[[@LINE+2]]:10: error: `namespace` introducer should be followed by a name [ExpectedDeclName] +// CHECK:STDERR: ╭─┤ fail_incomplete.carbon:[[@LINE+7]]:10 +// CHECK:STDERR: -> │ namespace bool +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `namespace` introducer should be followed by a name +// CHECK:STDERR: · ┃ [ExpectedDeclName] +// CHECK:STDERR: ╰──── // CHECK:STDERR: namespace bool -// CHECK:STDERR: fail_incomplete.carbon:[[@LINE+2]]:10: error: `namespace` introducer should be followed by a name [ExpectedDeclName] +// CHECK:STDERR: ╭─┤ fail_incomplete.carbon:[[@LINE+7]]:10 +// CHECK:STDERR: -> │ namespace namespace namespace namespace namespace +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `namespace` introducer should be followed by a name +// CHECK:STDERR: · ┃ [ExpectedDeclName] +// CHECK:STDERR: ╰──── // CHECK:STDERR: namespace namespace namespace namespace namespace -// CHECK:STDERR: fail_incomplete.carbon:[[@LINE+2]]:10: error: `namespace` introducer should be followed by a name [ExpectedDeclName] +// CHECK:STDERR: ╭─┤ fail_incomplete.carbon:[[@LINE+7]]:10 +// CHECK:STDERR: -> │ namespace +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `namespace` introducer should be followed by a name +// CHECK:STDERR: · ┃ [ExpectedDeclName] +// CHECK:STDERR: ╰──── // CHECK:STDERR: namespace diff --git a/toolchain/parse/testdata/namespace/fail_incomplete_name.carbon b/toolchain/parse/testdata/namespace/fail_incomplete_name.carbon index cc8ebc0ced83..404cfd1b34bd 100644 --- a/toolchain/parse/testdata/namespace/fail_incomplete_name.carbon +++ b/toolchain/parse/testdata/namespace/fail_incomplete_name.carbon @@ -8,7 +8,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/namespace/fail_incomplete_name.carbon -// CHECK:STDERR: fail_incomplete_name.carbon:[[@LINE+2]]:15: error: `.` should be followed by a name [ExpectedDeclNameAfterPeriod] +// CHECK:STDERR: ╭─┤ fail_incomplete_name.carbon:[[@LINE+7]]:15 +// CHECK:STDERR: -> │ namespace Foo.; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `.` should be followed by a name +// CHECK:STDERR: · ┃ [ExpectedDeclNameAfterPeriod] +// CHECK:STDERR: ╰──── // CHECK:STDERR: namespace Foo.; diff --git a/toolchain/parse/testdata/namespace/fail_modifiers.carbon b/toolchain/parse/testdata/namespace/fail_modifiers.carbon index f50b0818612c..f3c288ae5721 100644 --- a/toolchain/parse/testdata/namespace/fail_modifiers.carbon +++ b/toolchain/parse/testdata/namespace/fail_modifiers.carbon @@ -8,7 +8,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/namespace/fail_modifiers.carbon -// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+2]]:20: error: `namespace` declarations must end with a `;` [ExpectedDeclSemi] +// CHECK:STDERR: ╭─┤ fail_modifiers.carbon:[[@LINE+7]]:20 +// CHECK:STDERR: -> │ virtual namespace B +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `namespace` declarations must end with a `;` +// CHECK:STDERR: · ┃ [ExpectedDeclSemi] +// CHECK:STDERR: ╰──── // CHECK:STDERR: virtual namespace B diff --git a/toolchain/parse/testdata/namespace/fail_no_name.carbon b/toolchain/parse/testdata/namespace/fail_no_name.carbon index 6907bd8d138a..7b7fd3b8f85f 100644 --- a/toolchain/parse/testdata/namespace/fail_no_name.carbon +++ b/toolchain/parse/testdata/namespace/fail_no_name.carbon @@ -8,7 +8,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/namespace/fail_no_name.carbon -// CHECK:STDERR: fail_no_name.carbon:[[@LINE+2]]:10: error: `namespace` introducer should be followed by a name [ExpectedDeclName] +// CHECK:STDERR: ╭─┤ fail_no_name.carbon:[[@LINE+7]]:10 +// CHECK:STDERR: -> │ namespace; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `namespace` introducer should be followed by a name +// CHECK:STDERR: · ┃ [ExpectedDeclName] +// CHECK:STDERR: ╰──── // CHECK:STDERR: namespace; diff --git a/toolchain/parse/testdata/observe/fail_invalid_operator.carbon b/toolchain/parse/testdata/observe/fail_invalid_operator.carbon index 5fea605d68ff..4fb9c9b2ccaf 100644 --- a/toolchain/parse/testdata/observe/fail_invalid_operator.carbon +++ b/toolchain/parse/testdata/observe/fail_invalid_operator.carbon @@ -8,7 +8,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/observe/fail_invalid_operator.carbon -// CHECK:STDERR: fail_invalid_operator.carbon:[[@LINE+2]]:10: error: observe should use `==` or `impls` operator [ExpectedObserveOperator] +// CHECK:STDERR: ╭─┤ fail_invalid_operator.carbon:[[@LINE+7]]:10 +// CHECK:STDERR: -> │ observe T = U impls I; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: observe should use `==` or `impls` operator +// CHECK:STDERR: · ┃ [ExpectedObserveOperator] +// CHECK:STDERR: ╰──── // CHECK:STDERR: observe T = U impls I; diff --git a/toolchain/parse/testdata/observe/fail_missing_expr.carbon b/toolchain/parse/testdata/observe/fail_missing_expr.carbon index 3b72a3314dc0..c9f0db3c2da0 100644 --- a/toolchain/parse/testdata/observe/fail_missing_expr.carbon +++ b/toolchain/parse/testdata/observe/fail_missing_expr.carbon @@ -10,19 +10,32 @@ // --- fail_missing_expr_after_observe.carbon -// CHECK:STDERR: fail_missing_expr_after_observe.carbon:[[@LINE+2]]:8: error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╭─┤ fail_missing_expr_after_observe.carbon:[[@LINE+6]]:8 +// CHECK:STDERR: -> │ observe impls I; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: observe impls I; // --- fail_missing_expr_after_impls.carbon -// CHECK:STDERR: fail_missing_expr_after_impls.carbon:[[@LINE+2]]:16: error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╭─┤ fail_missing_expr_after_impls.carbon:[[@LINE+6]]:16 +// CHECK:STDERR: -> │ observe T impls ; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: observe T impls ; // --- fail_missing_impls.carbon -// CHECK:STDERR: fail_missing_impls.carbon:[[@LINE+2]]:10: error: observe should use `==` or `impls` operator [ExpectedObserveOperator] +// CHECK:STDERR: ╭─┤ fail_missing_impls.carbon:[[@LINE+7]]:10 +// CHECK:STDERR: -> │ observe T ; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: observe should use `==` or `impls` operator +// CHECK:STDERR: · ┃ [ExpectedObserveOperator] +// CHECK:STDERR: ╰──── // CHECK:STDERR: observe T ; diff --git a/toolchain/parse/testdata/operators/fail_chained_assign.carbon b/toolchain/parse/testdata/operators/fail_chained_assign.carbon index a79136eda8c0..a88c9bc70aac 100644 --- a/toolchain/parse/testdata/operators/fail_chained_assign.carbon +++ b/toolchain/parse/testdata/operators/fail_chained_assign.carbon @@ -13,7 +13,12 @@ fn F() { var b: i32; // TODO: Produce a custom diagnostic for this. - // CHECK:STDERR: fail_chained_assign.carbon:[[@LINE+2]]:9: error: operator `=` can only be used as a complete statement [StatementOperatorAsSubExpr] + // CHECK:STDERR: ╭─┤ fail_chained_assign.carbon:[[@LINE+7]]:9 + // CHECK:STDERR: -> │ a = b = 1; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: operator `=` can only be used as a complete statement + // CHECK:STDERR: · ┃ [StatementOperatorAsSubExpr] + // CHECK:STDERR: ╰──── // CHECK:STDERR: a = b = 1; } diff --git a/toolchain/parse/testdata/operators/fail_infix_uneven_space_after.carbon b/toolchain/parse/testdata/operators/fail_infix_uneven_space_after.carbon index e7617aaa3a1c..599014a53d8b 100644 --- a/toolchain/parse/testdata/operators/fail_infix_uneven_space_after.carbon +++ b/toolchain/parse/testdata/operators/fail_infix_uneven_space_after.carbon @@ -10,7 +10,12 @@ // TODO: We could figure out that this first Failed example is infix // with one-token lookahead. -// CHECK:STDERR: fail_infix_uneven_space_after.carbon:[[@LINE+2]]:15: error: `var` declarations must end with a `;` [ExpectedDeclSemi] +// CHECK:STDERR: ╭─┤ fail_infix_uneven_space_after.carbon:[[@LINE+7]]:15 +// CHECK:STDERR: -> │ var n: i8 = n* n; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `var` declarations must end with a `;` +// CHECK:STDERR: · ┃ [ExpectedDeclSemi] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var n: i8 = n* n; diff --git a/toolchain/parse/testdata/operators/fail_infix_uneven_space_before.carbon b/toolchain/parse/testdata/operators/fail_infix_uneven_space_before.carbon index 98bef97b8c81..0c4984c96143 100644 --- a/toolchain/parse/testdata/operators/fail_infix_uneven_space_before.carbon +++ b/toolchain/parse/testdata/operators/fail_infix_uneven_space_before.carbon @@ -8,7 +8,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/fail_infix_uneven_space_before.carbon -// CHECK:STDERR: fail_infix_uneven_space_before.carbon:[[@LINE+2]]:16: error: whitespace missing after binary operator [BinaryOperatorRequiresWhitespace] +// CHECK:STDERR: ╭─┤ fail_infix_uneven_space_before.carbon:[[@LINE+7]]:16 +// CHECK:STDERR: -> │ var n: i8 = n *n; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: whitespace missing after binary operator +// CHECK:STDERR: · ┃ [BinaryOperatorRequiresWhitespace] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var n: i8 = n *n; diff --git a/toolchain/parse/testdata/operators/fail_invalid_infix.carbon b/toolchain/parse/testdata/operators/fail_invalid_infix.carbon index 9caff315a13e..56e0f995a705 100644 --- a/toolchain/parse/testdata/operators/fail_invalid_infix.carbon +++ b/toolchain/parse/testdata/operators/fail_invalid_infix.carbon @@ -8,15 +8,31 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/fail_invalid_infix.carbon -// CHECK:STDERR: fail_invalid_infix.carbon:[[@LINE+2]]:18: error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╭─┤ fail_invalid_infix.carbon:[[@LINE+6]]:18 +// CHECK:STDERR: -> │ var a: i32 = n == ; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var a: i32 = n == ; -// CHECK:STDERR: fail_invalid_infix.carbon:[[@LINE+2]]:13: error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╭─┤ fail_invalid_infix.carbon:[[@LINE+6]]:13 +// CHECK:STDERR: -> │ var b: i32 = == n; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var b: i32 = == n; -// CHECK:STDERR: fail_invalid_infix.carbon:[[@LINE+4]]:13: error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╭─┤ fail_invalid_infix.carbon:[[@LINE+12]]:13 +// CHECK:STDERR: -> │ var c: i32 = == ; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_invalid_infix.carbon:[[@LINE+2]]:16: error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╭─┤ fail_invalid_infix.carbon:[[@LINE+6]]:16 +// CHECK:STDERR: -> │ var c: i32 = == ; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var c: i32 = == ; diff --git a/toolchain/parse/testdata/operators/fail_postfix_space.carbon b/toolchain/parse/testdata/operators/fail_postfix_space.carbon index 067adfbb3be0..47747ea84826 100644 --- a/toolchain/parse/testdata/operators/fail_postfix_space.carbon +++ b/toolchain/parse/testdata/operators/fail_postfix_space.carbon @@ -8,7 +8,13 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/fail_postfix_space.carbon -// CHECK:STDERR: fail_postfix_space.carbon:[[@LINE+2]]:18: error: whitespace is not allowed before this unary operator [UnaryOperatorHasWhitespace] +// CHECK:STDERR: ╭─┤ fail_postfix_space.carbon:[[@LINE+8]]:18 +// CHECK:STDERR: -> │ var v: type = i8 *; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: whitespace is not allowed before this unary +// CHECK:STDERR: · ┃ operator +// CHECK:STDERR: · ┃ [UnaryOperatorHasWhitespace] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var v: type = i8 *; diff --git a/toolchain/parse/testdata/operators/fail_postfix_space_before_comma.carbon b/toolchain/parse/testdata/operators/fail_postfix_space_before_comma.carbon index 6b2f9ca32548..7b0ad72ea587 100644 --- a/toolchain/parse/testdata/operators/fail_postfix_space_before_comma.carbon +++ b/toolchain/parse/testdata/operators/fail_postfix_space_before_comma.carbon @@ -8,7 +8,13 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/fail_postfix_space_before_comma.carbon -// CHECK:STDERR: fail_postfix_space_before_comma.carbon:[[@LINE+2]]:18: error: whitespace is not allowed before this unary operator [UnaryOperatorHasWhitespace] +// CHECK:STDERR: ╭─┤ fail_postfix_space_before_comma.carbon:[[@LINE+8]]:18 +// CHECK:STDERR: -> │ var n: i8 = F(i8 *, 0); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: whitespace is not allowed before this unary +// CHECK:STDERR: · ┃ operator +// CHECK:STDERR: · ┃ [UnaryOperatorHasWhitespace] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var n: i8 = F(i8 *, 0); diff --git a/toolchain/parse/testdata/operators/fail_postfix_space_in_call.carbon b/toolchain/parse/testdata/operators/fail_postfix_space_in_call.carbon index d1dbcd1e0e08..2d56c7dee38e 100644 --- a/toolchain/parse/testdata/operators/fail_postfix_space_in_call.carbon +++ b/toolchain/parse/testdata/operators/fail_postfix_space_in_call.carbon @@ -8,7 +8,13 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/fail_postfix_space_in_call.carbon -// CHECK:STDERR: fail_postfix_space_in_call.carbon:[[@LINE+2]]:18: error: whitespace is not allowed before this unary operator [UnaryOperatorHasWhitespace] +// CHECK:STDERR: ╭─┤ fail_postfix_space_in_call.carbon:[[@LINE+8]]:18 +// CHECK:STDERR: -> │ var n: i8 = F(i8 *); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: whitespace is not allowed before this unary +// CHECK:STDERR: · ┃ operator +// CHECK:STDERR: · ┃ [UnaryOperatorHasWhitespace] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var n: i8 = F(i8 *); diff --git a/toolchain/parse/testdata/operators/fail_postfix_space_surrounding.carbon b/toolchain/parse/testdata/operators/fail_postfix_space_surrounding.carbon index 3551c3e4818e..746f53989384 100644 --- a/toolchain/parse/testdata/operators/fail_postfix_space_surrounding.carbon +++ b/toolchain/parse/testdata/operators/fail_postfix_space_surrounding.carbon @@ -8,7 +8,13 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/fail_postfix_space_surrounding.carbon -// CHECK:STDERR: fail_postfix_space_surrounding.carbon:[[@LINE+2]]:18: error: whitespace is not allowed before this unary operator [UnaryOperatorHasWhitespace] +// CHECK:STDERR: ╭─┤ fail_postfix_space_surrounding.carbon:[[@LINE+8]]:18 +// CHECK:STDERR: -> │ var v: type = i8 * ; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: whitespace is not allowed before this unary +// CHECK:STDERR: · ┃ operator +// CHECK:STDERR: · ┃ [UnaryOperatorHasWhitespace] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var v: type = i8 * ; diff --git a/toolchain/parse/testdata/operators/fail_postincrement.carbon b/toolchain/parse/testdata/operators/fail_postincrement.carbon index d62af9369b53..0728abbd028a 100644 --- a/toolchain/parse/testdata/operators/fail_postincrement.carbon +++ b/toolchain/parse/testdata/operators/fail_postincrement.carbon @@ -11,10 +11,18 @@ fn F() { var n: i32 = 0; // TODO: It'd be nice to produce a custom diagnostic here. - // CHECK:STDERR: fail_postincrement.carbon:[[@LINE+2]]:4: error: expected `;` after expression statement [ExpectedExprSemi] + // CHECK:STDERR: ╭─┤ fail_postincrement.carbon:[[@LINE+6]]:4 + // CHECK:STDERR: -> │ n++; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `;` after expression statement [ExpectedExprSemi] + // CHECK:STDERR: ╰──── // CHECK:STDERR: n++; - // CHECK:STDERR: fail_postincrement.carbon:[[@LINE+2]]:4: error: expected `;` after expression statement [ExpectedExprSemi] + // CHECK:STDERR: ╭─┤ fail_postincrement.carbon:[[@LINE+6]]:4 + // CHECK:STDERR: -> │ n--; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `;` after expression statement [ExpectedExprSemi] + // CHECK:STDERR: ╰──── // CHECK:STDERR: n--; } diff --git a/toolchain/parse/testdata/operators/fail_precedence_and_or.carbon b/toolchain/parse/testdata/operators/fail_precedence_and_or.carbon index 4ac0bc005325..943b21dba946 100644 --- a/toolchain/parse/testdata/operators/fail_precedence_and_or.carbon +++ b/toolchain/parse/testdata/operators/fail_precedence_and_or.carbon @@ -9,7 +9,13 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/fail_precedence_and_or.carbon fn F() { - // CHECK:STDERR: fail_precedence_and_or.carbon:[[@LINE+2]]:11-12: error: parentheses are required to disambiguate operator precedence [OperatorRequiresParentheses] + // CHECK:STDERR: ╭─┤ fail_precedence_and_or.carbon:[[@LINE+8]]:11 + // CHECK:STDERR: -> │ a and b or c; + // CHECK:STDERR: · ┳━ + // CHECK:STDERR: · ┗━━┫ error: parentheses are required to disambiguate operator + // CHECK:STDERR: · ┃ precedence + // CHECK:STDERR: · ┃ [OperatorRequiresParentheses] + // CHECK:STDERR: ╰──── // CHECK:STDERR: a and b or c; } diff --git a/toolchain/parse/testdata/operators/fail_precedence_as.carbon b/toolchain/parse/testdata/operators/fail_precedence_as.carbon index 3f3c4ba5f8e4..a84b4a35fa12 100644 --- a/toolchain/parse/testdata/operators/fail_precedence_as.carbon +++ b/toolchain/parse/testdata/operators/fail_precedence_as.carbon @@ -10,31 +10,71 @@ fn F(n: i32) { // No ordering between `not` and `as`. - // CHECK:STDERR: fail_precedence_as.carbon:[[@LINE+2]]:12-13: error: parentheses are required to disambiguate operator precedence [OperatorRequiresParentheses] + // CHECK:STDERR: ╭─┤ fail_precedence_as.carbon:[[@LINE+8]]:12 + // CHECK:STDERR: -> │ not true as bool; + // CHECK:STDERR: · ┳━ + // CHECK:STDERR: · ┗━━┫ error: parentheses are required to disambiguate operator + // CHECK:STDERR: · ┃ precedence + // CHECK:STDERR: · ┃ [OperatorRequiresParentheses] + // CHECK:STDERR: ╰──── // CHECK:STDERR: not true as bool; // No ordering between mathematical binary operators and `as`. - // CHECK:STDERR: fail_precedence_as.carbon:[[@LINE+2]]:9-10: error: parentheses are required to disambiguate operator precedence [OperatorRequiresParentheses] + // CHECK:STDERR: ╭─┤ fail_precedence_as.carbon:[[@LINE+7]]:9 + // CHECK:STDERR: -> │ 1 + 1 as i32; + // CHECK:STDERR: · ┳━ + // CHECK:STDERR: · ┗━━┫ error: parentheses are required to disambiguate operator precedence + // CHECK:STDERR: · ┃ [OperatorRequiresParentheses] + // CHECK:STDERR: ╰──── // CHECK:STDERR: 1 + 1 as i32; - // CHECK:STDERR: fail_precedence_as.carbon:[[@LINE+2]]:9-10: error: parentheses are required to disambiguate operator precedence [OperatorRequiresParentheses] + // CHECK:STDERR: ╭─┤ fail_precedence_as.carbon:[[@LINE+7]]:9 + // CHECK:STDERR: -> │ 5 % 2 as i32; + // CHECK:STDERR: · ┳━ + // CHECK:STDERR: · ┗━━┫ error: parentheses are required to disambiguate operator precedence + // CHECK:STDERR: · ┃ [OperatorRequiresParentheses] + // CHECK:STDERR: ╰──── // CHECK:STDERR: 5 % 2 as i32; // No ordering between logical binary operators and `as`. - // CHECK:STDERR: fail_precedence_as.carbon:[[@LINE+2]]:12-14: error: parentheses are required to disambiguate operator precedence [OperatorRequiresParentheses] + // CHECK:STDERR: ╭─┤ fail_precedence_as.carbon:[[@LINE+8]]:12 + // CHECK:STDERR: -> │ 3 as i32 and true; + // CHECK:STDERR: · ┳━━ + // CHECK:STDERR: · ┗━━┫ error: parentheses are required to disambiguate operator + // CHECK:STDERR: · ┃ precedence + // CHECK:STDERR: · ┃ [OperatorRequiresParentheses] + // CHECK:STDERR: ╰──── // CHECK:STDERR: 3 as i32 and true; - // CHECK:STDERR: fail_precedence_as.carbon:[[@LINE+2]]:14-15: error: parentheses are required to disambiguate operator precedence [OperatorRequiresParentheses] + // CHECK:STDERR: ╭─┤ fail_precedence_as.carbon:[[@LINE+8]]:14 + // CHECK:STDERR: -> │ false or 4 as i32; + // CHECK:STDERR: · ┳━ + // CHECK:STDERR: · ┗━━┫ error: parentheses are required to disambiguate operator + // CHECK:STDERR: · ┃ precedence + // CHECK:STDERR: · ┃ [OperatorRequiresParentheses] + // CHECK:STDERR: ╰──── // CHECK:STDERR: false or 4 as i32; // No ordering between relational binary operators and `as`. - // CHECK:STDERR: fail_precedence_as.carbon:[[@LINE+2]]:12-13: error: parentheses are required to disambiguate operator precedence [OperatorRequiresParentheses] + // CHECK:STDERR: ╭─┤ fail_precedence_as.carbon:[[@LINE+8]]:12 + // CHECK:STDERR: -> │ 6 as i32 == 7; + // CHECK:STDERR: · ┳━ + // CHECK:STDERR: · ┗━━┫ error: parentheses are required to disambiguate operator + // CHECK:STDERR: · ┃ precedence + // CHECK:STDERR: · ┃ [OperatorRequiresParentheses] + // CHECK:STDERR: ╰──── // CHECK:STDERR: 6 as i32 == 7; - // CHECK:STDERR: fail_precedence_as.carbon:[[@LINE+2]]:10-11: error: parentheses are required to disambiguate operator precedence [OperatorRequiresParentheses] + // CHECK:STDERR: ╭─┤ fail_precedence_as.carbon:[[@LINE+8]]:10 + // CHECK:STDERR: -> │ 8 <= 9 as i32; + // CHECK:STDERR: · ┳━ + // CHECK:STDERR: · ┗━━┫ error: parentheses are required to disambiguate operator + // CHECK:STDERR: · ┃ precedence + // CHECK:STDERR: · ┃ [OperatorRequiresParentheses] + // CHECK:STDERR: ╰──── // CHECK:STDERR: 8 <= 9 as i32; } diff --git a/toolchain/parse/testdata/operators/fail_precedence_assign.carbon b/toolchain/parse/testdata/operators/fail_precedence_assign.carbon index 2e70b7690607..2e97d00782bd 100644 --- a/toolchain/parse/testdata/operators/fail_precedence_assign.carbon +++ b/toolchain/parse/testdata/operators/fail_precedence_assign.carbon @@ -12,18 +12,42 @@ fn F() { var a: i32; // Assignment can only appear as an expression statement, not as a subexpression. // TODO: Produce the "can only be used as a complete statement" diagnostic in each of these cases. - // CHECK:STDERR: fail_precedence_assign.carbon:[[@LINE+2]]:9: error: expected `,` or `)` [UnexpectedTokenAfterListElement] + // CHECK:STDERR: ╭─┤ fail_precedence_assign.carbon:[[@LINE+6]]:9 + // CHECK:STDERR: -> │ 1 + (a = 1); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `,` or `)` [UnexpectedTokenAfterListElement] + // CHECK:STDERR: ╰──── // CHECK:STDERR: 1 + (a = 1); - // CHECK:STDERR: fail_precedence_assign.carbon:[[@LINE+4]]:18: error: expected `else` after `if ... then ...` [ExpectedElseAfterIf] + // CHECK:STDERR: ╭─┤ fail_precedence_assign.carbon:[[@LINE+14]]:18 + // CHECK:STDERR: -> │ (if true then a += 1 else a /= 2); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `else` after `if ... then ...` + // CHECK:STDERR: · ┃ [ExpectedElseAfterIf] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_precedence_assign.carbon:[[@LINE+2]]:18: error: expected `,` or `)` [UnexpectedTokenAfterListElement] + // CHECK:STDERR: ╭─┤ fail_precedence_assign.carbon:[[@LINE+7]]:18 + // CHECK:STDERR: -> │ (if true then a += 1 else a /= 2); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `,` or `)` + // CHECK:STDERR: · ┃ [UnexpectedTokenAfterListElement] + // CHECK:STDERR: ╰──── // CHECK:STDERR: (if true then a += 1 else a /= 2); - // CHECK:STDERR: fail_precedence_assign.carbon:[[@LINE+2]]:7-8: error: operator `++` can only be used as a complete statement [StatementOperatorAsSubExpr] + // CHECK:STDERR: ╭─┤ fail_precedence_assign.carbon:[[@LINE+7]]:7 + // CHECK:STDERR: -> │ a + ++a; + // CHECK:STDERR: · ━┳ + // CHECK:STDERR: · ┗━━┫ error: operator `++` can only be used as a complete statement + // CHECK:STDERR: · ┃ [StatementOperatorAsSubExpr] + // CHECK:STDERR: ╰──── // CHECK:STDERR: a + ++a; - // CHECK:STDERR: fail_precedence_assign.carbon:[[@LINE+2]]:5-6: error: parentheses are required around this unary `if` operator [UnaryOperatorRequiresParentheses] + // CHECK:STDERR: ╭─┤ fail_precedence_assign.carbon:[[@LINE+7]]:5 + // CHECK:STDERR: -> │ ++if c then a else b; + // CHECK:STDERR: · ━┳ + // CHECK:STDERR: · ┗━━┫ error: parentheses are required around this unary `if` operator + // CHECK:STDERR: · ┃ [UnaryOperatorRequiresParentheses] + // CHECK:STDERR: ╰──── // CHECK:STDERR: ++if c then a else b; } diff --git a/toolchain/parse/testdata/operators/fail_precedence_or_and.carbon b/toolchain/parse/testdata/operators/fail_precedence_or_and.carbon index 84a3a86e8a85..500b6e70ae2a 100644 --- a/toolchain/parse/testdata/operators/fail_precedence_or_and.carbon +++ b/toolchain/parse/testdata/operators/fail_precedence_or_and.carbon @@ -9,7 +9,13 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/fail_precedence_or_and.carbon fn F() { - // CHECK:STDERR: fail_precedence_or_and.carbon:[[@LINE+2]]:10-12: error: parentheses are required to disambiguate operator precedence [OperatorRequiresParentheses] + // CHECK:STDERR: ╭─┤ fail_precedence_or_and.carbon:[[@LINE+8]]:10 + // CHECK:STDERR: -> │ a or b and c; + // CHECK:STDERR: · ┳━━ + // CHECK:STDERR: · ┗━━┫ error: parentheses are required to disambiguate operator + // CHECK:STDERR: · ┃ precedence + // CHECK:STDERR: · ┃ [OperatorRequiresParentheses] + // CHECK:STDERR: ╰──── // CHECK:STDERR: a or b and c; } diff --git a/toolchain/parse/testdata/operators/fail_precedence_where.carbon b/toolchain/parse/testdata/operators/fail_precedence_where.carbon index 62060e529070..fc6e5bb6b22f 100644 --- a/toolchain/parse/testdata/operators/fail_precedence_where.carbon +++ b/toolchain/parse/testdata/operators/fail_precedence_where.carbon @@ -11,7 +11,13 @@ // --- fail_and_where.carbon fn AndWhere() { - // CHECK:STDERR: fail_and_where.carbon:[[@LINE+2]]:14-18: error: parentheses are required to disambiguate operator precedence [OperatorRequiresParentheses] + // CHECK:STDERR: ╭─┤ fail_and_where.carbon:[[@LINE+8]]:14 + // CHECK:STDERR: -> │ true and T where .A = B; + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: parentheses are required to disambiguate operator + // CHECK:STDERR: · ┃ precedence + // CHECK:STDERR: · ┃ [OperatorRequiresParentheses] + // CHECK:STDERR: ╰──── // CHECK:STDERR: true and T where .A = B; } @@ -19,7 +25,12 @@ fn AndWhere() { // --- fail_where_or.carbon fn WhereOr() { - // CHECK:STDERR: fail_where_or.carbon:[[@LINE+2]]:21: error: expected `;` after expression statement [ExpectedExprSemi] + // CHECK:STDERR: ╭─┤ fail_where_or.carbon:[[@LINE+7]]:21 + // CHECK:STDERR: -> │ U where .C impls D or false; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `;` after expression statement + // CHECK:STDERR: · ┃ [ExpectedExprSemi] + // CHECK:STDERR: ╰──── // CHECK:STDERR: U where .C impls D or false; } @@ -27,7 +38,13 @@ fn WhereOr() { // --- fail_equals_where.carbon fn EqualsWhere() { - // CHECK:STDERR: fail_equals_where.carbon:[[@LINE+2]]:10-14: error: parentheses are required to disambiguate operator precedence [OperatorRequiresParentheses] + // CHECK:STDERR: ╭─┤ fail_equals_where.carbon:[[@LINE+8]]:10 + // CHECK:STDERR: -> │ e == V where .G == f32; + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: parentheses are required to disambiguate operator + // CHECK:STDERR: · ┃ precedence + // CHECK:STDERR: · ┃ [OperatorRequiresParentheses] + // CHECK:STDERR: ╰──── // CHECK:STDERR: e == V where .G == f32; } @@ -35,7 +52,12 @@ fn EqualsWhere() { // --- fail_where_neq.carbon fn WhereNEq() { - // CHECK:STDERR: fail_where_neq.carbon:[[@LINE+2]]:20: error: expected `;` after expression statement [ExpectedExprSemi] + // CHECK:STDERR: ╭─┤ fail_where_neq.carbon:[[@LINE+7]]:20 + // CHECK:STDERR: -> │ W where .H = bool != i; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `;` after expression statement + // CHECK:STDERR: · ┃ [ExpectedExprSemi] + // CHECK:STDERR: ╰──── // CHECK:STDERR: W where .H = bool != i; } @@ -43,7 +65,12 @@ fn WhereNEq() { // --- fail_less_requirement.carbon fn LessRequirement() { - // CHECK:STDERR: fail_less_requirement.carbon:[[@LINE+2]]:13: error: requirement should use `impls`, `=`, or `==` operator [ExpectedRequirementOperator] + // CHECK:STDERR: ╭─┤ fail_less_requirement.carbon:[[@LINE+7]]:13 + // CHECK:STDERR: -> │ X where .J < .K; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: requirement should use `impls`, `=`, or `==` operator + // CHECK:STDERR: · ┃ [ExpectedRequirementOperator] + // CHECK:STDERR: ╰──── // CHECK:STDERR: X where .J < .K; } @@ -51,7 +78,13 @@ fn LessRequirement() { // --- fail_as_where.carbon fn AsWhere() { - // CHECK:STDERR: fail_as_where.carbon:[[@LINE+2]]:10-14: error: parentheses are required to disambiguate operator precedence [OperatorRequiresParentheses] + // CHECK:STDERR: ╭─┤ fail_as_where.carbon:[[@LINE+8]]:10 + // CHECK:STDERR: -> │ Y as Z where .L impls M; + // CHECK:STDERR: · ┳━━━━ + // CHECK:STDERR: · ┗━━┫ error: parentheses are required to disambiguate operator + // CHECK:STDERR: · ┃ precedence + // CHECK:STDERR: · ┃ [OperatorRequiresParentheses] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Y as Z where .L impls M; } @@ -59,7 +92,12 @@ fn AsWhere() { // --- fail_where_as.carbon fn WhereAs() { - // CHECK:STDERR: fail_where_as.carbon:[[@LINE+2]]:20: error: expected `;` after expression statement [ExpectedExprSemi] + // CHECK:STDERR: ╭─┤ fail_where_as.carbon:[[@LINE+7]]:20 + // CHECK:STDERR: -> │ S where .N == i32 as type; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `;` after expression statement + // CHECK:STDERR: · ┃ [ExpectedExprSemi] + // CHECK:STDERR: ╰──── // CHECK:STDERR: S where .N == i32 as type; } @@ -67,7 +105,12 @@ fn WhereAs() { // --- fail_as_in_argument.carbon fn AsInArgument() { - // CHECK:STDERR: fail_as_in_argument.carbon:[[@LINE+2]]:13: error: requirement should use `impls`, `=`, or `==` operator [ExpectedRequirementOperator] + // CHECK:STDERR: ╭─┤ fail_as_in_argument.carbon:[[@LINE+7]]:13 + // CHECK:STDERR: -> │ R where .O as type impls P; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: requirement should use `impls`, `=`, or `==` operator + // CHECK:STDERR: · ┃ [ExpectedRequirementOperator] + // CHECK:STDERR: ╰──── // CHECK:STDERR: R where .O as type impls P; } @@ -75,7 +118,12 @@ fn AsInArgument() { // --- fail_greater_in_argument.carbon fn GreaterInArgument() { - // CHECK:STDERR: fail_greater_in_argument.carbon:[[@LINE+2]]:14: error: requirement should use `impls`, `=`, or `==` operator [ExpectedRequirementOperator] + // CHECK:STDERR: ╭─┤ fail_greater_in_argument.carbon:[[@LINE+7]]:14 + // CHECK:STDERR: -> │ Q where .AA > .BB impls CC; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: requirement should use `impls`, `=`, or `==` operator + // CHECK:STDERR: · ┃ [ExpectedRequirementOperator] + // CHECK:STDERR: ╰──── // CHECK:STDERR: Q where .AA > .BB impls CC; } diff --git a/toolchain/parse/testdata/operators/fail_prefix_repeat.carbon b/toolchain/parse/testdata/operators/fail_prefix_repeat.carbon index 8a97f6138e1e..fd76fa783569 100644 --- a/toolchain/parse/testdata/operators/fail_prefix_repeat.carbon +++ b/toolchain/parse/testdata/operators/fail_prefix_repeat.carbon @@ -8,7 +8,13 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/fail_prefix_repeat.carbon -// CHECK:STDERR: fail_prefix_repeat.carbon:[[@LINE+2]]:17-21: error: parentheses are required around this unary `const` operator [UnaryOperatorRequiresParentheses] +// CHECK:STDERR: ╭─┤ fail_prefix_repeat.carbon:[[@LINE+8]]:17 +// CHECK:STDERR: -> │ fn F() -> const const i32* { +// CHECK:STDERR: · ┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: parentheses are required around this unary `const` +// CHECK:STDERR: · ┃ operator +// CHECK:STDERR: · ┃ [UnaryOperatorRequiresParentheses] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F() -> const const i32* { } diff --git a/toolchain/parse/testdata/operators/fail_prefix_space.carbon b/toolchain/parse/testdata/operators/fail_prefix_space.carbon index 32725d3ac396..9df6700c69a5 100644 --- a/toolchain/parse/testdata/operators/fail_prefix_space.carbon +++ b/toolchain/parse/testdata/operators/fail_prefix_space.carbon @@ -8,7 +8,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/fail_prefix_space.carbon -// CHECK:STDERR: fail_prefix_space.carbon:[[@LINE+2]]:13: error: whitespace is not allowed after this unary operator [UnaryOperatorHasWhitespace] +// CHECK:STDERR: ╭─┤ fail_prefix_space.carbon:[[@LINE+7]]:13 +// CHECK:STDERR: -> │ var n: i8 = - n; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: whitespace is not allowed after this unary operator +// CHECK:STDERR: · ┃ [UnaryOperatorHasWhitespace] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var n: i8 = - n; diff --git a/toolchain/parse/testdata/operators/fail_prefix_uneven_space_with_assign.carbon b/toolchain/parse/testdata/operators/fail_prefix_uneven_space_with_assign.carbon index 31907710d9d5..83dde25d5878 100644 --- a/toolchain/parse/testdata/operators/fail_prefix_uneven_space_with_assign.carbon +++ b/toolchain/parse/testdata/operators/fail_prefix_uneven_space_with_assign.carbon @@ -8,7 +8,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/fail_prefix_uneven_space_with_assign.carbon -// CHECK:STDERR: fail_prefix_uneven_space_with_assign.carbon:[[@LINE+2]]:12: error: whitespace is not allowed after this unary operator [UnaryOperatorHasWhitespace] +// CHECK:STDERR: ╭─┤ fail_prefix_uneven_space_with_assign.carbon:[[@LINE+7]]:12 +// CHECK:STDERR: -> │ var n: i8 =- n; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: whitespace is not allowed after this unary operator +// CHECK:STDERR: · ┃ [UnaryOperatorHasWhitespace] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var n: i8 =- n; diff --git a/toolchain/parse/testdata/operators/fail_star_minus.carbon b/toolchain/parse/testdata/operators/fail_star_minus.carbon index 0018039ea59c..021f215afd2f 100644 --- a/toolchain/parse/testdata/operators/fail_star_minus.carbon +++ b/toolchain/parse/testdata/operators/fail_star_minus.carbon @@ -13,7 +13,12 @@ // available because it has already accepted that first part of the expression, // so it is recovering by using the second option, but the diagnostic should // ideally offer (or consider) both fixes as alternatives. -// CHECK:STDERR: fail_star_minus.carbon:[[@LINE+2]]:17: error: whitespace missing after binary operator [BinaryOperatorRequiresWhitespace] +// CHECK:STDERR: ╭─┤ fail_star_minus.carbon:[[@LINE+7]]:17 +// CHECK:STDERR: -> │ var n: i8 = n* -n; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: whitespace missing after binary operator +// CHECK:STDERR: · ┃ [BinaryOperatorRequiresWhitespace] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var n: i8 = n* -n; diff --git a/toolchain/parse/testdata/operators/fail_star_star.carbon b/toolchain/parse/testdata/operators/fail_star_star.carbon index 5b734130a8fa..c6616ae40b62 100644 --- a/toolchain/parse/testdata/operators/fail_star_star.carbon +++ b/toolchain/parse/testdata/operators/fail_star_star.carbon @@ -8,7 +8,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/fail_star_star.carbon -// CHECK:STDERR: fail_star_star.carbon:[[@LINE+2]]:17: error: whitespace missing after binary operator [BinaryOperatorRequiresWhitespace] +// CHECK:STDERR: ╭─┤ fail_star_star.carbon:[[@LINE+7]]:17 +// CHECK:STDERR: -> │ var n: i8 = n* *p; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: whitespace missing after binary operator +// CHECK:STDERR: · ┃ [BinaryOperatorRequiresWhitespace] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var n: i8 = n* *p; diff --git a/toolchain/parse/testdata/operators/fail_star_star_no_space.carbon b/toolchain/parse/testdata/operators/fail_star_star_no_space.carbon index ff028bdb49b4..7803cbcc89ac 100644 --- a/toolchain/parse/testdata/operators/fail_star_star_no_space.carbon +++ b/toolchain/parse/testdata/operators/fail_star_star_no_space.carbon @@ -12,7 +12,12 @@ // before we notice the missing whitespace around the second `*`. // It'd be better to (somehow) form n*(*p) and reject due to the missing // whitespace around the first `*`. -// CHECK:STDERR: fail_star_star_no_space.carbon:[[@LINE+2]]:16: error: `var` declarations must end with a `;` [ExpectedDeclSemi] +// CHECK:STDERR: ╭─┤ fail_star_star_no_space.carbon:[[@LINE+7]]:16 +// CHECK:STDERR: -> │ var n: i8 = n**p; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `var` declarations must end with a `;` +// CHECK:STDERR: · ┃ [ExpectedDeclSemi] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var n: i8 = n**p; diff --git a/toolchain/parse/testdata/operators/fail_variety.carbon b/toolchain/parse/testdata/operators/fail_variety.carbon index 7bf886fd26bd..c4b3ce48e0cb 100644 --- a/toolchain/parse/testdata/operators/fail_variety.carbon +++ b/toolchain/parse/testdata/operators/fail_variety.carbon @@ -9,15 +9,47 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/fail_variety.carbon fn F() { - // CHECK:STDERR: fail_variety.carbon:[[@LINE+10]]:21: error: operator `=` can only be used as a complete statement [StatementOperatorAsSubExpr] + // CHECK:STDERR: ╭─┤ fail_variety.carbon:[[@LINE+42]]:21 + // CHECK:STDERR: -> │ n = a * b + c * d = d * d << e & f - not g; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: operator `=` can only be used as a complete + // CHECK:STDERR: · ┃ statement + // CHECK:STDERR: · ┃ [StatementOperatorAsSubExpr] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_variety.carbon:[[@LINE+8]]:29-30: error: parentheses are required to disambiguate operator precedence [OperatorRequiresParentheses] + // CHECK:STDERR: ╭─┤ fail_variety.carbon:[[@LINE+34]]:29 + // CHECK:STDERR: -> │ n = a * b + c * d = d * d << e & f - not g; + // CHECK:STDERR: · ┳━ + // CHECK:STDERR: · ┗━━┫ error: parentheses are required to disambiguate + // CHECK:STDERR: · ┃ operator precedence + // CHECK:STDERR: · ┃ [OperatorRequiresParentheses] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_variety.carbon:[[@LINE+6]]:34: error: parentheses are required to disambiguate operator precedence [OperatorRequiresParentheses] + // CHECK:STDERR: ╭─┤ fail_variety.carbon:[[@LINE+26]]:34 + // CHECK:STDERR: -> │ n = a * b + c * d = d * d << e & f - not g; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: parentheses are required to + // CHECK:STDERR: · ┃ disambiguate operator precedence + // CHECK:STDERR: · ┃ [OperatorRequiresParentheses] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_variety.carbon:[[@LINE+4]]:38: error: parentheses are required to disambiguate operator precedence [OperatorRequiresParentheses] + // CHECK:STDERR: ╭─┤ fail_variety.carbon:[[@LINE+18]]:38 + // CHECK:STDERR: -> │ n = a * b + c * d = d * d << e & f - not g; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: parentheses are required to + // CHECK:STDERR: · ┃ disambiguate operator + // CHECK:STDERR: · ┃ precedence + // CHECK:STDERR: · ┃ [OperatorRequiresParentheses] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_variety.carbon:[[@LINE+2]]:40-42: error: parentheses are required around this unary `not` operator [UnaryOperatorRequiresParentheses] + // CHECK:STDERR: ╭─┤ fail_variety.carbon:[[@LINE+9]]:40 + // CHECK:STDERR: -> │ n = a * b + c * d = d * d << e & f - not g; + // CHECK:STDERR: · ┳━━ + // CHECK:STDERR: · ┗━━┫ error: parentheses are required + // CHECK:STDERR: · ┃ around this unary `not` + // CHECK:STDERR: · ┃ operator + // CHECK:STDERR: · ┃ [UnaryOperatorRequiresParentheses] + // CHECK:STDERR: ╰──── // CHECK:STDERR: n = a * b + c * d = d * d << e & f - not g; } diff --git a/toolchain/parse/testdata/operators/modifier.carbon b/toolchain/parse/testdata/operators/modifier.carbon index 374512b10bc2..143e1f60ba35 100644 --- a/toolchain/parse/testdata/operators/modifier.carbon +++ b/toolchain/parse/testdata/operators/modifier.carbon @@ -17,26 +17,55 @@ fn F() { // --- fail_invalid.carbon fn G() { - // CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:5-10: error: `unsafe` not allowed on operator `or` [ModifierNotAllowedOnOperator] + // CHECK:STDERR: ╭─┤ fail_invalid.carbon:[[@LINE+7]]:5 + // CHECK:STDERR: -> │ a unsafe or b; + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: `unsafe` not allowed on operator `or` + // CHECK:STDERR: · ┃ [ModifierNotAllowedOnOperator] + // CHECK:STDERR: ╰──── // CHECK:STDERR: a unsafe or b; - // CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:5-10: error: `unsafe` not allowed on operator `*` [ModifierNotAllowedOnOperator] + // CHECK:STDERR: ╭─┤ fail_invalid.carbon:[[@LINE+7]]:5 + // CHECK:STDERR: -> │ a unsafe * b; + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: `unsafe` not allowed on operator `*` + // CHECK:STDERR: · ┃ [ModifierNotAllowedOnOperator] + // CHECK:STDERR: ╰──── // CHECK:STDERR: a unsafe * b; - // CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:4: error: expected `;` after expression statement [ExpectedExprSemi] + // CHECK:STDERR: ╭─┤ fail_invalid.carbon:[[@LINE+6]]:4 + // CHECK:STDERR: -> │ a unsafe; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `;` after expression statement [ExpectedExprSemi] + // CHECK:STDERR: ╰──── // CHECK:STDERR: a unsafe; - // CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:3-8: error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╭─┤ fail_invalid.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ unsafe; + // CHECK:STDERR: · ━━━┳━━ + // CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╰──── // CHECK:STDERR: unsafe; // TODO: It'd be nice to underline both tokens in `unsafe as` here. - // CHECK:STDERR: fail_invalid.carbon:[[@LINE+4]]:9-14: error: parentheses are required to disambiguate operator precedence [OperatorRequiresParentheses] + // CHECK:STDERR: ╭─┤ fail_invalid.carbon:[[@LINE+15]]:9 + // CHECK:STDERR: -> │ a + b unsafe as c * d; + // CHECK:STDERR: · ┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: parentheses are required to disambiguate operator precedence + // CHECK:STDERR: · ┃ [OperatorRequiresParentheses] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:21: error: parentheses are required to disambiguate operator precedence [OperatorRequiresParentheses] + // CHECK:STDERR: ╭─┤ fail_invalid.carbon:[[@LINE+8]]:21 + // CHECK:STDERR: -> │ a + b unsafe as c * d; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: parentheses are required to disambiguate + // CHECK:STDERR: · ┃ operator precedence + // CHECK:STDERR: · ┃ [OperatorRequiresParentheses] + // CHECK:STDERR: ╰──── // CHECK:STDERR: a + b unsafe as c * d; } diff --git a/toolchain/parse/testdata/operators/ref.carbon b/toolchain/parse/testdata/operators/ref.carbon index 595893e8b331..a8761849b55e 100644 --- a/toolchain/parse/testdata/operators/ref.carbon +++ b/toolchain/parse/testdata/operators/ref.carbon @@ -14,7 +14,13 @@ var x: i32 = ref y as i32; // --- fail_if_ref.carbon -// CHECK:STDERR: fail_if_ref.carbon:[[@LINE+2]]:18-19: error: parentheses are required around this unary `if` operator [UnaryOperatorRequiresParentheses] +// CHECK:STDERR: ╭─┤ fail_if_ref.carbon:[[@LINE+8]]:18 +// CHECK:STDERR: -> │ var x: i32 = ref if b then c else d; +// CHECK:STDERR: · ┳━ +// CHECK:STDERR: · ┗━━┫ error: parentheses are required around this unary `if` +// CHECK:STDERR: · ┃ operator +// CHECK:STDERR: · ┃ [UnaryOperatorRequiresParentheses] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: i32 = ref if b then c else d; var x: i32 = ref (if b then c else d); diff --git a/toolchain/parse/testdata/operators/unary.carbon b/toolchain/parse/testdata/operators/unary.carbon index d90efdd7df21..2ce11490a5a7 100644 --- a/toolchain/parse/testdata/operators/unary.carbon +++ b/toolchain/parse/testdata/operators/unary.carbon @@ -11,7 +11,12 @@ // --- fail_space_before.carbon fn F() { - // CHECK:STDERR: fail_space_before.carbon:[[@LINE+2]]:16: error: whitespace is required before this unary operator [UnaryOperatorRequiresWhitespace] + // CHECK:STDERR: ╭─┤ fail_space_before.carbon:[[@LINE+7]]:16 + // CHECK:STDERR: -> │ if (false) {}--0; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: whitespace is required before this unary operator + // CHECK:STDERR: · ┃ [UnaryOperatorRequiresWhitespace] + // CHECK:STDERR: ╰──── // CHECK:STDERR: if (false) {}--0; } diff --git a/toolchain/parse/testdata/package_expr/fail_in_name.carbon b/toolchain/parse/testdata/package_expr/fail_in_name.carbon index 6806f4473551..09a01d236b86 100644 --- a/toolchain/parse/testdata/package_expr/fail_in_name.carbon +++ b/toolchain/parse/testdata/package_expr/fail_in_name.carbon @@ -8,22 +8,50 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/package_expr/fail_in_name.carbon -// CHECK:STDERR: fail_in_name.carbon:[[@LINE+2]]:5-13: error: unexpected expression before `:` in binding pattern [ExpectedBindingName] +// CHECK:STDERR: ╭─┤ fail_in_name.carbon:[[@LINE+7]]:5 +// CHECK:STDERR: -> │ var package.n: i32; +// CHECK:STDERR: · ━━━━┳━━━━ +// CHECK:STDERR: · ┗━━┫ error: unexpected expression before `:` in binding pattern +// CHECK:STDERR: · ┃ [ExpectedBindingName] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var package.n: i32; // `val` is a keyword, but during error recovery we treat it as an identifier. -// CHECK:STDERR: fail_in_name.carbon:[[@LINE+4]]:13-15: error: expected identifier after `.`; prefix reserved word with `r#` to form a valid identifier [ExpectedIdentifierAfterPeriodOrArrow] +// CHECK:STDERR: ╭─┤ fail_in_name.carbon:[[@LINE+15]]:13 +// CHECK:STDERR: -> │ var package.val: i32; +// CHECK:STDERR: · ┳━━ +// CHECK:STDERR: · ┗━━┫ error: expected identifier after `.`; prefix reserved word with +// CHECK:STDERR: · ┃ `r#` to form a valid identifier +// CHECK:STDERR: · ┃ [ExpectedIdentifierAfterPeriodOrArrow] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_in_name.carbon:[[@LINE+2]]:5-15: error: unexpected expression before `:` in binding pattern [ExpectedBindingName] +// CHECK:STDERR: ╭─┤ fail_in_name.carbon:[[@LINE+7]]:5 +// CHECK:STDERR: -> │ var package.val: i32; +// CHECK:STDERR: · ━━━━━┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: unexpected expression before `:` in binding pattern +// CHECK:STDERR: · ┃ [ExpectedBindingName] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var package.val: i32; -// CHECK:STDERR: fail_in_name.carbon:[[@LINE+2]]:11-17: error: `namespace` introducer should be followed by a name; prefix reserved word with `r#` to form a valid identifier [ExpectedDeclName] +// CHECK:STDERR: ╭─┤ fail_in_name.carbon:[[@LINE+8]]:11 +// CHECK:STDERR: -> │ namespace package.NS; +// CHECK:STDERR: · ┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `namespace` introducer should be followed by a name; +// CHECK:STDERR: · ┃ prefix reserved word with `r#` to form a valid identifier +// CHECK:STDERR: · ┃ [ExpectedDeclName] +// CHECK:STDERR: ╰──── // CHECK:STDERR: namespace package.NS; -// CHECK:STDERR: fail_in_name.carbon:[[@LINE+2]]:7-13: error: `class` introducer should be followed by a name; prefix reserved word with `r#` to form a valid identifier [ExpectedDeclName] +// CHECK:STDERR: ╭─┤ fail_in_name.carbon:[[@LINE+8]]:7 +// CHECK:STDERR: -> │ class package.C { +// CHECK:STDERR: · ┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `class` introducer should be followed by a name; prefix +// CHECK:STDERR: · ┃ reserved word with `r#` to form a valid identifier +// CHECK:STDERR: · ┃ [ExpectedDeclName] +// CHECK:STDERR: ╰──── // CHECK:STDERR: class package.C { } diff --git a/toolchain/parse/testdata/package_expr/fail_standalone.carbon b/toolchain/parse/testdata/package_expr/fail_standalone.carbon index 26dd09b9b3bd..49c1dfc9f68e 100644 --- a/toolchain/parse/testdata/package_expr/fail_standalone.carbon +++ b/toolchain/parse/testdata/package_expr/fail_standalone.carbon @@ -9,7 +9,12 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/package_expr/fail_standalone.carbon fn F() { - // CHECK:STDERR: fail_standalone.carbon:[[@LINE+2]]:10: error: expected `.` after `package` expression [ExpectedPeriodAfterPackage] + // CHECK:STDERR: ╭─┤ fail_standalone.carbon:[[@LINE+7]]:10 + // CHECK:STDERR: -> │ package; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `.` after `package` expression + // CHECK:STDERR: · ┃ [ExpectedPeriodAfterPackage] + // CHECK:STDERR: ╰──── // CHECK:STDERR: package; } diff --git a/toolchain/parse/testdata/packages/export.carbon b/toolchain/parse/testdata/packages/export.carbon index 83de0ecdf73c..0aeab62a44e3 100644 --- a/toolchain/parse/testdata/packages/export.carbon +++ b/toolchain/parse/testdata/packages/export.carbon @@ -28,7 +28,12 @@ export Foo.Bar; package Pkg; -// CHECK:STDERR: fail_expr.carbon:[[@LINE+2]]:7: error: `export` introducer should be followed by a name [ExpectedDeclName] +// CHECK:STDERR: ╭─┤ fail_expr.carbon:[[@LINE+7]]:7 +// CHECK:STDERR: -> │ export (); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `export` introducer should be followed by a name +// CHECK:STDERR: · ┃ [ExpectedDeclName] +// CHECK:STDERR: ╰──── // CHECK:STDERR: export (); @@ -36,7 +41,13 @@ export (); package Pkg; -// CHECK:STDERR: fail_package_in_name.carbon:[[@LINE+2]]:8-14: error: `export` introducer should be followed by a name; prefix reserved word with `r#` to form a valid identifier [ExpectedDeclName] +// CHECK:STDERR: ╭─┤ fail_package_in_name.carbon:[[@LINE+8]]:8 +// CHECK:STDERR: -> │ export package.Bar; +// CHECK:STDERR: · ┳━━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `export` introducer should be followed by a name; prefix +// CHECK:STDERR: · ┃ reserved word with `r#` to form a valid identifier +// CHECK:STDERR: · ┃ [ExpectedDeclName] +// CHECK:STDERR: ╰──── // CHECK:STDERR: export package.Bar; @@ -44,7 +55,12 @@ export package.Bar; package Pkg; -// CHECK:STDERR: fail_keyword_only:[[@LINE+2]]:7: error: `export` introducer should be followed by a name [ExpectedDeclName] +// CHECK:STDERR: ╭─┤ fail_keyword_only:[[@LINE+7]]:7 +// CHECK:STDERR: -> │ export +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `export` introducer should be followed by a name +// CHECK:STDERR: · ┃ [ExpectedDeclName] +// CHECK:STDERR: ╰──── // CHECK:STDERR: export @@ -52,7 +68,12 @@ export package Pkg; -// CHECK:STDERR: fail_no_name.carbon:[[@LINE+2]]:7: error: `export` introducer should be followed by a name [ExpectedDeclName] +// CHECK:STDERR: ╭─┤ fail_no_name.carbon:[[@LINE+7]]:7 +// CHECK:STDERR: -> │ export ; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `export` introducer should be followed by a name +// CHECK:STDERR: · ┃ [ExpectedDeclName] +// CHECK:STDERR: ╰──── // CHECK:STDERR: export ; @@ -60,7 +81,12 @@ export ; package Pkg; -// CHECK:STDERR: fail_no_semi.carbon:[[@LINE+2]]:11: error: `export` declarations must end with a `;` [ExpectedDeclSemi] +// CHECK:STDERR: ╭─┤ fail_no_semi.carbon:[[@LINE+7]]:11 +// CHECK:STDERR: -> │ export Foo +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `export` declarations must end with a `;` +// CHECK:STDERR: · ┃ [ExpectedDeclSemi] +// CHECK:STDERR: ╰──── // CHECK:STDERR: export Foo @@ -68,7 +94,12 @@ export Foo package Pkg; -// CHECK:STDERR: fail_incomplete_qual_name.carbon:[[@LINE+2]]:12: error: `.` should be followed by a name [ExpectedDeclNameAfterPeriod] +// CHECK:STDERR: ╭─┤ fail_incomplete_qual_name.carbon:[[@LINE+7]]:12 +// CHECK:STDERR: -> │ export Foo.; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `.` should be followed by a name +// CHECK:STDERR: · ┃ [ExpectedDeclNameAfterPeriod] +// CHECK:STDERR: ╰──── // CHECK:STDERR: export Foo.; @@ -76,7 +107,12 @@ export Foo.; package Pkg; -// CHECK:STDERR: fail_incomplete_qual_name2.carbon:[[@LINE+2]]:7: error: `export` introducer should be followed by a name [ExpectedDeclName] +// CHECK:STDERR: ╭─┤ fail_incomplete_qual_name2.carbon:[[@LINE+7]]:7 +// CHECK:STDERR: -> │ export .Bar; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `export` introducer should be followed by a name +// CHECK:STDERR: · ┃ [ExpectedDeclName] +// CHECK:STDERR: ╰──── // CHECK:STDERR: export .Bar; @@ -94,14 +130,27 @@ package Pkg; export Foo; -// CHECK:STDERR: fail_before_import.carbon:[[@LINE+3]]:1-6: error: `import` declarations must come after the `package` declaration (if present) and before any other entities in the file [ImportTooLate] -// CHECK:STDERR: fail_before_import.carbon:[[@LINE-3]]:1-6: note: first declaration is here [FirstDecl] +// CHECK:STDERR: ╭─┤ fail_before_import.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: │ export Foo; +// CHECK:STDERR: · ───┬── +// CHECK:STDERR: · ╰──┤ first declaration is here [FirstDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ import library "lib"; +// CHECK:STDERR: · ┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `import` declarations must come after the `package` declaration (if +// CHECK:STDERR: · ┃ present) and before any other entities in the file +// CHECK:STDERR: · ┃ [ImportTooLate] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import library "lib"; // --- fail_in_default_library.carbon -// CHECK:STDERR: fail_in_default_library.carbon:[[@LINE+2]]:1-6: error: `export` is only allowed in API files [ExportFromImpl] +// CHECK:STDERR: ╭─┤ fail_in_default_library.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ export Foo; +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: `export` is only allowed in API files [ExportFromImpl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: export Foo; @@ -109,7 +158,11 @@ export Foo; impl package Pkg; -// CHECK:STDERR: fail_in_impl.carbon:[[@LINE+2]]:1-6: error: `export` is only allowed in API files [ExportFromImpl] +// CHECK:STDERR: ╭─┤ fail_in_impl.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ export Foo; +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: `export` is only allowed in API files [ExportFromImpl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: export Foo; diff --git a/toolchain/parse/testdata/packages/import/cpp_inline.carbon b/toolchain/parse/testdata/packages/import/cpp_inline.carbon index f0897ad4c2c2..bc6de20384f9 100644 --- a/toolchain/parse/testdata/packages/import/cpp_inline.carbon +++ b/toolchain/parse/testdata/packages/import/cpp_inline.carbon @@ -10,37 +10,72 @@ // --- fail_bad_syntax.carbon -// CHECK:STDERR: fail_bad_syntax.carbon:[[@LINE+2]]:18: error: expected string literal after `inline` [ExpectedStringAfterInline] +// CHECK:STDERR: ╭─┤ fail_bad_syntax.carbon:[[@LINE+7]]:18 +// CHECK:STDERR: -> │ import Cpp inline; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected string literal after `inline` +// CHECK:STDERR: · ┃ [ExpectedStringAfterInline] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import Cpp inline; -// CHECK:STDERR: fail_bad_syntax.carbon:[[@LINE+2]]:18: error: expected string literal after `inline` [ExpectedStringAfterInline] +// CHECK:STDERR: ╭─┤ fail_bad_syntax.carbon:[[@LINE+7]]:18 +// CHECK:STDERR: -> │ import Cpp inline library "foo.h"; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected string literal after `inline` +// CHECK:STDERR: · ┃ [ExpectedStringAfterInline] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import Cpp inline library "foo.h"; // TODO: We might want to allow this as a "preprocessed source" syntax. -// CHECK:STDERR: fail_bad_syntax.carbon:[[@LINE+2]]:27: error: `import` declarations must end with a `;` [ExpectedDeclSemi] +// CHECK:STDERR: ╭─┤ fail_bad_syntax.carbon:[[@LINE+7]]:27 +// CHECK:STDERR: -> │ import Cpp library "foo.h" inline "bar"; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `import` declarations must end with a `;` +// CHECK:STDERR: · ┃ [ExpectedDeclSemi] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import Cpp library "foo.h" inline "bar"; -// CHECK:STDERR: fail_bad_syntax.carbon:[[@LINE+2]]:23: error: `import` declarations must end with a `;` [ExpectedDeclSemi] +// CHECK:STDERR: ╭─┤ fail_bad_syntax.carbon:[[@LINE+7]]:23 +// CHECK:STDERR: -> │ import library "foo.h" inline "bar"; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `import` declarations must end with a `;` +// CHECK:STDERR: · ┃ [ExpectedDeclSemi] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import library "foo.h" inline "bar"; // --- fail_no_semi_at_eof.carbon -// CHECK:STDERR: fail_no_semi_at_eof.carbon:[[@LINE+2]]:18: error: expected string literal after `inline` [ExpectedStringAfterInline] +// CHECK:STDERR: ╭─┤ fail_no_semi_at_eof.carbon:[[@LINE+7]]:18 +// CHECK:STDERR: -> │ import Cpp inline +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected string literal after `inline` +// CHECK:STDERR: · ┃ [ExpectedStringAfterInline] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import Cpp inline // --- fail_package_inline.carbon -// CHECK:STDERR: fail_package_inline.carbon:[[@LINE+2]]:15: error: `package` declarations must end with a `;` [ExpectedDeclSemi] +// CHECK:STDERR: ╭─┤ fail_package_inline.carbon:[[@LINE+7]]:15 +// CHECK:STDERR: -> │ package NotCpp inline "int n;"; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `package` declarations must end with a `;` +// CHECK:STDERR: · ┃ [ExpectedDeclSemi] +// CHECK:STDERR: ╰──── // CHECK:STDERR: package NotCpp inline "int n;"; // --- fail_library_inline.carbon -// CHECK:STDERR: fail_library_inline.carbon:[[@LINE+2]]:16: error: `library` declarations must end with a `;` [ExpectedDeclSemi] +// CHECK:STDERR: ╭─┤ fail_library_inline.carbon:[[@LINE+7]]:16 +// CHECK:STDERR: -> │ library "foo.h" inline "int n;"; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `library` declarations must end with a `;` +// CHECK:STDERR: · ┃ [ExpectedDeclSemi] +// CHECK:STDERR: ╰──── // CHECK:STDERR: library "foo.h" inline "int n;"; @@ -66,11 +101,19 @@ int n; // --- fail_inline_cpp_syntax_errors.carbon -// CHECK:STDERR: fail_inline_cpp_syntax_errors.carbon:[[@LINE+2]]:7: error: expected `Cpp` after `inline` [ExpectedCppAfterInline] +// CHECK:STDERR: ╭─┤ fail_inline_cpp_syntax_errors.carbon:[[@LINE+6]]:7 +// CHECK:STDERR: -> │ inline; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `Cpp` after `inline` [ExpectedCppAfterInline] +// CHECK:STDERR: ╰──── // CHECK:STDERR: inline; -// CHECK:STDERR: fail_inline_cpp_syntax_errors.carbon:[[@LINE+2]]:7: error: expected `Cpp` after `inline` [ExpectedCppAfterInline] +// CHECK:STDERR: ╭─┤ fail_inline_cpp_syntax_errors.carbon:[[@LINE+6]]:7 +// CHECK:STDERR: -> │ inline ''' +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `Cpp` after `inline` [ExpectedCppAfterInline] +// CHECK:STDERR: ╰──── // CHECK:STDERR: inline ''' int n; @@ -78,17 +121,31 @@ int n; // Recovery skips to the `;` even when tokens follow the closing `'''` on its // line, so the `;` ends the declaration rather than starting an empty one. -// CHECK:STDERR: fail_inline_cpp_syntax_errors.carbon:[[@LINE+2]]:7: error: expected `Cpp` after `inline` [ExpectedCppAfterInline] +// CHECK:STDERR: ╭─┤ fail_inline_cpp_syntax_errors.carbon:[[@LINE+6]]:7 +// CHECK:STDERR: -> │ inline ''' +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `Cpp` after `inline` [ExpectedCppAfterInline] +// CHECK:STDERR: ╰──── // CHECK:STDERR: inline ''' int n; ''' + "more"; -// CHECK:STDERR: fail_inline_cpp_syntax_errors.carbon:[[@LINE+2]]:11: error: expected string literal after `inline Cpp` [ExpectedStringAfterInlineCpp] +// CHECK:STDERR: ╭─┤ fail_inline_cpp_syntax_errors.carbon:[[@LINE+7]]:11 +// CHECK:STDERR: -> │ inline Cpp; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected string literal after `inline Cpp` +// CHECK:STDERR: · ┃ [ExpectedStringAfterInlineCpp] +// CHECK:STDERR: ╰──── // CHECK:STDERR: inline Cpp; -// CHECK:STDERR: fail_inline_cpp_syntax_errors.carbon:[[@LINE+2]]:11: error: expected string literal after `inline Cpp` [ExpectedStringAfterInlineCpp] +// CHECK:STDERR: ╭─┤ fail_inline_cpp_syntax_errors.carbon:[[@LINE+7]]:11 +// CHECK:STDERR: -> │ inline Cpp x; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected string literal after `inline Cpp` +// CHECK:STDERR: · ┃ [ExpectedStringAfterInlineCpp] +// CHECK:STDERR: ╰──── // CHECK:STDERR: inline Cpp x; diff --git a/toolchain/parse/testdata/packages/import/export.carbon b/toolchain/parse/testdata/packages/import/export.carbon index b1414c15d38b..ec3ae0c0cf3d 100644 --- a/toolchain/parse/testdata/packages/import/export.carbon +++ b/toolchain/parse/testdata/packages/import/export.carbon @@ -12,7 +12,12 @@ package Pkg; -// CHECK:STDERR: fail_package.carbon:[[@LINE+2]]:1-6: error: `export` cannot be used when importing a package [ExportImportPackage] +// CHECK:STDERR: ╭─┤ fail_package.carbon:[[@LINE+7]]:1 +// CHECK:STDERR: -> │ export import Bar; +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: `export` cannot be used when importing a package +// CHECK:STDERR: · ┃ [ExportImportPackage] +// CHECK:STDERR: ╰──── // CHECK:STDERR: export import Bar; @@ -36,14 +41,27 @@ export import library "a"; class C; -// CHECK:STDERR: fail_order.carbon:[[@LINE+3]]:1-6: error: `import` declarations must come after the `package` declaration (if present) and before any other entities in the file [ImportTooLate] -// CHECK:STDERR: fail_order.carbon:[[@LINE-3]]:1-5: note: first declaration is here [FirstDecl] +// CHECK:STDERR: ╭─┤ fail_order.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: │ class C; +// CHECK:STDERR: · ──┬── +// CHECK:STDERR: · ╰──┤ first declaration is here [FirstDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ export import library "b"; +// CHECK:STDERR: · ┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `import` declarations must come after the `package` declaration (if +// CHECK:STDERR: · ┃ present) and before any other entities in the file +// CHECK:STDERR: · ┃ [ImportTooLate] +// CHECK:STDERR: ╰──── // CHECK:STDERR: export import library "b"; // --- fail_in_default_library.carbon -// CHECK:STDERR: fail_in_default_library.carbon:[[@LINE+2]]:1-6: error: `export` is only allowed in API files [ExportFromImpl] +// CHECK:STDERR: ╭─┤ fail_in_default_library.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ export import library "lib"; +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: `export` is only allowed in API files [ExportFromImpl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: export import library "lib"; @@ -51,7 +69,11 @@ export import library "lib"; impl package Pkg; -// CHECK:STDERR: fail_in_impl.carbon:[[@LINE+2]]:1-6: error: `export` is only allowed in API files [ExportFromImpl] +// CHECK:STDERR: ╭─┤ fail_in_impl.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ export import library "lib"; +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: `export` is only allowed in API files [ExportFromImpl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: export import library "lib"; diff --git a/toolchain/parse/testdata/packages/import/fail_after_decl.carbon b/toolchain/parse/testdata/packages/import/fail_after_decl.carbon index 2f74fa8a3151..57b2c18d9761 100644 --- a/toolchain/parse/testdata/packages/import/fail_after_decl.carbon +++ b/toolchain/parse/testdata/packages/import/fail_after_decl.carbon @@ -10,8 +10,17 @@ fn A(); -// CHECK:STDERR: fail_after_decl.carbon:[[@LINE+3]]:1-6: error: `import` declarations must come after the `package` declaration (if present) and before any other entities in the file [ImportTooLate] -// CHECK:STDERR: fail_after_decl.carbon:[[@LINE-3]]:1-2: note: first declaration is here [FirstDecl] +// CHECK:STDERR: ╭─┤ fail_after_decl.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: │ fn A(); +// CHECK:STDERR: · ─┬ +// CHECK:STDERR: · ╰──┤ first declaration is here [FirstDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ import B; +// CHECK:STDERR: · ┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `import` declarations must come after the `package` declaration (if +// CHECK:STDERR: · ┃ present) and before any other entities in the file +// CHECK:STDERR: · ┃ [ImportTooLate] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import B; diff --git a/toolchain/parse/testdata/packages/import/fail_after_decl_repeated.carbon b/toolchain/parse/testdata/packages/import/fail_after_decl_repeated.carbon index 67b08ebf7539..ae34637d14a1 100644 --- a/toolchain/parse/testdata/packages/import/fail_after_decl_repeated.carbon +++ b/toolchain/parse/testdata/packages/import/fail_after_decl_repeated.carbon @@ -10,22 +10,48 @@ fn A(); -// CHECK:STDERR: fail_after_decl_repeated.carbon:[[@LINE+3]]:1-6: error: `import` declarations must come after the `package` declaration (if present) and before any other entities in the file [ImportTooLate] -// CHECK:STDERR: fail_after_decl_repeated.carbon:[[@LINE-3]]:1-2: note: first declaration is here [FirstDecl] +// CHECK:STDERR: ╭─┤ fail_after_decl_repeated.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: │ fn A(); +// CHECK:STDERR: · ─┬ +// CHECK:STDERR: · ╰──┤ first declaration is here [FirstDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ import B; +// CHECK:STDERR: · ┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `import` declarations must come after the `package` declaration (if +// CHECK:STDERR: · ┃ present) and before any other entities in the file +// CHECK:STDERR: · ┃ [ImportTooLate] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import B; // Note this is still invalid, but doesn't warn because it's sequential. import C; -// CHECK:STDERR: fail_after_decl_repeated.carbon:[[@LINE+3]]:1-7: error: the `package` declaration must be the first non-comment line [PackageTooLate] -// CHECK:STDERR: fail_after_decl_repeated.carbon:[[@LINE-10]]:1-2: note: first non-comment line is here [FirstNonCommentLine] +// CHECK:STDERR: ╭─┤ fail_after_decl_repeated.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: │ fn A(); +// CHECK:STDERR: · ─┬ +// CHECK:STDERR: · ╰──┤ first non-comment line is here [FirstNonCommentLine] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ package D; +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: the `package` declaration must be the first non-comment line +// CHECK:STDERR: · ┃ [PackageTooLate] +// CHECK:STDERR: ╰──── // CHECK:STDERR: package D; fn E(); -// CHECK:STDERR: fail_after_decl_repeated.carbon:[[@LINE+3]]:1-6: error: `import` declarations must come after the `package` declaration (if present) and before any other entities in the file [ImportTooLate] -// CHECK:STDERR: fail_after_decl_repeated.carbon:[[@LINE-17]]:1-2: note: first declaration is here [FirstDecl] +// CHECK:STDERR: ╭─┤ fail_after_decl_repeated.carbon:[[@LINE+12]]:1 +// CHECK:STDERR: │ fn A(); +// CHECK:STDERR: · ─┬ +// CHECK:STDERR: · ╰──┤ first declaration is here [FirstDecl] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ import F; +// CHECK:STDERR: · ┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `import` declarations must come after the `package` declaration (if +// CHECK:STDERR: · ┃ present) and before any other entities in the file +// CHECK:STDERR: · ┃ [ImportTooLate] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import F; // Note this is still invalid, but doesn't warn because it's sequential. diff --git a/toolchain/parse/testdata/packages/import/fail_extra_string.carbon b/toolchain/parse/testdata/packages/import/fail_extra_string.carbon index c4fdb34572bf..1676c1242569 100644 --- a/toolchain/parse/testdata/packages/import/fail_extra_string.carbon +++ b/toolchain/parse/testdata/packages/import/fail_extra_string.carbon @@ -8,7 +8,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/import/fail_extra_string.carbon -// CHECK:STDERR: fail_extra_string.carbon:[[@LINE+2]]:25: error: `import` declarations must end with a `;` [ExpectedDeclSemi] +// CHECK:STDERR: ╭─┤ fail_extra_string.carbon:[[@LINE+7]]:25 +// CHECK:STDERR: -> │ import Foo library "bar" "baz"; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `import` declarations must end with a `;` +// CHECK:STDERR: · ┃ [ExpectedDeclSemi] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import Foo library "bar" "baz"; diff --git a/toolchain/parse/testdata/packages/import/fail_in_nested_scope.carbon b/toolchain/parse/testdata/packages/import/fail_in_nested_scope.carbon index febe4b0537ef..41117535caf7 100644 --- a/toolchain/parse/testdata/packages/import/fail_in_nested_scope.carbon +++ b/toolchain/parse/testdata/packages/import/fail_in_nested_scope.carbon @@ -9,15 +9,33 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/import/fail_in_nested_scope.carbon class A { - // CHECK:STDERR: fail_in_nested_scope.carbon:[[@LINE+3]]:3-8: error: `import` declarations must come after the `package` declaration (if present) and before any other entities in the file [ImportTooLate] - // CHECK:STDERR: fail_in_nested_scope.carbon:[[@LINE-2]]:1-5: note: first declaration is here [FirstDecl] + // CHECK:STDERR: ╭─┤ fail_in_nested_scope.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ class A { + // CHECK:STDERR: · ──┬── + // CHECK:STDERR: · ╰──┤ first declaration is here [FirstDecl] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ import B; + // CHECK:STDERR: · ┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: `import` declarations must come after the `package` declaration + // CHECK:STDERR: · ┃ (if present) and before any other entities in the file + // CHECK:STDERR: · ┃ [ImportTooLate] + // CHECK:STDERR: ╰──── // CHECK:STDERR: import B; } fn F() { - // CHECK:STDERR: fail_in_nested_scope.carbon:[[@LINE+3]]:3-8: error: `import` declarations must come after the `package` declaration (if present) and before any other entities in the file [ImportTooLate] - // CHECK:STDERR: fail_in_nested_scope.carbon:[[@LINE-9]]:1-5: note: first declaration is here [FirstDecl] + // CHECK:STDERR: ╭─┤ fail_in_nested_scope.carbon:[[@LINE+12]]:3 + // CHECK:STDERR: │ class A { + // CHECK:STDERR: · ──┬── + // CHECK:STDERR: · ╰──┤ first declaration is here [FirstDecl] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ import C; + // CHECK:STDERR: · ┳━━━━━ + // CHECK:STDERR: · ┗━━┫ error: `import` declarations must come after the `package` declaration + // CHECK:STDERR: · ┃ (if present) and before any other entities in the file + // CHECK:STDERR: · ┃ [ImportTooLate] + // CHECK:STDERR: ╰──── // CHECK:STDERR: import C; } diff --git a/toolchain/parse/testdata/packages/import/fail_inline_cpp_no_semi.carbon b/toolchain/parse/testdata/packages/import/fail_inline_cpp_no_semi.carbon index 3493419f9d20..7a72dba69d9c 100644 --- a/toolchain/parse/testdata/packages/import/fail_inline_cpp_no_semi.carbon +++ b/toolchain/parse/testdata/packages/import/fail_inline_cpp_no_semi.carbon @@ -15,7 +15,11 @@ int n; // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/packages/import/fail_inline_cpp_no_semi.carbon // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/import/fail_inline_cpp_no_semi.carbon -// CHECK:STDERR: fail_inline_cpp_no_semi.carbon:[[@LINE-10]]:4: error: `inline` declarations must end with a `;` [ExpectedDeclSemi] +// CHECK:STDERR: ╭─┤ fail_inline_cpp_no_semi.carbon:[[@LINE-10]]:4 +// CHECK:STDERR: -> │ ''' +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `inline` declarations must end with a `;` [ExpectedDeclSemi] +// CHECK:STDERR: ╰──── // CHECK:STDERR: // CHECK:STDOUT: - filename: fail_inline_cpp_no_semi.carbon diff --git a/toolchain/parse/testdata/packages/import/fail_library_is_identifier.carbon b/toolchain/parse/testdata/packages/import/fail_library_is_identifier.carbon index b69f0cd5de72..af2d5670dabf 100644 --- a/toolchain/parse/testdata/packages/import/fail_library_is_identifier.carbon +++ b/toolchain/parse/testdata/packages/import/fail_library_is_identifier.carbon @@ -8,7 +8,13 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/import/fail_library_is_identifier.carbon -// CHECK:STDERR: fail_library_is_identifier.carbon:[[@LINE+2]]:24: error: expected a string literal to specify the library name [ExpectedLibraryName] +// CHECK:STDERR: ╭─┤ fail_library_is_identifier.carbon:[[@LINE+8]]:24 +// CHECK:STDERR: -> │ import Geometry library Shapes; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected a string literal to specify the +// CHECK:STDERR: · ┃ library name +// CHECK:STDERR: · ┃ [ExpectedLibraryName] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import Geometry library Shapes; diff --git a/toolchain/parse/testdata/packages/import/fail_name_is_keyword.carbon b/toolchain/parse/testdata/packages/import/fail_name_is_keyword.carbon index ae1aa14b046f..7b1797a5756e 100644 --- a/toolchain/parse/testdata/packages/import/fail_name_is_keyword.carbon +++ b/toolchain/parse/testdata/packages/import/fail_name_is_keyword.carbon @@ -8,7 +8,13 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/import/fail_name_is_keyword.carbon -// CHECK:STDERR: fail_name_is_keyword.carbon:[[@LINE+2]]:8-9: error: expected identifier or `library` after `import`; prefix reserved word with `r#` to form a valid identifier [ExpectedIdentifierAfterImport] +// CHECK:STDERR: ╭─┤ fail_name_is_keyword.carbon:[[@LINE+8]]:8 +// CHECK:STDERR: -> │ import fn; +// CHECK:STDERR: · ┳━ +// CHECK:STDERR: · ┗━━┫ error: expected identifier or `library` after `import`; prefix +// CHECK:STDERR: · ┃ reserved word with `r#` to form a valid identifier +// CHECK:STDERR: · ┃ [ExpectedIdentifierAfterImport] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import fn; diff --git a/toolchain/parse/testdata/packages/import/fail_no_name.carbon b/toolchain/parse/testdata/packages/import/fail_no_name.carbon index 8a6ddfdb592e..b130a516dcf0 100644 --- a/toolchain/parse/testdata/packages/import/fail_no_name.carbon +++ b/toolchain/parse/testdata/packages/import/fail_no_name.carbon @@ -8,7 +8,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/import/fail_no_name.carbon -// CHECK:STDERR: fail_no_name.carbon:[[@LINE+2]]:7: error: expected identifier or `library` after `import` [ExpectedIdentifierAfterImport] +// CHECK:STDERR: ╭─┤ fail_no_name.carbon:[[@LINE+7]]:7 +// CHECK:STDERR: -> │ import; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected identifier or `library` after `import` +// CHECK:STDERR: · ┃ [ExpectedIdentifierAfterImport] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import; diff --git a/toolchain/parse/testdata/packages/import/fail_no_semi.carbon b/toolchain/parse/testdata/packages/import/fail_no_semi.carbon index d15fa62d2850..1089730e9f36 100644 --- a/toolchain/parse/testdata/packages/import/fail_no_semi.carbon +++ b/toolchain/parse/testdata/packages/import/fail_no_semi.carbon @@ -8,7 +8,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/import/fail_no_semi.carbon -// CHECK:STDERR: fail_no_semi.carbon:[[@LINE+2]]:16: error: `import` declarations must end with a `;` [ExpectedDeclSemi] +// CHECK:STDERR: ╭─┤ fail_no_semi.carbon:[[@LINE+7]]:16 +// CHECK:STDERR: -> │ import Geometry +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `import` declarations must end with a `;` +// CHECK:STDERR: · ┃ [ExpectedDeclSemi] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import Geometry diff --git a/toolchain/parse/testdata/packages/import/fail_omit_library_keyword.carbon b/toolchain/parse/testdata/packages/import/fail_omit_library_keyword.carbon index 477460d04ead..600127f654f8 100644 --- a/toolchain/parse/testdata/packages/import/fail_omit_library_keyword.carbon +++ b/toolchain/parse/testdata/packages/import/fail_omit_library_keyword.carbon @@ -8,7 +8,11 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/import/fail_omit_library_keyword.carbon -// CHECK:STDERR: fail_omit_library_keyword.carbon:[[@LINE+2]]:16: error: missing `library` keyword [MissingLibraryKeyword] +// CHECK:STDERR: ╭─┤ fail_omit_library_keyword.carbon:[[@LINE+6]]:16 +// CHECK:STDERR: -> │ import Geometry "Shapes"; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: missing `library` keyword [MissingLibraryKeyword] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import Geometry "Shapes"; diff --git a/toolchain/parse/testdata/packages/import/fail_type.carbon b/toolchain/parse/testdata/packages/import/fail_type.carbon index 60f636f3170c..e33af618f180 100644 --- a/toolchain/parse/testdata/packages/import/fail_type.carbon +++ b/toolchain/parse/testdata/packages/import/fail_type.carbon @@ -8,7 +8,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/import/fail_type.carbon -// CHECK:STDERR: fail_type.carbon:[[@LINE+2]]:16: error: `import` declarations must end with a `;` [ExpectedDeclSemi] +// CHECK:STDERR: ╭─┤ fail_type.carbon:[[@LINE+7]]:16 +// CHECK:STDERR: -> │ import Geometry api; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `import` declarations must end with a `;` +// CHECK:STDERR: · ┃ [ExpectedDeclSemi] +// CHECK:STDERR: ╰──── // CHECK:STDERR: import Geometry api; diff --git a/toolchain/parse/testdata/packages/library/fail_in_nested_scope.carbon b/toolchain/parse/testdata/packages/library/fail_in_nested_scope.carbon index 26cf6f8ed1be..368401619fd5 100644 --- a/toolchain/parse/testdata/packages/library/fail_in_nested_scope.carbon +++ b/toolchain/parse/testdata/packages/library/fail_in_nested_scope.carbon @@ -11,15 +11,31 @@ // api.carbon class C { - // CHECK:STDERR: fail_in_nested_scope.carbon:[[@LINE+3]]:3-9: error: the `library` declaration must be the first non-comment line [PackageTooLate] - // CHECK:STDERR: fail_in_nested_scope.carbon:[[@LINE-2]]:1-5: note: first non-comment line is here [FirstNonCommentLine] + // CHECK:STDERR: ╭─┤ fail_in_nested_scope.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ class C { + // CHECK:STDERR: · ──┬── + // CHECK:STDERR: · ╰──┤ first non-comment line is here [FirstNonCommentLine] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ library "foo"; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: the `library` declaration must be the first non-comment line + // CHECK:STDERR: · ┃ [PackageTooLate] + // CHECK:STDERR: ╰──── // CHECK:STDERR: library "foo"; } fn F() { - // CHECK:STDERR: fail_in_nested_scope.carbon:[[@LINE+3]]:3-9: error: the `library` declaration must be the first non-comment line [PackageTooLate] - // CHECK:STDERR: fail_in_nested_scope.carbon:[[@LINE-9]]:1-5: note: first non-comment line is here [FirstNonCommentLine] + // CHECK:STDERR: ╭─┤ fail_in_nested_scope.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ class C { + // CHECK:STDERR: · ──┬── + // CHECK:STDERR: · ╰──┤ first non-comment line is here [FirstNonCommentLine] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ library "foo"; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: the `library` declaration must be the first non-comment line + // CHECK:STDERR: · ┃ [PackageTooLate] + // CHECK:STDERR: ╰──── // CHECK:STDERR: library "foo"; } @@ -27,15 +43,31 @@ fn F() { // impl.carbon class C { - // CHECK:STDERR: fail_in_nested_scope.carbon:[[@LINE+3]]:3-6: error: the `library` declaration must be the first non-comment line [PackageTooLate] - // CHECK:STDERR: fail_in_nested_scope.carbon:[[@LINE-18]]:1-5: note: first non-comment line is here [FirstNonCommentLine] + // CHECK:STDERR: ╭─┤ fail_in_nested_scope.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ class C { + // CHECK:STDERR: · ──┬── + // CHECK:STDERR: · ╰──┤ first non-comment line is here [FirstNonCommentLine] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ impl library "foo"; + // CHECK:STDERR: · ━━┳━ + // CHECK:STDERR: · ┗━━┫ error: the `library` declaration must be the first non-comment line + // CHECK:STDERR: · ┃ [PackageTooLate] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl library "foo"; } fn F() { - // CHECK:STDERR: fail_in_nested_scope.carbon:[[@LINE+3]]:3-6: error: the `library` declaration must be the first non-comment line [PackageTooLate] - // CHECK:STDERR: fail_in_nested_scope.carbon:[[@LINE-25]]:1-5: note: first non-comment line is here [FirstNonCommentLine] + // CHECK:STDERR: ╭─┤ fail_in_nested_scope.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ class C { + // CHECK:STDERR: · ──┬── + // CHECK:STDERR: · ╰──┤ first non-comment line is here [FirstNonCommentLine] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ impl library "foo"; + // CHECK:STDERR: · ━━┳━ + // CHECK:STDERR: · ┗━━┫ error: the `library` declaration must be the first non-comment line + // CHECK:STDERR: · ┃ [PackageTooLate] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl library "foo"; } diff --git a/toolchain/parse/testdata/packages/library/fail_invalid_name.carbon b/toolchain/parse/testdata/packages/library/fail_invalid_name.carbon index 7bc11e2f2801..53aa7fae7a65 100644 --- a/toolchain/parse/testdata/packages/library/fail_invalid_name.carbon +++ b/toolchain/parse/testdata/packages/library/fail_invalid_name.carbon @@ -10,37 +10,71 @@ // --- fail_identifier.carbon -// CHECK:STDERR: fail_identifier.carbon:[[@LINE+2]]:8: error: expected `default` or a string literal to specify the library name [ExpectedLibraryNameOrDefault] +// CHECK:STDERR: ╭─┤ fail_identifier.carbon:[[@LINE+8]]:8 +// CHECK:STDERR: -> │ library Shapes; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `default` or a string literal to specify the library +// CHECK:STDERR: · ┃ name +// CHECK:STDERR: · ┃ [ExpectedLibraryNameOrDefault] +// CHECK:STDERR: ╰──── // CHECK:STDERR: library Shapes; // --- fail_raw_identifier.carbon -// CHECK:STDERR: fail_raw_identifier.carbon:[[@LINE+2]]:8: error: expected `default` or a string literal to specify the library name [ExpectedLibraryNameOrDefault] +// CHECK:STDERR: ╭─┤ fail_raw_identifier.carbon:[[@LINE+8]]:8 +// CHECK:STDERR: -> │ library r#default; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `default` or a string literal to specify the library +// CHECK:STDERR: · ┃ name +// CHECK:STDERR: · ┃ [ExpectedLibraryNameOrDefault] +// CHECK:STDERR: ╰──── // CHECK:STDERR: library r#default; // --- fail_missing.carbon -// CHECK:STDERR: fail_missing.carbon:[[@LINE+2]]:8: error: expected `default` or a string literal to specify the library name [ExpectedLibraryNameOrDefault] +// CHECK:STDERR: ╭─┤ fail_missing.carbon:[[@LINE+8]]:8 +// CHECK:STDERR: -> │ library; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `default` or a string literal to specify the library +// CHECK:STDERR: · ┃ name +// CHECK:STDERR: · ┃ [ExpectedLibraryNameOrDefault] +// CHECK:STDERR: ╰──── // CHECK:STDERR: library; // --- fail_missing_with_api.carbon -// CHECK:STDERR: fail_missing_with_api.carbon:[[@LINE+2]]:8: error: expected `default` or a string literal to specify the library name [ExpectedLibraryNameOrDefault] +// CHECK:STDERR: ╭─┤ fail_missing_with_api.carbon:[[@LINE+8]]:8 +// CHECK:STDERR: -> │ library; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `default` or a string literal to specify the library +// CHECK:STDERR: · ┃ name +// CHECK:STDERR: · ┃ [ExpectedLibraryNameOrDefault] +// CHECK:STDERR: ╰──── // CHECK:STDERR: library; // --- fail_trailing_impl.carbon -// CHECK:STDERR: fail_trailing_impl.carbon:[[@LINE+2]]:24: error: `library` declarations must end with a `;` [ExpectedDeclSemi] +// CHECK:STDERR: ╭─┤ fail_trailing_impl.carbon:[[@LINE+7]]:24 +// CHECK:STDERR: -> │ library "trailing_impl" impl +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `library` declarations must end with a `;` +// CHECK:STDERR: · ┃ [ExpectedDeclSemi] +// CHECK:STDERR: ╰──── // CHECK:STDERR: library "[[@TEST_NAME]]" impl // --- fail_no_semi.carbon -// CHECK:STDERR: fail_no_semi.carbon:[[@LINE+2]]:18: error: `library` declarations must end with a `;` [ExpectedDeclSemi] +// CHECK:STDERR: ╭─┤ fail_no_semi.carbon:[[@LINE+7]]:18 +// CHECK:STDERR: -> │ library "no_semi" +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `library` declarations must end with a `;` +// CHECK:STDERR: · ┃ [ExpectedDeclSemi] +// CHECK:STDERR: ╰──── // CHECK:STDERR: library "[[@TEST_NAME]]" diff --git a/toolchain/parse/testdata/packages/library/fail_semi_before.carbon b/toolchain/parse/testdata/packages/library/fail_semi_before.carbon index 74c96933fb53..008f56271b89 100644 --- a/toolchain/parse/testdata/packages/library/fail_semi_before.carbon +++ b/toolchain/parse/testdata/packages/library/fail_semi_before.carbon @@ -10,8 +10,16 @@ ; -// CHECK:STDERR: fail_semi_before.carbon:[[@LINE+3]]:1-7: error: the `library` declaration must be the first non-comment line [PackageTooLate] -// CHECK:STDERR: fail_semi_before.carbon:[[@LINE-3]]:1: note: first non-comment line is here [FirstNonCommentLine] +// CHECK:STDERR: ╭─┤ fail_semi_before.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: │ ; +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ first non-comment line is here [FirstNonCommentLine] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ library "semi_before"; +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: the `library` declaration must be the first non-comment line +// CHECK:STDERR: · ┃ [PackageTooLate] +// CHECK:STDERR: ╰──── // CHECK:STDERR: library "[[@TEST_NAME]]"; diff --git a/toolchain/parse/testdata/packages/library/fail_too_late.carbon b/toolchain/parse/testdata/packages/library/fail_too_late.carbon index 25988b01d1dc..480fcbc1b294 100644 --- a/toolchain/parse/testdata/packages/library/fail_too_late.carbon +++ b/toolchain/parse/testdata/packages/library/fail_too_late.carbon @@ -10,8 +10,16 @@ import Geometry; -// CHECK:STDERR: fail_too_late.carbon:[[@LINE+3]]:1-7: error: the `library` declaration must be the first non-comment line [PackageTooLate] -// CHECK:STDERR: fail_too_late.carbon:[[@LINE-3]]:1-6: note: first non-comment line is here [FirstNonCommentLine] +// CHECK:STDERR: ╭─┤ fail_too_late.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: │ import Geometry; +// CHECK:STDERR: · ───┬── +// CHECK:STDERR: · ╰──┤ first non-comment line is here [FirstNonCommentLine] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ library "too_late"; +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: the `library` declaration must be the first non-comment line +// CHECK:STDERR: · ┃ [PackageTooLate] +// CHECK:STDERR: ╰──── // CHECK:STDERR: library "[[@TEST_NAME]]"; diff --git a/toolchain/parse/testdata/packages/package/fail_after_decl.carbon b/toolchain/parse/testdata/packages/package/fail_after_decl.carbon index fa884e8c5443..2c01de42fa57 100644 --- a/toolchain/parse/testdata/packages/package/fail_after_decl.carbon +++ b/toolchain/parse/testdata/packages/package/fail_after_decl.carbon @@ -10,8 +10,16 @@ fn A(); -// CHECK:STDERR: fail_after_decl.carbon:[[@LINE+3]]:1-7: error: the `package` declaration must be the first non-comment line [PackageTooLate] -// CHECK:STDERR: fail_after_decl.carbon:[[@LINE-3]]:1-2: note: first non-comment line is here [FirstNonCommentLine] +// CHECK:STDERR: ╭─┤ fail_after_decl.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: │ fn A(); +// CHECK:STDERR: · ─┬ +// CHECK:STDERR: · ╰──┤ first non-comment line is here [FirstNonCommentLine] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ package B; +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: the `package` declaration must be the first non-comment line +// CHECK:STDERR: · ┃ [PackageTooLate] +// CHECK:STDERR: ╰──── // CHECK:STDERR: package B; diff --git a/toolchain/parse/testdata/packages/package/fail_after_import.carbon b/toolchain/parse/testdata/packages/package/fail_after_import.carbon index 1f425de327e9..434217780815 100644 --- a/toolchain/parse/testdata/packages/package/fail_after_import.carbon +++ b/toolchain/parse/testdata/packages/package/fail_after_import.carbon @@ -10,8 +10,16 @@ import A; -// CHECK:STDERR: fail_after_import.carbon:[[@LINE+3]]:1-7: error: the `package` declaration must be the first non-comment line [PackageTooLate] -// CHECK:STDERR: fail_after_import.carbon:[[@LINE-3]]:1-6: note: first non-comment line is here [FirstNonCommentLine] +// CHECK:STDERR: ╭─┤ fail_after_import.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: │ import A; +// CHECK:STDERR: · ───┬── +// CHECK:STDERR: · ╰──┤ first non-comment line is here [FirstNonCommentLine] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ package B; +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: the `package` declaration must be the first non-comment line +// CHECK:STDERR: · ┃ [PackageTooLate] +// CHECK:STDERR: ╰──── // CHECK:STDERR: package B; diff --git a/toolchain/parse/testdata/packages/package/fail_after_package.carbon b/toolchain/parse/testdata/packages/package/fail_after_package.carbon index dc57f9177231..919add11bbe6 100644 --- a/toolchain/parse/testdata/packages/package/fail_after_package.carbon +++ b/toolchain/parse/testdata/packages/package/fail_after_package.carbon @@ -9,8 +9,16 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/package/fail_after_package.carbon package A; -// CHECK:STDERR: fail_after_package.carbon:[[@LINE+3]]:1-7: error: the `package` declaration must be the first non-comment line [PackageTooLate] -// CHECK:STDERR: fail_after_package.carbon:[[@LINE-2]]:1-7: note: first non-comment line is here [FirstNonCommentLine] +// CHECK:STDERR: ╭─┤ fail_after_package.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: │ package A; +// CHECK:STDERR: · ───┬─── +// CHECK:STDERR: · ╰──┤ first non-comment line is here [FirstNonCommentLine] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ package B; +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: the `package` declaration must be the first non-comment line +// CHECK:STDERR: · ┃ [PackageTooLate] +// CHECK:STDERR: ╰──── // CHECK:STDERR: package B; diff --git a/toolchain/parse/testdata/packages/package/fail_extra_string.carbon b/toolchain/parse/testdata/packages/package/fail_extra_string.carbon index 1c7109b5b174..d10602b6237e 100644 --- a/toolchain/parse/testdata/packages/package/fail_extra_string.carbon +++ b/toolchain/parse/testdata/packages/package/fail_extra_string.carbon @@ -8,7 +8,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/package/fail_extra_string.carbon -// CHECK:STDERR: fail_extra_string.carbon:[[@LINE+2]]:26: error: `package` declarations must end with a `;` [ExpectedDeclSemi] +// CHECK:STDERR: ╭─┤ fail_extra_string.carbon:[[@LINE+7]]:26 +// CHECK:STDERR: -> │ package Foo library "bar" "baz"; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `package` declarations must end with a `;` +// CHECK:STDERR: · ┃ [ExpectedDeclSemi] +// CHECK:STDERR: ╰──── // CHECK:STDERR: package Foo library "bar" "baz"; diff --git a/toolchain/parse/testdata/packages/package/fail_in_nested_scope.carbon b/toolchain/parse/testdata/packages/package/fail_in_nested_scope.carbon index ec7c3a60d221..a02597ce85ed 100644 --- a/toolchain/parse/testdata/packages/package/fail_in_nested_scope.carbon +++ b/toolchain/parse/testdata/packages/package/fail_in_nested_scope.carbon @@ -11,15 +11,28 @@ // api.carbon class C { - // CHECK:STDERR: fail_in_nested_scope.carbon:[[@LINE+3]]:3-9: error: the `package` declaration must be the first non-comment line [PackageTooLate] - // CHECK:STDERR: fail_in_nested_scope.carbon:[[@LINE-2]]:1-5: note: first non-comment line is here [FirstNonCommentLine] + // CHECK:STDERR: ╭─┤ fail_in_nested_scope.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ class C { + // CHECK:STDERR: · ──┬── + // CHECK:STDERR: · ╰──┤ first non-comment line is here [FirstNonCommentLine] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ package P; + // CHECK:STDERR: · ━━━┳━━━ + // CHECK:STDERR: · ┗━━┫ error: the `package` declaration must be the first non-comment line + // CHECK:STDERR: · ┃ [PackageTooLate] + // CHECK:STDERR: ╰──── // CHECK:STDERR: package P; } fn F() { // `package` here is an expression naming the package scope. - // CHECK:STDERR: fail_in_nested_scope.carbon:[[@LINE+2]]:10: error: expected `.` after `package` expression [ExpectedPeriodAfterPackage] + // CHECK:STDERR: ╭─┤ fail_in_nested_scope.carbon:[[@LINE+7]]:10 + // CHECK:STDERR: -> │ package P; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `.` after `package` expression + // CHECK:STDERR: · ┃ [ExpectedPeriodAfterPackage] + // CHECK:STDERR: ╰──── // CHECK:STDERR: package P; @@ -30,16 +43,32 @@ fn F() { // impl.carbon class C { - // CHECK:STDERR: fail_in_nested_scope.carbon:[[@LINE+3]]:3-6: error: the `package` declaration must be the first non-comment line [PackageTooLate] - // CHECK:STDERR: fail_in_nested_scope.carbon:[[@LINE-21]]:1-5: note: first non-comment line is here [FirstNonCommentLine] + // CHECK:STDERR: ╭─┤ fail_in_nested_scope.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ class C { + // CHECK:STDERR: · ──┬── + // CHECK:STDERR: · ╰──┤ first non-comment line is here [FirstNonCommentLine] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ impl package P; + // CHECK:STDERR: · ━━┳━ + // CHECK:STDERR: · ┗━━┫ error: the `package` declaration must be the first non-comment line + // CHECK:STDERR: · ┃ [PackageTooLate] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl package P; } fn F() { // This reaches decl parsing because `impl` is a valid modifier or introducer. - // CHECK:STDERR: fail_in_nested_scope.carbon:[[@LINE+3]]:3-6: error: the `package` declaration must be the first non-comment line [PackageTooLate] - // CHECK:STDERR: fail_in_nested_scope.carbon:[[@LINE-29]]:1-5: note: first non-comment line is here [FirstNonCommentLine] + // CHECK:STDERR: ╭─┤ fail_in_nested_scope.carbon:[[@LINE+11]]:3 + // CHECK:STDERR: │ class C { + // CHECK:STDERR: · ──┬── + // CHECK:STDERR: · ╰──┤ first non-comment line is here [FirstNonCommentLine] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ impl package P; + // CHECK:STDERR: · ━━┳━ + // CHECK:STDERR: · ┗━━┫ error: the `package` declaration must be the first non-comment line + // CHECK:STDERR: · ┃ [PackageTooLate] + // CHECK:STDERR: ╰──── // CHECK:STDERR: impl package P; } diff --git a/toolchain/parse/testdata/packages/package/fail_library_is_identifier.carbon b/toolchain/parse/testdata/packages/package/fail_library_is_identifier.carbon index be64adde337e..fc84fc9b788a 100644 --- a/toolchain/parse/testdata/packages/package/fail_library_is_identifier.carbon +++ b/toolchain/parse/testdata/packages/package/fail_library_is_identifier.carbon @@ -8,7 +8,13 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/package/fail_library_is_identifier.carbon -// CHECK:STDERR: fail_library_is_identifier.carbon:[[@LINE+2]]:25: error: expected a string literal to specify the library name [ExpectedLibraryName] +// CHECK:STDERR: ╭─┤ fail_library_is_identifier.carbon:[[@LINE+8]]:25 +// CHECK:STDERR: -> │ package Geometry library Shapes; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected a string literal to specify the +// CHECK:STDERR: · ┃ library name +// CHECK:STDERR: · ┃ [ExpectedLibraryName] +// CHECK:STDERR: ╰──── // CHECK:STDERR: package Geometry library Shapes; diff --git a/toolchain/parse/testdata/packages/package/fail_library_skips_name.carbon b/toolchain/parse/testdata/packages/package/fail_library_skips_name.carbon index c4f350a12ae0..cf2519f72f1f 100644 --- a/toolchain/parse/testdata/packages/package/fail_library_skips_name.carbon +++ b/toolchain/parse/testdata/packages/package/fail_library_skips_name.carbon @@ -8,7 +8,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/package/fail_library_skips_name.carbon -// CHECK:STDERR: fail_library_skips_name.carbon:[[@LINE+2]]:8: error: expected identifier after `package` [ExpectedIdentifierAfterPackage] +// CHECK:STDERR: ╭─┤ fail_library_skips_name.carbon:[[@LINE+7]]:8 +// CHECK:STDERR: -> │ package library "Shapes"; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected identifier after `package` +// CHECK:STDERR: · ┃ [ExpectedIdentifierAfterPackage] +// CHECK:STDERR: ╰──── // CHECK:STDERR: package library "Shapes"; diff --git a/toolchain/parse/testdata/packages/package/fail_name_is_keyword.carbon b/toolchain/parse/testdata/packages/package/fail_name_is_keyword.carbon index 11084149dc25..e26b36704934 100644 --- a/toolchain/parse/testdata/packages/package/fail_name_is_keyword.carbon +++ b/toolchain/parse/testdata/packages/package/fail_name_is_keyword.carbon @@ -8,7 +8,13 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/package/fail_name_is_keyword.carbon -// CHECK:STDERR: fail_name_is_keyword.carbon:[[@LINE+2]]:9-10: error: expected identifier after `package`; prefix reserved word with `r#` to form a valid identifier [ExpectedIdentifierAfterPackage] +// CHECK:STDERR: ╭─┤ fail_name_is_keyword.carbon:[[@LINE+8]]:9 +// CHECK:STDERR: -> │ package fn; +// CHECK:STDERR: · ┳━ +// CHECK:STDERR: · ┗━━┫ error: expected identifier after `package`; prefix reserved word +// CHECK:STDERR: · ┃ with `r#` to form a valid identifier +// CHECK:STDERR: · ┃ [ExpectedIdentifierAfterPackage] +// CHECK:STDERR: ╰──── // CHECK:STDERR: package fn; diff --git a/toolchain/parse/testdata/packages/package/fail_no_name.carbon b/toolchain/parse/testdata/packages/package/fail_no_name.carbon index dfb89d52f2fc..e326cb811f84 100644 --- a/toolchain/parse/testdata/packages/package/fail_no_name.carbon +++ b/toolchain/parse/testdata/packages/package/fail_no_name.carbon @@ -8,7 +8,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/package/fail_no_name.carbon -// CHECK:STDERR: fail_no_name.carbon:[[@LINE+2]]:8: error: expected identifier after `package` [ExpectedIdentifierAfterPackage] +// CHECK:STDERR: ╭─┤ fail_no_name.carbon:[[@LINE+7]]:8 +// CHECK:STDERR: -> │ package; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected identifier after `package` +// CHECK:STDERR: · ┃ [ExpectedIdentifierAfterPackage] +// CHECK:STDERR: ╰──── // CHECK:STDERR: package; diff --git a/toolchain/parse/testdata/packages/package/fail_no_semi.carbon b/toolchain/parse/testdata/packages/package/fail_no_semi.carbon index ffc7ce5f83ce..ffb6ff609c62 100644 --- a/toolchain/parse/testdata/packages/package/fail_no_semi.carbon +++ b/toolchain/parse/testdata/packages/package/fail_no_semi.carbon @@ -8,7 +8,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/package/fail_no_semi.carbon -// CHECK:STDERR: fail_no_semi.carbon:[[@LINE+2]]:17: error: `package` declarations must end with a `;` [ExpectedDeclSemi] +// CHECK:STDERR: ╭─┤ fail_no_semi.carbon:[[@LINE+7]]:17 +// CHECK:STDERR: -> │ package Geometry +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `package` declarations must end with a `;` +// CHECK:STDERR: · ┃ [ExpectedDeclSemi] +// CHECK:STDERR: ╰──── // CHECK:STDERR: package Geometry diff --git a/toolchain/parse/testdata/packages/package/fail_omit_library_keyword.carbon b/toolchain/parse/testdata/packages/package/fail_omit_library_keyword.carbon index 1fa2bc23afac..ae6e3bbe391f 100644 --- a/toolchain/parse/testdata/packages/package/fail_omit_library_keyword.carbon +++ b/toolchain/parse/testdata/packages/package/fail_omit_library_keyword.carbon @@ -8,7 +8,11 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/package/fail_omit_library_keyword.carbon -// CHECK:STDERR: fail_omit_library_keyword.carbon:[[@LINE+2]]:17: error: missing `library` keyword [MissingLibraryKeyword] +// CHECK:STDERR: ╭─┤ fail_omit_library_keyword.carbon:[[@LINE+6]]:17 +// CHECK:STDERR: -> │ package Geometry "Shapes"; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: missing `library` keyword [MissingLibraryKeyword] +// CHECK:STDERR: ╰──── // CHECK:STDERR: package Geometry "Shapes"; diff --git a/toolchain/parse/testdata/packages/package/fail_semi_before.carbon b/toolchain/parse/testdata/packages/package/fail_semi_before.carbon index 650e317d88dd..49a6ba336407 100644 --- a/toolchain/parse/testdata/packages/package/fail_semi_before.carbon +++ b/toolchain/parse/testdata/packages/package/fail_semi_before.carbon @@ -10,8 +10,16 @@ ; -// CHECK:STDERR: fail_semi_before.carbon:[[@LINE+3]]:1-7: error: the `package` declaration must be the first non-comment line [PackageTooLate] -// CHECK:STDERR: fail_semi_before.carbon:[[@LINE-3]]:1: note: first non-comment line is here [FirstNonCommentLine] +// CHECK:STDERR: ╭─┤ fail_semi_before.carbon:[[@LINE+11]]:1 +// CHECK:STDERR: │ ; +// CHECK:STDERR: · ┬ +// CHECK:STDERR: · ╰──┤ first non-comment line is here [FirstNonCommentLine] +// CHECK:STDERR: ┆ +// CHECK:STDERR: -> │ package Geometry; +// CHECK:STDERR: · ━━━┳━━━ +// CHECK:STDERR: · ┗━━┫ error: the `package` declaration must be the first non-comment line +// CHECK:STDERR: · ┃ [PackageTooLate] +// CHECK:STDERR: ╰──── // CHECK:STDERR: package Geometry; diff --git a/toolchain/parse/testdata/packages/package/fail_trailing_impl.carbon b/toolchain/parse/testdata/packages/package/fail_trailing_impl.carbon index 10a2fbf64cb3..39f56ce0cbee 100644 --- a/toolchain/parse/testdata/packages/package/fail_trailing_impl.carbon +++ b/toolchain/parse/testdata/packages/package/fail_trailing_impl.carbon @@ -8,7 +8,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/package/fail_trailing_impl.carbon -// CHECK:STDERR: fail_trailing_impl.carbon:[[@LINE+2]]:17: error: `package` declarations must end with a `;` [ExpectedDeclSemi] +// CHECK:STDERR: ╭─┤ fail_trailing_impl.carbon:[[@LINE+7]]:17 +// CHECK:STDERR: -> │ package Geometry impl; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `package` declarations must end with a `;` +// CHECK:STDERR: · ┃ [ExpectedDeclSemi] +// CHECK:STDERR: ╰──── // CHECK:STDERR: package Geometry impl; diff --git a/toolchain/parse/testdata/pointer/fail_pointer_type_in_expr.carbon b/toolchain/parse/testdata/pointer/fail_pointer_type_in_expr.carbon index 00701afaa3f8..a7bb2ee4c9e6 100644 --- a/toolchain/parse/testdata/pointer/fail_pointer_type_in_expr.carbon +++ b/toolchain/parse/testdata/pointer/fail_pointer_type_in_expr.carbon @@ -9,7 +9,13 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/pointer/fail_pointer_type_in_expr.carbon fn F() -> i32 { - // CHECK:STDERR: fail_pointer_type_in_expr.carbon:[[@LINE+2]]:14: error: parentheses are required to disambiguate operator precedence [OperatorRequiresParentheses] + // CHECK:STDERR: ╭─┤ fail_pointer_type_in_expr.carbon:[[@LINE+8]]:14 + // CHECK:STDERR: -> │ return *i32*; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: parentheses are required to disambiguate operator + // CHECK:STDERR: · ┃ precedence + // CHECK:STDERR: · ┃ [OperatorRequiresParentheses] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return *i32*; } diff --git a/toolchain/parse/testdata/pointer/fail_tuple_instead_of_compound_member_access.carbon b/toolchain/parse/testdata/pointer/fail_tuple_instead_of_compound_member_access.carbon index ffb006f3bd48..f5554d30cc9f 100644 --- a/toolchain/parse/testdata/pointer/fail_tuple_instead_of_compound_member_access.carbon +++ b/toolchain/parse/testdata/pointer/fail_tuple_instead_of_compound_member_access.carbon @@ -9,35 +9,67 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/pointer/fail_tuple_instead_of_compound_member_access.carbon fn F() { - // CHECK:STDERR: fail_tuple_instead_of_compound_member_access.carbon:[[@LINE+2]]:6: error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╭─┤ fail_tuple_instead_of_compound_member_access.carbon:[[@LINE+6]]:6 + // CHECK:STDERR: -> │ x.(); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╰──── // CHECK:STDERR: x.(); - // CHECK:STDERR: fail_tuple_instead_of_compound_member_access.carbon:[[@LINE+2]]:7: error: expected `)` [UnexpectedTokenInCompoundMemberAccess] + // CHECK:STDERR: ╭─┤ fail_tuple_instead_of_compound_member_access.carbon:[[@LINE+6]]:7 + // CHECK:STDERR: -> │ y.(1,); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `)` [UnexpectedTokenInCompoundMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: y.(1,); - // CHECK:STDERR: fail_tuple_instead_of_compound_member_access.carbon:[[@LINE+2]]:7: error: expected `)` [UnexpectedTokenInCompoundMemberAccess] + // CHECK:STDERR: ╭─┤ fail_tuple_instead_of_compound_member_access.carbon:[[@LINE+6]]:7 + // CHECK:STDERR: -> │ z.(a, b); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `)` [UnexpectedTokenInCompoundMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: z.(a, b); - // CHECK:STDERR: fail_tuple_instead_of_compound_member_access.carbon:[[@LINE+2]]:7: error: expected `)` [UnexpectedTokenInCompoundMemberAccess] + // CHECK:STDERR: ╭─┤ fail_tuple_instead_of_compound_member_access.carbon:[[@LINE+6]]:7 + // CHECK:STDERR: -> │ w.(c d e ()); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `)` [UnexpectedTokenInCompoundMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: w.(c d e ()); - // CHECK:STDERR: fail_tuple_instead_of_compound_member_access.carbon:[[@LINE+2]]:7: error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╭─┤ fail_tuple_instead_of_compound_member_access.carbon:[[@LINE+6]]:7 + // CHECK:STDERR: -> │ v->(); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╰──── // CHECK:STDERR: v->(); - // CHECK:STDERR: fail_tuple_instead_of_compound_member_access.carbon:[[@LINE+2]]:8: error: expected `)` [UnexpectedTokenInCompoundMemberAccess] + // CHECK:STDERR: ╭─┤ fail_tuple_instead_of_compound_member_access.carbon:[[@LINE+6]]:8 + // CHECK:STDERR: -> │ u->(f,); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `)` [UnexpectedTokenInCompoundMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: u->(f,); - // CHECK:STDERR: fail_tuple_instead_of_compound_member_access.carbon:[[@LINE+2]]:8: error: expected `)` [UnexpectedTokenInCompoundMemberAccess] + // CHECK:STDERR: ╭─┤ fail_tuple_instead_of_compound_member_access.carbon:[[@LINE+6]]:8 + // CHECK:STDERR: -> │ t->(2, 3); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `)` [UnexpectedTokenInCompoundMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: t->(2, 3); - // CHECK:STDERR: fail_tuple_instead_of_compound_member_access.carbon:[[@LINE+2]]:8: error: expected `)` [UnexpectedTokenInCompoundMemberAccess] + // CHECK:STDERR: ╭─┤ fail_tuple_instead_of_compound_member_access.carbon:[[@LINE+6]]:8 + // CHECK:STDERR: -> │ s->(g h i ()); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `)` [UnexpectedTokenInCompoundMemberAccess] + // CHECK:STDERR: ╰──── // CHECK:STDERR: s->(g h i ()); } diff --git a/toolchain/parse/testdata/return/fail_expr_no_semi.carbon b/toolchain/parse/testdata/return/fail_expr_no_semi.carbon index 36a04827e407..2eb8d666057e 100644 --- a/toolchain/parse/testdata/return/fail_expr_no_semi.carbon +++ b/toolchain/parse/testdata/return/fail_expr_no_semi.carbon @@ -9,7 +9,12 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/return/fail_expr_no_semi.carbon fn F() { - // CHECK:STDERR: fail_expr_no_semi.carbon:[[@LINE+2]]:11: error: `return` statements must end with a `;` [ExpectedStatementSemi] + // CHECK:STDERR: ╭─┤ fail_expr_no_semi.carbon:[[@LINE+7]]:11 + // CHECK:STDERR: -> │ return x + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: `return` statements must end with a `;` + // CHECK:STDERR: · ┃ [ExpectedStatementSemi] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return x } diff --git a/toolchain/parse/testdata/return/fail_no_semi.carbon b/toolchain/parse/testdata/return/fail_no_semi.carbon index 6bc2ef414082..402dd2929c2d 100644 --- a/toolchain/parse/testdata/return/fail_no_semi.carbon +++ b/toolchain/parse/testdata/return/fail_no_semi.carbon @@ -9,9 +9,18 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/return/fail_no_semi.carbon fn F() { - // CHECK:STDERR: fail_no_semi.carbon:[[@LINE+4]]:9: error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╭─┤ fail_no_semi.carbon:[[@LINE+13]]:9 + // CHECK:STDERR: -> │ return + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] + // CHECK:STDERR: ╰──── // CHECK:STDERR: - // CHECK:STDERR: fail_no_semi.carbon:[[@LINE+2]]:9: error: `return` statements must end with a `;` [ExpectedStatementSemi] + // CHECK:STDERR: ╭─┤ fail_no_semi.carbon:[[@LINE+7]]:9 + // CHECK:STDERR: -> │ return + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: `return` statements must end with a `;` + // CHECK:STDERR: · ┃ [ExpectedStatementSemi] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return } diff --git a/toolchain/parse/testdata/return/fail_returned_no_var.carbon b/toolchain/parse/testdata/return/fail_returned_no_var.carbon index a4eaf9d52f86..e32097f5e031 100644 --- a/toolchain/parse/testdata/return/fail_returned_no_var.carbon +++ b/toolchain/parse/testdata/return/fail_returned_no_var.carbon @@ -9,7 +9,11 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/return/fail_returned_no_var.carbon fn F() -> str { - // CHECK:STDERR: fail_returned_no_var.carbon:[[@LINE+2]]:11: error: expected `var` after `returned` [ExpectedVarAfterReturned] + // CHECK:STDERR: ╭─┤ fail_returned_no_var.carbon:[[@LINE+6]]:11 + // CHECK:STDERR: -> │ returned fn G() -> i32; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `var` after `returned` [ExpectedVarAfterReturned] + // CHECK:STDERR: ╰──── // CHECK:STDERR: returned fn G() -> i32; } diff --git a/toolchain/parse/testdata/return/fail_var_no_semi.carbon b/toolchain/parse/testdata/return/fail_var_no_semi.carbon index bf41ff1aba00..80a3366dda88 100644 --- a/toolchain/parse/testdata/return/fail_var_no_semi.carbon +++ b/toolchain/parse/testdata/return/fail_var_no_semi.carbon @@ -9,7 +9,12 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/return/fail_var_no_semi.carbon fn F() { - // CHECK:STDERR: fail_var_no_semi.carbon:[[@LINE+2]]:13: error: `return` statements must end with a `;` [ExpectedStatementSemi] + // CHECK:STDERR: ╭─┤ fail_var_no_semi.carbon:[[@LINE+7]]:13 + // CHECK:STDERR: -> │ return var + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: `return` statements must end with a `;` + // CHECK:STDERR: · ┃ [ExpectedStatementSemi] + // CHECK:STDERR: ╰──── // CHECK:STDERR: return var } diff --git a/toolchain/parse/testdata/struct/fail_comma_only.carbon b/toolchain/parse/testdata/struct/fail_comma_only.carbon index 50895ded7710..134ea7c137db 100644 --- a/toolchain/parse/testdata/struct/fail_comma_only.carbon +++ b/toolchain/parse/testdata/struct/fail_comma_only.carbon @@ -8,7 +8,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_comma_only.carbon -// CHECK:STDERR: fail_comma_only.carbon:[[@LINE+2]]:9: error: expected `.field: field_type` or `.field = value` [ExpectedStructLiteralField] +// CHECK:STDERR: ╭─┤ fail_comma_only.carbon:[[@LINE+7]]:9 +// CHECK:STDERR: -> │ var x: {,} = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `.field: field_type` or `.field = value` +// CHECK:STDERR: · ┃ [ExpectedStructLiteralField] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: {,} = {}; diff --git a/toolchain/parse/testdata/struct/fail_comma_repeat_in_type.carbon b/toolchain/parse/testdata/struct/fail_comma_repeat_in_type.carbon index 3613402fe951..8ce510c8e37a 100644 --- a/toolchain/parse/testdata/struct/fail_comma_repeat_in_type.carbon +++ b/toolchain/parse/testdata/struct/fail_comma_repeat_in_type.carbon @@ -8,7 +8,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_comma_repeat_in_type.carbon -// CHECK:STDERR: fail_comma_repeat_in_type.carbon:[[@LINE+2]]:17: error: expected `.field: field_type` [ExpectedStructLiteralField] +// CHECK:STDERR: ╭─┤ fail_comma_repeat_in_type.carbon:[[@LINE+7]]:17 +// CHECK:STDERR: -> │ var x: {.a: i32,,} = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `.field: field_type` +// CHECK:STDERR: · ┃ [ExpectedStructLiteralField] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: {.a: i32,,} = {}; diff --git a/toolchain/parse/testdata/struct/fail_comma_repeat_in_value.carbon b/toolchain/parse/testdata/struct/fail_comma_repeat_in_value.carbon index 751af6d97355..58af65185925 100644 --- a/toolchain/parse/testdata/struct/fail_comma_repeat_in_value.carbon +++ b/toolchain/parse/testdata/struct/fail_comma_repeat_in_value.carbon @@ -8,7 +8,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_comma_repeat_in_value.carbon -// CHECK:STDERR: fail_comma_repeat_in_value.carbon:[[@LINE+2]]:16: error: expected `.field = value` [ExpectedStructLiteralField] +// CHECK:STDERR: ╭─┤ fail_comma_repeat_in_value.carbon:[[@LINE+7]]:16 +// CHECK:STDERR: -> │ var x: {.a = 0,,} = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `.field = value` +// CHECK:STDERR: · ┃ [ExpectedStructLiteralField] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: {.a = 0,,} = {}; diff --git a/toolchain/parse/testdata/struct/fail_extra_token_in_type.carbon b/toolchain/parse/testdata/struct/fail_extra_token_in_type.carbon index 4520546c4728..00fbc767c442 100644 --- a/toolchain/parse/testdata/struct/fail_extra_token_in_type.carbon +++ b/toolchain/parse/testdata/struct/fail_extra_token_in_type.carbon @@ -8,7 +8,11 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_extra_token_in_type.carbon -// CHECK:STDERR: fail_extra_token_in_type.carbon:[[@LINE+2]]:16: error: expected `,` or `}` [UnexpectedTokenAfterListElement] +// CHECK:STDERR: ╭─┤ fail_extra_token_in_type.carbon:[[@LINE+6]]:16 +// CHECK:STDERR: -> │ var x: {.a: i32 banana} = {.a = 0}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `,` or `}` [UnexpectedTokenAfterListElement] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: {.a: i32 banana} = {.a = 0}; diff --git a/toolchain/parse/testdata/struct/fail_extra_token_in_value.carbon b/toolchain/parse/testdata/struct/fail_extra_token_in_value.carbon index 7f0d4b573cba..33e834241721 100644 --- a/toolchain/parse/testdata/struct/fail_extra_token_in_value.carbon +++ b/toolchain/parse/testdata/struct/fail_extra_token_in_value.carbon @@ -8,7 +8,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_extra_token_in_value.carbon -// CHECK:STDERR: fail_extra_token_in_value.carbon:[[@LINE+2]]:27: error: expected `,` or `}` [UnexpectedTokenAfterListElement] +// CHECK:STDERR: ╭─┤ fail_extra_token_in_value.carbon:[[@LINE+7]]:27 +// CHECK:STDERR: -> │ var x: {.a: i32} = {.a = 0 banana}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `,` or `}` +// CHECK:STDERR: · ┃ [UnexpectedTokenAfterListElement] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: {.a: i32} = {.a = 0 banana}; diff --git a/toolchain/parse/testdata/struct/fail_identifier_colon.carbon b/toolchain/parse/testdata/struct/fail_identifier_colon.carbon index 85b764d9bee7..22799d39d322 100644 --- a/toolchain/parse/testdata/struct/fail_identifier_colon.carbon +++ b/toolchain/parse/testdata/struct/fail_identifier_colon.carbon @@ -8,7 +8,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_identifier_colon.carbon -// CHECK:STDERR: fail_identifier_colon.carbon:[[@LINE+2]]:9: error: expected `.field: field_type` or `.field = value` [ExpectedStructLiteralField] +// CHECK:STDERR: ╭─┤ fail_identifier_colon.carbon:[[@LINE+7]]:9 +// CHECK:STDERR: -> │ var x: {a:} = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `.field: field_type` or `.field = value` +// CHECK:STDERR: · ┃ [ExpectedStructLiteralField] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: {a:} = {}; diff --git a/toolchain/parse/testdata/struct/fail_identifier_equals.carbon b/toolchain/parse/testdata/struct/fail_identifier_equals.carbon index fc5651106c65..3b638f8eaa5e 100644 --- a/toolchain/parse/testdata/struct/fail_identifier_equals.carbon +++ b/toolchain/parse/testdata/struct/fail_identifier_equals.carbon @@ -8,7 +8,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_identifier_equals.carbon -// CHECK:STDERR: fail_identifier_equals.carbon:[[@LINE+2]]:9: error: expected `.field: field_type` or `.field = value` [ExpectedStructLiteralField] +// CHECK:STDERR: ╭─┤ fail_identifier_equals.carbon:[[@LINE+7]]:9 +// CHECK:STDERR: -> │ var x: {a=} = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `.field: field_type` or `.field = value` +// CHECK:STDERR: · ┃ [ExpectedStructLiteralField] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: {a=} = {}; diff --git a/toolchain/parse/testdata/struct/fail_identifier_only.carbon b/toolchain/parse/testdata/struct/fail_identifier_only.carbon index 4a9866ae0b2c..156dd5da9b33 100644 --- a/toolchain/parse/testdata/struct/fail_identifier_only.carbon +++ b/toolchain/parse/testdata/struct/fail_identifier_only.carbon @@ -8,7 +8,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_identifier_only.carbon -// CHECK:STDERR: fail_identifier_only.carbon:[[@LINE+2]]:9: error: expected `.field: field_type` or `.field = value` [ExpectedStructLiteralField] +// CHECK:STDERR: ╭─┤ fail_identifier_only.carbon:[[@LINE+7]]:9 +// CHECK:STDERR: -> │ var x: {a} = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `.field: field_type` or `.field = value` +// CHECK:STDERR: · ┃ [ExpectedStructLiteralField] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: {a} = {}; diff --git a/toolchain/parse/testdata/struct/fail_invalid_struct_designator.carbon b/toolchain/parse/testdata/struct/fail_invalid_struct_designator.carbon index b3b4e2bb78fa..b9f6b5e217c5 100644 --- a/toolchain/parse/testdata/struct/fail_invalid_struct_designator.carbon +++ b/toolchain/parse/testdata/struct/fail_invalid_struct_designator.carbon @@ -8,7 +8,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_invalid_struct_designator.carbon -// CHECK:STDERR: fail_invalid_struct_designator.carbon:[[@LINE+2]]:16: error: expected identifier after `.` [ExpectedIdentifierAfterPeriodOrArrow] +// CHECK:STDERR: ╭─┤ fail_invalid_struct_designator.carbon:[[@LINE+7]]:16 +// CHECK:STDERR: -> │ var x: i32 = {.7 = 8}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected identifier after `.` +// CHECK:STDERR: · ┃ [ExpectedIdentifierAfterPeriodOrArrow] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: i32 = {.7 = 8}; diff --git a/toolchain/parse/testdata/struct/fail_missing_type.carbon b/toolchain/parse/testdata/struct/fail_missing_type.carbon index 4b308c31180e..b8246c902ab3 100644 --- a/toolchain/parse/testdata/struct/fail_missing_type.carbon +++ b/toolchain/parse/testdata/struct/fail_missing_type.carbon @@ -8,7 +8,11 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_missing_type.carbon -// CHECK:STDERR: fail_missing_type.carbon:[[@LINE+2]]:12: error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╭─┤ fail_missing_type.carbon:[[@LINE+6]]:12 +// CHECK:STDERR: -> │ var x: {.a:} = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: {.a:} = {}; diff --git a/toolchain/parse/testdata/struct/fail_missing_value.carbon b/toolchain/parse/testdata/struct/fail_missing_value.carbon index 658977b5ca9a..c9434f8f2416 100644 --- a/toolchain/parse/testdata/struct/fail_missing_value.carbon +++ b/toolchain/parse/testdata/struct/fail_missing_value.carbon @@ -8,7 +8,11 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_missing_value.carbon -// CHECK:STDERR: fail_missing_value.carbon:[[@LINE+2]]:12: error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╭─┤ fail_missing_value.carbon:[[@LINE+6]]:12 +// CHECK:STDERR: -> │ var x: {.a=} = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: {.a=} = {}; diff --git a/toolchain/parse/testdata/struct/fail_mix_type_and_value.carbon b/toolchain/parse/testdata/struct/fail_mix_type_and_value.carbon index 542674cff851..4eebd09fb8d5 100644 --- a/toolchain/parse/testdata/struct/fail_mix_type_and_value.carbon +++ b/toolchain/parse/testdata/struct/fail_mix_type_and_value.carbon @@ -8,7 +8,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_mix_type_and_value.carbon -// CHECK:STDERR: fail_mix_type_and_value.carbon:[[@LINE+2]]:21: error: expected `.field: field_type` [ExpectedStructLiteralField] +// CHECK:STDERR: ╭─┤ fail_mix_type_and_value.carbon:[[@LINE+7]]:21 +// CHECK:STDERR: -> │ var x: {.a: i32, .b = 0} = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `.field: field_type` +// CHECK:STDERR: · ┃ [ExpectedStructLiteralField] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: {.a: i32, .b = 0} = {}; diff --git a/toolchain/parse/testdata/struct/fail_mix_value_and_type.carbon b/toolchain/parse/testdata/struct/fail_mix_value_and_type.carbon index 82bea00a9389..0ce6463f2019 100644 --- a/toolchain/parse/testdata/struct/fail_mix_value_and_type.carbon +++ b/toolchain/parse/testdata/struct/fail_mix_value_and_type.carbon @@ -8,7 +8,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_mix_value_and_type.carbon -// CHECK:STDERR: fail_mix_value_and_type.carbon:[[@LINE+2]]:17: error: expected `.field = value` [ExpectedStructLiteralField] +// CHECK:STDERR: ╭─┤ fail_mix_value_and_type.carbon:[[@LINE+7]]:17 +// CHECK:STDERR: -> │ var x: {.a = 0, b: i32} = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `.field = value` +// CHECK:STDERR: · ┃ [ExpectedStructLiteralField] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: {.a = 0, b: i32} = {}; diff --git a/toolchain/parse/testdata/struct/fail_mix_with_unknown.carbon b/toolchain/parse/testdata/struct/fail_mix_with_unknown.carbon index 62976a4e8195..b6d1c5669cb0 100644 --- a/toolchain/parse/testdata/struct/fail_mix_with_unknown.carbon +++ b/toolchain/parse/testdata/struct/fail_mix_with_unknown.carbon @@ -8,15 +8,35 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_mix_with_unknown.carbon -// CHECK:STDERR: fail_mix_with_unknown.carbon:[[@LINE+4]]:25: error: expected `.field = value` [ExpectedStructLiteralField] +// CHECK:STDERR: ╭─┤ fail_mix_with_unknown.carbon:[[@LINE+14]]:25 +// CHECK:STDERR: -> │ var x: i32 = {.a = 1, .b, .c: i32}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `.field = value` +// CHECK:STDERR: · ┃ [ExpectedStructLiteralField] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_mix_with_unknown.carbon:[[@LINE+2]]:29: error: expected `.field = value` [ExpectedStructLiteralField] +// CHECK:STDERR: ╭─┤ fail_mix_with_unknown.carbon:[[@LINE+7]]:29 +// CHECK:STDERR: -> │ var x: i32 = {.a = 1, .b, .c: i32}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `.field = value` +// CHECK:STDERR: · ┃ [ExpectedStructLiteralField] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: i32 = {.a = 1, .b, .c: i32}; -// CHECK:STDERR: fail_mix_with_unknown.carbon:[[@LINE+4]]:26: error: expected `.field: field_type` [ExpectedStructLiteralField] +// CHECK:STDERR: ╭─┤ fail_mix_with_unknown.carbon:[[@LINE+14]]:26 +// CHECK:STDERR: -> │ var x: i32 = {.a: i32, .b, .c = 1}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `.field: field_type` +// CHECK:STDERR: · ┃ [ExpectedStructLiteralField] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_mix_with_unknown.carbon:[[@LINE+2]]:31: error: expected `.field: field_type` [ExpectedStructLiteralField] +// CHECK:STDERR: ╭─┤ fail_mix_with_unknown.carbon:[[@LINE+7]]:31 +// CHECK:STDERR: -> │ var x: i32 = {.a: i32, .b, .c = 1}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `.field: field_type` +// CHECK:STDERR: · ┃ [ExpectedStructLiteralField] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: i32 = {.a: i32, .b, .c = 1}; diff --git a/toolchain/parse/testdata/struct/fail_no_colon_or_equals.carbon b/toolchain/parse/testdata/struct/fail_no_colon_or_equals.carbon index be64b4b4023b..d95175ef7676 100644 --- a/toolchain/parse/testdata/struct/fail_no_colon_or_equals.carbon +++ b/toolchain/parse/testdata/struct/fail_no_colon_or_equals.carbon @@ -8,7 +8,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_no_colon_or_equals.carbon -// CHECK:STDERR: fail_no_colon_or_equals.carbon:[[@LINE+2]]:11: error: expected `.field: field_type` or `.field = value` [ExpectedStructLiteralField] +// CHECK:STDERR: ╭─┤ fail_no_colon_or_equals.carbon:[[@LINE+7]]:11 +// CHECK:STDERR: -> │ var x: {.a} = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `.field: field_type` or `.field = value` +// CHECK:STDERR: · ┃ [ExpectedStructLiteralField] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: {.a} = {}; diff --git a/toolchain/parse/testdata/struct/fail_period_only.carbon b/toolchain/parse/testdata/struct/fail_period_only.carbon index 5fe725e68283..4379d4769421 100644 --- a/toolchain/parse/testdata/struct/fail_period_only.carbon +++ b/toolchain/parse/testdata/struct/fail_period_only.carbon @@ -8,7 +8,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_period_only.carbon -// CHECK:STDERR: fail_period_only.carbon:[[@LINE+2]]:10: error: expected identifier after `.` [ExpectedIdentifierAfterPeriodOrArrow] +// CHECK:STDERR: ╭─┤ fail_period_only.carbon:[[@LINE+7]]:10 +// CHECK:STDERR: -> │ var x: {.} = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected identifier after `.` +// CHECK:STDERR: · ┃ [ExpectedIdentifierAfterPeriodOrArrow] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: {.} = {}; diff --git a/toolchain/parse/testdata/struct/fail_period_paren.carbon b/toolchain/parse/testdata/struct/fail_period_paren.carbon index 15896f0ff5df..8aac3ed6d553 100644 --- a/toolchain/parse/testdata/struct/fail_period_paren.carbon +++ b/toolchain/parse/testdata/struct/fail_period_paren.carbon @@ -8,7 +8,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_period_paren.carbon -// CHECK:STDERR: fail_period_paren.carbon:[[@LINE+2]]:10: error: expected identifier after `.` [ExpectedIdentifierAfterPeriodOrArrow] +// CHECK:STDERR: ╭─┤ fail_period_paren.carbon:[[@LINE+7]]:10 +// CHECK:STDERR: -> │ var x: {.(a) = 1}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected identifier after `.` +// CHECK:STDERR: · ┃ [ExpectedIdentifierAfterPeriodOrArrow] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: {.(a) = 1}; diff --git a/toolchain/parse/testdata/struct/fail_period_string_colon.carbon b/toolchain/parse/testdata/struct/fail_period_string_colon.carbon index 13fb3b71856b..195ca8c4f0c1 100644 --- a/toolchain/parse/testdata/struct/fail_period_string_colon.carbon +++ b/toolchain/parse/testdata/struct/fail_period_string_colon.carbon @@ -8,7 +8,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_period_string_colon.carbon -// CHECK:STDERR: fail_period_string_colon.carbon:[[@LINE+2]]:10: error: expected identifier after `.` [ExpectedIdentifierAfterPeriodOrArrow] +// CHECK:STDERR: ╭─┤ fail_period_string_colon.carbon:[[@LINE+7]]:10 +// CHECK:STDERR: -> │ var x: {."hello": i32, .y: i32} = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected identifier after `.` +// CHECK:STDERR: · ┃ [ExpectedIdentifierAfterPeriodOrArrow] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: {."hello": i32, .y: i32} = {}; diff --git a/toolchain/parse/testdata/struct/fail_period_string_equals.carbon b/toolchain/parse/testdata/struct/fail_period_string_equals.carbon index a4ad1e988036..133e5651c3ff 100644 --- a/toolchain/parse/testdata/struct/fail_period_string_equals.carbon +++ b/toolchain/parse/testdata/struct/fail_period_string_equals.carbon @@ -8,7 +8,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_period_string_equals.carbon -// CHECK:STDERR: fail_period_string_equals.carbon:[[@LINE+2]]:10: error: expected identifier after `.` [ExpectedIdentifierAfterPeriodOrArrow] +// CHECK:STDERR: ╭─┤ fail_period_string_equals.carbon:[[@LINE+7]]:10 +// CHECK:STDERR: -> │ var x: {."hello" = 0, .y = 4} = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected identifier after `.` +// CHECK:STDERR: · ┃ [ExpectedIdentifierAfterPeriodOrArrow] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: {."hello" = 0, .y = 4} = {}; diff --git a/toolchain/parse/testdata/struct/fail_type_no_designator.carbon b/toolchain/parse/testdata/struct/fail_type_no_designator.carbon index 2fe8bf68cf77..15d378a20df9 100644 --- a/toolchain/parse/testdata/struct/fail_type_no_designator.carbon +++ b/toolchain/parse/testdata/struct/fail_type_no_designator.carbon @@ -8,7 +8,12 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_type_no_designator.carbon -// CHECK:STDERR: fail_type_no_designator.carbon:[[@LINE+2]]:9-11: error: expected `.field: field_type` or `.field = value` [ExpectedStructLiteralField] +// CHECK:STDERR: ╭─┤ fail_type_no_designator.carbon:[[@LINE+7]]:9 +// CHECK:STDERR: -> │ var x: {i32} = {}; +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┗━━┫ error: expected `.field: field_type` or `.field = value` +// CHECK:STDERR: · ┃ [ExpectedStructLiteralField] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: {i32} = {}; diff --git a/toolchain/parse/testdata/struct/struct_pattern.carbon b/toolchain/parse/testdata/struct/struct_pattern.carbon index 3c0f086c5fc7..a570f09b4267 100644 --- a/toolchain/parse/testdata/struct/struct_pattern.carbon +++ b/toolchain/parse/testdata/struct/struct_pattern.carbon @@ -62,179 +62,333 @@ let{x: i32, .y = {a: i32, b: i32}} = {}; // --- fail_struct_pattern_comma_only.carbon -// CHECK:STDERR: fail_struct_pattern_comma_only.carbon:[[@LINE+2]]:6: error: expected name in binding pattern [ExpectedBindingPattern] +// CHECK:STDERR: ╭─┤ fail_struct_pattern_comma_only.carbon:[[@LINE+6]]:6 +// CHECK:STDERR: -> │ let {,} = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected name in binding pattern [ExpectedBindingPattern] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let {,} = {}; // --- fail_struct_pattern_missing_designator.carbon -// CHECK:STDERR: fail_struct_pattern_missing_designator.carbon:[[@LINE+2]]:6: error: expected name in binding pattern [ExpectedBindingPattern] +// CHECK:STDERR: ╭─┤ fail_struct_pattern_missing_designator.carbon:[[@LINE+6]]:6 +// CHECK:STDERR: -> │ let {= y: i32} = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected name in binding pattern [ExpectedBindingPattern] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let {= y: i32} = {}; // --- fail_struct_pattern_invalid_designator.carbon -// CHECK:STDERR: fail_struct_pattern_invalid_designator.carbon:[[@LINE+2]]:7: error: expected identifier after `.` [ExpectedIdentifierAfterPeriodOrArrow] +// CHECK:STDERR: ╭─┤ fail_struct_pattern_invalid_designator.carbon:[[@LINE+7]]:7 +// CHECK:STDERR: -> │ let {.7 = y: i32} = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected identifier after `.` +// CHECK:STDERR: · ┃ [ExpectedIdentifierAfterPeriodOrArrow] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let {.7 = y: i32} = {}; // --- fail_struct_pattern_designator_only.carbon -// CHECK:STDERR: fail_struct_pattern_designator_only.carbon:[[@LINE+2]]:8: error: expected `= value` after `.field` [ExpectedStructPatternDesignatedField] +// CHECK:STDERR: ╭─┤ fail_struct_pattern_designator_only.carbon:[[@LINE+7]]:8 +// CHECK:STDERR: -> │ let {.x} = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `= value` after `.field` +// CHECK:STDERR: · ┃ [ExpectedStructPatternDesignatedField] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let {.x} = {}; // --- fail_struct_type_literal_as_pattern.carbon -// CHECK:STDERR: fail_struct_type_literal_as_pattern.carbon:[[@LINE+2]]:8: error: expected `= value` after `.field` [ExpectedStructPatternDesignatedField] +// CHECK:STDERR: ╭─┤ fail_struct_type_literal_as_pattern.carbon:[[@LINE+7]]:8 +// CHECK:STDERR: -> │ let {.x: i32} = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `= value` after `.field` +// CHECK:STDERR: · ┃ [ExpectedStructPatternDesignatedField] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let {.x: i32} = {}; // --- fail_struct_pattern_period_only.carbon -// CHECK:STDERR: fail_struct_pattern_period_only.carbon:[[@LINE+2]]:7: error: expected identifier after `.` [ExpectedIdentifierAfterPeriodOrArrow] +// CHECK:STDERR: ╭─┤ fail_struct_pattern_period_only.carbon:[[@LINE+7]]:7 +// CHECK:STDERR: -> │ let {.} = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected identifier after `.` +// CHECK:STDERR: · ┃ [ExpectedIdentifierAfterPeriodOrArrow] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let {.} = {}; // --- fail_struct_pattern_repeated_comma.carbon -// CHECK:STDERR: fail_struct_pattern_repeated_comma.carbon:[[@LINE+2]]:18: error: expected name in binding pattern [ExpectedBindingPattern] +// CHECK:STDERR: ╭─┤ fail_struct_pattern_repeated_comma.carbon:[[@LINE+7]]:18 +// CHECK:STDERR: -> │ let {.x = x: i32,,} = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected name in binding pattern +// CHECK:STDERR: · ┃ [ExpectedBindingPattern] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let {.x = x: i32,,} = {}; // --- fail_struct_pattern_missing_comma.carbon -// CHECK:STDERR: fail_struct_pattern_missing_comma.carbon:[[@LINE+2]]:20: error: expected `,` or `}` [UnexpectedTokenAfterListElement] +// CHECK:STDERR: ╭─┤ fail_struct_pattern_missing_comma.carbon:[[@LINE+7]]:20 +// CHECK:STDERR: -> │ let {.x = x: i32 .y = y: i32} = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `,` or `}` +// CHECK:STDERR: · ┃ [UnexpectedTokenAfterListElement] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let {.x = x: i32 .y = y: i32} = {}; // --- fail_struct_pattern_missing_pattern.carbon -// CHECK:STDERR: fail_struct_pattern_missing_pattern.carbon:[[@LINE+2]]:10: error: expected pattern [ExpectedPattern] +// CHECK:STDERR: ╭─┤ fail_struct_pattern_missing_pattern.carbon:[[@LINE+6]]:10 +// CHECK:STDERR: -> │ let {.x = } = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected pattern [ExpectedPattern] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let {.x = } = {}; // --- fail_struct_pattern_shorthand_missing_identifier.carbon -// CHECK:STDERR: fail_struct_pattern_shorthand_missing_identifier.carbon:[[@LINE+2]]:6: error: expected name in binding pattern [ExpectedBindingPattern] +// CHECK:STDERR: ╭─┤ fail_struct_pattern_shorthand_missing_identifier.carbon:[[@LINE+6]]:6 +// CHECK:STDERR: -> │ let {:i32} = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected name in binding pattern [ExpectedBindingPattern] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let {:i32} = {}; // --- fail_struct_pattern_shorthand_missing_expression.carbon -// CHECK:STDERR: fail_struct_pattern_shorthand_missing_expression.carbon:[[@LINE+2]]:8: error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╭─┤ fail_struct_pattern_shorthand_missing_expression.carbon:[[@LINE+6]]:8 +// CHECK:STDERR: -> │ let {x: } = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let {x: } = {}; // --- fail_struct_pattern_shorthand_missing_comma.carbon -// CHECK:STDERR: fail_struct_pattern_shorthand_missing_comma.carbon:[[@LINE+2]]:12: error: expected `,` or `}` [UnexpectedTokenAfterListElement] +// CHECK:STDERR: ╭─┤ fail_struct_pattern_shorthand_missing_comma.carbon:[[@LINE+6]]:12 +// CHECK:STDERR: -> │ let {x: i32 y: i32} = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `,` or `}` [UnexpectedTokenAfterListElement] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let {x: i32 y: i32} = {}; // --- fail_struct_pattern_missing_equals.carbon -// CHECK:STDERR: fail_struct_pattern_missing_equals.carbon:[[@LINE+2]]:8: error: expected `= value` after `.field` [ExpectedStructPatternDesignatedField] +// CHECK:STDERR: ╭─┤ fail_struct_pattern_missing_equals.carbon:[[@LINE+7]]:8 +// CHECK:STDERR: -> │ let {.x x:i32} = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `= value` after `.field` +// CHECK:STDERR: · ┃ [ExpectedStructPatternDesignatedField] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let {.x x:i32} = {}; // --- fail_struct_pattern_token_after_underscore.carbon -// CHECK:STDERR: fail_struct_pattern_token_after_underscore.carbon:[[@LINE+2]]:20: error: unexpected token `.` after `_` in struct pattern, expected `}` [ExpectedCloseAfterUnderscore] +// CHECK:STDERR: ╭─┤ fail_struct_pattern_token_after_underscore.carbon:[[@LINE+8]]:20 +// CHECK:STDERR: -> │ let {.x = x: i32, _. } = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: unexpected token `.` after `_` in struct pattern, +// CHECK:STDERR: · ┃ expected `}` +// CHECK:STDERR: · ┃ [ExpectedCloseAfterUnderscore] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let {.x = x: i32, _. } = {}; // --- fail_struct_pattern_underscore_not_last.carbon -// CHECK:STDERR: fail_struct_pattern_underscore_not_last.carbon:[[@LINE+2]]:8: error: unexpected token `.` after `,` in struct pattern with `_` field, expected `}` [ExpectedCloseAfterUnderscore] +// CHECK:STDERR: ╭─┤ fail_struct_pattern_underscore_not_last.carbon:[[@LINE+8]]:8 +// CHECK:STDERR: -> │ let{_, .x = x: i32} = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: unexpected token `.` after `,` in struct pattern with `_` +// CHECK:STDERR: · ┃ field, expected `}` +// CHECK:STDERR: · ┃ [ExpectedCloseAfterUnderscore] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let{_, .x = x: i32} = {}; // --- fail_struct_pattern_extra_token_end.carbon -// CHECK:STDERR: fail_struct_pattern_extra_token_end.carbon:[[@LINE+2]]:17: error: expected `,` or `}` [UnexpectedTokenAfterListElement] +// CHECK:STDERR: ╭─┤ fail_struct_pattern_extra_token_end.carbon:[[@LINE+7]]:17 +// CHECK:STDERR: -> │ let {.x = x: i32 foo, .y = y: i32} = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `,` or `}` +// CHECK:STDERR: · ┃ [UnexpectedTokenAfterListElement] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let {.x = x: i32 foo, .y = y: i32} = {}; // --- fail_struct_pattern_extra_token_start.carbon -// CHECK:STDERR: fail_struct_pattern_extra_token_start.carbon:[[@LINE+2]]:22: error: expected `:` or `:?` in binding pattern [ExpectedBindingPattern] +// CHECK:STDERR: ╭─┤ fail_struct_pattern_extra_token_start.carbon:[[@LINE+7]]:22 +// CHECK:STDERR: -> │ let {.x = x: i32, foo .y = y: i32} = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `:` or `:?` in binding pattern +// CHECK:STDERR: · ┃ [ExpectedBindingPattern] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let {.x = x: i32, foo .y = y: i32} = {}; // --- fail_struct_pattern_shorthand_extra_token_end.carbon -// CHECK:STDERR: fail_struct_pattern_shorthand_extra_token_end.carbon:[[@LINE+2]]:12: error: expected `,` or `}` [UnexpectedTokenAfterListElement] +// CHECK:STDERR: ╭─┤ fail_struct_pattern_shorthand_extra_token_end.carbon:[[@LINE+6]]:12 +// CHECK:STDERR: -> │ let {x: i32 foo, y: i32} = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `,` or `}` [UnexpectedTokenAfterListElement] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let {x: i32 foo, y: i32} = {}; // --- fail_struct_pattern_shorthand_extra_token_start.carbon -// CHECK:STDERR: fail_struct_pattern_shorthand_extra_token_start.carbon:[[@LINE+2]]:17: error: expected `:` or `:?` in binding pattern [ExpectedBindingPattern] +// CHECK:STDERR: ╭─┤ fail_struct_pattern_shorthand_extra_token_start.carbon:[[@LINE+7]]:17 +// CHECK:STDERR: -> │ let {x: i32, foo y: i32} = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `:` or `:?` in binding pattern +// CHECK:STDERR: · ┃ [ExpectedBindingPattern] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let {x: i32, foo y: i32} = {}; // --- fail_struct_pattern_invalid_introducer.carbon -// CHECK:STDERR: fail_struct_pattern_invalid_introducer.carbon:[[@LINE+2]]:6: error: expected name in binding pattern [ExpectedBindingPattern] +// CHECK:STDERR: ╭─┤ fail_struct_pattern_invalid_introducer.carbon:[[@LINE+6]]:6 +// CHECK:STDERR: -> │ let {!x = x: i32} = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected name in binding pattern [ExpectedBindingPattern] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let {!x = x: i32} = {}; // --- fail_struct_pattern_extra_token_middle.carbon // recover on `=` -// CHECK:STDERR: fail_struct_pattern_extra_token_middle.carbon:[[@LINE+2]]:8: error: expected `= value` after `.field` [ExpectedStructPatternDesignatedField] +// CHECK:STDERR: ╭─┤ fail_struct_pattern_extra_token_middle.carbon:[[@LINE+7]]:8 +// CHECK:STDERR: -> │ let {.x foo = x: ()} = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `= value` after `.field` +// CHECK:STDERR: · ┃ [ExpectedStructPatternDesignatedField] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let {.x foo = x: ()} = {}; // no equals or comma - recover on `}` -// CHECK:STDERR: fail_struct_pattern_extra_token_middle.carbon:[[@LINE+2]]:8: error: expected `= value` after `.field` [ExpectedStructPatternDesignatedField] +// CHECK:STDERR: ╭─┤ fail_struct_pattern_extra_token_middle.carbon:[[@LINE+7]]:8 +// CHECK:STDERR: -> │ let {.x foo x: ()} = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `= value` after `.field` +// CHECK:STDERR: · ┃ [ExpectedStructPatternDesignatedField] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let {.x foo x: ()} = {}; // no equals, trailing comma - recover on `,` -// CHECK:STDERR: fail_struct_pattern_extra_token_middle.carbon:[[@LINE+2]]:8: error: expected `= value` after `.field` [ExpectedStructPatternDesignatedField] +// CHECK:STDERR: ╭─┤ fail_struct_pattern_extra_token_middle.carbon:[[@LINE+7]]:8 +// CHECK:STDERR: -> │ let {.x foo x: (),} = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `= value` after `.field` +// CHECK:STDERR: · ┃ [ExpectedStructPatternDesignatedField] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let {.x foo x: (),} = {}; // no equals, second field - recover on `,` -// CHECK:STDERR: fail_struct_pattern_extra_token_middle.carbon:[[@LINE+2]]:8: error: expected `= value` after `.field` [ExpectedStructPatternDesignatedField] +// CHECK:STDERR: ╭─┤ fail_struct_pattern_extra_token_middle.carbon:[[@LINE+7]]:8 +// CHECK:STDERR: -> │ let {.x foo x: (), .y = y: ()} = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `= value` after `.field` +// CHECK:STDERR: · ┃ [ExpectedStructPatternDesignatedField] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let {.x foo x: (), .y = y: ()} = {}; // --- fail_struct_pattern_invalid_field.carbon -// CHECK:STDERR: fail_struct_pattern_invalid_field.carbon:[[@LINE+2]]:6-10: error: expected name in binding pattern [ExpectedBindingPattern] +// CHECK:STDERR: ╭─┤ fail_struct_pattern_invalid_field.carbon:[[@LINE+6]]:6 +// CHECK:STDERR: -> │ let {"foo" = , .x = x:()} = {}; +// CHECK:STDERR: · ━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: expected name in binding pattern [ExpectedBindingPattern] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let {"foo" = , .x = x:()} = {}; // --- fail_struct_pattern_nested_tuple_pattern.carbon -// CHECK:STDERR: fail_struct_pattern_nested_tuple_pattern.carbon:[[@LINE+2]]:14: error: tuple pattern in shorthand struct pattern field; use `.field = (...)` instead [NestedTuplePatternInStructPatternShortField] +// CHECK:STDERR: ╭─┤ fail_struct_pattern_nested_tuple_pattern.carbon:[[@LINE+8]]:14 +// CHECK:STDERR: -> │ var {x: i32, (y: i32, z: i32)} = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: tuple pattern in shorthand struct pattern field; use +// CHECK:STDERR: · ┃ `.field = (...)` instead +// CHECK:STDERR: · ┃ [NestedTuplePatternInStructPatternShortField] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var {x: i32, (y: i32, z: i32)} = {}; // --- fail_struct_pattern_nested_var_tuple_pattern.carbon -// CHECK:STDERR: fail_struct_pattern_nested_var_tuple_pattern.carbon:[[@LINE+2]]:18: error: tuple pattern in shorthand struct pattern field; use `.field = (...)` instead [NestedTuplePatternInStructPatternShortField] +// CHECK:STDERR: ╭─┤ fail_struct_pattern_nested_var_tuple_pattern.carbon:[[@LINE+8]]:18 +// CHECK:STDERR: -> │ let {x: i32, var (y: i32, z: i32)} = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: tuple pattern in shorthand struct pattern field; +// CHECK:STDERR: · ┃ use `.field = (...)` instead +// CHECK:STDERR: · ┃ [NestedTuplePatternInStructPatternShortField] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let {x: i32, var (y: i32, z: i32)} = {}; // --- fail_struct_pattern_nested_struct_pattern.carbon -// CHECK:STDERR: fail_struct_pattern_nested_struct_pattern.carbon:[[@LINE+2]]:13: error: struct pattern in shorthand struct pattern field; use `.field = {...}` instead [NestedStructPatternStructPatternShortField] +// CHECK:STDERR: ╭─┤ fail_struct_pattern_nested_struct_pattern.carbon:[[@LINE+8]]:13 +// CHECK:STDERR: -> │ let{x: i32, {y: i32, z: i32}} = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: struct pattern in shorthand struct pattern field; use +// CHECK:STDERR: · ┃ `.field = {...}` instead +// CHECK:STDERR: · ┃ [NestedStructPatternStructPatternShortField] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let{x: i32, {y: i32, z: i32}} = {}; // --- fail_struct_pattern_unused_shorthand.carbon -// CHECK:STDERR: fail_struct_pattern_unused_shorthand.carbon:[[@LINE+2]]:6: error: anonymous binding found in struct pattern; use `.field = _: field_type` or `unused field: field_type` [AnonymousBindingInStructPattern] +// CHECK:STDERR: ╭─┤ fail_struct_pattern_unused_shorthand.carbon:[[@LINE+8]]:6 +// CHECK:STDERR: -> │ var {_: i32} = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: anonymous binding found in struct pattern; use +// CHECK:STDERR: · ┃ `.field = _: field_type` or `unused field: field_type` +// CHECK:STDERR: · ┃ [AnonymousBindingInStructPattern] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var {_: i32} = {}; -// CHECK:STDERR: fail_struct_pattern_unused_shorthand.carbon:[[@LINE+2]]:10: error: anonymous binding found in struct pattern; use `.field = _: field_type` or `unused field: field_type` [AnonymousBindingInStructPattern] +// CHECK:STDERR: ╭─┤ fail_struct_pattern_unused_shorthand.carbon:[[@LINE+8]]:10 +// CHECK:STDERR: -> │ let {ref _: i32} = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: anonymous binding found in struct pattern; use +// CHECK:STDERR: · ┃ `.field = _: field_type` or `unused field: field_type` +// CHECK:STDERR: · ┃ [AnonymousBindingInStructPattern] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let {ref _: i32} = {}; -// CHECK:STDERR: fail_struct_pattern_unused_shorthand.carbon:[[@LINE+2]]:10: error: anonymous binding found in struct pattern; use `.field = _: field_type` or `unused field: field_type` [AnonymousBindingInStructPattern] +// CHECK:STDERR: ╭─┤ fail_struct_pattern_unused_shorthand.carbon:[[@LINE+8]]:10 +// CHECK:STDERR: -> │ let {var _: i32} = {}; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: anonymous binding found in struct pattern; use +// CHECK:STDERR: · ┃ `.field = _: field_type` or `unused field: field_type` +// CHECK:STDERR: · ┃ [AnonymousBindingInStructPattern] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let {var _: i32} = {}; diff --git a/toolchain/parse/testdata/typeof/basic.carbon b/toolchain/parse/testdata/typeof/basic.carbon index 5fcf1221291d..43ef12c6fdc3 100644 --- a/toolchain/parse/testdata/typeof/basic.carbon +++ b/toolchain/parse/testdata/typeof/basic.carbon @@ -20,48 +20,91 @@ fn F() { // --- fail_no_paren.carbon -// CHECK:STDERR: fail_no_paren.carbon:[[@LINE+2]]:15: error: expected `(` after `typeof` [ExpectedParenAfter] +// CHECK:STDERR: ╭─┤ fail_no_paren.carbon:[[@LINE+6]]:15 +// CHECK:STDERR: -> │ var x: typeof y; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected `(` after `typeof` [ExpectedParenAfter] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: typeof y; // --- fail_no_expr.carbon -// CHECK:STDERR: fail_no_expr.carbon:[[@LINE+2]]:15: error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╭─┤ fail_no_expr.carbon:[[@LINE+6]]:15 +// CHECK:STDERR: -> │ var x: typeof(); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: typeof(); // --- fail_no_close_paren.carbon -// CHECK:STDERR: fail_no_close_paren.carbon:[[@LINE+3]]:17: error: unexpected tokens before `)` [ExpectedCloseSymbol] -// CHECK:STDERR: fail_no_close_paren.carbon:[[@LINE+2]]:14: note: matching this `(` [GroupOpenedHere] +// CHECK:STDERR: ╭─┤ fail_no_close_paren.carbon:[[@LINE+7]]:17 +// CHECK:STDERR: -> │ var x: typeof(y z); +// CHECK:STDERR: · ┬ ┳ +// CHECK:STDERR: · │ ┗━━┫ error: unexpected tokens before `)` [ExpectedCloseSymbol] +// CHECK:STDERR: · ╰───────┤ matching this `(` [GroupOpenedHere] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: typeof(y z); // --- fail_no_close_paren_multiline.carbon var x: typeof(y - // CHECK:STDERR: fail_no_close_paren_multiline.carbon:[[@LINE+3]]:15: error: unexpected tokens before `)` [ExpectedCloseSymbol] - // CHECK:STDERR: fail_no_close_paren_multiline.carbon:[[@LINE-2]]:14: note: matching this `(` [GroupOpenedHere] + // CHECK:STDERR: ╭─┤ fail_no_close_paren_multiline.carbon:[[@LINE+10]]:15 + // CHECK:STDERR: │ var x: typeof(y + // CHECK:STDERR: · ┬ + // CHECK:STDERR: · ╰──┤ matching this `(` [GroupOpenedHere] + // CHECK:STDERR: ┆ + // CHECK:STDERR: -> │ z); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: unexpected tokens before `)` [ExpectedCloseSymbol] + // CHECK:STDERR: ╰──── // CHECK:STDERR: z); // --- fail_no_close_paren_before_eof_at_eof.carbon -// CHECK:STDERR: fail_no_close_paren_before_eof_at_eof.carbon:[[@LINE+7]]:14: error: opening symbol without a corresponding closing symbol [UnmatchedOpening] -// CHECK:STDERR: fail_no_close_paren_before_eof_at_eof.carbon:[[@LINE+6]]:15: note: possibly missing `)` here [PossiblyMissingBracketHere] +// CHECK:STDERR: ╭─┤ fail_no_close_paren_before_eof_at_eof.carbon:[[@LINE+21]]:14 +// CHECK:STDERR: -> │ var x: typeof( +// CHECK:STDERR: · ╻╷ +// CHECK:STDERR: · ┗━━━┫ error: opening symbol without a corresponding closing symbol +// CHECK:STDERR: · │ ┃ [UnmatchedOpening] +// CHECK:STDERR: · ╰────┤ possibly missing `)` here [PossiblyMissingBracketHere] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_no_close_paren_before_eof_at_eof.carbon:[[@LINE+4]]:15: error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╭─┤ fail_no_close_paren_before_eof_at_eof.carbon:[[@LINE+13]]:15 +// CHECK:STDERR: -> │ var x: typeof( +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_no_close_paren_before_eof_at_eof.carbon:[[@LINE+2]]:15: error: `var` declarations must end with a `;` [ExpectedDeclSemi] +// CHECK:STDERR: ╭─┤ fail_no_close_paren_before_eof_at_eof.carbon:[[@LINE+7]]:15 +// CHECK:STDERR: -> │ var x: typeof( +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `var` declarations must end with a `;` +// CHECK:STDERR: · ┃ [ExpectedDeclSemi] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: typeof( // --- fail_no_close_paren_after_expr_at_eof.carbon -// CHECK:STDERR: fail_no_close_paren_after_expr_at_eof.carbon:[[@LINE+5]]:14: error: opening symbol without a corresponding closing symbol [UnmatchedOpening] -// CHECK:STDERR: fail_no_close_paren_after_expr_at_eof.carbon:[[@LINE+4]]:16: note: possibly missing `)` here [PossiblyMissingBracketHere] +// CHECK:STDERR: ╭─┤ fail_no_close_paren_after_expr_at_eof.carbon:[[@LINE+15]]:14 +// CHECK:STDERR: -> │ var x: typeof(y +// CHECK:STDERR: · ┳ ┬ +// CHECK:STDERR: · ┗━━━━┫ error: opening symbol without a corresponding closing symbol +// CHECK:STDERR: · │ ┃ [UnmatchedOpening] +// CHECK:STDERR: · ╰────┤ possibly missing `)` here [PossiblyMissingBracketHere] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_no_close_paren_after_expr_at_eof.carbon:[[@LINE+2]]:16: error: `var` declarations must end with a `;` [ExpectedDeclSemi] +// CHECK:STDERR: ╭─┤ fail_no_close_paren_after_expr_at_eof.carbon:[[@LINE+7]]:16 +// CHECK:STDERR: -> │ var x: typeof(y +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `var` declarations must end with a `;` +// CHECK:STDERR: · ┃ [ExpectedDeclSemi] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: typeof(y diff --git a/toolchain/parse/testdata/var/fail_bad_name.carbon b/toolchain/parse/testdata/var/fail_bad_name.carbon index f7fe1cf20448..f2dbd4d5d1bf 100644 --- a/toolchain/parse/testdata/var/fail_bad_name.carbon +++ b/toolchain/parse/testdata/var/fail_bad_name.carbon @@ -8,15 +8,31 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/var/fail_bad_name.carbon -// CHECK:STDERR: fail_bad_name.carbon:[[@LINE+2]]:6: error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╭─┤ fail_bad_name.carbon:[[@LINE+6]]:6 +// CHECK:STDERR: -> │ var *; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var *; -// CHECK:STDERR: fail_bad_name.carbon:[[@LINE+2]]:5-10: error: expected name in binding pattern; prefix reserved word with `r#` to form a valid identifier [ExpectedBindingPattern] +// CHECK:STDERR: ╭─┤ fail_bad_name.carbon:[[@LINE+8]]:5 +// CHECK:STDERR: -> │ var choice: i32; +// CHECK:STDERR: · ┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: expected name in binding pattern; prefix reserved word with `r#` +// CHECK:STDERR: · ┃ to form a valid identifier +// CHECK:STDERR: · ┃ [ExpectedBindingPattern] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var choice: i32; -// CHECK:STDERR: fail_bad_name.carbon:[[@LINE+2]]:5-6: error: expected name in binding pattern; prefix reserved word with `r#` to form a valid identifier [ExpectedBindingPattern] +// CHECK:STDERR: ╭─┤ fail_bad_name.carbon:[[@LINE+8]]:5 +// CHECK:STDERR: -> │ var f2: f32; +// CHECK:STDERR: · ┳━ +// CHECK:STDERR: · ┗━━┫ error: expected name in binding pattern; prefix reserved word with `r#` +// CHECK:STDERR: · ┃ to form a valid identifier +// CHECK:STDERR: · ┃ [ExpectedBindingPattern] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var f2: f32; diff --git a/toolchain/parse/testdata/var/fail_empty.carbon b/toolchain/parse/testdata/var/fail_empty.carbon index f92ef1675f83..1bbe45482f2b 100644 --- a/toolchain/parse/testdata/var/fail_empty.carbon +++ b/toolchain/parse/testdata/var/fail_empty.carbon @@ -8,7 +8,11 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/var/fail_empty.carbon -// CHECK:STDERR: fail_empty.carbon:[[@LINE+2]]:4: error: expected pattern [ExpectedPattern] +// CHECK:STDERR: ╭─┤ fail_empty.carbon:[[@LINE+6]]:4 +// CHECK:STDERR: -> │ var; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected pattern [ExpectedPattern] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var; diff --git a/toolchain/parse/testdata/var/fail_in_interface.carbon b/toolchain/parse/testdata/var/fail_in_interface.carbon index 02d03547cc00..ebd981ea9df8 100644 --- a/toolchain/parse/testdata/var/fail_in_interface.carbon +++ b/toolchain/parse/testdata/var/fail_in_interface.carbon @@ -9,19 +9,37 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/var/fail_in_interface.carbon interface I { - // CHECK:STDERR: fail_in_interface.carbon:[[@LINE+2]]:6: error: expected identifier in associated constant declaration [ExpectedAssociatedConstantIdentifier] + // CHECK:STDERR: ╭─┤ fail_in_interface.carbon:[[@LINE+7]]:6 + // CHECK:STDERR: -> │ let var a: (); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected identifier in associated constant declaration + // CHECK:STDERR: · ┃ [ExpectedAssociatedConstantIdentifier] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let var a: (); - // CHECK:STDERR: fail_in_interface.carbon:[[@LINE+2]]:3-5: error: unrecognized declaration introducer [UnrecognizedDecl] + // CHECK:STDERR: ╭─┤ fail_in_interface.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ var b: (); + // CHECK:STDERR: · ━┳━ + // CHECK:STDERR: · ┗━━┫ error: unrecognized declaration introducer [UnrecognizedDecl] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var b: (); - // CHECK:STDERR: fail_in_interface.carbon:[[@LINE+2]]:6: error: expected identifier in associated constant declaration [ExpectedAssociatedConstantIdentifier] + // CHECK:STDERR: ╭─┤ fail_in_interface.carbon:[[@LINE+7]]:6 + // CHECK:STDERR: -> │ let var c: (); + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected identifier in associated constant declaration + // CHECK:STDERR: · ┃ [ExpectedAssociatedConstantIdentifier] + // CHECK:STDERR: ╰──── // CHECK:STDERR: let var c: (); - // CHECK:STDERR: fail_in_interface.carbon:[[@LINE+2]]:3-5: error: unrecognized declaration introducer [UnrecognizedDecl] + // CHECK:STDERR: ╭─┤ fail_in_interface.carbon:[[@LINE+6]]:3 + // CHECK:STDERR: -> │ var d: (); + // CHECK:STDERR: · ━┳━ + // CHECK:STDERR: · ┗━━┫ error: unrecognized declaration introducer [UnrecognizedDecl] + // CHECK:STDERR: ╰──── // CHECK:STDERR: var d: (); } diff --git a/toolchain/parse/testdata/var/fail_no_semi.carbon b/toolchain/parse/testdata/var/fail_no_semi.carbon index f700b77c3609..a3da8ee78370 100644 --- a/toolchain/parse/testdata/var/fail_no_semi.carbon +++ b/toolchain/parse/testdata/var/fail_no_semi.carbon @@ -8,9 +8,17 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/var/fail_no_semi.carbon -// CHECK:STDERR: fail_no_semi.carbon:[[@LINE+4]]:4: error: expected pattern [ExpectedPattern] +// CHECK:STDERR: ╭─┤ fail_no_semi.carbon:[[@LINE+12]]:4 +// CHECK:STDERR: -> │ var +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected pattern [ExpectedPattern] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_no_semi.carbon:[[@LINE+2]]:4: error: `var` declarations must end with a `;` [ExpectedDeclSemi] +// CHECK:STDERR: ╭─┤ fail_no_semi.carbon:[[@LINE+6]]:4 +// CHECK:STDERR: -> │ var +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `var` declarations must end with a `;` [ExpectedDeclSemi] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var diff --git a/toolchain/parse/testdata/var/fail_ref.carbon b/toolchain/parse/testdata/var/fail_ref.carbon index 342005352d0e..4bd4835282b6 100644 --- a/toolchain/parse/testdata/var/fail_ref.carbon +++ b/toolchain/parse/testdata/var/fail_ref.carbon @@ -8,7 +8,11 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/var/fail_ref.carbon -// CHECK:STDERR: fail_ref.carbon:[[@LINE+2]]:5-7: error: found `ref` inside `var` pattern [RefInsideVar] +// CHECK:STDERR: ╭─┤ fail_ref.carbon:[[@LINE+6]]:5 +// CHECK:STDERR: -> │ var ref x: i32 = 0; +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┗━━┫ error: found `ref` inside `var` pattern [RefInsideVar] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var ref x: i32 = 0; diff --git a/toolchain/parse/testdata/var/fail_runtime.carbon b/toolchain/parse/testdata/var/fail_runtime.carbon index 44f0c477a33c..d3108a36179e 100644 --- a/toolchain/parse/testdata/var/fail_runtime.carbon +++ b/toolchain/parse/testdata/var/fail_runtime.carbon @@ -8,15 +8,38 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/var/fail_runtime.carbon -// CHECK:STDERR: fail_runtime.carbon:[[@LINE+10]]:5-11: error: `runtime` is redundant here; this binding is runtime by default [RedundantRuntimeModifier] +// CHECK:STDERR: ╭─┤ fail_runtime.carbon:[[@LINE+33]]:5 +// CHECK:STDERR: -> │ var runtime u:| +// CHECK:STDERR: · ━┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: `runtime` is redundant here; this binding is runtime by default +// CHECK:STDERR: · ┃ [RedundantRuntimeModifier] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_runtime.carbon:[[@LINE+8]]:15: error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╭─┤ fail_runtime.carbon:[[@LINE+26]]:15 +// CHECK:STDERR: -> │ var runtime u:| +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_runtime.carbon:[[@LINE+6]]:15: error: whitespace missing before binary operator [BinaryOperatorRequiresWhitespace] +// CHECK:STDERR: ╭─┤ fail_runtime.carbon:[[@LINE+20]]:15 +// CHECK:STDERR: -> │ var runtime u:| +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: whitespace missing before binary operator +// CHECK:STDERR: · ┃ [BinaryOperatorRequiresWhitespace] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_runtime.carbon:[[@LINE+4]]:16: error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╭─┤ fail_runtime.carbon:[[@LINE+13]]:16 +// CHECK:STDERR: -> │ var runtime u:| +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_runtime.carbon:[[@LINE+2]]:16: error: `var` declarations must end with a `;` [ExpectedDeclSemi] +// CHECK:STDERR: ╭─┤ fail_runtime.carbon:[[@LINE+7]]:16 +// CHECK:STDERR: -> │ var runtime u:| +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `var` declarations must end with a `;` +// CHECK:STDERR: · ┃ [ExpectedDeclSemi] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var runtime u:| diff --git a/toolchain/parse/testdata/var/unused.carbon b/toolchain/parse/testdata/var/unused.carbon index c0768d8c7239..83d5d17d0f60 100644 --- a/toolchain/parse/testdata/var/unused.carbon +++ b/toolchain/parse/testdata/var/unused.carbon @@ -10,7 +10,11 @@ // --- fail_unused_does_not_start_declaration.carbon -// CHECK:STDERR: fail_unused_does_not_start_declaration.carbon:[[@LINE+2]]:1-6: error: unrecognized declaration introducer [UnrecognizedDecl] +// CHECK:STDERR: ╭─┤ fail_unused_does_not_start_declaration.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ unused y: i32; +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: unrecognized declaration introducer [UnrecognizedDecl] +// CHECK:STDERR: ╰──── // CHECK:STDERR: unused y: i32; @@ -62,19 +66,33 @@ fn F(x: (), unused var y: ()); // --- fail_ref_unused.carbon -// CHECK:STDERR: fail_ref_unused.carbon:[[@LINE+2]]:10-15: error: `unused` must be written before `ref` [UnusedAfterBindingModifier] +// CHECK:STDERR: ╭─┤ fail_ref_unused.carbon:[[@LINE+7]]:10 +// CHECK:STDERR: -> │ fn F(ref unused y: i32); +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: `unused` must be written before `ref` +// CHECK:STDERR: · ┃ [UnusedAfterBindingModifier] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn F(ref unused y: i32); // --- fail_nested.carbon -// CHECK:STDERR: fail_nested.carbon:[[@LINE+2]]:12-17: error: `unused` nested within another `unused` [NestedUnused] +// CHECK:STDERR: ╭─┤ fail_nested.carbon:[[@LINE+6]]:12 +// CHECK:STDERR: -> │ var unused unused x: i32 = 0; +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: `unused` nested within another `unused` [NestedUnused] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var unused unused x: i32 = 0; // --- fail_nested_parens.carbon -// CHECK:STDERR: fail_nested_parens.carbon:[[@LINE+2]]:13-18: error: `unused` nested within another `unused` [NestedUnused] +// CHECK:STDERR: ╭─┤ fail_nested_parens.carbon:[[@LINE+7]]:13 +// CHECK:STDERR: -> │ var unused (unused y: i32) = (0,); +// CHECK:STDERR: · ━━━┳━━ +// CHECK:STDERR: · ┗━━┫ error: `unused` nested within another `unused` +// CHECK:STDERR: · ┃ [NestedUnused] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var unused (unused y: i32) = (0,); diff --git a/toolchain/parse/testdata/var/var_pattern.carbon b/toolchain/parse/testdata/var/var_pattern.carbon index 3a3561b4c840..4b4ec1ce52f9 100644 --- a/toolchain/parse/testdata/var/var_pattern.carbon +++ b/toolchain/parse/testdata/var/var_pattern.carbon @@ -30,7 +30,12 @@ let {var y: ()} = {.y = ()}; // --- fail_nested.carbon -// CHECK:STDERR: fail_nested.carbon:[[@LINE+2]]:25-27: error: `var` nested within another `var` [NestedVar] +// CHECK:STDERR: ╭─┤ fail_nested.carbon:[[@LINE+7]]:25 +// CHECK:STDERR: -> │ let (x: (), var (y: (), var z: ())) = ((), ((), ())); +// CHECK:STDERR: · ━┳━ +// CHECK:STDERR: · ┗━━┫ error: `var` nested within another `var` +// CHECK:STDERR: · ┃ [NestedVar] +// CHECK:STDERR: ╰──── // CHECK:STDERR: let (x: (), var (y: (), var z: ())) = ((), ((), ())); diff --git a/toolchain/parse/testdata/variadics/expand.carbon b/toolchain/parse/testdata/variadics/expand.carbon index d72a7e9bd5ce..b0016ffe3437 100644 --- a/toolchain/parse/testdata/variadics/expand.carbon +++ b/toolchain/parse/testdata/variadics/expand.carbon @@ -28,13 +28,24 @@ var i: auto = -expand x; // --- fail_under_not.carbon // Like prefix `*`, `expand` requires parentheses under `not`. -// CHECK:STDERR: fail_under_not.carbon:[[@LINE+2]]:19-24: error: parentheses are required around this unary `expand` operator [UnaryOperatorRequiresParentheses] +// CHECK:STDERR: ╭─┤ fail_under_not.carbon:[[@LINE+8]]:19 +// CHECK:STDERR: -> │ var a: auto = not expand x; +// CHECK:STDERR: · ┳━━━━━ +// CHECK:STDERR: · ┗━━┫ error: parentheses are required around this unary +// CHECK:STDERR: · ┃ `expand` operator +// CHECK:STDERR: · ┃ [UnaryOperatorRequiresParentheses] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var a: auto = not expand x; // --- fail_as_postfix.carbon -// CHECK:STDERR: fail_as_postfix.carbon:[[@LINE+2]]:16: error: `var` declarations must end with a `;` [ExpectedDeclSemi] +// CHECK:STDERR: ╭─┤ fail_as_postfix.carbon:[[@LINE+7]]:16 +// CHECK:STDERR: -> │ var a: auto = x expand; +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `var` declarations must end with a `;` +// CHECK:STDERR: · ┃ [ExpectedDeclSemi] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var a: auto = x expand; diff --git a/toolchain/parse/testdata/variadics/pack_expansion_statement.carbon b/toolchain/parse/testdata/variadics/pack_expansion_statement.carbon index e657322940dc..d37217f7bf1d 100644 --- a/toolchain/parse/testdata/variadics/pack_expansion_statement.carbon +++ b/toolchain/parse/testdata/variadics/pack_expansion_statement.carbon @@ -42,14 +42,22 @@ fn F() { fn F() { ... -// CHECK:STDERR: fail_missing_statement.carbon:[[@LINE+2]]:1: error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╭─┤ fail_missing_statement.carbon:[[@LINE+6]]:1 +// CHECK:STDERR: -> │ } +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: } // --- fail_missing_semi.carbon fn F() { - // CHECK:STDERR: fail_missing_semi.carbon:[[@LINE+2]]:10: error: expected `;` after expression statement [ExpectedExprSemi] + // CHECK:STDERR: ╭─┤ fail_missing_semi.carbon:[[@LINE+6]]:10 + // CHECK:STDERR: -> │ ... G() + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `;` after expression statement [ExpectedExprSemi] + // CHECK:STDERR: ╰──── // CHECK:STDERR: ... G() } diff --git a/toolchain/parse/testdata/where_expr/designators.carbon b/toolchain/parse/testdata/where_expr/designators.carbon index 8d4fa4a37d09..d5253719ce7b 100644 --- a/toolchain/parse/testdata/where_expr/designators.carbon +++ b/toolchain/parse/testdata/where_expr/designators.carbon @@ -18,7 +18,12 @@ fn Success() { // --- fail_numeric_designator.carbon fn FailNumeric() { - // CHECK:STDERR: fail_numeric_designator.carbon:[[@LINE+2]]:4: error: expected identifier or `Self` after `.` [ExpectedIdentifierOrSelfAfterPeriod] + // CHECK:STDERR: ╭─┤ fail_numeric_designator.carbon:[[@LINE+7]]:4 + // CHECK:STDERR: -> │ .1; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected identifier or `Self` after `.` + // CHECK:STDERR: · ┃ [ExpectedIdentifierOrSelfAfterPeriod] + // CHECK:STDERR: ╰──── // CHECK:STDERR: .1; } @@ -26,7 +31,13 @@ fn FailNumeric() { // --- fail_keyword_designator.carbon fn FailKeyword() { - // CHECK:STDERR: fail_keyword_designator.carbon:[[@LINE+2]]:4-7: error: expected identifier or `Self` after `.`; prefix reserved word with `r#` to form a valid identifier [ExpectedIdentifierOrSelfAfterPeriod] + // CHECK:STDERR: ╭─┤ fail_keyword_designator.carbon:[[@LINE+8]]:4 + // CHECK:STDERR: -> │ .base; + // CHECK:STDERR: · ┳━━━ + // CHECK:STDERR: · ┗━━┫ error: expected identifier or `Self` after `.`; prefix reserved word + // CHECK:STDERR: · ┃ with `r#` to form a valid identifier + // CHECK:STDERR: · ┃ [ExpectedIdentifierOrSelfAfterPeriod] + // CHECK:STDERR: ╰──── // CHECK:STDERR: .base; } @@ -34,7 +45,12 @@ fn FailKeyword() { // --- fail_empty_designator.carbon fn FailEmpty() { - // CHECK:STDERR: fail_empty_designator.carbon:[[@LINE+2]]:4: error: expected identifier or `Self` after `.` [ExpectedIdentifierOrSelfAfterPeriod] + // CHECK:STDERR: ╭─┤ fail_empty_designator.carbon:[[@LINE+7]]:4 + // CHECK:STDERR: -> │ .; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected identifier or `Self` after `.` + // CHECK:STDERR: · ┃ [ExpectedIdentifierOrSelfAfterPeriod] + // CHECK:STDERR: ╰──── // CHECK:STDERR: .; } @@ -42,16 +58,31 @@ fn FailEmpty() { // --- fail_star_designator.carbon fn FailStar() { - // CHECK:STDERR: fail_star_designator.carbon:[[@LINE+2]]:4: error: expected identifier or `Self` after `.` [ExpectedIdentifierOrSelfAfterPeriod] + // CHECK:STDERR: ╭─┤ fail_star_designator.carbon:[[@LINE+7]]:4 + // CHECK:STDERR: -> │ .*; + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected identifier or `Self` after `.` + // CHECK:STDERR: · ┃ [ExpectedIdentifierOrSelfAfterPeriod] + // CHECK:STDERR: ╰──── // CHECK:STDERR: .*; } // --- fail_designator_eof.carbon -// CHECK:STDERR: fail_designator_eof.carbon:[[@LINE+4]]:15: error: expected identifier or `Self` after `.` [ExpectedIdentifierOrSelfAfterPeriod] +// CHECK:STDERR: ╭─┤ fail_designator_eof.carbon:[[@LINE+14]]:15 +// CHECK:STDERR: -> │ var x: i32 = . +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected identifier or `Self` after `.` +// CHECK:STDERR: · ┃ [ExpectedIdentifierOrSelfAfterPeriod] +// CHECK:STDERR: ╰──── // CHECK:STDERR: -// CHECK:STDERR: fail_designator_eof.carbon:[[@LINE+2]]:15: error: `var` declarations must end with a `;` [ExpectedDeclSemi] +// CHECK:STDERR: ╭─┤ fail_designator_eof.carbon:[[@LINE+7]]:15 +// CHECK:STDERR: -> │ var x: i32 = . +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: `var` declarations must end with a `;` +// CHECK:STDERR: · ┃ [ExpectedDeclSemi] +// CHECK:STDERR: ╰──── // CHECK:STDERR: var x: i32 = . diff --git a/toolchain/parse/testdata/where_expr/fail_rewrite.carbon b/toolchain/parse/testdata/where_expr/fail_rewrite.carbon index 4bf6f2f09dd0..d7283566941c 100644 --- a/toolchain/parse/testdata/where_expr/fail_rewrite.carbon +++ b/toolchain/parse/testdata/where_expr/fail_rewrite.carbon @@ -13,43 +13,96 @@ // --- fail_not_designator.carbon -// CHECK:STDERR: fail_not_designator.carbon:[[@LINE+2]]:44: error: requirement can only use `=` after `.member` designator [RequirementEqualAfterNonDesignator] +// CHECK:STDERR: ╭─┤ fail_not_designator.carbon:[[@LINE+9]]:44 +// CHECK:STDERR: -> │ fn NotDesignator(generic T: type where i32 = .U); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: requirement can only use +// CHECK:STDERR: · ┃ `=` after `.member` +// CHECK:STDERR: · ┃ designator +// CHECK:STDERR: · ┃ [RequirementEqualAfterNonDesignator] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn NotDesignator(generic T: type where i32 = .U); // --- fail_designator_in_parens.carbon -// CHECK:STDERR: fail_designator_in_parens.carbon:[[@LINE+2]]:47: error: requirement can only use `=` after `.member` designator [RequirementEqualAfterNonDesignator] +// CHECK:STDERR: ╭─┤ fail_designator_in_parens.carbon:[[@LINE+9]]:47 +// CHECK:STDERR: -> │ fn DesignatorInParens(generic V: I where (.J) = bool); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: requirement can only +// CHECK:STDERR: · ┃ use `=` after +// CHECK:STDERR: · ┃ `.member` designator +// CHECK:STDERR: · ┃ [RequirementEqualAfterNonDesignator] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn DesignatorInParens(generic V: I where (.J) = bool); // --- fail_dot_self.carbon -// CHECK:STDERR: fail_dot_self.carbon:[[@LINE+2]]:37: error: requirement can only use `=` after `.member` designator [RequirementEqualAfterNonDesignator] +// CHECK:STDERR: ╭─┤ fail_dot_self.carbon:[[@LINE+8]]:37 +// CHECK:STDERR: -> │ fn DotSelf(generic W: K where .Self = f32); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: requirement can only use `=` +// CHECK:STDERR: · ┃ after `.member` designator +// CHECK:STDERR: · ┃ [RequirementEqualAfterNonDesignator] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn DotSelf(generic W: K where .Self = f32); // --- fail_dot_keyword.carbon -// CHECK:STDERR: fail_dot_keyword.carbon:[[@LINE+2]]:35-37: error: expected identifier or `Self` after `.`; prefix reserved word with `r#` to form a valid identifier [ExpectedIdentifierOrSelfAfterPeriod] +// CHECK:STDERR: ╭─┤ fail_dot_keyword.carbon:[[@LINE+10]]:35 +// CHECK:STDERR: -> │ fn DotKeyword(generic W: K where .and = u8); +// CHECK:STDERR: · ┳━━ +// CHECK:STDERR: · ┗━━┫ error: expected identifier or `Self` +// CHECK:STDERR: · ┃ after `.`; prefix reserved word +// CHECK:STDERR: · ┃ with `r#` to form a valid +// CHECK:STDERR: · ┃ identifier +// CHECK:STDERR: · ┃ [ExpectedIdentifierOrSelfAfterPeriod] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn DotKeyword(generic W: K where .and = u8); // --- fail_postfix_after_designator.carbon -// CHECK:STDERR: fail_postfix_after_designator.carbon:[[@LINE+2]]:50: error: requirement can only use `=` after `.member` designator [RequirementEqualAfterNonDesignator] +// CHECK:STDERR: ╭─┤ fail_postfix_after_designator.carbon:[[@LINE+10]]:50 +// CHECK:STDERR: -> │ fn PostfixAfterDesignator(generic X: L where .M* = u64*); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: requirement can +// CHECK:STDERR: · ┃ only use `=` after +// CHECK:STDERR: · ┃ `.member` +// CHECK:STDERR: · ┃ designator +// CHECK:STDERR: · ┃ [RequirementEqualAfterNonDesignator] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn PostfixAfterDesignator(generic X: L where .M* = u64*); // --- fail_binary_op_after_designator.carbon -// CHECK:STDERR: fail_binary_op_after_designator.carbon:[[@LINE+2]]:55: error: requirement can only use `=` after `.member` designator [RequirementEqualAfterNonDesignator] +// CHECK:STDERR: ╭─┤ fail_binary_op_after_designator.carbon:[[@LINE+11]]:55 +// CHECK:STDERR: -> │ fn BinaryOpAfterDesignator(generic Y: N where .O + .P = {}); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: requirement +// CHECK:STDERR: · ┃ can only use +// CHECK:STDERR: · ┃ `=` after +// CHECK:STDERR: · ┃ `.member` +// CHECK:STDERR: · ┃ designator +// CHECK:STDERR: · ┃ [RequirementEqualAfterNonDesignator] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn BinaryOpAfterDesignator(generic Y: N where .O + .P = {}); // --- fail_after_and.carbon -// CHECK:STDERR: fail_after_and.carbon:[[@LINE+2]]:50: error: requirement can only use `=` after `.member` designator [RequirementEqualAfterNonDesignator] +// CHECK:STDERR: ╭─┤ fail_after_and.carbon:[[@LINE+10]]:50 +// CHECK:STDERR: -> │ fn AfterAnd(generic Z: Q where .R impls S and () = .A); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: requirement can +// CHECK:STDERR: · ┃ only use `=` after +// CHECK:STDERR: · ┃ `.member` +// CHECK:STDERR: · ┃ designator +// CHECK:STDERR: · ┃ [RequirementEqualAfterNonDesignator] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn AfterAnd(generic Z: Q where .R impls S and () = .A); diff --git a/toolchain/parse/testdata/where_expr/where_and.carbon b/toolchain/parse/testdata/where_expr/where_and.carbon index ac27531ade8d..86e2eb6f3483 100644 --- a/toolchain/parse/testdata/where_expr/where_and.carbon +++ b/toolchain/parse/testdata/where_expr/where_and.carbon @@ -16,19 +16,34 @@ fn TwoAnd(generic Y: I where .J impls K and .L == .M and .N = bool); // --- fail_and_prefix.carbon -// CHECK:STDERR: fail_and_prefix.carbon:[[@LINE+2]]:35: error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╭─┤ fail_and_prefix.carbon:[[@LINE+6]]:35 +// CHECK:STDERR: -> │ fn AndPrefix(generic T: type where and .V == .W); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn AndPrefix(generic T: type where and .V == .W); // --- fail_and_suffix.carbon -// CHECK:STDERR: fail_and_suffix.carbon:[[@LINE+2]]:47: error: expected expression [ExpectedExpr] +// CHECK:STDERR: ╭─┤ fail_and_suffix.carbon:[[@LINE+7]]:47 +// CHECK:STDERR: -> │ fn AndSuffix(generic Y: I where .J impls K and); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: expected expression +// CHECK:STDERR: · ┃ [ExpectedExpr] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn AndSuffix(generic Y: I where .J impls K and); // --- fail_and_early.carbon -// CHECK:STDERR: fail_and_early.carbon:[[@LINE+2]]:34: error: requirement should use `impls`, `=`, or `==` operator [ExpectedRequirementOperator] +// CHECK:STDERR: ╭─┤ fail_and_early.carbon:[[@LINE+8]]:34 +// CHECK:STDERR: -> │ fn AndEarly(generic Z: L where .M and N); +// CHECK:STDERR: · ┳ +// CHECK:STDERR: · ┗━━┫ error: requirement should use `impls`, +// CHECK:STDERR: · ┃ `=`, or `==` operator +// CHECK:STDERR: · ┃ [ExpectedRequirementOperator] +// CHECK:STDERR: ╰──── // CHECK:STDERR: fn AndEarly(generic Z: L where .M and N); diff --git a/toolchain/parse/testdata/while/fail_missing_cond.carbon b/toolchain/parse/testdata/while/fail_missing_cond.carbon index 4c57503ca836..8bdeceba3d16 100644 --- a/toolchain/parse/testdata/while/fail_missing_cond.carbon +++ b/toolchain/parse/testdata/while/fail_missing_cond.carbon @@ -9,7 +9,11 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/while/fail_missing_cond.carbon fn F() { - // CHECK:STDERR: fail_missing_cond.carbon:[[@LINE+2]]:9: error: expected `(` after `while` [ExpectedParenAfter] + // CHECK:STDERR: ╭─┤ fail_missing_cond.carbon:[[@LINE+6]]:9 + // CHECK:STDERR: -> │ while { + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected `(` after `while` [ExpectedParenAfter] + // CHECK:STDERR: ╰──── // CHECK:STDERR: while { } diff --git a/toolchain/parse/testdata/while/fail_no_semi.carbon b/toolchain/parse/testdata/while/fail_no_semi.carbon index cbc2d4ab4804..30f6dfb0e3e1 100644 --- a/toolchain/parse/testdata/while/fail_no_semi.carbon +++ b/toolchain/parse/testdata/while/fail_no_semi.carbon @@ -11,12 +11,22 @@ fn F() { while (a) { if (b) { - // CHECK:STDERR: fail_no_semi.carbon:[[@LINE+2]]:12: error: `break` statements must end with a `;` [ExpectedStatementSemi] + // CHECK:STDERR: ╭─┤ fail_no_semi.carbon:[[@LINE+7]]:12 + // CHECK:STDERR: -> │ break + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: `break` statements must end with a `;` + // CHECK:STDERR: · ┃ [ExpectedStatementSemi] + // CHECK:STDERR: ╰──── // CHECK:STDERR: break } if (c) { - // CHECK:STDERR: fail_no_semi.carbon:[[@LINE+2]]:15: error: `continue` statements must end with a `;` [ExpectedStatementSemi] + // CHECK:STDERR: ╭─┤ fail_no_semi.carbon:[[@LINE+7]]:15 + // CHECK:STDERR: -> │ continue + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: `continue` statements must end with a `;` + // CHECK:STDERR: · ┃ [ExpectedStatementSemi] + // CHECK:STDERR: ╰──── // CHECK:STDERR: continue } diff --git a/toolchain/parse/testdata/while/fail_unbraced.carbon b/toolchain/parse/testdata/while/fail_unbraced.carbon index 15393ccee75b..ac3a7c9a2d9e 100644 --- a/toolchain/parse/testdata/while/fail_unbraced.carbon +++ b/toolchain/parse/testdata/while/fail_unbraced.carbon @@ -10,7 +10,11 @@ // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/while/fail_unbraced.carbon fn F() { - // CHECK:STDERR: fail_unbraced.carbon:[[@LINE+2]]:12: error: expected braced code block [ExpectedCodeBlock] + // CHECK:STDERR: ╭─┤ fail_unbraced.carbon:[[@LINE+6]]:12 + // CHECK:STDERR: -> │ while (a) + // CHECK:STDERR: · ┳ + // CHECK:STDERR: · ┗━━┫ error: expected braced code block [ExpectedCodeBlock] + // CHECK:STDERR: ╰──── // CHECK:STDERR: while (a) break; diff --git a/toolchain/testing/file_test.cpp b/toolchain/testing/file_test.cpp index e97322ea32e5..ceaff64dafd2 100644 --- a/toolchain/testing/file_test.cpp +++ b/toolchain/testing/file_test.cpp @@ -208,23 +208,36 @@ auto ToolchainFileTest::Run( filtered_test_args = test_args; } - // Most tests are about which diagnostics are produced and what they point at - // rather than how they are drawn, so they render compactly: one line per - // part, led by its location and the extent of its range. Nothing is then - // positioned against a line number, so adding a `CHECK` line above a - // diagnostic doesn't move anything inside one. A test that is about the - // drawing itself asks for `--diagnostic-snippets` in its `ARGS` and takes on - // goldens whose frames number their own `CHECK` lines. This is applied here - // rather than in `GetDefaultArgs` so that a test writing its own `ARGS` line - // still renders compactly unless it asks not to. - bool chooses_snippets = + // Tests pass `--diagnostic-line-numbers=first`, so the only line number in a + // frame is its first location row's, which autoupdate rewrites as a + // `[[@LINE...]]` offset. Adding a `CHECK` line above a diagnostic then + // doesn't change its frame. A test that sets a snippet or line-number option + // in its `ARGS` gets the driver's defaults for the other options, which is + // how toolchain/diagnostics/testdata keeps every line number. This is added + // here and not in `GetDefaultArgs`, so that a test with its own `ARGS` line + // still gets it. + bool chooses_rendering = llvm::any_of(filtered_test_args, [](llvm::StringRef arg) { return arg == "--diagnostic-snippets" || - arg == "--no-diagnostic-snippets"; + arg == "--no-diagnostic-snippets" || + arg == "--diagnostic-line-numbers" || + arg.starts_with("--diagnostic-line-numbers="); }); - if (!chooses_snippets) { + if (!chooses_rendering) { filtered_test_args.insert(filtered_test_args.begin(), - "--no-diagnostic-snippets"); + "--diagnostic-line-numbers=first"); + } + + // Goldens capture box drawing, which nearly every terminal gets, so that + // they show the line weights a user sees. A test about the ASCII form asks + // for `--terminal-unicode=never` in its `ARGS`. + bool chooses_charset = + llvm::any_of(filtered_test_args, [](llvm::StringRef arg) { + return arg.starts_with("--terminal-unicode"); + }); + if (!chooses_charset) { + filtered_test_args.insert(filtered_test_args.begin(), + "--terminal-unicode=always"); } Driver driver(overlay_fs, &data_->installation, input_stream, &output_stream, @@ -413,9 +426,39 @@ auto ToolchainFileTest::DoExtraCheckReplacements(std::string& check_line) const auto ToolchainFileTest::FinalizeCheckLines(CheckLineArray& check_lines, bool is_stderr) const -> void { if (is_stderr) { - // A diagnostic's headline carries its location only when snippets are off; - // with them on, the location is on the frame row below it. A compact - // location can carry the extent of its range as `-` after the column. + // A blank row ends each diagnostic. Within one, the rows before the first + // row with a line number, such as a frame's path rows, take that row's + // location, so that they stay with the frame instead of attaching to + // whatever came before it. Later rows without a location follow the rows + // before them, as they always do. + // + // TODO: A frame whose first location row names only a file, or a file + // outside the test such as the prelude, has no line number here, so it is + // placed after the diagnostic before it, sometimes in another file's split. + // Matching the file name in such a location row against the test's files + // would at least place it in that file's split. + llvm::SmallVector unplaced_rows; + bool block_placed = false; + for (auto& check_line : check_lines) { + if (check_line.line() == "// CHECK:STDERR:") { + unplaced_rows.clear(); + block_placed = false; + } else if (block_placed) { + // Trailing rows are placed by the rows before them. + } else if (check_line.line_number() == -1) { + unplaced_rows.push_back(&check_line); + } else { + for (FileTestAutoupdater::CheckLine* row : unplaced_rows) { + row->set_location(check_line.file_number(), check_line.line_number()); + } + unplaced_rows.clear(); + block_placed = true; + } + } + + // This matches the message's line in the compact form, which starts with + // its location when it has one, and that location can end with the extent + // of its range as `-`. No row of a frame matches. static const RE2 is_new_diagnostic_re( R"(^// CHECK:STDERR: (?:.*:\d*:\d*(?:-\d+)?: )?(?:error|warning): )"); // If a diagnostic isn't attached to a line, try to position it with its