Commit Graph

105129 Commits

Author SHA1 Message Date
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
Evgeniy.Zhelenskiy 291d52820c [Reflection] Use reference equality to determine that a callable reference is bound
It helps to avoid problems when receiver object implements structural equals violating the equality contract

#KT-60709
2023-10-05 22:16:39 +00:00
Ilya Kirillov 64f90f685d [Analysis API] create declarations from a library with library origin in StubBasedFirDeserializedSymbolProvider 2023-10-05 17:01:40 +00:00
Ilya Kirillov a3b67594ff [FIR] add more information to ISE "Status should be resolved for a declaration to create it fake override" exception
^KT-62268
2023-10-05 17:01:40 +00:00
Ilya Kirillov 68c7673cb3 [Analysis API FIR] fix ISE "Status should be resolved for a declaration to create it fake override"
on calling completion on an instance of `kotlin.Pair`.

Caused by unresolved status for `copy` created for data classes from a library.

^KT-62268 fixed
2023-10-05 17:01:40 +00:00
Ilya Kirillov 5d769bf524 [Analysis API] add possibility to have different results for standalone/ide Analysis API mode in tests 2023-10-05 17:01:40 +00:00
Pavel Kirpichenkov 80832ddae1 [K2, JS] Don't fail on missing JS module kind service in IDE
There's no module kind check for IDE at the moment: IDE modules don't
have access to compiler arguments or configuration. K1 currently doesn't
report the diagnostic either. See KTIJ-27279 for more details.

This commit repeats K1 behaviour: K2 IDE won't fail because of the
missing service, but the diagnostic won't be reported in IDE, only
during compilation.

KT-61615
2023-10-05 15:50:35 +00:00
Anna Kozlova da385210d8 [AA] provide psiType#asKtType conversion
it's useful for IDE's features such as write UAST or refactorings

^KT-62302 fixed

Merge-request: KT-MR-12414
Merged-by: Anna Kozlova <Anna.Kozlova@jetbrains.com>
2023-10-05 15:18:55 +00:00
Artem Daugel-Dauge 62544ec9c8 [Gradle] Don't copy DSYM in embedAndSign task
^KT-62232 Verification Pending
2023-10-05 14:40:15 +00:00
Vladimir Sukharev fa4de48d0e [FIR2IR] Create annotations for IrConstructor
^KT-62262 Fixed
2023-10-05 14:37:13 +00:00
Vladimir Sukharev e342d7ff66 [K/N] Revert language version override for uikit sample
^KT-62262
2023-10-05 14:37:13 +00:00
Vladimir Sukharev 520983d52c [K/N] Add failing test for KT-62262: NPE compiling uikit sample
^KT-62262
2023-10-05 14:37:13 +00:00
Brian Norman 2e6dbbe020 [FIR] Completely unwrap original argument when computing type arguments
When computing the conversion type for a type operator call, the
argument needs to be fully unwrapped before getting the resolved type.
This avoids the situation when the argument is a when-subject and the
assumed original type is not correct. Before, only smart-casts were
unwrapped, and this change will also unwrap when-subjects (as well as a
few other FirExpressions).

^KT-62114 Fixed
2023-10-05 14:12:06 +00:00