diff --git a/toolchain/check/cpp/operators.cpp b/toolchain/check/cpp/operators.cpp index a76de87b8e93..d2ed90610de1 100644 --- a/toolchain/check/cpp/operators.cpp +++ b/toolchain/check/cpp/operators.cpp @@ -39,6 +39,7 @@ static auto GetClangOperatorKind(Context& context, SemIR::LocId loc_id, case CoreIdentifier::Destroy: case CoreIdentifier::As: case CoreIdentifier::ImplicitAs: + case CoreIdentifier::Iterate: case CoreIdentifier::UnsafeAs: case CoreIdentifier::Copy: { // TODO: Support destructors and conversions. diff --git a/toolchain/check/testdata/interop/cpp/range_for.carbon b/toolchain/check/testdata/interop/cpp/range_for.carbon index d20f463304c5..1b0e5bc27225 100644 --- a/toolchain/check/testdata/interop/cpp/range_for.carbon +++ b/toolchain/check/testdata/interop/cpp/range_for.carbon @@ -42,7 +42,7 @@ public: }; '''; -fn Test[R:! Core.Iterate where .ElementType = i32](r: R) { +fn TestIterate[R:! Core.Iterate where .ElementType = i32](r: R) { var sum: i32 = 0; //@dump-sem-ir-begin @@ -52,9 +52,25 @@ fn Test[R:! Core.Iterate where .ElementType = i32](r: R) { //@dump-sem-ir-end } -fn TestDriver(var m: Cpp.MutableRange, c: Cpp.ConstRange) { - Test(m); - Test(c); +fn TestIterateDriver(var m: Cpp.MutableRange, c: Cpp.ConstRange) { + TestIterate(m); + TestIterate(c); +} + +fn TestRangeFor(var m: Cpp.MutableRange, c: Cpp.ConstRange) { + var sum: i32 = 0; + + //@dump-sem-ir-begin + for (i: i32 in m) { + sum += i; + } + //@dump-sem-ir-end + + //@dump-sem-ir-begin + for (i: i32 in c) { + sum += i; + } + //@dump-sem-ir-end } // --- methods_return_different_types.carbon @@ -97,7 +113,7 @@ public: }; '''; -fn Test[R:! Core.Iterate where .ElementType = Cpp.ValueType](var r: R) { +fn TestIterate[R:! Core.Iterate where .ElementType = Cpp.ValueType](var r: R) { var sum: Cpp.ValueType = Cpp.ValueType.ValueType(); //@dump-sem-ir-begin @@ -107,9 +123,23 @@ fn Test[R:! Core.Iterate where .ElementType = Cpp.ValueType](var r: R) { //@dump-sem-ir-end } -fn TestDriver(var m: Cpp.MutableRange, c: Cpp.ConstRange) { - Test(m); - Test(c); +fn TestIterateDriver(var m: Cpp.MutableRange, c: Cpp.ConstRange) { + TestIterate(m); + TestIterate(c); +} + +fn TestRangeFor(var m: Cpp.MutableRange, c: Cpp.ConstRange) { + var sum: Cpp.ValueType = Cpp.ValueType.ValueType(); + + //@dump-sem-ir-begin + for (i: Cpp.ValueType in m) { + sum += i; + } + + for (i: Cpp.ValueType in c) { + sum += i; + } + //@dump-sem-ir-end } // --- adl_return_same_types.carbon @@ -132,7 +162,7 @@ public: } // namespace N '''; -fn Test[R:! Core.Iterate where .ElementType = f64](r: R) { +fn TestIterate[R:! Core.Iterate where .ElementType = f64](r: R) { var sum: f64 = 0.0; //@dump-sem-ir-begin @@ -142,8 +172,18 @@ fn Test[R:! Core.Iterate where .ElementType = f64](r: R) { //@dump-sem-ir-end } -fn TestDriver(c: Cpp.N.ConstRange) { - Test(c); +fn TestIterateDriver(c: Cpp.N.ConstRange) { + TestIterate(c); +} + +fn TestRangeFor(c: Cpp.N.ConstRange) { + var sum: f64 = 0; + + //@dump-sem-ir-begin + for (i: f64 in c) { + sum += i; + } + //@dump-sem-ir-end } // --- fail_todo_adl_returns_same_types_mutable.carbon @@ -168,7 +208,7 @@ public: } // namespace N '''; -fn Test[R:! Core.Iterate where .ElementType = f64](r: R) { +fn TestIterate[R:! Core.Iterate where .ElementType = f64](r: R) { var sum: f64 = 0.0; //@dump-sem-ir-begin @@ -178,10 +218,10 @@ fn Test[R:! Core.Iterate where .ElementType = f64](r: R) { //@dump-sem-ir-end } -fn TestDriver(var m: Cpp.N.MutableRange) { +fn TestIterateDriver(var m: Cpp.N.MutableRange) { // CHECK:STDERR: fail_todo_adl_returns_same_types_mutable.carbon:[[@LINE+28]]:3: error: facet type `Core.CppRangeForIterate where .(Core.CppRangeForIterate.Iterator) impls Core.Destroy and .(Core.CppRangeForIterate.Iterator) impls Core.Copy and .(Core.CppRangeForIterate.Iterator) impls Core.CppUnsafeDeref and .(Core.CppRangeForIterate.Iterator) impls Core.EqWith(.(Core.CppRangeForIterate.Sentinel)) and .(Core.CppRangeForIterate.Iterator) impls Core.Inc and .(Core.CppRangeForIterate.Iterator).(Core.CppUnsafeDeref.Result) impls Core.Destroy and .(Core.CppRangeForIterate.Iterator).(Core.CppUnsafeDeref.Result) impls Core.Copy and .(Core.CppRangeForIterate.Sentinel) impls Core.Destroy and .(Core.CppRangeForIterate.Sentinel) impls Core.Copy` can not be identified [ImplLookupInUnidentifiedFacetType] - // CHECK:STDERR: Test(m); - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: TestIterate(m); + // CHECK:STDERR: ^~~~~~~~~~~~~~ // CHECK:STDERR: fail_todo_adl_returns_same_types_mutable.carbon: note: value expression passed to reference parameter [ValueForRefParam] // CHECK:STDERR: fail_todo_adl_returns_same_types_mutable.carbon:[[@LINE-21]]:34: note: initializing function parameter [InCallToFunctionParam] // CHECK:STDERR: friend auto begin(MutableRange&) -> Iterator; @@ -190,12 +230,12 @@ fn TestDriver(var m: Cpp.N.MutableRange) { // CHECK:STDERR: fn Begin(self) -> Iterator; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: fail_todo_adl_returns_same_types_mutable.carbon:[[@LINE-21]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn Test[R:! Core.Iterate where .ElementType = f64](r: R) { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fn TestIterate[R:! Core.Iterate where .ElementType = f64](r: R) { + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: // CHECK:STDERR: fail_todo_adl_returns_same_types_mutable.carbon:[[@LINE+14]]:3: error: facet type `Core.CppRangeForIterate where .(Core.CppRangeForIterate.Iterator) impls Core.Destroy and .(Core.CppRangeForIterate.Iterator) impls Core.Copy and .(Core.CppRangeForIterate.Iterator) impls Core.CppUnsafeDeref and .(Core.CppRangeForIterate.Iterator) impls Core.EqWith(.(Core.CppRangeForIterate.Sentinel)) and .(Core.CppRangeForIterate.Iterator) impls Core.Inc and .(Core.CppRangeForIterate.Iterator).(Core.CppUnsafeDeref.Result) impls Core.Destroy and .(Core.CppRangeForIterate.Iterator).(Core.CppUnsafeDeref.Result) impls Core.Copy and .(Core.CppRangeForIterate.Sentinel) impls Core.Destroy and .(Core.CppRangeForIterate.Sentinel) impls Core.Copy` can not be identified [ImplLookupInUnidentifiedFacetType] - // CHECK:STDERR: Test(m); - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: TestIterate(m); + // CHECK:STDERR: ^~~~~~~~~~~~~~ // CHECK:STDERR: fail_todo_adl_returns_same_types_mutable.carbon: note: value expression passed to reference parameter [ValueForRefParam] // CHECK:STDERR: fail_todo_adl_returns_same_types_mutable.carbon:[[@LINE-34]]:32: note: initializing function parameter [InCallToFunctionParam] // CHECK:STDERR: friend auto end(MutableRange&) -> Iterator; @@ -204,10 +244,20 @@ fn TestDriver(var m: Cpp.N.MutableRange) { // CHECK:STDERR: fn End(self) -> Sentinel; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: fail_todo_adl_returns_same_types_mutable.carbon:[[@LINE-35]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn Test[R:! Core.Iterate where .ElementType = f64](r: R) { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fn TestIterate[R:! Core.Iterate where .ElementType = f64](r: R) { + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: - Test(m); + TestIterate(m); +} + +fn TestRangeFor(var m: Cpp.N.MutableRange) { + var sum: f64 = 0; + + //@dump-sem-ir-begin + for (i: f64 in m) { + sum += i; + } + //@dump-sem-ir-end } // --- adl_returns_different_types.carbon @@ -237,7 +287,7 @@ public: } // namespace N '''; -fn Test[R:! Core.Iterate where .ElementType = Cpp.N.ValueType](r: R) { +fn TestIterate[R:! Core.Iterate where .ElementType = Cpp.N.ValueType](r: R) { var sum: Cpp.N.ValueType = Cpp.N.ValueType.ValueType(); //@dump-sem-ir-begin @@ -247,8 +297,18 @@ fn Test[R:! Core.Iterate where .ElementType = Cpp.N.ValueType](r: R) { //@dump-sem-ir-end } -fn TestDriver(c: Cpp.N.ConstRange) { - Test(c); +fn TestIterateDriver(c: Cpp.N.ConstRange) { + TestIterate(c); +} + +fn TestRangeFor(c: Cpp.N.ConstRange) { + var sum: Cpp.N.ValueType = Cpp.N.ValueType.ValueType(); + + //@dump-sem-ir-begin + for (i: Cpp.N.ValueType in c) { + sum += i; + } + //@dump-sem-ir-end } // --- fail_todo_adl_returns_different_types_mutable.carbon @@ -262,7 +322,6 @@ struct ValueType { }; class MutableRange { - struct Iterator { auto operator*() const -> ValueType&; auto operator++() -> Iterator&; @@ -279,7 +338,7 @@ public: } '''; -fn Test[R:! Core.Iterate where .ElementType = Cpp.N.ValueType](r: R) { +fn TestIterate[R:! Core.Iterate where .ElementType = Cpp.N.ValueType](r: R) { var sum: Cpp.N.ValueType = Cpp.N.ValueType.ValueType(); //@dump-sem-ir-begin @@ -289,10 +348,10 @@ fn Test[R:! Core.Iterate where .ElementType = Cpp.N.ValueType](r: R) { //@dump-sem-ir-end } -fn TestDriver(var m: Cpp.N.MutableRange) { +fn TestIterateDriver(var m: Cpp.N.MutableRange) { // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+42]]:3: error: facet type `Core.CppRangeForIterate where .(Core.CppRangeForIterate.Iterator) impls Core.Destroy and .(Core.CppRangeForIterate.Iterator) impls Core.Copy and .(Core.CppRangeForIterate.Iterator) impls Core.CppUnsafeDeref and .(Core.CppRangeForIterate.Iterator) impls Core.EqWith(.(Core.CppRangeForIterate.Sentinel)) and .(Core.CppRangeForIterate.Iterator) impls Core.Inc and .(Core.CppRangeForIterate.Iterator).(Core.CppUnsafeDeref.Result) impls Core.Destroy and .(Core.CppRangeForIterate.Iterator).(Core.CppUnsafeDeref.Result) impls Core.Copy and .(Core.CppRangeForIterate.Sentinel) impls Core.Destroy and .(Core.CppRangeForIterate.Sentinel) impls Core.Copy` can not be identified [ImplLookupInUnidentifiedFacetType] - // CHECK:STDERR: Test(m); - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: TestIterate(m); + // CHECK:STDERR: ^~~~~~~~~~~~~~ // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon: note: value expression passed to reference parameter [ValueForRefParam] // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE-21]]:34: note: initializing function parameter [InCallToFunctionParam] // CHECK:STDERR: friend auto begin(MutableRange&) -> Iterator; @@ -301,12 +360,12 @@ fn TestDriver(var m: Cpp.N.MutableRange) { // CHECK:STDERR: fn Begin(self) -> Iterator; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE-21]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn Test[R:! Core.Iterate where .ElementType = Cpp.N.ValueType](r: R) { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fn TestIterate[R:! Core.Iterate where .ElementType = Cpp.N.ValueType](r: R) { + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+28]]:3: error: facet type `Core.CppRangeForIterate where .(Core.CppRangeForIterate.Iterator) impls Core.Destroy and .(Core.CppRangeForIterate.Iterator) impls Core.Copy and .(Core.CppRangeForIterate.Iterator) impls Core.CppUnsafeDeref and .(Core.CppRangeForIterate.Iterator) impls Core.EqWith(.(Core.CppRangeForIterate.Sentinel)) and .(Core.CppRangeForIterate.Iterator) impls Core.Inc and .(Core.CppRangeForIterate.Iterator).(Core.CppUnsafeDeref.Result) impls Core.Destroy and .(Core.CppRangeForIterate.Iterator).(Core.CppUnsafeDeref.Result) impls Core.Copy and .(Core.CppRangeForIterate.Sentinel) impls Core.Destroy and .(Core.CppRangeForIterate.Sentinel) impls Core.Copy` can not be identified [ImplLookupInUnidentifiedFacetType] - // CHECK:STDERR: Test(m); - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: TestIterate(m); + // CHECK:STDERR: ^~~~~~~~~~~~~~ // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon: note: value expression passed to reference parameter [ValueForRefParam] // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE-34]]:32: note: initializing function parameter [InCallToFunctionParam] // CHECK:STDERR: friend auto end(MutableRange&) -> Sentinel; @@ -315,24 +374,42 @@ fn TestDriver(var m: Cpp.N.MutableRange) { // CHECK:STDERR: fn End(self) -> Sentinel; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE-35]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn Test[R:! Core.Iterate where .ElementType = Cpp.N.ValueType](r: R) { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fn TestIterate[R:! Core.Iterate where .ElementType = Cpp.N.ValueType](r: R) { + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+14]]:3: error: semantics TODO: `Rewriting operator== using operator== is not supported` [SemanticsTodo] - // CHECK:STDERR: Test(m); - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: TestIterate(m); + // CHECK:STDERR: ^~~~~~~~~~~~~~ // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE-42]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn Test[R:! Core.Iterate where .ElementType = Cpp.N.ValueType](r: R) { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fn TestIterate[R:! Core.Iterate where .ElementType = Cpp.N.ValueType](r: R) { + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+7]]:3: error: cannot convert type `Cpp.N.MutableRange` into type implementing `Core.Iterate where .(Core.Iterate.ElementType) = Cpp.N.ValueType as Core.Destroy & Core.Copy` [ConversionFailureTypeToFacet] - // CHECK:STDERR: Test(m); - // CHECK:STDERR: ^~~~~~~ + // CHECK:STDERR: TestIterate(m); + // CHECK:STDERR: ^~~~~~~~~~~~~~ // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE-49]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn Test[R:! Core.Iterate where .ElementType = Cpp.N.ValueType](r: R) { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fn TestIterate[R:! Core.Iterate where .ElementType = Cpp.N.ValueType](r: R) { + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: - Test(m); + TestIterate(m); +} + +fn TestRangeFor(var m: Cpp.N.MutableRange) { + var sum: Cpp.N.ValueType = Cpp.N.ValueType.ValueType(); + + //@dump-sem-ir-begin + // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+8]]:7: error: cannot access member of interface `Core.Iterate` in type `Cpp.N.MutableRange` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: for (i: Cpp.N.ValueType in m) { + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: + // CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+4]]:7: error: cannot access member of interface `Core.Iterate` in type `Cpp.N.MutableRange` that does not implement that interface [MissingImplInMemberAccess] + // CHECK:STDERR: for (i: Cpp.N.ValueType in m) { + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: + for (i: Cpp.N.ValueType in m) { + sum += i; + } + //@dump-sem-ir-end } // --- fail_todo_adl_overloads.carbon @@ -344,7 +421,6 @@ struct ValueType { }; class MutableAndConstRange { - struct Iterator { auto operator*() const -> ValueType&; auto operator++() -> Iterator&; @@ -370,7 +446,7 @@ class MutableAndConstRange { } '''; -fn Test[R:! Core.Iterate where .ElementType = Cpp.N.ValueType](r: R) { +fn TestIterate[R:! Core.Iterate where .ElementType = Cpp.N.ValueType](r: R) { var sum: Cpp.N.ValueType = Cpp.N.ValueType.ValueType(); //@dump-sem-ir-begin @@ -380,10 +456,10 @@ fn Test[R:! Core.Iterate where .ElementType = Cpp.N.ValueType](r: R) { //@dump-sem-ir-end } -fn TestDriver(var mc: Cpp.N.MutableAndConstRange) { +fn TestIterateDriver(var mc: Cpp.N.MutableAndConstRange) { // CHECK:STDERR: fail_todo_adl_overloads.carbon:[[@LINE+28]]:3: error: facet type `Core.CppRangeForIterate where .(Core.CppRangeForIterate.Iterator) impls Core.Destroy and .(Core.CppRangeForIterate.Iterator) impls Core.Copy and .(Core.CppRangeForIterate.Iterator) impls Core.CppUnsafeDeref and .(Core.CppRangeForIterate.Iterator) impls Core.EqWith(.(Core.CppRangeForIterate.Sentinel)) and .(Core.CppRangeForIterate.Iterator) impls Core.Inc and .(Core.CppRangeForIterate.Iterator).(Core.CppUnsafeDeref.Result) impls Core.Destroy and .(Core.CppRangeForIterate.Iterator).(Core.CppUnsafeDeref.Result) impls Core.Copy and .(Core.CppRangeForIterate.Sentinel) impls Core.Destroy and .(Core.CppRangeForIterate.Sentinel) impls Core.Copy` can not be identified [ImplLookupInUnidentifiedFacetType] - // CHECK:STDERR: Test(mc); - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: TestIterate(mc); + // CHECK:STDERR: ^~~~~~~~~~~~~~~ // CHECK:STDERR: fail_todo_adl_overloads.carbon: note: value expression passed to reference parameter [ValueForRefParam] // CHECK:STDERR: fail_todo_adl_overloads.carbon:[[@LINE-24]]:44: note: initializing function parameter [InCallToFunctionParam] // CHECK:STDERR: friend auto begin(MutableAndConstRange&) -> Iterator; @@ -392,12 +468,12 @@ fn TestDriver(var mc: Cpp.N.MutableAndConstRange) { // CHECK:STDERR: fn Begin(self) -> Iterator; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: fail_todo_adl_overloads.carbon:[[@LINE-21]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn Test[R:! Core.Iterate where .ElementType = Cpp.N.ValueType](r: R) { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fn TestIterate[R:! Core.Iterate where .ElementType = Cpp.N.ValueType](r: R) { + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: // CHECK:STDERR: fail_todo_adl_overloads.carbon:[[@LINE+14]]:3: error: facet type `Core.CppRangeForIterate where .(Core.CppRangeForIterate.Iterator) impls Core.Destroy and .(Core.CppRangeForIterate.Iterator) impls Core.Copy and .(Core.CppRangeForIterate.Iterator) impls Core.CppUnsafeDeref and .(Core.CppRangeForIterate.Iterator) impls Core.EqWith(.(Core.CppRangeForIterate.Sentinel)) and .(Core.CppRangeForIterate.Iterator) impls Core.Inc and .(Core.CppRangeForIterate.Iterator).(Core.CppUnsafeDeref.Result) impls Core.Destroy and .(Core.CppRangeForIterate.Iterator).(Core.CppUnsafeDeref.Result) impls Core.Copy and .(Core.CppRangeForIterate.Sentinel) impls Core.Destroy and .(Core.CppRangeForIterate.Sentinel) impls Core.Copy` can not be identified [ImplLookupInUnidentifiedFacetType] - // CHECK:STDERR: Test(mc); - // CHECK:STDERR: ^~~~~~~~ + // CHECK:STDERR: TestIterate(mc); + // CHECK:STDERR: ^~~~~~~~~~~~~~~ // CHECK:STDERR: fail_todo_adl_overloads.carbon: note: value expression passed to reference parameter [ValueForRefParam] // CHECK:STDERR: fail_todo_adl_overloads.carbon:[[@LINE-37]]:42: note: initializing function parameter [InCallToFunctionParam] // CHECK:STDERR: friend auto end(MutableAndConstRange&) -> Iterator; @@ -406,10 +482,20 @@ fn TestDriver(var mc: Cpp.N.MutableAndConstRange) { // CHECK:STDERR: fn End(self) -> Sentinel; // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: fail_todo_adl_overloads.carbon:[[@LINE-35]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere] - // CHECK:STDERR: fn Test[R:! Core.Iterate where .ElementType = Cpp.N.ValueType](r: R) { - // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // CHECK:STDERR: fn TestIterate[R:! Core.Iterate where .ElementType = Cpp.N.ValueType](r: R) { + // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CHECK:STDERR: - Test(mc); + TestIterate(mc); +} + +fn TestRangeFor(var mc: Cpp.N.MutableAndConstRange) { + var sum: Cpp.N.ValueType = Cpp.N.ValueType.ValueType(); + + //@dump-sem-ir-begin + for (i: Cpp.N.ValueType in mc) { + sum += i; + } + //@dump-sem-ir-end } // --- fail_never_valid.carbon @@ -656,7 +742,7 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %Int.67af24.1: type = class_type @Int, @Int(%N.fe9) [symbolic] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] // CHECK:STDOUT: %pattern_type.6b6: type = pattern_type %i32 [concrete] -// CHECK:STDOUT: %Destroy.Op.type.1d8f74.2: type = fn_type @Destroy.Op.loc30_47.2 [concrete] +// CHECK:STDOUT: %Destroy.Op.type.1d8f74.2: type = fn_type @Destroy.Op.loc30_54.2 [concrete] // CHECK:STDOUT: %Destroy.Op.1a2547.2: %Destroy.Op.type.1d8f74.2 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.df9cc1.2: = custom_witness (%Destroy.Op.1a2547.2), @Destroy [concrete] // CHECK:STDOUT: %Int.as.Copy.impl.Op.type.ac8: type = fn_type @Int.as.Copy.impl.Op, @Int.as.Copy.impl(%N.fe9) [symbolic] @@ -845,25 +931,25 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %r.param_patt.83e: %pattern_type.0ba = value_param_pattern [concrete] // CHECK:STDOUT: %r.patt.116: %pattern_type.0ba = at_binding_pattern r, %r.param_patt.83e [concrete] // CHECK:STDOUT: %Iterate.WithSelf.NewCursor.type.dcb: type = fn_type @Iterate.WithSelf.NewCursor, @Iterate.WithSelf(%Iterate.facet.ffb) [concrete] +// CHECK:STDOUT: %Iterate.WithSelf.Next.type.30e: type = fn_type @Iterate.WithSelf.Next, @Iterate.WithSelf(%Iterate.facet.ffb) [concrete] // CHECK:STDOUT: %.d6a: type = fn_type_with_self_type %Iterate.WithSelf.NewCursor.type.dcb, %Iterate.facet.ffb [concrete] // CHECK:STDOUT: %R.as_type.as.Iterate.impl.NewCursor.specific_fn.bf1: = specific_function %R.as_type.as.Iterate.impl.NewCursor.8d2, @R.as_type.as.Iterate.impl.NewCursor(%facet_value.cd6) [concrete] -// CHECK:STDOUT: %complete_type.c28: = complete_type_witness %tuple.type.508 [concrete] // CHECK:STDOUT: %ptr.45c: type = ptr_type %tuple.type.508 [concrete] -// CHECK:STDOUT: %Iterate.WithSelf.Next.type.30e: type = fn_type @Iterate.WithSelf.Next, @Iterate.WithSelf(%Iterate.facet.ffb) [concrete] // CHECK:STDOUT: %.d23: type = fn_type_with_self_type %Iterate.WithSelf.Next.type.30e, %Iterate.facet.ffb [concrete] // CHECK:STDOUT: %R.as_type.as.Iterate.impl.Next.specific_fn.dd5: = specific_function %R.as_type.as.Iterate.impl.Next.34d, @R.as_type.as.Iterate.impl.Next(%facet_value.cd6) [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.c6c: type = fn_type @Destroy.WithSelf.Op, @Destroy.WithSelf(%Destroy.facet.30f) [concrete] -// CHECK:STDOUT: %.0a4: type = fn_type_with_self_type %Destroy.WithSelf.Op.type.c6c, %Destroy.facet.30f [concrete] // CHECK:STDOUT: %Iterate.WithSelf.NewCursor.type.ab5: type = fn_type @Iterate.WithSelf.NewCursor, @Iterate.WithSelf(%Iterate.facet.5eb) [concrete] +// CHECK:STDOUT: %Iterate.WithSelf.Next.type.e25: type = fn_type @Iterate.WithSelf.Next, @Iterate.WithSelf(%Iterate.facet.5eb) [concrete] // CHECK:STDOUT: %.744: type = fn_type_with_self_type %Iterate.WithSelf.NewCursor.type.ab5, %Iterate.facet.5eb [concrete] // CHECK:STDOUT: %R.as_type.as.Iterate.impl.NewCursor.specific_fn.a05: = specific_function %R.as_type.as.Iterate.impl.NewCursor.2f6, @R.as_type.as.Iterate.impl.NewCursor(%facet_value.e88) [concrete] -// CHECK:STDOUT: %complete_type.8d5: = complete_type_witness %tuple.type.69f [concrete] // CHECK:STDOUT: %ptr.c5c: type = ptr_type %tuple.type.69f [concrete] -// CHECK:STDOUT: %Iterate.WithSelf.Next.type.e25: type = fn_type @Iterate.WithSelf.Next, @Iterate.WithSelf(%Iterate.facet.5eb) [concrete] // CHECK:STDOUT: %.03b: type = fn_type_with_self_type %Iterate.WithSelf.Next.type.e25, %Iterate.facet.5eb [concrete] // CHECK:STDOUT: %R.as_type.as.Iterate.impl.Next.specific_fn.4cc: = specific_function %R.as_type.as.Iterate.impl.Next.393, @R.as_type.as.Iterate.impl.Next(%facet_value.e88) [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.type.7ec: type = fn_type @Destroy.WithSelf.Op, @Destroy.WithSelf(%Destroy.facet.e4c) [concrete] // CHECK:STDOUT: %.0e7: type = fn_type_with_self_type %Destroy.WithSelf.Op.type.7ec, %Destroy.facet.e4c [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.c6c: type = fn_type @Destroy.WithSelf.Op, @Destroy.WithSelf(%Destroy.facet.30f) [concrete] +// CHECK:STDOUT: %.0a4: type = fn_type_with_self_type %Destroy.WithSelf.Op.type.c6c, %Destroy.facet.30f [concrete] +// CHECK:STDOUT: %complete_type.c28: = complete_type_witness %tuple.type.508 [concrete] +// CHECK:STDOUT: %complete_type.8d5: = complete_type_witness %tuple.type.69f [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -893,37 +979,37 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %AnyInt.impl_witness_table = impl_witness_table (%Core.import_ref.47b, %Core.import_ref.a64), @Int.as.AnyInt.impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Test(%R.loc30_10.2: %Iterate_where.type.8bc) { +// CHECK:STDOUT: generic fn @TestIterate(%R.loc30_17.2: %Iterate_where.type.8bc) { // CHECK:STDOUT: // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: -// CHECK:STDOUT: %Iterate.lookup_impl_witness: = lookup_impl_witness %R.loc30_10.1, @Iterate [symbolic = %Iterate.lookup_impl_witness (constants.%Iterate.lookup_impl_witness.c86)] -// CHECK:STDOUT: %Iterate.facet.loc34_19.5: %Iterate.type = facet_value %R.as_type.loc30_55.1, (%Iterate.lookup_impl_witness) [symbolic = %Iterate.facet.loc34_19.5 (constants.%Iterate.facet.bbb)] +// CHECK:STDOUT: %Iterate.lookup_impl_witness: = lookup_impl_witness %R.loc30_17.1, @Iterate [symbolic = %Iterate.lookup_impl_witness (constants.%Iterate.lookup_impl_witness.c86)] +// CHECK:STDOUT: %Iterate.facet.loc34_19.5: %Iterate.type = facet_value %R.as_type.loc30_62.1, (%Iterate.lookup_impl_witness) [symbolic = %Iterate.facet.loc34_19.5 (constants.%Iterate.facet.bbb)] // CHECK:STDOUT: %Iterate.WithSelf.NewCursor.type: type = fn_type @Iterate.WithSelf.NewCursor, @Iterate.WithSelf(%Iterate.facet.loc34_19.5) [symbolic = %Iterate.WithSelf.NewCursor.type (constants.%Iterate.WithSelf.NewCursor.type.d2b)] // CHECK:STDOUT: %.loc34_19.19: type = fn_type_with_self_type %Iterate.WithSelf.NewCursor.type, %Iterate.facet.loc34_19.5 [symbolic = %.loc34_19.19 (constants.%.3e2)] -// CHECK:STDOUT: %impl.elem2.loc34_19.2: @Test.%.loc34_19.19 (%.3e2) = impl_witness_access %Iterate.lookup_impl_witness, element2 [symbolic = %impl.elem2.loc34_19.2 (constants.%impl.elem2.f53)] +// CHECK:STDOUT: %impl.elem2.loc34_19.2: @TestIterate.%.loc34_19.19 (%.3e2) = impl_witness_access %Iterate.lookup_impl_witness, element2 [symbolic = %impl.elem2.loc34_19.2 (constants.%impl.elem2.f53)] // CHECK:STDOUT: %specific_impl_fn.loc34_19.4: = specific_impl_function %impl.elem2.loc34_19.2, @Iterate.WithSelf.NewCursor(%Iterate.facet.loc34_19.5) [symbolic = %specific_impl_fn.loc34_19.4 (constants.%specific_impl_fn.87a)] // CHECK:STDOUT: // CHECK:STDOUT: %ptr: type = ptr_type %as_type [symbolic = %ptr (constants.%ptr.3b4)] // CHECK:STDOUT: %Iterate.WithSelf.Next.type: type = fn_type @Iterate.WithSelf.Next, @Iterate.WithSelf(%Iterate.facet.loc34_19.5) [symbolic = %Iterate.WithSelf.Next.type (constants.%Iterate.WithSelf.Next.type.28b)] // CHECK:STDOUT: %.loc34_19.20: type = fn_type_with_self_type %Iterate.WithSelf.Next.type, %Iterate.facet.loc34_19.5 [symbolic = %.loc34_19.20 (constants.%.a8b)] -// CHECK:STDOUT: %impl.elem3.loc34_19.2: @Test.%.loc34_19.20 (%.a8b) = impl_witness_access %Iterate.lookup_impl_witness, element3 [symbolic = %impl.elem3.loc34_19.2 (constants.%impl.elem3.9c3)] +// CHECK:STDOUT: %impl.elem3.loc34_19.2: @TestIterate.%.loc34_19.20 (%.a8b) = impl_witness_access %Iterate.lookup_impl_witness, element3 [symbolic = %impl.elem3.loc34_19.2 (constants.%impl.elem3.9c3)] // CHECK:STDOUT: %specific_impl_fn.loc34_19.5: = specific_impl_function %impl.elem3.loc34_19.2, @Iterate.WithSelf.Next(%Iterate.facet.loc34_19.5) [symbolic = %specific_impl_fn.loc34_19.5 (constants.%specific_impl_fn.ab2)] // CHECK:STDOUT: %Destroy.WithSelf.Op.type: type = fn_type @Destroy.WithSelf.Op, @Destroy.WithSelf(%impl.elem1) [symbolic = %Destroy.WithSelf.Op.type (constants.%Destroy.WithSelf.Op.type.515)] // CHECK:STDOUT: %.loc34_19.21: type = fn_type_with_self_type %Destroy.WithSelf.Op.type, %impl.elem1 [symbolic = %.loc34_19.21 (constants.%.94f)] // CHECK:STDOUT: %Destroy.lookup_impl_witness: = lookup_impl_witness %impl.elem1, @Destroy [symbolic = %Destroy.lookup_impl_witness (constants.%Destroy.lookup_impl_witness.5d5)] -// CHECK:STDOUT: %impl.elem0.loc34_19.2: @Test.%.loc34_19.21 (%.94f) = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc34_19.2 (constants.%impl.elem0.e52)] +// CHECK:STDOUT: %impl.elem0.loc34_19.2: @TestIterate.%.loc34_19.21 (%.94f) = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc34_19.2 (constants.%impl.elem0.e52)] // CHECK:STDOUT: %specific_impl_fn.loc34_19.6: = specific_impl_function %impl.elem0.loc34_19.2, @Destroy.WithSelf.Op(%impl.elem1) [symbolic = %specific_impl_fn.loc34_19.6 (constants.%specific_impl_fn.12e)] // CHECK:STDOUT: -// CHECK:STDOUT: fn(%r.param: @Test.%R.as_type.loc30_55.1 (%R.as_type.67d)) { +// CHECK:STDOUT: fn(%r.param: @TestIterate.%R.as_type.loc30_62.1 (%R.as_type.67d)) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %i.patt: %pattern_type.6b6 = value_binding_pattern i [concrete = constants.%i.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %r.ref: @Test.%R.as_type.loc30_55.1 (%R.as_type.67d) = name_ref r, %r -// CHECK:STDOUT: %impl.elem2.loc34_19.1: @Test.%.loc34_19.19 (%.3e2) = impl_witness_access constants.%Iterate.lookup_impl_witness.c86, element2 [symbolic = %impl.elem2.loc34_19.2 (constants.%impl.elem2.f53)] +// CHECK:STDOUT: %r.ref: @TestIterate.%R.as_type.loc30_62.1 (%R.as_type.67d) = name_ref r, %r +// CHECK:STDOUT: %impl.elem2.loc34_19.1: @TestIterate.%.loc34_19.19 (%.3e2) = impl_witness_access constants.%Iterate.lookup_impl_witness.c86, element2 [symbolic = %impl.elem2.loc34_19.2 (constants.%impl.elem2.f53)] // CHECK:STDOUT: %bound_method.loc34_19.1: = bound_method %r.ref, %impl.elem2.loc34_19.1 // CHECK:STDOUT: %Iterate.facet.loc34_19.1: %Iterate.type = facet_value constants.%R.as_type.67d, (constants.%Iterate.lookup_impl_witness.c86) [symbolic = %Iterate.facet.loc34_19.5 (constants.%Iterate.facet.bbb)] // CHECK:STDOUT: %.loc34_19.1: %Iterate.type = converted constants.%R.as_type.67d, %Iterate.facet.loc34_19.1 [symbolic = %Iterate.facet.loc34_19.5 (constants.%Iterate.facet.bbb)] @@ -931,14 +1017,14 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %.loc34_19.2: %Iterate.type = converted constants.%R.as_type.67d, %Iterate.facet.loc34_19.2 [symbolic = %Iterate.facet.loc34_19.5 (constants.%Iterate.facet.bbb)] // CHECK:STDOUT: %specific_impl_fn.loc34_19.1: = specific_impl_function %impl.elem2.loc34_19.1, @Iterate.WithSelf.NewCursor(constants.%Iterate.facet.bbb) [symbolic = %specific_impl_fn.loc34_19.4 (constants.%specific_impl_fn.87a)] // CHECK:STDOUT: %bound_method.loc34_19.2: = bound_method %r.ref, %specific_impl_fn.loc34_19.1 -// CHECK:STDOUT: %var: ref @Test.%as_type (%as_type.ca2) = var invalid -// CHECK:STDOUT: %Iterate.WithSelf.NewCursor.call: init @Test.%as_type (%as_type.ca2) to %var = call %bound_method.loc34_19.2(%r.ref) +// CHECK:STDOUT: %var: ref @TestIterate.%as_type (%as_type.ca2) = var invalid +// CHECK:STDOUT: %Iterate.WithSelf.NewCursor.call: init @TestIterate.%as_type (%as_type.ca2) to %var = call %bound_method.loc34_19.2(%r.ref) // CHECK:STDOUT: assign %var, %Iterate.WithSelf.NewCursor.call // CHECK:STDOUT: br !for.next // CHECK:STDOUT: // CHECK:STDOUT: !for.next: -// CHECK:STDOUT: %addr: @Test.%ptr (%ptr.3b4) = addr_of %var -// CHECK:STDOUT: %impl.elem3.loc34_19.1: @Test.%.loc34_19.20 (%.a8b) = impl_witness_access constants.%Iterate.lookup_impl_witness.c86, element3 [symbolic = %impl.elem3.loc34_19.2 (constants.%impl.elem3.9c3)] +// CHECK:STDOUT: %addr: @TestIterate.%ptr (%ptr.3b4) = addr_of %var +// CHECK:STDOUT: %impl.elem3.loc34_19.1: @TestIterate.%.loc34_19.20 (%.a8b) = impl_witness_access constants.%Iterate.lookup_impl_witness.c86, element3 [symbolic = %impl.elem3.loc34_19.2 (constants.%impl.elem3.9c3)] // CHECK:STDOUT: %bound_method.loc34_19.3: = bound_method %r.ref, %impl.elem3.loc34_19.1 // CHECK:STDOUT: %Iterate.facet.loc34_19.3: %Iterate.type = facet_value constants.%R.as_type.67d, (constants.%Iterate.lookup_impl_witness.c86) [symbolic = %Iterate.facet.loc34_19.5 (constants.%Iterate.facet.bbb)] // CHECK:STDOUT: %.loc34_19.3: %Iterate.type = converted constants.%R.as_type.67d, %Iterate.facet.loc34_19.3 [symbolic = %Iterate.facet.loc34_19.5 (constants.%Iterate.facet.bbb)] @@ -991,7 +1077,7 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: !for.done: // CHECK:STDOUT: %Destroy.Op.bound.loc34: = bound_method %.loc34_19.8, constants.%Destroy.Op.1a2547.9 // CHECK:STDOUT: %Destroy.Op.call.loc34: init %empty_tuple.type = call %Destroy.Op.bound.loc34(%.loc34_19.8) -// CHECK:STDOUT: %impl.elem0.loc34_19.1: @Test.%.loc34_19.21 (%.94f) = impl_witness_access constants.%Destroy.lookup_impl_witness.5d5, element0 [symbolic = %impl.elem0.loc34_19.2 (constants.%impl.elem0.e52)] +// CHECK:STDOUT: %impl.elem0.loc34_19.1: @TestIterate.%.loc34_19.21 (%.94f) = impl_witness_access constants.%Destroy.lookup_impl_witness.5d5, element0 [symbolic = %impl.elem0.loc34_19.2 (constants.%impl.elem0.e52)] // CHECK:STDOUT: %bound_method.loc34_19.7: = bound_method %var, %impl.elem0.loc34_19.1 // CHECK:STDOUT: %.loc34_19.17: %Destroy.type = converted constants.%as_type.ca2, constants.%impl.elem1.d31 [symbolic = %impl.elem1 (constants.%impl.elem1.d31)] // CHECK:STDOUT: %.loc34_19.18: %Destroy.type = converted constants.%as_type.ca2, constants.%impl.elem1.d31 [symbolic = %impl.elem1 (constants.%impl.elem1.d31)] @@ -1029,22 +1115,174 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Test(constants.%R.891) { -// CHECK:STDOUT: %R.patt.loc30_10.2 => constants.%R.patt.860 -// CHECK:STDOUT: %R.loc30_10.1 => constants.%R.891 -// CHECK:STDOUT: %R.as_type.loc30_55.1 => constants.%R.as_type.67d -// CHECK:STDOUT: %pattern_type => constants.%pattern_type.e21 -// CHECK:STDOUT: %r.param_patt.loc30_53.2 => constants.%r.param_patt.fdd -// CHECK:STDOUT: %r.patt.loc30_53.2 => constants.%r.patt.939 +// CHECK:STDOUT: fn @TestRangeFor(%m.param: ref %MutableRange, %c.param: %ConstRange) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: +// CHECK:STDOUT: name_binding_decl { +// CHECK:STDOUT: %i.patt.loc49: %pattern_type.6b6 = value_binding_pattern i [concrete = constants.%i.patt] +// CHECK:STDOUT: } +// CHECK:STDOUT: %m.ref: ref %MutableRange = name_ref m, %m +// CHECK:STDOUT: %impl.elem2.loc49: %.d6a = impl_witness_access constants.%Iterate.impl_witness.cea, element2 [concrete = constants.%R.as_type.as.Iterate.impl.NewCursor.8d2] +// CHECK:STDOUT: %bound_method.loc49_19.1: = bound_method %m.ref, %impl.elem2.loc49 +// CHECK:STDOUT: %facet_value.loc49_19.1: %CppRangeForIterate_where.type = facet_value constants.%MutableRange, (constants.%custom_witness.df9cc1.2, constants.%Copy.impl_witness.0e0, constants.%custom_witness.ed3, constants.%custom_witness.955, constants.%custom_witness.1f5, constants.%custom_witness.ef8, constants.%custom_witness.981, constants.%custom_witness.444) [concrete = constants.%facet_value.cd6] +// CHECK:STDOUT: %.loc49_19.1: %CppRangeForIterate_where.type = converted constants.%MutableRange, %facet_value.loc49_19.1 [concrete = constants.%facet_value.cd6] +// CHECK:STDOUT: %facet_value.loc49_19.2: %CppRangeForIterate_where.type = facet_value constants.%MutableRange, (constants.%custom_witness.df9cc1.2, constants.%Copy.impl_witness.0e0, constants.%custom_witness.ed3, constants.%custom_witness.955, constants.%custom_witness.1f5, constants.%custom_witness.ef8, constants.%custom_witness.981, constants.%custom_witness.444) [concrete = constants.%facet_value.cd6] +// CHECK:STDOUT: %.loc49_19.2: %CppRangeForIterate_where.type = converted constants.%MutableRange, %facet_value.loc49_19.2 [concrete = constants.%facet_value.cd6] +// CHECK:STDOUT: %specific_fn.loc49_19.1: = specific_function %impl.elem2.loc49, @R.as_type.as.Iterate.impl.NewCursor(constants.%facet_value.cd6) [concrete = constants.%R.as_type.as.Iterate.impl.NewCursor.specific_fn.bf1] +// CHECK:STDOUT: %bound_method.loc49_19.2: = bound_method %m.ref, %specific_fn.loc49_19.1 +// CHECK:STDOUT: %var.loc49: ref %tuple.type.508 = var invalid +// CHECK:STDOUT: %.loc49_18.1: %MutableRange = acquire_value %m.ref +// CHECK:STDOUT: %R.as_type.as.Iterate.impl.NewCursor.call.loc49: init %tuple.type.508 to %var.loc49 = call %bound_method.loc49_19.2(%.loc49_18.1) +// CHECK:STDOUT: assign %var.loc49, %R.as_type.as.Iterate.impl.NewCursor.call.loc49 +// CHECK:STDOUT: br !for.next.loc49 +// CHECK:STDOUT: +// CHECK:STDOUT: !for.next.loc49: +// CHECK:STDOUT: %addr.loc49: %ptr.45c = addr_of %var.loc49 +// CHECK:STDOUT: %impl.elem3.loc49: %.d23 = impl_witness_access constants.%Iterate.impl_witness.cea, element3 [concrete = constants.%R.as_type.as.Iterate.impl.Next.34d] +// CHECK:STDOUT: %bound_method.loc49_19.3: = bound_method %m.ref, %impl.elem3.loc49 +// CHECK:STDOUT: %facet_value.loc49_19.3: %CppRangeForIterate_where.type = facet_value constants.%MutableRange, (constants.%custom_witness.df9cc1.2, constants.%Copy.impl_witness.0e0, constants.%custom_witness.ed3, constants.%custom_witness.955, constants.%custom_witness.1f5, constants.%custom_witness.ef8, constants.%custom_witness.981, constants.%custom_witness.444) [concrete = constants.%facet_value.cd6] +// CHECK:STDOUT: %.loc49_19.3: %CppRangeForIterate_where.type = converted constants.%MutableRange, %facet_value.loc49_19.3 [concrete = constants.%facet_value.cd6] +// CHECK:STDOUT: %facet_value.loc49_19.4: %CppRangeForIterate_where.type = facet_value constants.%MutableRange, (constants.%custom_witness.df9cc1.2, constants.%Copy.impl_witness.0e0, constants.%custom_witness.ed3, constants.%custom_witness.955, constants.%custom_witness.1f5, constants.%custom_witness.ef8, constants.%custom_witness.981, constants.%custom_witness.444) [concrete = constants.%facet_value.cd6] +// CHECK:STDOUT: %.loc49_19.4: %CppRangeForIterate_where.type = converted constants.%MutableRange, %facet_value.loc49_19.4 [concrete = constants.%facet_value.cd6] +// CHECK:STDOUT: %specific_fn.loc49_19.2: = specific_function %impl.elem3.loc49, @R.as_type.as.Iterate.impl.Next(constants.%facet_value.cd6) [concrete = constants.%R.as_type.as.Iterate.impl.Next.specific_fn.dd5] +// CHECK:STDOUT: %bound_method.loc49_19.4: = bound_method %m.ref, %specific_fn.loc49_19.2 +// CHECK:STDOUT: %.loc49_19.5: ref %Optional.e28 = temporary_storage +// CHECK:STDOUT: %.loc49_18.2: %MutableRange = acquire_value %m.ref +// CHECK:STDOUT: %R.as_type.as.Iterate.impl.Next.call.loc49: init %Optional.e28 to %.loc49_19.5 = call %bound_method.loc49_19.4(%.loc49_18.2, %addr.loc49) +// CHECK:STDOUT: %.loc49_19.6: ref %Optional.e28 = temporary %.loc49_19.5, %R.as_type.as.Iterate.impl.Next.call.loc49 +// CHECK:STDOUT: %.loc49_19.7: %Optional.HasValue.type.c6d = specific_constant imports.%Core.import_ref.bb6, @Optional(constants.%OptionalStorage.facet.172) [concrete = constants.%Optional.HasValue.89b] +// CHECK:STDOUT: %HasValue.ref.loc49: %Optional.HasValue.type.c6d = name_ref HasValue, %.loc49_19.7 [concrete = constants.%Optional.HasValue.89b] +// CHECK:STDOUT: %Optional.HasValue.bound.loc49: = bound_method %.loc49_19.6, %HasValue.ref.loc49 +// CHECK:STDOUT: %Optional.HasValue.specific_fn.loc49: = specific_function %HasValue.ref.loc49, @Optional.HasValue(constants.%OptionalStorage.facet.172) [concrete = constants.%Optional.HasValue.specific_fn] +// CHECK:STDOUT: %bound_method.loc49_19.5: = bound_method %.loc49_19.6, %Optional.HasValue.specific_fn.loc49 +// CHECK:STDOUT: %.loc49_19.8: %Optional.e28 = acquire_value %.loc49_19.6 +// CHECK:STDOUT: %Optional.HasValue.call.loc49: init bool = call %bound_method.loc49_19.5(%.loc49_19.8) +// CHECK:STDOUT: %.loc49_19.9: bool = value_of_initializer %Optional.HasValue.call.loc49 +// CHECK:STDOUT: %.loc49_19.10: bool = converted %Optional.HasValue.call.loc49, %.loc49_19.9 +// CHECK:STDOUT: if %.loc49_19.10 br !for.body.loc49 else br !for.done.loc49 +// CHECK:STDOUT: +// CHECK:STDOUT: !for.body.loc49: +// CHECK:STDOUT: %.loc49_19.11: %Optional.Get.type.7e6 = specific_constant imports.%Core.import_ref.daba, @Optional(constants.%OptionalStorage.facet.172) [concrete = constants.%Optional.Get.722] +// CHECK:STDOUT: %Get.ref.loc49: %Optional.Get.type.7e6 = name_ref Get, %.loc49_19.11 [concrete = constants.%Optional.Get.722] +// CHECK:STDOUT: %Optional.Get.bound.loc49: = bound_method %.loc49_19.6, %Get.ref.loc49 +// CHECK:STDOUT: %Optional.Get.specific_fn.loc49: = specific_function %Get.ref.loc49, @Optional.Get(constants.%OptionalStorage.facet.172) [concrete = constants.%Optional.Get.specific_fn] +// CHECK:STDOUT: %bound_method.loc49_19.6: = bound_method %.loc49_19.6, %Optional.Get.specific_fn.loc49 +// CHECK:STDOUT: %.loc49_19.12: %Optional.e28 = acquire_value %.loc49_19.6 +// CHECK:STDOUT: %Optional.Get.call.loc49: init %i32 = call %bound_method.loc49_19.6(%.loc49_19.12) +// CHECK:STDOUT: %.loc49_19.13: %i32 = value_of_initializer %Optional.Get.call.loc49 +// CHECK:STDOUT: %.loc49_19.14: %i32 = converted %Optional.Get.call.loc49, %.loc49_19.13 +// CHECK:STDOUT: %i32.loc49: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i.loc49: %i32 = value_binding i, %.loc49_19.14 +// CHECK:STDOUT: %sum.ref.loc50: ref %i32 = name_ref sum, %sum +// CHECK:STDOUT: %i.ref.loc50: %i32 = name_ref i, %i.loc49 +// CHECK:STDOUT: %impl.elem0.loc50: %.b28 = impl_witness_access constants.%AddAssignWith.impl_witness.22e, element0 [concrete = constants.%Int.as.AddAssignWith.impl.Op.00e760.2] +// CHECK:STDOUT: %bound_method.loc50_9.1: = bound_method %sum.ref.loc50, %impl.elem0.loc50 +// CHECK:STDOUT: %specific_fn.loc50: = specific_function %impl.elem0.loc50, @Int.as.AddAssignWith.impl.Op.1(constants.%int_32, constants.%ImplicitAs.facet.eaa) [concrete = constants.%Int.as.AddAssignWith.impl.Op.specific_fn.b14d9d.1] +// CHECK:STDOUT: %bound_method.loc50_9.2: = bound_method %sum.ref.loc50, %specific_fn.loc50 +// CHECK:STDOUT: %.loc50: %Int.as.AddAssignWith.impl.Op.type.73460a.1 = specific_constant imports.%Core.Op.1b1, @Int.as.AddAssignWith.impl(constants.%int_32, constants.%ImplicitAs.facet.eaa) [concrete = constants.%Int.as.AddAssignWith.impl.Op.00e760.1] +// CHECK:STDOUT: %Op.ref.loc50: %Int.as.AddAssignWith.impl.Op.type.73460a.1 = name_ref Op, %.loc50 [concrete = constants.%Int.as.AddAssignWith.impl.Op.00e760.1] +// CHECK:STDOUT: %Int.as.AddAssignWith.impl.Op.bound.loc50: = bound_method %sum.ref.loc50, %Op.ref.loc50 +// CHECK:STDOUT: %Int.as.AddAssignWith.impl.Op.specific_fn.loc50: = specific_function %Op.ref.loc50, @Int.as.AddAssignWith.impl.Op.2(constants.%int_32, constants.%ImplicitAs.facet.eaa) [concrete = constants.%Int.as.AddAssignWith.impl.Op.specific_fn.b14d9d.2] +// CHECK:STDOUT: %bound_method.loc50_9.3: = bound_method %sum.ref.loc50, %Int.as.AddAssignWith.impl.Op.specific_fn.loc50 +// CHECK:STDOUT: %Int.as.AddAssignWith.impl.Op.call.loc50: init %empty_tuple.type = call %bound_method.loc50_9.3(%sum.ref.loc50, %i.ref.loc50) +// CHECK:STDOUT: br !for.next.loc49 +// CHECK:STDOUT: +// CHECK:STDOUT: !for.done.loc49: +// CHECK:STDOUT: name_binding_decl { +// CHECK:STDOUT: %i.patt.loc55: %pattern_type.6b6 = value_binding_pattern i [concrete = constants.%i.patt] +// CHECK:STDOUT: } +// CHECK:STDOUT: %c.ref: %ConstRange = name_ref c, %c +// CHECK:STDOUT: %impl.elem2.loc55: %.744 = impl_witness_access constants.%Iterate.impl_witness.12a, element2 [concrete = constants.%R.as_type.as.Iterate.impl.NewCursor.2f6] +// CHECK:STDOUT: %bound_method.loc55_19.1: = bound_method %c.ref, %impl.elem2.loc55 +// CHECK:STDOUT: %facet_value.loc55_19.1: %CppRangeForIterate_where.type = facet_value constants.%ConstRange, (constants.%custom_witness.df9cc1.2, constants.%Copy.impl_witness.0e0, constants.%custom_witness.23e, constants.%custom_witness.6e8, constants.%custom_witness.150, constants.%custom_witness.adb, constants.%custom_witness.941, constants.%custom_witness.746) [concrete = constants.%facet_value.e88] +// CHECK:STDOUT: %.loc55_19.1: %CppRangeForIterate_where.type = converted constants.%ConstRange, %facet_value.loc55_19.1 [concrete = constants.%facet_value.e88] +// CHECK:STDOUT: %facet_value.loc55_19.2: %CppRangeForIterate_where.type = facet_value constants.%ConstRange, (constants.%custom_witness.df9cc1.2, constants.%Copy.impl_witness.0e0, constants.%custom_witness.23e, constants.%custom_witness.6e8, constants.%custom_witness.150, constants.%custom_witness.adb, constants.%custom_witness.941, constants.%custom_witness.746) [concrete = constants.%facet_value.e88] +// CHECK:STDOUT: %.loc55_19.2: %CppRangeForIterate_where.type = converted constants.%ConstRange, %facet_value.loc55_19.2 [concrete = constants.%facet_value.e88] +// CHECK:STDOUT: %specific_fn.loc55_19.1: = specific_function %impl.elem2.loc55, @R.as_type.as.Iterate.impl.NewCursor(constants.%facet_value.e88) [concrete = constants.%R.as_type.as.Iterate.impl.NewCursor.specific_fn.a05] +// CHECK:STDOUT: %bound_method.loc55_19.2: = bound_method %c.ref, %specific_fn.loc55_19.1 +// CHECK:STDOUT: %var.loc55: ref %tuple.type.69f = var invalid +// CHECK:STDOUT: %R.as_type.as.Iterate.impl.NewCursor.call.loc55: init %tuple.type.69f to %var.loc55 = call %bound_method.loc55_19.2(%c.ref) +// CHECK:STDOUT: assign %var.loc55, %R.as_type.as.Iterate.impl.NewCursor.call.loc55 +// CHECK:STDOUT: br !for.next.loc55 +// CHECK:STDOUT: +// CHECK:STDOUT: !for.next.loc55: +// CHECK:STDOUT: %addr.loc55: %ptr.c5c = addr_of %var.loc55 +// CHECK:STDOUT: %impl.elem3.loc55: %.03b = impl_witness_access constants.%Iterate.impl_witness.12a, element3 [concrete = constants.%R.as_type.as.Iterate.impl.Next.393] +// CHECK:STDOUT: %bound_method.loc55_19.3: = bound_method %c.ref, %impl.elem3.loc55 +// CHECK:STDOUT: %facet_value.loc55_19.3: %CppRangeForIterate_where.type = facet_value constants.%ConstRange, (constants.%custom_witness.df9cc1.2, constants.%Copy.impl_witness.0e0, constants.%custom_witness.23e, constants.%custom_witness.6e8, constants.%custom_witness.150, constants.%custom_witness.adb, constants.%custom_witness.941, constants.%custom_witness.746) [concrete = constants.%facet_value.e88] +// CHECK:STDOUT: %.loc55_19.3: %CppRangeForIterate_where.type = converted constants.%ConstRange, %facet_value.loc55_19.3 [concrete = constants.%facet_value.e88] +// CHECK:STDOUT: %facet_value.loc55_19.4: %CppRangeForIterate_where.type = facet_value constants.%ConstRange, (constants.%custom_witness.df9cc1.2, constants.%Copy.impl_witness.0e0, constants.%custom_witness.23e, constants.%custom_witness.6e8, constants.%custom_witness.150, constants.%custom_witness.adb, constants.%custom_witness.941, constants.%custom_witness.746) [concrete = constants.%facet_value.e88] +// CHECK:STDOUT: %.loc55_19.4: %CppRangeForIterate_where.type = converted constants.%ConstRange, %facet_value.loc55_19.4 [concrete = constants.%facet_value.e88] +// CHECK:STDOUT: %specific_fn.loc55_19.2: = specific_function %impl.elem3.loc55, @R.as_type.as.Iterate.impl.Next(constants.%facet_value.e88) [concrete = constants.%R.as_type.as.Iterate.impl.Next.specific_fn.4cc] +// CHECK:STDOUT: %bound_method.loc55_19.4: = bound_method %c.ref, %specific_fn.loc55_19.2 +// CHECK:STDOUT: %.loc55_19.5: ref %Optional.e28 = temporary_storage +// CHECK:STDOUT: %R.as_type.as.Iterate.impl.Next.call.loc55: init %Optional.e28 to %.loc55_19.5 = call %bound_method.loc55_19.4(%c.ref, %addr.loc55) +// CHECK:STDOUT: %.loc55_19.6: ref %Optional.e28 = temporary %.loc55_19.5, %R.as_type.as.Iterate.impl.Next.call.loc55 +// CHECK:STDOUT: %.loc55_19.7: %Optional.HasValue.type.c6d = specific_constant imports.%Core.import_ref.bb6, @Optional(constants.%OptionalStorage.facet.172) [concrete = constants.%Optional.HasValue.89b] +// CHECK:STDOUT: %HasValue.ref.loc55: %Optional.HasValue.type.c6d = name_ref HasValue, %.loc55_19.7 [concrete = constants.%Optional.HasValue.89b] +// CHECK:STDOUT: %Optional.HasValue.bound.loc55: = bound_method %.loc55_19.6, %HasValue.ref.loc55 +// CHECK:STDOUT: %Optional.HasValue.specific_fn.loc55: = specific_function %HasValue.ref.loc55, @Optional.HasValue(constants.%OptionalStorage.facet.172) [concrete = constants.%Optional.HasValue.specific_fn] +// CHECK:STDOUT: %bound_method.loc55_19.5: = bound_method %.loc55_19.6, %Optional.HasValue.specific_fn.loc55 +// CHECK:STDOUT: %.loc55_19.8: %Optional.e28 = acquire_value %.loc55_19.6 +// CHECK:STDOUT: %Optional.HasValue.call.loc55: init bool = call %bound_method.loc55_19.5(%.loc55_19.8) +// CHECK:STDOUT: %.loc55_19.9: bool = value_of_initializer %Optional.HasValue.call.loc55 +// CHECK:STDOUT: %.loc55_19.10: bool = converted %Optional.HasValue.call.loc55, %.loc55_19.9 +// CHECK:STDOUT: if %.loc55_19.10 br !for.body.loc55 else br !for.done.loc55 +// CHECK:STDOUT: +// CHECK:STDOUT: !for.body.loc55: +// CHECK:STDOUT: %.loc55_19.11: %Optional.Get.type.7e6 = specific_constant imports.%Core.import_ref.daba, @Optional(constants.%OptionalStorage.facet.172) [concrete = constants.%Optional.Get.722] +// CHECK:STDOUT: %Get.ref.loc55: %Optional.Get.type.7e6 = name_ref Get, %.loc55_19.11 [concrete = constants.%Optional.Get.722] +// CHECK:STDOUT: %Optional.Get.bound.loc55: = bound_method %.loc55_19.6, %Get.ref.loc55 +// CHECK:STDOUT: %Optional.Get.specific_fn.loc55: = specific_function %Get.ref.loc55, @Optional.Get(constants.%OptionalStorage.facet.172) [concrete = constants.%Optional.Get.specific_fn] +// CHECK:STDOUT: %bound_method.loc55_19.6: = bound_method %.loc55_19.6, %Optional.Get.specific_fn.loc55 +// CHECK:STDOUT: %.loc55_19.12: %Optional.e28 = acquire_value %.loc55_19.6 +// CHECK:STDOUT: %Optional.Get.call.loc55: init %i32 = call %bound_method.loc55_19.6(%.loc55_19.12) +// CHECK:STDOUT: %.loc55_19.13: %i32 = value_of_initializer %Optional.Get.call.loc55 +// CHECK:STDOUT: %.loc55_19.14: %i32 = converted %Optional.Get.call.loc55, %.loc55_19.13 +// CHECK:STDOUT: %i32.loc55: type = type_literal constants.%i32 [concrete = constants.%i32] +// CHECK:STDOUT: %i.loc55: %i32 = value_binding i, %.loc55_19.14 +// CHECK:STDOUT: %sum.ref.loc56: ref %i32 = name_ref sum, %sum +// CHECK:STDOUT: %i.ref.loc56: %i32 = name_ref i, %i.loc55 +// CHECK:STDOUT: %impl.elem0.loc56: %.b28 = impl_witness_access constants.%AddAssignWith.impl_witness.22e, element0 [concrete = constants.%Int.as.AddAssignWith.impl.Op.00e760.2] +// CHECK:STDOUT: %bound_method.loc56_9.1: = bound_method %sum.ref.loc56, %impl.elem0.loc56 +// CHECK:STDOUT: %specific_fn.loc56: = specific_function %impl.elem0.loc56, @Int.as.AddAssignWith.impl.Op.1(constants.%int_32, constants.%ImplicitAs.facet.eaa) [concrete = constants.%Int.as.AddAssignWith.impl.Op.specific_fn.b14d9d.1] +// CHECK:STDOUT: %bound_method.loc56_9.2: = bound_method %sum.ref.loc56, %specific_fn.loc56 +// CHECK:STDOUT: %.loc56: %Int.as.AddAssignWith.impl.Op.type.73460a.1 = specific_constant imports.%Core.Op.1b1, @Int.as.AddAssignWith.impl(constants.%int_32, constants.%ImplicitAs.facet.eaa) [concrete = constants.%Int.as.AddAssignWith.impl.Op.00e760.1] +// CHECK:STDOUT: %Op.ref.loc56: %Int.as.AddAssignWith.impl.Op.type.73460a.1 = name_ref Op, %.loc56 [concrete = constants.%Int.as.AddAssignWith.impl.Op.00e760.1] +// CHECK:STDOUT: %Int.as.AddAssignWith.impl.Op.bound.loc56: = bound_method %sum.ref.loc56, %Op.ref.loc56 +// CHECK:STDOUT: %Int.as.AddAssignWith.impl.Op.specific_fn.loc56: = specific_function %Op.ref.loc56, @Int.as.AddAssignWith.impl.Op.2(constants.%int_32, constants.%ImplicitAs.facet.eaa) [concrete = constants.%Int.as.AddAssignWith.impl.Op.specific_fn.b14d9d.2] +// CHECK:STDOUT: %bound_method.loc56_9.3: = bound_method %sum.ref.loc56, %Int.as.AddAssignWith.impl.Op.specific_fn.loc56 +// CHECK:STDOUT: %Int.as.AddAssignWith.impl.Op.call.loc56: init %empty_tuple.type = call %bound_method.loc56_9.3(%sum.ref.loc56, %i.ref.loc56) +// CHECK:STDOUT: br !for.next.loc55 +// CHECK:STDOUT: +// CHECK:STDOUT: !for.done.loc55: +// CHECK:STDOUT: %Destroy.Op.bound.loc55_19.1: = bound_method %.loc55_19.6, constants.%Destroy.Op.1a2547.9 +// CHECK:STDOUT: %Destroy.Op.call.loc55_19.1: init %empty_tuple.type = call %Destroy.Op.bound.loc55_19.1(%.loc55_19.6) +// CHECK:STDOUT: %Destroy.Op.bound.loc55_19.2: = bound_method %var.loc55, constants.%Destroy.Op.1a2547.11 +// CHECK:STDOUT: %Destroy.Op.call.loc55_19.2: init %empty_tuple.type = call %Destroy.Op.bound.loc55_19.2(%var.loc55) +// CHECK:STDOUT: %Destroy.Op.bound.loc49_19.1: = bound_method %.loc49_19.6, constants.%Destroy.Op.1a2547.9 +// CHECK:STDOUT: %Destroy.Op.call.loc49_19.1: init %empty_tuple.type = call %Destroy.Op.bound.loc49_19.1(%.loc49_19.6) +// CHECK:STDOUT: %Destroy.Op.bound.loc49_19.2: = bound_method %var.loc49, constants.%Destroy.Op.1a2547.10 +// CHECK:STDOUT: %Destroy.Op.call.loc49_19.2: init %empty_tuple.type = call %Destroy.Op.bound.loc49_19.2(%var.loc49) +// CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Test(constants.%facet_value.879) { -// CHECK:STDOUT: %R.patt.loc30_10.2 => constants.%R.patt.860 -// CHECK:STDOUT: %R.loc30_10.1 => constants.%facet_value.879 -// CHECK:STDOUT: %R.as_type.loc30_55.1 => constants.%MutableRange +// CHECK:STDOUT: specific @TestIterate(constants.%R.891) { +// CHECK:STDOUT: %R.patt.loc30_17.2 => constants.%R.patt.860 +// CHECK:STDOUT: %R.loc30_17.1 => constants.%R.891 +// CHECK:STDOUT: %R.as_type.loc30_62.1 => constants.%R.as_type.67d +// CHECK:STDOUT: %pattern_type => constants.%pattern_type.e21 +// CHECK:STDOUT: %r.param_patt.loc30_60.2 => constants.%r.param_patt.fdd +// CHECK:STDOUT: %r.patt.loc30_60.2 => constants.%r.patt.939 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @TestIterate(constants.%facet_value.879) { +// CHECK:STDOUT: %R.patt.loc30_17.2 => constants.%R.patt.860 +// CHECK:STDOUT: %R.loc30_17.1 => constants.%facet_value.879 +// CHECK:STDOUT: %R.as_type.loc30_62.1 => constants.%MutableRange // CHECK:STDOUT: %pattern_type => constants.%pattern_type.e635 -// CHECK:STDOUT: %r.param_patt.loc30_53.2 => constants.%r.param_patt.c79 -// CHECK:STDOUT: %r.patt.loc30_53.2 => constants.%r.patt.16f +// CHECK:STDOUT: %r.param_patt.loc30_60.2 => constants.%r.param_patt.c79 +// CHECK:STDOUT: %r.patt.loc30_60.2 => constants.%r.patt.16f // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete.loc30 => constants.%complete_type.357 @@ -1069,13 +1307,13 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %specific_impl_fn.loc34_19.6 => constants.%Destroy.Op.1a2547.10 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Test(constants.%facet_value.740) { -// CHECK:STDOUT: %R.patt.loc30_10.2 => constants.%R.patt.860 -// CHECK:STDOUT: %R.loc30_10.1 => constants.%facet_value.740 -// CHECK:STDOUT: %R.as_type.loc30_55.1 => constants.%ConstRange +// CHECK:STDOUT: specific @TestIterate(constants.%facet_value.740) { +// CHECK:STDOUT: %R.patt.loc30_17.2 => constants.%R.patt.860 +// CHECK:STDOUT: %R.loc30_17.1 => constants.%facet_value.740 +// CHECK:STDOUT: %R.as_type.loc30_62.1 => constants.%ConstRange // CHECK:STDOUT: %pattern_type => constants.%pattern_type.0ba -// CHECK:STDOUT: %r.param_patt.loc30_53.2 => constants.%r.param_patt.83e -// CHECK:STDOUT: %r.patt.loc30_53.2 => constants.%r.patt.116 +// CHECK:STDOUT: %r.param_patt.loc30_60.2 => constants.%r.param_patt.83e +// CHECK:STDOUT: %r.patt.loc30_60.2 => constants.%r.patt.116 // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete.loc30 => constants.%complete_type.357 @@ -1306,25 +1544,25 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %r.patt.36a: %pattern_type.0ba = ref_binding_pattern r [concrete] // CHECK:STDOUT: %r.param_patt.501: %pattern_type.0ba = var_param_pattern %r.patt.36a [concrete] // CHECK:STDOUT: %Iterate.WithSelf.NewCursor.type.47d: type = fn_type @Iterate.WithSelf.NewCursor, @Iterate.WithSelf(%Iterate.facet.723) [concrete] +// CHECK:STDOUT: %Iterate.WithSelf.Next.type.6f1: type = fn_type @Iterate.WithSelf.Next, @Iterate.WithSelf(%Iterate.facet.723) [concrete] // CHECK:STDOUT: %.47d: type = fn_type_with_self_type %Iterate.WithSelf.NewCursor.type.47d, %Iterate.facet.723 [concrete] // CHECK:STDOUT: %R.as_type.as.Iterate.impl.NewCursor.specific_fn.532: = specific_function %R.as_type.as.Iterate.impl.NewCursor.498, @R.as_type.as.Iterate.impl.NewCursor(%facet_value.55a) [concrete] -// CHECK:STDOUT: %complete_type.94f: = complete_type_witness %tuple.type.829 [concrete] // CHECK:STDOUT: %ptr.d6b: type = ptr_type %tuple.type.829 [concrete] -// CHECK:STDOUT: %Iterate.WithSelf.Next.type.6f1: type = fn_type @Iterate.WithSelf.Next, @Iterate.WithSelf(%Iterate.facet.723) [concrete] // CHECK:STDOUT: %.fd2: type = fn_type_with_self_type %Iterate.WithSelf.Next.type.6f1, %Iterate.facet.723 [concrete] // CHECK:STDOUT: %R.as_type.as.Iterate.impl.Next.specific_fn.5cb: = specific_function %R.as_type.as.Iterate.impl.Next.055, @R.as_type.as.Iterate.impl.Next(%facet_value.55a) [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.c89: type = fn_type @Destroy.WithSelf.Op, @Destroy.WithSelf(%Destroy.facet.305) [concrete] -// CHECK:STDOUT: %.e8a: type = fn_type_with_self_type %Destroy.WithSelf.Op.type.c89, %Destroy.facet.305 [concrete] // CHECK:STDOUT: %Iterate.WithSelf.NewCursor.type.cd5: type = fn_type @Iterate.WithSelf.NewCursor, @Iterate.WithSelf(%Iterate.facet.c46) [concrete] +// CHECK:STDOUT: %Iterate.WithSelf.Next.type.285: type = fn_type @Iterate.WithSelf.Next, @Iterate.WithSelf(%Iterate.facet.c46) [concrete] // CHECK:STDOUT: %.763: type = fn_type_with_self_type %Iterate.WithSelf.NewCursor.type.cd5, %Iterate.facet.c46 [concrete] // CHECK:STDOUT: %R.as_type.as.Iterate.impl.NewCursor.specific_fn.7c7: = specific_function %R.as_type.as.Iterate.impl.NewCursor.bd2, @R.as_type.as.Iterate.impl.NewCursor(%facet_value.445) [concrete] -// CHECK:STDOUT: %complete_type.dea: = complete_type_witness %tuple.type.99f [concrete] // CHECK:STDOUT: %ptr.2f7: type = ptr_type %tuple.type.99f [concrete] -// CHECK:STDOUT: %Iterate.WithSelf.Next.type.285: type = fn_type @Iterate.WithSelf.Next, @Iterate.WithSelf(%Iterate.facet.c46) [concrete] // CHECK:STDOUT: %.bca: type = fn_type_with_self_type %Iterate.WithSelf.Next.type.285, %Iterate.facet.c46 [concrete] // CHECK:STDOUT: %R.as_type.as.Iterate.impl.Next.specific_fn.a9a: = specific_function %R.as_type.as.Iterate.impl.Next.c50, @R.as_type.as.Iterate.impl.Next(%facet_value.445) [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.type.e30: type = fn_type @Destroy.WithSelf.Op, @Destroy.WithSelf(%Destroy.facet.e08) [concrete] // CHECK:STDOUT: %.987: type = fn_type_with_self_type %Destroy.WithSelf.Op.type.e30, %Destroy.facet.e08 [concrete] +// CHECK:STDOUT: %Destroy.WithSelf.Op.type.c89: type = fn_type @Destroy.WithSelf.Op, @Destroy.WithSelf(%Destroy.facet.305) [concrete] +// CHECK:STDOUT: %.e8a: type = fn_type_with_self_type %Destroy.WithSelf.Op.type.c89, %Destroy.facet.305 [concrete] +// CHECK:STDOUT: %complete_type.94f: = complete_type_witness %tuple.type.829 [concrete] +// CHECK:STDOUT: %complete_type.dea: = complete_type_witness %tuple.type.99f [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -1363,37 +1601,37 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %ConstRange.decl: type = class_decl @ConstRange [concrete = constants.%ConstRange] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Test(%R.loc40_10.2: %Iterate_where.type.dfc) { +// CHECK:STDOUT: generic fn @TestIterate(%R.loc40_17.2: %Iterate_where.type.dfc) { // CHECK:STDOUT: // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: -// CHECK:STDOUT: %Iterate.lookup_impl_witness: = lookup_impl_witness %R.loc40_10.1, @Iterate [symbolic = %Iterate.lookup_impl_witness (constants.%Iterate.lookup_impl_witness.acc)] -// CHECK:STDOUT: %Iterate.facet.loc44_29.5: %Iterate.type = facet_value %R.as_type.loc40_69.1, (%Iterate.lookup_impl_witness) [symbolic = %Iterate.facet.loc44_29.5 (constants.%Iterate.facet.b95)] +// CHECK:STDOUT: %Iterate.lookup_impl_witness: = lookup_impl_witness %R.loc40_17.1, @Iterate [symbolic = %Iterate.lookup_impl_witness (constants.%Iterate.lookup_impl_witness.acc)] +// CHECK:STDOUT: %Iterate.facet.loc44_29.5: %Iterate.type = facet_value %R.as_type.loc40_76.1, (%Iterate.lookup_impl_witness) [symbolic = %Iterate.facet.loc44_29.5 (constants.%Iterate.facet.b95)] // CHECK:STDOUT: %Iterate.WithSelf.NewCursor.type: type = fn_type @Iterate.WithSelf.NewCursor, @Iterate.WithSelf(%Iterate.facet.loc44_29.5) [symbolic = %Iterate.WithSelf.NewCursor.type (constants.%Iterate.WithSelf.NewCursor.type.d69)] // CHECK:STDOUT: %.loc44_29.20: type = fn_type_with_self_type %Iterate.WithSelf.NewCursor.type, %Iterate.facet.loc44_29.5 [symbolic = %.loc44_29.20 (constants.%.f8a)] -// CHECK:STDOUT: %impl.elem2.loc44_29.2: @Test.%.loc44_29.20 (%.f8a) = impl_witness_access %Iterate.lookup_impl_witness, element2 [symbolic = %impl.elem2.loc44_29.2 (constants.%impl.elem2.398)] +// CHECK:STDOUT: %impl.elem2.loc44_29.2: @TestIterate.%.loc44_29.20 (%.f8a) = impl_witness_access %Iterate.lookup_impl_witness, element2 [symbolic = %impl.elem2.loc44_29.2 (constants.%impl.elem2.398)] // CHECK:STDOUT: %specific_impl_fn.loc44_29.4: = specific_impl_function %impl.elem2.loc44_29.2, @Iterate.WithSelf.NewCursor(%Iterate.facet.loc44_29.5) [symbolic = %specific_impl_fn.loc44_29.4 (constants.%specific_impl_fn.544)] // CHECK:STDOUT: // CHECK:STDOUT: %ptr: type = ptr_type %as_type [symbolic = %ptr (constants.%ptr.bdd)] // CHECK:STDOUT: %Iterate.WithSelf.Next.type: type = fn_type @Iterate.WithSelf.Next, @Iterate.WithSelf(%Iterate.facet.loc44_29.5) [symbolic = %Iterate.WithSelf.Next.type (constants.%Iterate.WithSelf.Next.type.d6f)] // CHECK:STDOUT: %.loc44_29.21: type = fn_type_with_self_type %Iterate.WithSelf.Next.type, %Iterate.facet.loc44_29.5 [symbolic = %.loc44_29.21 (constants.%.52a)] -// CHECK:STDOUT: %impl.elem3.loc44_29.2: @Test.%.loc44_29.21 (%.52a) = impl_witness_access %Iterate.lookup_impl_witness, element3 [symbolic = %impl.elem3.loc44_29.2 (constants.%impl.elem3.510)] +// CHECK:STDOUT: %impl.elem3.loc44_29.2: @TestIterate.%.loc44_29.21 (%.52a) = impl_witness_access %Iterate.lookup_impl_witness, element3 [symbolic = %impl.elem3.loc44_29.2 (constants.%impl.elem3.510)] // CHECK:STDOUT: %specific_impl_fn.loc44_29.5: = specific_impl_function %impl.elem3.loc44_29.2, @Iterate.WithSelf.Next(%Iterate.facet.loc44_29.5) [symbolic = %specific_impl_fn.loc44_29.5 (constants.%specific_impl_fn.a00)] // CHECK:STDOUT: %Destroy.WithSelf.Op.type: type = fn_type @Destroy.WithSelf.Op, @Destroy.WithSelf(%impl.elem1) [symbolic = %Destroy.WithSelf.Op.type (constants.%Destroy.WithSelf.Op.type.d67)] // CHECK:STDOUT: %.loc44_29.22: type = fn_type_with_self_type %Destroy.WithSelf.Op.type, %impl.elem1 [symbolic = %.loc44_29.22 (constants.%.4b9)] // CHECK:STDOUT: %Destroy.lookup_impl_witness: = lookup_impl_witness %impl.elem1, @Destroy [symbolic = %Destroy.lookup_impl_witness (constants.%Destroy.lookup_impl_witness.ff8)] -// CHECK:STDOUT: %impl.elem0.loc44_29.2: @Test.%.loc44_29.22 (%.4b9) = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc44_29.2 (constants.%impl.elem0.fbe)] +// CHECK:STDOUT: %impl.elem0.loc44_29.2: @TestIterate.%.loc44_29.22 (%.4b9) = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc44_29.2 (constants.%impl.elem0.fbe)] // CHECK:STDOUT: %specific_impl_fn.loc44_29.6: = specific_impl_function %impl.elem0.loc44_29.2, @Destroy.WithSelf.Op(%impl.elem1) [symbolic = %specific_impl_fn.loc44_29.6 (constants.%specific_impl_fn.517)] // CHECK:STDOUT: -// CHECK:STDOUT: fn(%r.param: ref @Test.%R.as_type.loc40_69.1 (%R.as_type.f62)) { +// CHECK:STDOUT: fn(%r.param: ref @TestIterate.%R.as_type.loc40_76.1 (%R.as_type.f62)) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %i.patt: %pattern_type.e9f = value_binding_pattern i [concrete = constants.%i.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %r.ref: ref @Test.%R.as_type.loc40_69.1 (%R.as_type.f62) = name_ref r, %r -// CHECK:STDOUT: %impl.elem2.loc44_29.1: @Test.%.loc44_29.20 (%.f8a) = impl_witness_access constants.%Iterate.lookup_impl_witness.acc, element2 [symbolic = %impl.elem2.loc44_29.2 (constants.%impl.elem2.398)] +// CHECK:STDOUT: %r.ref: ref @TestIterate.%R.as_type.loc40_76.1 (%R.as_type.f62) = name_ref r, %r +// CHECK:STDOUT: %impl.elem2.loc44_29.1: @TestIterate.%.loc44_29.20 (%.f8a) = impl_witness_access constants.%Iterate.lookup_impl_witness.acc, element2 [symbolic = %impl.elem2.loc44_29.2 (constants.%impl.elem2.398)] // CHECK:STDOUT: %bound_method.loc44_29.1: = bound_method %r.ref, %impl.elem2.loc44_29.1 // CHECK:STDOUT: %Iterate.facet.loc44_29.1: %Iterate.type = facet_value constants.%R.as_type.f62, (constants.%Iterate.lookup_impl_witness.acc) [symbolic = %Iterate.facet.loc44_29.5 (constants.%Iterate.facet.b95)] // CHECK:STDOUT: %.loc44_29.1: %Iterate.type = converted constants.%R.as_type.f62, %Iterate.facet.loc44_29.1 [symbolic = %Iterate.facet.loc44_29.5 (constants.%Iterate.facet.b95)] @@ -1401,15 +1639,15 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %.loc44_29.2: %Iterate.type = converted constants.%R.as_type.f62, %Iterate.facet.loc44_29.2 [symbolic = %Iterate.facet.loc44_29.5 (constants.%Iterate.facet.b95)] // CHECK:STDOUT: %specific_impl_fn.loc44_29.1: = specific_impl_function %impl.elem2.loc44_29.1, @Iterate.WithSelf.NewCursor(constants.%Iterate.facet.b95) [symbolic = %specific_impl_fn.loc44_29.4 (constants.%specific_impl_fn.544)] // CHECK:STDOUT: %bound_method.loc44_29.2: = bound_method %r.ref, %specific_impl_fn.loc44_29.1 -// CHECK:STDOUT: %var: ref @Test.%as_type (%as_type.bc6) = var invalid -// CHECK:STDOUT: %.loc44_28.1: @Test.%R.as_type.loc40_69.1 (%R.as_type.f62) = acquire_value %r.ref -// CHECK:STDOUT: %Iterate.WithSelf.NewCursor.call: init @Test.%as_type (%as_type.bc6) to %var = call %bound_method.loc44_29.2(%.loc44_28.1) +// CHECK:STDOUT: %var: ref @TestIterate.%as_type (%as_type.bc6) = var invalid +// CHECK:STDOUT: %.loc44_28.1: @TestIterate.%R.as_type.loc40_76.1 (%R.as_type.f62) = acquire_value %r.ref +// CHECK:STDOUT: %Iterate.WithSelf.NewCursor.call: init @TestIterate.%as_type (%as_type.bc6) to %var = call %bound_method.loc44_29.2(%.loc44_28.1) // CHECK:STDOUT: assign %var, %Iterate.WithSelf.NewCursor.call // CHECK:STDOUT: br !for.next // CHECK:STDOUT: // CHECK:STDOUT: !for.next: -// CHECK:STDOUT: %addr.loc44: @Test.%ptr (%ptr.bdd) = addr_of %var -// CHECK:STDOUT: %impl.elem3.loc44_29.1: @Test.%.loc44_29.21 (%.52a) = impl_witness_access constants.%Iterate.lookup_impl_witness.acc, element3 [symbolic = %impl.elem3.loc44_29.2 (constants.%impl.elem3.510)] +// CHECK:STDOUT: %addr.loc44: @TestIterate.%ptr (%ptr.bdd) = addr_of %var +// CHECK:STDOUT: %impl.elem3.loc44_29.1: @TestIterate.%.loc44_29.21 (%.52a) = impl_witness_access constants.%Iterate.lookup_impl_witness.acc, element3 [symbolic = %impl.elem3.loc44_29.2 (constants.%impl.elem3.510)] // CHECK:STDOUT: %bound_method.loc44_29.3: = bound_method %r.ref, %impl.elem3.loc44_29.1 // CHECK:STDOUT: %Iterate.facet.loc44_29.3: %Iterate.type = facet_value constants.%R.as_type.f62, (constants.%Iterate.lookup_impl_witness.acc) [symbolic = %Iterate.facet.loc44_29.5 (constants.%Iterate.facet.b95)] // CHECK:STDOUT: %.loc44_29.3: %Iterate.type = converted constants.%R.as_type.f62, %Iterate.facet.loc44_29.3 [symbolic = %Iterate.facet.loc44_29.5 (constants.%Iterate.facet.b95)] @@ -1420,7 +1658,7 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %specific_impl_fn.loc44_29.2: = specific_impl_function %impl.elem3.loc44_29.1, @Iterate.WithSelf.Next(constants.%Iterate.facet.b95) [symbolic = %specific_impl_fn.loc44_29.5 (constants.%specific_impl_fn.a00)] // CHECK:STDOUT: %bound_method.loc44_29.4: = bound_method %r.ref, %specific_impl_fn.loc44_29.2 // CHECK:STDOUT: %.loc44_29.7: ref %Optional.95f = temporary_storage -// CHECK:STDOUT: %.loc44_28.2: @Test.%R.as_type.loc40_69.1 (%R.as_type.f62) = acquire_value %r.ref +// CHECK:STDOUT: %.loc44_28.2: @TestIterate.%R.as_type.loc40_76.1 (%R.as_type.f62) = acquire_value %r.ref // CHECK:STDOUT: %Iterate.WithSelf.Next.call: init %Optional.95f to %.loc44_29.7 = call %bound_method.loc44_29.4(%.loc44_28.2, %addr.loc44) // CHECK:STDOUT: %.loc44_29.8: ref %Optional.95f = temporary %.loc44_29.7, %Iterate.WithSelf.Next.call // CHECK:STDOUT: %.loc44_29.9: %Optional.HasValue.type.006 = specific_constant imports.%Core.import_ref.bb6, @Optional(constants.%OptionalStorage.facet.705) [concrete = constants.%Optional.HasValue.988] @@ -1466,7 +1704,7 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %ValueType.cpp_destructor.call.loc44: init %empty_tuple.type = call %ValueType.cpp_destructor.bound.loc44(%.loc44_29.16) // CHECK:STDOUT: %Destroy.Op.bound: = bound_method %.loc44_29.8, constants.%Destroy.Op.1a2547.7 // CHECK:STDOUT: %Destroy.Op.call: init %empty_tuple.type = call %Destroy.Op.bound(%.loc44_29.8) -// CHECK:STDOUT: %impl.elem0.loc44_29.1: @Test.%.loc44_29.22 (%.4b9) = impl_witness_access constants.%Destroy.lookup_impl_witness.ff8, element0 [symbolic = %impl.elem0.loc44_29.2 (constants.%impl.elem0.fbe)] +// CHECK:STDOUT: %impl.elem0.loc44_29.1: @TestIterate.%.loc44_29.22 (%.4b9) = impl_witness_access constants.%Destroy.lookup_impl_witness.ff8, element0 [symbolic = %impl.elem0.loc44_29.2 (constants.%impl.elem0.fbe)] // CHECK:STDOUT: %bound_method.loc44_29.7: = bound_method %var, %impl.elem0.loc44_29.1 // CHECK:STDOUT: %.loc44_29.18: %Destroy.type = converted constants.%as_type.bc6, constants.%impl.elem1.411 [symbolic = %impl.elem1 (constants.%impl.elem1.411)] // CHECK:STDOUT: %.loc44_29.19: %Destroy.type = converted constants.%as_type.bc6, constants.%impl.elem1.411 [symbolic = %impl.elem1 (constants.%impl.elem1.411)] @@ -1504,22 +1742,180 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Test(constants.%R.de1) { -// CHECK:STDOUT: %R.patt.loc40_10.2 => constants.%R.patt.f38 -// CHECK:STDOUT: %R.loc40_10.1 => constants.%R.de1 -// CHECK:STDOUT: %R.as_type.loc40_69.1 => constants.%R.as_type.f62 -// CHECK:STDOUT: %pattern_type => constants.%pattern_type.669 -// CHECK:STDOUT: %r.patt.loc40_67.2 => constants.%r.patt.c0f -// CHECK:STDOUT: %r.param_patt.loc40_62.2 => constants.%r.param_patt.bb2 +// CHECK:STDOUT: fn @TestRangeFor(%m.param: ref %MutableRange, %c.param: %ConstRange) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: +// CHECK:STDOUT: name_binding_decl { +// CHECK:STDOUT: %i.patt.loc59: %pattern_type.e9f = value_binding_pattern i [concrete = constants.%i.patt] +// CHECK:STDOUT: } +// CHECK:STDOUT: %m.ref: ref %MutableRange = name_ref m, %m +// CHECK:STDOUT: %impl.elem2.loc59: %.47d = impl_witness_access constants.%Iterate.impl_witness.096, element2 [concrete = constants.%R.as_type.as.Iterate.impl.NewCursor.498] +// CHECK:STDOUT: %bound_method.loc59_29.1: = bound_method %m.ref, %impl.elem2.loc59 +// CHECK:STDOUT: %facet_value.loc59_29.1: %CppRangeForIterate_where.type = facet_value constants.%MutableRange, (constants.%custom_witness.e7a31c.1, constants.%custom_witness.d0da43.1, constants.%custom_witness.6b6, constants.%custom_witness.95581e.1, constants.%custom_witness.1f52e9.1, constants.%custom_witness.90a, constants.%custom_witness.3e8, constants.%custom_witness.444, constants.%custom_witness.95581e.2, constants.%custom_witness.1f52e9.2) [concrete = constants.%facet_value.55a] +// CHECK:STDOUT: %.loc59_29.1: %CppRangeForIterate_where.type = converted constants.%MutableRange, %facet_value.loc59_29.1 [concrete = constants.%facet_value.55a] +// CHECK:STDOUT: %facet_value.loc59_29.2: %CppRangeForIterate_where.type = facet_value constants.%MutableRange, (constants.%custom_witness.e7a31c.1, constants.%custom_witness.d0da43.1, constants.%custom_witness.6b6, constants.%custom_witness.95581e.1, constants.%custom_witness.1f52e9.1, constants.%custom_witness.90a, constants.%custom_witness.3e8, constants.%custom_witness.444, constants.%custom_witness.95581e.2, constants.%custom_witness.1f52e9.2) [concrete = constants.%facet_value.55a] +// CHECK:STDOUT: %.loc59_29.2: %CppRangeForIterate_where.type = converted constants.%MutableRange, %facet_value.loc59_29.2 [concrete = constants.%facet_value.55a] +// CHECK:STDOUT: %specific_fn.loc59_29.1: = specific_function %impl.elem2.loc59, @R.as_type.as.Iterate.impl.NewCursor(constants.%facet_value.55a) [concrete = constants.%R.as_type.as.Iterate.impl.NewCursor.specific_fn.532] +// CHECK:STDOUT: %bound_method.loc59_29.2: = bound_method %m.ref, %specific_fn.loc59_29.1 +// CHECK:STDOUT: %var.loc59: ref %tuple.type.829 = var invalid +// CHECK:STDOUT: %.loc59_28.1: %MutableRange = acquire_value %m.ref +// CHECK:STDOUT: %R.as_type.as.Iterate.impl.NewCursor.call.loc59: init %tuple.type.829 to %var.loc59 = call %bound_method.loc59_29.2(%.loc59_28.1) +// CHECK:STDOUT: assign %var.loc59, %R.as_type.as.Iterate.impl.NewCursor.call.loc59 +// CHECK:STDOUT: br !for.next.loc59 +// CHECK:STDOUT: +// CHECK:STDOUT: !for.next.loc59: +// CHECK:STDOUT: %addr.loc59: %ptr.d6b = addr_of %var.loc59 +// CHECK:STDOUT: %impl.elem3.loc59: %.fd2 = impl_witness_access constants.%Iterate.impl_witness.096, element3 [concrete = constants.%R.as_type.as.Iterate.impl.Next.055] +// CHECK:STDOUT: %bound_method.loc59_29.3: = bound_method %m.ref, %impl.elem3.loc59 +// CHECK:STDOUT: %facet_value.loc59_29.3: %CppRangeForIterate_where.type = facet_value constants.%MutableRange, (constants.%custom_witness.e7a31c.1, constants.%custom_witness.d0da43.1, constants.%custom_witness.6b6, constants.%custom_witness.95581e.1, constants.%custom_witness.1f52e9.1, constants.%custom_witness.90a, constants.%custom_witness.3e8, constants.%custom_witness.444, constants.%custom_witness.95581e.2, constants.%custom_witness.1f52e9.2) [concrete = constants.%facet_value.55a] +// CHECK:STDOUT: %.loc59_29.3: %CppRangeForIterate_where.type = converted constants.%MutableRange, %facet_value.loc59_29.3 [concrete = constants.%facet_value.55a] +// CHECK:STDOUT: %facet_value.loc59_29.4: %CppRangeForIterate_where.type = facet_value constants.%MutableRange, (constants.%custom_witness.e7a31c.1, constants.%custom_witness.d0da43.1, constants.%custom_witness.6b6, constants.%custom_witness.95581e.1, constants.%custom_witness.1f52e9.1, constants.%custom_witness.90a, constants.%custom_witness.3e8, constants.%custom_witness.444, constants.%custom_witness.95581e.2, constants.%custom_witness.1f52e9.2) [concrete = constants.%facet_value.55a] +// CHECK:STDOUT: %.loc59_29.4: %CppRangeForIterate_where.type = converted constants.%MutableRange, %facet_value.loc59_29.4 [concrete = constants.%facet_value.55a] +// CHECK:STDOUT: %specific_fn.loc59_29.2: = specific_function %impl.elem3.loc59, @R.as_type.as.Iterate.impl.Next(constants.%facet_value.55a) [concrete = constants.%R.as_type.as.Iterate.impl.Next.specific_fn.5cb] +// CHECK:STDOUT: %bound_method.loc59_29.4: = bound_method %m.ref, %specific_fn.loc59_29.2 +// CHECK:STDOUT: %.loc59_29.5: ref %Optional.95f = temporary_storage +// CHECK:STDOUT: %.loc59_28.2: %MutableRange = acquire_value %m.ref +// CHECK:STDOUT: %R.as_type.as.Iterate.impl.Next.call.loc59: init %Optional.95f to %.loc59_29.5 = call %bound_method.loc59_29.4(%.loc59_28.2, %addr.loc59) +// CHECK:STDOUT: %.loc59_29.6: ref %Optional.95f = temporary %.loc59_29.5, %R.as_type.as.Iterate.impl.Next.call.loc59 +// CHECK:STDOUT: %.loc59_29.7: %Optional.HasValue.type.006 = specific_constant imports.%Core.import_ref.bb6, @Optional(constants.%OptionalStorage.facet.705) [concrete = constants.%Optional.HasValue.988] +// CHECK:STDOUT: %HasValue.ref.loc59: %Optional.HasValue.type.006 = name_ref HasValue, %.loc59_29.7 [concrete = constants.%Optional.HasValue.988] +// CHECK:STDOUT: %Optional.HasValue.bound.loc59: = bound_method %.loc59_29.6, %HasValue.ref.loc59 +// CHECK:STDOUT: %Optional.HasValue.specific_fn.loc59: = specific_function %HasValue.ref.loc59, @Optional.HasValue(constants.%OptionalStorage.facet.705) [concrete = constants.%Optional.HasValue.specific_fn] +// CHECK:STDOUT: %bound_method.loc59_29.5: = bound_method %.loc59_29.6, %Optional.HasValue.specific_fn.loc59 +// CHECK:STDOUT: %.loc59_29.8: %Optional.95f = acquire_value %.loc59_29.6 +// CHECK:STDOUT: %Optional.HasValue.call.loc59: init bool = call %bound_method.loc59_29.5(%.loc59_29.8) +// CHECK:STDOUT: %.loc59_29.9: bool = value_of_initializer %Optional.HasValue.call.loc59 +// CHECK:STDOUT: %.loc59_29.10: bool = converted %Optional.HasValue.call.loc59, %.loc59_29.9 +// CHECK:STDOUT: if %.loc59_29.10 br !for.body.loc59 else br !for.done.loc59 +// CHECK:STDOUT: +// CHECK:STDOUT: !for.body.loc59: +// CHECK:STDOUT: %.loc59_29.11: %Optional.Get.type.30f = specific_constant imports.%Core.import_ref.daba, @Optional(constants.%OptionalStorage.facet.705) [concrete = constants.%Optional.Get.59c] +// CHECK:STDOUT: %Get.ref.loc59: %Optional.Get.type.30f = name_ref Get, %.loc59_29.11 [concrete = constants.%Optional.Get.59c] +// CHECK:STDOUT: %Optional.Get.bound.loc59: = bound_method %.loc59_29.6, %Get.ref.loc59 +// CHECK:STDOUT: %Optional.Get.specific_fn.loc59: = specific_function %Get.ref.loc59, @Optional.Get(constants.%OptionalStorage.facet.705) [concrete = constants.%Optional.Get.specific_fn] +// CHECK:STDOUT: %bound_method.loc59_29.6: = bound_method %.loc59_29.6, %Optional.Get.specific_fn.loc59 +// CHECK:STDOUT: %.loc59_29.12: ref %ValueType = temporary_storage +// CHECK:STDOUT: %.loc59_29.13: %Optional.95f = acquire_value %.loc59_29.6 +// CHECK:STDOUT: %Optional.Get.call.loc59: init %ValueType to %.loc59_29.12 = call %bound_method.loc59_29.6(%.loc59_29.13) +// CHECK:STDOUT: %.loc59_29.14: ref %ValueType = temporary %.loc59_29.12, %Optional.Get.call.loc59 +// CHECK:STDOUT: %.loc59_29.15: %ValueType = acquire_value %.loc59_29.14 +// CHECK:STDOUT: %.loc59_14: type = splice_block %ValueType.ref.loc59 [concrete = constants.%ValueType] { +// CHECK:STDOUT: %Cpp.ref.loc59: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %ValueType.ref.loc59: type = name_ref ValueType, imports.%ValueType.decl [concrete = constants.%ValueType] +// CHECK:STDOUT: } +// CHECK:STDOUT: %i.loc59: %ValueType = value_binding i, %.loc59_29.15 +// CHECK:STDOUT: %sum.ref.loc60: ref %ValueType = name_ref sum, %sum +// CHECK:STDOUT: %i.ref.loc60: %ValueType = name_ref i, %i.loc59 +// CHECK:STDOUT: %.loc60_12: ref %ValueType = value_as_ref %i.ref.loc60 +// CHECK:STDOUT: %addr.loc60: %ptr.a3d = addr_of %.loc60_12 +// CHECK:STDOUT: %.loc60_9.1: %ptr.6bf = as_compatible %addr.loc60 +// CHECK:STDOUT: %.loc60_9.2: %ptr.6bf = converted %addr.loc60, %.loc60_9.1 +// CHECK:STDOUT: %operator_PlusEqual__carbon_thunk.call.loc60: ref %ValueType = call imports.%operator_PlusEqual__carbon_thunk.decl(%sum.ref.loc60, %.loc60_9.2) +// CHECK:STDOUT: br !for.next.loc59 +// CHECK:STDOUT: +// CHECK:STDOUT: !for.done.loc59: +// CHECK:STDOUT: name_binding_decl { +// CHECK:STDOUT: %i.patt.loc63: %pattern_type.e9f = value_binding_pattern i [concrete = constants.%i.patt] +// CHECK:STDOUT: } +// CHECK:STDOUT: %c.ref: %ConstRange = name_ref c, %c +// CHECK:STDOUT: %impl.elem2.loc63: %.763 = impl_witness_access constants.%Iterate.impl_witness.40c, element2 [concrete = constants.%R.as_type.as.Iterate.impl.NewCursor.bd2] +// CHECK:STDOUT: %bound_method.loc63_29.1: = bound_method %c.ref, %impl.elem2.loc63 +// CHECK:STDOUT: %facet_value.loc63_29.1: %CppRangeForIterate_where.type = facet_value constants.%ConstRange, (constants.%custom_witness.e7a31c.1, constants.%custom_witness.d0da43.1, constants.%custom_witness.a03, constants.%custom_witness.6e8a2e.1, constants.%custom_witness.15091a.1, constants.%custom_witness.78b, constants.%custom_witness.c55, constants.%custom_witness.746, constants.%custom_witness.6e8a2e.2, constants.%custom_witness.15091a.2) [concrete = constants.%facet_value.445] +// CHECK:STDOUT: %.loc63_29.1: %CppRangeForIterate_where.type = converted constants.%ConstRange, %facet_value.loc63_29.1 [concrete = constants.%facet_value.445] +// CHECK:STDOUT: %facet_value.loc63_29.2: %CppRangeForIterate_where.type = facet_value constants.%ConstRange, (constants.%custom_witness.e7a31c.1, constants.%custom_witness.d0da43.1, constants.%custom_witness.a03, constants.%custom_witness.6e8a2e.1, constants.%custom_witness.15091a.1, constants.%custom_witness.78b, constants.%custom_witness.c55, constants.%custom_witness.746, constants.%custom_witness.6e8a2e.2, constants.%custom_witness.15091a.2) [concrete = constants.%facet_value.445] +// CHECK:STDOUT: %.loc63_29.2: %CppRangeForIterate_where.type = converted constants.%ConstRange, %facet_value.loc63_29.2 [concrete = constants.%facet_value.445] +// CHECK:STDOUT: %specific_fn.loc63_29.1: = specific_function %impl.elem2.loc63, @R.as_type.as.Iterate.impl.NewCursor(constants.%facet_value.445) [concrete = constants.%R.as_type.as.Iterate.impl.NewCursor.specific_fn.7c7] +// CHECK:STDOUT: %bound_method.loc63_29.2: = bound_method %c.ref, %specific_fn.loc63_29.1 +// CHECK:STDOUT: %var.loc63: ref %tuple.type.99f = var invalid +// CHECK:STDOUT: %R.as_type.as.Iterate.impl.NewCursor.call.loc63: init %tuple.type.99f to %var.loc63 = call %bound_method.loc63_29.2(%c.ref) +// CHECK:STDOUT: assign %var.loc63, %R.as_type.as.Iterate.impl.NewCursor.call.loc63 +// CHECK:STDOUT: br !for.next.loc63 +// CHECK:STDOUT: +// CHECK:STDOUT: !for.next.loc63: +// CHECK:STDOUT: %addr.loc63: %ptr.2f7 = addr_of %var.loc63 +// CHECK:STDOUT: %impl.elem3.loc63: %.bca = impl_witness_access constants.%Iterate.impl_witness.40c, element3 [concrete = constants.%R.as_type.as.Iterate.impl.Next.c50] +// CHECK:STDOUT: %bound_method.loc63_29.3: = bound_method %c.ref, %impl.elem3.loc63 +// CHECK:STDOUT: %facet_value.loc63_29.3: %CppRangeForIterate_where.type = facet_value constants.%ConstRange, (constants.%custom_witness.e7a31c.1, constants.%custom_witness.d0da43.1, constants.%custom_witness.a03, constants.%custom_witness.6e8a2e.1, constants.%custom_witness.15091a.1, constants.%custom_witness.78b, constants.%custom_witness.c55, constants.%custom_witness.746, constants.%custom_witness.6e8a2e.2, constants.%custom_witness.15091a.2) [concrete = constants.%facet_value.445] +// CHECK:STDOUT: %.loc63_29.3: %CppRangeForIterate_where.type = converted constants.%ConstRange, %facet_value.loc63_29.3 [concrete = constants.%facet_value.445] +// CHECK:STDOUT: %facet_value.loc63_29.4: %CppRangeForIterate_where.type = facet_value constants.%ConstRange, (constants.%custom_witness.e7a31c.1, constants.%custom_witness.d0da43.1, constants.%custom_witness.a03, constants.%custom_witness.6e8a2e.1, constants.%custom_witness.15091a.1, constants.%custom_witness.78b, constants.%custom_witness.c55, constants.%custom_witness.746, constants.%custom_witness.6e8a2e.2, constants.%custom_witness.15091a.2) [concrete = constants.%facet_value.445] +// CHECK:STDOUT: %.loc63_29.4: %CppRangeForIterate_where.type = converted constants.%ConstRange, %facet_value.loc63_29.4 [concrete = constants.%facet_value.445] +// CHECK:STDOUT: %specific_fn.loc63_29.2: = specific_function %impl.elem3.loc63, @R.as_type.as.Iterate.impl.Next(constants.%facet_value.445) [concrete = constants.%R.as_type.as.Iterate.impl.Next.specific_fn.a9a] +// CHECK:STDOUT: %bound_method.loc63_29.4: = bound_method %c.ref, %specific_fn.loc63_29.2 +// CHECK:STDOUT: %.loc63_29.5: ref %Optional.95f = temporary_storage +// CHECK:STDOUT: %R.as_type.as.Iterate.impl.Next.call.loc63: init %Optional.95f to %.loc63_29.5 = call %bound_method.loc63_29.4(%c.ref, %addr.loc63) +// CHECK:STDOUT: %.loc63_29.6: ref %Optional.95f = temporary %.loc63_29.5, %R.as_type.as.Iterate.impl.Next.call.loc63 +// CHECK:STDOUT: %.loc63_29.7: %Optional.HasValue.type.006 = specific_constant imports.%Core.import_ref.bb6, @Optional(constants.%OptionalStorage.facet.705) [concrete = constants.%Optional.HasValue.988] +// CHECK:STDOUT: %HasValue.ref.loc63: %Optional.HasValue.type.006 = name_ref HasValue, %.loc63_29.7 [concrete = constants.%Optional.HasValue.988] +// CHECK:STDOUT: %Optional.HasValue.bound.loc63: = bound_method %.loc63_29.6, %HasValue.ref.loc63 +// CHECK:STDOUT: %Optional.HasValue.specific_fn.loc63: = specific_function %HasValue.ref.loc63, @Optional.HasValue(constants.%OptionalStorage.facet.705) [concrete = constants.%Optional.HasValue.specific_fn] +// CHECK:STDOUT: %bound_method.loc63_29.5: = bound_method %.loc63_29.6, %Optional.HasValue.specific_fn.loc63 +// CHECK:STDOUT: %.loc63_29.8: %Optional.95f = acquire_value %.loc63_29.6 +// CHECK:STDOUT: %Optional.HasValue.call.loc63: init bool = call %bound_method.loc63_29.5(%.loc63_29.8) +// CHECK:STDOUT: %.loc63_29.9: bool = value_of_initializer %Optional.HasValue.call.loc63 +// CHECK:STDOUT: %.loc63_29.10: bool = converted %Optional.HasValue.call.loc63, %.loc63_29.9 +// CHECK:STDOUT: if %.loc63_29.10 br !for.body.loc63 else br !for.done.loc63 +// CHECK:STDOUT: +// CHECK:STDOUT: !for.body.loc63: +// CHECK:STDOUT: %.loc63_29.11: %Optional.Get.type.30f = specific_constant imports.%Core.import_ref.daba, @Optional(constants.%OptionalStorage.facet.705) [concrete = constants.%Optional.Get.59c] +// CHECK:STDOUT: %Get.ref.loc63: %Optional.Get.type.30f = name_ref Get, %.loc63_29.11 [concrete = constants.%Optional.Get.59c] +// CHECK:STDOUT: %Optional.Get.bound.loc63: = bound_method %.loc63_29.6, %Get.ref.loc63 +// CHECK:STDOUT: %Optional.Get.specific_fn.loc63: = specific_function %Get.ref.loc63, @Optional.Get(constants.%OptionalStorage.facet.705) [concrete = constants.%Optional.Get.specific_fn] +// CHECK:STDOUT: %bound_method.loc63_29.6: = bound_method %.loc63_29.6, %Optional.Get.specific_fn.loc63 +// CHECK:STDOUT: %.loc63_29.12: ref %ValueType = temporary_storage +// CHECK:STDOUT: %.loc63_29.13: %Optional.95f = acquire_value %.loc63_29.6 +// CHECK:STDOUT: %Optional.Get.call.loc63: init %ValueType to %.loc63_29.12 = call %bound_method.loc63_29.6(%.loc63_29.13) +// CHECK:STDOUT: %.loc63_29.14: ref %ValueType = temporary %.loc63_29.12, %Optional.Get.call.loc63 +// CHECK:STDOUT: %.loc63_29.15: %ValueType = acquire_value %.loc63_29.14 +// CHECK:STDOUT: %.loc63_14: type = splice_block %ValueType.ref.loc63 [concrete = constants.%ValueType] { +// CHECK:STDOUT: %Cpp.ref.loc63: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %ValueType.ref.loc63: type = name_ref ValueType, imports.%ValueType.decl [concrete = constants.%ValueType] +// CHECK:STDOUT: } +// CHECK:STDOUT: %i.loc63: %ValueType = value_binding i, %.loc63_29.15 +// CHECK:STDOUT: %sum.ref.loc64: ref %ValueType = name_ref sum, %sum +// CHECK:STDOUT: %i.ref.loc64: %ValueType = name_ref i, %i.loc63 +// CHECK:STDOUT: %.loc64_12: ref %ValueType = value_as_ref %i.ref.loc64 +// CHECK:STDOUT: %addr.loc64: %ptr.a3d = addr_of %.loc64_12 +// CHECK:STDOUT: %.loc64_9.1: %ptr.6bf = as_compatible %addr.loc64 +// CHECK:STDOUT: %.loc64_9.2: %ptr.6bf = converted %addr.loc64, %.loc64_9.1 +// CHECK:STDOUT: %operator_PlusEqual__carbon_thunk.call.loc64: ref %ValueType = call imports.%operator_PlusEqual__carbon_thunk.decl(%sum.ref.loc64, %.loc64_9.2) +// CHECK:STDOUT: br !for.next.loc63 +// CHECK:STDOUT: +// CHECK:STDOUT: !for.done.loc63: +// CHECK:STDOUT: %ValueType.Op.bound.loc63: = bound_method %.loc63_29.14, constants.%ValueType.Op.4dca31.1 +// CHECK:STDOUT: %Op.ref.loc63: %ValueType.cpp_destructor.type = name_ref Op, imports.%ValueType.cpp_destructor.decl [concrete = constants.%ValueType.cpp_destructor] +// CHECK:STDOUT: %ValueType.cpp_destructor.bound.loc63: = bound_method %.loc63_29.14, %Op.ref.loc63 +// CHECK:STDOUT: %ValueType.cpp_destructor.call.loc63: init %empty_tuple.type = call %ValueType.cpp_destructor.bound.loc63(%.loc63_29.14) +// CHECK:STDOUT: %Destroy.Op.bound.loc63_29.1: = bound_method %.loc63_29.6, constants.%Destroy.Op.1a2547.7 +// CHECK:STDOUT: %Destroy.Op.call.loc63_29.1: init %empty_tuple.type = call %Destroy.Op.bound.loc63_29.1(%.loc63_29.6) +// CHECK:STDOUT: %Destroy.Op.bound.loc63_29.2: = bound_method %var.loc63, constants.%Destroy.Op.1a2547.9 +// CHECK:STDOUT: %Destroy.Op.call.loc63_29.2: init %empty_tuple.type = call %Destroy.Op.bound.loc63_29.2(%var.loc63) +// CHECK:STDOUT: %ValueType.Op.bound.loc59: = bound_method %.loc59_29.14, constants.%ValueType.Op.4dca31.1 +// CHECK:STDOUT: %Op.ref.loc59: %ValueType.cpp_destructor.type = name_ref Op, imports.%ValueType.cpp_destructor.decl [concrete = constants.%ValueType.cpp_destructor] +// CHECK:STDOUT: %ValueType.cpp_destructor.bound.loc59: = bound_method %.loc59_29.14, %Op.ref.loc59 +// CHECK:STDOUT: %ValueType.cpp_destructor.call.loc59: init %empty_tuple.type = call %ValueType.cpp_destructor.bound.loc59(%.loc59_29.14) +// CHECK:STDOUT: %Destroy.Op.bound.loc59_29.1: = bound_method %.loc59_29.6, constants.%Destroy.Op.1a2547.7 +// CHECK:STDOUT: %Destroy.Op.call.loc59_29.1: init %empty_tuple.type = call %Destroy.Op.bound.loc59_29.1(%.loc59_29.6) +// CHECK:STDOUT: %Destroy.Op.bound.loc59_29.2: = bound_method %var.loc59, constants.%Destroy.Op.1a2547.8 +// CHECK:STDOUT: %Destroy.Op.call.loc59_29.2: init %empty_tuple.type = call %Destroy.Op.bound.loc59_29.2(%var.loc59) +// CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Test(constants.%facet_value.150) { -// CHECK:STDOUT: %R.patt.loc40_10.2 => constants.%R.patt.f38 -// CHECK:STDOUT: %R.loc40_10.1 => constants.%facet_value.150 -// CHECK:STDOUT: %R.as_type.loc40_69.1 => constants.%MutableRange +// CHECK:STDOUT: specific @TestIterate(constants.%R.de1) { +// CHECK:STDOUT: %R.patt.loc40_17.2 => constants.%R.patt.f38 +// CHECK:STDOUT: %R.loc40_17.1 => constants.%R.de1 +// CHECK:STDOUT: %R.as_type.loc40_76.1 => constants.%R.as_type.f62 +// CHECK:STDOUT: %pattern_type => constants.%pattern_type.669 +// CHECK:STDOUT: %r.patt.loc40_74.2 => constants.%r.patt.c0f +// CHECK:STDOUT: %r.param_patt.loc40_69.2 => constants.%r.param_patt.bb2 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @TestIterate(constants.%facet_value.150) { +// CHECK:STDOUT: %R.patt.loc40_17.2 => constants.%R.patt.f38 +// CHECK:STDOUT: %R.loc40_17.1 => constants.%facet_value.150 +// CHECK:STDOUT: %R.as_type.loc40_76.1 => constants.%MutableRange // CHECK:STDOUT: %pattern_type => constants.%pattern_type.e635 -// CHECK:STDOUT: %r.patt.loc40_67.2 => constants.%r.patt.f69 -// CHECK:STDOUT: %r.param_patt.loc40_62.2 => constants.%r.param_patt.91e +// CHECK:STDOUT: %r.patt.loc40_74.2 => constants.%r.patt.f69 +// CHECK:STDOUT: %r.param_patt.loc40_69.2 => constants.%r.param_patt.91e // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete.loc40 => constants.%complete_type.357 @@ -1544,13 +1940,13 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %specific_impl_fn.loc44_29.6 => constants.%Destroy.Op.1a2547.8 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Test(constants.%facet_value.e78) { -// CHECK:STDOUT: %R.patt.loc40_10.2 => constants.%R.patt.f38 -// CHECK:STDOUT: %R.loc40_10.1 => constants.%facet_value.e78 -// CHECK:STDOUT: %R.as_type.loc40_69.1 => constants.%ConstRange +// CHECK:STDOUT: specific @TestIterate(constants.%facet_value.e78) { +// CHECK:STDOUT: %R.patt.loc40_17.2 => constants.%R.patt.f38 +// CHECK:STDOUT: %R.loc40_17.1 => constants.%facet_value.e78 +// CHECK:STDOUT: %R.as_type.loc40_76.1 => constants.%ConstRange // CHECK:STDOUT: %pattern_type => constants.%pattern_type.0ba -// CHECK:STDOUT: %r.patt.loc40_67.2 => constants.%r.patt.36a -// CHECK:STDOUT: %r.param_patt.loc40_62.2 => constants.%r.param_patt.501 +// CHECK:STDOUT: %r.patt.loc40_74.2 => constants.%r.patt.36a +// CHECK:STDOUT: %r.param_patt.loc40_69.2 => constants.%r.param_patt.501 // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete.loc40 => constants.%complete_type.357 @@ -1605,7 +2001,7 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %N.fe9: Core.IntLiteral = symbolic_binding N, 0 [symbolic] // CHECK:STDOUT: %f64.dc1: type = class_type @Float, @Float(%int_64) [concrete] // CHECK:STDOUT: %pattern_type.fb7: type = pattern_type %f64.dc1 [concrete] -// CHECK:STDOUT: %Destroy.Op.type.1d8f74.2: type = fn_type @Destroy.Op.loc20_47.2 [concrete] +// CHECK:STDOUT: %Destroy.Op.type.1d8f74.2: type = fn_type @Destroy.Op.loc20_54.2 [concrete] // CHECK:STDOUT: %Destroy.Op.1a2547.2: %Destroy.Op.type.1d8f74.2 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.df9cc1.2: = custom_witness (%Destroy.Op.1a2547.2), @Destroy [concrete] // CHECK:STDOUT: %Float.as.Copy.impl.Op.type.ff3: type = fn_type @Float.as.Copy.impl.Op, @Float.as.Copy.impl(%N.fe9) [symbolic] @@ -1732,15 +2128,15 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %r.param_patt.a73: %pattern_type.025 = value_param_pattern [concrete] // CHECK:STDOUT: %r.patt.0e2: %pattern_type.025 = at_binding_pattern r, %r.param_patt.a73 [concrete] // CHECK:STDOUT: %Iterate.WithSelf.NewCursor.type.d89: type = fn_type @Iterate.WithSelf.NewCursor, @Iterate.WithSelf(%Iterate.facet.9f4) [concrete] +// CHECK:STDOUT: %Iterate.WithSelf.Next.type.64f: type = fn_type @Iterate.WithSelf.Next, @Iterate.WithSelf(%Iterate.facet.9f4) [concrete] // CHECK:STDOUT: %.e0f: type = fn_type_with_self_type %Iterate.WithSelf.NewCursor.type.d89, %Iterate.facet.9f4 [concrete] // CHECK:STDOUT: %R.as_type.as.Iterate.impl.NewCursor.specific_fn: = specific_function %R.as_type.as.Iterate.impl.NewCursor.d2e, @R.as_type.as.Iterate.impl.NewCursor(%facet_value.c05) [concrete] -// CHECK:STDOUT: %complete_type.320: = complete_type_witness %tuple.type.005 [concrete] // CHECK:STDOUT: %ptr.d1a: type = ptr_type %tuple.type.005 [concrete] -// CHECK:STDOUT: %Iterate.WithSelf.Next.type.64f: type = fn_type @Iterate.WithSelf.Next, @Iterate.WithSelf(%Iterate.facet.9f4) [concrete] // CHECK:STDOUT: %.50c: type = fn_type_with_self_type %Iterate.WithSelf.Next.type.64f, %Iterate.facet.9f4 [concrete] // CHECK:STDOUT: %R.as_type.as.Iterate.impl.Next.specific_fn: = specific_function %R.as_type.as.Iterate.impl.Next.0b7, @R.as_type.as.Iterate.impl.Next(%facet_value.c05) [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.type.117: type = fn_type @Destroy.WithSelf.Op, @Destroy.WithSelf(%Destroy.facet.40b) [concrete] // CHECK:STDOUT: %.5a4: type = fn_type_with_self_type %Destroy.WithSelf.Op.type.117, %Destroy.facet.40b [concrete] +// CHECK:STDOUT: %complete_type.320: = complete_type_witness %tuple.type.005 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -1764,37 +2160,37 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %AddAssignWith.impl_witness_table = impl_witness_table (%Core.import_ref.cb3), @Float.as.AddAssignWith.impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Test(%R.loc20_10.2: %Iterate_where.type.83b) { +// CHECK:STDOUT: generic fn @TestIterate(%R.loc20_17.2: %Iterate_where.type.83b) { // CHECK:STDOUT: // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: -// CHECK:STDOUT: %Iterate.lookup_impl_witness: = lookup_impl_witness %R.loc20_10.1, @Iterate [symbolic = %Iterate.lookup_impl_witness (constants.%Iterate.lookup_impl_witness.171)] -// CHECK:STDOUT: %Iterate.facet.loc24_19.5: %Iterate.type = facet_value %R.as_type.loc20_55.1, (%Iterate.lookup_impl_witness) [symbolic = %Iterate.facet.loc24_19.5 (constants.%Iterate.facet.523)] +// CHECK:STDOUT: %Iterate.lookup_impl_witness: = lookup_impl_witness %R.loc20_17.1, @Iterate [symbolic = %Iterate.lookup_impl_witness (constants.%Iterate.lookup_impl_witness.171)] +// CHECK:STDOUT: %Iterate.facet.loc24_19.5: %Iterate.type = facet_value %R.as_type.loc20_62.1, (%Iterate.lookup_impl_witness) [symbolic = %Iterate.facet.loc24_19.5 (constants.%Iterate.facet.523)] // CHECK:STDOUT: %Iterate.WithSelf.NewCursor.type: type = fn_type @Iterate.WithSelf.NewCursor, @Iterate.WithSelf(%Iterate.facet.loc24_19.5) [symbolic = %Iterate.WithSelf.NewCursor.type (constants.%Iterate.WithSelf.NewCursor.type.51e)] // CHECK:STDOUT: %.loc24_19.19: type = fn_type_with_self_type %Iterate.WithSelf.NewCursor.type, %Iterate.facet.loc24_19.5 [symbolic = %.loc24_19.19 (constants.%.250)] -// CHECK:STDOUT: %impl.elem2.loc24_19.2: @Test.%.loc24_19.19 (%.250) = impl_witness_access %Iterate.lookup_impl_witness, element2 [symbolic = %impl.elem2.loc24_19.2 (constants.%impl.elem2.9ef)] +// CHECK:STDOUT: %impl.elem2.loc24_19.2: @TestIterate.%.loc24_19.19 (%.250) = impl_witness_access %Iterate.lookup_impl_witness, element2 [symbolic = %impl.elem2.loc24_19.2 (constants.%impl.elem2.9ef)] // CHECK:STDOUT: %specific_impl_fn.loc24_19.4: = specific_impl_function %impl.elem2.loc24_19.2, @Iterate.WithSelf.NewCursor(%Iterate.facet.loc24_19.5) [symbolic = %specific_impl_fn.loc24_19.4 (constants.%specific_impl_fn.5ff)] // CHECK:STDOUT: // CHECK:STDOUT: %ptr: type = ptr_type %as_type [symbolic = %ptr (constants.%ptr.b94)] // CHECK:STDOUT: %Iterate.WithSelf.Next.type: type = fn_type @Iterate.WithSelf.Next, @Iterate.WithSelf(%Iterate.facet.loc24_19.5) [symbolic = %Iterate.WithSelf.Next.type (constants.%Iterate.WithSelf.Next.type.e1d)] // CHECK:STDOUT: %.loc24_19.20: type = fn_type_with_self_type %Iterate.WithSelf.Next.type, %Iterate.facet.loc24_19.5 [symbolic = %.loc24_19.20 (constants.%.f81)] -// CHECK:STDOUT: %impl.elem3.loc24_19.2: @Test.%.loc24_19.20 (%.f81) = impl_witness_access %Iterate.lookup_impl_witness, element3 [symbolic = %impl.elem3.loc24_19.2 (constants.%impl.elem3.04c)] +// CHECK:STDOUT: %impl.elem3.loc24_19.2: @TestIterate.%.loc24_19.20 (%.f81) = impl_witness_access %Iterate.lookup_impl_witness, element3 [symbolic = %impl.elem3.loc24_19.2 (constants.%impl.elem3.04c)] // CHECK:STDOUT: %specific_impl_fn.loc24_19.5: = specific_impl_function %impl.elem3.loc24_19.2, @Iterate.WithSelf.Next(%Iterate.facet.loc24_19.5) [symbolic = %specific_impl_fn.loc24_19.5 (constants.%specific_impl_fn.c5b)] // CHECK:STDOUT: %Destroy.WithSelf.Op.type: type = fn_type @Destroy.WithSelf.Op, @Destroy.WithSelf(%impl.elem1) [symbolic = %Destroy.WithSelf.Op.type (constants.%Destroy.WithSelf.Op.type.b9c)] // CHECK:STDOUT: %.loc24_19.21: type = fn_type_with_self_type %Destroy.WithSelf.Op.type, %impl.elem1 [symbolic = %.loc24_19.21 (constants.%.75c)] // CHECK:STDOUT: %Destroy.lookup_impl_witness: = lookup_impl_witness %impl.elem1, @Destroy [symbolic = %Destroy.lookup_impl_witness (constants.%Destroy.lookup_impl_witness.f8f)] -// CHECK:STDOUT: %impl.elem0.loc24_19.2: @Test.%.loc24_19.21 (%.75c) = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc24_19.2 (constants.%impl.elem0.688)] +// CHECK:STDOUT: %impl.elem0.loc24_19.2: @TestIterate.%.loc24_19.21 (%.75c) = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc24_19.2 (constants.%impl.elem0.688)] // CHECK:STDOUT: %specific_impl_fn.loc24_19.6: = specific_impl_function %impl.elem0.loc24_19.2, @Destroy.WithSelf.Op(%impl.elem1) [symbolic = %specific_impl_fn.loc24_19.6 (constants.%specific_impl_fn.1e0)] // CHECK:STDOUT: -// CHECK:STDOUT: fn(%r.param: @Test.%R.as_type.loc20_55.1 (%R.as_type.657)) { +// CHECK:STDOUT: fn(%r.param: @TestIterate.%R.as_type.loc20_62.1 (%R.as_type.657)) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %i.patt: %pattern_type.fb7 = value_binding_pattern i [concrete = constants.%i.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %r.ref: @Test.%R.as_type.loc20_55.1 (%R.as_type.657) = name_ref r, %r -// CHECK:STDOUT: %impl.elem2.loc24_19.1: @Test.%.loc24_19.19 (%.250) = impl_witness_access constants.%Iterate.lookup_impl_witness.171, element2 [symbolic = %impl.elem2.loc24_19.2 (constants.%impl.elem2.9ef)] +// CHECK:STDOUT: %r.ref: @TestIterate.%R.as_type.loc20_62.1 (%R.as_type.657) = name_ref r, %r +// CHECK:STDOUT: %impl.elem2.loc24_19.1: @TestIterate.%.loc24_19.19 (%.250) = impl_witness_access constants.%Iterate.lookup_impl_witness.171, element2 [symbolic = %impl.elem2.loc24_19.2 (constants.%impl.elem2.9ef)] // CHECK:STDOUT: %bound_method.loc24_19.1: = bound_method %r.ref, %impl.elem2.loc24_19.1 // CHECK:STDOUT: %Iterate.facet.loc24_19.1: %Iterate.type = facet_value constants.%R.as_type.657, (constants.%Iterate.lookup_impl_witness.171) [symbolic = %Iterate.facet.loc24_19.5 (constants.%Iterate.facet.523)] // CHECK:STDOUT: %.loc24_19.1: %Iterate.type = converted constants.%R.as_type.657, %Iterate.facet.loc24_19.1 [symbolic = %Iterate.facet.loc24_19.5 (constants.%Iterate.facet.523)] @@ -1802,14 +2198,14 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %.loc24_19.2: %Iterate.type = converted constants.%R.as_type.657, %Iterate.facet.loc24_19.2 [symbolic = %Iterate.facet.loc24_19.5 (constants.%Iterate.facet.523)] // CHECK:STDOUT: %specific_impl_fn.loc24_19.1: = specific_impl_function %impl.elem2.loc24_19.1, @Iterate.WithSelf.NewCursor(constants.%Iterate.facet.523) [symbolic = %specific_impl_fn.loc24_19.4 (constants.%specific_impl_fn.5ff)] // CHECK:STDOUT: %bound_method.loc24_19.2: = bound_method %r.ref, %specific_impl_fn.loc24_19.1 -// CHECK:STDOUT: %var: ref @Test.%as_type (%as_type.6f2) = var invalid -// CHECK:STDOUT: %Iterate.WithSelf.NewCursor.call: init @Test.%as_type (%as_type.6f2) to %var = call %bound_method.loc24_19.2(%r.ref) +// CHECK:STDOUT: %var: ref @TestIterate.%as_type (%as_type.6f2) = var invalid +// CHECK:STDOUT: %Iterate.WithSelf.NewCursor.call: init @TestIterate.%as_type (%as_type.6f2) to %var = call %bound_method.loc24_19.2(%r.ref) // CHECK:STDOUT: assign %var, %Iterate.WithSelf.NewCursor.call // CHECK:STDOUT: br !for.next // CHECK:STDOUT: // CHECK:STDOUT: !for.next: -// CHECK:STDOUT: %addr: @Test.%ptr (%ptr.b94) = addr_of %var -// CHECK:STDOUT: %impl.elem3.loc24_19.1: @Test.%.loc24_19.20 (%.f81) = impl_witness_access constants.%Iterate.lookup_impl_witness.171, element3 [symbolic = %impl.elem3.loc24_19.2 (constants.%impl.elem3.04c)] +// CHECK:STDOUT: %addr: @TestIterate.%ptr (%ptr.b94) = addr_of %var +// CHECK:STDOUT: %impl.elem3.loc24_19.1: @TestIterate.%.loc24_19.20 (%.f81) = impl_witness_access constants.%Iterate.lookup_impl_witness.171, element3 [symbolic = %impl.elem3.loc24_19.2 (constants.%impl.elem3.04c)] // CHECK:STDOUT: %bound_method.loc24_19.3: = bound_method %r.ref, %impl.elem3.loc24_19.1 // CHECK:STDOUT: %Iterate.facet.loc24_19.3: %Iterate.type = facet_value constants.%R.as_type.657, (constants.%Iterate.lookup_impl_witness.171) [symbolic = %Iterate.facet.loc24_19.5 (constants.%Iterate.facet.523)] // CHECK:STDOUT: %.loc24_19.3: %Iterate.type = converted constants.%R.as_type.657, %Iterate.facet.loc24_19.3 [symbolic = %Iterate.facet.loc24_19.5 (constants.%Iterate.facet.523)] @@ -1857,7 +2253,7 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: !for.done: // CHECK:STDOUT: %Destroy.Op.bound.loc24: = bound_method %.loc24_19.8, constants.%Destroy.Op.1a2547.9 // CHECK:STDOUT: %Destroy.Op.call.loc24: init %empty_tuple.type = call %Destroy.Op.bound.loc24(%.loc24_19.8) -// CHECK:STDOUT: %impl.elem0.loc24_19.1: @Test.%.loc24_19.21 (%.75c) = impl_witness_access constants.%Destroy.lookup_impl_witness.f8f, element0 [symbolic = %impl.elem0.loc24_19.2 (constants.%impl.elem0.688)] +// CHECK:STDOUT: %impl.elem0.loc24_19.1: @TestIterate.%.loc24_19.21 (%.75c) = impl_witness_access constants.%Destroy.lookup_impl_witness.f8f, element0 [symbolic = %impl.elem0.loc24_19.2 (constants.%impl.elem0.688)] // CHECK:STDOUT: %bound_method.loc24_19.7: = bound_method %var, %impl.elem0.loc24_19.1 // CHECK:STDOUT: %.loc24_19.17: %Destroy.type = converted constants.%as_type.6f2, constants.%impl.elem1.f12 [symbolic = %impl.elem1 (constants.%impl.elem1.f12)] // CHECK:STDOUT: %.loc24_19.18: %Destroy.type = converted constants.%as_type.6f2, constants.%impl.elem1.f12 [symbolic = %impl.elem1 (constants.%impl.elem1.f12)] @@ -1895,22 +2291,95 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Test(constants.%R.7b2) { -// CHECK:STDOUT: %R.patt.loc20_10.2 => constants.%R.patt.053 -// CHECK:STDOUT: %R.loc20_10.1 => constants.%R.7b2 -// CHECK:STDOUT: %R.as_type.loc20_55.1 => constants.%R.as_type.657 -// CHECK:STDOUT: %pattern_type => constants.%pattern_type.afe -// CHECK:STDOUT: %r.param_patt.loc20_53.2 => constants.%r.param_patt.184 -// CHECK:STDOUT: %r.patt.loc20_53.2 => constants.%r.patt.727 +// CHECK:STDOUT: fn @TestRangeFor(%c.param: %ConstRange) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: +// CHECK:STDOUT: name_binding_decl { +// CHECK:STDOUT: %i.patt: %pattern_type.fb7 = value_binding_pattern i [concrete = constants.%i.patt] +// CHECK:STDOUT: } +// CHECK:STDOUT: %c.ref: %ConstRange = name_ref c, %c +// CHECK:STDOUT: %impl.elem2: %.e0f = impl_witness_access constants.%Iterate.impl_witness.1f0, element2 [concrete = constants.%R.as_type.as.Iterate.impl.NewCursor.d2e] +// CHECK:STDOUT: %bound_method.loc38_19.1: = bound_method %c.ref, %impl.elem2 +// CHECK:STDOUT: %facet_value.loc38_19.1: %CppRangeForIterate_where.type = facet_value constants.%ConstRange, (constants.%custom_witness.df9cc1.2, constants.%Copy.impl_witness.873, constants.%custom_witness.5d5, constants.%custom_witness.213, constants.%custom_witness.a31, constants.%custom_witness.994, constants.%custom_witness.821, constants.%custom_witness.393) [concrete = constants.%facet_value.c05] +// CHECK:STDOUT: %.loc38_19.1: %CppRangeForIterate_where.type = converted constants.%ConstRange, %facet_value.loc38_19.1 [concrete = constants.%facet_value.c05] +// CHECK:STDOUT: %facet_value.loc38_19.2: %CppRangeForIterate_where.type = facet_value constants.%ConstRange, (constants.%custom_witness.df9cc1.2, constants.%Copy.impl_witness.873, constants.%custom_witness.5d5, constants.%custom_witness.213, constants.%custom_witness.a31, constants.%custom_witness.994, constants.%custom_witness.821, constants.%custom_witness.393) [concrete = constants.%facet_value.c05] +// CHECK:STDOUT: %.loc38_19.2: %CppRangeForIterate_where.type = converted constants.%ConstRange, %facet_value.loc38_19.2 [concrete = constants.%facet_value.c05] +// CHECK:STDOUT: %specific_fn.loc38_19.1: = specific_function %impl.elem2, @R.as_type.as.Iterate.impl.NewCursor(constants.%facet_value.c05) [concrete = constants.%R.as_type.as.Iterate.impl.NewCursor.specific_fn] +// CHECK:STDOUT: %bound_method.loc38_19.2: = bound_method %c.ref, %specific_fn.loc38_19.1 +// CHECK:STDOUT: %var: ref %tuple.type.005 = var invalid +// CHECK:STDOUT: %R.as_type.as.Iterate.impl.NewCursor.call: init %tuple.type.005 to %var = call %bound_method.loc38_19.2(%c.ref) +// CHECK:STDOUT: assign %var, %R.as_type.as.Iterate.impl.NewCursor.call +// CHECK:STDOUT: br !for.next +// CHECK:STDOUT: +// CHECK:STDOUT: !for.next: +// CHECK:STDOUT: %addr: %ptr.d1a = addr_of %var +// CHECK:STDOUT: %impl.elem3: %.50c = impl_witness_access constants.%Iterate.impl_witness.1f0, element3 [concrete = constants.%R.as_type.as.Iterate.impl.Next.0b7] +// CHECK:STDOUT: %bound_method.loc38_19.3: = bound_method %c.ref, %impl.elem3 +// CHECK:STDOUT: %facet_value.loc38_19.3: %CppRangeForIterate_where.type = facet_value constants.%ConstRange, (constants.%custom_witness.df9cc1.2, constants.%Copy.impl_witness.873, constants.%custom_witness.5d5, constants.%custom_witness.213, constants.%custom_witness.a31, constants.%custom_witness.994, constants.%custom_witness.821, constants.%custom_witness.393) [concrete = constants.%facet_value.c05] +// CHECK:STDOUT: %.loc38_19.3: %CppRangeForIterate_where.type = converted constants.%ConstRange, %facet_value.loc38_19.3 [concrete = constants.%facet_value.c05] +// CHECK:STDOUT: %facet_value.loc38_19.4: %CppRangeForIterate_where.type = facet_value constants.%ConstRange, (constants.%custom_witness.df9cc1.2, constants.%Copy.impl_witness.873, constants.%custom_witness.5d5, constants.%custom_witness.213, constants.%custom_witness.a31, constants.%custom_witness.994, constants.%custom_witness.821, constants.%custom_witness.393) [concrete = constants.%facet_value.c05] +// CHECK:STDOUT: %.loc38_19.4: %CppRangeForIterate_where.type = converted constants.%ConstRange, %facet_value.loc38_19.4 [concrete = constants.%facet_value.c05] +// CHECK:STDOUT: %specific_fn.loc38_19.2: = specific_function %impl.elem3, @R.as_type.as.Iterate.impl.Next(constants.%facet_value.c05) [concrete = constants.%R.as_type.as.Iterate.impl.Next.specific_fn] +// CHECK:STDOUT: %bound_method.loc38_19.4: = bound_method %c.ref, %specific_fn.loc38_19.2 +// CHECK:STDOUT: %.loc38_19.5: ref %Optional.f48 = temporary_storage +// CHECK:STDOUT: %R.as_type.as.Iterate.impl.Next.call: init %Optional.f48 to %.loc38_19.5 = call %bound_method.loc38_19.4(%c.ref, %addr) +// CHECK:STDOUT: %.loc38_19.6: ref %Optional.f48 = temporary %.loc38_19.5, %R.as_type.as.Iterate.impl.Next.call +// CHECK:STDOUT: %.loc38_19.7: %Optional.HasValue.type.d4e = specific_constant imports.%Core.import_ref.bb6, @Optional(constants.%OptionalStorage.facet.cc1) [concrete = constants.%Optional.HasValue.e79] +// CHECK:STDOUT: %HasValue.ref: %Optional.HasValue.type.d4e = name_ref HasValue, %.loc38_19.7 [concrete = constants.%Optional.HasValue.e79] +// CHECK:STDOUT: %Optional.HasValue.bound: = bound_method %.loc38_19.6, %HasValue.ref +// CHECK:STDOUT: %Optional.HasValue.specific_fn: = specific_function %HasValue.ref, @Optional.HasValue(constants.%OptionalStorage.facet.cc1) [concrete = constants.%Optional.HasValue.specific_fn] +// CHECK:STDOUT: %bound_method.loc38_19.5: = bound_method %.loc38_19.6, %Optional.HasValue.specific_fn +// CHECK:STDOUT: %.loc38_19.8: %Optional.f48 = acquire_value %.loc38_19.6 +// CHECK:STDOUT: %Optional.HasValue.call: init bool = call %bound_method.loc38_19.5(%.loc38_19.8) +// CHECK:STDOUT: %.loc38_19.9: bool = value_of_initializer %Optional.HasValue.call +// CHECK:STDOUT: %.loc38_19.10: bool = converted %Optional.HasValue.call, %.loc38_19.9 +// CHECK:STDOUT: if %.loc38_19.10 br !for.body else br !for.done +// CHECK:STDOUT: +// CHECK:STDOUT: !for.body: +// CHECK:STDOUT: %.loc38_19.11: %Optional.Get.type.822 = specific_constant imports.%Core.import_ref.daba, @Optional(constants.%OptionalStorage.facet.cc1) [concrete = constants.%Optional.Get.f05] +// CHECK:STDOUT: %Get.ref: %Optional.Get.type.822 = name_ref Get, %.loc38_19.11 [concrete = constants.%Optional.Get.f05] +// CHECK:STDOUT: %Optional.Get.bound: = bound_method %.loc38_19.6, %Get.ref +// CHECK:STDOUT: %Optional.Get.specific_fn: = specific_function %Get.ref, @Optional.Get(constants.%OptionalStorage.facet.cc1) [concrete = constants.%Optional.Get.specific_fn] +// CHECK:STDOUT: %bound_method.loc38_19.6: = bound_method %.loc38_19.6, %Optional.Get.specific_fn +// CHECK:STDOUT: %.loc38_19.12: %Optional.f48 = acquire_value %.loc38_19.6 +// CHECK:STDOUT: %Optional.Get.call: init %f64.dc1 = call %bound_method.loc38_19.6(%.loc38_19.12) +// CHECK:STDOUT: %.loc38_19.13: %f64.dc1 = value_of_initializer %Optional.Get.call +// CHECK:STDOUT: %.loc38_19.14: %f64.dc1 = converted %Optional.Get.call, %.loc38_19.13 +// CHECK:STDOUT: %f64.loc38: type = type_literal constants.%f64.dc1 [concrete = constants.%f64.dc1] +// CHECK:STDOUT: %i: %f64.dc1 = value_binding i, %.loc38_19.14 +// CHECK:STDOUT: %sum.ref: ref %f64.dc1 = name_ref sum, %sum +// CHECK:STDOUT: %i.ref: %f64.dc1 = name_ref i, %i +// CHECK:STDOUT: %impl.elem0.loc39: %.746 = impl_witness_access constants.%AddAssignWith.impl_witness.e85, element0 [concrete = constants.%Float.as.AddAssignWith.impl.Op.ac1] +// CHECK:STDOUT: %bound_method.loc39_9.1: = bound_method %sum.ref, %impl.elem0.loc39 +// CHECK:STDOUT: %specific_fn.loc39: = specific_function %impl.elem0.loc39, @Float.as.AddAssignWith.impl.Op(constants.%int_64) [concrete = constants.%Float.as.AddAssignWith.impl.Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc39_9.2: = bound_method %sum.ref, %specific_fn.loc39 +// CHECK:STDOUT: %Float.as.AddAssignWith.impl.Op.call: init %empty_tuple.type = call %bound_method.loc39_9.2(%sum.ref, %i.ref) +// CHECK:STDOUT: br !for.next +// CHECK:STDOUT: +// CHECK:STDOUT: !for.done: +// CHECK:STDOUT: %Destroy.Op.bound.loc38_19.1: = bound_method %.loc38_19.6, constants.%Destroy.Op.1a2547.9 +// CHECK:STDOUT: %Destroy.Op.call.loc38_19.1: init %empty_tuple.type = call %Destroy.Op.bound.loc38_19.1(%.loc38_19.6) +// CHECK:STDOUT: %Destroy.Op.bound.loc38_19.2: = bound_method %var, constants.%Destroy.Op.1a2547.10 +// CHECK:STDOUT: %Destroy.Op.call.loc38_19.2: init %empty_tuple.type = call %Destroy.Op.bound.loc38_19.2(%var) +// CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Test(constants.%facet_value.9d0) { -// CHECK:STDOUT: %R.patt.loc20_10.2 => constants.%R.patt.053 -// CHECK:STDOUT: %R.loc20_10.1 => constants.%facet_value.9d0 -// CHECK:STDOUT: %R.as_type.loc20_55.1 => constants.%ConstRange +// CHECK:STDOUT: specific @TestIterate(constants.%R.7b2) { +// CHECK:STDOUT: %R.patt.loc20_17.2 => constants.%R.patt.053 +// CHECK:STDOUT: %R.loc20_17.1 => constants.%R.7b2 +// CHECK:STDOUT: %R.as_type.loc20_62.1 => constants.%R.as_type.657 +// CHECK:STDOUT: %pattern_type => constants.%pattern_type.afe +// CHECK:STDOUT: %r.param_patt.loc20_60.2 => constants.%r.param_patt.184 +// CHECK:STDOUT: %r.patt.loc20_60.2 => constants.%r.patt.727 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @TestIterate(constants.%facet_value.9d0) { +// CHECK:STDOUT: %R.patt.loc20_17.2 => constants.%R.patt.053 +// CHECK:STDOUT: %R.loc20_17.1 => constants.%facet_value.9d0 +// CHECK:STDOUT: %R.as_type.loc20_62.1 => constants.%ConstRange // CHECK:STDOUT: %pattern_type => constants.%pattern_type.025 -// CHECK:STDOUT: %r.param_patt.loc20_53.2 => constants.%r.param_patt.a73 -// CHECK:STDOUT: %r.patt.loc20_53.2 => constants.%r.patt.0e2 +// CHECK:STDOUT: %r.param_patt.loc20_60.2 => constants.%r.param_patt.a73 +// CHECK:STDOUT: %r.patt.loc20_60.2 => constants.%r.patt.0e2 // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete.loc20 => constants.%complete_type.357 @@ -1965,7 +2434,7 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %N.fe9: Core.IntLiteral = symbolic_binding N, 0 [symbolic] // CHECK:STDOUT: %f64.dc1: type = class_type @Float, @Float(%int_64) [concrete] // CHECK:STDOUT: %pattern_type.fb7: type = pattern_type %f64.dc1 [concrete] -// CHECK:STDOUT: %Destroy.Op.type.1d8f74.2: type = fn_type @Destroy.Op.loc22_47.2 [concrete] +// CHECK:STDOUT: %Destroy.Op.type.1d8f74.2: type = fn_type @Destroy.Op.loc22_54.2 [concrete] // CHECK:STDOUT: %Destroy.Op.1a2547.2: %Destroy.Op.type.1d8f74.2 = struct_value () [concrete] // CHECK:STDOUT: %custom_witness.df9cc1.2: = custom_witness (%Destroy.Op.1a2547.2), @Destroy [concrete] // CHECK:STDOUT: %Float.as.Copy.impl.Op.type.ff3: type = fn_type @Float.as.Copy.impl.Op, @Float.as.Copy.impl(%N.fe9) [symbolic] @@ -2092,15 +2561,15 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %r.param_patt.aeb: %pattern_type.992 = value_param_pattern [concrete] // CHECK:STDOUT: %r.patt.fe7: %pattern_type.992 = at_binding_pattern r, %r.param_patt.aeb [concrete] // CHECK:STDOUT: %Iterate.WithSelf.NewCursor.type.bde: type = fn_type @Iterate.WithSelf.NewCursor, @Iterate.WithSelf(%Iterate.facet.c9f) [concrete] +// CHECK:STDOUT: %Iterate.WithSelf.Next.type.454: type = fn_type @Iterate.WithSelf.Next, @Iterate.WithSelf(%Iterate.facet.c9f) [concrete] // CHECK:STDOUT: %.c29a: type = fn_type_with_self_type %Iterate.WithSelf.NewCursor.type.bde, %Iterate.facet.c9f [concrete] // CHECK:STDOUT: %R.as_type.as.Iterate.impl.NewCursor.specific_fn: = specific_function %R.as_type.as.Iterate.impl.NewCursor.41a, @R.as_type.as.Iterate.impl.NewCursor(%facet_value.85f) [concrete] -// CHECK:STDOUT: %complete_type.843: = complete_type_witness %tuple.type.dd0 [concrete] // CHECK:STDOUT: %ptr.a4f: type = ptr_type %tuple.type.dd0 [concrete] -// CHECK:STDOUT: %Iterate.WithSelf.Next.type.454: type = fn_type @Iterate.WithSelf.Next, @Iterate.WithSelf(%Iterate.facet.c9f) [concrete] // CHECK:STDOUT: %.b4c: type = fn_type_with_self_type %Iterate.WithSelf.Next.type.454, %Iterate.facet.c9f [concrete] // CHECK:STDOUT: %R.as_type.as.Iterate.impl.Next.specific_fn: = specific_function %R.as_type.as.Iterate.impl.Next.928, @R.as_type.as.Iterate.impl.Next(%facet_value.85f) [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.type.452: type = fn_type @Destroy.WithSelf.Op, @Destroy.WithSelf(%Destroy.facet.e1e) [concrete] // CHECK:STDOUT: %.899: type = fn_type_with_self_type %Destroy.WithSelf.Op.type.452, %Destroy.facet.e1e [concrete] +// CHECK:STDOUT: %complete_type.843: = complete_type_witness %tuple.type.dd0 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -2124,37 +2593,37 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %AddAssignWith.impl_witness_table = impl_witness_table (%Core.import_ref.cb3), @Float.as.AddAssignWith.impl [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Test(%R.loc22_10.2: %Iterate_where.type.83b) { +// CHECK:STDOUT: generic fn @TestIterate(%R.loc22_17.2: %Iterate_where.type.83b) { // CHECK:STDOUT: // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: -// CHECK:STDOUT: %Iterate.lookup_impl_witness: = lookup_impl_witness %R.loc22_10.1, @Iterate [symbolic = %Iterate.lookup_impl_witness (constants.%Iterate.lookup_impl_witness.171)] -// CHECK:STDOUT: %Iterate.facet.loc26_19.5: %Iterate.type = facet_value %R.as_type.loc22_55.1, (%Iterate.lookup_impl_witness) [symbolic = %Iterate.facet.loc26_19.5 (constants.%Iterate.facet.523)] +// CHECK:STDOUT: %Iterate.lookup_impl_witness: = lookup_impl_witness %R.loc22_17.1, @Iterate [symbolic = %Iterate.lookup_impl_witness (constants.%Iterate.lookup_impl_witness.171)] +// CHECK:STDOUT: %Iterate.facet.loc26_19.5: %Iterate.type = facet_value %R.as_type.loc22_62.1, (%Iterate.lookup_impl_witness) [symbolic = %Iterate.facet.loc26_19.5 (constants.%Iterate.facet.523)] // CHECK:STDOUT: %Iterate.WithSelf.NewCursor.type: type = fn_type @Iterate.WithSelf.NewCursor, @Iterate.WithSelf(%Iterate.facet.loc26_19.5) [symbolic = %Iterate.WithSelf.NewCursor.type (constants.%Iterate.WithSelf.NewCursor.type.51e)] // CHECK:STDOUT: %.loc26_19.19: type = fn_type_with_self_type %Iterate.WithSelf.NewCursor.type, %Iterate.facet.loc26_19.5 [symbolic = %.loc26_19.19 (constants.%.250)] -// CHECK:STDOUT: %impl.elem2.loc26_19.2: @Test.%.loc26_19.19 (%.250) = impl_witness_access %Iterate.lookup_impl_witness, element2 [symbolic = %impl.elem2.loc26_19.2 (constants.%impl.elem2.9ef)] +// CHECK:STDOUT: %impl.elem2.loc26_19.2: @TestIterate.%.loc26_19.19 (%.250) = impl_witness_access %Iterate.lookup_impl_witness, element2 [symbolic = %impl.elem2.loc26_19.2 (constants.%impl.elem2.9ef)] // CHECK:STDOUT: %specific_impl_fn.loc26_19.4: = specific_impl_function %impl.elem2.loc26_19.2, @Iterate.WithSelf.NewCursor(%Iterate.facet.loc26_19.5) [symbolic = %specific_impl_fn.loc26_19.4 (constants.%specific_impl_fn.5ff)] // CHECK:STDOUT: // CHECK:STDOUT: %ptr: type = ptr_type %as_type [symbolic = %ptr (constants.%ptr.b94)] // CHECK:STDOUT: %Iterate.WithSelf.Next.type: type = fn_type @Iterate.WithSelf.Next, @Iterate.WithSelf(%Iterate.facet.loc26_19.5) [symbolic = %Iterate.WithSelf.Next.type (constants.%Iterate.WithSelf.Next.type.e1d)] // CHECK:STDOUT: %.loc26_19.20: type = fn_type_with_self_type %Iterate.WithSelf.Next.type, %Iterate.facet.loc26_19.5 [symbolic = %.loc26_19.20 (constants.%.f81)] -// CHECK:STDOUT: %impl.elem3.loc26_19.2: @Test.%.loc26_19.20 (%.f81) = impl_witness_access %Iterate.lookup_impl_witness, element3 [symbolic = %impl.elem3.loc26_19.2 (constants.%impl.elem3.04c)] +// CHECK:STDOUT: %impl.elem3.loc26_19.2: @TestIterate.%.loc26_19.20 (%.f81) = impl_witness_access %Iterate.lookup_impl_witness, element3 [symbolic = %impl.elem3.loc26_19.2 (constants.%impl.elem3.04c)] // CHECK:STDOUT: %specific_impl_fn.loc26_19.5: = specific_impl_function %impl.elem3.loc26_19.2, @Iterate.WithSelf.Next(%Iterate.facet.loc26_19.5) [symbolic = %specific_impl_fn.loc26_19.5 (constants.%specific_impl_fn.c5b)] // CHECK:STDOUT: %Destroy.WithSelf.Op.type: type = fn_type @Destroy.WithSelf.Op, @Destroy.WithSelf(%impl.elem1) [symbolic = %Destroy.WithSelf.Op.type (constants.%Destroy.WithSelf.Op.type.b9c)] // CHECK:STDOUT: %.loc26_19.21: type = fn_type_with_self_type %Destroy.WithSelf.Op.type, %impl.elem1 [symbolic = %.loc26_19.21 (constants.%.75c)] // CHECK:STDOUT: %Destroy.lookup_impl_witness: = lookup_impl_witness %impl.elem1, @Destroy [symbolic = %Destroy.lookup_impl_witness (constants.%Destroy.lookup_impl_witness.f8f)] -// CHECK:STDOUT: %impl.elem0.loc26_19.2: @Test.%.loc26_19.21 (%.75c) = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc26_19.2 (constants.%impl.elem0.688)] +// CHECK:STDOUT: %impl.elem0.loc26_19.2: @TestIterate.%.loc26_19.21 (%.75c) = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc26_19.2 (constants.%impl.elem0.688)] // CHECK:STDOUT: %specific_impl_fn.loc26_19.6: = specific_impl_function %impl.elem0.loc26_19.2, @Destroy.WithSelf.Op(%impl.elem1) [symbolic = %specific_impl_fn.loc26_19.6 (constants.%specific_impl_fn.1e0)] // CHECK:STDOUT: -// CHECK:STDOUT: fn(%r.param: @Test.%R.as_type.loc22_55.1 (%R.as_type.657)) { +// CHECK:STDOUT: fn(%r.param: @TestIterate.%R.as_type.loc22_62.1 (%R.as_type.657)) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %i.patt: %pattern_type.fb7 = value_binding_pattern i [concrete = constants.%i.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %r.ref: @Test.%R.as_type.loc22_55.1 (%R.as_type.657) = name_ref r, %r -// CHECK:STDOUT: %impl.elem2.loc26_19.1: @Test.%.loc26_19.19 (%.250) = impl_witness_access constants.%Iterate.lookup_impl_witness.171, element2 [symbolic = %impl.elem2.loc26_19.2 (constants.%impl.elem2.9ef)] +// CHECK:STDOUT: %r.ref: @TestIterate.%R.as_type.loc22_62.1 (%R.as_type.657) = name_ref r, %r +// CHECK:STDOUT: %impl.elem2.loc26_19.1: @TestIterate.%.loc26_19.19 (%.250) = impl_witness_access constants.%Iterate.lookup_impl_witness.171, element2 [symbolic = %impl.elem2.loc26_19.2 (constants.%impl.elem2.9ef)] // CHECK:STDOUT: %bound_method.loc26_19.1: = bound_method %r.ref, %impl.elem2.loc26_19.1 // CHECK:STDOUT: %Iterate.facet.loc26_19.1: %Iterate.type = facet_value constants.%R.as_type.657, (constants.%Iterate.lookup_impl_witness.171) [symbolic = %Iterate.facet.loc26_19.5 (constants.%Iterate.facet.523)] // CHECK:STDOUT: %.loc26_19.1: %Iterate.type = converted constants.%R.as_type.657, %Iterate.facet.loc26_19.1 [symbolic = %Iterate.facet.loc26_19.5 (constants.%Iterate.facet.523)] @@ -2162,14 +2631,14 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %.loc26_19.2: %Iterate.type = converted constants.%R.as_type.657, %Iterate.facet.loc26_19.2 [symbolic = %Iterate.facet.loc26_19.5 (constants.%Iterate.facet.523)] // CHECK:STDOUT: %specific_impl_fn.loc26_19.1: = specific_impl_function %impl.elem2.loc26_19.1, @Iterate.WithSelf.NewCursor(constants.%Iterate.facet.523) [symbolic = %specific_impl_fn.loc26_19.4 (constants.%specific_impl_fn.5ff)] // CHECK:STDOUT: %bound_method.loc26_19.2: = bound_method %r.ref, %specific_impl_fn.loc26_19.1 -// CHECK:STDOUT: %var: ref @Test.%as_type (%as_type.6f2) = var invalid -// CHECK:STDOUT: %Iterate.WithSelf.NewCursor.call: init @Test.%as_type (%as_type.6f2) to %var = call %bound_method.loc26_19.2(%r.ref) +// CHECK:STDOUT: %var: ref @TestIterate.%as_type (%as_type.6f2) = var invalid +// CHECK:STDOUT: %Iterate.WithSelf.NewCursor.call: init @TestIterate.%as_type (%as_type.6f2) to %var = call %bound_method.loc26_19.2(%r.ref) // CHECK:STDOUT: assign %var, %Iterate.WithSelf.NewCursor.call // CHECK:STDOUT: br !for.next // CHECK:STDOUT: // CHECK:STDOUT: !for.next: -// CHECK:STDOUT: %addr: @Test.%ptr (%ptr.b94) = addr_of %var -// CHECK:STDOUT: %impl.elem3.loc26_19.1: @Test.%.loc26_19.20 (%.f81) = impl_witness_access constants.%Iterate.lookup_impl_witness.171, element3 [symbolic = %impl.elem3.loc26_19.2 (constants.%impl.elem3.04c)] +// CHECK:STDOUT: %addr: @TestIterate.%ptr (%ptr.b94) = addr_of %var +// CHECK:STDOUT: %impl.elem3.loc26_19.1: @TestIterate.%.loc26_19.20 (%.f81) = impl_witness_access constants.%Iterate.lookup_impl_witness.171, element3 [symbolic = %impl.elem3.loc26_19.2 (constants.%impl.elem3.04c)] // CHECK:STDOUT: %bound_method.loc26_19.3: = bound_method %r.ref, %impl.elem3.loc26_19.1 // CHECK:STDOUT: %Iterate.facet.loc26_19.3: %Iterate.type = facet_value constants.%R.as_type.657, (constants.%Iterate.lookup_impl_witness.171) [symbolic = %Iterate.facet.loc26_19.5 (constants.%Iterate.facet.523)] // CHECK:STDOUT: %.loc26_19.3: %Iterate.type = converted constants.%R.as_type.657, %Iterate.facet.loc26_19.3 [symbolic = %Iterate.facet.loc26_19.5 (constants.%Iterate.facet.523)] @@ -2217,7 +2686,7 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: !for.done: // CHECK:STDOUT: %Destroy.Op.bound.loc26: = bound_method %.loc26_19.8, constants.%Destroy.Op.1a2547.9 // CHECK:STDOUT: %Destroy.Op.call.loc26: init %empty_tuple.type = call %Destroy.Op.bound.loc26(%.loc26_19.8) -// CHECK:STDOUT: %impl.elem0.loc26_19.1: @Test.%.loc26_19.21 (%.75c) = impl_witness_access constants.%Destroy.lookup_impl_witness.f8f, element0 [symbolic = %impl.elem0.loc26_19.2 (constants.%impl.elem0.688)] +// CHECK:STDOUT: %impl.elem0.loc26_19.1: @TestIterate.%.loc26_19.21 (%.75c) = impl_witness_access constants.%Destroy.lookup_impl_witness.f8f, element0 [symbolic = %impl.elem0.loc26_19.2 (constants.%impl.elem0.688)] // CHECK:STDOUT: %bound_method.loc26_19.7: = bound_method %var, %impl.elem0.loc26_19.1 // CHECK:STDOUT: %.loc26_19.17: %Destroy.type = converted constants.%as_type.6f2, constants.%impl.elem1.f12 [symbolic = %impl.elem1 (constants.%impl.elem1.f12)] // CHECK:STDOUT: %.loc26_19.18: %Destroy.type = converted constants.%as_type.6f2, constants.%impl.elem1.f12 [symbolic = %impl.elem1 (constants.%impl.elem1.f12)] @@ -2255,22 +2724,97 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Test(constants.%R.7b2) { -// CHECK:STDOUT: %R.patt.loc22_10.2 => constants.%R.patt.053 -// CHECK:STDOUT: %R.loc22_10.1 => constants.%R.7b2 -// CHECK:STDOUT: %R.as_type.loc22_55.1 => constants.%R.as_type.657 -// CHECK:STDOUT: %pattern_type => constants.%pattern_type.afe -// CHECK:STDOUT: %r.param_patt.loc22_53.2 => constants.%r.param_patt.184 -// CHECK:STDOUT: %r.patt.loc22_53.2 => constants.%r.patt.727 +// CHECK:STDOUT: fn @TestRangeFor(%m.param: ref %MutableRange) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: +// CHECK:STDOUT: name_binding_decl { +// CHECK:STDOUT: %i.patt: %pattern_type.fb7 = value_binding_pattern i [concrete = constants.%i.patt] +// CHECK:STDOUT: } +// CHECK:STDOUT: %m.ref: ref %MutableRange = name_ref m, %m +// CHECK:STDOUT: %impl.elem2: %.c29a = impl_witness_access constants.%Iterate.impl_witness.5f7, element2 [concrete = constants.%R.as_type.as.Iterate.impl.NewCursor.41a] +// CHECK:STDOUT: %bound_method.loc68_19.1: = bound_method %m.ref, %impl.elem2 +// CHECK:STDOUT: %facet_value.loc68_19.1: %CppRangeForIterate_where.type = facet_value constants.%MutableRange, (constants.%custom_witness.df9cc1.2, constants.%Copy.impl_witness.873, constants.%custom_witness.902, constants.%custom_witness.c08, constants.%custom_witness.29f, constants.%custom_witness.05b, constants.%custom_witness.ed8, constants.%custom_witness.491) [concrete = constants.%facet_value.85f] +// CHECK:STDOUT: %.loc68_19.1: %CppRangeForIterate_where.type = converted constants.%MutableRange, %facet_value.loc68_19.1 [concrete = constants.%facet_value.85f] +// CHECK:STDOUT: %facet_value.loc68_19.2: %CppRangeForIterate_where.type = facet_value constants.%MutableRange, (constants.%custom_witness.df9cc1.2, constants.%Copy.impl_witness.873, constants.%custom_witness.902, constants.%custom_witness.c08, constants.%custom_witness.29f, constants.%custom_witness.05b, constants.%custom_witness.ed8, constants.%custom_witness.491) [concrete = constants.%facet_value.85f] +// CHECK:STDOUT: %.loc68_19.2: %CppRangeForIterate_where.type = converted constants.%MutableRange, %facet_value.loc68_19.2 [concrete = constants.%facet_value.85f] +// CHECK:STDOUT: %specific_fn.loc68_19.1: = specific_function %impl.elem2, @R.as_type.as.Iterate.impl.NewCursor(constants.%facet_value.85f) [concrete = constants.%R.as_type.as.Iterate.impl.NewCursor.specific_fn] +// CHECK:STDOUT: %bound_method.loc68_19.2: = bound_method %m.ref, %specific_fn.loc68_19.1 +// CHECK:STDOUT: %var: ref %tuple.type.dd0 = var invalid +// CHECK:STDOUT: %.loc68_18.1: %MutableRange = acquire_value %m.ref +// CHECK:STDOUT: %R.as_type.as.Iterate.impl.NewCursor.call: init %tuple.type.dd0 to %var = call %bound_method.loc68_19.2(%.loc68_18.1) +// CHECK:STDOUT: assign %var, %R.as_type.as.Iterate.impl.NewCursor.call +// CHECK:STDOUT: br !for.next +// CHECK:STDOUT: +// CHECK:STDOUT: !for.next: +// CHECK:STDOUT: %addr: %ptr.a4f = addr_of %var +// CHECK:STDOUT: %impl.elem3: %.b4c = impl_witness_access constants.%Iterate.impl_witness.5f7, element3 [concrete = constants.%R.as_type.as.Iterate.impl.Next.928] +// CHECK:STDOUT: %bound_method.loc68_19.3: = bound_method %m.ref, %impl.elem3 +// CHECK:STDOUT: %facet_value.loc68_19.3: %CppRangeForIterate_where.type = facet_value constants.%MutableRange, (constants.%custom_witness.df9cc1.2, constants.%Copy.impl_witness.873, constants.%custom_witness.902, constants.%custom_witness.c08, constants.%custom_witness.29f, constants.%custom_witness.05b, constants.%custom_witness.ed8, constants.%custom_witness.491) [concrete = constants.%facet_value.85f] +// CHECK:STDOUT: %.loc68_19.3: %CppRangeForIterate_where.type = converted constants.%MutableRange, %facet_value.loc68_19.3 [concrete = constants.%facet_value.85f] +// CHECK:STDOUT: %facet_value.loc68_19.4: %CppRangeForIterate_where.type = facet_value constants.%MutableRange, (constants.%custom_witness.df9cc1.2, constants.%Copy.impl_witness.873, constants.%custom_witness.902, constants.%custom_witness.c08, constants.%custom_witness.29f, constants.%custom_witness.05b, constants.%custom_witness.ed8, constants.%custom_witness.491) [concrete = constants.%facet_value.85f] +// CHECK:STDOUT: %.loc68_19.4: %CppRangeForIterate_where.type = converted constants.%MutableRange, %facet_value.loc68_19.4 [concrete = constants.%facet_value.85f] +// CHECK:STDOUT: %specific_fn.loc68_19.2: = specific_function %impl.elem3, @R.as_type.as.Iterate.impl.Next(constants.%facet_value.85f) [concrete = constants.%R.as_type.as.Iterate.impl.Next.specific_fn] +// CHECK:STDOUT: %bound_method.loc68_19.4: = bound_method %m.ref, %specific_fn.loc68_19.2 +// CHECK:STDOUT: %.loc68_19.5: ref %Optional.f48 = temporary_storage +// CHECK:STDOUT: %.loc68_18.2: %MutableRange = acquire_value %m.ref +// CHECK:STDOUT: %R.as_type.as.Iterate.impl.Next.call: init %Optional.f48 to %.loc68_19.5 = call %bound_method.loc68_19.4(%.loc68_18.2, %addr) +// CHECK:STDOUT: %.loc68_19.6: ref %Optional.f48 = temporary %.loc68_19.5, %R.as_type.as.Iterate.impl.Next.call +// CHECK:STDOUT: %.loc68_19.7: %Optional.HasValue.type.d4e = specific_constant imports.%Core.import_ref.bb6, @Optional(constants.%OptionalStorage.facet.cc1) [concrete = constants.%Optional.HasValue.e79] +// CHECK:STDOUT: %HasValue.ref: %Optional.HasValue.type.d4e = name_ref HasValue, %.loc68_19.7 [concrete = constants.%Optional.HasValue.e79] +// CHECK:STDOUT: %Optional.HasValue.bound: = bound_method %.loc68_19.6, %HasValue.ref +// CHECK:STDOUT: %Optional.HasValue.specific_fn: = specific_function %HasValue.ref, @Optional.HasValue(constants.%OptionalStorage.facet.cc1) [concrete = constants.%Optional.HasValue.specific_fn] +// CHECK:STDOUT: %bound_method.loc68_19.5: = bound_method %.loc68_19.6, %Optional.HasValue.specific_fn +// CHECK:STDOUT: %.loc68_19.8: %Optional.f48 = acquire_value %.loc68_19.6 +// CHECK:STDOUT: %Optional.HasValue.call: init bool = call %bound_method.loc68_19.5(%.loc68_19.8) +// CHECK:STDOUT: %.loc68_19.9: bool = value_of_initializer %Optional.HasValue.call +// CHECK:STDOUT: %.loc68_19.10: bool = converted %Optional.HasValue.call, %.loc68_19.9 +// CHECK:STDOUT: if %.loc68_19.10 br !for.body else br !for.done +// CHECK:STDOUT: +// CHECK:STDOUT: !for.body: +// CHECK:STDOUT: %.loc68_19.11: %Optional.Get.type.822 = specific_constant imports.%Core.import_ref.daba, @Optional(constants.%OptionalStorage.facet.cc1) [concrete = constants.%Optional.Get.f05] +// CHECK:STDOUT: %Get.ref: %Optional.Get.type.822 = name_ref Get, %.loc68_19.11 [concrete = constants.%Optional.Get.f05] +// CHECK:STDOUT: %Optional.Get.bound: = bound_method %.loc68_19.6, %Get.ref +// CHECK:STDOUT: %Optional.Get.specific_fn: = specific_function %Get.ref, @Optional.Get(constants.%OptionalStorage.facet.cc1) [concrete = constants.%Optional.Get.specific_fn] +// CHECK:STDOUT: %bound_method.loc68_19.6: = bound_method %.loc68_19.6, %Optional.Get.specific_fn +// CHECK:STDOUT: %.loc68_19.12: %Optional.f48 = acquire_value %.loc68_19.6 +// CHECK:STDOUT: %Optional.Get.call: init %f64.dc1 = call %bound_method.loc68_19.6(%.loc68_19.12) +// CHECK:STDOUT: %.loc68_19.13: %f64.dc1 = value_of_initializer %Optional.Get.call +// CHECK:STDOUT: %.loc68_19.14: %f64.dc1 = converted %Optional.Get.call, %.loc68_19.13 +// CHECK:STDOUT: %f64.loc68: type = type_literal constants.%f64.dc1 [concrete = constants.%f64.dc1] +// CHECK:STDOUT: %i: %f64.dc1 = value_binding i, %.loc68_19.14 +// CHECK:STDOUT: %sum.ref: ref %f64.dc1 = name_ref sum, %sum +// CHECK:STDOUT: %i.ref: %f64.dc1 = name_ref i, %i +// CHECK:STDOUT: %impl.elem0.loc69: %.746 = impl_witness_access constants.%AddAssignWith.impl_witness.e85, element0 [concrete = constants.%Float.as.AddAssignWith.impl.Op.ac1] +// CHECK:STDOUT: %bound_method.loc69_9.1: = bound_method %sum.ref, %impl.elem0.loc69 +// CHECK:STDOUT: %specific_fn.loc69: = specific_function %impl.elem0.loc69, @Float.as.AddAssignWith.impl.Op(constants.%int_64) [concrete = constants.%Float.as.AddAssignWith.impl.Op.specific_fn] +// CHECK:STDOUT: %bound_method.loc69_9.2: = bound_method %sum.ref, %specific_fn.loc69 +// CHECK:STDOUT: %Float.as.AddAssignWith.impl.Op.call: init %empty_tuple.type = call %bound_method.loc69_9.2(%sum.ref, %i.ref) +// CHECK:STDOUT: br !for.next +// CHECK:STDOUT: +// CHECK:STDOUT: !for.done: +// CHECK:STDOUT: %Destroy.Op.bound.loc68_19.1: = bound_method %.loc68_19.6, constants.%Destroy.Op.1a2547.9 +// CHECK:STDOUT: %Destroy.Op.call.loc68_19.1: init %empty_tuple.type = call %Destroy.Op.bound.loc68_19.1(%.loc68_19.6) +// CHECK:STDOUT: %Destroy.Op.bound.loc68_19.2: = bound_method %var, constants.%Destroy.Op.1a2547.10 +// CHECK:STDOUT: %Destroy.Op.call.loc68_19.2: init %empty_tuple.type = call %Destroy.Op.bound.loc68_19.2(%var) +// CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Test(constants.%facet_value.7dc) { -// CHECK:STDOUT: %R.patt.loc22_10.2 => constants.%R.patt.053 -// CHECK:STDOUT: %R.loc22_10.1 => constants.%facet_value.7dc -// CHECK:STDOUT: %R.as_type.loc22_55.1 => constants.%MutableRange +// CHECK:STDOUT: specific @TestIterate(constants.%R.7b2) { +// CHECK:STDOUT: %R.patt.loc22_17.2 => constants.%R.patt.053 +// CHECK:STDOUT: %R.loc22_17.1 => constants.%R.7b2 +// CHECK:STDOUT: %R.as_type.loc22_62.1 => constants.%R.as_type.657 +// CHECK:STDOUT: %pattern_type => constants.%pattern_type.afe +// CHECK:STDOUT: %r.param_patt.loc22_60.2 => constants.%r.param_patt.184 +// CHECK:STDOUT: %r.patt.loc22_60.2 => constants.%r.patt.727 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @TestIterate(constants.%facet_value.7dc) { +// CHECK:STDOUT: %R.patt.loc22_17.2 => constants.%R.patt.053 +// CHECK:STDOUT: %R.loc22_17.1 => constants.%facet_value.7dc +// CHECK:STDOUT: %R.as_type.loc22_62.1 => constants.%MutableRange // CHECK:STDOUT: %pattern_type => constants.%pattern_type.992 -// CHECK:STDOUT: %r.param_patt.loc22_53.2 => constants.%r.param_patt.aeb -// CHECK:STDOUT: %r.patt.loc22_53.2 => constants.%r.patt.fe7 +// CHECK:STDOUT: %r.param_patt.loc22_60.2 => constants.%r.param_patt.aeb +// CHECK:STDOUT: %r.patt.loc22_60.2 => constants.%r.patt.fe7 // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete.loc22 => constants.%complete_type.357 @@ -2454,15 +2998,15 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %r.param_patt.a73: %pattern_type.025 = value_param_pattern [concrete] // CHECK:STDOUT: %r.patt.0e2: %pattern_type.025 = at_binding_pattern r, %r.param_patt.a73 [concrete] // CHECK:STDOUT: %Iterate.WithSelf.NewCursor.type.e43: type = fn_type @Iterate.WithSelf.NewCursor, @Iterate.WithSelf(%Iterate.facet.099) [concrete] +// CHECK:STDOUT: %Iterate.WithSelf.Next.type.be4: type = fn_type @Iterate.WithSelf.Next, @Iterate.WithSelf(%Iterate.facet.099) [concrete] // CHECK:STDOUT: %.da4e: type = fn_type_with_self_type %Iterate.WithSelf.NewCursor.type.e43, %Iterate.facet.099 [concrete] // CHECK:STDOUT: %R.as_type.as.Iterate.impl.NewCursor.specific_fn: = specific_function %R.as_type.as.Iterate.impl.NewCursor.a27, @R.as_type.as.Iterate.impl.NewCursor(%facet_value.b1e) [concrete] -// CHECK:STDOUT: %complete_type.e35: = complete_type_witness %tuple.type.df8 [concrete] // CHECK:STDOUT: %ptr.fc0: type = ptr_type %tuple.type.df8 [concrete] -// CHECK:STDOUT: %Iterate.WithSelf.Next.type.be4: type = fn_type @Iterate.WithSelf.Next, @Iterate.WithSelf(%Iterate.facet.099) [concrete] // CHECK:STDOUT: %.4b8: type = fn_type_with_self_type %Iterate.WithSelf.Next.type.be4, %Iterate.facet.099 [concrete] // CHECK:STDOUT: %R.as_type.as.Iterate.impl.Next.specific_fn: = specific_function %R.as_type.as.Iterate.impl.Next.bf3, @R.as_type.as.Iterate.impl.Next(%facet_value.b1e) [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.type.589: type = fn_type @Destroy.WithSelf.Op, @Destroy.WithSelf(%Destroy.facet.777) [concrete] // CHECK:STDOUT: %.4e1: type = fn_type_with_self_type %Destroy.WithSelf.Op.type.589, %Destroy.facet.777 [concrete] +// CHECK:STDOUT: %complete_type.e35: = complete_type_witness %tuple.type.df8 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -2503,37 +3047,37 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %ConstRange.decl: type = class_decl @ConstRange [concrete = constants.%ConstRange] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Test(%R.loc27_10.2: %Iterate_where.type.99d) { +// CHECK:STDOUT: generic fn @TestIterate(%R.loc27_17.2: %Iterate_where.type.99d) { // CHECK:STDOUT: // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: -// CHECK:STDOUT: %Iterate.lookup_impl_witness: = lookup_impl_witness %R.loc27_10.1, @Iterate [symbolic = %Iterate.lookup_impl_witness (constants.%Iterate.lookup_impl_witness.8b4)] -// CHECK:STDOUT: %Iterate.facet.loc31_31.5: %Iterate.type = facet_value %R.as_type.loc27_67.1, (%Iterate.lookup_impl_witness) [symbolic = %Iterate.facet.loc31_31.5 (constants.%Iterate.facet.b19)] +// CHECK:STDOUT: %Iterate.lookup_impl_witness: = lookup_impl_witness %R.loc27_17.1, @Iterate [symbolic = %Iterate.lookup_impl_witness (constants.%Iterate.lookup_impl_witness.8b4)] +// CHECK:STDOUT: %Iterate.facet.loc31_31.5: %Iterate.type = facet_value %R.as_type.loc27_74.1, (%Iterate.lookup_impl_witness) [symbolic = %Iterate.facet.loc31_31.5 (constants.%Iterate.facet.b19)] // CHECK:STDOUT: %Iterate.WithSelf.NewCursor.type: type = fn_type @Iterate.WithSelf.NewCursor, @Iterate.WithSelf(%Iterate.facet.loc31_31.5) [symbolic = %Iterate.WithSelf.NewCursor.type (constants.%Iterate.WithSelf.NewCursor.type.217)] // CHECK:STDOUT: %.loc31_31.20: type = fn_type_with_self_type %Iterate.WithSelf.NewCursor.type, %Iterate.facet.loc31_31.5 [symbolic = %.loc31_31.20 (constants.%.a27)] -// CHECK:STDOUT: %impl.elem2.loc31_31.2: @Test.%.loc31_31.20 (%.a27) = impl_witness_access %Iterate.lookup_impl_witness, element2 [symbolic = %impl.elem2.loc31_31.2 (constants.%impl.elem2.7c0)] +// CHECK:STDOUT: %impl.elem2.loc31_31.2: @TestIterate.%.loc31_31.20 (%.a27) = impl_witness_access %Iterate.lookup_impl_witness, element2 [symbolic = %impl.elem2.loc31_31.2 (constants.%impl.elem2.7c0)] // CHECK:STDOUT: %specific_impl_fn.loc31_31.4: = specific_impl_function %impl.elem2.loc31_31.2, @Iterate.WithSelf.NewCursor(%Iterate.facet.loc31_31.5) [symbolic = %specific_impl_fn.loc31_31.4 (constants.%specific_impl_fn.e23)] // CHECK:STDOUT: // CHECK:STDOUT: %ptr: type = ptr_type %as_type [symbolic = %ptr (constants.%ptr.530)] // CHECK:STDOUT: %Iterate.WithSelf.Next.type: type = fn_type @Iterate.WithSelf.Next, @Iterate.WithSelf(%Iterate.facet.loc31_31.5) [symbolic = %Iterate.WithSelf.Next.type (constants.%Iterate.WithSelf.Next.type.10a)] // CHECK:STDOUT: %.loc31_31.21: type = fn_type_with_self_type %Iterate.WithSelf.Next.type, %Iterate.facet.loc31_31.5 [symbolic = %.loc31_31.21 (constants.%.df57)] -// CHECK:STDOUT: %impl.elem3.loc31_31.2: @Test.%.loc31_31.21 (%.df57) = impl_witness_access %Iterate.lookup_impl_witness, element3 [symbolic = %impl.elem3.loc31_31.2 (constants.%impl.elem3.199)] +// CHECK:STDOUT: %impl.elem3.loc31_31.2: @TestIterate.%.loc31_31.21 (%.df57) = impl_witness_access %Iterate.lookup_impl_witness, element3 [symbolic = %impl.elem3.loc31_31.2 (constants.%impl.elem3.199)] // CHECK:STDOUT: %specific_impl_fn.loc31_31.5: = specific_impl_function %impl.elem3.loc31_31.2, @Iterate.WithSelf.Next(%Iterate.facet.loc31_31.5) [symbolic = %specific_impl_fn.loc31_31.5 (constants.%specific_impl_fn.169)] // CHECK:STDOUT: %Destroy.WithSelf.Op.type: type = fn_type @Destroy.WithSelf.Op, @Destroy.WithSelf(%impl.elem1) [symbolic = %Destroy.WithSelf.Op.type (constants.%Destroy.WithSelf.Op.type.e7e)] // CHECK:STDOUT: %.loc31_31.22: type = fn_type_with_self_type %Destroy.WithSelf.Op.type, %impl.elem1 [symbolic = %.loc31_31.22 (constants.%.bc1)] // CHECK:STDOUT: %Destroy.lookup_impl_witness: = lookup_impl_witness %impl.elem1, @Destroy [symbolic = %Destroy.lookup_impl_witness (constants.%Destroy.lookup_impl_witness.f37)] -// CHECK:STDOUT: %impl.elem0.loc31_31.2: @Test.%.loc31_31.22 (%.bc1) = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc31_31.2 (constants.%impl.elem0.c7c)] +// CHECK:STDOUT: %impl.elem0.loc31_31.2: @TestIterate.%.loc31_31.22 (%.bc1) = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc31_31.2 (constants.%impl.elem0.c7c)] // CHECK:STDOUT: %specific_impl_fn.loc31_31.6: = specific_impl_function %impl.elem0.loc31_31.2, @Destroy.WithSelf.Op(%impl.elem1) [symbolic = %specific_impl_fn.loc31_31.6 (constants.%specific_impl_fn.cd3)] // CHECK:STDOUT: -// CHECK:STDOUT: fn(%r.param: @Test.%R.as_type.loc27_67.1 (%R.as_type.a62)) { +// CHECK:STDOUT: fn(%r.param: @TestIterate.%R.as_type.loc27_74.1 (%R.as_type.a62)) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %i.patt: %pattern_type.e41 = value_binding_pattern i [concrete = constants.%i.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %r.ref: @Test.%R.as_type.loc27_67.1 (%R.as_type.a62) = name_ref r, %r -// CHECK:STDOUT: %impl.elem2.loc31_31.1: @Test.%.loc31_31.20 (%.a27) = impl_witness_access constants.%Iterate.lookup_impl_witness.8b4, element2 [symbolic = %impl.elem2.loc31_31.2 (constants.%impl.elem2.7c0)] +// CHECK:STDOUT: %r.ref: @TestIterate.%R.as_type.loc27_74.1 (%R.as_type.a62) = name_ref r, %r +// CHECK:STDOUT: %impl.elem2.loc31_31.1: @TestIterate.%.loc31_31.20 (%.a27) = impl_witness_access constants.%Iterate.lookup_impl_witness.8b4, element2 [symbolic = %impl.elem2.loc31_31.2 (constants.%impl.elem2.7c0)] // CHECK:STDOUT: %bound_method.loc31_31.1: = bound_method %r.ref, %impl.elem2.loc31_31.1 // CHECK:STDOUT: %Iterate.facet.loc31_31.1: %Iterate.type = facet_value constants.%R.as_type.a62, (constants.%Iterate.lookup_impl_witness.8b4) [symbolic = %Iterate.facet.loc31_31.5 (constants.%Iterate.facet.b19)] // CHECK:STDOUT: %.loc31_31.1: %Iterate.type = converted constants.%R.as_type.a62, %Iterate.facet.loc31_31.1 [symbolic = %Iterate.facet.loc31_31.5 (constants.%Iterate.facet.b19)] @@ -2541,14 +3085,14 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %.loc31_31.2: %Iterate.type = converted constants.%R.as_type.a62, %Iterate.facet.loc31_31.2 [symbolic = %Iterate.facet.loc31_31.5 (constants.%Iterate.facet.b19)] // CHECK:STDOUT: %specific_impl_fn.loc31_31.1: = specific_impl_function %impl.elem2.loc31_31.1, @Iterate.WithSelf.NewCursor(constants.%Iterate.facet.b19) [symbolic = %specific_impl_fn.loc31_31.4 (constants.%specific_impl_fn.e23)] // CHECK:STDOUT: %bound_method.loc31_31.2: = bound_method %r.ref, %specific_impl_fn.loc31_31.1 -// CHECK:STDOUT: %var: ref @Test.%as_type (%as_type.862) = var invalid -// CHECK:STDOUT: %Iterate.WithSelf.NewCursor.call: init @Test.%as_type (%as_type.862) to %var = call %bound_method.loc31_31.2(%r.ref) +// CHECK:STDOUT: %var: ref @TestIterate.%as_type (%as_type.862) = var invalid +// CHECK:STDOUT: %Iterate.WithSelf.NewCursor.call: init @TestIterate.%as_type (%as_type.862) to %var = call %bound_method.loc31_31.2(%r.ref) // CHECK:STDOUT: assign %var, %Iterate.WithSelf.NewCursor.call // CHECK:STDOUT: br !for.next // CHECK:STDOUT: // CHECK:STDOUT: !for.next: -// CHECK:STDOUT: %addr.loc31: @Test.%ptr (%ptr.530) = addr_of %var -// CHECK:STDOUT: %impl.elem3.loc31_31.1: @Test.%.loc31_31.21 (%.df57) = impl_witness_access constants.%Iterate.lookup_impl_witness.8b4, element3 [symbolic = %impl.elem3.loc31_31.2 (constants.%impl.elem3.199)] +// CHECK:STDOUT: %addr.loc31: @TestIterate.%ptr (%ptr.530) = addr_of %var +// CHECK:STDOUT: %impl.elem3.loc31_31.1: @TestIterate.%.loc31_31.21 (%.df57) = impl_witness_access constants.%Iterate.lookup_impl_witness.8b4, element3 [symbolic = %impl.elem3.loc31_31.2 (constants.%impl.elem3.199)] // CHECK:STDOUT: %bound_method.loc31_31.3: = bound_method %r.ref, %impl.elem3.loc31_31.1 // CHECK:STDOUT: %Iterate.facet.loc31_31.3: %Iterate.type = facet_value constants.%R.as_type.a62, (constants.%Iterate.lookup_impl_witness.8b4) [symbolic = %Iterate.facet.loc31_31.5 (constants.%Iterate.facet.b19)] // CHECK:STDOUT: %.loc31_31.3: %Iterate.type = converted constants.%R.as_type.a62, %Iterate.facet.loc31_31.3 [symbolic = %Iterate.facet.loc31_31.5 (constants.%Iterate.facet.b19)] @@ -2605,7 +3149,7 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %ValueType.cpp_destructor.call.loc31: init %empty_tuple.type = call %ValueType.cpp_destructor.bound.loc31(%.loc31_31.16) // CHECK:STDOUT: %Destroy.Op.bound: = bound_method %.loc31_31.8, constants.%Destroy.Op.1a2547.7 // CHECK:STDOUT: %Destroy.Op.call: init %empty_tuple.type = call %Destroy.Op.bound(%.loc31_31.8) -// CHECK:STDOUT: %impl.elem0.loc31_31.1: @Test.%.loc31_31.22 (%.bc1) = impl_witness_access constants.%Destroy.lookup_impl_witness.f37, element0 [symbolic = %impl.elem0.loc31_31.2 (constants.%impl.elem0.c7c)] +// CHECK:STDOUT: %impl.elem0.loc31_31.1: @TestIterate.%.loc31_31.22 (%.bc1) = impl_witness_access constants.%Destroy.lookup_impl_witness.f37, element0 [symbolic = %impl.elem0.loc31_31.2 (constants.%impl.elem0.c7c)] // CHECK:STDOUT: %bound_method.loc31_31.7: = bound_method %var, %impl.elem0.loc31_31.1 // CHECK:STDOUT: %.loc31_31.18: %Destroy.type = converted constants.%as_type.862, constants.%impl.elem1.46a [symbolic = %impl.elem1 (constants.%impl.elem1.46a)] // CHECK:STDOUT: %.loc31_31.19: %Destroy.type = converted constants.%as_type.862, constants.%impl.elem1.46a [symbolic = %impl.elem1 (constants.%impl.elem1.46a)] @@ -2643,22 +3187,104 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Test(constants.%R.623) { -// CHECK:STDOUT: %R.patt.loc27_10.2 => constants.%R.patt.324 -// CHECK:STDOUT: %R.loc27_10.1 => constants.%R.623 -// CHECK:STDOUT: %R.as_type.loc27_67.1 => constants.%R.as_type.a62 -// CHECK:STDOUT: %pattern_type => constants.%pattern_type.725 -// CHECK:STDOUT: %r.param_patt.loc27_65.2 => constants.%r.param_patt.162 -// CHECK:STDOUT: %r.patt.loc27_65.2 => constants.%r.patt.15b +// CHECK:STDOUT: fn @TestRangeFor(%c.param: %ConstRange) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: +// CHECK:STDOUT: name_binding_decl { +// CHECK:STDOUT: %i.patt: %pattern_type.e41 = value_binding_pattern i [concrete = constants.%i.patt] +// CHECK:STDOUT: } +// CHECK:STDOUT: %c.ref: %ConstRange = name_ref c, %c +// CHECK:STDOUT: %impl.elem2: %.da4e = impl_witness_access constants.%Iterate.impl_witness.466, element2 [concrete = constants.%R.as_type.as.Iterate.impl.NewCursor.a27] +// CHECK:STDOUT: %bound_method.loc45_31.1: = bound_method %c.ref, %impl.elem2 +// CHECK:STDOUT: %facet_value.loc45_31.1: %CppRangeForIterate_where.type = facet_value constants.%ConstRange, (constants.%custom_witness.fef, constants.%custom_witness.c19, constants.%custom_witness.c2f, constants.%custom_witness.21358e.1, constants.%custom_witness.a3150e.1, constants.%custom_witness.1d3, constants.%custom_witness.aa4, constants.%custom_witness.393, constants.%custom_witness.21358e.2, constants.%custom_witness.a3150e.2) [concrete = constants.%facet_value.b1e] +// CHECK:STDOUT: %.loc45_31.1: %CppRangeForIterate_where.type = converted constants.%ConstRange, %facet_value.loc45_31.1 [concrete = constants.%facet_value.b1e] +// CHECK:STDOUT: %facet_value.loc45_31.2: %CppRangeForIterate_where.type = facet_value constants.%ConstRange, (constants.%custom_witness.fef, constants.%custom_witness.c19, constants.%custom_witness.c2f, constants.%custom_witness.21358e.1, constants.%custom_witness.a3150e.1, constants.%custom_witness.1d3, constants.%custom_witness.aa4, constants.%custom_witness.393, constants.%custom_witness.21358e.2, constants.%custom_witness.a3150e.2) [concrete = constants.%facet_value.b1e] +// CHECK:STDOUT: %.loc45_31.2: %CppRangeForIterate_where.type = converted constants.%ConstRange, %facet_value.loc45_31.2 [concrete = constants.%facet_value.b1e] +// CHECK:STDOUT: %specific_fn.loc45_31.1: = specific_function %impl.elem2, @R.as_type.as.Iterate.impl.NewCursor(constants.%facet_value.b1e) [concrete = constants.%R.as_type.as.Iterate.impl.NewCursor.specific_fn] +// CHECK:STDOUT: %bound_method.loc45_31.2: = bound_method %c.ref, %specific_fn.loc45_31.1 +// CHECK:STDOUT: %var: ref %tuple.type.df8 = var invalid +// CHECK:STDOUT: %R.as_type.as.Iterate.impl.NewCursor.call: init %tuple.type.df8 to %var = call %bound_method.loc45_31.2(%c.ref) +// CHECK:STDOUT: assign %var, %R.as_type.as.Iterate.impl.NewCursor.call +// CHECK:STDOUT: br !for.next +// CHECK:STDOUT: +// CHECK:STDOUT: !for.next: +// CHECK:STDOUT: %addr.loc45: %ptr.fc0 = addr_of %var +// CHECK:STDOUT: %impl.elem3: %.4b8 = impl_witness_access constants.%Iterate.impl_witness.466, element3 [concrete = constants.%R.as_type.as.Iterate.impl.Next.bf3] +// CHECK:STDOUT: %bound_method.loc45_31.3: = bound_method %c.ref, %impl.elem3 +// CHECK:STDOUT: %facet_value.loc45_31.3: %CppRangeForIterate_where.type = facet_value constants.%ConstRange, (constants.%custom_witness.fef, constants.%custom_witness.c19, constants.%custom_witness.c2f, constants.%custom_witness.21358e.1, constants.%custom_witness.a3150e.1, constants.%custom_witness.1d3, constants.%custom_witness.aa4, constants.%custom_witness.393, constants.%custom_witness.21358e.2, constants.%custom_witness.a3150e.2) [concrete = constants.%facet_value.b1e] +// CHECK:STDOUT: %.loc45_31.3: %CppRangeForIterate_where.type = converted constants.%ConstRange, %facet_value.loc45_31.3 [concrete = constants.%facet_value.b1e] +// CHECK:STDOUT: %facet_value.loc45_31.4: %CppRangeForIterate_where.type = facet_value constants.%ConstRange, (constants.%custom_witness.fef, constants.%custom_witness.c19, constants.%custom_witness.c2f, constants.%custom_witness.21358e.1, constants.%custom_witness.a3150e.1, constants.%custom_witness.1d3, constants.%custom_witness.aa4, constants.%custom_witness.393, constants.%custom_witness.21358e.2, constants.%custom_witness.a3150e.2) [concrete = constants.%facet_value.b1e] +// CHECK:STDOUT: %.loc45_31.4: %CppRangeForIterate_where.type = converted constants.%ConstRange, %facet_value.loc45_31.4 [concrete = constants.%facet_value.b1e] +// CHECK:STDOUT: %specific_fn.loc45_31.2: = specific_function %impl.elem3, @R.as_type.as.Iterate.impl.Next(constants.%facet_value.b1e) [concrete = constants.%R.as_type.as.Iterate.impl.Next.specific_fn] +// CHECK:STDOUT: %bound_method.loc45_31.4: = bound_method %c.ref, %specific_fn.loc45_31.2 +// CHECK:STDOUT: %.loc45_31.5: ref %Optional.552 = temporary_storage +// CHECK:STDOUT: %R.as_type.as.Iterate.impl.Next.call: init %Optional.552 to %.loc45_31.5 = call %bound_method.loc45_31.4(%c.ref, %addr.loc45) +// CHECK:STDOUT: %.loc45_31.6: ref %Optional.552 = temporary %.loc45_31.5, %R.as_type.as.Iterate.impl.Next.call +// CHECK:STDOUT: %.loc45_31.7: %Optional.HasValue.type.109 = specific_constant imports.%Core.import_ref.bb6, @Optional(constants.%OptionalStorage.facet.7ce) [concrete = constants.%Optional.HasValue.605] +// CHECK:STDOUT: %HasValue.ref: %Optional.HasValue.type.109 = name_ref HasValue, %.loc45_31.7 [concrete = constants.%Optional.HasValue.605] +// CHECK:STDOUT: %Optional.HasValue.bound: = bound_method %.loc45_31.6, %HasValue.ref +// CHECK:STDOUT: %Optional.HasValue.specific_fn: = specific_function %HasValue.ref, @Optional.HasValue(constants.%OptionalStorage.facet.7ce) [concrete = constants.%Optional.HasValue.specific_fn] +// CHECK:STDOUT: %bound_method.loc45_31.5: = bound_method %.loc45_31.6, %Optional.HasValue.specific_fn +// CHECK:STDOUT: %.loc45_31.8: %Optional.552 = acquire_value %.loc45_31.6 +// CHECK:STDOUT: %Optional.HasValue.call: init bool = call %bound_method.loc45_31.5(%.loc45_31.8) +// CHECK:STDOUT: %.loc45_31.9: bool = value_of_initializer %Optional.HasValue.call +// CHECK:STDOUT: %.loc45_31.10: bool = converted %Optional.HasValue.call, %.loc45_31.9 +// CHECK:STDOUT: if %.loc45_31.10 br !for.body else br !for.done +// CHECK:STDOUT: +// CHECK:STDOUT: !for.body: +// CHECK:STDOUT: %.loc45_31.11: %Optional.Get.type.135 = specific_constant imports.%Core.import_ref.daba, @Optional(constants.%OptionalStorage.facet.7ce) [concrete = constants.%Optional.Get.5aa] +// CHECK:STDOUT: %Get.ref: %Optional.Get.type.135 = name_ref Get, %.loc45_31.11 [concrete = constants.%Optional.Get.5aa] +// CHECK:STDOUT: %Optional.Get.bound: = bound_method %.loc45_31.6, %Get.ref +// CHECK:STDOUT: %Optional.Get.specific_fn: = specific_function %Get.ref, @Optional.Get(constants.%OptionalStorage.facet.7ce) [concrete = constants.%Optional.Get.specific_fn] +// CHECK:STDOUT: %bound_method.loc45_31.6: = bound_method %.loc45_31.6, %Optional.Get.specific_fn +// CHECK:STDOUT: %.loc45_31.12: ref %ValueType = temporary_storage +// CHECK:STDOUT: %.loc45_31.13: %Optional.552 = acquire_value %.loc45_31.6 +// CHECK:STDOUT: %Optional.Get.call: init %ValueType to %.loc45_31.12 = call %bound_method.loc45_31.6(%.loc45_31.13) +// CHECK:STDOUT: %.loc45_31.14: ref %ValueType = temporary %.loc45_31.12, %Optional.Get.call +// CHECK:STDOUT: %.loc45_31.15: %ValueType = acquire_value %.loc45_31.14 +// CHECK:STDOUT: %.loc45_16: type = splice_block %ValueType.ref.loc45 [concrete = constants.%ValueType] { +// CHECK:STDOUT: %Cpp.ref.loc45: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %N.ref.loc45: = name_ref N, imports.%N [concrete = imports.%N] +// CHECK:STDOUT: %ValueType.ref.loc45: type = name_ref ValueType, imports.%ValueType.decl [concrete = constants.%ValueType] +// CHECK:STDOUT: } +// CHECK:STDOUT: %i: %ValueType = value_binding i, %.loc45_31.15 +// CHECK:STDOUT: %sum.ref: ref %ValueType = name_ref sum, %sum +// CHECK:STDOUT: %i.ref: %ValueType = name_ref i, %i +// CHECK:STDOUT: %.loc46_12: ref %ValueType = value_as_ref %i.ref +// CHECK:STDOUT: %addr.loc46: %ptr.9d3 = addr_of %.loc46_12 +// CHECK:STDOUT: %.loc46_9.1: %ptr.32e = as_compatible %addr.loc46 +// CHECK:STDOUT: %.loc46_9.2: %ptr.32e = converted %addr.loc46, %.loc46_9.1 +// CHECK:STDOUT: %operator_PlusEqual__carbon_thunk.call: ref %ValueType = call imports.%operator_PlusEqual__carbon_thunk.decl(%sum.ref, %.loc46_9.2) +// CHECK:STDOUT: br !for.next +// CHECK:STDOUT: +// CHECK:STDOUT: !for.done: +// CHECK:STDOUT: %ValueType.Op.bound.loc45: = bound_method %.loc45_31.14, constants.%ValueType.Op.4c94b9.1 +// CHECK:STDOUT: %Op.ref.loc45: %ValueType.cpp_destructor.type = name_ref Op, imports.%ValueType.cpp_destructor.decl [concrete = constants.%ValueType.cpp_destructor] +// CHECK:STDOUT: %ValueType.cpp_destructor.bound.loc45: = bound_method %.loc45_31.14, %Op.ref.loc45 +// CHECK:STDOUT: %ValueType.cpp_destructor.call.loc45: init %empty_tuple.type = call %ValueType.cpp_destructor.bound.loc45(%.loc45_31.14) +// CHECK:STDOUT: %Destroy.Op.bound.loc45_31.1: = bound_method %.loc45_31.6, constants.%Destroy.Op.1a2547.7 +// CHECK:STDOUT: %Destroy.Op.call.loc45_31.1: init %empty_tuple.type = call %Destroy.Op.bound.loc45_31.1(%.loc45_31.6) +// CHECK:STDOUT: %Destroy.Op.bound.loc45_31.2: = bound_method %var, constants.%Destroy.Op.1a2547.8 +// CHECK:STDOUT: %Destroy.Op.call.loc45_31.2: init %empty_tuple.type = call %Destroy.Op.bound.loc45_31.2(%var) +// CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Test(constants.%facet_value.00d) { -// CHECK:STDOUT: %R.patt.loc27_10.2 => constants.%R.patt.324 -// CHECK:STDOUT: %R.loc27_10.1 => constants.%facet_value.00d -// CHECK:STDOUT: %R.as_type.loc27_67.1 => constants.%ConstRange +// CHECK:STDOUT: specific @TestIterate(constants.%R.623) { +// CHECK:STDOUT: %R.patt.loc27_17.2 => constants.%R.patt.324 +// CHECK:STDOUT: %R.loc27_17.1 => constants.%R.623 +// CHECK:STDOUT: %R.as_type.loc27_74.1 => constants.%R.as_type.a62 +// CHECK:STDOUT: %pattern_type => constants.%pattern_type.725 +// CHECK:STDOUT: %r.param_patt.loc27_72.2 => constants.%r.param_patt.162 +// CHECK:STDOUT: %r.patt.loc27_72.2 => constants.%r.patt.15b +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @TestIterate(constants.%facet_value.00d) { +// CHECK:STDOUT: %R.patt.loc27_17.2 => constants.%R.patt.324 +// CHECK:STDOUT: %R.loc27_17.1 => constants.%facet_value.00d +// CHECK:STDOUT: %R.as_type.loc27_74.1 => constants.%ConstRange // CHECK:STDOUT: %pattern_type => constants.%pattern_type.025 -// CHECK:STDOUT: %r.param_patt.loc27_65.2 => constants.%r.param_patt.a73 -// CHECK:STDOUT: %r.patt.loc27_65.2 => constants.%r.patt.0e2 +// CHECK:STDOUT: %r.param_patt.loc27_72.2 => constants.%r.param_patt.a73 +// CHECK:STDOUT: %r.patt.loc27_72.2 => constants.%r.patt.0e2 // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: %require_complete.loc27 => constants.%complete_type.357 @@ -2757,7 +3383,7 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %Optional.Get.specific_fn: = specific_function %Optional.Get.6bf, @Optional.Get(%OptionalStorage.facet.642) [concrete] // CHECK:STDOUT: %operator_PlusEqual__carbon_thunk.type: type = fn_type @operator_PlusEqual__carbon_thunk [concrete] // CHECK:STDOUT: %operator_PlusEqual__carbon_thunk: %operator_PlusEqual__carbon_thunk.type = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.Op.type.1d8f74.7: type = fn_type @Destroy.Op.loc32_31.6 [concrete] +// CHECK:STDOUT: %Destroy.Op.type.1d8f74.7: type = fn_type @Destroy.Op.loc31_31.6 [concrete] // CHECK:STDOUT: %Destroy.Op.1a2547.7: %Destroy.Op.type.1d8f74.7 = struct_value () [concrete] // CHECK:STDOUT: %Destroy.lookup_impl_witness.f37: = lookup_impl_witness %impl.elem1.46a, @Destroy [symbolic] // CHECK:STDOUT: %Destroy.WithSelf.Op.type.e7e: type = fn_type @Destroy.WithSelf.Op, @Destroy.WithSelf(%impl.elem1.46a) [symbolic] @@ -2800,153 +3426,190 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %MutableRange.decl: type = class_decl @MutableRange [concrete = constants.%MutableRange] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Test(%R.loc28_10.2: %Iterate_where.type.99d) { +// CHECK:STDOUT: generic fn @TestIterate(%R.loc27_17.2: %Iterate_where.type.99d) { // CHECK:STDOUT: // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: -// CHECK:STDOUT: %Iterate.lookup_impl_witness: = lookup_impl_witness %R.loc28_10.1, @Iterate [symbolic = %Iterate.lookup_impl_witness (constants.%Iterate.lookup_impl_witness.8b4)] -// CHECK:STDOUT: %Iterate.facet.loc32_31.5: %Iterate.type = facet_value %R.as_type.loc28_67.1, (%Iterate.lookup_impl_witness) [symbolic = %Iterate.facet.loc32_31.5 (constants.%Iterate.facet)] -// CHECK:STDOUT: %Iterate.WithSelf.NewCursor.type: type = fn_type @Iterate.WithSelf.NewCursor, @Iterate.WithSelf(%Iterate.facet.loc32_31.5) [symbolic = %Iterate.WithSelf.NewCursor.type (constants.%Iterate.WithSelf.NewCursor.type.217)] -// CHECK:STDOUT: %.loc32_31.20: type = fn_type_with_self_type %Iterate.WithSelf.NewCursor.type, %Iterate.facet.loc32_31.5 [symbolic = %.loc32_31.20 (constants.%.a27)] -// CHECK:STDOUT: %impl.elem2.loc32_31.2: @Test.%.loc32_31.20 (%.a27) = impl_witness_access %Iterate.lookup_impl_witness, element2 [symbolic = %impl.elem2.loc32_31.2 (constants.%impl.elem2.7c0)] -// CHECK:STDOUT: %specific_impl_fn.loc32_31.4: = specific_impl_function %impl.elem2.loc32_31.2, @Iterate.WithSelf.NewCursor(%Iterate.facet.loc32_31.5) [symbolic = %specific_impl_fn.loc32_31.4 (constants.%specific_impl_fn.e23)] +// CHECK:STDOUT: %Iterate.lookup_impl_witness: = lookup_impl_witness %R.loc27_17.1, @Iterate [symbolic = %Iterate.lookup_impl_witness (constants.%Iterate.lookup_impl_witness.8b4)] +// CHECK:STDOUT: %Iterate.facet.loc31_31.5: %Iterate.type = facet_value %R.as_type.loc27_74.1, (%Iterate.lookup_impl_witness) [symbolic = %Iterate.facet.loc31_31.5 (constants.%Iterate.facet)] +// CHECK:STDOUT: %Iterate.WithSelf.NewCursor.type: type = fn_type @Iterate.WithSelf.NewCursor, @Iterate.WithSelf(%Iterate.facet.loc31_31.5) [symbolic = %Iterate.WithSelf.NewCursor.type (constants.%Iterate.WithSelf.NewCursor.type.217)] +// CHECK:STDOUT: %.loc31_31.20: type = fn_type_with_self_type %Iterate.WithSelf.NewCursor.type, %Iterate.facet.loc31_31.5 [symbolic = %.loc31_31.20 (constants.%.a27)] +// CHECK:STDOUT: %impl.elem2.loc31_31.2: @TestIterate.%.loc31_31.20 (%.a27) = impl_witness_access %Iterate.lookup_impl_witness, element2 [symbolic = %impl.elem2.loc31_31.2 (constants.%impl.elem2.7c0)] +// CHECK:STDOUT: %specific_impl_fn.loc31_31.4: = specific_impl_function %impl.elem2.loc31_31.2, @Iterate.WithSelf.NewCursor(%Iterate.facet.loc31_31.5) [symbolic = %specific_impl_fn.loc31_31.4 (constants.%specific_impl_fn.e23)] // CHECK:STDOUT: // CHECK:STDOUT: %ptr: type = ptr_type %as_type [symbolic = %ptr (constants.%ptr.530)] -// CHECK:STDOUT: %Iterate.WithSelf.Next.type: type = fn_type @Iterate.WithSelf.Next, @Iterate.WithSelf(%Iterate.facet.loc32_31.5) [symbolic = %Iterate.WithSelf.Next.type (constants.%Iterate.WithSelf.Next.type.10a)] -// CHECK:STDOUT: %.loc32_31.21: type = fn_type_with_self_type %Iterate.WithSelf.Next.type, %Iterate.facet.loc32_31.5 [symbolic = %.loc32_31.21 (constants.%.df57)] -// CHECK:STDOUT: %impl.elem3.loc32_31.2: @Test.%.loc32_31.21 (%.df57) = impl_witness_access %Iterate.lookup_impl_witness, element3 [symbolic = %impl.elem3.loc32_31.2 (constants.%impl.elem3.199)] -// CHECK:STDOUT: %specific_impl_fn.loc32_31.5: = specific_impl_function %impl.elem3.loc32_31.2, @Iterate.WithSelf.Next(%Iterate.facet.loc32_31.5) [symbolic = %specific_impl_fn.loc32_31.5 (constants.%specific_impl_fn.169)] +// CHECK:STDOUT: %Iterate.WithSelf.Next.type: type = fn_type @Iterate.WithSelf.Next, @Iterate.WithSelf(%Iterate.facet.loc31_31.5) [symbolic = %Iterate.WithSelf.Next.type (constants.%Iterate.WithSelf.Next.type.10a)] +// CHECK:STDOUT: %.loc31_31.21: type = fn_type_with_self_type %Iterate.WithSelf.Next.type, %Iterate.facet.loc31_31.5 [symbolic = %.loc31_31.21 (constants.%.df57)] +// CHECK:STDOUT: %impl.elem3.loc31_31.2: @TestIterate.%.loc31_31.21 (%.df57) = impl_witness_access %Iterate.lookup_impl_witness, element3 [symbolic = %impl.elem3.loc31_31.2 (constants.%impl.elem3.199)] +// CHECK:STDOUT: %specific_impl_fn.loc31_31.5: = specific_impl_function %impl.elem3.loc31_31.2, @Iterate.WithSelf.Next(%Iterate.facet.loc31_31.5) [symbolic = %specific_impl_fn.loc31_31.5 (constants.%specific_impl_fn.169)] // CHECK:STDOUT: %Destroy.WithSelf.Op.type: type = fn_type @Destroy.WithSelf.Op, @Destroy.WithSelf(%impl.elem1) [symbolic = %Destroy.WithSelf.Op.type (constants.%Destroy.WithSelf.Op.type.e7e)] -// CHECK:STDOUT: %.loc32_31.22: type = fn_type_with_self_type %Destroy.WithSelf.Op.type, %impl.elem1 [symbolic = %.loc32_31.22 (constants.%.bc1)] +// CHECK:STDOUT: %.loc31_31.22: type = fn_type_with_self_type %Destroy.WithSelf.Op.type, %impl.elem1 [symbolic = %.loc31_31.22 (constants.%.bc1)] // CHECK:STDOUT: %Destroy.lookup_impl_witness: = lookup_impl_witness %impl.elem1, @Destroy [symbolic = %Destroy.lookup_impl_witness (constants.%Destroy.lookup_impl_witness.f37)] -// CHECK:STDOUT: %impl.elem0.loc32_31.2: @Test.%.loc32_31.22 (%.bc1) = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc32_31.2 (constants.%impl.elem0.c7c)] -// CHECK:STDOUT: %specific_impl_fn.loc32_31.6: = specific_impl_function %impl.elem0.loc32_31.2, @Destroy.WithSelf.Op(%impl.elem1) [symbolic = %specific_impl_fn.loc32_31.6 (constants.%specific_impl_fn.cd3)] +// CHECK:STDOUT: %impl.elem0.loc31_31.2: @TestIterate.%.loc31_31.22 (%.bc1) = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc31_31.2 (constants.%impl.elem0.c7c)] +// CHECK:STDOUT: %specific_impl_fn.loc31_31.6: = specific_impl_function %impl.elem0.loc31_31.2, @Destroy.WithSelf.Op(%impl.elem1) [symbolic = %specific_impl_fn.loc31_31.6 (constants.%specific_impl_fn.cd3)] // CHECK:STDOUT: -// CHECK:STDOUT: fn(%r.param: @Test.%R.as_type.loc28_67.1 (%R.as_type.a62)) { +// CHECK:STDOUT: fn(%r.param: @TestIterate.%R.as_type.loc27_74.1 (%R.as_type.a62)) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %i.patt: %pattern_type.e41 = value_binding_pattern i [concrete = constants.%i.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %r.ref: @Test.%R.as_type.loc28_67.1 (%R.as_type.a62) = name_ref r, %r -// CHECK:STDOUT: %impl.elem2.loc32_31.1: @Test.%.loc32_31.20 (%.a27) = impl_witness_access constants.%Iterate.lookup_impl_witness.8b4, element2 [symbolic = %impl.elem2.loc32_31.2 (constants.%impl.elem2.7c0)] -// CHECK:STDOUT: %bound_method.loc32_31.1: = bound_method %r.ref, %impl.elem2.loc32_31.1 -// CHECK:STDOUT: %Iterate.facet.loc32_31.1: %Iterate.type = facet_value constants.%R.as_type.a62, (constants.%Iterate.lookup_impl_witness.8b4) [symbolic = %Iterate.facet.loc32_31.5 (constants.%Iterate.facet)] -// CHECK:STDOUT: %.loc32_31.1: %Iterate.type = converted constants.%R.as_type.a62, %Iterate.facet.loc32_31.1 [symbolic = %Iterate.facet.loc32_31.5 (constants.%Iterate.facet)] -// CHECK:STDOUT: %Iterate.facet.loc32_31.2: %Iterate.type = facet_value constants.%R.as_type.a62, (constants.%Iterate.lookup_impl_witness.8b4) [symbolic = %Iterate.facet.loc32_31.5 (constants.%Iterate.facet)] -// CHECK:STDOUT: %.loc32_31.2: %Iterate.type = converted constants.%R.as_type.a62, %Iterate.facet.loc32_31.2 [symbolic = %Iterate.facet.loc32_31.5 (constants.%Iterate.facet)] -// CHECK:STDOUT: %specific_impl_fn.loc32_31.1: = specific_impl_function %impl.elem2.loc32_31.1, @Iterate.WithSelf.NewCursor(constants.%Iterate.facet) [symbolic = %specific_impl_fn.loc32_31.4 (constants.%specific_impl_fn.e23)] -// CHECK:STDOUT: %bound_method.loc32_31.2: = bound_method %r.ref, %specific_impl_fn.loc32_31.1 -// CHECK:STDOUT: %var: ref @Test.%as_type (%as_type.862) = var invalid -// CHECK:STDOUT: %Iterate.WithSelf.NewCursor.call: init @Test.%as_type (%as_type.862) to %var = call %bound_method.loc32_31.2(%r.ref) +// CHECK:STDOUT: %r.ref: @TestIterate.%R.as_type.loc27_74.1 (%R.as_type.a62) = name_ref r, %r +// CHECK:STDOUT: %impl.elem2.loc31_31.1: @TestIterate.%.loc31_31.20 (%.a27) = impl_witness_access constants.%Iterate.lookup_impl_witness.8b4, element2 [symbolic = %impl.elem2.loc31_31.2 (constants.%impl.elem2.7c0)] +// CHECK:STDOUT: %bound_method.loc31_31.1: = bound_method %r.ref, %impl.elem2.loc31_31.1 +// CHECK:STDOUT: %Iterate.facet.loc31_31.1: %Iterate.type = facet_value constants.%R.as_type.a62, (constants.%Iterate.lookup_impl_witness.8b4) [symbolic = %Iterate.facet.loc31_31.5 (constants.%Iterate.facet)] +// CHECK:STDOUT: %.loc31_31.1: %Iterate.type = converted constants.%R.as_type.a62, %Iterate.facet.loc31_31.1 [symbolic = %Iterate.facet.loc31_31.5 (constants.%Iterate.facet)] +// CHECK:STDOUT: %Iterate.facet.loc31_31.2: %Iterate.type = facet_value constants.%R.as_type.a62, (constants.%Iterate.lookup_impl_witness.8b4) [symbolic = %Iterate.facet.loc31_31.5 (constants.%Iterate.facet)] +// CHECK:STDOUT: %.loc31_31.2: %Iterate.type = converted constants.%R.as_type.a62, %Iterate.facet.loc31_31.2 [symbolic = %Iterate.facet.loc31_31.5 (constants.%Iterate.facet)] +// CHECK:STDOUT: %specific_impl_fn.loc31_31.1: = specific_impl_function %impl.elem2.loc31_31.1, @Iterate.WithSelf.NewCursor(constants.%Iterate.facet) [symbolic = %specific_impl_fn.loc31_31.4 (constants.%specific_impl_fn.e23)] +// CHECK:STDOUT: %bound_method.loc31_31.2: = bound_method %r.ref, %specific_impl_fn.loc31_31.1 +// CHECK:STDOUT: %var: ref @TestIterate.%as_type (%as_type.862) = var invalid +// CHECK:STDOUT: %Iterate.WithSelf.NewCursor.call: init @TestIterate.%as_type (%as_type.862) to %var = call %bound_method.loc31_31.2(%r.ref) // CHECK:STDOUT: assign %var, %Iterate.WithSelf.NewCursor.call // CHECK:STDOUT: br !for.next // CHECK:STDOUT: // CHECK:STDOUT: !for.next: -// CHECK:STDOUT: %addr.loc32: @Test.%ptr (%ptr.530) = addr_of %var -// CHECK:STDOUT: %impl.elem3.loc32_31.1: @Test.%.loc32_31.21 (%.df57) = impl_witness_access constants.%Iterate.lookup_impl_witness.8b4, element3 [symbolic = %impl.elem3.loc32_31.2 (constants.%impl.elem3.199)] -// CHECK:STDOUT: %bound_method.loc32_31.3: = bound_method %r.ref, %impl.elem3.loc32_31.1 -// CHECK:STDOUT: %Iterate.facet.loc32_31.3: %Iterate.type = facet_value constants.%R.as_type.a62, (constants.%Iterate.lookup_impl_witness.8b4) [symbolic = %Iterate.facet.loc32_31.5 (constants.%Iterate.facet)] -// CHECK:STDOUT: %.loc32_31.3: %Iterate.type = converted constants.%R.as_type.a62, %Iterate.facet.loc32_31.3 [symbolic = %Iterate.facet.loc32_31.5 (constants.%Iterate.facet)] -// CHECK:STDOUT: %Iterate.facet.loc32_31.4: %Iterate.type = facet_value constants.%R.as_type.a62, (constants.%Iterate.lookup_impl_witness.8b4) [symbolic = %Iterate.facet.loc32_31.5 (constants.%Iterate.facet)] -// CHECK:STDOUT: %.loc32_31.4: %Iterate.type = converted constants.%R.as_type.a62, %Iterate.facet.loc32_31.4 [symbolic = %Iterate.facet.loc32_31.5 (constants.%Iterate.facet)] -// CHECK:STDOUT: %.loc32_31.5: %Destroy.type = converted constants.%as_type.862, constants.%impl.elem1.46a [symbolic = %impl.elem1 (constants.%impl.elem1.46a)] -// CHECK:STDOUT: %.loc32_31.6: %Destroy.type = converted constants.%as_type.862, constants.%impl.elem1.46a [symbolic = %impl.elem1 (constants.%impl.elem1.46a)] -// CHECK:STDOUT: %specific_impl_fn.loc32_31.2: = specific_impl_function %impl.elem3.loc32_31.1, @Iterate.WithSelf.Next(constants.%Iterate.facet) [symbolic = %specific_impl_fn.loc32_31.5 (constants.%specific_impl_fn.169)] -// CHECK:STDOUT: %bound_method.loc32_31.4: = bound_method %r.ref, %specific_impl_fn.loc32_31.2 -// CHECK:STDOUT: %.loc32_31.7: ref %Optional.be6 = temporary_storage -// CHECK:STDOUT: %Iterate.WithSelf.Next.call: init %Optional.be6 to %.loc32_31.7 = call %bound_method.loc32_31.4(%r.ref, %addr.loc32) -// CHECK:STDOUT: %.loc32_31.8: ref %Optional.be6 = temporary %.loc32_31.7, %Iterate.WithSelf.Next.call -// CHECK:STDOUT: %.loc32_31.9: %Optional.HasValue.type.2bf = specific_constant imports.%Core.import_ref.bb6, @Optional(constants.%OptionalStorage.facet.642) [concrete = constants.%Optional.HasValue.cdf] -// CHECK:STDOUT: %HasValue.ref: %Optional.HasValue.type.2bf = name_ref HasValue, %.loc32_31.9 [concrete = constants.%Optional.HasValue.cdf] -// CHECK:STDOUT: %Optional.HasValue.bound: = bound_method %.loc32_31.8, %HasValue.ref +// CHECK:STDOUT: %addr.loc31: @TestIterate.%ptr (%ptr.530) = addr_of %var +// CHECK:STDOUT: %impl.elem3.loc31_31.1: @TestIterate.%.loc31_31.21 (%.df57) = impl_witness_access constants.%Iterate.lookup_impl_witness.8b4, element3 [symbolic = %impl.elem3.loc31_31.2 (constants.%impl.elem3.199)] +// CHECK:STDOUT: %bound_method.loc31_31.3: = bound_method %r.ref, %impl.elem3.loc31_31.1 +// CHECK:STDOUT: %Iterate.facet.loc31_31.3: %Iterate.type = facet_value constants.%R.as_type.a62, (constants.%Iterate.lookup_impl_witness.8b4) [symbolic = %Iterate.facet.loc31_31.5 (constants.%Iterate.facet)] +// CHECK:STDOUT: %.loc31_31.3: %Iterate.type = converted constants.%R.as_type.a62, %Iterate.facet.loc31_31.3 [symbolic = %Iterate.facet.loc31_31.5 (constants.%Iterate.facet)] +// CHECK:STDOUT: %Iterate.facet.loc31_31.4: %Iterate.type = facet_value constants.%R.as_type.a62, (constants.%Iterate.lookup_impl_witness.8b4) [symbolic = %Iterate.facet.loc31_31.5 (constants.%Iterate.facet)] +// CHECK:STDOUT: %.loc31_31.4: %Iterate.type = converted constants.%R.as_type.a62, %Iterate.facet.loc31_31.4 [symbolic = %Iterate.facet.loc31_31.5 (constants.%Iterate.facet)] +// CHECK:STDOUT: %.loc31_31.5: %Destroy.type = converted constants.%as_type.862, constants.%impl.elem1.46a [symbolic = %impl.elem1 (constants.%impl.elem1.46a)] +// CHECK:STDOUT: %.loc31_31.6: %Destroy.type = converted constants.%as_type.862, constants.%impl.elem1.46a [symbolic = %impl.elem1 (constants.%impl.elem1.46a)] +// CHECK:STDOUT: %specific_impl_fn.loc31_31.2: = specific_impl_function %impl.elem3.loc31_31.1, @Iterate.WithSelf.Next(constants.%Iterate.facet) [symbolic = %specific_impl_fn.loc31_31.5 (constants.%specific_impl_fn.169)] +// CHECK:STDOUT: %bound_method.loc31_31.4: = bound_method %r.ref, %specific_impl_fn.loc31_31.2 +// CHECK:STDOUT: %.loc31_31.7: ref %Optional.be6 = temporary_storage +// CHECK:STDOUT: %Iterate.WithSelf.Next.call: init %Optional.be6 to %.loc31_31.7 = call %bound_method.loc31_31.4(%r.ref, %addr.loc31) +// CHECK:STDOUT: %.loc31_31.8: ref %Optional.be6 = temporary %.loc31_31.7, %Iterate.WithSelf.Next.call +// CHECK:STDOUT: %.loc31_31.9: %Optional.HasValue.type.2bf = specific_constant imports.%Core.import_ref.bb6, @Optional(constants.%OptionalStorage.facet.642) [concrete = constants.%Optional.HasValue.cdf] +// CHECK:STDOUT: %HasValue.ref: %Optional.HasValue.type.2bf = name_ref HasValue, %.loc31_31.9 [concrete = constants.%Optional.HasValue.cdf] +// CHECK:STDOUT: %Optional.HasValue.bound: = bound_method %.loc31_31.8, %HasValue.ref // CHECK:STDOUT: %Optional.HasValue.specific_fn: = specific_function %HasValue.ref, @Optional.HasValue(constants.%OptionalStorage.facet.642) [concrete = constants.%Optional.HasValue.specific_fn] -// CHECK:STDOUT: %bound_method.loc32_31.5: = bound_method %.loc32_31.8, %Optional.HasValue.specific_fn -// CHECK:STDOUT: %.loc32_31.10: %Optional.be6 = acquire_value %.loc32_31.8 -// CHECK:STDOUT: %Optional.HasValue.call: init bool = call %bound_method.loc32_31.5(%.loc32_31.10) -// CHECK:STDOUT: %.loc32_31.11: bool = value_of_initializer %Optional.HasValue.call -// CHECK:STDOUT: %.loc32_31.12: bool = converted %Optional.HasValue.call, %.loc32_31.11 -// CHECK:STDOUT: if %.loc32_31.12 br !for.body else br !for.done +// CHECK:STDOUT: %bound_method.loc31_31.5: = bound_method %.loc31_31.8, %Optional.HasValue.specific_fn +// CHECK:STDOUT: %.loc31_31.10: %Optional.be6 = acquire_value %.loc31_31.8 +// CHECK:STDOUT: %Optional.HasValue.call: init bool = call %bound_method.loc31_31.5(%.loc31_31.10) +// CHECK:STDOUT: %.loc31_31.11: bool = value_of_initializer %Optional.HasValue.call +// CHECK:STDOUT: %.loc31_31.12: bool = converted %Optional.HasValue.call, %.loc31_31.11 +// CHECK:STDOUT: if %.loc31_31.12 br !for.body else br !for.done // CHECK:STDOUT: // CHECK:STDOUT: !for.body: -// CHECK:STDOUT: %.loc32_31.13: %Optional.Get.type.112 = specific_constant imports.%Core.import_ref.daba, @Optional(constants.%OptionalStorage.facet.642) [concrete = constants.%Optional.Get.6bf] -// CHECK:STDOUT: %Get.ref: %Optional.Get.type.112 = name_ref Get, %.loc32_31.13 [concrete = constants.%Optional.Get.6bf] -// CHECK:STDOUT: %Optional.Get.bound: = bound_method %.loc32_31.8, %Get.ref +// CHECK:STDOUT: %.loc31_31.13: %Optional.Get.type.112 = specific_constant imports.%Core.import_ref.daba, @Optional(constants.%OptionalStorage.facet.642) [concrete = constants.%Optional.Get.6bf] +// CHECK:STDOUT: %Get.ref: %Optional.Get.type.112 = name_ref Get, %.loc31_31.13 [concrete = constants.%Optional.Get.6bf] +// CHECK:STDOUT: %Optional.Get.bound: = bound_method %.loc31_31.8, %Get.ref // CHECK:STDOUT: %Optional.Get.specific_fn: = specific_function %Get.ref, @Optional.Get(constants.%OptionalStorage.facet.642) [concrete = constants.%Optional.Get.specific_fn] -// CHECK:STDOUT: %bound_method.loc32_31.6: = bound_method %.loc32_31.8, %Optional.Get.specific_fn -// CHECK:STDOUT: %.loc32_31.14: ref %ValueType = temporary_storage -// CHECK:STDOUT: %.loc32_31.15: %Optional.be6 = acquire_value %.loc32_31.8 -// CHECK:STDOUT: %Optional.Get.call: init %ValueType to %.loc32_31.14 = call %bound_method.loc32_31.6(%.loc32_31.15) -// CHECK:STDOUT: %.loc32_31.16: ref %ValueType = temporary %.loc32_31.14, %Optional.Get.call -// CHECK:STDOUT: %.loc32_31.17: %ValueType = acquire_value %.loc32_31.16 -// CHECK:STDOUT: %.loc32_16: type = splice_block %ValueType.ref.loc32 [concrete = constants.%ValueType] { -// CHECK:STDOUT: %Cpp.ref.loc32: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %N.ref.loc32: = name_ref N, imports.%N [concrete = imports.%N] -// CHECK:STDOUT: %ValueType.ref.loc32: type = name_ref ValueType, imports.%ValueType.decl [concrete = constants.%ValueType] +// CHECK:STDOUT: %bound_method.loc31_31.6: = bound_method %.loc31_31.8, %Optional.Get.specific_fn +// CHECK:STDOUT: %.loc31_31.14: ref %ValueType = temporary_storage +// CHECK:STDOUT: %.loc31_31.15: %Optional.be6 = acquire_value %.loc31_31.8 +// CHECK:STDOUT: %Optional.Get.call: init %ValueType to %.loc31_31.14 = call %bound_method.loc31_31.6(%.loc31_31.15) +// CHECK:STDOUT: %.loc31_31.16: ref %ValueType = temporary %.loc31_31.14, %Optional.Get.call +// CHECK:STDOUT: %.loc31_31.17: %ValueType = acquire_value %.loc31_31.16 +// CHECK:STDOUT: %.loc31_16: type = splice_block %ValueType.ref.loc31 [concrete = constants.%ValueType] { +// CHECK:STDOUT: %Cpp.ref.loc31: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %N.ref.loc31: = name_ref N, imports.%N [concrete = imports.%N] +// CHECK:STDOUT: %ValueType.ref.loc31: type = name_ref ValueType, imports.%ValueType.decl [concrete = constants.%ValueType] // CHECK:STDOUT: } -// CHECK:STDOUT: %i: %ValueType = value_binding i, %.loc32_31.17 +// CHECK:STDOUT: %i: %ValueType = value_binding i, %.loc31_31.17 // CHECK:STDOUT: %sum.ref: ref %ValueType = name_ref sum, %sum // CHECK:STDOUT: %i.ref: %ValueType = name_ref i, %i -// CHECK:STDOUT: %.loc33_12: ref %ValueType = value_as_ref %i.ref -// CHECK:STDOUT: %addr.loc33: %ptr.9d3 = addr_of %.loc33_12 -// CHECK:STDOUT: %.loc33_9.1: %ptr.32e = as_compatible %addr.loc33 -// CHECK:STDOUT: %.loc33_9.2: %ptr.32e = converted %addr.loc33, %.loc33_9.1 -// CHECK:STDOUT: %operator_PlusEqual__carbon_thunk.call: ref %ValueType = call imports.%operator_PlusEqual__carbon_thunk.decl(%sum.ref, %.loc33_9.2) +// CHECK:STDOUT: %.loc32_12: ref %ValueType = value_as_ref %i.ref +// CHECK:STDOUT: %addr.loc32: %ptr.9d3 = addr_of %.loc32_12 +// CHECK:STDOUT: %.loc32_9.1: %ptr.32e = as_compatible %addr.loc32 +// CHECK:STDOUT: %.loc32_9.2: %ptr.32e = converted %addr.loc32, %.loc32_9.1 +// CHECK:STDOUT: %operator_PlusEqual__carbon_thunk.call: ref %ValueType = call imports.%operator_PlusEqual__carbon_thunk.decl(%sum.ref, %.loc32_9.2) // CHECK:STDOUT: br !for.next // CHECK:STDOUT: // CHECK:STDOUT: !for.done: -// CHECK:STDOUT: %ValueType.Op.bound.loc32: = bound_method %.loc32_31.16, constants.%ValueType.Op.4c94b9.1 -// CHECK:STDOUT: %Op.ref.loc32: %ValueType.cpp_destructor.type = name_ref Op, imports.%ValueType.cpp_destructor.decl [concrete = constants.%ValueType.cpp_destructor] -// CHECK:STDOUT: %ValueType.cpp_destructor.bound.loc32: = bound_method %.loc32_31.16, %Op.ref.loc32 -// CHECK:STDOUT: %ValueType.cpp_destructor.call.loc32: init %empty_tuple.type = call %ValueType.cpp_destructor.bound.loc32(%.loc32_31.16) -// CHECK:STDOUT: %Destroy.Op.bound: = bound_method %.loc32_31.8, constants.%Destroy.Op.1a2547.7 -// CHECK:STDOUT: %Destroy.Op.call: init %empty_tuple.type = call %Destroy.Op.bound(%.loc32_31.8) -// CHECK:STDOUT: %impl.elem0.loc32_31.1: @Test.%.loc32_31.22 (%.bc1) = impl_witness_access constants.%Destroy.lookup_impl_witness.f37, element0 [symbolic = %impl.elem0.loc32_31.2 (constants.%impl.elem0.c7c)] -// CHECK:STDOUT: %bound_method.loc32_31.7: = bound_method %var, %impl.elem0.loc32_31.1 -// CHECK:STDOUT: %.loc32_31.18: %Destroy.type = converted constants.%as_type.862, constants.%impl.elem1.46a [symbolic = %impl.elem1 (constants.%impl.elem1.46a)] -// CHECK:STDOUT: %.loc32_31.19: %Destroy.type = converted constants.%as_type.862, constants.%impl.elem1.46a [symbolic = %impl.elem1 (constants.%impl.elem1.46a)] -// CHECK:STDOUT: %specific_impl_fn.loc32_31.3: = specific_impl_function %impl.elem0.loc32_31.1, @Destroy.WithSelf.Op(constants.%impl.elem1.46a) [symbolic = %specific_impl_fn.loc32_31.6 (constants.%specific_impl_fn.cd3)] -// CHECK:STDOUT: %bound_method.loc32_31.8: = bound_method %var, %specific_impl_fn.loc32_31.3 -// CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call %bound_method.loc32_31.8(%var) +// CHECK:STDOUT: %ValueType.Op.bound.loc31: = bound_method %.loc31_31.16, constants.%ValueType.Op.4c94b9.1 +// CHECK:STDOUT: %Op.ref.loc31: %ValueType.cpp_destructor.type = name_ref Op, imports.%ValueType.cpp_destructor.decl [concrete = constants.%ValueType.cpp_destructor] +// CHECK:STDOUT: %ValueType.cpp_destructor.bound.loc31: = bound_method %.loc31_31.16, %Op.ref.loc31 +// CHECK:STDOUT: %ValueType.cpp_destructor.call.loc31: init %empty_tuple.type = call %ValueType.cpp_destructor.bound.loc31(%.loc31_31.16) +// CHECK:STDOUT: %Destroy.Op.bound: = bound_method %.loc31_31.8, constants.%Destroy.Op.1a2547.7 +// CHECK:STDOUT: %Destroy.Op.call: init %empty_tuple.type = call %Destroy.Op.bound(%.loc31_31.8) +// CHECK:STDOUT: %impl.elem0.loc31_31.1: @TestIterate.%.loc31_31.22 (%.bc1) = impl_witness_access constants.%Destroy.lookup_impl_witness.f37, element0 [symbolic = %impl.elem0.loc31_31.2 (constants.%impl.elem0.c7c)] +// CHECK:STDOUT: %bound_method.loc31_31.7: = bound_method %var, %impl.elem0.loc31_31.1 +// CHECK:STDOUT: %.loc31_31.18: %Destroy.type = converted constants.%as_type.862, constants.%impl.elem1.46a [symbolic = %impl.elem1 (constants.%impl.elem1.46a)] +// CHECK:STDOUT: %.loc31_31.19: %Destroy.type = converted constants.%as_type.862, constants.%impl.elem1.46a [symbolic = %impl.elem1 (constants.%impl.elem1.46a)] +// CHECK:STDOUT: %specific_impl_fn.loc31_31.3: = specific_impl_function %impl.elem0.loc31_31.1, @Destroy.WithSelf.Op(constants.%impl.elem1.46a) [symbolic = %specific_impl_fn.loc31_31.6 (constants.%specific_impl_fn.cd3)] +// CHECK:STDOUT: %bound_method.loc31_31.8: = bound_method %var, %specific_impl_fn.loc31_31.3 +// CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call %bound_method.loc31_31.8(%var) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.Op.loc32_31.1(%self.param: ref %.b36) { +// CHECK:STDOUT: fn @Destroy.Op.loc31_31.1(%self.param: ref %.b36) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.Op.loc32_31.2(%self.param: ref %MaybeUnformed.669) { +// CHECK:STDOUT: fn @Destroy.Op.loc31_31.2(%self.param: ref %MaybeUnformed.669) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.Op.loc32_31.3(%self.param: ref bool) = "no_op"; +// CHECK:STDOUT: fn @Destroy.Op.loc31_31.3(%self.param: ref bool) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.Op.loc32_31.4(%self.param: ref %struct_type.value.has_value.5a1) { +// CHECK:STDOUT: fn @Destroy.Op.loc31_31.4(%self.param: ref %struct_type.value.has_value.5a1) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.Op.loc32_31.5(%self.param: ref %DefaultOptionalStorage.257) { +// CHECK:STDOUT: fn @Destroy.Op.loc31_31.5(%self.param: ref %DefaultOptionalStorage.257) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.Op.loc32_31.6(%self.param: ref %Optional.be6) { +// CHECK:STDOUT: fn @Destroy.Op.loc31_31.6(%self.param: ref %Optional.be6) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Test(constants.%R.623) { -// CHECK:STDOUT: %R.patt.loc28_10.2 => constants.%R.patt.324 -// CHECK:STDOUT: %R.loc28_10.1 => constants.%R.623 -// CHECK:STDOUT: %R.as_type.loc28_67.1 => constants.%R.as_type.a62 +// CHECK:STDOUT: fn @TestRangeFor(%m.param: ref %MutableRange) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: +// CHECK:STDOUT: name_binding_decl { +// CHECK:STDOUT: %i.patt: %pattern_type.e41 = value_binding_pattern i [concrete = constants.%i.patt] +// CHECK:STDOUT: } +// CHECK:STDOUT: %m.ref: ref %MutableRange = name_ref m, %m +// CHECK:STDOUT: %var: ref = var invalid [concrete = ] +// CHECK:STDOUT: assign , +// CHECK:STDOUT: br !for.next +// CHECK:STDOUT: +// CHECK:STDOUT: !for.next: +// CHECK:STDOUT: %addr.loc95: = addr_of [concrete = ] +// CHECK:STDOUT: %HasValue.ref: = name_ref HasValue, [concrete = ] +// CHECK:STDOUT: if br !for.body else br !for.done +// CHECK:STDOUT: +// CHECK:STDOUT: !for.body: +// CHECK:STDOUT: %Get.ref: = name_ref Get, [concrete = ] +// CHECK:STDOUT: %.loc95: type = splice_block %ValueType.ref.loc95 [concrete = constants.%ValueType] { +// CHECK:STDOUT: %Cpp.ref.loc95: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %N.ref.loc95: = name_ref N, imports.%N [concrete = imports.%N] +// CHECK:STDOUT: %ValueType.ref.loc95: type = name_ref ValueType, imports.%ValueType.decl [concrete = constants.%ValueType] +// CHECK:STDOUT: } +// CHECK:STDOUT: %i: %ValueType = value_binding i, [concrete = ] +// CHECK:STDOUT: %sum.ref: ref %ValueType = name_ref sum, %sum +// CHECK:STDOUT: %i.ref: %ValueType = name_ref i, %i [concrete = ] +// CHECK:STDOUT: %.loc96_12: ref %ValueType = value_as_ref %i.ref +// CHECK:STDOUT: %addr.loc96: %ptr.9d3 = addr_of %.loc96_12 +// CHECK:STDOUT: %.loc96_9.1: %ptr.32e = as_compatible %addr.loc96 +// CHECK:STDOUT: %.loc96_9.2: %ptr.32e = converted %addr.loc96, %.loc96_9.1 +// CHECK:STDOUT: %operator_PlusEqual__carbon_thunk.call: ref %ValueType = call imports.%operator_PlusEqual__carbon_thunk.decl(%sum.ref, %.loc96_9.2) +// CHECK:STDOUT: br !for.next +// CHECK:STDOUT: +// CHECK:STDOUT: !for.done: +// CHECK:STDOUT: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @TestIterate(constants.%R.623) { +// CHECK:STDOUT: %R.patt.loc27_17.2 => constants.%R.patt.324 +// CHECK:STDOUT: %R.loc27_17.1 => constants.%R.623 +// CHECK:STDOUT: %R.as_type.loc27_74.1 => constants.%R.as_type.a62 // CHECK:STDOUT: %pattern_type => constants.%pattern_type.725 -// CHECK:STDOUT: %r.param_patt.loc28_65.2 => constants.%r.param_patt -// CHECK:STDOUT: %r.patt.loc28_65.2 => constants.%r.patt +// CHECK:STDOUT: %r.param_patt.loc27_72.2 => constants.%r.param_patt +// CHECK:STDOUT: %r.patt.loc27_72.2 => constants.%r.patt // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- fail_todo_adl_overloads.carbon @@ -3053,7 +3716,7 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %Optional.Get.specific_fn: = specific_function %Optional.Get.5aa, @Optional.Get(%OptionalStorage.facet.7ce) [concrete] // CHECK:STDOUT: %operator_PlusEqual__carbon_thunk.type: type = fn_type @operator_PlusEqual__carbon_thunk [concrete] // CHECK:STDOUT: %operator_PlusEqual__carbon_thunk: %operator_PlusEqual__carbon_thunk.type = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.Op.type.1d8f74.7: type = fn_type @Destroy.Op.loc39_31.6 [concrete] +// CHECK:STDOUT: %Destroy.Op.type.1d8f74.7: type = fn_type @Destroy.Op.loc38_31.6 [concrete] // CHECK:STDOUT: %Destroy.Op.1a2547.7: %Destroy.Op.type.1d8f74.7 = struct_value () [concrete] // CHECK:STDOUT: %Destroy.lookup_impl_witness.f37: = lookup_impl_witness %impl.elem1.46a, @Destroy [symbolic] // CHECK:STDOUT: %Destroy.WithSelf.Op.type.e7e: type = fn_type @Destroy.WithSelf.Op, @Destroy.WithSelf(%impl.elem1.46a) [symbolic] @@ -3101,15 +3764,15 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %r.param_patt.8bb: %pattern_type.394 = value_param_pattern [concrete] // CHECK:STDOUT: %r.patt.ac4: %pattern_type.394 = at_binding_pattern r, %r.param_patt.8bb [concrete] // CHECK:STDOUT: %Iterate.WithSelf.NewCursor.type.875: type = fn_type @Iterate.WithSelf.NewCursor, @Iterate.WithSelf(%Iterate.facet.5cc) [concrete] +// CHECK:STDOUT: %Iterate.WithSelf.Next.type.b41: type = fn_type @Iterate.WithSelf.Next, @Iterate.WithSelf(%Iterate.facet.5cc) [concrete] // CHECK:STDOUT: %.7e3: type = fn_type_with_self_type %Iterate.WithSelf.NewCursor.type.875, %Iterate.facet.5cc [concrete] // CHECK:STDOUT: %R.as_type.as.Iterate.impl.NewCursor.specific_fn: = specific_function %R.as_type.as.Iterate.impl.NewCursor.96c, @R.as_type.as.Iterate.impl.NewCursor(%facet_value.88d) [concrete] -// CHECK:STDOUT: %complete_type.1b5: = complete_type_witness %tuple.type.56e [concrete] // CHECK:STDOUT: %ptr.484: type = ptr_type %tuple.type.56e [concrete] -// CHECK:STDOUT: %Iterate.WithSelf.Next.type.b41: type = fn_type @Iterate.WithSelf.Next, @Iterate.WithSelf(%Iterate.facet.5cc) [concrete] // CHECK:STDOUT: %.fef: type = fn_type_with_self_type %Iterate.WithSelf.Next.type.b41, %Iterate.facet.5cc [concrete] // CHECK:STDOUT: %R.as_type.as.Iterate.impl.Next.specific_fn: = specific_function %R.as_type.as.Iterate.impl.Next.683, @R.as_type.as.Iterate.impl.Next(%facet_value.88d) [concrete] // CHECK:STDOUT: %Destroy.WithSelf.Op.type.b7b: type = fn_type @Destroy.WithSelf.Op, @Destroy.WithSelf(%Destroy.facet.7aa) [concrete] // CHECK:STDOUT: %.1ad: type = fn_type_with_self_type %Destroy.WithSelf.Op.type.b7b, %Destroy.facet.7aa [concrete] +// CHECK:STDOUT: %complete_type.1b5: = complete_type_witness %tuple.type.56e [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { @@ -3150,183 +3813,267 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %MutableAndConstRange.decl: type = class_decl @MutableAndConstRange [concrete = constants.%MutableAndConstRange] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: generic fn @Test(%R.loc35_10.2: %Iterate_where.type.99d) { +// CHECK:STDOUT: generic fn @TestIterate(%R.loc34_17.2: %Iterate_where.type.99d) { // CHECK:STDOUT: // CHECK:STDOUT: // CHECK:STDOUT: !definition: // CHECK:STDOUT: -// CHECK:STDOUT: %Iterate.lookup_impl_witness: = lookup_impl_witness %R.loc35_10.1, @Iterate [symbolic = %Iterate.lookup_impl_witness (constants.%Iterate.lookup_impl_witness.8b4)] -// CHECK:STDOUT: %Iterate.facet.loc39_31.5: %Iterate.type = facet_value %R.as_type.loc35_67.1, (%Iterate.lookup_impl_witness) [symbolic = %Iterate.facet.loc39_31.5 (constants.%Iterate.facet.b19)] -// CHECK:STDOUT: %Iterate.WithSelf.NewCursor.type: type = fn_type @Iterate.WithSelf.NewCursor, @Iterate.WithSelf(%Iterate.facet.loc39_31.5) [symbolic = %Iterate.WithSelf.NewCursor.type (constants.%Iterate.WithSelf.NewCursor.type.217)] -// CHECK:STDOUT: %.loc39_31.20: type = fn_type_with_self_type %Iterate.WithSelf.NewCursor.type, %Iterate.facet.loc39_31.5 [symbolic = %.loc39_31.20 (constants.%.a27)] -// CHECK:STDOUT: %impl.elem2.loc39_31.2: @Test.%.loc39_31.20 (%.a27) = impl_witness_access %Iterate.lookup_impl_witness, element2 [symbolic = %impl.elem2.loc39_31.2 (constants.%impl.elem2.7c0)] -// CHECK:STDOUT: %specific_impl_fn.loc39_31.4: = specific_impl_function %impl.elem2.loc39_31.2, @Iterate.WithSelf.NewCursor(%Iterate.facet.loc39_31.5) [symbolic = %specific_impl_fn.loc39_31.4 (constants.%specific_impl_fn.e23)] +// CHECK:STDOUT: %Iterate.lookup_impl_witness: = lookup_impl_witness %R.loc34_17.1, @Iterate [symbolic = %Iterate.lookup_impl_witness (constants.%Iterate.lookup_impl_witness.8b4)] +// CHECK:STDOUT: %Iterate.facet.loc38_31.5: %Iterate.type = facet_value %R.as_type.loc34_74.1, (%Iterate.lookup_impl_witness) [symbolic = %Iterate.facet.loc38_31.5 (constants.%Iterate.facet.b19)] +// CHECK:STDOUT: %Iterate.WithSelf.NewCursor.type: type = fn_type @Iterate.WithSelf.NewCursor, @Iterate.WithSelf(%Iterate.facet.loc38_31.5) [symbolic = %Iterate.WithSelf.NewCursor.type (constants.%Iterate.WithSelf.NewCursor.type.217)] +// CHECK:STDOUT: %.loc38_31.20: type = fn_type_with_self_type %Iterate.WithSelf.NewCursor.type, %Iterate.facet.loc38_31.5 [symbolic = %.loc38_31.20 (constants.%.a27)] +// CHECK:STDOUT: %impl.elem2.loc38_31.2: @TestIterate.%.loc38_31.20 (%.a27) = impl_witness_access %Iterate.lookup_impl_witness, element2 [symbolic = %impl.elem2.loc38_31.2 (constants.%impl.elem2.7c0)] +// CHECK:STDOUT: %specific_impl_fn.loc38_31.4: = specific_impl_function %impl.elem2.loc38_31.2, @Iterate.WithSelf.NewCursor(%Iterate.facet.loc38_31.5) [symbolic = %specific_impl_fn.loc38_31.4 (constants.%specific_impl_fn.e23)] // CHECK:STDOUT: // CHECK:STDOUT: %ptr: type = ptr_type %as_type [symbolic = %ptr (constants.%ptr.530)] -// CHECK:STDOUT: %Iterate.WithSelf.Next.type: type = fn_type @Iterate.WithSelf.Next, @Iterate.WithSelf(%Iterate.facet.loc39_31.5) [symbolic = %Iterate.WithSelf.Next.type (constants.%Iterate.WithSelf.Next.type.10a)] -// CHECK:STDOUT: %.loc39_31.21: type = fn_type_with_self_type %Iterate.WithSelf.Next.type, %Iterate.facet.loc39_31.5 [symbolic = %.loc39_31.21 (constants.%.df57)] -// CHECK:STDOUT: %impl.elem3.loc39_31.2: @Test.%.loc39_31.21 (%.df57) = impl_witness_access %Iterate.lookup_impl_witness, element3 [symbolic = %impl.elem3.loc39_31.2 (constants.%impl.elem3.199)] -// CHECK:STDOUT: %specific_impl_fn.loc39_31.5: = specific_impl_function %impl.elem3.loc39_31.2, @Iterate.WithSelf.Next(%Iterate.facet.loc39_31.5) [symbolic = %specific_impl_fn.loc39_31.5 (constants.%specific_impl_fn.169)] +// CHECK:STDOUT: %Iterate.WithSelf.Next.type: type = fn_type @Iterate.WithSelf.Next, @Iterate.WithSelf(%Iterate.facet.loc38_31.5) [symbolic = %Iterate.WithSelf.Next.type (constants.%Iterate.WithSelf.Next.type.10a)] +// CHECK:STDOUT: %.loc38_31.21: type = fn_type_with_self_type %Iterate.WithSelf.Next.type, %Iterate.facet.loc38_31.5 [symbolic = %.loc38_31.21 (constants.%.df57)] +// CHECK:STDOUT: %impl.elem3.loc38_31.2: @TestIterate.%.loc38_31.21 (%.df57) = impl_witness_access %Iterate.lookup_impl_witness, element3 [symbolic = %impl.elem3.loc38_31.2 (constants.%impl.elem3.199)] +// CHECK:STDOUT: %specific_impl_fn.loc38_31.5: = specific_impl_function %impl.elem3.loc38_31.2, @Iterate.WithSelf.Next(%Iterate.facet.loc38_31.5) [symbolic = %specific_impl_fn.loc38_31.5 (constants.%specific_impl_fn.169)] // CHECK:STDOUT: %Destroy.WithSelf.Op.type: type = fn_type @Destroy.WithSelf.Op, @Destroy.WithSelf(%impl.elem1) [symbolic = %Destroy.WithSelf.Op.type (constants.%Destroy.WithSelf.Op.type.e7e)] -// CHECK:STDOUT: %.loc39_31.22: type = fn_type_with_self_type %Destroy.WithSelf.Op.type, %impl.elem1 [symbolic = %.loc39_31.22 (constants.%.bc1)] +// CHECK:STDOUT: %.loc38_31.22: type = fn_type_with_self_type %Destroy.WithSelf.Op.type, %impl.elem1 [symbolic = %.loc38_31.22 (constants.%.bc1)] // CHECK:STDOUT: %Destroy.lookup_impl_witness: = lookup_impl_witness %impl.elem1, @Destroy [symbolic = %Destroy.lookup_impl_witness (constants.%Destroy.lookup_impl_witness.f37)] -// CHECK:STDOUT: %impl.elem0.loc39_31.2: @Test.%.loc39_31.22 (%.bc1) = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc39_31.2 (constants.%impl.elem0.c7c)] -// CHECK:STDOUT: %specific_impl_fn.loc39_31.6: = specific_impl_function %impl.elem0.loc39_31.2, @Destroy.WithSelf.Op(%impl.elem1) [symbolic = %specific_impl_fn.loc39_31.6 (constants.%specific_impl_fn.cd3)] +// CHECK:STDOUT: %impl.elem0.loc38_31.2: @TestIterate.%.loc38_31.22 (%.bc1) = impl_witness_access %Destroy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc38_31.2 (constants.%impl.elem0.c7c)] +// CHECK:STDOUT: %specific_impl_fn.loc38_31.6: = specific_impl_function %impl.elem0.loc38_31.2, @Destroy.WithSelf.Op(%impl.elem1) [symbolic = %specific_impl_fn.loc38_31.6 (constants.%specific_impl_fn.cd3)] // CHECK:STDOUT: -// CHECK:STDOUT: fn(%r.param: @Test.%R.as_type.loc35_67.1 (%R.as_type.a62)) { +// CHECK:STDOUT: fn(%r.param: @TestIterate.%R.as_type.loc34_74.1 (%R.as_type.a62)) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %i.patt: %pattern_type.e41 = value_binding_pattern i [concrete = constants.%i.patt] // CHECK:STDOUT: } -// CHECK:STDOUT: %r.ref: @Test.%R.as_type.loc35_67.1 (%R.as_type.a62) = name_ref r, %r -// CHECK:STDOUT: %impl.elem2.loc39_31.1: @Test.%.loc39_31.20 (%.a27) = impl_witness_access constants.%Iterate.lookup_impl_witness.8b4, element2 [symbolic = %impl.elem2.loc39_31.2 (constants.%impl.elem2.7c0)] -// CHECK:STDOUT: %bound_method.loc39_31.1: = bound_method %r.ref, %impl.elem2.loc39_31.1 -// CHECK:STDOUT: %Iterate.facet.loc39_31.1: %Iterate.type = facet_value constants.%R.as_type.a62, (constants.%Iterate.lookup_impl_witness.8b4) [symbolic = %Iterate.facet.loc39_31.5 (constants.%Iterate.facet.b19)] -// CHECK:STDOUT: %.loc39_31.1: %Iterate.type = converted constants.%R.as_type.a62, %Iterate.facet.loc39_31.1 [symbolic = %Iterate.facet.loc39_31.5 (constants.%Iterate.facet.b19)] -// CHECK:STDOUT: %Iterate.facet.loc39_31.2: %Iterate.type = facet_value constants.%R.as_type.a62, (constants.%Iterate.lookup_impl_witness.8b4) [symbolic = %Iterate.facet.loc39_31.5 (constants.%Iterate.facet.b19)] -// CHECK:STDOUT: %.loc39_31.2: %Iterate.type = converted constants.%R.as_type.a62, %Iterate.facet.loc39_31.2 [symbolic = %Iterate.facet.loc39_31.5 (constants.%Iterate.facet.b19)] -// CHECK:STDOUT: %specific_impl_fn.loc39_31.1: = specific_impl_function %impl.elem2.loc39_31.1, @Iterate.WithSelf.NewCursor(constants.%Iterate.facet.b19) [symbolic = %specific_impl_fn.loc39_31.4 (constants.%specific_impl_fn.e23)] -// CHECK:STDOUT: %bound_method.loc39_31.2: = bound_method %r.ref, %specific_impl_fn.loc39_31.1 -// CHECK:STDOUT: %var: ref @Test.%as_type (%as_type.862) = var invalid -// CHECK:STDOUT: %Iterate.WithSelf.NewCursor.call: init @Test.%as_type (%as_type.862) to %var = call %bound_method.loc39_31.2(%r.ref) +// CHECK:STDOUT: %r.ref: @TestIterate.%R.as_type.loc34_74.1 (%R.as_type.a62) = name_ref r, %r +// CHECK:STDOUT: %impl.elem2.loc38_31.1: @TestIterate.%.loc38_31.20 (%.a27) = impl_witness_access constants.%Iterate.lookup_impl_witness.8b4, element2 [symbolic = %impl.elem2.loc38_31.2 (constants.%impl.elem2.7c0)] +// CHECK:STDOUT: %bound_method.loc38_31.1: = bound_method %r.ref, %impl.elem2.loc38_31.1 +// CHECK:STDOUT: %Iterate.facet.loc38_31.1: %Iterate.type = facet_value constants.%R.as_type.a62, (constants.%Iterate.lookup_impl_witness.8b4) [symbolic = %Iterate.facet.loc38_31.5 (constants.%Iterate.facet.b19)] +// CHECK:STDOUT: %.loc38_31.1: %Iterate.type = converted constants.%R.as_type.a62, %Iterate.facet.loc38_31.1 [symbolic = %Iterate.facet.loc38_31.5 (constants.%Iterate.facet.b19)] +// CHECK:STDOUT: %Iterate.facet.loc38_31.2: %Iterate.type = facet_value constants.%R.as_type.a62, (constants.%Iterate.lookup_impl_witness.8b4) [symbolic = %Iterate.facet.loc38_31.5 (constants.%Iterate.facet.b19)] +// CHECK:STDOUT: %.loc38_31.2: %Iterate.type = converted constants.%R.as_type.a62, %Iterate.facet.loc38_31.2 [symbolic = %Iterate.facet.loc38_31.5 (constants.%Iterate.facet.b19)] +// CHECK:STDOUT: %specific_impl_fn.loc38_31.1: = specific_impl_function %impl.elem2.loc38_31.1, @Iterate.WithSelf.NewCursor(constants.%Iterate.facet.b19) [symbolic = %specific_impl_fn.loc38_31.4 (constants.%specific_impl_fn.e23)] +// CHECK:STDOUT: %bound_method.loc38_31.2: = bound_method %r.ref, %specific_impl_fn.loc38_31.1 +// CHECK:STDOUT: %var: ref @TestIterate.%as_type (%as_type.862) = var invalid +// CHECK:STDOUT: %Iterate.WithSelf.NewCursor.call: init @TestIterate.%as_type (%as_type.862) to %var = call %bound_method.loc38_31.2(%r.ref) // CHECK:STDOUT: assign %var, %Iterate.WithSelf.NewCursor.call // CHECK:STDOUT: br !for.next // CHECK:STDOUT: // CHECK:STDOUT: !for.next: -// CHECK:STDOUT: %addr.loc39: @Test.%ptr (%ptr.530) = addr_of %var -// CHECK:STDOUT: %impl.elem3.loc39_31.1: @Test.%.loc39_31.21 (%.df57) = impl_witness_access constants.%Iterate.lookup_impl_witness.8b4, element3 [symbolic = %impl.elem3.loc39_31.2 (constants.%impl.elem3.199)] -// CHECK:STDOUT: %bound_method.loc39_31.3: = bound_method %r.ref, %impl.elem3.loc39_31.1 -// CHECK:STDOUT: %Iterate.facet.loc39_31.3: %Iterate.type = facet_value constants.%R.as_type.a62, (constants.%Iterate.lookup_impl_witness.8b4) [symbolic = %Iterate.facet.loc39_31.5 (constants.%Iterate.facet.b19)] -// CHECK:STDOUT: %.loc39_31.3: %Iterate.type = converted constants.%R.as_type.a62, %Iterate.facet.loc39_31.3 [symbolic = %Iterate.facet.loc39_31.5 (constants.%Iterate.facet.b19)] -// CHECK:STDOUT: %Iterate.facet.loc39_31.4: %Iterate.type = facet_value constants.%R.as_type.a62, (constants.%Iterate.lookup_impl_witness.8b4) [symbolic = %Iterate.facet.loc39_31.5 (constants.%Iterate.facet.b19)] -// CHECK:STDOUT: %.loc39_31.4: %Iterate.type = converted constants.%R.as_type.a62, %Iterate.facet.loc39_31.4 [symbolic = %Iterate.facet.loc39_31.5 (constants.%Iterate.facet.b19)] -// CHECK:STDOUT: %.loc39_31.5: %Destroy.type = converted constants.%as_type.862, constants.%impl.elem1.46a [symbolic = %impl.elem1 (constants.%impl.elem1.46a)] -// CHECK:STDOUT: %.loc39_31.6: %Destroy.type = converted constants.%as_type.862, constants.%impl.elem1.46a [symbolic = %impl.elem1 (constants.%impl.elem1.46a)] -// CHECK:STDOUT: %specific_impl_fn.loc39_31.2: = specific_impl_function %impl.elem3.loc39_31.1, @Iterate.WithSelf.Next(constants.%Iterate.facet.b19) [symbolic = %specific_impl_fn.loc39_31.5 (constants.%specific_impl_fn.169)] -// CHECK:STDOUT: %bound_method.loc39_31.4: = bound_method %r.ref, %specific_impl_fn.loc39_31.2 -// CHECK:STDOUT: %.loc39_31.7: ref %Optional.552 = temporary_storage -// CHECK:STDOUT: %Iterate.WithSelf.Next.call: init %Optional.552 to %.loc39_31.7 = call %bound_method.loc39_31.4(%r.ref, %addr.loc39) -// CHECK:STDOUT: %.loc39_31.8: ref %Optional.552 = temporary %.loc39_31.7, %Iterate.WithSelf.Next.call -// CHECK:STDOUT: %.loc39_31.9: %Optional.HasValue.type.109 = specific_constant imports.%Core.import_ref.bb6, @Optional(constants.%OptionalStorage.facet.7ce) [concrete = constants.%Optional.HasValue.605] -// CHECK:STDOUT: %HasValue.ref: %Optional.HasValue.type.109 = name_ref HasValue, %.loc39_31.9 [concrete = constants.%Optional.HasValue.605] -// CHECK:STDOUT: %Optional.HasValue.bound: = bound_method %.loc39_31.8, %HasValue.ref +// CHECK:STDOUT: %addr.loc38: @TestIterate.%ptr (%ptr.530) = addr_of %var +// CHECK:STDOUT: %impl.elem3.loc38_31.1: @TestIterate.%.loc38_31.21 (%.df57) = impl_witness_access constants.%Iterate.lookup_impl_witness.8b4, element3 [symbolic = %impl.elem3.loc38_31.2 (constants.%impl.elem3.199)] +// CHECK:STDOUT: %bound_method.loc38_31.3: = bound_method %r.ref, %impl.elem3.loc38_31.1 +// CHECK:STDOUT: %Iterate.facet.loc38_31.3: %Iterate.type = facet_value constants.%R.as_type.a62, (constants.%Iterate.lookup_impl_witness.8b4) [symbolic = %Iterate.facet.loc38_31.5 (constants.%Iterate.facet.b19)] +// CHECK:STDOUT: %.loc38_31.3: %Iterate.type = converted constants.%R.as_type.a62, %Iterate.facet.loc38_31.3 [symbolic = %Iterate.facet.loc38_31.5 (constants.%Iterate.facet.b19)] +// CHECK:STDOUT: %Iterate.facet.loc38_31.4: %Iterate.type = facet_value constants.%R.as_type.a62, (constants.%Iterate.lookup_impl_witness.8b4) [symbolic = %Iterate.facet.loc38_31.5 (constants.%Iterate.facet.b19)] +// CHECK:STDOUT: %.loc38_31.4: %Iterate.type = converted constants.%R.as_type.a62, %Iterate.facet.loc38_31.4 [symbolic = %Iterate.facet.loc38_31.5 (constants.%Iterate.facet.b19)] +// CHECK:STDOUT: %.loc38_31.5: %Destroy.type = converted constants.%as_type.862, constants.%impl.elem1.46a [symbolic = %impl.elem1 (constants.%impl.elem1.46a)] +// CHECK:STDOUT: %.loc38_31.6: %Destroy.type = converted constants.%as_type.862, constants.%impl.elem1.46a [symbolic = %impl.elem1 (constants.%impl.elem1.46a)] +// CHECK:STDOUT: %specific_impl_fn.loc38_31.2: = specific_impl_function %impl.elem3.loc38_31.1, @Iterate.WithSelf.Next(constants.%Iterate.facet.b19) [symbolic = %specific_impl_fn.loc38_31.5 (constants.%specific_impl_fn.169)] +// CHECK:STDOUT: %bound_method.loc38_31.4: = bound_method %r.ref, %specific_impl_fn.loc38_31.2 +// CHECK:STDOUT: %.loc38_31.7: ref %Optional.552 = temporary_storage +// CHECK:STDOUT: %Iterate.WithSelf.Next.call: init %Optional.552 to %.loc38_31.7 = call %bound_method.loc38_31.4(%r.ref, %addr.loc38) +// CHECK:STDOUT: %.loc38_31.8: ref %Optional.552 = temporary %.loc38_31.7, %Iterate.WithSelf.Next.call +// CHECK:STDOUT: %.loc38_31.9: %Optional.HasValue.type.109 = specific_constant imports.%Core.import_ref.bb6, @Optional(constants.%OptionalStorage.facet.7ce) [concrete = constants.%Optional.HasValue.605] +// CHECK:STDOUT: %HasValue.ref: %Optional.HasValue.type.109 = name_ref HasValue, %.loc38_31.9 [concrete = constants.%Optional.HasValue.605] +// CHECK:STDOUT: %Optional.HasValue.bound: = bound_method %.loc38_31.8, %HasValue.ref // CHECK:STDOUT: %Optional.HasValue.specific_fn: = specific_function %HasValue.ref, @Optional.HasValue(constants.%OptionalStorage.facet.7ce) [concrete = constants.%Optional.HasValue.specific_fn] -// CHECK:STDOUT: %bound_method.loc39_31.5: = bound_method %.loc39_31.8, %Optional.HasValue.specific_fn -// CHECK:STDOUT: %.loc39_31.10: %Optional.552 = acquire_value %.loc39_31.8 -// CHECK:STDOUT: %Optional.HasValue.call: init bool = call %bound_method.loc39_31.5(%.loc39_31.10) -// CHECK:STDOUT: %.loc39_31.11: bool = value_of_initializer %Optional.HasValue.call -// CHECK:STDOUT: %.loc39_31.12: bool = converted %Optional.HasValue.call, %.loc39_31.11 -// CHECK:STDOUT: if %.loc39_31.12 br !for.body else br !for.done +// CHECK:STDOUT: %bound_method.loc38_31.5: = bound_method %.loc38_31.8, %Optional.HasValue.specific_fn +// CHECK:STDOUT: %.loc38_31.10: %Optional.552 = acquire_value %.loc38_31.8 +// CHECK:STDOUT: %Optional.HasValue.call: init bool = call %bound_method.loc38_31.5(%.loc38_31.10) +// CHECK:STDOUT: %.loc38_31.11: bool = value_of_initializer %Optional.HasValue.call +// CHECK:STDOUT: %.loc38_31.12: bool = converted %Optional.HasValue.call, %.loc38_31.11 +// CHECK:STDOUT: if %.loc38_31.12 br !for.body else br !for.done // CHECK:STDOUT: // CHECK:STDOUT: !for.body: -// CHECK:STDOUT: %.loc39_31.13: %Optional.Get.type.135 = specific_constant imports.%Core.import_ref.daba, @Optional(constants.%OptionalStorage.facet.7ce) [concrete = constants.%Optional.Get.5aa] -// CHECK:STDOUT: %Get.ref: %Optional.Get.type.135 = name_ref Get, %.loc39_31.13 [concrete = constants.%Optional.Get.5aa] -// CHECK:STDOUT: %Optional.Get.bound: = bound_method %.loc39_31.8, %Get.ref +// CHECK:STDOUT: %.loc38_31.13: %Optional.Get.type.135 = specific_constant imports.%Core.import_ref.daba, @Optional(constants.%OptionalStorage.facet.7ce) [concrete = constants.%Optional.Get.5aa] +// CHECK:STDOUT: %Get.ref: %Optional.Get.type.135 = name_ref Get, %.loc38_31.13 [concrete = constants.%Optional.Get.5aa] +// CHECK:STDOUT: %Optional.Get.bound: = bound_method %.loc38_31.8, %Get.ref // CHECK:STDOUT: %Optional.Get.specific_fn: = specific_function %Get.ref, @Optional.Get(constants.%OptionalStorage.facet.7ce) [concrete = constants.%Optional.Get.specific_fn] -// CHECK:STDOUT: %bound_method.loc39_31.6: = bound_method %.loc39_31.8, %Optional.Get.specific_fn -// CHECK:STDOUT: %.loc39_31.14: ref %ValueType = temporary_storage -// CHECK:STDOUT: %.loc39_31.15: %Optional.552 = acquire_value %.loc39_31.8 -// CHECK:STDOUT: %Optional.Get.call: init %ValueType to %.loc39_31.14 = call %bound_method.loc39_31.6(%.loc39_31.15) -// CHECK:STDOUT: %.loc39_31.16: ref %ValueType = temporary %.loc39_31.14, %Optional.Get.call -// CHECK:STDOUT: %.loc39_31.17: %ValueType = acquire_value %.loc39_31.16 -// CHECK:STDOUT: %.loc39_16: type = splice_block %ValueType.ref.loc39 [concrete = constants.%ValueType] { -// CHECK:STDOUT: %Cpp.ref.loc39: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] -// CHECK:STDOUT: %N.ref.loc39: = name_ref N, imports.%N [concrete = imports.%N] -// CHECK:STDOUT: %ValueType.ref.loc39: type = name_ref ValueType, imports.%ValueType.decl [concrete = constants.%ValueType] +// CHECK:STDOUT: %bound_method.loc38_31.6: = bound_method %.loc38_31.8, %Optional.Get.specific_fn +// CHECK:STDOUT: %.loc38_31.14: ref %ValueType = temporary_storage +// CHECK:STDOUT: %.loc38_31.15: %Optional.552 = acquire_value %.loc38_31.8 +// CHECK:STDOUT: %Optional.Get.call: init %ValueType to %.loc38_31.14 = call %bound_method.loc38_31.6(%.loc38_31.15) +// CHECK:STDOUT: %.loc38_31.16: ref %ValueType = temporary %.loc38_31.14, %Optional.Get.call +// CHECK:STDOUT: %.loc38_31.17: %ValueType = acquire_value %.loc38_31.16 +// CHECK:STDOUT: %.loc38_16: type = splice_block %ValueType.ref.loc38 [concrete = constants.%ValueType] { +// CHECK:STDOUT: %Cpp.ref.loc38: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %N.ref.loc38: = name_ref N, imports.%N [concrete = imports.%N] +// CHECK:STDOUT: %ValueType.ref.loc38: type = name_ref ValueType, imports.%ValueType.decl [concrete = constants.%ValueType] // CHECK:STDOUT: } -// CHECK:STDOUT: %i: %ValueType = value_binding i, %.loc39_31.17 +// CHECK:STDOUT: %i: %ValueType = value_binding i, %.loc38_31.17 // CHECK:STDOUT: %sum.ref: ref %ValueType = name_ref sum, %sum // CHECK:STDOUT: %i.ref: %ValueType = name_ref i, %i -// CHECK:STDOUT: %.loc40_12: ref %ValueType = value_as_ref %i.ref -// CHECK:STDOUT: %addr.loc40: %ptr.9d3 = addr_of %.loc40_12 -// CHECK:STDOUT: %.loc40_9.1: %ptr.32e = as_compatible %addr.loc40 -// CHECK:STDOUT: %.loc40_9.2: %ptr.32e = converted %addr.loc40, %.loc40_9.1 -// CHECK:STDOUT: %operator_PlusEqual__carbon_thunk.call: ref %ValueType = call imports.%operator_PlusEqual__carbon_thunk.decl(%sum.ref, %.loc40_9.2) +// CHECK:STDOUT: %.loc39_12: ref %ValueType = value_as_ref %i.ref +// CHECK:STDOUT: %addr.loc39: %ptr.9d3 = addr_of %.loc39_12 +// CHECK:STDOUT: %.loc39_9.1: %ptr.32e = as_compatible %addr.loc39 +// CHECK:STDOUT: %.loc39_9.2: %ptr.32e = converted %addr.loc39, %.loc39_9.1 +// CHECK:STDOUT: %operator_PlusEqual__carbon_thunk.call: ref %ValueType = call imports.%operator_PlusEqual__carbon_thunk.decl(%sum.ref, %.loc39_9.2) // CHECK:STDOUT: br !for.next // CHECK:STDOUT: // CHECK:STDOUT: !for.done: -// CHECK:STDOUT: %ValueType.Op.bound.loc39: = bound_method %.loc39_31.16, constants.%ValueType.Op.4c94b9.1 -// CHECK:STDOUT: %Op.ref.loc39: %ValueType.cpp_destructor.type = name_ref Op, imports.%ValueType.cpp_destructor.decl [concrete = constants.%ValueType.cpp_destructor] -// CHECK:STDOUT: %ValueType.cpp_destructor.bound.loc39: = bound_method %.loc39_31.16, %Op.ref.loc39 -// CHECK:STDOUT: %ValueType.cpp_destructor.call.loc39: init %empty_tuple.type = call %ValueType.cpp_destructor.bound.loc39(%.loc39_31.16) -// CHECK:STDOUT: %Destroy.Op.bound: = bound_method %.loc39_31.8, constants.%Destroy.Op.1a2547.7 -// CHECK:STDOUT: %Destroy.Op.call: init %empty_tuple.type = call %Destroy.Op.bound(%.loc39_31.8) -// CHECK:STDOUT: %impl.elem0.loc39_31.1: @Test.%.loc39_31.22 (%.bc1) = impl_witness_access constants.%Destroy.lookup_impl_witness.f37, element0 [symbolic = %impl.elem0.loc39_31.2 (constants.%impl.elem0.c7c)] -// CHECK:STDOUT: %bound_method.loc39_31.7: = bound_method %var, %impl.elem0.loc39_31.1 -// CHECK:STDOUT: %.loc39_31.18: %Destroy.type = converted constants.%as_type.862, constants.%impl.elem1.46a [symbolic = %impl.elem1 (constants.%impl.elem1.46a)] -// CHECK:STDOUT: %.loc39_31.19: %Destroy.type = converted constants.%as_type.862, constants.%impl.elem1.46a [symbolic = %impl.elem1 (constants.%impl.elem1.46a)] -// CHECK:STDOUT: %specific_impl_fn.loc39_31.3: = specific_impl_function %impl.elem0.loc39_31.1, @Destroy.WithSelf.Op(constants.%impl.elem1.46a) [symbolic = %specific_impl_fn.loc39_31.6 (constants.%specific_impl_fn.cd3)] -// CHECK:STDOUT: %bound_method.loc39_31.8: = bound_method %var, %specific_impl_fn.loc39_31.3 -// CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call %bound_method.loc39_31.8(%var) +// CHECK:STDOUT: %ValueType.Op.bound.loc38: = bound_method %.loc38_31.16, constants.%ValueType.Op.4c94b9.1 +// CHECK:STDOUT: %Op.ref.loc38: %ValueType.cpp_destructor.type = name_ref Op, imports.%ValueType.cpp_destructor.decl [concrete = constants.%ValueType.cpp_destructor] +// CHECK:STDOUT: %ValueType.cpp_destructor.bound.loc38: = bound_method %.loc38_31.16, %Op.ref.loc38 +// CHECK:STDOUT: %ValueType.cpp_destructor.call.loc38: init %empty_tuple.type = call %ValueType.cpp_destructor.bound.loc38(%.loc38_31.16) +// CHECK:STDOUT: %Destroy.Op.bound: = bound_method %.loc38_31.8, constants.%Destroy.Op.1a2547.7 +// CHECK:STDOUT: %Destroy.Op.call: init %empty_tuple.type = call %Destroy.Op.bound(%.loc38_31.8) +// CHECK:STDOUT: %impl.elem0.loc38_31.1: @TestIterate.%.loc38_31.22 (%.bc1) = impl_witness_access constants.%Destroy.lookup_impl_witness.f37, element0 [symbolic = %impl.elem0.loc38_31.2 (constants.%impl.elem0.c7c)] +// CHECK:STDOUT: %bound_method.loc38_31.7: = bound_method %var, %impl.elem0.loc38_31.1 +// CHECK:STDOUT: %.loc38_31.18: %Destroy.type = converted constants.%as_type.862, constants.%impl.elem1.46a [symbolic = %impl.elem1 (constants.%impl.elem1.46a)] +// CHECK:STDOUT: %.loc38_31.19: %Destroy.type = converted constants.%as_type.862, constants.%impl.elem1.46a [symbolic = %impl.elem1 (constants.%impl.elem1.46a)] +// CHECK:STDOUT: %specific_impl_fn.loc38_31.3: = specific_impl_function %impl.elem0.loc38_31.1, @Destroy.WithSelf.Op(constants.%impl.elem1.46a) [symbolic = %specific_impl_fn.loc38_31.6 (constants.%specific_impl_fn.cd3)] +// CHECK:STDOUT: %bound_method.loc38_31.8: = bound_method %var, %specific_impl_fn.loc38_31.3 +// CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call %bound_method.loc38_31.8(%var) // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.Op.loc39_31.1(%self.param: ref %.b36) { +// CHECK:STDOUT: fn @Destroy.Op.loc38_31.1(%self.param: ref %.b36) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.Op.loc39_31.2(%self.param: ref %MaybeUnformed.669) { +// CHECK:STDOUT: fn @Destroy.Op.loc38_31.2(%self.param: ref %MaybeUnformed.669) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.Op.loc39_31.3(%self.param: ref bool) = "no_op"; +// CHECK:STDOUT: fn @Destroy.Op.loc38_31.3(%self.param: ref bool) = "no_op"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.Op.loc39_31.4(%self.param: ref %struct_type.value.has_value.5a1) { +// CHECK:STDOUT: fn @Destroy.Op.loc38_31.4(%self.param: ref %struct_type.value.has_value.5a1) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.Op.loc39_31.5(%self.param: ref %DefaultOptionalStorage.257) { +// CHECK:STDOUT: fn @Destroy.Op.loc38_31.5(%self.param: ref %DefaultOptionalStorage.257) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.Op.loc39_31.6(%self.param: ref %Optional.552) { +// CHECK:STDOUT: fn @Destroy.Op.loc38_31.6(%self.param: ref %Optional.552) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Test(constants.%R.623) { -// CHECK:STDOUT: %R.patt.loc35_10.2 => constants.%R.patt.324 -// CHECK:STDOUT: %R.loc35_10.1 => constants.%R.623 -// CHECK:STDOUT: %R.as_type.loc35_67.1 => constants.%R.as_type.a62 +// CHECK:STDOUT: fn @TestRangeFor(%mc.param: ref %MutableAndConstRange) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: +// CHECK:STDOUT: name_binding_decl { +// CHECK:STDOUT: %i.patt: %pattern_type.e41 = value_binding_pattern i [concrete = constants.%i.patt] +// CHECK:STDOUT: } +// CHECK:STDOUT: %mc.ref: ref %MutableAndConstRange = name_ref mc, %mc +// CHECK:STDOUT: %impl.elem2: %.7e3 = impl_witness_access constants.%Iterate.impl_witness.a6e, element2 [concrete = constants.%R.as_type.as.Iterate.impl.NewCursor.96c] +// CHECK:STDOUT: %bound_method.loc80_32.1: = bound_method %mc.ref, %impl.elem2 +// CHECK:STDOUT: %facet_value.loc80_32.1: %CppRangeForIterate_where.type = facet_value constants.%MutableAndConstRange, (constants.%custom_witness.fef, constants.%custom_witness.c19, constants.%custom_witness.a40, constants.%custom_witness.04a, constants.%custom_witness.cfc, constants.%custom_witness.dd5, constants.%custom_witness.c66, constants.%custom_witness.01a) [concrete = constants.%facet_value.88d] +// CHECK:STDOUT: %.loc80_32.1: %CppRangeForIterate_where.type = converted constants.%MutableAndConstRange, %facet_value.loc80_32.1 [concrete = constants.%facet_value.88d] +// CHECK:STDOUT: %facet_value.loc80_32.2: %CppRangeForIterate_where.type = facet_value constants.%MutableAndConstRange, (constants.%custom_witness.fef, constants.%custom_witness.c19, constants.%custom_witness.a40, constants.%custom_witness.04a, constants.%custom_witness.cfc, constants.%custom_witness.dd5, constants.%custom_witness.c66, constants.%custom_witness.01a) [concrete = constants.%facet_value.88d] +// CHECK:STDOUT: %.loc80_32.2: %CppRangeForIterate_where.type = converted constants.%MutableAndConstRange, %facet_value.loc80_32.2 [concrete = constants.%facet_value.88d] +// CHECK:STDOUT: %specific_fn.loc80_32.1: = specific_function %impl.elem2, @R.as_type.as.Iterate.impl.NewCursor(constants.%facet_value.88d) [concrete = constants.%R.as_type.as.Iterate.impl.NewCursor.specific_fn] +// CHECK:STDOUT: %bound_method.loc80_32.2: = bound_method %mc.ref, %specific_fn.loc80_32.1 +// CHECK:STDOUT: %var: ref %tuple.type.56e = var invalid +// CHECK:STDOUT: %.loc80_30.1: %MutableAndConstRange = acquire_value %mc.ref +// CHECK:STDOUT: %R.as_type.as.Iterate.impl.NewCursor.call: init %tuple.type.56e to %var = call %bound_method.loc80_32.2(%.loc80_30.1) +// CHECK:STDOUT: assign %var, %R.as_type.as.Iterate.impl.NewCursor.call +// CHECK:STDOUT: br !for.next +// CHECK:STDOUT: +// CHECK:STDOUT: !for.next: +// CHECK:STDOUT: %addr.loc80: %ptr.484 = addr_of %var +// CHECK:STDOUT: %impl.elem3: %.fef = impl_witness_access constants.%Iterate.impl_witness.a6e, element3 [concrete = constants.%R.as_type.as.Iterate.impl.Next.683] +// CHECK:STDOUT: %bound_method.loc80_32.3: = bound_method %mc.ref, %impl.elem3 +// CHECK:STDOUT: %facet_value.loc80_32.3: %CppRangeForIterate_where.type = facet_value constants.%MutableAndConstRange, (constants.%custom_witness.fef, constants.%custom_witness.c19, constants.%custom_witness.a40, constants.%custom_witness.04a, constants.%custom_witness.cfc, constants.%custom_witness.dd5, constants.%custom_witness.c66, constants.%custom_witness.01a) [concrete = constants.%facet_value.88d] +// CHECK:STDOUT: %.loc80_32.3: %CppRangeForIterate_where.type = converted constants.%MutableAndConstRange, %facet_value.loc80_32.3 [concrete = constants.%facet_value.88d] +// CHECK:STDOUT: %facet_value.loc80_32.4: %CppRangeForIterate_where.type = facet_value constants.%MutableAndConstRange, (constants.%custom_witness.fef, constants.%custom_witness.c19, constants.%custom_witness.a40, constants.%custom_witness.04a, constants.%custom_witness.cfc, constants.%custom_witness.dd5, constants.%custom_witness.c66, constants.%custom_witness.01a) [concrete = constants.%facet_value.88d] +// CHECK:STDOUT: %.loc80_32.4: %CppRangeForIterate_where.type = converted constants.%MutableAndConstRange, %facet_value.loc80_32.4 [concrete = constants.%facet_value.88d] +// CHECK:STDOUT: %specific_fn.loc80_32.2: = specific_function %impl.elem3, @R.as_type.as.Iterate.impl.Next(constants.%facet_value.88d) [concrete = constants.%R.as_type.as.Iterate.impl.Next.specific_fn] +// CHECK:STDOUT: %bound_method.loc80_32.4: = bound_method %mc.ref, %specific_fn.loc80_32.2 +// CHECK:STDOUT: %.loc80_32.5: ref %Optional.552 = temporary_storage +// CHECK:STDOUT: %.loc80_30.2: %MutableAndConstRange = acquire_value %mc.ref +// CHECK:STDOUT: %R.as_type.as.Iterate.impl.Next.call: init %Optional.552 to %.loc80_32.5 = call %bound_method.loc80_32.4(%.loc80_30.2, %addr.loc80) +// CHECK:STDOUT: %.loc80_32.6: ref %Optional.552 = temporary %.loc80_32.5, %R.as_type.as.Iterate.impl.Next.call +// CHECK:STDOUT: %.loc80_32.7: %Optional.HasValue.type.109 = specific_constant imports.%Core.import_ref.bb6, @Optional(constants.%OptionalStorage.facet.7ce) [concrete = constants.%Optional.HasValue.605] +// CHECK:STDOUT: %HasValue.ref: %Optional.HasValue.type.109 = name_ref HasValue, %.loc80_32.7 [concrete = constants.%Optional.HasValue.605] +// CHECK:STDOUT: %Optional.HasValue.bound: = bound_method %.loc80_32.6, %HasValue.ref +// CHECK:STDOUT: %Optional.HasValue.specific_fn: = specific_function %HasValue.ref, @Optional.HasValue(constants.%OptionalStorage.facet.7ce) [concrete = constants.%Optional.HasValue.specific_fn] +// CHECK:STDOUT: %bound_method.loc80_32.5: = bound_method %.loc80_32.6, %Optional.HasValue.specific_fn +// CHECK:STDOUT: %.loc80_32.8: %Optional.552 = acquire_value %.loc80_32.6 +// CHECK:STDOUT: %Optional.HasValue.call: init bool = call %bound_method.loc80_32.5(%.loc80_32.8) +// CHECK:STDOUT: %.loc80_32.9: bool = value_of_initializer %Optional.HasValue.call +// CHECK:STDOUT: %.loc80_32.10: bool = converted %Optional.HasValue.call, %.loc80_32.9 +// CHECK:STDOUT: if %.loc80_32.10 br !for.body else br !for.done +// CHECK:STDOUT: +// CHECK:STDOUT: !for.body: +// CHECK:STDOUT: %.loc80_32.11: %Optional.Get.type.135 = specific_constant imports.%Core.import_ref.daba, @Optional(constants.%OptionalStorage.facet.7ce) [concrete = constants.%Optional.Get.5aa] +// CHECK:STDOUT: %Get.ref: %Optional.Get.type.135 = name_ref Get, %.loc80_32.11 [concrete = constants.%Optional.Get.5aa] +// CHECK:STDOUT: %Optional.Get.bound: = bound_method %.loc80_32.6, %Get.ref +// CHECK:STDOUT: %Optional.Get.specific_fn: = specific_function %Get.ref, @Optional.Get(constants.%OptionalStorage.facet.7ce) [concrete = constants.%Optional.Get.specific_fn] +// CHECK:STDOUT: %bound_method.loc80_32.6: = bound_method %.loc80_32.6, %Optional.Get.specific_fn +// CHECK:STDOUT: %.loc80_32.12: ref %ValueType = temporary_storage +// CHECK:STDOUT: %.loc80_32.13: %Optional.552 = acquire_value %.loc80_32.6 +// CHECK:STDOUT: %Optional.Get.call: init %ValueType to %.loc80_32.12 = call %bound_method.loc80_32.6(%.loc80_32.13) +// CHECK:STDOUT: %.loc80_32.14: ref %ValueType = temporary %.loc80_32.12, %Optional.Get.call +// CHECK:STDOUT: %.loc80_32.15: %ValueType = acquire_value %.loc80_32.14 +// CHECK:STDOUT: %.loc80_16: type = splice_block %ValueType.ref.loc80 [concrete = constants.%ValueType] { +// CHECK:STDOUT: %Cpp.ref.loc80: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] +// CHECK:STDOUT: %N.ref.loc80: = name_ref N, imports.%N [concrete = imports.%N] +// CHECK:STDOUT: %ValueType.ref.loc80: type = name_ref ValueType, imports.%ValueType.decl [concrete = constants.%ValueType] +// CHECK:STDOUT: } +// CHECK:STDOUT: %i: %ValueType = value_binding i, %.loc80_32.15 +// CHECK:STDOUT: %sum.ref: ref %ValueType = name_ref sum, %sum +// CHECK:STDOUT: %i.ref: %ValueType = name_ref i, %i +// CHECK:STDOUT: %.loc81_12: ref %ValueType = value_as_ref %i.ref +// CHECK:STDOUT: %addr.loc81: %ptr.9d3 = addr_of %.loc81_12 +// CHECK:STDOUT: %.loc81_9.1: %ptr.32e = as_compatible %addr.loc81 +// CHECK:STDOUT: %.loc81_9.2: %ptr.32e = converted %addr.loc81, %.loc81_9.1 +// CHECK:STDOUT: %operator_PlusEqual__carbon_thunk.call: ref %ValueType = call imports.%operator_PlusEqual__carbon_thunk.decl(%sum.ref, %.loc81_9.2) +// CHECK:STDOUT: br !for.next +// CHECK:STDOUT: +// CHECK:STDOUT: !for.done: +// CHECK:STDOUT: %ValueType.Op.bound.loc80: = bound_method %.loc80_32.14, constants.%ValueType.Op.4c94b9.1 +// CHECK:STDOUT: %Op.ref.loc80: %ValueType.cpp_destructor.type = name_ref Op, imports.%ValueType.cpp_destructor.decl [concrete = constants.%ValueType.cpp_destructor] +// CHECK:STDOUT: %ValueType.cpp_destructor.bound.loc80: = bound_method %.loc80_32.14, %Op.ref.loc80 +// CHECK:STDOUT: %ValueType.cpp_destructor.call.loc80: init %empty_tuple.type = call %ValueType.cpp_destructor.bound.loc80(%.loc80_32.14) +// CHECK:STDOUT: %Destroy.Op.bound.loc80_32.1: = bound_method %.loc80_32.6, constants.%Destroy.Op.1a2547.7 +// CHECK:STDOUT: %Destroy.Op.call.loc80_32.1: init %empty_tuple.type = call %Destroy.Op.bound.loc80_32.1(%.loc80_32.6) +// CHECK:STDOUT: %Destroy.Op.bound.loc80_32.2: = bound_method %var, constants.%Destroy.Op.1a2547.8 +// CHECK:STDOUT: %Destroy.Op.call.loc80_32.2: init %empty_tuple.type = call %Destroy.Op.bound.loc80_32.2(%var) +// CHECK:STDOUT: +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: specific @TestIterate(constants.%R.623) { +// CHECK:STDOUT: %R.patt.loc34_17.2 => constants.%R.patt.324 +// CHECK:STDOUT: %R.loc34_17.1 => constants.%R.623 +// CHECK:STDOUT: %R.as_type.loc34_74.1 => constants.%R.as_type.a62 // CHECK:STDOUT: %pattern_type => constants.%pattern_type.725 -// CHECK:STDOUT: %r.param_patt.loc35_65.2 => constants.%r.param_patt.162 -// CHECK:STDOUT: %r.patt.loc35_65.2 => constants.%r.patt.15b +// CHECK:STDOUT: %r.param_patt.loc34_72.2 => constants.%r.param_patt.162 +// CHECK:STDOUT: %r.patt.loc34_72.2 => constants.%r.patt.15b // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: specific @Test(constants.%facet_value.0ec) { -// CHECK:STDOUT: %R.patt.loc35_10.2 => constants.%R.patt.324 -// CHECK:STDOUT: %R.loc35_10.1 => constants.%facet_value.0ec -// CHECK:STDOUT: %R.as_type.loc35_67.1 => constants.%MutableAndConstRange +// CHECK:STDOUT: specific @TestIterate(constants.%facet_value.0ec) { +// CHECK:STDOUT: %R.patt.loc34_17.2 => constants.%R.patt.324 +// CHECK:STDOUT: %R.loc34_17.1 => constants.%facet_value.0ec +// CHECK:STDOUT: %R.as_type.loc34_74.1 => constants.%MutableAndConstRange // CHECK:STDOUT: %pattern_type => constants.%pattern_type.394 -// CHECK:STDOUT: %r.param_patt.loc35_65.2 => constants.%r.param_patt.8bb -// CHECK:STDOUT: %r.patt.loc35_65.2 => constants.%r.patt.ac4 +// CHECK:STDOUT: %r.param_patt.loc34_72.2 => constants.%r.param_patt.8bb +// CHECK:STDOUT: %r.patt.loc34_72.2 => constants.%r.patt.ac4 // CHECK:STDOUT: // CHECK:STDOUT: !definition: -// CHECK:STDOUT: %require_complete.loc35 => constants.%complete_type.357 +// CHECK:STDOUT: %require_complete.loc34 => constants.%complete_type.357 // CHECK:STDOUT: %Iterate.lookup_impl_witness => constants.%Iterate.impl_witness.a6e -// CHECK:STDOUT: %Iterate.facet.loc39_31.5 => constants.%Iterate.facet.5cc +// CHECK:STDOUT: %Iterate.facet.loc38_31.5 => constants.%Iterate.facet.5cc // CHECK:STDOUT: %Iterate.WithSelf.NewCursor.type => constants.%Iterate.WithSelf.NewCursor.type.875 -// CHECK:STDOUT: %.loc39_31.20 => constants.%.7e3 -// CHECK:STDOUT: %impl.elem2.loc39_31.2 => constants.%R.as_type.as.Iterate.impl.NewCursor.96c -// CHECK:STDOUT: %specific_impl_fn.loc39_31.4 => constants.%R.as_type.as.Iterate.impl.NewCursor.specific_fn +// CHECK:STDOUT: %.loc38_31.20 => constants.%.7e3 +// CHECK:STDOUT: %impl.elem2.loc38_31.2 => constants.%R.as_type.as.Iterate.impl.NewCursor.96c +// CHECK:STDOUT: %specific_impl_fn.loc38_31.4 => constants.%R.as_type.as.Iterate.impl.NewCursor.specific_fn // CHECK:STDOUT: %impl.elem1 => constants.%Destroy.facet.7aa // CHECK:STDOUT: %as_type => constants.%tuple.type.56e // CHECK:STDOUT: %require_complete.1 => constants.%complete_type.1b5 // CHECK:STDOUT: %ptr => constants.%ptr.484 // CHECK:STDOUT: %Iterate.WithSelf.Next.type => constants.%Iterate.WithSelf.Next.type.b41 -// CHECK:STDOUT: %.loc39_31.21 => constants.%.fef -// CHECK:STDOUT: %impl.elem3.loc39_31.2 => constants.%R.as_type.as.Iterate.impl.Next.683 -// CHECK:STDOUT: %specific_impl_fn.loc39_31.5 => constants.%R.as_type.as.Iterate.impl.Next.specific_fn +// CHECK:STDOUT: %.loc38_31.21 => constants.%.fef +// CHECK:STDOUT: %impl.elem3.loc38_31.2 => constants.%R.as_type.as.Iterate.impl.Next.683 +// CHECK:STDOUT: %specific_impl_fn.loc38_31.5 => constants.%R.as_type.as.Iterate.impl.Next.specific_fn // CHECK:STDOUT: %Destroy.WithSelf.Op.type => constants.%Destroy.WithSelf.Op.type.b7b -// CHECK:STDOUT: %.loc39_31.22 => constants.%.1ad +// CHECK:STDOUT: %.loc38_31.22 => constants.%.1ad // CHECK:STDOUT: %Destroy.lookup_impl_witness => constants.%custom_witness.df9cc1.8 -// CHECK:STDOUT: %impl.elem0.loc39_31.2 => constants.%Destroy.Op.1a2547.8 -// CHECK:STDOUT: %specific_impl_fn.loc39_31.6 => constants.%Destroy.Op.1a2547.8 +// CHECK:STDOUT: %impl.elem0.loc38_31.2 => constants.%Destroy.Op.1a2547.8 +// CHECK:STDOUT: %specific_impl_fn.loc38_31.6 => constants.%Destroy.Op.1a2547.8 // CHECK:STDOUT: } // CHECK:STDOUT: