fun FirClassSymbol < * > . lazyResolveToPhaseWithCallableMembers ( toPhase : FirResolvePhase )

{ <EOL> fir . lazyResolveToPhaseWithCallableMembers ( toPhase ) <EOL> }

/**
 * Lazy resolve [FirClassSymbol] and its callable members to [FirResolvePhase].
 *
 * Might resolve additional required declarations.
 *
 * Note: for the [STATUS][FirResolvePhase.STATUS] phase it guarantees
 * that all callables in [this] or superclasses are resolved to at least the [STATUS][FirResolvePhase.STATUS] phase.
 *
 * @receiver [FirClassSymbol] which should be resolved and which callable members should be resolved
 * @param toPhase the minimum phase, the declaration and callable members should be resolved
 * to after an execution of the [lazyResolveToPhaseWithCallableMembers]
 *
 * Can be used instead of [lazyResolveToPhase] to avoid extra resolve calls.
 * Effectively the same as:
 * ```
 * kclass.lazyResolveToPhase(phase)
 * kclass.callableDeclarations.forEach { it.lazyResolveToPhase(phase) }
 * ```
 *
 * @see lazyResolveToPhase
 */


fun FirClass . lazyResolveToPhaseWithCallableMembers ( toPhase : FirResolvePhase )

{ <EOL> lazyDeclarationResolver . lazyResolveToPhaseWithCallableMembers ( this , toPhase ) <EOL> }

/**
 * Lazy resolve [FirClass] and its callable members to [FirResolvePhase].
 *
 * @see lazyResolveToPhaseWithCallableMembers
 */


fun FirBasedSymbol < * > . lazyResolveToPhaseRecursively ( toPhase : FirResolvePhase )

{ <EOL> fir . lazyResolveToPhaseRecursively ( toPhase ) <EOL> }

/**
 * Lazy resolve [FirBasedSymbol] and all nested declarations to [FirResolvePhase].
 *
 * In the case of lazy resolution (inside Analysis API), it checks that the declaration phase `>= toPhase`.
 * If not, it resolves the declaration for the requested phase.
 *
 * If the [lazyResolveToPhase] is called inside a fir transformer,
 * it should always request the phase which is strictly lower than the current transformer phase,
 * otherwise a deadlock/StackOverflow is possible.
 *
 * For the compiler mode, it does nothing, as the compiler is non-lazy.
 *
 * @receiver [FirBasedSymbol] which should be resolved
 * @param toPhase the minimum phase, the declaration and all nested declarations should be resolved to after an execution of the [lazyResolveToPhase]
 */


fun FirElementWithResolveState . lazyResolveToPhaseRecursively ( toPhase : FirResolvePhase )

{ <EOL> invokeLazyResolveToPhase ( toPhase , FirLazyDeclarationResolver :: lazyResolveToPhaseRecursively ) <EOL> }

/**
 * Lazy resolve [FirElementWithResolveState] and all nested declarations to [FirResolvePhase].
 *
 * @see lazyResolveToPhaseRecursively
 */


@ Test <EOL> fun testRfc7049IndefiniteByteStringExample ( )

{ <EOL> withDecoder ( input = "<STR_LIT>" ) { <EOL> assertEquals ( expected = "<STR_LIT>" , actual = HexConverter . printHexBinary ( nextByteString ( ) , lowerCase = true ) ) <EOL> } <EOL> }

/**
 * Test using example shown on page 11 of [RFC 7049 2.2.2](https://tools.ietf.org/html/rfc7049#section-2.2.2):
 *
 * ```
 * 0b010_11111 0b010_00100 0xaabbccdd 0b010_00011 0xeeff99 0b111_11111
 *
 * 5F -- Start indefinite-length byte string
 * 44 -- Byte string of length 4
 * aabbccdd -- Bytes content
 * 43 -- Byte string of length 3
 * eeff99 -- Bytes content
 * FF -- "break"
 *
 * After decoding, this results in a single byte string with seven
 * bytes: 0xaabbccddeeff99.
 * ```
 */


@ Test <EOL> fun testIgnoreUnknownKeysFailsWhenCborDataIsMissingKeysThatArePresentInKotlinClass ( )

{ <EOL> assertFailsWithMessage < SerializationException > ( "<STR_LIT>" ) { <EOL> ignoreUnknownKeys . decodeFromHexString ( Simple . serializer ( ) , "<STR_LIT>" ) <EOL> } <EOL> assertFailsWithMessage < SerializationException > ( "<STR_LIT>" ) { <EOL> ignoreUnknownKeys . decodeFromHexString ( Simple . serializer ( ) , "<STR_LIT>" ) <EOL> } <EOL> }

/**
 * CBOR hex data represents serialized versions of [TypesUmbrella] (which does **not** have a root property 'a') so
 * decoding to [Simple] (which has the field 'a') is expected to fail.
 */


{ <EOL> withDecoder ( "<STR_LIT>" ) { <EOL> expectMap ( size = <NUM_LIT:4> ) <EOL> expect ( "<STR_LIT:a>" ) <EOL> skipElement ( ) <EOL> expect ( "<STR_LIT:b>" ) <EOL> skipElement ( ) <EOL> expect ( "<STR_LIT:c>" ) <EOL> skipElement ( ) <EOL> expect ( "<STR_LIT:d>" ) <EOL> skipElement ( ) <EOL> expectEof ( ) <EOL> } <EOL> }

/**
 * Tests skipping unknown keys associated with values of the following CBOR types:
 * - Major type 0: an unsigned integer
 * - Major type 1: a negative integer
 * - Major type 2: a byte string
 * - Major type 3: a text string
 */


@ Test <EOL> fun testSkipEmptyPrimitives ( )

{ <EOL> withDecoder ( "<STR_LIT>" ) { <EOL> expectMap ( size = <NUM_LIT:2> ) <EOL> expect ( "<STR_LIT:a>" ) <EOL> skipElement ( ) <EOL> expect ( "<STR_LIT:b>" ) <EOL> skipElement ( ) <EOL> expectEof ( ) <EOL> } <EOL> }

/**
 * Tests skipping unknown keys associated with values (that are empty) of the following CBOR types:
 * - Major type 2: a byte string
 * - Major type 3: a text string
 */


@ Test <EOL> fun testSkipCollections ( )

/**
 * Tests skipping unknown keys associated with values of the following CBOR types:
 * - Major type 4: an array of data items
 * - Major type 5: a map of pairs of data items
 */


@ Test <EOL> fun testSkipEmptyCollections ( )

/**
 * Tests skipping unknown keys associated with values (empty collections) of the following CBOR types:
 * - Major type 4: an array of data items
 * - Major type 5: a map of pairs of data items
 */


@ Test <EOL> fun testSkipIndefiniteLength ( )

/**
 * Tests skipping unknown keys associated with **indefinite length** values of the following CBOR types:
 * - Major type 2: a byte string
 * - Major type 3: a text string
 * - Major type 4: an array of data items
 * - Major type 5: a map of pairs of data items
 */


/**
 * Tests that skipping unknown keys also skips over associated tags.
 *
 * Includes tags on the key, tags on the value, and tags on both key and value.
 */


@ Test <EOL> fun testDecodeCborWithUnknownKeysInSealedClasses ( )

{ <EOL> assertEquals ( expected = SealedBox ( listOf ( SubSealedA ( "<STR_LIT:a>" ) , SubSealedB ( <NUM_LIT:1> ) ) ) , actual = ignoreUnknownKeys . decodeFromHexString ( SealedBox . serializer ( ) , "<STR_LIT>" ) ) <EOL> }

/**
 * The following CBOR diagnostic output demonstrates the additional fields (prefixed with `+` in front of each line)
 * present in the encoded CBOR data that does not have associated fields in the Kotlin classes (they will be skipped
 * over with `ignoreUnknownKeys` is enabled).
 *
 * ```diff
 * {
 * + "extra": [
 * + 9,
 * + 8,
 * + 7
 * + ],
 * "boxed": [
 * [
 * "kotlinx.serialization.SimpleSealed.SubSealedA",
 * {
 * "s": "a",
 * + "newA": {
 * + "x": 1,
 * + "y": 2
 * + }
 * }
 * ],
 * [
 * "kotlinx.serialization.SimpleSealed.SubSealedB",
 * {
 * "i": 1
 * }
 * ]
 * ]
 * }
 * ```
 */


fun beforeTransformingChildren ( parentDeclaration : FirDeclaration ) : PersistentList < FirDeclaration >

{ <EOL> val current = owners <EOL> owners = owners . add ( parentDeclaration ) <EOL> return current <EOL> }

/**
 * Gets called before transforming [parentDeclaration]'s nested declarations (like in a class of a file).
 *
 * @param parentDeclaration A declaration whose nested declarations are about to be transformed.
 * @return Some state of the transformer; when the nested declarations are transformed, this state will be
 * passed to the [afterTransformingChildren].
 */


fun afterTransformingChildren ( state : PersistentList < FirDeclaration > ? )

{ <EOL> requireNotNull ( state ) <EOL> owners = state <EOL> }

/**
 * Gets called after performing transformation of some declaration's nested declarations; can be used to restore the internal
 * state of the transformer.
 *
 * @param state A state produced by the [beforeTransformingChildren] call before the transformation.
 */


override fun getOutputShape ( inputShape : TensorShape ) : TensorShape

{ <EOL> return when ( inputShape . rank ( ) ) { <EOL> <NUM_LIT:2> , <NUM_LIT:3> -> TensorShape ( inputShape [ <NUM_LIT:0> ] , inputShape [ <NUM_LIT:1> ] , colorMode . channels . toLong ( ) ) <EOL> else -> throw IllegalArgumentException ( "<STR_LIT>" ) <EOL> } <EOL> }

/**
 * Takes result color mode into account when computing output shape.
 */


{ <EOL> val ( train , test ) = mnist ( ) <EOL> model . use { <EOL> it . compile ( optimizer = Adam ( ) , loss = Losses . SOFT_MAX_CROSS_ENTROPY_WITH_LOGITS , metric = Metrics . ACCURACY ) <EOL> it . fit ( dataset = train , epochs = EPOCHS , batchSize = TRAINING_BATCH_SIZE ) <EOL> val accuracy = it . evaluate ( dataset = test , batchSize = TEST_BATCH_SIZE ) . metrics [ Metrics . ACCURACY ] <EOL> println ( "<STR_LIT>" ) <EOL> } <EOL> }

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


= denseOnly ( )


@ SinceKotlin ( "<STR_LIT:1.8>" ) <EOL> @ WasExperimental ( ExperimentalStdlibApi :: class ) <EOL> public fun < T : Any > Optional < T > . getOrNull ( ) : T ?

= orElse ( null )

/**
 * Returns this [Optional]'s value if [present][Optional.isPresent], or otherwise `null`.
 */


@ SinceKotlin ( "<STR_LIT:1.8>" ) <EOL> @ WasExperimental ( ExperimentalStdlibApi :: class ) <EOL> public fun < T > Optional < out T & Any > . getOrDefault ( defaultValue : T ) : T

= if ( isPresent ) get ( ) else defaultValue

/**
 * Returns this [Optional]'s value if [present][Optional.isPresent], or otherwise [defaultValue].
 */


@ SinceKotlin ( "<STR_LIT:1.8>" ) <EOL> @ WasExperimental ( ExperimentalStdlibApi :: class ) <EOL> public inline fun < T > Optional < out T & Any > . getOrElse ( defaultValue : ( ) -> T ) : T

{ <EOL> contract { <EOL> callsInPlace ( defaultValue , InvocationKind . AT_MOST_ONCE ) <EOL> } <EOL> return if ( isPresent ) get ( ) else defaultValue ( ) <EOL> }

/**
 * Returns this [Optional]'s value if [present][Optional.isPresent], or otherwise the result of the [defaultValue] function.
 */


@ SinceKotlin ( "<STR_LIT:1.8>" ) <EOL> @ WasExperimental ( ExperimentalStdlibApi :: class ) <EOL> public fun < T : Any , C : MutableCollection < in T > > Optional < T > . toCollection ( destination : C ) : C

{ <EOL> if ( isPresent ) { <EOL> destination . add ( get ( ) ) <EOL> } <EOL> return destination <EOL> }

/**
 * Appends this [Optional]'s value to the given [destination] collection if [present][Optional.isPresent].
 */


@ SinceKotlin ( "<STR_LIT:1.8>" ) <EOL> @ WasExperimental ( ExperimentalStdlibApi :: class ) <EOL> public fun < T : Any > Optional < out T > . toList ( ) : List < T >

= <EOL> if ( isPresent ) listOf ( get ( ) ) else emptyList ( )

/**
 * Returns a new read-only list of this [Optional]'s value if [present][Optional.isPresent], or otherwise an empty list.
 * The returned list is serializable (JVM).
 */


@ SinceKotlin ( "<STR_LIT:1.8>" ) <EOL> @ WasExperimental ( ExperimentalStdlibApi :: class ) <EOL> public fun < T : Any > Optional < out T > . toSet ( ) : Set < T >

