mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Only propagate .Self dependence in facet types from extended constraints (#7253)
When forming the constant value of a `where` expression, don't consider it to be `.Self`-dependent if the dependence only comes from the RHS of the `where`. More generally, ignore `.Self` dependence when evaluating a facet type unless it comes from an extended interface or named constraint. While we can get other kinds of constraint from the left-hand side of a `where`, such constraints must either come from the right-hand side of other `where` expressions or be extend constraints. This fixes a crash in lowering caused by a concrete function containing a `.Self`-symbolic `where` constant. Assisted-by: Gemini via Antigravity
This commit is contained in:
+14
-14
@@ -477,7 +477,7 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd,
|
||||
// CHECK:STDOUT: %impl.elem0.354: type = impl_witness_access %CppRangeForIterate.lookup_impl_witness.ae8, element0 [symbolic_self]
|
||||
// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
|
||||
// CHECK:STDOUT: %impl.elem1.fdc: type = impl_witness_access %CppRangeForIterate.lookup_impl_witness.ae8, element1 [symbolic_self]
|
||||
// CHECK:STDOUT: %CppRangeForIterate_where.type: type = facet_type <@CppRangeForIterate where %impl.elem0.354 impls @Destroy and %impl.elem1.fdc impls @Destroy> [symbolic_self]
|
||||
// CHECK:STDOUT: %CppRangeForIterate_where.type: type = facet_type <@CppRangeForIterate where %impl.elem0.354 impls @Destroy and %impl.elem1.fdc impls @Destroy> [concrete]
|
||||
// CHECK:STDOUT: %R: %CppRangeForIterate_where.type = symbolic_binding R, 0 [symbolic]
|
||||
// CHECK:STDOUT: %R.as_type: type = facet_access_type %R [symbolic]
|
||||
// CHECK:STDOUT: %pattern_type.ff859f.2: type = pattern_type %R.as_type [symbolic]
|
||||
@@ -524,7 +524,7 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd,
|
||||
// CHECK:STDOUT: %Iterator.Op.type.f11: type = fn_type @Iterator.Op.1 [concrete]
|
||||
// CHECK:STDOUT: %Iterator.Op.78e: %Iterator.Op.type.f11 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %custom_witness.b91: <witness> = custom_witness (%Iterator.Op.78e), @Destroy [concrete]
|
||||
// CHECK:STDOUT: %facet_value.665: %CppRangeForIterate_where.type = facet_value %MutableRange, (%custom_witness.7e3fb2.1, %custom_witness.b91) [symbolic_self]
|
||||
// CHECK:STDOUT: %facet_value.665: %CppRangeForIterate_where.type = facet_value %MutableRange, (%custom_witness.7e3fb2.1, %custom_witness.b91) [concrete]
|
||||
// CHECK:STDOUT: %Iterator.a7566c.2: type = class_type @Iterator.2 [concrete]
|
||||
// CHECK:STDOUT: %ConstRange.Begin.type: type = fn_type @ConstRange.Begin [concrete]
|
||||
// CHECK:STDOUT: %ConstRange.Begin: %ConstRange.Begin.type = struct_value () [concrete]
|
||||
@@ -535,7 +535,7 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd,
|
||||
// CHECK:STDOUT: %Iterator.Op.type.798: type = fn_type @Iterator.Op.2 [concrete]
|
||||
// CHECK:STDOUT: %Iterator.Op.250: %Iterator.Op.type.798 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %custom_witness.018: <witness> = custom_witness (%Iterator.Op.250), @Destroy [concrete]
|
||||
// CHECK:STDOUT: %facet_value.57a: %CppRangeForIterate_where.type = facet_value %ConstRange, (%custom_witness.7e3fb2.2, %custom_witness.018) [symbolic_self]
|
||||
// CHECK:STDOUT: %facet_value.57a: %CppRangeForIterate_where.type = facet_value %ConstRange, (%custom_witness.7e3fb2.2, %custom_witness.018) [concrete]
|
||||
// CHECK:STDOUT: %CppRangeForIterate.WithSelf.Begin.type.a13: type = fn_type @CppRangeForIterate.WithSelf.Begin, @CppRangeForIterate.WithSelf(%CppRangeForIterate.facet.d24) [concrete]
|
||||
// CHECK:STDOUT: %.a34: type = fn_type_with_self_type %CppRangeForIterate.WithSelf.Begin.type.a13, %CppRangeForIterate.facet.d24 [concrete]
|
||||
// CHECK:STDOUT: %CppRangeForIterate.WithSelf.End.type.e9f: type = fn_type @CppRangeForIterate.WithSelf.End, @CppRangeForIterate.WithSelf(%CppRangeForIterate.facet.d24) [concrete]
|
||||
@@ -714,7 +714,7 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd,
|
||||
// CHECK:STDOUT: %impl.elem0.354: type = impl_witness_access %CppRangeForIterate.lookup_impl_witness.ae8, element0 [symbolic_self]
|
||||
// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
|
||||
// CHECK:STDOUT: %impl.elem1.fdc: type = impl_witness_access %CppRangeForIterate.lookup_impl_witness.ae8, element1 [symbolic_self]
|
||||
// CHECK:STDOUT: %CppRangeForIterate_where.type: type = facet_type <@CppRangeForIterate where %impl.elem0.354 impls @Destroy and %impl.elem1.fdc impls @Destroy> [symbolic_self]
|
||||
// CHECK:STDOUT: %CppRangeForIterate_where.type: type = facet_type <@CppRangeForIterate where %impl.elem0.354 impls @Destroy and %impl.elem1.fdc impls @Destroy> [concrete]
|
||||
// CHECK:STDOUT: %R: %CppRangeForIterate_where.type = symbolic_binding R, 0 [symbolic]
|
||||
// CHECK:STDOUT: %R.as_type: type = facet_access_type %R [symbolic]
|
||||
// CHECK:STDOUT: %pattern_type.ff859f.2: type = pattern_type %R.as_type [symbolic]
|
||||
@@ -765,7 +765,7 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd,
|
||||
// CHECK:STDOUT: %Sentinel.Op.type.f11: type = fn_type @Sentinel.Op.1 [concrete]
|
||||
// CHECK:STDOUT: %Sentinel.Op.78e: %Sentinel.Op.type.f11 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %custom_witness.b916b4.2: <witness> = custom_witness (%Sentinel.Op.78e), @Destroy [concrete]
|
||||
// CHECK:STDOUT: %facet_value.8f5: %CppRangeForIterate_where.type = facet_value %MutableRange, (%custom_witness.607036.1, %custom_witness.b916b4.1, %custom_witness.b916b4.2) [symbolic_self]
|
||||
// CHECK:STDOUT: %facet_value.8f5: %CppRangeForIterate_where.type = facet_value %MutableRange, (%custom_witness.607036.1, %custom_witness.b916b4.1, %custom_witness.b916b4.2) [concrete]
|
||||
// CHECK:STDOUT: %Iterator.a7566c.2: type = class_type @Iterator.2 [concrete]
|
||||
// CHECK:STDOUT: %Sentinel.885798.2: type = class_type @Sentinel.2 [concrete]
|
||||
// CHECK:STDOUT: %ConstRange.Begin.type: type = fn_type @ConstRange.Begin [concrete]
|
||||
@@ -780,7 +780,7 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd,
|
||||
// CHECK:STDOUT: %Sentinel.Op.type.798: type = fn_type @Sentinel.Op.2 [concrete]
|
||||
// CHECK:STDOUT: %Sentinel.Op.250: %Sentinel.Op.type.798 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %custom_witness.0183d1.2: <witness> = custom_witness (%Sentinel.Op.250), @Destroy [concrete]
|
||||
// CHECK:STDOUT: %facet_value.058: %CppRangeForIterate_where.type = facet_value %ConstRange, (%custom_witness.607036.2, %custom_witness.0183d1.1, %custom_witness.0183d1.2) [symbolic_self]
|
||||
// CHECK:STDOUT: %facet_value.058: %CppRangeForIterate_where.type = facet_value %ConstRange, (%custom_witness.607036.2, %custom_witness.0183d1.1, %custom_witness.0183d1.2) [concrete]
|
||||
// CHECK:STDOUT: %CppRangeForIterate.WithSelf.Begin.type.dc4: type = fn_type @CppRangeForIterate.WithSelf.Begin, @CppRangeForIterate.WithSelf(%CppRangeForIterate.facet.5b8) [concrete]
|
||||
// CHECK:STDOUT: %.314: type = fn_type_with_self_type %CppRangeForIterate.WithSelf.Begin.type.dc4, %CppRangeForIterate.facet.5b8 [concrete]
|
||||
// CHECK:STDOUT: %CppRangeForIterate.WithSelf.End.type.143: type = fn_type @CppRangeForIterate.WithSelf.End, @CppRangeForIterate.WithSelf(%CppRangeForIterate.facet.5b8) [concrete]
|
||||
@@ -965,7 +965,7 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd,
|
||||
// CHECK:STDOUT: %impl.elem0.354: type = impl_witness_access %CppRangeForIterate.lookup_impl_witness.ae8, element0 [symbolic_self]
|
||||
// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
|
||||
// CHECK:STDOUT: %impl.elem1.fdc: type = impl_witness_access %CppRangeForIterate.lookup_impl_witness.ae8, element1 [symbolic_self]
|
||||
// CHECK:STDOUT: %CppRangeForIterate_where.type: type = facet_type <@CppRangeForIterate where %impl.elem0.354 impls @Destroy and %impl.elem1.fdc impls @Destroy> [symbolic_self]
|
||||
// CHECK:STDOUT: %CppRangeForIterate_where.type: type = facet_type <@CppRangeForIterate where %impl.elem0.354 impls @Destroy and %impl.elem1.fdc impls @Destroy> [concrete]
|
||||
// CHECK:STDOUT: %R: %CppRangeForIterate_where.type = symbolic_binding R, 0 [symbolic]
|
||||
// CHECK:STDOUT: %R.as_type: type = facet_access_type %R [symbolic]
|
||||
// CHECK:STDOUT: %pattern_type.ff859f.2: type = pattern_type %R.as_type [symbolic]
|
||||
@@ -1012,7 +1012,7 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd,
|
||||
// CHECK:STDOUT: %Iterator.Op.type.37d: type = fn_type @Iterator.Op.1 [concrete]
|
||||
// CHECK:STDOUT: %Iterator.Op.26b: %Iterator.Op.type.37d = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %custom_witness.415: <witness> = custom_witness (%Iterator.Op.26b), @Destroy [concrete]
|
||||
// CHECK:STDOUT: %facet_value.c35: %CppRangeForIterate_where.type = facet_value %MutableRange, (%custom_witness.827774.1, %custom_witness.415) [symbolic_self]
|
||||
// CHECK:STDOUT: %facet_value.c35: %CppRangeForIterate_where.type = facet_value %MutableRange, (%custom_witness.827774.1, %custom_witness.415) [concrete]
|
||||
// CHECK:STDOUT: %Iterator.b6bc8f.2: type = class_type @Iterator.2 [concrete]
|
||||
// CHECK:STDOUT: %Begin.type.793876.2: type = fn_type @Begin.2 [concrete]
|
||||
// CHECK:STDOUT: %Begin.1544bb.2: %Begin.type.793876.2 = struct_value () [concrete]
|
||||
@@ -1023,7 +1023,7 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd,
|
||||
// CHECK:STDOUT: %Iterator.Op.type.152: type = fn_type @Iterator.Op.2 [concrete]
|
||||
// CHECK:STDOUT: %Iterator.Op.84b: %Iterator.Op.type.152 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %custom_witness.0d3: <witness> = custom_witness (%Iterator.Op.84b), @Destroy [concrete]
|
||||
// CHECK:STDOUT: %facet_value.057: %CppRangeForIterate_where.type = facet_value %ConstRange, (%custom_witness.827774.2, %custom_witness.0d3) [symbolic_self]
|
||||
// CHECK:STDOUT: %facet_value.057: %CppRangeForIterate_where.type = facet_value %ConstRange, (%custom_witness.827774.2, %custom_witness.0d3) [concrete]
|
||||
// CHECK:STDOUT: %CppRangeForIterate.WithSelf.Begin.type.bfa: type = fn_type @CppRangeForIterate.WithSelf.Begin, @CppRangeForIterate.WithSelf(%CppRangeForIterate.facet.a7f) [concrete]
|
||||
// CHECK:STDOUT: %.73f: type = fn_type_with_self_type %CppRangeForIterate.WithSelf.Begin.type.bfa, %CppRangeForIterate.facet.a7f [concrete]
|
||||
// CHECK:STDOUT: %CppRangeForIterate.WithSelf.End.type.c37: type = fn_type @CppRangeForIterate.WithSelf.End, @CppRangeForIterate.WithSelf(%CppRangeForIterate.facet.a7f) [concrete]
|
||||
@@ -1202,7 +1202,7 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd,
|
||||
// CHECK:STDOUT: %impl.elem0.354: type = impl_witness_access %CppRangeForIterate.lookup_impl_witness.ae8, element0 [symbolic_self]
|
||||
// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
|
||||
// CHECK:STDOUT: %impl.elem1.fdc: type = impl_witness_access %CppRangeForIterate.lookup_impl_witness.ae8, element1 [symbolic_self]
|
||||
// CHECK:STDOUT: %CppRangeForIterate_where.type: type = facet_type <@CppRangeForIterate where %impl.elem0.354 impls @Destroy and %impl.elem1.fdc impls @Destroy> [symbolic_self]
|
||||
// CHECK:STDOUT: %CppRangeForIterate_where.type: type = facet_type <@CppRangeForIterate where %impl.elem0.354 impls @Destroy and %impl.elem1.fdc impls @Destroy> [concrete]
|
||||
// CHECK:STDOUT: %R: %CppRangeForIterate_where.type = symbolic_binding R, 0 [symbolic]
|
||||
// CHECK:STDOUT: %R.as_type: type = facet_access_type %R [symbolic]
|
||||
// CHECK:STDOUT: %pattern_type.ff859f.2: type = pattern_type %R.as_type [symbolic]
|
||||
@@ -1253,7 +1253,7 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd,
|
||||
// CHECK:STDOUT: %Sentinel.Op.type.37d: type = fn_type @Sentinel.Op.1 [concrete]
|
||||
// CHECK:STDOUT: %Sentinel.Op.26b: %Sentinel.Op.type.37d = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %custom_witness.415faa.2: <witness> = custom_witness (%Sentinel.Op.26b), @Destroy [concrete]
|
||||
// CHECK:STDOUT: %facet_value.b34: %CppRangeForIterate_where.type = facet_value %MutableRange, (%custom_witness.1bf5e5.1, %custom_witness.415faa.1, %custom_witness.415faa.2) [symbolic_self]
|
||||
// CHECK:STDOUT: %facet_value.b34: %CppRangeForIterate_where.type = facet_value %MutableRange, (%custom_witness.1bf5e5.1, %custom_witness.415faa.1, %custom_witness.415faa.2) [concrete]
|
||||
// CHECK:STDOUT: %Iterator.b6bc8f.2: type = class_type @Iterator.2 [concrete]
|
||||
// CHECK:STDOUT: %Sentinel.50a788.2: type = class_type @Sentinel.2 [concrete]
|
||||
// CHECK:STDOUT: %Begin.type.793876.2: type = fn_type @Begin.2 [concrete]
|
||||
@@ -1268,7 +1268,7 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd,
|
||||
// CHECK:STDOUT: %Sentinel.Op.type.152: type = fn_type @Sentinel.Op.2 [concrete]
|
||||
// CHECK:STDOUT: %Sentinel.Op.84b: %Sentinel.Op.type.152 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %custom_witness.0d3cfa.2: <witness> = custom_witness (%Sentinel.Op.84b), @Destroy [concrete]
|
||||
// CHECK:STDOUT: %facet_value.11c: %CppRangeForIterate_where.type = facet_value %ConstRange, (%custom_witness.1bf5e5.2, %custom_witness.0d3cfa.1, %custom_witness.0d3cfa.2) [symbolic_self]
|
||||
// CHECK:STDOUT: %facet_value.11c: %CppRangeForIterate_where.type = facet_value %ConstRange, (%custom_witness.1bf5e5.2, %custom_witness.0d3cfa.1, %custom_witness.0d3cfa.2) [concrete]
|
||||
// CHECK:STDOUT: %CppRangeForIterate.WithSelf.Begin.type.bf8: type = fn_type @CppRangeForIterate.WithSelf.Begin, @CppRangeForIterate.WithSelf(%CppRangeForIterate.facet.d1e) [concrete]
|
||||
// CHECK:STDOUT: %.504: type = fn_type_with_self_type %CppRangeForIterate.WithSelf.Begin.type.bf8, %CppRangeForIterate.facet.d1e [concrete]
|
||||
// CHECK:STDOUT: %CppRangeForIterate.WithSelf.End.type.580: type = fn_type @CppRangeForIterate.WithSelf.End, @CppRangeForIterate.WithSelf(%CppRangeForIterate.facet.d1e) [concrete]
|
||||
@@ -1453,7 +1453,7 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd,
|
||||
// CHECK:STDOUT: %impl.elem0.354: type = impl_witness_access %CppRangeForIterate.lookup_impl_witness.ae8, element0 [symbolic_self]
|
||||
// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
|
||||
// CHECK:STDOUT: %impl.elem1.fdc: type = impl_witness_access %CppRangeForIterate.lookup_impl_witness.ae8, element1 [symbolic_self]
|
||||
// CHECK:STDOUT: %CppRangeForIterate_where.type: type = facet_type <@CppRangeForIterate where %impl.elem0.354 impls @Destroy and %impl.elem1.fdc impls @Destroy> [symbolic_self]
|
||||
// CHECK:STDOUT: %CppRangeForIterate_where.type: type = facet_type <@CppRangeForIterate where %impl.elem0.354 impls @Destroy and %impl.elem1.fdc impls @Destroy> [concrete]
|
||||
// CHECK:STDOUT: %R: %CppRangeForIterate_where.type = symbolic_binding R, 0 [symbolic]
|
||||
// CHECK:STDOUT: %R.as_type: type = facet_access_type %R [symbolic]
|
||||
// CHECK:STDOUT: %pattern_type.ff859f.2: type = pattern_type %R.as_type [symbolic]
|
||||
@@ -1498,7 +1498,7 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd,
|
||||
// CHECK:STDOUT: %Iterator.Op.type: type = fn_type @Iterator.Op [concrete]
|
||||
// CHECK:STDOUT: %Iterator.Op: %Iterator.Op.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %custom_witness.2d3: <witness> = custom_witness (%Iterator.Op), @Destroy [concrete]
|
||||
// CHECK:STDOUT: %facet_value: %CppRangeForIterate_where.type = facet_value %MutableAndConstRange, (%custom_witness.827, %custom_witness.2d3) [symbolic_self]
|
||||
// CHECK:STDOUT: %facet_value: %CppRangeForIterate_where.type = facet_value %MutableAndConstRange, (%custom_witness.827, %custom_witness.2d3) [concrete]
|
||||
// CHECK:STDOUT: %CppRangeForIterate.WithSelf.Begin.type.706: type = fn_type @CppRangeForIterate.WithSelf.Begin, @CppRangeForIterate.WithSelf(%CppRangeForIterate.facet.98b) [concrete]
|
||||
// CHECK:STDOUT: %.ff3: type = fn_type_with_self_type %CppRangeForIterate.WithSelf.Begin.type.706, %CppRangeForIterate.facet.98b [concrete]
|
||||
// CHECK:STDOUT: %CppRangeForIterate.WithSelf.End.type.5f8: type = fn_type @CppRangeForIterate.WithSelf.End, @CppRangeForIterate.WithSelf(%CppRangeForIterate.facet.98b) [concrete]
|
||||
|
||||
Reference in New Issue
Block a user