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

Bug #310120 reported by James Y Knight on 2008-12-21
2
Affects Status Importance Assigned to Milestone
SBCL
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.

Changed in sbcl:
importance: Undecided → Medium
status: New → Confirmed
description: updated
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers