store/[org.clojure/core.typed "0.2.81"] clj::clojure.core.typed.test.nth-path-elem-test/nth-path-elem-test-second

Source

(deftest nth-path-elem-test-second
  (is-tc-e
   (do
     (defalias StatementA '[Number ':params String])
     (defalias StatementB '[Number ':no-params])
     (defalias Statement (U StatementA StatementB))
     (fn [stmt :- Statement] :- Any
       (if (= :params (second stmt))
         (let [param (nth stmt 2)]
           (ann-form param String))))))

  (testing "we actually do typechecking at the innermost form"
    ;; If `second` incorrectly uses an index of 0, this test fails
    (is-tc-err
     (do
       (defalias StatementA '[Number ':params String])
       (defalias StatementB '[Number ':no-params])
       (defalias Statement (U StatementA StatementB))
       (fn [stmt :- Statement] :- Any
         (if (= :params (second stmt))
           (let [param (nth stmt 2)]
             (ann-form param Number))))))))

Uses on crossclj