Skip to content

Commit ba0ec53

Browse files
committed
AST: Tweak a DynamicSelfType hack in the ASTPrinter
Let's use transformRec() instead of subst() here since we want to leave DependentMemberTypes unchanged. This avoids an assertion failure with the upcoming change to InFlightSubstitution::lookupConformance().
1 parent b911b80 commit ba0ec53

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

lib/AST/ASTPrinter.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4334,13 +4334,14 @@ void PrintAST::visitFuncDecl(FuncDecl *decl) {
43344334
if (proto && Options.TransformContext) {
43354335
auto BaseType = Options.TransformContext->getBaseType();
43364336
if (BaseType->getClassOrBoundGenericClass()) {
4337-
ResultTy = ResultTy.subst(
4338-
[&](Type t) -> Type {
4339-
if (t->isEqual(proto->getSelfInterfaceType()))
4337+
ResultTy = ResultTy.transformRec(
4338+
[&](TypeBase *t) -> std::optional<Type> {
4339+
if (isa<DependentMemberType>(t))
4340+
return t;
4341+
else if (t->isEqual(proto->getSelfInterfaceType()))
43404342
return DynamicSelfType::get(t, Ctx);
4341-
return t;
4342-
},
4343-
MakeAbstractConformanceForGenericType());
4343+
return std::nullopt;
4344+
});
43444345
ResultTyLoc = TypeLoc::withoutLoc(ResultTy);
43454346
}
43464347
}

0 commit comments

Comments
 (0)