diff --git a/Package.resolved b/Package.resolved index fe95812..a210e83 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,6 +1,24 @@ { - "originHash" : "aec35e3117707d5dfad488aa657c662f4864f9d4ec818bf1f2e0f3d63980f777", + "originHash" : "723f256dacf5a9bc49a4e3f3e3199b1f10b82b02c55d2ad4ae5a576846570b90", "pins" : [ + { + "identity" : "shellkit", + "kind" : "remoteSourceControl", + "location" : "https://github.com/Cocoanetics/ShellKit", + "state" : { + "branch" : "main", + "revision" : "3901e20158a2260586a4332ae244b74449da893a" + } + }, + { + "identity" : "swift-argument-parser", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-argument-parser", + "state" : { + "revision" : "626b5b7b2f45e1b0b1c6f4a309296d1d21d7311b", + "version" : "1.7.1" + } + }, { "identity" : "swift-syntax", "kind" : "remoteSourceControl", diff --git a/Package.swift b/Package.swift index f9c22b8..d081636 100644 --- a/Package.swift +++ b/Package.swift @@ -4,8 +4,10 @@ import PackageDescription let package = Package( name: "SwiftScript", platforms: [ - .macOS("26.0"), - .iOS("26.0"), + .macOS(.v13), + .iOS(.v16), + .tvOS(.v16), + .watchOS(.v9), ], products: [ .library(name: "SwiftScriptAST", targets: ["SwiftScriptAST"]), @@ -20,6 +22,17 @@ let package = Package( ], dependencies: [ .package(url: "https://github.com/swiftlang/swift-syntax", from: "603.0.0"), + // ShellKit owns the virtualised runtime context — IO sinks, + // Environment, Sandbox URL gate, NetworkConfig, ProcessTable, + // HostInfo, Command/ExitStatus. SwiftScript reads it through + // `ShellKit.Shell.current` so script output, input, file I/O, + // network calls, identity, and exit codes are all hookable by + // an embedder (SwiftBash, an iOS app, anything that builds a + // virtualised Shell). The standalone `swift-script` CLI uses + // `Shell.processDefault` so the binary still talks to real + // FileHandles when run on its own. + .package(url: "https://github.com/Cocoanetics/ShellKit", + branch: "main"), ], targets: [ .target( @@ -38,6 +51,7 @@ let package = Package( dependencies: [ "SwiftScriptAST", .product(name: "SwiftSyntax", package: "swift-syntax"), + .product(name: "ShellKit", package: "ShellKit"), ], path: "Sources/SwiftScriptInterpreter" ), @@ -45,6 +59,7 @@ let package = Package( name: "swift-script", dependencies: [ "SwiftScriptInterpreter", + .product(name: "ShellKit", package: "ShellKit"), ], path: "Sources/swift-script" ), diff --git a/Sources/BridgeGeneratorTool/main.swift b/Sources/BridgeGeneratorTool/main.swift index c1d8496..f5a7ada 100644 --- a/Sources/BridgeGeneratorTool/main.swift +++ b/Sources/BridgeGeneratorTool/main.swift @@ -655,6 +655,292 @@ func render(_ template: String, _ expr: String) -> String { return template.replacingOccurrences(of: "%@", with: expr) } +// MARK: - Sandbox / network gating policy + +/// What kind of host resource a bridge body touches at runtime. +/// Controls which `authorize…` call gets injected into the generated +/// closure and how the call args are reshaped to use the bound names. +enum GateKind { + case fsRead + case fsWrite + case fsDelete + case network + /// Network gate that pulls the URL+method out of a `URLRequest` + /// arg. The bound name binds the request itself; the gate-emit + /// step uses `\(name).url` and `\(name).httpMethod` to reach the + /// authorize call. + case networkRequest +} + +/// One gate to inject: bind `args[index]` to a local name, then call +/// the appropriate authorizer. The bound name replaces the inline +/// `try unbox…` in the call expression so we don't double-unbox. +struct GateDirective { + /// The arg index this gate applies to. + let argIndex: Int + /// Source-Swift type of the arg as bound. Driven by the symbol's + /// `BridgedType.swiftSpelling`. + let argSwiftType: String + /// Local-variable name used in the bound let + the call site. + let boundName: String + /// Kind of resource — picks the authorize function to call. + let kind: GateKind +} + +/// Decide which gates apply to a method/init based on its receiver, +/// method name, and the resolved signature. Returns an empty array +/// when no gating is needed (the default — most bridges pass through +/// untouched). +/// +/// The policy is intentionally conservative: gate every path-bearing +/// or URL-bearing arg of a known I/O receiver, even when the host +/// method itself is read-only metadata (`fileExists`, `attributesOfItem`). +/// Embedders that want cheaper introspection can grant a permissive +/// sandbox; the policy stays simple. +func gates( + forReceiver receiverTypeName: String?, + methodName: String?, + initFor: String? = nil, + signature sig: ResolvedSignature +) -> [GateDirective] { + // Identify which arg(s) carry path-or-URL data. Most FileManager / + // URL-init signatures put the path/URL first; a few methods + // (`copyItem`, `moveItem`, `linkItem`) pass two paths. + var directives: [GateDirective] = [] + + func appendIfPathish( + _ paramIndex: Int, + kind: GateKind + ) { + guard paramIndex < sig.parameters.count else { return } + let p = sig.parameters[paramIndex] + let spelling = p.type.swiftSpelling + // Only path-shaped args: `String` and `URL`. Bool / Int / etc. + // are introspection params — the gate doesn't apply. + guard spelling == "String" || spelling == "URL" else { return } + directives.append(GateDirective( + argIndex: paramIndex, + argSwiftType: spelling, + boundName: "arg\(paramIndex)", + kind: kind)) + } + + /// Like `appendIfPathish` but for `URLRequest`-typed args: gate + /// via the request's embedded URL + method. Used for the + /// URLSession overloads that take a `URLRequest` instead of a + /// bare `URL` (`data(for:)`, `upload(for:fromFile:)`, + /// `download(for:)`, etc.) so the network policy fires the same + /// way it does for the URL-arg variants. + func appendIfURLRequestish(_ paramIndex: Int) { + guard paramIndex < sig.parameters.count else { return } + let p = sig.parameters[paramIndex] + guard p.type.swiftSpelling == "URLRequest" else { return } + directives.append(GateDirective( + argIndex: paramIndex, + argSwiftType: "URLRequest", + boundName: "arg\(paramIndex)", + kind: .networkRequest)) + } + + // FileManager — every method that takes a path or URL. + if receiverTypeName == "FileManager" || initFor == "FileManager" { + // Pick intent from the method name. Anything that mutates + // disk is `.fsWrite` (or `.fsDelete` for explicit deletes); + // pure inspection is `.fsRead`. Two-path operations + // (`copyItem`, `moveItem`, `linkItem`, `replaceItemAt`) + // gate both paths. + let writeMethods: Set = [ + "createDirectory", "createFile", "createSymbolicLink", + "setAttributes", "changeCurrentDirectoryPath", + ] + let deleteMethods: Set = ["removeItem", "trashItem"] + let twoPathMethods: Set = [ + "copyItem", "moveItem", "linkItem", "replaceItemAt", + ] + let intent: GateKind + if let m = methodName { + if deleteMethods.contains(m) { intent = .fsDelete } + else if writeMethods.contains(m) { intent = .fsWrite } + else if twoPathMethods.contains(m) { intent = .fsWrite } + else { intent = .fsRead } + } else { intent = .fsRead } + if let m = methodName, twoPathMethods.contains(m) { + appendIfPathish(0, kind: intent) + appendIfPathish(1, kind: intent) + } else { + appendIfPathish(0, kind: intent) + } + } + + // URL initializers — `URL(fileURLWithPath:)`, `URL(string:)` — + // bind into a sandbox or network gate so a script can't escape + // by constructing URLs whose origin lies outside the policy. + // Pure URL construction is cheap; the authorize call adds the + // policy enforcement without changing the result. + // + // We only gate `init URL(fileURLWithPath:)` and the + // `String`-shaped `init URL(string:)` here — `URL(filePath:)` + // is a macOS-13+ alias, and the `URL.init(string:relativeTo:)` + // overload routes through the same single-string path. + // `URLComponents` and `URLRequest` get covered by their consumer + // methods (URLSession.data(from:) etc.) rather than at init. + // + // (We deliberately *don't* gate at URL construction time today + // because the current `Sandbox.authorize` is async and many URL + // inits are non-async; the gating happens at the I/O call site.) + + // String / Data file-IO inits — `init String(contentsOf:)`, + // `init String(contentsOfFile:)`, `init Data(contentsOf:)`, + // and the corresponding `.write(to:)` methods. Each takes either + // a `String` path or a `URL` as the first arg. + if initFor == "String" || initFor == "Data" { + if let m = methodName, m.contains("contentsOfFile") || m.contains("contentsOf") { + appendIfPathish(0, kind: .fsRead) + } + } + if receiverTypeName == "String" || receiverTypeName == "Data" { + if methodName == "write" { + // String/Data.write(to: URL/path, …) — first arg. + appendIfPathish(0, kind: .fsWrite) + } + } + + // URLSession — the high-level `data(from:)`, `data(for:)`, + // `download(from:)`, `upload(for:fromFile:)`, etc. take either a + // bare `URL` or a `URLRequest` at index 0; some (`upload(for: + // fromFile:)`) carry a second `URL` arg pointing at a local + // file we should also `authorizePath`. + if receiverTypeName == "URLSession" { + // First arg: URL → network gate; URLRequest → network gate + // via embedded URL + method. + appendIfPathish(0, kind: .network) + appendIfURLRequestish(0) + // Second arg: a `fromFile:` URL is a real local file the + // session reads to upload — gate as `.fsRead`. The first arg + // already handled the network policy; this one closes the + // file-read door for upload-from-file overloads. + appendIfPathish(1, kind: .fsRead) + } + + return directives +} + +/// Identity-leaking property reads on `ProcessInfo` / `Bundle` / +/// `FileManager` get redirected to the bound shell's `HostInfo` / +/// `Environment` / `scriptName`. Returns the substitute call +/// expression (a string that produces a Swift value of the same +/// declared type) when the receiver/member match, or `nil` to leave +/// the bridge untouched. +/// +/// The redirected expressions are top-level helpers from +/// `HostHooks.swift` — `hostUserName()`, `hostEnvironment()`, etc. +/// — that read `ShellKit.Shell.current` directly. Standalone +/// (`swift-script` CLI without an embedder) the helpers see +/// `Shell.processDefault` which mirrors the real OS values, so the +/// binary's behaviour is unchanged. +func redirectedPropertyCall(receiver: String, member: String) -> String? { + switch (receiver, member) { + case ("ProcessInfo", "userName"): return "hostUserName()" + case ("ProcessInfo", "fullUserName"): return "hostFullUserName()" + case ("ProcessInfo", "hostName"): return "hostNameOverride()" + case ("ProcessInfo", "processIdentifier"): return "hostProcessIdentifier()" + case ("ProcessInfo", "processName"): return "hostProcessName()" + case ("ProcessInfo", "environment"): return "hostEnvironment()" + case ("ProcessInfo", "arguments"): return "hostProcessArguments()" + // FileManager.currentDirectoryPath is the shell's logical cwd — + // route through the bound environment so `cd /foo` from a + // bash script is observable from a SwiftScript script in the + // same Shell. + case ("FileManager", "currentDirectoryPath"): + return "ShellKit.Shell.current.environment.workingDirectory" + default: + return nil + } +} + +/// Render the prologue lines that bind the gated args to local names +/// and call the authorizer. Returns `(prologue, callExprRewriter)` +/// — the rewriter takes the original `unboxedCallArgs` string and +/// substitutes the bound names in for the gated positions. +func renderGates( + _ directives: [GateDirective], + sig: ResolvedSignature, + indent: String +) -> (prologue: [String], callArgs: String, anyAsync: Bool) { + guard !directives.isEmpty else { + return ([], unboxedCallArgs(for: sig), false) + } + var prologue: [String] = [] + let directivesByIndex: [Int: GateDirective] = + Dictionary(uniqueKeysWithValues: directives.map { ($0.argIndex, $0) }) + // Bind each gated arg to its bound name. Non-gated args are left + // inline in the call args (built below). + for d in directives { + let unbox: String + switch d.argSwiftType { + case "String": + unbox = "try unboxString(args[\(d.argIndex)])" + case "URL": + unbox = "try unboxOpaque(args[\(d.argIndex)], as: URL.self, typeName: \"URL\")" + case "URLRequest": + unbox = "try unboxOpaque(args[\(d.argIndex)], as: URLRequest.self, typeName: \"URLRequest\")" + default: + // Should be rejected by `gates(...)` above. + unbox = "try unboxString(args[\(d.argIndex)])" + } + prologue.append("\(indent)let \(d.boundName) = \(unbox)") + // Wrap the authorize call in a do/catch that re-throws the + // sandbox denial (or any other gate error) as a + // `UserThrowSignal`. Without the wrap, Foundation-side + // errors like `Sandbox.Denial` propagate as raw Swift errors + // — script-side `do { … } catch { }` can't see them, and + // hosts get an opaque error rather than the typed thrown + // value the rest of the bridge ABI uses. + let authorizeCall: String + switch d.kind { + case .fsRead: + authorizeCall = "try await authorizePath(\(d.boundName), for: .read)" + case .fsWrite: + authorizeCall = "try await authorizePath(\(d.boundName), for: .write)" + case .fsDelete: + authorizeCall = "try await authorizePath(\(d.boundName), for: .delete)" + case .network: + // Network gate is `URL`-only — `String` URLs are out of + // scope here (no async URL parser available); embedders + // who care about that path can layer their own check. + if d.argSwiftType == "URL" { + authorizeCall = "try await authorizeURL(\(d.boundName))" + } else { + continue + } + case .networkRequest: + // URLRequest carries the URL + method inline. A request + // built from a relative URL has `.url == nil`; we treat + // that as an unauthorisable empty-URL (the network + // policy will deny it explicitly rather than silently + // skipping the gate). + authorizeCall = "try await authorizeURL(\(d.boundName).url ?? URL(fileURLWithPath: \"\"), method: \(d.boundName).httpMethod ?? \"GET\")" + } + prologue.append("\(indent)do {") + prologue.append("\(indent) \(authorizeCall)") + prologue.append("\(indent)} catch {") + prologue.append("\(indent) throw UserThrowSignal(value: .opaque(typeName: \"Error\", value: error))") + prologue.append("\(indent)}") + } + // Rebuild the call-args string: gated positions use the bound + // name, ungated positions keep their inline `try unbox…`. + let unboxed = sig.parameters.enumerated().map { (i, p) -> String in + if let d = directivesByIndex[i] { + return d.boundName + } + return render(p.type.unboxTemplate, "args[\(i)]") + } + let callArgs = zip(sig.parameters, unboxed) + .map { (p, u) in (p.label == "_" ? "" : "\(p.label): ") + u } + .joined(separator: ", ") + return (prologue, callArgs, true) +} + // MARK: - Unified closure-emit helper // // The five callable kinds (`swift.func`, `swift.method`, `swift.init`, @@ -694,6 +980,12 @@ struct EmitConfig { let isThrowing: Bool let isAsync: Bool let tupleElements: [BridgedType] + /// Extra body lines emitted between the receiver unbox and the + /// call expression. Used by the sandbox/network gating policy + /// (see `gates(...)` and `renderGates(...)`) to bind path args + /// and call `authorizePath` / `authorizeURL` before touching + /// disk or the network. + var prologue: [String] = [] } /// Render a runtime-time call: `i. { in }`. @@ -717,6 +1009,9 @@ func renderRuntimeEmit(_ c: EmitConfig) -> String { if let recv = c.recvUnboxLine { bodyLines.append(" \(recv)") } + for line in c.prologue { + bodyLines.append(line) + } bodyLines.append(" \(returnExpr)") return """ \(c.registerLine) { \(c.closureParams) in @@ -746,6 +1041,9 @@ func renderEmit(_ c: EmitConfig) -> String { if let recv = c.recvUnboxLine { bodyLines.append(" \(recv)") } + for line in c.prologue { + bodyLines.append(line) + } bodyLines.append(" \(returnExpr)") return """ \(c.registerLine) { \(c.closureParams) in @@ -800,11 +1098,42 @@ func isVarMutable(_ sym: SymbolGraph.Symbol) -> Bool { } /// True for `@available(*, deprecated)`, `unavailable`, or symbols -/// introduced after our deployment target. The deployment target lives -/// in `Package.swift` (macOS 26 today); we bake it in here to keep the -/// generator self-contained. -let deploymentMacOSMajor = 26 +/// introduced after our deployment target on any of the bridged +/// Apple platforms. The deployment targets live in `Package.swift` +/// (today: macOS 13 / iOS 16 / tvOS 16 / watchOS 9 — the SwiftBash +/// floor); we bake them in here to keep the generator self- +/// contained. +/// +/// All four platform floors are checked independently — a symbol +/// introduced in iOS 16.1 on top of a macOS 13.0 conformance still +/// fails to link on iOS 16.0, so the iOS check has to fire even +/// when the macOS check passes. +/// +/// Lowering any of these skips any Foundation symbol whose +/// `introduced` major version is higher than the floor, so the +/// generated bridges link cleanly on every platform SwiftBash +/// supports. The scl oracle continues to gate Apple-only entries +/// behind `#if canImport(Darwin)` independently. +let deploymentMacOSMajor = 13 let deploymentMacOSMinor = 0 +let deploymentIOSMajor = 16 +let deploymentIOSMinor = 0 +let deploymentTVOSMajor = 16 +let deploymentTVOSMinor = 0 +let deploymentWatchOSMajor = 9 +let deploymentWatchOSMinor = 0 + +/// `(major, minor)` deployment floor for `domain`, or `nil` for +/// non-platform domains (`*`, `swift`). +private func deploymentFloor(forDomain domain: String) -> (Int, Int)? { + switch domain { + case "macOS": return (deploymentMacOSMajor, deploymentMacOSMinor) + case "iOS": return (deploymentIOSMajor, deploymentIOSMinor) + case "tvOS": return (deploymentTVOSMajor, deploymentTVOSMinor) + case "watchOS": return (deploymentWatchOSMajor, deploymentWatchOSMinor) + default: return nil + } +} func isDeprecated(_ sym: SymbolGraph.Symbol) -> Bool { guard let avail = sym.availability else { return false } @@ -815,29 +1144,30 @@ func isDeprecated(_ sym: SymbolGraph.Symbol) -> Bool { // "Soft-deprecated" symbols carry `deprecated: { major: 100000 }` — // a sentinel meaning "we'd like you to migrate, but the symbol // still compiles and runs". Only treat as deprecated if the - // version is below the sentinel. macOS-domain entries also gate - // on the deployment target so a future-macOS deprecation - // doesn't pre-emptively trip when building for an older OS. + // version is below the sentinel. Per-platform-domain entries + // gate on the deployment target so a future-platform + // deprecation doesn't pre-emptively trip when building for an + // older OS. if let dep = a.deprecated?.major { let softSentinel = 100000 if dep < softSentinel { - if a.domain == "macOS" { - if dep <= deploymentMacOSMajor { return true } + if let floor = deploymentFloor(forDomain: a.domain ?? "") { + if dep <= floor.0 { return true } } else { - // `swift`, `*`, and per-platform domains other than - // macOS — if the version says deprecated, swiftc - // emits the warning, so skip the bridge. + // `swift`, `*`, and unknown domains — if the + // version says deprecated, swiftc emits the + // warning, so skip the bridge. return true } } } - if a.domain == "macOS", + if let floor = deploymentFloor(forDomain: a.domain ?? ""), let major = a.introduced?.major { - if major > deploymentMacOSMajor { return true } - if major == deploymentMacOSMajor, + if major > floor.0 { return true } + if major == floor.0, let minor = a.introduced?.minor, - minor > deploymentMacOSMinor + minor > floor.1 { return true } @@ -1447,18 +1777,27 @@ for annotated in prioritizedSymbols { let key = "method:\(receiverTypeName).\(methodName)" if !claim(key, clashLabel: "\(receiverTypeName).\(methodName)") { continue } let recvUnbox = render(recvType.unboxTemplate, "receiver") + let methodGates = gates( + forReceiver: receiverTypeName, + methodName: methodName, + signature: sig) + let methodGated = renderGates(methodGates, sig: sig, indent: " ") record(key, bucket: .type(receiverTypeName), code: renderEmit(EmitConfig( registerLine: "\"func \(receiverTypeName).\(methodName)()\": .method", closureParams: "receiver, args", arity: sig.parameters.count, recvUnboxLine: "let recv: \(recvType.swiftSpelling) = \(recvUnbox)", - callExpr: "recv.\(methodName)(\(unboxedCallArgs(for: sig)))", + callExpr: "recv.\(methodName)(\(methodGated.callArgs))", errorPrefix: "\(receiverTypeName).\(methodName)", returnType: sig.returnType, isOptional: sig.returnIsOptional, isThrowing: isThrowing(sym), - isAsync: isAsync(sym), - tupleElements: sig.returnTupleElements + // Sandbox/network gates use `await` on the bound shell's + // `Sandbox.authorize(_:)`, so any gated bridge becomes + // async even if the underlying Swift call is sync. + isAsync: isAsync(sym) || methodGated.anyAsync, + tupleElements: sig.returnTupleElements, + prologue: methodGated.prologue ))) case "swift.init" where (2...3).contains(sym.pathComponents.count) && !isDeprecated(sym) && !isGeneric(sym) && !isAsync(sym): @@ -1484,18 +1823,29 @@ for annotated in prioritizedSymbols { } let labelDoc = labels.isEmpty ? "" : labels.map { "\($0):" }.joined() let initKey = "init \(receiverTypeName)(\(labelDoc))" + // Inits like `String(contentsOfFile:)` and `Data(contentsOf:)` + // hit disk; route them through `authorizePath` exactly like + // a method on the same type. + let initMethodName = labels.first + let initGates = gates( + forReceiver: nil, + methodName: initMethodName, + initFor: receiverTypeName, + signature: sig) + let initGated = renderGates(initGates, sig: sig, indent: " ") record(key, bucket: .type(receiverTypeName), code: renderEmit(EmitConfig( registerLine: "\"\(initKey)\": .`init`", closureParams: "args", arity: sig.parameters.count, recvUnboxLine: nil, - callExpr: "\(receiverTypeName)(\(unboxedCallArgs(for: sig)))", + callExpr: "\(receiverTypeName)(\(initGated.callArgs))", errorPrefix: initKey, returnType: recvType, isOptional: failable, isThrowing: isThrowing(sym), - isAsync: isAsync(sym), - tupleElements: [] + isAsync: isAsync(sym) || initGated.anyAsync, + tupleElements: [], + prologue: initGated.prologue ))) case "swift.property" where (2...3).contains(sym.pathComponents.count) && !isDeprecated(sym) && !isAsync(sym): @@ -1519,12 +1869,20 @@ for annotated in prioritizedSymbols { // assignment RHS (`.prettyPrinted` against the property's // declared `JSONEncoder.OutputFormatting`). let propTypeSpelling = propType.bridge.swiftSpelling + (propType.isOptional ? "?" : "") + // Identity-leaking ProcessInfo / Bundle properties get + // redirected to the shell's `HostInfo` / `Environment` / + // `scriptName` so a sandboxed embedder doesn't fingerprint + // the host. Swap the call expression and drop the receiver + // unbox where the redirect doesn't need it. + let redirected = redirectedPropertyCall( + receiver: receiverTypeName, member: memberName) record(key, bucket: .type(receiverTypeName), code: renderEmit(EmitConfig( registerLine: "\"var \(receiverTypeName).\(memberName): \(propTypeSpelling)\": .computed", - closureParams: "receiver", + closureParams: redirected != nil ? "_" : "receiver", arity: nil, - recvUnboxLine: "let recv: \(recvType.swiftSpelling) = \(recvUnbox)", - callExpr: "recv.\(memberName)", + recvUnboxLine: redirected != nil ? nil + : "let recv: \(recvType.swiftSpelling) = \(recvUnbox)", + callExpr: redirected ?? "recv.\(memberName)", errorPrefix: "\(receiverTypeName).\(memberName)", returnType: propType.bridge, isOptional: propType.isOptional, @@ -1787,6 +2145,21 @@ for (usr, bridge) in bridgedTypes { registeredKeys.insert(claimKey) } +// Types whose `Comparable` conformance arrives after our deployment +// floor — the conformance declaration itself carries `@available(macOS X)` +// and the symbol-graph relationship metadata doesn't surface that +// gating, so we maintain it by hand here. Update when the floor moves. +// +// Bake-by-bake: whenever a regen at the current floor fails with +// "conformance of X to Comparable is only available in macOS Y or +// newer", add the spelling here. The fallback (`Equatable`-only) +// still lets scripts compare with `==`; ordering becomes a no-op. +let comparableUnavailableAtFloor: Set = [ + // UUID gets `Comparable` at macOS 14 / iOS 17 (FB-IDs in + // Apple's release notes for Foundation 2023). + "UUID", +] + // Emit `registerComparator` calls for every bridged opaque type that // conforms to `Equatable` (and use `<`/`>` ordering for those that also // conform to `Comparable`). Lets script code write `dateA < dateB`, @@ -1797,6 +2170,7 @@ for (usr, bridge) in bridgedTypes { let conformances = conformancesByUSR[usr] ?? [] guard conformances.contains(equatableUSR) else { continue } let isComparable = conformances.contains(comparableUSR) + && !comparableUnavailableAtFloor.contains(bridge.swiftSpelling) let typeName = bridge.swiftSpelling let body: String if isComparable { @@ -1952,6 +2326,7 @@ func renderPerTypeFile( let body = allEntries.isEmpty ? " // (no entries)" : allEntries return """ \(autogenBanner)import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif @@ -1980,6 +2355,7 @@ func renderPerTypeFile( if entries.crossPlatform.isEmpty { return """ \(autogenBanner)import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif @@ -1992,6 +2368,7 @@ func renderPerTypeFile( } return """ \(autogenBanner)import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif @@ -2012,6 +2389,7 @@ func renderPerTypeFile( : " var d: [String: Bridge] = [\n\(entries.crossPlatform.joined(separator: "\n"))\n ]" return """ \(autogenBanner)import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif @@ -2046,6 +2424,7 @@ func renderManifest( : runtimeBodies.joined(separator: "\n\n") return """ \(autogenBanner)import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/API/HostHooks.swift b/Sources/SwiftScriptInterpreter/API/HostHooks.swift new file mode 100644 index 0000000..5c41d44 --- /dev/null +++ b/Sources/SwiftScriptInterpreter/API/HostHooks.swift @@ -0,0 +1,187 @@ +import Foundation +import ShellKit + +// MARK: - Host hooks for sandboxing +// +// SwiftScript runs against `ShellKit.Shell.current` so embedders can +// confine script I/O without forking the bridge generator. The +// auto-generated Foundation bridges (FileManager, URLSession, +// ProcessInfo) and the hand-rolled ones (`String.write(to:)`, +// `Data(contentsOf:)`, …) call into these top-level functions before +// touching disk / network / identity. +// +// Default behaviour: each gate reads from +// ``ShellKit/Shell/current``. An embedder that wants confinement just +// constructs a ``ShellKit/Shell`` with a `sandbox` / `networkConfig` +// / `hostInfo` and binds it via ``ShellKit/Shell/withCurrent(_:)``. +// Standalone (`swift-script` CLI) sees ``ShellKit/Shell/processDefault`` +// — `nil` sandbox, no network policy, real `HostInfo` — so the gates +// are no-ops and the binary behaves as it always did. + +// MARK: Filesystem + +/// Hint about why a path is being authorized. Embedders may use the +/// kind to apply different rules per intent (e.g. allow read-only +/// access to system frameworks but deny writes). +public enum PathAccessIntent: Sendable { + case read + case write + case delete +} + +/// Authorize a filesystem access against the bound shell's sandbox. +/// +/// Throws ``ShellKit/Sandbox/Denial`` (rethrown as a +/// ``UserThrowSignal`` from the bridge wrapper) when the bound +/// sandbox rejects the path. Returns silently when no sandbox is +/// bound. +@inlinable +public func authorizePath( + _ path: String, + for intent: PathAccessIntent = .read +) async throws { + _ = intent // reserved for future per-intent rules + guard let sandbox = ShellKit.Shell.current.sandbox else { return } + try await sandbox.authorize(URL(fileURLWithPath: path)) +} + +/// URL-form variant for bridges that get a `URL` arg rather than a +/// path string. Foundation URL types include both `file://` and +/// scheme-bearing URLs; the same `Sandbox.authorize(_:)` handles +/// both. +@inlinable +public func authorizePath( + _ url: URL, + for intent: PathAccessIntent = .read +) async throws { + _ = intent + guard let sandbox = ShellKit.Shell.current.sandbox else { return } + try await sandbox.authorize(url) +} + +// MARK: Network + +/// Authorize a network access against the bound shell's `sandbox` +/// host gate and `networkConfig` allow-list. +/// +/// Throws when either policy denies the URL/method. Returns silently +/// when neither is configured (the standalone-CLI passthrough). +@inlinable +public func authorizeURL( + _ url: URL, + method: String = "GET" +) async throws { + if let sandbox = ShellKit.Shell.current.sandbox { + try await sandbox.authorize(url) + } + if let config = ShellKit.Shell.current.networkConfig { + try config.checkAllowed(url: url, method: method) + } +} + +// MARK: Identity + +/// Synthetic user-name override — script-side `ProcessInfo +/// .processInfo.userName` reads this. Standalone mode reports the +/// real OS account; under an embedder it reflects the bound +/// `HostInfo.userName`. +@inlinable +public func hostUserName() -> String { + ShellKit.Shell.current.hostInfo.userName +} + +/// Synthetic full-user-name. ShellKit's `HostInfo` doesn't carry a +/// distinct GECOS field so we surface `userName` here too — embedders +/// that care can layer richer identity on top. +@inlinable +public func hostFullUserName() -> String { + ShellKit.Shell.current.hostInfo.userName +} + +/// Synthetic host-name — `ProcessInfo.processInfo.hostName`. +@inlinable +public func hostNameOverride() -> String { + ShellKit.Shell.current.hostInfo.hostName +} + +/// Synthetic process identifier — `ProcessInfo.processInfo +/// .processIdentifier` reads `Shell.virtualPID`, which defaults to +/// 1 under a sandbox embedder and to the real PID under +/// `Shell.processDefault`. +@inlinable +public func hostProcessIdentifier() -> Int32 { + ShellKit.Shell.current.virtualPID +} + +/// Synthetic process name — falls back to the script's `$0` +/// (`Shell.scriptName`) so a running script that introspects +/// `ProcessInfo.processInfo.processName` sees the file it's +/// executing, not the embedder's binary. +@inlinable +public func hostProcessName() -> String { + let name = ShellKit.Shell.current.scriptName + if !name.isEmpty { return name } + // Last-resort fallback for the synthetic-identity case where + // an embedder constructs a Shell without setting scriptName. + return ShellKit.Shell.current.hostInfo.userName +} + +/// Synthetic environment dict — `ProcessInfo.processInfo +/// .environment`. Routed through ``ShellKit/Shell/current``'s +/// `Environment` so a script that reads its own env sees what the +/// embedder set, not the host process's actual env. +@inlinable +public func hostEnvironment() -> [String: String] { + ShellKit.Shell.current.environment.variables +} + +/// Synthetic argv — `ProcessInfo.processInfo.arguments`. Mirrors +/// the same source `CommandLine.arguments` reads from. See +/// ``Interpreter/scriptArguments`` for the full layering. +@inlinable +public func hostProcessArguments() -> [String] { + let shell = ShellKit.Shell.current + var assembled = [shell.scriptName] + assembled.append(contentsOf: shell.positionalParameters) + if assembled == [""] { return [] } + return assembled +} + +// MARK: NetworkConfig allow-list helper + +extension ShellKit.NetworkConfig { + /// Throw when this `NetworkConfig` denies access to `url` / + /// `method`. Mirrors the policy SwiftBash's `curl` builtin + /// applies. Pulled out as a method here so the SwiftScript + /// network bridges can share the same enforcement. + @usableFromInline + func checkAllowed(url: URL, method: String) throws { + if dangerouslyAllowFullInternetAccess { return } + // Method gate. + let normalised = method.uppercased() + let knownMethod = HTTPMethod(rawValue: normalised) ?? .GET + if !allowedMethods.contains(knownMethod) { + throw NetworkAccessDenied( + url: url, + reason: "HTTP method \(normalised) not in allow-list") + } + // URL allow-list — ShellKit's matcher applies the same + // wildcard / origin-only / path-scoped semantics SwiftBash + // uses for `curl`. + let allowed = URLAllowList.isAllowed( + url.absoluteString, + entries: allowedURLPrefixes) + guard allowed else { + throw NetworkAccessDenied( + url: url, reason: "URL not in allow-list") + } + } + + public struct NetworkAccessDenied: Error, CustomStringConvertible { + public let url: URL + public let reason: String + public var description: String { + "Network access denied: \(reason): \(url.absoluteString)" + } + } +} diff --git a/Sources/SwiftScriptInterpreter/API/Interpreter.swift b/Sources/SwiftScriptInterpreter/API/Interpreter.swift index b1628d3..f0baac2 100644 --- a/Sources/SwiftScriptInterpreter/API/Interpreter.swift +++ b/Sources/SwiftScriptInterpreter/API/Interpreter.swift @@ -1,5 +1,6 @@ import SwiftSyntax import SwiftScriptAST +import ShellKit /// `@unchecked Sendable`: the interpreter holds extensive mutable state /// (scopes, bridge tables, struct/class/enum defs) and is **not** @@ -12,8 +13,27 @@ import SwiftScriptAST /// the same logical owner. public final class Interpreter: @unchecked Sendable { public let rootScope: Scope + + /// Where script-emitted text goes — every `print`, `dump`, and + /// any other stdout-style write. The closure receives the + /// **verbatim** bytes the script wrote, including any trailing + /// newline `print` chose to add. Set this to capture or redirect. + /// + /// **Default behaviour** routes through ``ShellKit/Shell/current``'s + /// stdout sink. Standalone (`swift-script foo.swift`) that means + /// real fd 1 (`Shell.processDefault.stdout`); under an embedder + /// (SwiftBash, an iOS app) it means whatever sink the embedder + /// has bound for the current task. Same code path, different + /// destinations — no separate plumbing needed for capture. public var output: (String) -> Void + /// Where parse errors and runtime-error renders go — the + /// stderr-shaped channel. Same verbatim-text contract as + /// ``output``. Defaults to ``ShellKit/Shell/current``'s stderr + /// sink so embedder capture / sandbox routing works out of + /// the box. + public var error: (String) -> Void + /// Stack of declared return types for the currently-active user function /// calls. Used by `return` statements (and implicit returns) to coerce /// the produced value against the function's declared return type. @@ -74,10 +94,22 @@ public final class Interpreter: @unchecked Sendable { /// `register(module:)` idempotent. var registeredModules: Set = [] - /// Script-side `CommandLine.arguments`. Populated by the host - /// (`swift-script` main) before evaluation; index 0 is the script - /// path or `` sentinel, followed by any positional - /// arguments the user passed on the CLI. + /// Script-side `CommandLine.arguments`. Three ways for a host to + /// supply this, checked in order at the start of each ``eval(_:fileName:)``: + /// + /// 1. **Explicit** — set this property directly. Useful for tests + /// or embedders that want to override host argv. Index 0 is the + /// script path / `` sentinel; indices 1+ are the + /// user-supplied positional arguments. + /// 2. **From the bound shell** — leave this empty and bind a + /// `ShellKit.Shell` whose `scriptName` + `positionalParameters` + /// describe the script's argv. SwiftBash's shebang dispatch + /// sets these on the subshell it constructs for the script, + /// so `CommandLine.arguments[0]` becomes the script path + /// automatically. + /// 3. **Process default** — neither of the above. Falls through to + /// `Shell.processDefault`, which mirrors `ProcessInfo.processInfo + /// .arguments`. That's the standalone-CLI path. public var scriptArguments: [String] = [] /// Modules whose import name (`Foundation`, `Darwin`, …) has appeared @@ -131,9 +163,27 @@ public final class Interpreter: @unchecked Sendable { var currentSourceFile: SourceFileSyntax? var currentFileName: String? - public init(output: @escaping (String) -> Void = { Swift.print($0) }) { + /// Construct an interpreter. + /// + /// Without arguments, output and error route through + /// ``ShellKit/Shell/current`` so the same code does the right + /// thing both standalone and under an embedder. Tests that need + /// to capture override `output:` / `error:` directly. + /// + /// **Output contract.** Both closures receive the **verbatim** + /// bytes the script emitted, including any trailing newline + /// `print(_:terminator:)` chose to add. (This is a deliberate + /// change from earlier SwiftScript versions, where `output` + /// took a newline-less line and the closure was expected to add + /// the terminator — a contract that prevented routing + /// `print(x, terminator: "")` correctly.) + public init( + output: @escaping (String) -> Void = { ShellKit.Shell.current.stdout($0) }, + error: @escaping (String) -> Void = { ShellKit.Shell.current.stderr($0) } + ) { self.rootScope = Scope() self.output = output + self.error = error registerBuiltins() } @@ -144,6 +194,15 @@ public final class Interpreter: @unchecked Sendable { /// or `.void` if there were no expressions. @discardableResult public func eval(_ source: String, fileName: String = "") async throws -> Value { + // Refresh `CommandLine.arguments` from whichever of + // {scriptArguments, Shell.current.scriptName + + // positionalParameters, Shell.processDefault} is populated. + // Done on every eval so a single Interpreter instance can run + // multiple scripts with different argv (rare, but the + // alternative — relying on the host to register the bridge by + // hand — is the leakage that motivated this whole refactor). + bindCommandLineArguments() + let result = ScriptParser.parse(source, fileName: fileName) currentSourceFile = result.sourceFile currentFileName = fileName @@ -159,6 +218,50 @@ public final class Interpreter: @unchecked Sendable { } return last } + + /// Like ``eval(_:fileName:)`` but tailored for whole-script + /// execution: catches ``ScriptExit`` thrown by `exit(_:)` / + /// `abort()` and converts it into the returned ``ShellKit/ExitStatus``. + /// Anything else (parse error, runtime error) propagates. + /// + /// Hosts that want to honor `exit(N)` from script use this in + /// place of `eval`; existing callers that consume the last- + /// expression value keep using `eval` and handle `ScriptExit` + /// themselves if they care. + public func evalScript( + _ source: String, + fileName: String = "" + ) async throws -> ExitStatus { + do { + _ = try await eval(source, fileName: fileName) + return .success + } catch let exit as ScriptExit { + return exit.status + } + } + + /// Resolve the script's `CommandLine.arguments` from the layered + /// sources documented on ``scriptArguments`` and register the + /// resulting array as a static-value bridge. Called from + /// ``eval(_:fileName:)`` immediately before parsing. + private func bindCommandLineArguments() { + let argv: [String] + if !scriptArguments.isEmpty { + argv = scriptArguments + } else { + // Pull from the active `ShellKit.Shell`. `scriptName` ends + // up as argv[0]; positional parameters fill 1+. Fallback + // to an empty argv only if both are empty (the very-edge + // case where an embedder built a Shell from scratch + // without arguments). + let shell = ShellKit.Shell.current + var assembled = [shell.scriptName] + assembled.append(contentsOf: shell.positionalParameters) + argv = assembled.first == "" && assembled.count == 1 ? [] : assembled + } + bridges["static let CommandLine.arguments"] = + .staticValue(.array(argv.map { .string($0) })) + } } /// Bag of members added to a built-in type via `extension Int { … }` etc. diff --git a/Sources/SwiftScriptInterpreter/API/ScriptExit.swift b/Sources/SwiftScriptInterpreter/API/ScriptExit.swift new file mode 100644 index 0000000..be21d7f --- /dev/null +++ b/Sources/SwiftScriptInterpreter/API/ScriptExit.swift @@ -0,0 +1,25 @@ +import ShellKit + +/// Thrown by the `exit(_:)` and `abort()` builtins to unwind the +/// interpreter back to the host. +/// +/// Caught at the eval boundary in ``Interpreter/evalScript(_:fileName:)``, +/// which converts it back into an ``ShellKit/ExitStatus`` the host +/// can return / propagate. ``Interpreter/eval(_:fileName:)`` lets it +/// propagate so callers that use the older `Value`-returning API see +/// the thrown signal directly. +/// +/// This type is `internal`-shaped on purpose: a script can't catch +/// `ScriptExit` from script-side `try / catch` because the dispatcher +/// rethrows past `do/catch` blocks (matching how Swift's own `exit` +/// is unrecoverable from inside the running program). Hosts catch it +/// at the very edge. +public struct ScriptExit: Error, Sendable, CustomStringConvertible { + public let status: ExitStatus + public init(status: ExitStatus) { self.status = status } + public init(_ code: Int32) { self.status = ExitStatus(code) } + + public var description: String { + "ScriptExit(\(status.code))" + } +} diff --git a/Sources/SwiftScriptInterpreter/Builtins/IOBuiltins.swift b/Sources/SwiftScriptInterpreter/Builtins/IOBuiltins.swift index e8ace12..5460803 100644 --- a/Sources/SwiftScriptInterpreter/Builtins/IOBuiltins.swift +++ b/Sources/SwiftScriptInterpreter/Builtins/IOBuiltins.swift @@ -1,3 +1,6 @@ +import Foundation +import ShellKit + extension Interpreter { func registerIOBuiltins() { registerBuiltin(name: "print") { [weak self] args in @@ -8,7 +11,12 @@ extension Interpreter { // `print(x)` / `print(x, y)`. guard let self else { return .void } let parts = try await args.asyncMap { try await self.describe($0) } - self.output(parts.joined(separator: " ")) + // `output` receives verbatim bytes — append the default + // terminator here so a bare `print(x)` writes + // `"\n"`. The labelled form (`print(x, terminator:)`) + // is handled in `tryPrintCall` and passes its own + // terminator. + self.output(parts.joined(separator: " ") + "\n") return .void } @@ -21,7 +29,7 @@ extension Interpreter { guard let self else { return .void } guard let v = args.first else { return .void } let s = try await self.debugDescribe(v) - self.output("- " + s) + self.output("- " + s + "\n") // Real `dump` returns the value it was given, so chained // `let x = dump(expr)` works. return v @@ -88,8 +96,39 @@ extension Interpreter { else { msg = "fatal error" } throw RuntimeError.invalid("fatal error: \(msg)") } + // `exit(_:)` and `abort()` unwind the script back to the host. + // Routed via `ScriptExit` rather than the host's `Swift.exit` + // — that's the embedder's call (SwiftBash returns the code + // through `ExitStatus`, an iOS app may want to surface it as + // an in-app event). The standalone `swift-script` CLI catches + // and calls real `exit`. + registerBuiltin(name: "exit") { args in + let code: Int32 + if args.isEmpty { + code = 0 + } else if case .int(let i) = args[0] { + code = Int32(truncatingIfNeeded: i) + } else { + throw RuntimeError.invalid( + "exit: argument must be Int, got \(typeName(args[0]))") + } + throw ScriptExit(code) + } + registerBuiltin(name: "abort") { _ in + // Swift's `abort()` raises SIGABRT and exits 134 on Unix. + // We route the same conventional code through ScriptExit + // — there's no actual signal in-process. + throw ScriptExit(134) + } // `readLine()` reads a line from stdin, returns String? (nil on // EOF). `readLine(strippingNewline:)` mirrors the stdlib overload. + // + // Routes through `ShellKit.Shell.current.stdin` so embedders + // (SwiftBash pipelines, an iOS app feeding a fixed string) can + // supply input without hitting the host's real fd 0. Standalone + // `swift-script` mode resolves to `Shell.processDefault.stdin`, + // which wraps `FileHandle.standardInput`, so the binary's + // behaviour is unchanged. registerBuiltin(name: "readLine") { args in // Either no args, or a single bool with `strippingNewline` // semantics. Default is true (matches stdlib). @@ -100,10 +139,15 @@ extension Interpreter { } stripping = v } - if let line = Swift.readLine(strippingNewline: stripping) { - return .optional(.string(line)) + // `InputSource.readLine()` already strips the trailing `\n`. + // When `strippingNewline: false`, append it back unless we + // hit EOF on a final line that happened to lack a newline + // — Swift's stdlib readLine has no way to distinguish those + // cases either, so we don't try to. + guard let line = await ShellKit.Shell.current.stdin.readLine() else { + return .optional(nil) } - return .optional(nil) + return .optional(.string(stripping ? line : line + "\n")) } registerBuiltin(name: "String") { [weak self] args in diff --git a/Sources/SwiftScriptInterpreter/Builtins/Registry.swift b/Sources/SwiftScriptInterpreter/Builtins/Registry.swift index bf5efcb..66e9906 100644 --- a/Sources/SwiftScriptInterpreter/Builtins/Registry.swift +++ b/Sources/SwiftScriptInterpreter/Builtins/Registry.swift @@ -69,6 +69,20 @@ extension Interpreter { registerOnImport("Glibc", module: urlSessionModule) registerOnImport("ucrt", module: urlSessionModule) registerOnImport("WinSDK", module: urlSessionModule) + // ProcessInfo identity overrides — bridges that route + // `userName` / `processIdentifier` / `arguments` / + // `environment` through `ShellKit.Shell.current`'s + // `HostInfo` / `Environment` / `scriptName`. The generator + // already redirects the auto-discovered identity reads + // (`hostName`, `processName`); this module fills in the + // ones whose Swift type the generator can't bridge + // (`Int32`, `[String]`, `[String: String]`). + let identityModule = IdentityModule() + registerOnImport("Foundation", module: identityModule) + registerOnImport("Darwin", module: identityModule) + registerOnImport("Glibc", module: identityModule) + registerOnImport("ucrt", module: identityModule) + registerOnImport("WinSDK", module: identityModule) } func registerBuiltin(name: String, body: @escaping ([Value]) async throws -> Value) { diff --git a/Sources/SwiftScriptInterpreter/Execution/Interpreter+Calls.swift b/Sources/SwiftScriptInterpreter/Execution/Interpreter+Calls.swift index 85e34ab..9f81458 100644 --- a/Sources/SwiftScriptInterpreter/Execution/Interpreter+Calls.swift +++ b/Sources/SwiftScriptInterpreter/Execution/Interpreter+Calls.swift @@ -639,18 +639,14 @@ extension Interpreter { // style lookup) before falling back to Value's default. let parts = try await items.asyncMap { try await describe($0) } let body = parts.joined(separator: separator) - // The default-`output` closure adds its own newline (it wraps - // `Swift.print` in the binary, "$0 + \n" in tests). When the - // user's terminator is `\n` we route through `output` so test - // captures see it. For other terminators we go straight through - // `Swift.print`'s terminator parameter — same buffering as - // `output`'s underlying `Swift.print`, so ordering with sibling - // `print(...)` calls is preserved. - if terminator == "\n" { - output(body) - } else { - Swift.print(body, terminator: terminator) - } + // `output` receives verbatim bytes; append the user-chosen + // terminator so `print(x, terminator: "")` and + // `print(x, terminator: "|")` route through the same sink + // as a regular `print(x)`. Earlier versions bypassed `output` + // for non-`\n` terminators by calling `Swift.print` directly, + // which leaked to the host process's real fd 1 even when an + // embedder had bound a custom `output`. + output(body + terminator) return .void } diff --git a/Sources/SwiftScriptInterpreter/Execution/Interpreter+FileIO.swift b/Sources/SwiftScriptInterpreter/Execution/Interpreter+FileIO.swift index cb9dba1..51fbd0c 100644 --- a/Sources/SwiftScriptInterpreter/Execution/Interpreter+FileIO.swift +++ b/Sources/SwiftScriptInterpreter/Execution/Interpreter+FileIO.swift @@ -1,4 +1,5 @@ import Foundation +import ShellKit import SwiftSyntax extension Interpreter { @@ -14,6 +15,10 @@ extension Interpreter { /// regular `String(...)` builtin dispatch. Gated on Foundation import: /// without it, the path is dormant and the call falls through to the /// stdlib String builtin which will reject the labeled args. + /// + /// **Sandbox-aware**: routes the path through ``authorizePath(_:for:)`` + /// before reading from disk so an embedder's bound sandbox can deny + /// off-root access. func tryStringContentsOfFile(_ call: FunctionCallExprSyntax, in scope: Scope) async throws -> Value? { guard isImported(any: "Foundation", "Darwin", "Glibc", "ucrt", "WinSDK") else { return nil } guard let ref = call.calledExpression.as(DeclReferenceExprSyntax.self), @@ -30,6 +35,11 @@ extension Interpreter { guard case .string(let path) = pathValue else { throw RuntimeError.invalid("String(contentsOfFile:): path must be String") } + do { + try await authorizePath(path, for: .read) + } catch { + throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) + } do { let s = try String(contentsOfFile: path, encoding: .utf8) return .string(s) @@ -39,16 +49,22 @@ extension Interpreter { } /// Dispatch a method call on the `FileManager` singleton sentinel. + /// Each method authorises its path arg(s) against the bound shell's + /// sandbox before touching disk. func invokeFileManagerMethod(_ name: String, args: [Value]) async throws -> Value { switch name { case "fileExists": try expectStringArg(args, methodName: "FileManager.fileExists(atPath:)") if case .string(let path) = args[0] { + try await gatePath(path, for: .read, + methodName: "FileManager.fileExists(atPath:)") return .bool(FileManager.default.fileExists(atPath: path)) } case "contentsOfDirectory": try expectStringArg(args, methodName: "FileManager.contentsOfDirectory(atPath:)") if case .string(let path) = args[0] { + try await gatePath(path, for: .read, + methodName: "FileManager.contentsOfDirectory(atPath:)") do { let entries = try FileManager.default.contentsOfDirectory(atPath: path) return .array(entries.map { .string($0) }) @@ -59,6 +75,8 @@ extension Interpreter { case "removeItem": try expectStringArg(args, methodName: "FileManager.removeItem(atPath:)") if case .string(let path) = args[0] { + try await gatePath(path, for: .delete, + methodName: "FileManager.removeItem(atPath:)") do { try FileManager.default.removeItem(atPath: path) return .void @@ -77,6 +95,8 @@ extension Interpreter { "FileManager.createDirectory(atPath:withIntermediateDirectories:): bad args" ) } + try await gatePath(path, for: .write, + methodName: "FileManager.createDirectory(atPath:)") do { try FileManager.default.createDirectory( atPath: path, @@ -98,6 +118,9 @@ extension Interpreter { /// `encoding:` argument is typically `.utf8` — an implicit-member /// expression we can't otherwise resolve without `String.Encoding`. /// Gated on Foundation import. + /// + /// **Sandbox-aware**: the path arg is authorized for `.write` before + /// the `String.write(toFile:)` call. func tryStringWriteCall(_ call: FunctionCallExprSyntax, in scope: Scope) async throws -> Value? { guard isImported(any: "Foundation", "Darwin", "Glibc", "ucrt", "WinSDK") else { return nil } guard let memberAccess = call.calledExpression.as(MemberAccessExprSyntax.self), @@ -122,6 +145,8 @@ extension Interpreter { } // The third arg (encoding:) is intentionally ignored — we always // use UTF-8. + try await gatePath(path, for: .write, + methodName: "String.write(toFile:)") do { try s.write(toFile: path, atomically: atomically, encoding: .utf8) return .void @@ -138,4 +163,20 @@ extension Interpreter { throw RuntimeError.invalid("\(methodName): argument must be String") } } + + /// Shared sandbox-gate path used by every fast-path FileManager + /// dispatch. Wraps the denial as a `UserThrowSignal` so the call + /// site error path stays consistent with the auto-generated + /// bridges. + private func gatePath( + _ path: String, + for intent: PathAccessIntent, + methodName: String + ) async throws { + do { + try await authorizePath(path, for: intent) + } catch { + throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) + } + } } diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+AttributeContainer.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+AttributeContainer.swift index 581395b..75d867b 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+AttributeContainer.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+AttributeContainer.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif @@ -18,13 +19,6 @@ extension FoundationBridges { let recv: AttributeContainer = try unboxOpaque(receiver, as: AttributeContainer.self, typeName: "AttributeContainer") return .string(recv.description) }, - "func AttributeContainer.filter()": .method { receiver, args in - guard args.count == 1 else { - throw RuntimeError.invalid("AttributeContainer.filter: expected 1 argument(s), got \(args.count)") - } - let recv: AttributeContainer = try unboxOpaque(receiver, as: AttributeContainer.self, typeName: "AttributeContainer") - return boxOpaque(recv.filter(inheritedByAddedText: try unboxBool(args[0])), typeName: "AttributeContainer") - }, "func AttributeContainer.merging()": .method { receiver, args in guard args.count == 1 else { throw RuntimeError.invalid("AttributeContainer.merging: expected 1 argument(s), got \(args.count)") diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+AttributedString.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+AttributedString.swift index 823337f..9e4d96c 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+AttributedString.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+AttributedString.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+AttributedStringAttributeInvalidationCondition.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+AttributedStringAttributeInvalidationCondition.swift index d29ec28..0079543 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+AttributedStringAttributeInvalidationCondition.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+AttributedStringAttributeInvalidationCondition.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+AttributedStringFormattingOptions.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+AttributedStringFormattingOptions.swift index cb7a87d..195e989 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+AttributedStringFormattingOptions.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+AttributedStringFormattingOptions.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+AttributedStringInterpolationOptions.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+AttributedStringInterpolationOptions.swift index 14e0a61..255199f 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+AttributedStringInterpolationOptions.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+AttributedStringInterpolationOptions.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+AttributedStringMarkdownSourcePosition.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+AttributedStringMarkdownSourcePosition.swift index 53304b9..61f1a0e 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+AttributedStringMarkdownSourcePosition.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+AttributedStringMarkdownSourcePosition.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+AttributedStringRuns.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+AttributedStringRuns.swift index 29bbef1..431adbc 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+AttributedStringRuns.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+AttributedStringRuns.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+AttributedSubstring.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+AttributedSubstring.swift index 406e3c3..d9f948f 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+AttributedSubstring.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+AttributedSubstring.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ByteCountFormatStyle.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ByteCountFormatStyle.swift index 370f810..dffe7f6 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ByteCountFormatStyle.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ByteCountFormatStyle.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ByteCountFormatStyleAttributed.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ByteCountFormatStyleAttributed.swift index 5fc2b6e..f933a5b 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ByteCountFormatStyleAttributed.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ByteCountFormatStyleAttributed.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ByteCountFormatStyleUnits.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ByteCountFormatStyleUnits.swift index 39b2c9e..75ebddc 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ByteCountFormatStyleUnits.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ByteCountFormatStyleUnits.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ByteCountFormatterUnits.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ByteCountFormatterUnits.swift index 718f3ef..28137bc 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ByteCountFormatterUnits.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ByteCountFormatterUnits.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+Calendar.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+Calendar.swift index 1c73ca8..a3dc233 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+Calendar.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+Calendar.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+CalendarRecurrenceRule.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+CalendarRecurrenceRule.swift deleted file mode 100644 index afdb605..0000000 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+CalendarRecurrenceRule.swift +++ /dev/null @@ -1,64 +0,0 @@ -// AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. -// Regenerate with: bash Tools/regen-foundation-bridge.sh -import Foundation -#if canImport(FoundationNetworking) -import FoundationNetworking -#endif - -extension FoundationBridges { - nonisolated(unsafe) static let calendarRecurrenceRule: [String: Bridge] = { - var d: [String: Bridge] = [ - "var Calendar.RecurrenceRule.calendar: Calendar": .computed { receiver in - let recv: Calendar.RecurrenceRule = try unboxOpaque(receiver, as: Calendar.RecurrenceRule.self, typeName: "Calendar.RecurrenceRule") - return boxOpaque(recv.calendar, typeName: "Calendar") - }, - "var Calendar.RecurrenceRule.interval: Int": .computed { receiver in - let recv: Calendar.RecurrenceRule = try unboxOpaque(receiver, as: Calendar.RecurrenceRule.self, typeName: "Calendar.RecurrenceRule") - return .int(recv.interval) - }, - "static func Calendar.RecurrenceRule.weekly()": .staticMethod { args in - guard args.count == 2 else { - throw RuntimeError.invalid("Calendar.RecurrenceRule.weekly: expected 2 argument(s), got \(args.count)") - } - return boxOpaque(Calendar.RecurrenceRule.weekly(calendar: try unboxOpaque(args[0], as: Calendar.self, typeName: "Calendar"), interval: try unboxInt(args[1])), typeName: "Calendar.RecurrenceRule") - }, - "static func Calendar.RecurrenceRule.daily()": .staticMethod { args in - guard args.count == 2 else { - throw RuntimeError.invalid("Calendar.RecurrenceRule.daily: expected 2 argument(s), got \(args.count)") - } - return boxOpaque(Calendar.RecurrenceRule.daily(calendar: try unboxOpaque(args[0], as: Calendar.self, typeName: "Calendar"), interval: try unboxInt(args[1])), typeName: "Calendar.RecurrenceRule") - }, - "static func Calendar.RecurrenceRule.monthly()": .staticMethod { args in - guard args.count == 2 else { - throw RuntimeError.invalid("Calendar.RecurrenceRule.monthly: expected 2 argument(s), got \(args.count)") - } - return boxOpaque(Calendar.RecurrenceRule.monthly(calendar: try unboxOpaque(args[0], as: Calendar.self, typeName: "Calendar"), interval: try unboxInt(args[1])), typeName: "Calendar.RecurrenceRule") - }, - "static func Calendar.RecurrenceRule.minutely()": .staticMethod { args in - guard args.count == 2 else { - throw RuntimeError.invalid("Calendar.RecurrenceRule.minutely: expected 2 argument(s), got \(args.count)") - } - return boxOpaque(Calendar.RecurrenceRule.minutely(calendar: try unboxOpaque(args[0], as: Calendar.self, typeName: "Calendar"), interval: try unboxInt(args[1])), typeName: "Calendar.RecurrenceRule") - }, - "static func Calendar.RecurrenceRule.hourly()": .staticMethod { args in - guard args.count == 2 else { - throw RuntimeError.invalid("Calendar.RecurrenceRule.hourly: expected 2 argument(s), got \(args.count)") - } - return boxOpaque(Calendar.RecurrenceRule.hourly(calendar: try unboxOpaque(args[0], as: Calendar.self, typeName: "Calendar"), interval: try unboxInt(args[1])), typeName: "Calendar.RecurrenceRule") - }, - "static func Calendar.RecurrenceRule.yearly()": .staticMethod { args in - guard args.count == 2 else { - throw RuntimeError.invalid("Calendar.RecurrenceRule.yearly: expected 2 argument(s), got \(args.count)") - } - return boxOpaque(Calendar.RecurrenceRule.yearly(calendar: try unboxOpaque(args[0], as: Calendar.self, typeName: "Calendar"), interval: try unboxInt(args[1])), typeName: "Calendar.RecurrenceRule") - }, - ] - #if canImport(Darwin) - d["var Calendar.RecurrenceRule.hashValue: Int"] = .computed { receiver in - let recv: Calendar.RecurrenceRule = try unboxOpaque(receiver, as: Calendar.RecurrenceRule.self, typeName: "Calendar.RecurrenceRule") - return .int(recv.hashValue) - } - #endif - return d - }() -} diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+CharacterSet.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+CharacterSet.swift index 70bd659..9a2a6a9 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+CharacterSet.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+CharacterSet.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+CocoaError.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+CocoaError.swift index 89979f9..3a17990 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+CocoaError.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+CocoaError.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+CocoaErrorCode.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+CocoaErrorCode.swift index 5c18c14..d73a914 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+CocoaErrorCode.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+CocoaErrorCode.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+CodingUserInfoKey.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+CodingUserInfoKey.swift index 39f0a13..4e08495 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+CodingUserInfoKey.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+CodingUserInfoKey.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+CurrencyFormatStyleConfigurationPresentation.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+CurrencyFormatStyleConfigurationPresentation.swift index 892a98b..688acc5 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+CurrencyFormatStyleConfigurationPresentation.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+CurrencyFormatStyleConfigurationPresentation.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+CurrencyFormatStyleConfigurationSignDisplayStrategy.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+CurrencyFormatStyleConfigurationSignDisplayStrategy.swift index 5a12b22..8132632 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+CurrencyFormatStyleConfigurationSignDisplayStrategy.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+CurrencyFormatStyleConfigurationSignDisplayStrategy.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+Data.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+Data.swift index 8b9ac86..211116e 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+Data.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+Data.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif @@ -69,8 +70,14 @@ extension FoundationBridges { guard args.count == 1 else { throw RuntimeError.invalid("init Data(contentsOf:): expected 1 argument(s), got \(args.count)") } + let arg0 = try unboxOpaque(args[0], as: URL.self, typeName: "URL") do { - return boxOpaque(try Data(contentsOf: try unboxOpaque(args[0], as: URL.self, typeName: "URL")), typeName: "Data") + try await authorizePath(arg0, for: .read) + } catch { + throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) + } + do { + return boxOpaque(try await Data(contentsOf: arg0), typeName: "Data") } catch { throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) } @@ -80,8 +87,14 @@ extension FoundationBridges { throw RuntimeError.invalid("Data.write: expected 1 argument(s), got \(args.count)") } let recv: Data = try unboxOpaque(receiver, as: Data.self, typeName: "Data") + let arg0 = try unboxOpaque(args[0], as: URL.self, typeName: "URL") + do { + try await authorizePath(arg0, for: .write) + } catch { + throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) + } do { - try recv.write(to: try unboxOpaque(args[0], as: URL.self, typeName: "URL")) + try await recv.write(to: arg0) return .void } catch { throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+Date.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+Date.swift index 46b972a..44be50c 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+Date.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+Date.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateAnchoredRelativeFormatStyle.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateAnchoredRelativeFormatStyle.swift deleted file mode 100644 index b7a5e51..0000000 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateAnchoredRelativeFormatStyle.swift +++ /dev/null @@ -1,76 +0,0 @@ -// AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. -// Regenerate with: bash Tools/regen-foundation-bridge.sh -import Foundation -#if canImport(FoundationNetworking) -import FoundationNetworking -#endif - -extension FoundationBridges { - nonisolated(unsafe) static let dateAnchoredRelativeFormatStyle: [String: Bridge] = { - var d: [String: Bridge] = [ - "var Date.AnchoredRelativeFormatStyle.anchor: Date": .computed { receiver in - let recv: Date.AnchoredRelativeFormatStyle = try unboxOpaque(receiver, as: Date.AnchoredRelativeFormatStyle.self, typeName: "Date.AnchoredRelativeFormatStyle") - return boxOpaque(recv.anchor, typeName: "Date") - }, - "var Date.AnchoredRelativeFormatStyle.capitalizationContext: FormatStyleCapitalizationContext": .computed { receiver in - let recv: Date.AnchoredRelativeFormatStyle = try unboxOpaque(receiver, as: Date.AnchoredRelativeFormatStyle.self, typeName: "Date.AnchoredRelativeFormatStyle") - return boxOpaque(recv.capitalizationContext, typeName: "FormatStyleCapitalizationContext") - }, - "var Date.AnchoredRelativeFormatStyle.locale: Locale": .computed { receiver in - let recv: Date.AnchoredRelativeFormatStyle = try unboxOpaque(receiver, as: Date.AnchoredRelativeFormatStyle.self, typeName: "Date.AnchoredRelativeFormatStyle") - return boxOpaque(recv.locale, typeName: "Locale") - }, - "var Date.AnchoredRelativeFormatStyle.calendar: Calendar": .computed { receiver in - let recv: Date.AnchoredRelativeFormatStyle = try unboxOpaque(receiver, as: Date.AnchoredRelativeFormatStyle.self, typeName: "Date.AnchoredRelativeFormatStyle") - return boxOpaque(recv.calendar, typeName: "Calendar") - }, - "func Date.AnchoredRelativeFormatStyle.format()": .method { receiver, args in - guard args.count == 1 else { - throw RuntimeError.invalid("Date.AnchoredRelativeFormatStyle.format: expected 1 argument(s), got \(args.count)") - } - let recv: Date.AnchoredRelativeFormatStyle = try unboxOpaque(receiver, as: Date.AnchoredRelativeFormatStyle.self, typeName: "Date.AnchoredRelativeFormatStyle") - return .string(recv.format(try unboxOpaque(args[0], as: Date.self, typeName: "Date"))) - }, - "func Date.AnchoredRelativeFormatStyle.locale()": .method { receiver, args in - guard args.count == 1 else { - throw RuntimeError.invalid("Date.AnchoredRelativeFormatStyle.locale: expected 1 argument(s), got \(args.count)") - } - let recv: Date.AnchoredRelativeFormatStyle = try unboxOpaque(receiver, as: Date.AnchoredRelativeFormatStyle.self, typeName: "Date.AnchoredRelativeFormatStyle") - return boxOpaque(recv.locale(try unboxOpaque(args[0], as: Locale.self, typeName: "Locale")), typeName: "Date.AnchoredRelativeFormatStyle") - }, - "func Date.AnchoredRelativeFormatStyle.discreteInput()": .method { receiver, args in - guard args.count == 1 else { - throw RuntimeError.invalid("Date.AnchoredRelativeFormatStyle.discreteInput: expected 1 argument(s), got \(args.count)") - } - let recv: Date.AnchoredRelativeFormatStyle = try unboxOpaque(receiver, as: Date.AnchoredRelativeFormatStyle.self, typeName: "Date.AnchoredRelativeFormatStyle") - if let _v = recv.discreteInput(before: try unboxOpaque(args[0], as: Date.self, typeName: "Date")) { - return .optional(boxOpaque(_v, typeName: "Date")) - } - return .optional(nil) - }, - "func Date.AnchoredRelativeFormatStyle.input()": .method { receiver, args in - guard args.count == 1 else { - throw RuntimeError.invalid("Date.AnchoredRelativeFormatStyle.input: expected 1 argument(s), got \(args.count)") - } - let recv: Date.AnchoredRelativeFormatStyle = try unboxOpaque(receiver, as: Date.AnchoredRelativeFormatStyle.self, typeName: "Date.AnchoredRelativeFormatStyle") - if let _v = recv.input(before: try unboxOpaque(args[0], as: Date.self, typeName: "Date")) { - return .optional(boxOpaque(_v, typeName: "Date")) - } - return .optional(nil) - }, - "init Date.AnchoredRelativeFormatStyle(anchor:locale:calendar:capitalizationContext:)": .`init` { args in - guard args.count == 4 else { - throw RuntimeError.invalid("init Date.AnchoredRelativeFormatStyle(anchor:locale:calendar:capitalizationContext:): expected 4 argument(s), got \(args.count)") - } - return boxOpaque(Date.AnchoredRelativeFormatStyle(anchor: try unboxOpaque(args[0], as: Date.self, typeName: "Date"), locale: try unboxOpaque(args[1], as: Locale.self, typeName: "Locale"), calendar: try unboxOpaque(args[2], as: Calendar.self, typeName: "Calendar"), capitalizationContext: try unboxOpaque(args[3], as: FormatStyleCapitalizationContext.self, typeName: "FormatStyleCapitalizationContext")), typeName: "Date.AnchoredRelativeFormatStyle") - }, - ] - #if canImport(Darwin) - d["var Date.AnchoredRelativeFormatStyle.hashValue: Int"] = .computed { receiver in - let recv: Date.AnchoredRelativeFormatStyle = try unboxOpaque(receiver, as: Date.AnchoredRelativeFormatStyle.self, typeName: "Date.AnchoredRelativeFormatStyle") - return .int(recv.hashValue) - } - #endif - return d - }() -} diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateAttributedStyle.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateAttributedStyle.swift new file mode 100644 index 0000000..490eda4 --- /dev/null +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateAttributedStyle.swift @@ -0,0 +1,35 @@ +// AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. +// Regenerate with: bash Tools/regen-foundation-bridge.sh +import Foundation + import ShellKit +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif + +extension FoundationBridges { + nonisolated(unsafe) static let dateAttributedStyle: [String: Bridge] = { + var d: [String: Bridge] = [ + "func Date.AttributedStyle.format()": .method { receiver, args in + guard args.count == 1 else { + throw RuntimeError.invalid("Date.AttributedStyle.format: expected 1 argument(s), got \(args.count)") + } + let recv: Date.AttributedStyle = try unboxOpaque(receiver, as: Date.AttributedStyle.self, typeName: "Date.AttributedStyle") + return boxOpaque(recv.format(try unboxOpaque(args[0], as: Date.self, typeName: "Date")), typeName: "AttributedString") + }, + "func Date.AttributedStyle.locale()": .method { receiver, args in + guard args.count == 1 else { + throw RuntimeError.invalid("Date.AttributedStyle.locale: expected 1 argument(s), got \(args.count)") + } + let recv: Date.AttributedStyle = try unboxOpaque(receiver, as: Date.AttributedStyle.self, typeName: "Date.AttributedStyle") + return boxOpaque(recv.locale(try unboxOpaque(args[0], as: Locale.self, typeName: "Locale")), typeName: "Date.AttributedStyle") + }, + ] + #if canImport(Darwin) + d["var Date.AttributedStyle.hashValue: Int"] = .computed { receiver in + let recv: Date.AttributedStyle = try unboxOpaque(receiver, as: Date.AttributedStyle.self, typeName: "Date.AttributedStyle") + return .int(recv.hashValue) + } + #endif + return d + }() +} diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateComponents.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateComponents.swift index 5a359db..51522e2 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateComponents.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateComponents.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif @@ -113,13 +114,6 @@ extension FoundationBridges { } return .optional(nil) }, - "var DateComponents.dayOfYear: Int?": .computed { receiver in - let recv: DateComponents = try unboxOpaque(receiver, as: DateComponents.self, typeName: "DateComponents") - if let _v = recv.dayOfYear { - return .optional(.int(_v)) - } - return .optional(nil) - }, "var DateComponents.yearForWeekOfYear: Int?": .computed { receiver in let recv: DateComponents = try unboxOpaque(receiver, as: DateComponents.self, typeName: "DateComponents") if let _v = recv.yearForWeekOfYear { @@ -134,13 +128,6 @@ extension FoundationBridges { } return .optional(nil) }, - "var DateComponents.isRepeatedDay: Bool?": .computed { receiver in - let recv: DateComponents = try unboxOpaque(receiver, as: DateComponents.self, typeName: "DateComponents") - if let _v = recv.isRepeatedDay { - return .optional(.bool(_v)) - } - return .optional(nil) - }, "var DateComponents.date: Date?": .computed { receiver in let recv: DateComponents = try unboxOpaque(receiver, as: DateComponents.self, typeName: "DateComponents") if let _v = recv.date { diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateComponentsFormatStyle.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateComponentsFormatStyle.swift index 854960d..9ee1509 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateComponentsFormatStyle.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateComponentsFormatStyle.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif @@ -18,10 +19,6 @@ extension FoundationBridges { let recv: Date.ComponentsFormatStyle = try unboxOpaque(receiver, as: Date.ComponentsFormatStyle.self, typeName: "Date.ComponentsFormatStyle") return boxOpaque(recv.locale, typeName: "Locale") } - d["var Date.ComponentsFormatStyle.isPositive: Bool"] = .computed { receiver in - let recv: Date.ComponentsFormatStyle = try unboxOpaque(receiver, as: Date.ComponentsFormatStyle.self, typeName: "Date.ComponentsFormatStyle") - return .bool(recv.isPositive) - } d["var Date.ComponentsFormatStyle.hashValue: Int"] = .computed { receiver in let recv: Date.ComponentsFormatStyle = try unboxOpaque(receiver, as: Date.ComponentsFormatStyle.self, typeName: "Date.ComponentsFormatStyle") return .int(recv.hashValue) diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateComponentsFormatterZeroFormattingBehavior.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateComponentsFormatterZeroFormattingBehavior.swift index fb4f3b3..0cdf9fb 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateComponentsFormatterZeroFormattingBehavior.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateComponentsFormatterZeroFormattingBehavior.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateFormatString.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateFormatString.swift index 0b649a6..5fbcb68 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateFormatString.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateFormatString.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateFormatStyle.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateFormatStyle.swift index 2dff02b..02b7acd 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateFormatStyle.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateFormatStyle.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif @@ -24,6 +25,10 @@ extension FoundationBridges { let recv: Date.FormatStyle = try unboxOpaque(receiver, as: Date.FormatStyle.self, typeName: "Date.FormatStyle") return boxOpaque(recv.capitalizationContext, typeName: "FormatStyleCapitalizationContext") }, + "var Date.FormatStyle.attributed: Date.AttributedStyle": .computed { receiver in + let recv: Date.FormatStyle = try unboxOpaque(receiver, as: Date.FormatStyle.self, typeName: "Date.FormatStyle") + return boxOpaque(recv.attributed, typeName: "Date.AttributedStyle") + }, "var Date.FormatStyle.parseStrategy: Date.FormatStyle": .computed { receiver in let recv: Date.FormatStyle = try unboxOpaque(receiver, as: Date.FormatStyle.self, typeName: "Date.FormatStyle") return boxOpaque(recv.parseStrategy, typeName: "Date.FormatStyle") @@ -137,26 +142,6 @@ extension FoundationBridges { throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) } }, - "func Date.FormatStyle.discreteInput()": .method { receiver, args in - guard args.count == 1 else { - throw RuntimeError.invalid("Date.FormatStyle.discreteInput: expected 1 argument(s), got \(args.count)") - } - let recv: Date.FormatStyle = try unboxOpaque(receiver, as: Date.FormatStyle.self, typeName: "Date.FormatStyle") - if let _v = recv.discreteInput(before: try unboxOpaque(args[0], as: Date.self, typeName: "Date")) { - return .optional(boxOpaque(_v, typeName: "Date")) - } - return .optional(nil) - }, - "func Date.FormatStyle.input()": .method { receiver, args in - guard args.count == 1 else { - throw RuntimeError.invalid("Date.FormatStyle.input: expected 1 argument(s), got \(args.count)") - } - let recv: Date.FormatStyle = try unboxOpaque(receiver, as: Date.FormatStyle.self, typeName: "Date.FormatStyle") - if let _v = recv.input(before: try unboxOpaque(args[0], as: Date.self, typeName: "Date")) { - return .optional(boxOpaque(_v, typeName: "Date")) - } - return .optional(nil) - }, "init Date.FormatStyle(locale:calendar:timeZone:capitalizationContext:)": .`init` { args in guard args.count == 4 else { throw RuntimeError.invalid("init Date.FormatStyle(locale:calendar:timeZone:capitalizationContext:): expected 4 argument(s), got \(args.count)") diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateISO8601FormatStyle.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateISO8601FormatStyle.swift index 739e852..056aedf 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateISO8601FormatStyle.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateISO8601FormatStyle.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateInterval.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateInterval.swift index 1a05293..2d36334 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateInterval.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateInterval.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateIntervalFormatStyle.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateIntervalFormatStyle.swift index 11be0aa..2544c93 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateIntervalFormatStyle.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateIntervalFormatStyle.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateParseStrategy.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateParseStrategy.swift index cd2c001..8ce952c 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateParseStrategy.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateParseStrategy.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateRelativeFormatStyle.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateRelativeFormatStyle.swift index 1985da6..9947ee8 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateRelativeFormatStyle.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateRelativeFormatStyle.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateVerbatimFormatStyle.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateVerbatimFormatStyle.swift index 8acb6a7..ce97163 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateVerbatimFormatStyle.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DateVerbatimFormatStyle.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif @@ -23,6 +24,10 @@ extension FoundationBridges { } return .optional(nil) }, + "var Date.VerbatimFormatStyle.attributed: Date.AttributedStyle": .computed { receiver in + let recv: Date.VerbatimFormatStyle = try unboxOpaque(receiver, as: Date.VerbatimFormatStyle.self, typeName: "Date.VerbatimFormatStyle") + return boxOpaque(recv.attributed, typeName: "Date.AttributedStyle") + }, "var Date.VerbatimFormatStyle.parseStrategy: Date.ParseStrategy": .computed { receiver in let recv: Date.VerbatimFormatStyle = try unboxOpaque(receiver, as: Date.VerbatimFormatStyle.self, typeName: "Date.VerbatimFormatStyle") return boxOpaque(recv.parseStrategy, typeName: "Date.ParseStrategy") @@ -40,26 +45,6 @@ extension FoundationBridges { } let recv: Date.VerbatimFormatStyle = try unboxOpaque(receiver, as: Date.VerbatimFormatStyle.self, typeName: "Date.VerbatimFormatStyle") return boxOpaque(recv.locale(try unboxOpaque(args[0], as: Locale.self, typeName: "Locale")), typeName: "Date.VerbatimFormatStyle") - }, - "func Date.VerbatimFormatStyle.discreteInput()": .method { receiver, args in - guard args.count == 1 else { - throw RuntimeError.invalid("Date.VerbatimFormatStyle.discreteInput: expected 1 argument(s), got \(args.count)") - } - let recv: Date.VerbatimFormatStyle = try unboxOpaque(receiver, as: Date.VerbatimFormatStyle.self, typeName: "Date.VerbatimFormatStyle") - if let _v = recv.discreteInput(before: try unboxOpaque(args[0], as: Date.self, typeName: "Date")) { - return .optional(boxOpaque(_v, typeName: "Date")) - } - return .optional(nil) - }, - "func Date.VerbatimFormatStyle.input()": .method { receiver, args in - guard args.count == 1 else { - throw RuntimeError.invalid("Date.VerbatimFormatStyle.input: expected 1 argument(s), got \(args.count)") - } - let recv: Date.VerbatimFormatStyle = try unboxOpaque(receiver, as: Date.VerbatimFormatStyle.self, typeName: "Date.VerbatimFormatStyle") - if let _v = recv.input(before: try unboxOpaque(args[0], as: Date.self, typeName: "Date")) { - return .optional(boxOpaque(_v, typeName: "Date")) - } - return .optional(nil) }, ] #if canImport(Darwin) diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+Decimal.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+Decimal.swift index f3c0a22..622d8ff 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+Decimal.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+Decimal.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DecimalFormatStyle.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DecimalFormatStyle.swift index 3e024fd..cf13a9d 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DecimalFormatStyle.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DecimalFormatStyle.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DescriptiveNumberFormatConfigurationPresentation.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DescriptiveNumberFormatConfigurationPresentation.swift index e3db110..4517836 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DescriptiveNumberFormatConfigurationPresentation.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DescriptiveNumberFormatConfigurationPresentation.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+Duration.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+Duration.swift index 1bc6678..8da9905 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+Duration.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+Duration.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif @@ -42,12 +43,6 @@ extension FoundationBridges { } return boxOpaque(Duration.microseconds(try toDouble(args[0])), typeName: "Duration") }, - "static func Duration.nanoseconds()": .staticMethod { args in - guard args.count == 1 else { - throw RuntimeError.invalid("Duration.nanoseconds: expected 1 argument(s), got \(args.count)") - } - return boxOpaque(Duration.nanoseconds(try toDouble(args[0])), typeName: "Duration") - }, ] } #else diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DurationTimeFormatStyle.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DurationTimeFormatStyle.swift index 093a373..5a6efe9 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DurationTimeFormatStyle.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DurationTimeFormatStyle.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif @@ -12,10 +13,6 @@ extension FoundationBridges { let recv: Duration.TimeFormatStyle = try unboxOpaque(receiver, as: Duration.TimeFormatStyle.self, typeName: "Duration.TimeFormatStyle") return boxOpaque(recv.locale, typeName: "Locale") }, - "var Duration.TimeFormatStyle.grouping: NumberFormatStyleConfiguration.Grouping": .computed { receiver in - let recv: Duration.TimeFormatStyle = try unboxOpaque(receiver, as: Duration.TimeFormatStyle.self, typeName: "Duration.TimeFormatStyle") - return boxOpaque(recv.grouping, typeName: "NumberFormatStyleConfiguration.Grouping") - }, "func Duration.TimeFormatStyle.format()": .method { receiver, args in guard args.count == 1 else { throw RuntimeError.invalid("Duration.TimeFormatStyle.format: expected 1 argument(s), got \(args.count)") @@ -29,23 +26,6 @@ extension FoundationBridges { } let recv: Duration.TimeFormatStyle = try unboxOpaque(receiver, as: Duration.TimeFormatStyle.self, typeName: "Duration.TimeFormatStyle") return boxOpaque(recv.locale(try unboxOpaque(args[0], as: Locale.self, typeName: "Locale")), typeName: "Duration.TimeFormatStyle") - }, - "func Duration.TimeFormatStyle.grouping()": .method { receiver, args in - guard args.count == 1 else { - throw RuntimeError.invalid("Duration.TimeFormatStyle.grouping: expected 1 argument(s), got \(args.count)") - } - let recv: Duration.TimeFormatStyle = try unboxOpaque(receiver, as: Duration.TimeFormatStyle.self, typeName: "Duration.TimeFormatStyle") - return boxOpaque(recv.grouping(try unboxOpaque(args[0], as: NumberFormatStyleConfiguration.Grouping.self, typeName: "NumberFormatStyleConfiguration.Grouping")), typeName: "Duration.TimeFormatStyle") - }, - "func Duration.TimeFormatStyle.discreteInput()": .method { receiver, args in - guard args.count == 1 else { - throw RuntimeError.invalid("Duration.TimeFormatStyle.discreteInput: expected 1 argument(s), got \(args.count)") - } - let recv: Duration.TimeFormatStyle = try unboxOpaque(receiver, as: Duration.TimeFormatStyle.self, typeName: "Duration.TimeFormatStyle") - if let _v = recv.discreteInput(before: try unboxOpaque(args[0], as: Duration.self, typeName: "Duration")) { - return .optional(boxOpaque(_v, typeName: "Duration")) - } - return .optional(nil) }, ] #if canImport(Darwin) diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DurationUnitsFormatStyle.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DurationUnitsFormatStyle.swift index dd4a85f..6635c77 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DurationUnitsFormatStyle.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+DurationUnitsFormatStyle.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif @@ -32,16 +33,6 @@ extension FoundationBridges { } let recv: Duration.UnitsFormatStyle = try unboxOpaque(receiver, as: Duration.UnitsFormatStyle.self, typeName: "Duration.UnitsFormatStyle") return boxOpaque(recv.locale(try unboxOpaque(args[0], as: Locale.self, typeName: "Locale")), typeName: "Duration.UnitsFormatStyle") - }, - "func Duration.UnitsFormatStyle.discreteInput()": .method { receiver, args in - guard args.count == 1 else { - throw RuntimeError.invalid("Duration.UnitsFormatStyle.discreteInput: expected 1 argument(s), got \(args.count)") - } - let recv: Duration.UnitsFormatStyle = try unboxOpaque(receiver, as: Duration.UnitsFormatStyle.self, typeName: "Duration.UnitsFormatStyle") - if let _v = recv.discreteInput(before: try unboxOpaque(args[0], as: Duration.self, typeName: "Duration")) { - return .optional(boxOpaque(_v, typeName: "Duration")) - } - return .optional(nil) }, ] #if canImport(Darwin) diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ErrorUserInfoKey.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ErrorUserInfoKey.swift index e56f522..1b34d46 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ErrorUserInfoKey.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ErrorUserInfoKey.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+FileAttributeKey.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+FileAttributeKey.swift index 210ae3d..0f71d97 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+FileAttributeKey.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+FileAttributeKey.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+FileAttributeType.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+FileAttributeType.swift index 20c2848..55e26fe 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+FileAttributeType.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+FileAttributeType.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+FileManager.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+FileManager.swift index 4aa7171..9d39121 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+FileManager.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+FileManager.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif @@ -8,9 +9,8 @@ import FoundationNetworking extension FoundationBridges { nonisolated(unsafe) static let fileManager: [String: Bridge] = { var d: [String: Bridge] = [ - "var FileManager.currentDirectoryPath: String": .computed { receiver in - let recv: FileManager = try unboxOpaque(receiver, as: FileManager.self, typeName: "FileManager") - return .string(recv.currentDirectoryPath) + "var FileManager.currentDirectoryPath: String": .computed { _ in + return .string(ShellKit.Shell.current.environment.workingDirectory) }, "var FileManager.temporaryDirectory: URL": .computed { receiver in let recv: FileManager = try unboxOpaque(receiver, as: FileManager.self, typeName: "FileManager") @@ -21,8 +21,14 @@ extension FoundationBridges { throw RuntimeError.invalid("FileManager.destinationOfSymbolicLink: expected 1 argument(s), got \(args.count)") } let recv: FileManager = try unboxOpaque(receiver, as: FileManager.self, typeName: "FileManager") + let arg0 = try unboxString(args[0]) + do { + try await authorizePath(arg0, for: .read) + } catch { + throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) + } do { - return .string(try recv.destinationOfSymbolicLink(atPath: try unboxString(args[0]))) + return .string(try await recv.destinationOfSymbolicLink(atPath: arg0)) } catch { throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) } @@ -32,8 +38,14 @@ extension FoundationBridges { throw RuntimeError.invalid("FileManager.removeItem: expected 1 argument(s), got \(args.count)") } let recv: FileManager = try unboxOpaque(receiver, as: FileManager.self, typeName: "FileManager") + let arg0 = try unboxString(args[0]) + do { + try await authorizePath(arg0, for: .delete) + } catch { + throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) + } do { - try recv.removeItem(atPath: try unboxString(args[0])) + try await recv.removeItem(atPath: arg0) return .void } catch { throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) @@ -44,56 +56,104 @@ extension FoundationBridges { throw RuntimeError.invalid("FileManager.changeCurrentDirectoryPath: expected 1 argument(s), got \(args.count)") } let recv: FileManager = try unboxOpaque(receiver, as: FileManager.self, typeName: "FileManager") - return .bool(recv.changeCurrentDirectoryPath(try unboxString(args[0]))) + let arg0 = try unboxString(args[0]) + do { + try await authorizePath(arg0, for: .write) + } catch { + throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) + } + return .bool(await recv.changeCurrentDirectoryPath(arg0)) }, "func FileManager.fileExists()": .method { receiver, args in guard args.count == 1 else { throw RuntimeError.invalid("FileManager.fileExists: expected 1 argument(s), got \(args.count)") } let recv: FileManager = try unboxOpaque(receiver, as: FileManager.self, typeName: "FileManager") - return .bool(recv.fileExists(atPath: try unboxString(args[0]))) + let arg0 = try unboxString(args[0]) + do { + try await authorizePath(arg0, for: .read) + } catch { + throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) + } + return .bool(await recv.fileExists(atPath: arg0)) }, "func FileManager.isReadableFile()": .method { receiver, args in guard args.count == 1 else { throw RuntimeError.invalid("FileManager.isReadableFile: expected 1 argument(s), got \(args.count)") } let recv: FileManager = try unboxOpaque(receiver, as: FileManager.self, typeName: "FileManager") - return .bool(recv.isReadableFile(atPath: try unboxString(args[0]))) + let arg0 = try unboxString(args[0]) + do { + try await authorizePath(arg0, for: .read) + } catch { + throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) + } + return .bool(await recv.isReadableFile(atPath: arg0)) }, "func FileManager.isWritableFile()": .method { receiver, args in guard args.count == 1 else { throw RuntimeError.invalid("FileManager.isWritableFile: expected 1 argument(s), got \(args.count)") } let recv: FileManager = try unboxOpaque(receiver, as: FileManager.self, typeName: "FileManager") - return .bool(recv.isWritableFile(atPath: try unboxString(args[0]))) + let arg0 = try unboxString(args[0]) + do { + try await authorizePath(arg0, for: .read) + } catch { + throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) + } + return .bool(await recv.isWritableFile(atPath: arg0)) }, "func FileManager.isExecutableFile()": .method { receiver, args in guard args.count == 1 else { throw RuntimeError.invalid("FileManager.isExecutableFile: expected 1 argument(s), got \(args.count)") } let recv: FileManager = try unboxOpaque(receiver, as: FileManager.self, typeName: "FileManager") - return .bool(recv.isExecutableFile(atPath: try unboxString(args[0]))) + let arg0 = try unboxString(args[0]) + do { + try await authorizePath(arg0, for: .read) + } catch { + throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) + } + return .bool(await recv.isExecutableFile(atPath: arg0)) }, "func FileManager.isDeletableFile()": .method { receiver, args in guard args.count == 1 else { throw RuntimeError.invalid("FileManager.isDeletableFile: expected 1 argument(s), got \(args.count)") } let recv: FileManager = try unboxOpaque(receiver, as: FileManager.self, typeName: "FileManager") - return .bool(recv.isDeletableFile(atPath: try unboxString(args[0]))) + let arg0 = try unboxString(args[0]) + do { + try await authorizePath(arg0, for: .read) + } catch { + throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) + } + return .bool(await recv.isDeletableFile(atPath: arg0)) }, "func FileManager.displayName()": .method { receiver, args in guard args.count == 1 else { throw RuntimeError.invalid("FileManager.displayName: expected 1 argument(s), got \(args.count)") } let recv: FileManager = try unboxOpaque(receiver, as: FileManager.self, typeName: "FileManager") - return .string(recv.displayName(atPath: try unboxString(args[0]))) + let arg0 = try unboxString(args[0]) + do { + try await authorizePath(arg0, for: .read) + } catch { + throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) + } + return .string(await recv.displayName(atPath: arg0)) }, "func FileManager.contents()": .method { receiver, args in guard args.count == 1 else { throw RuntimeError.invalid("FileManager.contents: expected 1 argument(s), got \(args.count)") } let recv: FileManager = try unboxOpaque(receiver, as: FileManager.self, typeName: "FileManager") - if let _v = recv.contents(atPath: try unboxString(args[0])) { + let arg0 = try unboxString(args[0]) + do { + try await authorizePath(arg0, for: .read) + } catch { + throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) + } + if let _v = await recv.contents(atPath: arg0) { return .optional(boxOpaque(_v, typeName: "Data")) } return .optional(nil) @@ -103,8 +163,14 @@ extension FoundationBridges { throw RuntimeError.invalid("FileManager.createSymbolicLink: expected 2 argument(s), got \(args.count)") } let recv: FileManager = try unboxOpaque(receiver, as: FileManager.self, typeName: "FileManager") + let arg0 = try unboxOpaque(args[0], as: URL.self, typeName: "URL") do { - try recv.createSymbolicLink(at: try unboxOpaque(args[0], as: URL.self, typeName: "URL"), withDestinationURL: try unboxOpaque(args[1], as: URL.self, typeName: "URL")) + try await authorizePath(arg0, for: .write) + } catch { + throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) + } + do { + try await recv.createSymbolicLink(at: arg0, withDestinationURL: try unboxOpaque(args[1], as: URL.self, typeName: "URL")) return .void } catch { throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) @@ -115,8 +181,20 @@ extension FoundationBridges { throw RuntimeError.invalid("FileManager.copyItem: expected 2 argument(s), got \(args.count)") } let recv: FileManager = try unboxOpaque(receiver, as: FileManager.self, typeName: "FileManager") + let arg0 = try unboxString(args[0]) do { - try recv.copyItem(atPath: try unboxString(args[0]), toPath: try unboxString(args[1])) + try await authorizePath(arg0, for: .write) + } catch { + throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) + } + let arg1 = try unboxString(args[1]) + do { + try await authorizePath(arg1, for: .write) + } catch { + throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) + } + do { + try await recv.copyItem(atPath: arg0, toPath: arg1) return .void } catch { throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) @@ -127,8 +205,20 @@ extension FoundationBridges { throw RuntimeError.invalid("FileManager.moveItem: expected 2 argument(s), got \(args.count)") } let recv: FileManager = try unboxOpaque(receiver, as: FileManager.self, typeName: "FileManager") + let arg0 = try unboxString(args[0]) do { - try recv.moveItem(atPath: try unboxString(args[0]), toPath: try unboxString(args[1])) + try await authorizePath(arg0, for: .write) + } catch { + throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) + } + let arg1 = try unboxString(args[1]) + do { + try await authorizePath(arg1, for: .write) + } catch { + throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) + } + do { + try await recv.moveItem(atPath: arg0, toPath: arg1) return .void } catch { throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) @@ -139,8 +229,20 @@ extension FoundationBridges { throw RuntimeError.invalid("FileManager.linkItem: expected 2 argument(s), got \(args.count)") } let recv: FileManager = try unboxOpaque(receiver, as: FileManager.self, typeName: "FileManager") + let arg0 = try unboxString(args[0]) + do { + try await authorizePath(arg0, for: .write) + } catch { + throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) + } + let arg1 = try unboxString(args[1]) do { - try recv.linkItem(atPath: try unboxString(args[0]), toPath: try unboxString(args[1])) + try await authorizePath(arg1, for: .write) + } catch { + throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) + } + do { + try await recv.linkItem(atPath: arg0, toPath: arg1) return .void } catch { throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) @@ -151,15 +253,27 @@ extension FoundationBridges { throw RuntimeError.invalid("FileManager.contentsEqual: expected 2 argument(s), got \(args.count)") } let recv: FileManager = try unboxOpaque(receiver, as: FileManager.self, typeName: "FileManager") - return .bool(recv.contentsEqual(atPath: try unboxString(args[0]), andPath: try unboxString(args[1]))) + let arg0 = try unboxString(args[0]) + do { + try await authorizePath(arg0, for: .read) + } catch { + throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) + } + return .bool(await recv.contentsEqual(atPath: arg0, andPath: try unboxString(args[1]))) }, "func FileManager.createDirectory()": .method { receiver, args in guard args.count == 2 else { throw RuntimeError.invalid("FileManager.createDirectory: expected 2 argument(s), got \(args.count)") } let recv: FileManager = try unboxOpaque(receiver, as: FileManager.self, typeName: "FileManager") + let arg0 = try unboxOpaque(args[0], as: URL.self, typeName: "URL") + do { + try await authorizePath(arg0, for: .write) + } catch { + throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) + } do { - try recv.createDirectory(at: try unboxOpaque(args[0], as: URL.self, typeName: "URL"), withIntermediateDirectories: try unboxBool(args[1])) + try await recv.createDirectory(at: arg0, withIntermediateDirectories: try unboxBool(args[1])) return .void } catch { throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) @@ -172,15 +286,27 @@ extension FoundationBridges { throw RuntimeError.invalid("FileManager.isUbiquitousItem: expected 1 argument(s), got \(args.count)") } let recv: FileManager = try unboxOpaque(receiver, as: FileManager.self, typeName: "FileManager") - return .bool(recv.isUbiquitousItem(at: try unboxOpaque(args[0], as: URL.self, typeName: "URL"))) + let arg0 = try unboxOpaque(args[0], as: URL.self, typeName: "URL") + do { + try await authorizePath(arg0, for: .read) + } catch { + throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) + } + return .bool(await recv.isUbiquitousItem(at: arg0)) } d["func FileManager.startDownloadingUbiquitousItem()"] = .method { receiver, args in guard args.count == 1 else { throw RuntimeError.invalid("FileManager.startDownloadingUbiquitousItem: expected 1 argument(s), got \(args.count)") } let recv: FileManager = try unboxOpaque(receiver, as: FileManager.self, typeName: "FileManager") + let arg0 = try unboxOpaque(args[0], as: URL.self, typeName: "URL") do { - try recv.startDownloadingUbiquitousItem(at: try unboxOpaque(args[0], as: URL.self, typeName: "URL")) + try await authorizePath(arg0, for: .read) + } catch { + throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) + } + do { + try await recv.startDownloadingUbiquitousItem(at: arg0) return .void } catch { throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) @@ -191,8 +317,14 @@ extension FoundationBridges { throw RuntimeError.invalid("FileManager.evictUbiquitousItem: expected 1 argument(s), got \(args.count)") } let recv: FileManager = try unboxOpaque(receiver, as: FileManager.self, typeName: "FileManager") + let arg0 = try unboxOpaque(args[0], as: URL.self, typeName: "URL") do { - try recv.evictUbiquitousItem(at: try unboxOpaque(args[0], as: URL.self, typeName: "URL")) + try await authorizePath(arg0, for: .read) + } catch { + throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) + } + do { + try await recv.evictUbiquitousItem(at: arg0) return .void } catch { throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) @@ -203,7 +335,13 @@ extension FoundationBridges { throw RuntimeError.invalid("FileManager.containerURL: expected 1 argument(s), got \(args.count)") } let recv: FileManager = try unboxOpaque(receiver, as: FileManager.self, typeName: "FileManager") - if let _v = recv.containerURL(forSecurityApplicationGroupIdentifier: try unboxString(args[0])) { + let arg0 = try unboxString(args[0]) + do { + try await authorizePath(arg0, for: .read) + } catch { + throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) + } + if let _v = await recv.containerURL(forSecurityApplicationGroupIdentifier: arg0) { return .optional(boxOpaque(_v, typeName: "URL")) } return .optional(nil) diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+FileManagerDirectoryEnumerationOptions.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+FileManagerDirectoryEnumerationOptions.swift index 79776e7..696f44b 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+FileManagerDirectoryEnumerationOptions.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+FileManagerDirectoryEnumerationOptions.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+FileManagerItemReplacementOptions.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+FileManagerItemReplacementOptions.swift index 9759649..e8f7ad2 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+FileManagerItemReplacementOptions.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+FileManagerItemReplacementOptions.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+FileManagerSearchPathDomainMask.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+FileManagerSearchPathDomainMask.swift index 50108e3..212c0f3 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+FileManagerSearchPathDomainMask.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+FileManagerSearchPathDomainMask.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+FileManagerVolumeEnumerationOptions.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+FileManagerVolumeEnumerationOptions.swift index cce2caf..4224426 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+FileManagerVolumeEnumerationOptions.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+FileManagerVolumeEnumerationOptions.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+FileProtectionType.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+FileProtectionType.swift index 7fca186..cb408bd 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+FileProtectionType.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+FileProtectionType.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+FileWrapperReadingOptions.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+FileWrapperReadingOptions.swift index cbe1a12..7193d0b 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+FileWrapperReadingOptions.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+FileWrapperReadingOptions.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+FileWrapperWritingOptions.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+FileWrapperWritingOptions.swift index fb71f89..0431232 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+FileWrapperWritingOptions.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+FileWrapperWritingOptions.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+FormatStyleCapitalizationContext.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+FormatStyleCapitalizationContext.swift index 843d1c9..95a8f59 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+FormatStyleCapitalizationContext.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+FormatStyleCapitalizationContext.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+HTTPCookiePropertyKey.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+HTTPCookiePropertyKey.swift index 77d84d5..e70d6f4 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+HTTPCookiePropertyKey.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+HTTPCookiePropertyKey.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif @@ -39,7 +40,6 @@ extension FoundationBridges { let recv: HTTPCookiePropertyKey = try unboxOpaque(receiver, as: HTTPCookiePropertyKey.self, typeName: "HTTPCookiePropertyKey") return .int(recv.hashValue) } - d["static let HTTPCookiePropertyKey.setByJavaScript"] = .staticValue(boxOpaque(HTTPCookiePropertyKey.setByJavaScript, typeName: "HTTPCookiePropertyKey")) d["static let HTTPCookiePropertyKey.sameSitePolicy"] = .staticValue(boxOpaque(HTTPCookiePropertyKey.sameSitePolicy, typeName: "HTTPCookiePropertyKey")) #endif return d diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+HTTPCookieStringPolicy.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+HTTPCookieStringPolicy.swift index fea6487..527c84b 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+HTTPCookieStringPolicy.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+HTTPCookieStringPolicy.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+HTTPURLResponse.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+HTTPURLResponse.swift index 97dc9f0..2d875dd 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+HTTPURLResponse.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+HTTPURLResponse.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ISO8601DateFormatterOptions.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ISO8601DateFormatterOptions.swift index 99554d5..d529d91 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ISO8601DateFormatterOptions.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ISO8601DateFormatterOptions.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+IndexPath.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+IndexPath.swift index 7d2be7f..b71e3ae 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+IndexPath.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+IndexPath.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+IndexSet.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+IndexSet.swift index 7bd98bb..b70ee61 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+IndexSet.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+IndexSet.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+IndexSetIndex.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+IndexSetIndex.swift index 20f5c9a..f748d2b 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+IndexSetIndex.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+IndexSetIndex.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+IndexSetRangeView.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+IndexSetRangeView.swift index 9846494..ed7b923 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+IndexSetRangeView.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+IndexSetRangeView.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+InlinePresentationIntent.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+InlinePresentationIntent.swift index 79d42e3..c4ce752 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+InlinePresentationIntent.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+InlinePresentationIntent.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+JSONDecoder.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+JSONDecoder.swift index 93e846e..3f4c83a 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+JSONDecoder.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+JSONDecoder.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+JSONEncoder.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+JSONEncoder.swift index 377769f..187289f 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+JSONEncoder.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+JSONEncoder.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+JSONEncoderOutputFormatting.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+JSONEncoderOutputFormatting.swift index f4ff807..602405b 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+JSONEncoderOutputFormatting.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+JSONEncoderOutputFormatting.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+JSONSerializationReadingOptions.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+JSONSerializationReadingOptions.swift index 7ec96b2..a8460ed 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+JSONSerializationReadingOptions.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+JSONSerializationReadingOptions.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+JSONSerializationWritingOptions.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+JSONSerializationWritingOptions.swift index 8fe7e8d..ec4e840 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+JSONSerializationWritingOptions.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+JSONSerializationWritingOptions.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+Locale.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+Locale.swift index c1291ec..0433eaf 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+Locale.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+Locale.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocaleCollation.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocaleCollation.swift index 99abe9d..b64ccef 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocaleCollation.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocaleCollation.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif @@ -12,10 +13,6 @@ extension FoundationBridges { let recv: Locale.Collation = try unboxOpaque(receiver, as: Locale.Collation.self, typeName: "Locale.Collation") return .string(recv.identifier) }, - "var Locale.Collation.debugDescription: String": .computed { receiver in - let recv: Locale.Collation = try unboxOpaque(receiver, as: Locale.Collation.self, typeName: "Locale.Collation") - return .string(recv.debugDescription) - }, "static let Locale.Collation.searchRules": .staticValue(boxOpaque(Locale.Collation.searchRules, typeName: "Locale.Collation")), "static let Locale.Collation.standard": .staticValue(boxOpaque(Locale.Collation.standard, typeName: "Locale.Collation")), "init Locale.Collation(stringLiteral:)": .`init` { args in diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocaleComponents.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocaleComponents.swift index 5fd4737..1ce6061 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocaleComponents.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocaleComponents.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocaleCurrency.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocaleCurrency.swift index 8f4ca7e..42ff323 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocaleCurrency.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocaleCurrency.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif @@ -12,10 +13,6 @@ extension FoundationBridges { let recv: Locale.Currency = try unboxOpaque(receiver, as: Locale.Currency.self, typeName: "Locale.Currency") return .string(recv.identifier) }, - "var Locale.Currency.debugDescription: String": .computed { receiver in - let recv: Locale.Currency = try unboxOpaque(receiver, as: Locale.Currency.self, typeName: "Locale.Currency") - return .string(recv.debugDescription) - }, "var Locale.Currency.isISOCurrency: Bool": .computed { receiver in let recv: Locale.Currency = try unboxOpaque(receiver, as: Locale.Currency.self, typeName: "Locale.Currency") return .bool(recv.isISOCurrency) diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocaleLanguage.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocaleLanguage.swift index ec339ad..da81413 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocaleLanguage.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocaleLanguage.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocaleLanguageCode.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocaleLanguageCode.swift index 3812b3a..bee36a3 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocaleLanguageCode.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocaleLanguageCode.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif @@ -8,10 +9,6 @@ import FoundationNetworking extension FoundationBridges { nonisolated(unsafe) static let localeLanguageCode: [String: Bridge] = { var d: [String: Bridge] = [ - "var Locale.LanguageCode.debugDescription: String": .computed { receiver in - let recv: Locale.LanguageCode = try unboxOpaque(receiver, as: Locale.LanguageCode.self, typeName: "Locale.LanguageCode") - return .string(recv.debugDescription) - }, "var Locale.LanguageCode.identifier: String": .computed { receiver in let recv: Locale.LanguageCode = try unboxOpaque(receiver, as: Locale.LanguageCode.self, typeName: "Locale.LanguageCode") return .string(recv.identifier) diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocaleMeasurementSystem.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocaleMeasurementSystem.swift index 05844a1..bdec022 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocaleMeasurementSystem.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocaleMeasurementSystem.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif @@ -12,10 +13,6 @@ extension FoundationBridges { let recv: Locale.MeasurementSystem = try unboxOpaque(receiver, as: Locale.MeasurementSystem.self, typeName: "Locale.MeasurementSystem") return .string(recv.identifier) }, - "var Locale.MeasurementSystem.debugDescription: String": .computed { receiver in - let recv: Locale.MeasurementSystem = try unboxOpaque(receiver, as: Locale.MeasurementSystem.self, typeName: "Locale.MeasurementSystem") - return .string(recv.debugDescription) - }, "static let Locale.MeasurementSystem.metric": .staticValue(boxOpaque(Locale.MeasurementSystem.metric, typeName: "Locale.MeasurementSystem")), "static let Locale.MeasurementSystem.us": .staticValue(boxOpaque(Locale.MeasurementSystem.us, typeName: "Locale.MeasurementSystem")), "static let Locale.MeasurementSystem.uk": .staticValue(boxOpaque(Locale.MeasurementSystem.uk, typeName: "Locale.MeasurementSystem")), diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocaleNumberingSystem.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocaleNumberingSystem.swift index 2702762..c1921b6 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocaleNumberingSystem.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocaleNumberingSystem.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif @@ -12,10 +13,6 @@ extension FoundationBridges { let recv: Locale.NumberingSystem = try unboxOpaque(receiver, as: Locale.NumberingSystem.self, typeName: "Locale.NumberingSystem") return .string(recv.identifier) }, - "var Locale.NumberingSystem.debugDescription: String": .computed { receiver in - let recv: Locale.NumberingSystem = try unboxOpaque(receiver, as: Locale.NumberingSystem.self, typeName: "Locale.NumberingSystem") - return .string(recv.debugDescription) - }, "init Locale.NumberingSystem(stringLiteral:)": .`init` { args in guard args.count == 1 else { throw RuntimeError.invalid("init Locale.NumberingSystem(stringLiteral:): expected 1 argument(s), got \(args.count)") diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocaleRegion.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocaleRegion.swift index 4254a0b..722a977 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocaleRegion.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocaleRegion.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif @@ -8,10 +9,6 @@ import FoundationNetworking extension FoundationBridges { nonisolated(unsafe) static let localeRegion: [String: Bridge] = { var d: [String: Bridge] = [ - "var Locale.Region.debugDescription: String": .computed { receiver in - let recv: Locale.Region = try unboxOpaque(receiver, as: Locale.Region.self, typeName: "Locale.Region") - return .string(recv.debugDescription) - }, "var Locale.Region.identifier: String": .computed { receiver in let recv: Locale.Region = try unboxOpaque(receiver, as: Locale.Region.self, typeName: "Locale.Region") return .string(recv.identifier) @@ -290,13 +287,6 @@ extension FoundationBridges { } return .optional(nil) }, - "var Locale.Region.subcontinent: Locale.Region?": .computed { receiver in - let recv: Locale.Region = try unboxOpaque(receiver, as: Locale.Region.self, typeName: "Locale.Region") - if let _v = recv.subcontinent { - return .optional(boxOpaque(_v, typeName: "Locale.Region")) - } - return .optional(nil) - }, "init Locale.Region(stringLiteral:)": .`init` { args in guard args.count == 1 else { throw RuntimeError.invalid("init Locale.Region(stringLiteral:): expected 1 argument(s), got \(args.count)") diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocaleScript.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocaleScript.swift index ebecd36..1022d22 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocaleScript.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocaleScript.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif @@ -12,10 +13,6 @@ extension FoundationBridges { let recv: Locale.Script = try unboxOpaque(receiver, as: Locale.Script.self, typeName: "Locale.Script") return .string(recv.identifier) }, - "var Locale.Script.debugDescription: String": .computed { receiver in - let recv: Locale.Script = try unboxOpaque(receiver, as: Locale.Script.self, typeName: "Locale.Script") - return .string(recv.debugDescription) - }, "static let Locale.Script.unknown": .staticValue(boxOpaque(Locale.Script.unknown, typeName: "Locale.Script")), "static let Locale.Script.adlam": .staticValue(boxOpaque(Locale.Script.adlam, typeName: "Locale.Script")), "static let Locale.Script.arabic": .staticValue(boxOpaque(Locale.Script.arabic, typeName: "Locale.Script")), diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocaleSubdivision.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocaleSubdivision.swift index c960b2d..254538a 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocaleSubdivision.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocaleSubdivision.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif @@ -12,10 +13,6 @@ extension FoundationBridges { let recv: Locale.Subdivision = try unboxOpaque(receiver, as: Locale.Subdivision.self, typeName: "Locale.Subdivision") return .string(recv.identifier) }, - "var Locale.Subdivision.debugDescription: String": .computed { receiver in - let recv: Locale.Subdivision = try unboxOpaque(receiver, as: Locale.Subdivision.self, typeName: "Locale.Subdivision") - return .string(recv.debugDescription) - }, "init Locale.Subdivision(stringLiteral:)": .`init` { args in guard args.count == 1 else { throw RuntimeError.invalid("init Locale.Subdivision(stringLiteral:): expected 1 argument(s), got \(args.count)") diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocaleVariant.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocaleVariant.swift index c139242..096815c 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocaleVariant.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocaleVariant.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif @@ -12,10 +13,6 @@ extension FoundationBridges { let recv: Locale.Variant = try unboxOpaque(receiver, as: Locale.Variant.self, typeName: "Locale.Variant") return .string(recv.identifier) }, - "var Locale.Variant.debugDescription: String": .computed { receiver in - let recv: Locale.Variant = try unboxOpaque(receiver, as: Locale.Variant.self, typeName: "Locale.Variant") - return .string(recv.debugDescription) - }, "static let Locale.Variant.posix": .staticValue(boxOpaque(Locale.Variant.posix, typeName: "Locale.Variant")), "init Locale.Variant(stringLiteral:)": .`init` { args in guard args.count == 1 else { diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocalizedStringResource.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocalizedStringResource.swift index fdadfc3..619d841 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocalizedStringResource.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+LocalizedStringResource.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+MachError.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+MachError.swift index ee0ff68..f46a763 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+MachError.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+MachError.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+MeasurementFormatterUnitOptions.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+MeasurementFormatterUnitOptions.swift index 29d3e6b..1a141a3 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+MeasurementFormatterUnitOptions.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+MeasurementFormatterUnitOptions.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+Morphology.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+Morphology.swift index 77b432b..e128651 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+Morphology.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+Morphology.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif @@ -13,6 +14,16 @@ extension FoundationBridges { throw RuntimeError.invalid("init Morphology(): expected 0 argument(s), got \(args.count)") } return boxOpaque(Morphology(), typeName: "Morphology") + }, + "func Morphology.customPronoun()": .method { receiver, args in + guard args.count == 1 else { + throw RuntimeError.invalid("Morphology.customPronoun: expected 1 argument(s), got \(args.count)") + } + let recv: Morphology = try unboxOpaque(receiver, as: Morphology.self, typeName: "Morphology") + if let _v = recv.customPronoun(forLanguage: try unboxString(args[0])) { + return .optional(boxOpaque(_v, typeName: "Morphology.CustomPronoun")) + } + return .optional(nil) }, ] #if canImport(Darwin) diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+MorphologyCustomPronoun.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+MorphologyCustomPronoun.swift new file mode 100644 index 0000000..0cd28c7 --- /dev/null +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+MorphologyCustomPronoun.swift @@ -0,0 +1,68 @@ +// AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. +// Regenerate with: bash Tools/regen-foundation-bridge.sh +import Foundation + import ShellKit +#if canImport(FoundationNetworking) +import FoundationNetworking +#endif + +extension FoundationBridges { + nonisolated(unsafe) static let morphologyCustomPronoun: [String: Bridge] = { + var d: [String: Bridge] = [ + "init Morphology.CustomPronoun()": .`init` { args in + guard args.count == 0 else { + throw RuntimeError.invalid("init Morphology.CustomPronoun(): expected 0 argument(s), got \(args.count)") + } + return boxOpaque(Morphology.CustomPronoun(), typeName: "Morphology.CustomPronoun") + }, + "var Morphology.CustomPronoun.subjectForm: String?": .computed { receiver in + let recv: Morphology.CustomPronoun = try unboxOpaque(receiver, as: Morphology.CustomPronoun.self, typeName: "Morphology.CustomPronoun") + if let _v = recv.subjectForm { + return .optional(.string(_v)) + } + return .optional(nil) + }, + "var Morphology.CustomPronoun.objectForm: String?": .computed { receiver in + let recv: Morphology.CustomPronoun = try unboxOpaque(receiver, as: Morphology.CustomPronoun.self, typeName: "Morphology.CustomPronoun") + if let _v = recv.objectForm { + return .optional(.string(_v)) + } + return .optional(nil) + }, + "var Morphology.CustomPronoun.possessiveForm: String?": .computed { receiver in + let recv: Morphology.CustomPronoun = try unboxOpaque(receiver, as: Morphology.CustomPronoun.self, typeName: "Morphology.CustomPronoun") + if let _v = recv.possessiveForm { + return .optional(.string(_v)) + } + return .optional(nil) + }, + "var Morphology.CustomPronoun.possessiveAdjectiveForm: String?": .computed { receiver in + let recv: Morphology.CustomPronoun = try unboxOpaque(receiver, as: Morphology.CustomPronoun.self, typeName: "Morphology.CustomPronoun") + if let _v = recv.possessiveAdjectiveForm { + return .optional(.string(_v)) + } + return .optional(nil) + }, + "var Morphology.CustomPronoun.reflexiveForm: String?": .computed { receiver in + let recv: Morphology.CustomPronoun = try unboxOpaque(receiver, as: Morphology.CustomPronoun.self, typeName: "Morphology.CustomPronoun") + if let _v = recv.reflexiveForm { + return .optional(.string(_v)) + } + return .optional(nil) + }, + "static func Morphology.CustomPronoun.isSupported()": .staticMethod { args in + guard args.count == 1 else { + throw RuntimeError.invalid("Morphology.CustomPronoun.isSupported: expected 1 argument(s), got \(args.count)") + } + return .bool(Morphology.CustomPronoun.isSupported(forLanguage: try unboxString(args[0]))) + }, + ] + #if canImport(Darwin) + d["var Morphology.CustomPronoun.hashValue: Int"] = .computed { receiver in + let recv: Morphology.CustomPronoun = try unboxOpaque(receiver, as: Morphology.CustomPronoun.self, typeName: "Morphology.CustomPronoun") + return .int(recv.hashValue) + } + #endif + return d + }() +} diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+MorphologyPronoun.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+MorphologyPronoun.swift deleted file mode 100644 index aef74da..0000000 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+MorphologyPronoun.swift +++ /dev/null @@ -1,36 +0,0 @@ -// AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. -// Regenerate with: bash Tools/regen-foundation-bridge.sh -import Foundation -#if canImport(FoundationNetworking) -import FoundationNetworking -#endif - -#if canImport(Darwin) -extension FoundationBridges { - nonisolated(unsafe) static let morphologyPronoun: [String: Bridge] = [ - "var Morphology.Pronoun.pronoun: String": .computed { receiver in - let recv: Morphology.Pronoun = try unboxOpaque(receiver, as: Morphology.Pronoun.self, typeName: "Morphology.Pronoun") - return .string(recv.pronoun) - }, - "var Morphology.Pronoun.morphology: Morphology": .computed { receiver in - let recv: Morphology.Pronoun = try unboxOpaque(receiver, as: Morphology.Pronoun.self, typeName: "Morphology.Pronoun") - return boxOpaque(recv.morphology, typeName: "Morphology") - }, - "var Morphology.Pronoun.dependentMorphology: Morphology?": .computed { receiver in - let recv: Morphology.Pronoun = try unboxOpaque(receiver, as: Morphology.Pronoun.self, typeName: "Morphology.Pronoun") - if let _v = recv.dependentMorphology { - return .optional(boxOpaque(_v, typeName: "Morphology")) - } - return .optional(nil) - }, - "var Morphology.Pronoun.hashValue: Int": .computed { receiver in - let recv: Morphology.Pronoun = try unboxOpaque(receiver, as: Morphology.Pronoun.self, typeName: "Morphology.Pronoun") - return .int(recv.hashValue) - }, - ] -} -#else -extension FoundationBridges { - nonisolated(unsafe) static let morphologyPronoun: [String: Bridge] = [:] -} -#endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSAttributedStringEnumerationOptions.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSAttributedStringEnumerationOptions.swift index ac99f1b..6b4f308 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSAttributedStringEnumerationOptions.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSAttributedStringEnumerationOptions.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSAttributedStringFormattingContextKey.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSAttributedStringFormattingContextKey.swift index a459a9a..0bc264c 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSAttributedStringFormattingContextKey.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSAttributedStringFormattingContextKey.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif @@ -12,7 +13,6 @@ extension FoundationBridges { let recv: NSAttributedStringFormattingContextKey = try unboxOpaque(receiver, as: NSAttributedStringFormattingContextKey.self, typeName: "NSAttributedStringFormattingContextKey") return .int(recv.hashValue) }, - "static let NSAttributedStringFormattingContextKey.inflectionConceptsKey": .staticValue(boxOpaque(NSAttributedStringFormattingContextKey.inflectionConceptsKey, typeName: "NSAttributedStringFormattingContextKey")), "init NSAttributedStringFormattingContextKey(_:)": .`init` { args in guard args.count == 1 else { throw RuntimeError.invalid("init NSAttributedStringFormattingContextKey(_:): expected 1 argument(s), got \(args.count)") diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSAttributedStringKey.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSAttributedStringKey.swift index 5049327..b0d917e 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSAttributedStringKey.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSAttributedStringKey.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif @@ -35,11 +36,6 @@ extension FoundationBridges { d["static let NSAttributedString.Key.languageIdentifier"] = .staticValue(boxOpaque(NSAttributedString.Key.languageIdentifier, typeName: "NSAttributedString.Key")) d["static let NSAttributedString.Key.markdownSourcePosition"] = .staticValue(boxOpaque(NSAttributedString.Key.markdownSourcePosition, typeName: "NSAttributedString.Key")) d["static let NSAttributedString.Key.replacementIndex"] = .staticValue(boxOpaque(NSAttributedString.Key.replacementIndex, typeName: "NSAttributedString.Key")) - d["static let NSAttributedString.Key.agreeWithArgument"] = .staticValue(boxOpaque(NSAttributedString.Key.agreeWithArgument, typeName: "NSAttributedString.Key")) - d["static let NSAttributedString.Key.agreeWithConcept"] = .staticValue(boxOpaque(NSAttributedString.Key.agreeWithConcept, typeName: "NSAttributedString.Key")) - d["static let NSAttributedString.Key.referentConcept"] = .staticValue(boxOpaque(NSAttributedString.Key.referentConcept, typeName: "NSAttributedString.Key")) - d["static let NSAttributedString.Key.localizedNumberFormat"] = .staticValue(boxOpaque(NSAttributedString.Key.localizedNumberFormat, typeName: "NSAttributedString.Key")) - d["static let NSAttributedString.Key.listItemDelimiter"] = .staticValue(boxOpaque(NSAttributedString.Key.listItemDelimiter, typeName: "NSAttributedString.Key")) d["static let NSAttributedString.Key.presentationIntentAttributeName"] = .staticValue(boxOpaque(NSAttributedString.Key.presentationIntentAttributeName, typeName: "NSAttributedString.Key")) #endif return d diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSBinarySearchingOptions.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSBinarySearchingOptions.swift index 25dfa1f..a7c5b89 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSBinarySearchingOptions.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSBinarySearchingOptions.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSCalendarIdentifier.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSCalendarIdentifier.swift index e71d3ec..b5caea9 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSCalendarIdentifier.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSCalendarIdentifier.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif @@ -42,17 +43,6 @@ extension FoundationBridges { let recv: NSCalendar.Identifier = try unboxOpaque(receiver, as: NSCalendar.Identifier.self, typeName: "NSCalendar.Identifier") return .int(recv.hashValue) } - d["static let NSCalendar.Identifier.bangla"] = .staticValue(boxOpaque(NSCalendar.Identifier.bangla, typeName: "NSCalendar.Identifier")) - d["static let NSCalendar.Identifier.gujarati"] = .staticValue(boxOpaque(NSCalendar.Identifier.gujarati, typeName: "NSCalendar.Identifier")) - d["static let NSCalendar.Identifier.kannada"] = .staticValue(boxOpaque(NSCalendar.Identifier.kannada, typeName: "NSCalendar.Identifier")) - d["static let NSCalendar.Identifier.malayalam"] = .staticValue(boxOpaque(NSCalendar.Identifier.malayalam, typeName: "NSCalendar.Identifier")) - d["static let NSCalendar.Identifier.marathi"] = .staticValue(boxOpaque(NSCalendar.Identifier.marathi, typeName: "NSCalendar.Identifier")) - d["static let NSCalendar.Identifier.odia"] = .staticValue(boxOpaque(NSCalendar.Identifier.odia, typeName: "NSCalendar.Identifier")) - d["static let NSCalendar.Identifier.tamil"] = .staticValue(boxOpaque(NSCalendar.Identifier.tamil, typeName: "NSCalendar.Identifier")) - d["static let NSCalendar.Identifier.telugu"] = .staticValue(boxOpaque(NSCalendar.Identifier.telugu, typeName: "NSCalendar.Identifier")) - d["static let NSCalendar.Identifier.vikram"] = .staticValue(boxOpaque(NSCalendar.Identifier.vikram, typeName: "NSCalendar.Identifier")) - d["static let NSCalendar.Identifier.dangi"] = .staticValue(boxOpaque(NSCalendar.Identifier.dangi, typeName: "NSCalendar.Identifier")) - d["static let NSCalendar.Identifier.vietnamese"] = .staticValue(boxOpaque(NSCalendar.Identifier.vietnamese, typeName: "NSCalendar.Identifier")) #endif return d }() diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSCalendarOptions.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSCalendarOptions.swift index 129bed1..e594870 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSCalendarOptions.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSCalendarOptions.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSCalendarUnit.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSCalendarUnit.swift index f484817..f80975d 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSCalendarUnit.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSCalendarUnit.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif @@ -49,9 +50,6 @@ extension FoundationBridges { let recv: NSCalendar.Unit = try unboxOpaque(receiver, as: NSCalendar.Unit.self, typeName: "NSCalendar.Unit") return .bool(recv.isEmpty) } - d["static let NSCalendar.Unit.dayOfYear"] = .staticValue(boxOpaque(NSCalendar.Unit.dayOfYear, typeName: "NSCalendar.Unit")) - d["static let NSCalendar.Unit.isLeapMonth"] = .staticValue(boxOpaque(NSCalendar.Unit.isLeapMonth, typeName: "NSCalendar.Unit")) - d["static let NSCalendar.Unit.isRepeatedDay"] = .staticValue(boxOpaque(NSCalendar.Unit.isRepeatedDay, typeName: "NSCalendar.Unit")) #endif return d }() diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSComparisonPredicateOptions.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSComparisonPredicateOptions.swift index fbf5353..38c28d4 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSComparisonPredicateOptions.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSComparisonPredicateOptions.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSDataBase64DecodingOptions.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSDataBase64DecodingOptions.swift index 08c8dc2..8360da4 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSDataBase64DecodingOptions.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSDataBase64DecodingOptions.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSDataBase64EncodingOptions.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSDataBase64EncodingOptions.swift index f80b5c1..397829c 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSDataBase64EncodingOptions.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSDataBase64EncodingOptions.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSDataReadingOptions.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSDataReadingOptions.swift index dd7da8e..ec68dc2 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSDataReadingOptions.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSDataReadingOptions.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSDataSearchOptions.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSDataSearchOptions.swift index a109c01..9c9beca 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSDataSearchOptions.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSDataSearchOptions.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSDataWritingOptions.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSDataWritingOptions.swift index 6130ebd..0ab7445 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSDataWritingOptions.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSDataWritingOptions.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSEnumerationOptions.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSEnumerationOptions.swift index 181b1fa..8d119bd 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSEnumerationOptions.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSEnumerationOptions.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSExceptionName.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSExceptionName.swift index 671dba6..b415859 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSExceptionName.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSExceptionName.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSFileCoordinatorReadingOptions.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSFileCoordinatorReadingOptions.swift index e085b38..2a412bb 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSFileCoordinatorReadingOptions.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSFileCoordinatorReadingOptions.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSFileCoordinatorWritingOptions.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSFileCoordinatorWritingOptions.swift index 8413ec2..a52c1bc 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSFileCoordinatorWritingOptions.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSFileCoordinatorWritingOptions.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSFileManagerSupportedSyncControls.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSFileManagerSupportedSyncControls.swift deleted file mode 100644 index 2c3af5d..0000000 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSFileManagerSupportedSyncControls.swift +++ /dev/null @@ -1,112 +0,0 @@ -// AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. -// Regenerate with: bash Tools/regen-foundation-bridge.sh -import Foundation -#if canImport(FoundationNetworking) -import FoundationNetworking -#endif - -#if canImport(Darwin) -extension FoundationBridges { - nonisolated(unsafe) static let nSFileManagerSupportedSyncControls: [String: Bridge] = [ - "init NSFileManagerSupportedSyncControls()": .`init` { args in - guard args.count == 0 else { - throw RuntimeError.invalid("init NSFileManagerSupportedSyncControls(): expected 0 argument(s), got \(args.count)") - } - return boxOpaque(NSFileManagerSupportedSyncControls(), typeName: "NSFileManagerSupportedSyncControls") - }, - "var NSFileManagerSupportedSyncControls.isEmpty: Bool": .computed { receiver in - let recv: NSFileManagerSupportedSyncControls = try unboxOpaque(receiver, as: NSFileManagerSupportedSyncControls.self, typeName: "NSFileManagerSupportedSyncControls") - return .bool(recv.isEmpty) - }, - "static let NSFileManagerSupportedSyncControls.pauseSync": .staticValue(boxOpaque(NSFileManagerSupportedSyncControls.pauseSync, typeName: "NSFileManagerSupportedSyncControls")), - "static let NSFileManagerSupportedSyncControls.failUploadOnConflict": .staticValue(boxOpaque(NSFileManagerSupportedSyncControls.failUploadOnConflict, typeName: "NSFileManagerSupportedSyncControls")), - "func NSFileManagerSupportedSyncControls.union()": .method { receiver, args in - guard args.count == 1 else { - throw RuntimeError.invalid("NSFileManagerSupportedSyncControls.union: expected 1 argument(s), got \(args.count)") - } - let recv: NSFileManagerSupportedSyncControls = try unboxOpaque(receiver, as: NSFileManagerSupportedSyncControls.self, typeName: "NSFileManagerSupportedSyncControls") - return boxOpaque(recv.union(try unboxOpaque(args[0], as: NSFileManagerSupportedSyncControls.self, typeName: "NSFileManagerSupportedSyncControls")), typeName: "NSFileManagerSupportedSyncControls") - }, - "func NSFileManagerSupportedSyncControls.intersection()": .method { receiver, args in - guard args.count == 1 else { - throw RuntimeError.invalid("NSFileManagerSupportedSyncControls.intersection: expected 1 argument(s), got \(args.count)") - } - let recv: NSFileManagerSupportedSyncControls = try unboxOpaque(receiver, as: NSFileManagerSupportedSyncControls.self, typeName: "NSFileManagerSupportedSyncControls") - return boxOpaque(recv.intersection(try unboxOpaque(args[0], as: NSFileManagerSupportedSyncControls.self, typeName: "NSFileManagerSupportedSyncControls")), typeName: "NSFileManagerSupportedSyncControls") - }, - "func NSFileManagerSupportedSyncControls.symmetricDifference()": .method { receiver, args in - guard args.count == 1 else { - throw RuntimeError.invalid("NSFileManagerSupportedSyncControls.symmetricDifference: expected 1 argument(s), got \(args.count)") - } - let recv: NSFileManagerSupportedSyncControls = try unboxOpaque(receiver, as: NSFileManagerSupportedSyncControls.self, typeName: "NSFileManagerSupportedSyncControls") - return boxOpaque(recv.symmetricDifference(try unboxOpaque(args[0], as: NSFileManagerSupportedSyncControls.self, typeName: "NSFileManagerSupportedSyncControls")), typeName: "NSFileManagerSupportedSyncControls") - }, - "func NSFileManagerSupportedSyncControls.contains()": .method { receiver, args in - guard args.count == 1 else { - throw RuntimeError.invalid("NSFileManagerSupportedSyncControls.contains: expected 1 argument(s), got \(args.count)") - } - let recv: NSFileManagerSupportedSyncControls = try unboxOpaque(receiver, as: NSFileManagerSupportedSyncControls.self, typeName: "NSFileManagerSupportedSyncControls") - return .bool(recv.contains(try unboxOpaque(args[0], as: NSFileManagerSupportedSyncControls.self, typeName: "NSFileManagerSupportedSyncControls"))) - }, - "func NSFileManagerSupportedSyncControls.isSubset()": .method { receiver, args in - guard args.count == 1 else { - throw RuntimeError.invalid("NSFileManagerSupportedSyncControls.isSubset: expected 1 argument(s), got \(args.count)") - } - let recv: NSFileManagerSupportedSyncControls = try unboxOpaque(receiver, as: NSFileManagerSupportedSyncControls.self, typeName: "NSFileManagerSupportedSyncControls") - return .bool(recv.isSubset(of: try unboxOpaque(args[0], as: NSFileManagerSupportedSyncControls.self, typeName: "NSFileManagerSupportedSyncControls"))) - }, - "func NSFileManagerSupportedSyncControls.isSuperset()": .method { receiver, args in - guard args.count == 1 else { - throw RuntimeError.invalid("NSFileManagerSupportedSyncControls.isSuperset: expected 1 argument(s), got \(args.count)") - } - let recv: NSFileManagerSupportedSyncControls = try unboxOpaque(receiver, as: NSFileManagerSupportedSyncControls.self, typeName: "NSFileManagerSupportedSyncControls") - return .bool(recv.isSuperset(of: try unboxOpaque(args[0], as: NSFileManagerSupportedSyncControls.self, typeName: "NSFileManagerSupportedSyncControls"))) - }, - "func NSFileManagerSupportedSyncControls.isDisjoint()": .method { receiver, args in - guard args.count == 1 else { - throw RuntimeError.invalid("NSFileManagerSupportedSyncControls.isDisjoint: expected 1 argument(s), got \(args.count)") - } - let recv: NSFileManagerSupportedSyncControls = try unboxOpaque(receiver, as: NSFileManagerSupportedSyncControls.self, typeName: "NSFileManagerSupportedSyncControls") - return .bool(recv.isDisjoint(with: try unboxOpaque(args[0], as: NSFileManagerSupportedSyncControls.self, typeName: "NSFileManagerSupportedSyncControls"))) - }, - "func NSFileManagerSupportedSyncControls.subtracting()": .method { receiver, args in - guard args.count == 1 else { - throw RuntimeError.invalid("NSFileManagerSupportedSyncControls.subtracting: expected 1 argument(s), got \(args.count)") - } - let recv: NSFileManagerSupportedSyncControls = try unboxOpaque(receiver, as: NSFileManagerSupportedSyncControls.self, typeName: "NSFileManagerSupportedSyncControls") - return boxOpaque(recv.subtracting(try unboxOpaque(args[0], as: NSFileManagerSupportedSyncControls.self, typeName: "NSFileManagerSupportedSyncControls")), typeName: "NSFileManagerSupportedSyncControls") - }, - "func NSFileManagerSupportedSyncControls.isStrictSuperset()": .method { receiver, args in - guard args.count == 1 else { - throw RuntimeError.invalid("NSFileManagerSupportedSyncControls.isStrictSuperset: expected 1 argument(s), got \(args.count)") - } - let recv: NSFileManagerSupportedSyncControls = try unboxOpaque(receiver, as: NSFileManagerSupportedSyncControls.self, typeName: "NSFileManagerSupportedSyncControls") - return .bool(recv.isStrictSuperset(of: try unboxOpaque(args[0], as: NSFileManagerSupportedSyncControls.self, typeName: "NSFileManagerSupportedSyncControls"))) - }, - "func NSFileManagerSupportedSyncControls.isStrictSubset()": .method { receiver, args in - guard args.count == 1 else { - throw RuntimeError.invalid("NSFileManagerSupportedSyncControls.isStrictSubset: expected 1 argument(s), got \(args.count)") - } - let recv: NSFileManagerSupportedSyncControls = try unboxOpaque(receiver, as: NSFileManagerSupportedSyncControls.self, typeName: "NSFileManagerSupportedSyncControls") - return .bool(recv.isStrictSubset(of: try unboxOpaque(args[0], as: NSFileManagerSupportedSyncControls.self, typeName: "NSFileManagerSupportedSyncControls"))) - }, - "init NSFileManagerSupportedSyncControls(arrayLiteral:)": .`init` { args in - guard args.count == 1, case .array(let elements) = args[0] else { - throw RuntimeError.invalid("NSFileManagerSupportedSyncControls(arrayLiteral:): expected array literal") - } - var result = NSFileManagerSupportedSyncControls() - for element in elements { - let item: NSFileManagerSupportedSyncControls = try unboxOpaque( - element, as: NSFileManagerSupportedSyncControls.self, typeName: "NSFileManagerSupportedSyncControls" - ) - result.formUnion(item) - } - return boxOpaque(result, typeName: "NSFileManagerSupportedSyncControls") - }, - ] -} -#else -extension FoundationBridges { - nonisolated(unsafe) static let nSFileManagerSupportedSyncControls: [String: Bridge] = [:] -} -#endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSFileProviderServiceName.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSFileProviderServiceName.swift index 1bcee1e..98dc040 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSFileProviderServiceName.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSFileProviderServiceName.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSFileVersionAddingOptions.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSFileVersionAddingOptions.swift index a20a8d2..4376195 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSFileVersionAddingOptions.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSFileVersionAddingOptions.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSFileVersionReplacingOptions.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSFileVersionReplacingOptions.swift index 969442b..2a7ff74 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSFileVersionReplacingOptions.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSFileVersionReplacingOptions.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSItemProviderFileOptions.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSItemProviderFileOptions.swift index 5ac1e76..29f61a5 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSItemProviderFileOptions.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSItemProviderFileOptions.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSKeyValueChangeKey.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSKeyValueChangeKey.swift index a44d580..99a5f95 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSKeyValueChangeKey.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSKeyValueChangeKey.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSKeyValueObservingOptions.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSKeyValueObservingOptions.swift index 7af9196..84f5a49 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSKeyValueObservingOptions.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSKeyValueObservingOptions.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSKeyValueOperator.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSKeyValueOperator.swift index 91a304b..ce2098e 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSKeyValueOperator.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSKeyValueOperator.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSLinguisticTag.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSLinguisticTag.swift index c5433db..17e59a9 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSLinguisticTag.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSLinguisticTag.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSLinguisticTagScheme.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSLinguisticTagScheme.swift index 083c512..e92a328 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSLinguisticTagScheme.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSLinguisticTagScheme.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSLinguisticTaggerOptions.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSLinguisticTaggerOptions.swift index 4972249..623d072 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSLinguisticTaggerOptions.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSLinguisticTaggerOptions.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSLocaleKey.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSLocaleKey.swift index 738347d..ea9d4c7 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSLocaleKey.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSLocaleKey.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSMachPortOptions.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSMachPortOptions.swift index 875a68e..7210143 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSMachPortOptions.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSMachPortOptions.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSNotificationName.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSNotificationName.swift index 1bb7bad..bff3149 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSNotificationName.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSNotificationName.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif @@ -10,6 +11,9 @@ extension FoundationBridges { var d: [String: Bridge] = [ "static let NSNotification.Name.NSCalendarDayChanged": .staticValue(boxOpaque(NSNotification.Name.NSCalendarDayChanged, typeName: "NSNotification.Name")), "static let NSNotification.Name.NSSystemTimeZoneDidChange": .staticValue(boxOpaque(NSNotification.Name.NSSystemTimeZoneDidChange, typeName: "NSNotification.Name")), + "static let NSNotification.Name.NSWillBecomeMultiThreaded": .staticValue(boxOpaque(NSNotification.Name.NSWillBecomeMultiThreaded, typeName: "NSNotification.Name")), + "static let NSNotification.Name.NSDidBecomeSingleThreaded": .staticValue(boxOpaque(NSNotification.Name.NSDidBecomeSingleThreaded, typeName: "NSNotification.Name")), + "static let NSNotification.Name.NSThreadWillExit": .staticValue(boxOpaque(NSNotification.Name.NSThreadWillExit, typeName: "NSNotification.Name")), "init NSNotification.Name(_:)": .`init` { args in guard args.count == 1 else { throw RuntimeError.invalid("init NSNotification.Name(_:): expected 1 argument(s), got \(args.count)") diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSOrderedCollectionDifferenceCalculationOptions.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSOrderedCollectionDifferenceCalculationOptions.swift index 516b2fe..5089ac8 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSOrderedCollectionDifferenceCalculationOptions.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSOrderedCollectionDifferenceCalculationOptions.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSPointerFunctionsOptions.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSPointerFunctionsOptions.swift index 2fc230f..ceebb39 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSPointerFunctionsOptions.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSPointerFunctionsOptions.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSRegularExpressionMatchingFlags.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSRegularExpressionMatchingFlags.swift index 5946101..69ed4cd 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSRegularExpressionMatchingFlags.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSRegularExpressionMatchingFlags.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSRegularExpressionMatchingOptions.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSRegularExpressionMatchingOptions.swift index 785deac..627bd8a 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSRegularExpressionMatchingOptions.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSRegularExpressionMatchingOptions.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSRegularExpressionOptions.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSRegularExpressionOptions.swift index 38021fe..3eedf5e 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSRegularExpressionOptions.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSRegularExpressionOptions.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSSortOptions.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSSortOptions.swift index aaac7d3..58be461 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSSortOptions.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSSortOptions.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSStringCompareOptions.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSStringCompareOptions.swift index 183a4d6..38daac6 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSStringCompareOptions.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSStringCompareOptions.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSStringEncodingConversionOptions.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSStringEncodingConversionOptions.swift index e2e8128..fda9df1 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSStringEncodingConversionOptions.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSStringEncodingConversionOptions.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSStringEnumerationOptions.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSStringEnumerationOptions.swift index c800fa9..54bf5ae 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSStringEnumerationOptions.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSStringEnumerationOptions.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSTextCheckingKey.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSTextCheckingKey.swift index c39bc45..0929908 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSTextCheckingKey.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSTextCheckingKey.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSTextCheckingResultCheckingType.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSTextCheckingResultCheckingType.swift index 418a184..f0bf686 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSTextCheckingResultCheckingType.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSTextCheckingResultCheckingType.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSURLBookmarkCreationOptions.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSURLBookmarkCreationOptions.swift index 5d81456..077b6a3 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSURLBookmarkCreationOptions.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSURLBookmarkCreationOptions.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSURLBookmarkResolutionOptions.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSURLBookmarkResolutionOptions.swift index e627b77..68ed0c7 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSURLBookmarkResolutionOptions.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSURLBookmarkResolutionOptions.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSValueTransformerName.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSValueTransformerName.swift index 34be02a..09d75b4 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSValueTransformerName.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSValueTransformerName.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSXPCConnectionOptions.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSXPCConnectionOptions.swift index 71fc48b..c50981c 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSXPCConnectionOptions.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NSXPCConnectionOptions.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NetServiceOptions.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NetServiceOptions.swift index a949028..9117335 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NetServiceOptions.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NetServiceOptions.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+Notification.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+Notification.swift index e209b69..2d968d5 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+Notification.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+Notification.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NotificationQueueNotificationCoalescing.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NotificationQueueNotificationCoalescing.swift index 2ce277b..fce2d2a 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NotificationQueueNotificationCoalescing.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NotificationQueueNotificationCoalescing.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NumberFormatStyleConfigurationDecimalSeparatorDisplayStrategy.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NumberFormatStyleConfigurationDecimalSeparatorDisplayStrategy.swift index 583692f..0397231 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NumberFormatStyleConfigurationDecimalSeparatorDisplayStrategy.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NumberFormatStyleConfigurationDecimalSeparatorDisplayStrategy.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NumberFormatStyleConfigurationGrouping.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NumberFormatStyleConfigurationGrouping.swift index 6915dda..7c800fa 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NumberFormatStyleConfigurationGrouping.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NumberFormatStyleConfigurationGrouping.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NumberFormatStyleConfigurationNotation.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NumberFormatStyleConfigurationNotation.swift index 3a38a03..d1e46ff 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NumberFormatStyleConfigurationNotation.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NumberFormatStyleConfigurationNotation.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NumberFormatStyleConfigurationPrecision.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NumberFormatStyleConfigurationPrecision.swift index 39dc76e..470cd4e 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NumberFormatStyleConfigurationPrecision.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NumberFormatStyleConfigurationPrecision.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NumberFormatStyleConfigurationSignDisplayStrategy.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NumberFormatStyleConfigurationSignDisplayStrategy.swift index e167e9a..4ab2cfa 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NumberFormatStyleConfigurationSignDisplayStrategy.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+NumberFormatStyleConfigurationSignDisplayStrategy.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ObjectIdentifier.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ObjectIdentifier.swift index 2738fe0..76e46d0 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ObjectIdentifier.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ObjectIdentifier.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+OpaquePointer.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+OpaquePointer.swift index 1905df7..eb89291 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+OpaquePointer.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+OpaquePointer.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+OperationQueueSchedulerTimeType.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+OperationQueueSchedulerTimeType.swift index 996bef7..0e22db3 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+OperationQueueSchedulerTimeType.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+OperationQueueSchedulerTimeType.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+POSIXError.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+POSIXError.swift index e34af6b..1c50738 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+POSIXError.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+POSIXError.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PersonNameComponents.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PersonNameComponents.swift index 81459af..eb5122a 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PersonNameComponents.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PersonNameComponents.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PersonNameComponentsAttributedStyle.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PersonNameComponentsAttributedStyle.swift index cb86a59..9d2ab27 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PersonNameComponentsAttributedStyle.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PersonNameComponentsAttributedStyle.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PersonNameComponentsFormatStyle.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PersonNameComponentsFormatStyle.swift index ac2cc88..24cbb31 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PersonNameComponentsFormatStyle.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PersonNameComponentsFormatStyle.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PersonNameComponentsFormatterOptions.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PersonNameComponentsFormatterOptions.swift index 30c4f92..c64b2d5 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PersonNameComponentsFormatterOptions.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PersonNameComponentsFormatterOptions.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PersonNameComponentsParseStrategy.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PersonNameComponentsParseStrategy.swift index 5ce6fe8..5e1dd6c 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PersonNameComponentsParseStrategy.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PersonNameComponentsParseStrategy.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PredicateError.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PredicateError.swift deleted file mode 100644 index 663db74..0000000 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PredicateError.swift +++ /dev/null @@ -1,32 +0,0 @@ -// AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. -// Regenerate with: bash Tools/regen-foundation-bridge.sh -import Foundation -#if canImport(FoundationNetworking) -import FoundationNetworking -#endif - -extension FoundationBridges { - nonisolated(unsafe) static let predicateError: [String: Bridge] = { - var d: [String: Bridge] = [ - "var PredicateError.debugDescription: String": .computed { receiver in - let recv: PredicateError = try unboxOpaque(receiver, as: PredicateError.self, typeName: "PredicateError") - return .string(recv.debugDescription) - }, - "static let PredicateError.undefinedVariable": .staticValue(boxOpaque(PredicateError.undefinedVariable, typeName: "PredicateError")), - "static let PredicateError.forceUnwrapFailure": .staticValue(boxOpaque(PredicateError.forceUnwrapFailure, typeName: "PredicateError")), - "static let PredicateError.forceCastFailure": .staticValue(boxOpaque(PredicateError.forceCastFailure, typeName: "PredicateError")), - "static let PredicateError.invalidInput": .staticValue(boxOpaque(PredicateError.invalidInput, typeName: "PredicateError")), - ] - #if canImport(Darwin) - d["var PredicateError.localizedDescription: String"] = .computed { receiver in - let recv: PredicateError = try unboxOpaque(receiver, as: PredicateError.self, typeName: "PredicateError") - return .string(recv.localizedDescription) - } - d["var PredicateError.hashValue: Int"] = .computed { receiver in - let recv: PredicateError = try unboxOpaque(receiver, as: PredicateError.self, typeName: "PredicateError") - return .int(recv.hashValue) - } - #endif - return d - }() -} diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PredicateExpressionsVariableID.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PredicateExpressionsVariableID.swift deleted file mode 100644 index 89e1550..0000000 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PredicateExpressionsVariableID.swift +++ /dev/null @@ -1,19 +0,0 @@ -// AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. -// Regenerate with: bash Tools/regen-foundation-bridge.sh -import Foundation -#if canImport(FoundationNetworking) -import FoundationNetworking -#endif - -extension FoundationBridges { - nonisolated(unsafe) static let predicateExpressionsVariableID: [String: Bridge] = { - var d: [String: Bridge] = [:] - #if canImport(Darwin) - d["var PredicateExpressions.VariableID.hashValue: Int"] = .computed { receiver in - let recv: PredicateExpressions.VariableID = try unboxOpaque(receiver, as: PredicateExpressions.VariableID.self, typeName: "PredicateExpressions.VariableID") - return .int(recv.hashValue) - } - #endif - return d - }() -} diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PresentationIntent.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PresentationIntent.swift index 6ef2658..fa25153 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PresentationIntent.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PresentationIntent.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PresentationIntentIntentType.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PresentationIntentIntentType.swift index 7688683..aac9cc1 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PresentationIntentIntentType.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PresentationIntentIntentType.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PresentationIntentTableColumn.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PresentationIntentTableColumn.swift index f9b6dff..4153f2b 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PresentationIntentTableColumn.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PresentationIntentTableColumn.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ProcessInfo.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ProcessInfo.swift index 2ae8584..5738821 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ProcessInfo.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ProcessInfo.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif @@ -9,13 +10,11 @@ extension FoundationBridges { nonisolated(unsafe) static let processInfo: [String: Bridge] = { var d: [String: Bridge] = [ "static let ProcessInfo.processInfo": .staticValue(boxOpaque(ProcessInfo.processInfo, typeName: "ProcessInfo")), - "var ProcessInfo.hostName: String": .computed { receiver in - let recv: ProcessInfo = try unboxOpaque(receiver, as: ProcessInfo.self, typeName: "ProcessInfo") - return .string(recv.hostName) + "var ProcessInfo.hostName: String": .computed { _ in + return .string(hostNameOverride()) }, - "var ProcessInfo.processName: String": .computed { receiver in - let recv: ProcessInfo = try unboxOpaque(receiver, as: ProcessInfo.self, typeName: "ProcessInfo") - return .string(recv.processName) + "var ProcessInfo.processName: String": .computed { _ in + return .string(hostProcessName()) }, "set var ProcessInfo.processName: String": .setter { receiver, newValue in let recv: ProcessInfo = try unboxOpaque(receiver, as: ProcessInfo.self, typeName: "ProcessInfo") diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ProcessInfoActivityOptions.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ProcessInfoActivityOptions.swift index 2adcb23..014410f 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ProcessInfoActivityOptions.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ProcessInfoActivityOptions.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ProgressFileOperationKind.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ProgressFileOperationKind.swift index 83dd609..23faa64 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ProgressFileOperationKind.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ProgressFileOperationKind.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ProgressKind.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ProgressKind.swift index 46698f9..c628c7b 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ProgressKind.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ProgressKind.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ProgressUserInfoKey.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ProgressUserInfoKey.swift index 9791ea3..f0bbccd 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ProgressUserInfoKey.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+ProgressUserInfoKey.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PropertyListDecoder.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PropertyListDecoder.swift index f7b490c..d5dfff0 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PropertyListDecoder.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PropertyListDecoder.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PropertyListEncoder.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PropertyListEncoder.swift index abcc0b1..2eabe40 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PropertyListEncoder.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PropertyListEncoder.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PropertyListSerializationMutabilityOptions.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PropertyListSerializationMutabilityOptions.swift index b7a62a3..9c11b01 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PropertyListSerializationMutabilityOptions.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+PropertyListSerializationMutabilityOptions.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+RegexRepetitionBehavior.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+RegexRepetitionBehavior.swift index af9c051..fcdabd2 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+RegexRepetitionBehavior.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+RegexRepetitionBehavior.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+RegexSemanticLevel.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+RegexSemanticLevel.swift index 6fa7226..01f9598 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+RegexSemanticLevel.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+RegexSemanticLevel.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+RegexWordBoundaryKind.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+RegexWordBoundaryKind.swift index 6bd0655..9dbd191 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+RegexWordBoundaryKind.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+RegexWordBoundaryKind.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+RunLoopMode.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+RunLoopMode.swift index fb14d66..e764ac0 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+RunLoopMode.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+RunLoopMode.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+RunLoopSchedulerTimeType.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+RunLoopSchedulerTimeType.swift index 78e1381..33c3346 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+RunLoopSchedulerTimeType.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+RunLoopSchedulerTimeType.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StreamEvent.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StreamEvent.swift index 5cca993..f743c98 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StreamEvent.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StreamEvent.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StreamNetworkServiceTypeValue.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StreamNetworkServiceTypeValue.swift index 3f08686..8115f15 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StreamNetworkServiceTypeValue.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StreamNetworkServiceTypeValue.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StreamPropertyKey.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StreamPropertyKey.swift index e0e6192..535ece8 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StreamPropertyKey.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StreamPropertyKey.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StreamSOCKSProxyConfiguration.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StreamSOCKSProxyConfiguration.swift index 2b887c3..620d384 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StreamSOCKSProxyConfiguration.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StreamSOCKSProxyConfiguration.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StreamSOCKSProxyVersion.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StreamSOCKSProxyVersion.swift index ecec177..b322a52 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StreamSOCKSProxyVersion.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StreamSOCKSProxyVersion.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StreamSocketSecurityLevel.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StreamSocketSecurityLevel.swift index c8523ba..9668741 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StreamSocketSecurityLevel.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StreamSocketSecurityLevel.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StringComparator.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StringComparator.swift index 173d7a8..fc3bb7e 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StringComparator.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StringComparator.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StringEncoding.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StringEncoding.swift index 73d7e3d..4b327d6 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StringEncoding.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StringEncoding.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StringEncodingDetectionOptionsKey.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StringEncodingDetectionOptionsKey.swift index e278e8f..c32420f 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StringEncodingDetectionOptionsKey.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StringEncodingDetectionOptionsKey.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StringLocalizationValue.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StringLocalizationValue.swift index 60cd147..1d51e5d 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StringLocalizationValue.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StringLocalizationValue.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StringStandardComparator.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StringStandardComparator.swift index 40877e0..26d8612 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StringStandardComparator.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StringStandardComparator.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StringStyle.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StringStyle.swift index 0bc0a96..7141b66 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StringStyle.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StringStyle.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StringTransform.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StringTransform.swift index 35f87c7..4d42f37 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StringTransform.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+StringTransform.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+TaskPriority.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+TaskPriority.swift index 9770afc..166c8a3 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+TaskPriority.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+TaskPriority.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif @@ -13,18 +14,5 @@ extension FoundationBridges { "static let TaskPriority.userInitiated": .staticValue(boxOpaque(TaskPriority.userInitiated, typeName: "TaskPriority")), "static let TaskPriority.utility": .staticValue(boxOpaque(TaskPriority.utility, typeName: "TaskPriority")), "static let TaskPriority.background": .staticValue(boxOpaque(TaskPriority.background, typeName: "TaskPriority")), - "var TaskPriority.description: String": .computed { receiver in - let recv: TaskPriority = try unboxOpaque(receiver, as: TaskPriority.self, typeName: "TaskPriority") - return .string(recv.description) - }, - "init TaskPriority(_:)": .`init` { args in - guard args.count == 1 else { - throw RuntimeError.invalid("init TaskPriority(_:): expected 1 argument(s), got \(args.count)") - } - if let _v = TaskPriority(try unboxOpaque(args[0], as: JobPriority.self, typeName: "JobPriority")) { - return .optional(boxOpaque(_v, typeName: "TaskPriority")) - } - return .optional(nil) - }, ] } diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+TermOfAddress.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+TermOfAddress.swift deleted file mode 100644 index 92ab894..0000000 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+TermOfAddress.swift +++ /dev/null @@ -1,32 +0,0 @@ -// AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. -// Regenerate with: bash Tools/regen-foundation-bridge.sh -import Foundation -#if canImport(FoundationNetworking) -import FoundationNetworking -#endif - -#if canImport(Darwin) -extension FoundationBridges { - nonisolated(unsafe) static let termOfAddress: [String: Bridge] = [ - "var TermOfAddress.language: Locale.Language?": .computed { receiver in - let recv: TermOfAddress = try unboxOpaque(receiver, as: TermOfAddress.self, typeName: "TermOfAddress") - if let _v = recv.language { - return .optional(boxOpaque(_v, typeName: "Locale.Language")) - } - return .optional(nil) - }, - "static let TermOfAddress.neutral": .staticValue(boxOpaque(TermOfAddress.neutral, typeName: "TermOfAddress")), - "static let TermOfAddress.feminine": .staticValue(boxOpaque(TermOfAddress.feminine, typeName: "TermOfAddress")), - "static let TermOfAddress.masculine": .staticValue(boxOpaque(TermOfAddress.masculine, typeName: "TermOfAddress")), - "static let TermOfAddress.currentUser": .staticValue(boxOpaque(TermOfAddress.currentUser, typeName: "TermOfAddress")), - "var TermOfAddress.hashValue: Int": .computed { receiver in - let recv: TermOfAddress = try unboxOpaque(receiver, as: TermOfAddress.self, typeName: "TermOfAddress") - return .int(recv.hashValue) - }, - ] -} -#else -extension FoundationBridges { - nonisolated(unsafe) static let termOfAddress: [String: Bridge] = [:] -} -#endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+TimeZone.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+TimeZone.swift index 8879b3c..f7b27aa 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+TimeZone.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+TimeZone.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URL.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URL.swift index 5513d28..e6e39fd 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URL.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URL.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif @@ -261,15 +262,6 @@ extension FoundationBridges { } return boxOpaque(URL(fileReferenceLiteralResourceName: try unboxString(args[0])), typeName: "URL") }, - "init URL(string:encodingInvalidCharacters:)": .`init` { args in - guard args.count == 2 else { - throw RuntimeError.invalid("init URL(string:encodingInvalidCharacters:): expected 2 argument(s), got \(args.count)") - } - if let _v = URL(string: try unboxString(args[0]), encodingInvalidCharacters: try unboxBool(args[1])) { - return .optional(boxOpaque(_v, typeName: "URL")) - } - return .optional(nil) - }, "init URL(fileURLWithPath:isDirectory:)": .`init` { args in guard args.count == 2 else { throw RuntimeError.invalid("init URL(fileURLWithPath:isDirectory:): expected 2 argument(s), got \(args.count)") diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLComponents.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLComponents.swift index d1fe92f..c53cf47 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLComponents.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLComponents.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif @@ -152,15 +153,6 @@ extension FoundationBridges { return .optional(boxOpaque(_v, typeName: "URLComponents")) } return .optional(nil) - }, - "init URLComponents(string:encodingInvalidCharacters:)": .`init` { args in - guard args.count == 2 else { - throw RuntimeError.invalid("init URLComponents(string:encodingInvalidCharacters:): expected 2 argument(s), got \(args.count)") - } - if let _v = URLComponents(string: try unboxString(args[0]), encodingInvalidCharacters: try unboxBool(args[1])) { - return .optional(boxOpaque(_v, typeName: "URLComponents")) - } - return .optional(nil) }, ] #if canImport(Darwin) diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLError.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLError.swift index 7f96154..ed85db0 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLError.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLError.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif @@ -83,13 +84,6 @@ extension FoundationBridges { } return .optional(nil) } - d["var URLError.uploadTaskResumeData: Data?"] = .computed { receiver in - let recv: URLError = try unboxOpaque(receiver, as: URLError.self, typeName: "URLError") - if let _v = recv.uploadTaskResumeData { - return .optional(boxOpaque(_v, typeName: "Data")) - } - return .optional(nil) - } d["static let URLError.appTransportSecurityRequiresSecureConnection"] = .staticValue(boxOpaque(URLError.appTransportSecurityRequiresSecureConnection, typeName: "URLError.Code")) d["static let URLError.dataLengthExceedsMaximum"] = .staticValue(boxOpaque(URLError.dataLengthExceedsMaximum, typeName: "URLError.Code")) #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLErrorCode.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLErrorCode.swift index a67a40e..715bd8d 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLErrorCode.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLErrorCode.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLFileProtection.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLFileProtection.swift index 4d3101e..6987b00 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLFileProtection.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLFileProtection.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLFileResourceType.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLFileResourceType.swift index 7633037..bd517cd 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLFileResourceType.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLFileResourceType.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLFormatStyle.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLFormatStyle.swift index 900a4cd..81e5481 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLFormatStyle.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLFormatStyle.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLParseStrategy.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLParseStrategy.swift index d258673..dfb4229 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLParseStrategy.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLParseStrategy.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLQueryItem.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLQueryItem.swift index 7ff70f1..dba58f3 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLQueryItem.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLQueryItem.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLRequest.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLRequest.swift index 70d7e4a..856e6e5 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLRequest.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLRequest.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif @@ -86,21 +87,6 @@ extension FoundationBridges { let recv: URLRequest = try unboxOpaque(receiver, as: URLRequest.self, typeName: "URLRequest") return .bool(recv.assumesHTTP3Capable) } - d["var URLRequest.requiresDNSSECValidation: Bool"] = .computed { receiver in - let recv: URLRequest = try unboxOpaque(receiver, as: URLRequest.self, typeName: "URLRequest") - return .bool(recv.requiresDNSSECValidation) - } - d["var URLRequest.allowsPersistentDNS: Bool"] = .computed { receiver in - let recv: URLRequest = try unboxOpaque(receiver, as: URLRequest.self, typeName: "URLRequest") - return .bool(recv.allowsPersistentDNS) - } - d["var URLRequest.cookiePartitionIdentifier: String?"] = .computed { receiver in - let recv: URLRequest = try unboxOpaque(receiver, as: URLRequest.self, typeName: "URLRequest") - if let _v = recv.cookiePartitionIdentifier { - return .optional(.string(_v)) - } - return .optional(nil) - } d["var URLRequest.hashValue: Int"] = .computed { receiver in let recv: URLRequest = try unboxOpaque(receiver, as: URLRequest.self, typeName: "URLRequest") return .int(recv.hashValue) diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLResource.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLResource.swift index 7bf0ff1..427046f 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLResource.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLResource.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLResourceKey.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLResourceKey.swift index 077582f..09b3ca5 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLResourceKey.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLResourceKey.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif @@ -121,30 +122,23 @@ extension FoundationBridges { return .int(recv.hashValue) } d["static let URLResourceKey.contentTypeKey"] = .staticValue(boxOpaque(URLResourceKey.contentTypeKey, typeName: "URLResourceKey")) - d["static let URLResourceKey.fileIdentifierKey"] = .staticValue(boxOpaque(URLResourceKey.fileIdentifierKey, typeName: "URLResourceKey")) d["static let URLResourceKey.fileContentIdentifierKey"] = .staticValue(boxOpaque(URLResourceKey.fileContentIdentifierKey, typeName: "URLResourceKey")) d["static let URLResourceKey.mayShareFileContentKey"] = .staticValue(boxOpaque(URLResourceKey.mayShareFileContentKey, typeName: "URLResourceKey")) d["static let URLResourceKey.mayHaveExtendedAttributesKey"] = .staticValue(boxOpaque(URLResourceKey.mayHaveExtendedAttributesKey, typeName: "URLResourceKey")) d["static let URLResourceKey.isPurgeableKey"] = .staticValue(boxOpaque(URLResourceKey.isPurgeableKey, typeName: "URLResourceKey")) d["static let URLResourceKey.isSparseKey"] = .staticValue(boxOpaque(URLResourceKey.isSparseKey, typeName: "URLResourceKey")) d["static let URLResourceKey.fileProtectionKey"] = .staticValue(boxOpaque(URLResourceKey.fileProtectionKey, typeName: "URLResourceKey")) - d["static let URLResourceKey.directoryEntryCountKey"] = .staticValue(boxOpaque(URLResourceKey.directoryEntryCountKey, typeName: "URLResourceKey")) d["static let URLResourceKey.volumeSupportsImmutableFilesKey"] = .staticValue(boxOpaque(URLResourceKey.volumeSupportsImmutableFilesKey, typeName: "URLResourceKey")) d["static let URLResourceKey.volumeSupportsAccessPermissionsKey"] = .staticValue(boxOpaque(URLResourceKey.volumeSupportsAccessPermissionsKey, typeName: "URLResourceKey")) d["static let URLResourceKey.volumeSupportsFileProtectionKey"] = .staticValue(boxOpaque(URLResourceKey.volumeSupportsFileProtectionKey, typeName: "URLResourceKey")) d["static let URLResourceKey.volumeAvailableCapacityForImportantUsageKey"] = .staticValue(boxOpaque(URLResourceKey.volumeAvailableCapacityForImportantUsageKey, typeName: "URLResourceKey")) d["static let URLResourceKey.volumeAvailableCapacityForOpportunisticUsageKey"] = .staticValue(boxOpaque(URLResourceKey.volumeAvailableCapacityForOpportunisticUsageKey, typeName: "URLResourceKey")) - d["static let URLResourceKey.volumeTypeNameKey"] = .staticValue(boxOpaque(URLResourceKey.volumeTypeNameKey, typeName: "URLResourceKey")) - d["static let URLResourceKey.volumeSubtypeKey"] = .staticValue(boxOpaque(URLResourceKey.volumeSubtypeKey, typeName: "URLResourceKey")) - d["static let URLResourceKey.volumeMountFromLocationKey"] = .staticValue(boxOpaque(URLResourceKey.volumeMountFromLocationKey, typeName: "URLResourceKey")) d["static let URLResourceKey.ubiquitousItemIsExcludedFromSyncKey"] = .staticValue(boxOpaque(URLResourceKey.ubiquitousItemIsExcludedFromSyncKey, typeName: "URLResourceKey")) d["static let URLResourceKey.ubiquitousItemIsSharedKey"] = .staticValue(boxOpaque(URLResourceKey.ubiquitousItemIsSharedKey, typeName: "URLResourceKey")) d["static let URLResourceKey.ubiquitousSharedItemCurrentUserRoleKey"] = .staticValue(boxOpaque(URLResourceKey.ubiquitousSharedItemCurrentUserRoleKey, typeName: "URLResourceKey")) d["static let URLResourceKey.ubiquitousSharedItemCurrentUserPermissionsKey"] = .staticValue(boxOpaque(URLResourceKey.ubiquitousSharedItemCurrentUserPermissionsKey, typeName: "URLResourceKey")) d["static let URLResourceKey.ubiquitousSharedItemOwnerNameComponentsKey"] = .staticValue(boxOpaque(URLResourceKey.ubiquitousSharedItemOwnerNameComponentsKey, typeName: "URLResourceKey")) d["static let URLResourceKey.ubiquitousSharedItemMostRecentEditorNameComponentsKey"] = .staticValue(boxOpaque(URLResourceKey.ubiquitousSharedItemMostRecentEditorNameComponentsKey, typeName: "URLResourceKey")) - d["static let URLResourceKey.ubiquitousItemSupportedSyncControlsKey"] = .staticValue(boxOpaque(URLResourceKey.ubiquitousItemSupportedSyncControlsKey, typeName: "URLResourceKey")) - d["static let URLResourceKey.ubiquitousItemIsSyncPausedKey"] = .staticValue(boxOpaque(URLResourceKey.ubiquitousItemIsSyncPausedKey, typeName: "URLResourceKey")) #endif return d }() diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLResponse.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLResponse.swift index 75c91df..cfc9b9d 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLResponse.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLResponse.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLSession.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLSession.swift index ef2355a..7e69af2 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLSession.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLSession.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif @@ -20,8 +21,14 @@ extension FoundationBridges { throw RuntimeError.invalid("URLSession.data: expected 1 argument(s), got \(args.count)") } let recv: URLSession = try unboxOpaque(receiver, as: URLSession.self, typeName: "URLSession") + let arg0 = try unboxOpaque(args[0], as: URL.self, typeName: "URL") do { - let _t = try await recv.data(from: try unboxOpaque(args[0], as: URL.self, typeName: "URL")) + try await authorizeURL(arg0) + } catch { + throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) + } + do { + let _t = try await recv.data(from: arg0) return .tuple([boxOpaque(_t.0, typeName: "Data"), boxOpaque(_t.1, typeName: "URLResponse")]) } catch { throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) @@ -32,8 +39,20 @@ extension FoundationBridges { throw RuntimeError.invalid("URLSession.upload: expected 2 argument(s), got \(args.count)") } let recv: URLSession = try unboxOpaque(receiver, as: URLSession.self, typeName: "URLSession") + let arg0 = try unboxOpaque(args[0], as: URLRequest.self, typeName: "URLRequest") + do { + try await authorizeURL(arg0.url ?? URL(fileURLWithPath: ""), method: arg0.httpMethod ?? "GET") + } catch { + throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) + } + let arg1 = try unboxOpaque(args[1], as: URL.self, typeName: "URL") + do { + try await authorizePath(arg1, for: .read) + } catch { + throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) + } do { - let _t = try await recv.upload(for: try unboxOpaque(args[0], as: URLRequest.self, typeName: "URLRequest"), fromFile: try unboxOpaque(args[1], as: URL.self, typeName: "URL")) + let _t = try await recv.upload(for: arg0, fromFile: arg1) return .tuple([boxOpaque(_t.0, typeName: "Data"), boxOpaque(_t.1, typeName: "URLResponse")]) } catch { throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLThumbnailDictionaryItem.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLThumbnailDictionaryItem.swift index 132648d..d586059 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLThumbnailDictionaryItem.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLThumbnailDictionaryItem.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLUbiquitousItemDownloadingStatus.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLUbiquitousItemDownloadingStatus.swift index 5392ec7..80c5ce8 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLUbiquitousItemDownloadingStatus.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLUbiquitousItemDownloadingStatus.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLUbiquitousSharedItemPermissions.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLUbiquitousSharedItemPermissions.swift index 41086f0..72745ba 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLUbiquitousSharedItemPermissions.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLUbiquitousSharedItemPermissions.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLUbiquitousSharedItemRole.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLUbiquitousSharedItemRole.swift index 7118fba..303491f 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLUbiquitousSharedItemRole.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+URLUbiquitousSharedItemRole.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+UUID.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+UUID.swift index d68fd84..db75750 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+UUID.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+UUID.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+UndoManagerUserInfoKey.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+UndoManagerUserInfoKey.swift deleted file mode 100644 index c52d464..0000000 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+UndoManagerUserInfoKey.swift +++ /dev/null @@ -1,33 +0,0 @@ -// AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. -// Regenerate with: bash Tools/regen-foundation-bridge.sh -import Foundation -#if canImport(FoundationNetworking) -import FoundationNetworking -#endif - -#if canImport(Darwin) -extension FoundationBridges { - nonisolated(unsafe) static let undoManagerUserInfoKey: [String: Bridge] = [ - "var UndoManager.UserInfoKey.hashValue: Int": .computed { receiver in - let recv: UndoManager.UserInfoKey = try unboxOpaque(receiver, as: UndoManager.UserInfoKey.self, typeName: "UndoManager.UserInfoKey") - return .int(recv.hashValue) - }, - "init UndoManager.UserInfoKey(_:)": .`init` { args in - guard args.count == 1 else { - throw RuntimeError.invalid("init UndoManager.UserInfoKey(_:): expected 1 argument(s), got \(args.count)") - } - return boxOpaque(UndoManager.UserInfoKey(try unboxString(args[0])), typeName: "UndoManager.UserInfoKey") - }, - "init UndoManager.UserInfoKey(rawValue:)": .`init` { args in - guard args.count == 1 else { - throw RuntimeError.invalid("init UndoManager.UserInfoKey(rawValue:): expected 1 argument(s), got \(args.count)") - } - return boxOpaque(UndoManager.UserInfoKey(rawValue: try unboxString(args[0])), typeName: "UndoManager.UserInfoKey") - }, - ] -} -#else -extension FoundationBridges { - nonisolated(unsafe) static let undoManagerUserInfoKey: [String: Bridge] = [:] -} -#endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+UnsafeCurrentTask.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+UnsafeCurrentTask.swift index cee3c85..e610b41 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+UnsafeCurrentTask.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+UnsafeCurrentTask.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif @@ -15,10 +16,6 @@ extension FoundationBridges { let recv: UnsafeCurrentTask = try unboxOpaque(receiver, as: UnsafeCurrentTask.self, typeName: "UnsafeCurrentTask") return boxOpaque(recv.priority, typeName: "TaskPriority") }, - "var UnsafeCurrentTask.basePriority: TaskPriority": .computed { receiver in - let recv: UnsafeCurrentTask = try unboxOpaque(receiver, as: UnsafeCurrentTask.self, typeName: "UnsafeCurrentTask") - return boxOpaque(recv.basePriority, typeName: "TaskPriority") - }, "func UnsafeCurrentTask.cancel()": .method { receiver, args in guard args.count == 0 else { throw RuntimeError.invalid("UnsafeCurrentTask.cancel: expected 0 argument(s), got \(args.count)") @@ -31,12 +28,5 @@ extension FoundationBridges { let recv: UnsafeCurrentTask = try unboxOpaque(receiver, as: UnsafeCurrentTask.self, typeName: "UnsafeCurrentTask") return .int(recv.hashValue) }, - "var UnsafeCurrentTask.unownedTaskExecutor: UnownedTaskExecutor?": .computed { receiver in - let recv: UnsafeCurrentTask = try unboxOpaque(receiver, as: UnsafeCurrentTask.self, typeName: "UnsafeCurrentTask") - if let _v = recv.unownedTaskExecutor { - return .optional(boxOpaque(_v, typeName: "UnownedTaskExecutor")) - } - return .optional(nil) - }, ] } diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+UnsafeMutableRawPointer.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+UnsafeMutableRawPointer.swift index 070abba..a6adfcc 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+UnsafeMutableRawPointer.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+UnsafeMutableRawPointer.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+UnsafeRawPointer.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+UnsafeRawPointer.swift index bfc9723..eadaa3d 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+UnsafeRawPointer.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges+UnsafeRawPointer.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges.swift b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges.swift index 5d4da6d..b779910 100644 --- a/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges.swift +++ b/Sources/SwiftScriptInterpreter/Modules/FoundationBridge/FoundationBridges.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif @@ -13,14 +14,13 @@ enum FoundationBridges { /// Aggregated view of every per-type dict — convenient for /// callers that want to introspect the full bridge surface. nonisolated(unsafe) static let all: [String: Bridge] = [ - FoundationBridges.termOfAddress, FoundationBridges.runLoopSchedulerTimeType, FoundationBridges.uRLParseStrategy, FoundationBridges.characterSet, FoundationBridges.machError, FoundationBridges.personNameComponents, FoundationBridges.morphology, - FoundationBridges.morphologyPronoun, + FoundationBridges.morphologyCustomPronoun, FoundationBridges.indexSet, FoundationBridges.indexSetRangeView, FoundationBridges.indexSetIndex, @@ -31,7 +31,6 @@ enum FoundationBridges { FoundationBridges.attributedSubstring, FoundationBridges.calendar, FoundationBridges.dateComponents, - FoundationBridges.calendarRecurrenceRule, FoundationBridges.data, FoundationBridges.decimal, FoundationBridges.cocoaError, @@ -53,15 +52,13 @@ enum FoundationBridges { FoundationBridges.localeSubdivision, FoundationBridges.localeVariant, FoundationBridges.localeLanguage, - FoundationBridges.predicateError, - FoundationBridges.predicateExpressionsVariableID, - FoundationBridges.dateAnchoredRelativeFormatStyle, FoundationBridges.dateIntervalFormatStyle, FoundationBridges.dateRelativeFormatStyle, FoundationBridges.dateVerbatimFormatStyle, FoundationBridges.dateFormatString, FoundationBridges.date, FoundationBridges.dateFormatStyle, + FoundationBridges.dateAttributedStyle, FoundationBridges.dateParseStrategy, FoundationBridges.decimalFormatStyle, FoundationBridges.formatStyleCapitalizationContext, @@ -133,7 +130,6 @@ enum FoundationBridges { FoundationBridges.nSRegularExpressionMatchingFlags, FoundationBridges.hTTPURLResponse, FoundationBridges.uRLResponse, - FoundationBridges.undoManagerUserInfoKey, FoundationBridges.netServiceOptions, FoundationBridges.jSONSerializationReadingOptions, FoundationBridges.jSONSerializationWritingOptions, @@ -158,7 +154,6 @@ enum FoundationBridges { FoundationBridges.fileAttributeType, FoundationBridges.fileManager, FoundationBridges.fileProtectionType, - FoundationBridges.nSFileManagerSupportedSyncControls, FoundationBridges.nSFileProviderServiceName, FoundationBridges.fileManagerVolumeEnumerationOptions, FoundationBridges.fileManagerDirectoryEnumerationOptions, @@ -356,76 +351,123 @@ extension FoundationModule { } #if canImport(Darwin) - i.registerComparator(on: "NSLinguisticTag") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NSLinguisticTag, - case .opaque(_, let b) = rhs, let lb = b as? NSLinguisticTag - else { throw RuntimeError.invalid("NSLinguisticTag comparison: bad payloads") } + i.registerComparator(on: "URL.ParseStrategy") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? URL.ParseStrategy, + case .opaque(_, let b) = rhs, let lb = b as? URL.ParseStrategy + else { throw RuntimeError.invalid("URL.ParseStrategy comparison: bad payloads") } return la == lb ? 0 : -1 } #endif #if canImport(Darwin) - i.registerComparator(on: "NSMachPort.Options") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NSMachPort.Options, - case .opaque(_, let b) = rhs, let lb = b as? NSMachPort.Options - else { throw RuntimeError.invalid("NSMachPort.Options comparison: bad payloads") } + i.registerComparator(on: "AttributedString") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? AttributedString, + case .opaque(_, let b) = rhs, let lb = b as? AttributedString + else { throw RuntimeError.invalid("AttributedString comparison: bad payloads") } return la == lb ? 0 : -1 } #endif -#if canImport(Darwin) - i.registerComparator(on: "ErrorUserInfoKey") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? ErrorUserInfoKey, - case .opaque(_, let b) = rhs, let lb = b as? ErrorUserInfoKey - else { throw RuntimeError.invalid("ErrorUserInfoKey comparison: bad payloads") } + i.registerComparator(on: "NotificationQueue.NotificationCoalescing") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NotificationQueue.NotificationCoalescing, + case .opaque(_, let b) = rhs, let lb = b as? NotificationQueue.NotificationCoalescing + else { throw RuntimeError.invalid("NotificationQueue.NotificationCoalescing comparison: bad payloads") } return la == lb ? 0 : -1 } -#endif + + i.registerComparator(on: "Date") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? Date, + case .opaque(_, let b) = rhs, let lb = b as? Date + else { throw RuntimeError.invalid("Date comparison: bad payloads") } + return la < lb ? -1 : (la > lb ? 1 : 0) + } #if canImport(Darwin) - i.registerComparator(on: "NSOrderedCollectionDifferenceCalculationOptions") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NSOrderedCollectionDifferenceCalculationOptions, - case .opaque(_, let b) = rhs, let lb = b as? NSOrderedCollectionDifferenceCalculationOptions - else { throw RuntimeError.invalid("NSOrderedCollectionDifferenceCalculationOptions comparison: bad payloads") } + i.registerComparator(on: "AttributedString.AttributeInvalidationCondition") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? AttributedString.AttributeInvalidationCondition, + case .opaque(_, let b) = rhs, let lb = b as? AttributedString.AttributeInvalidationCondition + else { throw RuntimeError.invalid("AttributedString.AttributeInvalidationCondition comparison: bad payloads") } return la == lb ? 0 : -1 } #endif - i.registerComparator(on: "Locale.Components") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? Locale.Components, - case .opaque(_, let b) = rhs, let lb = b as? Locale.Components - else { throw RuntimeError.invalid("Locale.Components comparison: bad payloads") } + i.registerComparator(on: "NSRegularExpression.MatchingFlags") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NSRegularExpression.MatchingFlags, + case .opaque(_, let b) = rhs, let lb = b as? NSRegularExpression.MatchingFlags + else { throw RuntimeError.invalid("NSRegularExpression.MatchingFlags comparison: bad payloads") } return la == lb ? 0 : -1 } - i.registerComparator(on: "ByteCountFormatStyle.Units") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? ByteCountFormatStyle.Units, - case .opaque(_, let b) = rhs, let lb = b as? ByteCountFormatStyle.Units - else { throw RuntimeError.invalid("ByteCountFormatStyle.Units comparison: bad payloads") } + i.registerComparator(on: "FileManager.VolumeEnumerationOptions") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? FileManager.VolumeEnumerationOptions, + case .opaque(_, let b) = rhs, let lb = b as? FileManager.VolumeEnumerationOptions + else { throw RuntimeError.invalid("FileManager.VolumeEnumerationOptions comparison: bad payloads") } return la == lb ? 0 : -1 } #if canImport(Darwin) - i.registerComparator(on: "Morphology.Pronoun") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? Morphology.Pronoun, - case .opaque(_, let b) = rhs, let lb = b as? Morphology.Pronoun - else { throw RuntimeError.invalid("Morphology.Pronoun comparison: bad payloads") } + i.registerComparator(on: "URLResponse") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? URLResponse, + case .opaque(_, let b) = rhs, let lb = b as? URLResponse + else { throw RuntimeError.invalid("URLResponse comparison: bad payloads") } return la == lb ? 0 : -1 } #endif - i.registerComparator(on: "NSString.EnumerationOptions") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NSString.EnumerationOptions, - case .opaque(_, let b) = rhs, let lb = b as? NSString.EnumerationOptions - else { throw RuntimeError.invalid("NSString.EnumerationOptions comparison: bad payloads") } + i.registerComparator(on: "Date.ComponentsFormatStyle") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? Date.ComponentsFormatStyle, + case .opaque(_, let b) = rhs, let lb = b as? Date.ComponentsFormatStyle + else { throw RuntimeError.invalid("Date.ComponentsFormatStyle comparison: bad payloads") } + return la == lb ? 0 : -1 + } + + i.registerComparator(on: "POSIXError") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? POSIXError, + case .opaque(_, let b) = rhs, let lb = b as? POSIXError + else { throw RuntimeError.invalid("POSIXError comparison: bad payloads") } + return la == lb ? 0 : -1 + } + + i.registerComparator(on: "Locale.NumberingSystem") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? Locale.NumberingSystem, + case .opaque(_, let b) = rhs, let lb = b as? Locale.NumberingSystem + else { throw RuntimeError.invalid("Locale.NumberingSystem comparison: bad payloads") } + return la == lb ? 0 : -1 + } + + i.registerComparator(on: "Locale.Region") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? Locale.Region, + case .opaque(_, let b) = rhs, let lb = b as? Locale.Region + else { throw RuntimeError.invalid("Locale.Region comparison: bad payloads") } + return la == lb ? 0 : -1 + } + + i.registerComparator(on: "FileManager.DirectoryEnumerationOptions") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? FileManager.DirectoryEnumerationOptions, + case .opaque(_, let b) = rhs, let lb = b as? FileManager.DirectoryEnumerationOptions + else { throw RuntimeError.invalid("FileManager.DirectoryEnumerationOptions comparison: bad payloads") } + return la == lb ? 0 : -1 + } + + i.registerComparator(on: "Progress.FileOperationKind") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? Progress.FileOperationKind, + case .opaque(_, let b) = rhs, let lb = b as? Progress.FileOperationKind + else { throw RuntimeError.invalid("Progress.FileOperationKind comparison: bad payloads") } + return la == lb ? 0 : -1 + } + + i.registerComparator(on: "ByteCountFormatStyle") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? ByteCountFormatStyle, + case .opaque(_, let b) = rhs, let lb = b as? ByteCountFormatStyle + else { throw RuntimeError.invalid("ByteCountFormatStyle comparison: bad payloads") } return la == lb ? 0 : -1 } #if canImport(Darwin) - i.registerComparator(on: "URLFileProtection") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? URLFileProtection, - case .opaque(_, let b) = rhs, let lb = b as? URLFileProtection - else { throw RuntimeError.invalid("URLFileProtection comparison: bad payloads") } + i.registerComparator(on: "NSLinguisticTagScheme") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NSLinguisticTagScheme, + case .opaque(_, let b) = rhs, let lb = b as? NSLinguisticTagScheme + else { throw RuntimeError.invalid("NSLinguisticTagScheme comparison: bad payloads") } return la == lb ? 0 : -1 } #endif @@ -437,82 +479,94 @@ extension FoundationModule { return la == lb ? 0 : -1 } - i.registerComparator(on: "FileProtectionType") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? FileProtectionType, - case .opaque(_, let b) = rhs, let lb = b as? FileProtectionType - else { throw RuntimeError.invalid("FileProtectionType comparison: bad payloads") } + i.registerComparator(on: "Stream.PropertyKey") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? Stream.PropertyKey, + case .opaque(_, let b) = rhs, let lb = b as? Stream.PropertyKey + else { throw RuntimeError.invalid("Stream.PropertyKey comparison: bad payloads") } return la == lb ? 0 : -1 } - i.registerComparator(on: "NumberFormatStyleConfiguration.Precision") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NumberFormatStyleConfiguration.Precision, - case .opaque(_, let b) = rhs, let lb = b as? NumberFormatStyleConfiguration.Precision - else { throw RuntimeError.invalid("NumberFormatStyleConfiguration.Precision comparison: bad payloads") } + i.registerComparator(on: "ProgressUserInfoKey") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? ProgressUserInfoKey, + case .opaque(_, let b) = rhs, let lb = b as? ProgressUserInfoKey + else { throw RuntimeError.invalid("ProgressUserInfoKey comparison: bad payloads") } return la == lb ? 0 : -1 } -#if canImport(Darwin) - i.registerComparator(on: "AttributedSubstring") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? AttributedSubstring, - case .opaque(_, let b) = rhs, let lb = b as? AttributedSubstring - else { throw RuntimeError.invalid("AttributedSubstring comparison: bad payloads") } + i.registerComparator(on: "Locale.Subdivision") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? Locale.Subdivision, + case .opaque(_, let b) = rhs, let lb = b as? Locale.Subdivision + else { throw RuntimeError.invalid("Locale.Subdivision comparison: bad payloads") } return la == lb ? 0 : -1 } -#endif - i.registerComparator(on: "CocoaError.Code") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? CocoaError.Code, - case .opaque(_, let b) = rhs, let lb = b as? CocoaError.Code - else { throw RuntimeError.invalid("CocoaError.Code comparison: bad payloads") } + i.registerComparator(on: "Locale.Components") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? Locale.Components, + case .opaque(_, let b) = rhs, let lb = b as? Locale.Components + else { throw RuntimeError.invalid("Locale.Components comparison: bad payloads") } return la == lb ? 0 : -1 } #if canImport(Darwin) - i.registerComparator(on: "MachError") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? MachError, - case .opaque(_, let b) = rhs, let lb = b as? MachError - else { throw RuntimeError.invalid("MachError comparison: bad payloads") } + i.registerComparator(on: "URLFileProtection") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? URLFileProtection, + case .opaque(_, let b) = rhs, let lb = b as? URLFileProtection + else { throw RuntimeError.invalid("URLFileProtection comparison: bad payloads") } return la == lb ? 0 : -1 } #endif -#if canImport(Darwin) - i.registerComparator(on: "PersonNameComponents.ParseStrategy") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? PersonNameComponents.ParseStrategy, - case .opaque(_, let b) = rhs, let lb = b as? PersonNameComponents.ParseStrategy - else { throw RuntimeError.invalid("PersonNameComponents.ParseStrategy comparison: bad payloads") } + i.registerComparator(on: "FileAttributeType") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? FileAttributeType, + case .opaque(_, let b) = rhs, let lb = b as? FileAttributeType + else { throw RuntimeError.invalid("FileAttributeType comparison: bad payloads") } + return la == lb ? 0 : -1 + } + + i.registerComparator(on: "TimeZone") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? TimeZone, + case .opaque(_, let b) = rhs, let lb = b as? TimeZone + else { throw RuntimeError.invalid("TimeZone comparison: bad payloads") } + return la == lb ? 0 : -1 + } + + i.registerComparator(on: "StreamSOCKSProxyVersion") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? StreamSOCKSProxyVersion, + case .opaque(_, let b) = rhs, let lb = b as? StreamSOCKSProxyVersion + else { throw RuntimeError.invalid("StreamSOCKSProxyVersion comparison: bad payloads") } return la == lb ? 0 : -1 } -#endif #if canImport(Darwin) - i.registerComparator(on: "NSItemProviderFileOptions") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NSItemProviderFileOptions, - case .opaque(_, let b) = rhs, let lb = b as? NSItemProviderFileOptions - else { throw RuntimeError.invalid("NSItemProviderFileOptions comparison: bad payloads") } + i.registerComparator(on: "ProcessInfo") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? ProcessInfo, + case .opaque(_, let b) = rhs, let lb = b as? ProcessInfo + else { throw RuntimeError.invalid("ProcessInfo comparison: bad payloads") } return la == lb ? 0 : -1 } #endif - i.registerComparator(on: "FormatStyleCapitalizationContext") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? FormatStyleCapitalizationContext, - case .opaque(_, let b) = rhs, let lb = b as? FormatStyleCapitalizationContext - else { throw RuntimeError.invalid("FormatStyleCapitalizationContext comparison: bad payloads") } + i.registerComparator(on: "URL") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? URL, + case .opaque(_, let b) = rhs, let lb = b as? URL + else { throw RuntimeError.invalid("URL comparison: bad payloads") } return la == lb ? 0 : -1 } - i.registerComparator(on: "NSRegularExpression.MatchingFlags") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NSRegularExpression.MatchingFlags, - case .opaque(_, let b) = rhs, let lb = b as? NSRegularExpression.MatchingFlags - else { throw RuntimeError.invalid("NSRegularExpression.MatchingFlags comparison: bad payloads") } +#if canImport(Darwin) + i.registerComparator(on: "URL.FormatStyle") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? URL.FormatStyle, + case .opaque(_, let b) = rhs, let lb = b as? URL.FormatStyle + else { throw RuntimeError.invalid("URL.FormatStyle comparison: bad payloads") } return la == lb ? 0 : -1 } +#endif #if canImport(Darwin) - i.registerComparator(on: "PersonNameComponents.AttributedStyle") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? PersonNameComponents.AttributedStyle, - case .opaque(_, let b) = rhs, let lb = b as? PersonNameComponents.AttributedStyle - else { throw RuntimeError.invalid("PersonNameComponents.AttributedStyle comparison: bad payloads") } + i.registerComparator(on: "URLThumbnailDictionaryItem") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? URLThumbnailDictionaryItem, + case .opaque(_, let b) = rhs, let lb = b as? URLThumbnailDictionaryItem + else { throw RuntimeError.invalid("URLThumbnailDictionaryItem comparison: bad payloads") } return la == lb ? 0 : -1 } #endif @@ -524,42 +578,55 @@ extension FoundationModule { return la < lb ? -1 : (la > lb ? 1 : 0) } - i.registerComparator(on: "Data") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? Data, - case .opaque(_, let b) = rhs, let lb = b as? Data - else { throw RuntimeError.invalid("Data comparison: bad payloads") } +#if canImport(Darwin) + i.registerComparator(on: "AttributedString.MarkdownSourcePosition") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? AttributedString.MarkdownSourcePosition, + case .opaque(_, let b) = rhs, let lb = b as? AttributedString.MarkdownSourcePosition + else { throw RuntimeError.invalid("AttributedString.MarkdownSourcePosition comparison: bad payloads") } return la == lb ? 0 : -1 } +#endif #if canImport(Darwin) - i.registerComparator(on: "NSKeyValueOperator") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NSKeyValueOperator, - case .opaque(_, let b) = rhs, let lb = b as? NSKeyValueOperator - else { throw RuntimeError.invalid("NSKeyValueOperator comparison: bad payloads") } + i.registerComparator(on: "URLSession") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? URLSession, + case .opaque(_, let b) = rhs, let lb = b as? URLSession + else { throw RuntimeError.invalid("URLSession comparison: bad payloads") } return la == lb ? 0 : -1 } #endif - i.registerComparator(on: "Locale.LanguageCode") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? Locale.LanguageCode, - case .opaque(_, let b) = rhs, let lb = b as? Locale.LanguageCode - else { throw RuntimeError.invalid("Locale.LanguageCode comparison: bad payloads") } +#if canImport(Darwin) + i.registerComparator(on: "NetService.Options") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NetService.Options, + case .opaque(_, let b) = rhs, let lb = b as? NetService.Options + else { throw RuntimeError.invalid("NetService.Options comparison: bad payloads") } return la == lb ? 0 : -1 } +#endif - i.registerComparator(on: "URLQueryItem") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? URLQueryItem, - case .opaque(_, let b) = rhs, let lb = b as? URLQueryItem - else { throw RuntimeError.invalid("URLQueryItem comparison: bad payloads") } + i.registerComparator(on: "FileAttributeKey") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? FileAttributeKey, + case .opaque(_, let b) = rhs, let lb = b as? FileAttributeKey + else { throw RuntimeError.invalid("FileAttributeKey comparison: bad payloads") } return la == lb ? 0 : -1 } - i.registerComparator(on: "DescriptiveNumberFormatConfiguration.Presentation") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? DescriptiveNumberFormatConfiguration.Presentation, - case .opaque(_, let b) = rhs, let lb = b as? DescriptiveNumberFormatConfiguration.Presentation - else { throw RuntimeError.invalid("DescriptiveNumberFormatConfiguration.Presentation comparison: bad payloads") } + i.registerComparator(on: "Calendar") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? Calendar, + case .opaque(_, let b) = rhs, let lb = b as? Calendar + else { throw RuntimeError.invalid("Calendar comparison: bad payloads") } + return la == lb ? 0 : -1 + } + +#if canImport(Darwin) + i.registerComparator(on: "NSValueTransformerName") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NSValueTransformerName, + case .opaque(_, let b) = rhs, let lb = b as? NSValueTransformerName + else { throw RuntimeError.invalid("NSValueTransformerName comparison: bad payloads") } return la == lb ? 0 : -1 } +#endif i.registerComparator(on: "NumberFormatStyleConfiguration.Notation") { lhs, rhs in guard case .opaque(_, let a) = lhs, let la = a as? NumberFormatStyleConfiguration.Notation, @@ -568,152 +635,145 @@ extension FoundationModule { return la == lb ? 0 : -1 } -#if canImport(Darwin) - i.registerComparator(on: "NSURL.BookmarkResolutionOptions") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NSURL.BookmarkResolutionOptions, - case .opaque(_, let b) = rhs, let lb = b as? NSURL.BookmarkResolutionOptions - else { throw RuntimeError.invalid("NSURL.BookmarkResolutionOptions comparison: bad payloads") } - return la == lb ? 0 : -1 - } -#endif - - i.registerComparator(on: "StreamSOCKSProxyConfiguration") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? StreamSOCKSProxyConfiguration, - case .opaque(_, let b) = rhs, let lb = b as? StreamSOCKSProxyConfiguration - else { throw RuntimeError.invalid("StreamSOCKSProxyConfiguration comparison: bad payloads") } + i.registerComparator(on: "NumberFormatStyleConfiguration.SignDisplayStrategy") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NumberFormatStyleConfiguration.SignDisplayStrategy, + case .opaque(_, let b) = rhs, let lb = b as? NumberFormatStyleConfiguration.SignDisplayStrategy + else { throw RuntimeError.invalid("NumberFormatStyleConfiguration.SignDisplayStrategy comparison: bad payloads") } return la == lb ? 0 : -1 } - i.registerComparator(on: "NSCalendar.Unit") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NSCalendar.Unit, - case .opaque(_, let b) = rhs, let lb = b as? NSCalendar.Unit - else { throw RuntimeError.invalid("NSCalendar.Unit comparison: bad payloads") } + i.registerComparator(on: "StringStyle") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? StringStyle, + case .opaque(_, let b) = rhs, let lb = b as? StringStyle + else { throw RuntimeError.invalid("StringStyle comparison: bad payloads") } return la == lb ? 0 : -1 } #if canImport(Darwin) - i.registerComparator(on: "URLUbiquitousSharedItemPermissions") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? URLUbiquitousSharedItemPermissions, - case .opaque(_, let b) = rhs, let lb = b as? URLUbiquitousSharedItemPermissions - else { throw RuntimeError.invalid("URLUbiquitousSharedItemPermissions comparison: bad payloads") } + i.registerComparator(on: "DateComponentsFormatter.ZeroFormattingBehavior") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? DateComponentsFormatter.ZeroFormattingBehavior, + case .opaque(_, let b) = rhs, let lb = b as? DateComponentsFormatter.ZeroFormattingBehavior + else { throw RuntimeError.invalid("DateComponentsFormatter.ZeroFormattingBehavior comparison: bad payloads") } return la == lb ? 0 : -1 } #endif - i.registerComparator(on: "AttributeContainer") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? AttributeContainer, - case .opaque(_, let b) = rhs, let lb = b as? AttributeContainer - else { throw RuntimeError.invalid("AttributeContainer comparison: bad payloads") } - return la == lb ? 0 : -1 - } - - i.registerComparator(on: "ByteCountFormatter.Units") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? ByteCountFormatter.Units, - case .opaque(_, let b) = rhs, let lb = b as? ByteCountFormatter.Units - else { throw RuntimeError.invalid("ByteCountFormatter.Units comparison: bad payloads") } +#if canImport(Darwin) + i.registerComparator(on: "PersonNameComponentsFormatter.Options") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? PersonNameComponentsFormatter.Options, + case .opaque(_, let b) = rhs, let lb = b as? PersonNameComponentsFormatter.Options + else { throw RuntimeError.invalid("PersonNameComponentsFormatter.Options comparison: bad payloads") } return la == lb ? 0 : -1 } +#endif -#if canImport(Darwin) - i.registerComparator(on: "URL.ParseStrategy") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? URL.ParseStrategy, - case .opaque(_, let b) = rhs, let lb = b as? URL.ParseStrategy - else { throw RuntimeError.invalid("URL.ParseStrategy comparison: bad payloads") } + i.registerComparator(on: "ISO8601DateFormatter.Options") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? ISO8601DateFormatter.Options, + case .opaque(_, let b) = rhs, let lb = b as? ISO8601DateFormatter.Options + else { throw RuntimeError.invalid("ISO8601DateFormatter.Options comparison: bad payloads") } return la == lb ? 0 : -1 } -#endif #if canImport(Darwin) - i.registerComparator(on: "NSFileVersion.AddingOptions") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NSFileVersion.AddingOptions, - case .opaque(_, let b) = rhs, let lb = b as? NSFileVersion.AddingOptions - else { throw RuntimeError.invalid("NSFileVersion.AddingOptions comparison: bad payloads") } + i.registerComparator(on: "NSMachPort.Options") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NSMachPort.Options, + case .opaque(_, let b) = rhs, let lb = b as? NSMachPort.Options + else { throw RuntimeError.invalid("NSMachPort.Options comparison: bad payloads") } return la == lb ? 0 : -1 } #endif - i.registerComparator(on: "Date.RelativeFormatStyle") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? Date.RelativeFormatStyle, - case .opaque(_, let b) = rhs, let lb = b as? Date.RelativeFormatStyle - else { throw RuntimeError.invalid("Date.RelativeFormatStyle comparison: bad payloads") } + i.registerComparator(on: "URLRequest") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? URLRequest, + case .opaque(_, let b) = rhs, let lb = b as? URLRequest + else { throw RuntimeError.invalid("URLRequest comparison: bad payloads") } return la == lb ? 0 : -1 } - i.registerComparator(on: "Locale.Language") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? Locale.Language, - case .opaque(_, let b) = rhs, let lb = b as? Locale.Language - else { throw RuntimeError.invalid("Locale.Language comparison: bad payloads") } + i.registerComparator(on: "JSONEncoder.OutputFormatting") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? JSONEncoder.OutputFormatting, + case .opaque(_, let b) = rhs, let lb = b as? JSONEncoder.OutputFormatting + else { throw RuntimeError.invalid("JSONEncoder.OutputFormatting comparison: bad payloads") } return la == lb ? 0 : -1 } - i.registerComparator(on: "ProgressUserInfoKey") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? ProgressUserInfoKey, - case .opaque(_, let b) = rhs, let lb = b as? ProgressUserInfoKey - else { throw RuntimeError.invalid("ProgressUserInfoKey comparison: bad payloads") } +#if canImport(Darwin) + i.registerComparator(on: "NSLinguisticTag") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NSLinguisticTag, + case .opaque(_, let b) = rhs, let lb = b as? NSLinguisticTag + else { throw RuntimeError.invalid("NSLinguisticTag comparison: bad payloads") } return la == lb ? 0 : -1 } +#endif #if canImport(Darwin) - i.registerComparator(on: "NSData.SearchOptions") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NSData.SearchOptions, - case .opaque(_, let b) = rhs, let lb = b as? NSData.SearchOptions - else { throw RuntimeError.invalid("NSData.SearchOptions comparison: bad payloads") } + i.registerComparator(on: "NSFileProviderServiceName") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NSFileProviderServiceName, + case .opaque(_, let b) = rhs, let lb = b as? NSFileProviderServiceName + else { throw RuntimeError.invalid("NSFileProviderServiceName comparison: bad payloads") } return la == lb ? 0 : -1 } #endif - i.registerComparator(on: "ISO8601DateFormatter.Options") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? ISO8601DateFormatter.Options, - case .opaque(_, let b) = rhs, let lb = b as? ISO8601DateFormatter.Options - else { throw RuntimeError.invalid("ISO8601DateFormatter.Options comparison: bad payloads") } + i.registerComparator(on: "Locale.Currency") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? Locale.Currency, + case .opaque(_, let b) = rhs, let lb = b as? Locale.Currency + else { throw RuntimeError.invalid("Locale.Currency comparison: bad payloads") } return la == lb ? 0 : -1 } - i.registerComparator(on: "DateComponents") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? DateComponents, - case .opaque(_, let b) = rhs, let lb = b as? DateComponents - else { throw RuntimeError.invalid("DateComponents comparison: bad payloads") } + i.registerComparator(on: "JSONSerialization.ReadingOptions") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? JSONSerialization.ReadingOptions, + case .opaque(_, let b) = rhs, let lb = b as? JSONSerialization.ReadingOptions + else { throw RuntimeError.invalid("JSONSerialization.ReadingOptions comparison: bad payloads") } return la == lb ? 0 : -1 } - i.registerComparator(on: "ByteCountFormatStyle.Attributed") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? ByteCountFormatStyle.Attributed, - case .opaque(_, let b) = rhs, let lb = b as? ByteCountFormatStyle.Attributed - else { throw RuntimeError.invalid("ByteCountFormatStyle.Attributed comparison: bad payloads") } + i.registerComparator(on: "URLFileResourceType") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? URLFileResourceType, + case .opaque(_, let b) = rhs, let lb = b as? URLFileResourceType + else { throw RuntimeError.invalid("URLFileResourceType comparison: bad payloads") } return la == lb ? 0 : -1 } - i.registerComparator(on: "Locale.Script") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? Locale.Script, - case .opaque(_, let b) = rhs, let lb = b as? Locale.Script - else { throw RuntimeError.invalid("Locale.Script comparison: bad payloads") } + i.registerComparator(on: "Locale.Collation") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? Locale.Collation, + case .opaque(_, let b) = rhs, let lb = b as? Locale.Collation + else { throw RuntimeError.invalid("Locale.Collation comparison: bad payloads") } return la == lb ? 0 : -1 } - i.registerComparator(on: "PropertyListSerialization.MutabilityOptions") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? PropertyListSerialization.MutabilityOptions, - case .opaque(_, let b) = rhs, let lb = b as? PropertyListSerialization.MutabilityOptions - else { throw RuntimeError.invalid("PropertyListSerialization.MutabilityOptions comparison: bad payloads") } +#if canImport(Darwin) + i.registerComparator(on: "NSURL.BookmarkCreationOptions") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NSURL.BookmarkCreationOptions, + case .opaque(_, let b) = rhs, let lb = b as? NSURL.BookmarkCreationOptions + else { throw RuntimeError.invalid("NSURL.BookmarkCreationOptions comparison: bad payloads") } return la == lb ? 0 : -1 } +#endif + + i.registerComparator(on: "Decimal") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? Decimal, + case .opaque(_, let b) = rhs, let lb = b as? Decimal + else { throw RuntimeError.invalid("Decimal comparison: bad payloads") } + return la < lb ? -1 : (la > lb ? 1 : 0) + } #if canImport(Darwin) - i.registerComparator(on: "PersonNameComponents.FormatStyle") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? PersonNameComponents.FormatStyle, - case .opaque(_, let b) = rhs, let lb = b as? PersonNameComponents.FormatStyle - else { throw RuntimeError.invalid("PersonNameComponents.FormatStyle comparison: bad payloads") } + i.registerComparator(on: "NSAttributedStringFormattingContextKey") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NSAttributedStringFormattingContextKey, + case .opaque(_, let b) = rhs, let lb = b as? NSAttributedStringFormattingContextKey + else { throw RuntimeError.invalid("NSAttributedStringFormattingContextKey comparison: bad payloads") } return la == lb ? 0 : -1 } #endif -#if canImport(Darwin) - i.registerComparator(on: "PresentationIntent.IntentType") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? PresentationIntent.IntentType, - case .opaque(_, let b) = rhs, let lb = b as? PresentationIntent.IntentType - else { throw RuntimeError.invalid("PresentationIntent.IntentType comparison: bad payloads") } + i.registerComparator(on: "NSAttributedString.Key") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NSAttributedString.Key, + case .opaque(_, let b) = rhs, let lb = b as? NSAttributedString.Key + else { throw RuntimeError.invalid("NSAttributedString.Key comparison: bad payloads") } return la == lb ? 0 : -1 } -#endif #if canImport(Darwin) i.registerComparator(on: "HTTPCookieStringPolicy") { lhs, rhs in @@ -724,98 +784,68 @@ extension FoundationModule { } #endif - i.registerComparator(on: "HTTPCookiePropertyKey") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? HTTPCookiePropertyKey, - case .opaque(_, let b) = rhs, let lb = b as? HTTPCookiePropertyKey - else { throw RuntimeError.invalid("HTTPCookiePropertyKey comparison: bad payloads") } +#if canImport(Darwin) + i.registerComparator(on: "StringEncodingDetectionOptionsKey") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? StringEncodingDetectionOptionsKey, + case .opaque(_, let b) = rhs, let lb = b as? StringEncodingDetectionOptionsKey + else { throw RuntimeError.invalid("StringEncodingDetectionOptionsKey comparison: bad payloads") } return la == lb ? 0 : -1 } +#endif #if canImport(Darwin) - i.registerComparator(on: "URLThumbnailDictionaryItem") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? URLThumbnailDictionaryItem, - case .opaque(_, let b) = rhs, let lb = b as? URLThumbnailDictionaryItem - else { throw RuntimeError.invalid("URLThumbnailDictionaryItem comparison: bad payloads") } + i.registerComparator(on: "AttributedSubstring") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? AttributedSubstring, + case .opaque(_, let b) = rhs, let lb = b as? AttributedSubstring + else { throw RuntimeError.invalid("AttributedSubstring comparison: bad payloads") } return la == lb ? 0 : -1 } #endif - i.registerComparator(on: "Locale") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? Locale, - case .opaque(_, let b) = rhs, let lb = b as? Locale - else { throw RuntimeError.invalid("Locale comparison: bad payloads") } + i.registerComparator(on: "CharacterSet") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? CharacterSet, + case .opaque(_, let b) = rhs, let lb = b as? CharacterSet + else { throw RuntimeError.invalid("CharacterSet comparison: bad payloads") } return la == lb ? 0 : -1 } - i.registerComparator(on: "DateInterval") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? DateInterval, - case .opaque(_, let b) = rhs, let lb = b as? DateInterval - else { throw RuntimeError.invalid("DateInterval comparison: bad payloads") } - return la < lb ? -1 : (la > lb ? 1 : 0) - } - - i.registerComparator(on: "NSLocale.Key") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NSLocale.Key, - case .opaque(_, let b) = rhs, let lb = b as? NSLocale.Key - else { throw RuntimeError.invalid("NSLocale.Key comparison: bad payloads") } + i.registerComparator(on: "NSRegularExpression.MatchingOptions") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NSRegularExpression.MatchingOptions, + case .opaque(_, let b) = rhs, let lb = b as? NSRegularExpression.MatchingOptions + else { throw RuntimeError.invalid("NSRegularExpression.MatchingOptions comparison: bad payloads") } return la == lb ? 0 : -1 } -#if canImport(Darwin) - i.registerComparator(on: "AttributedString.AttributeInvalidationCondition") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? AttributedString.AttributeInvalidationCondition, - case .opaque(_, let b) = rhs, let lb = b as? AttributedString.AttributeInvalidationCondition - else { throw RuntimeError.invalid("AttributedString.AttributeInvalidationCondition comparison: bad payloads") } + i.registerComparator(on: "NumberFormatStyleConfiguration.Precision") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NumberFormatStyleConfiguration.Precision, + case .opaque(_, let b) = rhs, let lb = b as? NumberFormatStyleConfiguration.Precision + else { throw RuntimeError.invalid("NumberFormatStyleConfiguration.Precision comparison: bad payloads") } return la == lb ? 0 : -1 } -#endif - i.registerComparator(on: "PredicateError") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? PredicateError, - case .opaque(_, let b) = rhs, let lb = b as? PredicateError - else { throw RuntimeError.invalid("PredicateError comparison: bad payloads") } + i.registerComparator(on: "Date.AttributedStyle") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? Date.AttributedStyle, + case .opaque(_, let b) = rhs, let lb = b as? Date.AttributedStyle + else { throw RuntimeError.invalid("Date.AttributedStyle comparison: bad payloads") } return la == lb ? 0 : -1 } - i.registerComparator(on: "StringStyle") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? StringStyle, - case .opaque(_, let b) = rhs, let lb = b as? StringStyle - else { throw RuntimeError.invalid("StringStyle comparison: bad payloads") } + i.registerComparator(on: "NSCalendar.Unit") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NSCalendar.Unit, + case .opaque(_, let b) = rhs, let lb = b as? NSCalendar.Unit + else { throw RuntimeError.invalid("NSCalendar.Unit comparison: bad payloads") } return la == lb ? 0 : -1 } #if canImport(Darwin) - i.registerComparator(on: "NSAttributedStringFormattingContextKey") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NSAttributedStringFormattingContextKey, - case .opaque(_, let b) = rhs, let lb = b as? NSAttributedStringFormattingContextKey - else { throw RuntimeError.invalid("NSAttributedStringFormattingContextKey comparison: bad payloads") } + i.registerComparator(on: "AttributedString.Runs") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? AttributedString.Runs, + case .opaque(_, let b) = rhs, let lb = b as? AttributedString.Runs + else { throw RuntimeError.invalid("AttributedString.Runs comparison: bad payloads") } return la == lb ? 0 : -1 } #endif -#if canImport(Darwin) - i.registerComparator(on: "NSData.Base64DecodingOptions") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NSData.Base64DecodingOptions, - case .opaque(_, let b) = rhs, let lb = b as? NSData.Base64DecodingOptions - else { throw RuntimeError.invalid("NSData.Base64DecodingOptions comparison: bad payloads") } - return la == lb ? 0 : -1 - } -#endif - - i.registerComparator(on: "NSString.EncodingConversionOptions") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NSString.EncodingConversionOptions, - case .opaque(_, let b) = rhs, let lb = b as? NSString.EncodingConversionOptions - else { throw RuntimeError.invalid("NSString.EncodingConversionOptions comparison: bad payloads") } - return la == lb ? 0 : -1 - } - - i.registerComparator(on: "NSEnumerationOptions") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NSEnumerationOptions, - case .opaque(_, let b) = rhs, let lb = b as? NSEnumerationOptions - else { throw RuntimeError.invalid("NSEnumerationOptions comparison: bad payloads") } - return la == lb ? 0 : -1 - } - #if canImport(Darwin) i.registerComparator(on: "NSComparisonPredicate.Options") { lhs, rhs in guard case .opaque(_, let a) = lhs, let la = a as? NSComparisonPredicate.Options, @@ -825,249 +855,166 @@ extension FoundationModule { } #endif - i.registerComparator(on: "IndexSet.RangeView") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? IndexSet.RangeView, - case .opaque(_, let b) = rhs, let lb = b as? IndexSet.RangeView - else { throw RuntimeError.invalid("IndexSet.RangeView comparison: bad payloads") } - return la == lb ? 0 : -1 - } - - i.registerComparator(on: "NSExceptionName") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NSExceptionName, - case .opaque(_, let b) = rhs, let lb = b as? NSExceptionName - else { throw RuntimeError.invalid("NSExceptionName comparison: bad payloads") } - return la == lb ? 0 : -1 - } - - i.registerComparator(on: "RunLoop.Mode") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? RunLoop.Mode, - case .opaque(_, let b) = rhs, let lb = b as? RunLoop.Mode - else { throw RuntimeError.invalid("RunLoop.Mode comparison: bad payloads") } + i.registerComparator(on: "NSRegularExpression.Options") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NSRegularExpression.Options, + case .opaque(_, let b) = rhs, let lb = b as? NSRegularExpression.Options + else { throw RuntimeError.invalid("NSRegularExpression.Options comparison: bad payloads") } return la == lb ? 0 : -1 } #if canImport(Darwin) - i.registerComparator(on: "URLResponse") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? URLResponse, - case .opaque(_, let b) = rhs, let lb = b as? URLResponse - else { throw RuntimeError.invalid("URLResponse comparison: bad payloads") } + i.registerComparator(on: "NSFileCoordinator.ReadingOptions") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NSFileCoordinator.ReadingOptions, + case .opaque(_, let b) = rhs, let lb = b as? NSFileCoordinator.ReadingOptions + else { throw RuntimeError.invalid("NSFileCoordinator.ReadingOptions comparison: bad payloads") } return la == lb ? 0 : -1 } #endif - i.registerComparator(on: "Date.ParseStrategy") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? Date.ParseStrategy, - case .opaque(_, let b) = rhs, let lb = b as? Date.ParseStrategy - else { throw RuntimeError.invalid("Date.ParseStrategy comparison: bad payloads") } + i.registerComparator(on: "URLResourceKey") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? URLResourceKey, + case .opaque(_, let b) = rhs, let lb = b as? URLResourceKey + else { throw RuntimeError.invalid("URLResourceKey comparison: bad payloads") } return la == lb ? 0 : -1 } #if canImport(Darwin) - i.registerComparator(on: "LocalizedStringResource") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? LocalizedStringResource, - case .opaque(_, let b) = rhs, let lb = b as? LocalizedStringResource - else { throw RuntimeError.invalid("LocalizedStringResource comparison: bad payloads") } + i.registerComparator(on: "NSPointerFunctions.Options") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NSPointerFunctions.Options, + case .opaque(_, let b) = rhs, let lb = b as? NSPointerFunctions.Options + else { throw RuntimeError.invalid("NSPointerFunctions.Options comparison: bad payloads") } return la == lb ? 0 : -1 } #endif #if canImport(Darwin) - i.registerComparator(on: "InlinePresentationIntent") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? InlinePresentationIntent, - case .opaque(_, let b) = rhs, let lb = b as? InlinePresentationIntent - else { throw RuntimeError.invalid("InlinePresentationIntent comparison: bad payloads") } + i.registerComparator(on: "ErrorUserInfoKey") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? ErrorUserInfoKey, + case .opaque(_, let b) = rhs, let lb = b as? ErrorUserInfoKey + else { throw RuntimeError.invalid("ErrorUserInfoKey comparison: bad payloads") } return la == lb ? 0 : -1 } #endif - i.registerComparator(on: "Calendar.RecurrenceRule") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? Calendar.RecurrenceRule, - case .opaque(_, let b) = rhs, let lb = b as? Calendar.RecurrenceRule - else { throw RuntimeError.invalid("Calendar.RecurrenceRule comparison: bad payloads") } - return la == lb ? 0 : -1 - } - -#if canImport(Darwin) - i.registerComparator(on: "ProcessInfo.ActivityOptions") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? ProcessInfo.ActivityOptions, - case .opaque(_, let b) = rhs, let lb = b as? ProcessInfo.ActivityOptions - else { throw RuntimeError.invalid("ProcessInfo.ActivityOptions comparison: bad payloads") } + i.registerComparator(on: "CurrencyFormatStyleConfiguration.SignDisplayStrategy") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? CurrencyFormatStyleConfiguration.SignDisplayStrategy, + case .opaque(_, let b) = rhs, let lb = b as? CurrencyFormatStyleConfiguration.SignDisplayStrategy + else { throw RuntimeError.invalid("CurrencyFormatStyleConfiguration.SignDisplayStrategy comparison: bad payloads") } return la == lb ? 0 : -1 } -#endif #if canImport(Darwin) - i.registerComparator(on: "NSKeyValueChangeKey") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NSKeyValueChangeKey, - case .opaque(_, let b) = rhs, let lb = b as? NSKeyValueChangeKey - else { throw RuntimeError.invalid("NSKeyValueChangeKey comparison: bad payloads") } + i.registerComparator(on: "NSFileVersion.AddingOptions") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NSFileVersion.AddingOptions, + case .opaque(_, let b) = rhs, let lb = b as? NSFileVersion.AddingOptions + else { throw RuntimeError.invalid("NSFileVersion.AddingOptions comparison: bad payloads") } return la == lb ? 0 : -1 } #endif - i.registerComparator(on: "Locale.Subdivision") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? Locale.Subdivision, - case .opaque(_, let b) = rhs, let lb = b as? Locale.Subdivision - else { throw RuntimeError.invalid("Locale.Subdivision comparison: bad payloads") } - return la == lb ? 0 : -1 - } - - i.registerComparator(on: "FileAttributeKey") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? FileAttributeKey, - case .opaque(_, let b) = rhs, let lb = b as? FileAttributeKey - else { throw RuntimeError.invalid("FileAttributeKey comparison: bad payloads") } + i.registerComparator(on: "UUID") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? UUID, + case .opaque(_, let b) = rhs, let lb = b as? UUID + else { throw RuntimeError.invalid("UUID comparison: bad payloads") } return la == lb ? 0 : -1 } - i.registerComparator(on: "PredicateExpressions.VariableID") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? PredicateExpressions.VariableID, - case .opaque(_, let b) = rhs, let lb = b as? PredicateExpressions.VariableID - else { throw RuntimeError.invalid("PredicateExpressions.VariableID comparison: bad payloads") } + i.registerComparator(on: "FileManager.ItemReplacementOptions") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? FileManager.ItemReplacementOptions, + case .opaque(_, let b) = rhs, let lb = b as? FileManager.ItemReplacementOptions + else { throw RuntimeError.invalid("FileManager.ItemReplacementOptions comparison: bad payloads") } return la == lb ? 0 : -1 } - i.registerComparator(on: "URL") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? URL, - case .opaque(_, let b) = rhs, let lb = b as? URL - else { throw RuntimeError.invalid("URL comparison: bad payloads") } + i.registerComparator(on: "Notification") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? Notification, + case .opaque(_, let b) = rhs, let lb = b as? Notification + else { throw RuntimeError.invalid("Notification comparison: bad payloads") } return la == lb ? 0 : -1 } #if canImport(Darwin) - i.registerComparator(on: "AttributedString.Index") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? AttributedString.Index, - case .opaque(_, let b) = rhs, let lb = b as? AttributedString.Index - else { throw RuntimeError.invalid("AttributedString.Index comparison: bad payloads") } - return la < lb ? -1 : (la > lb ? 1 : 0) + i.registerComparator(on: "NSOrderedCollectionDifferenceCalculationOptions") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NSOrderedCollectionDifferenceCalculationOptions, + case .opaque(_, let b) = rhs, let lb = b as? NSOrderedCollectionDifferenceCalculationOptions + else { throw RuntimeError.invalid("NSOrderedCollectionDifferenceCalculationOptions comparison: bad payloads") } + return la == lb ? 0 : -1 } #endif #if canImport(Darwin) - i.registerComparator(on: "NSFileVersion.ReplacingOptions") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NSFileVersion.ReplacingOptions, - case .opaque(_, let b) = rhs, let lb = b as? NSFileVersion.ReplacingOptions - else { throw RuntimeError.invalid("NSFileVersion.ReplacingOptions comparison: bad payloads") } + i.registerComparator(on: "URLResource") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? URLResource, + case .opaque(_, let b) = rhs, let lb = b as? URLResource + else { throw RuntimeError.invalid("URLResource comparison: bad payloads") } return la == lb ? 0 : -1 } #endif - i.registerComparator(on: "NumberFormatStyleConfiguration.DecimalSeparatorDisplayStrategy") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NumberFormatStyleConfiguration.DecimalSeparatorDisplayStrategy, - case .opaque(_, let b) = rhs, let lb = b as? NumberFormatStyleConfiguration.DecimalSeparatorDisplayStrategy - else { throw RuntimeError.invalid("NumberFormatStyleConfiguration.DecimalSeparatorDisplayStrategy comparison: bad payloads") } - return la == lb ? 0 : -1 - } - - i.registerComparator(on: "Stream.Event") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? Stream.Event, - case .opaque(_, let b) = rhs, let lb = b as? Stream.Event - else { throw RuntimeError.invalid("Stream.Event comparison: bad payloads") } - return la == lb ? 0 : -1 - } - - i.registerComparator(on: "CharacterSet") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? CharacterSet, - case .opaque(_, let b) = rhs, let lb = b as? CharacterSet - else { throw RuntimeError.invalid("CharacterSet comparison: bad payloads") } - return la == lb ? 0 : -1 - } - - i.registerComparator(on: "Locale.Region") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? Locale.Region, - case .opaque(_, let b) = rhs, let lb = b as? Locale.Region - else { throw RuntimeError.invalid("Locale.Region comparison: bad payloads") } + i.registerComparator(on: "Locale.Language") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? Locale.Language, + case .opaque(_, let b) = rhs, let lb = b as? Locale.Language + else { throw RuntimeError.invalid("Locale.Language comparison: bad payloads") } return la == lb ? 0 : -1 } - i.registerComparator(on: "JSONSerialization.WritingOptions") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? JSONSerialization.WritingOptions, - case .opaque(_, let b) = rhs, let lb = b as? JSONSerialization.WritingOptions - else { throw RuntimeError.invalid("JSONSerialization.WritingOptions comparison: bad payloads") } + i.registerComparator(on: "Locale.Script") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? Locale.Script, + case .opaque(_, let b) = rhs, let lb = b as? Locale.Script + else { throw RuntimeError.invalid("Locale.Script comparison: bad payloads") } return la == lb ? 0 : -1 } #if canImport(Darwin) - i.registerComparator(on: "AttributedString") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? AttributedString, - case .opaque(_, let b) = rhs, let lb = b as? AttributedString - else { throw RuntimeError.invalid("AttributedString comparison: bad payloads") } + i.registerComparator(on: "AttributedString.FormattingOptions") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? AttributedString.FormattingOptions, + case .opaque(_, let b) = rhs, let lb = b as? AttributedString.FormattingOptions + else { throw RuntimeError.invalid("AttributedString.FormattingOptions comparison: bad payloads") } return la == lb ? 0 : -1 } #endif #if canImport(Darwin) - i.registerComparator(on: "StringEncodingDetectionOptionsKey") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? StringEncodingDetectionOptionsKey, - case .opaque(_, let b) = rhs, let lb = b as? StringEncodingDetectionOptionsKey - else { throw RuntimeError.invalid("StringEncodingDetectionOptionsKey comparison: bad payloads") } + i.registerComparator(on: "NSData.WritingOptions") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NSData.WritingOptions, + case .opaque(_, let b) = rhs, let lb = b as? NSData.WritingOptions + else { throw RuntimeError.invalid("NSData.WritingOptions comparison: bad payloads") } return la == lb ? 0 : -1 } #endif - i.registerComparator(on: "NSTextCheckingResult.CheckingType") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NSTextCheckingResult.CheckingType, - case .opaque(_, let b) = rhs, let lb = b as? NSTextCheckingResult.CheckingType - else { throw RuntimeError.invalid("NSTextCheckingResult.CheckingType comparison: bad payloads") } - return la == lb ? 0 : -1 - } - - i.registerComparator(on: "Date.ISO8601FormatStyle") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? Date.ISO8601FormatStyle, - case .opaque(_, let b) = rhs, let lb = b as? Date.ISO8601FormatStyle - else { throw RuntimeError.invalid("Date.ISO8601FormatStyle comparison: bad payloads") } - return la == lb ? 0 : -1 - } - - i.registerComparator(on: "CurrencyFormatStyleConfiguration.Presentation") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? CurrencyFormatStyleConfiguration.Presentation, - case .opaque(_, let b) = rhs, let lb = b as? CurrencyFormatStyleConfiguration.Presentation - else { throw RuntimeError.invalid("CurrencyFormatStyleConfiguration.Presentation comparison: bad payloads") } - return la == lb ? 0 : -1 - } - -#if canImport(Darwin) - i.registerComparator(on: "AttributedString.Runs") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? AttributedString.Runs, - case .opaque(_, let b) = rhs, let lb = b as? AttributedString.Runs - else { throw RuntimeError.invalid("AttributedString.Runs comparison: bad payloads") } + i.registerComparator(on: "NumberFormatStyleConfiguration.DecimalSeparatorDisplayStrategy") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NumberFormatStyleConfiguration.DecimalSeparatorDisplayStrategy, + case .opaque(_, let b) = rhs, let lb = b as? NumberFormatStyleConfiguration.DecimalSeparatorDisplayStrategy + else { throw RuntimeError.invalid("NumberFormatStyleConfiguration.DecimalSeparatorDisplayStrategy comparison: bad payloads") } return la == lb ? 0 : -1 } -#endif #if canImport(Darwin) - i.registerComparator(on: "PresentationIntent.TableColumn") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? PresentationIntent.TableColumn, - case .opaque(_, let b) = rhs, let lb = b as? PresentationIntent.TableColumn - else { throw RuntimeError.invalid("PresentationIntent.TableColumn comparison: bad payloads") } + i.registerComparator(on: "NSKeyValueObservingOptions") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NSKeyValueObservingOptions, + case .opaque(_, let b) = rhs, let lb = b as? NSKeyValueObservingOptions + else { throw RuntimeError.invalid("NSKeyValueObservingOptions comparison: bad payloads") } return la == lb ? 0 : -1 } #endif -#if canImport(Darwin) - i.registerComparator(on: "NSString.CompareOptions") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NSString.CompareOptions, - case .opaque(_, let b) = rhs, let lb = b as? NSString.CompareOptions - else { throw RuntimeError.invalid("NSString.CompareOptions comparison: bad payloads") } + i.registerComparator(on: "JSONSerialization.WritingOptions") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? JSONSerialization.WritingOptions, + case .opaque(_, let b) = rhs, let lb = b as? JSONSerialization.WritingOptions + else { throw RuntimeError.invalid("JSONSerialization.WritingOptions comparison: bad payloads") } return la == lb ? 0 : -1 } -#endif #if canImport(Darwin) - i.registerComparator(on: "NSData.Base64EncodingOptions") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NSData.Base64EncodingOptions, - case .opaque(_, let b) = rhs, let lb = b as? NSData.Base64EncodingOptions - else { throw RuntimeError.invalid("NSData.Base64EncodingOptions comparison: bad payloads") } + i.registerComparator(on: "NSKeyValueOperator") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NSKeyValueOperator, + case .opaque(_, let b) = rhs, let lb = b as? NSKeyValueOperator + else { throw RuntimeError.invalid("NSKeyValueOperator comparison: bad payloads") } return la == lb ? 0 : -1 } #endif - i.registerComparator(on: "JSONEncoder.OutputFormatting") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? JSONEncoder.OutputFormatting, - case .opaque(_, let b) = rhs, let lb = b as? JSONEncoder.OutputFormatting - else { throw RuntimeError.invalid("JSONEncoder.OutputFormatting comparison: bad payloads") } - return la == lb ? 0 : -1 - } - i.registerComparator(on: "StreamSocketSecurityLevel") { lhs, rhs in guard case .opaque(_, let a) = lhs, let la = a as? StreamSocketSecurityLevel, case .opaque(_, let b) = rhs, let lb = b as? StreamSocketSecurityLevel @@ -1075,43 +1022,6 @@ extension FoundationModule { return la == lb ? 0 : -1 } - i.registerComparator(on: "NumberFormatStyleConfiguration.SignDisplayStrategy") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NumberFormatStyleConfiguration.SignDisplayStrategy, - case .opaque(_, let b) = rhs, let lb = b as? NumberFormatStyleConfiguration.SignDisplayStrategy - else { throw RuntimeError.invalid("NumberFormatStyleConfiguration.SignDisplayStrategy comparison: bad payloads") } - return la == lb ? 0 : -1 - } - - i.registerComparator(on: "Calendar") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? Calendar, - case .opaque(_, let b) = rhs, let lb = b as? Calendar - else { throw RuntimeError.invalid("Calendar comparison: bad payloads") } - return la == lb ? 0 : -1 - } - -#if canImport(Darwin) - i.registerComparator(on: "NetService.Options") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NetService.Options, - case .opaque(_, let b) = rhs, let lb = b as? NetService.Options - else { throw RuntimeError.invalid("NetService.Options comparison: bad payloads") } - return la == lb ? 0 : -1 - } -#endif - - i.registerComparator(on: "PersonNameComponents") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? PersonNameComponents, - case .opaque(_, let b) = rhs, let lb = b as? PersonNameComponents - else { throw RuntimeError.invalid("PersonNameComponents comparison: bad payloads") } - return la == lb ? 0 : -1 - } - - i.registerComparator(on: "TimeZone") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? TimeZone, - case .opaque(_, let b) = rhs, let lb = b as? TimeZone - else { throw RuntimeError.invalid("TimeZone comparison: bad payloads") } - return la == lb ? 0 : -1 - } - #if canImport(Darwin) i.registerComparator(on: "URLUbiquitousItemDownloadingStatus") { lhs, rhs in guard case .opaque(_, let a) = lhs, let la = a as? URLUbiquitousItemDownloadingStatus, @@ -1121,465 +1031,454 @@ extension FoundationModule { } #endif - i.registerComparator(on: "Locale.Collation") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? Locale.Collation, - case .opaque(_, let b) = rhs, let lb = b as? Locale.Collation - else { throw RuntimeError.invalid("Locale.Collation comparison: bad payloads") } + i.registerComparator(on: "NSNotification.Name") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NSNotification.Name, + case .opaque(_, let b) = rhs, let lb = b as? NSNotification.Name + else { throw RuntimeError.invalid("NSNotification.Name comparison: bad payloads") } return la == lb ? 0 : -1 } -#if canImport(Darwin) - i.registerComparator(on: "UndoManager.UserInfoKey") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? UndoManager.UserInfoKey, - case .opaque(_, let b) = rhs, let lb = b as? UndoManager.UserInfoKey - else { throw RuntimeError.invalid("UndoManager.UserInfoKey comparison: bad payloads") } + i.registerComparator(on: "NSLocale.Key") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NSLocale.Key, + case .opaque(_, let b) = rhs, let lb = b as? NSLocale.Key + else { throw RuntimeError.invalid("NSLocale.Key comparison: bad payloads") } return la == lb ? 0 : -1 } -#endif -#if canImport(Darwin) - i.registerComparator(on: "NSFileManagerSupportedSyncControls") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NSFileManagerSupportedSyncControls, - case .opaque(_, let b) = rhs, let lb = b as? NSFileManagerSupportedSyncControls - else { throw RuntimeError.invalid("NSFileManagerSupportedSyncControls comparison: bad payloads") } + i.registerComparator(on: "URLQueryItem") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? URLQueryItem, + case .opaque(_, let b) = rhs, let lb = b as? URLQueryItem + else { throw RuntimeError.invalid("URLQueryItem comparison: bad payloads") } return la == lb ? 0 : -1 } -#endif - i.registerComparator(on: "NSAttributedString.Key") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NSAttributedString.Key, - case .opaque(_, let b) = rhs, let lb = b as? NSAttributedString.Key - else { throw RuntimeError.invalid("NSAttributedString.Key comparison: bad payloads") } + i.registerComparator(on: "HTTPCookiePropertyKey") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? HTTPCookiePropertyKey, + case .opaque(_, let b) = rhs, let lb = b as? HTTPCookiePropertyKey + else { throw RuntimeError.invalid("HTTPCookiePropertyKey comparison: bad payloads") } return la == lb ? 0 : -1 } - i.registerComparator(on: "URLError") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? URLError, - case .opaque(_, let b) = rhs, let lb = b as? URLError - else { throw RuntimeError.invalid("URLError comparison: bad payloads") } + i.registerComparator(on: "NSString.EncodingConversionOptions") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NSString.EncodingConversionOptions, + case .opaque(_, let b) = rhs, let lb = b as? NSString.EncodingConversionOptions + else { throw RuntimeError.invalid("NSString.EncodingConversionOptions comparison: bad payloads") } return la == lb ? 0 : -1 } - i.registerComparator(on: "Date.VerbatimFormatStyle") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? Date.VerbatimFormatStyle, - case .opaque(_, let b) = rhs, let lb = b as? Date.VerbatimFormatStyle - else { throw RuntimeError.invalid("Date.VerbatimFormatStyle comparison: bad payloads") } + i.registerComparator(on: "Date.FormatString") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? Date.FormatString, + case .opaque(_, let b) = rhs, let lb = b as? Date.FormatString + else { throw RuntimeError.invalid("Date.FormatString comparison: bad payloads") } return la == lb ? 0 : -1 } - i.registerComparator(on: "Date") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? Date, - case .opaque(_, let b) = rhs, let lb = b as? Date - else { throw RuntimeError.invalid("Date comparison: bad payloads") } - return la < lb ? -1 : (la > lb ? 1 : 0) - } - #if canImport(Darwin) - i.registerComparator(on: "AttributedString.FormattingOptions") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? AttributedString.FormattingOptions, - case .opaque(_, let b) = rhs, let lb = b as? AttributedString.FormattingOptions - else { throw RuntimeError.invalid("AttributedString.FormattingOptions comparison: bad payloads") } + i.registerComparator(on: "FileWrapper.WritingOptions") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? FileWrapper.WritingOptions, + case .opaque(_, let b) = rhs, let lb = b as? FileWrapper.WritingOptions + else { throw RuntimeError.invalid("FileWrapper.WritingOptions comparison: bad payloads") } return la == lb ? 0 : -1 } #endif - i.registerComparator(on: "NSAttributedString.EnumerationOptions") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NSAttributedString.EnumerationOptions, - case .opaque(_, let b) = rhs, let lb = b as? NSAttributedString.EnumerationOptions - else { throw RuntimeError.invalid("NSAttributedString.EnumerationOptions comparison: bad payloads") } + i.registerComparator(on: "Locale.Variant") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? Locale.Variant, + case .opaque(_, let b) = rhs, let lb = b as? Locale.Variant + else { throw RuntimeError.invalid("Locale.Variant comparison: bad payloads") } return la == lb ? 0 : -1 } - i.registerComparator(on: "Locale.NumberingSystem") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? Locale.NumberingSystem, - case .opaque(_, let b) = rhs, let lb = b as? Locale.NumberingSystem - else { throw RuntimeError.invalid("Locale.NumberingSystem comparison: bad payloads") } + i.registerComparator(on: "IndexSet") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? IndexSet, + case .opaque(_, let b) = rhs, let lb = b as? IndexSet + else { throw RuntimeError.invalid("IndexSet comparison: bad payloads") } return la == lb ? 0 : -1 } - i.registerComparator(on: "CurrencyFormatStyleConfiguration.SignDisplayStrategy") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? CurrencyFormatStyleConfiguration.SignDisplayStrategy, - case .opaque(_, let b) = rhs, let lb = b as? CurrencyFormatStyleConfiguration.SignDisplayStrategy - else { throw RuntimeError.invalid("CurrencyFormatStyleConfiguration.SignDisplayStrategy comparison: bad payloads") } +#if canImport(Darwin) + i.registerComparator(on: "ProcessInfo.ActivityOptions") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? ProcessInfo.ActivityOptions, + case .opaque(_, let b) = rhs, let lb = b as? ProcessInfo.ActivityOptions + else { throw RuntimeError.invalid("ProcessInfo.ActivityOptions comparison: bad payloads") } return la == lb ? 0 : -1 } +#endif - i.registerComparator(on: "URLRequest") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? URLRequest, - case .opaque(_, let b) = rhs, let lb = b as? URLRequest - else { throw RuntimeError.invalid("URLRequest comparison: bad payloads") } + i.registerComparator(on: "Locale") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? Locale, + case .opaque(_, let b) = rhs, let lb = b as? Locale + else { throw RuntimeError.invalid("Locale comparison: bad payloads") } return la == lb ? 0 : -1 } - i.registerComparator(on: "NSBinarySearchingOptions") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NSBinarySearchingOptions, - case .opaque(_, let b) = rhs, let lb = b as? NSBinarySearchingOptions - else { throw RuntimeError.invalid("NSBinarySearchingOptions comparison: bad payloads") } + i.registerComparator(on: "URLError") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? URLError, + case .opaque(_, let b) = rhs, let lb = b as? URLError + else { throw RuntimeError.invalid("URLError comparison: bad payloads") } return la == lb ? 0 : -1 } - i.registerComparator(on: "NSCalendar.Identifier") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NSCalendar.Identifier, - case .opaque(_, let b) = rhs, let lb = b as? NSCalendar.Identifier - else { throw RuntimeError.invalid("NSCalendar.Identifier comparison: bad payloads") } + i.registerComparator(on: "ByteCountFormatter.Units") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? ByteCountFormatter.Units, + case .opaque(_, let b) = rhs, let lb = b as? ByteCountFormatter.Units + else { throw RuntimeError.invalid("ByteCountFormatter.Units comparison: bad payloads") } return la == lb ? 0 : -1 } -#if canImport(Darwin) - i.registerComparator(on: "FileWrapper.WritingOptions") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? FileWrapper.WritingOptions, - case .opaque(_, let b) = rhs, let lb = b as? FileWrapper.WritingOptions - else { throw RuntimeError.invalid("FileWrapper.WritingOptions comparison: bad payloads") } + i.registerComparator(on: "Morphology") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? Morphology, + case .opaque(_, let b) = rhs, let lb = b as? Morphology + else { throw RuntimeError.invalid("Morphology comparison: bad payloads") } return la == lb ? 0 : -1 } -#endif - i.registerComparator(on: "Notification") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? Notification, - case .opaque(_, let b) = rhs, let lb = b as? Notification - else { throw RuntimeError.invalid("Notification comparison: bad payloads") } - return la == lb ? 0 : -1 + i.registerComparator(on: "DateInterval") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? DateInterval, + case .opaque(_, let b) = rhs, let lb = b as? DateInterval + else { throw RuntimeError.invalid("DateInterval comparison: bad payloads") } + return la < lb ? -1 : (la > lb ? 1 : 0) } - i.registerComparator(on: "NSNotification.Name") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NSNotification.Name, - case .opaque(_, let b) = rhs, let lb = b as? NSNotification.Name - else { throw RuntimeError.invalid("NSNotification.Name comparison: bad payloads") } + i.registerComparator(on: "DescriptiveNumberFormatConfiguration.Presentation") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? DescriptiveNumberFormatConfiguration.Presentation, + case .opaque(_, let b) = rhs, let lb = b as? DescriptiveNumberFormatConfiguration.Presentation + else { throw RuntimeError.invalid("DescriptiveNumberFormatConfiguration.Presentation comparison: bad payloads") } return la == lb ? 0 : -1 } #if canImport(Darwin) - i.registerComparator(on: "NSURL.BookmarkCreationOptions") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NSURL.BookmarkCreationOptions, - case .opaque(_, let b) = rhs, let lb = b as? NSURL.BookmarkCreationOptions - else { throw RuntimeError.invalid("NSURL.BookmarkCreationOptions comparison: bad payloads") } + i.registerComparator(on: "NSData.ReadingOptions") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NSData.ReadingOptions, + case .opaque(_, let b) = rhs, let lb = b as? NSData.ReadingOptions + else { throw RuntimeError.invalid("NSData.ReadingOptions comparison: bad payloads") } return la == lb ? 0 : -1 } #endif -#if canImport(Darwin) - i.registerComparator(on: "NSFileProviderServiceName") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NSFileProviderServiceName, - case .opaque(_, let b) = rhs, let lb = b as? NSFileProviderServiceName - else { throw RuntimeError.invalid("NSFileProviderServiceName comparison: bad payloads") } + i.registerComparator(on: "ByteCountFormatStyle.Attributed") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? ByteCountFormatStyle.Attributed, + case .opaque(_, let b) = rhs, let lb = b as? ByteCountFormatStyle.Attributed + else { throw RuntimeError.invalid("ByteCountFormatStyle.Attributed comparison: bad payloads") } return la == lb ? 0 : -1 } -#endif -#if canImport(Darwin) - i.registerComparator(on: "AttributedString.MarkdownSourcePosition") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? AttributedString.MarkdownSourcePosition, - case .opaque(_, let b) = rhs, let lb = b as? AttributedString.MarkdownSourcePosition - else { throw RuntimeError.invalid("AttributedString.MarkdownSourcePosition comparison: bad payloads") } + i.registerComparator(on: "StreamSOCKSProxyConfiguration") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? StreamSOCKSProxyConfiguration, + case .opaque(_, let b) = rhs, let lb = b as? StreamSOCKSProxyConfiguration + else { throw RuntimeError.invalid("StreamSOCKSProxyConfiguration comparison: bad payloads") } return la == lb ? 0 : -1 } -#endif - i.registerComparator(on: "NSCalendar.Options") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NSCalendar.Options, - case .opaque(_, let b) = rhs, let lb = b as? NSCalendar.Options - else { throw RuntimeError.invalid("NSCalendar.Options comparison: bad payloads") } +#if canImport(Darwin) + i.registerComparator(on: "NSData.Base64DecodingOptions") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NSData.Base64DecodingOptions, + case .opaque(_, let b) = rhs, let lb = b as? NSData.Base64DecodingOptions + else { throw RuntimeError.invalid("NSData.Base64DecodingOptions comparison: bad payloads") } return la == lb ? 0 : -1 } +#endif -#if canImport(Darwin) - i.registerComparator(on: "NSFileCoordinator.WritingOptions") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NSFileCoordinator.WritingOptions, - case .opaque(_, let b) = rhs, let lb = b as? NSFileCoordinator.WritingOptions - else { throw RuntimeError.invalid("NSFileCoordinator.WritingOptions comparison: bad payloads") } + i.registerComparator(on: "URLComponents") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? URLComponents, + case .opaque(_, let b) = rhs, let lb = b as? URLComponents + else { throw RuntimeError.invalid("URLComponents comparison: bad payloads") } return la == lb ? 0 : -1 } -#endif -#if canImport(Darwin) - i.registerComparator(on: "ProcessInfo") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? ProcessInfo, - case .opaque(_, let b) = rhs, let lb = b as? ProcessInfo - else { throw RuntimeError.invalid("ProcessInfo comparison: bad payloads") } + i.registerComparator(on: "StringTransform") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? StringTransform, + case .opaque(_, let b) = rhs, let lb = b as? StringTransform + else { throw RuntimeError.invalid("StringTransform comparison: bad payloads") } return la == lb ? 0 : -1 } -#endif - i.registerComparator(on: "FileManager.SearchPathDomainMask") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? FileManager.SearchPathDomainMask, - case .opaque(_, let b) = rhs, let lb = b as? FileManager.SearchPathDomainMask - else { throw RuntimeError.invalid("FileManager.SearchPathDomainMask comparison: bad payloads") } + i.registerComparator(on: "NSString.EnumerationOptions") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NSString.EnumerationOptions, + case .opaque(_, let b) = rhs, let lb = b as? NSString.EnumerationOptions + else { throw RuntimeError.invalid("NSString.EnumerationOptions comparison: bad payloads") } return la == lb ? 0 : -1 } - i.registerComparator(on: "Date.IntervalFormatStyle") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? Date.IntervalFormatStyle, - case .opaque(_, let b) = rhs, let lb = b as? Date.IntervalFormatStyle - else { throw RuntimeError.invalid("Date.IntervalFormatStyle comparison: bad payloads") } + i.registerComparator(on: "URLError.Code") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? URLError.Code, + case .opaque(_, let b) = rhs, let lb = b as? URLError.Code + else { throw RuntimeError.invalid("URLError.Code comparison: bad payloads") } return la == lb ? 0 : -1 } #if canImport(Darwin) - i.registerComparator(on: "NSPointerFunctions.Options") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NSPointerFunctions.Options, - case .opaque(_, let b) = rhs, let lb = b as? NSPointerFunctions.Options - else { throw RuntimeError.invalid("NSPointerFunctions.Options comparison: bad payloads") } + i.registerComparator(on: "NSFileCoordinator.WritingOptions") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NSFileCoordinator.WritingOptions, + case .opaque(_, let b) = rhs, let lb = b as? NSFileCoordinator.WritingOptions + else { throw RuntimeError.invalid("NSFileCoordinator.WritingOptions comparison: bad payloads") } return la == lb ? 0 : -1 } #endif + i.registerComparator(on: "Data") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? Data, + case .opaque(_, let b) = rhs, let lb = b as? Data + else { throw RuntimeError.invalid("Data comparison: bad payloads") } + return la == lb ? 0 : -1 + } + #if canImport(Darwin) - i.registerComparator(on: "NSKeyValueObservingOptions") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NSKeyValueObservingOptions, - case .opaque(_, let b) = rhs, let lb = b as? NSKeyValueObservingOptions - else { throw RuntimeError.invalid("NSKeyValueObservingOptions comparison: bad payloads") } + i.registerComparator(on: "NSString.CompareOptions") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NSString.CompareOptions, + case .opaque(_, let b) = rhs, let lb = b as? NSString.CompareOptions + else { throw RuntimeError.invalid("NSString.CompareOptions comparison: bad payloads") } return la == lb ? 0 : -1 } #endif - i.registerComparator(on: "NotificationQueue.NotificationCoalescing") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NotificationQueue.NotificationCoalescing, - case .opaque(_, let b) = rhs, let lb = b as? NotificationQueue.NotificationCoalescing - else { throw RuntimeError.invalid("NotificationQueue.NotificationCoalescing comparison: bad payloads") } + i.registerComparator(on: "NSEnumerationOptions") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NSEnumerationOptions, + case .opaque(_, let b) = rhs, let lb = b as? NSEnumerationOptions + else { throw RuntimeError.invalid("NSEnumerationOptions comparison: bad payloads") } return la == lb ? 0 : -1 } - i.registerComparator(on: "URLFileResourceType") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? URLFileResourceType, - case .opaque(_, let b) = rhs, let lb = b as? URLFileResourceType - else { throw RuntimeError.invalid("URLFileResourceType comparison: bad payloads") } +#if canImport(Darwin) + i.registerComparator(on: "NSData.SearchOptions") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NSData.SearchOptions, + case .opaque(_, let b) = rhs, let lb = b as? NSData.SearchOptions + else { throw RuntimeError.invalid("NSData.SearchOptions comparison: bad payloads") } return la == lb ? 0 : -1 } +#endif - i.registerComparator(on: "Decimal") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? Decimal, - case .opaque(_, let b) = rhs, let lb = b as? Decimal - else { throw RuntimeError.invalid("Decimal comparison: bad payloads") } + i.registerComparator(on: "IndexSet.Index") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? IndexSet.Index, + case .opaque(_, let b) = rhs, let lb = b as? IndexSet.Index + else { throw RuntimeError.invalid("IndexSet.Index comparison: bad payloads") } return la < lb ? -1 : (la > lb ? 1 : 0) } - i.registerComparator(on: "FileManager.VolumeEnumerationOptions") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? FileManager.VolumeEnumerationOptions, - case .opaque(_, let b) = rhs, let lb = b as? FileManager.VolumeEnumerationOptions - else { throw RuntimeError.invalid("FileManager.VolumeEnumerationOptions comparison: bad payloads") } + i.registerComparator(on: "Morphology.CustomPronoun") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? Morphology.CustomPronoun, + case .opaque(_, let b) = rhs, let lb = b as? Morphology.CustomPronoun + else { throw RuntimeError.invalid("Morphology.CustomPronoun comparison: bad payloads") } return la == lb ? 0 : -1 } #if canImport(Darwin) - i.registerComparator(on: "NSLinguisticTagger.Options") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NSLinguisticTagger.Options, - case .opaque(_, let b) = rhs, let lb = b as? NSLinguisticTagger.Options - else { throw RuntimeError.invalid("NSLinguisticTagger.Options comparison: bad payloads") } + i.registerComparator(on: "LocalizedStringResource") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? LocalizedStringResource, + case .opaque(_, let b) = rhs, let lb = b as? LocalizedStringResource + else { throw RuntimeError.invalid("LocalizedStringResource comparison: bad payloads") } return la == lb ? 0 : -1 } #endif - i.registerComparator(on: "URLResourceKey") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? URLResourceKey, - case .opaque(_, let b) = rhs, let lb = b as? URLResourceKey - else { throw RuntimeError.invalid("URLResourceKey comparison: bad payloads") } + i.registerComparator(on: "ProgressKind") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? ProgressKind, + case .opaque(_, let b) = rhs, let lb = b as? ProgressKind + else { throw RuntimeError.invalid("ProgressKind comparison: bad payloads") } return la == lb ? 0 : -1 } -#if canImport(Darwin) - i.registerComparator(on: "URLSession") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? URLSession, - case .opaque(_, let b) = rhs, let lb = b as? URLSession - else { throw RuntimeError.invalid("URLSession comparison: bad payloads") } + i.registerComparator(on: "CocoaError.Code") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? CocoaError.Code, + case .opaque(_, let b) = rhs, let lb = b as? CocoaError.Code + else { throw RuntimeError.invalid("CocoaError.Code comparison: bad payloads") } return la == lb ? 0 : -1 } -#endif - i.registerComparator(on: "POSIXError") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? POSIXError, - case .opaque(_, let b) = rhs, let lb = b as? POSIXError - else { throw RuntimeError.invalid("POSIXError comparison: bad payloads") } +#if canImport(Darwin) + i.registerComparator(on: "NSLinguisticTagger.Options") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NSLinguisticTagger.Options, + case .opaque(_, let b) = rhs, let lb = b as? NSLinguisticTagger.Options + else { throw RuntimeError.invalid("NSLinguisticTagger.Options comparison: bad payloads") } return la == lb ? 0 : -1 } +#endif - i.registerComparator(on: "Morphology") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? Morphology, - case .opaque(_, let b) = rhs, let lb = b as? Morphology - else { throw RuntimeError.invalid("Morphology comparison: bad payloads") } +#if canImport(Darwin) + i.registerComparator(on: "InlinePresentationIntent") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? InlinePresentationIntent, + case .opaque(_, let b) = rhs, let lb = b as? InlinePresentationIntent + else { throw RuntimeError.invalid("InlinePresentationIntent comparison: bad payloads") } return la == lb ? 0 : -1 } +#endif - i.registerComparator(on: "Progress.FileOperationKind") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? Progress.FileOperationKind, - case .opaque(_, let b) = rhs, let lb = b as? Progress.FileOperationKind - else { throw RuntimeError.invalid("Progress.FileOperationKind comparison: bad payloads") } + i.registerComparator(on: "DateComponents") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? DateComponents, + case .opaque(_, let b) = rhs, let lb = b as? DateComponents + else { throw RuntimeError.invalid("DateComponents comparison: bad payloads") } return la == lb ? 0 : -1 } - i.registerComparator(on: "FileAttributeType") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? FileAttributeType, - case .opaque(_, let b) = rhs, let lb = b as? FileAttributeType - else { throw RuntimeError.invalid("FileAttributeType comparison: bad payloads") } + i.registerComparator(on: "RunLoop.Mode") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? RunLoop.Mode, + case .opaque(_, let b) = rhs, let lb = b as? RunLoop.Mode + else { throw RuntimeError.invalid("RunLoop.Mode comparison: bad payloads") } return la == lb ? 0 : -1 } - i.registerComparator(on: "Stream.PropertyKey") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? Stream.PropertyKey, - case .opaque(_, let b) = rhs, let lb = b as? Stream.PropertyKey - else { throw RuntimeError.invalid("Stream.PropertyKey comparison: bad payloads") } + i.registerComparator(on: "Date.VerbatimFormatStyle") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? Date.VerbatimFormatStyle, + case .opaque(_, let b) = rhs, let lb = b as? Date.VerbatimFormatStyle + else { throw RuntimeError.invalid("Date.VerbatimFormatStyle comparison: bad payloads") } return la == lb ? 0 : -1 } - i.registerComparator(on: "StreamSOCKSProxyVersion") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? StreamSOCKSProxyVersion, - case .opaque(_, let b) = rhs, let lb = b as? StreamSOCKSProxyVersion - else { throw RuntimeError.invalid("StreamSOCKSProxyVersion comparison: bad payloads") } +#if canImport(Darwin) + i.registerComparator(on: "PresentationIntent") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? PresentationIntent, + case .opaque(_, let b) = rhs, let lb = b as? PresentationIntent + else { throw RuntimeError.invalid("PresentationIntent comparison: bad payloads") } return la == lb ? 0 : -1 } +#endif - i.registerComparator(on: "Date.FormatString") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? Date.FormatString, - case .opaque(_, let b) = rhs, let lb = b as? Date.FormatString - else { throw RuntimeError.invalid("Date.FormatString comparison: bad payloads") } + i.registerComparator(on: "NSSortOptions") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NSSortOptions, + case .opaque(_, let b) = rhs, let lb = b as? NSSortOptions + else { throw RuntimeError.invalid("NSSortOptions comparison: bad payloads") } return la == lb ? 0 : -1 } #if canImport(Darwin) - i.registerComparator(on: "NSData.ReadingOptions") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NSData.ReadingOptions, - case .opaque(_, let b) = rhs, let lb = b as? NSData.ReadingOptions - else { throw RuntimeError.invalid("NSData.ReadingOptions comparison: bad payloads") } + i.registerComparator(on: "FileManager") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? FileManager, + case .opaque(_, let b) = rhs, let lb = b as? FileManager + else { throw RuntimeError.invalid("FileManager comparison: bad payloads") } return la == lb ? 0 : -1 } #endif - i.registerComparator(on: "Date.FormatStyle") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? Date.FormatStyle, - case .opaque(_, let b) = rhs, let lb = b as? Date.FormatStyle - else { throw RuntimeError.invalid("Date.FormatStyle comparison: bad payloads") } + i.registerComparator(on: "NSTextCheckingKey") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NSTextCheckingKey, + case .opaque(_, let b) = rhs, let lb = b as? NSTextCheckingKey + else { throw RuntimeError.invalid("NSTextCheckingKey comparison: bad payloads") } return la == lb ? 0 : -1 } - i.registerComparator(on: "Date.ComponentsFormatStyle") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? Date.ComponentsFormatStyle, - case .opaque(_, let b) = rhs, let lb = b as? Date.ComponentsFormatStyle - else { throw RuntimeError.invalid("Date.ComponentsFormatStyle comparison: bad payloads") } + i.registerComparator(on: "FileProtectionType") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? FileProtectionType, + case .opaque(_, let b) = rhs, let lb = b as? FileProtectionType + else { throw RuntimeError.invalid("FileProtectionType comparison: bad payloads") } return la == lb ? 0 : -1 } -#if canImport(Darwin) - i.registerComparator(on: "TermOfAddress") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? TermOfAddress, - case .opaque(_, let b) = rhs, let lb = b as? TermOfAddress - else { throw RuntimeError.invalid("TermOfAddress comparison: bad payloads") } + i.registerComparator(on: "NSCalendar.Identifier") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NSCalendar.Identifier, + case .opaque(_, let b) = rhs, let lb = b as? NSCalendar.Identifier + else { throw RuntimeError.invalid("NSCalendar.Identifier comparison: bad payloads") } return la == lb ? 0 : -1 } -#endif #if canImport(Darwin) - i.registerComparator(on: "DateComponentsFormatter.ZeroFormattingBehavior") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? DateComponentsFormatter.ZeroFormattingBehavior, - case .opaque(_, let b) = rhs, let lb = b as? DateComponentsFormatter.ZeroFormattingBehavior - else { throw RuntimeError.invalid("DateComponentsFormatter.ZeroFormattingBehavior comparison: bad payloads") } + i.registerComparator(on: "URLUbiquitousSharedItemRole") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? URLUbiquitousSharedItemRole, + case .opaque(_, let b) = rhs, let lb = b as? URLUbiquitousSharedItemRole + else { throw RuntimeError.invalid("URLUbiquitousSharedItemRole comparison: bad payloads") } return la == lb ? 0 : -1 } #endif - i.registerComparator(on: "Locale.Currency") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? Locale.Currency, - case .opaque(_, let b) = rhs, let lb = b as? Locale.Currency - else { throw RuntimeError.invalid("Locale.Currency comparison: bad payloads") } + i.registerComparator(on: "NSTextCheckingResult.CheckingType") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NSTextCheckingResult.CheckingType, + case .opaque(_, let b) = rhs, let lb = b as? NSTextCheckingResult.CheckingType + else { throw RuntimeError.invalid("NSTextCheckingResult.CheckingType comparison: bad payloads") } return la == lb ? 0 : -1 } -#if canImport(Darwin) - i.registerComparator(on: "HTTPURLResponse") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? HTTPURLResponse, - case .opaque(_, let b) = rhs, let lb = b as? HTTPURLResponse - else { throw RuntimeError.invalid("HTTPURLResponse comparison: bad payloads") } + i.registerComparator(on: "ByteCountFormatStyle.Units") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? ByteCountFormatStyle.Units, + case .opaque(_, let b) = rhs, let lb = b as? ByteCountFormatStyle.Units + else { throw RuntimeError.invalid("ByteCountFormatStyle.Units comparison: bad payloads") } return la == lb ? 0 : -1 } -#endif - i.registerComparator(on: "ProgressKind") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? ProgressKind, - case .opaque(_, let b) = rhs, let lb = b as? ProgressKind - else { throw RuntimeError.invalid("ProgressKind comparison: bad payloads") } + i.registerComparator(on: "PropertyListSerialization.MutabilityOptions") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? PropertyListSerialization.MutabilityOptions, + case .opaque(_, let b) = rhs, let lb = b as? PropertyListSerialization.MutabilityOptions + else { throw RuntimeError.invalid("PropertyListSerialization.MutabilityOptions comparison: bad payloads") } return la == lb ? 0 : -1 } - i.registerComparator(on: "JSONSerialization.ReadingOptions") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? JSONSerialization.ReadingOptions, - case .opaque(_, let b) = rhs, let lb = b as? JSONSerialization.ReadingOptions - else { throw RuntimeError.invalid("JSONSerialization.ReadingOptions comparison: bad payloads") } + i.registerComparator(on: "Locale.LanguageCode") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? Locale.LanguageCode, + case .opaque(_, let b) = rhs, let lb = b as? Locale.LanguageCode + else { throw RuntimeError.invalid("Locale.LanguageCode comparison: bad payloads") } return la == lb ? 0 : -1 } #if canImport(Darwin) - i.registerComparator(on: "URLUbiquitousSharedItemRole") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? URLUbiquitousSharedItemRole, - case .opaque(_, let b) = rhs, let lb = b as? URLUbiquitousSharedItemRole - else { throw RuntimeError.invalid("URLUbiquitousSharedItemRole comparison: bad payloads") } + i.registerComparator(on: "PersonNameComponents.FormatStyle") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? PersonNameComponents.FormatStyle, + case .opaque(_, let b) = rhs, let lb = b as? PersonNameComponents.FormatStyle + else { throw RuntimeError.invalid("PersonNameComponents.FormatStyle comparison: bad payloads") } return la == lb ? 0 : -1 } #endif - i.registerComparator(on: "NSSortOptions") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NSSortOptions, - case .opaque(_, let b) = rhs, let lb = b as? NSSortOptions - else { throw RuntimeError.invalid("NSSortOptions comparison: bad payloads") } +#if canImport(Darwin) + i.registerComparator(on: "PresentationIntent.TableColumn") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? PresentationIntent.TableColumn, + case .opaque(_, let b) = rhs, let lb = b as? PresentationIntent.TableColumn + else { throw RuntimeError.invalid("PresentationIntent.TableColumn comparison: bad payloads") } return la == lb ? 0 : -1 } +#endif - i.registerComparator(on: "IndexSet") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? IndexSet, - case .opaque(_, let b) = rhs, let lb = b as? IndexSet - else { throw RuntimeError.invalid("IndexSet comparison: bad payloads") } +#if canImport(Darwin) + i.registerComparator(on: "PersonNameComponents.ParseStrategy") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? PersonNameComponents.ParseStrategy, + case .opaque(_, let b) = rhs, let lb = b as? PersonNameComponents.ParseStrategy + else { throw RuntimeError.invalid("PersonNameComponents.ParseStrategy comparison: bad payloads") } return la == lb ? 0 : -1 } +#endif #if canImport(Darwin) - i.registerComparator(on: "URL.FormatStyle") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? URL.FormatStyle, - case .opaque(_, let b) = rhs, let lb = b as? URL.FormatStyle - else { throw RuntimeError.invalid("URL.FormatStyle comparison: bad payloads") } + i.registerComparator(on: "NSKeyValueChangeKey") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NSKeyValueChangeKey, + case .opaque(_, let b) = rhs, let lb = b as? NSKeyValueChangeKey + else { throw RuntimeError.invalid("NSKeyValueChangeKey comparison: bad payloads") } return la == lb ? 0 : -1 } #endif - i.registerComparator(on: "URLComponents") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? URLComponents, - case .opaque(_, let b) = rhs, let lb = b as? URLComponents - else { throw RuntimeError.invalid("URLComponents comparison: bad payloads") } +#if canImport(Darwin) + i.registerComparator(on: "NSURL.BookmarkResolutionOptions") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NSURL.BookmarkResolutionOptions, + case .opaque(_, let b) = rhs, let lb = b as? NSURL.BookmarkResolutionOptions + else { throw RuntimeError.invalid("NSURL.BookmarkResolutionOptions comparison: bad payloads") } return la == lb ? 0 : -1 } +#endif - i.registerComparator(on: "NSRegularExpression.MatchingOptions") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NSRegularExpression.MatchingOptions, - case .opaque(_, let b) = rhs, let lb = b as? NSRegularExpression.MatchingOptions - else { throw RuntimeError.invalid("NSRegularExpression.MatchingOptions comparison: bad payloads") } + i.registerComparator(on: "FileManager.SearchPathDomainMask") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? FileManager.SearchPathDomainMask, + case .opaque(_, let b) = rhs, let lb = b as? FileManager.SearchPathDomainMask + else { throw RuntimeError.invalid("FileManager.SearchPathDomainMask comparison: bad payloads") } return la == lb ? 0 : -1 } - i.registerComparator(on: "IndexSet.Index") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? IndexSet.Index, - case .opaque(_, let b) = rhs, let lb = b as? IndexSet.Index - else { throw RuntimeError.invalid("IndexSet.Index comparison: bad payloads") } - return la < lb ? -1 : (la > lb ? 1 : 0) - } - -#if canImport(Darwin) - i.registerComparator(on: "FileManager") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? FileManager, - case .opaque(_, let b) = rhs, let lb = b as? FileManager - else { throw RuntimeError.invalid("FileManager comparison: bad payloads") } + i.registerComparator(on: "IndexSet.RangeView") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? IndexSet.RangeView, + case .opaque(_, let b) = rhs, let lb = b as? IndexSet.RangeView + else { throw RuntimeError.invalid("IndexSet.RangeView comparison: bad payloads") } return la == lb ? 0 : -1 } -#endif - i.registerComparator(on: "NSTextCheckingKey") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NSTextCheckingKey, - case .opaque(_, let b) = rhs, let lb = b as? NSTextCheckingKey - else { throw RuntimeError.invalid("NSTextCheckingKey comparison: bad payloads") } + i.registerComparator(on: "CurrencyFormatStyleConfiguration.Presentation") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? CurrencyFormatStyleConfiguration.Presentation, + case .opaque(_, let b) = rhs, let lb = b as? CurrencyFormatStyleConfiguration.Presentation + else { throw RuntimeError.invalid("CurrencyFormatStyleConfiguration.Presentation comparison: bad payloads") } return la == lb ? 0 : -1 } #if canImport(Darwin) - i.registerComparator(on: "NSValueTransformerName") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NSValueTransformerName, - case .opaque(_, let b) = rhs, let lb = b as? NSValueTransformerName - else { throw RuntimeError.invalid("NSValueTransformerName comparison: bad payloads") } - return la == lb ? 0 : -1 + i.registerComparator(on: "AttributedString.Index") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? AttributedString.Index, + case .opaque(_, let b) = rhs, let lb = b as? AttributedString.Index + else { throw RuntimeError.invalid("AttributedString.Index comparison: bad payloads") } + return la < lb ? -1 : (la > lb ? 1 : 0) } #endif @@ -1592,41 +1491,50 @@ extension FoundationModule { } #endif - i.registerComparator(on: "ByteCountFormatStyle") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? ByteCountFormatStyle, - case .opaque(_, let b) = rhs, let lb = b as? ByteCountFormatStyle - else { throw RuntimeError.invalid("ByteCountFormatStyle comparison: bad payloads") } + i.registerComparator(on: "Date.ISO8601FormatStyle") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? Date.ISO8601FormatStyle, + case .opaque(_, let b) = rhs, let lb = b as? Date.ISO8601FormatStyle + else { throw RuntimeError.invalid("Date.ISO8601FormatStyle comparison: bad payloads") } + return la == lb ? 0 : -1 + } + + i.registerComparator(on: "Date.ParseStrategy") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? Date.ParseStrategy, + case .opaque(_, let b) = rhs, let lb = b as? Date.ParseStrategy + else { throw RuntimeError.invalid("Date.ParseStrategy comparison: bad payloads") } return la == lb ? 0 : -1 } - i.registerComparator(on: "Date.AnchoredRelativeFormatStyle") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? Date.AnchoredRelativeFormatStyle, - case .opaque(_, let b) = rhs, let lb = b as? Date.AnchoredRelativeFormatStyle - else { throw RuntimeError.invalid("Date.AnchoredRelativeFormatStyle comparison: bad payloads") } + i.registerComparator(on: "AttributeContainer") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? AttributeContainer, + case .opaque(_, let b) = rhs, let lb = b as? AttributeContainer + else { throw RuntimeError.invalid("AttributeContainer comparison: bad payloads") } return la == lb ? 0 : -1 } - i.registerComparator(on: "URLError.Code") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? URLError.Code, - case .opaque(_, let b) = rhs, let lb = b as? URLError.Code - else { throw RuntimeError.invalid("URLError.Code comparison: bad payloads") } +#if canImport(Darwin) + i.registerComparator(on: "MachError") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? MachError, + case .opaque(_, let b) = rhs, let lb = b as? MachError + else { throw RuntimeError.invalid("MachError comparison: bad payloads") } return la == lb ? 0 : -1 } +#endif #if canImport(Darwin) - i.registerComparator(on: "NSXPCConnection.Options") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NSXPCConnection.Options, - case .opaque(_, let b) = rhs, let lb = b as? NSXPCConnection.Options - else { throw RuntimeError.invalid("NSXPCConnection.Options comparison: bad payloads") } + i.registerComparator(on: "AttributedString.InterpolationOptions") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? AttributedString.InterpolationOptions, + case .opaque(_, let b) = rhs, let lb = b as? AttributedString.InterpolationOptions + else { throw RuntimeError.invalid("AttributedString.InterpolationOptions comparison: bad payloads") } return la == lb ? 0 : -1 } #endif - i.registerComparator(on: "UUID") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? UUID, - case .opaque(_, let b) = rhs, let lb = b as? UUID - else { throw RuntimeError.invalid("UUID comparison: bad payloads") } - return la < lb ? -1 : (la > lb ? 1 : 0) + i.registerComparator(on: "Date.IntervalFormatStyle") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? Date.IntervalFormatStyle, + case .opaque(_, let b) = rhs, let lb = b as? Date.IntervalFormatStyle + else { throw RuntimeError.invalid("Date.IntervalFormatStyle comparison: bad payloads") } + return la == lb ? 0 : -1 } i.registerComparator(on: "Locale.MeasurementSystem") { lhs, rhs in @@ -1636,99 +1544,90 @@ extension FoundationModule { return la == lb ? 0 : -1 } - i.registerComparator(on: "FileManager.ItemReplacementOptions") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? FileManager.ItemReplacementOptions, - case .opaque(_, let b) = rhs, let lb = b as? FileManager.ItemReplacementOptions - else { throw RuntimeError.invalid("FileManager.ItemReplacementOptions comparison: bad payloads") } + i.registerComparator(on: "Date.FormatStyle") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? Date.FormatStyle, + case .opaque(_, let b) = rhs, let lb = b as? Date.FormatStyle + else { throw RuntimeError.invalid("Date.FormatStyle comparison: bad payloads") } return la == lb ? 0 : -1 } - i.registerComparator(on: "NSRegularExpression.Options") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NSRegularExpression.Options, - case .opaque(_, let b) = rhs, let lb = b as? NSRegularExpression.Options - else { throw RuntimeError.invalid("NSRegularExpression.Options comparison: bad payloads") } + i.registerComparator(on: "Stream.Event") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? Stream.Event, + case .opaque(_, let b) = rhs, let lb = b as? Stream.Event + else { throw RuntimeError.invalid("Stream.Event comparison: bad payloads") } return la == lb ? 0 : -1 } #if canImport(Darwin) - i.registerComparator(on: "NSData.WritingOptions") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NSData.WritingOptions, - case .opaque(_, let b) = rhs, let lb = b as? NSData.WritingOptions - else { throw RuntimeError.invalid("NSData.WritingOptions comparison: bad payloads") } + i.registerComparator(on: "NSItemProviderFileOptions") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NSItemProviderFileOptions, + case .opaque(_, let b) = rhs, let lb = b as? NSItemProviderFileOptions + else { throw RuntimeError.invalid("NSItemProviderFileOptions comparison: bad payloads") } return la == lb ? 0 : -1 } #endif -#if canImport(Darwin) - i.registerComparator(on: "AttributedString.InterpolationOptions") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? AttributedString.InterpolationOptions, - case .opaque(_, let b) = rhs, let lb = b as? AttributedString.InterpolationOptions - else { throw RuntimeError.invalid("AttributedString.InterpolationOptions comparison: bad payloads") } + i.registerComparator(on: "NSBinarySearchingOptions") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NSBinarySearchingOptions, + case .opaque(_, let b) = rhs, let lb = b as? NSBinarySearchingOptions + else { throw RuntimeError.invalid("NSBinarySearchingOptions comparison: bad payloads") } return la == lb ? 0 : -1 } -#endif #if canImport(Darwin) - i.registerComparator(on: "PersonNameComponentsFormatter.Options") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? PersonNameComponentsFormatter.Options, - case .opaque(_, let b) = rhs, let lb = b as? PersonNameComponentsFormatter.Options - else { throw RuntimeError.invalid("PersonNameComponentsFormatter.Options comparison: bad payloads") } + i.registerComparator(on: "URLUbiquitousSharedItemPermissions") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? URLUbiquitousSharedItemPermissions, + case .opaque(_, let b) = rhs, let lb = b as? URLUbiquitousSharedItemPermissions + else { throw RuntimeError.invalid("URLUbiquitousSharedItemPermissions comparison: bad payloads") } return la == lb ? 0 : -1 } #endif - i.registerComparator(on: "FileManager.DirectoryEnumerationOptions") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? FileManager.DirectoryEnumerationOptions, - case .opaque(_, let b) = rhs, let lb = b as? FileManager.DirectoryEnumerationOptions - else { throw RuntimeError.invalid("FileManager.DirectoryEnumerationOptions comparison: bad payloads") } - return la == lb ? 0 : -1 - } - #if canImport(Darwin) - i.registerComparator(on: "PresentationIntent") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? PresentationIntent, - case .opaque(_, let b) = rhs, let lb = b as? PresentationIntent - else { throw RuntimeError.invalid("PresentationIntent comparison: bad payloads") } + i.registerComparator(on: "PresentationIntent.IntentType") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? PresentationIntent.IntentType, + case .opaque(_, let b) = rhs, let lb = b as? PresentationIntent.IntentType + else { throw RuntimeError.invalid("PresentationIntent.IntentType comparison: bad payloads") } return la == lb ? 0 : -1 } #endif -#if canImport(Darwin) - i.registerComparator(on: "NSLinguisticTagScheme") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NSLinguisticTagScheme, - case .opaque(_, let b) = rhs, let lb = b as? NSLinguisticTagScheme - else { throw RuntimeError.invalid("NSLinguisticTagScheme comparison: bad payloads") } + i.registerComparator(on: "FormatStyleCapitalizationContext") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? FormatStyleCapitalizationContext, + case .opaque(_, let b) = rhs, let lb = b as? FormatStyleCapitalizationContext + else { throw RuntimeError.invalid("FormatStyleCapitalizationContext comparison: bad payloads") } return la == lb ? 0 : -1 } -#endif #if canImport(Darwin) - i.registerComparator(on: "URLResource") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? URLResource, - case .opaque(_, let b) = rhs, let lb = b as? URLResource - else { throw RuntimeError.invalid("URLResource comparison: bad payloads") } + i.registerComparator(on: "NSFileVersion.ReplacingOptions") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NSFileVersion.ReplacingOptions, + case .opaque(_, let b) = rhs, let lb = b as? NSFileVersion.ReplacingOptions + else { throw RuntimeError.invalid("NSFileVersion.ReplacingOptions comparison: bad payloads") } return la == lb ? 0 : -1 } #endif - i.registerComparator(on: "StringTransform") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? StringTransform, - case .opaque(_, let b) = rhs, let lb = b as? StringTransform - else { throw RuntimeError.invalid("StringTransform comparison: bad payloads") } +#if canImport(Darwin) + i.registerComparator(on: "NSXPCConnection.Options") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NSXPCConnection.Options, + case .opaque(_, let b) = rhs, let lb = b as? NSXPCConnection.Options + else { throw RuntimeError.invalid("NSXPCConnection.Options comparison: bad payloads") } return la == lb ? 0 : -1 } +#endif - i.registerComparator(on: "CocoaError") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? CocoaError, - case .opaque(_, let b) = rhs, let lb = b as? CocoaError - else { throw RuntimeError.invalid("CocoaError comparison: bad payloads") } + i.registerComparator(on: "NSExceptionName") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NSExceptionName, + case .opaque(_, let b) = rhs, let lb = b as? NSExceptionName + else { throw RuntimeError.invalid("NSExceptionName comparison: bad payloads") } return la == lb ? 0 : -1 } - i.registerComparator(on: "Locale.Variant") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? Locale.Variant, - case .opaque(_, let b) = rhs, let lb = b as? Locale.Variant - else { throw RuntimeError.invalid("Locale.Variant comparison: bad payloads") } + i.registerComparator(on: "NSAttributedString.EnumerationOptions") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NSAttributedString.EnumerationOptions, + case .opaque(_, let b) = rhs, let lb = b as? NSAttributedString.EnumerationOptions + else { throw RuntimeError.invalid("NSAttributedString.EnumerationOptions comparison: bad payloads") } return la == lb ? 0 : -1 } @@ -1739,6 +1638,13 @@ extension FoundationModule { return la == lb ? 0 : -1 } + i.registerComparator(on: "Date.RelativeFormatStyle") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? Date.RelativeFormatStyle, + case .opaque(_, let b) = rhs, let lb = b as? Date.RelativeFormatStyle + else { throw RuntimeError.invalid("Date.RelativeFormatStyle comparison: bad payloads") } + return la == lb ? 0 : -1 + } + #if canImport(Darwin) i.registerComparator(on: "MeasurementFormatter.UnitOptions") { lhs, rhs in guard case .opaque(_, let a) = lhs, let la = a as? MeasurementFormatter.UnitOptions, @@ -1748,11 +1654,50 @@ extension FoundationModule { } #endif + i.registerComparator(on: "PersonNameComponents") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? PersonNameComponents, + case .opaque(_, let b) = rhs, let lb = b as? PersonNameComponents + else { throw RuntimeError.invalid("PersonNameComponents comparison: bad payloads") } + return la == lb ? 0 : -1 + } + #if canImport(Darwin) - i.registerComparator(on: "NSFileCoordinator.ReadingOptions") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NSFileCoordinator.ReadingOptions, - case .opaque(_, let b) = rhs, let lb = b as? NSFileCoordinator.ReadingOptions - else { throw RuntimeError.invalid("NSFileCoordinator.ReadingOptions comparison: bad payloads") } + i.registerComparator(on: "NSData.Base64EncodingOptions") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NSData.Base64EncodingOptions, + case .opaque(_, let b) = rhs, let lb = b as? NSData.Base64EncodingOptions + else { throw RuntimeError.invalid("NSData.Base64EncodingOptions comparison: bad payloads") } + return la == lb ? 0 : -1 + } +#endif + +#if canImport(Darwin) + i.registerComparator(on: "HTTPURLResponse") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? HTTPURLResponse, + case .opaque(_, let b) = rhs, let lb = b as? HTTPURLResponse + else { throw RuntimeError.invalid("HTTPURLResponse comparison: bad payloads") } + return la == lb ? 0 : -1 + } +#endif + + i.registerComparator(on: "NSCalendar.Options") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NSCalendar.Options, + case .opaque(_, let b) = rhs, let lb = b as? NSCalendar.Options + else { throw RuntimeError.invalid("NSCalendar.Options comparison: bad payloads") } + return la == lb ? 0 : -1 + } + + i.registerComparator(on: "CocoaError") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? CocoaError, + case .opaque(_, let b) = rhs, let lb = b as? CocoaError + else { throw RuntimeError.invalid("CocoaError comparison: bad payloads") } + return la == lb ? 0 : -1 + } + +#if canImport(Darwin) + i.registerComparator(on: "PersonNameComponents.AttributedStyle") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? PersonNameComponents.AttributedStyle, + case .opaque(_, let b) = rhs, let lb = b as? PersonNameComponents.AttributedStyle + else { throw RuntimeError.invalid("PersonNameComponents.AttributedStyle comparison: bad payloads") } return la == lb ? 0 : -1 } #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/IdentityModule.swift b/Sources/SwiftScriptInterpreter/Modules/IdentityModule.swift new file mode 100644 index 0000000..3760d0e --- /dev/null +++ b/Sources/SwiftScriptInterpreter/Modules/IdentityModule.swift @@ -0,0 +1,55 @@ +import Foundation +import ShellKit + +/// Hand-rolled identity overrides — the auto-generator only catches +/// the simply-typed `ProcessInfo` properties (`hostName`, +/// `processName`). The ones with non-`Int`-shaped or array-shaped +/// types (`processIdentifier: Int32`, `arguments: [String]`, +/// `environment: [String: String]`) are bridged here, all redirected +/// to the bound shell's `HostInfo` / `Environment` / `scriptName` +/// via the helpers in `HostHooks.swift`. +/// +/// Loaded alongside the rest of the Foundation surface so a script +/// that imports Foundation (or Darwin / Glibc / ucrt / WinSDK) sees +/// the synthetic identity automatically. +struct IdentityModule: BuiltinModule { + // Distinct from `FoundationModule.name == "Foundation"` so + // `register(module:)`'s idempotency check (`registeredModules`) + // doesn't drop us when both modules try to register on + // `import Foundation`. + let name = "ProcessInfoIdentity" + + func register(into i: Interpreter) { + // `ProcessInfo.userName` and `.fullUserName` — neither makes + // it through the generator (Foundation surfaces them as a + // platform-conditional pair on Apple). Map both to + // `hostUserName()` so a sandbox embedder can present a + // synthetic account. + i.bridges["var ProcessInfo.userName: String"] = .computed { _ in + return .string(hostUserName()) + } + i.bridges["var ProcessInfo.fullUserName: String"] = .computed { _ in + return .string(hostFullUserName()) + } + + // `ProcessInfo.processIdentifier: Int32` — the generator + // skips Int32; we bridge it here, surfacing it as `Int` to + // the script (the only integer type SwiftScript bridges). + i.bridges["var ProcessInfo.processIdentifier: Int"] = .computed { _ in + return .int(Int(hostProcessIdentifier())) + } + + // `ProcessInfo.arguments: [String]` and + // `ProcessInfo.environment: [String: String]` — array and + // dictionary shapes the generator doesn't auto-bridge. + i.bridges["var ProcessInfo.arguments: [String]"] = .computed { _ in + return .array(hostProcessArguments().map { .string($0) }) + } + i.bridges["var ProcessInfo.environment: [String: String]"] = .computed { _ in + let dict = hostEnvironment() + return .dict(dict.map { (k, v) in + DictEntry(key: .string(k), value: .string(v)) + }) + } + } +} diff --git a/Sources/SwiftScriptInterpreter/Modules/StdlibBridge/StdlibBridges+Bool.swift b/Sources/SwiftScriptInterpreter/Modules/StdlibBridge/StdlibBridges+Bool.swift index a3cae03..ef8f639 100644 --- a/Sources/SwiftScriptInterpreter/Modules/StdlibBridge/StdlibBridges+Bool.swift +++ b/Sources/SwiftScriptInterpreter/Modules/StdlibBridge/StdlibBridges+Bool.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/StdlibBridge/StdlibBridges+ContinuousClockInstant.swift b/Sources/SwiftScriptInterpreter/Modules/StdlibBridge/StdlibBridges+ContinuousClockInstant.swift index c84f866..d598d5f 100644 --- a/Sources/SwiftScriptInterpreter/Modules/StdlibBridge/StdlibBridges+ContinuousClockInstant.swift +++ b/Sources/SwiftScriptInterpreter/Modules/StdlibBridge/StdlibBridges+ContinuousClockInstant.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/StdlibBridge/StdlibBridges+Double.swift b/Sources/SwiftScriptInterpreter/Modules/StdlibBridge/StdlibBridges+Double.swift index ab9eed2..9f2b6c1 100644 --- a/Sources/SwiftScriptInterpreter/Modules/StdlibBridge/StdlibBridges+Double.swift +++ b/Sources/SwiftScriptInterpreter/Modules/StdlibBridge/StdlibBridges+Double.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/StdlibBridge/StdlibBridges+Int.swift b/Sources/SwiftScriptInterpreter/Modules/StdlibBridge/StdlibBridges+Int.swift index 30e2d9d..3dbf209 100644 --- a/Sources/SwiftScriptInterpreter/Modules/StdlibBridge/StdlibBridges+Int.swift +++ b/Sources/SwiftScriptInterpreter/Modules/StdlibBridge/StdlibBridges+Int.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/StdlibBridge/StdlibBridges+String.swift b/Sources/SwiftScriptInterpreter/Modules/StdlibBridge/StdlibBridges+String.swift index ff4c306..cc4733f 100644 --- a/Sources/SwiftScriptInterpreter/Modules/StdlibBridge/StdlibBridges+String.swift +++ b/Sources/SwiftScriptInterpreter/Modules/StdlibBridge/StdlibBridges+String.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif @@ -65,6 +66,38 @@ extension StdlibBridges { } return .string(String.localizedName(of: try unboxOpaque(args[0], as: String.Encoding.self, typeName: "String.Encoding"))) }, + "init String(contentsOfFile:)": .`init` { args in + guard args.count == 1 else { + throw RuntimeError.invalid("init String(contentsOfFile:): expected 1 argument(s), got \(args.count)") + } + let arg0 = try unboxString(args[0]) + do { + try await authorizePath(arg0, for: .read) + } catch { + throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) + } + do { + return .string(try await String(contentsOfFile: arg0)) + } catch { + throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) + } + }, + "init String(contentsOf:)": .`init` { args in + guard args.count == 1 else { + throw RuntimeError.invalid("init String(contentsOf:): expected 1 argument(s), got \(args.count)") + } + let arg0 = try unboxOpaque(args[0], as: URL.self, typeName: "URL") + do { + try await authorizePath(arg0, for: .read) + } catch { + throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) + } + do { + return .string(try await String(contentsOf: arg0)) + } catch { + throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) + } + }, "func String.canBeConverted()": .method { receiver, args in guard args.count == 1 else { throw RuntimeError.invalid("String.canBeConverted: expected 1 argument(s), got \(args.count)") @@ -116,8 +149,14 @@ extension StdlibBridges { guard args.count == 2 else { throw RuntimeError.invalid("init String(contentsOfFile:encoding:): expected 2 argument(s), got \(args.count)") } + let arg0 = try unboxString(args[0]) + do { + try await authorizePath(arg0, for: .read) + } catch { + throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) + } do { - return .string(try String(contentsOfFile: try unboxString(args[0]), encoding: try unboxOpaque(args[1], as: String.Encoding.self, typeName: "String.Encoding"))) + return .string(try await String(contentsOfFile: arg0, encoding: try unboxOpaque(args[1], as: String.Encoding.self, typeName: "String.Encoding"))) } catch { throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) } @@ -126,8 +165,14 @@ extension StdlibBridges { guard args.count == 2 else { throw RuntimeError.invalid("init String(contentsOf:encoding:): expected 2 argument(s), got \(args.count)") } + let arg0 = try unboxOpaque(args[0], as: URL.self, typeName: "URL") do { - return .string(try String(contentsOf: try unboxOpaque(args[0], as: URL.self, typeName: "URL"), encoding: try unboxOpaque(args[1], as: String.Encoding.self, typeName: "String.Encoding"))) + try await authorizePath(arg0, for: .read) + } catch { + throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) + } + do { + return .string(try await String(contentsOf: arg0, encoding: try unboxOpaque(args[1], as: String.Encoding.self, typeName: "String.Encoding"))) } catch { throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) } @@ -157,8 +202,14 @@ extension StdlibBridges { throw RuntimeError.invalid("String.write: expected 3 argument(s), got \(args.count)") } let recv: String = try unboxString(receiver) + let arg0 = try unboxOpaque(args[0], as: URL.self, typeName: "URL") + do { + try await authorizePath(arg0, for: .write) + } catch { + throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) + } do { - try recv.write(to: try unboxOpaque(args[0], as: URL.self, typeName: "URL"), atomically: try unboxBool(args[1]), encoding: try unboxOpaque(args[2], as: String.Encoding.self, typeName: "String.Encoding")) + try await recv.write(to: arg0, atomically: try unboxBool(args[1]), encoding: try unboxOpaque(args[2], as: String.Encoding.self, typeName: "String.Encoding")) return .void } catch { throw UserThrowSignal(value: .opaque(typeName: "Error", value: error)) diff --git a/Sources/SwiftScriptInterpreter/Modules/StdlibBridge/StdlibBridges+StringIndex.swift b/Sources/SwiftScriptInterpreter/Modules/StdlibBridge/StdlibBridges+StringIndex.swift index e1ee143..2a23b46 100644 --- a/Sources/SwiftScriptInterpreter/Modules/StdlibBridge/StdlibBridges+StringIndex.swift +++ b/Sources/SwiftScriptInterpreter/Modules/StdlibBridge/StdlibBridges+StringIndex.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/StdlibBridge/StdlibBridges+SuspendingClockInstant.swift b/Sources/SwiftScriptInterpreter/Modules/StdlibBridge/StdlibBridges+SuspendingClockInstant.swift index ab7e3db..70871b3 100644 --- a/Sources/SwiftScriptInterpreter/Modules/StdlibBridge/StdlibBridges+SuspendingClockInstant.swift +++ b/Sources/SwiftScriptInterpreter/Modules/StdlibBridge/StdlibBridges+SuspendingClockInstant.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/StdlibBridge/StdlibBridges+UnicodeCanonicalCombiningClass.swift b/Sources/SwiftScriptInterpreter/Modules/StdlibBridge/StdlibBridges+UnicodeCanonicalCombiningClass.swift index 7eab0e7..8d68b6a 100644 --- a/Sources/SwiftScriptInterpreter/Modules/StdlibBridge/StdlibBridges+UnicodeCanonicalCombiningClass.swift +++ b/Sources/SwiftScriptInterpreter/Modules/StdlibBridge/StdlibBridges+UnicodeCanonicalCombiningClass.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/SwiftScriptInterpreter/Modules/StdlibBridge/StdlibBridges.swift b/Sources/SwiftScriptInterpreter/Modules/StdlibBridge/StdlibBridges.swift index 5b039f7..5c83dc6 100644 --- a/Sources/SwiftScriptInterpreter/Modules/StdlibBridge/StdlibBridges.swift +++ b/Sources/SwiftScriptInterpreter/Modules/StdlibBridge/StdlibBridges.swift @@ -1,6 +1,7 @@ // AUTO-GENERATED by BridgeGeneratorTool. Do not edit by hand. // Regenerate with: bash Tools/regen-foundation-bridge.sh import Foundation + import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif @@ -29,53 +30,51 @@ enum StdlibBridges { extension Interpreter { func registerGeneratedStdlib(into i: Interpreter) { for (k, v) in StdlibBridges.all { i.bridges[k] = v } - i.registerComparator(on: "OpaquePointer") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? OpaquePointer, - case .opaque(_, let b) = rhs, let lb = b as? OpaquePointer - else { throw RuntimeError.invalid("OpaquePointer comparison: bad payloads") } - return la == lb ? 0 : -1 + i.registerComparator(on: "TaskPriority") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? TaskPriority, + case .opaque(_, let b) = rhs, let lb = b as? TaskPriority + else { throw RuntimeError.invalid("TaskPriority comparison: bad payloads") } + return la < lb ? -1 : (la > lb ? 1 : 0) } #if canImport(Darwin) - i.registerComparator(on: "JobPriority") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? JobPriority, - case .opaque(_, let b) = rhs, let lb = b as? JobPriority - else { throw RuntimeError.invalid("JobPriority comparison: bad payloads") } + i.registerComparator(on: "AnyIndex") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? AnyIndex, + case .opaque(_, let b) = rhs, let lb = b as? AnyIndex + else { throw RuntimeError.invalid("AnyIndex comparison: bad payloads") } return la < lb ? -1 : (la > lb ? 1 : 0) } #endif #if canImport(Darwin) - i.registerComparator(on: "CodingUserInfoKey") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? CodingUserInfoKey, - case .opaque(_, let b) = rhs, let lb = b as? CodingUserInfoKey - else { throw RuntimeError.invalid("CodingUserInfoKey comparison: bad payloads") } + i.registerComparator(on: "NotificationCenter.Publisher") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? NotificationCenter.Publisher, + case .opaque(_, let b) = rhs, let lb = b as? NotificationCenter.Publisher + else { throw RuntimeError.invalid("NotificationCenter.Publisher comparison: bad payloads") } return la == lb ? 0 : -1 } #endif - i.registerComparator(on: "Duration.UnitsFormatStyle") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? Duration.UnitsFormatStyle, - case .opaque(_, let b) = rhs, let lb = b as? Duration.UnitsFormatStyle - else { throw RuntimeError.invalid("Duration.UnitsFormatStyle comparison: bad payloads") } + i.registerComparator(on: "UnsafeCurrentTask") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? UnsafeCurrentTask, + case .opaque(_, let b) = rhs, let lb = b as? UnsafeCurrentTask + else { throw RuntimeError.invalid("UnsafeCurrentTask comparison: bad payloads") } return la == lb ? 0 : -1 } -#if canImport(Darwin) - i.registerComparator(on: "ContinuousClock.Instant") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? ContinuousClock.Instant, - case .opaque(_, let b) = rhs, let lb = b as? ContinuousClock.Instant - else { throw RuntimeError.invalid("ContinuousClock.Instant comparison: bad payloads") } - return la < lb ? -1 : (la > lb ? 1 : 0) + i.registerComparator(on: "OpaquePointer") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? OpaquePointer, + case .opaque(_, let b) = rhs, let lb = b as? OpaquePointer + else { throw RuntimeError.invalid("OpaquePointer comparison: bad payloads") } + return la == lb ? 0 : -1 } -#endif #if canImport(Darwin) - i.registerComparator(on: "RegexRepetitionBehavior") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? RegexRepetitionBehavior, - case .opaque(_, let b) = rhs, let lb = b as? RegexRepetitionBehavior - else { throw RuntimeError.invalid("RegexRepetitionBehavior comparison: bad payloads") } - return la == lb ? 0 : -1 + i.registerComparator(on: "RunLoop.SchedulerTimeType") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? RunLoop.SchedulerTimeType, + case .opaque(_, let b) = rhs, let lb = b as? RunLoop.SchedulerTimeType + else { throw RuntimeError.invalid("RunLoop.SchedulerTimeType comparison: bad payloads") } + return la < lb ? -1 : (la > lb ? 1 : 0) } #endif @@ -88,37 +87,30 @@ extension Interpreter { } #endif -#if canImport(Darwin) - i.registerComparator(on: "Unicode.CanonicalCombiningClass") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? Unicode.CanonicalCombiningClass, - case .opaque(_, let b) = rhs, let lb = b as? Unicode.CanonicalCombiningClass - else { throw RuntimeError.invalid("Unicode.CanonicalCombiningClass comparison: bad payloads") } - return la < lb ? -1 : (la > lb ? 1 : 0) - } -#endif - - i.registerComparator(on: "Decimal.FormatStyle") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? Decimal.FormatStyle, - case .opaque(_, let b) = rhs, let lb = b as? Decimal.FormatStyle - else { throw RuntimeError.invalid("Decimal.FormatStyle comparison: bad payloads") } + i.registerComparator(on: "String.StandardComparator") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? String.StandardComparator, + case .opaque(_, let b) = rhs, let lb = b as? String.StandardComparator + else { throw RuntimeError.invalid("String.StandardComparator comparison: bad payloads") } return la == lb ? 0 : -1 } #if canImport(Darwin) - i.registerComparator(on: "RegexSemanticLevel") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? RegexSemanticLevel, - case .opaque(_, let b) = rhs, let lb = b as? RegexSemanticLevel - else { throw RuntimeError.invalid("RegexSemanticLevel comparison: bad payloads") } - return la == lb ? 0 : -1 + i.registerComparator(on: "ContinuousClock.Instant") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? ContinuousClock.Instant, + case .opaque(_, let b) = rhs, let lb = b as? ContinuousClock.Instant + else { throw RuntimeError.invalid("ContinuousClock.Instant comparison: bad payloads") } + return la < lb ? -1 : (la > lb ? 1 : 0) } #endif - i.registerComparator(on: "String.Index") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? String.Index, - case .opaque(_, let b) = rhs, let lb = b as? String.Index - else { throw RuntimeError.invalid("String.Index comparison: bad payloads") } +#if canImport(Darwin) + i.registerComparator(on: "Unicode.CanonicalCombiningClass") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? Unicode.CanonicalCombiningClass, + case .opaque(_, let b) = rhs, let lb = b as? Unicode.CanonicalCombiningClass + else { throw RuntimeError.invalid("Unicode.CanonicalCombiningClass comparison: bad payloads") } return la < lb ? -1 : (la > lb ? 1 : 0) } +#endif #if canImport(Darwin) i.registerComparator(on: "String.LocalizationValue") { lhs, rhs in @@ -129,28 +121,21 @@ extension Interpreter { } #endif - i.registerComparator(on: "UnsafeRawPointer") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? UnsafeRawPointer, - case .opaque(_, let b) = rhs, let lb = b as? UnsafeRawPointer - else { throw RuntimeError.invalid("UnsafeRawPointer comparison: bad payloads") } - return la < lb ? -1 : (la > lb ? 1 : 0) + i.registerComparator(on: "Duration.UnitsFormatStyle") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? Duration.UnitsFormatStyle, + case .opaque(_, let b) = rhs, let lb = b as? Duration.UnitsFormatStyle + else { throw RuntimeError.invalid("Duration.UnitsFormatStyle comparison: bad payloads") } + return la == lb ? 0 : -1 } #if canImport(Darwin) - i.registerComparator(on: "RunLoop.SchedulerTimeType") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? RunLoop.SchedulerTimeType, - case .opaque(_, let b) = rhs, let lb = b as? RunLoop.SchedulerTimeType - else { throw RuntimeError.invalid("RunLoop.SchedulerTimeType comparison: bad payloads") } - return la < lb ? -1 : (la > lb ? 1 : 0) - } -#endif - - i.registerComparator(on: "Duration.TimeFormatStyle") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? Duration.TimeFormatStyle, - case .opaque(_, let b) = rhs, let lb = b as? Duration.TimeFormatStyle - else { throw RuntimeError.invalid("Duration.TimeFormatStyle comparison: bad payloads") } + i.registerComparator(on: "RegexSemanticLevel") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? RegexSemanticLevel, + case .opaque(_, let b) = rhs, let lb = b as? RegexSemanticLevel + else { throw RuntimeError.invalid("RegexSemanticLevel comparison: bad payloads") } return la == lb ? 0 : -1 } +#endif i.registerComparator(on: "String.Encoding") { lhs, rhs in guard case .opaque(_, let a) = lhs, let la = a as? String.Encoding, @@ -159,20 +144,13 @@ extension Interpreter { return la == lb ? 0 : -1 } - i.registerComparator(on: "String.Comparator") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? String.Comparator, - case .opaque(_, let b) = rhs, let lb = b as? String.Comparator - else { throw RuntimeError.invalid("String.Comparator comparison: bad payloads") } + i.registerComparator(on: "Duration.TimeFormatStyle") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? Duration.TimeFormatStyle, + case .opaque(_, let b) = rhs, let lb = b as? Duration.TimeFormatStyle + else { throw RuntimeError.invalid("Duration.TimeFormatStyle comparison: bad payloads") } return la == lb ? 0 : -1 } - i.registerComparator(on: "UnsafeMutableRawPointer") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? UnsafeMutableRawPointer, - case .opaque(_, let b) = rhs, let lb = b as? UnsafeMutableRawPointer - else { throw RuntimeError.invalid("UnsafeMutableRawPointer comparison: bad payloads") } - return la < lb ? -1 : (la > lb ? 1 : 0) - } - #if canImport(Darwin) i.registerComparator(on: "SuspendingClock.Instant") { lhs, rhs in guard case .opaque(_, let a) = lhs, let la = a as? SuspendingClock.Instant, @@ -182,13 +160,36 @@ extension Interpreter { } #endif - i.registerComparator(on: "TaskPriority") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? TaskPriority, - case .opaque(_, let b) = rhs, let lb = b as? TaskPriority - else { throw RuntimeError.invalid("TaskPriority comparison: bad payloads") } + i.registerComparator(on: "UnsafeMutableRawPointer") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? UnsafeMutableRawPointer, + case .opaque(_, let b) = rhs, let lb = b as? UnsafeMutableRawPointer + else { throw RuntimeError.invalid("UnsafeMutableRawPointer comparison: bad payloads") } return la < lb ? -1 : (la > lb ? 1 : 0) } + i.registerComparator(on: "String.Comparator") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? String.Comparator, + case .opaque(_, let b) = rhs, let lb = b as? String.Comparator + else { throw RuntimeError.invalid("String.Comparator comparison: bad payloads") } + return la == lb ? 0 : -1 + } + + i.registerComparator(on: "Decimal.FormatStyle") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? Decimal.FormatStyle, + case .opaque(_, let b) = rhs, let lb = b as? Decimal.FormatStyle + else { throw RuntimeError.invalid("Decimal.FormatStyle comparison: bad payloads") } + return la == lb ? 0 : -1 + } + +#if canImport(Darwin) + i.registerComparator(on: "CodingUserInfoKey") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? CodingUserInfoKey, + case .opaque(_, let b) = rhs, let lb = b as? CodingUserInfoKey + else { throw RuntimeError.invalid("CodingUserInfoKey comparison: bad payloads") } + return la == lb ? 0 : -1 + } +#endif + i.registerComparator(on: "ObjectIdentifier") { lhs, rhs in guard case .opaque(_, let a) = lhs, let la = a as? ObjectIdentifier, case .opaque(_, let b) = rhs, let lb = b as? ObjectIdentifier @@ -197,27 +198,29 @@ extension Interpreter { } #if canImport(Darwin) - i.registerComparator(on: "NotificationCenter.Publisher") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? NotificationCenter.Publisher, - case .opaque(_, let b) = rhs, let lb = b as? NotificationCenter.Publisher - else { throw RuntimeError.invalid("NotificationCenter.Publisher comparison: bad payloads") } - return la == lb ? 0 : -1 + i.registerComparator(on: "OperationQueue.SchedulerTimeType") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? OperationQueue.SchedulerTimeType, + case .opaque(_, let b) = rhs, let lb = b as? OperationQueue.SchedulerTimeType + else { throw RuntimeError.invalid("OperationQueue.SchedulerTimeType comparison: bad payloads") } + return la < lb ? -1 : (la > lb ? 1 : 0) } #endif - i.registerComparator(on: "UnownedTaskExecutor") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? UnownedTaskExecutor, - case .opaque(_, let b) = rhs, let lb = b as? UnownedTaskExecutor - else { throw RuntimeError.invalid("UnownedTaskExecutor comparison: bad payloads") } - return la == lb ? 0 : -1 + i.registerComparator(on: "String.Index") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? String.Index, + case .opaque(_, let b) = rhs, let lb = b as? String.Index + else { throw RuntimeError.invalid("String.Index comparison: bad payloads") } + return la < lb ? -1 : (la > lb ? 1 : 0) } - i.registerComparator(on: "String.StandardComparator") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? String.StandardComparator, - case .opaque(_, let b) = rhs, let lb = b as? String.StandardComparator - else { throw RuntimeError.invalid("String.StandardComparator comparison: bad payloads") } +#if canImport(Darwin) + i.registerComparator(on: "RegexRepetitionBehavior") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? RegexRepetitionBehavior, + case .opaque(_, let b) = rhs, let lb = b as? RegexRepetitionBehavior + else { throw RuntimeError.invalid("RegexRepetitionBehavior comparison: bad payloads") } return la == lb ? 0 : -1 } +#endif #if canImport(Darwin) i.registerComparator(on: "RegexWordBoundaryKind") { lhs, rhs in @@ -228,29 +231,11 @@ extension Interpreter { } #endif - i.registerComparator(on: "UnsafeCurrentTask") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? UnsafeCurrentTask, - case .opaque(_, let b) = rhs, let lb = b as? UnsafeCurrentTask - else { throw RuntimeError.invalid("UnsafeCurrentTask comparison: bad payloads") } - return la == lb ? 0 : -1 - } - -#if canImport(Darwin) - i.registerComparator(on: "AnyIndex") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? AnyIndex, - case .opaque(_, let b) = rhs, let lb = b as? AnyIndex - else { throw RuntimeError.invalid("AnyIndex comparison: bad payloads") } - return la < lb ? -1 : (la > lb ? 1 : 0) - } -#endif - -#if canImport(Darwin) - i.registerComparator(on: "OperationQueue.SchedulerTimeType") { lhs, rhs in - guard case .opaque(_, let a) = lhs, let la = a as? OperationQueue.SchedulerTimeType, - case .opaque(_, let b) = rhs, let lb = b as? OperationQueue.SchedulerTimeType - else { throw RuntimeError.invalid("OperationQueue.SchedulerTimeType comparison: bad payloads") } + i.registerComparator(on: "UnsafeRawPointer") { lhs, rhs in + guard case .opaque(_, let a) = lhs, let la = a as? UnsafeRawPointer, + case .opaque(_, let b) = rhs, let lb = b as? UnsafeRawPointer + else { throw RuntimeError.invalid("UnsafeRawPointer comparison: bad payloads") } return la < lb ? -1 : (la > lb ? 1 : 0) } -#endif } } diff --git a/Sources/SwiftScriptInterpreter/Modules/URLSessionModule.swift b/Sources/SwiftScriptInterpreter/Modules/URLSessionModule.swift index b3ffea1..c8baf77 100644 --- a/Sources/SwiftScriptInterpreter/Modules/URLSessionModule.swift +++ b/Sources/SwiftScriptInterpreter/Modules/URLSessionModule.swift @@ -1,4 +1,5 @@ import Foundation +import ShellKit #if canImport(FoundationNetworking) import FoundationNetworking #endif @@ -45,6 +46,11 @@ struct URLSessionModule: BuiltinModule { else { throw RuntimeError.invalid("URLSession.bytes(from:): expected a URL argument") } + // Route the URL through the bound shell's network policy + // before opening a connection. Standalone mode is a + // no-op; an embedder with a `NetworkConfig` rejects URLs + // outside its allow-list. + try await authorizeURL(url) do { let (bytes, response) = try await session.bytes(from: url) var iterator = bytes.makeAsyncIterator() diff --git a/Sources/swift-script/SwiftScriptCLI.swift b/Sources/swift-script/SwiftScriptCLI.swift index 39eb2d7..4802d67 100644 --- a/Sources/swift-script/SwiftScriptCLI.swift +++ b/Sources/swift-script/SwiftScriptCLI.swift @@ -1,5 +1,6 @@ import Foundation import SwiftScriptInterpreter +import ShellKit /// CLI entry. Wrapped in a `@main` struct (rather than top-level code) /// so `main()` is nonisolated — top-level code becomes implicitly @@ -7,14 +8,20 @@ import SwiftScriptInterpreter /// the `try await interpreter.eval(...)` call cross an actor boundary /// and trip on `Value` not being `Sendable`. Keeping `main` nonisolated /// matches where the interpreter actually runs. +/// +/// All IO routes through ``ShellKit/Shell/current`` — in standalone +/// mode that resolves to ``ShellKit/Shell/processDefault`` whose +/// stdout / stderr forward to real `FileHandle.standard*`, so the +/// binary behaves exactly as before. Under an embedder (SwiftBash, +/// an iOS app) the bound Shell's sinks receive the bytes instead. @main struct SwiftScriptCLI { static func usage() -> Never { - FileHandle.standardError.write(Data(""" + Shell.current.stderr(""" usage: swift-script swift-script -e - """.utf8)) + """) exit(2) } @@ -54,7 +61,7 @@ struct SwiftScriptCLI { } source = contents } catch { - FileHandle.standardError.write(Data("error reading \(args[1]): \(error)\n".utf8)) + Shell.current.stderr("error reading \(args[1]): \(error)\n") exit(1) } fileName = args[1] @@ -63,32 +70,44 @@ struct SwiftScriptCLI { } let interpreter = Interpreter() + // The interpreter binds `CommandLine.arguments` automatically + // at eval time from `scriptArguments` (or, when that's empty, + // from `Shell.current.scriptName` + `positionalParameters`). + // The CLI just supplies argv here. interpreter.scriptArguments = scriptArgs - // Surface `CommandLine.arguments` to the script. Registered here - // (rather than as part of the always-on stdlib bridges) because - // the argv list comes from the host's CLI parsing and isn't - // known at interpreter-init time. Static-let semantics is fine — - // script argv is fixed for the lifetime of one run. - interpreter.bridges["static let CommandLine.arguments"] = - .staticValue(.array(scriptArgs.map { .string($0) })) do { - let result = try await interpreter.eval(source, fileName: fileName) - if isInline, case .void = result { - // nothing to print - } else if isInline { - print(result.description) + // Inline `-e` keeps the legacy `eval(_:fileName:)` path so we + // can print the resulting expression value. File scripts + // route through `evalScript(_:fileName:)`, which converts + // a thrown `ScriptExit` into the returned `ExitStatus`. + if isInline { + let result = try await interpreter.eval(source, fileName: fileName) + if case .void = result { + // nothing to print + } else { + Shell.current.stdout(result.description + "\n") + } + exit(0) + } else { + let status = try await interpreter.evalScript( + source, fileName: fileName) + exit(status.code) } } catch let parseError as ParseError { - FileHandle.standardError.write(Data(parseError.formatted.utf8)) + interpreter.error(parseError.formatted) if !parseError.formatted.hasSuffix("\n") { - FileHandle.standardError.write(Data("\n".utf8)) + interpreter.error("\n") } exit(1) + } catch let scriptExit as ScriptExit { + // Inline `-e` path: a script-side `exit(N)` still needs + // to translate into the host's exit code. + exit(scriptExit.status.code) } catch { // Runtime errors get the same caret-style rendering as // parse errors when the error carries source-location info. - FileHandle.standardError.write(Data(interpreter.renderRuntimeError(error).utf8)) + interpreter.error(interpreter.renderRuntimeError(error)) exit(1) } } diff --git a/Tests/SwiftScriptInterpreterTests/AsyncTests.swift b/Tests/SwiftScriptInterpreterTests/AsyncTests.swift index fe18d00..6b2d87f 100644 --- a/Tests/SwiftScriptInterpreterTests/AsyncTests.swift +++ b/Tests/SwiftScriptInterpreterTests/AsyncTests.swift @@ -7,7 +7,7 @@ struct AsyncTests { @Test func awaitOnBridgedSleepActuallySuspends() async throws { let interp = Interpreter() var captured = "" - interp.output = { captured += $0 + "\n" } + interp.output = { captured += $0 } let start = Date() try await interp.eval(""" print("a") @@ -36,7 +36,7 @@ struct AsyncTests { @Test func awaitCanBeUsedInAFunctionBody() async throws { let interp = Interpreter() var captured = "" - interp.output = { captured += $0 + "\n" } + interp.output = { captured += $0 } try await interp.eval(""" func work() async { print("start") diff --git a/Tests/SwiftScriptInterpreterTests/BridgedSubclassTests.swift b/Tests/SwiftScriptInterpreterTests/BridgedSubclassTests.swift index 537eba1..1ae4b6b 100644 --- a/Tests/SwiftScriptInterpreterTests/BridgedSubclassTests.swift +++ b/Tests/SwiftScriptInterpreterTests/BridgedSubclassTests.swift @@ -11,7 +11,7 @@ struct BridgedSubclassTests { @Test func tagAFoundationDate() async throws { let interp = Interpreter() var captured = "" - interp.output = { captured += $0 + "\n" } + interp.output = { captured += $0 } try await interp.eval(""" import Foundation class TaggedDate: Date { @@ -29,7 +29,7 @@ struct BridgedSubclassTests { @Test func failableBridgedInitPropagates() async throws { let interp = Interpreter() var captured = "" - interp.output = { captured += $0 + "\n" } + interp.output = { captured += $0 } try await interp.eval(#""" import Foundation class LabeledURL: URL { @@ -47,7 +47,7 @@ struct BridgedSubclassTests { @Test func wrapperSatisfiesIsCheckForBridgedParent() async throws { let interp = Interpreter() var captured = "" - interp.output = { captured += $0 + "\n" } + interp.output = { captured += $0 } try await interp.eval(""" import Foundation class TaggedDate: Date { @@ -68,7 +68,7 @@ struct BridgedSubclassTests { @Test func failableInitReturnsNilOnFailure() async throws { let interp = Interpreter() var captured = "" - interp.output = { captured += $0 + "\n" } + interp.output = { captured += $0 } try await interp.eval(#""" import Foundation class LabeledURL: URL { diff --git a/Tests/SwiftScriptInterpreterTests/BridgesTests.swift b/Tests/SwiftScriptInterpreterTests/BridgesTests.swift index 5823900..231a254 100644 --- a/Tests/SwiftScriptInterpreterTests/BridgesTests.swift +++ b/Tests/SwiftScriptInterpreterTests/BridgesTests.swift @@ -100,7 +100,7 @@ struct BridgesTests { @Test func scriptDefinedSequenceIteratesWithForLoop() async throws { let interp = Interpreter() var captured = "" - interp.output = { captured += $0 + "\n" } + interp.output = { captured += $0 } try await interp.eval(""" struct Counter: Sequence { let limit: Int @@ -131,7 +131,7 @@ struct BridgesTests { // commonly use the increment-on-exit pattern. let interp = Interpreter() var captured = "" - interp.output = { captured += $0 + "\n" } + interp.output = { captured += $0 } try await interp.eval(""" struct Box { var n: Int = 0 @@ -154,7 +154,7 @@ struct BridgesTests { @Test func scriptDescriptionWinsOverDefault() async throws { let interp = Interpreter() var captured = "" - interp.output = { captured += $0 + "\n" } + interp.output = { captured += $0 } try await interp.eval(""" struct Point: CustomStringConvertible { var x: Int @@ -171,7 +171,7 @@ struct BridgesTests { @Test func scriptDescriptionRecursesThroughCollections() async throws { let interp = Interpreter() var captured = "" - interp.output = { captured += $0 + "\n" } + interp.output = { captured += $0 } try await interp.eval(""" struct Tag: CustomStringConvertible { var name: String @@ -189,7 +189,7 @@ struct BridgesTests { @Test func caseIterableSynthesizesAllCases() async throws { let interp = Interpreter() var captured = "" - interp.output = { captured += $0 + "\n" } + interp.output = { captured += $0 } try await interp.eval(""" enum Direction: CaseIterable { case north, south, east, west @@ -207,7 +207,7 @@ struct BridgesTests { // generated allCases array. let interp = Interpreter() var captured = "" - interp.output = { captured += $0 + "\n" } + interp.output = { captured += $0 } try await interp.eval(""" enum E: CaseIterable { case a @@ -223,7 +223,7 @@ struct BridgesTests { @Test func dumpUsesDebugDescription() async throws { let interp = Interpreter() var captured = "" - interp.output = { captured += $0 + "\n" } + interp.output = { captured += $0 } try await interp.eval(""" struct Point: CustomDebugStringConvertible { var x: Int @@ -238,7 +238,7 @@ struct BridgesTests { @Test func dumpReturnsValueForChaining() async throws { let interp = Interpreter() var captured = "" - interp.output = { captured += $0 + "\n" } + interp.output = { captured += $0 } try await interp.eval(""" let n = dump(42) print(n + 1) @@ -251,7 +251,7 @@ struct BridgesTests { @Test func scriptDefinedAsyncSequenceWithForAwait() async throws { let interp = Interpreter() var captured = "" - interp.output = { captured += $0 + "\n" } + interp.output = { captured += $0 } try await interp.eval(""" struct AsyncCounterIterator { var current: Int @@ -280,7 +280,7 @@ struct BridgesTests { @Test func failableScriptInitReturnsNilOnFailure() async throws { let interp = Interpreter() var captured = "" - interp.output = { captured += $0 + "\n" } + interp.output = { captured += $0 } try await interp.eval(#""" struct Money { var amount: Int @@ -298,7 +298,7 @@ struct BridgesTests { @Test func failableInitWrapsResultInOptional() async throws { let interp = Interpreter() var captured = "" - interp.output = { captured += $0 + "\n" } + interp.output = { captured += $0 } try await interp.eval(""" struct Money { var amount: Int @@ -318,7 +318,7 @@ struct BridgesTests { @Test func expressibleByIntegerLiteral() async throws { let interp = Interpreter() var captured = "" - interp.output = { captured += $0 + "\n" } + interp.output = { captured += $0 } try await interp.eval(""" struct Money { var amount: Int @@ -333,7 +333,7 @@ struct BridgesTests { @Test func expressibleByFloatLiteral() async throws { let interp = Interpreter() var captured = "" - interp.output = { captured += $0 + "\n" } + interp.output = { captured += $0 } try await interp.eval(""" struct Distance { var meters: Double @@ -348,7 +348,7 @@ struct BridgesTests { @Test func expressibleByStringLiteral() async throws { let interp = Interpreter() var captured = "" - interp.output = { captured += $0 + "\n" } + interp.output = { captured += $0 } try await interp.eval(#""" struct Tag { var name: String @@ -365,7 +365,7 @@ struct BridgesTests { @Test func keyPathSugarPassesAsClosure() async throws { let interp = Interpreter() var captured = "" - interp.output = { captured += $0 + "\n" } + interp.output = { captured += $0 } try await interp.eval(""" struct Person { var name: String; var age: Int } let people = [Person(name: "Alice", age: 30), Person(name: "Bob", age: 25)] @@ -377,7 +377,7 @@ struct BridgesTests { @Test func nestedKeyPath() async throws { let interp = Interpreter() var captured = "" - interp.output = { captured += $0 + "\n" } + interp.output = { captured += $0 } try await interp.eval(""" struct Inner { var n: Int } struct Outer { var inner: Inner } @@ -392,7 +392,7 @@ struct BridgesTests { @Test func mirrorReportsStructFields() async throws { let interp = Interpreter() var captured = "" - interp.output = { captured += $0 + "\n" } + interp.output = { captured += $0 } try await interp.eval(""" struct Person { var name: String; var age: Int } let m = Mirror(reflecting: Person(name: "Alice", age: 30)) @@ -410,7 +410,7 @@ struct BridgesTests { @Test func dynamicMemberLookupRoutesToSubscript() async throws { let interp = Interpreter() var captured = "" - interp.output = { captured += $0 + "\n" } + interp.output = { captured += $0 } try await interp.eval(#""" @dynamicMemberLookup struct Bag { diff --git a/Tests/SwiftScriptInterpreterTests/CodableTests.swift b/Tests/SwiftScriptInterpreterTests/CodableTests.swift index c1c30ba..8f9417b 100644 --- a/Tests/SwiftScriptInterpreterTests/CodableTests.swift +++ b/Tests/SwiftScriptInterpreterTests/CodableTests.swift @@ -11,7 +11,7 @@ struct CodableTests { @Test func roundTripStruct() async throws { let interp = Interpreter() var captured = "" - interp.output = { captured += $0 + "\n" } + interp.output = { captured += $0 } try await interp.eval(#""" import Foundation struct Person: Codable { @@ -29,7 +29,7 @@ struct CodableTests { @Test func optionalFieldsOmitNilOnEncode() async throws { let interp = Interpreter() var captured = "" - interp.output = { captured += $0 + "\n" } + interp.output = { captured += $0 } try await interp.eval(#""" import Foundation struct Maybe: Codable { @@ -49,7 +49,7 @@ struct CodableTests { @Test func decodeMissingOptionalFieldAsNil() async throws { let interp = Interpreter() var captured = "" - interp.output = { captured += $0 + "\n" } + interp.output = { captured += $0 } try await interp.eval(#""" import Foundation struct Maybe: Codable { @@ -66,7 +66,7 @@ struct CodableTests { @Test func roundTripArrayOfStructs() async throws { let interp = Interpreter() var captured = "" - interp.output = { captured += $0 + "\n" } + interp.output = { captured += $0 } try await interp.eval(#""" import Foundation struct Tag: Codable { var name: String } @@ -81,7 +81,7 @@ struct CodableTests { @Test func nestedStruct() async throws { let interp = Interpreter() var captured = "" - interp.output = { captured += $0 + "\n" } + interp.output = { captured += $0 } try await interp.eval(#""" import Foundation struct Inner: Codable { var n: Int } @@ -100,7 +100,7 @@ struct CodableTests { @Test func foundationDateRidesItsOwnConformance() async throws { let interp = Interpreter() var captured = "" - interp.output = { captured += $0 + "\n" } + interp.output = { captured += $0 } // Foundation's default Date encoding is timeIntervalSinceReference — // a single number. We don't reimplement that strategy; we just // verify the round-trip works. @@ -122,7 +122,7 @@ struct CodableTests { @Test func foundationURLRoundTrips() async throws { let interp = Interpreter() var captured = "" - interp.output = { captured += $0 + "\n" } + interp.output = { captured += $0 } try await interp.eval(#""" import Foundation struct Bookmark: Codable { @@ -141,7 +141,7 @@ struct CodableTests { @Test func decodeRawValueEnum() async throws { let interp = Interpreter() var captured = "" - interp.output = { captured += $0 + "\n" } + interp.output = { captured += $0 } try await interp.eval(#""" import Foundation enum Status: Int, Codable { @@ -162,7 +162,7 @@ struct CodableTests { // to reimplement it. let interp = Interpreter() var captured = "" - interp.output = { captured += $0 + "\n" } + interp.output = { captured += $0 } try await interp.eval(#""" import Foundation struct A: Codable { var z: Int; var a: Int } diff --git a/Tests/SwiftScriptInterpreterTests/DeferTests.swift b/Tests/SwiftScriptInterpreterTests/DeferTests.swift index 096c404..a9b97a4 100644 --- a/Tests/SwiftScriptInterpreterTests/DeferTests.swift +++ b/Tests/SwiftScriptInterpreterTests/DeferTests.swift @@ -1,4 +1,5 @@ import Testing +import Foundation @testable import SwiftScriptInterpreter @Suite("defer") @@ -6,7 +7,7 @@ struct DeferTests { @Test func runsAtFunctionExit() async throws { let interp = Interpreter() var lines: [String] = [] - interp.output = { lines.append($0) } + interp.output = { lines.append($0.trimmingCharacters(in: .newlines)) } try await interp.eval(""" func f() async throws { defer { print("d1") } @@ -20,7 +21,7 @@ struct DeferTests { @Test func multipleRunInReverseOrder() async throws { let interp = Interpreter() var lines: [String] = [] - interp.output = { lines.append($0) } + interp.output = { lines.append($0.trimmingCharacters(in: .newlines)) } try await interp.eval(""" func f() async throws { defer { print("d1") } @@ -35,7 +36,7 @@ struct DeferTests { @Test func runsBeforeReturnValueIsConsumed() async throws { let interp = Interpreter() var lines: [String] = [] - interp.output = { lines.append($0) } + interp.output = { lines.append($0.trimmingCharacters(in: .newlines)) } try await interp.eval(""" func f() -> Int { defer { print("cleanup") } @@ -49,7 +50,7 @@ struct DeferTests { @Test func runsOnThrow() async throws { let interp = Interpreter() var lines: [String] = [] - interp.output = { lines.append($0) } + interp.output = { lines.append($0.trimmingCharacters(in: .newlines)) } try await interp.eval(""" enum E: Error { case bad } func f() async throws { @@ -65,7 +66,7 @@ struct DeferTests { // defer fires at the end of its enclosing scope, not the function. let interp = Interpreter() var lines: [String] = [] - interp.output = { lines.append($0) } + interp.output = { lines.append($0.trimmingCharacters(in: .newlines)) } try await interp.eval(""" func f() async throws { if true { diff --git a/Tests/SwiftScriptInterpreterTests/DictionaryTests.swift b/Tests/SwiftScriptInterpreterTests/DictionaryTests.swift index 601e276..6dfe350 100644 --- a/Tests/SwiftScriptInterpreterTests/DictionaryTests.swift +++ b/Tests/SwiftScriptInterpreterTests/DictionaryTests.swift @@ -1,4 +1,5 @@ import Testing +import Foundation @testable import SwiftScriptInterpreter @Suite("Dictionaries") @@ -58,7 +59,7 @@ struct DictionaryTests { @Test func iteration() async throws { let interp = Interpreter() var lines: [String] = [] - interp.output = { lines.append($0) } + interp.output = { lines.append($0.trimmingCharacters(in: .newlines)) } try await interp.eval(#""" let d = ["a": 1, "b": 2, "c": 3] var sum = 0 diff --git a/Tests/SwiftScriptInterpreterTests/ShellKitIntegrationTests.swift b/Tests/SwiftScriptInterpreterTests/ShellKitIntegrationTests.swift new file mode 100644 index 0000000..e893f00 --- /dev/null +++ b/Tests/SwiftScriptInterpreterTests/ShellKitIntegrationTests.swift @@ -0,0 +1,318 @@ +import Testing +import Foundation +import ShellKit +@testable import SwiftScriptInterpreter + +/// Disambiguate against `Testing.ExitStatus` (added by Swift Testing +/// 1743+ for exit-test assertions). We mean the ShellKit type. +typealias ExitStatus = ShellKit.ExitStatus + +/// Tests that exercise the SwiftScript ↔ ShellKit boundary. Each +/// constructs a ``ShellKit/Shell`` with custom sinks / sandbox / +/// hostInfo, binds it for the test scope via `withCurrent(_:)`, and +/// asserts that script-side I/O routes through the bound surface. +@Suite("ShellKit integration") +struct ShellKitIntegrationTests { + + // MARK: stdout / stderr + + @Test func defaultOutputRoutesToShellCurrentStdout() async throws { + let shell = TestShell() + try await shell.shellKit.withCurrent { + let interp = Interpreter() + try await interp.eval(#"print("hello")"#) + } + #expect(shell.stdout == "hello\n") + #expect(shell.stderr == "") + } + + @Test func printTerminatorEmptyDoesNotLeakToHostStdout() async throws { + // Earlier versions short-circuited around `output` for any + // non-`\n` terminator and called `Swift.print` directly, + // bypassing the bound shell. This exercises the fix. + let shell = TestShell() + try await shell.shellKit.withCurrent { + let interp = Interpreter() + try await interp.eval(#""" + print("a", terminator: "|") + print("b", terminator: "|") + print("c", terminator: "") + """#) + } + #expect(shell.stdout == "a|b|c") + } + + @Test func parseErrorRoutesToShellCurrentStderr() async throws { + let shell = TestShell() + try await shell.shellKit.withCurrent { + let interp = Interpreter() + do { + _ = try await interp.eval(#"let x = ###"#) + Issue.record("expected ParseError") + } catch let parseError as ParseError { + interp.error(parseError.formatted) + } + } + #expect(shell.stdout == "") + #expect(shell.stderr.contains("error:")) + } + + // MARK: stdin + + @Test func readLinePullsFromShellCurrentStdin() async throws { + let shell = TestShell( + stdin: .string("first line\nsecond line\n")) + try await shell.shellKit.withCurrent { + let interp = Interpreter() + try await interp.eval(#""" + if let a = readLine(), let b = readLine() { + print(a + "+" + b) + } + """#) + } + #expect(shell.stdout == "first line+second line\n") + } + + // MARK: CommandLine.arguments + + @Test func commandLineArgumentsReadFromBoundShell() async throws { + let shell = TestShell() + shell.shellKit.scriptName = "/abs/script.swift" + shell.shellKit.positionalParameters = ["alpha", "beta"] + try await shell.shellKit.withCurrent { + let interp = Interpreter() + try await interp.eval(#""" + for a in CommandLine.arguments { + print(a) + } + """#) + } + let lines = shell.stdout.split(separator: "\n").map(String.init) + #expect(lines == ["/abs/script.swift", "alpha", "beta"]) + } + + @Test func explicitScriptArgumentsOverrideBoundShell() async throws { + // When `interpreter.scriptArguments` is set explicitly, it + // wins over the bound shell. Embedders that want to inject a + // fixed argv (tests, replay) use this path. + let shell = TestShell() + shell.shellKit.scriptName = "/should/be/overridden" + try await shell.shellKit.withCurrent { + let interp = Interpreter() + interp.scriptArguments = ["/explicit", "x", "y"] + try await interp.eval(#""" + print(CommandLine.arguments[0]) + print(CommandLine.arguments[1]) + print(CommandLine.arguments[2]) + """#) + } + #expect(shell.stdout == "/explicit\nx\ny\n") + } + + // MARK: exit / evalScript + + @Test func evalScriptCatchesExitAndReturnsStatus() async throws { + let shell = TestShell() + let status = try await shell.shellKit.withCurrent { + let interp = Interpreter() + return try await interp.evalScript(#""" + print("before") + exit(42) + print("after") + """#) + } + #expect(status.code == 42) + #expect(shell.stdout == "before\n") + } + + @Test func evalLetsScriptExitPropagateForCallers() async throws { + // Callers that use the value-returning `eval` path see + // `ScriptExit` as a thrown error — they choose how to + // surface it. This test exercises that boundary. + let shell = TestShell() + var caught: ExitStatus? = nil + try await shell.shellKit.withCurrent { + let interp = Interpreter() + do { + _ = try await interp.eval(#"exit(7)"#) + } catch let scriptExit as ScriptExit { + caught = scriptExit.status + } + } + #expect(caught?.code == 7) + } + + @Test func abortReturnsConventionalExitCode() async throws { + let shell = TestShell() + let status = try await shell.shellKit.withCurrent { + let interp = Interpreter() + return try await interp.evalScript(#"abort()"#) + } + // Conventional 128 + SIGABRT (6) on Unix. + #expect(status.code == 134) + _ = shell // silence unused-let warning + } + + // MARK: sandbox — file-system gate + + @Test func sandboxBlocksReadOutsideAllowedRoot() async throws { + // `fileExists` is gated for `.read`; the sandbox denies an + // off-root path; the bridge wraps the denial as a thrown + // user-side error. + let root = NSTemporaryDirectory() + + "swiftscript-sandbox-\(UUID().uuidString)" + try FileManager.default.createDirectory( + atPath: root, withIntermediateDirectories: true) + defer { try? FileManager.default.removeItem(atPath: root) } + + let outside = "/etc/passwd" + let shell = TestShell( + sandbox: .rooted(at: URL(fileURLWithPath: root), + allowedHosts: [])) + var caughtError: Error? + await shell.shellKit.withCurrent { + let interp = Interpreter() + do { + _ = try await interp.eval(#""" + import Foundation + FileManager.default.fileExists(atPath: "\#(outside)") + """#) + } catch { + caughtError = error + } + } + // We expect a UserThrowSignal wrapping a Sandbox.Denial. The + // signal's payload is opaque; just confirm the right shape. + #expect(caughtError != nil) + if let signal = caughtError as? UserThrowSignal { + if case .opaque(_, let payload) = signal.value, + payload is ShellKit.Sandbox.Denial + { + // ok + } else { + Issue.record("expected Sandbox.Denial payload, got \(signal.value)") + } + } else { + Issue.record("expected UserThrowSignal, got \(caughtError as Any)") + } + } + + @Test func sandboxAllowsAccessInsideAllowedRoot() async throws { + let root = NSTemporaryDirectory() + + "swiftscript-sandbox-\(UUID().uuidString)" + try FileManager.default.createDirectory( + atPath: root, withIntermediateDirectories: true) + defer { try? FileManager.default.removeItem(atPath: root) } + // Drop a sentinel file the script can stat. + let sentinel = root + "/marker" + try "x".write(toFile: sentinel, atomically: true, encoding: .utf8) + + let shell = TestShell( + sandbox: .rooted(at: URL(fileURLWithPath: root), + allowedHosts: [])) + let escaped = sentinel.replacingOccurrences(of: "\\", with: "\\\\") + let r = try await shell.shellKit.withCurrent { + let interp = Interpreter() + return try await interp.eval(#""" + import Foundation + FileManager.default.fileExists(atPath: "\#(escaped)") + """#) + } + #expect(r == .bool(true)) + } + + // MARK: identity + + @Test func processInfoUserNameReadsHostInfo() async throws { + var info = HostInfo.synthetic + info.userName = "sandbox-user" + info.hostName = "sandbox-host" + let shell = TestShell(hostInfo: info) + try await shell.shellKit.withCurrent { + let interp = Interpreter() + try await interp.eval(#""" + import Foundation + print(ProcessInfo.processInfo.userName) + print(ProcessInfo.processInfo.hostName) + """#) + } + #expect(shell.stdout == "sandbox-user\nsandbox-host\n") + } + + @Test func processInfoArgumentsMirrorsCommandLine() async throws { + let shell = TestShell() + shell.shellKit.scriptName = "myscript.swift" + shell.shellKit.positionalParameters = ["one", "two"] + try await shell.shellKit.withCurrent { + let interp = Interpreter() + try await interp.eval(#""" + import Foundation + for a in ProcessInfo.processInfo.arguments { + print(a) + } + """#) + } + let lines = shell.stdout.split(separator: "\n").map(String.init) + #expect(lines == ["myscript.swift", "one", "two"]) + } + + @Test func processInfoEnvironmentReadsBoundEnvironment() async throws { + let shell = TestShell() + shell.shellKit.environment.variables = ["FOO": "bar", "BAZ": "qux"] + try await shell.shellKit.withCurrent { + let interp = Interpreter() + try await interp.eval(#""" + import Foundation + let env = ProcessInfo.processInfo.environment + print(env["FOO"] ?? "") + print(env["BAZ"] ?? "") + """#) + } + #expect(shell.stdout == "bar\nqux\n") + } +} + +// MARK: - Test harness + +/// A `ShellKit.Shell` wired up with capturing stdio sinks plus +/// optional `stdin` / `sandbox` / `hostInfo` / `networkConfig`. The +/// tests bind it via `shellKit.withCurrent { … }` for the duration +/// of each script evaluation. +final class TestShell { + let shellKit: ShellKit.Shell + private let stdoutBox = StringBox() + private let stderrBox = StringBox() + var stdout: String { stdoutBox.read() } + var stderr: String { stderrBox.read() } + + init(stdin: InputSource = .empty, + sandbox: ShellKit.Sandbox? = nil, + hostInfo: HostInfo = .synthetic, + networkConfig: NetworkConfig? = nil) + { + let stdoutBox = self.stdoutBox + let stderrBox = self.stderrBox + self.shellKit = ShellKit.Shell( + stdin: stdin, + stdout: OutputSink(onWrite: { stdoutBox.append($0) }), + stderr: OutputSink(onWrite: { stderrBox.append($0) }), + environment: Environment(), + sandbox: sandbox, + networkConfig: networkConfig, + hostInfo: hostInfo) + } + + private final class StringBox: @unchecked Sendable { + private let lock = NSLock() + private var value = "" + func append(_ data: Data) { + let s = String(decoding: data, as: UTF8.self) + lock.lock(); defer { lock.unlock() } + value.append(s) + } + func read() -> String { + lock.lock(); defer { lock.unlock() } + return value + } + } +} diff --git a/Tests/SwiftScriptInterpreterTests/ThrowsTests.swift b/Tests/SwiftScriptInterpreterTests/ThrowsTests.swift index cd56536..c40611d 100644 --- a/Tests/SwiftScriptInterpreterTests/ThrowsTests.swift +++ b/Tests/SwiftScriptInterpreterTests/ThrowsTests.swift @@ -6,7 +6,7 @@ struct ThrowsTests { @Test func throwAndCatchDefault() async throws { let interp = Interpreter() var captured = "" - let i = Interpreter(output: { captured += $0 + "\n" }) + let i = Interpreter(output: { captured += $0 }) try await i.eval(""" enum E: Error { case bad } func f() async throws { throw E.bad } @@ -19,7 +19,7 @@ struct ThrowsTests { @Test func throwWithPayloadCaughtByPattern() async throws { let i = Interpreter() var captured = "" - i.output = { captured += $0 + "\n" } + i.output = { captured += $0 } try await i.eval(""" enum E: Error { case parse(String) } func f() throws -> Int { throw E.parse("oops") } @@ -77,7 +77,7 @@ struct ThrowsTests { @Test func doWithoutThrow() async throws { let interp = Interpreter() var captured = "" - interp.output = { captured += $0 + "\n" } + interp.output = { captured += $0 } try await interp.eval(#"do { print("hello") }"#) #expect(captured == "hello\n") } diff --git a/Tools/regen-foundation-bridge.sh b/Tools/regen-foundation-bridge.sh index 6329bb2..1625e13 100755 --- a/Tools/regen-foundation-bridge.sh +++ b/Tools/regen-foundation-bridge.sh @@ -14,7 +14,13 @@ set -euo pipefail cd "$(dirname "$0")/.." SDK="$(xcrun --sdk macosx --show-sdk-path)" -TARGET="${BRIDGE_TARGET:-arm64-apple-macos26.0}" +# Match the package's deployment floor (macOS 13). Any symbol whose +# `@available(macOS X, *)` requires a newer OS gets filtered by the +# generator's `isDeprecated` check, so the resulting bridges link on +# every platform SwiftBash supports. Override via `BRIDGE_TARGET=...` +# to regen against a different floor — also update +# `deploymentMacOSMajor` in `Sources/BridgeGeneratorTool/main.swift`. +TARGET="${BRIDGE_TARGET:-arm64-apple-macos13.0}" SG_DIR="$(mktemp -d)" trap 'rm -rf "$SG_DIR"' EXIT