Commit Graph

86305 Commits

Author SHA1 Message Date
Tianyu Geng 954926e0de FIR IDE: get containing symbol of KtTypeParameterSymbol
As part of this change, we now also allow HL API to get containing
symbol for any KtSymbols.
2021-09-29 22:24:26 +02:00
Tianyu Geng 7c3754f516 FIR IDE: output substitutor from checkExtensionIsSuitable 2021-09-29 22:24:26 +02:00
Tianyu Geng 18a23f26f5 FIR IDE: allow getting overridden symbols on any callable symbols
This way caller don't need to first check if the symbol is allowed to
override. The current API throws for cases like Java field, or enum
entry, which is not very user-friendly.
2021-09-29 22:24:26 +02:00
Tianyu Geng 54b32f6911 FIR IDE: allow get overriding symbols of members in anonymous object 2021-09-29 22:24:26 +02:00
Tianyu Geng 50166c776c FIR IDE: add KtClassInitializerSymbol 2021-09-29 22:24:26 +02:00
Tianyu Geng 6f9712a812 FIR IDE: get property as containing symbol for default accessors 2021-09-29 22:24:26 +02:00
Tianyu Geng 3b48103cd2 FIR IDE: Add API to get implicit receiver types at a position
This will be used in completion contribution.
2021-09-29 22:24:25 +02:00
Tianyu Geng 14452661cc FIR IDE: makes HL ref shortener tolerate missing type arg in type refs 2021-09-29 22:24:25 +02:00
Tianyu Geng 72a4687990 FIR IDE: fix KtFirNonStarImportingScope 2021-09-29 22:24:25 +02:00
Tianyu Geng 211544e790 FIR: rename FirResolvedImport.resolvedClassId|relativeClassName
These two fields references the parent of the import rather than the
classes that are imported. For example

```
import java.util.Map // resolvedClassId -> null
import java.util.Map.Entry // resolvedClassId -> java.util.Map
import java.util.Map.* // resolvedClassId -> java.util.Map
import java.util.Map.someStaticMethod // resolvedClassId -> java.util.Map
import kotlin.package.someTopLevelFuntion // resolvedClassId -> null
import kotlin.package.MyObject.someObjectFuntion // resolvedClassId -> kotlin.package.MyObject
```
2021-09-29 22:24:25 +02:00
Tianyu Geng e5b9d667c0 FIR IDE: collect snapshot of FirTowerDataContext for statements
ImplicitReceiverValue is mutable and FIR body resolve could alter it
while analysing code with smartcast. Hence, previously the IDE may see
inconsistent receiver values for a local scope. For example

```
open class A
interface Foo {
    fun foo()
}
fun A.bar() {
    if (this is Foo) {
        // scope here has implicit receiver type to be `A` rather than `it<A, Foo>`
    }
}
```

This change creates snapshots for local statements so later changes
during body resolve won't affect the collected context.
2021-09-29 22:24:25 +02: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
Ilya Gorbunov 47adc4fdaa Prolong -no-stdlib option lifetime and regenerate Gradle compilation options
-no-stdlib may still be required internally for kotlin gradle plugin
to launch the compiler with the correct options.
2021-09-29 21:46:52 +03:00
Ilya Gorbunov bd856ad726 Propagate option deprecation to options impl class
This is to avoid the new warning OVERRIDE_DEPRECATION that is reported
when a base method is deprecated and an overriding method is not.
2021-09-29 21:46:51 +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 ad20d78a63 Add necessary optIn arguments to FIR full pipeline tests 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 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