aa
com.cliffc.aa.HM.TestHM8 Class Reference

Public Member Functions

void reset ()
 
void test00 ()
 
void test01 ()
 
void test02 ()
 
void test03 ()
 
void test04 ()
 
void test05 ()
 
void test05a ()
 
void test06 ()
 
void test07 ()
 
void test08 ()
 
void test09 ()
 
void test10 ()
 
void test11 ()
 
void test12 ()
 
void test13 ()
 
void test14 ()
 
void test15 ()
 
void test16 ()
 
void test17 ()
 
void test18 ()
 
void test19 ()
 
void test20 ()
 
void test21 ()
 
void test22 ()
 
void test23 ()
 
void test24 ()
 
void test25 ()
 
void test25a ()
 
void test25b ()
 
void test26 ()
 
void test27 ()
 
void test28 ()
 
void test29 ()
 
void test30 ()
 
void test30a ()
 
void test31 ()
 
void test32 ()
 
void test33 ()
 
void test34 ()
 
void test35 ()
 
void test36 ()
 

Detailed Description

Definition at line 9 of file TestHM8.java.

Member Function Documentation

◆ reset()

void com.cliffc.aa.HM.TestHM8.reset ( )

Definition at line 11 of file TestHM8.java.

11 { HM8.reset(); }

References com.cliffc.aa.HM.HM8.reset().

Here is the call graph for this function:

◆ test00()

void com.cliffc.aa.HM.TestHM8.test00 ( )

Definition at line 14 of file TestHM8.java.

14  {
15  HM8.hm("fred");
16  }

References com.cliffc.aa.HM.HM8.hm().

Here is the call graph for this function:

◆ test01()

void com.cliffc.aa.HM.TestHM8.test01 ( )

Definition at line 19 of file TestHM8.java.

19  {
20  Syntax syn = HM8.hm("3");
21  assertEquals("3",syn._t.p());
22  assertEquals("[]",syn._post.p());
23  }

References com.cliffc.aa.HM.HM8.hm().

Here is the call graph for this function:

◆ test02()

void com.cliffc.aa.HM.TestHM8.test02 ( )

Definition at line 26 of file TestHM8.java.

26  {
27  Syntax syn = HM8.hm("(pair1 3)");
28  assertEquals("{ A -> (pair 3 A) }",syn._t.p());
29  assertEquals("[]",syn._post.p());
30  }

References com.cliffc.aa.HM.HM8.hm().

Here is the call graph for this function:

◆ test03()

void com.cliffc.aa.HM.TestHM8.test03 ( )

Definition at line 33 of file TestHM8.java.

33  {
34  Syntax syn = HM8.hm("{ z -> (pair (z 3) (z \"abc\")) }");
35  assertEquals("{ { all -> A } -> (pair A A) }",syn._t.p());
36  assertEquals("[]",syn._post.p());
37  }

References com.cliffc.aa.HM.HM8.hm().

Here is the call graph for this function:

◆ test04()

void com.cliffc.aa.HM.TestHM8.test04 ( )

Definition at line 40 of file TestHM8.java.

40  {
41  Syntax syn = HM8.hm("fact = { n -> (if (?0 n) 1 (* n (fact (dec n))))}; fact");
42  assertEquals("{ int64 -> int64 }",syn._t.p());
43  assertEquals("[]",syn._post.p());
44  }

References com.cliffc.aa.HM.HM8.hm().

Here is the call graph for this function:

◆ test05()

void com.cliffc.aa.HM.TestHM8.test05 ( )

Definition at line 54 of file TestHM8.java.

54  {
55  // Because {y->y} is passed in, all 'y' types must agree.
56  // This unifies 3 and "abc" which results in 'all'
57  Syntax syn = HM8.hm("({ x -> (pair (x 3) (x \"abc\")) } {y->y})");
58  assertEquals("(pair all all)",syn._t.p());
59  assertEquals("[]",syn._post.p());
60  }

