Commit Graph

103704 Commits

Author SHA1 Message Date
Dmitriy Dolovov 7dbfe4bfb1 [IR][tests] Fix MPP IR dump tests to not fail on missing expect declarations
Expect declarations do not survive serialization to KLIB. So they need to be explicitly filtered in order for tests that compare dumped IR before and after serialization to pass successfully.

^KT-61136
2023-08-12 07:03:29 +00:00
Dmitriy Dolovov 6e648ac374 [IR] Drop IR expect/actual table
^KT-61136
2023-08-12 07:03:29 +00:00
Brian Norman e8b4550173 [FIR] Add checker for finite bounds validation
Added a new FIR based checker for both FINITE_BOUNDS_VIOLATION and
FINITE_BOUNDS_VIOLATION_IN_JAVA errors. Implementation copied from the
existing descriptor based checker with some minor changes.

#KT-59378 Fixed
2023-08-11 21:13:58 +00:00
Anton Bannykh 6a886e4c32 [JS] rename IC tests to easier distinguish between the K1/K2 variants 2023-08-11 15:46:51 +00:00
Anton Bannykh 962bfaca9c [JS] Support multimodule IC tests with K2
Includes supporting klib file generation.
2023-08-11 15:46:51 +00:00
Timofey Solonin d25d0e4f94 [MPP] Validate which configurations resolve for explicit stdlib-js dependency
^KT-60901
^KT-61126
2023-08-11 14:52:03 +00:00
Timofey Solonin 78e09816e5 [MPP] Use assemble instead of resolving all configurations
We expect that some configurations might fail to resolve in the case of
stdlib-js dependency if they are resolved explicitly. These configurations
should not actually resolve for the KGP user.

^KT-60901
^KT-61126
2023-08-11 14:52:03 +00:00
Sebastian Sellmair db1ee743ae [Gradle] Adjust functionalTests for stdlib-jdk7, stdlib-jdk8 constraint to 1.8.0
^KT-60901 Verification Pending
2023-08-11 14:52:03 +00:00
Sebastian Sellmair be867d0f25 [Gradle] Fix testMultiModulesHmppKt48370 missing cinterop opt-in
^KT-60901 Verification Pending
2023-08-11 14:52:03 +00:00
Sebastian Sellmair 65bc494a1a [Gradle] MppSharedNativeCompileIT: Disable K2 test because of 'KT-60943'
^KT-60901 Verification Pending
2023-08-11 14:52:03 +00:00
Sebastian Sellmair 73483b7a77 [Gradle] Update functionalTests to reflect kotlin-stdlib-common pointing to kotlin-stdlib
^KT-60901 Verification Pending
2023-08-11 14:52:03 +00:00
Sebastian Sellmair 59b29dc2b9 [Gradle] Update NativeIrLinkerIssuesIT to reflect changes in stdlib
^KT-60901 Verification Pending
2023-08-11 14:52:03 +00:00
Sebastian Sellmair 65e467dd5b [Gradle] Update NativeExternalDependenciesIT to reflect changes in stdlib
^KT-60901 Verification Pending
2023-08-11 14:52:03 +00:00
Sebastian Sellmair ada446b68f [Gradle] Update HierarchicalMppIT to reflect changes in stdlib
^KT-60901 Verification Pending
2023-08-11 14:52:03 +00:00
Sebastian Sellmair 00362390eb [Gradle] Ensure default stdlib is added to dependsOn source sets
^KT-60901 Verification Pending
2023-08-11 14:52:03 +00:00
Sebastian Sellmair 10f3704b35 [Gradle] Update MppCompositeBuildIT to reflect changes in stdlib
^KT-60901 Verification Pending
2023-08-11 14:52:02 +00:00
Sebastian Sellmair 12c3b981c4 [Gradle] Do not run 'IdeTransformedMetadataDependencyResolver' on 'single kotlin target' Source Sets
This will prevent transformed kotlin-stdlib source sets from
being resolved for leaf (e.g. jvmMain) as well as bamboo (jvmBambooMain)
source sets. For such source sets only the jvm jar shall be attached

^KT-60901 Verification Pending
2023-08-11 14:52:02 +00:00
Sebastian Sellmair 23ddabd5d7 [Gradle] Update WasmDependencyResolutionSmokeTest to reflect changes in stdlib
^KT-60901 Verification Pending
2023-08-11 14:52:02 +00:00
Sebastian Sellmair e9a1025c37 [Gradle][Minor] Update IdeJvmAndAndroidDependencyResolutionTest to newer version of mvikotlin
This is just a maintenance commit

^KT-60901 Verification Pending
2023-08-11 14:52:02 +00:00
Sebastian Sellmair bafb1aac80 [Gradle] Update IdeStdlibResolutionTest to reflect changes in stdlib
^KT-60901 Verification Pending
2023-08-11 14:52:02 +00:00
Sebastian Sellmair fa2b21e71b [Gradle] Update IdeOriginalMetadataDependencyResolverTest: Test with kotlin-test-common instead of stdlib
(because stdlib is now published with new metadata formats)

