Commit Graph

107590 Commits

Author SHA1 Message Date
Dmitrii Gridin 5c71015b09 [LC] implement isRecord for classes
Java world should better understand our classes with JvmRecord annotation

^KT-62357
2024-01-04 16:32:10 +00:00
Dmitrii Gridin b463f1fdfa [SLC] unmute tests on JvmRecord
^KT-62357
2024-01-04 16:32:10 +00:00
Ivan Kochurkin 69b9bfc3e0 [FIR] Initialize public visibility for class-like declarations at FIR building phase if no modifier is presented
Java resolving subsystem requires calculated visibility for correct disambiguation of supertypes.
But visibility remains `Unknown` for Kotlin class-like declarations during supertypes resolving because `STATUS` resolve phase is performed after `SUPER_TYPES` phase.
To fix the problem, the visibility should be initialized to public at the FIR building phase if no modifier is presented.

^KT-64127 Fixed
2024-01-04 16:17:32 +00:00
Alexander Udalov ee8d42532b Fir2Ir, JVM IR: support flexible Array types loaded from Java
We don't have true flexible types in the IR, but we approximate it with
internal type annotations, such as FlexibleNullability,
FlexibleMutability, RawType. These annotations are then handled
specially in JvmIrTypeSystemContext, which can construct a fake flexible
type so that type checker on IR types would behave exactly as on
frontend types.

As shown in KT-63441, one instance of flexible types where flexibility
was lost during conversion to IR is Java array/vararg types. It's
necessary to support it so that IR fake overrides could be constructed
correctly, because IR fake override checker requires parameter types to
be equal. So this change introduces another internal type annotation,
FlexibleArrayElementVariance, which is only applicable to types with
classifier kotlin/Array, and which signifies that the annotated type
`Array<X>` should rather be seen as `Array<X>..Array<out X>`.

 #KT-63441 Fixed
 #KT-63446 Fixed
2024-01-04 15:54:27 +00:00
Alexander Udalov e98902ce74 Fir2Ir, JVM IR: minor, deduplicate constants for ClassId of special annotations 2024-01-04 15:54:26 +00:00
Dmitrii Gridin 3fcf5c47c2 [resolution] KotlinJavaPsiFacade: replace explicit EMPTY_SCOPE check with more general
Someone can request search for `LocalSearchScope.EMPTY` and we can
catch this case

^KT-62892
2024-01-04 15:20:38 +00:00
Dmitrii Gridin 37ccf5d4f3 [resolution] KotlinJavaPsiFacade: do not return classes with wrong ClassId
We shouldn't return from `findClass`/`findClasses` Java classes with
`ClassId` different from the requested one

^KT-62892
2024-01-04 15:20:38 +00:00
Dmitrii Gridin c6004874c1 [SLC] generate light classes for functions with JvmName and value class as parameter
Such functions/accessors have not-mangled names, so they can be called
from Java

^KT-63087 Fixed
2024-01-04 15:16:20 +00:00
Dmitrii Gridin e0f524b6b3 [LC] add tests on declarations with JvmName and value classes
^KT-63087
2024-01-04 15:16:20 +00:00
Brian Norman aae8cd2a7c [FIR] Local variable assignment must be propagated before loops
When performing lookahead for local variable assignments, make sure
assignments taking place within loops are being propagated before loops.
This makes sure smartcasts within non-inline declarations before the
loop are disallowed.

^KT-63867 Fixed
2024-01-04 14:20:21 +00:00
Kirill Rakhman 10d6d95ee8 [Tests] Add regression test for #KT-64702 2024-01-04 14:12:42 +00:00
Nikolay Lunyak 533ed5c622 [FIR] Unwrap typealias-bounds in FirTypeParameterBoundsChecker
This change makes sure the test introduced
in the previous commit doesn't crash
the compiler.

^KT-64644 Fixed
2024-01-04 14:08:43 +00:00
Nikolay Lunyak 7c3042772e [FIR] Reproduce KT-64644
Ensure the given code crashes the
compiler.

