Commit Graph

17288 Commits

Author SHA1 Message Date
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
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 d26e3871ba [K2] Support interpretation of values in type 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
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
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
Kirill Rakhman e7bad26a4c [FIR] Unmute test for #KT-58080 2023-05-10 09:01:21 +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
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 24d7c3761d [FIR, Tests] Don't filter out syntax errors in tests
#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
Mikhail Glukhikh aec0def5ca FE: add test for KT-58332 (K2 fails with ARGUMENT_TYPE_MISMATCH) 2023-05-09 09:19:37 +00:00
Pavel Kunyavskiy 2f3947d8e5 [K/N] Unmute some actually passing tests 2023-05-09 09:15:41 +00:00
Dmitriy Novozhilov af60681705 [FIR] Save declarations in metadata in source order
^KT-54792 Fixed
^KT-54801
^KT-54800
2023-05-09 07:36:32 +00:00
Anna Kozlova c46a95aad7 [Light classes] do not write explicit options for IDE
those options are configured explicitly by test
2023-05-08 20:30:24 +00:00
Mikhail Zarechenskiy 6d7dc45ce6 K1: Add test for compatibility check of Enum.entries
Basically, the test checks that adding Enum.entries feature doesn't
break the existing code where it clashes with the user-defined "entries"
declaration; it's better to have a black-box test to be sure
that the compiler doesn't invoke something different at runtime

 The test covers KT-53153 and KT-56587

Merge-request: KT-MR-9798
Merged-by: Michail Zarečenskij <Mikhail.Zarechenskiy@jetbrains.com>
2023-05-08 15:35:25 +00:00
Nikolay Lunyak 76df0f9ad1 [FIR] KT-48870: Allow resolution to InaccessibleImplicitReceiverValue
^KT-48870 Fixed
2023-05-08 14:25:54 +00:00
Kirill Rakhman 7f9118d0f2 [FIR] Resolve property return type before resolving its annotations
This fixes TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM in a declaration
like `@Ann(myConst) const val myConst = ""`.

#KT-58080 Fixed
2023-05-08 07:45:57 +00:00
Mikhail Glukhikh 1c7ffb3276 ResultTypeResolver: don't allow Nothing as ILT subtype
#KT-58379 Fixed
2023-05-08 07:43:55 +00:00
Mikhail Glukhikh 6ae648f6f6 K2: reproduce KT-58379 2023-05-08 07:43:54 +00:00
Ivan Kylchik 73cc73115e [FIR2IR] Simplify logic around annotationMode
#KT-58005 Fixed
2023-05-05 16:15:00 +00:00
Dmitrii Gridin c2b09d3b1e [LL FIR] rewrite LLFirSuperTypeTargetResolver
The previous implementation had issues with
locks, publication and performance

Also, this change fixed a problem with mixed cycle inheritance

^KT-56550
^KTIJ-25430 Fixed
^KTIJ-23520 Fixed
^KT-57623 Fixed
^KTIJ-25372 Fixed
^KT-58357 Fixed
2023-05-05 12:35:46 +00:00
Stanislav Ruban 47c32ef37f KT-52671: Add CLI test
The issue in question was obsoleted by development of K2/MPP.

^KT-52671
2023-05-05 11:58:22 +00:00
Kirill Rakhman 3c66ae0f8b [FIR, LT] Report syntax error by traversing LT after parsing
#KT-57756 Fixed
2023-05-05 09:34:24 +00:00
Xin Wang 7b4e6bae0e JVM: ensure the $ENTRIES field is initialized before use
#KT-57784 Fixed
2023-05-04 23:11:39 +02:00
Evgeniy.Zhelenskiy bf5fa61ffb [IR] Unify MFVC bridge redirection, fix related bugs, support MFVC overriding functions with default parameters
#KT-1179
2023-05-04 16:44:18 +00:00
Sergej Jaskiewicz 89ff7bd0db [IR] Add body printing strategy to Kotlin-like dumper 2023-05-04 14:11:19 +00:00
Simon Ogorodnik 82611ad124 FIR. BI: Fix stub type leakage in builder inference
Previously, updateTypeInBuilderInference was calling
updateTypeFromSmartcast to actually perform type update in
implicit receiver after stub types was inferred
Such action results in creation of following FIR:

FirSmartCastExpression(
    original=FQAE(FirImplicitThisReference, typeRef=R|Inv<Stub>|)
    typeRef=R|Inv<String>|
)

in receiver position during completion of calls

However, it wasn't the case in general situation due to
action of FirStubTypeTransformer, which, in turn visits and updates
type ref inside original expression, but only if there was at
least one call (that was completed) using that implicit receiver
As after such type update updateTypeFromSmartcast function does
nothing

Yet in situation, when there was only partially resolved calls
referencing that implicit receiver we actually create smart-cast
expression and don't update type

The change just removes usage of updateTypeFromSmartcast and
replaces is with direct type update
We still mutate state of implicit receiver, potentially
improperly, it should be addressed in future

^KT-54708
^KT-58365 Fixed
2023-05-04 12:46:28 +00:00
Mikhail Glukhikh 3964ee38be K2: fix handling of synthetic calls in delegate inference
This commit is intended to avoid the second resolve of delegate when
we need to consider provideDelegate() possibility in inference.
Also here we provide correct completion of synthetic calls during
delegate inference.

#KT-58013 Fixed
2023-05-04 11:48:37 +00:00
Pavel Punegov 3d65907b8c [K/N][test] Ignore test in Native K1
This test doesn't work with K1 in Native

Merge-request: KT-MR-9934
Merged-by: Pavel Punegov <Pavel.Punegov@jetbrains.com>
2023-05-04 08:50:42 +00:00
Ilya Gorbunov 568d4b11af Use 'run' function instead of 'synchronized' in KT-51036 test
It should be enough to reproduce the issue and makes the test runnable on all backends
2023-05-04 02:44:26 +00:00
Mikhail Glukhikh 2e69c643cb K2: add test for KT-57649 2023-05-03 17:02:18 +00:00
Ivan Kylchik 7747643945 [IR] Filter chars and codePoints from allowed to interpret function
These two functions apparently are represented in Kotlin as methods
of `kotlin.String`. Because of that we accidentally treated them as
builtins.

To also minimize such cases, added filtration by return type. We are
allowing to interpret only these functions that have primitive or
unsigned return type.

#KT-57028 Fixed
2023-05-03 12:47:35 +00:00
Pavel Kunyavskiy af318fdfb0 [K/N] Fix default arguments in suspend functions
AddContinuationToFunctionsLowering was rewritten in way the order
of this lowering and defaults lowering doesn't matter.

^KT-58214
2023-05-03 12:14:53 +00:00
Kirill Rakhman 8afc8950e6 [FIR] Report illegal in/out modifier on star projection
#KT-55668 Fixed
2023-05-02 15:16:07 +00:00
Kirill Rakhman 0c3d5c11b1 [FIR] Render integer literal types as Int in diagnostic messages
#KT-55662 Fixed
2023-05-02 15:10:55 +00:00
Denis.Zharkov e95b8b843b K2: Support Unit-typed synthetic Java property
^KT-57979 Fixed
2023-05-02 14:24:23 +00:00