peachsim 0.1.1966 → 0.1.1967

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.
Files changed (82) hide show
  1. package/dist-lib/agent-daemon-client.cjs +1 -1
  2. package/dist-lib/agent-events.cjs +1 -1
  3. package/dist-lib/attached-projects.cjs +1 -1
  4. package/dist-lib/auth/shared-session.cjs +1 -1
  5. package/dist-lib/backend-origin.cjs +1 -1
  6. package/dist-lib/beta.cjs +1 -1
  7. package/dist-lib/beta.mjs +1 -1
  8. package/dist-lib/bridge-constants.cjs +1 -1
  9. package/dist-lib/bridge-contract-input.cjs +1 -1
  10. package/dist-lib/bridge-contract-input.mjs +1 -1
  11. package/dist-lib/bridge-contract.cjs +1 -1
  12. package/dist-lib/bridge-contract.mjs +1 -1
  13. package/dist-lib/bundle-channel.cjs +39 -8
  14. package/dist-lib/capture-contract.cjs +1 -1
  15. package/dist-lib/capture-contract.mjs +1 -1
  16. package/dist-lib/cloud-contract.cjs +1 -1
  17. package/dist-lib/cloud-contract.mjs +1 -1
  18. package/dist-lib/cloud-test-args.cjs +1 -1
  19. package/dist-lib/cloud-test-args.mjs +1 -1
  20. package/dist-lib/cloud.cjs +1 -1
  21. package/dist-lib/cloud.mjs +1 -1
  22. package/dist-lib/config.cjs +1 -1
  23. package/dist-lib/config.mjs +1 -1
  24. package/dist-lib/detox/index.cjs +1 -1
  25. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  26. package/dist-lib/expo-swift-bundle.cjs +38 -7
  27. package/dist-lib/expo-swift-metadata.cjs +1 -1
  28. package/dist-lib/expo-swift-metadata.mjs +1 -1
  29. package/dist-lib/home-paths.cjs +1 -1
  30. package/dist-lib/host/bridge-host.cjs +39 -8
  31. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  32. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  33. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  34. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  35. package/dist-lib/host/websocket-proxy.cjs +1 -1
  36. package/dist-lib/index.cjs +2 -2
  37. package/dist-lib/jump-to-source-babel.cjs +1 -1
  38. package/dist-lib/jump-to-source-native.cjs +1 -1
  39. package/dist-lib/kotlin-host.cjs +1 -1
  40. package/dist-lib/menu.cjs +1 -1
  41. package/dist-lib/menu.mjs +1 -1
  42. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  43. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  44. package/dist-lib/metro-production-bundle.cjs +1 -1
  45. package/dist-lib/metro-production-bundle.mjs +1 -1
  46. package/dist-lib/metro.cjs +2 -2
  47. package/dist-lib/native-app-identity-project.cjs +2 -2
  48. package/dist-lib/native-app-identity-project.mjs +2 -2
  49. package/dist-lib/native-app-identity.cjs +1 -1
  50. package/dist-lib/native-app-identity.mjs +1 -1
  51. package/dist-lib/native-firebase-metadata.cjs +1 -1
  52. package/dist-lib/native-firebase-metadata.mjs +1 -1
  53. package/dist-lib/pdfium-raster.cjs +1 -1
  54. package/dist-lib/pdfium-raster.mjs +1 -1
  55. package/dist-lib/plist.cjs +1 -1
  56. package/dist-lib/plist.mjs +1 -1
  57. package/dist-lib/profiles.cjs +1 -1
  58. package/dist-lib/public-brand.cjs +1 -1
  59. package/dist-lib/public-origins-lib-esm.json +24 -24
  60. package/dist-lib/public-origins-lib.json +53 -53
  61. package/dist-lib/react-native-host-modules.cjs +1 -1
  62. package/dist-lib/react-native-host-modules.mjs +1 -1
  63. package/dist-lib/reap-browser.cjs +1 -1
  64. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  65. package/dist-lib/sdk.cjs +1 -1
  66. package/dist-lib/sdk.mjs +1 -1
  67. package/dist-lib/skills.cjs +39 -8
  68. package/dist-lib/swift-compile.cjs +2 -2
  69. package/dist-lib/swift-compile.mjs +2 -2
  70. package/dist-lib/swift-package.cjs +1 -1
  71. package/dist-lib/swift-package.mjs +1 -1
  72. package/dist-lib/swift-submit.cjs +1 -1
  73. package/dist-lib/swift-submit.mjs +1 -1
  74. package/dist-lib/swift-toolchain.cjs +1 -1
  75. package/dist-lib/swift.cjs +1 -1
  76. package/dist-lib/vite-swift.cjs +37 -6
  77. package/dist-lib/vite.cjs +1 -1
  78. package/dist-lib/worklet-executable.cjs +1 -1
  79. package/dist-lib/worklet-executable.mjs +1 -1
  80. package/package.json +1 -1
  81. package/src/swift-objc-standin.ts +24 -1
  82. package/src/swift-standin-emit.ts +21 -2
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1966 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1967 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1966 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1967 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
 
