Commit Graph

1427 Commits

Author SHA1 Message Date
Ilya Chernikov 776cdbcd3f minor: small cleanup in K2 scripting support code 2023-07-26 08:49:27 +00:00
Ilya Chernikov d24fc3b581 K2 Scripting: add support for result field 2023-07-26 08:49:26 +00:00
Arseniy Terekhov be9d2953b2 [FIR] Make own accept methods of FirTypeParameterRef inheritors
This change is necessary in order to make `FirElement` abstract class. To do it we need to remove all `accept` and `transform` methods from fir interfaces. So we have to make sure that all fir element implementations have their `accept` and `transform` implementations in their super classes. In particular this change makes 'accept' and 'transform' methods in `FirConstructedClassTypeParameterRef` and `FirConstructedClassTypeParameterRef` base classes.
2023-07-25 11:53:47 +00:00
Arseniy Terekhov 4d85cc8aa6 [FIR] Make FirImport an abstract class
This change is necessary in order to make `FirElement` abstract class. To do it we need to remove all `accept` and `transform` methods from fir interfaces. So we have to make sure that all fir element implementations have their `accept` and `transform` implementations in their super classes. In particular this change makes `FirImport` abstract class in order to preserve `accept` and `transform` methods after removing them from fir interfaces.
2023-07-25 11:53:47 +00:00
Kirill Rakhman 070b694247 [FIR] Get rid of implicit type refs with source
#KT-55835
2023-07-20 07:29:18 +00:00
Kirill Rakhman 91dad7b952 [FIR] Set source of smart-cast expressions automatically
#KT-55835
2023-07-20 07:29:18 +00:00
Kirill Rakhman bed6cb7154 [FIR] Make FirFile.annotationsContainer nullable
Previously, when no file annotations were present, the FIR element
didn't have a source.
By making it nullable, it will only be created when appropriate and the
source will never be null.

#KT-55835
2023-07-20 07:29:18 +00:00
Kirill Rakhman ef086a4c88 [FIR] Eliminate null field in FirNoReceiverExpression
#KT-55835
2023-07-20 07:29:18 +00:00
Dmitrii Gridin d0854d5b45 [FIR] propagate copy of original ConeKotlinType to anonymous functions to avoid concurrent modification
It is required to avoid leakage of annotations instance from
the original type
It should be enough to just create a new instance of an annotation
without a deep copy, because transformer shouldn't touch it

^KT-60387 Fixed
2023-07-19 11:50:12 +00:00
Dmitrii Gridin 51b9059123 [FIR] generate copy builder for annotation
^KT-60387
2023-07-19 11:50:12 +00:00
Alexander Korepanov e61a11f0a3 [JS FIR] Fix review comments 2023-07-18 14:02:30 +00:00
Ilya Kirillov 24db4e62f5 Migrate some FIR/Analysis API KotlinExceptionWithAttachment usages to buildErrorWithAttachment API 2023-07-18 11:49:21 +00:00
Ilya Kirillov b5394d79b9 [FIR] remove user code leaks from compiler.fir.tree module, add more information to some errors 2023-07-18 11:49:20 +00:00
Ilya Kirillov a9cd881a07 [FIR] add utilities to FIR compiler to throw error with attachment 2023-07-18 11:49:20 +00:00
Ilya Kirillov 25911b1fec Move SmartPrinter to kotlin.core.util.runtime so it's accessible from KotlinExceptionWithAttachments 2023-07-18 11:49:20 +00:00
Dmitriy Novozhilov 73b580572b [FE] Move @PrivateForInline optIn into :core:compiler.common
This is needed to be able to use it in backend modules too
2023-07-17 21:02:40 +00:00
Brian Norman 363b336b7a [FIR] Only overridable members should report JvmName inapplicable
Instead of checking for only open declarations, check for overridable
declarations, since private declarations cannot be overridden even if
they are marked as open. While normally these modifiers are exclusive,
a declaration can be made open via a compiler plugin like AllOpen.

