summaryrefslogtreecommitdiff
path: root/Source/Dafny/Triggers/TriggerUtils.cs
diff options
context:
space:
mode:
authorGravatar Clément Pit--Claudel <clement.pitclaudel@live.com>2015-08-28 20:39:02 -0700
committerGravatar Clément Pit--Claudel <clement.pitclaudel@live.com>2015-08-28 20:39:02 -0700
commit2db858bf6e72e521b49aa0ae3a993dc943b8c875 (patch)
tree692ebe07028e35e431e8b93ee35266461126d5cd /Source/Dafny/Triggers/TriggerUtils.cs
parent3b1c3923a403efbd28b8f5ae6fc4429ccee8c2e8 (diff)
Implement {:nowarn}, clarify some messages, and add a few tests
Diffstat (limited to 'Source/Dafny/Triggers/TriggerUtils.cs')
-rw-r--r--Source/Dafny/Triggers/TriggerUtils.cs11
1 files changed, 8 insertions, 3 deletions
diff --git a/Source/Dafny/Triggers/TriggerUtils.cs b/Source/Dafny/Triggers/TriggerUtils.cs
index efa1f167..c16a3e44 100644
--- a/Source/Dafny/Triggers/TriggerUtils.cs
+++ b/Source/Dafny/Triggers/TriggerUtils.cs
@@ -183,14 +183,19 @@ namespace Microsoft.Dafny.Triggers {
internal static bool AllowsMatchingLoops(QuantifierExpr quantifier) {
Contract.Requires(quantifier.SplitQuantifier == null); // Don't call this on a quantifier with a Split clause: it's not a real quantifier
+ // This is different from nowarn: it won't remove loops at all, even if another trigger is available.
return Attributes.Contains(quantifier.Attributes, "matchingloop");
}
- internal static bool NeedsAutoTriggers(QuantifierExpr quantifier) {
+ internal static bool WantsAutoTriggers(QuantifierExpr quantifier) {
Contract.Requires(quantifier.SplitQuantifier == null); // Don't call this on a quantifier with a Split clause: it's not a real quantifier
bool wantsAutoTriggers = true;
- return !Attributes.Contains(quantifier.Attributes, "trigger") &&
- (!Attributes.ContainsBool(quantifier.Attributes, "autotriggers", ref wantsAutoTriggers) || wantsAutoTriggers);
+ return !Attributes.ContainsBool(quantifier.Attributes, "autotriggers", ref wantsAutoTriggers) || wantsAutoTriggers;
+ }
+
+ internal static bool NeedsAutoTriggers(QuantifierExpr quantifier) {
+ Contract.Requires(quantifier.SplitQuantifier == null); // Don't call this on a quantifier with a Split clause: it's not a real quantifier
+ return !Attributes.Contains(quantifier.Attributes, "trigger") && WantsAutoTriggers(quantifier);
}
internal static BinaryExpr.ResolvedOpcode RemoveNotInBinaryExprIn(BinaryExpr.ResolvedOpcode opcode) {