<< Back to previous view

[TANAL-1] bug in validate loop locals generates invalide ast Created: 12/Nov/13  Updated: 12/Nov/13  Resolved: 12/Nov/13

Status: Closed
Project: tools.analyzer
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Kevin Downey Assignee: Nicola Mometto
Resolution: Completed Votes: 0
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



 Comments   
Comment by Nicola Mometto [ 12/Nov/13 5:00 PM ]

Fixed: https://github.com/clojure/tools.analyzer.jvm/commit/64f96fd5ef34d49db3a9c6cc4d009788ee3d2889

Generated at Sat Dec 20 02:46:07 CST 2014 using JIRA 4.4#649-r158309.