diff options
author | Clément Pit--Claudel <clement.pitclaudel@live.com> | 2015-08-20 11:52:32 -0700 |
---|---|---|
committer | Clément Pit--Claudel <clement.pitclaudel@live.com> | 2015-08-20 11:52:32 -0700 |
commit | 75e436019003604ea3118a13ccd9b6ea079c643f (patch) | |
tree | 51b614bed3fb41d8b5ce4a42a54d94096e352baa /Source/Dafny/Reporting.cs | |
parent | 0478d0c42a9e824f288bdbdd74ca99f86b36a345 (diff) |
Discard error messages that refer to a non-nested TokenWrapper.
The VS extension already did that, but it also filtered out nested tokens. That
prevented info about triggers from being reported. Other interfaces (the CLI
and Emacs, in particular) should have the same ability.
Surprinsingly, this doesn't cause any tests failures.
Diffstat (limited to 'Source/Dafny/Reporting.cs')
-rw-r--r-- | Source/Dafny/Reporting.cs | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/Source/Dafny/Reporting.cs b/Source/Dafny/Reporting.cs index 77869d9f..63ec520a 100644 --- a/Source/Dafny/Reporting.cs +++ b/Source/Dafny/Reporting.cs @@ -34,21 +34,14 @@ namespace Microsoft.Dafny { AllMessages[ErrorLevel.Info] = new List<ErrorMessage>();
}
- protected bool ShouldDiscard(MessageSource source, ErrorLevel level) {
- return ((ErrorsOnly && level != ErrorLevel.Error) ||
- (!DafnyOptions.O.PrintTooltips && level == ErrorLevel.Info));
- }
-
// This is the only thing that needs to be overriden
public virtual bool Message(MessageSource source, ErrorLevel level, IToken tok, string msg) {
- var discard = ShouldDiscard(source, level);
-
+ bool discard = (ErrorsOnly && level != ErrorLevel.Error) || // Discard non-errors if ErrorsOnly is set
+ (tok is TokenWrapper && !(tok is NestedToken)); // Discard wrapped tokens, except for nested ones
if (!discard) {
AllMessages[level].Add(new ErrorMessage { token = tok, message = msg });
- return true;
}
-
- return false;
+ return !discard;
}
public int Count(ErrorLevel level) {
|