summaryrefslogtreecommitdiff
path: root/Source/Dafny/Printer.cs
diff options
context:
space:
mode:
authorGravatar leino <unknown>2014-08-22 00:26:53 -0700
committerGravatar leino <unknown>2014-08-22 00:26:53 -0700
commit6e8c5d61cee5aa6ef56d8b711055541a80162d60 (patch)
treec5986faebf35b8bd8ca70025d22550ba2476301d /Source/Dafny/Printer.cs
parent60036a94bf56dcb15e7f426f0e485e16fb85b651 (diff)
Type check and pretty print newtype constraints
Diffstat (limited to 'Source/Dafny/Printer.cs')
-rw-r--r--Source/Dafny/Printer.cs13
1 files changed, 10 insertions, 3 deletions
diff --git a/Source/Dafny/Printer.cs b/Source/Dafny/Printer.cs
index 459cbcef..316116e7 100644
--- a/Source/Dafny/Printer.cs
+++ b/Source/Dafny/Printer.cs
@@ -144,9 +144,16 @@ namespace Microsoft.Dafny {
var dd = (DerivedTypeDecl)d;
if (i++ != 0) { wr.WriteLine(); }
Indent(indent);
- PrintClassMethodHelper("type", dd.Attributes, dd.Name, new List<TypeParameter>());
- wr.Write(" = new ");
- PrintType(dd.BaseType);
+ PrintClassMethodHelper("newtype", dd.Attributes, dd.Name, new List<TypeParameter>());
+ wr.Write(" = ");
+ if (dd.Var == null) {
+ PrintType(dd.BaseType);
+ } else {
+ wr.Write("{0}: ", dd.Var.DisplayName);
+ PrintType(dd.BaseType);
+ wr.Write(" where ");
+ PrintExpression(dd.Constraint, true);
+ }
wr.WriteLine();
} else if (d is TypeSynonymDecl) {
var syn = (TypeSynonymDecl)d;