You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The changes in this PR remove duplicates (unique over span and message combination) from source diagnostics to avoid the same diagnostic being printed multiple times, as it would happen for long argument sinks.
The following document would previously print the following diagnostic 8 times, once for each element in the sink, but now only prints it once.
Other fields on SourceDiagnostic such as trace and hint were not considered, because these should likely match between diagnostics with the same span and message anyway. But they can be added by simply adding the lengths to the tuple stored in the HashSet.
I also think that maybe we should handle this internally so that different consumers don't need to handle it each on their own. Since warnings are already deduplicated, I guess we could this in typst::compile just for the errors.
I also think that maybe we should handle this internally so that different consumers don't need to handle it each on their own. Since warnings are already deduplicated, I guess we could this in typst::compile just for the errors.
Sure! Means we're back to iter -> filter -> collect, but I don't see this as being a big problem considering it's on the error path. We could also convert SourceResult to contain a HashSet with a new type that hashes using only the span message tuple instead, but that seems like it would make the API a bit too complicated for little to no gain.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The changes in this PR remove duplicates (unique over span and message combination) from source diagnostics to avoid the same diagnostic being printed multiple times, as it would happen for long argument sinks.
The following document would previously print the following diagnostic 8 times, once for each element in the sink, but now only prints it once.
Motivated by #201.
Other fields on
SourceDiagnosticsuch astraceandhintwere not considered, because these should likely match between diagnostics with the same span and message anyway. But they can be added by simply adding the lengths to the tuple stored in theHashSet.