diff --git a/collects/racket/contract/private/arr-i-parse.rkt b/collects/racket/contract/private/arr-i-parse.rkt index 36f9797ce3..f3cd48bb23 100644 --- a/collects/racket/contract/private/arr-i-parse.rkt +++ b/collects/racket/contract/private/arr-i-parse.rkt @@ -172,7 +172,10 @@ code does the parsing and validation of the syntax. (set! sp (cons from sp)) (free-identifier-mapping-put! neighbors from - (cons to (free-identifier-mapping-get neighbors from (λ () '()))))) + (cons to (free-identifier-mapping-get neighbors from)))) + + (define (init-neighbors var) + (free-identifier-mapping-put! neighbors var '())) (define (no-links from) (set! sp (cons from sp)) @@ -182,6 +185,7 @@ code does the parsing and validation of the syntax. (for ([a-res (in-list arg/ress)]) (cond [(arg/res-vars a-res) + (init-neighbors (arg/res-var a-res)) (for ([nvar (in-list (arg/res-vars a-res))]) (link (arg/res-var a-res) nvar))] [else @@ -196,6 +200,7 @@ code does the parsing and validation of the syntax. (when a-rst (cond [(arg/res-vars a-rst) + (init-neighbors (arg/res-var a-rst)) (for ([nvar (in-list (arg/res-vars a-rst))]) (link (arg/res-var a-rst) nvar))] [else diff --git a/collects/tests/racket/contract-test.rktl b/collects/tests/racket/contract-test.rktl index eee9b63b0a..fb0de1b7dc 100644 --- a/collects/tests/racket/contract-test.rktl +++ b/collects/tests/racket/contract-test.rktl @@ -3341,6 +3341,13 @@ 'neg) 1)) + ;; this used to cause a runtime error in the code that parses ->i + (ctest 'no-crash + '->i-no-vars-with-dep + (begin (->i ([x () any/c] [y (x) any/c]) any) 'no-crash)) + + + ; ; ; @@ -12854,7 +12861,7 @@ so that propagation occurs. 'pos 'neg)) (f 10))) - + ;