Commit Graph

107775 Commits

Author SHA1 Message Date
Denis.Zharkov 276f5b26d8 K2: Implement partially constrained lambda analysis (PCLA)
It's expected to partially mimic the behavior of what
previously was called builder inference, but with more clear contracts
(documentation is in progress, though)

See a lot of fixed issues in the later commits with test data,
especially [red-to-green]

^KT-59791 In Progress
2024-01-10 14:56:30 +00:00
Denis.Zharkov 9ae5287df8 K2: Pass resolution mode to CallInfo
It's going to be used for PCLA implementation in later commits

^KT-59791 In Progress
2024-01-10 14:56:30 +00:00
Denis.Zharkov 3b2bc49c4d K2. Drop PostponedVariablesInitializerResolutionStage
It would be unnecessary after PCLA approach would be implemented

^KT-59791 In progress
2024-01-10 14:56:30 +00:00
strangepleasures bb8ff9e299 KT-62584 Fix generation of type arguments for local classes
Merge-request: KT-MR-13684
Merged-by: Pavel Mikhailovskii <Pavel.Mikhailovskii@jetbrains.com>
2024-01-10 14:20:09 +00:00
Ilya Goncharov b645997dc4 [Gradle, JS] Use dev server not as property in KotlinWebpackConfig 2024-01-10 12:41:53 +00:00
Leonid Startsev fba2f5ea4e Expand most kotlinx.serialization tests on JS backend
to enhance and increase test coverage of the plugin.
2024-01-10 12:17:34 +00:00
Alexander.Likhachev 60080e8bb8 [Build] Remove redundant trove4j compileOnly dependencies
^KTI-1135 In Progress
2024-01-10 11:29:25 +00:00
Alexander.Likhachev 21b438f55d Replace the trove4j collections usages with the fastutil ones
The trove4j library is licensed under LGPL, and that causes some troubles while working with it. The fastutil library provides the same functionality in the context of our needs, and is licensed under the Apache license.
^KTI-1135 In Progress
2024-01-10 11:29:25 +00:00
Alexander Udalov dd5fffebf2 JVM: do not generate assertion message for captured fields
#KT-64615 Fixed
2024-01-10 11:10:08 +00:00
Alexander Udalov f01e633f8b JVM: do not put public field access into a single expression block
It affects the `is IrGetField` check in
TypeOperatorLowering.computeNotNullAssertionText, which leads to missing
NPE messages when accessing backing fields of public properties.

 #KT-64615
2024-01-10 11:10:08 +00:00
Nikita Bobko 96b2f13397 Make it possible to enable "non-local break and continue" with -language-version flag
We initially wanted to release the feature in 1.9.0, but found a bug in
K1 KT-54906. It was decided to postpone the feature release to 2.1, but
at this time KOTLIN_2_1 didn't exist

In this commit I make it possible to enable the feature with
-language-version 2.1 flag, so users can "preview" this feature in 2.0

KT-1436
2024-01-10 10:19:15 +00:00
Marco Pennekamp eabbe21b66 [AA] Add diagnostics tests for sealed classes/interfaces
- KT-62895 cannot be reproduced on the Analysis API side. Still, it is
  useful to add tests here for better coverage in the future.
- The reason is likely that Analysis API tests specifically use
  `SealedClassesInheritorsCaclulatorPreAnalysisHandler` to compute
  sealed class inheritors (which are usually the breaking point for
  problems in `when` exhaustiveness checking), so the tests do not use
  the production implementation. See KT-64505 for future work on this
  problem.

^KT-62895
2024-01-10 10:13:23 +00:00
Marco Pennekamp 51f1e31cce [AA] Support sealed class inheritors in dangling file tests
- In dangling file tests, the project structure's main module is a
  non-dangling file module. Sealed class inheritors are registered for
  that module. However, later when sealed class inheritors are
  requested, the FIR class has a dangling file module as its `KtModule`,
  which isn't known by the inheritors provider. We need to take the
  sealed inheritors of the context module instead.
2024-01-10 10:13:23 +00:00
Marco Pennekamp ff0224d28d [AA] Test project structure: Fix duplicate binary library modules in main module dependencies
- `TestModuleStructureFactory.createProjectStructureByTestStructure`
  created `KtModule`s for each test module and then also created new
  `KtModule`s for binary dependencies. This split worked as long as no
  binary dependency was also a test module and thus part of the main
  modules. But if not, `addLibraryDependencies` created a duplicate
  `KtModule`, instead of referring to the existing binary module.
- The fix registers a main binary library module in the library cache
  before it can become the dependency of another main module. Because
  main modules can only depend on main modules preceding them in the
  list, a separate pass over all main modules is not needed.

