@hatchingpoint/point 0.0.5 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +34 -21
- package/package.json +34 -30
- package/src/cli.ts +7 -7
- package/src/core/ast.ts +162 -124
- package/src/core/check.ts +590 -479
- package/src/core/cli.ts +497 -216
- package/src/core/context.ts +394 -217
- package/src/core/emit-javascript.ts +124 -0
- package/src/core/emit-typescript.ts +166 -133
- package/src/core/format.ts +6 -104
- package/src/core/incremental.ts +53 -0
- package/src/core/index.ts +12 -7
- package/src/core/lexer.ts +245 -240
- package/src/core/parser.ts +11 -612
- package/src/core/semantic-source.ts +26 -0
- package/src/core/serialize.ts +18 -0
- package/src/core/test-only/core-text-parser.ts +415 -0
- package/src/core/test-only/format-core.ts +120 -0
- package/src/core/test-only/index.ts +3 -0
- package/src/core/test-only/legacy-lowering.ts +1047 -0
- package/src/index.ts +1 -1
- package/src/semantic/ast.ts +230 -0
- package/src/semantic/callables.ts +51 -0
- package/src/semantic/context.ts +347 -0
- package/src/semantic/desugar.ts +665 -0
- package/src/semantic/expressions.ts +347 -0
- package/src/semantic/format.ts +222 -0
- package/src/semantic/index.ts +10 -0
- package/src/semantic/metadata.ts +37 -0
- package/src/semantic/naming.ts +33 -0
- package/src/semantic/parse.ts +945 -0
- package/src/semantic/serialize.ts +18 -0
package/src/core/check.ts
CHANGED
|
@@ -1,479 +1,590 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
PointCoreDeclaration,
|
|
3
|
-
PointCoreExpression,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
type
|
|
28
|
-
type
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
private readonly
|
|
40
|
-
private readonly
|
|
41
|
-
private readonly
|
|
42
|
-
private readonly
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
this.
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if (declaration.kind === "
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
private
|
|
79
|
-
if (declaration.
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
private
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
statement
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
return;
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
return
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
expression
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
return
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
return
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
1
|
+
import type {
|
|
2
|
+
PointCoreDeclaration,
|
|
3
|
+
PointCoreExpression,
|
|
4
|
+
PointCoreExternalDeclaration,
|
|
5
|
+
PointCoreFunctionDeclaration,
|
|
6
|
+
PointCoreProgram,
|
|
7
|
+
PointCoreStatement,
|
|
8
|
+
PointCoreTypeDeclaration,
|
|
9
|
+
PointCoreTypeExpression,
|
|
10
|
+
PointCoreValueDeclaration,
|
|
11
|
+
PointSourceSpan,
|
|
12
|
+
} from "./ast.ts";
|
|
13
|
+
|
|
14
|
+
export interface PointCoreDiagnostic {
|
|
15
|
+
code: string;
|
|
16
|
+
message: string;
|
|
17
|
+
path: string;
|
|
18
|
+
ref: string;
|
|
19
|
+
severity: "error";
|
|
20
|
+
span: PointSourceSpan | null;
|
|
21
|
+
expected?: string | string[];
|
|
22
|
+
actual?: string;
|
|
23
|
+
repair?: string;
|
|
24
|
+
relatedRefs?: string[];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
type DiagnosticMetadata = Partial<Pick<PointCoreDiagnostic, "expected" | "actual" | "repair" | "relatedRefs">>;
|
|
28
|
+
type ScopeEntry = { type: PointCoreTypeExpression; mutable: boolean };
|
|
29
|
+
type Scope = Map<string, ScopeEntry>;
|
|
30
|
+
|
|
31
|
+
const PRIMITIVE_TYPES = new Set(["Text", "Int", "Float", "Bool", "Void", "List", "Maybe", "Error", "Or"]);
|
|
32
|
+
|
|
33
|
+
export function checkPointCore(program: PointCoreProgram): PointCoreDiagnostic[] {
|
|
34
|
+
const checker = new CoreChecker(program);
|
|
35
|
+
return checker.check();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
class CoreChecker {
|
|
39
|
+
private readonly diagnostics: PointCoreDiagnostic[] = [];
|
|
40
|
+
private readonly types = new Set(PRIMITIVE_TYPES);
|
|
41
|
+
private readonly typeDeclarations = new Map<string, PointCoreTypeDeclaration>();
|
|
42
|
+
private readonly globals: Scope = new Map();
|
|
43
|
+
private readonly functions = new Map<string, PointCoreFunctionDeclaration | PointCoreExternalDeclaration>();
|
|
44
|
+
|
|
45
|
+
constructor(private readonly program: PointCoreProgram) {}
|
|
46
|
+
|
|
47
|
+
check(): PointCoreDiagnostic[] {
|
|
48
|
+
this.collectDeclarations();
|
|
49
|
+
for (const declaration of this.program.declarations) this.checkDeclaration(declaration);
|
|
50
|
+
return this.diagnostics;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
private collectDeclarations() {
|
|
54
|
+
for (const declaration of this.program.declarations) {
|
|
55
|
+
if (declaration.kind === "type") {
|
|
56
|
+
if (this.types.has(declaration.name)) {
|
|
57
|
+
this.push("duplicate-type", `Duplicate type ${declaration.name}`, `type.${declaration.name}`, declaration.span);
|
|
58
|
+
}
|
|
59
|
+
this.types.add(declaration.name);
|
|
60
|
+
this.typeDeclarations.set(declaration.name, declaration);
|
|
61
|
+
}
|
|
62
|
+
if (declaration.kind === "value") this.addGlobal(declaration);
|
|
63
|
+
if (declaration.kind === "function") {
|
|
64
|
+
if (this.functions.has(declaration.name)) {
|
|
65
|
+
this.push("duplicate-function", `Duplicate function ${declaration.name}`, `fn.${declaration.name}`, declaration.span);
|
|
66
|
+
}
|
|
67
|
+
this.functions.set(declaration.name, declaration);
|
|
68
|
+
}
|
|
69
|
+
if (declaration.kind === "external") {
|
|
70
|
+
if (this.functions.has(declaration.name)) {
|
|
71
|
+
this.push("duplicate-function", `Duplicate function ${declaration.name}`, `external.${declaration.name}`, declaration.span);
|
|
72
|
+
}
|
|
73
|
+
this.functions.set(declaration.name, declaration);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
private addGlobal(declaration: PointCoreValueDeclaration) {
|
|
79
|
+
if (this.globals.has(declaration.name)) {
|
|
80
|
+
this.push("duplicate-value", `Duplicate value ${declaration.name}`, `value.${declaration.name}`, declaration.span);
|
|
81
|
+
}
|
|
82
|
+
this.globals.set(declaration.name, { type: declaration.type, mutable: declaration.mutable });
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
private checkDeclaration(declaration: PointCoreDeclaration) {
|
|
86
|
+
if (declaration.kind === "import") return;
|
|
87
|
+
if (declaration.kind === "external") {
|
|
88
|
+
for (const param of declaration.params) this.checkType(param.type, `external.${declaration.name}.${param.name}.type`);
|
|
89
|
+
this.checkType(declaration.returnType, `external.${declaration.name}.return`);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (declaration.kind === "type") {
|
|
93
|
+
for (const field of declaration.fields) this.checkType(field.type, `type.${declaration.name}.${field.name}`);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
if (declaration.kind === "value") {
|
|
97
|
+
this.checkType(declaration.type, `value.${declaration.name}.type`);
|
|
98
|
+
this.checkExpressionAssignable(declaration.value, declaration.type, `value.${declaration.name}.value`, this.globals);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
this.checkFunction(declaration);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
private checkFunction(declaration: PointCoreFunctionDeclaration) {
|
|
105
|
+
this.checkType(declaration.returnType, `fn.${declaration.name}.return`);
|
|
106
|
+
const locals = new Map(this.globals);
|
|
107
|
+
for (const param of declaration.params) {
|
|
108
|
+
this.checkType(param.type, `fn.${declaration.name}.${param.name}.type`);
|
|
109
|
+
locals.set(param.name, { type: param.type, mutable: false });
|
|
110
|
+
}
|
|
111
|
+
for (const statement of declaration.body) {
|
|
112
|
+
this.checkStatement(statement, declaration, locals);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
private checkStatement(
|
|
117
|
+
statement: PointCoreStatement,
|
|
118
|
+
fn: PointCoreFunctionDeclaration,
|
|
119
|
+
locals: Scope,
|
|
120
|
+
) {
|
|
121
|
+
if (statement.kind === "return") {
|
|
122
|
+
if (!statement.value) {
|
|
123
|
+
if (fn.returnType.name !== "Void") {
|
|
124
|
+
this.push("return-type-mismatch", `Function ${fn.name} must return ${fn.returnType.name}`, `fn.${fn.name}.return`, statement.span);
|
|
125
|
+
}
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
this.checkExpressionAssignable(statement.value, fn.returnType, `fn.${fn.name}.return`, locals);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
if (statement.kind === "value") {
|
|
132
|
+
this.checkType(statement.type, `fn.${fn.name}.${statement.name}.type`);
|
|
133
|
+
this.checkExpressionAssignable(statement.value, statement.type, `fn.${fn.name}.${statement.name}.value`, locals);
|
|
134
|
+
locals.set(statement.name, { type: statement.type, mutable: statement.mutable });
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
if (statement.kind === "assignment") {
|
|
138
|
+
this.checkAssignment(statement, fn, locals);
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
if (statement.kind === "if") {
|
|
142
|
+
this.checkExpressionAssignable(statement.condition, typeRef("Bool"), `fn.${fn.name}.if.condition`, locals);
|
|
143
|
+
const thenLocals = new Map(locals);
|
|
144
|
+
for (const child of statement.thenBody) this.checkStatement(child, fn, thenLocals);
|
|
145
|
+
const elseLocals = new Map(locals);
|
|
146
|
+
for (const child of statement.elseBody) this.checkStatement(child, fn, elseLocals);
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
if (statement.kind === "for") {
|
|
150
|
+
this.checkForStatement(statement, fn, locals);
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
this.typeOfExpression(statement.value, locals, `fn.${fn.name}.expression`);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
private checkForStatement(
|
|
157
|
+
statement: Extract<PointCoreStatement, { kind: "for" }>,
|
|
158
|
+
fn: PointCoreFunctionDeclaration,
|
|
159
|
+
locals: Scope,
|
|
160
|
+
) {
|
|
161
|
+
const path = `fn.${fn.name}.for.${statement.itemName}`;
|
|
162
|
+
const iterableType = this.typeOfExpression(statement.iterable, locals, `${path}.iterable`);
|
|
163
|
+
if (!iterableType) return;
|
|
164
|
+
if (iterableType.name !== "List" || iterableType.args.length !== 1) {
|
|
165
|
+
this.push("iteration-type-mismatch", "for requires a List<T> iterable", path, statement.span, {
|
|
166
|
+
expected: "List<T>",
|
|
167
|
+
actual: formatType(iterableType),
|
|
168
|
+
repair: "Iterate over a List<T> value or change this expression to a list.",
|
|
169
|
+
});
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
const loopLocals = new Map(locals);
|
|
173
|
+
loopLocals.set(statement.itemName, { type: iterableType.args[0]!, mutable: false });
|
|
174
|
+
for (const child of statement.body) this.checkStatement(child, fn, loopLocals);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
private checkAssignment(
|
|
178
|
+
statement: Extract<PointCoreStatement, { kind: "assignment" }>,
|
|
179
|
+
fn: PointCoreFunctionDeclaration,
|
|
180
|
+
locals: Scope,
|
|
181
|
+
) {
|
|
182
|
+
const target = locals.get(statement.name);
|
|
183
|
+
const path = `fn.${fn.name}.${statement.name}.assignment`;
|
|
184
|
+
if (!target) {
|
|
185
|
+
this.push("unknown-identifier", `Unknown identifier ${statement.name}`, path, statement.span, {
|
|
186
|
+
actual: statement.name,
|
|
187
|
+
repair: `Declare var ${statement.name}: <Type> before assigning to it.`,
|
|
188
|
+
});
|
|
189
|
+
this.typeOfExpression(statement.value, locals, `${path}.value`);
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
if (!target.mutable) {
|
|
193
|
+
this.push("immutable-assignment", `Cannot assign to immutable value ${statement.name}`, path, statement.span, {
|
|
194
|
+
actual: statement.name,
|
|
195
|
+
repair: `Declare ${statement.name} with var if it needs to change.`,
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
if ((statement.operator === "+=" || statement.operator === "-=") && !isNumeric(String(target.type.name))) {
|
|
199
|
+
this.push("operator-type-mismatch", `${statement.operator} requires a numeric target`, path, statement.span, {
|
|
200
|
+
expected: "Int or Float target",
|
|
201
|
+
actual: formatType(target.type),
|
|
202
|
+
repair: `Use ${statement.operator} only with Int or Float values.`,
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
this.checkExpressionAssignable(statement.value, target.type, `${path}.value`, locals);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
private checkExpressionAssignable(
|
|
209
|
+
expression: PointCoreExpression,
|
|
210
|
+
expected: PointCoreTypeExpression,
|
|
211
|
+
path: string,
|
|
212
|
+
scope: Scope,
|
|
213
|
+
) {
|
|
214
|
+
if (expected.name === "Maybe" && expected.args.length === 1) {
|
|
215
|
+
if (expression.kind === "literal" && expression.value === null) return;
|
|
216
|
+
if (expression.kind !== "record" && expression.kind !== "list") {
|
|
217
|
+
const actual = this.typeOfExpression(expression, scope, path);
|
|
218
|
+
if (actual && sameType(actual, expected)) return;
|
|
219
|
+
}
|
|
220
|
+
this.checkExpressionAssignable(expression, expected.args[0]!, path, scope);
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
if (expected.name === "Or" && expected.args.length > 0) {
|
|
224
|
+
const diagnosticsBefore = this.diagnostics.length;
|
|
225
|
+
const actual = this.typeOfExpression(expression, scope, path);
|
|
226
|
+
if (!actual) return;
|
|
227
|
+
if (sameType(actual, expected)) return;
|
|
228
|
+
if (expected.args.some((candidate) => sameType(candidate, actual))) return;
|
|
229
|
+
this.push("type-mismatch", `Expected ${formatType(expected)}, got ${formatType(actual)}`, path, expression.span, {
|
|
230
|
+
expected: formatType(expected),
|
|
231
|
+
actual: formatType(actual),
|
|
232
|
+
repair: `Return or assign one of: ${expected.args.map(formatType).join(", ")}.`,
|
|
233
|
+
});
|
|
234
|
+
if (this.diagnostics.length > diagnosticsBefore + 1) return;
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
if (expression.kind === "list") {
|
|
238
|
+
this.checkListAssignable(expression, expected, path, scope);
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
if (expression.kind === "record") {
|
|
242
|
+
this.checkRecordAssignable(expression, expected, path, scope);
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
const actual = this.typeOfExpression(expression, scope, path);
|
|
246
|
+
if (actual && !sameType(actual, expected)) {
|
|
247
|
+
this.push("type-mismatch", `Expected ${formatType(expected)}, got ${formatType(actual)}`, path, expression.span, {
|
|
248
|
+
expected: formatType(expected),
|
|
249
|
+
actual: formatType(actual),
|
|
250
|
+
repair: `Return or assign a ${formatType(expected)} value here.`,
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
private checkListAssignable(
|
|
256
|
+
expression: Extract<PointCoreExpression, { kind: "list" }>,
|
|
257
|
+
expected: PointCoreTypeExpression,
|
|
258
|
+
path: string,
|
|
259
|
+
scope: Scope,
|
|
260
|
+
) {
|
|
261
|
+
if (expected.name !== "List" || expected.args.length !== 1) {
|
|
262
|
+
this.push("type-mismatch", `Expected ${formatType(expected)}, got List`, path, expression.span, {
|
|
263
|
+
expected: formatType(expected),
|
|
264
|
+
actual: "List",
|
|
265
|
+
repair: `Annotate this value as List<T> or replace the list with a ${formatType(expected)} value.`,
|
|
266
|
+
});
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
for (const [index, item] of expression.items.entries()) {
|
|
270
|
+
this.checkExpressionAssignable(item, expected.args[0]!, `${path}.${index}`, scope);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
private checkRecordAssignable(
|
|
275
|
+
expression: Extract<PointCoreExpression, { kind: "record" }>,
|
|
276
|
+
expected: PointCoreTypeExpression,
|
|
277
|
+
path: string,
|
|
278
|
+
scope: Scope,
|
|
279
|
+
) {
|
|
280
|
+
const declaration = this.typeDeclarations.get(String(expected.name));
|
|
281
|
+
if (!declaration) {
|
|
282
|
+
this.push("type-mismatch", `Expected ${formatType(expected)}, got record`, path, expression.span, {
|
|
283
|
+
expected: formatType(expected),
|
|
284
|
+
actual: "record",
|
|
285
|
+
repair: "Assign record literals to a named type with declared fields.",
|
|
286
|
+
});
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
const provided = new Map(expression.fields.map((field) => [field.name, field]));
|
|
290
|
+
for (const field of declaration.fields) {
|
|
291
|
+
const value = provided.get(field.name);
|
|
292
|
+
if (!value) {
|
|
293
|
+
this.push("missing-field", `Missing field ${field.name}`, `${path}.${field.name}`, expression.span, {
|
|
294
|
+
expected: declaration.fields.map((candidate) => candidate.name),
|
|
295
|
+
actual: [...provided.keys()].join(", "),
|
|
296
|
+
repair: `Add field ${field.name}: ${formatType(field.type)} to this record literal.`,
|
|
297
|
+
relatedRefs: this.fieldRefsFor(declaration),
|
|
298
|
+
});
|
|
299
|
+
continue;
|
|
300
|
+
}
|
|
301
|
+
this.checkExpressionAssignable(value.value, field.type, `${path}.${field.name}`, scope);
|
|
302
|
+
provided.delete(field.name);
|
|
303
|
+
}
|
|
304
|
+
for (const extra of provided.values()) {
|
|
305
|
+
this.push("unknown-field", `Unknown field ${extra.name}`, `${path}.${extra.name}`, extra.span, {
|
|
306
|
+
expected: declaration.fields.map((field) => field.name),
|
|
307
|
+
actual: extra.name,
|
|
308
|
+
repair: `Use one of: ${declaration.fields.map((field) => field.name).join(", ")}.`,
|
|
309
|
+
relatedRefs: this.fieldRefsFor(declaration),
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
private typeOfExpression(
|
|
315
|
+
expression: PointCoreExpression,
|
|
316
|
+
scope: Scope,
|
|
317
|
+
path: string,
|
|
318
|
+
awaitedCall = false,
|
|
319
|
+
): PointCoreTypeExpression | null {
|
|
320
|
+
if (expression.kind === "literal") {
|
|
321
|
+
if (expression.value === null) return { kind: "typeRef", name: "Void", args: [], span: expression.span };
|
|
322
|
+
const valueType =
|
|
323
|
+
typeof expression.value === "string"
|
|
324
|
+
? "Text"
|
|
325
|
+
: typeof expression.value === "boolean"
|
|
326
|
+
? "Bool"
|
|
327
|
+
: Number.isInteger(expression.value)
|
|
328
|
+
? "Int"
|
|
329
|
+
: "Float";
|
|
330
|
+
return { kind: "typeRef", name: valueType, args: [], span: expression.span };
|
|
331
|
+
}
|
|
332
|
+
if (expression.kind === "list") return this.typeOfListExpression(expression, scope, path);
|
|
333
|
+
if (expression.kind === "record") {
|
|
334
|
+
this.push("record-type-required", "Record literals require an expected named type", path, expression.span);
|
|
335
|
+
return null;
|
|
336
|
+
}
|
|
337
|
+
if (expression.kind === "identifier") {
|
|
338
|
+
const entry = scope.get(expression.name);
|
|
339
|
+
if (!entry) {
|
|
340
|
+
this.push("unknown-identifier", `Unknown identifier ${expression.name}`, path, expression.span, {
|
|
341
|
+
actual: expression.name,
|
|
342
|
+
repair: `Declare ${expression.name}, pass it as a parameter, or replace it with an in-scope symbol.`,
|
|
343
|
+
});
|
|
344
|
+
return null;
|
|
345
|
+
}
|
|
346
|
+
return entry.type;
|
|
347
|
+
}
|
|
348
|
+
if (expression.kind === "binary") {
|
|
349
|
+
return this.typeOfBinaryExpression(expression, scope, path);
|
|
350
|
+
}
|
|
351
|
+
if (expression.kind === "property") {
|
|
352
|
+
return this.typeOfPropertyExpression(expression, scope, path);
|
|
353
|
+
}
|
|
354
|
+
if (expression.kind === "await") {
|
|
355
|
+
return this.typeOfExpression(expression.value, scope, path, true);
|
|
356
|
+
}
|
|
357
|
+
if (expression.callee === "Error") {
|
|
358
|
+
if (expression.args.length !== 1) {
|
|
359
|
+
this.push("arity-mismatch", "Error expects 1 message argument", path, expression.span, {
|
|
360
|
+
expected: "1 arg",
|
|
361
|
+
actual: `${expression.args.length} args`,
|
|
362
|
+
repair: "Construct errors as Error(\"message\").",
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
const message = expression.args[0];
|
|
366
|
+
if (message) this.checkExpressionAssignable(message, typeRef("Text"), `${path}.message`, scope);
|
|
367
|
+
return typeRef("Error", [], expression.span);
|
|
368
|
+
}
|
|
369
|
+
if (expression.callee === "Ok") {
|
|
370
|
+
return expression.args[0] ? this.typeOfExpression(expression.args[0], scope, `${path}.value`) : typeRef("Void", [], expression.span);
|
|
371
|
+
}
|
|
372
|
+
const target = this.functions.get(expression.callee);
|
|
373
|
+
if (!target) {
|
|
374
|
+
this.push("unknown-function", `Unknown function ${expression.callee}`, path, expression.span, {
|
|
375
|
+
actual: expression.callee,
|
|
376
|
+
expected: [...this.functions.keys()],
|
|
377
|
+
repair: `Define fn ${expression.callee}(...) or call an existing function.`,
|
|
378
|
+
});
|
|
379
|
+
return null;
|
|
380
|
+
}
|
|
381
|
+
if ((target.semantic?.kind === "action" || target.semantic?.kind === "workflow") && !awaitedCall) {
|
|
382
|
+
this.push("missing-await", `Action ${expression.callee} must be awaited`, path, expression.span, {
|
|
383
|
+
expected: `await ${expression.callee}(...)`,
|
|
384
|
+
actual: `${expression.callee}(...)`,
|
|
385
|
+
repair: "Prefix this action call with await.",
|
|
386
|
+
relatedRefs: [this.refFor(`fn.${target.name}`)],
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
if (target.params.length !== expression.args.length) {
|
|
390
|
+
this.push("arity-mismatch", `Function ${expression.callee} expects ${target.params.length} args`, path, expression.span, {
|
|
391
|
+
expected: `${target.params.length} args`,
|
|
392
|
+
actual: `${expression.args.length} args`,
|
|
393
|
+
repair: `Call ${expression.callee} with ${target.params.length} argument(s).`,
|
|
394
|
+
relatedRefs: [this.refFor(`fn.${target.name}`)],
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
for (const [index, arg] of expression.args.entries()) {
|
|
398
|
+
const param = target.params[index];
|
|
399
|
+
if (param) this.checkExpressionAssignable(arg, param.type, `${path}.arg${index}`, scope);
|
|
400
|
+
}
|
|
401
|
+
return target.returnType;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
private typeOfListExpression(
|
|
405
|
+
expression: Extract<PointCoreExpression, { kind: "list" }>,
|
|
406
|
+
scope: Scope,
|
|
407
|
+
path: string,
|
|
408
|
+
): PointCoreTypeExpression | null {
|
|
409
|
+
if (expression.items.length === 0) {
|
|
410
|
+
this.push("list-type-required", "Empty lists require an expected List type", path, expression.span);
|
|
411
|
+
return null;
|
|
412
|
+
}
|
|
413
|
+
const first = this.typeOfExpression(expression.items[0]!, scope, `${path}.0`);
|
|
414
|
+
if (!first) return null;
|
|
415
|
+
for (const [index, item] of expression.items.slice(1).entries()) {
|
|
416
|
+
const actual = this.typeOfExpression(item, scope, `${path}.${index + 1}`);
|
|
417
|
+
if (actual && !sameType(actual, first)) {
|
|
418
|
+
this.push("type-mismatch", `Expected ${formatType(first)}, got ${formatType(actual)}`, `${path}.${index + 1}`, item.span);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
return { kind: "typeRef", name: "List", args: [first], span: expression.span };
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
private typeOfPropertyExpression(
|
|
425
|
+
expression: Extract<PointCoreExpression, { kind: "property" }>,
|
|
426
|
+
scope: Scope,
|
|
427
|
+
path: string,
|
|
428
|
+
): PointCoreTypeExpression | null {
|
|
429
|
+
const targetType = this.typeOfExpression(expression.target, scope, `${path}.target`);
|
|
430
|
+
if (!targetType) return null;
|
|
431
|
+
if (targetType.name === "Maybe" && targetType.args.length === 1) {
|
|
432
|
+
this.push("nullable-field-access", `Cannot access field ${expression.name} on nullable ${formatType(targetType)}`, path, expression.span, {
|
|
433
|
+
expected: formatType(targetType.args[0]!),
|
|
434
|
+
actual: formatType(targetType),
|
|
435
|
+
repair: "Check that this Maybe value is present before accessing its fields.",
|
|
436
|
+
});
|
|
437
|
+
return null;
|
|
438
|
+
}
|
|
439
|
+
const declaration = this.typeDeclarations.get(String(targetType.name));
|
|
440
|
+
if (!declaration) {
|
|
441
|
+
this.push("not-a-record", `${formatType(targetType)} has no fields`, path, expression.span, {
|
|
442
|
+
actual: formatType(targetType),
|
|
443
|
+
repair: "Only access fields on named record types.",
|
|
444
|
+
});
|
|
445
|
+
return null;
|
|
446
|
+
}
|
|
447
|
+
const field = declaration.fields.find((candidate) => candidate.name === expression.name);
|
|
448
|
+
if (!field) {
|
|
449
|
+
this.push("unknown-field", `Unknown field ${expression.name} on ${targetType.name}`, path, expression.span, {
|
|
450
|
+
expected: declaration.fields.map((candidate) => candidate.name),
|
|
451
|
+
actual: expression.name,
|
|
452
|
+
repair: `Use one of: ${declaration.fields.map((candidate) => candidate.name).join(", ")}.`,
|
|
453
|
+
relatedRefs: this.fieldRefsFor(declaration),
|
|
454
|
+
});
|
|
455
|
+
return null;
|
|
456
|
+
}
|
|
457
|
+
return field.type;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
private typeOfBinaryExpression(
|
|
461
|
+
expression: Extract<PointCoreExpression, { kind: "binary" }>,
|
|
462
|
+
scope: Scope,
|
|
463
|
+
path: string,
|
|
464
|
+
): PointCoreTypeExpression | null {
|
|
465
|
+
const left = this.typeOfExpression(expression.left, scope, `${path}.left`);
|
|
466
|
+
const right = this.typeOfExpression(expression.right, scope, `${path}.right`);
|
|
467
|
+
if (!left || !right) return null;
|
|
468
|
+
if (expression.operator === "and" || expression.operator === "or") {
|
|
469
|
+
if (left.name !== "Bool" || right.name !== "Bool") {
|
|
470
|
+
this.push("operator-type-mismatch", `${expression.operator} requires Bool operands`, path, expression.span, {
|
|
471
|
+
expected: "Bool operands",
|
|
472
|
+
actual: `${formatType(left)} and ${formatType(right)}`,
|
|
473
|
+
repair: `Use Bool expressions on both sides of ${expression.operator}.`,
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
return { kind: "typeRef", name: "Bool", args: [], span: expression.span };
|
|
477
|
+
}
|
|
478
|
+
if (expression.operator === "==" || expression.operator === "!=") {
|
|
479
|
+
if (left.name !== right.name) {
|
|
480
|
+
this.push("operator-type-mismatch", `${expression.operator} requires matching operand types`, path, expression.span, {
|
|
481
|
+
expected: formatType(left),
|
|
482
|
+
actual: formatType(right),
|
|
483
|
+
repair: "Compare values with the same Point type.",
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
return { kind: "typeRef", name: "Bool", args: [], span: expression.span };
|
|
487
|
+
}
|
|
488
|
+
if (expression.operator === "+" && left.name === "Text" && right.name === "Text") {
|
|
489
|
+
return { kind: "typeRef", name: "Text", args: [], span: expression.span };
|
|
490
|
+
}
|
|
491
|
+
if (!isNumeric(left.name) || !isNumeric(right.name)) {
|
|
492
|
+
this.push("operator-type-mismatch", `${expression.operator} requires numeric operands`, path, expression.span, {
|
|
493
|
+
expected: "Int or Float operands",
|
|
494
|
+
actual: `${formatType(left)} and ${formatType(right)}`,
|
|
495
|
+
repair: `Use numeric expressions on both sides of ${expression.operator}.`,
|
|
496
|
+
});
|
|
497
|
+
return null;
|
|
498
|
+
}
|
|
499
|
+
if (["<", "<=", ">", ">="].includes(expression.operator)) {
|
|
500
|
+
return { kind: "typeRef", name: "Bool", args: [], span: expression.span };
|
|
501
|
+
}
|
|
502
|
+
return { kind: "typeRef", name: left.name === "Float" || right.name === "Float" ? "Float" : "Int", args: [], span: expression.span };
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
private checkType(type: PointCoreTypeExpression, path: string) {
|
|
506
|
+
if (!this.types.has(type.name)) {
|
|
507
|
+
this.push("unknown-type", `Unknown type ${type.name}`, path, type.span, {
|
|
508
|
+
expected: [...this.types].sort(),
|
|
509
|
+
actual: String(type.name),
|
|
510
|
+
repair: `Declare type ${type.name} or use an existing type.`,
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
if (type.name === "List" && type.args.length !== 1) {
|
|
514
|
+
this.push("invalid-type-arity", "List requires one type argument", path, type.span, {
|
|
515
|
+
expected: "List<T>",
|
|
516
|
+
actual: formatType(type),
|
|
517
|
+
repair: "Use List<Text>, List<Int>, or another concrete item type.",
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
if (type.name === "Maybe" && type.args.length !== 1) {
|
|
521
|
+
this.push("invalid-type-arity", "Maybe requires one type argument", path, type.span, {
|
|
522
|
+
expected: "Maybe<T>",
|
|
523
|
+
actual: formatType(type),
|
|
524
|
+
repair: "Use Maybe<Text>, Maybe<User>, or another concrete optional type.",
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
if (type.name === "Or" && type.args.length < 2) {
|
|
528
|
+
this.push("invalid-type-arity", "Or requires at least two type arguments", path, type.span, {
|
|
529
|
+
expected: "A or B",
|
|
530
|
+
actual: formatType(type),
|
|
531
|
+
repair: "Use syntax such as User or Error.",
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
if (type.name !== "List" && type.name !== "Maybe" && type.name !== "Or" && type.args.length > 0 && !this.typeDeclarations.has(String(type.name))) {
|
|
535
|
+
this.push("invalid-type-arity", `${type.name} does not accept type arguments`, path, type.span, {
|
|
536
|
+
expected: String(type.name),
|
|
537
|
+
actual: formatType(type),
|
|
538
|
+
repair: `Remove type arguments from ${type.name}.`,
|
|
539
|
+
});
|
|
540
|
+
}
|
|
541
|
+
for (const arg of type.args) this.checkType(arg, `${path}.arg`);
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
private push(
|
|
545
|
+
code: string,
|
|
546
|
+
message: string,
|
|
547
|
+
path: string,
|
|
548
|
+
span: PointSourceSpan | undefined,
|
|
549
|
+
metadata: DiagnosticMetadata = {},
|
|
550
|
+
) {
|
|
551
|
+
this.diagnostics.push({
|
|
552
|
+
code,
|
|
553
|
+
message,
|
|
554
|
+
path,
|
|
555
|
+
ref: this.refFor(path),
|
|
556
|
+
severity: "error",
|
|
557
|
+
span: span ?? null,
|
|
558
|
+
...metadata,
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
private refFor(path: string): string {
|
|
563
|
+
return `point://core/${this.program.module ?? "anonymous"}/${path}`;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
private fieldRefsFor(declaration: PointCoreTypeDeclaration): string[] {
|
|
567
|
+
return declaration.fields.map((field) => this.refFor(`type.${declaration.name}.${field.name}`));
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
function isNumeric(type: string): boolean {
|
|
572
|
+
return type === "Int" || type === "Float";
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
function sameType(left: PointCoreTypeExpression, right: PointCoreTypeExpression): boolean {
|
|
576
|
+
const leftArgs = left.args ?? [];
|
|
577
|
+
const rightArgs = right.args ?? [];
|
|
578
|
+
return left.name === right.name && leftArgs.length === rightArgs.length && leftArgs.every((arg, index) => sameType(arg, rightArgs[index]!));
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
function formatType(type: PointCoreTypeExpression): string {
|
|
582
|
+
const args = type.args ?? [];
|
|
583
|
+
if (args.length === 0) return String(type.name);
|
|
584
|
+
if (type.name === "Or") return args.map(formatType).join(" or ");
|
|
585
|
+
return `${type.name}<${args.map(formatType).join(", ")}>`;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
function typeRef(name: string, args: PointCoreTypeExpression[] = [], span?: PointSourceSpan): PointCoreTypeExpression {
|
|
589
|
+
return { kind: "typeRef", name, args, span };
|
|
590
|
+
}
|