Skip to content

Commit 94bfd84

Browse files
committed
Fix programs with casts and ! annotations
1 parent 3aeb648 commit 94bfd84

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/syntax/syntax-check.rkt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@
5252
[#`(! #,props ... #,body)
5353
(check-properties* props '() error! deprecated-ops)
5454
(loop body vars)]
55+
[#`(cast #,arg)
56+
(loop arg vars)]
57+
[#`(cast #,args ...)
58+
(error! stx "Invalid `cast` expression with ~a arguments (expects 1)" (length args))
59+
(unless (null? args)
60+
(loop (first args) vars))]
5561
[#`(,(? (curry set-member? '(+ * and or))) #,args ...)
5662
;; Variary (minimum 0 arguments)
5763
(for ([arg args])

src/syntax/type-check.rkt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@
9595
(unless (equal? ift-repr iff-repr)
9696
(error! stx "If statement has different types for if (~a) and else (~a)" ift-repr iff-repr))
9797
ift-repr]
98-
[#`(! #,props ... #,body) (loop body (apply dict-set prop-dict props) ctx)]
98+
[#`(! #,props ... #,body)
99+
(loop body (apply dict-set prop-dict (map syntax->datum props)) ctx)]
99100
[#`(,(? (curry hash-has-key? (*functions*)) fname) #,args ...)
100101
; TODO: inline functions expect uniform types, this is clearly wrong
101102
(match-define (list vars prec _) (hash-ref (*functions*) fname))

0 commit comments

Comments
 (0)