Commit Graph

610 Commits

Author SHA1 Message Date
Marco Pennekamp 5797b4877c [FIR/AA decompiler] Add tests for sealed interfaces
^KT-62895
2024-01-05 15:55:29 +00:00
Ivan Kylchik 79c300209e [K2] Avoid type check for Kotlin's property in ConstUtils
When we check Java field for constant initializer, we could
be asked to get and check the type of Kotlin's property that
is used in this Java field. But there is no guarantee that the type
resolve phase was finished and this type is available. So we just
check for `const` modifier and skip type check.

#KT-63752 Fixed
#KT-62558 Obsolete
#KT-61786 Declined
2023-12-12 13:54:32 +00:00
Ivan Kylchik 97ba3fe396 [K2] Revert changes done in KT-61786
Changes in this ticket remove type enhancement in java fields
for K2. But after KT-61920 fix, we can actually support it.
2023-12-12 13:54:31 +00:00
Nikita Bobko da8a8cc492 Revert "K2/Java: add private enum constructor for MPP matching"
Review: https://jetbrains.team/p/kt/reviews/13368/timeline

This reverts commit 2cea2b9098.

Motivation:
KT-62961 was fixed independently by two different commits:
- ac3d8ad3ac
- 2cea2b9098

If possible, it's better not to introduce implicit declarations.
That's why it was agreed to keep
ac3d8ad3ac and revert
2cea2b9098
2023-12-05 17:49:18 +00:00
Mikhail Glukhikh 1260d03561 Drop erroneous FirJavaConstructorBuilder.visibility
Related to KT-62961
2023-11-28 13:30:26 +00:00
Mikhail Glukhikh 2cea2b9098 K2/Java: add private enum constructor for MPP matching
#KT-62961 Fixed
2023-11-28 13:30:26 +00:00
Mikhail Glukhikh af58b30e5f K2 Java: fix 'value' annotation constructor parameter type to Array<out>
#KT-61100 Fixed
2023-10-31 22:13:10 +00:00
Mikhail Glukhikh 4ed7504d87 FIR deserializer: apply attributes on type parameter-based types
#KT-62578 Fixed
2023-10-18 10:30:31 +00:00
Ivan Kochurkin 498f2e534a [FIR] Don't enhance Int and String Java final static fields
It's effectively a breaking change (^KT-62558)

