@@ -4489,7 +4489,8 @@ bool Parser::canParseTypeAttribute() {
4489
4489
TypeOrCustomAttr result; // ignored
4490
4490
PatternBindingInitializer *initContext = nullptr ;
4491
4491
return !parseTypeAttribute (result, /* atLoc=*/ SourceLoc (),
4492
- /* atEndLoc=*/ SourceLoc (), initContext,
4492
+ /* atEndLoc=*/ SourceLoc (),
4493
+ ParseTypeReason::Unspecified, initContext,
4493
4494
/* justChecking*/ true )
4494
4495
.isError ();
4495
4496
}
@@ -4690,6 +4691,7 @@ bool Parser::parseUUIDString(UUID &uuid, Diag<> diagnostic, bool justChecking) {
4690
4691
// / no need to actually record the attribute
4691
4692
ParserStatus Parser::parseTypeAttribute (TypeOrCustomAttr &result,
4692
4693
SourceLoc AtLoc, SourceLoc AtEndLoc,
4694
+ ParseTypeReason reason,
4693
4695
PatternBindingInitializer *&initContext,
4694
4696
bool justChecking) {
4695
4697
if (AtEndLoc != Tok.getLoc ()) {
@@ -4705,7 +4707,14 @@ ParserStatus Parser::parseTypeAttribute(TypeOrCustomAttr &result,
4705
4707
if (Tok.is (tok::code_complete)) {
4706
4708
if (!justChecking) {
4707
4709
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
+ }
4709
4718
}
4710
4719
}
4711
4720
consumeToken (tok::code_complete);
@@ -5534,7 +5543,8 @@ ParserStatus Parser::ParsedTypeAttributeList::slowParse(Parser &P) {
5534
5543
TypeOrCustomAttr result;
5535
5544
SourceLoc AtEndLoc = Tok.getRange ().getEnd ();
5536
5545
SourceLoc AtLoc = P.consumeToken ();
5537
- status |= P.parseTypeAttribute (result, AtLoc, AtEndLoc, initContext);
5546
+ status |=
5547
+ P.parseTypeAttribute (result, AtLoc, AtEndLoc, ParseReason, initContext);
5538
5548
if (status.isError ())
5539
5549
return status;
5540
5550
if (result)
@@ -6803,7 +6813,8 @@ ParserStatus Parser::parseInheritance(
6803
6813
continue ;
6804
6814
}
6805
6815
6806
- auto ParsedTypeResult = parseType ();
6816
+ auto ParsedTypeResult =
6817
+ parseType (diag::expected_type, ParseTypeReason::InheritanceClause);
6807
6818
Status |= ParsedTypeResult;
6808
6819
6809
6820
// Record the type if its a single type.
0 commit comments