Commit Graph

108415 Commits

Author SHA1 Message Date
Abduqodiri Qurbonzoda 240a423bed Introduce Common protected function AbstractMutableList.removeRange #KT-57151 2024-01-30 22:37:25 +00:00
Sergej Jaskiewicz f84fa29fef [klib] Add a test ensuring that signature clash detection works w/ MPP 2024-01-30 20:47:09 +00:00
Sergej Jaskiewicz 03aa14b473 [klib] Use "IR signatures" i/o "KLIB signatures" in diagnostics
We already use the term "IR signatures" in other places.
2024-01-30 20:47:09 +00:00
Sergej Jaskiewicz 6900e20096 [klib] Fix exception for clashing signatures from different modules
If we encounter a declaration in the current module whose signature
is the same as that of a declaration in another module which we happen
to also reference from the current module, don't report any errors,
just like we don't do it in Kotlin/JVM. This leaves the user in the KLIB
hell situation, but this is intentional, because otherwise a legitimate
change like moving a declaration to another module and marking
the original one as `@Deprecated("", level = DeprecationLevel.HIDDEN)`
would lead to a error, and we don't want that.

Also, don't try to show the diagnostics on a declaration that doesn't
have an IrFile.

^KT-65063 Fixed
2024-01-30 20:47:09 +00:00
Sergej Jaskiewicz a5c8ecae0b [test] Support dumping rendered diagnostics from multiple modules 2024-01-30 20:47:09 +00:00
vladislav.grechko d27adf6677 [FIR] Forbid multiple labels per statement
^KT-53629: Fixed
2024-01-30 19:58:53 +00:00
vladislav.grechko cd5b38b958 [FIR] Unwrap error expressions when detecting USAGE_IS_NOT_INLINABLE
Otherwise, false positive USAGE_IS_NOT_INLINABLE may be detected

^KT-65316: Fixed
2024-01-30 19:58:53 +00:00
Mikhail Glukhikh ed246d372b K2: introduce platform-dependent filtering for non-JVM platforms
This commit fixes a false negative in testData/cli/metadata/getOrDefault
Related to KT-57268
2024-01-30 19:44:00 +00:00
Mikhail Glukhikh 7599ff0ef1 K2: add a reproducer for getOrDefault false negative in metadata compilation
This case is similar to KT-57268 in early JDKs
2024-01-30 19:44:00 +00:00
Mikhail Glukhikh 38aec7333b Drop mentioning of KT-63955 in some ABI difference comments
In fact, the commit c3926219 should do it before because the relevant
difference was removed in this commit
2024-01-30 19:44:00 +00:00
Mikhail Glukhikh 672b5ba0d7 K2/Java: implement platform-dependent function filtering in JvmMappedScope
We drop Kotlin function 'remove' or 'getOrDefault' from JvmMappedScope,
if it has platform-dependent annotation, and the bound Java class scope
does not contain a function with the same signature.

#KT-57268 Fixed
2024-01-30 19:44:00 +00:00
Alexander Udalov 7d584e0eb4 K2/Java: add initial version of FirJvmPlatformDeclarationFilter
#KT-57268 In Progress
2024-01-30 19:44:00 +00:00
Brian Norman 76b9ba05fd [FIR] Lambda reassigned arguments should not have contracts applied
When applying function contracts to arguments, make sure the argument
variable hasn't been reassigned within a lambda. Contracts can only be
applied to unchanged variables, otherwise outdated type statements could
be added to the variable.

^KT-63151 Fixed
2024-01-30 17:23:56 +00:00
Brian Norman a2c9e5b36a [FIR] Copy implications from previous data flows when there is only one
Postponed lambdas introduce a host of challenges in data-flow analysis.
While inheriting type statements was disabled while these challenges are
being considered, we must still copy type statements from non-postponed
lambda edges. It seems the same is true for implications.

Implications are copied from previous flows when there is only a single
previous flow. That is because it never seemed to be required based on
test results. However, a recent test case revealed that copying is
required when there are multiple previous flows, but only one flow is
from a non-postponed-lambda node.

