Commit Graph

100481 Commits

Author SHA1 Message Date
Dmitrii Krasnov c3bfe72394 migrated CInteropIdeaSyncIT to junit5 and gradle TestKit
#KT-51553

Co-authored-by: Alexander Likhachev <me@alikhachev.com>

Merge-request: KT-MR-9599
Merged-by: Dmitrii Krasnov <Dmitrii.Krasnov@jetbrains.com>
2023-04-20 09:48:20 +00:00
Pavel Mikhailovskii 58143a2006 KT-57598 Run Kapt with K1 even when the compiler is run with K2 2023-04-20 09:30:38 +00:00
Dmitriy Novozhilov cb4c41a5ca [Gradle IT] Pass gradle version directly to tests in K2KotlinxSerializationIT 2023-04-20 09:27:08 +00:00
Dmitriy Novozhilov 37e4a05878 [FIR] Serialize generated classes into Klib metadata
^KT-57781 Fixed
2023-04-20 09:27:08 +00:00
Dmitriy Novozhilov 0f8c797d7c [FIR] Introduce caching service for metadata declarations provided by extensions
This is needed to allow to call for provided declarations multiple times
  with only one real invocation of plugins
2023-04-20 09:27:07 +00:00
Dmitriy Novozhilov fb1cdf643b [FIR] Load kotlin.arrayOf function in IrBuiltInsOverFir from Fir
^KT-57690 Fixed
^KT-57807 Fixed
2023-04-20 09:27:07 +00:00
Kirill Rakhman 6972391185 [FE] Make dynamic a suitable resulted type
This fixes a FIR-specific issue where a type variable is inferred to
Any instead of dynamic. K1 wasn't affected because of a FIR-specific
condition in ResultTypeResolver.

#KT-57962 Fixed
2023-04-20 08:45:42 +00:00
Filipp Zhinkin 50841e7cb0 KT-42589 Add listOf, setOf, mapOf overloads for a single value to common src-set
`listOf`, `setOf` and `mapOf` overloads were defined in some source-sets
but common source-set was missing it.
This change adds common definition of these methods and also add
declarations for source-sets that were previously
missing it.

^KT-42589 fixed
2023-04-20 08:42:15 +00:00
Pavel Punegov aa85e6d95c [K2/N] Disable special backend checkers due to the ^KT-58099
Several interop tests fail with error:
"type kotlin.String? is not supported here: doesn't correspond to any C type"

Merge-request: KT-MR-9690
Merged-by: Pavel Punegov <Pavel.Punegov@jetbrains.com>
2023-04-20 08:41:36 +00:00
Ivan Kylchik 2e836494f5 Rewrite primitives' generation using simple DSL 2023-04-20 08:18:58 +00:00
Ivan Kylchik dd0267f4ad [WASM] Mark necessary methods that must be evaluated at compile-time
It includes methods and properties from Boolean, Char, String,
Enum and KCallable.
2023-04-20 08:18:58 +00:00
Ivan Kylchik 695229e288 [JS] Mark necessary methods that must be evaluated at compile-time
It includes methods and properties from Boolean, Char, String,
Enum and KCallable.
2023-04-20 08:18:57 +00:00
Ivan Kylchik fcd3fe4fe3 [Native] Mark necessary methods that must be evaluated at compile-time
It includes methods and properties from Boolean, Char, String,
Enum and KCallable.
2023-04-20 08:18:57 +00:00
Ivan Kylchik 07ca981632 Unify generation of Primitives files for all backends 2023-04-20 08:18:57 +00:00
Kirill Rakhman e80b4c530d [FIR2IR] Properly handle intersection types in interface delegation
The changes to the irText test data result in the fact that we
now unconditionally unwrap substitution overrides of delegation targets
whereas before we built an unsubstituted scope of the type we delegate
to. If we delegate to a class A : B<C>, the unsubstituted scope of
A can still contain substitution overrides for inherited generic methods
from B<T> that we didn't unwrap before but do unwrap now.

