mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user