Commit Graph

535 Commits

Author SHA1 Message Date
Denis.Zharkov
8f484fcf88 Fix propagation of definitelyNotNull types from overrides 2021-07-29 19:45:57 +02:00
Mikhael Bogdanov
7cbd6908f9 Update test affected by ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated feature 2021-07-29 19:45:53 +02:00
Dmitriy Novozhilov
7008f02962 [FIR] Create fir classes for java annotations and enums with Final modality 2021-07-20 10:33:34 +03:00
Dmitriy Novozhilov
955c506294 Update load java testdata with type use annotations 2021-07-08 13:29:21 +03:00
Dmitriy Novozhilov
4d4d3a998b [FIR] Update load java testdata according to new sealed modifier 2021-07-08 13:29:20 +03:00
Mikhail Glukhikh
c33608e009 FIR: don't render resolved type annotations in favor of attributes 2021-06-09 15:42:43 +03:00
Denis.Zharkov
18e93b50d9 FIR: Fix loading read-only collection Java types with incorrect variance 2021-06-07 15:25:56 +03:00
Victor Petukhov
8dd71ec5c8 Build recursive raw types and raw types which contain type parameters properly
1) Substitute erasure of other type parameters
2) Use star projection at top level for recursive raw types

^KT-46126 Fixed
2021-04-30 10:49:47 +03:00
Mark Punzalan
9cf5ac1fbd FIR: Render "?" on nullable function types. 2021-04-26 15:11:37 +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
dceb8b2991 [FIR] Don't render ! at the end of ConeFlexibleType 2021-03-11 13:10:05 +03:00
Dmitriy Novozhilov
65ea4e184a [FIR] Fix enhancement of FlexibleNullability and EnhancedNullability
- Add utilities to add new attribute to ConeAttributes
- Get rid of FlexibleNullability attribute (it can be easily inferred
    for any flexible type at any moment)
- Fix determining of EnhancedNullability attribute
2021-03-11 13:10:04 +03:00
Denis.Zharkov
45018ea468 FIR: Rework loading overrides of special built-in methods from Java
Some of the changed data is correct, but some diagnostics are incorrect
Corner cases like having both contains(Object) and contains(String)
within implementation of Collection<String> is not supported
2021-02-20 10:59:21 +03:00
Alexander Udalov
899f75466d Remove tests on kotlin-annotations-android
#KT-44815
2021-02-15 17:23:44 +01: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
Mikhail Glukhikh
94e613dd01 FIR: support custom annotation-based type attributes 2021-01-23 10:56:42 +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
Jinseong Jeon
fc7f589caa FIR Java: record Java types with flexible nullability 2020-11-18 13:06:46 +03:00
Jinseong Jeon
46cc01602e FIR2IR: add implicit NOT_NULL cast if needed 2020-10-22 10:51:20 +03:00
Mikhail Glukhikh
44ebec05bb FIR Java: support read of field constant initializers 2020-10-02 08:57:39 +03:00
Denis Zharkov
9914b487b7 FIR: Do not load hashCode/toString/equals methods from Java interface
As it's done in FE 1.0, and there are subtle semantics in the language that depends on it
2020-10-01 17:49:02 +03:00
Dmitriy Novozhilov
4ef57c120f [FIR] Consider variance of type parameters during java type enhancement
#KT-41940 Fixed
2020-09-24 15:43:20 +03:00
Dmitriy Novozhilov
bc1fa8ed7f [FIR] Add constructor for java annotations 2020-08-04 08:59:14 +03:00
Ivan Kylchik
dcae6f1415 [FIR] Support when exhaustiveness for java enum
The problem appear because for java enum its entries was represented by
FirJavaField. To fix this FirEnumEntry was used

#KT-39621 Fixed
2020-07-09 23:49:54 +03:00
Denis Zharkov
4d484dd971 FIR: Support java array in type argument
^KT-37321 Fixed
2020-06-03 10:43:37 +03:00
Alexander Udalov
4520e02bae Support fun interfaces in kotlinx-metadata
#KT-37421 Fixed
2020-05-27 23:29:12 +02:00
Dmitriy Novozhilov
3acb64c536 [FIR] Add flexible default upper bound for java type parameters 2020-03-27 10:17:12 +03:00
Dmitriy Novozhilov
7bfe7061e7 [FIR] Add proper nullability for java enums 2020-03-20 23:11:28 +03:00
Denis Zharkov
e1312a752a FIR: Allow a field override another field with the same name 2020-03-17 16:33:48 +03:00
Mikhail Glukhikh
e051251b27 FIR: set isOperator only for Java methods with appropriate names
#KT-35133 Fixed
2020-02-19 18:09:04 +03:00
Denis Zharkov
2ad8488e6a FIR: Rewrite Java type mapping
Previoisly, there were two places where mapping had happened:
- toConeKotlinTypeWithNullability
- enhancePossiblyFlexible

The first one was used for supertypes and bounds and the second one
was used for other signature parts

The main idea is to perform type mapping once to a flexible type,
and then use it as it's needed (it's lower bound, or for the further ehnancement)

Also, this commit fixes flexibility for type arguments, see the tests
2020-02-19 15:53:34 +03:00
Denis Zharkov
95b4fa4b31 FIR: Support flexible types in getErasedVersionOfFirstUpperBound 2020-02-12 16:05:11 +03:00
Mikhail Glukhikh
91b432b4a1 [FIR] Java super-type arguments are now handled as flexible 2020-02-03 16:45:19 +03:00
Alexander Udalov
3c4e5d7615 Fix JvmFieldInInterfaceCompanion.kt for language version 1.4
Since 1.4, constant value is no longer written to the class file (and
thus cannot be read) for non-const properties. But in sources,
corresponding property descriptors still have the initializer which is
rendered to text. Therefore we disable the source-vs-binary check and
update the test data to check the new behavior.
2020-01-17 20:35:46 +01:00
Alexander Udalov
de683c0768 JVM IR: mute more tests after advancing language to 1.4 2020-01-17 12:47:20 +01:00
Mads Ager
98f5c5aa95 JVM_IR: Preserve annotations on inline class replacement methods. 2020-01-03 16:44:50 +01:00
Dmitriy Novozhilov
5dfe100ae5 Allow use reference to reified type parameters in contracts since 1.4 2019-12-26 17:43:28 +03:00
Dmitriy Novozhilov
f083edfac2 Allow contracts on final non-override members since 1.4 2019-12-26 17:43:27 +03:00
Denis Zharkov
e89c777fc6 FIR: Create DefinitelyNotNull only for annotated types 2019-12-10 14:21:21 +03:00
pyos
e4b1599457 JVM_IR: do not erase constant non-static field initializers...
...unless in 1.4 mode.
2019-11-29 16:49:52 +01:00
Denis Zharkov
f659dc0bea FIR: Add synthetic values/valueOf methods to Java classes 2019-11-27 11:20:52 +03:00
Mads Ager
8d5e5210a6 JVM_IR: Copy annotations to suspend function views. 2019-11-26 21:00:50 +03:00
Dmitriy Novozhilov
950d1f4fe4 [FIR] Fix enhancement of java array type 2019-11-19 10:43:46 +03:00
Mikhail Glukhikh
bd70daa3d1 FIR Java: use definitely not-null types for type parameters
We support & use ConeDefinitelyNotNullType more properly here
2019-11-14 19:10:59 +03:00
Alexander Udalov
57a674e9e6 Make fast class files reading mode default in compiler tests
This makes sense because this mode is the default in the production
compiler. Forgetting to enable it where necessary led to different
bizarre test failures, see for example changes around 3fee84b966 and
KT-34826
2019-11-11 15:40:49 +01:00