Commit Graph

90623 Commits

Author SHA1 Message Date
Dmitriy Novozhilov e5275992d2 [FIR] Return scope session from LowLevelFirAnalyzerFacade instead of failing
This is needed for proper work of FirScopeDumpHandler for
  low level fir tests
2022-01-19 15:24:43 +03:00
Dmitriy Novozhilov 6d8b1800e4 [FIR] Extract duplicated code of processing classifiers from intersection scope 2022-01-19 15:24:43 +03:00
Dmitriy Novozhilov c80cfb0fdb [FIR] Replace single supertype scope with list of scopes of supertypes in use site scopes
This big refactoring is needed to cleanup building of overrides
  mappings and prevent creating redundant intersection overrides in
  cases when there is no need in them:

```kotlin
interface A {
    fun foo()
}

interface B {
    fun foo()
}

interface C : A, B {
    override fun foo()
}
```

Before this refactoring there was next override tree:
C.foo
  intersection override (A.foo, B.foo)
    A.foo
    B.foo

Also this commit fixes special mapping of overrides in jvm scopes
  for declarations which have kotlin builtins in supertypes with
  special java mapping rules (collections, for example)
2022-01-19 15:24:43 +03:00
Dmitriy Novozhilov 17916d4a63 [FE] Return Name? instead of List<Name> from getBuiltinFunctionNamesByJvmName
This is much more correct, because we have one to one mapping for
  special java functions in this case, so using single nullable name
  instead of list of names makes code more readable
2022-01-19 15:24:43 +03:00
Dmitriy Novozhilov 09a7a1c09f [FIR] Add ability to specify members in FirScopeDumpHandler 2022-01-19 15:24:43 +03:00
Dmitriy Novozhilov d588b2e654 [FIR] Add toString to all type scopes 2022-01-19 15:24:43 +03:00
Dmitriy Novozhilov e4978d8022 [FIR] Move collecting classifiers from type intersection scope to context 2022-01-19 15:24:42 +03:00
Dmitriy Novozhilov 95a95450bf [FIR] Extract logic of creating intersection overrides into separate class 2022-01-19 15:24:42 +03:00
Pavel Punegov 3db341213b [K/N] Synchronize LLVM target initialization
Race conditions should be avoided during initialization.
See llvm/lib/Support/TargetRegistry.cpp in LLVM repo
2022-01-19 11:18:43 +00:00
Pavel Punegov a22e267b05 [K/N] Set JDK17 as a toolchain for endorsedLibs project
Older JDKs sometimes make build fail with obscure errors
2022-01-19 11:18:14 +00:00
Pavel Kirpichenkov b4c854429f [MPP] Permit const actual properties for non-const expects
It's safe as not having const is more restrictive, therefore can be
allowed in common. Otherwise, it's not possible to declare an expect
declaration for a platform property with `const` modifier in common

KT-18856
2022-01-19 13:22:47 +03:00
Pavel Kirpichenkov 8ad06ef725 Minor: reformat 2022-01-19 13:22:47 +03:00
Pavel Kirpichenkov a46e683c85 [MPP] Add tests for const vs non-const expect and actual properties
KT-18856
2022-01-19 13:22:46 +03:00
Denis.Zharkov b2543b7a26 Fix false negative UPPER_BOUND_VIOLATED with typealiases in supertypes
^KT-50797 Fixed
^KT-50798 Open
2022-01-19 09:52:16 +03:00
Pavel Punegov 8d0b511e95 [K/N][samples] Turn off hmpp and metadata due to ^KT-50547 2022-01-18 15:24:06 +00:00
Elena Lepilkina b8af589137 [K/N][perf] Added workaround to build benchmarks analyzer artifacts 2022-01-18 17:08:10 +03:00
Ilmir Usmanov b794b0f1be Check if there is bridge by signatures instead of IR
#KT-50649 Fixed
2022-01-18 16:57:00 +03:00
Alexander Korepanov 8fe4e9030f [JS IR] Add an implicit cast to int for the mod operation
^KT-45620 Fixed
2022-01-18 12:01:37 +00:00
Dmitriy Novozhilov 5fc1e2e0cb [FIR] Don't create DNN types for flexible simple types
^KT-50788
2022-01-18 13:41:31 +03:00
Sergej Jaskiewicz ceb744b53b Revert "[JS IR] [runtime] Remove valueOf method from Long"
This reverts commit e13b6b2a90.

The significance of the breakage caused by the removal of `valueOf`
was underestimated.

#KT-50202 Open
2022-01-18 10:33:54 +00:00
Dmitriy Novozhilov bc3157162d [FE 1.0] Clarify some diagnostic messages 2022-01-18 12:47:55 +03:00
Dmitriy Novozhilov 534d84e3e5 [FE 1.0] Add links to committee YT tickets into diagnostic messages
^KT-39883 Fixed
^KT-44705 Fixed
^KT-44866 Fixed
^KT-47902 Fixed
^KT-49110 Fixed
2022-01-18 12:47:54 +03:00
Dmitriy Novozhilov ca31d51a6e [FE 1.0] Change since version of ProhibitAccessToEnumCompanionMembersInEnumConstructorCall feature to 1.8
^KT-49110
2022-01-18 12:47:53 +03:00
Dmitriy Novozhilov a63f65fef1 [FE 1.0] Change since version of ProhibitNonExhaustiveIfInRhsOfElvis feature to 1.8
^KT-44705
2022-01-18 12:47:52 +03:00
Dmitriy Novozhilov a99a7fd48d [FE 1.0] Change since version of StopPropagatingDeprecationThroughOverrides feature to 1.8
^KT-47902
2022-01-18 12:47:51 +03:00
Jerome Prinet 3d121b2080 Bump up Gradle plugin dependencies 2022-01-18 12:22:18 +03:00
Svyatoslav Scherbina ec3a2c9671 Native: remove cleanup landingpad if it is unused
Useful for ObjCExport, because most of its bridges don't use it.
2022-01-18 08:15:15 +00:00
Svyatoslav Scherbina 47a0bdc1bc Native: remove forwardingForeignExceptionsTerminatedWith
It is no longer used, and was generally misdesigned.
2022-01-18 08:15:15 +00:00
Svyatoslav Scherbina 35cb897bdd ObjCExport: use terminatingExceptionHandler by default
If something called from an ObjCExport bridge throws a Kotlin exception,
treat it as fatal by default and terminate the process.

This affects
* Runtime calls (managing and converting Kotlin and Obj-C references and
  other types), that shouldn't throw such exceptions anyway
* User code (Kotlin function object throws Kotlin exception when
  called from Swift/Obj-C).

If an exception should be handled non-fatally (e.g. forwarded to
the caller), this intention should be expressed in the code generator
explicitly.

^KT-50830

This change makes the code more simple and efficient,
and the control flow -- more explicit.
2022-01-18 08:15:14 +00:00
Svyatoslav Scherbina bc2cc026db ObjCExport: use ObjCExportFunctionGenerationContext when generating code
instead of its supertype, FunctionGenerationContext.
2022-01-18 08:15:14 +00:00
Svyatoslav Scherbina e8e4a850d4 ObjCExport: remove state switching from callFromBridge
It is not required anymore.
2022-01-18 08:15:14 +00:00
Svyatoslav Scherbina 776154881b ObjCExport: prohibit Kotlin exceptions leaking through native code back
If a Kotlin exceptions is thrown out of a native code in ObjCExport
(when calling Swift/Obj-C method overriding Kotlin method, or calling
Swift/Obj-C block as Kotlin function type), treat this exception as
fatal and terminate the process.
This could happen if the Kotlin exception leaked from Kotlin to native
code before.
In other words, when calling Kotlin -> Swift/Obj-C -> Kotlin, if Kotlin
exception passes from the last to the first part, terminate.

^KT-50830
2022-01-18 08:15:13 +00:00
Svyatoslav Scherbina f7a1fa86a9 ObjCExport: introduce terminatingExceptionHandler 2022-01-18 08:15:13 +00:00
Svyatoslav Scherbina eaa6a75de4 ObjCExport: don't generate redundant exception handler for objc_release 2022-01-18 08:15:12 +00:00
Svyatoslav Scherbina cdfcffbd57 ObjCExport: make objc_release nounwind
Also replace it by an LLVM intrinsic, llvm.objc.release,
which is lowered to objc_release.

This is close to what Clang does.
2022-01-18 08:15:12 +00:00
Nikolay Krasko 0ad440f112 Revert "Use relative paths in own kotlin klib artifacts"
Revert because using absolute paths in inputs ruins Gradle build caches.

This reverts commit 0884782c60.
2022-01-18 02:30:04 +03:00
Alexander Udalov f84f3cae97 Decrease operand count in tests on invokedynamic string concat
Otherwise the tests are flaky for some reason; stack overflow is thrown
from psi2ir sometimes. Probably it has something to do with the fact
that the JVM stack which is used by the compiler here is around the
default limit (which is 1M).
2022-01-17 23:59:59 +01:00
Nikita Bobko f86b201eb5 Coop dev: make it possible to depend on ':prepare:ide-plugin-dependencies:kotlin-jps-common-for-ide'
KT-MR-5457
2022-01-17 20:42:57 +01:00
Nikita Bobko 9ec658b0ac [imltogradle] Fix kotlinc libs generator
kotlinc libs were changed from maven libs to plain JPS libs which
contain `../build/repo` jars

KT-MR-5457
2022-01-17 20:42:56 +01:00
Nikita Bobko d2315371e0 Coop dev: fix gradle import
JPS modules were moved back to the kotlin plugin and no longer exist in kt-212-master

KT-MR-5457
2022-01-17 20:42:56 +01:00
Victor Petukhov 72a78eb423 Replace errors with warnings for type checker recursion on delegates
^KT-49477 Fixed
2022-01-17 21:27:14 +03:00
Victor Petukhov a4a2f71fca Introduce deprecation cycle for reporting errors on some illegal equality calls inside a builder inference call
^KT-43493 Fixed
2022-01-17 19:44:16 +03:00
Victor Petukhov 060af85a93 Extract checks on equality expressions into a separate checker
^KT-43493 Fixed
2022-01-17 19:44:16 +03:00
Dmitriy Novozhilov 598f09d7a5 [Build] Don't generate redundant modularized tests configurations for kotlin project 2022-01-17 17:59:23 +03:00
Dmitriy Novozhilov 8daf7774ba [FIR] Properly handle when subject expression in DFA of equality calls
^KT-50785 Fixed
2022-01-17 17:59:23 +03:00
Dmitriy Novozhilov 57346bac54 [FIR] Properly handle flexible types during creation of DNNT
^KT-50788 Fixed
2022-01-17 17:59:22 +03:00
Yahor Berdnikau be020c588c Clarify the case when a new benchmark project should be added
^KT-49921 Fixed
2022-01-17 14:24:44 +00:00
Yahor Berdnikau 4fe27cce07 Add benchmarks for kotlin-graphql library.
This library uses Spring plus kapt.

^KT-49921 In Progress
2022-01-17 14:24:43 +00:00
Yahor Berdnikau ee9965a139 Add more benchmarks for Duckduckgo app
^KT-49921 In Progress
2022-01-17 14:24:43 +00:00
Ilya Gorbunov 906a351a81 Regenerate standard library generated code 2022-01-17 15:38:27 +03:00