Commit Graph

62519 Commits

Author SHA1 Message Date
pyos 159d292ea7 JVM_IR: make continuation detection more consistent
* unify various checks for whether a suspend function needs a
    continuation;

  * mark the continuation parameter with an origin (this also allows
    correctly computing the offset of the local in codegen -- see the
    new test);

  * when wrapping `suspend fun main`, use a suspend reference instead of
    a synthetic non-suspend lambda (required to correctly implement the
    previous point, as previously the continuation parameter was passed
    to main() itself correctly only because of very lenient checks in
    AddContinuationLowering).
2020-03-03 15:12:13 +01:00
Vyacheslav Gerasimov c57f466494 Build: Use same com.eclipsesource.j2v8 artifact for compilation
We can't reuse caches from different platform when we compile against
different jar on each platform. Since they have same api we may use
platform specific jars only for runtime.
2020-03-03 16:47:55 +03:00
Vyacheslav Gerasimov a4030d3abf Build: Make JavaExec relative path system independent 2020-03-03 16:47:55 +03:00
Vyacheslav Gerasimov 08ac7da7a6 Build: Fix input declaration for :kotlin-stdlib-js-ir:fullRuntimeSources
Input order was random because of unordered set
2020-03-03 16:47:55 +03:00
Vyacheslav Gerasimov bb2cf38617 Build: Make :kotlin-stdlib-js-ir buildKLib tasks cacheable 2020-03-03 16:47:55 +03:00
Alexander Udalov d84a6fa742 JVM IR: always generate inline class constructor with name 'constructor-impl'
Previously it was 'constructor-' + hash in case inline class property is
of inline class type.

No new tests added because this change fixes the constructor name in
`bytecodeListing/inlineClasses/inlineClassWithInlineClassUnderlyingType.kt`,
which is now failing due to other reasons.

 #KT-37041 Fixed
 #KT-37186
2020-03-03 14:16:03 +01:00
Vyacheslav Gerasimov 688208aa56 Build: Disable caching of Test tasks with doNotCacheIf 2020-03-03 15:55:38 +03:00
Vyacheslav Gerasimov 75a3808230 Build: Use sourceMapBaseDirs in :kotlin-stdlib-js:compileKotlin2Js
instead of freeCompiler args to avoid snapshotting absolute paths
and fix caching
2020-03-03 14:33:57 +03:00
Vyacheslav Gerasimov 4b9c7a1ae1 Advance bootstrap to 1.4.0-dev-1818 2020-03-03 14:33:55 +03:00
Victor Petukhov d6ccdb3caa NI: fix extensionLambdasAndArrow test 2020-03-03 13:55:15 +03:00
Kristoffer Andersen 6e40117116 [JVM IR] Refactor PromisedValue...
... for an _even leaner_ codegen!

- move discard from extention method to abstract method. This will at
  length avoid some calls to materialize.

- use newly abstract method to specialize discard in cases where it
  would introduce _and_ coerce values only to be popped by discard.

- move coerce to member method, introduce materializeAt with a view to
  eliminate calls to coerce outside of PromisedValue. This will allow
  us to specilaize materialization at particular types in some
  instances, at length avoiding casts etc.

- no calls to coerce outside of PromisedValue.kt! Progress.

- inlined coerce into materializeAt, anticipating specializing
  materializeAt across implementations of PromisedValue

- made materializeAt abstract, copied implementation everywhere!

- made materialize an extention function! Ready to specialize materializeAt

- coerce is no more!

- simplified and specialized all inlinings of materializeAt.

- adjust docs to match refactoring
2020-03-03 11:41:55 +01:00
Pavel Kirpichenkov ad988dbf43 minor: update test data 2020-03-03 12:57:41 +03:00
Pavel Kirpichenkov 23ed6c4a1f [NI] Narrow nullability constraint check in incorporator
This commit is a hotfix rather then proper solution.
The source of the issue is that currently type variable fixation result
may change due to fixation order alteration for variables with the same priority.
For instance, having variables V1, V2, and proper types Type1, Type2, such that:
V1 <: Type1
V1 <: V2
Type2 <: V2
both variables will be fixed either to Type1, if V1 will be fixed first,
or to Type2 otherwise.

Since this limitation cannot be easily overcome, the taken approach is to remove
incedental constraint added after 2d5a0546 by restricting nullability constraint check
to `Nothing?` constraints only, thus postponing problematic variable fixation.
To clearify, additional constraint is correct and should cause no harm (in ideal world),
but currently its presence changes fixation order.
So without the restriction the previously used constraint from fixed outer variable
is no longer available by the time problematic variable type is being selected.

^KT-37043 Fixed
2020-03-03 12:57:25 +03:00
Dmitriy Novozhilov ec01893237 [FIR] Resolve return expressions in independent context 2020-03-03 09:57:45 +03:00
Dmitriy Novozhilov d4f57fb835 [FIR] Support comparision operator and reified parameter reference in html dump 2020-03-03 09:57:45 +03:00
Dmitriy Novozhilov 9eeee6aad7 [FIR-TEST] Move FirBlackBoxCodegenTestGenerated to :fir2ir module 2020-03-03 09:57:45 +03:00
Dmitriy Novozhilov 54e7c79257 [FIR] Safe implicit receiver stack in lambda atom for resolve of inner lambdas
#KT-36887 Fixed
2020-03-03 09:57:42 +03:00
Dmitriy Novozhilov c7f5a2cba2 [FIR] Make ImplicitReceiverStack persistent 2020-03-03 09:57:41 +03:00
Dmitriy Novozhilov a332a5f26d Add benchmark with case with a lot of implicit receivers 2020-03-03 09:57:41 +03:00
Dmitriy Novozhilov 7ee125e1ad [FIR] Add receiver for lambda in position of default argument
#KT-36905 Fixed
2020-03-03 09:57:41 +03:00
Dmitriy Novozhilov c12fb1e069 [FIR] Fix determining type of when subject in exhaustiveness checker
#KT-37091 Fixed
2020-03-03 09:57:41 +03:00
Ivan Gavrilovic 6d4eb9ae52 KT-36113: Make KAPT classpath snapshot deterministic
When snapshotting a classpath entry, sort information about types
so there is no dependency on the order of entries in jar.

Test: ClasspathAnalyzerTest
2020-03-03 14:22:57 +09:00
pyos 9b68e4fe56 Android/IR: handle nulls from getView/getContainerView
Turns out it's possible to create an IR builder without a backend
context
2020-03-03 14:19:47 +09:00
Yan Zhulanow 390d062721 Fix class run configuration applicability (KT-33787)
The bug appeared when we turned “ultra light classes” on by default.
  The difference with the old implementation is that
  PsiClass.getTextRange() returns the correct non-null value.
  This triggers JavaExecutionUtil#stepIntoSingleClass() to return
  a light class instead of the original location (of a PsiIdentifier).
  So AbstractJavaTestConfigurationProducer#isConfigurationFromContext()
  returns true, and the wrong configuration is reused instead of
  creating the new one.

By the way, for Java it also returns an identifier because of the
  PsiTreeUtil.getParentOfType(element, PsiClass.class) != null check.

The proper fix should land in the newer versions of IDEA, however this
  (hopefully, temporary) hack will fix test method gutters for
  all platform versions.
2020-03-03 14:18:04 +09:00
Yan Zhulanow b360fb5119 Revert "Import Kotlin JUnit run configuration settings from Gradle" 2020-03-03 14:18:03 +09:00
Yan Zhulanow 29566723b8 Partially revert "Prefer Kotlin Gradle test run configurations when possible (KT-33787)"
This commit reverts 987307cf92.
Tests are left behind as the different fix will be provided for KT-33787.
2020-03-03 14:18:03 +09:00
Yan Zhulanow 9016a573ca Partially revert "Prefer Kotlin Junit test run configurations when possible (KT-33787)"
This commit reverts parts of ef8b3cb72a.
Tests are left behind as the different fix will be provided for KT-33787.
2020-03-03 14:18:03 +09:00
Nikolay Krasko 208c7274dd Disable parallel execution for gradle tests 2020-03-02 23:21:46 +03:00
Natalia Selezneva c0cd010b7d .gradle.kts: fix freezes by avoiding fs walking
^KT-36502 Fixed
2020-03-02 20:48:55 +03:00
Dmitry Petrov 01c4e66edb PSI2IR Use resulting descriptor extension receiver type
Use resulting descriptor extension receiver type instead of
ReceiverValue.type (which can contain captured types, which would be
approximated, and cause IR validation errors).
2020-03-02 20:34:02 +03:00
Victor Petukhov 51749b9747 NI: don't try to infer visible lambda parameters, if there is single one – extension parameter
^KT-37038 Fixed
2020-03-02 20:28:59 +03:00
pyos ed83e3ccef Optimize more redundant kotlin/jvm/internal/Refs
The number of initializations of the `value` field before the live range
begins does not really matter so long as we insert a write of a default
value to the local if there were none.
2020-03-02 20:20:55 +03:00
pyos 7e6d080123 JVM_IR: default-initialize variables visible in the LVT
See KT-36812. Aside from the problem stated there, D8 will throw out the
entire LVT if it sees a variable that has not been written to (and will
generate incorrect SSA if the slot is reused with a different type).

