Commit Graph

107458 Commits

Author SHA1 Message Date
Kirill Rakhman 737b286d5c [FIR] Remove useless cast 2023-12-21 13:29:00 +00:00
Mikhail Glukhikh d1edbe0c4b FIR scopes: createSuspendView -> more abstract replaceWithWrapperSymbolIfNeeded
Related to KT-59818
2023-12-21 13:10:17 +00:00
Mikhail Glukhikh 1ebf0f5376 K2: show all Java function with suspend view if possible
This commit fixes two tests related to removed workaround of KT-59818,
and also makes processing suspend functions in J/K hierarchy more consistent.
Before this commit, when we had Java class "suspend" method
(implemented with the help of Continuation) overriding Kotlin suspend fun,
the Kotlin suspend fun was visible in outer use-site scope,
and the Java method was invisible.
Also, we used a special "Java suspend view" just to determine
that Java method overrides Kotlin suspend fun and no more.
After this commit, Java class "suspend" method will be visible
in this hierarchy and Kotlin suspend fun will not.
Also, the "suspend" is visible as a synthetic Kotlin suspend fun
which is more correct.

Related to KT-63233
#KT-59818 Fixed
2023-12-21 13:10:17 +00:00
Mikhail Glukhikh 5409a51ce9 K2: remove a workaround for suspend functions implementation status
This commit breaks two diagnostic tests:
- testSuspendJavaImplementationFromDifferentClass
- testSuspendJavaOverrides

Related to KT-59818
#KT-63233 Fixed
2023-12-21 13:10:17 +00:00
Mikhail Glukhikh 7f7bc1f36c K2: add test to reproduce KT-63233 2023-12-21 13:10:17 +00:00
Mikhail Glukhikh b6d2d23f41 K2: use API instead of FirJavaMethod(Constructor) subtyping in enhancement
FirJavaMethod and FirJavaConstructor are implementation classes.
It's anyway not good to check subtyping using them,
because it makes the code implementation-dependent.
This commit begins to check Java origin instead.
2023-12-21 13:10:16 +00:00
Mikhail Glukhikh 2f29738989 K2: use lookupTag instead of classId in use-site scopes
We used this classId to get an associated symbol,
but this way is anyway not recommended (e.g. problems with local classes).
In this commit we migrated to usage of lookup tags instead.
2023-12-21 13:10:16 +00:00
Mikhail Glukhikh 79e041a310 FE: drop a redundant diagnostic test (exact duplicate of suspendJavaOverrides.kt) 2023-12-21 13:10:16 +00:00
Kirill Rakhman f47705f123 [Tests] Add box tests for #KT-59904 2023-12-21 12:03:48 +00:00
Nikita Bobko 843ded892d [FIR] Don't generate Any.{toString, equals, hashCode} for expect value classes in metadata
^KT-64121 Fixed
Review: https://jetbrains.team/p/kt/reviews/13495/timeline

If we generate these declarations then the compiler sees Any.{toString,
equals, hashCode} non-synthetic declarations of common metadata and
reports false positive ACTUAL_MISSING during intermediate (HMPP)
metadata compilation.

See the review for more details
2023-12-21 11:10:15 +00:00
Nikita Bobko 9da29d46aa FirElementSerializer cleanup
Review: https://jetbrains.team/p/kt/reviews/13495/timeline
2023-12-21 11:10:14 +00:00
Yahor Berdnikau ea8f7af1f2 [Gradle] Add api marker to Kotlin compilation tasks DSL
Kotlin's compilation tasks DSL should also be separated from other DSL
parts.

^KT-57292 In Progress
2023-12-21 10:30:50 +00:00
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