mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Implements proposal #7016: `self` moves from the deduced implicit list (`fn F[self: Self]()`) to the front of the explicit list. Its type may be written explicitly (`fn F(self: Self)`) or omitted, in which case it defaults to `Self` (`fn F(self)`, `fn F(ref self)`); `self` in the implicit list is rejected. Throughout checking, `self` is modeled as the first explicit parameter. Because a method is just a function whose first parameter is `self`, it can also be called as an ordinary function with the receiver passed explicitly (`Type.M(obj, ...)`), not only as `obj.M(...)`. A new `SemIR::CallArgParamPatterns` helper chooses the parameters matched against the explicit arguments, excluding a leading `self` only when it is supplied as a method-call receiver; arity checking, conversion, and generic deduction use it. The resulting SemIR and lowering are unchanged: `self` is still `call_param0`, and witnesses, thunks, and vtables are unaffected. An omitted `self` type is parsed as a `SelfBindingPattern` node with no type expression; checking synthesizes the `Self` type so it behaves exactly like `self: Self`. However, the exact spelling used must match between a forward declaration and a definition, following #3763's rules around declaration matching. Generated functions, thunks, and C++ interop import/export build `self` as the first explicit parameter, and the `self`-type override (e.g. Derived->Base for a virtual override) applies to the explicit `self`. Placement is validated by new diagnostics: `SelfInImplicitParamList`, `SelfNotFirstParam`, and `SelfOutsideParamList`. The benchmark source generator and the documentation adopt the `(self)` shorthand; the prelude, the examples, and the test data are migrated in the following commits. Assisted-by: Claude Code with Claude Opus 4.7 --------- Co-authored-by: josh11b <15258583+josh11b@users.noreply.github.com>
This commit is contained in:
co-authored by
josh11b
parent
fb05da761f
commit
7871237c15
+15
-12
@@ -70,6 +70,7 @@ fn CallSpecific(x: C*) -> C* {
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
|
||||
|
||||
// CHECK:STDOUT: --- explicit.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
@@ -170,16 +171,17 @@ fn CallSpecific(x: C*) -> C* {
|
||||
// CHECK:STDOUT: !definition:
|
||||
// CHECK:STDOUT: %require_complete: <witness> = require_complete_type %T.as_type.loc5_31.1 [symbolic = %require_complete (constants.%require_complete.d83)]
|
||||
// CHECK:STDOUT: %Copy.WithSelf.Op.type: type = fn_type @Copy.WithSelf.Op, @Copy.WithSelf(%T.loc5_14.1) [symbolic = %Copy.WithSelf.Op.type (constants.%Copy.WithSelf.Op.type.c85f21.2)]
|
||||
// CHECK:STDOUT: %.loc6: type = fn_type_with_self_type %Copy.WithSelf.Op.type, %T.loc5_14.1 [symbolic = %.loc6 (constants.%.c29)]
|
||||
// CHECK:STDOUT: %.loc6_10.2: type = fn_type_with_self_type %Copy.WithSelf.Op.type, %T.loc5_14.1 [symbolic = %.loc6_10.2 (constants.%.c29)]
|
||||
// CHECK:STDOUT: %Copy.lookup_impl_witness: <witness> = lookup_impl_witness %T.loc5_14.1, @Copy [symbolic = %Copy.lookup_impl_witness (constants.%Copy.lookup_impl_witness.d9c)]
|
||||
// CHECK:STDOUT: %impl.elem0.loc6_10.2: @Function.%.loc6 (%.c29) = impl_witness_access %Copy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc6_10.2 (constants.%impl.elem0.bd2)]
|
||||
// CHECK:STDOUT: %impl.elem0.loc6_10.2: @Function.%.loc6_10.2 (%.c29) = impl_witness_access %Copy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc6_10.2 (constants.%impl.elem0.bd2)]
|
||||
// CHECK:STDOUT: %specific_impl_fn.loc6_10.2: <specific function> = specific_impl_function %impl.elem0.loc6_10.2, @Copy.WithSelf.Op(%T.loc5_14.1) [symbolic = %specific_impl_fn.loc6_10.2 (constants.%specific_impl_fn.e2a)]
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn(%x.param: @Function.%T.as_type.loc5_31.1 (%T.as_type)) -> out %return.param: @Function.%T.as_type.loc5_31.1 (%T.as_type) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %x.ref: @Function.%T.as_type.loc5_31.1 (%T.as_type) = name_ref x, %x
|
||||
// CHECK:STDOUT: %impl.elem0.loc6_10.1: @Function.%.loc6 (%.c29) = impl_witness_access constants.%Copy.lookup_impl_witness.d9c, element0 [symbolic = %impl.elem0.loc6_10.2 (constants.%impl.elem0.bd2)]
|
||||
// CHECK:STDOUT: %impl.elem0.loc6_10.1: @Function.%.loc6_10.2 (%.c29) = impl_witness_access constants.%Copy.lookup_impl_witness.d9c, element0 [symbolic = %impl.elem0.loc6_10.2 (constants.%impl.elem0.bd2)]
|
||||
// CHECK:STDOUT: %bound_method.loc6_10.1: <bound method> = bound_method %x.ref, %impl.elem0.loc6_10.1
|
||||
// CHECK:STDOUT: %.loc6_10.1: %Copy.type = converted constants.%T.as_type, constants.%T.f84 [symbolic = %T.loc5_14.1 (constants.%T.f84)]
|
||||
// CHECK:STDOUT: %specific_impl_fn.loc6_10.1: <specific function> = specific_impl_function %impl.elem0.loc6_10.1, @Copy.WithSelf.Op(constants.%T.f84) [symbolic = %specific_impl_fn.loc6_10.2 (constants.%specific_impl_fn.e2a)]
|
||||
// CHECK:STDOUT: %bound_method.loc6_10.2: <bound method> = bound_method %x.ref, %specific_impl_fn.loc6_10.1
|
||||
// CHECK:STDOUT: %.loc5_37.1: ref @Function.%T.as_type.loc5_31.1 (%T.as_type) = splice_block %return.param {}
|
||||
@@ -258,7 +260,7 @@ fn CallSpecific(x: C*) -> C* {
|
||||
// CHECK:STDOUT: !definition:
|
||||
// CHECK:STDOUT: %require_complete => constants.%require_complete.d83
|
||||
// CHECK:STDOUT: %Copy.WithSelf.Op.type => constants.%Copy.WithSelf.Op.type.c85f21.2
|
||||
// CHECK:STDOUT: %.loc6 => constants.%.c29
|
||||
// CHECK:STDOUT: %.loc6_10.2 => constants.%.c29
|
||||
// CHECK:STDOUT: %Copy.lookup_impl_witness => constants.%Copy.lookup_impl_witness.d9c
|
||||
// CHECK:STDOUT: %impl.elem0.loc6_10.2 => constants.%impl.elem0.bd2
|
||||
// CHECK:STDOUT: %specific_impl_fn.loc6_10.2 => constants.%specific_impl_fn.e2a
|
||||
@@ -287,7 +289,7 @@ fn CallSpecific(x: C*) -> C* {
|
||||
// CHECK:STDOUT: !definition:
|
||||
// CHECK:STDOUT: %require_complete => constants.%require_complete.ef1
|
||||
// CHECK:STDOUT: %Copy.WithSelf.Op.type => constants.%Copy.WithSelf.Op.type.884
|
||||
// CHECK:STDOUT: %.loc6 => constants.%.be5
|
||||
// CHECK:STDOUT: %.loc6_10.2 => constants.%.be5
|
||||
// CHECK:STDOUT: %Copy.lookup_impl_witness => constants.%Copy.lookup_impl_witness.1da
|
||||
// CHECK:STDOUT: %impl.elem0.loc6_10.2 => constants.%impl.elem0.484
|
||||
// CHECK:STDOUT: %specific_impl_fn.loc6_10.2 => constants.%specific_impl_fn.a76
|
||||
@@ -302,7 +304,7 @@ fn CallSpecific(x: C*) -> C* {
|
||||
// CHECK:STDOUT: !definition:
|
||||
// CHECK:STDOUT: %require_complete => constants.%complete_type.bf9
|
||||
// CHECK:STDOUT: %Copy.WithSelf.Op.type => constants.%Copy.WithSelf.Op.type.c6a
|
||||
// CHECK:STDOUT: %.loc6 => constants.%.a68
|
||||
// CHECK:STDOUT: %.loc6_10.2 => constants.%.a68
|
||||
// CHECK:STDOUT: %Copy.lookup_impl_witness => constants.%Copy.impl_witness.65f
|
||||
// CHECK:STDOUT: %impl.elem0.loc6_10.2 => constants.%ptr.as.Copy.impl.Op.c19
|
||||
// CHECK:STDOUT: %specific_impl_fn.loc6_10.2 => constants.%ptr.as.Copy.impl.Op.specific_fn
|
||||
@@ -408,16 +410,17 @@ fn CallSpecific(x: C*) -> C* {
|
||||
// CHECK:STDOUT: !definition:
|
||||
// CHECK:STDOUT: %require_complete: <witness> = require_complete_type %T.as_type.loc5_31.1 [symbolic = %require_complete (constants.%require_complete.d83)]
|
||||
// CHECK:STDOUT: %Copy.WithSelf.Op.type: type = fn_type @Copy.WithSelf.Op, @Copy.WithSelf(%T.loc5_14.1) [symbolic = %Copy.WithSelf.Op.type (constants.%Copy.WithSelf.Op.type.c85f21.2)]
|
||||
// CHECK:STDOUT: %.loc6: type = fn_type_with_self_type %Copy.WithSelf.Op.type, %T.loc5_14.1 [symbolic = %.loc6 (constants.%.c29)]
|
||||
// CHECK:STDOUT: %.loc6_10.2: type = fn_type_with_self_type %Copy.WithSelf.Op.type, %T.loc5_14.1 [symbolic = %.loc6_10.2 (constants.%.c29)]
|
||||
// CHECK:STDOUT: %Copy.lookup_impl_witness: <witness> = lookup_impl_witness %T.loc5_14.1, @Copy [symbolic = %Copy.lookup_impl_witness (constants.%Copy.lookup_impl_witness.d9c)]
|
||||
// CHECK:STDOUT: %impl.elem0.loc6_10.2: @Function.%.loc6 (%.c29) = impl_witness_access %Copy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc6_10.2 (constants.%impl.elem0.bd2)]
|
||||
// CHECK:STDOUT: %impl.elem0.loc6_10.2: @Function.%.loc6_10.2 (%.c29) = impl_witness_access %Copy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc6_10.2 (constants.%impl.elem0.bd2)]
|
||||
// CHECK:STDOUT: %specific_impl_fn.loc6_10.2: <specific function> = specific_impl_function %impl.elem0.loc6_10.2, @Copy.WithSelf.Op(%T.loc5_14.1) [symbolic = %specific_impl_fn.loc6_10.2 (constants.%specific_impl_fn.e2a)]
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn(%x.param: @Function.%T.as_type.loc5_31.1 (%T.as_type)) -> out %return.param: @Function.%T.as_type.loc5_31.1 (%T.as_type) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %x.ref: @Function.%T.as_type.loc5_31.1 (%T.as_type) = name_ref x, %x
|
||||
// CHECK:STDOUT: %impl.elem0.loc6_10.1: @Function.%.loc6 (%.c29) = impl_witness_access constants.%Copy.lookup_impl_witness.d9c, element0 [symbolic = %impl.elem0.loc6_10.2 (constants.%impl.elem0.bd2)]
|
||||
// CHECK:STDOUT: %impl.elem0.loc6_10.1: @Function.%.loc6_10.2 (%.c29) = impl_witness_access constants.%Copy.lookup_impl_witness.d9c, element0 [symbolic = %impl.elem0.loc6_10.2 (constants.%impl.elem0.bd2)]
|
||||
// CHECK:STDOUT: %bound_method.loc6_10.1: <bound method> = bound_method %x.ref, %impl.elem0.loc6_10.1
|
||||
// CHECK:STDOUT: %.loc6_10.1: %Copy.type = converted constants.%T.as_type, constants.%T.f84 [symbolic = %T.loc5_14.1 (constants.%T.f84)]
|
||||
// CHECK:STDOUT: %specific_impl_fn.loc6_10.1: <specific function> = specific_impl_function %impl.elem0.loc6_10.1, @Copy.WithSelf.Op(constants.%T.f84) [symbolic = %specific_impl_fn.loc6_10.2 (constants.%specific_impl_fn.e2a)]
|
||||
// CHECK:STDOUT: %bound_method.loc6_10.2: <bound method> = bound_method %x.ref, %specific_impl_fn.loc6_10.1
|
||||
// CHECK:STDOUT: %.loc5_37.1: ref @Function.%T.as_type.loc5_31.1 (%T.as_type) = splice_block %return.param {}
|
||||
@@ -487,7 +490,7 @@ fn CallSpecific(x: C*) -> C* {
|
||||
// CHECK:STDOUT: !definition:
|
||||
// CHECK:STDOUT: %require_complete => constants.%require_complete.d83
|
||||
// CHECK:STDOUT: %Copy.WithSelf.Op.type => constants.%Copy.WithSelf.Op.type.c85f21.2
|
||||
// CHECK:STDOUT: %.loc6 => constants.%.c29
|
||||
// CHECK:STDOUT: %.loc6_10.2 => constants.%.c29
|
||||
// CHECK:STDOUT: %Copy.lookup_impl_witness => constants.%Copy.lookup_impl_witness.d9c
|
||||
// CHECK:STDOUT: %impl.elem0.loc6_10.2 => constants.%impl.elem0.bd2
|
||||
// CHECK:STDOUT: %specific_impl_fn.loc6_10.2 => constants.%specific_impl_fn.e2a
|
||||
@@ -516,7 +519,7 @@ fn CallSpecific(x: C*) -> C* {
|
||||
// CHECK:STDOUT: !definition:
|
||||
// CHECK:STDOUT: %require_complete => constants.%require_complete.ef1
|
||||
// CHECK:STDOUT: %Copy.WithSelf.Op.type => constants.%Copy.WithSelf.Op.type.884
|
||||
// CHECK:STDOUT: %.loc6 => constants.%.be5
|
||||
// CHECK:STDOUT: %.loc6_10.2 => constants.%.be5
|
||||
// CHECK:STDOUT: %Copy.lookup_impl_witness => constants.%Copy.lookup_impl_witness.1da
|
||||
// CHECK:STDOUT: %impl.elem0.loc6_10.2 => constants.%impl.elem0.484
|
||||
// CHECK:STDOUT: %specific_impl_fn.loc6_10.2 => constants.%specific_impl_fn.a76
|
||||
@@ -531,7 +534,7 @@ fn CallSpecific(x: C*) -> C* {
|
||||
// CHECK:STDOUT: !definition:
|
||||
// CHECK:STDOUT: %require_complete => constants.%complete_type.bf9
|
||||
// CHECK:STDOUT: %Copy.WithSelf.Op.type => constants.%Copy.WithSelf.Op.type.c6a
|
||||
// CHECK:STDOUT: %.loc6 => constants.%.a68
|
||||
// CHECK:STDOUT: %.loc6_10.2 => constants.%.a68
|
||||
// CHECK:STDOUT: %Copy.lookup_impl_witness => constants.%Copy.impl_witness.65f
|
||||
// CHECK:STDOUT: %impl.elem0.loc6_10.2 => constants.%ptr.as.Copy.impl.Op.c19
|
||||
// CHECK:STDOUT: %specific_impl_fn.loc6_10.2 => constants.%ptr.as.Copy.impl.Op.specific_fn
|
||||
|
||||
@@ -20,6 +20,7 @@ fn F(T:! type, p: T**) -> T* {
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
|
||||
|
||||
// CHECK:STDOUT: --- pointer_to_pointer.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
@@ -44,21 +45,23 @@ fn F(T:! type, p: T**) -> T* {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !definition:
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: %.loc6_10.3: require_specific_def_type = require_specific_def @ptr.as.Copy.impl(%T.loc4_7.1) [symbolic = %.loc6_10.3 (constants.%.0e9)]
|
||||
// CHECK:STDOUT: %.loc6_10.4: require_specific_def_type = require_specific_def @ptr.as.Copy.impl(%T.loc4_7.1) [symbolic = %.loc6_10.4 (constants.%.0e9)]
|
||||
// CHECK:STDOUT: %Copy.lookup_impl_witness: <witness> = lookup_impl_witness %ptr.loc4_20.1, @Copy [symbolic = %Copy.lookup_impl_witness (constants.%Copy.lookup_impl_witness.1da)]
|
||||
// CHECK:STDOUT: %Copy.facet: %Copy.type = facet_value %ptr.loc4_20.1, (%Copy.lookup_impl_witness) [symbolic = %Copy.facet (constants.%Copy.facet)]
|
||||
// CHECK:STDOUT: %Copy.WithSelf.Op.type: type = fn_type @Copy.WithSelf.Op, @Copy.WithSelf(%Copy.facet) [symbolic = %Copy.WithSelf.Op.type (constants.%Copy.WithSelf.Op.type.884)]
|
||||
// CHECK:STDOUT: %.loc6_10.4: type = fn_type_with_self_type %Copy.WithSelf.Op.type, %Copy.facet [symbolic = %.loc6_10.4 (constants.%.be5)]
|
||||
// CHECK:STDOUT: %impl.elem0.loc6_10.2: @F.%.loc6_10.4 (%.be5) = impl_witness_access %Copy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc6_10.2 (constants.%impl.elem0.484)]
|
||||
// CHECK:STDOUT: %specific_impl_fn.loc6_10.2: <specific function> = specific_impl_function %impl.elem0.loc6_10.2, @Copy.WithSelf.Op(%Copy.facet) [symbolic = %specific_impl_fn.loc6_10.2 (constants.%specific_impl_fn.a76)]
|
||||
// CHECK:STDOUT: %Copy.facet.loc6_10.2: %Copy.type = facet_value %ptr.loc4_20.1, (%Copy.lookup_impl_witness) [symbolic = %Copy.facet.loc6_10.2 (constants.%Copy.facet)]
|
||||
// CHECK:STDOUT: %Copy.WithSelf.Op.type: type = fn_type @Copy.WithSelf.Op, @Copy.WithSelf(%Copy.facet.loc6_10.2) [symbolic = %Copy.WithSelf.Op.type (constants.%Copy.WithSelf.Op.type.884)]
|
||||
// CHECK:STDOUT: %.loc6_10.5: type = fn_type_with_self_type %Copy.WithSelf.Op.type, %Copy.facet.loc6_10.2 [symbolic = %.loc6_10.5 (constants.%.be5)]
|
||||
// CHECK:STDOUT: %impl.elem0.loc6_10.2: @F.%.loc6_10.5 (%.be5) = impl_witness_access %Copy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc6_10.2 (constants.%impl.elem0.484)]
|
||||
// CHECK:STDOUT: %specific_impl_fn.loc6_10.2: <specific function> = specific_impl_function %impl.elem0.loc6_10.2, @Copy.WithSelf.Op(%Copy.facet.loc6_10.2) [symbolic = %specific_impl_fn.loc6_10.2 (constants.%specific_impl_fn.a76)]
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn(%p.param: @F.%ptr.loc4_21.1 (%ptr.125)) -> out %return.param: @F.%ptr.loc4_20.1 (%ptr.e8f) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %p.ref: @F.%ptr.loc4_21.1 (%ptr.125) = name_ref p, %p
|
||||
// CHECK:STDOUT: %.loc6_10.1: ref @F.%ptr.loc4_20.1 (%ptr.e8f) = deref %p.ref
|
||||
// CHECK:STDOUT: %.loc6_10.2: @F.%ptr.loc4_20.1 (%ptr.e8f) = acquire_value %.loc6_10.1
|
||||
// CHECK:STDOUT: %impl.elem0.loc6_10.1: @F.%.loc6_10.4 (%.be5) = impl_witness_access constants.%Copy.lookup_impl_witness.1da, element0 [symbolic = %impl.elem0.loc6_10.2 (constants.%impl.elem0.484)]
|
||||
// CHECK:STDOUT: %impl.elem0.loc6_10.1: @F.%.loc6_10.5 (%.be5) = impl_witness_access constants.%Copy.lookup_impl_witness.1da, element0 [symbolic = %impl.elem0.loc6_10.2 (constants.%impl.elem0.484)]
|
||||
// CHECK:STDOUT: %bound_method.loc6_10.1: <bound method> = bound_method %.loc6_10.2, %impl.elem0.loc6_10.1
|
||||
// CHECK:STDOUT: %Copy.facet.loc6_10.1: %Copy.type = facet_value constants.%ptr.e8f, (constants.%Copy.lookup_impl_witness.1da) [symbolic = %Copy.facet.loc6_10.2 (constants.%Copy.facet)]
|
||||
// CHECK:STDOUT: %.loc6_10.3: %Copy.type = converted constants.%ptr.e8f, %Copy.facet.loc6_10.1 [symbolic = %Copy.facet.loc6_10.2 (constants.%Copy.facet)]
|
||||
// CHECK:STDOUT: %specific_impl_fn.loc6_10.1: <specific function> = specific_impl_function %impl.elem0.loc6_10.1, @Copy.WithSelf.Op(constants.%Copy.facet) [symbolic = %specific_impl_fn.loc6_10.2 (constants.%specific_impl_fn.a76)]
|
||||
// CHECK:STDOUT: %bound_method.loc6_10.2: <bound method> = bound_method %.loc6_10.2, %specific_impl_fn.loc6_10.1
|
||||
// CHECK:STDOUT: %Copy.WithSelf.Op.call: init @F.%ptr.loc4_20.1 (%ptr.e8f) = call %bound_method.loc6_10.2(%.loc6_10.2)
|
||||
|
||||
@@ -38,6 +38,7 @@ fn CallNegative() {
|
||||
ErrorIfNIsZero(0);
|
||||
}
|
||||
|
||||
|
||||
// CHECK:STDOUT: --- fail_todo_call_monomorphization_error.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
@@ -145,11 +146,11 @@ fn CallNegative() {
|
||||
// CHECK:STDOUT: %impl.elem0.loc9_28.2: @ErrorIfNIsZero.%.loc9_28.4 (%.b74) = impl_witness_access %DefaultOrUnformed.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc9_28.2 (constants.%impl.elem0.b17)]
|
||||
// CHECK:STDOUT: %specific_impl_fn.loc9_28.2: <specific function> = specific_impl_function %impl.elem0.loc9_28.2, @DefaultOrUnformed.WithSelf.Op(%DefaultOrUnformed.facet.loc9_28.2) [symbolic = %specific_impl_fn.loc9_28.2 (constants.%specific_impl_fn.cf5)]
|
||||
// CHECK:STDOUT: %Destroy.lookup_impl_witness: <witness> = lookup_impl_witness %Int.loc9_27.2, @Destroy [symbolic = %Destroy.lookup_impl_witness (constants.%Destroy.lookup_impl_witness.173)]
|
||||
// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %Int.loc9_27.2, (%Destroy.lookup_impl_witness) [symbolic = %Destroy.facet (constants.%Destroy.facet.7bb)]
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.Op.type: type = fn_type @Destroy.WithSelf.Op, @Destroy.WithSelf(%Destroy.facet) [symbolic = %Destroy.WithSelf.Op.type (constants.%Destroy.WithSelf.Op.type.8f1)]
|
||||
// CHECK:STDOUT: %.loc9_3: type = fn_type_with_self_type %Destroy.WithSelf.Op.type, %Destroy.facet [symbolic = %.loc9_3 (constants.%.2c6)]
|
||||
// CHECK:STDOUT: %impl.elem0.loc9_3.2: @ErrorIfNIsZero.%.loc9_3 (%.2c6) = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc9_3.2 (constants.%impl.elem0.604)]
|
||||
// CHECK:STDOUT: %specific_impl_fn.loc9_3.2: <specific function> = specific_impl_function %impl.elem0.loc9_3.2, @Destroy.WithSelf.Op(%Destroy.facet) [symbolic = %specific_impl_fn.loc9_3.2 (constants.%specific_impl_fn.693)]
|
||||
// CHECK:STDOUT: %Destroy.facet.loc9_3.2: %Destroy.type = facet_value %Int.loc9_27.2, (%Destroy.lookup_impl_witness) [symbolic = %Destroy.facet.loc9_3.2 (constants.%Destroy.facet.7bb)]
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.Op.type: type = fn_type @Destroy.WithSelf.Op, @Destroy.WithSelf(%Destroy.facet.loc9_3.2) [symbolic = %Destroy.WithSelf.Op.type (constants.%Destroy.WithSelf.Op.type.8f1)]
|
||||
// CHECK:STDOUT: %.loc9_3.2: type = fn_type_with_self_type %Destroy.WithSelf.Op.type, %Destroy.facet.loc9_3.2 [symbolic = %.loc9_3.2 (constants.%.2c6)]
|
||||
// CHECK:STDOUT: %impl.elem0.loc9_3.2: @ErrorIfNIsZero.%.loc9_3.2 (%.2c6) = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc9_3.2 (constants.%impl.elem0.604)]
|
||||
// CHECK:STDOUT: %specific_impl_fn.loc9_3.2: <specific function> = specific_impl_function %impl.elem0.loc9_3.2, @Destroy.WithSelf.Op(%Destroy.facet.loc9_3.2) [symbolic = %specific_impl_fn.loc9_3.2 (constants.%specific_impl_fn.693)]
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
@@ -173,8 +174,10 @@ fn CallNegative() {
|
||||
// CHECK:STDOUT: %Int.loc9_27.1: type = class_type @Int, @Int(constants.%N) [symbolic = %Int.loc9_27.2 (constants.%Int)]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %v: ref @ErrorIfNIsZero.%Int.loc9_27.2 (%Int) = ref_binding v, %v.var
|
||||
// CHECK:STDOUT: %impl.elem0.loc9_3.1: @ErrorIfNIsZero.%.loc9_3 (%.2c6) = impl_witness_access constants.%Destroy.lookup_impl_witness.173, element0 [symbolic = %impl.elem0.loc9_3.2 (constants.%impl.elem0.604)]
|
||||
// CHECK:STDOUT: %impl.elem0.loc9_3.1: @ErrorIfNIsZero.%.loc9_3.2 (%.2c6) = impl_witness_access constants.%Destroy.lookup_impl_witness.173, element0 [symbolic = %impl.elem0.loc9_3.2 (constants.%impl.elem0.604)]
|
||||
// CHECK:STDOUT: %bound_method.loc9_3.1: <bound method> = bound_method %v.var, %impl.elem0.loc9_3.1
|
||||
// CHECK:STDOUT: %Destroy.facet.loc9_3.1: %Destroy.type = facet_value constants.%Int, (constants.%Destroy.lookup_impl_witness.173) [symbolic = %Destroy.facet.loc9_3.2 (constants.%Destroy.facet.7bb)]
|
||||
// CHECK:STDOUT: %.loc9_3.1: %Destroy.type = converted constants.%Int, %Destroy.facet.loc9_3.1 [symbolic = %Destroy.facet.loc9_3.2 (constants.%Destroy.facet.7bb)]
|
||||
// CHECK:STDOUT: %specific_impl_fn.loc9_3.1: <specific function> = specific_impl_function %impl.elem0.loc9_3.1, @Destroy.WithSelf.Op(constants.%Destroy.facet.7bb) [symbolic = %specific_impl_fn.loc9_3.2 (constants.%specific_impl_fn.693)]
|
||||
// CHECK:STDOUT: %bound_method.loc9_3.2: <bound method> = bound_method %v.var, %specific_impl_fn.loc9_3.1
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call %bound_method.loc9_3.2(%v.var)
|
||||
@@ -215,9 +218,9 @@ fn CallNegative() {
|
||||
// CHECK:STDOUT: %impl.elem0.loc9_28.2 => constants.%T.as.DefaultOrUnformed.impl.Op.38a
|
||||
// CHECK:STDOUT: %specific_impl_fn.loc9_28.2 => constants.%T.as.DefaultOrUnformed.impl.Op.specific_fn
|
||||
// CHECK:STDOUT: %Destroy.lookup_impl_witness => constants.%custom_witness.df9
|
||||
// CHECK:STDOUT: %Destroy.facet => constants.%Destroy.facet.85b
|
||||
// CHECK:STDOUT: %Destroy.facet.loc9_3.2 => constants.%Destroy.facet.85b
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.Op.type => constants.%Destroy.WithSelf.Op.type.b7e
|
||||
// CHECK:STDOUT: %.loc9_3 => constants.%.338
|
||||
// CHECK:STDOUT: %.loc9_3.2 => constants.%.338
|
||||
// CHECK:STDOUT: %impl.elem0.loc9_3.2 => constants.%Destroy.Op
|
||||
// CHECK:STDOUT: %specific_impl_fn.loc9_3.2 => constants.%Destroy.Op
|
||||
// CHECK:STDOUT: }
|
||||
|
||||
@@ -17,6 +17,7 @@ fn F(T:! type) {
|
||||
let unused n: T = *p;
|
||||
}
|
||||
|
||||
|
||||
// CHECK:STDOUT: --- type_param.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
@@ -94,11 +95,11 @@ fn F(T:! type) {
|
||||
// CHECK:STDOUT: %require_complete.loc17: <witness> = require_complete_type %T.loc15_7.1 [symbolic = %require_complete.loc17 (constants.%require_complete.944)]
|
||||
// CHECK:STDOUT: %pattern_type.loc17: type = pattern_type %T.loc15_7.1 [symbolic = %pattern_type.loc17 (constants.%pattern_type.51d)]
|
||||
// CHECK:STDOUT: %Destroy.lookup_impl_witness: <witness> = lookup_impl_witness %ptr.loc16_11.2, @Destroy [symbolic = %Destroy.lookup_impl_witness (constants.%Destroy.lookup_impl_witness)]
|
||||
// CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %ptr.loc16_11.2, (%Destroy.lookup_impl_witness) [symbolic = %Destroy.facet (constants.%Destroy.facet)]
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.Op.type: type = fn_type @Destroy.WithSelf.Op, @Destroy.WithSelf(%Destroy.facet) [symbolic = %Destroy.WithSelf.Op.type (constants.%Destroy.WithSelf.Op.type.8a4)]
|
||||
// CHECK:STDOUT: %.loc16_3: type = fn_type_with_self_type %Destroy.WithSelf.Op.type, %Destroy.facet [symbolic = %.loc16_3 (constants.%.9f8)]
|
||||
// CHECK:STDOUT: %impl.elem0.loc16_3.2: @F.%.loc16_3 (%.9f8) = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc16_3.2 (constants.%impl.elem0.258)]
|
||||
// CHECK:STDOUT: %specific_impl_fn.loc16_3.2: <specific function> = specific_impl_function %impl.elem0.loc16_3.2, @Destroy.WithSelf.Op(%Destroy.facet) [symbolic = %specific_impl_fn.loc16_3.2 (constants.%specific_impl_fn.192)]
|
||||
// CHECK:STDOUT: %Destroy.facet.loc16_3.2: %Destroy.type = facet_value %ptr.loc16_11.2, (%Destroy.lookup_impl_witness) [symbolic = %Destroy.facet.loc16_3.2 (constants.%Destroy.facet)]
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.Op.type: type = fn_type @Destroy.WithSelf.Op, @Destroy.WithSelf(%Destroy.facet.loc16_3.2) [symbolic = %Destroy.WithSelf.Op.type (constants.%Destroy.WithSelf.Op.type.8a4)]
|
||||
// CHECK:STDOUT: %.loc16_3.2: type = fn_type_with_self_type %Destroy.WithSelf.Op.type, %Destroy.facet.loc16_3.2 [symbolic = %.loc16_3.2 (constants.%.9f8)]
|
||||
// CHECK:STDOUT: %impl.elem0.loc16_3.2: @F.%.loc16_3.2 (%.9f8) = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc16_3.2 (constants.%impl.elem0.258)]
|
||||
// CHECK:STDOUT: %specific_impl_fn.loc16_3.2: <specific function> = specific_impl_function %impl.elem0.loc16_3.2, @Destroy.WithSelf.Op(%Destroy.facet.loc16_3.2) [symbolic = %specific_impl_fn.loc16_3.2 (constants.%specific_impl_fn.192)]
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
@@ -129,8 +130,10 @@ fn F(T:! type) {
|
||||
// CHECK:STDOUT: %T.ref.loc17: type = name_ref T, %T.loc15_7.2 [symbolic = %T.loc15_7.1 (constants.%T.67d)]
|
||||
// CHECK:STDOUT: %.loc17_21.2: @F.%T.loc15_7.1 (%T.67d) = acquire_value %.loc17_21.1
|
||||
// CHECK:STDOUT: %n: @F.%T.loc15_7.1 (%T.67d) = value_binding n, %.loc17_21.2
|
||||
// CHECK:STDOUT: %impl.elem0.loc16_3.1: @F.%.loc16_3 (%.9f8) = impl_witness_access constants.%Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc16_3.2 (constants.%impl.elem0.258)]
|
||||
// CHECK:STDOUT: %impl.elem0.loc16_3.1: @F.%.loc16_3.2 (%.9f8) = impl_witness_access constants.%Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc16_3.2 (constants.%impl.elem0.258)]
|
||||
// CHECK:STDOUT: %bound_method.loc16_3.1: <bound method> = bound_method %p.var, %impl.elem0.loc16_3.1
|
||||
// CHECK:STDOUT: %Destroy.facet.loc16_3.1: %Destroy.type = facet_value constants.%ptr, (constants.%Destroy.lookup_impl_witness) [symbolic = %Destroy.facet.loc16_3.2 (constants.%Destroy.facet)]
|
||||
// CHECK:STDOUT: %.loc16_3.1: %Destroy.type = converted constants.%ptr, %Destroy.facet.loc16_3.1 [symbolic = %Destroy.facet.loc16_3.2 (constants.%Destroy.facet)]
|
||||
// CHECK:STDOUT: %specific_impl_fn.loc16_3.1: <specific function> = specific_impl_function %impl.elem0.loc16_3.1, @Destroy.WithSelf.Op(constants.%Destroy.facet) [symbolic = %specific_impl_fn.loc16_3.2 (constants.%specific_impl_fn.192)]
|
||||
// CHECK:STDOUT: %bound_method.loc16_3.2: <bound method> = bound_method %p.var, %specific_impl_fn.loc16_3.1
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call %bound_method.loc16_3.2(%p.var)
|
||||
|
||||
@@ -21,6 +21,7 @@ fn F(T:! type, n: T*) -> T* {
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
|
||||
|
||||
// CHECK:STDOUT: --- local_let.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
@@ -43,13 +44,13 @@ fn F(T:! type, n: T*) -> T* {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !definition:
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: %.loc7_10.1: require_specific_def_type = require_specific_def @ptr.as.Copy.impl(%T.loc4_7.1) [symbolic = %.loc7_10.1 (constants.%.0e9)]
|
||||
// CHECK:STDOUT: %.loc7_10.2: require_specific_def_type = require_specific_def @ptr.as.Copy.impl(%T.loc4_7.1) [symbolic = %.loc7_10.2 (constants.%.0e9)]
|
||||
// CHECK:STDOUT: %Copy.lookup_impl_witness: <witness> = lookup_impl_witness %ptr.loc4_20.1, @Copy [symbolic = %Copy.lookup_impl_witness (constants.%Copy.lookup_impl_witness.1da)]
|
||||
// CHECK:STDOUT: %Copy.facet: %Copy.type = facet_value %ptr.loc4_20.1, (%Copy.lookup_impl_witness) [symbolic = %Copy.facet (constants.%Copy.facet)]
|
||||
// CHECK:STDOUT: %Copy.WithSelf.Op.type: type = fn_type @Copy.WithSelf.Op, @Copy.WithSelf(%Copy.facet) [symbolic = %Copy.WithSelf.Op.type (constants.%Copy.WithSelf.Op.type.884)]
|
||||
// CHECK:STDOUT: %.loc7_10.2: type = fn_type_with_self_type %Copy.WithSelf.Op.type, %Copy.facet [symbolic = %.loc7_10.2 (constants.%.be5)]
|
||||
// CHECK:STDOUT: %impl.elem0.loc7_10.2: @F.%.loc7_10.2 (%.be5) = impl_witness_access %Copy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc7_10.2 (constants.%impl.elem0.484)]
|
||||
// CHECK:STDOUT: %specific_impl_fn.loc7_10.2: <specific function> = specific_impl_function %impl.elem0.loc7_10.2, @Copy.WithSelf.Op(%Copy.facet) [symbolic = %specific_impl_fn.loc7_10.2 (constants.%specific_impl_fn.a76)]
|
||||
// CHECK:STDOUT: %Copy.facet.loc7_10.2: %Copy.type = facet_value %ptr.loc4_20.1, (%Copy.lookup_impl_witness) [symbolic = %Copy.facet.loc7_10.2 (constants.%Copy.facet)]
|
||||
// CHECK:STDOUT: %Copy.WithSelf.Op.type: type = fn_type @Copy.WithSelf.Op, @Copy.WithSelf(%Copy.facet.loc7_10.2) [symbolic = %Copy.WithSelf.Op.type (constants.%Copy.WithSelf.Op.type.884)]
|
||||
// CHECK:STDOUT: %.loc7_10.3: type = fn_type_with_self_type %Copy.WithSelf.Op.type, %Copy.facet.loc7_10.2 [symbolic = %.loc7_10.3 (constants.%.be5)]
|
||||
// CHECK:STDOUT: %impl.elem0.loc7_10.2: @F.%.loc7_10.3 (%.be5) = impl_witness_access %Copy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc7_10.2 (constants.%impl.elem0.484)]
|
||||
// CHECK:STDOUT: %specific_impl_fn.loc7_10.2: <specific function> = specific_impl_function %impl.elem0.loc7_10.2, @Copy.WithSelf.Op(%Copy.facet.loc7_10.2) [symbolic = %specific_impl_fn.loc7_10.2 (constants.%specific_impl_fn.a76)]
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn(%n.param: @F.%ptr.loc4_20.1 (%ptr)) -> out %return.param: @F.%ptr.loc4_20.1 (%ptr) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
@@ -63,8 +64,10 @@ fn F(T:! type, n: T*) -> T* {
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %m: @F.%ptr.loc4_20.1 (%ptr) = value_binding m, %n.ref
|
||||
// CHECK:STDOUT: %m.ref: @F.%ptr.loc4_20.1 (%ptr) = name_ref m, %m
|
||||
// CHECK:STDOUT: %impl.elem0.loc7_10.1: @F.%.loc7_10.2 (%.be5) = impl_witness_access constants.%Copy.lookup_impl_witness.1da, element0 [symbolic = %impl.elem0.loc7_10.2 (constants.%impl.elem0.484)]
|
||||
// CHECK:STDOUT: %impl.elem0.loc7_10.1: @F.%.loc7_10.3 (%.be5) = impl_witness_access constants.%Copy.lookup_impl_witness.1da, element0 [symbolic = %impl.elem0.loc7_10.2 (constants.%impl.elem0.484)]
|
||||
// CHECK:STDOUT: %bound_method.loc7_10.1: <bound method> = bound_method %m.ref, %impl.elem0.loc7_10.1
|
||||
// CHECK:STDOUT: %Copy.facet.loc7_10.1: %Copy.type = facet_value constants.%ptr, (constants.%Copy.lookup_impl_witness.1da) [symbolic = %Copy.facet.loc7_10.2 (constants.%Copy.facet)]
|
||||
// CHECK:STDOUT: %.loc7_10.1: %Copy.type = converted constants.%ptr, %Copy.facet.loc7_10.1 [symbolic = %Copy.facet.loc7_10.2 (constants.%Copy.facet)]
|
||||
// CHECK:STDOUT: %specific_impl_fn.loc7_10.1: <specific function> = specific_impl_function %impl.elem0.loc7_10.1, @Copy.WithSelf.Op(constants.%Copy.facet) [symbolic = %specific_impl_fn.loc7_10.2 (constants.%specific_impl_fn.a76)]
|
||||
// CHECK:STDOUT: %bound_method.loc7_10.2: <bound method> = bound_method %m.ref, %specific_impl_fn.loc7_10.1
|
||||
// CHECK:STDOUT: %Copy.WithSelf.Op.call: init @F.%ptr.loc4_20.1 (%ptr) = call %bound_method.loc7_10.2(%m.ref)
|
||||
|
||||
Reference in New Issue
Block a user