Don't treat dependent types as having a copy value representation. (#6055)

Add `Dependent` value and initializing representations for types whose
representations are unknown because they are dependent. When generating
SemIR in such cases, use a worst-case initializing representation that
both provides a destination address and also propagates a potential
result value.

Use this to fix incorrect lowering and lowering crashes for specific
functions involving generic types that don't use a copy value
representation.

In lowering, be careful to distinguish between whether the initializing
representation for the generic return type uses a return slot (which
affects whether the SemIR declaration and call have one) and whether the
initializing representation for the specific return type uses a return
slot (which affects whether the LLVM IR declaration and call have one).
This commit is contained in:
Richard Smith
2025-09-15 23:59:00 +00:00
committed by GitHub
parent ca40e9d693
commit b44ba47cf3
53 changed files with 1375 additions and 670 deletions
+1 -1
View File
@@ -477,7 +477,7 @@ fn AccessMissingConcrete(I:! Interface(i32)) -> i32 {
// CHECK:STDOUT: %require_complete.loc8: <witness> = require_complete_type %T.loc8_25.1 [symbolic = %require_complete.loc8 (constants.%require_complete.4ae)]
// CHECK:STDOUT: %require_complete.loc13: <witness> = require_complete_type %Interface.type.loc8_50.1 [symbolic = %require_complete.loc13 (constants.%require_complete.a60)]
// CHECK:STDOUT:
// CHECK:STDOUT: fn() -> @AccessMissingGeneric.%T.loc8_25.1 (%T) {
// CHECK:STDOUT: fn() -> %return.param: @AccessMissingGeneric.%T.loc8_25.1 (%T) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %I.ref: @AccessMissingGeneric.%Interface.type.loc8_50.1 (%Interface.type.cc2) = name_ref I, %I.loc8_35.2 [symbolic = %I.loc8_35.1 (constants.%I.01f)]
// CHECK:STDOUT: %nonesuch.ref: <error> = name_ref nonesuch, <error> [concrete = <error>]