@@ -9446,23 +9446,26 @@ applySolutionToInitialization(SyntacticElementTarget target, Expr *initializer,
9446
9446
// If this property has an opaque result type, set the underlying type
9447
9447
// substitutions based on the initializer.
9448
9448
if (auto var = resultTarget.getInitializationPattern ()->getSingleVar ()) {
9449
- SubstitutionMap substitutions;
9450
- if (auto opaque = var->getOpaqueResultTypeDecl ()) {
9451
- resultTarget.getAsExpr ()->forEachChildExpr ([&](Expr *expr) -> Expr * {
9452
- if (auto coercionExpr = dyn_cast<UnderlyingToOpaqueExpr>(expr)) {
9453
- auto newSubstitutions =
9454
- coercionExpr->substitutions .mapReplacementTypesOutOfContext ();
9455
- if (substitutions.empty ()) {
9456
- substitutions = newSubstitutions;
9457
- } else {
9458
- assert (substitutions.getCanonical () ==
9459
- newSubstitutions.getCanonical ());
9449
+ if (!var->getParsedAccessor (AccessorKind::Get)) {
9450
+ if (auto opaque = var->getOpaqueResultTypeDecl ()) {
9451
+ SubstitutionMap substitutions;
9452
+
9453
+ resultTarget.getAsExpr ()->forEachChildExpr ([&](Expr *expr) -> Expr * {
9454
+ if (auto coercionExpr = dyn_cast<UnderlyingToOpaqueExpr>(expr)) {
9455
+ auto newSubstitutions =
9456
+ coercionExpr->substitutions .mapReplacementTypesOutOfContext ();
9457
+ if (substitutions.empty ()) {
9458
+ substitutions = newSubstitutions;
9459
+ } else {
9460
+ assert (substitutions.getCanonical () ==
9461
+ newSubstitutions.getCanonical ());
9462
+ }
9460
9463
}
9461
- }
9462
- return expr;
9463
- });
9464
+ return expr;
9465
+ });
9464
9466
9465
- opaque->setUniqueUnderlyingTypeSubstitutions (substitutions);
9467
+ opaque->setUniqueUnderlyingTypeSubstitutions (substitutions);
9468
+ }
9466
9469
}
9467
9470
}
9468
9471
0 commit comments