Commit Graph

87184 Commits

Author SHA1 Message Date
Mikhail Glukhikh 4052befe88 Make OPT_IN_USAGE_ERROR an error in FIR 2021-09-29 19:39:24 +03:00
Mikhail Glukhikh 056f74a23b FE 1.0: allow OptIn marker on override if base class is marked
#KT-49002 Fixed
2021-09-29 19:39:24 +03:00
Mikhail Glukhikh a76aee9b69 FIR: spread OptIn markers to children except fake override case
This commit implements KT-49001 for FIR
2021-09-29 19:39:23 +03:00
Mikhail Glukhikh 69e06a242a FE 1.0: spread OptIn markers to children except fake override case
#KT-49001 Fixed
2021-09-29 19:39:22 +03:00
Mikhail Glukhikh 3045a5e920 FIR: implement OPT_IN_MARKER_ON_WRONG_TARGET 2021-09-29 19:39:20 +03:00
Mikhail Glukhikh 8bb16d8e7a FIR opt-in: rename(s) in checker(s) 2021-09-29 19:39:18 +03:00
Mark Punzalan 42abc4a3af FIR: Don't use AnnotationUseSiteTarget.PROPERTY_GETTER when computing
deprecation from a callable reference use site.

Also fixed positioning of DEPRECATION(_ERROR) diagnostics on variable
assignments.
2021-09-29 19:39:17 +03:00
Mark Punzalan b8ed46066e FIR: Change diagnostic for ConeHiddenCandidate to UNRESOLVED_REFERENCE.
The KDoc for @Deprecated states that DeprecationLevel.HIDDEN usages
should look like unresolved references.
2021-09-29 19:39:17 +03:00
Mark Punzalan 7425986bf0 Analysis API: Don't resolve references to @Deprecated(HIDDEN)
declarations.
2021-09-29 19:39:16 +03:00
Mark Punzalan 41a1fa25e2 FIR: Add ConeVisibilityError to distinguish between candidates that are
invisible versus hidden due to deprecation.
2021-09-29 19:39:15 +03:00
Mark Punzalan 58eb329fb9 FIR: Make CheckDeprecatedSinceKotlin the first resolution stage.
All subsequent stages don't need to run if the candidate is
@Deprecated(HIDDEN).
2021-09-29 19:39:14 +03:00
Mark Punzalan 63cc18b095 FIR: Add test for candidate behind hidden property accessors.
See KT-48799.
2021-09-29 19:39:13 +03:00
Tianyu Geng f35680f0a4 FIR checker: resolve property with protected getter and public setter
Assuming Java class `Super` has a protected `getName` method and a
public `setName` method.

Then, in a subclass of `Super`, FE1.0 allows calls to `setName` via the
property syntax if the property is protected and invisible due to
dispatch receiver is not `this` or `super`.
2021-09-29 19:39:12 +03:00
Alexander Likhachev f27f91b03a [Build] Make JVM target settings logic less imperative
Previously actual value was dependent on the order of calls to `updateJvmTarget` and `configureJava9Compilation` in build script that may lead to inconsistencies
2021-09-29 16:34:11 +00:00
Alexander Likhachev 2f230833ac [Build] Create configuration in :kotlin-reflect-api to patch Java module
`compileOnly` configuration is unresolvable, and it's more preferable to create new configuration that extends from it rather than making it resolvable
2021-09-29 16:34:10 +00:00
Alexander Likhachev c6e1e4fd8e [Gradle] Make compileOnly/compile/runtime configurations not resolvable
#KT-48245 Fixed
2021-09-29 16:34:10 +00:00
Dmitry Petrov 86b3ea09c2 JVM_IR handle @EnhancedNullability types in null check simplification 2021-09-29 19:14:38 +03:00
Dmitry Petrov cc885f9b24 JVM don't remove NOP starting a try-catch block 2021-09-29 19:14:37 +03:00
Dmitry Petrov 9325660f06 JVM_IR fold safe calls and elvises 2021-09-29 19:14:36 +03:00
Dmitry Petrov 7370d096ee JVM_IR recognize safe calls and elvises in arbitrary IR 2021-09-29 19:14:34 +03:00
Dmitry Petrov ca7ee75f88 JVM replace redundant GOTOs with NOPs to preserve debugging behavior 2021-09-29 19:14:33 +03:00
Dmitry Petrov 0a67ab54fe JVM_IR more compact safe call chains (almost as old BE) 2021-09-29 19:14:32 +03:00
Leonid Startsev f4eaf611c8 Do not access serializable property IrField if it is unbound
Fixes https://github.com/Kotlin/kotlinx.serialization/issues/1698
2021-09-29 15:21:12 +00:00
Svyatoslav Scherbina 9672b6b30d kotlin-native/NEW_MM.md: update to 1.6.0-M1 and remove kotlin/temporary repo 2021-09-29 15:16:53 +00:00
pyos be53fc3467 IR: remove the use of lazy from LocalDeclarationsLowering 2021-09-29 16:25:43 +02:00
pyos 255e94e961 JVM_IR: add IrInstanceInitializerCall to suspend lambda constructors 2021-09-29 16:25:43 +02:00
pyos e1520c61da IR: use parameters for captures in field/instance initializers
val y = 1
    object { val x = y }
  ->
    class XKt$1(`$y`: Int) { val x: Int = `$y` }

Note that `$y` is not stored in a field because it's not used outside
the primary constructor.

One exception is captured inline parameters on the JVM backend, as the
bytecode inliner uses field assignment instructions (setfield) to locate
them; removing the field is thus not possible.
2021-09-29 16:25:43 +02:00
pyos 85c53bc24e IR: do not create unused capture fields
^KT-48784 Fixed
2021-09-29 16:25:43 +02:00
Leonid Startsev e7f1cef3a1 Correctly rearrange arguments for annotation constructors copied from another module
It won't fix KT-48181 completely, but it will allow to create such annotations
if all value arguments are specified.

For the full fix, we need to read default annotation values from classfiles in jar.

#KT-48181 In progress
2021-09-29 13:45:45 +00:00
Yahor Berdnikau 60cbfbf107 Change KotlinGradleSubplugin deprecation level to ERROR.
^KT-48830 Fixed
2021-09-29 12:13:02 +00:00
Pavel Kunyavskiy e15cfe8f70 [K/N] Use gradle-level conditional compilation for core symbolication 2021-09-29 07:00:07 +00:00
Pavel Kunyavskiy 9f2035c43d [K/N] Don't assume all apple target support CoreSymbolication 2021-09-29 07:00:07 +00:00
Ilya Gorbunov 193effc7c4 Fix Random.nextLong returning value out of range KT-47304
Correctly zero-extend the lower Int part of the Long being produced
2021-09-29 06:50:41 +00:00
Alexander Shabalin 43f64bc7b4 [K/N] Fix timer tests 2021-09-28 22:50:52 +00:00
Steven Schäfer 00134fddf9 Parcelize: Allow Parcelize annotation on sealed classes
See https://issuetracker.google.com/177856520
2021-09-28 22:16:33 +02:00
Denis.Zharkov 9ac29e0714 Fix enhancement when mixing TYPE_USE and non-TYPE_USE annotations 2021-09-28 22:59:18 +03:00
Tianyu Geng a5435c0efc Make FE1.0 report tailrec diagnostics on the keyword 2021-09-28 22:30:20 +03:00
Tianyu Geng 5252effb10 FIR checker: report tailrec problems on the keyword
FE1.0 reports it on the declaration signature. This is not ideal so we
move it to the `tailrec` keyword in FIR.
2021-09-28 22:30:09 +03:00
Ivan Kochurkin 922ae607f6 [FIR] Implement REPEATED_ANNOTATION for types refs ^KT-48652 Fixed 2021-09-28 21:33:06 +03:00
Ivan Kochurkin 3dc0935da4 [FIR] Pass bounds from original type to fully expanded ^KT-40203 Fixed 2021-09-28 21:32:54 +03:00
Sergej Jaskiewicz f0f60907e2 [JS IR] Fix generating property accessors
TL;DR, before we were emitting this JS code:
  Object.defineProperty(Base.prototype, 'bar', {
    configurable: true,
    get: Base.prototype._get_bar__0_k$,
    set: Base.prototype._set_bar__a4enbm_k$
  });

Now we emit this code instead:
  Object.defineProperty(Base.prototype, 'bar', {
    configurable: true,
    get: function () {
      return this._get_bar__0_k$();
    },
    set: function (value) {
      this._set_bar__a4enbm_k$(value);
    }
  });

This fixes the issue where if we had a @JsExport'ed base class with a
public property overridden in a non-exported derived class, we couldn't
access that property from JS if we were given an instance of
the derived class.

#KT-41912 Fixed
2021-09-28 20:04:38 +03:00
Svyatoslav Kuzmich 841f5a583e [Wasm] Support wasm target in multiplatform plugin 2021-09-28 18:26:07 +03:00
Roman Artemev 070c64f9b5 [JS IR] Add descriptive error message for js("...") call
Report a message instead of NPE if `js("...")`` code couldn't be emitted
2021-09-28 18:15:57 +03:00
Roman Artemev 920daac0a2 [JS IR] Fix string literal folder in codegen for js("...") function
Support `val v = "S"` and plus (`v1 + v2`) cases

Fix KT-48941, KT-47360 and probably KT-42681
2021-09-28 18:15:55 +03:00
Roman Artemev f05c8ad953 [JS IR] Fix js("...") call checker in frontend.
Call mather relies on that BuiltIn package fragment implement specific
interface `BuiltInsPackageFragment` which was missed. Make sure that
BuiltIn module's package fragments implement that interface.

Fix progression optimizer symbols resolve in JS & WASM IR BE
2021-09-28 18:15:51 +03:00
Roman Artemev 18950feeff [JS IR] Add tests for KT-48941 2021-09-28 18:15:48 +03:00
Ilya Kirillov 7d4d035287 Analysis API: add validity assertions to diagnostics 2021-09-28 15:55:24 +03:00
Ilya Kirillov 9fd988d727 Analysis API: regenerate diagnostic classes 2021-09-28 15:55:22 +03:00
Ilya Kirillov 6c97393927 Analysis API: get rid of weak refs scheme for working with FIR internals for diagnostics 2021-09-28 15:55:19 +03:00
Ilya Kirillov d723916d67 Analysis API: get rid of weak refs scheme for working with FIR internals for KtScope 2021-09-28 15:55:18 +03:00