Commit Graph

101872 Commits

Author SHA1 Message Date
Anton Lakotka acf8f5b26b [Gradle] Include android source sets to source set depends on checker
Excluding android source sets can actually bring unexpected behaviour
when, for example, androidInstrumentedTest get depends on commonMain.
In this case "nativeMain" will be reported as checked skipped android
source sets, but they are still present in dependsOn edges.

Another important aspect is that mpp+android is a majority and their
cases should be checked as well

^KT-47144 Verification Pending
2023-06-16 12:11:38 +00:00
Anton Lakotka a4705050b1 [Gradle] Improve KotlinSourceSetTreeDependsOnMismatch heuristic
Introduce "White Crow" heuristic that will report incorrect dependency
edge when there is only one source set with different Source Set Tree.

Otherwise, report all source sets from all Source Set Tree groups
to user to choose which of them are incorrect.

And cover with more tests.

^KT-47144 Verification Pending
2023-06-16 12:11:38 +00:00
Anton Lakotka 681305c8e9 [Gradle] Add KotlinSourceSetTreeDependsOnMismatch diagnostic
In Kotlin Multiplatform it is not possible to have
source set dependencies between two different SourceSet Trees.

For example commonTest can't dependOn commonMain as SourceSet dependency
instead binaries of commonMain should be included as dependency to
commonTest. Which is implemented through different mechanisms

^KT-47144 Verification Pending
2023-06-16 12:11:38 +00:00
Vladimir Sukharev 05e22e56d3 [K/N] Mark rest of reflection related tests as jvm-only
^KT-59057

Merge-request: KT-MR-10570
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-06-16 11:50:03 +00:00
Brian Norman 269dfc61c8 [FIR] Display actual type for argument type mismatch error
Previously the argument type was being used for the actual type error
display. However, safe-call arguments are unwrapped which causes
nullable types to be displayed as non-null. Change to use the actual
type provided by the diagnostic instead of extracting the type from
the argument.

#KT-58844 Fixed
2023-06-16 11:44:14 +00:00
Pavel Kirpichenkov a7ff0cfc9d Remove deprecated CInteropSettings#getDependencyConfigurationName
KT-55908
2023-06-16 11:00:42 +00:00
Sergej Jaskiewicz fd094835a4 [test] Add the NATIVE backend to non-JVM check blocks in signature tests
(see KT-59204)
2023-06-16 10:01:54 +00:00
Sergej Jaskiewicz 6064012efa [test] Print NATIVE for newly generated check blocks in signature tests
Since we know that in most cases signatures for JS and NATIVE are
the same, when running a signature test for the first time, let's print
`// CHECK JS NATIVE:` instead of `// CHECK JS:` or `// CHECK NATIVE:`.

^KT-59204 Fixed
2023-06-16 10:01:54 +00:00
Anna Kozlova 09f4f0af66 [AA] delegate to resolveToFirSymbol to avoid decompilation
`getReturnTypeForKtDeclaration` is called by UAST on probably compiled declarations.
In order to avoid redundant decompilation + building raw FIR + resolve,
let's delegate to deserialized FIR which is already prepared in stubs

Fixes KTIJ-24810

When `findSourceNonLocalFirDeclaration` is called on non-physical property accessor e.g.,
during completion, then traverse tree should allow drilling into FirProperty;
otherwise, no FIR would be found
2023-06-16 09:00:09 +00:00
Pavel Mikhailovskii 16644c1a3b FIR Preserve nullability of ConeErrorType when possible 2023-06-16 08:09:04 +00:00
Vladimir Sukharev 217550d10e [K/N] Enable passed MPP K1/N tests
^KT-59057

Merge-request: KT-MR-10526
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-06-16 07:45:01 +00:00
Vladimir Sukharev 1e05cb308c [K/N] Convert and enable some tests using System.out?.println()
^KT-59057

Merge-request: KT-MR-10546
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-06-15 20:00:27 +00:00
Vladimir Sukharev 67b00f86b7 [K/N] Remove "IGNORE_BACKEND: NATIVE" from tests already ignored due to incompatible language setting found in test
^KT-59057

Merge-request: KT-MR-10587
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-06-15 19:58:04 +00:00
Anna Kozlova dd059a1e63 [LL] find fir by psi: allow fallthrough to traverse tree for invalid code
In case of broken code e.g., duplicated classes provider would return first class,
though we definitely need some code insight in this case
at least to add navigation fixes, etc.
Similar to this, a file copy is created during completion,
where additional elements might appear and we need to search for them.

