defprecated
defprecated copied to clipboard
IntelliJ IDEA + Cursive complain
When I define a "defprecated" function IntelliJ doesn't like it very much and says the name of the function cannot be resolved:
(ns some.namespace
(:require [defprecated.core :as depr]))
(depr/defn foo [x]
x)
Is this a flaw in the implementation of defprecated or a bug in IntelliJ or Cursive?
System info
Clojure 1.9 IntelliJ IDEA 2018.2.4 (Ultimate Edition) Build #IU-182.4505.22, built on September 18, 2018 JRE: 1.8.0_152-release-1248-b8 x86_64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o macOS 10.13.6 Cursive 1.7.0-2018.2
Hi Max, it's probably because Cursive can't understand that depr/defn
is a macro that defines the function. I don't know what logic it uses for that.
Can you still compile the function? Does it still work?
Thanks for the quick response!
Yes, it still works.
I've asked the question on Reddit as well and there people explained that it's not a flaw in the library and also not really the IDE's fault.
Here's how you can fix it: https://cursive-ide.com/userguide/macros.html. Maybe it's worth it to add this to the README? :)