Commit Graph

102749 Commits

Author SHA1 Message Date
Alexander Udalov 79fa2b6db0 Fir2Ir: generate coercion to Unit for when branches if needed
Before this change, it could happen that `when` of type Unit has a
branch whose type is not Unit. This can lead to problems in IR
lowerings, for example PolymorphicSignatureLowering which is very
reliant on the correct types of expressions and placement of coercions
to Unit (KT-59218).
2023-07-18 11:37:41 +00:00
Alexander Udalov 5513740659 Minor, remove extraneous box tests
These tests are already present in
`compiler/testData/codegen/box/classes/kt496.kt`.
2023-07-18 11:37:41 +00:00
Sergej Jaskiewicz e6c4a8957d [IR] Make IrPropertyWithLateBinding a subclass of IrProperty 2023-07-18 10:19:27 +00:00
Ilya Kirillov 4b523825be [Analysis API] forbid providing custom KtLifetimeToken for every analyze call
^KT-60488 fixed
2023-07-18 08:47:34 +00:00
Dmitrii Krasnov b617b24d48 Bump Kotlin/Native version in KGP to 1.9.20-dev-6473.
This version allows the konan data dir to be configured via properties.

#KT-50463
2023-07-18 10:12:51 +02:00
Vladimir Sukharev f9df4e1487 [K/N] Reorder hashCode, toString, equals in data classes to match K1 order
^KT-60247 Fixed

Merge-request: KT-MR-11080
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-07-18 00:06:48 +00:00
Sebastian Sellmair a4a0da267e [Gradle] KotlinJvmCompilation: Implement 'javaSourceSet' as safe Future<SourceSet?>
^KT-60441 Verification Pending
2023-07-17 22:22:02 +00:00
Sebastian Sellmair a49db89024 [Gradle] CompletableFuture: Add 'isCompleted' API
^KT-60441 Verification Pending
2023-07-17 22:22:02 +00:00
Sebastian Sellmair 0feecebc07 [Gradle] jvm().withJava(): Fix Zombie compilation instance returned from create()
^KT-60462 Verification Pending
2023-07-17 22:22:01 +00:00
Zalim Bashorov 0945968751 [Wasm] Update expected size in test data 2023-07-17 23:57:35 +02:00
Zalim Bashorov b34d291f85 [Wasm] Turn on final types in V8 for the box tests 2023-07-17 23:57:35 +02:00
Zalim Bashorov 1cf3841588 [Wasm] Always use -0x30/sub when defining a struct type
Otherwise, according to the spec, a type will be treated as a final,
which is not correct in many cases.
Later, we can generate final struct types when it's applicable.

#KT-60200 Fixed
2023-07-17 23:57:34 +02:00
Zalim Bashorov 5db493a475 [Wasm, JS] Update v8 to 11.7.186 2023-07-17 23:57:34 +02:00
Zalim Bashorov b744f2ef82 [Wasm] Stop using "--type-ssa" since without "--type-merging" it increases output size
"--type-merging" was disabled before because it requires "--close-world"
which we can't use in general (specifically in Compose applications).
2023-07-17 23:57:34 +02:00
Dmitriy Dolovov ce815968cf [Native][tests] Use convention fun generatedTestDir() in build.gradle.kts 2023-07-17 21:09:40 +00:00
Dmitriy Dolovov 938146749d [PL][tests] K/JS: Avoid any unexpected warnings to appear in tests 2023-07-17 21:09:40 +00:00
Dmitriy Dolovov 715aba3d18 [PL][tests] K/JS: Run compiler through CLI interface 2023-07-17 21:09:40 +00:00
Dmitriy Dolovov 19c6208cc0 [PL][tests] K/N: Avoid any unexpected warnings to appear in tests 2023-07-17 21:09:40 +00:00
Dmitriy Novozhilov 8cae224cb4 [PSI2IR] Remove unused method 2023-07-17 21:02:40 +00:00
Dmitriy Novozhilov 01661da7aa [IR] Mark SymbolTable.descriptorExtension with @ObsoleteDescriptorBasedAPI 2023-07-17 21:02:40 +00:00
Dmitriy Novozhilov 11974c14d8 [IR] Fix various TODOs in SymbolTable 2023-07-17 21:02:40 +00:00
Dmitriy Novozhilov 73b580572b [FE] Move @PrivateForInline optIn into :core:compiler.common
This is needed to be able to use it in backend modules too
2023-07-17 21:02:40 +00:00
Dmitriy Novozhilov 49a1dfa20e [IR] Don't create packageFragment in IR builtins if not needed
In REPL it's possible that builtins will be created several times with
  the same symbol table. And since IrBuiltinsPackageFragmentDescriptorImpl
  has overridden equals, symbol for external package will be the same for
  different descriptors (with same FQN). So we should create IrExternalPackageFragment
  here only if it was not created before, on previous compilation
2023-07-17 21:02:40 +00:00
Dmitriy Novozhilov 899e95ea04 [IR] Include signature into error messages about symbols binding 2023-07-17 21:02:40 +00:00
Dmitriy Novozhilov 4ec65ace1c [IR] Update inheritors of SymbolTable which override some descriptor-related methods 2023-07-17 21:02:40 +00:00
Dmitriy Novozhilov 8ad202eb8b [IR] Remove descriptor-related methods from SymbolTable
Replace them with calls to SymbolTableExtension
2023-07-17 21:02:39 +00:00
Dmitriy Novozhilov b886b7488d [IR] Remove descriptor-related methods from ReferenceSymbolTable
Replace them with calls to ReferenceSymbolTableExtension
2023-07-17 21:02:39 +00:00
Dmitriy Novozhilov 4986cb14aa [IR] Extract descriptor part from SymbolTable into separate component
After this change SymbolTable (and ReferenceSymbolTable) contains only
  methods with IdSignatures. All descriptors-related methods are moved
  into DescriptorSymbolTableExtension, which automatically delegates to
  the SymbolTable if needed

At this moment there are cross-references between SymbolTable, because
  descriptor API is still actively used across backends. So SymbolTable
  is accessible in some place then descriptor extension will be accessible
  too

DescriptorSymbolTableExtension is an implementation of abstract SymbolTableExtension
  which allows to implement different kinds of storages, e.g. FIR based
  (it probably will be needed for FIR2IR)
2023-07-17 21:02:39 +00:00
Dmitriy Novozhilov 0067eb85da [IR] Drop unused methods of ReferenceSymbolTable 2023-07-17 21:02:39 +00:00
Dmitriy Novozhilov 36de30a694 [FIR2IR] Don't use SymbolTable for storing IR package fragments
This is needed for getting rid of usages of descriptors API from symbol
  table in K2
