Commit Graph

732 Commits

Author SHA1 Message Date
Mikhail Glukhikh f33f87e3d4 K2: drop unused qualifier in FirJavaTypeRef 2022-12-20 11:04:27 +00:00
Mikhail Glukhikh 582b640bec K2: use MutableOrEmptyList for annotations storage in FIR elements 2022-12-20 11:04:25 +00:00
Ilya Kirillov 68a17242b3 [FIR] fix NPE on missing java annotations qualifier
^KTIJ-23075 fixed
2022-12-14 09:58:07 +00:00
Dmitriy Novozhilov d898e256ca [FIR] Don't update explicit delegated constructor calls of classes with @JvmRecord
^KT-54573 Fixed
2022-12-09 12:02:08 +00:00
Egor Kulikov dbfe33c00d [FIR] Make default values for value parameters lazy in RawFirBuilder
Sixth step for ^KT-52615

Merge-request: KT-MR-7926
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
2022-12-08 13:32:37 +00:00
Yan Zhulanow c8e9cfde0b [FE] Read Java static field initializer lazily (KTIJ-23043) 2022-12-08 10:46:43 +00:00
Egor Kulikov fb2485f83c [FIR] Make constructor delegate lazy in RawFirBuilder
Fifth step for ^KT-52615

Merge-request: KT-MR-7860
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
2022-12-02 03:12:51 +00:00
Yan Zhulanow fe69b21aed [FE] Fix 'containingClassForStaticMemberAttr' for fake overrides (KTIJ-22808) 2022-11-30 04:12:26 +00:00
Dmitrii Gridin 3bc9299b3b [FIR] SignatureEnhancement: drop redundant 'resolvePhase' for type parameter
^KT-54826
2022-11-24 18:32:45 +00:00
Dmitrii Gridin ec613e57ef [FIR] add Enhancement wrapping for type parameters
^KT-55095 Fixed
2022-11-24 18:32:43 +00:00
Ivan Kochurkin 8883de3f00 [FIR] Don't resolve Enum.declaringClass and Enum.getDeclaringClass
^KT-53946 Fixed
2022-11-23 18:29:29 +00:00
Ilya Kirillov 7781ad67d4 [FIR] introduce FirValueParameter.containingFunctionSymbol
^KT-55034 fixed
2022-11-22 18:25:30 +01:00
Artem Vasilev 02484baf07 [FIR] Set Java constructor source to Java class's when it's implicit
When there are no declared constructors in Java class, make
javaConstructor's source element point to the class declaration,
making it possible to navigate from constructor's invocation there.

^KTIJ-22360 Fixed
2022-11-17 13:18:30 +00:00
Dmitrii Gridin 86422d0944 [FIR] FirReceiverParameter: rename type to typeRef
^KT-54417
2022-11-17 09:50:17 +00:00
Dmitrii Gridin 22cfea5058 [FIR] introduce KtFakeSourceElementKind.ReceiverFromType
^KT-54417
2022-11-17 09:50:13 +00:00
Dmitrii Gridin be7d282974 [FIR] introduce FirReceiverParameter
^KT-54417
2022-11-17 09:50:09 +00:00
Ilya Kirillov 8dab560d6e [LL FIR] fix status resolution of static enum members
Before, BODY_RESOLVE phase were used for them but status may be unresolved.
This caused CCE on accessing resolved status for such static enum members.

Now, those declarations are created with the status of owning enum as the status is taken from that class.
2022-11-16 19:44:18 +00:00
Ilya Chernikov 8f18ab19f7 FIR: use serialization extension protocol correctly
otherwise the deserialization breaks on KLibs
2022-11-12 14:34:08 +01:00
Mikhail Glukhikh d4fc2248ff FIR: make class member helper names more consistent 2022-11-11 13:30:32 +00:00
Yan Zhulanow 0a8b9c821c [FE] Add missing 'ClassId' check in Kotlin class loading (KTIJ-23435)
'findKotlinClassOrContent()' does not really distinguish between
outer class names and package path components, so it might return
'foo/bar/Baz.Boo' for 'foo/bar/Baz/Boo'. Possibly because
 'findKotlinClassOrContent()' potentially returns a raw byte array,
 ClassId checking is supposed to be performed in
 'extractClassMetadata()'. For Java, it happens inside
 'FirJavaFacade.findClass()', yet for Kotlin the check was absent.
2022-11-11 11:28:37 +00:00
Ilya Kirillov 725ae1fc65 [Analysis API] separate non-class error types from class error types and add information about type qualifiers
it's needed for type printing in renderer
2022-11-11 11:59:55 +01:00
Denis.Zharkov 52eb535a7d FIR: Use platform specific overridability rules for platform members
^KT-54570 Fixed
2022-10-31 14:28:55 +00:00
Denis.Zharkov 7b15b28ee2 FIR: Properly support raw types in type parameter upper bounds
^KT-49345 Fixed
2022-10-31 14:28:52 +00:00
Denis.Zharkov 73cffa315d FIR: Do not re-initialize type parameter bounds for Java classes 2022-10-31 14:28:51 +00:00
Denis.Zharkov e5d2f4712a Minor. Reformat JavaTypeConversion.kt 2022-10-31 14:28:50 +00:00
Denis.Zharkov 5cc31114cd FIR: Support special scope for raw types
^KT-46369 Fixed
^KT-41794 Fixed
^KT-49351 Fixed
2022-10-31 14:28:50 +00:00
pyos 6c6d653e85 FE: don't lose annotations on Java primitive arrays
but only use them to enhance for warnings for now.

