1 // Test -lno-implicit-template instantiation of polymorphic types
4 datatype List<T> :: collectable printable rewrite
5 = #[] | #[ T ... List<T> ]
8 datatype Tree<T> :: collectable printable rewrite
9 = Empty | Leaf of T | Node of (Tree<T>, Tree<T>)
12 datatype Foo :: collectable printable rewrite = FOO() | BAR();
14 instantiate extern datatype List<int>, Tree<List<int> >, Tree<int>, Foo;
16 Tree<int> flip(Tree<int> t)
18 { Node(a,b): { return Node(flip(b),flip(a)); }
23 #define PROP_EXPLICIT_TEMPLATE_INSTANTIATION
24 instantiate datatype List<int>, Tree<List<int> >, Tree<int>, Foo;
27 { List<int> a = #[1,2,3];
28 Tree<List<int> > empty = Empty; // fake it for now
29 Tree<List<int> > b = Node(Leaf(#[4]),Node(Leaf(#[5,6]),empty));
30 Tree<int> c = Node(Leaf(4),Node(Leaf(5),Leaf(6)));
31 for (int i = 0; i < 10000; i++)
33 cout << "a = " << a << endl;
34 cout << "b = " << b << endl;
35 cout << "c = " << c << endl;