Commit Graph

892 Commits

Author SHA1 Message Date
Nikita Bobko de8c3826c2 [FE] Prohibit missed MUST_BE_INITIALIZED when there is no primary constructor
^KT-58472 Fixed
Review: https://jetbrains.team/p/kt/reviews/9967
2023-05-23 14:12:29 +03:00
Nikita Bobko ac40010501 [FE] Prohibit open val deferred initialization
^KT-57553 Fixed
Review: https://jetbrains.team/p/kt/reviews/9967

Other related tests:
- testUninitializedOrReassignedVariables
- testUseOfPropertiesWithoutPrimary
- @TestMetadata("compiler/testData/diagnostics/tests/secondaryConstructors")
- testAugmentedAssignmentInInitializer
- testInitOpenSetter
- testInitOverrideInConstructorComplex
- testPropertyInitializationOrder
2023-05-23 14:12:28 +03:00
Kirill Rakhman df03f0df0a [FIR] Implement deprecation for implementing var by inherited val
#KT-56779 Fixed
2023-05-19 15:04:46 +00:00
Mikhail Glukhikh 5fda57fa55 FE: delay DisableCheckingChangedProgressionsResolve to 2.*
This commit removes the relevant feature from 1.9 and
makes this feature experimental.
We plan to enable it in some 2.* version (not earlier than 2.1)

Related to KT-54261, KT-36932, KT-49276
#KT-58791 Fixed
2023-05-19 14:57:26 +00:00
Denis.Zharkov fa85cbfe74 Enable ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated in 1.9
^KT-36770 Related
^KT-53041 Fixed
^KT-55388 In Progress
2023-05-15 10:43:19 +00:00
Nikita Bobko 9a65dcb664 MUST_BE_INITIALIZED: take into account containingDeclaration's modality
^KT-58587 Fixed
Review: https://jetbrains.team/p/kt/reviews/10136

This commit is important in scope of KT-57553. It makes the migration
more smooth.

Other related tests:
- testUninitializedOrReassignedVariables
- testAugmentedAssignmentInInitializer
2023-05-12 13:48:49 +00:00
Mikhail Glukhikh 94c94d0605 K1: add a language feature to negate new errors from DiagnosticReporterByTrackingStrategy
Related to KT-55055, KT-55056, KT-55079, KT-57854
2023-05-01 11:47:01 +00:00
Alexander Udalov fc0ce415d7 JVM: remove source code from not null assertion message text
This is implemented under a LanguageFeature which will be enabled later,
when behavior change described in KT-57570 is approved.

 #KT-57570
2023-04-28 10:26:15 +00:00
Nikolay Krasko 3caa1d1349 Refactoring: fix usages of @TestOnly ExtensionsArea.registerExtensionPoint 2023-04-28 08:25:19 +00:00
Alexander Udalov a0790047f7 JvmDefault: remove -Xjvm-default modes "enable" and "compatibility"
#KT-54746
2023-04-25 14:33:00 +00:00
Nataliya.Valtman 2a391f7330 Move kotlin-build-statistic project to :compiler 2023-04-25 11:29:09 +00:00
Yahor Berdnikau eb4e96a113 Add kotlin-build-tools-enum-compat workaround
It acts as a workaround for the case when build tools or dependencies
are compiled with latest 'kotlin-stdlib' version, but at a runtime older
 'kotlin-stdlib' is provided, which does not know about new
 `EnumEntries`.

 ^KT-57317 Fixed
2023-04-21 14:57:17 +00:00
Roman Golyshev d4cffb8a5a [213] Switch to 213 platform
KTI-1114
2023-04-21 13:19:04 +00:00
Nikita Bobko 5a96754aec Shift ReferencesToSyntheticJavaProperties feature release from 1.9 to 2.1
Other related tests:
- testGenericJavaProperty
- testFunInterfaceConstructorReference

Meta issue: KT-8575
Review: https://jetbrains.team/p/kt/reviews/9595

UnsupportedSyntheticCallableReferenceChecker only existed for K1,
because we wanted to release the feature for 1.9 and the feature should
have been working for K2 unconditionally. But since, we're postponing
the release until 2.1, we also need to port the checker from K1 to K2
2023-04-17 17:42:01 +00:00
Mikhail Zarechenskiy fc37885d6d K1: report a warning for invisible setter accessed from a derived class
The issue is that during binding fake overrides, the compiler doesn't
 differ setters from its properties, so the compiler uses the same
 visibility for setter and entire property.

 Changing logic at the binding stage can cause some unpredictable consequences so
 the fix is to do this differentiation right at the reporting stage

 ^KT-56662 Fixed

Merge-request: KT-MR-9565
Merged-by: Michail Zarečenskij <Mikhail.Zarechenskiy@jetbrains.com>
2023-04-17 11:08:16 +00:00
Iaroslav Postovalov fb80c0cb0d Override toString function in stdlib delegates
Co-authored-by: ilya-g <ilya.gorbunov@jetbrains.com>
2023-04-11 14:46:29 +00:00
Pavel Kunyavskiy 09474758ab [K/N] Fix typo in language feature name 2023-04-04 09:13:36 +00:00
Nikolay Lunyak f0720c1d12 [FIR] Fix K2 behavior according to RULES1
The compiler should only report diagnostics for
comparisons over builtins and identity-less types,
other incompatibilities should be reported
via inspections.

It's ok that in `equalityChecksOnIntegerTypes`
instead of `EQUALITY_NOT_APPLICABLE_WARNING` we get
`EQUALITY_NOT_APPLICABLE`, because
`ProperEqualityChecksInBuilderInferenceCalls`
is already active by default.

This change also replaces the notion of a representative superclass
with the least upper bound.
This makes complex types like
intersection/flexible transparent to
RULES1-based compatibility checks.
One way to look at it is to think
that this is an automatic way of handling
type parameters: automatic picking of
"interesting" bounds, and checking them against one another.

Note that `TypeIntersector.intersectTypes`
for `Int` and `T` where `T` is a type parameter
may return both `{Int & T}` or `null`
depending on `T`-s bounds. At the same time,
for type parameters `T` and `K` it will
always return `{T & K}`.

`ConeTypeIntersector.intersectTypes`, on the
other hand, will always return `{Int & T}`
irrespectively of the bounds. Meaning, the two
intersectors differ in corner cases.

`lowerBoundIfFlexible` call in `isLiterallyTypeParameter` is backed by
the `equalityOfFlexibleTypeParameters` test.

^KT-35134 #fixed-in-k2
^KT-22499 #fixed-in-k2
^KT-46383 #fixed-in-k2
2023-03-31 15:01:50 +00:00
Dmitriy Dolovov a450866db3 [PL] Commonize Native & JS compiler configuration keys 2023-03-30 12:38:07 +00:00
Dmitriy Dolovov 831611d577 [PL] Introduce new CLI parameter: -Xpartial-linkage-loglevel
The parameter controls the level of logs produced during the compile time by the partial linkage: 'info', 'warn' (default for now), and 'error'.
2023-03-30 12:38:06 +00:00
Denis.Zharkov 2622e593b5 Postpone KeepNullabilityWhenApproximatingLocalType until 2.0
See KT-53982
It's been decided to postpone enabling the bug fix, since there's been
 too little time for deprecation
