Commit Graph

27 Commits

Author SHA1 Message Date
Alexander Udalov 9c03dcd230 Do not write version requirements for suspend functions
Previous attempt was at 6807ed6642, but it was reverted in 7771e5914d
(see that commit for the explanation). Now it should be fine to remove
these version requirements.

No issue reported because it's mostly not a user-visible change. The
main effect is that it reduces differences in metadata between K1 and
K2, namely it fixes the ValueClass.kt kotlinp test.
2023-07-31 13:05:29 +00:00
Alexander Udalov afd35accd8 Do not write version requirements for InlineClasses
Language feature InlineClasses is enabled since 1.3. The current lowest
supported language version is 1.4, so any compiler that can read
binaries produced by the current compiler also supports inline classes,
which means that the version requirement is not needed anymore.

No issue reported because it's mostly not a user-visible change. The
main effect is that it reduces differences in metadata between K1 and
K2, because K2 never supported writing this version requirement properly
due to the TODO in `hasInlineClassTypesInSignature`.
2023-07-31 13:05:29 +00:00
Mads Ager 683220a32c [K1] Remove compiler version requirements for context receivers in metadata. 2023-03-17 07:15:13 +00:00
Alexander Udalov 7771e5914d Revert "Do not write version requirements for suspend functions"
This reverts commit 6807ed6642.

The reason is that Kotlin compilers until and including version 1.6.10
have code that detects obsolete coroutines via these version
requirements (see `versionAndReleaseCoroutinesMismatch`). Since Kotlin
1.6.10 can read metadata of version 1.7, the earliest we can drop these
version requirements is Kotlin 1.8.0.
2021-12-21 20:06:07 +01:00
Alexander Udalov 6807ed6642 Do not write version requirements for suspend functions
Coroutines are a stable feature since 1.3. Version requirement on
suspend functions, or functions mentioning suspend function types in the
signature, was needed to prevent older compilers from reading metadata
that they can't properly use. It's not needed anymore because a newer
metadata version prevents older compilers from reading any metadata
altogether.

Also, computing isSuspendOrHasSuspendTypesInSignature took ~0.5% of
backend time on compilation of intellij (related to KT-48233).
2021-12-15 22:27:51 +01:00
Anastasiya Shadrina d47cf315e7 [Metadata] Add context receivers to metadata.proto
[Tests] Add JvmVersionRequirementTest
2021-12-02 20:24:20 +03:00
Denis.Zharkov 302eacbf59 Support new form of definitely non-nullable types: T & Any
^KT-26245 In Progress
2021-08-31 15:41:11 +03:00
Ilmir Usmanov 1f8dd45c2b Remove experimental coroutines support. Part 2 2021-08-30 14:21:57 +03:00
Denis.Zharkov 37813d9d82 Add version requirements for declarations with !! types
^KT-26245 Related
2021-04-09 13:06:40 +03:00
Mikhael Bogdanov 989fea3399 Remove version requirements for -Xjvm-default=enable (1.2.40) and JvmFieldInInterface(1.2.70) 2021-03-01 16:20:20 +01:00
Ilmir Usmanov 2cd9016016 IC mangling: Replace compiler hack with configuration flag 2020-11-19 17:39:30 +01:00
Dmitry Petrov 202bbdf8dd Forward compatibility hacks for Result.{success, failure}
Don't mangled functions annotated with @JvmName.
Annotate 'Result.success' and 'Result.failure' with @JvmName and
@Suppress("INAPPLICABLE_JVM_NAME").
NB this would require bootstrap.
2020-06-04 12:16:27 +03:00
Dmitry Petrov 5db6a0b563 New mangling rules require language version 1.4 (not compiler version)
Follow-up to a270ee094c
2020-05-29 15:15:54 +03:00
Dmitry Petrov 94509bdb4e KT-39228 Fix inliner when latest 1.4 compiler used with 1.3 stdlib
Since 1.4.0-dev-8774, we mangle functions returning inline class values,
including functions with return type 'kotlin.Result'. This causes
incompatibility when 1.4 compiler is used with 1.3 (or just some
pre-1.4.0-dev-8774) standard library.

Also, write "message from the future" on functions returning inline
class values indicating that they can be used since compiler version 1.4
(otherwise 1.3 compiler using 1.4 stdlib would fail to find some
@InlineOnly functions such as 'Result.success' and 'Result.failure').
2020-05-29 00:53:00 +03:00
Mikhail Bogdanov 7bcbae9826 Fix requirements 2020-04-09 07:37:31 +02:00
Ilya Gorbunov 3bd3d61469 Test experimental coroutines version requirement on JVM only
Modify 'suspendFun' and 'nestedClassMembers' tests so that pre-release
suspend functions are tested only on JVM, where they are still supported.
2020-01-29 09:12:42 +03:00
Alexander Udalov b970a57adb Generate version requirement on inline functions since API version 1.4
The old compiler will crash if it tries to inline a function that's
passing a lambda parameter into the new parameter null check method
`Intrinsics.checkNotNullParameter` because that usage is not considered as
inlinable by the old compiler (it only knows about
`Intrinsics.checkParameterIsNotNull`). Therefore we require that these
functions can only be read by compilers of version 1.3.50 or greater.

 #KT-22275 Fixed
2019-08-12 16:09:23 +02:00
Mikhail Zarechenskiy 09cd038e4b Fix test about version requirement
We began to write version requirement on declarations with `Result` and
 now (after bootstrap) we are getting error in this test because of that
 version requirement.

 see 908be10bf4
2018-09-20 17:58:56 +03:00
Mikhail Zarechenskiy 908be10bf4 Write version requirement on inline classes and relevant declarations
#KT-26720 Fixed
2018-09-11 17:13:44 +03:00
Alexander Udalov 1e9694f1db Fix version requirement serialization for nested classes
Use the version requierement table of the outer DescriptorSerializer
instance when serializing metadata for a class. Pass parent serializer
to DescriptorSerializer.create to make sure the correct table is used.
Serialize nested classes before the outer class in JS and common code,
to make sure requirements are not lost. Also, split
VersionRequirementTest to JVM and JS

 #KT-25120 In Progress
2018-07-18 17:58:46 +02:00
Mikhael Bogdanov e00b7a993f Write version requirements for @JvmField in interface companion 2018-07-16 16:13:18 +02:00
Mikhael Bogdanov 4aec9499b5 Add @RequireKotlin(1.2.40) on interface with @JvmDefaults and its subinterfaces 2018-04-04 16:17:38 +02:00
Alexander Udalov 00c846a160 Write patch version for VersionRequirement correctly 2017-10-10 13:21:50 +02:00
Alexander Udalov 6f2e6db131 Check the RequireKotlin annotation value
Similarly to SinceKotlin
2017-10-10 13:21:50 +02:00
Alexander Udalov a96861c353 Support version kind for RequireKotlin
#KT-20584 Fixed
2017-10-10 13:21:49 +02:00
Alexander Udalov 4532f7556c Introduce internal RequireKotlin annotation 2017-10-10 13:19:18 +02:00
Alexander Udalov 8962911503 Rename SinceKotlinInfo -> VersionRequirement 2017-10-10 13:19:18 +02:00