Commit Graph

44628 Commits

Author SHA1 Message Date
Ivan Kochurkin 8c39b2f71d [FIR] Report missing NO_ELSE_IN_WHEN for when statement with expect enums and sealed classes
^KT-59404 Fixed
2023-07-20 11:04:17 +00:00
Ivan Kochurkin d8ccf21894 [FIR] Fix false positive "suspension point is inside a critical section"
^KT-55072 Fixed
2023-07-20 10:38:59 +00:00
Ivan Kylchik 30c00f7983 [IR] Specify explicitly that classes from Java can be interpreted
In early prototypes of interpreter, it was easier to assume that
all classes from Java can be interpreted and fix something if not.
Check for Java declaration was done by checking that the package name is
starting with "java". But this is actually wrong and can lead to errors
when some code is declared in "java" something package, but is not from
Java stdlib.

#KT-60467 Fixed
2023-07-20 09:40:42 +00:00
Ivan Kochurkin 43c66ee0e5 [FIR] Fix arguments mapping for indexed set operator
Now processPositionArgument changes STATE as well as processNamedArgument

^KT-59386
2023-07-20 09:38:28 +00:00
Ivan Kochurkin 8f5294a508 [FIR] Consider explicit returns during computing return type of anonymous function
Introduce FirAnonymousFunctionReturnExpressionInfo

^KT-59386
2023-07-20 09:36:55 +00:00
Sergej Jaskiewicz 212c10e674 [IR] Restore source compatibility for IrFactory methods
Previous commits:
c2fde1a915,
0b7db067e6,
0ae95b39c3,
f46761a241,
b1f7b5e982,
2b4a08524d,
5b8b3644fc,
7b77ec9930,
30cd2c3025,
9fcdc10019

have reordered parameters in IrFactory methods.

Restore and deprecate the original methods to
preserve source compatibility for compiler plugins.

KTIJ-26314
^KT-59772 Fixed
2023-07-20 09:36:05 +00:00
Ivan Kylchik 7fd601b336 [JVM_IR] Unify code between fake variables lowerings
#KT-58778 Fixed
2023-07-20 09:01:43 +00:00
Ivan Kylchik 1dec9fc675 [JVM_IR] Move methods that generate LN into LineNumberMapper class 2023-07-20 09:01:43 +00:00
Ivan Kylchik b10f6907a7 [JVM_IR] Slightly rewrite SwitchGenerator to improve readability 2023-07-20 09:01:42 +00:00
Ivan Kylchik ecd20b1348 [JVM_IR] Properly handle inlined local var located in regenerated object
#KT-58778
2023-07-20 09:01:42 +00:00
Ivan Kylchik 17e49fce75 [JVM_IR] Support basic fake var generation for IR inliner
#KT-58778
2023-07-20 09:01:42 +00:00
Ivan Kylchik 5a09ca6908 [JVM] Slightly rewrite inliner code to understand it more easily 2023-07-20 09:01:42 +00:00
Ivan Kylchik 286090a1db [IR] Drop inlinePureArguments parameter from FunctionInlining
Replaced its usages with `alwaysCreateTemporaryVariablesForArguments`
2023-07-20 09:01:42 +00:00
Ivan Kylchik 2ecbb21a9f [IR] Add new tests on inline to check issues with type parameters
#KT-58241
2023-07-20 09:01:42 +00:00
Kirill Rakhman 95005dae8a [FIR PSI] Set source of equality operator call
#KT-55835
2023-07-20 07:29:19 +00:00
Kirill Rakhman 9e9b92fd16 [FIR PSI] Set source of error reference
#KT-55835
2023-07-20 07:29:18 +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 9288a96f6d [FIR] Assert source is not-null when reporting cone diagnostics
#KT-55835
#KT-59856
2023-07-20 07:29:18 +00:00
Kirill Rakhman 2f3293f99e [FIR] Skip redundant INAPPLICABLE_CANDIDATE on call with unresolved callable reference argument
A new resolution diagnostic UnsuccessfulCallableReferenceAtom is
introduced that is used in EagerResolveOfCallableReferences.
No diagnostic is reported on unresolved calls with this diagnostic
because

#KT-59856
2023-07-20 07:29:18 +00:00
Kirill Rakhman a55f3c5583 [FIR LT] Set source on FirExplicitSuperReference
#KT-55835
2023-07-20 07:29:18 +00:00
Kirill Rakhman ccab42cd2a [FIR LT] Set source on FirExplicitThisReference
#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 311975f1ed [FIR] Set source on return expression in generated getters
#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
Artem Kobzar 044c0adae7 [K/JS] Implement an incremental compilation for the per-file granularity 2023-07-19 15:57:56 +00:00
Pavel Mikhailovskii fd07f7f43c [FIR] KT-60427 Don't generate outerType attributes for non-inner classes in FirElementSerializer 2023-07-19 15:27:03 +00:00
Ivan Kylchik ca8db7d0b8 [IR] Move toIrConst method into common IrUtils file
This method is used not only in IR interpreter, so it makes sense to
move it.
2023-07-19 15:12:54 +00:00
Artem Kobzar e4bdd3560c [K/JS] Change order of exported properties definition for non ES-classes compilation ^KT-60131 Fixed 2023-07-19 14:33:19 +00:00
Kirill Rakhman 63374e870d [Tests] Specify ticket number in test mute reason
#KT-60136
2023-07-19 13:34:58 +00:00
Kirill Rakhman 97024d9ccb [FIR] Resolve array literal argument for non-primitive-array parameter as arrayOf call in annotation calls
This allows us to properly complete array literals arguments of
annotation calls fixing several false-negative type mismatch errors
as well as enabling the inference of generic type arguments.

#KT-59581 Fixed
#KT-58883 Fixed
2023-07-19 13:34:58 +00:00
Kirill Rakhman e69b695efd [FIR] Introduce common super type for context dependent resolution modes 2023-07-19 13:34:58 +00:00
Kirill Rakhman ff6b3350ae [FIR] Resolve array literal with non-primitive-array expected type as arrayOf call
This lets us properly complete the call which fixes some issues with
false-positive type mismatches.
This change doesn't apply to array literals in annotation calls yet
because they are resolved as context-dependent.
This will be adapted in a following commit.

#KT-59581
2023-07-19 13:34:58 +00:00
Marco Pennekamp 4ead02271b [FIR] Move TrackableModuleInfo to the common frontend
- FIR-specific parts of the Kotlin IntelliJ plugin depend on
  `TrackableModuleInfo`, so it should be part of the common frontend.
2023-07-19 13:03:51 +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
Kirill Rakhman 987867fe12 [FIR2IR] Fix crash caused by unresolved annotation argument in deserialized class
#KT-60181 Fixed
2023-07-19 11:07:11 +00:00
Artem Kobzar b1884456b8 [K/JS] Fix initialization issue for objects which annotated with @JsExport and contain nested classes
Merge-request: KT-MR-11146
Merged-by: Artem Kobzar <Artem.Kobzar@jetbrains.com>
2023-07-19 10:41:25 +00:00
Dmitrii Gridin 4366164b65 [FIR] ConeAttributes: fix plus method
The 'plus' method was actually creating a new 'ConeAttributes' with
only one new attribute due to a typo inside 'buildList'

^KT-60451
^KT-60504
2023-07-19 10:40:03 +00:00
Kirill Rakhman c605cb9855 [FIR2IR] Align object receiver generation with K1
#KT-59548 Fixed
2023-07-19 10:39:41 +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
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