Skip to content

Report nested types in scan-exports - #73

Merged
tsapeta merged 2 commits into
mainfrom
tsapeta1/eng-27128-scanner-report-nested-enumerable-enums-records-unions-and
Oct 11, 2026
Merged

tsapeta merged 2 commits into
mainfrom
tsapeta1/eng-27128-scanner-report-nested-enumerable-enums-records-unions-and

Conversation

@tsapeta

@tsapeta tsapeta commented Oct 11, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes ENG-27128.

scan-exports only reported file-scope declarations. An Enumerable enum, @Record, @Union, or @SharedObject declared inside another type was missing, so every ref to it stayed unresolved (Encoding in expo-crypto's DigestOptions, NotificationType and ImpactStyle in expo-haptics' module).

  • The surface visitor now walks type bodies (class, struct, enum, actor) and file-scope extensions. A nested type is reported under its qualified Swift name, for example Options.Encoding. A default jsName stays the declared name, as the macros spell it. Types local to a function body or a closure are still skipped.
  • Only a file-scope @ExpoModule is reported, because autolinking registers no other.
  • A ref resolves the way Swift looks a name up: from the type it is written in, outward to file scope (Self.X starts at the type itself). Encoding in Options finds Options.Encoding before a file-scope Encoding. A qualifier the scan does not declare is still dropped (Media.Status finds Status).
  • A resolved ref's name is now the qualified name of its declaration, so a consumer finds the declaration by an exact match. A module's classes entry takes the qualified name of its shared object the same way. schemaVersion is now 7, and src/types.ts follows.

Test Plan

swift test in apple/ passes, with new tests for nested types, types in extensions, local types, scoped lookup and shadowing, and a module class nested in its module, and Self.-qualified refs. npm run typecheck passes.

@linear-code

linear-code Bot commented Oct 11, 2026

Copy link
Copy Markdown

ENG-27128

@tsapeta
tsapeta marked this pull request as ready for review October 11, 2026 16:04
An `Enumerable` enum, `@Record`, `@Union`, or `@SharedObject` declared in another type's body or in a file-scope `extension` is now reported under its qualified Swift name (`Options.Encoding`). Refs resolve from the type they are written in, outward to file scope, and a resolved ref takes the qualified name of its declaration. `schemaVersion` is now 7.
Give a module class the qualified name of its shared object, resolve `Self.`-qualified refs, skip a nested `@ExpoModule` outright, and stop walking function bodies, accessors, and closures. `RefIndex` keeps one table.
@tsapeta
tsapeta force-pushed the tsapeta1/eng-27128-scanner-report-nested-enumerable-enums-records-unions-and branch from b284170 to 9074c70 Compare October 11, 2026 17:30
@tsapeta
tsapeta merged commit 24a525d into main Oct 11, 2026
3 checks passed
@tsapeta
tsapeta deleted the tsapeta1/eng-27128-scanner-report-nested-enumerable-enums-records-unions-and branch October 11, 2026 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant