Files
Kavon Farvardin b7d57f3bcd Reparenting: use resilient indexing to access base witness table
Ordinary base protocols use fixed-indexing to access the base index.
That means adding another base protocol to an existing protocol
can break the order of the entries, and thus clients, because we
otherwise order the base entires with TypeDecl::compare.

Reparentable protocols are meant to be resilient to that, so we
order them at the end of the base entries list, just before the
other resilient entries in the witness table.

This patch completes the picture, by having the reparentable
protocol entries be indexed resiliently, in the same manner as
associated conformances.

The difference is that we can skip the call to
`swift_getAssociatedConformanceWitness`
and compute the index directly by finding the distance of the
descriptors, because we know all base protocol witness table
entries are eagarly instantiated.

Using this distance protects us from the ordering problems
of entries among all of the reparentable base protocols.

resolves rdar://173409851
2026-04-20 17:37:36 -07:00
..