K2 assigns flexible type to all static fields (from Java) and, for example,
`String? becomes String unlike K1. It affects IR signature generating.
That's why signature dump is disabled for some tests.

^KT-57811 Fixed
^KT-61786 Fixed
2023-10-16 17:16:56 +00:00
Kirill Rakhman ff812197a8 [Test] Update test data after changes to FIR rendering 2023-09-21 14:02:21 +00:00
Kirill Rakhman 5b4409e34c [FIR] Store abbreviated type in deserialized declarations as attribute
#KT-58542 Fixed
2023-09-20 09:31:29 +00:00
Kirill Rakhman 4e041494be [FIR] Report DEPRECATION when Java declaration is deprecated in javadoc
#KT-60682
2023-08-31 10:19:33 +00:00
Nikolay Lunyak c2ad475153 [FIR] Render outer type parameters differently 2023-08-04 11:20:40 +00:00
Kirill Rakhman 38a54549ff [FIR] Fix serialization of empty varargs in annotations in KLIBs
#KT-59249 Fixed
2023-08-01 15:31:18 +00:00
Mikhail Glukhikh f8ca440e96 K2: resolve Java enum entries from the beginning (related to KT-59464) 2023-07-11 08:28:04 +00:00
Kirill Rakhman ee91ee9403 [FIR] Set publishedApiEffectiveVisibility on deserialized declarations
#KT-58641 Fixed
2023-06-21 07:34:29 +00:00
Kirill Rakhman 8ff67218f5 [FIR] Fix serialization of annotation vararg arguments
#KT-58937 Fixed
2023-06-14 08:41:27 +00:00
Dmitriy Novozhilov 6521729466 [Test] Update dumps of fir metadata where it differs on different platforms 2023-06-07 10:58:01 +00:00
Dmitriy Novozhilov 357c552b5f [Test] Set JVM target backend for load compiled tests which use JDK classes 2023-06-07 10:58:01 +00:00
Kirill Rakhman d1ce55cbd2 [FIR2IR] Fix infinite loop between annotation and annotation parameter
When an annotation constructor value parameter is annotated with the
very same annotation, FIR2IR went in an infinite loop when trying
to generate it.
To fix this, the constructor is added to the Fir2IrDeclarationStorage
cache before generating the value parameters.
To accommodate for the missing parameters, the value arguments count
is determined using the FIR.
2023-05-30 15:53:12 +00:00
Kirill Rakhman 80d68fc908 [FIR] Deserialize reference to typealias from metadata as fully expanded
#KT-58335 Fixed
2023-05-16 09:20:57 +00:00
Denis.Zharkov c3ac2e44a0 Adjust test data for enabling ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated
^KT-55388 Fixed
2023-05-15 10:43:19 +00:00
Leonid Startsev c4255f9a9e [K2] Instantiation of annotations having default values for properties
This commit adds missing pieces for the puzzle:

Annotation instantiation feature uses IrProperty's initializer to instantiate
properties from other modules that have default values which weren't
specified on call site.

To support this feature properly, Fir2IrVisitor should fill LazyIrProperty's
backing field initializer with information from Fir.

To get this information into Fir, FirMemberDeserializer should be able to read
it from KotlinJvmBinaryClass with AnnotationLoaderVisitorImpl. (klibs are unsupported for now)

There's a catch with enum entries references: we can't access session.SymbolProvider to resolve it
because we're still at the deserialization stage, and it can cause StackOverflow if enum is nested in the
same class (see RequiresOptIn.Level). To mitigate this, a new FirEnumEntryDeserializedAccessExpression is produced
instead; it is later replaced with the correct reference in the Fir2IrVisitor.

^KT-58137 Fixed

Also add test to loadJava folder with annotations default values that
verifies metadata loading
2023-05-12 16:08:02 +00:00
Kirill Rakhman e7bad26a4c [FIR] Unmute test for #KT-58080 2023-05-10 09:01:21 +00:00
Dmitriy Novozhilov af60681705 [FIR] Save declarations in metadata in source order
^KT-54792 Fixed
^KT-54801
^KT-54800
2023-05-09 07:36:32 +00:00
Kirill Rakhman bd9f36ad01 [FIR] Move type parameter scope above member and static scopes in tower
This fixes a false positive TYPE_PARAMETER_IS_NOT_AN_EXPRESSION when
a type parameter and some member, static or companion declaration have
the same name and referred to inside a class.

#KT-58028 Fixed
2023-04-27 13:59:13 +00:00
Mikhail Glukhikh abb58f1380 K2: unmute the test related to KT-48675 2023-04-27 09:16:44 +00:00
Mikhail Glukhikh f6bf7560a6 K2: fix field annotation handling around serialization
#KT-57135 Fixed
2023-04-25 12:18:27 +00:00
Dmitriy Novozhilov 92ab82b2f3 [Test] Remove duplicating testdata files 2023-04-19 18:41:21 +00:00
Dmitriy Novozhilov 6287968511 [FIR Test] Migrate AbstractFirLoadCompiledKotlin to new test infrastructure
Also introduce two different modes for those tests:
- load metadata compiled with K1
- load metadata compiled with K2
2023-04-19 14:33:25 +00:00
Dmitriy Novozhilov e94a64a4f2 [FE Test] Move FIR dumps for LoadCompiledKotlin tests close to original testdata 2023-04-19 14:33:24 +00:00
Dmitriy Novozhilov de33a21fd1 [FE Test] Rename nested directory in testdata into nestedClasses
This is needed to avoid clash between generated test class `Nested` and
  `@Nested` annotation from JUnit 5
2023-04-19 14:33:24 +00:00
Denis.Zharkov 38138bf079 K2: Fix bounds erasure for raw types
Basically, this commit reworks eraseToUpperBound* stuff
Instead of a bunch of vague flags, we introduce two modes
(rawTypes/intersection emptiness checker) which defined those flags.

Also, it makes choosing `eraseArgumentsDeeply` option always because
that how it works in K1 and also use invariant projection inside
`eraseArgumentsDeeply` for raw types for the same reason.

^KT-57198 Fixed
2023-03-21 12:38:22 +00:00
Kirill Rakhman 9268fd0e87 [FIR] Call enum entries in deserialized annotations as property access
KT-56177
2023-02-28 10:19:15 +00:00
Dmitriy Novozhilov 244dbb37cf [FIR] Properly set isOperator flag for java functions
^KT-56875 Fixed
2023-02-28 09:17:40 +00:00
Dmitriy Novozhilov 259303ca50 [FIR] Fix loading of classId for nested enums in java annotation arguments
^KT-55887 Fixed
^KT-55976
2023-01-17 14:51:29 +00:00
Denis.Zharkov cd0d6d2773 Adjust test data for postponing ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated
^KT-55357 Related
^KT-36770 Related
2022-12-12 11:39:04 +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 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
Nikolay Lunyak dd861515ad [FIR] KT-52157: Fix missing type parameter annotations 2022-10-20 13:08:11 +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
Simon Ogorodnik 8bdb8ba232 K2: Fix type-alias expansion during suspend function type serialization
When suspend function type is serialized, there is special logic that
adds Continuation parameter, before doing so, type-aliases has to be
expanded, attributes for resulting type should also derive from
expanded type

KT-53193, KT-54062
2022-09-16 20:42:03 +00:00
Ivan Kochurkin 6c4dafc23c Disable IgnoreNullabilityForErasedValueParameters for indefinite time, ^KT-53751 Fixed 2022-09-13 16:45:06 +00:00
Mikhail Glukhikh d3648bce0c Run LoadJava.CompiledKotlin test group with stdlib if some enum is inside
This commit makes compiler tests working similarly to ResolveByStub IDE tests.
2022-08-19 10:08:11 +00:00
Mikhail Glukhikh 7333589663 K1/K2: add Enum.entries unconditionally and filter them out in tower
Before this commit, we added Enum.entries only in case when
LanguageFeature.EnumEntries was ON (with an exception in K1/Java case).
In this commit we add Enum.entries unconditionally, and in case
the language feature is OFF we filter them out during tower resolve.
2022-08-12 09:35:27 +00:00
Vsevolod Tolstopyatov 0a5b3f1e13 [JVM IR] Adjust testData to address new static Enum.entries member 2022-08-12 09:35:26 +00:00
Victor Petukhov 42e71f8c53 Remove explicit enabling the new type inference from test data 2022-07-22 16:03:52 +00:00
Mikhail Glukhikh 38f4a35be2 FIR: introduce flexible types pretty rendering for no arguments case
#KT-52020 Fixed
2022-06-29 16:50:05 +00:00
Ilya Chernikov bb996c1b27 Switch kotlin version to 1.8
with appropriate fixes in testdata, tests and other
places.
2022-06-29 10:20:30 +02:00
Alexander Udalov 08f18c2940 Fix metadata deserialization for context receivers with type table
In DeserializedClassDescriptor and MemberDeserializer, only the
`contextReceiverTypeList` field was used, and not
`contextReceiverTypeIdList` which is used when `-Xuse-type-table` is
enabled. The convention is to use a bunch of utilities declared in
`protoTypeTableUtil.kt` which deal with both methods of reading types.
Also, simplify the deserialization code in FIR (which was correct for
some reason).
2022-06-15 16:45:30 +02:00