-
Notifications
You must be signed in to change notification settings - Fork 714
handle conditionals in duplicate module checks #7616
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
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.
This looks good @gbaz. Clean solution
++ concatMap checkTest (map snd $ condTestSuites pkg) | ||
++ concatMap checkBench (map snd $ condBenchmarks pkg) | ||
where | ||
-- the duplicate modules check is has not been thoroughly vetted for backpack |
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.
We can leave a TODO for that in the issues list if anyone wants to check it out.
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.
this was me migrating the old comment -- the current logic is no worse than before, but i didn't want to lose a potential warning here :-)
Tho we do need a changelog. |
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.
Great job, this produces much better approximation, while staying linear and improving code quality.
checkTest = checkDups "test suite" testModules | ||
checkBench = checkDups "benchmark" benchmarkModules | ||
checkDups s getModules t = | ||
let libMap = foldCondTree Map.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.
Why such an enormous indent? (Also, two spaces after arrow on the line below, but only one space before comments (feel free to ignore).)
This reverts commit ed01de6.
Resolves #4629
This is a less invasive approach than my last pass. It only factors out the duplicate module checks without touching anything else. This is a better "rough cut" approximation but still not perfect. In particular, It won't generate duplicate module warnings from a module existing on both sides of an
if/else
conditional -- however, if there are distinct conditional blocks which logically are exclusive (i.e. one is a check on a positive condition and the other a check on its negation) it won't catch that by actually model-checking the various possible outcomes.