Commit Graph

4496 Commits

Author SHA1 Message Date
Jinseong Jeon 0dfaa91970 K2 UAST: simplify PSI declaration provider
In addition to class lookup (done at cec299ac), we can use
JavaFileManager to search classes in a certain package too.
2024-01-23 09:09:37 +00:00
Nikolay Lunyak c55a7dd038 [FIR] Add SAFE_CALLABLE_REFERENCE_CALL
^KT-59835
2024-01-23 08:46:29 +00:00
Nikolay Lunyak 4fed4b6640 [FIR] Add more tests for RESERVED_SYNTAX_IN_CALLABLE_REFERENCE_LHS
It's a bit hard to reason about how different
diagnostics correspond to one another from
the existing tests.

^KT-59835
2024-01-23 08:46:29 +00:00
Pavel Kirpichenkov 8fbe376f25 [IDE, JS] Fix tests for asDynamic
Register JS configurator in tests for library sources
Ignore FE10 because of KTIJ-28546

KTIJ-27571
2024-01-22 18:28:24 +00:00
Pavel Kirpichenkov ed8d3092cd [IDE, JS] Add regression test for KTIJ-27571
Reference resolve for kotlin.js.asDynamic
2024-01-22 18:28:24 +00:00
Pavel Kunyavskiy 09713bb89e [Fir2IR] Don't add invisible fake overrides to Lazy class
^KT-65056
2024-01-22 13:30:05 +00:00
Vladimir Sukharev 39e2187d31 [K/N][Tests] Split filecheck part from test direct.kt
^KT-61259
2024-01-19 18:31:25 +01:00
Jinseong Jeon e91e5db0ce AA FIR: build argument mapping for SAM conversion node
^KT-64910 fixed
2024-01-19 17:05:06 +00:00
Ilya Chernikov d6c9a492ad K2 Scripting: disable K2 lightTree-based script tests
they were enabled by mistake and do not work properly until
LT parsing is implemented
depends on #KT-60127
2024-01-19 15:54:54 +00:00
Ilya Chernikov a5c2eb66a2 K2 Scripting: add missing contracts resolving in scripts
#KT-64074 fixed
2024-01-19 15:54:53 +00:00
Ilya Chernikov 3b70b3d92d K2 Scripting: restore some codegen scripting tests for K2 2024-01-19 15:54:53 +00:00
Mikhail Glukhikh ae6aef3a63 K2: reproduce KT-65111 2024-01-19 15:52:14 +00:00
Sergej Jaskiewicz bc5810ee67 [FIR2IR] Don't use descriptor manglers in FIR2IR
They don't do anything, only complicate the initial configuration.

KT-64990
2024-01-19 13:36:00 +00:00
Sergej Jaskiewicz 8b4cc050eb [FIR2IR] Remove linkViaSignatures from Fir2IrConfiguration
^KT-64809 Fixed
2024-01-19 13:36:00 +00:00
Alexander Udalov b2c30921e4 JVM: support JVM-specific primitive/wrapper type overridability check
#KT-62045 Fixed
2024-01-19 12:30:48 +00:00
Pavel Kirpichenkov 6deb679e5c [LL] Fix incorrect KMP groups in case of reordered dependencies
KTIJ-27569
2024-01-19 10:20:52 +00:00
Pavel Kirpichenkov 98e3813af9 [LL] Add error recovery to KmpModuleSorter
KTIJ-27569
2024-01-19 10:20:52 +00:00
Pavel Kirpichenkov 24b19e3c32 [LL] Add test for KmpModuleSorter
KTIJ-27569
2024-01-19 10:20:52 +00:00
Pavel Kirpichenkov ce3c05500e [LL] Sort modules from the same KMP project in symbol providers
Sort dependency modules topologically if they belong to the same KMP
project, preserving their relative positions. Sorting all modules and
changing positions of unrelated modules can be harmful: in the case of
a classpath hell, IDE results can become different from runtime
behavior. Sorting in place can help to avoid this problem, because
conflicting declarations shouldn't be allowed in different source sets
of the same multiplatform project.

