Do not allow parentheses omission for prefix ->

Also fix multiple -> detection, which was broken

original commit: 7bb537fc828854d3f5d59b88f84db1caab50aa5e
This commit is contained in:
Asumu Takikawa 2014-02-12 23:43:52 -05:00
parent 7f5638df9c
commit d2f1ea2fc6
2 changed files with 10 additions and 4 deletions

View File

@ -64,8 +64,13 @@
;; The body of a Forall type
(define-syntax-class all-body
#:attributes (type)
(pattern (type))
(pattern (~and type ((~or (~once :->^) x) ...))))
;; FIXME: the error message when a failure is triggered by this case
;; is not very good, but I have been unsuccessful with ~fail
;; or with #:fail-when. -- AT
(pattern (~and (:->^ x y ~! z ...) (~fail))
#:with type 'dummy)
(pattern (~and type ((~or (~once :->^) (~not :->^)) ...)))
(pattern (type)))
(define (parse-literal-alls stx)
(syntax-parse stx

View File

@ -82,14 +82,15 @@
[(-> (values Number Boolean Number)) (t:-> (-values (list N B N)))]
[(Number -> Number) (t:-> N N)]
[(All (A) Number -> Number) (-poly (a) (t:-> N N))]
[(All (A) -> Number Number) (-poly (a) (t:-> N N))]
[FAIL (All (A) -> Number Number)]
[(All (A) (Number -> Number)) (-poly (a) (t:-> N N))]
[(All (A) (-> Number Number)) (-poly (a) (t:-> N N))]
[(All (A) A -> A) (-poly (a) (t:-> a a))]
[(All (A) A A) (-poly (a) (t:-> a a))]
[(All (A) A A) (-poly (a) (t:-> a a))]
[FAIL (All (A) A A)]
[(All (A) (A -> A)) (-poly (a) (t:-> a a))]
[(All (A) (-> A A)) (-poly (a) (t:-> a a))]
[FAIL (All (A) -> Integer -> Integer -> Integer)]
;; requires transformer time stuff that doesn't work
#;[(Refinement even?) (make-Refinement #'even?)]
[(Number Number Number Boolean -> Number) (N N N B . t:-> . N)]