     (->> (continuous-combinations (.arity src))
          (mapcat
            (fn [idxs]
-             (let [^Types input (types (subvec (.types src) (first idxs) (inc (last idxs))))]
+             (let [^Types input (types (subvec (.types src) (first idxs) (inc (peek idxs))))]
                (->> (possible-conversions g input)
                     (filter (fn [[[_ ^Types replacement] _]]
                               (>= max-arity (+ (.arity replacement)

            dsts (equivalent-targets g dst)]
        (loop []
          (when-some [^ConversionPath p (poll)]
            (let [curr (or (-> p .path last second) src)]
              (if (some #(assignable? curr %) dsts)
                p
                (do (run! (fn [[[src dst] c]]

   (fn [vs]
     (let [vs (vec vs)]
       (replace-range vs
                      ((.f conv) (subvec vs (first idxs) (inc (peek idxs))))
                      idxs)))
   (.cost conv)])

