Commit Graph

3210 Commits

Author SHA1 Message Date
aleksandrina-streltsova 9e50a3b71d [FIR] create snapshot of collected tower data context for declaration
KTIJ-26113
2023-07-31 10:50:12 +00:00
aleksandrina-streltsova af6672c87d [FIR] store tower data context for operand in and/or binary expression
KTIJ-26113
2023-07-31 10:50:12 +00:00
aleksandrina-streltsova 2f2eb86195 [FIR] save tower data context for expression in when entry
^KTIJ-26113 Fixed
2023-07-31 10:50:11 +00:00
Ilya Kirillov de4224296d [Analysis API FIR] fix reference resolve to reified type parameter 2023-07-31 08:43:59 +00:00
Dmitrii Gridin da71a152cd [FIR] update FirRenderer for scripts
^KT-60728
2023-07-28 17:49:14 +00:00
Dmitrii Gridin 2bacba5a9a [LL FIR] add one more complex test case for scripts
^KT-60728
2023-07-28 17:49:14 +00:00
Yan Zhulanow 7d88ade005 [fir2ir] Allow non-cached type parameters
In the IDE, there might come declarations from other files/modules
that we link against, but not compile. Type parameters are one of such
declaration kinds.
2023-07-28 16:05:34 +00:00
Dmitriy Novozhilov 69a35970eb [FIR] Introduce different synthetic origins for FIR declarations
This is needed to be able to precisely distinguish different synthetic
  declarations (like fields for delegates and functions for data classes)
  in fir2ir
2023-07-28 13:59:38 +00:00
Kirill Rakhman ed6948959c [FIR] Make rendering of properties for diagnostics more user-friendly
#KT-60137 Fixed
2023-07-28 13:28:06 +00:00
Ivan Kylchik 84159596bd [FIR] Pass diagnosticReporter in Fir2IrConfiguration
This parameter will be used to report diagnostics from constant
evaluator, in addition to report diagnostic from actualizer.
2023-07-27 22:50:21 +00:00
Ivan Kylchik 6e45c9d4c7 [Test] Drop convertToIr method from AbstractFirAnalyzerFacade
We are going to use `convertToIr` from `ModuleCompilerAnalyzedOutput`
without an intermediate wrapper.
2023-07-27 22:50:21 +00:00
Dmitrii Gridin e99cfbd3b7 [LL FIR] add script tests for AbstractFirLazyDeclarationResolveTest
^KT-60728
2023-07-28 00:13:59 +02:00
Dmitrii Gridin 1515fbe99f [LL FIR] add script tests for AbstractGetOrBuildFirTest
^KT-60728
2023-07-28 00:13:59 +02:00
Dmitrii Gridin a60abc6c06 [LL FIR] add script tests for AbstractInBlockModificationTest
^KT-60728
2023-07-28 00:13:59 +02:00
Ivan Kochurkin 2eba7da5eb [FIR] Rename FirArrayOfCall to FirArrayLiteral 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
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
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
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
Pavel Kirpichenkov 6896684d36 [LL] Register JvmTypeMapper for common modules with JVM platform
KT-60706
2023-07-27 10:18:54 +00:00
marat.akhin 34b271b13d [KMP] Implement ACTUAL_TYPE_ALIAS_TO_NOTHING/TO_NULLABLE_TYPE errors
^KT-60650 Done
2023-07-27 09:13:37 +00:00
Kirill Rakhman 951b299268 [FIR] Rewrite redeclaration checks
#KT-60124 Fixed
#KT-60573 Fixed
2023-07-27 08:06:20 +00:00
Marco Pennekamp 017784d24f [LL FIR] KT-60570 Use emptySet in Kotlin symbol names provider to conserve memory
- As mentioned in KT-60570, memory consumption in cached symbol names
  providers is caused partially by lots of instances of empty mutable
  sets. This commit replaces such sets with the `emptySet()` singleton.
- This improvement also makes sense for callable names because the IDE
  "package names with top-level callables" set currently contains all
  package names in the project.
- In my local tests of the `setUp` Find Usages performance test, the
  retained size of `FirDelegatingCachedSymbolNamesProvider` is cut down
  from 208MB to 170MB by the empty class name set optimization, and from
  170MB to 115MB by the empty callable name set optimization.
2023-07-26 19:03:20 +00:00
Pavel Mikhailovskii bbbca94d3c [Analysis API] Get rid of automatic registration of KtLifetimeTokenProvider in StandaloneAnalysisAPISessionBuilder. Introduce KtAlwaysAccessibleLifetimeTokenProvider. 2023-07-26 15:47:05 +00:00
Ilya Kirillov 7606aab0dd [LL FIR] fix user code leak from exceptions in :analysis:analysis-api-fir
Also, add more info to some exceptions
2023-07-26 14:29:20 +00:00
Ilya Kirillov e3d2bccb33 [LL FIR] fix user code leak from exceptions in :analysis:low-level-api-fir
Also, add more info to some exceptions
2023-07-26 14:29:20 +00:00
Yan Zhulanow c702f00399 [LL API] Avoid implicit types in stub-decompiled annotations 2023-07-26 13:02:46 +00:00