OptionWarnings are emitted twice
andreasabel opened this issue · comments
OptionWarnings are emitted twice, e.g.:
agda/test/Succeed/LossyUnification.warn
Lines 1 to 6 in 0513851
Suspected reason: We are calling setOptionsFromPragma
several times during processing a file.
agda/src/full/Agda/TypeChecking/Monad/Options.hs
Lines 208 to 212 in 0513851
Found while working on:
Not sure how it applies to this issue, but in #6640 I had to jump through some hoops to not get the conflicting options warning multiple times:
- Only warn when the pragma options have changed (otherwise you get the same warning for each new
OPTIONS
pragma in a file)agda/src/full/Agda/TypeChecking/Monad/Options.hs
Lines 69 to 71 in b982f82
- Split
setOptionsFromPragma
into a checking and a non-checking versionagda/src/full/Agda/TypeChecking/Monad/Options.hs
Lines 226 to 232 in b982f82
- and propagate it to
setOptionsFromSourcePragma
inInteraction.Imports
agda/src/full/Agda/Interaction/Imports.hs
Lines 171 to 179 in b982f82
- and only run the check in
typeCheckMain
and increateInterface
for non-main modules (otherwise you get the warning twice for the main module)agda/src/full/Agda/Interaction/Imports.hs
Lines 420 to 425 in b982f82
agda/src/full/Agda/Interaction/Imports.hs
Lines 1000 to 1004 in b982f82
My question here is whether we should dig out the reason why the warning is raised twice, or whether we reorganise the warning store so that duplicate warnings are just stored once.
E.g. the warning store could be a map from positions to sets of warnings. (Currently it is a plain list.)