Commit Graph

818 Commits

Author SHA1 Message Date
Victor Petukhov fb76d819f0 [FE] Erase type parameters of super types during intersection type emptiness check as well 2022-04-27 19:50:27 +00:00
Victor Petukhov 0f1d212fc5 [FE] Fix tests 2022-04-27 19:50:27 +00:00
sebastian.sellmair 204bc4ca95 [Commonizer] Provide union of forwardDeclarations as common dependencies
^KT-52050 Verification Pending

The issue described in KT-52050 happened, because forwardDeclarations
were not carried into next commonization steps. For commonization
it is fair to choose the union of all modules forwardDeclarations
as common dependency (instead of a union), since we can assume that
all those forward declarations will be provided.
2022-04-22 08:47:39 +00:00
Dmitriy Dolovov c1a3bf1343 [Native][tests] Update testing information in HACKING.md 2022-04-19 16:02:46 +03:00
Dmitriy Dolovov 59a136574a [Native][tests] New test infra: fail immediately if static cache for libs from the distribution is required but there is no such cache 2022-04-15 15:11:41 +03:00
Dmitriy Dolovov 3b3dab3d43 [Native][tests] Forbid using thread state checker with cache 2022-04-15 15:11:41 +03:00
Igor Chevdar 231fe42c0a [klibs] Fixed a bug in the signature-to-descriptor searcher
#KT-51927 Fixed
2022-04-14 07:33:56 +00:00
Yahor Berdnikau 78cc2365b0 Fix gradle api dependency version in variants
Common SourceSet was forcing gradle api version to be the same
in all plugin variants via 'extendsFrom(..)'.

^KT-49227 In Progress
2022-04-12 14:48:48 +00:00
Dmitriy Dolovov 24552a625c [Native][tests] Reorganize OUTPUT_DATA_FILE directive
Use it as one of [TestRunCheck]s.
2022-04-09 19:06:26 +00:00
Dmitriy Dolovov 996ff5085d [Native][tests] Introduce EXIT_CODE directive
It allows to specify the expected exit code for STANDALONE_NO_TR tests.
2022-04-09 19:06:25 +00:00
Dmitriy Dolovov 261e177b39 [Native][tests] Introduce EXPECTED_TIMEOUT_FAILURE directive
It allows to correctly handle tests that were failed by timeout where such failure is the expected behavior.
2022-04-09 19:06:24 +00:00
Dmitriy Dolovov 7cf3ca29af [Native][tests] Fix: Avoid including similar but mutually exclusive shared modules into the same compilation 2022-04-09 19:06:24 +00:00
Ilmir Usmanov 1e3f84402d Safely check for suspend function parent
The issue here is that the function can be in unlowered file, and
thus its parent package fragment and not class.

 #KT-49317 Fixed
2022-04-08 23:31:49 +02:00
Pavel Punegov 3138b29fb2 [build] Requre common capability for gradle plugin test dependency 2022-04-08 18:06:41 +03:00
Pavel Punegov cfe76343d5 [Commonizer][test] Get K/N distribution in the test instead of the build
Get distribution and home path in the test to simplify gradle build.
Using NativeCompilerDownloader in the build led to the undesired results
where test get old K/N compiler from the bootstrap, also blocking K/N
version class development.
2022-04-08 10:38:12 +00:00
Ilmir Usmanov 1488790cd3 Replace recursion with a loop
#KT-51530 Fixed
2022-04-07 01:08:22 +00:00
Alexander Udalov df86290083 Add another test for KT-49715 and fix JS IR behavior
#KT-49715
 #KT-51798 Fixed
2022-04-05 01:06:57 +02:00
Xin Wang 24105139ea Handle methods descriptor clash in data class
1. Extension functions declared in data classes are generated earlier by `generateMembersDeclaredInClassBody`
2. Extension functions fake override from parent class are generated earlier by `generateFakeOverrideMemberDeclarations`

So it is safe to filter out extension functions inside `generateAdditionalMembersForDataClass`

 #KT-49715
 #KT-51798
