Commit Graph

102800 Commits

Author SHA1 Message Date
Kirill Rakhman c605cb9855 [FIR2IR] Align object receiver generation with K1
#KT-59548 Fixed
2023-07-19 10:39:41 +00:00
Dmitrii Gridin 14327d51ed [LL FIR] invalidateAfterInBlockModification: do not treat adding of body as in-block modification
It is an out-of-block modification because some diagnostics depend
on a fact of a body's existence

^KT-60518
2023-07-19 10:32:10 +00:00
Dmitrii Gridin 5f24ad114c [LL FIR] AbstractInBlockModificationTest: add more tests
^KT-60518
2023-07-19 10:32:10 +00:00
Dmitrii Gridin f0d8a1cbe9 [LL FIR] AbstractInBlockModificationTest: cover getNonLocalReanalyzableContainingDeclaration
^KT-60518
2023-07-19 10:32:10 +00:00
Dmitrii Gridin c2fd245ca1 [LL FIR] getSelectedElement should return PsiElement
^KT-60518
2023-07-19 10:32:10 +00:00
Ivan Kochurkin 5f1e2764c3 [FIR] Fix some missing EXPECTED_DECLARATION_WITH_BODY 2023-07-19 10:14:08 +00:00
Ivan Kochurkin 8f4a580c17 [FIR] Report EXPECTED_CLASS_CONSTRUCTOR_DELEGATION_CALL
^KT-59069 Fixed
2023-07-19 10:14:08 +00:00
Vladimir Sukharev f7269eb384 [FIR2IR] Rework reordering condition to better handle synthetic class delegation fields
^KT-60243

Merge-request: KT-MR-11125
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-07-19 09:59:53 +00:00
Mikhail Glukhikh 66bbb9582c K1/K2: split incremental compilation tests properly (relates to KT-59171) 2023-07-19 09:34:58 +00:00
Yahor Berdnikau faa74d124f [Gradle] Fix kapt tests compatability with Gradle 8.0
^KT-59588 Fixed
2023-07-19 08:14:50 +00:00
Anastasiia Spaseeva 61a9dcd8e6 Disable space warmups
#Related KTI-1043
2023-07-19 07:43:20 +00:00
Bogdan Mukvich 3aee0ab994 Add SBOM for gradle plugins
^KTI-1299
2023-07-19 06:57:32 +00:00
Bogdan Mukvich b6e8937077 Use root document supplier field value for project modules in SBOM
KTI-1301
2023-07-19 06:55:19 +00:00
Mikhail Glukhikh 08222c83cf K1/K2: set language version explicitly in Native tests pipeline 2023-07-19 06:46:53 +00:00
Dmitrii Gridin 7620289f6f [FIR] fix contract violation from meta annotations
^KT-60448 Fixed
2023-07-18 16:50:25 +00:00
Dmitrii Gridin 480c794444 [FIR] drop redundant JavaTypeParameterStack usage from Java annotations
It is safe just to use `JavaTypeParameterStack.EMPTY`
as Java annotations are not expected to use containing type parameters

^KT-59342
2023-07-18 16:48:53 +00:00
Dmitrii Gridin 32ad4380b3 [FIR] make java annotation mapping lazily
to avoid contract violations from getDeprecation

^KT-59342 Fixed
^KT-60520
2023-07-18 16:48:53 +00:00
Ivan Kylchik 4f92e7c48c [IR] Rename IrTypeTransformerVoid to IrTypeTransformer
This naming is more consistent with already existing
`IrElementTransformerVoid` and `IrElementTransformer`
2023-07-18 15:42:11 +00:00
Artem Kobzar 41f27d19b5 [K/JS, K/Wasm] Generate star imports for external objects with the @JsModule annotation for ES modules 2023-07-18 15:36:19 +00:00
Alexander Korepanov e61a11f0a3 [JS FIR] Fix review comments 2023-07-18 14:02:30 +00:00
Alexander Korepanov 08d158f901 [JS FIR] Support JS module system FE diagnostics
Support CALL_TO_JS_MODULE_WITHOUT_MODULE_SYSTEM diagnostic
^KT-59377 Fixed

Support CALL_TO_JS_NON_MODULE_WITH_MODULE_SYSTEM diagnostic
^KT-59381 Fixed

Support CALL_FROM_UMD_MUST_BE_JS_MODULE_AND_JS_NON_MODULE diagnostic
^KT-59417 Fixed
2023-07-18 14:02:30 +00:00
Alexander Korepanov 30b012839c [JS FIR] FirJsModuleOnVarPropertyChecker.kt -> FirJsModuleChecker.kt 2023-07-18 14:02:30 +00:00
Alexander Korepanov 6034d32d7c [JS FIR] Support DYNAMIC_NOT_ALLOWED diagnostic
^KT-59384 Fixed
2023-07-18 14:02:30 +00:00
Alexander Korepanov 39fba56de9 [JS FIR] Support PROPERTY_DELEGATION_BY_DYNAMIC diagnostic
^KT-59406 Fixed
2023-07-18 14:02:30 +00:00
Alexander Korepanov f6b7a07efe [JS FIR] Support EXTERNAL_INTERFACE_AS_REIFIED_TYPE_ARGUMENT diagnostic
^KT-59416 Fixed
2023-07-18 14:02:30 +00:00
Alexander Korepanov 760320a11b [JS FIR] Move FirJsExternalArgumentCallChecker to expression checkers 2023-07-18 14:02:30 +00:00
Alexander Korepanov f1fc3f1cf5 [JS FIR] Move FirJsDynamicCallChecker to expression checkers 2023-07-18 14:02:30 +00:00
Dmitriy Novozhilov 45b1c33ed8 [FIR2IR] Make some utility functions inline
Those utilities are commonly used and effectively just call passed
  lambda with some preparations
