private fun findSegmentReceive ( id : Long , startFrom : ChannelSegment < E > ) : ChannelSegment < E > ?

= <EOL> receiveSegment . findSegmentAndMoveForward ( id , startFrom , createSegmentFunction ( ) ) . let { <EOL> if ( it . isClosed ) { <EOL> completeCloseOrCancel ( ) <EOL> if ( startFrom . id * SEGMENT_SIZE < sendersCounter ) startFrom . cleanPrev ( ) <EOL> null <EOL> } else { <EOL> val segment = it . segment <EOL> if ( ! isRendezvousOrUnlimited && id <= bufferEndCounter / SEGMENT_SIZE ) { <EOL> bufferEndSegment . moveForward ( segment ) <EOL> } <EOL> if ( segment . id > id ) { <EOL> updateReceiversCounterIfLower ( segment . id * SEGMENT_SIZE ) <EOL> if ( segment . id * SEGMENT_SIZE < sendersCounter ) segment . cleanPrev ( ) <EOL> null <EOL> } else { <EOL> assert { segment . id == id } <EOL> segment <EOL> } <EOL> } <EOL> }

/**
 * Finds the segment with the specified [id] starting by the [startFrom]
 * segment and following the [ChannelSegment.next] references. In case
 * the required segment has not been created yet, this function attempts
 * to add it to the underlying linked list. Finally, it updates [receiveSegment]
 * to the found segment if its [ChannelSegment.id] is greater than the one
 * of the already stored segment.
 *
 * In case the requested segment is already removed, or if it should be allocated
 * but the linked list structure is closed for new segments addition, this function
 * returns `null`. The implementation also efficiently skips a sequence of removed
 * segments, updating the [receivers] counter correspondingly.
 */


private fun findSegmentBufferEnd ( id : Long , startFrom : ChannelSegment < E > , currentBufferEndCounter : Long ) : ChannelSegment < E > ?

= <EOL> bufferEndSegment . findSegmentAndMoveForward ( id , startFrom , createSegmentFunction ( ) ) . let { <EOL> if ( it . isClosed ) { <EOL> completeCloseOrCancel ( ) <EOL> moveSegmentBufferEndToSpecifiedOrLast ( id , startFrom ) <EOL> incCompletedExpandBufferAttempts ( ) <EOL> null <EOL> } else { <EOL> val segment = it . segment <EOL> if ( segment . id > id ) { <EOL> if ( bufferEnd . compareAndSet ( currentBufferEndCounter + <NUM_LIT:1> , segment . id * SEGMENT_SIZE ) ) { <EOL> incCompletedExpandBufferAttempts ( segment . id * SEGMENT_SIZE - currentBufferEndCounter ) <EOL> } else { <EOL> incCompletedExpandBufferAttempts ( ) <EOL> } <EOL> null <EOL> } else { <EOL> assert { segment . id == id } <EOL> segment <EOL> } <EOL> } <EOL> }

/**
 * Importantly, when this function does not find the requested segment,
 * it always updates the number of completed `expandBuffer()` attempts.
 */


private fun moveSegmentBufferEndToSpecifiedOrLast ( id : Long , startFrom : ChannelSegment < E > )

{ <EOL> var segment : ChannelSegment < E > = startFrom <EOL> while ( segment . id < id ) { <EOL> segment = segment . next ? : break <EOL> } <EOL> while ( true ) { <EOL> while ( segment . isRemoved ) { <EOL> segment = segment . next ? : break <EOL> } <EOL> if ( bufferEndSegment . moveForward ( segment ) ) return <EOL> } <EOL> }

/**
 * Updates [bufferEndSegment] to the one with the specified [id] or
 * to the last existing segment, if the required segment is not yet created.
 *
 * Unlike [findSegmentBufferEnd], this function does not allocate new segments.
 */


private fun updateSendersCounterIfLower ( value : Long ) : Unit

= <EOL> sendersAndCloseStatus . loop { cur -> <EOL> val curCounter = cur . sendersCounter <EOL> if ( curCounter >= value ) return <EOL> val update = constructSendersAndCloseStatus ( curCounter , cur . sendersCloseStatus ) <EOL> if ( sendersAndCloseStatus . compareAndSet ( cur , update ) ) return <EOL> }

/**
 * Updates the `senders` counter if its value
 * is lower that the specified one.
 *
 * Senders use this function to efficiently skip
 * a sequence of cancelled receivers.
 */


private fun updateReceiversCounterIfLower ( value : Long ) : Unit

= <EOL> receivers . loop { cur -> <EOL> if ( cur >= value ) return <EOL> if ( receivers . compareAndSet ( cur , value ) ) return <EOL> }

/**
 * Updates the `receivers` counter if its value
 * is lower that the specified one.
 *
 * Receivers use this function to efficiently skip
 * a sequence of cancelled senders.
 */


fun onCancelledRequest ( index : Int , receiver : Boolean )

{ <EOL> if ( receiver ) channel . waitExpandBufferCompletion ( id * SEGMENT_SIZE + index ) <EOL> onSlotCleaned ( ) <EOL> }

/**
 * Invokes `onSlotCleaned()` preceded by a `waitExpandBufferCompletion(..)` call
 * in case the cancelled request is receiver.
 */


private fun < T > CancellableContinuation < T > . tryResume0 ( value : T , onCancellation : ( ( cause : Throwable ) -> Unit ) ? = null ) : Boolean

= <EOL> tryResume ( value , null , onCancellation ) . let { token -> <EOL> if ( token != null ) { <EOL> completeResume ( token ) <EOL> true <EOL> } else false <EOL> }

/**
 * Tries to resume this continuation with the specified
 * value. Returns `true` on success and `false` on failure.
 */


public fun wrapUnsafe ( array : ByteArray ) : ByteString

= ByteString . wrap ( array )

/**
 * Creates a new byte string by wrapping [array] without copying it.
 * Make sure that the wrapped array won't be modified during the lifespan of the returned byte string.
 *
 * @param array the array to wrap into the byte string.
 */


public inline fun withByteArrayUnsafe ( byteString : ByteString , block : ( ByteArray ) -> Unit )

{ <EOL> block ( byteString . getBackingArrayReference ( ) ) <EOL> }

/**
 * Applies [block] to a reference to the underlying array.
 *
 * This method invokes [block] on a reference to the underlying array, not to its copy.
 * Consider using [ByteString.toByteArray] if it's impossible to guarantee that the array won't be modified.
 */


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

= append ( value ) . appendLine ( )

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


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

= append ( value ) . appendLine ( )


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

= append ( value ) . appendLine ( )


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

= append ( value ) . appendLine ( )


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

= append ( value ) . appendLine ( )


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

= append ( value ) . appendLine ( )


protected open fun isDeclaredFunctionAvailable ( function : SimpleFunctionDescriptor ) : Boolean

= true

/**
 * Can be overridden to filter specific declared functions. Not called on non-declared functions.
 */


protected open fun computeNonDeclaredFunctions ( name : Name , functions : MutableList < SimpleFunctionDescriptor > )

{ <EOL> }

/**
 * This function has the next contract:
 *
 * * It can only add to the end of the [functions] list and shall not modify it otherwise (e.g. remove from it).
 * * Before the call, [functions] should already contain all declared functions with the [name] name.
 */


protected open fun computeNonDeclaredProperties ( name : Name , descriptors : MutableList < PropertyDescriptor > )

{ <EOL> }

/**
 * This function has the next contract:
 *
 * * It can only add to the end of the [descriptors] list and shall not modify it otherwise (e.g. remove from it).
 * * Before the call, [descriptors] should already contain all declared properties with the [name] name.
 */


private inline fun < T : DeclarationDescriptor > computeNonDeclaredDescriptors ( name : Name , declaredDescriptors : List < T > , computeNonDeclared : ( Name , MutableList < T > ) -> Unit ) : List < T >

{ <EOL> val declaredDescriptorsWithSameName = declaredDescriptors . filterTo ( mutableListOf ( ) ) { it . name == name } <EOL> val nonDeclaredPropertiesStartIndex = declaredDescriptorsWithSameName . size <EOL> computeNonDeclared ( name , declaredDescriptorsWithSameName ) <EOL> return declaredDescriptorsWithSameName . subList ( nonDeclaredPropertiesStartIndex , declaredDescriptorsWithSameName . size ) <EOL> }

/**
 * We have to collect non-declared properties in such non-pretty way because we don't want to change the contract of the
 * [computeNonDeclaredProperties] and [computeNonDeclaredFunctions] methods, because we do not want any performance penalties.
 *
 * [computeNonDeclared] may only add elements to the end of [MutableList], otherwise this function would not work properly.
 */


internal fun FirClassSymbol < * > . isSerializableEnum ( session : FirSession ) : Boolean

{ <EOL> return classKind . isEnumClass && hasSerializableOrMetaAnnotation ( session ) <EOL> }

/**
 * Check that class is enum and marked by `Serializable` or meta-serializable annotation.
 */


public inline fun < reified @ PureReifiable T > emptyArray ( ) : Array < T >

= <EOL> @ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> ( arrayOfNulls < T > ( <NUM_LIT:0> ) as Array < T > )

/**
 * Returns an empty array of the specified type [T].
 */


override fun tryToMatch ( startIndex : Int , testString : CharSequence , matchResult : MatchResultImpl ) : Int

{ <EOL> matchResult . setConsumed ( groupIndex , startIndex ) <EOL> children . forEach { <EOL> if ( it . findBack ( <NUM_LIT:0> , startIndex , testString , matchResult ) >= <NUM_LIT:0> ) { <EOL> matchResult . setConsumed ( groupIndex , - <NUM_LIT:1> ) <EOL> return next . matches ( startIndex , testString , matchResult ) <EOL> } <EOL> } <EOL> return - <NUM_LIT:1> <EOL> }

/** Returns startIndex+shift, the next position to match */


{ <EOL> matchResult . setConsumed ( groupIndex , startIndex ) <EOL> children . forEach { <EOL> val shift = it . findBack ( <NUM_LIT:0> , startIndex , testString , matchResult ) <EOL> if ( shift >= <NUM_LIT:0> ) { <EOL> return - <NUM_LIT:1> <EOL> } <EOL> } <EOL> return next . matches ( startIndex , testString , matchResult ) <EOL> }


internal fun parseKotlinVersion ( fullVersionString : String ) : KotlinVersion ?

{ <EOL> val versionParts = fullVersionString <EOL> . split ( "<STR_LIT:.>" , "<STR_LIT:->" , limit = <NUM_LIT:4> ) <EOL> . takeIf { parts -> parts . size >= <NUM_LIT:3> && parts . subList ( <NUM_LIT:0> , <NUM_LIT:3> ) . all { it . isNumeric ( ) } } <EOL> ? : return null <EOL> return KotlinVersion ( major = versionParts [ <NUM_LIT:0> ] . toInt ( ) , minor = versionParts [ <NUM_LIT:1> ] . toInt ( ) , patch = versionParts [ <NUM_LIT:2> ] . toInt ( ) ) <EOL> }

/**
 * Accepts a full version string that contains the major, minor
 * and patch versions divided by dots, such as "1.7.10".
 *
 * Does NOT parse and store custom suffixes, so `1.8.20-RC2`
 * or `1.8.20-dev-42` will be viewed as `1.8.20`.
 */


public fun < T : Number , D : Dimension > exp ( a : MultiArray < T , D > ) : NDArray < Double , D >

/**
 * Returns a ndarray of Double from the given ndarray to each element of which an exp function has been applied.
 */


public fun < D : Dimension > expF ( a : MultiArray < Float , D > ) : NDArray < Float , D >

/**
 * Returns a ndarray of Float from the given ndarray to each element of which an exp function has been applied.
 */


public fun < D : Dimension > expCF ( a : MultiArray < ComplexFloat , D > ) : NDArray < ComplexFloat , D >

/**
 * Returns a ndarray of [ComplexFloat] from the given ndarray to each element of which an exp function has been applied.
 */


public fun < D : Dimension > expCD ( a : MultiArray < ComplexDouble , D > ) : NDArray < ComplexDouble , D >

/**
 * Returns a ndarray of [ComplexDouble] from the given ndarray to each element of which an exp function has been applied.
 */


public fun < T : Number , D : Dimension > log ( a : MultiArray < T , D > ) : NDArray < Double , D >

/**
 * Returns a ndarray of Double from the given ndarray to each element of which a log function has been applied.
 */


public fun < D : Dimension > logF ( a : MultiArray < Float , D > ) : NDArray < Float , D >

/**
 * Returns a ndarray of Float from the given ndarray to each element of which a log function has been applied.
 */


public fun < D : Dimension > logCF ( a : MultiArray < ComplexFloat , D > ) : NDArray < ComplexFloat , D >

/**
 * Returns a ndarray of [ComplexFloat] from the given ndarray to each element of which a log function has been applied.
 */


public fun < D : Dimension > logCD ( a : MultiArray < ComplexDouble , D > ) : NDArray < ComplexDouble , D >

/**
 * Returns a ndarray of [ComplexDouble] from the given ndarray to each element of which a log function has been applied.
 */


public fun < T : Number , D : Dimension > sin ( a : MultiArray < T , D > ) : NDArray < Double , D >

/**
 * Returns an ndarray of Double from the given ndarray to each element of which a sin function has been applied.
 */


public fun < D : Dimension > sinF ( a : MultiArray < Float , D > ) : NDArray < Float , D >

/**
 * Returns an ndarray of Float from the given ndarray to each element of which a sin function has been applied.
 */


public fun < D : Dimension > sinCF ( a : MultiArray < ComplexFloat , D > ) : NDArray < ComplexFloat , D >

/**
 * Returns an ndarray of [ComplexFloat] from the given ndarray to each element of which a sin function has been applied.
 */


public fun < D : Dimension > sinCD ( a : MultiArray < ComplexDouble , D > ) : NDArray < ComplexDouble , D >

