Commit Graph

104318 Commits

Author SHA1 Message Date
Ivan Kylchik 3efe07d0cb [Native] Drop getArgumentsWithIr from IrUtils2
We can reuse the same function from common `IrUtils`
2023-09-05 11:21:49 +00:00
Ivan Kylchik abc061e17f [IR] Restore and fix ifConstVal test
It was accidentally dropped after KT-55196 fix.
2023-09-05 11:06:43 +00:00
Alexander Udalov 34f52aaeda Reflection: fix callBy for functions with 32 * N parameters
Optimization in 2439c22ff6 introduced an array `absentArguments` with
default values of all parameter types, which is copied in `callBy`
instead of being recomputed each time. Unfortunately, its size was
computed incorrectly: `maskSize` should only take into account
value parameters (see the `parameter.kind == KParameter.Kind.VALUE`
check in `callBy`).

This led to an issue where if the function had 32 * N value parameters
and 1 receiver parameter, `maskSize` was greater by 1 than expected,
which caused an exception due to mismatching argument array sizes.

 #KT-61304 Fixed
2023-09-05 11:05:29 +00:00
Jinseong Jeon 421cd9929b SLC: use optimal type mapping mode for receiver parameter
...and other kinds of parameters as well
2023-09-05 10:33:54 +00:00
Jinseong Jeon 4cdc22c9cc AA FIR: use fully expanded type when computing optimal type mapping mode
^KT-61460 Fixed
2023-09-05 10:33:53 +00:00
Dmitriy Novozhilov 1868b29cc9 [FIR] Don't map java functions which override kotlin builtin function with erased parameter type if it's not needed
There is a case when we shouldn't hide a function even if it overrides
  builtin member with value parameter erasure: if substituted kotlin
  overridden has the same parameters as current java override. Such
  situation may happen only in case when `Any`/`Object` is used as
  parameterization of supertype:

// java
class MySuperMap extends java.util.Map<Object, Object> {
    @Override
    public boolean containsKey(Object key) {...}

    @Override
    public boolean containsValue(Object key) {...}
}

In this case, the signature of override, made based on the correct
  kotlin signature, will be the same (because of { K -> Any, V -> Any }
  substitution for both functions). And since the list of all such
  functions is well-known, the only case when this may happen is when
  value parameter types of kotlin overridden are `Any`

This change doesn't affect any tests in the moment, because it's part of
  bigger refactoring of proper storing IR declarations during FIR2IR
  conversion (KT-61637)

Without this change, there is one test break in branch for KT-61637:
`FirPsiBlackBoxCodegenTestGenerated.SpecialBuiltins.testMapGetOrDefault`
2023-09-05 10:18:24 +00:00
Pavel Kirpichenkov cf98fb5612 [Tests] Add .knm stub consistency test
The test compares stub trees built from .knm files directly and from
the decompiled text. Test data for .class decompiler is reused,
JVM-specific cases are ignored

KT-61354
2023-09-05 09:36:25 +00:00
Ivan Kylchik 2537ff94b7 [Native] Move StringTable and its builder to separate file 2023-09-05 08:35:48 +00:00
Ivan Kylchik 86b4d36b54 [Native] Make StringTable and its builder internal 2023-09-05 08:35:47 +00:00
Ivan Kylchik 70697af6b9 [Native] Move proto utils from KonanIrLinker into separate utils file 2023-09-05 08:35:47 +00:00
Ivan Kylchik 66b9c2f260 [Native] Move FORWARD_DECLARATION_ORIGIN into KonanForwardDeclarationModuleDeserializer 2023-09-05 08:35:47 +00:00
Ivan Kylchik cc906ad6d5 [Native] Move INVALID_INDEX into KonanPartialModuleDeserializer 2023-09-05 08:35:47 +00:00
Ivan Kylchik 79fa0d2648 [Native] Move KonanForwardDeclarationModuleDeserializer to a separate file 2023-09-05 08:35:47 +00:00
Ivan Kylchik 7d1c929fb5 [Native] Make KonanForwardDeclarationModuleDeserializer nested instead of inner 2023-09-05 08:35:47 +00:00
Ivan Kylchik 701dc72f70 [Native] Move KonanInteropModuleDeserializer to a separate file 2023-09-05 08:35:47 +00:00
Ivan Kylchik 6d0b936639 [Native] Make KonanInteropModuleDeserializer nested instead of inner 2023-09-05 08:35:47 +00:00
Ivan Kylchik 5661316d7a [Native] Use FORWARD_DECLARATIONS_MODULE_NAME instead of hardcoded value 2023-09-05 08:35:47 +00:00
Ivan Kylchik 3fba699c49 [Native] Move KonanPartialModuleDeserializer to a separate file 2023-09-05 08:35:47 +00:00
Ivan Kylchik 13a39c82ae [Native] Make KonanPartialModuleDeserializer nested instead of inner 2023-09-05 08:35:47 +00:00
Ivan Kylchik bf7f2afe5d [Native] Rename KonanIrlinker to KonanIrLinker 2023-09-05 08:35:47 +00:00
Ivan Kylchik 66650d2dcc [Native] Drop IrSerializationUtil file
Most methods from there are unused
2023-09-05 08:35:47 +00:00
Ivan Kylchik 852d829d83 [Native] Drop KonanFileMetadataSource class
Replaced it with more common `DescriptorMetadataSource.File`
2023-09-05 08:35:47 +00:00
Ivan Kylchik 36373ddfa7 [Native] Drop unused CodegenStaticFieldMetadata class 2023-09-05 08:35:46 +00:00
Ivan Kylchik d13d249640 [Native] Drop excess cast from isExternalObjCClass method 2023-09-05 08:35:46 +00:00
Ivan Kylchik a35defc682 [Native] Replace KonanIrModuleFragmentImpl with IrModuleFragmentImpl 2023-09-05 08:35:46 +00:00
Ivan Kylchik dfa60ee092 [IR] Drop TODO from IrModuleFragmentImpl
This TODO doesn't have any description, and it is already
hard to understand what the author meant.
2023-09-05 08:35:46 +00:00
Kirill Rakhman f08d4b8bb1 [FIR] Improve condition for sorting equivalent calls by source first
This accommodates for declarations generated by plugins that don't have
a source.
2023-09-05 07:08:28 +00:00
Alexander Shabalin 9ab6a5ff56 [K/N] Migrate all stdlib_external tests to new testing infra ^KT-61259
- Move backend.native/tests/stdlib_external to runtime/test This mirrors
  tests location (in relation to sources) on other backends.
- Remove all backend.native/tests tasks using stdlib_external.
  Additionally remove now unused KonanGTest.
- Include complete native-wasm/test and runtime/test in
  native/native.test
- In runtime/test/numbers/MathTest.kt leave only native-specific part.
2023-09-04 18:51:10 +00:00
Roman Golyshev c9e4b71010 KT-61689 [LL API] Handle scripts in ContextCollector
Add `FirDesignationWithScript`, because regular designation
does not account for scripts at all - that makes it
cumbersome to add the script's top level and implicit
receiver scopes when collecting contexts for the
non-top-level declarations (class members, for example)

^KT-61689 Fixed
2023-09-04 16:57:37 +00:00
Roman Golyshev 83049dc25c KT-61689 [LL API] Improve readability of withInterceptor function 2023-09-04 18:02:20 +02:00
Roman Golyshev 90ed90c9a7 KT-61689 [LL API] Support scripts in ContextCollector tests 2023-09-04 18:02:20 +02:00
Yan Zhulanow 5559a0754d [LL API] Handle smart casts correctly on 'FirCodeFragment' analysis 2023-09-04 15:47:56 +00:00
Yan Zhulanow 0fbf648971 [LL API] Pull smart casts from the CFG in 'ContextCollector'
^KT-61599 Fixed
2023-09-04 15:47:56 +00:00
Yan Zhulanow 1247ef750f [LL API] Refactoring, compute PsiElement inside 'dumpContext()' 2023-09-04 15:47:56 +00:00
Yahor Berdnikau f866883871 [Gradle] Also configure JsIrLink tasks with target compiler options
This should synchronize options between JS compile and link tasks
configured with target compiler options DSL.

^KT-61253 Fixed
2023-09-04 14:29:00 +00:00
Yahor Berdnikau 38e7bf6afa [Gradle] Add compilerOptions() methods to KotlinCompilation implementations
This should help to avoid user mistakes in configuring options when they
 are trying to use KotlinCompilation.

^KT-61636 Fixed
2023-09-04 14:29:00 +00:00
Yahor Berdnikau 55a0c86508 [Gradle] Fix JS module name and freeCompilerArgs config is not propagated to the task
Task was not using configured module name correctly.

In case of using "browser()" DSL freeCompilerArgs could be overwritten.

^KT-61194 Fixed
2023-09-04 14:28:59 +00:00
Yahor Berdnikau 4c60dd3f38 [Gradle] Fix JVM and Android targets moduleName change is not propagated in the multiplatform project
Missed existing logic where 'moduleName' was specifically configured
from 'moduleName' task input for MPP projects.

^KT-61303 Fixed
2023-09-04 14:28:59 +00:00
Dmitrii Gridin c095b60fe8 [LL FIR] drop outdated LazyBodyIsNotTouchedTest
We have our own transformers and tests against compiler test data,
so separate test with compiler transformers is redundant
2023-09-04 12:37:12 +00:00
Nikita Bobko 01fc708a0f Mark expect/actual classifiers as experimental
^KT-61573 Fixed
Review: https://jetbrains.team/p/kt/reviews/11969/timeline

Tests:
- MultiPlatformIntegrationTestGenerated
- CliTestGenerated
- MultiPlatformIntegrationTestGenerated
- DiagnosticTestGenerated.Multiplatform
- FirLightTreeOldFrontendDiagnosticsTestGenerated

Also add -Xexpect-actual-classes flag to all necessary ./libraries/* modules
Otherwise compilation of those modules failes because of `-Werror`
2023-09-04 12:21:37 +00:00
Alexander Shabalin 6a19c4ce96 [K/N] Remove legacy executors. 2023-09-04 11:38:47 +00:00
Ilya Gorbunov 78ef58f59d [Generator] Do not use explicit final modifier in Native primitive classes
'final' is the default modality, safe to omit
2023-09-04 11:32:39 +00:00
Ilya Gorbunov 8ae21c0e1b [Generator] Do not omit public visibility of methods in wasm 2023-09-04 11:32:39 +00:00
Ilya Gorbunov 918b935e22 [Generator] Write the body of Boolean.hashCode in one place 2023-09-04 11:32:39 +00:00
Ilya Gorbunov 1c149925b7 [Generator] Always put expression body on a new line 2023-09-04 11:32:39 +00:00
Ilya Gorbunov 68a9b9c312 [Generator] Reference generator class in generated code files 2023-09-04 11:32:39 +00:00
Ilya Gorbunov 74ac48851a [Generator] Canonical order of modifiers 2023-09-04 11:32:39 +00:00
Ilya Gorbunov 60bbd08569 [Generator] Rename additionalDoc, put its content before annotations 2023-09-04 11:32:39 +00:00
Nikolay Lunyak cd392ebe69 [FIR] Don't miss RETURN_NOT_ALLOWED
^KT-59914 Fixed
2023-09-04 10:19:11 +00:00
Vyacheslav Gerasimov 009cda0c60 Build: Make robolectric tests run offline without downloading artifacts
#KTI-1367
2023-09-04 08:57:19 +00:00