Translate Value types to ctcs with better names

e.g., True -> '#t  instead of
      True -> "#t" for a flat-named-contract
This commit is contained in:
Asumu Takikawa 2013-04-05 16:35:20 -04:00
parent fe83da9bdf
commit 0161dfdf16
2 changed files with 15 additions and 1 deletions

View File

@ -0,0 +1,14 @@
#;
(exn-pred #rx"expected: 0")
#lang racket
;; The purpose of this test is to make sure that contract
;; errors for (Value x) types print in a good way
(module a typed/racket
(define: (f [x : Zero]) : Zero x)
(provide f))
(require 'a)
(f "foo")

View File

@ -422,7 +422,7 @@
[(Syntax: (Base: 'Symbol _ _ _ _)) #'identifier?]
[(Syntax: t)
#`(syntax/c #,(t->c t #:kind flat-sym))]
[(Value: v) #`(flat-named-contract #,(format "~a" v) (lambda (x) (equal? x '#,v)))]
[(Value: v) #`(flat-named-contract '#,v (lambda (x) (equal? x '#,v)))]
;; TODO Is this sound?
[(Param: in out)
(set-impersonator!)