--* From postmaster%watson.vnet.ibm.com@yktvmv.watson.ibm.com  Thu Apr  6 15:42:52 1995
--* Received: from yktvmv-ob.watson.ibm.com by asharp.watson.ibm.com (AIX 3.2/UCB 5.64/930311)
--*           id AA32038; Thu, 6 Apr 1995 15:42:52 -0400
--* Received: from watson.vnet.ibm.com by yktvmv.watson.ibm.com (IBM VM SMTP V2R3)
--*    with BSMTP id 5201; Thu, 06 Apr 95 15:41:39 EDT
--* Received: from YKTVMV by watson.vnet.ibm.com with "VAGENT.V1.0"
--*           id <A.BRONSTEI.NOTE.YKTVMV.4185.Apr.06.15:41:38.-0400>
--*           for asbugs@watson; Thu, 06 Apr 95 15:41:39 -0400
--* Received: from inf.ethz.ch by watson.ibm.com (IBM VM SMTP V2R3) with TCP;
--*    Thu, 06 Apr 95 15:41:36 EDT
--* Received: from mendel.inf.ethz.ch (mendel.inf.ethz.ch [129.132.12.20]) by inf.ethz.ch (8.6.10/8.6.10) with ESMTP id VAA28868 for <asbugs@watson.ibm.com>; Thu, 6 Apr 1995 21:41:35 +0200
--* From: Manuel Bronstein <bronstei@inf.ethz.ch>
--* Received: (bronstei@localhost) by mendel.inf.ethz.ch (8.6.10/8.6.10) id VAA26503 for asbugs@watson.ibm.com; Thu, 6 Apr 1995 21:37:44 +0200
--* Date: Thu, 6 Apr 1995 21:37:44 +0200
--* Message-Id: <199504061937.VAA26503@mendel.inf.ethz.ch>
--* To: asbugs@watson.ibm.com
--* Subject: [1] separate compilation fails [manysrc.as][1.0.7]

--@ Fixed  by:  SSD   Fri Apr 14 16:55:42 EDT 1995 
--@ Tested by:  none 
--@ Summary:    Bug fixes to default/conditional exports. (Should appear in r1-1-0) 

------------------------------ manysrc.as --------------------------------
--
-- IN ORDER TO REPRODUCE THIS BUG, THE 3 (SHORT) FILES cats.as, polcat.as,
-- and poly.as MUST BE COMPILED SEPARATELY, THE BUG OCCURS THEN IN THE LAST
-- ONE (PUTTING THE CODE IN LESS THAN 3 FILES WORK):
--
-- axiomxl cats.as
-- axiomxl polcat.as
-- axiomxl poly.as
-- "poly.as", line 20:         foo(p:%):% == { zero? p => 0; 1 };
--                     ........................^
-- [L20 C25] #1 (Error) There are 6 meanings for `zero?' in this context.
-- The possible types were:
--           zero?: % -> Boolean, a local
--           zero?: % -> Boolean, a local
--           zero?: % -> Boolean, a local
--           zero?: % -> Boolean, a local
--           zero?: % -> Boolean, a local
--           zero?: % -> Boolean, a local
--   The context requires an expression of type % -> Boolean.
--

------------------------------- cats.as ----------------------------------
#include "axllib.as"

MyRing: Category == Ring with { characteristic: Integer };

------------------------------- polcat.as ----------------------------------
#include "axllib.as"

#library mycats "cats.ao"
import from mycats;

MyPolynomialCategory0(R:Ring):Category == Ring with {
	foo: % -> %;
	if R has Field then MyRing;
	default {
		coerce(n:Integer):%		== 0;
		coerce(n:SingleInteger):%	== 0;
		sample:%			== 0;
	}
}

MyPolynomialCategory(R:Ring):Category == MyPolynomialCategory0 R with {
	apply: (%, R) -> R;
	if R has EuclideanDomain then MyRing;
}

-------------------------------- poly.as ----------------------------------
#include "axllib.as"

#library mypolcat "polcat.ao"
import from mypolcat;

Poly(R:Ring): MyPolynomialCategory R == add {
	macro Rep == Record(deg:SingleInteger, koeffs:PrimitiveArray R);
	import from PrimitiveArray R, Rep, R, SingleInteger;

	0:% == per [0, new 0];
	1:% == per [0, new 0];
	(port:TextWriter) << (p:%):TextWriter == port;
	apply(p:%, r:R):R == r;
	-(p:%):% == p;
	(x:%) = (y:%):Boolean == false;
	(c:R) * (p:%):% == p;
	(p:%) + (q:%):% == p;
	(p:%) * (q:%):% == p;
	foo(p:%):% == { zero? p => 0; 1 };
}
 
