summaryrefslogtreecommitdiff
path: root/Source/Dafny/Resolver.cs
diff options
context:
space:
mode:
authorGravatar Rustan Leino <unknown>2016-03-01 15:38:18 -0800
committerGravatar Rustan Leino <unknown>2016-03-01 15:38:18 -0800
commit2144154dc66b8d83792dd4395d3059c97d044e01 (patch)
tree2b6a64475391309a24fecf839c77379b06fea023 /Source/Dafny/Resolver.cs
parent1f38d2d252aaac3d55191e6c3dad46ecffdfee2c (diff)
parent45e7bb72d4a8676796cb71cd8d11787dd6f91e17 (diff)
Merge
Diffstat (limited to 'Source/Dafny/Resolver.cs')
-rw-r--r--Source/Dafny/Resolver.cs12
1 files changed, 11 insertions, 1 deletions
diff --git a/Source/Dafny/Resolver.cs b/Source/Dafny/Resolver.cs
index 5a63b4e3..d3b59b51 100644
--- a/Source/Dafny/Resolver.cs
+++ b/Source/Dafny/Resolver.cs
@@ -6376,7 +6376,12 @@ namespace Microsoft.Dafny
if (topLevel) {
ScopePushAndReport(scope, v, "parameter");
} else {
- if (scope.Find(v.Name) != null) {
+ // For cons(a, const(b, c)):
+ // this handles check to see if 'b' or 'c' is duplicate with 'a',
+ // the duplication check between 'b' and 'c' is handled in the desugared
+ // form (to avoid reporting the same error twice), that is why we don't
+ // push 'b' and 'c' onto the scope, only find.
+ if (scope.FindInCurrentScope(v.Name) != null) {
reporter.Error(MessageSource.Resolver, v, "Duplicate parameter name: {0}", v.Name);
}
}
@@ -11069,6 +11074,11 @@ namespace Microsoft.Dafny
return Find(name, false);
}
+ public Thing FindInCurrentScope(string name) {
+ Contract.Requires(name != null);
+ return Find(name, true);
+ }
+
public bool ContainsDecl(Thing t) {
return things.Exists(thing => thing == t);
}