^KT-64647 fixed
2024-01-10 10:13:23 +00:00
Alexander Zakharenko 62facee96c [K/N] Debug output for flaky testReleaseCompilerAgainstPreReleaseLibrary
^KT-64822
2024-01-10 09:49:41 +00:00
eugene.levenetc 92affa1b24 [ObjCExport] Add initial objective-c function translation
KT-64226
2024-01-10 09:17:00 +00:00
Dmitrii Krasnov 7e61f9cb42 [Gradle] Validation for definitionFile and packageName in cinterop
^KT-62800 Fixed
2024-01-10 08:50:24 +00:00
Dmitrii Krasnov cef46a9dd1 [Gradle Native] Made definitionFile Optional for cinterop task
^KT-62800 Fixed
2024-01-10 08:50:24 +00:00
Nikita Bobko 013b5e3780 [IR] Fix missing AMBIGUOUS_ACTUALS
^KT-59938 Fixed
Review: https://jetbrains.team/p/kt/reviews/13760

After this patch:

    > The /compiler/testData/diagnostics/tests/multiplatform/topLevelFun/conflictingImplDeclarations.kt test:

    Fixed

    > The /compiler/testData/diagnostics/tests/multiplatform/headerClass/expectDeclarationWithWeakIncompatibilities.kt test:

    Declarations are in the same module. `PACKAGE_OR_CLASSIFIER_REDECLARATION` is reported anyway

    > The /compiler/testData/diagnostics/tests/multiplatform/java/varPropertyAgainstJavaGetterAndNonFinalField.kt test:

    Expect-actual matcher doesn't match fields in K2 https://youtrack.jetbrains.com/issue/KT-63667 => green code

    > The /compiler/testData/diagnostics/tests/multiplatform/java/propertyAgainstJavaPrivateFieldAndPublicMethod.kt test:

    Expect-actual matcher doesn't match fields in K2 https://youtrack.jetbrains.com/issue/KT-63667 => green code

    > The /compiler/testData/diagnostics/tests/multiplatform/java/implicitJavaActualization_multipleActuals.kt test:

    K2 doesn't have implicit Java actualization. And PACKAGE_OR_CLASSIFIER_REDECLARATION is reported anyway

    > The /compiler/testData/diagnostics/tests/multiplatform/java/propertyAgainstJavaPublicFieldAndPublicGetter.kt test:

    Expect-actual matcher doesn't match fields in K2 https://youtrack.jetbrains.com/issue/KT-63667 => green code

    > The /compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/injectContextReceiverOverload.kt test:

    Context receivers are not supported in expect-actual matcher. https://youtrack.jetbrains.com/issue/KT-61447
    And K2 reports another error right now anyway
2024-01-10 08:08:42 +00:00
Nikita Bobko e6860054ea [FIR] Cleanup: drop AMBIGUOUS_ACTUALS diagnostic from the frontend
Motivation: AMBIGUOUS_ACTUALS can't be reported on frontend (because it
requires expect to actual mapping, but the mapping is only available on
backend)

In scope of KT-59938
Review: https://jetbrains.team/p/kt/reviews/13760
2024-01-10 08:08:41 +00:00
Jinseong Jeon f1ce57f08f AA: handle PsiType conversion for recursive type parameter case (again)
^KT-64595 fixed
2024-01-10 04:04:20 +00:00
Roman Golyshev 93f1555322 KTIJ-28080 [AA] Move selection checking to ElementsToShortenCollector.findClassifierQualifierToShorten
This way, even if the whole qualifier is not selected, but some of its
parts are, the reference shortener will correctly find and shorten
those parts

^KTIJ-28080 Fixed
2024-01-09 20:07:38 +00:00
Roman Golyshev 3b448b284c KTIJ-28080 [AA] Refactor ElementsToShortenCollector.findClassifierElementsToShorten
Move unrolling the qualifiers into the function, add some simple KDoc
2024-01-09 20:07:38 +00:00
Stanislav Ruban 8f79d519b8 Add @NotNull to return type of KtTestUtil.getJdk21Home 2024-01-09 18:45:59 +00:00
Stanislav Ruban 8c2293ddcd Use JDK 21 in AdditionalBuiltInsMembersSignatureListsTest
^KT-58765
2024-01-09 18:45:59 +00:00
Stanislav Ruban 4ef830f9ee Regenerate tests after removing separate test configurations for JDK 21
^KT-58765

Now that JDK 21 was released as stable, we can remove separate test
configurations for testing the compiler with JDK 21 and reintegrate
the corresponding test data into standard test configurations.
2024-01-09 18:45:59 +00:00
Stanislav Ruban a5bae12915 Remove separate test configurations for JDK 21
^KT-58765

Now that JDK 21 was released as stable, we can remove separate test
configurations for testing the compiler with JDK 21 and reintegrate
the corresponding test data into standard test configurations.
2024-01-09 18:45:58 +00:00
Stanislav Ruban 13b3987aab Prepare test data for removal of separate test configurations for JDK 21
^KT-58765

Now that JDK 21 was released as stable, we can remove separate test
configurations for testing the compiler with JDK 21 and reintegrate
the corresponding test data into standard test configurations.
2024-01-09 18:45:58 +00:00
Aleksei.Glushko 8ed806ebe0 [K/N] Concurrent phase in GC mark (KT-58865)
+ Log Stop The World reasons