Added test cases for duplicated classes.
2023-06-15 17:32:40 +00:00
Anna Kozlova 70b9af0566 [LL] don't request provider with non-physical element
Otherwise, if fir was requested with non-physical element
 inside existing analysis session (not on-air, e.g.,
`FirPositionCompletionContextDetector#analyzeInContext` with
 `FirSimpleParameterPositionContext`) all consequent requests
 would return fir with that non-physical source,
 which might be already invalidated.

 On-air sessions should be protected from invalidation problem but some clients
 might expect original elements anyway and in this case, it would be
 impossible to retrieve correct fir for them.

 In order to find parameters, allow to traverse tree till functions.
2023-06-15 17:32:40 +00:00
Anna Kozlova 3fc334d2eb [decompiler] additional logging for ByDescriptorIndexer 2023-06-15 15:47:17 +00:00
Dmitrii Krasnov c1026a759a Migrated cocoapods tests to new test dsl (junit 5 and gradle test kit) 2023-06-15 15:28:07 +00:00
Nikolay Krasko 58d9727092 Remove *.spdx.json.md5 and *.spdx.json.sha1 from reproducible file 2023-06-15 15:10:55 +00:00
Pavel Punegov d5bdc7cf8e [K/N][test] Fix sample that uses watchos_x86 target
Simply replace it with watchos_x64
2023-06-15 14:07:42 +00:00
Brian Norman 6b5e7ae825 [FIR] Transform children independently when callee is an error
To make sure all possible types are resolved and any additional errors
are reported, resolve children of function calls using independent
resolution mode when the callee reference is an error.

#KT-59041 Fixed
2023-06-15 14:03:40 +00:00
Pavel Kunyavskiy 2f36886bac [K/N] Rewrite AtomicReference using intrinsics
^KT-59120
2023-06-15 13:53:13 +00:00
Brian Norman 8fad4272fc [FIR] Fix default message for PRIVATE_CLASS_MEMBER_FROM_INLINE
Error message was only printing the calling inline function and not the
class member being accessed. Make sure both pieces for diagnostic
information are included in the error message.

#KT-58972 Fixed
2023-06-15 13:49:41 +00:00
Brian Norman 5fe5113344 [Test] Sort FIR diagnostics by offset for consistent rendering 2023-06-15 13:49:41 +00:00
Artem Daugel-Dauge 2abe04132b [Tests] Try to make CocoaPods installation more robust 2023-06-15 13:46:37 +00:00
Alexander Shabalin 00fd0a421f [K/N] Remove runtime tests for legacy MM 2023-06-15 13:16:08 +00:00
Alexander Shabalin 43a7711fcc [K/N] Add CallsCheckerIgnoreGuard 2023-06-15 13:16:08 +00:00
Dmitrii Krasnov 39e97e5766 Migrated AppleFrameworkNonMacIT to new test dsl (junit 5 and gradle test kit)
#KT-51553 In Progress
2023-06-15 11:44:58 +00:00
Dmitriy Dolovov 72525a22a6 [KLIB] Extract "ir_provider" manifest property name as a const val 2023-06-15 11:07:30 +00:00
Artem Daugel-Dauge b1faee5ec6 [Gradle] Configuration cache support in CocoaPods plugin and Apple frameworks tasks
^KT-54362 Verification Pending

Merge-request: KT-MR-9947
2023-06-15 10:37:28 +00:00
vladislav.grechko 457837a255 Fix function invocation mangling rule
Mangle invocations of functions with value classes in signature which
override (directly or indirectly) a method declared in Kotlin code.
Otherwise, NoSuchMethodError is being thrown.

