Commit Graph

107446 Commits

Author SHA1 Message Date
Yahor Berdnikau 2af60a5e27 [Gradle] Add deprecated access to sourceSets container inside KotlinTarget
This should keep compatability with user scripts that for any reason tried to configure 'sourceSets' container inside KotlinTarget, but keep such users warned.

^KT-57292 In Progress
2023-12-21 10:30:50 +00:00
Yahor Berdnikau 36e85fec95 [Gradle] Introduce public KotlinGradlePluginDsl marker annotation
The purpose of this annotation is to distinguish different levels of DSL
 in KGP:
- top level extension
- target level DSL
- compilation level DSL

With this marker user should not be able to call implicit methods from
upper levels of DSL, and it should reduce confusion with DSL usage.

^KT-57292 In Progress
2023-12-21 10:30:50 +00:00
Yahor Berdnikau 74b4adf8e2 [Gradle] Rename internal KotlinGradlePluginDsl into KotlinGradlePluginPublicDsl
This is an internal annotation that eventually should go away, and the
name is clashing with more public annotation is going to be introduced
in the API project.

^KT-57292 In Progress
2023-12-21 10:30:50 +00:00
Mikhail Glukhikh a02cf76d6c K2: build SAM-based function type for a given captured type properly
Before this commit, we assumed (erroneously) that a captured type
cannot have an associated SAM-based function type.
In this commit we changed this assumption, replacing a captured type
with its lower type for this purpose

#KT-63379 Fixed
2023-12-21 10:19:23 +00:00
Mikhail Glukhikh 8588588760 K2: add test reproducing KT-63379 2023-12-21 10:19:23 +00:00
Dmitrii Gridin de44b7dc3b [LL FIR] LLFirSuperTypeTargetResolver: pass correct session during resolution
We should use the declaration-site session to have stable
resolution order. The same scheme is applicable during
regular lazy resolution calls.
Also, this means that we should process 'expect' classes
before 'actual' like it was for 'super' and 'sub' classes

^KT-63547
2023-12-21 09:34:39 +00:00
Dmitrii Gridin 960a59d49a [LL FIR] LLFirSupertypeComputationSession: rename session to useSiteSession
^KT-63547
2023-12-21 09:34:39 +00:00
Dmitrii Gridin 35a7e0db12 [LL FIR] LLFirSupertypeLazyResolver: covert receiver to parameter
To separate it from the next refactoring

^KT-63547
2023-12-21 09:34:39 +00:00
Dmitrii Gridin 14082f6924 [LL FIR] LLFirLazyResolver: drop redundant FirSession argument
LLFirSession should be received from LLFirResolveTarget to avoid
potential wrong sessions
ScopeSession cannot be dropped yet as we should be able to use another
session during on-air resolution to avoid garbage in the original one

^KT-63547
2023-12-21 09:34:39 +00:00
Dmitrii Gridin 1538c125c3 [LL FIR] LLFirReturnTypeCalculatorWithJump: use declaration-site ScopeSession
We should use the declaration-site session to have stable
resolution order. The same scheme is applicable during
regular lazy resolution calls

^KT-63547
2023-12-21 09:34:39 +00:00
Dmitrii Gridin e3841a1728 [Analysis API] add test for duplicated callable during implicit type
^KT-63547
2023-12-21 09:34:39 +00:00
Dmitrii Gridin 51f6525238 [LL FIR] LLFirCompilerAnnotationsLazyResolver: pass correct ScopeSession
We should use the declaration-site session to have stable
resolution order. The same scheme is applicable during
regular lazy resolution calls.

^KT-63547 Fixed
2023-12-21 09:34:39 +00:00
Dmitrii Gridin d83392a27a [LL FIR] LLFirStatusLazyResolver: pass correct session during resolution
We should use the declaration-site session to have stable
resolution order. The same scheme is applicable during
regular lazy resolution calls.
Also, this means that we should process 'expect' classes
before 'actual' like it was for 'super' and 'sub' classes

^KT-63547
2023-12-21 09:34:39 +00:00
Dmitrii Gridin 6ca6221be9 [LL FIR] LLFirStatusLazyResolver: more conservative optimization for actual classes
We cannot skip resolution in the case of type actualization as we cannot
guaranty that there are no any classes in super types which can be
actualized in the current context

