In Analysis API, enum entries are considered callables, but they do not
have receivers when you resolve them, so we have to check
their dispatch type differently (similar to static declarations from Java)
^KTIJ-31105 Fixed
GitOrigin-RevId: c1cc12130109e2582113d16eb5de5b017089af87
Regular non-static declarations are always dispatched with implicit
receivers; thus, it is enough to find a compatible type in the
implicit receivers list to check if the declaration
is indeed imported or just dispatched.
On the other hand, static declarations do not depend on implicit receivers at all;
instead, they come from scopes which can be introduced only by extending a
Java class with static declarations.
So we have to traverse the scopes to do the check.
^KTIJ-30883 Fixed
GitOrigin-RevId: e2efe818ed45d34e8d3f3778dcb280d575378df9
Due to KT-70949, both "Unused Import" inspection and Import Optimizer
worked incorrectly with nested classes declared in Java.
^KTIJ-31106 Fixed
GitOrigin-RevId: ee93554de5fa15c756137e91217f7d29081f2a12
This is a temporary solution to avoid removing such classes imports,
while the full conflicts resolution from KTIJ-30991 is not implemented yet
^KTIJ-31070 Fixed
GitOrigin-RevId: d5c7dccaf30af8caa65eb2d47713a1aa9a11fbb2
Those operators are not properly resolvable in K2 Mode
with Analysis API.
The workaround should be removed when KT-70774 is fixed.
^KTIJ-31026 Fixed
GitOrigin-RevId: c2ca2ca0f84bb31355205515eeb147785ddbe4a8
Currently, KDocs can be unresolved in a lot of places,
particularly due to the KT-61785.
To avoid problems with imports optimization,
we ignore such references and do not consider them
to yield any `unresolvedNames`
GitOrigin-RevId: e018f32f4e681d50d35906e33a8669463dd8eefc
This is not all the conflicts resolution that is
required for 100% correct Import Optimizer
implementation, but it suffices most of the time.
GitOrigin-RevId: 7732d85966c678efe2ffe7f78328daed50622af9
Such references have broken `resolveToSymbols` implementation (see KT-70476),
so they introduced incorrect `unresolvedNames`.
Ignoring them completely should fix the problem.
^KTIJ-30878 Fixed
GitOrigin-RevId: 74d76a9c1ea8c8092a44c6c5e6b2e5cc0950e5ce
For invoke operators coming from builtin functional types,
`resolveToSymbols` will return an empty list, and it seems like
an intentional design.
We have to deal with this for now.
GitOrigin-RevId: a81a82cdf3399f8c24edc4aeac0e4c4c61fe402b
Nested classifiers, if they are resolved, will be already
accessible even without the imports; so there's no need
to keep the imports for them.
^KTIJ-26752 Fixed
GitOrigin-RevId: f942edcf6e92fdc0c13d37a08cf4274811ceece9
Add more tests for Import Optimizer, and unmute
one of the now passing Move refactoring tests
GitOrigin-RevId: f882a77a02bfc2189c916f79180a831b8fbd9346
There are currently no good utility in AA to do the
"SAM constructor -> SAM type" navigation;
see KT-70301.
GitOrigin-RevId: a61ee3949f7892cf19276bf7bfcdc5c9f2c8105f
Currently, due to KTIJ-26098, if the constructor is invoked via the typealias,
the reference resolves directly to the constructed class, and not to the
typealias.
This prevented `UsedReferencesCollector` from properly recognizing such references.
To handle this, we resolve the type explicitly when we see constructor calls
by using code fragments.
This works because type references work fine with typealiases (compared
to constructor references).
Also, add an explicit test for currently incorrect optimization
of `kotlin.concurrent.Volatile` import.
^KTIJ-25346 Fixed
GitOrigin-RevId: f531c00cba6d7e6687a45ae06aa9ac85a92262a3
The testdata is mostly inspired by testdata from the `kotlin.git` repository, namely from the
"analysis/analysis-api/testData/components/importOptimizer/analyseImports"
If the migration proves to be successful, all the testdata should migrate to the `intellij`
repo, and more granular tests should be introduced
GitOrigin-RevId: d92d508f99a0df5dcac37883814e3288af9e32ee
K2 `analysisScope` of `KaSession` does not contain scopes provided by
`KotlinScopeEnlarger` for `GlobalSearchScope`. As a result, the
`KotlinScopeEnlarger` registered by Android Studio to support the
completion is not triggered when app has class symbols generated from
resources whose scope is supposed to be added by the
`KotlinScopeEnlarger`. This commit enlarges the search scope inside
`IdeKotlinByModulesResolutionScopeProvider` with the registered
`KotlinScopeEnlarger`.
^KTIJ-30502
GitOrigin-RevId: 8c5083910de1450b6c3dbcd4395bdc8bf9b32045