mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Sema: Subscript default arguments
Fixes <https://bugs.swift.org/browse/SR-6118>.
This commit is contained in:
@@ -6364,10 +6364,11 @@ Parser::parseDeclSubscript(ParseDeclOptions Flags,
|
||||
return makeParserCodeCompletionStatus();
|
||||
|
||||
// Parse the parameter list.
|
||||
DefaultArgumentInfo DefaultArgs;
|
||||
SmallVector<Identifier, 4> argumentNames;
|
||||
ParserResult<ParameterList> Indices
|
||||
= parseSingleParameterClause(ParameterContextKind::Subscript,
|
||||
&argumentNames);
|
||||
&argumentNames, &DefaultArgs);
|
||||
Status |= Indices;
|
||||
|
||||
SignatureHasCodeCompletion |= Indices.hasCodeCompletion();
|
||||
@@ -6419,6 +6420,8 @@ Parser::parseDeclSubscript(ParseDeclOptions Flags,
|
||||
nullptr);
|
||||
Subscript->getAttrs() = Attributes;
|
||||
|
||||
DefaultArgs.setFunctionContext(Subscript, Subscript->getIndices());
|
||||
|
||||
// Parse a 'where' clause if present, adding it to our GenericParamList.
|
||||
if (Tok.is(tok::kw_where)) {
|
||||
ContextChange CC(*this, Subscript);
|
||||
|
||||
Reference in New Issue
Block a user