Commit Graph

85332 Commits

Author SHA1 Message Date
Mads Ager 8dee3c1ca0 [JVM] Do not unbox when local variable initialized with null.
This is already the case for straightline code such as

```
inline fun <R> f(size: Int, block: () -> R): R {
    var result: R
    result = block()
    return result
}
```

However, if the local variable introduction happens at a merge
point as in the following example, we allow the unboxing but
only do it halfway. The initialization of the local is still
done with a null value.

```
inline fun <R> f(size: Int, block: () -> R): R {
    var result: R
    while (true) {
        result = block()
        if (size == 0) break
    }
    return result
}
```

This change disallows unboxing for this move complicated
case as well by bailing out if a local use is with a
TaintedBoxedValue (merge of Object and Integer).

^KT-48394 Fixed.
2021-08-26 15:14:02 +03:00
Mark Punzalan 580f1d51f6 FIR checker: report LOCAL_VARIABLE_WITH_TYPE_PARAMETERS 2021-08-26 12:25:07 +03:00
Tianyu Geng a18daa5d62 FIR checker: report type parameters on anonymous objects 2021-08-26 12:25:06 +03:00
Tianyu Geng 4d9102f749 FIR checker: fix position strategy of TYPE_PARAMETERS_IN_OBJECT 2021-08-26 12:25:03 +03:00
Ilya Goncharov acb7ba86bc [JS IR] Add vararg to state machine building
^KT-48344 fixed
2021-08-26 08:52:34 +00:00
Ilya Goncharov 0ca9e08c11 [JS IR] Add test with fail with vararg call in suspend
^KT-48344 fixed
2021-08-26 08:52:34 +00:00
Ilya Goncharov 4179d078ca [JS IR] Add test on call of suspend super type 2021-08-26 08:50:14 +00:00
Ilya Goncharov ee712b2770 [JS IR] Invokes which is not concrete suspend not wrap into function call 2021-08-26 08:50:13 +00:00
Margarita Bobova c3044e558a Add changelog for 1.5.30 2021-08-26 10:22:38 +03:00
Svyatoslav Scherbina 981a6ffeb8 Native: RedundantCoercionsCleaner should rewrite nested returns too 2021-08-26 07:15:25 +00:00
Dmitriy Novozhilov 3176dd1341 [FIR] Properly create edges from return expression to finally block
^KT-48376 Fixed
2021-08-26 10:08:52 +03:00
Dmitriy Novozhilov 16b7735cd6 [FIR] Fix rendering of labels for return edgeds in CFG 2021-08-26 10:08:52 +03:00
Dmitriy Novozhilov 0924216ed2 [FIR] Distinguish stub types for builder inference and for subtyping
^KT-48110 Fixed
2021-08-26 10:08:52 +03:00
Dmitriy Novozhilov 7e6e0a3dd6 Remove all type system-specific inheritors of TypeCheckerState 2021-08-26 10:08:51 +03:00
Dmitriy Novozhilov 3f6738c8bc Remove all type system dependent methods from TypeCheckerState 2021-08-26 10:08:51 +03:00
Dmitriy Novozhilov e07512a847 Delegate refineType and prepareType in TypeCheckerState to special services
This is needed to add ability to create type system independent TypeCheckerState
2021-08-26 10:08:51 +03:00
Dmitriy Novozhilov 8b5548df49 Rename AbstractTypeCheckerContext to TypeCheckerState 2021-08-26 10:08:51 +03:00
Alexander Shabalin 28136d7eb0 [K/N] Fix memoryModel selection 2021-08-26 04:46:47 +00:00
Ivan Kochurkin 84c5f58cab [FIR] Implement UNRESOLVED_REFERENCE_WRONG_RECEIVER 2021-08-25 21:53:23 +00:00
Ivan Kochurkin 34cc7e5199 [FIR] Fix resolving to star import member instead of builtin (^KT-48157 Fixed) 2021-08-25 21:53:23 +00:00
Ivan Kochurkin bb27ae2b42 [FIR] Fix incorrect resolve of callable reference in function signature (^KT-48304 Fixed) 2021-08-25 21:53:23 +00:00
ov7a 5ddf0cc7b2 JVM Cli: Proper Main-class manifest attribute for JvmStatic entry point.
`findMainClass` could handle main entry point from object and companion
object, not just top-level function.

