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

paredit/slurp-forward-fully throws when slurping into an empty seq that is last item with a seq #335

Closed
lread opened this issue Feb 5, 2025 · 0 comments · Fixed by #359

Comments

@lread
Copy link
Collaborator

lread commented Feb 5, 2025

Version
1.1.49

Platform
All

Symptom
paredit/slurp-forward-fully throws when slurping into an empty seq that is the last item within a seq

Reproduction

(def zloc (-> "[[1 []] 3 4]"
              z/of-string
              z/down
              z/down
              z/rightmost))

;; double-check we are where we think we are
(z/string zloc)
;; => "[]"

(-> zloc
    pe/slurp-forward-fully
    z/root-string)

Actual behavior

;; => Execution error (NullPointerException) at rewrite-clj.paredit/slurp-forward-fully (paredit.cljc:265).
;;    Cannot invoke "Object.getClass()" because "x" is null

Expected behavior

[[1 [3 4]]]

(and we should be located at node 3)

Diagnosis
Working on it.

Action
Working on it.

lread added a commit that referenced this issue Feb 18, 2025
Because of #256, slurp fns had to be rewritten. During rewriting:

- address design flaw by deprecating existing `slurp` fns and adding
replacement `slurp-`*`-into` fns (closes #339)
- stop adding space char when preserving slurped newlines (closes #345)
- review ambiguous `-slurp-`*-`fully` fn behaviour (closes #341)
- when slurping, don't consider a node with `#_` uneval nodes
empty (closes #338)
- don't throw on rewrite-clj parseable but invalid clojure
`{:a}` (closes #336)
- slurping forward fully no longer throws when slurping into an empty
seq that is last item in a seq (closes #335)
- slurping backward at empty-seq at start of seq no longer
throws (closes #334)
- slurp forward now slurps when at empty-seq at end of seq (closes #333)
@lread lread closed this as completed in 3954f58 Feb 18, 2025
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

Successfully merging a pull request may close this issue.

1 participant