bugKawa - Bugs: bug #47993, Spurious warning for throw in case...

 
 

bug #47993: Spurious warning for throw in case expression

Submitter:  Nathan S. <nathans>
Submitted:  Tue 24 May 2016 04:23:08 AM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Invalid
Privacy:  Public Assigned to:  bothner
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 31 May 2016 01:11:00 PM UTC, comment #2: 

Thanks!

Nathan S. <nathans>
Fri 27 May 2016 10:18:58 PM UTC, comment #1: 

I believe Kawa is correct.

The clause
  (else => (throw 'illegal-argument))
is equivalent to:
  (else ((throw 'illegal-argument) idx))
That is (throw 'illegal-argument) is evaluated to a procedure,
which is then called with the value of idx as its argument.
Since (throw 'illegal-argument) can never evaluate to a procedure, Kawa correctly complains.

You probably want plain:
  (else (throw 'illegal-argument))

Per Bothner <bothner>
Group administrator
Tue 24 May 2016 04:23:08 AM UTC, original submission:  

This procedure works correctly but generates a spurious warning message.


(define (case-test idx)
  (case idx
        ((0) (+ idx 2))
        ((1) (* idx 2))
        (else => (throw 'illegal-argument))))


Either compiling or loading the file as a script generates the following warning:


test.scm:2:3: warning - unreachable procedure call
test.scm:5:11: note - this operand never finishes


Nathan S. <nathans>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #37244:  test.scm added by nathans (109B - application/vnd.lotus-screencam - script demonstrating issue)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bothner (Posted a comment)
  • -email is unavailable- added by nathans (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-05-31 bothner Open/ClosedOpen Closed
    2016-05-27 bothner StatusNone Invalid
        Assigned toNone bothner
    2016-05-24 nathans Attached File- Added test.scm, #37244

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code