Commit Graph

6631 Commits

Author SHA1 Message Date
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
Ivan Kylchik dd264cff50 [IR] Split const folding into necessary one and for optimizations only
In this commit we have a lot of change in test data. This was caused
by the way where we evaluate constants. We split constant evaluation
into two distinct parts: only necessary evaluations for `fir2ir`
(like const val and annotations) and optimizations for lowering.
Now we don't do all constant evaluation on `fir2ir`, but IR
dump is executed after this phase, so test data changed.

#KT-58923
2023-06-14 19:02:39 +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 61ed34f4b7 K2: Adjust JDK 21 test data to the latest JvmMappedScope changes
See 2e5b783cc6 for details

After the fix for KT-57694 (mostly rewritten JvmMappedScope),
the behavior of loading new JDK 21 members of K2 has been aligned with K1
2023-06-08 15:53:22 +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
Nikolay Lunyak 45bbd432fc [FIR Native] Stop requiring :dist for native diagnostic test
Native uses its own klib stdlib generated
via `:kotlin-native:dist`.
2023-06-07 05:20:01 +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 0298d17987 [FIR] Remove suspend lambda redundant warning for inline functions
#KT-57971 Fixed
2023-06-02 10:49:57 +00:00
Nikolay Lunyak 70605c84df [FIR Native] KT-58549: Get rid of the builtin provider
According to
`FirNativeCodegenBoxTestGenerated.testNestedClassesInAnnotations`,
the annotation
`kotlin.internal.PlatformDependent` is
unresolved reference.

^KT-58549 Fixed
2023-06-01 10:27:54 +00:00
Nikolay Lunyak 5af4230f46 [FIR Native] KT-58549: Ensure Cloneable is accessible in native 2023-06-01 10:27:54 +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
Alexander Shabalin 2364ffb299 [K/N] Remove diagnostics about old Native GC ^KT-58853 2023-05-31 14:29:17 +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
Ilmir Usmanov d7fd2471b8 JVM IR: Remove remains of 1.2 coroutines from tests
Remove CoroutineAdapter and LANGUAGE: +ReleaseContinuation,
which are meaninless now.
Update the tests accordingly.
2023-05-31 05:56:18 +00:00
Kirill Rakhman ca022cf4dc [FIR] Forbid suspend operator get/setValue and provideDelegate
#KT-58989 Fixed
2023-05-30 16:48:53 +00:00
Kirill Rakhman cf2ef443f4 [FIR] Introduce a feature flag for context-sensitive enum resolution
The feature was previously enabled unconditionally in K2 which
triggered a bug when an enum has an entry with the same name as itself.

#KT-58897 Fixed
#KT-52774
2023-05-30 11:59:56 +00:00
Denis.Zharkov 2e5b783cc6 K2: Refine how JDK members are mapped to built-in classes
Previously, the semantic was more-or-less correct for most of the cases
but some corner one, like `sort` in MutableList didn't work properly.

Namely, `sort` should be marked there in a way to forbid to call it
everywhere beside super-calls.
Also, overriding it should be allowed.

Mostly, the logic was re-written to K2 model from K1-related
JvmBuiltInsCustomizer.

^KT-57694 In progress
^KT-57269 Fixed
2023-05-30 10:44:41 +00:00
Brian Norman 8091aebbc7 [FIR] Create checker for simple enum entries with missing overrides
Complex enum entries (those with bodies) with missing overrides
are covered by an existing checker that checks all types of classes. But
simple enum entries (those without bodies) were not covered and require
a separate checker for missing overrides.

#KT-58637 Fixed
2023-05-29 16:34:44 +00:00
Kirill Rakhman 0ac02be534 [FIR] Generate annotations to data class copy method parameters
#KT-57003 Fixed
2023-05-26 11:29:13 +00:00
Mikhail Glukhikh 6e58ba8f33 FE: don't approximate type variable based types for public/local declarations
#KT-58618 Fixed
2023-05-26 11:13:39 +00:00
Mikhail Glukhikh 2cfa3d7e0d K2: reproduce KT-58618 2023-05-26 11:13:39 +00:00
Nikolay Lunyak c0ce37a271 [FIR] KT-58460: Report a return type mismatch diagnostic
^KT-58460 Fixed
2023-05-25 14:52:04 +00:00
Nikolay Lunyak ff61f70dd0 [FIR] KT-58460: Ensure the error is missing 2023-05-25 14:52:04 +00:00
Nikolay Lunyak 83f2c2e1f0 [FIR] KT-58623: Unify FirInlineDeclarationChecker
> Condition 'isSuspendFunctionType' is always false when reached

The change in the native tests is needed, because K2
doesn't support disabling old language features

^KT-58623 Fixed
2023-05-25 12:19:51 +00:00
Nikolay Lunyak 75c0304671 [FIR] KT-58623: Ensure the diagnostics are missing for Native 2023-05-25 12:19:51 +00:00
Nikolay Lunyak 699366f178 [FIR] KT-58184: Prevent missing diagnostics on component calls
Update the component function visibility
based on the already resolved visibility
of the property before transforming
the status of the component function itself.

^KT-58184 Fixed
2023-05-25 12:19:30 +00:00
Brian Norman b2230327df [FIR] Refactor upper bound validation with better source element info
Attach source information to each argument of the type before expanding
to preserve information during validation. This allows errors to be
reported on the original argument during nested type alias expansion.

^KT-50798 Fixed
^KT-50703 Fixed
2023-05-25 11:24:17 +00:00
Ivan Kochurkin 994c2229df [FIR] Report UNSUPPORTED_FEATURE for expect/actual members if MPP is disabled
Always enable MultiPlatformProjects for K2MetadataCompilerArguments

 ^KT-57243 Fixed
2023-05-25 09:46:56 +00:00