Commit Graph

47474 Commits

Author SHA1 Message Date
wrongwrong a5bf8787a1 Reflection: exclude DEFAULT_CONSTRUCTOR_MARKER when calculating mask size
#KT-65156 Fixed
2024-02-09 17:54:16 +00:00
Abduqodiri Qurbonzoda 0033c9c23a Unmute unsafeAssignmentExtra test #KT-65218
As the result of the latest changes to stdlib, the muted test succeeds.
Thus "java.lang.AssertionError: Test contains MUTE_LL_FIR directive but
no errors was reported. Please remove directive".
It was decided to unmute the test for now until the compiler team
fixes the issue. See KT-65218
2024-02-09 17:20:15 +00:00
Sergej Jaskiewicz 4c06673483 [klib] Add a test for clashing signatures in property delegates 2024-02-09 16:45:34 +00:00
Sergej Jaskiewicz 0c0943a880 [klib] Add a test for KT-65551 2024-02-09 16:45:34 +00:00
Sergej Jaskiewicz 03ca64c954 [klib] Make CONFLICTING_KLIB_SIGNATURES_DATA diagnostic more precise
Show what kind of declarations exactly are clashing: functions,
properties, or fields.

This is so that diagnostics about clashing properties and fields are
distinguishable from one another, since properties and fields
are rendered the same way in those diagnostics:
2024-02-09 16:45:34 +00:00
Sergej Jaskiewicz d80a67652f [klib] Fix NIE when showing signature clash diagnostics on properties
The issue was that when rendering declarations in
the `CONFLICTING_KLIB_SIGNATURES_DATA` diagnostics, we sort them using
`MemberComparator`. That comparator falls back to comparing
declarations' renders if all previous checks were unsuccessful
(and in case of almost identical properties they are). The renderer that
the comparator uses also renders the properties' backing field
annotations, for which it calls `PropertyDescriptor#getBackingField`.
That method wasn't implemented in IR-based descriptors.

This is fixed by returning an instance of the new
`IrBasedBackingFieldDescriptor` class from that method.

^KT-65551 Fixed
2024-02-09 16:45:34 +00:00
Pavel Kunyavskiy b4062c8974 [Fir2IR] Fix fake override generation for lazy accessors
^KT-65595 Fixed
2024-02-09 13:27:15 +00:00
Marco Pennekamp d121b529b5 [IR] Remove strong references to IR entities in CompilationException
- `CompilationException` should not strongly reference `IrFile`s and
  other IR elements, which in turn reference FIR elements strongly. It
  can lead to a memory leak in the IDE as the exception is held
  statically in the IDE's `MessagePool`.
- I considered fixing this on the level of `KtCodeCompilationException`
  from the Analysis API, but:
  1. `KtCodeCompilationException` can wrap many kinds of exceptions.
     Snapshotting the cause only for `CompilationException` (somewhere
     down the cause chain) would be messy, as it'd require traversing
     the cause chain and referencing `CompilationException` directly,
     breaking API boundaries.
  2. Keeping the same level of report quality while snapshotting a cause
     is not trivial.
  3. Exceptions in general should be as lean as possible, so it makes
     sense to fix `CompilationException` itself.

^KT-65655 fixed
2024-02-09 13:12:40 +00:00
Denis.Zharkov a4ccb72b94 Add tests making sure that a couple of issues are fixed by PCLA
^KT-49283 Fixed
^KT-64077 Fixed
2024-02-09 13:03:12 +00:00
Denis.Zharkov fb8cc00d1f Minor. Mention KT-49160 in relevant test data 2024-02-09 13:03:12 +00:00
Pavel Mikhailovskii 7ab9e03347 KT-65684: KAPT: (Re)enable fallback to K1 KAPT and make it default
[KAPT] KT-65684 Set languageVersion=1.9 in KaptToolIntegrationTestGenerated

[KAPT] KT-65684 Re-enable a few now-passing tests in Kapt4IT

[KAPT] KT-65684 Fix the logic setting -Xuse-kapt4 flag in Kapt4IT.forceKapt4()

The change is needed to make sure that all the tests have the flag set,
 otherwise some of them would silently switch to the fallback node.
Also disables a few now failing tests.

[KAPT] KT-65684 Revert "KT-64385 Enable K2 KAPT by default"

This reverts commit 7e9d6e60


