Commit Graph

106564 Commits

Author SHA1 Message Date
Ilya Goncharov 08e3cb300a [JS] Migrate tests onto IR compiler with outputDir API instead of outputFile
^KT-61117 fixed
2023-11-29 11:21:56 +00:00
Yahor Berdnikau e50f6e6bca [Gradle] Add '@JvmStatic' annotation to companion methods in Kotlin types
This should improve usability in groovy scripts.

^KT-63601 Fixed
2023-11-29 10:24:23 +00:00
Dmitrii Gridin 21de05e5ac [FIR] FirDeclarationsContractResolveTransformer: drop redundant transformations
There is no sense to trying to transform aliases and dangling lists
2023-11-29 10:24:03 +00:00
Dmitrii Gridin 06aad65ed3 [FIR] pass correct scope during annotation resolve for local declarations
We should pass container for correct logic around CLASS_HEADER_ANNOTATIONS.
Also, such correct containers will be used in the context of KT-63042 to
correctly detect an annotation ownership

^KT-63042
^KT-63842 Fixed
2023-11-29 10:24:03 +00:00
Dmitrii Gridin fcb3f003dc [FIR] add more tests on annotations for local declarations
^KT-63842
2023-11-29 10:24:02 +00:00
Dmitrii Gridin 98e12b0d7b [FIR] add missed scope for annotations on property receiver, typealias and init and dangling list
Also, we shouldn't transform type alias during the implicit type phase

^KT-63042
^KT-63832 Fixed
2023-11-29 10:24:02 +00:00
Dmitrii Gridin aaaf35fcb8 [FIR] add missed tests for declaration annotations
^KT-63832
2023-11-29 10:24:02 +00:00
Egor Kulikov 001e9a4489 [FIR] Source for property delegates should not be null
^KT-60327 fixed


Merge-request: KT-MR-13221
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
2023-11-29 08:27:53 +00:00
Roman Efremov 5cf33c3556 [IR] Render different quotes depending on IR constant type
This is needed for ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT diagnostic
message, but also seems to be good improvement for IR dumps in tests.

^KT-62559
2023-11-28 23:17:23 +00:00
Roman Efremov 8f6b6e17be [IR] Print annotation arguments in report of ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT
Now IR checker is not duplicated by FIR checker reporting, so it's
useful to have more verbose report of annotations in diagnostic message.

^KT-62559
2023-11-28 23:17:23 +00:00
Roman Efremov ec7a2c20d1 [FIR] Beautify ::class expression rendering in annotation arguments
...in `ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT` diagnostic message.

^KT-62559
2023-11-28 23:17:23 +00:00
Roman Efremov c609de5195 [FIR] Refactor: extract class reference expression rendering out of
...`FirRenderer`.

^KT-62559
2023-11-28 23:17:23 +00:00
Roman Efremov fa897e4148 [Tests] Cover rendering of KClass annotation args in
...`ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT`.

^KT-62559
2023-11-28 23:17:23 +00:00
Roman Efremov 29c82c668f [IR] Prevent duplicated reports of ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT
...on property accessors and enum entries.

^KT-62559
2023-11-28 23:17:23 +00:00
Roman Efremov 2b120f6cdc [Tests] Cover rendering of diagnostic text by IR checker in
...`ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT`.

^KT-62559
2023-11-28 23:17:23 +00:00
Svyatoslav Scherbina 3297e6774f Bump Kotlin/Native version in KGP to 2.0.0-dev-8858 2023-11-28 19:08:21 +00:00
Sergey Bogolepov fe77fe89f4 [Swift Export] update CODEOWNERS to include new modules 2023-11-28 18:00:43 +00:00
Sergey Bogolepov ec82d54ef7 [Swift Export] Fix test infrastructure according to the review 2023-11-28 18:00:43 +00:00
Gleb Lukianets c3725ec8c8 rrn/rd/KT-63266/sir-gen
Swift Export: generated sir snapshot

