Commit Graph

105141 Commits

Author SHA1 Message Date
Dmitrii Gridin 5ebef0dfd1 [LL FIR] simplify common library symbol provider
createCommonLibrarySymbolProvider is simplified to avoid module clashes
and extra search

^KTIJ-27159
^KT-58325
2023-10-09 22:47:32 +00:00
Brian Norman 79303ab2db [FIR] Ignore anonymous functions during annotation argument phase
Anonymous functions (lambdas) are not allowed as annotation arguments.
However, because it is still possible to parse code written this way, it
must be handled without exception. So ignore these expressions when
processing annotation arguments.

#KT-59565 Fixed
2023-10-09 20:03:33 +00:00
Marco Pennekamp 223c793258 [SLC] Order parent classes before nested classes in structure test results
- This improves the readability of the result files.
2023-10-09 19:46:51 +00:00
Marco Pennekamp 9ac639e0d3 [PSI] Add forEachDescendantOfTypeInPreorder
- `forEachDescendantOfTypeInPreorder` is a preorder variant of
  `forEachDescendantOfType`, which operates in postorder.
2023-10-09 19:46:51 +00:00
Marco Pennekamp cd8143af7b [SLC] Fix nested classes missing in SLC structure tests for libraries
^KT-62038 fixed
2023-10-09 19:46:51 +00:00
Marco Pennekamp 315573d99f [SLC] Add SLC structure tests for nested classes
^KT-62038
2023-10-09 19:46:51 +00:00
Pavel Kunyavskiy 4175a0d258 [K/N] Enable test muted because of wrong test infra setup
^KT-61773
2023-10-09 16:52:15 +00:00
Dave MacLachlan c820e82db3 Native: remove linker warning when building libllvmstubs
Building with macOS gave the linker warning
`ld: warning: ignoring duplicate libraries: '/Users/foo/.konan/dependencies/apple-llvm-20200714-macos-aarch64-1/lib/libclangEdit.a'`

Remove duplication from the build script to get rid of the warning.

Co-authored-by: Dave MacLachlan <dmaclach@gmail.com>
2023-10-09 16:49:16 +00:00
Alexander Udalov 9164b7d405 K2 kapt: remove reference to "kapt 4" from the warning
#KT-62438 Fixed
2023-10-09 16:08:45 +00:00
Anna Kozlova 79193006ce [LC] light methods should provide type parameters for on the fly resolve
References inside LC apis are build over `ClsJavaCodeReferenceElement`,
which simplifies resolve by providing precalculated data.
When refactorings or quick fixes do on the fly resolve,
giving only text and LC context,
such precalculated data is not available and normal resolve starts.
In order for this resolve to work correctly,
LC should provide available declarations

Corresponding test in monorepo: `KotlinSymbolOnAirResolveTest`

^ KT-62440 fixed
2023-10-09 15:42:52 +00:00
Alexander.Likhachev afdd8466cc [Gradle] Introduce KotlinBuildStatsServicesRegistry to manage FUS services
KT-57371 introduced a legacy JMX service without proper management.
#KT-62318 Fixed
2023-10-09 13:44:29 +00:00
Alexander.Likhachev bb23602cb3 [Gradle] Do not hold a reference to Gradle objects in FUS services
Despite the FUS services are intended to be scoped to a build, the legacy compatibility service wasn't properly managed and that caused a significant memory leak together with changes in KT-59826.
#KT-62318 In Progress
2023-10-09 13:44:29 +00:00
Ilmir Usmanov 197f0112b4 Minor. Add regression test for KT-62127
#KT-62127 Fixed
2023-10-09 12:43:27 +00:00
Evgenii Mazhukin 203b7a4da3 [KGP] Treat friendPaths as non-incremental Input property
When friendPaths change, internal symbols from other modules become hidden
or visible. This might change which functions are called, which types
are returned, etc. So we should recompile the affected classes.

Gradle doesn't allow Input policy on FileCollection properties, so we
introduce friendPathsSet. It allows us to keep the ABI of BaseKotlinCompile
unchanged, detect non-incremental configuration changes on Gradle side,
and use normal incremental compilation for everything else.

^KT-61918 Fixed


Merge-request: KT-MR-12372
Merged-by: Evgenii Mazhukin <evgenii.mazhukin@jetbrains.com>
2023-10-09 11:23:02 +00:00
Dmitriy Novozhilov d9ddac5571 Advance bootstrap to 2.0.0-dev-4562 2023-10-09 09:30:38 +00:00
Dmitriy Novozhilov 91667d4e00 [Build] Fix update-bootstrap script 2023-10-09 09:30:37 +00:00
Dmitriy Novozhilov b9744f5315 [Build] Remove incorrect dependency from :kotlin-compiler for JPS build 2023-10-09 07:46:50 +00:00
Nikolay Lunyak 2e7dcd6096 [FIR] Require overrides to have matching isSuspend flag value
^KT-57100 Fixed
2023-10-09 06:55:43 +00:00
Nikolay Lunyak 4e58715760 [FIR] Check conflicting overloads via scopes
Scopes may return private symbols from
supertypes, they should not clash with
symbols from the current class.

