Skip to content
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

Failures on qualified methods #457

Open
marksto opened this issue Oct 30, 2024 · 1 comment
Open

Failures on qualified methods #457

marksto opened this issue Oct 30, 2024 · 1 comment

Comments

@marksto
Copy link

marksto commented Oct 30, 2024

Description

Eastwood fails on occurences of a newly added Clojure 1.12 feature — the Qualified Methods support. I guess, this is due to the missing support for this feature in the underlying clojure.tools.analyzer.

Here I use Float/parseFloat as a function. If I change to #(Float/parseFloat %), the error goes away, as expected.

Environment

  • Eastwood 1.4.3
  • Clojure 1.12.0
  • JVM 21.0.2

Error logs

Exception thrown during phase :analyze+eval of linting namespace my-fluffy.cli
Got exception with extra ex-data:
    msg='Cannot find field parseFloat for class class java.lang.Float'
    (keys dat)=(:class :field :file :end-column :column :line :end-line)
ExceptionInfo Cannot find field parseFloat for class class java.lang.Float
        eastwood.copieddeps.dep2.clojure.tools.analyzer.passes.jvm.analyze-host-expr/analyze-host-field (analyze_host_expr.clj:73)
        eastwood.copieddeps.dep2.clojure.tools.analyzer.passes.jvm.analyze-host-expr/analyze-host-field (analyze_host_expr.clj:68)
        eastwood.copieddeps.dep2.clojure.tools.analyzer.passes.jvm.analyze-host-expr/analyze-host-expr (analyze_host_expr.clj:172)
        eastwood.copieddeps.dep2.clojure.tools.analyzer.passes.jvm.analyze-host-expr/analyze-host-expr (analyze_host_expr.clj:142)
        clojure.lang.Var.invoke (Var.java:386)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.passes/compile-passes/fn--428/fn--433 (passes.clj:167)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.passes/compile-passes/fn--428/fn--435 (passes.clj:169)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.passes/compile-passes/fn--428/fn--435 (passes.clj:169)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.passes/compile-passes/fn--428/fn--435 (passes.clj:169)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.passes/compile-passes/fn--428/fn--435 (passes.clj:169)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.passes/compile-passes/fn--428/fn--435 (passes.clj:169)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.passes/compile-passes/fn--428/fn--435 (passes.clj:169)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.passes/compile-passes/fn--428/fn--435 (passes.clj:169)
        clojure.core/partial/fn--5929 (core.clj:2648)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.ast/walk/walk--309 (ast.clj:102)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.ast/walk/walk--309/walk--310 (ast.clj:96)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.utils/mapv' (utils.clj:208)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.utils/mapv' (utils.clj:202)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.ast/-update-children/fn--298 (ast.clj:51)
        clojure.lang.PersistentVector.reduce (PersistentVector.java:418)
        clojure.core/reduce (core.clj:6964)
        clojure.core/reduce (core.clj:6947)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.ast/-update-children (ast.clj:49)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.ast/-update-children (ast.clj:46)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.ast/update-children-reduced (ast.clj:64)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.ast/update-children-reduced (ast.clj:58)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.ast/walk/walk--309 (ast.clj:99)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.ast/walk/walk--309/walk--310 (ast.clj:96)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.ast/-update-children/fn--298 (ast.clj:51)
        clojure.lang.PersistentVector.reduce (PersistentVector.java:418)
        clojure.core/reduce (core.clj:6964)
        clojure.core/reduce (core.clj:6947)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.ast/-update-children (ast.clj:49)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.ast/-update-children (ast.clj:46)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.ast/update-children-reduced (ast.clj:64)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.ast/update-children-reduced (ast.clj:58)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.ast/walk/walk--309 (ast.clj:99)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.ast/walk/walk--309/walk--310 (ast.clj:96)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.utils/mapv' (utils.clj:208)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.utils/mapv' (utils.clj:202)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.ast/-update-children/fn--298 (ast.clj:51)
        clojure.lang.PersistentVector.reduce (PersistentVector.java:418)
        clojure.core/reduce (core.clj:6964)
        clojure.core/reduce (core.clj:6947)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.ast/-update-children (ast.clj:49)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.ast/-update-children (ast.clj:46)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.ast/update-children-reduced (ast.clj:64)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.ast/update-children-reduced (ast.clj:58)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.ast/walk/walk--309 (ast.clj:99)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.ast/walk/walk--309/walk--310 (ast.clj:96)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.ast/-update-children/fn--298 (ast.clj:51)
        clojure.lang.PersistentVector.reduce (PersistentVector.java:418)
        clojure.core/reduce (core.clj:6964)
        clojure.core/reduce (core.clj:6947)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.ast/-update-children (ast.clj:49)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.ast/-update-children (ast.clj:46)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.ast/update-children-reduced (ast.clj:64)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.ast/update-children-reduced (ast.clj:58)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.ast/walk/walk--309 (ast.clj:99)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.ast/walk/walk--309/walk--310 (ast.clj:96)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.ast/-update-children/fn--298 (ast.clj:51)
        clojure.lang.PersistentVector.reduce (PersistentVector.java:418)
        clojure.core/reduce (core.clj:6964)
        clojure.core/reduce (core.clj:6947)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.ast/-update-children (ast.clj:49)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.ast/-update-children (ast.clj:46)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.ast/update-children-reduced (ast.clj:64)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.ast/update-children-reduced (ast.clj:58)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.ast/walk/walk--309 (ast.clj:99)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.ast/walk (ast.clj:95)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.ast/walk (ast.clj:84)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.ast/postwalk (ast.clj:115)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.ast/postwalk (ast.clj:110)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.ast/postwalk (ast.clj:113)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.ast/postwalk (ast.clj:110)
        eastwood.copieddeps.dep1.clojure.tools.analyzer.passes/compile-passes/analyze--440 (passes.clj:171)
        clojure.core/comp/fn--5895 (core.clj:2586)
        clojure.core/comp/fn--5895 (core.clj:2586)
        eastwood.analyze-ns/run-passes (analyze_ns.clj:205)
        eastwood.analyze-ns/run-passes (analyze_ns.clj:201)
        eastwood.copieddeps.dep2.clojure.tools.analyzer.jvm/analyze/fn--4299/fn--4301 (jvm.clj:521)
        eastwood.copieddeps.dep2.clojure.tools.analyzer.jvm/analyze/fn--4299 (jvm.clj:519)
        clojure.core/apply (core.clj:667)
        clojure.core/with-bindings* (core.clj:1990)
        clojure.core/with-bindings* (core.clj:1990)
        eastwood.copieddeps.dep2.clojure.tools.analyzer.jvm/analyze (jvm.clj:508)
        eastwood.copieddeps.dep2.clojure.tools.analyzer.jvm/analyze (jvm.clj:488)
        eastwood.copieddeps.dep2.clojure.tools.analyzer.jvm/analyze+eval (jvm.clj:584)
        eastwood.copieddeps.dep2.clojure.tools.analyzer.jvm/analyze+eval (jvm.clj:529)
        eastwood.lint/with-memoization-bindings*/fn--8249 (lint.clj:331)
        clojure.core/apply (core.clj:667)
        clojure.core/memoize/fn--6969 (core.clj:6424)
        eastwood.analyze-ns/analyze-file/fn--5252/fn--5257/fn--5259 (analyze_ns.clj:479)
        eastwood.analyze-ns/analyze-file/fn--5252/fn--5257 (analyze_ns.clj:475)
        eastwood.analyze-ns/analyze-file/fn--5252 (analyze_ns.clj:472)
        eastwood.analyze-ns/analyze-file (analyze_ns.clj:467)
        eastwood.analyze-ns/analyze-file (analyze_ns.clj:367)
        eastwood.analyze-ns/analyze-ns/fn--5309 (analyze_ns.clj:598)
        eastwood.analyze-ns/with-form-writers (analyze_ns.clj:103)
        eastwood.analyze-ns/with-form-writers (analyze_ns.clj:101)
        eastwood.analyze-ns/analyze-ns (analyze_ns.clj:586)
        eastwood.analyze-ns/analyze-ns (analyze_ns.clj:567)
        eastwood.lint/lint-ns/fn--8259 (lint.clj:375)
        eastwood.lint/with-memoization-bindings* (lint.clj:335)
        eastwood.lint/with-memoization-bindings* (lint.clj:322)
        eastwood.lint/lint-ns (lint.clj:350)
        eastwood.lint/lint-ns (lint.clj:344)
        eastwood.lint/lint-namespace (lint.clj:662)
        eastwood.lint/lint-namespace (lint.clj:660)
        eastwood.lint/eval8351/fn--8353/fn--8355 (lint.clj:685)
        clojure.lang.PersistentVector.reduce (PersistentVector.java:418)
        clojure.core/reduce (core.clj:6964)
        clojure.core/reduce (core.clj:6947)
        eastwood.lint/eval8351/fn--8353 (lint.clj:683)
        clojure.lang.MultiFn.invoke (MultiFn.java:252)
        eastwood.lint/eastwood-core (lint.clj:752)
        eastwood.lint/eastwood-core (lint.clj:705)
        eastwood.lint/eastwood/fn--8392 (lint.clj:877)
        eastwood.lint/with-memoization-bindings* (lint.clj:335)
        eastwood.lint/with-memoization-bindings* (lint.clj:322)
        eastwood.lint/eastwood (lint.clj:853)
        eastwood.lint/eastwood (lint.clj:848)
        eastwood.lint/eastwood (lint.clj:850)
        eastwood.lint/eastwood (lint.clj:848)
        eastwood.lint/eastwood-from-cmdline (lint.clj:889)
        eastwood.lint/eastwood-from-cmdline (lint.clj:888)
        eastwood.lint/-main (lint.clj:1019)
        eastwood.lint/-main (lint.clj:1003)
        clojure.lang.Var.applyTo (Var.java:707)
        clojure.core/apply (core.clj:667)
        clojure.main/main-opt (main.clj:515)
        clojure.main/main-opt (main.clj:511)
        clojure.main/main (main.clj:665)
        clojure.main/main (main.clj:617)
        clojure.lang.Var.applyTo (Var.java:707)
        clojure.main.main (main.java:40)


