system records expanded types from declarations

Bug #1010862 reported by Nikodemus Siivola
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Triaged
Low
Unassigned

Bug Description

  CL-USER> (deftype foo () `(integer 0 12938))
  FOO
  CL-USER> (declaim (ftype (function (foo) *) bar))
  ; no value
  CL-USER> (defun bar (x) x)
  BAR
  CL-USER> (describe 'bar)
  COMMON-LISP-USER::BAR
    [symbol]

  BAR names a compiled function:
    Lambda-list: (X)
    Declared type: (FUNCTION ((MOD 12939)) *)
    Derived type: (FUNCTION ((MOD 12939)) (VALUES (MOD 12939) &OPTIONAL))
    Source form:
      (SB-INT:NAMED-LAMBDA BAR
          (X)
        (BLOCK BAR X))

...whereas

  Declared type: (FUNCTION (FOO) *)

would seem preferable.

Tags: compiler
Revision history for this message
Nikodemus Siivola (nikodemus) wrote : Re: system records expanded types for declarations

Same applies to variables, etc.

We currently record the parsed type into globaldb. Possibly we should either record both, or make type objects able to carry the unparsed form with them.

summary: - system records expanded types for functions
+ system records expanded types for declarations
Revision history for this message
Nikodemus Siivola (nikodemus) wrote :

Note also:

CL-USER> (deftype xtype () `(member :x))
XTYPE
CL-USER> (declaim (xtype *x*))
; No value
CL-USER> (deftype xtype () `(member :x 'x))
XTYPE
CL-USER> (defvar *x*)
*X*
CL-USER> (describe '*x*)
COMMON-LISP-USER::*X*
  [symbol]

*X* names a special variable:
  Declared type: (MEMBER :X)
  Currently unbound.

summary: - system records expanded types for declarations
+ system records expanded types from declarations
Revision history for this message
Douglas Katzman (dougk) wrote :

forcing CTYPEs to carry their unparsed form would pessimize all the type operators, notably TYPE=, since there would multiple spellings of the same CTYPE, which is precisely the thing that the caching and interning of types is designed to avoid.
We most definitely don't want that.
I have some ideas about this, I'll probably work on it.

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.