Commit Graph

2811 Commits

Author SHA1 Message Date
Nikita Bobko 4f3ecedbca [FE] Stop ignoring ABSTRACT_MEMBER_NOT_IMPLEMENTED for expect classes
^KT-59739 Fixed
Review: https://jetbrains.team/p/kt/reviews/11038/timeline
2023-07-24 09:15:11 +00:00
Pavel Kunyavskiy d797505f06 [K/N] Drop merging forward and real declaration in deserializer
^KT-59643
2023-07-24 08:24:20 +00:00
Vladimir Dolzhenko 4a7aea0dc6 Change the order of final properties initialization and ctor
To avoid case with NPE due to race-condition on publishing
non-fully initialized object in ctor via
`TypeRefinementSupport.Enabled(this)`

#KT-59852

Merge-request: KT-MR-10917
Merged-by: Vladimir Dolzhenko <Vladimir.Dolzhenko@jetbrains.com>
2023-07-03 10:51:53 +00:00
Ivan Kylchik 6f4f06757a [IR] Add KType to IrBuiltins 2023-06-14 19:02:39 +00:00
Dmitriy Novozhilov fdc236296d [FIR2IR] Generate @FlexibleMutability annotation on IR types if needed 2023-05-24 14:07:32 +00:00
Ilmir Usmanov f3a22e0ac4 Warn about suspend extension functional types as supertypes
They will become error in 2.0

 #KT-58529 Fixed
 #KT-49175 Fixed
2023-05-19 12:41:37 +02:00
Dmitriy Novozhilov 8338370fbd [FE 1.0] Provide implementation of ExpectActualMatchingContext for FE 1.0
^KT-58578
2023-05-19 10:19:17 +00:00
Anna Kozlova 366c67a668 extract StandartNames.NAME constant 2023-05-09 07:36:10 +00:00
Anna Kozlova f0af7c4228 [cls] include property constant initializer in stubs
^KTIJ-24667
this would allow building FirElements from stubs
2023-04-26 21:43:15 +02:00
Nikolay Lunyak e1158b1cb2 [FIR] Don't load unneeded things
It's confusing to stop at breakpoints
related to these loadings when they aren't
actually used.
2023-04-25 11:29:34 +00:00
Artem Kobzar 33c5068b79 [K/JS] Rework IR deserialization and lowering phases to consume less memory 2023-04-19 13:10:19 +00:00
Mikhail Zarechenskiy fc37885d6d K1: report a warning for invisible setter accessed from a derived class
The issue is that during binding fake overrides, the compiler doesn't
 differ setters from its properties, so the compiler uses the same
 visibility for setter and entire property.

 Changing logic at the binding stage can cause some unpredictable consequences so
 the fix is to do this differentiation right at the reporting stage

 ^KT-56662 Fixed

Merge-request: KT-MR-9565
Merged-by: Michail Zarečenskij <Mikhail.Zarechenskiy@jetbrains.com>
2023-04-17 11:08:16 +00:00
Denis.Zharkov 1071669a92 Fix project K2-bootstrapping when KT-57609 breaking change is introduced 2023-03-29 10:45:40 +00:00
Denis.Zharkov a3dcc2032f Drop RawTypeMarker as it's effectively unused anymore
See the previous commits
2023-03-10 18:35:01 +00:00
Denis.Zharkov 608cb01935 K2: Imitate K1 behavior for case of captured types with a raw supertype
See the comments in the code, but mostly the motivation is that once
it was decided to stick with such a legacy thing as raw types,
we are ok with some corner-cases hacks for them
(if there are not too many of them) and they don't break anything
when there are no raw types in the code.

^KT-56616 Fixed
2023-03-10 18:35:01 +00:00
Denis.Zharkov eb09a25239 TypeSystemContext: Rework raw types processing
All the current usages are about checking if the type is raw,
also in K2 it is simply incorrect to assume that only flexible types
might be raw
2023-03-10 18:35:00 +00:00
Mikhail Zarechenskiy 82524fde26 K1: Place integer cinterop conversions under a language feature
Note that it's quite hard to emit a particular diagnostic as
 type check happens later, after the conversion

 ^KT-56583
