2017-10-10 14:50:47 +03:00
|
|
|
;; This file contains examples of unsolved bugs
|
2017-10-12 15:35:28 +03:00
|
|
|
|
2018-02-04 10:55:44 +03:00
|
|
|
(load "Debug.carp")
|
|
|
|
(Debug.sanitize-addresses)
|
2017-12-15 17:31:56 +03:00
|
|
|
(project-set! "printAST" "true")
|
|
|
|
|
2018-01-28 08:17:23 +03:00
|
|
|
;; This shouldn't compile:
|
2018-01-28 07:56:03 +03:00
|
|
|
;; (defn faulty-repeat [n inpt]
|
|
|
|
;; (let [str ""]
|
|
|
|
;; (do
|
|
|
|
;; (for [i 0 n]
|
2018-02-02 09:19:10 +03:00
|
|
|
;; (set! str &(append @str @inpt)))
|
2018-01-28 07:56:03 +03:00
|
|
|
;; @str)))
|
|
|
|
;; (defn main []
|
2018-01-28 08:17:23 +03:00
|
|
|
;; (let [strings (faulty-repeat 20 "x")]
|
2018-01-28 07:56:03 +03:00
|
|
|
;; (IO.println &strings)))
|
2018-01-30 17:22:07 +03:00
|
|
|
|
2018-02-05 10:03:36 +03:00
|
|
|
;; ;; Dangling reference to member variable.
|
|
|
|
;; (deftype S [f String])
|
2018-02-04 10:55:44 +03:00
|
|
|
;; (defn main []
|
2018-02-05 10:03:36 +03:00
|
|
|
;; (let [s (S.init @"hello")
|
|
|
|
;; r (S.f &s)
|
|
|
|
;; _ (S.set-f s @"bye")]
|
|
|
|
;; (IO.println r)))
|
2018-02-04 10:55:44 +03:00
|
|
|
|
2018-02-05 10:03:36 +03:00
|
|
|
;; ;; Dangling reference to variable.
|
|
|
|
;; (defn main []
|
|
|
|
;; (let [s @"hello"
|
|
|
|
;; r &s]
|
|
|
|
;; (do (String.delete s)
|
|
|
|
;; (IO.println r))))
|
2018-02-04 11:05:31 +03:00
|
|
|
|
2018-02-05 10:03:36 +03:00
|
|
|
;; Problem with string deallocation in branches.
|
|
|
|
(defn ifmem []
|
|
|
|
(if true
|
|
|
|
(IO.println &@"TEST")
|
|
|
|
()))
|