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

UnusedImports: fix false positive for unresolved imports #4882

Merged
merged 1 commit into from Jul 16, 2022
Merged

UnusedImports: fix false positive for unresolved imports #4882

merged 1 commit into from Jul 16, 2022

Commits on Jun 1, 2022

  1. UnusedImports: fix false positive for unresolved imports

    Fix a false positive where UnusedImports would report extension function imports whose signature cannot be resolved by the BindingContext. This can happen for autogenerated classes, etc. (especially Android UI binding classes and the like).
    
    To do this we need to generate text matchers for all the references which cannot be resolved and check if there are any unresolved matches to them, similar to the approach without type resolution.
    
    Along the way, extract mappings inside `KtImportDirective.isNotUsed()` to lazy properties to avoid recalculating them for each import directive. Also make sure to map to a set for constant rather than linear lookup time.
    dzirbel committed Jun 1, 2022
    Copy the full SHA
    1ab8b53 View commit details
    Browse the repository at this point in the history