-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[CursorInfo] Pass primary path to allow comparing previous ASTs #66907
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@swift-ci please test |
@swift-ci please test |
InputFile, /*IsRealpath=*/true)) | ||
PrimaryFilePath, /*IsRealpath=*/true)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the most significant change. InputFile
is almost always empty, except in the case of generated buffers (eg. expanded macros). It should have been using the primary file path, which wasn't being passed in. So most of the change is just passing it to all the various callers.
Update the cursor requests to also pass in their primary file. Snapshots should be compared using this file, not the input buffer name. This fixes AST re-use when the AST is usable with snapshots. Resolves rdar://110344363.
// RUN: -req=cursor -offset=5 %t/func.swift -- %t/func.swift == \ | ||
// RUN: -req=edit -offset=0 -length=0 -replace="// some comment\n" -req-opts=enablesyntaxmap=0,enablesubstructure=0,enablediagnostics=0 %t/func.swift -- %t/func.swift == \ | ||
// RUN: -req=cursor -offset=21 %t/func.swift -- %t/func.swift | ||
// RUN: -req=cursor -offset=5 %t/func.swift -- %t/func.swift |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This just converts it back to before the previous PR.
@swift-ci please test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice find
@swift-ci Please test macOS |
Update the cursor requests to also pass in their primary file. Snapshots should be compared using this file, not the input buffer name. This fixes AST re-use when the AST is usable with snapshots.
Resolves rdar://110344363.