2023-03-10 09:48:01 +00:00
Roman Efremov 60787e9fe4 Add ability to override EnumEntries class search logic from IDE side
See KTIJ-24676
2023-03-09 14:01:10 +00:00
Evgeniy.Zhelenskiy 88f293d4a9 [IR] Support reflection for MFVC
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2023-03-07 21:44:43 +00:00
Stanislav Erokhin 57eae167cc Restore FunctionClassKind for compatibility with Android IDEA plugin 2023-02-10 16:01:05 +00:00
Stanislav Erokhin bec9ad0f6b Minor. Rename FunctionClassDescriptor#functionKind -> functionTypeKind
This commit is needed for the following commit.
There we will restore the compatibility API with Android IDEA plugin
2023-02-10 16:01:04 +00:00
Vladimir Dolzhenko b04b3d389f Add ability for DeclarationDescriptor validation
Not fully initialized DeclarationDescriptor could leak to bindingTrace.
It is hard to detect the outcome of that kind of leakage due to
possibility to have not fully initialized instances if PCE happens in
the middle of publication and instance full initialization.

#KT-56364
#KT-56388
#KT-54085
#KT-55150
2023-02-07 17:40:42 +00:00
Denis.Zharkov 6d7096b5e9 IR: Fix StackOverflowError caused by using DNN type in lambda
^KT-54140 Fixed
2023-02-03 14:08:57 +00:00
Dmitriy Novozhilov 89c42e20c9 [FIR] Consistently use _function_ instead of _functional_ in names of classes and functions 2023-02-02 08:24:52 +00:00
Dmitriy Novozhilov d1b797ed97 [FIR] Generify resolution and inference of arguments of functional types 2023-02-02 08:24:50 +00:00
Dmitriy Novozhilov 67aa80562d [FE] Completely replace FunctionClassKind with FunctionalTypeKind
FunctionalTypeKind can be used in FE 1.0 too, so there is no need to
  keep both classes. Also, removal of FunctionClassKind simplifies work
  with FunctionalTypeKind in common code, like Analysis Api
2023-02-02 08:24:50 +00:00
Vladimir Dolzhenko edf9c3a2f5 Add more diagnostic info
Resolver could be GCed if there is no any valid hard reference to it.
Some impl of PackageFragmentProvider (like DelegatingPackageFragmentProvider)
keep hard ref to resolver.
For the sake of investigation it is worth to know what kind of PFP is there.

#EA-725255

Merge-request: KT-MR-8581
Merged-by: Vladimir Dolzhenko <Vladimir.Dolzhenko@jetbrains.com>
2023-01-31 09:09:28 +00:00
Dmitriy Novozhilov a83caec94f [FE 1.0] Implement deprecation PRIVATE_CLASS_MEMBER_FROM_INLINE_WARNING warning
^KT-55179
^KT-56171 Fixed
2023-01-31 07:53:11 +00:00
Ivan Kylchik 13cad2a820 Don't save constant value for non-resolved array expression in K1
#KT-55912 Fixed
2023-01-27 09:56:35 +00:00
Alexander Udalov aa7b4cfbe6 Do not eagerly compute deserialized typealias constructors
Otherwise, when adding a typealias to core/builtins, it leads to an
exception "JvmBuiltins instance has not been initialized properly". It
happens because we start computing typealias constructors even before
the compiler has been initialized properly.

Basically we're creating the container, and as a part of it, we're
computing default imports, and for that we need to get all top-level
classifiers from scopes imported by default, which includes typealiases.
Eager call to `getTypeAliasConstructors` here results in computing
constructors of the class descriptor on the RHS of the type alias, which
is not possible if that class is built-in, since the container has not
yet been created and thus `JvmBuiltIns` has not been initialized yet.

No tests added, and no issue is affected because, as mentioned above,
the problem is only reproducible if we add something to core/builtins.
2023-01-23 20:35:11 +01:00
Roman Efremov 878608b7b2 Don't add Enum.entries to scope if it can't be called
^KT-53929 Fixed
2023-01-23 12:53:06 +01:00
Nicklas Ansman Giertz 115bc6ac89 KAPT: Fix an ISE when processing unresolved generic types
Error types that are generic could sometimes throw an ISE when
generating the stub.

