-
Notifications
You must be signed in to change notification settings - Fork 377
Store warnings in a set rather than a list #7478
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
4b7068f
to
e2a71db
Compare
SafeFlagPragma xs -> fsep $ concat | ||
[ [ fsep $ pwords "Cannot set OPTIONS" ++ [ pluralS (words =<< xs) "pragma" ] ] | ||
SafeFlagPragma sset -> vcat $ concat | ||
[ [ fwords $ singPlural (words =<< xs) id (++ "s") "The --safe mode does not allow OPTIONS pragma" ] |
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.
Check whether this rewording isn't a regression.
let sfp = case foldMap pragmas ws of | ||
(TCWarning loc r w doc str b : _, sfp) -> | ||
singleton $ TCWarning loc r (SafeFlagPragma sfp) doc str b | ||
_ -> empty |
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.
Can we get rid entirely of this special logic for SafeFlagPragma
? One of these possibilities:
- Make
SafeFlagPragma
take a single pragma name rather than a Set. - Store the
SafeFlagPragma
warning separately so that in the state these warnings are always properly aggregated.
Seems like 1. would be simplest.
Ad 2: We might want to aggregate other warnings as well (at least those that are deserialized), so we should have a uniform mechanism for that rather than this special case for SafeFlagPragma
.
@@ -1,6 +1,3 @@ | |||
Issue5029.agda:1,1-45: warning: -W[no]WarningProblem | |||
You may only turn off benign warnings. The warning TerminationIssue is a non-fatal error and thus cannot be ignored. See --help=warning. | |||
|
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.
Removed duplicate.
Missing newline between warning and error.
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.
Missing newline between warning and error.
Cannot find the code position where to fix this.
MdSpanningComment.lagda.md:10,3-16,7: Multi-line comment spans one or more literate text blocks. | ||
error: [OverlappingTokensWarning] | ||
MdSpanningComment.lagda.md:2,4-6,19: Multi-line comment spans one or more literate text blocks. |
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.
Missing range for this error.
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.
Attempt to fix this in #7492.
If `f` has inverse `g`, then check `g x ∈ s` is often faster then `x ∈ fmap f s`.
e2a71db
to
6eaed7a
Compare
f274684
to
6f4715a
Compare
This ensures that warnings we register twice are not printed twice. Also, the warnings are printed in order of their range.
Now they will be printed in order of their Range.
6f4715a
to
a387237
Compare
Currently we store warnings in a list and have some hacks to prevent duplicate warnings.
Also, to join warning lists we use
List.union
which has a weird semantics.It would be more natural to use a
Set
for warnings.Currently we lack an
Ord
instance forTCWarning
sinceDoc
does not have one.So here I cache the rendering of the warning doc as
tcWarningString
to facilitate anOrd
instance.The warnings should be ordered by position so the first component in the ordering is the
Range
of the warning.WIP: For reasons very unclear to me, this first component is ignored, or the ranges there are mysteriously empty, so the warnings are ordered by the string rendering of their position.Thanks @plt-amy !I already tried to make sure that the ranges are serialized, but to no avail.
I need some help in debugging this.
New features: