@scriptc/compiler 0.0.30 → 0.0.31

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.
@@ -633,13 +633,23 @@ export function lowerTupleReadMethodCall(L, call, access) {
633
633
  return null;
634
634
  if (!L.isStdlibMember(access))
635
635
  return null;
636
- const receiverIr = L.mapTypeOf(L.typeOf(access.expression));
636
+ let receiverIr = L.mapTypeOf(L.typeOf(access.expression));
637
+ let receiver = null;
638
+ // A readonly tuple union under Array.isArray is checker-typed as an
639
+ // unmappable intersection with any[], while maybeNarrow still extracts
640
+ // its one tuple arm. Dispatch the supported tuple read methods from
641
+ // that lowered representation, like tuple indexing and `.length`.
642
+ const checkerArray = L.checkerArrayValue(access.expression);
643
+ if (checkerArray?.type.kind === "record") {
644
+ receiverIr = checkerArray.type;
645
+ receiver = checkerArray;
646
+ }
637
647
  if (receiverIr?.kind !== "record")
638
648
  return null;
639
649
  const shape = L.shapes.get(receiverIr.shapeId);
640
650
  if (!shape?.tuple)
641
651
  return null;
642
- const receiver = L.lowerExpr(access.expression);
652
+ receiver ??= L.lowerExpr(access.expression);
643
653
  if (receiver.type.kind !== "record")
644
654
  return null;
645
655
  if (!pureReemittable(receiver)) {