41 Commits

Author SHA1 Message Date
Marco Pennekamp 708ed81eb2 [Test] Avoid importing unused @Nested annotations in generated tests
- Unused `Nested` imports frequently cause unused import warnings in the
  IDE, which are especially annoying in after-commit warning/error
  analysis.
2024-02-27 20:30:06 +00:00
Vyacheslav Gerasimov f924de5a2c Build: Remove unused dependencies on :kotlin-compiler project
#KTI-1598
2024-02-27 10:29:59 +00:00
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
Kirill Rakhman f231338cd6 [FIR] Render list of symbols with linebreaks as separators
#KT-61823 Fixed
2024-02-21 12:25:22 +00:00
Dmitriy Novozhilov acf2296590 [Test] Regenerate tests after two previous commits 2024-02-16 12:48:24 +00:00
Evgeniy.Zhelenskiy 7eab4b672d [K1, K2, CLI] Mark whole position range of compiler diagnostics in CLI
#KT-64989
2024-02-08 12:59:31 +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
Dmitrii Gridin b6d373d8e5 Update copyright to 2024 2024-01-05 13:43:17 +00:00
Nikolay Lunyak a68a2409d3 [FIR] Remove the applicability filtering when reporting diagnostics
In case we don't want to introduce any new
abstractions like "user relevance for
applicability", we can just remove the
filtering.

^KT-62541 Fixed
2023-10-19 09:27:45 +00:00
Ilya Kirillov d98da87278 [FIR] Render dot-separated FQNs instead of slash-separated ones in diagnostics
^KT-62030 fixed
2023-09-22 10:48:31 +00:00
Kirill Rakhman c3abe28049 [FIR] Use resolvedType instead of coneTypeOrNull in checkers
#KT-61367
2023-09-14 10:03:02 +00:00
Alexander.Likhachev 6eaccc997f [Build] Fix the typo junit jupyter -> jupiter 2023-09-06 22:47:34 +00:00
Alexander.Likhachev 53fde520d5 [Build] Add jUnit dependencies in testApiJUnit5 to the implementation configuration
Adding these dependencies to the `api` configuration pollutes classpath for each dependant modules even if it doesn't need them. Instead, the dependencies should be declared more granularly if they're required
#KTI-1349 In Progress
2023-09-06 22:47:34 +00:00
Alexander.Likhachev 357d12fc8e [Build] Move JUnit dependencies into the version catalog
The `kotlin-test` dependencies are left untouched as changing them affects publications, thus these versions are independent from the used inside our build
#KTI-1349 In Progress
2023-09-06 22:47:33 +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
Kirill Rakhman d0cc86f52c [Tests] Update test data after changes to FIR diagnostic messages 2023-08-21 16:28:48 +00:00
Nikolay Lunyak f9c6af4d2a [FIR] Properly assign <local> packages to symbols
This prevents `FirConflictsExpressionChecker.kt`
from missing conflicting local functions. It used
to due to inconsistencies in assigning `<local>`,
and this commit makes it a bit more
straightforward.

The change in KtClassTypeQualifierRenderer
prevents `FirOverrideImplementTest.testLocalClass`
from failing in `intellij`. It didn't fail for
callables, because `KtCallableSignatureRenderer`
doesn't try to render packages.

^KT-59186 Fixed
2023-08-18 13:31:04 +00:00
Mikhail Glukhikh 9d9d7880af K2: render types in quotes in diagnostic messages 2023-07-13 09:07:39 +00:00
Mikhail Glukhikh c839cd3c11 K2: don't use debugging type renderer in error messages 2023-07-13 09:07:39 +00:00
Brian Norman 5fe5113344 [Test] Sort FIR diagnostics by offset for consistent rendering 2023-06-15 13:49:41 +00:00
Brian Norman 48484368c7 [Test] Support RENDER_DIAGNOSTICS_FULL_TEXT directive for FIR tests 2023-06-06 15:42:21 +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
Yahor Berdnikau 5e41cbda75 Change kotlin-assignment plugin to use published compiler plugin
^KT-52811 In Progress
2023-04-17 14:40:49 +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
Dmitriy Novozhilov 8ff330079e [Assign plugin] Remove experimentality warning
The plugin is still experimental, see
  https://kotlinlang.org/docs/components-stability.html

^KT-56925 Fixed
2023-02-24 11:19:45 +00:00
Dmitriy Novozhilov da581f38e1 [Test] Require specifying parser for FIR test. Unify names for FIR tests
Now all tests with `Fir` in name are named accordingly to parser which
  is used in them -- `FirPsi` or `FirLightTree`. This is needed to keep
  consistency between different types of tests, because there is no
  single default in parser mode between different scenarios of using FIR
2023-02-24 11:15:26 +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
Alexander Udalov 3c4b5529af Update year to 2023 in COPYRIGHT_HEADER.txt
This commit is the result of changing the year to 2023 in
COPYRIGHT_HEADER.txt and running all `generate*` tasks in
`generators/build.gradle.kts`.
2023-01-02 22:52:15 +01:00
Dmitriy Novozhilov 02e327277e [FIR] Report VAL_REASSIGNMENT on assign to non-local vals
In this commit reporting on member properties in init section of class
  is not supported (see KT-55528)

^KT-55493 Fixed
2022-12-20 08:12:09 +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
Dmitriy Novozhilov 0eb34983cb [Assign plugin] Fix experimentality warning message 2022-10-19 11:09:33 +00:00
Nikolay Krasko f43ad1cb7a Remove packed stdlib from Kotlin compiler plugin artefacts
Remove annotations, kotlin-stdlib-common, kotlin-stdlib.

Packing those libraries is wrong and probably unexpected. It leads to
artifacts size increase. Can be dangerous because of bad classpath.
And also have a reproducibility issue because of caching tricks around
KotlinVersionCurrentValue class.

KTI-942
2022-10-12 13:44:30 +00:00
Dmitriy Novozhilov c543a2e6d5 [Assign plugin] Publish embeddable version of assign plugin 2022-10-04 19:47:34 +00:00
Dmitriy Novozhilov ed1a1c067c [Assign plugin] Add experimentality warning 2022-09-16 10:12:41 +03:00
Anže Sodja 09d6dfc8bf [Assign plugin] Add a compiler plugin for overloading assign ('=') operator 2022-09-16 10:12:41 +03:00