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

Source

(deftest nth-path-elem-test-types
  (testing "HVec"
    (is-tc-e
     (do
       (defalias StatementA (HVec [':params String]))
       (defalias StatementB (HVec [':no-params]))
       (defalias Statement (U StatementA StatementB))
       (fn [stmt :- Statement] :- Any
         (if (= :params (first stmt))
           (ann-form stmt StatementA))))))

  (testing "HSeq"
    (is-tc-e
     (do
       (defalias StatementA (HSeq [':params String]))
       (defalias StatementB (HSeq [':no-params]))
       (defalias Statement (U StatementA StatementB))
       (fn [stmt :- Statement] :- Any
         (if (= :params (first stmt))
           (ann-form stmt StatementA))))))

  (testing "HSequential"
    (is-tc-e
     (do
       (defalias StatementA (HSequential [':params String]))
       (defalias StatementB (HSequential [':no-params]))
       (defalias Statement (U StatementA StatementB))
       (fn [stmt :- Statement] :- Any
         (if (= :params (first stmt))
           (ann-form stmt StatementA))))))

  (testing "a mixture of types"
    (is-tc-e
     (do
       (defalias StatementA (HSeq [':params String]))
       (defalias StatementB (HVec [':no-params]))
       (defalias Statement (U StatementA StatementB))
       (fn [stmt :- Statement] :- Any
         (if (= :params (first stmt))
           (ann-form stmt StatementA)))))))

Uses on crossclj