aa
com.cliffc.aa.HM.TestHM9 Class Reference
Collaboration diagram for com.cliffc.aa.HM.TestHM9:
[legend]

Public Member Functions

void reset ()
 
void test00 ()
 
void test01 ()
 
void test02 ()
 
void test03 ()
 
void test04 ()
 
void test05 ()
 
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 test26 ()
 
void test27 ()
 
void test28 ()
 
void test29 ()
 
void test30 ()
 
void test31 ()
 
void test32 ()
 
void test33 ()
 
void test34 ()
 
void test35 ()
 
void test36 ()
 
void test37 ()
 
void test38 ()
 
void test39 ()
 
void test40 ()
 
void test41 ()
 
void test42 ()
 
void test43 ()
 
void test44 ()
 
void test45 ()
 
void test46 ()
 
void test47 ()
 
void test48 ()
 
void test49 ()
 
void test50 ()
 

Private Member Functions

void run (String prog, String rez_hm, Type rez_gcp)
 

Static Private Member Functions

static TypeMemPtr build_cycle (int alias, boolean nil, Type fld)
 
static TypeFunSig tfs (Type ret)
 

Static Private Attributes

static final String[] N1V1 = new String[]{"^","n1","v1"}
 
static final TypeFunSig ret_tuple2 = tfs(tuple2)
 
static final TypeMemPtr tuple2 = TypeMemPtr.make(7,TypeStruct.make(Type.SCALAR, Type.SCALAR ))
 
static final TypeMemPtr tuple55 = TypeMemPtr.make(7,TypeStruct.make(TypeInt.con(5),TypeInt.con(5)))
 
static final TypeMemPtr tuple82 = TypeMemPtr.make(7,TypeStruct.make(TypeInt.NINT8, TypeInt.NINT8 ))
 
static final TypeMemPtr tuple9 = TypeMemPtr.make(9,TypeStruct.make(TypeStruct.flds(Type.SCALAR,Type.SCALAR)))
 
static final TypeMemPtr tuplen2 = TypeMemPtr.make(7,TypeStruct.make(Type.NSCALR, Type.NSCALR ))
 
static final String[] XY = new String[]{"^","x","y"}
 

Detailed Description

Definition at line 12 of file TestHM9.java.

Member Function Documentation

◆ build_cycle()

static TypeMemPtr com.cliffc.aa.HM.TestHM9.build_cycle ( int  alias,
boolean  nil,
Type  fld 
)
staticprivate

Definition at line 239 of file TestHM9.java.

239  {
240  // Build a cycle of length 2.
241  BitsAlias aliases = BitsAlias.make0(alias);
242  if( nil ) aliases = aliases.meet_nil();
243  TypeMemPtr cycle_ptr0 = TypeMemPtr.make(aliases,TypeObj.XOBJ);
244  TypeStruct cycle_str1 = TypeStruct.make(TypeFld.NO_DISP,TypeFld.malloc("n1",cycle_ptr0,1),TypeFld.malloc("v1",fld,1));
245  TypeMemPtr cycle_ptr1 = TypeMemPtr.make(aliases,cycle_str1);
246  TypeStruct cycle_str2 = TypeStruct.make(TypeFld.NO_DISP,TypeFld.malloc("n1",cycle_ptr1,1),TypeFld.malloc("v1",fld,1));
247  TypeStruct cycle_strn = cycle_str2.approx(1,alias);
248  TypeMemPtr cycle_ptrn = (TypeMemPtr)cycle_strn.at(1);
249  return cycle_ptrn;
250  }

References com.cliffc.aa.type.TypeStruct.approx(), com.cliffc.aa.type.TypeStruct.at(), com.cliffc.aa.type.TypeMemPtr.make(), com.cliffc.aa.type.TypeStruct.make(), com.cliffc.aa.type.BitsAlias.make0(), com.cliffc.aa.type.TypeFld.malloc(), com.cliffc.aa.type.Bits< B extends Bits< B >.meet_nil(), com.cliffc.aa.type.TypeFld.NO_DISP, and com.cliffc.aa.type.TypeObj< O extends TypeObj< O >.XOBJ.

Referenced by com.cliffc.aa.HM.TestHM9.test32(), com.cliffc.aa.HM.TestHM9.test33(), and com.cliffc.aa.HM.TestHM9.test34().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reset()

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

Definition at line 14 of file TestHM9.java.

14 { HM.reset(); }

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

Here is the call graph for this function:

◆ run()

void com.cliffc.aa.HM.TestHM9.run ( String  prog,
String  rez_hm,
Type  rez_gcp 
)
private

Definition at line 16 of file TestHM9.java.

16  {
17  Root syn = HM9.hm(prog);
18  if( HM.DO_HM )
19  assertEquals(rez_hm,syn._hmt.p());
20  if( HM.DO_GCP )
21  assertEquals(rez_gcp,syn.flow_type());
22  }

References com.cliffc.aa.HM.HM.Syntax._hmt, com.cliffc.aa.HM.HM.DO_GCP, com.cliffc.aa.HM.HM.DO_HM, com.cliffc.aa.HM.HM.Root.flow_type(), com.cliffc.aa.HM.HM9.hm(), and com.cliffc.aa.HM.HM.T2.p().

Referenced by com.cliffc.aa.HM.TestHM9.test00(), com.cliffc.aa.HM.TestHM9.test01(), com.cliffc.aa.HM.TestHM9.test02(), com.cliffc.aa.HM.TestHM9.test03(), com.cliffc.aa.HM.TestHM9.test04(), com.cliffc.aa.HM.TestHM9.test07(), com.cliffc.aa.HM.TestHM9.test08(), com.cliffc.aa.HM.TestHM9.test09(), com.cliffc.aa.HM.TestHM9.test10(), com.cliffc.aa.HM.TestHM9.test11(), com.cliffc.aa.HM.TestHM9.test12(), com.cliffc.aa.HM.TestHM9.test13(), com.cliffc.aa.HM.TestHM9.test15(), com.cliffc.aa.HM.TestHM9.test16(), com.cliffc.aa.HM.TestHM9.test17(), com.cliffc.aa.HM.TestHM9.test19(), com.cliffc.aa.HM.TestHM9.test21(), com.cliffc.aa.HM.TestHM9.test22(), com.cliffc.aa.HM.TestHM9.test23(), com.cliffc.aa.HM.TestHM9.test24(), com.cliffc.aa.HM.TestHM9.test25(), com.cliffc.aa.HM.TestHM9.test26(), com.cliffc.aa.HM.TestHM9.test27(), com.cliffc.aa.HM.TestHM9.test28(), com.cliffc.aa.HM.TestHM9.test29(), com.cliffc.aa.HM.TestHM9.test30(), com.cliffc.aa.HM.TestHM9.test31(), com.cliffc.aa.HM.TestHM9.test35(), com.cliffc.aa.HM.TestHM9.test37(), com.cliffc.aa.HM.TestHM9.test38(), com.cliffc.aa.HM.TestHM9.test46(), com.cliffc.aa.HM.TestHM9.test47(), and com.cliffc.aa.HM.TestHM9.test48().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ test00()

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

Definition at line 38 of file TestHM9.java.

38 { run( "fred",null,null); }

References com.cliffc.aa.HM.TestHM9.run().

Here is the call graph for this function:

◆ test01()

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

Definition at line 40 of file TestHM9.java.

