DEFTYPE does not care about the second argument kind

Bug #576594 reported by Roman Marynchak
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Status tracked in Trunk
Trunk
Fix Released
Low
Unassigned

Bug Description

DEFTYPE in SBCL accepts a wide range of garbage to be its second argument, instead of checking it to be a valid lambda-list, as defined by CLHS.

For example:

* (deftype rr yy)
; in: LAMBDA NIL
; (LET* ((YY (CDR #:WHOLE676)))
; (BLOCK RR))
;
; caught STYLE-WARNING:
; The variable YY is defined but never used.
;
; compilation unit finished
; caught 1 STYLE-WARNING condition

Regards,
Roman

Revision history for this message
Roman Marynchak (roman-marynchak) wrote :

I have attached the simple patch. Now the behavior is the next:

* (deftype rr yy)

debugger invoked on a SIMPLE-ERROR in thread #<THREAD "initial thread" RUNNING
                                               {A9EB801}>:
  Arguments list is not a valid lambda-list: YY

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

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

((LAMBDA (#:WHOLE6 #:ENVIRONMENT7)) (DEFTYPE RR YY) #<unavailable argument>)
0]

Also I have fixed another error message to be a valid English sentence.

Regards,
Roman

Revision history for this message
Nathan Froyd (froydnj) wrote :

A testcase in tests/ would be a nice addition. Also, I think the usual phrase is "argument list."

Revision history for this message
Roman Marynchak (roman-marynchak) wrote :

Thanks for the note, fixed.

The test is coming soon (I hope to create it till the end of the week).

Regards,
Roman

Revision history for this message
Roman Marynchak (roman-marynchak) wrote :

I have attached a simple test. It passes after the fix, and claims about "Unhandled error" without the fix.

Regards,
Roman

Changed in sbcl:
status: New → In Progress
assignee: nobody → Roman Marynchak (roman-marynchak)
Changed in sbcl:
importance: Undecided → Low
tags: added: review
Revision history for this message
Nikodemus Siivola (nikodemus) wrote :

Thank you. Something like this was merged in 1.0.41.50.

I opted for putting the check in PARSE-DEFMACRO so that other users of that gain the benefit of this as well, and added an utility function for signalling simple-type-errors: there are plenty of places that could use that instead of doing keyword calls...

Changed in sbcl:
status: In Progress → Fix Committed
Revision history for this message
Nikodemus Siivola (nikodemus) wrote :

Apropos: we are not currently using the "nominate for trunk" stuff on launchpad.

tags: removed: review
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.