public fun < T > Flow < T > . catch ( action : suspend FlowCollector < T > . ( cause : Throwable ) -> Unit ) : Flow < T >

= <EOL> flow { <EOL> val exception = catchImpl ( this ) <EOL> if ( exception != null ) action ( exception ) <EOL> }

/**
 * Catches exceptions in the flow completion and calls a specified [action] with
 * the caught exception. This operator is *transparent* to exceptions that occur
 * in downstream flow and does not catch exceptions that are thrown to cancel the flow.
 *
 * For example:
 *
 * ```
 * flow { emitData() }
 * .map { computeOne(it) }
 * .catch { ... } // catches exceptions in emitData and computeOne
 * .map { computeTwo(it) }
 * .collect { process(it) } // throws exceptions from process and computeTwo
 * ```
 *
 * Conceptually, the action of `catch` operator is similar to wrapping the code of upstream flows with
 * `try { ... } catch (e: Throwable) { action(e) }`.
 *
 * Any exception in the [action] code itself proceeds downstream where it can be
 * caught by further `catch` operators if needed. If a particular exception does not need to be
 * caught it can be rethrown from the action of `catch` operator. For example:
 *
 * ```
 * flow.catch { e ->
 * if (e !is IOException) throw e // rethrow all but IOException
 * // e is IOException here
 * ...
 * }
 * ```
 *
 * The [action] code has [FlowCollector] as a receiver and can [emit][FlowCollector.emit] values downstream.
 * For example, caught exception can be replaced with some wrapper value for errors:
 *
 * ```
 * flow.catch { e -> emit(ErrorWrapperValue(e)) }
 * ```
 *
 * The [action] can also use [emitAll] to fallback on some other flow in case of an error. However, to
 * retry an original flow use [retryWhen] operator that can retry the flow multiple times without
 * introducing ever-growing stack of suspending calls.
 */


public fun < T > Flow < T > . retry ( retries : Long = Long . MAX_VALUE , predicate : suspend ( cause : Throwable ) -> Boolean = { true } ) : Flow < T >

{ <EOL> require ( retries > <NUM_LIT:0> ) { "<STR_LIT>" } <EOL> return retryWhen { cause , attempt -> attempt < retries && predicate ( cause ) } <EOL> }

/**
 * Retries collection of the given flow up to [retries] times when an exception that matches the
 * given [predicate] occurs in the upstream flow. This operator is *transparent* to exceptions that occur
 * in downstream flow and does not retry on exceptions that are thrown to cancel the flow.
 *
 * See [catch] for details on how exceptions are caught in flows.
 *
 * The default value of [retries] parameter is [Long.MAX_VALUE]. This value effectively means to retry forever.
 * This operator is a shorthand for the following code (see [retryWhen]). Note that `attempt` is checked first
 * and [predicate] is not called when it reaches the given number of [retries]:
 *
 * ```
 * retryWhen { cause, attempt -> attempt < retries && predicate(cause) }
 * ```
 *
 * The [predicate] parameter is always true by default. The [predicate] is a suspending function,
 * so it can be also used to introduce delay before retry, for example:
 *
 * ```
 * flow.retry(3) { e ->
 * // retry on any IOException but also introduce delay if retrying
 * (e is IOException).also { if (it) delay(1000) }
 * }
 * ```
 *
 * @throws IllegalArgumentException when [retries] is not positive.
 */


public fun < T > Flow < T > . retryWhen ( predicate : suspend FlowCollector < T > . ( cause : Throwable , attempt : Long ) -> Boolean ) : Flow < T >

= <EOL> flow { <EOL> var attempt = <NUM_LIT:0L> <EOL> var shallRetry : Boolean <EOL> do { <EOL> shallRetry = false <EOL> val cause = catchImpl ( this ) <EOL> if ( cause != null ) { <EOL> if ( predicate ( cause , attempt ) ) { <EOL> shallRetry = true <EOL> attempt ++ <EOL> } else { <EOL> throw cause <EOL> } <EOL> } <EOL> } while ( shallRetry ) <EOL> }

/**
 * Retries collection of the given flow when an exception occurs in the upstream flow and the
 * [predicate] returns true. The predicate also receives an `attempt` number as parameter,
 * starting from zero on the initial call. This operator is *transparent* to exceptions that occur
 * in downstream flow and does not retry on exceptions that are thrown to cancel the flow.
 *
 * For example, the following call retries the flow forever if the error is caused by `IOException`, but
 * stops after 3 retries on any other exception:
 *
 * ```
 * flow.retryWhen { cause, attempt -> cause is IOException || attempt < 3 }
 * ```
 *
 * To implement a simple retry logic with a limit on the number of retries use [retry] operator.
 *
 * Similarly to [catch] operator, the [predicate] code has [FlowCollector] as a receiver and can
 * [emit][FlowCollector.emit] values downstream.
 * The [predicate] is a suspending function, so it can be used to introduce delay before retry, for example:
 *
 * ```
 * flow.retryWhen { cause, attempt ->
 * if (cause is IOException) { // retry on IOException
 * emit(RetryWrapperValue(e))
 * delay(1000) // delay for one second before retry
 * true
 * } else { // do not retry otherwise
 * false
 * }
 * }
 * ```
 *
 * See [catch] for more details.
 */


@ kotlin . internal . InlineOnly <EOL> public inline fun charset ( charsetName : String ) : Charset

= Charset . forName ( charsetName )

/**
 * Returns a named charset with the given [charsetName] name.
 *
 * @throws UnsupportedCharsetException If the specified named charset is not available.
 */


@ Test <EOL> fun testAwaitCancellation ( )

= runTest { <EOL> expect ( <NUM_LIT:1> ) <EOL> val mono = mono { delay ( Long . MAX_VALUE ) } . doOnSubscribe { expect ( <NUM_LIT:3> ) } . doOnCancel { expect ( <NUM_LIT:5> ) } <EOL> val job = launch ( start = CoroutineStart . UNDISPATCHED ) { <EOL> try { <EOL> expect ( <NUM_LIT:2> ) <EOL> mono . awaitSingleOrNull ( ) <EOL> } catch ( e : CancellationException ) { <EOL> expect ( <NUM_LIT:6> ) <EOL> throw e <EOL> } <EOL> } <EOL> expect ( <NUM_LIT:4> ) <EOL> job . cancelAndJoin ( ) <EOL> finish ( <NUM_LIT:7> ) <EOL> }

/** Tests that calls to [awaitSingleOrNull] (and, thus, to the rest of such functions) throw [CancellationException]
 * and unsubscribe from the publisher when their [Job] is cancelled. */


{ <EOL> val mono = mono { <EOL> withTimeout ( <NUM_LIT:1> ) { delay ( <NUM_LIT:100> ) } <EOL> } <EOL> try { <EOL> mono . doOnSubscribe { expect ( <NUM_LIT:1> ) } <EOL> . doOnNext { expectUnreached ( ) } <EOL> . doOnSuccess { expectUnreached ( ) } <EOL> . doOnError { expect ( <NUM_LIT:2> ) } <EOL> . doOnCancel { expectUnreached ( ) } <EOL> . block ( ) <EOL> } catch ( e : CancellationException ) { <EOL> expect ( <NUM_LIT:3> ) <EOL> } <EOL> finish ( <NUM_LIT:4> ) <EOL> }

/** Test that cancelling a [mono] due to a timeout does throw an exception. */


@ Test <EOL> fun testDownstreamCancellationDoesNotThrow ( )

= runTest { <EOL> var i = <NUM_LIT:0> <EOL> Hooks . onOperatorError ( "<STR_LIT>" ) { t , a -> <EOL> expectUnreached ( ) <EOL> t <EOL> } <EOL> val mono = mono ( Dispatchers . Unconfined ) { expect ( <NUM_LIT:5> * i + <NUM_LIT:3> ) ; delay ( Long . MAX_VALUE ) } <EOL> . doOnSubscribe { expect ( <NUM_LIT:5> * i + <NUM_LIT:2> ) } <EOL> . doOnNext { expectUnreached ( ) } <EOL> . doOnSuccess { expectUnreached ( ) } <EOL> . doOnError { expectUnreached ( ) } <EOL> . doOnCancel { expect ( <NUM_LIT:5> * i + <NUM_LIT:4> ) } <EOL> val n = <NUM_LIT> <EOL> repeat ( n ) { <EOL> i = it <EOL> expect ( <NUM_LIT:5> * i + <NUM_LIT:1> ) <EOL> mono . awaitCancelAndJoin ( ) <EOL> expect ( <NUM_LIT:5> * i + <NUM_LIT:5> ) <EOL> } <EOL> finish ( <NUM_LIT:5> * n + <NUM_LIT:1> ) <EOL> Hooks . resetOnOperatorError ( "<STR_LIT>" ) <EOL> }

/** Test that when the reason for cancellation of a [mono] is that the downstream doesn't want its results anymore,
 * this is considered normal behavior and exceptions are not propagated. */


@ Test <EOL> fun testRethrowingDownstreamCancellation ( )

= runTest { <EOL> var i = <NUM_LIT:0> <EOL> Hooks . onOperatorError ( "<STR_LIT>" ) { t , a -> <EOL> expect ( i * <NUM_LIT:6> + <NUM_LIT:5> ) <EOL> t <EOL> } <EOL> val mono = mono ( Dispatchers . Unconfined ) { <EOL> expect ( i * <NUM_LIT:6> + <NUM_LIT:3> ) <EOL> try { <EOL> delay ( Long . MAX_VALUE ) <EOL> } catch ( e : CancellationException ) { <EOL> throw TestException ( ) <EOL> } <EOL> } <EOL> . doOnSubscribe { expect ( i * <NUM_LIT:6> + <NUM_LIT:2> ) } <EOL> . doOnNext { expectUnreached ( ) } <EOL> . doOnSuccess { expectUnreached ( ) } <EOL> . doOnError { expectUnreached ( ) } <EOL> . doOnCancel { expect ( i * <NUM_LIT:6> + <NUM_LIT:4> ) } <EOL> val n = <NUM_LIT> <EOL> repeat ( n ) { <EOL> i = it <EOL> expect ( i * <NUM_LIT:6> + <NUM_LIT:1> ) <EOL> mono . awaitCancelAndJoin ( ) <EOL> expect ( i * <NUM_LIT:6> + <NUM_LIT:6> ) <EOL> } <EOL> finish ( n * <NUM_LIT:6> + <NUM_LIT:1> ) <EOL> Hooks . resetOnOperatorError ( "<STR_LIT>" ) <EOL> }

/** Test that, when [Mono] is cancelled by the downstream and throws during handling the cancellation, the resulting
 * error is propagated to [Hooks.onOperatorError]. */


private suspend fun < T > Mono < T > . awaitCancelAndJoin ( )

= coroutineScope { <EOL> async ( start = CoroutineStart . UNDISPATCHED ) { <EOL> awaitSingleOrNull ( ) <EOL> } . cancelAndJoin ( ) <EOL> }

/** Run the given [Mono], cancel it, wait for the cancellation handler to finish, and return only then.
 *
 * Will not work in the general case, but here, when the publisher uses [Dispatchers.Unconfined], this seems to
 * ensure that the cancellation handler will have nowhere to execute but serially with the cancellation. */


@ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> internal expect fun convertDurationUnit ( value : Double , sourceUnit : DurationUnit , targetUnit : DurationUnit ) : Double

/** Converts the given time duration [value] expressed in the specified [sourceUnit] into the specified [targetUnit]. */


{ <EOL> var regex : Regex <EOL> var result : List < String > <EOL> regex = "<STR_LIT>" . toRegex ( ) <EOL> result = regex . allGroups ( "<STR_LIT>" ) <EOL> assertEquals ( <NUM_LIT:2> , result . count ( ) ) <EOL> assertEquals ( "<STR_LIT>" , result [ <NUM_LIT:0> ] ) <EOL> assertEquals ( "<STR_LIT>" , result [ <NUM_LIT:1> ] ) <EOL> regex = "<STR_LIT>" . toRegex ( ) <EOL> result = regex . allGroups ( "<STR_LIT>" ) <EOL> assertEquals ( <NUM_LIT:2> , result . count ( ) ) <EOL> assertEquals ( "<STR_LIT>" , result [ <NUM_LIT:0> ] ) <EOL> assertEquals ( "<STR_LIT>" , result [ <NUM_LIT:1> ] ) <EOL> }

/**
 * Tests regular expressions with lookbehind asserts.
 */


