--* From postmaster%watson.vnet.ibm.com@yktvmv.watson.ibm.com  Sun May 30 13:13:33 1993
--* Received: from yktvmv2.watson.ibm.com by radical.watson.ibm.com (AIX 3.2/UCB 5.64/900524)
--*           id AA20935; Sun, 30 May 1993 13:13:33 -0400
--* X-External-Networks: yes
--* Received: from watson.vnet.ibm.com by yktvmv.watson.ibm.com (IBM VM SMTP V2R3)
--*    with BSMTP id 3037; Sun, 30 May 93 13:14:05 EDT
--* Received: from YKTVMV by watson.vnet.ibm.com with "VAGENT.V1.0"
--*           id <A.SANTAS.NOTE.YKTVMV.7529.May.30.13:14:04.-0400>
--*           for asbugs@watson; Sun, 30 May 93 13:14:05 -0400
--* Received: from bernina.ethz.ch by watson.ibm.com (IBM VM SMTP V2R3) with TCP;
--*    Sun, 30 May 93 13:14:04 EDT
--* Received: from neptune by bernina.ethz.ch with SMTP inbound id <7302-0@bernina.ethz.ch>; Sun, 30 May 1993 19:14:01 +0200
--* From: Philip Santas <santas@inf.ethz.ch>
--* Received: from rutishauser.inf.ethz.ch (rutishauser-gw.inf.ethz.ch) by neptune id AA20094; Sun, 30 May 93 19:13:49 +0200
--* Date: Sun, 30 May 93 19:13:47 +0200
--* Message-Id: <9305301713.AA07096@rutishauser.inf.ethz.ch>
--* Received: from ru7.inf.ethz.ch.rutishauser by rutishauser.inf.ethz.ch id AA07096; Sun, 30 May 93 19:13:47 +0200
--* To: asbugs@watson.ibm.com
--* Subject: unions
--* In-Reply-To: Mail from 'postmaster@bernina.ethz.ch'
--*       dated: Sun, 30 May 1993 06:22:37 +0200

--@ Fixed  by: SMW Wed Oct 13 22:28:24 1993
--@ Tested by: halt0.as
--@ Summary:   Modified foam_c.c + genfoam.c to print error message before quitting when a bad union branch is attempted



--Some computations seem not to be performed in A#!
--
--The following program, does not print 'a'.
--IMO it should report some form of error.
--What is happening? Does it perform the addition
--a+1?
--
--Philip
--
-------------------------------------------------------
#include "aslib.as"

SI ==> SingleInteger
ST ==> String
import SI
import ST
import Boolean

union1 ==> Union(ii:SI, st:ST)

import union1

x:union1  := union("asd")

print(x st)()
a:SI := (x ii) + (x ii)
print(a+1)()
--------------------------------------------------------


 
--+ The generated code was detecting the bad union branch and quietly
--+ exiting your program with a "failure" return code.  I have modified
--+ the run-time support so that it displays an error message before exiting.
--+ Because the run-time system correctly detected your first invalid use
--+ of the union, neither the addition nor the print was evaluated.
--+ 
--+ Script started on Wed Oct 13 22:04:55 1993
--+ % asharp -r bug295.as
--+ asd
--+ User error: Bad union branch.
--+ script done on Wed Oct 13 22:05:35 1993
