@@ -16,40 +16,44 @@ testCases(compile, input => `compiling \`${JSON.stringify(input)}\``)(
1616 'compiler' ,
1717 [
1818 [ 'Hello, world!' , success ( 'Hello, world!' ) ] ,
19- [ [ '@check' , true , [ '@lookup' , [ 'identity' ] ] ] , success ( 'true' ) ] ,
19+ [ [ '@check' , true , [ '@lookup' , 'identity' ] ] , success ( 'true' ) ] ,
2020 [
2121 {
22- true1 : [ '@check' , true , [ '@lookup' , [ 'identity' ] ] ] ,
23- true2 : [ '@apply' , [ '@lookup ' , [ 'boolean' , 'not' ] ] , false ] ,
22+ true1 : [ '@check' , true , [ '@lookup' , 'identity' ] ] ,
23+ true2 : [ '@apply' , [ '@index ' , [ '@lookup' , ' boolean'] , [ 'not' ] ] , false ] ,
2424 true3 : [
2525 '@apply' ,
2626 [
2727 '@apply' ,
28- [ '@lookup' , [ 'flow' ] ] ,
28+ [ '@lookup' , 'flow' ] ,
2929 [
30- [ '@lookup ' , [ 'boolean' , 'not' ] ] ,
31- [ '@lookup ' , [ 'boolean' , 'not' ] ] ,
30+ [ '@index ' , [ '@lookup' , ' boolean'] , [ 'not' ] ] ,
31+ [ '@index ' , [ '@lookup' , ' boolean'] , [ 'not' ] ] ,
3232 ] ,
3333 ] ,
3434 true ,
3535 ] ,
36- false1 : [ '@check' , false , [ '@lookup' , [ 'boolean' , 'is' ] ] ] ,
37- false2 : [ '@apply' , [ '@lookup' , [ 'boolean' , 'is' ] ] , 'not a boolean' ] ,
36+ false1 : [ '@check' , false , [ '@index' , [ '@lookup' , 'boolean' ] , [ 'is' ] ] ] ,
37+ false2 : [
38+ '@apply' ,
39+ [ '@index' , [ '@lookup' , 'boolean' ] , [ 'is' ] ] ,
40+ 'not a boolean' ,
41+ ] ,
3842 false3 : [
3943 '@apply' ,
4044 [
4145 '@apply' ,
42- [ '@lookup' , [ 'flow' ] ] ,
46+ [ '@lookup' , 'flow' ] ,
4347 [
4448 [
4549 '@apply' ,
46- [ '@lookup' , [ 'flow' ] ] ,
50+ [ '@lookup' , 'flow' ] ,
4751 [
48- [ '@lookup ' , [ 'boolean' , 'not' ] ] ,
49- [ '@lookup ' , [ 'boolean' , 'not' ] ] ,
52+ [ '@index ' , [ '@lookup' , ' boolean'] , [ 'not' ] ] ,
53+ [ '@index ' , [ '@lookup' , ' boolean'] , [ 'not' ] ] ,
5054 ] ,
5155 ] ,
52- [ '@lookup ' , [ 'boolean' , 'not' ] ] ,
56+ [ '@index ' , [ '@lookup' , ' boolean'] , [ 'not' ] ] ,
5357 ] ,
5458 ] ,
5559 true ,
@@ -65,29 +69,29 @@ testCases(compile, input => `compiling \`${JSON.stringify(input)}\``)(
6569 } ) ,
6670 ] ,
6771 [
68- [ '@runtime' , [ '@lookup' , [ 'identity' ] ] ] ,
72+ [ '@runtime' , [ '@lookup' , 'identity' ] ] ,
6973 success ( {
7074 0 : '@runtime' ,
71- function : { 0 : '@lookup' , query : { 0 : 'identity' } } ,
75+ function : { 0 : '@lookup' , key : 'identity' } ,
7276 } ) ,
7377 ] ,
7478 [
7579 [
7680 '@runtime' ,
77- [ '@apply' , [ '@lookup' , [ 'identity' ] ] , [ '@lookup' , [ 'identity' ] ] ] ,
81+ [ '@apply' , [ '@lookup' , 'identity' ] , [ '@lookup' , 'identity' ] ] ,
7882 ] ,
7983 success ( {
8084 0 : '@runtime' ,
81- function : { 0 : '@lookup' , query : { 0 : 'identity' } } ,
85+ function : { 0 : '@lookup' , key : 'identity' } ,
8286 } ) ,
8387 ] ,
8488 [
85- [ '@check' , 'not a boolean' , [ '@lookup ' , [ 'boolean' , 'is' ] ] ] ,
89+ [ '@check' , 'not a boolean' , [ '@index ' , [ '@lookup' , ' boolean'] , [ 'is' ] ] ] ,
8690 output => assert ( either . isLeft ( output ) ) ,
8791 ] ,
88- [ [ '@lookup' , [ 'compose' ] ] , output => assert ( either . isLeft ( output ) ) ] ,
92+ [ [ '@lookup' , 'compose' ] , output => assert ( either . isLeft ( output ) ) ] ,
8993 [
90- [ '@runtime' , [ '@lookup ' , [ 'boolean' , 'not' ] ] ] ,
94+ [ '@runtime' , [ '@index ' , [ '@lookup' , ' boolean'] , [ 'not' ] ] ] ,
9195 output => {
9296 assert ( either . isLeft ( output ) )
9397 assert ( output . value . kind === 'typeMismatch' )
@@ -96,7 +100,11 @@ testCases(compile, input => `compiling \`${JSON.stringify(input)}\``)(
96100 [
97101 [
98102 '@runtime' ,
99- [ '@apply' , [ '@lookup' , [ 'identity' ] ] , [ '@lookup' , [ 'boolean' , 'not' ] ] ] ,
103+ [
104+ '@apply' ,
105+ [ '@lookup' , 'identity' ] ,
106+ [ '@index' , [ '@lookup' , 'boolean' ] , [ 'not' ] ] ,
107+ ] ,
100108 ] ,
101109 output => {
102110 assert ( either . isLeft ( output ) )
@@ -108,21 +116,21 @@ testCases(compile, input => `compiling \`${JSON.stringify(input)}\``)(
108116 '@runtime' ,
109117 [
110118 '@apply' ,
111- [ '@lookup' , [ 'flow' ] ] ,
119+ [ '@lookup' , 'flow' ] ,
112120 [
113- [ '@lookup' , [ 'identity' ] ] ,
114- [ '@lookup' , [ 'identity' ] ] ,
121+ [ '@lookup' , 'identity' ] ,
122+ [ '@lookup' , 'identity' ] ,
115123 ] ,
116124 ] ,
117125 ] ,
118126 success ( {
119127 0 : '@runtime' ,
120128 function : {
121129 0 : '@apply' ,
122- function : { 0 : '@lookup' , query : { 0 : 'flow' } } ,
130+ function : { 0 : '@lookup' , key : 'flow' } ,
123131 argument : {
124- 0 : { 0 : '@lookup' , query : { 0 : 'identity' } } ,
125- 1 : { 0 : '@lookup' , query : { 0 : 'identity' } } ,
132+ 0 : { 0 : '@lookup' , key : 'identity' } ,
133+ 1 : { 0 : '@lookup' , key : 'identity' } ,
126134 } ,
127135 } ,
128136 } ) ,
@@ -132,10 +140,10 @@ testCases(compile, input => `compiling \`${JSON.stringify(input)}\``)(
132140 '@runtime' ,
133141 [
134142 '@apply' ,
135- [ '@lookup' , [ 'flow' ] ] ,
143+ [ '@lookup' , 'flow' ] ,
136144 [
137- [ '@lookup ' , [ 'boolean' , 'not' ] ] ,
138- [ '@lookup ' , [ 'boolean' , 'not' ] ] ,
145+ [ '@index ' , [ '@lookup' , ' boolean'] , [ 'not' ] ] ,
146+ [ '@index ' , [ '@lookup' , ' boolean'] , [ 'not' ] ] ,
139147 ] ,
140148 ] ,
141149 ] ,
@@ -149,15 +157,23 @@ testCases(compile, input => `compiling \`${JSON.stringify(input)}\``)(
149157 0 : '@runtime' ,
150158 function : {
151159 0 : '@apply' ,
152- function : { 0 : '@lookup' , query : { 0 : 'object' , 1 : 'lookup' } } ,
160+ function : {
161+ 0 : '@index' ,
162+ object : { 0 : '@lookup' , key : 'object' } ,
163+ query : { 0 : 'lookup' } ,
164+ } ,
153165 argument : 'key which does not exist in runtime context' ,
154166 } ,
155167 } ,
156168 success ( {
157169 0 : '@runtime' ,
158170 function : {
159171 0 : '@apply' ,
160- function : { 0 : '@lookup' , query : { 0 : 'object' , 1 : 'lookup' } } ,
172+ function : {
173+ 0 : '@index' ,
174+ object : { 0 : '@lookup' , key : 'object' } ,
175+ query : { 0 : 'lookup' } ,
176+ } ,
161177 argument : 'key which does not exist in runtime context' ,
162178 } ,
163179 } ) ,
0 commit comments