References com.cliffc.aa.HM.HM8.hm().

Here is the call graph for this function:

◆ test05a()

void com.cliffc.aa.HM.TestHM8.test05a ( )

Definition at line 47 of file TestHM8.java.

47  {
48  Syntax syn = HM8.hm("id={x->x}; (pair (id 3) (id \"abc\"))");
49  assertEquals("(pair 3 \"abc\")",syn._t.p());
50  assertEquals("[]",syn._post.p());
51  }

References com.cliffc.aa.HM.HM8.hm().

Here is the call graph for this function:

◆ test06()

void com.cliffc.aa.HM.TestHM8.test06 ( )

Definition at line 63 of file TestHM8.java.

63  {
64  // recursive unification
65  Syntax syn = HM8.hm("{ f -> (f f) }");
66  assertEquals("{ A:{ $A -> B } -> B }",syn._t.p());
67  assertEquals("[]",syn._post.p());
68  // We can argue the pretty-print should print:
69  // "A:{ $A -> B }"
70  }

References com.cliffc.aa.HM.HM8.hm().

Here is the call graph for this function:

◆ test07()

void com.cliffc.aa.HM.TestHM8.test07 ( )

Definition at line 73 of file TestHM8.java.

73  {
74  Syntax syn = HM8.hm("g = {f -> 5}; (g g)");
75  assertEquals("5",syn._t.p());
76  assertEquals("[]",syn._post.p());
77  }

References com.cliffc.aa.HM.HM8.hm().

Here is the call graph for this function:

◆ test08()

void com.cliffc.aa.HM.TestHM8.test08 ( )

Definition at line 80 of file TestHM8.java.

80  {
81  // example that demonstrates generic and non-generic variables:
82  Syntax syn = HM8.hm("{ g -> f = { x -> g }; (pair (f 3) (f \"abc\"))}");
83  assertEquals("{ A -> (pair A A) }",syn._t.p());
84  assertEquals("[]",syn._post.p());
85  }

References com.cliffc.aa.HM.HM8.hm().

Here is the call graph for this function:

◆ test09()

void com.cliffc.aa.HM.TestHM8.test09 ( )

Definition at line 88 of file TestHM8.java.

88  {
89  Syntax syn = HM8.hm("{ f g -> (f g)}");
90  assertEquals("{ { A -> B } A -> B }",syn._t.p());
91  assertEquals("[]",syn._post.p());
92  }

References com.cliffc.aa.HM.HM8.hm().

Here is the call graph for this function:

◆ test10()

void com.cliffc.aa.HM.TestHM8.test10 ( )

Definition at line 95 of file TestHM8.java.

95  {
96  // Function composition
97  Syntax syn = HM8.hm("{ f g -> { arg -> (g (f arg))} }");
98  assertEquals("{ { A -> B } { B -> C } -> { A -> C } }",syn._t.p());
99  assertEquals("[]",syn._post.p());
100  }

References com.cliffc.aa.HM.HM8.hm().

Here is the call graph for this function:

◆ test11()

void com.cliffc.aa.HM.TestHM8.test11 ( )

Definition at line 103 of file TestHM8.java.

103  {
104  // Stacked functions ignoring all function arguments
105  Syntax syn = HM8.hm("map = { fun -> { x -> 2 } }; ((map 3) 5)");
106  assertEquals("2",syn._t.p());
107  assertEquals("[]",syn._post.p());
108  }

References com.cliffc.aa.HM.HM8.hm().

Here is the call graph for this function:

◆ test12()

void com.cliffc.aa.HM.TestHM8.test12 ( )

Definition at line 111 of file TestHM8.java.

111  {
112  // map takes a function and an element (collection?) and applies it (applies to collection?)
113  Syntax syn = HM8.hm("map = { fun -> { x -> (fun x)}}; { p -> 5 }");
114  assertEquals("{ A -> 5 }",syn._t.p());
115  assertEquals("[]",syn._post.p());
116  }