Fixes [KT-32376](https://youtrack.jetbrains.com/issue/KT-32376).
2021-08-25 23:38:51 +02:00
Ilya Gorbunov ed1bee6975 Setup Kotlin compilation of java 9 source sets consistently
Usually, java 9 source sets contain only module-info.java file, so
Kotlin compilation does not run because there are no .kt sources.
However, it can still start after some incremental changes and
thus it's important to have its JVM target configured consistently
with Java compilation of the same source set.
2021-08-25 18:34:38 +03:00
Dmitriy Novozhilov 8ed1b153b4 Fix warnings 2021-08-25 14:55:52 +03:00
Dmitriy Novozhilov 049ebef53e Advance bootstrap to 1.6.0-dev-3496 2021-08-25 14:55:51 +03:00
Tianyu Geng 1e8e38e5ac FIR checker: improve diagnostics message for SEALED_INHERITOR_IN_DIFFERENT_PACKAGE 2021-08-25 14:37:25 +03:00
Tianyu Geng 10d4dfef04 FIR: check subclass of sealed class 2021-08-25 14:37:24 +03:00
sebastian.sellmair ed152e74a0 [Gradle] Add 'CATEGORY_ATTRIBUTE=LIBRARY' attribute to configurations
^KT-36941 Verification Pending

This is necessary to fix:
https://youtrack.jetbrains.com/issue/KTIJ-10769
by preventing confusion with the `samplessources` variant.
2021-08-25 11:35:33 +00:00
Alexander Shabalin a279b2230f [K/N] Logging for runtime 2021-08-25 08:04:01 +00:00
Ilya Gorbunov 516c2933ce Run configuration for regenerating builtins sources 2021-08-25 06:22:17 +03:00
Ilya Gorbunov 43a614ffcd Make builder collection implementations serializable KT-39328
Collections returned by collection builders are now serializable in
their read-only state.
The builder mutable collections inside collection builder lambda,
however, are not.
2021-08-24 23:13:57 +00:00
Ilya Chernikov 4243bafd1d Scripting: implement correct disposal of REPL state on finalization
#KT-47927 fixed
2021-08-24 21:39:38 +03:00
Ilya Chernikov a45e31720c Make state of the default REPL compiler explicit and replaceable
restores proper object hierarchy in case the legacy REPL infrastructure
2021-08-24 21:39:37 +03:00
Ilya Chernikov e7c9a46329 [minor] Extract jvm scripting test into a separate task 2021-08-24 21:39:37 +03:00
Ilya Chernikov 61e5f68b8d Scripting invalidate compiled cache if a dependency is missing
#KT-48303 fixed
2021-08-24 21:39:35 +03:00
Ilya Chernikov e60e80f19a Scripting: improve reporting on cyclic dependency
#KT-48177 fixed
the issue is in fact fixed by the previous commit (report error
on duplicated import) by normalizing import path before processing,
but here we're making error reporting nicer for the case.
2021-08-24 21:39:33 +03:00
Ilya Chernikov c204d7a86f Scripting: report error on duplicate import
#KT-48177 fixed
(due to the path normalization)
2021-08-24 21:39:32 +03:00
Mark Punzalan 306a035c68 HL API: Fix argument mapping for lambda arguments (+ more tests). 2021-08-24 21:36:46 +03:00
Ilya Kirillov 20f297aaf7 FIR LC: do not ignore useSite target for getting deprecation status 2021-08-24 20:13:18 +03:00
Ilya Kirillov c17a4a5a3b FIR IDE: move light classes to separate module 2021-08-24 20:13:09 +03:00
Ilya Kirillov abe2311372 FIR IDE: move declaration/package providers to separate module 2021-08-24 20:12:58 +03:00
Ilya Kirillov a54b769ec4 FIR LC: do not use fir directly to get deprecation status 2021-08-24 20:12:57 +03:00
Ilya Kirillov 1baa4759a9 FIR LC: remove unused function 2021-08-24 20:12:56 +03:00
Ilya Kirillov 6e2c9256cf FIR LC: do not use fir directly to create ASM types 2021-08-24 20:12:54 +03:00
Ilya Kirillov a1497b13c9 HL API: add nullability property to every KtType 2021-08-24 20:12:53 +03:00
Tianyu Geng c940972674 FIR IDE: add shortcut to check if a KtSymbol is deprecated 2021-08-24 20:12:51 +03:00
Ilya Kirillov cc6389d394 FIR LC: do not use fir directly to create PSI types 2021-08-24 20:12:42 +03:00
Dmitry Petrov c30b23ed01 JVM_IR fixes after review 2021-08-24 18:56:22 +03:00
Dmitry Petrov f4dd75e769 JVM_IR don't inline temporary val for 'when' subject 2021-08-24 18:56:21 +03:00
Dmitry Petrov f4a1e27124 JVM optimize unneeded temporary vals 2021-08-24 18:56:20 +03:00