See: KT-56278
^KT-60901 Verification Pending
2023-08-11 14:52:02 +00:00
Sebastian Sellmair f06a1c89ef [stdlib-mpp] Publish patched/custom kpsm to list 'commonMain' included into 'nativeApiElements'
Native/Shared Source Sets still requires stdlib:commonMain.klib as
dependency for IDE analysis.

See: KT-56278
^KT-60901 Verification Pending
2023-08-11 14:52:02 +00:00
Sebastian Sellmair 243707c956 Revert "[stdlib-mpp] Disable/ignore failing tests in Kotlin Dev"
This reverts commit 171d156688.

KT-60901
2023-08-11 14:52:02 +00:00
Ivan Kylchik 2b5f839fac [IR] Minor: backend refactoring 2023-08-11 12:19:45 +00:00
Ivan Kylchik 55092da03b [PSI2IR] Check that a given function has the right descriptor
The issue was discovered during work on IR serialization and
this is just a safety check.

#KT-56230
2023-08-11 12:19:45 +00:00
Ivan Kylchik 5f2de9dbff [IR] Create primitive iterators in IrBuiltIns
This change is required to fix stdlib compilation with enabled
linking via signature. All primitive iterators are considered to be
builtins and are created during compile time as deserialized
declarations (at least in K1). But if we meet the definition of some
primitive iterator in code, for example, during stdlib compilation,
we will end up with two different descriptors (deserialized and lazy)
that describe the same entity. Because of that we have conflicts in
symbol table:
* For descriptors, we will end up with multiple IR declarations
that describe the same class, but with different descriptors. With
some magic compilation still works.
* For signatures, we will end up with only one IR declaration in the
table, but it will have wrong deserialized (instead of lazy)
descriptor.

In the end, this change allows us to initialize iterators in advance
with correct descriptor.

#KT-56230
2023-08-11 12:19:45 +00:00
Ivan Kylchik 782d5e86f6 [IR] Replace reference* with toIrSymbol in IrBuiltinsOverDescriptors
This change is a minor refactoring that introduces `toIrSymbol`
method for function and property descriptors, like it is done for
class descriptor.
2023-08-11 12:19:45 +00:00
Svyatoslav Scherbina 4da8b0850e Native: make CompareDistributionSignatures task fail on klib tool errors
CompareDistributionSignatures task is used to compare Native platform
libraries contents against a previous version.

Under the hood, it runs the klib tool to get a library contents. But it
didn't check the exit code, so if klib tool failed, the task could
mistakenly indicate that there are no differences in platform libs.

Fix this by checking the klib tool exit code and failing if it is not
zero.
2023-08-11 12:13:21 +00:00
Kirill Rakhman cee355196a [Tests] Fix accidental overload resolution ambiguity in test 2023-08-11 10:54:25 +00:00
Kirill Rakhman bb6d4acfb2 [Analysis API] Fix wrong override with context receiver 2023-08-11 10:54:24 +00:00
Kirill Rakhman 724d527fd8 [FIR] Fixes for call conflict resolution
Let ConeCompositeConflictResolver pass the results of the previous
resolver to the next one.
Otherwise, we get false positive conflicts when a set of candidates
can't be fully reduced by one resolver but could be resolved by the
subsequent application of multiple ones.
This change makes ConeCompositeConflictResolver order-dependent and
thus, ConeOverloadConflictResolver must be invoked last, because it
must work on a pre-filtered list.

Also, let ConeEquivalentCallConflictResolver use
FirStandardOverrideChecker instead of compareCallsByUsedArguments
because it's stricter.

This all fixes a false positive overload resolution ambiguity in common
metadata compilation that is caused by stdlib using the new KMP
format.
Now stdlib metadata is in the classpath, and so declarations from the
stdlib are returned from both MetadataSymbolProvider and
KlibBasedSymbolProvider.
This isn't a problem per se because duplicate candidates are filtered
out by ConeEquivalentCallConflictResolver (K1 works analogously), but
in the case of top-level functions with generic receivers like
Collection<T>.toTypedArray, the check failed because of the direct
comparison of receiver types.

#KT-60943 Fixed
2023-08-11 10:54:24 +00:00
Kirill Rakhman 86ef313233 [FIR] Check context receivers in FirStandardOverrideChecker
#KT-61145 Fixed
2023-08-11 10:54:24 +00:00
Artem Kobzar 4dc0d68288 [K/JS] Fix autoboxing for inlined function ^KT-60785 Fixed 2023-08-11 09:19:51 +00:00
Ilya Gorbunov 7ae443ad7f [stdlib-mpp] Use kotlin-stdlib-common artifact for dist from kotlin-stdlib project 2023-08-11 08:49:23 +00:00
Ilya Gorbunov 3e4cbd6dd2 Publish Gradle metadata for kotlin-stdlib-common, KT-60911
This makes it depend on kotlin-stdlib in all targets
and have no artifacts from Gradle's point of view
2023-08-11 08:49:23 +00:00
Dmitry Savvinov e8289181e6 [mpp] Minor: diagnostic messages clean-up
- Mention link to docs about templates in warning messages
^KT-60491 Fixed

