3
3
4
4
5
5
:escape
6
- let undefined: nothing
7
- //│ ╔══[PARSE ERROR] Expected a function name; found 'undefined' keyword instead
8
- //│ ║ l.6: let undefined: nothing
9
- //│ ╙── ^^^^^^^^^
10
- //│ let <error>: nothing
11
- //│ <error>
6
+ let nothing: nothing
7
+ //│ let nothing: nothing
8
+ //│ nothing
12
9
//│ = <missing implementation>
13
10
14
11
module None {
15
- fun value = undefined
12
+ fun value = nothing
16
13
}
17
14
class Some[out A](value: A)
18
15
//│ module None() {
19
- //│ fun value: undefined
16
+ //│ fun value: nothing
20
17
//│ }
21
18
//│ class Some[A](value: A)
22
19
@@ -49,29 +46,29 @@ fun zipWith_wrong(f, xs, ys) =
49
46
then Some(Cons(f(x, y), tail))
50
47
else None
51
48
//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause; found operator application followed by newline instead
52
- //│ ║ l.46 : if xs is Cons(x, xs)
49
+ //│ ║ l.43 : if xs is Cons(x, xs)
53
50
//│ ║ ^^^^^^^^^^^^^^^^^
54
- //│ ║ l.47 : and ys is Cons(y, ys)
51
+ //│ ║ l.44 : and ys is Cons(y, ys)
55
52
//│ ║ ^^
56
53
//│ ╟── Note: 'if' expression started here:
57
- //│ ║ l.46 : if xs is Cons(x, xs)
54
+ //│ ║ l.43 : if xs is Cons(x, xs)
58
55
//│ ╙── ^^
59
56
//│ ╔══[PARSE ERROR] Unexpected operator in expression position
60
- //│ ║ l.47 : and ys is Cons(y, ys)
57
+ //│ ║ l.44 : and ys is Cons(y, ys)
61
58
//│ ╙── ^^^
62
59
//│ ╔══[PARSE ERROR] Unexpected operator in expression position
63
- //│ ║ l.48 : and zipWith_wrong(f, xs, ys) is Some(tail)
60
+ //│ ║ l.45 : and zipWith_wrong(f, xs, ys) is Some(tail)
64
61
//│ ╙── ^^^
65
62
//│ ╔══[PARSE ERROR] Expected an expression; found a 'then'/'else' clause instead
66
- //│ ║ l.46 : if xs is Cons(x, xs)
63
+ //│ ║ l.43 : if xs is Cons(x, xs)
67
64
//│ ║ ^^^^^^^^^^^^^^^^^
68
- //│ ║ l.47 : and ys is Cons(y, ys)
65
+ //│ ║ l.44 : and ys is Cons(y, ys)
69
66
//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^
70
- //│ ║ l.48 : and zipWith_wrong(f, xs, ys) is Some(tail)
67
+ //│ ║ l.45 : and zipWith_wrong(f, xs, ys) is Some(tail)
71
68
//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
72
- //│ ║ l.49 : then Some(Cons(f(x, y), tail))
69
+ //│ ║ l.46 : then Some(Cons(f(x, y), tail))
73
70
//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
74
- //│ ║ l.50 : else None
71
+ //│ ║ l.47 : else None
75
72
//│ ╙── ^^^^^^^^^^^
76
73
//│ fun zipWith_wrong: (anything, anything, anything,) -> undefined
77
74
@@ -83,9 +80,9 @@ fun zipWith_wrong(f, xs, ys) =
83
80
and zipWith_wrong(f, xs, ys) is Some(tail) then Some(Cons(f(x, y), tail))
84
81
else None
85
82
//│ ╔══[ERROR] illegal pattern
86
- //│ ║ l.81 : if xs is Cons(x, xs)
83
+ //│ ║ l.78 : if xs is Cons(x, xs)
87
84
//│ ║ ^^^^^^^^^^^
88
- //│ ║ l.82 : and ys is Cons(y, ys)
85
+ //│ ║ l.79 : and ys is Cons(y, ys)
89
86
//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^
90
87
//│ fun zipWith_wrong: (anything, anything, anything,) -> error
91
88
//│ Code generation encountered an error:
@@ -114,16 +111,7 @@ fun zipWith(f, xs, ys) =
114
111
//│ fun zipWith: forall 'head 'head0 'A. (('head, 'head0,) -> 'A, Cons['head] | ~Cons[anything], Cons['head0] | ~Cons[anything],) -> (None | Some[Cons['A] | Nil])
115
112
116
113
zipWith(pairup, Cons(0, Nil), Cons("0", Nil)).value.toArray
117
- //│ ╔══[ERROR] Type mismatch in field selection:
118
- //│ ║ l.116: zipWith(pairup, Cons(0, Nil), Cons("0", Nil)).value.toArray
119
- //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
120
- //│ ╟── undefined literal of type `undefined` does not have field 'toArray'
121
- //│ ║ l.15: fun value = undefined
122
- //│ ║ ^^^^^^^^^
123
- //│ ╟── but it flows into field selection with expected type `{toArray: ?toArray}`
124
- //│ ║ l.116: zipWith(pairup, Cons(0, Nil), Cons("0", Nil)).value.toArray
125
- //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
126
- //│ Array[anything] | error
114
+ //│ Array[anything]
127
115
//│ res
128
116
//│ = [ [ 0, '0' ], [] ]
129
117
@@ -136,16 +124,7 @@ fun zipWith(f, xs, ys) =
136
124
//│ fun zipWith: forall 'head 'head0 'A. (('head, 'head0,) -> 'A, Cons['head] | ~Cons[anything], Cons['head0] | ~Cons[anything],) -> (None | Some[Cons['A] | Nil])
137
125
138
126
zipWith(pairup, Cons(0, Nil), Cons("0", Nil)).value.toArray
139
- //│ ╔══[ERROR] Type mismatch in field selection:
140
- //│ ║ l.138: zipWith(pairup, Cons(0, Nil), Cons("0", Nil)).value.toArray
141
- //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
142
- //│ ╟── undefined literal of type `undefined` does not have field 'toArray'
143
- //│ ║ l.15: fun value = undefined
144
- //│ ║ ^^^^^^^^^
145
- //│ ╟── but it flows into field selection with expected type `{toArray: ?toArray}`
146
- //│ ║ l.138: zipWith(pairup, Cons(0, Nil), Cons("0", Nil)).value.toArray
147
- //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
148
- //│ Array[anything] | error
127
+ //│ Array[anything]
149
128
//│ res
150
129
//│ = [ [ 0, '0' ], [] ]
151
130
@@ -157,16 +136,7 @@ fun zipWith(f, xs, ys) =
157
136
//│ fun zipWith: forall 'head 'head0 'A. (('head, 'head0,) -> 'A, Cons['head] | ~Cons[anything], Cons['head0] | ~Cons[anything],) -> (None | Some[Cons['A] | Nil])
158
137
159
138
zipWith(pairup, Cons(0, Nil), Cons("0", Nil)).value.toArray
160
- //│ ╔══[ERROR] Type mismatch in field selection:
161
- //│ ║ l.159: zipWith(pairup, Cons(0, Nil), Cons("0", Nil)).value.toArray
162
- //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
163
- //│ ╟── undefined literal of type `undefined` does not have field 'toArray'
164
- //│ ║ l.15: fun value = undefined
165
- //│ ║ ^^^^^^^^^
166
- //│ ╟── but it flows into field selection with expected type `{toArray: ?toArray}`
167
- //│ ║ l.159: zipWith(pairup, Cons(0, Nil), Cons("0", Nil)).value.toArray
168
- //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
169
- //│ Array[anything] | error
139
+ //│ Array[anything]
170
140
//│ res
171
141
//│ = [ [ 0, '0' ], [] ]
172
142
@@ -180,16 +150,7 @@ fun zipWith(f, xs, ys) =
180
150
//│ fun zipWith: forall 'head 'head0 'A. (('head, 'head0,) -> 'A, Cons['head] | ~Cons[anything], Cons['head0] | ~Cons[anything],) -> (None | Some[Cons['A] | Nil])
181
151
182
152
zipWith(pairup, Cons(0, Nil), Cons("0", Nil)).value.toArray
183
- //│ ╔══[ERROR] Type mismatch in field selection:
184
- //│ ║ l.182: zipWith(pairup, Cons(0, Nil), Cons("0", Nil)).value.toArray
185
- //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
186
- //│ ╟── undefined literal of type `undefined` does not have field 'toArray'
187
- //│ ║ l.15: fun value = undefined
188
- //│ ║ ^^^^^^^^^
189
- //│ ╟── but it flows into field selection with expected type `{toArray: ?toArray}`
190
- //│ ║ l.182: zipWith(pairup, Cons(0, Nil), Cons("0", Nil)).value.toArray
191
- //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
192
- //│ Array[anything] | error
153
+ //│ Array[anything]
193
154
//│ res
194
155
//│ = [ [ 0, '0' ], [] ]
195
156
@@ -208,60 +169,24 @@ fun zipWith(f, xs, ys) =
208
169
//│ fun zipWith: forall 'head 'head0 'A. (('head, 'head0,) -> 'A, Cons['head] | Nil, Cons['head0] | Nil,) -> (None | Some[Cons['A] | Nil])
209
170
210
171
zipWith(pairup, Nil, Nil).value.toArray
211
- //│ ╔══[ERROR] Type mismatch in field selection:
212
- //│ ║ l.210: zipWith(pairup, Nil, Nil).value.toArray
213
- //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
214
- //│ ╟── undefined literal of type `undefined` does not have field 'toArray'
215
- //│ ║ l.15: fun value = undefined
216
- //│ ║ ^^^^^^^^^
217
- //│ ╟── but it flows into field selection with expected type `{toArray: ?toArray}`
218
- //│ ║ l.210: zipWith(pairup, Nil, Nil).value.toArray
219
- //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
220
- //│ Array[anything] | error
172
+ //│ Array[anything]
221
173
//│ res
222
174
//│ = []
223
175
224
176
:re
225
177
zipWith(pairup, Nil, Cons(0, Nil)).value.toArray
226
- //│ ╔══[ERROR] Type mismatch in field selection:
227
- //│ ║ l.225: zipWith(pairup, Nil, Cons(0, Nil)).value.toArray
228
- //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
229
- //│ ╟── undefined literal of type `undefined` does not have field 'toArray'
230
- //│ ║ l.15: fun value = undefined
231
- //│ ║ ^^^^^^^^^
232
- //│ ╟── but it flows into field selection with expected type `{toArray: ?toArray}`
233
- //│ ║ l.225: zipWith(pairup, Nil, Cons(0, Nil)).value.toArray
234
- //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
235
- //│ Array[anything] | error
178
+ //│ Array[anything]
236
179
//│ res
237
180
//│ Runtime error:
238
- //│ TypeError: Cannot read properties of undefined (reading 'toArray')
181
+ //│ ReferenceError: nothing is not defined
239
182
240
183
zipWith(pairup, Cons(0, Nil), Cons("0", Nil)).value.toArray
241
- //│ ╔══[ERROR] Type mismatch in field selection:
242
- //│ ║ l.240: zipWith(pairup, Cons(0, Nil), Cons("0", Nil)).value.toArray
243
- //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
244
- //│ ╟── undefined literal of type `undefined` does not have field 'toArray'
245
- //│ ║ l.15: fun value = undefined
246
- //│ ║ ^^^^^^^^^
247
- //│ ╟── but it flows into field selection with expected type `{toArray: ?toArray}`
248
- //│ ║ l.240: zipWith(pairup, Cons(0, Nil), Cons("0", Nil)).value.toArray
249
- //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
250
- //│ Array[anything] | error
184
+ //│ Array[anything]
251
185
//│ res
252
186
//│ = [ [ 0, '0' ], [] ]
253
187
254
188
zipWith(pairup, Cons(0, Cons(1, Nil)), Cons("0", Cons("1", Nil))).value.toArray
255
- //│ ╔══[ERROR] Type mismatch in field selection:
256
- //│ ║ l.254: zipWith(pairup, Cons(0, Cons(1, Nil)), Cons("0", Cons("1", Nil))).value.toArray
257
- //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
258
- //│ ╟── undefined literal of type `undefined` does not have field 'toArray'
259
- //│ ║ l.15: fun value = undefined
260
- //│ ║ ^^^^^^^^^
261
- //│ ╟── but it flows into field selection with expected type `{toArray: ?toArray}`
262
- //│ ║ l.254: zipWith(pairup, Cons(0, Cons(1, Nil)), Cons("0", Cons("1", Nil))).value.toArray
263
- //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
264
- //│ Array[anything] | error
189
+ //│ Array[anything]
265
190
//│ res
266
191
//│ = [ [ 0, '0' ], [ [ 1, '1' ], [] ] ]
267
192
0 commit comments