References com.cliffc.aa.HM.HM8.hm().

Here is the call graph for this function:

◆ test13()

void com.cliffc.aa.HM.TestHM8.test13 ( )

Definition at line 119 of file TestHM8.java.

119  {
120  // Looking at when tvars are duplicated ("fresh" copies made).
121  // This is the "map" problem with a scalar instead of a collection.
122  // Takes a '{a->b}' and a 'a' for a couple of different prims.
123  Syntax syn = HM8.hm("map = { fun -> { x -> (fun x)}};"+
124  "(pair ((map str) 5) ((map factor) 2.3))");
125  assertEquals("(pair str (divmod flt64 flt64))",syn._t.p());
126  assertEquals("[]",syn._post.p());
127  }

References com.cliffc.aa.HM.HM8.hm().

Here is the call graph for this function:

◆ test14()

void com.cliffc.aa.HM.TestHM8.test14 ( )

Definition at line 130 of file TestHM8.java.

130  {
131  // map takes a function and an element (collection?) and applies it (applies to collection?)
132  Syntax syn = HM8.hm("map = { fun x -> (fun x)}; (map {a->3} 5)");
133  assertEquals("3",syn._t.p());
134  assertEquals("[]",syn._post.p());
135  }

References com.cliffc.aa.HM.HM8.hm().

Here is the call graph for this function:

◆ test15()

void com.cliffc.aa.HM.TestHM8.test15 ( )

Definition at line 138 of file TestHM8.java.

138  {
139  // map takes a function and an element (collection?) and applies it (applies to collection?)
140  Syntax syn = HM8.hm("map = { fun x -> (fun x)}; (map { a-> (pair a a)} 5)");
141  assertEquals("(pair 5 5)",syn._t.p());
142  assertEquals("[]",syn._post.p());
143  }

References com.cliffc.aa.HM.HM8.hm().

Here is the call graph for this function:

◆ test16()

void com.cliffc.aa.HM.TestHM8.test16 ( )

Definition at line 146 of file TestHM8.java.

146  {
147  Syntax syn = HM8.hm("fcn = { p -> { a -> (pair a a) }};"+
148  "map = { fun x -> (fun x)};"+
149  "{ q -> (map (fcn q) 5)}");
150  assertEquals("{ A -> (pair 5 5) }",syn._t.p());
151  assertEquals("[]",syn._post.p());
152  }

References com.cliffc.aa.HM.HM8.hm().

Here is the call graph for this function:

◆ test17()

void com.cliffc.aa.HM.TestHM8.test17 ( )

Definition at line 155 of file TestHM8.java.

155  {
156  // Checking behavior when using "if" to merge two functions with
157  // sufficiently different signatures, then attempting to pass them to a map
158  // & calling internally.
159  // fcn takes a predicate 'p' and returns one of two fcns.
160  // let fcn = { p -> (if p {a -> pair[a,a ]}
161  // {b -> pair[b,pair[3,b]]}) } in
162  // map takes a function and an element (collection?) and applies it (applies to collection?)
163  // let map = { fun x -> (fun x) }
164  // in { q -> ((map (fcn q)) 5) }
165  // Should return { q -> q ? [5,5] : [5,[3,5]] }
166  // Ultimately, unifies "a" with "pair[3,a]" which throws recursive unification.
167  Syntax syn = HM8.hm("fcn = {p -> (if p {a -> (pair a a)} {b -> (pair b (pair 3 b))})};"+
168  "map = { fun x -> (fun x)};"+
169  "{ q -> (map (fcn q) 5)}");
170  assertEquals("{ A -> (pair Cannot unify $V123:(pair 3 $V123) and 5 Cannot unify $V123:(pair 3 $V123) and 5) }",syn._t.p());
171  assertEquals("[]",syn._post.p());
172  }

References com.cliffc.aa.HM.HM8.hm().

Here is the call graph for this function:

◆ test18()

void com.cliffc.aa.HM.TestHM8.test18 ( )

