Commit Graph

107411 Commits

Author SHA1 Message Date
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
Dmitrii Gridin 835a9632b9 [FIR] FirFakeOverrideGenerator: use stub expression instead of original default value
We shouldn't copy the default value from the original declaration as is
as it won't be resolved correctly in some cases. It is enough to use
STUB as it will highlight the fact that we have some default value.
In LLFirBodyTargetResolver we shouldn't try to resolve fake declarations
as they don't have bodies and everything should already be resolved

^KT-64243
2023-12-19 16:21:57 +00:00
Dmitrii Gridin c9f11ad74f [FIR] FirFakeOverrideGenerator: unify value parameter copy between regular functions and property accessors
This commit contains:
* correct containingFunctionSymbol for value parameter from accessors
* correct choose between originalForIntersectionOverrideAttr and
originalForSubstitutionOverrideAttr for value parameters from functions

^KT-64243
2023-12-19 16:21:57 +00:00
Dmitrii Gridin 4a87ae9e04 [LL FIR] fix type annotations resolution for fake override declarations
Fake overrides have annotations from a class from which type parameters
were substituted, so we have to resolve them before the declaration.
It worked before in most cases as an original containing class is a part
of the designation path, so we considered annotations from such classes
as our and just resolved them in the wrong scope without right locks

^KT-64243
2023-12-19 16:21:57 +00:00
Dmitrii Gridin b6f0571f0b [LL FIR] introduce lazy resolution tests for fake overrides
^KT-64243
2023-12-19 16:21:57 +00:00
Dmitrii Gridin 6ffa8e6e98 [LL FIR] LLFirResolveTarget: make firFile property optional
Not all targets belonged to any files (e.g., fake overrides),
so we should be able to resolve them without a provided file

^KT-64243
2023-12-19 16:21:57 +00:00
Dmitrii Gridin a7cfbe6d50 [LL FIR] drop redundant usages of LLFirResolveTarget.firFile
After 6893c44a 'target' can be used in many cases

^KT-64243
2023-12-19 16:21:57 +00:00
Sergej Jaskiewicz 1b557c1657 [IR] Mark IrExpressionBodyImpl with an opt-in annotation
KT-59318
2023-12-19 16:20:02 +00:00
Sergej Jaskiewicz 2096d22e18 [IR] Mark IrBlockBodyImpl with an opt-in annotation
KT-59318
2023-12-19 16:20:02 +00:00
Sergej Jaskiewicz f482b6a458 [IR] Mark IrValueParameterImpl with an opt-in annotation
KT-59318
2023-12-19 16:20:02 +00:00
Sergej Jaskiewicz b56a04e796 [IR] Mark IrTypeParameterImpl with an opt-in annotation
KT-59318
2023-12-19 16:20:02 +00:00
Sergej Jaskiewicz 8f2201b7a8 [IR] Mark IrTypeAliasImpl with an opt-in annotation
KT-59318
2023-12-19 16:20:02 +00:00
Sergej Jaskiewicz 9845ca801e [IR] Mark IrPropertyWithLateBindingImpl with an opt-in annotation
KT-59318
2023-12-19 16:20:02 +00:00
Sergej Jaskiewicz c393736473 [IR] Mark IrPropertyImpl with an opt-in annotation
KT-59318
2023-12-19 16:20:02 +00:00
Sergej Jaskiewicz 2953d9ec90 [IR] Mark IrLocalDelegatedPropertyImpl with an opt-in annotation
KT-59318
2023-12-19 16:20:02 +00:00
Sergej Jaskiewicz d493d76dc7 [IR] Mark IrFunctionWithLateBindingImpl with an opt-in annotation
KT-59318
2023-12-19 16:20:02 +00:00
Sergej Jaskiewicz 41197392f9 [IR] Mark IrFunctionImpl with an opt-in annotation
KT-59318
2023-12-19 16:20:01 +00:00
Sergej Jaskiewicz e1d03f6540 [IR] Mark IrFieldImpl with an opt-in annotation
KT-59318
2023-12-19 16:20:01 +00:00
Sergej Jaskiewicz cd014c57a5 [IR] Mark IrErrorDeclarationImpl with an opt-in annotation
KT-59318
2023-12-19 16:20:01 +00:00
Sergej Jaskiewicz 28a0d0c6aa [IR] Mark IrEnumEntryImpl with an opt-in annotation
KT-59318
2023-12-19 16:20:01 +00:00
Sergej Jaskiewicz 444dcae93d [IR] Mark IrConstructorImpl with an opt-in annotation
KT-59318
2023-12-19 16:20:01 +00:00
Sergej Jaskiewicz 2fab853700 [IR] Mark IrClassImpl with an opt-in annotation
KT-59318
2023-12-19 16:20:01 +00:00
Sergej Jaskiewicz 8aacb59aec [IR] Mark IrAnonymousInitializerImpl with an opt-in annotation
KT-59318
2023-12-19 16:20:01 +00:00
Leonid Startsev 22709bcb18 Add missing documentation to KmVersionRequirement.toString
so the documentation publishing to website will not fail.
2023-12-19 15:42:55 +00:00
Leonid Startsev 2405d644a3 Raise all deprecations in kotlinx-metadata-jvm to ERROR
as 0.8.0 had them as WARNINGs.

#KT-63157 Fixed
2023-12-19 15:39:14 +00:00
Sergej Jaskiewicz a1970d3d57 [K/N] Move KonanIrModuleSerializer to serialization.native
KT-64392
2023-12-19 15:20:01 +00:00
Sergej Jaskiewicz 199d9d4880 [K/N] Move KonanDeclarationTable to the serialization.native module
KT-64392
2023-12-19 15:20:01 +00:00
Sergej Jaskiewicz 3f9de91bec [K/N] Move KonanIrFileSerializer to the serialization.native module
KT-64392
2023-12-19 15:20:01 +00:00
Sergej Jaskiewicz a032db500c [K/N] Move KonanFakeOverrideClassFilter to serialization.native
KT-64392
2023-12-19 15:20:01 +00:00