Commit Graph

515 Commits

Author SHA1 Message Date
Dmitrii Gridin 88da053408 [AA] forbid analyze from write action
Analysis is not supposed to be called from write action.
Such actions can lead to IDE freezes and incorrect behavior

^KT-60586 Fixed
2023-07-21 13:03:04 +00:00
Ilya Kirillov 08400d930f [Analysis API, FIR] migrate ::class.java -> ::class inside error messages
They seem to provide similar results and the `.java` part is redundant
2023-07-18 11:49:21 +00:00
Ilya Kirillov 2d791eb292 Rename buildErrorWithAttachment -> errorWithAttachment to emphasise the similar semantics to kotlin.error 2023-07-18 11:49:20 +00:00
Ilya Kirillov 15f6fe2627 Move ExceptionAttachmentBuilder near KotlinExceptionWithAttachments so it's accessible from KotlinExceptionWithAttachments 2023-07-18 11:49:20 +00:00
Jinseong Jeon 6fc02c3408 SLC: ROOT package exists no matter what
^KT-59843 Fixed
2023-07-11 11:47:23 +02:00
Pavel Mikhailovskii 6e6a4d6411 KT-59836 [SLC] Copy type parameters from the parent interface to DefaultImpls methods 2023-07-10 13:11:21 +00:00
Ilya Kirillov c4e8a6dee9 [SLC] implement isMangled for symbol light method
`isMangled` is needed for implementing rename refactoring

^KTIJ-25903
2023-06-30 13:43:30 +00:00
Jinseong Jeon f467c970b2 Drop param name check in PSI-KtSymbol eq checker
Parameter names might not be available, e.g., header jar (ijar).
2023-06-29 14:44:41 +00:00
Jinseong Jeon 7f1424737e LC: rework modality of enum class
It is abstract if it has abstract member.
It is final if it doesn't have enum entries that need subclass.
Otherwise, it is open (i.e., no modifier)

^KT-57567 Fixed
2023-06-23 16:19:06 +02:00
Jinseong Jeon 5d7ac18778 SLC: drop the assertion that class context shouldn't be null
...because it can be null if an anonymous object is returned as a value
of reified inline function, which isn't materialized as LC element.

^KT-59537 Fixed
2023-06-23 10:33:58 +00:00
Marco Pennekamp f318cd8a79 [SLC/ULC] KTIJ-25335 Add tests for fields with missing names 2023-06-23 09:26:58 +00:00
Marco Pennekamp c00eb050ce [SLC/ULC] KTIJ-25335 Avoid generating fields with special names
- Due to the fixes for KTIJ-23584, when calling the UAST conversion
  `convertDeclarationOrElement` from `BaseKotlinConverter` (intellij
  project) for an SLC/ULC property, `convertDeclaration` failed because
  the declaration is "special". This caused `convertPsiElement` to be
  tried instead, which also returned `null`, causing the "failed to
  convert element" exception described in KTIJ-25335.
- In parallel to the solution for KTIJ-23584, which fixed the special
  names issue for functions, this commit skips UAST field generation for
  properties with special names.

^KTIJ-25335 fixed
^KTIJ-24121 fixed
2023-06-23 09:26:57 +00:00
Pavel Mikhailovskii c3746652a4 KT-59293 [SLC] Fix generation of DefaultImpls classes 2023-06-23 08:01:52 +00:00
Pavel Mikhailovskii 9f763deea1 KT-59325 [SLC] Fix generation of fields from companion objects 2023-06-22 14:48:12 +00:00
Anna Kozlova 190d49a1e0 [light classes] optimize accessors retrieval
Avoid expensive calls to `navigationElement` for methods
that cannot be getters/setters and would be filtered later.
Repeat partly naming generation strategy.

