Skip to content

Commit 7a3f12f

Browse files
committed
Sema: Small fix to get class property access working on subclass existentials
This is tested in the next commit. This code path is about to get more cleanup shortly to fix a miscompile with class existentials (not just subclass existentials; an old problem), so I'm not too concerned with adding the new conditinals here.
1 parent e7d9d00 commit 7a3f12f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/Sema/CSApply.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -897,18 +897,19 @@ namespace {
897897

898898
// If the base is already an lvalue with the right base type, we can
899899
// pass it as an inout qualified type.
900-
auto selfParamTy = selfTy;
900+
auto selfParamTy = isDynamic ? selfTy : containerTy;
901901

902902
if (selfTy->isEqual(baseTy))
903903
if (cs.getType(base)->is<LValueType>())
904904
selfParamTy = InOutType::get(selfTy);
905+
905906
base = coerceObjectArgumentToType(
906907
base, selfParamTy, member, semantics,
907908
locator.withPathElement(ConstraintLocator::MemberRefBase));
908909
} else {
909910
// Convert the base to an rvalue of the appropriate metatype.
910911
base = coerceToType(base,
911-
MetatypeType::get(selfTy),
912+
MetatypeType::get(isDynamic ? selfTy : containerTy),
912913
locator.withPathElement(
913914
ConstraintLocator::MemberRefBase));
914915
if (!base)

0 commit comments

Comments
 (0)