Commit Graph

4422 Commits

Author SHA1 Message Date
Dmitriy Novozhilov 8300ad76d0 [FIR2IR] Remember overridden symbols if f/o contains error types
^KT-64837 Fixed
2024-01-12 15:32:25 +00:00
Roman Efremov 46cd5621bd [Test] Add test for two override-related diagnostics reported on one line
^KT-55433
2024-01-12 15:30:54 +00:00
Dmitrii Gridin e60a436068 [PSI2FIR] add test on primary constructor without constructor keyword
^KT-64900
2024-01-12 12:19:54 +00:00
Alejandro Serrano Mena b077293396 [FIR] Allow, but also warn, KMutableProperty with captured types
^KT-63589 Fixed
2024-01-12 10:07:14 +00:00
anzhela.sukhanova cdcb3e4dcd Tests for KT-64640
Add generated test methods
2024-01-12 08:08:20 +00:00
Denis.Zharkov 97d17012e5 K2: Add test reproducing KT-64222 2024-01-11 13:35:13 +00:00
Sergej Jaskiewicz a0ba878b1d [FIR2IR] De-duplicate creation of Fir2IrConfiguration
This will help to prevent inconsistencies between creating
the configuration in the actual compiler pipeline and in compiler tests.
2024-01-11 12:16:54 +00:00
Denis.Zharkov 72b0372927 K2: Allow PCLA inference when a value parameter has a TV type
^KT-64877 Fixed
2024-01-11 10:32:12 +00:00
Roman Golyshev 0cad4c9632 KT-64832 [FIR] Add more testData for invoke on local variables
Covers:
- suspend functional local variables
- overloads
- custom types with invoke operator
2024-01-11 09:58:04 +00:00
Roman Golyshev 2c90f1327d KT-61032 [FIR] Add testData for invoke on K*Function* local variables
N.B. Method references currently also implicitly have such type
2024-01-11 09:58:04 +00:00
Dmitrii Gridin cf290a73fc [Analysis API] migrate AbstractSymbolLightClassesTestBase to doTestByMainModuleAndOptionalMainFile
^KT-64805
2024-01-10 22:07:03 +00:00
Dmitrii Gridin 1aa2377c60 [Analysis API test] rename AbstractLowLevelApiModifiablePsiSingleFileTest to AbstractLowLevelApiModifiablePsiTest
^KT-64805
2024-01-10 22:07:03 +00:00
Dmitrii Gridin 6145255e2c [Analysis API test] extract AbstractPsiDeclarationProviderTest
^KT-64805
2024-01-10 22:07:03 +00:00
Dmitrii Gridin 0f3f0ff080 [Analysis API test] rename AbstractPsiDeclarationProviderMultiModuleBinaryTest to AbstractPsiDeclarationProviderBinaryTest
^KT-64805
2024-01-10 22:07:03 +00:00
Dmitrii Gridin 79a8b6de1f [Analysis API test] rename AbstractPsiDeclarationProviderSingleModuleTest to AbstractPsiDeclarationProviderSourceTest
^KT-64805
2024-01-10 22:07:03 +00:00
Dmitrii Gridin 052622b862 [Analysis API test] migrate more tests from doTestByModuleStructure to doTestByMainFile
^KT-64805
2024-01-10 22:07:03 +00:00
Dmitrii Gridin cbae92f5c6 [Analysis API test] get rid of AbstractAnalysisApiSingleFileTest
^KT-64805
2024-01-10 22:07:03 +00:00
Dmitrii Gridin 476940c06b [Analysis API test] get rid of AbstractAnalysisApiBasedSingleModuleTest
^KT-64805
2024-01-10 22:07:03 +00:00
Dmitrii Gridin 095989b6fc [LL FIR] ger rid of AbstractLowLevelApiLastModuleFirstFileTest
Now this class is redundant and all tests migrated to the base class

^KT-64805
2024-01-10 22:07:03 +00:00
Dmitrii Gridin 84d07ef492 [LL FIR] ger rid of AbstractLowLevelApiSingleFileTest
Now this class is redundant and all tests migrated to the base class

^KT-64805
2024-01-10 22:07:03 +00:00
Dmitrii Gridin f8d95eceb7 [Analysis API] AbstractAnalysisApiBasedTest: implement test entry points to avoid boilerplate on implementation side
There are three test entry points:
* [doTestByMainFile] – test cases with dedicated main file.
Supports everything from single-file cases to multi-platform multi-module
multi-file cases
* [doTestByMainModuleAndOptionalMainFile] – test cases rather around
modules than files
* [doTestByModuleStructure] – all other cases with fully custom logic

Look at the KDoc of the corresponding method for more details.

^KT-64805 Fixed
2024-01-10 22:07:03 +00:00
Dmitrii Gridin b67deea21f [Analysis API] introduce getKtFiles util
^KT-64805
2024-01-10 22:07:03 +00:00
Dmitrii Gridin d828a646cf [Analysis API] move allKtFiles util from LL FIR module
^KT-64805
2024-01-10 22:07:03 +00:00
Dmitrii Gridin 1c2fac41c2 [Analysis API] ExpressionMarkerProvider: fix path for selected expressions
We are storing them by file path, but accessing them by
file name, which is inconsistent

^KT-64805
2024-01-10 22:07:03 +00:00
Dmitrii Gridin a7984c6794 [Analysis API] ExpressionMarkerProvider: do not expose implementation details
And add API for selected expressions

^KT-64805
2024-01-10 22:07:03 +00:00
Dmitrii Gridin 663b7fb76f [Analysis API] AbstractAnalysisApiBasedTest: introduce entry point for tests with main file
Pulled up the implementation from AbstractCompilerFacilityTest

^KT-64805
2024-01-10 22:07:03 +00:00
Jinseong Jeon 45b8f99107 SLC: distinguish last v.s. non-last vararg during binary resolution
^KT-64795 fixed
2024-01-10 15:36:40 +00:00
Denis.Zharkov 2bdadeb0c8 Fix instability of declaration order of KotlinStaticDeclarationProvider
It affects how some rendering-related tests behave

^KT-64771 Fixed
2024-01-10 14:56:31 +00:00
Denis.Zharkov 7e4d9d9f64 K2: Add new tests for PCLA implementation
Many of them have been found & minimized at FP tests/user projects

^KT-59791 Fixed
2024-01-10 14:56:31 +00:00
Denis.Zharkov b9019d3de1 K2: Adjust test data after PCLA implementation [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
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
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
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
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 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
Denis.Zharkov f8fd46a5b8 K2: Rename delegateProvider in node for delegate and refine its type 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
Stanislav Ruban 78221bac11 Regenerate test configuration files with outdated copyright notices 2024-01-09 15:08:34 +00:00
Vladimir Sukharev 08bc0a6bd0 [K/N] Adjust moved special backend checks tests
^KT-61564
2024-01-09 14:17:47 +00:00
Nikolay Lunyak dd85a81d45 [FIR] Add a minimized alternative for orOperatorWithConstant.kt
It was decided to leave this code as is, because supporting
it would probably require introducing Implication-statements,
but this is not a good-enough use-case for such work.
2024-01-09 10:47:14 +00:00
Nikolay Lunyak 502b422b6b [FIR] Ensure KT-62814 is not reproducible
^KT-62814 Obsolete
2024-01-09 10:44:35 +00:00