Pavel Mikhailovskii
164cbc9968
KTIJ-24768 Fix IllegalArgumentException in KtType.isPrimitiveBacked
2023-03-10 11:03:45 +00:00
Kirill Rakhman
0e721c8fc2
[FIR2IR] Fix generation of val initialization after smart-cast
...
If neither setter nor backing field were found for an assignment call,
search overridden properties for backing fields.
^KT-57105 Fixed
2023-03-10 09:30:51 +00:00
Kirill Rakhman
2706e5502f
[Tests] Add IR text tests for KT-57105
2023-03-10 09:30:51 +00:00
Marco Pennekamp
f9fb718b37
[AA] KT-56617 Optimize deprecation calculation for Java class symbols
...
- Most Java classes aren't deprecated. To avoid building `firSymbol`
in such cases, this commit adds a simple heuristic which checks the
class's annotations for the presence of one of the deprecation
annotations recognized by the Kotlin compiler.
- Note that annotations are compared via simple names, so there is a
slight margin of error. However, comparing class IDs is more costly in
my tests, because getting an annotation's class ID is not as cheap as
getting its simple name.
2023-03-09 18:35:59 +00:00
Marco Pennekamp
1c46d37663
[AA] KT-56617 Build FirClassSymbols for Java classes lazily
...
- Some completion performance tests (e.g. IntelliJ: "empty place typing
with library cache") spent a considerable amount of time in
`KtFirSymbolProviderByJavaPsi.getNamedClassSymbol`.
- This commit introduces `KtFirPsiJavaClassSymbol`, which implements
many `KtNamedClassOrObjectSymbol` properties with the `PsiClass`
instead of the FIR class. The `FirClassSymbol` is built only when
necessary. This improves performance when no "slow" properties need to
be computed for the symbol.
^KT-56617 fixed
2023-03-09 18:35:56 +00:00
Marco Pennekamp
9cc6809ec6
[FIR] Fix JavaClass.modality for annotation classes and enums
...
- `JavaClass.modality` should return the correct modality instead of
requiring the caller to handle annotation classes and enums.
2023-03-09 18:35:56 +00:00
Kirill Rakhman
d7880eb12c
[FIR] Refactor SpecificityComparisonWithNumerics
2023-03-09 13:00:54 +00:00
Kirill Rakhman
fa432d7f0d
[FIR] Prioritize double over float in overload resolution
...
#KT-57194 Fixed
2023-03-09 13:00:53 +00:00
Dmitriy Novozhilov
d5e6102ed9
[FIR] Properly check is some setter function is applicable for synthetic property
...
^KT-56506 Fixed
2023-03-09 12:32:49 +00:00
Nikolay Lunyak
f39467b4ba
[FIR] KT-57175: Expand typealiases in the annotation class checker
...
^KT-57175 Fixed
2023-03-09 09:44:09 +00:00
Nikolay Lunyak
5cbe699fc4
[FIR] KT-56876: Ensure inner type classifiers are resolved in contracts
...
^KT-56876 Fixed
2023-03-09 09:43:03 +00:00
Nikolay Lunyak
c156dfe855
[FIR] KT-56877: Allow checking types of containing classes in contracts
2023-03-09 09:43:03 +00:00
Nikolay Lunyak
c7a71fec17
[FIR] KT-56877: Allow referencing implicit receivers in class contracts
2023-03-09 09:43:02 +00:00
Nikolay Lunyak
409249267c
[FIR] Ensure this@label doesn't work in K2
2023-03-09 09:43:02 +00:00
Nikita Bobko
62d2327ca3
Don't issue a warning about expect/actual in the same module for incompatible expect/actual pairs
...
^KT-57067 Fixed
Review: https://jetbrains.team/p/kt/reviews/9123
2023-03-09 09:30:29 +00:00
Mikhail Glukhikh
af78ef77b4
K2: don't accept reflective function kinds as possible lambda type
...
#KT-56954 Fixed
2023-03-09 08:52:46 +00:00
Mikhail Glukhikh
7a6ff5de34
K2: add test for KT-56954
2023-03-09 08:52:46 +00:00
Kirill Rakhman
f946ddeb40
[FIR] Implement checks for contract not allowed
...
^KT-55423 Fixed
2023-03-09 08:32:02 +00:00
Kirill Rakhman
b2fbf8bed5
[FIR] Fix callable reference adaptation for overrides without defaults
...
Provide the correct scope to the argument mapping so that default values
in overridden functions are considered.
^KT-56864 Fixed
2023-03-09 08:26:16 +00:00
Kirill Rakhman
81f858a3c4
[FIR] Require not-null source in buildImplicitTypeRef
...
KT-56906
2023-03-08 16:20:26 +00:00
Kirill Rakhman
04d57eb2f9
[FIR] Use cached instance of FirImplicitTypeRefImpl
...
^KT-56906 Fixed
2023-03-08 16:20:25 +00:00
vladislav.grechko
17e6099b53
Initialize 'source' property of FirCatch objects properly
...
^KT-56923: Fixed
^KT-56755: Fixed
2023-03-08 12:03:35 +00:00
Kirill Rakhman
83845fbab5
[FIR] Only add non-subsumed to overridden of intersection override
...
If an intersection override overrides members A.x, B.x and C.x and
B <: A, then A.x is subsumed by B.x, and we don't add it to the list of
overridden members. This fixes a false-positive MANY_IMPL_MEMBER_NOT_
IMPLEMENTED where an implementation is subsumed by an abstract override.
^KT-57092 Fixed
2023-03-08 11:01:56 +00:00
Kirill Rakhman
6afb1b7363
[FIR] Fix grammar in MANY_IMPL_MEMBER_NOT_IMPLEMENTED message
2023-03-08 11:01:56 +00:00
Ilya Chernikov
feca40071d
K2, MPP: Fix parent lookup in mangler in MPP scenario
...
fixes compilation of the ListTest.kt in stdlib tests
#KT-57131 fixed
(bootstrap required to see the effect!)
2023-03-08 09:38:48 +00:00
Kirill Rakhman
c4255cdb0f
[FIR2IR] Fix adapted callable reference to nested class constructor
...
^KT-56829 Fixed
2023-03-08 08:36:52 +00:00
Kirill Rakhman
e0baeb53db
[FIR] Fix substituted synthetic property with overridden getter only
...
When building the original for a substitution override for a synthetic
property, use the initial setter as fallback when unsubstituting it
returns null. This can happen when a generic class overrides the getter
of a synthetic property of a non-generic class. Then the setter is never
substituted, therefore there is nothing to unsubstitute.
^KT-57168 Fixed
2023-03-08 08:35:02 +00:00
Ilya Chernikov
b3d0a0a1c8
FIR LT: support labelled destructured declarations
...
add missing conversion in the LT to FIR converter
#KT-56759 fixed
2023-03-08 07:28:35 +00:00
Igor Chevdar
315d9089b0
[box-tests] Another version of reproducer for KT-56965
2023-03-08 06:48:52 +00:00
Igor Chevdar
99ec3215d9
[box-tests] Added a reproducer for KT-57053
2023-03-08 06:48:51 +00:00
Evgeniy.Zhelenskiy
88f293d4a9
[IR] Support reflection for MFVC
...
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com >
#KT-1179
2023-03-07 21:44:43 +00:00
Evgeniy.Zhelenskiy
394cd944b6
[IR] Add MFVC representation during serialization of FIR to IR
...
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com >
#KT-1179
2023-03-07 21:44:41 +00:00
Nikolay Lunyak
07fa86f6bc
[FIR] KT-57085: Ignore the diagnostic case in @Suppress()
...
^KT-57085 Fixed
2023-03-07 20:28:02 +00:00
Pavel Mikhailovskii
9db5ea66a6
KT-57103 Don't inline references to generic synthetic Java properties in K1
2023-03-07 17:35:04 +00:00
Marco Pennekamp
91fb16110f
[FIR] KTIJ-24296 Remove unused isNameForFunctionClass
2023-03-07 11:44:15 +00:00
Marco Pennekamp
eb673e4566
[FIR] KTIJ-24296 Optimize isNameForFunctionClass based on name shape
...
- A `classId` can only be a generated function class if it ends with a
digit, per the contract described in `FunctionTypeKind`.
- The optimization uses this fact to avoid calling
`functionTypeService.getKindByClassNamePrefix`, which can be expensive
due to a hash map access.
2023-03-07 11:44:14 +00:00
Marco Pennekamp
a725fe559c
[FIR] KTIJ-24296 Allow special names in symbol provider pre-filtering
...
- A special name such as `<no name provided>` may not be contained in
the list of names, but may still be found by a provider.
2023-03-07 11:44:14 +00:00
Marco Pennekamp
ece038b49b
[LL FIR] KTIJ-24296 Extract symbol provider name cache into a class
...
- The caching logic from `LLFirProvider` may be used in other symbol
providers.
2023-03-07 11:44:14 +00:00
Marco Pennekamp
18ce21fb13
[FIR] Extract mayHaveTopLevelClassifier from composite symbol provider
...
- The implementation is not trivial and should be usable in other symbol
providers.
2023-03-07 11:44:13 +00:00
Nikolay Lunyak
343deeec1c
[FIR] Check FirReceiverParameter annotations' targets
2023-03-07 11:35:47 +00:00
Nikolay Lunyak
1378d730d6
[FIR] Forbid all use-site targets of FirTypeRef annotations
2023-03-07 11:35:47 +00:00
Nikolay Lunyak
93ba0c3e70
[FIR] KT-56769: Ensure @receiver: is only allowed on receivers
...
Note that there's no code that checks that
FirReceiverParameter's annotation's use-site target
is indeed `@receiver:`, because otherwise the
annotation wouldn't have made it into
the FirReceiverParameter.
In contrast, in K1 all such annotations are treated
as annotations on a KtTypeReference.
^KT-56769 Fixed
2023-03-07 11:35:46 +00:00
Alexander Udalov
47c48efa33
JVM IR: do not generate extension receiver parameter as ACC_MANDATED
...
Otherwise Java reflection is not able to load its type as a
parameterized type.
#KT-40857 Fixed
2023-03-06 20:57:52 +00:00
Kirill Rakhman
b80970b09f
[FIR] Fix references to generic synthetic properties
...
When synthetic properties are built from a substitution override,
set originalForSubstitutionOverride, too.
^KT-56251 Fixed
2023-03-06 09:45:02 +00:00
Yan Zhulanow
1cfd2ae7ff
[LL API] Fix on-air analysis for scripts (KTIJ-21108)
...
The implementation is rather limited. Advanced cases, such as
replacing a script with another one with different import directives,
won't work because of non-trivial relationship between 'FirFile' and
'FirScript'.
2023-03-05 19:18:19 +00:00
vladislav.grechko
7033d78641
Fix SAM conversion generation condition
...
Remove check if array is passed to vararg parameter as it's not
relevant anymore and leads to ^KT-51821.
^KT-51821: Fixed
2023-03-04 12:53:48 +00:00
Sergej Jaskiewicz
27adfa8370
[FIR] Provide the correct type parameters when building arrayOf function
2023-03-03 22:08:56 +00:00
Sergej Jaskiewicz
1651199ed8
[IR] Add doc comments for KotlinMangleComputer and its inheritors
2023-03-03 22:08:56 +00:00
Sergej Jaskiewicz
c447b91101
[IR] Factor out duplicated code in KotlinMangleComputer into base class
2023-03-03 22:08:55 +00:00
Ivan Kochurkin
de5b475f7a
[FIR] Use KlibBasedSymbolProvider in FirCommonSessionFactory
...
Unify logic of KLib resolving (Common and JS)
^KT-56354 Fixed
2023-03-03 20:58:24 +00:00