Merge-request: KT-MR-13128
Merged-by: Gleb Lukianets <Gleb.Lukianets@jetbrains.com>
2023-11-28 18:00:43 +00:00
Artem Olkov 1f4099833a KT-63269: add dependency on dist for sir-analysis-api tests, as they are dependent on JVM dist
Merge-request: KT-MR-13142
Merged-by: Artem Olkov <artem.olkov@jetbrains.com>
2023-11-28 18:00:43 +00:00
Sergey Bogolepov 58bef34b9c [Swift Export] Rename tests generation tool
Now it generates test-cases for sir-compiler-bridges as well,
so it makes sense to move away from Analysis API in its name.
2023-11-28 18:00:43 +00:00
Sergey Bogolepov fe9ab0a1fc [Swift Export] KT-63516
Add a sir-compiler-bridge module that adds Kotlin and C bridges
for SIR. As SIR is still WIP, the module accepts `BridgeRequest`
instances instead of SIR elements.
2023-11-28 18:00:43 +00:00
Artem Olkov 7c15e3f229 KT-63269: implementation for SIRGenerator with top-level functions
KT-63269: add test generator

Merge-request: KT-MR-12945
Merged-by: Artem Olkov <artem.olkov@jetbrains.com>
2023-11-28 18:00:43 +00:00
Sergey Bogolepov cc14f11e2a [Swift Export] initial infrastructure for Swift IR
New modules 'sir', 'sir-passes', and 'sir-analysis-api' were added under
'native:swift' for creating and manipulating Swift IR elements.

* `sir` contains the implementation of Swift IR.
* `sir-analysis-api` contains translation from Analysis API to SIR.
* `sir-passses` contains transformation passes.

This groundwork will allow to progress with the Swift IR.
2023-11-28 18:00:43 +00:00
Svyatoslav Scherbina d15ee71b6c Native: get rid of __NSCFBoolean references in ObjCExport
ObjCExport accessed `__NSCFBoolean` using
`objc_getClass("__NSCFBoolean")`. This class is a private API.
Remove this private API usage by getting the same class from
`[[NSNumber numberWithBool:YES] class]` instead.

Also remove `__NSCFBoolean` from the related error messages.

`__NSCFBoolean` didn't cause Kotlin-compiled apps to be rejected by
Apple, but this commit reduces the risk that this might happen in the
future, and addresses related user concerns.

^KT-62091
2023-11-28 17:57:47 +00:00
Svyatoslav Scherbina 707a650de1 Native: improve tests for __NSCFBoolean RTTI conversion
- ObjCExport tests for numbers RTTI conversions didn't really check
  RTTI, because of a compiler optimization. Fix this by converting to
  Any.
- Also add more tests that specifically check that bool `NSNumber` get
  dynamically converted to `kotlin.Boolean` box. Those tests can't be
  affected by possible future compiler optimizations.
2023-11-28 17:57:47 +00:00
Sergej Jaskiewicz 7bd4de65f8 [IR generator] Deduplicate field copying logic 2023-11-28 16:24:40 +00:00
Sergej Jaskiewicz 5f04bc8a27 [IR generator] Simplify computation of walkable children
Don't require to specify them explicitly via `isChild` in IR generator,
instead test the field type whether it is an element.
2023-11-28 16:24:40 +00:00
Sergej Jaskiewicz ad4e97154f [FIR/IR generator] Factor out allFields to AbstractElement 2023-11-28 16:24:40 +00:00
Sergej Jaskiewicz 38ee477ab4 [FIR/IR generator] Make AbstractField generic over itself
This will make some code more type-safe.
2023-11-28 16:24:40 +00:00
Sergej Jaskiewicz c6eb7d6c21 [FIR/IR generator] Factor out walkableChildren and transformableChildren 2023-11-28 16:24:40 +00:00
Sergej Jaskiewicz 13ae129505 [FIR/IR generator] Move isSealed property to AbstractElement 2023-11-28 16:24:40 +00:00
Sergej Jaskiewicz 0465c6d0ee [FIR/IR generator] Make InterfaceAndAbstractClassConfigurator open 2023-11-28 16:24:40 +00:00
Nikolay Lunyak d5fa755e63 [FIR] Disable not null checks on dynamics
It looks like K1 doesn't do them.
And it's not particularly bad because
in the ideal world we'd have dynamics
with variable upper bound so that
in `dynamic?.let { it }` `it` would
be `Nothing..Any` (smartcasting to
`Any` is not correct because `dynamic`
can be passed into anything, but `Any`
can not).