^KT-64644
2024-01-04 14:08:43 +00:00
Igor Chevdar aaf34c3436 [IR] Fixed a bug with local classes extraction from lambdas
#KT-64508 Fixed
2024-01-04 11:15:18 +00:00
Igor Chevdar 54328a1db4 [K/N][tests] Added a reproducer for #KT-64508 2024-01-04 11:15:18 +00:00
Kirill Rakhman 7fb5cbd1f8 [FIR] Implement UNNECESSARY_NOT_NULL_ASSERTION checker for java warning level types 2024-01-04 09:59:50 +00:00
Kirill Rakhman d6bd31b313 [FIR] Implement UNNECESSARY_SAFE_CALL checker for java warning level types
#KT-63528 Fixed
2024-01-04 09:59:50 +00:00
Nikolay Lunyak 9c0ac27307 [FIR] Don't miss annotations on properties from primary constructors
^KT-64609 Fixed
2024-01-04 09:45:27 +00:00
Nikolay Lunyak 1f46aed3e0 [FIR] Reproduce KT-64609
^KT-64609
2024-01-04 09:45:27 +00:00
Dmitrii Gridin af5f76048b [SLC] AbstractSymbolLightClassesByPsiTest: add more stable order
Now more diff between sources and libraries are readable.
Also prefer .descriptors to .fir as FIR is a first-class support

^KT-62892
2024-01-03 21:35:12 +00:00
Dmitrii Gridin d64f18eaa9 [SLC] AbstractSymbolLightClassesStructureTestBase: add stable order
Now more diff between sources and libraries are readable

^KT-62892
2024-01-03 21:35:12 +00:00
Dmitrii Gridin 2bad2f37ce [LL FIR] add missed ClassId check for combined Java classes symbol provider
findClasses works over regular `PsiElementFinder`, which doesn't know
about out ClassId conception. So, `a/b/A.B` and `a/b/A/B` are the same
from `FqName` point of view.
`FirJavaFacade` has this check, so this problem appears only in the case
of combined provider.

^KT-62892 Fixed
2024-01-03 21:35:12 +00:00
Dmitrii Gridin a39688ba10 [LL FIR] add tests on fir for full qualified name for nested classes
For some reason, outer Java class is treated as a package

^KT-62892
2024-01-03 21:35:12 +00:00
Dmitrii Gridin 4cb75490db [LL FIR] AbstractLowLevelApiLastModuleFirstFileTest: replace moduleStructure with testModule
We can get the module structure from `TestServices`,
so current file is more preferable

^KT-62892
2024-01-03 21:35:12 +00:00
Dmitrii Gridin 7efbcad121 [Analysis API] add diagnostic tests for inner Java class usage
^KT-62892
2024-01-03 21:35:12 +00:00
Dmitrii Gridin 6c7d1babf0 [Analysis API] support Java compilation in tests
Previously we just skipped Java sources.
The order of classes in light classes test data is changed due to
differences in implementations of `compileLibraryToJar` and `runJvmCompiler`

^KT-62892
2024-01-03 21:35:12 +00:00
Alexander Udalov a9f85d75f4 Kapt: remove support for old JVM backend
#KT-64680 Fixed
2024-01-03 19:37:40 +00:00
Alexander Udalov c251eb19a6 Kapt: remove old JVM backend test data (2/2)
In this commit, .ir.txt expectation test data files for the JVM IR
backend are renamed to .txt. This is done as two separate commits so
that Git would recognize that these files were logically moved, not that
the contents of the original .txt files were changed.

 #KT-64680
2024-01-03 19:37:40 +00:00
Alexander Udalov 9c67616b25 Kapt: remove old JVM backend test data (1/2)
In this commit, .txt expectation test data files for the old JVM backend
are deleted.

 #KT-64680
2024-01-03 19:37:40 +00:00
Alexander Udalov e4a608c6e7 Kapt: remove tests on old JVM backend
#KT-64680
2024-01-03 19:37:40 +00:00
Alexander Shabalin eea89c7f23 [K/N] Enable safepoint signposts by default ^KT-62689 2024-01-03 18:30:59 +00:00
Kirill Rakhman 1018ff280e [FIR] Fully expand the bounds of type parameters for canBeNull check
This is required because a not-null bound `Foo` can resolve to a
`typealias Foo = Bar?` in which case we must return true.

