File tree Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -2526,7 +2526,15 @@ void Parser::parseDeclDelayed() {
2526
2526
Scope S (this , DelayedState->takeScope ());
2527
2527
ContextChange CC (*this , DelayedState->ParentContext );
2528
2528
2529
- parseDecl (ParseDeclOptions (DelayedState->Flags ), [](Decl *D) { });
2529
+ parseDecl (ParseDeclOptions (DelayedState->Flags ), [&](Decl *D) {
2530
+ if (auto *parent = DelayedState->ParentContext ) {
2531
+ if (auto *NTD = dyn_cast<NominalTypeDecl>(parent)) {
2532
+ NTD->addMember (D);
2533
+ } else if (auto *ED = dyn_cast<ExtensionDecl>(parent)) {
2534
+ ED->addMember (D);
2535
+ }
2536
+ }
2537
+ });
2530
2538
}
2531
2539
2532
2540
// / \brief Parse an 'import' declaration, doing no token skipping on error.
@@ -3296,8 +3304,11 @@ ParserResult<TypeDecl> Parser::parseDeclAssociatedType(Parser::ParseDeclOptions
3296
3304
if (Tok.is (tok::kw_where)) {
3297
3305
auto whereStatus = parseProtocolOrAssociatedTypeWhereClause (
3298
3306
TrailingWhere, /* isProtocol=*/ false );
3299
- if (whereStatus.shouldStopParsing ())
3307
+ Status |= whereStatus;
3308
+ if (whereStatus.hasCodeCompletion () && !CodeCompletion) {
3309
+ // Trigger delayed parsing, no need to continue.
3300
3310
return whereStatus;
3311
+ }
3301
3312
}
3302
3313
3303
3314
if (!Flags.contains (PD_InProtocol)) {
Original file line number Diff line number Diff line change @@ -109,8 +109,12 @@ protocol P2 {
109
109
110
110
// P2: Begin completions
111
111
// P2-DAG: Decl[GenericTypeParam]/CurrNominal: Self[#Self#];
112
- // FIXME: Should complete T.
112
+ // P2-DAG: Decl[AssociatedType]/CurrNominal: T;
113
+ // P2-DAG: Decl[AssociatedType]/CurrNominal: U;
113
114
// P2: End completions
114
115
116
+ // U_DOT: Begin completions
115
117
// FIXME: Should complete Q from Assoc.
116
- // U_DOT-NOT: Begin completions
118
+ // U_DOT-DAG: Keyword/None: Type[#Self.U.Type#];
119
+ // U_DOT-DAG: Keyword/CurrNominal: self[#Self.U#];
120
+ // U_DOT: End completions
You can’t perform that action at this time.
0 commit comments