Commit Graph

292 Commits

Author SHA1 Message Date
Egor Kulikov 163017fcaf [FIR] Do not dereference delegate in lazy mode
Tenth step for ^KT-52615
2023-02-24 19:42:11 +00:00
Kirill Rakhman 314784f435 [FIR] Introduce FirDeclarationStatus.hasStableParameterNames
This flag is true by default but is set to false for

- Java methods and constructors
- interface delegation methods that delegate to Java

The NAMED_ARGUMENTS_NOT_ALLOWED logic is mostly refactored to use the
new flag though some custom logic remains for determining the correct
message and to work around a corner case with fake overrides.

The flag is (de)serialized from/to metadata. For backward compatibility
with K1, delegated methods to Java types are deserialized as stable.

^KT-40480 Fixed
2023-02-13 12:09:39 +00:00
Dmitriy Novozhilov 67c504e6f0 [FIR] Add replaceStatus method for FirMemberDeclaration 2023-02-10 12:30:12 +00:00
Dmitriy Novozhilov a9248569a6 [FIR] Fix reporting of UNINITIALIZED_ENUM_ENTRY in init blocks
^KT-41126 Fixed
2023-02-10 12:30:12 +00:00
Yan Zhulanow e8570826e6 [LL API] Replace 'FirScript.containingFileSymbol' with 'FirProvider' API 2023-02-03 08:59:37 +00:00
Yan Zhulanow f352f7d5ba [LL API] Recognize scripts in Analysis API
Although the proper support for script resolution is yet to arrive
in K2, some initial steps are required to make LL API understand
such a concept.
2023-02-03 08:59:37 +00:00
Kirill Rakhman ace47c06a5 FIR: Make LHS of FirVariableAssignment a FirExpression
This way references can even be resolved for erroneous assignments
(e.g. function call, if expression, ... on LHS)

^KT-54648 Fixed
2023-01-31 08:39:42 +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
Yan Zhulanow d652dc620c [FE] Preserve legacy contract description calls in bodies
^KT-55231 Fixed
^KTIJ-21012 Fixed
2022-12-26 11:46:58 +00:00
Anna Kozlova 15b1e429d7 [compiler] introduce dedicated Fir declaration for dangling modifier lists (KTIJ-23008)
ensure fir annotations are included in FirDanglingModifierList and resolved,
dedicated DanglingTopLevelModifierListStructureElement exists for top
level lists only, class level lists are processed by containing structure
element
2022-12-21 20:58:46 +00:00
Ilya Chernikov a89dfdce03 K2 Scripting: add support for script args to FIR part 2022-12-21 14:34:20 +00:00
Mikhail Glukhikh e9fbeb9be2 K2: use MutableOrEmptyList for context receivers on declaration site 2022-12-20 11:04:27 +00:00
Mikhail Glukhikh d20d63786b K2: use MutableOrEmptyList for type arguments 2022-12-20 11:04:26 +00:00
Mikhail Glukhikh a48610000d K2: introduce & use MutableOrEmptyList.EMPTY singleton 2022-12-20 11:04:26 +00:00
Mikhail Glukhikh ddc786364f K2: use MutableOrEmptyList for context receivers 2022-12-20 11:04:26 +00:00
Mikhail Glukhikh dff71a9602 K2: use MutableOrEmptyList for nonFatalDiagnostics 2022-12-20 11:04:25 +00:00
Mikhail Glukhikh 582b640bec K2: use MutableOrEmptyList for annotations storage in FIR elements 2022-12-20 11:04:25 +00:00
Mikhail Glukhikh be5394e211 Fix minor formatting issue in generated FIR tree 2022-12-20 11:04:24 +00:00
Dmitriy Novozhilov d75160250d [FIR] Drop transformExtensionReceiver and transformDispatchReceiver from FirQualifiedAccess
After removal of `StoreReceiver` transformers those methods are not used
  anymore, so it's ok to remove them at all
2022-12-20 08:12:10 +00:00
Dmitriy Novozhilov 9ccbf8639d [FIR] Add dispatchReceiverType to FirAnonymousInitializer
This is needed to add ability to quickly find class to which initializer
  belongs
2022-12-20 08:12:09 +00:00
Dmitriy Novozhilov d45ae59d33 [FIR] Add methods to replace dispatch and extension receivers 2022-12-20 08:12:07 +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 9e4e5eed68 [FIR] Introduce FirResolvedErrorReference node 2022-12-15 12:12:19 +00:00
Ilya Kirillov b962fcddc8 [FIR] move file annotations to the FirFileAnnotationsContainer 2022-12-09 16:21:07 +00:00
Ilya Kirillov 67adc3fb1a [FIR] introduce FirFileAnnotationsContainer 2022-12-09 16:21:07 +00:00
Ilya Kirillov 8fd892176a [FIR] introduce FirElementWithResolvePhase class and make it a base class for FirDeclaration 2022-12-09 16:21:06 +00:00
Egor Kulikov dbfe33c00d [FIR] Make default values for value parameters lazy in RawFirBuilder
Sixth step for ^KT-52615

Merge-request: KT-MR-7926
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
2022-12-08 13:32:37 +00:00
Egor Kulikov fb2485f83c [FIR] Make constructor delegate lazy in RawFirBuilder
Fifth step for ^KT-52615