/**
 * Returns an ndarray of [ComplexDouble] from the given ndarray to each element of which a sin function has been applied.
 */


public fun < T : Number , D : Dimension > cos ( a : MultiArray < T , D > ) : NDArray < Double , D >

/**
 * Returns a ndarray of Double from the given ndarray to each element of which a cos function has been applied.
 */


public fun < D : Dimension > cosF ( a : MultiArray < Float , D > ) : NDArray < Float , D >

/**
 * Returns a ndarray of Float from the given ndarray to each element of which a cos function has been applied.
 */


public fun < D : Dimension > cosCF ( a : MultiArray < ComplexFloat , D > ) : NDArray < ComplexFloat , D >

/**
 * Returns a ndarray of [ComplexFloat] from the given ndarray to each element of which a cos function has been applied.
 */


public fun < D : Dimension > cosCD ( a : MultiArray < ComplexDouble , D > ) : NDArray < ComplexDouble , D >

/**
 * Returns a ndarray of [ComplexDouble] from the given ndarray to each element of which a cos function has been applied.
 */


fun registerAddedOrChangedFile ( outputFile : Path )

/**
 * This method should be called before creating a new file or changing an existing file.
 */


fun deleteFile ( outputFile : Path )

/**
 * This method should be used to perform a file removal.
 */


fun markAsSuccessful ( )

/**
 * Marks the transaction as successful, so it should not revert changes if it is able to perform revert.
 */


{ <EOL> reporter . debug { "<STR_LIT>" } <EOL> reporter . measure ( GradleBuildTime . RESTORE_OUTPUT_FROM_BACKUP ) { <EOL> for ( ( originPath , relocatedPath ) in fileRelocationRegistry ) { <EOL> if ( relocatedPath == null ) { <EOL> if ( Files . exists ( originPath ) ) { <EOL> Files . delete ( originPath ) <EOL> } <EOL> continue <EOL> } <EOL> Files . move ( relocatedPath , originPath , StandardCopyOption . REPLACE_EXISTING ) <EOL> } <EOL> } <EOL> }

/**
 * Reverts all the file changes registered in this transaction.
 * If the value for a key is null, then it's the file that was created during the transaction, so the file will be just removed.
 */


{ <EOL> reporter . debug { "<STR_LIT>" } <EOL> reporter . measure ( GradleBuildTime . CLEAN_BACKUP_STASH ) { <EOL> Files . walk ( stashDir ) . use { <EOL> it . sorted ( Comparator . reverseOrder ( ) ) <EOL> . forEach ( Files :: delete ) <EOL> } <EOL> } <EOL> }


fun Project . objCExportHeaderGeneratorTest ( taskName : String , testDisplayNameTag : String ? = null , configure : Test . ( ) -> Unit = { } , )

= nativeTest ( taskName = taskName , tag = null , requirePlatformLibs = false , ) { <EOL> run { <EOL> val testDependencyKlibs = configurations . maybeCreate ( "<STR_LIT>" ) . also { configuration -> <EOL> configuration . attributes { <EOL> attribute ( Usage . USAGE_ATTRIBUTE , objects . named ( KotlinUsages . KOTLIN_API ) ) <EOL> attribute ( Category . CATEGORY_ATTRIBUTE , objects . named ( Category . LIBRARY ) ) <EOL> attribute ( KotlinPlatformType . attribute , KotlinPlatformType . native ) <EOL> attribute ( KotlinNativeTarget . konanTargetAttribute , HostManager . host . name ) <EOL> } <EOL> dependencies { <EOL> configuration ( project ( "<STR_LIT>" ) ) <EOL> configuration ( project ( "<STR_LIT>" ) ) <EOL> } <EOL> } <EOL> val testDependencyKlibsClasspath = testDependencyKlibs . incoming . files . elements . map { elements -> <EOL> elements . joinToString ( File . pathSeparator ) { location -> location . asFile . absolutePath } <EOL> } <EOL> doFirst { <EOL> systemProperty ( "<STR_LIT>" , testDependencyKlibsClasspath . get ( ) ) <EOL> } <EOL> inputs . files ( testDependencyKlibs ) . withPathSensitivity ( PathSensitivity . RELATIVE ) <EOL> } <EOL> useJUnitPlatform ( ) <EOL> enableJunit5ExtensionsAutodetection ( ) <EOL> systemProperty ( "<STR_LIT>" , project . providers . gradleProperty ( "<STR_LIT>" ) . isPresent ) <EOL> if ( testDisplayNameTag != null ) { <EOL> systemProperty ( "<STR_LIT>" , testDisplayNameTag ) <EOL> } <EOL> configure ( ) <EOL> }

/**
 * Wrapper for [nativeTest] which helps to apply defaults expected by
 * projects under ':native:objcexport-header-generator:*'
 */


internal suspend fun < R > flowScope ( @ BuilderInference block : suspend CoroutineScope . ( ) -> R ) : R

= <EOL> suspendCoroutineUninterceptedOrReturn { uCont -> <EOL> val coroutine = FlowCoroutine ( uCont . context , uCont ) <EOL> coroutine . startUndispatchedOrReturn ( coroutine , block ) <EOL> }

/**
 * Creates a [CoroutineScope] and calls the specified suspend block with this scope.
 * This builder is similar to [coroutineScope] with the only exception that it *ties* lifecycle of children
 * and itself regarding the cancellation, thus being cancelled when one of the children becomes cancelled.
 *
 * For example:
 * ```
 * flowScope {
 * launch {
 * throw CancellationException()
 * }
 * } // <- CE will be rethrown here
 * ```
 */


internal fun < R > scopedFlow ( @ BuilderInference block : suspend CoroutineScope . ( FlowCollector < R > ) -> Unit ) : Flow < R >

= <EOL> flow { <EOL> flowScope { block ( this @ flow ) } <EOL> }

/**
 * Creates a flow that also provides a [CoroutineScope] for each collector
 * Shorthand for:
 * ```
 * flow {
 * flowScope {
 * ...
 * }
 * }
 * ```
 * with additional constraint on cancellation.
 * To cancel child without cancelling itself, `cancel(ChildCancelledException())` should be used.
 */


@ DelicateSymbolTableApi <EOL> fun forEachDeclarationSymbol ( block : ( IrSymbol ) -> Unit )

{ <EOL> table . forEachDeclarationSymbol ( block ) <EOL> scriptSlice . forEachSymbol { block ( it ) } <EOL> classSlice . forEachSymbol { block ( it ) } <EOL> constructorSlice . forEachSymbol { block ( it ) } <EOL> enumEntrySlice . forEachSymbol { block ( it ) } <EOL> fieldSlice . forEachSymbol { block ( it ) } <EOL> functionSlice . forEachSymbol { block ( it ) } <EOL> propertySlice . forEachSymbol { block ( it ) } <EOL> typeAliasSlice . forEachSymbol { block ( it ) } <EOL> globalTypeParameterSlice . forEachSymbol { block ( it ) } <EOL> }

/**
 * This function is quite messy and doesn't have good contract of what exactly is traversed.
 * Basic idea is it traverse symbols which can be reasonable referered from other module
 *
 * Be careful when using it, and avoid it, except really need.
 */


fun < K , V > Map < K , V > . shouldContainAll ( vararg expected : Pair < K , V > ) : Unit

= shouldContainAll ( expected . toMap ( ) )

/** @see io.kotest.matchers.maps.shouldContainAll */


fun < K , V > Map < K , V > . shouldContainExactly ( vararg expected : Pair < K , V > ) : Unit

= shouldContainExactly ( expected . toMap ( ) )

/** @see io.kotest.matchers.maps.shouldContainExactly */


fun < T > Sequence < T > . shouldBeSingleton ( match : ( T ) -> Unit )

{ <EOL> toList ( ) . shouldBeSingleton ( match ) <EOL> }

/** Verify the sequence contains a single element, matching [match]. */


public fun < T > y ( column : ColumnReference < T > , parameters : LetsPlotPositionalMappingParametersContinuous < T > . ( ) -> Unit = { } ) : PositionalMapping < T >

{ <EOL> return addPositionalMapping < T > ( Y , column . name ( ) , LetsPlotPositionalMappingParametersContinuous < T > ( ) . apply ( parameters ) ) <EOL> }

/**
 * Maps the `y` aesthetic to a data column by [ColumnReference].
 *
 * @param column the data column to map to the y-coordinate.
 * @param parameters additional mapping parameters.
 * @return a [PositionalMapping] object representing the mapping.
 */


public fun < T > y ( column : KProperty < T > , parameters : LetsPlotPositionalMappingParametersContinuous < T > . ( ) -> Unit = { } ) : PositionalMapping < T >

{ <EOL> return addPositionalMapping < T > ( Y , column . name , LetsPlotPositionalMappingParametersContinuous < T > ( ) . apply ( parameters ) ) <EOL> }

/**
 * Maps the `y` aesthetic to a data column by [KProperty].
 *
 * @param column the data column to map to the y-coordinate.
 * @param parameters additional mapping parameters.
 * @return a [PositionalMapping] object representing the mapping.
 */


public fun y ( column : String , parameters : LetsPlotPositionalMappingParametersContinuous < Any ? > . ( ) -> Unit = { } ) : PositionalMapping < Any ? >

{ <EOL> return addPositionalMapping < Any ? > ( Y , column , LetsPlotPositionalMappingParametersContinuous < Any ? > ( ) . apply ( parameters ) ) <EOL> }

/**
 * Maps the `y` aesthetic to a data column by [String].
 *
 * @param column the data column to map to the y-coordinate.
 * @param parameters additional mapping parameters.
 * @return a [PositionalMapping] object representing the mapping.
 */


public fun < T > y ( values : Iterable < T > , name : String ? = null , parameters : LetsPlotPositionalMappingParametersContinuous < T > . ( ) -> Unit = { } ) : PositionalMapping < T >

{ <EOL> return addPositionalMapping < T > ( Y , values . toList ( ) , name , LetsPlotPositionalMappingParametersContinuous < T > ( ) . apply ( parameters ) ) <EOL> }

/**
 * Maps the `y` aesthetic to iterable of values.
 *
 * @param values the iterable containing the y-coordinate values.
 * @param name optional name for this aesthetic mapping.
 * @param parameters additional mapping parameters.
 * @return a [PositionalMapping] object representing the mapping.
 */


public fun < T > y ( values : DataColumn < T > , parameters : LetsPlotPositionalMappingParametersContinuous < T > . ( ) -> Unit = { } ) : PositionalMapping < T >

{ <EOL> return addPositionalMapping < T > ( Y , values , LetsPlotPositionalMappingParametersContinuous < T > ( ) . apply ( parameters ) ) <EOL> }

/**
 * Maps the `y` aesthetic to a data column.
 *
 * @param values the data column to map to the y-coordinate.
 * @param parameters additional mapping parameters.
 * @return a [PositionalMapping] object representing the mapping.
 */


public fun y ( parameters : AxisParametersWithSetter . ( ) -> Unit = { } )

{ <EOL> y . apply ( parameters ) <EOL> }

/**
 * Applies configurations to y-axis parameters.
 *
 * @param parameters the configurations to apply to the y-axis parameters.
 */


@ OptIn ( ExperimentalMaterialApi :: class ) <EOL> @ Composable <EOL> fun JetsnackScaffold ( modifier : Modifier = Modifier , scaffoldState : ScaffoldState = rememberScaffoldState ( ) , topBar : @ Composable ( ( ) -> Unit ) = { } , bottomBar : @ Composable ( ( ) -> Unit ) = { } , snackbarHost : @ Composable ( SnackbarHostState ) -> Unit = { SnackbarHost ( it ) } , floatingActionButton : @ Composable ( ( ) -> Unit ) = { } , floatingActionButtonPosition : FabPosition = FabPosition . End , isFloatingActionButtonDocked : Boolean = false , drawerContent : @ Composable ( ColumnScope . ( ) -> Unit ) ? = null , drawerShape : Shape = MaterialTheme . shapes . large , drawerElevation : Dp = DrawerDefaults . Elevation , drawerBackgroundColor : Color = JetsnackTheme . colors . uiBackground , drawerContentColor : Color = JetsnackTheme . colors . textSecondary , drawerScrimColor : Color = JetsnackTheme . colors . uiBorder , backgroundColor : Color = JetsnackTheme . colors . uiBackground , contentColor : Color = JetsnackTheme . colors . textSecondary , content : @ Composable ( PaddingValues ) -> Unit )

{ <EOL> Scaffold ( modifier = modifier , scaffoldState = scaffoldState , topBar = topBar , bottomBar = bottomBar , snackbarHost = snackbarHost , floatingActionButton = floatingActionButton , floatingActionButtonPosition = floatingActionButtonPosition , isFloatingActionButtonDocked = isFloatingActionButtonDocked , drawerContent = drawerContent , drawerShape = drawerShape , drawerElevation = drawerElevation , drawerBackgroundColor = drawerBackgroundColor , drawerContentColor = drawerContentColor , drawerScrimColor = drawerScrimColor , backgroundColor = backgroundColor , contentColor = contentColor , content = content ) <EOL> }

/**
 * Wrap Material [androidx.compose.material.Scaffold] and set [JetsnackTheme] colors.
 */


@ SinceKotlin ( "<STR_LIT:1.8>" ) <EOL> @ ExperimentalEncodingApi <EOL> public fun InputStream . decodingWith ( base64 : Base64 ) : InputStream

{ <EOL> return DecodeInputStream ( this , base64 ) <EOL> }

