Commit Graph

109329 Commits

Author SHA1 Message Date
Dmitriy Dolovov 40af02ca4f [Commonizer] Metadata comparator: A special path element for FlexibleTypeUpperBound
^KT-62753
2024-02-22 17:53:15 +00:00
xiaozihan.larryxiao cabd9ad1ec IR: Fix missing source in IrClass with DeepCopyIrTreeWithSymbols
When using DeepCopyIrTreeWithSymbols as class transformer to transform
the IrClass, the source element of IrClass was set to
SourceElement.NO_SOURCE after the transform.

^KT-65343 Fixed
2024-02-22 16:14:38 +00:00
Nikita Bobko 7924573d20 [FIR] Report redeclaration across KMP source sets
^KT-57585 Fixed

Related tests:
- MultiPlatformIntegrationTestGenerated.testSimpleNoImplKeywordOnTopLevelFunction
- MultiPlatformIntegrationTestGenerated.testWeakIncompatibilityWithoutActualModifier
- FirPsiJsKlibDiagnosticsTestGenerated.testSignatureClash_MPP
- LLFirPreresolvedReversedDiagnosticCompilerFirTestDataTestGenerated$ResolveWithStdlib$MultiModule.testFakeOverrides
- DiagnosticCompilerTestFE10TestdataTestGenerated$Tests$Multiplatform:
- LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated$Tests$Multiplatform
- FirOldFrontendMPPDiagnosticsWithPsiTestGenerated
- FirOldFrontendMPPDiagnosticsWithLightTreeTestGenerated
- FirLibraryModuleDeclarationResolveTestGenerated.testDataClass
- org.jetbrains.kotlin.idea.k2.highlighting.K2HighlightingMetaInfoTestGenerated$Diagnostics.testDataClassFromLibrary
- org.jetbrains.fir.uast.test.FirLightClassBehaviorTest.testContainingFile
- org.jetbrains.fir.uast.test.FirLightClassBehaviorTest.testAnnotationParameterReference
- org.jetbrains.uast.test.kotlin.org.jetbrains.uast.test.kotlin.comparison.FE1LightClassBehaviorTest.testContainingFile
2024-02-22 16:06:36 +00:00
Nikita Bobko 4120d6a8aa [FIR] Search expect for actual only in dependsOn dependencies
Before this commit, the expect-actual resolver could find expects in
regular dependencies

Note: The appeared `VIRTUAL_MEMBER_HIDDEN` in
compiler/fir/analysis-tests/testData/resolveWithStdlib/multiModule/FakeOverrides.kt
isn't caused by my change. It's caused by fixing the testData dependency
syntax notation.

The testData improperly used regular dependency syntax notation, while
it should have been using dependsOn

Before:
    Regular dependency syntax notation

    // MODULE: androidMain(commonMain)

After:
    dependsOn dependency syntax notation

    // MODULE: androidMain()()(commonMain)
2024-02-22 16:06:35 +00:00
Dmitriy Novozhilov e431a96897 [FIR2IR] Properly calculate overridden functions for lazy fake overrides
For detailed explanation see the comment to `computeBaseSymbolsWithContainingClass`
  function in `FakeOverrideGenerator.kt`

^KT-65592
2024-02-22 15:56:57 +00:00
Vladimir Sukharev 1761c8eb25 [K/N][Tests] Ignore test sourceBinarySource.kt for per-file-caches on Linux
^KT-65669
2024-02-22 14:57:15 +00:00
Alexander Shabalin c600b74459 [K/N][tests] Restore ir_providers/hello.kt ^KTI-1597 2024-02-22 14:56:13 +00:00
Alexander Shabalin dc4f12f29c Revert "[K/N][Tests] Migrate driver test llvm_variant_dev"
This reverts commit d8a90f55a8.
2024-02-22 14:56:13 +00:00
Alexander Shabalin 4765cfda53 Revert "[K/N][Tests] Migrate test override_konan_properties0"
This reverts commit 9ef051dbc5.
2024-02-22 14:56:13 +00:00
Alexander Shabalin 8518c3f54f Revert "[K/N][Tests] Migrate test override_konan_properties0 and add testDriverVersion"
This reverts commit fbe8db4b45.
2024-02-22 14:56:13 +00:00
Alexander Shabalin 876be8f17a Revert "[K/N][Tests] Ignore KonanDriverTest tests on MinGW/opt.debug/cache.no"
This reverts commit 313b230333.
2024-02-22 14:56:13 +00:00
Ilya Goncharov bca785a87c [Gradle, Wasm] Fix copying wasm file to destination dir
^KT-65889 fixed
2024-02-22 14:53:54 +00:00
Yahor Berdnikau 6b19b8b9d0 [Repo] Don't use kotlinOptions in repo build scripts
^KT-63419 In Progress
2024-02-22 14:48:10 +00:00
Yahor Berdnikau 22e1e79c41 [Repo] Don't use kotlinOptions in buildSrc-compat
Exception is configuring klib relative path which should be fixed via
separate issue.

