Files
Slava Pestov f8f48d173c ASTMangler: Fix incorrect mangling of retroactive conformances to marker protocols
We turn off the AllowMarkerProtocols mangler flag when
mangling the types that are passed into the runtime demangler.

The logic in appendAnyProtocolConformance() was wrong when
this flag was set; we would early exit from this function,
but then appendRetroactiveConformances() would still call
appendListSeparator(). The would result in an invalid mangled
string which could not be parsed by the demangler.

In particular, this meant that the recent changes to generalize
Equatable to allow non-Copyable and non-Escapable conformers
could introduce runtime crashes, because a mangled string for
a retroactive conformance to Equatable could be incorrect.

The fix is to handle AllowMarkerProtocols further up in
forEachConditionalConformance().

Note that this change should not directly change ABI, because
AllowMarkerProtocols is on for symbol names.

When AllowMarkerProtocols is on, we still always mangle
conformances to Copyable and Escapable in this code path.

This means that even with this change, mangling a symbol name
that contains a retroactive conformance to Equatable can output
a different string than in Swift 6.3, which means we have an ABI
break. That problem requires a separate fix.

- Fixes rdar://problem/168023786.
2026-01-15 22:11:30 -05:00
..