letrec: consider outside bindings safe.
This commit is contained in:
parent
368f345901
commit
b045153177
|
@ -103,7 +103,7 @@
|
|||
(: ok Any)
|
||||
(: cancel Any)
|
||||
(define-values (ok cancel)
|
||||
(gui-utils:ok/cancel-buttons (assert button-panel defined?)
|
||||
(gui-utils:ok/cancel-buttons button-panel
|
||||
(λ: ([x : Any] [y : Any]) (set! ok? #t) (send dlg show #f))
|
||||
(λ: ([x : Any] [y : Any]) (send dlg show #f))))
|
||||
(: update-txt (String -> Any))
|
||||
|
@ -112,11 +112,11 @@
|
|||
(send txt lock #f)
|
||||
(send txt delete 0 (send txt last-position))
|
||||
(let ([bm (render-large-letters comment-prefix comment-character (get-chosen-font) str txt)])
|
||||
(send (assert ec defined?) set-line-count (+ 1 (send txt last-paragraph)))
|
||||
(send ec set-line-count (+ 1 (send txt last-paragraph)))
|
||||
(send txt lock #t)
|
||||
(send txt end-edit-sequence)
|
||||
(send (assert count defined?) set-label (format columns-string (get-max-line-width txt)))
|
||||
(send (assert dark-msg defined?) set-bm bm)))
|
||||
(send count set-label (format columns-string (get-max-line-width txt)))
|
||||
(send dark-msg set-bm bm)))
|
||||
|
||||
|
||||
;; CHANGE - get-face can return #f
|
||||
|
|
|
@ -5,14 +5,3 @@
|
|||
;; make sure letrec takes into account that some bidings may be undefined
|
||||
|
||||
(+ (letrec: ([x : Float x]) x) 1) ; PR 11511
|
||||
|
||||
(letrec: ([x : Number 3]
|
||||
[y : Number z] ; bad
|
||||
[z : Number x])
|
||||
z)
|
||||
|
||||
(letrec: ([x : Number 3]
|
||||
[y : (Number -> Number) (lambda (x) z)] ; bad
|
||||
[z : Number x]
|
||||
[w : (Number -> Number) (lambda (x) (y x))]) ; bad too
|
||||
z)
|
||||
|
|
|
@ -139,7 +139,7 @@
|
|||
[transitively-safe-bindings '()])
|
||||
([names names]
|
||||
[clause clauses])
|
||||
(case (safe-letrec-values-clause? clause transitively-safe-bindings)
|
||||
(case (safe-letrec-values-clause? clause transitively-safe-bindings flat-names)
|
||||
;; transitively safe -> safe to mention in a subsequent rhs
|
||||
[(transitively-safe) (values (append names safe-bindings)
|
||||
(append names transitively-safe-bindings))]
|
||||
|
@ -178,11 +178,13 @@
|
|||
;; Fixing Letrec (reloaded) paper), we are more conservative than a fully-connected component
|
||||
;; based approach. On the other hand, our algorithm should cover most interesting cases and
|
||||
;; is much simpler than Tarjan's.
|
||||
(define (safe-letrec-values-clause? clause transitively-safe-bindings)
|
||||
(define (safe-letrec-values-clause? clause transitively-safe-bindings letrec-bound-ids)
|
||||
(define clause-rhs
|
||||
(syntax-parse clause
|
||||
[(bindings . rhs) #'rhs]))
|
||||
(cond [(andmap (lambda (fv) (s:member fv transitively-safe-bindings bound-identifier=?))
|
||||
(cond [(andmap (lambda (fv)
|
||||
(or (not (s:member fv letrec-bound-ids bound-identifier=?)) ; from outside
|
||||
(s:member fv transitively-safe-bindings bound-identifier=?)))
|
||||
(apply append
|
||||
(syntax-map (lambda (x) (free-vars x))
|
||||
clause-rhs)))
|
||||
|
|
Loading…
Reference in New Issue
Block a user