For example, see:
`FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated.FakeOverride#testPrivateFakeOverrides1`

Lombok shouldn't generate functions if the
user has defined explicit ones.

In K1 generated functions are not really
added to the declared members scope.

^KT-61243 Fixed
2023-10-09 06:55:43 +00:00
Nikolay Lunyak 973248f432 [FIR] Reproduce KT-57100 2023-10-09 06:55:43 +00:00
Alexander Udalov 3116e26204 CLI: update jansi to 2.4.0 to support colors on arm macs
#KT-62350 Fixed
2023-10-08 20:55:23 +00:00
Kirill Rakhman a652c93828 [FIR] Remove useless call to FirWhenSubjectExpression.replaceConeTypeOrNull
This operation is a no-op.

#KT-61316
2023-10-06 21:26:42 +00:00
Anton Lakotka d820ddc27d [Gradle] Mark "main" metadata compilation as non-klib in all cases
Metadata compilation with name "main" isn't used in Hierarchical
Multiplatform. It used to compile commonMain source set to legacy
metadata artifacts. With Hierarchical MPP common source sets start
to compile to klib metadata.
2023-10-06 15:39:05 +00:00
Anton Lakotka f01c8de216 [Gradle] Add multiplatformExtension.metadataTarget 2023-10-06 15:39:05 +00:00
Anton Lakotka 0230f809c4 [Gradle] Fix CME when subplugins create source sets
GranularMetadataTransformation.ProjectData is created for all projects
There was a chance when it is created too early before some projects
evaluation. And if that happened that these projects contained some
subplugins (for example KSP) that add more source sets. Then old
algorithm of collecting sourceSetsMetadataOutputs() would fail with
ConcurrentModificationException. For example in this scenario:

Lets assume we evaluate sourceSetsMetadataOutputs for project with
just one common source set: commonMain.
And therefore one metadata compilation whose default source set name is:
commonMain.
On top of that a subplugin applied to this project. This subplugin
creates additional source set for each metadata compilation.

Then with old algorithm following would happen:

* start iterating over sourceSets
* for `commonMain` source set await its Metadata Compilation
* * When Metadata Compilation gets configured at some point of time
 it will reach KotlinCommonSourceSetProcessor.doTargetSpecificProcessing
 method. Which will apply subplugins.
* * When subplugin is applied it adds a new Source Set to
  the sourceSets collections: CME is occurred!

Adding a source set in subplugins should be regulated
either allow it and fix related side effects OR deprecate it.

The current fix doesn't solve all potential issues with adding new
source sets from subplugins. It primarily focused on CME occurrence
for the case above.

^KT-62299 Verification Pending
2023-10-06 15:39:05 +00:00
Dmitrii Gridin f124ba627d [FIR] implicit type: avoid redundant property and function transformations
This is a contract violation – we can touch only bodies during this phase

^KT-56551
2023-10-06 14:13:37 +00:00
Dmitrii Gridin ddc4fac896 [FIR] add missing transformation of type parameters during annotation arguments phase
^KT-56551
2023-10-06 14:13:36 +00:00
Dmitrii Gridin 61063a19b6 [FIR] add missing transformation of backing field during annotation arguments phase
^KT-56551
2023-10-06 14:13:36 +00:00
Dmitrii Gridin 889c210576 [FIR] add more tests for implicit type phase
These tests demonstrate the implicit type phase problem - annotations
are also resolved, although they should not

^KT-56551
2023-10-06 14:13:36 +00:00
Dmitrii Gridin d4bc5dc717 [LL FIR] add more tests on lazy resolution for implicit type phase
These tests demonstrate the implicit type phase problem - annotations
are also resolved, although they should not