^KT-62832 Fixed
^KT-63547
2023-12-21 09:34:39 +00:00
Dmitrii Gridin 0dace65f05 [LL FIR] add lazy resole test for actual override
^KT-63547
2023-12-21 09:34:39 +00:00
Dmitrii Gridin 4bd73e4ccd [Analysis API] add diagnostic test for compiler annotation with argument from another module
^KT-63547
2023-12-21 09:34:39 +00:00
Yahor Berdnikau acf3f2a3a1 [Gradle] Fix warnings in NativePerformanceReport
^KT-56904 In Progress
2023-12-21 08:33:58 +00:00
Yahor Berdnikau 705c9b50a9 [Gradle] Fix deprecated buildDir access in NativePerformanceReport
^KT-62527 In Progress
2023-12-21 08:33:58 +00:00
Mikhail Glukhikh fabeb7fbef Move JsAllowInvalidCharsIdentifiersEscaping to the proper section 2023-12-21 07:43:38 +00:00
Mikhail Glukhikh 3a106fc88e K1/K2: add some more tests around KT-63558 2023-12-21 07:43:38 +00:00
Mikhail Glukhikh c0635be31f Refactor ConeOverloadConflictResolver.chooseMaximallySpecificCandidates 2023-12-21 07:43:38 +00:00
Mikhail Glukhikh d3a0a6cabe K2: discriminate candidates with adaptations in the first place in ConeOverloadConflictResolver
Before this commit, we discriminated particular candidates with callable
reference adaptations during resolution stages.
After disabling compatibility mode for new inference, it's not so,
but now we discriminate similar candidates in ConeOverloadConflictResolver;
more precisely, it's candidates with callable reference adaptation
in their postponed atoms.
This does not allow going up the tower,
but allows to select better candidate at similar tower level.

Related to KT-63558, KT-64307, KT-64308
2023-12-21 07:43:38 +00:00
Mikhail Glukhikh 087edc026d K2: discriminate particular SAMs in the first place in ConeOverloadConflictResolver
Before this commit, we discriminated particular candidates with SAM
during resolution stages. More precisely, candidates from Kotlin
which used Java SAM types, were discriminated allowing go up the tower
for better candidates. After disabling compatibility mode for new
inference, it's not so, but now we discriminate similar candidates
in ConeOverloadConflictResolver. This does not allow going up the tower,
but allows to select better candidate at similar tower level.

Related to KT-63558, KT-64306
2023-12-21 07:43:38 +00:00
Mikhail Glukhikh a7dc381b93 K2: disable compatibility mode for new inference
#KT-64306 Fixed
#KT-64307 Fixed
#KT-64308 Fixed
2023-12-20 21:39:21 +01:00
Bogdan Mukvich d5e4c1db50 [K/N] Filter archives by extension for artifact publication
^KTI-1479
2023-12-20 19:05:11 +00:00
Alexander Korepanov 4a04a2fc4b [JS FIR] Enable invalidation with PL test for FIR
^KT-64446 Fixed
2023-12-20 19:04:31 +00:00
Sergey Bogolepov 6556f4fceb [Native][LTO] Drop unused module descriptor 2023-12-20 18:44:43 +00:00
Sergey Bogolepov 14c38aba14 [Native] Reduce number of descriptor occurrences
Mostly a cleanup commit:
* Remove some obsolete files and declarations
* Move some declarations from descriptors package to ir one
2023-12-20 18:44:42 +00:00
Alexander Shabalin 04a2a2d90d [K/N][tests] Migrate termination runtime tests to new testing infra ^KT-61259 2023-12-20 18:24:06 +00:00
Alexander Shabalin 226ee3c367 [K/N][tests] Support OUTPUT_REGEX in new testing infra ^KT-61259 2023-12-20 18:24:05 +00:00
vladislav.grechko 77d0d1073e Preserve origins when desugaring augmented array assignments
^KT-63827: Fixed
2023-12-20 17:15:40 +00:00
Artem Kobzar eb790732fd [K/JS] Enable identifiers escaping by default in 2.1 version ^KT-31799 Fixed 2023-12-20 16:39:19 +00:00
Mads Ager e41a1247e2 JVM_IR: Generate more line numbers for intrinsic comparisons.
Otherwise, if complex expressions such as when expressions are
used in combination with the intrinsics we get incorrect stepping
behavior.

^KT-64341 Fixed
2023-12-20 15:39:03 +00:00
Ivan Kylchik a441a82357 [JVM_IR] Add some documentation to the IdeCodegenSettings class
#KT-64238 Fixed
2023-12-20 15:02:45 +00:00
Dmitrii Krasnov 125a0e2f52 [Gradle] Made klib unpacked for native metadata compile task
^KT-63363 Fixed
2023-12-20 14:47:53 +00:00
Yahor Berdnikau 470ec8aef1 [Gradle] Fix KGP removes resource-producing task dependency
Previously, we tried to sync existing Java SourceSet resources into
KotlinSourceSet and then replace Java one from Kotlin. For such an
approach, we called 'files' on existing resources, but this does not
carry information about producing task dependency.

