Commit Graph

160 Commits

Author SHA1 Message Date
Nikita Bobko 9a865e4c55 [FE 1.0] Issue a warning if expect and actual are declared in the same module
The commit is based on b09561c3c3
Co-authored-by: Dmitriy Novozhilov <dmitriy.novozhilov@jetbrains.com>

^KT-40904 Fixed
^KT-55177 Fixed
Review: https://jetbrains.team/p/kt/reviews/8731

True negative test already exist:
`compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/intermediateWithActualAndExpect.kt`
2023-02-21 14:45:46 +01:00
Nikita Bobko 456605542c Make it possible to run hmpp tests with ENABLE_MULTIPLATFORM_COMPOSITE_ANALYSIS_MODE
In scope of KT-40904 KT-55177
Review: https://jetbrains.team/p/kt/reviews/8731

In order to make it possible to run hmpp tests with
`ENABLE_MULTIPLATFORM_COMPOSITE_ANALYSIS_MODE`, a dependency manager
must be implemented. This commit implements some basic dependency
manager. I'm not sure in its correctness because
`CommonDependenciesContainer` is an awkward API, but this dependency
manager works for my cases.

Why: I need hmpp + `ENABLE_MULTIPLATFORM_COMPOSITE_ANALYSIS_MODE`
infrastructure to cover `ExpectActualInTheSameModuleChecker` (I will add
the checker in the next commit) with tests. The checker couldn't be
covered with regular hmpp tests because regular hmpp tests and
`K2MetadataCompiler` run the compiler in a different way.
Contrary, `ENABLE_MULTIPLATFORM_COMPOSITE_ANALYSIS_MODE` runs the compiler in a
way `K2MetadataCompiler` does it.

I moved some tests from hmpp to `hmpp/multiplatformCompositeAnalysis`
because otherwise the tests would fail after I implement
`ExpectActualInTheSameModuleChecker` in the next commit.

Also the descriptor dumps were changed
(intermediateWithActualAndExpect.txt and
sealedInheritorsInComplexModuleStructure.txt). It happened because now
common source sets are no longer "squashed" into a single source set but
rather correct dependencies between source sets are established. And
each source set is analyzed separately (exactly like in
K2MetadataCompiler)
2023-02-21 14:45:45 +01:00
Marco Pennekamp d6cb75ca91 [LL FIR] KT-55329 Support transitive dependsOn dependencies in LL FIR
- In contrast to other kinds of dependencies, `dependsOn` dependencies
  must be followed transitively.
- Add `transitiveDependsOnDependencies` to `KtModule`. These
  dependencies are calculated lazily with a topological sort. They are
  added to the dependency provider when it's built in
  `LLFirSessionFactory`.

^KT-55329 fixed
2023-01-30 17:17:58 +00:00
Marco Pennekamp 1803bd36cc [FIR] Fix IncDecOperatorsInExpectClass for FIR, add multi-module test
- `IncDecOperatorsInExpectClass.kt` should produce an
  `ACTUAL_WITHOUT_EXPECT` in K2 (see KT-55177). This went unnoticed
  because of KT-55570.
- A similar multi-module test for K1 and K2 has been added, called:
  `multiplatform/incDecOperatorsInExpectClass.kt`.
2023-01-30 17:17:57 +00:00
Marco Pennekamp 2faa247075 [FIR] KT-55570 Fix ACTUAL_WITHOUT_EXPECT reporting for empty classes
- FirExpectActualMatcherTransformer: Instead of returning,
  `transformMemberDeclaration` must assign an empty map to
  `expectForActualData` so that `FirExpectActualDeclarationChecker`
  doesn't assume that the member declaration needs no expect-actual
  checking.

^KT-55570 fixed
2023-01-30 17:17:57 +00:00
Dmitriy Novozhilov 8d728d4f53 Revert "[FE 1.0] Deprecate declaration of expect and actual in the same module"
This reverts commit b09561c3c3.

It was decided to postpone this warning till 1.9
This is needed to provide proper IDE support

^KT-40904 Open
^KT-55177 Open
2023-01-17 18:02:50 +00:00
Dmitriy Novozhilov b09561c3c3 [FE 1.0] Deprecate declaration of expect and actual in the same module
^KT-40904 Fixed
^KT-55177 Fixed
2023-01-17 09:43:14 +00:00
Ivan Kochurkin 8936220876 [IR] Implement IR actualizer and use it for K2 test and CLI scenario
Implement calculateExpectActualMap for Fir2IrComponents

^KT-51753 Fixed
2023-01-13 12:55:58 +00:00
Ivan Kochurkin 5d273ce839 [FIR & FIR2IR] Prepare test and CLI infrastructure to support MPP
- Move out getAnalyzerServices from FirFrontendFacade to TestSetupUtils
- Simplify DependencyListForCliModule. Now it takes BinaryModuleData as input
- FirOutArtifact contains several FirOutputArtifactPart
- Simplify FirFrontendFacade
2023-01-13 12:55:57 +00:00
Ilya Kirillov 644d1bf0d0 [FIR] ignore tests which fail because of resolve contracts violation 2022-12-12 16:21:07 +00:00
Mikhail Glukhikh 82f1535007 K1: fix IIOBE in expect-actual checker with different type parameter number
#KT-54827 Fixed
2022-11-17 22:28:04 +00:00
Ilya Chernikov 5b3816cce5 Test infra: refactor IGNORE_BACKEND directive
treat it as a general one, introduce *_K1 and *_K2 variants for
more specific ignoring
2022-11-12 16:28:23 +01:00
Ilya Kirillov 556b7894d5 [Low Level FIR] do not search for declarations from kotlin. package in source modules 2022-09-30 12:15:49 +02:00
Pavel Mikhailovskii 85ab8b4ce1 KT-53783 Prohibit "expect data object" syntax 2022-09-07 12:53:24 +00:00
Nikolay Lunyak be9e97d044 [FIR] Introduce ConeDynamicType 2022-06-02 13:47:23 +00:00
Ivan Kylchik 51ccc32a3f Update test data after introducing IntrinsicConstEvaluation annotation 2022-05-18 21:19:57 +03:00
Mikhail Glukhikh d01e6b61a3 FIR: don't report PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED in exp.cl.
#KT-51761 Fixed
2022-04-01 16:15:53 +03:00
Mikhail Glukhikh aaebb7a30e FIR: don't create delegated constructor call in expect
#KT-51756 Fixed
2022-04-01 16:15:53 +03:00
Dmitriy Novozhilov c116565c0e [FIR] Allow named arguments for calls of expect functions 2022-02-18 17:44:41 +03:00
Dmitriy Novozhilov ccb74b6477 [FIR] Fix computing compatibility of expect and actual modality 2022-02-18 17:44:39 +03:00
Dmitriy Novozhilov e1d21d7a37 [Test] Enable MultiPlatformProjects in multiplatform tests by default 2022-02-18 17:44:39 +03:00
Dmitriy Novozhilov 851305f981 [FIR] Allow smartcasts on member properties for classes from dependsOn dependencies 2022-02-18 17:44:37 +03:00
zhelenskiy c1dc1f7e33 Diagnostics renamed
Signed-off-by: zhelenskiy <zhelenskiy2000@yandex.ru>
2021-11-13 12:38:45 +01:00
Tianyu Geng 10d4dfef04 FIR: check subclass of sealed class 2021-08-25 14:37:24 +03:00
Ivan Kochurkin cd6384eb20 [FIR] Fix handling of WRONG_MODIFIER_TARGET
Implement DEPRECATED_MODIFIER, DEPRECATED_MODIFIER_FOR_TARGET, REDUNDANT_MODIFIER_FOR_TARGET
2021-08-13 18:32:27 +03:00
Ivan Kochurkin fd92b851a2 [FIR] Implement PACKAGE_OR_CLASSIFIER_REDECLARATION
Fix REDECLARATION positioning
2021-08-10 15:09:25 +00:00
Andrey Zinovyev 015c2d1875 [FIR] Add NOTHING_TO_INLINE diagnostic 2021-08-04 17:33:08 +03:00
Stanislav Erokhin 748a2d2e7c [MPP] Performance optimization in expect/actual checker
Previously, the checker executed for every declaration i.e. every
declaration was considered as expect declaration. Because of that in
some cases this checker could eat 6% of compilation time.
After this commit only declarations marked with expect or actual
are checked. To achieve that, logic, that do reporting about missing
actual modifier was moved to the Actual part.

Please note, that in cases where there is no expect/actual modifier at
all other errors (like redeclaration and missing body on "actual"
declaration) would be reported.