{ <EOL> var regex : Regex <EOL> var result : List < String > <EOL> regex = "<STR_LIT>" . toRegex ( ) <EOL> result = regex . allGroups ( "<STR_LIT>" ) <EOL> assertEquals ( <NUM_LIT:2> , result . count ( ) ) <EOL> assertEquals ( "<STR_LIT>" , result [ <NUM_LIT:0> ] ) <EOL> assertEquals ( "<STR_LIT>" , result [ <NUM_LIT:1> ] ) <EOL> regex = "<STR_LIT>" . toRegex ( ) <EOL> result = regex . allGroups ( "<STR_LIT>" ) <EOL> assertEquals ( <NUM_LIT:2> , result . count ( ) ) <EOL> assertEquals ( "<STR_LIT>" , result [ <NUM_LIT:0> ] ) <EOL> assertEquals ( "<STR_LIT>" , result [ <NUM_LIT:1> ] ) <EOL> regex = "<STR_LIT>" . toRegex ( ) <EOL> result = regex . allGroups ( "<STR_LIT>" ) <EOL> assertEquals ( <NUM_LIT:2> , result . count ( ) ) <EOL> assertEquals ( "<STR_LIT>" , result [ <NUM_LIT:0> ] ) <EOL> assertEquals ( "<STR_LIT>" , result [ <NUM_LIT:1> ] ) <EOL> regex = "<STR_LIT>" . toRegex ( ) <EOL> result = regex . allGroups ( "<STR_LIT>" ) <EOL> assertEquals ( <NUM_LIT:1> , result . count ( ) ) <EOL> assertEquals ( "<STR_LIT>" , result [ <NUM_LIT:0> ] ) <EOL> }

/**
 * Tests regular expressions with lookahead asserts.
 */


public actual fun reverse ( ) : StringBuilder

{ <EOL> var reversed = "<STR_LIT>" <EOL> var index = string . length - <NUM_LIT:1> <EOL> while ( index >= <NUM_LIT:0> ) { <EOL> val low = string [ index -- ] <EOL> if ( low . isLowSurrogate ( ) && index >= <NUM_LIT:0> ) { <EOL> val high = string [ index -- ] <EOL> if ( high . isHighSurrogate ( ) ) { <EOL> reversed = reversed + high + low <EOL> } else { <EOL> reversed = reversed + low + high <EOL> } <EOL> } else { <EOL> reversed += low <EOL> } <EOL> } <EOL> string = reversed <EOL> return this <EOL> }

/**
 * Reverses the contents of this string builder and returns this instance.
 *
 * Surrogate pairs included in this string builder are treated as single characters.
 * Therefore, the order of the high-low surrogates is never reversed.
 *
 * Note that the reverse operation may produce new surrogate pairs that were unpaired low-surrogates and high-surrogates before the operation.
 * For example, reversing `"\uDC00\uD800"` produces `"\uD800\uDC00"` which is a valid surrogate pair.
 */


public actual fun append ( value : Any ? ) : StringBuilder

{ <EOL> string += value . toString ( ) <EOL> return this <EOL> }

/**
 * Appends the string representation of the specified object [value] to this string builder and returns this instance.
 *
 * The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,
 * and then that string was appended to this string builder.
 */


@ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> public actual fun append ( value : Boolean ) : StringBuilder

{ <EOL> string += value <EOL> return this <EOL> }

/**
 * Appends the string representation of the specified boolean [value] to this string builder and returns this instance.
 *
 * The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,
 * and then that string was appended to this string builder.
 */


@ SinceKotlin ( "<STR_LIT:1.9>" ) <EOL> public fun append ( value : Byte ) : StringBuilder

= append ( value . toString ( ) )

/**
 * Appends the string representation of the specified byte [value] to this string builder and returns this instance.
 *
 * The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,
 * and then that string was appended to this string builder.
 */


@ SinceKotlin ( "<STR_LIT:1.9>" ) <EOL> public fun append ( value : Short ) : StringBuilder

= append ( value . toString ( ) )

/**
 * Appends the string representation of the specified short [value] to this string builder and returns this instance.
 *
 * The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,
 * and then that string was appended to this string builder.
 */


@ SinceKotlin ( "<STR_LIT:1.9>" ) <EOL> public actual fun append ( value : Int ) : StringBuilder

= append ( value . toString ( ) )

/**
 * Appends the string representation of the specified int [value] to this string builder and returns this instance.
 *
 * The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,
 * and then that string was appended to this string builder.
 */


@ SinceKotlin ( "<STR_LIT:1.9>" ) <EOL> public actual fun append ( value : Long ) : StringBuilder

= append ( value . toString ( ) )

/**
 * Appends the string representation of the specified long [value] to this string builder and returns this instance.
 *
 * The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,
 * and then that string was appended to this string builder.
 */


@ SinceKotlin ( "<STR_LIT:1.9>" ) <EOL> public actual fun append ( value : Float ) : StringBuilder

= append ( value . toString ( ) )

/**
 * Appends the string representation of the specified float [value] to this string builder and returns this instance.
 *
 * The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,
 * and then that string was appended to this string builder.
 */


@ SinceKotlin ( "<STR_LIT:1.9>" ) <EOL> public actual fun append ( value : Double ) : StringBuilder

= append ( value . toString ( ) )

/**
 * Appends the string representation of the specified double [value] to this string builder and returns this instance.
 *
 * The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,
 * and then that string was appended to this string builder.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun append ( value : CharArray ) : StringBuilder

{ <EOL> string += value . concatToString ( ) <EOL> return this <EOL> }

/**
 * Appends characters in the specified character array [value] to this string builder and returns this instance.
 *
 * Characters are appended in order, starting at the index 0.
 */


@ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> public actual fun append ( value : String ? ) : StringBuilder

{ <EOL> this . string += value ? : "<STR_LIT:null>" <EOL> return this <EOL> }

/**
 * Appends the specified string [value] to this string builder and returns this instance.
 *
 * If [value] is `null`, then the four characters `"null"` are appended.
 */


@ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ Deprecated ( "<STR_LIT>" , level = DeprecationLevel . WARNING ) <EOL> public actual fun capacity ( ) : Int

= length

/**
 * Returns the current capacity of this string builder.
 *
 * The capacity is the maximum length this string builder can have before an allocation occurs.
 *
 * In Kotlin/JS implementation of StringBuilder the value returned from this method may not indicate the actual size of the backing storage.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun ensureCapacity ( minimumCapacity : Int )

{ <EOL> }

/**
 * Ensures that the capacity of this string builder is at least equal to the specified [minimumCapacity].
 *
 * If the current capacity is less than the [minimumCapacity], a new backing storage is allocated with greater capacity.
 * Otherwise, this method takes no action and simply returns.
 *
 * In Kotlin/JS implementation of StringBuilder the size of the backing storage is not extended to comply the given [minimumCapacity],
 * thus calling this method has no effect on the further performance of operations.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun indexOf ( string : String ) : Int

= this . string . asDynamic ( ) . indexOf ( string )

/**
 * Returns the index within this string builder of the first occurrence of the specified [string].
 *
 * Returns `-1` if the specified [string] does not occur in this string builder.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun indexOf ( string : String , startIndex : Int ) : Int

= this . string . asDynamic ( ) . indexOf ( string , startIndex )

/**
 * Returns the index within this string builder of the first occurrence of the specified [string],
 * starting at the specified [startIndex].
 *
 * Returns `-1` if the specified [string] does not occur in this string builder starting at the specified [startIndex].
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun lastIndexOf ( string : String ) : Int

= this . string . asDynamic ( ) . lastIndexOf ( string )

/**
 * Returns the index within this string builder of the last occurrence of the specified [string].
 * The last occurrence of empty string `""` is considered to be at the index equal to `this.length`.
 *
 * Returns `-1` if the specified [string] does not occur in this string builder.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun lastIndexOf ( string : String , startIndex : Int ) : Int

{ <EOL> if ( string . isEmpty ( ) && startIndex < <NUM_LIT:0> ) return - <NUM_LIT:1> <EOL> return this . string . asDynamic ( ) . lastIndexOf ( string , startIndex ) <EOL> }

/**
 * Returns the index within this string builder of the last occurrence of the specified [string],
 * starting from the specified [startIndex] toward the beginning.
 *
 * Returns `-1` if the specified [string] does not occur in this string builder starting at the specified [startIndex].
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun insert ( index : Int , value : Boolean ) : StringBuilder

{ <EOL> AbstractList . checkPositionIndex ( index , length ) <EOL> string = string . substring ( <NUM_LIT:0> , index ) + value + string . substring ( index ) <EOL> return this <EOL> }

/**
 * Inserts the string representation of the specified boolean [value] into this string builder at the specified [index] and returns this instance.
 *
 * The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,
 * and then that string was inserted into this string builder at the specified [index].
 *
 * @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
 */


@ SinceKotlin ( "<STR_LIT:1.9>" ) <EOL> public fun insert ( index : Int , value : Byte ) : StringBuilder

= insert ( index , value . toString ( ) )

/**
 * Inserts the string representation of the specified byte [value] into this string builder at the specified [index] and returns this instance.
 *
 * The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,
 * and then that string was inserted into this string builder at the specified [index].
 *
 * @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
 */


@ SinceKotlin ( "<STR_LIT:1.9>" ) <EOL> public fun insert ( index : Int , value : Short ) : StringBuilder

/**
 * Inserts the string representation of the specified short [value] into this string builder at the specified [index] and returns this instance.
 *
 * The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,
 * and then that string was inserted into this string builder at the specified [index].
 *
 * @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
 */


@ SinceKotlin ( "<STR_LIT:1.9>" ) <EOL> public actual fun insert ( index : Int , value : Int ) : StringBuilder

/**
 * Inserts the string representation of the specified int [value] into this string builder at the specified [index] and returns this instance.
 *
 * The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,
 * and then that string was inserted into this string builder at the specified [index].
 *
 * @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
 */


@ SinceKotlin ( "<STR_LIT:1.9>" ) <EOL> public actual fun insert ( index : Int , value : Long ) : StringBuilder

/**
 * Inserts the string representation of the specified long [value] into this string builder at the specified [index] and returns this instance.
 *
 * The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,
 * and then that string was inserted into this string builder at the specified [index].
 *
 * @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
 */


@ SinceKotlin ( "<STR_LIT:1.9>" ) <EOL> public actual fun insert ( index : Int , value : Float ) : StringBuilder

/**
 * Inserts the string representation of the specified float [value] into this string builder at the specified [index] and returns this instance.
 *
 * The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,
 * and then that string was inserted into this string builder at the specified [index].
 *
 * @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
 */


@ SinceKotlin ( "<STR_LIT:1.9>" ) <EOL> public actual fun insert ( index : Int , value : Double ) : StringBuilder

/**
 * Inserts the string representation of the specified double [value] into this string builder at the specified [index] and returns this instance.
 *
 * The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,
 * and then that string was inserted into this string builder at the specified [index].
 *
 * @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun insert ( index : Int , value : Char ) : StringBuilder

/**
 * Inserts the specified character [value] into this string builder at the specified [index] and returns this instance.
 *
 * @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun insert ( index : Int , value : CharArray ) : StringBuilder

{ <EOL> AbstractList . checkPositionIndex ( index , length ) <EOL> string = string . substring ( <NUM_LIT:0> , index ) + value . concatToString ( ) + string . substring ( index ) <EOL> return this <EOL> }

/**
 * Inserts characters in the specified character array [value] into this string builder at the specified [index] and returns this instance.
 *
 * The inserted characters go in same order as in the [value] character array, starting at [index].
 *
 * @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun insert ( index : Int , value : CharSequence ? ) : StringBuilder

{ <EOL> AbstractList . checkPositionIndex ( index , length ) <EOL> string = string . substring ( <NUM_LIT:0> , index ) + value . toString ( ) + string . substring ( index ) <EOL> return this <EOL> }

/**
 * Inserts characters in the specified character sequence [value] into this string builder at the specified [index] and returns this instance.
 *
 * The inserted characters go in the same order as in the [value] character sequence, starting at [index].
 *
 * @param index the position in this string builder to insert at.
 * @param value the character sequence from which characters are inserted. If [value] is `null`, then the four characters `"null"` are inserted.
 *
 * @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun insert ( index : Int , value : Any ? ) : StringBuilder

/**
 * Inserts the string representation of the specified object [value] into this string builder at the specified [index] and returns this instance.
 *
 * The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,
 * and then that string was inserted into this string builder at the specified [index].
 *
 * @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun insert ( index : Int , value : String ? ) : StringBuilder

{ <EOL> AbstractList . checkPositionIndex ( index , length ) <EOL> val toInsert = value ? : "<STR_LIT:null>" <EOL> this . string = this . string . substring ( <NUM_LIT:0> , index ) + toInsert + this . string . substring ( index ) <EOL> return this <EOL> }

/**
 * Inserts the string [value] into this string builder at the specified [index] and returns this instance.
 *
 * If [value] is `null`, then the four characters `"null"` are inserted.
 *
 * @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun setLength ( newLength : Int )

{ <EOL> if ( newLength < <NUM_LIT:0> ) { <EOL> throw IllegalArgumentException ( "<STR_LIT>" ) <EOL> } <EOL> if ( newLength <= length ) { <EOL> string = string . substring ( <NUM_LIT:0> , newLength ) <EOL> } else { <EOL> for ( i in length until newLength ) { <EOL> string += '<CHAR_LIT>' <EOL> } <EOL> } <EOL> }

/**
 * Sets the length of this string builder to the specified [newLength].
 *
 * If the [newLength] is less than the current length, it is changed to the specified [newLength].
 * Otherwise, null characters '\u0000' are appended to this string builder until its length is less than the [newLength].
 *
 * Note that in Kotlin/JS [set] operator function has non-constant execution time complexity.
 * Therefore, increasing length of this string builder and then updating each character by index may slow down your program.
 *
 * @throws IndexOutOfBoundsException or [IllegalArgumentException] if [newLength] is less than zero.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun substring ( startIndex : Int ) : String

{ <EOL> AbstractList . checkPositionIndex ( startIndex , length ) <EOL> return string . substring ( startIndex ) <EOL> }

/**
 * Returns a new [String] that contains characters in this string builder at [startIndex] (inclusive) and up to the [length] (exclusive).
 *
 * @throws IndexOutOfBoundsException if [startIndex] is less than zero or greater than the length of this string builder.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun substring ( startIndex : Int , endIndex : Int ) : String

{ <EOL> AbstractList . checkBoundsIndexes ( startIndex , endIndex , length ) <EOL> return string . substring ( startIndex , endIndex ) <EOL> }

/**
 * Returns a new [String] that contains characters in this string builder at [startIndex] (inclusive) and up to the [endIndex] (exclusive).
 *
 * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of this string builder indices or when `startIndex > endIndex`.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun trimToSize ( )

{ <EOL> }

/**
 * Attempts to reduce storage used for this string builder.
 *
 * If the backing storage of this string builder is larger than necessary to hold its current contents,
 * then it may be resized to become more space efficient.
 * Calling this method may, but is not required to, affect the value of the [capacity] property.
 *
 * In Kotlin/JS implementation of StringBuilder the size of the backing storage is always equal to the length of the string builder.
 */


@ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> public fun clear ( ) : StringBuilder

{ <EOL> string = "<STR_LIT>" <EOL> return this <EOL> }

/**
 * Clears the content of this string builder making it empty and returns this instance.
 *
 * @sample samples.text.Strings.clearStringBuilder
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public operator fun set ( index : Int , value : Char )

{ <EOL> AbstractList . checkElementIndex ( index , length ) <EOL> string = string . substring ( <NUM_LIT:0> , index ) + value + string . substring ( index + <NUM_LIT:1> ) <EOL> }

/**
 * Sets the character at the specified [index] to the specified [value].
 *
 * @throws IndexOutOfBoundsException if [index] is out of bounds of this string builder.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public fun setRange ( startIndex : Int , endIndex : Int , value : String ) : StringBuilder

{ <EOL> checkReplaceRange ( startIndex , endIndex , length ) <EOL> this . string = this . string . substring ( <NUM_LIT:0> , startIndex ) + value + this . string . substring ( endIndex ) <EOL> return this <EOL> }

/**
 * Replaces characters in the specified range of this string builder with characters in the specified string [value] and returns this instance.
 *
 * @param startIndex the beginning (inclusive) of the range to replace.
 * @param endIndex the end (exclusive) of the range to replace.
 * @param value the string to replace with.
 *
 * @throws IndexOutOfBoundsException or [IllegalArgumentException] if [startIndex] is less than zero, greater than the length of this string builder, or `startIndex > endIndex`.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public fun deleteAt ( index : Int ) : StringBuilder

{ <EOL> AbstractList . checkElementIndex ( index , length ) <EOL> string = string . substring ( <NUM_LIT:0> , index ) + string . substring ( index + <NUM_LIT:1> ) <EOL> return this <EOL> }

/**
 * Removes the character at the specified [index] from this string builder and returns this instance.
 *
 * If the `Char` at the specified [index] is part of a supplementary code point, this method does not remove the entire supplementary character.
 *
 * @param index the index of `Char` to remove.
 *
 * @throws IndexOutOfBoundsException if [index] is out of bounds of this string builder.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public fun deleteRange ( startIndex : Int , endIndex : Int ) : StringBuilder

{ <EOL> checkReplaceRange ( startIndex , endIndex , length ) <EOL> string = string . substring ( <NUM_LIT:0> , startIndex ) + string . substring ( endIndex ) <EOL> return this <EOL> }

/**
 * Removes characters in the specified range from this string builder and returns this instance.
 *
 * @param startIndex the beginning (inclusive) of the range to remove.
 * @param endIndex the end (exclusive) of the range to remove.
 *
 * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] is out of range of this string builder indices or when `startIndex > endIndex`.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public fun toCharArray ( destination : CharArray , destinationOffset : Int = <NUM_LIT:0> , startIndex : Int = <NUM_LIT:0> , endIndex : Int = this . length )

{ <EOL> AbstractList . checkBoundsIndexes ( startIndex , endIndex , length ) <EOL> AbstractList . checkBoundsIndexes ( destinationOffset , destinationOffset + endIndex - startIndex , destination . size ) <EOL> var dstIndex = destinationOffset <EOL> for ( index in startIndex until endIndex ) { <EOL> destination [ dstIndex ++ ] = string [ index ] <EOL> } <EOL> }

/**
 * Copies characters from this string builder into the [destination] character array.
 *
 * @param destination the array to copy to.
 * @param destinationOffset the position in the array to copy to, 0 by default.
 * @param startIndex the beginning (inclusive) of the range to copy, 0 by default.
 * @param endIndex the end (exclusive) of the range to copy, length of this string builder by default.
 *
 * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of this string builder indices or when `startIndex > endIndex`.
 * @throws IndexOutOfBoundsException when the subrange doesn't fit into the [destination] array starting at the specified [destinationOffset],
 * or when that index is out of the [destination] array indices range.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public fun appendRange ( value : CharArray , startIndex : Int , endIndex : Int ) : StringBuilder

{ <EOL> string += value . concatToString ( startIndex , endIndex ) <EOL> return this <EOL> }

/**
 * Appends characters in a subarray of the specified character array [value] to this string builder and returns this instance.
 *
 * Characters are appended in order, starting at specified [startIndex].
 *
 * @param value the array from which characters are appended.
 * @param startIndex the beginning (inclusive) of the subarray to append.
 * @param endIndex the end (exclusive) of the subarray to append.
 *
 * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of the [value] array indices or when `startIndex > endIndex`.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public fun appendRange ( value : CharSequence , startIndex : Int , endIndex : Int ) : StringBuilder

{ <EOL> val stringCsq = value . toString ( ) <EOL> AbstractList . checkBoundsIndexes ( startIndex , endIndex , stringCsq . length ) <EOL> string += stringCsq . substring ( startIndex , endIndex ) <EOL> return this <EOL> }

/**
 * Appends a subsequence of the specified character sequence [value] to this string builder and returns this instance.
 *
 * @param value the character sequence from which a subsequence is appended.
 * @param startIndex the beginning (inclusive) of the subsequence to append.
 * @param endIndex the end (exclusive) of the subsequence to append.
 *
 * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of the [value] character sequence indices or when `startIndex > endIndex`.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public fun insertRange ( index : Int , value : CharArray , startIndex : Int , endIndex : Int ) : StringBuilder

{ <EOL> AbstractList . checkPositionIndex ( index , this . length ) <EOL> string = string . substring ( <NUM_LIT:0> , index ) + value . concatToString ( startIndex , endIndex ) + string . substring ( index ) <EOL> return this <EOL> }

/**
 * Inserts characters in a subarray of the specified character array [value] into this string builder at the specified [index] and returns this instance.
 *
 * The inserted characters go in same order as in the [value] array, starting at [index].
 *
 * @param index the position in this string builder to insert at.
 * @param value the array from which characters are inserted.
 * @param startIndex the beginning (inclusive) of the subarray to insert.
 * @param endIndex the end (exclusive) of the subarray to insert.
 *
 * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of the [value] array indices or when `startIndex > endIndex`.
 * @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public fun insertRange ( index : Int , value : CharSequence , startIndex : Int , endIndex : Int ) : StringBuilder

{ <EOL> AbstractList . checkPositionIndex ( index , length ) <EOL> val stringCsq = value . toString ( ) <EOL> AbstractList . checkBoundsIndexes ( startIndex , endIndex , stringCsq . length ) <EOL> string = string . substring ( <NUM_LIT:0> , index ) + stringCsq . substring ( startIndex , endIndex ) + string . substring ( index ) <EOL> return this <EOL> }

/**
 * Inserts characters in a subsequence of the specified character sequence [value] into this string builder at the specified [index] and returns this instance.
 *
 * The inserted characters go in the same order as in the [value] character sequence, starting at [index].
 *
 * @param index the position in this string builder to insert at.
 * @param value the character sequence from which a subsequence is inserted.
 * @param startIndex the beginning (inclusive) of the subsequence to insert.
 * @param endIndex the end (exclusive) of the subsequence to insert.
 *
 * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of the [value] character sequence indices or when `startIndex > endIndex`.
 * @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
 */


@ Suppress ( "<STR_LIT>" , "<STR_LIT:NOTHING_TO_INLINE>" ) <EOL> @ SinceKotlin ( "<STR_LIT:1.9>" ) <EOL> public actual inline fun StringBuilder . append ( value : Byte ) : StringBuilder

= this . append ( value )

/**
 * Appends the string representation of the specified byte [value] to this string builder and returns this instance.
 *
 * The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,
 * and then that string was appended to this string builder.
 */


@ Suppress ( "<STR_LIT>" , "<STR_LIT:NOTHING_TO_INLINE>" ) <EOL> @ SinceKotlin ( "<STR_LIT:1.9>" ) <EOL> public actual inline fun StringBuilder . append ( value : Short ) : StringBuilder

= this . append ( value )

/**
 * Appends the string representation of the specified short [value] to this string builder and returns this instance.
 *
 * The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,
 * and then that string was appended to this string builder.
 */


@ Suppress ( "<STR_LIT>" , "<STR_LIT:NOTHING_TO_INLINE>" ) <EOL> @ SinceKotlin ( "<STR_LIT:1.9>" ) <EOL> public actual inline fun StringBuilder . insert ( index : Int , value : Byte ) : StringBuilder

= this . insert ( index , value )

/**
 * Inserts the string representation of the specified byte [value] into this string builder at the specified [index] and returns this instance.
 *
 * The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,
 * and then that string was inserted into this string builder at the specified [index].
 *
 * @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
 */


@ Suppress ( "<STR_LIT>" , "<STR_LIT:NOTHING_TO_INLINE>" ) <EOL> @ SinceKotlin ( "<STR_LIT:1.9>" ) <EOL> public actual inline fun StringBuilder . insert ( index : Int , value : Short ) : StringBuilder

= this . insert ( index , value )

/**
 * Inserts the string representation of the specified short [value] into this string builder at the specified [index] and returns this instance.
 *
 * The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,
 * and then that string was inserted into this string builder at the specified [index].
 *
 * @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
 */


@ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ Suppress ( "<STR_LIT>" , "<STR_LIT:NOTHING_TO_INLINE>" ) <EOL> public actual inline fun StringBuilder . clear ( ) : StringBuilder

= this . clear ( )


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ Suppress ( "<STR_LIT>" , "<STR_LIT:NOTHING_TO_INLINE>" ) <EOL> public actual inline operator fun StringBuilder . set ( index : Int , value : Char ) : Unit

= this . set ( index , value )


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ Suppress ( "<STR_LIT>" , "<STR_LIT:NOTHING_TO_INLINE>" ) <EOL> public actual inline fun StringBuilder . setRange ( startIndex : Int , endIndex : Int , value : String ) : StringBuilder

= <EOL> this . setRange ( startIndex , endIndex , value )


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ Suppress ( "<STR_LIT>" , "<STR_LIT:NOTHING_TO_INLINE>" ) <EOL> public actual inline fun StringBuilder . deleteAt ( index : Int ) : StringBuilder

= this . deleteAt ( index )


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ Suppress ( "<STR_LIT>" , "<STR_LIT:NOTHING_TO_INLINE>" ) <EOL> public actual inline fun StringBuilder . deleteRange ( startIndex : Int , endIndex : Int ) : StringBuilder

= this . deleteRange ( startIndex , endIndex )


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ Suppress ( "<STR_LIT>" , "<STR_LIT:NOTHING_TO_INLINE>" , "<STR_LIT:ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS>" ) <EOL> public actual inline fun StringBuilder . toCharArray ( destination : CharArray , destinationOffset : Int = <NUM_LIT:0> , startIndex : Int = <NUM_LIT:0> , endIndex : Int = this . length ) : Unit

= <EOL> this . toCharArray ( destination , destinationOffset , startIndex , endIndex )


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ Suppress ( "<STR_LIT>" , "<STR_LIT:NOTHING_TO_INLINE>" ) <EOL> public actual inline fun StringBuilder . appendRange ( value : CharArray , startIndex : Int , endIndex : Int ) : StringBuilder