2022-04-05 01:06:57 +02:00
Ilmir Usmanov 7579be6c68 Generate CHECKCAST after ACONST_NULL in coroutines
If we do not do this, the state-machine builder will not know the type
of the ACONST_NULL, defaulting to Object, leading to VerifyError.
Alternatively, we could use LVT to deduce the type, but getting types
from LVT is something I got rid of long time ago, and I have no desire
to return it back.

Generating CHECKCAST hints the state-machine builder the type of the
variable avoiding the issue of VerifyError. However, this CHECKCAST
replaces StrictBasicValue.NULL_VALUE with BasicValue in
OptimizationBasicInterpreter. To preserve optimization on not-spilling
known nulls, introduce BasicValues, which represent typed nulls and
create BasicInterpreter, which is aware of them. This way we have the
best of two worlds - we do not spill known nulls, and we know the type
of ACONST_NULL.

 #KT-51718 Fixed
2022-03-30 14:27:29 +00:00
Dmitriy Dolovov 0bc6885b2c [Native][tests] W/A: Generate test suites for included KLIB with tests
Relates to KT-51375
2022-03-29 14:55:57 +03:00
Svyatoslav Scherbina cf581738c3 Native: improve ClassCastException message for local classes
Previously it was like "null cannot be cast to MyObject" or
"MyObject cannot be cast to null", because `KClass.qualifiedName` is
`null` for local classes (including anonymous ones).

Use `KClass.toString()` instead, for both object actual dynamic type
and cast target type. This string representation is generally more
meaningful for such cases, and contains useful details for local
classes.
2022-03-28 08:21:55 +00:00
Pavel Kirpichenkov 621f14c5bb [MPP] Improve creation of @UnsafeNumber w.r.t. non-aliased types and PIC
^KT-51643
2022-03-25 16:22:25 +00:00
sebastian.sellmair 25c5d99a0c [Commonizer] Separate nullability from type substitution
^KT-51686 Verification Pending
2022-03-25 09:06:12 +00:00
sebastian.sellmair a08fdcf371 [Commonizer] Substitute type arguments when argument type is ClassOrTypeAlias type
^KT-51686 Verification Pending
2022-03-25 09:06:11 +00:00
sebastian.sellmair 4e16e506bb [Commonizer] Test: Be more lenient on missing abbreviated type in reference
After commonization a type might additionally reference a abbreviated
type which is not present in the reference module's metadata.

This was even considered 'OK' before this commit, however only
under a special condition which might be too strict.

Right now, this newly introduced test will only enter the
newly allowed branch. This shall be re-reviewed later.

KT-51686
2022-03-25 09:06:11 +00:00
sebastian.sellmair 00d1d777d5 [Commonizer] Implement tests covering KT-51686 2022-03-25 09:06:11 +00:00
Victor Petukhov 3aabc8d666 [FE 1.0] Substitute anonymous object's supertypes while using that in public declarations
^KT-46136 Fixed
2022-03-23 21:13:32 +00:00
sebastian.sellmair 1a5fc84080 [KPM] Implement initial kpm/idea dependency resolution
^KT-51386 Verification Pending
2022-03-17 15:39:46 +00:00
Vyacheslav Gerasimov 5e09c3176f Build: Set kotlin.build.cache.push to false by default
#KTI-793
2022-03-13 20:29:12 +00:00
wrongwrong c4735f9f29 Add tests for KFunction involving value classes
See KT-31141.
2022-03-10 23:28:40 +01:00
Pavel Kirpichenkov 9162faaf39 [MPP] Fix incorrect reuse of type argument commonizer
If the same NullableSingleInvocationCommonizer is reused for any reason,
it will store next inputs alongside previous, which is totally not
expected

^KT-51528 Fixed
2022-03-10 17:54:19 +03:00
Alexander Udalov 1e26888dd9 Psi2ir: fix parameter indices when generating extension invoke call
Incorrect `valueParameter` was passed to `generateValueArgument`, which
resulted in incorrect type being considered for generating suspend
conversion.

 #KT-50949 Fixed
