Commit Graph

100773 Commits

Author SHA1 Message Date
Alexander Shabalin 968bf424b4 [K/N] Fix interop_objc_kt56402 with different GCs ^KT-56402
Merge-request: KT-MR-9865
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2023-04-28 17:10:07 +00:00
Ilya Goncharov dee3bbb4bf [Gradle, JS] Fix testing of composite build without respect of work of NPM, just look on generated package.json 2023-04-28 16:40:11 +00:00
Denis.Zharkov 555d8eeb25 K2: Fix false-positive DELEGATE_SPECIAL_FUNCTION_NONE_APPLICABLE
For explanation, see nestedPartiallyResolvedCallsSimple.k

The problem was caused by "select" variable is being leaked to the
inference session of delegate while it should not happen because
it doesn't belong to the common system of `KotlinVal { ..` call,
as we complete it with fixing `E` variable during completion
for `A(select(null, fun(): Int { return 1 }))`.

The root of the problem is that we were adding all the partial
nested calls to the session, while in fact we only need there
the top-level one.

^KT-57543 Fixed
2023-04-28 16:20:06 +02:00
Denis.Zharkov 8b81c3715d Minor. Cleanup FirDelegatedPropertyInferenceSession a bit
- Some functions might be private
- the stubTypeBySyntheticTypeVariable map is actually write-only
- integrateConstraints Boolean return value is always unused
2023-04-28 16:20:06 +02:00
Dmitrii Gridin f425dea3b8 [CLI] JvmDependenciesIndexImpl: add lock to make it thread safe
Can be rewritten to multi-thread implementation in the feature

^KT-56550
2023-04-28 13:41:05 +00:00
Dmitriy Novozhilov 15dfe6c750 [FIR2IR] Use signature instead of FIR as a key for fake-override storage
This is needed to correctly handle the case, when we have the same java
  class in common and platform module. In this scenario we have two
  different classes on frontend (because symbol providers are not shared)
  and completely different enhanced function in scopes of those classes,
  but exactly one IrClass for those classes, which is cached during
  conversion of common module together with cache of its fake overrides.
  So using FirDeclaration as a key to FO cache leads to the problem, when
  we can not find cached value for platform module, because it has different
  fir declarations for the same real decalration

^KT-58030 Fixed
2023-04-28 13:08:19 +00:00
Denis.Zharkov 7b46c59d57 K2: Complete property-candidate before starting invoke resolution
Before this commit, for property candidates in K2 their types wasn't
inferred/susbtituted properly.

So, when candidate for fooBar.liveLoaded.invoke() was created,
the type of `fooBar.liveLoaded` was just X type parameter for which
there is no any `bar()` functions in its member scope.

While proposed semantics is a bit different from K1, where
both property and invoke candidates are united into common system,
it doesn't contradict to the specification (https://kotlinlang.org/spec/overload-resolution.html#callables-and-invoke-convention)
which says explicitly that invoke-convention should be desugared as
`r.foo.invoke()`, thus `r.foo` should be completed independently.

Also, this strategy supports some reasonable use-cases like KT-58259
while it's still a breaking change but for more artificial-looking
situations (see KT-58260) and should be passed through
the language committee.

The changes in stubTypeReceiverRestriction* tests looks consistent
because of how `genericLambda` now works
(with full completion of property call).
NB: The code is going to be red once KT-54667 is fixed and also there's
already similar diagnostic in K1 (INFERRED_INTO_DECLARED_UPPER_BOUNDS)

^KT-58142 Fixed
^KT-58259 Fixed
^KT-58260 Related
2023-04-28 12:46:20 +00:00
Dmitrii Gridin 481becb342 [LL FIR] implement LLFirReturnTypeCalculatorWithJump
To provide the correct designation and locks strategy

^KT-56550
^KT-58083 Fixed
2023-04-28 11:59:02 +00:00
Marco Pennekamp f903cb6bbc [JVM IR] KTIJ-25152 Reference undiscovered expect symbols
- When the bytecode tool window opens a file containing `actual`
  declarations, not all the `expect` symbols reachable via the `actual`
  symbols' descriptors might be contained in the symbol table, because
  the source of the `expect` members is not included in the files to
  compile. This caused an issue during lowering in
  `ExpectDeclarationRemover.tryCopyDefaultArguments`.
- The solution adds `expect` symbols reachable via `actual` declarations
  to the symbol table, so that these `expect` symbols can subsequently
  be stubbed.

^KTIJ-25152 fixed
2023-04-28 11:36:18 +00:00
Alexander Udalov fc0ce415d7 JVM: remove source code from not null assertion message text
This is implemented under a LanguageFeature which will be enabled later,
when behavior change described in KT-57570 is approved.

 #KT-57570
