Commit Graph

10982 Commits

Author SHA1 Message Date
Pavel Kunyavskiy 09474758ab [K/N] Fix typo in language feature name 2023-04-04 09:13:36 +00:00
Mikhail Glukhikh d76b32daf2 K1: rename 'kotlinCall' -> 'selectorCall' in relevant places 2023-04-03 16:35:55 +00:00
Mikhail Glukhikh bd27ec840c K1: report swallowed diagnostic about receiver type mismatch
#KT-55056 Fixed
2023-04-03 16:35:55 +00:00
Mikhail Zarechenskiy 681e85eaed Don't report unused variable warning for delegated variables with provide delegate
^KT-38871 Fixed
2023-03-27 13:46:13 +00:00
Mikhail Glukhikh 930237b60e K1: report swallowed diagnostic about upper bound violation
#KT-55055 Fixed
2023-03-24 14:27:03 +00:00
Pavel Mikhailovskii 0e6da53af8 KT-57491 Prefix context receivers with $context_receiver_ 2023-03-23 16:23:09 +00:00
Mikhail Glukhikh eb80ba9cf7 DiagnosticReporterByTrackingStrategy: extract reportArgumentConstraintErrorByPosition 2023-03-22 15:42:26 +00:00
Mikhail Glukhikh 7a58c2e99f DiagnosticReporterByTrackingStrategy: refactor positioning 2023-03-22 15:42:26 +00:00
Mikhail Glukhikh 739e7d3a7a DiagnosticReporterByTrackingStrategy: refactor all whens by type 2023-03-22 15:42:25 +00:00
Nikita Bobko 48ed6c4cc7 2/2 Implement deprecation for use-site '@get:' target
^KT-15470 Fixed
Review: https://jetbrains.team/p/kt/reviews/9250
2023-03-21 13:29:10 +01:00
Mikhail Glukhikh 41c868445c K1: introduce smartcast deprecation for a public API property in invisible class
#KT-56511 Fixed
Related to KT-57290
2023-03-17 14:57:40 +00:00
Mikhail Glukhikh 2fb79bf0b1 K1: don't report InferredIntoDeclaredUpperBound on non-physical element
#KT-56169 Fixed
2023-03-17 12:08:37 +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
Nikita Bobko 62d2327ca3 Don't issue a warning about expect/actual in the same module for incompatible expect/actual pairs
^KT-57067 Fixed
Review: https://jetbrains.team/p/kt/reviews/9123
2023-03-09 09:30:29 +00:00
Yan Zhulanow c604577132 Embed DefaultErrorMessages extension list (KT-57102)
Normally, 'DefaultErrorMessages' extensions should only be loaded
from the main compiler JAR. However, in the in-process JPS build,
there are two versions of the compiler classes in the process, and
'ClassLoader's there are not fully isolated.

'ServiceManager' loads extensions from both 'META-INF' locations. If
the JPS plugin bundles newer compiler components, newly appeared
'DefaultErrorMessages' extensions will be loaded from the JPS (parent)
'ClassLoader', causing an exception.

Such a problem appeared with 'DefaultErrorMessagesWasm':

- - - - -
java.util.ServiceConfigurationError:
org.jetbrains.kotlin.diagnostics.rendering.DefaultErrorMessages$Extension: org.jetbrains.kotlin.wasm.resolve.diagnostics.DefaultErrorMessagesWasm not a subtype
- - - - -
2023-03-04 06:38:34 +00:00
Svyatoslav Kuzmich 60ef7fcb49 [Wasm] Suppress unused parameters warning for functions with JS body
These parameters can be used in js(code)
2023-03-03 19:39:09 +00:00
Andrei Klunnyi e3d5affe5c KT-56221 Gradle KTS: overloaded assignment is not supported
```
java.docsDir = file("src/docs")
```
is a `KtBinaryExpression`. Decision on the assignment validity involves
`AbstractAssignPluginResolutionAltererExtension.hasSpecialAnnotation()`.
The function requires a parent declaration, which in case of a script
is `KtScriptInitializer`.

^KT-56221 fixed
2023-03-01 12:49:32 +01:00
Dmitriy Novozhilov cbc8b74e89 [FE 1.0] Don't check star projections in PrivateInlineFunctionsReturningAnonymousObjectsChecker
^KT-56692 Fixed
2023-02-28 09:17:39 +00:00
Vladimir Dolzhenko 3e99807436 Add ability to provide specific AbsentDescriptorHandler
#EA-457188

Merge-request: KT-MR-8900
Merged-by: Vladimir Dolzhenko <Vladimir.Dolzhenko@jetbrains.com>
2023-02-22 12:44:46 +00:00
Nikita Bobko 9a865e4c55 [FE 1.0] Issue a warning if expect and actual are declared in the same module
The commit is based on b09561c3c3
Co-authored-by: Dmitriy Novozhilov <dmitriy.novozhilov@jetbrains.com>

^KT-40904 Fixed
^KT-55177 Fixed
Review: https://jetbrains.team/p/kt/reviews/8731

