mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-17 23:10:28 +00:00
This allows us to capture the location at which a type literal was used, even in the cases where we don't otherwise need to create a new instruction to represent the type such as for `char` or `str`. The logic used to build the underlying type is now marked as desugaring. For cases such as `iN`, this causes the call to `Core.Int` to no longer be added as a dedicated IR instruction, and instead its constant value is used directly as the value of the `type_literal`. This results in this being on balance a reduction in the size of the IR. This also fixes a crash in C++ interop when using a `char` literal as a template argument. The crash was caused by the template argument not having an associated location when mapping to a C++ location. See changes to check/testdata/interop/cpp/template/type_param.carbon for an example that used to crash before this change. Update alias handling to allow an alias to point at any type literal, reinstating support for aliases for type literals such as `bool` and `i32` that had previously worked but stopped working when we transitioned those types to being defined in the prelude. See changes to toolchain/check/testdata/alias/builtins.carbon. All the test changes other than the two mentioned above are mechanical autoupdate changes switching to the new instruction.
297 lines
18 KiB
Plaintext
297 lines
18 KiB
Plaintext
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
|
// Exceptions. See /LICENSE for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/int.carbon
|
|
// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
|
|
// EXTRA-ARGS: --dump-sem-ir-ranges=if-present
|
|
//
|
|
// AUTOUPDATE
|
|
// TIP: To test this file alone, run:
|
|
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/inheritance/base_method_qualified.carbon
|
|
// TIP: To dump output, run:
|
|
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/inheritance/base_method_qualified.carbon
|
|
|
|
class Derived;
|
|
|
|
base class Base {
|
|
fn F[self: Self]() -> i32;
|
|
fn G[self: Derived]() -> i32;
|
|
}
|
|
|
|
class Derived {
|
|
extend base: Base;
|
|
|
|
fn F[self: Self]();
|
|
fn G[self: Self]();
|
|
}
|
|
|
|
fn Call(a: Derived) -> i32 {
|
|
return a.(Base.F)();
|
|
}
|
|
|
|
fn CallIndirect(p: Derived*) -> i32 {
|
|
return p->(Base.F)();
|
|
}
|
|
|
|
fn PassDerivedToBase(a: Derived) -> i32 {
|
|
return a.(Base.G)();
|
|
}
|
|
|
|
fn PassDerivedToBaseIndirect(p: Derived*) -> i32 {
|
|
return p->(Base.G)();
|
|
}
|
|
|
|
// CHECK:STDOUT: --- base_method_qualified.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: %Derived: type = class_type @Derived [concrete]
|
|
// CHECK:STDOUT: %Base: type = class_type @Base [concrete]
|
|
// CHECK:STDOUT: %pattern_type.101: type = pattern_type %Base [concrete]
|
|
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
|
|
// CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
|
|
// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
|
|
// CHECK:STDOUT: %.e54: Core.Form = init_form %i32, call_param1 [concrete]
|
|
// CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
|
|
// CHECK:STDOUT: %Base.F.type: type = fn_type @Base.F [concrete]
|
|
// CHECK:STDOUT: %Base.F: %Base.F.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: %pattern_type.9f6: type = pattern_type %Derived [concrete]
|
|
// CHECK:STDOUT: %Base.G.type: type = fn_type @Base.G [concrete]
|
|
// CHECK:STDOUT: %Base.G: %Base.G.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
|
|
// CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [concrete]
|
|
// CHECK:STDOUT: %Derived.elem: type = unbound_element_type %Derived, %Base [concrete]
|
|
// CHECK:STDOUT: %Derived.F.type: type = fn_type @Derived.F [concrete]
|
|
// CHECK:STDOUT: %Derived.F: %Derived.F.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: %Derived.G.type: type = fn_type @Derived.G [concrete]
|
|
// CHECK:STDOUT: %Derived.G: %Derived.G.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: %struct_type.base.27a: type = struct_type {.base: %Base} [concrete]
|
|
// CHECK:STDOUT: %complete_type.5a1: <witness> = complete_type_witness %struct_type.base.27a [concrete]
|
|
// CHECK:STDOUT: %Call.type: type = fn_type @Call [concrete]
|
|
// CHECK:STDOUT: %Call: %Call.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: %ptr.f74: type = ptr_type %Derived [concrete]
|
|
// CHECK:STDOUT: %pattern_type.0dd: type = pattern_type %ptr.f74 [concrete]
|
|
// CHECK:STDOUT: %CallIndirect.type: type = fn_type @CallIndirect [concrete]
|
|
// CHECK:STDOUT: %CallIndirect: %CallIndirect.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: %PassDerivedToBase.type: type = fn_type @PassDerivedToBase [concrete]
|
|
// CHECK:STDOUT: %PassDerivedToBase: %PassDerivedToBase.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: %PassDerivedToBaseIndirect.type: type = fn_type @PassDerivedToBaseIndirect [concrete]
|
|
// CHECK:STDOUT: %PassDerivedToBaseIndirect: %PassDerivedToBaseIndirect.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: imports {
|
|
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
|
|
// CHECK:STDOUT: .Int = %Core.Int
|
|
// CHECK:STDOUT: import Core//prelude
|
|
// CHECK:STDOUT: import Core//prelude/...
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .Core = imports.%Core
|
|
// CHECK:STDOUT: .Derived = %Derived.decl.loc15
|
|
// CHECK:STDOUT: .Base = %Base.decl
|
|
// CHECK:STDOUT: .Call = %Call.decl
|
|
// CHECK:STDOUT: .CallIndirect = %CallIndirect.decl
|
|
// CHECK:STDOUT: .PassDerivedToBase = %PassDerivedToBase.decl
|
|
// CHECK:STDOUT: .PassDerivedToBaseIndirect = %PassDerivedToBaseIndirect.decl
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %Core.import = import Core
|
|
// CHECK:STDOUT: %Derived.decl.loc15: type = class_decl @Derived [concrete = constants.%Derived] {} {}
|
|
// CHECK:STDOUT: %Base.decl: type = class_decl @Base [concrete = constants.%Base] {} {}
|
|
// CHECK:STDOUT: %Derived.decl.loc22: type = class_decl @Derived [concrete = constants.%Derived] {} {}
|
|
// CHECK:STDOUT: %Call.decl: %Call.type = fn_decl @Call [concrete = constants.%Call] {
|
|
// CHECK:STDOUT: %a.patt: %pattern_type.9f6 = value_binding_pattern a [concrete]
|
|
// CHECK:STDOUT: %a.param_patt: %pattern_type.9f6 = value_param_pattern %a.patt, call_param0 [concrete]
|
|
// CHECK:STDOUT: %return.patt: %pattern_type.7ce = return_slot_pattern [concrete]
|
|
// CHECK:STDOUT: %return.param_patt: %pattern_type.7ce = out_param_pattern %return.patt, call_param1 [concrete]
|
|
// CHECK:STDOUT: } {
|
|
// CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32]
|
|
// CHECK:STDOUT: %.loc29: Core.Form = init_form %i32, call_param1 [concrete = constants.%.e54]
|
|
// CHECK:STDOUT: %a.param: %Derived = value_param call_param0
|
|
// CHECK:STDOUT: %Derived.ref: type = name_ref Derived, file.%Derived.decl.loc15 [concrete = constants.%Derived]
|
|
// CHECK:STDOUT: %a: %Derived = value_binding a, %a.param
|
|
// CHECK:STDOUT: %return.param: ref %i32 = out_param call_param1
|
|
// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %CallIndirect.decl: %CallIndirect.type = fn_decl @CallIndirect [concrete = constants.%CallIndirect] {
|
|
// CHECK:STDOUT: %p.patt: %pattern_type.0dd = value_binding_pattern p [concrete]
|
|
// CHECK:STDOUT: %p.param_patt: %pattern_type.0dd = value_param_pattern %p.patt, call_param0 [concrete]
|
|
// CHECK:STDOUT: %return.patt: %pattern_type.7ce = return_slot_pattern [concrete]
|
|
// CHECK:STDOUT: %return.param_patt: %pattern_type.7ce = out_param_pattern %return.patt, call_param1 [concrete]
|
|
// CHECK:STDOUT: } {
|
|
// CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32]
|
|
// CHECK:STDOUT: %.loc33_33: Core.Form = init_form %i32, call_param1 [concrete = constants.%.e54]
|
|
// CHECK:STDOUT: %p.param: %ptr.f74 = value_param call_param0
|
|
// CHECK:STDOUT: %.loc33_27: type = splice_block %ptr [concrete = constants.%ptr.f74] {
|
|
// CHECK:STDOUT: %Derived.ref: type = name_ref Derived, file.%Derived.decl.loc15 [concrete = constants.%Derived]
|
|
// CHECK:STDOUT: %ptr: type = ptr_type %Derived.ref [concrete = constants.%ptr.f74]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %p: %ptr.f74 = value_binding p, %p.param
|
|
// CHECK:STDOUT: %return.param: ref %i32 = out_param call_param1
|
|
// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %PassDerivedToBase.decl: %PassDerivedToBase.type = fn_decl @PassDerivedToBase [concrete = constants.%PassDerivedToBase] {
|
|
// CHECK:STDOUT: %a.patt: %pattern_type.9f6 = value_binding_pattern a [concrete]
|
|
// CHECK:STDOUT: %a.param_patt: %pattern_type.9f6 = value_param_pattern %a.patt, call_param0 [concrete]
|
|
// CHECK:STDOUT: %return.patt: %pattern_type.7ce = return_slot_pattern [concrete]
|
|
// CHECK:STDOUT: %return.param_patt: %pattern_type.7ce = out_param_pattern %return.patt, call_param1 [concrete]
|
|
// CHECK:STDOUT: } {
|
|
// CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32]
|
|
// CHECK:STDOUT: %.loc37: Core.Form = init_form %i32, call_param1 [concrete = constants.%.e54]
|
|
// CHECK:STDOUT: %a.param: %Derived = value_param call_param0
|
|
// CHECK:STDOUT: %Derived.ref: type = name_ref Derived, file.%Derived.decl.loc15 [concrete = constants.%Derived]
|
|
// CHECK:STDOUT: %a: %Derived = value_binding a, %a.param
|
|
// CHECK:STDOUT: %return.param: ref %i32 = out_param call_param1
|
|
// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %PassDerivedToBaseIndirect.decl: %PassDerivedToBaseIndirect.type = fn_decl @PassDerivedToBaseIndirect [concrete = constants.%PassDerivedToBaseIndirect] {
|
|
// CHECK:STDOUT: %p.patt: %pattern_type.0dd = value_binding_pattern p [concrete]
|
|
// CHECK:STDOUT: %p.param_patt: %pattern_type.0dd = value_param_pattern %p.patt, call_param0 [concrete]
|
|
// CHECK:STDOUT: %return.patt: %pattern_type.7ce = return_slot_pattern [concrete]
|
|
// CHECK:STDOUT: %return.param_patt: %pattern_type.7ce = out_param_pattern %return.patt, call_param1 [concrete]
|
|
// CHECK:STDOUT: } {
|
|
// CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32]
|
|
// CHECK:STDOUT: %.loc41_46: Core.Form = init_form %i32, call_param1 [concrete = constants.%.e54]
|
|
// CHECK:STDOUT: %p.param: %ptr.f74 = value_param call_param0
|
|
// CHECK:STDOUT: %.loc41_40: type = splice_block %ptr [concrete = constants.%ptr.f74] {
|
|
// CHECK:STDOUT: %Derived.ref: type = name_ref Derived, file.%Derived.decl.loc15 [concrete = constants.%Derived]
|
|
// CHECK:STDOUT: %ptr: type = ptr_type %Derived.ref [concrete = constants.%ptr.f74]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %p: %ptr.f74 = value_binding p, %p.param
|
|
// CHECK:STDOUT: %return.param: ref %i32 = out_param call_param1
|
|
// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @Derived {
|
|
// CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [concrete = constants.%Base]
|
|
// CHECK:STDOUT: %.loc23: %Derived.elem = base_decl %Base.ref, element0 [concrete]
|
|
// CHECK:STDOUT: %Derived.F.decl: %Derived.F.type = fn_decl @Derived.F [concrete = constants.%Derived.F] {
|
|
// CHECK:STDOUT: %self.patt: %pattern_type.9f6 = value_binding_pattern self [concrete]
|
|
// CHECK:STDOUT: %self.param_patt: %pattern_type.9f6 = value_param_pattern %self.patt, call_param0 [concrete]
|
|
// CHECK:STDOUT: } {
|
|
// CHECK:STDOUT: %self.param: %Derived = value_param call_param0
|
|
// CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Derived [concrete = constants.%Derived]
|
|
// CHECK:STDOUT: %self: %Derived = value_binding self, %self.param
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %Derived.G.decl: %Derived.G.type = fn_decl @Derived.G [concrete = constants.%Derived.G] {
|
|
// CHECK:STDOUT: %self.patt: %pattern_type.9f6 = value_binding_pattern self [concrete]
|
|
// CHECK:STDOUT: %self.param_patt: %pattern_type.9f6 = value_param_pattern %self.patt, call_param0 [concrete]
|
|
// CHECK:STDOUT: } {
|
|
// CHECK:STDOUT: %self.param: %Derived = value_param call_param0
|
|
// CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Derived [concrete = constants.%Derived]
|
|
// CHECK:STDOUT: %self: %Derived = value_binding self, %self.param
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%struct_type.base.27a [concrete = constants.%complete_type.5a1]
|
|
// CHECK:STDOUT: complete_type_witness = %complete_type
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = constants.%Derived
|
|
// CHECK:STDOUT: .Base = <poisoned>
|
|
// CHECK:STDOUT: .base = %.loc23
|
|
// CHECK:STDOUT: .F = %Derived.F.decl
|
|
// CHECK:STDOUT: .G = %Derived.G.decl
|
|
// CHECK:STDOUT: extend %Base.ref
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @Base {
|
|
// CHECK:STDOUT: %Base.F.decl: %Base.F.type = fn_decl @Base.F [concrete = constants.%Base.F] {
|
|
// CHECK:STDOUT: %self.patt: %pattern_type.101 = value_binding_pattern self [concrete]
|
|
// CHECK:STDOUT: %self.param_patt: %pattern_type.101 = value_param_pattern %self.patt, call_param0 [concrete]
|
|
// CHECK:STDOUT: %return.patt: %pattern_type.7ce = return_slot_pattern [concrete]
|
|
// CHECK:STDOUT: %return.param_patt: %pattern_type.7ce = out_param_pattern %return.patt, call_param1 [concrete]
|
|
// CHECK:STDOUT: } {
|
|
// CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32]
|
|
// CHECK:STDOUT: %.loc18: Core.Form = init_form %i32, call_param1 [concrete = constants.%.e54]
|
|
// CHECK:STDOUT: %self.param: %Base = value_param call_param0
|
|
// CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Base [concrete = constants.%Base]
|
|
// CHECK:STDOUT: %self: %Base = value_binding self, %self.param
|
|
// CHECK:STDOUT: %return.param: ref %i32 = out_param call_param1
|
|
// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %Base.G.decl: %Base.G.type = fn_decl @Base.G [concrete = constants.%Base.G] {
|
|
// CHECK:STDOUT: %self.patt: %pattern_type.9f6 = value_binding_pattern self [concrete]
|
|
// CHECK:STDOUT: %self.param_patt: %pattern_type.9f6 = value_param_pattern %self.patt, call_param0 [concrete]
|
|
// CHECK:STDOUT: %return.patt: %pattern_type.7ce = return_slot_pattern [concrete]
|
|
// CHECK:STDOUT: %return.param_patt: %pattern_type.7ce = out_param_pattern %return.patt, call_param1 [concrete]
|
|
// CHECK:STDOUT: } {
|
|
// CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32]
|
|
// CHECK:STDOUT: %.loc19: Core.Form = init_form %i32, call_param1 [concrete = constants.%.e54]
|
|
// CHECK:STDOUT: %self.param: %Derived = value_param call_param0
|
|
// CHECK:STDOUT: %Derived.ref: type = name_ref Derived, file.%Derived.decl.loc15 [concrete = constants.%Derived]
|
|
// CHECK:STDOUT: %self: %Derived = value_binding self, %self.param
|
|
// CHECK:STDOUT: %return.param: ref %i32 = out_param call_param1
|
|
// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type.357]
|
|
// CHECK:STDOUT: complete_type_witness = %complete_type
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = constants.%Base
|
|
// CHECK:STDOUT: .F = %Base.F.decl
|
|
// CHECK:STDOUT: .Derived = <poisoned>
|
|
// CHECK:STDOUT: .G = %Base.G.decl
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @Base.F(%self.param: %Base) -> out %return.param: %i32;
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @Base.G(%self.param: %Derived) -> out %return.param: %i32;
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @Derived.F(%self.param: %Derived);
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @Derived.G(%self.param: %Derived);
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @Call(%a.param: %Derived) -> out %return.param: %i32 {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %a.ref: %Derived = name_ref a, %a
|
|
// CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [concrete = constants.%Base]
|
|
// CHECK:STDOUT: %F.ref: %Base.F.type = name_ref F, @Base.%Base.F.decl [concrete = constants.%Base.F]
|
|
// CHECK:STDOUT: %Base.F.bound: <bound method> = bound_method %a.ref, %F.ref
|
|
// CHECK:STDOUT: %.loc30_10.1: ref %Base = class_element_access %a.ref, element0
|
|
// CHECK:STDOUT: %.loc30_10.2: ref %Base = converted %a.ref, %.loc30_10.1
|
|
// CHECK:STDOUT: %.loc30_10.3: %Base = acquire_value %.loc30_10.2
|
|
// CHECK:STDOUT: %Base.F.call: init %i32 = call %Base.F.bound(%.loc30_10.3)
|
|
// CHECK:STDOUT: return %Base.F.call
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @CallIndirect(%p.param: %ptr.f74) -> out %return.param: %i32 {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %p.ref: %ptr.f74 = name_ref p, %p
|
|
// CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [concrete = constants.%Base]
|
|
// CHECK:STDOUT: %F.ref: %Base.F.type = name_ref F, @Base.%Base.F.decl [concrete = constants.%Base.F]
|
|
// CHECK:STDOUT: %.loc34_11.1: ref %Derived = deref %p.ref
|
|
// CHECK:STDOUT: %Base.F.bound: <bound method> = bound_method %.loc34_11.1, %F.ref
|
|
// CHECK:STDOUT: %.loc34_11.2: ref %Base = class_element_access %.loc34_11.1, element0
|
|
// CHECK:STDOUT: %.loc34_11.3: ref %Base = converted %.loc34_11.1, %.loc34_11.2
|
|
// CHECK:STDOUT: %.loc34_11.4: %Base = acquire_value %.loc34_11.3
|
|
// CHECK:STDOUT: %Base.F.call: init %i32 = call %Base.F.bound(%.loc34_11.4)
|
|
// CHECK:STDOUT: return %Base.F.call
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @PassDerivedToBase(%a.param: %Derived) -> out %return.param: %i32 {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %a.ref: %Derived = name_ref a, %a
|
|
// CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [concrete = constants.%Base]
|
|
// CHECK:STDOUT: %G.ref: %Base.G.type = name_ref G, @Base.%Base.G.decl [concrete = constants.%Base.G]
|
|
// CHECK:STDOUT: %Base.G.bound: <bound method> = bound_method %a.ref, %G.ref
|
|
// CHECK:STDOUT: %Base.G.call: init %i32 = call %Base.G.bound(%a.ref)
|
|
// CHECK:STDOUT: return %Base.G.call
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @PassDerivedToBaseIndirect(%p.param: %ptr.f74) -> out %return.param: %i32 {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %p.ref: %ptr.f74 = name_ref p, %p
|
|
// CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [concrete = constants.%Base]
|
|
// CHECK:STDOUT: %G.ref: %Base.G.type = name_ref G, @Base.%Base.G.decl [concrete = constants.%Base.G]
|
|
// CHECK:STDOUT: %.loc42_11.1: ref %Derived = deref %p.ref
|
|
// CHECK:STDOUT: %Base.G.bound: <bound method> = bound_method %.loc42_11.1, %G.ref
|
|
// CHECK:STDOUT: %.loc42_11.2: %Derived = acquire_value %.loc42_11.1
|
|
// CHECK:STDOUT: %Base.G.call: init %i32 = call %Base.G.bound(%.loc42_11.2)
|
|
// CHECK:STDOUT: return %Base.G.call
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|