Commit Graph

107681 Commits

Author SHA1 Message Date
Sebastian Sellmair e409c60780 [ObjCExport] Split ObjCExport into K1 and Analysis Api implementation
FL-23390
^KT-64168 Fixed
2024-01-08 15:25:19 +00:00
Sebastian Sellmair 3e57265fcb [ObjCExport] ObjCExportStub: Do not retain reference to descriptor
FL-23390
^KT-64076 Fixed
2024-01-08 15:25:19 +00:00
Sebastian Sellmair e97463afb3 [ObjCExport][Minor] Reformat Code after move into newly created modules
FL-23390
2024-01-08 15:25:19 +00:00
Yahor Berdnikau 5fba2962b9 [Gradle] Add deprecated accessor to sourceSets inside KotlinSourceSet
Apparently, using such an approach is a popular case especially for
configuring 'dependsOn' parameter. And we should simplify user migration
 to more restricted DSL.

^KT-64722 Verification Pending
2024-01-08 14:07:50 +00:00
Yahor Berdnikau eb663117c7 [Gradle] Add dsl marker to KotlinSourceSet
We also need users to distinguish KotlinSourceSet DSL from other levels
of DSL, specifically extension one.

^KT-64722 In Progress
2024-01-08 14:07:50 +00:00
Dmitriy Dolovov e92017f64e [KLIB Resolver] Deprecate Logger.fatal()
Invocation of Logger.fatal() may cause severe side effects such as
throwing an exception or even terminating the current JVM process
(check various implementations of this function for details).

The code that uses Logger.fatal() sometimes expects a particular kind
of side effect. This is totally a design flaw. And it's definitely not
a responsibility of Logger to influence the execution flow of
the program.
2024-01-08 13:26:24 +00:00
Dmitrii Gridin 50dd94502b [SLC] fix PsiJavaCodeReferenceElement contract violation
We should provide valid getReferenceName as it is used
in many places (e.g. from com.intellij.psi.impl.PsiImplUtil.findAnnotation)

^KT-61605 Fixed
^KT-64605 Fixed
2024-01-08 13:22:56 +00:00
Alexander Korepanov b33798d65a [FIR2IR] Set proper offsets for generated data class members
^KT-64435 Fixed
2024-01-08 12:38:37 +00:00
Alexander Korepanov 6556acabba [JS FIR] Enable FIR JS stepping tests
^KT-64422 Fixed
2024-01-08 12:38:37 +00:00
Dmitrii Krasnov 36e8f9e3ac [Gradle Native] Provided default value for produceUnpackedKlib
^KT-64573 Fixed
2024-01-08 12:24:23 +00:00
Denis.Zharkov cb5070e335 NI: Add TODO for removing ALL_CONSTRAINTS_TRIVIAL_OR_NON_PROPER
^KT-63032 Related
2024-01-08 11:26:31 +00:00
Denis.Zharkov 90fcf086bb NI: Clean things around hasOnlyTrivialProperConstraint
- Get rid of unused val and its initialization
- Use a bit clearer naming
- Simplify the definition of `allConstraintsTrivialOrNonProper`
2024-01-08 11:26:30 +00:00
Anna Kozlova ce0a41fc69 [psi] move frontend independent string manipulators to psi.main module
this way IDE can drop dependency to old frontend,
when it's actually redundant
2024-01-08 09:54:48 +00:00
Vladimir Sukharev 35e5b0613d [K/N] Migrate filecheck test redundant_safepoints to new infra
^KT-62157
2024-01-08 08:59:24 +00:00
Vladimir Sukharev 35b83a1225 [K/N][FIR] Do not emit CAST_NEVER_SUCCEEDS when casting to forward declarations
^KT-61841 Fixed
2024-01-08 08:57:42 +00:00
Mikhail Glukhikh 050d74a22e FE: fix PlainJavaClassifierType.isRaw (take inner classes into account)
#KT-64090 Fixed
2024-01-08 08:33:03 +00:00
Mikhail Glukhikh d5b784805b K2: add tests for KT-58579 and for KT-64090 reproduction 2024-01-08 08:33:03 +00:00
Pavel Kunyavskiy f45d92eebc [K/N, K/JS, K/WASM] Enable FakeOverrideRebuilder by default
While not beeing final solution, this is closer to what
we want to have in the end. Enabling on non-JVM targets
would help better testing.

Enabling in JVM is now not possible yet, as some of the bugs are
not fixed yet (check KT-61360 for details)

^KT-62476
2024-01-08 07:46:07 +00:00
Pavel Kunyavskiy c6e32571d6 [FakeOverrideBuilder] Workaround KT-64743
Because of KT-64743 there is unexpanded type-alias in a place we don't
expect it to occur. To workaround this, we just expand typialiases in
one more place.

^KT-64743
2024-01-08 07:46:07 +00:00
Pavel Kunyavskiy c0f0c595c3 [IR Actualizer] Don't crash on incorrect code 2024-01-08 07:46:07 +00:00
Yan Zhulanow e4b574de38 [Analysis API] Update test data after rebase 2024-01-06 07:18:47 +00:00
Mikhail Glukhikh 64948fe48f Minor cleanup: JvmMappedScope 2024-01-06 07:11:27 +00:00
Mikhail Glukhikh f5453690a6 K2: prefer base class sources for JVM mapped functions
This commit is a follow-up to 3cb9396b20
"K2: prefer derived class sources for callable copies (e.g. fake overrides)"

#KT-64044 Fixed
2024-01-06 07:11:27 +00:00
Igor Yakovlev c80854eb7c [Wasm/WASI] Extract js-wasi mode to context property 2024-01-05 22:04:25 +00:00
Ivan Kochurkin 1f0fb5a1a8 [FIR] Check for ConeErrorType in doUnify to prevent endless recursion
^KT-64625 Fixed
2024-01-05 19:21:10 +00:00
Artem Kobzar 567433cc12 [K/Wasm, K/JS] Unmute explicit backing fields tests 2024-01-05 17:27:31 +00:00
Mikhail Glukhikh ae358fe194 K1/K2: add more tests regarding SequencedCollection.add/remove calls
Related to KT-64640
2024-01-05 17:20:32 +00:00
Mikhail Glukhikh 0ef41d75b5 K1/K2: consider List.(add/remove)(First/Last) as mutable list methods
#KT-64640 Fixed
2024-01-05 17:20:32 +00:00
Mikhail Glukhikh 8a560d2629 FE tests: don't render text of disabled diagnostics 2024-01-05 17:20:32 +00:00
Mikhail Glukhikh e1b7b0e768 K1/K2: reproduce KT-64640 2024-01-05 17:20:32 +00:00
Mikhail Glukhikh 8c2f5c767f K1/K2: add BB test for (add/remove)(First/Last) calls on mutable list
Related to KT-64640
2024-01-05 17:20:32 +00:00
Filipp Zhinkin 940c3c81ad KT-64361 delegate Int/Long::sign to methods from Java stdlib
Merge-request: KT-MR-13708
Merged-by: Filipp Zhinkin <filipp.zhinkin@jetbrains.com>
2024-01-05 17:13:37 +00:00
Yan Zhulanow 1b7d1dd08a [Analysis API] Simplify 'getNotUnderContentRootModule()'
In the resulting implementation of dangling file modules,
'getNotUnderContentRootModule()' is never called with a not-null file.
2024-01-05 16:04:14 +00:00
Yan Zhulanow bed73fd650 [Analysis API] Collect designations only for autonomous declarations
Parameters, type parameters, and property accessors are not
self-sufficient declarations (their resolution depends on resolution
of their parent), so a proper designation path cannot be computed
for them.

Without a designation path, 'ContextCollector' performs analysis of the
whole file, which is inefficient.
2024-01-05 16:04:14 +00:00
Yan Zhulanow 4a2f11b2f5 Revert "Revert "KT-61890 [AA] Use ContextCollector in KtFirScopeProvider""
This reverts commit 644e29a2ea.
2024-01-05 16:04:14 +00:00
Yan Zhulanow 3761c1051d [Analysis API] Use ContextCollector in 'KtFirCompletionCandidateChecker' 2024-01-05 16:04:14 +00:00
Yan Zhulanow f14a67cb7d [Analysis API] Support IGNORE_SELF in containing declaration provider 2024-01-05 16:04:14 +00:00
Yan Zhulanow 957617081f [Analysis API] Refactor 'KtFirSymbolContainingDeclarationProvider'
Move out logic for dependent (not self-sufficient) declarations, as
well as for declarations, parents of which are only computed using PSI.
2024-01-05 16:04:14 +00:00
Yan Zhulanow 452d22e14f [Analysis API] Add IGNORE_SELF dangling file resolution mode
In the 'IGNORE_SELF' mode, dangling files don't have their own
declarations in providers. As a result, all references there resolve to
declarations of the original file. It is conceptually similar to that we
had in on-air resolve, however, now it's possible to work with the whole
content of the in-memory 'FirFile'.

As it can be seen in 'ProjectStructureProvider.kt'
(KtFile.danglingFileResolutionMode), the 'IGNORE_SELF' mode is
automatically applied for non-physical files with an original file being
set. For other scenarios, now there is a new 'analyzeCopy()' function
that allows to pass the analysis mode explicitly.
2024-01-05 16:04:14 +00:00
Yan Zhulanow ae6b690d4f [Analysis API] Invert the 'isAutonomousDeclaration' flag 2024-01-05 16:04:14 +00:00
Yan Zhulanow 087398edd7 [Analysis API] Do not force session creation in 'LLSessionProvider' 2024-01-05 16:04:14 +00:00
Yan Zhulanow 6bbd252c07 [Analysis API] Implement separate caching for unstable dangling files
PSI events do not arrive for dangling files with no backing
'VirtualFile', so its partial invalidation becomes non-trivial.
In the change, a short-living cache is implemented for these 'unstable'
dangling files.
2024-01-05 16:04:14 +00:00
Yan Zhulanow 9c91158be6 [Analysis API] Add tests for dangling files 2024-01-05 16:04:14 +00:00
Yan Zhulanow 2899822102 [Analysis API] Extract dangling file module computation
Use the same code for creating dangling file modules inside tests,
the stand-alone API, and in the IDE.
2024-01-05 16:04:14 +00:00
Yan Zhulanow 441f3e0209 [Analysis API] Give a standalone module provider a better naming
Some components in Analysis API have the 'Impl' suffix both in test
and standalone environments. This commit fixes the logical ambiguity
for a project structure provider.
2024-01-05 16:04:14 +00:00
Yan Zhulanow a614d0325f [Analysis API] Move test-only project provider closer to tests 2024-01-05 16:04:14 +00:00
Yan Zhulanow f0a21654f8 [PSI] Allow to create contextual 'KtPsiFactory' with eventSystemEnabled
The change allows creating trackable in-memory files, which are useful
for intention preview.
2024-01-05 16:04:14 +00:00
Yan Zhulanow 7944602066 [Analysis API] Rework in-block modifications for dandling file modules
Before the change, all code fragment sessions were invalidated on any
PSI change. It was a simple solution, though not very effective.
Fragments were invalidated not only on a physical module change, but
also on change in another, unrelated code fragment.

As code fragment sessions were reworked to support also ordinary '.kt'
files, the old logic started to have even less sense, because ordinary
dangling files do not have a context element (they only have a context
module).

Currently, code fragment sessions are invalidated on any change in a
physical (non-dangling) module, and are also invalidated on any change
in their contextual dangling module, if any. With some work, this can be
improved further, so code fragments will be invalidated only on changes
in modules they depend on.

Relevant tests can be found in the IntelliJ project
(DanglingFileModuleInvalidationTest).
2024-01-05 16:04:14 +00:00
Yan Zhulanow 432884fe84 [Analysis API] Use resolution components from the same session
In 'getFirForNonBodyElement()', a wrong 'FirProvider' was used for
elements from modules other than a use-site one, and it could lead to
"Modules are inconsistent" exceptions from 'LLFirFileBuilder'.
2024-01-05 16:04:14 +00:00
Yan Zhulanow 297920fde9 [Analysis API] Support dangling file copies in 'KtFirVisibilityChecker'
Dangling files are copies of files in the context module, or just
depend on it. In any way, dangling file modules see all internals of
the context module.
2024-01-05 16:04:14 +00:00