Merge-request: KT-MR-10689
Merged-by: Anna Kozlova <Anna.Kozlova@jetbrains.com>
2023-06-22 14:14:39 +00:00
Pavel Mikhailovskii 134b02c754 KT-59563 [SLC] Fix type erasure in $annotations methods of extension properties 2023-06-22 09:06:12 +00:00
Roman Golyshev 50c93b0228 KT-59093 [Analysis API] Make all resolveCall overloads nullable
Instead of returning an error which does not mean anything specific,
it's easier just to return `null`
2023-06-21 20:40:22 +00:00
Jinseong Jeon b91a23be12 Reintroduce KtLightClassForScript as a common interface between (U|S)LC
...so that UAST's conversion to KotlinScriptUClass can work for both LCs
2023-06-21 11:14:15 +02:00
Jinseong Jeon 37876313c9 SLC: add nullity annotation when force-boxing return type
^KT-57579 Fixed
2023-06-20 15:43:41 +00:00
Pavel Mikhailovskii 79dbacb621 [SLC] Keep default constructor parameters' values 2023-06-20 11:00:18 +00:00
Mikhail Glukhikh 5304afb097 Fix AA/LC behavior accordingly to changes related to KT-54844 2023-06-14 07:09:15 +00:00
Anna Kozlova 95ec7ede66 [light classes] create enum references as PsiReferenceExpressions
Ensure that enum constants with special characters in their names are properly ignored
2023-06-13 20:09:54 +00:00
Anna Kozlova 57f429206c [light classes] Improve isEquivalence checks
^KTIJ-25412

Update equivalence checks for light accessor methods and light fields
 to make them equivalent if they share the same underlying property.
 Follow the `kotlinOrigin` declaration:
 even if there is a property accessor,
 use property declaration.
2023-06-13 12:39:51 +00:00
Pavel Mikhailovskii 46844100d5 Fix visibility of $annotations methods 2023-06-12 12:59:53 +00:00
Anna Kozlova e81099ca96 [light classes] create enum references as PsiReferenceExpressions
to better mimic java psi,
see e.g. `PsiJvmConversionHelper#getAnnotationAttributeValue(PsiAnnotationMemberValue)`
2023-06-10 08:30:26 +00:00
Anna Kozlova 4d97e4c572 [LL] add tests for FirDeclarationForCompiledElementSearcher
build stub if was not able to load:
expected that in IDE stubs would always be found in the index, for tests -
build from virtual file
2023-06-07 21:00:26 +00:00
Ilya Kirillov 1eb0862820 [Analysis, build] replace testApi -> testImplementation in build.gradle.kts where it's possible 2023-06-02 09:16:47 +00:00
Pavel Mikhailovskii 0ef31501b1 [SLC] KT-54804 Erase type and drop receiver annotations in $annotations methods 2023-06-01 18:22:03 +00:00
Ilya Kirillov 41976a2932 [Analysis API] optimize scope members processing when a candidate name set is known
Use KtScope.getCallableSymbols/getClassifier symbols overloads which accept a candidate name set.

^KT-58653
2023-05-19 11:53:15 +00:00
Dmitrii Gridin 4472e1ae4e [AA FIR] add tests on implicit type in delegated scope
^KT-58727
2023-05-17 09:51:21 +00:00
Yan Zhulanow c6d8876f9f [LL API] Pass the project instance to ProjectStructureProvider
Eliminate unnecessary PSI tree traversal by providing the 'Project'
instance explicitly.
2023-05-16 08:42:57 +00:00
Yan Zhulanow d3cb41cbab [LL API] Pass contextual modules to 'KotlinDeclarationProvider' factory
^KT-57559 Fixed
2023-05-16 08:42:57 +00:00
Yan Zhulanow e9c077220f [LL API] Migrate 'getKtModule()' usages to 'ProjectStructureProvider'
Ensure the contextual module is passed wherever possible.