^KT-56551
2023-10-06 14:13:36 +00:00
Ivan Kochurkin 2151e34de3 [FIR] Merge getSingleCompatibleOrWeaklyIncompatibleExpectForActualOrNull into getSingleExpectForActualOrNull
Use getSingleExpectForActualOrNull everywhere
2023-10-06 12:29:01 +00:00
Ivan Kochurkin 89fe73f6f4 [FIR] Consider expect default function parameters in FirSuperCallWithDefaultsChecker
^KT-61572 Fixed
2023-10-06 12:29:01 +00:00
Ivan Kochurkin ec5fd02ab9 [FIR] Enable FirSuperCallWithDefaultsChecker for Native
It's enabled for JVM and Native in K1
2023-10-06 12:29:01 +00:00
Evgeniy.Zhelenskiy feed3a57d0 [FIR] Report wrong modifiers in function type arguments and types of value parameters
#KT-59955
2023-10-06 12:22:57 +00:00
Nikita Bobko 43c97077eb 2/2 Extract K1 KMP matcher in its own subsystem. Fix compilation errors 2023-10-06 11:41:22 +00:00
Nikita Bobko cc70f78027 1/2 Extract K1 KMP matcher in its own subsystem. Copy files
This commit is literally this shell command:
```
cp compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/mpp/AbstractExpectActualAnnotationMatchChecker.kt compiler/resolution/src/org/jetbrains/kotlin/resolve/multiplatform/K1AbstractExpectActualAnnotationMatchChecker.kt
cp compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/mpp/AbstractExpectActualCompatibilityChecker.kt compiler/resolution/src/org/jetbrains/kotlin/resolve/multiplatform/K1AbstractExpectActualCompatibilityChecker.kt
cp compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/mpp/ExpectActualCollectionArgumentsCompatibilityCheckStrategy.kt compiler/resolution/src/org/jetbrains/kotlin/resolve/multiplatform/K1ExpectActualCollectionArgumentsCompatibilityCheckStrategy.kt
cp core/compiler.common/src/org/jetbrains/kotlin/resolve/multiplatform/ExpectActualCompatibility.kt compiler/resolution/src/org/jetbrains/kotlin/resolve/multiplatform/K1ExpectActualCompatibility.kt
cp compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/mpp/ExpectActualMatchingContext.kt compiler/resolution/src/org/jetbrains/kotlin/resolve/multiplatform/K1ExpectActualMatchingContext.kt
cp core/compiler.common/src/org/jetbrains/kotlin/resolve/multiplatform/ExpectActualMemberDiff.kt compiler/resolution/src/org/jetbrains/kotlin/resolve/multiplatform/K1ExpectActualMemberDiff.kt
```

Motivation: KMP is going to evolve in K2 a lot. But we don't want to
touch K1 version of KMP. That's why it's easeir to just copy-paste
expect-actual matcher into K1 flavor
2023-10-06 11:41:22 +00:00
Dmitrii Gridin 96c45c74e8 [LL FIR] improve contract violation checks
Add check into LLFirModuleLazyDeclarationResolver to die fast
and avoid StackOverflowError for jumping phases

^KT-56551
^KT-57802
^KT-57811
2023-10-06 11:40:05 +00:00
Ilya Kirillov 0fb3c033e7 [Analysis API FE10] introduce an exception which marks some parts of the Analysis API as not supported for K1 2023-10-06 11:39:33 +00:00
Ilya Kirillov 9dcd142f0d fixup! [Analysis API] implement an API to get a substitution based on a inheritance relationship between classes 2023-10-06 11:39:33 +00:00
Ilya Kirillov 8f6b3d37b9 fixup! [Analysis API] implement an API to get a substitution based on a inheritance relationship between classes 2023-10-06 11:39:33 +00:00
Ilya Kirillov 15e4cbc10d [Analysis API] implement an API to get a substitution based on an inheritance relationship between classes
^KT-62090 fixed
2023-10-06 11:39:33 +00:00
Ilya Kirillov 49cfbb0576 [Analysis API] remove duplicating logic for building KtSubstitutor by ConeSubstitutor 2023-10-06 11:39:33 +00:00
Ilya Kirillov 1107e728a2 [Analysis API] implement better rendering for chained KtSubstitutor 2023-10-06 11:39:33 +00:00
Ilya Kirillov e2d248b76d [FIR] extract functionality to a public function to use from Analysis API
^KT-62090
2023-10-06 11:39:33 +00:00
Pavel Kunyavskiy a561a8e531 [K/N] Improve the exception message in code generator exceptions
^KT-62335
2023-10-06 11:39:03 +00:00
Ilya Gorbunov 7bdcaff89a KT-61126 Change test expectations
Also improve failure diagnostics in test
2023-10-06 00:46:08 +00:00
Ilya Gorbunov 785d6858ea KT-62004 Drop legacy JS build of kotlin-stdlib
- preserve kotlin-stdlib-js.jar in dist and maven
- change packaging to klib in .pom
- fix manifest attributes of kotlin-stdlib-js
2023-10-06 00:46:08 +00:00
Ilya Gorbunov 6d5b1f84f9 KT-62004 Publish kotlin-dom-api-compat only for JS IR consumers 2023-10-06 00:46:08 +00:00
Ilya Gorbunov 2590e7f48b KT-62004 Add kotlin-test maven artifacts to BOM integration test 2023-10-06 00:46:08 +00:00
Ilya Gorbunov eb813b7837 KT-62004 Drop legacy JS build of kotlin-test 2023-10-06 00:46:08 +00:00