summaryrefslogtreecommitdiff
path: root/Source/Dafny/Translator.cs
diff options
context:
space:
mode:
authorGravatar qadeer <qadeer@microsoft.com>2011-06-20 21:06:43 -0700
committerGravatar qadeer <qadeer@microsoft.com>2011-06-20 21:06:43 -0700
commitda900fd75d17b681eb5895daeceec3a0f35d90ce (patch)
treeac34a4ff5625c53c6bf23fc9d228997fee57ee53 /Source/Dafny/Translator.cs
parent819189e68af2e3190c9528d567ed8cc92e3814ab (diff)
parentaf320026248b5c5b3f466a0bde56d26076d8666d (diff)
Merge
Diffstat (limited to 'Source/Dafny/Translator.cs')
-rw-r--r--Source/Dafny/Translator.cs14
1 files changed, 14 insertions, 0 deletions
diff --git a/Source/Dafny/Translator.cs b/Source/Dafny/Translator.cs
index f3c48ab2..dbe5f2ed 100644
--- a/Source/Dafny/Translator.cs
+++ b/Source/Dafny/Translator.cs
@@ -2267,6 +2267,20 @@ namespace Microsoft.Dafny {
singletons = new List<Expression>();
}
singletons.Add(e);
+ } else if (e.Type is SeqType) {
+ // e represents a sequence
+ // Add: set x :: x in e
+ var bv = new BoundVar(e.tok, "_s2s_" + otherTmpVarCount, ((SeqType)e.Type).Arg);
+ otherTmpVarCount++; // use this counter, but for a Dafny name (the idea being that the number and the initial "_" in the name might avoid name conflicts)
+ var bvIE = new IdentifierExpr(e.tok, bv.Name);
+ bvIE.Var = bv; // resolve here
+ bvIE.Type = bv.Type; // resolve here
+ var sInE = new BinaryExpr(e.tok, BinaryExpr.Opcode.In, bvIE, e);
+ sInE.ResolvedOp = BinaryExpr.ResolvedOpcode.InSeq; // resolve here
+ sInE.Type = Type.Bool; // resolve here
+ var s = new SetComprehension(e.tok, new List<BoundVar>() { bv }, sInE, bvIE);
+ s.Type = new SetType(new ObjectType()); // resolve here
+ sets.Add(s);
} else {
// e is already a set
Contract.Assert(e.Type is SetType);