Commit Graph

109234 Commits

Author SHA1 Message Date
Marco Pennekamp ea2bb32bc0 [PSI] Don't calculate ClassIds for local classes in call elements
- The fix uses relevant logic from  `getNonLocalContainingDeclaration`.
- The annotation entry case is covered by `KtCallElement` because
  `KtAnnotationEntry` is a subtype of it.
- KT-66038 is fixed by this because the static declaration provider only
  indexes non-local classes.

^KT-66038 fixed
2024-02-26 16:36:00 +00:00
Marco Pennekamp d52860b835 [LL] Add tests for ClassId calculation of local class inside annotation argument
- The class IDs are erroneously calculated and will be fixed in the next
  commit.

^KT-66038
2024-02-26 16:36:00 +00:00
Dmitriy Dolovov 4b4c5c4e6b [FIR] Serialization to KLIB: Clean-up in firKlibSerialization.kt 2024-02-26 16:07:10 +00:00
Dmitriy Dolovov 5a8330ebad [FIR] Serialization to KLIB: Don't sort classes
^KT-62135
2024-02-26 16:07:10 +00:00
Dmitriy Dolovov 4b0ac63c38 [FIR] Serialization to KLIB: Drop obsolete TODO comments 2024-02-26 16:07:10 +00:00
Alexander Shabalin b1f59e5f0d [K/N] Make NativeDependenciesDownloader compatible with CC ^KTI-1553 2024-02-26 14:53:23 +00:00
Artem Olkov e4acb396ba Add SIR builder and printer for classes #KT-65905 fixed
Merge-request: KT-MR-14478
Merged-by: Artem Olkov <artem.olkov@jetbrains.com>
2024-02-26 14:30:07 +00:00
Vladimir Sukharev febac0dd5f [Tests] Migrate backend-independent tests from native to compiler/testData.
^KT-65979
2024-02-26 13:38:49 +00:00
Artem Olkov dd9332d9e1 Add kotlin runtime modulemap for swift export as part of kotlin-native dist #KT-65673 fixed
Co-authored-by: Alexander Shabalin <alexander.shabalin@ashabalin.me>

Merge-request: KT-MR-14493
Merged-by: Artem Olkov <artem.olkov@jetbrains.com>
2024-02-26 12:51:57 +00:00
Andrey Yastrebov 28a305a826 KT-65928 Worker API for Swift Export 2024-02-26 12:44:22 +00:00
Yan Zhulanow 1c1da6bced [Analysis API] Cause OOB when imports change in code fragments
In K1, code fragment analysis was completely invalidated on any PSI
change. Because imports are not a part of the PSI tree of
'KtCodeFragment's, a colon tremble happened on 'addImportsFromString()'.

In K2, changes inside code fragments are always considered in-body
modifications. So, even with the colon trembling, the 'FirFile',
together with its 'FirImport's was not recreated.

^KT-65600 Fixed
2024-02-26 11:28:56 +00:00
Yan Zhulanow 45c0fa8d23 [PSI] Refactor import handling in code fragments
Now there is a single place that performs import modification, as well
as reports events related to that modification.
2024-02-26 11:28:55 +00:00
Yan Zhulanow fa511fdc52 [Analysis API] Pass PCE exceptions from KtCompilerFacility 2024-02-26 10:56:24 +00:00
Abduqodiri Qurbonzoda 7978f63d37 Set AV to 2.0 in K/N StdlibTest 2024-02-26 10:48:29 +00:00
Abduqodiri Qurbonzoda 31aa71dd6a Promote Common String.toCharArray(destination) to stable #KT-65532 2024-02-26 10:48:29 +00:00
Pavel Kirpichenkov 2bd48b7e49 [Tests] Regenerate AdditionalStubInfoKnmTestGenerated
KTIJ-28668
2024-02-26 10:18:38 +00:00
Pavel Kirpichenkov 00faa6fa01 [Tests] Support language features from test data in .knm meta compiler
Mute test failure revealed by unblocked context receivers (KTIJ-28885)

KTIJ-28668
2024-02-26 10:18:38 +00:00
Pavel Kirpichenkov d17044515f [Tests] Update stub consistency test data
Common metadata compiler now reports compilation errors. Disable tests
that are not yet supported or should be skipped as JVM-specific.