#KT-57899 Fixed
2023-04-20 08:12:55 +00:00
Kirill Rakhman cda7dc4a3a [FIR2IR] Remove redundant ConversionTypeContext.inSetter() 2023-04-20 08:12:50 +00:00
Kirill Rakhman f08da86cfd [FIR] Improve comment for ConeIntersectionType 2023-04-20 08:12:49 +00:00
Kirill Rakhman 35c6da1aa7 [FIR2IR] Fix and refactor generation of dynamic call receiver generation
#KT-57988 Fixed
2023-04-20 08:04:07 +00:00
Kirill Rakhman 8b47a4fa48 [FIR] Fix resolution of objects in presence of low-priority candidates
For CallKind.VariableAccess, the condition when to *skip* resolution of
objects was previously collector.isSuccess. This wasn't strict enough
because collector.isSuccess could be true when the best found candidate
has an applicability like RESOLVED_WITH_LOW_PRIORITY (e.g. from dynamic
scope or annotated with @LowPriorityInOverloadResolution). In these
cases, we do want to resolve objects. To fix this, the condition is
changed to collector.shouldStopResolve which is stricter.

#KT-57960 Fixed
2023-04-20 08:04:07 +00:00
Alexander Udalov bc7aea1426 Kapt+JVM_IR: generate delegated members correctly
Generate a declaration for each delegated member without body. If we
don't generate delegated declarations, subclasses will have incorrect IR
with unbound symbols in fake overrides.

 #KT-58027 Fixed
2023-04-19 23:04:45 +00:00
Abduqodiri Qurbonzoda 5407ac1c72 [K/N] Mark UnhandledExceptionHook-related API with ExperimentalNativeApi
Instead of ExperimentalStdlibApi

As a part of efforts to stabilize Native stdlib #KT-55765.
2023-04-19 20:36:31 +00:00
Abduqodiri Qurbonzoda da0cc2ea4d [K/N] Deprecate Char.MIN_RADIX and MAX_RADIX constants
As a part of efforts to stabilize Native stdlib.
2023-04-19 20:33:33 +00:00
Abduqodiri Qurbonzoda b25f3be81b [K/N] Experimental Char code point constants and functions
Internalize WASM Char code point functions.

As a part of efforts to stabilize Native stdlib.
2023-04-19 20:33:33 +00:00
Abduqodiri Qurbonzoda c6eaadb44f [WASM] Internalize MutableList.replaceAll function
It will be introduced later in Common: KT-57152.
2023-04-19 20:32:56 +00:00
Abduqodiri Qurbonzoda 954e11c265 [K/N] Mark MutableList.replaceAll with ExperimentalNativeApi
As a part of efforts to stabilize Native stdlib #KT-55765.
2023-04-19 20:32:55 +00:00
Abduqodiri Qurbonzoda 040fcee04e [K/JS] Loosen StringBuilder.capacity() deprecation level to WARNING 2023-04-19 20:20:43 +00:00
Abduqodiri Qurbonzoda e20b1239fe [K/N] Remove Char.isIdentifierIgnorable() function
As a part of efforts to stabilize K/N stdlib.
2023-04-19 20:20:43 +00:00
Abduqodiri Qurbonzoda 88181404df [K/N] Remove deprecation from StringBuilder.capacity() function
As a part of efforts to stabilize K/N stdlib.
2023-04-19 20:20:43 +00:00
Abduqodiri Qurbonzoda 208b279d2b [K/N] Internalize CharCategory.value/valueOf
As a part of efforts to stabilize K/N stdlib.
2023-04-19 20:20:42 +00:00
Abduqodiri Qurbonzoda 7eba68e62b [K/N] Commonize String.regionMatches function
As a part of efforts to stabilize K/N stdlib.
2023-04-19 20:20:42 +00:00
Abduqodiri Qurbonzoda 0d31b0d12c [K/N] Internalize RegexOption.value/mask properties
As a part of efforts to stabilize K/N stdlib.
2023-04-19 20:20:42 +00:00
Abduqodiri Qurbonzoda 3a4a00ef84 [K/N] Fix MatchGroup.range documentation
As a part of efforts to stabilize K/N stdlib.
2023-04-19 20:20:41 +00:00
Dmitrii Gridin 2463b904f7 [LL FIR] add ability to suppress contract violation exception
^KT-56543
2023-04-19 20:12:43 +00:00
Dmitrii Gridin 8387ea8a39 [LL FIR] FileStructure: process annotations from constructors correctly
^KT-56543
2023-04-19 20:12:43 +00:00
Dmitrii Gridin 71f48ede53 [LL FIR] resolve compiler required annotations correctly
Original AbstractFirSpecificAnnotationResolveTransformer can jump
to other classes and resolve them outside
our transformers, so it leads to
problems with locks and lazy bodies

