summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorGravatar qunyanm <unknown>2015-04-21 14:35:41 -0700
committerGravatar qunyanm <unknown>2015-04-21 14:35:41 -0700
commit9d0cd81f47bb4fb27cdc4d0cf8442d4de7473cce (patch)
tree53f154dfd6bd66fa37b4f90854631ae431064b3c /Source
parent9c230b0c9037c30879e865aa5b6d994fee5820ff (diff)
Fix issue #70. Check the ctors for equality before marking them as duplicates.
Diffstat (limited to 'Source')
-rw-r--r--Source/Dafny/Resolver.cs9
1 files changed, 7 insertions, 2 deletions
diff --git a/Source/Dafny/Resolver.cs b/Source/Dafny/Resolver.cs
index 7f198946..568424f0 100644
--- a/Source/Dafny/Resolver.cs
+++ b/Source/Dafny/Resolver.cs
@@ -833,8 +833,13 @@ namespace Microsoft.Dafny
foreach (var kv in s.Ctors) {
Tuple<DatatypeCtor, bool> pair;
if (sig.Ctors.TryGetValue(kv.Key, out pair)) {
- // mark it as a duplicate
- sig.Ctors[kv.Key] = new Tuple<DatatypeCtor, bool>(pair.Item1, true);
+ // The same ctor can be imported from two different imports (e.g "diamond" imports), in which case,
+ // they are not duplicates. For TopLevelDecls and static members, they are handled by
+ // ReallyAmbiguousThing() during resolving.
+ if (kv.Value.Item1 != pair.Item1) {
+ // mark it as a duplicate
+ sig.Ctors[kv.Key] = new Tuple<DatatypeCtor, bool>(pair.Item1, true);
+ }
} else {
// add new
sig.Ctors.Add(kv.Key, kv.Value);