Commit Graph

44092 Commits

Author SHA1 Message Date
Sergej Jaskiewicz 487847bedc fixup! [IR] Add the description field to CommonIdSignature 2023-06-20 15:31:46 +00:00
Sergej Jaskiewicz e0b8cf827a fixup! [IR] Add the description field to CommonIdSignature 2023-06-20 15:31:46 +00:00
Sergej Jaskiewicz 3a30d74096 [IR] Add the description field to CommonIdSignature
This field shall be used for storing a human-readable representation
of the declaration, that would be a mangled name for now.

This field is not yet serialized. Serialization will be implemented in
follow-up commits.

See KT-59486
2023-06-20 15:31:45 +00:00
Mikhail Glukhikh 668684ca13 K2: correct FirJavaField usages taking imported variant into account
Related to KT-59140
2023-06-20 14:13:21 +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
Sergej Jaskiewicz c2fde1a915 [IR] Reorder parameters in IrFactory#createEnumEntry
This is to prepare for IrFactory auto-generation (KT-59308).
2023-06-20 14:12:58 +00:00
Nikolay Lunyak 46ea908daf [Tests] Ensure the temporary directories are cleared
This change may prevent OOMs. Context:
https://jetbrains.slack.com/archives/C4U955N6B/p1685000899030279
2023-06-20 13:28:23 +00:00
Artem Kobzar 039b5fca7a [K/JS] Use declared upper-bound types for parameters inside inlined functions body, instead of the provided types 2023-06-20 12:01:28 +00:00
Kirill Rakhman aa4ebe1991 [FIR2IR] Fix NPE on missing built-ins when using old stdlib
Specifically, this code was throwing when trying to get the symbol for
IntrinsicConstEvaluation which is only available since 1.7.

#KT-59151 Fixed
2023-06-20 11:52:21 +00:00
Artem Kobzar 66bdb9ce79 [K/JS] Fix private constructor delegating inside single class with ES6 mode ^KT-59335 Fixed 2023-06-20 11:07:08 +00:00
Pavel Mikhailovskii 79dbacb621 [SLC] Keep default constructor parameters' values 2023-06-20 11:00:18 +00:00
Pavel Kunyavskiy 12455451fc [K/N] Call class static initializer in constructors
^KT-59058
2023-06-20 08:41:11 +00:00
Mikhail Glukhikh d8a20f1975 K2: don't generate Java overridden synthetics for Kotlin get/sets
#KT-59038 Fixed
2023-06-20 07:07:10 +00:00
vladislav.grechko e4f1c10bc1 [JVM_IR] Do not compile-time evaluate apiVersionIsAtLeast in stdlib
Function `apiVersionIsAtLeast` was introduced to be able to have
different inline function content inlined to user code call sites
depending on their api version settings. Thus, it should not be
compile-time evaluated when being called in the body of inline stdlib
function.

^KT-59452: Fixed
2023-06-19 16:24:57 +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 9cf40f8c2f Extract diagnostics about 'suspend test' to a separate one
^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
Mikhail Zarechenskiy c613b312f9 Refactoring: inline single-used method, move checker closer to the usage 2023-06-19 15:21:32 +00:00
Mikhail Zarechenskiy ab7ae75f66 Remove unused method
Note that `yield` was allowed since 1.7.0: KT-27750
2023-06-19 15:21:32 +00:00
Mikhail Zarechenskiy 1df4893a43 Extract diagnostics about an unsupported case of inheritance from Java
^KT-59152
2023-06-19 15:21:32 +00:00
Evgeniy.Zhelenskiy 2d920df507 [IR] Fix KT-59346, KT-55993
#KT-59346
#KT-55993
2023-06-19 12:36:08 +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 8ac59592ed [FIR] Add DFA implications when one side of an Elvis operator is null
When one side of an Elvis operator can only be `null`, and the entire
Elvis operator expression cannot be `null`, this implies that the
opposite side of the Elvis operator cannot be `null`. Add such
implications to the Elvis exit node of the DFA. This helps smart-casting
of variables used within long Elvis operator chains.