40  { run( "3" ,
41  "3", TypeInt.con(3)); }

References com.cliffc.aa.type.TypeInt.con(), and com.cliffc.aa.HM.TestHM9.run().

Here is the call graph for this function:

◆ test02()

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

Definition at line 43 of file TestHM9.java.

43  { run( "(pair1 3)" ,
44  "{ A -> ( 3, $A)[7] }", tfs(TypeMemPtr.make(7,TypeStruct.make(TypeInt.con(3),Type.SCALAR)))); }

References com.cliffc.aa.type.TypeInt.con(), com.cliffc.aa.type.TypeMemPtr.make(), com.cliffc.aa.type.TypeStruct.make(), com.cliffc.aa.HM.TestHM9.run(), com.cliffc.aa.type.Type< T extends Type< T >.SCALAR, and com.cliffc.aa.HM.TestHM9.tfs().

Here is the call graph for this function:

◆ test03()

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

Definition at line 46 of file TestHM9.java.

46  { run( "{ z -> (pair (z 0) (z \"abc\")) }" ,
47  "{ { *[0,4]\"abc\"? -> A } -> ( $A, $A)[7] }", tfs(tuple2)); }

References com.cliffc.aa.HM.TestHM9.run(), com.cliffc.aa.HM.TestHM9.tfs(), and com.cliffc.aa.HM.TestHM9.tuple2.

Here is the call graph for this function:

◆ test04()

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

Definition at line 49 of file TestHM9.java.

49  { run( "fact = { n -> (if (?0 n) 1 (* n (fact (dec n))))}; fact",
50  "{ int64 -> int64 }", tfs(TypeInt.INT64) ); }

References com.cliffc.aa.type.TypeInt.INT64, com.cliffc.aa.HM.TestHM9.run(), and com.cliffc.aa.HM.TestHM9.tfs().

Here is the call graph for this function:

◆ test05()

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

Definition at line 54 of file TestHM9.java.

54  {
55  Root syn = HM9.hm("({ x -> (pair (x 3) (x 5)) } {y->y})");
56  if( HM.DO_HM )
57  assertEquals("( nint8, nint8)[7]",syn._hmt.p());
58  if( HM.DO_GCP )
59  if( HM.DO_HM )
60  assertEquals(tuple82,syn.flow_type());
61  else
62  assertEquals(tuple82,syn.flow_type());
63  }

References com.cliffc.aa.HM.HM.Syntax._hmt, com.cliffc.aa.HM.HM.DO_GCP, com.cliffc.aa.HM.HM.DO_HM, com.cliffc.aa.HM.HM.Root.flow_type(), com.cliffc.aa.HM.HM9.hm(), com.cliffc.aa.HM.HM.T2.p(), and com.cliffc.aa.HM.TestHM9.tuple82.

Here is the call graph for this function:

◆ test06()

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

Definition at line 65 of file TestHM9.java.

65  {
66  Root syn = HM9.hm("id={x->x}; (pair (id 3) (id \"abc\"))");
67  if( HM.DO_HM ) // HM is sharper here than in test05, because id is generalized per each use site
68  assertEquals("( 3, *[4]\"abc\")[7]",syn._hmt.p());
69  if( HM.DO_GCP )
70  if( HM.DO_HM )
71  assertEquals(TypeMemPtr.make(7,TypeStruct.make(TypeInt.con(3),TypeMemPtr.make(4,TypeStr.ABC))),syn.flow_type());
72  else
73  assertEquals(tuplen2,syn.flow_type());
74  }

References com.cliffc.aa.HM.HM.Syntax._hmt, com.cliffc.aa.type.TypeStr.ABC, com.cliffc.aa.type.TypeInt.con(), com.cliffc.aa.HM.HM.DO_GCP, com.cliffc.aa.HM.HM.DO_HM, com.cliffc.aa.HM.HM.Root.flow_type(), com.cliffc.aa.HM.HM9.hm(), com.cliffc.aa.type.TypeMemPtr.make(), com.cliffc.aa.type.TypeStruct.make(), com.cliffc.aa.HM.HM.T2.p(), and com.cliffc.aa.HM.TestHM9.tuplen2.

Here is the call graph for this function:

◆ test07()

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

Definition at line 77 of file TestHM9.java.

77  { run( "{ f -> (f f) }",
78  // We can argue the pretty-print should print:
79  // " A:{ $A -> B }"
80  "{ A:{ $A -> B } -> $B }", tfs(Type.SCALAR) ); }

References com.cliffc.aa.HM.TestHM9.run(), com.cliffc.aa.type.Type< T extends Type< T >.SCALAR, and com.cliffc.aa.HM.TestHM9.tfs().

Here is the call graph for this function:

◆ test08()

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

Definition at line 82 of file TestHM9.java.

82  { run( "g = {f -> 5}; (g g)",
83  "5", TypeInt.con(5)); }

References com.cliffc.aa.type.TypeInt.con(), and com.cliffc.aa.HM.TestHM9.run().

Here is the call graph for this function:

◆ test09()

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

Definition at line 86 of file TestHM9.java.

86  { run( "{ g -> f = { x -> g }; (pair (f 3) (f \"abc\"))}",
87  "{ A -> ( $A, $A)[7] }", ret_tuple2); }

References com.cliffc.aa.HM.TestHM9.ret_tuple2, and com.cliffc.aa.HM.TestHM9.run().

Here is the call graph for this function:

◆ test10()

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

Definition at line 89 of file TestHM9.java.

89  { run( "{ f g -> (f g)}",
90  "{ { A -> B } $A -> $B }", tfs(Type.SCALAR) ); }

References com.cliffc.aa.HM.TestHM9.run(), com.cliffc.aa.type.Type< T extends Type< T >.SCALAR, and com.cliffc.aa.HM.TestHM9.tfs().

Here is the call graph for this function:

◆ test11()

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

Definition at line 93 of file TestHM9.java.

93  { run( "{ f g -> { arg -> (g (f arg))} }",
94  "{ { A -> B } { $B -> C } -> { $A -> $C } }", tfs(tfs(Type.SCALAR))); }

References com.cliffc.aa.HM.TestHM9.run(), com.cliffc.aa.type.Type< T extends Type< T >.SCALAR, and com.cliffc.aa.HM.TestHM9.tfs().

Here is the call graph for this function:

◆ test12()

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

Definition at line 97 of file TestHM9.java.

97  { run( "map = { fun -> { x -> 2 } }; ((map 3) 5)",
98  "2", TypeInt.con(2)); }

References com.cliffc.aa.type.TypeInt.con(), and com.cliffc.aa.HM.TestHM9.run().

Here is the call graph for this function:

◆ test13()

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

Definition at line 101 of file TestHM9.java.

101  { run( "map = { fun -> { x -> (fun x)}}; { p -> 5 }",
102  "{ A -> 5 }", tfs(TypeInt.con(5))); }

References com.cliffc.aa.type.TypeInt.con(), com.cliffc.aa.HM.TestHM9.run(), and com.cliffc.aa.HM.TestHM9.tfs().

Here is the call graph for this function:

◆ test14()

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

Definition at line 107 of file TestHM9.java.

