Commit Graph

87184 Commits

Author SHA1 Message Date
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
Victor Petukhov b5661ccabd Don't run contract-specific checks in propery scopes
^KT-45118 Fixed
2021-09-30 20:08:59 +03:00
Victor Petukhov b957831683 Use WarningAwareUpperBoundChecker independently
^KT-47920 Fixed
^KT-48290 Fixed
2021-09-30 20:08:58 +03:00
Victor Petukhov d9c50f0fda Report NON_VARARG_SPREAD on missed cases
^KT-48162 Fixed
2021-09-30 20:08:56 +03:00
Victor Petukhov 71ceffefb5 Support reporting deprecation errors explicitly 2021-09-30 20:08:55 +03:00
Victor Petukhov e30d467304 Implement deprecation cycle for proper refinement rhs type in assignments for java fields
^KT-46727 Fixed
2021-09-30 20:08:54 +03:00
Victor Petukhov 0cb56be14f Have "in type" for java fields to be able to check that type in assignment positions (against rhs' type)
^KT-46727 Fixed
2021-09-30 20:08:52 +03:00
Victor Petukhov 3530840da3 Don't report TAILREC_ON_VIRTUAL_MEMBER on private opened functions instead of leaving private members final by allopen plugin
^KT-48117 Fixed
2021-09-30 20:08:49 +03:00
Victor Petukhov c3773d14bb Revert "[all-open] Don't affect private declarations to change their modality to open"
This reverts commit baeee8988e.
2021-09-30 20:08:48 +03:00
Victor Petukhov 80312789b2 [PSI2IR] Use candidate descriptor to get original type parameters while generating assignment receiver for property
^KT-46829 Fixed
2021-09-30 20:08:44 +03:00
Victor Petukhov 2bdbbdd1a7 Commit delegation expression's trace with errors if we couldn't extract type info for it
^KT-44843 Fixed
2021-09-30 20:08:39 +03:00
Victor Petukhov 561ef5947a Introduce error for PROTECTED_CONSTRUCTOR_CALL_FROM_PUBLIC_INLINE
^KT-42972 Fixed
2021-09-30 20:08:37 +03:00
Victor Petukhov 01e853fb9b Introduce error for SUPER_CALL_FROM_PUBLIC_INLINE
^KT-45378 Fixed
2021-09-30 20:08:36 +03:00
Victor Petukhov 70d70b9042 Use warn mode by default for jspecify nullability annotations in 1.6
^KT-48851 Fixed
2021-09-30 20:08:35 +03:00
Yahor Berdnikau 013139f18e Unset MapProperty if not task outputs is present.
By default, Gradle creates such property as empty. 'isPresent' returns
'true' in such case.

^KT-46406 Fixed
2021-09-30 18:55:42 +02:00
Yahor Berdnikau de8d4e9e3c Fix reflection call is not working on older Gradle versions.
It happens, older Gradle versions has two functions with the same name,
but different parameters.
2021-09-30 18:55:42 +02:00
Abduqodiri Qurbonzoda cca5f82aa0 Handle container builders capacity overflow 2021-09-30 16:01:57 +00:00
Abduqodiri Qurbonzoda f8bcba0b76 Align JS String.equals/compareTo(ignoreCase) behavior with JVM #KT-48999 2021-09-30 15:35:50 +00:00
Hung Nguyen b5f74ef9a6 KT-45777: Add tests for top-level functions
Address review + Minor changes
Fix error when building with -Pbootstrap.local=true
Fix tests failing on Windows due to '/' character
2021-09-30 17:57:47 +03:00
Hung Nguyen e26dc4d574 KT-45777: Compute classpath changes based on changed snapshots only
to avoid unnecessarily loading unchanged ones.

Duplicate classes will make this a bit tricky. This commit outlines the
algorithm to handle them, the full implementation will follow later.

Also handle removed classes when computing classpath changes.

Test: New tests in ClasspathChangesComputerTest
2021-09-30 17:57:47 +03:00
Ilya Gorbunov c2af8b2a29 Leave Duration.convert experimental KT-46784 2021-09-30 14:31:54 +00:00
Ilya Gorbunov 04d70162d2 Make DurationUnit not a typealias of TimeUnit on JVM
Provide conversion functions between DurationUnit and TimeUnit
2021-09-30 14:31:54 +00:00
Victor Petukhov 2b1897e362 Provide a proxy for external use of deprecate package org.jetbrains.kotlin.resolve.calls.callUtil
Provided API is `getResolvedCall`, `getType` and `getCall`
2021-09-30 14:05:39 +00:00
Roman Artemev afb7accd5b [IR] Support erasure of recursive non-reified type parameters
In case of `inline fun <T : I<T>> foo(a: Any) = a as T` `T` is being
erased to `I<*>`

Also substitute class upper bound

Fix KT-47342

See KT-31072 for more details
2021-09-30 15:42:04 +03:00
Roman Artemev 882016c22f [IR] Add tests for KT-47342 2021-09-30 15:42:03 +03:00