summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorGeorge Karachalias <george.karachalias@gmail.com>2015-12-27 23:05:02 +0100
committerBen Gamari <ben@smart-cactus.org>2015-12-27 23:06:32 +0100
commitbec5350da09fde51231004b1b7d33641ac51800e (patch)
tree2cdd4f637353f2379e381c2385c9975ff7b2642c /utils
parent07b3be76a14a061a43846ef41f1dd7819603be4e (diff)
downloadhaskell-bec5350da09fde51231004b1b7d33641ac51800e.tar.gz
Adding flags: -ffull-guard-reasoning and too-many-guards
Introduction of two new flags, for more precise control over the new pattern match checker's behaviour when reasoning about guards. This is supposed to address #11195 (and maybe more performance bugs related to the NP-Hardness of coverage checking). Expected behaviour: * When `-ffull-guard-reasoning` is on, run the new pattern match checker in its full power * When `-ffull-guard-reasoning` is off (the default), for every match, check a metric to see whether pattern match checking for it has high probability of being non performant (at the the moment we check whether the number of guards is over 20 but I would like to use a more precise measure in the future). If the probability is high: - Oversimplify the guards (less expressive but more performant) and run the checker, and - Issue a warning about the simplification that happened. A new flag `-Wtoo-many-guards/-Wno-too-many-guards` suppresses the warning about the simplification (useful when combined with -Werror). Test Plan: validate Reviewers: goldfire, austin, hvr, bgamari Reviewed By: bgamari Subscribers: mpickering, thomie Differential Revision: https://phabricator.haskell.org/D1676 GHC Trac Issues: #11195
Diffstat (limited to 'utils')
-rw-r--r--utils/mkUserGuidePart/Options/Warnings.hs13
1 files changed, 13 insertions, 0 deletions
diff --git a/utils/mkUserGuidePart/Options/Warnings.hs b/utils/mkUserGuidePart/Options/Warnings.hs
index e56e04115c..c775af4f6c 100644
--- a/utils/mkUserGuidePart/Options/Warnings.hs
+++ b/utils/mkUserGuidePart/Options/Warnings.hs
@@ -222,6 +222,11 @@ warningsOptions =
, flagType = DynamicFlag
, flagReverse = "-Wno-tabs"
}
+ , flag { flagName = "-Wtoo-many-guards"
+ , flagDescription = "warn when a match has too many guards"
+ , flagType = DynamicFlag
+ , flagReverse = "-Wno-too-many-guards"
+ }
, flag { flagName = "-Wtype-defaults"
, flagDescription = "warn when defaulting happens"
, flagType = DynamicFlag
@@ -364,4 +369,12 @@ warningsOptions =
, flagType = DynamicFlag
, flagReverse = "-Wno-deriving-typeable"
}
+ , flag { flagName = "-ffull-guard-reasoning"
+ , flagDescription =
+ "enable the full reasoning of the pattern match checker "++
+ "concerning guards, for more precise exhaustiveness/coverage "++
+ "warnings"
+ , flagType = DynamicFlag
+ , flagReverse = "-fno-full-guard-reasoning"
+ }
]