The original check introduced by https://github.com/apple/swift/pull/71855
is too broad. For concrete metadata we call the runtime demangler so
we need to strip off marker protocols when mangling that string and
`mangleTypeForReflection` already does that.
The use of 'nocapture' for parameters and return values is incorrect for C++ types, as they can actually capture a pointer into its own value (e.g. std::string in libstdc++)
rdar://115062687
Associated type references can be mangled without reference to the
protocol they are in when there is only one protocol to which the
base type conforms. Because marker protocols can never have associated
types, don't consider them in this computation. This allows marker
protocols to be added more freely to, e.g., generic type requirements.
Fixes rdar://95994469.
Marker protocols don't exist at runtime, drop them when mangling a type
for the purposes of runtime type metadata or reflection. Fixes
rdar://82314404.
This assertion was tripping when the existential involved a marker
protocol, because it was checking for the number of protocols rather
than the number of protocols that require witness tables. Correct the
assertion and add a test.
Fixes rdar://83020734.
We had an imbalance where we counted conformance requirements to
marker protocols in the number of requirements in a protocol's
requirement signature, but then did not emit the requirement. Don't
count them, either.
A marker protocol is a protocol with no requirements and with no ABI
footprint. They can be used to indicate semantics, only, and one can
never have values of a marker protocol type.
We still mangle marker protocols when they are used as generic
requirements, because they are a distinguishing characteristic for
overloading, but "no ABI footprint" means no protocol descriptors,
conformance descriptors, or dynamic discovery of any kind.