--* From postmaster%watson.vnet.ibm.com@yktvmv.watson.ibm.com  Wed Feb  2 19:25:31 1994
--* Received: from yktvmv.watson.ibm.com by leonardo.watson.ibm.com (AIX 3.2/UCB 5.64/4.03)
--*           id AA07561; Wed, 2 Feb 1994 19:25:31 -0500
--* X-External-Networks: yes
--* Received: from watson.vnet.ibm.com by yktvmv.watson.ibm.com (IBM VM SMTP V2R3)
--*    with BSMTP id 7415; Wed, 02 Feb 94 19:31:35 EST
--* Received: from YKTVMV by watson.vnet.ibm.com with "VAGENT.V1.0"
--*           id <A.ADK.NOTE.YKTVMV.4163.Feb.02.18:07:35.-0500>
--*           for asbugs@watson; Wed, 02 Feb 94 19:31:35 -0500
--* Received: from ibm4.scri.fsu.edu by watson.ibm.com (IBM VM SMTP V2R3) with TCP;
--*    Wed, 02 Feb 94 18:07:34 EST
--* Received: by ibm4.scri.fsu.edu id AA17156
--*   (5.65c/IDA-1.4.4 for asbugs@watson.ibm.com); Wed, 2 Feb 1994 18:07:35 -0500
--* Date: Wed, 2 Feb 1994 18:07:35 -0500
--* From: Tony Kennedy <adk@ibm4.scri.fsu.edu>
--* Message-Id: <199402022307.AA17156@ibm4.scri.fsu.edu>
--* To: asbugs@watson.ibm.com
--* Subject: [7] Untruthful error message [bugs/return.as][A# version 33.8 for AIX RS/6000 (debug version)]

--@ Fixed  by:  PAB   Thu May 11 09:40:05 EDT 1995 
--@ Tested by:  none 
--@ Summary:    Not a bug. The error message is correct: when n*n >= 0 is false, no value is available to return. 


--+ ibm4::adk[373]> asharp -r -M2 bugs/return.as
--+ "./bugs/return.as", line 9:   if n*n >= 0 then
--+                             ..^
--+ [L9 C3] (Error) A value is needed but `if' expression has no `else'.
--+ [L9 C3] (Error) Have determined 0 possible types for the expression.
--+   Subexpression `return n':
--+         Meaning 1: Exit
--+   The context requires an expression of type SingleInteger.
--+
--+ ibm4::adk[374]> asharp -r -M2 -Drescue bugs/return.as
--+ -4; -4; -3; -3; -2; -2; -1; -1; 0; 0; 1; 1; 2; 2; 3; 3; 4; 4;
#include "aslib.as"

good(n : SingleInteger) : SingleInteger ==
  if n*n >= 0 then
    return n
  42

bad(n : SingleInteger) : SingleInteger ==
  if n*n >= 0 then
    return n
#if rescue
  error "This is impossible"
#endif

for i : SingleInteger in -4..4 repeat
  print(good i)("; ")
  print(bad i)("; ")

print()
 
