Commit Graph

100897 Commits

Author SHA1 Message Date
Vsevolod Tolstopyatov f4e8ae5191 Explicitly declare stability levels of declarations in kotlinx.cinterop package
* @ExperimentalForeignApi for all declarations that operate on
    unmanaged memory (i.e. pointers and references)
* @BetaInteropApi for the rest of the interoperability declarations,
    namely Swift/CInterop-specific interfaces and convenience-functions

### Implementation details

* Some typealiases are not marked explicitly because it crashes the compiler,
    yet their experimentality is properly propagated
* License header is adjusted where it previously had been existing
* Deprecated with ERROR interop declarations that are deprecated for more than
    two years are removed
* WASM target interop declarations are deprecated
* Deliberately make Boolean.toByte and Byte.toBoolean foreign-experimental to scare
    people away

^KT-57728 fixed

Merge-request: KT-MR-9788
Merged-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com>
2023-05-04 13:52:21 +00:00
Simon Ogorodnik 82611ad124 FIR. BI: Fix stub type leakage in builder inference
Previously, updateTypeInBuilderInference was calling
updateTypeFromSmartcast to actually perform type update in
implicit receiver after stub types was inferred
Such action results in creation of following FIR:

FirSmartCastExpression(
    original=FQAE(FirImplicitThisReference, typeRef=R|Inv<Stub>|)
    typeRef=R|Inv<String>|
)

in receiver position during completion of calls

However, it wasn't the case in general situation due to
action of FirStubTypeTransformer, which, in turn visits and updates
type ref inside original expression, but only if there was at
least one call (that was completed) using that implicit receiver
As after such type update updateTypeFromSmartcast function does
nothing

Yet in situation, when there was only partially resolved calls
referencing that implicit receiver we actually create smart-cast
expression and don't update type

The change just removes usage of updateTypeFromSmartcast and
replaces is with direct type update
We still mutate state of implicit receiver, potentially
improperly, it should be addressed in future

^KT-54708
^KT-58365 Fixed
2023-05-04 12:46:28 +00:00
Mikhail Glukhikh af7d6b1bb3 K2: drop nullable results for generated synthetic callees 2023-05-04 11:48:37 +00:00
Mikhail Glukhikh 3964ee38be K2: fix handling of synthetic calls in delegate inference
This commit is intended to avoid the second resolve of delegate when
we need to consider provideDelegate() possibility in inference.
Also here we provide correct completion of synthetic calls during
delegate inference.

#KT-58013 Fixed
2023-05-04 11:48:37 +00:00
Ilya Chernikov 8c8ca7bb70 Remove examples/tests based on obsolete script-util
also mark the rest of the API as Obsolete
related to #KT-58367
2023-05-04 11:35:08 +00:00
Ilya Chernikov 2e393e8fb7 Stop publishing obsolete kotlin-script-util
#KT-58366 fixed
2023-05-04 11:35:08 +00:00
Yahor Berdnikau 17dded2f2a Update 'kotlin-dist-for-jps-meta' to use unbundled compiler plugins.
^KTIJ-25384
2023-05-04 10:52:12 +00:00
Bogdan Mukvich 0188e79df7 Run maven tests on JDK 8 by default 2023-05-04 10:51:52 +00:00
Bogdan Mukvich 1fcc843056 Create Nashorn in maven integration tests JS compatible with JDK 11 2023-05-04 10:51:52 +00:00
Bogdan Mukvich d95e3dbf17 Run maven plugin tests using kapt with dagger with JDK 8 2023-05-04 10:51:52 +00:00
Bogdan Mukvich 74cb25c3eb Create configuration for maven integration tests with JDK 8 2023-05-04 10:51:52 +00:00
Bogdan Mukvich c4f4249e83 Update maven invoker plugin 2023-05-04 10:51:52 +00:00
Dmitriy Dolovov 57ba28ae3d [K/N][tests] Drop obsolete test tags
The obsolete tags that are no more used and are dropped by this commit:
* 'stdlibK2'
* 'kotlin-testK2'
* 'codegenK2'
* 'k2libContents'
* 'firInfrastructure'
2023-05-04 10:35:08 +00:00
Dmitrii Gridin fce8172b0d [FIR] mark value parameter for "it" as resolved
^KT-56550
2023-05-04 10:03:45 +00:00
Dmitrii Gridin d29da18b60 [LL FIR] add more tests on specific members resolve
^KT-56550
2023-05-04 10:03:45 +00:00
Dmitrii Gridin 228b1852b1 [LL FIR] add isResolved check for delegated constructor call
^KT-56550
2023-05-04 10:03:45 +00:00
Pavel Punegov 3d65907b8c [K/N][test] Ignore test in Native K1
This test doesn't work with K1 in Native

