Commit Graph

105816 Commits

Author SHA1 Message Date
Pavel Kirpichenkov e6b2230d51 [minor] remove duplicated import 2023-11-02 10:28:37 +00:00
Pavel Kirpichenkov 2d10877fda [refactoring] extract base class for annotation loaders
Annotation loaders for descriptors (AnnotationAndConstantLoaderImpl) and
stubs (AnnotationLoaderForStubBuilderImpl) share the loading logic until
mapping ProtoBuf.Annotations to output values. The shared logic has been
extracted to the base class.

KTIJ-26761
KTIJ-26961
2023-11-02 10:28:37 +00:00
Pavel Kirpichenkov 30d45039fb [decompiler] Fix property and receiver annotations loading for stubs
Add annotation loading for property backing field, property delegate and
extension receiver to AnnotationLoaderForStubBuilderImpl. Use logic from
AnnotationAndConstantLoaderImpl.

AnnotationLoaderForStubBuilderImpl is used by KotlinMetadataDecompiler,
K2KlibMetadataDecompiler and KotlinJavaScriptMetaFileDecompiler. Stub
versions for built-ins (affects metadata and K/N decompilers) and JS
are bumped.

KTIJ-26761
KTIJ-26961
2023-11-02 10:28:37 +00:00
Dmitrii Krasnov 0882d5201b [FUS] Fixed ModuleChangesCatchingTest failures
#KT-62987 Fixed
2023-11-02 10:07:34 +00:00
Dmitriy Novozhilov 88bb98e5ad [Build] Update verification-metadata.xml 2023-11-02 10:03:06 +00:00
Dmitriy Novozhilov 2c24bc61cc Advance bootstrap to 2.0.0-dev-6573 2023-11-02 10:03:05 +00:00
Kirill Rakhman 0682a1f76d [FIR] Remove line breaks after context receivers in diagnostic messages
#KT-62944 Fixed
2023-11-02 08:58:28 +00:00
Ilya Gorbunov e18a124cbb [stdlib] Import kotlin-test-common sources as a part of native stdlib 2023-11-02 03:12:56 +00:00
Ilya Gorbunov 1ea0c2aa44 [stdlib] Import native sources in IDE 2023-11-02 03:12:56 +00:00
Pavel Punegov fb66626240 [K/N][test] Remove obsolete test on KlibInstall task
This test relied on the almost obsolete klib installation feature.
General linkage with a libraries already covered by various tests.
2023-11-01 20:58:21 +00:00
Pavel Punegov 9961780fbd [K/N][build] Build platform libraries without zipping/unzipping
With "-nopack" compiler option, it is possible to build unzipped klibs.
This makes it possible to get rid of install tasks that unzip them.
Also, an obsolete test for klib installation was removed.
2023-11-01 20:58:21 +00:00
Yahor Berdnikau 094490acbd [Gradle] Compile against Gradle 8.4 api
^KT-62964 Fixed
2023-11-01 19:26:36 +00:00
Nikita Bobko 173651eb5c Fix misconfigured widerVisibilityInActualClassifier test
^KT-59977 Fixed
Review: https://jetbrains.team/p/kt/reviews/12807/timeline
2023-11-01 19:14:20 +00:00
Dmitriy Novozhilov e473b52da7 [Test] Add additional test for KT-21463 2023-11-01 17:39:33 +00:00
Margarita Bobova 85665d71ca Add changelog for 1.9.20 2023-11-01 14:58:03 +00:00
Ivan Kylchik 32057f6d10 [JVM_IR] Use createSimpleNamedCompilerPhase to create lowerings 2023-11-01 14:01:17 +00:00
Ivan Kylchik f5bb477459 [JVM_IR] Move all stickyPostconditions into single lowering
`stickyPostconditions` are such conditions that are checked
every time after applying when a new lowering finishes its execution.
Right now we are using them only in JVM, and this is a blocker
for adopting Native approach for lowering execution.

