Commit Graph

24 Commits

Author SHA1 Message Date
Roman Golyshev 31291fc8fa KTIJ-28385 [AA] Support SAM constructors in computeImportableName
This allows to properly report them as used in `KtFirImportOptimizer`

This change will also be important for properly fixing KTIJ-28167,
since `computeImportableName` is also used in reference shortener

^KTIJ-28385 Fixed
2024-01-04 20:07:41 +00:00
Mikhail Glukhikh 83cfcc30c6 K2: handle type parameter vs nested class conflict in body resolve properly
This commit does two things:
- prioritize type parameter scopes against static scopes in body resolve
(effectively it's a revert of KT-58028 fix)
- consider type parameters as inapplicable callable, so during callable
resolve we can go up the tower and still resolve to static scope

This allows both KT-58028 and KT-63377 to work properly
#KT-63377 Fixed
2023-11-24 21:28:16 +00:00
Roman Golyshev bd92224aec KTIJ-26423 [AA] Ignore artificial Array type from varargs parameters in KtFirImportOptimizer 2023-10-25 20:53:15 +00:00
Roman Golyshev ef31eeae52 KTIJ-26423 [AA] Get rid of the old testdata for KtImportOptimizer
This testdata is some form will be transferred to the `intellij` repo
2023-10-25 20:53:14 +00:00
Roman Golyshev 306f404a69 KTIJ-26423 [AA] Get rid of local declarations in KtFirImportOptimizer
Adjust `computeImportableName` to return null for when passed symbol
is local
2023-10-25 20:53:13 +00:00
Roman Golyshev 421793673b KTIJ-26423 [AA] Extend KtImportOptimizer testdata with imports usage information
`KtImportOptimizerResult.unusedImports` should be removed soon, and
part of the testdata for the import optimizer service should go
to `intellij` repository
2023-10-25 20:53:12 +00:00
Roman Golyshev f5307173b5 KTIJ-26959 [AA] Do not ignore underscore named properties in KtFirImportOptimizer
After the fix for the KT-60904 issue (c963eadb),
there are unnamed declarations created even for
the unused variables in destructuring declarations

Because of this, we can actually align testData
for K1 and K2. It seems like KT-59504 is no
longer relevant and can be marked as obsolete
because of the KT-60904 fix

^KTIJ-26959 Fixed
2023-09-08 09:19:06 +00:00
Roman Golyshev 52d6ac5ed0 [AA] Fix processing of member invoke functions from objects in reference shortening and import optimization
Correctly handle `KtDotQualifedExpression`s with function calls as
selectors (like `foo.Bar()`). Without such handling, processing of
member invoke calls on objects was broken both
for reference shortener (causing KTIJ-26695)
and import optimizer (causing KTIJ-23407)

Also, to fix KTIJ-23407, do not ignore qualifiers with
`ImplicitInvokeCall` fake source

^KTIJ-26695 Fixed
^KTIJ-23407 Fixed
2023-08-18 07:32:05 +00:00
Roman Golyshev ef6e8ebb9b KTIJ-26672 [AA] Correctly handle ConeAmbiguityError in KtFirImportOptimizer
Add a test case for missing call diagnostic just in case

^KTIJ-26672 Fixed
2023-08-16 19:25:59 +00:00
Roman Golyshev 73bfc88613 KTIJ-26501 [Analysis API] Do not ignore vararg type references in KtFirImportOptimizer
Turns out they have fake sources, so ignoring all
type qualifiers with fake sources in e1ebbc10d9
was incorrect.

^KTIJ-26501 Fixed
2023-08-03 11:55:57 +00:00
Roman Golyshev e1ebbc10d9 KTIJ-24877 [Analysis API] Ignore type qualifiers with fake sources when optimizing imports
When optimizing imports, it does not make any sense to account for
type qualifiers which are not directly present in the code

ATM such implicit type references are present for every
callable declaration call

^KTIJ-24877 Fixed
2023-07-27 17:28:47 +00:00
Roman Golyshev 5e30adec06 KTIJ-26276 [Analysis API] Do not consider single aliased import from the same package as unused
Even when the aliased import comes from the same package, it cannot be
removed, because it will break the code

Also, add more tests for the imports coming from the same package

^KTIJ-26276 Fixed
2023-07-19 12:40:57 +00:00
Roman Golyshev 26dbeb9b6f KTIJ-25530 [Analysis API] Add missing test cases for Java statics
Can be done now because KT-58980 is fixed
2023-06-21 18:37:09 +00:00
Ilya Kirillov 0ad98ff610 [Analysis API] use fe10-specific testdata for Fe10IdeNormalAnalysisSourceModuleAnalysisApiImportOptimizerTestGenerated 2023-06-21 12:04:31 +02:00
Roman Golyshev bccd7bc04a KTIJ-25341 [Analysis API] Visit component calls in import optimizer
N.B. K2 does not require resolved `componentX` functions for the
placeholder variables (`_`), see KT-59504

^KTIJ-25341 Fixed
2023-06-20 10:12:57 +00:00
Roman Golyshev adab552928 KTIJ-25530 [Analysis API] Correctly collect references to implicitly dispatched callables in Import Optimizer
N.B. There is a case which is not covered ATM due to the bug in the
compiler, see KT-58980

^KTIJ-25530 Fixed
2023-06-19 16:02:09 +00:00
Roman Golyshev e4390e47cf [Analysis API] KTIJ-23588 Do not ignore calls qualified with objects
^KTIJ-23588 Fixed
2023-04-24 22:16:55 +00:00
Ilya Kirillov 15f19f324e [Analysis API FIR] do not consider unresolved imports as unused in import optimizer
Otherwise, the import optimizer breaks incomplete code

^KTIJ-25034 fixed
2023-03-29 10:36:27 +00:00
Roman Golyshev b23aabf6e0 [Analysis API] KTIJ-24610 Ignore qualifiers with fake source in KtFirImportOptimizer
Such qualifiers can appear for extensions imported from objects

^KTIJ-24610 Fixed
2023-02-14 16:08:40 +00:00
Marco Pennekamp c5e5140c08 [Analysis API] Fix exceptions around type parameters being treated as callables
- `toResolvedCallableSymbol`: cast defensively because
  the resolved symbol might not be a callable symbol.
- `toKtCallInfo`: Check that the resolved symbol is actually callable.

^KTIJ-23003 fixed
2022-11-17 18:58:38 +00:00
Roman Golyshev 4d6b424280 [FIR IDE] Properly handle generic types qualifiers
In code like `foo.Bar<Bazz>`, `Bar<Bazz>` is considered to be
`KtCallExpression` from the PSI point

^KT-52779 Fixed
2022-06-14 15:00:12 +00:00
Roman Golyshev 3f8fff55cf FIR IDE: Fix ImportOptimizer for types used as generics' parameters 2021-12-24 16:31:34 +00:00
Ilya Kirillov 6f6a33e852 Analysis API: move testdata to corresponding components folders 2021-11-17 20:55:08 +01:00
Ilya Kirillov 42f0536904 FIR IDE: move analysis api fir testdata to the analysis directory 2021-09-15 11:32:43 +02:00