= <EOL> if ( isPresent ) setOf ( get ( ) ) else emptySet ( )

/**
 * Returns a new read-only set of this [Optional]'s value if [present][Optional.isPresent], or otherwise an empty set.
 * The returned set is serializable (JVM).
 */


@ SinceKotlin ( "<STR_LIT:1.8>" ) <EOL> @ WasExperimental ( ExperimentalStdlibApi :: class ) <EOL> public fun < T : Any > Optional < out T > . asSequence ( ) : Sequence < T >

= <EOL> if ( isPresent ) sequenceOf ( get ( ) ) else emptySequence ( )

/**
 * Returns a new sequence for this [Optional]'s value if [present][Optional.isPresent], or otherwise an empty sequence.
 */


fun FqName . tail ( prefix : FqName ) : FqName

{ <EOL> return when { <EOL> ! isSubpackageOf ( prefix ) || prefix . isRoot -> this <EOL> this == prefix -> FqName . ROOT <EOL> else -> FqName ( asString ( ) . substring ( prefix . asString ( ) . length + <NUM_LIT:1> ) ) <EOL> } <EOL> }

/**
 * Get the tail part of the FQ name by stripping a prefix. If FQ name does not begin with the given prefix, it will be returned as is.
 *
 * Examples:
 * "org.jetbrains.kotlin".tail("org") = "jetbrains.kotlin"
 * "org.jetbrains.kotlin".tail("") = "org.jetbrains.kotlin"
 * "org.jetbrains.kotlin".tail("org.jetbrains.kotlin") = ""
 * "org.jetbrains.kotlin".tail("org.jetbrains.gogland") = "org.jetbrains.kotlin"
 */


{ <EOL> val jsonConfigFile = getVGG16JSONConfigFile ( ) <EOL> val model = Sequential . loadModelConfiguration ( jsonConfigFile ) <EOL> val imageNetClassLabels = Imagenet . V1k . labels ( ) <EOL> model . use { <EOL> it . compile ( optimizer = Adam ( ) , loss = Losses . MAE , metric = Metrics . ACCURACY ) <EOL> it . logSummary ( ) <EOL> val hdfFile = getVGG16WeightsFile ( ) <EOL> recursivePrintGroupInHDF5File ( hdfFile , hdfFile ) <EOL> val kernelDataPathTemplate = "<STR_LIT>" <EOL> val biasDataPathTemplate = "<STR_LIT>" <EOL> it . loadWeightsByPathTemplates ( hdfFile , kernelDataPathTemplate , biasDataPathTemplate ) <EOL> val fileLoader = pipeline < BufferedImage > ( ) <EOL> . convert { colorMode = ColorMode . BGR } <EOL> . toFloatArray { } <EOL> . call ( InputType . CAFFE . preprocessing ( ) ) <EOL> . fileLoader ( ) <EOL> for ( i in <NUM_LIT:1> .. <NUM_LIT:8> ) { <EOL> val inputData = fileLoader . load ( getFileFromResource ( "<STR_LIT>" ) ) <EOL> val res = it . predict ( inputData , "<STR_LIT>" ) <EOL> println ( "<STR_LIT>" ) <EOL> val top5 = it . predictTop5Labels ( inputData , imageNetClassLabels ) <EOL> println ( top5 . toString ( ) ) <EOL> } <EOL> } <EOL> val model2 = Sequential . loadModelConfiguration ( jsonConfigFile ) <EOL> model2 . use { <EOL> it . compile ( optimizer = Adam ( ) , loss = Losses . MAE , metric = Metrics . ACCURACY ) <EOL> it . logSummary ( ) <EOL> val hdfFile = getVGG16WeightsFile ( ) <EOL> recursivePrintGroupInHDF5File ( hdfFile , hdfFile ) <EOL> val weightPaths = listOf ( LayerConvOrDensePaths ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , LayerConvOrDensePaths ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , LayerConvOrDensePaths ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , LayerConvOrDensePaths ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , LayerConvOrDensePaths ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , LayerConvOrDensePaths ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , LayerConvOrDensePaths ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , LayerConvOrDensePaths ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , LayerConvOrDensePaths ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , LayerConvOrDensePaths ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , LayerConvOrDensePaths ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , LayerConvOrDensePaths ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , LayerConvOrDensePaths ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , LayerConvOrDensePaths ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , LayerConvOrDensePaths ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , LayerConvOrDensePaths ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , ) <EOL> it . loadWeightsByPaths ( hdfFile , weightPaths ) <EOL> val inputStreamLoader = pipeline < BufferedImage > ( ) <EOL> . convert { colorMode = ColorMode . BGR } <EOL> . toFloatArray { } <EOL> . call ( InputType . CAFFE . preprocessing ( ) ) <EOL> . inputStreamLoader ( ) <EOL> for ( i in <NUM_LIT:1> .. <NUM_LIT:8> ) { <EOL> val inputStream = OnHeapDataset :: class . java . classLoader . getResourceAsStream ( "<STR_LIT>" ) <EOL> val inputData = inputStreamLoader . load ( inputStream ) <EOL> val res = it . predict ( inputData , "<STR_LIT>" ) <EOL> println ( "<STR_LIT>" ) <EOL> val top5 = it . predictTop5Labels ( inputData , imageNetClassLabels ) <EOL> println ( top5 . toString ( ) ) <EOL> } <EOL> } <EOL> val model3 = Sequential . loadModelConfiguration ( jsonConfigFile ) <EOL> model3 . use { <EOL> it . compile ( optimizer = Adam ( ) , loss = Losses . MAE , metric = Metrics . ACCURACY ) <EOL> it . logSummary ( ) <EOL> val hdfFile = getVGG16WeightsFile ( ) <EOL> recursivePrintGroupInHDF5File ( hdfFile , hdfFile ) <EOL> it . loadWeights ( hdfFile ) <EOL> } <EOL> }

/**
 * This example demonstrates the inference concept on VGG'16 model and weights loading from outdated or custom weights' schema in .h5 file:
 *
 * - Weights are loaded from .h5 file, configuration is loaded from .json file.
 * - Model predicts on a few images located in resources.
 * - Special preprocessing (used in VGG'16 during training on ImageNet dataset) is applied to each image before prediction.
 * - No additional training.
 * - No new layers are added.
 *
 * NOTE: Also recursivePrintGroupInHDF5File() is helpful to discover hidden schema and paths.
 *
 * @see
 * Very Deep Convolutional Networks for Large-Scale Image Recognition (ICLR 2015).
 * @see
 * Detailed description of VGG'16 model and an approach to build it in Keras.
 */


private fun getVGG16JSONConfigFile ( ) : File

{ <EOL> val properties = Properties ( ) <EOL> val reader = FileReader ( "<STR_LIT>" ) <EOL> properties . load ( reader ) <EOL> val vgg16JSONModelPathForOldWeightSchema = properties [ "<STR_LIT>" ] as String <EOL> return File ( vgg16JSONModelPathForOldWeightSchema ) <EOL> }

/** Returns JSON file with model configuration, saved from Keras 2.x. */


private fun getVGG16WeightsFile ( ) : HdfFile

{ <EOL> val properties = Properties ( ) <EOL> val reader = FileReader ( "<STR_LIT>" ) <EOL> properties . load ( reader ) <EOL> val vgg19h5WeightsPathForOldWeightSchema = properties [ "<STR_LIT>" ] as String <EOL> return HdfFile ( File ( vgg19h5WeightsPathForOldWeightSchema ) ) <EOL> }

/** Returns .h5 file with model weights, saved from Keras 2.x. with old weights' schema in h5 file */


fun genReturn ( target : IrSymbolOwner , value : LLVMValueRef ? )

/**
 * Generates `return` [value] operation.
 *
 * @param value may be null iff target type is `Unit`.
 */


fun genDeclareVariable ( variable : IrVariable , value : LLVMValueRef ? , variableLocation : VariableDebugLocation ? ) : Int

/**
 * Declares the variable.
 * @return index of declared variable.
 */


fun getDeclaredValue ( value : IrValueDeclaration ) : Int

/**
 * @return index of value declared before, or -1 if no such variable has been declared yet.
 */


fun genGetValue ( value : IrValueDeclaration , resultSlot : LLVMValueRef ? ) : LLVMValueRef

/**
 * Generates the code to obtain a value available in this context.
 *
 * @return the requested value
 */


fun functionScope ( ) : CodeContext ?

/**
 * Returns owning function scope.
 *
 * @return the requested value
 */


fun fileScope ( ) : CodeContext ?

/**
 * Returns owning file scope.
 *
 * @return the requested value if in the file scope or null.
 */


fun classScope ( ) : CodeContext ?

/**
 * Returns owning class scope [ClassScope].
 *
 * @returns the requested value if in the class scope or null.
 */


fun returnableBlockScope ( ) : CodeContext ?

/**
 * Returns owning returnable block scope [ReturnableBlockScope].
 *
 * @returns the requested value if in the returnableBlockScope scope or null.
 */


fun location ( offset : Int ) : LocationInfo ?

/**
 * Returns location information for given source location [LocationInfo].
 */


fun scope ( ) : DIScopeOpaqueRef ?

/**
 * Returns [DIScopeOpaqueRef] instance for corresponding scope.
 */


/**
 * Called, when context is pushed on stack
 */


/**
 * Called, when context is removed from stack
 */


fun wrapException ( e : Exception ) : Exception

/**
 * Called, when exception is caught in this block. Result expception would be rethrown instead.
 */


private inline fun < R > using ( codeContext : CodeContext ? , block : ( ) -> R ) : R

{ <EOL> val oldCodeContext = currentCodeContext <EOL> if ( codeContext != null ) { <EOL> currentCodeContext = codeContext <EOL> codeContext . onEnter ( ) <EOL> } <EOL> try { <EOL> return block ( ) <EOL> } catch ( e : Exception ) { <EOL> throw ( codeContext ? . wrapException ( e ) ? : e ) <EOL> } finally { <EOL> codeContext ? . onExit ( ) <EOL> currentCodeContext = oldCodeContext <EOL> } <EOL> }

/**
 * Executes [block] with [codeContext] substituted as [currentCodeContext].
 */


private fun bindParameters ( function : IrFunction ? ) : Map < IrValueParameter , LLVMValueRef >

{ <EOL> if ( function == null ) return emptyMap ( ) <EOL> return function . allParameters . mapIndexed { i , irParameter -> <EOL> val parameter = codegen . param ( function , i ) <EOL> assert ( irParameter . type . toLLVMType ( llvm ) == parameter . type ) <EOL> irParameter to parameter <EOL> } . toMap ( ) <EOL> }

/**
 * Binds LLVM function parameters to IR parameter descriptors.
 */


private fun FunctionGenerationContext . jump ( target : ContinuationBlock , value : LLVMValueRef ? )

{ <EOL> val entry = target . block <EOL> br ( entry ) <EOL> if ( target . valuePhi != null ) { <EOL> assignPhis ( target . valuePhi to value ! ! ) <EOL> } <EOL> }

/**
 * Jumps to [target] passing [value].
 */


private fun continuationBlock ( type : IrType , locationInfo : LocationInfo ? , code : ( ContinuationBlock ) -> Unit = { } ) : ContinuationBlock

{ <EOL> val entry = functionGenerationContext . basicBlock ( "<STR_LIT>" , locationInfo ) <EOL> functionGenerationContext . appendingTo ( entry ) { <EOL> val valuePhi = if ( type . isUnit ( ) ) { <EOL> null <EOL> } else { <EOL> functionGenerationContext . phi ( type . toLLVMType ( llvm ) ) <EOL> } <EOL> val result = ContinuationBlock ( entry , valuePhi ) <EOL> code ( result ) <EOL> return result <EOL> } <EOL> }

/**
 * Creates new [ContinuationBlock] that receives the value of given Kotlin type
 * and generates [code] starting from its beginning.
 */


{ <EOL> with ( functionGenerationContext ) { <EOL> val exceptionPtr = catchKotlinException ( ) <EOL> jumpToHandler ( exceptionPtr ) <EOL> } <EOL> }

/**
 * Generates the LLVM `landingpad` that catches C++ exception with type `KotlinException`,
 * unwraps the Kotlin exception object and jumps to [handler].
 *
 * This method generates nearly the same code as `clang++` does for the following:
 * ```
 * catch (KotlinException& e) {
 * KRef exception = e.exception_;
 * return exception;
 * }
 * ```
 * except that our code doesn't check exception `typeid`.
 *
 * TODO: why does `clang++` check `typeid` even if there is only one catch clause?
 */


private fun evaluateWhen ( expression : IrWhen , resultSlot : LLVMValueRef ? ) : LLVMValueRef

