      :extend-hla!     (fn [a init-sets par-effect-sets] a)
      :hla-type        (fn [a] (throw (UnsupportedOperationException.)))})
 
-(deftype SAS-Compiled-HLA [name orig-type precond-vars effects refinements-and-preconditions-atom ref-generator-atom] :as this
+(deftype SAS-Compiled-HLA [name orig-hla precond-vars effects refinements-and-preconditions-atom ref-generator-atom] :as this
   SAS-Induced-Action
     (precond-var-set [] precond-vars)
     (effect-sets     [] effects)
     (pre-ref-pairs   [] @refinements-and-preconditions-atom)
     (compile-hla     [retain-type-set] this)
-    (hla-type        [] orig-type)
+    (hla-type        [] (hla-type orig-hla))
     (extend-hla!     [init-sets par-effect-sets] (throw (UnsupportedOperationException.)))
   env/Action
     (action-name [] [:!C  name])


(declare extend-precond-set-hla! make-interleaving-hla)
;; Preconds are ordered, max-level (deepest) first.
(deftype SAS-Precond-Set-HLA [ordered-preconds ref-atom] :as this
  SAS-Induced-Action
    (precond-var-set [] (apply clojure.set/union        (map precond-var-set ordered-preconds)))
    (effect-sets     [] (apply sequence-effect-set-maps (map effect-sets ordered-preconds)))

  hierarchy/HighLevelAction
    (immediate-refinements- [s]
      (let [[stalled-refs rest-refs] (split-with #(= (hla-type (first %)) ::SAS-Precond-Set-HLA) refinements)]
;        (println "\n\n" s "\n" (map (comp env/action-name first) refinements))
;        (println (map count [stalled-refs rest-refs]))
;        (println (map #(map type %) rest-refs))
        (if-let [[target-ref & more-refs] (seq rest-refs)]