True negative test already exist:
`compiler/testData/diagnostics/tests/multiplatform/hmpp/multiplatformCompositeAnalysis/intermediateWithActualAndExpect.kt`
2023-02-21 14:45:46 +01:00
Dmitriy Novozhilov d4bb740a62 [CLI] Store information about HMPP module for source files 2023-02-17 11:08:50 +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
Dmitriy Novozhilov 3c42521ce7 [FE 1.0] Report warning on leaking anonymous object type from private inline lambda
^KT-33917
^KT-56490 Fixed
2023-02-09 20:44:15 +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
Vladimir Dolzhenko a049fda75b Create SimpleFunctionDescriptorImpl under nonCancelableSection
SimpleFunctionDescriptorImpl initialization consists of two phases:
ctor + initialize.
When SimpleFunctionDescriptorImpl is created wrapped descriptor
(e.g. ValueParameterDescriptorImpl) is leaked through bindingTrace
with not fully initialized `containingDeclaration` (that is
SimpleFunctionDescriptorImpl).
If PCE happens after this unsafe publication prior to `initialize` then
it will be case with NPE on fully initialized instance reading.

#KT-56364 Fixed
2023-02-07 17:40:41 +00:00
Vladimir Dolzhenko 9be4aa2e02 Create PropertyDescriptorImpl under nonCancelableSection
PropertyDescriptorImpl initialization consists of two phases:
ctor + setType.
When PropertyDescriptorImpl is created wrapped descriptor
(e.g. WithDestructuringDeclaration) is leaked through bindingTrace
with not fully initialized `containingDeclaration` (that is
PropertyDescriptorImpl).
If PCE happens after this unsafe publication prior to `setType` then it
will be case with NPE on fully initialized instance reading.

#KT-56388 Fixed
2023-02-07 17:40:41 +00:00
Mikhail Zarechenskiy c586d7a03a Use more specific error for secondary constructor bodies in inline classes
- Also, this error allows IDE to provide quick-fix that changes language
 version in a project that simplifies the adoption
 - There is no point in
 changing K2 part as there this feature will be enabled by default

 ^KT-56224 Fixed
2023-02-03 13:38:31 +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 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 d3fcd965ba Get rid of recordToTrace
recordToTrace is a bad practice as instance could be initialized out of
our control (e.g. in other plugins)

#KTIJ-22182
2023-02-01 15:59:04 +00:00
Vladimir Dolzhenko 79b8954814 Prevent unsafe publication of not fully initialized instance
#KT-54085 Fixed
#EA-757831
2023-02-01 15:59:04 +00:00
Mikhail Glukhikh f14effa8e8 K1: extract isAssignmentCorrectWithDataFlowInfo 2023-01-31 22:05:17 +00:00
Mikhail Glukhikh 7cc3f7de62 K1: introduce assignment checkers and convert JvmSyntheticAssignmentChecker
Related to KT-56061
2023-01-31 22:05:16 +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
Alexander Udalov e8f95a3376 Add @JvmDefaultWithCompatibility to StorageComponentContainerContributor
This doesn't change behavior, but will hopefully fix a binary
compatibility issue with some IDEA plugins.
2023-01-27 20:02:24 +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
Mikhail Glukhikh 41966a745e Enum entries: add new tests with language feature ON & fix checker 2023-01-24 12:46:00 +00:00
Mikhail Glukhikh 565adf3075 K1: don't filter Enum.entries in tower to report error later
After this commit we:
- preserve Enum.entries synthetic property in tower even in case the bound feature is OFF
- report an error on Enum.entries call in specific checker if the feature is OFF
- give this synthetic property lower priority, no matter feature ON or OFF

#KT-55251 Fixed
2023-01-24 12:45:59 +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
Denis.Zharkov b1bb7dd25f K1: Fix regression with callable references as last statements in lambda
^KT-55729 Fixed
2023-01-19 10:00:02 +00:00
Dmitriy Novozhilov 8d728d4f53 Revert "[FE 1.0] Deprecate declaration of expect and actual in the same module"
This reverts commit b09561c3c3.

It was decided to postpone this warning till 1.9
This is needed to provide proper IDE support

^KT-40904 Open
^KT-55177 Open
2023-01-17 18:02:50 +00:00
Dmitriy Novozhilov b09561c3c3 [FE 1.0] Deprecate declaration of expect and actual in the same module
^KT-40904 Fixed
^KT-55177 Fixed
2023-01-17 09:43:14 +00:00
Mikhail Glukhikh cbedbda527 Enhance API/messages around BinaryVersion / JvmMetadataVersion 2023-01-16 18:16:07 +01:00
Mikhail Glukhikh 0c4a0360ac Deserialization/class reading: pass chosen JvmMetadataVersion whenever possible 2023-01-16 18:16:07 +01:00
Kirill Rakhman 721a37f7e7 K2: implement FirLateinitIntrinsicApplicabilityChecker ^KT-55495 Fixed 2023-01-04 14:42:43 +00:00
Mikhail Zarechenskiy 3cdbb4876f Add a warning for conflicting entries member
^KT-53153
2023-01-04 13:17:11 +00:00
Mikhail Zarechenskiy cf4b415a20 Add a warning for name shadowing case with Enum.entries
^KT-53153
2023-01-04 13:17:11 +00:00
Mikhail Zarechenskiy c70a1b1884 Add a warning for a custom Enum.entries entry
^KT-53153
2023-01-04 13:17:10 +00:00
Mikhail Zarechenskiy 989fc886e1 Add a warning for a user-defined entries property call
^KT-53153
2023-01-04 13:17:10 +00:00