The following form was being processed during the exception:
(def
 cli-options-spec
 [...
  ["-s"
   "--sensitivity SENSITIVITY"
   "Search sensitivity in percent in range 0 (exclusive) — 100 (inclusive)."
   :default
   80.0
   :parse-fn
   Float/parseFloat
   :validate
   [(fn*
     [p1__22153#]
     (and (float? p1__22153#) (pos? p1__22153#) (<= p1__22153# 100)))
    "Must be a floating point number in the range (0 .. 100]."]]
  ...])


Shown again with metadata for debugging (some metadata elided for brevity):
^{:line 90}
(^{:line 90} def
 ^{:line 90} cli-options-spec
 ^{:line 91}
 [...
  ^{:line 97}
  ["-s"
   "--sensitivity SENSITIVITY"
   "Search sensitivity in percent in range 0 (exclusive) — 100 (inclusive)."
   :default
   80.0
   :parse-fn
   ^{:line 100} Float/parseFloat
   :validate
   ^{:line 101}
   [(fn*
     [p1__22153#]
     ^{:line 101}
     (^{:line 101} and
      ^{:line 101} (^{:line 101} float? p1__22153#)
      ^{:line 101} (^{:line 101} pos? p1__22153#)
      ^{:line 101} (^{:line 101} <= p1__22153# 100)))
    "Must be a floating point number in the range (0 .. 100]."]]
  ...])
marksto added a commit to marksto/space-invaders-detector that referenced this issue Oct 30, 2024
Reverted the qualified methods uses due to jonase/eastwood#457
@vemv
Copy link
Collaborator

vemv commented Oct 31, 2024

I don't have much time to work on OSS or Eastwood these days, so a Clojure 1.12 compat thing won't happen unless someone makes it

https://clojurians.slack.com/archives/CAGC51YQ7/p1726689065711309

In better news, it looks like tools.analyzer finally is being worked on again, without that core dependency there's not much we can do to begin with

Cheers - V

@vemv vemv pinned this issue Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants