@magnusopera/fscript 0.92.5 → 0.93.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,11 @@
1
1
 
2
2
  import { Union } from "../fable_modules/fable-library-js.5.27.0/Types.js";
3
3
  import { union_type, list_type, string_type, bool_type } from "../fable_modules/fable-library-js.5.27.0/Reflection.js";
4
- import { value as value_5, toArray, defaultArg } from "../fable_modules/fable-library-js.5.27.0/Option.js";
5
- import { FSharpMap__TryFind, ofList, toList, tryFind } from "../fable_modules/fable-library-js.5.27.0/Map.js";
4
+ import { Types_expand } from "./Types.js";
6
5
  import { exists, length, splitAt, append, tryPick, cons, tryFind as tryFind_1, choose, map, forAll as forAll_1, head as head_7, tail as tail_13, isEmpty, map2, singleton, ofArray, empty, unzip } from "../fable_modules/fable-library-js.5.27.0/List.js";
6
+ import { FSharpMap__TryFind, tryFind, ofList, toList } from "../fable_modules/fable-library-js.5.27.0/Map.js";
7
7
  import { forAll, singleton as singleton_1, collect, delay, toList as toList_1 } from "../fable_modules/fable-library-js.5.27.0/Seq.js";
8
+ import { value as value_5, toArray } from "../fable_modules/fable-library-js.5.27.0/Option.js";
8
9
  import { compare, curry2, equals, comparePrimitives } from "../fable_modules/fable-library-js.5.27.0/Util.js";
9
10
  import { addToSet } from "../fable_modules/fable-library-js.5.27.0/MapUtil.js";
10
11
  import { contains, ofList as ofList_1 } from "../fable_modules/fable-library-js.5.27.0/Set.js";
@@ -50,14 +51,7 @@ function CoveragePattern_$reflection() {
50
51
  return union_type("FScript.Language.MatchCoverage.CoveragePattern", [], CoveragePattern, () => [[], [["Item1", Constructor_$reflection()], ["Item2", list_type(CoveragePattern_$reflection())]], []]);
51
52
  }
52
53
 
53
- function expandType(typeDefs, _arg) {
54
- if (_arg.tag === 12) {
55
- return defaultArg(tryFind(_arg.fields[0], typeDefs), _arg);
56
- }
57
- else {
58
- return _arg;
59
- }
60
- }
54
+ const expandType = (definitions) => ((typ) => Types_expand(definitions, typ));
61
55
 
62
56
  function recordConstructor(fields) {
63
57
  const patternInput = unzip(toList(fields));
@@ -88,12 +82,12 @@ function constructors(_arg) {
88
82
  fields = _arg.fields[0];
89
83
  break;
90
84
  }
91
- case 18: {
85
+ case 20: {
92
86
  matchResult = 4;
93
87
  fields = _arg.fields[1];
94
88
  break;
95
89
  }
96
- case 17: {
90
+ case 19: {
97
91
  matchResult = 4;
98
92
  fields = _arg.fields[1];
99
93
  break;
@@ -102,7 +96,7 @@ function constructors(_arg) {
102
96
  matchResult = 5;
103
97
  break;
104
98
  }
105
- case 13: {
99
+ case 15: {
106
100
  matchResult = 6;
107
101
  break;
108
102
  }
@@ -135,7 +129,7 @@ function constructors(_arg) {
135
129
  export function check(typeDefs, targetType, cases, span) {
136
130
  const normalize = (typ, pattern) => {
137
131
  let matchValue_3, pattern_1, payloadType;
138
- const typ_1 = expandType(typeDefs, typ);
132
+ const typ_1 = expandType(typeDefs)(typ);
139
133
  let matchResult, value_1, item, itemType, head, itemType_1, tail_1, itemTypes, items, fields, types, name_1, payload, types_1, key_1, keyType_1, tail_2, value_2, valueType_1;
140
134
  switch (pattern.tag) {
141
135
  case 0:
@@ -203,13 +197,13 @@ export function check(typeDefs, targetType, cases, span) {
203
197
  types = typ_1.fields[0];
204
198
  break;
205
199
  }
206
- case 18: {
200
+ case 20: {
207
201
  matchResult = 7;
208
202
  fields = pattern.fields[0];
209
203
  types = typ_1.fields[1];
210
204
  break;
211
205
  }
212
- case 17: {
206
+ case 19: {
213
207
  matchResult = 7;
214
208
  fields = pattern.fields[0];
215
209
  types = typ_1.fields[1];
@@ -221,7 +215,7 @@ export function check(typeDefs, targetType, cases, span) {
221
215
  break;
222
216
  }
223
217
  case 10: {
224
- if (typ_1.tag === 13) {
218
+ if (typ_1.tag === 15) {
225
219
  matchResult = 8;
226
220
  name_1 = pattern.fields[1];
227
221
  payload = pattern.fields[2];
@@ -445,7 +439,7 @@ export function check(typeDefs, targetType, cases, span) {
445
439
  }, rows), {
446
440
  Compare: (x_1, y_1) => (compare(x_1, y_1) | 0),
447
441
  });
448
- const available = constructors(expandType(typeDefs, head_7(types_3)));
442
+ const available = constructors(expandType(typeDefs)(head_7(types_3)));
449
443
  const missing = tryFind_1((tupledArg_1) => !contains(tupledArg_1[0], heads), available);
450
444
  if (isEmpty(available)) {
451
445
  const option_2 = uncovered(rest_1, defaultRows);