Commit Graph

104184 Commits

Author SHA1 Message Date
Aleksei.Cherepanov 498d2c0bd7 [Workspace model] Add targetPlatform serialization for Kotlin Facet Settings
This commit is needed for adding targetPlatform serialization for Kotlin Facet Settings Workspace Model on IJ side

Merge-request: KT-MR-11953
Merged-by: Aleksei Cherepanov <aleksei.cherepanov@jetbrains.com>
2023-08-30 15:35:12 +00:00
Alexander.Likhachev dafec3c0e5 Always use latest kotlin-build-env image for Space dev environments
#KTI-1362 Fixed
2023-08-30 15:24:12 +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
Dmitriy Novozhilov 5a46563a2c [FIR2IR] Extract logic of IR declarations generation into separate component. Part 3
Move caching of created IrFunctions back to Fir2IrDeclarationStorage
Fix all call-sites
2023-08-30 14:51:44 +00:00
Dmitriy Novozhilov 12c02897e1 [FIR2IR] Extract logic of IR declarations generation into separate component. Part 2
This commit fixes access of enter/leaveScope in Fir2IrCallableDeclarationsGenerator
2023-08-30 14:51:44 +00:00
Dmitriy Novozhilov 08ebe04485 [FIR2IR] Extract logic of IR declarations generation into separate component. Part 1
This commit just moves methods, which create IR callable declarations
  from Fir2IrDeclarationStorage to newly created Fir2IrCallableDeclarationsGenerator
  and Fir2IrLazyDeclarationsGenerator without any modifications.

Code in generators contains some errors (mostly because it refers to the
  logic of caching created declaration), and those errors will be fixed
  in following commits
2023-08-30 14:51:44 +00:00
Ilya Kirillov 714cb67254 [decompiler] add tests for generated psi text by builtin decompiler 2023-08-30 14:45:15 +00:00
Ilya Kirillov 5fc458d5a4 [LL FIR] implement toString for LLFirKotlinSymbolProvider and LLFirSession 2023-08-30 14:45:15 +00:00
Ilya Kirillov 9ea344fe76 [decompiler] fix ambiguities to builtin members resolve in K2 IDE
If a user has multiple kotlin-stdlib libraries in a project, all those stdlib libraries will contain builtins
which will result in resolution ambiguities.

To prevent such kind of ambiguities inside LLFirDependenciesSymbolProvider,
callables are grouped by facade class name.
Only matching callables from the first facade are used.

Facade is a Kotlin/JVM-term so right now it works only for JVM targets.
Builtins are also used in JVM, so the current solution is to have a Facade name also for builtins.

^KTIJ-26760
2023-08-30 14:45:14 +00:00
Ilya Kirillov 866368cf69 [LL FIR] fix navigation to stdlib declarations in K2 IDE
If a user has kotlin-stdlib in their project,
the IDE should resolve the builtin declarations to the kotlin-stdlib
instead of builtins from the Kotlin plugin.

^KTIJ-26760
2023-08-30 14:45:14 +00:00
Ilya Kirillov 5ab408859b [LL FIR] create a single builtin symbol provider which will be reused for the whole project when no stdlib is available
Previously, every kotlin stdlib containing builtins was searched causing resolution ambiguities.

^KTIJ-26760 fixed
2023-08-30 14:45:14 +00:00
Ilya Kirillov e8db349f24 [decompiler] extract builtin VirtualFile creation to a separate service for further reuse
^KTIJ-26760
2023-08-30 14:45:14 +00:00
Nikita Bobko 373abbde5d Partially revert "[FE] Stop ignoring ABSTRACT_MEMBER_NOT_IMPLEMENTED for expect classes"
^KT-61039 Fixed
KT-59739 is now open for K1 (but fixed in K2)
Review: https://jetbrains.team/p/kt/reviews/11867/timeline

This partially reverts commit 4f3ecedbca.
Only K1 part is reverted.

Motivation for revert: KT-59739 cannot be properly fixed in K1 because
of the bug it causes - KT-61039

We just accepted that we will have one more "green in K1 -> red in K2"
case
2023-08-30 14:35:59 +00:00
Nikita Bobko 3534a4b7a9 Improve NON_ACTUAL_MEMBER_DECLARED_IN_EXPECT_NON_FINAL_CLASSIFIER_ACTUALIZATION diagnostic message
In scope of: KT-22841
Review: https://jetbrains.team/p/kt/reviews/11867/timeline
2023-08-30 14:35:58 +00:00
Nikita Bobko 3722f4d7d6 ActualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker: reuse "expect-actual" matcher
In scope of: KT-22841
Review: https://jetbrains.team/p/kt/reviews/11867/timeline

Reduce complexity by reusing "expect-actual matcher" (namely
`AbstractExpectActualCompatibilityChecker.getCallablesCompatibility`)