/**
 * Returns an input stream that decodes symbols from this input stream using the specified [base64] encoding.
 *
 * Reading from the returned input stream leads to reading some symbols from the underlying input stream.
 * The symbols are decoded using the specified [base64] encoding and the resulting bytes are returned.
 * Symbols are decoded in 4-symbol blocks.
 *
 * The symbols for decoding are not required to be padded.
 * However, if there is a padding character present, the correct amount of padding character(s) must be present.
 * The padding character `'='` is interpreted as the end of the symbol stream. Subsequent symbols are not read even if
 * the end of the underlying input stream is not reached.
 *
 * The returned input stream should be closed in a timely manner. We suggest you try the [use] function,
 * which closes the resource after a given block of code is executed.
 * The close operation discards leftover bytes.
 * Closing the returned input stream will close the underlying input stream.
 */


@ SinceKotlin ( "<STR_LIT:1.8>" ) <EOL> @ ExperimentalEncodingApi <EOL> public fun OutputStream . encodingWith ( base64 : Base64 ) : OutputStream

{ <EOL> return EncodeOutputStream ( this , base64 ) <EOL> }

/**
 * Returns an output stream that encodes bytes using the specified [base64] encoding
 * and writes the result to this output stream.
 *
 * The byte data written to the returned output stream is encoded using the specified [base64] encoding
 * and the resulting symbols are written to the underlying output stream.
 * Bytes are encoded in 3-byte blocks.
 *
 * The returned output stream should be closed in a timely manner. We suggest you try the [use] function,
 * which closes the resource after a given block of code is executed.
 * The close operation writes properly padded leftover symbols to the underlying output stream.
 * Closing the returned output stream will close the underlying output stream.
 */


private fun SimpleFunctionDescriptor . shouldBeVisibleAsOverrideOfBuiltInWithErasedValueParameters ( ) : Boolean

{ <EOL> if ( ! name . sameAsBuiltinMethodWithErasedValueParameters ) return false <EOL> val candidatesToOverride = <EOL> getFunctionsFromSupertypes ( name ) . mapNotNull { <EOL> BuiltinMethodsWithSpecialGenericSignature . getOverriddenBuiltinFunctionWithErasedValueParametersInJava ( it ) <EOL> } <EOL> return candidatesToOverride . any { candidate -> <EOL> hasSameJvmDescriptorButDoesNotOverride ( candidate ) <EOL> } <EOL> }

/**
 * Checks if function is a valid override of JDK analogue of built-in method with erased value parameters (e.g. Map.containsKey(k: K))
 *
 * Examples:
 * - boolean containsKey(Object key) -> true
 * - boolean containsKey(K key) -> false // Wrong JDK method override, while it's a valid Kotlin built-in override
 */


private fun KtSourceElement . isSourceForCompoundAccess ( fir : FirElement ) : Boolean

{ <EOL> val psi = psi <EOL> val parentPsi = psi ? . parent <EOL> if ( kind !is KtFakeSourceElementKind . DesugaredAugmentedAssign && kind !is KtFakeSourceElementKind . DesugaredIncrementOrDecrement ) { <EOL> return false <EOL> } <EOL> return when { <EOL> psi is KtBinaryExpression || psi is KtUnaryExpression -> fir . isWriteInCompoundCall ( ) <EOL> parentPsi is KtBinaryExpression && psi == parentPsi . left -> fir . isReadInCompoundCall ( ) <EOL> parentPsi is KtUnaryExpression && psi == parentPsi . baseExpression -> fir . isReadInCompoundCall ( ) <EOL> else -> false <EOL> } <EOL> }

/**
 * FIR represents compound assignment and inc/dec operations as multiple smaller instructions. Here we choose the write operation as the
 * resolved FirElement for binary and unary expressions. For example, the `FirVariableAssignment` or the call to `set` or `plusAssign`
 * function, etc. This is because the write FirElement can be used to retrieve all other information related to this compound operation.

 * On the other hand, if the PSI is the left operand of an assignment or the base expression of a unary expression, we take the read FIR
 * element so the user of the Analysis API is able to retrieve such read calls reliably.
 */


private fun FirElement . getFallbackCompoundCalleeName ( ) : Name ?

{ <EOL> val psi = source . psi as? KtOperationExpression ? : return null <EOL> val operationReference = psi . operationReference <EOL> return operationReference . getAssignmentOperationName ( ) ? : operationReference . getReferencedNameAsName ( ) <EOL> }

/**
 * If the callee reference is not a [FirResolvedNamedReference], we can get the compound callee name from the source instead. For
 * example, if the callee reference is a [FirErrorNamedReference] with an unresolved name `plusAssign`, the operation element type from
 * the source will be `KtTokens.PLUSEQ`, which can be transformed to `plusAssign`.
 */


fun applyHierarchyTemplate ( template : KotlinHierarchyTemplate )

/**
 * Applies a given [template] to the project.
 *
 * *Examples:*
 *
 * - Manually apply the default hierarchy
 * (See `KotlinMultiplatformExtension.applyDefaultHierarchyTemplate`):
 * ```kotlin
 * kotlin {
 * applyHierarchyTemplate(KotlinHierarchyTemplate.default)
 * iosX64()
 * iosArm64()
 * iosSimulatorArm64()
 * linuxX64()
 * // ...
 * }
 * ```
 */


@ ExperimentalKotlinGradlePluginApi <EOL> fun applyHierarchyTemplate ( template : KotlinHierarchyTemplate , extension : KotlinHierarchyBuilder . Root . ( ) -> Unit )

/**
 * Similar to [applyHierarchyTemplate], but allows extension of the provided template.
 *
 * *Examples:*
 *
 * - Add custom groups (Experimental) to additionally share code between Linux and Apple (unixLike):
 *
 * ```kotlin
 * kotlin {
 * applyHierarchyTemplate(KotlinHierarchyTemplate.default) {
 * group("native") { // <- we can re-declare already existing groups and connect children to it!
 * group("unixLike") {
 * withLinux()
 * withApple()
 * }
 * }
 * }
 * }
 * ```
 */


@ ExperimentalKotlinGradlePluginApi <EOL> fun applyHierarchyTemplate ( template : KotlinHierarchyBuilder . Root . ( ) -> Unit )

/**
 * Allows creating a fully custom hierarchy (no defaults applied).
 *
 * **Note: ** Using the custom hierarchy requires setting the edges to 'commonMain' and 'commonTest' SourceSets by
 * using the `common` group.
 *
 * *Examples:*
 *
 * - Share code between iOS and JVM targets:
 * ```kotlin
 * applyHierarchyTemplate {
 * common {
 * withJvm()
 * group("ios") {
 * withIos()
 * }
 * }
 * }
 * ```
 *
 * This configuration creates two [KotlinSourceSetTree] using the 'common' and 'ios' groups,
 * applied on the "test" and "main" compilations.
 * When the following targets are specified:
 * - jvm()
 * - iosX64()
 * - iosArm64()
 * ```
 * "main" "test"
 * commonMain commonTest
 * | |
 * | |
 * +----------+----------+ +----------+----------+
 * | | | |
 * iosMain jvmMain iosTest jvmTest
 * | |
 * +----+-----+ +----+-----+
 * | | | |
 * iosX64Main iosArm64Main iosX64Test iosArm64Test
 * ```
 *
 * - Create a 'diamond structure'
 * ```kotlin
 * applyHierarchyTemplate {
 * common {
 * group("ios") {
 * withIos()
 * }
 *
 * group("frontend") {
 * withJvm()
 * group("ios") // <- ! We can again reference the 'ios' group
 * }
 *
 * group("apple") {
 * withMacos()
 * group("ios") // <- ! We can again reference the 'ios' group
 * }
 * }
 * }
 * ```
 *
 * In this case, the _group_ "ios" can be created with 'group("ios")' and later referenced with the same construction to build
 * the tree.
 * Apply the descriptor from the example to the following targets:
 * - iosX64()
 * - iosArm64()
 * - macosX64()
 * - jvm()
 *
 * To create the following 'main' KotlinSourceSetTree:
 *
 * ```
 * commonMain
 * |
 * +------------+----------+
 * | |
 * frontendMain appleMain
 * | |
 * +---------+------------+-----------+----------+
 * | | |
 * jvmMain iosMain macosX64Main
 * |
 * |
 * +----+----+
 * | |
 * iosX64Main iosArm64Main
 * ```
 */


public fun ClassName . isLocalClassName ( ) : Boolean

= this . startsWith ( "<STR_LIT:.>" )

/**
 * Checks whether a class name [this] represents a local class or an anonymous object.
 *
 * A class name represents a local class or an anonymous object if it starts with '.' (dot).
 */


@ ExperimentalMainFunctionArgumentsDsl <EOL> fun passAsArgumentToMainFunction ( jsExpression : String )

/**
 * The function accepts [jsExpression] and puts this expression as the "args: Array<String>" argument in place of main-function call
 */


@ Test <EOL> fun `launch in EvaluateBuildscript` ( )

{ <EOL> val project = buildProject ( ) <EOL> project . startKotlinPluginLifecycle ( ) <EOL> var executed = false <EOL> project . launch { <EOL> executed = true <EOL> } <EOL> assertTrue ( executed , "<STR_LIT>" ) <EOL> }

/**
 * Launching in 'EvaluateBuildscript' will execute the launched code right away!
 * This code will showcase that launching before any 'afterEvaluate' listeners have been invoked is possible.
 * However, the launched coroutines can be executed right away.
 */


@ Test <EOL> fun `launchInStage AfterEvaluate` ( )

{ <EOL> val project = buildProject ( ) <EOL> project . startKotlinPluginLifecycle ( ) <EOL> var executed = false <EOL> project . launchInStage ( AfterEvaluateBuildscript ) { <EOL> executed = true <EOL> } <EOL> assertFalse ( executed , "<STR_LIT>" ) <EOL> project . evaluate ( ) <EOL> assertTrue ( executed , "<STR_LIT>" ) <EOL> }

/**
 * Launching in code 'AfterEvaluateBuildscript' Stage:
 * This sample shows how code can be deferred into a 'afterEvaluate' based Stage.
 * Using [launchInStage]: This code will only be executed once the stage will be reached.
 */


@ Test <EOL> fun `launchInStage FinaliseDsl` ( )

{ <EOL> val project = buildProject ( ) <EOL> project . startKotlinPluginLifecycle ( ) <EOL> project . launchInStage ( FinaliseDsl ) { <EOL> assertEquals ( FinaliseDsl , project . kotlinPluginLifecycle . stage ) <EOL> } <EOL> project . evaluate ( ) <EOL> }

/**
 * Similar to [launchInStage AfterEvaluate], but shows launching in a later stage ([FinaliseDsl]).
 * Showcases that [launchInStage] will only execute the code once the respective Stage was reached.
 */


@ Test <EOL> fun `await FinaliseDsl Stage in coroutine` ( )

{ <EOL> val project = buildProject ( ) <EOL> project . startKotlinPluginLifecycle ( ) <EOL> project . launch { <EOL> assertEquals ( KotlinPluginLifecycle . Stage . EvaluateBuildscript , project . kotlinPluginLifecycle . stage ) <EOL> FinaliseDsl . await ( ) <EOL> assertEquals ( KotlinPluginLifecycle . Stage . FinaliseDsl , project . kotlinPluginLifecycle . stage ) <EOL> } <EOL> project . evaluate ( ) <EOL> }

/**
 * Shows how a stage like [FinaliseDsl] can be awaited using [await]:
 * A coroutine using [await] will suspend the execution until this [KotlinPluginLifecycle.Stage] was reached.
 * Note: The semantics is 'the stage was reached' **not** 'the stage was completed'
 */


@ Test <EOL> fun `exception thrown in buildscript evaluation - inside coroutine` ( )

{ <EOL> val project = buildProjectWithMPP ( ) <EOL> val executed = mutableListOf < String > ( ) <EOL> assertFailsWith < TestException > { <EOL> project . launch { <EOL> executed . add ( "<STR_LIT:first>" ) <EOL> } <EOL> project . launch { <EOL> executed . add ( "<STR_LIT:second>" ) <EOL> throw TestException ( ) <EOL> } <EOL> project . launch { <EOL> executed . add ( "<STR_LIT>" ) <EOL> } <EOL> } <EOL> assertEquals ( listOf ( "<STR_LIT:first>" , "<STR_LIT:second>" ) , executed ) <EOL> run { <EOL> assertNotNull ( project . future { KotlinPluginLifecycle . Stage . EvaluateBuildscript . await ( ) } . getOrThrow ( ) ) <EOL> assertFailsWith < IllegalLifecycleException > { <EOL> project . future { KotlinPluginLifecycle . Stage . AfterEvaluateBuildscript . await ( ) } . getOrThrow ( ) <EOL> } <EOL> } <EOL> }

/**
 * Showcase of error handling when there was an error thrown within the build.gradle.kts file (or in any plugin.apply())
 * Example would be:
 *
 * build.gradle.kts
 * ```kotlin
 * kotlin {
 * sourceSets.getByName("nonExistentSourceSet") // <- throws UnknownDomainObjectException
 * }
 * ```
 */


@ Test <EOL> fun `exception thrown in buildscript evaluation - inside user buildscript` ( )

{ <EOL> val project = buildProjectWithMPP ( ) <EOL> val executed = mutableListOf < String > ( ) <EOL> project . launchInStage ( AfterEvaluateBuildscript ) { <EOL> executed . add ( "<STR_LIT>" ) <EOL> } <EOL> project . launchInStage ( ReadyForExecution ) { <EOL> executed . add ( "<STR_LIT>" ) <EOL> } <EOL> project . tasks . whenObjectAdded { throw TestException ( ) } <EOL> assertFails { project . evaluate ( ) } <EOL> run { <EOL> assertEquals ( EvaluateBuildscript , project . kotlinPluginLifecycle . stage ) <EOL> assertEquals ( emptyList ( ) , executed ) <EOL> val result = project . configurationResult . getOrThrow ( ) <EOL> assertIsInstance < ProjectConfigurationResult . Failure > ( result ) <EOL> project . future { project . configurationResult . await ( ) } . getOrThrow ( ) <EOL> } <EOL> }

