Commit Graph

1580 Commits

Author SHA1 Message Date
Mikhail Filippov
bf43f2fc01 IJPL-150165 bump Kotlin language and API version
GitOrigin-RevId: a59dc8ca214a5047773fccf1cf28a1e1b07acf68
2024-08-30 22:15:55 +00:00
Pavel Gromov
2e7f2f28b9 [kotlin] Implement tests for actual declaration completion with several targets
* #FL-26673

GitOrigin-RevId: 107663afadb72654bb5775157b2ce16ed09a207c
2024-08-27 20:55:14 +00:00
Pavel Gromov
4fd0a3ff91 [kotlin] Implement tests for actual declaration completion from several files in one package
* #FL-26673

GitOrigin-RevId: c63da9add4b3579e853cbbf6ede2092d719d2171
2024-08-27 20:55:14 +00:00
Pavel Gromov
44e9ba70ce [kotlin] Implement tests for actual declaration completion with the same package
* #FL-26673

GitOrigin-RevId: d6b36ca55f87626489e4173511c2175c0fbb4428
2024-08-27 20:55:14 +00:00
Pavel Gromov
183f7aace0 [kotlin] Implement tests for actual declaration completion
* #FL-26673

GitOrigin-RevId: 7042baa2367ae8890aeee39e7a5e6128a9b6c7dd
2024-08-27 20:55:14 +00:00
Pavel Gromov
a500d8ecf4 [kotlin] Split tests by directories
* #FL-26673

GitOrigin-RevId: 882ffff9fd2f70fef1b6301443d7f5bf5b15c8c3
2024-08-27 20:55:14 +00:00
Andrew Kozlov
4cd0e25d5c [kotlin] KTIJ-28743, KT-71009 test added
GitOrigin-RevId: 982e96f46f0865dcd52f4d6e98dd7228999a1371
2024-08-27 18:09:56 +00:00
Andrew Kozlov
5ae8b1b86d [kotlin] KTIJ-30225, KT-71009 test added
GitOrigin-RevId: bc040a5bfad11e4fc03c0bbbf7b33c226d8d49a5
2024-08-27 18:09:56 +00:00
Roman Golyshev
3bd9369d37 KTIJ-31105 [kotlin] Adapt isAccessibleAsMemberCallable to enum entries
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
2024-08-27 10:22:58 +00:00
Roman Golyshev
890e8d0773 KTIJ-30883 [kotlin] Use different checks for static and regular imported members in Import Optimizer
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
2024-08-27 10:22:58 +00:00
Roman Golyshev
56514df617 KTIJ-31106 [kotlin] Properly check containing declaration for Java classes in Import Optimizer
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
2024-08-27 10:22:57 +00:00
Roman Golyshev
511fec66a4 KTIJ-31070 [kotlin] Check classes imported by default for conflicts also
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
2024-08-23 22:01:53 +00:00
Dmitrii Gridin
60fd679c03 Merge branch 'kt-master'
GitOrigin-RevId: fa95f0dac394cd639d40cd3ad137d51550d9d0d3
2024-08-22 11:48:19 +02:00
Andrew Kozlov
995e4a51cb [kotlin] KTIJ-27976 function type case supported
GitOrigin-RevId: 96d2c25fb343cb83b44c938561167ab7b5305c84
2024-08-20 16:39:48 +00:00
Roman Golyshev
4def5d6ddb KTIJ-31026 [kotlin] Workaround for Int.unaryPlus/Int.unaryMinus operators on literals for Import Optimizer
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
2024-08-18 20:50:20 +00:00
Ilya Kirillov
d891e54d5c [kotlin] add tests for "No classifier found" exception, KT-69416
GitOrigin-RevId: 0451f1a7073e20c5b345a01820360a62af7191bd
2024-08-16 11:16:50 +02:00
Andrew Kozlov
0c7168093e [kotlin] KTIJ-27084 fixed
GitOrigin-RevId: bafbf02e465511c489388883970e365223dafd3b
2024-08-13 17:30:27 +00:00
Roman Golyshev
d810f83b4f KTIJ-26423 [kotlin] Ignore unresolved KDoc references names in K2 Import Optimizer
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
2024-08-12 09:58:57 +00:00
Roman Golyshev
003225fb6e KTIJ-26423 [kotlin] Add extra test for class conflicts with default imports
GitOrigin-RevId: f4da7ea8342b0e80fa3bcc2c9f42c311a6454a65
2024-08-12 09:58:57 +00:00
Roman Golyshev
d2ee644e48 KTIJ-26423 [kotlin] Properly resolve conflicting classes in OptimizedImportsBuilder
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
2024-08-12 09:58:57 +00:00
Roman Golyshev
c3869eaf96 KTIJ-26423 [kotlin] Override nameCountToUseStarImportDefault in AbstractFirOptimizeImportsTest
This is the behavior expected by the testdata

GitOrigin-RevId: 4136278e984284522499912b08e4cc80895c99f7
2024-08-12 09:58:57 +00:00
Ilya Kirillov
893f5823dd [kotlin] add new tests for go to symbol
KTIJ-30913

GitOrigin-RevId: bec344b54790bb60b5f34afc237e5ff6a49e5c1f
2024-08-09 19:06:53 +00:00
Gregory.Shrago
c98b16d7a2 migrate non-typesafe getData: community
GitOrigin-RevId: 9925045d5302a768b5f57d9f965c96c631d14114
2024-08-07 02:37:34 +00:00
Roman Golyshev
3a9df5c488 KTIJ-30878 [kotlin] Ignore KtDefaultAnnotationArgumentReference references during import optimization
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
2024-08-05 18:44:39 +00:00
Roman Golyshev
ff820ed565 KTIJ-26752 [kotlin] Check if KtInvokeFunctionReference is resolved by resolveToCall instead of resolveToSymbols
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
2024-08-02 12:44:46 +00:00
Roman Golyshev
2b8ca408ab KTIJ-26752 [kotlin] Consider import aliases when checking if callable is accessible as member in UsedReference
We already do that for classifiers, and should do that for
callables too

GitOrigin-RevId: 7248a211a8108bf1910220ba1ec4662a8174eb87
2024-08-02 12:44:46 +00:00
Roman Golyshev
a6c1bc2a17 KTIJ-26752 [kotlin] Filter references to the nested classifiers in UsedReference
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
2024-08-02 12:44:46 +00:00
Anna Kozlova
f94f0d5f99 [kotlin] k2: add tests on type handler
^KTIJ-26171 fixed

GitOrigin-RevId: ae8016898179df70b877077c4609211bc093372d
2024-07-31 11:08:51 +00:00
Roman Golyshev
01a4079e52 KTIJ-25346 [kotlin] Do not collect references to inner constructors in UsedReferencesCollector
Add more tests for Import Optimizer, and unmute
one of the now passing Move refactoring tests

GitOrigin-RevId: f882a77a02bfc2189c916f79180a831b8fbd9346
2024-07-30 00:13:29 +00:00
Roman Golyshev
d6d5e3888e KTIJ-25346 [kotlin] Handle typealiased constructors referencing SAM types in K2 Import Optimizer
There are currently no good utility in AA to do the
"SAM constructor -> SAM type" navigation;
see KT-70301.

GitOrigin-RevId: a61ee3949f7892cf19276bf7bfcdc5c9f2c8105f
2024-07-30 00:13:29 +00:00
Roman Golyshev
c6391f929b KTIJ-25346 [kotlin] Handle typealiased constructors in K2 Import Optimizer
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
2024-07-30 00:13:29 +00:00
Vladimir Dolzhenko
90d1ce34b7 [kotlin] Fix rendering parameter info annotations
#KTIJ-29752 Fixed

