Commit Graph

43692 Commits

Author SHA1 Message Date
Alexander Korepanov 1920bbde07 [K/JS] Enable partial linkage tests 2023-05-11 12:37:01 +00:00
Artem Kobzar 302623c388 [K/JS] Skip static members in fake overrides generating ^KT-58396 Fixed 2023-05-11 12:32:21 +00:00
Mikhail Glukhikh 134284e496 FE: add test for KT-58055 2023-05-11 12:19:40 +00:00
Pavel Mikhailovskii 25c0725da9 [SLC] Treat error class types as not-nullable 2023-05-11 11:48:45 +00:00
Dmitrii Gridin 9a267176f5 [FIR] move deprecation calculation to COMPILER_REQUIRED_ANNOTATIONS phase
Also, this change adds SinceKotlin and Java.Deprecated to this phase
It fixes some problems with API_NOT_AVAILABLE, so now it is closer to K1

^KT-57648 Fixed
^KT-55723 Fixed
2023-05-11 10:31:52 +00:00
Dmitrii Gridin add47aa041 [FIR] provide correct origin and source to default backing field
Now it is aligned with default accessors
Covered by
analysis/analysis-api/testData/symbols/symbolByReference/accessorField.kt
test

^KT-57648
^KT-55723
2023-05-11 10:31:52 +00:00
Vladimir Dolzhenko ae4b0c6fe1 Drop KtStubElementTypes#FILE
It has been marked as deprecated for a while and targeted to be deleted in 1.9.0

#KT-53781

Merge-request: KT-MR-10082
Merged-by: Vladimir Dolzhenko <Vladimir.Dolzhenko@jetbrains.com>
2023-05-11 09:56:55 +00:00
Vsevolod Tolstopyatov 5b474bc5d3 Stabilize EnumEntries stdlib signature
* Also, mention implementation details of EnumEntries to enable safe uses of a 'EnumEntries' as a set
* Fix testdata for opt-in marker in enum entries

^KT-58548 fixed

Merge-request: KT-MR-10037
Merged-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com>
2023-05-11 09:18:44 +00:00
Ilmir Usmanov aec78ab2d8 Minor. Add regression test for KT-42696
#KT-42696 Fixed
2023-05-11 11:15:06 +02:00
Mikhail Glukhikh 9011af1008 K2: perform IOT approximation in completion properly #KT-58520 Fixed 2023-05-11 09:12:26 +00:00
Mikhail Glukhikh 8bc72cb2e5 K2: reproduce KT-58520 in FIR2IR (K2 fails with exception) 2023-05-11 09:12:26 +00:00
Ivan Kylchik d83f6a40fb [K2] Revert commit Pass FirFile to metadata serialization
We will ignore this for now. It is quite painful to bring `FirFile`
in all necessary places.

#KT-57812
2023-05-11 08:22:14 +00:00
Ivan Kylchik 0a5883d867 [IR] Add explicit error in IR type transformer for member access expr
We must generate transform method for `IrMemberAccessExpression` by
hand because of specifics of working with `typeArguments`. But we
also must consider the case that in future we can add new fields in
this element. If it happens, we will see error message.

#KT-57812
2023-05-11 08:22:13 +00:00
Ivan Kylchik 961d8a4905 [IR] Rewrite transformer generator to write explicit return type
#KT-57812
2023-05-11 08:22:13 +00:00
Ivan Kylchik d75d182b26 [K2] Slightly reformat code 2023-05-11 08:22:13 +00:00
Ivan Kylchik 951e30b683 [K2] Pass FirFile to metadata serialization
This is needed to extract correct const value from `ConstValueProvider`.

#KT-57812
2023-05-11 08:22:13 +00:00
Ivan Kylchik d26e3871ba [K2] Support interpretation of values in type annotations
#KT-57812
2023-05-11 08:22:13 +00:00
Ivan Kylchik 846ad95c9e [K2] Return from toConstantValue only if expected type match
There was a bug with early return from `toConstantValue`
method when we found any const value in `ConstValueProvider`.
Actually we should return only if expected type match. This error can
occur if annotation and constant inside it are fakes and
have the same offset.

