-
-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
satisfies? fails to find protocols that don't have methods #785
Comments
There's some discrepancy between what I see in SCI and the behavior in babashka: (sci/eval-string "
(defprotocol Marker)
(extend-type String Marker)
(satisfies? Marker \"\")
" {:classes '{java.lang.String java.lang.String} })
;; => true However, running in
If I elide the |
@lilactown Good find! I'm going to take a look |
@lilactown It has to do with how imports work. This is how it's configured in bb: (sci/eval-string "
(defprotocol Marker)
(extend-type String Marker)
(satisfies? Marker \"\")
" {:classes {'java.lang.String java.lang.String} :imports {'String 'java.lang.String}})
false |
I'll see if I can begin to understand how the classes/imports stuff works |
So guess what, I did have a test for this (clj only): #?(:clj (is (true? (sci/binding [sci/out *out*](sci/eval-string "
(defprotocol Marker)
(extend-type java.lang.Long Marker)
(satisfies? Marker 1)
" {:classes '{java.lang.Long java.lang.Long}}))))) but there is a mistake in the test: the classes config should be |
So we should fix that test and then update the implementation accordingly. |
@lilactown Whoops, after I merged #786, I noticed that some tests with babashka + schema.core are failing. Need to investigate why, for now I reverted the entire commit on master but pushed both SCI and bb branches named |
Could have been just a local thing, I'm running it in CI here now: https://app.circleci.com/pipelines/github/babashka/babashka?branch=satisfies-marker Will check back tomorrow. |
OK, all fine on CI. |
version
0.3.32 and main
platform
macOS 12.4 / Nodejs v18.3 / Clojure 1.11
problem
satisfies?
does not return true for protocols that have not methods.repro
in Clojure:
in ClojureScript:
expected behavior
The above snippets should return
true
.actual behavior
They return false.
The text was updated successfully, but these errors were encountered: