From e3727cb89d6f9302f08e53f9394df88e480dbaf7 Mon Sep 17 00:00:00 2001 From: Guilherme Souza Date: Fri, 19 Jun 2026 10:54:40 -0300 Subject: [PATCH 01/14] docs: add design spec for swift-symbolgraph-extract parser refactor Replaces the regex-based swift-parser with swift-symbolgraph-extract, the Swift compiler's own tool for public API surface extraction. --- ...6-06-19-swift-parser-symbolgraph-design.md | 215 ++++++++++++++++++ 1 file changed, 215 insertions(+) create mode 100644 docs/specs/2026-06-19-swift-parser-symbolgraph-design.md diff --git a/docs/specs/2026-06-19-swift-parser-symbolgraph-design.md b/docs/specs/2026-06-19-swift-parser-symbolgraph-design.md new file mode 100644 index 0000000..26fd30f --- /dev/null +++ b/docs/specs/2026-06-19-swift-parser-symbolgraph-design.md @@ -0,0 +1,215 @@ +# Swift Public API Parser — swift-symbolgraph-extract + +**Date:** 2026-06-19 +**Status:** Design approved, pending implementation + +## Problem + +The current `swift-parser.ts` is a ~170-line line-by-line regex scanner with brace-depth tracking. It has known blind spots: multi-line declarations, `#if` conditional compilation blocks, attributes spanning multiple lines (e.g. `@discardableResult` + `public func` on separate lines), and cannot model Swift's full access control semantics. Root cause: regex cannot reliably parse Swift without understanding the language. + +## Goal + +Replace the regex parser with `swift-symbolgraph-extract` — the Swift compiler's own tool for extracting a module's public API surface — and a thin TypeScript normalizer. Same downstream interface (`ParseResult`), no changes to `check-api-symbols` or anything else. + +## Decision: Semantic over Syntactic + +`swift-symbolgraph-extract` uses the Swift compiler (semantic analysis), not just syntax. This gets access control right by construction: `@_spi`, `@usableFromInline`, `#if` conditional compilation, and re-exports are all resolved correctly. The cost is that `swift build` must succeed in CI. For supabase-swift this is already a CI requirement, so the extra step is nearly free. + +## End-to-End Flow + +**Current (regex):** +``` +parse-swift + → swift-parser.ts (line-by-line regex) + → ParseResult JSON + → check-api-symbols +``` + +**Proposed (symbol graph):** +``` +swift build # PR branch + base branch +swift-symbolgraph-extract -module-name ... # one run per library product + → M.symbols.json (Symbol Graph format) +jq -s '[.[] | .symbols[]]' *.symbols.json # merge multiple modules + → merged-raw.json +normalize-symbolgraph # thin TS normalizer (new) + → ParseResult JSON + → check-api-symbols (unchanged) +``` + +## Files Changed + +**Added:** +- `src/normalize-symbolgraph.ts` — core normalizer: `SymbolGraph[]` → `ParseResult` +- `src/normalize-symbolgraph-cli.ts` — CLI entry point (`npm run normalize-symbolgraph `) +- `test/normalize-symbolgraph.test.ts` — ~20 unit tests +- `test/fixtures/symbolgraph-sample.json` — real `swift-symbolgraph-extract` output (committed, not hand-authored) +- `docs/specs/2026-06-19-swift-parser-symbolgraph-design.md` — this file + +**Removed:** +- `src/swift-parser.ts` — regex parser +- `src/parse-swift.ts` — CLI wrapper for regex parser +- `test/swift-parser.test.ts` — regex parser tests +- `test/fixtures/swift-sample/` — regex parser test fixtures + +**Modified:** +- `.github/workflows/validate-sdk-compliance.yml` — Swift-conditional steps (see CI section) +- `package.json` — `normalize-symbolgraph` script replaces `parse-swift` + +## Normalizer Design + +### Input types + +```typescript +interface SymbolGraphSymbol { + kind: { identifier: string }; + accessLevel: string; + pathComponents: string[]; + location?: { uri: string }; +} + +interface SymbolGraph { + symbols: SymbolGraphSymbol[]; +} +``` + +The normalizer accepts a merged array of all symbols (post-`jq` merge) as a single JSON file. + +### Name + +`pathComponents.join(".")` — the compiler already computed the qualified name. No regex needed. + +Examples: +- `["SupabaseClient"]` → `"SupabaseClient"` +- `["SupabaseClient", "signIn"]` → `"SupabaseClient.signIn"` + +### Kind mapping + +| `kind.identifier` | `ParsedSymbol["kind"]` | +|---|---| +| `swift.class`, `swift.struct`, `swift.enum`, `swift.protocol`, `swift.actor` | `"class"` | +| `swift.func` | `"function"` | +| `swift.method`, `swift.type.method`, `swift.init`, `swift.subscript`, `swift.type.subscript` | `"method"` | +| `swift.property`, `swift.type.property`, `swift.enum.case` | `"property"` | +| `swift.typealias`, `swift.associatedtype`, `swift.var` | `"variable"` | +| `swift.deinit`, everything else | skip | + +### Access filter + +`swift-symbolgraph-extract` only emits `public` and `open` symbols by default. The normalizer keeps an explicit check (`accessLevel === "public" || accessLevel === "open"`) as a defensive guard. + +### File path + +`location.uri` is an absolute `file://` URI. The normalizer accepts the SDK root as a second CLI argument and strips the prefix to produce a relative path. Falls back to an empty string if `location` is absent (e.g. synthesized symbols). + +## CI Workflow Changes + +### Runner + +The `check` job's runner becomes language-conditional: + +```yaml +check: + runs-on: ${{ inputs.language == 'swift' && 'macos-latest' || 'ubuntu-latest' }} +``` + +Swift gets `macos-latest` (Swift pre-installed via Xcode). JavaScript stays on `ubuntu-latest`. No new job. + +### New Swift-conditional steps + +Added after "Checkout capability spec", before the existing parse steps: + +```yaml +- name: Build PR branch (Swift) + if: inputs.language == 'swift' + run: swift build + working-directory: _sdk-pr + +- name: Build base branch (Swift) + if: inputs.language == 'swift' + run: swift build + working-directory: _sdk-base + +- name: Extract symbol graphs — PR + if: inputs.language == 'swift' + run: | + mkdir -p _sg-pr + TRIPLE=$(swift -print-target-info | jq -r '.target.triple') + SDK=$(xcrun --sdk macosx --show-sdk-path) + for MODULE in $(swift package dump-package | jq -r '[.products[] | select(.type.library != null) | .targets[]] | unique[]'); do + swift-symbolgraph-extract -module-name "$MODULE" \ + -target "$TRIPLE" -sdk "$SDK" \ + -I _sdk-pr/.build/debug \ + -output-dir _sg-pr + done + jq -s '[.[] | .symbols[]]' _sg-pr/*.symbols.json > pr-raw.json + working-directory: _sdk-pr + +- name: Extract symbol graphs — base + if: inputs.language == 'swift' + run: | + mkdir -p _sg-base + TRIPLE=$(swift -print-target-info | jq -r '.target.triple') + SDK=$(xcrun --sdk macosx --show-sdk-path) + for MODULE in $(swift package dump-package | jq -r '[.products[] | select(.type.library != null) | .targets[]] | unique[]'); do + swift-symbolgraph-extract -module-name "$MODULE" \ + -target "$TRIPLE" -sdk "$SDK" \ + -I _sdk-base/.build/debug \ + -output-dir _sg-base + done + jq -s '[.[] | .symbols[]]' _sg-base/*.symbols.json > base-raw.json + working-directory: _sdk-base + +- name: Normalize symbol graphs — PR + if: inputs.language == 'swift' + run: | + npm run --silent normalize-symbolgraph -- \ + "$GITHUB_WORKSPACE/pr-raw.json" "$GITHUB_WORKSPACE/_sdk-pr" \ + > "$GITHUB_WORKSPACE/pr-symbols.json" + working-directory: _sdk-spec/scripts/capability-matrix + +- name: Normalize symbol graphs — base + if: inputs.language == 'swift' + run: | + npm run --silent normalize-symbolgraph -- \ + "$GITHUB_WORKSPACE/base-raw.json" "$GITHUB_WORKSPACE/_sdk-base" \ + > "$GITHUB_WORKSPACE/base-symbols.json" + working-directory: _sdk-spec/scripts/capability-matrix +``` + +### Modified existing steps + +The three existing steps — "Resolve parse command", "Parse PR branch", "Parse base branch" — are each guarded with `if: inputs.language != 'swift'`. For Swift, the dedicated build → extract → normalize steps above already produce `pr-symbols.json` and `base-symbols.json` directly. The final "Check new symbols against capability matrix" step (`check-api-symbols`) runs unconditionally and is unchanged. + +### SPM dependency caching + +Add `actions/cache` on `~/.cache/org.swift.swiftpm` keyed on `Package.resolved` to avoid re-downloading SPM dependencies on repeated runs. + +## Testing + +**Fixture** (`test/fixtures/symbolgraph-sample.json`): real merged symbol graph output from a small Swift package or subset of supabase-swift. Generated once with the actual tool, committed, never hand-authored. + +**Test cases** (~20 tests in `test/normalize-symbolgraph.test.ts`): + +| Case | What it verifies | +|---|---| +| `public class` | type → `"class"`, pathComponents join | +| `public struct` | type → `"class"` | +| `public enum` + cases | type → `"class"`, cases → `"property"` | +| `public protocol` | type → `"class"` | +| `public actor` | type → `"class"` | +| `open class` | `open` access level included | +| `internal` symbol | filtered out | +| Instance method | → `"method"` | +| Static method (`swift.type.method`) | → `"method"` | +| `init` | → `"method"` | +| Instance property | → `"property"` | +| Global free function | → `"function"` | +| Typealias | → `"variable"` | +| `deinit` | skipped | +| Nested type (`Outer.Inner`) | pathComponents → `"Outer.Inner"` | +| Multi-module merge | symbols from two inputs appear in output | +| `file` path | absolute URI → relative path | +| Missing `location` | file falls back to `""` | + +No Swift toolchain needed at test time — the normalizer is pure TypeScript operating on JSON. From 8e39e2d2534d39f31c87932deb4e12c82b3a5301 Mon Sep 17 00:00:00 2001 From: Guilherme Souza Date: Fri, 19 Jun 2026 11:07:21 -0300 Subject: [PATCH 02/14] feat(parsers): scaffold normalize-symbolgraph types and add symbol graph fixture --- scripts/capability-matrix/package.json | 2 +- .../src/normalize-symbolgraph.ts | 41 + .../test/fixtures/symbolgraph-sample.json | 4120 +++++++++++++++++ 3 files changed, 4162 insertions(+), 1 deletion(-) create mode 100644 scripts/capability-matrix/src/normalize-symbolgraph.ts create mode 100644 scripts/capability-matrix/test/fixtures/symbolgraph-sample.json diff --git a/scripts/capability-matrix/package.json b/scripts/capability-matrix/package.json index 8859f87..84ae0c9 100644 --- a/scripts/capability-matrix/package.json +++ b/scripts/capability-matrix/package.json @@ -9,7 +9,7 @@ "validate:online": "tsx src/cli.ts validate --online", "validate-compliance": "tsx src/compliance-cli.ts", "parse-ts": "tsx src/parse-ts.ts", - "parse-swift": "tsx src/parse-swift.ts", + "normalize-symbolgraph": "tsx src/normalize-symbolgraph-cli.ts", "check-api-symbols": "tsx src/check-api-symbols.ts", "aggregate": "tsx src/aggregate.ts", "report": "tsx src/cli.ts report", diff --git a/scripts/capability-matrix/src/normalize-symbolgraph.ts b/scripts/capability-matrix/src/normalize-symbolgraph.ts new file mode 100644 index 0000000..01d9b21 --- /dev/null +++ b/scripts/capability-matrix/src/normalize-symbolgraph.ts @@ -0,0 +1,41 @@ +import { relative } from "node:path"; +import type { ParsedSymbol, ParseResult } from "./ts-parser.js"; +export type { ParsedSymbol, ParseResult }; + +export interface SymbolGraphSymbol { + kind: { identifier: string }; + accessLevel: string; + pathComponents: string[]; + location?: { uri: string }; +} + +// Kind identifiers that map to ParsedSymbol kinds. +// swift.deinit and all unrecognised kinds are skipped. +const KIND_MAP: Record = { + "swift.class": "class", + "swift.struct": "class", + "swift.enum": "class", + "swift.protocol": "class", + "swift.actor": "class", + "swift.func": "function", + "swift.func.op": "function", + "swift.method": "method", + "swift.type.method": "method", + "swift.init": "method", + "swift.subscript": "method", + "swift.type.subscript": "method", + "swift.property": "property", + "swift.type.property": "property", + "swift.enum.case": "property", + "swift.typealias": "variable", + "swift.associatedtype": "variable", + "swift.var": "variable", +}; + +export function normalizeSymbolGraph( + symbols: SymbolGraphSymbol[], + sdkRoot: string, +): ParseResult { + // TODO: implement in Task 2 + return { symbols: [] }; +} diff --git a/scripts/capability-matrix/test/fixtures/symbolgraph-sample.json b/scripts/capability-matrix/test/fixtures/symbolgraph-sample.json new file mode 100644 index 0000000..5945663 --- /dev/null +++ b/scripts/capability-matrix/test/fixtures/symbolgraph-sample.json @@ -0,0 +1,4120 @@ +[ + { + "kind": { + "identifier": "swift.class", + "displayName": "Class" + }, + "identifier": { + "precise": "s:9SampleLib11SimpleClassC", + "interfaceLanguage": "swift" + }, + "pathComponents": [ + "SimpleClass" + ], + "names": { + "title": "SimpleClass", + "navigator": [ + { + "kind": "identifier", + "spelling": "SimpleClass" + } + ], + "subHeading": [ + { + "kind": "keyword", + "spelling": "class" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "SimpleClass" + } + ] + }, + "declarationFragments": [ + { + "kind": "keyword", + "spelling": "class" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "SimpleClass" + } + ], + "accessLevel": "public", + "location": { + "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", + "position": { + "line": 0, + "character": 13 + } + } + }, + { + "kind": { + "identifier": "swift.property", + "displayName": "Instance Property" + }, + "identifier": { + "precise": "s:9SampleLib11SimpleClassC16instancePropertySSvp", + "interfaceLanguage": "swift" + }, + "pathComponents": [ + "SimpleClass", + "instanceProperty" + ], + "names": { + "title": "instanceProperty", + "subHeading": [ + { + "kind": "keyword", + "spelling": "var" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "instanceProperty" + }, + { + "kind": "text", + "spelling": ": " + }, + { + "kind": "typeIdentifier", + "spelling": "String", + "preciseIdentifier": "s:SS" + } + ] + }, + "declarationFragments": [ + { + "kind": "keyword", + "spelling": "var" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "instanceProperty" + }, + { + "kind": "text", + "spelling": ": " + }, + { + "kind": "typeIdentifier", + "spelling": "String", + "preciseIdentifier": "s:SS" + } + ], + "accessLevel": "public", + "location": { + "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", + "position": { + "line": 1, + "character": 15 + } + } + }, + { + "kind": { + "identifier": "swift.type.property", + "displayName": "Type Property" + }, + "identifier": { + "precise": "s:9SampleLib11SimpleClassC14staticPropertySivpZ", + "interfaceLanguage": "swift" + }, + "pathComponents": [ + "SimpleClass", + "staticProperty" + ], + "names": { + "title": "staticProperty", + "subHeading": [ + { + "kind": "keyword", + "spelling": "static" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "keyword", + "spelling": "var" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "staticProperty" + }, + { + "kind": "text", + "spelling": ": " + }, + { + "kind": "typeIdentifier", + "spelling": "Int", + "preciseIdentifier": "s:Si" + } + ] + }, + "declarationFragments": [ + { + "kind": "keyword", + "spelling": "static" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "keyword", + "spelling": "var" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "staticProperty" + }, + { + "kind": "text", + "spelling": ": " + }, + { + "kind": "typeIdentifier", + "spelling": "Int", + "preciseIdentifier": "s:Si" + } + ], + "accessLevel": "public", + "location": { + "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", + "position": { + "line": 2, + "character": 22 + } + } + }, + { + "kind": { + "identifier": "swift.method", + "displayName": "Instance Method" + }, + "identifier": { + "precise": "s:9SampleLib11SimpleClassC14instanceMethodyyF", + "interfaceLanguage": "swift" + }, + "pathComponents": [ + "SimpleClass", + "instanceMethod()" + ], + "names": { + "title": "instanceMethod()", + "subHeading": [ + { + "kind": "keyword", + "spelling": "func" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "instanceMethod" + }, + { + "kind": "text", + "spelling": "()" + } + ] + }, + "functionSignature": { + "returns": [ + { + "kind": "text", + "spelling": "()" + } + ] + }, + "declarationFragments": [ + { + "kind": "keyword", + "spelling": "func" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "instanceMethod" + }, + { + "kind": "text", + "spelling": "()" + } + ], + "accessLevel": "public", + "location": { + "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", + "position": { + "line": 3, + "character": 16 + } + } + }, + { + "kind": { + "identifier": "swift.type.method", + "displayName": "Type Method" + }, + "identifier": { + "precise": "s:9SampleLib11SimpleClassC12staticMethodACyFZ", + "interfaceLanguage": "swift" + }, + "pathComponents": [ + "SimpleClass", + "staticMethod()" + ], + "names": { + "title": "staticMethod()", + "subHeading": [ + { + "kind": "keyword", + "spelling": "static" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "keyword", + "spelling": "func" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "staticMethod" + }, + { + "kind": "text", + "spelling": "() -> " + }, + { + "kind": "typeIdentifier", + "spelling": "SimpleClass", + "preciseIdentifier": "s:9SampleLib11SimpleClassC" + } + ] + }, + "functionSignature": { + "returns": [ + { + "kind": "typeIdentifier", + "spelling": "SimpleClass", + "preciseIdentifier": "s:9SampleLib11SimpleClassC" + } + ] + }, + "declarationFragments": [ + { + "kind": "keyword", + "spelling": "static" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "keyword", + "spelling": "func" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "staticMethod" + }, + { + "kind": "text", + "spelling": "() -> " + }, + { + "kind": "typeIdentifier", + "spelling": "SimpleClass", + "preciseIdentifier": "s:9SampleLib11SimpleClassC" + } + ], + "accessLevel": "public", + "location": { + "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", + "position": { + "line": 4, + "character": 23 + } + } + }, + { + "kind": { + "identifier": "swift.init", + "displayName": "Initializer" + }, + "identifier": { + "precise": "s:9SampleLib11SimpleClassC5valueACSS_tcfc", + "interfaceLanguage": "swift" + }, + "pathComponents": [ + "SimpleClass", + "init(value:)" + ], + "names": { + "title": "init(value:)", + "subHeading": [ + { + "kind": "keyword", + "spelling": "init" + }, + { + "kind": "text", + "spelling": "(" + }, + { + "kind": "externalParam", + "spelling": "value" + }, + { + "kind": "text", + "spelling": ": " + }, + { + "kind": "typeIdentifier", + "spelling": "String", + "preciseIdentifier": "s:SS" + }, + { + "kind": "text", + "spelling": ")" + } + ] + }, + "functionSignature": { + "parameters": [ + { + "name": "value", + "declarationFragments": [ + { + "kind": "identifier", + "spelling": "value" + }, + { + "kind": "text", + "spelling": ": " + }, + { + "kind": "typeIdentifier", + "spelling": "String", + "preciseIdentifier": "s:SS" + } + ] + } + ] + }, + "declarationFragments": [ + { + "kind": "keyword", + "spelling": "init" + }, + { + "kind": "text", + "spelling": "(" + }, + { + "kind": "externalParam", + "spelling": "value" + }, + { + "kind": "text", + "spelling": ": " + }, + { + "kind": "typeIdentifier", + "spelling": "String", + "preciseIdentifier": "s:SS" + }, + { + "kind": "text", + "spelling": ")" + } + ], + "accessLevel": "public", + "location": { + "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", + "position": { + "line": 5, + "character": 11 + } + } + }, + { + "kind": { + "identifier": "swift.typealias", + "displayName": "Type Alias" + }, + "identifier": { + "precise": "s:9SampleLib11SimpleClassC8Callbacka", + "interfaceLanguage": "swift" + }, + "pathComponents": [ + "SimpleClass", + "Callback" + ], + "names": { + "title": "SimpleClass.Callback", + "navigator": [ + { + "kind": "identifier", + "spelling": "Callback" + } + ], + "subHeading": [ + { + "kind": "keyword", + "spelling": "typealias" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "Callback" + } + ] + }, + "declarationFragments": [ + { + "kind": "keyword", + "spelling": "typealias" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "Callback" + }, + { + "kind": "text", + "spelling": " = () -> " + }, + { + "kind": "typeIdentifier", + "spelling": "Void", + "preciseIdentifier": "s:s4Voida" + } + ], + "accessLevel": "public", + "location": { + "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", + "position": { + "line": 7, + "character": 21 + } + } + }, + { + "kind": { + "identifier": "swift.struct", + "displayName": "Structure" + }, + "identifier": { + "precise": "s:9SampleLib11SimpleClassC12NestedStructV", + "interfaceLanguage": "swift" + }, + "pathComponents": [ + "SimpleClass", + "NestedStruct" + ], + "names": { + "title": "SimpleClass.NestedStruct", + "navigator": [ + { + "kind": "identifier", + "spelling": "NestedStruct" + } + ], + "subHeading": [ + { + "kind": "keyword", + "spelling": "struct" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "NestedStruct" + } + ] + }, + "declarationFragments": [ + { + "kind": "keyword", + "spelling": "struct" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "NestedStruct" + } + ], + "accessLevel": "public", + "location": { + "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", + "position": { + "line": 8, + "character": 18 + } + } + }, + { + "kind": { + "identifier": "swift.property", + "displayName": "Instance Property" + }, + "identifier": { + "precise": "s:9SampleLib11SimpleClassC12NestedStructV14nestedPropertySivp", + "interfaceLanguage": "swift" + }, + "pathComponents": [ + "SimpleClass", + "NestedStruct", + "nestedProperty" + ], + "names": { + "title": "nestedProperty", + "subHeading": [ + { + "kind": "keyword", + "spelling": "var" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "nestedProperty" + }, + { + "kind": "text", + "spelling": ": " + }, + { + "kind": "typeIdentifier", + "spelling": "Int", + "preciseIdentifier": "s:Si" + } + ] + }, + "declarationFragments": [ + { + "kind": "keyword", + "spelling": "var" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "nestedProperty" + }, + { + "kind": "text", + "spelling": ": " + }, + { + "kind": "typeIdentifier", + "spelling": "Int", + "preciseIdentifier": "s:Si" + } + ], + "accessLevel": "public", + "location": { + "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", + "position": { + "line": 9, + "character": 19 + } + } + }, + { + "kind": { + "identifier": "swift.class", + "displayName": "Class" + }, + "identifier": { + "precise": "s:9SampleLib9OpenClassC", + "interfaceLanguage": "swift" + }, + "pathComponents": [ + "OpenClass" + ], + "names": { + "title": "OpenClass", + "navigator": [ + { + "kind": "identifier", + "spelling": "OpenClass" + } + ], + "subHeading": [ + { + "kind": "keyword", + "spelling": "class" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "OpenClass" + } + ] + }, + "declarationFragments": [ + { + "kind": "keyword", + "spelling": "class" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "OpenClass" + } + ], + "accessLevel": "open", + "location": { + "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", + "position": { + "line": 12, + "character": 11 + } + } + }, + { + "kind": { + "identifier": "swift.init", + "displayName": "Initializer" + }, + "identifier": { + "precise": "s:9SampleLib9OpenClassCACycfc", + "interfaceLanguage": "swift" + }, + "pathComponents": [ + "OpenClass", + "init()" + ], + "names": { + "title": "init()", + "subHeading": [ + { + "kind": "keyword", + "spelling": "init" + }, + { + "kind": "text", + "spelling": "()" + } + ] + }, + "functionSignature": {}, + "declarationFragments": [ + { + "kind": "keyword", + "spelling": "init" + }, + { + "kind": "text", + "spelling": "()" + } + ], + "accessLevel": "public", + "location": { + "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", + "position": { + "line": 13, + "character": 11 + } + } + }, + { + "kind": { + "identifier": "swift.method", + "displayName": "Instance Method" + }, + "identifier": { + "precise": "s:9SampleLib9OpenClassC10openMethodyyF", + "interfaceLanguage": "swift" + }, + "pathComponents": [ + "OpenClass", + "openMethod()" + ], + "names": { + "title": "openMethod()", + "subHeading": [ + { + "kind": "keyword", + "spelling": "func" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "openMethod" + }, + { + "kind": "text", + "spelling": "()" + } + ] + }, + "functionSignature": { + "returns": [ + { + "kind": "text", + "spelling": "()" + } + ] + }, + "declarationFragments": [ + { + "kind": "keyword", + "spelling": "func" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "openMethod" + }, + { + "kind": "text", + "spelling": "()" + } + ], + "accessLevel": "open", + "location": { + "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", + "position": { + "line": 14, + "character": 14 + } + } + }, + { + "kind": { + "identifier": "swift.struct", + "displayName": "Structure" + }, + "identifier": { + "precise": "s:9SampleLib12SimpleStructV", + "interfaceLanguage": "swift" + }, + "pathComponents": [ + "SimpleStruct" + ], + "names": { + "title": "SimpleStruct", + "navigator": [ + { + "kind": "identifier", + "spelling": "SimpleStruct" + } + ], + "subHeading": [ + { + "kind": "keyword", + "spelling": "struct" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "SimpleStruct" + } + ] + }, + "declarationFragments": [ + { + "kind": "keyword", + "spelling": "struct" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "SimpleStruct" + } + ], + "accessLevel": "public", + "location": { + "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", + "position": { + "line": 16, + "character": 14 + } + } + }, + { + "kind": { + "identifier": "swift.property", + "displayName": "Instance Property" + }, + "identifier": { + "precise": "s:9SampleLib12SimpleStructV5fieldSSvp", + "interfaceLanguage": "swift" + }, + "pathComponents": [ + "SimpleStruct", + "field" + ], + "names": { + "title": "field", + "subHeading": [ + { + "kind": "keyword", + "spelling": "var" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "field" + }, + { + "kind": "text", + "spelling": ": " + }, + { + "kind": "typeIdentifier", + "spelling": "String", + "preciseIdentifier": "s:SS" + } + ] + }, + "declarationFragments": [ + { + "kind": "keyword", + "spelling": "var" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "field" + }, + { + "kind": "text", + "spelling": ": " + }, + { + "kind": "typeIdentifier", + "spelling": "String", + "preciseIdentifier": "s:SS" + } + ], + "accessLevel": "public", + "location": { + "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", + "position": { + "line": 17, + "character": 15 + } + } + }, + { + "kind": { + "identifier": "swift.init", + "displayName": "Initializer" + }, + "identifier": { + "precise": "s:9SampleLib12SimpleStructV5fieldACSS_tcfc", + "interfaceLanguage": "swift" + }, + "pathComponents": [ + "SimpleStruct", + "init(field:)" + ], + "names": { + "title": "init(field:)", + "subHeading": [ + { + "kind": "keyword", + "spelling": "init" + }, + { + "kind": "text", + "spelling": "(" + }, + { + "kind": "externalParam", + "spelling": "field" + }, + { + "kind": "text", + "spelling": ": " + }, + { + "kind": "typeIdentifier", + "spelling": "String", + "preciseIdentifier": "s:SS" + }, + { + "kind": "text", + "spelling": ")" + } + ] + }, + "functionSignature": { + "parameters": [ + { + "name": "field", + "declarationFragments": [ + { + "kind": "identifier", + "spelling": "field" + }, + { + "kind": "text", + "spelling": ": " + }, + { + "kind": "typeIdentifier", + "spelling": "String", + "preciseIdentifier": "s:SS" + } + ] + } + ] + }, + "declarationFragments": [ + { + "kind": "keyword", + "spelling": "init" + }, + { + "kind": "text", + "spelling": "(" + }, + { + "kind": "externalParam", + "spelling": "field" + }, + { + "kind": "text", + "spelling": ": " + }, + { + "kind": "typeIdentifier", + "spelling": "String", + "preciseIdentifier": "s:SS" + }, + { + "kind": "text", + "spelling": ")" + } + ], + "accessLevel": "public", + "location": { + "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", + "position": { + "line": 18, + "character": 11 + } + } + }, + { + "kind": { + "identifier": "swift.enum", + "displayName": "Enumeration" + }, + "identifier": { + "precise": "s:9SampleLib10SimpleEnumO", + "interfaceLanguage": "swift" + }, + "pathComponents": [ + "SimpleEnum" + ], + "names": { + "title": "SimpleEnum", + "navigator": [ + { + "kind": "identifier", + "spelling": "SimpleEnum" + } + ], + "subHeading": [ + { + "kind": "keyword", + "spelling": "enum" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "SimpleEnum" + } + ] + }, + "declarationFragments": [ + { + "kind": "keyword", + "spelling": "enum" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "SimpleEnum" + } + ], + "accessLevel": "public", + "location": { + "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", + "position": { + "line": 20, + "character": 12 + } + } + }, + { + "kind": { + "identifier": "swift.func.op", + "displayName": "Operator" + }, + "identifier": { + "precise": "s:SQsE2neoiySbx_xtFZ::SYNTHESIZED::s:9SampleLib10SimpleEnumO", + "interfaceLanguage": "swift" + }, + "pathComponents": [ + "SimpleEnum", + "!=(_:_:)" + ], + "names": { + "title": "!=(_:_:)", + "subHeading": [ + { + "kind": "keyword", + "spelling": "static" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "keyword", + "spelling": "func" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "!=" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "text", + "spelling": "(" + }, + { + "kind": "typeIdentifier", + "spelling": "Self" + }, + { + "kind": "text", + "spelling": ", " + }, + { + "kind": "typeIdentifier", + "spelling": "Self" + }, + { + "kind": "text", + "spelling": ") -> " + }, + { + "kind": "typeIdentifier", + "spelling": "Bool", + "preciseIdentifier": "s:Sb" + } + ] + }, + "docComment": { + "module": "Swift", + "lines": [ + { + "text": "Returns a Boolean value indicating whether two values are not equal." + }, + { + "text": "" + }, + { + "text": "Inequality is the inverse of equality. For any values `a` and `b`, `a != b`" + }, + { + "text": "implies that `a == b` is `false`." + }, + { + "text": "" + }, + { + "text": "This is the default implementation of the not-equal-to operator (`!=`)" + }, + { + "text": "for any type that conforms to `Equatable`." + }, + { + "text": "" + }, + { + "text": "- Parameters:" + }, + { + "text": " - lhs: A value to compare." + }, + { + "text": " - rhs: Another value to compare." + } + ] + }, + "functionSignature": { + "parameters": [ + { + "name": "lhs", + "declarationFragments": [ + { + "kind": "identifier", + "spelling": "lhs" + }, + { + "kind": "text", + "spelling": ": " + }, + { + "kind": "typeIdentifier", + "spelling": "Self" + } + ] + }, + { + "name": "rhs", + "declarationFragments": [ + { + "kind": "identifier", + "spelling": "rhs" + }, + { + "kind": "text", + "spelling": ": " + }, + { + "kind": "typeIdentifier", + "spelling": "Self" + } + ] + } + ], + "returns": [ + { + "kind": "typeIdentifier", + "spelling": "Bool", + "preciseIdentifier": "s:Sb" + } + ] + }, + "swiftExtension": { + "extendedModule": "Swift", + "typeKind": "swift.protocol" + }, + "declarationFragments": [ + { + "kind": "keyword", + "spelling": "static" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "keyword", + "spelling": "func" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "!=" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "text", + "spelling": "(" + }, + { + "kind": "internalParam", + "spelling": "lhs" + }, + { + "kind": "text", + "spelling": ": " + }, + { + "kind": "typeIdentifier", + "spelling": "Self" + }, + { + "kind": "text", + "spelling": ", " + }, + { + "kind": "internalParam", + "spelling": "rhs" + }, + { + "kind": "text", + "spelling": ": " + }, + { + "kind": "typeIdentifier", + "spelling": "Self" + }, + { + "kind": "text", + "spelling": ") -> " + }, + { + "kind": "typeIdentifier", + "spelling": "Bool", + "preciseIdentifier": "s:Sb" + } + ], + "accessLevel": "public" + }, + { + "kind": { + "identifier": "swift.enum.case", + "displayName": "Case" + }, + "identifier": { + "precise": "s:9SampleLib10SimpleEnumO5alphayA2CmF", + "interfaceLanguage": "swift" + }, + "pathComponents": [ + "SimpleEnum", + "alpha" + ], + "names": { + "title": "SimpleEnum.alpha", + "subHeading": [ + { + "kind": "keyword", + "spelling": "case" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "alpha" + } + ] + }, + "declarationFragments": [ + { + "kind": "keyword", + "spelling": "case" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "alpha" + } + ], + "accessLevel": "public", + "location": { + "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", + "position": { + "line": 21, + "character": 9 + } + } + }, + { + "kind": { + "identifier": "swift.enum.case", + "displayName": "Case" + }, + "identifier": { + "precise": "s:9SampleLib10SimpleEnumO4betayA2CmF", + "interfaceLanguage": "swift" + }, + "pathComponents": [ + "SimpleEnum", + "beta" + ], + "names": { + "title": "SimpleEnum.beta", + "subHeading": [ + { + "kind": "keyword", + "spelling": "case" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "beta" + } + ] + }, + "declarationFragments": [ + { + "kind": "keyword", + "spelling": "case" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "beta" + } + ], + "accessLevel": "public", + "location": { + "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", + "position": { + "line": 22, + "character": 9 + } + } + }, + { + "kind": { + "identifier": "swift.method", + "displayName": "Instance Method" + }, + "identifier": { + "precise": "s:9SampleLib10SimpleEnumO10enumMethodSSyF", + "interfaceLanguage": "swift" + }, + "pathComponents": [ + "SimpleEnum", + "enumMethod()" + ], + "names": { + "title": "enumMethod()", + "subHeading": [ + { + "kind": "keyword", + "spelling": "func" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "enumMethod" + }, + { + "kind": "text", + "spelling": "() -> " + }, + { + "kind": "typeIdentifier", + "spelling": "String", + "preciseIdentifier": "s:SS" + } + ] + }, + "functionSignature": { + "returns": [ + { + "kind": "typeIdentifier", + "spelling": "String", + "preciseIdentifier": "s:SS" + } + ] + }, + "declarationFragments": [ + { + "kind": "keyword", + "spelling": "func" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "enumMethod" + }, + { + "kind": "text", + "spelling": "() -> " + }, + { + "kind": "typeIdentifier", + "spelling": "String", + "preciseIdentifier": "s:SS" + } + ], + "accessLevel": "public", + "location": { + "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", + "position": { + "line": 23, + "character": 16 + } + } + }, + { + "kind": { + "identifier": "swift.protocol", + "displayName": "Protocol" + }, + "identifier": { + "precise": "s:9SampleLib14SimpleProtocolP", + "interfaceLanguage": "swift" + }, + "pathComponents": [ + "SimpleProtocol" + ], + "names": { + "title": "SimpleProtocol", + "navigator": [ + { + "kind": "identifier", + "spelling": "SimpleProtocol" + } + ], + "subHeading": [ + { + "kind": "keyword", + "spelling": "protocol" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "SimpleProtocol" + } + ] + }, + "declarationFragments": [ + { + "kind": "keyword", + "spelling": "protocol" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "SimpleProtocol" + } + ], + "accessLevel": "public", + "location": { + "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", + "position": { + "line": 25, + "character": 16 + } + } + }, + { + "kind": { + "identifier": "swift.method", + "displayName": "Instance Method" + }, + "identifier": { + "precise": "s:9SampleLib14SimpleProtocolP14protocolMethodyyF", + "interfaceLanguage": "swift" + }, + "pathComponents": [ + "SimpleProtocol", + "protocolMethod()" + ], + "names": { + "title": "protocolMethod()", + "subHeading": [ + { + "kind": "keyword", + "spelling": "func" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "protocolMethod" + }, + { + "kind": "text", + "spelling": "()" + } + ] + }, + "functionSignature": { + "returns": [ + { + "kind": "text", + "spelling": "()" + } + ] + }, + "declarationFragments": [ + { + "kind": "keyword", + "spelling": "func" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "protocolMethod" + }, + { + "kind": "text", + "spelling": "()" + } + ], + "accessLevel": "public", + "location": { + "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", + "position": { + "line": 26, + "character": 9 + } + } + }, + { + "kind": { + "identifier": "swift.associatedtype", + "displayName": "Associated Type" + }, + "identifier": { + "precise": "s:9SampleLib14SimpleProtocolP4ItemQa", + "interfaceLanguage": "swift" + }, + "pathComponents": [ + "SimpleProtocol", + "Item" + ], + "names": { + "title": "Item", + "subHeading": [ + { + "kind": "keyword", + "spelling": "associatedtype" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "Item" + } + ] + }, + "declarationFragments": [ + { + "kind": "keyword", + "spelling": "associatedtype" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "Item" + } + ], + "accessLevel": "public", + "location": { + "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", + "position": { + "line": 27, + "character": 19 + } + } + }, + { + "kind": { + "identifier": "swift.class", + "displayName": "Class" + }, + "identifier": { + "precise": "s:9SampleLib11SimpleActorC", + "interfaceLanguage": "swift" + }, + "pathComponents": [ + "SimpleActor" + ], + "names": { + "title": "SimpleActor", + "navigator": [ + { + "kind": "identifier", + "spelling": "SimpleActor" + } + ], + "subHeading": [ + { + "kind": "keyword", + "spelling": "actor" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "SimpleActor" + } + ] + }, + "declarationFragments": [ + { + "kind": "keyword", + "spelling": "actor" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "SimpleActor" + } + ], + "accessLevel": "public", + "location": { + "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", + "position": { + "line": 29, + "character": 13 + } + } + }, + { + "kind": { + "identifier": "swift.method", + "displayName": "Instance Method" + }, + "identifier": { + "precise": "s:ScA12_ConcurrencyE18withSerialExecutoryqd__qd__Scf_pqd_0_YKXEqd_0_YKs5ErrorRd_0_Ri_d__r0_lF::SYNTHESIZED::s:9SampleLib11SimpleActorC", + "interfaceLanguage": "swift" + }, + "pathComponents": [ + "SimpleActor", + "withSerialExecutor(_:)" + ], + "names": { + "title": "withSerialExecutor(_:)", + "subHeading": [ + { + "kind": "keyword", + "spelling": "func" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "withSerialExecutor" + }, + { + "kind": "text", + "spelling": "<" + }, + { + "kind": "genericParameter", + "spelling": "T" + }, + { + "kind": "text", + "spelling": ", " + }, + { + "kind": "genericParameter", + "spelling": "E" + }, + { + "kind": "text", + "spelling": ">((any " + }, + { + "kind": "typeIdentifier", + "spelling": "SerialExecutor", + "preciseIdentifier": "s:Scf" + }, + { + "kind": "text", + "spelling": ") " + }, + { + "kind": "keyword", + "spelling": "throws" + }, + { + "kind": "text", + "spelling": "(" + }, + { + "kind": "typeIdentifier", + "spelling": "E" + }, + { + "kind": "text", + "spelling": ") -> " + }, + { + "kind": "typeIdentifier", + "spelling": "T" + }, + { + "kind": "text", + "spelling": ") " + }, + { + "kind": "keyword", + "spelling": "throws" + }, + { + "kind": "text", + "spelling": "(" + }, + { + "kind": "typeIdentifier", + "spelling": "E" + }, + { + "kind": "text", + "spelling": ") -> " + }, + { + "kind": "typeIdentifier", + "spelling": "T" + } + ] + }, + "docComment": { + "module": "_Concurrency", + "lines": [ + { + "text": "Perform an operation with the actor's ``SerialExecutor``." + }, + { + "text": "" + }, + { + "text": "This converts the actor's ``Actor/unownedExecutor`` to a ``SerialExecutor`` while" + }, + { + "text": "retaining the actor for the duration of the operation. This is to ensure the lifetime" + }, + { + "text": "of the executor while performing the operation." + } + ] + }, + "functionSignature": { + "parameters": [ + { + "name": "operation", + "declarationFragments": [ + { + "kind": "identifier", + "spelling": "operation" + }, + { + "kind": "text", + "spelling": ": (any " + }, + { + "kind": "typeIdentifier", + "spelling": "SerialExecutor", + "preciseIdentifier": "s:Scf" + }, + { + "kind": "text", + "spelling": ") " + }, + { + "kind": "keyword", + "spelling": "throws" + }, + { + "kind": "text", + "spelling": "(" + }, + { + "kind": "typeIdentifier", + "spelling": "E" + }, + { + "kind": "text", + "spelling": ") -> " + }, + { + "kind": "typeIdentifier", + "spelling": "T" + } + ] + } + ], + "returns": [ + { + "kind": "typeIdentifier", + "spelling": "T" + } + ] + }, + "swiftGenerics": { + "parameters": [ + { + "name": "T", + "index": 0, + "depth": 1 + }, + { + "name": "E", + "index": 1, + "depth": 1 + } + ], + "constraints": [ + { + "kind": "conformance", + "lhs": "E", + "rhs": "Error", + "rhsPrecise": "s:s5ErrorP" + } + ] + }, + "swiftExtension": { + "extendedModule": "_Concurrency", + "typeKind": "swift.protocol" + }, + "declarationFragments": [ + { + "kind": "attribute", + "spelling": "nonisolated" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "keyword", + "spelling": "func" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "withSerialExecutor" + }, + { + "kind": "text", + "spelling": "<" + }, + { + "kind": "genericParameter", + "spelling": "T" + }, + { + "kind": "text", + "spelling": ", " + }, + { + "kind": "genericParameter", + "spelling": "E" + }, + { + "kind": "text", + "spelling": ">(" + }, + { + "kind": "externalParam", + "spelling": "_" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "internalParam", + "spelling": "operation" + }, + { + "kind": "text", + "spelling": ": (any " + }, + { + "kind": "typeIdentifier", + "spelling": "SerialExecutor", + "preciseIdentifier": "s:Scf" + }, + { + "kind": "text", + "spelling": ") " + }, + { + "kind": "keyword", + "spelling": "throws" + }, + { + "kind": "text", + "spelling": "(" + }, + { + "kind": "typeIdentifier", + "spelling": "E" + }, + { + "kind": "text", + "spelling": ") -> " + }, + { + "kind": "typeIdentifier", + "spelling": "T" + }, + { + "kind": "text", + "spelling": ") " + }, + { + "kind": "keyword", + "spelling": "throws" + }, + { + "kind": "text", + "spelling": "(" + }, + { + "kind": "typeIdentifier", + "spelling": "E" + }, + { + "kind": "text", + "spelling": ") -> " + }, + { + "kind": "typeIdentifier", + "spelling": "T" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "keyword", + "spelling": "where" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "typeIdentifier", + "spelling": "E" + }, + { + "kind": "text", + "spelling": " : " + }, + { + "kind": "typeIdentifier", + "spelling": "Error", + "preciseIdentifier": "s:s5ErrorP" + }, + { + "kind": "text", + "spelling": ", " + }, + { + "kind": "typeIdentifier", + "spelling": "T" + }, + { + "kind": "text", + "spelling": " : ~Copyable" + } + ], + "accessLevel": "public", + "availability": [ + { + "domain": "macOS", + "introduced": { + "major": 10, + "minor": 15 + } + }, + { + "domain": "watchOS", + "introduced": { + "major": 6, + "minor": 0 + } + }, + { + "domain": "iOS", + "introduced": { + "major": 13, + "minor": 0 + } + }, + { + "domain": "tvOS", + "introduced": { + "major": 13, + "minor": 0 + } + } + ] + }, + { + "kind": { + "identifier": "swift.method", + "displayName": "Instance Method" + }, + "identifier": { + "precise": "s:ScA12_ConcurrencyE18withSerialExecutoryqd__qd__Scf_pYaqd_0_YKYCXEYaqd_0_YKs5ErrorRd_0_Ri_d__r0_lF::SYNTHESIZED::s:9SampleLib11SimpleActorC", + "interfaceLanguage": "swift" + }, + "pathComponents": [ + "SimpleActor", + "withSerialExecutor(_:)" + ], + "names": { + "title": "withSerialExecutor(_:)", + "subHeading": [ + { + "kind": "keyword", + "spelling": "func" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "withSerialExecutor" + }, + { + "kind": "text", + "spelling": "<" + }, + { + "kind": "genericParameter", + "spelling": "T" + }, + { + "kind": "text", + "spelling": ", " + }, + { + "kind": "genericParameter", + "spelling": "E" + }, + { + "kind": "text", + "spelling": ">(" + }, + { + "kind": "keyword", + "spelling": "nonisolated(nonsending)" + }, + { + "kind": "text", + "spelling": " (any " + }, + { + "kind": "typeIdentifier", + "spelling": "SerialExecutor", + "preciseIdentifier": "s:Scf" + }, + { + "kind": "text", + "spelling": ") " + }, + { + "kind": "keyword", + "spelling": "async" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "keyword", + "spelling": "throws" + }, + { + "kind": "text", + "spelling": "(" + }, + { + "kind": "typeIdentifier", + "spelling": "E" + }, + { + "kind": "text", + "spelling": ") -> " + }, + { + "kind": "typeIdentifier", + "spelling": "T" + }, + { + "kind": "text", + "spelling": ") " + }, + { + "kind": "keyword", + "spelling": "async" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "keyword", + "spelling": "throws" + }, + { + "kind": "text", + "spelling": "(" + }, + { + "kind": "typeIdentifier", + "spelling": "E" + }, + { + "kind": "text", + "spelling": ") -> " + }, + { + "kind": "typeIdentifier", + "spelling": "T" + } + ] + }, + "docComment": { + "module": "_Concurrency", + "lines": [ + { + "text": "Perform an operation with the actor's ``SerialExecutor``." + }, + { + "text": "" + }, + { + "text": "This converts the actor's ``Actor/unownedExecutor`` to a ``SerialExecutor`` while" + }, + { + "text": "retaining the actor for the duration of the operation. This is to ensure the lifetime" + }, + { + "text": "of the executor while performing the operation." + } + ] + }, + "functionSignature": { + "parameters": [ + { + "name": "operation", + "declarationFragments": [ + { + "kind": "identifier", + "spelling": "operation" + }, + { + "kind": "text", + "spelling": ": (any " + }, + { + "kind": "typeIdentifier", + "spelling": "SerialExecutor", + "preciseIdentifier": "s:Scf" + }, + { + "kind": "text", + "spelling": ") " + }, + { + "kind": "keyword", + "spelling": "async" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "keyword", + "spelling": "throws" + }, + { + "kind": "text", + "spelling": "(" + }, + { + "kind": "typeIdentifier", + "spelling": "E" + }, + { + "kind": "text", + "spelling": ") -> " + }, + { + "kind": "typeIdentifier", + "spelling": "T" + } + ] + } + ], + "returns": [ + { + "kind": "typeIdentifier", + "spelling": "T" + } + ] + }, + "swiftGenerics": { + "parameters": [ + { + "name": "T", + "index": 0, + "depth": 1 + }, + { + "name": "E", + "index": 1, + "depth": 1 + } + ], + "constraints": [ + { + "kind": "conformance", + "lhs": "E", + "rhs": "Error", + "rhsPrecise": "s:s5ErrorP" + } + ] + }, + "swiftExtension": { + "extendedModule": "_Concurrency", + "typeKind": "swift.protocol" + }, + "declarationFragments": [ + { + "kind": "attribute", + "spelling": "nonisolated" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "keyword", + "spelling": "func" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "withSerialExecutor" + }, + { + "kind": "text", + "spelling": "<" + }, + { + "kind": "genericParameter", + "spelling": "T" + }, + { + "kind": "text", + "spelling": ", " + }, + { + "kind": "genericParameter", + "spelling": "E" + }, + { + "kind": "text", + "spelling": ">(" + }, + { + "kind": "externalParam", + "spelling": "_" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "internalParam", + "spelling": "operation" + }, + { + "kind": "text", + "spelling": ": " + }, + { + "kind": "keyword", + "spelling": "nonisolated(nonsending)" + }, + { + "kind": "text", + "spelling": " (any " + }, + { + "kind": "typeIdentifier", + "spelling": "SerialExecutor", + "preciseIdentifier": "s:Scf" + }, + { + "kind": "text", + "spelling": ") " + }, + { + "kind": "keyword", + "spelling": "async" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "keyword", + "spelling": "throws" + }, + { + "kind": "text", + "spelling": "(" + }, + { + "kind": "typeIdentifier", + "spelling": "E" + }, + { + "kind": "text", + "spelling": ") -> " + }, + { + "kind": "typeIdentifier", + "spelling": "T" + }, + { + "kind": "text", + "spelling": ") " + }, + { + "kind": "keyword", + "spelling": "async" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "keyword", + "spelling": "throws" + }, + { + "kind": "text", + "spelling": "(" + }, + { + "kind": "typeIdentifier", + "spelling": "E" + }, + { + "kind": "text", + "spelling": ") -> " + }, + { + "kind": "typeIdentifier", + "spelling": "T" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "keyword", + "spelling": "where" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "typeIdentifier", + "spelling": "E" + }, + { + "kind": "text", + "spelling": " : " + }, + { + "kind": "typeIdentifier", + "spelling": "Error", + "preciseIdentifier": "s:s5ErrorP" + }, + { + "kind": "text", + "spelling": ", " + }, + { + "kind": "typeIdentifier", + "spelling": "T" + }, + { + "kind": "text", + "spelling": " : ~Copyable" + } + ], + "accessLevel": "public", + "availability": [ + { + "domain": "macOS", + "introduced": { + "major": 10, + "minor": 15 + } + }, + { + "domain": "watchOS", + "introduced": { + "major": 6, + "minor": 0 + } + }, + { + "domain": "iOS", + "introduced": { + "major": 13, + "minor": 0 + } + }, + { + "domain": "tvOS", + "introduced": { + "major": 13, + "minor": 0 + } + } + ] + }, + { + "kind": { + "identifier": "swift.method", + "displayName": "Instance Method" + }, + "identifier": { + "precise": "s:ScA12_ConcurrencyE20preconditionIsolated_4file4lineySSyXK_s12StaticStringVSutF::SYNTHESIZED::s:9SampleLib11SimpleActorC", + "interfaceLanguage": "swift" + }, + "pathComponents": [ + "SimpleActor", + "preconditionIsolated(_:file:line:)" + ], + "names": { + "title": "preconditionIsolated(_:file:line:)", + "subHeading": [ + { + "kind": "keyword", + "spelling": "func" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "preconditionIsolated" + }, + { + "kind": "text", + "spelling": "(" + }, + { + "kind": "attribute", + "spelling": "@autoclosure " + }, + { + "kind": "text", + "spelling": "() -> " + }, + { + "kind": "typeIdentifier", + "spelling": "String", + "preciseIdentifier": "s:SS" + }, + { + "kind": "text", + "spelling": ", " + }, + { + "kind": "externalParam", + "spelling": "file" + }, + { + "kind": "text", + "spelling": ": " + }, + { + "kind": "typeIdentifier", + "spelling": "StaticString", + "preciseIdentifier": "s:s12StaticStringV" + }, + { + "kind": "text", + "spelling": ", " + }, + { + "kind": "externalParam", + "spelling": "line" + }, + { + "kind": "text", + "spelling": ": " + }, + { + "kind": "typeIdentifier", + "spelling": "UInt", + "preciseIdentifier": "s:Su" + }, + { + "kind": "text", + "spelling": ")" + } + ] + }, + "docComment": { + "module": "_Concurrency", + "lines": [ + { + "text": "Stops program execution if the current task is not executing on this" + }, + { + "text": "actor's serial executor." + }, + { + "text": "" + }, + { + "text": "This function's effect varies depending on the build flag used:" + }, + { + "text": "" + }, + { + "text": "* In playgrounds and `-Onone` builds (the default for Xcode's Debug" + }, + { + "text": " configuration), stops program execution in a debuggable state after" + }, + { + "text": " printing `message`." + }, + { + "text": "" + }, + { + "text": "* In `-O` builds (the default for Xcode's Release configuration), stops" + }, + { + "text": " program execution." + }, + { + "text": "" + }, + { + "text": "- Note: Because this check is performed against the actor's serial executor," + }, + { + "text": " if another actor uses the same serial executor--by using" + }, + { + "text": " that actor's serial executor as its own ``Actor/unownedExecutor``--this" + }, + { + "text": " check will succeed. From a concurrency safety perspective, the" + }, + { + "text": " serial executor guarantees mutual exclusion of those two actors." + }, + { + "text": "" + }, + { + "text": "- Parameters:" + }, + { + "text": " - message: The message to print if the assertion fails." + }, + { + "text": " - file: The file name to print if the assertion fails. The default is" + }, + { + "text": " where this method was called." + }, + { + "text": " - line: The line number to print if the assertion fails The default is" + }, + { + "text": " where this method was called." + } + ] + }, + "functionSignature": { + "parameters": [ + { + "name": "message", + "declarationFragments": [ + { + "kind": "identifier", + "spelling": "message" + }, + { + "kind": "text", + "spelling": ": () -> " + }, + { + "kind": "typeIdentifier", + "spelling": "String", + "preciseIdentifier": "s:SS" + } + ] + }, + { + "name": "file", + "declarationFragments": [ + { + "kind": "identifier", + "spelling": "file" + }, + { + "kind": "text", + "spelling": ": " + }, + { + "kind": "typeIdentifier", + "spelling": "StaticString", + "preciseIdentifier": "s:s12StaticStringV" + } + ] + }, + { + "name": "line", + "declarationFragments": [ + { + "kind": "identifier", + "spelling": "line" + }, + { + "kind": "text", + "spelling": ": " + }, + { + "kind": "typeIdentifier", + "spelling": "UInt", + "preciseIdentifier": "s:Su" + } + ] + } + ], + "returns": [ + { + "kind": "text", + "spelling": "()" + } + ] + }, + "swiftExtension": { + "extendedModule": "_Concurrency", + "typeKind": "swift.protocol" + }, + "declarationFragments": [ + { + "kind": "text", + "spelling": "@backDeployed(before: macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0)\n" + }, + { + "kind": "attribute", + "spelling": "nonisolated" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "keyword", + "spelling": "func" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "preconditionIsolated" + }, + { + "kind": "text", + "spelling": "(" + }, + { + "kind": "externalParam", + "spelling": "_" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "internalParam", + "spelling": "message" + }, + { + "kind": "text", + "spelling": ": " + }, + { + "kind": "attribute", + "spelling": "@autoclosure " + }, + { + "kind": "text", + "spelling": "() -> " + }, + { + "kind": "typeIdentifier", + "spelling": "String", + "preciseIdentifier": "s:SS" + }, + { + "kind": "text", + "spelling": " = String(), " + }, + { + "kind": "externalParam", + "spelling": "file" + }, + { + "kind": "text", + "spelling": ": " + }, + { + "kind": "typeIdentifier", + "spelling": "StaticString", + "preciseIdentifier": "s:s12StaticStringV" + }, + { + "kind": "text", + "spelling": " = " + }, + { + "kind": "keyword", + "spelling": "#fileID" + }, + { + "kind": "text", + "spelling": ", " + }, + { + "kind": "externalParam", + "spelling": "line" + }, + { + "kind": "text", + "spelling": ": " + }, + { + "kind": "typeIdentifier", + "spelling": "UInt", + "preciseIdentifier": "s:Su" + }, + { + "kind": "text", + "spelling": " = " + }, + { + "kind": "keyword", + "spelling": "#line" + }, + { + "kind": "text", + "spelling": ")" + } + ], + "accessLevel": "public", + "availability": [ + { + "domain": "macOS", + "introduced": { + "major": 10, + "minor": 15 + } + }, + { + "domain": "watchOS", + "introduced": { + "major": 6, + "minor": 0 + } + }, + { + "domain": "iOS", + "introduced": { + "major": 13, + "minor": 0 + } + }, + { + "domain": "tvOS", + "introduced": { + "major": 13, + "minor": 0 + } + } + ] + }, + { + "kind": { + "identifier": "swift.method", + "displayName": "Instance Method" + }, + "identifier": { + "precise": "s:ScA12_ConcurrencyE14assertIsolated_4file4lineySSyXK_s12StaticStringVSutF::SYNTHESIZED::s:9SampleLib11SimpleActorC", + "interfaceLanguage": "swift" + }, + "pathComponents": [ + "SimpleActor", + "assertIsolated(_:file:line:)" + ], + "names": { + "title": "assertIsolated(_:file:line:)", + "subHeading": [ + { + "kind": "keyword", + "spelling": "func" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "assertIsolated" + }, + { + "kind": "text", + "spelling": "(" + }, + { + "kind": "attribute", + "spelling": "@autoclosure " + }, + { + "kind": "text", + "spelling": "() -> " + }, + { + "kind": "typeIdentifier", + "spelling": "String", + "preciseIdentifier": "s:SS" + }, + { + "kind": "text", + "spelling": ", " + }, + { + "kind": "externalParam", + "spelling": "file" + }, + { + "kind": "text", + "spelling": ": " + }, + { + "kind": "typeIdentifier", + "spelling": "StaticString", + "preciseIdentifier": "s:s12StaticStringV" + }, + { + "kind": "text", + "spelling": ", " + }, + { + "kind": "externalParam", + "spelling": "line" + }, + { + "kind": "text", + "spelling": ": " + }, + { + "kind": "typeIdentifier", + "spelling": "UInt", + "preciseIdentifier": "s:Su" + }, + { + "kind": "text", + "spelling": ")" + } + ] + }, + "docComment": { + "module": "_Concurrency", + "lines": [ + { + "text": "Stops program execution if the current task is not executing on this" + }, + { + "text": "actor's serial executor." + }, + { + "text": "" + }, + { + "text": "This function's effect varies depending on the build flag used:" + }, + { + "text": "" + }, + { + "text": "* In playgrounds and `-Onone` builds (the default for Xcode's Debug" + }, + { + "text": " configuration), stops program execution in a debuggable state after" + }, + { + "text": " printing `message`." + }, + { + "text": "" + }, + { + "text": "* In `-O` builds (the default for Xcode's Release configuration)," + }, + { + "text": " the isolation check is not performed and there are no effects." + }, + { + "text": "" + }, + { + "text": "- Note: This check is performed against the actor's serial executor," + }, + { + "text": " meaning that / if another actor uses the same serial executor--by using" + }, + { + "text": " that actor's serial executor as its own ``Actor/unownedExecutor``--this" + }, + { + "text": " check will succeed , as from a concurrency safety perspective, the" + }, + { + "text": " serial executor guarantees mutual exclusion of those two actors." + }, + { + "text": "" + }, + { + "text": "- Parameters:" + }, + { + "text": " - message: The message to print if the assertion fails." + }, + { + "text": " - file: The file name to print if the assertion fails. The default is" + }, + { + "text": " where this method was called." + }, + { + "text": " - line: The line number to print if the assertion fails The default is" + }, + { + "text": " where this method was called." + } + ] + }, + "functionSignature": { + "parameters": [ + { + "name": "message", + "declarationFragments": [ + { + "kind": "identifier", + "spelling": "message" + }, + { + "kind": "text", + "spelling": ": () -> " + }, + { + "kind": "typeIdentifier", + "spelling": "String", + "preciseIdentifier": "s:SS" + } + ] + }, + { + "name": "file", + "declarationFragments": [ + { + "kind": "identifier", + "spelling": "file" + }, + { + "kind": "text", + "spelling": ": " + }, + { + "kind": "typeIdentifier", + "spelling": "StaticString", + "preciseIdentifier": "s:s12StaticStringV" + } + ] + }, + { + "name": "line", + "declarationFragments": [ + { + "kind": "identifier", + "spelling": "line" + }, + { + "kind": "text", + "spelling": ": " + }, + { + "kind": "typeIdentifier", + "spelling": "UInt", + "preciseIdentifier": "s:Su" + } + ] + } + ], + "returns": [ + { + "kind": "text", + "spelling": "()" + } + ] + }, + "swiftExtension": { + "extendedModule": "_Concurrency", + "typeKind": "swift.protocol" + }, + "declarationFragments": [ + { + "kind": "text", + "spelling": "@backDeployed(before: macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0)\n" + }, + { + "kind": "attribute", + "spelling": "nonisolated" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "keyword", + "spelling": "func" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "assertIsolated" + }, + { + "kind": "text", + "spelling": "(" + }, + { + "kind": "externalParam", + "spelling": "_" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "internalParam", + "spelling": "message" + }, + { + "kind": "text", + "spelling": ": " + }, + { + "kind": "attribute", + "spelling": "@autoclosure " + }, + { + "kind": "text", + "spelling": "() -> " + }, + { + "kind": "typeIdentifier", + "spelling": "String", + "preciseIdentifier": "s:SS" + }, + { + "kind": "text", + "spelling": " = String(), " + }, + { + "kind": "externalParam", + "spelling": "file" + }, + { + "kind": "text", + "spelling": ": " + }, + { + "kind": "typeIdentifier", + "spelling": "StaticString", + "preciseIdentifier": "s:s12StaticStringV" + }, + { + "kind": "text", + "spelling": " = " + }, + { + "kind": "keyword", + "spelling": "#fileID" + }, + { + "kind": "text", + "spelling": ", " + }, + { + "kind": "externalParam", + "spelling": "line" + }, + { + "kind": "text", + "spelling": ": " + }, + { + "kind": "typeIdentifier", + "spelling": "UInt", + "preciseIdentifier": "s:Su" + }, + { + "kind": "text", + "spelling": " = " + }, + { + "kind": "keyword", + "spelling": "#line" + }, + { + "kind": "text", + "spelling": ")" + } + ], + "accessLevel": "public", + "availability": [ + { + "domain": "macOS", + "introduced": { + "major": 10, + "minor": 15 + } + }, + { + "domain": "watchOS", + "introduced": { + "major": 6, + "minor": 0 + } + }, + { + "domain": "iOS", + "introduced": { + "major": 13, + "minor": 0 + } + }, + { + "domain": "tvOS", + "introduced": { + "major": 13, + "minor": 0 + } + } + ] + }, + { + "kind": { + "identifier": "swift.method", + "displayName": "Instance Method" + }, + "identifier": { + "precise": "s:ScA12_ConcurrencyE14assumeIsolated_4file4lineqd__qd__xYiKXE_s12StaticStringVSutKs8SendableRd__lF::SYNTHESIZED::s:9SampleLib11SimpleActorC", + "interfaceLanguage": "swift" + }, + "pathComponents": [ + "SimpleActor", + "assumeIsolated(_:file:line:)" + ], + "names": { + "title": "assumeIsolated(_:file:line:)", + "subHeading": [ + { + "kind": "keyword", + "spelling": "func" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "assumeIsolated" + }, + { + "kind": "text", + "spelling": "<" + }, + { + "kind": "genericParameter", + "spelling": "T" + }, + { + "kind": "text", + "spelling": ">((" + }, + { + "kind": "keyword", + "spelling": "isolated" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "typeIdentifier", + "spelling": "Self" + }, + { + "kind": "text", + "spelling": ") " + }, + { + "kind": "keyword", + "spelling": "throws" + }, + { + "kind": "text", + "spelling": " -> " + }, + { + "kind": "typeIdentifier", + "spelling": "T" + }, + { + "kind": "text", + "spelling": ", " + }, + { + "kind": "externalParam", + "spelling": "file" + }, + { + "kind": "text", + "spelling": ": " + }, + { + "kind": "typeIdentifier", + "spelling": "StaticString", + "preciseIdentifier": "s:s12StaticStringV" + }, + { + "kind": "text", + "spelling": ", " + }, + { + "kind": "externalParam", + "spelling": "line" + }, + { + "kind": "text", + "spelling": ": " + }, + { + "kind": "typeIdentifier", + "spelling": "UInt", + "preciseIdentifier": "s:Su" + }, + { + "kind": "text", + "spelling": ") " + }, + { + "kind": "keyword", + "spelling": "rethrows" + }, + { + "kind": "text", + "spelling": " -> " + }, + { + "kind": "typeIdentifier", + "spelling": "T" + } + ] + }, + "docComment": { + "module": "_Concurrency", + "lines": [ + { + "text": "Assume that the current task is executing on this actor's serial executor," + }, + { + "text": "or stop program execution otherwise." + }, + { + "text": "" + }, + { + "text": "You call this method to *assume and verify* that the currently" + }, + { + "text": "executing synchronous function is actually executing on the serial" + }, + { + "text": "executor of this actor." + }, + { + "text": "" + }, + { + "text": "If that is the case, the operation is invoked with an `isolated` version" + }, + { + "text": "of the actor, allowing synchronous access to actor local state without" + }, + { + "text": "hopping through asynchronous boundaries." + }, + { + "text": "" + }, + { + "text": "If the current context is not running on the actor's serial executor, or" + }, + { + "text": "if the actor is a reference to a remote actor, this method will crash" + }, + { + "text": "with a fatal error (similar to ``preconditionIsolated()``)." + }, + { + "text": "" + }, + { + "text": "Note that this check is performed against the passed in actor's serial" + }, + { + "text": "executor, meaning that if another actor uses the same serial executor--by" + }, + { + "text": "using that actor's ``Actor/unownedExecutor`` as its own" + }, + { + "text": "``Actor/unownedExecutor``--this check will succeed, as from a concurrency" + }, + { + "text": "safety perspective, the serial executor guarantees mutual exclusion of" + }, + { + "text": "those two actors." + }, + { + "text": "" + }, + { + "text": "This method can only be used from synchronous functions, as asynchronous" + }, + { + "text": "functions should instead perform a normal method call to the actor, which" + }, + { + "text": "will hop task execution to the target actor if necessary." + }, + { + "text": "" + }, + { + "text": "- Note: This check is performed against the actor's serial executor," + }, + { + "text": " meaning that / if another actor uses the same serial executor--by using" + }, + { + "text": " another actor's executor as its own ``Actor/unownedExecutor``" + }, + { + "text": " --this check will succeed , as from a concurrency safety perspective," + }, + { + "text": " the serial executor guarantees mutual exclusion of those two actors." + }, + { + "text": "" + }, + { + "text": "- Parameters:" + }, + { + "text": " - operation: the operation that will be executed if the current context" + }, + { + "text": " is executing on the actors serial executor." + }, + { + "text": " - file: The file name to print if the assertion fails. The default is" + }, + { + "text": " where this method was called." + }, + { + "text": " - line: The line number to print if the assertion fails The default is" + }, + { + "text": " where this method was called." + }, + { + "text": "- Returns: the return value of the `operation`" + }, + { + "text": "- Throws: rethrows the `Error` thrown by the operation if it threw" + } + ] + }, + "functionSignature": { + "parameters": [ + { + "name": "operation", + "declarationFragments": [ + { + "kind": "identifier", + "spelling": "operation" + }, + { + "kind": "text", + "spelling": ": (" + }, + { + "kind": "keyword", + "spelling": "isolated" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "typeIdentifier", + "spelling": "Self" + }, + { + "kind": "text", + "spelling": ") " + }, + { + "kind": "keyword", + "spelling": "throws" + }, + { + "kind": "text", + "spelling": " -> " + }, + { + "kind": "typeIdentifier", + "spelling": "T" + } + ] + }, + { + "name": "file", + "declarationFragments": [ + { + "kind": "identifier", + "spelling": "file" + }, + { + "kind": "text", + "spelling": ": " + }, + { + "kind": "typeIdentifier", + "spelling": "StaticString", + "preciseIdentifier": "s:s12StaticStringV" + } + ] + }, + { + "name": "line", + "declarationFragments": [ + { + "kind": "identifier", + "spelling": "line" + }, + { + "kind": "text", + "spelling": ": " + }, + { + "kind": "typeIdentifier", + "spelling": "UInt", + "preciseIdentifier": "s:Su" + } + ] + } + ], + "returns": [ + { + "kind": "typeIdentifier", + "spelling": "T" + } + ] + }, + "swiftGenerics": { + "parameters": [ + { + "name": "T", + "index": 0, + "depth": 1 + } + ], + "constraints": [ + { + "kind": "conformance", + "lhs": "T", + "rhs": "Sendable", + "rhsPrecise": "s:s8SendableP" + } + ] + }, + "swiftExtension": { + "extendedModule": "_Concurrency", + "typeKind": "swift.protocol" + }, + "declarationFragments": [ + { + "kind": "attribute", + "spelling": "nonisolated" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "keyword", + "spelling": "func" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "assumeIsolated" + }, + { + "kind": "text", + "spelling": "<" + }, + { + "kind": "genericParameter", + "spelling": "T" + }, + { + "kind": "text", + "spelling": ">(" + }, + { + "kind": "externalParam", + "spelling": "_" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "internalParam", + "spelling": "operation" + }, + { + "kind": "text", + "spelling": ": (" + }, + { + "kind": "keyword", + "spelling": "isolated" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "typeIdentifier", + "spelling": "Self" + }, + { + "kind": "text", + "spelling": ") " + }, + { + "kind": "keyword", + "spelling": "throws" + }, + { + "kind": "text", + "spelling": " -> " + }, + { + "kind": "typeIdentifier", + "spelling": "T" + }, + { + "kind": "text", + "spelling": ", " + }, + { + "kind": "externalParam", + "spelling": "file" + }, + { + "kind": "text", + "spelling": ": " + }, + { + "kind": "typeIdentifier", + "spelling": "StaticString", + "preciseIdentifier": "s:s12StaticStringV" + }, + { + "kind": "text", + "spelling": " = " + }, + { + "kind": "keyword", + "spelling": "#fileID" + }, + { + "kind": "text", + "spelling": ", " + }, + { + "kind": "externalParam", + "spelling": "line" + }, + { + "kind": "text", + "spelling": ": " + }, + { + "kind": "typeIdentifier", + "spelling": "UInt", + "preciseIdentifier": "s:Su" + }, + { + "kind": "text", + "spelling": " = " + }, + { + "kind": "keyword", + "spelling": "#line" + }, + { + "kind": "text", + "spelling": ") " + }, + { + "kind": "keyword", + "spelling": "rethrows" + }, + { + "kind": "text", + "spelling": " -> " + }, + { + "kind": "typeIdentifier", + "spelling": "T" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "keyword", + "spelling": "where" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "typeIdentifier", + "spelling": "T" + }, + { + "kind": "text", + "spelling": " : " + }, + { + "kind": "typeIdentifier", + "spelling": "Sendable", + "preciseIdentifier": "s:s8SendableP" + } + ], + "accessLevel": "public", + "availability": [ + { + "domain": "macOS", + "introduced": { + "major": 10, + "minor": 15 + } + }, + { + "domain": "watchOS", + "introduced": { + "major": 6, + "minor": 0 + } + }, + { + "domain": "iOS", + "introduced": { + "major": 13, + "minor": 0 + } + }, + { + "domain": "tvOS", + "introduced": { + "major": 13, + "minor": 0 + } + } + ] + }, + { + "kind": { + "identifier": "swift.method", + "displayName": "Instance Method" + }, + "identifier": { + "precise": "s:9SampleLib11SimpleActorC11actorMethodyyF", + "interfaceLanguage": "swift" + }, + "pathComponents": [ + "SimpleActor", + "actorMethod()" + ], + "names": { + "title": "actorMethod()", + "subHeading": [ + { + "kind": "keyword", + "spelling": "func" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "actorMethod" + }, + { + "kind": "text", + "spelling": "()" + } + ] + }, + "functionSignature": { + "returns": [ + { + "kind": "text", + "spelling": "()" + } + ] + }, + "declarationFragments": [ + { + "kind": "keyword", + "spelling": "func" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "actorMethod" + }, + { + "kind": "text", + "spelling": "()" + } + ], + "accessLevel": "public", + "location": { + "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", + "position": { + "line": 30, + "character": 16 + } + } + }, + { + "kind": { + "identifier": "swift.typealias", + "displayName": "Type Alias" + }, + "identifier": { + "precise": "s:9SampleLib11GlobalAliasa", + "interfaceLanguage": "swift" + }, + "pathComponents": [ + "GlobalAlias" + ], + "names": { + "title": "GlobalAlias", + "navigator": [ + { + "kind": "identifier", + "spelling": "GlobalAlias" + } + ], + "subHeading": [ + { + "kind": "keyword", + "spelling": "typealias" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "GlobalAlias" + } + ] + }, + "declarationFragments": [ + { + "kind": "keyword", + "spelling": "typealias" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "GlobalAlias" + }, + { + "kind": "text", + "spelling": " = " + }, + { + "kind": "typeIdentifier", + "spelling": "String", + "preciseIdentifier": "s:SS" + } + ], + "accessLevel": "public", + "location": { + "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", + "position": { + "line": 32, + "character": 17 + } + } + }, + { + "kind": { + "identifier": "swift.func", + "displayName": "Function" + }, + "identifier": { + "precise": "s:9SampleLib14globalFunctionyyF", + "interfaceLanguage": "swift" + }, + "pathComponents": [ + "globalFunction()" + ], + "names": { + "title": "globalFunction()", + "subHeading": [ + { + "kind": "keyword", + "spelling": "func" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "globalFunction" + }, + { + "kind": "text", + "spelling": "()" + } + ] + }, + "functionSignature": { + "returns": [ + { + "kind": "text", + "spelling": "()" + } + ] + }, + "declarationFragments": [ + { + "kind": "keyword", + "spelling": "func" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "globalFunction" + }, + { + "kind": "text", + "spelling": "()" + } + ], + "accessLevel": "public", + "location": { + "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", + "position": { + "line": 33, + "character": 12 + } + } + } +] From 31cd77cb727e20506c4cf573d70abf5a043f030c Mon Sep 17 00:00:00 2001 From: Guilherme Souza Date: Fri, 19 Jun 2026 11:14:19 -0300 Subject: [PATCH 03/14] feat(parsers): implement normalize-symbolgraph with full test coverage --- .../src/normalize-symbolgraph.ts | 34 ++- .../test/normalize-symbolgraph.test.ts | 243 ++++++++++++++++++ 2 files changed, 275 insertions(+), 2 deletions(-) create mode 100644 scripts/capability-matrix/test/normalize-symbolgraph.test.ts diff --git a/scripts/capability-matrix/src/normalize-symbolgraph.ts b/scripts/capability-matrix/src/normalize-symbolgraph.ts index 01d9b21..e9e4f15 100644 --- a/scripts/capability-matrix/src/normalize-symbolgraph.ts +++ b/scripts/capability-matrix/src/normalize-symbolgraph.ts @@ -36,6 +36,36 @@ export function normalizeSymbolGraph( symbols: SymbolGraphSymbol[], sdkRoot: string, ): ParseResult { - // TODO: implement in Task 2 - return { symbols: [] }; + const result: ParsedSymbol[] = []; + + for (const sym of symbols) { + if (sym.accessLevel !== "public" && sym.accessLevel !== "open") continue; + + const kind = KIND_MAP[sym.kind.identifier]; + if (kind === undefined) continue; + + result.push({ + name: qualifiedName(sym.pathComponents), + kind, + file: resolveFile(sym.location?.uri, sdkRoot), + }); + } + + return { symbols: result }; +} + +function qualifiedName(pathComponents: string[]): string { + if (pathComponents.length === 0) return ""; + const parts = pathComponents.map((part, i) => { + if (i < pathComponents.length - 1) return part; + const parenIdx = part.indexOf("("); + return parenIdx >= 0 ? part.slice(0, parenIdx) : part; + }); + return parts.join("."); +} + +function resolveFile(uri: string | undefined, sdkRoot: string): string { + if (!uri) return ""; + const path = uri.startsWith("file://") ? uri.slice(7) : uri; + return sdkRoot ? relative(sdkRoot, path) : path; } diff --git a/scripts/capability-matrix/test/normalize-symbolgraph.test.ts b/scripts/capability-matrix/test/normalize-symbolgraph.test.ts new file mode 100644 index 0000000..df6ec2b --- /dev/null +++ b/scripts/capability-matrix/test/normalize-symbolgraph.test.ts @@ -0,0 +1,243 @@ +import { describe, it, expect } from "vitest"; +import { readFileSync } from "node:fs"; +import { join, dirname } from "node:path"; +import { fileURLToPath } from "node:url"; +import { normalizeSymbolGraph, type SymbolGraphSymbol } from "../src/normalize-symbolgraph.js"; + +const __dirname = dirname(fileURLToPath(import.meta.url)); + +// Helper to build a minimal SymbolGraphSymbol for inline tests. +function sym( + identifier: string, + accessLevel: string, + pathComponents: string[], + uri?: string, +): SymbolGraphSymbol { + return { + kind: { identifier }, + accessLevel, + pathComponents, + ...(uri ? { location: { uri } } : {}), + }; +} + +// --------------------------------------------------------------------------- +// Kind mapping +// --------------------------------------------------------------------------- + +describe("kind mapping — types", () => { + it("maps swift.class to 'class'", () => { + const { symbols } = normalizeSymbolGraph([sym("swift.class", "public", ["MyClass"])], ""); + expect(symbols[0]).toMatchObject({ name: "MyClass", kind: "class" }); + }); + it("maps swift.struct to 'class'", () => { + const { symbols } = normalizeSymbolGraph([sym("swift.struct", "public", ["MyStruct"])], ""); + expect(symbols[0]).toMatchObject({ name: "MyStruct", kind: "class" }); + }); + it("maps swift.enum to 'class'", () => { + const { symbols } = normalizeSymbolGraph([sym("swift.enum", "public", ["MyEnum"])], ""); + expect(symbols[0]).toMatchObject({ name: "MyEnum", kind: "class" }); + }); + it("maps swift.protocol to 'class'", () => { + const { symbols } = normalizeSymbolGraph([sym("swift.protocol", "public", ["MyProto"])], ""); + expect(symbols[0]).toMatchObject({ name: "MyProto", kind: "class" }); + }); + it("maps swift.actor to 'class'", () => { + const { symbols } = normalizeSymbolGraph([sym("swift.actor", "public", ["MyActor"])], ""); + expect(symbols[0]).toMatchObject({ name: "MyActor", kind: "class" }); + }); +}); + +describe("kind mapping — callables", () => { + it("maps swift.func (top-level) to 'function'", () => { + const { symbols } = normalizeSymbolGraph([sym("swift.func", "public", ["globalFn()"])], ""); + expect(symbols[0]).toMatchObject({ name: "globalFn", kind: "function" }); + }); + it("maps swift.func.op to 'function'", () => { + const { symbols } = normalizeSymbolGraph([sym("swift.func.op", "public", ["==(_:_:)"])], ""); + expect(symbols[0]).toMatchObject({ name: "==", kind: "function" }); + }); + it("maps swift.method to 'method'", () => { + const { symbols } = normalizeSymbolGraph([sym("swift.method", "public", ["MyClass", "doThing()"])], ""); + expect(symbols[0]).toMatchObject({ name: "MyClass.doThing", kind: "method" }); + }); + it("maps swift.type.method (static) to 'method'", () => { + const { symbols } = normalizeSymbolGraph([sym("swift.type.method", "public", ["MyClass", "create()"])], ""); + expect(symbols[0]).toMatchObject({ name: "MyClass.create", kind: "method" }); + }); + it("maps swift.init to 'method' and strips signature", () => { + const { symbols } = normalizeSymbolGraph([sym("swift.init", "public", ["MyClass", "init(url:key:)"])], ""); + expect(symbols[0]).toMatchObject({ name: "MyClass.init", kind: "method" }); + }); + it("maps swift.subscript to 'method'", () => { + const { symbols } = normalizeSymbolGraph([sym("swift.subscript", "public", ["MyClass", "subscript(_:)"])], ""); + expect(symbols[0]).toMatchObject({ name: "MyClass.subscript", kind: "method" }); + }); +}); + +describe("kind mapping — properties and variables", () => { + it("maps swift.property to 'property'", () => { + const { symbols } = normalizeSymbolGraph([sym("swift.property", "public", ["MyClass", "value"])], ""); + expect(symbols[0]).toMatchObject({ name: "MyClass.value", kind: "property" }); + }); + it("maps swift.type.property (static) to 'property'", () => { + const { symbols } = normalizeSymbolGraph([sym("swift.type.property", "public", ["MyClass", "shared"])], ""); + expect(symbols[0]).toMatchObject({ name: "MyClass.shared", kind: "property" }); + }); + it("maps swift.enum.case to 'property'", () => { + const { symbols } = normalizeSymbolGraph([sym("swift.enum.case", "public", ["MyEnum", "alpha"])], ""); + expect(symbols[0]).toMatchObject({ name: "MyEnum.alpha", kind: "property" }); + }); + it("maps swift.typealias to 'variable'", () => { + const { symbols } = normalizeSymbolGraph([sym("swift.typealias", "public", ["MyClass", "Callback"])], ""); + expect(symbols[0]).toMatchObject({ name: "MyClass.Callback", kind: "variable" }); + }); + it("maps swift.associatedtype to 'variable'", () => { + const { symbols } = normalizeSymbolGraph([sym("swift.associatedtype", "public", ["MyProto", "Item"])], ""); + expect(symbols[0]).toMatchObject({ name: "MyProto.Item", kind: "variable" }); + }); + it("maps swift.var (global) to 'variable'", () => { + const { symbols } = normalizeSymbolGraph([sym("swift.var", "public", ["globalVar"])], ""); + expect(symbols[0]).toMatchObject({ name: "globalVar", kind: "variable" }); + }); +}); + +// --------------------------------------------------------------------------- +// Access level filter +// --------------------------------------------------------------------------- + +describe("access level filter", () => { + it("includes public symbols", () => { + const { symbols } = normalizeSymbolGraph([sym("swift.class", "public", ["PubClass"])], ""); + expect(symbols).toHaveLength(1); + }); + it("includes open symbols", () => { + const { symbols } = normalizeSymbolGraph([sym("swift.class", "open", ["OpenClass"])], ""); + expect(symbols).toHaveLength(1); + }); + it("excludes internal symbols", () => { + const { symbols } = normalizeSymbolGraph([sym("swift.class", "internal", ["InternalClass"])], ""); + expect(symbols).toHaveLength(0); + }); + it("excludes private symbols", () => { + const { symbols } = normalizeSymbolGraph([sym("swift.method", "private", ["MyClass", "secret()"])], ""); + expect(symbols).toHaveLength(0); + }); +}); + +// --------------------------------------------------------------------------- +// Skipped kinds +// --------------------------------------------------------------------------- + +describe("skipped kinds", () => { + it("skips swift.deinit", () => { + const { symbols } = normalizeSymbolGraph([sym("swift.deinit", "public", ["MyClass", "deinit"])], ""); + expect(symbols).toHaveLength(0); + }); + it("skips unrecognised kind identifiers", () => { + const { symbols } = normalizeSymbolGraph([sym("swift.unknown.thing", "public", ["Something"])], ""); + expect(symbols).toHaveLength(0); + }); +}); + +// --------------------------------------------------------------------------- +// Name construction +// --------------------------------------------------------------------------- + +describe("name construction", () => { + it("joins pathComponents with '.'", () => { + const { symbols } = normalizeSymbolGraph( + [sym("swift.method", "public", ["SupabaseClient", "signIn(email:password:)"])], "" + ); + expect(symbols[0].name).toBe("SupabaseClient.signIn"); + }); + it("handles deeply nested types", () => { + const { symbols } = normalizeSymbolGraph( + [sym("swift.property", "public", ["Outer", "Inner", "value"])], "" + ); + expect(symbols[0].name).toBe("Outer.Inner.value"); + }); + it("strips trailing function signature from last pathComponent", () => { + const { symbols } = normalizeSymbolGraph( + [sym("swift.method", "public", ["Auth", "signUp(email:password:captchaToken:)"])], "" + ); + expect(symbols[0].name).toBe("Auth.signUp"); + }); + it("leaves non-function pathComponents unchanged", () => { + const { symbols } = normalizeSymbolGraph( + [sym("swift.property", "public", ["Auth", "session"])], "" + ); + expect(symbols[0].name).toBe("Auth.session"); + }); +}); + +// --------------------------------------------------------------------------- +// File path resolution +// --------------------------------------------------------------------------- + +describe("file path resolution", () => { + it("strips 'file://' prefix and makes path relative to sdkRoot", () => { + const sdkRoot = "/home/runner/work/supabase-swift"; + const uri = `file://${sdkRoot}/Sources/Auth/AuthClient.swift`; + const { symbols } = normalizeSymbolGraph([sym("swift.class", "public", ["Auth"], uri)], sdkRoot); + expect(symbols[0].file).toBe("Sources/Auth/AuthClient.swift"); + }); + it("returns empty string when location is absent", () => { + const { symbols } = normalizeSymbolGraph([sym("swift.class", "public", ["Auth"])], "/any/root"); + expect(symbols[0].file).toBe(""); + }); +}); + +// --------------------------------------------------------------------------- +// Multi-input +// --------------------------------------------------------------------------- + +describe("multi-symbol input", () => { + it("handles symbols from multiple modules in merged flat array", () => { + const input: SymbolGraphSymbol[] = [ + sym("swift.class", "public", ["ClassFromAuth"]), + sym("swift.struct", "public", ["StructFromStorage"]), + ]; + const { symbols } = normalizeSymbolGraph(input, ""); + const names = symbols.map(s => s.name); + expect(names).toContain("ClassFromAuth"); + expect(names).toContain("StructFromStorage"); + }); +}); + +// --------------------------------------------------------------------------- +// Smoke test against real fixture +// --------------------------------------------------------------------------- + +describe("real fixture smoke test", () => { + const fixture = JSON.parse( + readFileSync(join(__dirname, "fixtures/symbolgraph-sample.json"), "utf8") + ) as SymbolGraphSymbol[]; + + const { symbols } = normalizeSymbolGraph(fixture, "/sdk-root"); + + it("produces a non-empty symbol list", () => { + expect(symbols.length).toBeGreaterThan(10); + }); + it("includes SimpleClass from fixture", () => { + expect(symbols.map(s => s.name)).toContain("SimpleClass"); + }); + it("includes SimpleClass.instanceMethod from fixture", () => { + expect(symbols.map(s => s.name)).toContain("SimpleClass.instanceMethod"); + }); + it("includes SimpleEnum.alpha (enum case) from fixture", () => { + expect(symbols.map(s => s.name)).toContain("SimpleEnum.alpha"); + }); + it("includes OpenClass from fixture (open access level)", () => { + expect(symbols.map(s => s.name)).toContain("OpenClass"); + }); + it("excludes InternalClass from fixture", () => { + expect(symbols.map(s => s.name)).not.toContain("InternalClass"); + }); + it("includes globalFunction from fixture", () => { + expect(symbols.map(s => s.name)).toContain("globalFunction"); + }); + it("includes SimpleClass.NestedStruct (nested type) from fixture", () => { + expect(symbols.map(s => s.name)).toContain("SimpleClass.NestedStruct"); + }); +}); From c2de09d3910835046b0f810acb5586a5e9593d24 Mon Sep 17 00:00:00 2001 From: Guilherme Souza Date: Fri, 19 Jun 2026 11:18:12 -0300 Subject: [PATCH 04/14] feat(parsers): add normalize-symbolgraph CLI entry point --- .../src/normalize-symbolgraph-cli.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 scripts/capability-matrix/src/normalize-symbolgraph-cli.ts diff --git a/scripts/capability-matrix/src/normalize-symbolgraph-cli.ts b/scripts/capability-matrix/src/normalize-symbolgraph-cli.ts new file mode 100644 index 0000000..26d7c6c --- /dev/null +++ b/scripts/capability-matrix/src/normalize-symbolgraph-cli.ts @@ -0,0 +1,18 @@ +import { readFileSync } from "node:fs"; +import { resolve } from "node:path"; +import { normalizeSymbolGraph, type SymbolGraphSymbol } from "./normalize-symbolgraph.js"; + +async function main(): Promise { + const [,, rawPath, sdkRootArg] = process.argv; + if (!rawPath) { + console.error("Usage: normalize-symbolgraph [sdk-root]"); + process.exit(1); + } + + const sdkRoot = sdkRootArg ? resolve(sdkRootArg) : ""; + const symbols = JSON.parse(readFileSync(rawPath, "utf8")) as SymbolGraphSymbol[]; + const result = normalizeSymbolGraph(symbols, sdkRoot); + console.log(JSON.stringify(result, null, 2)); +} + +main().catch((e) => { console.error(e); process.exit(1); }); From 02f1f211ae9c001111810363f52ee7baa926c0ee Mon Sep 17 00:00:00 2001 From: Guilherme Souza Date: Fri, 19 Jun 2026 11:20:20 -0300 Subject: [PATCH 05/14] refactor(parsers): remove regex-based swift-parser in favour of normalize-symbolgraph --- scripts/capability-matrix/src/parse-swift.ts | 19 -- scripts/capability-matrix/src/swift-parser.ts | 171 --------------- .../test/swift-parser.test.ts | 202 ------------------ 3 files changed, 392 deletions(-) delete mode 100644 scripts/capability-matrix/src/parse-swift.ts delete mode 100644 scripts/capability-matrix/src/swift-parser.ts delete mode 100644 scripts/capability-matrix/test/swift-parser.test.ts diff --git a/scripts/capability-matrix/src/parse-swift.ts b/scripts/capability-matrix/src/parse-swift.ts deleted file mode 100644 index fcd6e11..0000000 --- a/scripts/capability-matrix/src/parse-swift.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { parseSwiftProject } from "./swift-parser.js"; - -async function main(): Promise { - const projectPath = process.argv[2]; - if (!projectPath) { - console.error("Usage: parse-swift "); - process.exit(1); - } - - try { - const result = parseSwiftProject(projectPath); - console.log(JSON.stringify(result, null, 2)); - } catch (e) { - console.error(`Error: ${(e as Error).message}`); - process.exit(1); - } -} - -main().catch((e) => { console.error(e); process.exit(1); }); diff --git a/scripts/capability-matrix/src/swift-parser.ts b/scripts/capability-matrix/src/swift-parser.ts deleted file mode 100644 index 3a193ef..0000000 --- a/scripts/capability-matrix/src/swift-parser.ts +++ /dev/null @@ -1,171 +0,0 @@ -import { readFileSync, readdirSync, existsSync } from "node:fs"; -import { join, resolve, relative } from "node:path"; -import type { ParsedSymbol, ParseResult } from "./ts-parser.js"; -import { loadIgnore, type Ignore } from "./parse-ignore.js"; - -export type { ParsedSymbol, ParseResult }; - -// --------------------------------------------------------------------------- -// Internal helpers -// --------------------------------------------------------------------------- - -function findSwiftFiles(dir: string, root: string, ig: Ignore): string[] { - const results: string[] = []; - try { - for (const entry of readdirSync(dir, { withFileTypes: true })) { - if (entry.name.startsWith(".")) continue; - const full = join(dir, entry.name); - const rel = relative(root, full); - if (entry.isDirectory()) { - if (ig.ignores(rel + "/")) continue; - results.push(...findSwiftFiles(full, root, ig)); - } else if (entry.isFile() && entry.name.endsWith(".swift")) { - if (ig.ignores(rel)) continue; - results.push(full); - } - } - } catch { /* ignore unreadable dirs */ } - return results; -} - -// --------------------------------------------------------------------------- -// Single-file parser -// --------------------------------------------------------------------------- - -interface Context { - name: string; // possibly dotted: "AuthClient.Configuration" - depth: number; // brace depth after entering this context -} - -// Access modifiers that indicate a symbol is public API -const ACCESS_PATTERN = /\b(?:public|open)\b/; -// Declaration keywords for types -const TYPE_KW = /\b(class|struct|enum|actor|protocol)\b/; -// Declaration keyword for extensions -const EXT_KW = /\bextension\b/; - -export function extractFromSource(source: string, relPath: string): ParsedSymbol[] { - const symbols: ParsedSymbol[] = []; - const contextStack: Context[] = []; - let depth = 0; - - for (const rawLine of source.split("\n")) { - // Strip line comments (// and ///) – handles the most common case - const commentIdx = rawLine.indexOf("//"); - const line = commentIdx >= 0 ? rawLine.slice(0, commentIdx) : rawLine; - const trimmed = line.trim(); - - if (!trimmed) continue; - // Preprocessor directives don't affect declarations - if (trimmed.startsWith("#")) continue; - - const opens = countChar(line, "{"); - const closes = countChar(line, "}"); - const isPublic = ACCESS_PATTERN.test(trimmed); - const isTypeDecl = isPublic && TYPE_KW.test(trimmed); - const isExtDecl = EXT_KW.test(trimmed); - - const currentType = - contextStack.length > 0 ? contextStack[contextStack.length - 1].name : ""; - - // --- Emit symbols for declarations on this line --- - - if (isTypeDecl) { - const m = trimmed.match(/\b(class|struct|enum|actor|protocol)\b\s+(\w+)/); - if (m) { - const typeName = m[2]; - const qualifiedName = currentType ? `${currentType}.${typeName}` : typeName; - symbols.push({ name: qualifiedName, kind: "class", file: relPath }); - } - } else if (isPublic && currentType) { - // Inside a type context: emit public members - const funcM = trimmed.match(/\bfunc\b\s+(\w+)/); - const varM = !funcM && trimmed.match(/\b(?:var|let)\b\s+(\w+)/); - const typealiasM = !funcM && !varM && trimmed.match(/\btypealias\b\s+(\w+)/); - const isInit = !funcM && !varM && !typealiasM && /\binit\b/.test(trimmed); - - if (funcM) { - symbols.push({ name: `${currentType}.${funcM[1]}`, kind: "method", file: relPath }); - } else if (varM) { - symbols.push({ name: `${currentType}.${varM[1]}`, kind: "property", file: relPath }); - } else if (typealiasM) { - symbols.push({ name: `${currentType}.${typealiasM[1]}`, kind: "variable", file: relPath }); - } else if (isInit) { - symbols.push({ name: `${currentType}.init`, kind: "method", file: relPath }); - } - } else if (isPublic && !currentType) { - // Top-level public declarations - const funcM = trimmed.match(/\bfunc\b\s+(\w+)/); - const typealiasM = !funcM && trimmed.match(/\btypealias\b\s+(\w+)/); - if (funcM) { - symbols.push({ name: funcM[1], kind: "function", file: relPath }); - } else if (typealiasM) { - symbols.push({ name: typealiasM[1], kind: "variable", file: relPath }); - } - } - - // --- Update depth --- - depth += opens - closes; - - // Pop contexts that ended when closes brought depth below their enter depth - while ( - contextStack.length > 0 && - contextStack[contextStack.length - 1].depth > depth - ) { - contextStack.pop(); - } - - // Push new context if this line opens a type or extension body - if (opens > closes) { - if (isTypeDecl) { - const m = trimmed.match(/\b(class|struct|enum|actor|protocol)\b\s+(\w+)/); - if (m) { - const typeName = m[2]; - const qualifiedName = currentType ? `${currentType}.${typeName}` : typeName; - contextStack.push({ name: qualifiedName, depth }); - } - } else if (isExtDecl) { - // Extensions can extend dotted names: "extension AuthClient.Configuration" - const m = trimmed.match(/\bextension\b\s+([\w.]+)/); - if (m) contextStack.push({ name: m[1], depth }); - } - } - } - - return symbols; -} - -// --------------------------------------------------------------------------- -// Project-level entry point -// --------------------------------------------------------------------------- - -export function parseSwiftProject(projectRoot: string): ParseResult { - const root = resolve(projectRoot); - const ig = loadIgnore(root); - // SPM convention: Sources/ holds all public library targets - const srcDir = join(root, "Sources"); - const scanRoot = existsSync(srcDir) ? srcDir : root; - - const files = findSwiftFiles(scanRoot, root, ig); - const symbols: ParsedSymbol[] = []; - - for (const file of files) { - const source = readFileSync(file, "utf8"); - const relPath = relative(root, file); - symbols.push(...extractFromSource(source, relPath)); - } - - return { symbols }; -} - -// --------------------------------------------------------------------------- -// Utility -// --------------------------------------------------------------------------- - -function countChar(s: string, ch: string): number { - let count = 0; - for (let i = 0; i < s.length; i++) { - if (s[i] === ch) count++; - } - return count; -} diff --git a/scripts/capability-matrix/test/swift-parser.test.ts b/scripts/capability-matrix/test/swift-parser.test.ts deleted file mode 100644 index 666449f..0000000 --- a/scripts/capability-matrix/test/swift-parser.test.ts +++ /dev/null @@ -1,202 +0,0 @@ -import { describe, it, expect } from "vitest"; -import { join } from "node:path"; -import { tmpdir } from "node:os"; -import { writeFileSync, mkdirSync } from "node:fs"; -import { extractFromSource, parseSwiftProject } from "../src/swift-parser"; - -function names(src: string): string[] { - return extractFromSource(src, "src/Foo.swift").map((s) => s.name); -} - -describe("extractFromSource — type declarations", () => { - it("extracts a public class", () => { - expect(names("public class AuthClient {\n}")).toContain("AuthClient"); - }); - - it("extracts a public final class", () => { - expect(names("public final class SupabaseClient {\n}")).toContain("SupabaseClient"); - }); - - it("extracts a public struct", () => { - expect(names("public struct Session {\n}")).toContain("Session"); - }); - - it("extracts a public actor", () => { - expect(names("public actor AuthClient {\n}")).toContain("AuthClient"); - }); - - it("extracts a public protocol", () => { - expect(names("public protocol AuthStateChangeListenerRegistration {\n}")).toContain( - "AuthStateChangeListenerRegistration", - ); - }); - - it("does not extract a non-public class", () => { - expect(names("class Internal {\n public func foo() {}\n}")).not.toContain("Internal"); - }); -}); - -describe("extractFromSource — public class members", () => { - const src = ` -public class AuthClient { - public var session: Session { get async throws {} } - public func signUp(email: String) async throws -> Session {} - private var _token: String? - internal func _internal() {} - nonisolated public var currentSession: Session? - nonisolated public func handle(_ url: URL) {} - public init(configuration: Configuration) {} - public typealias EventCallback = @Sendable (AuthChangeEvent) -> Void -} -`; - it("includes public var", () => expect(names(src)).toContain("AuthClient.session")); - it("includes public func", () => expect(names(src)).toContain("AuthClient.signUp")); - it("includes nonisolated public var", () => expect(names(src)).toContain("AuthClient.currentSession")); - it("includes nonisolated public func", () => expect(names(src)).toContain("AuthClient.handle")); - it("includes public init", () => expect(names(src)).toContain("AuthClient.init")); - it("includes public typealias", () => expect(names(src)).toContain("AuthClient.EventCallback")); - it("excludes private var", () => expect(names(src)).not.toContain("AuthClient._token")); - it("excludes internal func", () => expect(names(src)).not.toContain("AuthClient._internal")); -}); - -describe("extractFromSource — static members", () => { - const src = ` -public class FunctionsClient { - public static let defaultTimeout: TimeInterval = 150 - public static func create() -> FunctionsClient {} -} -`; - it("includes public static let", () => expect(names(src)).toContain("FunctionsClient.defaultTimeout")); - it("includes public static func", () => expect(names(src)).toContain("FunctionsClient.create")); -}); - -describe("extractFromSource — plain extensions", () => { - const src = ` -extension AuthClient { - public func signOut() async throws {} - func internalHelper() {} -} -`; - it("includes explicitly public members in extension", () => - expect(names(src)).toContain("AuthClient.signOut")); - it("excludes non-public members in extension", () => - expect(names(src)).not.toContain("AuthClient.internalHelper")); -}); - -describe("extractFromSource — dotted extension names", () => { - const src = ` -extension AuthClient.Configuration { - public static let defaultLocalStorage: any AuthLocalStorage = KeychainLocalStorage() -} -`; - it("handles dotted extension name", () => - expect(names(src)).toContain("AuthClient.Configuration.defaultLocalStorage")); -}); - -describe("extractFromSource — nested types", () => { - const src = ` -public class SupabaseClient { - public struct Configuration { - public var url: URL - } - public func from(_ table: String) -> PostgrestQueryBuilder {} -} -`; - it("extracts nested struct", () => expect(names(src)).toContain("SupabaseClient.Configuration")); - it("extracts nested struct property", () => expect(names(src)).toContain("SupabaseClient.Configuration.url")); - it("extracts outer class method", () => expect(names(src)).toContain("SupabaseClient.from")); -}); - -describe("extractFromSource — multiline function signatures", () => { - const src = ` -public class AuthClient { - public func signUp( - email: String, - password: String, - captchaToken: String? = nil - ) async throws -> Session { - return Session() - } -} -`; - it("captures method whose signature spans multiple lines", () => - expect(names(src)).toContain("AuthClient.signUp")); -}); - -describe("extractFromSource — comment stripping", () => { - it("ignores symbols in line comments", () => { - const src = ` -public class Foo { - // public func notReal() {} - public func real() {} -} -`; - const n = names(src); - expect(n).toContain("Foo.real"); - expect(n).not.toContain("Foo.notReal"); - }); - - it("ignores doc comment lines", () => { - const src = ` -public class Foo { - /// public func docComment() {} - public func real() {} -} -`; - const n = names(src); - expect(n).toContain("Foo.real"); - expect(n).not.toContain("Foo.docComment"); - }); -}); - -describe("extractFromSource — context stack correctness", () => { - it("does not bleed context across sibling types", () => { - const src = ` -public class Auth { - public func signUp() {} -} -public class Storage { - public func upload() {} -} -`; - const n = names(src); - expect(n).toContain("Auth.signUp"); - expect(n).toContain("Storage.upload"); - expect(n).not.toContain("Auth.upload"); - expect(n).not.toContain("Storage.signUp"); - }); -}); - -describe("parseSwiftProject — .sdk-parse-ignore", () => { - it("excludes files matched by .sdk-parse-ignore", () => { - const dir = join(tmpdir(), `swift-parser-ignore-test-${process.pid}`); - const srcDir = join(dir, "Sources", "MyLib"); - mkdirSync(srcDir, { recursive: true }); - writeFileSync(join(srcDir, "Auth.swift"), "public class AuthClient {\n public func signUp() {}\n}\n"); - writeFileSync(join(dir, ".sdk-parse-ignore"), "Sources/MyLib/Auth.swift\n"); - const result = parseSwiftProject(dir); - expect(result.symbols.map((s) => s.name)).not.toContain("AuthClient"); - }); - - it("excludes entire directories matched by .sdk-parse-ignore", () => { - const dir = join(tmpdir(), `swift-parser-dir-ignore-test-${process.pid}`); - const testDir = join(dir, "Tests"); - mkdirSync(testDir, { recursive: true }); - writeFileSync(join(dir, "Client.swift"), "public class SupabaseClient {}\n"); - writeFileSync(join(testDir, "ClientTests.swift"), "public class SupabaseClientTests {}\n"); - writeFileSync(join(dir, ".sdk-parse-ignore"), "Tests/\n"); - const result = parseSwiftProject(dir); - const names = result.symbols.map((s) => s.name); - expect(names).toContain("SupabaseClient"); - expect(names).not.toContain("SupabaseClientTests"); - }); - - it("does not filter when .sdk-parse-ignore is absent", () => { - const dir = join(tmpdir(), `swift-parser-no-ignore-test-${process.pid}`); - const srcDir = join(dir, "Sources", "MyLib"); - mkdirSync(srcDir, { recursive: true }); - writeFileSync(join(srcDir, "Auth.swift"), "public class AuthClient {}\n"); - const result = parseSwiftProject(dir); - expect(result.symbols.map((s) => s.name)).toContain("AuthClient"); - }); -}); From d2c792efa682b7c7c7a6f5ddc59cae3e2fdde3e1 Mon Sep 17 00:00:00 2001 From: Guilherme Souza Date: Fri, 19 Jun 2026 11:23:26 -0300 Subject: [PATCH 06/14] ci(swift): replace parse-swift with swift-symbolgraph-extract in compliance check --- .github/workflows/validate-sdk-compliance.yml | 85 +++++++++++++++++-- 1 file changed, 79 insertions(+), 6 deletions(-) diff --git a/.github/workflows/validate-sdk-compliance.yml b/.github/workflows/validate-sdk-compliance.yml index 818e0a7..0717dd8 100644 --- a/.github/workflows/validate-sdk-compliance.yml +++ b/.github/workflows/validate-sdk-compliance.yml @@ -45,7 +45,7 @@ jobs: check: name: Check public API against capability matrix - runs-on: ubuntu-latest + runs-on: ${{ inputs.language == 'swift' && 'macos-latest' || 'ubuntu-latest' }} steps: - name: Checkout PR branch uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 @@ -69,6 +69,17 @@ jobs: with: node-version: "22" + - name: Cache SPM dependencies + if: inputs.language == 'swift' + uses: actions/cache@v4 + with: + path: | + ~/.cache/org.swift.swiftpm + _sdk-pr/.build/repositories + _sdk-base/.build/repositories + key: spm-${{ runner.os }}-${{ hashFiles('_sdk-pr/Package.resolved') }} + restore-keys: spm-${{ runner.os }}- + - name: Install dependencies run: npm ci working-directory: _sdk-spec/scripts/capability-matrix @@ -85,21 +96,83 @@ jobs: run: dart pub get working-directory: _sdk-spec/scripts/dart_symbol_extractor + - name: Build PR branch (Swift) + if: inputs.language == 'swift' + run: swift build + working-directory: _sdk-pr + + - name: Build base branch (Swift) + if: inputs.language == 'swift' + run: swift build + working-directory: _sdk-base + + - name: Extract symbol graphs — PR + if: inputs.language == 'swift' + run: | + mkdir -p "$GITHUB_WORKSPACE/_sg-pr" + TRIPLE=$(swift -print-target-info | jq -r '.target.triple') + SDK=$(xcrun --sdk macosx --show-sdk-path) + for MODULE in $(swift package dump-package | jq -r '[.products[] | select(.type.library != null) | .targets[]] | unique[]'); do + swift-symbolgraph-extract -module-name "$MODULE" \ + -target "$TRIPLE" -sdk "$SDK" \ + -I .build/debug \ + -output-dir "$GITHUB_WORKSPACE/_sg-pr" + done + jq -s '[.[] | .symbols[]]' "$GITHUB_WORKSPACE/_sg-pr"/*.symbols.json \ + > "$GITHUB_WORKSPACE/pr-raw.json" + working-directory: _sdk-pr + + - name: Extract symbol graphs — base + if: inputs.language == 'swift' + run: | + mkdir -p "$GITHUB_WORKSPACE/_sg-base" + TRIPLE=$(swift -print-target-info | jq -r '.target.triple') + SDK=$(xcrun --sdk macosx --show-sdk-path) + for MODULE in $(swift package dump-package | jq -r '[.products[] | select(.type.library != null) | .targets[]] | unique[]'); do + swift-symbolgraph-extract -module-name "$MODULE" \ + -target "$TRIPLE" -sdk "$SDK" \ + -I .build/debug \ + -output-dir "$GITHUB_WORKSPACE/_sg-base" + done + jq -s '[.[] | .symbols[]]' "$GITHUB_WORKSPACE/_sg-base"/*.symbols.json \ + > "$GITHUB_WORKSPACE/base-raw.json" + working-directory: _sdk-base + + - name: Normalize symbol graphs — PR + if: inputs.language == 'swift' + run: | + npm run --silent normalize-symbolgraph -- \ + "$GITHUB_WORKSPACE/pr-raw.json" "$GITHUB_WORKSPACE/_sdk-pr" \ + > "$GITHUB_WORKSPACE/pr-symbols.json" + working-directory: _sdk-spec/scripts/capability-matrix + + - name: Normalize symbol graphs — base + if: inputs.language == 'swift' + run: | + npm run --silent normalize-symbolgraph -- \ + "$GITHUB_WORKSPACE/base-raw.json" "$GITHUB_WORKSPACE/_sdk-base" \ + > "$GITHUB_WORKSPACE/base-symbols.json" + working-directory: _sdk-spec/scripts/capability-matrix + - name: Resolve parse command - if: inputs.language != 'dart' + if: inputs.language != 'swift' && inputs.language != 'dart' id: resolve run: | case "${{ inputs.language }}" in - swift) echo "cmd=parse-swift" >> "$GITHUB_OUTPUT" ;; - javascript) echo "cmd=parse-ts" >> "$GITHUB_OUTPUT" ;; + javascript) echo "cmd=parse-ts" >> "$GITHUB_OUTPUT" ;; *) echo "::error::Unsupported language '${{ inputs.language }}'. Supported values: swift, javascript, dart"; exit 1 ;; esac - - name: Parse PR and base branch - if: inputs.language != 'dart' + - name: Parse PR branch + if: inputs.language != 'swift' && inputs.language != 'dart' run: | npm run --silent ${{ steps.resolve.outputs.cmd }} -- "$GITHUB_WORKSPACE/_sdk-pr" \ > "$GITHUB_WORKSPACE/pr-symbols.json" + working-directory: _sdk-spec/scripts/capability-matrix + + - name: Parse base branch + if: inputs.language != 'swift' && inputs.language != 'dart' + run: | npm run --silent ${{ steps.resolve.outputs.cmd }} -- "$GITHUB_WORKSPACE/_sdk-base" \ > "$GITHUB_WORKSPACE/base-symbols.json" working-directory: _sdk-spec/scripts/capability-matrix From fb338846d35f73651871270dd3587e86a6e8576d Mon Sep 17 00:00:00 2001 From: Guilherme Souza Date: Fri, 19 Jun 2026 11:28:14 -0300 Subject: [PATCH 07/14] ci(swift): fix synthesized symbol noise, pin actions/cache, update description --- .github/workflows/validate-sdk-compliance.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/validate-sdk-compliance.yml b/.github/workflows/validate-sdk-compliance.yml index 0717dd8..7d5c2d9 100644 --- a/.github/workflows/validate-sdk-compliance.yml +++ b/.github/workflows/validate-sdk-compliance.yml @@ -8,7 +8,7 @@ on: type: string default: sdk-compliance.yaml language: - description: SDK language for public API check — must match a parse- script (e.g. swift, javascript, dart) + description: SDK language for public API check — "swift", "javascript", or "dart" type: string required: true sdk-ref: @@ -71,7 +71,7 @@ jobs: - name: Cache SPM dependencies if: inputs.language == 'swift' - uses: actions/cache@v4 + uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 with: path: | ~/.cache/org.swift.swiftpm @@ -115,6 +115,7 @@ jobs: for MODULE in $(swift package dump-package | jq -r '[.products[] | select(.type.library != null) | .targets[]] | unique[]'); do swift-symbolgraph-extract -module-name "$MODULE" \ -target "$TRIPLE" -sdk "$SDK" \ + -skip-synthesized-members \ -I .build/debug \ -output-dir "$GITHUB_WORKSPACE/_sg-pr" done @@ -131,6 +132,7 @@ jobs: for MODULE in $(swift package dump-package | jq -r '[.products[] | select(.type.library != null) | .targets[]] | unique[]'); do swift-symbolgraph-extract -module-name "$MODULE" \ -target "$TRIPLE" -sdk "$SDK" \ + -skip-synthesized-members \ -I .build/debug \ -output-dir "$GITHUB_WORKSPACE/_sg-base" done From db393f6005cf1a4cd063eff03b56351eb753e087 Mon Sep 17 00:00:00 2001 From: Guilherme Souza Date: Fri, 19 Jun 2026 11:34:03 -0300 Subject: [PATCH 08/14] chore: exclude docs/specs from git tracking --- .gitignore | 1 + ...6-06-19-swift-parser-symbolgraph-design.md | 215 ------------------ 2 files changed, 1 insertion(+), 215 deletions(-) delete mode 100644 docs/specs/2026-06-19-swift-parser-symbolgraph-design.md diff --git a/.gitignore b/.gitignore index dcdfc9f..f2c6c8d 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ site/ # AI-assisted planning docs (agentic skill framework artefacts — not project documentation) docs/superpowers/ +docs/specs/ diff --git a/docs/specs/2026-06-19-swift-parser-symbolgraph-design.md b/docs/specs/2026-06-19-swift-parser-symbolgraph-design.md deleted file mode 100644 index 26fd30f..0000000 --- a/docs/specs/2026-06-19-swift-parser-symbolgraph-design.md +++ /dev/null @@ -1,215 +0,0 @@ -# Swift Public API Parser — swift-symbolgraph-extract - -**Date:** 2026-06-19 -**Status:** Design approved, pending implementation - -## Problem - -The current `swift-parser.ts` is a ~170-line line-by-line regex scanner with brace-depth tracking. It has known blind spots: multi-line declarations, `#if` conditional compilation blocks, attributes spanning multiple lines (e.g. `@discardableResult` + `public func` on separate lines), and cannot model Swift's full access control semantics. Root cause: regex cannot reliably parse Swift without understanding the language. - -## Goal - -Replace the regex parser with `swift-symbolgraph-extract` — the Swift compiler's own tool for extracting a module's public API surface — and a thin TypeScript normalizer. Same downstream interface (`ParseResult`), no changes to `check-api-symbols` or anything else. - -## Decision: Semantic over Syntactic - -`swift-symbolgraph-extract` uses the Swift compiler (semantic analysis), not just syntax. This gets access control right by construction: `@_spi`, `@usableFromInline`, `#if` conditional compilation, and re-exports are all resolved correctly. The cost is that `swift build` must succeed in CI. For supabase-swift this is already a CI requirement, so the extra step is nearly free. - -## End-to-End Flow - -**Current (regex):** -``` -parse-swift - → swift-parser.ts (line-by-line regex) - → ParseResult JSON - → check-api-symbols -``` - -**Proposed (symbol graph):** -``` -swift build # PR branch + base branch -swift-symbolgraph-extract -module-name ... # one run per library product - → M.symbols.json (Symbol Graph format) -jq -s '[.[] | .symbols[]]' *.symbols.json # merge multiple modules - → merged-raw.json -normalize-symbolgraph # thin TS normalizer (new) - → ParseResult JSON - → check-api-symbols (unchanged) -``` - -## Files Changed - -**Added:** -- `src/normalize-symbolgraph.ts` — core normalizer: `SymbolGraph[]` → `ParseResult` -- `src/normalize-symbolgraph-cli.ts` — CLI entry point (`npm run normalize-symbolgraph `) -- `test/normalize-symbolgraph.test.ts` — ~20 unit tests -- `test/fixtures/symbolgraph-sample.json` — real `swift-symbolgraph-extract` output (committed, not hand-authored) -- `docs/specs/2026-06-19-swift-parser-symbolgraph-design.md` — this file - -**Removed:** -- `src/swift-parser.ts` — regex parser -- `src/parse-swift.ts` — CLI wrapper for regex parser -- `test/swift-parser.test.ts` — regex parser tests -- `test/fixtures/swift-sample/` — regex parser test fixtures - -**Modified:** -- `.github/workflows/validate-sdk-compliance.yml` — Swift-conditional steps (see CI section) -- `package.json` — `normalize-symbolgraph` script replaces `parse-swift` - -## Normalizer Design - -### Input types - -```typescript -interface SymbolGraphSymbol { - kind: { identifier: string }; - accessLevel: string; - pathComponents: string[]; - location?: { uri: string }; -} - -interface SymbolGraph { - symbols: SymbolGraphSymbol[]; -} -``` - -The normalizer accepts a merged array of all symbols (post-`jq` merge) as a single JSON file. - -### Name - -`pathComponents.join(".")` — the compiler already computed the qualified name. No regex needed. - -Examples: -- `["SupabaseClient"]` → `"SupabaseClient"` -- `["SupabaseClient", "signIn"]` → `"SupabaseClient.signIn"` - -### Kind mapping - -| `kind.identifier` | `ParsedSymbol["kind"]` | -|---|---| -| `swift.class`, `swift.struct`, `swift.enum`, `swift.protocol`, `swift.actor` | `"class"` | -| `swift.func` | `"function"` | -| `swift.method`, `swift.type.method`, `swift.init`, `swift.subscript`, `swift.type.subscript` | `"method"` | -| `swift.property`, `swift.type.property`, `swift.enum.case` | `"property"` | -| `swift.typealias`, `swift.associatedtype`, `swift.var` | `"variable"` | -| `swift.deinit`, everything else | skip | - -### Access filter - -`swift-symbolgraph-extract` only emits `public` and `open` symbols by default. The normalizer keeps an explicit check (`accessLevel === "public" || accessLevel === "open"`) as a defensive guard. - -### File path - -`location.uri` is an absolute `file://` URI. The normalizer accepts the SDK root as a second CLI argument and strips the prefix to produce a relative path. Falls back to an empty string if `location` is absent (e.g. synthesized symbols). - -## CI Workflow Changes - -### Runner - -The `check` job's runner becomes language-conditional: - -```yaml -check: - runs-on: ${{ inputs.language == 'swift' && 'macos-latest' || 'ubuntu-latest' }} -``` - -Swift gets `macos-latest` (Swift pre-installed via Xcode). JavaScript stays on `ubuntu-latest`. No new job. - -### New Swift-conditional steps - -Added after "Checkout capability spec", before the existing parse steps: - -```yaml -- name: Build PR branch (Swift) - if: inputs.language == 'swift' - run: swift build - working-directory: _sdk-pr - -- name: Build base branch (Swift) - if: inputs.language == 'swift' - run: swift build - working-directory: _sdk-base - -- name: Extract symbol graphs — PR - if: inputs.language == 'swift' - run: | - mkdir -p _sg-pr - TRIPLE=$(swift -print-target-info | jq -r '.target.triple') - SDK=$(xcrun --sdk macosx --show-sdk-path) - for MODULE in $(swift package dump-package | jq -r '[.products[] | select(.type.library != null) | .targets[]] | unique[]'); do - swift-symbolgraph-extract -module-name "$MODULE" \ - -target "$TRIPLE" -sdk "$SDK" \ - -I _sdk-pr/.build/debug \ - -output-dir _sg-pr - done - jq -s '[.[] | .symbols[]]' _sg-pr/*.symbols.json > pr-raw.json - working-directory: _sdk-pr - -- name: Extract symbol graphs — base - if: inputs.language == 'swift' - run: | - mkdir -p _sg-base - TRIPLE=$(swift -print-target-info | jq -r '.target.triple') - SDK=$(xcrun --sdk macosx --show-sdk-path) - for MODULE in $(swift package dump-package | jq -r '[.products[] | select(.type.library != null) | .targets[]] | unique[]'); do - swift-symbolgraph-extract -module-name "$MODULE" \ - -target "$TRIPLE" -sdk "$SDK" \ - -I _sdk-base/.build/debug \ - -output-dir _sg-base - done - jq -s '[.[] | .symbols[]]' _sg-base/*.symbols.json > base-raw.json - working-directory: _sdk-base - -- name: Normalize symbol graphs — PR - if: inputs.language == 'swift' - run: | - npm run --silent normalize-symbolgraph -- \ - "$GITHUB_WORKSPACE/pr-raw.json" "$GITHUB_WORKSPACE/_sdk-pr" \ - > "$GITHUB_WORKSPACE/pr-symbols.json" - working-directory: _sdk-spec/scripts/capability-matrix - -- name: Normalize symbol graphs — base - if: inputs.language == 'swift' - run: | - npm run --silent normalize-symbolgraph -- \ - "$GITHUB_WORKSPACE/base-raw.json" "$GITHUB_WORKSPACE/_sdk-base" \ - > "$GITHUB_WORKSPACE/base-symbols.json" - working-directory: _sdk-spec/scripts/capability-matrix -``` - -### Modified existing steps - -The three existing steps — "Resolve parse command", "Parse PR branch", "Parse base branch" — are each guarded with `if: inputs.language != 'swift'`. For Swift, the dedicated build → extract → normalize steps above already produce `pr-symbols.json` and `base-symbols.json` directly. The final "Check new symbols against capability matrix" step (`check-api-symbols`) runs unconditionally and is unchanged. - -### SPM dependency caching - -Add `actions/cache` on `~/.cache/org.swift.swiftpm` keyed on `Package.resolved` to avoid re-downloading SPM dependencies on repeated runs. - -## Testing - -**Fixture** (`test/fixtures/symbolgraph-sample.json`): real merged symbol graph output from a small Swift package or subset of supabase-swift. Generated once with the actual tool, committed, never hand-authored. - -**Test cases** (~20 tests in `test/normalize-symbolgraph.test.ts`): - -| Case | What it verifies | -|---|---| -| `public class` | type → `"class"`, pathComponents join | -| `public struct` | type → `"class"` | -| `public enum` + cases | type → `"class"`, cases → `"property"` | -| `public protocol` | type → `"class"` | -| `public actor` | type → `"class"` | -| `open class` | `open` access level included | -| `internal` symbol | filtered out | -| Instance method | → `"method"` | -| Static method (`swift.type.method`) | → `"method"` | -| `init` | → `"method"` | -| Instance property | → `"property"` | -| Global free function | → `"function"` | -| Typealias | → `"variable"` | -| `deinit` | skipped | -| Nested type (`Outer.Inner`) | pathComponents → `"Outer.Inner"` | -| Multi-module merge | symbols from two inputs appear in output | -| `file` path | absolute URI → relative path | -| Missing `location` | file falls back to `""` | - -No Swift toolchain needed at test time — the normalizer is pure TypeScript operating on JSON. From 4471c552960c6afb6e6f4e2009e715fe6af2fea6 Mon Sep 17 00:00:00 2001 From: Guilherme Souza Date: Fri, 19 Jun 2026 11:35:02 -0300 Subject: [PATCH 09/14] chore: revert docs/specs gitignore exclusion --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index f2c6c8d..dcdfc9f 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,3 @@ site/ # AI-assisted planning docs (agentic skill framework artefacts — not project documentation) docs/superpowers/ -docs/specs/ From 82af3bfa264bc9679359cfc487f6246cca0f4920 Mon Sep 17 00:00:00 2001 From: Guilherme Souza Date: Tue, 23 Jun 2026 06:55:40 -0300 Subject: [PATCH 10/14] ci(swift): simplify symbol extraction via swift package dump-symbol-graph Replaces the manual swift build + module-discovery loop + swift-symbolgraph-extract invocation with a single `swift package dump-symbol-graph` call, which handles build, module discovery, and extraction internally. --- .github/workflows/validate-sdk-compliance.yml | 38 ++++--------------- 1 file changed, 8 insertions(+), 30 deletions(-) diff --git a/.github/workflows/validate-sdk-compliance.yml b/.github/workflows/validate-sdk-compliance.yml index 7d5c2d9..71b5e17 100644 --- a/.github/workflows/validate-sdk-compliance.yml +++ b/.github/workflows/validate-sdk-compliance.yml @@ -96,29 +96,13 @@ jobs: run: dart pub get working-directory: _sdk-spec/scripts/dart_symbol_extractor - - name: Build PR branch (Swift) - if: inputs.language == 'swift' - run: swift build - working-directory: _sdk-pr - - - name: Build base branch (Swift) - if: inputs.language == 'swift' - run: swift build - working-directory: _sdk-base - - name: Extract symbol graphs — PR if: inputs.language == 'swift' run: | - mkdir -p "$GITHUB_WORKSPACE/_sg-pr" - TRIPLE=$(swift -print-target-info | jq -r '.target.triple') - SDK=$(xcrun --sdk macosx --show-sdk-path) - for MODULE in $(swift package dump-package | jq -r '[.products[] | select(.type.library != null) | .targets[]] | unique[]'); do - swift-symbolgraph-extract -module-name "$MODULE" \ - -target "$TRIPLE" -sdk "$SDK" \ - -skip-synthesized-members \ - -I .build/debug \ - -output-dir "$GITHUB_WORKSPACE/_sg-pr" - done + swift package dump-symbol-graph \ + --minimum-access-level public \ + --skip-synthesized-members \ + --output-directory "$GITHUB_WORKSPACE/_sg-pr" jq -s '[.[] | .symbols[]]' "$GITHUB_WORKSPACE/_sg-pr"/*.symbols.json \ > "$GITHUB_WORKSPACE/pr-raw.json" working-directory: _sdk-pr @@ -126,16 +110,10 @@ jobs: - name: Extract symbol graphs — base if: inputs.language == 'swift' run: | - mkdir -p "$GITHUB_WORKSPACE/_sg-base" - TRIPLE=$(swift -print-target-info | jq -r '.target.triple') - SDK=$(xcrun --sdk macosx --show-sdk-path) - for MODULE in $(swift package dump-package | jq -r '[.products[] | select(.type.library != null) | .targets[]] | unique[]'); do - swift-symbolgraph-extract -module-name "$MODULE" \ - -target "$TRIPLE" -sdk "$SDK" \ - -skip-synthesized-members \ - -I .build/debug \ - -output-dir "$GITHUB_WORKSPACE/_sg-base" - done + swift package dump-symbol-graph \ + --minimum-access-level public \ + --skip-synthesized-members \ + --output-directory "$GITHUB_WORKSPACE/_sg-base" jq -s '[.[] | .symbols[]]' "$GITHUB_WORKSPACE/_sg-base"/*.symbols.json \ > "$GITHUB_WORKSPACE/base-raw.json" working-directory: _sdk-base From 638bf9e3d1d1a6372b0d73807da5b3e5c02514f7 Mon Sep 17 00:00:00 2001 From: Guilherme Souza Date: Tue, 23 Jun 2026 07:00:31 -0300 Subject: [PATCH 11/14] ci(swift): fix --output-directory flag (not supported by swift package dump-symbol-graph) swift package dump-symbol-graph always writes to .build//symbolgraph. Locate it with `find .build -maxdepth 3 -type d -name "symbolgraph"` instead. --- .github/workflows/validate-sdk-compliance.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/validate-sdk-compliance.yml b/.github/workflows/validate-sdk-compliance.yml index 71b5e17..05b1473 100644 --- a/.github/workflows/validate-sdk-compliance.yml +++ b/.github/workflows/validate-sdk-compliance.yml @@ -101,9 +101,9 @@ jobs: run: | swift package dump-symbol-graph \ --minimum-access-level public \ - --skip-synthesized-members \ - --output-directory "$GITHUB_WORKSPACE/_sg-pr" - jq -s '[.[] | .symbols[]]' "$GITHUB_WORKSPACE/_sg-pr"/*.symbols.json \ + --skip-synthesized-members + SGDIR=$(find .build -maxdepth 3 -type d -name "symbolgraph") + jq -s '[.[] | .symbols[]]' "$SGDIR"/*.symbols.json \ > "$GITHUB_WORKSPACE/pr-raw.json" working-directory: _sdk-pr @@ -112,9 +112,9 @@ jobs: run: | swift package dump-symbol-graph \ --minimum-access-level public \ - --skip-synthesized-members \ - --output-directory "$GITHUB_WORKSPACE/_sg-base" - jq -s '[.[] | .symbols[]]' "$GITHUB_WORKSPACE/_sg-base"/*.symbols.json \ + --skip-synthesized-members + SGDIR=$(find .build -maxdepth 3 -type d -name "symbolgraph") + jq -s '[.[] | .symbols[]]' "$SGDIR"/*.symbols.json \ > "$GITHUB_WORKSPACE/base-raw.json" working-directory: _sdk-base From df33a7539c14215e8d4b8253a0d9420cf924930d Mon Sep 17 00:00:00 2001 From: Guilherme Souza Date: Tue, 23 Jun 2026 07:14:35 -0300 Subject: [PATCH 12/14] ci(swift): handle test-target extraction failure in dump-symbol-graph swift package dump-symbol-graph tries all targets including test targets. Test modules can't be loaded in CI SDK search paths. Library target files land before the test-target attempt, so || true lets the step continue. Guard ensures the step still fails if zero files were produced. --- .github/workflows/validate-sdk-compliance.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/validate-sdk-compliance.yml b/.github/workflows/validate-sdk-compliance.yml index 05b1473..b6210f3 100644 --- a/.github/workflows/validate-sdk-compliance.yml +++ b/.github/workflows/validate-sdk-compliance.yml @@ -99,10 +99,13 @@ jobs: - name: Extract symbol graphs — PR if: inputs.language == 'swift' run: | + # || true: test targets may fail to extract on CI runners; library targets land first swift package dump-symbol-graph \ --minimum-access-level public \ - --skip-synthesized-members + --skip-synthesized-members || true SGDIR=$(find .build -maxdepth 3 -type d -name "symbolgraph") + NFILES=$(ls "$SGDIR"/*.symbols.json 2>/dev/null | wc -l | tr -d ' ') + if [ "$NFILES" -eq 0 ]; then echo "::error::No symbol graphs emitted"; exit 1; fi jq -s '[.[] | .symbols[]]' "$SGDIR"/*.symbols.json \ > "$GITHUB_WORKSPACE/pr-raw.json" working-directory: _sdk-pr @@ -112,8 +115,10 @@ jobs: run: | swift package dump-symbol-graph \ --minimum-access-level public \ - --skip-synthesized-members + --skip-synthesized-members || true SGDIR=$(find .build -maxdepth 3 -type d -name "symbolgraph") + NFILES=$(ls "$SGDIR"/*.symbols.json 2>/dev/null | wc -l | tr -d ' ') + if [ "$NFILES" -eq 0 ]; then echo "::error::No symbol graphs emitted"; exit 1; fi jq -s '[.[] | .symbols[]]' "$SGDIR"/*.symbols.json \ > "$GITHUB_WORKSPACE/base-raw.json" working-directory: _sdk-base From a88c80144e1fcf2014ae79e7013d47c1d321bcdc Mon Sep 17 00:00:00 2001 From: Guilherme Souza Date: Tue, 23 Jun 2026 07:30:14 -0300 Subject: [PATCH 13/14] test(parsers): regenerate fixture via dump-symbol-graph, drop access-filter assertions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Regenerate symbolgraph-sample.json with swift package dump-symbol-graph --minimum-access-level public --skip-synthesized-members. The fixture now reflects actual CI output: only public/open symbols, no InternalClass. Remove the access-filter test block and the "excludes InternalClass" smoke test — with --minimum-access-level public enforced upstream, those inputs can never arrive at the normalizer. --- .../test/fixtures/symbolgraph-sample.json | 3604 ++--------------- .../test/normalize-symbolgraph.test.ts | 26 - 2 files changed, 300 insertions(+), 3330 deletions(-) diff --git a/scripts/capability-matrix/test/fixtures/symbolgraph-sample.json b/scripts/capability-matrix/test/fixtures/symbolgraph-sample.json index 5945663..15289be 100644 --- a/scripts/capability-matrix/test/fixtures/symbolgraph-sample.json +++ b/scripts/capability-matrix/test/fixtures/symbolgraph-sample.json @@ -63,15 +63,15 @@ "displayName": "Instance Property" }, "identifier": { - "precise": "s:9SampleLib11SimpleClassC16instancePropertySSvp", + "precise": "s:9SampleLib11SimpleClassC5valueSSvp", "interfaceLanguage": "swift" }, "pathComponents": [ "SimpleClass", - "instanceProperty" + "value" ], "names": { - "title": "instanceProperty", + "title": "value", "subHeading": [ { "kind": "keyword", @@ -83,7 +83,7 @@ }, { "kind": "identifier", - "spelling": "instanceProperty" + "spelling": "value" }, { "kind": "text", @@ -107,7 +107,7 @@ }, { "kind": "identifier", - "spelling": "instanceProperty" + "spelling": "value" }, { "kind": "text", @@ -130,80 +130,94 @@ }, { "kind": { - "identifier": "swift.type.property", - "displayName": "Type Property" + "identifier": "swift.init", + "displayName": "Initializer" }, "identifier": { - "precise": "s:9SampleLib11SimpleClassC14staticPropertySivpZ", + "precise": "s:9SampleLib11SimpleClassC5valueACSS_tcfc", "interfaceLanguage": "swift" }, "pathComponents": [ "SimpleClass", - "staticProperty" + "init(value:)" ], "names": { - "title": "staticProperty", + "title": "init(value:)", "subHeading": [ { "kind": "keyword", - "spelling": "static" + "spelling": "init" }, { "kind": "text", - "spelling": " " + "spelling": "(" }, { - "kind": "keyword", - "spelling": "var" + "kind": "externalParam", + "spelling": "value" }, { "kind": "text", - "spelling": " " + "spelling": ": " }, { - "kind": "identifier", - "spelling": "staticProperty" + "kind": "typeIdentifier", + "spelling": "String", + "preciseIdentifier": "s:SS" }, { "kind": "text", - "spelling": ": " - }, + "spelling": ")" + } + ] + }, + "functionSignature": { + "parameters": [ { - "kind": "typeIdentifier", - "spelling": "Int", - "preciseIdentifier": "s:Si" + "name": "value", + "declarationFragments": [ + { + "kind": "identifier", + "spelling": "value" + }, + { + "kind": "text", + "spelling": ": " + }, + { + "kind": "typeIdentifier", + "spelling": "String", + "preciseIdentifier": "s:SS" + } + ] } ] }, "declarationFragments": [ { "kind": "keyword", - "spelling": "static" + "spelling": "init" }, { "kind": "text", - "spelling": " " + "spelling": "(" }, { - "kind": "keyword", - "spelling": "var" + "kind": "externalParam", + "spelling": "value" }, { "kind": "text", - "spelling": " " + "spelling": ": " }, { - "kind": "identifier", - "spelling": "staticProperty" + "kind": "typeIdentifier", + "spelling": "String", + "preciseIdentifier": "s:SS" }, { "kind": "text", - "spelling": ": " - }, - { - "kind": "typeIdentifier", - "spelling": "Int", - "preciseIdentifier": "s:Si" + "spelling": ")" } ], "accessLevel": "public", @@ -211,7 +225,7 @@ "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", "position": { "line": 2, - "character": 22 + "character": 11 } } }, @@ -221,7 +235,7 @@ "displayName": "Instance Method" }, "identifier": { - "precise": "s:9SampleLib11SimpleClassC14instanceMethodyyF", + "precise": "s:9SampleLib11SimpleClassC14instanceMethodSSyF", "interfaceLanguage": "swift" }, "pathComponents": [ @@ -245,15 +259,21 @@ }, { "kind": "text", - "spelling": "()" + "spelling": "() -> " + }, + { + "kind": "typeIdentifier", + "spelling": "String", + "preciseIdentifier": "s:SS" } ] }, "functionSignature": { "returns": [ { - "kind": "text", - "spelling": "()" + "kind": "typeIdentifier", + "spelling": "String", + "preciseIdentifier": "s:SS" } ] }, @@ -272,7 +292,12 @@ }, { "kind": "text", - "spelling": "()" + "spelling": "() -> " + }, + { + "kind": "typeIdentifier", + "spelling": "String", + "preciseIdentifier": "s:SS" } ], "accessLevel": "public", @@ -382,94 +407,52 @@ }, { "kind": { - "identifier": "swift.init", - "displayName": "Initializer" + "identifier": "swift.struct", + "displayName": "Structure" }, "identifier": { - "precise": "s:9SampleLib11SimpleClassC5valueACSS_tcfc", + "precise": "s:9SampleLib11SimpleClassC12NestedStructV", "interfaceLanguage": "swift" }, "pathComponents": [ "SimpleClass", - "init(value:)" + "NestedStruct" ], "names": { - "title": "init(value:)", + "title": "SimpleClass.NestedStruct", + "navigator": [ + { + "kind": "identifier", + "spelling": "NestedStruct" + } + ], "subHeading": [ { "kind": "keyword", - "spelling": "init" - }, - { - "kind": "text", - "spelling": "(" - }, - { - "kind": "externalParam", - "spelling": "value" + "spelling": "struct" }, { "kind": "text", - "spelling": ": " - }, - { - "kind": "typeIdentifier", - "spelling": "String", - "preciseIdentifier": "s:SS" + "spelling": " " }, { - "kind": "text", - "spelling": ")" - } - ] - }, - "functionSignature": { - "parameters": [ - { - "name": "value", - "declarationFragments": [ - { - "kind": "identifier", - "spelling": "value" - }, - { - "kind": "text", - "spelling": ": " - }, - { - "kind": "typeIdentifier", - "spelling": "String", - "preciseIdentifier": "s:SS" - } - ] + "kind": "identifier", + "spelling": "NestedStruct" } ] }, "declarationFragments": [ { "kind": "keyword", - "spelling": "init" - }, - { - "kind": "text", - "spelling": "(" - }, - { - "kind": "externalParam", - "spelling": "value" + "spelling": "struct" }, { "kind": "text", - "spelling": ": " - }, - { - "kind": "typeIdentifier", - "spelling": "String", - "preciseIdentifier": "s:SS" + "spelling": " " }, { - "kind": "text", - "spelling": ")" + "kind": "identifier", + "spelling": "NestedStruct" } ], "accessLevel": "public", @@ -477,103 +460,81 @@ "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", "position": { "line": 5, - "character": 11 + "character": 18 } } }, { "kind": { - "identifier": "swift.typealias", - "displayName": "Type Alias" + "identifier": "swift.init", + "displayName": "Initializer" }, "identifier": { - "precise": "s:9SampleLib11SimpleClassC8Callbacka", + "precise": "s:9SampleLib11SimpleClassC12NestedStructVAEycfc", "interfaceLanguage": "swift" }, "pathComponents": [ "SimpleClass", - "Callback" + "NestedStruct", + "init()" ], "names": { - "title": "SimpleClass.Callback", - "navigator": [ - { - "kind": "identifier", - "spelling": "Callback" - } - ], + "title": "init()", "subHeading": [ { "kind": "keyword", - "spelling": "typealias" + "spelling": "init" }, { "kind": "text", - "spelling": " " - }, - { - "kind": "identifier", - "spelling": "Callback" + "spelling": "()" } ] }, + "functionSignature": {}, "declarationFragments": [ { "kind": "keyword", - "spelling": "typealias" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "identifier", - "spelling": "Callback" + "spelling": "init" }, { "kind": "text", - "spelling": " = () -> " - }, - { - "kind": "typeIdentifier", - "spelling": "Void", - "preciseIdentifier": "s:s4Voida" + "spelling": "()" } ], "accessLevel": "public", "location": { "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", "position": { - "line": 7, - "character": 21 + "line": 5, + "character": 40 } } }, { "kind": { - "identifier": "swift.struct", - "displayName": "Structure" + "identifier": "swift.class", + "displayName": "Class" }, "identifier": { - "precise": "s:9SampleLib11SimpleClassC12NestedStructV", + "precise": "s:9SampleLib9OpenClassC", "interfaceLanguage": "swift" }, "pathComponents": [ - "SimpleClass", - "NestedStruct" + "OpenClass" ], "names": { - "title": "SimpleClass.NestedStruct", + "title": "OpenClass", "navigator": [ { "kind": "identifier", - "spelling": "NestedStruct" + "spelling": "OpenClass" } ], "subHeading": [ { "kind": "keyword", - "spelling": "struct" + "spelling": "class" }, { "kind": "text", @@ -581,14 +542,14 @@ }, { "kind": "identifier", - "spelling": "NestedStruct" + "spelling": "OpenClass" } ] }, "declarationFragments": [ { "kind": "keyword", - "spelling": "struct" + "spelling": "class" }, { "kind": "text", @@ -596,62 +557,110 @@ }, { "kind": "identifier", - "spelling": "NestedStruct" + "spelling": "OpenClass" } ], - "accessLevel": "public", + "accessLevel": "open", "location": { "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", "position": { - "line": 8, - "character": 18 + "line": 7, + "character": 11 } } }, { "kind": { - "identifier": "swift.property", - "displayName": "Instance Property" + "identifier": "swift.init", + "displayName": "Initializer" }, "identifier": { - "precise": "s:9SampleLib11SimpleClassC12NestedStructV14nestedPropertySivp", + "precise": "s:9SampleLib9OpenClassCACycfc", "interfaceLanguage": "swift" }, "pathComponents": [ - "SimpleClass", - "NestedStruct", - "nestedProperty" + "OpenClass", + "init()" ], "names": { - "title": "nestedProperty", + "title": "init()", "subHeading": [ { "kind": "keyword", - "spelling": "var" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "identifier", - "spelling": "nestedProperty" + "spelling": "init" }, { "kind": "text", - "spelling": ": " - }, - { - "kind": "typeIdentifier", - "spelling": "Int", - "preciseIdentifier": "s:Si" + "spelling": "()" } ] }, + "functionSignature": {}, "declarationFragments": [ { "kind": "keyword", - "spelling": "var" + "spelling": "init" + }, + { + "kind": "text", + "spelling": "()" + } + ], + "accessLevel": "public", + "location": { + "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", + "position": { + "line": 8, + "character": 11 + } + } + }, + { + "kind": { + "identifier": "swift.method", + "displayName": "Instance Method" + }, + "identifier": { + "precise": "s:9SampleLib9OpenClassC10openMethodyyF", + "interfaceLanguage": "swift" + }, + "pathComponents": [ + "OpenClass", + "openMethod()" + ], + "names": { + "title": "openMethod()", + "subHeading": [ + { + "kind": "keyword", + "spelling": "func" + }, + { + "kind": "text", + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "openMethod" + }, + { + "kind": "text", + "spelling": "()" + } + ] + }, + "functionSignature": { + "returns": [ + { + "kind": "text", + "spelling": "()" + } + ] + }, + "declarationFragments": [ + { + "kind": "keyword", + "spelling": "func" }, { "kind": "text", @@ -659,51 +668,46 @@ }, { "kind": "identifier", - "spelling": "nestedProperty" + "spelling": "openMethod" }, { "kind": "text", - "spelling": ": " - }, - { - "kind": "typeIdentifier", - "spelling": "Int", - "preciseIdentifier": "s:Si" + "spelling": "()" } ], - "accessLevel": "public", + "accessLevel": "open", "location": { "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", "position": { "line": 9, - "character": 19 + "character": 14 } } }, { "kind": { - "identifier": "swift.class", - "displayName": "Class" + "identifier": "swift.enum", + "displayName": "Enumeration" }, "identifier": { - "precise": "s:9SampleLib9OpenClassC", + "precise": "s:9SampleLib10SimpleEnumO", "interfaceLanguage": "swift" }, "pathComponents": [ - "OpenClass" + "SimpleEnum" ], "names": { - "title": "OpenClass", + "title": "SimpleEnum", "navigator": [ { "kind": "identifier", - "spelling": "OpenClass" + "spelling": "SimpleEnum" } ], "subHeading": [ { "kind": "keyword", - "spelling": "class" + "spelling": "enum" }, { "kind": "text", @@ -711,14 +715,14 @@ }, { "kind": "identifier", - "spelling": "OpenClass" + "spelling": "SimpleEnum" } ] }, "declarationFragments": [ { "kind": "keyword", - "spelling": "class" + "spelling": "enum" }, { "kind": "text", @@ -726,83 +730,90 @@ }, { "kind": "identifier", - "spelling": "OpenClass" + "spelling": "SimpleEnum" } ], - "accessLevel": "open", + "accessLevel": "public", "location": { "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", "position": { "line": 12, - "character": 11 + "character": 12 } } }, { "kind": { - "identifier": "swift.init", - "displayName": "Initializer" + "identifier": "swift.enum.case", + "displayName": "Case" }, "identifier": { - "precise": "s:9SampleLib9OpenClassCACycfc", + "precise": "s:9SampleLib10SimpleEnumO5alphayA2CmF", "interfaceLanguage": "swift" }, "pathComponents": [ - "OpenClass", - "init()" + "SimpleEnum", + "alpha" ], "names": { - "title": "init()", + "title": "SimpleEnum.alpha", "subHeading": [ { "kind": "keyword", - "spelling": "init" + "spelling": "case" }, { "kind": "text", - "spelling": "()" + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "alpha" } ] }, - "functionSignature": {}, "declarationFragments": [ { "kind": "keyword", - "spelling": "init" + "spelling": "case" }, { "kind": "text", - "spelling": "()" + "spelling": " " + }, + { + "kind": "identifier", + "spelling": "alpha" } ], "accessLevel": "public", "location": { "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", "position": { - "line": 13, - "character": 11 + "line": 12, + "character": 30 } } }, { "kind": { - "identifier": "swift.method", - "displayName": "Instance Method" + "identifier": "swift.enum.case", + "displayName": "Case" }, "identifier": { - "precise": "s:9SampleLib9OpenClassC10openMethodyyF", + "precise": "s:9SampleLib10SimpleEnumO4betayA2CmF", "interfaceLanguage": "swift" }, "pathComponents": [ - "OpenClass", - "openMethod()" + "SimpleEnum", + "beta" ], "names": { - "title": "openMethod()", + "title": "SimpleEnum.beta", "subHeading": [ { "kind": "keyword", - "spelling": "func" + "spelling": "case" }, { "kind": "text", @@ -810,26 +821,14 @@ }, { "kind": "identifier", - "spelling": "openMethod" - }, - { - "kind": "text", - "spelling": "()" - } - ] - }, - "functionSignature": { - "returns": [ - { - "kind": "text", - "spelling": "()" + "spelling": "beta" } ] }, "declarationFragments": [ { "kind": "keyword", - "spelling": "func" + "spelling": "case" }, { "kind": "text", @@ -837,46 +836,42 @@ }, { "kind": "identifier", - "spelling": "openMethod" - }, - { - "kind": "text", - "spelling": "()" + "spelling": "beta" } ], - "accessLevel": "open", + "accessLevel": "public", "location": { "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", "position": { - "line": 14, - "character": 14 + "line": 12, + "character": 37 } } }, { "kind": { - "identifier": "swift.struct", - "displayName": "Structure" + "identifier": "swift.protocol", + "displayName": "Protocol" }, "identifier": { - "precise": "s:9SampleLib12SimpleStructV", + "precise": "s:9SampleLib14SimpleProtocolP", "interfaceLanguage": "swift" }, "pathComponents": [ - "SimpleStruct" + "SimpleProtocol" ], "names": { - "title": "SimpleStruct", + "title": "SimpleProtocol", "navigator": [ { "kind": "identifier", - "spelling": "SimpleStruct" + "spelling": "SimpleProtocol" } ], "subHeading": [ { "kind": "keyword", - "spelling": "struct" + "spelling": "protocol" }, { "kind": "text", @@ -884,14 +879,14 @@ }, { "kind": "identifier", - "spelling": "SimpleStruct" + "spelling": "SimpleProtocol" } ] }, "declarationFragments": [ { "kind": "keyword", - "spelling": "struct" + "spelling": "protocol" }, { "kind": "text", @@ -899,37 +894,37 @@ }, { "kind": "identifier", - "spelling": "SimpleStruct" + "spelling": "SimpleProtocol" } ], "accessLevel": "public", "location": { "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", "position": { - "line": 16, - "character": 14 + "line": 13, + "character": 16 } } }, { "kind": { - "identifier": "swift.property", - "displayName": "Instance Property" + "identifier": "swift.method", + "displayName": "Instance Method" }, "identifier": { - "precise": "s:9SampleLib12SimpleStructV5fieldSSvp", + "precise": "s:9SampleLib14SimpleProtocolP11requirementyyF", "interfaceLanguage": "swift" }, "pathComponents": [ - "SimpleStruct", - "field" + "SimpleProtocol", + "requirement()" ], "names": { - "title": "field", + "title": "requirement()", "subHeading": [ { "kind": "keyword", - "spelling": "var" + "spelling": "func" }, { "kind": "text", @@ -937,23 +932,26 @@ }, { "kind": "identifier", - "spelling": "field" + "spelling": "requirement" }, { "kind": "text", - "spelling": ": " - }, + "spelling": "()" + } + ] + }, + "functionSignature": { + "returns": [ { - "kind": "typeIdentifier", - "spelling": "String", - "preciseIdentifier": "s:SS" + "kind": "text", + "spelling": "()" } ] }, "declarationFragments": [ { "kind": "keyword", - "spelling": "var" + "spelling": "func" }, { "kind": "text", @@ -961,2994 +959,57 @@ }, { "kind": "identifier", - "spelling": "field" + "spelling": "requirement" }, { "kind": "text", - "spelling": ": " - }, - { - "kind": "typeIdentifier", - "spelling": "String", - "preciseIdentifier": "s:SS" + "spelling": "()" } ], "accessLevel": "public", "location": { "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", "position": { - "line": 17, - "character": 15 + "line": 13, + "character": 38 } } }, { "kind": { - "identifier": "swift.init", - "displayName": "Initializer" + "identifier": "swift.func", + "displayName": "Function" }, "identifier": { - "precise": "s:9SampleLib12SimpleStructV5fieldACSS_tcfc", + "precise": "s:9SampleLib14globalFunctionyyF", "interfaceLanguage": "swift" }, "pathComponents": [ - "SimpleStruct", - "init(field:)" + "globalFunction()" ], "names": { - "title": "init(field:)", + "title": "globalFunction()", "subHeading": [ { "kind": "keyword", - "spelling": "init" - }, - { - "kind": "text", - "spelling": "(" - }, - { - "kind": "externalParam", - "spelling": "field" + "spelling": "func" }, { "kind": "text", - "spelling": ": " + "spelling": " " }, { - "kind": "typeIdentifier", - "spelling": "String", - "preciseIdentifier": "s:SS" + "kind": "identifier", + "spelling": "globalFunction" }, { "kind": "text", - "spelling": ")" + "spelling": "()" } ] }, "functionSignature": { - "parameters": [ - { - "name": "field", - "declarationFragments": [ - { - "kind": "identifier", - "spelling": "field" - }, - { - "kind": "text", - "spelling": ": " - }, - { - "kind": "typeIdentifier", - "spelling": "String", - "preciseIdentifier": "s:SS" - } - ] - } - ] - }, - "declarationFragments": [ - { - "kind": "keyword", - "spelling": "init" - }, - { - "kind": "text", - "spelling": "(" - }, - { - "kind": "externalParam", - "spelling": "field" - }, - { - "kind": "text", - "spelling": ": " - }, - { - "kind": "typeIdentifier", - "spelling": "String", - "preciseIdentifier": "s:SS" - }, - { - "kind": "text", - "spelling": ")" - } - ], - "accessLevel": "public", - "location": { - "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", - "position": { - "line": 18, - "character": 11 - } - } - }, - { - "kind": { - "identifier": "swift.enum", - "displayName": "Enumeration" - }, - "identifier": { - "precise": "s:9SampleLib10SimpleEnumO", - "interfaceLanguage": "swift" - }, - "pathComponents": [ - "SimpleEnum" - ], - "names": { - "title": "SimpleEnum", - "navigator": [ - { - "kind": "identifier", - "spelling": "SimpleEnum" - } - ], - "subHeading": [ - { - "kind": "keyword", - "spelling": "enum" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "identifier", - "spelling": "SimpleEnum" - } - ] - }, - "declarationFragments": [ - { - "kind": "keyword", - "spelling": "enum" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "identifier", - "spelling": "SimpleEnum" - } - ], - "accessLevel": "public", - "location": { - "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", - "position": { - "line": 20, - "character": 12 - } - } - }, - { - "kind": { - "identifier": "swift.func.op", - "displayName": "Operator" - }, - "identifier": { - "precise": "s:SQsE2neoiySbx_xtFZ::SYNTHESIZED::s:9SampleLib10SimpleEnumO", - "interfaceLanguage": "swift" - }, - "pathComponents": [ - "SimpleEnum", - "!=(_:_:)" - ], - "names": { - "title": "!=(_:_:)", - "subHeading": [ - { - "kind": "keyword", - "spelling": "static" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "keyword", - "spelling": "func" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "identifier", - "spelling": "!=" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "text", - "spelling": "(" - }, - { - "kind": "typeIdentifier", - "spelling": "Self" - }, - { - "kind": "text", - "spelling": ", " - }, - { - "kind": "typeIdentifier", - "spelling": "Self" - }, - { - "kind": "text", - "spelling": ") -> " - }, - { - "kind": "typeIdentifier", - "spelling": "Bool", - "preciseIdentifier": "s:Sb" - } - ] - }, - "docComment": { - "module": "Swift", - "lines": [ - { - "text": "Returns a Boolean value indicating whether two values are not equal." - }, - { - "text": "" - }, - { - "text": "Inequality is the inverse of equality. For any values `a` and `b`, `a != b`" - }, - { - "text": "implies that `a == b` is `false`." - }, - { - "text": "" - }, - { - "text": "This is the default implementation of the not-equal-to operator (`!=`)" - }, - { - "text": "for any type that conforms to `Equatable`." - }, - { - "text": "" - }, - { - "text": "- Parameters:" - }, - { - "text": " - lhs: A value to compare." - }, - { - "text": " - rhs: Another value to compare." - } - ] - }, - "functionSignature": { - "parameters": [ - { - "name": "lhs", - "declarationFragments": [ - { - "kind": "identifier", - "spelling": "lhs" - }, - { - "kind": "text", - "spelling": ": " - }, - { - "kind": "typeIdentifier", - "spelling": "Self" - } - ] - }, - { - "name": "rhs", - "declarationFragments": [ - { - "kind": "identifier", - "spelling": "rhs" - }, - { - "kind": "text", - "spelling": ": " - }, - { - "kind": "typeIdentifier", - "spelling": "Self" - } - ] - } - ], - "returns": [ - { - "kind": "typeIdentifier", - "spelling": "Bool", - "preciseIdentifier": "s:Sb" - } - ] - }, - "swiftExtension": { - "extendedModule": "Swift", - "typeKind": "swift.protocol" - }, - "declarationFragments": [ - { - "kind": "keyword", - "spelling": "static" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "keyword", - "spelling": "func" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "identifier", - "spelling": "!=" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "text", - "spelling": "(" - }, - { - "kind": "internalParam", - "spelling": "lhs" - }, - { - "kind": "text", - "spelling": ": " - }, - { - "kind": "typeIdentifier", - "spelling": "Self" - }, - { - "kind": "text", - "spelling": ", " - }, - { - "kind": "internalParam", - "spelling": "rhs" - }, - { - "kind": "text", - "spelling": ": " - }, - { - "kind": "typeIdentifier", - "spelling": "Self" - }, - { - "kind": "text", - "spelling": ") -> " - }, - { - "kind": "typeIdentifier", - "spelling": "Bool", - "preciseIdentifier": "s:Sb" - } - ], - "accessLevel": "public" - }, - { - "kind": { - "identifier": "swift.enum.case", - "displayName": "Case" - }, - "identifier": { - "precise": "s:9SampleLib10SimpleEnumO5alphayA2CmF", - "interfaceLanguage": "swift" - }, - "pathComponents": [ - "SimpleEnum", - "alpha" - ], - "names": { - "title": "SimpleEnum.alpha", - "subHeading": [ - { - "kind": "keyword", - "spelling": "case" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "identifier", - "spelling": "alpha" - } - ] - }, - "declarationFragments": [ - { - "kind": "keyword", - "spelling": "case" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "identifier", - "spelling": "alpha" - } - ], - "accessLevel": "public", - "location": { - "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", - "position": { - "line": 21, - "character": 9 - } - } - }, - { - "kind": { - "identifier": "swift.enum.case", - "displayName": "Case" - }, - "identifier": { - "precise": "s:9SampleLib10SimpleEnumO4betayA2CmF", - "interfaceLanguage": "swift" - }, - "pathComponents": [ - "SimpleEnum", - "beta" - ], - "names": { - "title": "SimpleEnum.beta", - "subHeading": [ - { - "kind": "keyword", - "spelling": "case" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "identifier", - "spelling": "beta" - } - ] - }, - "declarationFragments": [ - { - "kind": "keyword", - "spelling": "case" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "identifier", - "spelling": "beta" - } - ], - "accessLevel": "public", - "location": { - "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", - "position": { - "line": 22, - "character": 9 - } - } - }, - { - "kind": { - "identifier": "swift.method", - "displayName": "Instance Method" - }, - "identifier": { - "precise": "s:9SampleLib10SimpleEnumO10enumMethodSSyF", - "interfaceLanguage": "swift" - }, - "pathComponents": [ - "SimpleEnum", - "enumMethod()" - ], - "names": { - "title": "enumMethod()", - "subHeading": [ - { - "kind": "keyword", - "spelling": "func" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "identifier", - "spelling": "enumMethod" - }, - { - "kind": "text", - "spelling": "() -> " - }, - { - "kind": "typeIdentifier", - "spelling": "String", - "preciseIdentifier": "s:SS" - } - ] - }, - "functionSignature": { - "returns": [ - { - "kind": "typeIdentifier", - "spelling": "String", - "preciseIdentifier": "s:SS" - } - ] - }, - "declarationFragments": [ - { - "kind": "keyword", - "spelling": "func" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "identifier", - "spelling": "enumMethod" - }, - { - "kind": "text", - "spelling": "() -> " - }, - { - "kind": "typeIdentifier", - "spelling": "String", - "preciseIdentifier": "s:SS" - } - ], - "accessLevel": "public", - "location": { - "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", - "position": { - "line": 23, - "character": 16 - } - } - }, - { - "kind": { - "identifier": "swift.protocol", - "displayName": "Protocol" - }, - "identifier": { - "precise": "s:9SampleLib14SimpleProtocolP", - "interfaceLanguage": "swift" - }, - "pathComponents": [ - "SimpleProtocol" - ], - "names": { - "title": "SimpleProtocol", - "navigator": [ - { - "kind": "identifier", - "spelling": "SimpleProtocol" - } - ], - "subHeading": [ - { - "kind": "keyword", - "spelling": "protocol" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "identifier", - "spelling": "SimpleProtocol" - } - ] - }, - "declarationFragments": [ - { - "kind": "keyword", - "spelling": "protocol" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "identifier", - "spelling": "SimpleProtocol" - } - ], - "accessLevel": "public", - "location": { - "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", - "position": { - "line": 25, - "character": 16 - } - } - }, - { - "kind": { - "identifier": "swift.method", - "displayName": "Instance Method" - }, - "identifier": { - "precise": "s:9SampleLib14SimpleProtocolP14protocolMethodyyF", - "interfaceLanguage": "swift" - }, - "pathComponents": [ - "SimpleProtocol", - "protocolMethod()" - ], - "names": { - "title": "protocolMethod()", - "subHeading": [ - { - "kind": "keyword", - "spelling": "func" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "identifier", - "spelling": "protocolMethod" - }, - { - "kind": "text", - "spelling": "()" - } - ] - }, - "functionSignature": { - "returns": [ - { - "kind": "text", - "spelling": "()" - } - ] - }, - "declarationFragments": [ - { - "kind": "keyword", - "spelling": "func" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "identifier", - "spelling": "protocolMethod" - }, - { - "kind": "text", - "spelling": "()" - } - ], - "accessLevel": "public", - "location": { - "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", - "position": { - "line": 26, - "character": 9 - } - } - }, - { - "kind": { - "identifier": "swift.associatedtype", - "displayName": "Associated Type" - }, - "identifier": { - "precise": "s:9SampleLib14SimpleProtocolP4ItemQa", - "interfaceLanguage": "swift" - }, - "pathComponents": [ - "SimpleProtocol", - "Item" - ], - "names": { - "title": "Item", - "subHeading": [ - { - "kind": "keyword", - "spelling": "associatedtype" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "identifier", - "spelling": "Item" - } - ] - }, - "declarationFragments": [ - { - "kind": "keyword", - "spelling": "associatedtype" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "identifier", - "spelling": "Item" - } - ], - "accessLevel": "public", - "location": { - "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", - "position": { - "line": 27, - "character": 19 - } - } - }, - { - "kind": { - "identifier": "swift.class", - "displayName": "Class" - }, - "identifier": { - "precise": "s:9SampleLib11SimpleActorC", - "interfaceLanguage": "swift" - }, - "pathComponents": [ - "SimpleActor" - ], - "names": { - "title": "SimpleActor", - "navigator": [ - { - "kind": "identifier", - "spelling": "SimpleActor" - } - ], - "subHeading": [ - { - "kind": "keyword", - "spelling": "actor" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "identifier", - "spelling": "SimpleActor" - } - ] - }, - "declarationFragments": [ - { - "kind": "keyword", - "spelling": "actor" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "identifier", - "spelling": "SimpleActor" - } - ], - "accessLevel": "public", - "location": { - "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", - "position": { - "line": 29, - "character": 13 - } - } - }, - { - "kind": { - "identifier": "swift.method", - "displayName": "Instance Method" - }, - "identifier": { - "precise": "s:ScA12_ConcurrencyE18withSerialExecutoryqd__qd__Scf_pqd_0_YKXEqd_0_YKs5ErrorRd_0_Ri_d__r0_lF::SYNTHESIZED::s:9SampleLib11SimpleActorC", - "interfaceLanguage": "swift" - }, - "pathComponents": [ - "SimpleActor", - "withSerialExecutor(_:)" - ], - "names": { - "title": "withSerialExecutor(_:)", - "subHeading": [ - { - "kind": "keyword", - "spelling": "func" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "identifier", - "spelling": "withSerialExecutor" - }, - { - "kind": "text", - "spelling": "<" - }, - { - "kind": "genericParameter", - "spelling": "T" - }, - { - "kind": "text", - "spelling": ", " - }, - { - "kind": "genericParameter", - "spelling": "E" - }, - { - "kind": "text", - "spelling": ">((any " - }, - { - "kind": "typeIdentifier", - "spelling": "SerialExecutor", - "preciseIdentifier": "s:Scf" - }, - { - "kind": "text", - "spelling": ") " - }, - { - "kind": "keyword", - "spelling": "throws" - }, - { - "kind": "text", - "spelling": "(" - }, - { - "kind": "typeIdentifier", - "spelling": "E" - }, - { - "kind": "text", - "spelling": ") -> " - }, - { - "kind": "typeIdentifier", - "spelling": "T" - }, - { - "kind": "text", - "spelling": ") " - }, - { - "kind": "keyword", - "spelling": "throws" - }, - { - "kind": "text", - "spelling": "(" - }, - { - "kind": "typeIdentifier", - "spelling": "E" - }, - { - "kind": "text", - "spelling": ") -> " - }, - { - "kind": "typeIdentifier", - "spelling": "T" - } - ] - }, - "docComment": { - "module": "_Concurrency", - "lines": [ - { - "text": "Perform an operation with the actor's ``SerialExecutor``." - }, - { - "text": "" - }, - { - "text": "This converts the actor's ``Actor/unownedExecutor`` to a ``SerialExecutor`` while" - }, - { - "text": "retaining the actor for the duration of the operation. This is to ensure the lifetime" - }, - { - "text": "of the executor while performing the operation." - } - ] - }, - "functionSignature": { - "parameters": [ - { - "name": "operation", - "declarationFragments": [ - { - "kind": "identifier", - "spelling": "operation" - }, - { - "kind": "text", - "spelling": ": (any " - }, - { - "kind": "typeIdentifier", - "spelling": "SerialExecutor", - "preciseIdentifier": "s:Scf" - }, - { - "kind": "text", - "spelling": ") " - }, - { - "kind": "keyword", - "spelling": "throws" - }, - { - "kind": "text", - "spelling": "(" - }, - { - "kind": "typeIdentifier", - "spelling": "E" - }, - { - "kind": "text", - "spelling": ") -> " - }, - { - "kind": "typeIdentifier", - "spelling": "T" - } - ] - } - ], - "returns": [ - { - "kind": "typeIdentifier", - "spelling": "T" - } - ] - }, - "swiftGenerics": { - "parameters": [ - { - "name": "T", - "index": 0, - "depth": 1 - }, - { - "name": "E", - "index": 1, - "depth": 1 - } - ], - "constraints": [ - { - "kind": "conformance", - "lhs": "E", - "rhs": "Error", - "rhsPrecise": "s:s5ErrorP" - } - ] - }, - "swiftExtension": { - "extendedModule": "_Concurrency", - "typeKind": "swift.protocol" - }, - "declarationFragments": [ - { - "kind": "attribute", - "spelling": "nonisolated" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "keyword", - "spelling": "func" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "identifier", - "spelling": "withSerialExecutor" - }, - { - "kind": "text", - "spelling": "<" - }, - { - "kind": "genericParameter", - "spelling": "T" - }, - { - "kind": "text", - "spelling": ", " - }, - { - "kind": "genericParameter", - "spelling": "E" - }, - { - "kind": "text", - "spelling": ">(" - }, - { - "kind": "externalParam", - "spelling": "_" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "internalParam", - "spelling": "operation" - }, - { - "kind": "text", - "spelling": ": (any " - }, - { - "kind": "typeIdentifier", - "spelling": "SerialExecutor", - "preciseIdentifier": "s:Scf" - }, - { - "kind": "text", - "spelling": ") " - }, - { - "kind": "keyword", - "spelling": "throws" - }, - { - "kind": "text", - "spelling": "(" - }, - { - "kind": "typeIdentifier", - "spelling": "E" - }, - { - "kind": "text", - "spelling": ") -> " - }, - { - "kind": "typeIdentifier", - "spelling": "T" - }, - { - "kind": "text", - "spelling": ") " - }, - { - "kind": "keyword", - "spelling": "throws" - }, - { - "kind": "text", - "spelling": "(" - }, - { - "kind": "typeIdentifier", - "spelling": "E" - }, - { - "kind": "text", - "spelling": ") -> " - }, - { - "kind": "typeIdentifier", - "spelling": "T" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "keyword", - "spelling": "where" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "typeIdentifier", - "spelling": "E" - }, - { - "kind": "text", - "spelling": " : " - }, - { - "kind": "typeIdentifier", - "spelling": "Error", - "preciseIdentifier": "s:s5ErrorP" - }, - { - "kind": "text", - "spelling": ", " - }, - { - "kind": "typeIdentifier", - "spelling": "T" - }, - { - "kind": "text", - "spelling": " : ~Copyable" - } - ], - "accessLevel": "public", - "availability": [ - { - "domain": "macOS", - "introduced": { - "major": 10, - "minor": 15 - } - }, - { - "domain": "watchOS", - "introduced": { - "major": 6, - "minor": 0 - } - }, - { - "domain": "iOS", - "introduced": { - "major": 13, - "minor": 0 - } - }, - { - "domain": "tvOS", - "introduced": { - "major": 13, - "minor": 0 - } - } - ] - }, - { - "kind": { - "identifier": "swift.method", - "displayName": "Instance Method" - }, - "identifier": { - "precise": "s:ScA12_ConcurrencyE18withSerialExecutoryqd__qd__Scf_pYaqd_0_YKYCXEYaqd_0_YKs5ErrorRd_0_Ri_d__r0_lF::SYNTHESIZED::s:9SampleLib11SimpleActorC", - "interfaceLanguage": "swift" - }, - "pathComponents": [ - "SimpleActor", - "withSerialExecutor(_:)" - ], - "names": { - "title": "withSerialExecutor(_:)", - "subHeading": [ - { - "kind": "keyword", - "spelling": "func" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "identifier", - "spelling": "withSerialExecutor" - }, - { - "kind": "text", - "spelling": "<" - }, - { - "kind": "genericParameter", - "spelling": "T" - }, - { - "kind": "text", - "spelling": ", " - }, - { - "kind": "genericParameter", - "spelling": "E" - }, - { - "kind": "text", - "spelling": ">(" - }, - { - "kind": "keyword", - "spelling": "nonisolated(nonsending)" - }, - { - "kind": "text", - "spelling": " (any " - }, - { - "kind": "typeIdentifier", - "spelling": "SerialExecutor", - "preciseIdentifier": "s:Scf" - }, - { - "kind": "text", - "spelling": ") " - }, - { - "kind": "keyword", - "spelling": "async" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "keyword", - "spelling": "throws" - }, - { - "kind": "text", - "spelling": "(" - }, - { - "kind": "typeIdentifier", - "spelling": "E" - }, - { - "kind": "text", - "spelling": ") -> " - }, - { - "kind": "typeIdentifier", - "spelling": "T" - }, - { - "kind": "text", - "spelling": ") " - }, - { - "kind": "keyword", - "spelling": "async" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "keyword", - "spelling": "throws" - }, - { - "kind": "text", - "spelling": "(" - }, - { - "kind": "typeIdentifier", - "spelling": "E" - }, - { - "kind": "text", - "spelling": ") -> " - }, - { - "kind": "typeIdentifier", - "spelling": "T" - } - ] - }, - "docComment": { - "module": "_Concurrency", - "lines": [ - { - "text": "Perform an operation with the actor's ``SerialExecutor``." - }, - { - "text": "" - }, - { - "text": "This converts the actor's ``Actor/unownedExecutor`` to a ``SerialExecutor`` while" - }, - { - "text": "retaining the actor for the duration of the operation. This is to ensure the lifetime" - }, - { - "text": "of the executor while performing the operation." - } - ] - }, - "functionSignature": { - "parameters": [ - { - "name": "operation", - "declarationFragments": [ - { - "kind": "identifier", - "spelling": "operation" - }, - { - "kind": "text", - "spelling": ": (any " - }, - { - "kind": "typeIdentifier", - "spelling": "SerialExecutor", - "preciseIdentifier": "s:Scf" - }, - { - "kind": "text", - "spelling": ") " - }, - { - "kind": "keyword", - "spelling": "async" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "keyword", - "spelling": "throws" - }, - { - "kind": "text", - "spelling": "(" - }, - { - "kind": "typeIdentifier", - "spelling": "E" - }, - { - "kind": "text", - "spelling": ") -> " - }, - { - "kind": "typeIdentifier", - "spelling": "T" - } - ] - } - ], - "returns": [ - { - "kind": "typeIdentifier", - "spelling": "T" - } - ] - }, - "swiftGenerics": { - "parameters": [ - { - "name": "T", - "index": 0, - "depth": 1 - }, - { - "name": "E", - "index": 1, - "depth": 1 - } - ], - "constraints": [ - { - "kind": "conformance", - "lhs": "E", - "rhs": "Error", - "rhsPrecise": "s:s5ErrorP" - } - ] - }, - "swiftExtension": { - "extendedModule": "_Concurrency", - "typeKind": "swift.protocol" - }, - "declarationFragments": [ - { - "kind": "attribute", - "spelling": "nonisolated" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "keyword", - "spelling": "func" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "identifier", - "spelling": "withSerialExecutor" - }, - { - "kind": "text", - "spelling": "<" - }, - { - "kind": "genericParameter", - "spelling": "T" - }, - { - "kind": "text", - "spelling": ", " - }, - { - "kind": "genericParameter", - "spelling": "E" - }, - { - "kind": "text", - "spelling": ">(" - }, - { - "kind": "externalParam", - "spelling": "_" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "internalParam", - "spelling": "operation" - }, - { - "kind": "text", - "spelling": ": " - }, - { - "kind": "keyword", - "spelling": "nonisolated(nonsending)" - }, - { - "kind": "text", - "spelling": " (any " - }, - { - "kind": "typeIdentifier", - "spelling": "SerialExecutor", - "preciseIdentifier": "s:Scf" - }, - { - "kind": "text", - "spelling": ") " - }, - { - "kind": "keyword", - "spelling": "async" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "keyword", - "spelling": "throws" - }, - { - "kind": "text", - "spelling": "(" - }, - { - "kind": "typeIdentifier", - "spelling": "E" - }, - { - "kind": "text", - "spelling": ") -> " - }, - { - "kind": "typeIdentifier", - "spelling": "T" - }, - { - "kind": "text", - "spelling": ") " - }, - { - "kind": "keyword", - "spelling": "async" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "keyword", - "spelling": "throws" - }, - { - "kind": "text", - "spelling": "(" - }, - { - "kind": "typeIdentifier", - "spelling": "E" - }, - { - "kind": "text", - "spelling": ") -> " - }, - { - "kind": "typeIdentifier", - "spelling": "T" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "keyword", - "spelling": "where" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "typeIdentifier", - "spelling": "E" - }, - { - "kind": "text", - "spelling": " : " - }, - { - "kind": "typeIdentifier", - "spelling": "Error", - "preciseIdentifier": "s:s5ErrorP" - }, - { - "kind": "text", - "spelling": ", " - }, - { - "kind": "typeIdentifier", - "spelling": "T" - }, - { - "kind": "text", - "spelling": " : ~Copyable" - } - ], - "accessLevel": "public", - "availability": [ - { - "domain": "macOS", - "introduced": { - "major": 10, - "minor": 15 - } - }, - { - "domain": "watchOS", - "introduced": { - "major": 6, - "minor": 0 - } - }, - { - "domain": "iOS", - "introduced": { - "major": 13, - "minor": 0 - } - }, - { - "domain": "tvOS", - "introduced": { - "major": 13, - "minor": 0 - } - } - ] - }, - { - "kind": { - "identifier": "swift.method", - "displayName": "Instance Method" - }, - "identifier": { - "precise": "s:ScA12_ConcurrencyE20preconditionIsolated_4file4lineySSyXK_s12StaticStringVSutF::SYNTHESIZED::s:9SampleLib11SimpleActorC", - "interfaceLanguage": "swift" - }, - "pathComponents": [ - "SimpleActor", - "preconditionIsolated(_:file:line:)" - ], - "names": { - "title": "preconditionIsolated(_:file:line:)", - "subHeading": [ - { - "kind": "keyword", - "spelling": "func" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "identifier", - "spelling": "preconditionIsolated" - }, - { - "kind": "text", - "spelling": "(" - }, - { - "kind": "attribute", - "spelling": "@autoclosure " - }, - { - "kind": "text", - "spelling": "() -> " - }, - { - "kind": "typeIdentifier", - "spelling": "String", - "preciseIdentifier": "s:SS" - }, - { - "kind": "text", - "spelling": ", " - }, - { - "kind": "externalParam", - "spelling": "file" - }, - { - "kind": "text", - "spelling": ": " - }, - { - "kind": "typeIdentifier", - "spelling": "StaticString", - "preciseIdentifier": "s:s12StaticStringV" - }, - { - "kind": "text", - "spelling": ", " - }, - { - "kind": "externalParam", - "spelling": "line" - }, - { - "kind": "text", - "spelling": ": " - }, - { - "kind": "typeIdentifier", - "spelling": "UInt", - "preciseIdentifier": "s:Su" - }, - { - "kind": "text", - "spelling": ")" - } - ] - }, - "docComment": { - "module": "_Concurrency", - "lines": [ - { - "text": "Stops program execution if the current task is not executing on this" - }, - { - "text": "actor's serial executor." - }, - { - "text": "" - }, - { - "text": "This function's effect varies depending on the build flag used:" - }, - { - "text": "" - }, - { - "text": "* In playgrounds and `-Onone` builds (the default for Xcode's Debug" - }, - { - "text": " configuration), stops program execution in a debuggable state after" - }, - { - "text": " printing `message`." - }, - { - "text": "" - }, - { - "text": "* In `-O` builds (the default for Xcode's Release configuration), stops" - }, - { - "text": " program execution." - }, - { - "text": "" - }, - { - "text": "- Note: Because this check is performed against the actor's serial executor," - }, - { - "text": " if another actor uses the same serial executor--by using" - }, - { - "text": " that actor's serial executor as its own ``Actor/unownedExecutor``--this" - }, - { - "text": " check will succeed. From a concurrency safety perspective, the" - }, - { - "text": " serial executor guarantees mutual exclusion of those two actors." - }, - { - "text": "" - }, - { - "text": "- Parameters:" - }, - { - "text": " - message: The message to print if the assertion fails." - }, - { - "text": " - file: The file name to print if the assertion fails. The default is" - }, - { - "text": " where this method was called." - }, - { - "text": " - line: The line number to print if the assertion fails The default is" - }, - { - "text": " where this method was called." - } - ] - }, - "functionSignature": { - "parameters": [ - { - "name": "message", - "declarationFragments": [ - { - "kind": "identifier", - "spelling": "message" - }, - { - "kind": "text", - "spelling": ": () -> " - }, - { - "kind": "typeIdentifier", - "spelling": "String", - "preciseIdentifier": "s:SS" - } - ] - }, - { - "name": "file", - "declarationFragments": [ - { - "kind": "identifier", - "spelling": "file" - }, - { - "kind": "text", - "spelling": ": " - }, - { - "kind": "typeIdentifier", - "spelling": "StaticString", - "preciseIdentifier": "s:s12StaticStringV" - } - ] - }, - { - "name": "line", - "declarationFragments": [ - { - "kind": "identifier", - "spelling": "line" - }, - { - "kind": "text", - "spelling": ": " - }, - { - "kind": "typeIdentifier", - "spelling": "UInt", - "preciseIdentifier": "s:Su" - } - ] - } - ], - "returns": [ - { - "kind": "text", - "spelling": "()" - } - ] - }, - "swiftExtension": { - "extendedModule": "_Concurrency", - "typeKind": "swift.protocol" - }, - "declarationFragments": [ - { - "kind": "text", - "spelling": "@backDeployed(before: macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0)\n" - }, - { - "kind": "attribute", - "spelling": "nonisolated" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "keyword", - "spelling": "func" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "identifier", - "spelling": "preconditionIsolated" - }, - { - "kind": "text", - "spelling": "(" - }, - { - "kind": "externalParam", - "spelling": "_" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "internalParam", - "spelling": "message" - }, - { - "kind": "text", - "spelling": ": " - }, - { - "kind": "attribute", - "spelling": "@autoclosure " - }, - { - "kind": "text", - "spelling": "() -> " - }, - { - "kind": "typeIdentifier", - "spelling": "String", - "preciseIdentifier": "s:SS" - }, - { - "kind": "text", - "spelling": " = String(), " - }, - { - "kind": "externalParam", - "spelling": "file" - }, - { - "kind": "text", - "spelling": ": " - }, - { - "kind": "typeIdentifier", - "spelling": "StaticString", - "preciseIdentifier": "s:s12StaticStringV" - }, - { - "kind": "text", - "spelling": " = " - }, - { - "kind": "keyword", - "spelling": "#fileID" - }, - { - "kind": "text", - "spelling": ", " - }, - { - "kind": "externalParam", - "spelling": "line" - }, - { - "kind": "text", - "spelling": ": " - }, - { - "kind": "typeIdentifier", - "spelling": "UInt", - "preciseIdentifier": "s:Su" - }, - { - "kind": "text", - "spelling": " = " - }, - { - "kind": "keyword", - "spelling": "#line" - }, - { - "kind": "text", - "spelling": ")" - } - ], - "accessLevel": "public", - "availability": [ - { - "domain": "macOS", - "introduced": { - "major": 10, - "minor": 15 - } - }, - { - "domain": "watchOS", - "introduced": { - "major": 6, - "minor": 0 - } - }, - { - "domain": "iOS", - "introduced": { - "major": 13, - "minor": 0 - } - }, - { - "domain": "tvOS", - "introduced": { - "major": 13, - "minor": 0 - } - } - ] - }, - { - "kind": { - "identifier": "swift.method", - "displayName": "Instance Method" - }, - "identifier": { - "precise": "s:ScA12_ConcurrencyE14assertIsolated_4file4lineySSyXK_s12StaticStringVSutF::SYNTHESIZED::s:9SampleLib11SimpleActorC", - "interfaceLanguage": "swift" - }, - "pathComponents": [ - "SimpleActor", - "assertIsolated(_:file:line:)" - ], - "names": { - "title": "assertIsolated(_:file:line:)", - "subHeading": [ - { - "kind": "keyword", - "spelling": "func" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "identifier", - "spelling": "assertIsolated" - }, - { - "kind": "text", - "spelling": "(" - }, - { - "kind": "attribute", - "spelling": "@autoclosure " - }, - { - "kind": "text", - "spelling": "() -> " - }, - { - "kind": "typeIdentifier", - "spelling": "String", - "preciseIdentifier": "s:SS" - }, - { - "kind": "text", - "spelling": ", " - }, - { - "kind": "externalParam", - "spelling": "file" - }, - { - "kind": "text", - "spelling": ": " - }, - { - "kind": "typeIdentifier", - "spelling": "StaticString", - "preciseIdentifier": "s:s12StaticStringV" - }, - { - "kind": "text", - "spelling": ", " - }, - { - "kind": "externalParam", - "spelling": "line" - }, - { - "kind": "text", - "spelling": ": " - }, - { - "kind": "typeIdentifier", - "spelling": "UInt", - "preciseIdentifier": "s:Su" - }, - { - "kind": "text", - "spelling": ")" - } - ] - }, - "docComment": { - "module": "_Concurrency", - "lines": [ - { - "text": "Stops program execution if the current task is not executing on this" - }, - { - "text": "actor's serial executor." - }, - { - "text": "" - }, - { - "text": "This function's effect varies depending on the build flag used:" - }, - { - "text": "" - }, - { - "text": "* In playgrounds and `-Onone` builds (the default for Xcode's Debug" - }, - { - "text": " configuration), stops program execution in a debuggable state after" - }, - { - "text": " printing `message`." - }, - { - "text": "" - }, - { - "text": "* In `-O` builds (the default for Xcode's Release configuration)," - }, - { - "text": " the isolation check is not performed and there are no effects." - }, - { - "text": "" - }, - { - "text": "- Note: This check is performed against the actor's serial executor," - }, - { - "text": " meaning that / if another actor uses the same serial executor--by using" - }, - { - "text": " that actor's serial executor as its own ``Actor/unownedExecutor``--this" - }, - { - "text": " check will succeed , as from a concurrency safety perspective, the" - }, - { - "text": " serial executor guarantees mutual exclusion of those two actors." - }, - { - "text": "" - }, - { - "text": "- Parameters:" - }, - { - "text": " - message: The message to print if the assertion fails." - }, - { - "text": " - file: The file name to print if the assertion fails. The default is" - }, - { - "text": " where this method was called." - }, - { - "text": " - line: The line number to print if the assertion fails The default is" - }, - { - "text": " where this method was called." - } - ] - }, - "functionSignature": { - "parameters": [ - { - "name": "message", - "declarationFragments": [ - { - "kind": "identifier", - "spelling": "message" - }, - { - "kind": "text", - "spelling": ": () -> " - }, - { - "kind": "typeIdentifier", - "spelling": "String", - "preciseIdentifier": "s:SS" - } - ] - }, - { - "name": "file", - "declarationFragments": [ - { - "kind": "identifier", - "spelling": "file" - }, - { - "kind": "text", - "spelling": ": " - }, - { - "kind": "typeIdentifier", - "spelling": "StaticString", - "preciseIdentifier": "s:s12StaticStringV" - } - ] - }, - { - "name": "line", - "declarationFragments": [ - { - "kind": "identifier", - "spelling": "line" - }, - { - "kind": "text", - "spelling": ": " - }, - { - "kind": "typeIdentifier", - "spelling": "UInt", - "preciseIdentifier": "s:Su" - } - ] - } - ], - "returns": [ - { - "kind": "text", - "spelling": "()" - } - ] - }, - "swiftExtension": { - "extendedModule": "_Concurrency", - "typeKind": "swift.protocol" - }, - "declarationFragments": [ - { - "kind": "text", - "spelling": "@backDeployed(before: macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0)\n" - }, - { - "kind": "attribute", - "spelling": "nonisolated" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "keyword", - "spelling": "func" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "identifier", - "spelling": "assertIsolated" - }, - { - "kind": "text", - "spelling": "(" - }, - { - "kind": "externalParam", - "spelling": "_" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "internalParam", - "spelling": "message" - }, - { - "kind": "text", - "spelling": ": " - }, - { - "kind": "attribute", - "spelling": "@autoclosure " - }, - { - "kind": "text", - "spelling": "() -> " - }, - { - "kind": "typeIdentifier", - "spelling": "String", - "preciseIdentifier": "s:SS" - }, - { - "kind": "text", - "spelling": " = String(), " - }, - { - "kind": "externalParam", - "spelling": "file" - }, - { - "kind": "text", - "spelling": ": " - }, - { - "kind": "typeIdentifier", - "spelling": "StaticString", - "preciseIdentifier": "s:s12StaticStringV" - }, - { - "kind": "text", - "spelling": " = " - }, - { - "kind": "keyword", - "spelling": "#fileID" - }, - { - "kind": "text", - "spelling": ", " - }, - { - "kind": "externalParam", - "spelling": "line" - }, - { - "kind": "text", - "spelling": ": " - }, - { - "kind": "typeIdentifier", - "spelling": "UInt", - "preciseIdentifier": "s:Su" - }, - { - "kind": "text", - "spelling": " = " - }, - { - "kind": "keyword", - "spelling": "#line" - }, - { - "kind": "text", - "spelling": ")" - } - ], - "accessLevel": "public", - "availability": [ - { - "domain": "macOS", - "introduced": { - "major": 10, - "minor": 15 - } - }, - { - "domain": "watchOS", - "introduced": { - "major": 6, - "minor": 0 - } - }, - { - "domain": "iOS", - "introduced": { - "major": 13, - "minor": 0 - } - }, - { - "domain": "tvOS", - "introduced": { - "major": 13, - "minor": 0 - } - } - ] - }, - { - "kind": { - "identifier": "swift.method", - "displayName": "Instance Method" - }, - "identifier": { - "precise": "s:ScA12_ConcurrencyE14assumeIsolated_4file4lineqd__qd__xYiKXE_s12StaticStringVSutKs8SendableRd__lF::SYNTHESIZED::s:9SampleLib11SimpleActorC", - "interfaceLanguage": "swift" - }, - "pathComponents": [ - "SimpleActor", - "assumeIsolated(_:file:line:)" - ], - "names": { - "title": "assumeIsolated(_:file:line:)", - "subHeading": [ - { - "kind": "keyword", - "spelling": "func" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "identifier", - "spelling": "assumeIsolated" - }, - { - "kind": "text", - "spelling": "<" - }, - { - "kind": "genericParameter", - "spelling": "T" - }, - { - "kind": "text", - "spelling": ">((" - }, - { - "kind": "keyword", - "spelling": "isolated" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "typeIdentifier", - "spelling": "Self" - }, - { - "kind": "text", - "spelling": ") " - }, - { - "kind": "keyword", - "spelling": "throws" - }, - { - "kind": "text", - "spelling": " -> " - }, - { - "kind": "typeIdentifier", - "spelling": "T" - }, - { - "kind": "text", - "spelling": ", " - }, - { - "kind": "externalParam", - "spelling": "file" - }, - { - "kind": "text", - "spelling": ": " - }, - { - "kind": "typeIdentifier", - "spelling": "StaticString", - "preciseIdentifier": "s:s12StaticStringV" - }, - { - "kind": "text", - "spelling": ", " - }, - { - "kind": "externalParam", - "spelling": "line" - }, - { - "kind": "text", - "spelling": ": " - }, - { - "kind": "typeIdentifier", - "spelling": "UInt", - "preciseIdentifier": "s:Su" - }, - { - "kind": "text", - "spelling": ") " - }, - { - "kind": "keyword", - "spelling": "rethrows" - }, - { - "kind": "text", - "spelling": " -> " - }, - { - "kind": "typeIdentifier", - "spelling": "T" - } - ] - }, - "docComment": { - "module": "_Concurrency", - "lines": [ - { - "text": "Assume that the current task is executing on this actor's serial executor," - }, - { - "text": "or stop program execution otherwise." - }, - { - "text": "" - }, - { - "text": "You call this method to *assume and verify* that the currently" - }, - { - "text": "executing synchronous function is actually executing on the serial" - }, - { - "text": "executor of this actor." - }, - { - "text": "" - }, - { - "text": "If that is the case, the operation is invoked with an `isolated` version" - }, - { - "text": "of the actor, allowing synchronous access to actor local state without" - }, - { - "text": "hopping through asynchronous boundaries." - }, - { - "text": "" - }, - { - "text": "If the current context is not running on the actor's serial executor, or" - }, - { - "text": "if the actor is a reference to a remote actor, this method will crash" - }, - { - "text": "with a fatal error (similar to ``preconditionIsolated()``)." - }, - { - "text": "" - }, - { - "text": "Note that this check is performed against the passed in actor's serial" - }, - { - "text": "executor, meaning that if another actor uses the same serial executor--by" - }, - { - "text": "using that actor's ``Actor/unownedExecutor`` as its own" - }, - { - "text": "``Actor/unownedExecutor``--this check will succeed, as from a concurrency" - }, - { - "text": "safety perspective, the serial executor guarantees mutual exclusion of" - }, - { - "text": "those two actors." - }, - { - "text": "" - }, - { - "text": "This method can only be used from synchronous functions, as asynchronous" - }, - { - "text": "functions should instead perform a normal method call to the actor, which" - }, - { - "text": "will hop task execution to the target actor if necessary." - }, - { - "text": "" - }, - { - "text": "- Note: This check is performed against the actor's serial executor," - }, - { - "text": " meaning that / if another actor uses the same serial executor--by using" - }, - { - "text": " another actor's executor as its own ``Actor/unownedExecutor``" - }, - { - "text": " --this check will succeed , as from a concurrency safety perspective," - }, - { - "text": " the serial executor guarantees mutual exclusion of those two actors." - }, - { - "text": "" - }, - { - "text": "- Parameters:" - }, - { - "text": " - operation: the operation that will be executed if the current context" - }, - { - "text": " is executing on the actors serial executor." - }, - { - "text": " - file: The file name to print if the assertion fails. The default is" - }, - { - "text": " where this method was called." - }, - { - "text": " - line: The line number to print if the assertion fails The default is" - }, - { - "text": " where this method was called." - }, - { - "text": "- Returns: the return value of the `operation`" - }, - { - "text": "- Throws: rethrows the `Error` thrown by the operation if it threw" - } - ] - }, - "functionSignature": { - "parameters": [ - { - "name": "operation", - "declarationFragments": [ - { - "kind": "identifier", - "spelling": "operation" - }, - { - "kind": "text", - "spelling": ": (" - }, - { - "kind": "keyword", - "spelling": "isolated" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "typeIdentifier", - "spelling": "Self" - }, - { - "kind": "text", - "spelling": ") " - }, - { - "kind": "keyword", - "spelling": "throws" - }, - { - "kind": "text", - "spelling": " -> " - }, - { - "kind": "typeIdentifier", - "spelling": "T" - } - ] - }, - { - "name": "file", - "declarationFragments": [ - { - "kind": "identifier", - "spelling": "file" - }, - { - "kind": "text", - "spelling": ": " - }, - { - "kind": "typeIdentifier", - "spelling": "StaticString", - "preciseIdentifier": "s:s12StaticStringV" - } - ] - }, - { - "name": "line", - "declarationFragments": [ - { - "kind": "identifier", - "spelling": "line" - }, - { - "kind": "text", - "spelling": ": " - }, - { - "kind": "typeIdentifier", - "spelling": "UInt", - "preciseIdentifier": "s:Su" - } - ] - } - ], - "returns": [ - { - "kind": "typeIdentifier", - "spelling": "T" - } - ] - }, - "swiftGenerics": { - "parameters": [ - { - "name": "T", - "index": 0, - "depth": 1 - } - ], - "constraints": [ - { - "kind": "conformance", - "lhs": "T", - "rhs": "Sendable", - "rhsPrecise": "s:s8SendableP" - } - ] - }, - "swiftExtension": { - "extendedModule": "_Concurrency", - "typeKind": "swift.protocol" - }, - "declarationFragments": [ - { - "kind": "attribute", - "spelling": "nonisolated" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "keyword", - "spelling": "func" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "identifier", - "spelling": "assumeIsolated" - }, - { - "kind": "text", - "spelling": "<" - }, - { - "kind": "genericParameter", - "spelling": "T" - }, - { - "kind": "text", - "spelling": ">(" - }, - { - "kind": "externalParam", - "spelling": "_" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "internalParam", - "spelling": "operation" - }, - { - "kind": "text", - "spelling": ": (" - }, - { - "kind": "keyword", - "spelling": "isolated" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "typeIdentifier", - "spelling": "Self" - }, - { - "kind": "text", - "spelling": ") " - }, - { - "kind": "keyword", - "spelling": "throws" - }, - { - "kind": "text", - "spelling": " -> " - }, - { - "kind": "typeIdentifier", - "spelling": "T" - }, - { - "kind": "text", - "spelling": ", " - }, - { - "kind": "externalParam", - "spelling": "file" - }, - { - "kind": "text", - "spelling": ": " - }, - { - "kind": "typeIdentifier", - "spelling": "StaticString", - "preciseIdentifier": "s:s12StaticStringV" - }, - { - "kind": "text", - "spelling": " = " - }, - { - "kind": "keyword", - "spelling": "#fileID" - }, - { - "kind": "text", - "spelling": ", " - }, - { - "kind": "externalParam", - "spelling": "line" - }, - { - "kind": "text", - "spelling": ": " - }, - { - "kind": "typeIdentifier", - "spelling": "UInt", - "preciseIdentifier": "s:Su" - }, - { - "kind": "text", - "spelling": " = " - }, - { - "kind": "keyword", - "spelling": "#line" - }, - { - "kind": "text", - "spelling": ") " - }, - { - "kind": "keyword", - "spelling": "rethrows" - }, - { - "kind": "text", - "spelling": " -> " - }, - { - "kind": "typeIdentifier", - "spelling": "T" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "keyword", - "spelling": "where" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "typeIdentifier", - "spelling": "T" - }, - { - "kind": "text", - "spelling": " : " - }, - { - "kind": "typeIdentifier", - "spelling": "Sendable", - "preciseIdentifier": "s:s8SendableP" - } - ], - "accessLevel": "public", - "availability": [ - { - "domain": "macOS", - "introduced": { - "major": 10, - "minor": 15 - } - }, - { - "domain": "watchOS", - "introduced": { - "major": 6, - "minor": 0 - } - }, - { - "domain": "iOS", - "introduced": { - "major": 13, - "minor": 0 - } - }, - { - "domain": "tvOS", - "introduced": { - "major": 13, - "minor": 0 - } - } - ] - }, - { - "kind": { - "identifier": "swift.method", - "displayName": "Instance Method" - }, - "identifier": { - "precise": "s:9SampleLib11SimpleActorC11actorMethodyyF", - "interfaceLanguage": "swift" - }, - "pathComponents": [ - "SimpleActor", - "actorMethod()" - ], - "names": { - "title": "actorMethod()", - "subHeading": [ - { - "kind": "keyword", - "spelling": "func" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "identifier", - "spelling": "actorMethod" - }, - { - "kind": "text", - "spelling": "()" - } - ] - }, - "functionSignature": { - "returns": [ + "returns": [ { "kind": "text", "spelling": "()" @@ -3966,7 +1027,7 @@ }, { "kind": "identifier", - "spelling": "actorMethod" + "spelling": "globalFunction" }, { "kind": "text", @@ -3977,35 +1038,29 @@ "location": { "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", "position": { - "line": 30, - "character": 16 + "line": 14, + "character": 12 } } }, { "kind": { - "identifier": "swift.typealias", - "displayName": "Type Alias" + "identifier": "swift.var", + "displayName": "Global Variable" }, "identifier": { - "precise": "s:9SampleLib11GlobalAliasa", + "precise": "s:9SampleLib9globalVarSivp", "interfaceLanguage": "swift" }, "pathComponents": [ - "GlobalAlias" + "globalVar" ], "names": { - "title": "GlobalAlias", - "navigator": [ - { - "kind": "identifier", - "spelling": "GlobalAlias" - } - ], + "title": "globalVar", "subHeading": [ { "kind": "keyword", - "spelling": "typealias" + "spelling": "var" }, { "kind": "text", @@ -4013,87 +1068,23 @@ }, { "kind": "identifier", - "spelling": "GlobalAlias" - } - ] - }, - "declarationFragments": [ - { - "kind": "keyword", - "spelling": "typealias" - }, - { - "kind": "text", - "spelling": " " - }, - { - "kind": "identifier", - "spelling": "GlobalAlias" - }, - { - "kind": "text", - "spelling": " = " - }, - { - "kind": "typeIdentifier", - "spelling": "String", - "preciseIdentifier": "s:SS" - } - ], - "accessLevel": "public", - "location": { - "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", - "position": { - "line": 32, - "character": 17 - } - } - }, - { - "kind": { - "identifier": "swift.func", - "displayName": "Function" - }, - "identifier": { - "precise": "s:9SampleLib14globalFunctionyyF", - "interfaceLanguage": "swift" - }, - "pathComponents": [ - "globalFunction()" - ], - "names": { - "title": "globalFunction()", - "subHeading": [ - { - "kind": "keyword", - "spelling": "func" + "spelling": "globalVar" }, { "kind": "text", - "spelling": " " - }, - { - "kind": "identifier", - "spelling": "globalFunction" + "spelling": ": " }, { - "kind": "text", - "spelling": "()" - } - ] - }, - "functionSignature": { - "returns": [ - { - "kind": "text", - "spelling": "()" + "kind": "typeIdentifier", + "spelling": "Int", + "preciseIdentifier": "s:Si" } ] }, "declarationFragments": [ { "kind": "keyword", - "spelling": "func" + "spelling": "var" }, { "kind": "text", @@ -4101,19 +1092,24 @@ }, { "kind": "identifier", - "spelling": "globalFunction" + "spelling": "globalVar" }, { "kind": "text", - "spelling": "()" + "spelling": ": " + }, + { + "kind": "typeIdentifier", + "spelling": "Int", + "preciseIdentifier": "s:Si" } ], "accessLevel": "public", "location": { "uri": "file:///sdk-root/Sources/SampleLib/SampleLib.swift", "position": { - "line": 33, - "character": 12 + "line": 15, + "character": 11 } } } diff --git a/scripts/capability-matrix/test/normalize-symbolgraph.test.ts b/scripts/capability-matrix/test/normalize-symbolgraph.test.ts index df6ec2b..32a5ae4 100644 --- a/scripts/capability-matrix/test/normalize-symbolgraph.test.ts +++ b/scripts/capability-matrix/test/normalize-symbolgraph.test.ts @@ -102,29 +102,6 @@ describe("kind mapping — properties and variables", () => { }); }); -// --------------------------------------------------------------------------- -// Access level filter -// --------------------------------------------------------------------------- - -describe("access level filter", () => { - it("includes public symbols", () => { - const { symbols } = normalizeSymbolGraph([sym("swift.class", "public", ["PubClass"])], ""); - expect(symbols).toHaveLength(1); - }); - it("includes open symbols", () => { - const { symbols } = normalizeSymbolGraph([sym("swift.class", "open", ["OpenClass"])], ""); - expect(symbols).toHaveLength(1); - }); - it("excludes internal symbols", () => { - const { symbols } = normalizeSymbolGraph([sym("swift.class", "internal", ["InternalClass"])], ""); - expect(symbols).toHaveLength(0); - }); - it("excludes private symbols", () => { - const { symbols } = normalizeSymbolGraph([sym("swift.method", "private", ["MyClass", "secret()"])], ""); - expect(symbols).toHaveLength(0); - }); -}); - // --------------------------------------------------------------------------- // Skipped kinds // --------------------------------------------------------------------------- @@ -231,9 +208,6 @@ describe("real fixture smoke test", () => { it("includes OpenClass from fixture (open access level)", () => { expect(symbols.map(s => s.name)).toContain("OpenClass"); }); - it("excludes InternalClass from fixture", () => { - expect(symbols.map(s => s.name)).not.toContain("InternalClass"); - }); it("includes globalFunction from fixture", () => { expect(symbols.map(s => s.name)).toContain("globalFunction"); }); From f56ba9e0ae241fc733beda72aa1302e820899bff Mon Sep 17 00:00:00 2001 From: Guilherme Souza Date: Tue, 23 Jun 2026 07:34:07 -0300 Subject: [PATCH 14/14] refactor(parsers): remove access-level filter from normalizer --minimum-access-level public on dump-symbol-graph ensures only public/open symbols reach the normalizer. Remove the accessLevel field from SymbolGraphSymbol and the redundant filter loop in normalizeSymbolGraph. --- .../src/normalize-symbolgraph.ts | 3 - .../test/normalize-symbolgraph.test.ts | 56 +++++++++---------- 2 files changed, 27 insertions(+), 32 deletions(-) diff --git a/scripts/capability-matrix/src/normalize-symbolgraph.ts b/scripts/capability-matrix/src/normalize-symbolgraph.ts index e9e4f15..e1cd95b 100644 --- a/scripts/capability-matrix/src/normalize-symbolgraph.ts +++ b/scripts/capability-matrix/src/normalize-symbolgraph.ts @@ -4,7 +4,6 @@ export type { ParsedSymbol, ParseResult }; export interface SymbolGraphSymbol { kind: { identifier: string }; - accessLevel: string; pathComponents: string[]; location?: { uri: string }; } @@ -39,8 +38,6 @@ export function normalizeSymbolGraph( const result: ParsedSymbol[] = []; for (const sym of symbols) { - if (sym.accessLevel !== "public" && sym.accessLevel !== "open") continue; - const kind = KIND_MAP[sym.kind.identifier]; if (kind === undefined) continue; diff --git a/scripts/capability-matrix/test/normalize-symbolgraph.test.ts b/scripts/capability-matrix/test/normalize-symbolgraph.test.ts index 32a5ae4..78d4c5c 100644 --- a/scripts/capability-matrix/test/normalize-symbolgraph.test.ts +++ b/scripts/capability-matrix/test/normalize-symbolgraph.test.ts @@ -9,13 +9,11 @@ const __dirname = dirname(fileURLToPath(import.meta.url)); // Helper to build a minimal SymbolGraphSymbol for inline tests. function sym( identifier: string, - accessLevel: string, pathComponents: string[], uri?: string, ): SymbolGraphSymbol { return { kind: { identifier }, - accessLevel, pathComponents, ...(uri ? { location: { uri } } : {}), }; @@ -27,77 +25,77 @@ function sym( describe("kind mapping — types", () => { it("maps swift.class to 'class'", () => { - const { symbols } = normalizeSymbolGraph([sym("swift.class", "public", ["MyClass"])], ""); + const { symbols } = normalizeSymbolGraph([sym("swift.class", ["MyClass"])], ""); expect(symbols[0]).toMatchObject({ name: "MyClass", kind: "class" }); }); it("maps swift.struct to 'class'", () => { - const { symbols } = normalizeSymbolGraph([sym("swift.struct", "public", ["MyStruct"])], ""); + const { symbols } = normalizeSymbolGraph([sym("swift.struct", ["MyStruct"])], ""); expect(symbols[0]).toMatchObject({ name: "MyStruct", kind: "class" }); }); it("maps swift.enum to 'class'", () => { - const { symbols } = normalizeSymbolGraph([sym("swift.enum", "public", ["MyEnum"])], ""); + const { symbols } = normalizeSymbolGraph([sym("swift.enum", ["MyEnum"])], ""); expect(symbols[0]).toMatchObject({ name: "MyEnum", kind: "class" }); }); it("maps swift.protocol to 'class'", () => { - const { symbols } = normalizeSymbolGraph([sym("swift.protocol", "public", ["MyProto"])], ""); + const { symbols } = normalizeSymbolGraph([sym("swift.protocol", ["MyProto"])], ""); expect(symbols[0]).toMatchObject({ name: "MyProto", kind: "class" }); }); it("maps swift.actor to 'class'", () => { - const { symbols } = normalizeSymbolGraph([sym("swift.actor", "public", ["MyActor"])], ""); + const { symbols } = normalizeSymbolGraph([sym("swift.actor", ["MyActor"])], ""); expect(symbols[0]).toMatchObject({ name: "MyActor", kind: "class" }); }); }); describe("kind mapping — callables", () => { it("maps swift.func (top-level) to 'function'", () => { - const { symbols } = normalizeSymbolGraph([sym("swift.func", "public", ["globalFn()"])], ""); + const { symbols } = normalizeSymbolGraph([sym("swift.func", ["globalFn()"])], ""); expect(symbols[0]).toMatchObject({ name: "globalFn", kind: "function" }); }); it("maps swift.func.op to 'function'", () => { - const { symbols } = normalizeSymbolGraph([sym("swift.func.op", "public", ["==(_:_:)"])], ""); + const { symbols } = normalizeSymbolGraph([sym("swift.func.op", ["==(_:_:)"])], ""); expect(symbols[0]).toMatchObject({ name: "==", kind: "function" }); }); it("maps swift.method to 'method'", () => { - const { symbols } = normalizeSymbolGraph([sym("swift.method", "public", ["MyClass", "doThing()"])], ""); + const { symbols } = normalizeSymbolGraph([sym("swift.method", ["MyClass", "doThing()"])], ""); expect(symbols[0]).toMatchObject({ name: "MyClass.doThing", kind: "method" }); }); it("maps swift.type.method (static) to 'method'", () => { - const { symbols } = normalizeSymbolGraph([sym("swift.type.method", "public", ["MyClass", "create()"])], ""); + const { symbols } = normalizeSymbolGraph([sym("swift.type.method", ["MyClass", "create()"])], ""); expect(symbols[0]).toMatchObject({ name: "MyClass.create", kind: "method" }); }); it("maps swift.init to 'method' and strips signature", () => { - const { symbols } = normalizeSymbolGraph([sym("swift.init", "public", ["MyClass", "init(url:key:)"])], ""); + const { symbols } = normalizeSymbolGraph([sym("swift.init", ["MyClass", "init(url:key:)"])], ""); expect(symbols[0]).toMatchObject({ name: "MyClass.init", kind: "method" }); }); it("maps swift.subscript to 'method'", () => { - const { symbols } = normalizeSymbolGraph([sym("swift.subscript", "public", ["MyClass", "subscript(_:)"])], ""); + const { symbols } = normalizeSymbolGraph([sym("swift.subscript", ["MyClass", "subscript(_:)"])], ""); expect(symbols[0]).toMatchObject({ name: "MyClass.subscript", kind: "method" }); }); }); describe("kind mapping — properties and variables", () => { it("maps swift.property to 'property'", () => { - const { symbols } = normalizeSymbolGraph([sym("swift.property", "public", ["MyClass", "value"])], ""); + const { symbols } = normalizeSymbolGraph([sym("swift.property", ["MyClass", "value"])], ""); expect(symbols[0]).toMatchObject({ name: "MyClass.value", kind: "property" }); }); it("maps swift.type.property (static) to 'property'", () => { - const { symbols } = normalizeSymbolGraph([sym("swift.type.property", "public", ["MyClass", "shared"])], ""); + const { symbols } = normalizeSymbolGraph([sym("swift.type.property", ["MyClass", "shared"])], ""); expect(symbols[0]).toMatchObject({ name: "MyClass.shared", kind: "property" }); }); it("maps swift.enum.case to 'property'", () => { - const { symbols } = normalizeSymbolGraph([sym("swift.enum.case", "public", ["MyEnum", "alpha"])], ""); + const { symbols } = normalizeSymbolGraph([sym("swift.enum.case", ["MyEnum", "alpha"])], ""); expect(symbols[0]).toMatchObject({ name: "MyEnum.alpha", kind: "property" }); }); it("maps swift.typealias to 'variable'", () => { - const { symbols } = normalizeSymbolGraph([sym("swift.typealias", "public", ["MyClass", "Callback"])], ""); + const { symbols } = normalizeSymbolGraph([sym("swift.typealias", ["MyClass", "Callback"])], ""); expect(symbols[0]).toMatchObject({ name: "MyClass.Callback", kind: "variable" }); }); it("maps swift.associatedtype to 'variable'", () => { - const { symbols } = normalizeSymbolGraph([sym("swift.associatedtype", "public", ["MyProto", "Item"])], ""); + const { symbols } = normalizeSymbolGraph([sym("swift.associatedtype", ["MyProto", "Item"])], ""); expect(symbols[0]).toMatchObject({ name: "MyProto.Item", kind: "variable" }); }); it("maps swift.var (global) to 'variable'", () => { - const { symbols } = normalizeSymbolGraph([sym("swift.var", "public", ["globalVar"])], ""); + const { symbols } = normalizeSymbolGraph([sym("swift.var", ["globalVar"])], ""); expect(symbols[0]).toMatchObject({ name: "globalVar", kind: "variable" }); }); }); @@ -108,11 +106,11 @@ describe("kind mapping — properties and variables", () => { describe("skipped kinds", () => { it("skips swift.deinit", () => { - const { symbols } = normalizeSymbolGraph([sym("swift.deinit", "public", ["MyClass", "deinit"])], ""); + const { symbols } = normalizeSymbolGraph([sym("swift.deinit", ["MyClass", "deinit"])], ""); expect(symbols).toHaveLength(0); }); it("skips unrecognised kind identifiers", () => { - const { symbols } = normalizeSymbolGraph([sym("swift.unknown.thing", "public", ["Something"])], ""); + const { symbols } = normalizeSymbolGraph([sym("swift.unknown.thing", ["Something"])], ""); expect(symbols).toHaveLength(0); }); }); @@ -124,25 +122,25 @@ describe("skipped kinds", () => { describe("name construction", () => { it("joins pathComponents with '.'", () => { const { symbols } = normalizeSymbolGraph( - [sym("swift.method", "public", ["SupabaseClient", "signIn(email:password:)"])], "" + [sym("swift.method", ["SupabaseClient", "signIn(email:password:)"])], "" ); expect(symbols[0].name).toBe("SupabaseClient.signIn"); }); it("handles deeply nested types", () => { const { symbols } = normalizeSymbolGraph( - [sym("swift.property", "public", ["Outer", "Inner", "value"])], "" + [sym("swift.property", ["Outer", "Inner", "value"])], "" ); expect(symbols[0].name).toBe("Outer.Inner.value"); }); it("strips trailing function signature from last pathComponent", () => { const { symbols } = normalizeSymbolGraph( - [sym("swift.method", "public", ["Auth", "signUp(email:password:captchaToken:)"])], "" + [sym("swift.method", ["Auth", "signUp(email:password:captchaToken:)"])], "" ); expect(symbols[0].name).toBe("Auth.signUp"); }); it("leaves non-function pathComponents unchanged", () => { const { symbols } = normalizeSymbolGraph( - [sym("swift.property", "public", ["Auth", "session"])], "" + [sym("swift.property", ["Auth", "session"])], "" ); expect(symbols[0].name).toBe("Auth.session"); }); @@ -156,11 +154,11 @@ describe("file path resolution", () => { it("strips 'file://' prefix and makes path relative to sdkRoot", () => { const sdkRoot = "/home/runner/work/supabase-swift"; const uri = `file://${sdkRoot}/Sources/Auth/AuthClient.swift`; - const { symbols } = normalizeSymbolGraph([sym("swift.class", "public", ["Auth"], uri)], sdkRoot); + const { symbols } = normalizeSymbolGraph([sym("swift.class", ["Auth"], uri)], sdkRoot); expect(symbols[0].file).toBe("Sources/Auth/AuthClient.swift"); }); it("returns empty string when location is absent", () => { - const { symbols } = normalizeSymbolGraph([sym("swift.class", "public", ["Auth"])], "/any/root"); + const { symbols } = normalizeSymbolGraph([sym("swift.class", ["Auth"])], "/any/root"); expect(symbols[0].file).toBe(""); }); }); @@ -172,8 +170,8 @@ describe("file path resolution", () => { describe("multi-symbol input", () => { it("handles symbols from multiple modules in merged flat array", () => { const input: SymbolGraphSymbol[] = [ - sym("swift.class", "public", ["ClassFromAuth"]), - sym("swift.struct", "public", ["StructFromStorage"]), + sym("swift.class", ["ClassFromAuth"]), + sym("swift.struct", ["StructFromStorage"]), ]; const { symbols } = normalizeSymbolGraph(input, ""); const names = symbols.map(s => s.name);