Commit Graph

95379 Commits

Author SHA1 Message Date
Sergey Bogolepov 3a500e536a Lift restrictions on Context in CompilerPhase
CommonBackendContext is a complex interface that
actually requires many things to be instantiated.
We don't need it for many parts of compilation pipeline:
frontend or object files phases in native backend would
work just fine without CommonBackendContext.
2022-10-13 08:25:26 +00:00
Sergey Bogolepov e1f2b89875 Untie Symbols class from CommonBackendContext
`Symbols.context` property is actually unused. Let's drop
it as it makes harder to create an instance of this class.
2022-10-13 08:24:11 +00:00
Artem Kobzar de880ce9aa [K/JS] Move ES modules logic to a new transformer with IC 2022-10-13 07:32:44 +00:00
Sergey Bogolepov 54deba63a1 Use PhaseConfigurationService in CompilerPhase instead of PhaseConfig 2022-10-13 06:39:39 +00:00
Sergey Bogolepov 06182fe547 Introduce abstraction layer atop of PhaseConfig.
PhaseConfig is tied to some root `compoundPhase` that
defines the whole compilation pipeline. To lift this restriction
and allow dynamically-defined compilation pipelines, let's move
parts of PhaseConfig interface that do not depend on `compoundPhase`
to an interface.
2022-10-13 06:39:38 +00:00
Alexander Korepanov 7b2c125754 [JS IR] Update IC depends graph after intrinsics loading
- Remove unused params from compilerWithIC wrapper.
- Move JsIrBackendContext creation logic into separate function
- Introduce and use compiler interface for IC infrastructure

On dirty rebuild we may reload IR from stdlib,
such reloading may affect files with intrinsics and builtins.
As soon as we load only exported symbols, we must track dependencies
for files with intrinsics or builtins as for others.
This patch implements the logic which updates dependencies for
the stdlib files after loading of intrinsics and builtins.

^KT-54323 Fixed
2022-10-12 22:14:15 +00:00
Denis.Zharkov 31ba1f1534 Add deprecation warning for false-negative TYPE_MISMATCH
See KT-49404 for details

In K1, within SubstitutingScope we approximate almost all the types
containing captured types are being approximated to either a lower or
an upper bound.

While mostly, it's being done correctly there are some problems with
approximations for flexible types

So, the parameter's type of A<in Any>::foo is approximated to Inv<in Any!>,
thus allowing to use Inv<*>, while it's obviously unsound.

NB: For the similar example, in B, there are regular TYPE_MISMATCH
because parameter for B<in Any>::foo is approximated to Nothing

Also, it's important to say that
- in K2 everything works because we don't use type approximation there
- approximation algorithm that works incorrectly is only being used in K1

^KT-54332 Fixed
2022-10-12 20:53:02 +00:00
Denis.Zharkov 4b455c0e51 Minor. Inject CallComponents to CallCheckerContext 2022-10-12 20:53:02 +00:00
Sergey.Shanshin 503f4d924d Added support of MetaSerializable to the FIR 2022-10-12 20:10:58 +00:00
Svyatoslav Scherbina 28340459b0 Bump Kotlin/Native version to 1.8.20-dev-980 2022-10-12 19:12:28 +00:00
Ilya Goncharov 866dee083e [Gradle, JS] Compilation after rebase 2022-10-12 17:59:10 +00:00
Ilya Goncharov 6d7b7724bd [Gradle, JS] Fix filtered arguments for relocated build cache 2022-10-12 17:59:09 +00:00
Ilya Goncharov 715ba5c59f [Gradle, JS] Fix tests 2022-10-12 17:59:09 +00:00
Ilya Goncharov 462c53d566 [JS, IR] Fix creating targets in both mode 2022-10-12 17:59:09 +00:00
Ilya Goncharov 93be8317fa [JS, IR] Fix wasm tests and presets 2022-10-12 17:59:08 +00:00
Ilya Goncharov a3be2c893b [JS, IR] Make IR default for both mode 2022-10-12 17:59:08 +00:00
Anton Bannykh 9342356c38 JS IR: fix type checks for suspend function descendants (^KT-54382 fixed)
Consider `class A : suspend () -> Unit {}`. Type checks such as `is A`
are now performed via a regular `instanceof` check instead of the special
checks for suspend lambdas.
2022-10-12 17:38:23 +00:00
Johan Bay bc13173ea9 [K/N] cinterop: Do not expand non-constant macros
Expanding macros such as __FILE__ or __TIME__ exposes
arbitrary generated filenames and timestamps from the compiler
pipeline which are not useful for interop and makes the klib
generation non-deterministic. This patch instead redefines
the macros to just map to their name in the properties
available from Kotlin.

Co-authored-by: Johan Bay <jobay@google.com>
2022-10-12 16:54:00 +00:00
Anastasiia Spaseeva 49e343e08e Fix condition for execution of prepareSonatypeStaging script.
This fixes a publication to maven central problem after commit cf2d03b9
2022-10-12 18:05:42 +02:00
Yahor Berdnikau ff271a7908 Set maximum supported AGP version in tests to 7.2.1
^KT-53013 Fixed
2022-10-12 15:27:46 +00:00
Yahor Berdnikau faf3638c58 Bump minimal supported AGP to 4.1.3
^KT-53013 In Progress
2022-10-12 15:27:45 +00:00
Ilya Goncharov b01411544a [Gradle, JS] Improvements of kotlin test adapters
- divide adapter.js into different files, which frameworks could load separately
- possibility to inject something to kotlin-test adapter by user

