--* From postmaster%watson.vnet.ibm.com@yktvmv.watson.ibm.com  Thu Jul 22 18:27:00 1993
--* Received: from yktvmv2.watson.ibm.com by radical.watson.ibm.com (AIX 3.2/UCB 5.64/900524)
--*           id AA17283; Thu, 22 Jul 1993 18:27:00 -0400
--* X-External-Networks: yes
--* Received: from watson.vnet.ibm.com by yktvmv.watson.ibm.com (IBM VM SMTP V2R3)
--*    with BSMTP id 7185; Thu, 22 Jul 93 18:28:03 EDT
--* Received: from YKTVMV by watson.vnet.ibm.com with "VAGENT.V1.0"
--*           id <A.ADK.NOTE.YKTVMV.7575.Jul.22.18:28:03.-0400>
--*           for asbugs@watson; Thu, 22 Jul 93 18:28:03 -0400
--* Received: from ibm4.scri.fsu.edu by watson.ibm.com (IBM VM SMTP V2R3) with TCP;
--*    Thu, 22 Jul 93 18:28:02 EDT
--* Received: by ibm4.scri.fsu.edu id AA30293
--*   (5.65c/IDA-1.4.4 for asbugs@watson.ibm.com); Thu, 22 Jul 1993 18:27:59 -0400
--* Date: Thu, 22 Jul 1993 18:27:59 -0400
--* From: Tony Kennedy <adk@ibm4.scri.fsu.edu>
--* Message-Id: <199307222227.AA30293@ibm4.scri.fsu.edu>
--* To: asbugs@watson.ibm.com
--* Subject: Export not found? [bug7.as][A# version 29.2 for AIX RS/6000 (debug version)]

--@ Fixed  by:  PI   Thu Jan 20 11:34:36 EST 1994 
--@ Tested by:  none 
--@ Summary:    no more a bug. Line 45 should be removed. 

--+ A# version 29.2 for AIX RS/6000 (debug version)
--+ Exec: unicl -I/ds13/m/users/edwards/applications/asharp/base/rs3.2/include -c bug7.c
--+ Exec: xlc -I/ds13/m/users/edwards/applications/asharp/base/rs3.2/include -I/usr/include -c bug7.c
--+ 	      ld in sc sy li pa ma ab ck sb ti gf of pb pl pc po mi
--+  Time  10.6s   0 .2 .2 .3 .5 .6 .5 .0 .0  1 68  2 .9  0  0  6 16 .4 %
--+  Alloc 3747K   0 .2 .3 .0 .6 .4 .7 .0 .0  1 87  3 .1  0  0  4 .0 .0 %
--+  Free   807K   0 .1 .0 .0  3 .2  2 .3 .0  2 60  3  1  0  0 16 .0  9 %
--+  Store 2971K : 3779K alloc - 808K free - 0K gc  (3376K pool)
--+  Source 199L : 1121 lines per minute
--+ Exec: unicl bug7.o -L/ds13/m/users/edwards/applications/asharp/base/rs3.2/lib -o  bug7 -laslib -lfoam -lm
--+ Exec: xlc -I/usr/include -obug7 bug7.o -L/ds13/m/users/edwards/applications/asharp/base/rs3.2/lib -L/lib -L/usr/lib -L/usr/local/lib -laslib -lfoam -lm
--+ Exec: ./bug7
--+ Looking for 932148499 with code 974356174
--+ Export not found
#include "aslib"

macro

  SI == SingleInteger

  AddClause(name) ==
    add

      macro Rep == SI

      print("Constructing domain ")(name)("...")()

      alpha(x: SI): % ==
        print("alpha(")(x)(")$")(name)()
        per x

      beta(x: SI): % ==
        print("beta(")(x)(")$")(name)()
        per x

      gamma(x: SI): % ==
        print("gamma(")(x)(")$")(name)()
        per x



import
  SI
  String

-- Test of rules for categorical inclusion

-- A is a category which exports signatures for alpha and beta but not
-- for gamma

A: Category ==

  with
    alpha: SI -> %
    beta: SI -> %

-- B is a domain explicitly belonging to category A which exports
-- values for the functions alpha, beta, and gamma. Since gamma does
-- not have its signature exported it should not be visible outside of B.

B: A ==
  add AddClause("B")

-- C is a domain which does not explicitly belong to A, but does
-- implicitly (i.e., it has the structure of an A). Since gamma is
-- in its with clause it should be visible when C is imported.

C:
  with
    alpha: SI -> %
    beta: SI -> %
    gamma: SI -> %

  == add AddClause("C")

-- D is a domain which neither explicitly nor implicitly belongs to A
-- because it lacks beta in its with clause (i.e., it has less
-- structure than an A must have).

D:
  with
    alpha: SI -> %
    gamma: SI -> %

  == add AddClause("D")

-- bn, cn, and dn are elements of domains B, C, and D respectively

b1: B == alpha 2
c1: C == alpha 3
d1: D == alpha 5

b2: B == beta 7
c2: C == beta 11
-- d2: D == beta 13 -- Error

-- b3: B == gamma 17 -- Error
c3: C == gamma 19
d3: D == gamma 23

-- Bn, Cn, and Dn are domains belonging to category A

B1: A == B
C1: A == C
-- D1: A == D -- Error

b4: B1 == alpha 29
c4: C1 == alpha 31
-- d4: D1 == alpha 37 -- Error
 
