We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c498f37 commit 1e4eca8Copy full SHA for 1e4eca8
lib/AST/ASTScope.cpp
@@ -1439,6 +1439,13 @@ SourceRange ASTScope::getSourceRangeImpl() const {
1439
return cast<NominalTypeDecl>(iterableDeclContext)->getBraces();
1440
1441
case ASTScopeKind::GenericParams:
1442
+ // A protocol's generic parameter list is not written in source, and
1443
+ // is visible from the start of the body.
1444
+ if (auto *protoDecl = dyn_cast<ProtocolDecl>(genericParams.decl)) {
1445
+ return SourceRange(protoDecl->getBraces().Start,
1446
+ protoDecl->getEndLoc());
1447
+ }
1448
+
1449
// Explicitly-written generic parameters are in scope following their
1450
// definition.
1451
return SourceRange(genericParams.params->getParams()[genericParams.index]
0 commit comments