^KT-63071
2023-11-28 15:37:09 +00:00
Nikolay Lunyak 875e2b0cd6 [FIR] Prohibit calling functions with dynamic receiver over non-dynamics
^KT-63071 Fixed
2023-11-28 15:37:09 +00:00
Nikolay Lunyak c69c34ff8b [FIR] Properly set isReceiver for implicit invoke on function types 2023-11-28 15:37:09 +00:00
Alexander.Likhachev 2bd77d5cdc [IGS] Add a non-interactive way to make a consent decision for IDEA builds
When running builds from IDEA, especially tests, the interactive consent request is barely noticeable. Also, some of the tools windows are non-interactive terminals. Thus, we detect the IDEA builds and fail fast to make it noticeable.
^KTI-1443 Fixed
2023-11-28 15:32:23 +00:00
Alexander.Likhachev ab5699f106 [IGS] Ask for consent only 5 times
^KTI-1443 In Progress
2023-11-28 15:32:23 +00:00
Alexander.Likhachev b0254add6d [Gradle] Add a check for the SNAPSHOT_SIZE metric 2023-11-28 15:22:43 +00:00
Alexander.Likhachev a7e3f7b3a6 [Gradle] Apply IDEA suggestions to BuildReportsIT.kt 2023-11-28 15:22:43 +00:00
Alexander.Likhachev 71320d2439 [IC] Add a check for the CACHE_DIRECTORY_SIZE metric
^KT-63010 Fixed
2023-11-28 15:22:43 +00:00
Alexander.Likhachev 06c1bcdc5d [IC] Add filter on files for the CACHE_DIRECTORY_SIZE metric
Without the filter, we were walking both through subdirectories and their files, so some files might be counted twice. Moreover, the behaviour of `File.length` is unspecified for directories.
^KT-63010 In Progress
2023-11-28 15:22:43 +00:00
Alexander.Likhachev 4eccbd75c3 [IC] Measure IC size metrics after the caches are closed
Before this fix, the size metrics were measured after the compilation is finished, but before the caches are closed. In many cases it might lead to incorrect measurements. After flipping the default value of the `keepIncrementalCompilationCachesInMemory` flag for Gradle builds, it started to cause always incorrect results.
^KT-63010 In Progress
2023-11-28 15:22:43 +00:00
Alexander.Likhachev 9f89e7f94f [Gradle] Flip the IC backup optimizations flags in the tests
^KT-62758 Fixed
2023-11-28 15:22:43 +00:00
Alexander.Likhachev 0f245ef3c6 [Gradle] Enable the IC backup optimizations by default
^KT-62758 In Progress
2023-11-28 15:22:43 +00:00
Alexander.Likhachev f0c643a887 [Gradle] Remove warning about experimental IC backup optimizations
This commit is part of the optimizations stabilization
^KT-62758 In Progress
2023-11-28 15:22:43 +00:00
Ilya Goncharov 093f51c89a [JS] Removing usage of legacy JS compiler #1 2023-11-28 13:44:37 +00:00
Leonid Startsev 662bff7351 Make $serializer generic constructor public
If a serializable class has generic type parameters, its serializer is not an object
and has a specialized constructor. This constructor was public in K1 and should
be public in K2 so it can be called from other serializable classes
(in case class is e.g., part of sealed hierarchy).

#KT-63402 Fixed
2023-11-28 13:31:08 +00:00
Leonid Startsev 51e3e9af94 Use a correct type for SERIALIZER_TYPE_INCOMPATIBLE diagnostic.
This diagnostic used an incorrect type for rendering (outer class type instead of a property type)
and didn't expand type argument of `KSerializer`.

Also add an additional test case for generic parameters.

#KT-63570 Fixed
2023-11-28 13:30:45 +00:00
Mikhail Glukhikh 1260d03561 Drop erroneous FirJavaConstructorBuilder.visibility
Related to KT-62961
2023-11-28 13:30:26 +00:00