Skip to content

Commit 8dc142e

Browse files
ahoppenRajveer
authored andcommitted
[CursorInfo] Implement a few expression references as solver-based
This implements cursor info resolving for a few expression types using the constraint system. This allows us to detect ambiguous results – we cannot deliver them yet but that will be done in a follow-up PR.
1 parent 33bf9d2 commit 8dc142e

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

tools/SourceKit/include/SourceKit/Core/LangSupport.h

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,8 @@ struct CursorSymbolInfo {
519519

520520
llvm::Optional<unsigned> ParentNameOffset;
521521

522-
void print(llvm::raw_ostream &OS, std::string Indentation) const {
522+
void print(llvm::raw_ostream &OS, std::string Indentation,
523+
bool ForSolverBasedCursorInfoVerification = false) const {
523524
OS << Indentation << "CursorSymbolInfo" << '\n';
524525
OS << Indentation << " Kind: " << Kind.getName() << '\n';
525526
OS << Indentation << " DeclarationLang: " << DeclarationLang.getName()
@@ -528,7 +529,14 @@ struct CursorSymbolInfo {
528529
OS << Indentation << " USR: " << USR << '\n';
529530
OS << Indentation << " TypeName: " << TypeName << '\n';
530531
OS << Indentation << " TypeUSR: " << TypeUSR << '\n';
531-
OS << Indentation << " ContainerTypeUSR: " << ContainerTypeUSR << '\n';
532+
// The ContainerTypeUSR varies too much between the solver-based and
533+
// AST-based implementation. A few manual inspections showed that the
534+
// solver-based container is usually more correct than the old. Instead of
535+
// fixing the AST-based container type computation, exclude the container
536+
// type from the verification.
537+
if (!ForSolverBasedCursorInfoVerification) {
538+
OS << Indentation << " ContainerTypeUSR: " << ContainerTypeUSR << '\n';
539+
}
532540
OS << Indentation << " DocComment: " << DocComment << '\n';
533541
OS << Indentation << " GroupName: " << GroupName << '\n';
534542
OS << Indentation << " LocalizationKey: " << LocalizationKey << '\n';
@@ -596,7 +604,7 @@ struct CursorInfoData {
596604
OS << Indentation << "CursorInfoData" << '\n';
597605
OS << Indentation << " Symbols:" << '\n';
598606
for (auto Symbol : Symbols) {
599-
Symbol.print(OS, Indentation + " ");
607+
Symbol.print(OS, Indentation + " ", ForSolverBasedCursorInfoVerification);
600608
}
601609
OS << Indentation << " AvailableActions:" << '\n';
602610
for (auto AvailableAction : AvailableActions) {

0 commit comments

Comments
 (0)