@@ -4489,7 +4489,8 @@ bool Parser::canParseTypeAttribute() {
44894489 TypeOrCustomAttr result; // ignored
44904490 PatternBindingInitializer *initContext = nullptr ;
44914491 return !parseTypeAttribute (result, /* atLoc=*/ SourceLoc (),
4492- /* atEndLoc=*/ SourceLoc (), initContext,
4492+ /* atEndLoc=*/ SourceLoc (),
4493+ ParseTypeReason::Unspecified, initContext,
44934494 /* justChecking*/ true )
44944495 .isError ();
44954496}
@@ -4690,6 +4691,7 @@ bool Parser::parseUUIDString(UUID &uuid, Diag<> diagnostic, bool justChecking) {
46904691// / no need to actually record the attribute
46914692ParserStatus Parser::parseTypeAttribute (TypeOrCustomAttr &result,
46924693 SourceLoc AtLoc, SourceLoc AtEndLoc,
4694+ ParseTypeReason reason,
46934695 PatternBindingInitializer *&initContext,
46944696 bool justChecking) {
46954697 if (AtEndLoc != Tok.getLoc ()) {
@@ -4705,7 +4707,14 @@ ParserStatus Parser::parseTypeAttribute(TypeOrCustomAttr &result,
47054707 if (Tok.is (tok::code_complete)) {
47064708 if (!justChecking) {
47074709 if (CodeCompletionCallbacks) {
4708- CodeCompletionCallbacks->completeTypeAttrBeginning ();
4710+ switch (reason) {
4711+ case ParseTypeReason::InheritanceClause:
4712+ CodeCompletionCallbacks->completeTypeAttrInheritanceBeginning ();
4713+ break ;
4714+ default :
4715+ CodeCompletionCallbacks->completeTypeAttrBeginning ();
4716+ break ;
4717+ }
47094718 }
47104719 }
47114720 consumeToken (tok::code_complete);
@@ -5534,7 +5543,8 @@ ParserStatus Parser::ParsedTypeAttributeList::slowParse(Parser &P) {
55345543 TypeOrCustomAttr result;
55355544 SourceLoc AtEndLoc = Tok.getRange ().getEnd ();
55365545 SourceLoc AtLoc = P.consumeToken ();
5537- status |= P.parseTypeAttribute (result, AtLoc, AtEndLoc, initContext);
5546+ status |=
5547+ P.parseTypeAttribute (result, AtLoc, AtEndLoc, ParseReason, initContext);
55385548 if (status.isError ())
55395549 return status;
55405550 if (result)
@@ -6803,7 +6813,8 @@ ParserStatus Parser::parseInheritance(
68036813 continue ;
68046814 }
68056815
6806- auto ParsedTypeResult = parseType ();
6816+ auto ParsedTypeResult =
6817+ parseType (diag::expected_type, ParseTypeReason::InheritanceClause);
68076818 Status |= ParsedTypeResult;
68086819
68096820 // Record the type if its a single type.
0 commit comments