126 Commits

Author SHA1 Message Date
Dmitriy Novozhilov a4e8be8687 [FIR] Deserialize enum entries access in annotations into FirEnumEntryDeserializedAccessExpression
^KT-64975 Fixed
^KT-62900
2024-01-25 15:55:19 +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
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
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
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
Mikhail Glukhikh f6bf7560a6 K2: fix field annotation handling around serialization
#KT-57135 Fixed
2023-04-25 12:18:27 +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
Nikolay Lunyak dd861515ad [FIR] KT-52157: Fix missing type parameter annotations 2022-10-20 13:08:11 +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
Ivan Kylchik 51ccc32a3f Update test data after introducing IntrinsicConstEvaluation annotation 2022-05-18 21:19:57 +03:00
Vladimir Dolzhenko 918a91dbdf Escape special names with backticks in test data
#KT-51248
2022-02-10 21:20:47 +00:00
Leonid Startsev 767c570af4 Load default values for annotation members from classfiles
so that defaults are available to synthetic implementations.

#KT-48181 Fixed

Implementation is for JVM IR; other backends & FIR need to be supported
separately.
2021-12-07 10:10:04 +00:00
Denis.Zharkov d91155558b Rename LF: DefinitelyNotNullTypeParameters -> DefinitelyNonNullableTypes 2021-08-31 15:41:17 +03:00
Denis.Zharkov 62bef48f9d Adjust test data to changed rendering: T!! -> T & Any
^KT-26245 In Progress
2021-08-31 15:41:15 +03:00
Denis.Zharkov 302eacbf59 Support new form of definitely non-nullable types: T & Any
^KT-26245 In Progress
2021-08-31 15:41:11 +03:00
Dmitriy Novozhilov aec13defc4 [Test] Add proper annotation target in SupertypesAndBounds test 2021-04-14 18:30:55 +03:00
Ting-Yuan Huang 6c989bfd4b Support array of annotation in KotlinJvmBinaryClass
KotlinJvmBinaryClass.AnnotationArrayArgumentVisitor didn't cover the
case when the element type is an Annotation. Therefore, when the
compiler read an array of annotations from JVM binary classes built from
Kotlin sources, it got an empty array regardless of what was written in
the bytecode.

For example, Foo.value below is read as an empty array when SomeClass
resides in another Kotlin module.

  @Foo(
    value = [Bar(1), Bar(2)]
  )
  class SomeClass
2021-04-14 13:14:26 +02:00
Denis.Zharkov 30eb9ad32f Add serialization/deserialization of definitely-not-null types
^KT-26245 In Progress
2021-04-09 13:06:31 +03:00
Dmitriy Novozhilov f3a8fcaea6 [FE] Make constructors of sealed classes protected instead of internal 2021-02-12 13:36:38 +03:00
Ilya Gorbunov 87e130e77a Remove obsolete diagnostics suppression
The diagnostic NON_PUBLIC_PRIMARY_CONSTRUCTOR_OF_INLINE_CLASS is now
obsolete because internal constructors of inline classes became allowed.
2021-02-03 18:23:53 +03:00
Dmitriy Novozhilov ee1aff1012 [Test] Update different testdata according to changes in sealed classes 2021-01-28 13:19:29 +03:00
Ilmir Usmanov 129de76288 Value classes: Generate @JvmInline annotation for inline classes
but not for value classes.
Since inline classes and value classes share the same flag, we use
presence of the annotation to distinguish them.
2020-12-01 23:45:47 +01:00
Ilmir Usmanov ca3e7cf1a7 Value classes: Report lacking @JvmInline only on JVM backend
Report when @JvmInline is applied on non-value class.
2020-11-27 23:52:07 +01:00
Mads Ager 98f5c5aa95 JVM_IR: Preserve annotations on inline class replacement methods. 2020-01-03 16:44:50 +01:00
Steven Schäfer 917ef250cf Add and (un)mute inline class tests 2019-06-13 12:25:06 +02:00
Mads Ager dc5f4ab240 Add annotation to static methods on DefaultImpls. 2019-05-29 15:37:09 +02:00
Mads Ager 5be0bd4a56 JVM_IR: Enable loadJava tests 2019-05-29 13:10:47 +02:00
Alexander Udalov be66591a4f Minor, fix test data for PublishedApi on inline class constructor
PublishedApi is not available at runtime because it has BINARY
retention. Probably this test should check some other RUNTIME-retained
annotation
2018-10-31 17:25:12 +01:00
Alexander Udalov c1ab08c8ce Refactor KClassValue to store ClassLiteralValue internally
Only invariant array projections and non-null element types will be
supported soon (see KT-26568), so it makes no sense to store the
complete type in KClassValue. What we need is only the ClassId of the
class, and the number of times it's wrapped into kotlin/Array, which is
exactly what ClassLiteralValue represents.

This change helps in decoupling annotation values from
descriptors/types. The only constant value that depends on descriptors
is now AnnotationValue.

 #KT-26582 Fixed
2018-10-25 16:27:23 +02:00
Dmitry Petrov 88fb76bffc Fix annotations loading for inline class constructors 2018-09-14 16:09:41 +03:00
Dmitry Petrov 792c5f8b3f Generate metadata and annotations for hidden constructor
Reflection expects to see a callable method for a hidden constructor,
thus, it should be a synthetic accessor.
JVM method signature in metadata should point to the synthetic accessor.
Annotations for hidden constructor should be written on the synthetic
accessor.
2018-09-12 15:33:11 +03:00
Alexander Udalov 06ce0cb0f0 Fix deserialization of default property accessor flags
In MemberDeserializer.loadProperty, we incorrectly passed 0 to
getAnnotations when loading annotations on property accessors in case
the protobuf field getter_flags/setter_flags was not present. The
correct behavior, as described in metadata.proto, was to pass a special
"default accessor flags" value, constructed from the main property
flags. Otherwise in case there were annotations both on the property and
on the accessor (as in PropertyAndAccessor.kt) and the accessor was
otherwise default, we would assume that it had no annotations and would
not load them in compiler and reflection

 #KT-25499 In Progress
2018-09-07 11:49:41 +03:00
Alexander Udalov f90303315d Support array class literals in annotation serializer/deserializer
Note that this change brings an incompatibility: `Array<Foo>::class`
will be seen as `Foo::class` by the old deserializer. We consider this
OK because the compiler never had any logic that relied on reading class
literal arguments correctly (otherwise it wouldn't have worked because
it could only see `Array<*>::class` before this commit), and the support
of annotations on types in JVM reflection is only available in the
upcoming 1.3 release (KT-16795)

 #KT-22069 Fixed
2018-09-06 14:40:06 +03:00
Ilya Chernikov fd0eb6ee34 Implement support for class literals as annotation arguments...
on deserialization and reflection
2018-08-31 15:17:51 +03:00
Dmitry Petrov 8f103dd8e5 Fix ConstantValue-related testData for loadJava tests 2018-07-24 10:52:16 +03:00
Alexander Udalov 965e3ebab2 Do not serialize SOURCE-retained annotations
Also, fix the value of "hasAnnotations" flag to reflect if there are any
_non-source_ annotations on a declaration.

Unfortunately, after this change
IncrementalJsCompilerRunnerTestGenerated$PureKotlin.testAnnotations
starts to fail because of the following problem. The problem is that
annotations on property accessors are not serialized yet on JS (see
KT-14529), yet property proto message has setterFlags field which has
the hasAnnotations flag. Upon the full rebuild of the code in that test,
we correctly write hasAnnotations = true, but annotations themselves are
not serialized. After an incremental build, we deserialize property
setter descriptor, observe its Annotations object which happens to be an
instance of NonEmptyDeserializedAnnotationsWithPossibleTargets. Now,
because annotations itself are not serialized, that Annotations object
has no annotations, yet its isEmpty always returns false (see the code).
Everything worked correctly before the change because in
DescriptorSerializer.hasAnnotations, we used Annotations.isEmpty and the
result was the same in the full rebuild and in the incremental scenario.
But now we're actually loading annotations, to determine their
retention, and that's why the setterFlags are becoming different here
and the test fails

 #KT-23360 Fixed
2018-04-23 18:42:33 +02:00
Alexander Udalov f2be34ca1c Support KClass<*> annotation arguments in serialization/deserialization
#KT-11586 Fixed
2017-10-23 19:16:44 +02:00
Alexander Udalov e42b151561 Support primitive array annotation arguments in ConstantValueFactory
This has no visible consequences at the moment, but will help once we
need to load such argument from some annotation in the compiler in the
future
2017-06-27 14:53:39 +03:00
Alexander Udalov 33e9e660c4 Fix JvmRuntimeDescriptorLoaderTestGenerated
- Use FULL_JDK instead of mock JDK in some tests because mock JDK is
  created from JDK 6 and full JDK is now JDK 8, so there are differences
  in the behavior in the compiler and at runtime
- Remove some '*.runtime.txt' files which were workarounds to JDK 6
  reflection issues regarding generic inner classes; code in these tests
  is now loaded exactly the same in the compiler and at runtime
- Change supertype in SupertypesAndBounds.kt: the class in the supertype
  is not relevant to that test, it checks that annotations can be loaded
  on types
2017-03-20 18:46:05 +01:00
Stanislav Erokhin ab53978793 Allowed ast access for some tests. 2016-12-16 00:57:04 +03:00
Valentin Kipyatkov ec51076355 DescriptorRenderer to render annotations for all types + separate option to render annotation arguments + use it in IdeDescriptorRenderers 2016-10-11 23:38:54 +03:00
Denis Zharkov d0acb3674a Fix rendered testData
New members in enum member scope
2016-05-16 15:38:13 +03:00
Mikhail Glukhikh 4c03aaabd4 Implicit nothing / intersection types are now checked also for member functions #KT-11666 Fixed 2016-03-31 11:59:17 +03:00
Alexander Udalov 1b8f934b54 Delete deprecated enum 'values' property 2016-02-19 22:28:44 +03:00
Denis Zharkov 4cf1393e81 Minor. Render annotations on type parameters 2016-01-22 19:17:22 +03:00