@@ -9446,23 +9446,26 @@ applySolutionToInitialization(SyntacticElementTarget target, Expr *initializer,
94469446 // If this property has an opaque result type, set the underlying type
94479447 // substitutions based on the initializer.
94489448 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+ }
94609463 }
9461- }
9462- return expr;
9463- });
9464+ return expr;
9465+ });
94649466
9465- opaque->setUniqueUnderlyingTypeSubstitutions (substitutions);
9467+ opaque->setUniqueUnderlyingTypeSubstitutions (substitutions);
9468+ }
94669469 }
94679470 }
94689471
0 commit comments