diff --git a/toolchain/check/import_ref.cpp b/toolchain/check/import_ref.cpp index 39f62a8ced2b8..767e4a380f354 100644 --- a/toolchain/check/import_ref.cpp +++ b/toolchain/check/import_ref.cpp @@ -678,8 +678,8 @@ class ImportRefResolver { const SemIR::Interface& import_interface) -> SemIR::ConstantId { auto interface_decl = SemIR::InterfaceDecl{SemIR::TypeId::Invalid, - SemIR::InterfaceId::Invalid, - SemIR::InstBlockId::Empty}; + SemIR::InterfaceId::Invalid, + SemIR::InstBlockId::Empty}; auto interface_decl_id = context_.AddPlaceholderInst({Parse::NodeId::Invalid, interface_decl}); @@ -696,8 +696,7 @@ class ImportRefResolver { interface_decl_id, {Parse::NodeId::Invalid, interface_decl}); // Set the constant value for the imported interface. - auto interface_const_id = - context_.constant_values().Get(interface_decl_id); + auto interface_const_id = context_.constant_values().Get(interface_decl_id); import_ir_constant_values_.Set(inst_id, interface_const_id); return interface_const_id; } diff --git a/toolchain/check/operator.cpp b/toolchain/check/operator.cpp index fe1335cf50d2f..1f58ce0f4f955 100644 --- a/toolchain/check/operator.cpp +++ b/toolchain/check/operator.cpp @@ -12,22 +12,22 @@ namespace Carbon::Check { -// Returns the scope of the Carbon package, or Invalid if it's not found. +// Returns the scope of the Core package, or Invalid if it's not found. // -// TODO: Consider tracking the Carbon package in SemIR so we don't need to use +// TODO: Consider tracking the Core package in SemIR so we don't need to use // name lookup to find it. -static auto GetCarbonPackage(Context& context, Parse::AnyExprId node_id) +static auto GetCorePackage(Context& context, Parse::AnyExprId node_id) -> SemIR::NameScopeId { - // TODO: If the current package is the `Carbon` package, return + // TODO: If the current package is the `Core` package, return // `SemIR::InstId::Package`. - auto ident_id = context.identifiers().Lookup("Carbon"); + auto ident_id = context.identifiers().Lookup("Core"); if (!ident_id.is_valid()) { return SemIR::NameScopeId::Invalid; } auto name_id = SemIR::NameId::ForIdentifier(ident_id); - // Look up `package.Carbon`. + // Look up `package.Core`. auto package_id = context.LookupQualifiedName( node_id, name_id, SemIR::NameScopeId::Package, /*required=*/false); if (!package_id.is_valid()) { @@ -40,7 +40,7 @@ static auto GetCarbonPackage(Context& context, Parse::AnyExprId node_id) if (auto package_inst = context.insts().TryGetAs(package_id)) { auto& name_scope = context.name_scopes().Get(package_inst->name_scope_id); - // Check that this is really the `Carbon` package and not an alias. + // Check that this is really the `Core` package and not an alias. if (name_scope.is_closed_import && name_scope.name_id == name_id && name_scope.enclosing_scope_id == SemIR::NameScopeId::Package) { return package_inst->name_scope_id; @@ -50,15 +50,15 @@ static auto GetCarbonPackage(Context& context, Parse::AnyExprId node_id) } // Returns the name scope of the operator interface for the specified operator -// from the Carbon package. +// from the Core package. static auto GetOperatorInterface(Context& context, Parse::AnyExprId node_id, Operator op) -> SemIR::NameScopeId { - auto carbon_package_id = GetCarbonPackage(context, node_id); + auto carbon_package_id = GetCorePackage(context, node_id); if (!carbon_package_id.is_valid()) { return SemIR::NameScopeId::Invalid; } - // Lookup `Carbon.InterfaceName`. + // Lookup `Core.InterfaceName`. auto interface_ident_id = context.identifiers().Add(op.interface_name); auto interface_id = context.LookupQualifiedName( node_id, SemIR::NameId::ForIdentifier(interface_ident_id), diff --git a/toolchain/check/testdata/interface/import.carbon b/toolchain/check/testdata/interface/import.carbon index 1a363c63b7d28..34df2d9dcd763 100644 --- a/toolchain/check/testdata/interface/import.carbon +++ b/toolchain/check/testdata/interface/import.carbon @@ -120,9 +120,17 @@ var f: ForwardDeclared* = &f_ref.f; // CHECK:STDOUT: %.2: type = tuple_type () [template] // CHECK:STDOUT: %.3: type = interface_type @Basic [template] // CHECK:STDOUT: %.4: type = interface_type @ForwardDeclared [template] -// CHECK:STDOUT: %.5: type = ptr_type ForwardDeclared [template] -// CHECK:STDOUT: %.6: type = struct_type {.f: ForwardDeclared} [template] -// CHECK:STDOUT: %.7: type = struct_type {.f: ()} [template] +// CHECK:STDOUT: %.5: type = assoc_entity_type @Basic, type [template] +// CHECK:STDOUT: %.6: = assoc_entity element0, file.%import_ref.5 [template] +// CHECK:STDOUT: %.7: type = assoc_entity_type @Basic, [template] +// CHECK:STDOUT: %.8: in Basic> = assoc_entity element1, file.%import_ref.6 [template] +// CHECK:STDOUT: %.9: type = assoc_entity_type @ForwardDeclared, type [template] +// CHECK:STDOUT: %.10: = assoc_entity element0, file.%import_ref.7 [template] +// CHECK:STDOUT: %.11: type = assoc_entity_type @ForwardDeclared, [template] +// CHECK:STDOUT: %.12: in ForwardDeclared> = assoc_entity element1, file.%import_ref.8 [template] +// CHECK:STDOUT: %.13: type = ptr_type ForwardDeclared [template] +// CHECK:STDOUT: %.14: type = struct_type {.f: ForwardDeclared} [template] +// CHECK:STDOUT: %.15: type = struct_type {.f: ()} [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -134,7 +142,11 @@ var f: ForwardDeclared* = &f_ref.f; // CHECK:STDOUT: .UseEmpty = %UseEmpty // CHECK:STDOUT: .UseBasic = %UseBasic // CHECK:STDOUT: .UseForwardDeclared = %UseForwardDeclared -// CHECK:STDOUT: .f = %f.loc10 +// CHECK:STDOUT: .UseBasicT = %UseBasicT +// CHECK:STDOUT: .UseBasicF = %UseBasicF +// CHECK:STDOUT: .UseForwardDeclaredT = %UseForwardDeclaredT +// CHECK:STDOUT: .UseForwardDeclaredF = %UseForwardDeclaredF +// CHECK:STDOUT: .f = %f.loc16 // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.1: type = import_ref ir1, inst+1, used [template = constants.%.1] // CHECK:STDOUT: %import_ref.2: type = import_ref ir1, inst+4, used [template = constants.%.3] @@ -148,7 +160,7 @@ var f: ForwardDeclared* = &f_ref.f; // CHECK:STDOUT: } // CHECK:STDOUT: %UseBasic: = fn_decl @UseBasic [template] { // CHECK:STDOUT: %Basic.decl: invalid = interface_decl @Basic [template = constants.%.3] {} -// CHECK:STDOUT: %Basic.ref: type = name_ref Basic, %import_ref.2 [template = constants.%.3] +// CHECK:STDOUT: %Basic.ref.loc7: type = name_ref Basic, %import_ref.2 [template = constants.%.3] // CHECK:STDOUT: %e.loc7_13.1: Basic = param e // CHECK:STDOUT: @UseBasic.%e: Basic = bind_name e, %e.loc7_13.1 // CHECK:STDOUT: } @@ -158,10 +170,26 @@ var f: ForwardDeclared* = &f_ref.f; // CHECK:STDOUT: %f.loc8_23.1: ForwardDeclared = param f // CHECK:STDOUT: @UseForwardDeclared.%f: ForwardDeclared = bind_name f, %f.loc8_23.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %ForwardDeclared.ref.loc10: type = name_ref ForwardDeclared, %import_ref.3 [template = constants.%.4] -// CHECK:STDOUT: %.loc10: type = ptr_type ForwardDeclared [template = constants.%.5] +// CHECK:STDOUT: %Basic.ref.loc10: type = name_ref Basic, %import_ref.2 [template = constants.%.3] +// CHECK:STDOUT: %import_ref.5 = import_ref ir1, inst+7, unused +// CHECK:STDOUT: %T.ref.loc10: = name_ref T, @Basic.%import_ref.3 [template = constants.%.6] +// CHECK:STDOUT: %UseBasicT: = bind_alias UseBasicT, @Basic.%import_ref.3 [template = constants.%.6] +// CHECK:STDOUT: %Basic.ref.loc11: type = name_ref Basic, %import_ref.2 [template = constants.%.3] +// CHECK:STDOUT: %import_ref.6 = import_ref ir1, inst+11, unused +// CHECK:STDOUT: %F.ref.loc11: in Basic> = name_ref F, @Basic.%import_ref.2 [template = constants.%.8] +// CHECK:STDOUT: %UseBasicF: in Basic> = bind_alias UseBasicF, @Basic.%import_ref.2 [template = constants.%.8] +// CHECK:STDOUT: %ForwardDeclared.ref.loc13: type = name_ref ForwardDeclared, %import_ref.3 [template = constants.%.4] +// CHECK:STDOUT: %import_ref.7 = import_ref ir1, inst+19, unused +// CHECK:STDOUT: %T.ref.loc13: = name_ref T, @ForwardDeclared.%import_ref.3 [template = constants.%.10] +// CHECK:STDOUT: %UseForwardDeclaredT: = bind_alias UseForwardDeclaredT, @ForwardDeclared.%import_ref.3 [template = constants.%.10] +// CHECK:STDOUT: %ForwardDeclared.ref.loc14: type = name_ref ForwardDeclared, %import_ref.3 [template = constants.%.4] +// CHECK:STDOUT: %import_ref.8 = import_ref ir1, inst+23, unused +// CHECK:STDOUT: %F.ref.loc14: in ForwardDeclared> = name_ref F, @ForwardDeclared.%import_ref.2 [template = constants.%.12] +// CHECK:STDOUT: %UseForwardDeclaredF: in ForwardDeclared> = bind_alias UseForwardDeclaredF, @ForwardDeclared.%import_ref.2 [template = constants.%.12] +// CHECK:STDOUT: %ForwardDeclared.ref.loc16: type = name_ref ForwardDeclared, %import_ref.3 [template = constants.%.4] +// CHECK:STDOUT: %.loc16: type = ptr_type ForwardDeclared [template = constants.%.13] // CHECK:STDOUT: %f.var: ref ForwardDeclared* = var f -// CHECK:STDOUT: %f.loc10: ref ForwardDeclared* = bind_name f, %f.var +// CHECK:STDOUT: %f.loc16: ref ForwardDeclared* = bind_name f, %f.var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Empty { @@ -174,8 +202,8 @@ var f: ForwardDeclared* = &f_ref.f; // CHECK:STDOUT: // CHECK:STDOUT: interface @Basic { // CHECK:STDOUT: %import_ref.1 = import_ref ir1, inst+6, unused -// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+13, unused -// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+9, unused +// CHECK:STDOUT: %import_ref.2: in Basic> = import_ref ir1, inst+13, used [template = constants.%.8] +// CHECK:STDOUT: %import_ref.3: = import_ref ir1, inst+9, used [template = constants.%.6] // CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+7, unused // CHECK:STDOUT: %import_ref.5 = import_ref ir1, inst+11, unused // CHECK:STDOUT: @@ -188,8 +216,8 @@ var f: ForwardDeclared* = &f_ref.f; // CHECK:STDOUT: // CHECK:STDOUT: interface @ForwardDeclared { // CHECK:STDOUT: %import_ref.1 = import_ref ir1, inst+18, unused -// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+25, unused -// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+21, unused +// CHECK:STDOUT: %import_ref.2: in ForwardDeclared> = import_ref ir1, inst+25, used [template = constants.%.12] +// CHECK:STDOUT: %import_ref.3: = import_ref ir1, inst+21, used [template = constants.%.10] // CHECK:STDOUT: %import_ref.4 = import_ref ir1, inst+19, unused // CHECK:STDOUT: %import_ref.5 = import_ref ir1, inst+23, unused // CHECK:STDOUT: @@ -218,9 +246,9 @@ var f: ForwardDeclared* = &f_ref.f; // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %f_ref.ref: ref {.f: ForwardDeclared} = name_ref f_ref, file.%import_ref.4 -// CHECK:STDOUT: %.loc10_33: ref ForwardDeclared = struct_access %f_ref.ref, element0 -// CHECK:STDOUT: %.loc10_27: ForwardDeclared* = addr_of %.loc10_33 -// CHECK:STDOUT: assign file.%f.var, %.loc10_27 +// CHECK:STDOUT: %.loc16_33: ref ForwardDeclared = struct_access %f_ref.ref, element0 +// CHECK:STDOUT: %.loc16_27: ForwardDeclared* = addr_of %.loc16_33 +// CHECK:STDOUT: assign file.%f.var, %.loc16_27 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/add.carbon b/toolchain/check/testdata/operators/overloaded/add.carbon index 34e434b9d4e82..25ff6fbda1e07 100644 --- a/toolchain/check/testdata/operators/overloaded/add.carbon +++ b/toolchain/check/testdata/operators/overloaded/add.carbon @@ -8,7 +8,7 @@ // --- prelude.carbon -package Carbon api; +package Core api; interface Add { fn Op[self: Self](other: Self) -> Self; @@ -21,16 +21,16 @@ interface AddAssign { package User api; -import Carbon; +import Core; class C {}; -impl C as Carbon.Add { +impl C as Core.Add { fn Op[self: C](other: C) -> C { return {}; } } -impl C as Carbon.AddAssign { +impl C as Core.AddAssign { fn Op[addr self: C*](other: C) {} } @@ -46,7 +46,7 @@ fn TestAssign(a: C*, b: C) { package FailNoImpl api; -import Carbon; +import Core; class D {}; @@ -68,11 +68,11 @@ fn TestAssign(a: D*, b: D) { package FailNoImplForArgs api; -import Carbon; +import Core; class C {}; -impl C as Carbon.Add { +impl C as Core.Add { fn Op[self: C](other: C) -> C { return {}; } @@ -194,23 +194,23 @@ fn TestLhsBad(a: D, b: C) -> C { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Carbon = %Carbon +// CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: .TestOp = %TestOp // CHECK:STDOUT: .TestAssign = %TestAssign // CHECK:STDOUT: } -// CHECK:STDOUT: %Carbon: = namespace [template] {} +// CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: impl_decl @impl.1 { // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Carbon.ref.loc8: = name_ref Carbon, %Carbon [template = %Carbon] +// CHECK:STDOUT: %Core.ref.loc8: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %import_ref.1: type = import_ref ir1, inst+1, used [template = constants.%.2] // CHECK:STDOUT: %Add.decl: invalid = interface_decl @Add [template = constants.%.2] {} // CHECK:STDOUT: %Add.ref: type = name_ref Add, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } // CHECK:STDOUT: impl_decl @impl.2 { // CHECK:STDOUT: %C.ref.loc13: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Carbon.ref.loc13: = name_ref Carbon, %Carbon [template = %Carbon] +// CHECK:STDOUT: %Core.ref.loc13: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %import_ref.2: type = import_ref ir1, inst+22, used [template = constants.%.7] // CHECK:STDOUT: %AddAssign.decl: invalid = interface_decl @AddAssign [template = constants.%.7] {} // CHECK:STDOUT: %AddAssign.ref: type = name_ref AddAssign, %import_ref.2 [template = constants.%.7] @@ -361,12 +361,12 @@ fn TestLhsBad(a: D, b: C) -> C { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Carbon = %Carbon +// CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .D = %D.decl // CHECK:STDOUT: .TestOp = %TestOp // CHECK:STDOUT: .TestAssign = %TestAssign // CHECK:STDOUT: } -// CHECK:STDOUT: %Carbon: = namespace [template] {} +// CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {} // CHECK:STDOUT: %TestOp: = fn_decl @TestOp [template] { // CHECK:STDOUT: %D.ref.loc8_14: type = name_ref D, %D.decl [template = constants.%D] @@ -454,17 +454,17 @@ fn TestLhsBad(a: D, b: C) -> C { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Carbon = %Carbon +// CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: .D = %D.decl // CHECK:STDOUT: .TestRhsBad = %TestRhsBad // CHECK:STDOUT: .TestLhsBad = %TestLhsBad // CHECK:STDOUT: } -// CHECK:STDOUT: %Carbon: = namespace [template] {} +// CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: impl_decl @impl { // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Carbon.ref: = name_ref Carbon, %Carbon [template = %Carbon] +// CHECK:STDOUT: %Core.ref: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %import_ref: type = import_ref ir1, inst+1, used [template = constants.%.2] // CHECK:STDOUT: %Add.decl: invalid = interface_decl @Add [template = constants.%.2] {} // CHECK:STDOUT: %Add.ref: type = name_ref Add, %import_ref [template = constants.%.2] diff --git a/toolchain/check/testdata/operators/overloaded/binary_op.carbon.in b/toolchain/check/testdata/operators/overloaded/binary_op.carbon.in index 7efcc6ddf5994..f66842e84a71e 100644 --- a/toolchain/check/testdata/operators/overloaded/binary_op.carbon.in +++ b/toolchain/check/testdata/operators/overloaded/binary_op.carbon.in @@ -8,7 +8,7 @@ HEADER // --- prelude.carbon -package Carbon api; +package Core api; interface INTERFACE { fn Op[self: Self](other: Self) -> Self; @@ -21,16 +21,16 @@ interface INTERFACEAssign { package User api; -import Carbon; +import Core; class C {}; -impl C as Carbon.INTERFACE { +impl C as Core.INTERFACE { fn Op[self: C](other: C) -> C { return {}; } } -impl C as Carbon.INTERFACEAssign { +impl C as Core.INTERFACEAssign { fn Op[addr self: C*](other: C) {} } @@ -46,7 +46,7 @@ fn TestAssign(a: C*, b: C) { package FailNoImpl api; -import Carbon; +import Core; class D {}; @@ -62,11 +62,11 @@ fn TestAssign(a: D*, b: D) { package FailNoImplForArgs api; -import Carbon; +import Core; class C {}; -impl C as Carbon.INTERFACE { +impl C as Core.INTERFACE { fn Op[self: C](other: C) -> C { return {}; } diff --git a/toolchain/check/testdata/operators/overloaded/bit_and.carbon b/toolchain/check/testdata/operators/overloaded/bit_and.carbon index 72e3936dec67c..206329051e870 100644 --- a/toolchain/check/testdata/operators/overloaded/bit_and.carbon +++ b/toolchain/check/testdata/operators/overloaded/bit_and.carbon @@ -8,7 +8,7 @@ // --- prelude.carbon -package Carbon api; +package Core api; interface BitAnd { fn Op[self: Self](other: Self) -> Self; @@ -21,70 +21,58 @@ interface BitAndAssign { package User api; -import Carbon; +import Core; class C {}; -impl C as Carbon.BitAnd { +impl C as Core.BitAnd { fn Op[self: C](other: C) -> C { return {}; } } -impl C as Carbon.BitAndAssign { +impl C as Core.BitAndAssign { fn Op[addr self: C*](other: C) {} } fn TestOp(a: C, b: C) -> C { - // CHECK:STDERR: user.carbon:[[@LINE+6]]:10: ERROR: Cannot copy value of type `C`. - // CHECK:STDERR: return a OP b; - // CHECK:STDERR: ^ - // CHECK:STDERR: user.carbon:[[@LINE+3]]:12: ERROR: `return` statements must end with a `;`. - // CHECK:STDERR: return a OP b; - // CHECK:STDERR: ^~ - return a OP b; + return a & b; } fn TestAssign(a: C*, b: C) { - // CHECK:STDERR: user.carbon:[[@LINE+3]]:6: ERROR: Expected `;` after expression statement. - // CHECK:STDERR: *a OP= b; - // CHECK:STDERR: ^~ - *a OP= b; + *a &= b; } // --- fail_no_impl.carbon package FailNoImpl api; -import Carbon; +import Core; class D {}; fn TestOp(a: D, b: D) -> D { - // CHECK:STDERR: fail_no_impl.carbon:[[@LINE+6]]:10: ERROR: Cannot copy value of type `D`. - // CHECK:STDERR: return a OP b; - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_no_impl.carbon:[[@LINE+3]]:12: ERROR: `return` statements must end with a `;`. - // CHECK:STDERR: return a OP b; - // CHECK:STDERR: ^~ - return a OP b; + // CHECK:STDERR: fail_no_impl.carbon:[[@LINE+3]]:10: ERROR: Cannot access member of interface BitAnd in type D that does not implement that interface. + // CHECK:STDERR: return a & b; + // CHECK:STDERR: ^~~~~ + return a & b; } fn TestAssign(a: D*, b: D) { - // CHECK:STDERR: fail_no_impl.carbon:[[@LINE+3]]:6: ERROR: Expected `;` after expression statement. - // CHECK:STDERR: *a OP= b; - // CHECK:STDERR: ^~ - *a OP= b; + // CHECK:STDERR: fail_no_impl.carbon:[[@LINE+3]]:3: ERROR: Cannot access member of interface BitAndAssign in type D that does not implement that interface. + // CHECK:STDERR: *a &= b; + // CHECK:STDERR: ^~~~~~~ + *a &= b; } // --- fail_no_impl_for_args.carbon package FailNoImplForArgs api; -import Carbon; +import Core; class C {}; -impl C as Carbon.BitAnd { +impl C as Core.BitAnd { fn Op[self: C](other: C) -> C { return {}; } @@ -93,23 +81,20 @@ impl C as Carbon.BitAnd { class D {}; fn TestRhsBad(a: C, b: D) -> C { - // CHECK:STDERR: fail_no_impl_for_args.carbon:[[@LINE+6]]:10: ERROR: Cannot copy value of type `C`. - // CHECK:STDERR: return a OP b; - // CHECK:STDERR: ^ - // CHECK:STDERR: fail_no_impl_for_args.carbon:[[@LINE+3]]:12: ERROR: `return` statements must end with a `;`. - // CHECK:STDERR: return a OP b; - // CHECK:STDERR: ^~ - return a OP b; + // CHECK:STDERR: fail_no_impl_for_args.carbon:[[@LINE+6]]:10: ERROR: Cannot implicitly convert from `D` to `C`. + // CHECK:STDERR: return a & b; + // CHECK:STDERR: ^~~~~ + // CHECK:STDERR: fail_no_impl_for_args.carbon:[[@LINE-11]]:3: Initializing parameter 1 of function declared here. + // CHECK:STDERR: fn Op[self: C](other: C) -> C { + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + return a & b; } fn TestLhsBad(a: D, b: C) -> C { - // CHECK:STDERR: fail_no_impl_for_args.carbon:[[@LINE+6]]:3: ERROR: Cannot implicitly convert from `D` to `C`. - // CHECK:STDERR: return a OP b; - // CHECK:STDERR: ^~~~~~~~~~~~~~ - // CHECK:STDERR: fail_no_impl_for_args.carbon:[[@LINE+3]]:12: ERROR: `return` statements must end with a `;`. - // CHECK:STDERR: return a OP b; - // CHECK:STDERR: ^~ - return a OP b; + // CHECK:STDERR: fail_no_impl_for_args.carbon:[[@LINE+3]]:10: ERROR: Cannot access member of interface BitAnd in type D that does not implement that interface. + // CHECK:STDERR: return a & b; + // CHECK:STDERR: ^~~~~ + return a & b; } // CHECK:STDOUT: --- prelude.carbon @@ -201,27 +186,31 @@ fn TestLhsBad(a: D, b: C) -> C { // CHECK:STDOUT: %.8: type = ptr_type C [template] // CHECK:STDOUT: %.9: type = ptr_type Self [symbolic] // CHECK:STDOUT: %.10: = interface_witness (@impl.2.%Op) [template] +// CHECK:STDOUT: %.11: type = assoc_entity_type @BitAnd, [template] +// CHECK:STDOUT: %.12: in BitAnd> = assoc_entity element0, @TestOp.%import_ref.2 [template] +// CHECK:STDOUT: %.13: type = assoc_entity_type @BitAndAssign, [template] +// CHECK:STDOUT: %.14: in BitAndAssign> = assoc_entity element0, @TestAssign.%import_ref.2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Carbon = %Carbon +// CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: .TestOp = %TestOp // CHECK:STDOUT: .TestAssign = %TestAssign // CHECK:STDOUT: } -// CHECK:STDOUT: %Carbon: = namespace [template] {} +// CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: impl_decl @impl.1 { // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Carbon.ref.loc8: = name_ref Carbon, %Carbon [template = %Carbon] +// CHECK:STDOUT: %Core.ref.loc8: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %import_ref.1: type = import_ref ir1, inst+1, used [template = constants.%.2] // CHECK:STDOUT: %BitAnd.decl: invalid = interface_decl @BitAnd [template = constants.%.2] {} // CHECK:STDOUT: %BitAnd.ref: type = name_ref BitAnd, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } // CHECK:STDOUT: impl_decl @impl.2 { // CHECK:STDOUT: %C.ref.loc13: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Carbon.ref.loc13: = name_ref Carbon, %Carbon [template = %Carbon] +// CHECK:STDOUT: %Core.ref.loc13: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %import_ref.2: type = import_ref ir1, inst+22, used [template = constants.%.7] // CHECK:STDOUT: %BitAndAssign.decl: invalid = interface_decl @BitAndAssign [template = constants.%.7] {} // CHECK:STDOUT: %BitAndAssign.ref: type = name_ref BitAndAssign, %import_ref.2 [template = constants.%.7] @@ -237,18 +226,18 @@ fn TestLhsBad(a: D, b: C) -> C { // CHECK:STDOUT: @TestOp.%return: ref C = var // CHECK:STDOUT: } // CHECK:STDOUT: %TestAssign: = fn_decl @TestAssign [template] { -// CHECK:STDOUT: %C.ref.loc27_18: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc27: type = ptr_type C [template = constants.%.8] -// CHECK:STDOUT: %a.loc27_15.1: C* = param a -// CHECK:STDOUT: @TestAssign.%a: C* = bind_name a, %a.loc27_15.1 -// CHECK:STDOUT: %C.ref.loc27_25: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %b.loc27_22.1: C = param b -// CHECK:STDOUT: @TestAssign.%b: C = bind_name b, %b.loc27_22.1 +// CHECK:STDOUT: %C.ref.loc21_18: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %.loc21: type = ptr_type C [template = constants.%.8] +// CHECK:STDOUT: %a.loc21_15.1: C* = param a +// CHECK:STDOUT: @TestAssign.%a: C* = bind_name a, %a.loc21_15.1 +// CHECK:STDOUT: %C.ref.loc21_25: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %b.loc21_22.1: C = param b +// CHECK:STDOUT: @TestAssign.%b: C = bind_name b, %b.loc21_22.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @BitAnd { -// CHECK:STDOUT: %import_ref.1 = import_ref ir1, inst+20, unused +// CHECK:STDOUT: %import_ref.1: in BitAnd> = import_ref ir1, inst+20, used [template = constants.%.12] // CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+3, unused // CHECK:STDOUT: %import_ref.3: = import_ref ir1, inst+18, used [template = imports.%Op.1] // CHECK:STDOUT: @@ -259,7 +248,7 @@ fn TestLhsBad(a: D, b: C) -> C { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @BitAndAssign { -// CHECK:STDOUT: %import_ref.1 = import_ref ir1, inst+40, unused +// CHECK:STDOUT: %import_ref.1: in BitAndAssign> = import_ref ir1, inst+40, used [template = constants.%.14] // CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+24, unused // CHECK:STDOUT: %import_ref.3: = import_ref ir1, inst+38, used [template = imports.%Op.2] // CHECK:STDOUT: @@ -330,13 +319,27 @@ fn TestLhsBad(a: D, b: C) -> C { // CHECK:STDOUT: fn @TestOp(%a: C, %b: C) -> %return: C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C = name_ref a, %a -// CHECK:STDOUT: return +// CHECK:STDOUT: %b.ref: C = name_ref b, %b +// CHECK:STDOUT: %import_ref.1: type = import_ref ir1, inst+1, used [template = constants.%.2] +// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+18, unused +// CHECK:STDOUT: %.1: = interface_witness_access @impl.1.%.1, element0 [template = @impl.1.%Op] +// CHECK:STDOUT: %.loc18_12.1: = bound_method %a.ref, %.1 +// CHECK:STDOUT: %.loc17: ref C = splice_block %return {} +// CHECK:STDOUT: %.loc18_12.2: init C = call %.loc18_12.1(%a.ref, %b.ref) to %.loc17 +// CHECK:STDOUT: return %.loc18_12.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @TestAssign(%a: C*, %b: C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C* = name_ref a, %a -// CHECK:STDOUT: %.loc31: ref C = deref %a.ref +// CHECK:STDOUT: %.loc22_3.1: ref C = deref %a.ref +// CHECK:STDOUT: %b.ref: C = name_ref b, %b +// CHECK:STDOUT: %import_ref.1: type = import_ref ir1, inst+22, used [template = constants.%.7] +// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+38, unused +// CHECK:STDOUT: %.1: = interface_witness_access @impl.2.%.1, element0 [template = @impl.2.%Op] +// CHECK:STDOUT: %.loc22_6.1: = bound_method %.loc22_3.1, %.1 +// CHECK:STDOUT: %.loc22_3.2: C* = addr_of %.loc22_3.1 +// CHECK:STDOUT: %.loc22_6.2: init () = call %.loc22_6.1(%.loc22_3.2, %b.ref) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -347,17 +350,23 @@ fn TestLhsBad(a: D, b: C) -> C { // CHECK:STDOUT: %.1: type = struct_type {} [template] // CHECK:STDOUT: %.2: type = tuple_type () [template] // CHECK:STDOUT: %.3: type = ptr_type {} [template] -// CHECK:STDOUT: %.4: type = ptr_type D [template] +// CHECK:STDOUT: %.4: type = interface_type @BitAnd [template] +// CHECK:STDOUT: %.5: type = assoc_entity_type @BitAnd, [template] +// CHECK:STDOUT: %.6: in BitAnd> = assoc_entity element0, @TestOp.%import_ref.2 [template] +// CHECK:STDOUT: %.7: type = ptr_type D [template] +// CHECK:STDOUT: %.8: type = interface_type @BitAndAssign [template] +// CHECK:STDOUT: %.9: type = assoc_entity_type @BitAndAssign, [template] +// CHECK:STDOUT: %.10: in BitAndAssign> = assoc_entity element0, @TestAssign.%import_ref.2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Carbon = %Carbon +// CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .D = %D.decl // CHECK:STDOUT: .TestOp = %TestOp // CHECK:STDOUT: .TestAssign = %TestAssign // CHECK:STDOUT: } -// CHECK:STDOUT: %Carbon: = namespace [template] {} +// CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {} // CHECK:STDOUT: %TestOp: = fn_decl @TestOp [template] { // CHECK:STDOUT: %D.ref.loc8_14: type = name_ref D, %D.decl [template = constants.%D] @@ -370,16 +379,38 @@ fn TestLhsBad(a: D, b: C) -> C { // CHECK:STDOUT: @TestOp.%return: ref D = var // CHECK:STDOUT: } // CHECK:STDOUT: %TestAssign: = fn_decl @TestAssign [template] { -// CHECK:STDOUT: %D.ref.loc18_18: type = name_ref D, %D.decl [template = constants.%D] -// CHECK:STDOUT: %.loc18: type = ptr_type D [template = constants.%.4] -// CHECK:STDOUT: %a.loc18_15.1: D* = param a -// CHECK:STDOUT: @TestAssign.%a: D* = bind_name a, %a.loc18_15.1 -// CHECK:STDOUT: %D.ref.loc18_25: type = name_ref D, %D.decl [template = constants.%D] -// CHECK:STDOUT: %b.loc18_22.1: D = param b -// CHECK:STDOUT: @TestAssign.%b: D = bind_name b, %b.loc18_22.1 +// CHECK:STDOUT: %D.ref.loc15_18: type = name_ref D, %D.decl [template = constants.%D] +// CHECK:STDOUT: %.loc15: type = ptr_type D [template = constants.%.7] +// CHECK:STDOUT: %a.loc15_15.1: D* = param a +// CHECK:STDOUT: @TestAssign.%a: D* = bind_name a, %a.loc15_15.1 +// CHECK:STDOUT: %D.ref.loc15_25: type = name_ref D, %D.decl [template = constants.%D] +// CHECK:STDOUT: %b.loc15_22.1: D = param b +// CHECK:STDOUT: @TestAssign.%b: D = bind_name b, %b.loc15_22.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: interface @BitAnd { +// CHECK:STDOUT: %import_ref.1: in BitAnd> = import_ref ir1, inst+20, used [template = constants.%.6] +// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+3, unused +// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+18, unused +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Op = %import_ref.1 +// CHECK:STDOUT: .Self = %import_ref.2 +// CHECK:STDOUT: witness = (%import_ref.3) +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: interface @BitAndAssign { +// CHECK:STDOUT: %import_ref.1: in BitAndAssign> = import_ref ir1, inst+40, used [template = constants.%.10] +// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+24, unused +// CHECK:STDOUT: %import_ref.3 = import_ref ir1, inst+38, unused +// CHECK:STDOUT: +// CHECK:STDOUT: !members: +// CHECK:STDOUT: .Op = %import_ref.1 +// CHECK:STDOUT: .Self = %import_ref.2 +// CHECK:STDOUT: witness = (%import_ref.3) +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: class @D { // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%D @@ -388,13 +419,21 @@ fn TestLhsBad(a: D, b: C) -> C { // CHECK:STDOUT: fn @TestOp(%a: D, %b: D) -> %return: D { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: D = name_ref a, %a +// CHECK:STDOUT: %b.ref: D = name_ref b, %b +// CHECK:STDOUT: %import_ref.1: type = import_ref ir1, inst+1, used [template = constants.%.4] +// CHECK:STDOUT: %BitAnd.decl: invalid = interface_decl @BitAnd [template = constants.%.4] {} +// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+18, unused // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @TestAssign(%a: D*, %b: D) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: D* = name_ref a, %a -// CHECK:STDOUT: %.loc22: ref D = deref %a.ref +// CHECK:STDOUT: %.loc19: ref D = deref %a.ref +// CHECK:STDOUT: %b.ref: D = name_ref b, %b +// CHECK:STDOUT: %import_ref.1: type = import_ref ir1, inst+22, used [template = constants.%.8] +// CHECK:STDOUT: %BitAndAssign.decl: invalid = interface_decl @BitAndAssign [template = constants.%.8] {} +// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+38, unused // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -409,21 +448,23 @@ fn TestLhsBad(a: D, b: C) -> C { // CHECK:STDOUT: %.5: C = struct_value () [template] // CHECK:STDOUT: %.6: = interface_witness (@impl.%Op) [template] // CHECK:STDOUT: %D: type = class_type @D [template] +// CHECK:STDOUT: %.7: type = assoc_entity_type @BitAnd, [template] +// CHECK:STDOUT: %.8: in BitAnd> = assoc_entity element0, @TestRhsBad.%import_ref.2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Carbon = %Carbon +// CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: .D = %D.decl // CHECK:STDOUT: .TestRhsBad = %TestRhsBad // CHECK:STDOUT: .TestLhsBad = %TestLhsBad // CHECK:STDOUT: } -// CHECK:STDOUT: %Carbon: = namespace [template] {} +// CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: impl_decl @impl { // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Carbon.ref: = name_ref Carbon, %Carbon [template = %Carbon] +// CHECK:STDOUT: %Core.ref: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %import_ref: type = import_ref ir1, inst+1, used [template = constants.%.2] // CHECK:STDOUT: %BitAnd.decl: invalid = interface_decl @BitAnd [template = constants.%.2] {} // CHECK:STDOUT: %BitAnd.ref: type = name_ref BitAnd, %import_ref [template = constants.%.2] @@ -452,7 +493,7 @@ fn TestLhsBad(a: D, b: C) -> C { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @BitAnd { -// CHECK:STDOUT: %import_ref.1 = import_ref ir1, inst+20, unused +// CHECK:STDOUT: %import_ref.1: in BitAnd> = import_ref ir1, inst+20, used [template = constants.%.8] // CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+3, unused // CHECK:STDOUT: %import_ref.3: = import_ref ir1, inst+18, used [template = imports.%Op] // CHECK:STDOUT: @@ -503,12 +544,21 @@ fn TestLhsBad(a: D, b: C) -> C { // CHECK:STDOUT: fn @TestRhsBad(%a: C, %b: D) -> %return: C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C = name_ref a, %a -// CHECK:STDOUT: return +// CHECK:STDOUT: %b.ref: D = name_ref b, %b +// CHECK:STDOUT: %import_ref.1: type = import_ref ir1, inst+1, used [template = constants.%.2] +// CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+18, unused +// CHECK:STDOUT: %.1: = interface_witness_access @impl.%.1, element0 [template = @impl.%Op] +// CHECK:STDOUT: %.loc23_12.1: = bound_method %a.ref, %.1 +// CHECK:STDOUT: %.loc23_12.2: ref C = temporary_storage +// CHECK:STDOUT: %.loc23_12.3: init C = call %.loc23_12.1() +// CHECK:STDOUT: return %.loc23_12.3 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @TestLhsBad(%a: D, %b: C) -> %return: C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: D = name_ref a, %a +// CHECK:STDOUT: %b.ref: C = name_ref b, %b +// CHECK:STDOUT: %import_ref: type = import_ref ir1, inst+1, used [template = constants.%.2] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/bit_complement.carbon b/toolchain/check/testdata/operators/overloaded/bit_complement.carbon index 01131ad7645bd..3b38c3b711a5f 100644 --- a/toolchain/check/testdata/operators/overloaded/bit_complement.carbon +++ b/toolchain/check/testdata/operators/overloaded/bit_complement.carbon @@ -8,7 +8,7 @@ // --- prelude.carbon -package Carbon api; +package Core api; interface BitComplement { fn Op[self: Self]() -> Self; @@ -18,21 +18,17 @@ interface BitComplement { package User api; -import Carbon; +import Core; class C {}; -impl C as Carbon.BitComplement { - // CHECK:STDERR: user.carbon:[[@LINE+4]]:3: ERROR: Function redeclaration differs because of parameter count of 1. - // CHECK:STDERR: fn Op[self: C](other: C) -> C { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: user.carbon: Previously declared with parameter count of 0. - fn Op[self: C](other: C) -> C { +impl C as Core.BitComplement { + fn Op[self: C]() -> C { return {}; } } -fn TestOp(a: C, b: C) -> C { +fn TestOp(a: C) -> C { return ^a; } @@ -40,7 +36,7 @@ fn TestOp(a: C, b: C) -> C { package FailNoImpl api; -import Carbon; +import Core; class D {}; @@ -104,39 +100,37 @@ fn TestOp(a: D) { // CHECK:STDOUT: %.3: type = tuple_type () [template] // CHECK:STDOUT: %.4: type = ptr_type {} [template] // CHECK:STDOUT: %.5: C = struct_value () [template] -// CHECK:STDOUT: %.6: type = assoc_entity_type @BitComplement, [template] -// CHECK:STDOUT: %.7: in BitComplement> = assoc_entity element0, @TestOp.%import_ref.2 [template] +// CHECK:STDOUT: %.6: = interface_witness (@impl.%Op) [template] +// CHECK:STDOUT: %.7: type = assoc_entity_type @BitComplement, [template] +// CHECK:STDOUT: %.8: in BitComplement> = assoc_entity element0, @TestOp.%import_ref.2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Carbon = %Carbon +// CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: .TestOp = %TestOp // CHECK:STDOUT: } -// CHECK:STDOUT: %Carbon: = namespace [template] {} +// CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: impl_decl @impl { // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Carbon.ref: = name_ref Carbon, %Carbon [template = %Carbon] +// CHECK:STDOUT: %Core.ref: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %import_ref: type = import_ref ir1, inst+1, used [template = constants.%.2] // CHECK:STDOUT: %BitComplement.decl: invalid = interface_decl @BitComplement [template = constants.%.2] {} // CHECK:STDOUT: %BitComplement.ref: type = name_ref BitComplement, %import_ref [template = constants.%.2] // CHECK:STDOUT: } // CHECK:STDOUT: %TestOp: = fn_decl @TestOp [template] { -// CHECK:STDOUT: %C.ref.loc18_14: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %a.loc18_11.1: C = param a -// CHECK:STDOUT: @TestOp.%a: C = bind_name a, %a.loc18_11.1 -// CHECK:STDOUT: %C.ref.loc18_20: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %b.loc18_17.1: C = param b -// CHECK:STDOUT: @TestOp.%b: C = bind_name b, %b.loc18_17.1 -// CHECK:STDOUT: %C.ref.loc18_26: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %C.ref.loc14_14: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %a.loc14_11.1: C = param a +// CHECK:STDOUT: @TestOp.%a: C = bind_name a, %a.loc14_11.1 +// CHECK:STDOUT: %C.ref.loc14_20: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: @TestOp.%return: ref C = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @BitComplement { -// CHECK:STDOUT: %import_ref.1: in BitComplement> = import_ref ir1, inst+15, used [template = constants.%.7] +// CHECK:STDOUT: %import_ref.1: in BitComplement> = import_ref ir1, inst+15, used [template = constants.%.8] // CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+3, unused // CHECK:STDOUT: %import_ref.3: = import_ref ir1, inst+13, used [template = imports.%Op] // CHECK:STDOUT: @@ -148,16 +142,13 @@ fn TestOp(a: D) { // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: C as BitComplement { // CHECK:STDOUT: %Op: = fn_decl @Op.1 [template] { -// CHECK:STDOUT: %C.ref.loc13_15: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %self.loc13_9.1: C = param self -// CHECK:STDOUT: %self.loc13_9.2: C = bind_name self, %self.loc13_9.1 -// CHECK:STDOUT: %C.ref.loc13_25: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %other.loc13_18.1: C = param other -// CHECK:STDOUT: %other.loc13_18.2: C = bind_name other, %other.loc13_18.1 -// CHECK:STDOUT: %C.ref.loc13_31: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %C.ref.loc9_15: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %self.loc9_9.1: C = param self +// CHECK:STDOUT: %self.loc9_9.2: C = bind_name self, %self.loc9_9.1 +// CHECK:STDOUT: %C.ref.loc9_23: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %return.var: ref C = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness () [template = ] +// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.6] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Op = %Op @@ -169,23 +160,26 @@ fn TestOp(a: D) { // CHECK:STDOUT: .Self = constants.%C // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Op.1[@impl.%self.loc13_9.2: C](@impl.%other.loc13_18.2: C) -> @impl.%return.var: C { +// CHECK:STDOUT: fn @Op.1[@impl.%self.loc9_9.2: C]() -> @impl.%return.var: C { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc14_13.1: {} = struct_literal () -// CHECK:STDOUT: %.loc14_13.2: init C = class_init (), @impl.%return.var [template = constants.%.5] -// CHECK:STDOUT: %.loc14_13.3: init C = converted %.loc14_13.1, %.loc14_13.2 [template = constants.%.5] -// CHECK:STDOUT: return %.loc14_13.3 +// CHECK:STDOUT: %.loc10_13.1: {} = struct_literal () +// CHECK:STDOUT: %.loc10_13.2: init C = class_init (), @impl.%return.var [template = constants.%.5] +// CHECK:STDOUT: %.loc10_13.3: init C = converted %.loc10_13.1, %.loc10_13.2 [template = constants.%.5] +// CHECK:STDOUT: return %.loc10_13.3 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Op.2[%self: Self]() -> Self; // CHECK:STDOUT: -// CHECK:STDOUT: fn @TestOp(%a: C, %b: C) -> %return: C { +// CHECK:STDOUT: fn @TestOp(%a: C) -> %return: C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C = name_ref a, %a // CHECK:STDOUT: %import_ref.1: type = import_ref ir1, inst+1, used [template = constants.%.2] // CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+13, unused -// CHECK:STDOUT: %.1: = interface_witness_access @impl.%.1, element0 [template = ] -// CHECK:STDOUT: return +// CHECK:STDOUT: %.1: = interface_witness_access @impl.%.1, element0 [template = @impl.%Op] +// CHECK:STDOUT: %.loc15_10.1: = bound_method %a.ref, %.1 +// CHECK:STDOUT: %.loc14: ref C = splice_block %return {} +// CHECK:STDOUT: %.loc15_10.2: init C = call %.loc15_10.1(%a.ref) to %.loc14 +// CHECK:STDOUT: return %.loc15_10.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_no_impl.carbon @@ -202,11 +196,11 @@ fn TestOp(a: D) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Carbon = %Carbon +// CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .D = %D.decl // CHECK:STDOUT: .TestOp = %TestOp // CHECK:STDOUT: } -// CHECK:STDOUT: %Carbon: = namespace [template] {} +// CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {} // CHECK:STDOUT: %TestOp: = fn_decl @TestOp [template] { // CHECK:STDOUT: %D.ref: type = name_ref D, %D.decl [template = constants.%D] diff --git a/toolchain/check/testdata/operators/overloaded/bit_or.carbon b/toolchain/check/testdata/operators/overloaded/bit_or.carbon index dd3d0962564f1..92215c7fae4c8 100644 --- a/toolchain/check/testdata/operators/overloaded/bit_or.carbon +++ b/toolchain/check/testdata/operators/overloaded/bit_or.carbon @@ -8,7 +8,7 @@ // --- prelude.carbon -package Carbon api; +package Core api; interface BitOr { fn Op[self: Self](other: Self) -> Self; @@ -21,16 +21,16 @@ interface BitOrAssign { package User api; -import Carbon; +import Core; class C {}; -impl C as Carbon.BitOr { +impl C as Core.BitOr { fn Op[self: C](other: C) -> C { return {}; } } -impl C as Carbon.BitOrAssign { +impl C as Core.BitOrAssign { fn Op[addr self: C*](other: C) {} } @@ -46,7 +46,7 @@ fn TestAssign(a: C*, b: C) { package FailNoImpl api; -import Carbon; +import Core; class D {}; @@ -68,11 +68,11 @@ fn TestAssign(a: D*, b: D) { package FailNoImplForArgs api; -import Carbon; +import Core; class C {}; -impl C as Carbon.BitOr { +impl C as Core.BitOr { fn Op[self: C](other: C) -> C { return {}; } @@ -194,23 +194,23 @@ fn TestLhsBad(a: D, b: C) -> C { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Carbon = %Carbon +// CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: .TestOp = %TestOp // CHECK:STDOUT: .TestAssign = %TestAssign // CHECK:STDOUT: } -// CHECK:STDOUT: %Carbon: = namespace [template] {} +// CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: impl_decl @impl.1 { // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Carbon.ref.loc8: = name_ref Carbon, %Carbon [template = %Carbon] +// CHECK:STDOUT: %Core.ref.loc8: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %import_ref.1: type = import_ref ir1, inst+1, used [template = constants.%.2] // CHECK:STDOUT: %BitOr.decl: invalid = interface_decl @BitOr [template = constants.%.2] {} // CHECK:STDOUT: %BitOr.ref: type = name_ref BitOr, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } // CHECK:STDOUT: impl_decl @impl.2 { // CHECK:STDOUT: %C.ref.loc13: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Carbon.ref.loc13: = name_ref Carbon, %Carbon [template = %Carbon] +// CHECK:STDOUT: %Core.ref.loc13: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %import_ref.2: type = import_ref ir1, inst+22, used [template = constants.%.7] // CHECK:STDOUT: %BitOrAssign.decl: invalid = interface_decl @BitOrAssign [template = constants.%.7] {} // CHECK:STDOUT: %BitOrAssign.ref: type = name_ref BitOrAssign, %import_ref.2 [template = constants.%.7] @@ -361,12 +361,12 @@ fn TestLhsBad(a: D, b: C) -> C { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Carbon = %Carbon +// CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .D = %D.decl // CHECK:STDOUT: .TestOp = %TestOp // CHECK:STDOUT: .TestAssign = %TestAssign // CHECK:STDOUT: } -// CHECK:STDOUT: %Carbon: = namespace [template] {} +// CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {} // CHECK:STDOUT: %TestOp: = fn_decl @TestOp [template] { // CHECK:STDOUT: %D.ref.loc8_14: type = name_ref D, %D.decl [template = constants.%D] @@ -454,17 +454,17 @@ fn TestLhsBad(a: D, b: C) -> C { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Carbon = %Carbon +// CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: .D = %D.decl // CHECK:STDOUT: .TestRhsBad = %TestRhsBad // CHECK:STDOUT: .TestLhsBad = %TestLhsBad // CHECK:STDOUT: } -// CHECK:STDOUT: %Carbon: = namespace [template] {} +// CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: impl_decl @impl { // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Carbon.ref: = name_ref Carbon, %Carbon [template = %Carbon] +// CHECK:STDOUT: %Core.ref: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %import_ref: type = import_ref ir1, inst+1, used [template = constants.%.2] // CHECK:STDOUT: %BitOr.decl: invalid = interface_decl @BitOr [template = constants.%.2] {} // CHECK:STDOUT: %BitOr.ref: type = name_ref BitOr, %import_ref [template = constants.%.2] diff --git a/toolchain/check/testdata/operators/overloaded/bit_xor.carbon b/toolchain/check/testdata/operators/overloaded/bit_xor.carbon index 8387cbdc3664d..e6014585974f9 100644 --- a/toolchain/check/testdata/operators/overloaded/bit_xor.carbon +++ b/toolchain/check/testdata/operators/overloaded/bit_xor.carbon @@ -8,7 +8,7 @@ // --- prelude.carbon -package Carbon api; +package Core api; interface BitXor { fn Op[self: Self](other: Self) -> Self; @@ -21,16 +21,16 @@ interface BitXorAssign { package User api; -import Carbon; +import Core; class C {}; -impl C as Carbon.BitXor { +impl C as Core.BitXor { fn Op[self: C](other: C) -> C { return {}; } } -impl C as Carbon.BitXorAssign { +impl C as Core.BitXorAssign { fn Op[addr self: C*](other: C) {} } @@ -46,7 +46,7 @@ fn TestAssign(a: C*, b: C) { package FailNoImpl api; -import Carbon; +import Core; class D {}; @@ -68,11 +68,11 @@ fn TestAssign(a: D*, b: D) { package FailNoImplForArgs api; -import Carbon; +import Core; class C {}; -impl C as Carbon.BitXor { +impl C as Core.BitXor { fn Op[self: C](other: C) -> C { return {}; } @@ -194,23 +194,23 @@ fn TestLhsBad(a: D, b: C) -> C { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Carbon = %Carbon +// CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: .TestOp = %TestOp // CHECK:STDOUT: .TestAssign = %TestAssign // CHECK:STDOUT: } -// CHECK:STDOUT: %Carbon: = namespace [template] {} +// CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: impl_decl @impl.1 { // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Carbon.ref.loc8: = name_ref Carbon, %Carbon [template = %Carbon] +// CHECK:STDOUT: %Core.ref.loc8: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %import_ref.1: type = import_ref ir1, inst+1, used [template = constants.%.2] // CHECK:STDOUT: %BitXor.decl: invalid = interface_decl @BitXor [template = constants.%.2] {} // CHECK:STDOUT: %BitXor.ref: type = name_ref BitXor, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } // CHECK:STDOUT: impl_decl @impl.2 { // CHECK:STDOUT: %C.ref.loc13: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Carbon.ref.loc13: = name_ref Carbon, %Carbon [template = %Carbon] +// CHECK:STDOUT: %Core.ref.loc13: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %import_ref.2: type = import_ref ir1, inst+22, used [template = constants.%.7] // CHECK:STDOUT: %BitXorAssign.decl: invalid = interface_decl @BitXorAssign [template = constants.%.7] {} // CHECK:STDOUT: %BitXorAssign.ref: type = name_ref BitXorAssign, %import_ref.2 [template = constants.%.7] @@ -361,12 +361,12 @@ fn TestLhsBad(a: D, b: C) -> C { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Carbon = %Carbon +// CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .D = %D.decl // CHECK:STDOUT: .TestOp = %TestOp // CHECK:STDOUT: .TestAssign = %TestAssign // CHECK:STDOUT: } -// CHECK:STDOUT: %Carbon: = namespace [template] {} +// CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {} // CHECK:STDOUT: %TestOp: = fn_decl @TestOp [template] { // CHECK:STDOUT: %D.ref.loc8_14: type = name_ref D, %D.decl [template = constants.%D] @@ -454,17 +454,17 @@ fn TestLhsBad(a: D, b: C) -> C { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Carbon = %Carbon +// CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: .D = %D.decl // CHECK:STDOUT: .TestRhsBad = %TestRhsBad // CHECK:STDOUT: .TestLhsBad = %TestLhsBad // CHECK:STDOUT: } -// CHECK:STDOUT: %Carbon: = namespace [template] {} +// CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: impl_decl @impl { // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Carbon.ref: = name_ref Carbon, %Carbon [template = %Carbon] +// CHECK:STDOUT: %Core.ref: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %import_ref: type = import_ref ir1, inst+1, used [template = constants.%.2] // CHECK:STDOUT: %BitXor.decl: invalid = interface_decl @BitXor [template = constants.%.2] {} // CHECK:STDOUT: %BitXor.ref: type = name_ref BitXor, %import_ref [template = constants.%.2] diff --git a/toolchain/check/testdata/operators/overloaded/dec.carbon b/toolchain/check/testdata/operators/overloaded/dec.carbon index bd396fdc361f3..beea951f70354 100644 --- a/toolchain/check/testdata/operators/overloaded/dec.carbon +++ b/toolchain/check/testdata/operators/overloaded/dec.carbon @@ -8,7 +8,7 @@ // --- prelude.carbon -package Carbon api; +package Core api; interface Dec { fn Op[addr self: Self*](); @@ -18,11 +18,11 @@ interface Dec { package User api; -import Carbon; +import Core; class C {}; -impl C as Carbon.Dec { +impl C as Core.Dec { fn Op[addr self: C*](); } @@ -35,7 +35,7 @@ fn TestOp() { package FailNoImpl api; -import Carbon; +import Core; class D {}; @@ -51,11 +51,11 @@ fn TestOp() { package FailNotRef api; -import Carbon; +import Core; class C {}; -impl C as Carbon.Dec { +impl C as Core.Dec { fn Op[addr self: C*](); } @@ -125,15 +125,15 @@ fn TestOp() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Carbon = %Carbon +// CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: .TestOp = %TestOp // CHECK:STDOUT: } -// CHECK:STDOUT: %Carbon: = namespace [template] {} +// CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: impl_decl @impl { // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Carbon.ref: = name_ref Carbon, %Carbon [template = %Carbon] +// CHECK:STDOUT: %Core.ref: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %import_ref: type = import_ref ir1, inst+1, used [template = constants.%.2] // CHECK:STDOUT: %Dec.decl: invalid = interface_decl @Dec [template = constants.%.2] {} // CHECK:STDOUT: %Dec.ref: type = name_ref Dec, %import_ref [template = constants.%.2] @@ -210,11 +210,11 @@ fn TestOp() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Carbon = %Carbon +// CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .D = %D.decl // CHECK:STDOUT: .TestOp = %TestOp // CHECK:STDOUT: } -// CHECK:STDOUT: %Carbon: = namespace [template] {} +// CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {} // CHECK:STDOUT: %TestOp: = fn_decl @TestOp [template] {} // CHECK:STDOUT: } @@ -269,15 +269,15 @@ fn TestOp() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Carbon = %Carbon +// CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: .TestOp = %TestOp // CHECK:STDOUT: } -// CHECK:STDOUT: %Carbon: = namespace [template] {} +// CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: impl_decl @impl { // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Carbon.ref: = name_ref Carbon, %Carbon [template = %Carbon] +// CHECK:STDOUT: %Core.ref: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %import_ref: type = import_ref ir1, inst+1, used [template = constants.%.2] // CHECK:STDOUT: %Dec.decl: invalid = interface_decl @Dec [template = constants.%.2] {} // CHECK:STDOUT: %Dec.ref: type = name_ref Dec, %import_ref [template = constants.%.2] diff --git a/toolchain/check/testdata/operators/overloaded/div.carbon b/toolchain/check/testdata/operators/overloaded/div.carbon index 2a7d9e3e22e50..68af5bcfbb87d 100644 --- a/toolchain/check/testdata/operators/overloaded/div.carbon +++ b/toolchain/check/testdata/operators/overloaded/div.carbon @@ -8,7 +8,7 @@ // --- prelude.carbon -package Carbon api; +package Core api; interface Div { fn Op[self: Self](other: Self) -> Self; @@ -21,16 +21,16 @@ interface DivAssign { package User api; -import Carbon; +import Core; class C {}; -impl C as Carbon.Div { +impl C as Core.Div { fn Op[self: C](other: C) -> C { return {}; } } -impl C as Carbon.DivAssign { +impl C as Core.DivAssign { fn Op[addr self: C*](other: C) {} } @@ -46,7 +46,7 @@ fn TestAssign(a: C*, b: C) { package FailNoImpl api; -import Carbon; +import Core; class D {}; @@ -68,11 +68,11 @@ fn TestAssign(a: D*, b: D) { package FailNoImplForArgs api; -import Carbon; +import Core; class C {}; -impl C as Carbon.Div { +impl C as Core.Div { fn Op[self: C](other: C) -> C { return {}; } @@ -194,23 +194,23 @@ fn TestLhsBad(a: D, b: C) -> C { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Carbon = %Carbon +// CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: .TestOp = %TestOp // CHECK:STDOUT: .TestAssign = %TestAssign // CHECK:STDOUT: } -// CHECK:STDOUT: %Carbon: = namespace [template] {} +// CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: impl_decl @impl.1 { // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Carbon.ref.loc8: = name_ref Carbon, %Carbon [template = %Carbon] +// CHECK:STDOUT: %Core.ref.loc8: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %import_ref.1: type = import_ref ir1, inst+1, used [template = constants.%.2] // CHECK:STDOUT: %Div.decl: invalid = interface_decl @Div [template = constants.%.2] {} // CHECK:STDOUT: %Div.ref: type = name_ref Div, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } // CHECK:STDOUT: impl_decl @impl.2 { // CHECK:STDOUT: %C.ref.loc13: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Carbon.ref.loc13: = name_ref Carbon, %Carbon [template = %Carbon] +// CHECK:STDOUT: %Core.ref.loc13: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %import_ref.2: type = import_ref ir1, inst+22, used [template = constants.%.7] // CHECK:STDOUT: %DivAssign.decl: invalid = interface_decl @DivAssign [template = constants.%.7] {} // CHECK:STDOUT: %DivAssign.ref: type = name_ref DivAssign, %import_ref.2 [template = constants.%.7] @@ -361,12 +361,12 @@ fn TestLhsBad(a: D, b: C) -> C { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Carbon = %Carbon +// CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .D = %D.decl // CHECK:STDOUT: .TestOp = %TestOp // CHECK:STDOUT: .TestAssign = %TestAssign // CHECK:STDOUT: } -// CHECK:STDOUT: %Carbon: = namespace [template] {} +// CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {} // CHECK:STDOUT: %TestOp: = fn_decl @TestOp [template] { // CHECK:STDOUT: %D.ref.loc8_14: type = name_ref D, %D.decl [template = constants.%D] @@ -454,17 +454,17 @@ fn TestLhsBad(a: D, b: C) -> C { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Carbon = %Carbon +// CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: .D = %D.decl // CHECK:STDOUT: .TestRhsBad = %TestRhsBad // CHECK:STDOUT: .TestLhsBad = %TestLhsBad // CHECK:STDOUT: } -// CHECK:STDOUT: %Carbon: = namespace [template] {} +// CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: impl_decl @impl { // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Carbon.ref: = name_ref Carbon, %Carbon [template = %Carbon] +// CHECK:STDOUT: %Core.ref: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %import_ref: type = import_ref ir1, inst+1, used [template = constants.%.2] // CHECK:STDOUT: %Div.decl: invalid = interface_decl @Div [template = constants.%.2] {} // CHECK:STDOUT: %Div.ref: type = name_ref Div, %import_ref [template = constants.%.2] diff --git a/toolchain/check/testdata/operators/overloaded/eq.carbon b/toolchain/check/testdata/operators/overloaded/eq.carbon index 3d7ba87aec596..bcc55e90a6fa9 100644 --- a/toolchain/check/testdata/operators/overloaded/eq.carbon +++ b/toolchain/check/testdata/operators/overloaded/eq.carbon @@ -6,7 +6,7 @@ // --- prelude.carbon -package Carbon api; +package Core api; interface Eq { fn Equal[self: Self](other: Self) -> bool; @@ -17,11 +17,11 @@ interface Eq { package User api; -import Carbon; +import Core; class C {}; -impl C as Carbon.Eq { +impl C as Core.Eq { fn Equal[self: C](other: C) -> bool; fn NotEqual[self: C](other: C) -> bool; } @@ -38,7 +38,7 @@ fn TestNotEqual(a: C, b: C) -> bool { package FailNoImpl api; -import Carbon; +import Core; class D {}; @@ -60,12 +60,12 @@ fn TestNotEqual(a: D, b: D) -> bool { package FailNoImplForArgs api; -import Carbon; +import Core; class C {}; class D {}; -impl C as Carbon.Eq { +impl C as Core.Eq { fn Equal[self: C](other: C) -> bool; fn NotEqual[self: C](other: C) -> bool; } @@ -161,16 +161,16 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Carbon = %Carbon +// CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: .TestEqual = %TestEqual // CHECK:STDOUT: .TestNotEqual = %TestNotEqual // CHECK:STDOUT: } -// CHECK:STDOUT: %Carbon: = namespace [template] {} +// CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: impl_decl @impl { // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Carbon.ref: = name_ref Carbon, %Carbon [template = %Carbon] +// CHECK:STDOUT: %Core.ref: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %import_ref: type = import_ref ir1, inst+1, used [template = constants.%.2] // CHECK:STDOUT: %Eq.decl: invalid = interface_decl @Eq [template = constants.%.2] {} // CHECK:STDOUT: %Eq.ref: type = name_ref Eq, %import_ref [template = constants.%.2] @@ -292,12 +292,12 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Carbon = %Carbon +// CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .D = %D.decl // CHECK:STDOUT: .TestEqual = %TestEqual // CHECK:STDOUT: .TestNotEqual = %TestNotEqual // CHECK:STDOUT: } -// CHECK:STDOUT: %Carbon: = namespace [template] {} +// CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {} // CHECK:STDOUT: %TestEqual: = fn_decl @TestEqual [template] { // CHECK:STDOUT: %D.ref.loc8_17: type = name_ref D, %D.decl [template = constants.%D] @@ -374,18 +374,18 @@ fn TestLhsBad(a: D, b: C) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Carbon = %Carbon +// CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: .D = %D.decl // CHECK:STDOUT: .TestRhsBad = %TestRhsBad // CHECK:STDOUT: .TestLhsBad = %TestLhsBad // CHECK:STDOUT: } -// CHECK:STDOUT: %Carbon: = namespace [template] {} +// CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {} // CHECK:STDOUT: impl_decl @impl { // CHECK:STDOUT: %C.ref.loc9: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Carbon.ref: = name_ref Carbon, %Carbon [template = %Carbon] +// CHECK:STDOUT: %Core.ref: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %import_ref: type = import_ref ir1, inst+1, used [template = constants.%.2] // CHECK:STDOUT: %Eq.decl: invalid = interface_decl @Eq [template = constants.%.2] {} // CHECK:STDOUT: %Eq.ref: type = name_ref Eq, %import_ref [template = constants.%.2] diff --git a/toolchain/check/testdata/operators/overloaded/inc.carbon b/toolchain/check/testdata/operators/overloaded/inc.carbon index 87755b0a8435b..9b169f001364d 100644 --- a/toolchain/check/testdata/operators/overloaded/inc.carbon +++ b/toolchain/check/testdata/operators/overloaded/inc.carbon @@ -8,7 +8,7 @@ // --- prelude.carbon -package Carbon api; +package Core api; interface Inc { fn Op[addr self: Self*](); @@ -18,11 +18,11 @@ interface Inc { package User api; -import Carbon; +import Core; class C {}; -impl C as Carbon.Inc { +impl C as Core.Inc { fn Op[addr self: C*](); } @@ -35,7 +35,7 @@ fn TestOp() { package FailNoImpl api; -import Carbon; +import Core; class D {}; @@ -51,11 +51,11 @@ fn TestOp() { package FailNotRef api; -import Carbon; +import Core; class C {}; -impl C as Carbon.Inc { +impl C as Core.Inc { fn Op[addr self: C*](); } @@ -125,15 +125,15 @@ fn TestOp() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Carbon = %Carbon +// CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: .TestOp = %TestOp // CHECK:STDOUT: } -// CHECK:STDOUT: %Carbon: = namespace [template] {} +// CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: impl_decl @impl { // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Carbon.ref: = name_ref Carbon, %Carbon [template = %Carbon] +// CHECK:STDOUT: %Core.ref: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %import_ref: type = import_ref ir1, inst+1, used [template = constants.%.2] // CHECK:STDOUT: %Inc.decl: invalid = interface_decl @Inc [template = constants.%.2] {} // CHECK:STDOUT: %Inc.ref: type = name_ref Inc, %import_ref [template = constants.%.2] @@ -210,11 +210,11 @@ fn TestOp() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Carbon = %Carbon +// CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .D = %D.decl // CHECK:STDOUT: .TestOp = %TestOp // CHECK:STDOUT: } -// CHECK:STDOUT: %Carbon: = namespace [template] {} +// CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {} // CHECK:STDOUT: %TestOp: = fn_decl @TestOp [template] {} // CHECK:STDOUT: } @@ -269,15 +269,15 @@ fn TestOp() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Carbon = %Carbon +// CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: .TestOp = %TestOp // CHECK:STDOUT: } -// CHECK:STDOUT: %Carbon: = namespace [template] {} +// CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: impl_decl @impl { // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Carbon.ref: = name_ref Carbon, %Carbon [template = %Carbon] +// CHECK:STDOUT: %Core.ref: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %import_ref: type = import_ref ir1, inst+1, used [template = constants.%.2] // CHECK:STDOUT: %Inc.decl: invalid = interface_decl @Inc [template = constants.%.2] {} // CHECK:STDOUT: %Inc.ref: type = name_ref Inc, %import_ref [template = constants.%.2] diff --git a/toolchain/check/testdata/operators/overloaded/left_shift.carbon b/toolchain/check/testdata/operators/overloaded/left_shift.carbon index a9cae646147da..bf08ca64e29e2 100644 --- a/toolchain/check/testdata/operators/overloaded/left_shift.carbon +++ b/toolchain/check/testdata/operators/overloaded/left_shift.carbon @@ -8,7 +8,7 @@ // --- prelude.carbon -package Carbon api; +package Core api; interface LeftShift { fn Op[self: Self](other: Self) -> Self; @@ -21,16 +21,16 @@ interface LeftShiftAssign { package User api; -import Carbon; +import Core; class C {}; -impl C as Carbon.LeftShift { +impl C as Core.LeftShift { fn Op[self: C](other: C) -> C { return {}; } } -impl C as Carbon.LeftShiftAssign { +impl C as Core.LeftShiftAssign { fn Op[addr self: C*](other: C) {} } @@ -46,7 +46,7 @@ fn TestAssign(a: C*, b: C) { package FailNoImpl api; -import Carbon; +import Core; class D {}; @@ -68,11 +68,11 @@ fn TestAssign(a: D*, b: D) { package FailNoImplForArgs api; -import Carbon; +import Core; class C {}; -impl C as Carbon.LeftShift { +impl C as Core.LeftShift { fn Op[self: C](other: C) -> C { return {}; } @@ -194,23 +194,23 @@ fn TestLhsBad(a: D, b: C) -> C { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Carbon = %Carbon +// CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: .TestOp = %TestOp // CHECK:STDOUT: .TestAssign = %TestAssign // CHECK:STDOUT: } -// CHECK:STDOUT: %Carbon: = namespace [template] {} +// CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: impl_decl @impl.1 { // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Carbon.ref.loc8: = name_ref Carbon, %Carbon [template = %Carbon] +// CHECK:STDOUT: %Core.ref.loc8: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %import_ref.1: type = import_ref ir1, inst+1, used [template = constants.%.2] // CHECK:STDOUT: %LeftShift.decl: invalid = interface_decl @LeftShift [template = constants.%.2] {} // CHECK:STDOUT: %LeftShift.ref: type = name_ref LeftShift, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } // CHECK:STDOUT: impl_decl @impl.2 { // CHECK:STDOUT: %C.ref.loc13: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Carbon.ref.loc13: = name_ref Carbon, %Carbon [template = %Carbon] +// CHECK:STDOUT: %Core.ref.loc13: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %import_ref.2: type = import_ref ir1, inst+22, used [template = constants.%.7] // CHECK:STDOUT: %LeftShiftAssign.decl: invalid = interface_decl @LeftShiftAssign [template = constants.%.7] {} // CHECK:STDOUT: %LeftShiftAssign.ref: type = name_ref LeftShiftAssign, %import_ref.2 [template = constants.%.7] @@ -361,12 +361,12 @@ fn TestLhsBad(a: D, b: C) -> C { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Carbon = %Carbon +// CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .D = %D.decl // CHECK:STDOUT: .TestOp = %TestOp // CHECK:STDOUT: .TestAssign = %TestAssign // CHECK:STDOUT: } -// CHECK:STDOUT: %Carbon: = namespace [template] {} +// CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {} // CHECK:STDOUT: %TestOp: = fn_decl @TestOp [template] { // CHECK:STDOUT: %D.ref.loc8_14: type = name_ref D, %D.decl [template = constants.%D] @@ -454,17 +454,17 @@ fn TestLhsBad(a: D, b: C) -> C { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Carbon = %Carbon +// CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: .D = %D.decl // CHECK:STDOUT: .TestRhsBad = %TestRhsBad // CHECK:STDOUT: .TestLhsBad = %TestLhsBad // CHECK:STDOUT: } -// CHECK:STDOUT: %Carbon: = namespace [template] {} +// CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: impl_decl @impl { // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Carbon.ref: = name_ref Carbon, %Carbon [template = %Carbon] +// CHECK:STDOUT: %Core.ref: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %import_ref: type = import_ref ir1, inst+1, used [template = constants.%.2] // CHECK:STDOUT: %LeftShift.decl: invalid = interface_decl @LeftShift [template = constants.%.2] {} // CHECK:STDOUT: %LeftShift.ref: type = name_ref LeftShift, %import_ref [template = constants.%.2] diff --git a/toolchain/check/testdata/operators/overloaded/make_tests.sh b/toolchain/check/testdata/operators/overloaded/make_tests.sh index 2e5cdc5487fb6..686530c9769f7 100755 --- a/toolchain/check/testdata/operators/overloaded/make_tests.sh +++ b/toolchain/check/testdata/operators/overloaded/make_tests.sh @@ -5,7 +5,7 @@ make_test() { HEADER="// This file was generated from $4. Run make_tests.sh to regenerate." - sed "s,INTERFACE,$1,g; s,OP,$2,g; s,HEADER,$HEADER," $4 > $3.carbon + sed "s,INTERFACE,$1,g; s,OP,$2,g; s,HEADER,$HEADER," "$4" > "$3.carbon" } make_unary_op_test() { @@ -27,7 +27,7 @@ make_unary_stmt_test Dec '--' dec make_unary_stmt_test Inc '++' inc make_binary_op_test Add '+' add -make_binary_op_test BitAnd '&' bit_and +make_binary_op_test BitAnd '\&' bit_and make_binary_op_test BitOr '|' bit_or make_binary_op_test BitXor '^' bit_xor make_binary_op_test Div '/' div diff --git a/toolchain/check/testdata/operators/overloaded/mod.carbon b/toolchain/check/testdata/operators/overloaded/mod.carbon index cf8dc4fca5d7e..04fd463378a01 100644 --- a/toolchain/check/testdata/operators/overloaded/mod.carbon +++ b/toolchain/check/testdata/operators/overloaded/mod.carbon @@ -8,7 +8,7 @@ // --- prelude.carbon -package Carbon api; +package Core api; interface Mod { fn Op[self: Self](other: Self) -> Self; @@ -21,16 +21,16 @@ interface ModAssign { package User api; -import Carbon; +import Core; class C {}; -impl C as Carbon.Mod { +impl C as Core.Mod { fn Op[self: C](other: C) -> C { return {}; } } -impl C as Carbon.ModAssign { +impl C as Core.ModAssign { fn Op[addr self: C*](other: C) {} } @@ -46,7 +46,7 @@ fn TestAssign(a: C*, b: C) { package FailNoImpl api; -import Carbon; +import Core; class D {}; @@ -68,11 +68,11 @@ fn TestAssign(a: D*, b: D) { package FailNoImplForArgs api; -import Carbon; +import Core; class C {}; -impl C as Carbon.Mod { +impl C as Core.Mod { fn Op[self: C](other: C) -> C { return {}; } @@ -194,23 +194,23 @@ fn TestLhsBad(a: D, b: C) -> C { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Carbon = %Carbon +// CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: .TestOp = %TestOp // CHECK:STDOUT: .TestAssign = %TestAssign // CHECK:STDOUT: } -// CHECK:STDOUT: %Carbon: = namespace [template] {} +// CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: impl_decl @impl.1 { // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Carbon.ref.loc8: = name_ref Carbon, %Carbon [template = %Carbon] +// CHECK:STDOUT: %Core.ref.loc8: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %import_ref.1: type = import_ref ir1, inst+1, used [template = constants.%.2] // CHECK:STDOUT: %Mod.decl: invalid = interface_decl @Mod [template = constants.%.2] {} // CHECK:STDOUT: %Mod.ref: type = name_ref Mod, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } // CHECK:STDOUT: impl_decl @impl.2 { // CHECK:STDOUT: %C.ref.loc13: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Carbon.ref.loc13: = name_ref Carbon, %Carbon [template = %Carbon] +// CHECK:STDOUT: %Core.ref.loc13: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %import_ref.2: type = import_ref ir1, inst+22, used [template = constants.%.7] // CHECK:STDOUT: %ModAssign.decl: invalid = interface_decl @ModAssign [template = constants.%.7] {} // CHECK:STDOUT: %ModAssign.ref: type = name_ref ModAssign, %import_ref.2 [template = constants.%.7] @@ -361,12 +361,12 @@ fn TestLhsBad(a: D, b: C) -> C { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Carbon = %Carbon +// CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .D = %D.decl // CHECK:STDOUT: .TestOp = %TestOp // CHECK:STDOUT: .TestAssign = %TestAssign // CHECK:STDOUT: } -// CHECK:STDOUT: %Carbon: = namespace [template] {} +// CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {} // CHECK:STDOUT: %TestOp: = fn_decl @TestOp [template] { // CHECK:STDOUT: %D.ref.loc8_14: type = name_ref D, %D.decl [template = constants.%D] @@ -454,17 +454,17 @@ fn TestLhsBad(a: D, b: C) -> C { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Carbon = %Carbon +// CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: .D = %D.decl // CHECK:STDOUT: .TestRhsBad = %TestRhsBad // CHECK:STDOUT: .TestLhsBad = %TestLhsBad // CHECK:STDOUT: } -// CHECK:STDOUT: %Carbon: = namespace [template] {} +// CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: impl_decl @impl { // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Carbon.ref: = name_ref Carbon, %Carbon [template = %Carbon] +// CHECK:STDOUT: %Core.ref: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %import_ref: type = import_ref ir1, inst+1, used [template = constants.%.2] // CHECK:STDOUT: %Mod.decl: invalid = interface_decl @Mod [template = constants.%.2] {} // CHECK:STDOUT: %Mod.ref: type = name_ref Mod, %import_ref [template = constants.%.2] diff --git a/toolchain/check/testdata/operators/overloaded/mul.carbon b/toolchain/check/testdata/operators/overloaded/mul.carbon index c483068bdf53e..3ccd26b1867f2 100644 --- a/toolchain/check/testdata/operators/overloaded/mul.carbon +++ b/toolchain/check/testdata/operators/overloaded/mul.carbon @@ -8,7 +8,7 @@ // --- prelude.carbon -package Carbon api; +package Core api; interface Mul { fn Op[self: Self](other: Self) -> Self; @@ -21,16 +21,16 @@ interface MulAssign { package User api; -import Carbon; +import Core; class C {}; -impl C as Carbon.Mul { +impl C as Core.Mul { fn Op[self: C](other: C) -> C { return {}; } } -impl C as Carbon.MulAssign { +impl C as Core.MulAssign { fn Op[addr self: C*](other: C) {} } @@ -46,7 +46,7 @@ fn TestAssign(a: C*, b: C) { package FailNoImpl api; -import Carbon; +import Core; class D {}; @@ -68,11 +68,11 @@ fn TestAssign(a: D*, b: D) { package FailNoImplForArgs api; -import Carbon; +import Core; class C {}; -impl C as Carbon.Mul { +impl C as Core.Mul { fn Op[self: C](other: C) -> C { return {}; } @@ -194,23 +194,23 @@ fn TestLhsBad(a: D, b: C) -> C { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Carbon = %Carbon +// CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: .TestOp = %TestOp // CHECK:STDOUT: .TestAssign = %TestAssign // CHECK:STDOUT: } -// CHECK:STDOUT: %Carbon: = namespace [template] {} +// CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: impl_decl @impl.1 { // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Carbon.ref.loc8: = name_ref Carbon, %Carbon [template = %Carbon] +// CHECK:STDOUT: %Core.ref.loc8: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %import_ref.1: type = import_ref ir1, inst+1, used [template = constants.%.2] // CHECK:STDOUT: %Mul.decl: invalid = interface_decl @Mul [template = constants.%.2] {} // CHECK:STDOUT: %Mul.ref: type = name_ref Mul, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } // CHECK:STDOUT: impl_decl @impl.2 { // CHECK:STDOUT: %C.ref.loc13: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Carbon.ref.loc13: = name_ref Carbon, %Carbon [template = %Carbon] +// CHECK:STDOUT: %Core.ref.loc13: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %import_ref.2: type = import_ref ir1, inst+22, used [template = constants.%.7] // CHECK:STDOUT: %MulAssign.decl: invalid = interface_decl @MulAssign [template = constants.%.7] {} // CHECK:STDOUT: %MulAssign.ref: type = name_ref MulAssign, %import_ref.2 [template = constants.%.7] @@ -361,12 +361,12 @@ fn TestLhsBad(a: D, b: C) -> C { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Carbon = %Carbon +// CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .D = %D.decl // CHECK:STDOUT: .TestOp = %TestOp // CHECK:STDOUT: .TestAssign = %TestAssign // CHECK:STDOUT: } -// CHECK:STDOUT: %Carbon: = namespace [template] {} +// CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {} // CHECK:STDOUT: %TestOp: = fn_decl @TestOp [template] { // CHECK:STDOUT: %D.ref.loc8_14: type = name_ref D, %D.decl [template = constants.%D] @@ -454,17 +454,17 @@ fn TestLhsBad(a: D, b: C) -> C { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Carbon = %Carbon +// CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: .D = %D.decl // CHECK:STDOUT: .TestRhsBad = %TestRhsBad // CHECK:STDOUT: .TestLhsBad = %TestLhsBad // CHECK:STDOUT: } -// CHECK:STDOUT: %Carbon: = namespace [template] {} +// CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: impl_decl @impl { // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Carbon.ref: = name_ref Carbon, %Carbon [template = %Carbon] +// CHECK:STDOUT: %Core.ref: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %import_ref: type = import_ref ir1, inst+1, used [template = constants.%.2] // CHECK:STDOUT: %Mul.decl: invalid = interface_decl @Mul [template = constants.%.2] {} // CHECK:STDOUT: %Mul.ref: type = name_ref Mul, %import_ref [template = constants.%.2] diff --git a/toolchain/check/testdata/operators/overloaded/negate.carbon b/toolchain/check/testdata/operators/overloaded/negate.carbon index d20867c369821..705d76f7a5c0c 100644 --- a/toolchain/check/testdata/operators/overloaded/negate.carbon +++ b/toolchain/check/testdata/operators/overloaded/negate.carbon @@ -8,7 +8,7 @@ // --- prelude.carbon -package Carbon api; +package Core api; interface Negate { fn Op[self: Self]() -> Self; @@ -18,21 +18,17 @@ interface Negate { package User api; -import Carbon; +import Core; class C {}; -impl C as Carbon.Negate { - // CHECK:STDERR: user.carbon:[[@LINE+4]]:3: ERROR: Function redeclaration differs because of parameter count of 1. - // CHECK:STDERR: fn Op[self: C](other: C) -> C { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // CHECK:STDERR: user.carbon: Previously declared with parameter count of 0. - fn Op[self: C](other: C) -> C { +impl C as Core.Negate { + fn Op[self: C]() -> C { return {}; } } -fn TestOp(a: C, b: C) -> C { +fn TestOp(a: C) -> C { return -a; } @@ -40,7 +36,7 @@ fn TestOp(a: C, b: C) -> C { package FailNoImpl api; -import Carbon; +import Core; class D {}; @@ -104,39 +100,37 @@ fn TestOp(a: D) { // CHECK:STDOUT: %.3: type = tuple_type () [template] // CHECK:STDOUT: %.4: type = ptr_type {} [template] // CHECK:STDOUT: %.5: C = struct_value () [template] -// CHECK:STDOUT: %.6: type = assoc_entity_type @Negate, [template] -// CHECK:STDOUT: %.7: in Negate> = assoc_entity element0, @TestOp.%import_ref.2 [template] +// CHECK:STDOUT: %.6: = interface_witness (@impl.%Op) [template] +// CHECK:STDOUT: %.7: type = assoc_entity_type @Negate, [template] +// CHECK:STDOUT: %.8: in Negate> = assoc_entity element0, @TestOp.%import_ref.2 [template] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Carbon = %Carbon +// CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: .TestOp = %TestOp // CHECK:STDOUT: } -// CHECK:STDOUT: %Carbon: = namespace [template] {} +// CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: impl_decl @impl { // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Carbon.ref: = name_ref Carbon, %Carbon [template = %Carbon] +// CHECK:STDOUT: %Core.ref: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %import_ref: type = import_ref ir1, inst+1, used [template = constants.%.2] // CHECK:STDOUT: %Negate.decl: invalid = interface_decl @Negate [template = constants.%.2] {} // CHECK:STDOUT: %Negate.ref: type = name_ref Negate, %import_ref [template = constants.%.2] // CHECK:STDOUT: } // CHECK:STDOUT: %TestOp: = fn_decl @TestOp [template] { -// CHECK:STDOUT: %C.ref.loc18_14: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %a.loc18_11.1: C = param a -// CHECK:STDOUT: @TestOp.%a: C = bind_name a, %a.loc18_11.1 -// CHECK:STDOUT: %C.ref.loc18_20: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %b.loc18_17.1: C = param b -// CHECK:STDOUT: @TestOp.%b: C = bind_name b, %b.loc18_17.1 -// CHECK:STDOUT: %C.ref.loc18_26: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %C.ref.loc14_14: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %a.loc14_11.1: C = param a +// CHECK:STDOUT: @TestOp.%a: C = bind_name a, %a.loc14_11.1 +// CHECK:STDOUT: %C.ref.loc14_20: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: @TestOp.%return: ref C = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Negate { -// CHECK:STDOUT: %import_ref.1: in Negate> = import_ref ir1, inst+15, used [template = constants.%.7] +// CHECK:STDOUT: %import_ref.1: in Negate> = import_ref ir1, inst+15, used [template = constants.%.8] // CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+3, unused // CHECK:STDOUT: %import_ref.3: = import_ref ir1, inst+13, used [template = imports.%Op] // CHECK:STDOUT: @@ -148,16 +142,13 @@ fn TestOp(a: D) { // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: C as Negate { // CHECK:STDOUT: %Op: = fn_decl @Op.1 [template] { -// CHECK:STDOUT: %C.ref.loc13_15: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %self.loc13_9.1: C = param self -// CHECK:STDOUT: %self.loc13_9.2: C = bind_name self, %self.loc13_9.1 -// CHECK:STDOUT: %C.ref.loc13_25: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %other.loc13_18.1: C = param other -// CHECK:STDOUT: %other.loc13_18.2: C = bind_name other, %other.loc13_18.1 -// CHECK:STDOUT: %C.ref.loc13_31: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %C.ref.loc9_15: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %self.loc9_9.1: C = param self +// CHECK:STDOUT: %self.loc9_9.2: C = bind_name self, %self.loc9_9.1 +// CHECK:STDOUT: %C.ref.loc9_23: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %return.var: ref C = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.1: = interface_witness () [template = ] +// CHECK:STDOUT: %.1: = interface_witness (%Op) [template = constants.%.6] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Op = %Op @@ -169,23 +160,26 @@ fn TestOp(a: D) { // CHECK:STDOUT: .Self = constants.%C // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Op.1[@impl.%self.loc13_9.2: C](@impl.%other.loc13_18.2: C) -> @impl.%return.var: C { +// CHECK:STDOUT: fn @Op.1[@impl.%self.loc9_9.2: C]() -> @impl.%return.var: C { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc14_13.1: {} = struct_literal () -// CHECK:STDOUT: %.loc14_13.2: init C = class_init (), @impl.%return.var [template = constants.%.5] -// CHECK:STDOUT: %.loc14_13.3: init C = converted %.loc14_13.1, %.loc14_13.2 [template = constants.%.5] -// CHECK:STDOUT: return %.loc14_13.3 +// CHECK:STDOUT: %.loc10_13.1: {} = struct_literal () +// CHECK:STDOUT: %.loc10_13.2: init C = class_init (), @impl.%return.var [template = constants.%.5] +// CHECK:STDOUT: %.loc10_13.3: init C = converted %.loc10_13.1, %.loc10_13.2 [template = constants.%.5] +// CHECK:STDOUT: return %.loc10_13.3 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Op.2[%self: Self]() -> Self; // CHECK:STDOUT: -// CHECK:STDOUT: fn @TestOp(%a: C, %b: C) -> %return: C { +// CHECK:STDOUT: fn @TestOp(%a: C) -> %return: C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C = name_ref a, %a // CHECK:STDOUT: %import_ref.1: type = import_ref ir1, inst+1, used [template = constants.%.2] // CHECK:STDOUT: %import_ref.2 = import_ref ir1, inst+13, unused -// CHECK:STDOUT: %.1: = interface_witness_access @impl.%.1, element0 [template = ] -// CHECK:STDOUT: return +// CHECK:STDOUT: %.1: = interface_witness_access @impl.%.1, element0 [template = @impl.%Op] +// CHECK:STDOUT: %.loc15_10.1: = bound_method %a.ref, %.1 +// CHECK:STDOUT: %.loc14: ref C = splice_block %return {} +// CHECK:STDOUT: %.loc15_10.2: init C = call %.loc15_10.1(%a.ref) to %.loc14 +// CHECK:STDOUT: return %.loc15_10.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_no_impl.carbon @@ -202,11 +196,11 @@ fn TestOp(a: D) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Carbon = %Carbon +// CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .D = %D.decl // CHECK:STDOUT: .TestOp = %TestOp // CHECK:STDOUT: } -// CHECK:STDOUT: %Carbon: = namespace [template] {} +// CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {} // CHECK:STDOUT: %TestOp: = fn_decl @TestOp [template] { // CHECK:STDOUT: %D.ref: type = name_ref D, %D.decl [template = constants.%D] diff --git a/toolchain/check/testdata/operators/overloaded/ordered.carbon b/toolchain/check/testdata/operators/overloaded/ordered.carbon index 8f367ca95b44e..e158a533ab4c1 100644 --- a/toolchain/check/testdata/operators/overloaded/ordered.carbon +++ b/toolchain/check/testdata/operators/overloaded/ordered.carbon @@ -6,7 +6,7 @@ // --- prelude.carbon -package Carbon api; +package Core api; interface Ordered { // TODO: fn Compare @@ -20,11 +20,11 @@ interface Ordered { package User api; -import Carbon; +import Core; class C {}; -impl C as Carbon.Ordered { +impl C as Core.Ordered { fn Less[self: C](other: C) -> bool; fn LessOrEquivalent[self: C](other: C) -> bool; fn Greater[self: C](other: C) -> bool; @@ -51,7 +51,7 @@ fn TestGreaterEqual(a: C, b: C) -> bool { package FailNoImpl api; -import Carbon; +import Core; class D {}; @@ -195,18 +195,18 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Carbon = %Carbon +// CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: .TestLess = %TestLess // CHECK:STDOUT: .TestLessEqual = %TestLessEqual // CHECK:STDOUT: .TestGreater = %TestGreater // CHECK:STDOUT: .TestGreaterEqual = %TestGreaterEqual // CHECK:STDOUT: } -// CHECK:STDOUT: %Carbon: = namespace [template] {} +// CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: impl_decl @impl { // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Carbon.ref: = name_ref Carbon, %Carbon [template = %Carbon] +// CHECK:STDOUT: %Core.ref: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %import_ref: type = import_ref ir1, inst+1, used [template = constants.%.2] // CHECK:STDOUT: %Ordered.decl: invalid = interface_decl @Ordered [template = constants.%.2] {} // CHECK:STDOUT: %Ordered.ref: type = name_ref Ordered, %import_ref [template = constants.%.2] @@ -410,14 +410,14 @@ fn TestGreaterEqual(a: D, b: D) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Carbon = %Carbon +// CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .D = %D.decl // CHECK:STDOUT: .TestLess = %TestLess // CHECK:STDOUT: .TestLessEqual = %TestLessEqual // CHECK:STDOUT: .TestGreater = %TestGreater // CHECK:STDOUT: .TestGreaterEqual = %TestGreaterEqual // CHECK:STDOUT: } -// CHECK:STDOUT: %Carbon: = namespace [template] {} +// CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {} // CHECK:STDOUT: %TestLess: = fn_decl @TestLess [template] { // CHECK:STDOUT: %D.ref.loc8_16: type = name_ref D, %D.decl [template = constants.%D] diff --git a/toolchain/check/testdata/operators/overloaded/right_shift.carbon b/toolchain/check/testdata/operators/overloaded/right_shift.carbon index 84fd0d06353fd..596bf582cd4c0 100644 --- a/toolchain/check/testdata/operators/overloaded/right_shift.carbon +++ b/toolchain/check/testdata/operators/overloaded/right_shift.carbon @@ -8,7 +8,7 @@ // --- prelude.carbon -package Carbon api; +package Core api; interface RightShift { fn Op[self: Self](other: Self) -> Self; @@ -21,16 +21,16 @@ interface RightShiftAssign { package User api; -import Carbon; +import Core; class C {}; -impl C as Carbon.RightShift { +impl C as Core.RightShift { fn Op[self: C](other: C) -> C { return {}; } } -impl C as Carbon.RightShiftAssign { +impl C as Core.RightShiftAssign { fn Op[addr self: C*](other: C) {} } @@ -46,7 +46,7 @@ fn TestAssign(a: C*, b: C) { package FailNoImpl api; -import Carbon; +import Core; class D {}; @@ -68,11 +68,11 @@ fn TestAssign(a: D*, b: D) { package FailNoImplForArgs api; -import Carbon; +import Core; class C {}; -impl C as Carbon.RightShift { +impl C as Core.RightShift { fn Op[self: C](other: C) -> C { return {}; } @@ -194,23 +194,23 @@ fn TestLhsBad(a: D, b: C) -> C { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Carbon = %Carbon +// CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: .TestOp = %TestOp // CHECK:STDOUT: .TestAssign = %TestAssign // CHECK:STDOUT: } -// CHECK:STDOUT: %Carbon: = namespace [template] {} +// CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: impl_decl @impl.1 { // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Carbon.ref.loc8: = name_ref Carbon, %Carbon [template = %Carbon] +// CHECK:STDOUT: %Core.ref.loc8: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %import_ref.1: type = import_ref ir1, inst+1, used [template = constants.%.2] // CHECK:STDOUT: %RightShift.decl: invalid = interface_decl @RightShift [template = constants.%.2] {} // CHECK:STDOUT: %RightShift.ref: type = name_ref RightShift, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } // CHECK:STDOUT: impl_decl @impl.2 { // CHECK:STDOUT: %C.ref.loc13: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Carbon.ref.loc13: = name_ref Carbon, %Carbon [template = %Carbon] +// CHECK:STDOUT: %Core.ref.loc13: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %import_ref.2: type = import_ref ir1, inst+22, used [template = constants.%.7] // CHECK:STDOUT: %RightShiftAssign.decl: invalid = interface_decl @RightShiftAssign [template = constants.%.7] {} // CHECK:STDOUT: %RightShiftAssign.ref: type = name_ref RightShiftAssign, %import_ref.2 [template = constants.%.7] @@ -361,12 +361,12 @@ fn TestLhsBad(a: D, b: C) -> C { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Carbon = %Carbon +// CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .D = %D.decl // CHECK:STDOUT: .TestOp = %TestOp // CHECK:STDOUT: .TestAssign = %TestAssign // CHECK:STDOUT: } -// CHECK:STDOUT: %Carbon: = namespace [template] {} +// CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {} // CHECK:STDOUT: %TestOp: = fn_decl @TestOp [template] { // CHECK:STDOUT: %D.ref.loc8_14: type = name_ref D, %D.decl [template = constants.%D] @@ -454,17 +454,17 @@ fn TestLhsBad(a: D, b: C) -> C { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Carbon = %Carbon +// CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: .D = %D.decl // CHECK:STDOUT: .TestRhsBad = %TestRhsBad // CHECK:STDOUT: .TestLhsBad = %TestLhsBad // CHECK:STDOUT: } -// CHECK:STDOUT: %Carbon: = namespace [template] {} +// CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: impl_decl @impl { // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Carbon.ref: = name_ref Carbon, %Carbon [template = %Carbon] +// CHECK:STDOUT: %Core.ref: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %import_ref: type = import_ref ir1, inst+1, used [template = constants.%.2] // CHECK:STDOUT: %RightShift.decl: invalid = interface_decl @RightShift [template = constants.%.2] {} // CHECK:STDOUT: %RightShift.ref: type = name_ref RightShift, %import_ref [template = constants.%.2] diff --git a/toolchain/check/testdata/operators/overloaded/sub.carbon b/toolchain/check/testdata/operators/overloaded/sub.carbon index 92434ae84671a..ee0a814d054e6 100644 --- a/toolchain/check/testdata/operators/overloaded/sub.carbon +++ b/toolchain/check/testdata/operators/overloaded/sub.carbon @@ -8,7 +8,7 @@ // --- prelude.carbon -package Carbon api; +package Core api; interface Sub { fn Op[self: Self](other: Self) -> Self; @@ -21,16 +21,16 @@ interface SubAssign { package User api; -import Carbon; +import Core; class C {}; -impl C as Carbon.Sub { +impl C as Core.Sub { fn Op[self: C](other: C) -> C { return {}; } } -impl C as Carbon.SubAssign { +impl C as Core.SubAssign { fn Op[addr self: C*](other: C) {} } @@ -46,7 +46,7 @@ fn TestAssign(a: C*, b: C) { package FailNoImpl api; -import Carbon; +import Core; class D {}; @@ -68,11 +68,11 @@ fn TestAssign(a: D*, b: D) { package FailNoImplForArgs api; -import Carbon; +import Core; class C {}; -impl C as Carbon.Sub { +impl C as Core.Sub { fn Op[self: C](other: C) -> C { return {}; } @@ -194,23 +194,23 @@ fn TestLhsBad(a: D, b: C) -> C { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Carbon = %Carbon +// CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: .TestOp = %TestOp // CHECK:STDOUT: .TestAssign = %TestAssign // CHECK:STDOUT: } -// CHECK:STDOUT: %Carbon: = namespace [template] {} +// CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: impl_decl @impl.1 { // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Carbon.ref.loc8: = name_ref Carbon, %Carbon [template = %Carbon] +// CHECK:STDOUT: %Core.ref.loc8: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %import_ref.1: type = import_ref ir1, inst+1, used [template = constants.%.2] // CHECK:STDOUT: %Sub.decl: invalid = interface_decl @Sub [template = constants.%.2] {} // CHECK:STDOUT: %Sub.ref: type = name_ref Sub, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } // CHECK:STDOUT: impl_decl @impl.2 { // CHECK:STDOUT: %C.ref.loc13: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Carbon.ref.loc13: = name_ref Carbon, %Carbon [template = %Carbon] +// CHECK:STDOUT: %Core.ref.loc13: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %import_ref.2: type = import_ref ir1, inst+22, used [template = constants.%.7] // CHECK:STDOUT: %SubAssign.decl: invalid = interface_decl @SubAssign [template = constants.%.7] {} // CHECK:STDOUT: %SubAssign.ref: type = name_ref SubAssign, %import_ref.2 [template = constants.%.7] @@ -361,12 +361,12 @@ fn TestLhsBad(a: D, b: C) -> C { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Carbon = %Carbon +// CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .D = %D.decl // CHECK:STDOUT: .TestOp = %TestOp // CHECK:STDOUT: .TestAssign = %TestAssign // CHECK:STDOUT: } -// CHECK:STDOUT: %Carbon: = namespace [template] {} +// CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {} // CHECK:STDOUT: %TestOp: = fn_decl @TestOp [template] { // CHECK:STDOUT: %D.ref.loc8_14: type = name_ref D, %D.decl [template = constants.%D] @@ -454,17 +454,17 @@ fn TestLhsBad(a: D, b: C) -> C { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Carbon = %Carbon +// CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: .D = %D.decl // CHECK:STDOUT: .TestRhsBad = %TestRhsBad // CHECK:STDOUT: .TestLhsBad = %TestLhsBad // CHECK:STDOUT: } -// CHECK:STDOUT: %Carbon: = namespace [template] {} +// CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: impl_decl @impl { // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Carbon.ref: = name_ref Carbon, %Carbon [template = %Carbon] +// CHECK:STDOUT: %Core.ref: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %import_ref: type = import_ref ir1, inst+1, used [template = constants.%.2] // CHECK:STDOUT: %Sub.decl: invalid = interface_decl @Sub [template = constants.%.2] {} // CHECK:STDOUT: %Sub.ref: type = name_ref Sub, %import_ref [template = constants.%.2] diff --git a/toolchain/check/testdata/operators/overloaded/unary_op.carbon.in b/toolchain/check/testdata/operators/overloaded/unary_op.carbon.in index 5c0b6b2575bfe..a9d49b8100aea 100644 --- a/toolchain/check/testdata/operators/overloaded/unary_op.carbon.in +++ b/toolchain/check/testdata/operators/overloaded/unary_op.carbon.in @@ -8,7 +8,7 @@ HEADER // --- prelude.carbon -package Carbon api; +package Core api; interface INTERFACE { fn Op[self: Self]() -> Self; @@ -18,17 +18,17 @@ interface INTERFACE { package User api; -import Carbon; +import Core; class C {}; -impl C as Carbon.INTERFACE { - fn Op[self: C](other: C) -> C { +impl C as Core.INTERFACE { + fn Op[self: C]() -> C { return {}; } } -fn TestOp(a: C, b: C) -> C { +fn TestOp(a: C) -> C { return OPa; } @@ -36,7 +36,7 @@ fn TestOp(a: C, b: C) -> C { package FailNoImpl api; -import Carbon; +import Core; class D {}; diff --git a/toolchain/check/testdata/operators/overloaded/unary_stmt.carbon.in b/toolchain/check/testdata/operators/overloaded/unary_stmt.carbon.in index 5ddfea75b243d..88e95e2cf4cf9 100644 --- a/toolchain/check/testdata/operators/overloaded/unary_stmt.carbon.in +++ b/toolchain/check/testdata/operators/overloaded/unary_stmt.carbon.in @@ -8,7 +8,7 @@ HEADER // --- prelude.carbon -package Carbon api; +package Core api; interface INTERFACE { fn Op[addr self: Self*](); @@ -18,11 +18,11 @@ interface INTERFACE { package User api; -import Carbon; +import Core; class C {}; -impl C as Carbon.INTERFACE { +impl C as Core.INTERFACE { fn Op[addr self: C*](); } @@ -35,7 +35,7 @@ fn TestOp() { package FailNoImpl api; -import Carbon; +import Core; class D {}; @@ -48,11 +48,11 @@ fn TestOp() { package FailNotRef api; -import Carbon; +import Core; class C {}; -impl C as Carbon.INTERFACE { +impl C as Core.INTERFACE { fn Op[addr self: C*](); }