summaryrefslogtreecommitdiff
path: root/Source/Dafny/RefinementTransformer.cs
diff options
context:
space:
mode:
authorGravatar Rustan Leino <leino@microsoft.com>2012-10-21 22:06:25 -0700
committerGravatar Rustan Leino <leino@microsoft.com>2012-10-21 22:06:25 -0700
commit066cd4f2a054dd9acfa917ab0d89eed7d9b36d92 (patch)
treedef5fc8149bf617c0e75c3cc4c2415dfd4a624c3 /Source/Dafny/RefinementTransformer.cs
parent41ad2e0dbb6283acf5edfbcbef8bdf3f2b045998 (diff)
combine {:autocontracts} and refinement
Diffstat (limited to 'Source/Dafny/RefinementTransformer.cs')
-rw-r--r--Source/Dafny/RefinementTransformer.cs10
1 files changed, 8 insertions, 2 deletions
diff --git a/Source/Dafny/RefinementTransformer.cs b/Source/Dafny/RefinementTransformer.cs
index d045426d..91f79a23 100644
--- a/Source/Dafny/RefinementTransformer.cs
+++ b/Source/Dafny/RefinementTransformer.cs
@@ -629,6 +629,8 @@ namespace Microsoft.Dafny
} else {
reporter.Error(nwMember, "a field declaration ({0}) in a refining class ({1}) must replace a field in the refinement base", nwMember.Name, nw.Name);
}
+ nwMember.RefinementBase = member;
+
} else if (nwMember is Function) {
var f = (Function)nwMember;
bool isPredicate = f is Predicate;
@@ -676,7 +678,9 @@ namespace Microsoft.Dafny
} else if (f.Body != null) {
reporter.Error(nwMember, "a refining function is not allowed to extend/change the body");
}
- nw.Members[index] = CloneFunction(f.tok, prevFunction, f.IsGhost, f.Ens, moreBody, replacementBody, prevFunction.Body == null, f.Attributes);
+ var newFn = CloneFunction(f.tok, prevFunction, f.IsGhost, f.Ens, moreBody, replacementBody, prevFunction.Body == null, f.Attributes);
+ newFn.RefinementBase = member;
+ nw.Members[index] = newFn;
}
} else {
@@ -726,7 +730,9 @@ namespace Microsoft.Dafny
replacementBody = MergeBlockStmt(replacementBody, prevMethod.Body);
}
}
- nw.Members[index] = CloneMethod(prevMethod, m.Ens, decreases, replacementBody, prevMethod.Body == null, m.Attributes);
+ var newM = CloneMethod(prevMethod, m.Ens, decreases, replacementBody, prevMethod.Body == null, m.Attributes);
+ newM.RefinementBase = member;
+ nw.Members[index] = newM;
}
}
}