Giter Site home page Giter Site logo

ClassCastException about kibit HOT 7 CLOSED

clj-commons avatar clj-commons commented on July 28, 2024
ClassCastException

from kibit.

Comments (7)

jonase avatar jonase commented on July 28, 2024

Hi, and thanks for the report!

Kibit fails when trying to analyze this line. Similar, but simpler, expressions will also fail:

(use 'jonase.kibit.core)
(def rule '[(apply str (interpose ?x ?y)) (clojure.string/join ?x ?y)])
(def expr '(apply str (interpose " " #{(:tag attr-val)})))
(unify expr rule)

(def rule2 '[(do ?x) ?x])
(def expr2 '(do #{1}))
(unify expr2 rule2)

both attempts to use jonase.kibit.core/unify above results in a ClassCastException.

The problem seems to be core.logic and (non-empty) literal sets as seen below:

user=> (use 'clojure.core.logic)
nilWARNING: == already refers to: #'clojure.core/== in namespace: user, being replaced by: #'clojure.core.logic/==

user=> (unifier '(?x) '(#{}))
({}) ;; Note, not (#{})!
user=> (unifier '(?x) '(#{1}))
IllegalArgumentException Don't know how to create ISeq from: java.lang.Long  clojure.lang.RT.seqFrom (RT.java:487)

user=> (unifier '(?x) '([]))
([])
user=> (unifier '(?x) '([1]))
([1])

I'll have to ask @swannodette for help about this issue.

Edit: Also, at a lower level:

user=> (run* [q] (== q #{1}))
IllegalArgumentException Don't know how to create ISeq from: java.lang.Long  clojure.lang.RT.seqFrom (RT.java:487)

user=> (run* [q] (== q #{}))
({})

from kibit.

semperos avatar semperos commented on July 28, 2024

Understood; thanks for investigating this further. Interested to see what @swannodette has to say.

from kibit.

swannodette avatar swannodette commented on July 28, 2024

Noted, http://dev.clojure.org/jira/browse/LOGIC-32

Will look into it.

from kibit.

swannodette avatar swannodette commented on July 28, 2024

Was a bug in how core.logic dealt with sets. Fixed in 0.6.8.

from kibit.

semperos avatar semperos commented on July 28, 2024

Thanks @swannodette .

@jonase looking forward to another release of Kibit to include core.logic 0.6.8. Until then, lein install it is.

from kibit.

semperos avatar semperos commented on July 28, 2024

I can confirm that for the most recent version of my code base completes fine after bumping core.logic to 0.6.8, and that the two tests in kibit pass as well.

from kibit.

jonase avatar jonase commented on July 28, 2024

I updated kibit to core.logic 0.6.8 -- thanks @swannodette

from kibit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.