Commit Graph

5572 Commits

Author SHA1 Message Date
Kirill Rakhman c95a9ff55e [FIR] Only mark declaration name with ACTUAL_WITHOUT_EXPECT
#KT-58827 Fixed
2023-06-22 14:59:19 +00:00
Mikhail Glukhikh fa6b1e24f9 FE: perform IOT approximation after resolution & inference
#KT-54917 Fixed
2023-06-22 12:29:11 +00:00
Mikhail Glukhikh 7884d9a61e K2: reproduce KT-54917 2023-06-22 12:29:11 +00:00
Kirill Rakhman 6318da0f02 [FIR] Remove or replace whole expressions in FIR diagnostic messages
FIR expressions rendered by FirRenderer don't look very nice in error
messages anyway, and additionally, they can become arbitrarily large,
so we shouldn't use them in messages.

#KT-59449 Fixed
2023-06-22 08:02:07 +00:00
Dmitriy Novozhilov 0f0f0d604f [FIR] Expand typealiases before checking type of class literal 2023-06-22 07:09:15 +00:00
Dmitriy Novozhilov 6c7eb0167c [FIR] Report errors about type arguments on resolved qualifiers
^KT-56186 Fixed
^KT-56187 Fixed
^KT-59553
2023-06-22 07:09:15 +00:00
Dmitriy Novozhilov 1b24b95cde [FIR] Check for subtyping during actualization of supertypes of expect class
^KT-59356 Fixed
2023-06-22 07:05:31 +00:00
Mikhail Glukhikh 4b7ab54d95 FE: fix test data after commit clash 2023-06-21 19:25:14 +02:00
Mikhail Glukhikh 78f4d399d4 FE: add test to ensure Java entries static field is resolved normally 2023-06-21 13:08:01 +00:00
Mikhail Glukhikh 905e1dcd3b K2: introduce prioritized enum entries resolve by a 2.1 feature
Related to KT-48872
2023-06-21 13:08:01 +00:00
Mikhail Glukhikh b92f1e2036 K2: de-prioritize access to Enum.entries properly #KT-57954 Fixed 2023-06-21 13:08:00 +00:00
Mikhail Glukhikh 978d52d05b K2: render additionally *s for static references
This commit allows to distinguish static VS non-static things
inside FIR_DUMP, e.g. static synthetic Enum.entries with
enum entry Enum.entries
2023-06-21 13:08:00 +00:00
Mikhail Glukhikh 70899d492d K2: reproduce KT-57954 and reorganize tests around enum entries warnings
In particular, here we add FIR_DUMP to all enum entries tests with
some deprecation diagnostics and the feature on, and remove all txt-files
2023-06-21 13:08:00 +00:00
Kirill Rakhman 911e62257a [FIR] Improve INVISIBLE_REFERENCE message
Report the nearest invisible containing declaration in cases where
the declaration itself is visible.

#KT-53820 Fixed
2023-06-21 08:36:46 +00:00
Kirill Rakhman 6a073e0b17 [FIR] Fix duplicate spaces in FirPartialModifierRenderer 2023-06-21 08:36:46 +00:00
Egor Kulikov b147b7e929 [FIR] Store fir for invalid when branches
^KTIJ-25646 fixed

Merge-request: KT-MR-10646
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
2023-06-20 16:11:31 +00:00
Mikhail Glukhikh 8983e3a218 K2: correctly set importedFromObjectOrStaticData for fields
#KT-59140 Fixed
#KT-58980 Fixed
2023-06-20 14:13:21 +00:00
Mikhail Glukhikh 18206210cf K2: reproduce KT-59140 2023-06-20 14:13:21 +00:00
Mikhail Zarechenskiy 060f3fa7c4 Extract diagnostics about class literals with empty LHS
^KT-59152
2023-06-19 15:21:32 +00:00
Mikhail Zarechenskiy 1153238fd7 Extract diagnostics about references to variables to a separate one
Note that I've left in FIR everything as is to avoid non-trivial
refactoring that is required right now to report more specific diagnostics

 ^KT-59152
2023-06-19 15:21:32 +00:00
Mikhail Zarechenskiy 2dfdd8dcf6 Extract diagnostics about 'sealed fun interface' to a separate one
^KT-59152
2023-06-19 15:21:32 +00:00
Mikhail Zarechenskiy d772126f2c Extract diagnostics about 'sealed when' to a separate one
^KT-59152
2023-06-19 15:21:32 +00:00
Abduqodiri Qurbonzoda 4ae19b2b44 [K/N] Deprecate SharedImmutable annotation #KT-57837
As a part of efforts to stabilize Native stdlib.
2023-06-19 11:35:32 +00:00
Dmitriy Novozhilov d972b78627 [FIR] Allow actualization of expect classes by classes with wider visibility
^KT-59355 Fixed
2023-06-19 11:09:32 +00:00
Brian Norman 0ff9982b31 [FIR] Additional errors to distinguish resolution to classifier cases
When a call is resolved to a classifier, only a single error message was
being used for multiple cases. This lead to confusion as the default
message may not be applicable to a given error case. Added additional
errors and messages to distinguish between these error cases.

#KT-57251 Fixed
2023-06-16 16:26:50 +00:00
Brian Norman 269dfc61c8 [FIR] Display actual type for argument type mismatch error
Previously the argument type was being used for the actual type error
display. However, safe-call arguments are unwrapped which causes
nullable types to be displayed as non-null. Change to use the actual
type provided by the diagnostic instead of extracting the type from
the argument.

#KT-58844 Fixed
2023-06-16 11:44:14 +00:00
Brian Norman 6b5e7ae825 [FIR] Transform children independently when callee is an error
To make sure all possible types are resolved and any additional errors
are reported, resolve children of function calls using independent
resolution mode when the callee reference is an error.