Definition at line 175 of file TestHM8.java.

175  {
176  Syntax syn = HM8.hm("cons ={x y-> {cadr -> (cadr x y)}};"+
177  "cdr ={mycons -> (mycons { p q -> q})};"+
178  "(cdr (cons 2 3))");
179  assertEquals("3",syn._t.p());
180  assertEquals("[]",syn._post.p());
181  }

References com.cliffc.aa.HM.HM8.hm().

Here is the call graph for this function:

◆ test19()

void com.cliffc.aa.HM.TestHM8.test19 ( )

Definition at line 191 of file TestHM8.java.

191  {
192  Syntax syn = HM8.hm("cons ={x y-> {cadr -> (cadr x y)}};"+
193  "cdr ={mycons -> (mycons { p q -> q})};"+
194  "map ={fun parg -> (fun (cdr parg))};"+
195  "(pair (map str (cons 0 5)) (map isempty (cons 0 \"abc\")))"
196  );
197  assertEquals("(pair str int1)",syn._t.p());
198  assertEquals("[]",syn._post.p());
199  }

References com.cliffc.aa.HM.HM8.hm().

Here is the call graph for this function:

◆ test20()

void com.cliffc.aa.HM.TestHM8.test20 ( )

Definition at line 203 of file TestHM8.java.

203  {
204  Syntax syn = HM8.hm("f0 = { f x -> (if (?0 x) 1 (f (f0 f (dec x)) 2))}; (f0 * 99)");
205  assertEquals("int64",syn._t.p());
206  assertEquals("[]",syn._post.p());
207  }

References com.cliffc.aa.HM.HM8.hm().

Here is the call graph for this function:

◆ test21()

void com.cliffc.aa.HM.TestHM8.test21 ( )

Definition at line 211 of file TestHM8.java.

211  {
212  // let f0 = fn f x => (if (?0 x) 1 (* (f0 f (dec x)) 2) ) in f0 f0 99
213  // let f0 = fn f x => (if (?0 x) 1 (f (f0 f (dec x)) 2) ) in f0 * 99
214  Syntax syn = HM8.hm("f0 = { f x -> (if (?0 x) 1 (* (f0 f (dec x)) 2))}; (f0 f0 99)");
215  assertEquals("int64",syn._t.p());
216  assertEquals("[]",syn._post.p());
217  }

References com.cliffc.aa.HM.HM8.hm().

Here is the call graph for this function:

◆ test22()

void com.cliffc.aa.HM.TestHM8.test22 ( )

Definition at line 221 of file TestHM8.java.

221  {
222  Syntax syn = HM8.hm("is_even = "+
223  " is_odd = { n -> (if (?0 n) 0 (is_even (dec n)))}; "+
224  " { n -> (if (?0 n) 1 (is_odd (dec n)))};"+
225  "(is_even 3)"
226  );
227  assertEquals("int1",syn._t.p());
228  assertEquals("[]",syn._post.p());
229  }

References com.cliffc.aa.HM.HM8.hm().

Here is the call graph for this function:

◆ test23()

void com.cliffc.aa.HM.TestHM8.test23 ( )

Definition at line 233 of file TestHM8.java.

233  {
234  Syntax syn = HM8.hm("{ g -> fgz = "+
235  " cons = {x y -> {cadr -> (cadr x y)}};"+
236  " cdr = {mycons -> (mycons { p q -> q})};"+
237  " (cdr (cons 2 { z -> (g z) }));"+
238  " (pair (fgz 3) (fgz 5))"+
239  "}"
240  );
241  assertEquals("{ { nint8 -> A } -> (pair A A) }",syn._t.p());
242  assertEquals("[]",syn._post.p());
243  }

References com.cliffc.aa.HM.HM8.hm().

Here is the call graph for this function:

◆ test24()

void com.cliffc.aa.HM.TestHM8.test24 ( )

Definition at line 247 of file TestHM8.java.

