Permalink
Browse files

fix some type formatting result in pyty.py and in ptype.py

  • Loading branch information...
1 parent 9cb1658 commit bf4ea594fa79a477e0affa5d30fc2e8f81750915 @jruberg committed Apr 12, 2012
Showing with 6 additions and 3 deletions.
  1. +4 −1 src/ptype.py
  2. +2 −2 src/pyty.py
View
@@ -216,7 +216,10 @@ def __repr__(self):
elif self.is_set():
return "{" + self.elt.__repr__() + "}"
elif self.is_tuple():
- return "(" + ", ".join(elt.__repr__() for elt in self.elts) + ")"
+ if self.tuple_len() == 1:
+ return "(%s,)" % self.elts[0].__repr__()
+ else:
+ return "(" + ", ".join(elt.__repr__() for elt in self.elts) + ")"
elif self.is_map():
return "{" + self.dom.__repr__() + ": " + self.ran.__repr__() + "}"
elif self.is_arrow():
View
@@ -69,8 +69,8 @@
e = ast.parse(opt.expr).body[0].value
t = PType.from_str(opt.type)
template = ("YES! -- %s typechecks as type %s" if check_expr(e, t, {}) else
- "NO! --- %s does not typechecka s type %s")
- print template % (opt.expr, opt.type)
+ "NO! --- %s does not typecheck as type %s")
+ print template % (opt.expr, t)
elif opt.infer_expr and not opt.filename and not opt.expr and not opt.type:
e = ast.parse(opt.infer_expr).body[0].value

0 comments on commit bf4ea59

Please sign in to comment.