Commit Graph

638 Commits

Author SHA1 Message Date
Ilya Chernikov 484d026d2f Optimize resolution scope queries from the synthetic scopes
now required descriptors are queried in advance and passed to the
methods, to avoid multiple same name queries in a row
2020-06-11 16:16:15 +02:00
Ilya Chernikov a0efd1e323 Optimize scopes handling inside ChainedMemberScope 2020-06-11 16:16:15 +02:00
Ilya Chernikov 3da6ff7ec3 Optimize scopes handling inside LexicalChainedScope 2020-06-11 16:16:14 +02:00
Toshiaki Kameyama 957a927790 KT-15846 'Change lambda expression return type' quick fix does nothing (#3182)
* Change parameter type quickfix: fix it works correctly on property delegate

#KT-15846 Fixed

* Change parameter type quickfix: fix it works correctly when function literal has trailing comments

#KT-15846 Fixed
2020-06-11 12:07:44 +03:00
Vladimir Ilmov 4f1b7b38b2 (Resolve) lightweight resolve annotations
relates to #KT-38653
2020-06-05 00:19:16 +02:00
Vladimir Ilmov 47c25982b6 (ResolveElementCache) KtAnnotationEntry resolveToDescriptor added 2020-06-04 14:23:45 +02:00
Pavel Kirpichenkov 7fff8f82e2 Changes after review
- Replace leaking ModuleResolverTracker with use of ModuleDescriptor.Capabilies
- Provide API for retrieving ResolverForProject from ResolutionFacade
- Update names
2020-06-03 20:58:07 +03:00
Nicolay Mitropolsky 8434806f56 Ide-common: resolveToKotlinType moved to TypeUtils.kt in the *ide-common* 2020-05-26 17:39:43 +03:00
gcx11 8849a66c00 KT-10974 - add import layout configuration table 2020-05-25 10:40:24 +03:00
Ilya Kirillov d825428718 New J2K : move resolve resolve out of EDT in shorten references processing
relates to #KT-31812
2020-05-20 11:11:46 +03:00
Dmitry Gridin b2be1a53cf SpecifyTypeExplicitlyIntention: remove annotations from result type
#KT-36930 Fixed
2020-05-19 01:17:39 +00:00
Dmitry Gridin f12ed33a70 AbstractKotlinBundle: introduce withHtml
#KT-37483
2020-03-16 18:40:52 +07:00
Dmitry Gridin 177b7eb024 i18n: fix compilation 192 2020-03-16 18:40:43 +07:00
Dmitry Gridin dd6abec660 i18n: rewrite bundles with AbstractKotlinBundle 2020-03-16 18:40:40 +07:00
Dmitry Gridin d644214251 i18n: add bundle for ide-common 2020-03-16 18:40:40 +07:00
Dmitry Gridin c8c316c379 i18n: introduce AbstractKotlinBundle 2020-03-16 18:40:40 +07:00
Vladimir Dolzhenko 9fdf8530ff Add checkCanceled in loops in KotlinImportOptimizer to avoid freezes
#KT-37301 Fixed
2020-03-16 11:08:19 +00:00
Dmitry Gridin 8dbbd64beb idea: cleanup code 2019-12-17 13:56:48 +07:00
Roman Golyshev 28e2d2faf2 KT-34740 Make getImplicitReceiversWithInstanceToExpression keep script implicit receivers
- This makes completion aware of scripts implicit receivers (it matters in .gradle.kts files, for example)
- ^KT-34740 Fixed
2019-11-22 11:22:46 +03:00
Roman Golyshev be2fe256ba KT-34740 Refactor implicitReceiversUtils.kt 2019-11-22 11:22:46 +03:00
Vyacheslav Gerasimov 3b088818a5 Build: Add sources and javadocs to Kotlin Plugin publication 2019-11-01 16:22:42 +03:00
Vyacheslav Gerasimov 579645bcfa Build: Publish ide-common as separate artifact in KotlinPlugin publication
#KT-34452
2019-11-01 16:22:42 +03:00
Vyacheslav Gerasimov 7401a7c63f Build: Fix dependencies of ide-common
#KT-34452
2019-11-01 16:22:42 +03:00
Vladimir Dolzhenko 34e941f26f Render unresolved types in a presentable way in refactorings
#KT-34459 Fixed
2019-10-21 17:18:24 +02:00
Denis Zharkov 67410f7a57 Parametrize behavior of DescriptorEquivalenceForOverrides::areCallableDescriptorsEquivalent
The changes introduced 471134d31e are only needed
for the case of HMPP project while for other cases it might break the behavior
a bit like in KT-34027

See org.jetbrains.kotlin.resolve.calls.results.OverloadingConflictResolver#filterOutEquivalentCalls

Before 471134d we were comparing
"fun foo(x: String)" with "[substituted] fun foo(x: String)"
and areCallableDescriptorsEquivalent returned false for such case.
Thus, both overrides were left in the resulting set.

After 471134d, those two descriptors
becamed considered as equal thus having a possibility to remove any of them.

The problem is that "areCallableDescriptorsEquivalent" has kind of
unclear contract. Effectively it checks whether two descriptors match
to the same declaration

But straightforward fixing of this exact call-site (using original descriptors)
doesn't help: behavior might change in a very subtle way (see org.jetbrains.kotlin.spec.checkers.DiagnosticsTestSpecGenerated.NotLinked.Dfa.Pos#test72)

So, the main idea is changing the contract for areCallableDescriptorsEquivalent
only when project is HMPP one.

^KT-34027 In Progress
2019-09-30 20:09:42 +03:00
Roman Golyshev b422485440 KT-30996: Use the last receiver to complete dsl methods
- change `detectReceiverTypes` return type to `List` instead of `Collection`
  - it reflects that receiver types are actually ordered
  - did not propagate signature changes to all possible places because it creates too much noise in git history
- ^KT-30996 Fixed
2019-09-13 15:52:52 +03:00
Natalia Selezneva 3f451d7eaf Switch off SAM adapter conversion for constructors in completion
It is very slow in completion for build.gradle.kts because it creates SAM adapters for constructors of all imported classes
Note that those SamAdapters weren't shown in completion in any case because they were filtered by name filter (SamAdapters for constructors have <init> name)
2019-09-06 10:53:16 +03:00
Dmitry Gridin a2f937e282 DescriptorRender: cleanup code 2019-08-01 16:08:45 +03:00
Dmitry Savvinov 54cdd3bfef [Misc] Refactor Module.cached extension to accept lambda instead of FunctionalInterface 2019-07-30 12:41:39 +03:00
Denis Zharkov 21cc93860b [Invariant Fix] Fix KotlinPsiUnifier after types refinement introduction
Refined types with non-trivial substitution may result in different
descriptors instances
See PsiUnifierTestGenerated$Equivalence$Expressions.testArrayAccess
2019-07-30 12:41:38 +03:00
Denis Zharkov 529763b9bd [Misc] Get rid of public Companion methods in SmartCastManager
It's necessary for type-refinement component to be injected
2019-07-30 12:41:35 +03:00
Denis Zharkov e7d6a9508e [Misc] Reformat CallType.kt 2019-07-30 12:41:35 +03:00
Yan Zhulanow 6d7d524b9b Debugger: Fix 'expect fun' evaluation from common code (KT-26742) 2019-07-08 16:25:17 +09:00
Dmitry Gridin 46d8f45c11 Apply LiftReturnOrAssignmentInspection on idea 2019-06-17 11:24:28 +07:00
Dmitry Savvinov dca23f871c Allow to force-require syntetic SAM-adapters even in NI
This is needed for some IDE clients, particularly, completion: even
though presenting only non-converted member (e.g., 'foo(Consumer<Int>')
is nominally OK, as resolution with NI is smart enough to accept 'foo { }'
for such a call, it is inconvenient for users (for example, hitting
enter would insert round brackets instead of a figure brackets)

This commit adds very-very narrow API (borderline hacky) in
JavaSyntheticScopes, to allow clients explicitly ask for a scopes with
force-enabled synthetic conversions. It fixes several tests, which had
started to fail after corresponding commit about NI and SAM-adapters
(fe5976d7f4), e.g.:
- Java8BasicCompletionTestGenerated.testCollectionMethods
- Java8BasicCompletionTestGenerated.testStreamMethods
- JvmBasicCompletionTestGenerated$Common$StaticMembers.testJavaStaticMethods
- JvmBasicCompletionTestGenerated$Java.testSAMAdaptersStatic
- JvmWithLibBasicCompletionTestGenerated.testSamAdapter
- JvmWithLibBasicCompletionTestGenerated.testSamAdapterAndGenerics

Note that changes are made in ReferenceVariantsHelper, which is used by
several other clients in IDE. Presumably, those changes are needed for
them too.
2019-06-03 10:46:53 +03:00
Dmitry Savvinov eda975d317 Minor: reformat ReferenceVariantsHelper.kt 2019-06-03 10:46:53 +03:00
Dmitry Gridin aff8a3f97f Fix KNPE in OptimizedImportsBuilder
#KT-31637 Fixed
2019-05-28 21:46:48 +07:00
Dmitry Savvinov d5fbe59a3e [Platform API] Introduce fundamental abstraction of Platform
This is a large commit, which introduces general API for working with
abstraction of Platform.

- Add new abstraction to 'core' - SimplePlatform - which represents
exactly one platform
  - Clients are strongly prohibited to create instances of SimplePlatform
  by hand, instead, corresponding *Platforms abstraction should be used
  (e.g. JvmPlatforms, JsPlatforms, KonanPlatforms)

- Move TargetPlatform to 'core', it represents now a collection of
SimplePlatforms
  - Clients are strongly encouraged to use TargetPlatform
    (not SimplePlatform) in API, to enforce checks for multiplatform

- Provide a helper-extensions to work with TargetPlatform
(in particular, for getting a specific component platform)

- Remove MultiTargetPlatform in favour of TargetPlatform
  - Notably, this commit leaves another widely used duplicated abstraction,
    namely, IdePlatform. For the sake sanity, removal of IdePlatform is
    extracted in the separate commit.
2019-05-28 13:08:07 +03:00
Mikhail Zarechenskiy cc29ca02f8 [NI] Don't loose inference session during property resolve
#KT-31620 Fixed
2019-05-26 21:31:54 +03:00
Dmitry Gridin 3914530fa8 Don't delete import from stdlib if alias exists and used
#KT-31414 Fixed
2019-05-14 21:01:21 +07:00
Dmitry Gridin 32298522dd Optimize Imports shouldn't delete imports with unresolved parts
#KT-10512 Fixed
2019-05-14 21:01:20 +07:00
Dmitry Gridin ff26acacf9 Optimize Imports shouldn't delete imports with unresolved parts
#KT-10512 Fixed
2019-05-06 18:12:39 +07:00
Dmitry Gridin 96ed33e357 Optimize Imports should remove unused import alias
#KT-17375 Fixed
2019-05-06 18:10:52 +07:00
Dmitry Gridin 7fe0503337 Unused import: support also imports as alias
#KT-12392 Fixed
2019-05-06 18:10:52 +07:00
Dmitry Gridin c52abfda16 Minor: refactoring KotlinImportOptimizer, KotlinUnusedImportInspection, OptimizedmportsBuilder and AbstractOptimizeImportsTest 2019-05-06 18:10:51 +07:00
Simon Ogorodnik 04324b6723 Provide overloads with explicit resolutionFacade for resolutionApi
To ensure stable results of subsequent resolution api method calls,
it is require to provide same resolution facade, as
getResolutionFacade function doesn't guarantee to have same result in
subsequent calls due to soft caching
2019-04-29 16:51:32 +03:00
Dmitry Gridin 37c856290f Fix minor compile warnings 2019-04-25 19:47:39 +07:00
nikita.movshin 65244b4bea Update copyright.
Change the copyright from "JetBrains s.r.o." to
"JetBrains s.r.o. and Kotlin Project contributors"
Update only 2 lines copyright.
2019-04-23 20:09:22 +03:00
Vyacheslav Gerasimov 210ee681a4 Cleanup bunch workarounds made for 181 2019-04-23 17:28:41 +03:00
Vyacheslav Gerasimov 952d2b6287 Remove 181 bunch files 2019-04-23 17:28:41 +03:00