Commit Graph

10 Commits

Author SHA1 Message Date
Anthony Latsis
5e41794680 AST: Quote attributes more consistently in DiagnosticsSema.def 2025-04-23 19:18:08 +01:00
Slava Pestov
f42330151a Sema: Fix @marker attribute checking 2024-03-21 14:49:05 -04:00
Pavel Yaskevich
9dcb921484 [TypeChecker] Reject @objc attribute on marker protocols 2023-10-30 10:21:04 -07:00
omochimetaru
ed164aa47f fix test case 2022-11-11 19:02:50 +09:00
Doug Gregor
7d7ec9e7d5 Don't emit marker protocols into runtime type metadata.
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.
2021-10-15 17:53:30 -07:00
Doug Gregor
618378ae48 Ban use of marker protocols in conditional conformances to non-marker protocols
These conditional conformances could not be properly evaluated at
runtime, so ban them. We still allow conditional conformances to
marker protocols.
2021-02-20 22:04:22 -08:00
Doug Gregor
9df17fff93 Allow implied conditional conformances to marker protocols.
This improves source compatibility in cases where a marker
protocol is introduced after-the-fact (e.g., for `Error`),
and is safe because there's no runtime component to marker protocols.
2021-02-20 21:10:18 -08:00
Doug Gregor
66cd7d82ae Marker protocols are self-conforming. 2021-02-18 23:44:39 -08:00
Doug Gregor
85611dbf25 Allow marker protocols as existentials (but still ban casts)
There is no problem with having an existential value that involves a
marker protocol. However, since there is no runtime checking for
marker protocols, ban "as?" and "is" casts to them.
2021-02-18 23:44:39 -08:00
Doug Gregor
c9d66f0d35 Add "marker" protocols, indicated by @_marker.
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.
2021-02-02 21:53:26 -08:00