Merge-request: KT-MR-9934
Merged-by: Pavel Punegov <Pavel.Punegov@jetbrains.com>
2023-05-04 08:50:42 +00:00
Pavel Punegov 68ffa46187 [K/N][test] Increase default test timeout to 30 seconds
Sometimes on slower hosts longer running test may time out.

Merge-request: KT-MR-9935
Merged-by: Pavel Punegov <Pavel.Punegov@jetbrains.com>
2023-05-04 08:50:14 +00:00
Ilya Gorbunov 568d4b11af Use 'run' function instead of 'synchronized' in KT-51036 test
It should be enough to reproduce the issue and makes the test runnable on all backends
2023-05-04 02:44:26 +00:00
Nikolay Krasko 92a7a74382 [213] Fix proguard rule for ExtensionsArea.registerExtensionPoint
Fix for 6e18b75c73

KTI-1114
2023-05-03 20:46:58 +00:00
Mikhail Glukhikh 2e69c643cb K2: add test for KT-57649 2023-05-03 17:02:18 +00:00
Roman Golyshev 0dbf218f0b [FIR LC] KT-58330 Introduce SymbolPsiClassObjectAccessExpression
A PSI expression created with `createExpressionFromText` has dummy
parent, which might break some inspections (for example, it breaks
`JamAttributeElement` class in Spring Framework Plugin in intellij)

Modify `AbstractSymbolLightClassesParentingTestBase` to check values of
annotations in light classes; implement `accept` in some of them

^KT-58330 Fixed

Merge-request: KT-MR-9903
Merged-by: Roman Golyshev <roman.golyshev@jetbrains.com>
2023-05-03 15:21:18 +00:00
Ilya Goncharov 957d8ee3d2 [Gradle, JS] Print visited-gradle content in composite build test 2023-05-03 15:03:27 +00:00
Simon Ogorodnik 3b979fb60e Tests. Add defineJDKEnvVariables to tests of FIR2IR
Some tests use environment variables JDK_8, JDK_11, and JDK_17.
To ensure that the tests work out of the box,
we should set these variables in the tests.
2023-05-03 14:07:51 +00:00
Ivan Kylchik 568b593da7 [IR] Switch forbidden list in ONLY_BUILTINS mode onto allowed one 2023-05-03 12:47:35 +00:00
Ivan Kylchik 7747643945 [IR] Filter chars and codePoints from allowed to interpret function
These two functions apparently are represented in Kotlin as methods
of `kotlin.String`. Because of that we accidentally treated them as
builtins.

To also minimize such cases, added filtration by return type. We are
allowing to interpret only these functions that have primitive or
unsigned return type.

#KT-57028 Fixed
2023-05-03 12:47:35 +00:00
Ivan Kylchik 81fe411ef6 [IR] Extract some common code in EvaluationMode into extension val 2023-05-03 12:47:34 +00:00
Anton Lakotka 462a39d591 [Gradle] Fix testCustomAttributesInAndroidTargets for AGP 7.0.4
^KT-58305 Verification Pending
2023-05-03 12:18:34 +00:00
Anton Lakotka 39fc1ba81d [Gradle] Fix testMppAndroidLibFlavorsPublication for AGP 7.0.4
^KT-58305 Verification Pending
2023-05-03 12:18:34 +00:00
Pavel Kunyavskiy af318fdfb0 [K/N] Fix default arguments in suspend functions
AddContinuationToFunctionsLowering was rewritten in way the order
of this lowering and defaults lowering doesn't matter.

^KT-58214
2023-05-03 12:14:53 +00:00
Pavel Kunyavskiy fa1b22cf31 [K/N] Make klib manifest saving platform-independent
^KT-57126
2023-05-03 12:12:58 +00:00
Dmitriy Dolovov 0de06757ca [K/N][tests] Rework tags for K/N tests
Use plain combinations of tags, examples:
* codegen/box w/o FIR: 'codegen & !frontend-fir'
* codegen/box with FIR: 'codegen & frontend-fir'

