Commit Graph

106458 Commits

Author SHA1 Message Date
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
Ivan Kochurkin 115d685d91 [FIR] Fix ambiguity of Throws and other std annotations importing
Including `SharedImmutable` and `ThreadLocal`

Simplify code, remove `DefaultImportPriority.KOTLIN_THROWS`

Introduce `FirNativeClassMapper`
2023-11-23 23:51:23 +00:00
Pavel Punegov adf4f823ae [K/N][perf] Fix the fallback framework path in swift performance
After bootstrap update and the change that added /usr subdir to
absoluteTargetToolchain


Merge-request: KT-MR-13212
Merged-by: Pavel Punegov <Pavel.Punegov@jetbrains.com>
2023-11-23 18:37:18 +00:00
Svyatoslav Scherbina e5ae32c37a Native: remove bitcode embedding from tests
Xcode 14 deprecates bitcode embedding, and Xcode 15 removes support
for it. Therefore, testing bitcode embedding in Kotlin doesn't make
much sense.

This commit removes most of test code that enables bitcode.

^KT-61875
2023-11-23 18:36:59 +00:00
Ilya Goncharov 957d3c5610 [Gradle, JS] Use binaries for wasi with KotlinJsIrCompilation 2023-11-23 18:36:39 +00:00
Vladimir Sukharev 5ea59f57d6 [K/N] Verbose possible cinterop tool exceptions
^KT-59288
2023-11-23 18:36:00 +00:00
Yahor Berdnikau b000b3a90b [Gradle] Drop usage of non-LTS JDK versions in integration tests 2023-11-23 18:28:10 +00:00
Dmitrii Gridin 224b21b177 [LL FIR] LLFirTargetResolver: rename resolveDependencyTarget to resolveDependencies
^KT-63042
2023-11-23 15:55:07 +00:00
Dmitrii Gridin 5183019cb8 [LL FIR] resolve class before constructor
This is required to have stable resolution order to avoid concurrent
modifications and correct resolution context.
This also fixes KT-63700 as a super call expands only during body
resolution in the case of secondary constructor

^KT-63042
^KT-63700 Fixed
2023-11-23 15:55:07 +00:00
Dmitrii Gridin e3d91741ca [LL FIR] resolve class before delegate field
This is required to have stable resolution order to avoid concurrent
modifications and correct resolution context.
E.g., this commit fixes the resolution behavior of delegate field for
ANNOTATION_ARGUMENTS phase – now annotation argument resolves in the
correct scope

^KT-63042
2023-11-23 15:55:07 +00:00
Dmitrii Gridin 5a54520723 [FIR] add missed transformations for type annotations inside FirField
This issue doesn't affect the compiler because delegate field shares
annotation instance with the containing class, so it will be resolved
before field anyway.
In Low Level FIR we didn't notice this issue because we don't have
isResolved checks for type annotations (KT-63681)

^KT-63042
^KT-63681
2023-11-23 15:55:07 +00:00
Dmitrii Gridin 38c959ba5a [LL FIR] resolve original declarations before fake
This is required to have stable resolution order to avoid concurrent
modifications and correct resolution context.
E.g., this commit fixes the resolution behavior of fake override for
ANNOTATION_ARGUMENTS phase – now annotation argument resolves correctly.

We shouldn't do additional checks in the case of fake declaration
because they should be done on the original side

^KT-63042
2023-11-23 15:55:07 +00:00
Dmitrii Gridin ab26a02d19 [LL FIR] resolve generated property before copy
This is required to have stable resolution order to avoid concurrent
modifications

^KT-63042
2023-11-23 15:55:07 +00:00
Dmitrii Gridin c31d860f10 [FIR] LightTreeRawFirBuilder: add copyWithNewSourceKind for generated copy
This is done for consistency

^KT-63042
2023-11-23 15:55:07 +00:00
Dmitrii Gridin 9d72c1c370 [FIR] builder: drop unused forcedElementSourceKind
There was only one usage by withDefaultSourceElementKind that was
dropped in the previous commit