/**
 * Demonstrates how coroutines will behave if any exception is thrown within the buildscript of the user.
 * Such an exception would be:
 * ```kotlin
 * kotlin {
 * sourceSets.getByName("notExistingSourceSet") // <- throws UnknownDomainObjectException
 * }
 * ``
 *
 * In this case, all coroutines scheduled for later execution *will not be executed*
 */


@ Test <EOL> fun `exception thrown in buildscript evaluation - coroutines waiting for configurationResult` ( )

{ <EOL> val project = buildProjectWithMPP ( ) <EOL> val executed = mutableListOf < String > ( ) <EOL> project . launch { <EOL> project . configurationResult . await ( ) <EOL> executed . add ( "<STR_LIT>" ) <EOL> } <EOL> project . launch { <EOL> FinaliseDsl . await ( ) <EOL> project . configurationResult . await ( ) <EOL> executed . add ( "<STR_LIT>" ) <EOL> } <EOL> project . launchInStage ( AfterEvaluateBuildscript ) { <EOL> executed . add ( "<STR_LIT>" ) <EOL> } <EOL> project . tasks . whenObjectAdded { throw TestException ( ) } <EOL> assertFails { project . evaluate ( ) } <EOL> assertEquals ( EvaluateBuildscript , project . kotlinPluginLifecycle . stage ) <EOL> assertEquals ( listOf ( "<STR_LIT>" ) , executed ) <EOL> }

/**
 * Showcases how coroutines will behave if there is an exception thrown within the buildscript of the user.
 * In particular this sample shows how calls to `project.configurationResult` will be handled!
 *
 * In short: All coroutines that already suspended, waiting for the configurationResult will be unsuspended.
 * Like in [exception thrown in buildscript evaluation - inside user buildscript]:
 * Coroutines that ware waiting for later 'Stages' will not be executed (as their requirements are unmet)
 */


@ Test <EOL> fun `exception thrown in AfterEvaluateBuildscript` ( )

{ <EOL> val project = buildProjectWithMPP ( ) <EOL> val executed = mutableListOf < String > ( ) <EOL> project . launchInStage ( AfterEvaluateBuildscript ) { <EOL> executed . add ( "<STR_LIT>" ) <EOL> } <EOL> project . launchInStage ( AfterEvaluateBuildscript ) { <EOL> executed . add ( "<STR_LIT>" ) <EOL> throw TestException ( ) <EOL> } <EOL> project . launchInStage ( AfterEvaluateBuildscript ) { <EOL> executed . add ( "<STR_LIT>" ) <EOL> } <EOL> project . launchInStage ( ReadyForExecution ) { <EOL> executed . add ( "<STR_LIT>" ) <EOL> } <EOL> assertFails { project . evaluate ( ) } <EOL> run { <EOL> assertEquals ( AfterEvaluateBuildscript , project . kotlinPluginLifecycle . stage ) <EOL> assertEquals ( listOf ( "<STR_LIT>" , "<STR_LIT>" ) , executed ) <EOL> assertIsInstance < ProjectConfigurationResult . Failure > ( project . configurationResult . getOrThrow ( ) ) <EOL> } <EOL> run { <EOL> assertNotNull ( project . future { KotlinPluginLifecycle . Stage . EvaluateBuildscript . await ( ) } . getOrThrow ( ) ) <EOL> assertNotNull ( project . future { KotlinPluginLifecycle . Stage . AfterEvaluateBuildscript . await ( ) } . getOrThrow ( ) ) <EOL> assertFailsWith < IllegalLifecycleException > { <EOL> project . future { KotlinPluginLifecycle . Stage . ReadyForExecution . await ( ) } . getOrThrow ( ) <EOL> } <EOL> } <EOL> }

/**
 * Sample showcases how an exception thrown within a stage like [AfterEvaluateBuildscript] is handled:
 * All coroutines scheduled after the throwing coroutine will not be executed!
 * Coroutines already waiting for the projects configuration result will be unsuspended.
 *
 * Coroutines launched *after* the failure state has reached will be launched w/o suspensions.
 */


@ Test <EOL> fun `awaiting Project configurationResult` ( )

{ <EOL> val project = buildProjectWithMPP ( ) <EOL> project . launch { <EOL> assertEquals ( EvaluateBuildscript , project . kotlinPluginLifecycle . stage ) <EOL> val result = project . configurationResult . await ( ) <EOL> assertIsInstance < ProjectConfigurationResult . Success > ( result ) <EOL> assertEquals ( ReadyForExecution , project . kotlinPluginLifecycle . stage ) <EOL> } <EOL> project . evaluate ( ) <EOL> }

/**
 * Sample showcasing how one can wait for the finished project configurationResult when no exception is reached.
 * Just simply awaiting the future is enough here!
 * In happy case the stage will be [ReadyForExecution]
 */


@ Test <EOL> fun `awaiting Project configurationResult - with error thrown in FinaliseDsl` ( )

{ <EOL> val project = buildProjectWithMPP ( ) <EOL> val executed = mutableListOf < String > ( ) <EOL> project . launch { <EOL> executed . add ( "<STR_LIT>" ) <EOL> val result = project . configurationResult . await ( ) <EOL> assertIsInstance < ProjectConfigurationResult . Failure > ( result ) <EOL> executed . add ( "<STR_LIT>" ) <EOL> } <EOL> project . launchInStage ( FinaliseDsl ) { <EOL> executed . add ( "<STR_LIT>" ) <EOL> val result = project . configurationResult . await ( ) <EOL> assertIsInstance < ProjectConfigurationResult . Failure > ( result ) <EOL> executed . add ( "<STR_LIT>" ) <EOL> } <EOL> project . launchInStage ( FinaliseDsl ) { <EOL> executed . add ( "<STR_LIT>" ) <EOL> throw TestException ( ) <EOL> } <EOL> project . launchInStage ( FinaliseDsl ) { <EOL> executed . add ( "<STR_LIT>" ) <EOL> } <EOL> assertFails { project . evaluate ( ) } <EOL> assertEquals ( listOf ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , executed ) <EOL> }

/**
 * Showcases how coroutines will be treated if there are waiting for [configurationResult], but
 * an exception is thrown in a intermediate [KotlinPluginLifecycle.Stage]
 *
 * Coroutines that already suspended, waiting for the result will be unsuspended.
 * Coroutines that are in the queue when the exception is thrown will not be executed anymore.
 */


internal fun IrExpression . insertSpecialCast ( expression : FirExpression , valueType : ConeKotlinType , expectedType : ConeKotlinType , ) : IrExpression

{ <EOL> if ( this is IrTypeOperatorCall ) { <EOL> return this <EOL> } <EOL> if ( this is IrContainerExpression ) { <EOL> insertImplicitCasts ( coerceLastExpressionToUnit = type . isUnit ( ) ) <EOL> } <EOL> val expandedValueType = valueType . fullyExpandedType ( session ) <EOL> val expandedExpectedType = expectedType . fullyExpandedType ( session ) <EOL> return when { <EOL> expandedExpectedType . isUnit -> { <EOL> coerceToUnitIfNeeded ( this , irBuiltIns ) <EOL> } <EOL> expandedValueType is ConeDynamicType -> { <EOL> if ( expandedExpectedType !is ConeDynamicType && ! expandedExpectedType . isNullableAny ) { <EOL> implicitCast ( this , expandedExpectedType . toIrType ( c , ConversionTypeOrigin . DEFAULT ) ) <EOL> } else { <EOL> this <EOL> } <EOL> } <EOL> typeCanBeEnhancedOrFlexibleNullable ( expandedValueType , session ) && ! expandedExpectedType . acceptsNullValues ( ) -> { <EOL> insertImplicitNotNullCastIfNeeded ( expression ) <EOL> } <EOL> else -> this <EOL> } <EOL> }

/**
 * This functions processes the following casts:
 * - coercion to Unit
 * - nullability casts based on nullability annotations
 * - casts for dynamic types
 */


@ ExperimentalCoroutinesApi <EOL> @ Suppress ( "<STR_LIT>" ) <EOL> public fun < R > SelectBuilder < R > . onTimeout ( timeMillis : Long , block : suspend ( ) -> R ) : Unit

= <EOL> OnTimeout ( timeMillis ) . selectClause . invoke ( block )

/**
 * Clause that selects the given [block] after a specified timeout passes.
 * If timeout is negative or zero, [block] is selected immediately.
 *
 * **Note: This is an experimental api.** It may be replaced with light-weight timer/timeout channels in the future.
 *
 * @param timeMillis timeout time in milliseconds.
 */


@ ExperimentalCoroutinesApi <EOL> public fun < R > SelectBuilder < R > . onTimeout ( timeout : Duration , block : suspend ( ) -> R ) : Unit

= <EOL> onTimeout ( timeout . toDelayMillis ( ) , block )

/**
 * Clause that selects the given [block] after the specified [timeout] passes.
 * If timeout is negative or zero, [block] is selected immediately.
 *
 * **Note: This is an experimental api.** It may be replaced with light-weight timer/timeout channels in the future.
 */


private fun < T > NamedDomainObjectContainer < T > . getOrCreate ( name : String , action : Action < in T > ) : T

= try { <EOL> this . create ( name , action ) <EOL> } catch ( e : InvalidUserDataException ) { <EOL> this . getByName ( name ) <EOL> }

/**
 * Adds new object named [name] and configure it with [action] or return already existing object with this name.
 *
 * Similar to [NamedDomainObjectContainer.maybeCreate] but with [action] argument that will be applied only if
 * an object is being created.
 */


fun onlyIf ( spec : Spec < in KonanTarget > )

{ <EOL> this . onlyIf . add ( spec ) <EOL> }

/**
 * Builds this source set only if [spec] is satisfied.
 */


fun main ( action : Action < in SourceSet > ) : SourceSet

= create ( MAIN_SOURCE_SET_NAME ) { <EOL> this . inputFiles . include ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> this . inputFiles . exclude ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) <EOL> compileTask . configure { <EOL> this . group = BUILD_TASK_GROUP <EOL> } <EOL> task . configure { <EOL> this . group = BUILD_TASK_GROUP <EOL> } <EOL> action . execute ( this ) <EOL> }

/**
 * Configure `main` source set. Used for main module sources. Included into `compileBitcodeMainElements` configuration.
 */


fun testFixtures ( action : Action < in SourceSet > ) : SourceSet

= create ( TEST_FIXTURES_SOURCE_SET_NAME ) { <EOL> this . inputFiles . include ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> this . headersDirs . from ( googleTestExtension . headersDirs ) <EOL> dependencies . add ( project . tasks . named ( "<STR_LIT>" ) ) <EOL> compileTask . configure { <EOL> this . group = VERIFICATION_BUILD_TASK_GROUP <EOL> } <EOL> task . configure { <EOL> this . group = VERIFICATION_BUILD_TASK_GROUP <EOL> } <EOL> action . execute ( this ) <EOL> }

/**
 * Configure `testFixtures` source set. Used for testing API parts of module. Included into `compileBitcodeTestFixturesElements` configuration.
 */


fun test ( action : Action < in SourceSet > ) : SourceSet

= create ( TEST_SOURCE_SET_NAME ) { <EOL> this . inputFiles . include ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> this . headersDirs . from ( googleTestExtension . headersDirs ) <EOL> dependencies . add ( project . tasks . named ( "<STR_LIT>" ) ) <EOL> compileTask . configure { <EOL> this . group = VERIFICATION_BUILD_TASK_GROUP <EOL> } <EOL> task . configure { <EOL> this . group = VERIFICATION_BUILD_TASK_GROUP <EOL> } <EOL> action . execute ( this ) <EOL> }

/**
 * Configure `test` source set. Used for test files of module. Included into `compileBitcodeTestElements` configuration.
 */


fun sourceSets ( action : Action < in SourceSets > )

= sourceSets . apply { <EOL> action . execute ( this ) <EOL> }


public fun detectLandmarks ( image : I ) : List < Landmark >

= predict ( image )

/**
 * Detects [Landmark] objects on the given [image].
 */


public fun KtWhenExpression . getMissingCases ( ) : List < WhenMissingCase >

= <EOL> withValidityAssertion { analysisSession . expressionInfoProvider . getWhenMissingCases ( this ) }

/**
 * Returns cases missing from the branches of [KtWhenExpression].
 *
 * The missing cases of the when-expression in the following example are Direction.WEST and Direction.EAST:
 *
 * enum class Direction {
 * NORTH, SOUTH, WEST, EAST
 * }
 * foo = when(direction) {
 * Direction.NORTH -> 1
 * Direction.SOUTH -> 2
 * else -> 3
 * }
 *
 * If when-expression has no subject, then else-branch would be reported as missing even if it is explicitly present:
 *
 * fun test() {
 * when {
 * true -> {}
 * else -> {}
 * }
 * }
 *
 * Note that this function returns the same missing cases regardless of the existence of the else branch.
 * If you have to assume that it does not have the missing cases when it has an else branch,
 * you need a separate check whether it has an else branch or not.
 */


public fun KtExpression . isUsedAsExpression ( ) : Boolean

= <EOL> withValidityAssertion { analysisSession . expressionInfoProvider . isUsedAsExpression ( this ) }

/**
 * Compute if the value of a given expression is possibly used. Or,
 * conversely, compute whether the value of an expression is *not* safe to
 * discard.
 *
 * E.g. `x` in the following examples *are* used (`x.isUsedAsExpression() == true`)
 * - `if (x) { ... } else { ... }`
 * - `val a = x`
 * - `x + 8`
 * - `when (x) { 1 -> ...; else -> ... }
 *
 * E.g. `x` in the following example is definitely *not* used (`x.isUsedAsExpression() == false`)
 * - `run { x; println(50) }`
 * - `when (x) { else -> ... }`
 *
 * **Note!** This is a conservative check, not a control-flow analysis.
 * E.g. `x` in the following example *is possibly used*, even though the
 * value is never consumed at runtime.
 * - `x + try { throw Exception() } finally { return }`
 *
 */


