tools.analyzer

bug in validate loop locals generates invalide ast

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

I am seeing valid asts being generate for some recur forms, some arguments to recur in the ast are a {:env ..} map, no :op or other information

I think the following is the source of the problem:

(defmethod -validate-loop-locals :recur
  [_ {:keys [exprs env] :as ast}]
  (if validating?
    (let [casts (:loop-locals-casts env)]
      (assoc ast
        :exprs (mapv (fn [e c]
                       (if c (assoc e :tag c) c))
                     exprs (vals casts))))
    ast))

if I change it to (return e if not c in the mapv)

(defmethod -validate-loop-locals :recur
  [_ {:keys [exprs env] :as ast}]
  (if validating?
    (let [casts (:loop-locals-casts env)]
      (assoc ast
        :exprs (mapv (fn [e c]
                       (if c (assoc e :tag c) e))
                     exprs (vals casts))))
    ast))

I get the information I expect in the ast

Activity

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: