Commit Graph

86408 Commits

Author SHA1 Message Date
Jinseong Jeon 464eecef03 FIR IDE: add more tests about annotation resolution 2021-10-01 18:54:14 +03:00
Ilya Kirillov e95313acbb ULC: do not use synchronized lazy as safe publication lazy is enough for LC 2021-10-01 16:48:35 +02:00
Ilya Kirillov f90fc8a46e ULC: do not break laziness contract when computing declaration qualified name
^KTIJ-19780 fixed
2021-10-01 16:48:35 +02:00
Ilya Kirillov c8c1ee2b5a Fix usage of readWriteAccess without resolve
^KTIJ-19777 fixed
2021-10-01 16:48:35 +02:00
Tianyu Geng c1754ad427 FIR: fix label on non-lambda anonymous function 2021-10-01 17:21:42 +03:00
Tianyu Geng d3b9419837 FIR checker: FirReturnAllowedChecker -> FirReturnSyntaxAndLabelChecker 2021-10-01 17:21:42 +03:00
Tianyu Geng fadde98a86 FIR: fix label stealling and crash with multiple labels
Consider the code below

```
fun test() {
  a@ b@ {
    {}
  }
}
```

Currently when the code is converted to FIR, label `b` is bound to the
outer lambda and `a` gets bound to the inner lambda because it's not
consumed. This is wrong and also leads transfromation to fail with
exceptions because of the unexpected consumption of `a`.

This change fixes the above issue by designating a specific node in the
AST as the allowed user of a label when the label is added.
2021-10-01 17:21:40 +03:00
Tianyu Geng 5c716ea979 FIR checker: report NOT_A_FUNCTION_LABEL 2021-10-01 17:21:39 +03:00
Svyatoslav Kuzmich ab9a23cbfa [Wasm][Stdlib] Reuse K/N collections and StringBuilder 2021-10-01 17:18:49 +03:00
Svyatoslav Kuzmich 6ad6bca503 [Stdlib] Fix K/N StringBuilder insertRange capacity issue 2021-10-01 17:18:48 +03:00
Svyatoslav Kuzmich 80c9dd3440 Update .idea/kotlinc.xml automatically modified by IDE 2021-10-01 17:18:48 +03:00
Sergey Bogolepov b9bb56d9c6 [K/N] FileCheck-based tests
Introduce a simple infrastructure for testing produced bitcode with
FileCheck LLVM utility.

^KT-48925
2021-10-01 14:18:01 +00:00
Sergey Bogolepov b692705092 [K/N] Add LLVM utils into developer LLVM distribution.
Including FileCheck utility.
2021-10-01 14:18:01 +00:00
Sergey Bogolepov 5c1a4f79c4 [K/N] Minor LLVM builder fixes 2021-10-01 14:18:00 +00:00
Sergey Bogolepov 7a3f33ad0b [K/N] Add option to save unoptimized bitcode
Add `-Xsave-llvm-ir` option that stores LLVM IR text into temporary
directory right after IrToBitcode translation. This is required for
FileCheck-based tests and just helpful during development.
2021-10-01 14:18:00 +00:00
Alexander Likhachev a1424489b7 [Gradle, JS] Reduce configuration cache state size by data deduplication
#KT-49037 Fixed
2021-10-01 13:44:09 +00:00
Ilya Goncharov 18189ece48 [JS IR] Fix stdlib API 2021-10-01 13:32:14 +00:00
Ilya Goncharov 490ebde992 [JS IR] Commonize JsEagerInitialization 2021-10-01 13:32:13 +00:00
Ilya Goncharov 8bd009c5fd [JS IR] Eager initialization on side effect test 2021-10-01 13:32:13 +00:00
Ilya Goncharov 23c8433fce [JS IR] Eager initialization of adapter for kotlin.test tests 2021-10-01 13:32:13 +00:00
Ilya Goncharov dedb9d9018 [JS IR] Fix assertion to enable early created declarations 2021-10-01 13:32:12 +00:00
Ilya Goncharov 8f22e30515 [JS IR] Enable property lazy initialization in tests 2021-10-01 13:32:12 +00:00
Ilya Goncharov 4c0045b136 [JS IR] Add test on initialization calling only once 2021-10-01 13:32:11 +00:00
Ilya Goncharov 01fbe6bacc [JS IR] Use property lazy initialization by default 2021-10-01 13:32:11 +00:00
Ilya Goncharov 9af66d15a3 [JS IR] Fix stdlib API 2021-10-01 13:32:10 +00:00
Ilya Goncharov c2cf221965 [JS IR] Add annotation for eager property initialization 2021-10-01 13:32:10 +00:00
Ilya Goncharov b5fb0d9f33 [JS IR] Deprecate safeProperty(Get|Set) methods from stdlib 2021-10-01 13:21:19 +00:00
pyos 73adcd7b62 JVM_IR: copy code from JvmDefaultParameterInjector to JvmTailrecLowering
Some weird edge case for inline classes wrapping primitives?
2021-10-01 14:37:55 +02:00
pyos cb505d1101 IR: keep capture sets the same when copying objects for tailrec funs
tailrec f(x: () -> T = { y }, y: T = ...) = f()

-- at the call we know that in `x` the observed value of `y` is `null`,
but the constructor should still have a single parameter.
2021-10-01 14:37:54 +02:00
pyos a4d1358e57 FIR: permit tailrec calls in inline lambdas 2021-10-01 14:37:54 +02:00
pyos 2afab62dae JVM_IR: optimize tailrec calls in inline lambdas
^KT-48600 Fixed
2021-10-01 14:37:54 +02:00
pyos 7c63d50d1c IR: create more temporary vals when optimizing tailrec calls
This is needed so that SharedVariablesLowering doesn't get confused, and
SharedVariablesLowering should run after TailrecLowering to properly
optimize tailrec calls in inline lambdas.
2021-10-01 14:37:54 +02:00
pyos b2315a4a05 IR: optimize f(); return in tailrec fun f(): Unit
It's equivalent to `return f()`.
2021-10-01 14:37:54 +02:00
Abduqodiri Qurbonzoda 83364d78f5 Replace JVM StringBuilder.appendln usages with appendLine 2021-10-01 15:12:16 +03:00
Dmitry Petrov aea2db97c5 JVM_IR simplify null check on trivially initialized vals only 2021-10-01 14:31:48 +03:00
Pavel Punegov ae1288948a [K/N] Exclude libbacktrace for Linux-MIPS targets
See #KT-48949
2021-10-01 10:59:16 +00:00
Alexander Udalov 31ba7f24b1 JVM IR: fix generic signatures of suspend function references
Using `kotlin.jvm.functions.Function{n+1}` (via
`getJvmSuspendFunctionClass`) for suspend functions was wrong in the
function reference lowering, because we didn't adapt the parameter types
by transforming the last type to Continuation and adding Object, and
generic signature ended up being incorrect.

Actually there was no need to use `kotlin.jvm.functions.Function{n+1}`
at all. We can just use the built-in
`kotlin.coroutines.SuspendFunction{n}` as a supertype, and it will be
mapped correctly later in codegen. It's not even needed to add the
`kotlin.coroutines.jvm.internal.SuspendFunction` marker manually, since
it's also handled by the codegen (see `IrTypeMapper.mapClassSignature`).

 #KT-48732 Fixed
2021-10-01 12:43:00 +02:00
Victor Petukhov 43a83dd07a Don't add LHS type constraint for callable references too early, before the resolution
The constraint depends on a resolution candidate, because it can be Java static or companion object's member (don't need add constraint in this case)

^KT-41978 Fixed
2021-10-01 13:33:21 +03:00
Ilya Chernikov fd2929d2c5 IR: skip script inner classes in LDL
#KT-49012 fixed
2021-10-01 09:01:36 +02:00
Dmitry Petrov 7e86f5dcd9 JVM_IR don't use Intrinsics.stringPlus for 2-argument concatenation 2021-10-01 02:59:52 +03:00
Georgy Bronnikov 8a459821d0 JVM_IR: avoid double encoding of byte strings
IrLibraryFile, ingerited from Klib code, needed types, bodies, strings,
signatures encoded as byte strings.
When we store this data as class annotations, it is better to store it
as protobuf structs, to avoid re-encoding byte streams twice.
2021-10-01 00:58:06 +03:00
Mads Ager b61389f6f9 [JVM IR] Do not generate clinit as enclosing method.
The JVM and newer Android runtimes treats that the same as if
there is no enclosing method. However, older Android runtimes
for Android 5 and 6 throw exceptions on reflective access
and even older runtimes have different behavior. To avoid
those issues, exclude <clinit> from enclosing method attributes.

^ KT-48754 Fixed
2021-09-30 23:02:43 +02:00
Jinseong Jeon 56867d9c7e FIR LC: additional checks on synthetic members of data class 2021-09-30 19:42:42 +02:00
Jinseong Jeon 5af24dc6ce FIR/LC: use DataClassResolver when determining componentN/copy 2021-09-30 19:42:42 +02:00
Jinseong Jeon ac53166960 FIR LC: create synthetic members of data class 2021-09-30 19:42:42 +02:00
Jinseong Jeon c8047f8384 Unify and use names of synthetic members of data class 2021-09-30 19:42:42 +02:00
Jinseong Jeon 8c97f0c3a1 FIR LC: minor reordering of utils that add members 2021-09-30 19:42:41 +02:00
Abduqodiri Qurbonzoda 1ae7c2af21 Use JS substituteGroupRefs implementation in Native as well 2021-09-30 17:38:03 +00:00
Abduqodiri Qurbonzoda dc2f5eab25 Align JS and JVM behavior of Regex replace function #KT-28378 2021-09-30 17:38:03 +00:00
Victor Petukhov 5326c875c0 Update compiler tests after rebase 2021-09-30 20:09:00 +03:00