Bogus runtime type error related to inlined function

Bug #1943477 reported by Jan Moringen
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

1. A description of what you do, what happens, and what you expected to happen.

Define a function with a declaimed type and call it. Expected the call to return without error, got a type error instead.

2. A complete repeatable test-case

Save the following code in /tmp/bug.lisp:
(declaim (ftype (function ((unsigned-byte 62) t) (values t &optional))
(defun test2 (position chunk)
  (let ((cell (aref chunk position)))
    (when (consp (cdr cell))
      (alexandria:assoc-value (cdr cell) 'symbol :test #'eq))))

(let ((chunk (make-array 1)))
  (setf (aref chunk 0) '(0 . ((foo . :bar) (baz . :fez))))
  (test2 0 chunk))

Execute SBCL via sbcl --no-userinit <anything needed to make alexandria loadable> --eval '(asdf:load-system :alexandria)' --load /tmp/bug.lisp

debugger invoked on a TYPE-ERROR @535921B8 in thread
#<THREAD "main thread" RUNNING {1001C80303}>:
  The value
    ((FOO . :BAR) (BAZ . :FEZ))
  is not of type

3. SBCL version

SBCL built from 0b2a27ffa with --fancy. (Same behavior with 93167bb4f)

4. Output from uname -a

Linux al 5.10.0-8-amd64 #1 SMP Debian 5.10.46-4 (2021-08-03) x86_64 GNU/Linux



Revision history for this message
Stas Boukarev (stassats) wrote :

Regardless of the error, the type declaration is actually incorrect, alexandria:assoc-value returns two values.

Stas Boukarev (stassats)
Changed in sbcl:
status: New → Fix Committed
Stas Boukarev (stassats)
Changed in sbcl:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers