@@ -4483,7 +4483,8 @@ bool Parser::canParseTypeAttribute() {
44834483 TypeOrCustomAttr result; // ignored
44844484 PatternBindingInitializer *initContext = nullptr ;
44854485 return !parseTypeAttribute (result, /* atLoc=*/ SourceLoc (),
4486- /* atEndLoc=*/ SourceLoc (), initContext,
4486+ /* atEndLoc=*/ SourceLoc (),
4487+ ParseTypeReason::Unspecified, initContext,
44874488 /* justChecking*/ true )
44884489 .isError ();
44894490}
@@ -4684,6 +4685,7 @@ bool Parser::parseUUIDString(UUID &uuid, Diag<> diagnostic, bool justChecking) {
46844685// / no need to actually record the attribute
46854686ParserStatus Parser::parseTypeAttribute (TypeOrCustomAttr &result,
46864687 SourceLoc AtLoc, SourceLoc AtEndLoc,
4688+ ParseTypeReason reason,
46874689 PatternBindingInitializer *&initContext,
46884690 bool justChecking) {
46894691 if (AtEndLoc != Tok.getLoc ()) {
@@ -4699,7 +4701,14 @@ ParserStatus Parser::parseTypeAttribute(TypeOrCustomAttr &result,
46994701 if (Tok.is (tok::code_complete)) {
47004702 if (!justChecking) {
47014703 if (CodeCompletionCallbacks) {
4702- CodeCompletionCallbacks->completeTypeAttrBeginning ();
4704+ switch (reason) {
4705+ case ParseTypeReason::InheritanceClause:
4706+ CodeCompletionCallbacks->completeTypeAttrInheritanceBeginning ();
4707+ break ;
4708+ default :
4709+ CodeCompletionCallbacks->completeTypeAttrBeginning ();
4710+ break ;
4711+ }
47034712 }
47044713 }
47054714 consumeToken (tok::code_complete);
@@ -5525,7 +5534,8 @@ ParserStatus Parser::ParsedTypeAttributeList::slowParse(Parser &P) {
55255534 TypeOrCustomAttr result;
55265535 SourceLoc AtEndLoc = Tok.getRange ().getEnd ();
55275536 SourceLoc AtLoc = P.consumeToken ();
5528- status |= P.parseTypeAttribute (result, AtLoc, AtEndLoc, initContext);
5537+ status |=
5538+ P.parseTypeAttribute (result, AtLoc, AtEndLoc, ParseReason, initContext);
55295539 if (status.isError ())
55305540 return status;
55315541 if (result)
@@ -6806,7 +6816,8 @@ ParserStatus Parser::parseInheritance(
68066816 continue ;
68076817 }
68086818
6809- auto ParsedTypeResult = parseType ();
6819+ auto ParsedTypeResult =
6820+ parseType (diag::expected_type, ParseTypeReason::InheritanceClause);
68106821 Status |= ParsedTypeResult;
68116822
68126823 // Record the type if its a single type.
0 commit comments