{ <EOL> context . log { "<STR_LIT>" } <EOL> generateDebugTrambolineIf ( "<STR_LIT>" , expression ) <EOL> val bbOfFirstConditionCheck = functionGenerationContext . currentBlock <EOL> val branchInfos : List < BranchCaseNextInfo > = expression . branches . map { <EOL> val bbCase = if ( it . isUnconditional ( ) ) null else <EOL> functionGenerationContext . basicBlock ( "<STR_LIT>" , it . startLocation , it . endLocation ) . apply { functionGenerationContext . positionAtEnd ( this ) } <EOL> val bbNext = if ( it . isUnconditional ( ) || it == expression . branches . last ( ) ) null else <EOL> functionGenerationContext . basicBlock ( "<STR_LIT>" , it . startLocation , it . endLocation ) . apply { functionGenerationContext . positionAtEnd ( this ) } <EOL> BranchCaseNextInfo ( it , bbCase , bbNext , resultSlot ) <EOL> } <EOL> val whenEmittingContext = WhenEmittingContext ( expression , lastBBOfWhenCases = functionGenerationContext . currentBlock ) <EOL> functionGenerationContext . positionAtEnd ( bbOfFirstConditionCheck ) <EOL> branchInfos . forEach { generateWhenCase ( whenEmittingContext , it ) } <EOL> if ( whenEmittingContext . bbExit . isInitialized ( ) ) <EOL> functionGenerationContext . positionAtEnd ( whenEmittingContext . bbExit . value ) <EOL> return when { <EOL> expression . type . isUnit ( ) -> codegen . theUnitInstanceRef . llvm <EOL> expression . type . isNothing ( ) -> functionGenerationContext . kNothingFakeValue <EOL> whenEmittingContext . resultPhi . isInitialized ( ) -> whenEmittingContext . resultPhi . value <EOL> else -> LLVMGetUndef ( whenEmittingContext . llvmType ) ! ! <EOL> } <EOL> }

/** For WHEN { COND1 -> CASE1, COND2 -> CASE2, ELSE -> UNCONDITIONAL }
 * the following sequence of basic blocks is generated:
 * -- if COND1
 * -- CASE1
 * -- NEXT1(if COND2)
 * -- CASE2
 * -- NEXT2 (UNCONDITIONAL)
 * -- EXIT
 */


= if ( isNaN ( ) ) java . lang . Float . NaN else this

/**
 * Normalizing nans to single value is useful for build reproducibility.
 *
 * It's possible that it can lead to some bad consequences for interop libraries,
 * for which exact nan value is important. We are not aware of the existence of
 * any such useful library, at least on priority targets.
 *
 * On the other side, the semantics of exact cases, NaN values should be not normalized, is unclear.
 * E.g., in previous implementation, storing constant to another constant could change the exact bit pattern.
 *
 * So for now, we would just normalize all NaN constants. At least this leads to predictable result
 * useful in almost all cases.
 *
 * Also, java.lang classes are used here to avoid unexpected NaN values if a compiler and stdlib
 * are built in an arm64 architecture environment.
 */


private fun evaluateExplicitArgs ( expression : IrFunctionAccessExpression ) : List < LLVMValueRef >

{ <EOL> val result = expression . getArgumentsWithIr ( ) . map { ( _ , argExpr ) -> <EOL> evaluateExpression ( argExpr ) <EOL> } <EOL> val explicitParametersCount = expression . symbol . owner . explicitParametersCount <EOL> if ( result . size != explicitParametersCount ) { <EOL> error ( "<STR_LIT>" + "<STR_LIT>" ) <EOL> } <EOL> return result <EOL> }

/**
 * Evaluates all arguments of [expression] that are explicitly represented in the IR.
 * Returns results in the same order as LLVM function expects, assuming that all explicit arguments
 * exactly correspond to a tail of LLVM parameters.
 */


private fun IrValueDeclaration . debugNameConversion ( ) : Name

{ <EOL> if ( name == thisName ) { <EOL> return when ( origin ) { <EOL> IrDeclarationOrigin . IR_TEMPORARY_VARIABLE_FOR_INLINED_EXTENSION_RECEIVER -> doubleUnderscoreThisName <EOL> else -> underscoreThisName <EOL> } <EOL> } <EOL> return name <EOL> }

/**
 * HACK: this is workaround for GH-2316, to let IDE some how operate with this.
 * We're experiencing issue with libclang which is used as compiler of expression in lldb
 * for current state support Kotlin in lldb:
 * 1. <this> isn't accepted by libclang as valid variable name.
 * 2. this is reserved name and compiled in special way.
 */


@ Deprecated ( "<STR_LIT>" ) <EOL> public abstract fun restoreSymbol ( analysisSession : KtAnalysisSession ) : S ?

/**
 * @return restored symbol (possibly the new symbol instance) if one is still valid, `null` otherwise
 *
 * Consider using [org.jetbrains.kotlin.analysis.api.KtAnalysisSession.restoreSymbol]
 */


public open fun pointsToTheSameSymbolAs ( other : KtSymbolPointer < KtSymbol > ) : Boolean

= this === other

/**
 * @return **true** if [other] pointer can be restored to the same symbol. The operation is symmetric and transitive.
 */


public inline fun < reified DomainType : Comparable < DomainType > > continuousColorHue ( huesRange : ClosedRange < Int > ? = null , chroma : Int ? = null , luminance : Int ? = null , hueStart : Int ? = null , direction : WheelDirection ? = null , domainLimits : ClosedRange < DomainType > , nullValue : Color ? = null , transform : Transformation ? = null ) : ScaleContinuousColorHue < DomainType >

= ScaleContinuousColorHue ( domainLimits . let { <EOL> it . start to it . endInclusive <EOL> } , huesRange ? . let { <EOL> it . start to it . endInclusive <EOL> } , chroma , luminance , hueStart , direction , nullValue , transform )

/**
 * Creates a qualitative continuous color scale with evenly spaced hues.
 *
 * @param DomainType scale domain type.
 * @param domainLimits [ClosedRange] defining the scale domain.
 * @param huesRange [ClosedRange] of hues, in [0,360]
 * @param chroma numeric Chroma (intensity of color), maximum value varies depending on
 * @param luminance numeric Luminance (lightness), in [0,100]
 * @param hueStart number Hue to start at
 * @param direction [WheelDirection] to travel around the color wheel.
 * @param nullValue value which null is mapped to.
 * @param transform scale transformation.
 * @return new continuous color scale.
 */


public inline fun < reified DomainType : Comparable < DomainType > > continuousColorHue ( huesRange : ClosedRange < Int > ? = null , chroma : Int ? = null , luminance : Int ? = null , hueStart : Int ? = null , direction : WheelDirection ? = null , domainMin : DomainType ? = null , domainMax : DomainType ? = null , nullValue : Color ? = null , transform : Transformation ? = null ) : ScaleContinuousColorHue < DomainType >

= ScaleContinuousColorHue ( domainMin to domainMax , huesRange ? . let { <EOL> it . start to it . endInclusive <EOL> } , chroma , luminance , hueStart , direction , nullValue , transform )

/**
 * Creates a qualitative continuous color scale with evenly spaced hues.
 *
 * @param DomainType scale domain type.
 * @param domainMin scale domain minimum.
 * @param domainMax scale domain maximum.
 * @param huesRange [ClosedRange] of hues, in [0,360]
 * @param chroma numeric Chroma (intensity of color), maximum value varies depending on
 * @param luminance numeric Luminance (lightness), in [0,100]
 * @param hueStart number Hue to start at
 * @param direction [WheelDirection] to travel around the color wheel.
 * @param nullValue value which null is mapped to.
 * @param transform scale transformation.
 * @return new continuous color scale.
 */


public fun < DomainType > categoricalColorHue ( huesRange : Pair < Int , Int > ? = null , chroma : Int ? = null , luminance : Int ? = null , hueStart : Int ? = null , direction : WheelDirection ? = null , ) : ScaleCategoricalColorHue < DomainType >

= ScaleCategoricalColorHue < DomainType > ( huesRange , chroma , luminance , hueStart , direction , )

/**
 * Creates a qualitative categorical color scale with evenly spaced hues.
 *
 * @param DomainType scale domain type.
 * @param huesRange [ClosedRange] of hues, in [0,360]
 * @param chroma numeric Chroma (intensity of color), maximum value varies depending on
 * @param luminance numeric Luminance (lightness), in [0,100]
 * @param hueStart number Hue to start at
 * @param direction [WheelDirection] to travel around the color wheel.
 * @return new categorical color scale.
 */


public fun add ( element : @ UnsafeVariance E ) : PersistentCollection < E >

/**
 * Returns the result of adding the specified [element] to this collection.
 *
 * @returns a new persistent collection with the specified [element] added;
 * or this instance if this collection does not support duplicates and it already contains the element.
 */


public fun addAll ( elements : Collection < @ UnsafeVariance E > ) : PersistentCollection < E >

/**
 * Returns the result of adding all elements of the specified [elements] collection to this collection.
 *
 * @return a new persistent collection with elements of the specified [elements] collection added;
 * or this instance if no modifications were made in the result of this operation.
 */


public fun remove ( element : @ UnsafeVariance E ) : PersistentCollection < E >

/**
 * Returns the result of removing a single appearance of the specified [element] from this collection.
 *
 * @return a new persistent collection with a single appearance of the specified [element] removed;
 * or this instance if there is no such element in this collection.
 */


public fun removeAll ( elements : Collection < @ UnsafeVariance E > ) : PersistentCollection < E >

/**
 * Returns the result of removing all elements in this collection that are also
 * contained in the specified [elements] collection.
 *
 * @return a new persistent collection with elements in this collection that are also
 * contained in the specified [elements] collection removed;
 * or this instance if no modifications were made in the result of this operation.
 */


public fun removeAll ( predicate : ( E ) -> Boolean ) : PersistentCollection < E >

/**
 * Returns the result of removing all elements in this collection that match the specified [predicate].
 *
 * @return a new persistent collection with elements matching the specified [predicate] removed;
 * or this instance if no elements match the predicate.
 */


public fun retainAll ( elements : Collection < @ UnsafeVariance E > ) : PersistentCollection < E >

/**
 * Returns all elements in this collection that are also
 * contained in the specified [elements] collection.
 *
 * @return a new persistent set with elements in this set that are also
 * contained in the specified [elements] collection;
 * or this instance if no modifications were made in the result of this operation.
 */


public fun clear ( ) : PersistentCollection < E >

/**
 * Returns an empty persistent collection.
 */


public fun build ( ) : PersistentCollection < E >

/**
 * Returns a persistent collection with the same contents as this builder.
 *
 * This method can be called multiple times.
 *
 * If operations applied on this builder have caused no modifications:
 * - on the first call it returns the same persistent collection instance this builder was obtained from.
 * - on subsequent calls it returns the same previously returned persistent collection instance.
 */


public fun builder ( ) : Builder < @ UnsafeVariance E >

/**
 * Returns a new builder with the same contents as this collection.
 *
 * The builder can be used to efficiently perform multiple modification operations.
 */


fun append ( charCode : Int , categoryCode : String , mapping : Int ) : Boolean

/**
 * Appends the [charCode] to this range pattern.
 * Returns true if the [charCode] with the specified [categoryCode] and [mapping] was accommodated within this pattern.
 * Returns false otherwise.
 *
 * @param mapping the difference between the [charCode] and the char it converts to.
 */


internal fun _markDirty ( file : File , root : JavaSourceRootDescriptor )

{ <EOL> val isCrossCompiled = root is KotlinIncludedModuleSourceRoot <EOL> val old = _dirty . put ( file . normalize ( ) . absoluteFile , KotlinModuleBuildTarget . Source ( file , isCrossCompiled ) ) <EOL> check ( old == null || old . isCrossCompiled == isCrossCompiled ) { <EOL> "<STR_LIT>" + <EOL> "<STR_LIT>" + <EOL> "<STR_LIT>" <EOL> } <EOL> }

/**
 * Should be called only from [FSOperationsHelper.markFilesForCurrentRound]
 * and during KotlinDirtySourceFilesHolder initialization.
 */


