Files
swift-mirror/validation-test/IRGen/rdar147207926.swift
Nate Chandler aa49b8540d [TypeLowering] Record packs used in signatures.
To determine whether an instruction may require pack metadata, the types
of its operands are examined.

Previously, the top level type was checked for having a pack in its
signature, and the whole type was checked for having a type anywhere in
its layout (via TypeLowering).  This didn't account for the case where
the metadata was required for a resilient type which uses a pack in its
signature.

Here, during type lowering, a type having a pack in its signature is
counted towards the type having a pack.

Fixes a compiler crash.

rdar://147207926
2025-05-20 16:53:28 -07:00

66 lines
1.6 KiB
Swift

// RUN: %empty-directory(%t)
// RUN: split-file %s %t
// RUN: %target-swift-frontend \
// RUN: %t/Library.swift \
// RUN: -emit-module \
// RUN: -target %target-swift-5.9-abi-triple \
// RUN: -enable-library-evolution \
// RUN: -module-name Library \
// RUN: -emit-module-path %t/Library.swiftmodule
// RUN: %target-build-swift \
// RUN: %t/Downstream.swift \
// RUN: -c \
// RUN: -target %target-swift-5.9-abi-triple \
// RUN: -parse-as-library \
// RUN: -module-name main \
// RUN: -lLibrary \
// RUN: -I %t \
// RUN: -o %t/Executable.o
//--- Library.swift
public struct Paq<each T> {
public var uette: (repeat each T)
}
public class Loq<each T> {
}
// Enums don't take packs yet.
// public enum Orq<each T> {
// case uette(repeat each T)
// case uettette(repeat each T, repeat each T)
// }
//--- Downstream.swift
import Library
struct Sleeve<T> {
var impl: Paq<T>
}
func bin<Moribund>(_ s: consuming Sleeve<Moribund>) {
}
struct Laq<T> {
var impl: Loq<T>
var t: T
}
@_silgen_name("bun")
func bun<T>(_ l: consuming Laq<T>) {
}
// Enums don't take packs yet.
// struct Etiq<T> {
// var impl: Orq<T>
// }
//
// func bon<Moribund>(_ i: consuming Etiq<Moribund>) {
// }