fix seg fault when using in-X-set sequence constructor with wrong kind of set; closes #2765
This commit is contained in:
parent
0e2d97b1e4
commit
69d748a95e
|
@ -776,6 +776,18 @@
|
||||||
(err/rt-test (for/sum ([x (in-weak-set '(1 2))]) x)
|
(err/rt-test (for/sum ([x (in-weak-set '(1 2))]) x)
|
||||||
exn:fail:contract?
|
exn:fail:contract?
|
||||||
#rx"not a hash set")
|
#rx"not a hash set")
|
||||||
|
(err/rt-test (for/sum ([x (in-weak-set (set 1 2))]) x)
|
||||||
|
exn:fail:contract?
|
||||||
|
#rx"wrong kind of hash set")
|
||||||
|
(err/rt-test (for/sum ([x (in-mutable-set (set 1 2))]) x)
|
||||||
|
exn:fail:contract?
|
||||||
|
#rx"wrong kind of hash set")
|
||||||
|
(err/rt-test (for/sum ([x (in-immutable-set (mutable-set 1 2))]) x)
|
||||||
|
exn:fail:contract?
|
||||||
|
#rx"wrong kind of hash set")
|
||||||
|
(err/rt-test (for/sum ([x (in-immutable-set (weak-set 1 2))]) x)
|
||||||
|
exn:fail:contract?
|
||||||
|
#rx"wrong kind of hash set")
|
||||||
(test 10 'in-hash-set (for/sum ([x (in-immutable-set (set 1 2 3 4))]) x))
|
(test 10 'in-hash-set (for/sum ([x (in-immutable-set (set 1 2 3 4))]) x))
|
||||||
(test 10 'in-hash-set (for/sum ([x (in-mutable-set (mutable-set 1 2 3 4))]) x))
|
(test 10 'in-hash-set (for/sum ([x (in-mutable-set (mutable-set 1 2 3 4))]) x))
|
||||||
(test 10 'in-hash-set (for/sum ([x (in-weak-set (weak-set 1 2 3 4))]) x))
|
(test 10 'in-hash-set (for/sum ([x (in-weak-set (weak-set 1 2 3 4))]) x))
|
||||||
|
|
|
@ -611,7 +611,7 @@
|
||||||
(:do-in
|
(:do-in
|
||||||
;;outer bindings
|
;;outer bindings
|
||||||
([(HT fn) (let ([xs set-expr])
|
([(HT fn) (let ([xs set-expr])
|
||||||
(if (custom-set? xs)
|
(if (and (custom-set? xs) (-test? xs))
|
||||||
(values
|
(values
|
||||||
(custom-set-table xs)
|
(custom-set-table xs)
|
||||||
(if (custom-set-spec xs)
|
(if (custom-set-spec xs)
|
||||||
|
@ -619,8 +619,15 @@
|
||||||
(lambda (x) x)))
|
(lambda (x) x)))
|
||||||
(values #f #f)))])
|
(values #f #f)))])
|
||||||
;; outer check
|
;; outer check
|
||||||
(unless (and HT (-test? HT))
|
(unless HT
|
||||||
(custom-in-set/checked set-expr))
|
(define s set-expr)
|
||||||
|
(if (custom-set? s)
|
||||||
|
(raise (exn:fail:contract
|
||||||
|
(format "wrong kind of hash set, expected ~a, got: ~a\n" 'SETTYPE s)
|
||||||
|
(current-continuation-marks)))
|
||||||
|
(raise (exn:fail:contract
|
||||||
|
(format "not a hash set: ~a" s)
|
||||||
|
(current-continuation-marks)))))
|
||||||
;; loop bindings
|
;; loop bindings
|
||||||
([i (-first HT)])
|
([i (-first HT)])
|
||||||
;; pos check
|
;; pos check
|
||||||
|
|
Loading…
Reference in New Issue
Block a user