@markw65/monkeyc-optimizer 1.1.81 → 1.1.82

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.
@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_W4QVHCFN_exports = {};
30
- __export(chunk_W4QVHCFN_exports, {
29
+ var chunk_TLXMWGYI_exports = {};
30
+ __export(chunk_TLXMWGYI_exports, {
31
31
  EnumTagsConst: () => EnumTagsConst,
32
32
  LastTypeTag: () => LastTypeTag,
33
33
  ObjectLikeTagsConst: () => ObjectLikeTagsConst,
@@ -139,7 +139,7 @@ __export(chunk_W4QVHCFN_exports, {
139
139
  visitorNode: () => visitorNode,
140
140
  xml_util_exports: () => xml_util_exports
141
141
  });
142
- module.exports = __toCommonJS(chunk_W4QVHCFN_exports);
142
+ module.exports = __toCommonJS(chunk_TLXMWGYI_exports);
143
143
  var import_chunk_X7QCZR3F = require("./chunk-X7QCZR3F.cjs");
144
144
  var import_chunk_JDC43A3I = require("./chunk-JDC43A3I.cjs");
145
145
  var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
@@ -5726,6 +5726,12 @@ var init_build_config = (0, import_chunk_ABYVSU2C.__esm)({
5726
5726
  default: "YES",
5727
5727
  scope: "resource"
5728
5728
  },
5729
+ extraReferenceTypeChecks: {
5730
+ type: "boolean",
5731
+ description: "Whether to warn about [unsafe operations on Arrays and Dictionaries](https://github.com/markw65/monkeyc-optimizer/wiki/Extra-Reference-Type-Checks-(prettierMonkeyC.extraReferenceTypeChecks)) that Garmin's compiler allows",
5732
+ default: true,
5733
+ scope: "resource"
5734
+ },
5729
5735
  compilerLookupRules: {
5730
5736
  type: "string",
5731
5737
  description: "Whether to perform lookups as compiler1, compiler2, or based on the currently selected sdk",
@@ -7613,6 +7619,9 @@ var init_control_flow = (0, import_chunk_ABYVSU2C.__esm)({
7613
7619
  }
7614
7620
  });
7615
7621
  function unionInto(to, from) {
7622
+ return unionHelper(to, from, -Infinity);
7623
+ }
7624
+ function unionHelper(to, from, widenDepth) {
7616
7625
  if (to == null || from == null) {
7617
7626
  throw new Error("Null");
7618
7627
  }
@@ -7638,14 +7647,14 @@ function unionInto(to, from) {
7638
7647
  clearValuesUnder(to, from.type);
7639
7648
  return true;
7640
7649
  }
7641
- return mergeMultiple(to, from);
7650
+ return mergeMultiple(to, from, widenDepth);
7642
7651
  }
7643
7652
  if (to.value != null) {
7644
7653
  if (from.value == null) {
7645
7654
  clearValuesUnder(to, from.type);
7646
7655
  return true;
7647
7656
  }
7648
- mergeMultiple(to, from);
7657
+ mergeMultiple(to, from, widenDepth);
7649
7658
  return true;
7650
7659
  }
7651
7660
  if (from.value == null) {
@@ -7658,7 +7667,7 @@ function unionInto(to, from) {
7658
7667
  to.value = tmp.value;
7659
7668
  return true;
7660
7669
  }
7661
- function mergeMultiple(to, from) {
7670
+ function mergeMultiple(to, from, widenDepth) {
7662
7671
  const newTags = to.type | from.type;
7663
7672
  let anyChanged = newTags !== to.type;
7664
7673
  let mask = 0;
@@ -7667,11 +7676,14 @@ function mergeMultiple(to, from) {
7667
7676
  const fromv = getUnionComponent(from, ac.type);
7668
7677
  if (ac.value != null) {
7669
7678
  if (fromv != null) {
7670
- const [value2, changed] = mergeSingle({
7671
- type: ac.type,
7672
- avalue: ac.value,
7673
- bvalue: fromv
7674
- });
7679
+ const [value2, changed] = ac.value === fromv ? [fromv, false] : mergeSingle(
7680
+ {
7681
+ type: ac.type,
7682
+ avalue: ac.value,
7683
+ bvalue: fromv
7684
+ },
7685
+ widenDepth
7686
+ );
7675
7687
  if (changed)
7676
7688
  anyChanged = true;
7677
7689
  if (value2) {
@@ -7708,13 +7720,13 @@ function mergeMultiple(to, from) {
7708
7720
  to.value = result[mask];
7709
7721
  return true;
7710
7722
  }
7711
- function tryUnion(to, from) {
7712
- to = cloneType(to);
7713
- if (unionInto(to, from))
7714
- return to;
7715
- return null;
7716
- }
7717
- function mergeSingle(pair) {
7723
+ function mergeSingle(pair, widenDepth) {
7724
+ function tryUnion(to, from) {
7725
+ to = cloneType(to);
7726
+ if (unionHelper(to, from, widenDepth + 1))
7727
+ return to;
7728
+ return null;
7729
+ }
7718
7730
  switch (pair.type) {
7719
7731
  case 1:
7720
7732
  case 2:
@@ -7727,31 +7739,58 @@ function mergeSingle(pair) {
7727
7739
  case 128:
7728
7740
  case 256:
7729
7741
  case 131072:
7730
- if (pair.avalue === pair.bvalue) {
7731
- return [pair.avalue, false];
7732
- }
7733
7742
  return [null, true];
7734
7743
  case 512: {
7735
- if (Array.isArray(pair.avalue)) {
7736
- const bv = pair.bvalue;
7737
- if (Array.isArray(bv)) {
7738
- if (pair.avalue.length === bv.length) {
7739
- let changed = false;
7740
- const u = pair.avalue.map((a, i) => {
7741
- const merged2 = tryUnion(a, bv[i]);
7742
- if (merged2)
7743
- changed = true;
7744
- return merged2 || a;
7745
- });
7746
- return [u, changed];
7744
+ if (widenDepth > MaxWidenDepth) {
7745
+ return [null, true];
7746
+ }
7747
+ const tupleTypes = /* @__PURE__ */ new Map();
7748
+ const arrayTypes = [];
7749
+ tupleForEach(
7750
+ pair.avalue,
7751
+ (v) => {
7752
+ const t = tupleTypes.get(v.length);
7753
+ if (t) {
7754
+ t.push(v);
7755
+ } else {
7756
+ tupleTypes.set(v.length, [v]);
7747
7757
  }
7758
+ },
7759
+ (v) => arrayTypes.push(v)
7760
+ );
7761
+ const extraTypes = [];
7762
+ tupleForEach(
7763
+ pair.bvalue,
7764
+ (v) => {
7765
+ const tuples = tupleTypes.get(v.length);
7766
+ if (!tuples?.some(
7767
+ (t) => t.every((at, i) => {
7768
+ const bt = v[i];
7769
+ return subtypeOf(at, bt) && subtypeOf(bt, at);
7770
+ })
7771
+ )) {
7772
+ extraTypes.push(v);
7773
+ }
7774
+ },
7775
+ (v) => {
7776
+ if (!arrayTypes.some((at) => subtypeOf(at, v) && subtypeOf(v, at))) {
7777
+ extraTypes.push(v);
7778
+ }
7779
+ }
7780
+ );
7781
+ if (extraTypes.length) {
7782
+ if (widenDepth >= 0) {
7783
+ return [null, true];
7748
7784
  }
7785
+ const allTypes = (pair.avalue instanceof Set ? Array.from(pair.avalue) : [pair.avalue]).concat(extraTypes);
7786
+ return [tupleReduce(allTypes), true];
7749
7787
  }
7750
- const av = reducedType(pair.avalue);
7751
- const merged = tryUnion(av, reducedType(pair.bvalue));
7752
- return [merged || av, merged != null];
7788
+ return [pair.avalue, false];
7753
7789
  }
7754
7790
  case 1024: {
7791
+ if (widenDepth > MaxWidenDepth) {
7792
+ return [null, true];
7793
+ }
7755
7794
  const avalue = pair.avalue;
7756
7795
  const bvalue = pair.bvalue;
7757
7796
  if (!avalue.value) {
@@ -7766,7 +7805,7 @@ function mergeSingle(pair) {
7766
7805
  return;
7767
7806
  }
7768
7807
  av = cloneType(av);
7769
- if (unionInto(av, bv))
7808
+ if (unionHelper(av, bv, widenDepth + 1))
7770
7809
  merged = true;
7771
7810
  result.set(key2, av);
7772
7811
  });
@@ -7842,7 +7881,8 @@ function mergeSingle(pair) {
7842
7881
  let klass = pair.avalue.klass;
7843
7882
  const [obj, objChanged] = mergeObjectValues(
7844
7883
  pair.avalue.obj,
7845
- pair.bvalue.obj
7884
+ pair.bvalue.obj,
7885
+ widenDepth
7846
7886
  );
7847
7887
  const klassChanged = tryUnion(klass, pair.bvalue.klass);
7848
7888
  if (klassChanged || objChanged) {
@@ -7860,7 +7900,7 @@ function mergeSingle(pair) {
7860
7900
  if (toE.enum !== fromE.enum) {
7861
7901
  if (toE.value && fromE.value) {
7862
7902
  const result = cloneType(toE.value);
7863
- unionInto(result, fromE.value);
7903
+ unionHelper(result, fromE.value, widenDepth + 1);
7864
7904
  const e = { value: result };
7865
7905
  return [e, true];
7866
7906
  }
@@ -7884,7 +7924,7 @@ function mergeSingle(pair) {
7884
7924
  unhandledType(pair);
7885
7925
  }
7886
7926
  }
7887
- function mergeObjectValues(to, from) {
7927
+ function mergeObjectValues(to, from, widenDepth) {
7888
7928
  if (!to) {
7889
7929
  return [to, false];
7890
7930
  }
@@ -7901,7 +7941,7 @@ function mergeObjectValues(to, from) {
7901
7941
  return;
7902
7942
  }
7903
7943
  const rep = cloneType(value2);
7904
- if (unionInto(rep, from[key])) {
7944
+ if (unionHelper(rep, from[key], widenDepth + 1)) {
7905
7945
  if (result === to)
7906
7946
  result = { ...result };
7907
7947
  result[key] = rep;
@@ -7991,94 +8031,7 @@ function clearValuesUnder(v, tag, clearTag = false) {
7991
8031
  v.value = newData;
7992
8032
  }
7993
8033
  }
7994
- function widenTypeHelper(t, depth2) {
7995
- let result = null;
7996
- forEachUnionComponent(
7997
- t,
7998
- t.type & (512 | 1024),
7999
- (ac) => {
8000
- if (ac.value == null)
8001
- return;
8002
- switch (ac.type) {
8003
- case 512:
8004
- if (depth2 > 4) {
8005
- if (!result)
8006
- result = cloneType(t);
8007
- clearValuesUnder(result, ac.type);
8008
- } else {
8009
- if (Array.isArray(ac.value)) {
8010
- let newAData = ac.value;
8011
- ac.value.forEach((avalue, index) => {
8012
- const data = widenTypeHelper(avalue, depth2 + 1);
8013
- if (data) {
8014
- if (newAData === ac.value) {
8015
- newAData = newAData.slice();
8016
- }
8017
- newAData[index] = data;
8018
- }
8019
- });
8020
- if (newAData !== ac.value) {
8021
- if (!result)
8022
- result = cloneType(t);
8023
- setUnionComponent(result, ac.type, newAData);
8024
- }
8025
- } else {
8026
- const v = widenTypeHelper(ac.value, depth2 + 1);
8027
- if (v) {
8028
- if (!result)
8029
- result = cloneType(t);
8030
- setUnionComponent(result, ac.type, v);
8031
- }
8032
- }
8033
- }
8034
- return;
8035
- case 1024:
8036
- if (depth2 > 4) {
8037
- if (!result)
8038
- result = cloneType(t);
8039
- clearValuesUnder(result, ac.type);
8040
- } else {
8041
- const ddata = ac.value;
8042
- if (ddata.value) {
8043
- const key = widenTypeHelper(ddata.key, depth2 + 1);
8044
- const data = widenTypeHelper(ddata.value, depth2 + 1);
8045
- if (key || data) {
8046
- if (!result)
8047
- result = cloneType(t);
8048
- const newDData = { ...ddata };
8049
- if (key)
8050
- newDData.key = key;
8051
- if (data)
8052
- newDData.value = data;
8053
- setUnionComponent(result, ac.type, newDData);
8054
- }
8055
- } else {
8056
- let newDData = ddata;
8057
- ddata.forEach((dvalue, dkey) => {
8058
- const data = widenTypeHelper(dvalue, depth2 + 1);
8059
- if (data) {
8060
- if (newDData === ddata) {
8061
- newDData = new Map(newDData);
8062
- }
8063
- newDData.set(dkey, data);
8064
- }
8065
- });
8066
- if (newDData !== ddata) {
8067
- if (!result)
8068
- result = cloneType(t);
8069
- setUnionComponent(result, ac.type, newDData);
8070
- }
8071
- }
8072
- }
8073
- return;
8074
- }
8075
- }
8076
- );
8077
- return result;
8078
- }
8079
- function widenType(t) {
8080
- return widenTypeHelper(t, 0);
8081
- }
8034
+ var MaxWidenDepth;
8082
8035
  var init_union_type = (0, import_chunk_ABYVSU2C.__esm)({
8083
8036
  "src/type-flow/union-type.ts"() {
8084
8037
  "use strict";
@@ -8089,6 +8042,7 @@ var init_union_type = (0, import_chunk_ABYVSU2C.__esm)({
8089
8042
  init_intersection_type();
8090
8043
  init_sub_type();
8091
8044
  init_types();
8045
+ MaxWidenDepth = 4;
8092
8046
  }
8093
8047
  });
8094
8048
  function expandTypedef(t) {
@@ -8221,35 +8175,49 @@ function intersectionValue(pair) {
8221
8175
  case 128:
8222
8176
  case 131072:
8223
8177
  return pair.avalue === pair.bvalue ? pair.avalue : null;
8224
- case 512: {
8225
- if (Array.isArray(pair.avalue)) {
8226
- const bv = pair.bvalue;
8227
- if (Array.isArray(bv)) {
8228
- if (pair.avalue.length !== bv.length) {
8229
- return null;
8230
- }
8231
- const isect2 = pair.avalue.map((t, i) => intersection(t, bv[i]));
8232
- return isect2.some(
8233
- (t) => t.type === 0
8234
- /* Never */
8235
- ) ? null : isect2;
8178
+ case 512:
8179
+ return tupleMap(
8180
+ pair.avalue,
8181
+ (av) => tupleMap(
8182
+ pair.bvalue,
8183
+ (bv) => {
8184
+ if (av.length !== bv.length)
8185
+ return null;
8186
+ const isect = av.map((t, i) => intersection(t, bv[i]));
8187
+ return isect.some(
8188
+ (t) => t.type === 0
8189
+ /* Never */
8190
+ ) ? null : isect;
8191
+ },
8192
+ (bv) => {
8193
+ const isect = av.map((t) => intersection(bv, t));
8194
+ return isect.some(
8195
+ (t) => t.type === 0
8196
+ /* Never */
8197
+ ) ? null : isect;
8198
+ },
8199
+ (bv) => bv.length === 0 ? null : bv
8200
+ ),
8201
+ (av) => tupleMap(
8202
+ pair.bvalue,
8203
+ (bv) => {
8204
+ const isect = bv.map((t) => intersection(av, t));
8205
+ return isect.some(
8206
+ (t) => t.type === 0
8207
+ /* Never */
8208
+ ) ? null : isect;
8209
+ },
8210
+ (bv) => {
8211
+ const atype = intersection(av, bv);
8212
+ return atype.type === 0 ? null : atype;
8213
+ },
8214
+ (bv) => bv.length === 0 ? null : bv
8215
+ ),
8216
+ (av) => {
8217
+ const result = av.flat(1);
8218
+ return result.length === 0 ? null : tupleReduce(result);
8236
8219
  }
8237
- const isect = pair.avalue.map((t) => intersection(t, bv));
8238
- return isect.some(
8239
- (t) => t.type === 0
8240
- /* Never */
8241
- ) ? null : isect;
8242
- } else if (Array.isArray(pair.bvalue)) {
8243
- const av = pair.avalue;
8244
- const isect = pair.bvalue.map((t) => intersection(av, t));
8245
- return isect.some(
8246
- (t) => t.type === 0
8247
- /* Never */
8248
- ) ? null : isect;
8249
- }
8250
- const atype = intersection(pair.avalue, pair.bvalue);
8251
- return atype.type === 0 ? null : atype;
8252
- }
8220
+ );
8253
8221
  case 1024: {
8254
8222
  if (!pair.avalue.value) {
8255
8223
  if (!pair.bvalue.value) {
@@ -8693,19 +8661,34 @@ function subtypeOfValue(pair) {
8693
8661
  case 131072:
8694
8662
  return pair.avalue === pair.bvalue;
8695
8663
  case 512: {
8696
- if (Array.isArray(pair.avalue)) {
8697
- const bv = pair.bvalue;
8698
- if (Array.isArray(bv)) {
8699
- if (pair.avalue.length !== bv.length) {
8700
- return false;
8701
- }
8702
- return pair.avalue.every((t, i) => subtypeOf(t, bv[i]));
8664
+ let result = true;
8665
+ tupleForEach(
8666
+ pair.avalue,
8667
+ (av) => {
8668
+ let some2 = false;
8669
+ tupleForEach(
8670
+ pair.bvalue,
8671
+ (bv) => {
8672
+ some2 = av.length === bv.length && bv.every((b, i) => subtypeOf(av[i], b));
8673
+ return some2 === false;
8674
+ },
8675
+ (bv) => (some2 = av.every((a) => subtypeOf(a, bv))) === false
8676
+ );
8677
+ return result = some2;
8678
+ },
8679
+ (av) => {
8680
+ let some2 = false;
8681
+ tupleForEach(
8682
+ pair.bvalue,
8683
+ () => {
8684
+ return true;
8685
+ },
8686
+ (bv) => (some2 = subtypeOf(av, bv)) === false
8687
+ );
8688
+ return result = some2;
8703
8689
  }
8704
- return pair.avalue.every((t) => subtypeOf(t, bv));
8705
- } else if (Array.isArray(pair.bvalue)) {
8706
- return false;
8707
- }
8708
- return subtypeOf(pair.avalue, pair.bvalue);
8690
+ );
8691
+ return result;
8709
8692
  }
8710
8693
  case 1024: {
8711
8694
  const adict = pair.avalue;
@@ -9472,7 +9455,7 @@ function checkCallArgs(istate, node, callees, args) {
9472
9455
  if (object) {
9473
9456
  const info = sysCallInfo(istate.state, cur);
9474
9457
  if (info) {
9475
- const result2 = info(istate.state, cur, object, () => args);
9458
+ const result2 = info(istate, cur, object, () => args);
9476
9459
  if (result2.argTypes)
9477
9460
  argTypes = result2.argTypes;
9478
9461
  if (result2.returnType)
@@ -9481,6 +9464,8 @@ function checkCallArgs(istate, node, callees, args) {
9481
9464
  effects = false;
9482
9465
  if (!result2.argEffects)
9483
9466
  argEffects = false;
9467
+ if (result2.diagnostic)
9468
+ curDiags.push([node, result2.diagnostic]);
9484
9469
  }
9485
9470
  }
9486
9471
  if (cur.info === false) {
@@ -9514,7 +9499,7 @@ function checkCallArgs(istate, node, callees, args) {
9514
9499
  paramType = typeFromTypespec(istate.state, param.right, cur.stack);
9515
9500
  }
9516
9501
  if (checker(arg, paramType)) {
9517
- if (istate.state.config?.covarianceWarnings && effects && argEffects) {
9502
+ if (istate.state.config?.extraReferenceTypeChecks && effects && argEffects && !safeReferenceArg(node.arguments[i])) {
9518
9503
  if (arg.type & 512) {
9519
9504
  const atype = getUnionComponent(
9520
9505
  arg,
@@ -9527,7 +9512,7 @@ function checkCallArgs(istate, node, callees, args) {
9527
9512
  512
9528
9513
  /* Array */
9529
9514
  );
9530
- if (!ptype || Array.isArray(ptype) || Array.isArray(atype) || !subtypeOf(ptype, atype)) {
9515
+ if (!ptype || !checkArrayCovariance(atype, ptype)) {
9531
9516
  curDiags.push([
9532
9517
  node.arguments[i],
9533
9518
  `Argument ${i + 1} to ${cur.fullName}: passing ${display(
@@ -9709,7 +9694,7 @@ function getSystemCallTable(state) {
9709
9694
  }
9710
9695
  return ret;
9711
9696
  };
9712
- const arrayAdd = (state2, callee, calleeObj, getArgs) => {
9697
+ const arrayAdd = (istate, callee, calleeObj, getArgs) => {
9713
9698
  const ret = {};
9714
9699
  if (calleeObj.type & 512) {
9715
9700
  const adata = getUnionComponent(
@@ -9722,54 +9707,97 @@ function getSystemCallTable(state) {
9722
9707
  const args = getArgs();
9723
9708
  if (args.length === 1) {
9724
9709
  const arg = args[0];
9710
+ let hasTuple = false;
9725
9711
  if (callee.name === "add") {
9726
- if (Array.isArray(adata)) {
9727
- const relaxed = relaxType(arg);
9728
- const newAData = [...adata, relaxed];
9729
- ret.returnType.value = newAData;
9730
- ret.argTypes = [relaxed];
9731
- ret.calleeObj = ret.returnType;
9732
- } else if (!subtypeOf(arg, adata)) {
9733
- const newAData = cloneType(adata);
9734
- unionInto(newAData, arg);
9735
- const newObj = cloneType(calleeObj);
9736
- setUnionComponent(newObj, 512, newAData);
9737
- ret.calleeObj = newObj;
9738
- ret.argTypes = [adata];
9739
- }
9712
+ const relaxed = relaxType(arg);
9713
+ tupleMap(
9714
+ adata,
9715
+ (v) => {
9716
+ hasTuple = true;
9717
+ return [...v, relaxed];
9718
+ },
9719
+ (v) => {
9720
+ if (subtypeOf(arg, v))
9721
+ return v;
9722
+ const newAData = cloneType(v);
9723
+ unionInto(newAData, arg);
9724
+ if (!ret.argTypes) {
9725
+ ret.argTypes = [v];
9726
+ } else {
9727
+ ret.argTypes = [intersection(ret.argTypes[0], v)];
9728
+ }
9729
+ return newAData;
9730
+ },
9731
+ (v) => {
9732
+ const newAData = tupleReduce(v);
9733
+ ret.returnType.value = newAData;
9734
+ const newObj = cloneType(calleeObj);
9735
+ setUnionComponent(newObj, 512, newAData);
9736
+ ret.calleeObj = newObj;
9737
+ if (!ret.argTypes) {
9738
+ ret.argTypes = [relaxed];
9739
+ }
9740
+ }
9741
+ );
9740
9742
  } else {
9741
- if (Array.isArray(adata)) {
9742
- if (arg.type & 512) {
9743
- const argSubtypes = getUnionComponent(
9744
- arg,
9745
- 512
9746
- /* Array */
9747
- );
9748
- if (argSubtypes) {
9749
- if (Array.isArray(argSubtypes)) {
9750
- const newAData2 = [...adata, ...argSubtypes];
9751
- ret.returnType.value = newAData2;
9752
- ret.argTypes = [arg];
9753
- ret.calleeObj = ret.returnType;
9754
- return ret;
9743
+ const argSubtypes = arg.type & 512 ? getUnionComponent(
9744
+ arg,
9745
+ 512
9746
+ /* Array */
9747
+ ) : null;
9748
+ if (argSubtypes) {
9749
+ tupleMap(
9750
+ adata,
9751
+ (v) => {
9752
+ hasTuple = true;
9753
+ return tupleMap(
9754
+ argSubtypes,
9755
+ (a) => [...v, ...a],
9756
+ (a) => {
9757
+ const at = cloneType(reducedType(v));
9758
+ unionInto(at, a);
9759
+ return at;
9760
+ },
9761
+ (a) => a
9762
+ );
9763
+ },
9764
+ (v) => {
9765
+ const addedType = reducedArrayType(argSubtypes);
9766
+ if (subtypeOf(addedType, v))
9767
+ return [v];
9768
+ if (!ret.argTypes) {
9769
+ ret.argTypes = [v];
9770
+ } else {
9771
+ ret.argTypes = [intersection(ret.argTypes[0], v)];
9755
9772
  }
9756
- const newAData = reducedType(adata);
9757
- unionInto(newAData, argSubtypes);
9773
+ v = cloneType(v);
9774
+ unionInto(v, addedType);
9775
+ return [v];
9776
+ },
9777
+ (va) => {
9778
+ const newAData = tupleReduce(va.flat());
9758
9779
  ret.returnType.value = newAData;
9759
- ret.argTypes = [arg];
9760
- ret.calleeObj = ret.returnType;
9761
- return ret;
9780
+ const newObj = cloneType(calleeObj);
9781
+ setUnionComponent(newObj, 512, newAData);
9782
+ ret.calleeObj = newObj;
9783
+ if (!ret.argTypes) {
9784
+ ret.argTypes = [
9785
+ { type: 512, value: argSubtypes }
9786
+ ];
9787
+ }
9762
9788
  }
9763
- }
9764
- ret.returnType.value = reducedType(adata);
9765
- }
9766
- if (!subtypeOf(arg, ret.returnType)) {
9767
- ret.argTypes = [ret.returnType];
9768
- const newObj = cloneType(calleeObj);
9769
- unionInto(newObj, arg);
9770
- ret.calleeObj = newObj;
9789
+ );
9790
+ } else {
9791
+ tupleForEach(
9792
+ adata,
9793
+ () => hasTuple = true,
9794
+ () => false
9795
+ );
9771
9796
  }
9772
9797
  }
9798
+ if (hasTuple && istate.typeChecker && istate.state.config?.extraReferenceTypeChecks !== false) {
9799
+ ret.diagnostic = "Adding to a tuple would change its type";
9800
+ }
9773
9801
  }
9774
9802
  }
9775
9803
  }
@@ -9959,7 +9987,7 @@ function getSystemCallTable(state) {
9959
9987
  ret.argTypes = getArgs();
9960
9988
  return ret;
9961
9989
  };
9962
- const method = (state2, callee, calleeObj, getArgs) => {
9990
+ const method = (istate, callee, calleeObj, getArgs) => {
9963
9991
  const ret = {};
9964
9992
  const args = getArgs();
9965
9993
  if (args.length === 1 && hasValue(args[0]) && args[0].type === 131072) {
@@ -9974,7 +10002,7 @@ function getSystemCallTable(state) {
9974
10002
  computed: false
9975
10003
  };
9976
10004
  const [, trueDecls] = findObjectDeclsByProperty(
9977
- state2,
10005
+ istate.state,
9978
10006
  calleeObj,
9979
10007
  next.property
9980
10008
  );
@@ -9988,7 +10016,7 @@ function getSystemCallTable(state) {
9988
10016
  ret.returnType = callees.reduce(
9989
10017
  (type, callee2) => {
9990
10018
  const result = callee2.node.returnType ? typeFromTypespec(
9991
- state2,
10019
+ istate.state,
9992
10020
  callee2.node.returnType.argument,
9993
10021
  callee2.stack
9994
10022
  ) : {
@@ -9996,7 +10024,7 @@ function getSystemCallTable(state) {
9996
10024
  /* Any */
9997
10025
  };
9998
10026
  const args2 = callee2.node.params.map(
9999
- (param) => param.type === "BinaryExpression" ? typeFromTypespec(state2, param.right, callee2.stack) : {
10027
+ (param) => param.type === "BinaryExpression" ? typeFromTypespec(istate.state, param.right, callee2.stack) : {
10000
10028
  type: 524287
10001
10029
  /* Any */
10002
10030
  }
@@ -10017,7 +10045,7 @@ function getSystemCallTable(state) {
10017
10045
  };
10018
10046
  const nop = () => ({ effectFree: true });
10019
10047
  const mod = () => ({});
10020
- const rounder = (state2, callee, calleeObj, getArgs) => {
10048
+ const rounder = (istate, callee, calleeObj, getArgs) => {
10021
10049
  const results = {};
10022
10050
  const fn = Math[callee.name];
10023
10051
  results.effectFree = true;
@@ -10039,7 +10067,7 @@ function getSystemCallTable(state) {
10039
10067
  };
10040
10068
  return results;
10041
10069
  };
10042
- const mathHelper = (state2, callee, calleeObj, getArgs, helper) => {
10070
+ const mathHelper = (istate, callee, calleeObj, getArgs, helper) => {
10043
10071
  const results = {};
10044
10072
  const fn = helper && typeof helper === "function" ? helper : (0, import_chunk_JDC43A3I.hasProperty)(Math, helper || callee.name) && Math[helper || callee.name];
10045
10073
  if (fn && typeof fn === "function") {
@@ -10188,6 +10216,7 @@ var init_interp_call = (0, import_chunk_ABYVSU2C.__esm)({
10188
10216
  init_optimizer_types();
10189
10217
  (0, import_chunk_X7QCZR3F.init_util)();
10190
10218
  init_interp();
10219
+ init_intersection_type();
10191
10220
  init_sub_type();
10192
10221
  init_type_flow_util();
10193
10222
  init_types();
@@ -10456,23 +10485,27 @@ function deEnumerate(t) {
10456
10485
  }
10457
10486
  return t;
10458
10487
  }
10459
- function arrayTypeAtIndex(arr, elemType) {
10460
- if (Array.isArray(arr)) {
10461
- if (elemType && isExact(elemType) && elemType.type === 8 && elemType.value != null && arr[elemType.value] != null) {
10462
- return arr[elemType.value];
10488
+ function arrayTypeAtIndex(arr, elemType, forStrictAssign, enforceTuples) {
10489
+ const reduce2 = (v) => forStrictAssign ? v.reduce(
10490
+ (t, c) => t ? intersection(t, c) : c,
10491
+ null
10492
+ ) ?? {
10493
+ type: 0
10494
+ /* Never */
10495
+ } : reducedType(v);
10496
+ const key = elemType && isExact(elemType) && elemType.type === 8 ? elemType.value : null;
10497
+ return tupleMap(
10498
+ arr,
10499
+ (v) => key != null ? v[key] ?? null : reduce2(v),
10500
+ (v) => v,
10501
+ (v) => v.length ? reduce2(v) : enforceTuples ? {
10502
+ type: 0
10503
+ /* Never */
10504
+ } : {
10505
+ type: 524287
10506
+ /* Any */
10463
10507
  }
10464
- return arr.reduce(
10465
- (p, v) => {
10466
- unionInto(p, v);
10467
- return p;
10468
- },
10469
- {
10470
- type: 0
10471
- /* Never */
10472
- }
10473
- );
10474
- }
10475
- return arr;
10508
+ );
10476
10509
  }
10477
10510
  function getLhsConstraint(istate, node) {
10478
10511
  if (istate.localLvals?.has(node)) {
@@ -10502,7 +10535,15 @@ function getLhsConstraint(istate, node) {
10502
10535
  /* Array */
10503
10536
  );
10504
10537
  if (arr) {
10505
- result = arrayTypeAtIndex(arr, istate.typeMap.get(node.property));
10538
+ result = arrayTypeAtIndex(
10539
+ arr,
10540
+ istate.typeMap.get(node.property) ?? {
10541
+ type: 8,
10542
+ value: arrayLiteralKeyFromExpr(node.property) ?? void 0
10543
+ },
10544
+ strict,
10545
+ istate.state.config?.extraReferenceTypeChecks !== false
10546
+ );
10506
10547
  }
10507
10548
  }
10508
10549
  const updateResult = (value2) => {
@@ -10968,7 +11009,7 @@ function evaluateNode(istate, node) {
10968
11009
  type: 524287
10969
11010
  /* Any */
10970
11011
  };
10971
- const atype = arrayTypeAtIndex(avalue, property.value);
11012
+ const atype = arrayTypeAtIndex(avalue, property.value, false, true);
10972
11013
  if (result) {
10973
11014
  unionInto(result = cloneType(result), atype);
10974
11015
  } else {
@@ -12085,7 +12126,7 @@ function reducedType(elems) {
12085
12126
  if (!Array.isArray(elems)) {
12086
12127
  return elems;
12087
12128
  }
12088
- return elems.reduce(
12129
+ return elems.flat().reduce(
12089
12130
  (p, t) => {
12090
12131
  unionInto(p, t);
12091
12132
  return p;
@@ -12121,7 +12162,12 @@ function display(type) {
12121
12162
  case 256:
12122
12163
  return JSON.stringify(tv.value);
12123
12164
  case 512:
12124
- return Array.isArray(tv.value) ? `[${tv.value.map((t) => display(t)).join(", ")}]` : `Array<${display(tv.value)}>`;
12165
+ return tupleMap(
12166
+ tv.value,
12167
+ (v) => `[${v.map((t) => display(t)).join(", ")}]`,
12168
+ (v) => `Array<${display(v)}>`,
12169
+ (v) => v.join(" or ")
12170
+ );
12125
12171
  case 1024:
12126
12172
  return tv.value.value ? `Dictionary<${display(tv.value.key)}, ${display(tv.value.value)}>` : `{ ${Array.from(tv.value).map(
12127
12173
  ([key, value2]) => `${display(typeFromObjectLiteralKey(key))} as ${display(
@@ -12295,6 +12341,79 @@ function getStateNodeDeclsWithExactFromType(state, object) {
12295
12341
  }
12296
12342
  return decls;
12297
12343
  }
12344
+ function tupleForEach(t, tupleFn, arrayFn) {
12345
+ if (t instanceof Set) {
12346
+ for (const v of t) {
12347
+ if ((Array.isArray(v) ? tupleFn(v) : arrayFn(v)) === false) {
12348
+ break;
12349
+ }
12350
+ }
12351
+ } else {
12352
+ if (Array.isArray(t)) {
12353
+ tupleFn(t);
12354
+ } else {
12355
+ arrayFn(t);
12356
+ }
12357
+ }
12358
+ }
12359
+ function tupleMap(t, tupleFn, arrayFn, reduceFn) {
12360
+ const result = t instanceof Set ? Array.from(t).map((v) => Array.isArray(v) ? tupleFn(v) : arrayFn(v)) : [Array.isArray(t) ? tupleFn(t) : arrayFn(t)];
12361
+ return reduceFn(result.filter((v) => v != null));
12362
+ }
12363
+ function tupleReduce(v) {
12364
+ return v.length === 1 ? v[0] : new Set(v);
12365
+ }
12366
+ function reducedArrayType(t) {
12367
+ if (t instanceof Set) {
12368
+ return reducedType(Array.from(t).map((v) => reducedType(v)));
12369
+ }
12370
+ return reducedType(t);
12371
+ }
12372
+ function checkArrayCovariance(arg, param) {
12373
+ let ok = true;
12374
+ tupleForEach(
12375
+ arg,
12376
+ (av) => {
12377
+ tupleForEach(
12378
+ param,
12379
+ (pv) => {
12380
+ if (av.length !== pv.length)
12381
+ return true;
12382
+ if (!av.every((a, i) => subtypeOf(a, pv[i])))
12383
+ return true;
12384
+ if (!av.every((a, i) => subtypeOf(pv[i], a))) {
12385
+ ok = false;
12386
+ }
12387
+ return ok !== false;
12388
+ },
12389
+ () => {
12390
+ ok = false;
12391
+ return false;
12392
+ }
12393
+ );
12394
+ return ok !== false;
12395
+ },
12396
+ (av) => {
12397
+ tupleForEach(
12398
+ param,
12399
+ () => {
12400
+ return ok !== false;
12401
+ },
12402
+ (pv) => {
12403
+ if (subtypeOf(av, pv) && !subtypeOf(pv, av)) {
12404
+ ok = false;
12405
+ }
12406
+ return ok !== false;
12407
+ }
12408
+ );
12409
+ return ok !== false;
12410
+ }
12411
+ );
12412
+ return ok;
12413
+ }
12414
+ function safeReferenceArg(arg) {
12415
+ return arg.type === "ArrayExpression" || arg.type === "ObjectExpression" || arg.type === "NewExpression";
12416
+ }
12298
12417
  var LastTypeTag, SingletonTypeTagsConst, UnionDataTypeTagsConst, ValueTypeTagsConst, ObjectLikeTagsConst, EnumTagsConst, TruthyTypes;
12299
12418
  var init_types = (0, import_chunk_ABYVSU2C.__esm)({
12300
12419
  "src/type-flow/types.ts"() {
@@ -12306,6 +12425,7 @@ var init_types = (0, import_chunk_ABYVSU2C.__esm)({
12306
12425
  init_interp();
12307
12426
  init_intersection_type();
12308
12427
  init_union_type();
12428
+ init_sub_type();
12309
12429
  LastTypeTag = 262144;
12310
12430
  SingletonTypeTagsConst = 1 | 2 | 4;
12311
12431
  UnionDataTypeTagsConst = 512 | 1024 | 2048 | 4096 | 8192 | 16384 | 32768 | 65536 | 262144;
@@ -12403,24 +12523,40 @@ function couldBeValue(pair, shallow) {
12403
12523
  case 128:
12404
12524
  case 131072:
12405
12525
  return pair.avalue === pair.bvalue;
12406
- case 512:
12526
+ case 512: {
12407
12527
  if (shallow)
12408
12528
  return true;
12409
- if (Array.isArray(pair.avalue)) {
12410
- const bv = pair.bvalue;
12411
- if (Array.isArray(bv)) {
12412
- if (pair.avalue.length !== bv.length) {
12413
- return false;
12414
- }
12415
- return pair.avalue.every((a, i) => couldBe(a, bv[i]));
12529
+ let result = false;
12530
+ tupleForEach(
12531
+ pair.avalue,
12532
+ (av) => {
12533
+ tupleForEach(
12534
+ pair.bvalue,
12535
+ (bv) => {
12536
+ result = av.length === bv.length && bv.every((b, i) => couldBe(av[i], b));
12537
+ return result === false;
12538
+ },
12539
+ (bv) => {
12540
+ result = av.every((a) => couldBe(a, bv));
12541
+ return result === false;
12542
+ }
12543
+ );
12544
+ return result === false;
12545
+ },
12546
+ (av) => {
12547
+ tupleForEach(
12548
+ pair.bvalue,
12549
+ (bv) => {
12550
+ result = bv.every((b) => couldBe(av, b));
12551
+ return result === false;
12552
+ },
12553
+ (bv) => (result = couldBe(av, bv)) === false
12554
+ );
12555
+ return result === false;
12416
12556
  }
12417
- return pair.avalue.every((a) => couldBe(a, bv));
12418
- }
12419
- if (Array.isArray(pair.bvalue)) {
12420
- const av = pair.avalue;
12421
- return pair.bvalue.every((b) => couldBe(av, b));
12422
- }
12423
- return couldBe(pair.avalue, pair.bvalue);
12557
+ );
12558
+ return result;
12559
+ }
12424
12560
  case 1024: {
12425
12561
  if (shallow)
12426
12562
  return true;
@@ -13160,14 +13296,9 @@ function mergeTypeState(blockStates, index, from, nodeCopyProp) {
13160
13296
  return;
13161
13297
  }
13162
13298
  }
13163
- let result = cloneType(tov.curType);
13164
- if (!unionInto(result, fromv.curType))
13299
+ const result = cloneType(tov.curType);
13300
+ if (!unionHelper(result, fromv.curType, widen ? 0 : -Infinity))
13165
13301
  return;
13166
- if (widen) {
13167
- const wide = widenType(result);
13168
- if (wide)
13169
- result = wide;
13170
- }
13171
13302
  tov.curType = result;
13172
13303
  changes = true;
13173
13304
  });
@@ -13238,11 +13369,11 @@ function updateAffected(blockState, objectType, baseDecl, assignedPath, affected
13238
13369
  /* Array */
13239
13370
  );
13240
13371
  if (atype) {
13241
- if (Array.isArray(atype)) {
13242
- atype.forEach((value2) => unionInto(newType, value2));
13243
- } else {
13244
- unionInto(newType, atype);
13245
- }
13372
+ tupleForEach(
13373
+ atype,
13374
+ (v) => v.forEach((value2) => unionInto(newType, value2)),
13375
+ (v) => unionInto(newType, v)
13376
+ );
13246
13377
  }
13247
13378
  }
13248
13379
  if (type.type & 1024) {
@@ -13370,7 +13501,7 @@ function propagateTypes(state, root, graph, optimizeEquivalencies, copyPropStore
13370
13501
  next = t;
13371
13502
  }
13372
13503
  if (cur.type & 512) {
13373
- let avalue = getUnionComponent(
13504
+ const avalue = getUnionComponent(
13374
13505
  cur,
13375
13506
  512
13376
13507
  /* Array */
@@ -13378,29 +13509,41 @@ function propagateTypes(state, root, graph, optimizeEquivalencies, copyPropStore
13378
13509
  type: 524287
13379
13510
  /* Any */
13380
13511
  };
13381
- if (Array.isArray(avalue)) {
13382
- const index = arrayLiteralKeyFromExpr(me.property);
13383
- if (index != null && avalue[index] != null) {
13384
- if (!next) {
13385
- assocValue[i].keyStr = index;
13512
+ const index = arrayLiteralKeyFromExpr(me.property);
13513
+ tupleForEach(
13514
+ avalue,
13515
+ (av) => {
13516
+ let possibleValues = av;
13517
+ if (index != null) {
13518
+ if (av[index] != null) {
13519
+ if (!next) {
13520
+ assocValue[i].keyStr = index;
13521
+ }
13522
+ possibleValues = av[index];
13523
+ } else {
13524
+ possibleValues = {
13525
+ type: 0
13526
+ /* Never */
13527
+ };
13528
+ }
13529
+ }
13530
+ if (next || i !== l || !newValue) {
13531
+ const n = next ? cloneType(next) : {
13532
+ type: 0
13533
+ /* Never */
13534
+ };
13535
+ (0, import_chunk_X7QCZR3F.forEach)(possibleValues, (v) => unionInto(n, v));
13536
+ next = n;
13537
+ }
13538
+ },
13539
+ (av) => {
13540
+ if (next) {
13541
+ unionInto(next = cloneType(next), av);
13542
+ } else {
13543
+ next = av;
13386
13544
  }
13387
- avalue = avalue[index];
13388
- }
13389
- if (next || i !== l || !newValue) {
13390
- const n = next ? cloneType(next) : {
13391
- type: 0
13392
- /* Never */
13393
- };
13394
- (0, import_chunk_X7QCZR3F.forEach)(avalue, (v) => unionInto(n, v));
13395
- next = n;
13396
- }
13397
- } else {
13398
- if (next) {
13399
- unionInto(next = cloneType(next), avalue);
13400
- } else {
13401
- next = avalue;
13402
13545
  }
13403
- }
13546
+ );
13404
13547
  }
13405
13548
  let isExact2 = false;
13406
13549
  if (cur.type & 1024) {
@@ -13679,7 +13822,7 @@ function propagateTypes(state, root, graph, optimizeEquivalencies, copyPropStore
13679
13822
  return;
13680
13823
  }
13681
13824
  const result = info(
13682
- istate.state,
13825
+ istate,
13683
13826
  callee,
13684
13827
  calleeObj,
13685
13828
  () => node.arguments.map((arg) => evaluateExpr(state, arg, typeMap).value)
@@ -14765,24 +14908,39 @@ function updateByAssocPath(path7, property, update) {
14765
14908
  512
14766
14909
  /* Array */
14767
14910
  );
14768
- if (Array.isArray(avalue)) {
14769
- const key = pathElem.keyStr;
14770
- const relaxed = relaxType(property);
14771
- if (typeof key === "number" && key >= 0 && key < avalue.length) {
14772
- avalue = avalue.slice();
14773
- avalue[key] = relaxed;
14774
- } else {
14775
- avalue = avalue.map((v) => {
14776
- v = cloneType(v);
14777
- unionInto(v, relaxed);
14778
- return v;
14779
- });
14780
- }
14781
- } else {
14782
- avalue = valueToStore(avalue);
14911
+ const key = pathElem.keyStr;
14912
+ const relaxed = relaxType(property);
14913
+ if (avalue) {
14914
+ avalue = tupleMap(
14915
+ avalue,
14916
+ (v) => {
14917
+ if (typeof key === "number") {
14918
+ if (key < 0 || key >= v.length) {
14919
+ return null;
14920
+ }
14921
+ v = v.slice();
14922
+ v[key] = relaxed;
14923
+ return v;
14924
+ }
14925
+ return v.map((v2) => {
14926
+ v2 = cloneType(v2);
14927
+ unionInto(v2, relaxed);
14928
+ return v2;
14929
+ });
14930
+ },
14931
+ (v) => valueToStore(v),
14932
+ tupleReduce
14933
+ );
14783
14934
  }
14784
14935
  object = cloneType(object);
14785
- setUnionComponent(object, 512, avalue);
14936
+ setUnionComponent(
14937
+ object,
14938
+ 512,
14939
+ avalue ?? {
14940
+ type: 524287
14941
+ /* Any */
14942
+ }
14943
+ );
14786
14944
  }
14787
14945
  if (object.type & 1024) {
14788
14946
  const dvalue = getUnionComponent(
@@ -18478,35 +18636,41 @@ function add_one_resource(state, doc, module2, e, barrelNames) {
18478
18636
  let func;
18479
18637
  const makeVarDecl = (id2, outer) => {
18480
18638
  const loc = id2 && (0, import_chunk_JDC43A3I.adjustLoc)(id2.value.loc);
18639
+ const declarations = [];
18640
+ if (id2) {
18641
+ declarations.push({
18642
+ type: "VariableDeclarator",
18643
+ kind: "var",
18644
+ id: {
18645
+ type: "BinaryExpression",
18646
+ operator: "as",
18647
+ left: (0, import_chunk_JDC43A3I.makeIdentifier)(id2.value.value, loc),
18648
+ right: {
18649
+ type: "TypeSpecList",
18650
+ ts: [
18651
+ {
18652
+ type: "TypeSpecPart",
18653
+ name: (0, import_chunk_JDC43A3I.makeScopedName)(
18654
+ (state?.sdkVersion ?? 0) >= 7e6 ? "Toybox.Lang.ResourceId" : "Toybox.Lang.Symbol"
18655
+ )
18656
+ }
18657
+ ]
18658
+ }
18659
+ }
18660
+ });
18661
+ }
18662
+ if (init) {
18663
+ declarations.push({
18664
+ type: "VariableDeclarator",
18665
+ kind: "var",
18666
+ id: (0, import_chunk_JDC43A3I.makeIdentifier)("*invalid*"),
18667
+ init
18668
+ });
18669
+ }
18481
18670
  return (0, import_chunk_JDC43A3I.wrap)(
18482
18671
  {
18483
18672
  type: "VariableDeclaration",
18484
- declarations: [
18485
- (0, import_chunk_JDC43A3I.wrap)(
18486
- {
18487
- type: "VariableDeclarator",
18488
- kind: "var",
18489
- id: id2 && !init ? {
18490
- type: "BinaryExpression",
18491
- operator: "as",
18492
- left: (0, import_chunk_JDC43A3I.makeIdentifier)(id2.value.value, loc),
18493
- right: {
18494
- type: "TypeSpecList",
18495
- ts: [
18496
- {
18497
- type: "TypeSpecPart",
18498
- name: (0, import_chunk_JDC43A3I.makeScopedName)(
18499
- (state?.sdkVersion ?? 0) >= 7e6 ? "Toybox.Lang.ResourceId" : "Toybox.Lang.Symbol"
18500
- )
18501
- }
18502
- ]
18503
- }
18504
- } : (0, import_chunk_JDC43A3I.makeIdentifier)(id2 ? id2.value.value : "*invalid*", loc),
18505
- init
18506
- },
18507
- outer
18508
- )
18509
- ],
18673
+ declarations: declarations.map((d) => (0, import_chunk_JDC43A3I.wrap)(d, outer)),
18510
18674
  kind: "var"
18511
18675
  },
18512
18676
  outer
@@ -30242,7 +30406,7 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
30242
30406
  const opt_time = await (0, import_chunk_X7QCZR3F.first_modified)(
30243
30407
  Object.values(fnMap).map((v) => v.output)
30244
30408
  );
30245
- if (source_time < opt_time && 1732126457866 < opt_time) {
30409
+ if (source_time < opt_time && 1732486572981 < opt_time) {
30246
30410
  return {
30247
30411
  hasTests,
30248
30412
  diagnostics: prevDiagnostics,
@@ -30280,7 +30444,7 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
30280
30444
  hasTests: hasTests2,
30281
30445
  diagnostics,
30282
30446
  sdkVersion,
30283
- optimizerVersion: "1.1.81",
30447
+ optimizerVersion: "1.1.82",
30284
30448
  ...Object.fromEntries(
30285
30449
  configOptionsToCheck.map((option) => [option, config[option]])
30286
30450
  )
@@ -30446,7 +30610,7 @@ var init_optimizer = (0, import_chunk_ABYVSU2C.__esm)({
30446
30610
  "minimizeModules",
30447
30611
  "extensionVersion",
30448
30612
  "typeCheckLevel",
30449
- "covarianceWarnings",
30613
+ "extraReferenceTypeChecks",
30450
30614
  "iterateOptimizer",
30451
30615
  "extraExcludes"
30452
30616
  ];