= <EOL> this . appendRange ( value , startIndex , endIndex )


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ Suppress ( "<STR_LIT>" , "<STR_LIT:NOTHING_TO_INLINE>" ) <EOL> public actual inline fun StringBuilder . appendRange ( value : CharSequence , startIndex : Int , endIndex : Int ) : StringBuilder


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ Suppress ( "<STR_LIT>" , "<STR_LIT:NOTHING_TO_INLINE>" ) <EOL> public actual inline fun StringBuilder . insertRange ( index : Int , value : CharArray , startIndex : Int , endIndex : Int ) : StringBuilder

= <EOL> this . insertRange ( index , value , startIndex , endIndex )


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ Suppress ( "<STR_LIT>" , "<STR_LIT:NOTHING_TO_INLINE>" ) <EOL> public actual inline fun StringBuilder . insertRange ( index : Int , value : CharSequence , startIndex : Int , endIndex : Int ) : StringBuilder


@ SinceKotlin ( "<STR_LIT:1.9>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun StringBuilder . appendLine ( value : Int ) : StringBuilder

= append ( value ) . appendLine ( )

/** Appends [value] to this [StringBuilder], followed by a line feed character (`\n`). */


@ SinceKotlin ( "<STR_LIT:1.9>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun StringBuilder . appendLine ( value : Short ) : StringBuilder

= append ( value . toInt ( ) ) . appendLine ( )


@ SinceKotlin ( "<STR_LIT:1.9>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun StringBuilder . appendLine ( value : Byte ) : StringBuilder


@ SinceKotlin ( "<STR_LIT:1.9>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun StringBuilder . appendLine ( value : Long ) : StringBuilder

= append ( value ) . appendLine ( )


@ SinceKotlin ( "<STR_LIT:1.9>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun StringBuilder . appendLine ( value : Float ) : StringBuilder

= append ( value ) . appendLine ( )


@ SinceKotlin ( "<STR_LIT:1.9>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun StringBuilder . appendLine ( value : Double ) : StringBuilder

= append ( value ) . appendLine ( )


public actual operator fun contains ( char : Char ) : Boolean

= char . getCategoryValue ( ) == this . value

/**
 * Returns `true` if [char] character belongs to this category.
 */


inline fun ConeKotlinType . forEachType ( prepareType : ( ConeKotlinType ) -> ConeKotlinType = { it } , action : ( ConeKotlinType ) -> Unit , )

{ <EOL> val stack = mutableListOf ( this ) <EOL> while ( stack . isNotEmpty ( ) ) { <EOL> val next = stack . popLast ( ) . let ( prepareType ) <EOL> action ( next ) <EOL> when ( next ) { <EOL> is ConeFlexibleType -> { <EOL> stack . add ( next . lowerBound ) <EOL> stack . add ( next . upperBound ) <EOL> } <EOL> is ConeDefinitelyNotNullType -> stack . add ( next . original ) <EOL> is ConeIntersectionType -> stack . addAll ( next . intersectedTypes ) <EOL> else -> next . typeArguments . forEach { if ( it is ConeKotlinTypeProjection ) stack . add ( it . type ) } <EOL> } <EOL> } <EOL> }

/**
 * Recursively visits each [ConeKotlinType] inside (including itself) and performs the given action.
 * Doesn't give guarantees on the traversal order.
 */


private fun rebindDelegate ( newTarget : FirProperty , oldTarget : FirProperty )

{ <EOL> val delegate = newTarget . delegate ? : return <EOL> requireWithAttachment ( delegate is FirWrappedDelegateExpression , { "<STR_LIT>" } , ) { <EOL> withFirEntry ( "<STR_LIT>" , newTarget ) <EOL> withFirEntry ( "<STR_LIT>" , oldTarget ) <EOL> withFirEntry ( "<STR_LIT>" , delegate ) <EOL> } <EOL> val delegateProvider = delegate . provideDelegateCall <EOL> rebindArgumentList ( delegateProvider . argumentList , newTarget = newTarget . symbol , oldTarget = oldTarget . symbol , isSetter = false , canHavePropertySymbolAsThisReference = false , ) <EOL> }

/**
 * This function is required to correctly rebind symbols
 * after [generateAccessorsByDelegate][org.jetbrains.kotlin.fir.builder.generateAccessorsByDelegate]
 * for correct work
 *
 * @see org.jetbrains.kotlin.fir.builder.generateAccessorsByDelegate
 */


private fun rebindDelegatedAccessorBody ( newTarget : FirPropertyAccessor , oldTarget : FirPropertyAccessor )

{ <EOL> if ( newTarget . source ? . kind != KtFakeSourceElementKind . DelegatedPropertyAccessor ) return <EOL> val body = newTarget . body <EOL> requireWithAttachment ( body is FirSingleExpressionBlock , { "<STR_LIT>" } , ) { <EOL> withFirSymbolEntry ( "<STR_LIT>" , newTarget . propertySymbol ) <EOL> withFirSymbolEntry ( "<STR_LIT>" , oldTarget . propertySymbol ) <EOL> body ? . let { withFirEntry ( "<STR_LIT>" , it ) } ? : withEntry ( "<STR_LIT>" , "<STR_LIT:null>" ) <EOL> } <EOL> val returnExpression = body . statement <EOL> rebindReturnExpression ( returnExpression = returnExpression , newTarget = newTarget , oldTarget = oldTarget ) <EOL> }

/**
 * This function is required to correctly rebind symbols
 * after [generateAccessorsByDelegate][org.jetbrains.kotlin.fir.builder.generateAccessorsByDelegate]
 * for correct work
 *
 * @see org.jetbrains.kotlin.fir.builder.generateAccessorsByDelegate
 * @see rebindDelegate
 */


private fun rebindThisRef ( expression : FirExpression , newTarget : FirPropertySymbol , oldTarget : FirPropertySymbol , canHavePropertySymbolAsThisReference : Boolean , )

{ <EOL> if ( expression is FirLiteralExpression < * > ) return <EOL> requireWithAttachment ( expression is FirThisReceiverExpression , { "<STR_LIT>" } , ) { <EOL> withFirSymbolEntry ( "<STR_LIT>" , newTarget ) <EOL> withFirSymbolEntry ( "<STR_LIT>" , oldTarget ) <EOL> withFirEntry ( "<STR_LIT>" , expression ) <EOL> } <EOL> val boundSymbol = expression . calleeReference . boundSymbol <EOL> if ( boundSymbol is FirClassSymbol < * > ) return <EOL> requireWithAttachment ( canHavePropertySymbolAsThisReference , { "<STR_LIT>" } , ) { <EOL> withFirSymbolEntry ( "<STR_LIT>" , newTarget ) <EOL> withFirSymbolEntry ( "<STR_LIT>" , oldTarget ) <EOL> boundSymbol ? . let { withFirSymbolEntry ( "<STR_LIT>" , boundSymbol ) } <EOL> } <EOL> requireWithAttachment ( boundSymbol == oldTarget , { "<STR_LIT>" } ) { <EOL> withFirSymbolEntry ( "<STR_LIT>" , newTarget ) <EOL> withFirSymbolEntry ( "<STR_LIT>" , oldTarget ) <EOL> boundSymbol ? . let { withFirSymbolEntry ( "<STR_LIT>" , boundSymbol ) } <EOL> } <EOL> expression . replaceCalleeReference ( buildImplicitThisReference { <EOL> this . boundSymbol = newTarget <EOL> } ) <EOL> }

/**
 * To cover `thisRef` function
 *
 * @see org.jetbrains.kotlin.fir.builder.generateAccessorsByDelegate
 */


private fun rebindSetterParameter ( expression : FirExpression , newPropertySymbol : FirPropertySymbol , oldPropertySymbol : FirPropertySymbol )

{ <EOL> requireWithAttachment ( expression is FirPropertyAccessExpression , { "<STR_LIT>" } ) { <EOL> withFirSymbolEntry ( "<STR_LIT>" , newPropertySymbol ) <EOL> withFirSymbolEntry ( "<STR_LIT>" , oldPropertySymbol ) <EOL> withFirEntry ( "<STR_LIT>" , expression ) <EOL> } <EOL> val calleeReference = expression . resolvedCalleeReference ( newPropertySymbol = newPropertySymbol , oldPropertySymbol = oldPropertySymbol ) <EOL> val resolvedParameterSymbol = calleeReference . resolvedSymbol <EOL> val oldValueParameterSymbol = oldPropertySymbol . setterSymbol ? . valueParameterSymbols ? . first ( ) <EOL> requireWithAttachment ( resolvedParameterSymbol == oldValueParameterSymbol , { "<STR_LIT>" } , ) { <EOL> withFirEntry ( "<STR_LIT>" , expression ) <EOL> withFirSymbolEntry ( "<STR_LIT>" , resolvedParameterSymbol ) <EOL> oldValueParameterSymbol ? . let { withFirSymbolEntry ( "<STR_LIT>" , it ) } <EOL> withFirSymbolEntry ( "<STR_LIT>" , oldPropertySymbol ) <EOL> withFirSymbolEntry ( "<STR_LIT>" , newPropertySymbol ) <EOL> } <EOL> expression . replaceCalleeReference ( buildResolvedNamedReference { <EOL> source = calleeReference . source <EOL> name = calleeReference . name <EOL> resolvedSymbol = newPropertySymbol . setterSymbol ? . valueParameterSymbols ? . first ( ) ? : errorWithAttachment ( "<STR_LIT>" ) { <EOL> withFirSymbolEntry ( "<STR_LIT>" , oldPropertySymbol ) <EOL> withFirSymbolEntry ( "<STR_LIT>" , newPropertySymbol ) <EOL> } <EOL> } ) <EOL> }

/**
 * To cover third argument in setter body
 *
 * @see org.jetbrains.kotlin.fir.builder.generateAccessorsByDelegate
 */


private fun rebindPropertyRef ( expression : FirExpression , newPropertySymbol : FirPropertySymbol , oldPropertySymbol : FirPropertySymbol , )

{ <EOL> requireWithAttachment ( expression is FirCallableReferenceAccess , { "<STR_LIT>" } , ) { <EOL> withFirSymbolEntry ( "<STR_LIT>" , newPropertySymbol ) <EOL> withFirSymbolEntry ( "<STR_LIT>" , oldPropertySymbol ) <EOL> withFirEntry ( "<STR_LIT>" , expression ) <EOL> } <EOL> val calleeReference = expression . resolvedCalleeReference ( newPropertySymbol = newPropertySymbol , oldPropertySymbol = oldPropertySymbol ) <EOL> val resolvedPropertySymbol = calleeReference . resolvedSymbol <EOL> requireWithAttachment ( resolvedPropertySymbol == oldPropertySymbol , { "<STR_LIT>" } , ) { <EOL> withFirEntry ( "<STR_LIT>" , expression ) <EOL> withFirSymbolEntry ( "<STR_LIT>" , resolvedPropertySymbol ) <EOL> withFirSymbolEntry ( "<STR_LIT>" , oldPropertySymbol ) <EOL> withFirSymbolEntry ( "<STR_LIT>" , newPropertySymbol ) <EOL> } <EOL> expression . replaceCalleeReference ( buildResolvedNamedReference { <EOL> source = calleeReference . source <EOL> name = calleeReference . name <EOL> resolvedSymbol = newPropertySymbol <EOL> } ) <EOL> expression . replaceTypeArguments ( newPropertySymbol . fir . typeParameters . map { <EOL> buildTypeProjectionWithVariance { <EOL> source = expression . source <EOL> variance = Variance . INVARIANT <EOL> typeRef = buildResolvedTypeRef { <EOL> type = ConeTypeParameterTypeImpl ( it . symbol . toLookupTag ( ) , false ) <EOL> } <EOL> } <EOL> } ) <EOL> }

/**
 * To cover `propertyRef` function
 *
 * @see org.jetbrains.kotlin.fir.builder.generateAccessorsByDelegate
 */


private fun rebindDelegateAccess ( expression : FirExpression ? , newPropertySymbol : FirPropertySymbol , oldPropertySymbol : FirPropertySymbol )

{ <EOL> requireWithAttachment ( expression is FirPropertyAccessExpression , { "<STR_LIT>" } , ) { <EOL> withFirSymbolEntry ( "<STR_LIT>" , newPropertySymbol ) <EOL> withFirSymbolEntry ( "<STR_LIT>" , oldPropertySymbol ) <EOL> expression ? . let { withFirEntry ( "<STR_LIT>" , it ) } <EOL> } <EOL> val delegateFieldReference = expression . calleeReference <EOL> requireWithAttachment ( delegateFieldReference is FirDelegateFieldReference , { "<STR_LIT>" } , ) { <EOL> withFirSymbolEntry ( "<STR_LIT>" , newPropertySymbol ) <EOL> withFirSymbolEntry ( "<STR_LIT>" , oldPropertySymbol ) <EOL> withFirEntry ( "<STR_LIT>" , delegateFieldReference ) <EOL> } <EOL> requireWithAttachment ( delegateFieldReference . resolvedSymbol == oldPropertySymbol . delegateFieldSymbol , { "<STR_LIT>" } ) { <EOL> withFirSymbolEntry ( "<STR_LIT>" , newPropertySymbol ) <EOL> withFirSymbolEntry ( "<STR_LIT>" , oldPropertySymbol ) <EOL> withFirSymbolEntry ( "<STR_LIT>" , delegateFieldReference . resolvedSymbol ) <EOL> } <EOL> expression . replaceCalleeReference ( buildDelegateFieldReference { <EOL> source = delegateFieldReference . source <EOL> resolvedSymbol = newPropertySymbol . delegateFieldSymbol ? : errorWithAttachment ( "<STR_LIT>" ) { <EOL> withFirSymbolEntry ( "<STR_LIT>" , newPropertySymbol ) <EOL> withFirSymbolEntry ( "<STR_LIT>" , oldPropertySymbol ) <EOL> } <EOL> } ) <EOL> expression . dispatchReceiver ? . let { <EOL> rebindThisRef ( expression = it , newTarget = newPropertySymbol , oldTarget = oldPropertySymbol , canHavePropertySymbolAsThisReference = false , ) <EOL> } <EOL> }

/**
 * To cover `delegateAccess` function
 *
 * @see org.jetbrains.kotlin.fir.builder.generateAccessorsByDelegate
 */


fun initializeIteration ( loopVariable : IrVariable ? , loopVariableComponents : Map < Int , IrVariable > , builder : DeclarationIrBuilder , backendContext : CommonBackendContext , ) : List < IrStatement >

/** Statements used to initialize an iteration of the loop (e.g., assign loop variable). */


fun buildLoop ( builder : DeclarationIrBuilder , oldLoop : IrLoop , newBody : IrExpression ? ) : LoopReplacement

/** Builds a new loop from the old loop. */


fun extractHeader ( variable : IrVariable ) : ForLoopHeader ?

{ <EOL> assert ( variable . origin == IrDeclarationOrigin . FOR_LOOP_ITERATOR ) <EOL> if ( ! variable . type . isSubtypeOfClass ( symbols . iterator ) ) { <EOL> return null <EOL> } <EOL> val iteratorCall = variable . initializer as? IrCall <EOL> val iterable = iteratorCall ? . run { <EOL> if ( extensionReceiver != null ) { <EOL> extensionReceiver <EOL> } else { <EOL> dispatchReceiver <EOL> } <EOL> } <EOL> val headerInfo = iterable ? . accept ( headerInfoBuilder , iteratorCall ) <EOL> ? : return null <EOL> val builder = context . createIrBuilder ( scopeOwnerSymbol ( ) , variable . startOffset , variable . endOffset ) <EOL> return when ( headerInfo ) { <EOL> is IndexedGetHeaderInfo -> IndexedGetLoopHeader ( headerInfo , builder , context ) <EOL> is ProgressionHeaderInfo -> ProgressionLoopHeader ( headerInfo , builder , context ) <EOL> is WithIndexHeaderInfo -> WithIndexLoopHeader ( headerInfo , builder , context ) <EOL> is IterableHeaderInfo -> IterableLoopHeader ( headerInfo ) <EOL> is FloatingPointRangeHeaderInfo , is ComparableRangeInfo -> error ( "<STR_LIT>" ) <EOL> } <EOL> }

/**
 * Extracts information for building the for-loop (as a [ForLoopHeader]) from the given
 * "header" statement that stores the iterator into the loop variable
 * (e.g., `val it = someIterable.iterator()`).
 *
 * Returns null if the for-loop cannot be lowered.
 */


@ JvmName ( "<STR_LIT>" ) <EOL> fun com . google . protobuf . kotlin . DslMap < kotlin . String , com . google . protobuf . ByteString , ValuesProxy > <EOL> . put ( key : kotlin . String , value : com . google . protobuf . ByteString )

{ <EOL> _builder . putValues ( key , value ) <EOL> }

/**
 * map<string, bytes> values = 1;
 */


@ kotlin . jvm . JvmSynthetic <EOL> @ JvmName ( "<STR_LIT>" ) <EOL> @ Suppress ( "<STR_LIT:NOTHING_TO_INLINE>" ) <EOL> inline operator fun com . google . protobuf . kotlin . DslMap < kotlin . String , com . google . protobuf . ByteString , ValuesProxy > <EOL> . set ( key : kotlin . String , value : com . google . protobuf . ByteString )

{ <EOL> put ( key , value ) <EOL> }


@ kotlin . jvm . JvmSynthetic <EOL> @ JvmName ( "<STR_LIT>" ) <EOL> fun com . google . protobuf . kotlin . DslMap < kotlin . String , com . google . protobuf . ByteString , ValuesProxy > <EOL> . remove ( key : kotlin . String )

{ <EOL> _builder . removeValues ( key ) <EOL> }


@ kotlin . jvm . JvmSynthetic <EOL> @ JvmName ( "<STR_LIT>" ) <EOL> fun com . google . protobuf . kotlin . DslMap < kotlin . String , com . google . protobuf . ByteString , ValuesProxy > <EOL> . putAll ( map : kotlin . collections . Map < kotlin . String , com . google . protobuf . ByteString > )

{ <EOL> _builder . putAllValues ( map ) <EOL> }


@ kotlin . jvm . JvmSynthetic <EOL> @ JvmName ( "<STR_LIT>" ) <EOL> fun com . google . protobuf . kotlin . DslMap < kotlin . String , com . google . protobuf . ByteString , ValuesProxy > <EOL> . clear ( )

{ <EOL> _builder . clearValues ( ) <EOL> }


{ <EOL> interceptor . beforeUpdate ( this ) <EOL> FU . lazySet ( this , value ) <EOL> interceptor . afterSet ( this , value ) <EOL> }

/**
 * Maps to [AtomicReferenceFieldUpdater.lazySet].
 */


public actual fun compareAndSet ( expect : T , update : T ) : Boolean

{ <EOL> interceptor . beforeUpdate ( this ) <EOL> val result = FU . compareAndSet ( this , expect , update ) <EOL> if ( result ) interceptor . afterRMW ( this , expect , update ) <EOL> return result <EOL> }

/**
 * Maps to [AtomicReferenceFieldUpdater.compareAndSet].
 */


public actual fun getAndSet ( value : T ) : T

{ <EOL> interceptor . beforeUpdate ( this ) <EOL> val oldValue = FU . getAndSet ( this , value ) as T <EOL> interceptor . afterRMW ( this , oldValue , value ) <EOL> return oldValue <EOL> }

/**
 * Maps to [AtomicReferenceFieldUpdater.getAndSet].
 */


public fun < T > mono ( context : CoroutineContext = EmptyCoroutineContext , block : suspend CoroutineScope . ( ) -> T ? <EOL> ) : Mono < T >

{ <EOL> require ( context [ Job ] === null ) { "<STR_LIT>" + <EOL> "<STR_LIT>" } <EOL> return monoInternal ( GlobalScope , context , block ) <EOL> }

/**
 * Creates a cold [mono][Mono] that runs a given [block] in a coroutine and emits its result.
 * Every time the returned mono is subscribed, it starts a new coroutine.
 * If the result of [block] is `null`, [MonoSink.success] is invoked without a value.
 * Unsubscribing cancels the running coroutine.
 *
 * Coroutine context can be specified with [context] argument.
 * If the context does not have any dispatcher nor any other [ContinuationInterceptor], then [Dispatchers.Default] is used.
 *
 * @throws IllegalArgumentException if the provided [context] contains a [Job] instance.
 */


public suspend fun < T > Mono < T > . awaitSingleOrNull ( ) : T ?

= suspendCancellableCoroutine { cont -> <EOL> injectCoroutineContext ( cont . context ) . subscribe ( object : Subscriber < T > { <EOL> private var value : T ? = null <EOL> override fun onSubscribe ( s : Subscription ) { <EOL> cont . invokeOnCancellation { s . cancel ( ) } <EOL> s . request ( Long . MAX_VALUE ) <EOL> } <EOL> override fun onComplete ( ) { <EOL> cont . resume ( value ) <EOL> value = null <EOL> } <EOL> override fun onNext ( t : T ) { <EOL> value = t <EOL> } <EOL> override fun onError ( error : Throwable ) { cont . resumeWithException ( error ) } <EOL> } ) <EOL> }

/**
 * Awaits the single value from the given [Mono] without blocking the thread and returns the resulting value, or, if
 * this publisher has produced an error, throws the corresponding exception. If the Mono completed without a value,
 * `null` is returned.
 *
 * This suspending function is cancellable.
 * If the [Job] of the current coroutine is cancelled while the suspending function is waiting, this
 * function immediately cancels its [Subscription] and resumes with [CancellationException].
 */


public suspend fun < T > Mono < T > . awaitSingle ( ) : T

= awaitSingleOrNull ( ) ? : throw NoSuchElementException ( )

/**
 * Awaits the single value from the given [Mono] without blocking the thread and returns the resulting value, or,
 * if this Mono has produced an error, throws the corresponding exception.
 *
 * This suspending function is cancellable.
 * If the [Job] of the current coroutine is cancelled while the suspending function is waiting, this
 * function immediately cancels its [Subscription] and resumes with [CancellationException].
 *
 * @throws NoSuchElementException if the Mono does not emit any value
 */


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN , replaceWith = ReplaceWith ( "<STR_LIT>" ) ) <EOL> public fun < T > CoroutineScope . mono ( context : CoroutineContext = EmptyCoroutineContext , block : suspend CoroutineScope . ( ) -> T ? <EOL> ) : Mono < T >

= monoInternal ( this , context , block )


@ Deprecated ( message = "<STR_LIT>" + "<STR_LIT>" , level = DeprecationLevel . HIDDEN , replaceWith = ReplaceWith ( "<STR_LIT>" ) ) <EOL> public suspend fun < T > Mono < T > . awaitFirst ( ) : T

= awaitSingle ( )

/**
 * This is a lint function that was added already deprecated in order to guard against confusing usages on [Mono].
 * On [Publisher] instances other than [Mono], this function is not deprecated.
 *
 * Both [awaitFirst] and [awaitSingle] await the first value, or throw [NoSuchElementException] if there is none, but
 * the name [Mono.awaitSingle] better reflects the semantics of [Mono].
 *
 * For example, consider this code:
 * ```
 * myDbClient.findById(uniqueId).awaitFirst() // findById returns a `Mono`
 * ```
 * It looks like more than one value could be returned from `findById` and [awaitFirst] discards the extra elements,
 * when in fact, at most a single value can be present.
 *
 * @suppress
 */


@ Deprecated ( message = "<STR_LIT>" + "<STR_LIT>" , level = DeprecationLevel . HIDDEN , replaceWith = ReplaceWith ( "<STR_LIT>" ) ) <EOL> public suspend fun < T > Mono < T > . awaitFirstOrDefault ( default : T ) : T

= awaitSingleOrNull ( ) ? : default

/**
 * This is a lint function that was added already deprecated in order to guard against confusing usages on [Mono].
 * On [Publisher] instances other than [Mono], this function is not deprecated.
 *
 * Both [awaitFirstOrDefault] and [awaitSingleOrNull] await the first value, or return some special value if there
 * is none, but the name [Mono.awaitSingleOrNull] better reflects the semantics of [Mono].
 *
 * For example, consider this code:
 * ```
 * myDbClient.findById(uniqueId).awaitFirstOrDefault(default) // findById returns a `Mono`
 * ```
 * It looks like more than one value could be returned from `findById` and [awaitFirstOrDefault] discards the extra
 * elements, when in fact, at most a single value can be present.
 *
 * @suppress
 */


@ Deprecated ( message = "<STR_LIT>" + "<STR_LIT>" , level = DeprecationLevel . HIDDEN , replaceWith = ReplaceWith ( "<STR_LIT>" ) ) <EOL> public suspend fun < T > Mono < T > . awaitFirstOrNull ( ) : T ?

= awaitSingleOrNull ( )

/**
 * This is a lint function that was added already deprecated in order to guard against confusing usages on [Mono].
 * On [Publisher] instances other than [Mono], this function is not deprecated.
 *
 * Both [awaitFirstOrNull] and [awaitSingleOrNull] await the first value, or return some special value if there
 * is none, but the name [Mono.awaitSingleOrNull] better reflects the semantics of [Mono].
 *
 * For example, consider this code:
 * ```
 * myDbClient.findById(uniqueId).awaitFirstOrNull() // findById returns a `Mono`
 * ```
 * It looks like more than one value could be returned from `findById` and [awaitFirstOrNull] discards the extra
 * elements, when in fact, at most a single value can be present.
 *
 * @suppress
 */


@ Deprecated ( message = "<STR_LIT>" + "<STR_LIT>" , level = DeprecationLevel . HIDDEN , replaceWith = ReplaceWith ( "<STR_LIT>" ) ) <EOL> public suspend fun < T > Mono < T > . awaitFirstOrElse ( defaultValue : ( ) -> T ) : T

= awaitSingleOrNull ( ) ? : defaultValue ( )

/**
 * This is a lint function that was added already deprecated in order to guard against confusing usages on [Mono].
 * On [Publisher] instances other than [Mono], this function is not deprecated.
 *
 * Both [awaitFirstOrElse] and [awaitSingleOrNull] await the first value, or return some special value if there
 * is none, but the name [Mono.awaitSingleOrNull] better reflects the semantics of [Mono].
 *
 * For example, consider this code:
 * ```
 * myDbClient.findById(uniqueId).awaitFirstOrElse(defaultValue) // findById returns a `Mono`
 * ```
 * It looks like more than one value could be returned from `findById` and [awaitFirstOrElse] discards the extra
 * elements, when in fact, at most a single value can be present.
 *
 * @suppress
 */


@ Deprecated ( message = "<STR_LIT>" + "<STR_LIT>" , level = DeprecationLevel . HIDDEN , replaceWith = ReplaceWith ( "<STR_LIT>" ) ) <EOL> public suspend fun < T > Mono < T > . awaitLast ( ) : T

= awaitSingle ( )

/**
 * This is a lint function that was added already deprecated in order to guard against confusing usages on [Mono].
 * On [Publisher] instances other than [Mono], this function is not deprecated.
 *
 * Both [awaitLast] and [awaitSingle] await the single value, or throw [NoSuchElementException] if there is none, but
 * the name [Mono.awaitSingle] better reflects the semantics of [Mono].
 *
 * For example, consider this code:
 * ```
 * myDbClient.findById(uniqueId).awaitLast() // findById returns a `Mono`
 * ```
 * It looks like more than one value could be returned from `findById` and [awaitLast] discards the initial elements,
 * when in fact, at most a single value can be present.
 *
 * @suppress
 */


private fun < T > remapCapturedFields ( lambdaConstructor : IrConstructor , remapVP : ( IrValueParameterSymbol ) -> T ? <EOL> ) : Map < IrFieldSymbol , T >

{ <EOL> val statements = lambdaConstructor . body ? . let { it . cast < IrBlockBody > ( ) . statements } <EOL> ? : compilationException ( "<STR_LIT>" , lambdaConstructor ) <EOL> return statements <EOL> . asSequence ( ) <EOL> . filterIsInstance < IrSetField > ( ) <EOL> . filter { it . origin == LoweredStatementOrigins . STATEMENT_ORIGIN_INITIALIZER_OF_FIELD_FOR_CAPTURED_VALUE } <EOL> . mapNotNull { irSetField -> <EOL> remapVP ( irSetField . value . cast < IrGetValue > ( ) . symbol . cast ( ) ) ? . let { <EOL> irSetField . symbol to it <EOL> } <EOL> } <EOL> . toMap ( ) <EOL> }

/**
 * Returns a mapping from a lambda class field to the corresponding captured value.
 *
 * [remapVP] accepts a lambda constructor's value parameter symbol, for which it should return the corresponding captured value.
 */


private fun liftLambda ( ctorToFreeFunctionMap : MutableMap < IrConstructorSymbol , IrSimpleFunctionSymbol > , lambdaInfo : LambdaInfo ) : List < IrDeclaration >

{ <EOL> val constructor = lambdaInfo . lambdaClass . constructors . single ( ) <EOL> val newDeclarations = mutableListOf < IrDeclaration > ( ) <EOL> val freeFunctionDeclaration = createLambdaDeclaration ( lambdaInfo . invokeFun , lambdaInfo . lambdaClass . name , lambdaInfo . lambdaClass . parent , lambdaInfo . superInvokeFun ) <EOL> freeFunctionDeclaration . body = inlineLambdaBody ( freeFunctionDeclaration , lambdaInfo . invokeFun , lambdaInfo . createOldToNewInvokeParametersMapping ( freeFunctionDeclaration ) , emptyMap ( ) ) <EOL> newDeclarations . add ( freeFunctionDeclaration ) <EOL> newDeclarations . addAll ( lambdaInfo . lambdaInnerClasses ( ) ) <EOL> ctorToFreeFunctionMap [ constructor . symbol ] = freeFunctionDeclaration . symbol <EOL> return newDeclarations <EOL> }

/**
 * Replaces a contextless lambda class with a free function.
 */


abstract override fun toString ( ) : String

/**
 * Returns a string representation of the signature.
 *
 * In case of a method it's just [name] and [descriptor] concatenated together, e.g. `equals(Ljava/lang/Object;)Z`
 *
 * In case of a field [name] and [descriptor] are concatenated with `:` separator, e.g. `value:Ljava/lang/String;`
 */


fun execClangForCompilerTests ( target : KonanTarget , action : Action < in ExecSpec > ) : ExecResult

{ <EOL> val defaultArgs = platformManager . platform ( target ) . clang . clangArgs . toList ( ) <EOL> return execOperations . exec { <EOL> action . execute ( this ) <EOL> executable = if ( target . family . isAppleFamily ) { <EOL> resolveToolchainExecutable ( target , executable ) <EOL> } else { <EOL> resolveExecutable ( executable ) <EOL> } <EOL> args = defaultArgs + args <EOL> } <EOL> }

/**
 * Execute Clang the way that produced object file is compatible with
 * the one that produced by Kotlin/Native for given [target]. It means:
 * 1. We pass flags that set sysroot.
 * 2. We call Clang from toolchain in case of Apple target.
 */


private inline fun dispatchInternal ( block : Runnable , startWorker : ( Worker ) -> Unit )

{ <EOL> queue . addLast ( block ) <EOL> if ( runningWorkers . value >= parallelism ) return <EOL> if ( ! tryAllocateWorker ( ) ) return <EOL> val task = obtainTaskOrDeallocateWorker ( ) ? : return <EOL> startWorker ( Worker ( task ) ) <EOL> }

/**
 * Tries to dispatch the given [block].
 * If there are not enough workers, it starts a new one via [startWorker].
 */


private fun tryAllocateWorker ( ) : Boolean

{ <EOL> synchronized ( workerAllocationLock ) { <EOL> if ( runningWorkers . value >= parallelism ) return false <EOL> runningWorkers . incrementAndGet ( ) <EOL> return true <EOL> } <EOL> }

/**
 * Tries to obtain the permit to start a new worker.
 */


private fun obtainTaskOrDeallocateWorker ( ) : Runnable ?

{ <EOL> while ( true ) { <EOL> when ( val nextTask = queue . removeFirstOrNull ( ) ) { <EOL> null -> synchronized ( workerAllocationLock ) { <EOL> runningWorkers . decrementAndGet ( ) <EOL> if ( queue . size == <NUM_LIT:0> ) return null <EOL> runningWorkers . incrementAndGet ( ) <EOL> } <EOL> else -> return nextTask <EOL> } <EOL> } <EOL> }

/**
 * Obtains the next task from the queue, or logically deallocates the worker if the queue is empty.
 */


protected abstract fun computeNext ( ) : Unit

/**
 * Computes the next item in the iterator.
 *
 * This callback method should call one of these two methods:
 *
 * * [setNext] with the next value of the iteration
 * * [done] to indicate there are no more elements
 *
 * Failure to call either method will result in the iteration terminating with a failed state
 */


protected fun setNext ( value : T ) : Unit

{ <EOL> nextValue = value <EOL> state = State . READY <EOL> }

/**
 * Sets the next value in the iteration, called from the [computeNext] function
 */


{ <EOL> state = State . DONE <EOL> }

/**
 * Sets the state to done so that the iteration terminates.
 */


internal fun runCommand ( command : List < String > , logger : Logger ? = null , errorHandler : ( ( result : RunProcessResult ) -> String ? ) ? = null , processConfiguration : ProcessBuilder . ( ) -> Unit = { } , ) : String

{ <EOL> val runResult = assembleAndRunProcess ( command , logger , processConfiguration ) <EOL> check ( runResult . retCode == <NUM_LIT:0> ) { <EOL> errorHandler ? . invoke ( runResult ) ? : createErrorMessage ( command , runResult ) <EOL> } <EOL> return runResult . stdOut <EOL> }

/**
 * Executes a command and returns the input text.
 *
 * @param command the command and its arguments to be executed as a list of strings.
 * @param logger an optional logger to log information about the command execution.
 * @param errorHandler (Optional) A function that handles any errors that occur during the command execution.
 * @param processConfiguration a function to configure the process before execution.
 * @return The input text of the executed command.
 */


internal fun runCommandWithFallback ( command : List < String > , logger : Logger ? = null , fallback : ( result : RunProcessResult ) -> CommandFallback , processConfiguration : ProcessBuilder . ( ) -> Unit = { } , ) : String

{ <EOL> val runResult = assembleAndRunProcess ( command , logger , processConfiguration ) <EOL> return if ( runResult . retCode != <NUM_LIT:0> ) { <EOL> when ( val fallbackOption = fallback ( runResult ) ) { <EOL> is CommandFallback . Action -> fallbackOption . fallback <EOL> is CommandFallback . Error -> error ( fallbackOption . error ? : createErrorMessage ( command , runResult ) ) <EOL> } <EOL> } else { <EOL> runResult . stdOut <EOL> } <EOL> }

/**
 * Executes the specified command with fallback behavior in case of non-zero return code.
 *
 * @param command the command and its arguments to be executed as a list of strings.
 * @param logger an optional logger to log information about the command execution.
 * @param fallback a function that provides the fallback behavior. It takes the return code, output, and process as parameters and returns a [CommandFallback] object.
 * @param processConfiguration a function to configure the process before execution.
 * @return the output of the command if the return code is 0, otherwise the fallback action or error.
 */


private fun String . detectSubprojects ( rootPath : String ) : Map < String , String >

{ <EOL> val result : MutableMap < String , String > = mutableMapOf ( ) <EOL> lines ( ) . forEach { line -> <EOL> if ( ! line . matches ( includeRegex ) ) { <EOL> return@forEach <EOL> } <EOL> pathStringRegex . findAll ( this ) . mapNotNull { it . groupValues . getOrNull ( <NUM_LIT:1> ) } . forEach { path -> <EOL> if ( path != "<STR_LIT::>" ) { <EOL> val parent = path . substringBeforeLast ( '<CHAR_LIT::>' ) + "<STR_LIT::>" <EOL> if ( parent . startsWith ( rootPath ) ) { <EOL> result [ path ] = parent <EOL> } <EOL> } <EOL> } <EOL> } <EOL> return result <EOL> }

/**
 * @return map project path -> parent project path
 */


public suspend fun < T > Flow < T > . toList ( destination : MutableList < T > = ArrayList ( ) ) : List < T >

= toCollection ( destination )

/**
 * Collects given flow into a [destination]
 */


public suspend fun < T > Flow < T > . toSet ( destination : MutableSet < T > = LinkedHashSet ( ) ) : Set < T >

= toCollection ( destination )


public suspend fun < T , C : MutableCollection < in T > > Flow < T > . toCollection ( destination : C ) : C

{ <EOL> collect { value -> <EOL> destination . add ( value ) <EOL> } <EOL> return destination <EOL> }


@ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ ExperimentalUnsignedTypes <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun UIntArray . elementAt ( index : Int ) : UInt

{ <EOL> return get ( index ) <EOL> }

/**
 * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this array.
 *
 * @sample samples.collections.Collections.Elements.elementAt
 */


@ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ ExperimentalUnsignedTypes <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun ULongArray . elementAt ( index : Int ) : ULong

{ <EOL> return get ( index ) <EOL> }


@ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ ExperimentalUnsignedTypes <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun UByteArray . elementAt ( index : Int ) : UByte

{ <EOL> return get ( index ) <EOL> }


@ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ ExperimentalUnsignedTypes <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun UShortArray . elementAt ( index : Int ) : UShort

{ <EOL> return get ( index ) <EOL> }


@ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ ExperimentalUnsignedTypes <EOL> public actual fun UIntArray . asList ( ) : List < UInt >

{ <EOL> return object : AbstractList < UInt > ( ) , RandomAccess { <EOL> override val size : Int get ( ) = this@asList . size <EOL> override fun isEmpty ( ) : Boolean = this@asList . isEmpty ( ) <EOL> override fun contains ( element : UInt ) : Boolean = this@asList . contains ( element ) <EOL> override fun get ( index : Int ) : UInt = this@asList [ index ] <EOL> override fun indexOf ( element : UInt ) : Int = this@asList . indexOf ( element ) <EOL> override fun lastIndexOf ( element : UInt ) : Int = this@asList . lastIndexOf ( element ) <EOL> } <EOL> }

/**
 * Returns a [List] that wraps the original array.
 */


@ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ ExperimentalUnsignedTypes <EOL> public actual fun ULongArray . asList ( ) : List < ULong >

{ <EOL> return object : AbstractList < ULong > ( ) , RandomAccess { <EOL> override val size : Int get ( ) = this@asList . size <EOL> override fun isEmpty ( ) : Boolean = this@asList . isEmpty ( ) <EOL> override fun contains ( element : ULong ) : Boolean = this@asList . contains ( element ) <EOL> override fun get ( index : Int ) : ULong = this@asList [ index ] <EOL> override fun indexOf ( element : ULong ) : Int = this@asList . indexOf ( element ) <EOL> override fun lastIndexOf ( element : ULong ) : Int = this@asList . lastIndexOf ( element ) <EOL> } <EOL> }


@ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ ExperimentalUnsignedTypes <EOL> public actual fun UByteArray . asList ( ) : List < UByte >

{ <EOL> return object : AbstractList < UByte > ( ) , RandomAccess { <EOL> override val size : Int get ( ) = this@asList . size <EOL> override fun isEmpty ( ) : Boolean = this@asList . isEmpty ( ) <EOL> override fun contains ( element : UByte ) : Boolean = this@asList . contains ( element ) <EOL> override fun get ( index : Int ) : UByte = this@asList [ index ] <EOL> override fun indexOf ( element : UByte ) : Int = this@asList . indexOf ( element ) <EOL> override fun lastIndexOf ( element : UByte ) : Int = this@asList . lastIndexOf ( element ) <EOL> } <EOL> }


@ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ ExperimentalUnsignedTypes <EOL> public actual fun UShortArray . asList ( ) : List < UShort >

{ <EOL> return object : AbstractList < UShort > ( ) , RandomAccess { <EOL> override val size : Int get ( ) = this@asList . size <EOL> override fun isEmpty ( ) : Boolean = this@asList . isEmpty ( ) <EOL> override fun contains ( element : UShort ) : Boolean = this@asList . contains ( element ) <EOL> override fun get ( index : Int ) : UShort = this@asList [ index ] <EOL> override fun indexOf ( element : UShort ) : Int = this@asList . indexOf ( element ) <EOL> override fun lastIndexOf ( element : UShort ) : Int = this@asList . lastIndexOf ( element ) <EOL> } <EOL> }


@ Deprecated ( "<STR_LIT>" ) <EOL> @ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ DeprecatedSinceKotlin ( hiddenSince = "<STR_LIT:1.4>" ) <EOL> @ ExperimentalUnsignedTypes <EOL> public infix fun UIntArray . contentEquals ( other : UIntArray ) : Boolean

{ <EOL> return this . contentEquals ( other ) <EOL> }

/**
 * Checks if the two specified arrays are *structurally* equal to one another.
 *
 * Two arrays are considered structurally equal if they have the same size, and elements at corresponding indices are equal.
 *
 * @param other the array to compare with this array.
 * @return `true` if the two arrays are structurally equal, `false` otherwise.
 *
 * @sample samples.collections.Arrays.ContentOperations.intArrayContentEquals
 */


@ Deprecated ( "<STR_LIT>" ) <EOL> @ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ DeprecatedSinceKotlin ( hiddenSince = "<STR_LIT:1.4>" ) <EOL> @ ExperimentalUnsignedTypes <EOL> public infix fun ULongArray . contentEquals ( other : ULongArray ) : Boolean


@ Deprecated ( "<STR_LIT>" ) <EOL> @ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ DeprecatedSinceKotlin ( hiddenSince = "<STR_LIT:1.4>" ) <EOL> @ ExperimentalUnsignedTypes <EOL> public infix fun UByteArray . contentEquals ( other : UByteArray ) : Boolean


@ Deprecated ( "<STR_LIT>" ) <EOL> @ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ DeprecatedSinceKotlin ( hiddenSince = "<STR_LIT:1.4>" ) <EOL> @ ExperimentalUnsignedTypes <EOL> public infix fun UShortArray . contentEquals ( other : UShortArray ) : Boolean


@ Deprecated ( "<STR_LIT>" ) <EOL> @ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ DeprecatedSinceKotlin ( hiddenSince = "<STR_LIT:1.4>" ) <EOL> @ ExperimentalUnsignedTypes <EOL> public fun UIntArray . contentHashCode ( ) : Int

{ <EOL> return this . contentHashCode ( ) <EOL> }

/**
 * Returns a hash code based on the contents of this array as if it is [List].
 */


@ Deprecated ( "<STR_LIT>" ) <EOL> @ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ DeprecatedSinceKotlin ( hiddenSince = "<STR_LIT:1.4>" ) <EOL> @ ExperimentalUnsignedTypes <EOL> public fun ULongArray . contentHashCode ( ) : Int


@ Deprecated ( "<STR_LIT>" ) <EOL> @ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ DeprecatedSinceKotlin ( hiddenSince = "<STR_LIT:1.4>" ) <EOL> @ ExperimentalUnsignedTypes <EOL> public fun UByteArray . contentHashCode ( ) : Int


@ Deprecated ( "<STR_LIT>" ) <EOL> @ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ DeprecatedSinceKotlin ( hiddenSince = "<STR_LIT:1.4>" ) <EOL> @ ExperimentalUnsignedTypes <EOL> public fun UShortArray . contentHashCode ( ) : Int


@ Deprecated ( "<STR_LIT>" ) <EOL> @ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ DeprecatedSinceKotlin ( hiddenSince = "<STR_LIT:1.4>" ) <EOL> @ ExperimentalUnsignedTypes <EOL> public fun UIntArray . contentToString ( ) : String

{ <EOL> return this . contentToString ( ) <EOL> }

/**
 * Returns a string representation of the contents of the specified array as if it is [List].
 *
 * @sample samples.collections.Arrays.ContentOperations.contentToString
 */


@ Deprecated ( "<STR_LIT>" ) <EOL> @ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ DeprecatedSinceKotlin ( hiddenSince = "<STR_LIT:1.4>" ) <EOL> @ ExperimentalUnsignedTypes <EOL> public fun ULongArray . contentToString ( ) : String


@ Deprecated ( "<STR_LIT>" ) <EOL> @ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ DeprecatedSinceKotlin ( hiddenSince = "<STR_LIT:1.4>" ) <EOL> @ ExperimentalUnsignedTypes <EOL> public fun UByteArray . contentToString ( ) : String


@ Deprecated ( "<STR_LIT>" ) <EOL> @ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ DeprecatedSinceKotlin ( hiddenSince = "<STR_LIT:1.4>" ) <EOL> @ ExperimentalUnsignedTypes <EOL> public fun UShortArray . contentToString ( ) : String


public fun convert ( lossFunctionType : Losses ) : LossFunction

{ <EOL> return when ( lossFunctionType ) { <EOL> SOFT_MAX_CROSS_ENTROPY_WITH_LOGITS -> SoftmaxCrossEntropyWithLogits ( ) <EOL> HINGE -> Hinge ( ) <EOL> HUBER -> Huber ( ) <EOL> BINARY_CROSSENTROPY -> BinaryCrossEntropy ( ) <EOL> MAE -> MAE ( ) <EOL> MSE -> MSE ( ) <EOL> MAPE -> MAPE ( ) <EOL> MSLE -> MSLE ( ) <EOL> POISSON -> Poisson ( ) <EOL> SQUARED_HINGE -> SquaredHinge ( ) <EOL> LOG_COSH -> LogCosh ( ) <EOL> } <EOL> }

/** Converts enum value to subclass of [LossFunction]. */


public abstract fun apply ( tf : Ops , input : Operand < Float > , ) : Operand < Float >

/** Applies regularization to the input. */


private fun FlyweightCapableTreeStructure < LighterASTNode > . referenceExpression ( node : LighterASTNode , locateReferencedName : Boolean ) : LighterASTNode ?

{ <EOL> val childrenRef = Ref < Array < LighterASTNode ? > > ( ) <EOL> getChildren ( node , childrenRef ) <EOL> var result = childrenRef . get ( ) ? . firstOrNull { <EOL> it ? . isExpression ( ) == true || it ? . tokenType == KtNodeTypes . PARENTHESIZED <EOL> } <EOL> while ( locateReferencedName && result != null && result . tokenType == KtNodeTypes . PARENTHESIZED ) { <EOL> result = referenceExpression ( result , locateReferencedName = true ) <EOL> } <EOL> return result <EOL> }

/**
 * @param locateReferencedName whether to remove any nested parentheses while locating the reference element. This is useful for diagnostics
 * on super and unresolved references. For example, with the following, only the part inside the parentheses should be highlighted.
 *
 * ```
 * fun foo() {
 * (super)()
 * ^^^^^
 * (random123)()
 * ^^^^^^^^^
 * }
 * ```
 */


@ Test <EOL> fun testAndroidInverseOrder ( )

{ <EOL> val buildSource = buildFromTemplate ( "<STR_LIT>" ) <EOL> val build = buildSource . generate ( ) <EOL> val buildResult = build . runWithParams ( "<STR_LIT>" ) <EOL> assertFalse ( buildResult . isSuccessful ) <EOL> }

/**
 * In the common verify config, rules are declared that always lead to an error.
 * Verification of the Android build variant should use these rules and failed.
 */


{ <EOL> LLVMSetUnnamedAddr ( llvmGlobal , if ( value ) <NUM_LIT:1> else <NUM_LIT:0> ) <EOL> }

/**
 * Globals that are marked with unnamed_addr might be merged by LLVM's ConstantMerge pass.
 */


fun createGlobal ( type : LLVMTypeRef , name : String , isExported : Boolean = false ) : Global

{ <EOL> return Global . create ( this , type , name , isExported ) <EOL> }

/**
 * Creates [Global] with given type and name.
 *
 * It is external until explicitly initialized with [Global.setInitializer].
 */


fun placeGlobal ( name : String , initializer : ConstValue , isExported : Boolean = false ) : Global

{ <EOL> val global = createGlobal ( initializer . llvmType , name , isExported ) <EOL> global . setInitializer ( initializer ) <EOL> return global <EOL> }

/**
 * Creates [Global] with given name and value.
 */


fun placeGlobalArray ( name : String , elemType : LLVMTypeRef ? , elements : List < ConstValue > , isExported : Boolean = false ) : Global

{ <EOL> val initializer = ConstArray ( elemType , elements ) <EOL> val global = placeGlobal ( name , initializer , isExported ) <EOL> return global <EOL> }

/**
 * Creates array-typed global with given name and value.
 */


@ JsExport <EOL> fun makeValueDescriptionForSteppingTests ( value : Any ? ) : ValueDescriptionForSteppingTests ?

{ <EOL> val jsTypeName = jsTypeOf ( value ) <EOL> val displayedTypeName = when ( jsTypeName ) { <EOL> "<STR_LIT>" -> return null <EOL> "<STR_LIT:string>" , "<STR_LIT:object>" , "<STR_LIT:function>" -> if ( value == null ) jsTypeName else { <EOL> val klass = value :: class <EOL> knownFqNames [ klass ] ? : klass . simpleName ? : "<STR_LIT>" <EOL> } <EOL> else -> jsTypeName <EOL> } <EOL> return js ( "<STR_LIT>" ) . unsafeCast < ValueDescriptionForSteppingTests > ( ) . apply { <EOL> isNull = value == null <EOL> isReferenceType = jsTypeName == "<STR_LIT:object>" || jsTypeName == "<STR_LIT:function>" <EOL> valueDescription = when ( jsTypeName ) { <EOL> "<STR_LIT:string>" -> JSON . stringify ( value ) <EOL> else -> value . toString ( ) <EOL> } <EOL> typeName = displayedTypeName <EOL> } <EOL> }

/**
 * This function is only called from the debugger
 */


@ kotlin . internal . InlineOnly <EOL> public inline fun exitProcess ( status : Int ) : Nothing

{ <EOL> System . exit ( status ) <EOL> throw RuntimeException ( "<STR_LIT>" ) <EOL> }

/**
 * Terminates the currently running process.
 *
 * @param status serves as a status code; by convention,
 * a nonzero status code indicates abnormal termination.
 *
 * @return This method never returns normally.
 */


fun iWantSomeDocumentationFromDokka ( f : FindMyDocumantationPlease )

/**
 * A function using a class type placed right into the same file.
 *
 * @param f The parameter of the type under the investigation
 * */


public fun mean ( vararg arrays : FloatArray , channels : Int = <NUM_LIT:1> ) : FloatArray

{ <EOL> val result = FloatArray ( <NUM_LIT:3> ) { <NUM_LIT> } <EOL> val n = arrays . sumOf { it . size / channels } <EOL> for ( floats in arrays ) { <EOL> require ( floats . size % channels == <NUM_LIT:0> ) { <EOL> "<STR_LIT>" + <EOL> "<STR_LIT>" <EOL> } <EOL> for ( i in floats . indices ) { <EOL> result [ i % channels ] += floats [ i ] / n <EOL> } <EOL> } <EOL> return result <EOL> }

/**
 * Computes mean value for each channel of the provided arrays.
 *
 * NOTE: might be migrated to multik in the future.
 *
 * @param [arrays] input arrays. Size of each array should be divisible by the passed [channels] number.
 * @param [channels] number of channels to compute mean value for.
 * @return an array of size [channels] containing mean value for each channel.
 */


public fun std ( vararg arrays : FloatArray , channels : Int = <NUM_LIT:1> ) : FloatArray

{ <EOL> val sumSquares = FloatArray ( <NUM_LIT:3> ) { <NUM_LIT> } <EOL> val sum = FloatArray ( <NUM_LIT:3> ) { <NUM_LIT> } <EOL> val n = arrays . sumOf { it . size / channels } <EOL> for ( floats in arrays ) { <EOL> require ( floats . size % channels == <NUM_LIT:0> ) { <EOL> "<STR_LIT>" + <EOL> "<STR_LIT>" <EOL> } <EOL> for ( i in floats . indices ) { <EOL> sumSquares [ i % channels ] += floats [ i ] * floats [ i ] / n <EOL> sum [ i % channels ] += floats [ i ] / n <EOL> } <EOL> } <EOL> return FloatArray ( <NUM_LIT:3> ) { sqrt ( sumSquares [ it ] - sum [ it ] * sum [ it ] ) } <EOL> }

/**
 * Computes std value for each channel of the provided arrays.
 *
 * NOTE: might be migrated to multik in the future.
 *
 * @param [arrays] input arrays. Size of each array should be divisible by the passed [channels] number.
 * @param [channels] number of channels to compute std value for.
 * @return an array of size [channels] containing std value for each channel.
 */


public fun FloatArray . mean ( channels : Int = <NUM_LIT:1> ) : FloatArray

= mean ( this , channels = channels )

/**
 * Computes mean value for each channel of the array. Array size should be divisible by the passed [channels] number.
 *
 * NOTE: might be migrated to multik in the future.
 *
 * @param [channels] number of channels to compute mean value for.
 * @return an array of size [channels] containing mean value for each channel.
 */


public fun FloatArray . std ( channels : Int = <NUM_LIT:1> ) : FloatArray

= std ( this , channels = channels )

/**
 * Computes std value for each channel of the array. Array size should be divisible by the passed [channels] number.
 *
 * NOTE: might be migrated to multik in the future.
 *
 * @param [channels] number of channels to compute std value for.
 * @return an array of size [channels] containing std value for each channel.
 */


{ <EOL> cEnumCompanionGenerator . invokePostLinkageSteps ( ) <EOL> cEnumByValueFunctionGenerator . invokePostLinkageSteps ( ) <EOL> cEnumClassGenerator . invokePostLinkageSteps ( ) <EOL> cEnumVarClassGenerator . invokePostLinkageSteps ( ) <EOL> cStructClassGenerator . invokePostLinkageSteps ( ) <EOL> cStructCompanionGenerator . invokePostLinkageSteps ( ) <EOL> }

/**
 * We postpone generation of bodies until IR linkage is complete.
 * This way we ensure that all used symbols are resolved.
 */


@ HtmlTagMarker <EOL> inline fun TABLE . caption ( classes : String ? = null , crossinline block : CAPTION . ( ) -> Unit = { } ) : Unit

= CAPTION ( attributesMapOf ( "<STR_LIT:class>" , classes ) , consumer ) . visit ( block )


@ HtmlTagMarker <EOL> inline fun TABLE . colGroup ( classes : String ? = null , crossinline block : COLGROUP . ( ) -> Unit = { } ) : Unit

= COLGROUP ( attributesMapOf ( "<STR_LIT:class>" , classes ) , consumer ) . visit ( block )


@ HtmlTagMarker <EOL> inline fun TABLE . thead ( classes : String ? = null , crossinline block : THEAD . ( ) -> Unit = { } ) : Unit

= THEAD ( attributesMapOf ( "<STR_LIT:class>" , classes ) , consumer ) . visit ( block )


@ HtmlTagMarker <EOL> inline fun TABLE . tfoot ( classes : String ? = null , crossinline block : TFOOT . ( ) -> Unit = { } ) : Unit

= TFOOT ( attributesMapOf ( "<STR_LIT:class>" , classes ) , consumer ) . visit ( block )


@ HtmlTagMarker <EOL> inline fun TABLE . tbody ( classes : String ? = null , crossinline block : TBODY . ( ) -> Unit = { } ) : Unit

= TBODY ( attributesMapOf ( "<STR_LIT:class>" , classes ) , consumer ) . visit ( block )


@ HtmlTagMarker <EOL> inline fun TABLE . tr ( classes : String ? = null , crossinline block : TR . ( ) -> Unit = { } ) : Unit

= TR ( attributesMapOf ( "<STR_LIT:class>" , classes ) , consumer ) . visit ( block )


@ HtmlTagMarker <EOL> inline fun TBODY . tr ( classes : String ? = null , crossinline block : TR . ( ) -> Unit = { } ) : Unit


@ HtmlTagMarker <EOL> inline fun TFOOT . tr ( classes : String ? = null , crossinline block : TR . ( ) -> Unit = { } ) : Unit


@ HtmlTagMarker <EOL> inline fun THEAD . tr ( classes : String ? = null , crossinline block : TR . ( ) -> Unit = { } ) : Unit


@ HtmlTagMarker <EOL> inline fun TR . th ( scope : ThScope ? = null , classes : String ? = null , crossinline block : TH . ( ) -> Unit = { } ) : Unit

= TH ( attributesMapOf ( "<STR_LIT>" , scope ? . enumEncode ( ) , "<STR_LIT:class>" , classes ) , consumer ) . visit ( block )


@ HtmlTagMarker <EOL> inline fun TR . td ( classes : String ? = null , crossinline block : TD . ( ) -> Unit = { } ) : Unit

= TD ( attributesMapOf ( "<STR_LIT:class>" , classes ) , consumer ) . visit ( block )


public expect fun println ( )

/** Prints the line separator to the standard output stream. */


public expect fun println ( message : Any ? )

/** Prints the given [message] and the line separator to the standard output stream. */


public expect fun print ( message : Any ? )

/** Prints the given [message] to the standard output stream. */


@ SinceKotlin ( "<STR_LIT:1.6>" ) <EOL> public expect fun readln ( ) : String

/**
 * Reads a line of input from the standard input stream and returns it,
 * or throws a [RuntimeException] if EOF has already been reached when [readln] is called.
 *
 * LF or CRLF is treated as the line terminator. Line terminator is not included in the returned string.
 *
 * Currently this function is not supported in Kotlin/JS and throws [UnsupportedOperationException].
 */


@ SinceKotlin ( "<STR_LIT:1.6>" ) <EOL> public expect fun readlnOrNull ( ) : String ?

/**
 * Reads a line of input from the standard input stream and returns it,
 * or return `null` if EOF has already been reached when [readlnOrNull] is called.
 *
 * LF or CRLF is treated as the line terminator. Line terminator is not included in the returned string.
 *
 * Currently this function is not supported in Kotlin/JS and throws [UnsupportedOperationException].
 */


@ DisplayName ( "<STR_LIT>" ) <EOL> @ GradleTest <EOL> fun testClasspathChangesCauseTypesToBeReprocessed ( gradleVersion : GradleVersion )

{ <EOL> project ( PROJECT_NAME , gradleVersion ) { <EOL> setupIncrementalAptProject ( Pair ( "<STR_LIT>" , IncrementalBinaryIsolatingProcessor :: class . java ) , Pair ( "<STR_LIT>" , IncrementalAggregatingReferencingClasspathProcessor :: class . java ) , ) <EOL> settingsGradle . append ( "<STR_LIT>" ) <EOL> val classpathTypeSource = subProject ( "<STR_LIT:lib>" ) . run { <EOL> projectPath . createDirectories ( ) <EOL> buildGradle . writeText ( """<STR_LIT>""" . trimIndent ( ) ) <EOL> val source = javaSourcesDir ( ) <EOL> . resolve ( IncrementalAggregatingReferencingClasspathProcessor . CLASSPATH_TYPE . replace ( "<STR_LIT:.>" , "<STR_LIT:/>" ) + "<STR_LIT>" ) <EOL> source . parent . createDirectories ( ) <EOL> source . writeText ( """<STR_LIT>""" . trimIndent ( ) ) <EOL> return@run source <EOL> } <EOL> buildGradle . append ( """<STR_LIT>""" . trimIndent ( ) ) <EOL> javaSourcesDir ( ) . deleteRecursively ( ) <EOL> with ( javaSourcesDir ( ) . resolve ( "<STR_LIT>" ) ) { <EOL> parent . createDirectories ( ) <EOL> writeText ( """<STR_LIT>""" . trimIndent ( ) ) <EOL> } <EOL> val allKotlinStubs = setOf ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) <EOL> build ( "<STR_LIT:clean>" , "<STR_LIT:assemble>" ) { <EOL> assertEquals ( allKotlinStubs . map { projectPath . resolve ( it ) . toRealPath ( ) . toString ( ) } . toSet ( ) , getProcessedSources ( output ) ) <EOL> assertFileInProjectExists ( "<STR_LIT>" ) <EOL> } <EOL> classpathTypeSource . writeText ( classpathTypeSource . readText ( ) . replace ( "<STR_LIT:}>" , "<STR_LIT>" ) ) <EOL> build ( "<STR_LIT:assemble>" ) { <EOL> assertEquals ( emptySet ( ) , getProcessedSources ( output ) ) <EOL> assertEquals ( setOf ( "<STR_LIT>" ) , getProcessedTypes ( output ) ) <EOL> assertFileInProjectExists ( "<STR_LIT>" ) <EOL> } <EOL> } <EOL> }

/**
 * Make sure that changes to classpath can cause types to be reprocessed (i.e types in generated .class files that contain annotations
 * claimed by annotation processors).
 */


override fun equals ( other : Any ? ) : Boolean

{ <EOL> val otherType = other as? ColumnSchema ? : return false <EOL> if ( otherType . kind != kind ) return false <EOL> if ( otherType . nullable != nullable ) return false <EOL> return when ( this ) { <EOL> is Value -> type == ( otherType as Value ) . type <EOL> is Group -> schema == ( otherType as Group ) . schema <EOL> is Frame -> schema == ( otherType as Frame ) . schema <EOL> else -> throw NotImplementedError ( ) <EOL> } <EOL> }

/** Checks equality just on kind, type, or schema. */


{ <EOL> var prod = <NUM_LIT:1L> <EOL> for ( i in <NUM_LIT:0> until numDimensions ( ) ) { <EOL> prod *= abs ( dims [ i ] ) <EOL> } <EOL> return prod <EOL> }

/** Returns amount of elements in Tensor with the given shape. */


{ <EOL> return dims . size <EOL> }


{ <EOL> return dims <EOL> }

/** Returns the array of dimensions representing this shape. */


public operator fun get ( i : Int ) : Long

{ <EOL> return dims [ i ] <EOL> }

/**
 * Returns the value of a dimension
 *
 * @param i The index at which to retrieve a dimension.
 * @return The size of dimension i
 */


public operator fun set ( i : Int , value : Long )

{ <EOL> dims [ i ] = value <EOL> }

/**
 * Sets the value of a dimension
 *
 * @param i The index at which to retrieve a dimension.
 */


private fun isKnown ( i : Int ) : Boolean

{ <EOL> return dims [ i ] != - <NUM_LIT:1L> <EOL> }

/**
 * Test whether dimension i in this shape is known
 *
 * @param [i] Target dimension to test
 * @return Whether dimension [i] is unknown (equal to -1)
 */


{ <EOL> check ( isKnown ( i ) ) { "<STR_LIT>" } <EOL> }

/**
 * Throw an exception if dimension [i] is unknown.
 *
 * @param [i] Target dimension to test
 * @throws IllegalStateException if dimension [i] is unknown
 */


public fun replace ( i : Int , dim : Long ) : TensorShape

{ <EOL> dims [ i ] = dim <EOL> return this <EOL> }

/**
 * Replace dimension i with a new dimension size.
 *
 * @param i The target dimension to change.
 * @param dim The new dimension size.
 * @return The new changed TensorShape
 */


public fun replaceLast ( dim : Long ) : TensorShape

{ <EOL> return replace ( dims . size - <NUM_LIT:1> , dim ) <EOL> }

/**
 * Replace the last dimension with a new dimension size.
 *
 * @param dim New size for the last dimensions
 * @return The new changed TensorShape
 */


public fun replaceFirst ( dim : Long ) : TensorShape

{ <EOL> return replace ( <NUM_LIT:0> , dim ) <EOL> }

/**
 * Replace the first dimension with a new dimension size.
 *
 * @param dim New size for first dimension
 * @return The new changed TensorShape.
 */