Skip to content

Commit fd86e03

Browse files
Merge pull request #64971 from nate-chandler/rdar107709069
[TypeLowering] Fixed verifier variable shadowing.
2 parents 417bc5a + 6e7a91b commit fd86e03

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/SIL/IR/TypeLowering.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2745,7 +2745,7 @@ bool TypeConverter::visitAggregateLeaves(
27452745
Optional<unsigned> maybeIndex;
27462746
if (index != UINT_MAX)
27472747
maybeIndex = {index};
2748-
return {ty, origTy, field, index};
2748+
return {ty, origTy, field, maybeIndex};
27492749
};
27502750
auto isAggregate = [](CanType ty) {
27512751
return isa<SILPackType>(ty) ||
@@ -2761,6 +2761,7 @@ bool TypeConverter::visitAggregateLeaves(
27612761
ValueDecl *field;
27622762
Optional<unsigned> index;
27632763
std::tie(ty, origTy, field, index) = popFromWorklist();
2764+
assert(!field || !index && "both field and index!?");
27642765
if (isAggregate(ty) && !isLeafAggregate(ty, origTy, field, index)) {
27652766
if (auto packTy = dyn_cast<SILPackType>(ty)) {
27662767
for (auto packIndex : indices(packTy->getElementTypes())) {

test/SILGen/lexical_lifetime.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ enum E {
2626
@_silgen_name("use_generic")
2727
func use_generic<T>(_ t: T) {}
2828

29+
struct NonlexicalBox<X> {
30+
@_eagerMove var x: X
31+
}
32+
2933
////////////////////////////////////////////////////////////////////////////////
3034
// Declarations }}
3135
////////////////////////////////////////////////////////////////////////////////
@@ -147,6 +151,8 @@ extension C {
147151
func eagermove_method_attr() {}
148152
}
149153

154+
func f<T>() -> (NonlexicalBox<T>) {}
155+
150156
////////////////////////////////////////////////////////////////////////////////
151157
// Test }}
152158
////////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)