Commit Graph

108547 Commits

Author SHA1 Message Date
Yahor Berdnikau 5b18687935 [Gradle] Fix warnings in KotlinMetadataTargetConfigurator
^KT-56904 In Progress
2024-02-06 10:20:23 +00:00
cristiangarcia c897328af6 Make lombok tests CC compatible
Required for KTI-1553
2024-02-06 10:11:15 +00:00
Mads Ager 79eee6de4f [FIR] Do not enhance nullability for annotation interface field types.
Java annotation interface fields are constant declarations that can
have any Java type and are not restricted in the same way that
method return types are for annotation interfaces.

#KT-65482 Fixed
2024-02-06 09:45:34 +00:00
Simon Ogorodnik f5d0a5b92d CODEOWNERS: Update Compiler Core team ownership
- Move Simon.Ogorodnik out of the Compiler Core team
2024-02-06 09:25:11 +00:00
Nikolay Lunyak 183c263c55 [FIR] Create proper error name references for invoke receivers
In this example, when processing
the `jso` property candidate form
the `dynamic` scope we get
`DslScopeViolation`.
When we later create the
receiver for the invoke call
(since we still call `jso {}` as
a function), we create a non-error
named reference which fails at
`toResolvedReference()`.

The included test should not fail
with exception.

^KT-65255 Fixed
2024-02-06 09:12:46 +00:00
Dmitrii Krasnov be6ab943f4 [Gradle] Fixed Mac and Windows integration tests
These tests were failed because of `dependencyManagement` in testDsl.

^KT-64903


Merge-request: KT-MR-14201
Merged-by: Dmitrii Krasnov <Dmitrii.Krasnov@jetbrains.com>
2024-02-06 09:09:34 +00:00
Pavel Kunyavskiy 1cc138431d [Fir2IR] Get rid of simple symbol table usages
We have two sources of truth in Fir2Ir - declaration storages,
which maps fir to ir symbols and symbolTable which maps
IdSignature to ir symbol.

The long-term goal is to have only one - declaration storages. This
commit goes to this goal by removing all symbolTable usages that are
straightforward to remove, i.e., all except:

1. classes as there is some code, that uses signature inside ClassSymbol
2. functions/properties as sometimes declaration storage fails to match
symbols correctly (i.e. for generated data class members)
3. type parameters, as we need to remove functions first.

As a side effect, it fixes some of the signature clash cases on valid
code, as we no longer rely on signature uniqueness, except cases
mentioned above.

^KT-65274 Fixed
^KT-64990
2024-02-06 08:55:35 +00:00
Sergej Jaskiewicz 06684f207a [klib] Don't rely on Lazy IR for signature clash checking
We only want to report signature clashes for declarations that come
from the module currently being serialized. In GlobalDeclarationTable,
declarations from other modules could also be stored.
Checking whether a declaration is a Lazy IR declaration to
determine if it comes from an external module works okay, but it is
a hack which relies on an implementation detail of IR, which may or
may not work in the future.

Use a more robust logic here, since IrFileSerializer is always aware
which declarations are declared in the current module and which are
just referenced from it.
2024-02-05 17:30:08 +00:00
Bogdan Mukvich 55a87f301b Ignore native bundle artifacts in ArtifactsTest
* kotlin-native not enabled by default in project
2024-02-05 17:16:35 +00:00
Bogdan Mukvich 86fa4507d0 Publish native SBOMs with binaries to maven repository
^KTI-1569
2024-02-05 17:16:35 +00:00
Dmitrii Krasnov 06a3e9135c [Gradle Native] Made a k/n bundle as input for commonizeNativeDist task
Also, extracted moving konan bundle to konanHome into BuildService and wrapped moving k/n bundle to konan home with file lock.
And added an integration test for checking ^KT-65222 and ^KT-65347.

^KT-65450
^KT-65347 Fixed


Merge-request: KT-MR-14099
Merged-by: Dmitrii Krasnov <Dmitrii.Krasnov@jetbrains.com>
2024-02-05 16:37:49 +00:00
Gleb Lukianets f262247b2b [Swift Export] KT-65008: support simple top-level properties
Merge-request: KT-MR-14131
Merged-by: Gleb Lukianets <Gleb.Lukianets@jetbrains.com>
2024-02-05 16:29:37 +00:00
Yahor Berdnikau ad5ee28d58 [Gradle] Use proper approach to local repository
^KT-65528 In Progress
2024-02-05 16:14:41 +00:00
Yahor Berdnikau eac48d065b [Gradle] Migrate HierarchicalStructureOptInMigrationArtifactContentMppIT to new test DSL
^KT-65528 In Progress
2024-02-05 16:14:41 +00:00
Yahor Berdnikau 81fded3c8b [Gradle] Migrate KotlinToolingMetadataIT to new test DSL
^KT-65528 In Progress
2024-02-05 16:14:40 +00:00
Vladimir Sukharev 72d92cd9b2 [K/N][Tests] Don't make per-file-cache from given dependencies
^KT-61259
2024-02-05 16:06:34 +00:00
Vladimir Sukharev e20b91ab30 [K/N][Tests] Fix FreeArgs
^KT-61259
2024-02-05 16:06:34 +00:00
Vladimir Sukharev e4d36d3840 [K/N][Tests] Fix wrong root cache path
^KT-61259
2024-02-05 16:06:34 +00:00
Vladimir Sukharev 95b1fba37f [K/N][Tests] Clean up framework testing code
^KT-61259
2024-02-05 16:06:34 +00:00
Vladimir Sukharev c72443e4be [K/N][Tests] Move "-Xcache-directory" flag generation to BasicCompilation
^KT-61259
2024-02-05 16:06:34 +00:00
Vladimir Sukharev 8ce8441409 [K/N][Tests] Split away cache-dependent part of "multiple" test
^KT-61259
2024-02-05 16:06:34 +00:00
Vladimir Sukharev fc6fc8d122 [K/N][Tests] Check lazy headers in K1's ObjCExportTest
^KT-61259
2024-02-05 16:06:34 +00:00
Vladimir Sukharev 025771460c [K/N][Tests] Migrate framework and objcexport tests
^KT-61259
2024-02-05 16:06:34 +00:00
Vladimir Sukharev f00a145dd7 [K/N] Don't cut cinterop exceptions from TC logs. 2024-02-05 15:47:01 +00:00
Alexander Udalov 53c5230520 IR: copy EnhancedNullability in CopyIrTreeWithSymbolsForFakeOverrides
Otherwise it leads to the following problem in the newly added test.

Suppose that we have a fake override `remove(Int)` inherited from
LinkedList _without_ EnhancedNullability on its parameter type. By
normal Kotlin rules, this method should override the method from
KotlinInterface. However, on JVM we have another overridability check in
IrJavaIncompatibilityRulesOverridabilityCondition which ensures that
"JVM primitivity" of parameter types is the same for the base and the
overridden method.

So the fake override `remove(Int)` from LinkedList is determined to be
override-incompatible with `remove(Int)` from KotlinInterface. But when
we try to create symbols for all fake overrides in the class, we get a
clash because there are two fake overrides with exactly the same
IdSignature, neither of which overrides the other.

If we keep the EnhancedNullability annotation on the parameter, it
starts working because the logic of computing signature in
JvmIrMangler.JvmIrManglerComputer.mangleTypePlatformSpecific adds an
"{EnhancedNullability}" mark to the IdSignature of a fake override from
LinkedList.

 #KT-65499 Fixed
2024-02-05 13:28:19 +00:00
Evgeniy.Zhelenskiy f05c972efb [K2, CLI] Support endOffset in Kotlin CLI
Duplicated messages in testdata appeared because default renderer
renders diagnostic spans ambiguously. It shows only start position.
In fact, there are 3 failures, 2 of them distinguish only by the
diagnostic end offset. See youtrack for more information.

The issue about inconvenient rendering is KT-64989.

#KT-64608
2024-02-05 13:26:13 +00:00
Yahor Berdnikau 6404cede07 [Gradle] Fix warnings in KotlinWebpack
^KT-56904 In Progress
2024-02-05 10:27:18 +00:00
Yahor Berdnikau ac8edc168d [Gradle] Fix warnings in KotlinJsTest
^KT-56904 In Progress
2024-02-05 10:27:18 +00:00
Yahor Berdnikau bbf0402a0f [Gradle] Remove unused import in NodeJsRootExtension
^KT-56904 In Progress
2024-02-05 10:27:18 +00:00
Yahor Berdnikau 07ae48d1a3 [Gradle] Fix warnings in NodeJsExec
^KT-56904 In Progress
2024-02-05 10:27:18 +00:00
Dmitrii Gridin 9589043a05 [LL FIR] adapt LLFirTargetResolver for new FirDesignation
We should maintain `containingDeclarations` to be consistent with
the new ` FirDesignation `

^KT-65345 Fixed
2024-02-05 09:32:45 +00:00
Dmitrii Gridin 9b60e5ca06 [LL FIR] adapt RawFirNonLocalDeclarationBuilder for new FirDesignation
Effectively nothing changed right now, but now it is possible to process
`FirScript` as `containingDeclaration` inside `moveNext`

^KT-65345
2024-02-05 09:32:45 +00:00
Dmitrii Gridin eb8e3f64f0 [LL FIR] reuse FirDesignation for LLFirResolveTarget
This is an intermediate change before unification

^KT-65345
2024-02-05 09:32:45 +00:00
Dmitrii Gridin 39131a7f30 [LL FIR] rework FirDesignation collector
The main change – now we collect not only `FirRegularClass`, but also
`FirScript`.
This allows us to have a proper context collector for
diagnostics for scripts.
Also, this change fixes dangling files for scripts in `IGNORE_SELF`
as now we have the correct patcher for this case, so we won't resolve
the copied script

^KT-65345
^KT-62841 Fixed
2024-02-05 09:32:45 +00:00
Dmitrii Gridin f06b17cbb2 [LL FIR] unify FirDesignation
Now we have only one FirDesignation instead of `FirDesignation`,
`FirDesignationWithFile` and `FirDesignationWithScript`

This allows us to unify situations with `FirFile` and `FirScript`
in the path and unbind from `FirRegularClass`.
This commit only refactors code, the semantic is still the same yet

^KT-65345
2024-02-05 09:32:45 +00:00
anzhela.sukhanova 14b6f6d050 [Test] KT-59012: tests for inferring types based on self upper bound
Add tests on JK inheritance cases, extension functions for Enum and some basic recursive type cases
2024-02-05 09:05:13 +00:00
Mikhail Glukhikh e1df52bc02 K2: handle non lookup-tag based types in private-to-this analysis
#KT-62134 Fixed
2024-02-02 17:12:02 +00:00
Mikhail Glukhikh 3c3396a87e K2: reproduce some situations related to KT-62134 2024-02-02 17:12:02 +00:00
Mikhail Glukhikh 36dd9b6818 K2: add BB tests for KT-59380 working properly (compiler error in K1)
#KT-59380 As Designed
2024-02-02 17:07:40 +00:00
Vladimir Tagakov dab9ac3b1c jvm-abi-gen: Allow disabling class members sorting in abi.jar
#KT-64589
2024-02-02 16:29:19 +00:00
Pavel Kunyavskiy c0152ccf0f [IRFakeOverrides] Convert lazy callables overriddens during f/o building
Unfortunately, it's not enough to know direct overriddens
to correctly build fake overrides. This mean, that we need to know
whole overridden tree during the process of building.

It happens automatically for normal classes, but not for lazy classes,
as their overriddens are built separatly.

This commit enforces correct overrddens for lazy classes in hierarhies
at the point, where they should be normally computed.

^KT-65236
2024-02-02 16:28:25 +00:00
Pavel Kunyavskiy caa6918031 [FIR2IR] Fix handling private setters in anonymous classes
^KT-65290 Fixed
2024-02-02 16:07:35 +00:00
Denis.Zharkov 66d8f471d9 K2: Fix internal error in FIR2IR caused by PCLA + String interpolation
There's an implicit contract in PCLA that the statement-level call
should be postponed iff it has something to be postponed inside.

And that contract didn't work well for string interpolation containing
some postponed calls.

Thus, we haven't run a completion results writing for them properly,
thus leaving type parameters (K from synthetic call) for expression
types instead of an inferred substituted type.

In this commit, the contract was reversed to explicitly enumerate
the cases when it's safe to resolve the candidate outside PCLA session.

See the comments at `mightBeAnalyzedAndCompletedIndependently`.

^KT-65341 Fixed
2024-02-02 15:40:47 +00:00
Denis.Zharkov 3ba8256b8d Add IR text tests fixating the state of KT-65341 2024-02-02 15:40:46 +00:00
Denis.Zharkov 64902e615e K2: Minor. Unify call postponement rules in PCLA session 2024-02-02 15:40:46 +00:00
Yan Zhulanow 57dcd645b1 [kotlin] Reuse applicability checker between extension candidates
Before, auto-completion was based on on-air resolve, and
'FirTowerDataContext' was computed once, during creation of the
dependent analysis session (with using 'FirTowerDataContextCollector').
This allowed to return the context almost instantly, no matter how many
completion candidates there were.

Dangling file resolution doesn't use 'FirTowerDataContextCollector', as
now there is more precise 'ContextCollector'. However,
'ContextCollector' doesn't cache results by itself, and, if asked, it
will compute the same context over and over again. This exact happened
with extension applicability checker.

The optimized implementation maintains a checker object which caches the
computed context. The old end-point is left to give the IDE plugin time
to adapt to the change.

^KTIJ-28445
2024-02-02 15:38:10 +00:00
Artem Kobzar 4f521aa05c [K1] Fix string offsets to include quotes in the same way it's done in FIR 2024-02-02 14:43:46 +00:00
Anastasia.Nekrasova 434470a4f5 [K/N][K2]: K2 behavioral difference with inconsistent inheritance of ObjCName
The problem arises when retrieveDirectOverriddenOf returns a
substitution override member. For such members, it is impossible to get
the first base member. For a correct result, it is required to find
originalForSubstitutionOverride for all substitutionOverrides.

#KT-64276 Fixed
2024-02-02 13:54:45 +00:00
Alexander Shabalin 5525a6829a [ObjCExport][tests] Ignore AA test failures both locally and on CI
To run AA tests normally, use kif.loca gradle property.


Merge-request: KT-MR-14129
Merged-by: Alexander Shabalin <alexander.shabalin@ashabalin.me>
2024-02-02 13:43:30 +00:00
Kirill Rakhman 15d2799ed4 Update dependency verification metadata 2024-02-02 13:26:57 +00:00