2023-07-17 21:02:39 +00:00
Sergey.Shanshin a45fe2d8a8 [KxSerialization] Implemented generation of companions for interfaces
For interfaces with custom serializer (@Serializer(`SerializerType::class)`) now the `serializer()` function is generated in the companion so that user can get a serializer by type

Merge-request: KT-MR-11040
Merged-by: Sergey Shanshin <Sergey.Shanshin@jetbrains.com>
2023-07-17 19:44:01 +00:00
Dmitrii Gridin 38b55c659b [LL FIR] LLFirResolveSessionDepended: add missing mapping for resolveToFirSymbol
We should try to find a declaration from our mapping firstly
Otherwise we can find an invalid element

^KT-60451 Fixed
2023-07-17 17:15:35 +00:00
Alexander Shabalin bdb534c3de [K/N] Fix perf build 2023-07-17 16:56:34 +00:00
Alexander Udalov 1e9979a6b7 Tests: rename FirPsi{Old,}DiagnosticsTestWithJvmIrBackendGenerated 2023-07-17 16:55:24 +00:00
Alexander Udalov 8fc6c03e16 Tests: merge firTestWithJvmBackend into testsWithJvmBackend 2023-07-17 16:55:24 +00:00
Alexander Udalov 9935519656 Tests: add RENDER_ALL_DIAGNOSTICS_FULL_TEXT directive
Use it in diagnostic tests with JVM backend instead of the
RENDER_DIAGNOSTICS_FULL_TEXT directive.

This is needed because otherwise in
AbstractDiagnosticsTestWithJvmBackend there are two handlers trying to
dump full diagnostic texts: JvmBackendDiagnosticsHandler and
FirDiagnosticsHandler, which dump different diagnostics (reported by
backend vs frontend) and in slightly different formats.

In fact, this is why exceptionFromInterpreter.fir.diag.txt was added in
48484368c7: the existing .diag.txt was detected as incorrect by
FirDiagnosticsHandler (even though the diagnostics are the same, just
printed in a different way), which led to the creation of .fir.diag.txt.
For these tests, the behavior about checking diagnostic text in
FirDiagnosticsHandler is useless because it doesn't include backend
diagnostics. So we disable it by using another directive.
2023-07-17 16:55:24 +00:00
Alexander Udalov eeef70b2c8 Tests: remove TargetBackend.JVM_OLD
TargetBackend.JVM is equivalent to it at this point.
2023-07-17 16:55:24 +00:00
Alexander Udalov dd3bebb690 Remove obsolete directives in diagnostic backend tests 2023-07-17 16:55:24 +00:00
Alexander Udalov 6f2bb8c05a Rename tests with diagnostics on JVM backend
Remove the "_ir" suffix. It was originally used to distinguish tests on
the JVM IR backend from the old JVM backend ("_old"), but the latter are
removed now.
2023-07-17 16:55:24 +00:00
Alexander Udalov 18be8f50c0 Remove old JVM backend diagnostic tests 2023-07-17 16:55:24 +00:00
Alexander Udalov 815ab15313 Remove JVM_OLD-specific test data from backend diagnostic tests
Old JVM backend is only used as a fallback in Evaluate Expression in the
IDE at this point, so it's supposed to compile only correct code anyway.
2023-07-17 16:55:24 +00:00
Alexander Udalov b03e50129e Tests: fix handling of diag.txt files in diagnostic tests with backend
Also take into account diagnostics reported via
GenerationState.collectedExtraJvmDiagnostics, and render them in the
similar format to KtDiagnostic.

Don't make the test pass if the reported list of diagnostics is empty,
because that defeats the purpose of the test.
2023-07-17 16:55:24 +00:00
Leonid Startsev a17cdfe338 Fix obsolete information in kotlinx-metadata-jvm ReadMe.md 2023-07-17 16:17:03 +00:00
Alexander Kuznetsov ece7dce2ae [debugger] FragmentLocalFunctionPatchLowering: remove pointless visiting
`FragmentLocalFunctionPatchLowering.visitSimpleFunction`
uses a transformer with an overridden `visitCall`.
Inside it visits every nested call recursively in two places:
in the beginning (1, line 59), and via super method
if the current call doesn't refer to a local function (2, line 64).
It leads to a combinatorial explosion: if there are N nested calls
in one expression, then the number of `visitCall` invocations
will be `pow(2, N)`.

Thus, it will take forever to compile certain expressions. A perfect
example of a long nested call is string interpolation: string templates
are being compiled to a chain of `StringBuilder::append` calls. Here's
why IDEA-325225 happens -- the code in the issue has large string
templates, and the resulting `StringBuilder::append` chains may contain
up to 30 links, making for around 1 billion `visitCall` invocations.

However, the visiting (2) is obsolete. First, the visiting (1) will
process all the children of an expression, replacing them with the
right local function calls, if necessary, recursively, up the stack.
Second, the expression itself will be transformed, if necessary, in
that same method, after all its children are processed. That means we
can get rid of one visiting and avoid the combinatorial explosion, yet
all the local function calls will still be correctly processed.

Fixes IDEA-325225, contributes to IDEA-325146


Merge-request: KT-MR-11104
Merged-by: Alexander Kuznetsov <Aleksander.Kuznetsov@jetbrains.com>
2023-07-17 15:21:05 +00:00
Artem Kobzar df0e4e0b53 [K/JS] Remove declarations with @JsExport.Ignore from klib explicit roots 2023-07-17 15:11:47 +00:00
Timofey Solonin 6edfda0204 [MPP] Run pod install through env to prevent ProcessBuilder from missing
PATH modifications

^KT-60394
2023-07-17 14:18:37 +00:00
Igor Yakovlev 78fa93d75c [Wasm] Restrict WasmExport functions for primitive typed signature 2023-07-17 14:01:13 +00:00
Sebastian Sellmair f47b2f404f [Gradle][Minor] Rename IdeArtifactResolutionQuerySourcesAndDocumentationResolver to IdeArtifactResolutionQuerySourcesResolver
^KT-59595 Verification Pending
2023-07-17 13:56:09 +00:00
Sebastian Sellmair e5ac2f2788 [Gradle] Multiplatform Import: Support intellij/gradle 'idea.gradle.download.sources' flag
^KT-60441 Verification Pending
2023-07-17 13:56:09 +00:00
Mikhail Zarechenskiy 3cdb28e95f Remove last usage of ModelBranch API
It was decided to remove ModelBranch completely from Intellij API, see IDEA-309887
2023-07-17 13:52:53 +00:00