Skip to content

Commit 37236ea

Browse files
endobsonrmculpepper
authored andcommitted
Fix register-struct-bindings! to meet correct contract.
Please merge to 5.3.2. (cherry picked from commit a5daacd)
1 parent b160adf commit 37236ea

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

collects/typed-racket/typecheck/tc-structs.rkt

+14-8
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@
150150

151151
;; Register the approriate types to the struct bindings.
152152
(define/cond-contract (register-struct-bindings! sty names desc si)
153-
(c-> Struct? struct-names? struct-desc? (or/c #f struct-info?) void?)
153+
(c-> Struct? struct-names? struct-desc? (or/c #f struct-info?) (listof def-binding?))
154154

155155

156156
(define tvars (struct-desc-tvars desc))
@@ -203,14 +203,20 @@
203203
(add-struct-fn! s (make-StructPE poly-base i) #t)
204204
(cons s (poly-wrapper (->* (list poly-base t) -Void))))
205205
null))))
206+
206207
(add-struct-constructor! (struct-names-constructor names))
207-
(cons
208-
(and si (make-def-struct-stx-binding (struct-names-type-name names) si))
209-
(for/list ([b bindings])
210-
(define id (car b))
211-
(define t (cdr b))
212-
(register-type id t)
213-
(make-def-binding id t))))
208+
209+
(define def-bindings
210+
(for/list ([b bindings])
211+
(define id (car b))
212+
(define t (cdr b))
213+
(register-type id t)
214+
(make-def-binding id t)))
215+
(if si
216+
(cons
217+
(make-def-struct-stx-binding (struct-names-type-name names) si)
218+
def-bindings)
219+
def-bindings))
214220

215221
(define (register-parsed-struct-sty! ps)
216222
(match ps

0 commit comments

Comments
 (0)