Commit Graph

102837 Commits

Author SHA1 Message Date
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
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
Roman Golyshev 5e30adec06 KTIJ-26276 [Analysis API] Do not consider single aliased import from the same package as unused
Even when the aliased import comes from the same package, it cannot be
removed, because it will break the code

Also, add more tests for the imports coming from the same package

^KTIJ-26276 Fixed
2023-07-19 12:40:57 +00:00
Dmitriy Novozhilov 8acf6b1bd0 Advance bootstrap to 1.9.20-dev-6963 2023-07-19 12:16:31 +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
Dmitrii Gridin b59e66c217 [LL FIR] add test on annotation type copy
^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
Artem Kobzar 69c8942462 [K/JS] Remove trivial JS constructors from JS AST 2023-07-19 10:41:04 +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
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