Combining implications from multiple non-postponed-lambda nodes did not
have an impact on test results, so until such a test case can be
created, the overhead of calculating common implications from multiple
flows will be avoided.

^KT-63351 Fixed
2024-01-30 17:22:31 +00:00
Dmitriy Dolovov 478205e6e8 [build] Don't use dependencies on Native backend in KLIB tool
^KT-62340
2024-01-30 16:12:56 +00:00
Dmitriy Dolovov c1a4c33301 [build] Migrate kotlin-native/klib/build.gradle to KTS
^KT-62340
2024-01-30 16:12:56 +00:00
Dmitriy Dolovov ca0c2f1405 [KLIB tool] Introduce a new CLI command: "dump-abi"
With this command it is possble to make an ABI snapshot of any IR-ful library

^KT-62340
2024-01-30 16:12:56 +00:00
Dmitriy Dolovov 9d6266d6ad [KLIB tool] Use more correct wording in HELP output
"dump ... of all public declarations"
->
"dump ... of all non-private declarations"

^KT-62340
2024-01-30 16:12:56 +00:00
Dmitriy Dolovov ab09a3d0fe [KLIB tool] Dump metadata for all non-private declarations
This is done to make the output of "dump-metadata" command consistent
with the output of "dump-metadata-signatures" and "dump-ir-signatures",
which dump signatures for all non-private declarations.

^KT-62340
2024-01-30 16:12:56 +00:00
Dmitriy Dolovov 1f3da86021 [KLIB tool] Don't print stack trace on CLI args parsing errors
^KT-62340
2024-01-30 16:12:56 +00:00
Igor Chevdar f220074d8a [K/N][IR] Fixed a problem with top-level fields
#KT-65324 Fixed
2024-01-30 14:49:34 +00:00
Nataliya.Valtman 6000596673 Report FUS metrics only from FusMetrics.kt
#KT-65213 Fixed
2024-01-30 14:26:43 +00:00
vladislav.grechko 3da1efc94a Set correct IR origin for getting array element operators
^KT-60246: Fixed
2024-01-30 14:26:10 +00:00
vladislav.grechko 9aa8fb80e7 Set correct IR origins for inc/dec operations
NB: in order to produce correct IR origins, the source element kinds for
some FIR elements has been changed. As a side effect, mapping PSI to FIR
slightly changed: namely, for `a[b]++`, `a[b]` used to be mapped on
`set` call or callable reference, but now it is mapped on `get` call.

^KT-61891: Fixed
^KT-64387: Fixed
2024-01-30 14:26:10 +00:00
vladislav.grechko 8b1d87848d [FIR2IR] Fix unwrapping of single-statement blocks
Unwrapping should be done with respect to `forceUnitType` parameter.

^KT-65019: Fixed
2024-01-30 14:26:10 +00:00
Artem Kobzar 5b7478c0a6 [K/JS] Automatiacally add runtime dependency for JS Plain Objects plugin inside its Gradle plugin 2024-01-30 13:54:51 +00:00
strangepleasures effcdd5e71 KT-65330 Fix the DuckDuckGo benchmark 2024-01-30 13:23:21 +00:00
Yahor Berdnikau 09f2f36545 [Gradle] Fix warnings in KotlinJsIrTarget
^KT-56904 In Progress
2024-01-30 11:49:07 +00:00
Yahor Berdnikau c43a0228b9 [Gradle] Fix warnings in KotlinJsIrSubTarget
^KT-56904 In Progress
2024-01-30 11:49:07 +00:00
Yahor Berdnikau cc29ee9f7a [Gradle] Removed unused method in KotlinJsIrLink
^KT-56904 In Progress
2024-01-30 11:49:07 +00:00
Yahor Berdnikau ed82ca5c09 [Gradle] Fix warnings in KotlinJsBinaryContainer
^KT-56904 In Progress
2024-01-30 11:49:07 +00:00
Yahor Berdnikau d0b0774c6d [Gradle] Fix warnings in KotlinBrowserJsIr
^KT-56904 In Progress
2024-01-30 11:49:07 +00:00
Yahor Berdnikau f4d9d98a5e [Gradle] Fix warnings in D8Exec
^KT-56904 In Progress
2024-01-30 11:49:07 +00:00
Yahor Berdnikau 5cf1572995 [Gradle] Fix warnings in KotlinJsCompilation
^KT-56904 In Progress
2024-01-30 11:49:07 +00:00
Yahor Berdnikau 0f29ae48ee [Gradle] Fix warnings in InternalKotlinTargetPreset
^KT-56904 In Progress
2024-01-30 11:49:07 +00:00
Marco Pennekamp 9a4bf0601e [AA] Add KtClass-based KotlinSealedInheritorsProvider
- The compiler's `SealedClassInheritorsProvider` should not be exposed
  outside LL FIR, as it is an internal compiler component and also
  exposes `FirRegularClass`. `KotlinSealedInheritorsProvider` is an
  Analysis API provider for sealed inheritors that accepts a `KtClass`
  instead.