247  {
248  Syntax syn = HM8.hm("@{x=2, y=3}");
249  assertEquals("*[7]@{ x = 2, y = 3}",syn._t.p());
250  assertEquals("[ 7:*[7]@{ x = 2, y = 3}]",syn._post.p());
251  }

References com.cliffc.aa.HM.HM8.hm().

Here is the call graph for this function:

◆ test25()

void com.cliffc.aa.HM.TestHM8.test25 ( )

Definition at line 255 of file TestHM8.java.

255  {
256  Syntax syn = HM8.hm(".x @{x =2, y =3}");
257  assertEquals("2",syn._t.p());
258  assertEquals("[ 7:*[7]@{ x = 2, y = 3}]",syn._post.p());
259  }

References com.cliffc.aa.HM.HM8.hm().

Here is the call graph for this function:

◆ test25a()

void com.cliffc.aa.HM.TestHM8.test25a ( )

Definition at line 263 of file TestHM8.java.

263  {
264  Syntax syn = HM8.hm(".x 5");
265  assertEquals("Cannot unify *[-2]@{ x = V24} and 5",syn._t.p());
266  assertEquals("[]",syn._post.p());
267  }

References com.cliffc.aa.HM.HM8.hm().

Here is the call graph for this function:

◆ test25b()

void com.cliffc.aa.HM.TestHM8.test25b ( )

Definition at line 271 of file TestHM8.java.

271  {
272  Syntax syn = HM8.hm(".x @{ y =3}");
273  assertEquals("Missing field x in *[7]@{ y = 3, x = all}",syn._t.p());
274  assertEquals("[ 7:*[7]@{ y = 3, x = Missing field x in *[7]@{ y = 3, x = all}}]",syn._post.p());
275  }

References com.cliffc.aa.HM.HM8.hm().

Here is the call graph for this function:

◆ test26()

void com.cliffc.aa.HM.TestHM8.test26 ( )

Definition at line 278 of file TestHM8.java.

278  {
279  Syntax syn = HM8.hm("{ g -> @{x=g, y=g}}");
280  assertEquals("{ A -> *[7]@{ x = A, y = A} }",syn._t.p());
281  assertEquals("[ 7:*[7]@{ x = A, y = A}]",syn._post.p());
282  }

References com.cliffc.aa.HM.HM8.hm().

Here is the call graph for this function:

◆ test27()

void com.cliffc.aa.HM.TestHM8.test27 ( )

Definition at line 285 of file TestHM8.java.

285  {
286  // Load common field 'x', ignoring mismatched fields y and z
287  Syntax syn = HM8.hm("{ pred -> .x (if pred @{x=2,y=3} @{x=3,z= \"abc\"}) }");
288  assertEquals("{ A -> nint8 }",syn._t.p());
289  assertEquals("[ 7:A:*[7,8]@{ x = nint8, z = all, y = all}, 8:$A]",syn._post.p());
290  }

References com.cliffc.aa.HM.HM8.hm().

Here is the call graph for this function:

◆ test28()

void com.cliffc.aa.HM.TestHM8.test28 ( )

Definition at line 293 of file TestHM8.java.

293  {
294  // Load some fields from an unknown struct: area of a square.
295  // Since no nil-check, correctly types as needing a not-nil input.
296  Syntax syn = HM8.hm("{ sq -> (* .x sq .y sq) }"); // { sq -> sq.x * sq.y }
297  assertEquals("{ *[-2]@{ y = int64, x = int64} -> int64 }",syn._t.p());
298  assertEquals("[]",syn._post.p());
299  }

References com.cliffc.aa.HM.HM8.hm().

Here is the call graph for this function:

◆ test29()

void com.cliffc.aa.HM.TestHM8.test29 ( )

Definition at line 302 of file TestHM8.java.