Note: this only fixes a FIR test because it's missing an `else -> throw`
branch, and default initialization satisfies the verifier and masks the
incorrect control flow.
2020-03-02 20:17:10 +03:00
Dmitry Gridin ecb7478794 ExperimentalFixesFactory: OptIn shouldn't be added for old version
#KT-36478
2020-03-03 00:09:00 +07:00
Nikolay Krasko 08dc03a704 201: Fix refineSignaturesWithResolve failure for primary constructors 2020-03-02 18:25:29 +03:00
Nikolay Krasko 096ff0e8a9 201: Enable mute in KotlinSuggestedRefactoringChangeListenerTest 2020-03-02 18:25:29 +03:00
Mikhail Zarechenskiy d1a8f57740 Disable New Inference in JS backend
See #KT-37163 for details
2020-03-02 18:03:41 +03:00
Dmitry Savvinov e6885323da Accept incorrect behaviour for run-config tests for AS
Short description.
It's a corner-case with old MPP plugins and AS, so we
don't care too much that it works incorrectly, but we'd like to avoid
muting it in order to keep track of this "known issue"

Long description.
In IDEA, KotlinJvmTestMethodGradleConfigurationProducer successfully
returns run configuration; in AS, it fails to do so.

This is becasuse it doesn't override 'forceGradleRunner', which means
that in 'setupConfigurationFromContext' we'll delegate to super-call,
which will pull 'GradleProjectSettings.getTestRunner()'.

In IDEA, it will return GRADLE, but in AS it will return PLATFORM,
because AS uses special instance of GradleProjectSettings which forces
runner to PLATFORM.

Note that KotlinMultiplatformJvmTestMethodGradleConfigurationProducer
does override 'forceGradleRunner' to true, that's why other tests work
successfully. However, this test uses old 1.2.X-MPP plugins, therefore
all new KotlinMultiplatform*ConfigurationProducers won't work here.\
2020-03-02 16:40:15 +03:00
Ilmir Usmanov 22de20e7e5 JVM_IR: Generate PUBLIC constructor for suspend lambda
if the lambda is inside inline function.
2020-03-02 14:03:35 +01:00
Ilmir Usmanov 42420cb6fc JVM_IR: Generate inner classes for continuations
Also, generate correct visibilities for constructors and continuation's fields.
2020-03-02 14:03:33 +01:00
Ilmir Usmanov 536e0e23a0 JVM_IR: Lazyly generate continuation classes of suspend functions
Otherwise, they will be generated, but unused, if the function is tail-call.
 #KT-36795 Fixed
2020-03-02 14:03:31 +01:00
Vladimir Dolzhenko 91ee63432a Disable CacheResetOnProcessCancele by default 2020-03-02 11:42:19 +01:00
Konstantin Tskhovrebov 60d592716d Disable KotlinMppTestLogger for non test executions.
Issue #KT-36716 Fixed
2020-03-02 13:41:33 +03:00
Konstantin Tskhovrebov 35055d1895 Fix empty run actions in context menu for non-JVM test results.
Issue #KT-36910 Fixed
Issue #KT-36909 Fixed
2020-03-02 12:25:36 +03:00
Vladimir Ilmov dc8f24b8bc Revert "Registry key to show hidden variables in debugger."
This reverts commit f5e6001d82.
2020-03-02 08:35:09 +01:00
Dmitry Petrov 61f8d3e558 Minor: update FIR2IR testData 2020-03-02 10:11:51 +03:00
Mikhail Glukhikh 1bad380381 FIR: fix test data in IDEA multi-module tests 2020-03-02 10:03:49 +03:00
Dmitriy Novozhilov 70ee51d88c [FIR] Add anonymous objects to CFG 2020-03-02 09:49:29 +03:00
Dmitriy Novozhilov e3f1f18ca3 [FIR] Add empty member scope for type variables 2020-03-02 09:49:29 +03:00
Dmitriy Novozhilov 985311d9f0 [FIR] Implement delegate inference 2020-03-02 09:49:29 +03:00