mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Ban generic parameters on extensions.
We no longer allow extensions to provide generic parameters, and the
ability to parse the syntax
extension Array<String> { ... }
is causing confusion. Fixes rdar://problem/20873336.
Swift SVN r28468
This commit is contained in:
@@ -2265,11 +2265,17 @@ Parser::parseDeclExtension(ParseDeclOptions Flags, DeclAttributes &Attributes) {
|
||||
if (status.isError())
|
||||
break;
|
||||
|
||||
// Parse the generic parameter list.
|
||||
// Skip over a generic parameter or argument list; they are not
|
||||
// permitted on extensions.
|
||||
GenericParamList *genericParams = nullptr;
|
||||
{
|
||||
Scope scope(this, ScopeKind::Generics);
|
||||
genericParams = maybeParseGenericParams();
|
||||
if (startsWithLess(Tok)) {
|
||||
SourceLoc lAngleLoc = consumeStartingLess();
|
||||
skipUntilGreaterInTypeList();
|
||||
SourceLoc rAngleLoc = Tok.getLoc();
|
||||
if (startsWithGreater(Tok))
|
||||
consumeStartingGreater();
|
||||
diagnose(nameLoc, diag::extension_generic_params_args, name)
|
||||
.highlight(SourceRange(lAngleLoc, rAngleLoc));
|
||||
}
|
||||
|
||||
auto TyR = new (Context) SimpleIdentTypeRepr(nameLoc, name);
|
||||
|
||||
Reference in New Issue
Block a user