|
|
@@ -8,6 +8,10 @@
|
|
|
// TIP: To dump output, run:
|
|
|
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/self.carbon
|
|
|
|
|
|
+// --- self.carbon
|
|
|
+
|
|
|
+library "[[@TEST_NAME]]";
|
|
|
+
|
|
|
class Class {
|
|
|
fn F[self: Self]() -> i32;
|
|
|
fn G[addr self: Self*]() -> i32;
|
|
|
@@ -23,6 +27,27 @@ fn Class.G[addr self: Self*]() -> i32 {
|
|
|
return (*self).n;
|
|
|
}
|
|
|
|
|
|
+// --- fail_return_self_value.carbon
|
|
|
+
|
|
|
+library "[[@TEST_NAME]]";
|
|
|
+
|
|
|
+class Class {
|
|
|
+ // CHECK:STDERR: fail_return_self_value.carbon:[[@LINE+13]]:25: error: invalid use of incomplete type `Class`
|
|
|
+ // CHECK:STDERR: fn F[self: Self]() -> self;
|
|
|
+ // CHECK:STDERR: ^~~~
|
|
|
+ // CHECK:STDERR: fail_return_self_value.carbon:[[@LINE-4]]:1: note: class is incomplete within its definition
|
|
|
+ // CHECK:STDERR: class Class {
|
|
|
+ // CHECK:STDERR: ^~~~~~~~~~~~~
|
|
|
+ // CHECK:STDERR:
|
|
|
+ // CHECK:STDERR: fail_return_self_value.carbon:[[@LINE+6]]:25: error: cannot implicitly convert from `Class` to `type`
|
|
|
+ // CHECK:STDERR: fn F[self: Self]() -> self;
|
|
|
+ // CHECK:STDERR: ^~~~
|
|
|
+ // CHECK:STDERR: fail_return_self_value.carbon:[[@LINE+3]]:25: note: type `<error>` does not implement interface `ImplicitAs`
|
|
|
+ // CHECK:STDERR: fn F[self: Self]() -> self;
|
|
|
+ // CHECK:STDERR: ^~~~
|
|
|
+ fn F[self: Self]() -> self;
|
|
|
+}
|
|
|
+
|
|
|
// CHECK:STDOUT: --- self.carbon
|
|
|
// CHECK:STDOUT:
|
|
|
// CHECK:STDOUT: constants {
|
|
|
@@ -67,27 +92,27 @@ fn Class.G[addr self: Self*]() -> i32 {
|
|
|
// CHECK:STDOUT: %self.patt: %Class = binding_pattern self
|
|
|
// CHECK:STDOUT: %self.param_patt: %Class = param_pattern %self.patt, runtime_param0
|
|
|
// CHECK:STDOUT: } {
|
|
|
-// CHECK:STDOUT: %Self.ref.loc18: type = name_ref Self, constants.%Class [template = constants.%Class]
|
|
|
-// CHECK:STDOUT: %int.make_type_32.loc18: init type = call constants.%Int32() [template = i32]
|
|
|
-// CHECK:STDOUT: %.loc18_29.1: type = value_of_initializer %int.make_type_32.loc18 [template = i32]
|
|
|
-// CHECK:STDOUT: %.loc18_29.2: type = converted %int.make_type_32.loc18, %.loc18_29.1 [template = i32]
|
|
|
+// CHECK:STDOUT: %Self.ref.loc11: type = name_ref Self, constants.%Class [template = constants.%Class]
|
|
|
+// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%Int32() [template = i32]
|
|
|
+// CHECK:STDOUT: %.loc11_29.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32]
|
|
|
+// CHECK:STDOUT: %.loc11_29.2: type = converted %int.make_type_32.loc11, %.loc11_29.1 [template = i32]
|
|
|
// CHECK:STDOUT: %return: ref i32 = var <return slot>
|
|
|
-// CHECK:STDOUT: %param.loc18: %Class = param runtime_param0
|
|
|
-// CHECK:STDOUT: %self.loc18: %Class = bind_name self, %param.loc18
|
|
|
+// CHECK:STDOUT: %param.loc11: %Class = param runtime_param0
|
|
|
+// CHECK:STDOUT: %self.loc11: %Class = bind_name self, %param.loc11
|
|
|
// CHECK:STDOUT: }
|
|
|
// CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {
|
|
|
// CHECK:STDOUT: %self.patt: %.2 = binding_pattern self
|
|
|
// CHECK:STDOUT: %self.param_patt: %.2 = param_pattern %self.patt, runtime_param0
|
|
|
-// CHECK:STDOUT: %.loc22_12: auto = addr_pattern %self.param_patt
|
|
|
+// CHECK:STDOUT: %.loc15_12: auto = addr_pattern %self.param_patt
|
|
|
// CHECK:STDOUT: } {
|
|
|
-// CHECK:STDOUT: %Self.ref.loc22: type = name_ref Self, constants.%Class [template = constants.%Class]
|
|
|
-// CHECK:STDOUT: %.loc22_27: type = ptr_type %Class [template = constants.%.2]
|
|
|
-// CHECK:STDOUT: %int.make_type_32.loc22: init type = call constants.%Int32() [template = i32]
|
|
|
-// CHECK:STDOUT: %.loc22_35.1: type = value_of_initializer %int.make_type_32.loc22 [template = i32]
|
|
|
-// CHECK:STDOUT: %.loc22_35.2: type = converted %int.make_type_32.loc22, %.loc22_35.1 [template = i32]
|
|
|
+// CHECK:STDOUT: %Self.ref.loc15: type = name_ref Self, constants.%Class [template = constants.%Class]
|
|
|
+// CHECK:STDOUT: %.loc15_27: type = ptr_type %Class [template = constants.%.2]
|
|
|
+// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%Int32() [template = i32]
|
|
|
+// CHECK:STDOUT: %.loc15_35.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32]
|
|
|
+// CHECK:STDOUT: %.loc15_35.2: type = converted %int.make_type_32.loc15, %.loc15_35.1 [template = i32]
|
|
|
// CHECK:STDOUT: %return: ref i32 = var <return slot>
|
|
|
-// CHECK:STDOUT: %param.loc22: %.2 = param runtime_param0
|
|
|
-// CHECK:STDOUT: %self.loc22: %.2 = bind_name self, %param.loc22
|
|
|
+// CHECK:STDOUT: %param.loc15: %.2 = param runtime_param0
|
|
|
+// CHECK:STDOUT: %self.loc15: %.2 = bind_name self, %param.loc15
|
|
|
// CHECK:STDOUT: }
|
|
|
// CHECK:STDOUT: }
|
|
|
// CHECK:STDOUT:
|
|
|
@@ -96,59 +121,202 @@ fn Class.G[addr self: Self*]() -> i32 {
|
|
|
// CHECK:STDOUT: %self.patt: %Class = binding_pattern self
|
|
|
// CHECK:STDOUT: %self.param_patt: %Class = param_pattern %self.patt, runtime_param0
|
|
|
// CHECK:STDOUT: } {
|
|
|
-// CHECK:STDOUT: %Self.ref.loc12: type = name_ref Self, constants.%Class [template = constants.%Class]
|
|
|
-// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%Int32() [template = i32]
|
|
|
-// CHECK:STDOUT: %.loc12_25.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32]
|
|
|
-// CHECK:STDOUT: %.loc12_25.2: type = converted %int.make_type_32.loc12, %.loc12_25.1 [template = i32]
|
|
|
-// CHECK:STDOUT: %return.var.loc12: ref i32 = var <return slot>
|
|
|
-// CHECK:STDOUT: %param.loc12: %Class = param runtime_param0
|
|
|
-// CHECK:STDOUT: %self.loc12: %Class = bind_name self, %param.loc12
|
|
|
+// CHECK:STDOUT: %Self.ref.loc5: type = name_ref Self, constants.%Class [template = constants.%Class]
|
|
|
+// CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%Int32() [template = i32]
|
|
|
+// CHECK:STDOUT: %.loc5_25.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32]
|
|
|
+// CHECK:STDOUT: %.loc5_25.2: type = converted %int.make_type_32.loc5, %.loc5_25.1 [template = i32]
|
|
|
+// CHECK:STDOUT: %return.var.loc5: ref i32 = var <return slot>
|
|
|
+// CHECK:STDOUT: %param.loc5: %Class = param runtime_param0
|
|
|
+// CHECK:STDOUT: %self.loc5: %Class = bind_name self, %param.loc5
|
|
|
// CHECK:STDOUT: }
|
|
|
// CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {
|
|
|
// CHECK:STDOUT: %self.patt: %.2 = binding_pattern self
|
|
|
// CHECK:STDOUT: %self.param_patt: %.2 = param_pattern %self.patt, runtime_param0
|
|
|
-// CHECK:STDOUT: %.loc22_12: auto = addr_pattern %self.param_patt
|
|
|
+// CHECK:STDOUT: %.loc15_12: auto = addr_pattern %self.param_patt
|
|
|
// CHECK:STDOUT: } {
|
|
|
-// CHECK:STDOUT: %Self.ref.loc13: type = name_ref Self, constants.%Class [template = constants.%Class]
|
|
|
-// CHECK:STDOUT: %.loc13_23: type = ptr_type %Class [template = constants.%.2]
|
|
|
-// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%Int32() [template = i32]
|
|
|
-// CHECK:STDOUT: %.loc13_31.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32]
|
|
|
-// CHECK:STDOUT: %.loc13_31.2: type = converted %int.make_type_32.loc13, %.loc13_31.1 [template = i32]
|
|
|
-// CHECK:STDOUT: %return.var.loc13: ref i32 = var <return slot>
|
|
|
-// CHECK:STDOUT: %param.loc13: %.2 = param runtime_param0
|
|
|
-// CHECK:STDOUT: %self.loc13: %.2 = bind_name self, %param.loc13
|
|
|
+// CHECK:STDOUT: %Self.ref.loc6: type = name_ref Self, constants.%Class [template = constants.%Class]
|
|
|
+// CHECK:STDOUT: %.loc6_23: type = ptr_type %Class [template = constants.%.2]
|
|
|
+// CHECK:STDOUT: %int.make_type_32.loc6: init type = call constants.%Int32() [template = i32]
|
|
|
+// CHECK:STDOUT: %.loc6_31.1: type = value_of_initializer %int.make_type_32.loc6 [template = i32]
|
|
|
+// CHECK:STDOUT: %.loc6_31.2: type = converted %int.make_type_32.loc6, %.loc6_31.1 [template = i32]
|
|
|
+// CHECK:STDOUT: %return.var.loc6: ref i32 = var <return slot>
|
|
|
+// CHECK:STDOUT: %param.loc6: %.2 = param runtime_param0
|
|
|
+// CHECK:STDOUT: %self.loc6: %.2 = bind_name self, %param.loc6
|
|
|
// CHECK:STDOUT: }
|
|
|
// CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
|
|
|
-// CHECK:STDOUT: %.loc15_10.1: type = value_of_initializer %int.make_type_32 [template = i32]
|
|
|
-// CHECK:STDOUT: %.loc15_10.2: type = converted %int.make_type_32, %.loc15_10.1 [template = i32]
|
|
|
-// CHECK:STDOUT: %.loc15_8: %.3 = field_decl n, element0 [template]
|
|
|
-// CHECK:STDOUT: %.loc16: <witness> = complete_type_witness %.4 [template = constants.%.5]
|
|
|
+// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32 [template = i32]
|
|
|
+// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32, %.loc8_10.1 [template = i32]
|
|
|
+// CHECK:STDOUT: %.loc8_8: %.3 = field_decl n, element0 [template]
|
|
|
+// CHECK:STDOUT: %.loc9: <witness> = complete_type_witness %.4 [template = constants.%.5]
|
|
|
// CHECK:STDOUT:
|
|
|
// CHECK:STDOUT: !members:
|
|
|
// CHECK:STDOUT: .Self = constants.%Class
|
|
|
// CHECK:STDOUT: .F = %F.decl
|
|
|
// CHECK:STDOUT: .G = %G.decl
|
|
|
-// CHECK:STDOUT: .n = %.loc15_8
|
|
|
+// CHECK:STDOUT: .n = %.loc8_8
|
|
|
// CHECK:STDOUT: }
|
|
|
// CHECK:STDOUT:
|
|
|
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
|
|
|
// CHECK:STDOUT:
|
|
|
// CHECK:STDOUT: fn @F[%self.param_patt: %Class]() -> i32 {
|
|
|
// CHECK:STDOUT: !entry:
|
|
|
-// CHECK:STDOUT: %self.ref: %Class = name_ref self, %self.loc18
|
|
|
-// CHECK:STDOUT: %n.ref: %.3 = name_ref n, @Class.%.loc15_8 [template = @Class.%.loc15_8]
|
|
|
-// CHECK:STDOUT: %.loc19_14.1: ref i32 = class_element_access %self.ref, element0
|
|
|
-// CHECK:STDOUT: %.loc19_14.2: i32 = bind_value %.loc19_14.1
|
|
|
-// CHECK:STDOUT: return %.loc19_14.2
|
|
|
+// CHECK:STDOUT: %self.ref: %Class = name_ref self, %self.loc11
|
|
|
+// CHECK:STDOUT: %n.ref: %.3 = name_ref n, @Class.%.loc8_8 [template = @Class.%.loc8_8]
|
|
|
+// CHECK:STDOUT: %.loc12_14.1: ref i32 = class_element_access %self.ref, element0
|
|
|
+// CHECK:STDOUT: %.loc12_14.2: i32 = bind_value %.loc12_14.1
|
|
|
+// CHECK:STDOUT: return %.loc12_14.2
|
|
|
// CHECK:STDOUT: }
|
|
|
// CHECK:STDOUT:
|
|
|
// CHECK:STDOUT: fn @G[addr %self.param_patt: %.2]() -> i32 {
|
|
|
// CHECK:STDOUT: !entry:
|
|
|
-// CHECK:STDOUT: %self.ref: %.2 = name_ref self, %self.loc22
|
|
|
-// CHECK:STDOUT: %.loc23_11: ref %Class = deref %self.ref
|
|
|
-// CHECK:STDOUT: %n.ref: %.3 = name_ref n, @Class.%.loc15_8 [template = @Class.%.loc15_8]
|
|
|
-// CHECK:STDOUT: %.loc23_17.1: ref i32 = class_element_access %.loc23_11, element0
|
|
|
-// CHECK:STDOUT: %.loc23_17.2: i32 = bind_value %.loc23_17.1
|
|
|
-// CHECK:STDOUT: return %.loc23_17.2
|
|
|
+// CHECK:STDOUT: %self.ref: %.2 = name_ref self, %self.loc15
|
|
|
+// CHECK:STDOUT: %.loc16_11: ref %Class = deref %self.ref
|
|
|
+// CHECK:STDOUT: %n.ref: %.3 = name_ref n, @Class.%.loc8_8 [template = @Class.%.loc8_8]
|
|
|
+// CHECK:STDOUT: %.loc16_17.1: ref i32 = class_element_access %.loc16_11, element0
|
|
|
+// CHECK:STDOUT: %.loc16_17.2: i32 = bind_value %.loc16_17.1
|
|
|
+// CHECK:STDOUT: return %.loc16_17.2
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT:
|
|
|
+// CHECK:STDOUT: --- fail_return_self_value.carbon
|
|
|
+// CHECK:STDOUT:
|
|
|
+// CHECK:STDOUT: constants {
|
|
|
+// CHECK:STDOUT: %Class: type = class_type @Class [template]
|
|
|
+// CHECK:STDOUT: %ImplicitAs.type.1: type = generic_interface_type @ImplicitAs [template]
|
|
|
+// CHECK:STDOUT: %.1: type = tuple_type () [template]
|
|
|
+// CHECK:STDOUT: %ImplicitAs: %ImplicitAs.type.1 = struct_value () [template]
|
|
|
+// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic]
|
|
|
+// CHECK:STDOUT: %ImplicitAs.type.2: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic]
|
|
|
+// CHECK:STDOUT: %Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2) = bind_symbolic_name Self, 1 [symbolic]
|
|
|
+// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic]
|
|
|
+// CHECK:STDOUT: %Self.2: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic]
|
|
|
+// CHECK:STDOUT: %Convert.type.1: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic]
|
|
|
+// CHECK:STDOUT: %Convert.1: %Convert.type.1 = struct_value () [symbolic]
|
|
|
+// CHECK:STDOUT: %.2: type = assoc_entity_type %ImplicitAs.type.2, %Convert.type.1 [symbolic]
|
|
|
+// CHECK:STDOUT: %.3: %.2 = assoc_entity element0, imports.%import_ref.5 [symbolic]
|
|
|
+// CHECK:STDOUT: %ImplicitAs.type.3: type = interface_type @ImplicitAs, @ImplicitAs(type) [template]
|
|
|
+// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert, @ImplicitAs(type) [template]
|
|
|
+// CHECK:STDOUT: %Convert.2: %Convert.type.2 = struct_value () [template]
|
|
|
+// CHECK:STDOUT: %.4: type = assoc_entity_type %ImplicitAs.type.3, %Convert.type.2 [template]
|
|
|
+// CHECK:STDOUT: %.5: %.4 = assoc_entity element0, imports.%import_ref.5 [template]
|
|
|
+// CHECK:STDOUT: %.6: %.2 = assoc_entity element0, imports.%import_ref.6 [symbolic]
|
|
|
+// CHECK:STDOUT: %F.type: type = fn_type @F [template]
|
|
|
+// CHECK:STDOUT: %F: %F.type = struct_value () [template]
|
|
|
+// CHECK:STDOUT: %.7: type = struct_type {} [template]
|
|
|
+// CHECK:STDOUT: %.8: <witness> = complete_type_witness %.7 [template]
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT:
|
|
|
+// CHECK:STDOUT: imports {
|
|
|
+// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
|
|
|
+// CHECK:STDOUT: .ImplicitAs = %import_ref.1
|
|
|
+// CHECK:STDOUT: import Core//prelude
|
|
|
+// CHECK:STDOUT: import Core//prelude/operators
|
|
|
+// CHECK:STDOUT: import Core//prelude/types
|
|
|
+// CHECK:STDOUT: import Core//prelude/operators/arithmetic
|
|
|
+// CHECK:STDOUT: import Core//prelude/operators/as
|
|
|
+// CHECK:STDOUT: import Core//prelude/operators/bitwise
|
|
|
+// CHECK:STDOUT: import Core//prelude/operators/comparison
|
|
|
+// CHECK:STDOUT: import Core//prelude/types/bool
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT: %import_ref.1: %ImplicitAs.type.1 = import_ref Core//prelude/operators/as, inst+46, loaded [template = constants.%ImplicitAs]
|
|
|
+// CHECK:STDOUT: %import_ref.2 = import_ref Core//prelude/operators/as, inst+52, unloaded
|
|
|
+// CHECK:STDOUT: %import_ref.3: @ImplicitAs.%.1 (%.2) = import_ref Core//prelude/operators/as, inst+71, loaded [symbolic = @ImplicitAs.%.2 (constants.%.6)]
|
|
|
+// CHECK:STDOUT: %import_ref.4 = import_ref Core//prelude/operators/as, inst+64, unloaded
|
|
|
+// CHECK:STDOUT: %import_ref.5 = import_ref Core//prelude/operators/as, inst+64, unloaded
|
|
|
+// CHECK:STDOUT: %import_ref.6 = import_ref Core//prelude/operators/as, inst+64, unloaded
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT:
|
|
|
+// CHECK:STDOUT: file {
|
|
|
+// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
|
|
+// CHECK:STDOUT: .Core = imports.%Core
|
|
|
+// CHECK:STDOUT: .Class = %Class.decl
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT: %Core.import = import Core
|
|
|
+// CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} {}
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT:
|
|
|
+// CHECK:STDOUT: generic interface @ImplicitAs(constants.%Dest: type) {
|
|
|
+// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)]
|
|
|
+// CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt (constants.%Dest.patt)]
|
|
|
+// CHECK:STDOUT:
|
|
|
+// CHECK:STDOUT: !definition:
|
|
|
+// CHECK:STDOUT: %ImplicitAs.type: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)]
|
|
|
+// CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)]
|
|
|
+// CHECK:STDOUT: %Convert.type: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic = %Convert.type (constants.%Convert.type.1)]
|
|
|
+// CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type.1) = struct_value () [symbolic = %Convert (constants.%Convert.1)]
|
|
|
+// CHECK:STDOUT: %.1: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2), @ImplicitAs.%Convert.type (%Convert.type.1) [symbolic = %.1 (constants.%.2)]
|
|
|
+// CHECK:STDOUT: %.2: @ImplicitAs.%.1 (%.2) = assoc_entity element0, imports.%import_ref.5 [symbolic = %.2 (constants.%.3)]
|
|
|
+// CHECK:STDOUT:
|
|
|
+// CHECK:STDOUT: interface {
|
|
|
+// CHECK:STDOUT: !members:
|
|
|
+// CHECK:STDOUT: .Self = imports.%import_ref.2
|
|
|
+// CHECK:STDOUT: .Convert = imports.%import_ref.3
|
|
|
+// CHECK:STDOUT: witness = (imports.%import_ref.4)
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT:
|
|
|
+// CHECK:STDOUT: class @Class {
|
|
|
+// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
|
|
|
+// CHECK:STDOUT: %self.patt: %Class = binding_pattern self
|
|
|
+// CHECK:STDOUT: %self.param_patt: %Class = param_pattern %self.patt, runtime_param0
|
|
|
+// CHECK:STDOUT: } {
|
|
|
+// CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Class [template = constants.%Class]
|
|
|
+// CHECK:STDOUT: %self.ref: %Class = name_ref self, %self
|
|
|
+// CHECK:STDOUT: %ImplicitAs.type: type = interface_type @ImplicitAs, @ImplicitAs(type) [template = constants.%ImplicitAs.type.3]
|
|
|
+// CHECK:STDOUT: %.loc18_25.1: %.4 = specific_constant imports.%import_ref.3, @ImplicitAs(type) [template = constants.%.5]
|
|
|
+// CHECK:STDOUT: %Convert.ref: %.4 = name_ref Convert, %.loc18_25.1 [template = constants.%.5]
|
|
|
+// CHECK:STDOUT: %.loc18_25.2: type = converted %self.ref, <error> [template = <error>]
|
|
|
+// CHECK:STDOUT: %return: ref <error> = var <return slot>
|
|
|
+// CHECK:STDOUT: %param: %Class = param runtime_param0
|
|
|
+// CHECK:STDOUT: %self: %Class = bind_name self, %param
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT: %.loc19: <witness> = complete_type_witness %.7 [template = constants.%.8]
|
|
|
+// CHECK:STDOUT:
|
|
|
+// CHECK:STDOUT: !members:
|
|
|
+// CHECK:STDOUT: .Self = constants.%Class
|
|
|
+// CHECK:STDOUT: .F = %F.decl
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT:
|
|
|
+// CHECK:STDOUT: generic fn @Convert(constants.%Dest: type, constants.%Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2)) {
|
|
|
+// CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)]
|
|
|
+// CHECK:STDOUT: %ImplicitAs.type: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)]
|
|
|
+// CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)]
|
|
|
+// CHECK:STDOUT:
|
|
|
+// CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self (%Self.2)]() -> @Convert.%Dest (%Dest);
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT:
|
|
|
+// CHECK:STDOUT: fn @F[%self.param_patt: %Class]() -> <error>;
|
|
|
+// CHECK:STDOUT:
|
|
|
+// CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) {
|
|
|
+// CHECK:STDOUT: %Dest => constants.%Dest
|
|
|
+// CHECK:STDOUT: %Dest.patt => constants.%Dest
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT:
|
|
|
+// CHECK:STDOUT: specific @ImplicitAs(@ImplicitAs.%Dest) {
|
|
|
+// CHECK:STDOUT: %Dest => constants.%Dest
|
|
|
+// CHECK:STDOUT: %Dest.patt => constants.%Dest
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT:
|
|
|
+// CHECK:STDOUT: specific @ImplicitAs(@Convert.%Dest) {
|
|
|
+// CHECK:STDOUT: %Dest => constants.%Dest
|
|
|
+// CHECK:STDOUT: %Dest.patt => constants.%Dest
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT:
|
|
|
+// CHECK:STDOUT: specific @Convert(constants.%Dest, constants.%Self.1) {
|
|
|
+// CHECK:STDOUT: %Dest => constants.%Dest
|
|
|
+// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.2
|
|
|
+// CHECK:STDOUT: %Self => constants.%Self.1
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT:
|
|
|
+// CHECK:STDOUT: specific @ImplicitAs(type) {
|
|
|
+// CHECK:STDOUT: %Dest => type
|
|
|
+// CHECK:STDOUT: %Dest.patt => type
|
|
|
+// CHECK:STDOUT:
|
|
|
+// CHECK:STDOUT: !definition:
|
|
|
+// CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.3
|
|
|
+// CHECK:STDOUT: %Self => constants.%Self.2
|
|
|
+// CHECK:STDOUT: %Convert.type => constants.%Convert.type.2
|
|
|
+// CHECK:STDOUT: %Convert => constants.%Convert.2
|
|
|
+// CHECK:STDOUT: %.1 => constants.%.4
|
|
|
+// CHECK:STDOUT: %.2 => constants.%.5
|
|
|
// CHECK:STDOUT: }
|
|
|
// CHECK:STDOUT:
|