#KT-59041 Fixed
2023-06-15 14:03:40 +00:00
Brian Norman 8fad4272fc [FIR] Fix default message for PRIVATE_CLASS_MEMBER_FROM_INLINE
Error message was only printing the calling inline function and not the
class member being accessed. Make sure both pieces for diagnostic
information are included in the error message.

#KT-58972 Fixed
2023-06-15 13:49:41 +00:00
Brian Norman 5fe5113344 [Test] Sort FIR diagnostics by offset for consistent rendering 2023-06-15 13:49:41 +00:00
Mikhail Glukhikh 0ea0346ec1 FE MPP: add a test with expect value class B : interface with toString
Related to KT-54844
2023-06-14 07:09:16 +00:00
Mikhail Glukhikh 35b475f9f7 K2: Fix processing inference lower bound NullableType <: T & Any
This commit is a follow-up to 0d070f8ba9.
Here we remove accidentally returning "Not a sub-type" for a constraint
like TypeVariable <: DNN type

#KT-59241 Fixed
2023-06-12 22:36:02 +00:00
Mikhail Glukhikh ab1d634ad3 K2: add test for KT-59241 2023-06-12 22:36:02 +00:00
Brian Norman a71437335b [FIR] Unwrap definitely not-null types in type parameter cycle checks
#KT-58944 Fixed
2023-06-12 20:05:23 +00:00
Denis.Zharkov 41933facbb K2: Fix ISE from inference on delegate vars with implicit types
See the test data.
ISE happened because at some point after incomplete `getValue` resolution
of `a` property, we updated in the `transformAccessors` the property type
to the `Variable(Y)` type and then used it as a 3rd argument for
`setValue` call which is incorrect because the variable belongs
to a different constraint system (from `getValue`).

Mostly, the fix is just a repeating K1 behavior, namely postponing
`setValue` resolution until delegate inference is completed.

^KT-59066 Fixed
2023-06-12 11:30:35 +00:00
Dmitriy Novozhilov 29afd0dc97 [FIR] Properly match expect fun interfaces with java interfaces 2023-06-10 07:33:30 +00:00
Dmitriy Novozhilov 1418a2bcb8 [Test] Temporary update testdata till KT-58829 will be fixed 2023-06-10 07:33:30 +00:00
Dmitriy Novozhilov af041f5bef [Test] Update test according to KT-58899 2023-06-10 07:33:30 +00:00
Dmitriy Novozhilov 8b9079d026 [Expect/Actual] Add ability to skip matching of constructors of expect enums
In terms of MPP there are no such thing as `expect constructor` for enums,
  but they are physically exist in FIR and IR, so we need a switch which
  skips matching for them

FE 1.0 implementation did not touch to avoid any hidden changes
2023-06-10 07:33:29 +00:00
Dmitriy Novozhilov ba41e8ec38 [IR] Use common expect/actual matching algorithm in IR actualizer
^KT-58578 Fixed
2023-06-10 07:33:29 +00:00
Brian Norman 92cb47a8f9 [FIR] Always report when named arguments are not allowed
#KT-59177 Fixed
2023-06-08 17:25:34 +00:00
Denis.Zharkov d5f24addea K2: Fix isHiddenForThisCallSite for non-direct overridden
Previously, the call of `z.sort` in test has been resolved
to the overridden member
2023-06-08 15:53:22 +00:00
Egor Kulikov f2f979134d [FIR] Change diagnostic INITIALIZER_TYPE_MISMATCH to work with for loop
^KTIJ-25251 fixed


Merge-request: KT-MR-10507
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
2023-06-08 09:40:09 +00:00
Nikolay Lunyak 5daec16ce0 [FIR] Forbid creating abstract class instances via any qualified access
^KT-58938 Fixed
2023-06-07 16:45:28 +00:00
Brian Norman 63a327808c [Test] Update FIR diagnostic rendering 2023-06-07 15:19:42 +00:00
Denis.Zharkov 69a6339935 K2: Add test for obsolete KT-51793
^KT-51793 Fixed
2023-06-07 14:49:22 +00:00
Denis.Zharkov 0d070f8ba9 K2: Fix processing inference lower bound NullableType <: T & Any
Previously, it was led to plainly adding NullableType <: T constraint
which silently led to successful call completion.
What is suggested is just marking such initial constraint
as unsuccessful.

In K1, the error was reported just via additional type checking
mechanism being run after call completion.

^KT-58665 Fixed
2023-06-07 09:42:55 +00:00
Brian Norman 48484368c7 [Test] Support RENDER_DIAGNOSTICS_FULL_TEXT directive for FIR tests 2023-06-06 15:42:21 +00:00
Egor Kulikov 347c748182 [FIR] Add excessive delegated constructors to FIR tree
^KTIJ-25453 fixed

Merge-request: KT-MR-10379
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
2023-06-05 14:27:53 +00:00
Brian Norman e10a9263d0 [FIR] Only inherit class type parameters if inner class
Nested classes which are not inner class should not be able to access
type parameters of the outer class. Make sure access is not available
when resolving super types.

#KT-54748 Fixed
2023-05-31 16:25:51 +00:00
Roman Efremov d2eb4a0abf [FE] Prohibit default arguments in expect declarations actualized via typealias
Cases when default argument inhertied from super class are allowed.

Some tests for default arguments already exist and can be found in
`testData/diagnostics/tests/multiplatform/defaultArguments`, for example
`annotationsViaActualTypeAlias.kt`.

^KT-57614 Fixed

Merge-request: KT-MR-10356
Merged-by: Roman Efremov <Roman.Efremov@jetbrains.com>
2023-05-31 13:14:37 +00:00