2023-03-30 10:42:31 +00:00
Ivan Kylchik b28d9a1b48 Add new IntrinsicConstEvaluation language feature
This feature will allow to evaluate function marked with
`IntrinsicConstEvaluation` annotation and so use such function
in `const val`.
2023-03-21 20:02:43 +00:00
Ivan Kylchik 6bce668cac Introduce language version 2.1 2023-03-21 20:02:42 +00:00
Nikita Bobko 48ed6c4cc7 2/2 Implement deprecation for use-site '@get:' target
^KT-15470 Fixed
Review: https://jetbrains.team/p/kt/reviews/9250
2023-03-21 13:29:10 +01:00
Mikhail Glukhikh a43a16b25b Delay ForbidInferringPostponedTypeVariableIntoDeclaredUpperBound to 2.0
#KT-57395 Fixed
Related to KT-47986
2023-03-20 11:11:41 +00:00
Mikhail Glukhikh 41c868445c K1: introduce smartcast deprecation for a public API property in invisible class
#KT-56511 Fixed
Related to KT-57290
2023-03-17 14:57:40 +00:00
Mikhail Glukhikh 47fab61716 FE: introduce AllowEmptyIntersectionsInResultTypeResolver feature
Related to KT-51221
2023-03-11 10:15:24 +00:00
Mikhail Glukhikh f7544aff62 Delay ForbidInferringTypeVariablesIntoEmptyIntersection to 2.*
Note: here we set sinceVersion = null for this feature.
However, we plan in 1.9.* - 2.0 time frame to solve KT-56377
and to enable this feature in 2.0, the latest in 2.1.
2023-03-11 10:15:22 +00:00
Mikhail Zarechenskiy 82524fde26 K1: Place integer cinterop conversions under a language feature
Note that it's quite hard to emit a particular diagnostic as
 type check happens later, after the conversion

 ^KT-56583
2023-03-10 09:48:01 +00:00
Yahor Berdnikau 0cad069522 [Build] Pin api and language level to 1.8 in Kotlin compiler modules used by KGP
This is required to be able to compile KGP and it's dependencies which
set LV to 1.4 when repo will use LV 1.9. This caused by the change how
enums are compiled (KT-48872).
2023-02-18 13:26:54 +00:00
Alexander Korepanov 43cef114c6 [Compiler CLI] Sort flags and features before appending them to string
JS IR BE incremental compilation infrastructure uses
 LanguageVersionSettings::toString method to detect if any
 compiler features or flags were enabled or disabled.
 It is important that the features and flags order are stable
 in the result string.

^KT-56580 Fixed
2023-02-15 13:24:11 +00:00
Mikhail Glukhikh 7d8a1e9c1c Delay EnhanceNullabilityOfPrimitiveArrays to version 2.0
See KT-54521
2023-02-14 11:52:00 +00:00
Mikhail Glukhikh 81ac94b2d7 FE: convert LanguageVersion.versionString to a stored property
Suggested by Yuriy Artamonov
#KT-56276 Fixed
2023-02-08 12:51:21 +00:00
Svyatoslav Kuzmich e517df1533 [Wasm] Mark JsAllowImplementingFunctionInterface with OTHER kind
This fixes test failures when advancing bootstrap.

When a language feature has UNSTABLE_FEATURE kind, enabling it causes
the compiler to mark the compiled library with the pre-release flag.

JsAllowImplementingFunctionInterface feature is enabled by default in
Wasm backend. So effectively, all Wasm klibs are marked with the
pre-release flag, including the standard library.

Pre-release checks were enabled recently and cause compiler errors.

To fix the problem, this commit changes the feature kind to OTHER, which
doesn't enforce the pre-release flag.

Merge-request: KT-MR-8582
Merged-by: Svyatoslav Kuzmich <svyatoslav.kuzmich@jetbrains.com>
2023-01-31 10:18:08 +00:00
Dmitriy Novozhilov 4c96495eef [FIR] Put new contract syntax under feauture flag
^KT-55171 Fixed
2023-01-31 07:53:09 +00:00
Marco Pennekamp d6cb75ca91 [LL FIR] KT-55329 Support transitive dependsOn dependencies in LL FIR
- In contrast to other kinds of dependencies, `dependsOn` dependencies
  must be followed transitively.
- Add `transitiveDependsOnDependencies` to `KtModule`. These
  dependencies are calculated lazily with a topological sort. They are
  added to the dependency provider when it's built in
  `LLFirSessionFactory`.

