#lang racket/base

;; CLJ-specific stdlib entries: JVM/Clojure functions unavailable in CLJS.
;;
;; Split from stdlib-types.rkt. Merged into the unified STDLIB-TYPES at
;; require time; kept separate so the CLJS pipeline can exclude cleanly.

(require "types.rkt"
         "stdlib-helpers.rkt"
         racket/set)

(define STDLIB-CLJ
  (hash
   ;; --- atom / ref: CLJ-specific extensions --------------------------------
   'volatile!  (fn-of '(Any) 'Any)
   'vreset!    (fn-of '(Any Any) 'Any)
   'vswap!     (fn-of '(Any Any) 'Any #:rest 'Any)
   ;; --- delay / promise / future -------------------------------------------
   'delay      (fn-of '(Any) 'Any)
   'force      (fn-of '(Any) 'Any)
   'realized?  (fn-of '(Any) 'Bool)
   'deliver    (fn-of '(Any Any) 'Any)
   'promise    (fn-of '() 'Any)
   ;; --- type coercion: CLJ-specific -----------------------------------------
   'long       (fn-of '(Any) 'Int)
   'float      (fn-of '(Any) 'Float)
   'short      (fn-of '(Any) 'Int)
   'byte       (fn-of '(Any) 'Int)
   'bigint     (fn-of '(Any) 'Any)
   'biginteger (fn-of '(Any) 'Any)
   'bigdec     (fn-of '(Any) 'Any)
   'num        (fn-of '(Any) 'Any)
   'rationalize (fn-of '(Any) 'Any)
   ;; --- type predicates: JVM-specific -------------------------------------
   'char?      (fn-of '(Any) 'Bool)
   'float?     (fn-of '(Any) 'Bool)
   'double?    (fn-of '(Any) 'Bool)
   'int?       (fn-of '(Any) 'Bool)
   'nat-int?   (fn-of '(Any) 'Bool)
   'pos-int?   (fn-of '(Any) 'Bool)
   'neg-int?   (fn-of '(Any) 'Bool)
   'decimal?   (fn-of '(Any) 'Bool)
   'ratio?     (fn-of '(Any) 'Bool)
   'rational?  (fn-of '(Any) 'Bool)
   'associative? (fn-of '(Any) 'Bool)
   'sorted?    (fn-of '(Any) 'Bool)
   'counted?   (fn-of '(Any) 'Bool)
   'reversible? (fn-of '(Any) 'Bool)
   'seqable?   (fn-of '(Any) 'Bool)
   'indexed?   (fn-of '(Any) 'Bool)
   'ifn?       (fn-of '(Any) 'Bool)
   'ident?     (fn-of '(Any) 'Bool)
   'qualified-ident? (fn-of '(Any) 'Bool)
   'simple-ident? (fn-of '(Any) 'Bool)
   'qualified-keyword? (fn-of '(Any) 'Bool)
   'simple-keyword? (fn-of '(Any) 'Bool)
   'qualified-symbol? (fn-of '(Any) 'Bool)
   'simple-symbol? (fn-of '(Any) 'Bool)
   'uri?       (fn-of '(Any) 'Bool)
   'uuid?      (fn-of '(Any) 'Bool)
   'inst?      (fn-of '(Any) 'Bool)
   'bytes?     (fn-of '(Any) 'Bool)
   'class?     (fn-of '(Any) 'Bool)
   'record?    (fn-of '(Any) 'Bool)
   'satisfies? (fn-of '(Any Any) 'Bool)
   'instance?  (fn-of '(Any Any) 'Bool)
   'extends?   (fn-of '(Any Any) 'Bool)
   ;; --- string: CLJ-specific -----------------------------------------------
   'char-escape-string (fn-of '(Any) 'Any)
   ;; --- clojure.string -----------------------------------------------------
   'clojure.string/join     (fn-of '(Any) 'String #:rest 'Any)
   ;; (split s re) and (split s re limit) — Clojure's 3-arg form takes an Int
   ;; limit (-1 keeps trailing empties). Optional 3rd arg via a rest Int.
   'clojure.string/split    (type-fn (list (p 'String) (p 'Any)) (p 'Int)
                                     (type-app 'Vec (list (p 'String))))
   'clojure.string/replace  (fn-of '(String Any Any) 'String)
   'clojure.string/trim     (fn-of '(String) 'String)
   'clojure.string/triml    (fn-of '(String) 'String)
   'clojure.string/trimr    (fn-of '(String) 'String)
   'clojure.string/upper-case (fn-of '(String) 'String)
   'clojure.string/lower-case (fn-of '(String) 'String)
   'clojure.string/capitalize (fn-of '(String) 'String)
   'clojure.string/blank?   (fn-of '(Any) 'Bool)
   'clojure.string/includes? (fn-of '(String String) 'Bool)
   'clojure.string/starts-with? (fn-of '(String String) 'Bool)
   'clojure.string/ends-with? (fn-of '(String String) 'Bool)
   'clojure.string/reverse  (fn-of '(String) 'String)
   'clojure.string/escape   (fn-of '(String Any) 'String)
   'clojure.string/re-quote-replacement (fn-of '(String) 'String)
   ;; Nullable-honest returns: no match → nil. Ergonomic now that
   ;; nil-narrowing flows through if/when/if-let/and/or/cond guards.
   ;; 3rd arg = optional from-index (Int); Clojure supports (index-of s v from-index).
   'clojure.string/index-of (type-fn (list (p 'String) (p 'Any)) (p 'Int)
                                     (type-union (list (p 'Int) (p 'Nil))))
   'clojure.string/last-index-of (type-fn (list (p 'String) (p 'Any)) (p 'Int)
                                          (type-union (list (p 'Int) (p 'Nil))))
   'clojure.string/split-lines (type-fn (list (p 'String)) #f
                                        (type-app 'Vec (list (p 'String))))
   'clojure.string/replace-first (fn-of '(String Any Any) 'String)
   ;; --- clojure.set -------------------------------------------------------
   'clojure.set/union       (fn-of '() 'Any #:rest 'Any)
   'clojure.set/intersection (fn-of '(Any) 'Any #:rest 'Any)
   'clojure.set/difference  (fn-of '(Any) 'Any #:rest 'Any)
   'clojure.set/select      (fn-of '(Any Any) 'Any)
   'clojure.set/project     (fn-of '(Any Any) 'Any)
   'clojure.set/rename       (fn-of '(Any Any) 'Any)
   'clojure.set/join        (fn-of '(Any Any) 'Any #:rest 'Any)
   'clojure.set/map-invert  (fn-of '(Any) 'Any)
   'clojure.set/index       (fn-of '(Any Any) 'Any)
   'clojure.set/subset?     (fn-of '(Any Any) 'Bool)
   'clojure.set/superset?   (fn-of '(Any Any) 'Bool)
   ;; --- clojure.walk -------------------------------------------------------
   'clojure.walk/walk       (fn-of '(Any Any Any) 'Any)
   'clojure.walk/postwalk   (fn-of '(Any Any) 'Any)
   'clojure.walk/prewalk    (fn-of '(Any Any) 'Any)
   'clojure.walk/postwalk-replace (fn-of '(Any Any) 'Any)
   'clojure.walk/prewalk-replace  (fn-of '(Any Any) 'Any)
   'clojure.walk/stringify-keys   (fn-of '(Any) 'Any)
   'clojure.walk/keywordize-keys  (fn-of '(Any) 'Any)
   ;; --- clojure.java.io ----------------------------------------------------
   'clojure.java.io/file          (fn-of '(String) 'Any #:rest 'String)
   'clojure.java.io/reader        (fn-of '(Any) 'Any)
   'clojure.java.io/writer        (fn-of '(Any) 'Any)
   'clojure.java.io/input-stream  (fn-of '(Any) 'Any)
   'clojure.java.io/output-stream (fn-of '(Any) 'Any)
   'clojure.java.io/resource      (fn-of '(String) 'Any)
   'clojure.java.io/copy          (fn-of '(Any Any) 'Any)
   'clojure.java.io/delete-file   (fn-of '(Any) 'Bool #:rest 'Any)
   'clojure.java.io/make-parents  (fn-of '(Any) 'Bool)
   ;; --- clojure.pprint ------------------------------------------------------
   'clojure.pprint/pprint       (fn-of '(Any) 'Nil #:rest 'Any)
   'clojure.pprint/cl-format    (fn-of '(Any String) 'Any #:rest 'Any)
   'clojure.pprint/print-table  (fn-of '(Any) 'Nil #:rest 'Any)
   ;; --- clojure.edn -------------------------------------------------------
   'clojure.edn/read-string (fn-of '(String) 'Any)
   'clojure.edn/read        (fn-of '(Any) 'Any)
   ;; --- clojure.data -------------------------------------------------------
   ;; (diff returns [in-a-only in-b-only in-both])
   'clojure.data/diff       (fn-of '(Any Any) 'Any)
   ;; --- clojure.repl -------------------------------------------------------
   ;; (interactive help/debug functions; return Nil for printing-only)
   'clojure.repl/doc        (fn-of '(Any) 'Nil)
   'clojure.repl/source     (fn-of '(Any) 'Nil)
   'clojure.repl/dir        (fn-of '(Any) 'Nil)
   'clojure.repl/pst        (fn-of '() 'Nil #:rest 'Any)
   'clojure.repl/apropos    (fn-of '(Any) 'Any)
   'clojure.repl/find-doc   (fn-of '(Any) 'Nil)
   'clojure.repl/demunge    (fn-of '(String) 'String)
   ;; --- clojure.test -------------------------------------------------------
   ;; (test runner — `is`, `are`, `testing` are macros; `run-tests` returns a map)
   'clojure.test/run-tests       (fn-of '() 'Any #:rest 'Any)
   'clojure.test/run-all-tests   (fn-of '() 'Any #:rest 'Any)
   'clojure.test/successful?     (fn-of '(Any) 'Bool)
   'clojure.test/test-var        (fn-of '(Any) 'Any)
   'clojure.test/test-vars       (fn-of '(Any) 'Any)
   'clojure.test/test-ns         (fn-of '(Any) 'Any)
   ;; --- clojure.zip --------------------------------------------------------
   ;; (zipper navigation; locs are opaque)
   'clojure.zip/zipper           (fn-of '(Any Any Any Any) 'Any)
   'clojure.zip/seq-zip          (fn-of '(Any) 'Any)
   'clojure.zip/vector-zip       (fn-of '(Any) 'Any)
   'clojure.zip/xml-zip          (fn-of '(Any) 'Any)
   'clojure.zip/node             (fn-of '(Any) 'Any)
   'clojure.zip/branch?          (fn-of '(Any) 'Bool)
   'clojure.zip/children         (fn-of '(Any) 'Any)
   'clojure.zip/make-node        (fn-of '(Any Any Any) 'Any)
   'clojure.zip/path             (fn-of '(Any) 'Any)
   'clojure.zip/lefts            (fn-of '(Any) 'Any)
   'clojure.zip/rights           (fn-of '(Any) 'Any)
   'clojure.zip/down             (fn-of '(Any) 'Any)
   'clojure.zip/up               (fn-of '(Any) 'Any)
   'clojure.zip/root             (fn-of '(Any) 'Any)
   'clojure.zip/right            (fn-of '(Any) 'Any)
   'clojure.zip/rightmost        (fn-of '(Any) 'Any)
   'clojure.zip/left             (fn-of '(Any) 'Any)
   'clojure.zip/leftmost         (fn-of '(Any) 'Any)
   'clojure.zip/insert-left      (fn-of '(Any Any) 'Any)
   'clojure.zip/insert-right     (fn-of '(Any Any) 'Any)
   'clojure.zip/replace          (fn-of '(Any Any) 'Any)
   'clojure.zip/edit             (fn-of '(Any Any) 'Any #:rest 'Any)
   'clojure.zip/insert-child     (fn-of '(Any Any) 'Any)
   'clojure.zip/append-child     (fn-of '(Any Any) 'Any)
   'clojure.zip/next             (fn-of '(Any) 'Any)
   'clojure.zip/prev             (fn-of '(Any) 'Any)
   'clojure.zip/end?             (fn-of '(Any) 'Bool)
   'clojure.zip/remove           (fn-of '(Any) 'Any)
   ;; --- namespace / var inspection: CLJ-specific --------------------------
   'type       (fn-of '(Any) 'Any)
   'class      (fn-of '(Any) 'Any)
   'supers     (fn-of '(Any) 'Any)
   'bases      (fn-of '(Any) 'Any)
   'alter-meta! (fn-of '(Any Any) 'Any #:rest 'Any)
   ;; --- io: JVM file IO ---------------------------------------------------
   'slurp      (fn-of '(Any) 'String)
   'spit       (fn-of '(Any Any) 'Nil #:rest 'Any)
   'read-string (fn-of '(String) 'Any)
   ;; --- array ops: CLJ-specific ---------------------------------------------
   'alength    (fn-of '(Any) 'Int)
   'aclone     (fn-of '(Any) 'Any)
   'array      (fn-of '() 'Any #:rest 'Any)
   'into-array (fn-of '(Any) 'Any #:rest 'Any)
   'make-array (fn-of '(Any Int) 'Any)
   ;; --- Java interop: instance methods (receiver is first param) ----------
   '.getMessage  (fn-of '(Any) 'String)
   '.getCause    (fn-of '(Any) 'Any)
   '.getClass    (fn-of '(Any) 'Any)
   '.hashCode    (fn-of '(Any) 'Int)
   '.equals      (fn-of '(Any Any) 'Bool)
   '.compareTo   (fn-of '(Any Any) 'Int)
   '.indexOf     (fn-of '(String String) 'Int)
   '.lastIndexOf (fn-of '(String String) 'Int)
   '.charAt      (fn-of '(String Int) 'Any)
   '.substring   (fn-of '(String Int) 'String #:rest 'Int)
   '.replace     (fn-of '(String Any Any) 'String)
   '.replaceAll  (fn-of '(String String String) 'String)
   '.replaceFirst (fn-of '(String String String) 'String)
   '.matches     (fn-of '(String String) 'Bool)
   '.split       (fn-of '(String String) 'Any)
   '.isEmpty     (fn-of '(Any) 'Bool)
   '.toCharArray (fn-of '(String) 'Any)
   '.getBytes    (fn-of '(String) 'Any #:rest 'Any)
   '.intern      (fn-of '(String) 'String)
   '.format      (fn-of '(Any String) 'String #:rest 'Any)
   '.size        (fn-of '(Any) 'Int)
   '.get         (fn-of '(Any Any) 'Any)
   '.put         (fn-of '(Any Any Any) 'Any)
   '.add         (fn-of '(Any Any) 'Bool)
   '.remove      (fn-of '(Any Any) 'Any)
   '.clear       (fn-of '(Any) 'Nil)
   '.containsKey (fn-of '(Any Any) 'Bool)
   '.containsValue (fn-of '(Any Any) 'Bool)
   '.keySet      (fn-of '(Any) 'Any)
   '.values      (fn-of '(Any) 'Any)
   '.entrySet    (fn-of '(Any) 'Any)
   '.iterator    (fn-of '(Any) 'Any)
   '.hasNext     (fn-of '(Any) 'Bool)
   '.next        (fn-of '(Any) 'Any)
   '.exists        (fn-of '(Any) 'Bool)
   '.toString      (fn-of '(Any) 'String)
   '.length        (fn-of '(String) 'Int)
   '.trim          (fn-of '(String) 'String)
   '.startsWith    (fn-of '(String String) 'Bool)
   '.endsWith      (fn-of '(String String) 'Bool)
   '.contains      (fn-of '(String String) 'Bool)
   '.toLowerCase   (fn-of '(String) 'String)
   '.toUpperCase   (fn-of '(String) 'String)
   '.getPath       (fn-of '(Any) 'String)
   '.getName       (fn-of '(Any) 'String)
   '.getParent     (fn-of '(Any) 'String)
   '.getParentFile (fn-of '(Any) 'Any)
   '.mkdirs        (fn-of '(Any) 'Bool)
   '.mkdir         (fn-of '(Any) 'Bool)
   '.isDirectory   (fn-of '(Any) 'Bool)
   '.isFile        (fn-of '(Any) 'Bool)
   '.delete        (fn-of '(Any) 'Bool)
   '.canRead       (fn-of '(Any) 'Bool)
   '.canWrite      (fn-of '(Any) 'Bool)
   '.lastModified  (fn-of '(Any) 'Int)
   '.toPath        (fn-of '(Any) 'Any)
   '.close         (fn-of '(Any) 'Nil)
   ;; --- Java interop: static methods --------------------------------------
   'Boolean/parseBoolean (fn-of '(String) 'Bool)
   'Boolean/valueOf      (fn-of '(Any) 'Bool)
   'Integer/valueOf      (fn-of '(Any) 'Int)
   'Long/valueOf         (fn-of '(Any) 'Int)
   'Double/valueOf       (fn-of '(Any) 'Float)
   'Float/parseFloat     (fn-of '(String) 'Float)
   'String/valueOf       (fn-of '(Any) 'String)
   'String/format        (fn-of '(String) 'String #:rest 'Any)
   'Math/PI              (p 'Float)
   'Math/E               (p 'Float)
   'Math/sin             (fn-of '(Float) 'Float)
   'Math/cos             (fn-of '(Float) 'Float)
   'Math/tan             (fn-of '(Float) 'Float)
   'Math/asin            (fn-of '(Float) 'Float)
   'Math/acos            (fn-of '(Float) 'Float)
   'Math/atan            (fn-of '(Float) 'Float)
   'Math/atan2           (fn-of '(Float Float) 'Float)
   'Math/log             (fn-of '(Float) 'Float)
   'Math/log10           (fn-of '(Float) 'Float)
   'Math/exp             (fn-of '(Float) 'Float)
   'Math/random          (fn-of '() 'Float)
   'Math/signum          (fn-of '(Float) 'Float)
   'Math/toRadians       (fn-of '(Float) 'Float)
   'Math/toDegrees       (fn-of '(Float) 'Float)
   'Math/cbrt            (fn-of '(Float) 'Float)
   'Math/hypot           (fn-of '(Float Float) 'Float)
   'Math/IEEEremainder   (fn-of '(Float Float) 'Float)
   'Math/floorMod        (fn-of '(Int Int) 'Int)
   'Math/floorDiv        (fn-of '(Int Int) 'Int)
   'Math/addExact        (fn-of '(Int Int) 'Int)
   'Math/subtractExact   (fn-of '(Int Int) 'Int)
   'Math/multiplyExact   (fn-of '(Int Int) 'Int)
   'Math/incrementExact  (fn-of '(Int) 'Int)
   'Math/decrementExact  (fn-of '(Int) 'Int)
   'Math/negateExact     (fn-of '(Int) 'Int)
   'Math/toIntExact      (fn-of '(Int) 'Int)
   'Collections/unmodifiableList (fn-of '(Any) 'Any)
   'Collections/unmodifiableMap  (fn-of '(Any) 'Any)
   'Collections/sort     (fn-of '(Any) 'Nil #:rest 'Any)
   'Arrays/asList        (fn-of '(Any) 'Any)
   'Arrays/sort          (fn-of '(Any) 'Nil #:rest 'Any)
   'Objects/requireNonNull (fn-of '(Any) 'Any #:rest 'Any)
   'Thread/sleep         (fn-of '(Int) 'Nil)
   'Instant/now          (fn-of '() 'Any)
   'Instant/parse        (fn-of '(Any) 'Any)
   'UUID/randomUUID      (fn-of '() 'Any)
   'UUID/fromString      (fn-of '(String) 'Any)
   'Math/abs      (fn-of '(Int) 'Int)
   'Math/max      (fn-of '(Int Int) 'Int)
   'Math/min      (fn-of '(Int Int) 'Int)
   'Math/round    (fn-of '(Float) 'Int)
   'Math/floor    (fn-of '(Float) 'Float)
   'Math/ceil     (fn-of '(Float) 'Float)
   'Math/pow      (fn-of '(Float Float) 'Float)
   'Math/sqrt     (fn-of '(Float) 'Float)
   'Integer/parseInt   (fn-of '(String) 'Int)
   'Long/parseLong     (fn-of '(String) 'Int)
   'Double/parseDouble (fn-of '(String) 'Float)
   'System/getProperty       (fn-of '(String) 'String)
   'System/getenv            (type-fn (list (p 'String)) #f
                                      (type-union (list (p 'String) (p 'Nil))))
   'System/currentTimeMillis (fn-of '() 'Int)
   'System/exit              (fn-of '(Int) 'Nil)
   ;; --- Java interop: dynamic vars ----------------------------------------
   '*command-line-args* (type-app 'Vec (list (p 'String)))
   ;; =========================================================================
   ;; AUTO-GENERATED CLJ-specific entries from clojure.core metadata
   ;; =========================================================================
   'add-tap        (fn-of '(Any) 'Any)
   'remove-tap     (fn-of '(Any) 'Any)
   'tap>           (fn-of '(Any) 'Bool)
   'all-ns         (fn-of '() 'Any)
   'ancestors      (fn-of '(Any) 'Any #:rest 'Any)
   'descendants    (fn-of '(Any) 'Any #:rest 'Any)
   'parents        (fn-of '(Any) 'Any #:rest 'Any)
   'derive         (fn-of '(Any Any) 'Any #:rest 'Any)
   'underive       (fn-of '(Any Any) 'Any #:rest 'Any)
   'make-hierarchy (fn-of '() 'Any)
   'isa?           (fn-of '(Any Any) 'Bool #:rest 'Any)
   'aset-boolean   (fn-of '(Any Any Any) 'Any #:rest 'Any)
   'aset-byte      (fn-of '(Any Any Any) 'Any #:rest 'Any)
   'aset-char      (fn-of '(Any Any Any) 'Any #:rest 'Any)
   'aset-double    (fn-of '(Any Any Any) 'Any #:rest 'Any)
   'aset-float     (fn-of '(Any Any Any) 'Any #:rest 'Any)
   'aset-int       (fn-of '(Any Any Any) 'Any #:rest 'Any)
   'aset-long      (fn-of '(Any Any Any) 'Any #:rest 'Any)
   'aset-short     (fn-of '(Any Any Any) 'Any #:rest 'Any)
   'assoc!         (fn-of '(Any Any Any) 'Any #:rest 'Any)
   'conj!          (fn-of '() 'Any #:rest 'Any)
   'disj!          (fn-of '(Any Any) 'Any #:rest 'Any)
   'dissoc!        (fn-of '(Any Any) 'Any #:rest 'Any)
   'persistent!    (fn-of '(Any) 'Any)
   'pop!           (fn-of '(Any) 'Any)
   'transient      (fn-of '(Any) 'Any)
   'bean           (fn-of '(Any) 'Any)
   'binding-conveyor-fn (fn-of '(Any) 'Any)
   'boolean-array  (fn-of '(Any) 'Any #:rest 'Any)
   'booleans       (fn-of '(Any) 'Any)
   'byte-array     (fn-of '(Any) 'Any #:rest 'Any)
   'bytes          (fn-of '(Any) 'Any)
   'char-array     (fn-of '(Any) 'Any #:rest 'Any)
   'chars          (fn-of '(Any) 'Any)
   'double-array   (fn-of '(Any) 'Any #:rest 'Any)
   'doubles        (fn-of '(Any) 'Any)
   'float-array    (fn-of '(Any) 'Any #:rest 'Any)
   'floats         (fn-of '(Any) 'Any)
   'int-array      (fn-of '(Any) 'Any #:rest 'Any)
   'ints           (fn-of '(Any) 'Any)
   'long-array     (fn-of '(Any) 'Any #:rest 'Any)
   'longs          (fn-of '(Any) 'Any)
   'object-array   (fn-of '(Any) 'Any)
   'short-array    (fn-of '(Any) 'Any #:rest 'Any)
   'shorts         (fn-of '(Any) 'Any)
   'chunk          (fn-of '(Any) 'Any)
   'chunk-append   (fn-of '(Any Any) 'Any)
   'chunk-buffer   (fn-of '(Any) 'Any)
   'chunk-cons     (fn-of '(Any Any) 'Any)
   'chunk-first    (fn-of '(Any) 'Any)
   'chunk-next     (fn-of '(Any) 'Any)
   'chunk-rest     (fn-of '(Any) 'Any)
   'chunked-seq?   (fn-of '(Any) 'Bool)
   'clojure-version (fn-of '() 'String)
   'delay?         (fn-of '(Any) 'Bool)
   'destructure    (fn-of '(Any) 'Any #:rest 'Any)
   'enumeration-seq (fn-of '(Any) 'Any)
   'extend         (fn-of '(Any) 'Any #:rest 'Any)
   'file-seq       (fn-of '(Any) 'Any)
   'find-var       (fn-of '(Any) 'Any)
   'future-call    (fn-of '(Any) 'Any)
   'future-cancel  (fn-of '(Any) 'Any)
   'future-cancelled? (fn-of '(Any) 'Bool)
   'future-done?   (fn-of '(Any) 'Bool)
   'future?        (fn-of '(Any) 'Bool)
   'get-method     (fn-of '(Any Any) 'Any)
   'prefer-method  (fn-of '(Any Any Any) 'Any)
   'prefers        (fn-of '(Any) 'Any)
   'remove-all-methods (fn-of '(Any) 'Any)
   'remove-method  (fn-of '(Any Any) 'Any)
   'methods        (fn-of '(Any) 'Any)
   'hash-combine   (fn-of '(Int Any) 'Int)
   'hash-ordered-coll (fn-of '(Any) 'Int)
   'hash-unordered-coll (fn-of '(Any) 'Int)
   'iterator-seq   (fn-of '(Any) 'Any)
   'line-seq       (fn-of '(Any) 'Any)
   'munge          (fn-of '(Any) 'Any)
   'namespace-munge (fn-of '(Any) 'Any)
   'print-simple   (fn-of '(Any Any) 'Any)
   're-matcher     (fn-of '(Any Any) 'Any)
   'reader-conditional (fn-of '(Any Any) 'Any)
   'reader-conditional? (fn-of '(Any) 'Bool)
   'requiring-resolve (fn-of '(Any) 'Any)
   'reset-meta!    (fn-of '(Any Any) 'Any)
   'reset-vals!    (fn-of '(Any Any) 'Any)
   'swap-vals!     (fn-of '(Any Any Any Any) 'Any #:rest 'Any)
   'seq-to-map-for-destructuring (fn-of '(Any) 'Any)
   'stream-into!   (fn-of '(Any Any) 'Any #:rest 'Any)
   'stream-reduce! (fn-of '(Any Any) 'Any #:rest 'Any)
   'stream-seq!    (fn-of '(Any) 'Any)
   'stream-transduce! (fn-of '(Any Any Any) 'Any #:rest 'Any)
   'test           (fn-of '(Any) 'Any)
   'to-array-2d    (fn-of '(Any) 'Any)
   'unchecked-add  (fn-of '(Any Any) 'Any)
   'unchecked-add-int (fn-of '(Any Any) 'Any)
   'unchecked-byte (fn-of '(Any) 'Any)
   'unchecked-char (fn-of '(Any) 'Any)
   'unchecked-dec  (fn-of '(Any) 'Any)
   'unchecked-dec-int (fn-of '(Any) 'Any)
   'unchecked-divide-int (fn-of '(Any Any) 'Any)
   'unchecked-double (fn-of '(Any) 'Any)
   'unchecked-float (fn-of '(Any) 'Any)
   'unchecked-get  (fn-of '(Any Any) 'Any)
   'unchecked-set  (fn-of '(Any Any Any) 'Any)
   'unchecked-inc  (fn-of '(Any) 'Any)
   'unchecked-inc-int (fn-of '(Any) 'Any)
   'unchecked-int  (fn-of '(Any) 'Any)
   'unchecked-long (fn-of '(Any) 'Any)
   'unchecked-multiply (fn-of '(Any Any) 'Any)
   'unchecked-multiply-int (fn-of '(Any Any) 'Any)
   'unchecked-negate (fn-of '(Any) 'Any)
   'unchecked-negate-int (fn-of '(Any) 'Any)
   'unchecked-remainder-int (fn-of '(Any Any) 'Any)
   'unchecked-short (fn-of '(Any) 'Any)
   'unchecked-subtract (fn-of '(Any Any) 'Any)
   'unchecked-subtract-int (fn-of '(Any Any) 'Any)
   'var?           (fn-of '(Any) 'Bool)
   'volatile?      (fn-of '(Any) 'Bool)
   'xml-seq        (fn-of '(Any) 'Any)

   ;; === 2026-06-12 signature deepening (clj-table overrides) ===============
   ;; Overrides of Any-heavy PORTABLE entries — placed here so the portable
   ;; table (and therefore the nix corpus) is untouched. Two families:
   ;; 1. Nullable-honest returns — usable now that nil-narrowing flows
   ;;    through guards; unguarded use in a non-nil position is a compile
   ;;    error pointing at the missing guard.
   ;; 2. Vec element flow via poly — (first (str/split s #",")) : String.
   ;;    Deliberately NOT nullable: first-of-empty returning nil stays the
   ;;    accepted Clojure prior in v0 (the honest (U A Nil) would flood
   ;;    every call site with guards for marginal gain).
   'parse-long    (type-fn (list (p 'String)) #f
                           (type-union (list (p 'Int) (p 'Nil))))
   'parse-double  (type-fn (list (p 'String)) #f
                           (type-union (list (p 'Float) (p 'Nil))))
   'parse-boolean (type-fn (list (p 'String)) #f
                           (type-union (list (p 'Bool) (p 'Nil))))
   'first  (poly-fn '(A) (list (type-app 'Vec (list (tv 'A)))) (tv 'A))
   'second (poly-fn '(A) (list (type-app 'Vec (list (tv 'A)))) (tv 'A))
   'last   (poly-fn '(A) (list (type-app 'Vec (list (tv 'A)))) (tv 'A))
   'peek   (poly-fn '(A) (list (type-app 'Vec (list (tv 'A)))) (tv 'A))
   'nth    (poly-fn '(A) (list (type-app 'Vec (list (tv 'A))) (p 'Int)) (tv 'A)
                    #:rest (p 'Any))
   'reverse  (poly-fn '(A) (list (type-app 'Vec (list (tv 'A))))
                      (type-app 'Vec (list (tv 'A))))
   'distinct (poly-fn '(A) (list (type-app 'Vec (list (tv 'A))))
                      (type-app 'Vec (list (tv 'A))))
   'shuffle  (poly-fn '(A) (list (type-app 'Vec (list (tv 'A))))
                      (type-app 'Vec (list (tv 'A))))
   'subvec   (poly-fn '(A) (list (type-app 'Vec (list (tv 'A))) (p 'Int))
                      (type-app 'Vec (list (tv 'A))) #:rest (p 'Int))
   'keys (poly-fn '(K V) (list (type-app 'Map (list (tv 'K) (tv 'V))))
                  (type-app 'Vec (list (tv 'K))))
   'vals (poly-fn '(K V) (list (type-app 'Map (list (tv 'K) (tv 'V))))
                  (type-app 'Vec (list (tv 'V))))
   ;; G2 — (Atom T) parametric (clj overrides the Any-typed portable atom family).
   ;; Atom is INVARIANT (types.rkt), so the element flows precisely + soundly:
   ;; deref reads A; reset!/swap! ENFORCE that what's written stays A.
   'atom   (poly-fn '(A) (list (tv 'A)) (type-app 'Atom (list (tv 'A))))
   'deref  (poly-fn '(A) (list (type-app 'Atom (list (tv 'A)))) (tv 'A))
   'reset! (poly-fn '(A) (list (type-app 'Atom (list (tv 'A))) (tv 'A)) (tv 'A))
   ;; swap! is variadic — (swap! a f & args) = (apply f @a args). The fn must RETURN A
   ;; (the soundness wall: a wrong-returning fn would poison the cell). Beagle's fn-compat
   ;; rejects a fn that REQUIRES more fixed args than the slot, so accept a UNION of
   ;; leading-A fixed-arity shapes (each returning A) to cover (swap! ctx update :k v).
   'swap!  (poly-fn '(A)
                    (list (type-app 'Atom (list (tv 'A)))
                          (type-union (list (type-fn (list (tv 'A)) #f (tv 'A))
                                            (type-fn (list (tv 'A) (p 'Any)) #f (tv 'A))
                                            (type-fn (list (tv 'A) (p 'Any) (p 'Any)) #f (tv 'A))
                                            (type-fn (list (tv 'A) (p 'Any) (p 'Any) (p 'Any)) #f (tv 'A)))))
                    (tv 'A) #:rest (p 'Any))
   ))

;; CLJ entries unavailable when targeting CLJS.
;; (Renamed from CLJS-EXCLUDE — the set lives with the CLJ catalog it describes.)
(define CLJ-EXCLUDE
  (set
   ;; Java instance methods
   '.getMessage '.getCause '.getClass '.hashCode '.equals '.compareTo
   '.indexOf '.lastIndexOf '.charAt '.substring '.replace '.replaceAll
   '.replaceFirst '.matches '.split '.isEmpty '.toCharArray '.getBytes
   '.intern '.format '.size '.get '.put '.add '.remove '.clear
   '.containsKey '.containsValue '.keySet '.values '.entrySet
   '.iterator '.hasNext '.next
   '.exists '.toString '.length '.trim '.startsWith '.endsWith
   '.contains '.toLowerCase '.toUpperCase
   '.getPath '.getName '.getParent '.getParentFile '.mkdirs '.mkdir
   '.isDirectory '.isFile '.delete '.canRead '.canWrite '.lastModified
   '.toPath '.close
   ;; Java static methods
   'System/getProperty 'System/getenv 'System/exit 'System/currentTimeMillis
   'System/nanoTime
   'Math/abs 'Math/floor 'Math/ceil 'Math/round 'Math/max 'Math/min
   'Math/pow 'Math/sqrt 'Math/random 'Math/log 'Math/sin 'Math/cos
   'Math/tan 'Math/PI 'Math/E
   'Integer/parseInt 'Integer/valueOf 'Integer/MAX_VALUE 'Integer/MIN_VALUE
   'Long/parseLong 'Long/valueOf 'Long/MAX_VALUE 'Long/MIN_VALUE
   'Double/parseDouble 'Double/valueOf 'Double/NaN 'Double/POSITIVE_INFINITY
   'Double/NEGATIVE_INFINITY 'Double/isNaN 'Double/isInfinite
   'Float/parseFloat 'Float/valueOf
   'Boolean/parseBoolean 'Boolean/valueOf
   'String/format 'String/valueOf 'String/join
   'Character/isDigit 'Character/isLetter 'Character/isWhitespace
   'Class/forName
   'Thread/sleep 'Thread/currentThread
   'Runtime/getRuntime
   'UUID/randomUUID 'UUID/fromString
   ;; JVM dynamic vars
   '*command-line-args*
   ;; JVM-only core functions
   'slurp 'spit 'bean 'class 'supers 'bases 'ancestors 'parents
   'future 'future-call 'future-cancel 'future-cancelled? 'future-done? 'future?
   'promise 'deliver 'realized?
   'agent 'send 'send-off 'await 'shutdown-agents
   ;; clojure.repl: REPL/JVM-only — no CLJS port
   'clojure.repl/doc 'clojure.repl/source 'clojure.repl/dir 'clojure.repl/pst
   'clojure.repl/apropos 'clojure.repl/find-doc 'clojure.repl/demunge
   ;; clojure.zip: `clojure.zip` ns is JVM-only —
   ;; excluded to surface ns mismatches at type time
   'clojure.zip/zipper 'clojure.zip/seq-zip 'clojure.zip/vector-zip 'clojure.zip/xml-zip
   'clojure.zip/node 'clojure.zip/branch? 'clojure.zip/children 'clojure.zip/make-node
   'clojure.zip/path 'clojure.zip/lefts 'clojure.zip/rights
   'clojure.zip/down 'clojure.zip/up 'clojure.zip/root
   'clojure.zip/right 'clojure.zip/rightmost 'clojure.zip/left 'clojure.zip/leftmost
   'clojure.zip/insert-left 'clojure.zip/insert-right
   'clojure.zip/replace 'clojure.zip/edit
   'clojure.zip/insert-child 'clojure.zip/append-child
   'clojure.zip/next 'clojure.zip/prev 'clojure.zip/end? 'clojure.zip/remove))

(provide STDLIB-CLJ CLJ-EXCLUDE)
