Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gazelle/kotln: Fix import resolution to use ancestor packages #753

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

gonzojive
Copy link

When a Kotlin file imports "xyz.abc.foo.Bar.Baz", gazelle will only resolve the import successfully if "xyz.abc.foo.Bar" can be resolved to a Bazel label.

The plugin should also check if "xyz.abc.foo", "xyz.abc", or "xyz" resolve to a bazel label.


Changes are visible to end-users: yes

  • Searched for relevant documentation and updated as needed: yes
  • Breaking change (forces users to change their own code or config): no? (bug fix to match user expectations)
  • Suggested release notes appear below: yes/no

Test plan

  • New test cases added: gazelle/kotlin/tests/deep_import/ gazelle test.

When a Kotlin file imports "xyz.abc.foo.Bar.Baz", gazelle will only resolve the
import successfully if "xyz.abc.foo.Bar" can be resolved to a Bazel label.

The plugin should also check if "xyz.abc.foo", "xyz.abc", or "xyz" resolve
to a bazel label.
TODO: update import parsing to match the Kotlin spec for 'identifier' (see
packageHeader and importHeader at
https://kotlinlang.org/spec/syntax-and-grammar.html#grammar-rule-packageHeader).
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