302  {
303  // Recursive linked-list discovery, with no end clause
304  Syntax syn = HM8.hm("map = { fcn lst -> @{ n1 = (map fcn .n0 lst), v1 = (fcn .v0 lst) } }; map");
305  assertEquals("{ { A -> B } C:*[-2]@{ v0 = A, n0 = $C} -> D:*[7]@{ n1 = $D, v1 = B} }",syn._t.p());
306  assertEquals("[ 7:A:*[7]@{ n1 = $A, v1 = B}]",syn._post.p());
307  }

References com.cliffc.aa.HM.HM8.hm().

Here is the call graph for this function:

◆ test30()

void com.cliffc.aa.HM.TestHM8.test30 ( )

Definition at line 310 of file TestHM8.java.

310  {
311  // Recursive linked-list discovery, with nil. Note that the output memory
312  // has the output memory alias, but not the input memory alias (which must
313  // be made before calling 'map').
314  Syntax syn = HM8.hm("map = { fcn lst -> (if lst @{ n1=(map fcn .n0 lst), v1=(fcn .v0 lst) } nil) }; map");
315  assertEquals("{ { A -> B } C:*[-2]@{ v0 = A, n0 = $C}? -> D:*[7]@{ n1 = $D, v1 = B}? }",syn._t.p());
316  assertEquals("[ 7:A:*[7]@{ n1 = $A, v1 = B}?]",syn._post.p());
317  }

References com.cliffc.aa.HM.HM8.hm().

Here is the call graph for this function:

◆ test30a()

void com.cliffc.aa.HM.TestHM8.test30a ( )

Definition at line 320 of file TestHM8.java.

320  {
321  // Recursive linked-list discovery, with no end clause
322  Syntax syn = HM8.hm("map = { fcn lst -> (if lst @{ n1 = (map fcn .n0 lst), v1 = (fcn .v0 lst) } nil) }; (map dec @{n0 = nil, v0 = 5})");
323  assertEquals("A:*[7]@{ n1 = $A, v1 = int64}?",syn._t.p());
324  assertEquals("[ 7:A:*[7]@{ n1 = $A, v1 = B}?, 8:*[8]@{ n0 = (Nil), v0 = int64}?]",syn._post.p());
325  }

References com.cliffc.aa.HM.HM8.hm().

Here is the call graph for this function:

◆ test31()

void com.cliffc.aa.HM.TestHM8.test31 ( )

Definition at line 329 of file TestHM8.java.

329  {
330  // Recursive linked-list discovery, with nil
331  Syntax syn = HM8.hm("p0 = { x y z -> (triple x y z) };"+
332  "p1 = (triple p0 p0 p0);"+
333  "p2 = (triple p1 p1 p1);"+
334  "p3 = (triple p2 p2 p2);"+
335  "p3");
336  assertEquals("(triple (triple (triple { A B C -> (triple A B C) } { D E F -> (triple D E F) } { G H I -> (triple G H I) }) (triple { J K L -> (triple J K L) } { M N O -> (triple M N O) } { P Q R -> (triple P Q R) }) (triple { S T U -> (triple S T U) } { V21 V22 V23 -> (triple V21 V22 V23) } { V24 V25 V26 -> (triple V24 V25 V26) })) (triple (triple { V27 V28 V29 -> (triple V27 V28 V29) } { V30 V31 V32 -> (triple V30 V31 V32) } { V33 V34 V35 -> (triple V33 V34 V35) }) (triple { V36 V37 V38 -> (triple V36 V37 V38) } { V39 V40 V41 -> (triple V39 V40 V41) } { V42 V43 V44 -> (triple V42 V43 V44) }) (triple { V45 V46 V47 -> (triple V45 V46 V47) } { V48 V49 V50 -> (triple V48 V49 V50) } { V51 V52 V53 -> (triple V51 V52 V53) })) (triple (triple { V54 V55 V56 -> (triple V54 V55 V56) } { V57 V58 V59 -> (triple V57 V58 V59) } { V60 V61 V62 -> (triple V60 V61 V62) }) (triple { V63 V64 V65 -> (triple V63 V64 V65) } { V66 V67 V68 -> (triple V66 V67 V68) } { V69 V70 V71 -> (triple V69 V70 V71) }) (triple { V72 V73 V74 -> (triple V72 V73 V74) } { V75 V76 V77 -> (triple V75 V76 V77) } { V78 V79 V80 -> (triple V78 V79 V80) })))",syn._t.p());
337  assertEquals("[]",syn._post.p());
338  }

