Commit Graph

297 Commits

Author SHA1 Message Date
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
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 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
Mikhail Glukhikh f8ca440e96 K2: resolve Java enum entries from the beginning (related to KT-59464) 2023-07-11 08:28:04 +00:00
Denis.Zharkov c3ac2e44a0 Adjust test data for enabling ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated
^KT-55388 Fixed
2023-05-15 10:43:19 +00:00
Mikhail Glukhikh abb58f1380 K2: unmute the test related to KT-48675 2023-04-27 09:16:44 +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
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
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
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
Denis.Zharkov c766f20554 FIR: Adjust override checker to definitely-not-nullable types
^KT-52201 Related
2022-05-19 16:54:05 +00:00
Denis.Zharkov be3c9ceacb FIR: Adjust FirTypeEnhancement test data 2022-05-19 16:54:02 +00:00
Ivan Kylchik 51ccc32a3f Update test data after introducing IntrinsicConstEvaluation annotation 2022-05-18 21:19:57 +03:00
Dmitriy Novozhilov 1a3841d66d [FIR] Properly enhance raw Class type in java annotations 2022-01-20 11:25:44 +03:00
Denis.Zharkov 46217318c0 FIR: Load final static constant Java fields as non-nullable 2021-11-26 19:39:48 +03:00
Dmitriy Novozhilov 9807c67ae4 [FIR] Properly collect overriddens for method enhancement
If some java class has multiple supertypes then we need to collect
  overriddens from all those types directly, even if superTypeScope
  (which is FirTypeIntersectionScope in this case) returns only
  one symbol from one of this types (not intersection one)

This is needed to proper enhancement in cases when some type occurs
  multiple times in supertypes graph with different nullability
  of arguments:

class ConcurrentHashMap<K, V> : AbstractMap<K!, V!>, MutableMap<K, V>

If we try to find method `get(key: K): V` supertype scope returns
  `AbstractMap.get(key: K!): V!` (because it actually overrides
  `MutableMap(key: K): V?`), but we need to get both symbols to
  properly enhance types for `ConcurrentHashMap.remove`
2021-11-22 17:01:17 +03:00
Roman Golyshev 9b9c51bc8d [FIR] Fix dispatch receivers on inner classes' constructors
1. Inner class constructor should have its outer class as a dispatch
receiver, since it is necessary for the call. Before it was null
2. Substituted inner class constructor should have its original dispatch
 receiver type with the proper substitution. Before it was set to the
 class itself (since the class was usually passed as a new dispatch
 receiver)

Also, modify FIR renderer, so it properly renders the dispatch receiver
of the constructors
2021-10-05 12:17:08 +00:00
Dmitriy Novozhilov 765b389875 [FIR] Mute failing test due to KT-48675 2021-09-13 13:53:14 +03:00
Dmitriy Novozhilov 5769d42248 [FIR] Fix all usages of annotations due to new FirAnnotation hierarchy 2021-09-13 13:53:12 +03:00
pyos 9bb7a29baa FIR: disregard enhancements for warnings
Warnings are not implemented yet, so don't produce errors either.
2021-09-06 13:11:16 +03:00
pyos a2e2545e3f FIR: update loadJava tests 2021-09-06 13:11:14 +03:00
pyos 5704dffdbe FIR: attach annotations to Java-converted cone types 2021-09-06 13:11:03 +03:00
Denis.Zharkov 4a9d4ed9fe Enable ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated since 1.7
^KT-36770 Fixed
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
Mikhail Glukhikh 020b6e9dd1 FIR Java: fix conversion of primitive type 2021-08-27 18:03:02 +03:00
pyos a12e31daf1 FIR: dump nested classes in loadJava tests
Because those test are single Java files, many of them use a top-level
class as a container for multiple classes to be tested. Such tests do
almost nothing if those nested classes aren't handled.
2021-08-27 18:03:01 +03:00
Victor Petukhov d730db094a Don't look at raw type's arguments while enhancing super types
^KT-48172 Fixed
2021-08-20 13:10:45 +03:00
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
Dmitriy Novozhilov dceb8b2991 [FIR] Don't render ! at the end of ConeFlexibleType 2021-03-11 13:10:05 +03:00