#KT-57812
2023-05-11 08:22:13 +00:00
Ivan Kylchik 01749a910b [IR] Add new visitor IrTypeVisitorVoid that can traverse IR types
#KT-57812
2023-05-11 08:22:13 +00:00
Ivan Kylchik 55cac9caa6 [IR] Separate IrConstTransformer into two distinct classes
The first one `IrConstExpressionTransformer` is responsible for
transforming ordinary expressions and the second one
`IrConstAnnotationTransformer` is responsible for annotations.

#KT-57812
2023-05-11 08:22:13 +00:00
Dmitriy Novozhilov 40b8b682f9 [FIR] Don't save DFA implications for unstable local vars
^KT-57502 Fixed
2023-05-10 14:19:25 +00:00
Ivan Kochurkin 31424e38ac [FIR] Consider the isExpect value of the receiver class for intersection overrides
It's critical for signature calculation in FIR2IR because `isExpect` is a part of signature
2023-05-10 14:17:53 +00:00
Sergej Jaskiewicz 93d1932ccb [IR] Make IrReturnTargetSymbol a sealed interface 2023-05-10 11:51:26 +00:00
Sergej Jaskiewicz 6c211f3a39 [IR] Make IrFunctionSymbol a sealed interface 2023-05-10 11:51:26 +00:00
Sergej Jaskiewicz d0ca89f0a0 [IR] Make IrValueSymbol a sealed interface 2023-05-10 11:51:25 +00:00
Sergej Jaskiewicz 916d965b0b [IR] Make IrPackageFragmentSymbol a sealed interface 2023-05-10 11:51:25 +00:00
Sergej Jaskiewicz 1a371350ea [IR] Make IrClassifierSymbol a sealed interface 2023-05-10 11:51:25 +00:00
Egor Kulikov 6f20ac4f38 [FIR] Enable asserts for not building AST tree in lazy mode
Make interface delegate expressions lazy
2023-05-10 11:49:42 +00:00
Kirill Rakhman b2fa104081 [FIR] Keep all failed resolution candidates and fully resolve them
Previously, when a candidate was found with an applicability that is
better than the current best applicability, all previous candidates were
thrown away. Now we keep them, unless the new applicability is
successful. If no successful candidates are found, we fully resolve all
the unsuccessful ones and select the ones with the least bad
applicability. This improves diagnostics for unresolved calls.

#KT-57844 Fixed
2023-05-10 11:48:58 +00:00
Vladimir Dolzhenko 451daaa7c5 Do not publish non fully initialized descriptors
Leaking of a reference (via publishing to binding trace) of not fully
initialized object could lead to unpredicted and unexpected NPEs
iff some exception (like PCE or InvalidPsiAccess) happens between
the publishing and initialization.

#KT-57514
#KT-56388
#KT-56364

Merge-request: KT-MR-10052
Merged-by: Vladimir Dolzhenko <Vladimir.Dolzhenko@jetbrains.com>
2023-05-10 11:40:44 +00:00
Igor Chevdar f5478bda3d Handle recently added property to K2NativeCompilerArguments 2023-05-10 11:05:06 +00:00
Simon Ogorodnik 4d1ea06c17 FIR. Document current builder inference algorithm 2023-05-10 10:40:04 +00:00
Alexander Udalov 987e8c25dc K2: do not generate line numbers for delegated members
Psi2ir does not generate them, see
https://github.com/JetBrains/kotlin/blob/1.8.20/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ClassGenerator.kt#L319.

Besides influencing debugger and coverage behavior, it also affects how
conflicting JVM signature diagnostics are reported because they
use offsets to determine which element to report the error on. So after
this change, K1 and K2 behavior is the same in that regard as well.

 #KT-58215 Fixed