^KT-48861 Fixed
2022-10-26 09:33:40 +02:00
Nikolay Lunyak dd861515ad [FIR] KT-52157: Fix missing type parameter annotations 2022-10-20 13:08:11 +00:00
Dmitriy Novozhilov 8fbb605034 [FIR] Rename containingClass function to containingClassLookupTag
Since this function returns lookup tag instead of FirClass or symbol
  the old name may lead to misunderstanding
2022-10-19 11:09:34 +00:00
Dmitriy Novozhilov be3f8e7eb0 [FIR] Remove redundant opt-ins to ExperimentalStdlibApi in FIR modules 2022-10-19 11:09:33 +00:00
Dmitrii Gridin a0b814a1b6 [FIR] make FirPropertyAccessor#propertySymbol non-nullable
we need it to restore property accessor by property

^KT-54311
2022-10-17 14:59:42 +00:00
Dmitriy Novozhilov ee21c966e1 [FIR] Get rid of all usages of safeAs in FIR modules 2022-10-06 06:57:06 +00:00
pyos 5ba76ee757 FIR: convert Java type parameter bounds before reading annotations
This avoids a crash due to circular class references through annotation
arguments.
2022-10-04 19:48:15 +00:00
Dmitriy Novozhilov 6623456d2a [FIR] Properly support @JvmRecord
^KT-53867 Fixed
2022-10-03 15:48:17 +03:00
Dmitriy Novozhilov c0ad67c4f9 [FIR] Generate java declarations for record components of java records
^KT-53964 Fixed
2022-10-03 15:48:17 +03:00
Ilya Kirillov 9ac9bef20f [FIR] fix nested access to FirCache
it's forbidden by the contract and causes ISE "Recursive update" or deadlock in the IDE
2022-10-02 19:00:02 +02:00
Mikhail Glukhikh f68f06a93f FIR visibility checker: remove redundant session from isVisibleForOverriding 2022-09-29 08:34:14 +00:00
pyos 3a5d75fd22 K2: introduce platform-specific visibility checks for overrides + tests
Related to KT-53197
2022-09-29 08:34:13 +00:00
pyos ecdd80769e FIR: do not read a Java nested class if the outer class is Kotlin
Example: if C is a Kotlin class and there is an import of C.Companion.f,
a call to f will need to check if it is a constructor, for which
it will attempt to load C.Companion.f as a Java class. This involves
loading all outer classes, including C itself, as BinaryJavaClass - see
KotlinCliJavaFileManagerImpl - despite the fact that C and C.Companion
have both already been loaded from their Metadata annotations as Kotlin
classes, wasting cycles and polluting caches.

Thus the theoretical motivation for this change is to marginally speed
up FIR.

The real motivation is that with the -Xemit-jvm-type-annotations option,
kotlinc sometimes generates invalid annotations, and reading them with
BinaryJavaClass throws an exception (the Kotlin metadata however is
valid):

    // MODULE: lib
    // FILE: C.kt
    // The constructor has an argument of type
    //   List<? extends Function1<? super String, Integer>>
    // and a ParameterName type annotation with path
    //   TYPE_ARGUMENT(0), TYPE_ARGUMENT(0)
    // which is missing a WILDCARD between the two TYPE_ARGUMENTs
    class C(val x: List<(name: String) -> Int>) {
      companion object {
        fun foo() {}
      }
    }
    // MODULE: main(lib)
    // FILE: main.kt
    import C.Companion.f

    fun bar() = foo() // crashes FIR

The parameter annotation should obviously be fixed too, but invalid
bytecode may already exist in the wild. Also, did I mention that this
change marginally speeds up FIR?
2022-09-16 08:44:15 +00:00
Arseniy Terekhov 539e5f82e2 [FIR] DeprecationProvider: inline builder, fix named arguments, cosmetic 2022-08-19 07:37:55 +00:00
Arseniy Terekhov a80870bc8f [FIR] DeprecationsProvider: caching results 2022-08-19 07:37:54 +00:00
Arseniy Terekhov 25fc948d95 [FIR] DeprecationsProvider: make evaluation of deprecations on demand 2022-08-19 07:37:54 +00:00
Vsevolod Tolstopyatov 93f17a2b86 [FIR] Support static getters along with fake Enum.entries declaration in FIR
#KT-48872
2022-08-12 09:35:18 +00:00
Dmitriy Novozhilov fd4aafdb75 [Lombok K2] Support @Builder and @Singular annotations
^KT-46959 Fixed
2022-08-11 15:22:36 +03:00
Ilya Kirillov 0748f28efe [FIR] rename ensureResolve -> lazyResolveToPhase as it better describes function semantics 2022-08-10 22:49:18 +02:00
Mikhail Glukhikh 2598ecf23f Revert "K2: fix internal visibility checks for overrides #KT-53197 Fixed"
This reverts commit 166965e559.
2022-08-05 18:26:59 +02:00
Mikhail Glukhikh 166965e559 K2: fix internal visibility checks for overrides #KT-53197 Fixed 2022-08-03 07:52:14 +00:00
Victor Petukhov 7d945d9bdc [FIR] Support loading rxjava3 nullability annotations on bounded wildcards
^KT-53041 Fixed
2022-07-11 12:44:08 +00:00
Mikhail Glukhikh 730a5d1a88 FIR: introduce Java vs Kotlin class conflicts checker #KT-44441 Fixed 2022-07-04 13:28:58 +00:00
Ilya Kirillov da43062a46 [FIR] do not swallow PCE 2022-06-24 10:50:31 +02:00