2022-03-09 15:19:38 +01:00
sebastian.sellmair 14046b81ff Replace transitiveClosure (commonizer-api) with closure (tooling-core) 2022-03-09 13:17:06 +00:00
sebastian.sellmair 530a3bb6ea kotlin-tooling-core: Implement closure util 2022-03-09 13:17:05 +00:00
Alexander Udalov 328853dffe Add tests for obsolete issues
(Test for KT-37331 is added to multiplatform/defaultArguments/suspend.kt.)

 #KT-30080
 #KT-33641
 #KT-36237
 #KT-36952
 #KT-37331
 #KT-38920
 #KT-39256
 #KT-42415
 #KT-44636
 #KT-45704
 #KT-47084
 #KT-47894
2022-03-08 14:19:37 +01:00
Dmitry Petrov fdb01d96f0 JVM_IR JavaSamConversionEqualsHashCode 2022-03-03 09:01:42 +00:00
Pavel Kirpichenkov 1e925b5937 [MPP] Allow commonization of platform types in leaf targets
Costs little right now and is more robust for potential future uses of
platform types in native libraries or cinterops.

KT-41509
2022-02-28 10:59:44 +03:00
Pavel Kirpichenkov 867390b889 [MPP] Move integer names used by commonizer to its module
KT-41509
2022-02-28 10:59:42 +03:00
Pavel Kirpichenkov f257297505 [MPP] Commonize to platform integers considering target's bit width
Commonized type should match the platform's `platform.posix.ssize_t`
type alias' width. The implementation hard-codes platform widths for
all the targets, this can be potentially changed to search for ssize_t
in dependencies and get width from its type.

Use real targets in platform int commonization tests.

KT-41509
2022-02-28 10:59:38 +03:00
Pavel Kirpichenkov 8f4d04dad2 [MPP] Add preliminary version of platform integer commonizer
Doesn't take target's size_t alias into account just yet

KT-41509
2022-02-28 10:59:36 +03:00
Pavel Kirpichenkov b8ee473107 [Commonizer] Improve error messages for tests 2022-02-28 10:59:34 +03:00
Alexander Udalov 157db778fd Rework support of Iterator.iterator optimization in ForLoopsLowering
- Fix the predicate used for finding the member function `next`: check
  that there's no extension receiver parameter, don't filter out
  abstract functions.
- Do not copy iterator expression, instead change the type in all
  references to the iterator variable.
- Fix some style issues.

 #KT-47171 Fixed
2022-02-28 01:39:31 +01:00
Xin Wang 1b776bd5b6 JVM_IR: Specialize iterator if possible
fixes KT-47171
2022-02-28 01:39:31 +01:00
Alexander Udalov b443848ea0 Fix type table serialization in DescriptorSerializer
Always serialize type table (and version requirement table) after
everything else, to prevent bugs like KT-51446 where inline class
underlying type was added to the type table after it has already been
serialized.

 #KT-51446 Fixed
2022-02-24 16:34:25 +01:00
Dmitry Petrov 872b81ac8a JVM prune exception edges in DFA in some cases 2022-02-24 10:06:47 +00:00
Sergey Bogolepov 2ecde3e831 [K/N] Enable AndroidProgramType.Standalone by default
^KT-49144 fixed.
2022-02-23 17:25:47 +00:00
Ilmir Usmanov 8811f62300 Fix mapping of nullable generic underlying types of inline classes
#KT-32162 Fixed
2022-02-23 01:23:07 +03:00
Ilmir Usmanov c072448d22 Lower fun interface children's body during inline class lowering
#KT-51121 Fixed
2022-02-21 19:50:12 +03:00
Dmitriy Novozhilov 3d48f9926f [Build] Update version of kotlin-build-gradle-plugin to 0.0.35 2022-02-18 17:44:44 +03:00
Pavel Kirpichenkov 6674c3f482 [MPP] Apply @UnsafeNumber to functions and properties
KT-51224
KT-51215
2022-02-17 13:17:13 +03:00