2023-07-18 13:06:15 +00:00
Dmitriy Novozhilov ccb0d3cb0c [FIR2IR] Refactor signatures of Fir2IrConversionScope.withXxx functions
Usually functions like `withSomething` are considered to return the value
  of lambda which is passed to it, not one of its arguments
2023-07-18 13:06:15 +00:00
Dmitriy Novozhilov 0b502f08d5 [IR] Provide default implementations of symbol factories in SymbolTableExtension 2023-07-18 11:51:29 +00:00
Dmitriy Novozhilov c2f9961d4f [IR] Get rid of parameter name descriptor from methods of SymbolTableExtension 2023-07-18 11:51:29 +00:00
Ilya Kirillov 08400d930f [Analysis API, FIR] migrate ::class.java -> ::class inside error messages
They seem to provide similar results and the `.java` part is redundant
2023-07-18 11:49:21 +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 24f60a542d Add basic test for getElementTextWithContext 2023-07-18 11:49:21 +00:00
Ilya Kirillov 743662ec7f [FIR] remove user code leaks from compiler.fir.java module, add more information to some errors 2023-07-18 11:49:21 +00:00
Ilya Kirillov e6c8bf6644 [FIR] remove user code leaks from compiler.fir.providers module, add more information to some errors 2023-07-18 11:49:21 +00:00
Ilya Kirillov 9f847da13e [FIR] remove user code leaks from compiler.fir.raw-fir module, add more information to some errors 2023-07-18 11:49:21 +00:00
Ilya Kirillov d43057e19a [FIR] remove user code leaks from compiler.fir.resolve module, add more information to some errors 2023-07-18 11:49:21 +00:00
Ilya Kirillov df0662459b [FIR] remove user code leaks from compiler.fir.semantics module, add more information to some errors 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 c5014d4765 Move PsiElement.getElementTextWithContext to psi module with small adjustments
* replace existing function (the new one makes it more clear which element was printed)
* prints position for element
* handles invalid psi element
2023-07-18 11:49:20 +00:00
Ilya Kirillov 4b3bff3344 Rework checkWithAttachment/requireWithAttachment
* better naming
* throw corresponding KotlinIllegalStateExceptionWithAttachments/KotlinIllegalArgumentExceptionWithAttachments instead of general KotlinRuntimeExceptionWithAttachments
2023-07-18 11:49:20 +00:00
Ilya Kirillov 2d791eb292 Rename buildErrorWithAttachment -> errorWithAttachment to emphasise the similar semantics to kotlin.error 2023-07-18 11:49:20 +00:00
Ilya Kirillov e3c31e1387 Introduce exception-specific exception classes for KotlinExceptionWithAttachments 2023-07-18 11:49:20 +00:00
Ilya Kirillov 52c065b08a Extract a base class from KotlinExceptionWithAttachments 2023-07-18 11:49:20 +00:00
Ilya Kirillov 15f6fe2627 Move ExceptionAttachmentBuilder near KotlinExceptionWithAttachments so it's accessible from KotlinExceptionWithAttachments 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
Ilya Kirillov 6f429ec072 [Analysis] migrate ExceptionAttachmentBuilder to use SmartPrinter
So it can be moved to a compiler module
2023-07-18 11:49:20 +00:00
Alexander Udalov 1cb1420e43 JVM: push down implicit coercion to Unit in IR
This is basically a workaround for a slightly different IR generated by
fir2ir vs psi2ir. Simplified, psi2ir generates something like this for
the sample from KT-59218:

  TRY type=Unit
    try: BLOCK type=Unit
      VAR methodHandle [...]
      TYPE_OP type=Unit origin=IMPLICIT_COERCION_TO_UNIT
        CALL invokeExact [...]

While fir2ir generates the following:

  TYPE_OP type=Unit origin=IMPLICIT_COERCION_TO_UNIT
    TRY type=Any?
      try: BLOCK type=Any?
        VAR methodHandle [...]
        CALL invokeExact [...]

The lowering relies on the fact that a polymorphic call (`invokeExact`
in this case) is a direct argument to the TYPE_OP, to determine the
correct return type (Unit in this case) to be generated in the bytecode.

The solution here is to push the type coercion "through" all the
block-like structures (`try`, `when`, container expression) so that if
the last statement in the block is a polymorphic call, it gets properly
converted even if the whole block is under a type coercion operation, as
it happens in fir2ir. We achieve that by using the "data" parameter of
the IR transformer: appropriate immediate children of
IrTypeOperatorCall/IrTry/IrWhen/IrContainerExpression get the type that
the expression needs to be coerced to, and all the other expressions
ignore that type and set it to null when transforming their children.

A proper solution would be to ensure fir2ir generates exactly the same
IR as psi2ir (KT-59781), but since PolymorphicSignatureLowering is the
only lowering affected so far, and polymorphic calls occur very rarely,
it seems safe to workaround it in the lowering for now.

 #KT-59218 Fixed
2023-07-18 11:37:42 +00:00