graphify icon indicating copy to clipboard operation
graphify copied to clipboard

Swift builtins: broaden coverage (SwiftUI views, property wrappers) and scope per-language

Open safishamsi opened this issue 4 months ago • 1 comments

Follow-up to #2147 / #2149 (Swift/Foundation/SwiftUI builtin filtering).

  1. Coverage: add SwiftUI views (Text, Image, Button, VStack/HStack/ZStack, List, Spacer), property wrappers / Combine (State, Binding, Published, ObservedObject, StateObject, ObservableObject), concurrency (Task, MainActor), and common stdlib/CG/Foundation types (Dictionary, Result, CGFloat/CGRect/CGSize/CGPoint, Timer, Notification).
  2. Scoping (the real fix): _LANGUAGE_BUILTIN_GLOBALS is shared across languages, so adding Swift names suppresses a JS/Python project's own Color/Data/Text constructor edges. Migrate Swift to a per-language builtin set consulted only when the source file is .swift, and scope the god-node label filter by the node's source extension. This unblocks adding high-collision names like Task/Text.
  3. Two maintainer calls: whether _swift_classify_base should skip implements edges to builtin protocols (closes the still-open Sendable path-bridge repro in #2147), and whether the Swift type-ref rewire should get the same builtin guard as the member-call resolver (closes the residual references[field] bind).

safishamsi avatar Jul 25 '26 21:07 safishamsi

Hi — I'd like to take this if it's still free. Before coding I want to confirm scope so we don't fight #2313 or guess the two maintainer calls in (3).

My reading of the issue:

  1. Coverage — broaden the Swift/SwiftUI/Foundation builtin lists (views, property wrappers, concurrency, CG/stdlib types).
  2. Scoping — the real fix: stop consulting Swift names from a shared _LANGUAGE_BUILTIN_GLOBALS for every language; only apply them for .swift sources, and scope the god-node noise filter by source extension.
  3. Two open product calls — (a) should _swift_classify_base skip implements edges to builtin protocols (Sendable path-bridge leftover from #2147)? (b) should Swift type-ref rewire get the same builtin guard as the member-call resolver?

Proposed approach (happy to adjust):

  • Land (1) first as a focused PR with fixtures/tests in the existing test_swift_builtin_noise shape, without yet adding high-collision names that only make sense after (2) (Text/Task/etc. stay gated until scoping exists).
  • For (2), treat it as a follow-up PR and align with #2313 — i.e. not a naive global per-language split that resurrects phantom Error/set-class edges elsewhere. Prefer Swift-only consultation at the Swift resolution sites + extension-scoped god-node filter, unless you'd rather wait for the multi-definition guard in #2313 first.
  • Hold the two items in (3) until you call them; I won't change implements → Sendable or type-ref rewire without an explicit yes/no.

Questions before I start:

  1. Is this issue still unclaimed / OK for me to work?
  2. OK to ship coverage (1) first, then scoping (2), as separate PRs against v8?
  3. For (3a) and (3b): yes / no / later?

Happy to revise the plan if you want scoping first, or a different cut.

nothariharan avatar Aug 05 '26 02:08 nothariharan