Commit Graph

103138 Commits

Author SHA1 Message Date
Ivan Kochurkin 2eba7da5eb [FIR] Rename FirArrayOfCall to FirArrayLiteral 2023-07-27 17:53:44 +00:00
Ivan Kochurkin f4e4c5e724 [FIR] Fix missing type mismatch with array literals
Clarify existing type mismatch errors on array literals

^KT-60474 Fixed

Remove ResolutionMode.TransformingArrayLiterals
2023-07-27 17:53:44 +00:00
Roman Golyshev e1ebbc10d9 KTIJ-24877 [Analysis API] Ignore type qualifiers with fake sources when optimizing imports
When optimizing imports, it does not make any sense to account for
type qualifiers which are not directly present in the code

ATM such implicit type references are present for every
callable declaration call

^KTIJ-24877 Fixed
2023-07-27 17:28:47 +00:00
Timofey Solonin 167ddc556d [MPP] Don't publish PM20
^KT-60198
2023-07-27 15:54:06 +00:00
Stanislav Ruban 9ecf02fddf fixup! Add a 2nd user-defined class to InsideNestedBuilderInferenceLambda.kt 2023-07-27 14:25:08 +00:00
Stanislav Ruban 816906c7b7 fixup! Remove integer literals from InsideNestedBuilderInferenceLambda.kt 2023-07-27 14:25:08 +00:00
Stanislav Ruban 8bd823de0d [tests] BI (1P&1TV/1TIO): add tests for contexts of source-sink feeds
single builder parameter
single postponed type variable
single origin of type information

relevant issues:
KT-60274
KT-60663
2023-07-27 14:25:08 +00:00
Stanislav Ruban b13a225949 [tests] BI (1P&1TV/1TIO): add tests for basic cases
single builder parameter
single postponed type variable
single origin of type information

relevant issues:
KT-59551
2023-07-27 14:25:07 +00:00
Aleksei.Glushko 1eda35a59c [K/N] Process objc run loop on the finalizer thread ^KT-58851
Merge-request: KT-MR-11024
Merged-by: Alexey Glushko <aleksei.glushko@jetbrains.com>
2023-07-27 14:17:48 +00:00
Aleksei.Cherepanov 6ac76aa3e9 Fix passing K2 language version to K1 multimodule tests
After splitting K1 and K2 tests some multimodule tests in K1 configuration were still running with 2.0 language version. The reason was in misconfiguration of complex multimodule projects - they don't apply override of compiler arguments. This fix added such arguments update.

#KT-60589 Fixed
2023-07-27 14:15:49 +00:00
Aleksei.Cherepanov f6963d04e9 Run K1 configuration on TC with languageVersion="1.9"
KotlinVersion is overrided on TC, so we need to rely on LanguageVersion

#KT-60589 Fixed
2023-07-27 14:15:49 +00:00
Yahor Berdnikau 6089d3efc5 [Gradle] Update Gradle test versions
^KT-56178 Fixed
2023-07-27 13:29:57 +00:00
Yahor Berdnikau 7c563d8484 [Gradle] Update AGP 8.2 version in tests
ExternalAndroidTargetIT: Update to AGP 8.2.0-alpha13

^KT-56178 In Progress
2023-07-27 13:29:57 +00:00
Yahor Berdnikau 2dacb6e816 [Gradle] Run Gradle integrations tests against Gradle 8.1.1
^KT-56178 In Progress
2023-07-27 13:29:57 +00:00
Brian Norman 0e2b3ce845 [FIR] Create alternate DFA flows through finally blocks
Entering a `finally` block can happen from many different places:
through an exception, a jump, or normal exit from the `try` block. When
in the `finally` block, all DFA flows must be merged to have correct
smart casting. However, after the `finally` block, if exiting normally
or because of a jump, the combined flow from within the `finally` block
should not be used, but rather an alternate flow which combines the
correct flows from before the `finally` block.