107  {
108  Root syn = HM9.hm("map = { fun -> { x -> (fun x)}};"+
109  "(pair ((map str) 5) ((map factor) 2.3))");
110  if( HM.DO_HM )
111  assertEquals("( *[4]str, flt64)[7]",syn._hmt.p());
112  if( HM.DO_GCP )
113  if( HM.DO_HM )
114  assertEquals(TypeMemPtr.make(7,TypeStruct.make(TypeMemPtr.STRPTR,TypeFlt.FLT64)),syn.flow_type());
115  else
116  assertEquals(tuple2,syn.flow_type());
117  }

References com.cliffc.aa.HM.HM.Syntax._hmt, com.cliffc.aa.HM.HM.DO_GCP, com.cliffc.aa.HM.HM.DO_HM, com.cliffc.aa.HM.HM.Root.flow_type(), com.cliffc.aa.type.TypeFlt.FLT64, com.cliffc.aa.HM.HM9.hm(), com.cliffc.aa.type.TypeMemPtr.make(), com.cliffc.aa.type.TypeStruct.make(), com.cliffc.aa.HM.HM.T2.p(), com.cliffc.aa.type.TypeMemPtr.STRPTR, and com.cliffc.aa.HM.TestHM9.tuple2.

Here is the call graph for this function:

◆ test15()

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

Definition at line 120 of file TestHM9.java.

120  { run("map = { fun x -> (fun x)}; (map {a->3} 5)",
121  "3", TypeInt.con(3)); }

References com.cliffc.aa.type.TypeInt.con(), and com.cliffc.aa.HM.TestHM9.run().

Here is the call graph for this function:

◆ test16()

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

Definition at line 124 of file TestHM9.java.

124  { run("map = { fun x -> (fun x)}; (map { a-> (pair a a)} 5)",
125  "( 5, 5)[7]", tuple55); }

References com.cliffc.aa.HM.TestHM9.run(), and com.cliffc.aa.HM.TestHM9.tuple55.

Here is the call graph for this function:

◆ test17()

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

Definition at line 127 of file TestHM9.java.

127  { run("fcn = { p -> { a -> (pair a a) }};"+
128  "map = { fun x -> (fun x)};"+
129  "{ q -> (map (fcn q) 5)}",
130  "{ A -> ( 5, 5)[7] }", tfs(tuple55)); }

References com.cliffc.aa.HM.TestHM9.run(), com.cliffc.aa.HM.TestHM9.tfs(), and com.cliffc.aa.HM.TestHM9.tuple55.

Here is the call graph for this function:

◆ test18()

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

Definition at line 142 of file TestHM9.java.

142  {
143  Root syn = HM9.hm("fcn = {p -> (if p {a -> (pair a a)} {b -> (pair b (pair 3 b))})};"+
144  "map = { fun x -> (fun x)};"+
145  "{ q -> (map (fcn q) 5)}");
146  if( HM.DO_HM )
147  assertEquals("{ A -> ( B:Cannot unify A:( 3, $A)[7] and 5, $B)[7] }",syn._hmt.p());
148  if( HM.DO_GCP )
149  if( HM.DO_HM )
150  assertEquals(tfs(TypeMemPtr.make(7,TypeStruct.make(Type.XNSCALR,TypeMemPtr.make(7,TypeStruct.make(TypeInt.con(3),Type.XNSCALR))))),syn.flow_type());
151  else
152  assertEquals(tfs(TypeMemPtr.make(7,TypeStruct.make(TypeInt.con(5),Type.NSCALR))),syn.flow_type());
153  }

References com.cliffc.aa.HM.HM.Syntax._hmt, com.cliffc.aa.type.TypeInt.con(), com.cliffc.aa.HM.HM.DO_GCP, com.cliffc.aa.HM.HM.DO_HM, com.cliffc.aa.HM.HM.Root.flow_type(), com.cliffc.aa.HM.HM9.hm(), com.cliffc.aa.type.TypeMemPtr.make(), com.cliffc.aa.type.TypeStruct.make(), com.cliffc.aa.type.Type< T extends Type< T >.NSCALR, com.cliffc.aa.HM.HM.T2.p(), com.cliffc.aa.HM.TestHM9.tfs(), and com.cliffc.aa.type.Type< T extends Type< T >.XNSCALR.

Here is the call graph for this function:

◆ test19()

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

Definition at line 155 of file TestHM9.java.

155  { run("cons ={x y-> {cadr -> (cadr x y)}};"+
156  "cdr ={mycons -> (mycons { p q -> q})};"+
157  "(cdr (cons 2 3))",
158  "3", TypeInt.con(3)); }

References com.cliffc.aa.type.TypeInt.con(), and com.cliffc.aa.HM.TestHM9.run().

Here is the call graph for this function:

◆ test20()

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

Definition at line 167 of file TestHM9.java.

167  {
168  Root syn = HM9.hm("cons ={x y-> {cadr -> (cadr x y)}};"+
169  "cdr ={mycons -> (mycons { p q -> q})};"+
170  "map ={fun parg -> (fun (cdr parg))};"+
171  "(pair (map str (cons 0 5)) (map isempty (cons 0 \"abc\")))");
172  if( HM.DO_HM )
173  assertEquals("( *[4]str, int1)[7]",syn._hmt.p());
174  if( HM.DO_GCP )
175  if( HM.DO_HM )
176  assertEquals(TypeMemPtr.make(7,TypeStruct.make(TypeMemPtr.STRPTR,TypeInt.BOOL)),syn.flow_type());
177  else
178  assertEquals(tuple2,syn.flow_type());
179  }

References com.cliffc.aa.HM.HM.Syntax._hmt, com.cliffc.aa.type.TypeInt.BOOL, com.cliffc.aa.HM.HM.DO_GCP, com.cliffc.aa.HM.HM.DO_HM, com.cliffc.aa.HM.HM.Root.flow_type(), com.cliffc.aa.HM.HM9.hm(), com.cliffc.aa.type.TypeMemPtr.make(), com.cliffc.aa.type.TypeStruct.make(), com.cliffc.aa.HM.HM.T2.p(), com.cliffc.aa.type.TypeMemPtr.STRPTR, and com.cliffc.aa.HM.TestHM9.tuple2.

Here is the call graph for this function:

◆ test21()

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

Definition at line 182 of file TestHM9.java.

182  { run("f0 = { f x -> (if (?0 x) 1 (f (f0 f (dec x)) 2))}; (f0 * 99)",
183  "int64", TypeInt.INT64); }

References com.cliffc.aa.type.TypeInt.INT64, and com.cliffc.aa.HM.TestHM9.run().

Here is the call graph for this function:

◆ test22()

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

Definition at line 188 of file TestHM9.java.

188  { run("f0 = { f x -> (if (?0 x) 1 (* (f0 f (dec x)) 2))}; (f0 f0 99)",
189  "int64", TypeInt.INT64); }

References com.cliffc.aa.type.TypeInt.INT64, and com.cliffc.aa.HM.TestHM9.run().

Here is the call graph for this function:

◆ test23()

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

Definition at line 192 of file TestHM9.java.

192  { run("is_even = "+
193  " is_odd = { n -> (if (?0 n) 0 (is_even (dec n)))}; "+
194  " { n -> (if (?0 n) 1 (is_odd (dec n)))};"+
195  "(is_even 3)" ,
196  "int1", TypeInt.BOOL); }

References com.cliffc.aa.type.TypeInt.BOOL, and com.cliffc.aa.HM.TestHM9.run().

Here is the call graph for this function:

◆ test24()

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

Definition at line 199 of file TestHM9.java.