In Native we are using
`SimpleNamedCompilerPhase<in Context : LoggingContext, Input, Output>`
as the common super type for all lowerings. Here we have `Input` and
`Output` that can potentially be different and `stickyPostconditions`
don't have much sense in that case.
2023-11-01 14:01:17 +00:00
Ivan Kylchik 6a02a26db8 [Native] Move createSimpleNamedCompilerPhase into common.phaser.PhaseBuilders
This is needed to be able to reuse these functions
for other backends.
2023-11-01 14:01:17 +00:00
Ivan Kylchik 465fc9116e [IR] Drop some old lower utils that are not used anymore 2023-11-01 14:01:17 +00:00
Dave MacLachlan 722ddc9f91 Use fileKey instead of canonicalPath when deduping files
`resolveDependencies` showed up as a hotspot when profiling due to `canonicalPath` doing a lot of file system calls.
`fileKey` is more efficient and should guarantee uniqueness (`canonicalPath` may fail in the case of hardlinks).
The new code is 3x faster in our use case.
2023-11-01 13:59:13 +00:00
Ilya Goncharov 3673dff959 [FIR] Only one specific diagnostic for data class without parameters left
^KT-60042 fixed
2023-11-01 13:58:44 +00:00
Alexander Shabalin 17dc60aac9 [K/N] Migrate runtime/text tests to new testing infra ^KT-61259 2023-11-01 13:56:10 +00:00
Brian Norman e9983a947f [FIR] Add checker for EXPANSIVE_INHERITANCE
^KT-59402 Fixed
2023-11-01 13:53:57 +00:00
Anastasiia Spaseeva a991a13295 Reproducible builds: convert instruction to the template
^Relates to KTI-1222
2023-11-01 12:59:13 +00:00
Roman Golyshev 236a76f779 KT-62676 [AA] Small refactoring of AbstractReferenceShortener*Test 2023-11-01 09:45:40 +00:00
Roman Golyshev b0f15451fd KT-62676 [AA] Collect redundant this qualifiers in reference shortener
^KT-62676 Fixed
2023-11-01 09:45:40 +00:00
Roman Golyshev 4ca1f9d492 KT-62676 [AA] Introduce ShortenOptions class
This class should contain 'global' settings for reference shortening;
ATM it only contains the `removeThis` flag

In the future this setting might be merged together with
`ShortenStrategy` to be computed on per-element basis
2023-11-01 09:45:40 +00:00
Roman Golyshev adf7ee4535 KT-62676 [AA] Rename ShortenOption -> ShortenStrategy
`Option` is going to refer to more global settings of the
reference shortener (like shortening `this` or `Companion`
references)
2023-11-01 09:45:39 +00:00
Vladimir Sukharev 9e7bb90e44 [K/N] Don't pass language version to the second stage. 2023-11-01 01:51:12 +00:00
Mikhail Glukhikh d6cefb363b K1/K2: add test to confirm KT-61100 behavior 2023-10-31 22:13:10 +00:00
Mikhail Glukhikh af58b30e5f K2 Java: fix 'value' annotation constructor parameter type to Array<out>
#KT-61100 Fixed
2023-10-31 22:13:10 +00:00
Vladimir Sukharev 8e4a6759a4 [FIR] Fix Disappeared INVALID_CHARACTERS
^KT-59996 Fixed
2023-10-31 22:04:06 +00:00
Marco Pennekamp 50fdc2128f [AA] Improve documentation of ProjectStructureProvider.getModule
- Since this documentation was written, the usages of contextual modules
  have expanded beyond outsider files, for example to support `KtModule`
  disambiguation for library elements. Hence, it was necessary to update
  the documentation accordingly.
2023-10-31 17:34:44 +00:00
Kirill Rakhman ac203591e5 [FE, Java resolve] Support inheritors of sealed Java type without permits clause
This fixes a false negative NO_ELSE_IN_WHEN in K2 and incidentally
also fixes a false positive NO_ELSE_IN_WHEN in K1 since the fix is in
the common code.

#KT-62491 Fixed
2023-10-31 13:41:56 +00:00
Svyatoslav Kuzmich 15d3bf5e25 [Wasm] Port JS interop type checker to K2 (KT-56849) 2023-10-31 12:34:32 +00:00
Dmitrii Krasnov 0c46cfd761 [Gradle MPP] Added duplicate source set name diagnostic
#KT-62601 Fixed
2023-10-31 12:34:14 +00:00
Mikhail Glukhikh 290adda8fc Calculate empty array literal types in FIR2IR instead of deserializer
This commit handles situations when some annotation in deserialized code
has an empty array literal argument [] or even non-empty [something].
Before this commit, we tried to guess a type of this array by "resolving"
the relevant annotation class and looking into the corresponding
parameter. Sometimes it can work, but also it can provoke recursive
resolve e.g. when the annotation class is a nested class in the same scope.
In this commit we changed the behavior in the following way:
- first, for non-empty array literals in deserialized code we just
take the array type from the corresponding array literal element
- second, for empty array literals we no more try to "guess" anything.
Instead we approximate array type as Array<Any>, and later at FIR2IR
stage we use the corresponding parameter type instead. At FIR2IR stage,
everything is already resolved and problems with recursions are no more
possible.

