-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Make frozen doc state non-nullable #77896
Make frozen doc state non-nullable #77896
Conversation
Trying something out to see if it cleans up compilation tracker state management. |
@dibarbet ptal. |
Contract.ThrowIfFalse(FrozenSourceGeneratedDocumentIdentities.HasValue); | ||
Contract.ThrowIfFalse(FrozenSourceGeneratedDocuments.HasValue); |
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.
If these should now always have a value, should they become non-nullable too?
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.
So much simpler. Thanks!
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.
The changes from something being nullable to non-nullable make sense to me. Whether the scenario still makes sense I leave for someone else to work out :)
@@ -117,7 +117,7 @@ private SolutionCompilationState Branch( | |||
SolutionState newSolutionState, | |||
ImmutableSegmentedDictionary<ProjectId, ICompilationTracker>? projectIdToTrackerMap = null, | |||
SourceGeneratorExecutionVersionMap? sourceGeneratorExecutionVersionMap = null, | |||
Optional<TextDocumentStates<SourceGeneratedDocumentState>?> frozenSourceGeneratedDocumentStates = default, | |||
Optional<TextDocumentStates<SourceGeneratedDocumentState>> frozenSourceGeneratedDocumentStates = default, |
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.
You don't need Optional here anymore.
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.
Good call. Simplifying.
// For the frozen source generated document info, we expect two either have both checksum collections or neither, and they | ||
// should both be the same length as there is a 1:1 correspondence between them. | ||
Contract.ThrowIfFalse(frozenSourceGeneratedDocumentIdentities.HasValue == frozenSourceGeneratedDocuments.HasValue); | ||
Contract.ThrowIfFalse(frozenSourceGeneratedDocumentIdentities?.Count == frozenSourceGeneratedDocuments?.Length); |
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.
Did you still want to keep this assertion that the lengths match?
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.
will add back.
No description provided.