Fixed a few bugs in set/c's keyword options, and one test for set/c.
Specifically, set/c no longer behaves as a flat contract, so it is necessary to apply at least one set operation to detect a contract error on an element. It is possible the flat behavior can be restored for some kinds of sets, but it's not immediately obvious what kinds those should be. (Immutable hash sets in particular? Any sets that don't implement set-add! or set-remove!?)
This commit is contained in:
parent
8aeadd314d
commit
1c7cdfb302
|
@ -13,9 +13,9 @@
|
||||||
|
|
||||||
(test/pos-blame
|
(test/pos-blame
|
||||||
'set/c2
|
'set/c2
|
||||||
'(contract (set/c integer?)
|
'(set-first (contract (set/c integer?)
|
||||||
(set #t)
|
(set #t)
|
||||||
'pos 'neg))
|
'pos 'neg)))
|
||||||
|
|
||||||
(test/pos-blame
|
(test/pos-blame
|
||||||
'set/c3
|
'set/c3
|
||||||
|
|
|
@ -96,10 +96,10 @@
|
||||||
(unless (set-equal? x)
|
(unless (set-equal? x)
|
||||||
(raise-blame-error b x "expected an equal?-based set"))]
|
(raise-blame-error b x "expected an equal?-based set"))]
|
||||||
[(eqv)
|
[(eqv)
|
||||||
(unless (set-equal? x)
|
(unless (set-eqv? x)
|
||||||
(raise-blame-error b x "expected an eqv?-based set"))]
|
(raise-blame-error b x "expected an eqv?-based set"))]
|
||||||
[(eq)
|
[(eq)
|
||||||
(unless (set-equal? x)
|
(unless (set-eq? x)
|
||||||
(raise-blame-error b x "expected an eq?-based set"))])
|
(raise-blame-error b x "expected an eq?-based set"))])
|
||||||
(case kind
|
(case kind
|
||||||
[(mutable-or-weak)
|
[(mutable-or-weak)
|
||||||
|
@ -109,7 +109,7 @@
|
||||||
(unless (set-mutable? x)
|
(unless (set-mutable? x)
|
||||||
(raise-blame-error b x "expected a mutable set"))]
|
(raise-blame-error b x "expected a mutable set"))]
|
||||||
[(weak)
|
[(weak)
|
||||||
(unless (set-mutable? x)
|
(unless (set-weak? x)
|
||||||
(raise-blame-error b x "expected a weak set"))]
|
(raise-blame-error b x "expected a weak set"))]
|
||||||
[(immutable)
|
[(immutable)
|
||||||
(unless (set-immutable? x)
|
(unless (set-immutable? x)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user