fix validation of known structure mutators
Specifically, fix the case where the structure type for the mutator includes "auto" fields (with no corresponding constructor argument).
This commit is contained in:
parent
f878afb82b
commit
6444d078eb
|
@ -6210,6 +6210,26 @@
|
||||||
((proc)))
|
((proc)))
|
||||||
(void proc proc)))
|
(void proc proc)))
|
||||||
|
|
||||||
|
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;; Make sure validation doesn't fail for importing a setter of a
|
||||||
|
;; structure type that has auto fields:
|
||||||
|
|
||||||
|
(module provides-a-mutator-for-a-struct-with-an-auto-field racket/base
|
||||||
|
(provide foo set-foo-y!)
|
||||||
|
(struct foo (x [y #:mutable] [z #:auto])))
|
||||||
|
|
||||||
|
(let ([e `(module uses-mutator-with-an-auto-field racket/base
|
||||||
|
(require 'provides-a-mutator-for-a-struct-with-an-auto-field)
|
||||||
|
(provide f)
|
||||||
|
(define (f x)
|
||||||
|
(and x
|
||||||
|
(set-foo-y! x 1))))]
|
||||||
|
[o (open-output-bytes)])
|
||||||
|
(write (compile e) o)
|
||||||
|
(parameterize ([read-accept-compiled #t])
|
||||||
|
(eval (read (open-input-bytes (get-output-bytes o)))))
|
||||||
|
((dynamic-require ''uses-mutator-with-an-auto-field 'f) #f))
|
||||||
|
|
||||||
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(report-errs)
|
(report-errs)
|
||||||
|
|
|
@ -3608,7 +3608,7 @@ int scheme_check_structure_shape(Scheme_Object *e, Scheme_Object *expected)
|
||||||
return (v == STRUCT_PROC_SHAPE_PRED);
|
return (v == STRUCT_PROC_SHAPE_PRED);
|
||||||
} else if (i == SCHEME_PRIM_STRUCT_TYPE_INDEXED_SETTER) {
|
} else if (i == SCHEME_PRIM_STRUCT_TYPE_INDEXED_SETTER) {
|
||||||
st = (Scheme_Struct_Type *)SCHEME_PRIM_CLOSURE_ELS(e)[0];
|
st = (Scheme_Struct_Type *)SCHEME_PRIM_CLOSURE_ELS(e)[0];
|
||||||
return (v == ((st->num_islots << STRUCT_PROC_SHAPE_SHIFT)
|
return (v == ((st->num_slots << STRUCT_PROC_SHAPE_SHIFT)
|
||||||
| STRUCT_PROC_SHAPE_SETTER));
|
| STRUCT_PROC_SHAPE_SETTER));
|
||||||
} else if (i == SCHEME_PRIM_STRUCT_TYPE_INDEXED_GETTER) {
|
} else if (i == SCHEME_PRIM_STRUCT_TYPE_INDEXED_GETTER) {
|
||||||
int pos = SCHEME_INT_VAL(SCHEME_PRIM_CLOSURE_ELS(e)[1]);
|
int pos = SCHEME_INT_VAL(SCHEME_PRIM_CLOSURE_ELS(e)[1]);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user