2023-04-28 10:26:15 +00:00
Nataliya.Valtman ea264cb5b5 Add kotlin-build-statistics embedded dependency for JPS
#KT-58314: Fixed
2023-04-28 09:22:00 +00:00
Nikolay Krasko 3caa1d1349 Refactoring: fix usages of @TestOnly ExtensionsArea.registerExtensionPoint 2023-04-28 08:25:19 +00:00
Nikolay Krasko 6e18b75c73 [213] Do not remove deprecated ExtensionsArea.registerExtensionPoint
The method is proved to be used in klint project
https://github.com/pinterest/ktlint/blob/c5a81e0d4198fa5cb2cac69967080e01e365b837/ktlint-rule-engine/src/main/kotlin/com/pinterest/ktlint/rule/engine/internal/KotlinPsiFileFactory.kt#L121

There is an issue about the remove: https://github.com/pinterest/ktlint/issues/1981

KTI-1114
2023-04-28 08:25:19 +00:00
Alexander Shabalin cd93100148 [K/N] Fix sleeping in RWSpinLockTest ^KT-56233 2023-04-27 16:49:30 +00:00
Alexander Shabalin e6c0f32477 [K/N] Fixing ConcurrentMarkAndSweepTest ^KT-56233 2023-04-27 16:49:30 +00:00
Sebastian Sellmair 4e74f7e57c Enable new mpp dependency resolution
KT-58319
2023-04-27 18:38:45 +02:00
Yahor Berdnikau 982a4fbda0 Print in the console report showing amount of tasks used K2
^KT-57736 Fixed
2023-04-27 14:32:47 +00:00
Dmitrii Krasnov 847544d99c Removed jfrog repository from kapt integration tests
#KT-58022
2023-04-27 14:19:22 +00:00
Gleb Lukianets 242ca73d83 rrn/rd/KT-55578 User-provided hints for linker errors
[K/N] KT-55578 Show customized user suggestions on linkage errors

Merge-request: KT-MR-9636
Merged-by: Gleb Lukianets <Gleb.Lukianets@jetbrains.com>
2023-04-27 14:14:43 +00:00
Andrei Klunnyi 1e0115aef8 KT-57468 Kotlin assignment plugin: operation name cannot be found
The problem results in broken import quick fix and import optimizer on
the IDE side [1].

`AssignResolutionAltererExtension` introduced a possibility to override
 resolution of assignment statements. The inconsistency though is
 that `KtSimpleNameReference.getResolvesByNames` doesn't return a name
 for the overridden `=`. Kotlin as a language doesn't support this [2].

This commit eliminates the drawback above:
1. It fixes the name `assign` the `=` can be resolved to [3].
   This eliminates the need to search for the name, bypassing the
   plugins.
2. `KtSimpleNameReference.getResolvesByNames` returns `assign` among
   other names in case it deals with binary `=` and assignment is
   resolved.
3. `KtCompilerPluginsProvider` was extended to check plugins' presence.
   K1 implementation added.

----------------------------------------------------------------
[1]: https://youtrack.jetbrains.com/issue/KTIJ-24390
[2]: OperatorConventions.getNameForOperationSymbol
     https://kotlinlang.org/docs/operator-overloading.html#augmented-assignments
[3]: OperatorConventions#ASSIGN_METHOD + AssignmentPluginNames
2023-04-27 14:05:02 +00:00
Andrei Klunnyi 4c1a66b7d6 KT-57468 Kotlin assignment plugin: publish K2 & CLI artefacts
This commit effectively proceeds with the fix [1] but now in the context
of [2]. It includes jars from the assignment compiler plugin.

----------------------------------------------------------------------
[1]: https://youtrack.jetbrains.com/issue/KTIJ-24438
[2]: https://youtrack.jetbrains.com/issue/KTIJ-24390
2023-04-27 14:05:02 +00:00
Kirill Rakhman bd9f36ad01 [FIR] Move type parameter scope above member and static scopes in tower
This fixes a false positive TYPE_PARAMETER_IS_NOT_AN_EXPRESSION when
a type parameter and some member, static or companion declaration have
the same name and referred to inside a class.

#KT-58028 Fixed
2023-04-27 13:59:13 +00:00
Dmitriy Novozhilov 7958a9debd [FIR2IR] Correctly generate delegating constructor call for secondary constructors in enums
^KT-56927 Fxied
2023-04-27 13:35:14 +00:00
Kirill Rakhman a818c543a9 [FIR] Verify diagnostic messages don't reference non-existent parameters 2023-04-27 12:54:31 +00:00
aleksandrina-streltsova c956b4aeae [Analysis API FIR] Use stable module name when mangling internal name
^KTIJ-25046
2023-04-27 12:36:20 +00:00
Bogdan Mukvich a7396d8c10 Make gradle integration proguard test JDK 11 compatible 2023-04-27 12:25:21 +00:00
Bogdan Mukvich 0299d2c9e2 Use JDK 8 as JAVA_HOME for android tests
* android sdk tools binaries run in a child process relies on JAVA_HOME
* old android sdk tools can run only under JDK 8, requiring javax libs
2023-04-27 12:25:21 +00:00
Bogdan Mukvich b0d964ec8b Use JDK 8 as JAVA_HOME for kapt tests
* kapt tests launch scripts in a child process relied on JAVA_HOME
* tests fail under JDK 11 due to illegal reflexive access
2023-04-27 12:25:20 +00:00
Bogdan Mukvich e7989eecf5 Add function to get toolchain JDK home location 2023-04-27 12:25:20 +00:00
Mikhail Glukhikh 08c22c388c K2: change logic of result type search in ILT case
Related to KT-57487, KT-57703
2023-04-27 12:19:38 +00:00
Mikhail Glukhikh 27c4a7b7ef FE: add new tests around unresolved integer literals
Related to KT-57487, KT-57703
2023-04-27 12:19:38 +00:00
Mikhail Glukhikh 70c5978add K2: Approximate ILT in vararg expressions properly #KT-57487 Fixed 2023-04-27 12:19:38 +00:00
Anna Kozlova dead2c8be8 [LL] stubBased provider: deserialize fir from stubs build from decompiled text
if the compiled code is opened in the editor,
1. it's decompiled
2. stub is build over decompiled text
3. this stub replaces the stub built from classes.

This process leads to missed information in resulted FIR, e.g. half correct classId.
On the other side, this FIR is used only for this opened editor.
2023-04-27 11:37:29 +00:00
Anna Kozlova 2a47e89706 [LL] use provided sources to skip search for declaration phase 2023-04-27 11:37:29 +00:00
Anna Kozlova a41f7dc25d [cls] save parameter name for functional types in stub
to make it available for deserialized Fir
2023-04-27 11:37:28 +00:00
Anna Kozlova d59d66e876 [AA, LL] use stubs to build deserialized Fir elements in IDE
^KTIJ-24638

Notice on `DebugSymbolRenderer`:
stub based deserializer sets source directly,
but it's available in IDE mode only.
Thus, standalone and IDE tests have different results.
In order to avoid this, sources for compiled code are explicitly ignored

Notice on distinct callables:
for a file which belong to multiple libraries, decompiled code would be build per library.
In order to avoid ambiguity errors for members in that file,
we need to distinct provided elements by origins
failed test from IJ repo:
 FirReferenceResolveWithCrossLibTestGenerated#testSetWithTypeParameters
2023-04-27 11:37:28 +00:00
Anna Kozlova 96c15f6c71 [cls] include generated equals/hashCode/toString method in stubs
to avoid heavy computation of super functions
2023-04-27 11:37:27 +00:00
Anna Kozlova e28e8ad7b8 [AA] recognize library module by roots
merging `LLFirSelectingCombinedSymbolProvider.selectFirstElementInClasspathOrder`
relies on the fact that a candidate belongs to exactly one module.
This can be not true for libraries, attached to multiple modules.
 In that case we need to accept "wrong module" to retrieve correct provider
2023-04-27 11:37:27 +00:00
Anna Kozlova d491fd2f70 [LL] don't include kotlin classes in combined java provider
do not resolve annotations when short name doesn't match
2023-04-27 11:37:27 +00:00
Anna Kozlova 6ba4e37696 [psi] don't load ast for compiled code
deserialized parameters do not contain real default values anyway
2023-04-27 11:37:26 +00:00
Anna Kozlova 1f4e4f94a7 [FIR] varargs: do not leak source of value parameter to the call site
when source for compiled fir elements is set, it leaks e.g. to diagnostics,
which is then filtered

see `TestsWithStdLib.Experimental.testImplicitUsages`
2023-04-27 11:37:26 +00:00
Anna Kozlova e94946d8df [FIR] extract data class copy function generation 2023-04-27 11:37:25 +00:00
Anna Kozlova 3f6432cdc9 [FIR] setup origin for generated enum functions 2023-04-27 11:37:25 +00:00
Alexander Udalov 68b94b07b8 Fir2Ir: more precise calculation of enum class modality
Use the same condition as in the already existing `createIrEnumEntry`
function (and as in psi2ir): enum class should be final unless there's
an enum entry with any declaration other than its constructor.

 #KT-57216
2023-04-27 11:02:22 +00:00
aleksandrina-streltsova 2cc3b542fd [Analysis API FIR] Initialize properties of KtCallableSignature lazily 2023-04-27 10:59:30 +00:00
aleksandrina-streltsova 2eab9fc00f [AA] Fix incorrect nullability for KtType created from stub type
^KTIJ-24992 Fixed
2023-04-27 10:59:30 +00:00
aleksandrina-streltsova 1d905aa20c [Analysis API] Render type aliases with fully expanded types
^KTIJ-24989
2023-04-27 10:59:30 +00:00
aleksandrina-streltsova 3c8531aad8 [Analysis API] Allow obtaining original for fake declaration/file
It is required to remove dependency on low-level API from completion
2023-04-27 10:59:29 +00:00
Kirill Rakhman 6d3b911dfc [K2/Native] Configure metadata compilation mode
This fixes access to internal declarations in common source sets from
intermediate source sets that are compiled to metadata.

#KT-58219 Fixed
2023-04-27 10:49:53 +00:00
Dmitrii Krasnov aea8670c12 migrated NativeLibraryDslIT and NativeLibraryDslWithCocoapodsIT to junit 5 and gradle TestKit
#KT-51553
2023-04-27 10:40:32 +00:00