```
try {
    str as String // Potential cast exception
} finally {
    str.length // Shouldn`t be resolved
}
str.length // Should be resolved
```

When building DFA flows, track the start of possible alternate flows,
and continue building them until they end. Both of these situations are
now marked on CFGNodes via interfaces.

When building the default DFA flow, and the source node is the end node
of alternate flows, attempt to use the alternate flow with the same edge
label instead of the default flow of the source node.

#KT-56888 Fixed
2023-07-27 13:05:58 +00:00
Brian Norman f3847de1b9 [FIR] Create FlowPath interface and add alternate flows to CFGNodes
Preliminary refactor in preparation for the implementation details to
fix KT-56888. This change makes it so alternate data flows can be
created and maintained through CFGNodes. This change was separated and
created first to aid in the code review process.
2023-07-27 13:05:58 +00:00
Brian Norman 1acdb3c143 [FIR] finally CFG exit node jump edges should match enter node edges
Jump edge targets are maintained globally within the CFG builder and are
added indiscriminately to `finally` exit nodes. This means that a
`finally` exit node could have a jump edge added which doesn't match how
the `finally` block was entered. Make sure edges are only added to the
exit node if they also exist on the enter node.

#KT-60723 Fixed
2023-07-27 13:05:58 +00:00
Dmitrii Gridin 5ab4229ee5 [LL FIR] AbstractWholeFileResolvePhaseTest change extension to .lazy.resolve.txt
^KT-60728
2023-07-27 12:02:05 +00:00
Dmitrii Gridin e328aeee72 [LL FIR] add script tests for AbstractWholeFileResolvePhaseTest
^KT-60728
2023-07-27 12:02:05 +00:00
Dmitrii Gridin 167c247456 [LL FIR] rename AbstractInnerDeclarationsResolvePhaseTest to AbstractWholeFileResolvePhaseTest
^KT-60728
2023-07-27 12:02:05 +00:00
Dmitrii Gridin b1b123efc0 [LL FIR] merge innerDeclarationsResolve testData to fileStructure
^KT-60728
2023-07-27 12:02:05 +00:00
Dmitrii Gridin bba1eeac82 [LL FIR] AbstractInnerDeclarationsResolvePhaseTest use .txt instead of .fir.txt
^KT-60728
2023-07-27 12:02:05 +00:00
Dmitrii Gridin 8a906004e3 [LL FIR] do not resolve declarations from script separately
It leads to exceptions because of race.
We shouldn't try to resolve a script and its content simultaneously,
because it is not thread-safe

^KT-60728
2023-07-27 12:02:05 +00:00
Dmitrii Gridin 6fa254c353 [LL FIR] merge diagnosticTraversalCounter testData to fileStructure
^KT-60728
2023-07-27 12:02:04 +00:00
Dmitrii Gridin 9970663a2b [LL FIR] add script tests for AbstractFirContextCollectionTest
^KT-60728
2023-07-27 12:02:04 +00:00
Dmitrii Gridin 3ed5ccbb6f [LL FIR] add script tests for AbstractFileStructureTest
^KT-60728
2023-07-27 12:02:04 +00:00
Dmitrii Gridin c79bdd8ce3 [LL FIR] drop granular resolve from scripts
Effectively, KtScript currently resolves as a monolith,
so we have problems because some declarations have
their own locks, but some others are not
This change fixed many exceptions

^KT-60728
2023-07-27 12:02:04 +00:00
Dmitrii Gridin e248d1a588 [LL FIR] add script tests for AbstractFileBasedKotlinDeclarationProviderTest
^KT-60728
2023-07-27 12:02:04 +00:00
Dmitrii Gridin aa36e2ef5b [LL FIR] add script tests for AbstractNonLocalDeclarationAnchorTest
^KT-60728
2023-07-27 12:02:04 +00:00
Dmitrii Gridin 60dc0ace47 [LL FIR] add script tests for AbstractClassIdTest
^KT-60728
2023-07-27 12:02:04 +00:00
Dmitrii Gridin c01c113af4 [AA] implement infrastructure for scripts
^KT-60728
2023-07-27 12:02:04 +00:00
Dmitrii Gridin e5cd674f33 [AA] split KtSourceModuleImpl on separate files
^KT-60728
2023-07-27 12:02:04 +00:00
Mikhail Glukhikh cdd3f10e99 K2: make synthesized functions synthesized in protobuf
Related to KT-59171
2023-07-27 11:24:09 +00:00
Nataliya.Valtman ed2dd4b2ae Split Gradle and JPS metrics
#KT-58026 In progress
2023-07-27 11:18:54 +00:00
Abduqodiri Qurbonzoda 524df83265 Deprecate kotlin.jvm.internal.collectionToArray 2023-07-27 11:16:58 +00:00
Abduqodiri Qurbonzoda 7fc90c02f1 Rename copyToArrayImpl to collectionToArray 2023-07-27 11:16:58 +00:00
Abduqodiri Qurbonzoda 7010bf2c20 Move copyToArrayImpl implementation to Common source set 2023-07-27 11:16:58 +00:00
Abduqodiri Qurbonzoda 6fdfd4e8dd Null-terminate Collection.toArray destination only in JVM
In other platforms the elements following the collection elements
should not be changed.

As a part of efforts to stabilize Native stdlib.
2023-07-27 11:16:58 +00:00
Abduqodiri Qurbonzoda 60455daa9d Update AbstractCollection.toArray documentation 2023-07-27 11:16:58 +00:00
Abduqodiri Qurbonzoda 672a40c7cb [K/N] Remove redundant collectionToArray functions 2023-07-27 11:16:58 +00:00
Nikolay Lunyak 713c2136cc [FIR] Prohibit class literals with empty left-hand side
^KT-59165 Fixed
2023-07-27 10:28:52 +00:00
Yan Zhulanow d748fe7696 [Analysis API] Wrap compilation exceptions in KtCodeCompilationException 2023-07-27 10:23:42 +00:00
Yan Zhulanow f92089cb82 [Analysis API] Move 'allowedErrorFilter' to the 'compile()' parameters 2023-07-27 10:23:42 +00:00
Yan Zhulanow c44925dbed [Analysis API] Add test for inlined local class collection 2023-07-27 10:23:42 +00:00
Yan Zhulanow 7821ef0414 [Analysis API] Make 'KtCompiledFileForOutputFile' an internal API 2023-07-27 10:23:42 +00:00
Yan Zhulanow fcb2b0475e [Analysis API] Improve documentation for 'KtCompilationResult' 2023-07-27 10:23:42 +00:00
Yan Zhulanow 0f6f22d76b [Analysis API] Add API for code compilation
The API replaces 'KotlinCompilerIde' in the IntelliJ IDEA plugin.
Code moved to Analysis API as its K2 implementation severely depends on
the internal compiler API (FIR).

The API is going to be used in the JVM debugger evaluator, and in
the Bytecode Tool Window.

In this commit, only ordinary Kotlin are supported.
In later commits, there will be also support for 'KtCodeFragment' files,
as well as some test coverage.
2023-07-27 10:23:42 +00:00
Yan Zhulanow 441735c2a8 [Analysis API] Support 'analyzeWithAllCompilerChecks()' in FE10 2023-07-27 10:23:41 +00:00
Yan Zhulanow 4b43e72440 [FIR] Create 'FirCodeFragment' with a lazy block if requested 2023-07-27 10:21:29 +00:00
Pavel Kirpichenkov 6896684d36 [LL] Register JvmTypeMapper for common modules with JVM platform
KT-60706
2023-07-27 10:18:54 +00:00