TYPE-ERROR redefining class as structure

Bug #1942317 reported by Luke Gorrie
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Confirmed
Low
Unassigned

Bug Description

I found a reproducible way to provoke a TYPE-ERROR from the compiler. First define a class and then compile (only) a structure definition with the same name.

$ echo "(defstruct x)" > x.lisp

$ sbcl --eval '(defclass x () ())' --eval '(compile-file "x.lisp")'
This is SBCL 2.1.2.nixos, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.
; compiling file "/home/luke/x.lisp" (written 01 SEP 2021 12:10:08 PM):
; processing (DEFSTRUCT X)
; file: /home/luke/x.lisp
; in: DEFSTRUCT X
; (DEFSTRUCT X)
; --> PROGN EVAL-WHEN
; ==>
; (SB-KERNEL::%COMPILER-DEFSTRUCT
; '#<SB-KERNEL:DEFSTRUCT-DESCRIPTION X {10015B9AB3}>
; '#(#<SB-KERNEL:LAYOUT (ID=1) for T {50201003}>
; #<SB-KERNEL:LAYOUT (ID=2) for STRUCTURE-OBJECT {50201073}>))
;
; caught WARNING:
; change in superclasses of class #<SB-KERNEL:STRUCTURE-CLASSOID X>:
; The current superclasses: (T SB-PCL::SLOT-OBJECT STANDARD-OBJECT)
; the most recently loaded superclasses: (T STRUCTURE-OBJECT)

debugger invoked on a TYPE-ERROR in thread
#<THREAD "main thread" RUNNING {1001550103}>:
  The value
    NIL
  is not of type
    SB-KERNEL:LAYOUT

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [CONTINUE] Ignore runtime option --eval "(compile-file \"x.lisp\")".
  1: [ABORT ] Skip rest of --eval and --load options.
  2: Skip to toplevel READ/EVAL/PRINT loop.
  3: [EXIT ] Exit SBCL (calling #'EXIT, killing the process).

(SB-KERNEL:UNDECLARE-STRUCTURE #<SB-KERNEL:STRUCTURE-CLASSOID X> NIL)
0]

$ uname -a
Linux thinky 5.13.9 #1-NixOS SMP Sun Aug 8 07:06:57 UTC 2021 x86_64 GNU/Linux

$ sbcl --version
SBCL 2.1.2.nixos

Stas Boukarev (stassats)
Changed in sbcl:
status: New → Confirmed
importance: Undecided → Low
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.