The current solution has worse algorithmic complexity. Previously it was
O(n) in the best case, where `n` is a number of members. Now, it's
O(m^2), where `m` is number of members in one overload group. But we
prefer to have worse complexity but reuse expect-actual matcher, number
of elements in one overload group shall not be big on real world
examples.

The previous logic was non-trivial because it compared types with with
double comparison in `equals`.
2023-08-30 14:35:56 +00:00
Nikita Bobko 17089276a7 Add regression tests for modality changes
Motivation: the discovered false negative in test
changeModalityFromAbstractToOpenInOverride.kt

Unfortunately, it can't be fixed in K1, so we will just live with that.
Luckily, we report ABSTRACT_MEMBER_NOT_IMPLEMENTED additionally.

In K2, MODALITY_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION
will be correctly reported as a compilation error

In scope of: KT-22841
Review: https://jetbrains.team/p/kt/reviews/11867/timeline
2023-08-30 14:35:55 +00:00
Roman Golyshev 21dffe4639 KT-61568 [FIR][AA] Do not add redundant file scopes in AllCandidatesResolver
`firResolveSession.getTowerContextProvider` should already
contain all the relevant scopes, including default and
importing scopes for the file

Because of this, import and default scopes had presence over the
more local scopes, and the resolve was performed incorrecty - top level
candidates were given higher priority

^KT-61568 Fixed
^KTIJ-26824 Fixed
2023-08-30 14:30:21 +00:00
Bogdan Mukvich 826297979d SBOM for native artifacts
^KTI-1240
2023-08-30 13:20:33 +00:00
Aleksei.Cherepanov 68af705664 Add import tracker
This tracker reports import directives to IJ's JPS to track changes and detectwehen it is needed to adjust compilation scope.

#KT-44835 Fixed
2023-08-30 12:42:39 +00:00
Aleksei.Cherepanov b27aef2c61 Add test
#KT-44835 In Progress
2023-08-30 12:42:39 +00:00
Alexander Shabalin 3ec4f2e0ee [K/N] Remove jsinterop because K/N wasm32 target is removed ^KT-59008
See https://kotl.in/native-targets-tiers for details
2023-08-30 12:17:52 +00:00
Stanislav Ruban 857bfeb92c [KMP] Fix multiplatform test data with ACTUAL_WITHOUT_EXPECT messages 2023-08-30 12:06:43 +00:00
Stanislav Ruban e7b7ef18fa [KMP] Tweak ACTUAL_WITHOUT_EXPECT message to include 'value' modifier
See KT-59660 for an example of relevant code.
2023-08-30 12:06:43 +00:00
Nikolay Lunyak 6c6474bb19 [FIR] Fix a typo in one of the multiple defaults diagnsotics messages
Merge-request: KT-MR-11942
Merged-by: Nikolay Lunyak <Nikolay.Lunyak@jetbrains.com>
2023-08-30 11:40:07 +00:00
Ilya Gorbunov 516383b995 [Docs] add wasm source sets for wasm-js and wasm-wasi 2023-08-30 11:37:29 +00:00
strangepleasures ece40ca775 Lazy evaluation of an error prefix in MethodInliner (performance optimization) 2023-08-30 09:51:54 +00:00
Alexander Udalov 5aa0000b3e Tests: remove IGNORE_BACKEND_K2_LIGHT_TREE directive
This is a partial revert of f47040696e. This directive is not used
anymore.

 #KT-56757 Fixed
2023-08-30 09:50:36 +00:00
vladislav.grechko e9ccc0329c Fix isKotlinFunctionWithBigArity function
fixup! Fix `isKotlinFunctionWithBigArity` function

Fix `isKotlinFunctionWithBigArity` function

Previous implementation could return false positive results, e.g. for
class named `abacaba.kotlin.Function42`

^KT-61548: Fixed


Merge-request: KT-MR-11928
Merged-by: Vladislav Grechko <Vladislav.Grechko@jetbrains.com>
2023-08-30 09:15:00 +00:00
Dmitriy Novozhilov 84d863aaf4 [Doc] Add documentation for FIR checkers 2023-08-30 08:51:56 +00:00
Yan Zhulanow ebd0ac8933 [LL API] Minor, move the call conflict resolver to the right package 2023-08-30 06:38:44 +00:00
Yan Zhulanow 8ad9718310 [LL API] Check the class file is in a conventional place
Although 'VirtualFile's are typically inside the containing package
directory, e.g. 'foo/bar/Baz.class' for 'foo.bar.Baz', there might
be classes with files in unexpected places. Sources of such classes
may include broken stubs, or just classes from misbehaving IDE plugins.

As we are yet to identity such cases, here we treat them as 'other'
candidates.
2023-08-30 06:38:44 +00:00
Yan Zhulanow faaba52ed5 [LL API] Minor, clean up 'LLLibraryScopeAwareConeCallConflictResolver' 2023-08-30 06:38:44 +00:00
Yan Zhulanow 4c3d414067 [LL API] Minor, fix documentation for 'globalLanguageVersionSettings' 2023-08-30 06:38:44 +00:00