This fixes KT-43786
2023-01-17 11:40:13 +01:00
Mikhail Glukhikh 7904f23660 FE: add & fix test with intersection property shadowed by base field 2023-01-09 21:37:22 +00:00
Pavel Mikhailovskii 906c161068 KT-52791 Make it possible to pass multiple context receivers to a class 2022-12-28 11:21:03 +00:00
Dmitriy Novozhilov c44993e586 [FE] Use FQN instead of KClass in TypeRegistry
TypeRegistry is the static map which contains mapping between type of
  session component and its index in the session array. Originally
  `KClass` of a component was used as a key in this map, which worked
  pretty well for compiler components. But there was a problem with
  components from plugins and Kotlin daemon: in compilation with daemon
  we keep TypeRegistry between compilations. But for each compilation
  we load plugins from jar, which brings to the situation when after N
  compilations there is N entries in TypeRegistry map with different
  KClass'es for same extension component. This not only causes AIOBE
  but also introduces the memory leak, because we keep reference to
  KClass which is not used anymore

So to fix this issue it's enough to just store FQN of component in
  TypeRegistry instead of KClass

There are no tests in this commit, but they will be added in next
  commit relevant to scripting. With those commits we will have gradle
  integration tests which uses Kotlin compiler daemon and registers
  a compiler plugin for scripting

^KT-55023 Fixed
2022-12-21 10:33:03 +00:00
Dmitriy Novozhilov 3cffb33ab7 [FE] Drop ApproximateIntegerLiteralTypesInReceiverPosition language feature
This feature is not needed because it is unconditionally disabled for K1
  (because of not fully correct implementation) and unconditionally enabled
  in K2 (K2 does not support old behavior)

^KT-38895
2022-12-09 15:10:02 +00:00
Pavel Mikhailovskii 4676072137 KT-51284 Fix SAM conversion for methods with context receivers 2022-12-07 09:01:21 +00:00
Steven Schäfer 21fef70367 Standardize context receiver parameter names
Previously, FIR used `_context_receiver_n` while FE10 used `<this>` for
all context receiver parameters. This commit changes the code in FE10
to follow the convention from FIR.
2022-12-03 00:11:38 +01:00
Evgeniy.Zhelenskiy fa4ceb4ef4 [IR] Add diagnostics to forbid annotations for MFVC-typed elements
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-11-30 18:55:39 +00:00
Evgeniy.Zhelenskiy 9f01ccc304 [IR] Support user-defined equals for MFVC
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-11-30 18:55:36 +00:00
Dmitriy Novozhilov ac7fddaad5 [FE] Always infer upper types to intersection types in K2...
...and always use old algorithm for K1

^KT-51221
2022-11-29 12:25:44 +00:00
Vladimir Dolzhenko e751b11b5e Add extra checks
#EA-721785
2022-11-28 15:20:29 +00:00
vladislav.grechko 36b8ba8df3 Improve support of custom equals in inline classes
- Ensure that typed equals parameter's type is a star projection of
  corresponding inline class

- Make possible to declare typed equals that returns 'Nothing'

- Forbid type parameters in typed equals operator declaration

^KT-54909 fixed
^KT-54910 fixed
2022-11-17 15:35:14 +01:00
Jinseong Jeon fcba1f215a AA: handle erroneous type in nested type argument 2022-11-16 14:13:43 +01: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
Sergej Jaskiewicz 37b32907ab Fix a compatibility issue with AnnotationDescriptor
The `getSourceForArgument` method should be in the interface,
but adding it is a breaking change for Java usages,
since the module is not built with -Xjvm-default (KT-54749).

Move the method to an extension. This doesn't change the behavior,
since it was only ever called on LazyAnnotationDescriptor.
2022-11-02 11:07:07 +00:00
Alexey Belkov 2036b65b78 K1: render receiver DNN type as parenthesized
^KTIJ-20849
2022-10-28 12:52:22 +04:00
vladislav.grechko 817afcd4af KT-MR-7307 review fixes 2022-10-13 15:19:10 +00:00
Dmitriy Novozhilov d423782fac [FE 1.0] Remove usages of safeAs and cast from most of FE 1.0 modules:
- :core:descriptors
- :core:descriptors.jvm
- :core:deserialization
- :compiler:cli
- :compiler:frontend
- :compiler:frontend:cfg
- :compiler:frontend.java
- :compiler:frontend.common.jvm
- :compiler:psi
- :compiler:resolution
- :compiler:resolution.common
- :compiler:resolution.common.jvm
- :kotlin-reflect-api
2022-10-12 13:58:56 +00:00
vladislav.grechko e0c8142106 Support of custom 'equals' and 'hashCode' in inline classes
'equals' from any made available for overriding in inline classes
'typed' equals made available for definition in inline classes
'typed' equals definition made compulsory if 'untyped' is overridden
'operator' keyword is allowed in 'typed' equals definition

^KT-24874: Fixed
2022-10-10 16:52:34 +00:00