diff --git a/collects/tests/racket/contract-test.rktl b/collects/tests/racket/contract-test.rktl index dd93b870c4..0286c604f5 100644 --- a/collects/tests/racket/contract-test.rktl +++ b/collects/tests/racket/contract-test.rktl @@ -4350,6 +4350,25 @@ (with-continuation-mark mark (lambda (x) (+ x 1)) (do-mark mark)))) + (test/pos-blame + 'continuation-mark-key/c-ho-10 + '(let* ([mark (make-continuation-mark-key)] + [ctc-mark (contract (continuation-mark-key/c number?) + mark + 'pos + 'neg)]) + (with-continuation-mark mark "not a number" + (+ 1 (continuation-mark-set-first #f ctc-mark))))) + + (test/spec-passed + 'continuation-mark-key/c-ho-11 + '(let* ([mark (make-continuation-mark-key)] + [ctc-mark (contract (continuation-mark-key/c number?) + mark + 'pos + 'neg)]) + (continuation-mark-set-first #f ctc-mark))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; make-contract diff --git a/src/racket/src/fun.c b/src/racket/src/fun.c index a251f97e59..1bdad50a0b 100644 --- a/src/racket/src/fun.c +++ b/src/racket/src/fun.c @@ -7889,6 +7889,9 @@ scheme_extract_one_cc_mark_with_meta(Scheme_Object *mark_set, Scheme_Object *key } } + if (key_arg != key && val != NULL) + val = scheme_chaperone_do_continuation_mark("continuation-mark-set-first", 1, key_arg, val); + pos = startpos - findpos; if (pos > 16) { pos >>= 1; @@ -7931,8 +7934,6 @@ scheme_extract_one_cc_mark_with_meta(Scheme_Object *mark_set, Scheme_Object *key } else cht = NULL; - if (key_arg != key) - val = scheme_chaperone_do_continuation_mark("continuation-mark-set-first", 1, key_arg, val); if (!cache || !SCHEME_VECTORP(cache)) { /* No cache so far, so map one key */ cache = scheme_make_vector(4, NULL);