Useful nodes:
- In this checker reportOn is always the same as
descriptor.sourceElement.ktElement. This is because the only case when
it isn't true is PropertyAccessors and they are filtered
- Annotation constructor descriptor isActual == true all the time
- previously for weak incompatible members ACTUAL_MISSING
was not reported
- the logic here is super complicated and crazy, but I don't think that
there is sense to refactor it in the old FE
2021-08-04 15:19:34 +03:00
Ivan Kochurkin d4e1cded59 [FIR] Implement RESOLUTION_TO_CLASSIFIER 2021-07-28 23:18:38 +03:00
Dmitriy Novozhilov 9b3b386f0a [FIR IDE] Ignore HMMP compiler test 2021-07-20 10:33:54 +03:00
Dmitriy Novozhilov c3060e861f [FIR] Add expect actual checker 2021-07-20 10:33:49 +03:00
Denis.Zharkov ddbdfafa79 Remove OI/NI attributes from test data 2021-05-25 13:28:27 +03:00
Denis.Zharkov 2ecba6ac39 Remove WITH_NEW_INFERENCE directive from all tests
This directive anyway does not make test run twice with OI, and with NI
It only once run the test with specific settings (// LANGUAGE)
and ignores irrelevant (OI or NI tags)
2021-05-25 13:28:26 +03:00
Dmitriy Novozhilov e08df2c530 [Test] Add diagnostics and codegen tests with hmpp module structure 2021-05-19 00:52:31 +03:00
Dmitriy Novozhilov 06b2efe65f [Test] Introduce new syntax for dependsOn dependencies 2021-05-19 00:52:27 +03:00
zadorotskas 334d0a8b5a FIR: introduce three diagnostics for const val 2021-04-13 21:36:46 +03:00
Dmitriy Novozhilov 803d47daaa Distinguish classes from different sourcesets in SealedInheritorInSameModuleChecker
#KT-45848 Fixed
#KT-46031
2021-04-13 11:21:58 +03:00
Dmitriy Novozhilov a107e3d160 Support actualization of expect sealed class with typealias in CliSealedClassInheritorsProvider 2021-04-06 11:40:40 +03:00
Dmitriy Novozhilov 1633190478 Refine expect classes in CliSealedClassInheritorsProvider
KT-45796 Fixed
2021-04-06 11:40:36 +03:00
Tianyu Geng 761a0a7d0d FIR checkers: report specific errors instead of INAPPLICABLE_CANDIDATE
Specifically, the report the following 4 errors.

* NON_VARARG_SPREAD
* ARGUMENT_PASSED_TWICE
* TOO_MANY_ARGUMENTS
* NO_VALUE_FOR_PARAMETER

Also added/updated the following position strategies.
* NAME_OF_NAMED_ARGUMENT
* VALUE_ARGUMENTS
2021-04-02 14:36:14 +03:00
Dmitriy Novozhilov cd890d5833 [Test] Disable UNUSED_* diagnostics in tests which are not belong to contolFlowAnalysis suite 2021-03-29 16:12:29 +03:00
Tianyu Geng 56bec6997c FIR checker: report SUPERTYPE_NOT_INITIALIZED
Combined this and the checker of
SUPERTYPE_INITIALIZED_WITHOUT_PRIMARY_CONSTRUCTOR together.

Also fixed SUPERTYPE_INITIALIZED_WITHOUT_PRIMARY_CONSTRUCTOR incorrectly
repoted as warning instead of error.
2021-03-24 17:48:39 +03:00
Mikhail Glukhikh 9ce8420491 FIR: introduce not implemented checker 2021-03-24 16:07:25 +03:00
Mikhail Glukhikh a26a195c35 Add FIR_IDENTICAL to some tests 2021-03-24 16:02:09 +03:00
Ilmir Usmanov 3bcc2fe476 Minor. Add IDE MPP test 2021-03-22 11:13:14 +00:00
Ilmir Usmanov 164e9034d1 IC MPP: Allow expect value classes without @JvmInline
#KT-45525 Fixed
2021-03-22 11:13:13 +00:00
Tianyu Geng be0dd84a06 FIR: check NAMED_ARGUMENTS_NOT_ALLOWED
The check has already been partially implemented in
org.jetbrains.kotlin.fir.resolve.calls.FirCallArgumentsProcessor. This
change completes the missing piece that determines if a `FirFunction`
has stable parameter names.
2021-03-11 22:57:57 +03:00
Jinseong Jeon d2da15e039 FIR checker: report (expected|unnecessary) lateinit 2021-03-11 13:25:51 +03:00
eugenpolytechnic f6e564ffa6 FIR: introduce inline classes checks 2021-03-06 09:22:34 +03:00
Jinseong Jeon e009b71f88 FIR checker: report uninitialized member/extension properties 2021-03-04 17:56:29 +03:00