954 Commits

Author SHA1 Message Date
Mikhail Glukhikh cd20f31810 K2: introduce JavaTypeParameterDefaultRepresentationWithDNN exp. feature
#KT-66447 Fixed
2024-03-14 22:39:03 +00:00
Artem Kobzar 4f4c98ec73 [K/JS] Allow parameter properties inside external declarations ^KT-65965 Fixed 2024-02-29 09:46:59 +00:00
Nikita Bobko 052baf1b04 Revert "[FIR] Enable ForbidInferringTypeVariablesIntoEmptyIntersection in 2.0"
^KT-66196 Fixed
Keep it a warning in 2.0

This reverts commit be232d3e6f.
2024-02-28 18:08:11 +00:00
Dmitriy Novozhilov 88206ca151 [Util] Allow to use Throwable as cause of ExceptionWithAttachment 2024-02-28 08:28:14 +00:00
Dmitrii Gridin 072d191306 [compiler] replace Enum values() with entries
To fix warnings. Also, use of `Enum.entries` may improve the performance

^KT-48872
2024-02-20 17:56:46 +00:00
Ivan Kochurkin 04ead1716a [FIR] Prohibit constructor and supertype on typealias with type projection
Introduce `CONSTRUCTOR_OR_SUPERTYPE_ON_TYPEALIAS_WITH_TYPE_PROJECTION`

^KT-60305 Fixed
2024-02-19 19:27:28 +00:00
Roman Efremov 3994e3f63a [FIR] Deprecate using typealias as callable qualifier in import
^KT-64350 Fixed
2024-02-15 08:37:02 +00:00
Pavel Kunyavskiy 6e8a7d4662 [ObjCInterop] Implement @ObjCSignatureOverride
This annotation leads to conflicting overloads error supression,
in case where several function with the same argument types,
but different argument names are inherited from ObjC class.

We need to implement it in both K1 and K2 to make the IDE experience
better.
But the annotation itself wouldn't be available in K1.

    ^KT-61323
2024-02-14 11:44:01 +00:00
Alexander Shabalin 4468167a64 [K/N] Move kotlin-native/utilities/basic-utils to compiler/utils 2024-02-08 20:43:11 +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 Udalov 28797a31b4 JVM: refactor JvmDefaultMode, remove/rename some entries
- remove ENABLE/COMPATIBILITY because they can no longer be used
- remove forAllMethodsWithBody because its behavior is now equivalent to
  isEnabled
- inline isCompatibility
- inline DEFAULT
- rename ALL_INCOMPATIBLE -> ALL
2024-02-06 17:18:44 +00:00
Kirill Rakhman 376a9b8ace [FIR] Implement deprecation for accessing private operators from public inline function
This only affects delegation operators as well as the for-loop-related
next and hasNext operators.
All the other operators worked correctly before.
In K2, the previously mentioned operator calls will be flagged with a
deprecation error and will become and error in 2.1.

#KT-59782 Fixed
2024-02-06 11:18:25 +00:00
Nikita Bobko d69deb97fe K2: Put boolean DFA variables under a feature flag
^KT-62547 Fixed

I also tested the commit by disabling DfaBooleanVariables in all tests
and checking what tests will fail

I didn't find anything that worked in K1, but doesn't work in K2 with
DfaBooleanVariables disabled

Related tests:
- DiagnosticCompilerTestFirTestdataTestGenerated$Resolve$Smartcasts
- LLFirPreresolvedReversedDiagnosticCompilerFirTestDataTestGenerated$Resolve$Smartcasts
- PreFirIdeSpecTestGenerated$NotLinked$Dfa
- DiagnosticCompilerTestFE10TestdataTestGenerated$Tests$SmartCasts
- FirPsiDiagnosticTestGenerated$Resolve$Expresssions.testSyntheticSmartCast
2024-01-31 16:31:02 +00:00
Pavel Kirpichenkov ce3c05500e [LL] Sort modules from the same KMP project in symbol providers
Sort dependency modules topologically if they belong to the same KMP
project, preserving their relative positions. Sorting all modules and
changing positions of unrelated modules can be harmful: in the case of
a classpath hell, IDE results can become different from runtime
behavior. Sorting in place can help to avoid this problem, because
conflicting declarations shouldn't be allowed in different source sets
of the same multiplatform project.

KTIJ-27569
2024-01-19 10:20:52 +00:00
Kirill Rakhman e91e9d8ca8 [FIR] Don't lose error level enhancements in warning-level-enhanced arguments
The error-level enhancement is kept as warning-level and a new
LanguageFeature is introduced to turn the warning into an error.

