Commit Graph

101346 Commits

Author SHA1 Message Date
Nikolay Lunyak f446fc4154 [FIR] KT-58719: Ensure the compiler resolves to the class 2023-05-22 11:40:30 +00:00
Denis.Zharkov 67d51eb7ee Add a separate test configurations for JDK 21 dependent test
After it's released, there would be no need in them, but right now
they are unavailable through the toolchain, so we can't require it.
See KT-58765 for tracking

But there should be a dedicated Build configuration with JDK_21_0 env
properly set.

^KT-58716 Fixed
2023-05-22 09:19:52 +00:00
Vladimir Sukharev 4705207263 [K2/N] Fix lost diagnostics
^KT-58065

Merge-request: KT-MR-10264
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-05-22 09:18:04 +00:00
Denis.Zharkov 6b2da2069d K2: Use Any? expected type only for the right argument of == operator
^KT-47409 Fixed
2023-05-22 08:41:55 +00:00
Dmitrii Gridin 447e1711da [LL FIR] do not update phase if exception occurred
Exception (even PCE) can lead to inconsistent situations, for example,
where a function can be marked as resolved, but arguments – not.
Also, in this case, it is possible that the function will be
marked as resolved to TYPES, but not all its type really resolved

^KTIJ-25582 Fixed
2023-05-19 22:59:32 +00:00
Igor Yakovlev 1749bafc30 [Wasm] Rename dateref to structref 2023-05-19 15:50:07 +00:00
Igor Yakovlev 1e0be4e0af [Wasm] Fix null constant typed with external class upperbound 2023-05-19 15:50:06 +00:00
Igor Yakovlev 1c716cee9c [Wasm] Update versions of nodejs, d8 and binaryen 2023-05-19 15:50:06 +00:00
Igor Yakovlev ed1c15b64b [Wasm] Remove redundant code 2023-05-19 15:50:06 +00:00
Igor Yakovlev 6adfd91169 Revert "[Wasm] Revert a7ed496a and few fixes to make Kotlin/Wasm compatible with Firefox"
This reverts commit 1d793f7bec.
2023-05-19 15:50:06 +00:00
Igor Yakovlev 6437d0919c [Wasm] Replace deprecated cast instructions 2023-05-19 15:50:06 +00:00
Igor Yakovlev 45897cf045 [Wasm] Update SpiderMonkey and D8 2023-05-19 15:50:06 +00:00
Kirill Rakhman df03f0df0a [FIR] Implement deprecation for implementing var by inherited val
#KT-56779 Fixed
2023-05-19 15:04:46 +00:00
Mikhail Glukhikh 941446ea39 FE: rework tests around changed progression resolve
Related to KT-54261, KT-36932, KT-49276
2023-05-19 14:57:26 +00:00
Mikhail Glukhikh 5fda57fa55 FE: delay DisableCheckingChangedProgressionsResolve to 2.*
This commit removes the relevant feature from 1.9 and
makes this feature experimental.
We plan to enable it in some 2.* version (not earlier than 2.1)

Related to KT-54261, KT-36932, KT-49276
#KT-58791 Fixed
2023-05-19 14:57:26 +00:00
Dmitrii Gridin 500016df87 [LL FIR] do not drop resolvePhase for recreated class
Because now all phases below DECLARATIONS do not depend on the class
declarations

^KT-56551
2023-05-19 14:33:37 +00:00
Anastasia.Nekrasova 58fca659a2 [IR] Fix private methods with default parameters
It is required for methods with default parameters to pass a dispatchReceiver (if the IrCall has one) as an argument, because the method generated bytecode expects it. In the case where the function has both receivers (dispatchReceiver and extensionReceiver), only the extensionReceiver should be added.

Related to KTIJ-24564
2023-05-19 13:56:21 +00:00
Dmitrii Gridin 579df97a7c [FIR] errorInLazyResolve: fix typo 2023-05-19 15:30:32 +02:00
Alexander Udalov fb900d2e2a JVM: remove most usages of JvmTarget.JVM_1_6 2023-05-19 13:24:00 +00:00
Alexander Udalov 75197d1b86 JVM: remove diagnostics related to JVM target 1.6 2023-05-19 13:24:00 +00:00
Alexander Udalov e4e1bcefbd JVM: remove tests on JVM target 1.6 2023-05-19 13:23:59 +00:00
Dmitrii Gridin b713dfd7ea [AA FIR] KtFirOverrideInfoProvider: resolve to status only if needed
^KT-56551
2023-05-19 12:43:45 +00:00
Dmitrii Gridin b88cde11b1 [LL FIR] mark super types phase as non-jumping
It is supposed that this phase can't be called from itself
because now it is impossible to jump under a lock

^KT-56551
2023-05-19 12:43:45 +00:00
Dmitrii Gridin 0d7ddd65c2 [LL FIR] drop global phase lock from status phase
^KT-56551
2023-05-19 12:43:45 +00:00
Dmitrii Gridin 2885df14ee [LL FIR] rewrite status phase transformer
Now we will try to avoid redundant calculation:
* Class-like declarations can be calculated without super types
* Overridden search logic not is out of lock

Unfortunately, right now it is not safe to use
StatusResolveMode.FunctionWithSpecificName and
StatusResolveMode.PropertyWithSpecificName
because lazyResolveToPhaseWithCallableMembers can lead to an incorrect
state of scope. Example:
```
open class A {
  open fun a() {}
  open fun b() {}
}
class C : A()
```
Steps:
1. Resolve constructor of C to STATUS
2. Now we want to call lazyResolveToPhaseWithCallableMembers on
C, and this call will do nothing because this class and all
its declarations (only constructor) are already in STATUS phase,
so class A won't be resolved as expected

^KT-56551
2023-05-19 12:43:45 +00:00
Dmitrii Gridin e464af00db [LL FIR] do not calculate constructors with classes during types phase
^KT-56551
2023-05-19 12:43:45 +00:00
Dmitrii Gridin 5b3f617378 [FIR] add memberRequiredPhase to declaredMemberScope
^KT-56551
2023-05-19 12:43:45 +00:00
Dmitrii Gridin 01a94624f5 [AA FIR] KtFirScopeProvider: use lazy resolve only if needed
^KT-56551
2023-05-19 12:43:45 +00:00
Dmitrii Gridin f2da13b39d [AA FIR] KtFirMemberSymbolPointer: replace explicit lazy resolve call with implicit
^KT-56551
2023-05-19 12:43:45 +00:00
Dmitrii Gridin 04231d7497 [AA FIR] add missing memberRequiredPhase to some usages of unsubstitutedScope
^KT-56551
2023-05-19 12:43:45 +00:00
Dmitrii Gridin fdec0bd942 [FIR] drop redundant memberRequiredPhase parameter from overriddenFunctions
It should be STATUS always, because we want to process overrides

^KT-56551
2023-05-19 12:43:45 +00:00
Dmitrii Gridin aaf173687b [FIR] rename requiredPhase to requiredMembersPhase for type scope
Also move `requiredMembersPhase` use inside `unsubstitutedScope`

^KT-56551
2023-05-19 12:43:44 +00:00
Dmitrii Gridin 52ce302095 [FIR] AbstractFirStatusResolveTransformer: drop unreachable 'if'
^KT-56551
2023-05-19 12:43:44 +00:00
Dmitrii Gridin 595279887a [LL FIR] add correct isResolved check to expect-actual phase transformer 2023-05-19 12:19:36 +00:00
Dmitrii Gridin 71386cc117 [FIR] SignatureEnhancement: fix CME from type parameters enhancement
The problem was that type parameters of Java function were changed
without any synchronization.
In fact, we shouldn't mutate Java declarations at all.
So now we don't mutate type parameters – instead of this,
we mutate only its copy that is safe

^KT-58613 Fixed
^KTIJ-25242 Fixed
^KTIJ-21791 Fixed
2023-05-19 12:17:12 +00:00
Anastasia.Nekrasova fa6fc0e334 [IR] Fix local function with default param
The key 'localDeclarationsData' is a IrFunction whose symbol owner is 'IrDeclarationOrigin.LOCAL_FUNCTION'. To find the 'localsData', it's required to get the original local IrFunction ('IrDeclarationOrigin.LOCAL_FUNCTION') for the IrFunction with default arguments (IrDeclarationOrigin.FUNCTION_FOR_DEFAULT_PARAMETER).

Related to KTIJ-25558
2023-05-19 11:57:10 +00:00
Ilya Kirillov 993acad3f3 [Analysis API] optimize DeclarationsInPackageProvider.getTopLevelClassifierNamesInPackageProvider 2023-05-19 11:53:16 +00:00
Ilya Kirillov d1da3b8acd [Analysis API] fix missing names in KtFirStarImportingScope
The missing name types were: java classifier names, callable/classifier names generated by plugins
2023-05-19 11:53:16 +00:00
Ilya Kirillov 546191d1b3 [Analysis API] refactoring, simplify constructor KtFirStarImportingScope 2023-05-19 11:53:16 +00:00
Ilya Kirillov 50c49838ba [Analysis API] refactoring, extract top level name collecting to a separate file
out of KtFirPackageScope
2023-05-19 11:53:16 +00:00
Ilya Kirillov 51c04b624f [Analysis API] optimize KtFirPackageScope.getPossibleClassifierNames
Previously, we did the kotlin subclasses name search two times:
- via `KotlinDeclarationProvider`
- via `JavaElementFinder`

which is redundant and slows down the searching
2023-05-19 11:53:16 +00:00
Ilya Kirillov c646008438 [Analysis API] refactoring, extract forEachNonKotlinPsiElementFinder to a separate file 2023-05-19 11:53:16 +00:00
Ilya Kirillov f8ddf204e2 [Analysis API] add KtTypeScope.getCallableSignatures/getClassifierSymbols overloads which accept a candidate name set
This is needed for the cases when a candidate name set is known
to avoid retrieving a set with all possible names when processing the scope.

Similar to KtScope.

^KT-58653
2023-05-19 11:53:15 +00:00
Ilya Kirillov ee1fd9f6e9 [Analysis API] optimize composite scope
Do not create KtCompositeScope for empty or single scopes
2023-05-19 11:53:15 +00:00
Ilya Kirillov 950a32901c [Analysis API FIR] refactoring, remove duplicated code from KtFir(Non)StarImporting scope
use base class implementation instead.
2023-05-19 11:53:15 +00:00
Ilya Kirillov 55bbc5eb02 [Analysis API FIR] refactoring, extract base part of KtFirDelegatingScope into a separate class
For further reuse
2023-05-19 11:53:15 +00:00
Ilya Kirillov 41976a2932 [Analysis API] optimize scope members processing when a candidate name set is known
Use KtScope.getCallableSymbols/getClassifier symbols overloads which accept a candidate name set.

^KT-58653
2023-05-19 11:53:15 +00:00
Ilya Kirillov 29be88e3c9 [Analysis API] add KtScope.getCallableSymbols/getClassifier symbols overloads which accept a candidate name set
This is needed for the cases when a candidate name set is known
 to avoid retrieving a set with all possible names when processing the scope.

^KT-58653 fixed
2023-05-19 11:53:15 +00:00
Kirill Rakhman aacdfb67c6 [Stubs] Bump stubs version
#KT-58786
2023-05-19 11:50:40 +00:00
Kirill Rakhman 47b8fd7e0c [AA] Mute tests related to decompilation of aliased types from stubs
#KT-58786
2023-05-19 11:50:40 +00:00