Skip to content

Can't instrument very large case statements #2335

Open
@lvh

Description

@lvh

Expected behavior

Function with #dbg is correctly instrumented

Actual behavior

2. Unhandled clojure.lang.Compiler$CompilerException
   Error compiling src/xyzzy/core.clj at (3:1)

1. Caused by java.lang.NegativeArraySizeException
   (No message)

Steps to reproduce the problem

Compile following function:

(defn x
  []
  #dbg ^{:break/when true}
  (case :a
    (:a-0 :b-0) 0
    (:a-1 :b-1) 1
    (:a-2 :b-2) 2
    (:a-3 :b-3) 3
    (:a-4 :b-4) 4
    (:a-5 :b-5) 5
    (:a-6 :b-6) 6
    (:a-7 :b-7) 7
    (:a-8 :b-8) 8
    (:a-9 :b-9) 9
    (:a-10 :b-10) 10
    (:a-11 :b-11) 11
    (:a-12 :b-12) 12
    (:a-13 :b-13) 13
    (:a-14 :b-14) 14
    (:a-15 :b-15) 15
    (:a-16 :b-16) 16
    (:a-17 :b-17) 17
    (:a-18 :b-18) 18
    (:a-19 :b-19) 19
    (:a-20 :b-20) 20
    (:a-21 :b-21) 21
    (:a-22 :b-22) 22
    (:a-23 :b-23) 23
    (:a-24 :b-24) 24
    (:a-25 :b-25) 25
    (:a-26 :b-26) 26
    (:a-27 :b-27) 27
    (:a-28 :b-28) 28
    (:a-29 :b-29) 29
    (:a-30 :b-30) 30
    (:a-31 :b-31) 31
    (:a-32 :b-32) 32
    (:a-33 :b-33) 33
    (:a-34 :b-34) 34
    (:a-35 :b-35) 35
    (:a-36 :b-36) 36
    (:a-37 :b-37) 37
    (:a-38 :b-38) 38
    (:a-39 :b-39) 39
    (:a-40 :b-40) 40
    (:a-41 :b-41) 41
    (:a-42 :b-42) 42
    (:a-43 :b-43) 43))

This was created with:

(apply list 'case :a (mapcat (fn [i] [(list (keyword (str "a-" i)) (keyword (str "b-" i))) i]) (range 44)))

Extra info

This may be a bug in clojure.tools.macro or at least have a similar cause to this bug in clojure.tools.macro: https://groups.google.com/forum/#!topic/clojure/HdmkjLcyqWQ

Environment & Version information

CIDER version information

Include here the version string displayed when
CIDER's REPL is launched. Here's an example:

;; CIDER 0.18.0-snapshot, nREPL 0.2.13
;; Clojure 1.9.0, Java 1.8.0_171

Lein/Boot version

Leiningen 2.8.1 on Java 1.8.0_171 OpenJDK 64-Bit Server VM

Emacs version

  • Emacs: 26.1
  • Spacemacs: 0.200.13
  • Spacemacs branch: master (rev. c7a103a77)
  • Graphic display: t

Operating system

Fedora 28

Metadata

Metadata

Assignees

Labels

bugdebuggerpinnedTickets immune to staleness checks

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions