Commit Graph

488 Commits

Author SHA1 Message Date
Nikolay Lunyak 389f02b016 [FIR] Let FirErrorExpression have a working type if possible
^KT-65337 Fixed
2024-02-14 09:57:12 +00:00
Simon Ogorodnik 53e89a9722 K2. Minor. Rename FirConstExpression to FirLiteralExpression
FirConstExpression is usually confused with "constant" calculations,
while in fact, it just denotes a simple literal expression
and `1 + 1` isn't represented by a FirConstExpression.

^KT-64314 Fixed
2024-01-25 23:05:15 +00:00
Nikolay Lunyak 9b786d35f8 [FIR] Fix NO_RECEIVER_ALLOWED
If we do create an implicit invoke call, and
then put the receiver into the argument list,
we should mark it.
2024-01-24 12:49:56 +00:00
Ivan Kylchik aecf05c4ac [FIR] Use ConeKotlinType to represent vararg's element type
We are using `ConeKotlinType` instead of `FirTypeRef` to represent
that element type of vararg doesn't have any source. It has a type
that was inferred. If we try to specify a source, then we could
end up with the incorrect place for diagnostic.

#KT-59682 Fixed
2024-01-18 13:33:48 +00:00
Alexander.Likhachev 60080e8bb8 [Build] Remove redundant trove4j compileOnly dependencies
^KTI-1135 In Progress
2024-01-10 11:29:25 +00:00
Denis.Zharkov f8fd46a5b8 K2: Rename delegateProvider in node for delegate and refine its type 2024-01-09 18:03:05 +00:00
Marco Pennekamp 85c4d6b67b [FIR] Add workaround for exception in JavaOverrideChecker.buildErasure
- `useMutableOrEmpty` causes the bounds to be replaced atomically, which
  avoids the race described in KT-60324.

^KT-60324 fixed
^KT-60445
2023-12-19 11:10:06 +00:00
Sergej Jaskiewicz f844a86057 [utils] Introduce the bind function and use it throughout 2023-12-13 10:04:45 +00:00
Sergej Jaskiewicz cab87eba21 [SIR, FIR generators] Add KDocs for visitor-related methods of elements 2023-12-12 14:27:57 +00:00
Sergej Jaskiewicz 80847b9ee2 [SIR generator] Add SirVisitorVoid class
This is convenient for cases when the visitor has no context to pass to
each method
2023-12-12 14:27:57 +00:00
Sergej Jaskiewicz 80c9eae409 [tree generators] Factor out common transformer printing logic 2023-12-12 14:27:57 +00:00
Ilya Chernikov ff4f30ddc1 FIR: replace receiver in anon initializer with containing decl
This way the abstraction represents the intended use better and
doesn't stay on the way of using FirAnonymousInitializer in scripts
2023-12-12 09:58:19 +00:00
Ilya Chernikov eeb723eb01 K2 Scripting: wrap script statements into blocks
(reuse anonymous initializers as block wrappers) so the top-level script
elements are all declarations now. Rename the property accordingly (
together with the previous commit).
It makes script more similar to the class and thus simplify e.g.
control flow analysis and resolve code.
2023-12-12 09:58:19 +00:00
Ilya Chernikov c9aee5bf09 minor: rename FirScript.statements do declarations...
to simplify the following commit that actually convert the types
and wrap statements into blocks.
2023-12-12 09:58:19 +00:00
Ilya Chernikov b7057eb22f K2 Scripting: make FirScript a CFG owner 2023-12-12 09:58:18 +00:00
Dmitrii Gridin 6eca9fe3a9 [FIR] tree: introduce containingDeclarationSymbol for annotation calls
This symbol will be used during resolution to avoid transformation
of annotations in the wrong context in the case of FIR node sharing.
The symbol should be some containing declaration symbol to be able
to answer the question "Are we own this annotation?" during resolution