#KT-62598 Fixed
2023-10-31 12:30:29 +00:00
Mikhail Glukhikh 19a95f2fb4 K2: swap heuristics in AnnotationLoader (related to KT-62598)
Before this commit, we first tried to guess a type of array literal
in deserialized annotation (it's a strange heuristics which can
lead to SOE and maybe not needed at all, see KT-62598, KT-62929),
and then, if unsuccessful, took the type from the first literal element,
if any. Since the second heuristic is much more clear, safe, and
understandable, in this commit they were swapped.

This commit does not fix KT-62598 in general case,
but decreases a set of cases when it can occur to
empty array literals only.
See the commented line at the end of the added test.
2023-10-31 12:30:29 +00:00
Ilya Kirillov 4720a0faa7 [Analysis API FIR] fix NPE of == call resolve without builtins
We should not expect builtins to be always available as they are taken from indecies.

For K1 and FIR Standalone implementations, the builtins are always available.

^KT-62957 fixed
2023-10-31 12:24:16 +00:00
Ilya Kirillov 1aa5cf031f [Analysis API FIR] fix "ConeClassLikeTypeImpl is not resolved to symbol for on-error type"
We should not expect builtins to be always available as they are taken from indecies.

For K1 and FIR Standalone implementations, the builtins are always available.

^KT-62010 fixed
2023-10-31 12:24:16 +00:00
Nikolay Lunyak f5d859f209 [FIR] Don't miss smartcast info on equalities with when subjects
Since they are not `FirSmartCastExpression`s,
they are treated as proper original types,
thus leading to reporting errors instead of
warnings.

^KT-60095 Fixed
2023-10-31 10:40:43 +00:00
Alexander Udalov 4f96171716 K2: report IR_WITH_UNSTABLE_ABI_COMPILED_CLASS
Also, remove setting the value of allowUnstableDependencies to true if
K2 is used because we want K2 to report errors (as K1 does) on
unstable-ABI dependencies.

 #KT-61598 Fixed
2023-10-31 10:39:43 +00:00
Alexander Udalov 6a1c210cd1 Minor, remove obsolete mention of issue in previously muted test
The test was fixed for K2 in 365ce2a6a5.
2023-10-31 10:39:43 +00:00
Brian Norman 01a757cbd6 [FIR] Report PROPERTY_WITH_NO_TYPE_NO_INITIALIZER for all properties
Currently, PROPERTY_WITH_NO_TYPE_NO_INITIALIZER is reported for local
variables, but not reported for member or top-level properties. Add a
check to the common `checkPropertyInitializer` for when a property
type cannot be determined from the getter.

This also corrects a K1 versus K2 inconsistency, where K2 would allow
blocks from getters to determine property type instead of only allowing
expression bodies.

^KT-59935 Fixed
^KT-60117 Fixed
^KT-60123 Fixed
2023-10-30 16:28:10 +00:00
Anton Lakotka b154283149 [Gradle] Make sure that rootSoftwareComponent is always added
Even when createDefaultMultiplatformPublications=false and maven-publish
is applied it is required to create all publication-specific entities
such as tasks, configurations, components etc. In order to let users
to compose publications on their own.

^KT-62877 Verification Pending
2023-10-30 16:11:38 +00:00
Anton Lakotka d3f25d81de [Gradle] Change withPluginId to isPluginApplied
It is more convenient to use.
Also added test coverage for cases when plugin is applied too late.

^KT-62877 Verification Pending
2023-10-30 16:11:38 +00:00
Anton Lakotka 5607ae1bc3 [Gradle] Extract publicationDelegate as Project Stored Property
Previously it was attached to RootSoftwareComponent which has
heavy initialization work, for instance it creates new configurations
upon creation. The `publicationDelegate` is used in
`idOfRootModule` and should not trigger RootSoftwareComponent
initialization. After the change `idOfRootModule` became cross-project
safe. I.e. Project `foo` can call `idOfRootModule` on project `bar`.

^KT-62877 Verification Pending
^KTIJ-27374 Verification Pending
2023-10-30 16:11:38 +00:00
Anton Lakotka 6bb33cc8bc [Gradle] Test for Project's collection mutation after evaluation
Mutating projects data, particularly, adding new items to its
collections such as tasks, configurations and components is a potential
risk to lose these data during the import to IDE.

^KT-62877 In Progress
2023-10-30 16:11:38 +00:00
Sebastian Sellmair 36d1622276 [Gradle] Mute IdeNativeStdlibDependencyResolver in case of missing stdlib 2023-10-30 10:40:34 +00:00
Alexander Korepanov 0d7de87e2e [JS IR test] Add a test for invalidation with a src name chash 2023-10-30 09:14:16 +00:00