Handle desired types being outside of the function's range.

This commit is contained in:
Vincent St-Amour 2011-07-20 15:14:57 -04:00
parent 59027c6b40
commit fae966146f

View File

@ -195,7 +195,13 @@ This file defines two sorts of primitives. All of them are provided into any mod
(tc-setup #'stx #'op 'top-level expanded tc-toplevel-form type (tc-setup #'stx #'op 'top-level expanded tc-toplevel-form type
(match type (match type
[(tc-result1: (and t (Function: _)) f o) [(tc-result1: (and t (Function: _)) f o)
#`(display #,(format "~a\n" (cleanup-type t expected)))] (let ([cleaned (cleanup-type t expected)])
#`(display
#,(match cleaned
[(Function: '())
"Desired return type not in the given function's range."]
[(Function: arrs)
(format "~a\n" cleaned)])))]
[_ (error (format "~a: not a function" (syntax->datum #'op) ))])))])) [_ (error (format "~a: not a function" (syntax->datum #'op) ))])))]))
(define-syntax (require/opaque-type stx) (define-syntax (require/opaque-type stx)