Commit Graph

102102 Commits

Author SHA1 Message Date
Ivan Kylchik 8f88f08573 [FIR] Use correct source for implicit this receiver
#KT-57489 Fixed
#KT-56139 Fixed
#KT-56755 Fixed
2023-06-23 07:23:39 +00:00
Vladimir Sukharev ab03cb2357 [Test] Convert IGNORE: NATIVE directives in box tests sam/* and sameFile*/*
^KT-59057

Merge-request: KT-MR-10758
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-06-23 06:23:53 +00:00
Alexander Udalov 4db2bc28f2 Minor, suppress unchecked cast warning 2023-06-22 18:55:56 +00:00
Alexander Udalov ab195b68a5 Build: remove explicit enabling of RangeUntilOperator
This feature is enabled by default since 1.8. Using the `-XXLanguage`
compiler argument leads to big warnings which are distracting during the
build.
2023-06-22 18:55:56 +00:00
Ivan Kylchik 2115d55e1c [IR] Forbid to interpret expressions that involves unsigned numbers
We want to forbid expressions of type `Unsigned == Unsigned` or
similar. Working with unsigned numbers we can only inline them on the
call site or use in `String.plus` expression.

This commit fixes problem in test `unsignedTypesInAnnotations`. Here
interpreter thinks that expression `ONE_UINT != 1u` can be
evaluated, but fails to do it. This fail prevent us from inlining
`ONE_UINT` and on runtime we get error about missing getter.
Earlier this property would have been inlined by `ConstLowering`,
but we got rid of it.
2023-06-22 18:49:50 +00:00
Ivan Kylchik d1a54a522d [JVM IR] Drop ConstLowering
It basically can be replaced with IR interpreter. The only half-hack
was required in `PropertyReferenceLowering`. Const interpreter is
running before it, so we can't optimize some calls on const
properties that appear after this lowering. Solution is to inline
constants manually during property reference lowering.
2023-06-22 18:49:50 +00:00
Vladimir Sukharev 1bf3bde4f8 [Test] Convert IGNORE: NATIVE directives in box tests from J to J
^KT-59057

Merge-request: KT-MR-10749
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-06-22 18:39:59 +00:00
Vladimir Sukharev f3fcaa69eb [Test] Convert IGNORE: NATIVE directives in box tests from T to W and boxInline
^KT-59057

Merge-request: KT-MR-10752
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-06-22 18:33:24 +00:00
Artem Kobzar 64158a8a2f [K/JS] Add file-to-file compilation ^KT-6168 Fixed 2023-06-22 18:23:45 +00:00
Alexander Udalov a44b5e4562 JVM IR: do not copy call in JvmStaticAnnotationLowering
This is just a refactoring/optimization that makes use of the fact that
IrCall.symbol is now mutable.
2023-06-22 17:19:00 +00:00
Alexander Udalov 572892dc8a JVM IR: do not copy call in InterfaceObjectCallsLowering
This is just a refactoring/optimization that makes use of the fact that
IrCall.symbol is now mutable.
2023-06-22 17:19:00 +00:00
Alexander Udalov 7ae195d9eb JVM IR: do not copy call in ReplaceNumberToCharCallSitesLowering
This is just a refactoring/optimization that makes use of the fact that
IrCall.symbol is now mutable.
2023-06-22 17:19:00 +00:00
Alexander Udalov 994d61a360 JVM IR: do not copy call in ResolveInlineCalls
This is just a refactoring/optimization that makes use of the fact that
IrCall.symbol is now mutable.
2023-06-22 17:19:00 +00:00
Alexander Udalov c8862f3aa8 JVM IR: do not copy call in UpdateFunctionCallSites
This is just a refactoring/optimization that makes use of the fact that
IrCall.symbol is now mutable.
2023-06-22 17:19:00 +00:00
Alexander Udalov 943dde0cbb JVM IR: do not copy call in ReplaceKFunctionInvokeWithFunctionInvoke
This is just a refactoring/optimization that makes use of the fact that
IrCall.symbol is now mutable.
2023-06-22 17:19:00 +00:00
Alexander Udalov 755d140e16 Parcelize: do not copy call in ParcelizeIrTransformer
This is just a refactoring/optimization that makes use of the fact that
IrCall.symbol and IrFunctionReference.symbol are now mutable.
2023-06-22 17:19:00 +00:00
Alexander Udalov b75aa9af4e IR: do not copy call in CrossFileCallAdjuster
This is just a refactoring/optimization that makes use of the fact that
IrCall.symbol is now mutable.
2023-06-22 17:18:59 +00:00
Alexander Udalov 42057b7fe0 IR: do not copy call in ForLoopsLowering
This is just a refactoring/optimization that makes use of the fact that
IrCall.symbol is now mutable.
2023-06-22 17:18:59 +00:00
Alexander Udalov bb4d25dfc9 IR: do not copy calls/references in ExpectSymbolTransformer
This is just a refactoring/optimization that makes use of the fact that
IrCall.symbol and other similar fields are now mutable.
2023-06-22 17:18:59 +00:00
Alexander Udalov 978553c513 IR: make call symbols mutable
This will help in some lowerings which need to change the callee of a
call. Instead of creating a new call and copying everything (type
arguments, value arguments, receivers, annotations, attributes, ...),
it's easier to modify the `symbol`. In a way, this is a continuation of
22b4b29292.
2023-06-22 17:18:59 +00:00
Alexander Udalov 3744192806 IR: minor, remove redundant override IrSetValue.symbol 2023-06-22 17:18:59 +00:00
Aleksei.Cherepanov a3583ea79b Add the possibility to omit explicitly specifying a version in annotationProcessorPaths
Resolve the version of the annotation processor path (specified in annotationProcessorPaths) in kapt plugin if it is already specified in dependencies of this module or parent module. Plugin management is also supported.