3
3
  // src/swift-package.ts
4
4
  function swiftManifestSettings(target) {
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1966 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1967 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1966 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1967 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
 
3
3
  // src/is-record.ts
4
4
  function isRecord(value) {
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1966 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1967 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1966 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1967 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1966 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1967 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -6272,6 +6272,7 @@ function emitSwiftStandin(sourceGraphs, options) {
6272
6272
  const superclass = /* @__PURE__ */ new Map();
6273
6273
  const superId = /* @__PURE__ */ new Map();
6274
6274
  const conforms = /* @__PURE__ */ new Map();
6275
+ const conditional = [];
6275
6276
  const conformanceTargets = /* @__PURE__ */ new Map();
6276
6277
  const objectConformers = /* @__PURE__ */ new Set();
6277
6278
  const conformIds = /* @__PURE__ */ new Map();
@@ -6302,6 +6303,7 @@ function emitSwiftStandin(sourceGraphs, options) {
6302
6303
  if (edge.sourceOrigin) origins.set(edge.source, edge.sourceOrigin.displayName);
6303
6304
  switch (edge.kind) {
6304
6305
  case "memberOf": {
6306
+ if (edge.source === edge.target) break;
6305
6307
  const parent = byId.get(edge.target);
6306
6308
  if (parent) {
6307
6309
  owner.set(edge.source, edge.target);
@@ -6332,7 +6334,15 @@ function emitSwiftStandin(sourceGraphs, options) {
6332
6334
  path: pathOf(source),
6333
6335
  reason: `unsupported Objective-C protocol parent ${edge.target}`
6334
6336
  });
6335
- if (name3) {
6337
+ if (name3 && edge.swiftConstraints?.length) {
6338
+ conditional.push({
6339
+ source,
6340
+ name: name3,
6341
+ where: edge.swiftConstraints.map(
6342
+ ({ kind, lhs, rhs }) => kind === "sameType" ? `${lhs} == ${rhs}` : `${lhs}: ${rhs}`
6343
+ ).join(", ")
6344
+ });
6345
+ } else if (name3) {
6336
6346
  conforms.set(edge.source, [...conforms.get(edge.source) ?? [], name3]);
6337
6347
  const targets = conformanceTargets.get(edge.source) ?? /* @__PURE__ */ new Map();
6338
6348
  targets.set(name3, edge.target);
@@ -6813,7 +6823,7 @@ function emitSwiftStandin(sourceGraphs, options) {
6813
6823
  if (!parentSymbol || !ownIds.has(parentSymbol.identifier.precise))
6814
6824
  list2.push(standinMarker);
6815
6825
  const open = symbol2.accessLevel === "open" && (!parentSymbol || parentSymbol.accessLevel === "open");
6816
- const objcName = /^c:objc\(cs\)(\w+)$/.exec(id)?.[1];
6826
+ const objcName = shape.generics ? void 0 : /^c:objc\(cs\)(\w+)$/.exec(id)?.[1];
6817
6827
  emit(
6818
6828
  `${indent2}${shape.attrs}${objcName ? `@objc(${objcName}) ` : ""}${shape.final}${open ? "open" : "public"} class ${shape.name}${shape.generics}${list2.length ? `: ${list2.join(", ")}` : ""}${selfConforming(shape.where)} {`
6819
6829
  );
@@ -7208,6 +7218,8 @@ function emitSwiftStandin(sourceGraphs, options) {
7208
7218
  emitWitness(witness.member, " ", witness.path);
7209
7219
  emit("}");
7210
7220
  }
7221
+ for (const { source, name: name3, where } of conditional)
7222
+ emitAt(pathOf(source), `extension ${pathOf(source)}: ${name3} where ${where} {}`);
7211
7223
  const banner = [
7212
7224
  ...options.placeholder ? [
7213
7225
  `// placeholder for ${options.module}, generated from ${options.source}: ${options.placeholder}.`,
@@ -7596,6 +7608,7 @@ function objcView(surface, toolchainBin, stdlib, cacheDir5, work, original, vend
7596
7608
  import_node_fs7.default.mkdirSync(import_node_path7.default.dirname(file), { recursive: true });
7597
7609
  import_node_fs7.default.writeFileSync(file, text5);
7598
7610
  }
7611
+ const interfaceCopies = [];
7599
7612
  if (framework) {
7600
7613
  import_node_fs7.default.mkdirSync(import_node_path7.default.join(frameworks, `${surface.module}.framework`, "Modules"), {
7601
7614
  recursive: true
@@ -7614,7 +7627,8 @@ function objcView(surface, toolchainBin, stdlib, cacheDir5, work, original, vend
7614
7627
  );
7615
7628
  import_node_fs7.default.mkdirSync(to, { recursive: true });
7616
7629
  for (const name3 of import_node_fs7.default.readdirSync(from))
7617
- if (name3.endsWith(".swiftinterface"))
7630
+ if (name3.endsWith(".swiftinterface")) {
7631
+ interfaceCopies.push(import_node_path7.default.join(to, name3));
7618
7632
  import_node_fs7.default.writeFileSync(
7619
7633
  import_node_path7.default.join(to, name3),
7620
7634
  import_node_fs7.default.readFileSync(import_node_path7.default.join(from, name3), "utf8").replace(/\bCoreFoundation\.(?=CG)/g, "CoreGraphics.").replace(/\bCoreFoundation\.(?=\w)/g, "Foundation.").replace(
@@ -7622,6 +7636,7 @@ function objcView(surface, toolchainBin, stdlib, cacheDir5, work, original, vend
7622
7636
  "Foundation.NSData."
7623
7637
  )
7624
7638
  );
7639
+ }
7625
7640
  }
7626
7641
  } else {
7627
7642
  import_node_fs7.default.copyFileSync(surface.modulemap, import_node_path7.default.join(headersDir, "module.modulemap"));
@@ -7779,6 +7794,7 @@ function objcView(surface, toolchainBin, stdlib, cacheDir5, work, original, vend
7779
7794
  return name3 ? { name: name3, before: text5.slice(0, column - 1), after: rest.slice(name3.length) } : null;
7780
7795
  };
7781
7796
  const typeKind = (name3, after) => /^[A-Z][A-Z0-9_]+$/.test(name3) && !/^\s*\*/.test(after) ? "macro" : /^\s*\*/.test(after) ? "class" : "struct";
7797
+ const selectors = /* @__PURE__ */ new Set();
7782
7798
  for (let round = 0; ; round++) {
7783
7799
  import_node_fs7.default.rmSync(out, { recursive: true, force: true });
7784
7800
  import_node_fs7.default.mkdirSync(out, { recursive: true });
@@ -7816,6 +7832,21 @@ function objcView(surface, toolchainBin, stdlib, cacheDir5, work, original, vend
7816
7832
  `original Objective-C declarations do not import as Swift: ${run5.stderr.trim() || run5.stdout.trim()}`
7817
7833
  );
7818
7834
  let progress = false;
7835
+ for (const [, shadowed, same] of run5.stderr.matchAll(
7836
+ /is not a member type of class '(\w+)\.(\w+)'/g
7837
+ ))
7838
+ if (shadowed === same && !selectors.has(shadowed)) {
7839
+ selectors.add(shadowed);
7840
+ progress = true;
7841
+ for (const file of interfaceCopies)
7842
+ import_node_fs7.default.writeFileSync(
7843
+ file,
7844
+ import_node_fs7.default.readFileSync(file, "utf8").replace(
7845
+ new RegExp(`\\b${shadowed}\\.(?=[A-Za-z_])`, "g"),
7846
+ `${shadowed}::`
7847
+ )
7848
+ );
7849
+ }
7819
7850
  const learn = (name3, kind) => {
7820
7851
  if (missing.has(name3)) return;
7821
7852
  missing.set(name3, kind);
@@ -16713,7 +16744,7 @@ var darwinRecordsRegion = (quoted) => quoted.length ? ["-Wl,--start-lib", ...quo
16713
16744
  var REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
16714
16745
  var MULTI_MANIFEST_VERSION = 66;
16715
16746
  var SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
16716
- var compilerSourceDigest = true ? "43445ac597f2b7673127e43186400d0f6863caf82dafb48c31ce3b516719ce13" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
16747
+ var compilerSourceDigest = true ? "2e5698309de758f9fcfd857f44c8fe794ab3ef36f7b28f6a042e4326bbc8113a" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
16717
16748
  function swiftArtifactHash(input, release, moduleRoot) {
16718
16749
  const hash = (0, import_node_crypto13.createHash)("sha256");
16719
16750
  hash.update(`swift-compile
@@ -29667,7 +29698,7 @@ function sourceClosureDigest(srcDir, entrypoints) {
29667
29698
  return hash.digest("hex");
29668
29699
  }
29669
29700
  var standinSourceDigest = (srcDir = __sootsim_import_meta_dirname) => sourceClosureDigest(srcDir, STANDIN_DIGEST_ENTRYPOINTS);
29670
- var STANDIN_SOURCE_DIGEST = true ? "05087ee542759092b4dbe08e7a7c0a03416fa45a27f3c2e9b633d6d5ce98186a" : standinSourceDigest();
29701
+ var STANDIN_SOURCE_DIGEST = true ? "af579d23be157d779601d4f3373566fac852d588d01fe54fa87ad7cd82139fd8" : standinSourceDigest();
29671
29702
 
29672
29703
  // src/swift-standins.ts
29673
29704
  init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
package/dist-lib/vite.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1966 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1967 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1966 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1967 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1966 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1967 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
 
3
3
  // src/worklet-executable.ts
4
4
  import { parse } from "acorn";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "peachsim",
3
- "version": "0.1.1966",
3
+ "version": "0.1.1967",
4
4
  "description": "Vite and Metro plugins, testing drivers, and SDK exports for peach.",
5
5
  "author": "Tamagui LLC",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -482,6 +482,7 @@ export function objcView(
482
482
  fs.mkdirSync(path.dirname(file), { recursive: true })
483
483
  fs.writeFileSync(file, text)
484
484
  }
485
+ const interfaceCopies: string[] = []
485
486
  if (framework) {
486
487
  fs.mkdirSync(path.join(frameworks, `${surface.module}.framework`, 'Modules'), {
487
488
  recursive: true,
@@ -504,7 +505,8 @@ export function objcView(
504
505
  )
505
506
  fs.mkdirSync(to, { recursive: true })
506
507
  for (const name of fs.readdirSync(from))
507
- if (name.endsWith('.swiftinterface'))
508
+ if (name.endsWith('.swiftinterface')) {
509
+ interfaceCopies.push(path.join(to, name))
508
510
  fs.writeFileSync(
509
511
  path.join(to, name),
510
512
  fs
@@ -518,6 +520,7 @@ export function objcView(
518
520
  'Foundation.NSData.',
519
521
  ),
520
522
  )
523
+ }
521
524
  }
522
525
  } else {
523
526
  fs.copyFileSync(surface.modulemap, path.join(headersDir, 'module.modulemap'))
@@ -690,6 +693,7 @@ export function objcView(
690
693
  : /^\s*\*/.test(after)
691
694
  ? 'class'
692
695
  : 'struct'
696
+ const selectors = new Set<string>()
693
697
  for (let round = 0; ; round++) {
694
698
  fs.rmSync(out, { recursive: true, force: true })
695
699
  fs.mkdirSync(out, { recursive: true })
@@ -727,6 +731,25 @@ export function objcView(
727
731
  `original Objective-C declarations do not import as Swift: ${run.stderr.trim() || run.stdout.trim()}`,
728
732
  )
729
733
  let progress = false
734
+ // a class named like its module shadows the module qualifier, which a module selector
735
+ // still reaches
736
+ for (const [, shadowed, same] of run.stderr.matchAll(
737
+ /is not a member type of class '(\w+)\.(\w+)'/g,
738
+ ))
739
+ if (shadowed === same && !selectors.has(shadowed!)) {
740
+ selectors.add(shadowed!)
741
+ progress = true
742
+ for (const file of interfaceCopies)
743
+ fs.writeFileSync(
744
+ file,
745
+ fs
746
+ .readFileSync(file, 'utf8')
747
+ .replace(
748
+ new RegExp(`\\b${shadowed}\\.(?=[A-Za-z_])`, 'g'),
749
+ `${shadowed}::`,
750
+ ),
751
+ )
752
+ }
730
753
  const learn = (name: string, kind: 'class' | 'protocol' | 'struct' | 'macro') => {
731
754
  if (missing.has(name)) return
732
755
  missing.set(name, kind)
@@ -38,6 +38,7 @@ export type GraphRelationship = {
38
38
  source: string
39
39
  target: string
40
40
  targetFallback?: string
41
+ swiftConstraints?: { kind: string; lhs: string; rhs: string }[]
41
42
  sourceOrigin?: { identifier: string; displayName: string }
42
43
  }
43
44
  export type SymbolGraph = {
@@ -703,6 +704,7 @@ export function emitSwiftStandin(
703
704
  const superclass = new Map<string, string>()
704
705
  const superId = new Map<string, string>()
705
706
  const conforms = new Map<string, string[]>()
707
+ const conditional: { source: GraphSymbol; name: string; where: string }[] = []
706
708
  const conformanceTargets = new Map<string, Map<string, string>>()
707
709
  const objectConformers = new Set<string>()
708
710
  const conformIds = new Map<string, string[]>()
@@ -736,6 +738,8 @@ export function emitSwiftStandin(
736
738
  if (edge.sourceOrigin) origins.set(edge.source, edge.sourceOrigin.displayName)
737
739
  switch (edge.kind) {
738
740
  case 'memberOf': {
741
+ // a synthesized alias shares its enum's id, so its edge can name itself
742
+ if (edge.source === edge.target) break
739
743
  const parent = byId.get(edge.target)
740
744
  if (parent) {
741
745
  owner.set(edge.source, edge.target)
@@ -779,7 +783,17 @@ export function emitSwiftStandin(
779
783
  path: pathOf(source),
780
784
  reason: `unsupported Objective-C protocol parent ${edge.target}`,
781
785
  })
782
- if (name) {
786
+ if (name && edge.swiftConstraints?.length) {
787
+ conditional.push({
788
+ source,
789
+ name,
790
+ where: edge.swiftConstraints
791
+ .map(({ kind, lhs, rhs }) =>
792
+ kind === 'sameType' ? `${lhs} == ${rhs}` : `${lhs}: ${rhs}`,
793
+ )
794
+ .join(', '),
795
+ })
796
+ } else if (name) {
783
797
  conforms.set(edge.source, [...(conforms.get(edge.source) ?? []), name])
784
798
  const targets =
785
799
  conformanceTargets.get(edge.source) ?? new Map<string, string>()
@@ -1464,7 +1478,10 @@ export function emitSwiftStandin(
1464
1478
  const open =
1465
1479
  symbol.accessLevel === 'open' &&
1466
1480
  (!parentSymbol || parentSymbol.accessLevel === 'open')
1467
- const objcName = /^c:objc\(cs\)(\w+)$/.exec(id)?.[1]
1481
+ // swift rejects an explicit objc name on a generic subclass of an objc class
1482
+ const objcName = shape.generics
1483
+ ? undefined
1484
+ : /^c:objc\(cs\)(\w+)$/.exec(id)?.[1]
1468
1485
  emit(
1469
1486
  `${indent}${shape.attrs}${objcName ? `@objc(${objcName}) ` : ''}${shape.final}${open ? 'open' : 'public'} class ${shape.name}${shape.generics}${list.length ? `: ${list.join(', ')}` : ''}${selfConforming(shape.where)} {`,
1470
1487
  )
@@ -2001,6 +2018,8 @@ export function emitSwiftStandin(
2001
2018
  emitWitness(witness.member, ' ', witness.path)
2002
2019
  emit('}')
2003
2020
  }
2021
+ for (const { source, name, where } of conditional)
2022
+ emitAt(pathOf(source), `extension ${pathOf(source)}: ${name} where ${where} {}`)
2004
2023
  const banner = [
2005
2024
  ...(options.placeholder
2006
2025
  ? [