Commit Graph

107439 Commits

Author SHA1 Message Date
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
Alexander Korepanov 56e1c5cbc6 [JS IR] Add comments about JS IR BE IC 2023-12-20 06:34:13 +00:00
Anastasiia Spaseeva 389095e8f7 [K/N]: Do not deploy files containing checksum strings to a Maven repo
^Related to KTI-1479
2023-12-20 00:23:39 +00:00
Anna Kozlova 21bdf22249 [AA] support KDoc reference resolve in fragments
test in monorepo QuickDocNavigationTest#testTopLevelFunShortName

KTIJ-27582
^KTIJ-27760 fixed
2023-12-19 19:05:26 +00:00
Troels Bjerre Lund b668433256 [CLI] Add cache for reflection lookup of CLI arguments
Add cache for reflection lookup of CLI arguments.

Replace CLI argument list with map.

The current cli parser tries to match every possible command line
argument against each command line argument, essentially in a double
loop. This fix replaces one of the loops with a map lookup. Building the 
map is not expensive, and pays for itself even with a modest number of
parameters. The map is cached between calls, making subsequent calls
much cheaper. If run in a daemon, repeatedly parsing, e.g., 250 
arguments, this speeds up argument parsing by a factor 20. 

Disallow -shortName=value in CLI arguments.

Co-authored-by: Troels Lund <troels@google.com>
2023-12-19 17:05:03 +00:00
Dmitrii Gridin 357015f399 [FIR] FirFakeOverrideGenerator: drop fake attributes from value parameters
We can find corresponding parameters by the containing function symbol.
Analysis API part is covered by tests from:
* FirIdeNormalAnalysisSourceModuleResolveCandidatesTestGenerated
* FirIdeNormalAnalysisSourceModuleResolveCallTestGenerated
* FirIdeNormalAnalysisSourceModuleTypeScopeTestGenerated

^KT-64243
2023-12-19 16:21:57 +00:00
Dmitrii Gridin ed6a67b26d [LL FIR] proper lazy resolution support for fake declarations
Fake declarations do not require any context to be resolved, so we are
able to resolve them not only for non-local classes.
They share most states with the real declaration, so mostly they are
resolved through `LLFirTargetResolver.resolveDependencies`.
The next step is KT-64363

^KT-64243 Fixed
2023-12-19 16:21:57 +00:00
Dmitrii Gridin c3e6dd12a2 [FIR] FirFakeOverrideGenerator: generate fake declaration with STATUS phase
The requirement for original declarations is to have resolved status,
so we can set at least `STATUS` phase for copied ones. This fixes the
problem that fake declarations for local declarations can have `RAW_FIR`
phase due to the copy from the original declarations, as during body
resolution all local declarations have only this phase.
Another issue: we cannot set the phase from the original declaration
as it is not guaranteed that we will have everything in the resolved
state. E.g., we can have the original declaration in `BODY_RESOLVE`
phase, but at the same time a containing class for fake declaration
can be in `STATUS` phase, for example. This means that the fake
declaration can have unresolved type annotation as it has them
from both places – from the original declaration and from the class
super type.
To simplify the code, we can just always set STATUS phase to be sure
that everything is resolved correctly.

Also, so we can optimize the logic for all phases above on Low Level FIR
level

^KT-64243
2023-12-19 16:21:57 +00:00