Skip to content

cider-load-buffer fails to parse namespaced keywords on a narrowed buffer #2676

@glittershark

Description

@glittershark

Expected behavior

  1. M-x narrow-to-defun (or similar narrowing command)
  2. M-x cider-load-buffer

Loads the code from the (non-narrowed) buffer

Actual behavior

2. Unhandled clojure.lang.Compiler$CompilerException
   Error compiling /path/to/my-clojure-file.clj at (8:0)
   #:clojure.error{:phase :read-source,
                   :line 8,
                   :column 0,
                   :source
                   "/path/to/my-clojure-file.clj"}
             Compiler.java: 7642  clojure.lang.Compiler/load
                      REPL:    1  com.gfredericks.test.chuck.generators/eval3043503
                      REPL:    1  com.gfredericks.test.chuck.generators/eval3043503
             Compiler.java: 7176  clojure.lang.Compiler/eval
             Compiler.java: 7131  clojure.lang.Compiler/eval
                  core.clj: 3214  clojure.core/eval
                  core.clj: 3210  clojure.core/eval
                  main.clj:  414  clojure.main/repl/read-eval-print/fn
                  main.clj:  414  clojure.main/repl/read-eval-print
                  main.clj:  435  clojure.main/repl/fn
                  main.clj:  435  clojure.main/repl
                  main.clj:  345  clojure.main/repl
               RestFn.java:  137  clojure.lang.RestFn/applyTo
                  core.clj:  665  clojure.core/apply
                  core.clj:  660  clojure.core/apply
                regrow.clj:   18  refactor-nrepl.ns.slam.hound.regrow/wrap-clojure-repl/fn
               RestFn.java: 1523  clojure.lang.RestFn/invoke
    interruptible_eval.clj:   79  nrepl.middleware.interruptible-eval/evaluate
    interruptible_eval.clj:   55  nrepl.middleware.interruptible-eval/evaluate
    interruptible_eval.clj:  142  nrepl.middleware.interruptible-eval/interruptible-eval/fn/fn
                  AFn.java:   22  clojure.lang.AFn/run
               session.clj:  171  nrepl.middleware.session/session-exec/main-loop/fn
               session.clj:  170  nrepl.middleware.session/session-exec/main-loop
                  AFn.java:   22  clojure.lang.AFn/run
               Thread.java:  748  java.lang.Thread/run

1. Caused by java.lang.RuntimeException
   Invalid token: ::some-namespaced/keyword-in-the-buffer

Steps to reproduce the problem

My buffer has aliased namespaces and namespaced keywords using those aliases, eg:

(ns my-clojure-file
  (:require [some-other.namespace :as [some-namespaced]]))

(defn foo []
  ::some-namespaced/keyword-in-the-buffer)

Environment & Version information

CIDER version information

;; CIDER 0.22.0snapshot (package: 20190711.1657), nREPL 0.6.0
;; Clojure 1.10.0, Java 1.8.0_222

Emacs version

GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.3) of 2019-02-12

Operating system

Arch Linux 5.2.0-arch2-1-ARCH

Metadata

Metadata

Assignees

No one assigned

    Labels

    buggood first issueA simple tasks suitable for first-time contributors

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions