for/fold produces better err msg
This commit is contained in:
parent
ce1bc6b90f
commit
579815512e
|
@ -924,7 +924,11 @@
|
|||
#:with ([e- (ty)] ...) (⇑s (e ...) as Sequence)
|
||||
#:with [(acc- x- ...) body- ty_body]
|
||||
(infer/ctx+erase #'([acc : ty_init][x : ty] ...) #'body)
|
||||
#:when (typecheck? #'ty_body #'ty_init)
|
||||
#:fail-unless (typecheck? #'ty_body #'ty_init)
|
||||
(type-error #:src stx
|
||||
#:msg
|
||||
"for/fold: Type of body and initial accumulator must be the same, given ~a and ~a"
|
||||
#'ty_init #'ty_body)
|
||||
(⊢ (for/fold ([acc- init-]) ([x- e-] ...) body-) : ty_body)])
|
||||
|
||||
(define-typed-syntax for/hash
|
||||
|
|
|
@ -390,6 +390,9 @@
|
|||
(check-type RT2 : (→/test {X Y} Y X (List X) (RecoTest X Y)))
|
||||
(check-type RT3 : (→/test X Y (RecoTest X Y)))
|
||||
|
||||
(typecheck-fail (for/fold ([x 1]) () "hello")
|
||||
#:with-msg "for/fold: Type of body and initial accumulator must be the same, given Int and String")
|
||||
|
||||
; ext-stlc tests --------------------------------------------------
|
||||
|
||||
; tests for stlc extensions
|
||||
|
|
Loading…
Reference in New Issue
Block a user