^KT-64718 fixed
2024-01-30 11:48:09 +00:00
Yan Zhulanow e001fa4e72 [Analysis API] Explicitly specify the context module in a directive 2024-01-30 11:41:26 +00:00
Yan Zhulanow 892212bdf6 [Analysis API] Add type code fragment test for a local class 2024-01-30 11:41:26 +00:00
Yan Zhulanow 3cd04a9e9e [Analysis API] Migrate existing code fragment tests to the new API 2024-01-30 11:41:26 +00:00
Yan Zhulanow ef890e9b76 [Analysis API] Add reference resolution tests for code fragments 2024-01-30 11:41:26 +00:00
Yan Zhulanow c548bed6f6 [Analysis API] Fix 'getContainingDeclaration()' for code fragments
^KT-65075 Fixed
2024-01-30 11:41:26 +00:00
Yan Zhulanow 1c883c93fc [Analysis API] Minor, prettify 'getContainingPsiDeclaration()' 2024-01-30 11:41:26 +00:00
Yan Zhulanow 83ad6eca08 [Analysis API] Minor, prettify 'hasParentSymbol()' 2024-01-30 11:41:26 +00:00
Yan Zhulanow 01ca31a061 [Analysis API] Add test infrastructure for code fragments
Now, Analysis API tests can define modules with code fragments.
The preceding module will be used as a context module.
2024-01-30 11:41:26 +00:00
Yan Zhulanow 7298289e4e [FIR] Support type code fragments in 'PsiRawFirBuilder'
For type code fragments, which essentially contain a single type
reference, we add a single statement 'null is Type'.

^KT-61332 Fixed
2024-01-30 11:41:26 +00:00
Ilya Goncharov 0350533189 [Gradle, JS] Do not use project on execution phase 2024-01-30 10:38:09 +00:00
Jinseong Jeon 42e8245007 AA: take into account type arguments if available
...when computing receiver type for double colon expression
2024-01-30 06:57:27 +00:00
Jinseong Jeon 2429d09edd AA: use explicit qualifier type if available
...when computing receiver type for double colon expression

^KT-65150 fixed
2024-01-30 06:57:27 +00:00
Sergej Jaskiewicz 2277c1ba97 [FIR] Fix metadata dump in a compiler plugin-related test
The previous commit also fixed the inconsistency between the test and
production compiler configuration, which led to the metadata dump in
this test to be correct.

See the commit message of 49071374b4
for details.
2024-01-29 21:07:43 +00:00
Sergej Jaskiewicz f39335b3f7 [klib] Don't pass around metadata serialization closure
Pass the metadata serializer instance instead. This allows to further
reduce code duplication by introducing the common interface
`KlibSingleFileMetadataSerializer` for abstracting away K1 and K2
representation of a source file, as well as reusing
`Fir2KlibMetadataSerializer` across different backends.

KT-64392
2024-01-29 21:07:43 +00:00