@fable-org/fable-library-ts 2.0.0-rc.6 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ---
2
+ last_commit_released: 63bcd3d90f37cb3934edcc59b5f54f49ffab3896
3
+ updaters:
4
+ - package.json:
5
+ file: package.json
6
+ - regex:
7
+ file: ./../Fable.Transforms/Global/Compiler.fs
8
+ pattern: (?<=let JS_LIBRARY_VERSION = ").*(?=")
9
+ ---
10
+
1
11
  # Changelog
2
12
 
3
13
  All notable changes to this project will be documented in this file.
@@ -5,7 +15,31 @@ All notable changes to this project will be documented in this file.
5
15
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
16
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
17
 
8
- ## Unreleased
18
+ ## 2.1.0 - 2026-05-28
19
+
20
+ ### 🚀 Features
21
+
22
+ * *(js/ts/python)* Add missing standard DateTime format specifiers for JS/TS and Python (#4547) ([90f5eb7](https://github.com/fable-compiler/Fable/commit/90f5eb7f61710bc679f6fdec30ff5d864984ac08))
23
+ * *(js/ts/python)* Add missing StringBuilder.Append overloads for numeric types (#4568) ([b402c30](https://github.com/fable-compiler/Fable/commit/b402c30d04bfca8644314ba4b21894abfff6a713))
24
+
25
+ ### 🐞 Bug Fixes
26
+
27
+ * [JS/TS] Fix DatetimeOffset.ToString("s") (#4596) ([3ce6f3f](https://github.com/fable-compiler/Fable/commit/3ce6f3fd88cc7f67e34e2bbc311e722c55ffbf45))
28
+ * *(js/ts)* Fix datetime custom format off by one year (#4558) ([83bdbb5](https://github.com/fable-compiler/Fable/commit/83bdbb5b34e70eae203831a3a442d477d15911e1))
29
+ * *(js/ts)* Hex format specifier uses no padding unless precision is specified (#4603) ([ba9857a](https://github.com/fable-compiler/Fable/commit/ba9857a4dcbf7ab1f936241f6619fda43e039040))
30
+ * *(js/ts)* Fix Decimal.GetBits returning incorrect mantissa after round arithmetic result (#4561) ([345bcd4](https://github.com/fable-compiler/Fable/commit/345bcd4b99417b304c71059966126fad74cf3a97))
31
+ * *(js/ts)* Fix G/g format specifier corrupting exponential notation when trimming trailing zeros (#4587) ([773c098](https://github.com/fable-compiler/Fable/commit/773c098a8f7ac7e8db1d4e490dec1294a80321ee))
32
+ * *(js/ts/python)* Fix FSharpOption not recognized as union type in F# reflection (#4529) ([d78a37d](https://github.com/fable-compiler/Fable/commit/d78a37db9f4c25eb51fac8afcd320b4ea36c60a7))
33
+ * *(ts)* Enforce browser-only compatibility in fable-library-ts tsconfig (#4563) ([10c81c1](https://github.com/fable-compiler/Fable/commit/10c81c1361208eb61f5fa78c6704e6fccc068fb1))
34
+
35
+ <strong><small>[View changes on Github](https://github.com/fable-compiler/Fable/compare/b471dc16fc3b5132af77b5974d1669c9b8220cca..63bcd3d90f37cb3934edcc59b5f54f49ffab3896)</small></strong>
36
+
37
+ ## 2.0.0 - 2026-04-21
38
+
39
+ ### Fixed
40
+
41
+ * [JS/TS] Fix `ResizeArray` (`System.Collections.Generic.List`) equality to use reference equality instead of structural equality (fixes #3718)
42
+ * [JS/TS] Fix `String.Contains` ignoring `StringComparison` argument (second argument was silently discarded)
9
43
 
10
44
  ## 2.0.0-rc.6 - 2026-04-07
11
45
 
package/Date.ts CHANGED
@@ -273,13 +273,13 @@ function dateToStringWithCustomFormat(date: Date, format: string, utc: boolean)
273
273
  cursorPos += tokenLength;
274
274
  switch (tokenLength) {
275
275
  case 1:
276
- result += localizedDate.getFullYear() % 100;
276
+ result += year(localizedDate) % 100;
277
277
  break;
278
278
  case 2:
279
- result += padWithZeros(localizedDate.getFullYear() % 100, 2);
279
+ result += padWithZeros(year(localizedDate) % 100, 2);
280
280
  break;
281
281
  default:
282
- result += padWithZeros(localizedDate.getFullYear(), tokenLength);
282
+ result += padWithZeros(year(localizedDate), tokenLength);
283
283
  break;
284
284
  }
285
285
  break;
@@ -410,9 +410,28 @@ function dateToStringWithOffset(date: IDateTimeOffset, format?: string) {
410
410
  switch (format) {
411
411
  case "D": return dateToString_D(d);
412
412
  case "d": return dateToString_d(d);
413
+ case "F": return dateToString_D(d) + " " + dateToString_T(d);
414
+ case "f": return dateToString_D(d) + " " + dateToString_t(d);
415
+ case "G": return dateToString_d(d) + " " + dateToString_T(d);
416
+ case "g": return dateToString_d(d) + " " + dateToString_t(d);
417
+ case "M": case "m": return dateToString_M(d);
418
+ case "O": case "o": return dateToISOStringWithOffset(d, (date.offset ?? 0));
419
+ case "R": case "r": {
420
+ const utcDate = DateTime(date.getTime(), DateTimeKind.Utc);
421
+ return dateToString_R(utcDate);
422
+ }
423
+ case "s": return dateToString_s(toUniversalTime(d));
413
424
  case "T": return dateToString_T(toUniversalTime(d));
414
425
  case "t": return dateToString_t(toUniversalTime(d));
415
- case "O": case "o": return dateToISOStringWithOffset(d, (date.offset ?? 0));
426
+ case "u": {
427
+ const utcDate = DateTime(date.getTime(), DateTimeKind.Utc);
428
+ return dateToString_u(utcDate);
429
+ }
430
+ case "U": {
431
+ const utcDate = DateTime(date.getTime(), DateTimeKind.Utc);
432
+ return dateToString_D(utcDate) + " " + dateToString_T(utcDate);
433
+ }
434
+ case "Y": case "y": return dateToString_Y(d);
416
435
  default: throw new Exception("Unrecognized Date print format");
417
436
  }
418
437
  } else {
@@ -444,6 +463,49 @@ function dateToString_t(date: IDateTime) {
444
463
  + ":" + padWithZeros(minute(date), 2);
445
464
  }
446
465
 
466
+ // RFC 1123: "Thu, 01 Jan 2009 00:00:00 GMT" — always UTC
467
+ function dateToString_R(date: IDateTime) {
468
+ const utcDate = toUniversalTime(date);
469
+ return shortDays[dayOfWeek(utcDate)] + ", "
470
+ + padWithZeros(day(utcDate), 2) + " "
471
+ + shortMonths[month(utcDate) - 1] + " "
472
+ + year(utcDate) + " "
473
+ + padWithZeros(hour(utcDate), 2) + ":"
474
+ + padWithZeros(minute(utcDate), 2) + ":"
475
+ + padWithZeros(second(utcDate), 2) + " GMT";
476
+ }
477
+
478
+ // Sortable ISO 8601, no timezone: "2009-06-15T13:45:30"
479
+ function dateToString_s(date: IDateTime) {
480
+ return padWithZeros(year(date), 4) + "-"
481
+ + padWithZeros(month(date), 2) + "-"
482
+ + padWithZeros(day(date), 2) + "T"
483
+ + padWithZeros(hour(date), 2) + ":"
484
+ + padWithZeros(minute(date), 2) + ":"
485
+ + padWithZeros(second(date), 2);
486
+ }
487
+
488
+ // Universal sortable: "2009-06-15 13:45:30Z" — always UTC
489
+ function dateToString_u(date: IDateTime) {
490
+ const utcDate = toUniversalTime(date);
491
+ return padWithZeros(year(utcDate), 4) + "-"
492
+ + padWithZeros(month(utcDate), 2) + "-"
493
+ + padWithZeros(day(utcDate), 2) + " "
494
+ + padWithZeros(hour(utcDate), 2) + ":"
495
+ + padWithZeros(minute(utcDate), 2) + ":"
496
+ + padWithZeros(second(utcDate), 2) + "Z";
497
+ }
498
+
499
+ // Month/day (InvariantCulture "MMMM dd"): "June 15"
500
+ function dateToString_M(date: IDateTime) {
501
+ return longMonths[month(date) - 1] + " " + padWithZeros(day(date), 2);
502
+ }
503
+
504
+ // Year/month (InvariantCulture "yyyy MMMM"): "2009 June"
505
+ function dateToString_Y(date: IDateTime) {
506
+ return year(date) + " " + longMonths[month(date) - 1];
507
+ }
508
+
447
509
  function dateToStringWithKind(date: IDateTime, format?: string) {
448
510
  const utc = date.kind === DateTimeKind.Utc;
449
511
  if (typeof format !== "string") {
@@ -452,10 +514,19 @@ function dateToStringWithKind(date: IDateTime, format?: string) {
452
514
  switch (format) {
453
515
  case "D": return dateToString_D(date);
454
516
  case "d": return dateToString_d(date);
517
+ case "F": return dateToString_D(date) + " " + dateToString_T(date);
518
+ case "f": return dateToString_D(date) + " " + dateToString_t(date);
519
+ case "G": return dateToString_d(date) + " " + dateToString_T(date);
520
+ case "g": return dateToString_d(date) + " " + dateToString_t(date);
521
+ case "M": case "m": return dateToString_M(date);
522
+ case "O": case "o": return dateToISOString(date, utc);
523
+ case "R": case "r": return dateToString_R(date);
524
+ case "s": return dateToString_s(date);
455
525
  case "T": return dateToString_T(date);
456
526
  case "t": return dateToString_t(date);
457
- case "O": case "o":
458
- return dateToISOString(date, utc);
527
+ case "u": return dateToString_u(date);
528
+ case "U": return dateToString_D(toUniversalTime(date)) + " " + dateToString_T(toUniversalTime(date));
529
+ case "Y": case "y": return dateToString_Y(date);
459
530
  default:
460
531
  throw new Exception("Unrecognized Date print format");
461
532
  }
package/Decimal.ts CHANGED
@@ -248,14 +248,16 @@ export function fromParts(low: number, mid: number, high: number, isNegative: bo
248
248
 
249
249
  export function getBits(d: Decimal) {
250
250
  const bitSize = 96;
251
- const decDigits = Uint8Array.from(d.c);
251
+ const decStr = d.toString();
252
+ const absStr = decStr[0] === "-" ? decStr.slice(1) : decStr;
253
+ const dotPos = absStr.indexOf(".");
254
+ const scale = dotPos < 0 ? 0 : absStr.length - dotPos - 1;
255
+ const mantissaStr = absStr.replace(".", "");
256
+ const decDigits = Uint8Array.from(mantissaStr, ch => ch.charCodeAt(0) - 48);
252
257
  const hexDigits = decimalToHex(decDigits, bitSize);
253
258
  const low = getInt32Bits(hexDigits, 0);
254
259
  const mid = getInt32Bits(hexDigits, 8);
255
260
  const high = getInt32Bits(hexDigits, 16);
256
- const decStr = d.toString();
257
- const dotPos = decStr.indexOf(".");
258
- const scale = dotPos < 0 ? 0 : decStr.length - dotPos - 1;
259
261
  const signExp = ((scale & 0x7F) << 16) | (d.s < 0 ? 0x80000000 : 0);
260
262
  return [low, mid, high, signExp];
261
263
  }
package/Reflection.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { FSharpRef, Record, Union } from "./Types.ts";
2
2
  import { Exception, MutableArray, combineHashCodes, equalArraysWith, IEquatable, stringHash } from "./Util.ts";
3
3
  import Decimal from "./Decimal.ts";
4
+ import { Some, some } from "./Option.ts";
4
5
 
5
6
  export type FieldInfo = [string, TypeInfo];
6
7
  export type PropertyInfo = FieldInfo;
@@ -155,7 +156,18 @@ export function lambda_type(argType: TypeInfo, returnType: TypeInfo): TypeInfo {
155
156
  }
156
157
 
157
158
  export function option_type(generic: TypeInfo): TypeInfo {
158
- return new TypeInfo("Microsoft.FSharp.Core.FSharpOption`1", [generic]);
159
+ const t: TypeInfo = new TypeInfo(
160
+ "Microsoft.FSharp.Core.FSharpOption`1",
161
+ [generic],
162
+ undefined,
163
+ undefined,
164
+ undefined,
165
+ () => [
166
+ new CaseInfo(t, 0, "None"),
167
+ new CaseInfo(t, 1, "Some", [["value", generic]])
168
+ ]
169
+ );
170
+ return t;
159
171
  }
160
172
 
161
173
  export function list_type(generic: TypeInfo): TypeInfo {
@@ -443,6 +455,15 @@ export function isFunction(t: TypeInfo): boolean {
443
455
 
444
456
  export function getUnionFields(v: any, t: TypeInfo): [CaseInfo, any[]] {
445
457
  const cases = getUnionCases(t);
458
+ // Special handling for option types (None is undefined, Some is the value or a Some wrapper)
459
+ if (t.fullname === "Microsoft.FSharp.Core.FSharpOption`1") {
460
+ if (v == null) {
461
+ return [cases[0], []]; // None case
462
+ } else {
463
+ const innerValue = v instanceof Some ? v.value : v;
464
+ return [cases[1], [innerValue]]; // Some case
465
+ }
466
+ }
446
467
  const case_ = cases[v.tag];
447
468
  if (case_ == null) {
448
469
  throw new Exception(`Cannot find case ${v.name} in union type`);
@@ -478,6 +499,10 @@ export function makeUnion(uci: CaseInfo, values: MutableArray<any>): any {
478
499
  if (values.length !== expectedLength) {
479
500
  throw new Exception(`Expected an array of length ${expectedLength} but got ${values.length}`);
480
501
  }
502
+ // Special handling for option types
503
+ if (uci.declaringType.fullname === "Microsoft.FSharp.Core.FSharpOption`1") {
504
+ return uci.tag === 0 ? undefined : some(values[0]);
505
+ }
481
506
  const construct = uci.declaringType.construct;
482
507
  if (construct == null) {
483
508
  return {};
package/Seq.ts CHANGED
@@ -6,9 +6,10 @@ import { class_type, TypeInfo } from "./Reflection.ts";
6
6
  import { some, value as value_1, Option } from "./Option.ts";
7
7
  import { KeyNotFoundException_$ctor_Z721C83C5 } from "./System.Collections.Generic.ts";
8
8
  import { Operators_Lock, Operators_NullArgCheck } from "./FSharp.Core.ts";
9
- import { randomSampleBy as randomSampleBy_1, randomChoicesBy as randomChoicesBy_1, randomChoice as randomChoice_1, randomChoiceWith as randomChoiceWith_1, randomChoiceBy as randomChoiceBy_1, randomShuffleInPlaceBy, chunkBySize as chunkBySize_1, permute as permute_1, transpose as transpose_1, map as map_1, windowed as windowed_1, splitInto as splitInto_1, pairwise as pairwise_1, scanBack as scanBack_1, reverse as reverse_1, mapFoldBack as mapFoldBack_1, mapFold as mapFold_1, item as item_1, tryItem as tryItem_1, tryHead as tryHead_1, foldBack2 as foldBack2_1, foldBack as foldBack_1, tryFindIndexBack as tryFindIndexBack_1, tryFindBack as tryFindBack_1, singleton as singleton_1 } from "./Array.ts";
9
+ import { randomSampleBy as randomSampleBy_1, randomChoicesBy as randomChoicesBy_1, randomChoice as randomChoice_1, randomChoiceWith as randomChoiceWith_1, randomChoiceBy as randomChoiceBy_1, randomShuffleInPlaceBy, chunkBySize as chunkBySize_1, permute as permute_1, transpose as transpose_1, map as map_1, windowed as windowed_1, splitInto as splitInto_1, pairwise as pairwise_1, scanBack as scanBack_1, reverse as reverse_1, mapFoldBack as mapFoldBack_1, mapFold as mapFold_1, tryItem as tryItem_1, tryHead as tryHead_1, item as item_1, foldBack as foldBack_1, tryFindIndexBack as tryFindIndexBack_1, tryFindBack as tryFindBack_1, singleton as singleton_1 } from "./Array.ts";
10
10
  import { length as length_1, tryItem as tryItem_2, isEmpty as isEmpty_1, tryHead as tryHead_2, ofSeq as ofSeq_1, ofArray as ofArray_1, toArray as toArray_1, FSharpList } from "./List.ts";
11
11
  import { float64, int32 } from "./Int32.ts";
12
+ import { min as min_1 } from "./Double.ts";
12
13
  import { SR_indexOutOfBounds } from "./Global.ts";
13
14
  import { nonSeeded } from "./Random.ts";
14
15
 
@@ -724,7 +725,14 @@ export function fold2<T1, T2, State>(folder: ((arg0: State, arg1: T1, arg2: T2)
724
725
  }
725
726
 
726
727
  export function foldBack2<T1, T2, State>(folder: ((arg0: T1, arg1: T2, arg2: State) => State), xs: Iterable<T1>, ys: Iterable<T2>, state: State): State {
727
- return foldBack2_1<T1, T2, State>(folder, toArray<T1>(xs), toArray<T2>(ys), state);
728
+ const xs_1: MutableArray<T1> = toArray<T1>(xs);
729
+ const ys_1: MutableArray<T2> = toArray<T2>(ys);
730
+ const len: int32 = min_1(xs_1.length, ys_1.length) | 0;
731
+ let acc: State = state;
732
+ for (let i: int32 = len - 1; i >= 0; i--) {
733
+ acc = folder(item_1(i, xs_1), item_1(i, ys_1), acc);
734
+ }
735
+ return acc;
728
736
  }
729
737
 
730
738
  export function forAll<$a>(predicate: ((arg0: $a) => boolean), xs: Iterable<$a>): boolean {
package/Set.ts CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  import { record_type, bool_type, list_type, option_type, class_type, TypeInfo } from "./Reflection.ts";
3
- import { some, value as value_3, Option } from "./Option.ts";
3
+ import { some, value as value_2, Option } from "./Option.ts";
4
4
  import { int32 } from "./Int32.ts";
5
5
  import { structuralHash, ISet, toIterator, IDisposable, disposeSafe, getEnumerator, isArrayLike, MutableArray, IEnumerator, IComparer, Exception } from "./Util.ts";
6
6
  import { Record } from "./Types.ts";
@@ -8,7 +8,7 @@ import { fold as fold_2, cons, singleton as singleton_1, empty as empty_1, ofArr
8
8
  import { fold as fold_1, fill, setItem } from "./Array.ts";
9
9
  import { join } from "./String.ts";
10
10
  import { NotSupportedException_$ctor_Z721C83C5 } from "./System.ts";
11
- import { exists as exists_1, cache, forAll as forAll_1, fold as fold_3, reduce, iterate as iterate_1, map as map_1 } from "./Seq.ts";
11
+ import { skip, truncate, iterateIndexed, exists as exists_1, forAll as forAll_1, fold as fold_3, reduce, iterate as iterate_1, map as map_1 } from "./Seq.ts";
12
12
  import { HashSet__get_Comparer, HashSet_$ctor_Z6150332D, HashSet } from "./MutableSet.ts";
13
13
 
14
14
  export class SetTreeLeaf$1<T> {
@@ -71,7 +71,7 @@ export function SetTreeModule_countAux<T>(t_mut: Option<SetTreeLeaf$1<T>>, acc_m
71
71
  while (true) {
72
72
  const t: Option<SetTreeLeaf$1<T>> = t_mut, acc: int32 = acc_mut;
73
73
  if (t != null) {
74
- const t2: SetTreeLeaf$1<T> = value_3(t);
74
+ const t2: SetTreeLeaf$1<T> = value_2(t);
75
75
  if (t2 instanceof SetTreeNode$1) {
76
76
  const tn = t2 as SetTreeNode$1<T>;
77
77
  t_mut = SetTreeNode$1__get_Left<T>(tn);
@@ -98,7 +98,7 @@ export function SetTreeModule_mk<T>(l: Option<SetTreeLeaf$1<T>>, k: T, r: Option
98
98
  let hl: int32;
99
99
  const t: Option<SetTreeLeaf$1<T>> = l;
100
100
  if (t != null) {
101
- const t2: SetTreeLeaf$1<T> = value_3(t);
101
+ const t2: SetTreeLeaf$1<T> = value_2(t);
102
102
  hl = ((t2 instanceof SetTreeNode$1) ? ((tn = (t2 as SetTreeNode$1<T>), SetTreeNode$1__get_Height<T>(tn))) : 1);
103
103
  }
104
104
  else {
@@ -107,7 +107,7 @@ export function SetTreeModule_mk<T>(l: Option<SetTreeLeaf$1<T>>, k: T, r: Option
107
107
  let hr: int32;
108
108
  const t_1: Option<SetTreeLeaf$1<T>> = r;
109
109
  if (t_1 != null) {
110
- const t2_1: SetTreeLeaf$1<T> = value_3(t_1);
110
+ const t2_1: SetTreeLeaf$1<T> = value_2(t_1);
111
111
  hr = ((t2_1 instanceof SetTreeNode$1) ? ((tn_1 = (t2_1 as SetTreeNode$1<T>), SetTreeNode$1__get_Height<T>(tn_1))) : 1);
112
112
  }
113
113
  else {
@@ -127,7 +127,7 @@ export function SetTreeModule_rebalance<T>(t1: Option<SetTreeLeaf$1<T>>, v: T, t
127
127
  let t1h: int32;
128
128
  const t: Option<SetTreeLeaf$1<T>> = t1;
129
129
  if (t != null) {
130
- const t2_1: SetTreeLeaf$1<T> = value_3(t);
130
+ const t2_1: SetTreeLeaf$1<T> = value_2(t);
131
131
  t1h = ((t2_1 instanceof SetTreeNode$1) ? ((tn = (t2_1 as SetTreeNode$1<T>), SetTreeNode$1__get_Height<T>(tn))) : 1);
132
132
  }
133
133
  else {
@@ -136,18 +136,18 @@ export function SetTreeModule_rebalance<T>(t1: Option<SetTreeLeaf$1<T>>, v: T, t
136
136
  let t2h: int32;
137
137
  const t_1: Option<SetTreeLeaf$1<T>> = t2;
138
138
  if (t_1 != null) {
139
- const t2_2: SetTreeLeaf$1<T> = value_3(t_1);
139
+ const t2_2: SetTreeLeaf$1<T> = value_2(t_1);
140
140
  t2h = ((t2_2 instanceof SetTreeNode$1) ? ((tn_1 = (t2_2 as SetTreeNode$1<T>), SetTreeNode$1__get_Height<T>(tn_1))) : 1);
141
141
  }
142
142
  else {
143
143
  t2h = 0;
144
144
  }
145
145
  if (t2h > (t1h + 2)) {
146
- const matchValue: SetTreeLeaf$1<T> = value_3(t2);
146
+ const matchValue: SetTreeLeaf$1<T> = value_2(t2);
147
147
  if (matchValue instanceof SetTreeNode$1) {
148
148
  const t2$0027 = matchValue as SetTreeNode$1<T>;
149
- if (((t_2 = SetTreeNode$1__get_Left<T>(t2$0027), (t_2 != null) ? ((t2_3 = value_3(t_2), (t2_3 instanceof SetTreeNode$1) ? ((tn_2 = (t2_3 as SetTreeNode$1<T>), SetTreeNode$1__get_Height<T>(tn_2))) : 1)) : 0)) > (t1h + 1)) {
150
- const matchValue_1: SetTreeLeaf$1<T> = value_3(SetTreeNode$1__get_Left<T>(t2$0027));
149
+ if (((t_2 = SetTreeNode$1__get_Left<T>(t2$0027), (t_2 != null) ? ((t2_3 = value_2(t_2), (t2_3 instanceof SetTreeNode$1) ? ((tn_2 = (t2_3 as SetTreeNode$1<T>), SetTreeNode$1__get_Height<T>(tn_2))) : 1)) : 0)) > (t1h + 1)) {
150
+ const matchValue_1: SetTreeLeaf$1<T> = value_2(SetTreeNode$1__get_Left<T>(t2$0027));
151
151
  if (matchValue_1 instanceof SetTreeNode$1) {
152
152
  const t2l = matchValue_1 as SetTreeNode$1<T>;
153
153
  return SetTreeModule_mk<T>(SetTreeModule_mk<T>(t1, v, SetTreeNode$1__get_Left<T>(t2l)), SetTreeLeaf$1__get_Key<T>(t2l), SetTreeModule_mk<T>(SetTreeNode$1__get_Right<T>(t2l), SetTreeLeaf$1__get_Key<T>(t2$0027), SetTreeNode$1__get_Right<T>(t2$0027)));
@@ -165,11 +165,11 @@ export function SetTreeModule_rebalance<T>(t1: Option<SetTreeLeaf$1<T>>, v: T, t
165
165
  }
166
166
  }
167
167
  else if (t1h > (t2h + 2)) {
168
- const matchValue_2: SetTreeLeaf$1<T> = value_3(t1);
168
+ const matchValue_2: SetTreeLeaf$1<T> = value_2(t1);
169
169
  if (matchValue_2 instanceof SetTreeNode$1) {
170
170
  const t1$0027 = matchValue_2 as SetTreeNode$1<T>;
171
- if (((t_3 = SetTreeNode$1__get_Right<T>(t1$0027), (t_3 != null) ? ((t2_4 = value_3(t_3), (t2_4 instanceof SetTreeNode$1) ? ((tn_3 = (t2_4 as SetTreeNode$1<T>), SetTreeNode$1__get_Height<T>(tn_3))) : 1)) : 0)) > (t2h + 1)) {
172
- const matchValue_3: SetTreeLeaf$1<T> = value_3(SetTreeNode$1__get_Right<T>(t1$0027));
171
+ if (((t_3 = SetTreeNode$1__get_Right<T>(t1$0027), (t_3 != null) ? ((t2_4 = value_2(t_3), (t2_4 instanceof SetTreeNode$1) ? ((tn_3 = (t2_4 as SetTreeNode$1<T>), SetTreeNode$1__get_Height<T>(tn_3))) : 1)) : 0)) > (t2h + 1)) {
172
+ const matchValue_3: SetTreeLeaf$1<T> = value_2(SetTreeNode$1__get_Right<T>(t1$0027));
173
173
  if (matchValue_3 instanceof SetTreeNode$1) {
174
174
  const t1r = matchValue_3 as SetTreeNode$1<T>;
175
175
  return SetTreeModule_mk<T>(SetTreeModule_mk<T>(SetTreeNode$1__get_Left<T>(t1$0027), SetTreeLeaf$1__get_Key<T>(t1$0027), SetTreeNode$1__get_Left<T>(t1r)), SetTreeLeaf$1__get_Key<T>(t1r), SetTreeModule_mk<T>(SetTreeNode$1__get_Right<T>(t1r), v, t2));
@@ -193,7 +193,7 @@ export function SetTreeModule_rebalance<T>(t1: Option<SetTreeLeaf$1<T>>, v: T, t
193
193
 
194
194
  export function SetTreeModule_add<T>(comparer: IComparer<T>, k: T, t: Option<SetTreeLeaf$1<T>>): Option<SetTreeLeaf$1<T>> {
195
195
  if (t != null) {
196
- const t2: SetTreeLeaf$1<T> = value_3(t);
196
+ const t2: SetTreeLeaf$1<T> = value_2(t);
197
197
  const c: int32 = comparer.Compare(k, SetTreeLeaf$1__get_Key<T>(t2)) | 0;
198
198
  if (t2 instanceof SetTreeNode$1) {
199
199
  const tn = t2 as SetTreeNode$1<T>;
@@ -227,9 +227,9 @@ export function SetTreeModule_add<T>(comparer: IComparer<T>, k: T, t: Option<Set
227
227
 
228
228
  export function SetTreeModule_balance<T>(comparer: IComparer<T>, t1: Option<SetTreeLeaf$1<T>>, k: T, t2: Option<SetTreeLeaf$1<T>>): Option<SetTreeLeaf$1<T>> {
229
229
  if (t1 != null) {
230
- const t1$0027: SetTreeLeaf$1<T> = value_3(t1);
230
+ const t1$0027: SetTreeLeaf$1<T> = value_2(t1);
231
231
  if (t2 != null) {
232
- const t2$0027: SetTreeLeaf$1<T> = value_3(t2);
232
+ const t2$0027: SetTreeLeaf$1<T> = value_2(t2);
233
233
  if (t1$0027 instanceof SetTreeNode$1) {
234
234
  const t1n = t1$0027 as SetTreeNode$1<T>;
235
235
  if (t2$0027 instanceof SetTreeNode$1) {
@@ -263,7 +263,7 @@ export function SetTreeModule_balance<T>(comparer: IComparer<T>, t1: Option<SetT
263
263
 
264
264
  export function SetTreeModule_split<T>(comparer: IComparer<T>, pivot: T, t: Option<SetTreeLeaf$1<T>>): [Option<SetTreeLeaf$1<T>>, boolean, Option<SetTreeLeaf$1<T>>] {
265
265
  if (t != null) {
266
- const t2: SetTreeLeaf$1<T> = value_3(t);
266
+ const t2: SetTreeLeaf$1<T> = value_2(t);
267
267
  if (t2 instanceof SetTreeNode$1) {
268
268
  const tn = t2 as SetTreeNode$1<T>;
269
269
  const c: int32 = comparer.Compare(pivot, SetTreeLeaf$1__get_Key<T>(tn)) | 0;
@@ -299,7 +299,7 @@ export function SetTreeModule_split<T>(comparer: IComparer<T>, pivot: T, t: Opti
299
299
 
300
300
  export function SetTreeModule_spliceOutSuccessor<T>(t: Option<SetTreeLeaf$1<T>>): [T, Option<SetTreeLeaf$1<T>>] {
301
301
  if (t != null) {
302
- const t2: SetTreeLeaf$1<T> = value_3(t);
302
+ const t2: SetTreeLeaf$1<T> = value_2(t);
303
303
  if (t2 instanceof SetTreeNode$1) {
304
304
  const tn = t2 as SetTreeNode$1<T>;
305
305
  if (SetTreeNode$1__get_Left<T>(tn) == null) {
@@ -321,7 +321,7 @@ export function SetTreeModule_spliceOutSuccessor<T>(t: Option<SetTreeLeaf$1<T>>)
321
321
 
322
322
  export function SetTreeModule_remove<T>(comparer: IComparer<T>, k: T, t: Option<SetTreeLeaf$1<T>>): Option<SetTreeLeaf$1<T>> {
323
323
  if (t != null) {
324
- const t2: SetTreeLeaf$1<T> = value_3(t);
324
+ const t2: SetTreeLeaf$1<T> = value_2(t);
325
325
  const c: int32 = comparer.Compare(k, SetTreeLeaf$1__get_Key<T>(t2)) | 0;
326
326
  if (t2 instanceof SetTreeNode$1) {
327
327
  const tn = t2 as SetTreeNode$1<T>;
@@ -361,7 +361,7 @@ export function SetTreeModule_mem<T>(comparer_mut: IComparer<T>, k_mut: T, t_mut
361
361
  while (true) {
362
362
  const comparer: IComparer<T> = comparer_mut, k: T = k_mut, t: Option<SetTreeLeaf$1<T>> = t_mut;
363
363
  if (t != null) {
364
- const t2: SetTreeLeaf$1<T> = value_3(t);
364
+ const t2: SetTreeLeaf$1<T> = value_2(t);
365
365
  const c: int32 = comparer.Compare(k, SetTreeLeaf$1__get_Key<T>(t2)) | 0;
366
366
  if (t2 instanceof SetTreeNode$1) {
367
367
  const tn = t2 as SetTreeNode$1<T>;
@@ -397,7 +397,7 @@ export function SetTreeModule_iter<T>(f_mut: ((arg0: T) => void), t_mut: Option<
397
397
  while (true) {
398
398
  const f: ((arg0: T) => void) = f_mut, t: Option<SetTreeLeaf$1<T>> = t_mut;
399
399
  if (t != null) {
400
- const t2: SetTreeLeaf$1<T> = value_3(t);
400
+ const t2: SetTreeLeaf$1<T> = value_2(t);
401
401
  if (t2 instanceof SetTreeNode$1) {
402
402
  const tn = t2 as SetTreeNode$1<T>;
403
403
  SetTreeModule_iter<T>(f, SetTreeNode$1__get_Left<T>(tn));
@@ -419,7 +419,7 @@ export function SetTreeModule_foldBackOpt<T, $a>(f_mut: any, t_mut: Option<SetTr
419
419
  while (true) {
420
420
  const f: any = f_mut, t: Option<SetTreeLeaf$1<T>> = t_mut, x: $a = x_mut;
421
421
  if (t != null) {
422
- const t2: SetTreeLeaf$1<T> = value_3(t);
422
+ const t2: SetTreeLeaf$1<T> = value_2(t);
423
423
  if (t2 instanceof SetTreeNode$1) {
424
424
  const tn = t2 as SetTreeNode$1<T>;
425
425
  f_mut = f;
@@ -447,7 +447,7 @@ export function SetTreeModule_foldOpt<$a, T>(f_mut: any, x_mut: $a, t_mut: Optio
447
447
  while (true) {
448
448
  const f: any = f_mut, x: $a = x_mut, t: Option<SetTreeLeaf$1<T>> = t_mut;
449
449
  if (t != null) {
450
- const t2: SetTreeLeaf$1<T> = value_3(t);
450
+ const t2: SetTreeLeaf$1<T> = value_2(t);
451
451
  if (t2 instanceof SetTreeNode$1) {
452
452
  const tn = t2 as SetTreeNode$1<T>;
453
453
  f_mut = f;
@@ -475,7 +475,7 @@ export function SetTreeModule_forall<T>(f_mut: ((arg0: T) => boolean), t_mut: Op
475
475
  while (true) {
476
476
  const f: ((arg0: T) => boolean) = f_mut, t: Option<SetTreeLeaf$1<T>> = t_mut;
477
477
  if (t != null) {
478
- const t2: SetTreeLeaf$1<T> = value_3(t);
478
+ const t2: SetTreeLeaf$1<T> = value_2(t);
479
479
  if (t2 instanceof SetTreeNode$1) {
480
480
  const tn = t2 as SetTreeNode$1<T>;
481
481
  if (f(SetTreeLeaf$1__get_Key<T>(tn)) && SetTreeModule_forall<T>(f, SetTreeNode$1__get_Left<T>(tn))) {
@@ -503,7 +503,7 @@ export function SetTreeModule_exists<T>(f_mut: ((arg0: T) => boolean), t_mut: Op
503
503
  while (true) {
504
504
  const f: ((arg0: T) => boolean) = f_mut, t: Option<SetTreeLeaf$1<T>> = t_mut;
505
505
  if (t != null) {
506
- const t2: SetTreeLeaf$1<T> = value_3(t);
506
+ const t2: SetTreeLeaf$1<T> = value_2(t);
507
507
  if (t2 instanceof SetTreeNode$1) {
508
508
  const tn = t2 as SetTreeNode$1<T>;
509
509
  if (f(SetTreeLeaf$1__get_Key<T>(tn)) ? true : SetTreeModule_exists<T>(f, SetTreeNode$1__get_Left<T>(tn))) {
@@ -544,7 +544,7 @@ export function SetTreeModule_filterAux<T>(comparer_mut: IComparer<T>, f_mut: ((
544
544
  while (true) {
545
545
  const comparer: IComparer<T> = comparer_mut, f: ((arg0: T) => boolean) = f_mut, t: Option<SetTreeLeaf$1<T>> = t_mut, acc: Option<SetTreeLeaf$1<T>> = acc_mut;
546
546
  if (t != null) {
547
- const t2: SetTreeLeaf$1<T> = value_3(t);
547
+ const t2: SetTreeLeaf$1<T> = value_2(t);
548
548
  if (t2 instanceof SetTreeNode$1) {
549
549
  const tn = t2 as SetTreeNode$1<T>;
550
550
  const acc_1: Option<SetTreeLeaf$1<T>> = f(SetTreeLeaf$1__get_Key<T>(tn)) ? SetTreeModule_add<T>(comparer, SetTreeLeaf$1__get_Key<T>(tn), acc) : acc;
@@ -580,7 +580,7 @@ export function SetTreeModule_diffAux<T>(comparer_mut: IComparer<T>, t_mut: Opti
580
580
  return acc;
581
581
  }
582
582
  else if (t != null) {
583
- const t2: SetTreeLeaf$1<T> = value_3(t);
583
+ const t2: SetTreeLeaf$1<T> = value_2(t);
584
584
  if (t2 instanceof SetTreeNode$1) {
585
585
  const tn = t2 as SetTreeNode$1<T>;
586
586
  comparer_mut = comparer;
@@ -605,9 +605,9 @@ export function SetTreeModule_diff<$a>(comparer: IComparer<$a>, a: Option<SetTre
605
605
 
606
606
  export function SetTreeModule_union<T>(comparer: IComparer<T>, t1: Option<SetTreeLeaf$1<T>>, t2: Option<SetTreeLeaf$1<T>>): Option<SetTreeLeaf$1<T>> {
607
607
  if (t1 != null) {
608
- const t1$0027: SetTreeLeaf$1<T> = value_3(t1);
608
+ const t1$0027: SetTreeLeaf$1<T> = value_2(t1);
609
609
  if (t2 != null) {
610
- const t2$0027: SetTreeLeaf$1<T> = value_3(t2);
610
+ const t2$0027: SetTreeLeaf$1<T> = value_2(t2);
611
611
  if (t1$0027 instanceof SetTreeNode$1) {
612
612
  const t1n = t1$0027 as SetTreeNode$1<T>;
613
613
  if (t2$0027 instanceof SetTreeNode$1) {
@@ -643,7 +643,7 @@ export function SetTreeModule_intersectionAux<T>(comparer_mut: IComparer<T>, b_m
643
643
  while (true) {
644
644
  const comparer: IComparer<T> = comparer_mut, b: Option<SetTreeLeaf$1<T>> = b_mut, t: Option<SetTreeLeaf$1<T>> = t_mut, acc: Option<SetTreeLeaf$1<T>> = acc_mut;
645
645
  if (t != null) {
646
- const t2: SetTreeLeaf$1<T> = value_3(t);
646
+ const t2: SetTreeLeaf$1<T> = value_2(t);
647
647
  if (t2 instanceof SetTreeNode$1) {
648
648
  const tn = t2 as SetTreeNode$1<T>;
649
649
  const acc_1: Option<SetTreeLeaf$1<T>> = SetTreeModule_intersectionAux<T>(comparer, b, SetTreeNode$1__get_Right<T>(tn), acc);
@@ -687,7 +687,7 @@ export function SetTreeModule_partitionAux<T>(comparer_mut: IComparer<T>, f_mut:
687
687
  const comparer: IComparer<T> = comparer_mut, f: ((arg0: T) => boolean) = f_mut, t: Option<SetTreeLeaf$1<T>> = t_mut, acc_: Option<SetTreeLeaf$1<T>> = acc__mut, acc__1: Option<SetTreeLeaf$1<T>> = acc__1_mut;
688
688
  const acc = [acc_, acc__1] as [Option<SetTreeLeaf$1<T>>, Option<SetTreeLeaf$1<T>>];
689
689
  if (t != null) {
690
- const t2: SetTreeLeaf$1<T> = value_3(t);
690
+ const t2: SetTreeLeaf$1<T> = value_2(t);
691
691
  if (t2 instanceof SetTreeNode$1) {
692
692
  const tn = t2 as SetTreeNode$1<T>;
693
693
  const acc_1: [Option<SetTreeLeaf$1<T>>, Option<SetTreeLeaf$1<T>>] = SetTreeModule_partitionAux<T>(comparer, f, SetTreeNode$1__get_Right<T>(tn), acc[0], acc[1]);
@@ -719,7 +719,7 @@ export function SetTreeModule_minimumElementAux<T>(t_mut: Option<SetTreeLeaf$1<T
719
719
  while (true) {
720
720
  const t: Option<SetTreeLeaf$1<T>> = t_mut, n: T = n_mut;
721
721
  if (t != null) {
722
- const t2: SetTreeLeaf$1<T> = value_3(t);
722
+ const t2: SetTreeLeaf$1<T> = value_2(t);
723
723
  if (t2 instanceof SetTreeNode$1) {
724
724
  const tn = t2 as SetTreeNode$1<T>;
725
725
  t_mut = SetTreeNode$1__get_Left<T>(tn);
@@ -739,7 +739,7 @@ export function SetTreeModule_minimumElementAux<T>(t_mut: Option<SetTreeLeaf$1<T
739
739
 
740
740
  export function SetTreeModule_minimumElementOpt<T>(t: Option<SetTreeLeaf$1<T>>): Option<T> {
741
741
  if (t != null) {
742
- const t2: SetTreeLeaf$1<T> = value_3(t);
742
+ const t2: SetTreeLeaf$1<T> = value_2(t);
743
743
  if (t2 instanceof SetTreeNode$1) {
744
744
  const tn = t2 as SetTreeNode$1<T>;
745
745
  return some(SetTreeModule_minimumElementAux<T>(SetTreeNode$1__get_Left<T>(tn), SetTreeLeaf$1__get_Key<T>(tn)));
@@ -758,7 +758,7 @@ export function SetTreeModule_maximumElementAux<T>(t_mut: Option<SetTreeLeaf$1<T
758
758
  while (true) {
759
759
  const t: Option<SetTreeLeaf$1<T>> = t_mut, n: T = n_mut;
760
760
  if (t != null) {
761
- const t2: SetTreeLeaf$1<T> = value_3(t);
761
+ const t2: SetTreeLeaf$1<T> = value_2(t);
762
762
  if (t2 instanceof SetTreeNode$1) {
763
763
  const tn = t2 as SetTreeNode$1<T>;
764
764
  t_mut = SetTreeNode$1__get_Right<T>(tn);
@@ -778,7 +778,7 @@ export function SetTreeModule_maximumElementAux<T>(t_mut: Option<SetTreeLeaf$1<T
778
778
 
779
779
  export function SetTreeModule_maximumElementOpt<T>(t: Option<SetTreeLeaf$1<T>>): Option<T> {
780
780
  if (t != null) {
781
- const t2: SetTreeLeaf$1<T> = value_3(t);
781
+ const t2: SetTreeLeaf$1<T> = value_2(t);
782
782
  if (t2 instanceof SetTreeNode$1) {
783
783
  const tn = t2 as SetTreeNode$1<T>;
784
784
  return some(SetTreeModule_maximumElementAux<T>(SetTreeNode$1__get_Right<T>(tn), SetTreeLeaf$1__get_Key<T>(tn)));
@@ -798,7 +798,7 @@ export function SetTreeModule_minimumElement<$a>(s: Option<SetTreeLeaf$1<$a>>):
798
798
  throw new Exception("Set contains no elements");
799
799
  }
800
800
  else {
801
- return value_3(matchValue);
801
+ return value_2(matchValue);
802
802
  }
803
803
  }
804
804
 
@@ -808,7 +808,7 @@ export function SetTreeModule_maximumElement<$a>(s: Option<SetTreeLeaf$1<$a>>):
808
808
  throw new Exception("Set contains no elements");
809
809
  }
810
810
  else {
811
- return value_3(matchValue);
811
+ return value_2(matchValue);
812
812
  }
813
813
  }
814
814
 
@@ -834,7 +834,7 @@ export function SetTreeModule_collapseLHS<T>(stack_mut: FSharpList<Option<SetTre
834
834
  const x: Option<SetTreeLeaf$1<T>> = head(stack);
835
835
  const rest: FSharpList<Option<SetTreeLeaf$1<T>>> = tail(stack);
836
836
  if (x != null) {
837
- const x2: SetTreeLeaf$1<T> = value_3(x);
837
+ const x2: SetTreeLeaf$1<T> = value_2(x);
838
838
  if (x2 instanceof SetTreeNode$1) {
839
839
  const xn = x2 as SetTreeNode$1<T>;
840
840
  stack_mut = ofArrayWithTail([SetTreeNode$1__get_Left<T>(xn), SetTreeLeaf$1_$ctor_2B595<T>(SetTreeLeaf$1__get_Key<T>(xn)), SetTreeNode$1__get_Right<T>(xn)], rest);
@@ -875,7 +875,7 @@ export function SetTreeModule_current<$a>(i: SetTreeModule_SetIterator$1<$a>): $
875
875
  return SetTreeModule_alreadyFinished<$a>();
876
876
  }
877
877
  else if (head(matchValue) != null) {
878
- const t: SetTreeLeaf$1<$a> = value_3(head(matchValue));
878
+ const t: SetTreeLeaf$1<$a> = value_2(head(matchValue));
879
879
  return SetTreeLeaf$1__get_Key<$a>(t);
880
880
  }
881
881
  else {
@@ -892,7 +892,7 @@ export function SetTreeModule_moveNext<T>(i: SetTreeModule_SetIterator$1<T>): bo
892
892
  const matchValue: FSharpList<Option<SetTreeLeaf$1<T>>> = i.stack;
893
893
  if (!isEmpty_1(matchValue)) {
894
894
  if (head(matchValue) != null) {
895
- const t: SetTreeLeaf$1<T> = value_3(head(matchValue));
895
+ const t: SetTreeLeaf$1<T> = value_2(head(matchValue));
896
896
  if (t instanceof SetTreeNode$1) {
897
897
  throw new Exception("Please report error: Set iterator, unexpected stack for moveNext");
898
898
  }
@@ -946,8 +946,8 @@ export function SetTreeModule_compareStacks<T>(comparer_mut: IComparer<T>, l1_mu
946
946
  if (!isEmpty_1(l2)) {
947
947
  if (head(l2) != null) {
948
948
  if (head(l1) != null) {
949
- const x1_3: SetTreeLeaf$1<T> = value_3(head(l1));
950
- const x2_3: SetTreeLeaf$1<T> = value_3(head(l2));
949
+ const x1_3: SetTreeLeaf$1<T> = value_2(head(l1));
950
+ const x2_3: SetTreeLeaf$1<T> = value_2(head(l2));
951
951
  if (x1_3 instanceof SetTreeNode$1) {
952
952
  const x1n_2 = x1_3 as SetTreeNode$1<T>;
953
953
  if (SetTreeNode$1__get_Left<T>(x1n_2) == null) {
@@ -971,13 +971,13 @@ export function SetTreeModule_compareStacks<T>(comparer_mut: IComparer<T>, l1_mu
971
971
  if (head(l1) != null) {
972
972
  matchResult = 0;
973
973
  t1_6 = tail(l1);
974
- x1_4 = value_3(head(l1));
974
+ x1_4 = value_2(head(l1));
975
975
  }
976
976
  else if (!isEmpty_1(l2)) {
977
977
  if (head(l2) != null) {
978
978
  matchResult = 1;
979
979
  t2_6 = tail(l2);
980
- x2_4 = value_3(head(l2));
980
+ x2_4 = value_2(head(l2));
981
981
  }
982
982
  else {
983
983
  matchResult = 2;
@@ -991,7 +991,7 @@ export function SetTreeModule_compareStacks<T>(comparer_mut: IComparer<T>, l1_mu
991
991
  if (head(l2) != null) {
992
992
  matchResult = 1;
993
993
  t2_6 = tail(l2);
994
- x2_4 = value_3(head(l2));
994
+ x2_4 = value_2(head(l2));
995
995
  }
996
996
  else {
997
997
  matchResult = 2;
@@ -1053,13 +1053,13 @@ export function SetTreeModule_compareStacks<T>(comparer_mut: IComparer<T>, l1_mu
1053
1053
  if (head(l1) != null) {
1054
1054
  matchResult_1 = 0;
1055
1055
  t1_7 = tail(l1);
1056
- x1_5 = value_3(head(l1));
1056
+ x1_5 = value_2(head(l1));
1057
1057
  }
1058
1058
  else if (!isEmpty_1(l2)) {
1059
1059
  if (head(l2) != null) {
1060
1060
  matchResult_1 = 1;
1061
1061
  t2_7 = tail(l2);
1062
- x2_5 = value_3(head(l2));
1062
+ x2_5 = value_2(head(l2));
1063
1063
  }
1064
1064
  else {
1065
1065
  matchResult_1 = 2;
@@ -1073,7 +1073,7 @@ export function SetTreeModule_compareStacks<T>(comparer_mut: IComparer<T>, l1_mu
1073
1073
  if (head(l2) != null) {
1074
1074
  matchResult_1 = 1;
1075
1075
  t2_7 = tail(l2);
1076
- x2_5 = value_3(head(l2));
1076
+ x2_5 = value_2(head(l2));
1077
1077
  }
1078
1078
  else {
1079
1079
  matchResult_1 = 2;
@@ -1136,13 +1136,13 @@ export function SetTreeModule_compareStacks<T>(comparer_mut: IComparer<T>, l1_mu
1136
1136
  if (head(l1) != null) {
1137
1137
  matchResult_2 = 0;
1138
1138
  t1_8 = tail(l1);
1139
- x1_6 = value_3(head(l1));
1139
+ x1_6 = value_2(head(l1));
1140
1140
  }
1141
1141
  else if (!isEmpty_1(l2)) {
1142
1142
  if (head(l2) != null) {
1143
1143
  matchResult_2 = 1;
1144
1144
  t2_8 = tail(l2);
1145
- x2_6 = value_3(head(l2));
1145
+ x2_6 = value_2(head(l2));
1146
1146
  }
1147
1147
  else {
1148
1148
  matchResult_2 = 2;
@@ -1156,7 +1156,7 @@ export function SetTreeModule_compareStacks<T>(comparer_mut: IComparer<T>, l1_mu
1156
1156
  if (head(l2) != null) {
1157
1157
  matchResult_2 = 1;
1158
1158
  t2_8 = tail(l2);
1159
- x2_6 = value_3(head(l2));
1159
+ x2_6 = value_2(head(l2));
1160
1160
  }
1161
1161
  else {
1162
1162
  matchResult_2 = 2;
@@ -1213,19 +1213,19 @@ export function SetTreeModule_compareStacks<T>(comparer_mut: IComparer<T>, l1_mu
1213
1213
  }
1214
1214
  }
1215
1215
  else {
1216
- const x2: SetTreeLeaf$1<T> = value_3(head(l2));
1216
+ const x2: SetTreeLeaf$1<T> = value_2(head(l2));
1217
1217
  let matchResult_3: int32 = (undefined as any), t1_2: FSharpList<Option<SetTreeLeaf$1<T>>> = (undefined as any), x1: SetTreeLeaf$1<T> = (undefined as any), t2_2: FSharpList<Option<SetTreeLeaf$1<T>>> = (undefined as any), x2_1: SetTreeLeaf$1<T> = (undefined as any);
1218
1218
  if (!isEmpty_1(l1)) {
1219
1219
  if (head(l1) != null) {
1220
1220
  matchResult_3 = 0;
1221
1221
  t1_2 = tail(l1);
1222
- x1 = value_3(head(l1));
1222
+ x1 = value_2(head(l1));
1223
1223
  }
1224
1224
  else if (!isEmpty_1(l2)) {
1225
1225
  if (head(l2) != null) {
1226
1226
  matchResult_3 = 1;
1227
1227
  t2_2 = tail(l2);
1228
- x2_1 = value_3(head(l2));
1228
+ x2_1 = value_2(head(l2));
1229
1229
  }
1230
1230
  else {
1231
1231
  matchResult_3 = 2;
@@ -1239,7 +1239,7 @@ export function SetTreeModule_compareStacks<T>(comparer_mut: IComparer<T>, l1_mu
1239
1239
  if (head(l2) != null) {
1240
1240
  matchResult_3 = 1;
1241
1241
  t2_2 = tail(l2);
1242
- x2_1 = value_3(head(l2));
1242
+ x2_1 = value_2(head(l2));
1243
1243
  }
1244
1244
  else {
1245
1245
  matchResult_3 = 2;
@@ -1283,19 +1283,19 @@ export function SetTreeModule_compareStacks<T>(comparer_mut: IComparer<T>, l1_mu
1283
1283
  }
1284
1284
  }
1285
1285
  else if (head(l1) != null) {
1286
- const x1_1: SetTreeLeaf$1<T> = value_3(head(l1));
1286
+ const x1_1: SetTreeLeaf$1<T> = value_2(head(l1));
1287
1287
  let matchResult_4: int32 = (undefined as any), t1_4: FSharpList<Option<SetTreeLeaf$1<T>>> = (undefined as any), x1_2: SetTreeLeaf$1<T> = (undefined as any), t2_4: FSharpList<Option<SetTreeLeaf$1<T>>> = (undefined as any), x2_2: SetTreeLeaf$1<T> = (undefined as any);
1288
1288
  if (!isEmpty_1(l1)) {
1289
1289
  if (head(l1) != null) {
1290
1290
  matchResult_4 = 0;
1291
1291
  t1_4 = tail(l1);
1292
- x1_2 = value_3(head(l1));
1292
+ x1_2 = value_2(head(l1));
1293
1293
  }
1294
1294
  else if (!isEmpty_1(l2)) {
1295
1295
  if (head(l2) != null) {
1296
1296
  matchResult_4 = 1;
1297
1297
  t2_4 = tail(l2);
1298
- x2_2 = value_3(head(l2));
1298
+ x2_2 = value_2(head(l2));
1299
1299
  }
1300
1300
  else {
1301
1301
  matchResult_4 = 2;
@@ -1309,7 +1309,7 @@ export function SetTreeModule_compareStacks<T>(comparer_mut: IComparer<T>, l1_mu
1309
1309
  if (head(l2) != null) {
1310
1310
  matchResult_4 = 1;
1311
1311
  t2_4 = tail(l2);
1312
- x2_2 = value_3(head(l2));
1312
+ x2_2 = value_2(head(l2));
1313
1313
  }
1314
1314
  else {
1315
1315
  matchResult_4 = 2;
@@ -1399,7 +1399,7 @@ export function SetTreeModule_toList<T>(t: Option<SetTreeLeaf$1<T>>): FSharpList
1399
1399
  while (true) {
1400
1400
  const t$0027: Option<SetTreeLeaf$1<T>> = t$0027_mut, acc: FSharpList<T> = acc_mut;
1401
1401
  if (t$0027 != null) {
1402
- const t2: SetTreeLeaf$1<T> = value_3(t$0027);
1402
+ const t2: SetTreeLeaf$1<T> = value_2(t$0027);
1403
1403
  if (t2 instanceof SetTreeNode$1) {
1404
1404
  const tn = t2 as SetTreeNode$1<T>;
1405
1405
  t$0027_mut = SetTreeNode$1__get_Left<T>(tn);
@@ -1944,12 +1944,44 @@ export function isProperSubsetOf<T>(s1: ISet<T>, s2: Iterable<T>): boolean {
1944
1944
  }
1945
1945
 
1946
1946
  export function isProperSupersetOf<T>(s1: ISet<T>, s2: Iterable<T>): boolean {
1947
- const s2_1: Iterable<T> = cache<T>(s2);
1948
- if (exists_1<T>((arg: T): boolean => !s1.has(arg), s2_1)) {
1949
- return forAll_1<T>((value_2: T): boolean => s1.has(value_2), s2_1);
1947
+ const s2_1: ISet<T> = newMutableSetWith<T>(s1, s2);
1948
+ if (s1.size > s2_1.size) {
1949
+ return forAll_1<T>((value: T): boolean => s1.has(value), s2_1.values());
1950
1950
  }
1951
1951
  else {
1952
1952
  return false;
1953
1953
  }
1954
1954
  }
1955
1955
 
1956
+ export function symmetricExceptWith<T>(s1: ISet<T>, s2: Iterable<T>): void {
1957
+ const s2_1: ISet<T> = newMutableSetWith<T>(s1, s2);
1958
+ iterate_1<T>((x: T): void => {
1959
+ if (s1.has(x)) {
1960
+ s1.delete(x);
1961
+ }
1962
+ else {
1963
+ s1.add(x);
1964
+ }
1965
+ }, s2_1.values());
1966
+ }
1967
+
1968
+ export function overlaps<T>(s1: ISet<T>, s2: Iterable<T>): boolean {
1969
+ return exists_1<T>((value: T): boolean => s1.has(value), s2);
1970
+ }
1971
+
1972
+ export function setEquals<T>(s1: ISet<T>, s2: Iterable<T>): boolean {
1973
+ const s2_1: ISet<T> = newMutableSetWith<T>(s1, s2);
1974
+ if (s1.size === s2_1.size) {
1975
+ return forAll_1<T>((value: T): boolean => s2_1.has(value), s1.values());
1976
+ }
1977
+ else {
1978
+ return false;
1979
+ }
1980
+ }
1981
+
1982
+ export function copyToArray<T>(s1: ISet<T>, target: MutableArray<T>, sourceIndex: int32, targetIndex: int32, count_1: int32): void {
1983
+ iterateIndexed<T>((index: int32, value: T): void => {
1984
+ setItem(target, targetIndex + index, value);
1985
+ }, truncate<T>(count_1, skip<T>(sourceIndex, s1.values())));
1986
+ }
1987
+
package/String.ts CHANGED
@@ -86,6 +86,19 @@ export function endsWith(str: string, pattern: string, ic: boolean | StringCompa
86
86
  return false;
87
87
  }
88
88
 
89
+ export function contains(str: string, pattern: string, ic: boolean | StringComparison) {
90
+ if (ic === StringComparison.Ordinal) { // fast path
91
+ return str.includes(pattern);
92
+ }
93
+ const len = pattern.length;
94
+ for (let i = 0; i <= str.length - len; i++) {
95
+ if (cmp(str.slice(i, i + len), pattern, ic) === 0) {
96
+ return true;
97
+ }
98
+ }
99
+ return false;
100
+ }
101
+
89
102
  export function indexOfAny(str: string, anyOf: string[], ...args: number[]) {
90
103
  if (str == null || str === "") {
91
104
  return -1;
@@ -377,11 +390,23 @@ export function format(str: string | object, ...args: any[]) {
377
390
  rep = parts.integral + "." + padRight(parts.decimal, precision, "0");
378
391
  }
379
392
  break;
380
- case "g": case "G":
393
+ case "g": case "G": {
381
394
  rep = precision != null ? toPrecision(rep, precision) : toPrecision(rep);
382
- // TODO: Check why some numbers are formatted with decimal part
383
- rep = trimEnd(trimEnd(rep, "0"), ".");
395
+ // Handle exponential notation: only trim trailing zeros from mantissa, not from exponent.
396
+ // .NET G format guarantees an exponent of at least 2 digits with an explicit sign (e.g. "E-07").
397
+ const eIdx = rep.indexOf("e");
398
+ if (eIdx >= 0) {
399
+ const mantissa = trimEnd(trimEnd(rep.slice(0, eIdx), "0"), ".");
400
+ const expSign = rep[eIdx + 1]; // toPrecision always emits "+" or "-"
401
+ const expDigits = rep.slice(eIdx + 2);
402
+ const paddedExpDigits = expDigits.length < 2 ? "0" + expDigits : expDigits;
403
+ const eChar = format === "G" ? "E" : "e";
404
+ rep = mantissa + eChar + expSign + paddedExpDigits;
405
+ } else {
406
+ rep = trimEnd(trimEnd(rep, "0"), ".");
407
+ }
384
408
  break;
409
+ }
385
410
  case "n": case "N":
386
411
  precision = precision != null ? precision : 2;
387
412
  rep = toFixed(rep, precision);
@@ -408,7 +433,7 @@ export function format(str: string | object, ...args: any[]) {
408
433
  if (!isIntegral(rep)) {
409
434
  throw new Exception("Format specifier was invalid.");
410
435
  }
411
- precision = precision != null ? precision : 2;
436
+ precision = precision != null ? precision : 1;
412
437
  rep = padLeft(toHex(rep), precision, "0");
413
438
  if (format === "X") {
414
439
  rep = rep.toUpperCase();
package/System.Text.ts CHANGED
@@ -1,9 +1,10 @@
1
1
 
2
2
  import { replace, format, replicate, substring, isNullOrEmpty, join } from "./String.ts";
3
- import { float64, int32 } from "./Int32.ts";
3
+ import { float64, float32, uint32, uint16, int16, uint8, int8, int32 } from "./Int32.ts";
4
4
  import { class_type, TypeInfo } from "./Reflection.ts";
5
5
  import { toString } from "./Types.ts";
6
- import { Exception, clear, MutableArray, int32ToString } from "./Util.ts";
6
+ import { Exception, clear, MutableArray, int64ToString, int32ToString, int16ToString } from "./Util.ts";
7
+ import { uint64, int64 } from "./BigInt.ts";
7
8
  import { setItem, item } from "./Array.ts";
8
9
 
9
10
  export class StringBuilder {
@@ -61,11 +62,51 @@ export function StringBuilder__Append_61B1CA(x: StringBuilder, c: string, repeat
61
62
  return x;
62
63
  }
63
64
 
65
+ export function StringBuilder__Append_Z510FF069(x: StringBuilder, o: int8): StringBuilder {
66
+ void (x.buf.push(o.toString()));
67
+ return x;
68
+ }
69
+
70
+ export function StringBuilder__Append_244D3E44(x: StringBuilder, o: uint8): StringBuilder {
71
+ void (x.buf.push(o.toString()));
72
+ return x;
73
+ }
74
+
75
+ export function StringBuilder__Append_Z524259E6(x: StringBuilder, o: int16): StringBuilder {
76
+ void (x.buf.push(int16ToString(o)));
77
+ return x;
78
+ }
79
+
80
+ export function StringBuilder__Append_Z6EF82811(x: StringBuilder, o: uint16): StringBuilder {
81
+ void (x.buf.push(o.toString()));
82
+ return x;
83
+ }
84
+
64
85
  export function StringBuilder__Append_Z524259A4(x: StringBuilder, o: int32): StringBuilder {
65
86
  void (x.buf.push(int32ToString(o)));
66
87
  return x;
67
88
  }
68
89
 
90
+ export function StringBuilder__Append_Z6EF827D7(x: StringBuilder, o: uint32): StringBuilder {
91
+ void (x.buf.push(o.toString()));
92
+ return x;
93
+ }
94
+
95
+ export function StringBuilder__Append_Z524259C1(x: StringBuilder, o: int64): StringBuilder {
96
+ void (x.buf.push(int64ToString(o)));
97
+ return x;
98
+ }
99
+
100
+ export function StringBuilder__Append_Z6EF827B6(x: StringBuilder, o: uint64): StringBuilder {
101
+ void (x.buf.push(o.toString()));
102
+ return x;
103
+ }
104
+
105
+ export function StringBuilder__Append_Z7138B98C(x: StringBuilder, o: float32): StringBuilder {
106
+ void (x.buf.push(o.toString()));
107
+ return x;
108
+ }
109
+
69
110
  export function StringBuilder__Append_5E38073B(x: StringBuilder, o: float64): StringBuilder {
70
111
  void (x.buf.push(o.toString()));
71
112
  return x;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "private": false,
4
4
  "type": "module",
5
5
  "name": "@fable-org/fable-library-ts",
6
- "version": "2.0.0-rc.6",
6
+ "version": "2.1.0",
7
7
  "description": "Core library used by F# projects compiled with fable.io",
8
8
  "author": "Fable Contributors",
9
9
  "license": "MIT",
package/tsconfig.json CHANGED
@@ -34,7 +34,7 @@
34
34
  // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
35
35
  // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
36
36
  // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
37
- // "types": [], /* Specify type package names to be included without being referenced in a source file. */
37
+ "types": [], /* Exclude all @types/* packages (e.g. @types/node) to enforce browser-only compatibility. */
38
38
  // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
39
39
  // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
40
40
  // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */