defclass doesn't inform TYPEP in the compilation environment (because we don't have a compilation environment)

Bug #310120 reported by James Y Knight
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
SBCL
Confirmed
Medium
Unassigned

Bug Description

Version: 1.0.23
Platform: linux x86-64

Originally reported to me by Mark Nahabedian.

Put this in a file:

> (in-package :cl-user)
>
> (defclass foo ()
> ((foo1) (foo2)))
>
> (defmacro foobie-doo (&environment env class-name)
> (let ((class (find-class class-name t env)))
> `(progn
> ,class)))
>
> (print (foobie-doo foo))

Then:

* (compile-file "/tmp/test.lisp")

debugger invoked on a SIMPLE-ERROR in thread #<THREAD "initial thread" RUNNING {1002740F11}>:
  There is no class named FOO.

restarts (invokable by number or by possibly-abbreviated name):
  0: [ABORT] Exit debugger, returning to top level.

(SB-PCL::FIND-CLASS-FROM-CELL FOO NIL T)
0]

But the CommonLisp spec (see "Macro DEFCLASS") says:
    If a defclass form appears as a top level form, the compiler must make
    the class name be recognized as a valid type name in subsequent
    declarations (as for deftype) and be recognized as a valid class name
    for defmethod parameter specializers and for use as the :metaclass
    option of a subsequent defclass. The compiler must make the class
    definition available to be returned by find-class when its environment
    argument is a value received as the environment parameter of a macro.

See also bug 309140.

Tags: ansi compiler pcl
Changed in sbcl:
importance: Undecided → Medium
status: New → Confirmed
description: updated
Revision history for this message
Paul F. Dietz (paul-f-dietz) wrote :

This bug bit Shinmera, as reported in irc.

Revision history for this message
Paul F. Dietz (paul-f-dietz) wrote :

Saw this bug again from someone at work.

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.