^KT-55945: Fixed
2023-06-15 09:34:21 +00:00
Anna Kozlova f80ed4592d [AA] Handle KtTypeReference children in CompileTimeConstantProvider
CompileTimeConstantProvider could receive a reference expression,
whose grandparent is KtTypeReference (seen that in UAST inspection).
FIR would not contain anything explicit for this reference,
FirResolvedTypeRef would be received as the nearest parent.
Of course, in this case, there could be no compile time constant anyway.
2023-06-15 07:06:41 +00:00
Dmitrii Krasnov 455aa4a76a Migrated the rest part of git connected cocoapods tests to the new test dsl (junit 5 and gradle test kit)
#KT-51553 In Progress
2023-06-15 07:06:08 +00:00
Ivan Kylchik 3ce61f988f [IR] Replace mutable property in const transformer with data class 2023-06-14 19:02:39 +00:00
Ivan Kylchik 0e2b348fa0 [IR] Try to tun IrInterpreterKCallableNamePreprocessor only once
#KT-58923 Fixed
2023-06-14 19:02:39 +00:00
Ivan Kylchik a6a389933d [IR] Slightly simplify string concatenation folding
#KT-58923
2023-06-14 19:02:39 +00:00
Ivan Kylchik dd264cff50 [IR] Split const folding into necessary one and for optimizations only
In this commit we have a lot of change in test data. This was caused
by the way where we evaluate constants. We split constant evaluation
into two distinct parts: only necessary evaluations for `fir2ir`
(like const val and annotations) and optimizations for lowering.
Now we don't do all constant evaluation on `fir2ir`, but IR
dump is executed after this phase, so test data changed.

#KT-58923
2023-06-14 19:02:39 +00:00
Ivan Kylchik 8067df3c94 [IR] Combine IrInterpreterNameCheck with common one
This way we achieve faster compilation time. We want to traverse
IR tree as little as possible. If we add new checker than the time
to evaluate constants basically doubles.

#KT-58923
2023-06-14 19:02:39 +00:00
Ivan Kylchik e5ed1714d1 [IR] Unconditionally allow to interpret IrConst
We can interpret all const elements. It wasn't true on early
prototype phase because of some problems with unsigned numbers,
but right now it is correct to assume that all const are valid.

#KT-58923
2023-06-14 19:02:39 +00:00
Ivan Kylchik 6f4f06757a [IR] Add KType to IrBuiltins 2023-06-14 19:02:39 +00:00
Ivan Kylchik 0021a5f655 [K2] Save inlined java field into special InlineConstTracker 2023-06-14 19:02:39 +00:00
Ivan Kylchik 39242e517e [IR] Minor refactoring 2023-06-14 19:02:39 +00:00
Ivan Kylchik 2129938ef2 [IR] Properly handle interpretation errors if inside annotation class
#KT-58923
2023-06-14 19:02:38 +00:00
Ivan Kylchik ec4cf40f6f [IR] Allow to fold IrGetField expressions
#KT-58923
2023-06-14 19:02:38 +00:00
vladislav.grechko b8b8b7fd3a [JVM_IR] Move variables out of IrInlinedFunctionBlock on MFVC lowering
Variables in `IrInlinedFunctionBlock` declared before the composite
blocks with arguments evaluation may lead to error on codegen while
processing `IrInlinedFunctionBlock`.

^KT-58779: Fixed
2023-06-14 17:34:14 +00:00
vladislav.grechko 4f1d181c88 [JVM_IR] Set correct origin for new variables on MFVC flattening.
Preserve information that variable is temporary while flattening.
Otherwise, unnecessary bytecode for them might be generated.
2023-06-14 17:34:14 +00:00
Alexander Korepanov fc898c7620 [JS IR] Use type upper bounds for calculating function signatures
^KT-59239 Fixed
2023-06-14 14:57:15 +00:00
Dmitry Savvinov a4d40498c7 [mpp] Remove KMM-related diagnostic functional tests
Functional tests do not run on Mac-hosts on CI. Adding a corresponding
integration will be handled as part of more general KGP/MPP tests
rework
2023-06-14 14:36:48 +02:00
Dmitry Savvinov 768e185280 [mpp] Ignore KMM-related diagnostic tests
Currently, CI runs on Linux agents which can not work with iOS targets
2023-06-14 14:36:48 +02:00
Dmitry Savvinov 66411a92f0 [Gradle] Cleanup: remove unused classes
- CompilationFreeArgsValidator got accidentally unused at some point,
and for now we don't see a reason to enable it back. A proper solution
includes exposing K/N linker options more explicitly via DSL, which
would address the initial problem of passing linker options to compiler
accidentally

- With ComplationFreeArgsValidator removal and migration of
DisabledNativeTargetsReporter to diagnostics infra, AggregateReporter
becomes unused so it can be removed as well
2023-06-14 14:36:48 +02:00
Dmitry Savvinov e74e6759ed [Gradle] Cleanup: remove SingleWarningPerBuild API
Instead, newer infrastructure for diagnostics should be used (see
'KotlinToolingDiagnosticsCollector')
2023-06-14 14:36:48 +02:00