mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Disallow inheritance clauses for concrete typealiases.
typealias MyInt: ForwardIndex = Int There is no real reason to allow this; it's just a static_assert that Int conforms to ForwardIndex, which would be better spelled some other way. This only applies to concrete typealiases, i.e. those that simply alias an underlying type. Associated types can still have both inheritance clauses and a (default) underlying type. Swift SVN r11481
This commit is contained in:
@@ -1080,6 +1080,8 @@ void Serializer::writeDecl(const Decl *D) {
|
||||
case DeclKind::TypeAlias: {
|
||||
auto typeAlias = cast<TypeAliasDecl>(D);
|
||||
assert(!typeAlias->isObjC() && "ObjC typealias is not meaningful");
|
||||
assert(typeAlias->getProtocols().empty() &&
|
||||
"concrete typealiases cannot have protocols");
|
||||
checkAllowedAttributes<>(typeAlias);
|
||||
|
||||
const Decl *DC = getDeclForContext(typeAlias->getDeclContext());
|
||||
@@ -1095,9 +1097,6 @@ void Serializer::writeDecl(const Decl *D) {
|
||||
addTypeRef(underlying),
|
||||
addTypeRef(typeAlias->getInterfaceType()),
|
||||
typeAlias->isImplicit());
|
||||
|
||||
writeConformances(typeAlias->getProtocols(), typeAlias->getConformances(),
|
||||
typeAlias, DeclTypeAbbrCodes);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user