@magnusopera/fscript 0.83.2 → 0.84.0
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/README.md +10 -0
- package/dist/FScript.Language/Ast.js +82 -5
- package/dist/FScript.Language/BuiltinFunctions.js +28 -2
- package/dist/FScript.Language/BuiltinSignatures.js +3 -3
- package/dist/FScript.Language/BuiltinTypes.js +2 -2
- package/dist/FScript.Language/Eval.js +534 -253
- package/dist/FScript.Language/ExportSignatures.js +136 -0
- package/dist/FScript.Language/IncludeResolver.js +56 -35
- package/dist/FScript.Language/Interactive.js +7 -3
- package/dist/FScript.Language/Lexer.js +7 -3
- package/dist/FScript.Language/Library.js +5 -1
- package/dist/FScript.Language/Parser.js +296 -159
- package/dist/FScript.Language/TypeInfer.js +2542 -289
- package/dist/FScript.Language/Types.js +23 -1
- package/dist/FScript.Language/Value.js +3 -2
- package/dist/Library.js +1087 -102
- package/dist/fable_modules/project_cracked.json +1 -1
- package/examples/hosting.mjs +36 -0
- package/package.json +2 -1
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
|
|
2
2
|
import { Span_$reflection, Span, Position } from "./Span.js";
|
|
3
|
-
import { iterate as iterate_2, FSharpMap__Add, values, FSharpMap__get_Keys, keys, toList, FSharpMap__get_Item, FSharpMap__get_Count, forAll, FSharpMap__ContainsKey, filter, ofList, exists as exists_1, add, fold as fold_1, remove, map, FSharpMap__TryFind, tryFind, isEmpty, empty } from "../fable_modules/fable-library-js.5.13.0/Map.js";
|
|
4
|
-
import { disposeSafe, getEnumerator, Exception, stringHash, compareArrays, equals, comparePrimitives } from "../fable_modules/fable-library-js.5.13.0/Util.js";
|
|
5
|
-
import { Types_generalize, Types_freshNumeric, Type_$reflection, Types_freshVar, Types_typeToString, Scheme, Type } from "./Types.js";
|
|
6
|
-
import { tryFind as tryFind_1, indexed, collect, append, reverse, iterate, tryFindIndex, choose, tail as
|
|
3
|
+
import { find as find_1, toSeq, containsKey, iterate as iterate_2, FSharpMap__Add, values as values_4, FSharpMap__get_Keys, keys, toList, FSharpMap__get_Item, FSharpMap__get_Count, forAll, FSharpMap__ContainsKey, filter, ofList, exists as exists_1, add, fold as fold_1, remove, map, FSharpMap__TryFind, tryFind, isEmpty, empty } from "../fable_modules/fable-library-js.5.13.0/Map.js";
|
|
4
|
+
import { curry2, curry3, uncurry2, compare, disposeSafe, getEnumerator, Exception, stringHash, compareArrays, equals, comparePrimitives } from "../fable_modules/fable-library-js.5.13.0/Util.js";
|
|
5
|
+
import { PurityContractsModule_empty, Types_generalize, Types_freshNumeric, PurityContracts_$reflection, Scheme_$reflection, Type_$reflection, Types_freshVar, Types_typeToString, Scheme, Type as Type_1 } from "./Types.js";
|
|
6
|
+
import { exactlyOne, replicate, map2, sortBy, mapIndexed, tryFind as tryFind_1, indexed, collect, unzip, append, reverse, iterate, tryFindIndex, choose, tail as tail_9, cons, head as head_4, isEmpty as isEmpty_1, empty as empty_2, ofArray, singleton, zip, length, exists, fold, map as map_1 } from "../fable_modules/fable-library-js.5.13.0/List.js";
|
|
7
7
|
import { toList as toList_2, ofSeq, contains, add as add_1, empty as empty_1, FSharpSet__Add, FSharpSet__Contains } from "../fable_modules/fable-library-js.5.13.0/Set.js";
|
|
8
8
|
import { EvalException, TypeException, TypeError$ } from "./Error.js";
|
|
9
9
|
import { endsWith, split, join, concat, isNullOrWhiteSpace, printf, toText } from "../fable_modules/fable-library-js.5.13.0/String.js";
|
|
10
|
-
import { defaultArg } from "../fable_modules/fable-library-js.5.13.0/Option.js";
|
|
10
|
+
import { orElse, value as value_42, toArray, flatten, defaultArg } from "../fable_modules/fable-library-js.5.13.0/Option.js";
|
|
11
11
|
import { Union, Record } from "../fable_modules/fable-library-js.5.13.0/Types.js";
|
|
12
|
-
import { Expr, Ast_spanOfPattern, Ast_spanOfExpr, Pattern_$reflection, TypeDef_$reflection, Expr_$reflection } from "./Ast.js";
|
|
13
|
-
import {
|
|
14
|
-
import { foldBack, iterate as iterate_1, filter as filter_1, map as map_2, toList as toList_1 } from "../fable_modules/fable-library-js.5.13.0/Seq.js";
|
|
15
|
-
import { last, item as
|
|
12
|
+
import { Attribute, Expr, Ast_spanOfPattern, Ast_spanOfExpr, Attribute_$reflection, BackendImport_$reflection, Pattern_$reflection, TypeDef_$reflection, Expr_$reflection } from "./Ast.js";
|
|
13
|
+
import { array_type, class_type, tuple_type, list_type, bool_type, float64_type, int64_type, option_type, union_type, int32_type, string_type, record_type } from "../fable_modules/fable-library-js.5.13.0/Reflection.js";
|
|
14
|
+
import { exists as exists_2, forAll as forAll_1, tryPick, tryFind as tryFind_2, find, foldBack, iterate as iterate_1, filter as filter_1, map as map_2, toList as toList_1 } from "../fable_modules/fable-library-js.5.13.0/Seq.js";
|
|
15
|
+
import { last as last_2, setItem, item as item_26 } from "../fable_modules/fable-library-js.5.13.0/Array.js";
|
|
16
16
|
import { distinct } from "../fable_modules/fable-library-js.5.13.0/Seq2.js";
|
|
17
17
|
import { builtinReservedNames, builtinSchemes } from "./BuiltinSignatures.js";
|
|
18
18
|
import { ofExterns, typeDefinitions } from "./HostInterop.js";
|
|
19
19
|
import { typeDefs as typeDefs_2 } from "./BuiltinTypes.js";
|
|
20
|
+
import { rangeDouble } from "../fable_modules/fable-library-js.5.13.0/Range.js";
|
|
20
21
|
|
|
21
22
|
const unknownSpan = new Span(new Position(undefined, 0, 0), new Position(undefined, 0, 0));
|
|
22
23
|
|
|
@@ -128,29 +129,29 @@ function applyType(s, t) {
|
|
|
128
129
|
}
|
|
129
130
|
switch (matchResult_1) {
|
|
130
131
|
case 0:
|
|
131
|
-
return new
|
|
132
|
+
return new Type_1(/* TRecordShape */ 18, [id, map((_arg, t_1) => apply(t_1), mappedFields_1), mappedConstructible_1]);
|
|
132
133
|
case 1: {
|
|
133
134
|
current_mut = mapped_4;
|
|
134
135
|
continue apply;
|
|
135
136
|
}
|
|
136
137
|
default:
|
|
137
|
-
return new
|
|
138
|
+
return new Type_1(/* TRecordShape */ 18, [id, map((_arg_1, t_2) => apply(t_2), current.fields[1]), current.fields[2]]);
|
|
138
139
|
}
|
|
139
140
|
}
|
|
140
141
|
case 2:
|
|
141
|
-
return new
|
|
142
|
+
return new Type_1(/* TList */ 5, [apply(current.fields[0])]);
|
|
142
143
|
case 3:
|
|
143
|
-
return new
|
|
144
|
+
return new Type_1(/* TTask */ 6, [apply(current.fields[0])]);
|
|
144
145
|
case 4:
|
|
145
|
-
return new
|
|
146
|
+
return new Type_1(/* TTuple */ 7, [map_1(apply, current.fields[0])]);
|
|
146
147
|
case 5:
|
|
147
|
-
return new
|
|
148
|
+
return new Type_1(/* TRecord */ 8, [map((_arg_2, t1_2) => apply(t1_2), current.fields[0])]);
|
|
148
149
|
case 6:
|
|
149
|
-
return new
|
|
150
|
+
return new Type_1(/* TMap */ 9, [apply(current.fields[0]), apply(current.fields[1])]);
|
|
150
151
|
case 7:
|
|
151
|
-
return new
|
|
152
|
+
return new Type_1(/* TOption */ 10, [apply(current.fields[0])]);
|
|
152
153
|
case 8:
|
|
153
|
-
return new
|
|
154
|
+
return new Type_1(/* TFun */ 11, [apply(current.fields[0]), apply(current.fields[1])]);
|
|
154
155
|
default:
|
|
155
156
|
return current;
|
|
156
157
|
}
|
|
@@ -1040,10 +1041,10 @@ function unify(typeDefs, t1, t2, span) {
|
|
|
1040
1041
|
return fold((sAcc, tupledArg) => compose(uni(seen$0027, applyType(sAcc, tupledArg[0]), applyType(sAcc, tupledArg[1])), sAcc), emptySubst, zip(xs, ys));
|
|
1041
1042
|
}
|
|
1042
1043
|
case 5:
|
|
1043
|
-
if (equals(t, new
|
|
1044
|
+
if (equals(t, new Type_1(/* TVar */ 15, [v]))) {
|
|
1044
1045
|
return emptySubst;
|
|
1045
1046
|
}
|
|
1046
|
-
else if (equals(t, new
|
|
1047
|
+
else if (equals(t, new Type_1(/* TNumeric */ 16, [v]))) {
|
|
1047
1048
|
return ofList(singleton([v, t]), {
|
|
1048
1049
|
Compare: (x_6, y_6) => (comparePrimitives(x_6, y_6) | 0),
|
|
1049
1050
|
});
|
|
@@ -1058,7 +1059,7 @@ function unify(typeDefs, t1, t2, span) {
|
|
|
1058
1059
|
}
|
|
1059
1060
|
case 6: {
|
|
1060
1061
|
const shared = filter((name, _arg) => FSharpMap__ContainsKey(yf, name), xf);
|
|
1061
|
-
const s = uni(seen$0027, new
|
|
1062
|
+
const s = uni(seen$0027, new Type_1(/* TRecord */ 8, [shared]), new Type_1(/* TRecord */ 8, [filter((name_1, _arg_1) => FSharpMap__ContainsKey(shared, name_1), yf)]));
|
|
1062
1063
|
const fields = map((_arg_2, t_2) => applyType(s, t_2), fold_1((acc, name_2, t_1) => add(name_2, t_1, acc), xf, yf));
|
|
1063
1064
|
if (exists_1((_arg_3, t_3) => {
|
|
1064
1065
|
if (occurs(id, t_3)) {
|
|
@@ -1070,7 +1071,7 @@ function unify(typeDefs, t1, t2, span) {
|
|
|
1070
1071
|
}, fields)) {
|
|
1071
1072
|
throw new TypeException(new TypeError$("Occurs check failed", span));
|
|
1072
1073
|
}
|
|
1073
|
-
const merged = new
|
|
1074
|
+
const merged = new Type_1(/* TRecordShape */ 18, [other, fields, xc ? true : yc]);
|
|
1074
1075
|
return compose((id === other) ? ofList(singleton([other, merged]), {
|
|
1075
1076
|
Compare: (x_8, y_8) => (comparePrimitives(x_8, y_8) | 0),
|
|
1076
1077
|
}) : ofList(ofArray([[id, merged], [other, merged]]), {
|
|
@@ -1147,7 +1148,7 @@ function unify(typeDefs, t1, t2, span) {
|
|
|
1147
1148
|
}
|
|
1148
1149
|
switch (matchResult_2) {
|
|
1149
1150
|
case 0: {
|
|
1150
|
-
const s_1 = uni(seen$0027, new
|
|
1151
|
+
const s_1 = uni(seen$0027, new Type_1(/* TRecord */ 8, [required]), new Type_1(/* TRecord */ 8, [filter((name_5, _arg_5) => FSharpMap__ContainsKey(required, name_5), fields_5)]));
|
|
1151
1152
|
return compose(ofList(singleton([id_1, applyType(s_1, concrete)]), {
|
|
1152
1153
|
Compare: (x_10, y_10) => (comparePrimitives(x_10, y_10) | 0),
|
|
1153
1154
|
}), s_1);
|
|
@@ -1188,7 +1189,7 @@ function unify(typeDefs, t1, t2, span) {
|
|
|
1188
1189
|
const matchValue_2 = FSharpMap__TryFind(typeDefs, name_8);
|
|
1189
1190
|
let matchResult_3, expanded_1;
|
|
1190
1191
|
if (matchValue_2 != null) {
|
|
1191
|
-
if (!equals(matchValue_2, new
|
|
1192
|
+
if (!equals(matchValue_2, new Type_1(/* TNamed */ 12, [name_8]))) {
|
|
1192
1193
|
matchResult_3 = 0;
|
|
1193
1194
|
expanded_1 = matchValue_2;
|
|
1194
1195
|
}
|
|
@@ -1233,7 +1234,7 @@ function unify(typeDefs, t1, t2, span) {
|
|
|
1233
1234
|
const matchValue_3 = FSharpMap__TryFind(typeDefs, name_9);
|
|
1234
1235
|
let matchResult_5, expanded_3;
|
|
1235
1236
|
if (matchValue_3 != null) {
|
|
1236
|
-
if (!equals(matchValue_3, new
|
|
1237
|
+
if (!equals(matchValue_3, new Type_1(/* TNamed */ 12, [name_9]))) {
|
|
1237
1238
|
matchResult_5 = 0;
|
|
1238
1239
|
expanded_3 = matchValue_3;
|
|
1239
1240
|
}
|
|
@@ -1279,7 +1280,7 @@ function unify(typeDefs, t1, t2, span) {
|
|
|
1279
1280
|
return emptySubst;
|
|
1280
1281
|
}
|
|
1281
1282
|
else {
|
|
1282
|
-
return ofList(singleton([v_1, new
|
|
1283
|
+
return ofList(singleton([v_1, new Type_1(/* TNumeric */ 16, [w])]), {
|
|
1283
1284
|
Compare: (x_13, y_13) => (comparePrimitives(x_13, y_13) | 0),
|
|
1284
1285
|
});
|
|
1285
1286
|
}
|
|
@@ -1327,29 +1328,29 @@ function instantiate(_arg) {
|
|
|
1327
1328
|
}
|
|
1328
1329
|
switch (matchResult) {
|
|
1329
1330
|
case 0:
|
|
1330
|
-
return new
|
|
1331
|
+
return new Type_1(/* TNumeric */ 16, [fresh]);
|
|
1331
1332
|
default:
|
|
1332
1333
|
return t_1;
|
|
1333
1334
|
}
|
|
1334
1335
|
}
|
|
1335
1336
|
case 18: {
|
|
1336
1337
|
const id = t_1.fields[0] | 0;
|
|
1337
|
-
return new
|
|
1338
|
+
return new Type_1(/* TRecordShape */ 18, [(matchValue_1 = FSharpMap__TryFind(freshMap, id), (matchValue_1 != null) ? ((matchValue_1.tag === 15) ? ((v_3 = (matchValue_1.fields[0] | 0), v_3)) : id) : id), map((_arg_1, t_2) => subst(t_2), t_1.fields[1]), t_1.fields[2]]);
|
|
1338
1339
|
}
|
|
1339
1340
|
case 5:
|
|
1340
|
-
return new
|
|
1341
|
+
return new Type_1(/* TList */ 5, [subst(t_1.fields[0])]);
|
|
1341
1342
|
case 6:
|
|
1342
|
-
return new
|
|
1343
|
+
return new Type_1(/* TTask */ 6, [subst(t_1.fields[0])]);
|
|
1343
1344
|
case 7:
|
|
1344
|
-
return new
|
|
1345
|
+
return new Type_1(/* TTuple */ 7, [map_1(subst, t_1.fields[0])]);
|
|
1345
1346
|
case 8:
|
|
1346
|
-
return new
|
|
1347
|
+
return new Type_1(/* TRecord */ 8, [map((_arg_2, t1) => subst(t1), t_1.fields[0])]);
|
|
1347
1348
|
case 9:
|
|
1348
|
-
return new
|
|
1349
|
+
return new Type_1(/* TMap */ 9, [subst(t_1.fields[0]), subst(t_1.fields[1])]);
|
|
1349
1350
|
case 10:
|
|
1350
|
-
return new
|
|
1351
|
+
return new Type_1(/* TOption */ 10, [subst(t_1.fields[0])]);
|
|
1351
1352
|
case 11:
|
|
1352
|
-
return new
|
|
1353
|
+
return new Type_1(/* TFun */ 11, [subst(t_1.fields[0]), subst(t_1.fields[1])]);
|
|
1353
1354
|
default:
|
|
1354
1355
|
return t_1;
|
|
1355
1356
|
}
|
|
@@ -1383,6 +1384,264 @@ export function LocalVariableTypeInfo_$reflection() {
|
|
|
1383
1384
|
return record_type("FScript.Language.TypeInfer.LocalVariableTypeInfo", [], LocalVariableTypeInfo, () => [["Name", string_type], ["Span", Span_$reflection()], ["Type", Type_$reflection()]]);
|
|
1384
1385
|
}
|
|
1385
1386
|
|
|
1387
|
+
export class ResolvedExpressionType extends Record {
|
|
1388
|
+
constructor(Expr, Type, Span) {
|
|
1389
|
+
super();
|
|
1390
|
+
this.Expr = Expr;
|
|
1391
|
+
this.Type = Type;
|
|
1392
|
+
this.Span = Span;
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
|
|
1396
|
+
export function ResolvedExpressionType_$reflection() {
|
|
1397
|
+
return record_type("FScript.Language.TypeInfer.ResolvedExpressionType", [], ResolvedExpressionType, () => [["Expr", Expr_$reflection()], ["Type", Type_$reflection()], ["Span", Span_$reflection()]]);
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1400
|
+
export class ResolvedSymbolReference extends Record {
|
|
1401
|
+
constructor(SymbolId, Name, Kind, Type, Span) {
|
|
1402
|
+
super();
|
|
1403
|
+
this.SymbolId = (SymbolId | 0);
|
|
1404
|
+
this.Name = Name;
|
|
1405
|
+
this.Kind = Kind;
|
|
1406
|
+
this.Type = Type;
|
|
1407
|
+
this.Span = Span;
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1411
|
+
export function ResolvedSymbolReference_$reflection() {
|
|
1412
|
+
return record_type("FScript.Language.TypeInfer.ResolvedSymbolReference", [], ResolvedSymbolReference, () => [["SymbolId", int32_type], ["Name", string_type], ["Kind", ResolvedSymbolKind_$reflection()], ["Type", Type_$reflection()], ["Span", Span_$reflection()]]);
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
export class ResolvedSymbolKind extends Union {
|
|
1416
|
+
constructor(tag, fields) {
|
|
1417
|
+
super();
|
|
1418
|
+
this.tag = tag;
|
|
1419
|
+
this.fields = fields;
|
|
1420
|
+
}
|
|
1421
|
+
cases() {
|
|
1422
|
+
return ["TypeSymbol", "DeclarationSymbol", "ParameterSymbol", "PatternBindingSymbol", "LocalSymbol", "BuiltinSymbol", "ExternSymbol", "UnionCaseSymbol"];
|
|
1423
|
+
}
|
|
1424
|
+
static TypeSymbol = new ResolvedSymbolKind(0, []);
|
|
1425
|
+
static DeclarationSymbol = new ResolvedSymbolKind(1, []);
|
|
1426
|
+
static ParameterSymbol = new ResolvedSymbolKind(2, []);
|
|
1427
|
+
static PatternBindingSymbol = new ResolvedSymbolKind(3, []);
|
|
1428
|
+
static LocalSymbol = new ResolvedSymbolKind(4, []);
|
|
1429
|
+
static BuiltinSymbol = new ResolvedSymbolKind(5, []);
|
|
1430
|
+
static ExternSymbol = new ResolvedSymbolKind(6, []);
|
|
1431
|
+
static UnionCaseSymbol = new ResolvedSymbolKind(7, []);
|
|
1432
|
+
}
|
|
1433
|
+
|
|
1434
|
+
export function ResolvedSymbolKind_$reflection() {
|
|
1435
|
+
return union_type("FScript.Language.TypeInfer.ResolvedSymbolKind", [], ResolvedSymbolKind, () => [[], [], [], [], [], [], [], []]);
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1438
|
+
export class ResolvedSymbol extends Record {
|
|
1439
|
+
constructor(SymbolId, Name, Kind, Span, Scheme) {
|
|
1440
|
+
super();
|
|
1441
|
+
this.SymbolId = (SymbolId | 0);
|
|
1442
|
+
this.Name = Name;
|
|
1443
|
+
this.Kind = Kind;
|
|
1444
|
+
this.Span = Span;
|
|
1445
|
+
this.Scheme = Scheme;
|
|
1446
|
+
}
|
|
1447
|
+
}
|
|
1448
|
+
|
|
1449
|
+
export function ResolvedSymbol_$reflection() {
|
|
1450
|
+
return record_type("FScript.Language.TypeInfer.ResolvedSymbol", [], ResolvedSymbol, () => [["SymbolId", int32_type], ["Name", string_type], ["Kind", ResolvedSymbolKind_$reflection()], ["Span", Span_$reflection()], ["Scheme", option_type(Scheme_$reflection())]]);
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
export class ResolvedPrimitiveOperation extends Union {
|
|
1454
|
+
constructor(tag, fields) {
|
|
1455
|
+
super();
|
|
1456
|
+
this.tag = tag;
|
|
1457
|
+
this.fields = fields;
|
|
1458
|
+
}
|
|
1459
|
+
cases() {
|
|
1460
|
+
return ["NumericAddition", "NumericSubtraction", "NumericMultiplication", "NumericDivision", "IntegerAddition", "FloatingAddition", "IntegerSubtraction", "FloatingSubtraction", "IntegerMultiplication", "FloatingMultiplication", "IntegerDivision", "FloatingDivision", "IntegerRemainder", "StructuralEquality", "NumericComparison", "BooleanOperation"];
|
|
1461
|
+
}
|
|
1462
|
+
static NumericAddition = new ResolvedPrimitiveOperation(0, []);
|
|
1463
|
+
static NumericSubtraction = new ResolvedPrimitiveOperation(1, []);
|
|
1464
|
+
static NumericMultiplication = new ResolvedPrimitiveOperation(2, []);
|
|
1465
|
+
static NumericDivision = new ResolvedPrimitiveOperation(3, []);
|
|
1466
|
+
static IntegerAddition = new ResolvedPrimitiveOperation(4, []);
|
|
1467
|
+
static FloatingAddition = new ResolvedPrimitiveOperation(5, []);
|
|
1468
|
+
static IntegerSubtraction = new ResolvedPrimitiveOperation(6, []);
|
|
1469
|
+
static FloatingSubtraction = new ResolvedPrimitiveOperation(7, []);
|
|
1470
|
+
static IntegerMultiplication = new ResolvedPrimitiveOperation(8, []);
|
|
1471
|
+
static FloatingMultiplication = new ResolvedPrimitiveOperation(9, []);
|
|
1472
|
+
static IntegerDivision = new ResolvedPrimitiveOperation(10, []);
|
|
1473
|
+
static FloatingDivision = new ResolvedPrimitiveOperation(11, []);
|
|
1474
|
+
static IntegerRemainder = new ResolvedPrimitiveOperation(12, []);
|
|
1475
|
+
static StructuralEquality = new ResolvedPrimitiveOperation(13, []);
|
|
1476
|
+
}
|
|
1477
|
+
|
|
1478
|
+
export function ResolvedPrimitiveOperation_$reflection() {
|
|
1479
|
+
return union_type("FScript.Language.TypeInfer.ResolvedPrimitiveOperation", [], ResolvedPrimitiveOperation, () => [[], [], [], [], [], [], [], [], [], [], [], [], [], [], [["Item", string_type]], [["Item", string_type]]]);
|
|
1480
|
+
}
|
|
1481
|
+
|
|
1482
|
+
export class RecordCoercionEvidence extends Record {
|
|
1483
|
+
constructor(SourceType, TargetType, TargetName) {
|
|
1484
|
+
super();
|
|
1485
|
+
this.SourceType = SourceType;
|
|
1486
|
+
this.TargetType = TargetType;
|
|
1487
|
+
this.TargetName = TargetName;
|
|
1488
|
+
}
|
|
1489
|
+
}
|
|
1490
|
+
|
|
1491
|
+
export function RecordCoercionEvidence_$reflection() {
|
|
1492
|
+
return record_type("FScript.Language.TypeInfer.RecordCoercionEvidence", [], RecordCoercionEvidence, () => [["SourceType", Type_$reflection()], ["TargetType", Type_$reflection()], ["TargetName", option_type(string_type)]]);
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
export class ResolvedLiteral extends Union {
|
|
1496
|
+
constructor(tag, fields) {
|
|
1497
|
+
super();
|
|
1498
|
+
this.tag = tag;
|
|
1499
|
+
this.fields = fields;
|
|
1500
|
+
}
|
|
1501
|
+
cases() {
|
|
1502
|
+
return ["ResolvedUnit", "ResolvedInt", "ResolvedFloat", "ResolvedBool", "ResolvedString"];
|
|
1503
|
+
}
|
|
1504
|
+
static ResolvedUnit = new ResolvedLiteral(0, []);
|
|
1505
|
+
}
|
|
1506
|
+
|
|
1507
|
+
export function ResolvedLiteral_$reflection() {
|
|
1508
|
+
return union_type("FScript.Language.TypeInfer.ResolvedLiteral", [], ResolvedLiteral, () => [[], [["Item", int64_type]], [["Item", float64_type]], [["Item", bool_type]], [["Item", string_type]]]);
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1511
|
+
export class ResolvedBinding extends Record {
|
|
1512
|
+
constructor(SymbolId, Name, Type, Span) {
|
|
1513
|
+
super();
|
|
1514
|
+
this.SymbolId = (SymbolId | 0);
|
|
1515
|
+
this.Name = Name;
|
|
1516
|
+
this.Type = Type;
|
|
1517
|
+
this.Span = Span;
|
|
1518
|
+
}
|
|
1519
|
+
}
|
|
1520
|
+
|
|
1521
|
+
export function ResolvedBinding_$reflection() {
|
|
1522
|
+
return record_type("FScript.Language.TypeInfer.ResolvedBinding", [], ResolvedBinding, () => [["SymbolId", int32_type], ["Name", string_type], ["Type", Type_$reflection()], ["Span", Span_$reflection()]]);
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1525
|
+
export class ResolvedExpression extends Record {
|
|
1526
|
+
constructor(Type, Span, Reference, Primitive, RecordCoercion, Node$, Children) {
|
|
1527
|
+
super();
|
|
1528
|
+
this.Type = Type;
|
|
1529
|
+
this.Span = Span;
|
|
1530
|
+
this.Reference = Reference;
|
|
1531
|
+
this.Primitive = Primitive;
|
|
1532
|
+
this.RecordCoercion = RecordCoercion;
|
|
1533
|
+
this.Node = Node$;
|
|
1534
|
+
this.Children = Children;
|
|
1535
|
+
}
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
export function ResolvedExpression_$reflection() {
|
|
1539
|
+
return record_type("FScript.Language.TypeInfer.ResolvedExpression", [], ResolvedExpression, () => [["Type", Type_$reflection()], ["Span", Span_$reflection()], ["Reference", option_type(ResolvedSymbolReference_$reflection())], ["Primitive", option_type(ResolvedPrimitiveOperation_$reflection())], ["RecordCoercion", option_type(RecordCoercionEvidence_$reflection())], ["Node", ResolvedExpressionNode_$reflection()], ["Children", list_type(ResolvedExpression_$reflection())]]);
|
|
1540
|
+
}
|
|
1541
|
+
|
|
1542
|
+
export class ResolvedExpressionNode extends Union {
|
|
1543
|
+
constructor(tag, fields) {
|
|
1544
|
+
super();
|
|
1545
|
+
this.tag = tag;
|
|
1546
|
+
this.fields = fields;
|
|
1547
|
+
}
|
|
1548
|
+
cases() {
|
|
1549
|
+
return ["ResolvedConstant", "ResolvedReference", "ResolvedLambda", "ResolvedApply", "ResolvedPipe", "ResolvedIf", "ResolvedPrimitive", "ResolvedTuple", "ResolvedList", "ResolvedRecord", "ResolvedFieldGet", "ResolvedSome", "ResolvedNone", "ResolvedCons", "ResolvedAppend", "ResolvedLet", "ResolvedLetRecursiveGroup", "ResolvedFail", "ResolvedMatch", "ResolvedRange", "ResolvedRecordUpdate", "ResolvedIndexGet", "ResolvedInterpolate", "ResolvedMap", "ResolvedForEach", "ResolvedTypeToken"];
|
|
1550
|
+
}
|
|
1551
|
+
static ResolvedNone = new ResolvedExpressionNode(12, []);
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1554
|
+
export function ResolvedExpressionNode_$reflection() {
|
|
1555
|
+
return union_type("FScript.Language.TypeInfer.ResolvedExpressionNode", [], ResolvedExpressionNode, () => [[["Item", ResolvedLiteral_$reflection()]], [["Item", ResolvedSymbolReference_$reflection()]], [["Item1", ResolvedBinding_$reflection()], ["Item2", ResolvedExpression_$reflection()]], [["Item1", ResolvedExpression_$reflection()], ["Item2", ResolvedExpression_$reflection()]], [["Item1", ResolvedExpression_$reflection()], ["Item2", ResolvedExpression_$reflection()]], [["Item1", ResolvedExpression_$reflection()], ["Item2", ResolvedExpression_$reflection()], ["Item3", ResolvedExpression_$reflection()]], [["Item1", ResolvedPrimitiveOperation_$reflection()], ["Item2", list_type(ResolvedExpression_$reflection())]], [["Item", list_type(ResolvedExpression_$reflection())]], [["Item", list_type(ResolvedExpression_$reflection())]], [["Item", list_type(tuple_type(string_type, ResolvedExpression_$reflection()))]], [["Item1", ResolvedExpression_$reflection()], ["Item2", string_type]], [["Item", ResolvedExpression_$reflection()]], [], [["Item1", ResolvedExpression_$reflection()], ["Item2", ResolvedExpression_$reflection()]], [["Item1", ResolvedExpression_$reflection()], ["Item2", ResolvedExpression_$reflection()]], [["Item1", ResolvedBinding_$reflection()], ["Item2", bool_type], ["Item3", ResolvedExpression_$reflection()], ["Item4", ResolvedExpression_$reflection()]], [["Item1", list_type(ResolvedRecursiveBinding_$reflection())], ["Item2", ResolvedExpression_$reflection()]], [["Item", ResolvedExpression_$reflection()]], [["Item1", ResolvedExpression_$reflection()], ["Item2", list_type(ResolvedMatchCase_$reflection())]], [["Item1", ResolvedExpression_$reflection()], ["Item2", ResolvedExpression_$reflection()]], [["Item1", bool_type], ["Item2", ResolvedExpression_$reflection()], ["Item3", list_type(tuple_type(string_type, ResolvedExpression_$reflection()))]], [["Item1", ResolvedExpression_$reflection()], ["Item2", ResolvedExpression_$reflection()]], [["Item", list_type(ResolvedInterpolationPart_$reflection())]], [["Item", list_type(ResolvedMapEntry_$reflection())]], [["Item1", ResolvedBinding_$reflection()], ["Item2", ResolvedExpression_$reflection()], ["Item3", ResolvedExpression_$reflection()]], [["Item", Type_$reflection()]]]);
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1558
|
+
export class ResolvedRecursiveBinding extends Record {
|
|
1559
|
+
constructor(Binding, Value) {
|
|
1560
|
+
super();
|
|
1561
|
+
this.Binding = Binding;
|
|
1562
|
+
this.Value = Value;
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1565
|
+
|
|
1566
|
+
export function ResolvedRecursiveBinding_$reflection() {
|
|
1567
|
+
return record_type("FScript.Language.TypeInfer.ResolvedRecursiveBinding", [], ResolvedRecursiveBinding, () => [["Binding", ResolvedBinding_$reflection()], ["Value", ResolvedExpression_$reflection()]]);
|
|
1568
|
+
}
|
|
1569
|
+
|
|
1570
|
+
export class ResolvedInterpolationPart extends Union {
|
|
1571
|
+
constructor(tag, fields) {
|
|
1572
|
+
super();
|
|
1573
|
+
this.tag = tag;
|
|
1574
|
+
this.fields = fields;
|
|
1575
|
+
}
|
|
1576
|
+
cases() {
|
|
1577
|
+
return ["ResolvedTextPart", "ResolvedValuePart"];
|
|
1578
|
+
}
|
|
1579
|
+
}
|
|
1580
|
+
|
|
1581
|
+
export function ResolvedInterpolationPart_$reflection() {
|
|
1582
|
+
return union_type("FScript.Language.TypeInfer.ResolvedInterpolationPart", [], ResolvedInterpolationPart, () => [[["Item", string_type]], [["Item", ResolvedExpression_$reflection()]]]);
|
|
1583
|
+
}
|
|
1584
|
+
|
|
1585
|
+
export class ResolvedMapEntry extends Union {
|
|
1586
|
+
constructor(tag, fields) {
|
|
1587
|
+
super();
|
|
1588
|
+
this.tag = tag;
|
|
1589
|
+
this.fields = fields;
|
|
1590
|
+
}
|
|
1591
|
+
cases() {
|
|
1592
|
+
return ["ResolvedKeyValue", "ResolvedSpread"];
|
|
1593
|
+
}
|
|
1594
|
+
}
|
|
1595
|
+
|
|
1596
|
+
export function ResolvedMapEntry_$reflection() {
|
|
1597
|
+
return union_type("FScript.Language.TypeInfer.ResolvedMapEntry", [], ResolvedMapEntry, () => [[["Item1", ResolvedExpression_$reflection()], ["Item2", ResolvedExpression_$reflection()]], [["Item", ResolvedExpression_$reflection()]]]);
|
|
1598
|
+
}
|
|
1599
|
+
|
|
1600
|
+
export class ResolvedPattern extends Record {
|
|
1601
|
+
constructor(Type, Span, Node$) {
|
|
1602
|
+
super();
|
|
1603
|
+
this.Type = Type;
|
|
1604
|
+
this.Span = Span;
|
|
1605
|
+
this.Node = Node$;
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1608
|
+
|
|
1609
|
+
export function ResolvedPattern_$reflection() {
|
|
1610
|
+
return record_type("FScript.Language.TypeInfer.ResolvedPattern", [], ResolvedPattern, () => [["Type", Type_$reflection()], ["Span", Span_$reflection()], ["Node", ResolvedPatternNode_$reflection()]]);
|
|
1611
|
+
}
|
|
1612
|
+
|
|
1613
|
+
export class ResolvedPatternNode extends Union {
|
|
1614
|
+
constructor(tag, fields) {
|
|
1615
|
+
super();
|
|
1616
|
+
this.tag = tag;
|
|
1617
|
+
this.fields = fields;
|
|
1618
|
+
}
|
|
1619
|
+
cases() {
|
|
1620
|
+
return ["ResolvedWildcard", "ResolvedPatternBinding", "ResolvedLiteralPattern", "ResolvedEmptyList", "ResolvedConsPattern", "ResolvedTuplePattern", "ResolvedRecordPattern", "ResolvedMapPattern", "ResolvedSomePattern", "ResolvedNonePattern", "ResolvedUnionPattern", "ResolvedTypePattern"];
|
|
1621
|
+
}
|
|
1622
|
+
static ResolvedWildcard = new ResolvedPatternNode(0, []);
|
|
1623
|
+
static ResolvedEmptyList = new ResolvedPatternNode(3, []);
|
|
1624
|
+
static ResolvedNonePattern = new ResolvedPatternNode(9, []);
|
|
1625
|
+
}
|
|
1626
|
+
|
|
1627
|
+
export function ResolvedPatternNode_$reflection() {
|
|
1628
|
+
return union_type("FScript.Language.TypeInfer.ResolvedPatternNode", [], ResolvedPatternNode, () => [[], [["Item", ResolvedBinding_$reflection()]], [["Item", ResolvedLiteral_$reflection()]], [], [["Item1", ResolvedPattern_$reflection()], ["Item2", ResolvedPattern_$reflection()]], [["Item", list_type(ResolvedPattern_$reflection())]], [["Item", list_type(tuple_type(string_type, ResolvedPattern_$reflection()))]], [["Item1", list_type(tuple_type(ResolvedPattern_$reflection(), ResolvedPattern_$reflection()))], ["Item2", option_type(ResolvedPattern_$reflection())]], [["Item", ResolvedPattern_$reflection()]], [], [["Item1", string_type], ["Item2", string_type], ["Item3", option_type(ResolvedPattern_$reflection())]], [["Item", Type_$reflection()]]]);
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1631
|
+
export class ResolvedMatchCase extends Record {
|
|
1632
|
+
constructor(Pattern, Guard, Body, Span) {
|
|
1633
|
+
super();
|
|
1634
|
+
this.Pattern = Pattern;
|
|
1635
|
+
this.Guard = Guard;
|
|
1636
|
+
this.Body = Body;
|
|
1637
|
+
this.Span = Span;
|
|
1638
|
+
}
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
export function ResolvedMatchCase_$reflection() {
|
|
1642
|
+
return record_type("FScript.Language.TypeInfer.ResolvedMatchCase", [], ResolvedMatchCase, () => [["Pattern", ResolvedPattern_$reflection()], ["Guard", option_type(ResolvedExpression_$reflection())], ["Body", ResolvedExpression_$reflection()], ["Span", Span_$reflection()]]);
|
|
1643
|
+
}
|
|
1644
|
+
|
|
1386
1645
|
class LocalVariableTypeCapture extends Record {
|
|
1387
1646
|
constructor(Name, Span, Type) {
|
|
1388
1647
|
super();
|
|
@@ -1403,30 +1662,159 @@ export class TypedStmt extends Union {
|
|
|
1403
1662
|
this.fields = fields;
|
|
1404
1663
|
}
|
|
1405
1664
|
cases() {
|
|
1406
|
-
return ["TSType", "TSLet", "TSLetPattern", "TSLetRecGroup", "TSExpr"];
|
|
1665
|
+
return ["TSType", "TSLet", "TSLetPattern", "TSLetRecGroup", "TSBackendImport", "TSExpr"];
|
|
1407
1666
|
}
|
|
1408
1667
|
}
|
|
1409
1668
|
|
|
1410
1669
|
export function TypedStmt_$reflection() {
|
|
1411
|
-
return union_type("FScript.Language.TypeInfer.TypedStmt", [], TypedStmt, () => [[["Item", TypeDef_$reflection()]], [["Item1", string_type], ["Item2", Expr_$reflection()], ["Item3", Type_$reflection()], ["Item4", bool_type], ["Item5", bool_type], ["Item6", Span_$reflection()]], [["Item1", Pattern_$reflection()], ["Item2", Expr_$reflection()], ["Item3", class_type("Microsoft.FSharp.Collections.FSharpMap`2", [string_type, Type_$reflection()])], ["Item4", bool_type], ["Item5", Span_$reflection()]], [["Item1", list_type(tuple_type(string_type, Expr_$reflection(), Type_$reflection(), Span_$reflection()))], ["Item2", bool_type], ["Item3", Span_$reflection()]], [["Item", TypedExpr_$reflection()]]]);
|
|
1670
|
+
return union_type("FScript.Language.TypeInfer.TypedStmt", [], TypedStmt, () => [[["Item", TypeDef_$reflection()]], [["Item1", string_type], ["Item2", Expr_$reflection()], ["Item3", Type_$reflection()], ["Item4", bool_type], ["Item5", bool_type], ["Item6", Span_$reflection()]], [["Item1", Pattern_$reflection()], ["Item2", Expr_$reflection()], ["Item3", class_type("Microsoft.FSharp.Collections.FSharpMap`2", [string_type, Type_$reflection()])], ["Item4", bool_type], ["Item5", Span_$reflection()]], [["Item1", list_type(tuple_type(string_type, Expr_$reflection(), Type_$reflection(), Span_$reflection()))], ["Item2", bool_type], ["Item3", Span_$reflection()]], [["Item1", string_type], ["Item2", Type_$reflection()], ["Item3", BackendImport_$reflection()], ["Item4", Span_$reflection()]], [["Item", TypedExpr_$reflection()]]]);
|
|
1671
|
+
}
|
|
1672
|
+
|
|
1673
|
+
export class ResolvedBackendImport extends Record {
|
|
1674
|
+
constructor(ModulePath, MemberName, Span) {
|
|
1675
|
+
super();
|
|
1676
|
+
this.ModulePath = ModulePath;
|
|
1677
|
+
this.MemberName = MemberName;
|
|
1678
|
+
this.Span = Span;
|
|
1679
|
+
}
|
|
1680
|
+
}
|
|
1681
|
+
|
|
1682
|
+
export function ResolvedBackendImport_$reflection() {
|
|
1683
|
+
return record_type("FScript.Language.TypeInfer.ResolvedBackendImport", [], ResolvedBackendImport, () => [["ModulePath", string_type], ["MemberName", string_type], ["Span", Span_$reflection()]]);
|
|
1684
|
+
}
|
|
1685
|
+
|
|
1686
|
+
export class ResolvedTypeDeclaration extends Record {
|
|
1687
|
+
constructor(Binding, IsRecursive, Definition, Fields, Cases, Import) {
|
|
1688
|
+
super();
|
|
1689
|
+
this.Binding = Binding;
|
|
1690
|
+
this.IsRecursive = IsRecursive;
|
|
1691
|
+
this.Definition = Definition;
|
|
1692
|
+
this.Fields = Fields;
|
|
1693
|
+
this.Cases = Cases;
|
|
1694
|
+
this.Import = Import;
|
|
1695
|
+
}
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1698
|
+
export function ResolvedTypeDeclaration_$reflection() {
|
|
1699
|
+
return record_type("FScript.Language.TypeInfer.ResolvedTypeDeclaration", [], ResolvedTypeDeclaration, () => [["Binding", ResolvedBinding_$reflection()], ["IsRecursive", bool_type], ["Definition", Type_$reflection()], ["Fields", list_type(tuple_type(string_type, Type_$reflection()))], ["Cases", list_type(tuple_type(string_type, option_type(Type_$reflection())))], ["Import", option_type(ResolvedBackendImport_$reflection())]]);
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1702
|
+
export class ResolvedValueDeclaration extends Record {
|
|
1703
|
+
constructor(Binding, Scheme, IsRecursive, Value) {
|
|
1704
|
+
super();
|
|
1705
|
+
this.Binding = Binding;
|
|
1706
|
+
this.Scheme = Scheme;
|
|
1707
|
+
this.IsRecursive = IsRecursive;
|
|
1708
|
+
this.Value = Value;
|
|
1709
|
+
}
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1712
|
+
export function ResolvedValueDeclaration_$reflection() {
|
|
1713
|
+
return record_type("FScript.Language.TypeInfer.ResolvedValueDeclaration", [], ResolvedValueDeclaration, () => [["Binding", ResolvedBinding_$reflection()], ["Scheme", Scheme_$reflection()], ["IsRecursive", bool_type], ["Value", ResolvedExpression_$reflection()]]);
|
|
1714
|
+
}
|
|
1715
|
+
|
|
1716
|
+
export class ResolvedPatternDeclaration extends Record {
|
|
1717
|
+
constructor(Pattern, Value, Bindings) {
|
|
1718
|
+
super();
|
|
1719
|
+
this.Pattern = Pattern;
|
|
1720
|
+
this.Value = Value;
|
|
1721
|
+
this.Bindings = Bindings;
|
|
1722
|
+
}
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1725
|
+
export function ResolvedPatternDeclaration_$reflection() {
|
|
1726
|
+
return record_type("FScript.Language.TypeInfer.ResolvedPatternDeclaration", [], ResolvedPatternDeclaration, () => [["Pattern", ResolvedPattern_$reflection()], ["Value", ResolvedExpression_$reflection()], ["Bindings", list_type(tuple_type(ResolvedBinding_$reflection(), Scheme_$reflection()))]]);
|
|
1727
|
+
}
|
|
1728
|
+
|
|
1729
|
+
export class ResolvedImportedDeclaration extends Record {
|
|
1730
|
+
constructor(Binding, Scheme, Import) {
|
|
1731
|
+
super();
|
|
1732
|
+
this.Binding = Binding;
|
|
1733
|
+
this.Scheme = Scheme;
|
|
1734
|
+
this.Import = Import;
|
|
1735
|
+
}
|
|
1736
|
+
}
|
|
1737
|
+
|
|
1738
|
+
export function ResolvedImportedDeclaration_$reflection() {
|
|
1739
|
+
return record_type("FScript.Language.TypeInfer.ResolvedImportedDeclaration", [], ResolvedImportedDeclaration, () => [["Binding", ResolvedBinding_$reflection()], ["Scheme", Scheme_$reflection()], ["Import", ResolvedBackendImport_$reflection()]]);
|
|
1740
|
+
}
|
|
1741
|
+
|
|
1742
|
+
export class ResolvedStatementNode extends Union {
|
|
1743
|
+
constructor(tag, fields) {
|
|
1744
|
+
super();
|
|
1745
|
+
this.tag = tag;
|
|
1746
|
+
this.fields = fields;
|
|
1747
|
+
}
|
|
1748
|
+
cases() {
|
|
1749
|
+
return ["ResolvedTypeDeclaration", "ResolvedValueDeclaration", "ResolvedPatternDeclaration", "ResolvedRecursiveDeclarations", "ResolvedImportedDeclaration", "ResolvedExpressionStatement"];
|
|
1750
|
+
}
|
|
1751
|
+
}
|
|
1752
|
+
|
|
1753
|
+
export function ResolvedStatementNode_$reflection() {
|
|
1754
|
+
return union_type("FScript.Language.TypeInfer.ResolvedStatementNode", [], ResolvedStatementNode, () => [[["Item", ResolvedTypeDeclaration_$reflection()]], [["Item", ResolvedValueDeclaration_$reflection()]], [["Item", ResolvedPatternDeclaration_$reflection()]], [["Item", list_type(ResolvedValueDeclaration_$reflection())]], [["Item", ResolvedImportedDeclaration_$reflection()]], [["Item", ResolvedExpression_$reflection()]]]);
|
|
1755
|
+
}
|
|
1756
|
+
|
|
1757
|
+
export class ResolvedStatement extends Record {
|
|
1758
|
+
constructor(Span, Attributes, Export, Node$, Patterns, Expressions) {
|
|
1759
|
+
super();
|
|
1760
|
+
this.Span = Span;
|
|
1761
|
+
this.Attributes = Attributes;
|
|
1762
|
+
this.Export = Export;
|
|
1763
|
+
this.Node = Node$;
|
|
1764
|
+
this.Patterns = Patterns;
|
|
1765
|
+
this.Expressions = Expressions;
|
|
1766
|
+
}
|
|
1767
|
+
}
|
|
1768
|
+
|
|
1769
|
+
export function ResolvedStatement_$reflection() {
|
|
1770
|
+
return record_type("FScript.Language.TypeInfer.ResolvedStatement", [], ResolvedStatement, () => [["Span", Span_$reflection()], ["Attributes", list_type(Attribute_$reflection())], ["Export", option_type(ResolvedExport_$reflection())], ["Node", ResolvedStatementNode_$reflection()], ["Patterns", list_type(ResolvedPattern_$reflection())], ["Expressions", list_type(ResolvedExpression_$reflection())]]);
|
|
1771
|
+
}
|
|
1772
|
+
|
|
1773
|
+
export class ResolvedExport extends Record {
|
|
1774
|
+
constructor(Name, Span) {
|
|
1775
|
+
super();
|
|
1776
|
+
this.Name = Name;
|
|
1777
|
+
this.Span = Span;
|
|
1778
|
+
}
|
|
1779
|
+
}
|
|
1780
|
+
|
|
1781
|
+
export function ResolvedExport_$reflection() {
|
|
1782
|
+
return record_type("FScript.Language.TypeInfer.ResolvedExport", [], ResolvedExport, () => [["Name", string_type], ["Span", Span_$reflection()]]);
|
|
1783
|
+
}
|
|
1784
|
+
|
|
1785
|
+
export class ResolvedProgram extends Record {
|
|
1786
|
+
constructor(Purity, TypedProgram, ResolvedStatements, ExpressionTypes, Symbols, SymbolReferences) {
|
|
1787
|
+
super();
|
|
1788
|
+
this.Purity = Purity;
|
|
1789
|
+
this.TypedProgram = TypedProgram;
|
|
1790
|
+
this.ResolvedStatements = ResolvedStatements;
|
|
1791
|
+
this.ExpressionTypes = ExpressionTypes;
|
|
1792
|
+
this.Symbols = Symbols;
|
|
1793
|
+
this.SymbolReferences = SymbolReferences;
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1796
|
+
|
|
1797
|
+
export function ResolvedProgram_$reflection() {
|
|
1798
|
+
return record_type("FScript.Language.TypeInfer.ResolvedProgram", [], ResolvedProgram, () => [["Purity", PurityContracts_$reflection()], ["TypedProgram", list_type(TypedStmt_$reflection())], ["ResolvedStatements", list_type(ResolvedStatement_$reflection())], ["ExpressionTypes", list_type(ResolvedExpressionType_$reflection())], ["Symbols", list_type(ResolvedSymbol_$reflection())], ["SymbolReferences", list_type(ResolvedSymbolReference_$reflection())]]);
|
|
1412
1799
|
}
|
|
1413
1800
|
|
|
1414
1801
|
class InferenceTelemetry extends Record {
|
|
1415
|
-
constructor(ScopeStack, LocalVariableTypes) {
|
|
1802
|
+
constructor(ScopeStack, LocalVariableTypes, ExpressionTypes) {
|
|
1416
1803
|
super();
|
|
1417
1804
|
this.ScopeStack = ScopeStack;
|
|
1418
1805
|
this.LocalVariableTypes = LocalVariableTypes;
|
|
1806
|
+
this.ExpressionTypes = ExpressionTypes;
|
|
1419
1807
|
}
|
|
1420
1808
|
}
|
|
1421
1809
|
|
|
1422
1810
|
function InferenceTelemetry_$reflection() {
|
|
1423
|
-
return record_type("FScript.Language.TypeInfer.InferenceTelemetry", [], InferenceTelemetry, () => [["ScopeStack", list_type(class_type("Microsoft.FSharp.Collections.FSharpSet`1", [string_type]))], ["LocalVariableTypes", array_type(LocalVariableTypeCapture_$reflection())]]);
|
|
1811
|
+
return record_type("FScript.Language.TypeInfer.InferenceTelemetry", [], InferenceTelemetry, () => [["ScopeStack", list_type(class_type("Microsoft.FSharp.Collections.FSharpSet`1", [string_type]))], ["LocalVariableTypes", array_type(LocalVariableTypeCapture_$reflection())], ["ExpressionTypes", array_type(ResolvedExpressionType_$reflection())]]);
|
|
1424
1812
|
}
|
|
1425
1813
|
|
|
1426
1814
|
function createTelemetry() {
|
|
1427
1815
|
return new InferenceTelemetry(singleton(empty_1({
|
|
1428
1816
|
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
1429
|
-
})), []);
|
|
1817
|
+
})), [], []);
|
|
1430
1818
|
}
|
|
1431
1819
|
|
|
1432
1820
|
function capturedLocalVariableTypes(telemetry) {
|
|
@@ -1451,7 +1839,7 @@ function withLocalBindings(telemetry, names, work) {
|
|
|
1451
1839
|
}
|
|
1452
1840
|
}, (matchValue = t.ScopeStack, isEmpty_1(matchValue) ? empty_1({
|
|
1453
1841
|
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
1454
|
-
}) :
|
|
1842
|
+
}) : head_4(matchValue)), names);
|
|
1455
1843
|
t.ScopeStack = cons(pushed, t.ScopeStack);
|
|
1456
1844
|
try {
|
|
1457
1845
|
return work();
|
|
@@ -1461,7 +1849,7 @@ function withLocalBindings(telemetry, names, work) {
|
|
|
1461
1849
|
if (isEmpty_1(matchValue_1)) {
|
|
1462
1850
|
}
|
|
1463
1851
|
else {
|
|
1464
|
-
t.ScopeStack =
|
|
1852
|
+
t.ScopeStack = tail_9(matchValue_1);
|
|
1465
1853
|
}
|
|
1466
1854
|
}
|
|
1467
1855
|
}
|
|
@@ -1476,7 +1864,7 @@ function recordLocalVariableUse(telemetry, name, span, varType) {
|
|
|
1476
1864
|
const t = telemetry;
|
|
1477
1865
|
if (contains(name, (matchValue = t.ScopeStack, isEmpty_1(matchValue) ? empty_1({
|
|
1478
1866
|
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
1479
|
-
}) :
|
|
1867
|
+
}) : head_4(matchValue)))) {
|
|
1480
1868
|
void (t.LocalVariableTypes.push(new LocalVariableTypeCapture(name, span, varType)));
|
|
1481
1869
|
}
|
|
1482
1870
|
}
|
|
@@ -1495,12 +1883,24 @@ function applySubstToCapturedLocals(telemetry, startIndex, subst) {
|
|
|
1495
1883
|
if (telemetry != null) {
|
|
1496
1884
|
const t = telemetry;
|
|
1497
1885
|
for (let i = startIndex; i <= (t.LocalVariableTypes.length - 1); i++) {
|
|
1498
|
-
const entry =
|
|
1886
|
+
const entry = item_26(i, t.LocalVariableTypes);
|
|
1499
1887
|
entry.Type = applyType(subst, entry.Type);
|
|
1500
1888
|
}
|
|
1501
1889
|
}
|
|
1502
1890
|
}
|
|
1503
1891
|
|
|
1892
|
+
function applySubstToCapturedExpressions(telemetry, startIndex, subst) {
|
|
1893
|
+
if (telemetry == null) {
|
|
1894
|
+
}
|
|
1895
|
+
else {
|
|
1896
|
+
const t = telemetry;
|
|
1897
|
+
for (let i = startIndex; i <= (t.ExpressionTypes.length - 1); i++) {
|
|
1898
|
+
const item = item_26(i, t.ExpressionTypes);
|
|
1899
|
+
setItem(t.ExpressionTypes, i, new ResolvedExpressionType(item.Expr, applyType(subst, item.Type), item.Span));
|
|
1900
|
+
}
|
|
1901
|
+
}
|
|
1902
|
+
}
|
|
1903
|
+
|
|
1504
1904
|
function currentTelemetryCaptureCount(telemetry) {
|
|
1505
1905
|
if (telemetry == null) {
|
|
1506
1906
|
return 0;
|
|
@@ -1523,24 +1923,31 @@ function ConstructorSig_$reflection() {
|
|
|
1523
1923
|
return record_type("FScript.Language.TypeInfer.ConstructorSig", [], ConstructorSig, () => [["UnionName", string_type], ["Payload", option_type(Type_$reflection())]]);
|
|
1524
1924
|
}
|
|
1525
1925
|
|
|
1526
|
-
function asTyped(expr, t) {
|
|
1527
|
-
|
|
1926
|
+
function asTyped(telemetry, expr, t) {
|
|
1927
|
+
const span = Ast_spanOfExpr(expr);
|
|
1928
|
+
if (telemetry == null) {
|
|
1929
|
+
}
|
|
1930
|
+
else {
|
|
1931
|
+
const capture = telemetry;
|
|
1932
|
+
void (capture.ExpressionTypes.push(new ResolvedExpressionType(expr, t, span)));
|
|
1933
|
+
}
|
|
1934
|
+
return new TypedExpr(expr, t, span);
|
|
1528
1935
|
}
|
|
1529
1936
|
|
|
1530
1937
|
function builtinType(name) {
|
|
1531
1938
|
switch (name) {
|
|
1532
1939
|
case "unit":
|
|
1533
|
-
return
|
|
1940
|
+
return Type_1.TUnit;
|
|
1534
1941
|
case "int":
|
|
1535
|
-
return
|
|
1942
|
+
return Type_1.TInt;
|
|
1536
1943
|
case "float":
|
|
1537
|
-
return
|
|
1944
|
+
return Type_1.TFloat;
|
|
1538
1945
|
case "numeric":
|
|
1539
1946
|
return Types_freshNumeric();
|
|
1540
1947
|
case "bool":
|
|
1541
|
-
return
|
|
1948
|
+
return Type_1.TBool;
|
|
1542
1949
|
case "string":
|
|
1543
|
-
return
|
|
1950
|
+
return Type_1.TString;
|
|
1544
1951
|
default:
|
|
1545
1952
|
return undefined;
|
|
1546
1953
|
}
|
|
@@ -1570,13 +1977,13 @@ function resolveNamedRecordByShape(typeDefs, shape, span) {
|
|
|
1570
1977
|
}
|
|
1571
1978
|
}, toList(typeDefs));
|
|
1572
1979
|
if (isEmpty_1(matches)) {
|
|
1573
|
-
throw new TypeException(new TypeError$(concat("No declared record type matches shape ", Types_typeToString(new
|
|
1980
|
+
throw new TypeException(new TypeError$(concat("No declared record type matches shape ", Types_typeToString(new Type_1(/* TRecord */ 8, [shape]))), span));
|
|
1574
1981
|
}
|
|
1575
|
-
else if (isEmpty_1(
|
|
1576
|
-
return new
|
|
1982
|
+
else if (isEmpty_1(tail_9(matches))) {
|
|
1983
|
+
return new Type_1(/* TNamed */ 12, [head_4(matches)]);
|
|
1577
1984
|
}
|
|
1578
1985
|
else {
|
|
1579
|
-
throw new TypeException(new TypeError$(concat("Ambiguous declared record type for shape ", Types_typeToString(new
|
|
1986
|
+
throw new TypeException(new TypeError$(concat("Ambiguous declared record type for shape ", Types_typeToString(new Type_1(/* TRecord */ 8, [shape])), ": ", join(", ", matches)), span));
|
|
1580
1987
|
}
|
|
1581
1988
|
}
|
|
1582
1989
|
|
|
@@ -1608,8 +2015,8 @@ function resolveNamedRecordByFieldSet(typeDefs, fields, span) {
|
|
|
1608
2015
|
if (isEmpty_1(matches)) {
|
|
1609
2016
|
throw new TypeException(new TypeError$(concat("No declared record type matches fields ", concat("{ ", join("; ", toList_2(fields)), " }")), span));
|
|
1610
2017
|
}
|
|
1611
|
-
else if (isEmpty_1(
|
|
1612
|
-
return
|
|
2018
|
+
else if (isEmpty_1(tail_9(matches))) {
|
|
2019
|
+
return head_4(matches);
|
|
1613
2020
|
}
|
|
1614
2021
|
else {
|
|
1615
2022
|
throw new TypeException(new TypeError$(concat("Ambiguous declared record type for fields ", concat("{ ", join("; ", toList_2(fields)), " }"), ": ", join(", ", matches)), span));
|
|
@@ -1623,7 +2030,7 @@ function resolveReferencedTypeName(knownNames, name, span) {
|
|
|
1623
2030
|
return name;
|
|
1624
2031
|
}
|
|
1625
2032
|
else if (name.indexOf(".") >= 0) {
|
|
1626
|
-
const shortName =
|
|
2033
|
+
const shortName = last_2(split(name, ["."], undefined, 0));
|
|
1627
2034
|
const matches = toList_1(distinct(filter_1((candidate) => {
|
|
1628
2035
|
if (candidate === shortName) {
|
|
1629
2036
|
return true;
|
|
@@ -1638,8 +2045,8 @@ function resolveReferencedTypeName(knownNames, name, span) {
|
|
|
1638
2045
|
if (isEmpty_1(matches)) {
|
|
1639
2046
|
return name;
|
|
1640
2047
|
}
|
|
1641
|
-
else if (isEmpty_1(
|
|
1642
|
-
return
|
|
2048
|
+
else if (isEmpty_1(tail_9(matches))) {
|
|
2049
|
+
return head_4(matches);
|
|
1643
2050
|
}
|
|
1644
2051
|
else {
|
|
1645
2052
|
throw new TypeException(new TypeError$(concat("Ambiguous type reference \'", name, "\'. Candidates: ", join(", ", matches)), span));
|
|
@@ -1653,25 +2060,25 @@ function resolveReferencedTypeName(knownNames, name, span) {
|
|
|
1653
2060
|
function annotationTypeFromRef(typeDefs, span, tref) {
|
|
1654
2061
|
switch (tref.tag) {
|
|
1655
2062
|
case 1:
|
|
1656
|
-
return new
|
|
2063
|
+
return new Type_1(/* TTuple */ 7, [map_1((tref_1) => annotationTypeFromRef(typeDefs, span, tref_1), tref.fields[0])]);
|
|
1657
2064
|
case 2:
|
|
1658
|
-
return new
|
|
2065
|
+
return new Type_1(/* TFun */ 11, [annotationTypeFromRef(typeDefs, span, tref.fields[0]), annotationTypeFromRef(typeDefs, span, tref.fields[1])]);
|
|
1659
2066
|
case 3:
|
|
1660
2067
|
switch (tref.fields[1]) {
|
|
1661
2068
|
case "list":
|
|
1662
|
-
return new
|
|
2069
|
+
return new Type_1(/* TList */ 5, [annotationTypeFromRef(typeDefs, span, tref.fields[0])]);
|
|
1663
2070
|
case "task":
|
|
1664
|
-
return new
|
|
2071
|
+
return new Type_1(/* TTask */ 6, [annotationTypeFromRef(typeDefs, span, tref.fields[0])]);
|
|
1665
2072
|
case "option":
|
|
1666
|
-
return new
|
|
2073
|
+
return new Type_1(/* TOption */ 10, [annotationTypeFromRef(typeDefs, span, tref.fields[0])]);
|
|
1667
2074
|
case "map":
|
|
1668
|
-
return new
|
|
2075
|
+
return new Type_1(/* TMap */ 9, [Type_1.TString, annotationTypeFromRef(typeDefs, span, tref.fields[0])]);
|
|
1669
2076
|
default:
|
|
1670
2077
|
throw new TypeException(new TypeError$(concat("Unknown type suffix \'", tref.fields[1], "\'"), span));
|
|
1671
2078
|
}
|
|
1672
2079
|
case 4: {
|
|
1673
2080
|
const key = annotationTypeFromRef(typeDefs, span, tref.fields[0]);
|
|
1674
|
-
return new
|
|
2081
|
+
return new Type_1(/* TMap */ 9, [(key.tag === 16) ? Type_1.TInt : key, annotationTypeFromRef(typeDefs, span, tref.fields[1])]);
|
|
1675
2082
|
}
|
|
1676
2083
|
case 5:
|
|
1677
2084
|
return resolveNamedRecordByShape(typeDefs, ofList(map_1((tupledArg) => [tupledArg[0], annotationTypeFromRef(typeDefs, span, tupledArg[1])], tref.fields[0]), {
|
|
@@ -1683,7 +2090,7 @@ function annotationTypeFromRef(typeDefs, span, tref) {
|
|
|
1683
2090
|
});
|
|
1684
2091
|
const matchValue = Types_freshVar();
|
|
1685
2092
|
if (matchValue.tag === 15) {
|
|
1686
|
-
return new
|
|
2093
|
+
return new Type_1(/* TRecordShape */ 18, [matchValue.fields[0], fields_2, false]);
|
|
1687
2094
|
}
|
|
1688
2095
|
else {
|
|
1689
2096
|
throw new Exception("Expected type variable");
|
|
@@ -1692,19 +2099,19 @@ function annotationTypeFromRef(typeDefs, span, tref) {
|
|
|
1692
2099
|
default:
|
|
1693
2100
|
switch (tref.fields[0]) {
|
|
1694
2101
|
case "unit":
|
|
1695
|
-
return
|
|
2102
|
+
return Type_1.TUnit;
|
|
1696
2103
|
case "int":
|
|
1697
|
-
return
|
|
2104
|
+
return Type_1.TInt;
|
|
1698
2105
|
case "float":
|
|
1699
|
-
return
|
|
2106
|
+
return Type_1.TFloat;
|
|
1700
2107
|
case "numeric":
|
|
1701
2108
|
return Types_freshNumeric();
|
|
1702
2109
|
case "bool":
|
|
1703
|
-
return
|
|
2110
|
+
return Type_1.TBool;
|
|
1704
2111
|
case "string":
|
|
1705
|
-
return
|
|
2112
|
+
return Type_1.TString;
|
|
1706
2113
|
default:
|
|
1707
|
-
return new
|
|
2114
|
+
return new Type_1(/* TNamed */ 12, [resolveReferencedTypeName(FSharpMap__get_Keys(typeDefs), tref.fields[0], span)]);
|
|
1708
2115
|
}
|
|
1709
2116
|
}
|
|
1710
2117
|
}
|
|
@@ -1727,35 +2134,35 @@ function functionReturnType(t_mut) {
|
|
|
1727
2134
|
function typeFromRef(decls, stack, tref) {
|
|
1728
2135
|
switch (tref.tag) {
|
|
1729
2136
|
case 1:
|
|
1730
|
-
return new
|
|
2137
|
+
return new Type_1(/* TTuple */ 7, [map_1((tref_1) => typeFromRef(decls, stack, tref_1), tref.fields[0])]);
|
|
1731
2138
|
case 2:
|
|
1732
|
-
return new
|
|
2139
|
+
return new Type_1(/* TFun */ 11, [typeFromRef(decls, stack, tref.fields[0]), typeFromRef(decls, stack, tref.fields[1])]);
|
|
1733
2140
|
case 3: {
|
|
1734
2141
|
const suffix = tref.fields[1];
|
|
1735
2142
|
const resolved = typeFromRef(decls, stack, tref.fields[0]);
|
|
1736
2143
|
switch (suffix) {
|
|
1737
2144
|
case "list":
|
|
1738
|
-
return new
|
|
2145
|
+
return new Type_1(/* TList */ 5, [resolved]);
|
|
1739
2146
|
case "task":
|
|
1740
|
-
return new
|
|
2147
|
+
return new Type_1(/* TTask */ 6, [resolved]);
|
|
1741
2148
|
case "option":
|
|
1742
|
-
return new
|
|
2149
|
+
return new Type_1(/* TOption */ 10, [resolved]);
|
|
1743
2150
|
case "map":
|
|
1744
|
-
return new
|
|
2151
|
+
return new Type_1(/* TMap */ 9, [Type_1.TString, resolved]);
|
|
1745
2152
|
default:
|
|
1746
2153
|
throw new TypeException(new TypeError$(concat("Unknown type suffix \'", suffix, "\'"), unknownSpan));
|
|
1747
2154
|
}
|
|
1748
2155
|
}
|
|
1749
2156
|
case 4: {
|
|
1750
2157
|
const key = typeFromRef(decls, stack, tref.fields[0]);
|
|
1751
|
-
return new
|
|
2158
|
+
return new Type_1(/* TMap */ 9, [(key.tag === 16) ? Type_1.TInt : key, typeFromRef(decls, stack, tref.fields[1])]);
|
|
1752
2159
|
}
|
|
1753
2160
|
case 5:
|
|
1754
|
-
return new
|
|
2161
|
+
return new Type_1(/* TRecord */ 8, [ofList(map_1((tupledArg_1) => [tupledArg_1[0], typeFromRef(decls, stack, tupledArg_1[1])], tref.fields[0]), {
|
|
1755
2162
|
Compare: (x_1, y_2) => (comparePrimitives(x_1, y_2) | 0),
|
|
1756
2163
|
})]);
|
|
1757
2164
|
case 6:
|
|
1758
|
-
return new
|
|
2165
|
+
return new Type_1(/* TRecord */ 8, [ofList(map_1((tupledArg_2) => [tupledArg_2[0], typeFromRef(decls, stack, tupledArg_2[1])], tref.fields[0]), {
|
|
1759
2166
|
Compare: (x_2, y_3) => (comparePrimitives(x_2, y_3) | 0),
|
|
1760
2167
|
})]);
|
|
1761
2168
|
default: {
|
|
@@ -1765,24 +2172,24 @@ function typeFromRef(decls, stack, tref) {
|
|
|
1765
2172
|
const resolvedName = resolveReferencedTypeName(FSharpMap__get_Keys(decls), name, unknownSpan);
|
|
1766
2173
|
const matchValue_1 = FSharpMap__TryFind(decls, resolvedName);
|
|
1767
2174
|
if (matchValue_1 == null) {
|
|
1768
|
-
return new
|
|
2175
|
+
return new Type_1(/* TNamed */ 12, [resolvedName]);
|
|
1769
2176
|
}
|
|
1770
2177
|
else {
|
|
1771
2178
|
const def = matchValue_1;
|
|
1772
2179
|
const matchValue_2 = tryFindIndex((y) => (resolvedName === y), stack);
|
|
1773
2180
|
if (matchValue_2 == null) {
|
|
1774
2181
|
if (!isEmpty_1(def.Cases)) {
|
|
1775
|
-
return new
|
|
2182
|
+
return new Type_1(/* TNamed */ 12, [resolvedName]);
|
|
1776
2183
|
}
|
|
1777
2184
|
else {
|
|
1778
|
-
return new
|
|
2185
|
+
return new Type_1(/* TRecord */ 8, [ofList(map_1((tupledArg) => [tupledArg[0], typeFromRef(decls, cons(resolvedName, stack), tupledArg[1])], def.Fields), {
|
|
1779
2186
|
Compare: (x, y_1) => (comparePrimitives(x, y_1) | 0),
|
|
1780
2187
|
})]);
|
|
1781
2188
|
}
|
|
1782
2189
|
}
|
|
1783
2190
|
else if (matchValue_2 === 0) {
|
|
1784
2191
|
if (def.IsRecursive) {
|
|
1785
|
-
return new
|
|
2192
|
+
return new Type_1(/* TNamed */ 12, [resolvedName]);
|
|
1786
2193
|
}
|
|
1787
2194
|
else {
|
|
1788
2195
|
throw new TypeException(new TypeError$(concat("Recursive type \'", resolvedName, "\' requires \'type rec\'"), unknownSpan));
|
|
@@ -1903,7 +2310,7 @@ function constrainMapKeyTypes(typeDefs, span, t) {
|
|
|
1903
2310
|
case 0: {
|
|
1904
2311
|
const keyType = matchValue.fields[0];
|
|
1905
2312
|
if (keyType.tag === 16) {
|
|
1906
|
-
subst = compose(unify(typeDefs, keyType,
|
|
2313
|
+
subst = compose(unify(typeDefs, keyType, Type_1.TInt, span), subst);
|
|
1907
2314
|
}
|
|
1908
2315
|
else {
|
|
1909
2316
|
ensureSupportedMapKeyType(typeDefs, span, keyType);
|
|
@@ -1922,7 +2329,7 @@ function constrainMapKeyTypes(typeDefs, span, t) {
|
|
|
1922
2329
|
break;
|
|
1923
2330
|
}
|
|
1924
2331
|
case 3: {
|
|
1925
|
-
iterate_1(loop,
|
|
2332
|
+
iterate_1(loop, values_4(fields));
|
|
1926
2333
|
break;
|
|
1927
2334
|
}
|
|
1928
2335
|
case 4: {
|
|
@@ -1955,7 +2362,7 @@ function inferPattern(telemetry, typeDefs, constructors, pat) {
|
|
|
1955
2362
|
}
|
|
1956
2363
|
case 2: {
|
|
1957
2364
|
const lit = pat.fields[0];
|
|
1958
|
-
const t = (lit.tag === 1) ?
|
|
2365
|
+
const t = (lit.tag === 1) ? Type_1.TFloat : ((lit.tag === 2) ? Type_1.TBool : ((lit.tag === 3) ? Type_1.TString : Type_1.TInt));
|
|
1959
2366
|
return [empty({
|
|
1960
2367
|
Compare: (x_2, y_2) => (comparePrimitives(x_2, y_2) | 0),
|
|
1961
2368
|
}), t];
|
|
@@ -1964,7 +2371,7 @@ function inferPattern(telemetry, typeDefs, constructors, pat) {
|
|
|
1964
2371
|
const tv_1 = Types_freshVar();
|
|
1965
2372
|
return [empty({
|
|
1966
2373
|
Compare: (x_3, y_3) => (comparePrimitives(x_3, y_3) | 0),
|
|
1967
|
-
}), new
|
|
2374
|
+
}), new Type_1(/* TList */ 5, [tv_1])];
|
|
1968
2375
|
}
|
|
1969
2376
|
case 4: {
|
|
1970
2377
|
const startIndex = currentTelemetryCaptureCount(telemetry) | 0;
|
|
@@ -1973,9 +2380,9 @@ function inferPattern(telemetry, typeDefs, constructors, pat) {
|
|
|
1973
2380
|
const patternInput_1 = inferPattern(telemetry, typeDefs, constructors, pat.fields[1]);
|
|
1974
2381
|
const s = unify(empty({
|
|
1975
2382
|
Compare: (x_4, y_4) => (comparePrimitives(x_4, y_4) | 0),
|
|
1976
|
-
}), patternInput_1[1], new
|
|
2383
|
+
}), patternInput_1[1], new Type_1(/* TList */ 5, [t1]), pat.fields[2]);
|
|
1977
2384
|
applySubstToCapturedLocals(telemetry, startIndex, s);
|
|
1978
|
-
return [map((_arg, ty) => applyType(s, ty), fold_1((acc, k, v) => add(k, v, acc), patternInput[0], patternInput_1[0])), applyType(s, new
|
|
2385
|
+
return [map((_arg, ty) => applyType(s, ty), fold_1((acc, k, v) => add(k, v, acc), patternInput[0], patternInput_1[0])), applyType(s, new Type_1(/* TList */ 5, [t1]))];
|
|
1979
2386
|
}
|
|
1980
2387
|
case 5: {
|
|
1981
2388
|
const patternInput_3 = fold((tupledArg, p) => {
|
|
@@ -1984,7 +2391,7 @@ function inferPattern(telemetry, typeDefs, constructors, pat) {
|
|
|
1984
2391
|
}, [empty({
|
|
1985
2392
|
Compare: (x_5, y_5) => (comparePrimitives(x_5, y_5) | 0),
|
|
1986
2393
|
}), empty_2()], pat.fields[0]);
|
|
1987
|
-
return [patternInput_3[0], new
|
|
2394
|
+
return [patternInput_3[0], new Type_1(/* TTuple */ 7, [reverse(patternInput_3[1])])];
|
|
1988
2395
|
}
|
|
1989
2396
|
case 6: {
|
|
1990
2397
|
const patternInput_5 = fold((tupledArg_1, tupledArg_2) => {
|
|
@@ -1995,7 +2402,7 @@ function inferPattern(telemetry, typeDefs, constructors, pat) {
|
|
|
1995
2402
|
}), empty({
|
|
1996
2403
|
Compare: (x_7, y_7) => (comparePrimitives(x_7, y_7) | 0),
|
|
1997
2404
|
})], pat.fields[0]);
|
|
1998
|
-
return [patternInput_5[0], (matchValue = Types_freshVar(), (matchValue.tag === 15) ? (new
|
|
2405
|
+
return [patternInput_5[0], (matchValue = Types_freshVar(), (matchValue.tag === 15) ? (new Type_1(/* TRecordShape */ 18, [matchValue.fields[0], patternInput_5[1], false])) : (() => {
|
|
1999
2406
|
throw new Exception("Expected type variable");
|
|
2000
2407
|
})())];
|
|
2001
2408
|
}
|
|
@@ -2034,24 +2441,24 @@ function inferPattern(telemetry, typeDefs, constructors, pat) {
|
|
|
2034
2441
|
}
|
|
2035
2442
|
else {
|
|
2036
2443
|
const patternInput_8 = inferPattern(telemetry, typeDefs, constructors, tailPattern);
|
|
2037
|
-
const expectedTailType = new
|
|
2444
|
+
const expectedTailType = new Type_1(/* TMap */ 9, [applyType(sAcc, mapKeyType), applyType(sAcc, valueType)]);
|
|
2038
2445
|
const sTail = unify(typeDefs, applyType(sAcc, patternInput_8[1]), expectedTailType, span_1);
|
|
2039
2446
|
sAcc = compose(sTail, sAcc);
|
|
2040
2447
|
envAcc_2 = ((table_5 = map((_arg_2, t_3) => applyType(sAcc, t_3), patternInput_8[0]), fold_1((acc_5, k_5, v_5) => add(k_5, v_5, acc_5), envAcc_2, table_5)));
|
|
2041
2448
|
}
|
|
2042
2449
|
ensureSupportedMapKeyType_1(applyType(sAcc, mapKeyType));
|
|
2043
2450
|
applySubstToCapturedLocals(telemetry, startIndex_1, sAcc);
|
|
2044
|
-
return [map((_arg_3, t_4) => applyType(sAcc, t_4), envAcc_2), new
|
|
2451
|
+
return [map((_arg_3, t_4) => applyType(sAcc, t_4), envAcc_2), new Type_1(/* TMap */ 9, [applyType(sAcc, mapKeyType), applyType(sAcc, valueType)])];
|
|
2045
2452
|
}
|
|
2046
2453
|
case 8: {
|
|
2047
2454
|
const patternInput_9 = inferPattern(telemetry, typeDefs, constructors, pat.fields[0]);
|
|
2048
|
-
return [patternInput_9[0], new
|
|
2455
|
+
return [patternInput_9[0], new Type_1(/* TOption */ 10, [patternInput_9[1]])];
|
|
2049
2456
|
}
|
|
2050
2457
|
case 9: {
|
|
2051
2458
|
const tv_2 = Types_freshVar();
|
|
2052
2459
|
return [empty({
|
|
2053
2460
|
Compare: (x_9, y_9) => (comparePrimitives(x_9, y_9) | 0),
|
|
2054
|
-
}), new
|
|
2461
|
+
}), new Type_1(/* TOption */ 10, [tv_2])];
|
|
2055
2462
|
}
|
|
2056
2463
|
case 10: {
|
|
2057
2464
|
const span_2 = pat.fields[3];
|
|
@@ -2062,7 +2469,7 @@ function inferPattern(telemetry, typeDefs, constructors, pat) {
|
|
|
2062
2469
|
const matchValue_1 = FSharpMap__TryFind(constructors, constructorName);
|
|
2063
2470
|
if (matchValue_1 != null) {
|
|
2064
2471
|
const sigInfo = matchValue_1;
|
|
2065
|
-
const unionType = new
|
|
2472
|
+
const unionType = new Type_1(/* TNamed */ 12, [sigInfo.UnionName]);
|
|
2066
2473
|
const matchValue_2 = sigInfo.Payload;
|
|
2067
2474
|
if (matchValue_2 != null) {
|
|
2068
2475
|
if (payload == null) {
|
|
@@ -2188,7 +2595,7 @@ function validateMapKeyTypes(typeDefs, span, t) {
|
|
|
2188
2595
|
break;
|
|
2189
2596
|
}
|
|
2190
2597
|
case 4: {
|
|
2191
|
-
iterate_1(loop,
|
|
2598
|
+
iterate_1(loop, values_4(fields));
|
|
2192
2599
|
break;
|
|
2193
2600
|
}
|
|
2194
2601
|
case 5: {
|
|
@@ -2213,12 +2620,21 @@ function validateMapKeyTypes(typeDefs, span, t) {
|
|
|
2213
2620
|
}
|
|
2214
2621
|
|
|
2215
2622
|
function inferExpr(telemetry, typeDefs, constructors, env, expr) {
|
|
2623
|
+
let expressionStart;
|
|
2624
|
+
if (telemetry == null) {
|
|
2625
|
+
expressionStart = 0;
|
|
2626
|
+
}
|
|
2627
|
+
else {
|
|
2628
|
+
const t = telemetry;
|
|
2629
|
+
expressionStart = t.ExpressionTypes.length;
|
|
2630
|
+
}
|
|
2216
2631
|
const patternInput = inferExprRaw(telemetry, typeDefs, constructors, env, expr);
|
|
2217
2632
|
const subst = patternInput[0];
|
|
2218
2633
|
const inferred = patternInput[1];
|
|
2219
2634
|
const combined = compose(constrainMapKeyTypes(typeDefs, Ast_spanOfExpr(expr), applyType(subst, inferred)), subst);
|
|
2220
2635
|
const resolved = applyType(combined, inferred);
|
|
2221
|
-
|
|
2636
|
+
applySubstToCapturedExpressions(telemetry, expressionStart, combined);
|
|
2637
|
+
return [combined, resolved, new TypedExpr(expr, resolved, Ast_spanOfExpr(expr))];
|
|
2222
2638
|
}
|
|
2223
2639
|
|
|
2224
2640
|
function inferExprRaw(telemetry, typeDefs, constructors, env, expr) {
|
|
@@ -2226,8 +2642,8 @@ function inferExprRaw(telemetry, typeDefs, constructors, env, expr) {
|
|
|
2226
2642
|
switch (expr.tag) {
|
|
2227
2643
|
case 1: {
|
|
2228
2644
|
const lit = expr.fields[0];
|
|
2229
|
-
const t = (lit.tag === 1) ?
|
|
2230
|
-
return [emptySubst, t, asTyped(expr, t)];
|
|
2645
|
+
const t = (lit.tag === 1) ? Type_1.TFloat : ((lit.tag === 2) ? Type_1.TBool : ((lit.tag === 3) ? Type_1.TString : Type_1.TInt));
|
|
2646
|
+
return [emptySubst, t, asTyped(telemetry, expr, t)];
|
|
2231
2647
|
}
|
|
2232
2648
|
case 2: {
|
|
2233
2649
|
const span = expr.fields[1];
|
|
@@ -2239,18 +2655,18 @@ function inferExprRaw(telemetry, typeDefs, constructors, env, expr) {
|
|
|
2239
2655
|
else {
|
|
2240
2656
|
const t_1 = instantiate(matchValue);
|
|
2241
2657
|
recordLocalVariableUse(telemetry, name, span, t_1);
|
|
2242
|
-
return [emptySubst, t_1, asTyped(expr, t_1)];
|
|
2658
|
+
return [emptySubst, t_1, asTyped(telemetry, expr, t_1)];
|
|
2243
2659
|
}
|
|
2244
2660
|
}
|
|
2245
2661
|
case 3: {
|
|
2246
2662
|
const patternInput = inferExpr(telemetry, typeDefs, constructors, env, expr.fields[0]);
|
|
2247
2663
|
const t_2 = patternInput[1];
|
|
2248
|
-
return [patternInput[0], t_2, asTyped(expr, t_2)];
|
|
2664
|
+
return [patternInput[0], t_2, asTyped(telemetry, expr, t_2)];
|
|
2249
2665
|
}
|
|
2250
2666
|
case 28: {
|
|
2251
2667
|
const name_1 = expr.fields[0];
|
|
2252
2668
|
if (FSharpMap__ContainsKey(typeDefs, name_1)) {
|
|
2253
|
-
return [emptySubst,
|
|
2669
|
+
return [emptySubst, Type_1.TTypeToken, asTyped(telemetry, expr, Type_1.TTypeToken)];
|
|
2254
2670
|
}
|
|
2255
2671
|
else {
|
|
2256
2672
|
throw new TypeException(new TypeError$(toText(printf("Unknown type \'%s\'"))(name_1), expr.fields[1]));
|
|
@@ -2259,7 +2675,7 @@ function inferExprRaw(telemetry, typeDefs, constructors, env, expr) {
|
|
|
2259
2675
|
case 29: {
|
|
2260
2676
|
const name_2 = expr.fields[0];
|
|
2261
2677
|
if (FSharpMap__ContainsKey(env, name_2)) {
|
|
2262
|
-
return [emptySubst,
|
|
2678
|
+
return [emptySubst, Type_1.TString, asTyped(telemetry, expr, Type_1.TString)];
|
|
2263
2679
|
}
|
|
2264
2680
|
else {
|
|
2265
2681
|
throw new TypeException(new TypeError$(toText(printf("Unbound variable \'%s\'"))(name_2), expr.fields[1]));
|
|
@@ -2280,7 +2696,7 @@ function inferExprRaw(telemetry, typeDefs, constructors, env, expr) {
|
|
|
2280
2696
|
finally {
|
|
2281
2697
|
disposeSafe(enumerator);
|
|
2282
2698
|
}
|
|
2283
|
-
return [sAcc,
|
|
2699
|
+
return [sAcc, Type_1.TString, asTyped(telemetry, expr, Type_1.TString)];
|
|
2284
2700
|
}
|
|
2285
2701
|
case 4: {
|
|
2286
2702
|
const param = expr.fields[0];
|
|
@@ -2291,8 +2707,8 @@ function inferExprRaw(telemetry, typeDefs, constructors, env, expr) {
|
|
|
2291
2707
|
const env$0027 = add(param.Name, new Scheme(empty_2(), tv), env);
|
|
2292
2708
|
const patternInput_2 = withLocalBindings(telemetry, singleton(param.Name), () => inferExpr(telemetry, typeDefs, constructors, env$0027, expr.fields[1]));
|
|
2293
2709
|
const s1_1 = patternInput_2[0];
|
|
2294
|
-
const tFun = new
|
|
2295
|
-
return [s1_1, tFun, asTyped(expr, tFun)];
|
|
2710
|
+
const tFun = new Type_1(/* TFun */ 11, [applyType(s1_1, tv), patternInput_2[1]]);
|
|
2711
|
+
return [s1_1, tFun, asTyped(telemetry, expr, tFun)];
|
|
2296
2712
|
}
|
|
2297
2713
|
case 5: {
|
|
2298
2714
|
const span_4 = expr.fields[2];
|
|
@@ -2302,16 +2718,16 @@ function inferExprRaw(telemetry, typeDefs, constructors, env, expr) {
|
|
|
2302
2718
|
const t2 = patternInput_4[1];
|
|
2303
2719
|
const s2 = patternInput_4[0];
|
|
2304
2720
|
const tv_1 = Types_freshVar();
|
|
2305
|
-
const combined = compose(unify(typeDefs, applyType(s2, patternInput_3[1]), new
|
|
2306
|
-
const s_1 = compose(constrainMapKeyTypes(typeDefs, span_4, applyType(combined, new
|
|
2721
|
+
const combined = compose(unify(typeDefs, applyType(s2, patternInput_3[1]), new Type_1(/* TFun */ 11, [t2, tv_1]), span_4), compose(s2, s1_2));
|
|
2722
|
+
const s_1 = compose(constrainMapKeyTypes(typeDefs, span_4, applyType(combined, new Type_1(/* TFun */ 11, [t2, tv_1]))), combined);
|
|
2307
2723
|
const tRes = applyType(s_1, tv_1);
|
|
2308
|
-
return [s_1, tRes, asTyped(expr, tRes)];
|
|
2724
|
+
return [s_1, tRes, asTyped(telemetry, expr, tRes)];
|
|
2309
2725
|
}
|
|
2310
2726
|
case 6: {
|
|
2311
2727
|
const span_5 = expr.fields[3];
|
|
2312
2728
|
const patternInput_5 = inferExpr(telemetry, typeDefs, constructors, env, expr.fields[0]);
|
|
2313
2729
|
const s1_3 = patternInput_5[0];
|
|
2314
|
-
const sBool = unify(typeDefs, patternInput_5[1],
|
|
2730
|
+
const sBool = unify(typeDefs, patternInput_5[1], Type_1.TBool, span_5);
|
|
2315
2731
|
const patternInput_6 = inferExpr(telemetry, typeDefs, constructors, applyEnv(compose(sBool, s1_3), env), expr.fields[1]);
|
|
2316
2732
|
const s2_1 = patternInput_6[0];
|
|
2317
2733
|
const patternInput_7 = inferExpr(telemetry, typeDefs, constructors, applyEnv(compose(s2_1, compose(sBool, s1_3)), env), expr.fields[2]);
|
|
@@ -2319,14 +2735,14 @@ function inferExprRaw(telemetry, typeDefs, constructors, env, expr) {
|
|
|
2319
2735
|
const s3_1 = patternInput_7[0];
|
|
2320
2736
|
const s_2 = compose(unify(typeDefs, applyType(s3_1, patternInput_6[1]), tElse, span_5), compose(s3_1, compose(s2_1, compose(sBool, s1_3))));
|
|
2321
2737
|
const tRes_1 = applyType(s_2, tElse);
|
|
2322
|
-
return [s_2, tRes_1, asTyped(expr, tRes_1)];
|
|
2738
|
+
return [s_2, tRes_1, asTyped(telemetry, expr, tRes_1)];
|
|
2323
2739
|
}
|
|
2324
2740
|
case 7: {
|
|
2325
2741
|
const patternInput_8 = inferExpr(telemetry, typeDefs, constructors, env, expr.fields[0]);
|
|
2326
2742
|
const s1_4 = patternInput_8[0];
|
|
2327
|
-
const s_3 = compose(unify(typeDefs, applyType(s1_4, patternInput_8[1]),
|
|
2743
|
+
const s_3 = compose(unify(typeDefs, applyType(s1_4, patternInput_8[1]), Type_1.TString, expr.fields[1]), s1_4);
|
|
2328
2744
|
const tRes_2 = Types_freshVar();
|
|
2329
|
-
return [s_3, tRes_2, asTyped(expr, tRes_2)];
|
|
2745
|
+
return [s_3, tRes_2, asTyped(telemetry, expr, tRes_2)];
|
|
2330
2746
|
}
|
|
2331
2747
|
case 8: {
|
|
2332
2748
|
const name_3 = expr.fields[0];
|
|
@@ -2334,11 +2750,11 @@ function inferExprRaw(telemetry, typeDefs, constructors, env, expr) {
|
|
|
2334
2750
|
const patternInput_9 = inferExpr(telemetry, typeDefs, constructors, env, expr.fields[1]);
|
|
2335
2751
|
const s1_5 = patternInput_9[0];
|
|
2336
2752
|
const tv_2 = Types_freshVar();
|
|
2337
|
-
const sSource = compose(unify(typeDefs, applyType(s1_5, patternInput_9[1]), new
|
|
2753
|
+
const sSource = compose(unify(typeDefs, applyType(s1_5, patternInput_9[1]), new Type_1(/* TList */ 5, [tv_2]), expr.fields[3]), s1_5);
|
|
2338
2754
|
const envBody = add(name_3, new Scheme(empty_2(), applyType(sSource, tv_2)), applyEnv(sSource, env));
|
|
2339
2755
|
const patternInput_10 = withLocalBindings(telemetry, singleton(name_3), () => inferExpr(telemetry, typeDefs, constructors, envBody, body_1));
|
|
2340
2756
|
const s2_3 = patternInput_10[0];
|
|
2341
|
-
return [compose(unify(typeDefs, applyType(s2_3, patternInput_10[1]),
|
|
2757
|
+
return [compose(unify(typeDefs, applyType(s2_3, patternInput_10[1]), Type_1.TUnit, Ast_spanOfExpr(body_1)), compose(s2_3, sSource)), Type_1.TUnit, asTyped(telemetry, expr, Type_1.TUnit)];
|
|
2342
2758
|
}
|
|
2343
2759
|
case 10: {
|
|
2344
2760
|
const value_3 = expr.fields[1];
|
|
@@ -2358,19 +2774,19 @@ function inferExprRaw(telemetry, typeDefs, constructors, env, expr) {
|
|
|
2358
2774
|
const env2_2 = add(name_4, Types_generalize(env1, applyType(sValue, t1_2)), env1);
|
|
2359
2775
|
const patternInput_12 = withLocalBindings(telemetry, singleton(name_4), () => inferExpr(telemetry, typeDefs, constructors, env2_2, body_2));
|
|
2360
2776
|
const tBody_2 = patternInput_12[1];
|
|
2361
|
-
return [compose(patternInput_12[0], sValue), tBody_2, asTyped(expr, tBody_2)];
|
|
2777
|
+
return [compose(patternInput_12[0], sValue), tBody_2, asTyped(telemetry, expr, tBody_2)];
|
|
2362
2778
|
}
|
|
2363
2779
|
else {
|
|
2364
2780
|
const patternInput_13 = inferExpr(telemetry, typeDefs, constructors, env, value_3);
|
|
2365
2781
|
const t1_3 = patternInput_13[1];
|
|
2366
2782
|
const s1_7 = patternInput_13[0];
|
|
2367
|
-
const sDiscard = (name_4 === "_") ? unify(typeDefs, applyType(s1_7, t1_3),
|
|
2783
|
+
const sDiscard = (name_4 === "_") ? unify(typeDefs, applyType(s1_7, t1_3), Type_1.TUnit, Ast_spanOfExpr(value_3)) : emptySubst;
|
|
2368
2784
|
const sValue_1 = compose((returnAnnotation == null) ? emptySubst : ((expectedReturn_1 = annotationTypeFromRef(typeDefs, span_8, returnAnnotation), unify(typeDefs, functionReturnType(applyType(sDiscard, t1_3)), expectedReturn_1, span_8))), compose(sDiscard, s1_7));
|
|
2369
2785
|
const env1_1 = applyEnv(sValue_1, env);
|
|
2370
2786
|
const env2_3 = add(name_4, Types_generalize(env1_1, applyType(sValue_1, t1_3)), env1_1);
|
|
2371
2787
|
const patternInput_14 = withLocalBindings(telemetry, singleton(name_4), () => inferExpr(telemetry, typeDefs, constructors, env2_3, body_2));
|
|
2372
2788
|
const t2_1 = patternInput_14[1];
|
|
2373
|
-
return [compose(patternInput_14[0], sValue_1), t2_1, asTyped(expr, t2_1)];
|
|
2789
|
+
return [compose(patternInput_14[0], sValue_1), t2_1, asTyped(telemetry, expr, t2_1)];
|
|
2374
2790
|
}
|
|
2375
2791
|
}
|
|
2376
2792
|
case 11: {
|
|
@@ -2385,7 +2801,7 @@ function inferExprRaw(telemetry, typeDefs, constructors, env, expr) {
|
|
|
2385
2801
|
const env2_4 = fold_1((state, name_5, bindingType) => add(name_5, Types_generalize(env1_2, bindingType), state), env1_2, envPatTyped);
|
|
2386
2802
|
const patternInput_17 = withLocalBindings(telemetry, map_1((tuple) => tuple[0], toList(envPatTyped)), () => inferExpr(telemetry, typeDefs, constructors, env2_4, expr.fields[2]));
|
|
2387
2803
|
const tBody_3 = patternInput_17[1];
|
|
2388
|
-
return [compose(patternInput_17[0], sValue_2), tBody_3, asTyped(expr, tBody_3)];
|
|
2804
|
+
return [compose(patternInput_17[0], sValue_2), tBody_3, asTyped(telemetry, expr, tBody_3)];
|
|
2389
2805
|
}
|
|
2390
2806
|
case 12: {
|
|
2391
2807
|
const foldedBindings = map_1((tupledArg) => {
|
|
@@ -2442,7 +2858,7 @@ function inferExprRaw(telemetry, typeDefs, constructors, env, expr) {
|
|
|
2442
2858
|
}, foldedBindings));
|
|
2443
2859
|
const patternInput_19 = withLocalBindings(telemetry, recursiveNames, () => inferExpr(telemetry, typeDefs, constructors, envBody_1, expr.fields[1]));
|
|
2444
2860
|
const tBody_4 = patternInput_19[1];
|
|
2445
|
-
return [compose(patternInput_19[0], sRec), tBody_4, asTyped(expr, tBody_4)];
|
|
2861
|
+
return [compose(patternInput_19[0], sRec), tBody_4, asTyped(telemetry, expr, tBody_4)];
|
|
2446
2862
|
}
|
|
2447
2863
|
case 9: {
|
|
2448
2864
|
const patternInput_20 = inferExpr(telemetry, typeDefs, constructors, env, expr.fields[0]);
|
|
@@ -2467,7 +2883,7 @@ function inferExprRaw(telemetry, typeDefs, constructors, env, expr) {
|
|
|
2467
2883
|
const guardExpr = guard;
|
|
2468
2884
|
const patternInput_22 = inferExpr(telemetry, typeDefs, constructors, envBodyCase, guardExpr);
|
|
2469
2885
|
const sGuard = patternInput_22[0];
|
|
2470
|
-
const sGuardBool = unify(typeDefs, applyType(sGuard, patternInput_22[1]),
|
|
2886
|
+
const sGuardBool = unify(typeDefs, applyType(sGuard, patternInput_22[1]), Type_1.TBool, caseSpan);
|
|
2471
2887
|
sAcc_1 = compose(sGuardBool, compose(sGuard, sAcc_1));
|
|
2472
2888
|
envBodyCase = applyEnv(compose(sGuardBool, sGuard), envBodyCase);
|
|
2473
2889
|
}
|
|
@@ -2483,7 +2899,7 @@ function inferExprRaw(telemetry, typeDefs, constructors, env, expr) {
|
|
|
2483
2899
|
disposeSafe(enumerator_3);
|
|
2484
2900
|
}
|
|
2485
2901
|
const tRes_3 = defaultArg(resultTypeOpt, Types_freshVar());
|
|
2486
|
-
return [sAcc_1, tRes_3, asTyped(expr, tRes_3)];
|
|
2902
|
+
return [sAcc_1, tRes_3, asTyped(telemetry, expr, tRes_3)];
|
|
2487
2903
|
}
|
|
2488
2904
|
case 13: {
|
|
2489
2905
|
const tv_5 = Types_freshVar();
|
|
@@ -2501,8 +2917,8 @@ function inferExprRaw(telemetry, typeDefs, constructors, env, expr) {
|
|
|
2501
2917
|
finally {
|
|
2502
2918
|
disposeSafe(enumerator_4);
|
|
2503
2919
|
}
|
|
2504
|
-
const tRes_4 = new
|
|
2505
|
-
return [sAcc_2, tRes_4, asTyped(expr, tRes_4)];
|
|
2920
|
+
const tRes_4 = new Type_1(/* TList */ 5, [applyType(sAcc_2, tv_5)]);
|
|
2921
|
+
return [sAcc_2, tRes_4, asTyped(telemetry, expr, tRes_4)];
|
|
2506
2922
|
}
|
|
2507
2923
|
case 14: {
|
|
2508
2924
|
const span_13 = expr.fields[2];
|
|
@@ -2510,9 +2926,9 @@ function inferExprRaw(telemetry, typeDefs, constructors, env, expr) {
|
|
|
2510
2926
|
const s1_12 = patternInput_25[0];
|
|
2511
2927
|
const patternInput_26 = inferExpr(telemetry, typeDefs, constructors, applyEnv(s1_12, env), expr.fields[1]);
|
|
2512
2928
|
const s2_9 = patternInput_26[0];
|
|
2513
|
-
const s3_3 = unify(typeDefs, applyType(s2_9, patternInput_25[1]),
|
|
2514
|
-
const tRes_5 = new
|
|
2515
|
-
return [compose(unify(typeDefs, applyType(s3_3, applyType(s2_9, patternInput_26[1])),
|
|
2929
|
+
const s3_3 = unify(typeDefs, applyType(s2_9, patternInput_25[1]), Type_1.TInt, span_13);
|
|
2930
|
+
const tRes_5 = new Type_1(/* TList */ 5, [Type_1.TInt]);
|
|
2931
|
+
return [compose(unify(typeDefs, applyType(s3_3, applyType(s2_9, patternInput_26[1])), Type_1.TInt, span_13), compose(s3_3, compose(s2_9, s1_12))), tRes_5, asTyped(telemetry, expr, tRes_5)];
|
|
2516
2932
|
}
|
|
2517
2933
|
case 15: {
|
|
2518
2934
|
let sAcc_3 = emptySubst;
|
|
@@ -2529,8 +2945,8 @@ function inferExprRaw(telemetry, typeDefs, constructors, env, expr) {
|
|
|
2529
2945
|
finally {
|
|
2530
2946
|
disposeSafe(enumerator_5);
|
|
2531
2947
|
}
|
|
2532
|
-
const tRes_6 = new
|
|
2533
|
-
return [sAcc_3, tRes_6, asTyped(expr, tRes_6)];
|
|
2948
|
+
const tRes_6 = new Type_1(/* TTuple */ 7, [inferred_1]);
|
|
2949
|
+
return [sAcc_3, tRes_6, asTyped(telemetry, expr, tRes_6)];
|
|
2534
2950
|
}
|
|
2535
2951
|
case 16: {
|
|
2536
2952
|
const span_14 = expr.fields[1];
|
|
@@ -2550,12 +2966,12 @@ function inferExprRaw(telemetry, typeDefs, constructors, env, expr) {
|
|
|
2550
2966
|
finally {
|
|
2551
2967
|
disposeSafe(enumerator_6);
|
|
2552
2968
|
}
|
|
2553
|
-
const expected_1 = new
|
|
2969
|
+
const expected_1 = new Type_1(/* TNamed */ 12, [resolveNamedRecordByFieldSet(typeDefs, ofSeq(keys(inferred_2), {
|
|
2554
2970
|
Compare: (x_2, y_2) => (comparePrimitives(x_2, y_2) | 0),
|
|
2555
2971
|
}), span_14)]);
|
|
2556
|
-
const s_10 = compose(unify(typeDefs, applyType(sAcc_4, new
|
|
2972
|
+
const s_10 = compose(unify(typeDefs, applyType(sAcc_4, new Type_1(/* TRecord */ 8, [inferred_2])), expected_1, span_14), sAcc_4);
|
|
2557
2973
|
const tRes_7 = applyType(s_10, expected_1);
|
|
2558
|
-
return [s_10, tRes_7, asTyped(expr, tRes_7)];
|
|
2974
|
+
return [s_10, tRes_7, asTyped(telemetry, expr, tRes_7)];
|
|
2559
2975
|
}
|
|
2560
2976
|
case 17: {
|
|
2561
2977
|
let sAcc_5 = emptySubst;
|
|
@@ -2574,8 +2990,8 @@ function inferExprRaw(telemetry, typeDefs, constructors, env, expr) {
|
|
|
2574
2990
|
finally {
|
|
2575
2991
|
disposeSafe(enumerator_7);
|
|
2576
2992
|
}
|
|
2577
|
-
const tRes_8 = new
|
|
2578
|
-
return [sAcc_5, tRes_8, asTyped(expr, tRes_8)];
|
|
2993
|
+
const tRes_8 = new Type_1(/* TRecord */ 8, [inferred_3]);
|
|
2994
|
+
return [sAcc_5, tRes_8, asTyped(telemetry, expr, tRes_8)];
|
|
2579
2995
|
}
|
|
2580
2996
|
case 18: {
|
|
2581
2997
|
const ensureSupportedMapKeyType_1 = (t_3) => {
|
|
@@ -2592,7 +3008,7 @@ function inferExprRaw(telemetry, typeDefs, constructors, env, expr) {
|
|
|
2592
3008
|
const spreadExpr = entry.fields[0];
|
|
2593
3009
|
const patternInput_32 = inferExpr(telemetry, typeDefs, constructors, applyEnv(sAcc_6, env), spreadExpr);
|
|
2594
3010
|
const sSpread = patternInput_32[0];
|
|
2595
|
-
const expectedSpreadType = new
|
|
3011
|
+
const expectedSpreadType = new Type_1(/* TMap */ 9, [applyType(sSpread, applyType(sAcc_6, keyType)), applyType(sSpread, applyType(sAcc_6, valueType))]);
|
|
2596
3012
|
const sSpreadMap = unify(typeDefs, applyType(sSpread, patternInput_32[1]), expectedSpreadType, Ast_spanOfExpr(spreadExpr));
|
|
2597
3013
|
sAcc_6 = compose(sSpreadMap, compose(sSpread, sAcc_6));
|
|
2598
3014
|
}
|
|
@@ -2614,8 +3030,8 @@ function inferExprRaw(telemetry, typeDefs, constructors, env, expr) {
|
|
|
2614
3030
|
disposeSafe(enumerator_8);
|
|
2615
3031
|
}
|
|
2616
3032
|
ensureSupportedMapKeyType_1(applyType(sAcc_6, keyType));
|
|
2617
|
-
const tRes_9 = new
|
|
2618
|
-
return [sAcc_6, tRes_9, asTyped(expr, tRes_9)];
|
|
3033
|
+
const tRes_9 = new Type_1(/* TMap */ 9, [applyType(sAcc_6, keyType), applyType(sAcc_6, valueType)]);
|
|
3034
|
+
return [sAcc_6, tRes_9, asTyped(telemetry, expr, tRes_9)];
|
|
2619
3035
|
}
|
|
2620
3036
|
case 19: {
|
|
2621
3037
|
const span_16 = expr.fields[2];
|
|
@@ -2626,7 +3042,7 @@ function inferExprRaw(telemetry, typeDefs, constructors, env, expr) {
|
|
|
2626
3042
|
const matchValue_2 = applyType(sInitial, tBase);
|
|
2627
3043
|
if (matchValue_2.tag === 18) {
|
|
2628
3044
|
const id = matchValue_2.fields[0] | 0;
|
|
2629
|
-
sBase = compose(ofList(singleton([id, new
|
|
3045
|
+
sBase = compose(ofList(singleton([id, new Type_1(/* TRecordShape */ 18, [id, matchValue_2.fields[1], true])]), {
|
|
2630
3046
|
Compare: (x_4, y_4) => (comparePrimitives(x_4, y_4) | 0),
|
|
2631
3047
|
}), sInitial);
|
|
2632
3048
|
}
|
|
@@ -2722,8 +3138,8 @@ function inferExprRaw(telemetry, typeDefs, constructors, env, expr) {
|
|
|
2722
3138
|
finally {
|
|
2723
3139
|
disposeSafe(enumerator_9);
|
|
2724
3140
|
}
|
|
2725
|
-
const tRes_10 = new
|
|
2726
|
-
return [sAcc_7, tRes_10, asTyped(expr, tRes_10)];
|
|
3141
|
+
const tRes_10 = new Type_1(/* TRecord */ 8, [map((_arg_7, t_5) => applyType(sAcc_7, t_5), baseFields)]);
|
|
3142
|
+
return [sAcc_7, tRes_10, asTyped(telemetry, expr, tRes_10)];
|
|
2727
3143
|
}
|
|
2728
3144
|
case 20: {
|
|
2729
3145
|
const span_17 = expr.fields[2];
|
|
@@ -2734,7 +3150,7 @@ function inferExprRaw(telemetry, typeDefs, constructors, env, expr) {
|
|
|
2734
3150
|
const matchValue_6 = applyType(sInitial_1, tBase_1);
|
|
2735
3151
|
if (matchValue_6.tag === 18) {
|
|
2736
3152
|
const id_1 = matchValue_6.fields[0] | 0;
|
|
2737
|
-
sBase_1 = compose(ofList(singleton([id_1, new
|
|
3153
|
+
sBase_1 = compose(ofList(singleton([id_1, new Type_1(/* TRecordShape */ 18, [id_1, matchValue_6.fields[1], true])]), {
|
|
2738
3154
|
Compare: (x_5, y_5) => (comparePrimitives(x_5, y_5) | 0),
|
|
2739
3155
|
}), sInitial_1);
|
|
2740
3156
|
}
|
|
@@ -2825,8 +3241,8 @@ function inferExprRaw(telemetry, typeDefs, constructors, env, expr) {
|
|
|
2825
3241
|
finally {
|
|
2826
3242
|
disposeSafe(enumerator_10);
|
|
2827
3243
|
}
|
|
2828
|
-
const tRes_11 = new
|
|
2829
|
-
return [sAcc_8, tRes_11, asTyped(expr, tRes_11)];
|
|
3244
|
+
const tRes_11 = new Type_1(/* TRecord */ 8, [map((_arg_8, t_6) => applyType(sAcc_8, t_6), resultFields_1)]);
|
|
3245
|
+
return [sAcc_8, tRes_11, asTyped(telemetry, expr, tRes_11)];
|
|
2830
3246
|
}
|
|
2831
3247
|
case 21: {
|
|
2832
3248
|
const target = expr.fields[0];
|
|
@@ -2869,7 +3285,7 @@ function inferExprRaw(telemetry, typeDefs, constructors, env, expr) {
|
|
|
2869
3285
|
const matchValue_11 = FSharpMap__TryFind(fields_8, fieldName);
|
|
2870
3286
|
if (matchValue_11 == null) {
|
|
2871
3287
|
const tField_3 = Types_freshVar();
|
|
2872
|
-
return [compose(ofList(singleton([id_2, new
|
|
3288
|
+
return [compose(ofList(singleton([id_2, new Type_1(/* TRecordShape */ 18, [id_2, FSharpMap__Add(fields_8, fieldName, tField_3), matchValue_10.fields[2]])]), {
|
|
2873
3289
|
Compare: (x_6, y_6) => (comparePrimitives(x_6, y_6) | 0),
|
|
2874
3290
|
}), s1_16), tField_3];
|
|
2875
3291
|
}
|
|
@@ -2924,7 +3340,7 @@ function inferExprRaw(telemetry, typeDefs, constructors, env, expr) {
|
|
|
2924
3340
|
}
|
|
2925
3341
|
case 3: {
|
|
2926
3342
|
const tField_6 = Types_freshVar();
|
|
2927
|
-
const s_12 = compose(unify(typeDefs, matchValue_10, (matchValue_15 = Types_freshVar(), (matchValue_15.tag === 15) ? (new
|
|
3343
|
+
const s_12 = compose(unify(typeDefs, matchValue_10, (matchValue_15 = Types_freshVar(), (matchValue_15.tag === 15) ? (new Type_1(/* TRecordShape */ 18, [matchValue_15.fields[0], ofList(singleton([fieldName, tField_6]), {
|
|
2928
3344
|
Compare: (x_7, y_7) => (comparePrimitives(x_7, y_7) | 0),
|
|
2929
3345
|
}), false])) : (() => {
|
|
2930
3346
|
throw new Exception("Expected type variable");
|
|
@@ -2936,34 +3352,48 @@ function inferExprRaw(telemetry, typeDefs, constructors, env, expr) {
|
|
|
2936
3352
|
}
|
|
2937
3353
|
};
|
|
2938
3354
|
const qualifiedTarget = (_arg_9) => {
|
|
2939
|
-
let matchResult_6,
|
|
3355
|
+
let matchResult_6, name_22, name_23, parent;
|
|
2940
3356
|
switch (_arg_9.tag) {
|
|
2941
3357
|
case 2: {
|
|
2942
|
-
if (
|
|
2943
|
-
|
|
2944
|
-
|
|
3358
|
+
if (_arg_9.fields[0] === "Env") {
|
|
3359
|
+
if (fieldName === "setExitCode") {
|
|
3360
|
+
matchResult_6 = 0;
|
|
3361
|
+
}
|
|
3362
|
+
else if (!FSharpMap__ContainsKey(env, _arg_9.fields[0])) {
|
|
3363
|
+
matchResult_6 = 1;
|
|
3364
|
+
name_22 = _arg_9.fields[0];
|
|
3365
|
+
}
|
|
3366
|
+
else {
|
|
3367
|
+
matchResult_6 = 3;
|
|
3368
|
+
}
|
|
3369
|
+
}
|
|
3370
|
+
else if (!FSharpMap__ContainsKey(env, _arg_9.fields[0])) {
|
|
3371
|
+
matchResult_6 = 1;
|
|
3372
|
+
name_22 = _arg_9.fields[0];
|
|
2945
3373
|
}
|
|
2946
3374
|
else {
|
|
2947
|
-
matchResult_6 =
|
|
3375
|
+
matchResult_6 = 3;
|
|
2948
3376
|
}
|
|
2949
3377
|
break;
|
|
2950
3378
|
}
|
|
2951
3379
|
case 21: {
|
|
2952
|
-
matchResult_6 =
|
|
2953
|
-
|
|
3380
|
+
matchResult_6 = 2;
|
|
3381
|
+
name_23 = _arg_9.fields[1];
|
|
2954
3382
|
parent = _arg_9.fields[0];
|
|
2955
3383
|
break;
|
|
2956
3384
|
}
|
|
2957
3385
|
default:
|
|
2958
|
-
matchResult_6 =
|
|
3386
|
+
matchResult_6 = 3;
|
|
2959
3387
|
}
|
|
2960
3388
|
switch (matchResult_6) {
|
|
2961
3389
|
case 0:
|
|
2962
|
-
return
|
|
2963
|
-
case 1:
|
|
3390
|
+
return "Env";
|
|
3391
|
+
case 1:
|
|
3392
|
+
return name_22;
|
|
3393
|
+
case 2: {
|
|
2964
3394
|
const option_2 = qualifiedTarget(parent);
|
|
2965
3395
|
if (option_2 != null) {
|
|
2966
|
-
return (option_2 + ".") +
|
|
3396
|
+
return (option_2 + ".") + name_23;
|
|
2967
3397
|
}
|
|
2968
3398
|
else {
|
|
2969
3399
|
return undefined;
|
|
@@ -2980,18 +3410,18 @@ function inferExprRaw(telemetry, typeDefs, constructors, env, expr) {
|
|
|
2980
3410
|
const patternInput_37 = inferExpr(telemetry, typeDefs, constructors, env, target);
|
|
2981
3411
|
const patternInput_38 = inferRecordField(patternInput_37[0], patternInput_37[1]);
|
|
2982
3412
|
const tField_7 = patternInput_38[1];
|
|
2983
|
-
return [patternInput_38[0], tField_7, asTyped(expr, tField_7)];
|
|
3413
|
+
return [patternInput_38[0], tField_7, asTyped(telemetry, expr, tField_7)];
|
|
2984
3414
|
}
|
|
2985
3415
|
else {
|
|
2986
3416
|
const t_7 = instantiate(matchValue_17);
|
|
2987
|
-
return [emptySubst, t_7, asTyped(expr, t_7)];
|
|
3417
|
+
return [emptySubst, t_7, asTyped(telemetry, expr, t_7)];
|
|
2988
3418
|
}
|
|
2989
3419
|
}
|
|
2990
3420
|
else {
|
|
2991
3421
|
const patternInput_39 = inferExpr(telemetry, typeDefs, constructors, env, target);
|
|
2992
3422
|
const patternInput_40 = inferRecordField(patternInput_39[0], patternInput_39[1]);
|
|
2993
3423
|
const tField_8 = patternInput_40[1];
|
|
2994
|
-
return [patternInput_40[0], tField_8, asTyped(expr, tField_8)];
|
|
3424
|
+
return [patternInput_40[0], tField_8, asTyped(telemetry, expr, tField_8)];
|
|
2995
3425
|
}
|
|
2996
3426
|
}
|
|
2997
3427
|
case 22: {
|
|
@@ -3041,28 +3471,28 @@ function inferExprRaw(telemetry, typeDefs, constructors, env, expr) {
|
|
|
3041
3471
|
}
|
|
3042
3472
|
switch (matchResult_7) {
|
|
3043
3473
|
case 0: {
|
|
3044
|
-
const s_13 = compose(unify(typeDefs, keyType_1,
|
|
3045
|
-
const tRes_12 = new
|
|
3046
|
-
return [s_13, tRes_12, asTyped(expr, tRes_12)];
|
|
3474
|
+
const s_13 = compose(unify(typeDefs, keyType_1, Type_1.TInt, span_19), compose(s2_10, s1_19));
|
|
3475
|
+
const tRes_12 = new Type_1(/* TOption */ 10, [applyType(s_13, itemType_1)]);
|
|
3476
|
+
return [s_13, tRes_12, asTyped(telemetry, expr, tRes_12)];
|
|
3047
3477
|
}
|
|
3048
3478
|
case 1: {
|
|
3049
3479
|
const s_14 = compose(unify(typeDefs, keyType_1, mapKeyType, span_19), compose(s2_10, s1_19));
|
|
3050
3480
|
ensureSupportedMapKeyType(typeDefs, span_19, applyType(s_14, mapKeyType));
|
|
3051
|
-
const tRes_13 = new
|
|
3052
|
-
return [s_14, tRes_13, asTyped(expr, tRes_13)];
|
|
3481
|
+
const tRes_13 = new Type_1(/* TOption */ 10, [applyType(s_14, valueType_1)]);
|
|
3482
|
+
return [s_14, tRes_13, asTyped(telemetry, expr, tRes_13)];
|
|
3053
3483
|
}
|
|
3054
3484
|
case 2: {
|
|
3055
3485
|
const itemType_2 = Types_freshVar();
|
|
3056
|
-
const s_15 = compose(unify(typeDefs, targetType, new
|
|
3057
|
-
const tRes_14 = new
|
|
3058
|
-
return [s_15, tRes_14, asTyped(expr, tRes_14)];
|
|
3486
|
+
const s_15 = compose(unify(typeDefs, targetType, new Type_1(/* TList */ 5, [itemType_2]), span_19), compose(s2_10, s1_19));
|
|
3487
|
+
const tRes_14 = new Type_1(/* TOption */ 10, [applyType(s_15, itemType_2)]);
|
|
3488
|
+
return [s_15, tRes_14, asTyped(telemetry, expr, tRes_14)];
|
|
3059
3489
|
}
|
|
3060
3490
|
case 3: {
|
|
3061
3491
|
const valueType_2 = Types_freshVar();
|
|
3062
3492
|
ensureSupportedMapKeyType(typeDefs, span_19, keyType_1);
|
|
3063
|
-
const s_16 = compose(unify(typeDefs, targetType, new
|
|
3064
|
-
const tRes_15 = new
|
|
3065
|
-
return [s_16, tRes_15, asTyped(expr, tRes_15)];
|
|
3493
|
+
const s_16 = compose(unify(typeDefs, targetType, new Type_1(/* TMap */ 9, [keyType_1, valueType_2]), span_19), compose(s2_10, s1_19));
|
|
3494
|
+
const tRes_15 = new Type_1(/* TOption */ 10, [applyType(s_16, valueType_2)]);
|
|
3495
|
+
return [s_16, tRes_15, asTyped(telemetry, expr, tRes_15)];
|
|
3066
3496
|
}
|
|
3067
3497
|
case 4:
|
|
3068
3498
|
throw new TypeException(new TypeError$("Ambiguous index access: annotate the list or map target", span_19));
|
|
@@ -3083,10 +3513,10 @@ function inferExprRaw(telemetry, typeDefs, constructors, env, expr) {
|
|
|
3083
3513
|
const patternInput_44 = inferExpr(telemetry, typeDefs, constructors, applyEnv(s1_20, env), b);
|
|
3084
3514
|
const s2_11 = patternInput_44[0];
|
|
3085
3515
|
const tv_7 = Types_freshVar();
|
|
3086
|
-
const combined_1 = compose(unify(typeDefs, applyType(s2_11, patternInput_44[1]), new
|
|
3087
|
-
const s_17 = compose(constrainMapKeyTypes(typeDefs, span_20, applyType(combined_1, new
|
|
3516
|
+
const combined_1 = compose(unify(typeDefs, applyType(s2_11, patternInput_44[1]), new Type_1(/* TFun */ 11, [applyType(s2_11, tLeft), tv_7]), span_20), compose(s2_11, s1_20));
|
|
3517
|
+
const s_17 = compose(constrainMapKeyTypes(typeDefs, span_20, applyType(combined_1, new Type_1(/* TFun */ 11, [tLeft, tv_7]))), combined_1);
|
|
3088
3518
|
const tRes_16 = applyType(s_17, tv_7);
|
|
3089
|
-
return [s_17, tRes_16, asTyped(expr, tRes_16)];
|
|
3519
|
+
return [s_17, tRes_16, asTyped(telemetry, expr, tRes_16)];
|
|
3090
3520
|
}
|
|
3091
3521
|
case "::": {
|
|
3092
3522
|
const patternInput_45 = inferExpr(telemetry, typeDefs, constructors, env, a);
|
|
@@ -3094,9 +3524,9 @@ function inferExprRaw(telemetry, typeDefs, constructors, env, expr) {
|
|
|
3094
3524
|
const s1_21 = patternInput_45[0];
|
|
3095
3525
|
const patternInput_46 = inferExpr(telemetry, typeDefs, constructors, applyEnv(s1_21, env), b);
|
|
3096
3526
|
const s2_12 = patternInput_46[0];
|
|
3097
|
-
const s_18 = compose(unify(typeDefs, applyType(s2_12, patternInput_46[1]), new
|
|
3098
|
-
const tRes_17 = applyType(s_18, new
|
|
3099
|
-
return [s_18, tRes_17, asTyped(expr, tRes_17)];
|
|
3527
|
+
const s_18 = compose(unify(typeDefs, applyType(s2_12, patternInput_46[1]), new Type_1(/* TList */ 5, [tHead]), span_20), compose(s2_12, s1_21));
|
|
3528
|
+
const tRes_17 = applyType(s_18, new Type_1(/* TList */ 5, [tHead]));
|
|
3529
|
+
return [s_18, tRes_17, asTyped(telemetry, expr, tRes_17)];
|
|
3100
3530
|
}
|
|
3101
3531
|
case "@": {
|
|
3102
3532
|
const patternInput_47 = inferExpr(telemetry, typeDefs, constructors, env, a);
|
|
@@ -3104,10 +3534,10 @@ function inferExprRaw(telemetry, typeDefs, constructors, env, expr) {
|
|
|
3104
3534
|
const patternInput_48 = inferExpr(telemetry, typeDefs, constructors, applyEnv(s1_22, env), b);
|
|
3105
3535
|
const s2_13 = patternInput_48[0];
|
|
3106
3536
|
const tv_8 = Types_freshVar();
|
|
3107
|
-
const s3_10 = unify(typeDefs, applyType(s2_13, patternInput_47[1]), new
|
|
3108
|
-
const s_19 = compose(unify(typeDefs, applyType(s3_10, applyType(s2_13, patternInput_48[1])), new
|
|
3109
|
-
const tRes_18 = new
|
|
3110
|
-
return [s_19, tRes_18, asTyped(expr, tRes_18)];
|
|
3537
|
+
const s3_10 = unify(typeDefs, applyType(s2_13, patternInput_47[1]), new Type_1(/* TList */ 5, [tv_8]), span_20);
|
|
3538
|
+
const s_19 = compose(unify(typeDefs, applyType(s3_10, applyType(s2_13, patternInput_48[1])), new Type_1(/* TList */ 5, [applyType(s3_10, tv_8)]), span_20), compose(s3_10, compose(s2_13, s1_22)));
|
|
3539
|
+
const tRes_18 = new Type_1(/* TList */ 5, [applyType(s_19, tv_8)]);
|
|
3540
|
+
return [s_19, tRes_18, asTyped(telemetry, expr, tRes_18)];
|
|
3111
3541
|
}
|
|
3112
3542
|
default: {
|
|
3113
3543
|
const patternInput_49 = inferExpr(telemetry, typeDefs, constructors, env, a);
|
|
@@ -3127,41 +3557,41 @@ function inferExprRaw(telemetry, typeDefs, constructors, env, expr) {
|
|
|
3127
3557
|
break;
|
|
3128
3558
|
}
|
|
3129
3559
|
case "%": {
|
|
3130
|
-
patternInput_52 = [unify(typeDefs, t_8,
|
|
3560
|
+
patternInput_52 = [unify(typeDefs, t_8, Type_1.TInt, span_20), Type_1.TInt];
|
|
3131
3561
|
break;
|
|
3132
3562
|
}
|
|
3133
3563
|
case "=": {
|
|
3134
|
-
patternInput_52 = [emptySubst,
|
|
3564
|
+
patternInput_52 = [emptySubst, Type_1.TBool];
|
|
3135
3565
|
break;
|
|
3136
3566
|
}
|
|
3137
3567
|
case "<":
|
|
3138
3568
|
case ">":
|
|
3139
3569
|
case "<=":
|
|
3140
3570
|
case ">=": {
|
|
3141
|
-
patternInput_52 = [constrainNumeric(typeDefs, t_8, span_20)[0],
|
|
3571
|
+
patternInput_52 = [constrainNumeric(typeDefs, t_8, span_20)[0], Type_1.TBool];
|
|
3142
3572
|
break;
|
|
3143
3573
|
}
|
|
3144
3574
|
case "&&":
|
|
3145
3575
|
case "||": {
|
|
3146
|
-
patternInput_52 = [unify(typeDefs, t_8,
|
|
3576
|
+
patternInput_52 = [unify(typeDefs, t_8, Type_1.TBool, span_20), Type_1.TBool];
|
|
3147
3577
|
break;
|
|
3148
3578
|
}
|
|
3149
3579
|
default:
|
|
3150
3580
|
throw new TypeException(new TypeError$(toText(printf("Unknown operator %s"))(op), span_20));
|
|
3151
3581
|
}
|
|
3152
3582
|
const resultType = patternInput_52[1];
|
|
3153
|
-
return [compose(patternInput_52[0], compose(s3_11, compose(s2_14, s1_23))), resultType, asTyped(expr, resultType)];
|
|
3583
|
+
return [compose(patternInput_52[0], compose(s3_11, compose(s2_14, s1_23))), resultType, asTyped(telemetry, expr, resultType)];
|
|
3154
3584
|
}
|
|
3155
3585
|
}
|
|
3156
3586
|
}
|
|
3157
3587
|
case 26: {
|
|
3158
3588
|
const patternInput_53 = inferExpr(telemetry, typeDefs, constructors, env, expr.fields[0]);
|
|
3159
3589
|
const t1_11 = patternInput_53[1];
|
|
3160
|
-
return [patternInput_53[0], new
|
|
3590
|
+
return [patternInput_53[0], new Type_1(/* TOption */ 10, [t1_11]), asTyped(telemetry, expr, new Type_1(/* TOption */ 10, [t1_11]))];
|
|
3161
3591
|
}
|
|
3162
3592
|
case 27: {
|
|
3163
3593
|
const tv_9 = Types_freshVar();
|
|
3164
|
-
return [emptySubst, new
|
|
3594
|
+
return [emptySubst, new Type_1(/* TOption */ 10, [tv_9]), asTyped(telemetry, expr, new Type_1(/* TOption */ 10, [tv_9]))];
|
|
3165
3595
|
}
|
|
3166
3596
|
case 23: {
|
|
3167
3597
|
const patternInput_54 = inferExpr(telemetry, typeDefs, constructors, env, expr.fields[0]);
|
|
@@ -3169,9 +3599,9 @@ function inferExprRaw(telemetry, typeDefs, constructors, env, expr) {
|
|
|
3169
3599
|
const s1_25 = patternInput_54[0];
|
|
3170
3600
|
const patternInput_55 = inferExpr(telemetry, typeDefs, constructors, applyEnv(s1_25, env), expr.fields[1]);
|
|
3171
3601
|
const s2_15 = patternInput_55[0];
|
|
3172
|
-
const s_21 = compose(unify(typeDefs, applyType(s2_15, patternInput_55[1]), new
|
|
3173
|
-
const tRes_19 = applyType(s_21, new
|
|
3174
|
-
return [s_21, tRes_19, asTyped(expr, tRes_19)];
|
|
3602
|
+
const s_21 = compose(unify(typeDefs, applyType(s2_15, patternInput_55[1]), new Type_1(/* TList */ 5, [t1_12]), expr.fields[2]), compose(s2_15, s1_25));
|
|
3603
|
+
const tRes_19 = applyType(s_21, new Type_1(/* TList */ 5, [t1_12]));
|
|
3604
|
+
return [s_21, tRes_19, asTyped(telemetry, expr, tRes_19)];
|
|
3175
3605
|
}
|
|
3176
3606
|
case 24: {
|
|
3177
3607
|
const span_22 = expr.fields[2];
|
|
@@ -3180,13 +3610,13 @@ function inferExprRaw(telemetry, typeDefs, constructors, env, expr) {
|
|
|
3180
3610
|
const patternInput_57 = inferExpr(telemetry, typeDefs, constructors, applyEnv(s1_26, env), expr.fields[1]);
|
|
3181
3611
|
const s2_16 = patternInput_57[0];
|
|
3182
3612
|
const tv_10 = Types_freshVar();
|
|
3183
|
-
const s3_13 = unify(typeDefs, applyType(s2_16, patternInput_56[1]), new
|
|
3184
|
-
const s_22 = compose(unify(typeDefs, applyType(s3_13, applyType(s2_16, patternInput_57[1])), new
|
|
3185
|
-
const tRes_20 = new
|
|
3186
|
-
return [s_22, tRes_20, asTyped(expr, tRes_20)];
|
|
3613
|
+
const s3_13 = unify(typeDefs, applyType(s2_16, patternInput_56[1]), new Type_1(/* TList */ 5, [tv_10]), span_22);
|
|
3614
|
+
const s_22 = compose(unify(typeDefs, applyType(s3_13, applyType(s2_16, patternInput_57[1])), new Type_1(/* TList */ 5, [applyType(s3_13, tv_10)]), span_22), compose(s3_13, compose(s2_16, s1_26)));
|
|
3615
|
+
const tRes_20 = new Type_1(/* TList */ 5, [applyType(s_22, tv_10)]);
|
|
3616
|
+
return [s_22, tRes_20, asTyped(telemetry, expr, tRes_20)];
|
|
3187
3617
|
}
|
|
3188
3618
|
default:
|
|
3189
|
-
return [emptySubst,
|
|
3619
|
+
return [emptySubst, Type_1.TUnit, asTyped(telemetry, expr, Type_1.TUnit)];
|
|
3190
3620
|
}
|
|
3191
3621
|
}
|
|
3192
3622
|
|
|
@@ -3248,8 +3678,23 @@ function patternBindingNames(pat) {
|
|
|
3248
3678
|
return loop(empty_2(), pat);
|
|
3249
3679
|
}
|
|
3250
3680
|
|
|
3681
|
+
function unwrapStatementAttributes(statement) {
|
|
3682
|
+
if (statement.tag === 6) {
|
|
3683
|
+
const patternInput = unwrapStatementAttributes(statement.fields[1]);
|
|
3684
|
+
return [append(statement.fields[0], patternInput[0]), patternInput[1]];
|
|
3685
|
+
}
|
|
3686
|
+
else {
|
|
3687
|
+
return [empty_2(), statement];
|
|
3688
|
+
}
|
|
3689
|
+
}
|
|
3690
|
+
|
|
3691
|
+
function unwrapProgramAttributes(program) {
|
|
3692
|
+
return unzip(map_1(unwrapStatementAttributes, program));
|
|
3693
|
+
}
|
|
3694
|
+
|
|
3251
3695
|
function topLevelBindingNames(program) {
|
|
3252
|
-
return collect((
|
|
3696
|
+
return collect((arg_1) => {
|
|
3697
|
+
const _arg = unwrapStatementAttributes(arg_1)[1];
|
|
3253
3698
|
switch (_arg.tag) {
|
|
3254
3699
|
case 2:
|
|
3255
3700
|
return singleton(_arg.fields[0]);
|
|
@@ -3263,18 +3708,19 @@ function topLevelBindingNames(program) {
|
|
|
3263
3708
|
}, program);
|
|
3264
3709
|
}
|
|
3265
3710
|
|
|
3266
|
-
function inferProgramWithExternsRawAndLocals(
|
|
3267
|
-
let
|
|
3711
|
+
function inferProgramWithExternsRawAndLocals(captureTelemetry, registration, program) {
|
|
3712
|
+
let list_10;
|
|
3713
|
+
const program_1 = unwrapProgramAttributes(program)[1];
|
|
3268
3714
|
let hostDefinitions;
|
|
3269
3715
|
try {
|
|
3270
|
-
hostDefinitions = typeDefinitions(registration,
|
|
3716
|
+
hostDefinitions = typeDefinitions(registration, choose((_arg) => {
|
|
3271
3717
|
if (_arg.tag === 0) {
|
|
3272
3718
|
return _arg.fields[0].Name;
|
|
3273
3719
|
}
|
|
3274
3720
|
else {
|
|
3275
3721
|
return undefined;
|
|
3276
3722
|
}
|
|
3277
|
-
},
|
|
3723
|
+
}, program_1));
|
|
3278
3724
|
}
|
|
3279
3725
|
catch (matchValue) {
|
|
3280
3726
|
if (matchValue instanceof EvalException) {
|
|
@@ -3284,33 +3730,33 @@ function inferProgramWithExternsRawAndLocals(captureLocalVariables, registration
|
|
|
3284
3730
|
throw matchValue;
|
|
3285
3731
|
}
|
|
3286
3732
|
}
|
|
3287
|
-
const decls = ofList(append(map_1((
|
|
3733
|
+
const decls = ofList(append(map_1((d_1) => [d_1.Name, d_1], typeDefs_2), choose((_arg_1) => {
|
|
3288
3734
|
if (_arg_1.tag === 0) {
|
|
3289
|
-
const
|
|
3290
|
-
return [
|
|
3735
|
+
const d_2 = _arg_1.fields[0];
|
|
3736
|
+
return [d_2.Name, d_2];
|
|
3291
3737
|
}
|
|
3292
3738
|
else {
|
|
3293
3739
|
return undefined;
|
|
3294
3740
|
}
|
|
3295
|
-
},
|
|
3741
|
+
}, program_1)), {
|
|
3296
3742
|
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
3297
3743
|
});
|
|
3298
|
-
const typeDefs_1 = fold_1((acc, name_1, t_1) => add(name_1, t_1, acc), map((name,
|
|
3299
|
-
if (!isEmpty_1(
|
|
3300
|
-
return new
|
|
3744
|
+
const typeDefs_1 = fold_1((acc, name_1, t_1) => add(name_1, t_1, acc), map((name, d_3) => {
|
|
3745
|
+
if (!isEmpty_1(d_3.Cases)) {
|
|
3746
|
+
return new Type_1(/* TUnion */ 13, [name, ofList(map_1((tupledArg) => {
|
|
3301
3747
|
let option_1;
|
|
3302
3748
|
return [tupledArg[0], (option_1 = tupledArg[1], (option_1 != null) ? typeFromRef(decls, singleton(name), option_1) : undefined)];
|
|
3303
|
-
},
|
|
3749
|
+
}, d_3.Cases), {
|
|
3304
3750
|
Compare: (x_1, y_1) => (comparePrimitives(x_1, y_1) | 0),
|
|
3305
3751
|
})]);
|
|
3306
3752
|
}
|
|
3307
3753
|
else {
|
|
3308
|
-
return new
|
|
3754
|
+
return new Type_1(/* TRecord */ 8, [ofList(map_1((tupledArg_1) => [tupledArg_1[0], typeFromRef(decls, singleton(d_3.Name), tupledArg_1[1])], d_3.Fields), {
|
|
3309
3755
|
Compare: (x_2, y_2) => (comparePrimitives(x_2, y_2) | 0),
|
|
3310
3756
|
})]);
|
|
3311
3757
|
}
|
|
3312
3758
|
}, decls), hostDefinitions);
|
|
3313
|
-
const constructors = ofList((
|
|
3759
|
+
const constructors = ofList((list_10 = collect((tupledArg_2) => {
|
|
3314
3760
|
const typeName = tupledArg_2[0];
|
|
3315
3761
|
return collect((tupledArg_3) => {
|
|
3316
3762
|
let option_3;
|
|
@@ -3322,76 +3768,103 @@ function inferProgramWithExternsRawAndLocals(captureLocalVariables, registration
|
|
|
3322
3768
|
const caseName_2 = tupledArg_4[0];
|
|
3323
3769
|
const info = new ConstructorSig(descriptor.Name, tupledArg_4[1]);
|
|
3324
3770
|
return ofArray([[caseName_2, info], [concat(descriptor.Name, ".", caseName_2), info]]);
|
|
3325
|
-
}, toList(descriptor.Cases)), registration.Unions),
|
|
3771
|
+
}, toList(descriptor.Cases)), registration.Unions), list_10)), {
|
|
3326
3772
|
Compare: (x_3, y_3) => (comparePrimitives(x_3, y_3) | 0),
|
|
3327
3773
|
});
|
|
3328
3774
|
const constructorSchemes = map_1((tupledArg_5) => {
|
|
3329
3775
|
let matchValue_1;
|
|
3330
3776
|
const sigInfo_1 = tupledArg_5[1];
|
|
3331
|
-
const unionType = new
|
|
3332
|
-
return [tupledArg_5[0], new Scheme(empty_2(), (matchValue_1 = sigInfo_1.Payload, (matchValue_1 != null) ? (new
|
|
3777
|
+
const unionType = new Type_1(/* TNamed */ 12, [sigInfo_1.UnionName]);
|
|
3778
|
+
return [tupledArg_5[0], new Scheme(empty_2(), (matchValue_1 = sigInfo_1.Payload, (matchValue_1 != null) ? (new Type_1(/* TFun */ 11, [matchValue_1, unionType])) : unionType))];
|
|
3333
3779
|
}, toList(constructors));
|
|
3334
3780
|
let env = fold((acc_1, tupledArg_6) => FSharpMap__Add(acc_1, tupledArg_6[0], tupledArg_6[1]), envFromExterns(registration.Functions), constructorSchemes);
|
|
3335
|
-
const telemetry =
|
|
3781
|
+
const telemetry = captureTelemetry ? createTelemetry() : undefined;
|
|
3336
3782
|
const typed = [];
|
|
3337
3783
|
try {
|
|
3338
|
-
const enumerator = getEnumerator(indexed(
|
|
3784
|
+
const enumerator = getEnumerator(indexed(program_1));
|
|
3339
3785
|
try {
|
|
3340
3786
|
while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
|
|
3341
3787
|
let expectedReturn, expectedReturn_1;
|
|
3342
3788
|
const forLoopVar = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
3343
3789
|
const stmt = forLoopVar[1];
|
|
3790
|
+
let expressionStartIndex;
|
|
3791
|
+
if (telemetry == null) {
|
|
3792
|
+
expressionStartIndex = 0;
|
|
3793
|
+
}
|
|
3794
|
+
else {
|
|
3795
|
+
const t_2 = telemetry;
|
|
3796
|
+
expressionStartIndex = t_2.ExpressionTypes.length;
|
|
3797
|
+
}
|
|
3344
3798
|
switch (stmt.tag) {
|
|
3345
3799
|
case 1: {
|
|
3346
3800
|
throw new TypeException(new TypeError$("\'import\' must be resolved before type inference", stmt.fields[2]));
|
|
3347
3801
|
break;
|
|
3348
3802
|
}
|
|
3349
|
-
case
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
const
|
|
3355
|
-
|
|
3356
|
-
|
|
3803
|
+
case 6: {
|
|
3804
|
+
throw new TypeException(new TypeError$("Attributed statements must be normalized before type inference", stmt.fields[2]));
|
|
3805
|
+
break;
|
|
3806
|
+
}
|
|
3807
|
+
case 5: {
|
|
3808
|
+
const span_2 = stmt.fields[3];
|
|
3809
|
+
const name_3 = stmt.fields[0];
|
|
3810
|
+
const importedType = annotationTypeFromRef(typeDefs_1, span_2, stmt.fields[1]);
|
|
3811
|
+
if (importedType.tag === 11) {
|
|
3812
|
+
env = add(name_3, new Scheme(empty_2(), importedType), env);
|
|
3813
|
+
void (typed.push(new TypedStmt(/* TSBackendImport */ 4, [name_3, importedType, stmt.fields[2], span_2])));
|
|
3814
|
+
}
|
|
3815
|
+
else {
|
|
3816
|
+
throw new TypeException(new TypeError$("Backend imports require a complete function signature", span_2));
|
|
3817
|
+
}
|
|
3818
|
+
break;
|
|
3819
|
+
}
|
|
3820
|
+
case 2: {
|
|
3821
|
+
const span_3 = stmt.fields[6];
|
|
3822
|
+
const returnAnnotation = stmt.fields[2];
|
|
3823
|
+
const name_4 = stmt.fields[0];
|
|
3824
|
+
const isExported = stmt.fields[5];
|
|
3825
|
+
const exprVal = foldBack((arg, acc_2) => (new Expr(/* ELambda */ 4, [arg, acc_2, span_3])), stmt.fields[1], stmt.fields[3]);
|
|
3826
|
+
let startIndex;
|
|
3827
|
+
if (telemetry == null) {
|
|
3357
3828
|
startIndex = 0;
|
|
3358
3829
|
}
|
|
3359
3830
|
else {
|
|
3360
|
-
const
|
|
3361
|
-
startIndex =
|
|
3831
|
+
const t_3 = telemetry;
|
|
3832
|
+
startIndex = t_3.LocalVariableTypes.length;
|
|
3362
3833
|
}
|
|
3363
3834
|
if (stmt.fields[4]) {
|
|
3364
3835
|
const tv = Types_freshVar();
|
|
3365
|
-
const
|
|
3366
|
-
const t1 =
|
|
3367
|
-
const s1 =
|
|
3368
|
-
const s2 = unify(typeDefs_1, applyType(s1, tv), t1,
|
|
3369
|
-
const s = compose((returnAnnotation == null) ? emptySubst : ((expectedReturn = annotationTypeFromRef(typeDefs_1,
|
|
3836
|
+
const patternInput_1 = inferExpr(telemetry, typeDefs_1, constructors, add(name_4, new Scheme(empty_2(), tv), env), exprVal);
|
|
3837
|
+
const t1 = patternInput_1[1];
|
|
3838
|
+
const s1 = patternInput_1[0];
|
|
3839
|
+
const s2 = unify(typeDefs_1, applyType(s1, tv), t1, span_3);
|
|
3840
|
+
const s = compose((returnAnnotation == null) ? emptySubst : ((expectedReturn = annotationTypeFromRef(typeDefs_1, span_3, returnAnnotation), unify(typeDefs_1, functionReturnType(applyType(s2, t1)), expectedReturn, span_3))), compose(s2, s1));
|
|
3370
3841
|
applySubstToCapturedLocals(telemetry, startIndex, s);
|
|
3842
|
+
applySubstToCapturedExpressions(telemetry, expressionStartIndex, s);
|
|
3371
3843
|
const env$0027 = applyEnv(s, env);
|
|
3372
3844
|
const inferred = applyType(s, t1);
|
|
3373
|
-
validateMapKeyTypes(typeDefs_1,
|
|
3845
|
+
validateMapKeyTypes(typeDefs_1, span_3, inferred);
|
|
3374
3846
|
const scheme_1 = Types_generalize(env$0027, inferred);
|
|
3375
|
-
env = add(
|
|
3376
|
-
void (typed.push(new TypedStmt(/* TSLet */ 1, [
|
|
3847
|
+
env = add(name_4, scheme_1, env$0027);
|
|
3848
|
+
void (typed.push(new TypedStmt(/* TSLet */ 1, [name_4, exprVal, inferred, true, isExported, span_3])));
|
|
3377
3849
|
}
|
|
3378
3850
|
else {
|
|
3379
|
-
const
|
|
3380
|
-
const t1_1 =
|
|
3381
|
-
const s1_1 =
|
|
3382
|
-
const s_1 = compose((returnAnnotation == null) ? emptySubst : ((expectedReturn_1 = annotationTypeFromRef(typeDefs_1,
|
|
3851
|
+
const patternInput_2 = inferExpr(telemetry, typeDefs_1, constructors, env, exprVal);
|
|
3852
|
+
const t1_1 = patternInput_2[1];
|
|
3853
|
+
const s1_1 = patternInput_2[0];
|
|
3854
|
+
const s_1 = compose((returnAnnotation == null) ? emptySubst : ((expectedReturn_1 = annotationTypeFromRef(typeDefs_1, span_3, returnAnnotation), unify(typeDefs_1, functionReturnType(applyType(s1_1, t1_1)), expectedReturn_1, span_3))), s1_1);
|
|
3383
3855
|
applySubstToCapturedLocals(telemetry, startIndex, s_1);
|
|
3856
|
+
applySubstToCapturedExpressions(telemetry, expressionStartIndex, s_1);
|
|
3384
3857
|
const env$0027_1 = applyEnv(s_1, env);
|
|
3385
3858
|
const inferred_1 = applyType(s_1, t1_1);
|
|
3386
|
-
validateMapKeyTypes(typeDefs_1,
|
|
3859
|
+
validateMapKeyTypes(typeDefs_1, span_3, inferred_1);
|
|
3387
3860
|
const scheme_2 = Types_generalize(env$0027_1, inferred_1);
|
|
3388
|
-
env = add(
|
|
3389
|
-
void (typed.push(new TypedStmt(/* TSLet */ 1, [
|
|
3861
|
+
env = add(name_4, scheme_2, env$0027_1);
|
|
3862
|
+
void (typed.push(new TypedStmt(/* TSLet */ 1, [name_4, exprVal, inferred_1, false, isExported, span_3])));
|
|
3390
3863
|
}
|
|
3391
3864
|
break;
|
|
3392
3865
|
}
|
|
3393
3866
|
case 3: {
|
|
3394
|
-
const
|
|
3867
|
+
const span_4 = stmt.fields[3];
|
|
3395
3868
|
const pattern = stmt.fields[0];
|
|
3396
3869
|
const expr_1 = stmt.fields[1];
|
|
3397
3870
|
let startIndex_1;
|
|
@@ -3399,32 +3872,33 @@ function inferProgramWithExternsRawAndLocals(captureLocalVariables, registration
|
|
|
3399
3872
|
startIndex_1 = 0;
|
|
3400
3873
|
}
|
|
3401
3874
|
else {
|
|
3402
|
-
const
|
|
3403
|
-
startIndex_1 =
|
|
3875
|
+
const t_4 = telemetry;
|
|
3876
|
+
startIndex_1 = t_4.LocalVariableTypes.length;
|
|
3404
3877
|
}
|
|
3405
|
-
const
|
|
3406
|
-
const s1_2 =
|
|
3407
|
-
const
|
|
3408
|
-
const s_2 = compose(unify(typeDefs_1, applyType(s1_2,
|
|
3878
|
+
const patternInput_3 = inferExpr(telemetry, typeDefs_1, constructors, env, expr_1);
|
|
3879
|
+
const s1_2 = patternInput_3[0];
|
|
3880
|
+
const patternInput_4 = inferPattern(telemetry, typeDefs_1, constructors, pattern);
|
|
3881
|
+
const s_2 = compose(unify(typeDefs_1, applyType(s1_2, patternInput_3[1]), patternInput_4[1], span_4), s1_2);
|
|
3409
3882
|
applySubstToCapturedLocals(telemetry, startIndex_1, s_2);
|
|
3883
|
+
applySubstToCapturedExpressions(telemetry, expressionStartIndex, s_2);
|
|
3410
3884
|
const envBase = applyEnv(s_2, env);
|
|
3411
|
-
const typedBindings = map((_arg_2, ty) => applyType(s_2, ty),
|
|
3885
|
+
const typedBindings = map((_arg_2, ty) => applyType(s_2, ty), patternInput_4[0]);
|
|
3412
3886
|
iterate_2((_arg_3, ty_1) => {
|
|
3413
|
-
validateMapKeyTypes(typeDefs_1,
|
|
3887
|
+
validateMapKeyTypes(typeDefs_1, span_4, ty_1);
|
|
3414
3888
|
}, typedBindings);
|
|
3415
|
-
env = fold_1((state_1,
|
|
3416
|
-
void (typed.push(new TypedStmt(/* TSLetPattern */ 2, [pattern, expr_1, typedBindings, stmt.fields[2],
|
|
3889
|
+
env = fold_1((state_1, name_5, bindingType) => add(name_5, Types_generalize(envBase, bindingType), state_1), envBase, typedBindings);
|
|
3890
|
+
void (typed.push(new TypedStmt(/* TSLetPattern */ 2, [pattern, expr_1, typedBindings, stmt.fields[2], span_4])));
|
|
3417
3891
|
break;
|
|
3418
3892
|
}
|
|
3419
3893
|
case 4: {
|
|
3420
|
-
const
|
|
3894
|
+
const span_5 = stmt.fields[2];
|
|
3421
3895
|
let startIndex_2;
|
|
3422
3896
|
if (telemetry == null) {
|
|
3423
3897
|
startIndex_2 = 0;
|
|
3424
3898
|
}
|
|
3425
3899
|
else {
|
|
3426
|
-
const
|
|
3427
|
-
startIndex_2 =
|
|
3900
|
+
const t_5 = telemetry;
|
|
3901
|
+
startIndex_2 = t_5.LocalVariableTypes.length;
|
|
3428
3902
|
}
|
|
3429
3903
|
const foldedBindings = map_1((tupledArg_7) => {
|
|
3430
3904
|
const args_1 = tupledArg_7[1];
|
|
@@ -3437,15 +3911,15 @@ function inferProgramWithExternsRawAndLocals(captureLocalVariables, registration
|
|
|
3437
3911
|
const freshByName = ofList(map_1((tupledArg_8) => [tupledArg_8[0], Types_freshVar()], foldedBindings), {
|
|
3438
3912
|
Compare: (x_4, y_4) => (comparePrimitives(x_4, y_4) | 0),
|
|
3439
3913
|
});
|
|
3440
|
-
const envRec_1 = fold_1((acc_4,
|
|
3914
|
+
const envRec_1 = fold_1((acc_4, name_8, tv_1) => add(name_8, new Scheme(empty_2(), tv_1), acc_4), env, freshByName);
|
|
3441
3915
|
let sRec = emptySubst;
|
|
3442
3916
|
const enumerator_1 = getEnumerator(foldedBindings);
|
|
3443
3917
|
try {
|
|
3444
3918
|
while (enumerator_1["System.Collections.IEnumerator.MoveNext"]()) {
|
|
3445
3919
|
const forLoopVar_1 = enumerator_1["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
3446
|
-
const
|
|
3447
|
-
const s1_3 =
|
|
3448
|
-
const s2_2 = unify(typeDefs_1, applyType(s1_3, applyType(sRec, FSharpMap__get_Item(freshByName, forLoopVar_1[0]))),
|
|
3920
|
+
const patternInput_5 = inferExpr(telemetry, typeDefs_1, constructors, applyEnv(sRec, envRec_1), forLoopVar_1[2]);
|
|
3921
|
+
const s1_3 = patternInput_5[0];
|
|
3922
|
+
const s2_2 = unify(typeDefs_1, applyType(s1_3, applyType(sRec, FSharpMap__get_Item(freshByName, forLoopVar_1[0]))), patternInput_5[1], forLoopVar_1[3]);
|
|
3449
3923
|
sRec = compose(s2_2, compose(s1_3, sRec));
|
|
3450
3924
|
}
|
|
3451
3925
|
}
|
|
@@ -3471,39 +3945,41 @@ function inferProgramWithExternsRawAndLocals(captureLocalVariables, registration
|
|
|
3471
3945
|
disposeSafe(enumerator_2);
|
|
3472
3946
|
}
|
|
3473
3947
|
applySubstToCapturedLocals(telemetry, startIndex_2, sRec);
|
|
3948
|
+
applySubstToCapturedExpressions(telemetry, expressionStartIndex, sRec);
|
|
3474
3949
|
const envGeneralize = applyEnv(sRec, env);
|
|
3475
3950
|
const schemes = map_1((tupledArg_9) => {
|
|
3476
|
-
const
|
|
3477
|
-
const inferred_2 = applyType(sRec, FSharpMap__get_Item(freshByName,
|
|
3478
|
-
validateMapKeyTypes(typeDefs_1,
|
|
3479
|
-
return [
|
|
3951
|
+
const name_11 = tupledArg_9[0];
|
|
3952
|
+
const inferred_2 = applyType(sRec, FSharpMap__get_Item(freshByName, name_11));
|
|
3953
|
+
validateMapKeyTypes(typeDefs_1, span_5, inferred_2);
|
|
3954
|
+
return [name_11, Types_generalize(envGeneralize, inferred_2)];
|
|
3480
3955
|
}, foldedBindings);
|
|
3481
3956
|
const typedBindings_1 = map_1((tupledArg_10) => {
|
|
3482
|
-
const
|
|
3483
|
-
return [
|
|
3957
|
+
const name_12 = tupledArg_10[0];
|
|
3958
|
+
return [name_12, tupledArg_10[2], applyType(sRec, FSharpMap__get_Item(freshByName, name_12)), tupledArg_10[3]];
|
|
3484
3959
|
}, foldedBindings);
|
|
3485
3960
|
env = fold((acc_5, tupledArg_11) => add(tupledArg_11[0], tupledArg_11[1], acc_5), envGeneralize, schemes);
|
|
3486
|
-
void (typed.push(new TypedStmt(/* TSLetRecGroup */ 3, [typedBindings_1, stmt.fields[1],
|
|
3961
|
+
void (typed.push(new TypedStmt(/* TSLetRecGroup */ 3, [typedBindings_1, stmt.fields[1], span_5])));
|
|
3487
3962
|
break;
|
|
3488
3963
|
}
|
|
3489
|
-
case
|
|
3964
|
+
case 7: {
|
|
3490
3965
|
const expr_2 = stmt.fields[0];
|
|
3491
3966
|
let startIndex_3;
|
|
3492
3967
|
if (telemetry == null) {
|
|
3493
3968
|
startIndex_3 = 0;
|
|
3494
3969
|
}
|
|
3495
3970
|
else {
|
|
3496
|
-
const
|
|
3497
|
-
startIndex_3 =
|
|
3971
|
+
const t_6 = telemetry;
|
|
3972
|
+
startIndex_3 = t_6.LocalVariableTypes.length;
|
|
3498
3973
|
}
|
|
3499
|
-
const
|
|
3500
|
-
const t1_3 =
|
|
3501
|
-
const s1_4 =
|
|
3502
|
-
const s_3 = compose((forLoopVar[0] < (length(
|
|
3974
|
+
const patternInput_6 = inferExpr(telemetry, typeDefs_1, constructors, env, expr_2);
|
|
3975
|
+
const t1_3 = patternInput_6[1];
|
|
3976
|
+
const s1_4 = patternInput_6[0];
|
|
3977
|
+
const s_3 = compose((forLoopVar[0] < (length(program_1) - 1)) ? unify(typeDefs_1, applyType(s1_4, t1_3), Type_1.TUnit, Ast_spanOfExpr(expr_2)) : emptySubst, s1_4);
|
|
3503
3978
|
applySubstToCapturedLocals(telemetry, startIndex_3, s_3);
|
|
3979
|
+
applySubstToCapturedExpressions(telemetry, expressionStartIndex, s_3);
|
|
3504
3980
|
validateMapKeyTypes(typeDefs_1, Ast_spanOfExpr(expr_2), applyType(s_3, t1_3));
|
|
3505
3981
|
env = applyEnv(s_3, env);
|
|
3506
|
-
void (typed.push(new TypedStmt(/* TSExpr */
|
|
3982
|
+
void (typed.push(new TypedStmt(/* TSExpr */ 5, [patternInput_6[2]])));
|
|
3507
3983
|
break;
|
|
3508
3984
|
}
|
|
3509
3985
|
default:
|
|
@@ -3514,7 +3990,8 @@ function inferProgramWithExternsRawAndLocals(captureLocalVariables, registration
|
|
|
3514
3990
|
finally {
|
|
3515
3991
|
disposeSafe(enumerator);
|
|
3516
3992
|
}
|
|
3517
|
-
|
|
3993
|
+
const expressionTypes = (telemetry == null) ? empty_2() : toList_1(telemetry.ExpressionTypes);
|
|
3994
|
+
return [toList_1(typed), capturedLocalVariableTypes(telemetry), expressionTypes];
|
|
3518
3995
|
}
|
|
3519
3996
|
catch (matchValue_2) {
|
|
3520
3997
|
throw matchValue_2;
|
|
@@ -3525,7 +4002,7 @@ export function inferProgramWithExternsRaw(externs, program) {
|
|
|
3525
4002
|
return inferProgramWithExternsRawAndLocals(false, ofExterns(externs), program)[0];
|
|
3526
4003
|
}
|
|
3527
4004
|
|
|
3528
|
-
|
|
4005
|
+
function validateProgramBindings(externs, program) {
|
|
3529
4006
|
const option_1 = tryFind_1((ext) => contains(ext.Name, builtinReservedNames), externs);
|
|
3530
4007
|
if (option_1 != null) {
|
|
3531
4008
|
throw new TypeException(new TypeError$(concat("Host extern \'", option_1.Name, "\' collides with reserved stdlib symbol"), unknownSpan));
|
|
@@ -3534,19 +4011,1794 @@ export function inferProgramWithExterns(externs, program) {
|
|
|
3534
4011
|
if (option_3 != null) {
|
|
3535
4012
|
throw new TypeException(new TypeError$(concat("Top-level binding \'", option_3, "\' collides with reserved stdlib symbol"), unknownSpan));
|
|
3536
4013
|
}
|
|
3537
|
-
return inferProgramWithExternsRaw(externs, program);
|
|
3538
4014
|
}
|
|
3539
4015
|
|
|
3540
4016
|
export function inferProgramWithExternsAndLocalVariableTypes(externs, program) {
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
4017
|
+
validateProgramBindings(externs, program);
|
|
4018
|
+
const patternInput = inferProgramWithExternsRawAndLocals(true, ofExterns(externs), program);
|
|
4019
|
+
return [patternInput[0], patternInput[1]];
|
|
4020
|
+
}
|
|
4021
|
+
|
|
4022
|
+
export function inferResolvedProgramWithRegistration(registration, program) {
|
|
4023
|
+
const externs = registration.Functions;
|
|
4024
|
+
validateProgramBindings(externs, program);
|
|
4025
|
+
const patternInput = unwrapProgramAttributes(program);
|
|
4026
|
+
const patternInput_1 = inferProgramWithExternsRawAndLocals(true, registration, patternInput[1]);
|
|
4027
|
+
const typed = patternInput_1[0];
|
|
4028
|
+
const expressions = patternInput_1[2];
|
|
4029
|
+
const expressionTypes = fold((state, item) => add(item.Expr, item.Type, state), empty({
|
|
4030
|
+
Compare: (x, y) => (compare(x, y) | 0),
|
|
4031
|
+
}), expressions);
|
|
4032
|
+
let nextSymbol = 0;
|
|
4033
|
+
const symbols = [];
|
|
4034
|
+
const references = [];
|
|
4035
|
+
const patternBindingIds = [];
|
|
4036
|
+
const normalizeTypeVariables = (value_3) => {
|
|
4037
|
+
let next = 0;
|
|
4038
|
+
let mapping_3 = empty({
|
|
4039
|
+
Compare: (x_2, y_2) => (comparePrimitives(x_2, y_2) | 0),
|
|
4040
|
+
});
|
|
4041
|
+
const normalize_1 = (_arg_5) => {
|
|
4042
|
+
let matchValue_1;
|
|
4043
|
+
let matchResult, variable_3;
|
|
4044
|
+
switch (_arg_5.tag) {
|
|
4045
|
+
case 15: {
|
|
4046
|
+
matchResult = 0;
|
|
4047
|
+
variable_3 = _arg_5.fields[0];
|
|
4048
|
+
break;
|
|
4049
|
+
}
|
|
4050
|
+
case 16: {
|
|
4051
|
+
matchResult = 0;
|
|
4052
|
+
variable_3 = _arg_5.fields[0];
|
|
4053
|
+
break;
|
|
4054
|
+
}
|
|
4055
|
+
case 18: {
|
|
4056
|
+
matchResult = 1;
|
|
4057
|
+
break;
|
|
4058
|
+
}
|
|
4059
|
+
case 5: {
|
|
4060
|
+
matchResult = 2;
|
|
4061
|
+
break;
|
|
4062
|
+
}
|
|
4063
|
+
case 6: {
|
|
4064
|
+
matchResult = 3;
|
|
4065
|
+
break;
|
|
4066
|
+
}
|
|
4067
|
+
case 10: {
|
|
4068
|
+
matchResult = 4;
|
|
4069
|
+
break;
|
|
4070
|
+
}
|
|
4071
|
+
case 7: {
|
|
4072
|
+
matchResult = 5;
|
|
4073
|
+
break;
|
|
4074
|
+
}
|
|
4075
|
+
case 8: {
|
|
4076
|
+
matchResult = 6;
|
|
4077
|
+
break;
|
|
4078
|
+
}
|
|
4079
|
+
case 9: {
|
|
4080
|
+
matchResult = 7;
|
|
4081
|
+
break;
|
|
4082
|
+
}
|
|
4083
|
+
case 11: {
|
|
4084
|
+
matchResult = 8;
|
|
4085
|
+
break;
|
|
4086
|
+
}
|
|
4087
|
+
case 13: {
|
|
4088
|
+
matchResult = 9;
|
|
4089
|
+
break;
|
|
4090
|
+
}
|
|
4091
|
+
default:
|
|
4092
|
+
matchResult = 10;
|
|
4093
|
+
}
|
|
4094
|
+
switch (matchResult) {
|
|
4095
|
+
case 0: {
|
|
4096
|
+
const matchValue = tryFind(variable_3, mapping_3);
|
|
4097
|
+
if (matchValue == null) {
|
|
4098
|
+
const normalized_1 = next | 0;
|
|
4099
|
+
next = ((next + 1) | 0);
|
|
4100
|
+
mapping_3 = add(variable_3, normalized_1, mapping_3);
|
|
4101
|
+
return new Type_1(/* TVar */ 15, [normalized_1]);
|
|
4102
|
+
}
|
|
4103
|
+
else {
|
|
4104
|
+
return new Type_1(/* TVar */ 15, [matchValue]);
|
|
4105
|
+
}
|
|
4106
|
+
}
|
|
4107
|
+
case 1: {
|
|
4108
|
+
const id_1 = _arg_5.fields[0] | 0;
|
|
4109
|
+
return new Type_1(/* TRecordShape */ 18, [(matchValue_1 = normalize_1(new Type_1(/* TVar */ 15, [id_1])), (matchValue_1.tag === 15) ? matchValue_1.fields[0] : id_1), map(uncurry2((_arg_6) => normalize_1), _arg_5.fields[1]), _arg_5.fields[2]]);
|
|
4110
|
+
}
|
|
4111
|
+
case 2:
|
|
4112
|
+
return new Type_1(/* TList */ 5, [normalize_1(_arg_5.fields[0])]);
|
|
4113
|
+
case 3:
|
|
4114
|
+
return new Type_1(/* TTask */ 6, [normalize_1(_arg_5.fields[0])]);
|
|
4115
|
+
case 4:
|
|
4116
|
+
return new Type_1(/* TOption */ 10, [normalize_1(_arg_5.fields[0])]);
|
|
4117
|
+
case 5:
|
|
4118
|
+
return new Type_1(/* TTuple */ 7, [map_1(normalize_1, _arg_5.fields[0])]);
|
|
4119
|
+
case 6:
|
|
4120
|
+
return new Type_1(/* TRecord */ 8, [map((_arg_7, item_7) => normalize_1(item_7), _arg_5.fields[0])]);
|
|
4121
|
+
case 7:
|
|
4122
|
+
return new Type_1(/* TMap */ 9, [normalize_1(_arg_5.fields[0]), normalize_1(_arg_5.fields[1])]);
|
|
4123
|
+
case 8:
|
|
4124
|
+
return new Type_1(/* TFun */ 11, [normalize_1(_arg_5.fields[0]), normalize_1(_arg_5.fields[1])]);
|
|
4125
|
+
case 9:
|
|
4126
|
+
return new Type_1(/* TUnion */ 13, [_arg_5.fields[0], map((_arg_8, payload_1) => {
|
|
4127
|
+
const option_4 = payload_1;
|
|
4128
|
+
return (option_4 != null) ? normalize_1(option_4) : undefined;
|
|
4129
|
+
}, _arg_5.fields[1])]);
|
|
4130
|
+
default:
|
|
4131
|
+
return _arg_5;
|
|
4132
|
+
}
|
|
4133
|
+
};
|
|
4134
|
+
return normalize_1(value_3);
|
|
4135
|
+
};
|
|
4136
|
+
const allocate = (name_2, kind, span, scheme) => {
|
|
4137
|
+
let option_5, _arg, variables, mapping_1, normalize;
|
|
4138
|
+
const id_2 = nextSymbol | 0;
|
|
4139
|
+
nextSymbol = ((nextSymbol + 1) | 0);
|
|
4140
|
+
void (symbols.push(new ResolvedSymbol(id_2, name_2, kind, span, (option_5 = scheme, (option_5 != null) ? ((_arg = option_5, (variables = _arg.fields[0], (mapping_1 = ofList(mapIndexed((index, variable) => [variable, index], variables), {
|
|
4141
|
+
Compare: (x_1, y_1) => (comparePrimitives(x_1, y_1) | 0),
|
|
4142
|
+
}), (normalize = ((_arg_1) => {
|
|
4143
|
+
switch (_arg_1.tag) {
|
|
4144
|
+
case 15: {
|
|
4145
|
+
const variable_1 = _arg_1.fields[0] | 0;
|
|
4146
|
+
return new Type_1(/* TVar */ 15, [defaultArg(tryFind(variable_1, mapping_1), variable_1)]);
|
|
4147
|
+
}
|
|
4148
|
+
case 16: {
|
|
4149
|
+
const variable_2 = _arg_1.fields[0] | 0;
|
|
4150
|
+
return new Type_1(/* TVar */ 15, [defaultArg(tryFind(variable_2, mapping_1), variable_2)]);
|
|
4151
|
+
}
|
|
4152
|
+
case 18: {
|
|
4153
|
+
const id = _arg_1.fields[0] | 0;
|
|
4154
|
+
return new Type_1(/* TRecordShape */ 18, [defaultArg(tryFind(id, mapping_1), id), map(uncurry2((_arg_2) => normalize), _arg_1.fields[1]), _arg_1.fields[2]]);
|
|
4155
|
+
}
|
|
4156
|
+
case 5:
|
|
4157
|
+
return new Type_1(/* TList */ 5, [normalize(_arg_1.fields[0])]);
|
|
4158
|
+
case 6:
|
|
4159
|
+
return new Type_1(/* TTask */ 6, [normalize(_arg_1.fields[0])]);
|
|
4160
|
+
case 10:
|
|
4161
|
+
return new Type_1(/* TOption */ 10, [normalize(_arg_1.fields[0])]);
|
|
4162
|
+
case 7:
|
|
4163
|
+
return new Type_1(/* TTuple */ 7, [map_1(normalize, _arg_1.fields[0])]);
|
|
4164
|
+
case 8:
|
|
4165
|
+
return new Type_1(/* TRecord */ 8, [map((_arg_3, value) => normalize(value), _arg_1.fields[0])]);
|
|
4166
|
+
case 9:
|
|
4167
|
+
return new Type_1(/* TMap */ 9, [normalize(_arg_1.fields[0]), normalize(_arg_1.fields[1])]);
|
|
4168
|
+
case 11:
|
|
4169
|
+
return new Type_1(/* TFun */ 11, [normalize(_arg_1.fields[0]), normalize(_arg_1.fields[1])]);
|
|
4170
|
+
case 13:
|
|
4171
|
+
return new Type_1(/* TUnion */ 13, [_arg_1.fields[0], map((_arg_4, payload) => {
|
|
4172
|
+
const option_3 = payload;
|
|
4173
|
+
return (option_3 != null) ? normalize(option_3) : undefined;
|
|
4174
|
+
}, _arg_1.fields[1])]);
|
|
4175
|
+
default:
|
|
4176
|
+
return _arg_1;
|
|
4177
|
+
}
|
|
4178
|
+
}), new Scheme(toList_1(rangeDouble(0, 1, length(variables) - 1)), normalize(_arg.fields[1]))))))) : undefined))));
|
|
4179
|
+
return id_2 | 0;
|
|
4180
|
+
};
|
|
4181
|
+
const syntheticSpan = new Span(new Position(undefined, 0, 0), new Position(undefined, 0, 0));
|
|
4182
|
+
let globalEnvironment = empty({
|
|
4183
|
+
Compare: (x_3, y_3) => (comparePrimitives(x_3, y_3) | 0),
|
|
4184
|
+
});
|
|
4185
|
+
const enumerator = getEnumerator(sortBy((tuple) => tuple[0], toList(builtinSchemes), {
|
|
4186
|
+
Compare: (x_4, y_4) => (comparePrimitives(x_4, y_4) | 0),
|
|
4187
|
+
}));
|
|
4188
|
+
try {
|
|
4189
|
+
while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
|
|
4190
|
+
const forLoopVar = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
4191
|
+
const name_3 = forLoopVar[0];
|
|
4192
|
+
globalEnvironment = add(name_3, allocate(name_3, ResolvedSymbolKind.BuiltinSymbol, syntheticSpan, forLoopVar[1]), globalEnvironment);
|
|
4193
|
+
}
|
|
3544
4194
|
}
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
4195
|
+
finally {
|
|
4196
|
+
disposeSafe(enumerator);
|
|
4197
|
+
}
|
|
4198
|
+
const enumerator_1 = getEnumerator(sortBy((_arg_9) => _arg_9.Name, externs, {
|
|
4199
|
+
Compare: (x_5, y_5) => (comparePrimitives(x_5, y_5) | 0),
|
|
4200
|
+
}));
|
|
4201
|
+
try {
|
|
4202
|
+
while (enumerator_1["System.Collections.IEnumerator.MoveNext"]()) {
|
|
4203
|
+
const external = enumerator_1["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
4204
|
+
globalEnvironment = add(external.Name, allocate(external.Name, ResolvedSymbolKind.ExternSymbol, syntheticSpan, external.Scheme), globalEnvironment);
|
|
4205
|
+
}
|
|
4206
|
+
}
|
|
4207
|
+
finally {
|
|
4208
|
+
disposeSafe(enumerator_1);
|
|
4209
|
+
}
|
|
4210
|
+
const enumerator_2 = getEnumerator(typeDefs_2);
|
|
4211
|
+
try {
|
|
4212
|
+
while (enumerator_2["System.Collections.IEnumerator.MoveNext"]()) {
|
|
4213
|
+
const definition = enumerator_2["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
4214
|
+
globalEnvironment = add(definition.Name, allocate(definition.Name, ResolvedSymbolKind.TypeSymbol, definition.Span, undefined), globalEnvironment);
|
|
4215
|
+
const enumerator_3 = getEnumerator(definition.Cases);
|
|
4216
|
+
try {
|
|
4217
|
+
while (enumerator_3["System.Collections.IEnumerator.MoveNext"]()) {
|
|
4218
|
+
let table_5;
|
|
4219
|
+
const caseName = enumerator_3["System.Collections.Generic.IEnumerator`1.get_Current"]()[0];
|
|
4220
|
+
const id_3 = allocate(concat(definition.Name, ".", caseName), ResolvedSymbolKind.UnionCaseSymbol, definition.Span, undefined) | 0;
|
|
4221
|
+
globalEnvironment = ((table_5 = add(caseName, id_3, globalEnvironment), add(concat(definition.Name, ".", caseName), id_3, table_5)));
|
|
4222
|
+
}
|
|
4223
|
+
}
|
|
4224
|
+
finally {
|
|
4225
|
+
disposeSafe(enumerator_3);
|
|
4226
|
+
}
|
|
4227
|
+
}
|
|
4228
|
+
}
|
|
4229
|
+
finally {
|
|
4230
|
+
disposeSafe(enumerator_2);
|
|
4231
|
+
}
|
|
4232
|
+
const hostDefinitions = typeDefinitions(registration, empty_2());
|
|
4233
|
+
const enumerator_4 = getEnumerator(toList(hostDefinitions));
|
|
4234
|
+
try {
|
|
4235
|
+
while (enumerator_4["System.Collections.IEnumerator.MoveNext"]()) {
|
|
4236
|
+
const forLoopVar_2 = enumerator_4["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
4237
|
+
const name_4 = forLoopVar_2[0];
|
|
4238
|
+
const definition_1 = forLoopVar_2[1];
|
|
4239
|
+
globalEnvironment = add(name_4, allocate(name_4, ResolvedSymbolKind.TypeSymbol, syntheticSpan, undefined), globalEnvironment);
|
|
4240
|
+
if (definition_1.tag === 13) {
|
|
4241
|
+
const enumerator_5 = getEnumerator(toList(definition_1.fields[1]));
|
|
4242
|
+
try {
|
|
4243
|
+
while (enumerator_5["System.Collections.IEnumerator.MoveNext"]()) {
|
|
4244
|
+
let table_9;
|
|
4245
|
+
const caseName_1 = enumerator_5["System.Collections.Generic.IEnumerator`1.get_Current"]()[0];
|
|
4246
|
+
const id_4 = allocate(concat(name_4, ".", caseName_1), ResolvedSymbolKind.UnionCaseSymbol, syntheticSpan, undefined) | 0;
|
|
4247
|
+
globalEnvironment = ((table_9 = add(caseName_1, id_4, globalEnvironment), add(concat(name_4, ".", caseName_1), id_4, table_9)));
|
|
4248
|
+
}
|
|
4249
|
+
}
|
|
4250
|
+
finally {
|
|
4251
|
+
disposeSafe(enumerator_5);
|
|
4252
|
+
}
|
|
4253
|
+
}
|
|
4254
|
+
}
|
|
4255
|
+
}
|
|
4256
|
+
finally {
|
|
4257
|
+
disposeSafe(enumerator_4);
|
|
4258
|
+
}
|
|
4259
|
+
const builtinEnvironment = globalEnvironment;
|
|
4260
|
+
const enumerator_6 = getEnumerator(typed);
|
|
4261
|
+
try {
|
|
4262
|
+
while (enumerator_6["System.Collections.IEnumerator.MoveNext"]()) {
|
|
4263
|
+
const statement = enumerator_6["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
4264
|
+
switch (statement.tag) {
|
|
4265
|
+
case 1: {
|
|
4266
|
+
const name_5 = statement.fields[0];
|
|
4267
|
+
globalEnvironment = add(name_5, allocate(name_5, ResolvedSymbolKind.DeclarationSymbol, statement.fields[5], Types_generalize(empty({
|
|
4268
|
+
Compare: (x_6, y_6) => (comparePrimitives(x_6, y_6) | 0),
|
|
4269
|
+
}), statement.fields[2])), globalEnvironment);
|
|
4270
|
+
break;
|
|
4271
|
+
}
|
|
4272
|
+
case 2: {
|
|
4273
|
+
const enumerator_8 = getEnumerator(toList(statement.fields[2]));
|
|
4274
|
+
try {
|
|
4275
|
+
while (enumerator_8["System.Collections.IEnumerator.MoveNext"]()) {
|
|
4276
|
+
const forLoopVar_5 = enumerator_8["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
4277
|
+
const name_6 = forLoopVar_5[0];
|
|
4278
|
+
globalEnvironment = add(name_6, allocate(name_6, ResolvedSymbolKind.DeclarationSymbol, statement.fields[4], Types_generalize(empty({
|
|
4279
|
+
Compare: (x_7, y_7) => (comparePrimitives(x_7, y_7) | 0),
|
|
4280
|
+
}), forLoopVar_5[1])), globalEnvironment);
|
|
4281
|
+
}
|
|
4282
|
+
}
|
|
4283
|
+
finally {
|
|
4284
|
+
disposeSafe(enumerator_8);
|
|
4285
|
+
}
|
|
4286
|
+
break;
|
|
4287
|
+
}
|
|
4288
|
+
case 3: {
|
|
4289
|
+
const enumerator_9 = getEnumerator(statement.fields[0]);
|
|
4290
|
+
try {
|
|
4291
|
+
while (enumerator_9["System.Collections.IEnumerator.MoveNext"]()) {
|
|
4292
|
+
const forLoopVar_6 = enumerator_9["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
4293
|
+
const name_7 = forLoopVar_6[0];
|
|
4294
|
+
globalEnvironment = add(name_7, allocate(name_7, ResolvedSymbolKind.DeclarationSymbol, forLoopVar_6[3], Types_generalize(empty({
|
|
4295
|
+
Compare: (x_8, y_8) => (comparePrimitives(x_8, y_8) | 0),
|
|
4296
|
+
}), forLoopVar_6[2])), globalEnvironment);
|
|
4297
|
+
}
|
|
4298
|
+
}
|
|
4299
|
+
finally {
|
|
4300
|
+
disposeSafe(enumerator_9);
|
|
4301
|
+
}
|
|
4302
|
+
break;
|
|
4303
|
+
}
|
|
4304
|
+
case 4: {
|
|
4305
|
+
const name_8 = statement.fields[0];
|
|
4306
|
+
globalEnvironment = add(name_8, allocate(name_8, ResolvedSymbolKind.DeclarationSymbol, statement.fields[3], new Scheme(empty_2(), statement.fields[1])), globalEnvironment);
|
|
4307
|
+
break;
|
|
4308
|
+
}
|
|
4309
|
+
case 5: {
|
|
4310
|
+
break;
|
|
4311
|
+
}
|
|
4312
|
+
default: {
|
|
4313
|
+
const definition_2 = statement.fields[0];
|
|
4314
|
+
globalEnvironment = add(definition_2.Name, allocate(definition_2.Name, ResolvedSymbolKind.TypeSymbol, definition_2.Span, undefined), globalEnvironment);
|
|
4315
|
+
const enumerator_7 = getEnumerator(definition_2.Cases);
|
|
4316
|
+
try {
|
|
4317
|
+
while (enumerator_7["System.Collections.IEnumerator.MoveNext"]()) {
|
|
4318
|
+
let table_11;
|
|
4319
|
+
const caseName_2 = enumerator_7["System.Collections.Generic.IEnumerator`1.get_Current"]()[0];
|
|
4320
|
+
const id_5 = allocate(concat(definition_2.Name, ".", caseName_2), ResolvedSymbolKind.UnionCaseSymbol, definition_2.Span, undefined) | 0;
|
|
4321
|
+
globalEnvironment = ((table_11 = add(caseName_2, id_5, globalEnvironment), add(concat(definition_2.Name, ".", caseName_2), id_5, table_11)));
|
|
4322
|
+
}
|
|
4323
|
+
}
|
|
4324
|
+
finally {
|
|
4325
|
+
disposeSafe(enumerator_7);
|
|
4326
|
+
}
|
|
4327
|
+
}
|
|
4328
|
+
}
|
|
4329
|
+
}
|
|
4330
|
+
}
|
|
4331
|
+
finally {
|
|
4332
|
+
disposeSafe(enumerator_6);
|
|
3548
4333
|
}
|
|
3549
|
-
|
|
4334
|
+
const recordReference = (environment, name_9, expression, span_5) => {
|
|
4335
|
+
const option_8 = tryFind(name_9, environment);
|
|
4336
|
+
if (option_8 != null) {
|
|
4337
|
+
const id_6 = option_8 | 0;
|
|
4338
|
+
const symbol_1 = find((symbol) => (symbol.SymbolId === id_6), symbols);
|
|
4339
|
+
void (references.push(new ResolvedSymbolReference(id_6, name_9, symbol_1.Kind, normalizeTypeVariables(defaultArg(tryFind(expression, expressionTypes), Type_1.TUnit)), span_5)));
|
|
4340
|
+
}
|
|
4341
|
+
};
|
|
4342
|
+
const bindPattern = (kind_1, environment_1, pattern) => {
|
|
4343
|
+
const bind = (bindings_2_mut, current_mut, pattern_1_mut) => {
|
|
4344
|
+
bind:
|
|
4345
|
+
while (true) {
|
|
4346
|
+
const bindings_2 = bindings_2_mut, current = current_mut, pattern_1 = pattern_1_mut;
|
|
4347
|
+
let mapping_6, option_10, mapping_8, option_13;
|
|
4348
|
+
switch (pattern_1.tag) {
|
|
4349
|
+
case 1: {
|
|
4350
|
+
const span_6 = pattern_1.fields[1];
|
|
4351
|
+
const name_10 = pattern_1.fields[0];
|
|
4352
|
+
const matchValue_2 = tryFind(name_10, bindings_2);
|
|
4353
|
+
if (matchValue_2 == null) {
|
|
4354
|
+
const id_8 = allocate(name_10, kind_1, span_6, undefined) | 0;
|
|
4355
|
+
void (patternBindingIds.push([span_6, id_8]));
|
|
4356
|
+
return [add(name_10, id_8, bindings_2), add(name_10, id_8, current)];
|
|
4357
|
+
}
|
|
4358
|
+
else {
|
|
4359
|
+
const id_7 = matchValue_2 | 0;
|
|
4360
|
+
void (patternBindingIds.push([span_6, id_7]));
|
|
4361
|
+
return [bindings_2, add(name_10, id_7, current)];
|
|
4362
|
+
}
|
|
4363
|
+
}
|
|
4364
|
+
case 4: {
|
|
4365
|
+
const patternInput_2 = bind(bindings_2, current, pattern_1.fields[0]);
|
|
4366
|
+
bindings_2_mut = patternInput_2[0];
|
|
4367
|
+
current_mut = patternInput_2[1];
|
|
4368
|
+
pattern_1_mut = pattern_1.fields[1];
|
|
4369
|
+
continue bind;
|
|
4370
|
+
}
|
|
4371
|
+
case 5:
|
|
4372
|
+
return fold((tupledArg, item_10) => bind(tupledArg[0], tupledArg[1], item_10), [bindings_2, current], pattern_1.fields[0]);
|
|
4373
|
+
case 6:
|
|
4374
|
+
return fold((tupledArg_1, tupledArg_2) => bind(tupledArg_1[0], tupledArg_1[1], tupledArg_2[1]), [bindings_2, current], pattern_1.fields[0]);
|
|
4375
|
+
case 7: {
|
|
4376
|
+
const patternInput_4 = fold((tupledArg_3, tupledArg_4) => {
|
|
4377
|
+
const patternInput_3 = bind(tupledArg_3[0], tupledArg_3[1], tupledArg_4[0]);
|
|
4378
|
+
return bind(patternInput_3[0], patternInput_3[1], tupledArg_4[1]);
|
|
4379
|
+
}, [bindings_2, current], pattern_1.fields[0]);
|
|
4380
|
+
const current_6 = patternInput_4[1];
|
|
4381
|
+
const bindings_8 = patternInput_4[0];
|
|
4382
|
+
return defaultArg((mapping_6 = curry3(bind)(bindings_8)(current_6), (option_10 = pattern_1.fields[1], (option_10 != null) ? mapping_6(option_10) : undefined)), [bindings_8, current_6]);
|
|
4383
|
+
}
|
|
4384
|
+
case 8: {
|
|
4385
|
+
bindings_2_mut = bindings_2;
|
|
4386
|
+
current_mut = current;
|
|
4387
|
+
pattern_1_mut = pattern_1.fields[0];
|
|
4388
|
+
continue bind;
|
|
4389
|
+
}
|
|
4390
|
+
case 10:
|
|
4391
|
+
return defaultArg((mapping_8 = curry3(bind)(bindings_2)(current), (option_13 = pattern_1.fields[2], (option_13 != null) ? mapping_8(option_13) : undefined)), [bindings_2, current]);
|
|
4392
|
+
default:
|
|
4393
|
+
return [bindings_2, current];
|
|
4394
|
+
}
|
|
4395
|
+
break;
|
|
4396
|
+
}
|
|
4397
|
+
};
|
|
4398
|
+
return bind(empty({
|
|
4399
|
+
Compare: (x_9, y_9) => (comparePrimitives(x_9, y_9) | 0),
|
|
4400
|
+
}), environment_1, pattern)[1];
|
|
4401
|
+
};
|
|
4402
|
+
const visit = (environment_2_mut, expression_1_mut) => {
|
|
4403
|
+
visit:
|
|
4404
|
+
while (true) {
|
|
4405
|
+
const environment_2 = environment_2_mut, expression_1 = expression_1_mut;
|
|
4406
|
+
const visitSame = (item_13) => {
|
|
4407
|
+
visit(environment_2, item_13);
|
|
4408
|
+
};
|
|
4409
|
+
let matchResult_1, name_11, span_8, name_12, span_9, name_13, span_10, body, parameter, argument_2, fn, condition, whenFalse, whenTrue, binding, body_1, name_14, recursive, span_11, binding_1, body_2, pattern_2, bindings_9, body_3, cases_3, target, body_5, name_16, source_1, span_14, items_3, fields_5, entries, fields_6, target_1, fieldName_1, moduleName_1, span_15, target_2, item_14, first, last, parts;
|
|
4410
|
+
switch (expression_1.tag) {
|
|
4411
|
+
case 0:
|
|
4412
|
+
case 1:
|
|
4413
|
+
case 27: {
|
|
4414
|
+
matchResult_1 = 20;
|
|
4415
|
+
break;
|
|
4416
|
+
}
|
|
4417
|
+
case 29: {
|
|
4418
|
+
matchResult_1 = 1;
|
|
4419
|
+
name_12 = expression_1.fields[0];
|
|
4420
|
+
span_9 = expression_1.fields[1];
|
|
4421
|
+
break;
|
|
4422
|
+
}
|
|
4423
|
+
case 28: {
|
|
4424
|
+
matchResult_1 = 2;
|
|
4425
|
+
name_13 = expression_1.fields[0];
|
|
4426
|
+
span_10 = expression_1.fields[1];
|
|
4427
|
+
break;
|
|
4428
|
+
}
|
|
4429
|
+
case 4: {
|
|
4430
|
+
matchResult_1 = 3;
|
|
4431
|
+
body = expression_1.fields[1];
|
|
4432
|
+
parameter = expression_1.fields[0];
|
|
4433
|
+
break;
|
|
4434
|
+
}
|
|
4435
|
+
case 5: {
|
|
4436
|
+
matchResult_1 = 4;
|
|
4437
|
+
argument_2 = expression_1.fields[1];
|
|
4438
|
+
fn = expression_1.fields[0];
|
|
4439
|
+
break;
|
|
4440
|
+
}
|
|
4441
|
+
case 25: {
|
|
4442
|
+
matchResult_1 = 4;
|
|
4443
|
+
argument_2 = expression_1.fields[2];
|
|
4444
|
+
fn = expression_1.fields[1];
|
|
4445
|
+
break;
|
|
4446
|
+
}
|
|
4447
|
+
case 24: {
|
|
4448
|
+
matchResult_1 = 4;
|
|
4449
|
+
argument_2 = expression_1.fields[1];
|
|
4450
|
+
fn = expression_1.fields[0];
|
|
4451
|
+
break;
|
|
4452
|
+
}
|
|
4453
|
+
case 23: {
|
|
4454
|
+
matchResult_1 = 4;
|
|
4455
|
+
argument_2 = expression_1.fields[1];
|
|
4456
|
+
fn = expression_1.fields[0];
|
|
4457
|
+
break;
|
|
4458
|
+
}
|
|
4459
|
+
case 22: {
|
|
4460
|
+
matchResult_1 = 4;
|
|
4461
|
+
argument_2 = expression_1.fields[1];
|
|
4462
|
+
fn = expression_1.fields[0];
|
|
4463
|
+
break;
|
|
4464
|
+
}
|
|
4465
|
+
case 6: {
|
|
4466
|
+
matchResult_1 = 5;
|
|
4467
|
+
condition = expression_1.fields[0];
|
|
4468
|
+
whenFalse = expression_1.fields[2];
|
|
4469
|
+
whenTrue = expression_1.fields[1];
|
|
4470
|
+
break;
|
|
4471
|
+
}
|
|
4472
|
+
case 10: {
|
|
4473
|
+
matchResult_1 = 6;
|
|
4474
|
+
binding = expression_1.fields[1];
|
|
4475
|
+
body_1 = expression_1.fields[2];
|
|
4476
|
+
name_14 = expression_1.fields[0];
|
|
4477
|
+
recursive = expression_1.fields[3];
|
|
4478
|
+
span_11 = expression_1.fields[5];
|
|
4479
|
+
break;
|
|
4480
|
+
}
|
|
4481
|
+
case 11: {
|
|
4482
|
+
matchResult_1 = 7;
|
|
4483
|
+
binding_1 = expression_1.fields[1];
|
|
4484
|
+
body_2 = expression_1.fields[2];
|
|
4485
|
+
pattern_2 = expression_1.fields[0];
|
|
4486
|
+
break;
|
|
4487
|
+
}
|
|
4488
|
+
case 12: {
|
|
4489
|
+
matchResult_1 = 8;
|
|
4490
|
+
bindings_9 = expression_1.fields[0];
|
|
4491
|
+
body_3 = expression_1.fields[1];
|
|
4492
|
+
break;
|
|
4493
|
+
}
|
|
4494
|
+
case 9: {
|
|
4495
|
+
matchResult_1 = 9;
|
|
4496
|
+
cases_3 = expression_1.fields[1];
|
|
4497
|
+
target = expression_1.fields[0];
|
|
4498
|
+
break;
|
|
4499
|
+
}
|
|
4500
|
+
case 8: {
|
|
4501
|
+
matchResult_1 = 10;
|
|
4502
|
+
body_5 = expression_1.fields[2];
|
|
4503
|
+
name_16 = expression_1.fields[0];
|
|
4504
|
+
source_1 = expression_1.fields[1];
|
|
4505
|
+
span_14 = expression_1.fields[3];
|
|
4506
|
+
break;
|
|
4507
|
+
}
|
|
4508
|
+
case 13: {
|
|
4509
|
+
matchResult_1 = 11;
|
|
4510
|
+
items_3 = expression_1.fields[0];
|
|
4511
|
+
break;
|
|
4512
|
+
}
|
|
4513
|
+
case 15: {
|
|
4514
|
+
matchResult_1 = 11;
|
|
4515
|
+
items_3 = expression_1.fields[0];
|
|
4516
|
+
break;
|
|
4517
|
+
}
|
|
4518
|
+
case 16: {
|
|
4519
|
+
matchResult_1 = 12;
|
|
4520
|
+
fields_5 = expression_1.fields[0];
|
|
4521
|
+
break;
|
|
4522
|
+
}
|
|
4523
|
+
case 17: {
|
|
4524
|
+
matchResult_1 = 12;
|
|
4525
|
+
fields_5 = expression_1.fields[0];
|
|
4526
|
+
break;
|
|
4527
|
+
}
|
|
4528
|
+
case 18: {
|
|
4529
|
+
matchResult_1 = 13;
|
|
4530
|
+
entries = expression_1.fields[0];
|
|
4531
|
+
break;
|
|
4532
|
+
}
|
|
4533
|
+
case 19: {
|
|
4534
|
+
matchResult_1 = 14;
|
|
4535
|
+
fields_6 = expression_1.fields[1];
|
|
4536
|
+
target_1 = expression_1.fields[0];
|
|
4537
|
+
break;
|
|
4538
|
+
}
|
|
4539
|
+
case 20: {
|
|
4540
|
+
matchResult_1 = 14;
|
|
4541
|
+
fields_6 = expression_1.fields[1];
|
|
4542
|
+
target_1 = expression_1.fields[0];
|
|
4543
|
+
break;
|
|
4544
|
+
}
|
|
4545
|
+
case 21: {
|
|
4546
|
+
if (expression_1.fields[0].tag === 2) {
|
|
4547
|
+
if (containsKey(concat(expression_1.fields[0].fields[0], ".", expression_1.fields[1]), environment_2)) {
|
|
4548
|
+
matchResult_1 = 15;
|
|
4549
|
+
fieldName_1 = expression_1.fields[1];
|
|
4550
|
+
moduleName_1 = expression_1.fields[0].fields[0];
|
|
4551
|
+
span_15 = expression_1.fields[2];
|
|
4552
|
+
}
|
|
4553
|
+
else {
|
|
4554
|
+
matchResult_1 = 16;
|
|
4555
|
+
target_2 = expression_1.fields[0];
|
|
4556
|
+
}
|
|
4557
|
+
}
|
|
4558
|
+
else {
|
|
4559
|
+
matchResult_1 = 16;
|
|
4560
|
+
target_2 = expression_1.fields[0];
|
|
4561
|
+
}
|
|
4562
|
+
break;
|
|
4563
|
+
}
|
|
4564
|
+
case 26: {
|
|
4565
|
+
matchResult_1 = 17;
|
|
4566
|
+
item_14 = expression_1.fields[0];
|
|
4567
|
+
break;
|
|
4568
|
+
}
|
|
4569
|
+
case 3: {
|
|
4570
|
+
matchResult_1 = 17;
|
|
4571
|
+
item_14 = expression_1.fields[0];
|
|
4572
|
+
break;
|
|
4573
|
+
}
|
|
4574
|
+
case 7: {
|
|
4575
|
+
matchResult_1 = 17;
|
|
4576
|
+
item_14 = expression_1.fields[0];
|
|
4577
|
+
break;
|
|
4578
|
+
}
|
|
4579
|
+
case 14: {
|
|
4580
|
+
matchResult_1 = 18;
|
|
4581
|
+
first = expression_1.fields[0];
|
|
4582
|
+
last = expression_1.fields[1];
|
|
4583
|
+
break;
|
|
4584
|
+
}
|
|
4585
|
+
case 30: {
|
|
4586
|
+
matchResult_1 = 19;
|
|
4587
|
+
parts = expression_1.fields[0];
|
|
4588
|
+
break;
|
|
4589
|
+
}
|
|
4590
|
+
default: {
|
|
4591
|
+
matchResult_1 = 0;
|
|
4592
|
+
name_11 = expression_1.fields[0];
|
|
4593
|
+
span_8 = expression_1.fields[1];
|
|
4594
|
+
}
|
|
4595
|
+
}
|
|
4596
|
+
switch (matchResult_1) {
|
|
4597
|
+
case 0: {
|
|
4598
|
+
recordReference(environment_2, name_11, expression_1, span_8);
|
|
4599
|
+
break;
|
|
4600
|
+
}
|
|
4601
|
+
case 1: {
|
|
4602
|
+
recordReference(environment_2, name_12, expression_1, span_9);
|
|
4603
|
+
break;
|
|
4604
|
+
}
|
|
4605
|
+
case 2: {
|
|
4606
|
+
recordReference(environment_2, name_13, expression_1, span_10);
|
|
4607
|
+
break;
|
|
4608
|
+
}
|
|
4609
|
+
case 3: {
|
|
4610
|
+
environment_2_mut = add(parameter.Name, allocate(parameter.Name, ResolvedSymbolKind.ParameterSymbol, parameter.Span, undefined), environment_2);
|
|
4611
|
+
expression_1_mut = body;
|
|
4612
|
+
continue visit;
|
|
4613
|
+
break;
|
|
4614
|
+
}
|
|
4615
|
+
case 4: {
|
|
4616
|
+
visitSame(fn);
|
|
4617
|
+
visitSame(argument_2);
|
|
4618
|
+
break;
|
|
4619
|
+
}
|
|
4620
|
+
case 5: {
|
|
4621
|
+
visitSame(condition);
|
|
4622
|
+
visitSame(whenTrue);
|
|
4623
|
+
visitSame(whenFalse);
|
|
4624
|
+
break;
|
|
4625
|
+
}
|
|
4626
|
+
case 6: {
|
|
4627
|
+
const id_10 = allocate(name_14, ResolvedSymbolKind.LocalSymbol, span_11, undefined) | 0;
|
|
4628
|
+
visit(recursive ? add(name_14, id_10, environment_2) : environment_2, binding);
|
|
4629
|
+
environment_2_mut = add(name_14, id_10, environment_2);
|
|
4630
|
+
expression_1_mut = body_1;
|
|
4631
|
+
continue visit;
|
|
4632
|
+
break;
|
|
4633
|
+
}
|
|
4634
|
+
case 7: {
|
|
4635
|
+
visitSame(binding_1);
|
|
4636
|
+
environment_2_mut = bindPattern(ResolvedSymbolKind.PatternBindingSymbol, environment_2, pattern_2);
|
|
4637
|
+
expression_1_mut = body_2;
|
|
4638
|
+
continue visit;
|
|
4639
|
+
break;
|
|
4640
|
+
}
|
|
4641
|
+
case 8: {
|
|
4642
|
+
const recursiveEnvironment = fold((env, tupledArg_5) => {
|
|
4643
|
+
const name_15 = tupledArg_5[0];
|
|
4644
|
+
return add(name_15, allocate(name_15, ResolvedSymbolKind.LocalSymbol, tupledArg_5[4], undefined), env);
|
|
4645
|
+
}, environment_2, bindings_9);
|
|
4646
|
+
const enumerator_10 = getEnumerator(bindings_9);
|
|
4647
|
+
try {
|
|
4648
|
+
while (enumerator_10["System.Collections.IEnumerator.MoveNext"]()) {
|
|
4649
|
+
const forLoopVar_7 = enumerator_10["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
4650
|
+
visit(recursiveEnvironment, foldBack((parameter_1, inner) => (new Expr(/* ELambda */ 4, [parameter_1, inner, forLoopVar_7[4]])), forLoopVar_7[1], forLoopVar_7[3]));
|
|
4651
|
+
}
|
|
4652
|
+
}
|
|
4653
|
+
finally {
|
|
4654
|
+
disposeSafe(enumerator_10);
|
|
4655
|
+
}
|
|
4656
|
+
environment_2_mut = recursiveEnvironment;
|
|
4657
|
+
expression_1_mut = body_3;
|
|
4658
|
+
continue visit;
|
|
4659
|
+
break;
|
|
4660
|
+
}
|
|
4661
|
+
case 9: {
|
|
4662
|
+
visitSame(target);
|
|
4663
|
+
const enumerator_11 = getEnumerator(cases_3);
|
|
4664
|
+
try {
|
|
4665
|
+
while (enumerator_11["System.Collections.IEnumerator.MoveNext"]()) {
|
|
4666
|
+
const forLoopVar_8 = enumerator_11["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
4667
|
+
const caseEnvironment = bindPattern(ResolvedSymbolKind.PatternBindingSymbol, environment_2, forLoopVar_8[0]);
|
|
4668
|
+
const action_2 = curry2(visit)(caseEnvironment);
|
|
4669
|
+
const option_15 = forLoopVar_8[1];
|
|
4670
|
+
if (option_15 != null) {
|
|
4671
|
+
action_2(option_15);
|
|
4672
|
+
}
|
|
4673
|
+
visit(caseEnvironment, forLoopVar_8[2]);
|
|
4674
|
+
}
|
|
4675
|
+
}
|
|
4676
|
+
finally {
|
|
4677
|
+
disposeSafe(enumerator_11);
|
|
4678
|
+
}
|
|
4679
|
+
break;
|
|
4680
|
+
}
|
|
4681
|
+
case 10: {
|
|
4682
|
+
visitSame(source_1);
|
|
4683
|
+
environment_2_mut = add(name_16, allocate(name_16, ResolvedSymbolKind.LocalSymbol, span_14, undefined), environment_2);
|
|
4684
|
+
expression_1_mut = body_5;
|
|
4685
|
+
continue visit;
|
|
4686
|
+
break;
|
|
4687
|
+
}
|
|
4688
|
+
case 11: {
|
|
4689
|
+
iterate(visitSame, items_3);
|
|
4690
|
+
break;
|
|
4691
|
+
}
|
|
4692
|
+
case 12: {
|
|
4693
|
+
iterate((arg) => {
|
|
4694
|
+
visitSame(arg[1]);
|
|
4695
|
+
}, fields_5);
|
|
4696
|
+
break;
|
|
4697
|
+
}
|
|
4698
|
+
case 13: {
|
|
4699
|
+
iterate((_arg_14) => {
|
|
4700
|
+
if (_arg_14.tag === 1) {
|
|
4701
|
+
visitSame(_arg_14.fields[0]);
|
|
4702
|
+
}
|
|
4703
|
+
else {
|
|
4704
|
+
visitSame(_arg_14.fields[0]);
|
|
4705
|
+
visitSame(_arg_14.fields[1]);
|
|
4706
|
+
}
|
|
4707
|
+
}, entries);
|
|
4708
|
+
break;
|
|
4709
|
+
}
|
|
4710
|
+
case 14: {
|
|
4711
|
+
visitSame(target_1);
|
|
4712
|
+
iterate((arg_1) => {
|
|
4713
|
+
visitSame(arg_1[1]);
|
|
4714
|
+
}, fields_6);
|
|
4715
|
+
break;
|
|
4716
|
+
}
|
|
4717
|
+
case 15: {
|
|
4718
|
+
recordReference(environment_2, concat(moduleName_1, ".", fieldName_1), expression_1, span_15);
|
|
4719
|
+
break;
|
|
4720
|
+
}
|
|
4721
|
+
case 16: {
|
|
4722
|
+
visitSame(target_2);
|
|
4723
|
+
break;
|
|
4724
|
+
}
|
|
4725
|
+
case 17: {
|
|
4726
|
+
visitSame(item_14);
|
|
4727
|
+
break;
|
|
4728
|
+
}
|
|
4729
|
+
case 18: {
|
|
4730
|
+
visitSame(first);
|
|
4731
|
+
visitSame(last);
|
|
4732
|
+
break;
|
|
4733
|
+
}
|
|
4734
|
+
case 19: {
|
|
4735
|
+
iterate((_arg_15) => {
|
|
4736
|
+
if (_arg_15.tag === 1) {
|
|
4737
|
+
visitSame(_arg_15.fields[0]);
|
|
4738
|
+
}
|
|
4739
|
+
}, parts);
|
|
4740
|
+
break;
|
|
4741
|
+
}
|
|
4742
|
+
case 20: {
|
|
4743
|
+
break;
|
|
4744
|
+
}
|
|
4745
|
+
}
|
|
4746
|
+
break;
|
|
4747
|
+
}
|
|
4748
|
+
};
|
|
4749
|
+
const allocated = (kind_2, name_17, span_16) => (find((symbol_2) => {
|
|
4750
|
+
if (equals(symbol_2.Kind, kind_2) && (symbol_2.Name === name_17)) {
|
|
4751
|
+
return equals(symbol_2.Span, span_16);
|
|
4752
|
+
}
|
|
4753
|
+
else {
|
|
4754
|
+
return false;
|
|
4755
|
+
}
|
|
4756
|
+
}, symbols).SymbolId | 0);
|
|
4757
|
+
let resolutionEnvironment = builtinEnvironment;
|
|
4758
|
+
const enumerator_12 = getEnumerator(typed);
|
|
4759
|
+
try {
|
|
4760
|
+
while (enumerator_12["System.Collections.IEnumerator.MoveNext"]()) {
|
|
4761
|
+
const statement_1 = enumerator_12["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
4762
|
+
switch (statement_1.tag) {
|
|
4763
|
+
case 1: {
|
|
4764
|
+
const name_18 = statement_1.fields[0];
|
|
4765
|
+
const id_13 = allocated(ResolvedSymbolKind.DeclarationSymbol, name_18, statement_1.fields[5]) | 0;
|
|
4766
|
+
visit(statement_1.fields[3] ? add(name_18, id_13, resolutionEnvironment) : resolutionEnvironment, statement_1.fields[1]);
|
|
4767
|
+
resolutionEnvironment = add(name_18, id_13, resolutionEnvironment);
|
|
4768
|
+
break;
|
|
4769
|
+
}
|
|
4770
|
+
case 2: {
|
|
4771
|
+
visit(resolutionEnvironment, statement_1.fields[1]);
|
|
4772
|
+
bindPattern(ResolvedSymbolKind.PatternBindingSymbol, resolutionEnvironment, statement_1.fields[0]);
|
|
4773
|
+
const enumerator_14 = getEnumerator(toList(statement_1.fields[2]));
|
|
4774
|
+
try {
|
|
4775
|
+
while (enumerator_14["System.Collections.IEnumerator.MoveNext"]()) {
|
|
4776
|
+
const name_19 = enumerator_14["System.Collections.Generic.IEnumerator`1.get_Current"]()[0];
|
|
4777
|
+
resolutionEnvironment = add(name_19, allocated(ResolvedSymbolKind.DeclarationSymbol, name_19, statement_1.fields[4]), resolutionEnvironment);
|
|
4778
|
+
}
|
|
4779
|
+
}
|
|
4780
|
+
finally {
|
|
4781
|
+
disposeSafe(enumerator_14);
|
|
4782
|
+
}
|
|
4783
|
+
break;
|
|
4784
|
+
}
|
|
4785
|
+
case 3: {
|
|
4786
|
+
const bindings_11 = statement_1.fields[0];
|
|
4787
|
+
const recursiveEnvironment_1 = fold((environment_3, tupledArg_6) => {
|
|
4788
|
+
const name_20 = tupledArg_6[0];
|
|
4789
|
+
return add(name_20, allocated(ResolvedSymbolKind.DeclarationSymbol, name_20, tupledArg_6[3]), environment_3);
|
|
4790
|
+
}, resolutionEnvironment, bindings_11);
|
|
4791
|
+
iterate((tupledArg_7) => {
|
|
4792
|
+
visit(recursiveEnvironment_1, tupledArg_7[1]);
|
|
4793
|
+
}, bindings_11);
|
|
4794
|
+
resolutionEnvironment = recursiveEnvironment_1;
|
|
4795
|
+
break;
|
|
4796
|
+
}
|
|
4797
|
+
case 5: {
|
|
4798
|
+
visit(resolutionEnvironment, statement_1.fields[0].Expr);
|
|
4799
|
+
break;
|
|
4800
|
+
}
|
|
4801
|
+
case 4: {
|
|
4802
|
+
const name_21 = statement_1.fields[0];
|
|
4803
|
+
resolutionEnvironment = add(name_21, allocated(ResolvedSymbolKind.DeclarationSymbol, name_21, statement_1.fields[3]), resolutionEnvironment);
|
|
4804
|
+
break;
|
|
4805
|
+
}
|
|
4806
|
+
default: {
|
|
4807
|
+
const definition_3 = statement_1.fields[0];
|
|
4808
|
+
resolutionEnvironment = add(definition_3.Name, allocated(ResolvedSymbolKind.TypeSymbol, definition_3.Name, definition_3.Span), resolutionEnvironment);
|
|
4809
|
+
const enumerator_13 = getEnumerator(definition_3.Cases);
|
|
4810
|
+
try {
|
|
4811
|
+
while (enumerator_13["System.Collections.IEnumerator.MoveNext"]()) {
|
|
4812
|
+
let table_16;
|
|
4813
|
+
const caseName_3 = enumerator_13["System.Collections.Generic.IEnumerator`1.get_Current"]()[0];
|
|
4814
|
+
const id_12 = allocated(ResolvedSymbolKind.UnionCaseSymbol, concat(definition_3.Name, ".", caseName_3), definition_3.Span) | 0;
|
|
4815
|
+
resolutionEnvironment = ((table_16 = add(caseName_3, id_12, resolutionEnvironment), add(concat(definition_3.Name, ".", caseName_3), id_12, table_16)));
|
|
4816
|
+
}
|
|
4817
|
+
}
|
|
4818
|
+
finally {
|
|
4819
|
+
disposeSafe(enumerator_13);
|
|
4820
|
+
}
|
|
4821
|
+
}
|
|
4822
|
+
}
|
|
4823
|
+
}
|
|
4824
|
+
}
|
|
4825
|
+
finally {
|
|
4826
|
+
disposeSafe(enumerator_12);
|
|
4827
|
+
}
|
|
4828
|
+
const resolvedReferences = toList_1(references);
|
|
4829
|
+
let remainingReferenceOccurrences = resolvedReferences;
|
|
4830
|
+
const finalType = (expression_6) => normalizeTypeVariables(defaultArg(tryFind(expression_6, expressionTypes), Type_1.TUnit));
|
|
4831
|
+
const declarations = ofList(append(map_1((definition_4) => [definition_4.Name, definition_4], typeDefs_2), choose((_arg_22) => {
|
|
4832
|
+
if (_arg_22.tag === 0) {
|
|
4833
|
+
const definition_5 = _arg_22.fields[0];
|
|
4834
|
+
return [definition_5.Name, definition_5];
|
|
4835
|
+
}
|
|
4836
|
+
else {
|
|
4837
|
+
return undefined;
|
|
4838
|
+
}
|
|
4839
|
+
}, typed)), {
|
|
4840
|
+
Compare: (x_10, y_10) => (comparePrimitives(x_10, y_10) | 0),
|
|
4841
|
+
});
|
|
4842
|
+
const resolvedTypeDefinitions = fold_1((state_5, name_23, definition_7) => add(name_23, definition_7, state_5), map((name_22, definition_6) => {
|
|
4843
|
+
if (isEmpty_1(definition_6.Cases)) {
|
|
4844
|
+
return new Type_1(/* TRecord */ 8, [ofList(map_1((tupledArg_8) => [tupledArg_8[0], typeFromRef(declarations, singleton(name_22), tupledArg_8[1])], definition_6.Fields), {
|
|
4845
|
+
Compare: (x_11, y_11) => (comparePrimitives(x_11, y_11) | 0),
|
|
4846
|
+
})]);
|
|
4847
|
+
}
|
|
4848
|
+
else {
|
|
4849
|
+
return new Type_1(/* TUnion */ 13, [name_22, ofList(map_1((tupledArg_9) => {
|
|
4850
|
+
let option_17;
|
|
4851
|
+
return [tupledArg_9[0], (option_17 = tupledArg_9[1], (option_17 != null) ? typeFromRef(declarations, singleton(name_22), option_17) : undefined)];
|
|
4852
|
+
}, definition_6.Cases), {
|
|
4853
|
+
Compare: (x_12, y_12) => (comparePrimitives(x_12, y_12) | 0),
|
|
4854
|
+
})]);
|
|
4855
|
+
}
|
|
4856
|
+
}, declarations), hostDefinitions);
|
|
4857
|
+
const resolvedLiteral = (_arg_23) => {
|
|
4858
|
+
switch (_arg_23.tag) {
|
|
4859
|
+
case 1:
|
|
4860
|
+
return new ResolvedLiteral(/* ResolvedFloat */ 2, [_arg_23.fields[0]]);
|
|
4861
|
+
case 2:
|
|
4862
|
+
return new ResolvedLiteral(/* ResolvedBool */ 3, [_arg_23.fields[0]]);
|
|
4863
|
+
case 3:
|
|
4864
|
+
return new ResolvedLiteral(/* ResolvedString */ 4, [_arg_23.fields[0]]);
|
|
4865
|
+
default:
|
|
4866
|
+
return new ResolvedLiteral(/* ResolvedInt */ 1, [_arg_23.fields[0]]);
|
|
4867
|
+
}
|
|
4868
|
+
};
|
|
4869
|
+
const symbolAt = (kind_3, name_24, span_21) => find((symbol_3) => {
|
|
4870
|
+
if (equals(symbol_3.Kind, kind_3) && (symbol_3.Name === name_24)) {
|
|
4871
|
+
return equals(symbol_3.Span, span_21);
|
|
4872
|
+
}
|
|
4873
|
+
else {
|
|
4874
|
+
return false;
|
|
4875
|
+
}
|
|
4876
|
+
}, symbols);
|
|
4877
|
+
const bindingAt = (kind_4, name_25, span_22, bindingType) => {
|
|
4878
|
+
let option_21, option_19;
|
|
4879
|
+
return new ResolvedBinding(equals(kind_4, ResolvedSymbolKind.PatternBindingSymbol) ? ((option_21 = ((option_19 = tryFind_2((arg_2) => equals(span_22, arg_2[0]), patternBindingIds), (option_19 != null) ? option_19[1] : undefined)), (option_21 != null) ? option_21 : symbolAt(kind_4, name_25, span_22).SymbolId)) : symbolAt(kind_4, name_25, span_22).SymbolId, name_25, bindingType, span_22);
|
|
4880
|
+
};
|
|
4881
|
+
const resolvePattern = (expected, pattern_5) => {
|
|
4882
|
+
let mapping_19, option_24, mapping_20, option_31;
|
|
4883
|
+
const span_24 = Ast_spanOfPattern(pattern_5);
|
|
4884
|
+
const make = (node) => (new ResolvedPattern(expected, span_24, node));
|
|
4885
|
+
switch (pattern_5.tag) {
|
|
4886
|
+
case 1:
|
|
4887
|
+
return make(new ResolvedPatternNode(/* ResolvedPatternBinding */ 1, [bindingAt(ResolvedSymbolKind.PatternBindingSymbol, pattern_5.fields[0], span_24, expected)]));
|
|
4888
|
+
case 2:
|
|
4889
|
+
return make(new ResolvedPatternNode(/* ResolvedLiteralPattern */ 2, [resolvedLiteral(pattern_5.fields[0])]));
|
|
4890
|
+
case 3:
|
|
4891
|
+
return make(ResolvedPatternNode.ResolvedEmptyList);
|
|
4892
|
+
case 4:
|
|
4893
|
+
return make(new ResolvedPatternNode(/* ResolvedConsPattern */ 4, [resolvePattern((expected.tag === 5) ? expected.fields[0] : Types_freshVar(), pattern_5.fields[0]), resolvePattern(expected, pattern_5.fields[1])]));
|
|
4894
|
+
case 5: {
|
|
4895
|
+
const items_4 = pattern_5.fields[0];
|
|
4896
|
+
return make(new ResolvedPatternNode(/* ResolvedTuplePattern */ 5, [map2(resolvePattern, (expected.tag === 7) ? ((length(expected.fields[0]) === length(items_4)) ? expected.fields[0] : replicate(length(items_4), Types_freshVar())) : replicate(length(items_4), Types_freshVar()), items_4)]));
|
|
4897
|
+
}
|
|
4898
|
+
case 6: {
|
|
4899
|
+
let fieldTypes;
|
|
4900
|
+
let matchResult_2, values;
|
|
4901
|
+
switch (expected.tag) {
|
|
4902
|
+
case 8: {
|
|
4903
|
+
matchResult_2 = 0;
|
|
4904
|
+
values = expected.fields[0];
|
|
4905
|
+
break;
|
|
4906
|
+
}
|
|
4907
|
+
case 17: {
|
|
4908
|
+
matchResult_2 = 0;
|
|
4909
|
+
values = expected.fields[1];
|
|
4910
|
+
break;
|
|
4911
|
+
}
|
|
4912
|
+
case 12: {
|
|
4913
|
+
matchResult_2 = 1;
|
|
4914
|
+
break;
|
|
4915
|
+
}
|
|
4916
|
+
default:
|
|
4917
|
+
matchResult_2 = 2;
|
|
4918
|
+
}
|
|
4919
|
+
switch (matchResult_2) {
|
|
4920
|
+
case 0: {
|
|
4921
|
+
fieldTypes = values;
|
|
4922
|
+
break;
|
|
4923
|
+
}
|
|
4924
|
+
case 1: {
|
|
4925
|
+
const matchValue_3 = tryFind(expected.fields[0], resolvedTypeDefinitions);
|
|
4926
|
+
let matchResult_3, values_1;
|
|
4927
|
+
if (matchValue_3 != null) {
|
|
4928
|
+
switch (matchValue_3.tag) {
|
|
4929
|
+
case 8: {
|
|
4930
|
+
matchResult_3 = 0;
|
|
4931
|
+
values_1 = matchValue_3.fields[0];
|
|
4932
|
+
break;
|
|
4933
|
+
}
|
|
4934
|
+
case 17: {
|
|
4935
|
+
matchResult_3 = 0;
|
|
4936
|
+
values_1 = matchValue_3.fields[1];
|
|
4937
|
+
break;
|
|
4938
|
+
}
|
|
4939
|
+
default:
|
|
4940
|
+
matchResult_3 = 1;
|
|
4941
|
+
}
|
|
4942
|
+
}
|
|
4943
|
+
else {
|
|
4944
|
+
matchResult_3 = 1;
|
|
4945
|
+
}
|
|
4946
|
+
switch (matchResult_3) {
|
|
4947
|
+
case 0: {
|
|
4948
|
+
fieldTypes = values_1;
|
|
4949
|
+
break;
|
|
4950
|
+
}
|
|
4951
|
+
default:
|
|
4952
|
+
fieldTypes = empty({
|
|
4953
|
+
Compare: (x_14, y_15) => (comparePrimitives(x_14, y_15) | 0),
|
|
4954
|
+
});
|
|
4955
|
+
}
|
|
4956
|
+
break;
|
|
4957
|
+
}
|
|
4958
|
+
default:
|
|
4959
|
+
fieldTypes = empty({
|
|
4960
|
+
Compare: (x_15, y_16) => (comparePrimitives(x_15, y_16) | 0),
|
|
4961
|
+
});
|
|
4962
|
+
}
|
|
4963
|
+
return make(new ResolvedPatternNode(/* ResolvedRecordPattern */ 6, [map_1((tupledArg_10) => {
|
|
4964
|
+
const name_29 = tupledArg_10[0];
|
|
4965
|
+
return [name_29, resolvePattern(defaultArg(tryFind(name_29, fieldTypes), Types_freshVar()), tupledArg_10[1])];
|
|
4966
|
+
}, pattern_5.fields[0])]));
|
|
4967
|
+
}
|
|
4968
|
+
case 7: {
|
|
4969
|
+
const patternInput_5 = (expected.tag === 9) ? [expected.fields[0], expected.fields[1]] : [Types_freshVar(), Types_freshVar()];
|
|
4970
|
+
return make(new ResolvedPatternNode(/* ResolvedMapPattern */ 7, [map_1((tupledArg_11) => [resolvePattern(patternInput_5[0], tupledArg_11[0]), resolvePattern(patternInput_5[1], tupledArg_11[1])], pattern_5.fields[0]), (mapping_19 = curry2(resolvePattern)(expected), (option_24 = pattern_5.fields[1], (option_24 != null) ? mapping_19(option_24) : undefined))]));
|
|
4971
|
+
}
|
|
4972
|
+
case 8:
|
|
4973
|
+
return make(new ResolvedPatternNode(/* ResolvedSomePattern */ 8, [resolvePattern((expected.tag === 10) ? expected.fields[0] : Types_freshVar(), pattern_5.fields[0])]));
|
|
4974
|
+
case 9:
|
|
4975
|
+
return make(ResolvedPatternNode.ResolvedNonePattern);
|
|
4976
|
+
case 10: {
|
|
4977
|
+
const qualifier = pattern_5.fields[0];
|
|
4978
|
+
const caseName_5 = pattern_5.fields[1];
|
|
4979
|
+
let patternInput_6;
|
|
4980
|
+
switch (expected.tag) {
|
|
4981
|
+
case 12: {
|
|
4982
|
+
const name_30 = expected.fields[0];
|
|
4983
|
+
const matchValue_4 = tryFind(name_30, resolvedTypeDefinitions);
|
|
4984
|
+
let matchResult_4, cases_5;
|
|
4985
|
+
if (matchValue_4 != null) {
|
|
4986
|
+
if (matchValue_4.tag === 13) {
|
|
4987
|
+
matchResult_4 = 0;
|
|
4988
|
+
cases_5 = matchValue_4.fields[1];
|
|
4989
|
+
}
|
|
4990
|
+
else {
|
|
4991
|
+
matchResult_4 = 1;
|
|
4992
|
+
}
|
|
4993
|
+
}
|
|
4994
|
+
else {
|
|
4995
|
+
matchResult_4 = 1;
|
|
4996
|
+
}
|
|
4997
|
+
switch (matchResult_4) {
|
|
4998
|
+
case 0: {
|
|
4999
|
+
patternInput_6 = [name_30, flatten(tryFind(caseName_5, cases_5))];
|
|
5000
|
+
break;
|
|
5001
|
+
}
|
|
5002
|
+
default:
|
|
5003
|
+
patternInput_6 = [defaultArg(qualifier, name_30), undefined];
|
|
5004
|
+
}
|
|
5005
|
+
break;
|
|
5006
|
+
}
|
|
5007
|
+
case 13: {
|
|
5008
|
+
patternInput_6 = [expected.fields[0], flatten(tryFind(caseName_5, expected.fields[1]))];
|
|
5009
|
+
break;
|
|
5010
|
+
}
|
|
5011
|
+
default:
|
|
5012
|
+
patternInput_6 = defaultArg(tryPick((tupledArg_12) => {
|
|
5013
|
+
const definition_8 = tupledArg_12[1];
|
|
5014
|
+
let matchResult_5, cases_8;
|
|
5015
|
+
if (definition_8.tag === 13) {
|
|
5016
|
+
if (containsKey(caseName_5, definition_8.fields[1])) {
|
|
5017
|
+
matchResult_5 = 0;
|
|
5018
|
+
cases_8 = definition_8.fields[1];
|
|
5019
|
+
}
|
|
5020
|
+
else {
|
|
5021
|
+
matchResult_5 = 1;
|
|
5022
|
+
}
|
|
5023
|
+
}
|
|
5024
|
+
else {
|
|
5025
|
+
matchResult_5 = 1;
|
|
5026
|
+
}
|
|
5027
|
+
switch (matchResult_5) {
|
|
5028
|
+
case 0:
|
|
5029
|
+
return [tupledArg_12[0], FSharpMap__get_Item(cases_8, caseName_5)];
|
|
5030
|
+
default:
|
|
5031
|
+
return undefined;
|
|
5032
|
+
}
|
|
5033
|
+
}, toSeq(resolvedTypeDefinitions)), [defaultArg(qualifier, ""), undefined]);
|
|
5034
|
+
}
|
|
5035
|
+
return make(new ResolvedPatternNode(/* ResolvedUnionPattern */ 10, [patternInput_6[0], caseName_5, (mapping_20 = curry2(resolvePattern)(defaultArg(patternInput_6[1], Types_freshVar())), (option_31 = pattern_5.fields[2], (option_31 != null) ? mapping_20(option_31) : undefined))]));
|
|
5036
|
+
}
|
|
5037
|
+
case 11:
|
|
5038
|
+
return make(new ResolvedPatternNode(/* ResolvedTypePattern */ 11, [annotationTypeFromRef(resolvedTypeDefinitions, span_24, pattern_5.fields[0])]));
|
|
5039
|
+
default:
|
|
5040
|
+
return make(ResolvedPatternNode.ResolvedWildcard);
|
|
5041
|
+
}
|
|
5042
|
+
};
|
|
5043
|
+
const resolveExpression = (expression_8) => {
|
|
5044
|
+
let matchValue_6;
|
|
5045
|
+
const expressionType = finalType(expression_8);
|
|
5046
|
+
let reference;
|
|
5047
|
+
const expression_7 = expression_8;
|
|
5048
|
+
const span_23 = Ast_spanOfExpr(expression_7);
|
|
5049
|
+
const expectedName = (expression_7.tag === 2) ? expression_7.fields[0] : ((expression_7.tag === 29) ? expression_7.fields[0] : ((expression_7.tag === 28) ? expression_7.fields[0] : ((expression_7.tag === 21) ? ((expression_7.fields[0].tag === 2) ? concat(expression_7.fields[0].fields[0], ".", expression_7.fields[1]) : undefined) : undefined)));
|
|
5050
|
+
const consume = (preceding_mut, _arg_24_mut) => {
|
|
5051
|
+
consume:
|
|
5052
|
+
while (true) {
|
|
5053
|
+
const preceding = preceding_mut, _arg_24 = _arg_24_mut;
|
|
5054
|
+
let item_16;
|
|
5055
|
+
if (!isEmpty_1(_arg_24)) {
|
|
5056
|
+
if ((item_16 = head_4(_arg_24), equals(item_16.Span, span_23) && forAll_1((y_14) => (item_16.Name === y_14), toArray(expectedName)))) {
|
|
5057
|
+
remainingReferenceOccurrences = append(reverse(preceding), tail_9(_arg_24));
|
|
5058
|
+
return head_4(_arg_24);
|
|
5059
|
+
}
|
|
5060
|
+
else {
|
|
5061
|
+
preceding_mut = cons(head_4(_arg_24), preceding);
|
|
5062
|
+
_arg_24_mut = tail_9(_arg_24);
|
|
5063
|
+
continue consume;
|
|
5064
|
+
}
|
|
5065
|
+
}
|
|
5066
|
+
else {
|
|
5067
|
+
return undefined;
|
|
5068
|
+
}
|
|
5069
|
+
break;
|
|
5070
|
+
}
|
|
5071
|
+
};
|
|
5072
|
+
reference = consume(empty_2(), remainingReferenceOccurrences);
|
|
5073
|
+
let primitive;
|
|
5074
|
+
if (expression_8.tag === 25) {
|
|
5075
|
+
const op = expression_8.fields[0];
|
|
5076
|
+
let matchResult_6;
|
|
5077
|
+
switch (op) {
|
|
5078
|
+
case "=": {
|
|
5079
|
+
matchResult_6 = 13;
|
|
5080
|
+
break;
|
|
5081
|
+
}
|
|
5082
|
+
case "<":
|
|
5083
|
+
case ">":
|
|
5084
|
+
case "<=":
|
|
5085
|
+
case ">=": {
|
|
5086
|
+
matchResult_6 = 14;
|
|
5087
|
+
break;
|
|
5088
|
+
}
|
|
5089
|
+
case "&&":
|
|
5090
|
+
case "||": {
|
|
5091
|
+
matchResult_6 = 15;
|
|
5092
|
+
break;
|
|
5093
|
+
}
|
|
5094
|
+
case "+": {
|
|
5095
|
+
switch (expressionType.tag) {
|
|
5096
|
+
case 2: {
|
|
5097
|
+
matchResult_6 = 0;
|
|
5098
|
+
break;
|
|
5099
|
+
}
|
|
5100
|
+
case 1: {
|
|
5101
|
+
matchResult_6 = 1;
|
|
5102
|
+
break;
|
|
5103
|
+
}
|
|
5104
|
+
default:
|
|
5105
|
+
matchResult_6 = 2;
|
|
5106
|
+
}
|
|
5107
|
+
break;
|
|
5108
|
+
}
|
|
5109
|
+
case "-": {
|
|
5110
|
+
switch (expressionType.tag) {
|
|
5111
|
+
case 2: {
|
|
5112
|
+
matchResult_6 = 3;
|
|
5113
|
+
break;
|
|
5114
|
+
}
|
|
5115
|
+
case 1: {
|
|
5116
|
+
matchResult_6 = 4;
|
|
5117
|
+
break;
|
|
5118
|
+
}
|
|
5119
|
+
default:
|
|
5120
|
+
matchResult_6 = 5;
|
|
5121
|
+
}
|
|
5122
|
+
break;
|
|
5123
|
+
}
|
|
5124
|
+
case "*": {
|
|
5125
|
+
switch (expressionType.tag) {
|
|
5126
|
+
case 2: {
|
|
5127
|
+
matchResult_6 = 6;
|
|
5128
|
+
break;
|
|
5129
|
+
}
|
|
5130
|
+
case 1: {
|
|
5131
|
+
matchResult_6 = 7;
|
|
5132
|
+
break;
|
|
5133
|
+
}
|
|
5134
|
+
default:
|
|
5135
|
+
matchResult_6 = 8;
|
|
5136
|
+
}
|
|
5137
|
+
break;
|
|
5138
|
+
}
|
|
5139
|
+
case "/": {
|
|
5140
|
+
switch (expressionType.tag) {
|
|
5141
|
+
case 2: {
|
|
5142
|
+
matchResult_6 = 9;
|
|
5143
|
+
break;
|
|
5144
|
+
}
|
|
5145
|
+
case 1: {
|
|
5146
|
+
matchResult_6 = 10;
|
|
5147
|
+
break;
|
|
5148
|
+
}
|
|
5149
|
+
default:
|
|
5150
|
+
matchResult_6 = 11;
|
|
5151
|
+
}
|
|
5152
|
+
break;
|
|
5153
|
+
}
|
|
5154
|
+
case "%": {
|
|
5155
|
+
if (expressionType.tag === 1) {
|
|
5156
|
+
matchResult_6 = 12;
|
|
5157
|
+
}
|
|
5158
|
+
else {
|
|
5159
|
+
matchResult_6 = 16;
|
|
5160
|
+
}
|
|
5161
|
+
break;
|
|
5162
|
+
}
|
|
5163
|
+
default:
|
|
5164
|
+
matchResult_6 = 16;
|
|
5165
|
+
}
|
|
5166
|
+
switch (matchResult_6) {
|
|
5167
|
+
case 0: {
|
|
5168
|
+
primitive = ResolvedPrimitiveOperation.FloatingAddition;
|
|
5169
|
+
break;
|
|
5170
|
+
}
|
|
5171
|
+
case 1: {
|
|
5172
|
+
primitive = ResolvedPrimitiveOperation.IntegerAddition;
|
|
5173
|
+
break;
|
|
5174
|
+
}
|
|
5175
|
+
case 2: {
|
|
5176
|
+
primitive = ResolvedPrimitiveOperation.NumericAddition;
|
|
5177
|
+
break;
|
|
5178
|
+
}
|
|
5179
|
+
case 3: {
|
|
5180
|
+
primitive = ResolvedPrimitiveOperation.FloatingSubtraction;
|
|
5181
|
+
break;
|
|
5182
|
+
}
|
|
5183
|
+
case 4: {
|
|
5184
|
+
primitive = ResolvedPrimitiveOperation.IntegerSubtraction;
|
|
5185
|
+
break;
|
|
5186
|
+
}
|
|
5187
|
+
case 5: {
|
|
5188
|
+
primitive = ResolvedPrimitiveOperation.NumericSubtraction;
|
|
5189
|
+
break;
|
|
5190
|
+
}
|
|
5191
|
+
case 6: {
|
|
5192
|
+
primitive = ResolvedPrimitiveOperation.FloatingMultiplication;
|
|
5193
|
+
break;
|
|
5194
|
+
}
|
|
5195
|
+
case 7: {
|
|
5196
|
+
primitive = ResolvedPrimitiveOperation.IntegerMultiplication;
|
|
5197
|
+
break;
|
|
5198
|
+
}
|
|
5199
|
+
case 8: {
|
|
5200
|
+
primitive = ResolvedPrimitiveOperation.NumericMultiplication;
|
|
5201
|
+
break;
|
|
5202
|
+
}
|
|
5203
|
+
case 9: {
|
|
5204
|
+
primitive = ResolvedPrimitiveOperation.FloatingDivision;
|
|
5205
|
+
break;
|
|
5206
|
+
}
|
|
5207
|
+
case 10: {
|
|
5208
|
+
primitive = ResolvedPrimitiveOperation.IntegerDivision;
|
|
5209
|
+
break;
|
|
5210
|
+
}
|
|
5211
|
+
case 11: {
|
|
5212
|
+
primitive = ResolvedPrimitiveOperation.NumericDivision;
|
|
5213
|
+
break;
|
|
5214
|
+
}
|
|
5215
|
+
case 12: {
|
|
5216
|
+
primitive = ResolvedPrimitiveOperation.IntegerRemainder;
|
|
5217
|
+
break;
|
|
5218
|
+
}
|
|
5219
|
+
case 13: {
|
|
5220
|
+
primitive = ResolvedPrimitiveOperation.StructuralEquality;
|
|
5221
|
+
break;
|
|
5222
|
+
}
|
|
5223
|
+
case 14: {
|
|
5224
|
+
primitive = (new ResolvedPrimitiveOperation(/* NumericComparison */ 14, [op]));
|
|
5225
|
+
break;
|
|
5226
|
+
}
|
|
5227
|
+
case 15: {
|
|
5228
|
+
primitive = (new ResolvedPrimitiveOperation(/* BooleanOperation */ 15, [op]));
|
|
5229
|
+
break;
|
|
5230
|
+
}
|
|
5231
|
+
default:
|
|
5232
|
+
primitive = undefined;
|
|
5233
|
+
}
|
|
5234
|
+
}
|
|
5235
|
+
else {
|
|
5236
|
+
primitive = undefined;
|
|
5237
|
+
}
|
|
5238
|
+
let node_1;
|
|
5239
|
+
let matchResult_7, value_26, inner_1, body_6, parameter_2, argument_4, fn_1, condition_1, whenFalse_1, whenTrue_1, left_1, right, head_2, tail_7, left_2, right_1, left_3, right_2, head_3, tail_8, items_5, items_6, fields_8, name_34, target_3, item_23, body_7, name_35, recursive_2, span_25, value_28, body_8, pattern_6, value_29, bindings_12, body_9, value_31, body_10, name_37, source_7, span_27, cases_9, target_4, first_1, last_1, fields_9, target_5, fields_10, target_6, index_1, target_7, name_40, name_41, parts_1, entries_1;
|
|
5240
|
+
switch (expression_8.tag) {
|
|
5241
|
+
case 1: {
|
|
5242
|
+
matchResult_7 = 1;
|
|
5243
|
+
value_26 = expression_8.fields[0];
|
|
5244
|
+
break;
|
|
5245
|
+
}
|
|
5246
|
+
case 2: {
|
|
5247
|
+
matchResult_7 = 2;
|
|
5248
|
+
break;
|
|
5249
|
+
}
|
|
5250
|
+
case 3: {
|
|
5251
|
+
matchResult_7 = 3;
|
|
5252
|
+
inner_1 = expression_8.fields[0];
|
|
5253
|
+
break;
|
|
5254
|
+
}
|
|
5255
|
+
case 4: {
|
|
5256
|
+
matchResult_7 = 4;
|
|
5257
|
+
body_6 = expression_8.fields[1];
|
|
5258
|
+
parameter_2 = expression_8.fields[0];
|
|
5259
|
+
break;
|
|
5260
|
+
}
|
|
5261
|
+
case 5: {
|
|
5262
|
+
matchResult_7 = 5;
|
|
5263
|
+
argument_4 = expression_8.fields[1];
|
|
5264
|
+
fn_1 = expression_8.fields[0];
|
|
5265
|
+
break;
|
|
5266
|
+
}
|
|
5267
|
+
case 6: {
|
|
5268
|
+
matchResult_7 = 6;
|
|
5269
|
+
condition_1 = expression_8.fields[0];
|
|
5270
|
+
whenFalse_1 = expression_8.fields[2];
|
|
5271
|
+
whenTrue_1 = expression_8.fields[1];
|
|
5272
|
+
break;
|
|
5273
|
+
}
|
|
5274
|
+
case 25: {
|
|
5275
|
+
switch (expression_8.fields[0]) {
|
|
5276
|
+
case "|>": {
|
|
5277
|
+
matchResult_7 = 7;
|
|
5278
|
+
left_1 = expression_8.fields[1];
|
|
5279
|
+
right = expression_8.fields[2];
|
|
5280
|
+
break;
|
|
5281
|
+
}
|
|
5282
|
+
case "::": {
|
|
5283
|
+
matchResult_7 = 8;
|
|
5284
|
+
head_2 = expression_8.fields[1];
|
|
5285
|
+
tail_7 = expression_8.fields[2];
|
|
5286
|
+
break;
|
|
5287
|
+
}
|
|
5288
|
+
case "@": {
|
|
5289
|
+
matchResult_7 = 9;
|
|
5290
|
+
left_2 = expression_8.fields[1];
|
|
5291
|
+
right_1 = expression_8.fields[2];
|
|
5292
|
+
break;
|
|
5293
|
+
}
|
|
5294
|
+
default: {
|
|
5295
|
+
matchResult_7 = 10;
|
|
5296
|
+
left_3 = expression_8.fields[1];
|
|
5297
|
+
right_2 = expression_8.fields[2];
|
|
5298
|
+
}
|
|
5299
|
+
}
|
|
5300
|
+
break;
|
|
5301
|
+
}
|
|
5302
|
+
case 24: {
|
|
5303
|
+
matchResult_7 = 9;
|
|
5304
|
+
left_2 = expression_8.fields[0];
|
|
5305
|
+
right_1 = expression_8.fields[1];
|
|
5306
|
+
break;
|
|
5307
|
+
}
|
|
5308
|
+
case 23: {
|
|
5309
|
+
matchResult_7 = 11;
|
|
5310
|
+
head_3 = expression_8.fields[0];
|
|
5311
|
+
tail_8 = expression_8.fields[1];
|
|
5312
|
+
break;
|
|
5313
|
+
}
|
|
5314
|
+
case 15: {
|
|
5315
|
+
matchResult_7 = 12;
|
|
5316
|
+
items_5 = expression_8.fields[0];
|
|
5317
|
+
break;
|
|
5318
|
+
}
|
|
5319
|
+
case 13: {
|
|
5320
|
+
matchResult_7 = 13;
|
|
5321
|
+
items_6 = expression_8.fields[0];
|
|
5322
|
+
break;
|
|
5323
|
+
}
|
|
5324
|
+
case 16: {
|
|
5325
|
+
matchResult_7 = 14;
|
|
5326
|
+
fields_8 = expression_8.fields[0];
|
|
5327
|
+
break;
|
|
5328
|
+
}
|
|
5329
|
+
case 17: {
|
|
5330
|
+
matchResult_7 = 14;
|
|
5331
|
+
fields_8 = expression_8.fields[0];
|
|
5332
|
+
break;
|
|
5333
|
+
}
|
|
5334
|
+
case 21: {
|
|
5335
|
+
if (reference != null) {
|
|
5336
|
+
matchResult_7 = 15;
|
|
5337
|
+
}
|
|
5338
|
+
else {
|
|
5339
|
+
matchResult_7 = 16;
|
|
5340
|
+
name_34 = expression_8.fields[1];
|
|
5341
|
+
target_3 = expression_8.fields[0];
|
|
5342
|
+
}
|
|
5343
|
+
break;
|
|
5344
|
+
}
|
|
5345
|
+
case 26: {
|
|
5346
|
+
matchResult_7 = 17;
|
|
5347
|
+
item_23 = expression_8.fields[0];
|
|
5348
|
+
break;
|
|
5349
|
+
}
|
|
5350
|
+
case 27: {
|
|
5351
|
+
matchResult_7 = 18;
|
|
5352
|
+
break;
|
|
5353
|
+
}
|
|
5354
|
+
case 10: {
|
|
5355
|
+
matchResult_7 = 19;
|
|
5356
|
+
body_7 = expression_8.fields[2];
|
|
5357
|
+
name_35 = expression_8.fields[0];
|
|
5358
|
+
recursive_2 = expression_8.fields[3];
|
|
5359
|
+
span_25 = expression_8.fields[5];
|
|
5360
|
+
value_28 = expression_8.fields[1];
|
|
5361
|
+
break;
|
|
5362
|
+
}
|
|
5363
|
+
case 11: {
|
|
5364
|
+
matchResult_7 = 20;
|
|
5365
|
+
body_8 = expression_8.fields[2];
|
|
5366
|
+
pattern_6 = expression_8.fields[0];
|
|
5367
|
+
value_29 = expression_8.fields[1];
|
|
5368
|
+
break;
|
|
5369
|
+
}
|
|
5370
|
+
case 12: {
|
|
5371
|
+
matchResult_7 = 21;
|
|
5372
|
+
bindings_12 = expression_8.fields[0];
|
|
5373
|
+
body_9 = expression_8.fields[1];
|
|
5374
|
+
break;
|
|
5375
|
+
}
|
|
5376
|
+
case 7: {
|
|
5377
|
+
matchResult_7 = 22;
|
|
5378
|
+
value_31 = expression_8.fields[0];
|
|
5379
|
+
break;
|
|
5380
|
+
}
|
|
5381
|
+
case 8: {
|
|
5382
|
+
matchResult_7 = 23;
|
|
5383
|
+
body_10 = expression_8.fields[2];
|
|
5384
|
+
name_37 = expression_8.fields[0];
|
|
5385
|
+
source_7 = expression_8.fields[1];
|
|
5386
|
+
span_27 = expression_8.fields[3];
|
|
5387
|
+
break;
|
|
5388
|
+
}
|
|
5389
|
+
case 9: {
|
|
5390
|
+
matchResult_7 = 24;
|
|
5391
|
+
cases_9 = expression_8.fields[1];
|
|
5392
|
+
target_4 = expression_8.fields[0];
|
|
5393
|
+
break;
|
|
5394
|
+
}
|
|
5395
|
+
case 14: {
|
|
5396
|
+
matchResult_7 = 25;
|
|
5397
|
+
first_1 = expression_8.fields[0];
|
|
5398
|
+
last_1 = expression_8.fields[1];
|
|
5399
|
+
break;
|
|
5400
|
+
}
|
|
5401
|
+
case 19: {
|
|
5402
|
+
matchResult_7 = 26;
|
|
5403
|
+
fields_9 = expression_8.fields[1];
|
|
5404
|
+
target_5 = expression_8.fields[0];
|
|
5405
|
+
break;
|
|
5406
|
+
}
|
|
5407
|
+
case 20: {
|
|
5408
|
+
matchResult_7 = 27;
|
|
5409
|
+
fields_10 = expression_8.fields[1];
|
|
5410
|
+
target_6 = expression_8.fields[0];
|
|
5411
|
+
break;
|
|
5412
|
+
}
|
|
5413
|
+
case 22: {
|
|
5414
|
+
matchResult_7 = 28;
|
|
5415
|
+
index_1 = expression_8.fields[1];
|
|
5416
|
+
target_7 = expression_8.fields[0];
|
|
5417
|
+
break;
|
|
5418
|
+
}
|
|
5419
|
+
case 29: {
|
|
5420
|
+
matchResult_7 = 29;
|
|
5421
|
+
name_40 = expression_8.fields[0];
|
|
5422
|
+
break;
|
|
5423
|
+
}
|
|
5424
|
+
case 28: {
|
|
5425
|
+
matchResult_7 = 30;
|
|
5426
|
+
name_41 = expression_8.fields[0];
|
|
5427
|
+
break;
|
|
5428
|
+
}
|
|
5429
|
+
case 30: {
|
|
5430
|
+
matchResult_7 = 31;
|
|
5431
|
+
parts_1 = expression_8.fields[0];
|
|
5432
|
+
break;
|
|
5433
|
+
}
|
|
5434
|
+
case 18: {
|
|
5435
|
+
matchResult_7 = 32;
|
|
5436
|
+
entries_1 = expression_8.fields[0];
|
|
5437
|
+
break;
|
|
5438
|
+
}
|
|
5439
|
+
default:
|
|
5440
|
+
matchResult_7 = 0;
|
|
5441
|
+
}
|
|
5442
|
+
switch (matchResult_7) {
|
|
5443
|
+
case 0: {
|
|
5444
|
+
node_1 = (new ResolvedExpressionNode(/* ResolvedConstant */ 0, [ResolvedLiteral.ResolvedUnit]));
|
|
5445
|
+
break;
|
|
5446
|
+
}
|
|
5447
|
+
case 1: {
|
|
5448
|
+
node_1 = (new ResolvedExpressionNode(/* ResolvedConstant */ 0, [resolvedLiteral(value_26)]));
|
|
5449
|
+
break;
|
|
5450
|
+
}
|
|
5451
|
+
case 2: {
|
|
5452
|
+
node_1 = (new ResolvedExpressionNode(/* ResolvedReference */ 1, [value_42(reference)]));
|
|
5453
|
+
break;
|
|
5454
|
+
}
|
|
5455
|
+
case 3: {
|
|
5456
|
+
node_1 = resolveExpression(inner_1).Node;
|
|
5457
|
+
break;
|
|
5458
|
+
}
|
|
5459
|
+
case 4: {
|
|
5460
|
+
node_1 = (new ResolvedExpressionNode(/* ResolvedLambda */ 2, [bindingAt(ResolvedSymbolKind.ParameterSymbol, parameter_2.Name, parameter_2.Span, (expressionType.tag === 11) ? expressionType.fields[0] : Types_freshVar()), resolveExpression(body_6)]));
|
|
5461
|
+
break;
|
|
5462
|
+
}
|
|
5463
|
+
case 5: {
|
|
5464
|
+
node_1 = (new ResolvedExpressionNode(/* ResolvedApply */ 3, [resolveExpression(fn_1), resolveExpression(argument_4)]));
|
|
5465
|
+
break;
|
|
5466
|
+
}
|
|
5467
|
+
case 6: {
|
|
5468
|
+
node_1 = (new ResolvedExpressionNode(/* ResolvedIf */ 5, [resolveExpression(condition_1), resolveExpression(whenTrue_1), resolveExpression(whenFalse_1)]));
|
|
5469
|
+
break;
|
|
5470
|
+
}
|
|
5471
|
+
case 7: {
|
|
5472
|
+
node_1 = (new ResolvedExpressionNode(/* ResolvedPipe */ 4, [resolveExpression(left_1), resolveExpression(right)]));
|
|
5473
|
+
break;
|
|
5474
|
+
}
|
|
5475
|
+
case 8: {
|
|
5476
|
+
node_1 = (new ResolvedExpressionNode(/* ResolvedCons */ 13, [resolveExpression(head_2), resolveExpression(tail_7)]));
|
|
5477
|
+
break;
|
|
5478
|
+
}
|
|
5479
|
+
case 9: {
|
|
5480
|
+
node_1 = (new ResolvedExpressionNode(/* ResolvedAppend */ 14, [resolveExpression(left_2), resolveExpression(right_1)]));
|
|
5481
|
+
break;
|
|
5482
|
+
}
|
|
5483
|
+
case 10: {
|
|
5484
|
+
node_1 = (new ResolvedExpressionNode(/* ResolvedPrimitive */ 6, [value_42(primitive), ofArray([resolveExpression(left_3), resolveExpression(right_2)])]));
|
|
5485
|
+
break;
|
|
5486
|
+
}
|
|
5487
|
+
case 11: {
|
|
5488
|
+
node_1 = (new ResolvedExpressionNode(/* ResolvedCons */ 13, [resolveExpression(head_3), resolveExpression(tail_8)]));
|
|
5489
|
+
break;
|
|
5490
|
+
}
|
|
5491
|
+
case 12: {
|
|
5492
|
+
node_1 = (new ResolvedExpressionNode(/* ResolvedTuple */ 7, [map_1(resolveExpression, items_5)]));
|
|
5493
|
+
break;
|
|
5494
|
+
}
|
|
5495
|
+
case 13: {
|
|
5496
|
+
node_1 = (new ResolvedExpressionNode(/* ResolvedList */ 8, [map_1(resolveExpression, items_6)]));
|
|
5497
|
+
break;
|
|
5498
|
+
}
|
|
5499
|
+
case 14: {
|
|
5500
|
+
node_1 = (new ResolvedExpressionNode(/* ResolvedRecord */ 9, [map_1((tupledArg_13) => [tupledArg_13[0], resolveExpression(tupledArg_13[1])], fields_8)]));
|
|
5501
|
+
break;
|
|
5502
|
+
}
|
|
5503
|
+
case 15: {
|
|
5504
|
+
node_1 = (new ResolvedExpressionNode(/* ResolvedReference */ 1, [value_42(reference)]));
|
|
5505
|
+
break;
|
|
5506
|
+
}
|
|
5507
|
+
case 16: {
|
|
5508
|
+
node_1 = (new ResolvedExpressionNode(/* ResolvedFieldGet */ 10, [resolveExpression(target_3), name_34]));
|
|
5509
|
+
break;
|
|
5510
|
+
}
|
|
5511
|
+
case 17: {
|
|
5512
|
+
node_1 = (new ResolvedExpressionNode(/* ResolvedSome */ 11, [resolveExpression(item_23)]));
|
|
5513
|
+
break;
|
|
5514
|
+
}
|
|
5515
|
+
case 18: {
|
|
5516
|
+
node_1 = ResolvedExpressionNode.ResolvedNone;
|
|
5517
|
+
break;
|
|
5518
|
+
}
|
|
5519
|
+
case 19: {
|
|
5520
|
+
node_1 = (new ResolvedExpressionNode(/* ResolvedLet */ 15, [bindingAt(ResolvedSymbolKind.LocalSymbol, name_35, span_25, finalType(value_28)), recursive_2, resolveExpression(value_28), resolveExpression(body_7)]));
|
|
5521
|
+
break;
|
|
5522
|
+
}
|
|
5523
|
+
case 20: {
|
|
5524
|
+
const resolvedValue = resolveExpression(value_29);
|
|
5525
|
+
node_1 = (new ResolvedExpressionNode(/* ResolvedMatch */ 18, [resolvedValue, singleton(new ResolvedMatchCase(resolvePattern(resolvedValue.Type, pattern_6), undefined, resolveExpression(body_8), Ast_spanOfPattern(pattern_6)))]));
|
|
5526
|
+
break;
|
|
5527
|
+
}
|
|
5528
|
+
case 21: {
|
|
5529
|
+
node_1 = (new ResolvedExpressionNode(/* ResolvedLetRecursiveGroup */ 16, [map_1((tupledArg_14) => {
|
|
5530
|
+
const span_26 = tupledArg_14[4];
|
|
5531
|
+
const resolvedValue_1 = resolveExpression(foldBack((parameter_3, inner_2) => (new Expr(/* ELambda */ 4, [parameter_3, inner_2, span_26])), tupledArg_14[1], tupledArg_14[3]));
|
|
5532
|
+
return new ResolvedRecursiveBinding(bindingAt(ResolvedSymbolKind.LocalSymbol, tupledArg_14[0], span_26, resolvedValue_1.Type), resolvedValue_1);
|
|
5533
|
+
}, bindings_12), resolveExpression(body_9)]));
|
|
5534
|
+
break;
|
|
5535
|
+
}
|
|
5536
|
+
case 22: {
|
|
5537
|
+
node_1 = (new ResolvedExpressionNode(/* ResolvedFail */ 17, [resolveExpression(value_31)]));
|
|
5538
|
+
break;
|
|
5539
|
+
}
|
|
5540
|
+
case 23: {
|
|
5541
|
+
const resolvedSource = resolveExpression(source_7);
|
|
5542
|
+
node_1 = (new ResolvedExpressionNode(/* ResolvedForEach */ 24, [bindingAt(ResolvedSymbolKind.LocalSymbol, name_37, span_27, (matchValue_6 = resolvedSource.Type, (matchValue_6.tag === 5) ? matchValue_6.fields[0] : Types_freshVar())), resolvedSource, resolveExpression(body_10)]));
|
|
5543
|
+
break;
|
|
5544
|
+
}
|
|
5545
|
+
case 24: {
|
|
5546
|
+
const resolvedTarget = resolveExpression(target_4);
|
|
5547
|
+
node_1 = (new ResolvedExpressionNode(/* ResolvedMatch */ 18, [resolvedTarget, map_1((tupledArg_15) => {
|
|
5548
|
+
let option_32;
|
|
5549
|
+
return new ResolvedMatchCase(resolvePattern(resolvedTarget.Type, tupledArg_15[0]), (option_32 = tupledArg_15[1], (option_32 != null) ? resolveExpression(option_32) : undefined), resolveExpression(tupledArg_15[2]), tupledArg_15[3]);
|
|
5550
|
+
}, cases_9)]));
|
|
5551
|
+
break;
|
|
5552
|
+
}
|
|
5553
|
+
case 25: {
|
|
5554
|
+
node_1 = (new ResolvedExpressionNode(/* ResolvedRange */ 19, [resolveExpression(first_1), resolveExpression(last_1)]));
|
|
5555
|
+
break;
|
|
5556
|
+
}
|
|
5557
|
+
case 26: {
|
|
5558
|
+
node_1 = (new ResolvedExpressionNode(/* ResolvedRecordUpdate */ 20, [true, resolveExpression(target_5), map_1((tupledArg_16) => [tupledArg_16[0], resolveExpression(tupledArg_16[1])], fields_9)]));
|
|
5559
|
+
break;
|
|
5560
|
+
}
|
|
5561
|
+
case 27: {
|
|
5562
|
+
node_1 = (new ResolvedExpressionNode(/* ResolvedRecordUpdate */ 20, [false, resolveExpression(target_6), map_1((tupledArg_17) => [tupledArg_17[0], resolveExpression(tupledArg_17[1])], fields_10)]));
|
|
5563
|
+
break;
|
|
5564
|
+
}
|
|
5565
|
+
case 28: {
|
|
5566
|
+
node_1 = (new ResolvedExpressionNode(/* ResolvedIndexGet */ 21, [resolveExpression(target_7), resolveExpression(index_1)]));
|
|
5567
|
+
break;
|
|
5568
|
+
}
|
|
5569
|
+
case 29: {
|
|
5570
|
+
node_1 = (new ResolvedExpressionNode(/* ResolvedConstant */ 0, [new ResolvedLiteral(/* ResolvedString */ 4, [name_40])]));
|
|
5571
|
+
break;
|
|
5572
|
+
}
|
|
5573
|
+
case 30: {
|
|
5574
|
+
node_1 = (new ResolvedExpressionNode(/* ResolvedTypeToken */ 25, [find_1(name_41, resolvedTypeDefinitions)]));
|
|
5575
|
+
break;
|
|
5576
|
+
}
|
|
5577
|
+
case 31: {
|
|
5578
|
+
node_1 = (new ResolvedExpressionNode(/* ResolvedInterpolate */ 22, [map_1((_arg_26) => {
|
|
5579
|
+
if (_arg_26.tag === 1) {
|
|
5580
|
+
return new ResolvedInterpolationPart(/* ResolvedValuePart */ 1, [resolveExpression(_arg_26.fields[0])]);
|
|
5581
|
+
}
|
|
5582
|
+
else {
|
|
5583
|
+
return new ResolvedInterpolationPart(/* ResolvedTextPart */ 0, [_arg_26.fields[0]]);
|
|
5584
|
+
}
|
|
5585
|
+
}, parts_1)]));
|
|
5586
|
+
break;
|
|
5587
|
+
}
|
|
5588
|
+
default:
|
|
5589
|
+
node_1 = (new ResolvedExpressionNode(/* ResolvedMap */ 23, [map_1((_arg_27) => {
|
|
5590
|
+
if (_arg_27.tag === 1) {
|
|
5591
|
+
return new ResolvedMapEntry(/* ResolvedSpread */ 1, [resolveExpression(_arg_27.fields[0])]);
|
|
5592
|
+
}
|
|
5593
|
+
else {
|
|
5594
|
+
return new ResolvedMapEntry(/* ResolvedKeyValue */ 0, [resolveExpression(_arg_27.fields[0]), resolveExpression(_arg_27.fields[1])]);
|
|
5595
|
+
}
|
|
5596
|
+
}, entries_1)]));
|
|
5597
|
+
}
|
|
5598
|
+
const children = (node_1.tag === 11) ? singleton(node_1.fields[0]) : ((node_1.tag === 17) ? singleton(node_1.fields[0]) : ((node_1.tag === 3) ? ofArray([node_1.fields[0], node_1.fields[1]]) : ((node_1.tag === 4) ? ofArray([node_1.fields[0], node_1.fields[1]]) : ((node_1.tag === 13) ? ofArray([node_1.fields[0], node_1.fields[1]]) : ((node_1.tag === 14) ? ofArray([node_1.fields[0], node_1.fields[1]]) : ((node_1.tag === 19) ? ofArray([node_1.fields[0], node_1.fields[1]]) : ((node_1.tag === 21) ? ofArray([node_1.fields[0], node_1.fields[1]]) : ((node_1.tag === 5) ? ofArray([node_1.fields[0], node_1.fields[1], node_1.fields[2]]) : ((node_1.tag === 6) ? node_1.fields[1] : ((node_1.tag === 7) ? node_1.fields[0] : ((node_1.tag === 8) ? node_1.fields[0] : ((node_1.tag === 9) ? map_1((tuple_6) => tuple_6[1], node_1.fields[0]) : ((node_1.tag === 10) ? singleton(node_1.fields[0]) : ((node_1.tag === 15) ? ofArray([node_1.fields[2], node_1.fields[3]]) : ((node_1.tag === 16) ? append(map_1((_arg_28) => _arg_28.Value, node_1.fields[0]), singleton(node_1.fields[1])) : ((node_1.tag === 18) ? cons(node_1.fields[0], collect((case$) => append(ofArray(toArray(case$.Guard)), singleton(case$.Body)), node_1.fields[1])) : ((node_1.tag === 20) ? cons(node_1.fields[1], map_1((tuple_7) => tuple_7[1], node_1.fields[2])) : ((node_1.tag === 22) ? choose((_arg_29) => {
|
|
5599
|
+
if (_arg_29.tag === 1) {
|
|
5600
|
+
return _arg_29.fields[0];
|
|
5601
|
+
}
|
|
5602
|
+
else {
|
|
5603
|
+
return undefined;
|
|
5604
|
+
}
|
|
5605
|
+
}, node_1.fields[0]) : ((node_1.tag === 23) ? collect((_arg_30) => {
|
|
5606
|
+
if (_arg_30.tag === 1) {
|
|
5607
|
+
return singleton(_arg_30.fields[0]);
|
|
5608
|
+
}
|
|
5609
|
+
else {
|
|
5610
|
+
return ofArray([_arg_30.fields[0], _arg_30.fields[1]]);
|
|
5611
|
+
}
|
|
5612
|
+
}, node_1.fields[0]) : ((node_1.tag === 24) ? ofArray([node_1.fields[1], node_1.fields[2]]) : ((node_1.tag === 0) ? empty_2() : ((node_1.tag === 1) ? empty_2() : ((node_1.tag === 12) ? empty_2() : ((node_1.tag === 25) ? empty_2() : singleton(node_1.fields[1])))))))))))))))))))))))));
|
|
5613
|
+
let coercion;
|
|
5614
|
+
const recordShape = (_arg_31) => {
|
|
5615
|
+
switch (_arg_31.tag) {
|
|
5616
|
+
case 8:
|
|
5617
|
+
return _arg_31.fields[0];
|
|
5618
|
+
case 12: {
|
|
5619
|
+
const matchValue_7 = tryFind(_arg_31.fields[0], resolvedTypeDefinitions);
|
|
5620
|
+
let matchResult_8, fields_14;
|
|
5621
|
+
if (matchValue_7 != null) {
|
|
5622
|
+
if (matchValue_7.tag === 8) {
|
|
5623
|
+
matchResult_8 = 0;
|
|
5624
|
+
fields_14 = matchValue_7.fields[0];
|
|
5625
|
+
}
|
|
5626
|
+
else {
|
|
5627
|
+
matchResult_8 = 1;
|
|
5628
|
+
}
|
|
5629
|
+
}
|
|
5630
|
+
else {
|
|
5631
|
+
matchResult_8 = 1;
|
|
5632
|
+
}
|
|
5633
|
+
switch (matchResult_8) {
|
|
5634
|
+
case 0:
|
|
5635
|
+
return fields_14;
|
|
5636
|
+
default:
|
|
5637
|
+
return undefined;
|
|
5638
|
+
}
|
|
5639
|
+
}
|
|
5640
|
+
default:
|
|
5641
|
+
return undefined;
|
|
5642
|
+
}
|
|
5643
|
+
};
|
|
5644
|
+
const conversion = (targetType, sourceType) => {
|
|
5645
|
+
let targetFields, sourceFields;
|
|
5646
|
+
const matchValue_8 = recordShape(targetType);
|
|
5647
|
+
const matchValue_9 = recordShape(sourceType);
|
|
5648
|
+
let matchResult_9, sourceFields_1, targetFields_1;
|
|
5649
|
+
if (matchValue_8 != null) {
|
|
5650
|
+
if (matchValue_9 != null) {
|
|
5651
|
+
if ((targetFields = matchValue_8, (sourceFields = matchValue_9, !equals(targetType, sourceType) && forAll((name_43, targetField) => exists_2((y_17) => equals(targetField, y_17), toArray(tryFind(name_43, sourceFields))), targetFields)))) {
|
|
5652
|
+
matchResult_9 = 0;
|
|
5653
|
+
sourceFields_1 = matchValue_9;
|
|
5654
|
+
targetFields_1 = matchValue_8;
|
|
5655
|
+
}
|
|
5656
|
+
else {
|
|
5657
|
+
matchResult_9 = 1;
|
|
5658
|
+
}
|
|
5659
|
+
}
|
|
5660
|
+
else {
|
|
5661
|
+
matchResult_9 = 1;
|
|
5662
|
+
}
|
|
5663
|
+
}
|
|
5664
|
+
else {
|
|
5665
|
+
matchResult_9 = 1;
|
|
5666
|
+
}
|
|
5667
|
+
switch (matchResult_9) {
|
|
5668
|
+
case 0:
|
|
5669
|
+
return new RecordCoercionEvidence(sourceType, targetType, (targetType.tag === 12) ? targetType.fields[0] : undefined);
|
|
5670
|
+
default:
|
|
5671
|
+
return undefined;
|
|
5672
|
+
}
|
|
5673
|
+
};
|
|
5674
|
+
const callParameter = (fn_2) => {
|
|
5675
|
+
let option_37, option_35, signature;
|
|
5676
|
+
let inferred_3;
|
|
5677
|
+
const matchValue_11 = fn_2.Type;
|
|
5678
|
+
inferred_3 = ((matchValue_11.tag === 11) ? matchValue_11.fields[0] : undefined);
|
|
5679
|
+
const matchValue_12 = fn_2.Node;
|
|
5680
|
+
if (matchValue_12.tag === 1) {
|
|
5681
|
+
return orElse((option_37 = ((option_35 = tryFind_2((symbol_4) => (symbol_4.SymbolId === matchValue_12.fields[0].SymbolId), symbols), (option_35 != null) ? option_35.Scheme : undefined)), (option_37 != null) ? ((signature = option_37.fields[1], (signature.tag === 11) ? ((signature.fields[0].tag === 8) ? (new Type_1(/* TRecord */ 8, [signature.fields[0].fields[0]])) : undefined) : undefined)) : undefined), inferred_3);
|
|
5682
|
+
}
|
|
5683
|
+
else {
|
|
5684
|
+
return inferred_3;
|
|
5685
|
+
}
|
|
5686
|
+
};
|
|
5687
|
+
switch (node_1.tag) {
|
|
5688
|
+
case 3: {
|
|
5689
|
+
const option_40 = callParameter(node_1.fields[0]);
|
|
5690
|
+
coercion = ((option_40 != null) ? conversion(option_40, node_1.fields[1].Type) : undefined);
|
|
5691
|
+
break;
|
|
5692
|
+
}
|
|
5693
|
+
case 4: {
|
|
5694
|
+
const option_42 = callParameter(node_1.fields[1]);
|
|
5695
|
+
coercion = ((option_42 != null) ? conversion(option_42, node_1.fields[0].Type) : undefined);
|
|
5696
|
+
break;
|
|
5697
|
+
}
|
|
5698
|
+
default:
|
|
5699
|
+
coercion = undefined;
|
|
5700
|
+
}
|
|
5701
|
+
return new ResolvedExpression(expressionType, Ast_spanOfExpr(expression_8), reference, primitive, coercion, node_1, children);
|
|
5702
|
+
};
|
|
5703
|
+
const resolvedStatements = map2((declaredAttributes, statement_2) => {
|
|
5704
|
+
let option_44, import$_1, option_48;
|
|
5705
|
+
const roots = (statement_2.tag === 2) ? singleton(statement_2.fields[1]) : ((statement_2.tag === 3) ? map_1((tupledArg_18) => tupledArg_18[1], statement_2.fields[0]) : ((statement_2.tag === 5) ? singleton(statement_2.fields[0].Expr) : ((statement_2.tag === 4) ? empty_2() : ((statement_2.tag === 0) ? empty_2() : singleton(statement_2.fields[1])))));
|
|
5706
|
+
const export$ = (statement_2.tag === 1) ? (statement_2.fields[4] ? (new ResolvedExport(statement_2.fields[0], statement_2.fields[5])) : undefined) : ((statement_2.tag === 2) ? (statement_2.fields[3] ? (new ResolvedExport("<pattern>", statement_2.fields[4])) : undefined) : ((statement_2.tag === 3) ? (statement_2.fields[1] ? (new ResolvedExport(join(",", map_1((tupledArg_19) => tupledArg_19[0], statement_2.fields[0])), statement_2.fields[2])) : undefined) : undefined));
|
|
5707
|
+
const attributes = (statement_2.tag === 1) ? (statement_2.fields[4] ? singleton(new Attribute("Export", empty_2(), statement_2.fields[5])) : empty_2()) : ((statement_2.tag === 2) ? (statement_2.fields[3] ? singleton(new Attribute("Export", empty_2(), statement_2.fields[4])) : empty_2()) : ((statement_2.tag === 3) ? (statement_2.fields[1] ? singleton(new Attribute("Export", empty_2(), statement_2.fields[2])) : empty_2()) : ((statement_2.tag === 4) ? singleton(new Attribute("Import", ofArray([statement_2.fields[2].ModulePath, statement_2.fields[2].MemberName]), statement_2.fields[2].Span)) : ((statement_2.tag === 0) ? defaultArg((option_44 = statement_2.fields[0].Import, (option_44 != null) ? ((import$_1 = option_44, singleton(new Attribute("Import", ofArray([import$_1.ModulePath, import$_1.MemberName]), import$_1.Span)))) : undefined), empty_2()) : empty_2()))));
|
|
5708
|
+
const patterns = (statement_2.tag === 2) ? singleton(resolvePattern(finalType(statement_2.fields[1]), statement_2.fields[0])) : empty_2();
|
|
5709
|
+
const resolvedRoots = map_1(resolveExpression, roots);
|
|
5710
|
+
const declarationBinding = (name_47, span_32, bindingType_1) => bindingAt(ResolvedSymbolKind.DeclarationSymbol, name_47, span_32, bindingType_1);
|
|
5711
|
+
const declarationScheme = (name_48, span_33, fallback) => defaultArg(symbolAt(ResolvedSymbolKind.DeclarationSymbol, name_48, span_33).Scheme, fallback);
|
|
5712
|
+
const importMetadata = (import$_2) => (new ResolvedBackendImport(import$_2.ModulePath, import$_2.MemberName, import$_2.Span));
|
|
5713
|
+
let node_2;
|
|
5714
|
+
switch (statement_2.tag) {
|
|
5715
|
+
case 1: {
|
|
5716
|
+
const span_34 = statement_2.fields[5];
|
|
5717
|
+
const name_51 = statement_2.fields[0];
|
|
5718
|
+
const inferred_4 = statement_2.fields[2];
|
|
5719
|
+
node_2 = (new ResolvedStatementNode(/* ResolvedValueDeclaration */ 1, [new ResolvedValueDeclaration(declarationBinding(name_51, span_34, normalizeTypeVariables(inferred_4)), declarationScheme(name_51, span_34, Types_generalize(empty({
|
|
5720
|
+
Compare: (x_16, y_18) => (comparePrimitives(x_16, y_18) | 0),
|
|
5721
|
+
}), inferred_4)), statement_2.fields[3], exactlyOne(resolvedRoots))]));
|
|
5722
|
+
break;
|
|
5723
|
+
}
|
|
5724
|
+
case 2: {
|
|
5725
|
+
const span_35 = statement_2.fields[4];
|
|
5726
|
+
const resolvedBindings = map_1((tupledArg_22) => {
|
|
5727
|
+
const name_52 = tupledArg_22[0];
|
|
5728
|
+
const normalized_2 = normalizeTypeVariables(tupledArg_22[1]);
|
|
5729
|
+
return [declarationBinding(name_52, span_35, normalized_2), declarationScheme(name_52, span_35, Types_generalize(empty({
|
|
5730
|
+
Compare: (x_17, y_19) => (comparePrimitives(x_17, y_19) | 0),
|
|
5731
|
+
}), normalized_2))];
|
|
5732
|
+
}, toList(statement_2.fields[2]));
|
|
5733
|
+
node_2 = (new ResolvedStatementNode(/* ResolvedPatternDeclaration */ 2, [new ResolvedPatternDeclaration(exactlyOne(patterns), exactlyOne(resolvedRoots), resolvedBindings)]));
|
|
5734
|
+
break;
|
|
5735
|
+
}
|
|
5736
|
+
case 3: {
|
|
5737
|
+
node_2 = (new ResolvedStatementNode(/* ResolvedRecursiveDeclarations */ 3, [map_1((tupledArg_23) => {
|
|
5738
|
+
const _arg_40 = tupledArg_23[0];
|
|
5739
|
+
const span_36 = _arg_40[3];
|
|
5740
|
+
const name_53 = _arg_40[0];
|
|
5741
|
+
const inferred_5 = _arg_40[2];
|
|
5742
|
+
return new ResolvedValueDeclaration(declarationBinding(name_53, span_36, normalizeTypeVariables(inferred_5)), declarationScheme(name_53, span_36, Types_generalize(empty({
|
|
5743
|
+
Compare: (x_18, y_20) => (comparePrimitives(x_18, y_20) | 0),
|
|
5744
|
+
}), inferred_5)), true, tupledArg_23[1]);
|
|
5745
|
+
}, zip(statement_2.fields[0], resolvedRoots))]));
|
|
5746
|
+
break;
|
|
5747
|
+
}
|
|
5748
|
+
case 4: {
|
|
5749
|
+
const span_37 = statement_2.fields[3];
|
|
5750
|
+
const name_54 = statement_2.fields[0];
|
|
5751
|
+
const normalized_3 = normalizeTypeVariables(statement_2.fields[1]);
|
|
5752
|
+
node_2 = (new ResolvedStatementNode(/* ResolvedImportedDeclaration */ 4, [new ResolvedImportedDeclaration(declarationBinding(name_54, span_37, normalized_3), declarationScheme(name_54, span_37, new Scheme(empty_2(), normalized_3)), importMetadata(statement_2.fields[2]))]));
|
|
5753
|
+
break;
|
|
5754
|
+
}
|
|
5755
|
+
case 5: {
|
|
5756
|
+
node_2 = (new ResolvedStatementNode(/* ResolvedExpressionStatement */ 5, [exactlyOne(resolvedRoots)]));
|
|
5757
|
+
break;
|
|
5758
|
+
}
|
|
5759
|
+
default: {
|
|
5760
|
+
const definition_10 = statement_2.fields[0];
|
|
5761
|
+
node_2 = (new ResolvedStatementNode(/* ResolvedTypeDeclaration */ 0, [new ResolvedTypeDeclaration(bindingAt(ResolvedSymbolKind.TypeSymbol, definition_10.Name, definition_10.Span, new Type_1(/* TNamed */ 12, [definition_10.Name])), definition_10.IsRecursive, FSharpMap__get_Item(resolvedTypeDefinitions, definition_10.Name), map_1((tupledArg_20) => [tupledArg_20[0], typeFromRef(declarations, singleton(definition_10.Name), tupledArg_20[1])], definition_10.Fields), map_1((tupledArg_21) => {
|
|
5762
|
+
let option_47;
|
|
5763
|
+
return [tupledArg_21[0], (option_47 = tupledArg_21[1], (option_47 != null) ? typeFromRef(declarations, singleton(definition_10.Name), option_47) : undefined)];
|
|
5764
|
+
}, definition_10.Cases), (option_48 = definition_10.Import, (option_48 != null) ? importMetadata(option_48) : undefined))]));
|
|
5765
|
+
}
|
|
5766
|
+
}
|
|
5767
|
+
return new ResolvedStatement((statement_2.tag === 1) ? statement_2.fields[5] : ((statement_2.tag === 2) ? statement_2.fields[4] : ((statement_2.tag === 3) ? statement_2.fields[2] : ((statement_2.tag === 4) ? statement_2.fields[3] : ((statement_2.tag === 5) ? statement_2.fields[0].Span : statement_2.fields[0].Span)))), sortBy((attribute) => [attribute.Span.Start.Line, attribute.Span.Start.Column], append(declaredAttributes, attributes), {
|
|
5768
|
+
Compare: (x_19, y_21) => (compareArrays(x_19, y_21) | 0),
|
|
5769
|
+
}), export$, node_2, patterns, resolvedRoots);
|
|
5770
|
+
}, patternInput[0], typed);
|
|
5771
|
+
return new ResolvedProgram(PurityContractsModule_empty, typed, append(map_1((tupledArg_24) => {
|
|
5772
|
+
const name_55 = tupledArg_24[0];
|
|
5773
|
+
const definition_12 = tupledArg_24[1];
|
|
5774
|
+
return new ResolvedStatement(syntheticSpan, empty_2(), undefined, new ResolvedStatementNode(/* ResolvedTypeDeclaration */ 0, [new ResolvedTypeDeclaration(bindingAt(ResolvedSymbolKind.TypeSymbol, name_55, syntheticSpan, new Type_1(/* TNamed */ 12, [name_55])), false, definition_12, (definition_12.tag === 8) ? toList(definition_12.fields[0]) : ((definition_12.tag === 17) ? toList(definition_12.fields[1]) : empty_2()), (definition_12.tag === 13) ? toList(definition_12.fields[1]) : empty_2(), undefined)]), empty_2(), empty_2());
|
|
5775
|
+
}, toList(hostDefinitions)), resolvedStatements), expressions, toList_1(symbols), resolvedReferences);
|
|
5776
|
+
}
|
|
5777
|
+
|
|
5778
|
+
/**
|
|
5779
|
+
* Host metadata does not change inference or execute provider code.
|
|
5780
|
+
*/
|
|
5781
|
+
export function inferResolvedProgramWithRegistrationAndPurity(registration, purity, program) {
|
|
5782
|
+
const bind$0040 = inferResolvedProgramWithRegistration(registration, program);
|
|
5783
|
+
return new ResolvedProgram(purity, bind$0040.TypedProgram, bind$0040.ResolvedStatements, bind$0040.ExpressionTypes, bind$0040.Symbols, bind$0040.SymbolReferences);
|
|
5784
|
+
}
|
|
5785
|
+
|
|
5786
|
+
export function inferResolvedProgramWithExterns(externs, program) {
|
|
5787
|
+
return inferResolvedProgramWithRegistration(ofExterns(externs), program);
|
|
5788
|
+
}
|
|
5789
|
+
|
|
5790
|
+
export function inferResolvedProgram(program) {
|
|
5791
|
+
return inferResolvedProgramWithExterns(empty_2(), program);
|
|
5792
|
+
}
|
|
5793
|
+
|
|
5794
|
+
/**
|
|
5795
|
+
* The legacy typed-program API is a projection of the semantic resolved
|
|
5796
|
+
* result, so both compiler consumers and existing evaluators observe the
|
|
5797
|
+
* same inference pass and substitutions.
|
|
5798
|
+
*/
|
|
5799
|
+
export function inferProgramWithExterns(externs, program) {
|
|
5800
|
+
validateProgramBindings(externs, program);
|
|
5801
|
+
return inferProgramWithExternsRaw(externs, program);
|
|
3550
5802
|
}
|
|
3551
5803
|
|
|
3552
5804
|
export function inferProgramWithLocalVariableTypes(program) {
|
|
@@ -3574,6 +5826,7 @@ export function inferProgramWithRegistrationAndLocalVariableTypes(registration,
|
|
|
3574
5826
|
if (exists((name) => contains(name, builtinReservedNames), topLevelBindingNames(program))) {
|
|
3575
5827
|
throw new TypeException(new TypeError$("Top-level binding collides with reserved stdlib symbol", unknownSpan));
|
|
3576
5828
|
}
|
|
3577
|
-
|
|
5829
|
+
const patternInput = inferProgramWithExternsRawAndLocals(true, registration, program);
|
|
5830
|
+
return [patternInput[0], patternInput[1]];
|
|
3578
5831
|
}
|
|
3579
5832
|
|