@ OptIn ( DelicateIoApi :: class ) <EOL> public fun Sink . writeHexadecimalUnsignedLong ( long : Long )

{ <EOL> var v = long <EOL> if ( v == <NUM_LIT:0L> ) { <EOL> writeByte ( '<CHAR_LIT:0>' . code . toByte ( ) ) <EOL> return <EOL> } <EOL> var x = v <EOL> x = x or ( x ushr <NUM_LIT:1> ) <EOL> x = x or ( x ushr <NUM_LIT:2> ) <EOL> x = x or ( x ushr <NUM_LIT:4> ) <EOL> x = x or ( x ushr <NUM_LIT:8> ) <EOL> x = x or ( x ushr <NUM_LIT:16> ) <EOL> x = x or ( x ushr <NUM_LIT> ) <EOL> x -= x ushr <NUM_LIT:1> and <NUM_LIT> <EOL> x = ( x ushr <NUM_LIT:2> and <NUM_LIT> ) + ( x and <NUM_LIT> ) <EOL> x = ( x ushr <NUM_LIT:4> ) + x and <NUM_LIT> <EOL> x += x ushr <NUM_LIT:8> <EOL> x += x ushr <NUM_LIT:16> <EOL> x = ( x and <NUM_LIT> ) + ( ( x ushr <NUM_LIT> ) and <NUM_LIT> ) <EOL> val width = ( ( x + <NUM_LIT:3> ) / <NUM_LIT:4> ) . toInt ( ) <EOL> writeToInternalBuffer { buffer -> <EOL> val tail = buffer . writableSegment ( width ) <EOL> val data = tail . data <EOL> var pos = tail . limit + width - <NUM_LIT:1> <EOL> val start = tail . limit <EOL> while ( pos >= start ) { <EOL> data [ pos ] = HEX_DIGIT_BYTES [ ( v and <NUM_LIT> ) . toInt ( ) ] <EOL> v = v ushr <NUM_LIT:4> <EOL> pos -- <EOL> } <EOL> tail . limit += width <EOL> buffer . size += width . toLong ( ) <EOL> } <EOL> }

/**
 * Writes [long] to this sink in hexadecimal form (i.e., as a string in base 16).
 *
 * Resulting string will not contain leading zeros, except the `0` value itself.
 *
 * @param long the long to be written.
 *
 * @throws IllegalStateException when the sink is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.writeHexLong
 */


public fun Sink . writeUByte ( byte : UByte )

{ <EOL> writeByte ( byte . toByte ( ) ) <EOL> }

/**
 * Writes am unsigned byte to this sink.
 *
 * @param byte the byte to be written.
 *
 * @throws IllegalStateException when the sink is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.writeUByte
 */


public fun Sink . writeUShort ( short : UShort )

{ <EOL> writeShort ( short . toShort ( ) ) <EOL> }

/**
 * Writes two bytes containing [short], in the big-endian order, to this sink.
 *
 * @param short the unsigned short integer to be written.
 *
 * @throws IllegalStateException when the sink is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.writeUShort
 */


public fun Sink . writeUInt ( int : UInt )

{ <EOL> writeInt ( int . toInt ( ) ) <EOL> }

/**
 * Writes four bytes containing [int], in the big-endian order, to this sink.
 *
 * @param int the unsigned integer to be written.
 *
 * @throws IllegalStateException when the sink is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.writeUInt
 */


public fun Sink . writeULong ( long : ULong )

{ <EOL> writeLong ( long . toLong ( ) ) <EOL> }

/**
 * Writes eight bytes containing [long], in the big-endian order, to this sink.
 *
 * @param long the unsigned long integer to be written.
 *
 * @throws IllegalStateException when the sink is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.writeULong
 */


public fun Sink . writeUShortLe ( short : UShort )

{ <EOL> writeShortLe ( short . toShort ( ) ) <EOL> }

/**
 * Writes two bytes containing [short], in the little-endian order, to this sink.
 *
 * @param short the unsigned short integer to be written.
 *
 * @throws IllegalStateException when the sink is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.writeUShortLe
 */


public fun Sink . writeUIntLe ( int : UInt )

{ <EOL> writeIntLe ( int . toInt ( ) ) <EOL> }

/**
 * Writes four bytes containing [int], in the little-endian order, to this sink.
 *
 * @param int the unsigned integer to be written.
 *
 * @throws IllegalStateException when the sink is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.writeUIntLe
 */


public fun Sink . writeULongLe ( long : ULong )

{ <EOL> writeLongLe ( long . toLong ( ) ) <EOL> }

/**
 * Writes eight bytes containing [long], in the little-endian order, to this sink.
 *
 * @param long the unsigned long integer to be written.
 *
 * @throws IllegalStateException when the sink is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.writeULongLe
 */


public fun Sink . writeFloat ( float : Float )

{ <EOL> writeInt ( float . toBits ( ) ) <EOL> }

/**
 * Writes four bytes of a bit representation of [float], in the big-endian order, to this sink.
 * Bit representation of the [float] corresponds to the IEEE 754 floating-point "single format" bit layout.
 *
 * To obtain a bit representation, the [Float.toBits] function is used.
 *
 * Should be used with care when working with special values (like `NaN`) as bit patterns obtained for [Float.NaN] may vary depending on a platform.
 *
 * @param float the floating point number to be written.
 *
 * @throws IllegalStateException when the sink is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.writeFloat
 */


public fun Sink . writeDouble ( double : Double )

{ <EOL> writeLong ( double . toBits ( ) ) <EOL> }

/**
 * Writes eight bytes of a bit representation of [double], in the big-endian order, to this sink.
 * Bit representation of the [double] corresponds to the IEEE 754 floating-point "double format" bit layout.
 *
 * To obtain a bit representation, the [Double.toBits] function is used.
 *
 * Should be used with care when working with special values (like `NaN`) as bit patterns obtained for [Double.NaN] may vary depending on a platform.
 *
 * @param double the floating point number to be written.
 *
 * @throws IllegalStateException when the sink is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.writeDouble
 */


public fun Sink . writeFloatLe ( float : Float )

{ <EOL> writeIntLe ( float . toBits ( ) ) <EOL> }

/**
 * Writes four bytes of a bit representation of [float], in the little-endian order, to this sink.
 * Bit representation of the [float] corresponds to the IEEE 754 floating-point "single format" bit layout.
 *
 * To obtain a bit representation, the [Float.toBits] function is used.
 *
 * Should be used with care when working with special values (like `NaN`) as bit patterns obtained for [Float.NaN] may vary depending on a platform.
 *
 * @param float the floating point number to be written.
 *
 * @throws IllegalStateException when the sink is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.writeFloatLe
 */


public fun Sink . writeDoubleLe ( double : Double )

{ <EOL> writeLongLe ( double . toBits ( ) ) <EOL> }

/**
 * Writes eight bytes of a bit representation of [double], in the little-endian order, to this sink.
 * Bit representation of the [double] corresponds to the IEEE 754 floating-point "double format" bit layout.
 *
 * To obtain a bit representation, the [Double.toBits] function is used.
 *
 * Should be used with care when working with special values (like `NaN`) as bit patterns obtained for [Double.NaN] may vary depending on a platform.
 *
 * @param double the floating point number to be written.
 *
 * @throws IllegalStateException when the sink is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.writeDoubleLe
 */


@ DelicateIoApi <EOL> @ OptIn ( InternalIoApi :: class ) <EOL> public inline fun Sink . writeToInternalBuffer ( lambda : ( Buffer ) -> Unit )

{ <EOL> lambda ( this . buffer ) <EOL> this . hintEmit ( ) <EOL> }

/**
 * Provides direct access to the sink's internal buffer and hints its emit before exit.
 *
 * The internal buffer is passed into [lambda],
 * and it may be partially emitted to the underlying sink before returning from this method.
 *
 * Use this method with care as the data within the buffer is not yet emitted to the underlying sink
 * and consumption of data from the buffer will cause its loss.
 *
 * @param lambda the callback accessing internal buffer.
 *
 * @throws IllegalStateException when the sink is closed.
 */


@ Deprecated ( "<STR_LIT>" , ReplaceWith ( "<STR_LIT>" ) , DeprecationLevel . HIDDEN ) <EOL> @ Suppress ( "<STR_LIT>" , "<STR_LIT:DEPRECATION_ERROR>" ) <EOL> public suspend fun < E : Any > ReceiveChannel < E > . receiveOrNull ( ) : E ?

{ <EOL> @ Suppress ( "<STR_LIT:INVISIBLE_MEMBER>" , "<STR_LIT:INVISIBLE_REFERENCE>" ) <EOL> return ( this as ReceiveChannel < E ? > ) . receiveOrNull ( ) <EOL> }

/**
 * This function is deprecated in the favour of [ReceiveChannel.receiveCatching].
 *
 * This function is considered error-prone for the following reasons;
 * - Is throwing if the channel has failed even though its signature may suggest it returns 'null'
 * - It is easy to forget that exception handling still have to be explicit
 * - During code reviews and code reading, intentions of the code are frequently unclear:
 * are potential exceptions ignored deliberately or not?
 *
 * @suppress doc
 */


