in order to work correctly for non-@objc protocols.

Language features like erasing concrete metatype
values are also left for the future.  Still, baby steps.

The singleton ordinary metatype for existential types
is still potentially useful; we allow it to be written
as P.Protocol.

I've been somewhat cavalier in making code accept
AnyMetatypeType instead of a more specific type, and
it's likely that a number of these places can and
should be more restrictive.
When T is an existential type, parse T.Type as an
ExistentialMetatypeType instead of a MetatypeType.

An existential metatype is the formal type
 \exists t:P . (t.Type)
whereas the ordinary metatype is the formal type
 (\exists t:P . t).Type
which is singleton.  Our inability to express that
difference was leading to an ever-increasing cascade
of hacks where information is shadily passed behind
the scenes in order to make various operations with
static members of protocols work correctly.

This patch takes the first step towards fixing that
by splitting out existential metatypes and giving
them a pointer representation.  Eventually, we will
need them to be able to carry protocol witness tables

Swift SVN r15716
This commit is contained in:
John McCall
2014-04-01 00:38:28 +00:00
parent 83a830eb8a
commit f1180f5e6d
64 changed files with 883 additions and 256 deletions

View File

@@ -412,6 +412,12 @@ namespace decls_block {
MetatypeRepresentationField // representation
>;
using ExistentialMetatypeTypeLayout = BCRecordLayout<
EXISTENTIAL_METATYPE_TYPE,
TypeIDField, // instance type
MetatypeRepresentationField // representation
>;
using LValueTypeLayout = BCRecordLayout<
LVALUE_TYPE,
TypeIDField // object type