= <EOL> throw UnsupportedOperationException ( "<STR_LIT>" )

/**
 * **GENERAL NOTE**
 *
 * These deprecations are added to improve user experience when they will start to
 * search for their favourite operators and/or patterns that are missing or renamed in Flow.
 * Deprecated functions also are moved here when they renamed. The difference is that they have
 * a body with their implementation while pure stubs have [noImpl].
 */


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . ERROR ) <EOL> public fun < T > Flow < T > . observeOn ( context : CoroutineContext ) : Flow < T >

= noImpl ( )

/**
 * `observeOn` has no direct match in [Flow] API because all terminal flow operators are suspending and
 * thus use the context of the caller.
 *
 * For example, the following code:
 * ```
 * flowable
 * .observeOn(Schedulers.io())
 * .doOnEach { value -> println("Received $value") }
 * .subscribe()
 * ```
 *
 * has the following Flow equivalent:
 * ```
 * withContext(Dispatchers.IO) {
 * flow.collect { value -> println("Received $value") }
 * }
 *
 * ```
 * @suppress
 */


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . ERROR ) <EOL> public fun < T > Flow < T > . publishOn ( context : CoroutineContext ) : Flow < T >

= noImpl ( )

/**
 * `publishOn` has no direct match in [Flow] API because all terminal flow operators are suspending and
 * thus use the context of the caller.
 *
 * For example, the following code:
 * ```
 * flux
 * .publishOn(Schedulers.io())
 * .doOnEach { value -> println("Received $value") }
 * .subscribe()
 * ```
 *
 * has the following Flow equivalent:
 * ```
 * withContext(Dispatchers.IO) {
 * flow.collect { value -> println("Received $value") }
 * }
 *
 * ```
 * @suppress
 */


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . ERROR ) <EOL> public fun < T > Flow < T > . subscribeOn ( context : CoroutineContext ) : Flow < T >

= noImpl ( )

/**
 * `subscribeOn` has no direct match in [Flow] API because [Flow] preserves its context and does not leak it.
 *
 * For example, the following code:
 * ```
 * flowable
 * .map { value -> println("Doing map in IO"); value }
 * .subscribeOn(Schedulers.io())
 * .observeOn(Schedulers.computation())
 * .doOnEach { value -> println("Processing $value in computation")
 * .subscribe()
 * ```
 * has the following Flow equivalent:
 * ```
 * withContext(Dispatchers.Default) {
 * flow
 * .map { value -> println("Doing map in IO"); value }
 * .flowOn(Dispatchers.IO) // Works upstream, doesn't change downstream
 * .collect { value ->
 * println("Processing $value in computation")
 * }
 * }
 * ```
 * Opposed to subscribeOn, it it **possible** to use multiple `flowOn` operators in the one flow
 * @suppress
 */


@ Deprecated ( level = DeprecationLevel . ERROR , message = "<STR_LIT>" , replaceWith = ReplaceWith ( "<STR_LIT>" ) ) <EOL> public fun < T > Flow < T > . onErrorResume ( fallback : Flow < T > ) : Flow < T >

= noImpl ( )

/**
 * Flow analogue of `onErrorXxx` is [catch].
 * Use `catch { emitAll(fallback) }`.
 * @suppress
 */


@ Deprecated ( level = DeprecationLevel . ERROR , message = "<STR_LIT>" , replaceWith = ReplaceWith ( "<STR_LIT>" ) ) <EOL> public fun < T > Flow < T > . onErrorResumeNext ( fallback : Flow < T > ) : Flow < T >

= noImpl ( )


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . ERROR ) <EOL> public fun < T > Flow < T > . subscribe ( ) : Unit

= noImpl ( )

/**
 * `subscribe` is Rx-specific API that has no direct match in flows.
 * One can use [launchIn] instead, for example the following:
 * ```
 * flowable
 * .observeOn(Schedulers.io())
 * .subscribe({ println("Received $it") }, { println("Exception $it happened") }, { println("Flowable is completed successfully") }
 * ```
 *
 * has the following Flow equivalent:
 * ```
 * flow
 * .onEach { value -> println("Received $value") }
 * .onCompletion { cause -> if (cause == null) println("Flow is completed successfully") }
 * .catch { cause -> println("Exception $cause happened") }
 * .flowOn(Dispatchers.IO)
 * .launchIn(myScope)
 * ```
 *
 * Note that resulting value of [launchIn] is not used because the provided scope takes care of cancellation.
 *
 * Or terminal operators like [single] can be used from suspend functions.
 * @suppress
 */


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . ERROR ) public fun < T > Flow < T > . subscribe ( onEach : suspend ( T ) -> Unit ) : Unit

= noImpl ( )

/**
 * Use [launchIn] with [onEach], [onCompletion] and [catch] operators instead.
 * @suppress
 */


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . ERROR ) public fun < T > Flow < T > . subscribe ( onEach : suspend ( T ) -> Unit , onError : suspend ( Throwable ) -> Unit ) : Unit

= noImpl ( )


@ Deprecated ( level = DeprecationLevel . ERROR , message = "<STR_LIT>" , replaceWith = ReplaceWith ( "<STR_LIT>" ) ) <EOL> public fun < T , R > Flow < T > . flatMap ( mapper : suspend ( T ) -> Flow < R > ) : Flow < R >

= noImpl ( )

/**
 * Note that this replacement is sequential (`concat`) by default.
 * For concurrent flatMap [flatMapMerge] can be used instead.
 * @suppress
 */


@ Deprecated ( level = DeprecationLevel . ERROR , message = "<STR_LIT>" , replaceWith = ReplaceWith ( "<STR_LIT>" ) ) <EOL> public fun < T , R > Flow < T > . concatMap ( mapper : ( T ) -> Flow < R > ) : Flow < R >

= noImpl ( )

/**
 * Flow analogue of `concatMap` is [flatMapConcat].
 * @suppress
 */


@ Deprecated ( level = DeprecationLevel . ERROR , message = "<STR_LIT>" , replaceWith = ReplaceWith ( "<STR_LIT>" ) ) <EOL> public fun < T > Flow < Flow < T > > . merge ( ) : Flow < T >

= noImpl ( )

/**
 * Note that this replacement is sequential (`concat`) by default.
 * For concurrent flatMap [flattenMerge] can be used instead.
 * @suppress
 */


@ Deprecated ( level = DeprecationLevel . ERROR , message = "<STR_LIT>" , replaceWith = ReplaceWith ( "<STR_LIT>" ) ) <EOL> public fun < T > Flow < Flow < T > > . flatten ( ) : Flow < T >

= noImpl ( )

/**
 * Flow analogue of `flatten` is [flattenConcat].
 * @suppress
 */


@ Deprecated ( level = DeprecationLevel . ERROR , message = "<STR_LIT>" , replaceWith = ReplaceWith ( "<STR_LIT>" ) ) <EOL> public fun < T , R > Flow < T > . compose ( transformer : Flow < T > . ( ) -> Flow < R > ) : Flow < R >

= noImpl ( )

/**
 * Kotlin has a built-in generic mechanism for making chained calls.
 * If you wish to write something like
 * ```
 * myFlow.compose(MyFlowExtensions.ignoreErrors()).collect { ... }
 * ```
 * you can replace it with
 *
 * ```
 * myFlow.let(MyFlowExtensions.ignoreErrors()).collect { ... }
 * ```
 * @suppress
 */


@ Deprecated ( level = DeprecationLevel . ERROR , message = "<STR_LIT>" , replaceWith = ReplaceWith ( "<STR_LIT>" ) ) <EOL> public fun < T > Flow < T > . skip ( count : Int ) : Flow < T >

= noImpl ( )

/**
 * Flow analogue of `skip` is [drop].
 * @suppress
 */


@ Deprecated ( level = DeprecationLevel . ERROR , message = "<STR_LIT>" , replaceWith = ReplaceWith ( "<STR_LIT>" ) ) <EOL> public fun < T > Flow < T > . forEach ( action : suspend ( value : T ) -> Unit ) : Unit

= noImpl ( )

/**
 * Flow extension to iterate over elements is [collect].
 * Foreach wasn't introduced deliberately to avoid confusion.
 * Flow is not a collection, iteration over it may be not idempotent
 * and can *launch* computations with side-effects.
 * This behaviour is not reflected in [forEach] name.
 * @suppress
 */


@ Deprecated ( level = DeprecationLevel . ERROR , message = "<STR_LIT>" , replaceWith = ReplaceWith ( "<STR_LIT>" ) ) <EOL> public fun < T , R > Flow < T > . scanFold ( initial : R , @ BuilderInference operation : suspend ( accumulator : R , value : T ) -> R ) : Flow < R >

= <EOL> noImpl ( )

/**
 * Flow has less verbose [scan] shortcut.
 * @suppress
 */


@ Deprecated ( level = DeprecationLevel . ERROR , message = "<STR_LIT>" , replaceWith = ReplaceWith ( "<STR_LIT>" ) ) <EOL> public fun < T > Flow < T > . onErrorReturn ( fallback : T ) : Flow < T >

= noImpl ( )

/**
 * Flow analogue of `onErrorXxx` is [catch].
 * Use `catch { emit(fallback) }`.
 * @suppress
 */


@ Deprecated ( level = DeprecationLevel . ERROR , message = "<STR_LIT>" , replaceWith = ReplaceWith ( "<STR_LIT>" ) ) <EOL> public fun < T > Flow < T > . onErrorReturn ( fallback : T , predicate : ( Throwable ) -> Boolean = { true } ) : Flow < T >

= <EOL> catch { e -> <EOL> if ( ! predicate ( e ) ) throw e <EOL> emit ( fallback ) <EOL> }

/**
 * Flow analogue of `onErrorXxx` is [catch].
 * Use `catch { e -> if (predicate(e)) emit(fallback) else throw e }`.
 * @suppress
 */


@ Deprecated ( level = DeprecationLevel . ERROR , message = "<STR_LIT>" , replaceWith = ReplaceWith ( "<STR_LIT>" ) ) <EOL> public fun < T > Flow < T > . startWith ( value : T ) : Flow < T >

= noImpl ( )

/**
 * Flow analogue of `startWith` is [onStart].
 * Use `onStart { emit(value) }`.
 * @suppress
 */


@ Deprecated ( level = DeprecationLevel . ERROR , message = "<STR_LIT>" , replaceWith = ReplaceWith ( "<STR_LIT>" ) ) <EOL> public fun < T > Flow < T > . startWith ( other : Flow < T > ) : Flow < T >

= noImpl ( )

/**
 * Flow analogue of `startWith` is [onStart].
 * Use `onStart { emitAll(other) }`.
 * @suppress
 */


@ Deprecated ( level = DeprecationLevel . ERROR , message = "<STR_LIT>" , replaceWith = ReplaceWith ( "<STR_LIT>" ) ) <EOL> public fun < T > Flow < T > . concatWith ( value : T ) : Flow < T >

= noImpl ( )

/**
 * Flow analogue of `concatWith` is [onCompletion].
 * Use `onCompletion { emit(value) }`.
 * @suppress
 */


@ Deprecated ( level = DeprecationLevel . ERROR , message = "<STR_LIT>" , replaceWith = ReplaceWith ( "<STR_LIT>" ) ) <EOL> public fun < T > Flow < T > . concatWith ( other : Flow < T > ) : Flow < T >

= noImpl ( )

/**
 * Flow analogue of `concatWith` is [onCompletion].
 * Use `onCompletion { if (it == null) emitAll(other) }`.
 * @suppress
 */


@ Deprecated ( level = DeprecationLevel . ERROR , message = "<STR_LIT>" , replaceWith = ReplaceWith ( "<STR_LIT>" ) ) <EOL> public fun < T1 , T2 , R > Flow < T1 > . combineLatest ( other : Flow < T2 > , transform : suspend ( T1 , T2 ) -> R ) : Flow < R >

= <EOL> combine ( this , other , transform )


@ Deprecated ( level = DeprecationLevel . ERROR , message = "<STR_LIT>" , replaceWith = ReplaceWith ( "<STR_LIT>" ) ) <EOL> public fun < T1 , T2 , T3 , R > Flow < T1 > . combineLatest ( other : Flow < T2 > , other2 : Flow < T3 > , transform : suspend ( T1 , T2 , T3 ) -> R )

= combine ( this , other , other2 , transform )


@ Deprecated ( level = DeprecationLevel . ERROR , message = "<STR_LIT>" , replaceWith = ReplaceWith ( "<STR_LIT>" ) ) <EOL> public fun < T1 , T2 , T3 , T4 , R > Flow < T1 > . combineLatest ( other : Flow < T2 > , other2 : Flow < T3 > , other3 : Flow < T4 > , transform : suspend ( T1 , T2 , T3 , T4 ) -> R )

= combine ( this , other , other2 , other3 , transform )


@ Deprecated ( level = DeprecationLevel . ERROR , message = "<STR_LIT>" , replaceWith = ReplaceWith ( "<STR_LIT>" ) ) <EOL> public fun < T1 , T2 , T3 , T4 , T5 , R > Flow < T1 > . combineLatest ( other : Flow < T2 > , other2 : Flow < T3 > , other3 : Flow < T4 > , other4 : Flow < T5 > , transform : suspend ( T1 , T2 , T3 , T4 , T5 ) -> R ) : Flow < R >

= combine ( this , other , other2 , other3 , other4 , transform )


@ Deprecated ( level = DeprecationLevel . ERROR , message = "<STR_LIT>" , replaceWith = ReplaceWith ( "<STR_LIT>" ) ) <EOL> public fun < T > Flow < T > . delayFlow ( timeMillis : Long ) : Flow < T >

= onStart { delay ( timeMillis ) }

/**
 * Delays the emission of values from this flow for the given [timeMillis].
 * Use `onStart { delay(timeMillis) }`.
 * @suppress
 */


