Skip to content

Commit 2ff4c7b

Browse files
committed
Fix undefined is a keyword
1 parent f6021f4 commit 2ff4c7b

File tree

1 file changed

+26
-101
lines changed

1 file changed

+26
-101
lines changed

shared/src/test/diff/ucs/zipWith.mls

+26-101
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,17 @@
33

44

55
: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
129
//│ = <missing implementation>
1310

1411
module None {
15-
fun value = undefined
12+
fun value = nothing
1613
}
1714
class Some[out A](value: A)
1815
//│ module None() {
19-
//│ fun value: undefined
16+
//│ fun value: nothing
2017
//│ }
2118
//│ class Some[A](value: A)
2219

@@ -49,29 +46,29 @@ fun zipWith_wrong(f, xs, ys) =
4946
then Some(Cons(f(x, y), tail))
5047
else None
5148
//│ ╔══[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)
5350
//│ ║ ^^^^^^^^^^^^^^^^^
54-
//│ ║ l.47: and ys is Cons(y, ys)
51+
//│ ║ l.44: and ys is Cons(y, ys)
5552
//│ ║ ^^
5653
//│ ╟── Note: 'if' expression started here:
57-
//│ ║ l.46: if xs is Cons(x, xs)
54+
//│ ║ l.43: if xs is Cons(x, xs)
5855
//│ ╙── ^^
5956
//│ ╔══[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)
6158
//│ ╙── ^^^
6259
//│ ╔══[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)
6461
//│ ╙── ^^^
6562
//│ ╔══[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)
6764
//│ ║ ^^^^^^^^^^^^^^^^^
68-
//│ ║ l.47: and ys is Cons(y, ys)
65+
//│ ║ l.44: and ys is Cons(y, ys)
6966
//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^
70-
//│ ║ l.48: and zipWith_wrong(f, xs, ys) is Some(tail)
67+
//│ ║ l.45: and zipWith_wrong(f, xs, ys) is Some(tail)
7168
//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
72-
//│ ║ l.49: then Some(Cons(f(x, y), tail))
69+
//│ ║ l.46: then Some(Cons(f(x, y), tail))
7370
//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
74-
//│ ║ l.50: else None
71+
//│ ║ l.47: else None
7572
//│ ╙── ^^^^^^^^^^^
7673
//│ fun zipWith_wrong: (anything, anything, anything,) -> undefined
7774

@@ -83,9 +80,9 @@ fun zipWith_wrong(f, xs, ys) =
8380
and zipWith_wrong(f, xs, ys) is Some(tail) then Some(Cons(f(x, y), tail))
8481
else None
8582
//│ ╔══[ERROR] illegal pattern
86-
//│ ║ l.81: if xs is Cons(x, xs)
83+
//│ ║ l.78: if xs is Cons(x, xs)
8784
//│ ║ ^^^^^^^^^^^
88-
//│ ║ l.82: and ys is Cons(y, ys)
85+
//│ ║ l.79: and ys is Cons(y, ys)
8986
//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^
9087
//│ fun zipWith_wrong: (anything, anything, anything,) -> error
9188
//│ Code generation encountered an error:
@@ -114,16 +111,7 @@ fun zipWith(f, xs, ys) =
114111
//│ fun zipWith: forall 'head 'head0 'A. (('head, 'head0,) -> 'A, Cons['head] | ~Cons[anything], Cons['head0] | ~Cons[anything],) -> (None | Some[Cons['A] | Nil])
115112

116113
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]
127115
//│ res
128116
//│ = [ [ 0, '0' ], [] ]
129117

@@ -136,16 +124,7 @@ fun zipWith(f, xs, ys) =
136124
//│ fun zipWith: forall 'head 'head0 'A. (('head, 'head0,) -> 'A, Cons['head] | ~Cons[anything], Cons['head0] | ~Cons[anything],) -> (None | Some[Cons['A] | Nil])
137125

138126
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]
149128
//│ res
150129
//│ = [ [ 0, '0' ], [] ]
151130

@@ -157,16 +136,7 @@ fun zipWith(f, xs, ys) =
157136
//│ fun zipWith: forall 'head 'head0 'A. (('head, 'head0,) -> 'A, Cons['head] | ~Cons[anything], Cons['head0] | ~Cons[anything],) -> (None | Some[Cons['A] | Nil])
158137

159138
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]
170140
//│ res
171141
//│ = [ [ 0, '0' ], [] ]
172142

@@ -180,16 +150,7 @@ fun zipWith(f, xs, ys) =
180150
//│ fun zipWith: forall 'head 'head0 'A. (('head, 'head0,) -> 'A, Cons['head] | ~Cons[anything], Cons['head0] | ~Cons[anything],) -> (None | Some[Cons['A] | Nil])
181151

182152
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]
193154
//│ res
194155
//│ = [ [ 0, '0' ], [] ]
195156

@@ -208,60 +169,24 @@ fun zipWith(f, xs, ys) =
208169
//│ fun zipWith: forall 'head 'head0 'A. (('head, 'head0,) -> 'A, Cons['head] | Nil, Cons['head0] | Nil,) -> (None | Some[Cons['A] | Nil])
209170

210171
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]
221173
//│ res
222174
//│ = []
223175

224176
:re
225177
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]
236179
//│ res
237180
//│ Runtime error:
238-
//│ TypeError: Cannot read properties of undefined (reading 'toArray')
181+
//│ ReferenceError: nothing is not defined
239182

240183
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]
251185
//│ res
252186
//│ = [ [ 0, '0' ], [] ]
253187

254188
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]
265190
//│ res
266191
//│ = [ [ 0, '0' ], [ [ 1, '1' ], [] ] ]
267192

0 commit comments

Comments
 (0)