Commit Graph

102861 Commits

Author SHA1 Message Date
Ivan Kochurkin b98dbf7b56 [FIR] Use singleOrNull instead of firstOrNull for WHEN_MISSING_CASES renderer 2023-07-20 11:04:18 +00:00
Ivan Kochurkin 529d5a1df2 [FIR] Add description to NO_ELSE_IN_WHEN and fill it for expect enum or sealed declarations 2023-07-20 11:04:18 +00:00
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
Mikhail Glukhikh 834bd1a71c K1/K2: split incremental JPS tests properly (relates to KT-59171) 2023-07-20 10:57:45 +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
Roman Golyshev b8052761db KT-60341 [Analysis API] Provide a type for a FirNameReference only when it refers to an actual property/variable
We cannot always return null, because in such case some expressions
would become not fully explorable from the types perspective (see
the documentation on the `getCorrespondingTypeIfPossible`)

`FirNamedReference` might appear when resolving method references (like
`foo::bar`), but also when IJ Platform tries to resolve other parts of
the Kotlin PSI, notably a `KtNameReferenceExpression` in a
function call (`bar` in `foo.bar(baz)` expression).

N.B. FE10 implementation does not support returning `null` as a type -
currently it always returns `Unit` type in case it cannot figure out
the actual type. This issue should probably be tackled together with
KT-60166, so that both implementations are more or less aligned

^KT-60341 Fixed
^KT-59077 Fixed
^KTIJ-25745 Fixed
2023-07-19 22:01:37 +00:00
Yahor Berdnikau 19a60d6b85 [Gradle] Fix kapt test with different JDK versions
This test was incorrect as it configured JVM toolchain to use JDK 1.8.
This configured JVM toolchain forced kapt tasks to always use JDK 1.8
even if the build itself was running on different JDK versions. Now test
uses different values for JVM toolchain which should correctly
configure kapt JDK.

^KT-59588
2023-07-19 18:58:53 +00:00
Yahor Berdnikau 63b0e900a9 [repo] Start using version catalog in the main build 2023-07-19 17:53:10 +00:00
Yahor Berdnikau 9294a74bf2 [repo] Fix 'prepare-deps' sub-project was not included in build 2023-07-19 17:53:10 +00:00
Yahor Berdnikau 45d8a8e56a [repo] Simplify buildsrc-compat/build.gradle.kts configuration
Use the Kotlin extension to configure toolchain and compiler options.
2023-07-19 17:53:10 +00:00
Yahor Berdnikau d743dc70ac [repo] Add version catalog for gradle-build-conventions included build 2023-07-19 17:53:10 +00:00
Yahor Berdnikau 67ea8b09e7 [repo] Migrate settings.gradle into settings.gradle.kts 2023-07-19 17:53:10 +00:00
Yahor Berdnikau 92baeefeaf [repo] Add version catalog for gradle-settings-convensions included build 2023-07-19 17:53:10 +00:00
Anton Lakotka 325d184419 [Gradle] Update documentation in KotlinTargetAlreadyDeclared
^KT-59316 Verification Pending
2023-07-19 16:38:37 +00:00
Anton Lakotka bb7e738b9e [Gradle] Remove TargetsNeedDisambiguation diagnostic
It is overlapping with KotlinTargetAlreadyDeclared which is stricter
and recommends users to migrate away from multiple target set up at all.

^KT-59316 Verification Pending
2023-07-19 16:38:37 +00:00
Anton Lakotka b08d12e477 [Gradle] Report KotlinTargetAlreadyDeclared from checker
Rephrase diagnostic message and add kotl.in link for details.

^KT-59316 Verification Pending
2023-07-19 16:38:37 +00:00
Anton Lakotka 0e34d0b01a [Gradle] Deprecate multiple same targets
Having multiple jvm, js and other targets in the same project
is now deprecated and will be forbidden in the future.

Users should migrate away from that by using custom compilations
or different projects.

^KT-59316 Verification Pending
2023-07-19 16:38:37 +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
Svyatoslav Scherbina f18c6755cc Native: fix runtime compilation against older glibc versions
Replace `#include <inttypes.h>` with `cinttypes`.
Improve other includes in the same file.

^KT-58864


Co-authored-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2023-07-19 14:41:51 +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
Yahor Berdnikau dc5660d98c [Gradle] Add 'validatePlugins' tasks for Gradle plugin dependencies
Gradle 8 has removed "validate-external-gradle-plugin" plugin which we
used before to run validate task inputs proper annotations.

With this change, every Gradle dependency that is not published as a
Gradle plugin but uses Gradle API types is also running
'validatedPlugins' task registered manually via a build script.

^KT-59827 Fixed
2023-07-19 13:36:03 +00:00
Yahor Berdnikau f5889bcc6c [Gradle] Update plugin variant used test 2023-07-19 13:36:03 +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