[AST] Rename ProtocolCompositionTypeRepr to CompositionTypeRepr

And make it be able to composite any TypeReprs.

Although Swift doesn't support composition of arbitrary types, AST
should be able to hold any TypeReprs, to represent syntax as accurate as
possible.
This commit is contained in:
Rintaro Ishizaki
2016-10-16 09:27:25 +09:00
parent b0a566942d
commit 2fb48c6594
10 changed files with 74 additions and 77 deletions

View File

@@ -2419,10 +2419,11 @@ ParserStatus Parser::parseInheritance(SmallVectorImpl<TypeLoc> &Inherited,
Status |= ParsedTypeResult;
// Cannot inherit from composition
if (auto Composition = dyn_cast_or_null<ProtocolCompositionTypeRepr>(ParsedTypeResult.getPtrOrNull())) {
if (auto Composition = dyn_cast_or_null<CompositionTypeRepr>(
ParsedTypeResult.getPtrOrNull())) {
// Record the protocols inside the composition.
Inherited.append(Composition->getProtocols().begin(),
Composition->getProtocols().end());
Inherited.append(Composition->getTypes().begin(),
Composition->getTypes().end());
// We can inherit from Any
if (!isAny) {
if (usesDeprecatedCompositionSyntax) {