^KT-54418 fixed
2022-10-12 14:14:50 +00:00
Dmitriy Novozhilov d423782fac [FE 1.0] Remove usages of safeAs and cast from most of FE 1.0 modules:
- :core:descriptors
- :core:descriptors.jvm
- :core:deserialization
- :compiler:cli
- :compiler:frontend
- :compiler:frontend:cfg
- :compiler:frontend.java
- :compiler:frontend.common.jvm
- :compiler:psi
- :compiler:resolution
- :compiler:resolution.common
- :compiler:resolution.common.jvm
- :kotlin-reflect-api
2022-10-12 13:58:56 +00:00
Nikolay Krasko 6afceb1e84 Remove more usages for embedded with isTransitive = true
It's a refactoring because the list of dependencies shouldn't change

Follow up for KTI-942
2022-10-12 13:44:30 +00:00
Nikolay Krasko f43ad1cb7a Remove packed stdlib from Kotlin compiler plugin artefacts
Remove annotations, kotlin-stdlib-common, kotlin-stdlib.

Packing those libraries is wrong and probably unexpected. It leads to
artifacts size increase. Can be dangerous because of bad classpath.
And also have a reproducibility issue because of caching tricks around
KotlinVersionCurrentValue class.

KTI-942
2022-10-12 13:44:30 +00:00
pyos 2ec264cfa2 FIR CFG: filter out variables declared inside lambdas more eagerly 2022-10-12 11:56:02 +00:00
Leonid Startsev 090aec6b3b Prohibit Array<T> in @Serializable classes
because it's impossible to correctly create array reflectively without
knowing correct KClass.

Fixes https://github.com/Kotlin/kotlinx.serialization/issues/1243
2022-10-12 11:48:21 +00:00
Leonid Startsev 596949a501 Correctly handle star projections according to logic of the old FE.
#KT-54297 Fixed

Properly substitute surrogate UnitSerializer in the Companion.serializer()
function generated on classes that use polymorphic or sealed serializer
by default. (Fixes https://github.com/Kotlin/kotlinx.serialization/issues/1692)
2022-10-12 10:36:26 +00:00
Leonid Startsev 2a626b27d3 Correctly determine the type of serializable property
when supertype of serializable class is generic and also serializable,
and contains the property with type with its generic parameter.

Fixes https://github.com/Kotlin/kotlinx.serialization/issues/1264
#KT-43910 Fixed
#KT-49660 Fixed
2022-10-12 10:34:53 +00:00
Nikolay Krasko 2ea0cdf46d Rules for commit messages
Part of KTI-944 about adding automatic checks to commit messages.
2022-10-12 09:39:51 +00:00
Mikhail Glukhikh 0080f16cc2 K1: report TYPE_MISMATCH for incorrect assignments in builder
#KT-54004 Fixed
2022-10-12 08:21:13 +00:00
Mikhail Glukhikh 0940707fd4 FE: add reproducer for KT-54004 2022-10-12 08:21:12 +00:00
Nikolay Krasko 80c0c33670 Drop support for old idea versions in verification-metadata.xml 2022-10-12 08:20:27 +00:00
Nikolay Krasko 7484fe8333 Add an explicit requirement for JDK_11_0 in tests-common-new 2022-10-12 08:20:26 +00:00
Nikolay Krasko e1a498e757 Exclude intellij dir when working with compound build 2022-10-12 08:20:26 +00:00
Nikolay Krasko 0e44ad6c60 Minor: explicitly use ext.repoUrl 2022-10-12 08:20:25 +00:00
Nikolay Krasko cfd79c87a6 Minor: fix spelling in the comment 2022-10-12 08:20:25 +00:00
Nikolay Krasko 3853f228af Add a comment about implicit dependency between compiler and plugin
^KTI-746 Fixed
2022-10-12 08:20:24 +00:00
Daniel Santiago 189be2b117 [KAPT] Setup KaptJavaLog writers during initialization.
Migrate KaptJavaLog to not used deprecated constructor in newer JDKs and instead set up the writers during initialization. This enables us to get rid of KaptJavaLog17.

Fixes KT-54030
2022-10-11 23:48:18 +02:00
Sergey.Shanshin f4845b8dd9 Marked write$Self and $serializer from serialization as synthetic 2022-10-11 17:05:03 +00:00
Artem Kobzar 34c32e91e8 [K/JS] Don't remvove @JsExport.Ignore while test generating running 2022-10-11 17:02:23 +00:00
Nikolay Krasko fefc3bdbbc Add review links 2022-10-11 16:20:46 +00:00
Svyatoslav Scherbina dc36272354 Get rid of unsafe cast function usages in :native:frontend.native 2022-10-11 15:12:03 +00:00
Svyatoslav Scherbina 2987340edd Get rid of unsafe cast function usages in :kotlin-native:backend.native 2022-10-11 15:11:36 +00:00
Svyatoslav Scherbina 3e1eddcf54 Get rid of unsafe cast function usages in :native:native.tests 2022-10-11 15:11:03 +00:00
Pavel Punegov 51e337a148 [K/N] Fix watchOS-simulator device name changed in XCode 14 2022-10-11 15:11:01 +02:00
Pavel Punegov b0b3698698 [K/N][build] Make kotlin-native.jar archive version empty
Gradle base plugin sets convention to project's version that can be
SNAPSHOT that brakes name of the archive
2022-10-11 12:50:13 +00:00
sebastian.sellmair fd9f542895 [Gradle][MPP] Remove Kotlin Multiplatform stability warning
^KT-54387 Verification Pending
2022-10-11 12:10:44 +00:00
Anton Lakotka 71fe1dae22 [Gradle] Support Configuration Cache for XCFramework task
^KT-54362
^KT-54339 Verification Pending
2022-10-11 11:20:59 +00:00
Anton Lakotka 13dcb9388c [Gradle] Support Configuration Cache for FatFramework task
^KT-54362
^KT-54339 Verification Pending
2022-10-11 11:20:59 +00:00