Skip to content

Instantly share code, notes, and snippets.

@wagjo
Last active January 2, 2016 10:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wagjo/8290237 to your computer and use it in GitHub Desktop.
Save wagjo/8290237 to your computer and use it in GitHub Desktop.
Bug in nrepl?
;; AOT before loading (e.g. with :aot :all in project.clj)
;; $ lein deps :tree
;; [clojure-complete "0.2.3" :exclusions [[org.clojure/clojure]]]
;; [org.clojure/clojure "1.5.1"]
;; [org.clojure/tools.nrepl "0.2.3" :exclusions [[org.clojure/clojure]]]
(ns ccc.core
(:gen-class))
(defprotocol P)
(assert (identical? (:on-interface P) ccc.core.P))
;; protocol definition inside a function
;; used e.g. in clojure.core.typed/defprotocol>
(identity (defprotocol P2))
(defn -main
[& args]
;; using nrepl, following bug appears
;; false false true false
(println (identical? (:on-interface P2) ccc.core.P2)
(satisfies? P2 (reify P2))
(instance? ccc.core.P2 (reify P2))
(instance? (:on-interface P2) (reify P2)))
;; workaround
(alter-var-root #'P2 assoc :on-interface ccc.core.P2)
;; true true true true
(println (identical? (:on-interface P2) ccc.core.P2)
(satisfies? P2 (reify P2))
(instance? ccc.core.P2 (reify P2))
(instance? (:on-interface P2) (reify P2)))
(println "DONE"))
(comment
;; eval in emacs to produce bug, e.g. C-c C-k, C-x C-e
(-main)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment