--* From postmaster%watson.vnet.ibm.com@yktvmv.watson.ibm.com  Wed Dec  8 11:19:44 1993
--* Received: from yktvmv.watson.ibm.com by leonardo.watson.ibm.com (AIX 3.2/UCB 5.64/4.03)
--*           id AA22914; Wed, 8 Dec 1993 11:19:44 -0500
--* X-External-Networks: yes
--* Received: from watson.vnet.ibm.com by yktvmv.watson.ibm.com (IBM VM SMTP V2R3)
--*    with BSMTP id 8537; Wed, 08 Dec 93 11:26:05 EST
--* Received: from YKTVMV by watson.vnet.ibm.com with "VAGENT.V1.0"
--*           id <A.BRONSTEI.NOTE.YKTVMV.1021.Dec.08.11:26:04.-0500>
--*           for asbugs@watson; Wed, 08 Dec 93 11:26:05 -0500
--* Received: from bernina.ethz.ch by watson.ibm.com (IBM VM SMTP V2R3) with TCP;
--*    Wed, 08 Dec 93 11:26:04 EST
--* Received: from neptune by bernina.ethz.ch with SMTP inbound id <15322-0@bernina.ethz.ch>; Wed, 8 Dec 1993 17:25:52 +0100
--* From: Manuel Bronstein <bronstei@inf.ethz.ch>
--* Received: from rutishauser.inf.ethz.ch (rutishauser-gw.inf.ethz.ch) by neptune id AA15042; Wed, 8 Dec 93 17:25:49 +0100
--* Date: Wed, 8 Dec 93 17:25:48 +0100
--* Message-Id: <9312081625.AA17766@rutishauser.inf.ethz.ch>
--* Received: from vinci.inf.ethz.ch.rutishauser by rutishauser.inf.ethz.ch id AA17766; Wed, 8 Dec 93 17:25:48 +0100
--* To: asbugs@watson.ibm.com
--* Subject: [1] Local type in add part won't compile [buglocal.as][33.0]

--@ Fixed  by:  SSD   Thu Dec 16 16:22:35 1993 
--@ Tested by:  none 
--@ Summary:    Substitution code enhancements between v33.0 and v33.2 fix the bug. 

#include "aslib.as"

macro Z == Integer

-- This type compiles ok if the with{foo:Z->%} is removed, but with that
-- statement in, the local type Term does not compile anymore!

MyType: BasicType with {
		foo: Z -> %;
	}
	== add {
        Term: BasicType with {
			term: Z -> %;
			mret: % -> Z;
		} == add {
			macro Rep == Z;
			import Z; import Boolean; import Rep;

			term(c:Z):% == per c;
			mret(t:%):Z == rep(t);
			sample:%    == term 1;
        	(x:%) = (y:%):Boolean == mret x = mret y;
        	apply(p:OutPort, x:%):OutPort == p;
		}

        macro Rep == List Term;
        import Z;
        import Term;
        import Rep;

        (x:%) = (y:%):Boolean         == rep x = rep y;
		sample:%                      == foo 1;
        apply(p:OutPort, x:%):OutPort == p;
        foo(c:Z):%                    == per list term c;
}

 