@ Deprecated ( "<STR_LIT>" , ReplaceWith ( "<STR_LIT>" ) ) <EOL> @ DeprecatedSinceKotlin ( warningSince = "<STR_LIT:1.5>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun Char . toLowerCase ( ) : Char

= lowercaseChar ( )

/**
 * Converts this character to lower case using Unicode mapping rules of the invariant locale.
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ WasExperimental ( ExperimentalStdlibApi :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun Char . lowercaseChar ( ) : Char

= lowercase ( ) [ <NUM_LIT:0> ]

/**
 * Converts this character to lower case using Unicode mapping rules of the invariant locale.
 *
 * This function performs one-to-one character mapping.
 * To support one-to-many character mapping use the [lowercase] function.
 * If this character has no mapping equivalent, the character itself is returned.
 *
 * @sample samples.text.Chars.lowercase
 */


@ Deprecated ( "<STR_LIT>" , ReplaceWith ( "<STR_LIT>" ) ) <EOL> @ DeprecatedSinceKotlin ( warningSince = "<STR_LIT:1.5>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun Char . toUpperCase ( ) : Char

= uppercaseChar ( )

/**
 * Converts this character to upper case using Unicode mapping rules of the invariant locale.
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ WasExperimental ( ExperimentalStdlibApi :: class ) <EOL> public actual fun Char . uppercaseChar ( ) : Char

{ <EOL> val uppercase = uppercase ( ) <EOL> return if ( uppercase . length > <NUM_LIT:1> ) this else uppercase [ <NUM_LIT:0> ] <EOL> }

/**
 * Converts this character to upper case using Unicode mapping rules of the invariant locale.
 *
 * This function performs one-to-one character mapping.
 * To support one-to-many character mapping use the [uppercase] function.
 * If this character has no mapping equivalent, the character itself is returned.
 *
 * @sample samples.text.Chars.uppercase
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> public actual fun Char . titlecaseChar ( ) : Char

= titlecaseCharImpl ( )

/**
 * Converts this character to title case using Unicode mapping rules of the invariant locale.
 *
 * This function performs one-to-one character mapping.
 * To support one-to-many character mapping use the [titlecase] function.
 * If this character has no mapping equivalent, the result of calling [uppercaseChar] is returned.
 *
 * @sample samples.text.Chars.titlecase
 */


public actual fun Char . isHighSurrogate ( ) : Boolean

= this in Char . MIN_HIGH_SURROGATE .. Char . MAX_HIGH_SURROGATE

/**
 * Returns `true` if this character is a Unicode high-surrogate code unit (also known as leading-surrogate code unit).
 */


public actual fun Char . isLowSurrogate ( ) : Boolean

= this in Char . MIN_LOW_SURROGATE .. Char . MAX_LOW_SURROGATE

/**
 * Returns `true` if this character is a Unicode low-surrogate code unit (also known as trailing-surrogate code unit).
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> public actual fun Char . isDefined ( ) : Boolean

{ <EOL> if ( this < '<CHAR_LIT>' ) { <EOL> return true <EOL> } <EOL> return getCategoryValue ( ) != CharCategory . UNASSIGNED . value <EOL> }

/**
 * Returns `true` if this character (Unicode code point) is defined in Unicode.
 *
 * A character is considered to be defined in Unicode if its [category] is not [CharCategory.UNASSIGNED].
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> public actual fun Char . isLetter ( ) : Boolean

{ <EOL> if ( this in '<CHAR_LIT:a>' .. '<CHAR_LIT:z>' || this in '<CHAR_LIT:A>' .. '<CHAR_LIT:Z>' ) { <EOL> return true <EOL> } <EOL> if ( this < '<CHAR_LIT>' ) { <EOL> return false <EOL> } <EOL> return isLetterImpl ( ) <EOL> }

/**
 * Returns `true` if this character is a letter.
 *
 * A character is considered to be a letter if its [category] is [CharCategory.UPPERCASE_LETTER],
 * [CharCategory.LOWERCASE_LETTER], [CharCategory.TITLECASE_LETTER], [CharCategory.MODIFIER_LETTER], or [CharCategory.OTHER_LETTER].
 *
 * @sample samples.text.Chars.isLetter
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> public actual fun Char . isLetterOrDigit ( ) : Boolean

{ <EOL> if ( this in '<CHAR_LIT:a>' .. '<CHAR_LIT:z>' || this in '<CHAR_LIT:A>' .. '<CHAR_LIT:Z>' || this in '<CHAR_LIT:0>' .. '<CHAR_LIT:9>' ) { <EOL> return true <EOL> } <EOL> if ( this < '<CHAR_LIT>' ) { <EOL> return false <EOL> } <EOL> return isDigitImpl ( ) || isLetterImpl ( ) <EOL> }

/**
 * Returns `true` if this character is a letter or digit.
 *
 * @see isLetter
 * @see isDigit
 *
 * @sample samples.text.Chars.isLetterOrDigit
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> public actual fun Char . isDigit ( ) : Boolean

{ <EOL> if ( this in '<CHAR_LIT:0>' .. '<CHAR_LIT:9>' ) { <EOL> return true <EOL> } <EOL> if ( this < '<CHAR_LIT>' ) { <EOL> return false <EOL> } <EOL> return isDigitImpl ( ) <EOL> }

/**
 * Returns `true` if this character is a digit.
 *
 * A character is considered to be a digit if its [category] is [CharCategory.DECIMAL_DIGIT_NUMBER].
 *
 * @sample samples.text.Chars.isDigit
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> public actual fun Char . isUpperCase ( ) : Boolean

{ <EOL> if ( this in '<CHAR_LIT:A>' .. '<CHAR_LIT:Z>' ) { <EOL> return true <EOL> } <EOL> if ( this < '<CHAR_LIT>' ) { <EOL> return false <EOL> } <EOL> return isUpperCaseImpl ( ) <EOL> }

/**
 * Returns `true` if this character is upper case.
 *
 * A character is considered to be an upper case character if its [category] is [CharCategory.UPPERCASE_LETTER],
 * or it has contributory property `Other_Uppercase` as defined by the Unicode Standard.
 *
 * @sample samples.text.Chars.isUpperCase
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> public actual fun Char . isLowerCase ( ) : Boolean

{ <EOL> if ( this in '<CHAR_LIT:a>' .. '<CHAR_LIT:z>' ) { <EOL> return true <EOL> } <EOL> if ( this < '<CHAR_LIT>' ) { <EOL> return false <EOL> } <EOL> return isLowerCaseImpl ( ) <EOL> }

/**
 * Returns `true` if this character is lower case.
 *
 * A character is considered to be a lower case character if its [category] is [CharCategory.LOWERCASE_LETTER],
 * or it has contributory property `Other_Lowercase` as defined by the Unicode Standard.
 *
 * @sample samples.text.Chars.isLowerCase
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> public actual fun Char . isTitleCase ( ) : Boolean

{ <EOL> if ( this < '<CHAR_LIT>' ) { <EOL> return false <EOL> } <EOL> return getCategoryValue ( ) == CharCategory . TITLECASE_LETTER . value <EOL> }

/**
 * Returns `true` if this character is a title case letter.
 *
 * A character is considered to be a title case letter if its [category] is [CharCategory.TITLECASE_LETTER].
 *
 * @sample samples.text.Chars.isTitleCase
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> public actual fun Char . isISOControl ( ) : Boolean

{ <EOL> return this <= '<CHAR_LIT>' || this in '<CHAR_LIT>' .. '<CHAR_LIT>' <EOL> }

/**
 * Returns `true` if this character is an ISO control character.
 *
 * A character is considered to be an ISO control character if its [category] is [CharCategory.CONTROL],
 * meaning the Char is in the range `'\u0000'..'\u001F'` or in the range `'\u007F'..'\u009F'`.
 *
 * @sample samples.text.Chars.isISOControl
 */


public actual fun Char . isWhitespace ( ) : Boolean

= isWhitespaceImpl ( )

/**
 * Determines whether a character is whitespace.
 *
 * A character is considered whitespace if either its Unicode [category][Char.category]
 * is one of [CharCategory.SPACE_SEPARATOR], [CharCategory.LINE_SEPARATOR], [CharCategory.PARAGRAPH_SEPARATOR],
 * or it is a [CharCategory.CONTROL] character in range `U+0009..U+000D` or `U+001C..U+001F`.
 *
 * Returns `true` if the character is whitespace.
 *
 * @sample samples.text.Chars.isWhitespace
 */


fun < E > decodeConfigValue ( extractValueAtPath : ( conf : Config , path : String ) -> E ) : E

/**
 * Decodes the value at the current path from the input.
 * Allows to call methods on a [Config] instance.
 *
 * @param E type of value
 * @param extractValueAtPath lambda for extracting value, where conf - original config object, path - current path expression being decoded.
 * @return result of lambda execution
 */


public fun < T > stroke ( column : ColumnReference < T > , parameters : LetsPlotNonPositionalMappingParametersContinuous < T , Double > . ( ) -> Unit = { } ) : NonPositionalMapping < T , Double >

{ <EOL> return addNonPositionalMapping ( STROKE , column . name ( ) , LetsPlotNonPositionalMappingParametersContinuous < T , Double > ( ) . apply ( parameters ) ) <EOL> }

/**
 * Maps the `stroke` aesthetic to a data column by [ColumnReference].
 *
 * @param column the data column to map to the size.
 * @param parameters optional lambda to configure additional scale parameters.
 * @return a [NonPositionalMapping] object representing the mapping.
 */


public fun < T > stroke ( column : KProperty < T > , parameters : LetsPlotNonPositionalMappingParametersContinuous < T , Double > . ( ) -> Unit = { } ) : NonPositionalMapping < T , Double >

{ <EOL> return addNonPositionalMapping ( STROKE , column . name , LetsPlotNonPositionalMappingParametersContinuous < T , Double > ( ) . apply ( parameters ) ) <EOL> }

/**
 * Maps the `stroke` aesthetic to a data column by [KProperty].
 *
 * @param column the data column to map to the size.
 * @param parameters optional lambda to configure additional scale parameters.
 * @return a [NonPositionalMapping] object representing the mapping.
 */


public fun stroke ( column : String , parameters : LetsPlotNonPositionalMappingParametersContinuous < Any ? , Double > . ( ) -> Unit = { } ) : NonPositionalMapping < Any ? , Double >

{ <EOL> return addNonPositionalMapping ( STROKE , column , LetsPlotNonPositionalMappingParametersContinuous < Any ? , Double > ( ) . apply ( parameters ) ) <EOL> }

/**
 * Maps the `stroke` aesthetic to a data column by [String].
 *
 * @param column the data column to map to the size.
 * @param parameters optional lambda to configure additional scale parameters.
 * @return a [NonPositionalMapping] object representing the mapping.
 */


public fun < T > stroke ( values : Iterable < T > , name : String ? = null , parameters : LetsPlotNonPositionalMappingParametersContinuous < T , Double > . ( ) -> Unit = { } ) : NonPositionalMapping < T , Double >

{ <EOL> return addNonPositionalMapping ( STROKE , values . toList ( ) , name , LetsPlotNonPositionalMappingParametersContinuous < T , Double > ( ) . apply ( parameters ) ) <EOL> }

/**
 * Maps the `stroke` aesthetic to iterable of discrete values.
 *
 * @param values the iterable containing the discrete values.
 * @param name optional name for this aesthetic mapping.
 * @param parameters optional lambda to configure additional scale parameters.
 * @return a [NonPositionalMapping] object representing the mapping.
 */


public fun < T > stroke ( values : DataColumn < T > , parameters : LetsPlotNonPositionalMappingParametersContinuous < T , Double > . ( ) -> Unit = { } ) : NonPositionalMapping < T , Double >

{ <EOL> return addNonPositionalMapping ( STROKE , values , LetsPlotNonPositionalMappingParametersContinuous < T , Double > ( ) . apply ( parameters ) ) <EOL> }

/**
 * Maps the `stroke` aesthetic to a data column.
 *
 * @param values the data column to map to the size.
 * @param parameters optional lambda to configure additional scale parameters.
 * @return a [NonPositionalMapping] object representing the mapping.
 */


fun legacyStdlibJdkDependencies ( version : String = "<STR_LIT>" )

= listOf ( binaryCoordinates ( "<STR_LIT>" ) , binaryCoordinates ( "<STR_LIT>" ) , )

/**
 * Legacy -jdk8 and -jdk7 dependencies:
 * Those artifacts will be published as empty jars starting from Kotlin 1.8.0 as
 * the classes will be included in the kotlin-stdlib artifact already.
 *
 * Note: The kotlin-stdlib will add a constraint to always resolve 1.8.0 of those artifacts.
 * This will be necessary in the future, when no more jdk8 or jdk7 artifacts will be published:
 * In this case we need to still resolve to a version that will contain empty artifacts (1.8.0)
 *
 */


@ PublishedApi <EOL> internal fun < T > arrayConcat ( vararg args : T ) : T

{ <EOL> val len = args . size <EOL> val typed = js ( "<STR_LIT>" ) . unsafeCast < Array < T > > ( ) <EOL> for ( i in <NUM_LIT:0> .. ( len - <NUM_LIT:1> ) ) { <EOL> val arr = args [ i ] <EOL> if ( arr !is Array < * > ) { <EOL> typed [ i ] = js ( "<STR_LIT>" ) . slice . call ( arr ) <EOL> } else { <EOL> typed [ i ] = arr <EOL> } <EOL> } <EOL> return js ( "<STR_LIT>" ) . concat . apply ( js ( "<STR_LIT>" ) , typed ) ; <EOL> }

/** Concat regular Array's and TypedArray's into an Array.
 */


@ PublishedApi <EOL> internal fun < T > primitiveArrayConcat ( vararg args : T ) : T

{ <EOL> var size_local = <NUM_LIT:0> <EOL> for ( i in <NUM_LIT:0> .. ( args . size - <NUM_LIT:1> ) ) { <EOL> size_local += args [ i ] . unsafeCast < Array < Any ? > > ( ) . size <EOL> } <EOL> val a = args [ <NUM_LIT:0> ] <EOL> val result = js ( "<STR_LIT>" ) . unsafeCast < Array < Any ? > > ( ) <EOL> if ( a . asDynamic ( ) . `$type$` != null ) { <EOL> withType ( a . asDynamic ( ) . `$type$` , result ) <EOL> } <EOL> size_local = <NUM_LIT:0> <EOL> for ( i in <NUM_LIT:0> .. ( args . size - <NUM_LIT:1> ) ) { <EOL> val arr = args [ i ] . unsafeCast < Array < Any ? > > ( ) <EOL> for ( j in <NUM_LIT:0> .. ( arr . size - <NUM_LIT:1> ) ) { <EOL> result [ size_local ++ ] = arr [ j ] <EOL> } <EOL> } <EOL> return result . unsafeCast < T > ( ) <EOL> }

/** Concat primitive arrays. Main use: prepare vararg arguments.
 */


fun isOverridable ( superMember : MemberWithOriginal , subMember : MemberWithOriginal , ) : Result

/**
 * Determines whether [superMember] is overridable by [subMember]. The returned result can be one of the following:
 *
 * - [Result.OVERRIDABLE] means that it is definitely overridable, and neither the general override checking algorithm, nor other
 * external overridability conditions can refute that.
 * - [Result.INCOMPATIBLE] means that it is not overridable, but it's OK to have both declarations available in the same class because
 * they don't cause a conflict.
 * - [Result.UNKNOWN] means that this overridability condition cannot claim anything about the overridability, and the final result
 * will be based on the general override checking algorithm and the other external overridability conditions.
 */


internal fun MethodNode . alternateDefaultSignature ( className : String ) : JvmMethodSignature ?

{ <EOL> return when { <EOL> access and Opcodes . ACC_SYNTHETIC == <NUM_LIT:0> -> null <EOL> name == "<STR_LIT:<init>>" && "<STR_LIT>" in desc -> <EOL> JvmMethodSignature ( name , desc . replace ( "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> name . endsWith ( "<STR_LIT>" ) && "<STR_LIT>" in desc -> <EOL> JvmMethodSignature ( name . removeSuffix ( "<STR_LIT>" ) , desc . replace ( "<STR_LIT>" , "<STR_LIT:)>" ) . replace ( "<STR_LIT>" , "<STR_LIT:(>" ) ) <EOL> else -> null <EOL> } <EOL> }

/**
 * Calculates the signature of this method without default parameters
 *
 * Returns `null` if this method isn't an entry point of a function
 * or a constructor with default parameters.
 * Returns an incorrect result, if there are more than 31 default parameters.
 */


= runTest { <EOL> val d = CompletableDeferred < Nothing > ( ) <EOL> d . completeExceptionally ( TestException ( ) ) <EOL> val d2 = CompletableDeferred ( <NUM_LIT:42> ) <EOL> assertFailsWith < TestException > { <EOL> select { <EOL> d . onAwait { expectUnreached ( ) } <EOL> d2 . onAwait { <NUM_LIT:4> } <EOL> } <EOL> } <EOL> }

/**
 * Tests that completing a [Deferred] with an exception will cause the [select] that uses [Deferred.onAwait]
 * to throw the same exception.
 */


override fun hasConsumed ( matchResult : MatchResultImpl ) : Boolean

= false

/** Returns false, because word boundary does not consumes any characters and do not move string index. */


private fun tryGenerateInteropConstantRead ( expression : IrCall ) : IrExpression ?

{ <EOL> val function = expression . symbol . owner <EOL> if ( ! function . isFromInteropLibrary ( ) ) return null <EOL> if ( ! function . isGetter ) return null <EOL> val constantProperty = function . correspondingPropertySymbol ? . owner ? . takeIf { it . isConst } ? : return null <EOL> val initializer = constantProperty . backingField ? . initializer ? . expression <EOL> require ( initializer is IrConst < * > ) { renderCompilerError ( expression ) } <EOL> return initializer . shallowCopy ( ) <EOL> }

/**
 * Handle `const val`s that come from interop libraries.
 *
 * We extract constant value from the backing field, and replace getter invocation with it.
 */


fun autoreleaseAndRet ( value : LLVMValueRef )

{ <EOL> onReturn ( ) <EOL> val result = call ( objCExportCodegen . objcAutoreleaseReturnValue , listOf ( value ) ) <EOL> LLVMSetTailCall ( result , <NUM_LIT:1> ) <EOL> rawRet ( result ) <EOL> }

/**
 * autoreleases and returns [value].
 * It is equivalent to `ret(autorelease(value))`, but optimizes the autorelease out if the caller is prepared for it.
 *
 * See the Clang documentation and the Obj-C runtime source code for more details:
 * https://clang.llvm.org/docs/AutomaticReferenceCounting.html#arc-runtime-objc-autoreleasereturnvalue
 * https://github.com/opensource-apple/objc4/blob/cd5e62a5597ea7a31dccef089317abb3a661c154/runtime/objc-object.h#L930
 */


inline fun ObjCExportFunctionGenerationContext . convertKotlin ( genValue : ( Lifetime ) -> LLVMValueRef , actualType : IrType , expectedType : IrType , resultLifetime : Lifetime ) : LLVMValueRef

{ <EOL> val conversion = context . getTypeConversion ( actualType , expectedType ) <EOL> ? : return genValue ( resultLifetime ) <EOL> val value = genValue ( Lifetime . ARGUMENT ) <EOL> return callFromBridge ( conversion . owner . llvmFunction , listOf ( value ) , resultLifetime ) <EOL> }

/**
 * Convert [genValue] of Kotlin type from [actualType] to [expectedType] in a bridge method.
 */


private fun ObjCExportCodeGenerator . createReverseAdapter ( irFunction : IrFunction , baseMethod : ObjCMethodSpec . BaseMethod < IrSimpleFunctionSymbol > , vtableIndex : Int ? , itablePlace : ClassLayoutBuilder . InterfaceTablePlace ? <EOL> ) : ObjCExportCodeGenerator . KotlinToObjCMethodAdapter

{ <EOL> val selector = baseMethod . selector <EOL> val kotlinToObjC = generateKotlinToObjCBridge ( irFunction , baseMethod ) . bitcast ( llvm . int8PtrType ) <EOL> return KotlinToObjCMethodAdapter ( selector , itablePlace ? : ClassLayoutBuilder . InterfaceTablePlace . INVALID , vtableIndex ? : - <NUM_LIT:1> , kotlinToObjC ) <EOL> }

/**
 * Reverse adapters are required when Kotlin code invokes virtual method which might be overriden on Objective-C side.
 * Example:
 *
 * ```kotlin
 * interface I {
 * fun foo()
 * }
 *
 * fun usage(i: I) {
 * i.foo() // Here we invoke
 * }
 * ```
 *
 * ```swift
 * class C : I {
 * override func foo() { ... }
 * }
 *
 * FileKt.usage(C()) // C.foo is invoked via reverse method adapter.
 * ```
 */


private fun ObjCExportCodeGenerator . createMethodVirtualAdapter ( baseMethod : ObjCMethodSpec . BaseMethod < IrSimpleFunctionSymbol > ) : ObjCExportCodeGenerator . ObjCToKotlinMethodAdapter

{ <EOL> val selector = baseMethod . selector <EOL> val methodBridge = baseMethod . bridge <EOL> val irFunction = baseMethod . owner <EOL> val imp = generateObjCImp ( irFunction , irFunction , methodBridge , isVirtual = true ) <EOL> return objCToKotlinMethodAdapter ( selector , methodBridge , imp ) <EOL> }

/**
 * We need to generate indirect version of a method for a cases
 * when it is called on an object of non-exported type.
 *
 * Consider the following example:
 * file.kt:
 * ```
 * open class Foo {
 * open fun foo() {}
 * }
 * private class Bar : Foo() {
 * override fun foo() {}
 * }
 *
 * fun createBar(): Foo = Bar()
 * ```
 * file.swift:
 * ```
 * FileKt.createBar().foo()
 * ```
 * There is no Objective-C typeinfo for `Bar`, thus `foo` will be called via method lookup.
 */


/**
 * [WithGenerics.<caret_1>intExt]
 * [WithGenerics.<caret_2>stringExt]
 */


protected fun Constraint . resolveWithProperties ( ) : Constraint

{ <EOL> val copy = this . resolve ( ) <EOL> if ( copy is PropertyOwner ) { <EOL> modifiedProperties . forEach { ( name , constraint ) -> <EOL> copy [ name ] = constraint <EOL> } <EOL> } <EOL> return copy . resolve ( ) <EOL> }

/**
 * Called at resolving stage,
 * to apply properties to the resolved reference.
 */


= true

/**
 * Returns `true` if this preprocessor accepts the given [code]
 */


fun process ( code : String , host : KotlinKernelHost , ) : Result


fun < T : Number > lcm ( x1 : KtNDArray < T > , x2 : KtNDArray < T > ) : KtNDArray < T >

= <EOL> callFunc ( nameMethod = arrayOf ( "<STR_LIT>" ) , args = arrayOf ( x1 , x2 ) )

/**
 * Returns the lowest common multiple of |x1| and |x2|
 */


fun < T : Number > gcd ( x1 : KtNDArray < T > , x2 : KtNDArray < T > ) : KtNDArray < T >

/**
 * Returns the greatest common divisor of |x1| and |x2|
 */


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

/**
 * optional .org.jetbrains.kotlin.gradle.idea.proto.generated.IdeaExtrasProto extras = 1;
 */


{ <EOL> return _builder . hasExtras ( ) <EOL> }

/**
 * optional .org.jetbrains.kotlin.gradle.idea.proto.generated.IdeaExtrasProto extras = 1;
 * @return Whether the extras field is set.
 */


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

/**
 * optional .org.jetbrains.kotlin.gradle.idea.proto.generated.tcs.IdeaKotlinSourceDependencyProto.Type type = 2;
 */


{ <EOL> return _builder . hasType ( ) <EOL> }

/**
 * optional .org.jetbrains.kotlin.gradle.idea.proto.generated.tcs.IdeaKotlinSourceDependencyProto.Type type = 2;
 * @return Whether the type field is set.
 */


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

/**
 * optional .org.jetbrains.kotlin.gradle.idea.proto.generated.tcs.IdeaKotlinSourceCoordinatesProto coordinates = 3;
 */


fun hasCoordinates ( ) : kotlin . Boolean

{ <EOL> return _builder . hasCoordinates ( ) <EOL> }

/**
 * optional .org.jetbrains.kotlin.gradle.idea.proto.generated.tcs.IdeaKotlinSourceCoordinatesProto coordinates = 3;
 * @return Whether the coordinates field is set.
 */


@ OptIn ( SymbolInternals :: class ) <EOL> private fun FirStatement . isDelegatedPropertySelfAccess ( context : CheckerContext , referencedSymbol : FirBasedSymbol < * > ) : Boolean

{ <EOL> if ( source ? . kind != KtFakeSourceElementKind . DelegatedPropertyAccessor ) return false <EOL> val containers = context . containingDeclarations <EOL> val size = containers . size <EOL> val fir = referencedSymbol . fir <EOL> return containers . getOrNull ( size - <NUM_LIT:1> ) == fir <EOL> || containers . getOrNull ( size - <NUM_LIT:2> ) == fir <EOL> }

/** Checks if this is an access to a delegated property inside the delegated property itself.
 * Deprecations shouldn't be reported here. */


fun FirFunction . constructFunctionType ( kind : FunctionTypeKind ? = null ) : ConeLookupTagBasedType

{ <EOL> val receiverTypeRef = when ( this ) { <EOL> is FirSimpleFunction -> receiverParameter <EOL> is FirAnonymousFunction -> receiverParameter <EOL> else -> null <EOL> } ? . typeRef <EOL> val parameters = valueParameters . map { <EOL> it . returnTypeRef . coneTypeSafe < ConeKotlinType > ( ) ? : ConeErrorType ( ConeSimpleDiagnostic ( "<STR_LIT>" , DiagnosticKind . ValueParameterWithNoTypeAnnotation ) ) <EOL> } <EOL> val rawReturnType = ( this as FirCallableDeclaration ) . returnTypeRef . coneType <EOL> return createFunctionType ( kind ? : FunctionTypeKind . Function , parameters , receiverTypeRef ? . coneType , rawReturnType , contextReceivers = contextReceivers . map { it . typeRef . coneType } ) <EOL> }

/**
 * [kind] == null means that [FunctionTypeKind.Function] will be used
 */


fun FirAnonymousFunction . constructFunctionTypeRef ( session : FirSession , kind : FunctionTypeKind ? = null ) : FirResolvedTypeRef

{ <EOL> var diagnostic : ConeDiagnostic ? = null <EOL> val kinds = session . functionTypeService . extractAllSpecialKindsForFunction ( symbol ) <EOL> val kindFromDeclaration = when ( kinds . size ) { <EOL> <NUM_LIT:0> -> null <EOL> <NUM_LIT:1> -> kinds . single ( ) <EOL> else -> { <EOL> diagnostic = ConeAmbiguousFunctionTypeKinds ( kinds ) <EOL> FunctionTypeKind . Function <EOL> } <EOL> } <EOL> val type = constructFunctionType ( kindFromDeclaration ? : kind ) <EOL> val source = this@constructFunctionTypeRef . source ? . fakeElement ( KtFakeSourceElementKind . ImplicitTypeRef ) <EOL> return if ( diagnostic == null ) { <EOL> buildResolvedTypeRef { <EOL> this . source = source <EOL> this . type = type <EOL> } <EOL> } else { <EOL> buildErrorTypeRef { <EOL> this . source = source <EOL> this . type = type <EOL> this . diagnostic = diagnostic <EOL> } <EOL> } <EOL> }


internal fun FirFunction . forbiddenNamedArgumentsTargetOrNull ( originScope : FirTypeScope ? ) : ForbiddenNamedArgumentsTarget ?

{ <EOL> if ( hasStableParameterNames ) return null <EOL> return when ( origin ) { <EOL> FirDeclarationOrigin . ImportedFromObjectOrStatic -> <EOL> importedFromObjectOrStaticData ? . original ? . forbiddenNamedArgumentsTargetOrNullIgnoringOverridden ( ) <EOL> FirDeclarationOrigin . IntersectionOverride , is FirDeclarationOrigin . SubstitutionOverride , FirDeclarationOrigin . Delegated -> { <EOL> val initial = unwrapFakeOverridesOrDelegated ( ) . forbiddenNamedArgumentsTargetOrNullIgnoringOverridden ( ) ? : return null <EOL> initial . takeUnless { symbol . hasOverrideThatAllowsNamedArguments ( originScope ) } <EOL> } <EOL> FirDeclarationOrigin . Enhancement -> { <EOL> ForbiddenNamedArgumentsTarget . NON_KOTLIN_FUNCTION . takeUnless { symbol . hasOverrideThatAllowsNamedArguments ( originScope ) } <EOL> } <EOL> FirDeclarationOrigin . BuiltIns -> ForbiddenNamedArgumentsTarget . INVOKE_ON_FUNCTION_TYPE <EOL> is FirDeclarationOrigin . Plugin -> null <EOL> else -> ForbiddenNamedArgumentsTarget . NON_KOTLIN_FUNCTION <EOL> } <EOL> }

/**
 * Returns a non-null value when named arguments are forbidden for calls to this function.
 *
 * When [originScope] is provided, overrides of the function will be checked.
 * If one of the overridden functions allows named arguments, `null` will be returned.
 *
 * One example of this behavior is a Java function that overrides a Kotlin function.
 * In this case, `null` will be returned, if [originScope] is provided.
 * Otherwise, [ForbiddenNamedArgumentsTarget.NON_KOTLIN_FUNCTION] will be returned.
 *
 * To check if a function allows named arguments regardless of its overrides, it is recommended to use
 * [FirFunction.areNamedArgumentsForbiddenIgnoringOverridden].
 */


private fun isEqualBound ( overrideBound : FirTypeRef , baseBound : FirTypeRef , overrideTypeParameter : FirTypeParameter , baseTypeParameter : FirTypeParameter , substitutor : ConeSubstitutor ) : Boolean

{ <EOL> val substitutedOverrideType = substitutor . substituteOrSelf ( overrideBound . coneType ) <EOL> val substitutedBaseType = substitutor . substituteOrSelf ( baseBound . coneType ) <EOL> if ( AbstractTypeChecker . equalTypes ( context , substitutedOverrideType , substitutedBaseType ) ) return true <EOL> return overrideTypeParameter . symbol . resolvedBounds . any { bound -> <EOL> isEqualTypes ( bound . coneType , substitutedBaseType , substitutor ) <EOL> } && <EOL> baseTypeParameter . symbol . resolvedBounds . any { bound -> isEqualTypes ( bound . coneType , substitutedOverrideType , substitutor ) } <EOL> }

/**
 * Good case complexity is O(1)
 * Worst case complexity is O(N), where N is number of type-parameter bound's
 */


{ <EOL> fun FqName . escapeSlashes ( ) : String { <EOL> val res = asString ( ) <EOL> if ( res . contains ( '<CHAR_LIT:/>' ) ) { <EOL> return "<STR_LIT>" <EOL> } <EOL> return res <EOL> } <EOL> return if ( packageFqName . isRoot ) { <EOL> relativeClassName . escapeSlashes ( ) <EOL> } else { <EOL> buildString { <EOL> append ( packageFqName . asString ( ) . replace ( '<CHAR_LIT:.>' , '<CHAR_LIT:/>' ) ) <EOL> append ( "<STR_LIT:/>" ) <EOL> append ( relativeClassName . escapeSlashes ( ) ) <EOL> } <EOL> } <EOL> }

/**
 * @return a string where packages are delimited by '/' and classes by '.', e.g. "kotlin/Map.Entry"
 */


@ JvmOverloads <EOL> @ JvmStatic <EOL> fun fromString ( string : String , isLocal : Boolean = false ) : ClassId

{ <EOL> val tickIndex = string . indexOf ( '<CHAR_LIT>' ) <EOL> val lastSlashIndex = string . lastIndexOf ( "<STR_LIT:/>" , if ( tickIndex == - <NUM_LIT:1> ) string . length else tickIndex ) <EOL> val packageName : String <EOL> val className : String <EOL> if ( lastSlashIndex == - <NUM_LIT:1> ) { <EOL> packageName = "<STR_LIT>" <EOL> className = string . replace ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> } else { <EOL> packageName = string . substring ( <NUM_LIT:0> , lastSlashIndex ) . replace ( '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) <EOL> className = string . substring ( lastSlashIndex + <NUM_LIT:1> ) . replace ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> } <EOL> return ClassId ( FqName ( packageName ) , FqName ( className ) , isLocal ) <EOL> }

/**
 * @param string a string where packages are delimited by '/' and classes by '.', e.g. "kotlin/Map.Entry".
 * If class name contains slashes, it should be put into ticks, e.g. "package/`test/test`"
 */


@ OptIn ( ExperimentalContracts :: class ) <EOL> public suspend inline fun < R > select ( crossinline builder : SelectBuilder < R > . ( ) -> Unit ) : R

{ <EOL> contract { <EOL> callsInPlace ( builder , InvocationKind . EXACTLY_ONCE ) <EOL> } <EOL> return SelectImplementation < R > ( coroutineContext ) . run { <EOL> builder ( this ) <EOL> doSelect ( ) <EOL> } <EOL> }

/**
 * Waits for the result of multiple suspending functions simultaneously, which are specified using _clauses_
 * in the [builder] scope of this select invocation. The caller is suspended until one of the clauses
 * is either _selected_ or _fails_.
 *
 * At most one clause is *atomically* selected and its block is executed. The result of the selected clause
 * becomes the result of the select. If any clause _fails_, then the select invocation produces the
 * corresponding exception. No clause is selected in this case.
 *
 * This select function is _biased_ to the first clause. When multiple clauses can be selected at the same time,
 * the first one of them gets priority. Use [selectUnbiased] for an unbiased (randomized) selection among
 * the clauses.

 * There is no `default` clause for select expression. Instead, each selectable suspending function has the
 * corresponding non-suspending version that can be used with a regular `when` expression to select one
 * of the alternatives or to perform the default (`else`) action if none of them can be immediately selected.
 *
 * ### List of supported select methods
 *
 * | **Receiver** | **Suspending function** | **Select clause**
 * | ---------------- | --------------------------------------------- | -----------------------------------------------------
 * | [Job] | [join][Job.join] | [onJoin][Job.onJoin]
 * | [Deferred] | [await][Deferred.await] | [onAwait][Deferred.onAwait]
 * | [SendChannel] | [send][SendChannel.send] | [onSend][SendChannel.onSend]
 * | [ReceiveChannel] | [receive][ReceiveChannel.receive] | [onReceive][ReceiveChannel.onReceive]
 * | [ReceiveChannel] | [receiveCatching][ReceiveChannel.receiveCatching] | [onReceiveCatching][ReceiveChannel.onReceiveCatching]
 * | none | [delay] | [onTimeout][SelectBuilder.onTimeout]
 *
 * This suspending function is cancellable: if the [Job] of the current coroutine is cancelled while this
 * suspending function is waiting, this function immediately resumes with [CancellationException].
 * There is a **prompt cancellation guarantee**: even if this function is ready to return the result, but was cancelled
 * while suspended, [CancellationException] will be thrown. See [suspendCancellableCoroutine] for low-level details.
 *
 * Note that this function does not check for cancellation when it is not suspended.
 * Use [yield] or [CoroutineScope.isActive] to periodically check for cancellation in tight loops if needed.
 */


public operator fun SelectClause0 . invoke ( block : suspend ( ) -> R )

/**
 * Registers a clause in this [select] expression without additional parameters that does not select any value.
 */


public operator fun < Q > SelectClause1 < Q > . invoke ( block : suspend ( Q ) -> R )

/**
 * Registers clause in this [select] expression without additional parameters that selects value of type [Q].
 */


public operator fun < P , Q > SelectClause2 < P , Q > . invoke ( param : P , block : suspend ( Q ) -> R )

/**
 * Registers clause in this [select] expression with additional parameter of type [P] that selects value of type [Q].
 */


public operator fun < P , Q > SelectClause2 < P ? , Q > . invoke ( block : suspend ( Q ) -> R ) : Unit

= invoke ( null , block )

/**
 * Registers clause in this [select] expression with additional nullable parameter of type [P]
 * with the `null` value for this parameter that selects value of type [Q].
 */


@ ExperimentalCoroutinesApi <EOL> @ Suppress ( "<STR_LIT:INVISIBLE_REFERENCE>" , "<STR_LIT:INVISIBLE_MEMBER>" ) <EOL> @ LowPriorityInOverloadResolution <EOL> @ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . ERROR , replaceWith = ReplaceWith ( expression = "<STR_LIT>" , imports = [ "<STR_LIT>" ] ) ) <EOL> public fun onTimeout ( timeMillis : Long , block : suspend ( ) -> R ) : Unit

= onTimeout ( timeMillis , 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.
 */


public fun trySelect ( clauseObject : Any , result : Any ? ) : Boolean

/**
 * This function should be called by other operations,
 * which are trying to perform a rendezvous with this `select`.
 * Returns `true` if the rendezvous succeeds, `false` otherwise.
 *
 * Note that according to the current implementation, a rendezvous attempt can fail
 * when either another clause is already selected or this `select` is still in
 * REGISTRATION phase. To distinguish the reasons, [SelectImplementation.trySelectDetailed]
 * function can be used instead.
 */


public fun disposeOnCompletion ( disposableHandle : DisposableHandle )

/**
 * When this `select` instance is stored as a waiter, the specified [handle][disposableHandle]
 * defines how the stored `select` should be removed in case of cancellation or another clause selection.
 */


public fun selectInRegistrationPhase ( internalResult : Any ? )

/**
 * When a clause becomes selected during registration, the corresponding internal result
 * (which is further passed to the clause's [ProcessResultFunction]) should be provided
 * via this function. After that, other clause registrations are ignored and [trySelect] fails.
 */


@ PublishedApi <EOL> internal open suspend fun doSelect ( ) : R

= <EOL> if ( isSelected ) complete ( ) <EOL> else doSelectSuspend ( )

/**
 * This function is called after the [SelectBuilder] is applied. In case one of the clauses is already selected,
 * the algorithm applies the corresponding [ProcessResultFunction] and invokes the user-specified [block][ClauseData.block].
 * Otherwise, it moves this `select` to WAITING phase (re-registering clauses if needed), suspends until a rendezvous
 * is happened, and then completes the operation by applying the corresponding [ProcessResultFunction] and
 * invoking the user-specified [block][ClauseData.block].
 */


@ JvmName ( "<STR_LIT>" ) <EOL> internal fun ClauseData . register ( reregister : Boolean = false )

{ <EOL> assert { state . value !== STATE_CANCELLED } <EOL> if ( state . value . let { it is SelectImplementation < * > . ClauseData } ) return <EOL> if ( ! reregister ) checkClauseObject ( clauseObject ) <EOL> if ( tryRegisterAsWaiter ( this @ SelectImplementation ) ) { <EOL> if ( ! reregister ) clauses ! ! += this <EOL> disposableHandleOrSegment = this@SelectImplementation . disposableHandleOrSegment <EOL> indexInSegment = this@SelectImplementation . indexInSegment <EOL> this@SelectImplementation . disposableHandleOrSegment = null <EOL> this@SelectImplementation . indexInSegment = - <NUM_LIT:1> <EOL> } else { <EOL> state . value = this <EOL> } <EOL> }

/**
 * Attempts to register this `select` clause. If another clause is already selected,
 * this function does nothing and completes immediately.
 * Otherwise, it registers this `select` instance in
 * the [clause object][ClauseData.clauseObject]
 * according to the provided [registration function][ClauseData.regFunc].
 * On success, this `select` instance is stored as a waiter
 * in the clause object -- the algorithm also stores
 * the provided via [disposeOnCompletion] completion action
 * and adds the clause to the list of registered one.
 * In case of registration failure, the internal result
 * (not processed by [ProcessResultFunction] yet) must be
 * provided via [selectInRegistrationPhase] -- the algorithm
 * updates the state to this clause reference.
 */


private fun checkClauseObject ( clauseObject : Any )

{ <EOL> val clauses = clauses ! ! <EOL> check ( clauses . none { it . clauseObject === clauseObject } ) { <EOL> "<STR_LIT>" <EOL> } <EOL> }

/**
 * Checks that there does not exist another clause with the same object.
 */


override fun invokeOnCancellation ( segment : Segment < * > , index : Int )

{ <EOL> this . disposableHandleOrSegment = segment <EOL> this . indexInSegment = index <EOL> }

/**
 * An optimized version for the code below that does not allocate
 * a cancellation handler object and efficiently stores the specified
 * [segment] and [index].
 *
 * ```
 * disposeOnCompletion {
 * segment.onCancellation(index, null)
 * }
 * ```
 */


private suspend fun waitUntilSelected ( )

= suspendCancellableCoroutine < Unit > sc @ { cont -> <EOL> state . loop { curState -> <EOL> when { <EOL> curState === STATE_REG -> if ( state . compareAndSet ( curState , cont ) ) { <EOL> cont . invokeOnCancellation ( this ) <EOL> return@sc <EOL> } <EOL> curState is List < * > -> if ( state . compareAndSet ( curState , STATE_REG ) ) { <EOL> @ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> curState as List < Any > <EOL> curState . forEach { reregisterClause ( it ) } <EOL> } <EOL> curState is SelectImplementation < * > . ClauseData -> { <EOL> cont . resume ( Unit , curState . createOnCancellationAction ( this , internalResult ) ) <EOL> return@sc <EOL> } <EOL> else -> error ( "<STR_LIT>" ) <EOL> } <EOL> } <EOL> }

/**
 * Suspends and waits until some clause is selected. However, it is possible for a concurrent
 * coroutine to invoke [trySelect] while this `select` is still in REGISTRATION phase.
 * In this case, [trySelect] marks the corresponding select clause to be re-registered, and
 * this function performs registration of such clauses. After that, it atomically stores
 * the continuation into the [state] field if there is no more clause to be re-registered.
 */


private fun reregisterClause ( clauseObject : Any )

{ <EOL> val clause = findClause ( clauseObject ) ! ! <EOL> clause . disposableHandleOrSegment = null <EOL> clause . indexInSegment = - <NUM_LIT:1> <EOL> clause . register ( reregister = true ) <EOL> }

/**
 * Re-registers the clause with the specified
 * [clause object][clauseObject] after unsuccessful
 * [trySelect] of this clause while the `select`
 * was still in REGISTRATION phase.
 */


fun trySelectDetailed ( clauseObject : Any , result : Any ? )

= <EOL> TrySelectDetailedResult ( trySelectInternal ( clauseObject , result ) )

/**
 * Similar to [trySelect] but provides a failure reason
 * if this rendezvous is unsuccessful. We need this function
 * in the channel implementation.
 */


private fun findClause ( clauseObject : Any ) : ClauseData ?

{ <EOL> val clauses = this . clauses ? : return null <EOL> return clauses . find { it . clauseObject === clauseObject } <EOL> ? : error ( "<STR_LIT>" ) <EOL> }

/**
 * Finds the clause with the corresponding [clause object][SelectClause.clauseObject].
 * If the reference to the list of clauses is already cleared due to completion/cancellation,
 * this function returns `null`
 */


{ <EOL> assert { isSelected } <EOL> @ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> val selectedClause = state . value as SelectImplementation < R > . ClauseData <EOL> val internalResult = this . internalResult <EOL> cleanup ( selectedClause ) <EOL> return if ( ! RECOVER_STACK_TRACES ) { <EOL> val blockArgument = selectedClause . processResult ( internalResult ) <EOL> selectedClause . invokeBlock ( blockArgument ) <EOL> } else { <EOL> processResultAndInvokeBlockRecoveringException ( selectedClause , internalResult ) <EOL> } <EOL> }

/**
 * Completes this `select` operation after the internal result is provided
 * via [SelectInstance.trySelect] or [SelectInstance.selectInRegistrationPhase].
 * (1) First, this function applies the [ProcessResultFunction] of the selected clause
 * to the internal result.
 * (2) After that, the [clean-up procedure][cleanup]
 * is called to remove this `select` instance from other clause objects, and
 * make it possible to collect it by GC after this `select` finishes.
 * (3) Finally, the user-specified block is invoked
 * with the processed result as an argument.
 */


private fun cleanup ( selectedClause : ClauseData )

{ <EOL> assert { state . value == selectedClause } <EOL> val clauses = this . clauses ? : return <EOL> clauses . forEach { clause -> <EOL> if ( clause !== selectedClause ) clause . dispose ( ) <EOL> } <EOL> this . state . value = STATE_COMPLETED <EOL> this . internalResult = NO_RESULT <EOL> this . clauses = null <EOL> }

/**
 * Invokes all [DisposableHandle]-s provided via
 * [SelectInstance.disposeOnCompletion] during
 * clause registrations.
 */


fun tryRegisterAsWaiter ( select : SelectImplementation < R > ) : Boolean

{ <EOL> assert { select . inRegistrationPhase || select . isCancelled } <EOL> assert { select . internalResult === NO_RESULT } <EOL> regFunc ( clauseObject , select , param ) <EOL> return select . internalResult === NO_RESULT <EOL> }

/**
 * Tries to register the specified [select] instance in [clauseObject] and check
 * whether the registration succeeded or a rendezvous has happened during the registration.
 * This function returns `true` if this [select] is successfully registered and
 * is _waiting_ for a rendezvous, or `false` when this clause becomes
 * selected during registration.
 *
 * For example, the [Channel.onReceive] clause registration
 * on a non-empty channel retrieves the first element and completes
 * the corresponding [select] via [SelectInstance.selectInRegistrationPhase].
 */


= processResFunc ( clauseObject , param , result )

/**
 * Processes the internal result provided via either
 * [SelectInstance.selectInRegistrationPhase] or
 * [SelectInstance.trySelect] and returns an argument
 * for the user-specified [block].
 *
 * Importantly, this function may throw an exception
 * (e.g., when the channel is closed in [Channel.onSend], the
 * corresponding [ProcessResultFunction] is bound to fail).
 */


@ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> suspend fun invokeBlock ( argument : Any ? ) : R

{ <EOL> val block = block <EOL> return if ( this . param === PARAM_CLAUSE_0 ) { <EOL> block as suspend ( ) -> R <EOL> block ( ) <EOL> } else { <EOL> block as suspend ( Any ? ) -> R <EOL> block ( argument ) <EOL> } <EOL> }

/**
 * Invokes the user-specified block and returns
 * the final result of this `select` clause.
 */


private fun JsNode . match ( predicate : ( JsNode ) -> Boolean ) : Set < JsNode >

{ <EOL> val visitor = object : JsExpressionVisitor ( ) { <EOL> val matched = IdentitySet < JsNode > ( ) <EOL> override fun < R : JsNode > doTraverse ( node : R , ctx : JsContext < JsNode > ? ) { <EOL> super . doTraverse ( node , ctx ) <EOL> if ( node !in matched && predicate ( node ) ) { <EOL> matched . add ( node ) <EOL> } <EOL> } <EOL> } <EOL> visitor . accept ( this ) <EOL> return visitor . matched <EOL> }

/**
 * Returns descendants of receiver, matched by [predicate].
 */


private fun JsNode . withParentsOfNodes ( nodes : Set < JsNode > ) : Set < JsNode >

{ <EOL> val visitor = object : JsExpressionVisitor ( ) { <EOL> private val stack = SmartList < JsNode > ( ) <EOL> val matched = IdentitySet < JsNode > ( ) <EOL> override fun < R : JsNode > doTraverse ( node : R , ctx : JsContext < JsNode > ? ) { <EOL> stack . add ( node ) <EOL> super . doTraverse ( node , ctx ) <EOL> if ( node in nodes ) { <EOL> addAllUntilMatchedOrStatement ( stack ) <EOL> } <EOL> stack . removeAt ( stack . lastIndex ) <EOL> } <EOL> fun addAllUntilMatchedOrStatement ( nodesOnStack : List < JsNode > ) { <EOL> for ( i in nodesOnStack . lastIndex downTo <NUM_LIT:0> ) { <EOL> val currentNode = nodesOnStack [ i ] <EOL> if ( currentNode in matched ) break <EOL> matched . add ( currentNode ) <EOL> if ( currentNode is JsStatement ) break <EOL> } <EOL> } <EOL> } <EOL> visitor . accept ( this ) <EOL> return visitor . matched <EOL> }

/**
 * Returns set of nodes, that satisfy transitive closure of `is parent` relation, starting from [nodes].
 */


public fun getCallableSignatures ( nameFilter : KtScopeNameFilter = { true } ) : Sequence < KtCallableSignature < * > >

/**
 * Return a sequence of [KtCallableSignature] which current scope contain if declaration name matches [nameFilter].
 */


public fun getCallableSignatures ( names : Collection < Name > ) : Sequence < KtCallableSignature < * > >

/**
 * Return a sequence of [KtCallableSignature] which current scope contain if declaration, if declaration name present in [names]
 *
 * This implementation is more optimal than the one with `nameFilter` and should be used when the candidate name set is known.
 */


public fun getCallableSignatures ( vararg names : Name ) : Sequence < KtCallableSignature < * > >

= withValidityAssertion { <EOL> getCallableSignatures ( names . toList ( ) ) <EOL> }

/**
 * Return a sequence of [KtCallableSignature] which current scope contain if declaration, if declaration name present in [names]
 *
 * @see getCallableSignatures
 */


public fun getClassifierSymbols ( nameFilter : KtScopeNameFilter = { true } ) : Sequence < KtClassifierSymbol >

/**
 * Return a sequence of [KtClassifierSymbol] which current scope contain if classifier name matches [nameFilter]. The sequence includes:
 * nested classes, inner classes, nested type aliases for the class scope, and top-level classes and top-level type aliases for file scope.
 *
 * This function needs to retrieve a set of all possible names before processing the scope.
 * The overload with `names: Collection<Name>` should be used when the candidate name set is known.
 */


public fun getClassifierSymbols ( names : Collection < Name > ) : Sequence < KtClassifierSymbol >

/**
 * Return a sequence of [KtClassifierSymbol] which current scope contains, if classifier name present in [names].
 *
 * The sequence includes: nested classes, inner classes, nested type aliases for the class scope,
 * and top-level classes and top-level type aliases for file scope.
 *
 * This implementation is more optimal than the one with `nameFilter` and should be used when the candidate name set is known.
 */


public fun getClassifierSymbols ( vararg names : Name ) : Sequence < KtClassifierSymbol >

= <EOL> getClassifierSymbols ( names . toList ( ) )

/**
 * Return a sequence of [KtClassifierSymbol] which current scope contains, if classifier name present in [names].
 *
 * @see getClassifierSymbols
 */


public fun getConstructors ( ) : Sequence < KtConstructorSymbol >

/**
 * Return a sequence of [KtConstructorSymbol] which current scope contain
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> public expect fun < T : Comparable < T > > maxOf ( a : T , b : T ) : T

/**
 * Returns the greater of two values.
 *
 * If values are equal, returns the first one.
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> public expect inline fun maxOf ( a : Byte , b : Byte ) : Byte

/**
 * Returns the greater of two values.
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> public expect inline fun maxOf ( a : Short , b : Short ) : Short


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> public expect inline fun maxOf ( a : Int , b : Int ) : Int


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> public expect inline fun maxOf ( a : Long , b : Long ) : Long


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> public expect inline fun maxOf ( a : Float , b : Float ) : Float

/**
 * Returns the greater of two values.
 *
 * If either value is `NaN`, returns `NaN`.
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> public expect inline fun maxOf ( a : Double , b : Double ) : Double


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> public expect fun < T : Comparable < T > > maxOf ( a : T , b : T , c : T ) : T

/**
 * Returns the greater of three values.
 *
 * If there are multiple equal maximal values, returns the first of them.
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public expect inline fun maxOf ( a : Byte , b : Byte , c : Byte ) : Byte

/**
 * Returns the greater of three values.
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public expect inline fun maxOf ( a : Short , b : Short , c : Short ) : Short


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public expect inline fun maxOf ( a : Int , b : Int , c : Int ) : Int


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public expect inline fun maxOf ( a : Long , b : Long , c : Long ) : Long


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public expect inline fun maxOf ( a : Float , b : Float , c : Float ) : Float

/**
 * Returns the greater of three values.
 *
 * If any value is `NaN`, returns `NaN`.
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public expect inline fun maxOf ( a : Double , b : Double , c : Double ) : Double


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> public fun < T > maxOf ( a : T , b : T , c : T , comparator : Comparator < in T > ) : T

{ <EOL> return maxOf ( a , maxOf ( b , c , comparator ) , comparator ) <EOL> }

/**
 * Returns the greater of three values according to the order specified by the given [comparator].
 *
 * If there are multiple equal maximal values, returns the first of them.
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> public fun < T > maxOf ( a : T , b : T , comparator : Comparator < in T > ) : T

{ <EOL> return if ( comparator . compare ( a , b ) >= <NUM_LIT:0> ) a else b <EOL> }

/**
 * Returns the greater of two values according to the order specified by the given [comparator].
 *
 * If values are equal, returns the first one.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public expect fun < T : Comparable < T > > maxOf ( a : T , vararg other : T ) : T

/**
 * Returns the greater of the given values.
 *
 * If there are multiple equal maximal values, returns the first of them.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public expect fun maxOf ( a : Byte , vararg other : Byte ) : Byte

/**
 * Returns the greater of the given values.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public expect fun maxOf ( a : Short , vararg other : Short ) : Short


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public expect fun maxOf ( a : Int , vararg other : Int ) : Int


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public expect fun maxOf ( a : Long , vararg other : Long ) : Long


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public expect fun maxOf ( a : Float , vararg other : Float ) : Float

/**
 * Returns the greater of the given values.
 *
 * If any value is `NaN`, returns `NaN`.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public expect fun maxOf ( a : Double , vararg other : Double ) : Double


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public fun < T > maxOf ( a : T , vararg other : T , comparator : Comparator < in T > ) : T

{ <EOL> var max = a <EOL> for ( e in other ) if ( comparator . compare ( max , e ) < <NUM_LIT:0> ) max = e <EOL> return max <EOL> }

/**
 * Returns the greater of the given values according to the order specified by the given [comparator].
 *
 * If there are multiple equal maximal values, returns the first of them.
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> public expect fun < T : Comparable < T > > minOf ( a : T , b : T ) : T

/**
 * Returns the smaller of two values.
 *
 * If values are equal, returns the first one.
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> public expect inline fun minOf ( a : Byte , b : Byte ) : Byte

/**
 * Returns the smaller of two values.
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> public expect inline fun minOf ( a : Short , b : Short ) : Short


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> public expect inline fun minOf ( a : Int , b : Int ) : Int


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> public expect inline fun minOf ( a : Long , b : Long ) : Long


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> public expect inline fun minOf ( a : Float , b : Float ) : Float

/**
 * Returns the smaller of two values.
 *
 * If either value is `NaN`, returns `NaN`.
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> public expect inline fun minOf ( a : Double , b : Double ) : Double


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> public expect fun < T : Comparable < T > > minOf ( a : T , b : T , c : T ) : T

/**
 * Returns the smaller of three values.
 *
 * If there are multiple equal minimal values, returns the first of them.
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public expect inline fun minOf ( a : Byte , b : Byte , c : Byte ) : Byte

/**
 * Returns the smaller of three values.
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public expect inline fun minOf ( a : Short , b : Short , c : Short ) : Short


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public expect inline fun minOf ( a : Int , b : Int , c : Int ) : Int


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public expect inline fun minOf ( a : Long , b : Long , c : Long ) : Long


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public expect inline fun minOf ( a : Float , b : Float , c : Float ) : Float

/**
 * Returns the smaller of three values.
 *
 * If any value is `NaN`, returns `NaN`.
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public expect inline fun minOf ( a : Double , b : Double , c : Double ) : Double


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> public fun < T > minOf ( a : T , b : T , c : T , comparator : Comparator < in T > ) : T

{ <EOL> return minOf ( a , minOf ( b , c , comparator ) , comparator ) <EOL> }

/**
 * Returns the smaller of three values according to the order specified by the given [comparator].
 *
 * If there are multiple equal minimal values, returns the first of them.
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> public fun < T > minOf ( a : T , b : T , comparator : Comparator < in T > ) : T

{ <EOL> return if ( comparator . compare ( a , b ) <= <NUM_LIT:0> ) a else b <EOL> }

/**
 * Returns the smaller of two values according to the order specified by the given [comparator].
 *
 * If values are equal, returns the first one.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public expect fun < T : Comparable < T > > minOf ( a : T , vararg other : T ) : T

/**
 * Returns the smaller of the given values.
 *
 * If there are multiple equal minimal values, returns the first of them.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public expect fun minOf ( a : Byte , vararg other : Byte ) : Byte

/**
 * Returns the smaller of the given values.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public expect fun minOf ( a : Short , vararg other : Short ) : Short


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public expect fun minOf ( a : Int , vararg other : Int ) : Int


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public expect fun minOf ( a : Long , vararg other : Long ) : Long


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public expect fun minOf ( a : Float , vararg other : Float ) : Float

/**
 * Returns the smaller of the given values.
 *
 * If any value is `NaN`, returns `NaN`.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public expect fun minOf ( a : Double , vararg other : Double ) : Double


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public fun < T > minOf ( a : T , vararg other : T , comparator : Comparator < in T > ) : T

{ <EOL> var min = a <EOL> for ( e in other ) if ( comparator . compare ( min , e ) > <NUM_LIT:0> ) min = e <EOL> return min <EOL> }

/**
 * Returns the smaller of the given values according to the order specified by the given [comparator].
 *
 * If there are multiple equal minimal values, returns the first of them.
 */


public abstract fun renderAsKotlinConstant ( ) : String

/**
 * Constant value represented as Kotlin code. E.g: `1`, `2f, `3u` `null`, `"str"`
 */


operator fun < K , V > Map . Entry < K , V > . component1 ( ) : K

{ <EOL> return key <EOL> }


operator fun < K , V > Map . Entry < K , V > . component2 ( ) : V

{ <EOL> return value <EOL> }


abstract fun run ( config : KonanConfig , environment : KotlinCoreEnvironment )

/**
 * Entry point for compilation pipeline.
 */


@ Deprecated ( "<STR_LIT>" , ReplaceWith ( "<STR_LIT>" ) , DeprecationLevel . WARNING ) <EOL> fun fromProject ( project : Project )

= GradleExecutionContext ( filesProvider = project :: files , javaexec = { spec -> project . javaexec ( spec ) } , logger = project . logger )

/**
 * Executing [KotlinToolRunner] during Gradle Configuration Phase is undesired behaviour.
 * Currently only [KotlinNativeLibraryGenerationRunner] used in this way.
 * It should be fixed as part of KT-51255
 */


fun fromTaskContext ( objectFactory : ObjectFactory , execOperations : ExecOperations , logger : Logger , )

= GradleExecutionContext ( filesProvider = objectFactory . fileCollection ( ) :: from , javaexec = { spec -> execOperations . javaexec ( spec ) } , logger = logger )

/** Gradle Configuration Cache friendly context, should be used inside Task Execution Phase */


override fun printBuildReport ( data : Any , outputFile : File )

{ <EOL> outputFile . bufferedWriter ( ) . use { <EOL> it . write ( gson . toJson ( data ) ) <EOL> } <EOL> }

/**
 * Prints general build information and task/transform build metrics
 */


public inline fun LayerCollectorContext . pie ( block : PieContext . ( ) -> Unit )

{ <EOL> addLayer ( PieContext ( this ) . apply ( block ) ) <EOL> }

/**
 * Adds a new `pie` layer to the plot.
 *
 * The `pie` layer represents categorical data through the angle of pie slices.
 * The size of each slice is proportional to the value it represents.
 *
 * This function creates a context where you can set aesthetic mappings (`aes`) or aesthetic constants.
 * - Mappings are specified by calling methods that correspond to aesthetic names (`aes`).
 * - Constants are directly assigned using properties with the names corresponding to aesthetics.
 * For positional aesthetics, you can use the `.constant()` method.
 *
 * ## Pie Aesthetics
 * * **`x`** - The X-coordinate specifying the center of the pie.
 * * **`y`** - The Y-coordinate specifying the center of the pie.
 * * **`fillColor`** - The color of each pie slice.
 * * **`slice`** - The value each slice represents.
 * * **`hole`** - The radius of the inner hole, creating a donut chart when set.
 * * **`explode`** - The distance to offset slices from the center.
 * * **`size`** - The size of the pie chart.
 * * **`alpha`** - The transparency of the pie slices.
 * * **`stroke`** - The stroke width around each slice.
 * * **`strokeColor`** - The color of the stroke around each slice.
 *
 * ## Example
 *
 * ```kotlin
 * val categories by columnOf("Rent", "Food", "Utilities", "Transportation", "Entertainment")
 * val amounts by columnOf(500.0, 300.0, 150.0, 100.0, 50.0)
 *
 * plot {
 * pie {
 * // Positional settings for the center of the pie chart
 * x.constant(0.5) // Assuming this is the normalized center on the X-axis
 * y.constant(0.5) // Assuming this is the normalized center on the Y-axis
 *
 * slice(amounts) // The values that each slice represents
 *
 * // Non-positional setting for the size of the pie chart
 * size = 30.0 // Assuming this is a normalized size relative to the plot dimensions
 *
 * // Non-positional mapping for the fill color based on the category
 * fillColor(categories) {
 * // Inside this block, you would define the mapping parameters or color scale
 * // e.g., you might want to map each category to a specific color
 * }
 *
 * // Non-positional settings for aesthetics like alpha, stroke, and stroke color
 * alpha = 0.8 // Sets the transparency of the pie slices
 * stroke = 1.0 // Sets the stroke width around each slice
 * strokeColor = Color.BLACK // Sets the color of the stroke around each slice
 *
 * // If you want to create a donut chart, set the hole radius
 * hole = 0.2 // Assuming this creates a hole with radius equal to 20% of the pie chart radius
 *
 * // If you want to "explode" or offset a slice from the center, specify the explode setting
 * explode(listOf(.0, .0, 0.1, .0, .0)) // This would offset the "Utilities" slice by 10% of the pie radius
 * }
 * }
 * ```
 */


fun getSession ( module : KtModule , preferBinary : Boolean = false ) : LLFirSession

{ <EOL> if ( module is KtBinaryModule && ( preferBinary || module is KtSdkModule ) ) { <EOL> return getCachedSession ( module , binaryCache ) { <EOL> createPlatformAwareSessionFactory ( module ) . createBinaryLibrarySession ( module ) <EOL> } <EOL> } <EOL> if ( module is KtDanglingFileModule ) { <EOL> return getDanglingFileCachedSession ( module ) <EOL> } <EOL> return getCachedSession ( module , sourceCache , factory = :: createSession ) <EOL> }

/**
 * Returns the existing session if found, or creates a new session and caches it.
 * Analyzable session will be returned for a library module.
 *
 * Must be called from a read action.
 */


internal fun getSessionNoCaching ( module : KtModule ) : LLFirSession

{ <EOL> return createSession ( module ) <EOL> }

/**
 * Returns a session without caching it.
 * Note that session dependencies are still cached.
 */


fun removeSession ( module : KtModule ) : Boolean

{ <EOL> ApplicationManager . getApplication ( ) . assertWriteAccessAllowed ( ) <EOL> val didSourceSessionExist = removeSessionFrom ( module , sourceCache ) <EOL> val didBinarySessionExist = module is KtBinaryModule && removeSessionFrom ( module , binaryCache ) <EOL> val didDanglingFileSessionExist = module is KtDanglingFileModule && removeSessionFrom ( module , danglingFileSessionCache ) <EOL> val didUnstableDanglingFileSessionExist = module is KtDanglingFileModule && removeSessionFrom ( module , unstableDanglingFileSessionCache ) <EOL> return didSourceSessionExist || didBinarySessionExist || didDanglingFileSessionExist || didUnstableDanglingFileSessionExist <EOL> }

/**
 * Removes the session(s) associated with [module] after it has been invalidated. Must be called in a write action.
 *
 * @return `true` if any sessions were removed.
 */


fun removeAllSessions ( includeLibraryModules : Boolean )

{ <EOL> ApplicationManager . getApplication ( ) . assertWriteAccessAllowed ( ) <EOL> if ( includeLibraryModules ) { <EOL> removeAllSessionsFrom ( sourceCache ) <EOL> removeAllSessionsFrom ( binaryCache ) <EOL> } else { <EOL> removeAllMatchingSessionsFrom ( sourceCache ) { it !is KtBinaryModule && it !is KtLibrarySourceModule } <EOL> } <EOL> removeAllDanglingFileSessions ( ) <EOL> }

/**
 * Removes all sessions after global invalidation. If [includeLibraryModules] is `false`, sessions of library modules will not be
 * removed.
 *
 * [removeAllSessions] must be called in a write action.
 */