@ Deprecated ( level = DeprecationLevel . ERROR , message = "<STR_LIT>" , replaceWith = ReplaceWith ( "<STR_LIT>" ) ) <EOL> public fun < T > Flow < T > . delayEach ( timeMillis : Long ) : Flow < T >

= onEach { delay ( timeMillis ) }

/**
 * Delays each element emitted by the given flow for the given [timeMillis].
 * Use `onEach { delay(timeMillis) }`.
 * @suppress
 */


@ Deprecated ( level = DeprecationLevel . ERROR , message = "<STR_LIT>" , replaceWith = ReplaceWith ( "<STR_LIT>" ) ) <EOL> public fun < T , R > Flow < T > . switchMap ( transform : suspend ( value : T ) -> Flow < R > ) : Flow < R >

= flatMapLatest ( transform )


@ Deprecated ( level = DeprecationLevel . ERROR , message = "<STR_LIT>" , replaceWith = ReplaceWith ( "<STR_LIT>" ) ) <EOL> public fun < T > Flow < T > . scanReduce ( operation : suspend ( accumulator : T , value : T ) -> T ) : Flow < T >

= runningReduce ( operation )


@ Deprecated ( level = DeprecationLevel . ERROR , message = "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" , replaceWith = ReplaceWith ( "<STR_LIT>" ) ) <EOL> public fun < T > Flow < T > . publish ( ) : Flow < T >

= noImpl ( )


@ Deprecated ( level = DeprecationLevel . ERROR , message = "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" , replaceWith = ReplaceWith ( "<STR_LIT>" ) ) <EOL> public fun < T > Flow < T > . publish ( bufferSize : Int ) : Flow < T >

= noImpl ( )


@ Deprecated ( level = DeprecationLevel . ERROR , message = "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" , replaceWith = ReplaceWith ( "<STR_LIT>" ) ) <EOL> public fun < T > Flow < T > . replay ( ) : Flow < T >

= noImpl ( )


@ Deprecated ( level = DeprecationLevel . ERROR , message = "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" , replaceWith = ReplaceWith ( "<STR_LIT>" ) ) <EOL> public fun < T > Flow < T > . replay ( bufferSize : Int ) : Flow < T >

= noImpl ( )


@ Deprecated ( level = DeprecationLevel . ERROR , message = "<STR_LIT>" , replaceWith = ReplaceWith ( "<STR_LIT>" ) ) <EOL> public fun < T > Flow < T > . cache ( ) : Flow < T >

= noImpl ( )


@ Composable <EOL> fun VerticalGrid ( modifier : Modifier = Modifier , columns : Int = <NUM_LIT:2> , content : @ Composable ( ) -> Unit )

{ <EOL> Layout ( content = content , modifier = modifier ) { measurables , constraints -> <EOL> val itemWidth = constraints . maxWidth / columns <EOL> val itemConstraints = constraints . copy ( minWidth = itemWidth , maxWidth = itemWidth ) <EOL> val placeables = measurables . map { it . measure ( itemConstraints ) } <EOL> val columnHeights = Array ( columns ) { <NUM_LIT:0> } <EOL> placeables . forEachIndexed { index , placeable -> <EOL> val column = index % columns <EOL> columnHeights [ column ] += placeable . height <EOL> } <EOL> val height = ( columnHeights . maxOrNull ( ) ? : constraints . minHeight ) <EOL> . coerceAtMost ( constraints . maxHeight ) <EOL> layout ( width = constraints . maxWidth , height = height ) { <EOL> val columnY = Array ( columns ) { <NUM_LIT:0> } <EOL> placeables . forEachIndexed { index , placeable -> <EOL> val column = index % columns <EOL> placeable . placeRelative ( x = column * itemWidth , y = columnY [ column ] ) <EOL> columnY [ column ] += placeable . height <EOL> } <EOL> } <EOL> } <EOL> }

/**
 * A simple grid which lays elements out vertically in evenly sized [columns].
 */


public inline operator fun < reified T > String . invoke ( ) : ColumnAccessor < T >

= <EOL> column ( this )

/**
 * Returns a new typed [ColumnReference] to the column with the receiver [String] as a name and given type.
 * The pointer name and type must be exactly the same as the name and type of the
 * column in the [DataFrame].
 *
 * @param T type of the column
 * @receiver name of the column
 */


@ Test <EOL> fun testDelayInArbitraryContext ( )

= runBlocking { <EOL> var thread : Thread ? = null <EOL> val pool = Executors . newFixedThreadPool ( <NUM_LIT:1> ) { runnable -> <EOL> Thread ( runnable ) . also { thread = it } <EOL> } <EOL> val context = CustomInterceptor ( pool ) <EOL> val c = async ( context ) { <EOL> assertEquals ( thread , Thread . currentThread ( ) ) <EOL> delay ( <NUM_LIT:100> ) <EOL> assertEquals ( thread , Thread . currentThread ( ) ) <EOL> <NUM_LIT:42> <EOL> } <EOL> assertEquals ( <NUM_LIT:42> , c . await ( ) ) <EOL> pool . shutdown ( ) <EOL> }

/**
 * Test that delay works properly in contexts with custom [ContinuationInterceptor]
 */


internal fun KtAnalysisSession . getDRIFromReceiverParameter ( receiverParameterSymbol : KtReceiverParameterSymbol ) : DRI

= <EOL> getDRIFromReceiverType ( receiverParameterSymbol . type )

/**
 * @return [DRI] to receiver type
 */


private fun KtAnalysisSession . getDRIFromLocalFunction ( symbol : KtFunctionLikeSymbol ) : DRI

{ <EOL> val containingSymbolDRI = symbol . getContainingSymbol ( ) ? . let { getDRIFromNonCallablePossibleLocalSymbol ( it ) } <EOL> ? : throw IllegalStateException ( "<STR_LIT>" ) <EOL> return containingSymbolDRI . copy ( callable = Callable ( ( symbol as? KtNamedSymbol ) ? . name ? . asString ( ) ? : "<STR_LIT>" , params = symbol . valueParameters . map { getTypeReferenceFrom ( it . returnType ) } , receiver = symbol . receiverType ? . let { <EOL> getTypeReferenceFrom ( it ) <EOL> } ) ) <EOL> }

/**
 * Currently, it's used only for functions from enum entry,
 * For its members: `memberSymbol.callableIdIfNonLocal=null`
 */


@ OptIn ( UnsafeApi :: class ) <EOL> operator fun < T > KotlinGradlePluginExtensionPoint < T > . set ( project : Project , extensions : List < T > )

{ <EOL> ( this as KotlinGradlePluginExtensionPointInternal < T > ) <EOL> set ( project , extensions ) <EOL> }

/**
 * Completely overwrites the currently registered extensions on this [KotlinGradlePluginExtensionPoint] in this project.
 */


fun IrSimpleType . argumentTypesOrUpperBounds ( ) : List < IrType >

{ <EOL> val params = this . classOrUpperBound ( ) ! ! . owner . typeParameters <EOL> return arguments . mapIndexed { index , argument -> <EOL> argument . typeOrNull ? : params [ index ] . representativeUpperBound <EOL> } <EOL> }

/**
 * Replaces star projections with representativeUpperBound of respective type parameter
 * to mimic behaviour of old FE (see StarProjectionImpl.getType())
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ LowPriorityInOverloadResolution <EOL> public fun < T : Any > KClass < T > . cast ( value : Any ? ) : T

{ <EOL> if ( ! isInstance ( value ) ) throw ClassCastException ( "<STR_LIT>" ) <EOL> return value as T <EOL> }

/**
 * Casts the given [value] to the class represented by this [KClass] object.
 * Throws an exception if the value is `null` or if it is not an instance of this class.
 *
 * This is an experimental function that behaves as a similar function from kotlin.reflect.full on JVM.
 *
 * @see [KClass.isInstance]
 * @see [KClass.safeCast]
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ LowPriorityInOverloadResolution <EOL> public fun < T : Any > KClass < T > . safeCast ( value : Any ? ) : T ?

{ <EOL> return if ( isInstance ( value ) ) value as T else null <EOL> }

/**
 * Casts the given [value] to the class represented by this [KClass] object.
 * Returns `null` if the value is `null` or if it is not an instance of this class.
 *
 * This is an experimental function that behaves as a similar function from kotlin.reflect.full on JVM.
 *
 * @see [KClass.isInstance]
 * @see [KClass.cast]
 */


{ <EOL> session . runner ( ) . addTarget ( assign ) . run ( ) <EOL> }

/**
 * Initialize the variable using the default initializer
 * @param [session] session to use
 */


public fun fill ( data : Any , session : Session )

{ <EOL> var tensorData = data <EOL> if ( data is Array < * > && data . isArrayOf < Float > ( ) ) { <EOL> tensorData = ( data as Array < Float > ) . toFloatArray ( ) <EOL> } <EOL> Tensor . create ( tensorData ) . use { tensor -> <EOL> session . runner ( ) <EOL> . feed ( initialValue , tensor ) <EOL> . addTarget ( assign ) <EOL> . run ( ) <EOL> } <EOL> }

/**
 * Fill the variable using the given data
 * @param [data] data to use, should have correct shape and type
 * @param [session] session to use
 */


{ <EOL> val uri = uri . get ( ) <EOL> val commitId = commitId . get ( ) <EOL> val gitRepoInitialized = RepositoryCache . FileKey . isGitRepository ( localRepoDir , FS . DETECTED ) <EOL> val repo = if ( gitRepoInitialized ) { <EOL> Git . open ( localRepoDir ) <EOL> } else { <EOL> fs . delete { delete ( localRepoDir ) } <EOL> Git . cloneRepository ( ) <EOL> . setProgressMonitor ( gitOperationsPrinter ) <EOL> . setNoCheckout ( true ) <EOL> . setURI ( uri ) <EOL> . setDirectory ( localRepoDir ) <EOL> . call ( ) <EOL> } <EOL> repo . use { git -> <EOL> git . checkout ( ) <EOL> . setProgressMonitor ( gitOperationsPrinter ) <EOL> . setForced ( true ) <EOL> . setName ( commitId ) <EOL> . call ( ) <EOL> git . reset ( ) <EOL> . setProgressMonitor ( gitOperationsPrinter ) <EOL> . setMode ( HARD ) <EOL> . call ( ) <EOL> git . clean ( ) <EOL> . setForce ( true ) <EOL> . setCleanDirectories ( true ) <EOL> . setIgnore ( false ) <EOL> . call ( ) <EOL> } <EOL> }

/**
 * Initialize [uri] in [localRepoDir].
 *
 * If a git repo already exists in [localRepoDir], try to re-use it.
 *
 * Any changes to tracked or untracked files will be forcibly removed.
 */


fun StubContainer . computeNamesToBeDeclared ( pkgName : String ) : List < String >

{ <EOL> fun checkPackageCorrectness ( classifier : Classifier ) { <EOL> assert ( classifier . pkg == pkgName ) { <EOL> """<STR_LIT>""" . trimMargin ( ) <EOL> } <EOL> } <EOL> val classNames = classes . mapNotNull { <EOL> when ( it ) { <EOL> is ClassStub . Simple -> it . classifier <EOL> is ClassStub . Companion -> null <EOL> is ClassStub . Enum -> it . classifier <EOL> } <EOL> } . onEach { checkPackageCorrectness ( it ) } . map { it . topLevelName } <EOL> val typealiasNames = typealiases <EOL> . onEach { checkPackageCorrectness ( it . alias ) } <EOL> . map { it . alias . topLevelName } <EOL> val namesFromNestedContainers = simpleContainers <EOL> . flatMap { it . computeNamesToBeDeclared ( pkgName ) } <EOL> return classNames + typealiasNames + namesFromNestedContainers <EOL> }

/**
 * Compute which names will be declared by [StubContainer] in the given [pkgName]
 */


{ <EOL> when { <EOL> isDirectory -> listFiles ( ) ! ! . forEach { it . deleteRecursivelyOrThrow ( ) } <EOL> isFile -> error ( "<STR_LIT>" ) <EOL> else -> error ( "<STR_LIT>" ) <EOL> } <EOL> }

/**
 * Deletes the contents of this directory (not the directory itself).
 *
 * If the directory does not exist or if this is a regular file, this method will throw an exception.
 */


{ <EOL> if ( ! deleteRecursively ( ) ) { <EOL> throw IOException ( "<STR_LIT>" ) <EOL> } <EOL> }

/** Deletes this file or directory recursively (if it exists), throwing an exception if the deletion failed. */


@ Suppress ( "<STR_LIT>" ) <EOL> fun File . createDirectory ( )

{ <EOL> when { <EOL> isDirectory -> Unit <EOL> isFile -> error ( "<STR_LIT>" ) <EOL> else -> { <EOL> if ( ! mkdirs ( ) && ! isDirectory ) { <EOL> throw IOException ( "<STR_LIT>" ) <EOL> } <EOL> } <EOL> } <EOL> }

/**
 * Creates this directory (if it does not yet exist).
 *
 * If a regular file already exists at this path, this method will throw an exception.
 */


private fun clearGroupedConstraintCaches ( )

{ <EOL> constraintsGroupedByContainedTypeVariables = null <EOL> constraintsGroupedByTypeHashCode = null <EOL> }

/**
 * Every part that modifies [constraints] should either maintain the consistences of the grouped caches above
 * or call this function.
 */


fun source ( vararg sources : Any )

/**
 * Adds input sources for this task.
 *
 * @param sources object is evaluated as per [org.gradle.api.Project.files].
 */


fun setSource ( vararg sources : Any )

/**
 * Sets input sources for this task.
 *
 * **Note**: due to [a bug](https://youtrack.jetbrains.com/issue/KT-59632/KotlinCompileTool.setSource-should-replace-existing-sources),
 * the `setSource()` function does not update already added sources.
 *
 * @param sources object is evaluated as per [org.gradle.api.Project.files].
 */


@ Internal <EOL> override fun getExcludes ( ) : MutableSet < String >