199  { run("{ g -> fgz = "+
200  " cons = {x y -> {cadr -> (cadr x y)}};"+
201  " cdr = {mycons -> (mycons { p q -> q})};"+
202  " (cdr (cons 2 { z -> (g z) }));"+
203  " (pair (fgz 3) (fgz 5))"+
204  "}"
205  ,
206  "{ { nint8 -> A } -> ( $A, $A)[7] }", tfs(tuple2)); }

References com.cliffc.aa.HM.TestHM9.run(), com.cliffc.aa.HM.TestHM9.tfs(), and com.cliffc.aa.HM.TestHM9.tuple2.

Here is the call graph for this function:

◆ test25()

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

Definition at line 209 of file TestHM9.java.

209  { run("@{x=2, y=3}",
210  "@{ x = 2, y = 3}[9]",
212  ); }

References com.cliffc.aa.type.TypeInt.con(), com.cliffc.aa.type.TypeStruct.flds(), com.cliffc.aa.type.TypeMemPtr.make(), com.cliffc.aa.type.TypeStruct.make(), and com.cliffc.aa.HM.TestHM9.run().

Here is the call graph for this function:

◆ test26()

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

Definition at line 215 of file TestHM9.java.

215  { run(".x @{x =2, y =3}",
216  "2", TypeInt.con(2)); }

References com.cliffc.aa.type.TypeInt.con(), and com.cliffc.aa.HM.TestHM9.run().

Here is the call graph for this function:

◆ test27()

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

Definition at line 219 of file TestHM9.java.

219  { run(".x 5",
220  "Missing field x in 5", Type.SCALAR); }

References com.cliffc.aa.HM.TestHM9.run(), and com.cliffc.aa.type.Type< T extends Type< T >.SCALAR.

Here is the call graph for this function:

◆ test28()

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

Definition at line 223 of file TestHM9.java.

223  { run(".x @{ y =3}",
224  "Missing field x in @{ y = 3}[9]",
225  Type.SCALAR); }

References com.cliffc.aa.HM.TestHM9.run(), and com.cliffc.aa.type.Type< T extends Type< T >.SCALAR.

Here is the call graph for this function:

◆ test29()

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

Definition at line 227 of file TestHM9.java.

227  { run("{ g -> @{x=g, y=g}}",
228  "{ A -> @{ x = $A, y = $A}[9] }", tfs(tuple9)); }

References com.cliffc.aa.HM.TestHM9.run(), com.cliffc.aa.HM.TestHM9.tfs(), and com.cliffc.aa.HM.TestHM9.tuple9.

Here is the call graph for this function:

◆ test30()

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

Definition at line 231 of file TestHM9.java.

231  { run("{ pred -> .x (if pred @{x=2,y=3} @{x=3,z= \"abc\"}) }",
232  "{ A -> nint8 }", tfs(TypeInt.NINT8)); }

References com.cliffc.aa.type.TypeInt.NINT8, com.cliffc.aa.HM.TestHM9.run(), and com.cliffc.aa.HM.TestHM9.tfs().

Here is the call graph for this function:

◆ test31()

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

Definition at line 236 of file TestHM9.java.

236  { run("{ sq -> (* .x sq .y sq) }", // { sq -> sq.x * sq.y }
237  "{ @{ x = int64, y = int64}[] -> int64 }", tfs(TypeInt.INT64)); }

References com.cliffc.aa.type.TypeInt.INT64, com.cliffc.aa.HM.TestHM9.run(), and com.cliffc.aa.HM.TestHM9.tfs().

Here is the call graph for this function:

◆ test32()

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

Definition at line 256 of file TestHM9.java.

256  {
257  Root syn = HM9.hm("map = { fcn lst -> @{ n1 = (map fcn .n0 lst), v1 = (fcn .v0 lst) } }; map");
258  if( HM.DO_HM )
259  assertEquals("{ { A -> B } C:@{ n0 = $C, v0 = $A}[] -> D:@{ n1 = $D, v1 = $B}[9] }",syn._hmt.p());
260  if( HM.DO_GCP )
261  // Build a cycle of length 2, without nil.
262  assertEquals(tfs(build_cycle(9,false,Type.SCALAR)),syn.flow_type());
263  }

References com.cliffc.aa.HM.HM.Syntax._hmt, com.cliffc.aa.HM.TestHM9.build_cycle(), com.cliffc.aa.HM.HM.DO_GCP, com.cliffc.aa.HM.HM.DO_HM, com.cliffc.aa.HM.HM.Root.flow_type(), com.cliffc.aa.HM.HM9.hm(), com.cliffc.aa.HM.HM.T2.p(), com.cliffc.aa.type.Type< T extends Type< T >.SCALAR, and com.cliffc.aa.HM.TestHM9.tfs().

Here is the call graph for this function:

◆ test33()

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

Definition at line 268 of file TestHM9.java.

268  {
269  Root syn = HM9.hm("map = { fcn lst -> (if lst @{ n1=(map fcn .n0 lst), v1=(fcn .v0 lst) } 0) }; map");
270  if( HM.DO_HM )
271  assertEquals("{ { A -> B } C:@{ n0 = $C, v0 = $A}[0] -> D:@{ n1 = $D, v1 = $B}[0,9] }",syn._hmt.p());
272  if( HM.DO_GCP )
273  // Build a cycle of length 2, with nil.
274  assertEquals(tfs(build_cycle(9,true,Type.SCALAR)),syn.flow_type());
275  }

References com.cliffc.aa.HM.HM.Syntax._hmt, com.cliffc.aa.HM.TestHM9.build_cycle(), com.cliffc.aa.HM.HM.DO_GCP, com.cliffc.aa.HM.HM.DO_HM, com.cliffc.aa.HM.HM.Root.flow_type(), com.cliffc.aa.HM.HM9.hm(), com.cliffc.aa.HM.HM.T2.p(), com.cliffc.aa.type.Type< T extends Type< T >.SCALAR, and com.cliffc.aa.HM.TestHM9.tfs().

Here is the call graph for this function:

◆ test34()

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

Definition at line 278 of file TestHM9.java.

278  {
279  Root syn = HM9.hm("map = { fcn lst -> (if lst @{ n1 = (map fcn .n0 lst), v1 = (fcn .v0 lst) } 0) }; (map dec @{n0 = 0, v0 = 5})");
280  if( HM.DO_HM )
281  assertEquals("A:@{ n1 = $A, v1 = int64}[0,9]",syn._hmt.p());
282  if( HM.DO_GCP )
283  assertEquals(build_cycle(9,true,TypeInt.con(4)),syn.flow_type());
284  }

References com.cliffc.aa.HM.HM.Syntax._hmt, com.cliffc.aa.HM.TestHM9.build_cycle(), com.cliffc.aa.type.TypeInt.con(), com.cliffc.aa.HM.HM.DO_GCP, com.cliffc.aa.HM.HM.DO_HM, com.cliffc.aa.HM.HM.Root.flow_type(), com.cliffc.aa.HM.HM9.hm(), and com.cliffc.aa.HM.HM.T2.p().

Here is the call graph for this function:

◆ test35()

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

Definition at line 287 of file TestHM9.java.