#KT-63208 Fixed
#KT-63209

(cherry picked from commit 371b1eb3d5)
2024-01-18 08:27:10 +00:00
Kirill Rakhman 121536d2e5 Revert "[FIR] Don't lose error level enhancements in warning-level-enhanced arguments"
This reverts commit 371b1eb3d5.
2024-01-16 09:14:21 +01:00
Kirill Rakhman 371b1eb3d5 [FIR] Don't lose error level enhancements in warning-level-enhanced arguments
The error-level enhancement is kept as warning-level and a new
LanguageFeature is introduced to turn the warning into an error.

#KT-63208 Fixed
#KT-63209
2024-01-15 12:23:26 +00:00
Nikita Bobko 60365cc116 Revert "Make it possible to enable "non-local break and continue" with -language-version flag"
This reverts commit 96b2f13397.

Unfortunately, in K2, the feature works only in JVM. KT-56466 The
feature is postponed till 2.2 (preview is postponed till 2.1)

KT-1436
2024-01-11 15:16:26 +00:00
Nikita Bobko 96b2f13397 Make it possible to enable "non-local break and continue" with -language-version flag
We initially wanted to release the feature in 1.9.0, but found a bug in
K1 KT-54906. It was decided to postpone the feature release to 2.1, but
at this time KOTLIN_2_1 didn't exist

In this commit I make it possible to enable the feature with
-language-version 2.1 flag, so users can "preview" this feature in 2.0

KT-1436
2024-01-10 10:19:15 +00:00
Mikhail Glukhikh fabeb7fbef Move JsAllowInvalidCharsIdentifiersEscaping to the proper section 2023-12-21 07:43:38 +00:00
Mikhail Glukhikh a7dc381b93 K2: disable compatibility mode for new inference
#KT-64306 Fixed
#KT-64307 Fixed
#KT-64308 Fixed
2023-12-20 21:39:21 +01:00
Artem Kobzar eb790732fd [K/JS] Enable identifiers escaping by default in 2.1 version ^KT-31799 Fixed 2023-12-20 16:39:19 +00:00
Mikhail Glukhikh c322644860 K2: report only warning on lambda parameters with missing dependencies
During the fix of KT-62525, we've forbidden to use lambda parameters
with inaccessible types at all. After it, some impact was noticed,
so we decided to forbid them only in case it's necessary
(the case when associated types have type arguments, see KT-62525
description), and to deprecate them in other cases.

#KT-64266 Fixed
2023-12-20 12:48:00 +00:00
Dmitriy Novozhilov fa33c5dc79 [FIR] Implement deprecation warning for synthetic without java base getter
Also implement new resolution behavior under language feature

^KT-63076 Fixed
^KT-64358
2023-12-19 09:04:26 +00:00
Nikita Bobko 45c5fd7a2d [FE] Introduce a language feature entry for expect actual classes
^KT-62885 Fixed
2023-11-07 20:05:59 +00:00
Nikita Bobko 7b8445f914 [FIR] 2/2 Support more wider actual member visibility, if the expect member is effectively final
^KT-61955 Fixed

Introduce LV vs don't introduce LV:

introduce LV:
- K1 IDE and K2 project: IDE accurately shows compiler errors
- K2 IDE and K1 project: There are cases when IDE shows red but in reality it's green

don't introduce LV:
- K1 IDE and K2 project: There are cases when IDE shows red but in reality it's green
- K2 IDE and K1 project: There are cases when IDE shows green but in reality it's red
2023-11-07 15:53:54 +00:00
Alejandro Serrano Mena f227447837 [K2] Disallow named functions as expressions
^KT-62573 Fixed
^KT-59945 Fixed
2023-10-25 13:24:30 +00:00
Marco Pennekamp 38ebe60e9f [FIR] Refactoring: Move set utility functions to setUtils.kt 2023-10-25 11:04:36 +00:00
Nikolay Lunyak ba9baa7457 [FIR] Don't enable features without sinceKotlin in Progressive Mode
There are two BUG_FIX features that have
been added to the compiler, without a clear
decision to enable them somewhere in the
future. Since there is no decision to
force users rewrite their code, such
features should not be enabled in
Progressive Mode.

^KT-62644 Fixed
^KT-62143 Fixed
2023-10-18 13:16:10 +00:00
Ilya Goncharov a79324037d [JS] Fix JPS artifacts cordinates 2023-10-16 13:34:37 +00:00
Roman Efremov d09c3783fd [K2] Fix mistake in language feature name for
...`DEFAULT_ARGUMENTS_IN_EXPECT_ACTUALIZED_BY_FAKE_OVERRIDE`
diagnostic.