/**
 * Returns the set of exclude patterns.
 *
 * @return The exclude patterns. Returns an empty set when there are no exclude patterns.
 */


@ Internal <EOL> override fun getIncludes ( ) : MutableSet < String >

/**
 * Returns the set of include patterns.
 *
 * @return The include patterns. Returns an empty set when there are no include patterns.
 */


protected open fun resolveAllSupertypesForOuterClass ( outerClass : FirClass )

{ <EOL> resolveAllSupertypes ( outerClass , outerClass . superTypeRefs ) <EOL> }

/**
 * Resolve all super types. [outerClass] is used as an outer scope for nested class or companion
 */


fun resolveSpecificClassLikeSupertypes ( classLikeDeclaration : FirClassLikeDeclaration , supertypeRefs : List < FirTypeRef > , ) : List < FirResolvedTypeRef >

{ <EOL> return resolveSpecificClassLikeSupertypes ( classLikeDeclaration ) { transformer , scopeDeclaration -> <EOL> supertypeRefs . mapTo ( mutableListOf ( ) ) { <EOL> val superTypeRef = it . transform < FirTypeRef , ScopeClassDeclaration > ( transformer , scopeDeclaration ) <EOL> val typeParameterType = superTypeRef . coneTypeSafe < ConeTypeParameterType > ( ) <EOL> when { <EOL> typeParameterType != null -> <EOL> buildErrorTypeRef { <EOL> source = superTypeRef . source <EOL> diagnostic = ConeTypeParameterSupertype ( typeParameterType . lookupTag . typeParameterSymbol ) <EOL> } <EOL> superTypeRef !is FirResolvedTypeRef -> <EOL> createErrorTypeRef ( superTypeRef , "<STR_LIT>" , DiagnosticKind . UnresolvedSupertype ) <EOL> else -> <EOL> superTypeRef <EOL> } <EOL> } . also { <EOL> addSupertypesFromExtensions ( classLikeDeclaration , it , transformer , scopeDeclaration ) <EOL> } <EOL> } <EOL> }

/**
 * The function won't call supertypeRefs on classLikeDeclaration directly
 */


protected open fun reportLoopErrorRefs ( classLikeDeclaration : FirClassLikeDeclaration , supertypeRefs : List < FirResolvedTypeRef > )

{ <EOL> supertypeStatusMap [ classLikeDeclaration ] = SupertypeComputationStatus . Computed ( supertypeRefs ) <EOL> }

/**
 * @param supertypeRefs a collection where at least one element is [FirErrorTypeRef] for looped references
 */


protected fun breakLoopFor ( declaration : FirClassLikeDeclaration , session : FirSession , visited : MutableSet < FirClassLikeDeclaration > , looped : MutableSet < FirClassLikeDeclaration > , pathSet : MutableSet < FirClassLikeDeclaration > , path : MutableList < FirClassLikeDeclaration > , )

{ <EOL> require ( path . isEmpty ( ) ) { "<STR_LIT>" } <EOL> require ( pathSet . isEmpty ( ) ) { "<STR_LIT>" } <EOL> fun checkIsInLoop ( classLikeDeclaration : FirClassLikeDeclaration ? , wasSubtypingInvolved : Boolean , wereTypeArgumentsInvolved : Boolean , ) { <EOL> if ( classLikeDeclaration == null ) return <EOL> require ( ! wasSubtypingInvolved || ! wereTypeArgumentsInvolved ) { <EOL> "<STR_LIT>" <EOL> } <EOL> val supertypeStatus = supertypeStatusMap [ classLikeDeclaration ] <EOL> val supertypeRefs : List < FirResolvedTypeRef > = if ( supertypeStatus != null ) { <EOL> require ( supertypeStatus is SupertypeComputationStatus . Computed ) { <EOL> "<STR_LIT>" <EOL> } <EOL> supertypeStatus . supertypeRefs <EOL> } else { <EOL> getResolvedSuperTypeRefsForOutOfSessionDeclaration ( classLikeDeclaration ) ? : return <EOL> } <EOL> if ( classLikeDeclaration in visited ) { <EOL> if ( classLikeDeclaration in pathSet ) { <EOL> looped . add ( classLikeDeclaration ) <EOL> looped . addAll ( path . takeLastWhile { element -> element != classLikeDeclaration } ) <EOL> } <EOL> return <EOL> } <EOL> path . add ( classLikeDeclaration ) <EOL> pathSet . add ( classLikeDeclaration ) <EOL> visited . add ( classLikeDeclaration ) <EOL> val parentId = classLikeDeclaration . symbol . classId . relativeClassName . parent ( ) <EOL> if ( ! parentId . isRoot ) { <EOL> val parentSymbol = session . symbolProvider . getClassLikeSymbolByClassId ( ClassId . fromString ( parentId . asString ( ) ) ) <EOL> if ( parentSymbol is FirRegularClassSymbol ) { <EOL> checkIsInLoop ( parentSymbol . fir , wasSubtypingInvolved , wereTypeArgumentsInvolved ) <EOL> } <EOL> } <EOL> val isTypeAlias = classLikeDeclaration is FirTypeAlias <EOL> val isSubtypingCurrentlyInvolved = ! isTypeAlias <EOL> if ( wereTypeArgumentsInvolved && isSubtypingCurrentlyInvolved ) { <EOL> path . removeAt ( path . size - <NUM_LIT:1> ) <EOL> pathSet . remove ( classLikeDeclaration ) <EOL> return <EOL> } <EOL> val isSubtypingInvolved = wasSubtypingInvolved || isSubtypingCurrentlyInvolved <EOL> var isErrorInSupertypesFound = false <EOL> val resultSupertypeRefs = mutableListOf < FirResolvedTypeRef > ( ) <EOL> for ( supertypeRef in supertypeRefs ) { <EOL> if ( isTypeAlias ) { <EOL> for ( annotation in supertypeRef . annotations ) { <EOL> val resolvedType = annotation . resolvedType as? ConeClassLikeType ? : continue <EOL> val typeArgumentClassLikeDeclaration = resolvedType . lookupTag . toSymbol ( session ) ? . fir <EOL> checkIsInLoop ( typeArgumentClassLikeDeclaration , wasSubtypingInvolved , wereTypeArgumentsInvolved ) <EOL> } <EOL> } <EOL> val supertypeFir = supertypeRef . firClassLike ( session ) ? : supertypeRef . firClassLike ( classLikeDeclaration . moduleData . session ) <EOL> checkIsInLoop ( supertypeFir , isSubtypingInvolved , wereTypeArgumentsInvolved ) <EOL> if ( ! isSubtypingInvolved ) { <EOL> val areTypeArgumentsCurrentlyInvolved = true <EOL> fun checkTypeArgumentsRecursively ( type : ConeKotlinType , visitedTypes : MutableSet < ConeKotlinType > ) { <EOL> if ( type in visitedTypes ) return <EOL> visitedTypes += type <EOL> for ( typeArgument in type . typeArguments ) { <EOL> if ( typeArgument is ConeClassLikeType ) { <EOL> checkIsInLoop ( typeArgument . lookupTag . toSymbol ( session ) ? . fir , wasSubtypingInvolved , areTypeArgumentsCurrentlyInvolved , ) <EOL> checkTypeArgumentsRecursively ( typeArgument , visitedTypes ) <EOL> } <EOL> } <EOL> } <EOL> checkTypeArgumentsRecursively ( supertypeRef . type , mutableSetOf ( ) ) <EOL> } <EOL> resultSupertypeRefs . add ( if ( classLikeDeclaration in looped ) { <EOL> isErrorInSupertypesFound = true <EOL> createErrorTypeRef ( supertypeRef , "<STR_LIT>" , if ( isTypeAlias ) DiagnosticKind . RecursiveTypealiasExpansion else DiagnosticKind . LoopInSupertype ) <EOL> } else { <EOL> supertypeRef <EOL> } ) <EOL> } <EOL> if ( isErrorInSupertypesFound ) { <EOL> reportLoopErrorRefs ( classLikeDeclaration , resultSupertypeRefs ) <EOL> } <EOL> path . removeAt ( path . size - <NUM_LIT:1> ) <EOL> pathSet . remove ( classLikeDeclaration ) <EOL> } <EOL> checkIsInLoop ( declaration , wasSubtypingInvolved = false , wereTypeArgumentsInvolved = false ) <EOL> require ( path . isEmpty ( ) ) { "<STR_LIT>" } <EOL> }

/**
 * @param declaration declaration to be checked for loops
 * @param visited visited declarations during the current loop search
 * @param looped declarations inside loop
 */


/**
 * Function declares in JS source set
 */


/**
 * Function declared in JS source set.
 *
 * Function with the same name exists in another source set as well.
 */


= println ( "<STR_LIT:test>" )

/**
 * Extension declared in JS source set
 */


fun buildCompileList ( source : Path , outputDirectory : String , defaultModule : TestModule = TestModule . default ( ) ) : List < TestFile >

{ <EOL> val result = mutableListOf < TestFile > ( ) <EOL> val srcFile = source . toFile ( ) <EOL> val srcText = srcFile . readText ( ) . replace ( Regex ( "<STR_LIT>" ) ) { match -> match . groupValues [ <NUM_LIT:1> ] } <EOL> var supportModule : TestModule ? = if ( srcText . contains ( "<STR_LIT>" ) ) TestModule . support ( ) else null <EOL> val moduleMatcher = MODULE_PATTERN . matcher ( srcText ) <EOL> val fileMatcher = FILE_PATTERN . matcher ( srcText ) <EOL> var nextModuleExists = moduleMatcher . find ( ) <EOL> var nextFileExists = fileMatcher . find ( ) <EOL> if ( ! nextModuleExists && ! nextFileExists ) { <EOL> if ( supportModule != null ) defaultModule . dependencies . add ( supportModule . name ) <EOL> result . add ( TestFile ( srcFile . name , "<STR_LIT>" , srcText , defaultModule ) ) <EOL> } else { <EOL> var processedChars = <NUM_LIT:0> <EOL> var module : TestModule = defaultModule <EOL> while ( nextModuleExists || nextFileExists ) { <EOL> if ( nextModuleExists ) { <EOL> var moduleName = moduleMatcher . group ( <NUM_LIT:1> ) <EOL> val moduleDependencies = moduleMatcher . group ( <NUM_LIT:2> ) <EOL> val moduleFriends = moduleMatcher . group ( <NUM_LIT:3> ) <EOL> if ( moduleName != null ) { <EOL> moduleName = moduleName . trim { it <= '<CHAR_LIT:U+0020>' } <EOL> val dependencies = mutableListOf < String > ( ) . apply { <EOL> addAll ( moduleDependencies . parseModuleList ( ) . map { if ( it != "<STR_LIT>" ) "<STR_LIT>" else it } ) <EOL> } <EOL> module = TestModule ( "<STR_LIT>" , dependencies , mutableListOf < String > ( ) . apply { <EOL> addAll ( moduleFriends . parseModuleList ( ) . map { "<STR_LIT>" } ) <EOL> } ) <EOL> } <EOL> } <EOL> if ( supportModule != null && ! module . dependencies . contains ( "<STR_LIT>" ) ) { <EOL> module . dependencies . add ( "<STR_LIT>" ) <EOL> } <EOL> nextModuleExists = moduleMatcher . find ( ) <EOL> while ( nextFileExists ) { <EOL> val fileName = fileMatcher . group ( <NUM_LIT:1> ) <EOL> val filePath = "<STR_LIT>" <EOL> val start = processedChars <EOL> nextFileExists = fileMatcher . find ( ) <EOL> val end = when { <EOL> nextFileExists && nextModuleExists -> Math . min ( fileMatcher . start ( ) , moduleMatcher . start ( ) ) <EOL> nextFileExists -> fileMatcher . start ( ) <EOL> else -> srcText . length <EOL> } <EOL> val fileText = srcText . substring ( start , end ) <EOL> processedChars = end <EOL> if ( fileName . endsWith ( "<STR_LIT>" ) ) { <EOL> result . add ( TestFile ( fileName , filePath , fileText , module ) ) <EOL> } <EOL> if ( nextModuleExists && nextFileExists && fileMatcher . start ( ) > moduleMatcher . start ( ) ) break <EOL> } <EOL> } <EOL> } <EOL> return result <EOL> }

/**
 * Creates test files from the given source file that may contain different test directives.
 *
 * @return list of test files [TestFile] to be compiled
 */


{ <EOL> Paths . get ( path ) . takeUnless { text . isEmpty ( ) } ? . run { <EOL> parent . toFile ( ) <EOL> . takeUnless { it . exists ( ) } <EOL> ? . mkdirs ( ) <EOL> toFile ( ) . writeText ( text ) <EOL> } <EOL> }

/**
 * Writes [text] to the file created from the [path].
 */


@ Suppress ( "<STR_LIT:DEPRECATION>" ) <EOL> fun pathToPlatformSdk ( platformName : String ) : String

= when ( platformName . toLowerCase ( ) ) { <EOL> "<STR_LIT>" -> macosxSdk <EOL> "<STR_LIT>" -> iphoneosSdk <EOL> "<STR_LIT>" -> iphonesimulatorSdk <EOL> "<STR_LIT>" -> appletvosSdk <EOL> "<STR_LIT>" -> appletvsimulatorSdk <EOL> "<STR_LIT>" -> watchosSdk <EOL> "<STR_LIT>" -> watchsimulatorSdk <EOL> else -> error ( "<STR_LIT>" ) <EOL> }

/**
 * TODO: `toLowerCase` is deprecated and should be replaced with `lowercase`, but
 * this code used in buildSrc which depends on bootstrap version of stdlib, so right version
 * of this function isn't available, please replace warning suppression with right function
 * when compatible version of bootstrap will be available.
 */


{ <EOL> }


fun getFunctionKindPackageNames ( ) : Set < FqName >

= extractor . getFunctionKindPackageNames ( )

