Add annotations to 2dmatch to help typecheck.
Also use `match*/derived` to get the right error message name. original commit: a9428728c56a15ad4bd63399c79070e07ef8ad24
This commit is contained in:
commit
08dff62620
|
@ -100,20 +100,18 @@
|
||||||
(for ([cell (in-list cells)])
|
(for ([cell (in-list cells)])
|
||||||
(hash-set! coord-to-content cell app))
|
(hash-set! coord-to-content cell app))
|
||||||
(set! let-bindings
|
(set! let-bindings
|
||||||
(cons #`[id (λ (#,@horizontal-vars #,@vertical-vars) #,@rhses)]
|
(cons #`[id #,(syntax-property
|
||||||
|
#`(λ (#,@horizontal-vars #,@vertical-vars) #,@rhses)
|
||||||
|
'typechecker:called-in-tail-position
|
||||||
|
#t)]
|
||||||
let-bindings)))))
|
let-bindings)))))
|
||||||
|
|
||||||
(define num-of-cols (length (syntax->list #'widths)))
|
(define num-of-cols (length (syntax->list #'widths)))
|
||||||
(define num-of-rows (length (syntax->list #'heights)))
|
(define num-of-rows (length (syntax->list #'heights)))
|
||||||
#`(let #,(reverse let-bindings)
|
#`(let #,(reverse let-bindings)
|
||||||
(match* #,main-args
|
(match*/derived #,main-args #,stx
|
||||||
#,@(for*/list ([x (in-range 1 num-of-cols)]
|
#,@(for*/list ([x (in-range 1 num-of-cols)]
|
||||||
[y (in-range 1 num-of-rows)])
|
[y (in-range 1 num-of-rows)])
|
||||||
#`[(#,(hash-ref coord-to-content (list x 0))
|
#`[(#,(hash-ref coord-to-content (list x 0))
|
||||||
#,(hash-ref coord-to-content (list 0 y)))
|
#,(hash-ref coord-to-content (list 0 y)))
|
||||||
#,(hash-ref coord-to-content (list x y))])
|
#,(hash-ref coord-to-content (list x y))]))))]))
|
||||||
[(_ _)
|
|
||||||
(2dmatch-error #,@main-args)])))]))
|
|
||||||
|
|
||||||
(define (2dmatch-error a b)
|
|
||||||
(error '2dmatch "no matching clauses for ~e and ~e" a b))
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user