[K2] Support legacy serialization for custom function type extensions.

For Compose libraries, it is important that libraries built with
K2 in version 2.0 can be read and used by a version 1.9 K1
compiler. That is not possible if custom function types are
in the metadata.

^KT-58456 Fixed
This commit is contained in:
Mads Ager
2023-05-10 13:39:51 +02:00
committed by teamcity
parent fb476612af
commit 089928ba2b
12 changed files with 114 additions and 2 deletions
@@ -63,6 +63,22 @@ abstract class FunctionTypeKind internal constructor(
open val prefixForTypeRender: String?
get() = null
/**
* Specifies the first language version for which to serialize custom function types
* into kotlin metadata. Until that version, custom function types will be serialized
* with the legacy scheme: as a FunctionN/KFunctionN with the annotation used for the
* custom function type.
*
* If no version is specified, custom function types are serialized to kotlin metadata.
*
* Serialization using the legacy format allows libraries compiled with K2 with a
* K2 plugin that uses custom function types to be used by clients using a K1 compiler
* with a K1 compiler plugin that understands the custom function types.
*/
open val serializeAsFunctionWithAnnotationUntil: String?
get() = null
/**
* @return corresponding non-reflect kind for reflect kind
* @return [this] if [isReflectType] is false