Merge-request: KT-MR-7860
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
2022-12-02 03:12:51 +00:00
Dmitriy Novozhilov 6864433581 [FIR] Support resolution of meta-annotations before supertypes
Now annotations are resolved with following algorithm:
1. On COMPILER_REQUIRED_ANNOTATIONS we resolve all annotations
     and store results if this is compiler annotation, plugin annotation,
     or annotation with meta-annotation (meta annotations are checked
     recursively with designated resolution if needed)
2. On TYPES stage we resolve all those annotations once again and if
     some annotation changes resolution then we keep type from p.1 and
     report error on this annotation, so user should disambiguate it

Ambiguity may occur because of nested annotations with same name as
  plugin annotations:

```
annotation class SomeAnnotation // (1) plugin annotation

open class Base {
    annotation class SomeAnnotation // (2)
}

class Derived : Base() {
    @SomeAnnotation // <-----------------
    class Inner
}
```
At COMPILER_REQUIRED_ANNOTATIONS annotation call will be resolved to (1)
  because at this stage supertypes are not resolved yet, and we consider
  only importing scopes. At the TYPES stage we will find correct
  annotation from supertype
2022-12-01 07:29:39 +00:00
Ilya Chernikov a3a1550933 K2 scripting: add initial scripting support to K2 frontend 2022-11-26 18:01:48 +00:00
Egor Kulikov d585f068dd [FIR] Make anonymous initializer lazy in RawFirBuilder
Fourth step for KT-52615

Merge-request: KT-MR-7798
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
2022-11-25 11:41:44 +00:00
Ilya Kirillov 7781ad67d4 [FIR] introduce FirValueParameter.containingFunctionSymbol
^KT-55034 fixed
2022-11-22 18:25:30 +01:00
Ilya Kirillov c8e3103af9 [FIR] do not create FirParameter for catch parameter
use FirProperty instead

^KT-55034
2022-11-22 18:25:30 +01:00
Egor Kulikov 067036c162 RawFirBuilder refactoring
Second step for KT-52615
Get rid of PsiHandlingMode
Get rid of source in FirLazyBlock
Refactor lazy creation

Merge-request: KT-MR-7753
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
2022-11-22 14:43:53 +00:00
Anna Kozlova 3fdd0aacd3 [compiler] preserve fir receiver in tree
when selector is invalid expression,
ensure that fir tree still contains receiver as well as selector

KTIJ-23578
2022-11-22 10:46:59 +00:00
Ilya Kirillov b6481ed891 [FIR] do not use FirValueParameter for function type parameter
As it is a different abstraction, introduced FirFunctionTypeParameter instead

Also, fix syntax checkers for function type parameter

^KT-55035 fixed
2022-11-21 16:17:51 +00:00
Dmitrii Gridin 86422d0944 [FIR] FirReceiverParameter: rename type to typeRef
^KT-54417
2022-11-17 09:50:17 +00:00
Dmitrii Gridin 3cd85a4622 [FIR] drop redundant receiver copy
^KT-54417
2022-11-17 09:50:15 +00:00
Dmitrii Gridin b40d329751 [FIR] FirAnnotationBuilder: drop redundant buildAnnotationCopy
^KT-54417
2022-11-17 09:50:13 +00:00
Dmitrii Gridin be7d282974 [FIR] introduce FirReceiverParameter
^KT-54417
2022-11-17 09:50:09 +00:00
Dmitrii Gridin a0b814a1b6 [FIR] make FirPropertyAccessor#propertySymbol non-nullable
we need it to restore property accessor by property

^KT-54311
2022-10-17 14:59:42 +00:00
Ilya Kirillov 49f2f85927 [Low Level FIR] fix exception when creating symbol by invalid code 2022-10-04 12:56:07 +00:00
Nikolay Lunyak f578381726 [FIR] KT-46483: Forbid annotations in where Clauses
Merge-request: KT-MR-7208
Merged-by: Nikolay Lunyak <lunyak.kolya@mail.ru>
2022-09-28 13:38:18 +00:00
Dmitriy Novozhilov 7ef2f7ccde [FIR] Add transformContextReceivers() method to FirProperty 2022-08-24 15:36:41 +00:00
Arseniy Terekhov 25fc948d95 [FIR] DeprecationsProvider: make evaluation of deprecations on demand 2022-08-19 07:37:54 +00:00
Simon Ogorodnik 513af2dfbc FIR. Refactor smart-cast representation in FIR tree
Make smart-casts non-transparent expression without delegation
to underlying FirQualifiedAccessExpression, as children delegation in
fir tree has unclear semantics
Remove two different kinds of tree nodes for smart-casts
2022-08-15 21:46:11 +00:00
Dmitry Gridin 4ceb170917 regenerate tests 2022-08-05 14:12:41 +02:00
Dmitriy Novozhilov 80223bd555 [FIR] Fix determination of which type is FIR type in tree generator
^KT-52832 Fixed
2022-06-21 14:10:36 +00:00
Ivan Kochurkin fd2b4fd497 [FIR] Fix false positive USELESS_CAST on stub types, ^KT-50293 Fixed 2022-06-17 23:26:18 +00:00
Ivan Kochurkin 9d6f88469a [FIR] Use @file:Suppress("DuplicatedCode") for generated fir impl nodes
Get rid of unwanted warnings in IntelliJ
2022-06-17 23:26:17 +00:00