287  {
288  TypeFunPtr tfp = TypeFunPtr.make(15,3,Type.ANY);
289  TypeMemPtr tmp0 = TypeMemPtr.make(8,TypeStruct.make(tfp ,tfp ,tfp ));
290  TypeMemPtr tmp1 = TypeMemPtr.make(8,TypeStruct.make(tmp0,tmp0,tmp0));
291  TypeMemPtr tmp2 = TypeMemPtr.make(8,TypeStruct.make(tmp1,tmp1,tmp1));
292 
293  run("p0 = { x y z -> (triple x y z) };"+
294  "p1 = (triple p0 p0 p0);"+
295  "p2 = (triple p1 p1 p1);"+
296  "p3 = (triple p2 p2 p2);"+
297  "p3",
298  "( ( ( { A B C -> ( $A, $B, $C)[8] }, { D E F -> ( $D, $E, $F)[8] }, { G H I -> ( $G, $H, $I)[8] })[8], ( { J K L -> ( $J, $K, $L)[8] }, { M N O -> ( $M, $N, $O)[8] }, { P Q R -> ( $P, $Q, $R)[8] })[8], ( { S T U -> ( $S, $T, $U)[8] }, { V21 V22 V23 -> ( $V21, $V22, $V23)[8] }, { V24 V25 V26 -> ( $V24, $V25, $V26)[8] })[8])[8], ( ( { V27 V28 V29 -> ( $V27, $V28, $V29)[8] }, { V30 V31 V32 -> ( $V30, $V31, $V32)[8] }, { V33 V34 V35 -> ( $V33, $V34, $V35)[8] })[8], ( { V36 V37 V38 -> ( $V36, $V37, $V38)[8] }, { V39 V40 V41 -> ( $V39, $V40, $V41)[8] }, { V42 V43 V44 -> ( $V42, $V43, $V44)[8] })[8], ( { V45 V46 V47 -> ( $V45, $V46, $V47)[8] }, { V48 V49 V50 -> ( $V48, $V49, $V50)[8] }, { V51 V52 V53 -> ( $V51, $V52, $V53)[8] })[8])[8], ( ( { V54 V55 V56 -> ( $V54, $V55, $V56)[8] }, { V57 V58 V59 -> ( $V57, $V58, $V59)[8] }, { V60 V61 V62 -> ( $V60, $V61, $V62)[8] })[8], ( { V63 V64 V65 -> ( $V63, $V64, $V65)[8] }, { V66 V67 V68 -> ( $V66, $V67, $V68)[8] }, { V69 V70 V71 -> ( $V69, $V70, $V71)[8] })[8], ( { V72 V73 V74 -> ( $V72, $V73, $V74)[8] }, { V75 V76 V77 -> ( $V75, $V76, $V77)[8] }, { V78 V79 V80 -> ( $V78, $V79, $V80)[8] })[8])[8])[8]",
299  tmp2 );
300  }

References com.cliffc.aa.type.Type< T extends Type< T >.ANY, com.cliffc.aa.type.TypeMemPtr.make(), com.cliffc.aa.type.TypeFunPtr.make(), com.cliffc.aa.type.TypeStruct.make(), and com.cliffc.aa.HM.TestHM9.run().

Here is the call graph for this function:

◆ test36()

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

Definition at line 304 of file TestHM9.java.

304  {
305  Root syn = HM9.hm("map = { lst -> (if lst @{ n1= arg= .n0 lst; (if arg @{ n1=(map .n0 arg), v1=(str .v0 arg)} 0), v1=(str .v0 lst) } 0) }; map");
306  if( HM.DO_HM )
307  assertEquals("{ A:@{ n0 = @{ n0 = $A, v0 = int64}[0], v0 = int64}[0] -> B:@{ n1 = @{ n1 = $B, v1 = *[4]str}[0,9], v1 = *[4]str}[0,10] }",syn._hmt.p());
308  if( HM.DO_GCP ) {
309  TypeStruct cycle_strX;
310  if( true ) {
311  // Unrolled, known to only produce results where either other nested
312  // struct is from a different allocation site.
313  TypeMemPtr cycle_ptr0 = TypeMemPtr.make(BitsAlias.FULL.make(0,10),TypeObj.XOBJ);
314  TypeStruct cycle_str1 = TypeStruct.make(TypeFld.NO_DISP,TypeFld.malloc("n1",cycle_ptr0,1),TypeFld.malloc("v1",TypeMemPtr.STRPTR,1));
315  TypeMemPtr cycle_ptr1 = TypeMemPtr.make(BitsAlias.FULL.make(0, 9),cycle_str1);
316  TypeStruct cycle_str2 = TypeStruct.make(TypeFld.NO_DISP,TypeFld.malloc("n1",cycle_ptr1,1),TypeFld.malloc("v1",TypeMemPtr.STRPTR,1));
317  TypeMemPtr cycle_ptr2 = TypeMemPtr.make(BitsAlias.FULL.make(0,10),cycle_str2);
318  TypeStruct cycle_str3 = TypeStruct.make(TypeFld.NO_DISP,TypeFld.malloc("n1",cycle_ptr2,1),TypeFld.malloc("v1",TypeMemPtr.STRPTR,1));
319  cycle_strX = cycle_str3;
320  } else {
321  // Not unrolled, both structs are folded
322  TypeMemPtr cycle_ptr0 = TypeMemPtr.make(BitsAlias.FULL.make(0,7, 8),TypeObj.XOBJ);
323  TypeStruct cycle_str1 = TypeStruct.make(TypeFld.NO_DISP,TypeFld.malloc("n1",cycle_ptr0,1),TypeFld.malloc("v1",TypeMemPtr.STRPTR,1));
324  TypeMemPtr cycle_ptr1 = TypeMemPtr.make(BitsAlias.FULL.make(0,7, 8),cycle_str1);
325  TypeStruct cycle_str2 = TypeStruct.make(TypeFld.NO_DISP,TypeFld.malloc("n1",cycle_ptr1,1),TypeFld.malloc("v1",TypeMemPtr.STRPTR,1));
326  cycle_strX = cycle_str2;
327  }
328  TypeStruct cycle_strn = cycle_strX.approx(1,9);
329  TypeMemPtr cycle_ptrn = (TypeMemPtr)cycle_strn.at(1);
330  assertEquals(tfs(cycle_ptrn),syn.flow_type());
331  }
332  }

References com.cliffc.aa.HM.HM.Syntax._hmt, com.cliffc.aa.type.TypeStruct.approx(), com.cliffc.aa.type.TypeStruct.at(), com.cliffc.aa.HM.HM.DO_GCP, com.cliffc.aa.HM.HM.DO_HM, com.cliffc.aa.HM.HM.Root.flow_type(), com.cliffc.aa.type.BitsAlias.FULL, com.cliffc.aa.HM.HM9.hm(), com.cliffc.aa.type.TypeMemPtr.make(), com.cliffc.aa.type.Bits< B extends Bits< B >.make(), com.cliffc.aa.type.TypeStruct.make(), com.cliffc.aa.type.TypeFld.malloc(), com.cliffc.aa.type.TypeFld.NO_DISP, com.cliffc.aa.HM.HM.T2.p(), com.cliffc.aa.type.TypeMemPtr.STRPTR, com.cliffc.aa.HM.TestHM9.tfs(), and com.cliffc.aa.type.TypeObj< O extends TypeObj< O >.XOBJ.

Here is the call graph for this function:

◆ test37()

void com.cliffc.aa.HM.TestHM9.test37 ( )

Definition at line 334 of file TestHM9.java.

