tools.nrepl

Middleware linearizes wrong with redundant :expects entries

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Duplicate
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

Consider the following:

(def wrap-foo identity)
(mid/set-descriptor! #'wrap-foo
                     ;; note that these two entries are redundant since
                     ;; the session middleware implements "clone"
                     {:expects #{#'clojure.tools.nrepl.middleware.session/session "clone"}})

;; this one returns correctly
(mid/linearize-middleware-stack [#'wrap-foo
                                 #'clojure.tools.nrepl.middleware.session/session])
;; => (#'clojure.tools.nrepl.middleware.session/session
       #'user/wrap-foo)


;; this one returns incorrectly -- note that by adding a presumably
;; unrelated extra middleware to the stack, session and wrap-foo have
;; switched their order relative to each other.
(mid/linearize-middleware-stack [#'wrap-foo
                                 #'cider.nrepl.middleware.stacktrace/wrap-stacktrace
                                 #'clojure.tools.nrepl.middleware.session/session])
;; => (#'user/wrap-foo
       #'clojure.tools.nrepl.middleware.pr-values/pr-values
       #'cider.nrepl.middleware.stacktrace/wrap-stacktrace
       #'clojure.tools.nrepl.middleware.session/session)

Activity

Hide
Gary Fredericks added a comment -

I'm going to close this since I think NREPL-53 gets more to the root of the matter.

Show
Gary Fredericks added a comment - I'm going to close this since I think NREPL-53 gets more to the root of the matter.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: