summaryrefslogtreecommitdiff
path: root/Dafny/Compiler.cs
diff options
context:
space:
mode:
authorGravatar Rustan Leino <leino@microsoft.com>2011-09-11 10:52:07 -0700
committerGravatar Rustan Leino <leino@microsoft.com>2011-09-11 10:52:07 -0700
commite9bc860b9aaf37bd58f0b6d8eb19803851a9ee3b (patch)
treeea9fadc74bf4ba2c44f58cdfe790329a7288a32b /Dafny/Compiler.cs
parentb25e8fa5503332ae469c9f7a50409d038fcc69cd (diff)
Dafny: fixed compilation error where type of target "null" was undetermined
Diffstat (limited to 'Dafny/Compiler.cs')
-rw-r--r--Dafny/Compiler.cs4
1 files changed, 2 insertions, 2 deletions
diff --git a/Dafny/Compiler.cs b/Dafny/Compiler.cs
index 6a448172..7db1e98f 100644
--- a/Dafny/Compiler.cs
+++ b/Dafny/Compiler.cs
@@ -601,7 +601,7 @@ namespace Microsoft.Dafny {
} else if (type is IntType) {
return "new BigInteger(0)";
} else if (type.IsRefType) {
- return "null";
+ return string.Format("({0})null", TypeName(type));
} else if (type.IsDatatype) {
UserDefinedType udt = (UserDefinedType)type;
string s = "@" + udt.Name;
@@ -1175,7 +1175,7 @@ namespace Microsoft.Dafny {
if (expr is LiteralExpr) {
LiteralExpr e = (LiteralExpr)expr;
if (e.Value == null) {
- wr.Write("null");
+ wr.Write("({0})null", TypeName(e.Type));
} else if (e.Value is bool) {
wr.Write((bool)e.Value ? "true" : "false");
} else if (e.Value is BigInteger) {