15 Commits

Author SHA1 Message Date
Ilya Chernikov 0c5b700523 K2: fix annotation search on supertypes in assignment plugin
Current implementation checks only immediate supertype, while
in case of gradle build scripts DSL, the annotated superclass
is located deeper in the hierarchy.
The fix implements a recursive supertype check.

#KT-65983 fixed
2024-02-23 22:03:44 +00:00
Dmitriy Novozhilov 727d2f46f8 [FIR] Part 1. Group checkers by the MPP kind
This commit introduces MppChecker kind, which represents the new property
  of checkers
- `MppCheckerKind.Common` means that this checker should run from the same
  session to which corresponding declaration belongs
- `MppCheckerKind.Platform` means that in case of MPP compilation this
  checker should run with session of leaf platform module for sources
  of all modules

An example of a platform checker is a checker that checks class scopes
  and reports ABSTRACT_NOT_IMPLEMENTED and similar diagnostics. If some
  regular class in the common module contains expect supertypes, the
  checker should consider the actualization of those supertypes to get
  a complete type scope

^KT-58881
2024-01-24 10:44:59 +02:00
Kirill Rakhman c3abe28049 [FIR] Use resolvedType instead of coneTypeOrNull in checkers
#KT-61367
2023-09-14 10:03:02 +00:00
Kirill Rakhman 8d7c5b375e [FIR] Replace usages of FirExpression.typeRef with coneTypeOrNull
#KT-59855 Fixed
2023-08-24 07:54:57 +00:00
Kirill Rakhman 9ec814b7ad [FIR] Replace FirExpression.typeRef.coneType (and variants) with FirExpression.coneType
#KT-59855
2023-08-24 07:54:56 +00:00
Andrei Klunnyi 1e0115aef8 KT-57468 Kotlin assignment plugin: operation name cannot be found
The problem results in broken import quick fix and import optimizer on
the IDE side [1].

`AssignResolutionAltererExtension` introduced a possibility to override
 resolution of assignment statements. The inconsistency though is
 that `KtSimpleNameReference.getResolvesByNames` doesn't return a name
 for the overridden `=`. Kotlin as a language doesn't support this [2].

This commit eliminates the drawback above:
1. It fixes the name `assign` the `=` can be resolved to [3].
   This eliminates the need to search for the name, bypassing the
   plugins.
2. `KtSimpleNameReference.getResolvesByNames` returns `assign` among
   other names in case it deals with binary `=` and assignment is
   resolved.
3. `KtCompilerPluginsProvider` was extended to check plugins' presence.
   K1 implementation added.

----------------------------------------------------------------
[1]: https://youtrack.jetbrains.com/issue/KTIJ-24390
[2]: OperatorConventions.getNameForOperationSymbol
     https://kotlinlang.org/docs/operator-overloading.html#augmented-assignments
[3]: OperatorConventions#ASSIGN_METHOD + AssignmentPluginNames
2023-04-27 14:05:02 +00:00
Roman Golyshev 4e0b68b516 [Assign plugin] Use FqName to match annotations in FirAssignAnnotationMatchingService
All other compiler plugins accept "pkg1.pkg2.Class1" classes notation
and correctly match against it

But Assignment plugin used `ClassId` on such qualified names and got
`ClassId("/pkg1.pkg2.Class1")` instead of `ClassId("pkg1/pkg2/Class1")`,
and that lead to unexpected problems

This commit fixes that by using `FqName` instead of `ClassId`

^KT-57406 Fixed
2023-03-31 10:55:05 +00:00
Kirill Rakhman 63a908cff8 FIR, Assign plugin: Update for KT-54648 2023-01-31 08:39:43 +00:00
Nikolay Lunyak 6a1c9e9279 [FIR] Support typealiases in FirAssignAnnotationMatchingService 2023-01-17 06:26:35 +00:00
Dmitriy Novozhilov 4bddb27ca3 [FIR] Get rid of candidateSymbol in FirNamedReference
`candidateSymbol` has any reasonable meaning only for references with
  not completed candidate, so this property is moved from FirNamedReference
  to new node FirNamedReferenceWithCandidateSymbol, which has real
  implementation only in :resolve module (`FirNamedReferenceWithCandidate`)
2022-12-20 08:12:07 +00:00
Dmitriy Novozhilov 34be0f05b2 [FIR] Add utility for checking if FirReference is one of error reference
Also simplify relevant code in checkers
2022-12-15 12:12:21 +00:00
Dmitriy Novozhilov b53c4a6353 [FIR] Introduce some typed FirReference.toResolvedXXXSymbol utilities 2022-12-15 12:12:20 +00:00
Dmitriy Novozhilov cffc32ec76 [FIR] Fir utils for FirReference in package org.jetbrains.kotlin.fir.references 2022-12-15 12:12:20 +00:00
Dmitriy Novozhilov dde64c10ea [FIR] Create FirResolvedErrorReference for error reference with single candidate
Note that this reference won't be created for hidden candidates,
  because they are designed to be truly invisible from the user side
2022-12-15 12:12:19 +00:00
Anže Sodja 09d6dfc8bf [Assign plugin] Add a compiler plugin for overloading assign ('=') operator 2022-09-16 10:12:41 +03:00