Skip to content

Import resolution (kotlin): an import of a function overloaded across files of one package draws no edge #4125

Closed

Description

@squid-protocol

What

A Kotlin import of a top-level function that is overloaded across several files of one package draws no import edge.

NetworkRiskSensor._resolve_declaration (#3596) returns a file only when exactly one file in the package declares the name (hits[0] if len(hits) == 1 else None). Kotlin's import a.b.name imports every top-level overload of name in package a.b. So when two files declare it, the statement depends on both, and the engine draws neither edge.

Evidence

Graph comparison ledger shape kotlin/import/truth-names-several-files/agree[tree_sitter]_vs[gitgalaxy] (1 occurrence, #3799), kotlinpoet@57073846d05b:

  • interop/ksp/test-processor/.../TestProcessor.kt:47 import com.squareup.kotlinpoet.ksp.toKModifier
  • interop/ksp/src/main/kotlin/com/squareup/kotlinpoet/ksp/Modifiers.kt:55 public fun Modifier.toKModifier()
  • interop/ksp/src/main/kotlin/com/squareup/kotlinpoet/ksp/Visibilities.kt:27 public fun Visibility.toKModifier()

TestProcessor uses both overloads: decl.getVisibility().toKModifier() at line 86 (Visibilities.kt) and decl.modifiers.mapNotNull { it.toKModifier() } at line 87 (Modifiers.kt). The import really joins it to both files.

Fix direction (needs a design call)

The resolver maps one token to one file. Two options:

  • emit an edge to every declaring file in the package, which needs a token-to-many path through the import pipeline;
  • or pick one file deterministically.

Same-package overloads are not the C8 build-variant case (#3665) and not a symlink (objective-c), so neither existing narrowing applies.

Activity

  1. added
    bug
    core-engine
    metrics
    priority: low
    on Oct 3, 2026
  2. added
    scope:frontier
    on Oct 16, 2026
  3. squid-protocol commented on Oct 27, 2026

    @squid-protocol
    OwnerAuthor

    Waiting on an owner decision (asked privately, 2026-10-27). Nothing is needed from contributors; work resumes once it is answered.

  4. added 2 commits that reference this issue on Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcore-enginemetricspriority: lowscope:frontier

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions