Commit Graph

105503 Commits

Author SHA1 Message Date
Dmitrii Gridin 27c5a0b60d [LL FIR] add lazy resolve test on conflict of compiler required annotation
^KT-62679
2023-10-19 14:34:35 +00:00
Nikolay Lunyak a0e9cc3206 [FIR] Fix new test data after merging a68a2409 2023-10-19 14:29:24 +00:00
Dmitriy Novozhilov 402e4e3af4 [FIR2IR] Rename some entities in Fir2IrDeclarationStorage
In the previous commit, we started to treat delegated function similarly
  to substitution/intersection overrides, so now it's incorrect to name
  corresponding methods and storages using "fake-override" word

^KT-62671
2023-10-19 13:15:48 +00:00
Dmitriy Novozhilov 940567978d [FIR2IR] Treat delegated functions as fake-overrides
Delegated callables in FIR are session-dependant (as fake-overrides),
  so it's incorrect to use their FIR as a key for declaration storage.
  Pair of original function and owner lookup tag should be used instead

^KT-62671 Fixed
2023-10-19 13:15:48 +00:00
Roman Golyshev 3c68b27280 KT-62071 [AA] Do not throw error from getScopeContextForPosition when implicitScope of receiver value is null
`implicitScope` can be `null`
in case when the implicit receiver resides in a user-defined `kotlin.*`
package, but the user have not yet allowed this with compiler argument
directive.

In this case,
we don't want the IDE to crush and show exceptions - the `kotlin`
package would be highlighted by the compiler diagnostics and other
resolve problems, and that would be enough

^KT-62071 Fixed
2023-10-19 12:59:47 +00:00
Igor Chevdar eb6db02649 Revert "[Native] Use LLVMBuildLoad2 instead of LLVMBuildLoad."
This reverts commit a487ec1889.
2023-10-19 12:57:25 +00:00
Igor Chevdar 254b5b1934 Revert "[Native] Fix tailrec test."
This reverts commit 67c501e0b6.
2023-10-19 12:57:24 +00:00
Igor Chevdar d5001fb7dd Revert "[Native] Move remaining usages for LLVMBuildLoad to LLVMBuildLoad2."
This reverts commit 4e66881549.
2023-10-19 12:57:24 +00:00
Ivan Kylchik 70f195598e [FIR2IR] Don't run interpreter's preprocessors on fir2ir stage
In IR interpreter we have "preprocessors". Preprocessor is a
transformer that changes IR expressions in a way that we can
interpret them at least partially.

We have two places where interpretation is happening:
1. Right after fir2ir where we evaluate only strictly necessary
expression for `const val` and annotations.
2. In lowering for every backend where we are doing some
constant folding.

Earlier, to avoid double work, we didn't launch preprocessors
in backend if we were using K2. But this approach breaks compilation
for MPP projects where one module is compiled with K1 into klib
and the overall project is compiled with K2. On the backend side,
we are mistakenly assuming that preprocessors were launched, but they
were not.

The solution is to run preprocessors only on the backend side. If we
think about it, interpretation on fir2ir doesn't require any
preprocessing because we are working only with expressions that are
correct and must be fully evaluated.

#KT-62126 Fixed
2023-10-19 12:29:32 +00:00
Dmitriy Novozhilov 7ff2fc9dbe Add workaround for KT-62702 2023-10-19 12:13:46 +00:00
Dmitriy Novozhilov 866fbed388 Advance bootstrap to 2.0.0-dev-5387 2023-10-19 12:13:45 +00:00
Pavel Punegov ff89fb8405 [K/N][build] Lazy task configuration in the tests 2023-10-19 12:12:02 +00:00
Pavel Punegov e01cea6669 [K/N][build] Add providers to klib install and cache tasks 2023-10-19 12:12:02 +00:00
Pavel Punegov b1a85d45c6 [K/N][build] Move old Konan plugin to native-build-tools 2023-10-19 12:12:02 +00:00
Sergej Jaskiewicz 04c5ac0eb6 [FIR/IR generator] Factor out adding pure abstract element as parent 2023-10-19 12:00:25 +00:00
Sergej Jaskiewicz 5798021e4b [FIR/IR generator] Refactor element parents
- Move `elementParents` and `otherParents` properties
  to `AbstractElement`
- Use `elementParents` instead of `parentRefs` where needed
2023-10-19 12:00:25 +00:00
Pavel Kunyavskiy 33994d419d [IR] Replace a couple of TODOs with shouldNotBeCalled 2023-10-19 10:16:45 +00:00
Pavel Kunyavskiy da488f513f [IR] Fix file modules after actualization
When files from different IrModules are merged in IrActualizer
their IrModule link was not updated. This led to assuming them
as different modules, and incorrect internal visibility handling.

^KT-62623
2023-10-19 10:16:45 +00:00
Pavel Kunyavskiy ad5831acc6 [IR] Add a method to get ModuleDescriptor from IrPackageFragment
Ideally, instead of this method, there should be a link
to IrModuleFragment. Unfortunately, it would require to big refactoring,
as some of IrPackageFragment implementations doesn't have any
IrModuleFragment inside, and are not located inside any
IrModuleFragment.

So for now, we just implement and use everywhere a single way of
getting the module descriptor, which respects a IrModuleFragment
link if it exists, and fallbacks to descriptor-based method
if it doesn't.

^KT-62623
2023-10-19 10:16:44 +00:00
Vladimir Sukharev 9b9ddb760a [FIR2IR] Coerce last operator in a loop to Unit
One of many fixes for https://youtrack.jetbrains.com/issue/KT-59781/K2-investigate-implicit-cast-generation-in-fir2ir-vs-psi2ir

Merge-request: KT-MR-12629
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-10-19 09:53:46 +00:00
Ilya Goncharov 5df8ac4d1a [Gradle, JS] Ignore stdout for mocha dry run
^KT-61992 fixed
2023-10-19 09:46:01 +00:00
Nikolay Lunyak a68a2409d3 [FIR] Remove the applicability filtering when reporting diagnostics
In case we don't want to introduce any new
abstractions like "user relevance for
applicability", we can just remove the
filtering.

^KT-62541 Fixed
2023-10-19 09:27:45 +00:00
Nikolay Lunyak fedadfb8db [FIR] Show ARGUMENTS_MAPPING_ERROR diagnostics along with INAPPLICABLE
K1 reports `ARGUMENT_TYPE_MISMATCH`
and `TOO_MANY_ARGUMENTS` together, and
one way to do it in K2 is to say that
their kinds of inapplicability difference
is not relevant to the user.

Note that K1 doesn't do such filtering,
so this change "makes K2 closer to K1",
but still different.

^KT-62541 Fixed

fixup! [FIR] Show ARGUMENTS_MAPPING_ERROR diagnostics along with INAPPLICABLE
2023-10-19 09:27:45 +00:00
Nikolay Lunyak 06b3c6ec13 [FIR] Reproduce KT-62541 2023-10-19 09:27:44 +00:00
Igor Chevdar 40e8552a8d [gradle] Added a bunch of Gradle IT on K/N incremental compilation 2023-10-19 07:57:36 +00:00
Mads Ager 4e66881549 [Native] Move remaining usages for LLVMBuildLoad to LLVMBuildLoad2.
Step towards LLVM opaque pointers.
2023-10-19 07:54:30 +00:00
Mads Ager 67c501e0b6 [Native] Fix tailrec test.
tailrec is no longer allowed on open functions but this test is
still using it.
2023-10-19 07:54:30 +00:00
Mads Ager a487ec1889 [Native] Use LLVMBuildLoad2 instead of LLVMBuildLoad.
This is a first step in the move from typed to opaque pointers.
2023-10-19 07:54:30 +00:00
Dmitriy Novozhilov 847442d547 [Test] Add regression test for KT-60876 2023-10-19 06:58:14 +00:00
Ilya Gorbunov aedc704e77 [stdlib] Further merge js-ir specific sources 2023-10-19 03:11:54 +00:00
Ilya Gorbunov 911fa3bbbb [stdlib] Merge js-ir specific sources into common js sources 2023-10-19 03:11:54 +00:00
Ilya Gorbunov f00d4022c4 [stdlib] Use common js sources in js-ir compilation without copying 2023-10-19 03:11:54 +00:00
Ilya Gorbunov 3622ea2e33 [stdlib-gen] Minor refactoring: use enum entries instead of values 2023-10-19 03:11:54 +00:00
Ilya Gorbunov ff2254db69 [stdlib] Remove generator templates for js legacy 2023-10-19 03:11:53 +00:00
Ilya Gorbunov 1d232c69d6 [stdlib] Move location of generated sources for js-IR compilation 2023-10-19 03:11:53 +00:00
Ilya Gorbunov 5f0a930ea3 [stdlib] Delete js-v1 sources 2023-10-19 03:11:53 +00:00
Roman Efremov 601c517887 [FIR] Don't print function's default value parameters
...in `ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT` diagnostic message.

^KT-62585
2023-10-18 20:01:47 +00:00
Roman Efremov 0f0540cda0 [Test] Add test for reporting of function default value parameters
...in `ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT` diagnostic message.

^KT-62585
2023-10-18 20:01:47 +00:00
Roman Efremov 7893624589 [FIR] Remove debug labels in annotation arguments rendering
...in `ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT` diagnostic message.

^KT-62585
2023-10-18 20:01:47 +00:00
Roman Efremov f54a1b5ced [FIR] Refactor: extract resolved qualifier rendering out of FirRenderer
^KT-62585
2023-10-18 20:01:47 +00:00
Roman Efremov 6b1e340364 [FIR] Refactor: extract resolved named reference rendering out of FirRenderer
^KT-62585
2023-10-18 20:01:47 +00:00
Roman Efremov 37a0dd9487 [FIR] Use idRenderer to print referenced class and callable ids
...in `ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT` diagnostic message.
Unlike in previous commit, this can't be fixed right in
`FirSymbolRenderer`, because `ConeIdRendererForDebugging` renders
differently and a lot of lazy resolve tests rely on that.

^KT-62585
2023-10-18 20:01:47 +00:00
Roman Efremov 7f7801a7bc [FIR] Use idRenderer to render ClassId in qualifiers
It shouldn't break existing usages, because
1) default `ConeIdRendererForDebugging` renders ClassId in
same way as before the change;
2) I didn't find any usages, which use non-default idRenderer,
but rely on full ClassId be rendered for qualifiers.

^KT-62585
2023-10-18 20:01:47 +00:00
Roman Efremov cb6ec46de1 [FIR] Fix type annotation arguments rendering inside symbols
...in ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT diagnostic.

^KT-62585
2023-10-18 20:01:47 +00:00
Roman Efremov b3467353b2 [Test] Add test for ugly K2 reporting of annotation arguments
...in `ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT` diagnostic message.

^KT-62585
2023-10-18 20:01:47 +00:00
Ilya Kirillov 67ac985be7 [Analysis API Standalone] fix testdata for standalone mode tests
The commit (7db2fc522e) with changing behavior of builtin symbol provider
is in a conflict with a commit (72de86a8ba) where new tests were added.

The difference should be fixed as a part of KT-62651
2023-10-18 19:50:44 +00:00
vladislav.grechko 897eab6b50 Do not add nullability annotations to the methods of local classes
Nullability annotations are useless for the methods of local classes
due to their restricted scope.

^KT-62513: Fixed
2023-10-18 19:48:38 +00:00
Sergej Jaskiewicz 417aa236fb [FIR/IR generator] Factor out printing the preamble in generated files 2023-10-18 18:42:40 +00:00
strangepleasures a33da2a1c6 Temporarily disable Kapt4IT and KaptIncrementalIT and the descendants.
Those tests are currently producing OOMs on Windows
2023-10-18 17:40:29 +00:00
Hung Nguyen 5ceebec331 Cache Gradle properties with a BuildService to improve performance
Currently, the performance overhead when loading a Gradle property
consists of:
  1. Creating a Provider
  2. Resolving the Provider

Both steps are performed even when the same property was loaded before.
That means this overhead will multiply when there are a large number of
property read requests (e.g., in KT-62496, the tested project 400,000
read requests for only 17 properties).

To improve performance, we will now cache both steps with a
BuildService.

With this commit, configuration time for the tested project returns to
the same level before commit d6becee where the performance regression
happened (that commit can't be reverted because it introduced
`Provider`s which are required for proper Gradle usage).

Test: Manually verified on the large project in KT-62496

^KT-62496 Fixed
2023-10-18 17:27:32 +00:00