References com.cliffc.aa.HM.HM8.hm().

Here is the call graph for this function:

◆ test32()

void com.cliffc.aa.HM.TestHM8.test32 ( )

Definition at line 343 of file TestHM8.java.

343  {
344  // Recursive linked-list discovery, with nil. Unrolled once.
345  Syntax syn = HM8.hm("map = { lst -> (if lst @{ n1= arg= .n0 lst; (if arg @{ n1=(map .n0 arg), v1=(str .v0 arg)} nil), v1=(str .v0 lst) } nil) }; map");
346  assertEquals("{ A:*[-2]@{ v0 = int64, n0 = *[-2]@{ n0 = $A, v0 = int64}?}? -> B:*[8]@{ n1 = *[7]@{ n1 = $B, v1 = str}?, v1 = str}? }",syn._t.p());
347  assertEquals("[ 7:A:*[7]@{ n1 = B:*[8]@{ n1 = $A, v1 = str}?, v1 = str}?, 8:$B]",syn._post.p());
348  }

References com.cliffc.aa.HM.HM8.hm().

Here is the call graph for this function:

◆ test33()

void com.cliffc.aa.HM.TestHM8.test33 ( )

Definition at line 351 of file TestHM8.java.

351  {
352  Syntax syn = HM8.hm("x = { y -> (x (y y))}; x");
353  assertEquals("{ A:{ $A -> $A } -> B }",syn._t.p());
354  assertEquals("[]",syn._post.p());
355  }

References com.cliffc.aa.HM.HM8.hm().

Here is the call graph for this function:

◆ test34()

void com.cliffc.aa.HM.TestHM8.test34 ( )

Definition at line 358 of file TestHM8.java.

358  {
359  // Example from SimpleSub requiring 'x' to be both a struct with field
360  // 'v', and also a function type - specifically disallowed in 'aa'.
361  Syntax syn = HM8.hm("{ x -> y = ( x .v x ); 0}");
362  assertEquals("{ Cannot unify *[-2]@{ v = V40} and { V40 -> V34 } -> 0 }",syn._t.p());
363  assertEquals("[]",syn._post.p());
364  }

References com.cliffc.aa.HM.HM8.hm().

Here is the call graph for this function:

◆ test35()

void com.cliffc.aa.HM.TestHM8.test35 ( )

Definition at line 367 of file TestHM8.java.

367  {
368  Syntax syn = HM8.hm("x = { z -> z}; (x { y -> .u y})");
369  assertEquals("{ *[-2]@{ u = A} -> A }",syn._t.p());
370  assertEquals("[]",syn._post.p());
371  }

References com.cliffc.aa.HM.HM8.hm().

Here is the call graph for this function:

◆ test36()

void com.cliffc.aa.HM.TestHM8.test36 ( )

Definition at line 374 of file TestHM8.java.

374  {
375  // Example from SimpleSub requiring 'x' to be both:
376  // - a recursive self-call function from "w = (x x)": $V66:{ $V66 -> V67 } AND
377  // - a function which takes a struct with field 'u'
378  // The first arg to x is two different kinds of functions, so fails unification.
379  Syntax syn = HM8.hm("x = w = (x x); { z -> z}; (x { y -> .u y})");
380  assertEquals("Cannot unify $V66:{ $V66 -> V67 } and *[-2]@{ u = V39}",syn._t.p());
381  assertEquals("[]",syn._post.p());
382  }

References com.cliffc.aa.HM.HM8.hm().

Here is the call graph for this function:

The documentation for this class was generated from the following file: