Commit Graph

104976 Commits

Author SHA1 Message Date
Alexander Korepanov 522952db1f [JS IR] Run diagnostics by IR before the klib serialization
Implement an infrastructure for checking IR before JS klib serialization.
Implement the EXPORTING_JS_NAME_CLASH and EXPORTING_JS_NAME_CLASH_ES checks.

^KT-61710 Fixed
2023-09-23 19:49:17 +02:00
Alexander Korepanov 13bd627bfa [Common tests] Use RootDiagnosticRendererFactory for checking messages
The patch allows checking all diagnostings with checkFullDiagnosticRender().
It is required for the JS BE diagnostic tests.
2023-09-23 19:48:51 +02:00
Alexander Korepanov a7458f18a9 [Common tests] Support RENDER_ALL_DIAGNOSTICS_FULL_TEXT in JS BE tests
Move the checkFullDiagnosticRender() function from
the JvmBackendDiagnosticsHandler class so it can be reused
in the JsBackendDiagnosticsHandler class.
2023-09-23 19:48:50 +02:00
Igor Yakovlev 758484a01f [Wasm] Fix generation optimised when expression with Nothing type
Fixed #KT-62147
2023-09-23 10:18:30 +02:00
Yan Zhulanow 624d35fefd Update test data for 'ContextCollector' after renderer changes
See also d98da87278 ([FIR] Render
dot-separated FQNs instead of slash-separated ones in diagnostics).
2023-09-23 07:01:04 +00:00
Dmitrii Krasnov 93fcee7532 [Gradle] Muted NativeDownloadAndPlatformLibsNonParallelIT on Windows. 2023-09-23 06:26:11 +00:00
Johan Bay 9399663b6e [K/N] Serialize full IdSignatures to caches
^KT-61642 Fixed
2023-09-22 22:30:25 +00:00
Johan Bay 64e601bea0 Extract IdSignature serializer from IrFileSerializer
^KT-61642
2023-09-22 22:30:25 +00:00
Johan Bay a041e51ff2 Rename IdSignatureSerializer to IdSignatureFactory
^KT-61642
2023-09-22 22:30:24 +00:00
Alejandro Serrano Mena b1551c67e0 KT-59504 [FIR] Check _ on destructuring declarations
Previously the checker was ignoring them, leading to missing diagnostics

^KT-59504 Fixed
2023-09-22 21:46:09 +00:00
Sergej Jaskiewicz 59129501cb [FIR/IR generator] Remove unused properties of Type 2023-09-22 19:46:14 +00:00
Sergej Jaskiewicz 3a5e69d651 [FIR/IR generator] Inherit TypeRef from Importable
This is the first step to replace the usages of `Importable`
in the FIR generator with `TypeRef`.

This is a step towards commonizing the code generator between
FIR and IR: KT-61970
2023-09-22 19:46:14 +00:00
Sergej Jaskiewicz d86161bccb [FIR generator] Remove Type#firType property as it has no effect 2023-09-22 19:46:14 +00:00
Sergej Jaskiewicz a995c522f7 [IR generator] Factor out TypeRef to common module
This is a step towards commonizing the code generator between
FIR and IR: KT-61970
2023-09-22 19:46:14 +00:00
Sergej Jaskiewicz d5394db185 [FIR generator] Factor out AbstractElement to common module
This is a step towards commonizing the code generator between
FIR and IR: KT-61970
2023-09-22 19:46:14 +00:00
Sergej Jaskiewicz 977e316489 [FIR generator] Factor out TypeArgument to common module
This is a step towards commonizing the code generator between
FIR and IR: KT-61970
2023-09-22 19:46:14 +00:00
Nikolay Krasko 46cbec7260 Remove kotlinx-collections-immutable-metadata from verification (KT-61766)
For some reason resolution have changed once again after version
switch to 2.0.0
2023-09-22 19:38:37 +00:00
Yan Zhulanow bd6d492b0c [LL API] Compile code fragment together with its context file
Recently, 'KtFirCompilerFacility' started to compile files from
dependent modules separately. Until recently, the code fragment was
in the same module as its context, so they naturally went in the same
compilation round. Now a separate 'KtCodeFragmentModule' is created,
so the code fragment case has to be handled explicitly.

This fixes the following groups of tests:
- FirIdeNormalAnalysisLibrarySourceModuleCompilerFacilityTestGenerated
- K2IdeK2CodeKotlinEvaluateExpressionTestGenerated (in IntelliJ)
2023-09-22 19:26:21 +00:00
Dmitrii Krasnov 3074b50e86 Migrated GeneralNativeIT to junit 5 and gradle TestKit 2023-09-22 18:21:46 +00:00
Ilya Kirillov 1ace71a907 [Analysis API] allow completion from non-physical files
Needed for injection

^KTIJ-21127
2023-09-22 17:42:51 +00:00
Vladimir Sukharev 690d18e541 [K/N, Test] Move test code "org.jetbrains.kotlin.konan" -> "org.jetbrains.kotlin.konan.test.*" 2023-09-22 17:27:09 +00:00
Roman Golyshev f5c33ad380 KT-62139 [AA] Remove withValidityAssertion from FE10 implementation of createContextDependentCopy
FIR implementation already does not have this check in
`createContextDependentCopy`, because it's called not
inside `analyze` call, but before it (see
`analyzeInDependedAnalysisSession`)

^KT-62139 Fixed
2023-09-22 14:19:04 +00:00
Kirill Rakhman fbf68a5bcc [FIR] Narrow down range of NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER
This uses the same approach as
INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION where we use a visitor
to find a call to a symbol that contains the type variable in question.

#KT-56140 Fixed
2023-09-22 13:49:59 +00:00
Yan Zhulanow 4690a430f4 [LL API] Fix smart-cast collection for special 'FirElement's
'DFANode' is not created for certain elements, such as types or
references. Before the change, only the target element itself was
queried for DFA, making the 'ContextCollector' return an empty map of
smart casts.

^KTIJ-26973 Fixed
2023-09-22 13:40:09 +00:00
Dmitriy Dolovov 6c1711c52a Bump Kotlin/Native version in KGP to 2.0.0-dev-3904 2023-09-22 12:51:02 +00:00
Mikhail Glukhikh ae19cd91bf K2: fix "private to this" determination logic in accordance with K1
#KT-61844 Fixed
2023-09-22 12:23:46 +00:00
Mikhail Glukhikh b9302869d5 K2: reproduce KT-61844 2023-09-22 12:23:46 +00:00
Yan Zhulanow 36df749697 [LL API] Invalidate code fragment sessions on PSI modifications
Code fragments depend not only on their context module, but also on
body of the context declaration.
2023-09-22 12:20:05 +00:00
Yan Zhulanow 1293eb0fab [LL API] Rename 'KtModuleKind' to 'KtModuleResolutionStrategy'
The word "kind" is ambiguous – users might assume the kind is somehow
related to 'KtSourceModule'/'KtScriptModule'.
2023-09-22 12:20:05 +00:00
Yan Zhulanow 0f33f82ffc [LL API] Fix reflective patching for field accesses
Implement the same behavior as in K1 evaluator. Also see
'IRFragmentCompilerCodegen#codegenFactory' in the IntelliJ project.

The commit fixes the following failing tests in the IntelliJ project:
- K2IdeK2CodeKotlinEvaluateExpressionTestGenerated$SingleBreakpoint$CompilingEvaluator$InaccessibleMembers.testPrivateAnnotationCompanionValue
- K2IdeK2CodeKotlinEvaluateExpressionTestGenerated$SingleBreakpoint$CompilingEvaluator$InaccessibleMembers.testSelfMembers
- K2IdeK2CodeKotlinEvaluateExpressionTestGenerated$SingleBreakpoint$CompilingEvaluator$InaccessibleMembers.testOuterMembers
- K2IdeK2CodeKotlinEvaluateExpressionTestGenerated$SingleBreakpoint$Uncategorized.testPrivateMember
- K2IdeK2CodeKotlinEvaluateExpressionTestGenerated$SingleBreakpoint$Uncategorized.testProperties
- K2IdeK2CodeKotlinEvaluateExpressionTestGenerated$SingleBreakpoint$Uncategorized.testPrivatePropertyWithExplicitDefaultGetter
- K2IdeK2CodeKotlinEvaluateExpressionTestGenerated$SingleBreakpoint$Uncategorized.testPrivateClass
2023-09-22 12:20:05 +00:00
Yan Zhulanow fa98945719 [LL API] Remove KtCodeFragment-targeted conflict resolver from libraries
Before, 'KtCodeFragment's were analyzed as a part of their context
session. Now, a separate session is created for each code fragment,
and the LLLibraryScopeAwareCallConflictResolverFactory registration
moved there.
2023-09-22 12:20:05 +00:00
Yan Zhulanow 715f7d1a35 [LL API] Analyze code fragment in a separate 'FirSession'
Before, `KtCodeFragment`/`FirCodeFragment` was analyzed as a part of
its context `KtModule`. This has the following complications:

- In non-source sessions, diagnostic reporting is globally disabled.
  For code fragments, however, checking the code before passing it to
  the backend is essential.

- Special treatment for call ambiguities in libraries
  (`LLLibraryScopeAwareCallConflictResolverFactory`) becomes complicated
  as the conflict resolver has to be applied to a library module.

- `KtCodeFragment`s usually have a shorter lifetime than their own
  context. Caching may potentially be implemented differently for them.

^KT-61783 Fixed
2023-09-22 12:20:05 +00:00
Yan Zhulanow b32c083346 [LL API] Remove leaves of 'LLFirResolvableResolveSession' 2023-09-22 12:20:05 +00:00
Yan Zhulanow f51a7515e1 [LL API] Move 'LLModuleKindProvider' instantiation out 2023-09-22 12:20:05 +00:00
Yan Zhulanow 095dd7d9c3 [LL API] Move 'LLDiagnosticProvider' instantiation out 2023-09-22 12:20:05 +00:00
Yan Zhulanow 68bb39fbcd [LL API] Pass 'LLDiagnosticProvider' to 'LLFirResolveSession' explicitly 2023-09-22 12:20:05 +00:00
Yan Zhulanow b18856dc0a [LL API] Move LLModuleProvider and LLSessionProvider instantiation out 2023-09-22 12:20:05 +00:00
Yan Zhulanow 147712975f [LL API] Remove instance checks for LLFirResolveSession implementations 2023-09-22 12:20:04 +00:00
Yan Zhulanow fee3e696ea [LL API] Move out traits of 'LLFirResolveSession' to separate classes 2023-09-22 12:20:04 +00:00
Yan Zhulanow 25c9ef12df [LL API] Minor, return 'List' from 'getAllDiagnosticsForFile()' 2023-09-22 20:53:26 +09:00
Yan Zhulanow 9ef58f2bdb [LL API] Collect syntax errors in 'KtFirCompilerFacility'
^KTIJ-27167 Fixed
2023-09-22 11:39:49 +00:00
Ilya Chernikov 141333bdcd K2: Update extension receiver after checking in CheckExtensionReceiver
fixes receiver selection when the candidate has more that one possible
extension receiver
#KT-62129 fixed
2023-09-22 11:33:46 +00:00
Vladimir Sukharev 56eedfebee [FIR] K2: Fix disappeared diagnostic UNDERSCORE_USAGE_WITHOUT_BACKTICKS on types
^KT-59985 Fixed

Merge-request: KT-MR-12282
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-09-22 11:18:19 +00:00
Ilya Kirillov 80f86a3527 [FIR] Render flexible types as A..B instead of cryptic ft<A, B>` in diagnostic messages
^KT-62032 fixed
2023-09-22 10:48:31 +00:00
Ilya Kirillov 252c59a8a3 [FIR] Render k2-specific flexible types in a more compact way in diagnostic messages
^KT-62031 fixed
2023-09-22 10:48:31 +00:00
Ilya Kirillov e2252f5e6b [FIR] add testcase for KT-62031 2023-09-22 10:48:31 +00:00
Ilya Kirillov d98da87278 [FIR] Render dot-separated FQNs instead of slash-separated ones in diagnostics
^KT-62030 fixed
2023-09-22 10:48:31 +00:00
Gavriil Maksyutenko b119b4de02 [Wasm] Return SpiderMonkey in box tests
^KT-61958 fixed
2023-09-22 10:16:31 +00:00
Gavriil Maksyutenko c9ba080383 [Gradle, Wasm] Update jsshell 2023-09-22 10:16:30 +00:00
Vladimir Sukharev 42af684ab7 [FIR] Fix disappeared ILLEGAL_ESCAPE
^KT-59950 Fixed
2023-09-22 08:38:50 +00:00