Weak type inference in BREAK
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
New
|
Undecided
|
Unassigned |
Bug Description
* (defclass foo () ())
#<STANDARD-CLASS COMMON-
* (defun bar () (break (make-instance 'foo)))
BAR
* (defun baz () (break (make-hash-table)))
; in: DEFUN BAZ
; (BREAK (MAKE-HASH-TABLE))
;
; caught WARNING:
; Derived type of (MAKE-HASH-TABLE) is
; (VALUES HASH-TABLE &OPTIONAL),
; conflicting with its asserted type
; (OR (VECTOR CHARACTER) (VECTOR NIL) BASE-STRING FUNCTION).
; See also:
; The SBCL Manual, Node "Handling of Types"
;
; compilation unit finished
; caught 1 WARNING condition
BAZ
DEFUN BAR should signal a warning, just like DEFUN BAZ does.
An instance of FOO is not of type (OR (VECTOR CHARACTER) (VECTOR NIL) BASE-STRING FUNCTION) as it is not a vector or a base string, and it is not a function because it is not a funcallable instance.
SBCL 1.4.15 on Linux.
(defclass foo () ())
(defun bar ()
(break (make-instance 'foo)))
(setf (find-class 'foo) (defclass f () () (:metaclass sb-mop: funcallable- standard- class)) )
(defmethod initialize-instance :after ((f f) &key) set-funcallable -instance- function f (lambda (stream) (format stream "BREAK"))))
(sb-mop:
(bar)
=>
debugger invoked on a SIMPLE-CONDITION in thread
#<THREAD "main thread" RUNNING {10005F05B3}>:
BREAK