summaryrefslogtreecommitdiff
path: root/Source/Dafny/Compiler.cs
diff options
context:
space:
mode:
authorGravatar Bryan Parno <parno@microsoft.com>2015-06-08 14:39:25 -0700
committerGravatar Bryan Parno <parno@microsoft.com>2015-06-08 14:39:25 -0700
commit67c4a534c033a239d47c7bffd9b632ff59ce42a0 (patch)
tree4e928f43bfecd980c0961418671e06e4003906c1 /Source/Dafny/Compiler.cs
parent9a7cc1eaf7dc9006f249ceab7793ccd0b6da40ac (diff)
Fix some issues when compiling generic types and generic function method calls
Diffstat (limited to 'Source/Dafny/Compiler.cs')
-rw-r--r--Source/Dafny/Compiler.cs12
1 files changed, 11 insertions, 1 deletions
diff --git a/Source/Dafny/Compiler.cs b/Source/Dafny/Compiler.cs
index ef5ba69e..4d0182dc 100644
--- a/Source/Dafny/Compiler.cs
+++ b/Source/Dafny/Compiler.cs
@@ -1116,7 +1116,13 @@ namespace Microsoft.Dafny {
return string.Format("new {0}()", s);
} else if (type.IsTypeParameter) {
var udt = (UserDefinedType)type;
- return "default(@" + udt.FullCompileName + ")";
+ string s = "default(@" + udt.FullCompileName;
+ if (udt.TypeArgs.Count != 0)
+ {
+ s += "<" + TypeNames(udt.TypeArgs) + ">";
+ }
+ s += ")";
+ return s;
} else if (type is SetType) {
return DafnySetClass + "<" + TypeName(((SetType)type).Arg) + ">.Empty";
} else if (type is MultiSetType) {
@@ -2959,6 +2965,10 @@ namespace Microsoft.Dafny {
twr.Write(")");
}
twr.Write(".@{0}", f.CompileName);
+ if (f.TypeArgs.Count != 0) {
+ List<Type> typeArgs = f.TypeArgs.ConvertAll(ta => e.TypeArgumentSubstitutions[ta]);
+ twr.Write("<" + TypeNames(typeArgs) + ">");
+ }
twr.Write("(");
string sep = "";
for (int i = 0; i < e.Args.Count; i++) {