cs & schemfiy: avoid crash with 1 extra argument to make-struct-type

This commit is contained in:
Matthew Flatt 2021-02-12 19:45:08 -07:00
parent ae80c890e9
commit 1f68962d67
3 changed files with 778 additions and 733 deletions

View File

@ -1563,6 +1563,27 @@
(struct exn:foo exn () #:constructor-name make-exn:foo)
(test "foo" exn-message (make-exn:foo "foo" (current-continuation-marks))))
;; ----------------------------------------
(err/rt-test
(let ()
;; Should be arity error (as opposed to a crash)
(define-values (struct:y y y? y-z)
(let-values ([(struct:_1 make-_2 ?_3 -ref_4 -set!_5)
(let-values ()
(let-values ()
(make-struct-type 'y #f 1 0 #f
(list)
(current-inspector)
#f '() #f 'y 'extra)))])
(values
struct:_1
make-_2
?_3
(make-struct-field-accessor -ref_4 0 'z))))
5))
;; ----------------------------------------
(report-errs)

File diff suppressed because it is too large Load Diff

View File

@ -39,6 +39,7 @@
(known-struct-type?
(find-known u-parent prim-knowns knowns imports mutated)))
(exact-nonnegative-integer? fields)
((length rest) . <= . 6)
(let ([prefab-imms
;; The inspector argument needs to be missing or duplicable,
;; and if it's not known to produce a value other than 'prefab,