^KT-63042
2023-11-23 15:55:07 +00:00
Dmitrii Gridin 6c1f5b7a74 [FIR] PsiRawFirBuilder: reuse type for copy from generated property
Previously, this call was required to avoid sharing to have independent
instances with their own resolution cycle. Now we will have stable
order (in the next commit), so it is possible to share instances.
Also, this change makes the logic consistency with Light Tree

^KT-63042
2023-11-23 15:55:07 +00:00
Dmitrii Gridin a79cef08b5 [LL FIR] resolve generated property before componentN
This is required to have stable resolution order to avoid concurrent
modifications.
Another point here – status phase logic for componentN function is
located in the corresponding property resolution

^KT-63042
2023-11-23 15:55:07 +00:00
Dmitrii Gridin 5fa516e010 [LL FIR] resolve constructor parameter before generated property
This is required to have stable resolution order to avoid concurrent
modifications

^KT-63042
2023-11-23 15:55:06 +00:00
Dmitrii Gridin 6ecaccbcfe [FIR] PsiRawFirBuilder: reuse type for property from constructor parameter
Previously, this call was required to avoid sharing to have independent
instances with their own resolution cycle. Now we will have stable
order (in the next commit), so it is possible to share instances.
Also, this change makes the logic consistency with Light Tree

^KT-63042
2023-11-23 15:55:06 +00:00
Dmitrii Gridin 8dacd41818 [LL FIR] introduce lazy resolve tests for type annotations
From one side to check how annotation propagation works and from another
side to cover scenarios with lazy resolution from type position as it is
a valid case of usage in Analysis API (KtFirAnnotationListForType)

^KT-63042
2023-11-23 15:55:06 +00:00
Dmitrii Gridin 689fe28efa [FIR] FirScriptSymbol: add stable toString
It will be used in tests

^KT-63042
2023-11-23 15:55:06 +00:00
Svyatoslav Kuzmich b3bc99a44a [Build] Use impl dependencies for compiler.common.{web,wasm}
Refactor build scripts to use implementation dependencies instead of api
for finer grained recompilations.
2023-11-23 15:52:55 +00:00
Ivan Kochurkin a04deba7c7 [FIR] Fix compiler crash with incorrect argument in FirDanglingModifierList
KT-63508 Fixed
2023-11-23 15:25:44 +00:00
Tatiana Bogdanova fc5239bdfd Add changelog for 1.9.21 2023-11-23 14:36:56 +00:00
Kirill Rakhman 11ab90ecbd [Tests] Add regression test for #KT-63732 2023-11-23 14:24:47 +00:00
Kirill Rakhman 9ea4afe7c8 [FIR] Fix isValidTypeParameterFromOuterDeclaration check for local class
This fixes an IllegalArgumentException when
symbolProvider.getClassLikeSymbolByClassId is called with a local
class ID.

#KT-63656 Fixed
2023-11-23 14:24:47 +00:00
Marco Pennekamp a703f5afb8 [LL] Use emptyMap() for empty FileStructureElementDiagnosticLists
- This improves the memory usage of `FileStructureElementDiagnosticList`
  by avoiding lots of duplicate empty mutable maps. We can assume that
  most diagnostics lists are empty, since code is usually green.
- I tested the memory consumption manually by opening all files in
  `org.jetbrains.kotlin.idea.k2.codeinsight.inspections` and waiting for
  analysis to finish for each file. With the change, the retained size
  of `FileStructureElementDiagnosticList` shrank from 63.39kB to
  13.77kB.
2023-11-23 14:00:43 +00:00
Sebastian Sellmair 59c4c83ed5 [K/N] Samples: Update samples default Kotlin version to 1.9.20 2023-11-23 13:19:04 +00:00
Sebastian Sellmair 359f5fe7b3 [K/N] Samples: Migrate 'echoServer' to modern multiplatform
^KT-50547 Fixed
2023-11-23 13:19:04 +00:00
Anastasia.Nekrasova 97ef2de6e3 [K2] OPT_IN_USAGE_ERROR is absent when calling the enum primary constructor
^KT-63459
2023-11-23 13:16:05 +00:00