Merge pull request #85625 from aschwaighofer/wip_embedded_cast_tuples

[embedded] Allow casting to tuples and tighten the check which existentials we support in embedded with existentials
This commit is contained in:
Arnold Schwaighofer
2025-12-01 08:27:43 -08:00
committed by GitHub
4 changed files with 250 additions and 3 deletions

View File

@@ -94,6 +94,11 @@ private struct FunctionChecker {
for conf in ie.conformances {
try checkConformance(conf, location: ie.location)
}
} else if instruction is OpenExistentialAddrInst {
// okay in embedded with exitentials
} else {
// not supported even in embedded with exitentials
throw Diagnostic(.embedded_swift_existential_type, instruction.operands[0].value.type, at: instruction.location)
}
case let aeb as AllocExistentialBoxInst:

View File

@@ -1051,8 +1051,7 @@ func isCastSupportedInEmbeddedSwift(from sourceType: Type,
return false
}
// Tuple?
if !destType.isStruct && !destType.isClass && !destType.isEnum {
if !destType.isStruct && !destType.isClass && !destType.isEnum && !destType.isTuple {
return false
}