KTIJ-27569
2024-01-19 10:20:52 +00:00
Yan Zhulanow 50203adb72 [Analysis API] Minor, add KDoc for 'ContextCollector.Context' 2024-01-18 17:12:28 +00:00
Yan Zhulanow e393282c67 [Analysis API] Remove test infrastructure for obsolete on-air analysis 2024-01-18 17:12:28 +00:00
Yan Zhulanow 8c5c40760b [Analysis API] Minor, remove mentions of on-air analysis in KDoc 2024-01-18 17:12:28 +00:00
Yan Zhulanow 2c4fbb1eb1 [Analysis API] Minor, move out fallback computation for designation path 2024-01-18 17:12:28 +00:00
Yan Zhulanow 5d7f54500f [Analysis API] Remove 'FirTowerContextProvider'
The only implementation of 'FirTowerContextProvider' that is not
obsolete is inside the reference shortener.
2024-01-18 17:12:28 +00:00
Yan Zhulanow 9227359256 [Analysis API] Remove components of obsolete on-air analysis
On-air analysis only worked correctly inside declaration bodies, and
required special handling ('analyzeInDependedAnalysisSession()').
Dangling files, the on-air replacement, works seamlessly, and it is
available in all contexts.
2024-01-18 17:12:28 +00:00
Yan Zhulanow 9021fdaf83 [Analysis API] Remove obsolete dependentCopy tests 2024-01-18 17:12:28 +00:00
Yan Zhulanow 08727bf0be [Analysis API] Add more ContextCollector tests inspired by dependentCopy
As the on-air analysis is obsolete, related tests are going to be
deleted. Here we add cases not yet covered by 'ContextCollector' tests.
2024-01-18 17:12:28 +00:00
Yan Zhulanow 0502da474b [Analysis API] Load scripting extensions for script dangling files
The commit fixes failing 'ContextCollectorScriptTestGenerated'
for dangling file copies.
2024-01-18 17:12:28 +00:00
Yan Zhulanow e47f505eb9 [Analysis API] Use 'ContextCollector' in implicit receiver type provider
'getTowerContextProvider()', which operates on top of obsolete on-air
analysis can be replaced with more robust 'ContextCollector'.
2024-01-18 17:12:28 +00:00
Yan Zhulanow 74db837b7d [Analysis API] Remove obsolete on-air resolution tests 2024-01-18 17:12:28 +00:00
Yan Zhulanow a848a0233d [Analysis API] Add more ContextCollector tests inspired by on-air tests
As the on-air analysis is obsolete, related tests are going to be
deleted. Here we add cases not yet covered by 'ContextCollector' tests.
2024-01-18 17:12:28 +00:00
Yan Zhulanow f9c7ca3bdc [Analysis API] Test 'IGNORE_SELF' mode in context collector tests
Parent declarations of the file copy are typically unresolved in the
'IGNORE_SELF' mode, as the declaration designation contains declarations
from the original file.
2024-01-18 17:12:28 +00:00
Yan Zhulanow adb8b7b252 [Analysis API] Minor, improve naming for 'computeTestDataPath()' 2024-01-18 17:12:28 +00:00
Ilya Kirillov 7773fdab9a [LL FIR] refactoring, extract duplicated code from LLFirAbstractSessionFactory 2024-01-18 15:43:52 +00:00
Ilya Kirillov 46d5d512e5 [LL FIR] refactoring, remove repeated logic of registering default components in inheritors of LLFirAbstractSessionFactory 2024-01-18 15:43:52 +00:00
Ilya Kirillov 3a90cb00c7 [LL FIR] reuse the same function for registering K/N FIR session components as in the compiler
So, if a new component is registered in the compiler, it's not forgotten for the LL FIR

This registers `FirDelegatedMembersFilter` for K/N modules and fixes KT-64528

^KT-64528 fixed
2024-01-18 15:43:52 +00:00
Ilya Kirillov f203d2d731 [LL FIR] refactoring, reuse the same function for registering JS FIR session components as in the compiler
So, if a new component is registered in the compiler, it's not forgotten for the LL FIR
2024-01-18 15:43:52 +00:00
Kirill Rakhman 582dd1d3c0 [FIR] Only don't approximate nested captured arguments if they have recursive supertypes
This fixes a compiler crash
IllegalStateException: Captured type for incorporation shouldn't escape
from incorporation

