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

original commit: fae966146fbb6a40973d22b88fa6e480db6cde41
This commit is contained in:
Vincent St-Amour 2011-07-20 15:14:57 -04:00
parent 4d9c5c6cb9
commit 4f8a856630

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
(match type
[(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) ))])))]))
(define-syntax (require/opaque-type stx)