File tree Expand file tree Collapse file tree 1 file changed +5
-11
lines changed Expand file tree Collapse file tree 1 file changed +5
-11
lines changed Original file line number Diff line number Diff line change @@ -838,19 +838,13 @@ emitKeyPathComponent(IRGenModule &IGM,
838
838
// different ways we need to go about this.
839
839
if (loweredBaseTy.getClassOrBoundGenericClass ()) {
840
840
841
- // Walk up the class hierarchy to find the class decl that matches the
842
- // property's class decl and use this type to determin the field access.
841
+ // Use the property's class type to determine the field access.
843
842
auto propertyBaseDecl = property->getDeclContext ()->getSelfClassDecl ();
844
- auto currentBaseTy = loweredBaseTy.getASTType ();
845
- while (currentBaseTy->getClassOrBoundGenericClass () != propertyBaseDecl &&
846
- currentBaseTy->getClassOrBoundGenericClass ()->hasSuperclass ()) {
847
- currentBaseTy = currentBaseTy->getClassOrBoundGenericClass ()
848
- ->getSuperclass ()
849
- ->getCanonicalType ();
850
- }
843
+ auto currentBaseTy =
844
+ loweredBaseTy.getASTType ()->getSuperclassForDecl (propertyBaseDecl);
851
845
assert (currentBaseTy->getClassOrBoundGenericClass () == propertyBaseDecl);
852
- loweredBaseTy = IGM. getLoweredType ( AbstractionPattern::getOpaque (),
853
- currentBaseTy-> getWithoutSpecifierType () );
846
+ loweredBaseTy =
847
+ IGM. getLoweredType ( AbstractionPattern::getOpaque (), currentBaseTy );
854
848
855
849
switch (getClassFieldAccess (IGM, loweredBaseTy, property)) {
856
850
case FieldAccess::ConstantDirect: {
You can’t perform that action at this time.
0 commit comments