2023-05-10 10:32:07 +00:00
Dmitrii Gridin ae88726fae [FIR] treat constructors of local classes as local declarations
The main problem: we are trying to lazily resolve local declaration

^KT-58546
^KT-58490
2023-05-10 09:59:15 +00:00
Kirill Rakhman e7bad26a4c [FIR] Unmute test for #KT-58080 2023-05-10 09:01:21 +00:00
Kirill Rakhman 8dad097841 [Tests] Fix reporting when FirLoadCompiledKotlinTest can be unmuted 2023-05-10 09:01:21 +00:00
Igor Chevdar e4f30589a4 [K/N] Incremental compilation of per-file caches 2023-05-10 08:37:32 +00:00
Igor Chevdar f90db20512 [K/N][caches] Added klib hash computing and storing 2023-05-10 08:37:32 +00:00
Dmitriy Novozhilov 1936658e40 [FIR] Consider stability of receiver for DFA variables
^KT-57425 Fixed
2023-05-10 07:50:31 +00:00
Ivan Kochurkin b22e89e91d [Tests] Consider dependent fragments in IR handlers 2023-05-09 20:50:01 +00:00
Ivan Kochurkin 988927154e [Tests] Extract common dependentIrModuleFragments and diagnosticReporter for IrBackendInput 2023-05-09 20:50:01 +00:00
Dmitrii Gridin 2c294cba64 [FIR] SupertypeComputationSession: fix false positive invisible reference for local object
The problem is that FirAnonymousObject was ignored during getResolvedSuperTypeRefsForOutOfSessionDeclaration from SupertypeSupplier

^KT-58583 Fixed
2023-05-09 17:23:45 +00:00
Kirill Rakhman f0a8d7c86f [FIR] Add TODO for ConeDestructuringDeclarationsOnTopLevel
#KT-58563
2023-05-09 13:36:34 +00:00
Kirill Rakhman 24d7c3761d [FIR, Tests] Don't filter out syntax errors in tests
#KT-58469
2023-05-09 13:36:33 +00:00
Kirill Rakhman 9187bbb710 [FIR] Fix typo 2023-05-09 13:36:33 +00:00
Kirill Rakhman 93ee4d7ce7 [FIR] Refactor DiagnosticKind.Syntax into ConeSyntaxDiagnostic
#KT-58469
2023-05-09 13:36:33 +00:00
Roman Golyshev 105611679e [AA FIR] KT-58503 Use resolvedStatus to access visibility and modality of a class
Compiler plugins (AllOpen, for example) can modify the status of a
declaration, including visibility and modality. If we observe them
without enforcing STATUS resolve, we risk to see incorrect information,
which in turn can lead to false negatives/positives in
inspections/intentions.

Add test for light classes. See KT-58503 description for the explanation
how the initial problem was influencing Spring inspections from intellij
repository.

^KT-58503 Fixed
2023-05-09 13:20:16 +00:00
Alexander Udalov c06ec84bb1 JVM: fix type mapping of big arity suspend function types
The code in IrTypeMapper was incorrectly translated from
KotlinTypeMapper during the development of JVM IR. The
`classDescriptor.hasBigArity` condition in KotlinTypeMapper was checking
if the class represents a function or a suspend function with big arity,
and the suspend function part was lost during conversion.

This resulted in incorrect generic signature being generated, which led
to malformed type exceptions from reflection, and compilation errors
from kapt stub generation.

Also, change a comment in irCodegenUtils to avoid confusion of numbered
function types (kotlin.jvm.functions.Function1, ...) with the big-arity
type kotlin.jvm.functions.FunctionN.

 #KT-58375 Fixed
2023-05-09 12:57:07 +00:00
Alexander Udalov 45bf70c9f9 Minor, add debug stepping test for KT-44745 2023-05-09 12:44:47 +00:00
Mikhail Glukhikh 0906258d03 K2: handle suspend anonymous functions properly in various compiler parts
#KT-58332 Fixed
2023-05-09 09:19:38 +00:00