A strange problem: function returning nil instead returns random numbers #26
Open
Description
Hi, @gnl —
Keep up all the amazing work. Just ran into the strange problem... Here's a function without ghostwheel...
(defn should-return-nil
[x]
nil)
=> #'x.asin/should-return-nil
(should-return-nil "")
=> nil
(should-return-nil "")
=> nil
And here's the same function with ghostwheel — it returns seemingly random numbers. I'm wondering if I'm doing something wrong?
(>defn should-return-nil-gw
[x] [string? => int?]
nil)
=> [x.asin/should-return-nil-gw]
; this fails, as expected...
(should-return-nil-gw 12)
Syntax error (ExceptionInfo) compiling at (asin.clj:23:3).
Call to amazonreviews.asin/should-return-nil-gw did not conform to spec:
12 - failed: string? in: [0] at: [:args :x]
; this has surprising return value
(should-return-nil-gw "")
=> -6922
(should-return-nil-gw "")
=> 0
(should-return-nil-gw "")
=> -31855
- Shouldn't the return value fail the spec, as it is not nilable?
- Why is it returning seemingly random numbers?
Thank you!
Gene