@magnusopera/fscript 0.77.0 → 0.78.1
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/dist/FScript.Language/Ast.js +2 -2
- package/dist/FScript.Language/BuiltinFunctions.js +68 -67
- package/dist/FScript.Language/BuiltinSignatures.js +7 -7
- package/dist/FScript.Language/BuiltinTypes.js +3 -3
- package/dist/FScript.Language/Error.js +2 -2
- package/dist/FScript.Language/Eval.js +305 -213
- package/dist/FScript.Language/IncludeResolver.js +97 -79
- package/dist/FScript.Language/Interactive.js +149 -0
- package/dist/FScript.Language/Lexer.js +77 -77
- package/dist/FScript.Language/Parser.js +274 -272
- package/dist/FScript.Language/Pretty.js +4 -4
- package/dist/FScript.Language/Span.js +2 -2
- package/dist/FScript.Language/Token.js +59 -2
- package/dist/FScript.Language/TypeInfer.js +452 -348
- package/dist/FScript.Language/Types.js +22 -10
- package/dist/FScript.Language/Value.js +3 -2
- package/dist/Library.js +91 -79
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Array.js +36 -35
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Async.js +52 -23
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/AsyncBuilder.js +23 -2
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/BigInt.js +33 -32
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/BitConverter.js +2 -2
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/CHANGELOG.md +80 -1
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Date.js +8 -15
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/DateOffset.js +8 -17
- package/dist/fable_modules/fable-library-js.5.13.0/Directory.js +11 -0
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Double.js +8 -2
- package/dist/fable_modules/fable-library-js.5.13.0/Environment.js +3 -0
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Event.js +10 -1
- package/dist/fable_modules/fable-library-js.5.13.0/File.js +27 -0
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/List.js +35 -21
- package/dist/fable_modules/fable-library-js.5.13.0/Long.js +38 -0
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/MailboxProcessor.js +11 -5
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Map.js +8 -4
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/MutableMap.js +2 -2
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/MutableSet.js +1 -1
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Observable.js +5 -3
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Option.js +1 -18
- package/dist/fable_modules/fable-library-js.5.13.0/Path.js +31 -0
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Reflection.js +13 -3
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/RegExp.js +53 -24
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Seq.js +109 -22
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Set.js +16 -3
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/String.js +28 -1
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/System.js +15 -9
- package/dist/fable_modules/fable-library-js.5.13.0/Task.js +27 -0
- package/dist/fable_modules/fable-library-js.5.13.0/TaskBuilder.js +72 -0
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Types.js +12 -12
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Util.js +15 -3
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/package.json +1 -1
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/quotation.js +25 -8
- package/dist/fable_modules/project_cracked.json +1 -1
- package/package.json +1 -1
- package/dist/fable_modules/fable-library-js.5.2.0/Long.js +0 -47
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Boolean.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Char.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Choice.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/CollectionUtil.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/ConditionalWeakTable.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/DateOnly.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Decimal.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Encoding.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/FSharp.Collections.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/FSharp.Core.CompilerServices.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/FSharp.Core.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Global.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Guid.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Int32.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/MapUtil.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Native.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Numeric.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/README.md +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Random.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Range.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Result.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Seq2.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/System.Collections.Generic.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/System.Text.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/TimeOnly.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/TimeSpan.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Timer.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Unicode.13.0.0.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Uri.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/big.d.ts +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/lib/big.js +0 -0
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
|
|
2
2
|
import { Span_$reflection, Span, Position } from "./Span.js";
|
|
3
|
-
import { iterate as iterate_2, FSharpMap__Add,
|
|
4
|
-
import { disposeSafe, getEnumerator, stringHash, compareArrays, equals, comparePrimitives } from "../fable_modules/fable-library-js.5.
|
|
5
|
-
import { Types_generalize, Type_$reflection, Types_freshVar, Types_typeToString,
|
|
6
|
-
import { tryFind as tryFind_1, indexed, ofArray, collect, append, iterate, reverse, tryFindIndex, choose, tail as tail_2, cons, head as head_1, isEmpty, empty as empty_2, singleton, zip, length, fold, map } from "../fable_modules/fable-library-js.5.
|
|
7
|
-
import { toList as toList_2, add as add_1, empty as empty_1,
|
|
3
|
+
import { iterate as iterate_2, FSharpMap__Add, values, FSharpMap__get_Keys, keys, FSharpMap__TryFind, ofList, toList, FSharpMap__get_Item, FSharpMap__ContainsKey, FSharpMap__get_Count, exists as exists_1, add, fold as fold_1, remove, map as map_1, tryFind, isEmpty, empty } from "../fable_modules/fable-library-js.5.13.0/Map.js";
|
|
4
|
+
import { disposeSafe, getEnumerator, stringHash, compareArrays, equals, comparePrimitives } from "../fable_modules/fable-library-js.5.13.0/Util.js";
|
|
5
|
+
import { Types_generalize, Type_$reflection, Types_freshVar, Types_typeToString, Scheme, Type } from "./Types.js";
|
|
6
|
+
import { tryFind as tryFind_1, indexed, ofArray, collect, append, iterate, reverse, tryFindIndex, choose, tail as tail_2, cons, head as head_1, isEmpty as isEmpty_1, empty as empty_2, singleton, zip, length, exists, fold, map } from "../fable_modules/fable-library-js.5.13.0/List.js";
|
|
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 { TypeException, TypeError$ } from "./Error.js";
|
|
9
|
-
import { endsWith, split, join, concat, isNullOrWhiteSpace, printf, toText } from "../fable_modules/fable-library-js.5.
|
|
10
|
-
import {
|
|
11
|
-
import { Union, Record } from "../fable_modules/fable-library-js.5.
|
|
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";
|
|
11
|
+
import { Union, Record } from "../fable_modules/fable-library-js.5.13.0/Types.js";
|
|
12
12
|
import { Expr, Ast_spanOfPattern, Ast_spanOfExpr, Pattern_$reflection, TypeDef_$reflection, Expr_$reflection } from "./Ast.js";
|
|
13
|
-
import { option_type, array_type, union_type, list_type, tuple_type, class_type, bool_type, string_type, record_type } from "../fable_modules/fable-library-js.5.
|
|
14
|
-
import { foldBack, iterate as iterate_1, filter, map as map_2, toList as toList_1 } from "../fable_modules/fable-library-js.5.
|
|
15
|
-
import { last, item as item_2 } from "../fable_modules/fable-library-js.5.
|
|
16
|
-
import { distinct } from "../fable_modules/fable-library-js.5.
|
|
13
|
+
import { option_type, array_type, union_type, list_type, tuple_type, class_type, bool_type, string_type, record_type } from "../fable_modules/fable-library-js.5.13.0/Reflection.js";
|
|
14
|
+
import { foldBack, iterate as iterate_1, filter, map as map_2, toList as toList_1 } from "../fable_modules/fable-library-js.5.13.0/Seq.js";
|
|
15
|
+
import { last, item as item_2 } from "../fable_modules/fable-library-js.5.13.0/Array.js";
|
|
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 { typeDefs as typeDefs_1 } from "./BuiltinTypes.js";
|
|
19
19
|
|
|
@@ -23,58 +23,164 @@ const emptySubst = empty({
|
|
|
23
23
|
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
-
function applyType(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
26
|
+
function applyType(s, t) {
|
|
27
|
+
if (isEmpty(s)) {
|
|
28
|
+
return t;
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
const apply = (current_mut) => {
|
|
32
|
+
apply:
|
|
33
|
+
while (true) {
|
|
34
|
+
const current = current_mut;
|
|
35
|
+
switch (current.tag) {
|
|
36
|
+
case 15: {
|
|
37
|
+
const matchValue = tryFind(current.fields[0], s);
|
|
38
|
+
if (matchValue == null) {
|
|
39
|
+
return current;
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
current_mut = matchValue;
|
|
43
|
+
continue apply;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
case 5:
|
|
47
|
+
return new Type(/* TList */ 5, [apply(current.fields[0])]);
|
|
48
|
+
case 6:
|
|
49
|
+
return new Type(/* TTask */ 6, [apply(current.fields[0])]);
|
|
50
|
+
case 7:
|
|
51
|
+
return new Type(/* TTuple */ 7, [map(apply, current.fields[0])]);
|
|
52
|
+
case 8:
|
|
53
|
+
return new Type(/* TRecord */ 8, [map_1((_arg, t1_2) => apply(t1_2), current.fields[0])]);
|
|
54
|
+
case 9:
|
|
55
|
+
return new Type(/* TMap */ 9, [apply(current.fields[0]), apply(current.fields[1])]);
|
|
56
|
+
case 10:
|
|
57
|
+
return new Type(/* TOption */ 10, [apply(current.fields[0])]);
|
|
58
|
+
case 11:
|
|
59
|
+
return new Type(/* TFun */ 11, [apply(current.fields[0]), apply(current.fields[1])]);
|
|
60
|
+
default:
|
|
61
|
+
return current;
|
|
40
62
|
}
|
|
63
|
+
break;
|
|
41
64
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
case 6:
|
|
45
|
-
return new Type(6, [applyType(s, t.fields[0])]);
|
|
46
|
-
case 7:
|
|
47
|
-
return new Type(7, [map((t_1) => applyType(s, t_1), t.fields[0])]);
|
|
48
|
-
case 8:
|
|
49
|
-
return new Type(8, [map_1((_arg, t1_2) => applyType(s, t1_2), t.fields[0])]);
|
|
50
|
-
case 9:
|
|
51
|
-
return new Type(9, [applyType(s, t.fields[0]), applyType(s, t.fields[1])]);
|
|
52
|
-
case 10:
|
|
53
|
-
return new Type(10, [applyType(s, t.fields[0])]);
|
|
54
|
-
case 11:
|
|
55
|
-
return new Type(11, [applyType(s, t.fields[0]), applyType(s, t.fields[1])]);
|
|
56
|
-
default:
|
|
57
|
-
return t;
|
|
58
|
-
}
|
|
59
|
-
break;
|
|
65
|
+
};
|
|
66
|
+
return apply(t);
|
|
60
67
|
}
|
|
61
68
|
}
|
|
62
69
|
|
|
63
|
-
function applyScheme(s,
|
|
64
|
-
const
|
|
65
|
-
|
|
70
|
+
function applyScheme(s, scheme) {
|
|
71
|
+
const scheme_1 = scheme;
|
|
72
|
+
const vars = scheme_1.fields[0];
|
|
73
|
+
if (isEmpty(s)) {
|
|
74
|
+
return scheme_1;
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
return new Scheme(vars, applyType(fold((acc, v) => remove(v, acc), s, vars), scheme_1.fields[1]));
|
|
78
|
+
}
|
|
66
79
|
}
|
|
67
80
|
|
|
68
81
|
function applyEnv(s, env) {
|
|
69
|
-
|
|
82
|
+
if (isEmpty(s)) {
|
|
83
|
+
return env;
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
return map_1((_arg, sc) => applyScheme(s, sc), env);
|
|
87
|
+
}
|
|
70
88
|
}
|
|
71
89
|
|
|
72
90
|
function compose(s1, s2) {
|
|
73
|
-
|
|
91
|
+
if (isEmpty(s1)) {
|
|
92
|
+
return s2;
|
|
93
|
+
}
|
|
94
|
+
else if (isEmpty(s2)) {
|
|
95
|
+
return s1;
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
return fold_1((acc, k, v) => add(k, v, acc), s1, map_1((_arg, t) => applyType(s1, t), s2));
|
|
99
|
+
}
|
|
74
100
|
}
|
|
75
101
|
|
|
76
102
|
function occurs(v, t) {
|
|
77
|
-
|
|
103
|
+
const loop = (current_mut) => {
|
|
104
|
+
loop:
|
|
105
|
+
while (true) {
|
|
106
|
+
const current = current_mut;
|
|
107
|
+
let matchResult, item, keyType, valueType;
|
|
108
|
+
switch (current.tag) {
|
|
109
|
+
case 7: {
|
|
110
|
+
matchResult = 2;
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
case 8: {
|
|
114
|
+
matchResult = 3;
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
case 0:
|
|
118
|
+
case 1:
|
|
119
|
+
case 2:
|
|
120
|
+
case 3:
|
|
121
|
+
case 4:
|
|
122
|
+
case 12:
|
|
123
|
+
case 13:
|
|
124
|
+
case 14: {
|
|
125
|
+
matchResult = 5;
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
case 5: {
|
|
129
|
+
matchResult = 1;
|
|
130
|
+
item = current.fields[0];
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
case 6: {
|
|
134
|
+
matchResult = 1;
|
|
135
|
+
item = current.fields[0];
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
case 10: {
|
|
139
|
+
matchResult = 1;
|
|
140
|
+
item = current.fields[0];
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
case 9: {
|
|
144
|
+
matchResult = 4;
|
|
145
|
+
keyType = current.fields[0];
|
|
146
|
+
valueType = current.fields[1];
|
|
147
|
+
break;
|
|
148
|
+
}
|
|
149
|
+
case 11: {
|
|
150
|
+
matchResult = 4;
|
|
151
|
+
keyType = current.fields[0];
|
|
152
|
+
valueType = current.fields[1];
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
default:
|
|
156
|
+
matchResult = 0;
|
|
157
|
+
}
|
|
158
|
+
switch (matchResult) {
|
|
159
|
+
case 0:
|
|
160
|
+
return current.fields[0] === v;
|
|
161
|
+
case 1: {
|
|
162
|
+
current_mut = item;
|
|
163
|
+
continue loop;
|
|
164
|
+
}
|
|
165
|
+
case 2:
|
|
166
|
+
return exists(loop, current.fields[0]);
|
|
167
|
+
case 3:
|
|
168
|
+
return exists_1((_arg, fieldType) => loop(fieldType), current.fields[0]);
|
|
169
|
+
case 4:
|
|
170
|
+
if (loop(keyType)) {
|
|
171
|
+
return true;
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
current_mut = valueType;
|
|
175
|
+
continue loop;
|
|
176
|
+
}
|
|
177
|
+
default:
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
break;
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
return loop(t);
|
|
78
184
|
}
|
|
79
185
|
|
|
80
186
|
function unify(typeDefs, t1, t2, span) {
|
|
@@ -88,7 +194,7 @@ function unify(typeDefs, t1, t2, span) {
|
|
|
88
194
|
}
|
|
89
195
|
else {
|
|
90
196
|
const seen$0027 = FSharpSet__Add(seen, [a, b]);
|
|
91
|
-
let matchResult, x_1, y_1, x_2, y_2, x_3, y_3, xs, ys, xf, yf, kx, ky, vx, vy,
|
|
197
|
+
let matchResult, x_1, y_1, x_2, y_2, x_3, y_3, xs, ys, xf, yf, kx, ky, vx, vy, x_5, y_5, a1, a2, b1, b2, t, v, name_2, t_1, name_3, t_2;
|
|
92
198
|
switch (a.tag) {
|
|
93
199
|
case 0: {
|
|
94
200
|
switch (b.tag) {
|
|
@@ -104,7 +210,7 @@ function unify(typeDefs, t1, t2, span) {
|
|
|
104
210
|
}
|
|
105
211
|
case 12: {
|
|
106
212
|
matchResult = 11;
|
|
107
|
-
|
|
213
|
+
name_3 = b.fields[0];
|
|
108
214
|
t_2 = a;
|
|
109
215
|
break;
|
|
110
216
|
}
|
|
@@ -127,7 +233,7 @@ function unify(typeDefs, t1, t2, span) {
|
|
|
127
233
|
}
|
|
128
234
|
case 12: {
|
|
129
235
|
matchResult = 11;
|
|
130
|
-
|
|
236
|
+
name_3 = b.fields[0];
|
|
131
237
|
t_2 = a;
|
|
132
238
|
break;
|
|
133
239
|
}
|
|
@@ -150,7 +256,7 @@ function unify(typeDefs, t1, t2, span) {
|
|
|
150
256
|
}
|
|
151
257
|
case 12: {
|
|
152
258
|
matchResult = 11;
|
|
153
|
-
|
|
259
|
+
name_3 = b.fields[0];
|
|
154
260
|
t_2 = a;
|
|
155
261
|
break;
|
|
156
262
|
}
|
|
@@ -173,7 +279,7 @@ function unify(typeDefs, t1, t2, span) {
|
|
|
173
279
|
}
|
|
174
280
|
case 12: {
|
|
175
281
|
matchResult = 11;
|
|
176
|
-
|
|
282
|
+
name_3 = b.fields[0];
|
|
177
283
|
t_2 = a;
|
|
178
284
|
break;
|
|
179
285
|
}
|
|
@@ -196,7 +302,7 @@ function unify(typeDefs, t1, t2, span) {
|
|
|
196
302
|
}
|
|
197
303
|
case 12: {
|
|
198
304
|
matchResult = 11;
|
|
199
|
-
|
|
305
|
+
name_3 = b.fields[0];
|
|
200
306
|
t_2 = a;
|
|
201
307
|
break;
|
|
202
308
|
}
|
|
@@ -219,7 +325,7 @@ function unify(typeDefs, t1, t2, span) {
|
|
|
219
325
|
}
|
|
220
326
|
case 12: {
|
|
221
327
|
matchResult = 11;
|
|
222
|
-
|
|
328
|
+
name_3 = b.fields[0];
|
|
223
329
|
t_2 = a;
|
|
224
330
|
break;
|
|
225
331
|
}
|
|
@@ -238,7 +344,7 @@ function unify(typeDefs, t1, t2, span) {
|
|
|
238
344
|
}
|
|
239
345
|
else {
|
|
240
346
|
matchResult = 10;
|
|
241
|
-
|
|
347
|
+
name_2 = a.fields[0];
|
|
242
348
|
t_1 = b;
|
|
243
349
|
}
|
|
244
350
|
break;
|
|
@@ -251,7 +357,7 @@ function unify(typeDefs, t1, t2, span) {
|
|
|
251
357
|
}
|
|
252
358
|
default: {
|
|
253
359
|
matchResult = 10;
|
|
254
|
-
|
|
360
|
+
name_2 = a.fields[0];
|
|
255
361
|
t_1 = b;
|
|
256
362
|
}
|
|
257
363
|
}
|
|
@@ -273,7 +379,7 @@ function unify(typeDefs, t1, t2, span) {
|
|
|
273
379
|
}
|
|
274
380
|
case 12: {
|
|
275
381
|
matchResult = 11;
|
|
276
|
-
|
|
382
|
+
name_3 = b.fields[0];
|
|
277
383
|
t_2 = a;
|
|
278
384
|
break;
|
|
279
385
|
}
|
|
@@ -298,7 +404,7 @@ function unify(typeDefs, t1, t2, span) {
|
|
|
298
404
|
}
|
|
299
405
|
case 12: {
|
|
300
406
|
matchResult = 11;
|
|
301
|
-
|
|
407
|
+
name_3 = b.fields[0];
|
|
302
408
|
t_2 = a;
|
|
303
409
|
break;
|
|
304
410
|
}
|
|
@@ -323,7 +429,7 @@ function unify(typeDefs, t1, t2, span) {
|
|
|
323
429
|
}
|
|
324
430
|
case 12: {
|
|
325
431
|
matchResult = 11;
|
|
326
|
-
|
|
432
|
+
name_3 = b.fields[0];
|
|
327
433
|
t_2 = a;
|
|
328
434
|
break;
|
|
329
435
|
}
|
|
@@ -348,7 +454,7 @@ function unify(typeDefs, t1, t2, span) {
|
|
|
348
454
|
}
|
|
349
455
|
case 12: {
|
|
350
456
|
matchResult = 11;
|
|
351
|
-
|
|
457
|
+
name_3 = b.fields[0];
|
|
352
458
|
t_2 = a;
|
|
353
459
|
break;
|
|
354
460
|
}
|
|
@@ -375,7 +481,7 @@ function unify(typeDefs, t1, t2, span) {
|
|
|
375
481
|
}
|
|
376
482
|
case 12: {
|
|
377
483
|
matchResult = 11;
|
|
378
|
-
|
|
484
|
+
name_3 = b.fields[0];
|
|
379
485
|
t_2 = a;
|
|
380
486
|
break;
|
|
381
487
|
}
|
|
@@ -388,8 +494,8 @@ function unify(typeDefs, t1, t2, span) {
|
|
|
388
494
|
switch (b.tag) {
|
|
389
495
|
case 10: {
|
|
390
496
|
matchResult = 7;
|
|
391
|
-
|
|
392
|
-
|
|
497
|
+
x_5 = a.fields[0];
|
|
498
|
+
y_5 = b.fields[0];
|
|
393
499
|
break;
|
|
394
500
|
}
|
|
395
501
|
case 15: {
|
|
@@ -400,7 +506,7 @@ function unify(typeDefs, t1, t2, span) {
|
|
|
400
506
|
}
|
|
401
507
|
case 12: {
|
|
402
508
|
matchResult = 11;
|
|
403
|
-
|
|
509
|
+
name_3 = b.fields[0];
|
|
404
510
|
t_2 = a;
|
|
405
511
|
break;
|
|
406
512
|
}
|
|
@@ -427,7 +533,7 @@ function unify(typeDefs, t1, t2, span) {
|
|
|
427
533
|
}
|
|
428
534
|
case 12: {
|
|
429
535
|
matchResult = 11;
|
|
430
|
-
|
|
536
|
+
name_3 = b.fields[0];
|
|
431
537
|
t_2 = a;
|
|
432
538
|
break;
|
|
433
539
|
}
|
|
@@ -452,7 +558,7 @@ function unify(typeDefs, t1, t2, span) {
|
|
|
452
558
|
}
|
|
453
559
|
case 12: {
|
|
454
560
|
matchResult = 11;
|
|
455
|
-
|
|
561
|
+
name_3 = b.fields[0];
|
|
456
562
|
t_2 = a;
|
|
457
563
|
break;
|
|
458
564
|
}
|
|
@@ -484,26 +590,16 @@ function unify(typeDefs, t1, t2, span) {
|
|
|
484
590
|
return fold((sAcc, tupledArg) => compose(uni(seen$0027, applyType(sAcc, tupledArg[0]), applyType(sAcc, tupledArg[1])), sAcc), emptySubst, zip(xs, ys));
|
|
485
591
|
}
|
|
486
592
|
case 5: {
|
|
487
|
-
const
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
Compare: (x_6, y_6) => (comparePrimitives(x_6, y_6) | 0),
|
|
492
|
-
});
|
|
493
|
-
let patternInput;
|
|
494
|
-
if (isSubset(xKeys, yKeys)) {
|
|
495
|
-
patternInput = [xf, yf];
|
|
496
|
-
}
|
|
497
|
-
else if (isSubset(yKeys, xKeys)) {
|
|
498
|
-
patternInput = [yf, xf];
|
|
499
|
-
}
|
|
500
|
-
else {
|
|
593
|
+
const patternInput = (FSharpMap__get_Count(xf) <= FSharpMap__get_Count(yf)) ? [xf, yf] : [yf, xf];
|
|
594
|
+
const otherFields = patternInput[1];
|
|
595
|
+
const fieldsToCheck = patternInput[0];
|
|
596
|
+
if (exists_1((name, _arg) => !FSharpMap__ContainsKey(otherFields, name), fieldsToCheck)) {
|
|
501
597
|
throw new TypeException(new TypeError$("Record field set mismatch", span));
|
|
502
598
|
}
|
|
503
599
|
return fold((sAcc_1, tupledArg_1) => {
|
|
504
|
-
const yt = FSharpMap__get_Item(
|
|
600
|
+
const yt = FSharpMap__get_Item(otherFields, tupledArg_1[0]);
|
|
505
601
|
return compose(uni(seen$0027, applyType(sAcc_1, tupledArg_1[1]), applyType(sAcc_1, yt)), sAcc_1);
|
|
506
|
-
}, emptySubst, toList(
|
|
602
|
+
}, emptySubst, toList(fieldsToCheck));
|
|
507
603
|
}
|
|
508
604
|
case 6: {
|
|
509
605
|
const s1_2 = uni(seen$0027, kx, ky);
|
|
@@ -511,8 +607,8 @@ function unify(typeDefs, t1, t2, span) {
|
|
|
511
607
|
}
|
|
512
608
|
case 7: {
|
|
513
609
|
seen_mut = seen$0027;
|
|
514
|
-
a_mut =
|
|
515
|
-
b_mut =
|
|
610
|
+
a_mut = x_5;
|
|
611
|
+
b_mut = y_5;
|
|
516
612
|
continue uni;
|
|
517
613
|
}
|
|
518
614
|
case 8: {
|
|
@@ -520,7 +616,7 @@ function unify(typeDefs, t1, t2, span) {
|
|
|
520
616
|
return compose(uni(seen$0027, applyType(s1_3, b1), applyType(s1_3, b2)), s1_3);
|
|
521
617
|
}
|
|
522
618
|
case 9:
|
|
523
|
-
if (equals(t, new Type(15, [v]))) {
|
|
619
|
+
if (equals(t, new Type(/* TVar */ 15, [v]))) {
|
|
524
620
|
return emptySubst;
|
|
525
621
|
}
|
|
526
622
|
else if (occurs(v, t)) {
|
|
@@ -528,14 +624,14 @@ function unify(typeDefs, t1, t2, span) {
|
|
|
528
624
|
}
|
|
529
625
|
else {
|
|
530
626
|
return ofList(singleton([v, t]), {
|
|
531
|
-
Compare: (
|
|
627
|
+
Compare: (x_6, y_6) => (comparePrimitives(x_6, y_6) | 0),
|
|
532
628
|
});
|
|
533
629
|
}
|
|
534
630
|
case 10: {
|
|
535
|
-
const matchValue_1 = FSharpMap__TryFind(typeDefs,
|
|
631
|
+
const matchValue_1 = FSharpMap__TryFind(typeDefs, name_2);
|
|
536
632
|
let matchResult_1, expanded_1;
|
|
537
633
|
if (matchValue_1 != null) {
|
|
538
|
-
if (!equals(matchValue_1, new Type(12, [
|
|
634
|
+
if (!equals(matchValue_1, new Type(/* TNamed */ 12, [name_2]))) {
|
|
539
635
|
matchResult_1 = 0;
|
|
540
636
|
expanded_1 = matchValue_1;
|
|
541
637
|
}
|
|
@@ -556,7 +652,7 @@ function unify(typeDefs, t1, t2, span) {
|
|
|
556
652
|
default: {
|
|
557
653
|
let matchResult_2, other_1;
|
|
558
654
|
if (t_1.tag === 12) {
|
|
559
|
-
if (t_1.fields[0] ===
|
|
655
|
+
if (t_1.fields[0] === name_2) {
|
|
560
656
|
matchResult_2 = 0;
|
|
561
657
|
other_1 = t_1.fields[0];
|
|
562
658
|
}
|
|
@@ -577,10 +673,10 @@ function unify(typeDefs, t1, t2, span) {
|
|
|
577
673
|
}
|
|
578
674
|
}
|
|
579
675
|
case 11: {
|
|
580
|
-
const matchValue_2 = FSharpMap__TryFind(typeDefs,
|
|
676
|
+
const matchValue_2 = FSharpMap__TryFind(typeDefs, name_3);
|
|
581
677
|
let matchResult_3, expanded_3;
|
|
582
678
|
if (matchValue_2 != null) {
|
|
583
|
-
if (!equals(matchValue_2, new Type(12, [
|
|
679
|
+
if (!equals(matchValue_2, new Type(/* TNamed */ 12, [name_3]))) {
|
|
584
680
|
matchResult_3 = 0;
|
|
585
681
|
expanded_3 = matchValue_2;
|
|
586
682
|
}
|
|
@@ -601,7 +697,7 @@ function unify(typeDefs, t1, t2, span) {
|
|
|
601
697
|
default: {
|
|
602
698
|
let matchResult_4, other_3;
|
|
603
699
|
if (t_2.tag === 12) {
|
|
604
|
-
if (t_2.fields[0] ===
|
|
700
|
+
if (t_2.fields[0] === name_3) {
|
|
605
701
|
matchResult_4 = 0;
|
|
606
702
|
other_3 = t_2.fields[0];
|
|
607
703
|
}
|
|
@@ -629,7 +725,7 @@ function unify(typeDefs, t1, t2, span) {
|
|
|
629
725
|
}
|
|
630
726
|
};
|
|
631
727
|
return uni(empty_1({
|
|
632
|
-
Compare: (
|
|
728
|
+
Compare: (x_7, y_7) => (compareArrays(x_7, y_7) | 0),
|
|
633
729
|
}), t1, t2);
|
|
634
730
|
}
|
|
635
731
|
|
|
@@ -642,19 +738,19 @@ function instantiate(_arg) {
|
|
|
642
738
|
case 15:
|
|
643
739
|
return defaultArg(tryFind(t_1.fields[0], freshMap), t_1);
|
|
644
740
|
case 5:
|
|
645
|
-
return new Type(5, [subst(t_1.fields[0])]);
|
|
741
|
+
return new Type(/* TList */ 5, [subst(t_1.fields[0])]);
|
|
646
742
|
case 6:
|
|
647
|
-
return new Type(6, [subst(t_1.fields[0])]);
|
|
743
|
+
return new Type(/* TTask */ 6, [subst(t_1.fields[0])]);
|
|
648
744
|
case 7:
|
|
649
|
-
return new Type(7, [map(subst, t_1.fields[0])]);
|
|
745
|
+
return new Type(/* TTuple */ 7, [map(subst, t_1.fields[0])]);
|
|
650
746
|
case 8:
|
|
651
|
-
return new Type(8, [map_1((_arg_1, t1) => subst(t1), t_1.fields[0])]);
|
|
747
|
+
return new Type(/* TRecord */ 8, [map_1((_arg_1, t1) => subst(t1), t_1.fields[0])]);
|
|
652
748
|
case 9:
|
|
653
|
-
return new Type(9, [subst(t_1.fields[0]), subst(t_1.fields[1])]);
|
|
749
|
+
return new Type(/* TMap */ 9, [subst(t_1.fields[0]), subst(t_1.fields[1])]);
|
|
654
750
|
case 10:
|
|
655
|
-
return new Type(10, [subst(t_1.fields[0])]);
|
|
751
|
+
return new Type(/* TOption */ 10, [subst(t_1.fields[0])]);
|
|
656
752
|
case 11:
|
|
657
|
-
return new Type(11, [subst(t_1.fields[0]), subst(t_1.fields[1])]);
|
|
753
|
+
return new Type(/* TFun */ 11, [subst(t_1.fields[0]), subst(t_1.fields[1])]);
|
|
658
754
|
default:
|
|
659
755
|
return t_1;
|
|
660
756
|
}
|
|
@@ -728,21 +824,22 @@ function InferenceTelemetry_$reflection() {
|
|
|
728
824
|
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())]]);
|
|
729
825
|
}
|
|
730
826
|
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
function beginTelemetry() {
|
|
734
|
-
telemetry = (new InferenceTelemetry(singleton(empty_1({
|
|
827
|
+
function createTelemetry() {
|
|
828
|
+
return new InferenceTelemetry(singleton(empty_1({
|
|
735
829
|
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
736
|
-
})), [])
|
|
830
|
+
})), []);
|
|
737
831
|
}
|
|
738
832
|
|
|
739
|
-
function
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
833
|
+
function capturedLocalVariableTypes(telemetry) {
|
|
834
|
+
if (telemetry == null) {
|
|
835
|
+
return empty_2();
|
|
836
|
+
}
|
|
837
|
+
else {
|
|
838
|
+
return toList_1(map_2((item) => (new LocalVariableTypeInfo(item.Name, item.Span, item.Type)), telemetry.LocalVariableTypes));
|
|
839
|
+
}
|
|
743
840
|
}
|
|
744
841
|
|
|
745
|
-
function withLocalBindings(names, work) {
|
|
842
|
+
function withLocalBindings(telemetry, names, work) {
|
|
746
843
|
let matchValue;
|
|
747
844
|
if (telemetry != null) {
|
|
748
845
|
const t = telemetry;
|
|
@@ -753,7 +850,7 @@ function withLocalBindings(names, work) {
|
|
|
753
850
|
else {
|
|
754
851
|
return add_1(name, acc);
|
|
755
852
|
}
|
|
756
|
-
}, (matchValue = t.ScopeStack,
|
|
853
|
+
}, (matchValue = t.ScopeStack, isEmpty_1(matchValue) ? empty_1({
|
|
757
854
|
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
758
855
|
}) : head_1(matchValue)), names);
|
|
759
856
|
t.ScopeStack = cons(pushed, t.ScopeStack);
|
|
@@ -762,7 +859,7 @@ function withLocalBindings(names, work) {
|
|
|
762
859
|
}
|
|
763
860
|
finally {
|
|
764
861
|
const matchValue_1 = t.ScopeStack;
|
|
765
|
-
if (
|
|
862
|
+
if (isEmpty_1(matchValue_1)) {
|
|
766
863
|
}
|
|
767
864
|
else {
|
|
768
865
|
t.ScopeStack = tail_2(matchValue_1);
|
|
@@ -774,11 +871,11 @@ function withLocalBindings(names, work) {
|
|
|
774
871
|
}
|
|
775
872
|
}
|
|
776
873
|
|
|
777
|
-
function recordLocalVariableUse(name, span, varType) {
|
|
874
|
+
function recordLocalVariableUse(telemetry, name, span, varType) {
|
|
778
875
|
let matchValue;
|
|
779
876
|
if (telemetry != null) {
|
|
780
877
|
const t = telemetry;
|
|
781
|
-
if (contains(name, (matchValue = t.ScopeStack,
|
|
878
|
+
if (contains(name, (matchValue = t.ScopeStack, isEmpty_1(matchValue) ? empty_1({
|
|
782
879
|
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
783
880
|
}) : head_1(matchValue)))) {
|
|
784
881
|
void (t.LocalVariableTypes.push(new LocalVariableTypeCapture(name, span, varType)));
|
|
@@ -786,7 +883,7 @@ function recordLocalVariableUse(name, span, varType) {
|
|
|
786
883
|
}
|
|
787
884
|
}
|
|
788
885
|
|
|
789
|
-
function recordLocalVariableDeclaration(name, span, varType) {
|
|
886
|
+
function recordLocalVariableDeclaration(telemetry, name, span, varType) {
|
|
790
887
|
if (isNullOrWhiteSpace(name) ? true : (name === "_")) {
|
|
791
888
|
}
|
|
792
889
|
else if (telemetry != null) {
|
|
@@ -795,7 +892,7 @@ function recordLocalVariableDeclaration(name, span, varType) {
|
|
|
795
892
|
}
|
|
796
893
|
}
|
|
797
894
|
|
|
798
|
-
function applySubstToCapturedLocals(startIndex, subst) {
|
|
895
|
+
function applySubstToCapturedLocals(telemetry, startIndex, subst) {
|
|
799
896
|
if (telemetry != null) {
|
|
800
897
|
const t = telemetry;
|
|
801
898
|
for (let i = startIndex; i <= (t.LocalVariableTypes.length - 1); i++) {
|
|
@@ -805,7 +902,7 @@ function applySubstToCapturedLocals(startIndex, subst) {
|
|
|
805
902
|
}
|
|
806
903
|
}
|
|
807
904
|
|
|
808
|
-
function currentTelemetryCaptureCount() {
|
|
905
|
+
function currentTelemetryCaptureCount(telemetry) {
|
|
809
906
|
if (telemetry == null) {
|
|
810
907
|
return 0;
|
|
811
908
|
}
|
|
@@ -834,15 +931,15 @@ function asTyped(expr, t) {
|
|
|
834
931
|
function builtinType(name) {
|
|
835
932
|
switch (name) {
|
|
836
933
|
case "unit":
|
|
837
|
-
return
|
|
934
|
+
return Type.TUnit;
|
|
838
935
|
case "int":
|
|
839
|
-
return
|
|
936
|
+
return Type.TInt;
|
|
840
937
|
case "float":
|
|
841
|
-
return
|
|
938
|
+
return Type.TFloat;
|
|
842
939
|
case "bool":
|
|
843
|
-
return
|
|
940
|
+
return Type.TBool;
|
|
844
941
|
case "string":
|
|
845
|
-
return
|
|
942
|
+
return Type.TString;
|
|
846
943
|
default:
|
|
847
944
|
return undefined;
|
|
848
945
|
}
|
|
@@ -871,14 +968,14 @@ function resolveNamedRecordByShape(typeDefs, shape, span) {
|
|
|
871
968
|
return undefined;
|
|
872
969
|
}
|
|
873
970
|
}, toList(typeDefs));
|
|
874
|
-
if (
|
|
875
|
-
throw new TypeException(new TypeError$(concat("No declared record type matches shape ", Types_typeToString(new Type(8, [shape]))), span));
|
|
971
|
+
if (isEmpty_1(matches)) {
|
|
972
|
+
throw new TypeException(new TypeError$(concat("No declared record type matches shape ", Types_typeToString(new Type(/* TRecord */ 8, [shape]))), span));
|
|
876
973
|
}
|
|
877
|
-
else if (
|
|
878
|
-
return new Type(12, [head_1(matches)]);
|
|
974
|
+
else if (isEmpty_1(tail_2(matches))) {
|
|
975
|
+
return new Type(/* TNamed */ 12, [head_1(matches)]);
|
|
879
976
|
}
|
|
880
977
|
else {
|
|
881
|
-
throw new TypeException(new TypeError$(concat("Ambiguous declared record type for shape ", Types_typeToString(new Type(8, [shape])), ": ", join(", ", matches)), span));
|
|
978
|
+
throw new TypeException(new TypeError$(concat("Ambiguous declared record type for shape ", Types_typeToString(new Type(/* TRecord */ 8, [shape])), ": ", join(", ", matches)), span));
|
|
882
979
|
}
|
|
883
980
|
}
|
|
884
981
|
|
|
@@ -907,10 +1004,10 @@ function resolveNamedRecordByFieldSet(typeDefs, fields, span) {
|
|
|
907
1004
|
return undefined;
|
|
908
1005
|
}
|
|
909
1006
|
}, toList(typeDefs));
|
|
910
|
-
if (
|
|
1007
|
+
if (isEmpty_1(matches)) {
|
|
911
1008
|
throw new TypeException(new TypeError$(concat("No declared record type matches fields ", concat("{ ", join("; ", toList_2(fields)), " }")), span));
|
|
912
1009
|
}
|
|
913
|
-
else if (
|
|
1010
|
+
else if (isEmpty_1(tail_2(matches))) {
|
|
914
1011
|
return head_1(matches);
|
|
915
1012
|
}
|
|
916
1013
|
else {
|
|
@@ -937,10 +1034,10 @@ function resolveReferencedTypeName(knownNames, name, span) {
|
|
|
937
1034
|
Equals: (x_1, y_1) => (x_1 === y_1),
|
|
938
1035
|
GetHashCode: (x_1) => (stringHash(x_1) | 0),
|
|
939
1036
|
}));
|
|
940
|
-
if (
|
|
1037
|
+
if (isEmpty_1(matches)) {
|
|
941
1038
|
return name;
|
|
942
1039
|
}
|
|
943
|
-
else if (
|
|
1040
|
+
else if (isEmpty_1(tail_2(matches))) {
|
|
944
1041
|
return head_1(matches);
|
|
945
1042
|
}
|
|
946
1043
|
else {
|
|
@@ -955,19 +1052,19 @@ function resolveReferencedTypeName(knownNames, name, span) {
|
|
|
955
1052
|
function annotationTypeFromRef(typeDefs, span, tref) {
|
|
956
1053
|
switch (tref.tag) {
|
|
957
1054
|
case 1:
|
|
958
|
-
return new Type(7, [map((tref_1) => annotationTypeFromRef(typeDefs, span, tref_1), tref.fields[0])]);
|
|
1055
|
+
return new Type(/* TTuple */ 7, [map((tref_1) => annotationTypeFromRef(typeDefs, span, tref_1), tref.fields[0])]);
|
|
959
1056
|
case 2:
|
|
960
|
-
return new Type(11, [annotationTypeFromRef(typeDefs, span, tref.fields[0]), annotationTypeFromRef(typeDefs, span, tref.fields[1])]);
|
|
1057
|
+
return new Type(/* TFun */ 11, [annotationTypeFromRef(typeDefs, span, tref.fields[0]), annotationTypeFromRef(typeDefs, span, tref.fields[1])]);
|
|
961
1058
|
case 3:
|
|
962
1059
|
switch (tref.fields[1]) {
|
|
963
1060
|
case "list":
|
|
964
|
-
return new Type(5, [annotationTypeFromRef(typeDefs, span, tref.fields[0])]);
|
|
1061
|
+
return new Type(/* TList */ 5, [annotationTypeFromRef(typeDefs, span, tref.fields[0])]);
|
|
965
1062
|
case "task":
|
|
966
|
-
return new Type(6, [annotationTypeFromRef(typeDefs, span, tref.fields[0])]);
|
|
1063
|
+
return new Type(/* TTask */ 6, [annotationTypeFromRef(typeDefs, span, tref.fields[0])]);
|
|
967
1064
|
case "option":
|
|
968
|
-
return new Type(10, [annotationTypeFromRef(typeDefs, span, tref.fields[0])]);
|
|
1065
|
+
return new Type(/* TOption */ 10, [annotationTypeFromRef(typeDefs, span, tref.fields[0])]);
|
|
969
1066
|
case "map":
|
|
970
|
-
return new Type(9, [
|
|
1067
|
+
return new Type(/* TMap */ 9, [Type.TString, annotationTypeFromRef(typeDefs, span, tref.fields[0])]);
|
|
971
1068
|
default:
|
|
972
1069
|
throw new TypeException(new TypeError$(concat("Unknown type suffix \'", tref.fields[1], "\'"), span));
|
|
973
1070
|
}
|
|
@@ -976,23 +1073,23 @@ function annotationTypeFromRef(typeDefs, span, tref) {
|
|
|
976
1073
|
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
977
1074
|
}), span);
|
|
978
1075
|
case 5:
|
|
979
|
-
return new Type(8, [ofList(map((tupledArg_1) => [tupledArg_1[0], annotationTypeFromRef(typeDefs, span, tupledArg_1[1])], tref.fields[0]), {
|
|
1076
|
+
return new Type(/* TRecord */ 8, [ofList(map((tupledArg_1) => [tupledArg_1[0], annotationTypeFromRef(typeDefs, span, tupledArg_1[1])], tref.fields[0]), {
|
|
980
1077
|
Compare: (x_1, y_1) => (comparePrimitives(x_1, y_1) | 0),
|
|
981
1078
|
})]);
|
|
982
1079
|
default:
|
|
983
1080
|
switch (tref.fields[0]) {
|
|
984
1081
|
case "unit":
|
|
985
|
-
return
|
|
1082
|
+
return Type.TUnit;
|
|
986
1083
|
case "int":
|
|
987
|
-
return
|
|
1084
|
+
return Type.TInt;
|
|
988
1085
|
case "float":
|
|
989
|
-
return
|
|
1086
|
+
return Type.TFloat;
|
|
990
1087
|
case "bool":
|
|
991
|
-
return
|
|
1088
|
+
return Type.TBool;
|
|
992
1089
|
case "string":
|
|
993
|
-
return
|
|
1090
|
+
return Type.TString;
|
|
994
1091
|
default:
|
|
995
|
-
return new Type(12, [resolveReferencedTypeName(FSharpMap__get_Keys(typeDefs), tref.fields[0], span)]);
|
|
1092
|
+
return new Type(/* TNamed */ 12, [resolveReferencedTypeName(FSharpMap__get_Keys(typeDefs), tref.fields[0], span)]);
|
|
996
1093
|
}
|
|
997
1094
|
}
|
|
998
1095
|
}
|
|
@@ -1015,31 +1112,31 @@ function functionReturnType(t_mut) {
|
|
|
1015
1112
|
function typeFromRef(decls, stack, tref) {
|
|
1016
1113
|
switch (tref.tag) {
|
|
1017
1114
|
case 1:
|
|
1018
|
-
return new Type(7, [map((tref_1) => typeFromRef(decls, stack, tref_1), tref.fields[0])]);
|
|
1115
|
+
return new Type(/* TTuple */ 7, [map((tref_1) => typeFromRef(decls, stack, tref_1), tref.fields[0])]);
|
|
1019
1116
|
case 2:
|
|
1020
|
-
return new Type(11, [typeFromRef(decls, stack, tref.fields[0]), typeFromRef(decls, stack, tref.fields[1])]);
|
|
1117
|
+
return new Type(/* TFun */ 11, [typeFromRef(decls, stack, tref.fields[0]), typeFromRef(decls, stack, tref.fields[1])]);
|
|
1021
1118
|
case 3: {
|
|
1022
1119
|
const suffix = tref.fields[1];
|
|
1023
1120
|
const resolved = typeFromRef(decls, stack, tref.fields[0]);
|
|
1024
1121
|
switch (suffix) {
|
|
1025
1122
|
case "list":
|
|
1026
|
-
return new Type(5, [resolved]);
|
|
1123
|
+
return new Type(/* TList */ 5, [resolved]);
|
|
1027
1124
|
case "task":
|
|
1028
|
-
return new Type(6, [resolved]);
|
|
1125
|
+
return new Type(/* TTask */ 6, [resolved]);
|
|
1029
1126
|
case "option":
|
|
1030
|
-
return new Type(10, [resolved]);
|
|
1127
|
+
return new Type(/* TOption */ 10, [resolved]);
|
|
1031
1128
|
case "map":
|
|
1032
|
-
return new Type(9, [
|
|
1129
|
+
return new Type(/* TMap */ 9, [Type.TString, resolved]);
|
|
1033
1130
|
default:
|
|
1034
1131
|
throw new TypeException(new TypeError$(concat("Unknown type suffix \'", suffix, "\'"), unknownSpan));
|
|
1035
1132
|
}
|
|
1036
1133
|
}
|
|
1037
1134
|
case 4:
|
|
1038
|
-
return new Type(8, [ofList(map((tupledArg_1) => [tupledArg_1[0], typeFromRef(decls, stack, tupledArg_1[1])], tref.fields[0]), {
|
|
1135
|
+
return new Type(/* TRecord */ 8, [ofList(map((tupledArg_1) => [tupledArg_1[0], typeFromRef(decls, stack, tupledArg_1[1])], tref.fields[0]), {
|
|
1039
1136
|
Compare: (x_1, y_2) => (comparePrimitives(x_1, y_2) | 0),
|
|
1040
1137
|
})]);
|
|
1041
1138
|
case 5:
|
|
1042
|
-
return new Type(8, [ofList(map((tupledArg_2) => [tupledArg_2[0], typeFromRef(decls, stack, tupledArg_2[1])], tref.fields[0]), {
|
|
1139
|
+
return new Type(/* TRecord */ 8, [ofList(map((tupledArg_2) => [tupledArg_2[0], typeFromRef(decls, stack, tupledArg_2[1])], tref.fields[0]), {
|
|
1043
1140
|
Compare: (x_2, y_3) => (comparePrimitives(x_2, y_3) | 0),
|
|
1044
1141
|
})]);
|
|
1045
1142
|
default: {
|
|
@@ -1049,24 +1146,24 @@ function typeFromRef(decls, stack, tref) {
|
|
|
1049
1146
|
const resolvedName = resolveReferencedTypeName(FSharpMap__get_Keys(decls), name, unknownSpan);
|
|
1050
1147
|
const matchValue_1 = FSharpMap__TryFind(decls, resolvedName);
|
|
1051
1148
|
if (matchValue_1 == null) {
|
|
1052
|
-
return new Type(12, [resolvedName]);
|
|
1149
|
+
return new Type(/* TNamed */ 12, [resolvedName]);
|
|
1053
1150
|
}
|
|
1054
1151
|
else {
|
|
1055
1152
|
const def = matchValue_1;
|
|
1056
1153
|
const matchValue_2 = tryFindIndex((y) => (resolvedName === y), stack);
|
|
1057
1154
|
if (matchValue_2 == null) {
|
|
1058
|
-
if (!
|
|
1059
|
-
return new Type(12, [resolvedName]);
|
|
1155
|
+
if (!isEmpty_1(def.Cases)) {
|
|
1156
|
+
return new Type(/* TNamed */ 12, [resolvedName]);
|
|
1060
1157
|
}
|
|
1061
1158
|
else {
|
|
1062
|
-
return new Type(8, [ofList(map((tupledArg) => [tupledArg[0], typeFromRef(decls, cons(resolvedName, stack), tupledArg[1])], def.Fields), {
|
|
1159
|
+
return new Type(/* TRecord */ 8, [ofList(map((tupledArg) => [tupledArg[0], typeFromRef(decls, cons(resolvedName, stack), tupledArg[1])], def.Fields), {
|
|
1063
1160
|
Compare: (x, y_1) => (comparePrimitives(x, y_1) | 0),
|
|
1064
1161
|
})]);
|
|
1065
1162
|
}
|
|
1066
1163
|
}
|
|
1067
1164
|
else if (matchValue_2 === 0) {
|
|
1068
1165
|
if (def.IsRecursive) {
|
|
1069
|
-
return new Type(12, [resolvedName]);
|
|
1166
|
+
return new Type(/* TNamed */ 12, [resolvedName]);
|
|
1070
1167
|
}
|
|
1071
1168
|
else {
|
|
1072
1169
|
throw new TypeException(new TypeError$(concat("Recursive type \'", resolvedName, "\' requires \'type rec\'"), unknownSpan));
|
|
@@ -1084,20 +1181,20 @@ function typeFromRef(decls, stack, tref) {
|
|
|
1084
1181
|
}
|
|
1085
1182
|
}
|
|
1086
1183
|
|
|
1087
|
-
function inferPattern(typeDefs, constructors, pat) {
|
|
1184
|
+
function inferPattern(telemetry, typeDefs, constructors, pat) {
|
|
1088
1185
|
let table_5;
|
|
1089
1186
|
switch (pat.tag) {
|
|
1090
1187
|
case 1: {
|
|
1091
1188
|
const name = pat.fields[0];
|
|
1092
1189
|
const tv = Types_freshVar();
|
|
1093
|
-
recordLocalVariableDeclaration(name, Ast_spanOfPattern(pat), tv);
|
|
1190
|
+
recordLocalVariableDeclaration(telemetry, name, Ast_spanOfPattern(pat), tv);
|
|
1094
1191
|
return [ofList(singleton([name, tv]), {
|
|
1095
1192
|
Compare: (x_1, y_1) => (comparePrimitives(x_1, y_1) | 0),
|
|
1096
1193
|
}), tv];
|
|
1097
1194
|
}
|
|
1098
1195
|
case 2: {
|
|
1099
1196
|
const lit = pat.fields[0];
|
|
1100
|
-
const t = (lit.tag === 1) ?
|
|
1197
|
+
const t = (lit.tag === 1) ? Type.TFloat : ((lit.tag === 2) ? Type.TBool : ((lit.tag === 3) ? Type.TString : Type.TInt));
|
|
1101
1198
|
return [empty({
|
|
1102
1199
|
Compare: (x_2, y_2) => (comparePrimitives(x_2, y_2) | 0),
|
|
1103
1200
|
}), t];
|
|
@@ -1106,43 +1203,43 @@ function inferPattern(typeDefs, constructors, pat) {
|
|
|
1106
1203
|
const tv_1 = Types_freshVar();
|
|
1107
1204
|
return [empty({
|
|
1108
1205
|
Compare: (x_3, y_3) => (comparePrimitives(x_3, y_3) | 0),
|
|
1109
|
-
}), new Type(5, [tv_1])];
|
|
1206
|
+
}), new Type(/* TList */ 5, [tv_1])];
|
|
1110
1207
|
}
|
|
1111
1208
|
case 4: {
|
|
1112
|
-
const startIndex = currentTelemetryCaptureCount() | 0;
|
|
1113
|
-
const patternInput = inferPattern(typeDefs, constructors, pat.fields[0]);
|
|
1209
|
+
const startIndex = currentTelemetryCaptureCount(telemetry) | 0;
|
|
1210
|
+
const patternInput = inferPattern(telemetry, typeDefs, constructors, pat.fields[0]);
|
|
1114
1211
|
const t1 = patternInput[1];
|
|
1115
|
-
const patternInput_1 = inferPattern(typeDefs, constructors, pat.fields[1]);
|
|
1212
|
+
const patternInput_1 = inferPattern(telemetry, typeDefs, constructors, pat.fields[1]);
|
|
1116
1213
|
const s = unify(empty({
|
|
1117
1214
|
Compare: (x_4, y_4) => (comparePrimitives(x_4, y_4) | 0),
|
|
1118
|
-
}), patternInput_1[1], new Type(5, [t1]), pat.fields[2]);
|
|
1119
|
-
applySubstToCapturedLocals(startIndex, s);
|
|
1120
|
-
return [map_1((_arg, ty) => applyType(s, ty), fold_1((acc, k, v) => add(k, v, acc), patternInput[0], patternInput_1[0])), applyType(s, new Type(5, [t1]))];
|
|
1215
|
+
}), patternInput_1[1], new Type(/* TList */ 5, [t1]), pat.fields[2]);
|
|
1216
|
+
applySubstToCapturedLocals(telemetry, startIndex, s);
|
|
1217
|
+
return [map_1((_arg, ty) => applyType(s, ty), fold_1((acc, k, v) => add(k, v, acc), patternInput[0], patternInput_1[0])), applyType(s, new Type(/* TList */ 5, [t1]))];
|
|
1121
1218
|
}
|
|
1122
1219
|
case 5: {
|
|
1123
1220
|
const patternInput_3 = fold((tupledArg, p) => {
|
|
1124
|
-
const patternInput_2 = inferPattern(typeDefs, constructors, p);
|
|
1221
|
+
const patternInput_2 = inferPattern(telemetry, typeDefs, constructors, p);
|
|
1125
1222
|
return [fold_1((acc_1, k_1, v_1) => add(k_1, v_1, acc_1), tupledArg[0], patternInput_2[0]), cons(patternInput_2[1], tupledArg[1])];
|
|
1126
1223
|
}, [empty({
|
|
1127
1224
|
Compare: (x_5, y_5) => (comparePrimitives(x_5, y_5) | 0),
|
|
1128
1225
|
}), empty_2()], pat.fields[0]);
|
|
1129
|
-
return [patternInput_3[0], new Type(7, [reverse(patternInput_3[1])])];
|
|
1226
|
+
return [patternInput_3[0], new Type(/* TTuple */ 7, [reverse(patternInput_3[1])])];
|
|
1130
1227
|
}
|
|
1131
1228
|
case 6: {
|
|
1132
1229
|
const patternInput_5 = fold((tupledArg_1, tupledArg_2) => {
|
|
1133
|
-
const patternInput_4 = inferPattern(typeDefs, constructors, tupledArg_2[1]);
|
|
1230
|
+
const patternInput_4 = inferPattern(telemetry, typeDefs, constructors, tupledArg_2[1]);
|
|
1134
1231
|
return [fold_1((acc_2, k_2, v_2) => add(k_2, v_2, acc_2), tupledArg_1[0], patternInput_4[0]), add(tupledArg_2[0], patternInput_4[1], tupledArg_1[1])];
|
|
1135
1232
|
}, [empty({
|
|
1136
1233
|
Compare: (x_6, y_6) => (comparePrimitives(x_6, y_6) | 0),
|
|
1137
1234
|
}), empty({
|
|
1138
1235
|
Compare: (x_7, y_7) => (comparePrimitives(x_7, y_7) | 0),
|
|
1139
1236
|
})], pat.fields[0]);
|
|
1140
|
-
return [patternInput_5[0], new Type(8, [patternInput_5[1]])];
|
|
1237
|
+
return [patternInput_5[0], new Type(/* TRecord */ 8, [patternInput_5[1]])];
|
|
1141
1238
|
}
|
|
1142
1239
|
case 7: {
|
|
1143
1240
|
const tailPattern = pat.fields[1];
|
|
1144
1241
|
const span_1 = pat.fields[2];
|
|
1145
|
-
const startIndex_1 = currentTelemetryCaptureCount() | 0;
|
|
1242
|
+
const startIndex_1 = currentTelemetryCaptureCount(telemetry) | 0;
|
|
1146
1243
|
const ensureSupportedMapKeyType = (t_1) => {
|
|
1147
1244
|
switch (t_1.tag) {
|
|
1148
1245
|
case 4:
|
|
@@ -1163,8 +1260,8 @@ function inferPattern(typeDefs, constructors, pat) {
|
|
|
1163
1260
|
try {
|
|
1164
1261
|
while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
|
|
1165
1262
|
const forLoopVar = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
1166
|
-
const patternInput_6 = inferPattern(typeDefs, constructors, forLoopVar[0]);
|
|
1167
|
-
const patternInput_7 = inferPattern(typeDefs, constructors, forLoopVar[1]);
|
|
1263
|
+
const patternInput_6 = inferPattern(telemetry, typeDefs, constructors, forLoopVar[0]);
|
|
1264
|
+
const patternInput_7 = inferPattern(telemetry, typeDefs, constructors, forLoopVar[1]);
|
|
1168
1265
|
const sKey = unify(typeDefs, applyType(sAcc, patternInput_6[1]), applyType(sAcc, mapKeyType), span_1);
|
|
1169
1266
|
sAcc = compose(sKey, sAcc);
|
|
1170
1267
|
ensureSupportedMapKeyType(applyType(sAcc, mapKeyType));
|
|
@@ -1180,25 +1277,25 @@ function inferPattern(typeDefs, constructors, pat) {
|
|
|
1180
1277
|
if (tailPattern == null) {
|
|
1181
1278
|
}
|
|
1182
1279
|
else {
|
|
1183
|
-
const patternInput_8 = inferPattern(typeDefs, constructors, tailPattern);
|
|
1184
|
-
const expectedTailType = new Type(9, [applyType(sAcc, mapKeyType), applyType(sAcc, valueType)]);
|
|
1280
|
+
const patternInput_8 = inferPattern(telemetry, typeDefs, constructors, tailPattern);
|
|
1281
|
+
const expectedTailType = new Type(/* TMap */ 9, [applyType(sAcc, mapKeyType), applyType(sAcc, valueType)]);
|
|
1185
1282
|
const sTail = unify(typeDefs, applyType(sAcc, patternInput_8[1]), expectedTailType, span_1);
|
|
1186
1283
|
sAcc = compose(sTail, sAcc);
|
|
1187
1284
|
envAcc_2 = ((table_5 = map_1((_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)));
|
|
1188
1285
|
}
|
|
1189
1286
|
ensureSupportedMapKeyType(applyType(sAcc, mapKeyType));
|
|
1190
|
-
applySubstToCapturedLocals(startIndex_1, sAcc);
|
|
1191
|
-
return [map_1((_arg_3, t_4) => applyType(sAcc, t_4), envAcc_2), new Type(9, [applyType(sAcc, mapKeyType), applyType(sAcc, valueType)])];
|
|
1287
|
+
applySubstToCapturedLocals(telemetry, startIndex_1, sAcc);
|
|
1288
|
+
return [map_1((_arg_3, t_4) => applyType(sAcc, t_4), envAcc_2), new Type(/* TMap */ 9, [applyType(sAcc, mapKeyType), applyType(sAcc, valueType)])];
|
|
1192
1289
|
}
|
|
1193
1290
|
case 8: {
|
|
1194
|
-
const patternInput_9 = inferPattern(typeDefs, constructors, pat.fields[0]);
|
|
1195
|
-
return [patternInput_9[0], new Type(10, [patternInput_9[1]])];
|
|
1291
|
+
const patternInput_9 = inferPattern(telemetry, typeDefs, constructors, pat.fields[0]);
|
|
1292
|
+
return [patternInput_9[0], new Type(/* TOption */ 10, [patternInput_9[1]])];
|
|
1196
1293
|
}
|
|
1197
1294
|
case 9: {
|
|
1198
1295
|
const tv_2 = Types_freshVar();
|
|
1199
1296
|
return [empty({
|
|
1200
1297
|
Compare: (x_9, y_9) => (comparePrimitives(x_9, y_9) | 0),
|
|
1201
|
-
}), new Type(10, [tv_2])];
|
|
1298
|
+
}), new Type(/* TOption */ 10, [tv_2])];
|
|
1202
1299
|
}
|
|
1203
1300
|
case 10: {
|
|
1204
1301
|
const span_2 = pat.fields[3];
|
|
@@ -1209,7 +1306,7 @@ function inferPattern(typeDefs, constructors, pat) {
|
|
|
1209
1306
|
const matchValue = FSharpMap__TryFind(constructors, constructorName);
|
|
1210
1307
|
if (matchValue != null) {
|
|
1211
1308
|
const sigInfo = matchValue;
|
|
1212
|
-
const unionType = new Type(12, [sigInfo.UnionName]);
|
|
1309
|
+
const unionType = new Type(/* TNamed */ 12, [sigInfo.UnionName]);
|
|
1213
1310
|
const matchValue_1 = sigInfo.Payload;
|
|
1214
1311
|
if (matchValue_1 != null) {
|
|
1215
1312
|
if (payload == null) {
|
|
@@ -1218,10 +1315,10 @@ function inferPattern(typeDefs, constructors, pat) {
|
|
|
1218
1315
|
else {
|
|
1219
1316
|
const expectedPayload = matchValue_1;
|
|
1220
1317
|
const payloadPattern = payload;
|
|
1221
|
-
const startIndex_2 = currentTelemetryCaptureCount() | 0;
|
|
1222
|
-
const patternInput_10 = inferPattern(typeDefs, constructors, payloadPattern);
|
|
1318
|
+
const startIndex_2 = currentTelemetryCaptureCount(telemetry) | 0;
|
|
1319
|
+
const patternInput_10 = inferPattern(telemetry, typeDefs, constructors, payloadPattern);
|
|
1223
1320
|
const s_1 = unify(typeDefs, patternInput_10[1], expectedPayload, span_2);
|
|
1224
|
-
applySubstToCapturedLocals(startIndex_2, s_1);
|
|
1321
|
+
applySubstToCapturedLocals(telemetry, startIndex_2, s_1);
|
|
1225
1322
|
return [map_1((_arg_4, t_6) => applyType(s_1, t_6), patternInput_10[0]), unionType];
|
|
1226
1323
|
}
|
|
1227
1324
|
}
|
|
@@ -1255,7 +1352,7 @@ function numericResult(t, span) {
|
|
|
1255
1352
|
case 2:
|
|
1256
1353
|
return t;
|
|
1257
1354
|
case 15:
|
|
1258
|
-
return
|
|
1355
|
+
return Type.TInt;
|
|
1259
1356
|
default:
|
|
1260
1357
|
throw new TypeException(new TypeError$("Expected numeric type", span));
|
|
1261
1358
|
}
|
|
@@ -1319,12 +1416,12 @@ function validateMapKeyTypes(span, t) {
|
|
|
1319
1416
|
loop(t);
|
|
1320
1417
|
}
|
|
1321
1418
|
|
|
1322
|
-
function inferExpr(typeDefs, constructors, env, expr) {
|
|
1419
|
+
function inferExpr(telemetry, typeDefs, constructors, env, expr) {
|
|
1323
1420
|
let expectedReturn, expectedReturn_1;
|
|
1324
1421
|
switch (expr.tag) {
|
|
1325
1422
|
case 1: {
|
|
1326
1423
|
const lit = expr.fields[0];
|
|
1327
|
-
const t = (lit.tag === 1) ?
|
|
1424
|
+
const t = (lit.tag === 1) ? Type.TFloat : ((lit.tag === 2) ? Type.TBool : ((lit.tag === 3) ? Type.TString : Type.TInt));
|
|
1328
1425
|
return [emptySubst, t, asTyped(expr, t)];
|
|
1329
1426
|
}
|
|
1330
1427
|
case 2: {
|
|
@@ -1336,19 +1433,19 @@ function inferExpr(typeDefs, constructors, env, expr) {
|
|
|
1336
1433
|
}
|
|
1337
1434
|
else {
|
|
1338
1435
|
const t_1 = instantiate(matchValue);
|
|
1339
|
-
recordLocalVariableUse(name, span, t_1);
|
|
1436
|
+
recordLocalVariableUse(telemetry, name, span, t_1);
|
|
1340
1437
|
return [emptySubst, t_1, asTyped(expr, t_1)];
|
|
1341
1438
|
}
|
|
1342
1439
|
}
|
|
1343
1440
|
case 3: {
|
|
1344
|
-
const patternInput = inferExpr(typeDefs, constructors, env, expr.fields[0]);
|
|
1441
|
+
const patternInput = inferExpr(telemetry, typeDefs, constructors, env, expr.fields[0]);
|
|
1345
1442
|
const t_2 = patternInput[1];
|
|
1346
1443
|
return [patternInput[0], t_2, asTyped(expr, t_2)];
|
|
1347
1444
|
}
|
|
1348
1445
|
case 28: {
|
|
1349
1446
|
const name_1 = expr.fields[0];
|
|
1350
1447
|
if (FSharpMap__ContainsKey(typeDefs, name_1)) {
|
|
1351
|
-
return [emptySubst,
|
|
1448
|
+
return [emptySubst, Type.TTypeToken, asTyped(expr, Type.TTypeToken)];
|
|
1352
1449
|
}
|
|
1353
1450
|
else {
|
|
1354
1451
|
throw new TypeException(new TypeError$(toText(printf("Unknown type \'%s\'"))(name_1), expr.fields[1]));
|
|
@@ -1357,7 +1454,7 @@ function inferExpr(typeDefs, constructors, env, expr) {
|
|
|
1357
1454
|
case 29: {
|
|
1358
1455
|
const name_2 = expr.fields[0];
|
|
1359
1456
|
if (FSharpMap__ContainsKey(env, name_2)) {
|
|
1360
|
-
return [emptySubst,
|
|
1457
|
+
return [emptySubst, Type.TString, asTyped(expr, Type.TString)];
|
|
1361
1458
|
}
|
|
1362
1459
|
else {
|
|
1363
1460
|
throw new TypeException(new TypeError$(toText(printf("Unbound variable \'%s\'"))(name_2), expr.fields[1]));
|
|
@@ -1370,7 +1467,7 @@ function inferExpr(typeDefs, constructors, env, expr) {
|
|
|
1370
1467
|
while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
|
|
1371
1468
|
const part = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
1372
1469
|
if (part.tag === 1) {
|
|
1373
|
-
const patternInput_1 = inferExpr(typeDefs, constructors, applyEnv(sAcc, env), part.fields[0]);
|
|
1470
|
+
const patternInput_1 = inferExpr(telemetry, typeDefs, constructors, applyEnv(sAcc, env), part.fields[0]);
|
|
1374
1471
|
sAcc = compose(patternInput_1[0], sAcc);
|
|
1375
1472
|
}
|
|
1376
1473
|
}
|
|
@@ -1378,38 +1475,38 @@ function inferExpr(typeDefs, constructors, env, expr) {
|
|
|
1378
1475
|
finally {
|
|
1379
1476
|
disposeSafe(enumerator);
|
|
1380
1477
|
}
|
|
1381
|
-
return [sAcc,
|
|
1478
|
+
return [sAcc, Type.TString, asTyped(expr, Type.TString)];
|
|
1382
1479
|
}
|
|
1383
1480
|
case 4: {
|
|
1384
1481
|
const param = expr.fields[0];
|
|
1385
1482
|
let tv;
|
|
1386
1483
|
const matchValue_1 = param.Annotation;
|
|
1387
1484
|
tv = ((matchValue_1 == null) ? Types_freshVar() : annotationTypeFromRef(typeDefs, param.Span, matchValue_1));
|
|
1388
|
-
recordLocalVariableDeclaration(param.Name, param.Span, tv);
|
|
1485
|
+
recordLocalVariableDeclaration(telemetry, param.Name, param.Span, tv);
|
|
1389
1486
|
const env$0027 = add(param.Name, new Scheme(empty_2(), tv), env);
|
|
1390
|
-
const patternInput_2 = withLocalBindings(singleton(param.Name), () => inferExpr(typeDefs, constructors, env$0027, expr.fields[1]));
|
|
1487
|
+
const patternInput_2 = withLocalBindings(telemetry, singleton(param.Name), () => inferExpr(telemetry, typeDefs, constructors, env$0027, expr.fields[1]));
|
|
1391
1488
|
const s1_1 = patternInput_2[0];
|
|
1392
|
-
const tFun = new Type(11, [applyType(s1_1, tv), patternInput_2[1]]);
|
|
1489
|
+
const tFun = new Type(/* TFun */ 11, [applyType(s1_1, tv), patternInput_2[1]]);
|
|
1393
1490
|
return [s1_1, tFun, asTyped(expr, tFun)];
|
|
1394
1491
|
}
|
|
1395
1492
|
case 5: {
|
|
1396
|
-
const patternInput_3 = inferExpr(typeDefs, constructors, env, expr.fields[0]);
|
|
1493
|
+
const patternInput_3 = inferExpr(telemetry, typeDefs, constructors, env, expr.fields[0]);
|
|
1397
1494
|
const s1_2 = patternInput_3[0];
|
|
1398
|
-
const patternInput_4 = inferExpr(typeDefs, constructors, applyEnv(s1_2, env), expr.fields[1]);
|
|
1495
|
+
const patternInput_4 = inferExpr(telemetry, typeDefs, constructors, applyEnv(s1_2, env), expr.fields[1]);
|
|
1399
1496
|
const s2 = patternInput_4[0];
|
|
1400
1497
|
const tv_1 = Types_freshVar();
|
|
1401
|
-
const s_1 = compose(unify(typeDefs, applyType(s2, patternInput_3[1]), new Type(11, [patternInput_4[1], tv_1]), expr.fields[2]), compose(s2, s1_2));
|
|
1498
|
+
const s_1 = compose(unify(typeDefs, applyType(s2, patternInput_3[1]), new Type(/* TFun */ 11, [patternInput_4[1], tv_1]), expr.fields[2]), compose(s2, s1_2));
|
|
1402
1499
|
const tRes = applyType(s_1, tv_1);
|
|
1403
1500
|
return [s_1, tRes, asTyped(expr, tRes)];
|
|
1404
1501
|
}
|
|
1405
1502
|
case 6: {
|
|
1406
1503
|
const span_5 = expr.fields[3];
|
|
1407
|
-
const patternInput_5 = inferExpr(typeDefs, constructors, env, expr.fields[0]);
|
|
1504
|
+
const patternInput_5 = inferExpr(telemetry, typeDefs, constructors, env, expr.fields[0]);
|
|
1408
1505
|
const s1_3 = patternInput_5[0];
|
|
1409
|
-
const sBool = unify(typeDefs, patternInput_5[1],
|
|
1410
|
-
const patternInput_6 = inferExpr(typeDefs, constructors, applyEnv(compose(sBool, s1_3), env), expr.fields[1]);
|
|
1506
|
+
const sBool = unify(typeDefs, patternInput_5[1], Type.TBool, span_5);
|
|
1507
|
+
const patternInput_6 = inferExpr(telemetry, typeDefs, constructors, applyEnv(compose(sBool, s1_3), env), expr.fields[1]);
|
|
1411
1508
|
const s2_1 = patternInput_6[0];
|
|
1412
|
-
const patternInput_7 = inferExpr(typeDefs, constructors, applyEnv(compose(s2_1, compose(sBool, s1_3)), env), expr.fields[2]);
|
|
1509
|
+
const patternInput_7 = inferExpr(telemetry, typeDefs, constructors, applyEnv(compose(s2_1, compose(sBool, s1_3)), env), expr.fields[2]);
|
|
1413
1510
|
const tElse = patternInput_7[1];
|
|
1414
1511
|
const s3_1 = patternInput_7[0];
|
|
1415
1512
|
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))));
|
|
@@ -1417,23 +1514,23 @@ function inferExpr(typeDefs, constructors, env, expr) {
|
|
|
1417
1514
|
return [s_2, tRes_1, asTyped(expr, tRes_1)];
|
|
1418
1515
|
}
|
|
1419
1516
|
case 7: {
|
|
1420
|
-
const patternInput_8 = inferExpr(typeDefs, constructors, env, expr.fields[0]);
|
|
1517
|
+
const patternInput_8 = inferExpr(telemetry, typeDefs, constructors, env, expr.fields[0]);
|
|
1421
1518
|
const s1_4 = patternInput_8[0];
|
|
1422
|
-
const s_3 = compose(unify(typeDefs, applyType(s1_4, patternInput_8[1]),
|
|
1519
|
+
const s_3 = compose(unify(typeDefs, applyType(s1_4, patternInput_8[1]), Type.TString, expr.fields[1]), s1_4);
|
|
1423
1520
|
const tRes_2 = Types_freshVar();
|
|
1424
1521
|
return [s_3, tRes_2, asTyped(expr, tRes_2)];
|
|
1425
1522
|
}
|
|
1426
1523
|
case 8: {
|
|
1427
1524
|
const name_3 = expr.fields[0];
|
|
1428
1525
|
const body_1 = expr.fields[2];
|
|
1429
|
-
const patternInput_9 = inferExpr(typeDefs, constructors, env, expr.fields[1]);
|
|
1526
|
+
const patternInput_9 = inferExpr(telemetry, typeDefs, constructors, env, expr.fields[1]);
|
|
1430
1527
|
const s1_5 = patternInput_9[0];
|
|
1431
1528
|
const tv_2 = Types_freshVar();
|
|
1432
|
-
const sSource = compose(unify(typeDefs, applyType(s1_5, patternInput_9[1]), new Type(5, [tv_2]), expr.fields[3]), s1_5);
|
|
1529
|
+
const sSource = compose(unify(typeDefs, applyType(s1_5, patternInput_9[1]), new Type(/* TList */ 5, [tv_2]), expr.fields[3]), s1_5);
|
|
1433
1530
|
const envBody = add(name_3, new Scheme(empty_2(), applyType(sSource, tv_2)), applyEnv(sSource, env));
|
|
1434
|
-
const patternInput_10 = withLocalBindings(singleton(name_3), () => inferExpr(typeDefs, constructors, envBody, body_1));
|
|
1531
|
+
const patternInput_10 = withLocalBindings(telemetry, singleton(name_3), () => inferExpr(telemetry, typeDefs, constructors, envBody, body_1));
|
|
1435
1532
|
const s2_3 = patternInput_10[0];
|
|
1436
|
-
return [compose(unify(typeDefs, applyType(s2_3, patternInput_10[1]),
|
|
1533
|
+
return [compose(unify(typeDefs, applyType(s2_3, patternInput_10[1]), Type.TUnit, Ast_spanOfExpr(body_1)), compose(s2_3, sSource)), Type.TUnit, asTyped(expr, Type.TUnit)];
|
|
1437
1534
|
}
|
|
1438
1535
|
case 10: {
|
|
1439
1536
|
const value_3 = expr.fields[1];
|
|
@@ -1444,41 +1541,41 @@ function inferExpr(typeDefs, constructors, env, expr) {
|
|
|
1444
1541
|
if (expr.fields[3]) {
|
|
1445
1542
|
const tv_3 = Types_freshVar();
|
|
1446
1543
|
const envRec = add(name_4, new Scheme(empty_2(), tv_3), env);
|
|
1447
|
-
const patternInput_11 = withLocalBindings(singleton(name_4), () => inferExpr(typeDefs, constructors, envRec, value_3));
|
|
1544
|
+
const patternInput_11 = withLocalBindings(telemetry, singleton(name_4), () => inferExpr(telemetry, typeDefs, constructors, envRec, value_3));
|
|
1448
1545
|
const t1_2 = patternInput_11[1];
|
|
1449
1546
|
const s1_6 = patternInput_11[0];
|
|
1450
1547
|
const s2_4 = unify(typeDefs, applyType(s1_6, tv_3), t1_2, span_8);
|
|
1451
1548
|
const sValue = compose((returnAnnotation == null) ? emptySubst : ((expectedReturn = annotationTypeFromRef(typeDefs, span_8, returnAnnotation), unify(typeDefs, functionReturnType(applyType(s2_4, t1_2)), expectedReturn, span_8))), compose(s2_4, s1_6));
|
|
1452
1549
|
const env1 = applyEnv(sValue, env);
|
|
1453
1550
|
const env2_2 = add(name_4, Types_generalize(env1, applyType(sValue, t1_2)), env1);
|
|
1454
|
-
const patternInput_12 = withLocalBindings(singleton(name_4), () => inferExpr(typeDefs, constructors, env2_2, body_2));
|
|
1551
|
+
const patternInput_12 = withLocalBindings(telemetry, singleton(name_4), () => inferExpr(telemetry, typeDefs, constructors, env2_2, body_2));
|
|
1455
1552
|
const tBody_2 = patternInput_12[1];
|
|
1456
1553
|
return [compose(patternInput_12[0], sValue), tBody_2, asTyped(expr, tBody_2)];
|
|
1457
1554
|
}
|
|
1458
1555
|
else {
|
|
1459
|
-
const patternInput_13 = inferExpr(typeDefs, constructors, env, value_3);
|
|
1556
|
+
const patternInput_13 = inferExpr(telemetry, typeDefs, constructors, env, value_3);
|
|
1460
1557
|
const t1_3 = patternInput_13[1];
|
|
1461
1558
|
const s1_7 = patternInput_13[0];
|
|
1462
|
-
const sDiscard = (name_4 === "_") ? unify(typeDefs, applyType(s1_7, t1_3),
|
|
1559
|
+
const sDiscard = (name_4 === "_") ? unify(typeDefs, applyType(s1_7, t1_3), Type.TUnit, Ast_spanOfExpr(value_3)) : emptySubst;
|
|
1463
1560
|
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));
|
|
1464
1561
|
const env1_1 = applyEnv(sValue_1, env);
|
|
1465
1562
|
const env2_3 = add(name_4, Types_generalize(env1_1, applyType(sValue_1, t1_3)), env1_1);
|
|
1466
|
-
const patternInput_14 = withLocalBindings(singleton(name_4), () => inferExpr(typeDefs, constructors, env2_3, body_2));
|
|
1563
|
+
const patternInput_14 = withLocalBindings(telemetry, singleton(name_4), () => inferExpr(telemetry, typeDefs, constructors, env2_3, body_2));
|
|
1467
1564
|
const t2_1 = patternInput_14[1];
|
|
1468
1565
|
return [compose(patternInput_14[0], sValue_1), t2_1, asTyped(expr, t2_1)];
|
|
1469
1566
|
}
|
|
1470
1567
|
}
|
|
1471
1568
|
case 11: {
|
|
1472
|
-
const startIndex = currentTelemetryCaptureCount() | 0;
|
|
1473
|
-
const patternInput_15 = inferExpr(typeDefs, constructors, env, expr.fields[1]);
|
|
1569
|
+
const startIndex = currentTelemetryCaptureCount(telemetry) | 0;
|
|
1570
|
+
const patternInput_15 = inferExpr(telemetry, typeDefs, constructors, env, expr.fields[1]);
|
|
1474
1571
|
const s1_8 = patternInput_15[0];
|
|
1475
|
-
const patternInput_16 = inferPattern(typeDefs, constructors, expr.fields[0]);
|
|
1572
|
+
const patternInput_16 = inferPattern(telemetry, typeDefs, constructors, expr.fields[0]);
|
|
1476
1573
|
const sValue_2 = compose(unify(typeDefs, applyType(s1_8, patternInput_15[1]), patternInput_16[1], expr.fields[3]), s1_8);
|
|
1477
|
-
applySubstToCapturedLocals(startIndex, sValue_2);
|
|
1574
|
+
applySubstToCapturedLocals(telemetry, startIndex, sValue_2);
|
|
1478
1575
|
const env1_2 = applyEnv(sValue_2, env);
|
|
1479
1576
|
const envPatTyped = map_1((_arg, ty) => applyType(sValue_2, ty), patternInput_16[0]);
|
|
1480
1577
|
const env2_4 = fold_1((state, name_5, bindingType) => add(name_5, Types_generalize(env1_2, bindingType), state), env1_2, envPatTyped);
|
|
1481
|
-
const patternInput_17 = withLocalBindings(map((tuple) => tuple[0], toList(envPatTyped)), () => inferExpr(typeDefs, constructors, env2_4, expr.fields[2]));
|
|
1578
|
+
const patternInput_17 = withLocalBindings(telemetry, map((tuple) => tuple[0], toList(envPatTyped)), () => inferExpr(telemetry, typeDefs, constructors, env2_4, expr.fields[2]));
|
|
1482
1579
|
const tBody_3 = patternInput_17[1];
|
|
1483
1580
|
return [compose(patternInput_17[0], sValue_2), tBody_3, asTyped(expr, tBody_3)];
|
|
1484
1581
|
}
|
|
@@ -1486,10 +1583,10 @@ function inferExpr(typeDefs, constructors, env, expr) {
|
|
|
1486
1583
|
const foldedBindings = map((tupledArg) => {
|
|
1487
1584
|
const args = tupledArg[1];
|
|
1488
1585
|
const bindingSpan = tupledArg[4];
|
|
1489
|
-
if (
|
|
1586
|
+
if (isEmpty_1(args)) {
|
|
1490
1587
|
throw new TypeException(new TypeError$("\'let rec ... and ...\' requires function arguments for each binding", bindingSpan));
|
|
1491
1588
|
}
|
|
1492
|
-
return [tupledArg[0], tupledArg[2], foldBack((arg_4, acc) => (new Expr(4, [arg_4, acc, bindingSpan])), args, tupledArg[3]), bindingSpan];
|
|
1589
|
+
return [tupledArg[0], tupledArg[2], foldBack((arg_4, acc) => (new Expr(/* ELambda */ 4, [arg_4, acc, bindingSpan])), args, tupledArg[3]), bindingSpan];
|
|
1493
1590
|
}, expr.fields[0]);
|
|
1494
1591
|
const freshByName = ofList(map((tupledArg_1) => [tupledArg_1[0], Types_freshVar()], foldedBindings), {
|
|
1495
1592
|
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
@@ -1497,12 +1594,12 @@ function inferExpr(typeDefs, constructors, env, expr) {
|
|
|
1497
1594
|
const envRec_1 = fold_1((acc_1, name_8, tv_4) => add(name_8, new Scheme(empty_2(), tv_4), acc_1), env, freshByName);
|
|
1498
1595
|
let sRec = emptySubst;
|
|
1499
1596
|
const recursiveNames = map((tuple_1) => tuple_1[0], toList(freshByName));
|
|
1500
|
-
withLocalBindings(recursiveNames, () => {
|
|
1597
|
+
withLocalBindings(telemetry, recursiveNames, () => {
|
|
1501
1598
|
const enumerator_1 = getEnumerator(foldedBindings);
|
|
1502
1599
|
try {
|
|
1503
1600
|
while (enumerator_1["System.Collections.IEnumerator.MoveNext"]()) {
|
|
1504
1601
|
const forLoopVar = enumerator_1["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
1505
|
-
const patternInput_18 = inferExpr(typeDefs, constructors, applyEnv(sRec, envRec_1), forLoopVar[2]);
|
|
1602
|
+
const patternInput_18 = inferExpr(telemetry, typeDefs, constructors, applyEnv(sRec, envRec_1), forLoopVar[2]);
|
|
1506
1603
|
const s1_9 = patternInput_18[0];
|
|
1507
1604
|
const s2_7 = unify(typeDefs, applyType(s1_9, applyType(sRec, FSharpMap__get_Item(freshByName, forLoopVar[0]))), patternInput_18[1], forLoopVar[3]);
|
|
1508
1605
|
sRec = compose(s2_7, compose(s1_9, sRec));
|
|
@@ -1535,12 +1632,12 @@ function inferExpr(typeDefs, constructors, env, expr) {
|
|
|
1535
1632
|
const name_11 = tupledArg_2[0];
|
|
1536
1633
|
return [name_11, Types_generalize(envGeneralize, applyType(sRec, FSharpMap__get_Item(freshByName, name_11)))];
|
|
1537
1634
|
}, foldedBindings));
|
|
1538
|
-
const patternInput_19 = withLocalBindings(recursiveNames, () => inferExpr(typeDefs, constructors, envBody_1, expr.fields[1]));
|
|
1635
|
+
const patternInput_19 = withLocalBindings(telemetry, recursiveNames, () => inferExpr(telemetry, typeDefs, constructors, envBody_1, expr.fields[1]));
|
|
1539
1636
|
const tBody_4 = patternInput_19[1];
|
|
1540
1637
|
return [compose(patternInput_19[0], sRec), tBody_4, asTyped(expr, tBody_4)];
|
|
1541
1638
|
}
|
|
1542
1639
|
case 9: {
|
|
1543
|
-
const patternInput_20 = inferExpr(typeDefs, constructors, env, expr.fields[0]);
|
|
1640
|
+
const patternInput_20 = inferExpr(telemetry, typeDefs, constructors, env, expr.fields[0]);
|
|
1544
1641
|
const tScrut = patternInput_20[1];
|
|
1545
1642
|
let sAcc_1 = patternInput_20[0];
|
|
1546
1643
|
let resultTypeOpt = undefined;
|
|
@@ -1552,7 +1649,7 @@ function inferExpr(typeDefs, constructors, env, expr) {
|
|
|
1552
1649
|
const pat_1 = forLoopVar_2[0];
|
|
1553
1650
|
const guard = forLoopVar_2[1];
|
|
1554
1651
|
const caseSpan = forLoopVar_2[3];
|
|
1555
|
-
const patternInput_21 = inferPattern(typeDefs, constructors, pat_1);
|
|
1652
|
+
const patternInput_21 = inferPattern(telemetry, typeDefs, constructors, pat_1);
|
|
1556
1653
|
const tPat_1 = patternInput_21[1];
|
|
1557
1654
|
const envPat_1 = patternInput_21[0];
|
|
1558
1655
|
let sPat;
|
|
@@ -1643,19 +1740,19 @@ function inferExpr(typeDefs, constructors, env, expr) {
|
|
|
1643
1740
|
sPat = unify(typeDefs, applyType(sAcc_1, tScrut), tPat_1, caseSpan);
|
|
1644
1741
|
}
|
|
1645
1742
|
const envCase$0027 = fold_1((acc_3, k, v) => add(k, new Scheme(empty_2(), applyType(sPat, v)), acc_3), applyEnv(compose(sPat, sAcc_1), env), envPat_1);
|
|
1646
|
-
const patternInput_23 = withLocalBindings(map((tuple_2) => tuple_2[0], toList(envPat_1)), () => {
|
|
1743
|
+
const patternInput_23 = withLocalBindings(telemetry, map((tuple_2) => tuple_2[0], toList(envPat_1)), () => {
|
|
1647
1744
|
let envBodyCase = envCase$0027;
|
|
1648
1745
|
if (guard == null) {
|
|
1649
1746
|
}
|
|
1650
1747
|
else {
|
|
1651
1748
|
const guardExpr = guard;
|
|
1652
|
-
const patternInput_22 = inferExpr(typeDefs, constructors, envBodyCase, guardExpr);
|
|
1749
|
+
const patternInput_22 = inferExpr(telemetry, typeDefs, constructors, envBodyCase, guardExpr);
|
|
1653
1750
|
const sGuard = patternInput_22[0];
|
|
1654
|
-
const sGuardBool = unify(typeDefs, applyType(sGuard, patternInput_22[1]),
|
|
1751
|
+
const sGuardBool = unify(typeDefs, applyType(sGuard, patternInput_22[1]), Type.TBool, caseSpan);
|
|
1655
1752
|
sAcc_1 = compose(sGuardBool, compose(sGuard, sAcc_1));
|
|
1656
1753
|
envBodyCase = applyEnv(compose(sGuardBool, sGuard), envBodyCase);
|
|
1657
1754
|
}
|
|
1658
|
-
return inferExpr(typeDefs, constructors, envBodyCase, forLoopVar_2[2]);
|
|
1755
|
+
return inferExpr(telemetry, typeDefs, constructors, envBodyCase, forLoopVar_2[2]);
|
|
1659
1756
|
});
|
|
1660
1757
|
const sBody_2 = patternInput_23[0];
|
|
1661
1758
|
const tBody$0027 = applyType(sBody_2, patternInput_23[1]);
|
|
@@ -1676,7 +1773,7 @@ function inferExpr(typeDefs, constructors, env, expr) {
|
|
|
1676
1773
|
try {
|
|
1677
1774
|
while (enumerator_4["System.Collections.IEnumerator.MoveNext"]()) {
|
|
1678
1775
|
const item = enumerator_4["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
1679
|
-
const patternInput_24 = inferExpr(typeDefs, constructors, applyEnv(sAcc_2, env), item);
|
|
1776
|
+
const patternInput_24 = inferExpr(telemetry, typeDefs, constructors, applyEnv(sAcc_2, env), item);
|
|
1680
1777
|
const s1_11 = patternInput_24[0];
|
|
1681
1778
|
const s2_8 = unify(typeDefs, applyType(s1_11, tv_5), patternInput_24[1], expr.fields[1]);
|
|
1682
1779
|
sAcc_2 = compose(s2_8, compose(s1_11, sAcc_2));
|
|
@@ -1685,18 +1782,18 @@ function inferExpr(typeDefs, constructors, env, expr) {
|
|
|
1685
1782
|
finally {
|
|
1686
1783
|
disposeSafe(enumerator_4);
|
|
1687
1784
|
}
|
|
1688
|
-
const tRes_4 = new Type(5, [applyType(sAcc_2, tv_5)]);
|
|
1785
|
+
const tRes_4 = new Type(/* TList */ 5, [applyType(sAcc_2, tv_5)]);
|
|
1689
1786
|
return [sAcc_2, tRes_4, asTyped(expr, tRes_4)];
|
|
1690
1787
|
}
|
|
1691
1788
|
case 14: {
|
|
1692
1789
|
const span_13 = expr.fields[2];
|
|
1693
|
-
const patternInput_25 = inferExpr(typeDefs, constructors, env, expr.fields[0]);
|
|
1790
|
+
const patternInput_25 = inferExpr(telemetry, typeDefs, constructors, env, expr.fields[0]);
|
|
1694
1791
|
const s1_12 = patternInput_25[0];
|
|
1695
|
-
const patternInput_26 = inferExpr(typeDefs, constructors, applyEnv(s1_12, env), expr.fields[1]);
|
|
1792
|
+
const patternInput_26 = inferExpr(telemetry, typeDefs, constructors, applyEnv(s1_12, env), expr.fields[1]);
|
|
1696
1793
|
const s2_9 = patternInput_26[0];
|
|
1697
|
-
const s3_3 = unify(typeDefs, applyType(s2_9, patternInput_25[1]),
|
|
1698
|
-
const tRes_5 = new Type(5, [
|
|
1699
|
-
return [compose(unify(typeDefs, applyType(s3_3, applyType(s2_9, patternInput_26[1])),
|
|
1794
|
+
const s3_3 = unify(typeDefs, applyType(s2_9, patternInput_25[1]), Type.TInt, span_13);
|
|
1795
|
+
const tRes_5 = new Type(/* TList */ 5, [Type.TInt]);
|
|
1796
|
+
return [compose(unify(typeDefs, applyType(s3_3, applyType(s2_9, patternInput_26[1])), Type.TInt, span_13), compose(s3_3, compose(s2_9, s1_12))), tRes_5, asTyped(expr, tRes_5)];
|
|
1700
1797
|
}
|
|
1701
1798
|
case 15: {
|
|
1702
1799
|
let sAcc_3 = emptySubst;
|
|
@@ -1705,7 +1802,7 @@ function inferExpr(typeDefs, constructors, env, expr) {
|
|
|
1705
1802
|
try {
|
|
1706
1803
|
while (enumerator_5["System.Collections.IEnumerator.MoveNext"]()) {
|
|
1707
1804
|
const item_1 = enumerator_5["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
1708
|
-
const patternInput_27 = inferExpr(typeDefs, constructors, applyEnv(sAcc_3, env), item_1);
|
|
1805
|
+
const patternInput_27 = inferExpr(telemetry, typeDefs, constructors, applyEnv(sAcc_3, env), item_1);
|
|
1709
1806
|
sAcc_3 = compose(patternInput_27[0], sAcc_3);
|
|
1710
1807
|
inferred_1 = append(inferred_1, singleton(applyType(sAcc_3, patternInput_27[1])));
|
|
1711
1808
|
}
|
|
@@ -1713,7 +1810,7 @@ function inferExpr(typeDefs, constructors, env, expr) {
|
|
|
1713
1810
|
finally {
|
|
1714
1811
|
disposeSafe(enumerator_5);
|
|
1715
1812
|
}
|
|
1716
|
-
const tRes_6 = new Type(7, [inferred_1]);
|
|
1813
|
+
const tRes_6 = new Type(/* TTuple */ 7, [inferred_1]);
|
|
1717
1814
|
return [sAcc_3, tRes_6, asTyped(expr, tRes_6)];
|
|
1718
1815
|
}
|
|
1719
1816
|
case 16: {
|
|
@@ -1726,7 +1823,7 @@ function inferExpr(typeDefs, constructors, env, expr) {
|
|
|
1726
1823
|
try {
|
|
1727
1824
|
while (enumerator_6["System.Collections.IEnumerator.MoveNext"]()) {
|
|
1728
1825
|
const forLoopVar_3 = enumerator_6["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
1729
|
-
const patternInput_28 = inferExpr(typeDefs, constructors, applyEnv(sAcc_4, env), forLoopVar_3[1]);
|
|
1826
|
+
const patternInput_28 = inferExpr(telemetry, typeDefs, constructors, applyEnv(sAcc_4, env), forLoopVar_3[1]);
|
|
1730
1827
|
sAcc_4 = compose(patternInput_28[0], sAcc_4);
|
|
1731
1828
|
inferred_2 = FSharpMap__Add(inferred_2, forLoopVar_3[0], applyType(sAcc_4, patternInput_28[1]));
|
|
1732
1829
|
}
|
|
@@ -1734,10 +1831,10 @@ function inferExpr(typeDefs, constructors, env, expr) {
|
|
|
1734
1831
|
finally {
|
|
1735
1832
|
disposeSafe(enumerator_6);
|
|
1736
1833
|
}
|
|
1737
|
-
const expected_1 = new Type(12, [resolveNamedRecordByFieldSet(typeDefs, ofSeq(keys(inferred_2), {
|
|
1834
|
+
const expected_1 = new Type(/* TNamed */ 12, [resolveNamedRecordByFieldSet(typeDefs, ofSeq(keys(inferred_2), {
|
|
1738
1835
|
Compare: (x_2, y_2) => (comparePrimitives(x_2, y_2) | 0),
|
|
1739
1836
|
}), span_14)]);
|
|
1740
|
-
const s_10 = compose(unify(typeDefs, applyType(sAcc_4, new Type(8, [inferred_2])), expected_1, span_14), sAcc_4);
|
|
1837
|
+
const s_10 = compose(unify(typeDefs, applyType(sAcc_4, new Type(/* TRecord */ 8, [inferred_2])), expected_1, span_14), sAcc_4);
|
|
1741
1838
|
const tRes_7 = applyType(s_10, expected_1);
|
|
1742
1839
|
return [s_10, tRes_7, asTyped(expr, tRes_7)];
|
|
1743
1840
|
}
|
|
@@ -1750,7 +1847,7 @@ function inferExpr(typeDefs, constructors, env, expr) {
|
|
|
1750
1847
|
try {
|
|
1751
1848
|
while (enumerator_7["System.Collections.IEnumerator.MoveNext"]()) {
|
|
1752
1849
|
const forLoopVar_4 = enumerator_7["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
1753
|
-
const patternInput_29 = inferExpr(typeDefs, constructors, applyEnv(sAcc_5, env), forLoopVar_4[1]);
|
|
1850
|
+
const patternInput_29 = inferExpr(telemetry, typeDefs, constructors, applyEnv(sAcc_5, env), forLoopVar_4[1]);
|
|
1754
1851
|
sAcc_5 = compose(patternInput_29[0], sAcc_5);
|
|
1755
1852
|
inferred_3 = FSharpMap__Add(inferred_3, forLoopVar_4[0], applyType(sAcc_5, patternInput_29[1]));
|
|
1756
1853
|
}
|
|
@@ -1758,7 +1855,7 @@ function inferExpr(typeDefs, constructors, env, expr) {
|
|
|
1758
1855
|
finally {
|
|
1759
1856
|
disposeSafe(enumerator_7);
|
|
1760
1857
|
}
|
|
1761
|
-
const tRes_8 = new Type(8, [inferred_3]);
|
|
1858
|
+
const tRes_8 = new Type(/* TRecord */ 8, [inferred_3]);
|
|
1762
1859
|
return [sAcc_5, tRes_8, asTyped(expr, tRes_8)];
|
|
1763
1860
|
}
|
|
1764
1861
|
case 18: {
|
|
@@ -1781,20 +1878,20 @@ function inferExpr(typeDefs, constructors, env, expr) {
|
|
|
1781
1878
|
const entry = enumerator_8["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
1782
1879
|
if (entry.tag === 1) {
|
|
1783
1880
|
const spreadExpr = entry.fields[0];
|
|
1784
|
-
const patternInput_32 = inferExpr(typeDefs, constructors, applyEnv(sAcc_6, env), spreadExpr);
|
|
1881
|
+
const patternInput_32 = inferExpr(telemetry, typeDefs, constructors, applyEnv(sAcc_6, env), spreadExpr);
|
|
1785
1882
|
const sSpread = patternInput_32[0];
|
|
1786
|
-
const expectedSpreadType = new Type(9, [applyType(sSpread, applyType(sAcc_6, keyType)), applyType(sSpread, applyType(sAcc_6, valueType))]);
|
|
1883
|
+
const expectedSpreadType = new Type(/* TMap */ 9, [applyType(sSpread, applyType(sAcc_6, keyType)), applyType(sSpread, applyType(sAcc_6, valueType))]);
|
|
1787
1884
|
const sSpreadMap = unify(typeDefs, applyType(sSpread, patternInput_32[1]), expectedSpreadType, Ast_spanOfExpr(spreadExpr));
|
|
1788
1885
|
sAcc_6 = compose(sSpreadMap, compose(sSpread, sAcc_6));
|
|
1789
1886
|
}
|
|
1790
1887
|
else {
|
|
1791
1888
|
const valueExpr_3 = entry.fields[1];
|
|
1792
1889
|
const keyExpr = entry.fields[0];
|
|
1793
|
-
const patternInput_30 = inferExpr(typeDefs, constructors, applyEnv(sAcc_6, env), keyExpr);
|
|
1890
|
+
const patternInput_30 = inferExpr(telemetry, typeDefs, constructors, applyEnv(sAcc_6, env), keyExpr);
|
|
1794
1891
|
const sKey = patternInput_30[0];
|
|
1795
1892
|
const sAfterKey = compose(unify(typeDefs, applyType(sKey, patternInput_30[1]), applyType(sKey, applyType(sAcc_6, keyType)), Ast_spanOfExpr(keyExpr)), compose(sKey, sAcc_6));
|
|
1796
1893
|
ensureSupportedMapKeyType(applyType(sAfterKey, keyType));
|
|
1797
|
-
const patternInput_31 = inferExpr(typeDefs, constructors, applyEnv(sAfterKey, env), valueExpr_3);
|
|
1894
|
+
const patternInput_31 = inferExpr(telemetry, typeDefs, constructors, applyEnv(sAfterKey, env), valueExpr_3);
|
|
1798
1895
|
const sValue_3 = patternInput_31[0];
|
|
1799
1896
|
const sValueType = unify(typeDefs, applyType(sValue_3, applyType(sAfterKey, valueType)), patternInput_31[1], Ast_spanOfExpr(valueExpr_3));
|
|
1800
1897
|
sAcc_6 = compose(sValueType, compose(sValue_3, sAfterKey));
|
|
@@ -1805,12 +1902,12 @@ function inferExpr(typeDefs, constructors, env, expr) {
|
|
|
1805
1902
|
disposeSafe(enumerator_8);
|
|
1806
1903
|
}
|
|
1807
1904
|
ensureSupportedMapKeyType(applyType(sAcc_6, keyType));
|
|
1808
|
-
const tRes_9 = new Type(9, [applyType(sAcc_6, keyType), applyType(sAcc_6, valueType)]);
|
|
1905
|
+
const tRes_9 = new Type(/* TMap */ 9, [applyType(sAcc_6, keyType), applyType(sAcc_6, valueType)]);
|
|
1809
1906
|
return [sAcc_6, tRes_9, asTyped(expr, tRes_9)];
|
|
1810
1907
|
}
|
|
1811
1908
|
case 19: {
|
|
1812
1909
|
const span_16 = expr.fields[2];
|
|
1813
|
-
const patternInput_33 = inferExpr(typeDefs, constructors, env, expr.fields[0]);
|
|
1910
|
+
const patternInput_33 = inferExpr(telemetry, typeDefs, constructors, env, expr.fields[0]);
|
|
1814
1911
|
const sBase = patternInput_33[0];
|
|
1815
1912
|
let baseFields;
|
|
1816
1913
|
const matchValue_7 = applyType(sBase, patternInput_33[1]);
|
|
@@ -1862,7 +1959,7 @@ function inferExpr(typeDefs, constructors, env, expr) {
|
|
|
1862
1959
|
else {
|
|
1863
1960
|
expectedFieldType = matchValue_9;
|
|
1864
1961
|
}
|
|
1865
|
-
const patternInput_34 = inferExpr(typeDefs, constructors, applyEnv(sAcc_7, env), valueExpr_4);
|
|
1962
|
+
const patternInput_34 = inferExpr(telemetry, typeDefs, constructors, applyEnv(sAcc_7, env), valueExpr_4);
|
|
1866
1963
|
const sField_2 = patternInput_34[0];
|
|
1867
1964
|
const sEq_1 = unify(typeDefs, applyType(sField_2, applyType(sAcc_7, expectedFieldType)), patternInput_34[1], Ast_spanOfExpr(valueExpr_4));
|
|
1868
1965
|
sAcc_7 = compose(sEq_1, compose(sField_2, sAcc_7));
|
|
@@ -1871,12 +1968,12 @@ function inferExpr(typeDefs, constructors, env, expr) {
|
|
|
1871
1968
|
finally {
|
|
1872
1969
|
disposeSafe(enumerator_9);
|
|
1873
1970
|
}
|
|
1874
|
-
const tRes_10 = new Type(8, [map_1((_arg_7, t_5) => applyType(sAcc_7, t_5), baseFields)]);
|
|
1971
|
+
const tRes_10 = new Type(/* TRecord */ 8, [map_1((_arg_7, t_5) => applyType(sAcc_7, t_5), baseFields)]);
|
|
1875
1972
|
return [sAcc_7, tRes_10, asTyped(expr, tRes_10)];
|
|
1876
1973
|
}
|
|
1877
1974
|
case 20: {
|
|
1878
1975
|
const span_17 = expr.fields[2];
|
|
1879
|
-
const patternInput_35 = inferExpr(typeDefs, constructors, env, expr.fields[0]);
|
|
1976
|
+
const patternInput_35 = inferExpr(telemetry, typeDefs, constructors, env, expr.fields[0]);
|
|
1880
1977
|
const sBase_1 = patternInput_35[0];
|
|
1881
1978
|
let sAcc_8 = sBase_1;
|
|
1882
1979
|
let resultFields_1;
|
|
@@ -1921,7 +2018,7 @@ function inferExpr(typeDefs, constructors, env, expr) {
|
|
|
1921
2018
|
const forLoopVar_6 = enumerator_10["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
1922
2019
|
const valueExpr_5 = forLoopVar_6[1];
|
|
1923
2020
|
const name_18 = forLoopVar_6[0];
|
|
1924
|
-
const patternInput_36 = inferExpr(typeDefs, constructors, applyEnv(sAcc_8, env), valueExpr_5);
|
|
2021
|
+
const patternInput_36 = inferExpr(telemetry, typeDefs, constructors, applyEnv(sAcc_8, env), valueExpr_5);
|
|
1925
2022
|
const sField_3 = patternInput_36[0];
|
|
1926
2023
|
const tFieldApplied = applyType(sField_3, patternInput_36[1]);
|
|
1927
2024
|
const sEq_2 = unify(typeDefs, (matchValue_12 = FSharpMap__TryFind(resultFields_1, name_18), (matchValue_12 == null) ? tFieldApplied : ((existingFieldType = matchValue_12, applyType(sField_3, applyType(sAcc_8, existingFieldType))))), tFieldApplied, Ast_spanOfExpr(valueExpr_5));
|
|
@@ -1932,7 +2029,7 @@ function inferExpr(typeDefs, constructors, env, expr) {
|
|
|
1932
2029
|
finally {
|
|
1933
2030
|
disposeSafe(enumerator_10);
|
|
1934
2031
|
}
|
|
1935
|
-
const tRes_11 = new Type(8, [map_1((_arg_8, t_6) => applyType(sAcc_8, t_6), resultFields_1)]);
|
|
2032
|
+
const tRes_11 = new Type(/* TRecord */ 8, [map_1((_arg_8, t_6) => applyType(sAcc_8, t_6), resultFields_1)]);
|
|
1936
2033
|
return [sAcc_8, tRes_11, asTyped(expr, tRes_11)];
|
|
1937
2034
|
}
|
|
1938
2035
|
case 21: {
|
|
@@ -1982,7 +2079,7 @@ function inferExpr(typeDefs, constructors, env, expr) {
|
|
|
1982
2079
|
}
|
|
1983
2080
|
case 15: {
|
|
1984
2081
|
const tField_4 = Types_freshVar();
|
|
1985
|
-
const s_11 = compose(unify(typeDefs, matchValue_13, new Type(8, [ofList(singleton([fieldName, tField_4]), {
|
|
2082
|
+
const s_11 = compose(unify(typeDefs, matchValue_13, new Type(/* TRecord */ 8, [ofList(singleton([fieldName, tField_4]), {
|
|
1986
2083
|
Compare: (x_4, y_4) => (comparePrimitives(x_4, y_4) | 0),
|
|
1987
2084
|
})]), span_18), s1_16);
|
|
1988
2085
|
return [s_11, applyType(s_11, tField_4)];
|
|
@@ -2008,7 +2105,7 @@ function inferExpr(typeDefs, constructors, env, expr) {
|
|
|
2008
2105
|
case 0: {
|
|
2009
2106
|
const matchValue_17 = FSharpMap__TryFind(env, concat(moduleName_1, ".", fieldName));
|
|
2010
2107
|
if (matchValue_17 == null) {
|
|
2011
|
-
const patternInput_37 = inferExpr(typeDefs, constructors, env, target);
|
|
2108
|
+
const patternInput_37 = inferExpr(telemetry, typeDefs, constructors, env, target);
|
|
2012
2109
|
const patternInput_38 = inferRecordField(patternInput_37[0], patternInput_37[1]);
|
|
2013
2110
|
const tField_5 = patternInput_38[1];
|
|
2014
2111
|
return [patternInput_38[0], tField_5, asTyped(expr, tField_5)];
|
|
@@ -2019,7 +2116,7 @@ function inferExpr(typeDefs, constructors, env, expr) {
|
|
|
2019
2116
|
}
|
|
2020
2117
|
}
|
|
2021
2118
|
default: {
|
|
2022
|
-
const patternInput_39 = inferExpr(typeDefs, constructors, env, target);
|
|
2119
|
+
const patternInput_39 = inferExpr(telemetry, typeDefs, constructors, env, target);
|
|
2023
2120
|
const patternInput_40 = inferRecordField(patternInput_39[0], patternInput_39[1]);
|
|
2024
2121
|
const tField_6 = patternInput_40[1];
|
|
2025
2122
|
return [patternInput_40[0], tField_6, asTyped(expr, tField_6)];
|
|
@@ -2028,9 +2125,9 @@ function inferExpr(typeDefs, constructors, env, expr) {
|
|
|
2028
2125
|
}
|
|
2029
2126
|
case 22: {
|
|
2030
2127
|
const span_19 = expr.fields[2];
|
|
2031
|
-
const patternInput_41 = inferExpr(typeDefs, constructors, env, expr.fields[0]);
|
|
2128
|
+
const patternInput_41 = inferExpr(telemetry, typeDefs, constructors, env, expr.fields[0]);
|
|
2032
2129
|
const s1_19 = patternInput_41[0];
|
|
2033
|
-
const patternInput_42 = inferExpr(typeDefs, constructors, applyEnv(s1_19, env), expr.fields[1]);
|
|
2130
|
+
const patternInput_42 = inferExpr(telemetry, typeDefs, constructors, applyEnv(s1_19, env), expr.fields[1]);
|
|
2034
2131
|
const s2_10 = patternInput_42[0];
|
|
2035
2132
|
const targetType = applyType(s2_10, patternInput_41[1]);
|
|
2036
2133
|
const keyType_1 = applyType(s2_10, patternInput_42[1]);
|
|
@@ -2071,8 +2168,8 @@ function inferExpr(typeDefs, constructors, env, expr) {
|
|
|
2071
2168
|
}
|
|
2072
2169
|
switch (matchResult_6) {
|
|
2073
2170
|
case 0: {
|
|
2074
|
-
const s_12 = compose(unify(typeDefs, keyType_1,
|
|
2075
|
-
const tRes_12 = new Type(10, [applyType(s_12, itemType_1)]);
|
|
2171
|
+
const s_12 = compose(unify(typeDefs, keyType_1, Type.TInt, span_19), compose(s2_10, s1_19));
|
|
2172
|
+
const tRes_12 = new Type(/* TOption */ 10, [applyType(s_12, itemType_1)]);
|
|
2076
2173
|
return [s_12, tRes_12, asTyped(expr, tRes_12)];
|
|
2077
2174
|
}
|
|
2078
2175
|
case 1: {
|
|
@@ -2086,19 +2183,19 @@ function inferExpr(typeDefs, constructors, env, expr) {
|
|
|
2086
2183
|
default:
|
|
2087
2184
|
throw new TypeException(new TypeError$(concat("Map key type must be string, got ", Types_typeToString(matchValue_19)), span_19));
|
|
2088
2185
|
}
|
|
2089
|
-
const tRes_13 = new Type(10, [applyType(s_13, valueType_1)]);
|
|
2186
|
+
const tRes_13 = new Type(/* TOption */ 10, [applyType(s_13, valueType_1)]);
|
|
2090
2187
|
return [s_13, tRes_13, asTyped(expr, tRes_13)];
|
|
2091
2188
|
}
|
|
2092
2189
|
case 2: {
|
|
2093
2190
|
const itemType_2 = Types_freshVar();
|
|
2094
|
-
const s_14 = compose(unify(typeDefs, targetType, new Type(5, [itemType_2]), span_19), compose(s2_10, s1_19));
|
|
2095
|
-
const tRes_14 = new Type(10, [applyType(s_14, itemType_2)]);
|
|
2191
|
+
const s_14 = compose(unify(typeDefs, targetType, new Type(/* TList */ 5, [itemType_2]), span_19), compose(s2_10, s1_19));
|
|
2192
|
+
const tRes_14 = new Type(/* TOption */ 10, [applyType(s_14, itemType_2)]);
|
|
2096
2193
|
return [s_14, tRes_14, asTyped(expr, tRes_14)];
|
|
2097
2194
|
}
|
|
2098
2195
|
case 3: {
|
|
2099
2196
|
const valueType_2 = Types_freshVar();
|
|
2100
|
-
const s_15 = compose(unify(typeDefs, targetType, new Type(9, [
|
|
2101
|
-
const tRes_15 = new Type(10, [applyType(s_15, valueType_2)]);
|
|
2197
|
+
const s_15 = compose(unify(typeDefs, targetType, new Type(/* TMap */ 9, [Type.TString, valueType_2]), span_19), compose(s2_10, s1_19));
|
|
2198
|
+
const tRes_15 = new Type(/* TOption */ 10, [applyType(s_15, valueType_2)]);
|
|
2102
2199
|
return [s_15, tRes_15, asTyped(expr, tRes_15)];
|
|
2103
2200
|
}
|
|
2104
2201
|
case 4:
|
|
@@ -2114,40 +2211,40 @@ function inferExpr(typeDefs, constructors, env, expr) {
|
|
|
2114
2211
|
const a = expr.fields[1];
|
|
2115
2212
|
switch (op) {
|
|
2116
2213
|
case "|>": {
|
|
2117
|
-
const patternInput_43 = inferExpr(typeDefs, constructors, env, a);
|
|
2214
|
+
const patternInput_43 = inferExpr(telemetry, typeDefs, constructors, env, a);
|
|
2118
2215
|
const s1_20 = patternInput_43[0];
|
|
2119
|
-
const patternInput_44 = inferExpr(typeDefs, constructors, applyEnv(s1_20, env), b);
|
|
2216
|
+
const patternInput_44 = inferExpr(telemetry, typeDefs, constructors, applyEnv(s1_20, env), b);
|
|
2120
2217
|
const s2_11 = patternInput_44[0];
|
|
2121
2218
|
const tv_7 = Types_freshVar();
|
|
2122
|
-
const s_16 = compose(unify(typeDefs, applyType(s2_11, patternInput_44[1]), new Type(11, [applyType(s2_11, patternInput_43[1]), tv_7]), span_20), compose(s2_11, s1_20));
|
|
2219
|
+
const s_16 = compose(unify(typeDefs, applyType(s2_11, patternInput_44[1]), new Type(/* TFun */ 11, [applyType(s2_11, patternInput_43[1]), tv_7]), span_20), compose(s2_11, s1_20));
|
|
2123
2220
|
const tRes_16 = applyType(s_16, tv_7);
|
|
2124
2221
|
return [s_16, tRes_16, asTyped(expr, tRes_16)];
|
|
2125
2222
|
}
|
|
2126
2223
|
case "::": {
|
|
2127
|
-
const patternInput_45 = inferExpr(typeDefs, constructors, env, a);
|
|
2224
|
+
const patternInput_45 = inferExpr(telemetry, typeDefs, constructors, env, a);
|
|
2128
2225
|
const tHead = patternInput_45[1];
|
|
2129
2226
|
const s1_21 = patternInput_45[0];
|
|
2130
|
-
const patternInput_46 = inferExpr(typeDefs, constructors, applyEnv(s1_21, env), b);
|
|
2227
|
+
const patternInput_46 = inferExpr(telemetry, typeDefs, constructors, applyEnv(s1_21, env), b);
|
|
2131
2228
|
const s2_12 = patternInput_46[0];
|
|
2132
|
-
const s_17 = compose(unify(typeDefs, applyType(s2_12, patternInput_46[1]), new Type(5, [tHead]), span_20), compose(s2_12, s1_21));
|
|
2133
|
-
const tRes_17 = applyType(s_17, new Type(5, [tHead]));
|
|
2229
|
+
const s_17 = compose(unify(typeDefs, applyType(s2_12, patternInput_46[1]), new Type(/* TList */ 5, [tHead]), span_20), compose(s2_12, s1_21));
|
|
2230
|
+
const tRes_17 = applyType(s_17, new Type(/* TList */ 5, [tHead]));
|
|
2134
2231
|
return [s_17, tRes_17, asTyped(expr, tRes_17)];
|
|
2135
2232
|
}
|
|
2136
2233
|
case "@": {
|
|
2137
|
-
const patternInput_47 = inferExpr(typeDefs, constructors, env, a);
|
|
2234
|
+
const patternInput_47 = inferExpr(telemetry, typeDefs, constructors, env, a);
|
|
2138
2235
|
const s1_22 = patternInput_47[0];
|
|
2139
|
-
const patternInput_48 = inferExpr(typeDefs, constructors, applyEnv(s1_22, env), b);
|
|
2236
|
+
const patternInput_48 = inferExpr(telemetry, typeDefs, constructors, applyEnv(s1_22, env), b);
|
|
2140
2237
|
const s2_13 = patternInput_48[0];
|
|
2141
2238
|
const tv_8 = Types_freshVar();
|
|
2142
|
-
const s3_10 = unify(typeDefs, applyType(s2_13, patternInput_47[1]), new Type(5, [tv_8]), span_20);
|
|
2143
|
-
const s_18 = compose(unify(typeDefs, applyType(s3_10, applyType(s2_13, patternInput_48[1])), new Type(5, [applyType(s3_10, tv_8)]), span_20), compose(s3_10, compose(s2_13, s1_22)));
|
|
2144
|
-
const tRes_18 = new Type(5, [applyType(s_18, tv_8)]);
|
|
2239
|
+
const s3_10 = unify(typeDefs, applyType(s2_13, patternInput_47[1]), new Type(/* TList */ 5, [tv_8]), span_20);
|
|
2240
|
+
const s_18 = compose(unify(typeDefs, applyType(s3_10, applyType(s2_13, patternInput_48[1])), new Type(/* TList */ 5, [applyType(s3_10, tv_8)]), span_20), compose(s3_10, compose(s2_13, s1_22)));
|
|
2241
|
+
const tRes_18 = new Type(/* TList */ 5, [applyType(s_18, tv_8)]);
|
|
2145
2242
|
return [s_18, tRes_18, asTyped(expr, tRes_18)];
|
|
2146
2243
|
}
|
|
2147
2244
|
default: {
|
|
2148
|
-
const patternInput_49 = inferExpr(typeDefs, constructors, env, a);
|
|
2245
|
+
const patternInput_49 = inferExpr(telemetry, typeDefs, constructors, env, a);
|
|
2149
2246
|
const s1_23 = patternInput_49[0];
|
|
2150
|
-
const patternInput_50 = inferExpr(typeDefs, constructors, applyEnv(s1_23, env), b);
|
|
2247
|
+
const patternInput_50 = inferExpr(telemetry, typeDefs, constructors, applyEnv(s1_23, env), b);
|
|
2151
2248
|
const t2_3 = patternInput_50[1];
|
|
2152
2249
|
const s2_14 = patternInput_50[0];
|
|
2153
2250
|
const s3_11 = unify(typeDefs, applyType(s2_14, patternInput_49[1]), t2_3, span_20);
|
|
@@ -2163,7 +2260,7 @@ function inferExpr(typeDefs, constructors, env, expr) {
|
|
|
2163
2260
|
break;
|
|
2164
2261
|
}
|
|
2165
2262
|
case "=": {
|
|
2166
|
-
resultType =
|
|
2263
|
+
resultType = Type.TBool;
|
|
2167
2264
|
break;
|
|
2168
2265
|
}
|
|
2169
2266
|
case "<":
|
|
@@ -2171,13 +2268,13 @@ function inferExpr(typeDefs, constructors, env, expr) {
|
|
|
2171
2268
|
case "<=":
|
|
2172
2269
|
case ">=": {
|
|
2173
2270
|
numericResult(t_9, span_20);
|
|
2174
|
-
resultType =
|
|
2271
|
+
resultType = Type.TBool;
|
|
2175
2272
|
break;
|
|
2176
2273
|
}
|
|
2177
2274
|
case "&&":
|
|
2178
2275
|
case "||": {
|
|
2179
|
-
unify(typeDefs, t_9,
|
|
2180
|
-
resultType =
|
|
2276
|
+
unify(typeDefs, t_9, Type.TBool, span_20);
|
|
2277
|
+
resultType = Type.TBool;
|
|
2181
2278
|
break;
|
|
2182
2279
|
}
|
|
2183
2280
|
default:
|
|
@@ -2188,38 +2285,38 @@ function inferExpr(typeDefs, constructors, env, expr) {
|
|
|
2188
2285
|
}
|
|
2189
2286
|
}
|
|
2190
2287
|
case 26: {
|
|
2191
|
-
const patternInput_51 = inferExpr(typeDefs, constructors, env, expr.fields[0]);
|
|
2288
|
+
const patternInput_51 = inferExpr(telemetry, typeDefs, constructors, env, expr.fields[0]);
|
|
2192
2289
|
const t1_11 = patternInput_51[1];
|
|
2193
|
-
return [patternInput_51[0], new Type(10, [t1_11]), asTyped(expr, new Type(10, [t1_11]))];
|
|
2290
|
+
return [patternInput_51[0], new Type(/* TOption */ 10, [t1_11]), asTyped(expr, new Type(/* TOption */ 10, [t1_11]))];
|
|
2194
2291
|
}
|
|
2195
2292
|
case 27: {
|
|
2196
2293
|
const tv_9 = Types_freshVar();
|
|
2197
|
-
return [emptySubst, new Type(10, [tv_9]), asTyped(expr, new Type(10, [tv_9]))];
|
|
2294
|
+
return [emptySubst, new Type(/* TOption */ 10, [tv_9]), asTyped(expr, new Type(/* TOption */ 10, [tv_9]))];
|
|
2198
2295
|
}
|
|
2199
2296
|
case 23: {
|
|
2200
|
-
const patternInput_52 = inferExpr(typeDefs, constructors, env, expr.fields[0]);
|
|
2297
|
+
const patternInput_52 = inferExpr(telemetry, typeDefs, constructors, env, expr.fields[0]);
|
|
2201
2298
|
const t1_12 = patternInput_52[1];
|
|
2202
2299
|
const s1_25 = patternInput_52[0];
|
|
2203
|
-
const patternInput_53 = inferExpr(typeDefs, constructors, applyEnv(s1_25, env), expr.fields[1]);
|
|
2300
|
+
const patternInput_53 = inferExpr(telemetry, typeDefs, constructors, applyEnv(s1_25, env), expr.fields[1]);
|
|
2204
2301
|
const s2_15 = patternInput_53[0];
|
|
2205
|
-
const s_20 = compose(unify(typeDefs, applyType(s2_15, patternInput_53[1]), new Type(5, [t1_12]), expr.fields[2]), compose(s2_15, s1_25));
|
|
2206
|
-
const tRes_19 = applyType(s_20, new Type(5, [t1_12]));
|
|
2302
|
+
const s_20 = compose(unify(typeDefs, applyType(s2_15, patternInput_53[1]), new Type(/* TList */ 5, [t1_12]), expr.fields[2]), compose(s2_15, s1_25));
|
|
2303
|
+
const tRes_19 = applyType(s_20, new Type(/* TList */ 5, [t1_12]));
|
|
2207
2304
|
return [s_20, tRes_19, asTyped(expr, tRes_19)];
|
|
2208
2305
|
}
|
|
2209
2306
|
case 24: {
|
|
2210
2307
|
const span_22 = expr.fields[2];
|
|
2211
|
-
const patternInput_54 = inferExpr(typeDefs, constructors, env, expr.fields[0]);
|
|
2308
|
+
const patternInput_54 = inferExpr(telemetry, typeDefs, constructors, env, expr.fields[0]);
|
|
2212
2309
|
const s1_26 = patternInput_54[0];
|
|
2213
|
-
const patternInput_55 = inferExpr(typeDefs, constructors, applyEnv(s1_26, env), expr.fields[1]);
|
|
2310
|
+
const patternInput_55 = inferExpr(telemetry, typeDefs, constructors, applyEnv(s1_26, env), expr.fields[1]);
|
|
2214
2311
|
const s2_16 = patternInput_55[0];
|
|
2215
2312
|
const tv_10 = Types_freshVar();
|
|
2216
|
-
const s3_13 = unify(typeDefs, applyType(s2_16, patternInput_54[1]), new Type(5, [tv_10]), span_22);
|
|
2217
|
-
const s_21 = compose(unify(typeDefs, applyType(s3_13, applyType(s2_16, patternInput_55[1])), new Type(5, [applyType(s3_13, tv_10)]), span_22), compose(s3_13, compose(s2_16, s1_26)));
|
|
2218
|
-
const tRes_20 = new Type(5, [applyType(s_21, tv_10)]);
|
|
2313
|
+
const s3_13 = unify(typeDefs, applyType(s2_16, patternInput_54[1]), new Type(/* TList */ 5, [tv_10]), span_22);
|
|
2314
|
+
const s_21 = compose(unify(typeDefs, applyType(s3_13, applyType(s2_16, patternInput_55[1])), new Type(/* TList */ 5, [applyType(s3_13, tv_10)]), span_22), compose(s3_13, compose(s2_16, s1_26)));
|
|
2315
|
+
const tRes_20 = new Type(/* TList */ 5, [applyType(s_21, tv_10)]);
|
|
2219
2316
|
return [s_21, tRes_20, asTyped(expr, tRes_20)];
|
|
2220
2317
|
}
|
|
2221
2318
|
default:
|
|
2222
|
-
return [emptySubst,
|
|
2319
|
+
return [emptySubst, Type.TUnit, asTyped(expr, Type.TUnit)];
|
|
2223
2320
|
}
|
|
2224
2321
|
}
|
|
2225
2322
|
|
|
@@ -2296,7 +2393,7 @@ function topLevelBindingNames(program) {
|
|
|
2296
2393
|
}, program);
|
|
2297
2394
|
}
|
|
2298
2395
|
|
|
2299
|
-
function inferProgramWithExternsRawAndLocals(externs, program) {
|
|
2396
|
+
function inferProgramWithExternsRawAndLocals(captureLocalVariables, externs, program) {
|
|
2300
2397
|
const decls = ofList(append(map((d) => [d.Name, d], typeDefs_1), choose((_arg) => {
|
|
2301
2398
|
if (_arg.tag === 0) {
|
|
2302
2399
|
const d_1 = _arg.fields[0];
|
|
@@ -2309,13 +2406,16 @@ function inferProgramWithExternsRawAndLocals(externs, program) {
|
|
|
2309
2406
|
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
2310
2407
|
});
|
|
2311
2408
|
const typeDefs = map_1((name, d_2) => {
|
|
2312
|
-
if (!
|
|
2313
|
-
return new Type(13, [name, ofList(map((tupledArg) =>
|
|
2409
|
+
if (!isEmpty_1(d_2.Cases)) {
|
|
2410
|
+
return new Type(/* TUnion */ 13, [name, ofList(map((tupledArg) => {
|
|
2411
|
+
let option_1;
|
|
2412
|
+
return [tupledArg[0], (option_1 = tupledArg[1], (option_1 != null) ? typeFromRef(decls, singleton(name), option_1) : undefined)];
|
|
2413
|
+
}, d_2.Cases), {
|
|
2314
2414
|
Compare: (x_1, y_1) => (comparePrimitives(x_1, y_1) | 0),
|
|
2315
2415
|
})]);
|
|
2316
2416
|
}
|
|
2317
2417
|
else {
|
|
2318
|
-
return new Type(8, [ofList(map((tupledArg_1) => [tupledArg_1[0], typeFromRef(decls, singleton(d_2.Name), tupledArg_1[1])], d_2.Fields), {
|
|
2418
|
+
return new Type(/* TRecord */ 8, [ofList(map((tupledArg_1) => [tupledArg_1[0], typeFromRef(decls, singleton(d_2.Name), tupledArg_1[1])], d_2.Fields), {
|
|
2319
2419
|
Compare: (x_2, y_2) => (comparePrimitives(x_2, y_2) | 0),
|
|
2320
2420
|
})]);
|
|
2321
2421
|
}
|
|
@@ -2323,8 +2423,9 @@ function inferProgramWithExternsRawAndLocals(externs, program) {
|
|
|
2323
2423
|
const constructors = ofList(collect((tupledArg_2) => {
|
|
2324
2424
|
const typeName = tupledArg_2[0];
|
|
2325
2425
|
return collect((tupledArg_3) => {
|
|
2426
|
+
let option_3;
|
|
2326
2427
|
const caseName_1 = tupledArg_3[0];
|
|
2327
|
-
const sigInfo = new ConstructorSig(typeName,
|
|
2428
|
+
const sigInfo = new ConstructorSig(typeName, (option_3 = tupledArg_3[1], (option_3 != null) ? typeFromRef(decls, singleton(typeName), option_3) : undefined));
|
|
2328
2429
|
return ofArray([[caseName_1, sigInfo], [concat(typeName, ".", caseName_1), sigInfo]]);
|
|
2329
2430
|
}, tupledArg_2[1].Cases);
|
|
2330
2431
|
}, toList(decls)), {
|
|
@@ -2333,13 +2434,13 @@ function inferProgramWithExternsRawAndLocals(externs, program) {
|
|
|
2333
2434
|
const constructorSchemes = map((tupledArg_4) => {
|
|
2334
2435
|
let matchValue;
|
|
2335
2436
|
const sigInfo_1 = tupledArg_4[1];
|
|
2336
|
-
const unionType = new Type(12, [sigInfo_1.UnionName]);
|
|
2337
|
-
return [tupledArg_4[0], new Scheme(empty_2(), (matchValue = sigInfo_1.Payload, (matchValue != null) ? (new Type(11, [matchValue, unionType])) : unionType))];
|
|
2437
|
+
const unionType = new Type(/* TNamed */ 12, [sigInfo_1.UnionName]);
|
|
2438
|
+
return [tupledArg_4[0], new Scheme(empty_2(), (matchValue = sigInfo_1.Payload, (matchValue != null) ? (new Type(/* TFun */ 11, [matchValue, unionType])) : unionType))];
|
|
2338
2439
|
}, toList(constructors));
|
|
2339
2440
|
let env = fold((acc, tupledArg_5) => FSharpMap__Add(acc, tupledArg_5[0], tupledArg_5[1]), envFromExterns(externs), constructorSchemes);
|
|
2340
|
-
|
|
2441
|
+
const telemetry = captureLocalVariables ? createTelemetry() : undefined;
|
|
2442
|
+
const typed = [];
|
|
2341
2443
|
try {
|
|
2342
|
-
const typed = [];
|
|
2343
2444
|
const enumerator = getEnumerator(indexed(program));
|
|
2344
2445
|
try {
|
|
2345
2446
|
while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
|
|
@@ -2356,7 +2457,7 @@ function inferProgramWithExternsRawAndLocals(externs, program) {
|
|
|
2356
2457
|
const returnAnnotation = stmt.fields[2];
|
|
2357
2458
|
const name_2 = stmt.fields[0];
|
|
2358
2459
|
const isExported = stmt.fields[5];
|
|
2359
|
-
const exprVal = foldBack((arg, acc_1) => (new Expr(4, [arg, acc_1, span_1])), stmt.fields[1], stmt.fields[3]);
|
|
2460
|
+
const exprVal = foldBack((arg, acc_1) => (new Expr(/* ELambda */ 4, [arg, acc_1, span_1])), stmt.fields[1], stmt.fields[3]);
|
|
2360
2461
|
let startIndex;
|
|
2361
2462
|
if (telemetry == null) {
|
|
2362
2463
|
startIndex = 0;
|
|
@@ -2367,31 +2468,31 @@ function inferProgramWithExternsRawAndLocals(externs, program) {
|
|
|
2367
2468
|
}
|
|
2368
2469
|
if (stmt.fields[4]) {
|
|
2369
2470
|
const tv = Types_freshVar();
|
|
2370
|
-
const patternInput = inferExpr(typeDefs, constructors, add(name_2, new Scheme(empty_2(), tv), env), exprVal);
|
|
2471
|
+
const patternInput = inferExpr(telemetry, typeDefs, constructors, add(name_2, new Scheme(empty_2(), tv), env), exprVal);
|
|
2371
2472
|
const t1 = patternInput[1];
|
|
2372
2473
|
const s1 = patternInput[0];
|
|
2373
2474
|
const s2 = unify(typeDefs, applyType(s1, tv), t1, span_1);
|
|
2374
2475
|
const s = compose((returnAnnotation == null) ? emptySubst : ((expectedReturn = annotationTypeFromRef(typeDefs, span_1, returnAnnotation), unify(typeDefs, functionReturnType(applyType(s2, t1)), expectedReturn, span_1))), compose(s2, s1));
|
|
2375
|
-
applySubstToCapturedLocals(startIndex, s);
|
|
2476
|
+
applySubstToCapturedLocals(telemetry, startIndex, s);
|
|
2376
2477
|
const env$0027 = applyEnv(s, env);
|
|
2377
2478
|
const inferred = applyType(s, t1);
|
|
2378
2479
|
validateMapKeyTypes(span_1, inferred);
|
|
2379
2480
|
const scheme_1 = Types_generalize(env$0027, inferred);
|
|
2380
2481
|
env = add(name_2, scheme_1, env$0027);
|
|
2381
|
-
void (typed.push(new TypedStmt(1, [name_2, exprVal, inferred, true, isExported, span_1])));
|
|
2482
|
+
void (typed.push(new TypedStmt(/* TSLet */ 1, [name_2, exprVal, inferred, true, isExported, span_1])));
|
|
2382
2483
|
}
|
|
2383
2484
|
else {
|
|
2384
|
-
const patternInput_1 = inferExpr(typeDefs, constructors, env, exprVal);
|
|
2485
|
+
const patternInput_1 = inferExpr(telemetry, typeDefs, constructors, env, exprVal);
|
|
2385
2486
|
const t1_1 = patternInput_1[1];
|
|
2386
2487
|
const s1_1 = patternInput_1[0];
|
|
2387
2488
|
const s_1 = compose((returnAnnotation == null) ? emptySubst : ((expectedReturn_1 = annotationTypeFromRef(typeDefs, span_1, returnAnnotation), unify(typeDefs, functionReturnType(applyType(s1_1, t1_1)), expectedReturn_1, span_1))), s1_1);
|
|
2388
|
-
applySubstToCapturedLocals(startIndex, s_1);
|
|
2489
|
+
applySubstToCapturedLocals(telemetry, startIndex, s_1);
|
|
2389
2490
|
const env$0027_1 = applyEnv(s_1, env);
|
|
2390
2491
|
const inferred_1 = applyType(s_1, t1_1);
|
|
2391
2492
|
validateMapKeyTypes(span_1, inferred_1);
|
|
2392
2493
|
const scheme_2 = Types_generalize(env$0027_1, inferred_1);
|
|
2393
2494
|
env = add(name_2, scheme_2, env$0027_1);
|
|
2394
|
-
void (typed.push(new TypedStmt(1, [name_2, exprVal, inferred_1, false, isExported, span_1])));
|
|
2495
|
+
void (typed.push(new TypedStmt(/* TSLet */ 1, [name_2, exprVal, inferred_1, false, isExported, span_1])));
|
|
2395
2496
|
}
|
|
2396
2497
|
break;
|
|
2397
2498
|
}
|
|
@@ -2407,18 +2508,18 @@ function inferProgramWithExternsRawAndLocals(externs, program) {
|
|
|
2407
2508
|
const t_2 = telemetry;
|
|
2408
2509
|
startIndex_1 = t_2.LocalVariableTypes.length;
|
|
2409
2510
|
}
|
|
2410
|
-
const patternInput_2 = inferExpr(typeDefs, constructors, env, expr_1);
|
|
2511
|
+
const patternInput_2 = inferExpr(telemetry, typeDefs, constructors, env, expr_1);
|
|
2411
2512
|
const s1_2 = patternInput_2[0];
|
|
2412
|
-
const patternInput_3 = inferPattern(typeDefs, constructors, pattern);
|
|
2513
|
+
const patternInput_3 = inferPattern(telemetry, typeDefs, constructors, pattern);
|
|
2413
2514
|
const s_2 = compose(unify(typeDefs, applyType(s1_2, patternInput_2[1]), patternInput_3[1], span_2), s1_2);
|
|
2414
|
-
applySubstToCapturedLocals(startIndex_1, s_2);
|
|
2515
|
+
applySubstToCapturedLocals(telemetry, startIndex_1, s_2);
|
|
2415
2516
|
const envBase = applyEnv(s_2, env);
|
|
2416
2517
|
const typedBindings = map_1((_arg_1, ty) => applyType(s_2, ty), patternInput_3[0]);
|
|
2417
2518
|
iterate_2((_arg_2, ty_1) => {
|
|
2418
2519
|
validateMapKeyTypes(span_2, ty_1);
|
|
2419
2520
|
}, typedBindings);
|
|
2420
2521
|
env = fold_1((state_1, name_3, bindingType) => add(name_3, Types_generalize(envBase, bindingType), state_1), envBase, typedBindings);
|
|
2421
|
-
void (typed.push(new TypedStmt(2, [pattern, expr_1, typedBindings, stmt.fields[2], span_2])));
|
|
2522
|
+
void (typed.push(new TypedStmt(/* TSLetPattern */ 2, [pattern, expr_1, typedBindings, stmt.fields[2], span_2])));
|
|
2422
2523
|
break;
|
|
2423
2524
|
}
|
|
2424
2525
|
case 4: {
|
|
@@ -2434,10 +2535,10 @@ function inferProgramWithExternsRawAndLocals(externs, program) {
|
|
|
2434
2535
|
const foldedBindings = map((tupledArg_6) => {
|
|
2435
2536
|
const args_1 = tupledArg_6[1];
|
|
2436
2537
|
const bindingSpan = tupledArg_6[4];
|
|
2437
|
-
if (
|
|
2538
|
+
if (isEmpty_1(args_1)) {
|
|
2438
2539
|
throw new TypeException(new TypeError$("\'let rec ... and ...\' requires function arguments for each binding", bindingSpan));
|
|
2439
2540
|
}
|
|
2440
|
-
return [tupledArg_6[0], tupledArg_6[2], foldBack((arg_1, acc_2) => (new Expr(4, [arg_1, acc_2, bindingSpan])), args_1, tupledArg_6[3]), bindingSpan];
|
|
2541
|
+
return [tupledArg_6[0], tupledArg_6[2], foldBack((arg_1, acc_2) => (new Expr(/* ELambda */ 4, [arg_1, acc_2, bindingSpan])), args_1, tupledArg_6[3]), bindingSpan];
|
|
2441
2542
|
}, stmt.fields[0]);
|
|
2442
2543
|
const freshByName = ofList(map((tupledArg_7) => [tupledArg_7[0], Types_freshVar()], foldedBindings), {
|
|
2443
2544
|
Compare: (x_4, y_4) => (comparePrimitives(x_4, y_4) | 0),
|
|
@@ -2448,7 +2549,7 @@ function inferProgramWithExternsRawAndLocals(externs, program) {
|
|
|
2448
2549
|
try {
|
|
2449
2550
|
while (enumerator_1["System.Collections.IEnumerator.MoveNext"]()) {
|
|
2450
2551
|
const forLoopVar_1 = enumerator_1["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
2451
|
-
const patternInput_4 = inferExpr(typeDefs, constructors, applyEnv(sRec, envRec_1), forLoopVar_1[2]);
|
|
2552
|
+
const patternInput_4 = inferExpr(telemetry, typeDefs, constructors, applyEnv(sRec, envRec_1), forLoopVar_1[2]);
|
|
2452
2553
|
const s1_3 = patternInput_4[0];
|
|
2453
2554
|
const s2_2 = unify(typeDefs, applyType(s1_3, applyType(sRec, FSharpMap__get_Item(freshByName, forLoopVar_1[0]))), patternInput_4[1], forLoopVar_1[3]);
|
|
2454
2555
|
sRec = compose(s2_2, compose(s1_3, sRec));
|
|
@@ -2475,7 +2576,7 @@ function inferProgramWithExternsRawAndLocals(externs, program) {
|
|
|
2475
2576
|
finally {
|
|
2476
2577
|
disposeSafe(enumerator_2);
|
|
2477
2578
|
}
|
|
2478
|
-
applySubstToCapturedLocals(startIndex_2, sRec);
|
|
2579
|
+
applySubstToCapturedLocals(telemetry, startIndex_2, sRec);
|
|
2479
2580
|
const envGeneralize = applyEnv(sRec, env);
|
|
2480
2581
|
const schemes = map((tupledArg_8) => {
|
|
2481
2582
|
const name_9 = tupledArg_8[0];
|
|
@@ -2488,7 +2589,7 @@ function inferProgramWithExternsRawAndLocals(externs, program) {
|
|
|
2488
2589
|
return [name_10, tupledArg_9[2], applyType(sRec, FSharpMap__get_Item(freshByName, name_10)), tupledArg_9[3]];
|
|
2489
2590
|
}, foldedBindings);
|
|
2490
2591
|
env = fold((acc_4, tupledArg_10) => add(tupledArg_10[0], tupledArg_10[1], acc_4), envGeneralize, schemes);
|
|
2491
|
-
void (typed.push(new TypedStmt(3, [typedBindings_1, stmt.fields[1], span_3])));
|
|
2592
|
+
void (typed.push(new TypedStmt(/* TSLetRecGroup */ 3, [typedBindings_1, stmt.fields[1], span_3])));
|
|
2492
2593
|
break;
|
|
2493
2594
|
}
|
|
2494
2595
|
case 5: {
|
|
@@ -2501,54 +2602,57 @@ function inferProgramWithExternsRawAndLocals(externs, program) {
|
|
|
2501
2602
|
const t_4 = telemetry;
|
|
2502
2603
|
startIndex_3 = t_4.LocalVariableTypes.length;
|
|
2503
2604
|
}
|
|
2504
|
-
const patternInput_5 = inferExpr(typeDefs, constructors, env, expr_2);
|
|
2605
|
+
const patternInput_5 = inferExpr(telemetry, typeDefs, constructors, env, expr_2);
|
|
2505
2606
|
const t1_3 = patternInput_5[1];
|
|
2506
2607
|
const s1_4 = patternInput_5[0];
|
|
2507
|
-
const s_3 = compose((forLoopVar[0] < (length(program) - 1)) ? unify(typeDefs, applyType(s1_4, t1_3),
|
|
2508
|
-
applySubstToCapturedLocals(startIndex_3, s_3);
|
|
2608
|
+
const s_3 = compose((forLoopVar[0] < (length(program) - 1)) ? unify(typeDefs, applyType(s1_4, t1_3), Type.TUnit, Ast_spanOfExpr(expr_2)) : emptySubst, s1_4);
|
|
2609
|
+
applySubstToCapturedLocals(telemetry, startIndex_3, s_3);
|
|
2509
2610
|
validateMapKeyTypes(Ast_spanOfExpr(expr_2), applyType(s_3, t1_3));
|
|
2510
2611
|
env = applyEnv(s_3, env);
|
|
2511
|
-
void (typed.push(new TypedStmt(4, [patternInput_5[2]])));
|
|
2612
|
+
void (typed.push(new TypedStmt(/* TSExpr */ 4, [patternInput_5[2]])));
|
|
2512
2613
|
break;
|
|
2513
2614
|
}
|
|
2514
2615
|
default:
|
|
2515
|
-
void (typed.push(new TypedStmt(0, [stmt.fields[0]])));
|
|
2616
|
+
void (typed.push(new TypedStmt(/* TSType */ 0, [stmt.fields[0]])));
|
|
2516
2617
|
}
|
|
2517
2618
|
}
|
|
2518
2619
|
}
|
|
2519
2620
|
finally {
|
|
2520
2621
|
disposeSafe(enumerator);
|
|
2521
2622
|
}
|
|
2522
|
-
return [toList_1(typed),
|
|
2623
|
+
return [toList_1(typed), capturedLocalVariableTypes(telemetry)];
|
|
2523
2624
|
}
|
|
2524
2625
|
catch (matchValue_1) {
|
|
2525
|
-
endTelemetry();
|
|
2526
2626
|
throw matchValue_1;
|
|
2527
2627
|
}
|
|
2528
2628
|
}
|
|
2529
2629
|
|
|
2530
2630
|
export function inferProgramWithExternsRaw(externs, program) {
|
|
2531
|
-
return inferProgramWithExternsRawAndLocals(externs, program)[0];
|
|
2631
|
+
return inferProgramWithExternsRawAndLocals(false, externs, program)[0];
|
|
2532
2632
|
}
|
|
2533
2633
|
|
|
2534
2634
|
export function inferProgramWithExterns(externs, program) {
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2635
|
+
const option_1 = tryFind_1((ext) => contains(ext.Name, builtinReservedNames), externs);
|
|
2636
|
+
if (option_1 != null) {
|
|
2637
|
+
throw new TypeException(new TypeError$(concat("Host extern \'", option_1.Name, "\' collides with reserved stdlib symbol"), unknownSpan));
|
|
2638
|
+
}
|
|
2639
|
+
const option_3 = tryFind_1((name) => contains(name, builtinReservedNames), topLevelBindingNames(program));
|
|
2640
|
+
if (option_3 != null) {
|
|
2641
|
+
throw new TypeException(new TypeError$(concat("Top-level binding \'", option_3, "\' collides with reserved stdlib symbol"), unknownSpan));
|
|
2642
|
+
}
|
|
2541
2643
|
return inferProgramWithExternsRaw(externs, program);
|
|
2542
2644
|
}
|
|
2543
2645
|
|
|
2544
2646
|
export function inferProgramWithExternsAndLocalVariableTypes(externs, program) {
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2647
|
+
const option_1 = tryFind_1((ext) => contains(ext.Name, builtinReservedNames), externs);
|
|
2648
|
+
if (option_1 != null) {
|
|
2649
|
+
throw new TypeException(new TypeError$(concat("Host extern \'", option_1.Name, "\' collides with reserved stdlib symbol"), unknownSpan));
|
|
2650
|
+
}
|
|
2651
|
+
const option_3 = tryFind_1((name) => contains(name, builtinReservedNames), topLevelBindingNames(program));
|
|
2652
|
+
if (option_3 != null) {
|
|
2653
|
+
throw new TypeException(new TypeError$(concat("Top-level binding \'", option_3, "\' collides with reserved stdlib symbol"), unknownSpan));
|
|
2654
|
+
}
|
|
2655
|
+
return inferProgramWithExternsRawAndLocals(true, externs, program);
|
|
2552
2656
|
}
|
|
2553
2657
|
|
|
2554
2658
|
export function inferProgramWithLocalVariableTypes(program) {
|