Skip to content

Commit 52e496d

Browse files
committed
ASTPrinter: Remove opaque archetype re-sugaring hack
We cannot in general assume the substitution map's replacement types are written in terms of the generic signautre of the owner declaration. This was only necessary because this substitution map did not preserve type sugar, but now that it does, we no longer need this hack.
1 parent 8cf491f commit 52e496d

File tree

1 file changed

+0
-15
lines changed

1 file changed

+0
-15
lines changed

lib/AST/ASTPrinter.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3634,16 +3634,6 @@ void PrintAST::visitTypeAliasDecl(TypeAliasDecl *decl) {
36343634

36353635
if (ShouldPrint) {
36363636
Printer << " = ";
3637-
// FIXME: An inferred associated type witness type alias may reference
3638-
// an opaque type, but OpaqueTypeArchetypes are always canonicalized
3639-
// so lose type sugar for generic params. Bind the generic signature so
3640-
// we can map params back into the generic signature and print them
3641-
// correctly.
3642-
//
3643-
// Remove this when we have a way to represent non-canonical archetypes
3644-
// preserving sugar.
3645-
PrintOptions::OverrideScope scope(Options);
3646-
OVERRIDE_PRINT_OPTION(scope, GenericSig, decl->getGenericSignature().getPointer());
36473637
printTypeLoc(TypeLoc(decl->getUnderlyingTypeRepr(), Ty));
36483638
printDeclGenericRequirements(decl);
36493639
}
@@ -7500,11 +7490,6 @@ class TypePrinter : public TypeVisitor<TypePrinter, void, NonRecursivePrintOptio
75007490
if (auto existential = constraint->getAs<ExistentialType>())
75017491
constraint = existential->getConstraintType();
75027492

7503-
// Opaque archetype substitutions are always canonical, so re-sugar the
7504-
// constraint type using the owning declaration's generic parameter names.
7505-
if (genericSig)
7506-
constraint = genericSig->getSugaredType(constraint);
7507-
75087493
visit(constraint);
75097494
return;
75107495
}

0 commit comments

Comments
 (0)