^KT-62036
2023-10-13 12:30:41 +00:00
Aleksei.Cherepanov a32c65e4e1 Convert absolute to relative pluginsClasspath..
..to avoid recompilation on build with portable caches

#KT-62256 Fixed


Merge-request: KT-MR-12377
Merged-by: Aleksei Cherepanov <aleksei.cherepanov@jetbrains.com>
2023-10-05 10:25:53 +00:00
Roman Efremov 81fd9a679d [FIR] Prohibit expect class members with default values actualized
...by fake-override.
It is error without deprecation cycle because `expect` and `actual`
classes are still in Beta and expected impact of change is negligible.

^KT-62036 Fixed
2023-10-02 15:50:37 +00:00
Mikhail Glukhikh 156097fe17 Restore KotlinCompilerVersion.IS_PRE_RELEASE
This commit is a slightly modified revert of 4f29c113.
IS_PRE_RELEASE allows to make LATEST_STABLE version behave as
experimental when this flag is set to true.
The general goal is to prepare fix of KT-62058; after this commit
one can do it by changing IS_PRE_RELEASE flag to true.
The fix of KT-62058 is planned to be done during bootstrapping.
This preparation and the future fix are parts of umbrella KT-61951.
2023-09-21 20:09:25 +00:00
Mikhail Glukhikh 5fb38008b7 Switch Kotlin version to 2.0
#KT-59171 In Progress
2023-09-19 15:46:26 +00:00
Iaroslav Postovalov fd2954a8d3 Move DummyDelegate to :compiler:util
Deleted DummyDelegate from a pair of usages across the project, and
moved it to :compiler:util module to avoid further duplicates
2023-09-13 09:51:13 +00:00
Nikita Bobko 7667b36aa0 KMP: Put "prohibit member scope mismatch for non-final expect" under the flag
^KT-61668 Fixed

Review: https://jetbrains.team/p/kt/reviews/12062/timeline
2023-09-08 10:51:42 +00:00
Alexander.Likhachev 6f96be0b76 [Build] Get rid of the testApiJUnit5 method
#KTI-1349 In Progress
2023-09-06 22:47:34 +00:00
Nikolay Lunyak 13a7bb95b3 [FIR] Relax MULTIPLE_DEFAULTS_* to account for the K1 behavior
^KT-56442
^KT-36188
2023-08-28 10:57:40 +00:00
Nikolay Lunyak 77feb86a85 [FIR] Report the use of inline on primary constructor parameters
^KT-59664 Fixed
2023-08-25 12:23:56 +00:00
Ilya Kirillov e3d2bccb33 [LL FIR] fix user code leak from exceptions in :analysis:low-level-api-fir
Also, add more info to some exceptions
2023-07-26 14:29:20 +00:00
Ilya Chernikov 776cdbcd3f minor: small cleanup in K2 scripting support code 2023-07-26 08:49:27 +00:00
Ilya Kirillov 24db4e62f5 Migrate some FIR/Analysis API KotlinExceptionWithAttachment usages to buildErrorWithAttachment API 2023-07-18 11:49:21 +00:00
Ilya Kirillov 24f60a542d Add basic test for getElementTextWithContext 2023-07-18 11:49:21 +00:00
Ilya Kirillov a9cd881a07 [FIR] add utilities to FIR compiler to throw error with attachment 2023-07-18 11:49:20 +00:00
Ilya Kirillov c5014d4765 Move PsiElement.getElementTextWithContext to psi module with small adjustments
* replace existing function (the new one makes it more clear which element was printed)
* prints position for element
* handles invalid psi element
2023-07-18 11:49:20 +00:00
Ilya Kirillov 4b3bff3344 Rework checkWithAttachment/requireWithAttachment
* better naming
* throw corresponding KotlinIllegalStateExceptionWithAttachments/KotlinIllegalArgumentExceptionWithAttachments instead of general KotlinRuntimeExceptionWithAttachments
2023-07-18 11:49:20 +00:00
Ilya Kirillov 2d791eb292 Rename buildErrorWithAttachment -> errorWithAttachment to emphasise the similar semantics to kotlin.error 2023-07-18 11:49:20 +00:00
Ilya Kirillov e3c31e1387 Introduce exception-specific exception classes for KotlinExceptionWithAttachments 2023-07-18 11:49:20 +00:00
Ilya Kirillov 52c065b08a Extract a base class from KotlinExceptionWithAttachments 2023-07-18 11:49:20 +00:00