Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions include/swift/SIL/SILCloner.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,14 +293,18 @@ class SILCloner : protected SILInstructionVisitor<ImplClass> {
continue;
}

// Substitute the shape class of the expansion.
// Substitute the shape class of the expansion. If this doesn't
// give us a pack (e.g. if this isn't a substituting clone),
// we're never erasing tuple structure.
auto newShapeClass = getOpASTType(expansion.getCountType());
auto newShapePack = dyn_cast<PackType>(newShapeClass);
if (!newShapePack)
return false;

// If the element has a name, then the tuple sticks around unless
// the expansion disappears completely.
if (type->getElement(index).hasName()) {
if (newShapePack && newShapePack->getNumElements() == 0)
if (newShapePack->getNumElements() == 0)
continue;
return false;
}
Expand Down
10 changes: 10 additions & 0 deletions test/SILOptimizer/Inputs/cross-module/cross-module.swift
Original file line number Diff line number Diff line change
Expand Up @@ -295,3 +295,13 @@ public func getEmptySet() -> Set<Int> {
return Set()
}

public protocol Visitable {
func visit()
}
@available(SwiftStdlib 6.0, *)
public struct S<each T : Visitable> {
var storage: (repeat each T)
public func visit() {
_ = (repeat (each storage).visit())
}
}