334  { run("x = { y -> (x (y y))}; x",
335  "{ A:{ $A -> $A } -> B }", tfs(Type.XSCALAR)); }

References com.cliffc.aa.HM.TestHM9.run(), com.cliffc.aa.HM.TestHM9.tfs(), and com.cliffc.aa.type.Type< T extends Type< T >.XSCALAR.

Here is the call graph for this function:

◆ test38()

void com.cliffc.aa.HM.TestHM9.test38 ( )

Definition at line 339 of file TestHM9.java.

339  { run("{ x -> y = ( x .v x ); 0}",
340  "{ Cannot unify @{ v = A}[] and { A -> B } -> 0 }", tfs(Type.XNIL)); }

References com.cliffc.aa.HM.TestHM9.run(), com.cliffc.aa.HM.TestHM9.tfs(), and com.cliffc.aa.type.Type< T extends Type< T >.XNIL.

Here is the call graph for this function:

◆ test39()

void com.cliffc.aa.HM.TestHM9.test39 ( )

Definition at line 344 of file TestHM9.java.

344  {
345  Root syn = HM9.hm("x = { z -> z}; (x { y -> .u y})");
346  if( HM.DO_HM )
347  assertEquals("{ @{ u = A}[] -> $A }",syn._hmt.p());
348  if( HM.DO_GCP )
349  assertEquals(tfs(Type.SCALAR), syn.flow_type());
350  }

References com.cliffc.aa.HM.HM.Syntax._hmt, com.cliffc.aa.HM.HM.DO_GCP, com.cliffc.aa.HM.HM.DO_HM, com.cliffc.aa.HM.HM.Root.flow_type(), com.cliffc.aa.HM.HM9.hm(), com.cliffc.aa.HM.HM.T2.p(), com.cliffc.aa.type.Type< T extends Type< T >.SCALAR, and com.cliffc.aa.HM.TestHM9.tfs().

Here is the call graph for this function:

◆ test40()

void com.cliffc.aa.HM.TestHM9.test40 ( )

Definition at line 356 of file TestHM9.java.

356  {
357  Root syn = HM9.hm("x = w = (x x); { z -> z}; (x { y -> .u y})");
358  if( HM.DO_HM )
359  assertEquals("Cannot unify A:{ $A -> $A } and @{ u = A}[]",syn._hmt.p());
360  if( HM.DO_GCP ) {
361  if( HM.DO_HM ) {
362  assertEquals(tfs(Type.SCALAR), syn.flow_type());
363  } else {
364  assertEquals(Type.SCALAR, syn.flow_type());
365  }
366  }
367  }

References com.cliffc.aa.HM.HM.Syntax._hmt, com.cliffc.aa.HM.HM.DO_GCP, com.cliffc.aa.HM.HM.DO_HM, com.cliffc.aa.HM.HM.Root.flow_type(), com.cliffc.aa.HM.HM9.hm(), com.cliffc.aa.HM.HM.T2.p(), com.cliffc.aa.type.Type< T extends Type< T >.SCALAR, and com.cliffc.aa.HM.TestHM9.tfs().

Here is the call graph for this function:

◆ test41()

void com.cliffc.aa.HM.TestHM9.test41 ( )

Definition at line 376 of file TestHM9.java.

376  {
377  Root syn = HM9.hm("map={lst fcn -> (fcn .y lst) }; "+
378  "in_int=@{ x=0 y=2}; " +
379  "in_str=@{ x=0 y=\"abc\"}; " +
380  "out_str = (map in_int str); " +
381  "out_bool= (map in_str { xstr -> (eq xstr \"def\")}); "+
382  "(pair out_str out_bool)");
383  if( HM.DO_HM )
384  assertEquals("( *[4]str, int1)[7]",syn._hmt.p());
385  if( HM.DO_GCP )
386  if( HM.DO_HM )
387  assertEquals(TypeMemPtr.make(7,TypeStruct.make(TypeMemPtr.STRPTR,TypeInt.BOOL)),syn.flow_type());
388  else
389  assertEquals(tuple2,syn.flow_type());
390  }

References com.cliffc.aa.HM.HM.Syntax._hmt, com.cliffc.aa.type.TypeInt.BOOL, com.cliffc.aa.HM.HM.DO_GCP, com.cliffc.aa.HM.HM.DO_HM, com.cliffc.aa.HM.HM.Root.flow_type(), com.cliffc.aa.HM.HM9.hm(), com.cliffc.aa.type.TypeMemPtr.make(), com.cliffc.aa.type.TypeStruct.make(), com.cliffc.aa.HM.HM.T2.p(), com.cliffc.aa.type.TypeMemPtr.STRPTR, and com.cliffc.aa.HM.TestHM9.tuple2.

Here is the call graph for this function:

◆ test42()

void com.cliffc.aa.HM.TestHM9.test42 ( )

Definition at line 393 of file TestHM9.java.

393  {
394  Root syn = HM9.hm("pred = 0; s1 = @{ x=\"abc\" }; s2 = @{ y=3.4 }; .y (if pred s1 s2)");
395  if( HM.DO_HM ) {
396  if( HM.DO_GCP )
397  assertEquals("3.4000000953674316",syn._hmt.p());
398  else
399  assertEquals("Missing field y in @{ x = *[4]\"abc\"}[9]",syn._hmt.p());
400  }
401  if( HM.DO_GCP )
402  assertEquals(TypeFlt.con(3.4f), syn.flow_type());
403  }

References com.cliffc.aa.HM.HM.Syntax._hmt, com.cliffc.aa.type.TypeFlt.con(), com.cliffc.aa.HM.HM.DO_GCP, com.cliffc.aa.HM.HM.DO_HM, com.cliffc.aa.HM.HM.Root.flow_type(), com.cliffc.aa.HM.HM9.hm(), and com.cliffc.aa.HM.HM.T2.p().

Here is the call graph for this function:

◆ test43()

void com.cliffc.aa.HM.TestHM9.test43 ( )

Definition at line 406 of file TestHM9.java.

406  {
407  Root syn = HM9.hm("pred = 0; s1 = @{ x=\"abc\" }; s2 = @{ y=3.4 }; z = (if pred s1 s2); .y s2");
408  if( HM.DO_HM )
409  assertEquals("3.4000000953674316",syn._hmt.p());
410  if( HM.DO_GCP )
411  assertEquals(TypeFlt.con(3.4f), syn.flow_type());
412  }

References com.cliffc.aa.HM.HM.Syntax._hmt, com.cliffc.aa.type.TypeFlt.con(), com.cliffc.aa.HM.HM.DO_GCP, com.cliffc.aa.HM.HM.DO_HM, com.cliffc.aa.HM.HM.Root.flow_type(), com.cliffc.aa.HM.HM9.hm(), and com.cliffc.aa.HM.HM.T2.p().

Here is the call graph for this function:

◆ test44()

void com.cliffc.aa.HM.TestHM9.test44 ( )

Definition at line 415 of file TestHM9.java.

415  {
416  Root syn = HM9.hm("fun = (if (isempty \"abc\") {x->x} {x->1.2}); (fun @{})");
417  if( HM.DO_HM ) {
418  if( HM.DO_GCP )
419  assertEquals("1.2000000476837158",syn._hmt.p());
420  else
421  assertEquals("Cannot unify 1.2000000476837158 and )[9]",syn._hmt.p());
422  }
423  if( HM.DO_GCP )
424  assertEquals(TypeFlt.con(1.2f), syn.flow_type());
425  }

