Skip to content

Commit dd665cf

Browse files
committed
Fix for fn? and ifn?
Signed-off-by: James Hamlin <jfhamlin@gmail.com>
1 parent d1a2786 commit dd665cf

File tree

3 files changed

+73
-48
lines changed

3 files changed

+73
-48
lines changed

pkg/stdlib/clojure/core.glj

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -656,15 +656,15 @@
656656
"Applies fn f to the argument list formed by prepending intervening arguments to args."
657657
{:added "1.0"
658658
:static true}
659-
([^clojure.lang.IFn f args]
659+
([^github.com:glojurelang:glojure:pkg:lang.IFn f args]
660660
(github.com:glojurelang:glojure:pkg:lang.Apply f (seq args)))
661-
([^clojure.lang.IFn f x args]
661+
([^github.com:glojurelang:glojure:pkg:lang.IFn f x args]
662662
(github.com:glojurelang:glojure:pkg:lang.Apply f (list* x args)))
663-
([^clojure.lang.IFn f x y args]
663+
([^github.com:glojurelang:glojure:pkg:lang.IFn f x y args]
664664
(github.com:glojurelang:glojure:pkg:lang.Apply f (list* x y args)))
665-
([^clojure.lang.IFn f x y z args]
665+
([^github.com:glojurelang:glojure:pkg:lang.IFn f x y z args]
666666
(github.com:glojurelang:glojure:pkg:lang.Apply f (list* x y z args)))
667-
([^clojure.lang.IFn f a b c d & args]
667+
([^github.com:glojurelang:glojure:pkg:lang.IFn f a b c d & args]
668668
(github.com:glojurelang:glojure:pkg:lang.Apply f (cons a (cons b (cons c (cons d (spread args))))))))
669669

670670
(defn vary-meta
@@ -6203,13 +6203,13 @@ fails, attempts to require sym's namespace and retries."
62036203
(e.g. sets and maps) implement IFn"
62046204
{:added "1.0"
62056205
:static true}
6206-
[x] (instance? clojure.lang.IFn x))
6206+
[x] (instance? github.com:glojurelang:glojure:pkg:lang.IFn x))
62076207

62086208
(defn fn?
62096209
"Returns true if x implements Fn, i.e. is an object created via fn."
62106210
{:added "1.0"
62116211
:static true}
6212-
[x] (instance? github.com:glojurelang:glojure:pkg:runtime.*Fn x))
6212+
[x] (or (instance? github.com:glojurelang:glojure:pkg:runtime.*Fn x) (instance? github.com:glojurelang:glojure:pkg:lang.IFn x)))
62136213

62146214

62156215
(defn associative?
@@ -7090,7 +7090,7 @@ fails, attempts to require sym's namespace and retries."
70907090
github.com:glojurelang:glojure:pkg:lang.IPending
70917091
(isRealized [this]
70927092
(zero? (.getCount d)))
7093-
clojure.lang.IFn
7093+
github.com:glojurelang:glojure:pkg:lang.IFn
70947094
(invoke
70957095
[this x]
70967096
(when (and (pos? (.getCount d))
@@ -7921,7 +7921,7 @@ fails, attempts to require sym's namespace and retries."
79217921
:added "1.11"}
79227922
^go/int64 [^go/string s]
79237923
(if (string? s)
7924-
(clojure.core/let [result__3646__auto__ (strconv.ParseInt s 10 64)] (if (result__3646__auto__ 1) nil (result__3646__auto__ 0)))
7924+
(clojure.core/let [result__3648__auto__ (strconv.ParseInt s 10 64)] (if (result__3648__auto__ 1) nil (result__3648__auto__ 0)))
79257925
(throw (github.com:glojurelang:glojure:pkg:lang.NewIllegalArgumentError (parsing-err s)))))
79267926

79277927
(defn parse-double
@@ -7932,7 +7932,7 @@ fails, attempts to require sym's namespace and retries."
79327932
:added "1.11"}
79337933
^go/float64 [^go/string s]
79347934
(if (string? s)
7935-
(clojure.core/let [result__3647__auto__ (strconv.ParseFloat s 64)] (if (result__3647__auto__ 1) nil (result__3647__auto__ 0)))
7935+
(clojure.core/let [result__3649__auto__ (strconv.ParseFloat s 64)] (if (result__3649__auto__ 1) nil (result__3649__auto__ 0)))
79367936
(throw (github.com:glojurelang:glojure:pkg:lang.NewIllegalArgumentError (parsing-err s)))))
79377937

79387938
(defn parse-uuid

pkg/stdlib/clojure/core/loader.go

Lines changed: 56 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/rewrite-core/rewrite.clj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,8 @@
263263

264264
(sexpr-replace 'clojure.lang.IReduce
265265
'github.com:glojurelang:glojure:pkg:lang.IReduce)
266+
(sexpr-replace 'clojure.lang.IFn
267+
'github.com:glojurelang:glojure:pkg:lang.IFn)
266268
(sexpr-replace 'clojure.lang.IPending
267269
'github.com:glojurelang:glojure:pkg:lang.IPending)
268270
(sexpr-replace 'clojure.lang.MultiFn
@@ -347,6 +349,11 @@
347349
'(fn instance? [t x] (github.com:glojurelang:glojure:pkg:lang.HasType t x)))
348350

349351

352+
;; Replace instance? checks for clojure.lang.Fn with OR expression checking both runtime.*Fn and IFn
353+
(sexpr-replace '(instance? clojure.lang.Fn x)
354+
'(or (instance? github.com:glojurelang:glojure:pkg:runtime.*Fn x)
355+
(instance? github.com:glojurelang:glojure:pkg:lang.IFn x)))
356+
350357
;; ===== Exception Handling =====
351358
(sexpr-replace 'Exception. 'github.com:glojurelang:glojure:pkg:lang.NewError)
352359

0 commit comments

Comments
 (0)