#KT-59521 In Fixed

Merge-request: KT-MR-10761
Merged-by: Aleksei Cherepanov <aleksei.cherepanov@jetbrains.com>
2023-06-22 17:13:24 +00:00
Alexander Udalov e4d1e6246e CLI: increase default value of Xms option
According to the preloader's "-measure" option, just the raw class files
occupy ~50 Mb during compilation of hello world (~55 Mb for K2). So 32M
is a very outdated value for Xms. This change sets it to something more
reasonable to hopefully avoid unnecessary GCs and thus help with
performance and potentially with OOMs (KT-58690).

 #KT-58690
2023-06-22 17:10:11 +00:00
Sergej Jaskiewicz 0ae95b39c3 [IR] Reorder parameters in IrFactory#createConstructor
This is to prepare for IrFactory auto-generation (KT-59308).
2023-06-22 16:31:17 +00:00
Pavel Kunyavskiy f486fc942b [K/N] Fix special backend checks tests 2023-06-22 16:22:59 +00:00
Sergej Jaskiewicz 0b7db067e6 [IR] Reorder parameters in IrFactory#createField
This is to prepare for IrFactory auto-generation (KT-59308).
2023-06-22 15:55:02 +00:00
Ilya Goncharov 90f6c53bf8 [Gradle, Js] Use dynamic import to catch exceptions during wasm compilation 2023-06-22 15:46:31 +00:00
Alexander.Likhachev 9d128c8d0d [Build] DeclarewriteStdlibVersion as an explicit dependency of K/N stdlib
#KTI-1221 In Progress
2023-06-22 15:16:08 +00:00
Alexander.Likhachev a93c49baf1 [Build] Fix a bunch of buildscript compilation warnings
#KTI-1221 Fixed
2023-06-22 15:16:08 +00:00
Alexander.Likhachev 46e83ef7da [Gradle] Specify children projects names in functional tests to avoid ambiguity
#KTI-1221 In Progress
2023-06-22 15:16:08 +00:00
Alexander.Likhachev e9fa576297 [Gradle] Fix expected JVM target version in compiler arguments test
Since Gradle 8.0, the JDK used to run Gradle is exposed to plugins as a JVM toolchain, thus it configures the jvm target as it was a regular used-configured JVM toolchain
https://docs.gradle.org/8.1/userguide/upgrading_version_7.html#toolchain_based_tasks_for_jvm_projects
#KTI-1221 In Progress
2023-06-22 15:16:08 +00:00
Alexander.Likhachev 76ba0c60b2 [Gradle] Update Gradle integration tests code as the new stdlib is now available
#KTI-1221 In Progress
2023-06-22 15:16:08 +00:00
Alexander.Likhachev 7690904bc4 [Gradle] Update AGP for KGP functional tests to support Gradle 8
#KTI-1221 In Progress
2023-06-22 15:16:08 +00:00
Alexander.Likhachev 862f8f235c [Build] Bump Gradle version to 8.1.1
#KTI-1221 In Progress
2023-06-22 15:16:08 +00:00
Alexander.Likhachev 786653baf2 [Build] Use separate sbom directories per publication
Currently, `SpdxSbomTask` declares output file not as `@OutputFile`, but `@OutputDirectory` leading to overlapping outputs problem. This way the problem is worked around.
#KTI-1221 In Progress
2023-06-22 15:16:08 +00:00
Alexander.Likhachev 407a2d4203 [Build] Remove usages of Provider.forUseAtConfigurationTime()
It's not required anymore and was deprecated since Gradle 7.4
#KTI-1221 In Progress
2023-06-22 15:16:08 +00:00
Alexander.Likhachev 58490ea184 [Build] Configure sourcesJar task dependencies explicitly
The `sourcesJar` task uses outputs of code generation tasks, thus it should be declared, so Gradle would know that's not a misconfiguration.
https://docs.gradle.org/8.1/userguide/validation_problems.html#implicit_dependency
#KTI-1221 In Progress
2023-06-22 15:16:08 +00:00
Alexander.Likhachev 3affe78ae5 [Build] Make K/N backend sources publishing for IDE in a less hacky way
The previous way was too hacky relying on internal API
#KTI-1221 In Progress
2023-06-22 15:16:08 +00:00
Alexander.Likhachev 8dd957d371 [Build] Mark kotlin.test publication variant not consumable
Their attribute sets are the same as for platform-specific publications, thus Gradle raises a legit deprecation warning here. These configurations are not being consumed directly, so it's fine to make them not consumable
#KTI-1221 In Progress
2023-06-22 15:16:08 +00:00
Alexander.Likhachev 01276bbe49 [Build] Fix buildscripts deprecation warnings
#KTI-1221 In Progress
2023-06-22 15:16:08 +00:00
Alexander Udalov 1588b07472 Tests: unmute light analysis tests passing with JVM_IR 2023-06-22 17:10:51 +02:00
Alexander Udalov cab53361f3 Use JVM IR backend in light analysis mode tests
Add some more filters on private/synthetic stuff (which doesn't matter
in practice) to make full and light analysis mode dumps as similar as
possible, so that all existing tests will pass for JVM IR. Unmute some
tests which were failing with the old JVM backend.

