ruricolist / serapeum

Utilities beyond Alexandria
MIT License
428 stars 42 forks source link

Assuref shadows type of function parameters #163

Closed kilianmh closed 6 months ago

kilianmh commented 11 months ago

I am not sure if this behaviour is intended:

(declaim (ftype (function (integer)) x))
(defun x (x)
  (serapeum:assuref x number))

(x 10.1) -> 10.1

Shouldn't there be an error (on sbcl at least), since the ftype declaration is violated?

ruricolist commented 11 months ago

It may be the call to x isn't getting compiled at the REPL.

CL-USER> (lambda () (x 10.1))
; in: LAMBDA ()
;     (X 10.1)
; 
; caught WARNING:
;   Constant 10.1 conflicts with its asserted type INTEGER.
;   See also:
;     The SBCL Manual, Node "Handling of Types"
; 
; compilation unit finished
;   caught 1 WARNING condition
kilianmh commented 7 months ago

You are correct.

Do you think there is a way to make it work in the repl? (only if its not too much effort)

ruricolist commented 6 months ago

I'm not aware of one.