Merge-request: KT-MR-14291
Merged-by: Pavel Mikhailovskii <Pavel.Mikhailovskii@jetbrains.com>
2024-02-09 12:54:28 +00:00
Mikhail Glukhikh e532220305 K1/K2: add a test fixing behavior of overloadResolutionByLambda/PCLA combo 2024-02-09 11:38:34 +00:00
Mikhail Glukhikh 8217aa9633 K2: introduce fun interface PostponedAtomAnalyzer to make code cleaner 2024-02-09 11:38:34 +00:00
Mikhail Glukhikh 9b2fc061e5 K2: drop unused ConeStubTypeForSyntheticFixation 2024-02-09 11:38:34 +00:00
Mikhail Glukhikh f1aaae9515 K2: reorganize code in ConstraintSystemCompleter around PCLA mode 2024-02-09 11:38:34 +00:00
Mikhail Glukhikh 56475c0a5b Rename: builderInferenceSession -> pclaInferenceSession 2024-02-09 11:38:34 +00:00
Mikhail Glukhikh 195d3604ae Add 'K2Only' OptIn for 'usesOuterCs' 2024-02-09 11:38:34 +00:00
Mikhail Glukhikh e54ed9d470 Cleanup FirPCLAInferenceSession 2024-02-09 11:38:34 +00:00
Mikhail Glukhikh 9743a5b334 K2: drop unused parameter in ConstraintSystemCompleter 2024-02-09 11:38:34 +00:00
Mikhail Glukhikh f0ac963474 K2/PCLA: add explicit withPCLASession: Boolean parameter to analyzeLambda 2024-02-09 11:38:34 +00:00
Mikhail Glukhikh c7bc8547da K2: inline notFixedInputTypeVariables in ConstraintSystemCompleter 2024-02-09 11:38:34 +00:00
Roman Efremov 1f30d076de [CLI] Introduce compiler argument to suppress error about API version
...greater than language version.

^KT-63712
2024-02-09 11:02:26 +00:00
Mikhail Glukhikh 5e4c0186ac Fix exception in checker stage of FirResolveModularizedTotalKotlinTest
#KT-65468 Fixed
2024-02-09 09:34:19 +00:00
Ilmir Usmanov f1fd84f539 Put $completion parameter to LVT
The parameter, unlike other ones, should span the whole method, since
throughout the whole method it has some value and thus should be
visible.

This effectively rolls bb5a99ec back

 #KT-64309 Fixed
2024-02-08 22:58:20 +00:00
Dmitrii Gridin c52b9032ce [LL FIR] pull up custom logic for synthetic properties and accessors
We should process them independently as they can be not related to each
other

^KT-65563 Fixed
2024-02-08 22:28:13 +00:00
Sergej Jaskiewicz 403e9a3df8 [FIR2IR] Simplify insertImplicitCasts() calls
This method always returns `this`, so no need to reassign.
2024-02-08 22:16:20 +00:00
Sergej Jaskiewicz 88b80e0ed2 [FIR2IR] Add Unit coercion for non-last expressions in try/catch blocks
^KT-61088 Fixed
2024-02-08 22:16:20 +00:00
Sergej Jaskiewicz 3d66511ca7 [FIR2IR] Remove unused method from Fir2IrImplicitCastInserter 2024-02-08 22:16:20 +00:00
Sergej Jaskiewicz b5793222d8 [test] Drop unnecessary WITH_STDLIB in an irText test 2024-02-08 22:16:20 +00:00
Alexander Shabalin 4468167a64 [K/N] Move kotlin-native/utilities/basic-utils to compiler/utils 2024-02-08 20:43:11 +00:00
Evgeniy.Zhelenskiy 3ab6e9de28 [K2, CLI] Fix error message in master after merging fix for KT-64989 2024-02-08 19:50:58 +00:00
Alexander Udalov 3f034e8b67 Enable lightweight lambdas (aka invokedynamic) since 2.0
#KT-45375 Fixed
 #KT-58173 Open
2024-02-08 19:46:18 +00:00
Alexander.Likhachev 10cedd495d [BTA] Add Kotlin version getter into CompilationService
^KT-62921 In Progress
2024-02-08 19:11:26 +00:00
Nikita Bobko 58e1c4c6ac [FIR] Kmp: Deprecate header/impl keywords
Review: https://jetbrains.team/p/kt/reviews/14224/timeline

Timeline:
**(1)** Kotlin 1.1.60 https://github.com/JetBrains/kotlin/commit/59efedf610a25b004edf3d19897ce4dfca28ddb2 `header` keyword is introduced (committed on Dec 13, 2016)
**(2)** Kotlin `header`/`impl` has been deprecated (warning) at least since 1.1.60 https://github.com/JetBrains/kotlin/commit/5d251062677e09d607f295189b7978d5833e448f (committed on Sep 15, 2017)
**(3)** 1.1.60 release https://repo1.maven.org/maven2/org/jetbrains/kotlin/kotlin-compiler/1.1.60/ Nov 13, 2017

