Opened 7 years ago

Closed 7 years ago

#949 closed defect (fixed)

RESTART-CASE with :TEST & :INTERACTIVE broken

Reported by: pfeilgm Owned by:
Priority: normal Milestone:
Component: ANSI CL Compliance Version: trunk
Keywords: Cc:

Description

There seems to be some odd behavior in RESTART-CASE when a restart clause has both test and interactive expressions.

In the attached file, the only difference between TEST-BROKEN-RESTART and TEST-WORKING-RESTART is that the latter’s restart clause has no test expression.

./dx86cl64 --no-init
Welcome to Clozure Common Lisp Version 1.9-dev-r15272M-trunk  (DarwinX8664)!
? (load "~/broken-restart.lisp")
#P"/Users/greg/broken-restart.lisp"

This case behaves correctly – the test fails, so the restart is not offered.

? (test-broken-restart 'non-restartable-error)
> Error: Condition #<NON-RESTARTABLE-ERROR #x30200072ED8D>
1 > :r
>   Type (:C <n>) to invoke one of the following restarts:
0. Return to break level 1.
1. #<RESTART ABORT-BREAK #x7EBECD>
2. Return to toplevel.
3. #<RESTART ABORT-BREAK #x7EC5AD>
4. Reset this thread
5. Kill this thread
1 > :pop

This case fails – the test passes and the restart is offered, but when the restart is selected, rather than calling the interactive expression, some anonymous restart is used, and another error is signaled.

? (test-broken-restart 'restartable-error)
> Error: Condition #<RESTARTABLE-ERROR #x302000726B1D>
1 > :r
>   Type (:C <n>) to invoke one of the following restarts:
2. #<RESTART BROKEN #x7EC16D>
1 > :c 2
Invoking restart: NIL
432345564230164480 is not of type (OR SYMBOL FUNCTION), and can't be FUNCALLed or APPLYed
1 > :pop

This is the same as the previous case, but with the test expression removed. This time it works – the restart is selected, then it interactively asks for a value.

? (test-working-restart 'restartable-error)
> Error: Condition #<RESTARTABLE-ERROR #x302000721A6D>
1 > :r
>   Type (:C <n>) to invoke one of the following restarts:
2. #<RESTART WORKING #x7EC16D>
1 > :c 2
Invoking restart: #<RESTART WORKING #x7EC16D>
Enter a value: 5
5
? 

Attachments (1)

broken-restart.lisp (971 bytes) - added by pfeilgm 7 years ago.

Download all attachments as: .zip

Change History (2)

Changed 7 years ago by pfeilgm

comment:1 Changed 7 years ago by gb

  • Resolution set to fixed
  • Status changed from new to closed

(In [15303]) FIND-RESTART: if argument is a RESTART (rather than a symbol that might name one), don't worry about whether it's applicable (just return it if it's active.) Someone was arguing vehemently that this was wrong a few years ago, IIRC.

In %ACTIVE-RESTART, use APPLICABLE-RESTART-P.

In INVOKE-RESTART-INTERACTIVELY, call %ACTIVE-RESTART (which signals a CONTROL-ERROR rather than indirecting through NIL if the restart isn't found.)

Fixes ticket:949 in the trunk.

Note: See TracTickets for help on using tickets.