#KT-49249 Fixed
2023-06-19 08:17:47 +00:00
Nikolay Lunyak 110cc79ddd [FIR] Improve debugging of diagnostic ranges
`UNREACHABLE_CODE` is weird.
If we look into its
positioning strategy,
we'll see that this diagnostic
attempts to split the source
of its element into multiple ranges.
This is bad, because such smaller
ranges can easily overlap with other
diagnostics in such a way that
they are no longer hierarchical.
See the
`compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/3.kt` test
for an example of this behavior
(allow reporting `UNREACHABLE_CODE`
first). The problem will appear at
the condition of `case_7`.
2023-06-19 07:40:16 +00:00
Nikolay Lunyak 7541732752 [FIR] Fix TEST SPEC tests
Ensure the test data contents for both the frontends
are identical. This is needed for proper analysis of
K2-differences.
2023-06-19 07:40:15 +00:00
Dmitriy Dolovov 56bebeaf92 [KLIB] Extract "ir_provider" manifest property name as a const val, p.2 2023-06-17 01:00:04 +00:00
Alexander Udalov 04998cff8a Kapt+JVM_IR: fix error on delegation to anonymous object
In kapt stub generation mode, psi2ir does not generate bodies of
declarations. This means that the delegate type was translated into an
IrType which is based on a class which is not generated by psi2ir, thus
leading to an unbound symbol error. The fix is to avoid using anonymous
types for delegate fields in this mode.

 #KT-59211 Fixed
2023-06-16 23:03:39 +00:00
Alexander Udalov fd4e59f279 Kapt+JVM_IR: do not generate bodies of enum entries
#KT-59247 Fixed
2023-06-16 22:48:11 +00:00
Abduqodiri Qurbonzoda 295fdc36ce Enum.valueOf throws inconsistent exception across multiple platforms #KT-35116 2023-06-16 22:18:20 +00:00
Abduqodiri Qurbonzoda d6867917c9 Enum entry hashCode() should return identity hash code #KT-59223 2023-06-16 22:18:20 +00:00
Hung Nguyen 078356164b IC: Fix regression in detecting constants in KotlinClassInfo.kt
A constant is a static final field with non-null value. In a previous
commit (0b09be7), we accidentally removed the *non-null value*
filter when looking for constants in the bytecode.

This commit re-adds that filter to make sure the detection is correct.

Test: Added KotlinOnlyClasspathChangesComputerTest.testDelegatedProperties

^KT-58986: Fixed
2023-06-16 18:40:01 +00:00
Hung Nguyen ff612f15cf IC: Small cleanup in KotlinClassInfo.kt
This is to address the not-yet-resolved comments in
https://github.com/JetBrains/kotlin/pull/5127, plus a few other small
(non-functional) changes.

^KT-58986: In progress
2023-06-16 18:40:00 +00:00
Mikhail Glukhikh d5a02960d8 K2 plugins: set proper 'expect' flag for all member declarations
Related to KT-59299
2023-06-16 17:55:46 +00:00
Mikhail Glukhikh 8e882ea797 K2 plugins: create companions with same expect/actual as their owners
#KT-59299 Fixed
2023-06-16 17:55:45 +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
Vladimir Sukharev 05e22e56d3 [K/N] Mark rest of reflection related tests as jvm-only
^KT-59057

Merge-request: KT-MR-10570
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-06-16 11:50:03 +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
Sergej Jaskiewicz fd094835a4 [test] Add the NATIVE backend to non-JVM check blocks in signature tests
(see KT-59204)
2023-06-16 10:01:54 +00:00
Sergej Jaskiewicz 6064012efa [test] Print NATIVE for newly generated check blocks in signature tests
Since we know that in most cases signatures for JS and NATIVE are
the same, when running a signature test for the first time, let's print
`// CHECK JS NATIVE:` instead of `// CHECK JS:` or `// CHECK NATIVE:`.

^KT-59204 Fixed
2023-06-16 10:01:54 +00:00
Pavel Mikhailovskii 16644c1a3b FIR Preserve nullability of ConeErrorType when possible 2023-06-16 08:09:04 +00:00
Vladimir Sukharev 217550d10e [K/N] Enable passed MPP K1/N tests
^KT-59057

Merge-request: KT-MR-10526
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-06-16 07:45:01 +00:00
Vladimir Sukharev 1e05cb308c [K/N] Convert and enable some tests using System.out?.println()
^KT-59057

Merge-request: KT-MR-10546
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-06-15 20:00:27 +00:00
Vladimir Sukharev 67b00f86b7 [K/N] Remove "IGNORE_BACKEND: NATIVE" from tests already ignored due to incompatible language setting found in test
^KT-59057

Merge-request: KT-MR-10587
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-06-15 19:58:04 +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