Commit Graph

45188 Commits

Author SHA1 Message Date
Alexander Udalov 5c19cb3fcb [KAPT4] KT-51982 Implement Kapt4AnalysisHandlerExtension, add KAPT CLI and Gradle IT
Co-authored-by: Alexander Udalov <Alexander.Udalov@jetbrains.com>
2023-08-31 22:19:13 +00:00
Mikhail Glukhikh 3ff2c7d6f7 K2: introduce custom Enum.entries migration checkers
Related to KT-56623, KT-56587
#KT-59344 Fixed
2023-08-31 13:29:02 +00:00
Mikhail Glukhikh e0d68fc93e K2: introduce FirEnumEntriesRedeclarationChecker (KT-59344) 2023-08-31 13:29:01 +00:00
Mikhail Glukhikh d028f9ec95 K2: add stubs for enum entries deprecation diagnostics (KT-59344) 2023-08-31 13:29:01 +00:00
Pavel Kunyavskiy 91e96e9f31 [Fir2Ir] Introduce testing with IrFakeOverrideBuilder
^KT-61514
2023-08-31 13:12:15 +00:00
Pavel Kunyavskiy bf9cae6410 [Fir2Ir] Support rebuilding fake overrides over IR
^KT-61514
2023-08-31 13:12:15 +00:00
Pavel Kunyavskiy 44c2a749c9 [Ir common] Introduce symbol table api to remove entries
^KT-61514
2023-08-31 13:12:15 +00:00
Nikolay Lunyak 0d19942d2c [FIR] Make reporting of local class diagnostics more consistent with K1
It would be nice to report more appropriate diagnostics at the
corresponding places, but right now it's more important to
fix greenness-redness problems. Plus, this is already how K1 works.

^KT-59900 Fixed
2023-08-31 13:07:00 +00:00
Brian Norman 997e062de9 [FIR] Check top-level property initialization via CFG
Now that files have a CFG, use it to validate properties are initialized
correctly. Update FirTopLevelPropertiesChecker to collect initialization
info for the property being checked - similar to
FirMemberPropertiesChecker - and validate proper initialization.

#KT-56683 Fixed
#KT-58531 Fixed
2023-08-31 12:50:52 +00:00
Brian Norman b55fda0c55 [FIR] Create CFG for files to track top-level property initialization
In order to properly analyze top-level property initialization, a
control-flow graph must be created for FirFiles. This change adds the
foundation for the file CFG and updates body resolve to create the CFG.
Checking the CFG for proper initialization is separated into a following
change to ease code review.

KT-56683
2023-08-31 12:50:52 +00:00
Dmitrii Gridin 0b7eb32064 [FIR] FirSupertypeResolverVisitor: use symbol API instead of ClassId version
In Low Level FIR we have a simplified version of getFirClassifierContainerFileIfAny
without a scope search

^KTIJ-26848
2023-08-31 12:34:46 +00:00
Dmitriy Novozhilov de68ec7cd5 [FIR] Properly report SEALED_INHERITOR_IN_DIFFERENT_MODULE
^KT-46031 Fixed
^KT-59804 Fixed
2023-08-31 12:32:25 +00:00
Anton Bannykh 387898056a [JS] Report K2 diagnostics before Fir2IR
^KT-60531 fixed
2023-08-31 12:15:08 +00:00
Brian Norman 3590f0aa03 [FIR] Check type alias visibility after constructor visibility
#KT-61576 Fixed
2023-08-31 12:01:30 +00:00
Evgeniy.Zhelenskiy 6ede1bcf85 [IR] Reduce unnecessary allocations 2023-08-31 10:43:30 +00:00
Kirill Rakhman 0121686a7f [RAW FIR] Use KtFakeSourceElementKind.WrappedDelegate in LT 2023-08-31 10:19:33 +00:00
Kirill Rakhman 21f8ba1706 [FIR] Don't report DEPRECATION on self-access in delegated property
#KT-60682
2023-08-31 10:19:33 +00:00
Kirill Rakhman 411210b520 [RAW FIR] Use range as source of desugared loop-related statements 2023-08-31 10:19:33 +00:00
Kirill Rakhman 61259ef34b [FIR] Report missing DEPRECATION on fake sources
#KT-60682
2023-08-31 10:19:33 +00:00
Kirill Rakhman 4e041494be [FIR] Report DEPRECATION when Java declaration is deprecated in javadoc
#KT-60682
2023-08-31 10:19:33 +00:00
Dmitriy Novozhilov 6169834bb3 [FIR] Make FirResolvedDeclarationStatus.modality non nullable
^KT-58764 Fixed
2023-08-31 09:38:44 +00:00
Kirill Rakhman ac102dedac [IR Actualizer] Fix fake-override generation in actual A -> common B -> actual C hierarchy
...  where C defines a member x and A overrides the member x

#KT-61166 Fixed
2023-08-31 07:52:02 +00:00
Kirill Rakhman 293474ee50 [FIR2IR] Remove unused return value of processOverriddenPropertySymbols 2023-08-31 07:52:01 +00:00
Ivan Kochurkin c8c25d8b98 [FIR] Fix resolving of overload function with expect and common candidates
^KT-58896 Fixed
2023-08-30 15:58:59 +00:00
Alexander Udalov dc2deea04c JVM: remove unnecessary check in StrictBasicValue.equals
Types are already checked for equality several lines below.
2023-08-30 15:35:43 +00:00
Alexander Udalov 12bbdebed2 JVM IR: support value classes only when feature is enabled
Remove NeedsToVisit because it doesn't really help with performance, and
it significantly increases code complexity.
2023-08-30 15:35:43 +00:00
Alexander Udalov 2dee47a8c1 JVM IR: simplify JvmValueClassAbstractLowering.visitReturn
Change the existing IrReturn object instead of returning a new one.
2023-08-30 15:35:43 +00:00
Alexander Udalov d1f884bad9 JVM IR: micro-optimization in IrType.erasedUpperBound
Avoid `is` on interfaces, use classes instead.
2023-08-30 15:35:43 +00:00
Alexander Udalov 35d498847e JVM IR: reorder some resolveFakeOverride calls 2023-08-30 15:35:43 +00:00
Alexander Udalov 29fab6c3eb IR: optimize IrDeclarationWithName.fqNameWhenAvailable
Do not construct lots of FqName objects, since doing so takes ~1% of JVM
backend time.
2023-08-30 15:35:43 +00:00
Alexander Udalov f1886f8219 JVM IR: optimize comparison with FQ name of kotlin.Result 2023-08-30 15:35:43 +00:00
Alexander Udalov 70f48db226 JVM IR: optimize IrIntrinsicMethods.getIntrinsic
Create a nested hash map with names as keys that are easier to compute
than the whole `Key`. It helps to substantially reduce the number of
computed FqName instances, since intrinsics are queried on generation of
each call.

Also put intrinsic query a bit lower in SyntheticAccessorLowering, after
operations which are easier to compute.
2023-08-30 15:35:43 +00:00
Dmitriy Novozhilov 332eca2d55 [Test] Update testdata of fixed test
I don't really know which exact commit fixed this test, but there was
  a problem with return types of delegated members. Before my changes
  delegated `override fun foo(x: Int)` in `actual class E` had error
  return type and now it has correct type `Int`
2023-08-30 14:51:45 +00:00
Dmitriy Novozhilov b53ccf7fac [FIR2IR] Drop Fir2IrSymbols in favor of IrPublicSymbol...Impl
Effectively, those two symbol hierarchies have the same semantics, so
  there is no sense to keep them both
2023-08-30 14:51:45 +00:00
Dmitriy Novozhilov 1776b84945 [FIR2IR] Remove unused checks of type parameter index 2023-08-30 14:51:45 +00:00
Dmitriy Novozhilov 0d942d2564 [FIR2IR] Extract logic of IR declarations generation into separate component. Part 17
Move creation of Fir2IrLazyConstructor into Fir2IrLazyDeclarationsGenerator
2023-08-30 14:51:45 +00:00
Dmitriy Novozhilov b9fd78d906 [FIR2IR] Extract logic of IR declarations generation into separate component. Part 16
Group methods of Fir2IrClassifierStorage and Fir2IrClassifiersGenerator
  by types of declarations they are working with.

This commit contains nothing but just moving code in borders of the same file
2023-08-30 14:51:45 +00:00
Dmitriy Novozhilov 40ae5a8e33 [FIR2IR] Extract logic of IR declarations generation into separate component. Part 15
Always require containing IrClass for enum entries
2023-08-30 14:51:45 +00:00
Dmitriy Novozhilov eb9c732527 [FIR2IR] Extract logic of IR declarations generation into separate component. Part 14
Decompose creation, processing, and caching local classes between classifier
  storage and classifiers generator
2023-08-30 14:51:45 +00:00
Dmitriy Novozhilov 41fa276022 [FIR2IR] Extract logic of IR declarations generation into separate component. Part 13
Move almost all caching of created classifiers from Fir2IrClassifiersGenerator
  back to Fir2IrClassifierStorage
2023-08-30 14:51:45 +00:00
Dmitriy Novozhilov 26211a0277 [FIR2IR] Extract logic of IR declarations generation into separate component. Part 12
This commit just moves methods which create IR callable declarations
  from Fir2IrClassifierStorage to newly created Fir2IrClassifiersGenerator

Code in generators contains some errors (mostly because it refers to the
  logic of caching created declaration), and those errors will be fixed
  in the following commits
2023-08-30 14:51:45 +00:00
Dmitriy Novozhilov e2e8a9eb8f [FIR2IR] Extract logic of IR declarations generation into separate component. Part 11
Move creation of IrScript into Fir2IrCallableDeclarationsGenerator
2023-08-30 14:51:45 +00:00
Dmitriy Novozhilov 771b44fd02 [FIR2IR] Extract logic of IR declarations generation into separate component. Part 11
Group methods of Fir2IrDeclarationStorage and Fir2IrCallableDeclarationsGenerator
  by types of declarations they are working with.

This commit contains nothing but just moving code in borders of the same file
2023-08-30 14:51:45 +00:00
Dmitriy Novozhilov 5163e578aa [FIR2IR] Extract logic of IR declarations generation into separate component. Part 10
Restore old behavior of forced creation of fake-overrides
This behavior semantically is not fully correct, because it ignores existed
  f/o in storages and overwrites them, but replacing `createIr...` with
  `getOrCreate...` leads to problems with f/o in actual classes

^KT-61513
2023-08-30 14:51:45 +00:00
Dmitriy Novozhilov c215df8b93 [FIR2IR] Extract logic of IR declarations generation into separate component. Part 9
Move caching of created lazy declarations back to Fir2IrDeclarationStorage
2023-08-30 14:51:45 +00:00
Dmitriy Novozhilov 6e2123c2b6 [FIR2IR] Extract logic of IR declarations generation into separate component. Part 8
Move caching of created IrParameter, IrVariable and IrLocalDelegatedProperty
  back to Fir2IrDeclarationStorage
2023-08-30 14:51:45 +00:00
Dmitriy Novozhilov 8d9fa0fdde [FIR2IR] Extract logic of IR declarations generation into separate component. Part 7
Move caching of created IrField back to Fir2IrDeclarationStorage
2023-08-30 14:51:45 +00:00
Dmitriy Novozhilov b3efad5428 [FIR2IR] Extract logic of IR declarations generation into separate component. Part 6
Move caching of created IrProperty back to Fir2IrDeclarationStorage
2023-08-30 14:51:44 +00:00
Dmitriy Novozhilov e83dc35ba5 [FIR2IR] Extract logic of IR declarations generation into separate component. Part 5
Move caching of created IrConstructor back to Fir2IrDeclarationStorage

^KT-61513
2023-08-30 14:51:44 +00:00
Dmitriy Novozhilov 6621b16e77 [FIR2IR] Extract logic of IR declarations generation into separate component. Part 4
Move caching of created IrAnonymousInitializer back to Fir2IrDeclarationStorage
Fix all call-sites
2023-08-30 14:51:44 +00:00