It sounds stupid but it looks like `header` was introduced and
deprecated right in the same release. Though it may be possible that we
had a release between **(1)** and **(2)** that I couldn't find

Anyway the keywords have been deprecated since basically forever

The fix is not perfect

"The perfect fix" would be:
1. Introduce a separate `DEPRECATED_MODIFIER_ERROR` diagnostic
2. Introduce LanguageVersionSettings for the `DEPRECATED_MODIFIER_ERROR`
   diagnostic

But "the perfect fix" requires:
1. Adopting `ReplaceModifierFix` in the IDE to make it work with the new
   diagnostic. `ReplaceModifierFix` is only implemented in K1 IDE. So
   there are two ways:
   1. Create a KTIJ ticket to port the diagnostic to K2 IDE (it needs to
      be ported anyway), and **mention** in the ticket that
      `DEPRECATED_MODIFIER_ERROR` also needs to be supported in K2 IDE.
      It's the ticket that nobody will probably find and fix
   2. Go and port `ReplaceModifierFix` to K2 IDE myself. It's fairly
      simple task, but I've not worked in intellij for quite a while,
      and it will take me too much time to index and compile

Considering that DEPRECATED_MODIFIER diagnostic is used only to report
`header`/`impl`, and there are literally 0 known cases when people use
it. It's just easier to convert the diagnostic to error in K2

Related tests:
- compiler/testData/diagnostics/tests/multiplatform/deprecated/header.kt

^KT-59839 Fixed
2024-02-08 16:34:27 +00:00
Vladimir Tagakov 11d3ead975 jvm-abi-gen: Remove effectively private classes from ABI
#KT-64590 Fixed
2024-02-08 15:19:50 +00:00
Igor Yakovlev be6b9e8a9a [Wasm] Support lazy associated object initialisation
Fix #KT-63939
2024-02-08 14:15:17 +00:00
Evgeniy.Zhelenskiy 7eab4b672d [K1, K2, CLI] Mark whole position range of compiler diagnostics in CLI
#KT-64989
2024-02-08 12:59:31 +00:00
Egor Kulikov 926c0a9136 [FIR] Fix naming for light tree delegate and expression conversion 2024-02-08 11:54:00 +00:00
Mikhail Glukhikh f3523edb61 Minor cleanup of approximateCapturedType comments/code 2024-02-08 10:49:55 +00:00
Mikhail Glukhikh 44dcae2090 Rename: type -> capturedType 2024-02-08 10:49:55 +00:00
Mikhail Glukhikh 94bcf6d87f K2: handle recursive types properly in approximation
This commit is intended to deal with inconsistency in K1/K2
star projection handling.
K1 star projection includes a 'type' property.
This type from a star projection can be used for relevant
functions / properties return types,
and already includes some approximation for recursive generics.
In contrast, K2 star projection is an object,
and return types of relevant functions / properties are
represented as captured types.
To prevent recursion in them in recursive generic case,
this commit includes additional replacement of their type arguments.
See more details in added comments.

#KT-65057 Fixed
2024-02-08 10:49:55 +00:00
Mikhail Glukhikh c4d6554493 K2: reproduce KT-65057 2024-02-08 10:49:55 +00:00
Brian Norman c8e77aad91 [FIR] Fix CFG/DFA for delegate properties within PCLA
^KT-65262 Fixed
2024-02-07 22:34:12 +00:00
Brian Norman 1f904aef55 [FIR] Enhance equality smartcasting test case to include data classes
^KT-58169 Fixed
2024-02-07 22:26:16 +00:00
Brian Norman 9f5589614a [Test] Allow alternate output for box tests 2024-02-07 21:51:17 +00:00
Ivan Kochurkin 6570d3fd55 [FIR] Minor fixes in FirDelegateUsesExtensionPropertyTypeParameterChecker
Fix a link in DELEGATE_USES_EXTENSION_PROPERTY_TYPE_PARAMETER message
2024-02-07 21:15:59 +00:00
Ivan Kochurkin c4e0cafe9c [FIR] Check DELEGATE_USES_EXTENSION_PROPERTY_TYPE_PARAMETER for anonymous objects
^KT-64102 Fixed
2024-02-07 21:15:59 +00:00
Mikhail Glukhikh 8ee54a9045 K2: add a test to ensure #KT-63756 Fixed 2024-02-07 20:56:04 +00:00
Igor Chevdar 6c05219485 [IR][K/N] Extracted explicit var spilling phase from coroutines lowering
Not only does it give some flexibility but also it could be turned off
in the future (by providing trivial replacement) as a workaround

 #KT-65153
2024-02-07 18:54:31 +00:00
Igor Chevdar 954eade78c [IR][K/N] Refactored a bit SuspendFunctionLowering 2024-02-07 18:54:31 +00:00