Skip to content

Commit 97ce526

Browse files
committed
Sema: Replace a usage of SubstFlags::SubstituteOpaqueArchetypes with transformRec()
The semantics of SubstFlags::SubstituteOpaqueArchetypes are changing so this is no longer useful here.
1 parent ef0164d commit 97ce526

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

lib/Sema/CSApply.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7515,17 +7515,15 @@ Expr *ExprRewriter::coerceToType(Expr *expr, Type toType,
75157515
if (!substitutions.empty()) {
75167516
// Compute the underlying type by replacing all opaque archetypes with
75177517
// the fixed type of their opened type.
7518-
auto underlyingType = toType.subst(
7519-
[&](SubstitutableType *type) -> Type {
7520-
if (auto *opaqueType = type->getAs<OpaqueTypeArchetypeType>()) {
7518+
auto underlyingType = toType.transformRec(
7519+
[&](TypeBase *type) -> std::optional<Type> {
7520+
if (auto *opaqueType = dyn_cast<OpaqueTypeArchetypeType>(type)) {
75217521
if (opaqueType->getDecl() == opaqueDecl) {
75227522
return opaqueType->getInterfaceType().subst(substitutions);
75237523
}
75247524
}
7525-
return type;
7526-
},
7527-
LookUpConformanceInModule(),
7528-
SubstFlags::SubstituteOpaqueArchetypes);
7525+
return std::nullopt;
7526+
});
75297527

75307528
// Coerce the result expression to the underlying type.
75317529
// FIXME: Wrong locator?

0 commit comments

Comments
 (0)