This fix goes a little further and just replaces default KotlinSourceSet
 'resources' SourceDirectorySet with a similar object from Java
 SourceSet, so any change to Java or Kotlin resources is reflected in
 both.

^KT-62490 Verification Pending
2023-12-20 14:23:04 +00:00
Leonid Startsev 6c6f2ccacd Handle non-reified type parameters of function inside serializer<T>() intrinsic
to match an error message thrown from KType-based serializer<T>().

Fixes https://github.com/Kotlin/kotlinx.serialization/issues/2528
2023-12-20 13:50:39 +00:00
Ivan Kochurkin a2cd2200d6 [FIR] Infer Unit type for generic lambda function if implicit return exists
Make behavior more consistent with K1

^KT-63563 Fixed
2023-12-20 13:50:05 +00:00
Nataliya.Valtman b19c496c44 Use unique buildId for file name to store FUS metrics
#KT-58768 In Progress
2023-12-20 13:46:50 +00:00
Roman Efremov 30aad31ece [FIR, IR] Prohibit actualization of expect Kotlin property to Java field
The problem from KT-63624 was that during matching phase we must choose
only one candidate, but in Java we can have two successfully matched
properties: 1) from field and 2) from method, which overrides Kotlin
property.
See test `propertyAgainstJavaPrivateFieldAndPublicMethod.kt`.
As a result, we choose field candidate, throw away method candidate, and
then fail during visibility check.

Instead of inventing special rule of prioritizing field over method
it was decided to prohibit actualization to Java field at all because:

1. It doesn't seem that Java fields actualization was implemented in K1
on purpose
2. People usually don't use public Java fields, and use instead
private field + getter, especially when compatibility is important, so
it shouldn't be a breaking change

Besides that, such solution simplifies code and is consistent with
the current logic of matcher, which doesn't expect that two members
can be matched successfully. Also, it fixes KT-63624 and KT-63667.

^KT-63624 Fixed
^KT-63667 Fixed
2023-12-20 13:37:43 +00:00
Roman Efremov 3f95e99e29 [Tests] Add tests for matching of expect property against Java property
...via typealias. Java property can be either field or method, which
overrides Kotlin property.

^KT-63624
2023-12-20 13:37:43 +00:00
Mikhail Glukhikh c322644860 K2: report only warning on lambda parameters with missing dependencies
During the fix of KT-62525, we've forbidden to use lambda parameters
with inaccessible types at all. After it, some impact was noticed,
so we decided to forbid them only in case it's necessary
(the case when associated types have type arguments, see KT-62525
description), and to deprecate them in other cases.

#KT-64266 Fixed
2023-12-20 12:48:00 +00:00
Mikhail Glukhikh 44aa2d86d3 K2: add test to reproduce KT-64266 2023-12-20 12:47:59 +00:00
Ilya Goncharov 81efc8d7c7 [Gradle, JS] Replace outputFileProperty onto Binary's mainFile
^KT-63435 fixed
2023-12-20 12:36:28 +00:00
Nikolay Krasko d3322d515f Update list of compose modules 2023-12-20 12:18:18 +00:00
Nelson Osacky 94f83a5891 Update "Revved up by Develocity" badge 2023-12-20 11:41:40 +01:00
Vladimir Sukharev 26b626c8cf [K/N][Tests] Add test for KT-64276
^KT-64276
2023-12-20 07:15:52 +00:00
Vladimir Sukharev 85882413db [K/N] Fix approach of expected failures caused by outputCheck fail.
`Expected failure flag` was wrongly included in list of test checks.
However, the nature of checks and this flag is different:
- any test check can pronounce the test as failed.
- `Expected failure flag` must invert the accumulated effect of all checks.
Having flag as an additional check cannot catch usecase,
when test is failed only by producing wrong stdout.

This commit extracts this flag out of check list.

^KT-59288
2023-12-20 07:15:35 +00:00
Vladimir Sukharev bb8a7b6795 [K/N][Tests] Adjust moved tests interfaceCallsNCasts..vector to new infra
^KT-61259
2023-12-20 07:07:27 +00:00
Vladimir Sukharev 93642020ff [K/N][Tests] Move codegen test sources interfaceCallsNCasts..vector
^KT-61259
2023-12-20 07:07:27 +00:00