^KT-55329 fixed
2023-01-30 17:17:58 +00:00
Dmitriy Novozhilov 66544a4e00 Switch kotlin version to 1.9
with appropriate fixes in testdata, tests and other
places.
2023-01-30 09:29:55 +00:00
Mikhail Zarechenskiy 4dd7481ac3 Set Kotlin 1.9 and Kotlin 2.0 as ready for preview
^KT-56165
 ^KTIJ-24398
2023-01-25 13:09:38 +00:00
Mikhail Glukhikh 70fc891260 K2: move -Xuse-k2 VS language version checks to CommonCompilerArguments 2023-01-16 18:16:49 +01:00
Mikhail Glukhikh 17c434002a Move EnableDfaWarningsInK2 into experimental section until K2/IDE EAP
This commit means that we will not see K2 DFA warnings until
we explicitly enable them (probably in 1.9.20 or 2.0).
We are going to enable DFA warnings at the moment when
K2/IDE is accessible for external users
2023-01-16 18:12:55 +01:00
Mikhail Glukhikh 3dc05f4ec5 Introduce language version 2.0 and associate K2 compiler with it 2023-01-16 18:12:55 +01:00
Svyatoslav Scherbina 4db7bac4c0 Switch JsAllowValueClassesInExternals kind from UNSTABLE_FEATURE to OTHER
When a language feature has UNSTABLE_FEATURE kind, enabling it causes
the compiler to mark the compiled library with the pre-release flag.

JsAllowValueClassesInExternals feature is enabled by default in JS IR
backend. So effectively, all JS klibs are marked with the pre-release
flag. This remained unnoticed because the compiler currently doesn't
read this flag from klibs. This will change soon.

To fix the problem, this commit changes the feature kind to OTHER, which
doesn't enforce the pre-release flag.
2023-01-06 16:57:38 +00:00
Pavel Kunyavskiy 4928e284f6 Make LateinitIntrinsicApplicabilityChecker warning for Native and JS
This checker was enabled only on JVM by mistake.
It's now fixed, but we don't want to make it an error in minor release.
So it will be an warning in 1.8.20 and an error in 1.9.0

^KT-27002
2022-12-20 20:06:52 +00:00
vladislav.grechko 18edf43ec7 Disable 'InlineLateinit' feature in 1.9 language version
The feature is not ready to be shown in preview

^KT-55247: Fixed
2022-12-13 10:27:01 +00:00
vladislav.grechko eb87b726e2 Disable 'CustomEqualsInValueClasses' feature in 1.9 language version
The feature is not ready to be shown in preview

^KT-55246: Fixed
2022-12-13 10:27:01 +00:00
Denis.Zharkov d34bd2e8c0 Postpone ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated
The main reason is a bug in deserialization(KT-55357) that doesn't allow
to deserialize some binaries compiled with that feature enabled.

While we might fix it in 1.8.0, it doesn't help because previous
compilers, e.g. 1.7.0 still may break when using freshly recompiled
libraries.

Considering, that almost any meaningful fix might look unsafe for
the almost released 1.8.0, we can't enable the feature even in 1.9,
because 1.8.0 compilers wouldn't read those libraries anyway.

So, effectively this feature will be only enabled in K2.

^KT-55357 Related
^KT-36770 Related
2022-12-12 11:39:04 +00:00
Evgeniy.Zhelenskiy abc1d942d1 [IR] Add tests for value classes secondary constructors with body and set language feature version for the feature
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-55333
2022-12-11 22:06:47 +01:00
Dmitriy Novozhilov 3cffb33ab7 [FE] Drop ApproximateIntegerLiteralTypesInReceiverPosition language feature
This feature is not needed because it is unconditionally disabled for K1
  (because of not fully correct implementation) and unconditionally enabled
  in K2 (K2 does not support old behavior)

^KT-38895
2022-12-09 15:10:02 +00:00
Pavel Mikhailovskii b4b05b7bf6 KT-8575 Enable references to synthetic Java properties in 1.9 2022-12-06 22:16:01 +00:00
Andrey Uskov c9e0100214 Remove experimental implementation of Kotlin Compiler Daemon
#KT-50846 Fixed
2022-12-05 16:02:03 +00:00