Commit Graph

109365 Commits

Author SHA1 Message Date
Wojciech Litewka 97e2dab9f0 [IR] Autogenerate IrScriptImpl
^KT-65773 In Progress
2024-02-28 09:29:57 +00:00
Wojciech Litewka f30f2216cc [IR] Autogenerate IrEnumEntryImpl
^KT-65773 In Progress
2024-02-28 09:29:57 +00:00
Wojciech Litewka 401113cc27 [IR] Autogenerate IrClassImpl
^KT-65773 In Progress
2024-02-28 09:29:57 +00:00
Wojciech Litewka fde3ea14ae [IR] Autogenerate IrVariableImpl
^KT-65773 In Progress
2024-02-28 09:29:57 +00:00
Wojciech Litewka 222268b6f9 [IR] Autogenerate IrValueParameterImpl
^KT-65773 In Progress
2024-02-28 09:29:57 +00:00
Wojciech Litewka e23aff7256 [IR] Autogenerate IrTypeParameterImpl
^KT-65773 In Progress
2024-02-28 09:29:57 +00:00
Wojciech Litewka 6de200dea1 [IR] Autogenerate IrPropertyWithLateBindingImpl
^KT-65773 In Progress
2024-02-28 09:29:57 +00:00
Wojciech Litewka 5aedc24f00 [IR] Autogenerate IrLocalDelegatedProperty
^KT-65773 In Progress
2024-02-28 09:29:57 +00:00
Wojciech Litewka 87f5d3901c [IR] Autogenerate IrPropertyImpl
^KT-65773 In Progress
2024-02-28 09:29:57 +00:00
Wojciech Litewka 541a0f4bec [IR] Autogenerate IrFieldImpl
^KT-65773 In Progress
2024-02-28 09:29:56 +00:00
Wojciech Litewka f2af1bc04a [IR] Autogenerate IrConstructorImpl
^KT-65773 In Progress
2024-02-28 09:29:56 +00:00
Wojciech Litewka d97681f2a9 [IR] Autogenerate IrFunctionWithLateBindingImpl
^KT-65773 In Progress
2024-02-28 09:29:56 +00:00
Wojciech Litewka d5b78c0cdc [IR] Autogenerate IrFunctionImpl
^KT-65773 In Progress
2024-02-28 09:29:56 +00:00
Wojciech Litewka 518aee693e [IR] Autogenerate IrAnonymousInitializerImpl
^KT-65773 In Progress
2024-02-28 09:29:56 +00:00
Wojciech Litewka 6cdddaacb0 [IR] Final preparation to autogenerate IR declaration implementations
IR expressions are left out for now, because unlike declarations,
which are mostly created via IrFactory, expressions' constructors are
widely used, and it's hard to replicate the exact signatures of those
constructors with the tree generator.

Therefore, some other approach is expected to be taken when generating
them in the future.

^KT-65773 In Progress
2024-02-28 09:29:56 +00:00
Wojciech Litewka 451c51c849 [IR] Temporarily move to-be-autogenerated files under gen directory
so that git recognizes them as moved.
2024-02-28 09:29:56 +00:00
Wojciech Litewka 4d9d1974ec [IR generator] Better support for fields' default value in base classes
- Allows using those with the incoming IR implementation printer.
- Moves the logic to common tree generator, so other trees can specify
default values in base classes as well, if needed.

^KT-65773 In Progress
2024-02-28 09:29:56 +00:00
Wojciech Litewka 288351d733 [tree generator] Rename AbstractImplementation.fieldsWith(out)Default
to better describe their intended usage, see also next commit.

^KT-65773 In Progress
2024-02-28 09:29:56 +00:00
Wojciech Litewka 6fadc51856 [tree generator] Minor: pass model inside ImplementationConfigurator
Needed for config across many elements in subsequent commits.

^KT-65773 In Progress
2024-02-28 09:29:56 +00:00
Wojciech Litewka e737320d01 [FIR generator] Specify Field.isChild in base tree configuration
instead of inside implementation configuration.

Whether a field is a child element is a core concept of the tree,
not a matter of particular implementation class.

It is especially visible in IR tree, where the base classes implement the
acceptChildren method. It will also be more relevant in the future.

This also aligns the config style between IR and FIR tree generators.

^KT-65773 In Progress
2024-02-28 09:29:56 +00:00
Wojciech Litewka 6d5b07ebe9 [tree generator] Add AbstractElement#subElements, drop semantic leaves
The notion of IR element class being 'semantically leaf' is rather hacky.
Instead, now we only distinguish whether an element has its
implementation class, which is what this notion was actually trying to
represent.

^KT-65773 In Progress
2024-02-28 09:29:56 +00:00
Wojciech Litewka 7e01fc5906 [IR] Drop "leaf/non-leaf" comment from generated IR classes
As it is not much useful, and the current wording does not represent its
intended wording.
2024-02-28 09:29:56 +00:00
Wojciech Litewka d904ce0939 [tree generator] Merge default and custom implementations 2024-02-28 09:29:56 +00:00
Wojciech Litewka 665bd5153a [tree generator] Make defaultEmptyList#withGetter false by default
to align it with other default* methods.

This will be helpful for configuring IR implementation,
where there are many such empty lists.
2024-02-28 09:29:56 +00:00
Wojciech Litewka 5d7a5245ff [tree generator] Extract printPropertyDeclaration util
analogous to printFunctionDeclaration.

This decouples the printing logic from handling IR elements' fields,
and makes it easier to directly print arbitrary fields.
2024-02-28 09:29:56 +00:00
Wojciech Litewka 92ff782815 [IR] Call IR declaration constructors with named parameters
When those classes become auto-generated, the order of constructor
parameters will differ.
This commit ensures they will still be resolved correctly.

^KT-65773 In Progress
2024-02-28 09:29:56 +00:00
Wojciech Litewka a005f2e75d [IR] Make IrFunction.returnType lateinit
to replace custom logic that would throw in case of IrUninitialized.

This is to remove custom logic from those classes,
so that source generator will be able to generate
them in a straight-forward way.
Otherwise, it would need to be thought about those special cases, which
is better to be avoided.

There are two consequences:
- The error message will be more generic, and won't contain reference
to the element.
- It becomes possible to reassign returnType
property with IrUninitializedType
and read it afterward.

^KT-65773 In Progress
2024-02-28 09:29:56 +00:00
Wojciech Litewka 92c56d0535 [IR] Remove custom error messages for missing IrDeclaration.parent
This is to remove custom logic from those classes,
so that source generator will be able to generate
them in a straight-forward way.
Otherwise, it would need to be thought about those special cases, which
is better to be avoided.

It is also a small step for future work,
which likely involves making parent property nullable.

Unfortunately, this change causes a loss of some details from exception
messages.

^KT-65773 In Progress
2024-02-28 09:29:56 +00:00
Wojciech Litewka f6b2a5915e [IR] Remove some default values from implementation classes' constructors
To make it a bit easier and cleaner to autogenerate them.
Those default values were mostly unused anyway.

^KT-65773 In Progress
2024-02-28 09:29:56 +00:00
Wojciech Litewka 2a5b4ae652 [IR] Remove files parameter from IrModuleFragmentImpl
This commit removes the default parameter in constructor,
as well as custom logic in this class, which would
make it harder for its subsequent auto-generation.

^KT-65773 In Progress
2024-02-28 09:29:56 +00:00
Wojciech Litewka 83bc12949b [IR] Push default values from base to implementation classes
The default value of those properties is a detail that should be handled
 by implementation or builder layer.

 This change will also simplify auto-generating and reasoning about
 generated implementation classes, and allow for potential further
 enhancements like intercepting all mutations.

^KT-65773 In Progress
2024-02-28 09:29:56 +00:00
Wojciech Litewka 5921706a15 [IR generator] Minor: split Model.kt into Element.kt and Field.kt
^KT-65773 In Progress
2024-02-28 09:29:56 +00:00
Wojciech Litewka fbd8c79c1b [IR] Change IrErrorClassImpl from object to property
to avoid subclassing IrClass, which is a bit problematic for
subsequent refactorings.
2024-02-28 09:29:56 +00:00
Wojciech Litewka daeea1747d [IR] Split files containing multiple Ir*Impl classes
To produce smaller diff when switching to auto-generated classes.

^KT-65773 In Progress
2024-02-28 09:29:56 +00:00
Wojciech Litewka 3d9194c82c [IR] Make IrMutableAnnotationContainer an IrElement
It is required, so that IR tree generator will properly handle
the `annotations` property in subsequent commits,
e.g., to include them in implementation classes.

All subclasses of IrMutableAnnotationContainer
do already derive from IrElement.

^KT-65773 In Progress
2024-02-28 09:29:56 +00:00
Mikhail Glukhikh 202c7f4677 K2: cleanup of FirVisibilityChecker.isVisibleForOverriding 2024-02-28 09:00:56 +00:00
Dmitriy Novozhilov dd94de3a34 [FIR2IR] Properly set statement origin for all parts of += calls
^KT-65649 Fixed
2024-02-28 08:28:14 +00:00
Dmitriy Novozhilov e4537cb9f0 [FIR2IR] Unify utilities for rethrowing exceptions with attachments 2024-02-28 08:28:14 +00:00
Dmitriy Novozhilov 88206ca151 [Util] Allow to use Throwable as cause of ExceptionWithAttachment 2024-02-28 08:28:14 +00:00
Dmitriy Novozhilov 5c632bc78e [FIR2IR] Don't create f/o symbols on smartcasted Nothing in dispatch receiver
^KT-63525 Fixed
2024-02-28 08:28:14 +00:00
Dmitriy Novozhilov 62e9c944fe [FIR2IR] Minor. Cleanup Fir2IrVisitor.convertToIrReceiverExpression 2024-02-28 08:28:12 +00:00
Dmitriy Novozhilov 5b01396a11 [FIR] Carefully process constructors of inner and nested classes in the tower
If there is an expression receiver, we should process constructors only
  of inner classes. Constructors of nested classes can be called only
  on classifier

^KT-65333 Fixed
2024-02-28 08:08:32 +00:00
Dmitriy Novozhilov 67557ce731 [Test] Reproduce KT-65333 2024-02-28 08:08:31 +00:00
Alexander Udalov 7f90111283 Build: remove obsolete -Xbuiltins-from-sources from stdlib build
It was removed in 77dba281a3.
2024-02-28 07:25:47 +00:00
nataliya.valtman 485840731d Remove old build report properties
kotlin.build.report.dir and kotlin.internal.single.build.metrics.file
were deleted

#KT-64380
2024-02-27 21:46:53 +00:00
nataliya.valtman a7f57710e2 Create checker for deprecated gradle properties
#KT-64380 Fixed
2024-02-27 21:46:52 +00:00
Abduqodiri Qurbonzoda 65cfc578a8 Introduce constructor-like function for AutoCloseable #KT-66102 2024-02-27 20:52:49 +00:00
Abduqodiri Qurbonzoda 557ea32f87 Introduce kotlin.AutoCloseable typealias in K/JVM stdlib #KT-55777 2024-02-27 20:52:49 +00:00
Abduqodiri Qurbonzoda 98ad68eb90 Promote AutoCloseable & use to stable #KT-65532 2024-02-27 20:52:49 +00:00
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