Bogus runtime type error related to inlined function

Bug #1943477 reported by Jan Moringen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Fix Released
Undecided
Unassigned

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))
                test2))
(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

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

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

5. *FEATURES*

(:X86-64 :GENCGC :64-BIT :ANSI-CL :COMMON-LISP :ELF :IEEE-FLOATING-POINT :LINUX
 :LITTLE-ENDIAN :PACKAGE-LOCAL-NICKNAMES :SB-CORE-COMPRESSION :SB-LDB
 :SB-PACKAGE-LOCKS :SB-THREAD :SB-UNICODE :SBCL :UNIX)

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  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.