862862 " goog.isArrayLike;" " Java.type;" " Object.out;" " Object.out.println;"
863863 " Object.error;" " Object.error.println;" ])
864864
865- (defn infer-test-helper [{:keys [forms externs warnings warn with-core?]}]
866- (let [test-cenv (atom {::a/externs
867- (externs/externs-map
868- (closure/load-externs {:externs (or externs [])}))})
865+ (defn infer-test-helper [{:keys [forms externs warnings warn with-core? opts]}]
866+ (let [test-cenv (if with-core?
867+ (env/default-compiler-env
868+ (closure/add-externs-sources (merge {:infer-externs true } opts)))
869+ (atom
870+ {::a/externs
871+ (externs/externs-map
872+ (closure/load-externs {:externs (or externs [])}))}))
869873 wrap (if with-core?
870874 #(comp/with-core-cljs nil %)
871875 #(do (% )))]
875879 (e/with-compiler-env test-cenv
876880 (wrap
877881 (fn []
878- (binding [a/*cljs-warnings*
882+ (binding [a/*analyze-deps* true
883+ a/*cljs-warnings*
879884 (assoc a/*cljs-warnings*
880885 :infer-warning (if (nil? warn) true warn))]
881886 (a/analyze-form-seq forms))
10341039 :with-core? true })]
10351040 (is (string/includes? res " Thing.prototype.componentDidUpdate;" ))
10361041 (is (zero? (count @ws)))))
1042+
1043+ (comment
1044+
1045+ ; ; this includes compiled - don't want that
1046+ (deftest test-cljs-2392-broken-inferred-externs
1047+ (let [ws (atom [])
1048+ res (infer-test-helper
1049+ {:forms '[(ns cjls-1918.core
1050+ (:require [cljs.nodejscli]))]
1051+ :warnings ws
1052+ :with-core? true })]
1053+ (println res)
1054+ (is (zero? (count @ws)))))
1055+
1056+ (let [ws (atom [])
1057+ res (infer-test-helper
1058+ {:forms '[(ns cjls-1918.core
1059+ (:require [cljs.nodejscli]))]
1060+ :warnings ws
1061+ :with-core? true
1062+ :opts {:target :nodejs }
1063+ })]
1064+ (println res))
1065+
1066+ (-> @(env/default-compiler-env
1067+ (closure/add-externs-sources {:infer-externs true }))
1068+ (get-in [::a/externs ])
1069+ keys sort)
1070+
1071+ )
0 commit comments