Git Product home page Git Product logo

Comments (4)

borkdude avatar borkdude commented on June 2, 2024

The issue (bug) is that metadata isn't properly preserved in the conversion to s-expressions and back:

(comment
  (def node (clj-kondo.impl.rewrite-clj.parser/parse-string "^Long foo"))
  (:meta node) ;; => :token Long
  (def sexpr (api/sexpr node)) ;; foo
  (meta sexpr)
  (def node2 (api/coerce sexpr))
  (:meta node2) ;;=> nil
  )

from clj-kondo.

borkdude avatar borkdude commented on June 2, 2024

Compare to the original rewrite-clj:

user=> (require '[rewrite-clj.parser :as p])
nil
user=> (p/parse-string "^Long foo")
<meta: ^Long foo>
user=> (def node (p/parse-string "^Long foo"))
#'user/node
user=> (require '[rewrite-clj.node :as n])
nil
user=> (n/sexpr n)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: n in this context, compiling:(NO_SOURCE_PATH:5:1)
user=> (n/sexpr node)
foo
user=> (meta (n/sexpr node))
{Long true}
user=> (n/coerce (n/sexpr node))
<meta: ^{Long true} foo>

from clj-kondo.

mrkam2 avatar mrkam2 commented on June 2, 2024

The issue (bug) is that metadata isn't properly preserved in the conversion to s-expressions and back:

Is this fixable for clj-kondo?

from clj-kondo.

borkdude avatar borkdude commented on June 2, 2024

I hope so. Haven't looked into it yet.

from clj-kondo.

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.