- Make sure that each warning mentions some way to solve the problem
  aside from disabling default template

- Fix small syntactical bug in code sample

- fix incorrect indentation in trimMargin after joinToString

- Use kotl.in in Kotlin12XMppDeprecation
2023-08-11 08:26:14 +00:00
Dmitry Savvinov edbaed0da9 [Gradle] Minor: restore link to page about JVM toolchains in warning text
The link has been accidentally lost during migration of diagnostics to
the new infrastructure
2023-08-11 08:26:14 +00:00
Aleksei.Cherepanov da267ba2c8 Fix JPS import after removing dependency checksums...
...that are no longer resolved due to alignment (ca7e4941)
2023-08-11 07:05:33 +00:00
Anton Bannykh d78f7bde6a [JS] set LV=1.9 for K1-specific IC tests
Otherwise they will actully run K2 after
the LV=2.0 migration.

^KT-60829 fixed
2023-08-10 22:37:16 +00:00
Alexander Udalov 7f5bc94117 Jvm-abi-gen: do not treat KmProperty.hasConstant as part of ABI
... for non-const properties.

The meaning of this flag for non-const properties is in reality not
well-established, and it can vary from one release to another. In
particular, it's different in K2.

This commit has two parts:
1) The test (added in 5891617674) about clinit is changed. Original
   motivation was to check that presence or absence of `<clinit>` is not
   a part of the ABI. However, in addition to that, the test also
   involuntarily checked that the aforementioned "hasConstant" flag for
   the property y/Object.y is the same in both cases (which I believe
   was not the intention) because these tests check that Kotlin metadata
   is _exactly the same_ after applying jvm-abi-gen. So I've changed it
   to be more straightforward: one version declares an obvious constant,
   while another declares an obvious non-constant. After this change,
   the test started to fail (even on K1) because the value of the
   "hasConstant" flag was different between two versions.
2) Remove "hasConstant" flag for non-const properties when transforming
   metadata via jvm-abi-gen. This fixes the test and assures it won't
   fail when the project is migrated to LV 2.0.

 #KT-60849 Fixed
2023-08-10 20:24:17 +00:00
Ivan Kochurkin d4d30dcfcf [FIR] Introduce OPTIONAL_EXPECTATION_NOT_ON_EXPECTED diagnostic
^KT-60892 Fixed
2023-08-10 17:46:08 +00:00
Ivan Kochurkin 8e8de513ee [FIR] Introduce OPTIONAL_DECLARATION_USAGE_IN_NON_COMMON_SOURCE diagnostic
^KT-60892
2023-08-10 17:46:08 +00:00
Ivan Kochurkin 9ec7218af6 [FIR] Add isCommon property to FirModuleData
It will be used for correct OPTIONAL_DECLARATION_USAGE_IN_NON_COMMON_SOURCE reporting
2023-08-10 17:46:08 +00:00
Ivan Kochurkin b08df32cac [FIR] Introduce OPTIONAL_DECLARATION_OUTSIDE_OF_ANNOTATION_ENTRY diagnostic
^KT-60892
2023-08-10 17:46:08 +00:00
Ivan Kochurkin dc1f1fe979 Move optionalExpectationIncorrectUse from MPP integration to diagnostics tests 2023-08-10 17:46:08 +00:00
Roman Golyshev 93124ee98c KT-60957 [Analysis API] Properly handle source PSI for implicit invoke calls in KtFirReferenceShortener
For implicit invoke operator calls, there are two instances of
`FirResolvedNamedReference`. One of them references `invoke` function
and cannot be used to analyze the property access, and the second one
has `source == null`. Luckily, the parent of the second reference is
`FirPropertyAccessExpression`, which has the correct source

^KT-60957 Fixed
2023-08-10 16:51:31 +00:00
Roman Golyshev 7633e6e6f1 KT-60957 [Analysis API] Visit FirPropertyAccessExpressions instead of FirResolvedNamedReferences
It's much easier to analyze complex cases like invoke operator calls
using dedicated `FirPropertyAccessExpression`
2023-08-10 16:51:30 +00:00
Dmitrii Gridin b0b2e76e13 [LL FIR] dependent analyze: support different numbers of statements
Previously, the different number of statements has led to
some unexpected behavior. E.g., the resulting script can have
duplicated declarations – one from the original script instead of
some statement and one from the copy

^KT-60987
2023-08-10 16:18:26 +00:00
Dmitrii Gridin 4f4b30ee28 [LL FIR] dependent analyze: add test on different statements in script
It contains a wrong result. Will be fixed in the next commit

^KT-60987
2023-08-10 16:18:26 +00:00
Dmitrii Gridin 201100db60 [LL FIR] AbstractDependentCopyTest: supports custom text in copy
This provides an ability to test more real-world cases.
E.g., we can emulate completion behavior

^KT-60987
2023-08-10 16:18:26 +00:00