/**
 * Returns all package names for which [getKindByClassNamePrefix] may return a [FunctionTypeKind].
 */


= extractor . hasExtensionKinds ( )

/**
 * Whether [getKindByClassNamePrefix] may return a [FunctionTypeKind] added by a compiler plugin.
 */


public fun getClasslike ( dri : DRI , sourceSet : DokkaSourceSet ) : DClasslike ?

/**
 * Returns a valid and fully initialized [DClasslike] if the [dri] points to a class-like
 * declaration (annotation, class, enum, interface, object) that can be found among
 * [DokkaSourceSet.classpath] entries.
 *
 * If the [dri] points to a non-class-like declaration (like a function),
 * or the declaration cannot be found, it returns `null`.
 *
 * Note: the implementation is not expected to cache results or return pre-computed values, so
 * it may need to analyze parts of the project and instantiate new documentables on every invocation.
 * Use this function sparingly, and cache results on your side if you need to.
 */


internal fun TaskCollection < Test > . instrument ( koverContext : KoverContext , koverDisabled : Provider < Boolean > , current : KoverCurrentProjectVariantsConfigImpl )

{ <EOL> configureEach { <EOL> val binReportProvider = <EOL> project . layout . buildDirectory . map { dir -> <EOL> dir . file ( binReportPath ( name , koverContext . toolProvider . get ( ) . variant . vendor ) ) <EOL> } <EOL> dependsOn ( koverContext . findAgentJarTask ) <EOL> doFirst { <EOL> binReportProvider . get ( ) . asFile . delete ( ) <EOL> } <EOL> val excludedClassesWithAndroid = current . instrumentation . excludedClasses . map { it + <EOL> setOf ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) <EOL> } <EOL> val taskInstrumentationDisabled = koverDisabled . map { <EOL> if ( it ) return@map true <EOL> if ( current . instrumentation . disabledForAll . get ( ) ) return@map true <EOL> if ( name in current . instrumentation . disabledForTestTasks . get ( ) ) return@map true <EOL> return@map false <EOL> } <EOL> jvmArgumentProviders += JvmTestTaskArgumentProvider ( temporaryDir , koverContext . toolProvider , koverContext . findAgentJarTask . map { it . agentJar . get ( ) . asFile } , taskInstrumentationDisabled , excludedClassesWithAndroid , binReportProvider ) <EOL> } <EOL> }

/**
 * Add online instrumentation to all JVM test tasks.
 */


@ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ Suppress ( "<STR_LIT:DEPRECATION>" ) <EOL> public fun < T > sequence ( @ BuilderInference block : suspend SequenceScope < T > . ( ) -> Unit ) : Sequence < T >

= Sequence { iterator ( block ) }

/**
 * Builds a [Sequence] lazily yielding values one by one.
 *
 * @see kotlin.sequences.generateSequence
 *
 * @sample samples.collections.Sequences.Building.buildSequenceYieldAll
 * @sample samples.collections.Sequences.Building.buildFibonacciSequence
 */


@ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ Suppress ( "<STR_LIT:DEPRECATION>" ) <EOL> public fun < T > iterator ( @ BuilderInference block : suspend SequenceScope < T > . ( ) -> Unit ) : Iterator < T >

{ <EOL> val iterator = SequenceBuilderIterator < T > ( ) <EOL> iterator . nextStep = block . createCoroutineUnintercepted ( receiver = iterator , completion = iterator ) <EOL> return iterator <EOL> }

/**
 * Builds an [Iterator] lazily yielding values one by one.
 *
 * @sample samples.collections.Sequences.Building.buildIterator
 * @sample samples.collections.Iterables.Building.iterable
 */


public abstract suspend fun yield ( value : T )

/**
 * Yields a value to the [Iterator] being built and suspends
 * until the next value is requested.
 *
 * @sample samples.collections.Sequences.Building.buildSequenceYieldAll
 * @sample samples.collections.Sequences.Building.buildFibonacciSequence
 */


public abstract suspend fun yieldAll ( iterator : Iterator < T > )

/**
 * Yields all values from the `iterator` to the [Iterator] being built
 * and suspends until all these values are iterated and the next one is requested.
 *
 * The sequence of values returned by the given iterator can be potentially infinite.
 *
 * @sample samples.collections.Sequences.Building.buildSequenceYieldAll
 */


public suspend fun yieldAll ( elements : Iterable < T > )

{ <EOL> if ( elements is Collection && elements . isEmpty ( ) ) return <EOL> return yieldAll ( elements . iterator ( ) ) <EOL> }

/**
 * Yields a collections of values to the [Iterator] being built
 * and suspends until all these values are iterated and the next one is requested.
 *
 * @sample samples.collections.Sequences.Building.buildSequenceYieldAll
 */


public suspend fun yieldAll ( sequence : Sequence < T > ) : Unit

= yieldAll ( sequence . iterator ( ) )

/**
 * Yields potentially infinite sequence of values to the [Iterator] being built
 * and suspends until all these values are iterated and the next one is requested.
 *
 * The sequence can be potentially infinite.
 *
 * @sample samples.collections.Sequences.Building.buildSequenceYieldAll
 */


public fun labels ( zeroIndexed : Boolean = false ) : Map < Int , String >

{ <EOL> return when ( this ) { <EOL> V2014 -> if ( zeroIndexed ) toZeroIndexed ( cocoCategories2014 ) else cocoCategories2014 <EOL> V2017 -> if ( zeroIndexed ) toZeroIndexed ( cocoCategories2017 ) else cocoCategories2017 <EOL> } <EOL> }

/**
 * Returns a map of COCO labels according to the [Coco] version.
 * @param [zeroIndexed] if true, then labels are indexed from 0, otherwise from 1.
 */


private fun getCallExpressionTypeInfoWithoutFinalTypeCheck ( callExpression : KtCallExpression , receiver : Receiver ? , callOperationNode : ASTNode ? , context : ExpressionTypingContext , initialDataFlowInfoForArguments : DataFlowInfo ) : KotlinTypeInfo

{ <EOL> val call = CallMaker . makeCall ( receiver , callOperationNode , callExpression ) <EOL> val temporaryForFunction = TemporaryTraceAndCache . create ( context , "<STR_LIT>" , callExpression ) <EOL> val ( resolveResult , resolvedCall ) = getResolvedCallForFunction ( call , context . replaceTraceAndCache ( temporaryForFunction ) , CheckArgumentTypesMode . CHECK_VALUE_ARGUMENTS , initialDataFlowInfoForArguments ) <EOL> if ( resolveResult ) { <EOL> val functionDescriptor = resolvedCall ? . resultingDescriptor <EOL> temporaryForFunction . commit ( ) <EOL> if ( callExpression . valueArgumentList == null && callExpression . lambdaArguments . isEmpty ( ) ) { <EOL> val hasValueParameters = functionDescriptor == null || functionDescriptor . valueParameters . size > <NUM_LIT:0> <EOL> context . trace . report ( FUNCTION_CALL_EXPECTED . on ( callExpression , callExpression , hasValueParameters ) ) <EOL> } <EOL> if ( functionDescriptor == null ) { <EOL> return noTypeInfo ( context ) <EOL> } <EOL> if ( functionDescriptor is ConstructorDescriptor ) { <EOL> val constructedClass = functionDescriptor . constructedClass <EOL> if ( DescriptorUtils . isAnnotationClass ( constructedClass ) && ! canInstantiateAnnotationClass ( callExpression , context . trace ) ) { <EOL> val supported = context . languageVersionSettings . supportsFeature ( LanguageFeature . InstantiationOfAnnotationClasses ) <EOL> if ( ! supported ) context . trace . report ( ANNOTATION_CLASS_CONSTRUCTOR_CALL . on ( callExpression ) ) <EOL> } <EOL> if ( DescriptorUtils . isEnumClass ( constructedClass ) ) { <EOL> context . trace . report ( ENUM_CLASS_CONSTRUCTOR_CALL . on ( callExpression ) ) <EOL> } <EOL> if ( DescriptorUtils . isSealedClass ( constructedClass ) ) { <EOL> context . trace . report ( SEALED_CLASS_CONSTRUCTOR_CALL . on ( callExpression ) ) <EOL> } <EOL> } <EOL> val type = functionDescriptor . returnType <EOL> val arguments = callExpression . valueArguments <EOL> val resultFlowInfo = resolvedCall . dataFlowInfoForArguments . resultInfo <EOL> var jumpFlowInfo = resultFlowInfo <EOL> var jumpOutPossible = false <EOL> for ( argument in arguments ) { <EOL> val argTypeInfo = context . trace . get ( BindingContext . EXPRESSION_TYPE_INFO , argument . getArgumentExpression ( ) ) <EOL> if ( argTypeInfo != null && argTypeInfo . jumpOutPossible ) { <EOL> jumpOutPossible = true <EOL> jumpFlowInfo = argTypeInfo . jumpFlowInfo <EOL> break <EOL> } <EOL> } <EOL> return createTypeInfo ( type , resultFlowInfo , jumpOutPossible , jumpFlowInfo ) <EOL> } <EOL> val calleeExpression = callExpression . calleeExpression <EOL> if ( calleeExpression is KtSimpleNameExpression && callExpression . typeArgumentList == null ) { <EOL> val temporaryForVariable = TemporaryTraceAndCache . create ( context , "<STR_LIT>" , callExpression ) <EOL> val ( notNothing , type ) = getVariableType ( calleeExpression , receiver , callOperationNode , context . replaceTraceAndCache ( temporaryForVariable ) ) <EOL> val qualifier = temporaryForVariable . trace . get ( BindingContext . QUALIFIER , calleeExpression ) <EOL> if ( notNothing && ( qualifier == null || qualifier !is PackageQualifier ) ) { <EOL> callExpression . getResolvedCall ( temporaryForVariable . trace . bindingContext ) . let { <EOL> ( it as? ResolvedCallImpl ) ? . addStatus ( ResolutionStatus . OTHER_ERROR ) <EOL> } <EOL> temporaryForVariable . commit ( ) <EOL> context . trace . report ( FUNCTION_EXPECTED . on ( calleeExpression , calleeExpression , type ? : ErrorUtils . createErrorType ( ErrorTypeKind . ERROR_EXPECTED_TYPE ) ) ) <EOL> argumentTypeResolver . analyzeArgumentsAndRecordTypes ( BasicCallResolutionContext . create ( context , call , CheckArgumentTypesMode . CHECK_VALUE_ARGUMENTS , DataFlowInfoForArgumentsImpl ( initialDataFlowInfoForArguments , call ) ) , ResolveArgumentsMode . RESOLVE_FUNCTION_ARGUMENTS ) <EOL> return noTypeInfo ( context ) <EOL> } <EOL> } <EOL> temporaryForFunction . commit ( ) <EOL> return noTypeInfo ( context ) <EOL> }

/**
 * Visits a call expression and its arguments.
 * Determines the result type and data flow information after the call.
 */


fun getQualifiedExpressionTypeInfo ( expression : KtQualifiedExpression , context : ExpressionTypingContext ) : KotlinTypeInfo

{ <EOL> val currentContext = context . replaceExpectedType ( NO_EXPECTED_TYPE ) . replaceContextDependency ( INDEPENDENT ) <EOL> val trace = currentContext . trace <EOL> val elementChain = expression . elementChain ( currentContext ) <EOL> val firstReceiver = elementChain . first ( ) . receiver <EOL> var receiverTypeInfo = when ( trace . get ( BindingContext . QUALIFIER , firstReceiver ) ) { <EOL> null -> expressionTypingServices . getTypeInfo ( firstReceiver , currentContext ) <EOL> else -> KotlinTypeInfo ( null , currentContext . dataFlowInfo ) <EOL> } <EOL> var resultTypeInfo = receiverTypeInfo <EOL> var allUnsafe = true <EOL> var branchPointDataFlowInfo = receiverTypeInfo . dataFlowInfo <EOL> for ( element in elementChain ) { <EOL> val receiverType = receiverTypeInfo . type <EOL> ? : ErrorUtils . createErrorType ( ErrorTypeKind . ERROR_RECEIVER_TYPE , when ( val receiver = element . receiver ) { <EOL> is KtNameReferenceExpression -> receiver . getReferencedName ( ) <EOL> else -> receiver . text <EOL> } ) <EOL> val receiver = trace . get ( BindingContext . QUALIFIER , element . receiver ) <EOL> ? : ExpressionReceiver . create ( element . receiver , receiverType , trace . bindingContext ) <EOL> val qualifiedExpression = element . qualified <EOL> val lastStage = qualifiedExpression === expression <EOL> val contextForSelector = ( if ( lastStage ) context else currentContext ) . replaceDataFlowInfo ( if ( receiver is ReceiverValue && TypeUtils . isNullableType ( receiver . type ) && ! element . safe ) { <EOL> branchPointDataFlowInfo <EOL> } else { <EOL> receiverTypeInfo . dataFlowInfo <EOL> } ) <EOL> val selectorTypeInfo = getSafeOrUnsafeSelectorTypeInfo ( receiver , element , contextForSelector ) <EOL> allUnsafe = allUnsafe && ! element . safe <EOL> if ( allUnsafe ) { <EOL> branchPointDataFlowInfo = selectorTypeInfo . dataFlowInfo <EOL> } <EOL> resultTypeInfo = checkSelectorTypeInfo ( qualifiedExpression , selectorTypeInfo , contextForSelector ) . replaceDataFlowInfo ( branchPointDataFlowInfo ) <EOL> if ( ! lastStage ) { <EOL> recordResultTypeInfo ( qualifiedExpression , resultTypeInfo , contextForSelector ) <EOL> } <EOL> receiverTypeInfo = selectorTypeInfo <EOL> } <EOL> return resultTypeInfo <EOL> }

/**
 * Visits a qualified expression like x.y or x?.z controlling data flow information changes.

 * @return qualified expression type together with data flow information
 */