^KT-63042
2023-12-07 12:26:39 +00:00
Sergej Jaskiewicz c0c6667876 [FIR generator] Make Readme.md up-to-date 2023-12-05 20:30:22 +00:00
Sergej Jaskiewicz 8d1907e2f5 [FIR/IR generator] Introduce the common entry point for tree generators
This reduces code duplication.
2023-12-05 20:30:22 +00:00
Sergej Jaskiewicz 858343695c [FIR generator] Remove unused constant 2023-12-05 20:30:22 +00:00
Sergej Jaskiewicz 19ff050eae [FIR/IR generator] Move usedTypes to AbstractElement, rename it 2023-12-05 20:30:22 +00:00
Sergej Jaskiewicz 8c75526130 [FIR generator] Move each visitor printer into its own file 2023-12-05 20:30:22 +00:00
Sergej Jaskiewicz 0c0f7f9899 [FIR/IR generator] Rename files with printers: use printer class's names 2023-12-05 20:30:22 +00:00
Sergej Jaskiewicz d0f87f9aba [FIR/IR generator] Rename field's needAcceptAndTransform to isChild
This better describes the semantics.
2023-12-05 11:41:02 +00:00
Roman Golyshev ad2c77b298 KT-59732 [FIR] Get rid of FirErrorImport node
It's no longer relevant, since it's not created anywhere
2023-12-04 16:51:46 +00:00
Sergej Jaskiewicz f46a14522f [FIR generator] Remove unused notNull property 2023-12-01 12:06:06 +00:00
Sergej Jaskiewicz f3016e1dcb [FIR generator] Avoid FIR-specific code in AbstractBuilderPrinter 2023-12-01 12:06:06 +00:00
Sergej Jaskiewicz cae4a9930b [FIR generator] Extract the Builder class to a common module
We want to use it to generate builder classes for other
trees, just like we already do with elements (see `AbstractElement` and
`AbsractImplementation`).
2023-12-01 12:06:06 +00:00
Sergej Jaskiewicz 91b5a71f1a [FIR generator] Extract the Implementation class to a common module
We want to use it to generate implementation classes for other
trees, just like we already do with elements (see `AbstractElement`).
2023-12-01 12:06:06 +00:00
Kirill Rakhman 0b28e770b2 [FIR] Introduce new FIR node for SAM conversion
#KT-62847
2023-11-30 08:39:03 +00:00
Ivan Kylchik 9f64edb31e [FIR] Add hasConstantInitializer field in FirField class
This field is required to be able to analyze Java fields
without triggering lazy const evaluation.

#KT-59894
#KT-61920
2023-11-29 16:33:17 +00:00
Sergej Jaskiewicz 7bd4de65f8 [IR generator] Deduplicate field copying logic 2023-11-28 16:24:40 +00:00
Sergej Jaskiewicz ad4e97154f [FIR/IR generator] Factor out allFields to AbstractElement 2023-11-28 16:24:40 +00:00
Sergej Jaskiewicz 38ee477ab4 [FIR/IR generator] Make AbstractField generic over itself
This will make some code more type-safe.
2023-11-28 16:24:40 +00:00
Sergej Jaskiewicz c6eb7d6c21 [FIR/IR generator] Factor out walkableChildren and transformableChildren 2023-11-28 16:24:40 +00:00
Sergej Jaskiewicz 13ae129505 [FIR/IR generator] Move isSealed property to AbstractElement 2023-11-28 16:24:40 +00:00
Sergej Jaskiewicz 0465c6d0ee [FIR/IR generator] Make InterfaceAndAbstractClassConfigurator open 2023-11-28 16:24:40 +00:00
Sergej Jaskiewicz 4307e76f15 [FIR/IR generator] Remove visitSuperTypeByDefault from visitor printers
This property is FIR-specific, no need to use it in the generic printer.
2023-11-24 17:29:58 +00:00
Sergej Jaskiewicz a5b5492b2d [IR generator] Simplify configuration of visitor parents
Don't specify a visitor parent manually for each IR node,
use an algorithm instead.
2023-11-24 17:29:58 +00:00
Sergej Jaskiewicz 62d32471e1 [FIR generator] Extract BaseTransformerTypeFinder into the common module
We want to use it in other tree generators.
2023-11-24 17:29:58 +00:00
Sergej Jaskiewicz 9a11208e67 [FIR/IR generator] Extract visitFunctionName to AbstractElement 2023-11-22 15:10:16 +00:00
Sergej Jaskiewicz d7710b8e8d [FIR generator] Remove redundant full qualifier in generated builders 2023-11-22 10:00:06 +00:00
Sergej Jaskiewicz fab63e38aa [FIR/IR generator] Reduce duplication when printing curly-braced blocks 2023-11-21 01:15:10 +00:00
Kirill Rakhman 49e786f088 [FIR] Copy java enum entry during enhancement instead of mutating it
#KT-57949 Fixed
2023-11-20 15:21:49 +00:00
Nikolay Lunyak 5a1a23afac [FIR] Don't miss annotations on inits
^KT-59874
2023-11-14 15:19:33 +00:00
Sergej Jaskiewicz 02c12ae26f [FIR generator] Write kDocs for accept & transform methods in FirElement 2023-11-09 13:30:25 +00:00
Sergej Jaskiewicz ed28923282 [IR generator] Don't use kotlinpoet for auto-generating IR tree classes
KT-61970 Fixed
KT-61703 Fixed
2023-11-09 13:30:25 +00:00
Sergej Jaskiewicz 63e9dd588c [FIR generator] Factor out element printer to common module
This is a step towards commonizing the code generator between
FIR and IR: KT-61970
2023-11-09 13:30:25 +00:00
Sergej Jaskiewicz 84bd12c667 [FIR generator] Factor out field printer into the common code
This is a step towards commonizing the code generator between
FIR and IR: KT-61970
2023-11-09 13:30:25 +00:00
Sergej Jaskiewicz bca35c0015 [FIR/IR generator] Add default arguments to TypeVariable constructor 2023-11-09 13:30:25 +00:00
Sergej Jaskiewicz c5f519f7c7 [FIR/IR generator] Commonize visitor printing logic
This is a step towards commonizing the code generator between
FIR and IR: KT-61970

Also, don't use kotlinpoet for generating IR visitors (KT-61703)
2023-11-02 23:05:18 +00:00