diff options
author | qunyanm <unknown> | 2016-02-08 15:22:06 -0800 |
---|---|---|
committer | qunyanm <unknown> | 2016-02-08 15:22:06 -0800 |
commit | 0d08ec191bf3f15ae89dc243877d9295b3004bc6 (patch) | |
tree | 489a9b1d27ff9b06ac537360f8b87afb68e2ee8d /Source/Dafny | |
parent | e9c589851d913a6566c421c87483dc7e94519f91 (diff) |
Fix issue 120. Need to wrap operations that are "lit lifted" and turned into
boogie function calls with "Lit" function.
Diffstat (limited to 'Source/Dafny')
-rw-r--r-- | Source/Dafny/Translator.cs | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/Source/Dafny/Translator.cs b/Source/Dafny/Translator.cs index 1208a83a..cfb77d84 100644 --- a/Source/Dafny/Translator.cs +++ b/Source/Dafny/Translator.cs @@ -11222,7 +11222,7 @@ namespace Microsoft.Dafny { bOpcode = BinaryOperator.Opcode.Lt;
break;
} else {
- return translator.FunctionCall(expr.tok, "INTERNAL_lt_boogie", Bpl.Type.Int, e0, e1);
+ return TrToFunctionCall(expr.tok, "INTERNAL_lt_boogie", Bpl.Type.Int, e0, e1, liftLit);
}
case BinaryExpr.ResolvedOpcode.Le:
@@ -11232,7 +11232,7 @@ namespace Microsoft.Dafny { bOpcode = BinaryOperator.Opcode.Le;
break;
} else {
- return translator.FunctionCall(expr.tok, "INTERNAL_le_boogie", Bpl.Type.Int, e0, e1);
+ return TrToFunctionCall(expr.tok, "INTERNAL_le_boogie", Bpl.Type.Int, e0, e1, false);
}
case BinaryExpr.ResolvedOpcode.Ge:
keepLits = true;
@@ -11241,7 +11241,7 @@ namespace Microsoft.Dafny { bOpcode = BinaryOperator.Opcode.Ge;
break;
} else {
- return translator.FunctionCall(expr.tok, "INTERNAL_ge_boogie", Bpl.Type.Int, e0, e1);
+ return TrToFunctionCall(expr.tok, "INTERNAL_ge_boogie", Bpl.Type.Int, e0, e1, false);
}
case BinaryExpr.ResolvedOpcode.Gt:
if (isReal || !DafnyOptions.O.DisableNLarith) {
@@ -11249,7 +11249,7 @@ namespace Microsoft.Dafny { bOpcode = BinaryOperator.Opcode.Gt;
break;
} else {
- return translator.FunctionCall(expr.tok, "INTERNAL_gt_boogie", Bpl.Type.Int, e0, e1);
+ return TrToFunctionCall(expr.tok, "INTERNAL_gt_boogie", Bpl.Type.Int, e0, e1, liftLit);
}
case BinaryExpr.ResolvedOpcode.Add:
if (!DafnyOptions.O.DisableNLarith) {
@@ -11261,7 +11261,7 @@ namespace Microsoft.Dafny { bOpcode = BinaryOperator.Opcode.Add;
break;
} else {
- return translator.FunctionCall(expr.tok, "INTERNAL_add_boogie", Bpl.Type.Int, e0, e1);
+ return TrToFunctionCall(expr.tok, "INTERNAL_add_boogie", Bpl.Type.Int, e0, e1, liftLit);
}
}
case BinaryExpr.ResolvedOpcode.Sub:
@@ -11274,7 +11274,7 @@ namespace Microsoft.Dafny { bOpcode = BinaryOperator.Opcode.Sub;
break;
} else {
- return translator.FunctionCall(expr.tok, "INTERNAL_sub_boogie", Bpl.Type.Int, e0, e1);
+ return TrToFunctionCall(expr.tok, "INTERNAL_sub_boogie", Bpl.Type.Int, e0, e1, liftLit);
}
}
case BinaryExpr.ResolvedOpcode.Mul:
@@ -11287,7 +11287,7 @@ namespace Microsoft.Dafny { bOpcode = BinaryOperator.Opcode.Mul;
break;
} else {
- return translator.FunctionCall(expr.tok, "INTERNAL_mul_boogie", Bpl.Type.Int, e0, e1);
+ return TrToFunctionCall(expr.tok, "INTERNAL_mul_boogie", Bpl.Type.Int, e0, e1, liftLit);
}
}
@@ -11300,7 +11300,7 @@ namespace Microsoft.Dafny { typ = Bpl.Type.Int;
bOpcode = BinaryOperator.Opcode.Div; break;
} else {
- return translator.FunctionCall(expr.tok, "INTERNAL_div_boogie", Bpl.Type.Int, e0, e1);
+ return TrToFunctionCall(expr.tok, "INTERNAL_div_boogie", Bpl.Type.Int, e0, e1, liftLit);
}
}
case BinaryExpr.ResolvedOpcode.Mod:
@@ -11313,7 +11313,7 @@ namespace Microsoft.Dafny { bOpcode = BinaryOperator.Opcode.Mod;
break;
} else {
- return translator.FunctionCall(expr.tok, "INTERNAL_mod_boogie", Bpl.Type.Int, e0, e1);
+ return TrToFunctionCall(expr.tok, "INTERNAL_mod_boogie", Bpl.Type.Int, e0, e1, liftLit);
}
}
@@ -11651,6 +11651,14 @@ namespace Microsoft.Dafny { }
}
+ private Expr TrToFunctionCall(IToken tok, string function, Bpl.Type returnType, Bpl.Expr e0, Bpl.Expr e1, bool liftLit) {
+ Bpl.Expr re = translator.FunctionCall(tok, function, returnType, e0, e1);
+ if (liftLit) {
+ re = MaybeLit(re, returnType);
+ }
+ return re;
+ }
+
private Expr TrLambdaExpr(LambdaExpr e) {
var bvars = new List<Bpl.Variable>();
var bargs = new List<Bpl.Expr>();
|