Tests on repeatable annotations are muted because in full analysis,
annotations are wrapped into the container (e.g. `@A(1) @A(2)` ->
`@A$Container(A(1), A(2))`), but they are no in the light analysis mode.
So there's always going to be a difference for these tests between full
and light analysis, unless we're going to change behavior of kapt, which
would be a kind of a breaking change.

 #KT-58497 Fixed
2023-06-22 17:10:51 +02:00
Alexander Udalov 6cce510319 Tests: tweak light analysis mode test filters
Do not compare private and synthetic methods between full and light
analysis modes, some private fields, and InnerClasses attributes. This
is needed to prepare these tests for migration to JVM IR.
2023-06-22 17:10:51 +02:00
Alexander Udalov f56bbd68d7 Kapt+JVM_IR: generate stub bodies for property accessors
Similarly to how stub bodies are generated for functions in the kapt
mode (see `BodyGenerator.generateFunctionBody`).

This is more useful then not generating bodies at all, because otherwise
in the -Xjvm-default=all/all-compatibility modes it would be difficult
to differentiate functions with default implementations from the ones
without (because they all would lack body and thus be generated as
abstract into the resulting Java stub).

The effect of this change is pretty minor, so there's no YT issue. But
it fixes light analysis tests run with JVM_IR in
`codegen/box/jvm8/defaults`, because now there's no difference between
full analysis and light analysis for interfaces with default methods in
new modes.
2023-06-22 17:10:51 +02:00
Alexander Udalov 4ac6f01d31 Add ReplaceWithSupertypeAnonymousTypeTransformer to light analysis tests
To make these tests behave closer to kapt, since kapt is the primary use
case for the light analysis mode.

AbstractLightAnalysisModeTest compares the text dump of bytecode
obtained with full analysis and light analysis, removing things like
anonymous/synthetic entities. In the light analysis mode anonymous
objects in supertypes are always approximated, and in the full analysis
mode they are always present as is in signatures. So we're transforming
the text dump in the same way, by approximating anonymous objects in
signatures (more precisely, in return types of methods and fields) to
the supertype.
2023-06-22 17:10:51 +02:00
Alexander Udalov c5f44486a9 Rename KaptAnonymousTypeTransformer and move to frontend.java
This is needed in order to run light analysis mode tests for JVM IR
backend. In the subsequent commit, this extension is added to light
analysis mode tests.

Kapt stub generation uses this extension to transform local types to
non-local:

    private val x = object {}

With this extension, x's type will be `Any`. Without it, it will be an
anonymous type. This anonymous type was not a problem for the old JVM
backend, but it's difficult to translate it in the IR infrastructure in
the light analysis mode where bodies are not resolved.

When kapt stub generation works with JVM IR enabled,
KaptAnonymousTypeTransformer ensured that backend would not crash and
stubs would contain something useful.

However, this is not happening in light analysis mode tests, which are
supposed to check how compiler behaves in the light analysis mode which
is used in kapt.
2023-06-22 17:10:50 +02:00
Kirill Rakhman c95a9ff55e [FIR] Only mark declaration name with ACTUAL_WITHOUT_EXPECT
#KT-58827 Fixed
2023-06-22 14:59:19 +00:00
Vladimir Sukharev 3e6175fe30 [Test] Convert IGNORE: NATIVE directives in box tests "super"
^KT-59057

Merge-request: KT-MR-10764
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-06-22 14:50:18 +00:00
Pavel Mikhailovskii 9f763deea1 KT-59325 [SLC] Fix generation of fields from companion objects 2023-06-22 14:48:12 +00:00
Anna Kozlova 190d49a1e0 [light classes] optimize accessors retrieval
Avoid expensive calls to `navigationElement` for methods
that cannot be getters/setters and would be filtered later.
Repeat partly naming generation strategy.

Merge-request: KT-MR-10689
Merged-by: Anna Kozlova <Anna.Kozlova@jetbrains.com>
2023-06-22 14:14:39 +00:00