#KT-60183 Fixed
#KT-57223 Fixed
2023-07-17 12:06:09 +00:00
Mikhail Glukhikh 00b4ae6ae9 K2: expand type before isSomeType checks properly
Related to KT-60229
2023-07-14 16:38:47 +00:00
Egor Kulikov 70d49999ac [FIR] Generate an error primary constructor when super call is invalid
Merge-request: KT-MR-11026
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
2023-07-13 17:37:48 +00:00
Ivan Kochurkin ca93165044 [FIR] Remove useless code discovered by code coverage 2023-07-12 13:11:24 +00:00
Brian Norman 10ed26991d [FIR] Extract LHS receiver of assignment operator statements
#KT-53490 Fixed
2023-07-12 11:41:33 +00:00
Denis.Zharkov e98890cece K2: Remove a bunch of unused declarations 2023-07-11 13:12:22 +00:00
Mikhail Glukhikh 71456c5514 FIR2IR: properly set constant expression type 2023-07-11 08:28:04 +00:00
Nikolay Lunyak 8541143d6f [FIR] Fix the TODO in FirConflictsHelpers
According to
https://github.com/Kotlin/KEEP/blob/master/proposals/enhancing-main-convention.md#rules-and-semantics,
only main function without args may avoid
`CONFLICTING_OVERLOADS`, but since the
jps/jps-plugin/testData/incremental/withJava/other/mainRedeclaration
test dates back to 2015, this is not the
current behavior.
2023-07-10 09:28:54 +00:00
Yan Zhulanow 8ffb329741 [FIR] Add 'buildCodeFragmentCopy()' and 'replaceBlock()' for IDE analysis 2023-07-06 15:58:30 +09:00
Vasily Levchenko 33abe75a74 [FIR] Add FirCodeFragment 2023-07-06 15:58:29 +09:00
Ilya Chernikov bf3a6f7678 K2 Scripting: support script top-level destructuring declarations 2023-07-05 19:46:04 +00:00
Ilya Chernikov 02e2438d37 K2 Scripting: fix script this receiver handling in IR
also fix accessor lowering
2023-07-05 19:46:04 +00:00
Ivan Kochurkin 7b3f1c73ca [FIR] Add @Supress("unused") to generated files 2023-07-05 17:53:52 +00:00
Ivan Kochurkin ee44bddaf9 [FIR] Add @Supress("unused") to debug and plugin-related declarations 2023-07-05 17:53:52 +00:00
Ivan Kochurkin 43b76f3c24 [FIR] Remove unused declarations 2023-07-05 17:53:51 +00:00
Dmitriy Novozhilov 1ca1616528 [FIR] Check for extension and context receiver in isMethodOfAny utility 2023-07-05 14:57:55 +00:00
Dmitriy Novozhilov 210ad770aa [FIR] Remove duplicated logic for isMethodOfAny utility 2023-07-05 14:57:55 +00:00
Kirill Rakhman 1d3a127f52 [FIR] Simplify getSingleExpectForActualOrNull
When compatibleOnly == false, the logic was equivalent to returning
singleOrNull.
The only call-site with compatibleOnly = true was FirElementSerializer,
but after the fix for KT-59613, the map will never contain multiple
entries when one of the entries is compatible.
Assuming that we only run serialization on green code, the map will
either contain one compatible entry or no entries which makes the
additional check redundant.
2023-07-05 08:51:01 +00:00
Dmitrii Gridin 43705d9a75 [FIR] drop redundant replace from wrapped expression
They were introduced for lazy

^KT-59687
2023-07-04 10:09:51 +00:00
Dmitrii Gridin f8b2b4ac21 [FIR] FirVariable: add replace method for delegate
It is required to properly implement lazy expression calculation

^KT-59687
2023-07-04 10:09:51 +00:00
Ivan Kylchik 8f88f08573 [FIR] Use correct source for implicit this receiver
#KT-57489 Fixed
#KT-56139 Fixed
#KT-56755 Fixed
2023-06-23 07:23:39 +00:00
aleksandrina-streltsova d439bdd49f Move ClassId for IntrinsicConstEvaluation to StandardClassIds
^KTIJ-19863
2023-06-22 12:33:52 +00:00
Dmitrii Gridin f74d4494aa [LL FIR] fix designation path for synthetic declarations
A designation path for synthetic declarations like fake override
or member delegate contained the wrong FirFile, because it
was provided by the original declaration that is wrong.
So we should pick up the file from our path, because it shouldn't be
synthetic

^KT-59505 Fixed
2023-06-22 10:22:37 +00:00
Kirill Rakhman 6318da0f02 [FIR] Remove or replace whole expressions in FIR diagnostic messages
FIR expressions rendered by FirRenderer don't look very nice in error
messages anyway, and additionally, they can become arbitrarily large,
so we shouldn't use them in messages.

#KT-59449 Fixed
2023-06-22 08:02:07 +00:00
Mikhail Glukhikh b92f1e2036 K2: de-prioritize access to Enum.entries properly #KT-57954 Fixed 2023-06-21 13:08:00 +00:00
Mikhail Glukhikh 978d52d05b K2: render additionally *s for static references
This commit allows to distinguish static VS non-static things
inside FIR_DUMP, e.g. static synthetic Enum.entries with
enum entry Enum.entries
2023-06-21 13:08:00 +00:00
Kirill Rakhman 6a073e0b17 [FIR] Fix duplicate spaces in FirPartialModifierRenderer 2023-06-21 08:36:46 +00:00
Kirill Rakhman ee91ee9403 [FIR] Set publishedApiEffectiveVisibility on deserialized declarations
#KT-58641 Fixed
2023-06-21 07:34:29 +00:00
Egor Kulikov b147b7e929 [FIR] Store fir for invalid when branches
^KTIJ-25646 fixed

Merge-request: KT-MR-10646
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
2023-06-20 16:11:31 +00:00
Mikhail Glukhikh 8983e3a218 K2: correctly set importedFromObjectOrStaticData for fields
#KT-59140 Fixed
#KT-58980 Fixed
2023-06-20 14:13:21 +00:00
Dmitrii Gridin 7631e90f12 [LL FIR, Java] fix resolve contract violation from java symbol provider from permits
To create a smart psi type pointer, IJ Platform uses resolve
We cannot use resolve from JavaSymbolProvider,
as it may lead to resolve contract violation

^KT-59243 Fixed
2023-06-14 09:25:26 +00:00
Mikhail Glukhikh 2a825f8df1 K2: implement FirClassAnySynthesizedMemberScope #KT-54844 Fixed 2023-06-14 07:09:15 +00:00
Ivan Kochurkin 1e09e8663c [FIR] Add compatibleOnly parameter to getSingleCompatibleExpectForActualOrNull
Rename `getSingleCompatibleExpectForActualOrNull` to `getSingleExpectForActualOrNull`
2023-06-13 10:12:44 +00:00
Dmitriy Novozhilov 6409bf2fe8 [FIR] Store expressions of receivers inside candidates instead of ReceiverValue
This is needed because of mutable nature of receiver values: implicit
  receiver values can be modified because of smartcasts, but in candidate
  we need to store snapshot of receiver in the form it was at the beginning
  of the resolution

^KT-58823 Fixed
2023-06-09 22:51:31 +00:00