KTIJ-28668
2024-02-26 10:18:38 +00:00
Pavel Kirpichenkov ae664d37ae [Tests] Support KLIB metadata for stdlib in test compile utility
Create dependency provider able to resolve code from .knm metadata
files to simplify migration from the legacy kotlin-stdlib-common
artifact.

KTIJ-28668
KTI-1457
2024-02-26 10:18:38 +00:00
Pavel Kirpichenkov bfb1ef14f5 [Stubs] Fix contract deserialization for non-JVM stubs
Types serialized via type table weren't deserialized, which led to
missing contract information in stubs.

KTIJ-28668
2024-02-26 10:18:38 +00:00
Pavel Kirpichenkov 9373437cad [Tests] Add kotlin-stdlib dependency in KLIB metadata compile utility
It's necessary, for instance, to compile custom contracts in common

KTIJ-28668
KTIJ-26788
2024-02-26 10:18:38 +00:00
Pavel Kirpichenkov 3e5065fbba [Tests] Report compilation errors from test KLIB compiler
KTIJ-28668
2024-02-26 10:18:38 +00:00
Pavel Kirpichenkov 5548e854a0 [Tests] Extract shared .knm test utilities
KTIJ-28668
2024-02-26 10:18:38 +00:00
Pavel Kirpichenkov 1c1bdae973 [Tests] Add tests for additional stub info in .knm files
KTIJ-28668
2024-02-26 10:18:38 +00:00
Pavel Kirpichenkov 604dec7a87 [Tests] Move stub info extraction for test into a separate utility
KTIJ-28668
2024-02-26 10:18:38 +00:00
Pavel Kirpichenkov f6a35ef0e5 [Tests] Extract AbstractDecompiledKnmFileTest from the stub test
KTIJ-28668
2024-02-26 10:18:38 +00:00
Svyatoslav Scherbina 23e558d172 Bump Kotlin/Native version in KGP to 2.0.0-dev-16829 2024-02-26 10:16:19 +00:00
Nikolay Lunyak 3b2bc598b5 [FIR] Reuse getNonSubsumedNonPhantomOverriddenSymbols
Just a small refactoring to avoid
duplicating comments.
2024-02-26 10:06:26 +00:00
Nikolay Lunyak 22fc90e5a1 [FIR] Treat properties from ObjC-classes as abstract
In short, the problem is some
platform libraries contain invalid
Kotlin code. Specifically,
some classes may inherit multiple
members with default
implementations, but do not define
an explicit override, like `UIView.bounds`.

Since we can't refactor platrofm
libraries just now, we want to
treat such properties as abstract.

^KT-65866 Fixed
^KT-65855
2024-02-26 10:06:26 +00:00
Andrey Yastrebov 2ae8d28b33 KT-65582 Swift export XCTest integration tests 2024-02-26 09:57:12 +00:00
Andrey Yastrebov 6146a59636 KT-65582 Swift export build integration tests 2024-02-26 09:57:12 +00:00
Andrey Yastrebov 444dc790db KT-65582 Extract xcode simulator test helpers 2024-02-26 09:57:12 +00:00
Andrey Yastrebov 6ed6e7ce28 KT-65582 Add Swift export test tags 2024-02-26 09:57:12 +00:00
Nikolay Lunyak f1c7f929d2 [FIR] Don't miss diagnostics on resovled reified type parameters
^KT-66005 Fixed
2024-02-26 09:53:13 +00:00
Nikolay Lunyak b0e6db7807 [FIR] Reproduce KT-66005
^KT-66005
2024-02-26 09:53:13 +00:00
Dmitriy Novozhilov eb85caedad [FIR] Search for typealias in dependencies, if expect class was found first
^KT-65840 Fixed
2024-02-26 09:25:57 +00:00
Kirill Rakhman c3c2f6f90a [FIR] Don't set lambda parameter type to Nothing by default
... when the expected type is not a function type.
Instead set it to a new type variable.
This fixes a bunch of false negative CANNOT_INFER_PARAMETER_TYPE.