@ Deprecated ( "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) <EOL> @ Suppress ( "<STR_LIT:DEPRECATION_ERROR>" ) <EOL> public fun < E : Any > ReceiveChannel < E > . onReceiveOrNull ( ) : SelectClause1 < E ? >

{ <EOL> return ( this as ReceiveChannel < E ? > ) . onReceiveOrNull <EOL> }

/**
 * This function is deprecated in the favour of [ReceiveChannel.onReceiveCatching]
 */


public inline fun < E , R > ReceiveChannel < E > . consume ( block : ReceiveChannel < E > . ( ) -> R ) : R

{ <EOL> contract { <EOL> callsInPlace ( block , InvocationKind . EXACTLY_ONCE ) <EOL> } <EOL> var cause : Throwable ? = null <EOL> try { <EOL> return block ( ) <EOL> } catch ( e : Throwable ) { <EOL> cause = e <EOL> throw e <EOL> } finally { <EOL> cancelConsumed ( cause ) <EOL> } <EOL> }

/**
 * Makes sure that the given [block] consumes all elements from the given channel
 * by always invoking [cancel][ReceiveChannel.cancel] after the execution of the block.
 *
 * The operation is _terminal_.
 */


public suspend inline fun < E > ReceiveChannel < E > . consumeEach ( action : ( E ) -> Unit ) : Unit

= <EOL> consume { <EOL> for ( e in this ) action ( e ) <EOL> }

/**
 * Performs the given [action] for each received element and [cancels][ReceiveChannel.cancel]
 * the channel after the execution of the block.
 * If you need to iterate over the channel without consuming it, a regular `for` loop should be used instead.
 *
 * The operation is _terminal_.
 * This function [consumes][ReceiveChannel.consume] all elements of the original [ReceiveChannel].
 */


public suspend fun < E > ReceiveChannel < E > . toList ( ) : List < E >

= buildList { <EOL> consumeEach { <EOL> add ( it ) <EOL> } <EOL> }

/**
 * Returns a [List] containing all elements.
 *
 * The operation is _terminal_.
 * This function [consumes][ReceiveChannel.consume] all elements of the original [ReceiveChannel].
 */


public fun < I > Operation < I , FloatData > . onnx ( block : ONNXModelPreprocessor . ( ) -> Unit ) : Operation < I , FloatData >

{ <EOL> return PreprocessingPipeline ( this , ONNXModelPreprocessor ( null ) . apply ( block ) ) <EOL> }

/** Image DSL Preprocessing extension.*/


private fun Path . toExpectedPath ( ) : Path

{ <EOL> val artifactDirPath = localRepoPath . relativize ( this ) . parent . parent <EOL> val expectedFileName = "<STR_LIT>" <EOL> return expectedRepoPath . resolve ( artifactDirPath . resolve ( expectedFileName ) ) <EOL> }

/**
 * convert:
 * ${mavenLocal}/org/jetbrains/kotlin/artifact/version/artifact-version.pom
 * to:
 * ${expectedRepository}/org/jetbrains/kotlin/artifact/artifact.pom
 */


private fun Project . setupCInteropCommonizerDependenciesForIde ( sourceSet : DefaultKotlinSourceSet )

= launch { <EOL> addIntransitiveMetadataDependencyIfPossible ( sourceSet , cinteropCommonizerDependencies ( sourceSet ) ) <EOL> }

/**
 * IDE will resolve the dependencies provided on source sets.
 * This will use the [Project.copyCommonizeCInteropForIdeTask] over the regular cinterop commonization task.
 * The copying task prevent red code within the IDE after cleaning the build output.
 */


operator fun < DsType > invoke ( vararg params : TypedColumn < DsType , T > ) : TypedColumn < DsType , R >

= udf . apply ( * params ) . `as` ( encoder ) as TypedColumn < DsType , R >

/**
 * Allows this UDF to be called in typed manner using columns in a [Dataset.selectTyped] call.
 * @see typedCol to create typed columns.
 * @see org.apache.spark.sql.expressions.UserDefinedFunction.apply
 */


override fun withName ( name : String ) : NamedUserDefinedFunctionVararg < T , R >

= NamedUserDefinedFunctionVararg ( name = name , udf = udf , encoder = encoder , )

/** Returns named variant of this UDF. */


override fun getValue ( thisRef : Any ? , property : KProperty < * > ) : NamedUserDefinedFunctionVararg < T , R >

= <EOL> withName ( property . name )

/**
 * Returns named variant of this UDF.
 * @see withName
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > udf ( name : String , nondeterministic : Boolean = false , varargFunc : UDF1 < ByteArray , R > , ) : NamedUserDefinedFunctionVararg < Byte , R >

= <EOL> udf ( nondeterministic , varargFunc ) . withName ( name )

/**
 * Defines a named vararg UDF ([NamedUserDefinedFunctionVararg]) instance based on the (lambda) function [varargFunc].
 * For example: `val myUdf = udf("myUdf") { t1: ByteArray -> ... }`
 * Name can also be supplied using delegate: `val myUdf by udf { t1: ByteArray -> ... }`
 * @see UserDefinedFunction.getValue
 *
 * If you want to process a column containing an ByteArray instead, use WrappedArray<Byte>.
 *
 * @param name The name for this UDF.
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @param varargFunc The function to convert to a UDF. Can be a lambda.
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > udf ( nondeterministic : Boolean = false , varargFunc : UDF1 < ByteArray , R > , ) : UserDefinedFunctionVararg < Byte , R >

{ <EOL> return withAllowUntypedScalaUDF { <EOL> UserDefinedFunctionVararg ( udf = functions . udf ( VarargUnwrapper ( varargFunc ) { i , init -> ByteArray ( i , init :: call ) } , schema ( typeOf < R > ( ) ) . unWrap ( ) ) . let { if ( nondeterministic ) it . asNondeterministic ( ) else it } . let { if ( typeOf < R > ( ) . isMarkedNullable ) it else it . asNonNullable ( ) } , encoder = encoder < R > ( ) , ) <EOL> } <EOL> }

/**
 * Defines a vararg UDF ([UserDefinedFunctionVararg]) instance based on the (lambda) function [varargFunc].
 * For example: `val myUdf = udf { t1: ByteArray -> ... }`
 *
 * If you want to process a column containing an ByteArray instead, use WrappedArray<Byte>.
 *
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @param varargFunc The function to convert to a UDF. Can be a lambda.
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > UDFRegistration . register ( name : String , nondeterministic : Boolean = false , varargFunc : UDF1 < ByteArray , R > , ) : NamedUserDefinedFunctionVararg < Byte , R >

= <EOL> register ( udf ( name , nondeterministic , varargFunc ) )

/**
 * Defines and registers a named vararg UDF ([NamedUserDefinedFunctionVararg]) instance based on the (lambda) function [varargFunc].
 * For example: `val myUdf = udf.register("myUdf") { t1: ByteArray -> ... }`
 *
 * If you want to process a column containing an ByteArray instead, use WrappedArray<Byte>.
 *
 * @param name The name for this UDF.
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @param varargFunc The function to convert to a UDF. Can be a lambda.
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > udf ( varargFunc : KProperty0 < ( ByteArray ) -> R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Byte , R >

= udf ( varargFunc . name , varargFunc , nondeterministic )

/**
 * Creates a vararg UDF ([NamedUserDefinedFunctionVararg]) from a function reference adapting its name by reflection.
 * For example: `val myUdf = udf(::myFunction)`
 *
 * If you want to process a column containing an ByteArray instead, use WrappedArray<Byte>.
 *
 * @param varargFunc function reference
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @see udf
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > udf ( name : String , varargFunc : KProperty0 < ( ByteArray ) -> R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Byte , R >

= udf ( name , nondeterministic , varargFunc . get ( ) )

/**
 * Creates a vararg UDF ([NamedUserDefinedFunctionVararg]) from a function reference.
 * For example: `val myUdf = udf("myFunction", ::myFunction)`
 *
 * If you want to process a column containing an ByteArray instead, use WrappedArray<Byte>.
 *
 * @param name Optional. Name for the UDF.
 * @param varargFunc function reference
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @see udf
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > UDFRegistration . register ( varargFunc : KProperty0 < ( ByteArray ) -> R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Byte , R >

= register ( udf ( varargFunc , nondeterministic ) )

/**
 * Creates and registers a vararg UDF ([NamedUserDefinedFunctionVararg]) from a function reference adapting its name by reflection.
 * For example: `val myUdf = udf.register(::myFunction)`
 *
 * If you want to process a column containing an ByteArray instead, use WrappedArray<Byte>.
 *
 * @param varargFunc function reference
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @see udf
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > UDFRegistration . register ( name : String , varargFunc : KProperty0 < ( ByteArray ) -> R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Byte , R >

= register ( udf ( name , varargFunc , nondeterministic ) )

/**
 * Creates and registers a vararg UDF ([NamedUserDefinedFunctionVararg]) from a function reference.
 * For example: `val myUdf = udf.register("myFunction", ::myFunction)`
 *
 * If you want to process a column containing an ByteArray instead, use WrappedArray<Byte>.
 *
 * @param name Optional. Name for the UDF.
 * @param varargFunc function reference
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @see udf
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > udf ( varargFunc : KFunction1 < ByteArray , R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Byte , R >


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > udf ( name : String , varargFunc : KFunction1 < ByteArray , R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Byte , R >

= udf ( name , nondeterministic , varargFunc )


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > UDFRegistration . register ( varargFunc : KFunction1 < ByteArray , R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Byte , R >


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > UDFRegistration . register ( name : String , varargFunc : KFunction1 < ByteArray , R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Byte , R >


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > udf ( name : String , nondeterministic : Boolean = false , varargFunc : UDF1 < ShortArray , R > , ) : NamedUserDefinedFunctionVararg < Short , R >

/**
 * Defines a named vararg UDF ([NamedUserDefinedFunctionVararg]) instance based on the (lambda) function [varargFunc].
 * For example: `val myUdf = udf("myUdf") { t1: ShortArray -> ... }`
 * Name can also be supplied using delegate: `val myUdf by udf { t1: ShortArray -> ... }`
 * @see UserDefinedFunction.getValue
 *
 * If you want to process a column containing an ShortArray instead, use WrappedArray<Short>.
 *
 * @param name The name for this UDF.
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @param varargFunc The function to convert to a UDF. Can be a lambda.
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > udf ( nondeterministic : Boolean = false , varargFunc : UDF1 < ShortArray , R > , ) : UserDefinedFunctionVararg < Short , R >

{ <EOL> return withAllowUntypedScalaUDF { <EOL> UserDefinedFunctionVararg ( udf = functions . udf ( VarargUnwrapper ( varargFunc ) { i , init -> ShortArray ( i , init :: call ) } , schema ( typeOf < R > ( ) ) . unWrap ( ) ) . let { if ( nondeterministic ) it . asNondeterministic ( ) else it } . let { if ( typeOf < R > ( ) . isMarkedNullable ) it else it . asNonNullable ( ) } , encoder = encoder < R > ( ) , ) <EOL> } <EOL> }

/**
 * Defines a vararg UDF ([UserDefinedFunctionVararg]) instance based on the (lambda) function [varargFunc].
 * For example: `val myUdf = udf { t1: ShortArray -> ... }`
 *
 * If you want to process a column containing an ShortArray instead, use WrappedArray<Short>.
 *
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @param varargFunc The function to convert to a UDF. Can be a lambda.
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > UDFRegistration . register ( name : String , nondeterministic : Boolean = false , varargFunc : UDF1 < ShortArray , R > , ) : NamedUserDefinedFunctionVararg < Short , R >

/**
 * Defines and registers a named vararg UDF ([NamedUserDefinedFunctionVararg]) instance based on the (lambda) function [varargFunc].
 * For example: `val myUdf = udf.register("myUdf") { t1: ShortArray -> ... }`
 *
 * If you want to process a column containing an ShortArray instead, use WrappedArray<Short>.
 *
 * @param name The name for this UDF.
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @param varargFunc The function to convert to a UDF. Can be a lambda.
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > udf ( varargFunc : KProperty0 < ( ShortArray ) -> R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Short , R >

/**
 * Creates a vararg UDF ([NamedUserDefinedFunctionVararg]) from a function reference adapting its name by reflection.
 * For example: `val myUdf = udf(::myFunction)`
 *
 * If you want to process a column containing an ShortArray instead, use WrappedArray<Short>.
 *
 * @param varargFunc function reference
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @see udf
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > udf ( name : String , varargFunc : KProperty0 < ( ShortArray ) -> R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Short , R >

/**
 * Creates a vararg UDF ([NamedUserDefinedFunctionVararg]) from a function reference.
 * For example: `val myUdf = udf("myFunction", ::myFunction)`
 *
 * If you want to process a column containing an ShortArray instead, use WrappedArray<Short>.
 *
 * @param name Optional. Name for the UDF.
 * @param varargFunc function reference
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @see udf
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > UDFRegistration . register ( varargFunc : KProperty0 < ( ShortArray ) -> R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Short , R >

/**
 * Creates and registers a vararg UDF ([NamedUserDefinedFunctionVararg]) from a function reference adapting its name by reflection.
 * For example: `val myUdf = udf.register(::myFunction)`
 *
 * If you want to process a column containing an ShortArray instead, use WrappedArray<Short>.
 *
 * @param varargFunc function reference
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @see udf
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > UDFRegistration . register ( name : String , varargFunc : KProperty0 < ( ShortArray ) -> R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Short , R >

/**
 * Creates and registers a vararg UDF ([NamedUserDefinedFunctionVararg]) from a function reference.
 * For example: `val myUdf = udf.register("myFunction", ::myFunction)`
 *
 * If you want to process a column containing an ShortArray instead, use WrappedArray<Short>.
 *
 * @param name Optional. Name for the UDF.
 * @param varargFunc function reference
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @see udf
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > udf ( varargFunc : KFunction1 < ShortArray , R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Short , R >


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > udf ( name : String , varargFunc : KFunction1 < ShortArray , R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Short , R >


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > UDFRegistration . register ( varargFunc : KFunction1 < ShortArray , R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Short , R >


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > UDFRegistration . register ( name : String , varargFunc : KFunction1 < ShortArray , R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Short , R >


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > udf ( name : String , nondeterministic : Boolean = false , varargFunc : UDF1 < IntArray , R > , ) : NamedUserDefinedFunctionVararg < Int , R >

/**
 * Defines a named vararg UDF ([NamedUserDefinedFunctionVararg]) instance based on the (lambda) function [varargFunc].
 * For example: `val myUdf = udf("myUdf") { t1: IntArray -> ... }`
 * Name can also be supplied using delegate: `val myUdf by udf { t1: IntArray -> ... }`
 * @see UserDefinedFunction.getValue
 *
 * If you want to process a column containing an IntArray instead, use WrappedArray<Int>.
 *
 * @param name The name for this UDF.
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @param varargFunc The function to convert to a UDF. Can be a lambda.
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > udf ( nondeterministic : Boolean = false , varargFunc : UDF1 < IntArray , R > , ) : UserDefinedFunctionVararg < Int , R >

{ <EOL> return withAllowUntypedScalaUDF { <EOL> UserDefinedFunctionVararg ( udf = functions . udf ( VarargUnwrapper ( varargFunc ) { i , init -> IntArray ( i , init :: call ) } , schema ( typeOf < R > ( ) ) . unWrap ( ) ) . let { if ( nondeterministic ) it . asNondeterministic ( ) else it } . let { if ( typeOf < R > ( ) . isMarkedNullable ) it else it . asNonNullable ( ) } , encoder = encoder < R > ( ) , ) <EOL> } <EOL> }

/**
 * Defines a vararg UDF ([UserDefinedFunctionVararg]) instance based on the (lambda) function [varargFunc].
 * For example: `val myUdf = udf { t1: IntArray -> ... }`
 *
 * If you want to process a column containing an IntArray instead, use WrappedArray<Int>.
 *
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @param varargFunc The function to convert to a UDF. Can be a lambda.
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > UDFRegistration . register ( name : String , nondeterministic : Boolean = false , varargFunc : UDF1 < IntArray , R > , ) : NamedUserDefinedFunctionVararg < Int , R >

/**
 * Defines and registers a named vararg UDF ([NamedUserDefinedFunctionVararg]) instance based on the (lambda) function [varargFunc].
 * For example: `val myUdf = udf.register("myUdf") { t1: IntArray -> ... }`
 *
 * If you want to process a column containing an IntArray instead, use WrappedArray<Int>.
 *
 * @param name The name for this UDF.
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @param varargFunc The function to convert to a UDF. Can be a lambda.
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > udf ( varargFunc : KProperty0 < ( IntArray ) -> R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Int , R >

/**
 * Creates a vararg UDF ([NamedUserDefinedFunctionVararg]) from a function reference adapting its name by reflection.
 * For example: `val myUdf = udf(::myFunction)`
 *
 * If you want to process a column containing an IntArray instead, use WrappedArray<Int>.
 *
 * @param varargFunc function reference
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @see udf
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > udf ( name : String , varargFunc : KProperty0 < ( IntArray ) -> R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Int , R >

/**
 * Creates a vararg UDF ([NamedUserDefinedFunctionVararg]) from a function reference.
 * For example: `val myUdf = udf("myFunction", ::myFunction)`
 *
 * If you want to process a column containing an IntArray instead, use WrappedArray<Int>.
 *
 * @param name Optional. Name for the UDF.
 * @param varargFunc function reference
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @see udf
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > UDFRegistration . register ( varargFunc : KProperty0 < ( IntArray ) -> R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Int , R >

/**
 * Creates and registers a vararg UDF ([NamedUserDefinedFunctionVararg]) from a function reference adapting its name by reflection.
 * For example: `val myUdf = udf.register(::myFunction)`
 *
 * If you want to process a column containing an IntArray instead, use WrappedArray<Int>.
 *
 * @param varargFunc function reference
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @see udf
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > UDFRegistration . register ( name : String , varargFunc : KProperty0 < ( IntArray ) -> R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Int , R >

/**
 * Creates and registers a vararg UDF ([NamedUserDefinedFunctionVararg]) from a function reference.
 * For example: `val myUdf = udf.register("myFunction", ::myFunction)`
 *
 * If you want to process a column containing an IntArray instead, use WrappedArray<Int>.
 *
 * @param name Optional. Name for the UDF.
 * @param varargFunc function reference
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @see udf
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > udf ( varargFunc : KFunction1 < IntArray , R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Int , R >


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > udf ( name : String , varargFunc : KFunction1 < IntArray , R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Int , R >


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > UDFRegistration . register ( varargFunc : KFunction1 < IntArray , R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Int , R >


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > UDFRegistration . register ( name : String , varargFunc : KFunction1 < IntArray , R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Int , R >


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > udf ( name : String , nondeterministic : Boolean = false , varargFunc : UDF1 < LongArray , R > , ) : NamedUserDefinedFunctionVararg < Long , R >

/**
 * Defines a named vararg UDF ([NamedUserDefinedFunctionVararg]) instance based on the (lambda) function [varargFunc].
 * For example: `val myUdf = udf("myUdf") { t1: LongArray -> ... }`
 * Name can also be supplied using delegate: `val myUdf by udf { t1: LongArray -> ... }`
 * @see UserDefinedFunction.getValue
 *
 * If you want to process a column containing an LongArray instead, use WrappedArray<Long>.
 *
 * @param name The name for this UDF.
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @param varargFunc The function to convert to a UDF. Can be a lambda.
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > udf ( nondeterministic : Boolean = false , varargFunc : UDF1 < LongArray , R > , ) : UserDefinedFunctionVararg < Long , R >

{ <EOL> return withAllowUntypedScalaUDF { <EOL> UserDefinedFunctionVararg ( udf = functions . udf ( VarargUnwrapper ( varargFunc ) { i , init -> LongArray ( i , init :: call ) } , schema ( typeOf < R > ( ) ) . unWrap ( ) ) . let { if ( nondeterministic ) it . asNondeterministic ( ) else it } . let { if ( typeOf < R > ( ) . isMarkedNullable ) it else it . asNonNullable ( ) } , encoder = encoder < R > ( ) , ) <EOL> } <EOL> }

/**
 * Defines a vararg UDF ([UserDefinedFunctionVararg]) instance based on the (lambda) function [varargFunc].
 * For example: `val myUdf = udf { t1: LongArray -> ... }`
 *
 * If you want to process a column containing an LongArray instead, use WrappedArray<Long>.
 *
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @param varargFunc The function to convert to a UDF. Can be a lambda.
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > UDFRegistration . register ( name : String , nondeterministic : Boolean = false , varargFunc : UDF1 < LongArray , R > , ) : NamedUserDefinedFunctionVararg < Long , R >

/**
 * Defines and registers a named vararg UDF ([NamedUserDefinedFunctionVararg]) instance based on the (lambda) function [varargFunc].
 * For example: `val myUdf = udf.register("myUdf") { t1: LongArray -> ... }`
 *
 * If you want to process a column containing an LongArray instead, use WrappedArray<Long>.
 *
 * @param name The name for this UDF.
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @param varargFunc The function to convert to a UDF. Can be a lambda.
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > udf ( varargFunc : KProperty0 < ( LongArray ) -> R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Long , R >

/**
 * Creates a vararg UDF ([NamedUserDefinedFunctionVararg]) from a function reference adapting its name by reflection.
 * For example: `val myUdf = udf(::myFunction)`
 *
 * If you want to process a column containing an LongArray instead, use WrappedArray<Long>.
 *
 * @param varargFunc function reference
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @see udf
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > udf ( name : String , varargFunc : KProperty0 < ( LongArray ) -> R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Long , R >

/**
 * Creates a vararg UDF ([NamedUserDefinedFunctionVararg]) from a function reference.
 * For example: `val myUdf = udf("myFunction", ::myFunction)`
 *
 * If you want to process a column containing an LongArray instead, use WrappedArray<Long>.
 *
 * @param name Optional. Name for the UDF.
 * @param varargFunc function reference
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @see udf
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > UDFRegistration . register ( varargFunc : KProperty0 < ( LongArray ) -> R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Long , R >

/**
 * Creates and registers a vararg UDF ([NamedUserDefinedFunctionVararg]) from a function reference adapting its name by reflection.
 * For example: `val myUdf = udf.register(::myFunction)`
 *
 * If you want to process a column containing an LongArray instead, use WrappedArray<Long>.
 *
 * @param varargFunc function reference
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @see udf
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > UDFRegistration . register ( name : String , varargFunc : KProperty0 < ( LongArray ) -> R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Long , R >

/**
 * Creates and registers a vararg UDF ([NamedUserDefinedFunctionVararg]) from a function reference.
 * For example: `val myUdf = udf.register("myFunction", ::myFunction)`
 *
 * If you want to process a column containing an LongArray instead, use WrappedArray<Long>.
 *
 * @param name Optional. Name for the UDF.
 * @param varargFunc function reference
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @see udf
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > udf ( varargFunc : KFunction1 < LongArray , R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Long , R >


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > udf ( name : String , varargFunc : KFunction1 < LongArray , R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Long , R >


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > UDFRegistration . register ( varargFunc : KFunction1 < LongArray , R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Long , R >


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > UDFRegistration . register ( name : String , varargFunc : KFunction1 < LongArray , R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Long , R >


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > udf ( name : String , nondeterministic : Boolean = false , varargFunc : UDF1 < FloatArray , R > , ) : NamedUserDefinedFunctionVararg < Float , R >

/**
 * Defines a named vararg UDF ([NamedUserDefinedFunctionVararg]) instance based on the (lambda) function [varargFunc].
 * For example: `val myUdf = udf("myUdf") { t1: FloatArray -> ... }`
 * Name can also be supplied using delegate: `val myUdf by udf { t1: FloatArray -> ... }`
 * @see UserDefinedFunction.getValue
 *
 * If you want to process a column containing an FloatArray instead, use WrappedArray<Float>.
 *
 * @param name The name for this UDF.
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @param varargFunc The function to convert to a UDF. Can be a lambda.
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > udf ( nondeterministic : Boolean = false , varargFunc : UDF1 < FloatArray , R > , ) : UserDefinedFunctionVararg < Float , R >

{ <EOL> return withAllowUntypedScalaUDF { <EOL> UserDefinedFunctionVararg ( udf = functions . udf ( VarargUnwrapper ( varargFunc ) { i , init -> FloatArray ( i , init :: call ) } , schema ( typeOf < R > ( ) ) . unWrap ( ) ) . let { if ( nondeterministic ) it . asNondeterministic ( ) else it } . let { if ( typeOf < R > ( ) . isMarkedNullable ) it else it . asNonNullable ( ) } , encoder = encoder < R > ( ) , ) <EOL> } <EOL> }

/**
 * Defines a vararg UDF ([UserDefinedFunctionVararg]) instance based on the (lambda) function [varargFunc].
 * For example: `val myUdf = udf { t1: FloatArray -> ... }`
 *
 * If you want to process a column containing an FloatArray instead, use WrappedArray<Float>.
 *
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @param varargFunc The function to convert to a UDF. Can be a lambda.
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > UDFRegistration . register ( name : String , nondeterministic : Boolean = false , varargFunc : UDF1 < FloatArray , R > , ) : NamedUserDefinedFunctionVararg < Float , R >

/**
 * Defines and registers a named vararg UDF ([NamedUserDefinedFunctionVararg]) instance based on the (lambda) function [varargFunc].
 * For example: `val myUdf = udf.register("myUdf") { t1: FloatArray -> ... }`
 *
 * If you want to process a column containing an FloatArray instead, use WrappedArray<Float>.
 *
 * @param name The name for this UDF.
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @param varargFunc The function to convert to a UDF. Can be a lambda.
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > udf ( varargFunc : KProperty0 < ( FloatArray ) -> R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Float , R >

/**
 * Creates a vararg UDF ([NamedUserDefinedFunctionVararg]) from a function reference adapting its name by reflection.
 * For example: `val myUdf = udf(::myFunction)`
 *
 * If you want to process a column containing an FloatArray instead, use WrappedArray<Float>.
 *
 * @param varargFunc function reference
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @see udf
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > udf ( name : String , varargFunc : KProperty0 < ( FloatArray ) -> R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Float , R >

/**
 * Creates a vararg UDF ([NamedUserDefinedFunctionVararg]) from a function reference.
 * For example: `val myUdf = udf("myFunction", ::myFunction)`
 *
 * If you want to process a column containing an FloatArray instead, use WrappedArray<Float>.
 *
 * @param name Optional. Name for the UDF.
 * @param varargFunc function reference
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @see udf
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > UDFRegistration . register ( varargFunc : KProperty0 < ( FloatArray ) -> R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Float , R >

/**
 * Creates and registers a vararg UDF ([NamedUserDefinedFunctionVararg]) from a function reference adapting its name by reflection.
 * For example: `val myUdf = udf.register(::myFunction)`
 *
 * If you want to process a column containing an FloatArray instead, use WrappedArray<Float>.
 *
 * @param varargFunc function reference
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @see udf
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > UDFRegistration . register ( name : String , varargFunc : KProperty0 < ( FloatArray ) -> R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Float , R >

/**
 * Creates and registers a vararg UDF ([NamedUserDefinedFunctionVararg]) from a function reference.
 * For example: `val myUdf = udf.register("myFunction", ::myFunction)`
 *
 * If you want to process a column containing an FloatArray instead, use WrappedArray<Float>.
 *
 * @param name Optional. Name for the UDF.
 * @param varargFunc function reference
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @see udf
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > udf ( varargFunc : KFunction1 < FloatArray , R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Float , R >


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > udf ( name : String , varargFunc : KFunction1 < FloatArray , R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Float , R >


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > UDFRegistration . register ( varargFunc : KFunction1 < FloatArray , R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Float , R >


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > UDFRegistration . register ( name : String , varargFunc : KFunction1 < FloatArray , R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Float , R >


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > udf ( name : String , nondeterministic : Boolean = false , varargFunc : UDF1 < DoubleArray , R > , ) : NamedUserDefinedFunctionVararg < Double , R >

/**
 * Defines a named vararg UDF ([NamedUserDefinedFunctionVararg]) instance based on the (lambda) function [varargFunc].
 * For example: `val myUdf = udf("myUdf") { t1: DoubleArray -> ... }`
 * Name can also be supplied using delegate: `val myUdf by udf { t1: DoubleArray -> ... }`
 * @see UserDefinedFunction.getValue
 *
 * If you want to process a column containing an DoubleArray instead, use WrappedArray<Double>.
 *
 * @param name The name for this UDF.
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @param varargFunc The function to convert to a UDF. Can be a lambda.
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > udf ( nondeterministic : Boolean = false , varargFunc : UDF1 < DoubleArray , R > , ) : UserDefinedFunctionVararg < Double , R >

{ <EOL> return withAllowUntypedScalaUDF { <EOL> UserDefinedFunctionVararg ( udf = functions . udf ( VarargUnwrapper ( varargFunc ) { i , init -> DoubleArray ( i , init :: call ) } , schema ( typeOf < R > ( ) ) . unWrap ( ) ) . let { if ( nondeterministic ) it . asNondeterministic ( ) else it } . let { if ( typeOf < R > ( ) . isMarkedNullable ) it else it . asNonNullable ( ) } , encoder = encoder < R > ( ) , ) <EOL> } <EOL> }

/**
 * Defines a vararg UDF ([UserDefinedFunctionVararg]) instance based on the (lambda) function [varargFunc].
 * For example: `val myUdf = udf { t1: DoubleArray -> ... }`
 *
 * If you want to process a column containing an DoubleArray instead, use WrappedArray<Double>.
 *
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @param varargFunc The function to convert to a UDF. Can be a lambda.
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > UDFRegistration . register ( name : String , nondeterministic : Boolean = false , varargFunc : UDF1 < DoubleArray , R > , ) : NamedUserDefinedFunctionVararg < Double , R >

/**
 * Defines and registers a named vararg UDF ([NamedUserDefinedFunctionVararg]) instance based on the (lambda) function [varargFunc].
 * For example: `val myUdf = udf.register("myUdf") { t1: DoubleArray -> ... }`
 *
 * If you want to process a column containing an DoubleArray instead, use WrappedArray<Double>.
 *
 * @param name The name for this UDF.
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @param varargFunc The function to convert to a UDF. Can be a lambda.
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > udf ( varargFunc : KProperty0 < ( DoubleArray ) -> R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Double , R >

/**
 * Creates a vararg UDF ([NamedUserDefinedFunctionVararg]) from a function reference adapting its name by reflection.
 * For example: `val myUdf = udf(::myFunction)`
 *
 * If you want to process a column containing an DoubleArray instead, use WrappedArray<Double>.
 *
 * @param varargFunc function reference
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @see udf
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > udf ( name : String , varargFunc : KProperty0 < ( DoubleArray ) -> R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Double , R >

/**
 * Creates a vararg UDF ([NamedUserDefinedFunctionVararg]) from a function reference.
 * For example: `val myUdf = udf("myFunction", ::myFunction)`
 *
 * If you want to process a column containing an DoubleArray instead, use WrappedArray<Double>.
 *
 * @param name Optional. Name for the UDF.
 * @param varargFunc function reference
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @see udf
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > UDFRegistration . register ( varargFunc : KProperty0 < ( DoubleArray ) -> R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Double , R >

/**
 * Creates and registers a vararg UDF ([NamedUserDefinedFunctionVararg]) from a function reference adapting its name by reflection.
 * For example: `val myUdf = udf.register(::myFunction)`
 *
 * If you want to process a column containing an DoubleArray instead, use WrappedArray<Double>.
 *
 * @param varargFunc function reference
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @see udf
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > UDFRegistration . register ( name : String , varargFunc : KProperty0 < ( DoubleArray ) -> R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Double , R >

/**
 * Creates and registers a vararg UDF ([NamedUserDefinedFunctionVararg]) from a function reference.
 * For example: `val myUdf = udf.register("myFunction", ::myFunction)`
 *
 * If you want to process a column containing an DoubleArray instead, use WrappedArray<Double>.
 *
 * @param name Optional. Name for the UDF.
 * @param varargFunc function reference
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @see udf
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > udf ( varargFunc : KFunction1 < DoubleArray , R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Double , R >


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > udf ( name : String , varargFunc : KFunction1 < DoubleArray , R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Double , R >


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > UDFRegistration . register ( varargFunc : KFunction1 < DoubleArray , R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Double , R >


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > UDFRegistration . register ( name : String , varargFunc : KFunction1 < DoubleArray , R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Double , R >


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > udf ( name : String , nondeterministic : Boolean = false , varargFunc : UDF1 < BooleanArray , R > , ) : NamedUserDefinedFunctionVararg < Boolean , R >

/**
 * Defines a named vararg UDF ([NamedUserDefinedFunctionVararg]) instance based on the (lambda) function [varargFunc].
 * For example: `val myUdf = udf("myUdf") { t1: BooleanArray -> ... }`
 * Name can also be supplied using delegate: `val myUdf by udf { t1: BooleanArray -> ... }`
 * @see UserDefinedFunction.getValue
 *
 * If you want to process a column containing an BooleanArray instead, use WrappedArray<Boolean>.
 *
 * @param name The name for this UDF.
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @param varargFunc The function to convert to a UDF. Can be a lambda.
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > udf ( nondeterministic : Boolean = false , varargFunc : UDF1 < BooleanArray , R > , ) : UserDefinedFunctionVararg < Boolean , R >

{ <EOL> return withAllowUntypedScalaUDF { <EOL> UserDefinedFunctionVararg ( udf = functions . udf ( VarargUnwrapper ( varargFunc ) { i , init -> BooleanArray ( i , init :: call ) } , schema ( typeOf < R > ( ) ) . unWrap ( ) ) . let { if ( nondeterministic ) it . asNondeterministic ( ) else it } . let { if ( typeOf < R > ( ) . isMarkedNullable ) it else it . asNonNullable ( ) } , encoder = encoder < R > ( ) , ) <EOL> } <EOL> }

/**
 * Defines a vararg UDF ([UserDefinedFunctionVararg]) instance based on the (lambda) function [varargFunc].
 * For example: `val myUdf = udf { t1: BooleanArray -> ... }`
 *
 * If you want to process a column containing an BooleanArray instead, use WrappedArray<Boolean>.
 *
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @param varargFunc The function to convert to a UDF. Can be a lambda.
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > UDFRegistration . register ( name : String , nondeterministic : Boolean = false , varargFunc : UDF1 < BooleanArray , R > , ) : NamedUserDefinedFunctionVararg < Boolean , R >

/**
 * Defines and registers a named vararg UDF ([NamedUserDefinedFunctionVararg]) instance based on the (lambda) function [varargFunc].
 * For example: `val myUdf = udf.register("myUdf") { t1: BooleanArray -> ... }`
 *
 * If you want to process a column containing an BooleanArray instead, use WrappedArray<Boolean>.
 *
 * @param name The name for this UDF.
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @param varargFunc The function to convert to a UDF. Can be a lambda.
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > udf ( varargFunc : KProperty0 < ( BooleanArray ) -> R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Boolean , R >

/**
 * Creates a vararg UDF ([NamedUserDefinedFunctionVararg]) from a function reference adapting its name by reflection.
 * For example: `val myUdf = udf(::myFunction)`
 *
 * If you want to process a column containing an BooleanArray instead, use WrappedArray<Boolean>.
 *
 * @param varargFunc function reference
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @see udf
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > udf ( name : String , varargFunc : KProperty0 < ( BooleanArray ) -> R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Boolean , R >

/**
 * Creates a vararg UDF ([NamedUserDefinedFunctionVararg]) from a function reference.
 * For example: `val myUdf = udf("myFunction", ::myFunction)`
 *
 * If you want to process a column containing an BooleanArray instead, use WrappedArray<Boolean>.
 *
 * @param name Optional. Name for the UDF.
 * @param varargFunc function reference
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @see udf
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > UDFRegistration . register ( varargFunc : KProperty0 < ( BooleanArray ) -> R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Boolean , R >

/**
 * Creates and registers a vararg UDF ([NamedUserDefinedFunctionVararg]) from a function reference adapting its name by reflection.
 * For example: `val myUdf = udf.register(::myFunction)`
 *
 * If you want to process a column containing an BooleanArray instead, use WrappedArray<Boolean>.
 *
 * @param varargFunc function reference
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @see udf
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > UDFRegistration . register ( name : String , varargFunc : KProperty0 < ( BooleanArray ) -> R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Boolean , R >

/**
 * Creates and registers a vararg UDF ([NamedUserDefinedFunctionVararg]) from a function reference.
 * For example: `val myUdf = udf.register("myFunction", ::myFunction)`
 *
 * If you want to process a column containing an BooleanArray instead, use WrappedArray<Boolean>.
 *
 * @param name Optional. Name for the UDF.
 * @param varargFunc function reference
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @see udf
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > udf ( varargFunc : KFunction1 < BooleanArray , R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Boolean , R >


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > udf ( name : String , varargFunc : KFunction1 < BooleanArray , R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Boolean , R >


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > UDFRegistration . register ( varargFunc : KFunction1 < BooleanArray , R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Boolean , R >


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified R > UDFRegistration . register ( name : String , varargFunc : KFunction1 < BooleanArray , R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < Boolean , R >


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified T , reified R > udf ( name : String , nondeterministic : Boolean = false , varargFunc : UDF1 < Array < T > , R > , ) : NamedUserDefinedFunctionVararg < T , R >

/**
 * Defines a named vararg UDF ([NamedUserDefinedFunctionVararg]) instance based on the (lambda) function [varargFunc].
 * For example: `val myUdf = udf("myUdf") { t1: Array<T> -> ... }`
 * Name can also be supplied using delegate: `val myUdf by udf { t1: Array<T> -> ... }`
 * @see UserDefinedFunction.getValue
 *
 * If you want to process a column containing an Array<T> instead, use WrappedArray<T>.
 *
 * @param name The name for this UDF.
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @param varargFunc The function to convert to a UDF. Can be a lambda.
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified T , reified R > udf ( nondeterministic : Boolean = false , varargFunc : UDF1 < Array < T > , R > , ) : UserDefinedFunctionVararg < T , R >

{ <EOL> T :: class . checkForValidType ( "<STR_LIT:T>" ) <EOL> return withAllowUntypedScalaUDF { <EOL> UserDefinedFunctionVararg ( udf = functions . udf ( VarargUnwrapper ( varargFunc ) { i , init -> Array < T > ( i , init :: call ) } , schema ( typeOf < R > ( ) ) . unWrap ( ) ) . let { if ( nondeterministic ) it . asNondeterministic ( ) else it } . let { if ( typeOf < R > ( ) . isMarkedNullable ) it else it . asNonNullable ( ) } , encoder = encoder < R > ( ) , ) <EOL> } <EOL> }

/**
 * Defines a vararg UDF ([UserDefinedFunctionVararg]) instance based on the (lambda) function [varargFunc].
 * For example: `val myUdf = udf { t1: Array<T> -> ... }`
 *
 * If you want to process a column containing an Array<T> instead, use WrappedArray<T>.
 *
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @param varargFunc The function to convert to a UDF. Can be a lambda.
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified T , reified R > UDFRegistration . register ( name : String , nondeterministic : Boolean = false , varargFunc : UDF1 < Array < T > , R > , ) : NamedUserDefinedFunctionVararg < T , R >

/**
 * Defines and registers a named vararg UDF ([NamedUserDefinedFunctionVararg]) instance based on the (lambda) function [varargFunc].
 * For example: `val myUdf = udf.register("myUdf") { t1: Array<T> -> ... }`
 *
 * If you want to process a column containing an Array<T> instead, use WrappedArray<T>.
 *
 * @param name The name for this UDF.
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @param varargFunc The function to convert to a UDF. Can be a lambda.
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified T , reified R > udf ( varargFunc : KProperty0 < ( Array < T > ) -> R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < T , R >

/**
 * Creates a vararg UDF ([NamedUserDefinedFunctionVararg]) from a function reference adapting its name by reflection.
 * For example: `val myUdf = udf(::myFunction)`
 *
 * If you want to process a column containing an Array<T> instead, use WrappedArray<T>.
 *
 * @param varargFunc function reference
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @see udf
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified T , reified R > udf ( name : String , varargFunc : KProperty0 < ( Array < T > ) -> R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < T , R >

/**
 * Creates a vararg UDF ([NamedUserDefinedFunctionVararg]) from a function reference.
 * For example: `val myUdf = udf("myFunction", ::myFunction)`
 *
 * If you want to process a column containing an Array<T> instead, use WrappedArray<T>.
 *
 * @param name Optional. Name for the UDF.
 * @param varargFunc function reference
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @see udf
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified T , reified R > UDFRegistration . register ( varargFunc : KProperty0 < ( Array < T > ) -> R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < T , R >

/**
 * Creates and registers a vararg UDF ([NamedUserDefinedFunctionVararg]) from a function reference adapting its name by reflection.
 * For example: `val myUdf = udf.register(::myFunction)`
 *
 * If you want to process a column containing an Array<T> instead, use WrappedArray<T>.
 *
 * @param varargFunc function reference
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @see udf
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified T , reified R > UDFRegistration . register ( name : String , varargFunc : KProperty0 < ( Array < T > ) -> R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < T , R >

/**
 * Creates and registers a vararg UDF ([NamedUserDefinedFunctionVararg]) from a function reference.
 * For example: `val myUdf = udf.register("myFunction", ::myFunction)`
 *
 * If you want to process a column containing an Array<T> instead, use WrappedArray<T>.
 *
 * @param name Optional. Name for the UDF.
 * @param varargFunc function reference
 * @param nondeterministic Optional. If true, sets the UserDefinedFunction as nondeterministic.
 * @see udf
 */


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified T , reified R > udf ( varargFunc : KFunction1 < Array < T > , R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < T , R >


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified T , reified R > udf ( name : String , varargFunc : KFunction1 < Array < T > , R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < T , R >


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified T , reified R > UDFRegistration . register ( varargFunc : KFunction1 < Array < T > , R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < T , R >


@ JvmName ( "<STR_LIT>" ) <EOL> inline fun < reified T , reified R > UDFRegistration . register ( name : String , varargFunc : KFunction1 < Array < T > , R > , nondeterministic : Boolean = false , ) : NamedUserDefinedFunctionVararg < T , R >


/**
 * [kotlin.collections.Abstr<caret>actCollection]
 */


internal fun < T > ( suspend ( ) -> T ) . startCoroutineUnintercepted ( completion : Continuation < T > )

{ <EOL> startDirect ( completion ) { actualCompletion -> <EOL> startCoroutineUninterceptedOrReturn ( actualCompletion ) <EOL> } <EOL> }

/**
 * Use this function to restart a coroutine directly from inside of [suspendCoroutine],
 * when the code is already in the context of this coroutine.
 * It does not use [ContinuationInterceptor] and does not update the context of the current thread.
 */


internal fun < R , T > ( suspend ( R ) -> T ) . startCoroutineUndispatched ( receiver : R , completion : Continuation < T > )

{ <EOL> startDirect ( completion ) { actualCompletion -> <EOL> withCoroutineContext ( completion . context , null ) { <EOL> startCoroutineUninterceptedOrReturn ( receiver , actualCompletion ) <EOL> } <EOL> } <EOL> }

/**
 * Use this function to start a new coroutine in [CoroutineStart.UNDISPATCHED] mode —
 * immediately execute the coroutine in the current thread until the next suspension.
 * It does not use [ContinuationInterceptor], but updates the context of the current thread for the new coroutine.
 */


private inline fun < T > startDirect ( completion : Continuation < T > , block : ( Continuation < T > ) -> Any ? )

{ <EOL> val actualCompletion = probeCoroutineCreated ( completion ) <EOL> val value = try { <EOL> block ( actualCompletion ) <EOL> } catch ( e : Throwable ) { <EOL> actualCompletion . resumeWithException ( e ) <EOL> return <EOL> } <EOL> if ( value !== COROUTINE_SUSPENDED ) { <EOL> @ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> actualCompletion . resume ( value as T ) <EOL> } <EOL> }

/**
 * Starts the given [block] immediately in the current stack-frame until the first suspension point.
 * This method supports debug probes and thus can intercept completion, thus completion is provided
 * as the parameter of [block].
 */


internal fun < T , R > ScopeCoroutine < T > . startUndispatchedOrReturn ( receiver : R , block : suspend R . ( ) -> T ) : Any ?

{ <EOL> return undispatchedResult ( { true } ) { <EOL> block . startCoroutineUninterceptedOrReturn ( receiver , this ) <EOL> } <EOL> }

/**
 * Starts this coroutine with the given code [block] in the same context and returns the coroutine result when it
 * completes without suspension.
 * This function shall be invoked at most once on this coroutine.
 * This function checks cancellation of the outer [Job] on fast-path.
 *
 * It starts the coroutine using [startCoroutineUninterceptedOrReturn].
 */


internal fun < T , R > ScopeCoroutine < T > . startUndispatchedOrReturnIgnoreTimeout ( receiver : R , block : suspend R . ( ) -> T ) : Any ?

{ <EOL> return undispatchedResult ( { e -> ! ( e is TimeoutCancellationException && e . coroutine === this ) } ) { <EOL> block . startCoroutineUninterceptedOrReturn ( receiver , this ) <EOL> } <EOL> }

/**
 * Same as [startUndispatchedOrReturn], but ignores [TimeoutCancellationException] on fast-path.
 */


internal fun CommonizerParameters . commonModuleNames ( target : CommonizerTarget ) : Set < String >

{ <EOL> val supportedTargets = target . withAllLeaves ( ) . mapNotNull ( targetProviders :: getOrNull ) <EOL> if ( supportedTargets . isEmpty ( ) ) return emptySet ( ) <EOL> val allModuleNames : List < Set < String > > = supportedTargets . toList ( ) . map { targetProvider -> <EOL> targetProvider . modulesProvider . moduleInfos . mapTo ( HashSet ( ) ) { it . name } <EOL> } <EOL> return allModuleNames . reduce { a , b -> a intersect b } <EOL> }

/**
 * @return Set of module names that is available across all children targets
 */


internal fun CommonizerParameters . commonModuleNames ( targetProvider : TargetProvider ) : Set < String >

{ <EOL> return outputTargets <EOL> . filter { target -> ( target . allLeaves ( ) intersect targetProvider . target . allLeaves ( ) ) . isNotEmpty ( ) } <EOL> . map { target -> commonModuleNames ( target ) } <EOL> . fold ( emptySet ( ) ) { acc , names -> acc + names } <EOL> }

/**
 * @return Set of module names that this [targetProvider] shares with *at least* one other target
 */


internal fun Project . androidCompilationKits ( androidExtension : DynamicBean , kotlinTarget : DynamicBean ) : List < AndroidVariantOrigin >

{ <EOL> val variants = if ( "<STR_LIT>" in androidExtension ) { <EOL> androidExtension . beanCollection ( "<STR_LIT>" ) <EOL> } else { <EOL> androidExtension . beanCollection ( "<STR_LIT>" ) <EOL> } <EOL> val fallbacks = findFallbacks ( androidExtension ) <EOL> return variants . map { <EOL> extractAndroidKit ( androidExtension , kotlinTarget , fallbacks , it ) <EOL> } <EOL> }

/**
 * Locate Android compilation kits for the given Kotlin Target.
 */


fun dwarfVersion ( config : KonanConfig )

= when ( config . debugInfoVersion ( ) ) { <EOL> <NUM_LIT:1> -> <NUM_LIT:2> <EOL> <NUM_LIT:2> -> <NUM_LIT:4> <EOL> else -> TODO ( "<STR_LIT>" ) <EOL> }

/**
 * Note: Kotlin language constant appears in DWARF v6, while modern linker fails to links DWARF other then [2;4],
 * that why we emit version 4 actually.
 */


{ <EOL> val ( train , test ) = mnist ( ) <EOL> modernLeNet . use { <EOL> it . compile ( optimizer = SGD ( learningRate = <NUM_LIT> ) , loss = Losses . SOFT_MAX_CROSS_ENTROPY_WITH_LOGITS , metric = Metrics . ACCURACY ) <EOL> println ( "<STR_LIT>" ) <EOL> println ( it . kGraph ) <EOL> it . init ( ) <EOL> var accuracy = it . evaluate ( dataset = test , batchSize = TEST_BATCH_SIZE ) . metrics [ Metrics . ACCURACY ] <EOL> println ( "<STR_LIT>" ) <EOL> println ( "<STR_LIT>" ) <EOL> println ( it . kGraph ) <EOL> it . fit ( dataset = train , epochs = EPOCHS , batchSize = TRAINING_BATCH_SIZE ) <EOL> println ( "<STR_LIT>" ) <EOL> println ( it . kGraph ) <EOL> accuracy = it . evaluate ( dataset = test , batchSize = TEST_BATCH_SIZE ) . metrics [ Metrics . ACCURACY ] <EOL> println ( "<STR_LIT>" ) <EOL> println ( it . kGraph ) <EOL> println ( "<STR_LIT>" ) <EOL> it . reset ( ) <EOL> accuracy = it . evaluate ( dataset = test , batchSize = TEST_BATCH_SIZE ) . metrics [ Metrics . ACCURACY ] <EOL> println ( "<STR_LIT>" ) <EOL> it . fit ( dataset = train , epochs = EPOCHS , batchSize = TRAINING_BATCH_SIZE ) <EOL> accuracy = it . evaluate ( dataset = test , batchSize = TEST_BATCH_SIZE ) . metrics [ Metrics . ACCURACY ] <EOL> println ( "<STR_LIT>" ) <EOL> } <EOL> }

/**
 * This example shows how to do image classification from scratch using [modernLeNet], without leveraging pre-trained weights or a pre-made model.
 * We demonstrate the workflow on the Mnist classification dataset.
 *
 * It includes:
 * - dataset loading from S3
 * - model compilation
 * - model summary (including TensorFlow graph operands)
 * - model training
 * - model evaluation
 */


= modernLenet ( )


@ Throws ( IOException :: class ) <EOL> public fun extractCifar10Images ( archiveName : String ) : Array < FloatArray >

{ <EOL> return loadImagesFromDirectory ( DATASET_SIZE , archiveName ) <EOL> }

/** Loads images from [archiveName] to heap memory and applies basic normalization preprocessing. */


@ Throws ( IOException :: class ) <EOL> public fun extractCifar10Labels ( pathToLabels : String ) : FloatArray

{ <EOL> val labelCount = DATASET_SIZE <EOL> println ( String . format ( "<STR_LIT>" , labelCount , pathToLabels ) ) <EOL> val labelBuffer = ByteArray ( labelCount ) <EOL> var cnt = <NUM_LIT:0> <EOL> csvReader ( ) . open ( pathToLabels ) { <EOL> readAllAsSequence ( ) <EOL> . forEach { row -> <EOL> labelBuffer [ cnt ] = dictionary . getOrElse ( row [ <NUM_LIT:1> ] ) { <NUM_LIT:1> } . toByte ( ) <EOL> cnt ++ <EOL> } <EOL> } <EOL> val floats = FloatArray ( labelCount ) <EOL> for ( i in <NUM_LIT:0> until labelCount ) { <EOL> floats [ i ] = OnHeapDataset . convertByteToFloat ( labelBuffer [ i ] ) <EOL> } <EOL> return floats <EOL> }

/** Loads labels from [pathToLabels] csv file to heap memory and converts to Floats. */


@ Throws ( IOException :: class ) <EOL> public fun extractCifar10LabelsAnsSort ( pathToLabels : String ) : FloatArray

{ <EOL> val labelCount = DATASET_SIZE <EOL> println ( String . format ( "<STR_LIT>" , labelCount , pathToLabels ) ) <EOL> val labelSorter = mutableMapOf < String , Int > ( ) <EOL> csvReader ( ) . open ( pathToLabels ) { <EOL> readAllAsSequence ( ) <EOL> . forEach { row -> <EOL> labelSorter [ row [ <NUM_LIT:0> ] ] = dictionary . getOrElse ( row [ <NUM_LIT:1> ] ) { <NUM_LIT:1> } <EOL> } <EOL> } <EOL> val sortedMap = labelSorter . toSortedMap ( ) <EOL> val labelBuffer = sortedMap . values . toIntArray ( ) <EOL> val floats = FloatArray ( labelCount ) <EOL> for ( i in <NUM_LIT:0> until labelCount ) { <EOL> floats [ i ] = <EOL> OnHeapDataset . convertByteToFloat ( labelBuffer [ i ] . toByte ( ) ) <EOL> } <EOL> return floats <EOL> }

/**
 * Loads labels from [pathToLabels] csv file to heap memory and converts to Floats, after that it sorts
 * it to have the same order as image files.
 *
 * NOTE: It's important if you're going to use it with [org.jetbrains.kotlinx.dl.dataset.OnFlyImageDataset].
 */


public fun top ( distance : Int ? = null , rotate : Int ? = null ) : LabelPosition

= <EOL> LabelPosition ( "<STR_LIT>" , distance , rotate )

/**
 * `top` label position with [distance] and [rotate]
 *
 * @param distance distance to the host graphic element.
 * @param rotate rotate label, from `-90` degree to `90`, positive value represents rotate anti-clockwise.
 */


public fun left ( distance : Int ? = null , rotate : Int ? = null ) : LabelPosition

/**
 * `left` label position with [distance] and [rotate]
 *
 * @param distance distance to the host graphic element.
 * @param rotate rotate label, from `-90` degree to `90`, positive value represents rotate anti-clockwise.
 */


public fun right ( distance : Int ? = null , rotate : Int ? = null ) : LabelPosition

/**
 * `right` label position with [distance] and [rotate]
 *
 * @param distance distance to the host graphic element.
 * @param rotate rotate label, from `-90` degree to `90`, positive value represents rotate anti-clockwise.
 */


public fun bottom ( distance : Int ? = null , rotate : Int ? = null ) : LabelPosition

/**
 * `bottom` label position with [distance] and [rotate]
 *
 * @param distance distance to the host graphic element.
 * @param rotate rotate label, from `-90` degree to `90`, positive value represents rotate anti-clockwise.
 */


public fun inside ( distance : Int ? = null , rotate : Int ? = null ) : LabelPosition

/**
 * `inside` label position with [distance] and [rotate]
 *
 * @param distance distance to the host graphic element.
 * @param rotate rotate label, from `-90` degree to `90`, positive value represents rotate anti-clockwise.
 */


public fun insideLeft ( distance : Int ? = null , rotate : Int ? = null ) : LabelPosition

/**
 * `insideLeft` label position with [distance] and [rotate]
 *
 * @param distance distance to the host graphic element.
 * @param rotate rotate label, from `-90` degree to `90`, positive value represents rotate anti-clockwise.
 */


public fun insideRight ( distance : Int ? = null , rotate : Int ? = null ) : LabelPosition

/**
 * `insideRight` label position with [distance] and [rotate]
 *
 * @param distance distance to the host graphic element.
 * @param rotate rotate label, from `-90` degree to `90`, positive value represents rotate anti-clockwise.
 */


public fun insideTop ( distance : Int ? = null , rotate : Int ? = null ) : LabelPosition

/**
 * `insideTop` label position with [distance] and [rotate]
 *
 * @param distance distance to the host graphic element.
 * @param rotate rotate label, from `-90` degree to `90`, positive value represents rotate anti-clockwise.
 */


public fun insideBottom ( distance : Int ? = null , rotate : Int ? = null ) : LabelPosition

/**
 * `insideBottom` label position with [distance] and [rotate]
 *
 * @param distance distance to the host graphic element.
 * @param rotate rotate label, from `-90` degree to `90`, positive value represents rotate anti-clockwise.
 */


public fun insideTopLeft ( distance : Int ? = null , rotate : Int ? = null ) : LabelPosition

/**
 * `insideTopLeft` label position with [distance] and [rotate]
 *
 * @param distance distance to the host graphic element.
 * @param rotate rotate label, from `-90` degree to `90`, positive value represents rotate anti-clockwise.
 */


public fun insideBottomLeft ( distance : Int ? = null , rotate : Int ? = null ) : LabelPosition

/**
 * `insideBottomLeft` label position with [distance] and [rotate]
 *
 * @param distance distance to the host graphic element.
 * @param rotate rotate label, from `-90` degree to `90`, positive value represents rotate anti-clockwise.
 */


public fun insideTopRight ( distance : Int ? = null , rotate : Int ? = null ) : LabelPosition

/**
 * `insideTopRight` label position with [distance] and [rotate]
 *
 * @param distance distance to the host graphic element.
 * @param rotate rotate label, from `-90` degree to `90`, positive value represents rotate anti-clockwise.
 */


public fun insideBottomRight ( distance : Int ? = null , rotate : Int ? = null ) : LabelPosition

/**
 * `insideBottomRight` label position with [distance] and [rotate]
 *
 * @param distance distance to the host graphic element.
 * @param rotate rotate label, from `-90` degree to `90`, positive value represents rotate anti-clockwise.
 */


public fun fromPx ( pair : Pair < Pixel , Pixel > , rotate : Int ? = null ) : LabelPosition

= LabelPosition ( pair , rotate )

/**
 * Represents position of label relative to a top-left corner of bounding box in absolute pixel values.
 *
 * @param pair pair of absolute pixel values
 * @param rotate rotate label, from `-90` degree to `90`, positive value represents rotate anti-clockwise.
 */


public fun fromPx ( first : Pixel , second : Pixel , rotate : Int ? = null ) : LabelPosition

= <EOL> LabelPosition ( first to second , rotate )

/**
 * Represents position of label relative to a top-left corner of bounding box in absolute pixel values.
 *
 * @param first pixel value along the x-axis
 * @param second pixel value along the y-axis
 * @param rotate rotate label, from `-90` degree to `90`, positive value represents rotate anti-clockwise.
 */


public fun fromPct ( pair : Pair < Percentage , Percentage > , rotate : Int ? = null ) : LabelPosition

= <EOL> LabelPosition ( pair , rotate )

/**
 * Represents position of label relative to a top-left corner of bounding box in relative percentage.
 *
 * @param pair pair of relative percentages
 * @param rotate rotate label, from `-90` degree to `90`, positive value represents rotate anti-clockwise.
 */


public fun fromPct ( first : Percentage , second : Percentage , rotate : Int ? = null ) : LabelPosition

/**
 * Represents position of label relative to a top-left corner of bounding box in relative percentage.
 *
 * @param first relative percentage along the x-axis
 * @param second relative percentage along the y-axis
 * @param rotate rotate label, from `-90` degree to `90`, positive value represents rotate anti-clockwise.
 */


override fun put ( key : K , value : V ) : V ?

{ <EOL> if ( put ( array , shift , key , value ) ) { <EOL> if ( ++ size_ >= ( THRESHOLD ushr shift ) ) { <EOL> rehash ( ) <EOL> } <EOL> } <EOL> return null <EOL> }

/**
 * Never returns previous values
 */


public fun KtAnnotated . hasAnnotation ( classId : ClassId , useSiteTargetFilter : AnnotationUseSiteTargetFilter = AnyAnnotationUseSiteTargetFilter , ) : Boolean

= annotationsList . hasAnnotation ( classId , useSiteTargetFilter )

/**
 * Checks if entity has annotation with specified [classId] and filtered by [useSiteTargetFilter].
 *
 * @see [KtAnnotationsList.hasAnnotation]
 */


public fun KtAnnotated . annotationsByClassId ( classId : ClassId , useSiteTargetFilter : AnnotationUseSiteTargetFilter = AnyAnnotationUseSiteTargetFilter , ) : List < KtAnnotationApplicationWithArgumentsInfo >

= annotationsList . annotationsByClassId ( classId , useSiteTargetFilter )

/**
 * A list of annotations applied with specified [classId] and filtered by [useSiteTargetFilter].
 *
 * @see [KtAnnotationsList.annotationClassIds]
 */


private fun isStringConcatenationExpression ( expression : IrExpression ) : Boolean

= <EOL> ( expression is IrStringConcatenation ) || ( expression is IrCall ) && expression . isStringPlusCall

/** @return true if the given expression is a [IrStringConcatenation], or an [IrCall] to [String.plus]. */


private fun collectStringConcatenationArguments ( expression : IrExpression ) : List < IrExpression >

{ <EOL> val arguments = mutableListOf < IrExpression > ( ) <EOL> expression . acceptChildrenVoid ( object : IrElementVisitorVoid { <EOL> override fun visitElement ( element : IrElement ) { <EOL> element . acceptChildrenVoid ( this ) <EOL> } <EOL> override fun visitCall ( expression : IrCall ) { <EOL> if ( isStringConcatenationExpression ( expression ) || expression . isToStringCall ) { <EOL> expression . acceptChildrenVoid ( this ) <EOL> } else { <EOL> arguments . add ( expression ) <EOL> } <EOL> } <EOL> override fun visitStringConcatenation ( expression : IrStringConcatenation ) { <EOL> expression . acceptChildrenVoid ( this ) <EOL> } <EOL> override fun visitExpression ( expression : IrExpression ) { <EOL> arguments . add ( expression ) <EOL> } <EOL> } ) <EOL> return arguments <EOL> }

/** Recursively collects string concatenation arguments from the given expression. */


override fun updateThreadContext ( context : CoroutineContext ) : MDCContextMap

{ <EOL> val oldState = MDC . getCopyOfContextMap ( ) <EOL> setCurrent ( contextMap ) <EOL> return oldState <EOL> }


override fun restoreThreadContext ( context : CoroutineContext , oldState : MDCContextMap )

{ <EOL> setCurrent ( oldState ) <EOL> }


@ Operation <EOL> fun computeReplaceValue ( key : Int , @ Param ( name = "<STR_LIT:value>" ) newValue : ValueWithCleanup , ) : ValueWithCleanup ?

= cache . compute ( key ) { _ , _ -> newValue }

/**
 * Models a computation that replaces the cache's existing value for [key] with [newValue].
 */


@ Operation <EOL> fun computeKeepValue ( key : Int ) : ValueWithCleanup ?

= cache . compute ( key ) { _ , existingValue -> existingValue }

/**
 * Models a computation that keeps the cache's existing value for [key].
 */


@ Operation <EOL> fun computeRemoveValue ( key : Int ) : ValueWithCleanup ?

= cache . compute ( key ) { _ , _ -> null }

/**
 * Models a computation that removes the cache's existing value for [key] (if any).
 */


internal fun List < IrDeclaration > . stableOrdered ( ) : List < IrDeclaration >

{ <EOL> val strictOrder = hashMapOf < IrDeclaration , Int > ( ) <EOL> var idx = <NUM_LIT:0> <EOL> forEach { <EOL> val shouldPreserveRelativeOrder = when ( it ) { <EOL> is IrProperty -> it . backingField != null && ! it . isConst <EOL> is IrAnonymousInitializer , is IrEnumEntry , is IrField -> true <EOL> else -> false <EOL> } <EOL> if ( shouldPreserveRelativeOrder ) { <EOL> strictOrder [ it ] = idx ++ <EOL> } <EOL> } <EOL> return sortedWith { a , b -> <EOL> val strictA = strictOrder [ a ] ? : Int . MAX_VALUE <EOL> val strictB = strictOrder [ b ] ? : Int . MAX_VALUE <EOL> if ( strictA == strictB ) { <EOL> val rA = a . render ( ) <EOL> val rB = b . render ( ) <EOL> rA . compareTo ( rB ) <EOL> } else strictA - strictB <EOL> } <EOL> }

/**
 * Sorts the declarations in the list using the result of [IrDeclaration.render] as the sorting key.
 *
 * The exceptions for which relative order is preserved as it matters for code generation:
 * * Properties with backing field
 * * Anonymous initializers
 * * Enum entries
 * * Fields
 */


@ ExperimentalSerializationApi <EOL> public abstract fun < T : Any > getContextual ( kClass : KClass < T > , typeArgumentsSerializers : List < KSerializer < * > > = emptyList ( ) ) : KSerializer < T > ?

/**
 * Returns a contextual serializer associated with a given [kClass].
 * If given class has generic parameters and module has provider for [kClass],
 * [typeArgumentsSerializers] are used to create serializer.
 * This method is used in context-sensitive operations on a property marked with [Contextual] by a [ContextualSerializer].
 *
 * @see SerializersModuleBuilder.contextual
 */


@ ExperimentalSerializationApi <EOL> public abstract fun < T : Any > getPolymorphic ( baseClass : KClass < in T > , value : T ) : SerializationStrategy < T > ?

/**
 * Returns a polymorphic serializer registered for a class of the given [value] in the scope of [baseClass].
 */


@ ExperimentalSerializationApi <EOL> public abstract fun < T : Any > getPolymorphic ( baseClass : KClass < in T > , serializedClassName : String ? ) : DeserializationStrategy < T > ?

/**
 * Returns a polymorphic deserializer registered for a [serializedClassName] in the scope of [baseClass]
 * or default value constructed from [serializedClassName] if a default serializer provider was registered.
 */


@ ExperimentalSerializationApi <EOL> public abstract fun dumpTo ( collector : SerializersModuleCollector )

/**
 * Copies contents of this module to the given [collector].
 */


public operator fun SerializersModule . plus ( other : SerializersModule ) : SerializersModule

= SerializersModule { <EOL> include ( this @ plus ) <EOL> include ( other ) <EOL> }

/**
 * Returns a combination of two serial modules
 *
 * If serializer for some class presents in both modules, a [SerializerAlreadyRegisteredException] is thrown.
 * To overwrite serializers, use [SerializersModule.overwriteWith] function.
 */


@ OptIn ( ExperimentalSerializationApi :: class ) <EOL> public infix fun SerializersModule . overwriteWith ( other : SerializersModule ) : SerializersModule

= SerializersModule { <EOL> include ( this @ overwriteWith ) <EOL> other . dumpTo ( object : SerializersModuleCollector { <EOL> override fun < T : Any > contextual ( kClass : KClass < T > , serializer : KSerializer < T > ) { <EOL> registerSerializer ( kClass , ContextualProvider . Argless ( serializer ) , allowOverwrite = true ) <EOL> } <EOL> override fun < T : Any > contextual ( kClass : KClass < T > , provider : ( serializers : List < KSerializer < * > > ) -> KSerializer < * > ) { <EOL> registerSerializer ( kClass , ContextualProvider . WithTypeArguments ( provider ) , allowOverwrite = true ) <EOL> } <EOL> override fun < Base : Any , Sub : Base > polymorphic ( baseClass : KClass < Base > , actualClass : KClass < Sub > , actualSerializer : KSerializer < Sub > ) { <EOL> registerPolymorphicSerializer ( baseClass , actualClass , actualSerializer , allowOverwrite = true ) <EOL> } <EOL> override fun < Base : Any > polymorphicDefaultSerializer ( baseClass : KClass < Base > , defaultSerializerProvider : ( value : Base ) -> SerializationStrategy < Base > ? <EOL> ) { <EOL> registerDefaultPolymorphicSerializer ( baseClass , defaultSerializerProvider , allowOverwrite = true ) <EOL> } <EOL> override fun < Base : Any > polymorphicDefaultDeserializer ( baseClass : KClass < Base > , defaultDeserializerProvider : ( className : String ? ) -> DeserializationStrategy < Base > ? <EOL> ) { <EOL> registerDefaultPolymorphicDeserializer ( baseClass , defaultDeserializerProvider , allowOverwrite = true ) <EOL> } <EOL> } ) <EOL> }

/**
 * Returns a combination of two serial modules
 *
 * If serializer for some class presents in both modules, result module
 * will contain serializer from [other] module.
 */


private fun createDependencyContainerForStdlibIfKlib ( stdlibFilePath : Path , environment : KotlinCoreEnvironment , projectContext : ProjectContext , ) : CommonDependenciesContainerImpl ?

{ <EOL> val stdlibKlib = resolveSingleFileKlib ( KFile ( stdlibFilePath ) , strategy = ToolingSingleFileKlibResolveStrategy ) . also { <EOL> try { <EOL> it . moduleName <EOL> } catch ( e : IOException ) { <EOL> return null <EOL> } <EOL> } <EOL> val stdlibModuleDescriptor = createAndInitializeKlibBasedStdlibCommonDescriptor ( stdlibKlib , environment , projectContext ) <EOL> return CommonDependenciesContainerImpl ( listOf ( stdlibModuleDescriptor ) ) <EOL> }

/**
 * Creates a dependency container that includes common stdlib, if the passed file path points to a metadata KLIB in the supported format.
 * Note that [resolveSingleFileKlib] is sensitive to the library layout and to the file extension.
 * In the case of a custom klib layout or file extension other than .klib, the library won't be resolved even if it contains .knm files.
 * For the current kotlin-stdlib-common.jar it will always return null, the purpose of the function is to simplify future migration.
 * It's been checked that the dependency container for a library with the supported layout is functional.
 * See KTI-1457.
 */


fun ClassLoweringPass . runOnFileInOrder ( irFile : IrFile )

{ <EOL> irFile . acceptVoid ( object : IrElementVisitorVoid { <EOL> override fun visitElement ( element : IrElement ) { <EOL> element . acceptChildrenVoid ( this ) <EOL> } <EOL> override fun visitClass ( declaration : IrClass ) { <EOL> lower ( declaration ) <EOL> declaration . acceptChildrenVoid ( this ) <EOL> } <EOL> } ) <EOL> }

/**
 * Copy of [runOnFilePostfix], but this implementation first lowers declaration, then its children.
 */


private fun smallestUnresolvablePrefix ( qualifiers : List < FirQualifierPart > , partiallyResolvedTypeRef : FirResolvedTypeRef ? , ) : List < FirQualifierPart >

{ <EOL> val totalQualifierCount = qualifiers . size <EOL> val resolvedQualifierCount = ( partiallyResolvedTypeRef ? . delegatedTypeRef as? FirUserTypeRef ) ? . qualifier ? . size <EOL> ? : calculatePartiallyResolvablePackageSegments ( qualifiers ) <EOL> val unresolvedQualifierCount = totalQualifierCount - resolvedQualifierCount <EOL> return if ( unresolvedQualifierCount > <NUM_LIT:1> ) { <EOL> qualifiers . dropLast ( unresolvedQualifierCount - <NUM_LIT:1> ) <EOL> } else { <EOL> qualifiers <EOL> } <EOL> }

/**
 * Returns the smallest non-resolvable prefix of the given [qualifiers].
 *
 * Examples:
 *
 * - Given `A.B.C` and `A.B` can be resolved, then `A.B.C` will be returned
 * - Given `A.B.C` and `A` cannot be resolved, then `A` will be returned
 * - Given `a.b.C` and package `a` exists but package `a.b` doesn't exist, `a.b.` will be returned.
 */


private fun tryCalculatingPartiallyResolvedTypeRef ( typeRef : FirTypeRef , data : ScopeClassDeclaration ) : FirResolvedTypeRef ?

{ <EOL> if ( typeRef !is FirUserTypeRef ) return null <EOL> val qualifiers = typeRef . qualifier <EOL> if ( qualifiers . size <= <NUM_LIT:1> ) { <EOL> return null <EOL> } <EOL> val qualifiersToTry = qualifiers . toMutableList ( ) <EOL> while ( qualifiersToTry . size > <NUM_LIT:1> ) { <EOL> qualifiersToTry . removeLast ( ) <EOL> val typeRefToTry = buildUserTypeRef { <EOL> qualifier += qualifiersToTry <EOL> isMarkedNullable = false <EOL> source = typeRef . source <EOL> } <EOL> val ( resolvedType , diagnostic ) = resolveType ( typeRefToTry , data ) <EOL> if ( resolvedType is ConeErrorType || diagnostic != null ) continue <EOL> return buildResolvedTypeRef { <EOL> source = qualifiersToTry . last ( ) . source <EOL> type = resolvedType <EOL> delegatedTypeRef = typeRefToTry <EOL> } <EOL> } <EOL> return null <EOL> }

/**
 * Tries to calculate a partially resolved type reference for a type reference which was resolved to an error type.
 * It will attempt to resolve the type with a decreasing number of qualifiers until it succeeds, allowing
 * partial resolution in case of errors in the type reference.
 *
 * This is useful for providing better IDE support when resolving partially incorrect types.
 *
 * @param typeRef The type reference for which to try to calculate a partially resolved type reference.
 * @param data The scope class declaration containing relevant information for resolving the reference.
 * @return A partially resolved type reference if it was resolved, or `null` otherwise.
 */


private fun calculatePartiallyResolvablePackageSegments ( qualifiers : List < FirQualifierPart > ) : Int

{ <EOL> if ( qualifiers . size <= <NUM_LIT:1> ) { <EOL> return <NUM_LIT:0> <EOL> } <EOL> val packageSegmentsToTry = qualifiers . mapTo ( mutableListOf ( ) ) { it . name . asString ( ) } <EOL> while ( packageSegmentsToTry . size > <NUM_LIT:1> ) { <EOL> packageSegmentsToTry . removeLast ( ) <EOL> if ( session . symbolProvider . getPackage ( FqName . fromSegments ( packageSegmentsToTry ) ) != null ) { <EOL> return packageSegmentsToTry . size <EOL> } <EOL> } <EOL> return <NUM_LIT:0> <EOL> }

/**
 * If the given [qualifiers] are interpreted as a fully qualified name,
 * calculates how many segments (from the left) can be resolved to an existing package.
 *
 * This is useful for providing better IDE support when resolving partially incorrect types.
 *
 * The last segment is never considered, i.e., if [qualifiers] is not empty, the result is always `< qualifiers.size`.
 */


/**
 * [ClassWithCompanion.f<caret>oo]
 */


private fun searchInheritors ( firClass : FirClass ) : List < ClassId >

{ <EOL> val ktClass = firClass . psi as? KtClass ? : return emptyList ( ) <EOL> val ktModule = when ( val classKtModule = firClass . llFirModuleData . ktModule ) { <EOL> is KtDanglingFileModule -> classKtModule . contextModule <EOL> else -> classKtModule <EOL> } <EOL> val scope = if ( firClass . isExpect ) { <EOL> val refinementDependents = KotlinModuleDependentsProvider . getInstance ( project ) . getRefinementDependents ( ktModule ) <EOL> GlobalSearchScope . union ( refinementDependents . map { it . contentScope } + ktModule . contentScope ) <EOL> } else { <EOL> ktModule . contentScope <EOL> } <EOL> return searchInScope ( ktClass , firClass . classId , scope ) <EOL> }

/**
 * Some notes about the search:
 *
 * - A Java class cannot legally extend a sealed Kotlin class (even in the same package), so we don't need to search for Java class
 * inheritors.
 * - Technically, we could use a package scope to narrow the search, but the search is already sufficiently narrow because it uses
 * supertype indices and is confined to the current `KtModule` in most cases (except for 'expect' classes). Finding a `PsiPackage`
 * for a `PackageScope` is not cheap, hence the decision to avoid it. If a `PackageScope` is needed in the future, it'd be best to
 * extract a `PackageNameScope` which operates just with the qualified package name, to avoid `PsiPackage`. (At the time of writing,
 * this is possible with the implementation of `PackageScope`.)
 * - We ignore local classes to avoid lazy resolve contract violations.
 * See KT-63795.
 * - For `expect` declarations, the search scope includes all modules with a dependsOn dependency on the containing module.
 * At the same time, `actual` declarations are restricted to the same module and require no special handling.
 * See KT-45842.
 * - KMP libraries are not yet supported.
 * See KT-65591.
 */


fun File . unzipTo ( destinationDirectory : File , fromSubdirectory : File = File ( "<STR_LIT:/>" ) , resetTimeAttributes : Boolean = false )

{ <EOL> withZipFileSystem { <EOL> it . file ( fromSubdirectory ) . recursiveCopyTo ( destinationDirectory , resetTimeAttributes ) <EOL> } <EOL> }

/**
 * Unpacks the contents of a zip archive located in [this] into the [destinationDirectory].
 *
 * @param destinationDirectory The directory to unpack the contents to.
 * @param resetTimeAttributes Whether to set the newly created files' time attributes
 * (creation time, last access time, and last modification time) to zero.
 * @param fromSubdirectory A subdirectory inside the archive to unpack. Specify "/" if you need to unpack the whole archive.
 */


fun Path . unzipTo ( destinationDirectory : Path , fromSubdirectory : Path = Paths . get ( "<STR_LIT:/>" ) , resetTimeAttributes : Boolean = false )

{ <EOL> File ( this ) . unzipTo ( File ( destinationDirectory ) , File ( fromSubdirectory ) , resetTimeAttributes ) <EOL> }


fun loadExportedForwardDeclarations ( modulesProviders : List < ModulesProvider > ) : CirProvidedClassifiers

{ <EOL> val classifiers = CommonizerMap < CirEntityId , CirProvided . Classifier > ( ) <EOL> modulesProviders . flatMap { moduleProvider -> moduleProvider . moduleInfos } <EOL> . mapNotNull { moduleInfo -> moduleInfo . cInteropAttributes } <EOL> . forEach { attrs -> readExportedForwardDeclarations ( attrs , classifiers :: set ) } <EOL> if ( classifiers . isEmpty ( ) ) return CirProvidedClassifiers . EMPTY <EOL> return CirProvidedClassifiersByModules ( true , classifiers ) <EOL> }

/**
 * Will load *all* forward declarations provided by all modules into a flat [CirProvidedClassifiers].
 * Note: This builds a union *not an intersection* of forward declarations.
 */


@ Test <EOL> fun testEncodePackedFloatArrayProtobuf ( )

{ <EOL> val obj = PackedFloatArrayCarrier ( <NUM_LIT> . toULong ( ) , floatArrayOf ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) ) <EOL> val s = ProtoBuf . encodeToHexString ( PackedFloatArrayCarrier . serializer ( ) , obj ) . uppercase ( ) <EOL> assertEquals ( """<STR_LIT>""" , s ) <EOL> }

/**
 * Test that when packing is specified the array is encoded as packed
 */


@ Test <EOL> fun testEncodeNonPackedFloatArrayProtobuf ( )

{ <EOL> val obj = NonPackedFloatArrayCarrier ( <NUM_LIT> . toULong ( ) , floatArrayOf ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) ) <EOL> val s = ProtoBuf . encodeToHexString ( NonPackedFloatArrayCarrier . serializer ( ) , obj ) . uppercase ( ) <EOL> assertEquals ( """<STR_LIT>""" , s ) <EOL> }

/**
 * Test that when packing is not specified the array is not encoded as packed. Note that protobuf 3
 * should encode as packed by default. The format doesn't allow specifying versions at this point so
 * the default remains the original.
 */


@ Test <EOL> fun testDecodePackedFloatArrayProtobuf ( )

{ <EOL> val obj : BaseFloatArrayCarrier = PackedFloatArrayCarrier ( <NUM_LIT> . toULong ( ) , floatArrayOf ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) ) <EOL> val s = """<STR_LIT>""" <EOL> val decodedPacked = ProtoBuf . decodeFromHexString ( PackedFloatArrayCarrier . serializer ( ) , s ) <EOL> assertEquals ( obj , decodedPacked ) <EOL> val decodedNonPacked = ProtoBuf . decodeFromHexString ( NonPackedFloatArrayCarrier . serializer ( ) , s ) <EOL> assertEquals ( obj , decodedNonPacked ) <EOL> }

/**
 * Per the specification decoders should support both packed and repeated fields independent of whether
 * a field is specified as packed in the schema. Check that decoding works with both types (packed and non-packed)
 * if the data itself is packed.
 */


@ Test <EOL> fun testDecodeNonPackedFloatArrayProtobuf ( )

/**
 * Per the specification decoders should support both packed and repeated fields independent of whether
 * a field is specified as packed in the schema. Check that decoding works with both types (packed and non-packed)
 * if the data itself is not packed.
 */


@ Test <EOL> fun testEncodeAnnotatedStringList ( )

{ <EOL> val obj = PackedStringCarrier ( listOf ( "<STR_LIT:aaa>" , "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> val expectedHex = "<STR_LIT>" <EOL> val encodedHex = ProtoBuf . encodeToHexString ( obj ) <EOL> assertEquals ( expectedHex , encodedHex ) <EOL> assertEquals ( obj , ProtoBuf . decodeFromHexString < PackedStringCarrier > ( expectedHex ) ) <EOL> val invalidPackedHex = "<STR_LIT>" <EOL> val decoded = ProtoBuf . decodeFromHexString < PackedStringCarrier > ( invalidPackedHex ) <EOL> val invalidString = "<STR_LIT>" <EOL> assertEquals ( PackedStringCarrier ( listOf ( invalidString ) ) , decoded ) <EOL> }

/**
 * Test that serializing a list of strings is never packed, and deserialization ignores the packing annotation.
 */


@ Test <EOL> fun testDecodeToplevelPackedList ( )

{ <EOL> val input = "<STR_LIT>" <EOL> val listData = listOf ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) <EOL> val decoded = ProtoBuf . decodeFromHexString < List < Int > > ( input ) <EOL> assertEquals ( listData , decoded ) <EOL> }

/**
 * Test that toplevel "packed" lists with only byte length also work.
 */


fun preprocessSources ( srcFiles : List < File > ) : List < File >

/**
 * Preprocess some sources and return path to the resulting file.
 * This function should be pure and should return the same output for given input
 * (required for incremental compilation).
 */


{ <EOL> var result = srcFiles <EOL> JpsServiceManager . getInstance ( ) . getExtensions ( SourcesPreprocessor :: class . java ) . forEach { <EOL> result = it . preprocessSources ( result ) <EOL> } <EOL> return result <EOL> }


internal fun shouldPerformPreLink ( config : KonanConfig , caches : ResolvedCacheBinaries , linkerOutputKind : LinkerOutputKind ) : Boolean

{ <EOL> val isStaticLibrary = linkerOutputKind == LinkerOutputKind . STATIC_LIBRARY && <EOL> config . isFinalBinary <EOL> val enabled = config . cacheSupport . preLinkCaches <EOL> val nonEmptyCaches = caches . static . isNotEmpty ( ) <EOL> return isStaticLibrary && enabled && nonEmptyCaches <EOL> }

/**
 * Check if we should link static caches into an object file before running full linkage.
 */