Commit Graph

106487 Commits

Author SHA1 Message Date
Dmitriy Novozhilov 039baf95fc [Test] Add empty platform module for MPP diagnostic test with only one module
After previous commits IrActualizer runs only there are at least two modules
  in backend input. So to check diagnostics from Actualizer all tests
  should contain at least two modules

Diagnostics in test `extendExpectedClassWithAbstractMember.kt` were
  changed because there is an exception from IrActualizer caused by
  errors from frontend (`ABSTRACT_METHOD_NOT_IMPLEMENTED`), which is
  swallowed by this kind of tests
2023-11-27 10:17:54 +00:00
Dmitriy Novozhilov 62d269b3b9 [AA] Use convertToIrAndActualize in KtFirCompilerFacility
It was the last place that manually called parts of fir2ir
2023-11-27 10:17:54 +00:00
Dmitriy Novozhilov ffe5b4c40d [Test] Update some IR dumps after previous changes
Now IR dump handlers receiver actualized IR with removed expected
  declarations, so corresponding tests should be updated accordingly
2023-11-27 10:17:54 +00:00
Dmitriy Novozhilov 48c3313e67 [Test] Inline processAllIrModuleFragments utility
After previous changes IR output artifact contains only one IrModuleFragment
2023-11-27 10:17:54 +00:00
Dmitriy Novozhilov 06af6adf4f [Test] Unify all fir2ir facades for non-jvm platforms
Setup of fir2ir for JS, Native and Wasm is very similar, so it makes
  sense to extract all common parts of it into common base facade
2023-11-27 10:17:54 +00:00
Dmitriy Novozhilov e38b25c278 [FIR2IR] Make convertAndActualize method the only entrypoint to fir2ir
Fir2Ir conversion consists of multiple steps with complex logic (like
  conversion of each module, actualization, plugins application, constant
  evaluation), and to ensure that they all are executed correctly it's
  convenient to have the single entry point for all this machinery
2023-11-27 10:17:54 +00:00
Dmitriy Novozhilov 075010b14e [Test] Get rid of some properties in IrBackendInput
`fir2IrComponents`, `irActualizerResult` and `dependentIrModuleFragments`
  were used in `IrActualizerAndPluginsFacade`, which was removed in the
  previous commit
2023-11-27 10:17:54 +00:00
Dmitriy Novozhilov 1303a33bea [Test] Get rid of IrActualizerAndPluginsFacade
IR actualization and IR plugins will be moved into base Fir2Ir facades
  in the following commits, so this facade is not needed anymore

It was easier and cleanlier to remove this facade first and only after
  that modify base facades
2023-11-27 10:17:54 +00:00
Sebastian Sellmair ddd97e84b9 [K/N] Implement lightweight tests for ObjC header generation 2023-11-27 09:08:54 +00:00
Kirill Rakhman 06811dfc2f [FIR] Add enum entry to body resolve context containers
This fixes processing of annotations on enum entries.
Before, the check in BodyResolveContext.forAnnotation would set the
tower data mode to CLASS_HEADER_ANNOTATIONS because no containers were
present.
This would lead to some tower data elements like nested classifiers
missing, which would lead to false positive unresolved references.

#KT-63761 Fixed
2023-11-27 09:00:17 +00:00
Anton Lakotka bb5e219c1d [Gradle] Explain reason for (isCanBeResolved && isCanBeConsumed) check 2023-11-26 18:47:29 +01:00
Anton Lakotka 7673434ccd [Gradle] Keep "-publishable" configurations as dependencyScope
As they would clash with the ones that is intended to be consumed as
project dependencies. It will not be compatible with future Gradle
versions. This should be fixed with KT-49919

^KT-60879
2023-11-26 18:47:29 +01:00
Anton Lakotka e73441843b [Gradle] Don't make native compilation api configuration resolvable
Instead, create a resolvableDetached configuration for that purpose.
Changing configuration roles is deprecated since Gradle 8.2

^KT-60879
2023-11-26 18:47:29 +01:00
Anton Lakotka 5d46e45da7 [Gradle] Fix tests for Gradle 8.2 compatibility
* Dependency scope configurations can't have attributes
* ConfigurationInternal.path is removed

^KT-60879
2023-11-26 18:47:29 +01:00
Anton Lakotka 2ab30d8880 [Gradle] Add role-based configuration method factories
Starting from Gradle 8.2 there is deprecation diagnostic that
disallows changing configuration roles after creation.

With Gradle 8.4 there is an Incubating API that introduces
role factories for Configuration. For consistency reasons names that
introduced in this commit match the names that Gradle introduces in 8.4
version.

^KT-60879
2023-11-26 18:47:29 +01:00
Abduqodiri Qurbonzoda e94b247835 Introduce Common StringBuilder.append/insert(Byte/Short) extensions #KT-63341 2023-11-26 02:48:19 +02:00
Abduqodiri Qurbonzoda db6a662631 Remove Common StringBuilder.append/insert(Byte/Short) members #KT-63341 2023-11-26 02:48:18 +02:00
Aleksei.Cherepanov c002af6365 Make plugin classpath serialization path agnostic
This is needed for correct usage of portable caches

^KT-63799 Fixed
2023-11-25 10:46:49 +00:00
Aleksei.Cherepanov ea85b30f88 Make CompilerSettings open to add listeners on IJ side
Workspace Model will return a copy of CompilerSettings instead of reference to the original one. Thats why we need to add listeners on it on IJ side

