Skip to content

Drop dangling local symbol occurrences - #491

Open
eseliger wants to merge 1 commit into
relationship-symbol-informationfrom
local-symbol-information
Open

Drop dangling local symbol occurrences#491
eseliger wants to merge 1 commit into
relationship-symbol-informationfrom
local-symbol-information

Conversation

@eseliger

@eseliger eseliger commented Aug 22, 2026

Copy link
Copy Markdown
Member

Concrete failure before this change

Given two indexed packages:

// package A
export function localResult() {
  interface LocalResult {
    value: string
  }
  return { value: '' } as LocalResult
}

// package B
localResult().value

Package B previously emitted a reference local 1 occurrence for value, but its document contained no SymbolInformation for local 1. SCIP local symbols are scoped to one document, so package A's local symbol could not satisfy that reference. This change drops that dangling cross-document occurrence while preserving the valid local definitions and references inside package A.

Longer-term

Ideally, package B's value reference should navigate to the LocalResult.value definition in package A. SCIP can represent that by assigning the private property a stable declaration-derived global identity—global in the SCIP uniqueness sense, not exported in the TypeScript visibility sense—likely owned by the exported function whose return type exposes it. Both the definition in package A and references in other documents would then use that identity.

That promotion requires deterministic handling for private declarations exposed through exported inferred or structural types. This PR intentionally implements the safe correctness fallback first: omitting an unrepresentable reference is preferable to emitting an invalid dangling local symbol.

@eseliger eseliger changed the title local symbol information Drop dangling local symbol occurrences Aug 22, 2026
@eseliger
eseliger force-pushed the local-symbol-information branch from 8d7f430 to 5373ad1 Compare August 23, 2026 00:09
@eseliger
eseliger force-pushed the local-symbol-information branch from 5373ad1 to 3d0f16e Compare August 23, 2026 00:50
@eseliger
eseliger marked this pull request as ready for review August 23, 2026 00:53
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