Skip to content

Language record

Swift

Swift is indexed with extensions and protocols treated as real structure: an extension is its own symbol carrying the type it extends, a protocol is recorded as an interface, and a self.init or super.init is a construction rather than a call.

.swift · 1 registry id · 11 of 14 relationship types

The registry row this page is generated from

Read at render time from the same family row the register reads, so nothing in this block can disagree with it.

Extensions
.swift
Registry names
swift
Recorded symbols
classes · protocols · methods · constructors

Relationship types this analyzer constructs

11 of 14 constructed, read from this analyzer's source and re-derived by the languages gate. Each row below is one of the engine's types, in the engine's own order.

Relationship typeConstructed
callsconstructed by this analyzer
extendsconstructed by this analyzer
implementsconstructed by this analyzer
usesconstructed by this analyzer
importsconstructed by this analyzer
exportsconstructed by this analyzer
containsconstructed by this analyzer
referencesconstructed by this analyzer
overridesconstructed by this analyzer
instantiatesconstructed by this analyzer
decoratesruled absent
rendersconstructed by this analyzer
mixes_inruled absent
part_ofruled absent

11 constructed, 3 not constructed. All 3 absent types are recorded as ruled absent: the written reason and the corpus measurement behind each are in this family's completeness record. The register explains what each label means.

What this analyzer does not resolve

  • Override resolution runs in three tiers — an exact match inside the file, then the shared companion index, then a deterministic first-parent guess. The last tier is published at reduced confidence precisely because the parent may not declare that member at all.
  • A member call resolves to its written leaf: users.first is a call to first with no owner, so an extension method and a member method of the same name are one target in the graph.
  • Initializer delegation is never a call edge, because init is a keyword rather than a name in this vocabulary — so which initializer chains to which is not a question the graph answers. deinit and subscript declarations publish no symbols either.

Every line above was written against Swift’s own analyzer module and is named against a construct in it, so it can be checked against the source. Nothing here is inherited from a template, or from another language’s page.

Where you meet it in a repository

Recognised by extension — .swift. Everything below is about where those files actually sit in a working repository.

  • Swift reopens a type across many files: the declaration is in one, its behaviour in an extension per protocol in the others.
  • SwiftUI state is declared with property wrappers such as @State and @Published, so the attribute often says more than the property's own type does.
  • Backtick-escaped keywords are legal identifiers, and bb strips the backticks so a published name matches how the case is actually written.

Questions this index answers

Phrased as retrievals, because that is what an index can honestly do: it holds the symbols and the edges between them, and hands them back with the evidence attached.

  1. Which protocols does this type adopt?
  2. Which methods does this extension add to the type?
  3. Where is this initializer reached from?
  4. Which enum case does this expression construct?

What the analyzer sees in code like this

A protocol, the extension that adopts it, and a struct's stored property
protocol Cacheable {                       // bb records: interface Cacheable
    func load() -> Data
}

extension Cache: Cacheable {          // bb records: extension Cache · method load
    func load() -> Data { return Data() }
}

struct Entry { var id: Int }          // bb records: struct Entry · property id

Symbols are stored with the file they came from and the bytes they span, so a hit points at a line rather than at a guess. The annotations in the sample are commentary for the reader, not strings the index would store.

Languages that turn up in the same repository

Application & systems — the count beside each name is how many relationship types that family’s analyzer constructs.

The extensions, registry names, recorded symbols and relationship types above are the parser registry row for Swift, read while the page rendered — the same row the register reads, so the two surfaces cannot tell two stories. Every relationship type listed as constructed appears in src/ast/real-*, the analyzer modules bb ships. bb 0.1.0 answers from a local store over 50 languages (53 registry ids, three of them aliases). There is no benchmark on this page: every claim here is one you can go and read in the source.