References com.cliffc.aa.HM.HM.Syntax._hmt, com.cliffc.aa.type.TypeFlt.con(), com.cliffc.aa.HM.HM.DO_GCP, com.cliffc.aa.HM.HM.DO_HM, com.cliffc.aa.HM.HM.Root.flow_type(), com.cliffc.aa.HM.HM9.hm(), and com.cliffc.aa.HM.HM.T2.p().

Here is the call graph for this function:

◆ test45()

void com.cliffc.aa.HM.TestHM9.test45 ( )

Definition at line 429 of file TestHM9.java.

429  {
430  Root syn = HM9.hm(
431 "id = {x -> x};" +
432 "loop = { name cnt ->" +
433 " (if cnt " +
434 " (loop" +
435 " fltfun = (if name id {x->3});" +
436 " (fltfun \"abc\")" +
437 " (dec cnt)" +
438 " )" +
439 " name" +
440 " )"+
441 "};" +
442 "(loop \"def\" (id 2))");
443  if( HM.DO_HM )
444  assertEquals(HM.DO_GCP
445  ? "*[4]str" // Both HM and GCP
446  : "Cannot unify *[4]\"abc\" and 3", // HM alone cannot do this one
447  syn._hmt.p());
448  if( HM.DO_GCP )
449  assertEquals(HM.DO_HM
450  ? TypeMemPtr.STRPTR // Both HM and GCP
451  : Type.NSCALR, // GCP alone gets a very weak answer
452  syn.flow_type());
453  }

References com.cliffc.aa.HM.HM.Syntax._hmt, com.cliffc.aa.HM.HM.DO_GCP, com.cliffc.aa.HM.HM.DO_HM, com.cliffc.aa.HM.HM.Root.flow_type(), com.cliffc.aa.HM.HM9.hm(), com.cliffc.aa.type.Type< T extends Type< T >.NSCALR, com.cliffc.aa.HM.HM.T2.p(), and com.cliffc.aa.type.TypeMemPtr.STRPTR.

Here is the call graph for this function:

◆ test46()

void com.cliffc.aa.HM.TestHM9.test46 ( )

Definition at line 457 of file TestHM9.java.

457  { run(".x 0",
458  "May be nil when loading field x", Type.XSCALAR); }

References com.cliffc.aa.HM.TestHM9.run(), and com.cliffc.aa.type.Type< T extends Type< T >.XSCALAR.

Here is the call graph for this function:

◆ test47()

void com.cliffc.aa.HM.TestHM9.test47 ( )

Definition at line 461 of file TestHM9.java.

461  { run("{ pred -> .x (if pred @{x=3} 0)}",
462  "{ A -> May be nil when loading field x }", tfs(TypeInt.con(3))); }

References com.cliffc.aa.type.TypeInt.con(), com.cliffc.aa.HM.TestHM9.run(), and com.cliffc.aa.HM.TestHM9.tfs().

Here is the call graph for this function:

◆ test48()

void com.cliffc.aa.HM.TestHM9.test48 ( )

Definition at line 465 of file TestHM9.java.

465  { run("{ pred -> tmp=(if pred @{x=3} 0); (if tmp .x tmp 4) }",
466  "{ A -> nint8 }", tfs(TypeInt.NINT8)); }

References com.cliffc.aa.type.TypeInt.NINT8, com.cliffc.aa.HM.TestHM9.run(), and com.cliffc.aa.HM.TestHM9.tfs().

Here is the call graph for this function:

◆ test49()

void com.cliffc.aa.HM.TestHM9.test49 ( )

Definition at line 470 of file TestHM9.java.

470  {
471  Root syn = HM9.hm("{ pred -> \n"+
472  " map = { fun x -> (fun x) };\n" +
473  " (pair (map {str0 -> .x str0 } @{x = 3} )\n" +
474  " (map {str1 -> (if str1 .x str1 4)} (if pred @{x = 5} 0))\n" +
475  " )\n"+
476  "}");
477  if( HM.DO_HM )
478  assertEquals("{ A -> ( 3, nint8)[7] }",syn._hmt.p());
479  if( HM.DO_GCP )
480  if( HM.DO_HM ) tfs(TypeMemPtr.make(7,TypeStruct.make(TypeInt.con(3), TypeInt.NINT8 )));
482  }

References com.cliffc.aa.HM.HM.Syntax._hmt, com.cliffc.aa.type.TypeInt.con(), com.cliffc.aa.HM.HM.DO_GCP, com.cliffc.aa.HM.HM.DO_HM, com.cliffc.aa.HM.HM9.hm(), com.cliffc.aa.type.TypeMemPtr.make(), com.cliffc.aa.type.TypeStruct.make(), com.cliffc.aa.type.TypeInt.NINT8, com.cliffc.aa.HM.HM.T2.p(), and com.cliffc.aa.HM.TestHM9.tfs().

Here is the call graph for this function:

◆ test50()

void com.cliffc.aa.HM.TestHM9.test50 ( )

Definition at line 485 of file TestHM9.java.

485  {
486  Root syn = HM9.hm("{ pred -> \n"+
487  " map = { fun x -> (fun x) };\n" +
488  " (pair (map {str0 -> .x str0 } @{x = 3} )\n" +
489  " (map {str1 -> .x str1 } (if pred @{x = 5} 0))\n" +
490  " )\n"+
491  "}");
492  if( HM.DO_HM )
493  assertEquals("{ A -> May be nil when loading field x }",syn._hmt.p());
494  if( HM.DO_GCP )
495  if( HM.DO_HM ) tfs(TypeMemPtr.make(7,TypeStruct.make(TypeInt.con(3), TypeInt.NINT8 )));
497  }

References com.cliffc.aa.HM.HM.Syntax._hmt, com.cliffc.aa.type.TypeInt.con(), com.cliffc.aa.HM.HM.DO_GCP, com.cliffc.aa.HM.HM.DO_HM, com.cliffc.aa.HM.HM9.hm(), com.cliffc.aa.type.TypeMemPtr.make(), com.cliffc.aa.type.TypeStruct.make(), com.cliffc.aa.type.TypeInt.NINT8, com.cliffc.aa.HM.HM.T2.p(), and com.cliffc.aa.HM.TestHM9.tfs().

Here is the call graph for this function:

◆ tfs()

Member Data Documentation

◆ N1V1

final String [] com.cliffc.aa.HM.TestHM9.N1V1 = new String[]{"^","n1","v1"}
staticprivate

Definition at line 34 of file TestHM9.java.

◆ ret_tuple2

final TypeFunSig com.cliffc.aa.HM.TestHM9.ret_tuple2 = tfs(tuple2)
staticprivate

Definition at line 32 of file TestHM9.java.

Referenced by com.cliffc.aa.HM.TestHM9.test09().

◆ tuple2

final TypeMemPtr com.cliffc.aa.HM.TestHM9.tuple2 = TypeMemPtr.make(7,TypeStruct.make(Type.SCALAR, Type.SCALAR ))
staticprivate

◆ tuple55

final TypeMemPtr com.cliffc.aa.HM.TestHM9.tuple55 = TypeMemPtr.make(7,TypeStruct.make(TypeInt.con(5),TypeInt.con(5)))
staticprivate

◆ tuple82

