Commit Graph

102350 Commits

Author SHA1 Message Date
Igor Chevdar 4f859a634e [K/N] Fixed a bug in escape analysis
#KT-59693 Fixed
2023-07-04 09:45:48 +00:00
Ilya Goncharov 0bbf16dff4 [Wasm] Add kotlin-stdlib-wasm and kotlin-test-wasm to trusted group 2023-07-04 08:52:30 +00:00
Artem Daugel-Dauge de56f788f6 [Gradle] Warn about kotlinArtifacts DSL usage
^KT-58029 Verification Pending
2023-07-04 08:29:39 +00:00
Yahor Berdnikau 4c95797067 [Gradle] disable toolchain auto-download in tests
Required JDKs should be already downloaded by Kotlin repo itself.
2023-07-04 07:38:12 +00:00
Yahor Berdnikau 5b1ffb417a [Gradle] Update AGP versions for tests 2023-07-04 07:38:12 +00:00
Yahor Berdnikau f4fbc2edc6 [Gradle] Update Gradle versions for tests
Added Gradle 8.2 release
2023-07-04 07:38:12 +00:00
Denis.Zharkov 78e2d53f3c K2: Adjust Analysis API to the recent scope structure changes
Namely, in the previous commit we merged two
(LOW and HIGH priority default start import scopes) into the single one

For more explanations, please look at the previous commit
2023-07-04 07:25:22 +00:00
Denis.Zharkov 01354c8ce5 K2: Fix false-positive resolution to j.l.String constructor
In K1 (see LazyImportScope), default start import with different
priority worked as follows:
- if something is found in HIGH, don't look at LOW
- otherwise, look at LOW

That, in particular, helped to avoid looking into JDK mirroring classes'
constructors like when resolving calls like String(...) because we
just don't look into j.l.String while already found kotlin.String

The change inside FirTowerResolveTask.kt is not made accidentally:
- At first, it's more or less obviously a bug fix because tower group
for hide-members candidate with implicit receiver should take into
account the tower level of the receiver itself.
- The change is attached to this commit because otherwise the test
at compiler/testData/diagnostics/testsWithStdLib/kt55503.kt starts
failing.
The bug was hidden because previously after finding a successful
`Sequence.forEach` candidate for the inner receiver
(at the default HIGH star import scope), resolver was continuing to
look into default LOW star import scope where it's frozen forever because
we had the better/closer candidate anyway.

But after this change with merging default star imports into the same
tower leve, resolver was continuing its job, enumerating implicit
receivers, finding List<Int> there and noticing that there's
a TopPrioritized hide-member candidates for them
(erroneously ignoring it has a worse/more far receiver).

^KT-51670 Fixed
2023-07-04 07:25:22 +00:00
Denis.Zharkov 12dcfd25e6 K2: Fix test state for KT-51670 before the fix 2023-07-04 07:25:22 +00:00
Roman Golyshev c5ded1ba48 KTIJ-26103 [Analysis API] Ignore implicit dispatch receivers in Reference Shortener
Calls to extension functions imported from objects have implicit
dispatch receivers, but those receivers are not present in the code
and should not be analyzed by the shortener

^KTIJ-26103 Fixed
2023-07-03 20:05:09 +00:00
Sebastian Sellmair 8d2ac41454 [Gradle] Only register CInteropMetadataDependencyTransformationTask's for shared native source sets
KT-58712
2023-07-03 18:42:14 +00:00
Timofey Solonin 4695d9088a [MPP] Enable cinterop commonization if CocoaPods plugin is applied
^KT-58712
2023-07-03 18:42:14 +00:00
Artem Daugel-Dauge caaade1f4f [Gradle] Fix invalidation framework after sync while preserving 'generateDummyFramework' task semantic
^KT-49430 Verification Pending
2023-07-03 17:37:37 +00:00
Anna Kozlova f96b5bae48 [LL] anchor module provider for navigation in monorepo
Use information from IDE about anchor module,
to include everything from that module and dependencies into library session
^ KTIJ-24683
2023-07-03 17:10:51 +00:00
Egor Kulikov 19fb6e7458 [FIR] Don't resolve parameters in function types in invalid code
^KTIJ-25653 fixed

Merge-request: KT-MR-10831
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
2023-07-03 16:30:14 +00:00
Roman Golyshev ab149e1053 KTIJ-26024 [Analysis API] Add more tests for nested cases of reference shortening in class header
Account for `FirNestedClassifierScopeWithSubstitution` in the reference
shortener
2023-07-03 16:21:42 +00:00
Roman Golyshev 4adda42206 KTIJ-26024 [FIR] Expose original scope from FirNestedClassifierScopeWithSubstitution
Access to the original scope is required for the
KtFirReferenceShortener to correctly compare the scopes between each
other
2023-07-03 16:21:42 +00:00
Roman Golyshev 88450c69b3 KTIJ-26024 [Analysis API] Provide correct context for class header from FirTowerDataContextAllElementsCollector
To correctly provide the context for class header resolution, we save
the additional copy of the context right before `withRegularClass`
wrapper call in `LLFirBodyLazyResolver`. Otherwise we would have to
clear the existing context by hand, which is too cumbersome
(if at all possible)

^KTIJ-26024 Fixed
^KTIJ-24832 Fixed
2023-07-03 16:21:42 +00:00
Roman Golyshev d7d2c1f260 KTIJ-26024 [Analysis API] Refactor FirTowerDataContextAllElementsCollector 2023-07-03 16:21:42 +00:00
Roman Golyshev 96697b5a77 KTIJ-26024 [Analysis API] Rearrange testData for reference shortener
Move testData for nested classes' scopes to a separate directory
2023-07-03 16:21:42 +00:00
Alexander Shabalin e1b168d77c [K/N] Fix performance build 2023-07-03 15:49:42 +00:00
Alexander Shabalin 4081115774 [K/N] Fix benchmarksAnalyzer build 2023-07-03 15:49:42 +00:00
Anton Lakotka 182c10f77d [Gradle] Mark some tasks with @DisableCachingByDefault
By default, tasks should opt-in for supporting build cache through
marking class with @CacheableTask.

However, some tasks should not be cacheable by default, as for these
tasks doesn't do any heavy load. Even worse, storing and extracting
tasks results from the remote cache (for example) would take more time
than actual run on host machine.

So these tasks are marked as @DisableCachingByDefault

^KT-59307 Verification Pending
2023-07-03 15:46:34 +00:00
Timofey Solonin e59371d291 [MPP] Add a test for configuration avoidance between CommonizeCInterop
and CInterop tasks

^KT-58712
2023-07-03 15:41:31 +00:00
Timofey Solonin a1db10c5fe [MPP] Use SetProperty in CInteropCommonizerTask for configuration avoidance
^KT-58712
2023-07-03 15:41:30 +00:00
aleksandrina-streltsova 57cbab7d8e [AA] Shortener: allow import if requested import kind has high priority 2023-07-03 15:08:05 +00:00
aleksandrina-streltsova a96e2f37e7 [Analysis API] Shortener: don't add import if it affects usages
^KTIJ-24096 Fixed
2023-07-03 15:08:04 +00:00
aleksandrina-streltsova 338c2433ac [Analysis API] Add API for expect/actual declaration detection 2023-07-03 15:08:04 +00:00
aleksandrina-streltsova da5f33d762 [Analysis API] Do not shorten qualifiers outside the selection range
^KTIJ-25116 Fixed
2023-07-03 15:08:04 +00:00
aleksandrina-streltsova ed7a3299f0 [Analysis API] Shorten qualifier of unresolved reference
^KTIJ-25115
2023-07-03 15:08:03 +00:00
Sergey Bogolepov 2d945b7226 [K/N] Disable KT-59167 test on watchOS 2023-07-03 14:45:21 +00:00
Ilya Goncharov 0bc19e70b6 [JS] Update npm dependencies in integration tests 2023-07-03 14:44:34 +00:00
Artem Kobzar 9ad5910de9 [K/JS] Remove isObject check from runtime ^KT-57926 Fixed 2023-07-03 13:19:43 +00:00
Sebastian Sellmair 23174add97 [Gradle] IdeBinaryDependencyResolver: Demote unresolved dependency logging to 'info'
The unresolved dependency built below will be reported by the
IDE as 'UnresolvedDependencySyncIssue'

KT-59844
2023-07-03 13:04:24 +00:00
vladislav.grechko 195ca10394 [FIR] Report error on non-public API access in @PublishedApi inline fun
^KT-59695: Fixed
2023-07-03 12:24:16 +00:00
Ilya Kirillov 36c8987df2 [FIR] fix exception on primary constructor parameter without a type
^KTIJ-25869 fixed
2023-07-03 11:40:18 +00:00
vladislav.grechko c6bd981fad [FIR] Fix order of arguments passed to inline function diagnostics
Accessibility-related diagnostics for inline function have the inline
function symbol as a first argument, and the forbidden callee as a
second one.

^KT-59673: Fixed
2023-07-03 11:39:57 +00:00
Dmitriy Novozhilov c8190707b3 [CODEOWNERS] Change owner of psi2ir from Compiler Core to JVM team 2023-07-03 11:29:20 +00:00
Vladimir Dolzhenko 4a7aea0dc6 Change the order of final properties initialization and ctor
To avoid case with NPE due to race-condition on publishing
non-fully initialized object in ctor via
`TypeRefinementSupport.Enabled(this)`

#KT-59852

