@@ -3521,14 +3521,6 @@ SILGenModule::emitKeyPathComponentForDecl(SILLocation loc,
3521
3521
return storage->isSettable (storage->getDeclContext ());
3522
3522
};
3523
3523
3524
- // We cannot use the same opened archetype in the getter and setter. Therefore
3525
- // we create a new one for both the getter and the setter.
3526
- auto renewOpenedArchetypes = [](SubstitutableType *type) -> Type {
3527
- if (auto *openedTy = dyn_cast<OpenedArchetypeType>(type))
3528
- return OpenedArchetypeType::get (openedTy->getOpenedExistentialType ());
3529
- return type;
3530
- };
3531
-
3532
3524
if (auto var = dyn_cast<VarDecl>(storage)) {
3533
3525
CanType componentTy;
3534
3526
if (!var->getDeclContext ()->isTypeContext ()) {
@@ -3552,15 +3544,13 @@ SILGenModule::emitKeyPathComponentForDecl(SILLocation loc,
3552
3544
auto id = getIdForKeyPathComponentComputedProperty (*this , var,
3553
3545
strategy);
3554
3546
auto getter = getOrCreateKeyPathGetter (*this , loc,
3555
- var, subs.subst (renewOpenedArchetypes,
3556
- MakeAbstractConformanceForGenericType ()),
3547
+ var, subs,
3557
3548
needsGenericContext ? genericEnv : nullptr ,
3558
3549
expansion, {}, baseTy, componentTy);
3559
3550
3560
3551
if (isSettableInComponent ()) {
3561
3552
auto setter = getOrCreateKeyPathSetter (*this , loc,
3562
- var, subs.subst (renewOpenedArchetypes,
3563
- MakeAbstractConformanceForGenericType ()),
3553
+ var, subs,
3564
3554
needsGenericContext ? genericEnv : nullptr ,
3565
3555
expansion, {}, baseTy, componentTy);
3566
3556
return KeyPathPatternComponent::forComputedSettableProperty (id,
@@ -3605,8 +3595,7 @@ SILGenModule::emitKeyPathComponentForDecl(SILLocation loc,
3605
3595
3606
3596
auto id = getIdForKeyPathComponentComputedProperty (*this , decl, strategy);
3607
3597
auto getter = getOrCreateKeyPathGetter (*this , loc,
3608
- decl, subs.subst (renewOpenedArchetypes,
3609
- MakeAbstractConformanceForGenericType ()),
3598
+ decl, subs,
3610
3599
needsGenericContext ? genericEnv : nullptr ,
3611
3600
expansion,
3612
3601
indexTypes,
@@ -3615,8 +3604,7 @@ SILGenModule::emitKeyPathComponentForDecl(SILLocation loc,
3615
3604
auto indexPatternsCopy = getASTContext ().AllocateCopy (indexPatterns);
3616
3605
if (isSettableInComponent ()) {
3617
3606
auto setter = getOrCreateKeyPathSetter (*this , loc,
3618
- decl, subs.subst (renewOpenedArchetypes,
3619
- MakeAbstractConformanceForGenericType ()),
3607
+ decl, subs,
3620
3608
needsGenericContext ? genericEnv : nullptr ,
3621
3609
expansion,
3622
3610
indexTypes,
0 commit comments