#KT-59882 Fixed
2024-02-26 08:59:22 +00:00
Dmitriy Novozhilov 9857bdc891 [FIR2IR] Unwrap typealiases during applying of suspend conversion
^KT-65002 Fixed
2024-02-26 08:56:24 +00:00
eugene.levenetc 83ddf904aa [ObjCExport] Fix data class predefined methods translation
KT-65800
2024-02-25 21:31:30 +00:00
Anton Lakotka 3e5afcaaba [Gradle] Setup Consistent metadata dependencies resolution
Configure consistent metadata resolution only for source sets that
participate in metadata compilation. i.e. test or any other extra
compilations should be excluded.

^KT-65954 Verification Pending
^KT-66047 Verification Pending
2024-02-25 20:59:03 +00:00
Anton Lakotka c027ba642f [Gradle] Introduce SourceSetDependenciesResolution dsl for tests
It allows to mock published via gradle libraries to verify
dependency resolution correctness.
2024-02-25 20:59:03 +00:00
Anton Lakotka 46abf63796 [Gradle] Compare resolved components ignoring versions for source sets
Source Set Visibility algorithm relies on the match between metadata
dependencies resolution and platform dependencies resolution. However
there is a chance that they don't match in versions.
i.e. commonMain resolved into 1.0 but jvmMain got 2.0 of the same
library. However this discrepancy is not correct after all. And
both metadata compilations and platform compilations should see the same
set of libraries. This behavior will be fixed in KT-66047

^KT-65954 Verification Pending
2024-02-25 20:59:03 +00:00
Anton Lakotka 32be35051d [Gradle] Test that metadata compilation for bug KT-65954 doesn't fail
Metadata compilation should not fail when test source set has
dependency with higher version

^KT-65954 Verification Pending
2024-02-25 20:59:03 +00:00
Nikita Bobko c31a72a4af [FIR] Switch FirExpectActualDeclarationChecker to Platform checker
^KT-66028 Fixed
2024-02-25 18:18:55 +00:00
Nikita Bobko 4c602585b0 [FIR, IR] Cleanup: drop unused allowClassActualizationWithWiderVisibility & allowTransitiveSupertypesActualization
These flags were used when ExpectActualMatchingContext was reused in K1.
2024-02-25 18:18:55 +00:00
Jaebaek Seo 171ea3571c K2: Use deserialized type annotation for lambda type resolution.
This commit adds code to check whether a deserialized cone type is a
special function type kind or not when resolving the type of a lambda
expression (anonymous function). If it is a special function kind, it
sets the type of lambda based on the special function kind.

^KT-64994 Fixed
2024-02-25 10:10:43 +00:00
Jaebaek Seo 10a422180a K2: Propagate annotation of function type kind in compose plugin
We want to test whether the propagation of function type kind annotation
correctly works or not. This commit updates
ComposableFunctionsTransformer that mimics the real compose compiler
plugin to propagate the composable annotation i.e., @MyComposable from
MyComposableFunction kind. Finally, the generated IR function for lambda
expression must have the composable annotation, when the lambda
expression does not have the explicit composable annotation, but we
infer the composable annotation based on the annotation of function type
for the value parameter.

^KT-64994
2024-02-25 10:10:43 +00:00
Jaebaek Seo 512efb9649 K2: Support binary library dependencies between test modules
The test infrastructure for analysis supports binary module tests, but
the binary build does not use another binary module as a dependency when
it passes the class path. As a result, each binary module build does not
work when they have dependency on each other.

This commit fixes the issue by
1. Topological sort in the order of dependency graph for test modules.
2. Pass module paths as extra class paths when they have dependency on
   each other.

^KT-64994
2024-02-25 10:10:43 +00:00
Nikita Nazarov 407448d8e3 [JVM] Implement new inlined variable naming format
^KT-65478 fixed
2024-02-23 23:59:13 +01:00
Ilya Chernikov 9ea775cbed K2 scripting: fix containing decl for last script expression
Generally the wrapping anonymous initializer can be used as a
"containing declaration" for some elements, but since the initialiser
for the last script expression could be dropped (the expression could
be converted to the result property), this may lead to the surprises,
e.g. as described in KT-65984
This fix marks the last initialiser as local, preventing it from being
referenced as "containing declaration".

#KT-65984
2024-02-23 22:03:44 +00:00