^KT-63419 In Progress
2024-02-22 14:48:10 +00:00
Igor Yakovlev eea3c3624c [WasmJs] Generate a wrapper that run in Deno
Fixed #KT-65713
2024-02-22 14:45:09 +00:00
Ivan Kylchik 96b5d47e68 [IR] Move property needsInlining into InlineFunctionResolver
#KT-64807 Fixed
2024-02-22 09:55:58 +00:00
Ivan Kylchik 9e7ddfa191 [IR] Resolve fake overrides inside getFunctionDeclaration function
#KT-64807
2024-02-22 09:55:58 +00:00
Ivan Kylchik 2bfd1c8f23 [IR] Don't pass originalCallee to the inliner
`originalCallee` is supposed to be the owner of the original call.
It can be a fake override, and in the inliner we are using actual
function with body. Apparently we can just stick with the resolved
function.

#KT-64807
2024-02-22 09:55:58 +00:00
Ivan Kylchik 0258927d33 [IR] Forbid to use shouldExcludeFunctionFromInlining as public API
#KT-64807
2024-02-22 09:55:58 +00:00
Ivan Kylchik f1bc542d74 [IR] Change the return type of getFunctionDeclaration to be nullable
#KT-64807
2024-02-22 09:55:58 +00:00
Ivan Kylchik 91f818ba5a [IR] Transformed InlineFunctionResolver into abstract class
#KT-64807
2024-02-22 09:55:58 +00:00
eugene.levenetc 30b63e4843 [ObjCExport] Add translation of functions and properties extensions
KT-65630
2024-02-22 09:20:12 +00:00
Aleksei.Cherepanov a34b87c63a Load kotlin.coroutines.Continuation from parent classloader
^KT-66004 Fixed
2024-02-22 09:03:21 +00:00
vladislav.grechko f32367d2c2 Fix IrFunction.isEmptyArray implementation
The previous one was incorrect for K1 since parent of top-level function
is `IrClass`, not `IrPackageFragment`.

The change is non-functional, K1 still worked correctly, but had to do
some extra work when inlining `emptyArray` calls and produces less
performant bytecode.
2024-02-22 07:32:36 +00:00
vladislav.grechko 224a4e1e3c Do not exclude codegen/box/script directory from JVM ABI tests 2024-02-22 07:32:35 +00:00
Pavel Kunyavskiy 9bbf15c14a [IRFakeOverrides] Do not override modality in expect classes
It was a workaround for case, where expect class don't have
override of abstract function. We don't allow it anymore,
so it can be dropped to make correct modality comparation.

^KT-65971
2024-02-21 22:10:30 +00:00
Pavel Kunyavskiy 21ae6e46b7 [IRFakeOverrides] Also replace special symbols in annotations
This fixes some crashes on red code in diagnostic tests.
Also can be useful in the future, when we would allow things like
enum.name in annotation arguments.

^KT-65971
2024-02-21 22:10:29 +00:00
Dmitriy Dolovov 7fe0de897b [KLIB tool] Update missing test data in Kotlin/Native C-interop tests
^KT-62340
2024-02-21 21:21:31 +00:00
Nikolay Lunyak ae0d1201c5 [FIR] Add a blackbox test for failure #3 of KT-65972
^KT-65972
2024-02-21 20:24:18 +00:00
Nikolay Lunyak 01cff6b5e9 [FIR] Call distinctBy for containsMultipleNonSubsumed
Otherwise, when analyzing
`PsiTypeParameterListOwner` in the
related test, we (after flattening and
`nonSubsumed()`) get 2 `JvmMember.accept`
from the same very java enhancement
scope `JvmMember`.

^KT-65972
2024-02-21 20:24:17 +00:00
Nikolay Lunyak 453b97a2d1 [FIR] Reproduce one more failure for KT-65972 #3
^KT-65972
2024-02-21 20:24:17 +00:00
Nikolay Lunyak 39cbe3fb35 [FIR] Add a blackbox test for failure #2 of KT-65972
^KT-65972
2024-02-21 20:24:17 +00:00
Nikolay Lunyak 341a23d05c [FIR] Introduce containsMultipleNonSubsumed to intersection overrides
After this change the IO created for
`SimpleColoredComponent::setToolTipText`
will be `containsMultipleNonSubsumed == true`
while IOs created for classes in
`intersectionOverridesIntersection.kt`
will have this property set to `false`.