GitOrigin-RevId: 8d260a57c6baccf18cf7f5dfa1a61f77d01c17ce
2024-07-29 19:29:16 +00:00
aleksandrina-streltsova
43fdbf05e7 [kotlin] KTIJ-11469: add test
GitOrigin-RevId: 0efa023d67ef1011d5d612cd64e491ab406d9dac
2024-07-29 10:03:19 +00:00
aleksandrina-streltsova
722706dffe [kotlin] KTIJ-9157, KTIJ-15629: add tests
GitOrigin-RevId: 2c6cfb789ed5e985d3038d061d82be14a5ce21ca
2024-07-29 10:03:19 +00:00
aleksandrina-streltsova
8df299a78b [kotlin] KTIJ-9093: add test
GitOrigin-RevId: 7007ac5174d7a3647f23840bc76d451efe51d211
2024-07-29 10:03:19 +00:00
aleksandrina-streltsova
2473fbc32d [kotlin] KTIJ-9044: add test
GitOrigin-RevId: 5bbf7151bc47ab1cf83c523e1b809e4d3604cab9
2024-07-29 10:03:19 +00:00
aleksandrina-streltsova
5e05d2e68f [kotlin] KTIJ-6956: add test
GitOrigin-RevId: f68e0b53cbc9c465e54a2cdadd9cfa91d7959049
2024-07-29 10:03:19 +00:00
Anna Kozlova
11be10cacc [kotlin] k2: test data for parameter info for incomplete code
^KTIJ-30516 fixed

GitOrigin-RevId: e97ffb78bac657d085597769e4d2b1288c4c8ed5
2024-07-26 14:34:47 +00:00
Roman Golyshev
1d7750aa38 KTIJ-30581 [kotlin] Add more testdata for import optimizer to preserve the current behavior
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
2024-07-25 13:07:13 +00:00
Anna Kozlova
e9124d5314 [kotlin] k2 override/implement: take care of enum entries
^KTIJ-25970 fixed

GitOrigin-RevId: dbea6ce1ed3e5c48e1df6c548a175f8862ae22fc
2024-07-25 12:05:41 +00:00
Anna Kozlova
28345d51c0 [kotlin] k2 override/implement with suspend: test data
^KTIJ-24917 fixed

GitOrigin-RevId: ae8364fea80846f8f2c3a47750438f944699f434
2024-07-25 12:05:41 +00:00
Anna Kozlova
adde2abd9a [kotlin] k2 override/implement with java super: test data
^KTIJ-24303 fixed

GitOrigin-RevId: f563a4b68c080b6baf6e14d847ce4196de1b4e01
2024-07-25 12:05:41 +00:00
Anna Kozlova
a035b6119f [kotlin] k2 override/implement: postpone reformat until shorten references is performed
^KTIJ-30749 fixed

GitOrigin-RevId: 60a622180d020a4f14346ce3babe3538d3bb057a
2024-07-25 12:05:40 +00:00
Jaebaek Seo
ed21784ccc K2: Use KotlinScopeEnlarger for scope provider
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
2024-07-18 14:03:33 +00:00
Vladimir Dolzhenko
44e0adab8a [kotlin] Migrate to org.jetbrains.kotlin.utils.checkWithAttachment
GitOrigin-RevId: b679ab7c3d0e0edf1b8ef616075d924dd16a0024
2024-07-15 12:26:58 +00:00
Yan Zhulanow
9c7e738f14 [kotlin] Clean up type information provider deprecations in Analysis API usages
^KT-68884

GitOrigin-RevId: baa5f9529ba0eaa074d748a9cf615aa4e20df526
2024-07-12 07:39:22 +00:00
Yan Zhulanow
4c26a5ff2e [kotlin] Clean up symbol provider deprecations in Analysis API usages
^KT-68884

GitOrigin-RevId: 88ae06a8e485d6a40f99fe6511175426e766a26b
2024-07-12 07:39:21 +00:00
Yan Zhulanow
23bd2ea087 [kotlin] Migrate 'analysisSession' to 'useSiteSession'
^KT-67996

GitOrigin-RevId: 4bbcd499ea9e7ddedab2fc1229bbe4bd811e8c04
2024-07-12 07:39:21 +00:00
Yan Zhulanow
fce177b293 [kotlin] Clean up symbol deprecations in Analysis API usages
^KT-67996
^KT-68884

GitOrigin-RevId: abb3fc5a1cbbe662cc827d1dfa3359415d996987
2024-07-12 07:39:21 +00:00
Vlad Koshkin
1d84270b7b Merge IJ-MR-138941: master-813e61b202209c2216e28c3c9a58cb8b5d4c0682
GitOrigin-RevId: ddefdde60e077fe76f295f1ef496526e1ef71a95
2024-07-09 02:19:47 +00:00