@neocompose/cli 0.89.7 → 0.89.9

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.
@@ -25397,6 +25397,7 @@ function indexRuntimeCollectionChange(collection, entry, ctx, removedEntries = n
25397
25397
  indexes4.memberByRowId.clear();
25398
25398
  }
25399
25399
  if (Array.isArray(collection)) forgetLocalListIndexes(ctx, collection);
25400
+ else indexes4.declaredListByArray = /* @__PURE__ */ new WeakMap();
25400
25401
  markOverlayMutated(ctx, collection);
25401
25402
  if (ctx.__valueOverlay instanceof LazyValueOverlay)
25402
25403
  indexes4.overlayRevision = ctx.__valueOverlay.revision;
@@ -26889,11 +26890,10 @@ function remapRuntimeReferences(value, overlay, seen, preservedReferences) {
26889
26890
  const next = {};
26890
26891
  seen.set(value, next);
26891
26892
  for (const [key, entry] of Object.entries(value)) {
26892
- next[key] = remapRuntimeReferences(
26893
- entry,
26894
- overlay,
26895
- seen,
26896
- preservedReferences
26893
+ setOwnField(
26894
+ next,
26895
+ key,
26896
+ remapRuntimeReferences(entry, overlay, seen, preservedReferences)
26897
26897
  );
26898
26898
  }
26899
26899
  return next;
@@ -28689,7 +28689,7 @@ function applyOverlayAssignment(target, targetTypeInfo, value, scope, ctx, desti
28689
28689
  if (entryId !== null) {
28690
28690
  const collection = Array.isArray(receiver) ? receiver : objectArg(receiver, "Assignment target");
28691
28691
  const entryKey = typeof key === "number" ? key : String(key);
28692
- Reflect.set(collection, String(entryKey), entryId);
28692
+ setOwnField(collection, String(entryKey), entryId);
28693
28693
  recordWrittenEntry(collection, entryKey, true, ctx);
28694
28694
  if (!indexRuntimeCollectionChange(
28695
28695
  collection,
@@ -28785,7 +28785,7 @@ function applyOverlayAssignment(target, targetTypeInfo, value, scope, ctx, desti
28785
28785
  );
28786
28786
  noteDetachedRow(object[stringKey], referenceValueId, ctx);
28787
28787
  }
28788
- object[stringKey] = referenceValueId;
28788
+ setOwnField(object, stringKey, referenceValueId);
28789
28789
  if (!field) recordWrittenEntry(object, stringKey, true, ctx);
28790
28790
  if (field || !indexRuntimeCollectionEntryWrite(
28791
28791
  object,
@@ -28801,7 +28801,7 @@ function applyOverlayAssignment(target, targetTypeInfo, value, scope, ctx, desti
28801
28801
  return;
28802
28802
  if (field && (targetTypeInfo.type === 7 /* Class */ || targetTypeInfo.type === 22 /* Interface */))
28803
28803
  noteDetachedRow(object[stringKey], value, ctx);
28804
- object[stringKey] = value;
28804
+ setOwnField(object, stringKey, value);
28805
28805
  if (!field) recordWrittenEntry(object, stringKey, false, ctx);
28806
28806
  const scalarField = (previous == null || typeof previous === "number" || typeof previous === "boolean" || typeof previous === "string") && (value == null || typeof value === "number" || typeof value === "boolean" || typeof value === "string");
28807
28807
  if (field && !scalarField || !indexRuntimeCollectionEntryWrite(object, previous, value, stringKey, ctx))
@@ -28883,7 +28883,7 @@ function copiedCollectionContents(source, entryTypeInfo, slotId, ctx) {
28883
28883
  }
28884
28884
  }
28885
28885
  if (Array.isArray(copy)) copy.push(entry);
28886
- else copy[String(key)] = entry;
28886
+ else setOwnField(copy, String(key), entry);
28887
28887
  return 0 /* Continue */;
28888
28888
  });
28889
28889
  const cache = unorderedListProjectionCache(ctx);
@@ -28952,107 +28952,6 @@ function keepAssignedCollectionValues(value, targetTypeInfo, row, ctx) {
28952
28952
  return 0 /* Continue */;
28953
28953
  });
28954
28954
  }
28955
- function pendingConstructorRootsForRow(valueId, ctx) {
28956
- const roots = /* @__PURE__ */ new Set();
28957
- const open = ctx.__executionState?.openConstructions;
28958
- if (open === void 0 || open.size === 0) return roots;
28959
- const visited = /* @__PURE__ */ new Set();
28960
- const pending = [valueId];
28961
- const parentEntries = /* @__PURE__ */ new Map();
28962
- const placingMembers = /* @__PURE__ */ new Map();
28963
- while (pending.length > 0) {
28964
- const id = pending.pop();
28965
- if (id === void 0 || visited.has(id)) continue;
28966
- visited.add(id);
28967
- const row = evalValueById(
28968
- ctx,
28969
- id,
28970
- ctx.__runtimeSessionValues,
28971
- ctx.__valueOverlay
28972
- );
28973
- if (row === null) continue;
28974
- if (typeof row.value === "object" && row.value !== null && open.has(row.value))
28975
- roots.add(id);
28976
- for (const owner of currentOwnedValueAttachments(
28977
- id,
28978
- ctx,
28979
- parentEntries,
28980
- placingMembers
28981
- )) {
28982
- if (!owner.identity.startsWith("value:")) continue;
28983
- const parent = evalValueById(
28984
- ctx,
28985
- owner.label,
28986
- ctx.__runtimeSessionValues,
28987
- ctx.__valueOverlay
28988
- );
28989
- if (parent === null) continue;
28990
- if (parent.classId === void 0 || parent.classId === null) {
28991
- const raw = placingMember(
28992
- parent,
28993
- ctx,
28994
- void 0,
28995
- 0,
28996
- placingMembers,
28997
- parentEntries
28998
- );
28999
- if (raw === null) continue;
29000
- const member = raw.kind === 21 /* Generic */ ? substituteMember(raw, rowGenericEnv(parent, ctx), ctx.vm.members) : resolveMember(raw, ctx.vm.members);
29001
- if (isMemberWithEntries(member)) {
29002
- const rawEntry = evalMemberById(ctx.vm, member.entryMemberId);
29003
- if (rawEntry === null) continue;
29004
- const entry = rawEntry.kind === 21 /* Generic */ ? substituteMember(
29005
- rawEntry,
29006
- rowGenericEnv(parent, ctx),
29007
- ctx.vm.members
29008
- ) : resolveMember(rawEntry, ctx.vm.members);
29009
- if (entry.kind === 21 /* Generic */ || isMemberLookupBase(entry))
29010
- continue;
29011
- }
29012
- }
29013
- pending.push(owner.label);
29014
- }
29015
- for (const link of evaluatorParentLinks(evaluatorIndexes(ctx), id)) {
29016
- const parent = evalValueById(
29017
- ctx,
29018
- link.parentId,
29019
- ctx.__runtimeSessionValues,
29020
- ctx.__valueOverlay
29021
- );
29022
- if (parent === null || !Array.isArray(parent.value)) continue;
29023
- const member = placingMember(
29024
- parent,
29025
- ctx,
29026
- void 0,
29027
- 0,
29028
- placingMembers,
29029
- parentEntries
29030
- );
29031
- if (member === null || !isMemberTupleBase(member)) continue;
29032
- const positions = ownershipParentEntryKeys(
29033
- parent.value,
29034
- id,
29035
- parentEntries
29036
- );
29037
- for (const position of positions ?? []) {
29038
- if (typeof position !== "number") continue;
29039
- const entryId = member.elementMemberIds[position];
29040
- const rawEntry = entryId === void 0 ? null : evalMemberById(ctx.vm, entryId);
29041
- if (rawEntry === null) continue;
29042
- const entry = rawEntry.kind === 21 /* Generic */ ? substituteMember(
29043
- rawEntry,
29044
- rowGenericEnv(parent, ctx),
29045
- ctx.vm.members
29046
- ) : resolveMember(rawEntry, ctx.vm.members);
29047
- if (entry.kind === 21 /* Generic */ || isMemberLookupBase(entry))
29048
- continue;
29049
- pending.push(parent.id);
29050
- break;
29051
- }
29052
- }
29053
- }
29054
- return roots;
29055
- }
29056
28955
  function preflightAssignedCollection(collection, member, row, ctx) {
29057
28956
  if (member === null) return;
29058
28957
  const env = rowGenericEnv(row, ctx);
@@ -29065,8 +28964,6 @@ function preflightAssignedCollection(collection, member, row, ctx) {
29065
28964
  const attached = /* @__PURE__ */ new Set();
29066
28965
  const preflight = {
29067
28966
  parentEntries: /* @__PURE__ */ new Map(),
29068
- constructorRootIds: pendingConstructorRootsForRow(row.id, ctx),
29069
- constructorArgumentTransfers: /* @__PURE__ */ new Map(),
29070
28967
  dependencies: /* @__PURE__ */ new Map()
29071
28968
  };
29072
28969
  forEachRawCollectionEntry(collection, ctx, ({ raw, key, valueId }) => {
@@ -29089,8 +28986,6 @@ function preflightAssignedCollection(collection, member, row, ctx) {
29089
28986
  );
29090
28987
  return 0 /* Continue */;
29091
28988
  });
29092
- for (const [id, destination] of preflight.constructorArgumentTransfers)
29093
- ctx.__executionState?.ownedValueAttachments.set(id, destination);
29094
28989
  for (const [id, destination] of preflight.dependencies)
29095
28990
  recordConstructorGroupDependency(id, destination, ctx);
29096
28991
  }
@@ -29118,6 +29013,7 @@ function replaceRowValue(row, value, receiver, ctx) {
29118
29013
  unindexEvaluatorRow(indexes4, row, true);
29119
29014
  row.value = value;
29120
29015
  indexEvaluatorRow(indexes4, row, true);
29016
+ indexes4.declaredListByArray = /* @__PURE__ */ new WeakMap();
29121
29017
  markOverlayMutated(ctx, receiver);
29122
29018
  if (ctx.__valueOverlay instanceof LazyValueOverlay)
29123
29019
  indexes4.overlayRevision = ctx.__valueOverlay.revision;
@@ -30945,7 +30841,11 @@ function applyLocalCollectionMutation(targetValue, mutation, args, ctx, unique =
30945
30841
  }
30946
30842
  return null;
30947
30843
  }
30948
- objectArg(targetValue, "Dictionary Add target")[String(args[0])] = args[1];
30844
+ setOwnField(
30845
+ objectArg(targetValue, "Dictionary Add target"),
30846
+ String(args[0]),
30847
+ args[1]
30848
+ );
30949
30849
  return null;
30950
30850
  case "Remove" /* Remove */:
30951
30851
  if (Array.isArray(targetValue)) {
@@ -33370,6 +33270,17 @@ function runtimeTypeCheck(value, checkType, ctx, seenCollections = /* @__PURE__
33370
33270
  case 8 /* Enum */:
33371
33271
  return Array.isArray(value) && value.every((v) => typeof v === "string");
33372
33272
  case 7 /* Class */: {
33273
+ if (isVariantClassId(checkType.classId)) {
33274
+ if (!isVariantRefValue(value)) return false;
33275
+ const targetParameter = evaluatorSchemaIndex(ctx).classesById.get(
33276
+ checkType.classId
33277
+ )?.genericParams?.[0];
33278
+ const target = targetParameter === void 0 ? void 0 : receiverClosedTypeArguments(checkType.typeArguments, ctx)?.[targetParameter.id];
33279
+ return target?.type !== 7 /* Class */ || evaluatorSchemaIndex(ctx).classIsOrExtends(
33280
+ value.classId,
33281
+ target.classId
33282
+ );
33283
+ }
33373
33284
  if (typeof value !== "object") return false;
33374
33285
  const row = trackedRowForValueReference(value, ctx);
33375
33286
  const runtimeClassId = row === null ? void 0 : classIdForValueRow(row, ctx);
@@ -37432,6 +37343,7 @@ function publishConstructedRows(args) {
37432
37343
  if (beforeRetain !== null) {
37433
37344
  for (const rowId of beforeRetain) {
37434
37345
  if (retained.has(rowId)) continue;
37346
+ if (constructorGroupForRow(rowId, ctx) !== null) continue;
37435
37347
  deleteRuntimeSessionValue(ctx, rowId);
37436
37348
  }
37437
37349
  }
@@ -37517,16 +37429,55 @@ function assertImplicitConstructionAllowed(schemaClass2) {
37517
37429
  `Class '${schemaClass2.name}' declares a required constructor, so it cannot be constructed without one.`
37518
37430
  );
37519
37431
  }
37432
+ function constructionReplayContext(descriptor, ctx) {
37433
+ if (ctx.storedConstructionReplay !== true) return ctx;
37434
+ const target = ctx.__storedInitializerReplay;
37435
+ let rowId;
37436
+ let candidate;
37437
+ if (target !== void 0) {
37438
+ const row = storedReplayRowById(target.rowId, ctx);
37439
+ if (row !== null && classIdForValueRow(row, ctx) === descriptor.schemaClass.id) {
37440
+ rowId = target.rowId;
37441
+ candidate = { reattached: false };
37442
+ target.candidates.push(candidate);
37443
+ }
37444
+ } else if (ctx.__executionState?.constructionStack.length === 0 && ctx.__storedConstructionReplaySlot?.classId === descriptor.schemaClass.id) {
37445
+ rowId = ctx.__storedConstructionReplayRowId;
37446
+ }
37447
+ return {
37448
+ ...ctx,
37449
+ __storedInitializerReplay: void 0,
37450
+ __storedReplayCandidate: candidate,
37451
+ __storedConstructionReplayRowId: rowId,
37452
+ __storedConstructionReplayRootId: void 0,
37453
+ __storedConstructionReplaySlot: rowId === void 0 ? ctx.__storedConstructionReplaySlot : {
37454
+ classId: descriptor.schemaClass.id,
37455
+ classArguments: descriptor.classArguments ?? {}
37456
+ }
37457
+ };
37458
+ }
37459
+ function rollbackStoredConstructionReplay(ctx, checkpoint) {
37460
+ if (checkpoint === void 0) return;
37461
+ for (const row of createdSessionValuesSince(ctx, checkpoint))
37462
+ deleteRuntimeSessionValue(ctx, row.id);
37463
+ if (ctx.__storedReplayCandidate !== void 0)
37464
+ ctx.__storedReplayCandidate.reattached = false;
37465
+ }
37520
37466
  function constructClassValue(info, scope, ctx) {
37521
37467
  const descriptor = validateClassConstructorDescriptor(
37522
37468
  info,
37523
37469
  ctx,
37524
37470
  ctx.constructionBaselineReplay !== true
37525
37471
  );
37472
+ ctx = constructionReplayContext(descriptor, ctx);
37526
37473
  assertImplicitConstructionAllowed(descriptor.schemaClass);
37474
+ const replayCheckpoint = ctx.__storedConstructionReplayRowId === void 0 ? void 0 : sessionCreationCheckpoint(ctx);
37527
37475
  const closeFrame = pushConstructionFrame(ctx, descriptor.schemaClass.name);
37528
37476
  try {
37529
37477
  return constructClassValueWithinFrame(descriptor, scope, ctx);
37478
+ } catch (error) {
37479
+ rollbackStoredConstructionReplay(ctx, replayCheckpoint);
37480
+ throw error;
37530
37481
  } finally {
37531
37482
  closeFrame();
37532
37483
  }
@@ -37626,6 +37577,8 @@ function constructClassValueWithinFrame(descriptor, scope, ctx) {
37626
37577
  });
37627
37578
  root.classId = classId;
37628
37579
  stampConstructedRootGenericBindings(root, descriptor);
37580
+ if (ctx.__storedReplayCandidate !== void 0)
37581
+ ctx.__storedReplayCandidate.value = root.value;
37629
37582
  if (typeof root.value !== "object" || root.value === null || Array.isArray(root.value)) {
37630
37583
  throw new Error(
37631
37584
  `Class constructor for '${schemaClass2.name}' produced a non-record root.`
@@ -38055,15 +38008,20 @@ function constructionInitEvaluator(ctx, createdValues, argumentScopes, construct
38055
38008
  sourceValueId: sourceValueId ?? null,
38056
38009
  compileMemberId: scopeMemberId
38057
38010
  });
38011
+ const childId = storedInitializerChildId(member, ctx);
38012
+ const initializerCtx = childId === void 0 ? ctx : {
38013
+ ...ctx,
38014
+ __storedInitializerReplay: { rowId: childId, candidates: [] }
38015
+ };
38058
38016
  const evaluate = (argumentValues = []) => {
38059
- return withConstructionGenericSlots(
38017
+ const result = withConstructionGenericSlots(
38060
38018
  member,
38061
- ctx,
38019
+ initializerCtx,
38062
38020
  genericEnv,
38063
38021
  () => evaluateInitializerInContext(
38064
38022
  init,
38065
38023
  member,
38066
- ctx,
38024
+ initializerCtx,
38067
38025
  createdValues,
38068
38026
  argumentValues,
38069
38027
  sourceValueId ?? null,
@@ -38071,6 +38029,17 @@ function constructionInitEvaluator(ctx, createdValues, argumentScopes, construct
38071
38029
  genericEnv
38072
38030
  )
38073
38031
  );
38032
+ for (const candidate of initializerCtx.__storedInitializerReplay?.candidates ?? []) {
38033
+ if (!candidate.reattached) continue;
38034
+ if (candidate.value !== result.value) {
38035
+ throw new NSGetterRuntimeError(
38036
+ `Stored initializer '${member.name}' constructed an already owned value outside its returned child. Call Clone() explicitly.`
38037
+ );
38038
+ }
38039
+ if (ctx.__storedReplayCandidate !== void 0)
38040
+ ctx.__storedReplayCandidate.reattached = true;
38041
+ }
38042
+ return result;
38074
38043
  };
38075
38044
  const ownerClassId = scopeMemberId === null ? null : owningClassId(scopeMemberId);
38076
38045
  const expectedArgumentCount = compiled.parameters.slice(2).length;
@@ -38283,6 +38252,13 @@ function evaluateInitializerInContext(init, member, ctx, createdValues, argument
38283
38252
  (argument2) => trackedRowForValueReference(argument2, ctx)?.id === existingValueRow.id
38284
38253
  )) {
38285
38254
  assertInitializerPlacement(existingValueRow.id, member, ctx);
38255
+ if (storedInitializerChildId(member, ctx) === existingValueRow.id) {
38256
+ return {
38257
+ value: result.value,
38258
+ classId: existingRuntimeClassId,
38259
+ existingValueRow
38260
+ };
38261
+ }
38286
38262
  }
38287
38263
  if (existingValueRow !== null && existingRuntimeClassId !== null && isClassSlotMember(member)) {
38288
38264
  const storage = constructorArgumentStorage(existingValueRow.id, ctx);
@@ -38486,18 +38462,14 @@ function encodeRequiredConstructorArgument(args) {
38486
38462
  args.ctx.__valueOverlay
38487
38463
  ) !== null ? args.value : null;
38488
38464
  const adoptTracked = (id, suffix) => {
38489
- if (constructorGroupForRow(id, args.ctx) !== null) {
38490
- assertOwnedValueAttachable(
38491
- id,
38492
- {
38493
- identity: `value:${args.ownerRootId}:constructorArg:${args.parameterId}:${suffix}`,
38494
- label: args.ownerRootId
38495
- },
38496
- `constructor argument '${args.parameterId}'`,
38497
- args.ctx,
38498
- true
38499
- );
38500
- }
38465
+ recordConstructorGroupDependency(
38466
+ id,
38467
+ {
38468
+ identity: `value:${args.ownerRootId}:constructorArg:${args.parameterId}:${suffix}`,
38469
+ label: args.ownerRootId
38470
+ },
38471
+ args.ctx
38472
+ );
38501
38473
  return id;
38502
38474
  };
38503
38475
  if (args.typeInfo.type === 21 /* Generic */) {
@@ -38505,6 +38477,21 @@ function encodeRequiredConstructorArgument(args) {
38505
38477
  `Constructor argument '${args.parameterId}' has an unresolved generic type.`
38506
38478
  );
38507
38479
  }
38480
+ if (args.typeInfo.type === 7 /* Class */ && isVariantClassId(args.typeInfo.classId)) {
38481
+ if (args.value === null || args.value === void 0) return null;
38482
+ const selection = readVariantSelection(
38483
+ args.value,
38484
+ `Constructor argument '${args.parameterId}'`
38485
+ );
38486
+ if (selection.rowValueId !== null) {
38487
+ adoptTracked(selection.rowValueId, "variant-row");
38488
+ }
38489
+ return {
38490
+ classId: selection.classId,
38491
+ variantId: selection.variantId,
38492
+ ...selection.rowValueId === null ? {} : { rowValueId: selection.rowValueId }
38493
+ };
38494
+ }
38508
38495
  if (args.typeInfo.type === 7 /* Class */ || args.typeInfo.type === 22 /* Interface */) {
38509
38496
  if (args.value === null || args.value === void 0) return null;
38510
38497
  const aggregateId2 = trackedId ?? replayedAggregateId;
@@ -39419,7 +39406,8 @@ function constructDeclaredClassValue(info, scope, ctx) {
39419
39406
  const descriptor = validateClassConstructorDescriptor(info, ctx, false);
39420
39407
  const schemaClass2 = descriptor.schemaClass;
39421
39408
  const record4 = resolveDeclaredConstructorRecord(info, schemaClass2, ctx);
39422
- const replayCheckpoint = ctx.storedConstructionReplay === true && ctx.__storedConstructionReplayRowId !== void 0 && ctx.__storedConstructionReplaySlot?.classId === schemaClass2.id && ctx.__executionState?.constructionStack.length === 0 ? sessionCreationCheckpoint(ctx) : void 0;
39409
+ ctx = constructionReplayContext(descriptor, ctx);
39410
+ const replayCheckpoint = ctx.storedConstructionReplay === true && ctx.__storedConstructionReplayRowId !== void 0 && ctx.__storedConstructionReplaySlot?.classId === schemaClass2.id ? sessionCreationCheckpoint(ctx) : void 0;
39423
39411
  const closeFrame = pushConstructionFrame(ctx, schemaClass2.name);
39424
39412
  try {
39425
39413
  return constructDeclaredClassValueWithinFrame(
@@ -39430,11 +39418,7 @@ function constructDeclaredClassValue(info, scope, ctx) {
39430
39418
  ctx
39431
39419
  );
39432
39420
  } catch (error) {
39433
- if (replayCheckpoint !== void 0) {
39434
- for (const row of createdSessionValuesSince(ctx, replayCheckpoint)) {
39435
- deleteRuntimeSessionValue(ctx, row.id);
39436
- }
39437
- }
39421
+ rollbackStoredConstructionReplay(ctx, replayCheckpoint);
39438
39422
  throw error;
39439
39423
  } finally {
39440
39424
  closeFrame();
@@ -39495,6 +39479,8 @@ function constructDeclaredClassValueWithinFrame(descriptor, record4, info, scope
39495
39479
  });
39496
39480
  root.classId = classId;
39497
39481
  stampConstructedRootGenericBindings(root, descriptor);
39482
+ if (ctx.__storedReplayCandidate !== void 0)
39483
+ ctx.__storedReplayCandidate.value = root.value;
39498
39484
  } catch (error) {
39499
39485
  if (error instanceof NSGetterRuntimeError) {
39500
39486
  positionAtPassingArgument(error, info, record4, argumentValues, ctx);
@@ -39507,7 +39493,7 @@ function constructDeclaredClassValueWithinFrame(descriptor, record4, info, scope
39507
39493
  `Declared constructor for '${schemaClass2.name}' produced a non-record root.`
39508
39494
  );
39509
39495
  }
39510
- if (ctx.storedConstructionReplay === true && ctx.__storedConstructionReplayRowId !== void 0 && ctx.__storedConstructionReplaySlot?.classId === classId && ctx.__executionState?.constructionStack.length === 1) {
39496
+ if (ctx.storedConstructionReplay === true && ctx.__storedConstructionReplayRowId !== void 0 && ctx.__storedConstructionReplaySlot?.classId === classId) {
39511
39497
  ctx = { ...ctx, __storedConstructionReplayRootId: root.id };
39512
39498
  }
39513
39499
  const rootRecord = root.value;
@@ -39671,8 +39657,13 @@ function assertOwnedValueAttachable(valueId, destination, destinationName, ctx,
39671
39657
  ctx,
39672
39658
  preflight?.parentEntries
39673
39659
  )) {
39674
- if (mode === "assign" && ownedAttachmentIdentity(owner, ctx) === ownedAttachmentIdentity(destination, ctx))
39660
+ if (mode === "assign" && ownedAttachmentIdentity(owner, ctx) === ownedAttachmentIdentity(destination, ctx)) {
39661
+ if (ctx.__storedReplayCandidate !== void 0 && ctx.__storedConstructionReplayRowId !== void 0 && owner.identity.startsWith(
39662
+ `value:${ctx.__storedConstructionReplayRowId}:slot:`
39663
+ ))
39664
+ ctx.__storedReplayCandidate.reattached = true;
39675
39665
  continue;
39666
+ }
39676
39667
  const error = new NSGetterRuntimeError(
39677
39668
  `Aggregate value '${valueId}' is already owned by parent value '${owner.label}' and cannot be attached to '${destinationName}'. Call Clone() explicitly.`
39678
39669
  );
@@ -39681,23 +39672,6 @@ function assertOwnedValueAttachable(valueId, destination, destinationName, ctx,
39681
39672
  }
39682
39673
  const reserved = ctx.__executionState?.ownedValueAttachments.get(valueId);
39683
39674
  if (reserved !== void 0 && (mode === "insert" || reserved.identity !== destination.identity)) {
39684
- const constructorArgumentReservation = reserved.identity.startsWith(
39685
- `value:${reserved.label}:constructorArg:`
39686
- );
39687
- const destinationConstructorGroup = constructorGroupForRow(
39688
- destination.label,
39689
- ctx
39690
- );
39691
- if (constructorArgumentReservation && (destination.label === reserved.label || destinationConstructorGroup === reserved.label || preflight?.constructorRootIds.has(reserved.label) === true)) {
39692
- if (preflight === void 0) {
39693
- ctx.__executionState?.ownedValueAttachments.set(valueId, destination);
39694
- recordConstructorGroupDependency(valueId, destination, ctx);
39695
- } else {
39696
- preflight.constructorArgumentTransfers.set(valueId, destination);
39697
- preflight.dependencies.set(valueId, destination);
39698
- }
39699
- return;
39700
- }
39701
39675
  throw new NSGetterRuntimeError(
39702
39676
  `Aggregate value '${valueId}' is already owned by parent value '${reserved.label}' and cannot be attached to '${destinationName}'. Call Clone() explicitly.`
39703
39677
  );
@@ -39709,6 +39683,29 @@ function assertOwnedValueAttachable(valueId, destination, destinationName, ctx,
39709
39683
  recordConstructorGroupDependency(valueId, destination, ctx);
39710
39684
  else preflight.dependencies.set(valueId, destination);
39711
39685
  }
39686
+ function storedReplayRowById(id, ctx) {
39687
+ ctx.valueDependencies?.add(id);
39688
+ ctx.__getterReads?.add(id);
39689
+ const database = ctx.vm.databaseVM;
39690
+ if (database?.storedValueById !== void 0)
39691
+ return database.storedValueById(id);
39692
+ if (database?.evaluatorIndexes !== void 0)
39693
+ return database.evaluatorIndexes.valueById.get(id) ?? null;
39694
+ return ctx.vm.values.find((row) => row.id === id) ?? null;
39695
+ }
39696
+ function storedInitializerChildId(member, ctx) {
39697
+ if (ctx.storedConstructionReplay !== true) return void 0;
39698
+ const parentId = ctx.__storedConstructionReplayRowId;
39699
+ const memberId = Reflect.get(member, "id");
39700
+ if (parentId === void 0 || typeof memberId !== "string") return void 0;
39701
+ const parent = storedReplayRowById(parentId, ctx);
39702
+ if (parent?.value === null || typeof parent?.value !== "object")
39703
+ return void 0;
39704
+ const schemaKey = cachedSchemaKeyForMember(memberId, ctx);
39705
+ if (schemaKey === null) return void 0;
39706
+ const childId = Reflect.get(parent.value, schemaKey);
39707
+ return typeof childId === "string" ? childId : void 0;
39708
+ }
39712
39709
  function assertInitializerPlacement(valueId, member, ctx) {
39713
39710
  const replayRowId = ctx.__storedConstructionReplayRowId;
39714
39711
  const memberId = Reflect.get(member, "id");
@@ -39746,7 +39743,7 @@ function ownershipParentEntryKeys(value, valueId, cache) {
39746
39743
  }
39747
39744
  return entries.get(valueId) ?? [];
39748
39745
  }
39749
- function currentOwnedValueAttachments(valueId, ctx, parentEntries, placingMembers) {
39746
+ function currentOwnedValueAttachments(valueId, ctx, parentEntries) {
39750
39747
  const indexes4 = evaluatorIndexes(ctx);
39751
39748
  const cached = indexes4.ownedValueAttachmentsByValueId.get(valueId);
39752
39749
  if (cached !== void 0) return [...cached];
@@ -39809,14 +39806,7 @@ function currentOwnedValueAttachments(valueId, ctx, parentEntries, placingMember
39809
39806
  let member = null;
39810
39807
  let classId = parent.classId;
39811
39808
  if (classId === void 0 || classId === null) {
39812
- member = activeStaticBindingRoot(parent.id, ctx)?.member ?? (placingMembers === void 0 ? memberForValueRow(parent, ctx) : placingMember(
39813
- parent,
39814
- ctx,
39815
- void 0,
39816
- 0,
39817
- placingMembers,
39818
- parentEntries
39819
- ));
39809
+ member = activeStaticBindingRoot(parent.id, ctx)?.member ?? memberForValueRow(parent, ctx);
39820
39810
  if (member !== null) {
39821
39811
  try {
39822
39812
  member = resolveMember(member, ctx.vm.members);
@@ -45542,22 +45532,29 @@ function lookupEntryTypeInfo2(member, collectionTypeInfo) {
45542
45532
  }
45543
45533
 
45544
45534
  // ../packages/neoscript-runtime/src/values/member-declared-type-info.ts
45545
- function resolveMemberDeclaredTypeInfo(member, members2, ownerClass = null, env) {
45535
+ function resolveMemberDeclaredTypeInfo(member, members2, classes, ownerClass = null, env) {
45546
45536
  return resolveMemberDeclaredTypeInfoInternal(
45547
45537
  member,
45548
45538
  members2,
45539
+ classes,
45549
45540
  /* @__PURE__ */ new Set(),
45550
45541
  ownerClass,
45551
45542
  env,
45552
45543
  ownerClass === null ? void 0 : classConstrainedGenerics([ownerClass])
45553
45544
  );
45554
45545
  }
45555
- function resolveMemberDeclaredTypeInfoInternal(member, members2, seen, ownerClass, env, isClassConstrained) {
45546
+ function resolveMemberDeclaredTypeInfoInternal(member, members2, classes, seen, ownerClass, env, isClassConstrained) {
45556
45547
  const resolved = env === void 0 ? resolveMember(member, members2) : substituteMember(member, env, members2);
45557
45548
  const memberId = getField(resolved, "id");
45558
45549
  if (typeof memberId === "string" && seen.has(memberId)) return null;
45559
45550
  const nextSeen = typeof memberId === "string" ? /* @__PURE__ */ new Set([...seen, memberId]) : new Set(seen);
45560
45551
  if (isMemberNSPropertyBase(resolved)) return resolved.returnTypeInfo;
45552
+ if (isMemberVariantBase(resolved)) {
45553
+ return variantMemberDeclaredTypeInfo(
45554
+ resolved,
45555
+ neoVariantSystemClass(classes, resolved.valueTypeInfo != null)
45556
+ );
45557
+ }
45561
45558
  if (isClassSlotMember(resolved)) {
45562
45559
  const typeArguments = Object.fromEntries(
45563
45560
  Object.entries(declaredSlotArguments(resolved) ?? {}).flatMap(
@@ -45577,6 +45574,7 @@ function resolveMemberDeclaredTypeInfoInternal(member, members2, seen, ownerClas
45577
45574
  const argumentType2 = resolveMemberDeclaredTypeInfoInternal(
45578
45575
  argumentMember,
45579
45576
  members2,
45577
+ classes,
45580
45578
  nextSeen,
45581
45579
  ownerClass,
45582
45580
  env,
@@ -45647,6 +45645,7 @@ function resolveMemberDeclaredTypeInfoInternal(member, members2, seen, ownerClas
45647
45645
  const typeInfo = resolveMemberDeclaredTypeInfoInternal(
45648
45646
  descriptor,
45649
45647
  members2,
45648
+ classes,
45650
45649
  nextSeen,
45651
45650
  ownerClass,
45652
45651
  env,
@@ -45675,6 +45674,7 @@ function resolveMemberDeclaredTypeInfoInternal(member, members2, seen, ownerClas
45675
45674
  const entryTypeInfo = resolveMemberDeclaredTypeInfoInternal(
45676
45675
  entry,
45677
45676
  members2,
45677
+ classes,
45678
45678
  nextSeen,
45679
45679
  ownerClass,
45680
45680
  env,
@@ -45699,6 +45699,7 @@ function resolveMemberDeclaredTypeInfoInternal(member, members2, seen, ownerClas
45699
45699
  return resolveMemberDeclaredTypeInfoInternal(
45700
45700
  collection,
45701
45701
  members2,
45702
+ classes,
45702
45703
  nextSeen,
45703
45704
  ownerClass,
45704
45705
  env,
@@ -45741,6 +45742,15 @@ function recordEntries(value) {
45741
45742
  if (typeof value !== "object" || value === null) return [];
45742
45743
  return Object.values(value);
45743
45744
  }
45745
+ function isVariantArgument(value, typeInfo) {
45746
+ return typeInfo?.type === 7 /* Class */ && isVariantClassId(typeInfo.classId) && isVariantRefValue(value);
45747
+ }
45748
+ function remapVariantArgument(value, typeInfo, remap) {
45749
+ if (!isVariantArgument(value, typeInfo)) return value;
45750
+ if (typeof value.rowValueId !== "string") return value;
45751
+ const rowValueId = remap(value.rowValueId);
45752
+ return rowValueId === value.rowValueId ? value : { ...value, rowValueId };
45753
+ }
45744
45754
  var MaterializedValueGraphContext = class _MaterializedValueGraphContext {
45745
45755
  /**
45746
45756
  * P79 §7a. Generic in the caller's document view so a pass typed against a
@@ -45977,7 +45987,7 @@ var MaterializedValueGraphContext = class _MaterializedValueGraphContext {
45977
45987
  const typeInfo = parameterTypes.get(parameterId);
45978
45988
  return [
45979
45989
  parameterId,
45980
- typeInfo !== void 0 && (isAggregateTypeInfo(typeInfo) || typeInfo.type === 29 /* Reference */) && typeof argument2 === "string" ? rewriteId(argument2) : argument2
45990
+ typeInfo !== void 0 && (isAggregateTypeInfo(typeInfo) || typeInfo.type === 29 /* Reference */) && typeof argument2 === "string" ? rewriteId(argument2) : remapVariantArgument(argument2, typeInfo, rewriteId)
45981
45991
  ];
45982
45992
  }
45983
45993
  )
@@ -46013,15 +46023,18 @@ var MaterializedValueGraphContext = class _MaterializedValueGraphContext {
46013
46023
  ids.push(edge.targetValueId);
46014
46024
  return ids;
46015
46025
  }
46016
- /** The targets a row's Reference creation data names (P112 §1.1). */
46026
+ /** Reference targets and bound lookup rows retained by creation data. */
46017
46027
  referenceArgumentIds(row) {
46018
46028
  if (!isLiteralValueContent(row)) return [];
46019
46029
  const args = row.constructorArgs;
46020
46030
  if (args === void 0 || args === null) return [];
46021
46031
  const ids = [];
46022
- for (const parameterId of this.referenceParameterIds(row)) {
46032
+ for (const [parameterId, typeInfo] of this.constructorParameterTypes(row)) {
46023
46033
  const argument2 = args[parameterId];
46024
- if (typeof argument2 === "string") ids.push(argument2);
46034
+ if (typeInfo.type === 29 /* Reference */ && typeof argument2 === "string")
46035
+ ids.push(argument2);
46036
+ else if (isVariantArgument(argument2, typeInfo) && typeof argument2.rowValueId === "string")
46037
+ ids.push(argument2.rowValueId);
46025
46038
  }
46026
46039
  return ids;
46027
46040
  }
@@ -46030,23 +46043,23 @@ var MaterializedValueGraphContext = class _MaterializedValueGraphContext {
46030
46043
  const args = row.constructorArgs;
46031
46044
  if (args === void 0 || args === null) return args;
46032
46045
  let remapped;
46033
- for (const parameterId of this.referenceParameterIds(
46046
+ for (const [parameterId, typeInfo] of this.constructorParameterTypes(
46034
46047
  row,
46035
46048
  contextualMember
46036
46049
  )) {
46037
46050
  const argument2 = args[parameterId];
46038
- if (typeof argument2 !== "string") continue;
46039
- const target = remap(argument2);
46051
+ const target = typeInfo.type === 29 /* Reference */ && typeof argument2 === "string" ? remap(argument2) : remapVariantArgument(argument2, typeInfo, remap);
46040
46052
  if (target !== argument2) (remapped ??= { ...args })[parameterId] = target;
46041
46053
  }
46042
46054
  return remapped ?? args;
46043
46055
  }
46044
- *referenceParameterIds(row, contextualMember) {
46045
- for (const [parameterId, typeInfo] of this.constructorParameterTypes(
46046
- row,
46047
- contextualMember
46048
- ))
46049
- if (typeInfo.type === 29 /* Reference */) yield parameterId;
46056
+ *variantArgumentSelections(row) {
46057
+ if (!isLiteralValueContent(row)) return;
46058
+ if (row.constructorArgs == null) return;
46059
+ for (const [parameterId, typeInfo] of this.constructorParameterTypes(row)) {
46060
+ const argument2 = row.constructorArgs[parameterId];
46061
+ if (isVariantArgument(argument2, typeInfo)) yield argument2;
46062
+ }
46050
46063
  }
46051
46064
  slotEntries(row) {
46052
46065
  const value = row.value;
@@ -46147,6 +46160,17 @@ var MaterializedValueGraphContext = class _MaterializedValueGraphContext {
46147
46160
  if (member === void 0) return null;
46148
46161
  return this.memberTypeInfo(member, env);
46149
46162
  }
46163
+ if ((rawTypeInfo.type === 7 /* Class */ || rawTypeInfo.type === 22 /* Interface */) && rawTypeInfo.typeArguments !== void 0) {
46164
+ const typeArguments = {};
46165
+ for (const [parameterId, argument2] of Object.entries(
46166
+ rawTypeInfo.typeArguments
46167
+ )) {
46168
+ const resolved = this.resolveTypeInfo(argument2, env);
46169
+ if (resolved === null) return null;
46170
+ typeArguments[parameterId] = resolved;
46171
+ }
46172
+ return { ...rawTypeInfo, typeArguments };
46173
+ }
46150
46174
  if (rawTypeInfo.type === 30 /* Tuple */) {
46151
46175
  const elements = [];
46152
46176
  for (const element of rawTypeInfo.elements) {
@@ -46178,7 +46202,8 @@ var MaterializedValueGraphContext = class _MaterializedValueGraphContext {
46178
46202
  const member = substituteMember(rawMember, env, this.document.members);
46179
46203
  const typeInfo = resolveMemberDeclaredTypeInfo(
46180
46204
  member,
46181
- this.document.members
46205
+ this.document.members,
46206
+ this.document.classes
46182
46207
  );
46183
46208
  return typeInfo === null ? null : this.resolveTypeInfo(typeInfo, env);
46184
46209
  } catch {
@@ -46415,7 +46440,11 @@ function tryResolveTypeInfo(document2, rawTypeInfo, env) {
46415
46440
  function tryMemberTypeInfo(document2, rawMember, env) {
46416
46441
  try {
46417
46442
  const member = substituteMember(rawMember, env, document2.members);
46418
- const typeInfo = resolveMemberDeclaredTypeInfo(member, document2.members);
46443
+ const typeInfo = resolveMemberDeclaredTypeInfo(
46444
+ member,
46445
+ document2.members,
46446
+ document2.classes
46447
+ );
46419
46448
  if (typeInfo === null) return null;
46420
46449
  return tryResolveTypeInfo(document2, typeInfo, env);
46421
46450
  } catch {
@@ -53856,8 +53885,8 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
53856
53885
  this.persistingMethodGroup = false;
53857
53886
  }
53858
53887
  }
53859
- /** P112 §2.2. Checks a stored default's `Reference(place)` the push can't settle. */
53860
- resolvePersistedReference(expression, expected) {
53888
+ /** Check an initializer with its expected type, including contextual expressions. */
53889
+ validateInitializerExpression(expression, expected) {
53861
53890
  const resolved = this.resolveExpression(
53862
53891
  expression,
53863
53892
  this.initialScope(),
@@ -58959,11 +58988,97 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
58959
58988
  if (callee.kind !== "member") return null;
58960
58989
  const isInitialize = callee.name === VARIANT_INITIALIZE_NAME;
58961
58990
  const isApply = callee.name === VARIANT_APPLY_NAME;
58962
- if (!isInitialize && !isApply) return null;
58991
+ const isBind = callee.name === "Bind";
58992
+ if (!isInitialize && !isApply && !isBind) return null;
58963
58993
  if (callee.receiver.kind === "ident" && !this.hasValueReceiver(callee.receiver.name, scope) && this.project.typeByName.has(callee.receiver.name)) {
58964
58994
  return null;
58965
58995
  }
58966
58996
  const receiver = receiverValue ? receiverValue() : this.resolveExpression(callee.receiver, scope);
58997
+ if (isBind) {
58998
+ const variantInfo2 = this.variantTypeInfo(receiver.type);
58999
+ if (variantInfo2 === null) return null;
59000
+ if (variantInfo2.valueType === null) {
59001
+ throw new CompileError("Only a lookup variant can bind a row.", pos);
59002
+ }
59003
+ if (callee.optional === true) {
59004
+ throw new CompileError("Bind requires a non-null lookup variant.", pos);
59005
+ }
59006
+ if (receiver.pointer.type !== "variant" /* Variant */) {
59007
+ throw new CompileError(
59008
+ "Bind requires a declared lookup variant path.",
59009
+ pos
59010
+ );
59011
+ }
59012
+ requireArgCount("NeoLookupVariant.Bind", argumentsList2, 1, pos);
59013
+ const row2 = argumentsList2[0];
59014
+ if (row2.kind !== "call") {
59015
+ throw new CompileError(
59016
+ 'Bind requires Reference(id: "value-id").',
59017
+ row2.pos
59018
+ );
59019
+ }
59020
+ if (row2.callee.kind !== "ident" || row2.callee.name !== "Reference") {
59021
+ throw new CompileError(
59022
+ "Bind requires a Reference row argument.",
59023
+ row2.pos
59024
+ );
59025
+ }
59026
+ requireArgCount("Bind Reference", row2.args, 1, row2.pos);
59027
+ if (row2.argumentNames?.[0] !== "id") {
59028
+ throw new CompileError(
59029
+ 'Bind requires Reference(id: "value-id").',
59030
+ row2.pos
59031
+ );
59032
+ }
59033
+ const id = row2.args[0];
59034
+ if (id.kind !== "litString") {
59035
+ throw new CompileError(
59036
+ "Bound row id must be a string literal.",
59037
+ id.pos
59038
+ );
59039
+ }
59040
+ if (id.value.length === 0) {
59041
+ throw new CompileError("Bound row id must not be empty.", id.pos);
59042
+ }
59043
+ if (row2.typeArguments !== void 0) {
59044
+ if (row2.typeArguments.length !== 1) {
59045
+ throw new CompileError(
59046
+ "Reference requires exactly one generic target type.",
59047
+ row2.pos
59048
+ );
59049
+ }
59050
+ this.requireAssignable(
59051
+ this.resolveType(row2.typeArguments[0]),
59052
+ variantInfo2.valueType,
59053
+ row2.pos,
59054
+ "Lookup variant row"
59055
+ );
59056
+ }
59057
+ const rowType = this.context.persistedReferenceTypes?.get(id.value);
59058
+ if (rowType !== void 0) {
59059
+ this.requireAssignable(
59060
+ neoScriptReadType(rowType),
59061
+ variantInfo2.valueType,
59062
+ row2.pos,
59063
+ "Lookup variant row"
59064
+ );
59065
+ }
59066
+ const bound = this.project.typeByName.get(NEO_VARIANT_TYPE_NAME);
59067
+ if (bound === void 0) {
59068
+ throw new CompileError(
59069
+ `The seeded '${NEO_VARIANT_TYPE_NAME}' class is missing.`,
59070
+ pos
59071
+ );
59072
+ }
59073
+ return {
59074
+ pointer: { ...receiver.pointer, rowValueId: id.value },
59075
+ type: {
59076
+ kind: "named",
59077
+ typeId: bound.id,
59078
+ typeArguments: receiver.type.kind === "named" ? receiver.type.typeArguments?.slice(0, 1) ?? [] : []
59079
+ }
59080
+ };
59081
+ }
58967
59082
  if (isInitialize) {
58968
59083
  const variantInfo2 = this.variantTypeInfo(receiver.type);
58969
59084
  if (variantInfo2 === null) return null;
@@ -59631,6 +59746,8 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
59631
59746
  }
59632
59747
  const staticType = this.project.typeByName.get(receiverAst.name);
59633
59748
  if (staticType && staticType.kind !== "enum") {
59749
+ if (receiverAst.typeQualifier)
59750
+ this.resolveType(receiverAst.typeQualifier);
59634
59751
  this.assertUserSafe(
59635
59752
  { kind: "named", typeId: staticType.id },
59636
59753
  "a static receiver",
@@ -59770,6 +59887,9 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
59770
59887
  pointer: listIndexPointer(receiver.pointer, index),
59771
59888
  type: viewType,
59772
59889
  writability: "readOnly" /* ReadOnly */,
59890
+ ...receiver.entryWritability !== void 0 ? { entryWritability: receiver.entryWritability } : {},
59891
+ entryUserData: receiver.entryUserData === true,
59892
+ ...receiver.writeRoot !== void 0 ? { writeRoot: receiver.writeRoot } : {},
59773
59893
  indexDefinition: index,
59774
59894
  indexCollectionPointer: receiver.pointer
59775
59895
  };
@@ -59778,7 +59898,10 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
59778
59898
  return {
59779
59899
  pointer: receiver.pointer,
59780
59900
  type: { kind: "primitive", name: "unknown" },
59781
- indexSurface: receiver.type
59901
+ indexSurface: receiver.type,
59902
+ entryWritability: receiver.entryWritability ?? receiver.writability ?? "runtime" /* Runtime */,
59903
+ entryUserData: receiver.entryWritability === void 0 ? receiver.userData === true : receiver.entryUserData === true,
59904
+ writeRoot: this.expressionWriteRoot(receiver, scope)
59782
59905
  };
59783
59906
  }
59784
59907
  if ((name === "Keys" || name === "Values") && receiver.type.kind === "dictionary") {
@@ -60053,7 +60176,7 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
60053
60176
  pos
60054
60177
  );
60055
60178
  }
60056
- if (entry.id.startsWith(NEOSCRIPT_PENDING_SYMBOL_ID_PREFIX)) {
60179
+ if (entry.id.startsWith(NEOSCRIPT_PENDING_SYMBOL_ID_PREFIX) && !this.options.allowPendingRegistryEntries) {
60057
60180
  throw new CompileError(
60058
60181
  `${registry.entryType} '${name}' has no @id, so it has never been pushed and has no project file to reference. Push the file before referencing it.`,
60059
60182
  pos
@@ -60181,7 +60304,10 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
60181
60304
  key.pointer
60182
60305
  ),
60183
60306
  type: resultType,
60184
- writability: "readOnly" /* ReadOnly */
60307
+ writability: "readOnly" /* ReadOnly */,
60308
+ ...receiver.entryWritability !== void 0 ? { entryWritability: receiver.entryWritability } : {},
60309
+ entryUserData: receiver.entryUserData === true,
60310
+ ...receiver.writeRoot !== void 0 ? { writeRoot: receiver.writeRoot } : {}
60185
60311
  };
60186
60312
  }
60187
60313
  const readonlyCollection = receiver.symbol?.readonlyDeclaration === true && receiver.initWritability !== void 0 ? {
@@ -60854,6 +60980,33 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
60854
60980
  typeArguments
60855
60981
  );
60856
60982
  }
60983
+ if (callee.kind === "lambda" && expected !== void 0) {
60984
+ rejectTypeArguments();
60985
+ const parameterTypes = callee.params.map((parameter3) => {
60986
+ if (parameter3.type === null) {
60987
+ throw new CompileError(
60988
+ "An immediately invoked lambda requires explicit parameter types.",
60989
+ parameter3.pos
60990
+ );
60991
+ }
60992
+ return this.resolveType(parameter3.type);
60993
+ });
60994
+ return this.resolveDelegateCall(
60995
+ this.resolveDelegateLambda(
60996
+ callee,
60997
+ {
60998
+ kind: "delegate",
60999
+ parameterTypes,
61000
+ returnType: expected
61001
+ },
61002
+ scope
61003
+ ),
61004
+ argumentsList2,
61005
+ scope,
61006
+ pos,
61007
+ false
61008
+ );
61009
+ }
60857
61010
  const variantCall = this.resolveVariantCall(
60858
61011
  callee,
60859
61012
  argumentsList2,
@@ -61017,6 +61170,8 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
61017
61170
  }
61018
61171
  const staticType = this.project.typeByName.get(callee.receiver.name);
61019
61172
  if (staticType && staticType.kind !== "enum") {
61173
+ if (callee.receiver.typeQualifier)
61174
+ this.resolveType(callee.receiver.typeQualifier);
61020
61175
  this.assertUserSafe(
61021
61176
  { kind: "named", typeId: staticType.id },
61022
61177
  "a static receiver",
@@ -71552,7 +71707,7 @@ function resolveAnalyzerMember(context, member) {
71552
71707
  }
71553
71708
 
71554
71709
  // ../src/runtime/neoscript/neoscript-language-context-adapter.ts
71555
- var NEOSCRIPT_COMPILER_ADAPTER_REVISION = 6;
71710
+ var NEOSCRIPT_COMPILER_ADAPTER_REVISION = 7;
71556
71711
  var UNKNOWN_TYPE = {
71557
71712
  kind: "primitive",
71558
71713
  name: "unknown"
@@ -73842,6 +73997,7 @@ function compileMemberInitializerBody(args) {
73842
73997
  const returnTypeInfo = resolveMemberDeclaredTypeInfo(
73843
73998
  args.member,
73844
73999
  members2,
74000
+ args.classes,
73845
74001
  args.thisClass
73846
74002
  );
73847
74003
  if (returnTypeInfo === null) {
@@ -73889,7 +74045,8 @@ function compileValueRowInitializerBody(args) {
73889
74045
  }
73890
74046
  const returnTypeInfo = resolveMemberDeclaredTypeInfo(
73891
74047
  args.member,
73892
- args.members
74048
+ args.members,
74049
+ args.classes
73893
74050
  );
73894
74051
  if (returnTypeInfo === null) {
73895
74052
  throw new Error(
@@ -74022,7 +74179,9 @@ function compilationProjectForDocument(document2, state) {
74022
74179
  classes: document2.classes,
74023
74180
  enums: document2.enums,
74024
74181
  interfaces: document2.interfaces,
74025
- constructors: document2.constructors ?? []
74182
+ constructors: document2.constructors ?? [],
74183
+ variants: document2.variants ?? [],
74184
+ variantFolders: document2.variantFolders ?? []
74026
74185
  });
74027
74186
  return state.compilationProject;
74028
74187
  }
@@ -74118,6 +74277,8 @@ function compileValueInitializerDependency(document2, valueId, compilationProjec
74118
74277
  enums: document2.enums,
74119
74278
  interfaces: document2.interfaces,
74120
74279
  constructors: document2.constructors ?? [],
74280
+ variants: document2.variants ?? [],
74281
+ variantFolders: document2.variantFolders ?? [],
74121
74282
  member: site.member,
74122
74283
  valueRow: { ...site.row },
74123
74284
  valueId: site.row.id,
@@ -74136,7 +74297,9 @@ function compileMemberInitializerDependency(document2, memberId, compilationProj
74136
74297
  classes: document2.classes,
74137
74298
  enums: document2.enums,
74138
74299
  interfaces: document2.interfaces,
74139
- constructors: document2.constructors ?? []
74300
+ constructors: document2.constructors ?? [],
74301
+ variants: document2.variants ?? [],
74302
+ variantFolders: document2.variantFolders ?? []
74140
74303
  };
74141
74304
  const memberIndex = documentMemberCompilationIndex(document2);
74142
74305
  const member = memberIndex.membersById.get(memberId);
@@ -78591,15 +78754,7 @@ function calculateDeclarationSignature(ctx, projectionClassId, schemaKey, declar
78591
78754
  declarationClassId: declaration.classDef.id,
78592
78755
  memberId: declaration.memberId,
78593
78756
  isAbstract: isAbstractMember(member) === true,
78594
- isVirtual: isVirtualMember(member) !== false,
78595
- // Openness belongs to the DECLARING class, not to whoever is asking: a
78596
- // descendant that closes the param still has to see a declaration it is
78597
- // obliged to implement.
78598
- requiresClosingImplementation: lookupDeclaredTypeInfo2(member) === null ? false : lookupNarrowingAwaitsClosingBinding(
78599
- ctx,
78600
- member,
78601
- resolveGenericEnvForEmission(ctx, declaration.classDef.id)
78602
- )
78757
+ isVirtual: isVirtualMember(member) !== false
78603
78758
  };
78604
78759
  if (isCallableMemberForCodegen(member)) {
78605
78760
  const parameterTypes = member.argumentTypes.map(
@@ -78809,7 +78964,7 @@ function generatedInstanceMemberSignaturesEqual(left, right) {
78809
78964
  return false;
78810
78965
  }
78811
78966
  function emitsAbstractDeclaration(signature) {
78812
- return signature.isAbstract || signature.requiresClosingImplementation;
78967
+ return signature.isAbstract;
78813
78968
  }
78814
78969
  function resolveGeneratedInstanceMemberPlan(ctx, classDef, schemaKey) {
78815
78970
  const declaration = ownInstanceMemberDeclaration(classDef, schemaKey);
@@ -80867,41 +81022,6 @@ function lookupDeclaredTypeInfo2(member) {
80867
81022
  if (!isMemberLookupBase(member)) return null;
80868
81023
  return member.declaredTypeInfo ?? null;
80869
81024
  }
80870
- function lookupTargetClassProjection(ctx, member, env) {
80871
- if (!isMemberLookupBase(member)) return null;
80872
- const declaredTypeInfo = lookupDeclaredTypeInfo2(member);
80873
- if (declaredTypeInfo === null) {
80874
- const entryMember = resolveLookupEntryMember(ctx, member);
80875
- if (entryMember === null) return null;
80876
- if (!isClassTypedMember(entryMember)) return null;
80877
- return {
80878
- classId: entryMember.classId,
80879
- constructedSuffix: constructedTypeArgumentsSuffix(ctx, entryMember, true, env) ?? ""
80880
- };
80881
- }
80882
- if (declaredTypeInfo.type === 7 /* Class */) {
80883
- return {
80884
- classId: declaredTypeInfo.classId,
80885
- constructedSuffix: typeInfoConstructedSuffix(ctx, declaredTypeInfo, true, env) ?? ""
80886
- };
80887
- }
80888
- if (declaredTypeInfo.type !== 21 /* Generic */) return null;
80889
- if (!isClassGenericParamTypeInfo(declaredTypeInfo)) return null;
80890
- const entry = env?.get(declaredTypeInfo.genericParamId);
80891
- if (entry === void 0) return null;
80892
- if (entry.kind !== "member") return null;
80893
- const bindingMember = resolveMemberById(
80894
- ctx,
80895
- entry.memberId,
80896
- `classes.${declaredTypeInfo.ownerClassId}.genericParams.${declaredTypeInfo.genericParamId}`
80897
- );
80898
- if (bindingMember === null) return null;
80899
- if (!isClassTypedMember(bindingMember)) return null;
80900
- return {
80901
- classId: bindingMember.classId,
80902
- constructedSuffix: constructedTypeArgumentsSuffix(ctx, bindingMember, true, env) ?? ""
80903
- };
80904
- }
80905
81025
  function referenceHandleTypeInfo(ctx, reference) {
80906
81026
  const target = reference.targetTypeInfo;
80907
81027
  if (referenceCategory(target, classConstrainedGenerics(ctx.classes)) !== "handle" /* Handle */) {
@@ -80965,11 +81085,6 @@ function lookupReferenceElementType(ctx, member, env) {
80965
81085
  function lookupNarrowsThroughGenericParam(member) {
80966
81086
  return lookupDeclaredTypeInfo2(member)?.type === 21 /* Generic */;
80967
81087
  }
80968
- function lookupNarrowingAwaitsClosingBinding(ctx, member, env) {
80969
- if (!lookupNarrowsThroughGenericParam(member)) return false;
80970
- if (lookupProjection(ctx, member) !== "class" /* Class */) return false;
80971
- return lookupTargetClassProjection(ctx, member, env) === null;
80972
- }
80973
81088
  function lookupTargetValueType(ctx, member, saved, env) {
80974
81089
  if (!isMemberLookupBase(member)) return "NeoLookupSelection";
80975
81090
  const targetSaved = lookupTargetSaved(ctx, member) ?? saved;
@@ -86457,7 +86572,9 @@ function buildNeoScriptProject(document2) {
86457
86572
  classes: document2.classes,
86458
86573
  enums: document2.enums,
86459
86574
  interfaces: document2.interfaces,
86460
- constructors: document2.constructors ?? []
86575
+ constructors: document2.constructors ?? [],
86576
+ variants: document2.variants,
86577
+ variantFolders: document2.variantFolders
86461
86578
  });
86462
86579
  }
86463
86580
  function neoScriptProjectFingerprint(document2) {