^KT-57559 Fixed
2023-05-16 08:42:57 +00:00
Jinseong Jeon 41473a948d SLC: implement PsiAnnotation#find(Declared)AttributeValue
^KT-58448 Fixed
2023-05-15 14:16:14 +02:00
Pavel Mikhailovskii 7ac5233a32 KT-54804 [SLC] Generate synthetic functions for annotations on properties in light classes 2023-05-12 09:39:37 +00:00
Pavel Mikhailovskii 25c0725da9 [SLC] Treat error class types as not-nullable 2023-05-11 11:48:45 +00:00
Roman Golyshev 105611679e [AA FIR] KT-58503 Use resolvedStatus to access visibility and modality of a class
Compiler plugins (AllOpen, for example) can modify the status of a
declaration, including visibility and modality. If we observe them
without enforcing STATUS resolve, we risk to see incorrect information,
which in turn can lead to false negatives/positives in
inspections/intentions.

Add test for light classes. See KT-58503 description for the explanation
how the initial problem was influencing Spring inspections from intellij
repository.

^KT-58503 Fixed
2023-05-09 13:20:16 +00:00
Roman Golyshev 0dbf218f0b [FIR LC] KT-58330 Introduce SymbolPsiClassObjectAccessExpression
A PSI expression created with `createExpressionFromText` has dummy
parent, which might break some inspections (for example, it breaks
`JamAttributeElement` class in Spring Framework Plugin in intellij)

Modify `AbstractSymbolLightClassesParentingTestBase` to check values of
annotations in light classes; implement `accept` in some of them

^KT-58330 Fixed

Merge-request: KT-MR-9903
Merged-by: Roman Golyshev <roman.golyshev@jetbrains.com>
2023-05-03 15:21:18 +00:00
Anna Kozlova 956294821b [psi] don't load text for compiled code
use stubs when possible, when stub doesn't contain anything,
decompiled text won't contain it either,
no sense to load
2023-05-02 10:30:34 +00:00
aleksandrina-streltsova c956b4aeae [Analysis API FIR] Use stable module name when mangling internal name
^KTIJ-25046
2023-04-27 12:36:20 +00:00
Jinseong Jeon 5298abf2d6 AA/LC: introduce an API to find script files 2023-04-25 14:49:03 +02:00
Jinseong Jeon f9086daf4d SLC: add support for .kts
^KTIJ-21108
^KT-50241
^KT-55626 Fixed
2023-04-25 14:49:03 +02:00
Mikhail Glukhikh 1f05ce2e01 AA/LC: Support annotation property->backing field move
#KT-57462 Fixed
2023-04-25 12:18:27 +00:00
Pavel Mikhailovskii 37ed7beda0 KT-57135 Take into account annotations' allowed targets
- Check allowed targets
- Attach field annotations to the backing field
2023-04-25 12:18:26 +00:00
Dmitrii Gridin 2a00be916a [SLC] SymbolLightAccessorMethod: avoid symbol restoring on isValid
^KTIJ-25108 Fixed
2023-04-24 11:53:36 +00:00
Dmitrii Gridin f85dc95b66 [SLC] SymbolLightAccessorMethod: reduce number of requests on symbol restoring
We can avoid extra restoring of property accessors
if the corresponding property is already restored

^KT-57850
2023-04-21 11:10:20 +00:00
Jinseong Jeon 0ca86c86be SLC: add nullability annotation to value param of non-synthetic enum members
^KT-57567
2023-04-19 16:14:23 +02:00
Jinseong Jeon 9fe30bfc12 SLC: regression test for final modifier on enum members
^KT-57567
2023-04-19 16:14:23 +02:00
Nikita Bobko 5a96754aec Shift ReferencesToSyntheticJavaProperties feature release from 1.9 to 2.1
Other related tests:
- testGenericJavaProperty
- testFunInterfaceConstructorReference

Meta issue: KT-8575
Review: https://jetbrains.team/p/kt/reviews/9595

UnsupportedSyntheticCallableReferenceChecker only existed for K1,
because we wanted to release the feature for 1.9 and the feature should
have been working for K2 unconditionally. But since, we're postponing
the release until 2.1, we also need to port the checker from K1 to K2
2023-04-17 17:42:01 +00:00
Jinseong Jeon 5403cc7feb SLC: fix type mapping mode for var
^KT-57578
2023-04-17 10:59:03 +02:00