^KT-65972 Fixed
2024-02-21 20:24:16 +00:00
Nikolay Lunyak ee20d979cb [FIR] Reproduce one more failure for KT-65972 #2
And refactor another related test to
explain the desired behavior.

^KT-65972
2024-02-21 20:24:16 +00:00
Nikolay Lunyak e929ed8f8c [FIR] Add a blackbox test for KT-65972 2024-02-21 20:24:15 +00:00
Nikolay Lunyak da6006b7d0 [FIR] Relax intersection overrides visibility requirements for Java
Allow multiple bases with default
implementations as long as there's a
non-abstract symbol from a class.

Our rules for Kotlin are stricter than
those in Java.
2024-02-21 20:24:13 +00:00
Nikolay Lunyak 76ed5453b3 [FIR] Report all Visibilities.Unknown in FirOverrideChecker
Check all members for `Visibility.Unknown`,
otherwise we miss them when they come
from supertypes. This is the reason why
the FP intellij build failed with a
cryptic stacktrace instead of a
human-readable diagnostic.

Also, do report the diagnostic at all
cases of `Visibilities.Unknown`. Turns
out, there are no "simple to reason
about" situations here :(

Also, an interesting detail:
`retrieveDirectOverriddenOf` returns an
empty list for intersection overrides.
But this doesn't seem to break anything...

Replacing `CANNOT_INFER_VISIBILITY`'s
type `KtDeclaration` with
`PsiNameIdentifierOwner` and the related
changes in `PositioningStrategies`
were needed to prevent an exception saying that
`PsiClassImpl` is not a subtype of
`KtDeclaration`.
2024-02-21 20:24:13 +00:00
Nikolay Lunyak 053eb07692 [FIR] Reproduce KT-65972
This code does lead to inferring
`Visibilities.Unknown`, but it's not
reported anywhere. This is because it
happens inside `AbstractIntSet` which
comes to us "pre-compiled" by javac,
whereas `FirOverrideChecker` only checks
members within `KotlinClass`.

^KT-65972
2024-02-21 20:24:13 +00:00
Dmitrii Gridin 3ce3c50b92 [LL FIR] update low-level-api-fir.md doc 2024-02-21 20:16:15 +00:00
Dmitrii Gridin 71f9c101a1 [LL FIR] KDoc here and there 2024-02-21 20:16:15 +00:00
Dmitrii Gridin 8525a39579 [FIR] FirResolvePhase: update KDoc
- Add pseudocode
- Add information about loop breaks to the super type phase
2024-02-21 18:21:47 +01:00
Bogdan Mukvich 768119bdef Remove mentioning of snapshot versions
* we don't publish snapshots

^KTI-1541
2024-02-21 17:13:29 +00:00
Bogdan Mukvich ff2fea390b Fix snapshot deployment maven params
^KT-65944
2024-02-21 17:13:29 +00:00
Ilya Gorbunov 0ecbbbf1ca [stdlib] Set AV to 2.0, LV to 1.9 for main compilations, build tests with K2 2024-02-21 16:28:12 +00:00
Bogdan Mukvich 6152022838 Gitignore teamcity directory
^KTI-1541
2024-02-21 15:38:02 +00:00
Nelson Osacky 320b0d1f36 Update Develocity Gradle plugin and CCUD plugin (#5266) 2024-02-21 16:11:58 +01:00
Evgeniy.Zhelenskiy 931f2eab58 [FIR] Remove implicit coercion of ifs and whens to Unit
The rule of thumb is the following:
If the `if` and `when` can be successfully replaced with `while`,
then it is used as a statement, otherwise, it is used as an expression.

#KT-59883
2024-02-21 15:04:03 +00:00
Evgeniy.Zhelenskiy 2e66954d01 [FIR] Forbid no then branch in if expression
#KT-59883
2024-02-21 15:04:02 +00:00
Yahor Berdnikau 3d6af53a3b [Repo] Fix missing Gradle API 8.5 dependency in verification metadata 2024-02-21 14:13:13 +00:00
Alexander Udalov 5ca7ab9801 K2 JVM: implement Java modules-related checkers
All existing tests use custom test data for FIR because the diagnostic
text in FIR has to have a dot at the end. Also, the K2 checker doesn't
check usages in imports because there are no "import checkers" in K2
right now, this will need to be fixed later if necessary.

 #KT-60797 Fixed
2024-02-21 14:10:44 +00:00