Merge-request: KT-MR-10917
Merged-by: Vladimir Dolzhenko <Vladimir.Dolzhenko@jetbrains.com>
2023-07-03 10:51:53 +00:00
Kirill Rakhman c7ae3c75db [FIR] Don't require delegated constructor calls for expect constructors
#KT-59640 Fixed
2023-07-03 10:17:22 +00:00
Kirill Rakhman 028921ade1 [FIR] Implement checker for value parameter default value type mismatch
#KT-58901 Fixed
2023-07-03 10:11:36 +00:00
Kirill Rakhman cfc824f9f2 [FIR] Set vararg modifier on data class copy method parameters
This only happens in red code, but it prevents unhelpful initializer
type mismatch errors.
2023-07-03 10:11:36 +00:00
Kirill Rakhman dcb200d6d3 [FIR LT] Optimize LighterASTNode.getChildNodeByType
Instead of creating a list first, return the first matching element of
the array.
2023-07-03 10:11:36 +00:00
Denis.Zharkov 8519053527 K2: Get rid of errorsToIgnore parameter during error reporting
The reason is that it's potentially might lead to some errors
are actually ignored leading to false-negatively green code,
while on the other hand we don't have any evidences (like tests)
that not-having the parameter lead to at least some redundant diagnostics.
2023-07-03 10:06:45 +00:00
Denis.Zharkov ffcb4cd1cb Add kdoc for LanguageFeature.AllowEmptyIntersectionsInResultTypeResolver
^KT-51221 Related
2023-07-03 10:06:45 +00:00
Alexander Kuznetsov c63a9582aa [debugger] IrFile for KtBlockCodeFragment should have a module
A module created for expression evaluation contains `fragment.kt`,
the file that contains necessary code for the expression
to be successfully evaluated (including the expression itself).
However, the IrFileImpl created for the fragment doesn't refer
to the module, leaving its lateinit `module` property uninitialized.
So, simply put, a parent has a child, but that child
doesn't have the parent. And that may lead to various errors.

Compose has a psi2ir lowering that transforms Composable declarations,
and for that it deep-copies all the declarations
(see `androidx.compose.compiler.plugins.kotlin.lower.
ComposerParamTransformer#lower`).
During the copying, it eventually tries to access that uninitialized
`module` property (`org.jetbrains.kotlin.ir.util.
DeepCopyIrTreeWithSymbols.visitFile`),
which predictably ends up with an exception.
The exception propagates down the stack, interrupting further
Compose lowerings, but eventually it gets swallowed at
`com.android.tools.compose.ComposePluginIrGenerationExtension#generate`.
So, fragment compilation continues and brings forth more complicated
errors on later stages, in particular during the codegen,
like in the IDEA-320738, when some declarations don't have
their lateinit `parent`s initialized.
This one example in the issue strikes during expect declarations
lowering at `org.jetbrains.kotlin.backend.common.lower.
ExpectDeclarationRemover.tryCopyDefaultArguments`.

The problem arisen in the issue could be solved on the Compose side,
but there's no telling what else can get broken because of
this module-file inconsistency.

Fixes IDEA-320738

Merge-request: KT-MR-10914
Merged-by: Alexander Kuznetsov <Aleksander.Kuznetsov@jetbrains.com>
2023-07-03 09:55:29 +00:00
Ilya Kirillov 5675c19f3b [Java Resolution, LL FIR] fix PsiInvalidElementAccessException from JavaClassifierTypeImpl.substitutor
The cached `PsiSubstitutor` might be invalidated, in this case we should recompute the value

Also make the `JavaClassifierTypeImpl` to be thread safe

^KT-59667 fixed
2023-07-03 07:55:36 +00:00
Anna Kozlova 600b5ec6e5 [FIR] preserve real source for property accessors
^ KT-59705
If property is delegated, it can't have property accessors with non-default impl,
but it can contain property accessors declarations
with non-default visibility, annotations, etc.
Seems, it's more logical to preserve them as fake sources
than use property itself
2023-07-03 08:46:40 +02:00
Denis.Zharkov 3279313f2c K2: Fix priority for implicit receiver + extensionInvoke
See K1 counterpart at org.jetbrains.kotlin.resolve.calls.tower.TowerResolver.Task.processImplicitReceiver

^KT-58943 Fixed
^KT-59541 Fixed
2023-07-01 16:29:06 +00:00
Denis.Zharkov 1f120ecd20 K2: Adjust invoke priorities with K1
- At first, get rid of a kind of interceptTowerGroup callback and use
explicit towerGroup construction instead
- Get rid of INVOKE_RECEIVER (not sure exactly why it was needed)
- Make comparison consistent with tower-levels priority of K2
(see the comments in the compareTo code)

^KT-37375 Fixed
^KT-58940 Open
2023-07-01 16:29:05 +00:00