Relates to KTIJ-24647
2023-11-24 22:58:13 +00:00
Artem Kobzar 55d41db2ce [K/JS] Include jsFirEs6Test into jsFirCompilerTest tests 2023-11-24 22:09:43 +00:00
Mikhail Glukhikh e391e68ea3 K2: drop TypeParameterAsCallable check for reified in ::class
Related to KT-63377
2023-11-24 21:28:16 +00:00
Mikhail Glukhikh 83cfcc30c6 K2: handle type parameter vs nested class conflict in body resolve properly
This commit does two things:
- prioritize type parameter scopes against static scopes in body resolve
(effectively it's a revert of KT-58028 fix)
- consider type parameters as inapplicable callable, so during callable
resolve we can go up the tower and still resolve to static scope

This allows both KT-58028 and KT-63377 to work properly
#KT-63377 Fixed
2023-11-24 21:28:16 +00:00
Mikhail Glukhikh 4e938d852c K2: add some more tests around KT-63377 and KT-58028 2023-11-24 21:28:16 +00:00
Mikhail Glukhikh 99234ef1c5 K2: reproduce KT-63377 (+ consider some more cases) 2023-11-24 21:28:16 +00:00
Alexander Udalov 2d76c7b05d Generators: reduce verbosity when logging which files are generated
It made it a bit difficult to see which tests were affected when running
generateTests.
2023-11-24 19:48:09 +00:00
Nikita Bobko 6f17022449 [FIR] Cleanup: extract reportClassScopesIncompatibility into its own function
Review: https://jetbrains.team/p/kt/reviews/13094/timeline
2023-11-24 18:02:49 +00:00
Nikita Bobko 7166adb179 [FIR, IR] Convert FirDefaultArgumentsInExpectActualizedByFakeOverrideChecker into ExpectActualCheckingCompatibility
FirDefaultArgumentsInExpectActualizedByFakeOverrideChecker is an adhoc
checker which can be converted to ExpectActualCheckingCompatibility to
reuse common expect-actual checking infrastructure.

^KT-62913 Fixed
Review: https://jetbrains.team/p/kt/reviews/13094/timeline

Tests that were broken by one of my previous commits are now fixed:
- actualFakeOverride_paramsAreCompatibleViaSharedMethodWithDefaultParams.kt
- inheritedJavaMembers.kt

DEFAULT_ARGUMENTS_IN_EXPECT_ACTUALIZED_BY_FAKE_OVERRIDE diagnostic
disappeared in delegation.fir.kt because only one
AbstractExpectActualChecker incompatibility can be reported at a time
(DEFAULT_ARGUMENTS_IN_EXPECT_ACTUALIZED_BY_FAKE_OVERRIDE is now reported
not by adhoc checker but by common AbstractExpectActualChecker). It
would be nice to report both of them, but it's a separate issue KT-62631

delegation2 test makes sure that
DEFAULT_ARGUMENTS_IN_EXPECT_ACTUALIZED_BY_FAKE_OVERRIDE is reported when
NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS is fixed
2023-11-24 18:02:49 +00:00
Nikita Bobko c8a9928624 [FIR] Deduplicate isFakeOverride
Reuse isFakeOverride from ExpectActualMatchingContext. It does the same
thing

Review: https://jetbrains.team/p/kt/reviews/13094/timeline
2023-11-24 18:02:48 +00:00
Nikita Bobko 5b72c127bd [FIR, IR] Commonize isFakeOverride check for AbstractExpectActualAnnotationMatchChecker
This commit fixes fakeOverrides.fir.kt test that got broken in the
previous commit

Previously isFakeOverride was only checked on IR backend. Now this check
is moved to AbstractExpectActualAnnotationMatchChecker which is used by
both: frontend and backend. That's why frontend no longer reports false
positive ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT

Review: https://jetbrains.team/p/kt/reviews/13094/timeline
2023-11-24 18:02:48 +00:00
Nikita Bobko e6bfcc7c65 [FIR] 2/2 update testData
This tests started failing after the previous commit. I extract this
change into a separate commit to make it obvious that appeared
diagnostics is not an expected behavior. I will fix these tests in the
following commits

Review: https://jetbrains.team/p/kt/reviews/13094/timeline
2023-11-24 18:02:47 +00:00
Nikita Bobko a1ce8ac175 [FIR] 1/2 match and check expect fake-overrides vs actuals
^KT-63550 Fixed
Review: https://jetbrains.team/p/kt/reviews/13094/timeline

Now it's required to create a new ScopeSession when searching for expect
members for actuals. If you keep reusing actualScopeSession then members
declared in platform may "slip into" the search results, resulting an
incorrect expect for actual (e.g. it happens in
supertypeIsExpectActual_covariantOverrideOfInjectedFromSuper_transitiveSubstitutionFakeOverride.fir.kt)

I suppose that it always has been a bug that we reused
actualScopeSession because we were mixing actualScopeSession and
expect FirSession (which is a bad idea), but we simply didn't have cases
where this bug could be observed. Now after we started matching
fake-overrides, we have such cases.

But creating a new ScopeSession every time is a suboptimal solution. We
need to design a scope caching KT-63773
2023-11-24 18:02:47 +00:00
Nikita Bobko 5aa0475aa7 [KMP] Fix incorrect transitiveSuperclassActualization_java.kt test
Review: https://jetbrains.team/p/kt/reviews/13094

I made the test to look like transitiveSuperclassActualization.kt

`actual typealias A = A_J` is incorrect because `A` isn't expect

If I kept the test "as it's", then it would become red once KT-63550 is
fixed
2023-11-24 18:02:47 +00:00
Nikita Bobko 216006c504 [FIR] NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS: report both mismatches and incompatibilites
This commit is a preparation step for KT-59887. For now,
expectActualInlineClass.fir.kt became slightly more verbose. Once is
KT-59887 fixed, the verbosity will go away. Because we won't report
incompatibilites mismatches for ACTUAL_MISSING declarations

Review: https://jetbrains.team/p/kt/reviews/13094/timeline
2023-11-24 18:02:46 +00:00
Nikita Bobko 93cf68a08d [IR] IrExpectActualAnnotationMatchingChecker: add elaboration comment
Review: https://jetbrains.team/p/kt/reviews/13094/timeline
2023-11-24 18:02:46 +00:00
Nikita Bobko 584c353a44 [FIR, IR] shouldCheckAbsenceOfDefaultParamsInActual: update comment
Fixing KT-61105 won't help.
Review: https://jetbrains.team/p/kt/reviews/13094/timeline
2023-11-24 18:02:45 +00:00
Sergej Jaskiewicz 4307e76f15 [FIR/IR generator] Remove visitSuperTypeByDefault from visitor printers
This property is FIR-specific, no need to use it in the generic printer.
2023-11-24 17:29:58 +00:00
Sergej Jaskiewicz a5b5492b2d [IR generator] Simplify configuration of visitor parents
Don't specify a visitor parent manually for each IR node,
use an algorithm instead.
2023-11-24 17:29:58 +00:00
Sergej Jaskiewicz 62d32471e1 [FIR generator] Extract BaseTransformerTypeFinder into the common module
We want to use it in other tree generators.
2023-11-24 17:29:58 +00:00
Anastasia.Nekrasova 7787b53b4a [K2] Disappeared UNSUPPORTED
Forbid callable reference to coroutineContext

^KT-59881
2023-11-24 15:59:04 +00:00
Alexander Udalov daac8603d0 Fir2Ir: build fake overrides for abstract methods from Any
This call to isAbstractMethodOfAny was in Fir2IrLazyClass since its
inception in 0622be14a5, and there's no explanation why this was
necessary. Removing it does not seem to break anything, but fixes the
case when IrFakeOverrideRebuilder is enabled and when Java base class
declares an abstract equals/hashCode/toString which is not overridden in
the Kotlin subclass.

 #KT-63443 Fixed
2023-11-24 14:48:10 +00:00
Alexander Udalov b63a780e15 Build: update kotlinx-metadata-jvm to 0.7.0 2023-11-24 14:03:21 +00:00
Roman Golyshev 644e29a2ea Revert "KT-61890 [AA] Use ContextCollector in KtFirScopeProvider"
This reverts commit 47a00bf9

See KTIJ-27918
2023-11-24 11:21:15 +00:00
Ilya Goncharov f9ffe67430 [Gradle, JS] Add comment why we use project.provider and not use single 2023-11-24 11:17:49 +00:00
Philip Wedemann 1dbb227de2 KT-63544: Fix Gradle CC problem in KotlinJsIrLink 2023-11-24 11:17:49 +00:00
Kirill Rakhman 31256e259e [FIR] Fix lower bound of flexible type variable not becoming DNN in warning-severity case
The bug was introduced as part of the implementation for Java
nullability warnings.

#KT-58933 Fixed
2023-11-24 11:00:10 +00:00
Kirill Rakhman 711e7ce8d7 [FIR] Add regression test for overriding Java with DNN without annotations
#KT-58933 Related
2023-11-24 11:00:10 +00:00
Kirill Rakhman ad3da48f55 [FIR] Remove redundant special cases from FirStandardOverrideChecker
AbstractTypeChecker.equalTypes already handles the same special cases.
2023-11-24 11:00:10 +00:00
Kirill Rakhman 4882ac6599 [FIR] Fix duplicate WRONG_NULLABILITY_FOR_JAVA_OVERRIDE
Also, the test shows a missing warning in K1 which is present in K2.

#KT-63600 Fixed
#KT-63599
#KT-63745
#KT-63746
2023-11-24 11:00:10 +00:00
Artem Olkov 54c2339dfb [Analysis API] [Test Infra] move (de)compilation services
move (de)compilation services from static dependencies into DI
This is done for allowing different (de)compile strategies in the future


Merge-request: KT-MR-13213
Merged-by: Artem Olkov <artem.olkov@jetbrains.com>
2023-11-24 10:58:49 +00:00
Ilya Gorbunov 88bbe8d92d [stdlib] Enable explicit API mode 2023-11-24 01:45:45 +00:00