@fable-org/fable-library-js 2.5.1 → 2.6.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,5 +1,5 @@
1
1
  ---
2
- last_commit_released: 619d7afddbaf25108e819abaaa9d8a6503c457d6
2
+ last_commit_released: bf694309ae5dbc6bb546d9acc4d091f5e35fe330
3
3
  updaters:
4
4
  - package.json:
5
5
  file: package.json
@@ -15,6 +15,18 @@ All notable changes to this project will be documented in this file.
15
15
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
16
16
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
17
17
 
18
+ ## 2.6.0 - 2026-09-03
19
+
20
+ ### 🚀 Features
21
+
22
+ * *(all)* Quotations: DerivedPatterns, and captured locals as Value nodes (#4919) ([fae5093f](https://github.com/fable-compiler/Fable/commit/fae5093f2801195e865adf1acfaec63f38bbf973))
23
+
24
+ ### 🐞 Bug Fixes
25
+
26
+ * *(all)* Emit instance calls for virtual methods inherited from Object (#4926) ([2fb535a7](https://github.com/fable-compiler/Fable/commit/2fb535a7cd35cef501c56684f205e2dffa3c36e6))
27
+
28
+ <strong><small>[View changes on Github](https://github.com/fable-compiler/Fable/compare/619d7afddbaf25108e819abaaa9d8a6503c457d6..bf694309ae5dbc6bb546d9acc4d091f5e35fe330)</small></strong>
29
+
18
30
  ## 2.5.1 - 2026-07-24
19
31
 
20
32
  ### 🐞 Bug Fixes
package/System.Text.js CHANGED
@@ -178,6 +178,13 @@ export function StringBuilder__set_Chars_413E0D0A(x, index, value) {
178
178
  setItem(x.buf, i, (item(i, x.buf).slice(0, (pos - 1) + 1) + value) + item(i, x.buf).slice(pos + 1, item(i, x.buf).length));
179
179
  }
180
180
  }
181
+ export function StringBuilder__get_Length(x) {
182
+ let len = 0;
183
+ for (let i = x.buf.length - 1; i >= 0; i--) {
184
+ len = ((len + item(i, x.buf).length) | 0);
185
+ }
186
+ return len | 0;
187
+ }
181
188
  export function StringBuilder__Replace_Z766F94C0(x, oldValue, newValue) {
182
189
  for (let i = x.buf.length - 1; i >= 0; i--) {
183
190
  setItem(x.buf, i, replace(item(i, x.buf), oldValue, newValue));
@@ -188,13 +195,6 @@ export function StringBuilder__Replace_Z384F8060(x, oldValue, newValue) {
188
195
  const str = replace(x.toString(), oldValue, newValue);
189
196
  return StringBuilder__Append_Z721C83C5(StringBuilder__Clear(x), str);
190
197
  }
191
- export function StringBuilder__get_Length(x) {
192
- let len = 0;
193
- for (let i = x.buf.length - 1; i >= 0; i--) {
194
- len = ((len + item(i, x.buf).length) | 0);
195
- }
196
- return len | 0;
197
- }
198
- export function StringBuilder__ToString_Z37302880(x, firstIndex, length) {
199
- return substring(x.toString(), firstIndex, length);
198
+ export function StringBuilder__ToString_Z37302880(x, startIndex, length) {
199
+ return substring(x.toString(), startIndex, length);
200
200
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "private": false,
4
4
  "type": "module",
5
5
  "name": "@fable-org/fable-library-js",
6
- "version": "2.5.1",
6
+ "version": "2.6.0",
7
7
  "description": "Core library used by F# projects compiled with fable.io",
8
8
  "author": "Fable Contributors",
9
9
  "license": "MIT",
package/quotation.js CHANGED
@@ -633,3 +633,50 @@ export function exprFromJSON(json) {
633
633
  default: return new ExprValue(json, "unknown");
634
634
  }
635
635
  }
636
+ // ===================================================================
637
+ // DerivedPatterns
638
+ // F# defines these on top of Patterns. AndAlso and OrElse recover the
639
+ // shape `&&` and `||` desugar into; SpecificCall matches a call by the
640
+ // identity of a template quotation rather than by compiled name.
641
+ // ===================================================================
642
+ export function isAndAlso(expr) {
643
+ // a && b ==> if a then b else false
644
+ if (expr instanceof ExprIfThenElse
645
+ && expr.elseExpr instanceof ExprValue
646
+ && expr.elseExpr.value === false) {
647
+ return [expr.guard, expr.thenExpr];
648
+ }
649
+ return undefined;
650
+ }
651
+ export function isOrElse(expr) {
652
+ // a || b ==> if a then true else b
653
+ if (expr instanceof ExprIfThenElse
654
+ && expr.thenExpr instanceof ExprValue
655
+ && expr.thenExpr.value === true) {
656
+ return [expr.guard, expr.elseExpr];
657
+ }
658
+ return undefined;
659
+ }
660
+ /// A template such as <@ (=) @> quotes as nested lambdas around the call, so
661
+ /// the identifying Call node has to be dug out before comparing.
662
+ function templateCall(expr) {
663
+ let current = expr;
664
+ while (current instanceof ExprLambda) {
665
+ current = current.body;
666
+ }
667
+ return current instanceof ExprCall ? current : undefined;
668
+ }
669
+ // Takes both arguments; the partial application FSharp.Core expresses by
670
+ // currying is built by the replacement instead.
671
+ export function isSpecificCall(template, expr) {
672
+ const wanted = templateCall(template);
673
+ if (wanted === undefined || !(expr instanceof ExprCall))
674
+ return undefined;
675
+ if (expr.method !== wanted.method || expr.declaringType !== wanted.declaringType)
676
+ return undefined;
677
+ const instance = (expr.instance instanceof ExprValue && expr.instance.type === "novalue") ? null : expr.instance;
678
+ // The middle slot is F#'s generic-argument list. The runtime models types as
679
+ // names rather than System.Type, so it is always empty here; callers written
680
+ // against Fable match it with a wildcard.
681
+ return [instance, ofArray([]), ofArray(expr.args)];
682
+ }