Skip to content

Commit 6caf827

Browse files
johnno1962DougGregor
authored andcommitted
Cater for case when existential to open is a "var".
1 parent 2028931 commit 6caf827

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/Sema/CSSimplify.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1547,6 +1547,10 @@ shouldOpenExistentialCallArgument(
15471547
adjustments |= OpenedExistentialAdjustmentFlags::InOut;
15481548
}
15491549

1550+
// The argument may be a "var" instead of a "let".
1551+
if (auto lv = dyn_cast<LValueType>(argTy->getCanonicalType()))
1552+
argTy = lv->getObjectType();
1553+
15501554
// The argument type needs to be an existential type or metatype thereof.
15511555
if (!argTy->isAnyExistentialType())
15521556
return None;

0 commit comments

Comments
 (0)