#KT-64645 Fixed
2024-01-03 17:15:50 +00:00
Nikita Nazarov 438b2dd164 [K2, MPP] Actualize value class representation
^KT-63638 fixed
2024-01-03 16:39:56 +00:00
Dmitriy Novozhilov 0bd6ea764e [FIR] Consider only normal execution path during contracts verification
There might be several pathes out from the function from CFG point of view:
- normal execution path
- exceptional execution path

For verification of callsInPlace contract it's needed to check only
 the normal path

^KT-63414 Fixed
2024-01-03 14:18:46 +00:00
Dmitriy Novozhilov de9826683e [FIR] Unwrap named arguments during contracts verification
^KT-64501 Fixed
2024-01-03 14:18:46 +00:00
Dmitriy Novozhilov 6031f80e01 [Test] Reproduce KT-63414, KT-64500 and KT-64501 2024-01-03 14:18:46 +00:00
Brian Norman 3346cc4b19 [FIR] Lambdas without contracts should be considered repeatable
^KT-63777 Fixed
2024-01-03 14:08:04 +00:00
Dmitrii Gridin 8a3f850bca [LL FIR] StubBasedFirMemberDeserializer: deserialized properties must have default getter/setter
In FIR we always have either real getter/setter or the default one

^KT-62888 Fixed
^KT-62651 Fixed
2024-01-03 13:39:42 +00:00
Dmitrii Gridin db2849dc0d [Analysis API] add run configuration for standalone tests
^KT-62888
^KT-62651
2024-01-03 13:39:42 +00:00
Dmitrii Gridin 8de9d42b0d [Analysis API] use createSearchScopeByLibraryRoots for test libraries
As it is more similar to production. Also, fixed scope search for klib.
Now we register main binary modules before to avoid duplication with
libraries from createLibrariesByCompilerConfigurators as now we can
have a declared library and regular sources

^KT-62888
^KT-62651
2024-01-03 13:39:42 +00:00
Dmitrii Gridin 02d99769ff [Analysis API] Use library name in result jar
^KT-62888
^KT-62651
2024-01-03 13:39:41 +00:00
Dmitrii Gridin a341dc704f [Analysis API] Add symbol tests for properties from libraries
^KT-62888
^KT-62651
2024-01-03 13:39:41 +00:00
Dmitrii Gridin faf33e4fa4 [Analysis API] add diagnostic test of type inference from getValue delegate
^KT-62888
2024-01-03 13:39:41 +00:00
Yahor Berdnikau 3eb86ede96 [Gradle] Fix warnings in KotlinBaseApiPlugin
^KT-56904 In Progress
2024-01-03 12:40:39 +00:00
Dmitriy Novozhilov 3a5e4d3b45 Advance bootstrap to 2.0.0-dev-11567 2024-01-03 12:12:58 +00:00
Evgenii Mazhukin 0c647d6fec [Tests] Double-check the Native incremental builds in Gradle IT
Couldn't reproduce the issue in tests or with the reproducer. Most likely the problem was on my side.

^KT-63970 Can't Reproduce


Merge-request: KT-MR-13673
Merged-by: Evgenii Mazhukin <evgenii.mazhukin@jetbrains.com>
2024-01-03 12:08:04 +00:00
Kirill Rakhman fd12f24725 [FIR] Only let supertypes of ILTs include Number when it's not unsigned
#KT-64607 Fixed
2024-01-03 12:05:18 +00:00
Artem Kobzar 81d6615915 [K/Wasm] Add ownership for stepping tests and source-maps 2024-01-03 10:55:39 +00:00
Andrey Yastrebov c6bf5b8ef1 KT-63592 Add testGenerateLLDBInitFile test 2024-01-03 10:29:18 +00:00
Andrey Yastrebov 4176c50107 KT-63592 Create setupLLDBScript task 2024-01-03 10:29:18 +00:00