Merge-request: KT-MR-13759
Merged-by: Alexey Glushko <aleksei.glushko@jetbrains.com>
2024-01-09 18:34:36 +00:00
Denis.Zharkov f8fd46a5b8 K2: Rename delegateProvider in node for delegate and refine its type 2024-01-09 18:03:05 +00:00
Denis.Zharkov ca9372cfa0 K2: Get rid of using inference session for augmented assignments
Instead, use specific resolution mode handled by call completer.
Mostly, it's done for simplification of PCLA implementation because
otherwise we would need to track how PCLA inference session and the
one for augmented should be combined.

But just independently of this, not using inference session here,
it looks just simpler.

^KT-59791 In Progress
2024-01-09 18:03:05 +00:00
Denis.Zharkov 4e26c9f2ba K2: Fix updateSubstitutedMemberIfReceiverContainsTypeVariable
Initially, it was a bug caused by unfortunate copy-paste, but there were
no tests for this because mostly `delegation` operators are functions

But after PCLA is implemented, many tests start failing
For example, FirPsiOldFrontendDiagnosticsTestGenerated.Tests.BuilderInference.OneParameter.OneTypeVariable.OneTypeInfoOrigin.TypeInfoSinks.testImmutableProperties

^KT-59791 In Progress
2024-01-09 18:03:05 +00:00
Denis.Zharkov f831e11b4a Minor. Refine type parameters' naming in diagnostic test data
Using different names is more convenient for debugging
2024-01-09 18:03:05 +00:00
Denis.Zharkov d9f6e33cf7 Minor. Reformat FirCallCompleter.kt 2024-01-09 18:03:05 +00:00
Denis.Zharkov c163f86ecb Minor. Reformat some inference files 2024-01-09 18:03:05 +00:00
Denis.Zharkov 9a6bff958f K2: Drop unused methods from FirInferenceSession 2024-01-09 18:03:05 +00:00
Pavel Kunyavskiy 9374cacdd6 [IrActualizer] Don't actualize expect types
This was never semantically correct, but was not important
before KT-63644, as they were immediately dropped after that anyway.

After KT-63644, they were used to compute fake overrides inside them,
which were later matched against actual class, which can
produce false-positive matching errors.

^KT-64835
2024-01-09 17:53:06 +00:00
Nataliya.Valtman cf3672314a Remove JMX bean invocation for internal build FUS metrics
#KT-58768 In Progress
2024-01-09 16:48:11 +00:00
Alexander Udalov 9b5c331c8e IR, descriptors: remove (Ir)ExternalOverridabilityCondition.Result.CONFLICT
No existing external overridability condition reports a conflict anyway,
and there's no support for it in the IR case.
2024-01-09 16:19:14 +00:00
Alexander Udalov c63f31f92f Fir2Ir: minor, remove obsolete part of a TODO related to KT-61804
KT-61804 is obsolete, or at least shelved at this point.
2024-01-09 16:19:14 +00:00
Alexander Udalov 70cfd34a7b Tests: minor, change test mute reason to KT-64432 2024-01-09 16:19:14 +00:00
Dmitriy Novozhilov 4c74fa1d1d [Build] Exclude native tests of atomicfu from the JPS compilation
`AtomicfuNativeTestGenerated` test depends on classes from Native
  modules, which are not present in the JPS build. Which means that this
  class should be excluded from the compilation, so "Build project"
  wouldn't fail on it
2024-01-09 16:09:24 +00:00
Stanislav Ruban 78221bac11 Regenerate test configuration files with outdated copyright notices 2024-01-09 15:08:34 +00:00
Vladimir Sukharev 8f201a0257 [FIR] Refactor FirCallableDeclaration.getOverriddenSymbols
^KT-61564
2024-01-09 14:17:47 +00:00
Vladimir Sukharev e166e70916 [FIR] Refactor FirRegularClassSymbol.getSuperClassSymbolOrAny
^KT-61564
2024-01-09 14:17:47 +00:00
Vladimir Sukharev a78cfff8c9 [K/N] Move more names to NativeStandardInteropNames
^KT-61564
2024-01-09 14:17:47 +00:00
Vladimir Sukharev 324e04586a [K/N] Properly format new diagnostic messages texts
^KT-61564
2024-01-09 14:17:47 +00:00
Vladimir Sukharev 943306f8fe [K/N][Tests] Restore inline modifier in t59.kt test
^KT-61259
2024-01-09 14:17:47 +00:00
Vladimir Sukharev 7eb239c282 [K/N][Tests] Move objCActionFqName to NativeStandardInteropNames
^KT-61259
2024-01-09 14:17:47 +00:00
Vladimir Sukharev 28ee61c57d [K/N] Add diagnostic directives to test sources
^KT-61564
2024-01-09 14:17:47 +00:00