Commit Graph

14631 Commits

Author SHA1 Message Date
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
Roman Artemev 882016c22f [IR] Add tests for KT-47342 2021-09-30 15:42:03 +03:00
Alexander Udalov dbd28142d0 Fix callable reference adaptation for vararg in fake override
`mappedVarargElements` are populated with parameters from
`argumentMapping`, which is computed using `ArgumentsToParametersMapper`
which calls `original` on all value parameters (see
ArgumentsToParametersMapper.kt:136).

So the code that adds empty lists for unassigned vararg parameters
should also call `original`. Otherwise, in the added test, we ended up
with two arguments for the parameter `s` in `id(::base1)`, one for
`Base.s` containing the correct value, and another for `Derived.s`
containing the empty list. Psi2ir took the last one, which resulted in
empty array being passed to the vararg parameter.

Note that all of this is caused by the fact that `original` of a fake
override parameter is the parameter of the base function. This seems
suspicious because `original` of a fake override _function_ is that fake
override itself (NOT the base function), but this would probably be very
risky to change at this point.

 #KT-48835 Fixed
2021-09-30 14:08:38 +02:00
Alexander Udalov 9857af7823 Psi2ir: fix function type check for fun interface conversion
Parameter of a synthetic SAM adapter always has a function type (not a
subtype). Checking for the subtypes broke the case from KT-46908, where
fun interface is itself a subtype of a function type.

 #KT-46908 Fixed
2021-09-30 14:07:07 +02:00
Alexander Udalov e6a160e115 Minor, uncomment passing IR text test 2021-09-30 14:07:07 +02:00
Mikhail Glukhikh d3662b48a2 FIR: fix OPT_IN_MARKER_ON_WRONG_TARGET (setter via parameter case)
This commit fixes FIR bootstrap compilation
2021-09-30 14:58:14 +03:00
Alexander Udalov aa247726b6 Prohibit using old JVM backend with LV >= 1.6
#KT-48928 Fixed
2021-09-30 13:56:34 +02:00
Roman Artemev f644f47360 [IR] Add test for KT-47767 2021-09-30 14:39:01 +03:00
Denis.Zharkov f7ef551f99 Report warnings on overrides with wrong types nullability
^KT-48899 Fixed
2021-09-30 14:36:26 +03:00
Alexander Udalov b821b26cfe JVM IR: do not try to optimize casts in TypeOperatorLowering
In case the cast value is used as a receiver to a private method call,
the cast is actually necessary, see KT-48927. Also, this optimization
has backfired once already (see kt48659_identityEqualsWithCastToAny.kt).
It seems that the best way to optimize these casts is not to generate
them in the first place, and/or use bytecode postprocessing.

Apparently the only kind of casts which need to be eliminated are those
which occur on an inline class to its supertype. Otherwise the
unsafe-coerce intrinsic is inserted at the incorrect place, and several
tests fail (uncastInlineClassToAnyAndBack.kt, genericOverride.kt,
classGenericOverride.kt).

 #KT-48927 Fixed
2021-09-30 13:32:36 +02:00
Ilya Kirillov 451464d635 FIR: do not leak ConeTypeVariableType via diagnostics
ConeTypeVariableType is an internal part of type inference
and should not be leaked outside it
2021-09-30 01:45:57 +03:00
Jinseong Jeon aad02c1259 FIR LC: introduce modifier list for members
to simulate `default` modifier of methods in interface
2021-09-29 22:02:48 +02:00
Ilya Gorbunov ec5c06238d Split language and api version lifetimes, restore apiVersion 1.3 support
KT-49007
2021-09-29 21:46:53 +03:00
Dmitriy Novozhilov 7917e511ed [FE 1.0] Disable INTEGER_OPERATOR_RESOLVE_WILL_CHANGE warning by default
Also remove sinceVersion parameter from
  ApproximateIntegerLiteralTypesInReceiverPosition language feature

^KT-48992 Fixed
2021-09-29 21:23:22 +03:00
Mikhail Glukhikh 212c3e8d51 FIR: fix OPT_IN_MARKER_ON_WRONG_TARGET for constructor properties 2021-09-29 19:39:28 +03:00
Mikhail Glukhikh e9bff861dd FIR: report OPT_IN_MARKER_ON_OVERRIDE diagnostic
This diagnostic works in accordance with KT-45844 and KT-49002
2021-09-29 19:39:27 +03:00
Mikhail Glukhikh 11459aced6 Replace UseExperimental with OptIn in BB builder inference tests 2021-09-29 19:39:26 +03:00
Mikhail Glukhikh ac3b738d9b FIR: report OPT_IN_OVERRIDE(_ERROR) diagnostics 2021-09-29 19:39:25 +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
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 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
Dmitry Petrov 86b3ea09c2 JVM_IR handle @EnhancedNullability types in null check simplification 2021-09-29 19:14:38 +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
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
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
Ilya Kirillov 7045e3ee45 Unmute passing FIR LC test 2021-09-28 14:19:15 +02:00
Dmitriy Novozhilov de7fb9606a Migrate all JDK 9 related tests to JDK 11 2021-09-28 13:01:47 +03:00
Dmitriy Novozhilov ce3562f0e8 Migrate all JDK 15 related tests to JDK 17 2021-09-28 13:01:45 +03:00
Mikhail Glukhikh 363680e4c9 Delay abstract class member forbiddance (see KT-45508) to 1.7 2021-09-28 11:17:42 +03:00
Ivan Kylchik cc934d9574 Support arguments' evaluation of primitive arrays in fir2ir transformer 2021-09-27 17:45:01 +03:00
Svyatoslav Kuzmich 5c05ff48ff [Wasm] Copy property reference lowering from K/N 2021-09-27 17:07:39 +03:00
Victor Petukhov ee728b6902 Use the new type inference for top-level callable reference resolution
^KT-47797 Fixed
^KT-47987 Fixed
^KT-45034 Fixed
^KT-48446 Fixed
^KT-13934 Fixed
2021-09-27 16:12:27 +03:00
Nikolay Lunyak 1a9f63efeb [FIR] Fix INSTANCE_ACCESS_BEFORE_SUPER_CALL 2021-09-24 16:50:51 +00:00
Dmitry Petrov be28b3c74d JVM_IR KT-29822 KT-48669 loop over unsigned array, indices, withIndex 2021-09-24 12:12:42 +03:00