final TypeMemPtr com.cliffc.aa.HM.TestHM9.tuple82 = TypeMemPtr.make(7,TypeStruct.make(TypeInt.NINT8, TypeInt.NINT8 ))
staticprivate

Definition at line 30 of file TestHM9.java.

Referenced by com.cliffc.aa.HM.TestHM9.test05().

◆ tuple9

final TypeMemPtr com.cliffc.aa.HM.TestHM9.tuple9 = TypeMemPtr.make(9,TypeStruct.make(TypeStruct.flds(Type.SCALAR,Type.SCALAR)))
staticprivate

Definition at line 35 of file TestHM9.java.

Referenced by com.cliffc.aa.HM.TestHM9.test29().

◆ tuplen2

final TypeMemPtr com.cliffc.aa.HM.TestHM9.tuplen2 = TypeMemPtr.make(7,TypeStruct.make(Type.NSCALR, Type.NSCALR ))
staticprivate

Definition at line 29 of file TestHM9.java.

Referenced by com.cliffc.aa.HM.TestHM9.test06().

◆ XY

final String [] com.cliffc.aa.HM.TestHM9.XY = new String[]{"^","x","y"}
staticprivate

Definition at line 33 of file TestHM9.java.


The documentation for this class was generated from the following file:
com.cliffc.aa.type.BitsAlias.FULL
static BitsAlias FULL
Definition: BitsAlias.java:27
com.cliffc.aa.HM.TestHM9.tuple55
static final TypeMemPtr tuple55
Definition: TestHM9.java:31
com.cliffc.aa.type.Type.NSCALR
static final Type NSCALR
Definition: Type.java:330
com.cliffc.aa.type.TypeFunPtr
Definition: TypeFunPtr.java:23
com.cliffc.aa.type.TypeTuple.make_args
static TypeTuple make_args(Type[] ts)
Definition: TypeTuple.java:106
com.cliffc.aa.type.TypeTuple.make_ret
static TypeTuple make_ret(Type trez)
Definition: TypeTuple.java:120
com.cliffc.aa.type.Type.SCALAR
static final Type SCALAR
Definition: Type.java:328
com.cliffc.aa.type.Bits.make
B make(boolean any, long[] bits)
Definition: Bits.java:154
com.cliffc.aa.type.TypeFld
Definition: TypeFld.java:12
com.cliffc.aa.type.Type.XSCALAR
static final Type XSCALAR
Definition: Type.java:329
com.cliffc.aa.type.TypeInt
Definition: TypeInt.java:9
com.cliffc.aa.type.Type
an implementation of language AA
Definition: Type.java:94
com.cliffc.aa.type.TypeFunSig.make
static TypeFunSig make(String[] args, TypeTuple formals, TypeTuple ret)
Definition: TypeFunSig.java:71
com.cliffc.aa.type.TypeFlt
Definition: TypeFlt.java:9
com.cliffc.aa.type.BitsAlias
Definition: BitsAlias.java:8
com.cliffc.aa.type.TypeTuple
Definition: TypeTuple.java:11
com.cliffc.aa.type.TypeFld.NO_DISP
static final TypeFld NO_DISP
Definition: TypeFld.java:170
com.cliffc.aa.type.TypeInt.con
static TypeInt con(long con)
Definition: TypeInt.java:37
com.cliffc.aa.HM.TestHM9.build_cycle
static TypeMemPtr build_cycle(int alias, boolean nil, Type fld)
Definition: TestHM9.java:239
com.cliffc.aa.type.Type.ANY
static final Type ANY
Definition: Type.java:325
com.cliffc.aa.type.TypeStruct
A memory-based collection of optionally named fields.
Definition: TypeStruct.java:50
com.cliffc.aa.type.TypeStruct.at
Type at(int idx)
Definition: TypeStruct.java:1013
com.cliffc.aa.HM.TestHM9.tuple9
static final TypeMemPtr tuple9
Definition: TestHM9.java:35
com.cliffc.aa.type.TypeInt.INT64
static final TypeInt INT64
Definition: TypeInt.java:39
com.cliffc.aa.type.TypeObj
Definition: TypeObj.java:15
com.cliffc.aa.type.TypeFlt.con
static Type con(double con)
Definition: TypeFlt.java:36
com.cliffc.aa.type.Type.XNSCALR
static final Type XNSCALR
Definition: Type.java:331
com.cliffc.aa.type.TypeObj.XOBJ
static final TypeObj XOBJ
Definition: TypeObj.java:47
com.cliffc.aa.HM.TestHM9.tfs
static TypeFunSig tfs(Type ret)
Definition: TestHM9.java:24
com.cliffc.aa.type.TypeStr.ABC
static final TypeStr ABC
Definition: TypeStr.java:47
com.cliffc.aa.HM.TestHM9.tuple82
static final TypeMemPtr tuple82
Definition: TestHM9.java:30
com.cliffc.aa.HM.TestHM9.tuple2
static final TypeMemPtr tuple2
Definition: TestHM9.java:28
com.cliffc.aa.type.TypeInt.NINT8
static final TypeInt NINT8
Definition: TypeInt.java:47
com.cliffc.aa.type.Bits.meet_nil
B meet_nil()
Definition: Bits.java:212
com.cliffc.aa.type.TypeFunPtr.make
static TypeFunPtr make(BitsFun fidxs, int nargs, Type disp)
Definition: TypeFunPtr.java:67
com.cliffc.aa.type.TypeStruct.flds
static TypeFld[] flds(Type t1)
Definition: TypeStruct.java:184
com.cliffc.aa.type.TypeStr
Definition: TypeStr.java:14
com.cliffc.aa.type.TypeFld.malloc
static TypeFld malloc(String fld, Type t, Access access, int order)
Definition: TypeFld.java:53
com.cliffc.aa.type.TypeStruct.approx
TypeStruct approx(int cutoff, int alias)
Definition: TypeStruct.java:477
com.cliffc.aa.HM.TestHM9.tuplen2
static final TypeMemPtr tuplen2
Definition: TestHM9.java:29
com.cliffc.aa.type.BitsAlias.make0
static BitsAlias make0(int bit)
Definition: BitsAlias.java:72
com.cliffc.aa.type.TypeFunSig
Definition: TypeFunSig.java:10
com.cliffc.aa.type.TypeStruct.make
static TypeStruct make(String fld_name, Type t)
Definition: TypeStruct.java:190
com.cliffc.aa.type.Type.XNIL
static final Type XNIL
Definition: Type.java:333
com.cliffc.aa.type.TypeMemPtr.STRPTR
static final TypeMemPtr STRPTR
Definition: TypeMemPtr.java:97
com.cliffc.aa.HM.TestHM9.run
void run(String prog, String rez_hm, Type rez_gcp)
Definition: TestHM9.java:16
com.cliffc.aa.type.TypeInt.BOOL
static final TypeInt BOOL
Definition: TypeInt.java:43
com.cliffc.aa.type.TypeMemPtr
Definition: TypeMemPtr.java:14
com.cliffc.aa.type.TypeFlt.FLT64
static final TypeFlt FLT64
Definition: TypeFlt.java:38
com.cliffc.aa.HM.TestHM9.ret_tuple2
static final TypeFunSig ret_tuple2
Definition: TestHM9.java:32
com.cliffc.aa.type.TypeMemPtr.make
static TypeMemPtr make(BitsAlias aliases, TypeObj obj)
Definition: TypeMemPtr.java:66