Commit Graph

879 Commits

Author SHA1 Message Date
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
Evgeniy.Zhelenskiy 9f01ccc304 [IR] Support user-defined equals for MFVC
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-11-30 18:55:36 +00:00
Evgeniy.Zhelenskiy 6107caa8e2 [FE1.0, FIR] Support secondary constructors for Value Classes
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-11-30 18:55:35 +00:00
Vladislav Grechko cd6e865fb3 Improve support of 'lateinit' modifier
- Allow 'lateinit' for inline classes which underlying type
is suitable for 'lateinit'

- K2: report all problems related to 'lateinit' modifier

^KT-55052: Fixed
2022-11-24 19:47:21 +00:00
Nikita Bobko 4f68684eba Postpone non-local break and continue feature till K2
Postpone because we found a bug KT-54906 in CFA/DFA in K1 which we are
not going to fix in K1

Meta-issue: KT-1436
2022-11-16 13:17:02 +00:00
Svyatoslav Kuzmich 78bd6dbdcd [Wasm] Allow implementing function interfaces 2022-11-14 11:23:18 +01:00
Alexander Korepanov d5e9e87538 [JS BE] Drop JS scripting support
JS scripting uses the old IR to JS transformer.
 The new IR to JS transformer can not be used for
 JS scripting out of the box. Patching the new transformer for
 JS scripting is potentially dangerous and requires a lot of effort.
 Dropping JS scripting and the old IR to JS transformer allows to
 refactor and simplify JS BE codebase.
2022-11-04 14:15:15 +00:00
Vladimir Dolzhenko 5dc2442872 Safe reporting PSI elements in KEWA 2022-11-03 17:27:11 +00:00
Nikita Bobko a926edd845 Disable ReferencesToSyntheticJavaProperties until the KEEP document is approved
KEEP document: https://github.com/Kotlin/KEEP/pull/329
2022-11-03 12:02:59 +00:00
Denis.Zharkov f95bfccf59 K1: Prolong deprecation for KT-46727
The language committee ticket has not yet been prepared
2022-11-01 12:03:26 +00:00
Nikita Bobko cdbfcdc465 Cleanup: LanguageFeature.defaultState -> LanguageFeature.isEnabledWithWarning
Review: https://jetbrains.team/p/kt/reviews/7418

`State` enum contains `DISABLED` item which is redundant for
`LanguageFeature`. It's redundant because `sinceVersion = null` is used
to express the same semantic.

I had to reorder some items in the enum because otherwise
`testLanguageFeatureOrder` fails. I could keep the same logic in
`testLanguageFeatureOrder` but I would need to make
`isEnabledWithWarning` public which I don't want to. Anyway, it's not
obvious what is more readable: keep `isEnabledWithWarning = true` items
at the end or at the beginning.

Also all effectively disabled features (`sinceVersion = null` or
`defaultState = State.DISABLED`) are now moved to the "Experimental"
section at the end which is obviously better.
2022-10-27 13:16:44 +02:00
Nikita Bobko 49a5186f15 Enable EnumEntries language feature by default
Related issue: KT-48872
Review: https://jetbrains.team/p/kt/reviews/7418

If we want to make the feature experimental then specifying
`sinceVersion` higher than the current compiler version is enough.
`defaultState = State.DISABLED` is redundant
2022-10-27 13:16:10 +02:00
Nikita Bobko 4e69d1248a Cleanup: drop unused LanguageFeature.State.ENABLED_WITH_ERROR
Review: https://jetbrains.team/p/kt/reviews/7418
2022-10-27 13:16:10 +02:00
Mikhail Glukhikh 8e48636b29 K1: don't report assignment TYPE_MISMATCH in BI under feature ON
Related to KT-54004
2022-10-26 09:21:48 +00:00