AST: Introduce primitive AnyObject type

Add a 'hasExplicitAnyObject()' bit to ProtocolCompositionType
to represent canonical composition types containing '& AnyObject'.

Serialize this bit and take it into account when building
ExistentialLayouts.

Rename ProtocolCompositionType::getProtocols() to getMembers()
since it can contain classes now, and update a few usages that
need further attention with FIXMEs or asserts.

For now, nothing actually constructs these types, and they will
trigger arounds asserts. Upcoming patches will introduce support
for this.
This commit is contained in:
Slava Pestov
2017-04-13 01:00:25 -07:00
parent ce3f098021
commit d49f8fb6d9
22 changed files with 178 additions and 104 deletions

View File

@@ -54,7 +54,7 @@ const uint16_t VERSION_MAJOR = 0;
/// in source control, you should also update the comment to briefly
/// describe what change you made. The content of this comment isn't important;
/// it just ensures a conflict if two people change the module format.
const uint16_t VERSION_MINOR = 333; // Last change: AST constant_string_literal
const uint16_t VERSION_MINOR = 334; // Last change: AnyObject bit in ProtocolCompositionType
using DeclID = PointerEmbeddedInt<unsigned, 31>;
using DeclIDField = BCFixed<31>;
@@ -660,6 +660,7 @@ namespace decls_block {
using ProtocolCompositionTypeLayout = BCRecordLayout<
PROTOCOL_COMPOSITION_TYPE,
BCFixed<1>, // has AnyObject constraint
BCArray<TypeIDField> // protocols
>;