@@ -3514,14 +3514,6 @@ SILGenModule::emitKeyPathComponentForDecl(SILLocation loc,
3514
3514
return storage->isSettable (storage->getDeclContext ());
3515
3515
};
3516
3516
3517
- // We cannot use the same opened archetype in the getter and setter. Therefore
3518
- // we create a new one for both the getter and the setter.
3519
- auto renewOpenedArchetypes = [](SubstitutableType *type) -> Type {
3520
- if (auto *openedTy = dyn_cast<OpenedArchetypeType>(type))
3521
- return OpenedArchetypeType::get (openedTy->getOpenedExistentialType ());
3522
- return type;
3523
- };
3524
-
3525
3517
if (auto var = dyn_cast<VarDecl>(storage)) {
3526
3518
CanType componentTy;
3527
3519
if (!var->getDeclContext ()->isTypeContext ()) {
@@ -3545,15 +3537,13 @@ SILGenModule::emitKeyPathComponentForDecl(SILLocation loc,
3545
3537
auto id = getIdForKeyPathComponentComputedProperty (*this , var,
3546
3538
strategy);
3547
3539
auto getter = getOrCreateKeyPathGetter (*this , loc,
3548
- var, subs.subst (renewOpenedArchetypes,
3549
- MakeAbstractConformanceForGenericType ()),
3540
+ var, subs,
3550
3541
needsGenericContext ? genericEnv : nullptr ,
3551
3542
expansion, {}, baseTy, componentTy);
3552
3543
3553
3544
if (isSettableInComponent ()) {
3554
3545
auto setter = getOrCreateKeyPathSetter (*this , loc,
3555
- var, subs.subst (renewOpenedArchetypes,
3556
- MakeAbstractConformanceForGenericType ()),
3546
+ var, subs,
3557
3547
needsGenericContext ? genericEnv : nullptr ,
3558
3548
expansion, {}, baseTy, componentTy);
3559
3549
return KeyPathPatternComponent::forComputedSettableProperty (id,
@@ -3598,8 +3588,7 @@ SILGenModule::emitKeyPathComponentForDecl(SILLocation loc,
3598
3588
3599
3589
auto id = getIdForKeyPathComponentComputedProperty (*this , decl, strategy);
3600
3590
auto getter = getOrCreateKeyPathGetter (*this , loc,
3601
- decl, subs.subst (renewOpenedArchetypes,
3602
- MakeAbstractConformanceForGenericType ()),
3591
+ decl, subs,
3603
3592
needsGenericContext ? genericEnv : nullptr ,
3604
3593
expansion,
3605
3594
indexTypes,
@@ -3608,8 +3597,7 @@ SILGenModule::emitKeyPathComponentForDecl(SILLocation loc,
3608
3597
auto indexPatternsCopy = getASTContext ().AllocateCopy (indexPatterns);
3609
3598
if (isSettableInComponent ()) {
3610
3599
auto setter = getOrCreateKeyPathSetter (*this , loc,
3611
- decl, subs.subst (renewOpenedArchetypes,
3612
- MakeAbstractConformanceForGenericType ()),
3600
+ decl, subs,
3613
3601
needsGenericContext ? genericEnv : nullptr ,
3614
3602
expansion,
3615
3603
indexTypes,
0 commit comments