Fix messages leaking via suspended messages #13911
Merged
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.
It isn't clear what StoreReporter's purpose is. Is it simply a store of
all messages, or is it a store of "real" messages, i.e. messages that
aren't suppressed with
@nowarn
or -Wconf (i.e. configurable warnings)?I believe StoreReporter is often used as a way to get programmatic
access to the real messages.
Typer, with its TyperState, uses StoreReporter as a more general buffer
while making typing attempts, such as when trying to apply an implicit
conversion. But with configurable warnings, we don't know if a warning
is real or not until we've typed all the
@nowarn
annotation in thecode, which is why we suspend the messages, on Run.
So we add an override for TyperState, so that StoreReporter is used as
simply a buffer. When it then unbuffers its messages in flush to the
parent context's reporter, it will run through the regular
"issueIfNotSuppressed" code (assuming it's not another store reporter).
[test_java8]