Avoid using tags with multiple aspects in their names, examples:
* 'codegenK1'
* 'firCodegen'

The obsolete tags to be removed but still used in TeamCity configurations:
* 'stdlibK2'
* 'kotlin-testK2'
* 'codegenK2'
* 'k2libContents'
* 'firInfrastructure'
2023-05-03 11:49:43 +00:00
Dmitriy Dolovov f2b6cbeee8 [K/N][tests] Merge tags: noPartialLinkage() + noPartialLinkageMayBeSkipped() 2023-05-03 11:49:43 +00:00
Dmitriy Dolovov cdf84a019d [K/N][tests] Rename tags: hostOnly() -> forceHostTarget() 2023-05-03 11:49:43 +00:00
Dmitriy Dolovov d998ccedc2 [K/N][tests] Rename tags: debugOnly() -> forceDebugMode() 2023-05-03 11:49:43 +00:00
Sergej Jaskiewicz 40a1443401 [GitHub] Highlight Kotlin-like IR dump as Kotlin on GitHub
github.com/github-linguist/linguist/blob/master/docs/overrides.md

See e.g. *.kt.txt files in compiler/testData/ir/irText
2023-05-03 10:46:21 +00:00
Alexander Korepanov 97024edf8a [JS IR] Replace canonicalPath with absolutePath
Since canonicalPath is slow, replace it with
absolutePath in SourceMaps and CompilationOutputs.

^KT-58187 Fixed
2023-05-03 10:39:40 +00:00
Nikolay Lunyak 1d9db1b9f8 [FIR] Use proper moduleData in fake override generator Ti
^KT-58145 Fixed
2023-05-03 10:04:25 +00:00
Nikolay Lunyak ef28e031dc [FIR] KT-58145: Ensure the compiler fails
It fails with: "Module data is not
registered in Libraries session"
during `FirFakeOverrideGenerator.createCopyForFirProperty()`
for `callerFrame`.
2023-05-03 10:04:25 +00:00
Nikolay Lunyak efbcfb4994 [FIR] Prevent duplicate FileAnalysisException-s 2023-05-03 10:04:25 +00:00
Alexander Udalov f3231b2aa9 KGP IT: do not run recently added tests with class loader cache
Also add a comment mentioning the error so that it could be searchable
in the future.
2023-05-03 09:47:58 +00:00
Dmitrii Krasnov 617dddba70 migrated FatFrameworkIT to junit 5 and gradle TestKit 2023-05-03 09:29:31 +00:00
Nataliya.Valtman 1591869991 Add FUS statistics for dokka usage
#KT-57330 Fixed
2023-05-03 07:22:38 +00:00
Alexander Udalov 180fc84eb7 Add ReadMe for compiler/android-tests 2023-05-02 21:27:12 +00:00
Hung Nguyen 37d6606852 IC: Load one class at a time when snapshotting classpath
Previously, when snapshotting the classpath with
`ClasspathEntrySnapshotTransform`, for each jar we load all classes
in memory at once. This was needed to detect inaccessible classes
(classes that don't impact incremental compilation and therefore
don't need to be snapshotted).

To reduce memory consumption, this commit updates the algorithm such
that we can now load one class at a time while still being able to
detect inaccessible classes.

In addition, we now read jar files with `java.util.zip.ZipFile` API
instead of `java.util.zip.ZipInputStream` to avoid current JDK bugs with
`ZipInputStream` (e.g., https://bugs.openjdk.org/browse/JDK-8298530).

^KT-57757 Fixed
^KT-57767 Fixed
2023-05-02 19:42:03 +00:00
Kirill Rakhman 8afc8950e6 [FIR] Report illegal in/out modifier on star projection
#KT-55668 Fixed
2023-05-02 15:16:07 +00:00
Kirill Rakhman 0c3d5c11b1 [FIR] Render integer literal types as Int in diagnostic messages
#KT-55662 Fixed
2023-05-02 15:10:55 +00:00
Kirill Rakhman cc87aabaec [Test infrastructure] Remove redundant suppress 2023-05-02 15:10:55 +00:00
Dmitrii Gridin fdcfb1d190 [AA FIR] add missing new line to addImportToFile
^KTIJ-25416
2023-05-02 14:37:28 +00:00
Dmitry Savvinov 8561bbf603 [Gradle] Minor: move diagnostic tests under unitTest package 2023-05-02 14:32:14 +00:00