The crash occurs when a captured type with status FOR_INCORPORATION
is two layers deep inside a captured type with status FROM_EXPRESSION.
We first check if approximation is required for the most outer captured
type in AbstractTypeApproximator.approximateCapturedType.
Then we encounter the second captured type with status FROM_EXPRESSION
in AbstractTypeApproximator.approximateParametrizedType.
At this point, we stop checking and miss the third captured type with
status FOR_INCORPORATION.

Unfortunately, we can't check recursively if nested captured types
need to be approximated because of types with recursive super types
(the original reason why the extra check was introduced).
That's why we restrict the second check to types with recursive
super types, effectively restoring the previous behavior for all other
types.

#KT-65050 Fixed
2024-01-18 09:22:15 +00:00
anzhela.sukhanova 7587f73846 [Test] KT-61937: add tests with context functions and naming clash
Update tests for ^KT-61937


Merge-request: KT-MR-13678
Merged-by: Anzhela Sukhanova <anzhela.sukhanova@jetbrains.com>
2024-01-18 08:27:31 +00:00
Kirill Rakhman e91e9d8ca8 [FIR] Don't lose error level enhancements in warning-level-enhanced arguments
The error-level enhancement is kept as warning-level and a new
LanguageFeature is introduced to turn the warning into an error.

#KT-63208 Fixed
#KT-63209

(cherry picked from commit 371b1eb3d5)
2024-01-18 08:27:10 +00:00
Kirill Rakhman c39262195d [FIR] Let attributes opt-in to participating in ConeClassLikeTypeImpl structural equality
This is required for EnhancedTypeForWarningAttribute because scopes
should not be reused between cone types with different values of
this attribute.

#KT-63208

(cherry picked from commit 9189154cae)
2024-01-18 08:27:10 +00:00
Mikhail Glukhikh e999e289ee K2: split EXPLICIT_TYPE_ARGUMENTS_IN_PROPERTY_ACCESS to property/objects
Related to KT-64982
2024-01-17 16:51:48 +00:00
Mikhail Glukhikh caa850e470 FIR: render resolved qualifier type arguments in dumps 2024-01-17 16:51:48 +00:00
Mikhail Glukhikh 0a21669fb9 K2: reproduce KT-64982 2024-01-17 16:51:48 +00:00
Roman Efremov 3d2a37ee41 [Test] Write reproducer test for expect-actual matching to Java field
..., which comes from super class, which incorrectly works in K2.

^KT-63624
2024-01-17 14:47:41 +00:00
Nikita Bobko 0dc8629312 [FIR] Don't report MUST_BE_INITIALIZED on private open properites
^KT-59074 Fixed

This solution is not ideal. Ideally, the allopen compiler plugin
shouldn't report `private` properites as `open` KT-64980, but it will
unpredictably break other things.
2024-01-17 14:18:06 +00:00
Alexander Udalov 35caae355d Tests: minor, add box test for KT-31367/KT-61805
For some reason, codegen box test was not added in 082c337faa. The main
point of it now is to check that everything works correctly in the
IrFakeOverrideBuilder mode.
2024-01-17 12:27:36 +00:00
Nikolay Lunyak a4b7697714 [FIR] Reproduce KT-63529
^KT-63529
2024-01-17 11:31:26 +00:00
Roman Golyshev 6884266328 KTIJ-27841 [AA] Add explicit containingFile to ElementsToShortenCollector
This simplifies the code in a few places, and also allows to avoid
retrieving the `containingKtFile` from the PSI elements
2024-01-17 10:15:28 +00:00
Roman Golyshev 646cdb56e5 KTIJ-27841 [AA] Do not import and shorten class constructor if it will alter other references in the file
N.B. This implementation does not 100% prevent conflicts or resolve
alterations when shortening functions.
To guarantee that,
we would need to carefully consider all the references in the file,
and to check whether they have changed their resolve in the presence
of a new import.
This is not trivial and will be approached separately under a different
task.

^KTIJ-27841 Fixed
2024-01-17 10:15:28 +00:00