^KT-56543
2023-04-19 20:12:42 +00:00
Dmitrii Gridin 22b5d940f1 [FIR] move lazy expression assertions to more common class
^KT-56543
2023-04-19 20:12:42 +00:00
Dmitrii Gridin efdae98ba8 [FIR] SignatureEnhancement: reduce access to initializer field
It can trigger lazy calculation of FirJavaField initializer

^KT-56543
2023-04-19 20:12:41 +00:00
Dmitrii Gridin 6170d83301 [FIR] update reversed testData
^KT-56543
2023-04-19 20:12:41 +00:00
Dmitrii Gridin 1c5aa6c45b [FIR] add reversed testData to update it in the next commit
^KT-56543
2023-04-19 20:12:41 +00:00
Ilya Kirillov cc52e896f9 [FIR] ensure that status is resolved when we create fake overrides
We should create the fake override only when we
already have resolved status.

Otherwise, the fake override declaration will be created
with unresolved status, and its status will never be computed
as we do not resolve fake override declarations.

^KT-56543
2023-04-19 20:12:40 +00:00
Dmitrii Gridin 7c8f7bdbfb [FIR] FirDelegatedMemberScope: add missing resolve
^KT-56543
2023-04-19 20:12:40 +00:00
Dmitrii Gridin 26f8147a8c [LL FIR] FileStructure: process super class calls correctly
^KT-56543
^KT-57793
2023-04-19 20:12:39 +00:00
Dmitrii Gridin d0e801054c [FIR] builder: add test on class with wrong super call
^KT-56543
^KT-57793
2023-04-19 20:12:39 +00:00
Dmitrii Gridin 332cdc514b [LL FIR] reanalyse declarations on the air for incremental analysis
We cannot do it inplace now as we do not have a lock to do
it under after analysis started to use declaration-level lock

This part is mostly covered by the plugin tests
(which failed after the previous commit)

^KT-56543
2023-04-19 20:12:39 +00:00
Dmitrii Gridin 72def186a3 [LL FIR] rework transformers, so transformers resolve only a specific set of declarations
The change is needed for the parallel resolution (^KT-55750), so we can resolve the declaration
under a lock that is specific to this declaration.
Previously, if LL FIR was resolving some FirClass, LL FIR  resolved all its children too, and it had no control over what parts of the FIR tree were modified.
The same applied to the designation path, sometimes the classes on the designation path
might be unexpectedly (and without lock) modified.

This commit introduces LLFirResolveTarget, which specifies which exact declarations should be resolved during the lazy resolution of the declaration.
All elements outside the declarations specified for resolve in LLFirResolveTarget, should not be modified.

The logic of lazy transformers is the following:
- Go to target declaration collecting all scopes from the file and containing classes
- Resolve only declarations that are specified by the LLFirResolveTarget, performing the resolve under a separate lock for each declaration

^KT-56543
^KT-57619 Fixed
2023-04-19 20:12:38 +00:00
Dmitrii Gridin 18a8cfb090 [AA FIR] firSymbolUtils: avoid redundant resolve
^KT-56543
2023-04-19 20:12:36 +00:00
Dmitrii Gridin 093695962a [FIR] hacky fix lazy resolve contract violation for deprecation of enum entries
Enum entries can be used as types in Kotlin (even it's a compilation error)
To use the classifier as a type, we need to find if it's hidden or not.
The deprecations for classes are calculated on COMPILER_REQUIRED_ANNOTATION phase, and that's okay as it goes before the TYPES phase.
For enum entries, the deprecations are calculated on TYPES phase which goes on TYPES phase.
This is incorrect as we cannot jump from lower phase to upper phase

The hack ignores such deprecation search for enum entires.

Test: org.jetbrains.kotlin.analysis.low.level.api.fir.diagnostic.compiler.based.LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.Tests.testEnumEntryAsType

^KT-57648
^KT-56543
2023-04-19 20:12:36 +00:00
Dmitrii Gridin 7e380e7df5 [LL FIR] remove LLFirPhaseRunner as it does nothing
^KT-56543
2023-04-19 20:12:36 +00:00
Dmitrii Gridin 72fce82f2f [LL FIR] remove useless checks for resolve phases inside transformers
Those checks are not performed during locking

^KT-56543
2023-04-19 20:12:35 +00:00
Dmitrii Gridin 0f379e592a [LL FIR] make LLFirLazyTransformerExecutor an object
^KT-56543
2023-04-19 20:12:35 +00:00