Add debug macro, and fix check-below to return appropriate values.
This commit is contained in:
parent
3e4e5af03c
commit
e77ad12feb
|
@ -85,6 +85,8 @@
|
||||||
(match (tc-expr/check e t)
|
(match (tc-expr/check e t)
|
||||||
[(tc-result: t) t]))
|
[(tc-result: t) t]))
|
||||||
|
|
||||||
|
;; check-below : (/\ (Result Type -> Result)
|
||||||
|
;; (Type Type -> Type))
|
||||||
(define (check-below tr1 expected)
|
(define (check-below tr1 expected)
|
||||||
(match (list tr1 expected)
|
(match (list tr1 expected)
|
||||||
[(list (tc-result: t1 te1 ee1) t2)
|
[(list (tc-result: t1 te1 ee1) t2)
|
||||||
|
@ -94,7 +96,7 @@
|
||||||
[(list t1 t2)
|
[(list t1 t2)
|
||||||
(unless (subtype t1 t2)
|
(unless (subtype t1 t2)
|
||||||
(tc-error/expr"Expected ~a, but got ~a" t2 t1))
|
(tc-error/expr"Expected ~a, but got ~a" t2 t1))
|
||||||
(ret expected)]))
|
expected]))
|
||||||
|
|
||||||
(define (tc-expr/check form expected)
|
(define (tc-expr/check form expected)
|
||||||
(parameterize ([current-orig-stx form])
|
(parameterize ([current-orig-stx form])
|
||||||
|
|
|
@ -14,7 +14,14 @@
|
||||||
hash-union
|
hash-union
|
||||||
in-pairs
|
in-pairs
|
||||||
in-list-forever
|
in-list-forever
|
||||||
extend)
|
extend
|
||||||
|
debug)
|
||||||
|
|
||||||
|
(define-syntax-rule (debug args)
|
||||||
|
(begin (printf "starting ~a~n" 'args)
|
||||||
|
(let ([e args])
|
||||||
|
(printf "result was ~a~n" e)
|
||||||
|
e)))
|
||||||
|
|
||||||
(define-syntax (with-syntax* stx)
|
(define-syntax (with-syntax* stx)
|
||||||
(syntax-case stx ()
|
(syntax-case stx ()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user