Skip to content

Conversation

@ahoppen
Copy link
Member

@ahoppen ahoppen commented Dec 10, 2021

If a file isn’t opened with a key.sourcefile argument, we don’t store a snapshot for it. This could cause a crash when trying to consult its snapshot to see whether an AST can be reused for cursor info.

@ahoppen ahoppen requested a review from bnbarham December 10, 2021 15:44
@ahoppen ahoppen force-pushed the pr/fix-snapshot-nullptr-issue branch from 67df5b1 to aa1d745 Compare December 10, 2021 15:58
@ahoppen
Copy link
Member Author

ahoppen commented Dec 10, 2021

@swift-ci Please smoke test

@ahoppen
Copy link
Member Author

ahoppen commented Dec 10, 2021

@swift-ci Please smoke test

@bnbarham
Copy link
Contributor

bnbarham commented Dec 10, 2021

You could use split-file instead of the echo's if you wanted. Why is key.sourcefile not being passed? What's the difference between it and key.name in the open/close request?

@ahoppen
Copy link
Member Author

ahoppen commented Dec 13, 2021

@swift-ci Please test Windows

@ahoppen ahoppen force-pushed the pr/fix-snapshot-nullptr-issue branch from 5c41cfe to 404e1d9 Compare December 13, 2021 15:33
…ciated source file is reopened

When opening a file for the first time, we don’t store a snapshot for it. This could cause a crash when trying to consult its snapshot to see whether an AST can be reused for cursor info.
@ahoppen ahoppen force-pushed the pr/fix-snapshot-nullptr-issue branch from 404e1d9 to f5b6103 Compare December 13, 2021 15:43
@ahoppen
Copy link
Member Author

ahoppen commented Dec 13, 2021

@swift-ci Please smoke test

@ahoppen
Copy link
Member Author

ahoppen commented Dec 13, 2021

I couldn’t use split-file because I was using %t to refer to files in a temporary directory and that wouldn’t get expanded by split-file. After some more understanding of the underlying issue, I was able to rewrite the test to no longer use JSON request paths.

@ahoppen ahoppen merged commit ee79c9f into swiftlang:main Dec 13, 2021
@ahoppen ahoppen deleted the pr/fix-snapshot-nullptr-issue branch December 13, 2021 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants