private fun pushFilledTail ( root : Array < Any ? > , filledTail : Array < Any ? > , newTail : Array < Any ? > ) : PersistentVector < E >

{ <EOL> if ( size shr LOG_MAX_BUFFER_SIZE > <NUM_LIT:1> shl rootShift ) { <EOL> var newRoot = presizedBufferWith ( root ) <EOL> val newRootShift = rootShift + LOG_MAX_BUFFER_SIZE <EOL> newRoot = pushTail ( newRoot , newRootShift , filledTail ) <EOL> return PersistentVector ( newRoot , newTail , size + <NUM_LIT:1> , newRootShift ) <EOL> } <EOL> val newRoot = pushTail ( root , rootShift , filledTail ) <EOL> return PersistentVector ( newRoot , newTail , size + <NUM_LIT:1> , rootShift ) <EOL> }

/**
 * Appends the specified entirely filled [tail] as a leaf buffer to the next free position in the [root] trie.
 */


private fun pushTail ( root : Array < Any ? > ? , shift : Int , tail : Array < Any ? > ) : Array < Any ? >

{ <EOL> val bufferIndex = indexSegment ( size - <NUM_LIT:1> , shift ) <EOL> val newRootNode = root ? . copyOf ( MAX_BUFFER_SIZE ) ? : arrayOfNulls < Any ? > ( MAX_BUFFER_SIZE ) <EOL> if ( shift == LOG_MAX_BUFFER_SIZE ) { <EOL> newRootNode [ bufferIndex ] = tail <EOL> } else { <EOL> @ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> newRootNode [ bufferIndex ] = pushTail ( newRootNode [ bufferIndex ] as Array < Any ? > ? , shift - LOG_MAX_BUFFER_SIZE , tail ) <EOL> } <EOL> return newRootNode <EOL> }

/**
 * Appends the specified entirely filled [tail] as a leaf buffer to the next free position in the [root] trie.
 * The trie must not be filled entirely.
 */


private fun insertIntoRoot ( root : Array < Any ? > , shift : Int , index : Int , element : Any ? , elementCarry : ObjectRef ) : Array < Any ? >

{ <EOL> val bufferIndex = indexSegment ( index , shift ) <EOL> if ( shift == <NUM_LIT:0> ) { <EOL> val newRoot = if ( bufferIndex == <NUM_LIT:0> ) arrayOfNulls < Any ? > ( MAX_BUFFER_SIZE ) else root . copyOf ( MAX_BUFFER_SIZE ) <EOL> root . copyInto ( newRoot , bufferIndex + <NUM_LIT:1> , bufferIndex , MAX_BUFFER_SIZE_MINUS_ONE ) <EOL> elementCarry . value = root [ MAX_BUFFER_SIZE_MINUS_ONE ] <EOL> newRoot [ bufferIndex ] = element <EOL> return newRoot <EOL> } <EOL> val newRoot = root . copyOf ( MAX_BUFFER_SIZE ) <EOL> val lowerLevelShift = shift - LOG_MAX_BUFFER_SIZE <EOL> @ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> newRoot [ bufferIndex ] = insertIntoRoot ( root [ bufferIndex ] as Array < Any ? > , lowerLevelShift , index , element , elementCarry ) <EOL> for ( i in bufferIndex + <NUM_LIT:1> until MAX_BUFFER_SIZE ) { <EOL> if ( newRoot [ i ] == null ) break <EOL> @ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> newRoot [ i ] = insertIntoRoot ( root [ i ] as Array < Any ? > , lowerLevelShift , <NUM_LIT:0> , elementCarry . value , elementCarry ) <EOL> } <EOL> return newRoot <EOL> }

/**
 * Insert the specified [element] into the [root] trie at the specified trie [index].
 *
 * [elementCarry] contains the last element of this trie that was popped out by the insertion operation.
 *
 * @return new root trie
 */


private fun pullLastBufferFromRoot ( root : Array < Any ? > , rootSize : Int , shift : Int ) : PersistentList < E >

{ <EOL> if ( shift == <NUM_LIT:0> ) { <EOL> val buffer = if ( root . size == MUTABLE_BUFFER_SIZE ) root . copyOf ( MAX_BUFFER_SIZE ) else root <EOL> return SmallPersistentVector ( buffer ) <EOL> } <EOL> val tailCarry = ObjectRef ( null ) <EOL> val newRoot = pullLastBuffer ( root , shift , rootSize - <NUM_LIT:1> , tailCarry ) ! ! <EOL> @ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> val newTail = tailCarry . value as Array < Any ? > <EOL> if ( newRoot [ <NUM_LIT:1> ] == null ) { <EOL> @ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> val lowerLevelRoot = newRoot [ <NUM_LIT:0> ] as Array < Any ? > <EOL> return PersistentVector ( lowerLevelRoot , newTail , rootSize , shift - LOG_MAX_BUFFER_SIZE ) <EOL> } <EOL> return PersistentVector ( newRoot , newTail , rootSize , shift ) <EOL> }

/**
 * Extracts the last entirely filled leaf buffer from the trie of this vector and makes it a tail in the returned [PersistentVector].
 *
 * Used when there are no elements left in current tail.
 *
 * Requires the trie to contain at least one leaf buffer.
 *
 * If the trie becomes empty after the operation, returns a tail-only vector ([SmallPersistentVector]).
 */


private fun pullLastBuffer ( root : Array < Any ? > , shift : Int , index : Int , tailCarry : ObjectRef ) : Array < Any ? > ?

{ <EOL> val bufferIndex = indexSegment ( index , shift ) <EOL> val newBufferAtIndex = if ( shift == LOG_MAX_BUFFER_SIZE ) { <EOL> tailCarry . value = root [ bufferIndex ] <EOL> null <EOL> } else { <EOL> @ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> pullLastBuffer ( root [ bufferIndex ] as Array < Any ? > , shift - LOG_MAX_BUFFER_SIZE , index , tailCarry ) <EOL> } <EOL> if ( newBufferAtIndex == null && bufferIndex == <NUM_LIT:0> ) { <EOL> return null <EOL> } <EOL> val newRoot = root . copyOf ( MAX_BUFFER_SIZE ) <EOL> newRoot [ bufferIndex ] = newBufferAtIndex <EOL> return newRoot <EOL> }

/**
 * Extracts the last leaf buffer from trie and returns new trie without it or `null` if there's no more leaf elements in this trie.
 *
 * [tailCarry] on output contains the extracted leaf buffer.
 */


private fun removeFromRootAt ( root : Array < Any ? > , shift : Int , index : Int , tailCarry : ObjectRef ) : Array < Any ? >

{ <EOL> val bufferIndex = indexSegment ( index , shift ) <EOL> if ( shift == <NUM_LIT:0> ) { <EOL> val newRoot = if ( bufferIndex == <NUM_LIT:0> ) arrayOfNulls < Any ? > ( MAX_BUFFER_SIZE ) else root . copyOf ( MAX_BUFFER_SIZE ) <EOL> root . copyInto ( newRoot , bufferIndex , bufferIndex + <NUM_LIT:1> , MAX_BUFFER_SIZE ) <EOL> newRoot [ MAX_BUFFER_SIZE - <NUM_LIT:1> ] = tailCarry . value <EOL> tailCarry . value = root [ bufferIndex ] <EOL> return newRoot <EOL> } <EOL> var bufferLastIndex = MAX_BUFFER_SIZE_MINUS_ONE <EOL> if ( root [ bufferLastIndex ] == null ) { <EOL> bufferLastIndex = indexSegment ( rootSize ( ) - <NUM_LIT:1> , shift ) <EOL> } <EOL> val newRoot = root . copyOf ( MAX_BUFFER_SIZE ) <EOL> val lowerLevelShift = shift - LOG_MAX_BUFFER_SIZE <EOL> for ( i in bufferLastIndex downTo bufferIndex + <NUM_LIT:1> ) { <EOL> @ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> newRoot [ i ] = removeFromRootAt ( newRoot [ i ] as Array < Any ? > , lowerLevelShift , <NUM_LIT:0> , tailCarry ) <EOL> } <EOL> @ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> newRoot [ bufferIndex ] = removeFromRootAt ( newRoot [ bufferIndex ] as Array < Any ? > , lowerLevelShift , index , tailCarry ) <EOL> return newRoot <EOL> }

/**
 * Removes element from trie at the specified trie [index].
 *
 * [tailCarry] on input contains the first element of the adjacent trie to fill the last vacant element with.
 * [tailCarry] on output contains the first element of this trie.
 *
 * @return the new root of the trie.
 */


private fun bufferFor ( index : Int ) : Array < Any ? >

{ <EOL> if ( rootSize ( ) <= index ) { <EOL> return tail <EOL> } <EOL> var buffer = root <EOL> var shift = rootShift <EOL> while ( shift > <NUM_LIT:0> ) { <EOL> @ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> buffer = buffer [ indexSegment ( index , shift ) ] as Array < Any ? > <EOL> shift -= LOG_MAX_BUFFER_SIZE <EOL> } <EOL> return buffer <EOL> }

/** Returns either leaf buffer of the trie or the tail, that contains element with the specified [index]. */


private fun areTypesTheSame ( ktTypeRef : KtTypeReference , psiType : PsiType , varArgs : Boolean ) : Boolean

{ <EOL> val qualifiedName = <EOL> getQualifiedName ( ktTypeRef . typeElement , ktTypeRef . getAllModifierLists ( ) . any { it . hasSuspendModifier ( ) } ) ? : return false <EOL> return if ( psiType is PsiArrayType && psiType . componentType !is PsiPrimitiveType ) { <EOL> qualifiedName == StandardNames . FqNames . array . asString ( ) || <EOL> varArgs && areTypesTheSame ( ktTypeRef , psiType . componentType , false ) <EOL> } else { <EOL> psiType . isTheSame ( psiType ( qualifiedName , ktTypeRef ) ) <EOL> } <EOL> }


{ <EOL> return FlatIterator ( this . data ? : throw NumKtException ( "<STR_LIT>" ) , this . ndim , this . strides , this . itemsize , this . shape , this . dtype , p ) <EOL> }


= ArrayList < T > ( this . size ) . also { <EOL> for ( el in this . flatIter ( ) ) { <EOL> it . add ( el ) <EOL> } <EOL> }


{ <EOL> assert ( this . ndim == <NUM_LIT:2> ) <EOL> return MutableList ( shape [ <NUM_LIT:0> ] ) { <EOL> this [ it ] . toList ( ) <EOL> } <EOL> }


fun toList3d ( ) : List < List < List < T > > >

{ <EOL> assert ( this . ndim == <NUM_LIT:3> ) <EOL> return MutableList ( this . shape [ <NUM_LIT:0> ] ) { <EOL> this [ it ] . toList2d ( ) <EOL> } <EOL> }


operator fun iterator ( ) : Iterator < KtNDArray < T > >

= NDIterator ( this . getPointer ( ) )

/**
 * Iterator over ndarray elements.
 *
 * Iteration takes place on the direct buffer indexes obtained from the nditer.
 * This iterator is equivalent to ndarray.flat or nditer with order 'C'.
 */


override fun equals ( other : Any ? ) : Boolean

{ <EOL> if ( other !is KtNDArray < * > ) <EOL> return false <EOL> if ( isScalar ( ) ) { <EOL> return this . scalar == other . scalar <EOL> } <EOL> return arrayEqual ( this , other ) <EOL> }


{ <EOL> if ( isNotScalar ( ) ) <EOL> interp . freeArray ( pointer , data ! ! ) <EOL> }

/**
 * If the array is not a scalar, the counter of the array decreases by one.
 * If the counter is zero, python will free up memory.
 */


infix fun < T : Any , C : Number > KtNDArray < T > . lt ( other : C ) : KtNDArray < Boolean >

= <EOL> callFunc ( nameMethod = arrayOf ( "<STR_LIT>" , "<STR_LIT>" ) , args = arrayOf ( this , other ) )


infix fun < T : Any , C : Number > KtNDArray < T > . le ( other : C ) : KtNDArray < T >


infix fun < T : Any , C : Number > KtNDArray < T > . gt ( other : C ) : KtNDArray < Boolean >


infix fun < T : Any , C : Number > KtNDArray < T > . ge ( other : C ) : KtNDArray < Boolean >


infix fun < T : Any , C : Number > KtNDArray < T > . eq ( other : C ) : KtNDArray < Boolean >


infix fun < T : Any , C : Number > KtNDArray < T > . ne ( other : C ) : KtNDArray < Boolean >


fun produceCAdapterBitcode ( clang : ClangArgs , cppFile : File , bitcodeFile : File )

{ <EOL> val clangCommand = clang . clangCXX ( "<STR_LIT>" , cppFile . absoluteFile . normalize ( ) . path , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , bitcodeFile . absoluteFile . normalize ( ) . path ) <EOL> Command ( clangCommand ) . execute ( ) <EOL> }

/**
 * Fourth phase of C export: compile runtime bindings to bitcode.
 */


private fun FirFunctionSymbol < * > . hasDifferentParameterNames ( other : FirFunctionSymbol < * > ) : Boolean

{ <EOL> return valueParameterSymbols . drop ( <NUM_LIT:1> ) . map { it . name } != other . valueParameterSymbols . drop ( <NUM_LIT:1> ) . map { it . name } <EOL> }

/**
 * This function basically checks that these two functions have different objective-C signature.
 *
 * This signature consists of function name and parameter names except first.
 *
 * So we ignore the first parameter name, but check others
 */


{ <EOL> if ( indicies [ currentDepth ] == - <NUM_LIT:2> ) { <EOL> currentObjectPath [ currentDepth ] = Tombstone <EOL> } <EOL> }

/** Used to indicate that we are in the process of decoding the key itself and can't specify it in path */


internal fun ijListenTestTask ( task : AbstractTestTask )

{ <EOL> try { <EOL> Class . forName ( "<STR_LIT>" ) <EOL> ? . getMethod ( "<STR_LIT>" ) <EOL> ? . invoke ( null , task ) <EOL> } catch ( e : ClassNotFoundException ) { <EOL> } <EOL> }

/**
 * Experimental test reporting for Intellij Ultimate only
 */


fun runLazyResolverByPhase ( phase : FirResolvePhase , target : LLFirResolveTarget )

{ <EOL> val lazyResolver = LLFirLazyPhaseResolverByPhase . getByPhase ( phase ) <EOL> LLFirGlobalResolveComponents . getInstance ( target . session ) . lockProvider . withGlobalLock { <EOL> lazyResolver . resolve ( target ) <EOL> } <EOL> }

/**
 * Runs [resolver][LLFirLazyResolver] associated with [phase] for [target].
 *
 * @see LLFirLazyPhaseResolverByPhase
 */


fun ConeIntegerLiteralType . Companion . findCommonSuperType ( types : Collection < SimpleTypeMarker > ) : SimpleTypeMarker ?

{ <EOL> return ConeIntegerLiteralTypeExtensions . findCommonSuperType ( types ) <EOL> }

/**
 * This methods detects common super type only for special rules for integer literal types
 * If it returns null then CST will be found by regular rules using real supertypes
 * of integer literal types
 */


{ <EOL> return System . setProperty ( CONDY_SYSTEM_PARAM_NAME , "<STR_LIT:false>" ) <EOL> }

/**
 * Disable JVM ConDy during instrumentation.
 *
 * @return previous value of ConDy setting
 */


fun restoreConDy ( prevValue : String ? )

{ <EOL> if ( prevValue == null ) { <EOL> System . clearProperty ( CONDY_SYSTEM_PARAM_NAME ) <EOL> } else { <EOL> System . setProperty ( CONDY_SYSTEM_PARAM_NAME , prevValue ) <EOL> } <EOL> }

/**
 * Restore previous value of JVM ConDy setting.
 *
 * Returns prevValue new setting value.
 */


private fun OverloadCandidate . preserveCalleeInapplicability ( )

{ <EOL> val callSite = candidate . callInfo . callSite <EOL> val calleeReference = callSite . toReference ( firSession ) as? FirDiagnosticHolder ? : return <EOL> val diagnostic = calleeReference . diagnostic as? ConeInapplicableCandidateError ? : return <EOL> if ( diagnostic . applicability != CandidateApplicability . INAPPLICABLE ) return <EOL> candidate . addDiagnostic ( InapplicableCandidate ) <EOL> }

/**
 * Post-processes a candidate to carry the callee's inapplicability over into the candidate. Without this post-processing, an issue may
 * arise where [getAllCandidates] produces "applicable" candidates with inapplicable callee references.
 *
 * For example, a function call `generic<String, String>` of function `fun <A, B, C> generic() { }` is correctly marked as inapplicable
 * by the compiler (due to the missing type argument), but the `firFile` built during [getAllCandidates] will contain an inapplicable
 * function call `generic<String, String, ERROR>` (with the missing type argument inferred as an error type). The *subsequent*
 * resolution by `bodyResolveComponents.callResolver.collectAllCandidates` feeds this call to
 * [org.jetbrains.kotlin.fir.resolve.calls.CandidateFactory], which doesn't make any guarantees for inapplicable calls. Hence, the
 * resulting candidate is *not* marked as inapplicable and needs to be post-processed.
 */


public fun < T > DataFrame < T > . drop ( n : Int ) : DataFrame < T >

{ <EOL> require ( n >= <NUM_LIT:0> ) { "<STR_LIT>" } <EOL> return getRows ( n . coerceAtMost ( nrow ) until nrow ) <EOL> }

/**
 * Returns a DataFrame containing all rows except first [n] rows.
 *
 * @throws IllegalArgumentException if [n] is negative.
 */


public fun < T > DataFrame < T > . dropLast ( n : Int = <NUM_LIT:1> ) : DataFrame < T >

{ <EOL> require ( n >= <NUM_LIT:0> ) { "<STR_LIT>" } <EOL> return take ( ( nrow - n ) . coerceAtLeast ( <NUM_LIT:0> ) ) <EOL> }

/**
 * Returns a DataFrame containing all rows except last [n] rows.
 *
 * @throws IllegalArgumentException if [n] is negative.
 */


public fun < T > DataFrame < T > . drop ( predicate : RowFilter < T > ) : DataFrame < T >

= filter { ! predicate ( it , it ) }

/**
 * Returns a DataFrame containing all rows except rows that satisfy the given [predicate].
 */


public fun < T > DataFrame < T > . dropWhile ( predicate : RowFilter < T > ) : DataFrame < T >

= <EOL> firstOrNull { ! predicate ( it , it ) } ? . let { drop ( it . index ) } ? : this

/**
 * Returns a DataFrame containing all rows except first rows that satisfy the given [predicate].
 */


public fun < C > ColumnSet < C > . drop ( n : Int ) : ColumnSet < C >

= transform { it . drop ( n ) }

/**
 * @include [CommonDropFirstDocs]
 * @set [CommonTakeAndDropDocs.ExampleArg]
 *
 * `df.`[select][DataFrame.select]` { `[colsOf][SingleColumn.colsOf]`<`[String][String]`>().`[drop][ColumnSet.drop]`(2) }`
 *
 * `df.`[select][DataFrame.select]` { `[cols][ColumnsSelectionDsl.cols]` { .. }.`[drop][ColumnSet.drop]`(2) }`
 */


public fun ColumnsSelectionDsl < * > . drop ( n : Int ) : ColumnSet < * >

= <EOL> asSingleColumn ( ) . dropCols ( n )

/**
 * @include [CommonDropFirstDocs]
 * @set [CommonTakeAndDropDocs.ExampleArg]
 *
 * `df.`[select][DataFrame.select]` { `[drop][ColumnsSelectionDsl.drop]`(5) }`
 */


public fun SingleColumn < DataRow < * > > . dropCols ( n : Int ) : ColumnSet < * >

= <EOL> this . ensureIsColumnGroup ( ) . transformSingle { it . cols ( ) . drop ( n ) }

/**
 * @include [CommonDropFirstDocs]
 * @set [CommonTakeAndDropDocs.ExampleArg]
 *
 * `df.`[select][DataFrame.select]` { myColumnGroup.`[dropCols][SingleColumn.dropCols]`(1) }`
 */


public fun String . dropCols ( n : Int ) : ColumnSet < * >

= columnGroup ( this ) . dropCols ( n )

/**
 * @include [CommonDropFirstDocs]
 * @set [CommonTakeAndDropDocs.ExampleArg]
 *
 * `df.`[select][DataFrame.select]` { "myColumnGroup".`[dropCols][String.dropCols]`(1) }`
 */


public fun KProperty < * > . dropCols ( n : Int ) : ColumnSet < * >

= columnGroup ( this ) . dropCols ( n )

/**
 * @include [CommonDropFirstDocs]
 * @set [CommonTakeAndDropDocs.ExampleArg]
 *
 * `df.`[select][DataFrame.select]` { DataSchemaType::myColumnGroup.`[dropCols][KProperty.dropCols]`(1) }`
 */


public fun ColumnPath . dropCols ( n : Int ) : ColumnSet < * >

= columnGroup ( this ) . dropCols ( n )

/**
 * @include [CommonDropFirstDocs]
 * @set [CommonTakeAndDropDocs.ExampleArg]
 *
 * `df.`[select][DataFrame.select]` { "pathTo"["myColumnGroup"].`[dropCols][ColumnPath.dropCols]`(1) }`
 */


public fun < C > ColumnSet < C > . dropLast ( n : Int = <NUM_LIT:1> ) : ColumnSet < C >

= transform { it . dropLast ( n ) }

/**
 * @include [CommonDropLastDocs]
 * @set [CommonTakeAndDropDocs.ExampleArg]
 *
 * `df.`[select][DataFrame.select]` { `[colsOf][SingleColumn.colsOf]`<`[String][String]`>().`[dropLast][ColumnSet.dropLast]`(2) }`
 *
 * `df.`[select][DataFrame.select]` { `[cols][ColumnsSelectionDsl.cols]` { .. }.`[dropLast][ColumnSet.dropLast]`() }`
 */


public fun ColumnsSelectionDsl < * > . dropLast ( n : Int = <NUM_LIT:1> ) : ColumnSet < * >

= <EOL> this . asSingleColumn ( ) . dropLastCols ( n )

/**
 * @include [CommonDropLastDocs]
 * @set [CommonTakeAndDropDocs.ExampleArg]
 *
 * `df.`[select][DataFrame.select]` { `[dropLast][ColumnsSelectionDsl.dropLast]`(5) }`
 */


public fun SingleColumn < DataRow < * > > . dropLastCols ( n : Int ) : ColumnSet < * >

= <EOL> this . ensureIsColumnGroup ( ) . transformSingle { it . cols ( ) . dropLast ( n ) }

/**
 * @include [CommonDropLastDocs]
 * @set [CommonTakeAndDropDocs.ExampleArg]
 *
 * `df.`[select][DataFrame.select]` { myColumnGroup.`[dropLastCols][SingleColumn.dropLastCols]`() }`
 */


public fun String . dropLastCols ( n : Int ) : ColumnSet < * >

= columnGroup ( this ) . dropLastCols ( n )

/**
 * @include [CommonDropLastDocs]
 * @set [CommonTakeAndDropDocs.ExampleArg]
 *
 * `df.`[select][DataFrame.select]` { "myColumnGroup".`[dropLastCols][String.dropLastCols]`(1) }`
 */


public fun KProperty < * > . dropLastCols ( n : Int ) : ColumnSet < * >

/**
 * @include [CommonDropLastDocs]
 * @set [CommonTakeAndDropDocs.ExampleArg]
 *
 * `df.`[select][DataFrame.select]` { DataSchemaType::myColumnGroup.`[dropLastCols][KProperty.dropLastCols]`(1) }`
 */


public fun ColumnPath . dropLastCols ( n : Int ) : ColumnSet < * >

/**
 * @include [CommonDropLastDocs]
 * @set [CommonTakeAndDropDocs.ExampleArg]
 *
 * `df.`[select][DataFrame.select]` { "pathTo"["myColumnGroup"].`[dropLastCols][ColumnPath.dropLastCols]`(1) }`
 */


public fun < C > ColumnSet < C > . dropWhile ( predicate : ColumnFilter < C > ) : ColumnSet < C >

= <EOL> transform { it . dropWhile ( predicate ) }

/**
 * @include [CommonDropWhileDocs]
 * @set [CommonTakeAndDropWhileDocs.ExampleArg]
 *
 * `df.`[select][DataFrame.select]` { `[colsOf][SingleColumn.colsOf]`<`[String][String]`>().`[dropWhile][ColumnSet.dropWhile]` { it.`[any][ColumnWithPath.any]` { it == "Alice" } } }`
 *
 * `df.`[select][DataFrame.select]` { `[cols][ColumnsSelectionDsl.cols]` { .. }.`[dropWhile][ColumnSet.dropWhile]` { it.`[name][ColumnWithPath.name]`.`[startsWith][String.startsWith]`("my") } }`
 */


public fun ColumnsSelectionDsl < * > . dropWhile ( predicate : ColumnFilter < * > ) : ColumnSet < * >

= <EOL> this . asSingleColumn ( ) . dropColsWhile ( predicate )

/**
 * @include [CommonDropWhileDocs]
 * @set [CommonTakeAndDropWhileDocs.ExampleArg]
 *
 * `df.`[select][DataFrame.select]` { `[dropWhile][ColumnsSelectionDsl.dropWhile]` { it.`[any][ColumnWithPath.any]` { it == "Alice" } } }`
 */


public fun SingleColumn < DataRow < * > > . dropColsWhile ( predicate : ColumnFilter < * > ) : ColumnSet < * >

= <EOL> this . ensureIsColumnGroup ( ) . transformSingle { it . cols ( ) . dropWhile ( predicate ) }

/**
 * @include [CommonDropWhileDocs]
 * @set [CommonTakeAndDropWhileDocs.ExampleArg]
 *
 * `df.`[select][DataFrame.select]` { myColumnGroup.`[dropColsWhile][SingleColumn.dropColsWhile]` { it.`[name][ColumnWithPath.name]`.`[startsWith][String.startsWith]`("my") } }`
 */


public fun String . dropColsWhile ( predicate : ColumnFilter < * > ) : ColumnSet < * >

= <EOL> columnGroup ( this ) . dropColsWhile ( predicate )

/**
 * @include [CommonDropWhileDocs]
 * @set [CommonTakeAndDropWhileDocs.ExampleArg]
 *
 * `df.`[select][DataFrame.select]` { "myColumnGroup".`[dropColsWhile][String.dropColsWhile]` { it.`[name][ColumnWithPath.name]`.`[startsWith][String.startsWith]`("my") } }`
 */


public fun KProperty < * > . dropColsWhile ( predicate : ColumnFilter < * > ) : ColumnSet < * >

/**
 * @include [CommonDropWhileDocs]
 * @set [CommonTakeAndDropWhileDocs.ExampleArg]
 *
 * `df.`[select][DataFrame.select]` { DataSchemaType::myColumnGroup.`[dropColsWhile][KProperty.dropColsWhile]` { it.`[any][ColumnWithPath.any]` { it == "Alice" } } }`
 */


public fun ColumnPath . dropColsWhile ( predicate : ColumnFilter < * > ) : ColumnSet < * >

/**
 * @include [CommonDropWhileDocs]
 * @set [CommonTakeAndDropWhileDocs.ExampleArg]
 *
 * `df.`[select][DataFrame.select]` { "pathTo"["myColumnGroup"].`[dropColsWhile][ColumnPath.dropColsWhile]` { it.`[name][ColumnWithPath.name]`.`[startsWith][String.startsWith]`("my") } }`
 */


public fun < C > ColumnSet < C > . dropLastWhile ( predicate : ColumnFilter < C > ) : ColumnSet < C >

= <EOL> transform { it . dropLastWhile ( predicate ) }

/**
 * @include [CommonDropLastWhileDocs]
 * @set [CommonTakeAndDropWhileDocs.ExampleArg]
 *
 * `df.`[select][DataFrame.select]` { `[colsOf][SingleColumn.colsOf]`<`[String][String]`>().`[dropLastWhile][ColumnSet.dropLastWhile]` { it.`[any][ColumnWithPath.any]` { it == "Alice" } } }`
 *
 * `df.`[select][DataFrame.select]` { `[cols][ColumnsSelectionDsl.cols]` { .. }.`[dropLastWhile][ColumnSet.dropLastWhile]` { it.`[name][ColumnWithPath.name]`.`[startsWith][String.startsWith]`("my") } }`
 */


public fun ColumnsSelectionDsl < * > . dropLastWhile ( predicate : ColumnFilter < * > ) : ColumnSet < * >

= <EOL> this . asSingleColumn ( ) . dropLastColsWhile ( predicate )

/**
 * @include [CommonDropLastWhileDocs]
 * @set [CommonTakeAndDropWhileDocs.ExampleArg]
 *
 * `df.`[select][DataFrame.select]` { `[dropLastWhile][ColumnsSelectionDsl.dropLastWhile]` { it.`[any][ColumnWithPath.any]` { it == "Alice" } } }`
 */


public fun SingleColumn < DataRow < * > > . dropLastColsWhile ( predicate : ColumnFilter < * > ) : ColumnSet < * >

= <EOL> this . ensureIsColumnGroup ( ) . transformSingle { it . cols ( ) . dropLastWhile ( predicate ) }

/**
 * @include [CommonDropLastWhileDocs]
 * @set [CommonTakeAndDropWhileDocs.ExampleArg]
 *
 * `df.`[select][DataFrame.select]` { myColumnGroup.`[dropLastColsWhile][SingleColumn.dropLastColsWhile]` { it.`[name][ColumnWithPath.name]`.`[startsWith][String.startsWith]`("my") } }`
 */


public fun String . dropLastColsWhile ( predicate : ColumnFilter < * > ) : ColumnSet < * >

= <EOL> columnGroup ( this ) . dropLastColsWhile ( predicate )

/**
 * @include [CommonDropLastWhileDocs]
 * @set [CommonTakeAndDropWhileDocs.ExampleArg]
 *
 * `df.`[select][DataFrame.select]` { "myColumnGroup".`[dropLastColsWhile][String.dropLastColsWhile]` { it.`[name][ColumnWithPath.name]`.`[startsWith][String.startsWith]`("my") } }`
 */


public fun KProperty < * > . dropLastColsWhile ( predicate : ColumnFilter < * > ) : ColumnSet < * >

/**
 * @include [CommonDropLastWhileDocs]
 * @set [CommonTakeAndDropWhileDocs.ExampleArg]
 *
 * `df.`[select][DataFrame.select]` { Type::myColumnGroup.`[dropLastColsWhile][SingleColumn.dropLastColsWhile]` { it.`[name][ColumnWithPath.name]`.`[startsWith][String.startsWith]`("my") } }`
 *
 * `df.`[select][DataFrame.select]` { DataSchemaType::myColumnGroup.`[dropLastColsWhile][KProperty.dropLastColsWhile]` { it.`[any][ColumnWithPath.any]` { it == "Alice" } } }`
 */


public fun ColumnPath . dropLastColsWhile ( predicate : ColumnFilter < * > ) : ColumnSet < * >

/**
 * @include [CommonDropLastWhileDocs]
 * @set [CommonTakeAndDropWhileDocs.ExampleArg]
 *
 * `df.`[select][DataFrame.select]` { "pathTo"["myColumnGroup"].`[dropLastColsWhile][ColumnPath.dropLastColsWhile]` { it.`[name][ColumnWithPath.name]`.`[startsWith][String.startsWith]`("my") } }`
 */


protected fun buildFirstStageArgs ( klibPath : String )

= mutableListOf < String > ( ) . apply { <EOL> addArg ( "<STR_LIT>" , klibPath ) <EOL> addArg ( "<STR_LIT>" , CompilerOutputKind . LIBRARY . name . lowercase ( Locale . getDefault ( ) ) ) <EOL> addAll ( buildCommonArgs ( ) ) <EOL> addAll ( firstStageExtraOpts ( ) ) <EOL> allSourceFiles . mapTo ( this ) { it . absolutePath } <EOL> commonSrcFiles <EOL> . flatMap { it . files } <EOL> . mapTo ( this ) { "<STR_LIT>" } <EOL> }

/** Args passed to the compiler at the first stage of two-stage compilation (klib building). */


protected fun buildSecondStageArgs ( klibPath : String )

= mutableListOf < String > ( ) . apply { <EOL> addArg ( "<STR_LIT>" , artifact . canonicalPath ) <EOL> addArg ( "<STR_LIT>" , produce . name . lowercase ( Locale . getDefault ( ) ) ) <EOL> addArgIfNotNull ( "<STR_LIT>" , entryPoint ) <EOL> addAll ( buildCommonArgs ( ) ) <EOL> addFileArgs ( "<STR_LIT>" , nativeLibraries ) <EOL> linkerOpts . forEach { <EOL> addArg ( "<STR_LIT>" , it ) <EOL> } <EOL> addAll ( secondStageExtraOpts ( ) ) <EOL> add ( "<STR_LIT>" ) <EOL> }

/** Args passed to the compiler at the second stage of two-stage compilation (producing a final binary from the klib). */


= mutableListOf < String > ( ) . apply { <EOL> if ( platformConfigurationFiles . files . isNotEmpty ( ) ) { <EOL> platformConfigurationFiles . files . filter { it . name . endsWith ( "<STR_LIT>" ) } . forEach { <EOL> addArg ( "<STR_LIT>" , it . absolutePath ) <EOL> } <EOL> } <EOL> addFileArgs ( "<STR_LIT>" , libraries . klibFiles ) <EOL> addArgs ( "<STR_LIT>" , libraries . artifacts . map { it . artifact . canonicalPath } ) <EOL> addArgIfNotNull ( "<STR_LIT>" , konanTarget . visibleName ) <EOL> addArgIfNotNull ( "<STR_LIT>" , languageVersion ) <EOL> addArgIfNotNull ( "<STR_LIT>" , apiVersion ) <EOL> addArgIfNotNull ( "<STR_LIT>" , entryPoint ) <EOL> addKey ( "<STR_LIT>" , enableDebug ) <EOL> addKey ( "<STR_LIT>" , noStdLib ) <EOL> addKey ( "<STR_LIT>" , noMain ) <EOL> addKey ( "<STR_LIT>" , enableOptimizations ) <EOL> addKey ( "<STR_LIT>" , enableAssertions ) <EOL> addKey ( "<STR_LIT>" , measureTime ) <EOL> addKey ( "<STR_LIT>" , measureTime ) <EOL> addKey ( "<STR_LIT>" , noDefaultLibs ) <EOL> addKey ( "<STR_LIT>" , noEndorsedLibs ) <EOL> addKey ( "<STR_LIT>" , enableMultiplatform ) <EOL> if ( libraries . friends . isNotEmpty ( ) ) <EOL> addArg ( "<STR_LIT>" , libraries . friends . joinToString ( File . pathSeparator ) ) <EOL> }

/** Args passed to the compiler at both stages of the two-stage compilation and during the singe-stage compilation. */


= mutableListOf < String > ( ) . apply { <EOL> addArg ( "<STR_LIT>" , artifact . canonicalPath ) <EOL> addArg ( "<STR_LIT>" , produce . name . lowercase ( Locale . getDefault ( ) ) ) <EOL> addArgIfNotNull ( "<STR_LIT>" , entryPoint ) <EOL> addAll ( buildCommonArgs ( ) ) <EOL> addFileArgs ( "<STR_LIT>" , nativeLibraries ) <EOL> linkerOpts . forEach { <EOL> addArg ( "<STR_LIT>" , it ) <EOL> } <EOL> if ( produce != CompilerOutputKind . LIBRARY ) { <EOL> add ( "<STR_LIT>" ) <EOL> add ( "<STR_LIT>" ) <EOL> } <EOL> addAll ( extraOpts ) <EOL> allSourceFiles . mapTo ( this ) { it . absolutePath } <EOL> commonSrcFiles <EOL> . flatMap { it . files } <EOL> . mapTo ( this ) { "<STR_LIT>" } <EOL> }

/** Args passed to the compiler if the two-stage compilation is disabled. */


@ Deprecated ( IDENTITY_FUNCTION , ReplaceWith ( COL_REPLACE ) ) <EOL> public fun < C > col ( col : ColumnAccessor < C > ) : ColumnAccessor < C >

= col

/**
 * @include [ColReferenceDocs] {@set [CommonColDocs.ReceiverArg]}
 * {@set [CommonColDocs.Note] NOTE: This overload is an identity function and can be omitted.}
 */


public fun < C > SingleColumn < DataRow < * > > . col ( col : ColumnAccessor < C > ) : SingleColumn < C >

= <EOL> this . ensureIsColumnGroup ( ) . transformSingle { <EOL> val child = it . getCol ( col ) <EOL> ? : throw IllegalStateException ( "<STR_LIT>" ) <EOL> listOf ( child ) <EOL> } . singleImpl ( )

/**
 * @include [ColReferenceDocs] {@set [CommonColDocs.ReceiverArg] myColumnGroup.}
 */


public fun < C > AnyColumnGroupAccessor . col ( col : ColumnAccessor < C > ) : ColumnAccessor < C >

= <EOL> this . ensureIsColumnGroup ( ) . column ( col . path ( ) )


public fun < C > String . col ( col : ColumnAccessor < C > ) : ColumnAccessor < C >

= <EOL> columnGroup ( this ) . ensureIsColumnGroup ( ) . column ( col . path ( ) )

/**
 * @include [ColReferenceDocs] {@set [CommonColDocs.ReceiverArg] "myColumnGroup".}
 */


public fun < C > KProperty < * > . col ( col : ColumnAccessor < C > ) : ColumnAccessor < C >

/**
 * @include [ColReferenceDocs] {@set [CommonColDocs.ReceiverArg] Type::myColumnGroup.}
 */


public fun < C > ColumnPath . col ( col : ColumnAccessor < C > ) : ColumnAccessor < C >

/**
 * @include [ColReferenceDocs] {@set [CommonColDocs.ReceiverArg] "pathTo"["myColumnGroup"].}
 */


@ Suppress ( "<STR_LIT:INAPPLICABLE_JVM_NAME>" ) <EOL> @ JvmName ( "<STR_LIT>" ) <EOL> public fun col ( name : String ) : ColumnAccessor < * >

= column < Any ? > ( name )

/**
 * @include [ColNameDocs] {@set [CommonColDocs.ReceiverArg]}
 */


public fun < C > col ( name : String ) : ColumnAccessor < C >

= column ( name )

/**
 * @include [ColNameDocs] {@set [CommonColDocs.ReceiverArg]}
 * @include [CommonColDocs.ColumnTypeParam]
 */


@ Suppress ( "<STR_LIT:INAPPLICABLE_JVM_NAME>" ) <EOL> @ JvmName ( "<STR_LIT>" ) <EOL> public fun SingleColumn < DataRow < * > > . col ( name : String ) : SingleColumn < * >

= <EOL> col < Any ? > ( name )

/**
 * @include [ColNameDocs] {@set [CommonColDocs.ReceiverArg] myColumnGroup.}
 */


public fun < C > SingleColumn < DataRow < * > > . col ( name : String ) : SingleColumn < C >

= <EOL> this . ensureIsColumnGroup ( ) . transformSingle { <EOL> val child = it . getCol ( name ) ? . cast < C > ( ) <EOL> ? : throw IllegalStateException ( "<STR_LIT>" ) <EOL> listOf ( child ) <EOL> } . singleImpl ( )

/**
 * @include [ColNameDocs] {@set [CommonColDocs.ReceiverArg] myColumnGroup.}
 * @include [CommonColDocs.ColumnTypeParam]
 */


@ Suppress ( "<STR_LIT:INAPPLICABLE_JVM_NAME>" ) <EOL> @ JvmName ( "<STR_LIT>" ) <EOL> public fun AnyColumnGroupAccessor . col ( name : String ) : ColumnAccessor < * >

= <EOL> col < Any ? > ( name )


public fun < C > AnyColumnGroupAccessor . col ( name : String ) : ColumnAccessor < C >

= <EOL> this . ensureIsColumnGroup ( ) . column ( name )


@ Suppress ( "<STR_LIT:INAPPLICABLE_JVM_NAME>" ) <EOL> @ JvmName ( "<STR_LIT>" ) <EOL> public fun String . col ( name : String ) : ColumnAccessor < * >

= <EOL> col < Any ? > ( name )

/**
 * @include [ColNameDocs] {@set [CommonColDocs.ReceiverArg] "myColumnGroup".}
 */


public fun < C > String . col ( name : String ) : ColumnAccessor < C >

= <EOL> columnGroup ( this ) <EOL> . ensureIsColumnGroup ( ) <EOL> . column ( name )

/**
 * @include [ColNameDocs] {@set [CommonColDocs.ReceiverArg] "myColumnGroup".}
 * @include [CommonColDocs.ColumnTypeParam]
 */


@ Suppress ( "<STR_LIT:INAPPLICABLE_JVM_NAME>" ) <EOL> @ JvmName ( "<STR_LIT>" ) <EOL> public fun KProperty < * > . col ( name : String ) : ColumnAccessor < * >

= <EOL> col < Any ? > ( name )

/**
 * @include [ColNameDocs] {@set [CommonColDocs.ReceiverArg] Type::myColumnGroup.}
 */


public fun < C > KProperty < * > . col ( name : String ) : ColumnAccessor < C >

= <EOL> columnGroup ( this ) . ensureIsColumnGroup ( ) . column ( name )

/**
 * @include [ColNameDocs] {@set [CommonColDocs.ReceiverArg] Type::myColumnGroup.}
 * @include [CommonColDocs.ColumnTypeParam]
 */


@ Suppress ( "<STR_LIT:INAPPLICABLE_JVM_NAME>" ) <EOL> @ JvmName ( "<STR_LIT>" ) <EOL> public fun ColumnPath . col ( name : String ) : ColumnAccessor < * >

= <EOL> col < Any ? > ( name )

/**
 * @include [ColNameDocs] {@set [CommonColDocs.ReceiverArg] "pathTo"["myColumnGroup"].}
 */


public fun < C > ColumnPath . col ( name : String ) : ColumnAccessor < C >

/**
 * @include [ColNameDocs] {@set [CommonColDocs.ReceiverArg] "pathTo"["myColumnGroup"].}
 * @include [CommonColDocs.ColumnTypeParam]
 */


@ Suppress ( "<STR_LIT:INAPPLICABLE_JVM_NAME>" ) <EOL> @ JvmName ( "<STR_LIT>" ) <EOL> public fun col ( path : ColumnPath ) : ColumnAccessor < * >

= column < Any ? > ( path )

/**
 * @include [ColPathDocs] {@set [CommonColDocs.ReceiverArg]}
 */


public fun < C > col ( path : ColumnPath ) : ColumnAccessor < C >

= column ( path )

/**
 * @include [ColPathDocs] {@set [CommonColDocs.ReceiverArg]}
 * @include [CommonColDocs.ColumnTypeParam]
 */


@ Suppress ( "<STR_LIT:INAPPLICABLE_JVM_NAME>" ) <EOL> @ JvmName ( "<STR_LIT>" ) <EOL> public fun SingleColumn < DataRow < * > > . col ( path : ColumnPath ) : SingleColumn < * >

= <EOL> col < Any ? > ( path )

/**
 * @include [ColPathDocs] {@set [CommonColDocs.ReceiverArg] myColumnGroup.}
 */


public fun < C > SingleColumn < DataRow < * > > . col ( path : ColumnPath ) : SingleColumn < C >

= <EOL> this . ensureIsColumnGroup ( ) . transformSingle { <EOL> val child = it . getCol ( path ) ? . cast < C > ( ) <EOL> ? : throw IllegalStateException ( "<STR_LIT>" ) <EOL> listOf ( child ) <EOL> } . singleImpl ( )

/**
 * @include [ColPathDocs] {@set [CommonColDocs.ReceiverArg] myColumnGroup.}
 * @include [CommonColDocs.ColumnTypeParam]
 */


@ Suppress ( "<STR_LIT:INAPPLICABLE_JVM_NAME>" ) <EOL> @ JvmName ( "<STR_LIT>" ) <EOL> public fun AnyColumnGroupAccessor . col ( path : ColumnPath ) : ColumnAccessor < * >

= <EOL> col < Any ? > ( path )


public fun < C > AnyColumnGroupAccessor . col ( path : ColumnPath ) : ColumnAccessor < C >

= <EOL> this . ensureIsColumnGroup ( ) . column ( path )


@ Suppress ( "<STR_LIT:INAPPLICABLE_JVM_NAME>" ) <EOL> @ JvmName ( "<STR_LIT>" ) <EOL> public fun String . col ( path : ColumnPath ) : ColumnAccessor < * >

= <EOL> col < Any ? > ( path )

/**
 * @include [ColPathDocs] {@set [CommonColDocs.ReceiverArg] "myColumnGroup".}
 */


public fun < C > String . col ( path : ColumnPath ) : ColumnAccessor < C >

= <EOL> columnGroup ( this ) . ensureIsColumnGroup ( ) . column ( path )

/**
 * @include [ColPathDocs] {@set [CommonColDocs.ReceiverArg] "myColumnGroup".}
 * @include [CommonColDocs.ColumnTypeParam]
 */


@ Suppress ( "<STR_LIT:INAPPLICABLE_JVM_NAME>" ) <EOL> @ JvmName ( "<STR_LIT>" ) <EOL> public fun KProperty < * > . col ( path : ColumnPath ) : ColumnAccessor < * >

= <EOL> col < Any ? > ( path )

/**
 * @include [ColPathDocs] {@set [CommonColDocs.ReceiverArg] Type::myColumnGroup.}
 */


public fun < C > KProperty < * > . col ( path : ColumnPath ) : ColumnAccessor < C >

/**
 * @include [ColPathDocs] {@set [CommonColDocs.ReceiverArg] Type::myColumnGroup.}
 * @include [CommonColDocs.ColumnTypeParam]
 */


@ Suppress ( "<STR_LIT:INAPPLICABLE_JVM_NAME>" ) <EOL> @ JvmName ( "<STR_LIT>" ) <EOL> public fun ColumnPath . col ( path : ColumnPath ) : ColumnAccessor < * >

= <EOL> col < Any ? > ( path )

/**
 * @include [ColPathDocs] {@set [CommonColDocs.ReceiverArg] "pathTo"["myColumnGroup"].}
 */


public fun < C > ColumnPath . col ( path : ColumnPath ) : ColumnAccessor < C >

/**
 * @include [ColPathDocs] {@set [CommonColDocs.ReceiverArg] "pathTo"["myColumnGroup"].}
 * @include [CommonColDocs.ColumnTypeParam]
 */


public fun < C > col ( property : KProperty < C > ) : SingleColumn < C >

= column ( property )

/**
 * @include [ColKPropertyDocs] {@set [CommonColDocs.ReceiverArg]}
 */


public fun < C > SingleColumn < DataRow < * > > . col ( property : KProperty < C > ) : SingleColumn < C >

= <EOL> col < C > ( property . name )

/**
 * @include [ColKPropertyDocs] {@set [CommonColDocs.ReceiverArg] myColumnGroup.}
 */


public fun < C > AnyColumnGroupAccessor . col ( property : KProperty < C > ) : ColumnAccessor < C >

= <EOL> this . ensureIsColumnGroup ( ) . column ( property )


public fun < C > String . col ( property : KProperty < C > ) : ColumnAccessor < C >

= <EOL> columnGroup ( this ) . ensureIsColumnGroup ( ) . column ( property )

/**
 * @include [ColKPropertyDocs] {@set [CommonColDocs.ReceiverArg] "myColumnGroup".}
 */


public fun < C > KProperty < * > . col ( property : KProperty < C > ) : ColumnAccessor < C >

/**
 * @include [ColKPropertyDocs] {@set [CommonColDocs.ReceiverArg] Type::myColumnGroup.}
 */


public fun < C > ColumnPath . col ( property : KProperty < C > ) : ColumnAccessor < C >

/**
 * @include [ColKPropertyDocs] {@set [CommonColDocs.ReceiverArg] "pathTo"["myColumnGroup"].}
 */


public fun < C > ColumnSet < C > . col ( index : Int ) : SingleColumn < C >

= getAt ( index )

/**
 * @include [ColIndexDocs] {@set [CommonColDocs.ReceiverArg] `[colsOf][ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().}
 * @include [CommonColDocs.ColumnTypeParam]
 * {@set [CommonColDocs.ExampleArg]
 * {@include [CommonColDocs.SingleExample]}
 *
 * `df.`[select][DataFrame.select]` { `[colsOf][ColumnsSelectionDsl.colsOf]`<`[String][String]`>()`[`[`][col]`1`[`]`][col]` \}`
 * }
 * {@set [CommonColDocs.Note] NOTE: You can use the get-[] operator on [ColumnSets][ColumnSet] as well!}
 */


public operator fun < C > ColumnSet < C > . get ( index : Int ) : SingleColumn < C >

= col ( index )

/**
 * @include [ColIndexDocs] {@set [CommonColDocs.ReceiverArg] `[colsOf][ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().}
 * @include [CommonColDocs.ColumnTypeParam]
 * {@set [CommonColDocs.ExampleArg]
 * {@include [CommonColDocs.SingleExample]}
 *
 * `df.`[select][DataFrame.select]` { `[colsOf][ColumnsSelectionDsl.colsOf]`<`[String][String]`>()`[`[`][col]`1`[`]`][col]` \}`
 * }
 */


@ Suppress ( "<STR_LIT:INAPPLICABLE_JVM_NAME>" ) <EOL> @ JvmName ( "<STR_LIT>" ) <EOL> public fun ColumnsSelectionDsl < * > . col ( index : Int ) : SingleColumn < * >

= <EOL> col < Any ? > ( index )

/**
 * @include [ColIndexDocs] {@set [CommonColDocs.ReceiverArg]}
 */


public fun < C > ColumnsSelectionDsl < * > . col ( index : Int ) : SingleColumn < C >

= <EOL> asSingleColumn ( ) . col < C > ( index )

/**
 * @include [ColIndexDocs] {@set [CommonColDocs.ReceiverArg]}
 * @include [CommonColDocs.ColumnTypeParam]
 */


@ Suppress ( "<STR_LIT:INAPPLICABLE_JVM_NAME>" ) <EOL> @ JvmName ( "<STR_LIT>" ) <EOL> public fun SingleColumn < DataRow < * > > . col ( index : Int ) : SingleColumn < * >

= <EOL> col < Any ? > ( index )

/**
 * @include [ColIndexDocs] {@set [CommonColDocs.ReceiverArg] myColumnGroup.}
 */


public fun < C > SingleColumn < DataRow < * > > . col ( index : Int ) : SingleColumn < C >

= <EOL> this . ensureIsColumnGroup ( ) <EOL> . allColumnsInternal ( ) <EOL> . getAt ( index ) <EOL> . cast ( )

/**
 * @include [ColIndexDocs] {@set [CommonColDocs.ReceiverArg] myColumnGroup.}
 * @include [CommonColDocs.ColumnTypeParam]
 */


@ Suppress ( "<STR_LIT:INAPPLICABLE_JVM_NAME>" ) <EOL> @ JvmName ( "<STR_LIT>" ) <EOL> public fun String . col ( index : Int ) : SingleColumn < * >

= <EOL> col < Any ? > ( index )

/**
 * @include [ColIndexDocs] {@set [CommonColDocs.ReceiverArg] "myColumnGroup".}
 */


public fun < C > String . col ( index : Int ) : SingleColumn < C >

= <EOL> columnGroup ( this ) . col < C > ( index )

/**
 * @include [ColIndexDocs] {@set [CommonColDocs.ReceiverArg] "myColumnGroup".}
 * @include [CommonColDocs.ColumnTypeParam]
 */


@ Suppress ( "<STR_LIT:INAPPLICABLE_JVM_NAME>" ) <EOL> @ JvmName ( "<STR_LIT>" ) <EOL> public fun KProperty < * > . col ( index : Int ) : SingleColumn < * >

= <EOL> col < Any ? > ( index )

/**
 * @include [ColIndexDocs] {@set [CommonColDocs.ReceiverArg] Type::myColumnGroup.}
 */


public fun < C > KProperty < * > . col ( index : Int ) : SingleColumn < C >

/**
 * @include [ColIndexDocs] {@set [CommonColDocs.ReceiverArg] Type::myColumnGroup.}
 * @include [CommonColDocs.ColumnTypeParam]
 */


@ Suppress ( "<STR_LIT:INAPPLICABLE_JVM_NAME>" ) <EOL> @ JvmName ( "<STR_LIT>" ) <EOL> public fun ColumnPath . col ( index : Int ) : SingleColumn < * >

= <EOL> col < Any ? > ( index )

/**
 * @include [ColIndexDocs] {@set [CommonColDocs.ReceiverArg] "pathTo"["myColumnGroup"].}
 */


public fun < C > ColumnPath . col ( index : Int ) : SingleColumn < C >

/**
 * @include [ColIndexDocs] {@set [CommonColDocs.ReceiverArg] "pathTo"["myColumnGroup"].}
 * @include [CommonColDocs.ColumnTypeParam]
 */


internal fun getCanonicalClassInternal ( ch : Int ) : Int

{ <EOL> return getCanonicalClass ( ch ) <EOL> }

/** Gets canonical class for given codepoint from decomposition mappings table. */


internal fun hasSingleCodepointDecompositionInternal ( ch : Int ) : Boolean

{ <EOL> val index : Int = binarySearchRange ( singleDecompositions , ch ) <EOL> return index != - <NUM_LIT:1> && singleDecompositions [ index ] == ch <EOL> }

/** Check if the given character is in table of single decompositions. */


internal fun decomposeString ( inputCodePoints : IntArray , inputLength : Int , outputCodePoints : IntArray ) : Int

{ <EOL> if ( inputLength == <NUM_LIT:0> ) return <NUM_LIT:0> <EOL> var outputLength = <NUM_LIT:0> <EOL> for ( i in <NUM_LIT:0> until inputLength ) { <EOL> val decomposition = getDecomposition ( inputCodePoints [ i ] ) <EOL> if ( decomposition == null ) { <EOL> outputCodePoints [ outputLength ++ ] = inputCodePoints [ i ] <EOL> } else { <EOL> decomposition . copyInto ( outputCodePoints , outputLength ) <EOL> outputLength += decomposition . size <EOL> } <EOL> } <EOL> return outputLength <EOL> }

/**
 * Decomposes the given string represented as an array of codepoints. Saves the decomposition into [outputCodepoints] array.
 * Returns the length of the decomposition.
 */


internal fun decomposeCodePoint ( codePoint : Int , outputCodePoints : IntArray , fromIndex : Int ) : Int

{ <EOL> val decomposition = getDecomposition ( codePoint ) <EOL> if ( decomposition == null ) { <EOL> outputCodePoints [ fromIndex ] = codePoint <EOL> return <NUM_LIT:1> <EOL> } else { <EOL> decomposition . copyInto ( outputCodePoints , fromIndex ) <EOL> return decomposition . size <EOL> } <EOL> }

/**
 * Decomposes the given codepoint. Saves the decomposition into [outputCodepoints] array starting with [fromIndex].
 * Returns the length of the decomposition.
 */


private fun binarySearchRange ( array : IntArray , needle : Int ) : Int

{ <EOL> var bottom = <NUM_LIT:0> <EOL> var top = array . size - <NUM_LIT:1> <EOL> var middle = - <NUM_LIT:1> <EOL> var value = <NUM_LIT:0> <EOL> while ( bottom <= top ) { <EOL> middle = ( bottom + top ) / <NUM_LIT:2> <EOL> value = array [ middle ] <EOL> if ( needle > value ) <EOL> bottom = middle + <NUM_LIT:1> <EOL> else if ( needle == value ) <EOL> return middle <EOL> else <EOL> top = middle - <NUM_LIT:1> <EOL> } <EOL> return middle - ( if ( needle < value ) <NUM_LIT:1> else <NUM_LIT:0> ) <EOL> }

/**
 * Returns the index of the largest element in [array] smaller or equal to the specified [needle],
 * or -1 if [needle] is smaller than the smallest element in [array].
 */


private fun computeRebindTarget ( function : FirFunction ) : FirFunction ?

{ <EOL> if ( functionsToRebind . isNullOrEmpty ( ) ) return null <EOL> val realPsi = function . realPsi <EOL> if ( realPsi != null ) { <EOL> return functionsToRebind . firstOrNull { it . realPsi == realPsi } <EOL> } <EOL> val accessor = function as? FirPropertyAccessor ? : return null <EOL> val accessorPsi = accessor . psi ? : return null <EOL> return functionsToRebind . firstOrNull { it is FirPropertyAccessor && it . isGetter == accessor . isGetter && it . psi == accessorPsi } <EOL> }

/**
 * @return [FirFunction] if another function should be used instead of [function] for [FirFunctionTarget]
 *
 * @see bindFunctionTarget
 * @see functionsToRebind
 */


private fun generateForwardStruct ( s : StructDecl ) : List < StubIrElement >

= when ( context . platform ) { <EOL> KotlinPlatform . JVM -> { <EOL> val classifier = context . getKotlinClassForPointed ( s ) <EOL> val superClass = context . platform . getRuntimeType ( "<STR_LIT>" ) <EOL> val rawPtrConstructorParam = FunctionParameterStub ( "<STR_LIT>" , context . platform . getRuntimeType ( "<STR_LIT>" ) ) <EOL> val superClassInit = SuperClassInit ( superClass , listOf ( GetConstructorParameter ( rawPtrConstructorParam ) ) ) <EOL> val origin = StubOrigin . Struct ( s ) <EOL> val primaryConstructor = ConstructorStub ( listOf ( rawPtrConstructorParam ) , emptyList ( ) , isPrimary = true , origin = origin ) <EOL> listOf ( ClassStub . Simple ( classifier , ClassStubModality . NONE , constructors = listOf ( primaryConstructor ) , superClassInit = superClassInit , origin = origin ) ) <EOL> } <EOL> KotlinPlatform . NATIVE -> emptyList ( ) <EOL> }

/**
 * Produces to [out] the definition of Kotlin class representing the reference to given forward (incomplete) struct.
 */


private fun generateEnumAsConstants ( enumDef : EnumDef ) : List < StubIrElement >

{ <EOL> val entries = mutableListOf < PropertyStub > ( ) <EOL> val typealiases = mutableListOf < TypealiasStub > ( ) <EOL> val constants = enumDef . constants . filter { <EOL> it . name !in context . macroConstantsByName <EOL> } <EOL> val kotlinType : KotlinType <EOL> val baseKotlinType = context . mirror ( enumDef . baseType ) . argType <EOL> val meta = if ( enumDef . isAnonymous ) { <EOL> kotlinType = baseKotlinType <EOL> StubContainerMeta ( textAtStart = if ( constants . isNotEmpty ( ) ) "<STR_LIT>" else "<STR_LIT>" ) <EOL> } else { <EOL> val typeMirror = context . mirror ( EnumType ( enumDef ) ) <EOL> if ( typeMirror !is TypeMirror . ByValue ) { <EOL> error ( "<STR_LIT>" ) <EOL> } <EOL> val varTypeName = typeMirror . info . constructPointedType ( typeMirror . valueType ) <EOL> val varTypeClassifier = typeMirror . pointedType . classifier <EOL> val valueTypeClassifier = typeMirror . valueType . classifier <EOL> val origin = StubOrigin . Enum ( enumDef ) <EOL> typealiases += TypealiasStub ( varTypeClassifier , varTypeName . toStubIrType ( ) , StubOrigin . VarOf ( origin ) ) <EOL> typealiases += TypealiasStub ( valueTypeClassifier , baseKotlinType . toStubIrType ( ) , origin ) <EOL> kotlinType = typeMirror . valueType <EOL> StubContainerMeta ( ) <EOL> } <EOL> for ( constant in constants ) { <EOL> val literal = context . tryCreateIntegralStub ( enumDef . baseType , constant . value ) ? : continue <EOL> val kind = when ( context . generationMode ) { <EOL> GenerationMode . SOURCE_CODE -> { <EOL> val getter = PropertyAccessor . Getter . SimpleGetter ( constant = literal ) <EOL> PropertyStub . Kind . Val ( getter ) <EOL> } <EOL> GenerationMode . METADATA -> { <EOL> PropertyStub . Kind . Constant ( literal ) <EOL> } <EOL> } <EOL> entries += PropertyStub ( constant . name , kotlinType . toStubIrType ( ) , kind , MemberStubModality . FINAL , null , origin = StubOrigin . EnumEntry ( constant ) ) <EOL> } <EOL> val container = SimpleStubContainer ( meta , properties = entries . toList ( ) , typealiases = typealiases . toList ( ) ) <EOL> return listOf ( container ) <EOL> }

/**
 * Produces to [out] the Kotlin definitions for given enum which shouldn't be represented as Kotlin enum.
 */


internal suspend fun < T > withRestrictedStages ( allowed : Set < KotlinPluginLifecycle . Stage > , block : suspend ( ) -> T ) : T

{ <EOL> val newCoroutineContext = coroutineContext + KotlinPluginLifecycleStageRestriction ( currentKotlinPluginLifecycle ( ) , allowed ) <EOL> return suspendCoroutine { continuation -> <EOL> val newContinuation = object : Continuation < T > { <EOL> override val context : CoroutineContext <EOL> get ( ) = newCoroutineContext <EOL> override fun resumeWith ( result : Result < T > ) { <EOL> continuation . resumeWith ( result ) <EOL> } <EOL> } <EOL> block . startCoroutine ( newContinuation ) <EOL> } <EOL> }

/**
 * Will ensure that the given [block] cannot leave the specified allowed stages [allowed]
 * e.g.
 *
 * ```kotlin
 * project.launchInStage(Stage.BeforeFinaliseDsl) {
 * withRestrictedStages(Stage.upTo(Stage.FinaliseDsl)) {
 * await(Stage.FinaliseDsl) // <- OK, since still in allowed stages
 * await(Stage.AfterFinaliseDsl) // <- fails, since not in allowed stages!
 * }
 * }
 * ```
 */


fun CartViewModel . Companion . provideFactory ( snackbarManager : SnackbarManager = SnackbarManager , snackRepository : SnackRepo = SnackRepo ) : ViewModelProvider . Factory

= object : ViewModelProvider . Factory { <EOL> @ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> override fun < T : ViewModel > create ( modelClass : Class < T > ) : T { <EOL> return CartViewModel ( snackbarManager , snackRepository ) as T <EOL> } <EOL> }

/**
 * Factory for CartViewModel that takes SnackbarManager as a dependency
 */


= getBooleanProperty ( TRY_K2 )


inline fun < reified T > ifExhaustive ( vararg values : T ) : Array < out T >

{ <EOL> return if ( TestEnvironment . isExhaustive ) values else emptyArray ( ) <EOL> }

/**
 * Will only return values if [TestEnvironment.isExhaustive] is set to true
 */


private fun collectLlvmModules ( generationState : NativeGenerationState , generatedBitcodeFiles : List < String > ) : LlvmModules

{ <EOL> val config = generationState . config <EOL> val ( bitcodePartOfStdlib , bitcodeLibraries ) = generationState . dependenciesTracker . bitcodeToLink <EOL> . partition { it . isNativeStdlib && generationState . producedLlvmModuleContainsStdlib } <EOL> . toList ( ) <EOL> . map { libraries -> <EOL> libraries . flatMap { it . bitcodePaths } . filter { it . isBitcode } <EOL> } <EOL> val nativeLibraries = config . nativeLibraries + config . launcherNativeLibraries <EOL> . takeIf { config . produce == CompilerOutputKind . PROGRAM } . orEmpty ( ) <EOL> val additionalBitcodeFilesToLink = generationState . llvm . additionalProducedBitcodeFiles <EOL> val exceptionsSupportNativeLibrary = listOf ( config . exceptionsSupportNativeLibrary ) <EOL> . takeIf { config . produce == CompilerOutputKind . DYNAMIC_CACHE } . orEmpty ( ) <EOL> val xcTestRunnerNativeLibrary = listOf ( config . xcTestLauncherNativeLibrary ) <EOL> . takeIf { config . produce == CompilerOutputKind . TEST_BUNDLE } . orEmpty ( ) <EOL> val additionalBitcodeFiles = nativeLibraries + <EOL> generatedBitcodeFiles + <EOL> additionalBitcodeFilesToLink + <EOL> bitcodeLibraries + <EOL> exceptionsSupportNativeLibrary + <EOL> xcTestRunnerNativeLibrary <EOL> val runtimeNativeLibraries = config . runtimeNativeLibraries <EOL> fun parseBitcodeFiles ( files : List < String > ) : List < LLVMModuleRef > = files . map { bitcodeFile -> <EOL> val parsedModule = parseBitcodeFile ( generationState . llvmContext , bitcodeFile ) <EOL> if ( ! generationState . shouldUseDebugInfoFromNativeLibs ( ) ) { <EOL> LLVMStripModuleDebugInfo ( parsedModule ) <EOL> } <EOL> parsedModule <EOL> } <EOL> val runtimeModules = parseBitcodeFiles ( ( runtimeNativeLibraries + bitcodePartOfStdlib ) . takeIf { generationState . shouldLinkRuntimeNativeLibraries } . orEmpty ( ) ) <EOL> val additionalModules = parseBitcodeFiles ( additionalBitcodeFiles ) <EOL> return LlvmModules ( runtimeModules . ifNotEmpty { this + generationState . generateRuntimeConstantsModule ( ) } ? : emptyList ( ) , additionalModules + listOfNotNull ( patchObjCRuntimeModule ( generationState ) ) ) <EOL> }

/**
 * Deserialize, generate, patch all bitcode dependencies and classify them into two sets:
 * - Runtime modules. These may be used as an input for a separate LTO (e.g. for debug builds).
 * - Everything else.
 */


@ Throws ( IOException :: class ) <EOL> public fun extractFashionImages ( archivePath : String ) : Array < FloatArray >

{ <EOL> val archiveStream = DataInputStream ( GZIPInputStream ( OnHeapDataset :: class . java . classLoader . getResourceAsStream ( archivePath ) ) ) <EOL> val magic = archiveStream . readInt ( ) <EOL> require ( IMAGE_ARCHIVE_MAGIC == magic ) { "<STR_LIT>" } <EOL> val imageCount = archiveStream . readInt ( ) <EOL> val imageRows = archiveStream . readInt ( ) <EOL> val imageCols = archiveStream . readInt ( ) <EOL> println ( String . format ( "<STR_LIT>" , imageCount , imageRows , imageCols , archivePath ) ) <EOL> val imageBuffer = ByteArray ( imageRows * imageCols ) <EOL> val images = Array ( imageCount ) { <EOL> archiveStream . readFully ( imageBuffer ) <EOL> toNormalizedVector ( imageBuffer ) <EOL> } <EOL> return images <EOL> }

/**
 * Extracts Fashion Mnist images from [archivePath].
 */


@ Throws ( IOException :: class ) <EOL> public fun extractFashionLabels ( archivePath : String , numClasses : Int ) : Array < FloatArray >

{ <EOL> val archiveStream = DataInputStream ( GZIPInputStream ( OnHeapDataset :: class . java . classLoader . getResourceAsStream ( archivePath ) ) ) <EOL> val magic = archiveStream . readInt ( ) <EOL> require ( LABEL_ARCHIVE_MAGIC == magic ) { "<STR_LIT>" } <EOL> val labelCount = archiveStream . readInt ( ) <EOL> println ( String . format ( "<STR_LIT>" , labelCount , archivePath ) ) <EOL> val labelBuffer = ByteArray ( labelCount ) <EOL> archiveStream . readFully ( labelBuffer ) <EOL> val floats = Array ( labelCount ) { <EOL> OnHeapDataset . toOneHotVector ( numClasses , labelBuffer [ it ] ) <EOL> } <EOL> return floats <EOL> }

/**
 * Extracts Fashion Mnist labels from [archivePath] with number of classes [numClasses].
 */


override fun subList ( fromIndex : Int , toIndex : Int ) : ImmutableList < E >

= SubList ( this , fromIndex , toIndex )

/**
 * Returns a view of the portion of this list between the specified [fromIndex] (inclusive) and [toIndex] (exclusive).
 *
 * The returned list is backed by this list.
 *
 * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this list.
 * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
 */


{ <EOL> ListImplementation . checkRangeIndexes ( fromIndex , toIndex , this . _size ) <EOL> return SubList ( source , this . fromIndex + fromIndex , this . fromIndex + toIndex ) <EOL> }


override fun add ( element : @ UnsafeVariance E ) : PersistentList < E >

/**
 * Returns a new persistent list with the specified [element] appended.
 */


override fun addAll ( elements : Collection < @ UnsafeVariance E > ) : PersistentList < E >

/**
 * Returns the result of appending all elements of the specified [elements] collection to this list.
 *
 * The elements are appended in the order they appear in the specified collection.
 *
 * @return a new persistent list with elements of the specified [elements] collection appended;
 * or this instance if the specified collection is empty.
 */


override fun remove ( element : @ UnsafeVariance E ) : PersistentList < E >

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


override fun removeAll ( elements : Collection < @ UnsafeVariance E > ) : PersistentList < E >

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


override fun removeAll ( predicate : ( E ) -> Boolean ) : PersistentList < E >

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


override fun retainAll ( elements : Collection < @ UnsafeVariance E > ) : PersistentList < E >

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


override fun clear ( ) : PersistentList < E >

/**
 * Returns an empty persistent list.
 */


public fun addAll ( index : Int , c : Collection < @ UnsafeVariance E > ) : PersistentList < E >

/**
 * Returns the result of inserting the specified [c] collection at the specified [index].
 *
 * @return a new persistent list with the specified [c] collection inserted at the specified [index];
 * or this instance if the specified collection is empty.
 *
 * @throws IndexOutOfBoundsException if [index] is out of bounds of this list.
 */


public fun set ( index : Int , element : @ UnsafeVariance E ) : PersistentList < E >

/**
 * Returns a new persistent list with the element at the specified [index] replaced with the specified [element].
 *
 * @throws IndexOutOfBoundsException if [index] is out of bounds of this list.
 */


public fun add ( index : Int , element : @ UnsafeVariance E ) : PersistentList < E >

/**
 * Returns a new persistent list with the specified [element] inserted at the specified [index].
 *
 * @throws IndexOutOfBoundsException if [index] is out of bounds of this list.
 */


public fun removeAt ( index : Int ) : PersistentList < E >

/**
 * Returns a new persistent list with the element at the specified [index] removed.
 *
 * @throws IndexOutOfBoundsException if [index] is out of bounds of this list.
 */


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


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

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

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


public fun collectPossibleReferenceShortenings ( file : KtFile , selection : TextRange = file . textRange , shortenOptions : ShortenOptions = ShortenOptions . DEFAULT , classShortenStrategy : ( KtClassLikeSymbol ) -> ShortenStrategy = defaultClassShortenStrategy , callableShortenStrategy : ( KtCallableSymbol ) -> ShortenStrategy = defaultCallableShortenStrategy ) : ShortenCommand

= <EOL> withValidityAssertion { <EOL> analysisSession . referenceShortener . collectShortenings ( file , selection , shortenOptions , classShortenStrategy , callableShortenStrategy ) <EOL> }

/**
 * Collects possible references to shorten. By default, it shortens a fully-qualified members to the outermost class and does not
 * shorten enum entries. In case of KDoc shortens reference only if it is already imported.
 *
 * N.B. This API is not implemented for the FE10 implementation!
 * For a K1- and K2-compatible API, use [org.jetbrains.kotlin.idea.base.codeInsight.ShortenReferencesFacility].
 *
 * Also see [org.jetbrains.kotlin.idea.base.analysis.api.utils.shortenReferences] and functions around it.
 */


public fun collectPossibleReferenceShorteningsInElement ( element : KtElement , shortenOptions : ShortenOptions = ShortenOptions . DEFAULT , classShortenStrategy : ( KtClassLikeSymbol ) -> ShortenStrategy = defaultClassShortenStrategy , callableShortenStrategy : ( KtCallableSymbol ) -> ShortenStrategy = defaultCallableShortenStrategy ) : ShortenCommand

= <EOL> withValidityAssertion { <EOL> analysisSession . referenceShortener . collectShortenings ( element . containingKtFile , element . textRange , shortenOptions , classShortenStrategy , callableShortenStrategy ) <EOL> }

/**
 * Collects possible references to shorten in [element]s text range. By default, it shortens a fully-qualified members to the outermost
 * class and does not shorten enum entries.
 *
 * N.B. This API is not implemented for the FE10 implementation!
 * For a K1- and K2-compatible API, use [org.jetbrains.kotlin.idea.base.codeInsight.ShortenReferencesFacility].
 *
 * Also see [org.jetbrains.kotlin.idea.base.analysis.api.utils.shortenReferences] and functions around it.
 */


public fun getResolveExtensionScopeWithTopLevelDeclarations ( ) : KtScope

= withValidityAssertion { <EOL> analysisSession . resolveExtensionInfoProvider . getResolveExtensionScopeWithTopLevelDeclarations ( ) <EOL> }

/**
 * Returns [KtScope] which contains all top-level callable declarations which are generated by [KtResolveExtension]
 *
 * @see org.jetbrains.kotlin.analysis.api.resolve.extensions.KtResolveExtension
 * @see org.jetbrains.kotlin.analysis.api.resolve.extensions.KtResolveExtensionProvider
 */


public fun KtElement . getResolveExtensionNavigationElements ( ) : Collection < PsiElement >

= withValidityAssertion { <EOL> analysisSession . resolveExtensionInfoProvider . getResolveExtensionNavigationElements ( this ) <EOL> }

/**
 * Returns the [PsiElement]s which should be used as a navigation target in place of this [KtElement]
 * provided by a [KtResolveExtension].
 *
 * These [PsiElement]s will typically be the source item(s) that caused the given [KtElement] to be generated
 * by the [KtResolveExtension]. For example, for a [KtElement] generated by a resource compiler, this will
 * typically be a list of the [PsiElement]s of the resource items in the corresponding resource file.
 *
 * @see org.jetbrains.kotlin.analysis.api.resolve.extensions.KtResolveExtension
 * @see org.jetbrains.kotlin.analysis.api.resolve.extensions.KtResolveExtensionProvider
 */


private fun cleanBlockHoundTraces ( frames : List < String > ) : List < String >

{ <EOL> val result = mutableListOf < String > ( ) <EOL> val blockHoundSubstr = "<STR_LIT>" <EOL> var i = <NUM_LIT:0> <EOL> while ( i < frames . size ) { <EOL> result . add ( frames [ i ] . replace ( blockHoundSubstr , "<STR_LIT>" ) ) <EOL> if ( frames [ i ] . contains ( blockHoundSubstr ) ) { <EOL> i += <NUM_LIT:1> <EOL> } <EOL> i += <NUM_LIT:1> <EOL> } <EOL> return result <EOL> }

/** Clean the stacktraces from artifacts of BlockHound instrumentation
 *
 * BlockHound works by switching a native call by a class generated with ByteBuddy, which, if the blocking
 * call is allowed in this context, in turn calls the real native call that is now available under a
 * different name.
 *
 * The traces thus undergo the following two changes when the execution is instrumented:
 * - The original native call is replaced with a non-native one with the same FQN, and
 * - An additional native call is placed on top of the stack, with the original name that also has
 * `$$BlockHound$$_` prepended at the last component.
 */


private fun removeJavaUtilConcurrentTraces ( frames : List < String > ) : List < String >

= <EOL> frames . filter { ! it . contains ( "<STR_LIT>" ) }

/**
 * Removes all frames that contain "java.util.concurrent" in it.
 *
 * We do leverage Java's locks for proper rendezvous and to fix the coroutine stack's state,
 * but this API doesn't have (nor expected to) stable stacktrace, so we are filtering all such
 * frames out.
 *
 * See https://github.com/Kotlin/kotlinx.coroutines/issues/3700 for the example of failure
 */


fun parse ( header : String ) : CoroutineDumpHeader

{ <EOL> val ( identFull , stateFull ) = header . split ( "<STR_LIT:U+002CU+0020>" , limit = <NUM_LIT:2> ) <EOL> val nameAndClassName = identFull . removePrefix ( "<STR_LIT>" ) . split ( '<CHAR_LIT>' , limit = <NUM_LIT:2> ) [ <NUM_LIT:0> ] <EOL> val ( name , className ) = nameAndClassName . split ( '<CHAR_LIT::>' , limit = <NUM_LIT:2> ) . let { parts -> <EOL> val ( quotedName , classNameWithState ) = if ( parts . size == <NUM_LIT:1> ) { <EOL> null to parts [ <NUM_LIT:0> ] <EOL> } else { <EOL> parts [ <NUM_LIT:0> ] to parts [ <NUM_LIT:1> ] <EOL> } <EOL> val name = quotedName ? . removeSurrounding ( "<STR_LIT>" ) ? . split ( '<CHAR_LIT>' , limit = <NUM_LIT:2> ) ? . get ( <NUM_LIT:0> ) <EOL> val className = classNameWithState . replace ( "<STR_LIT>" . toRegex ( ) , "<STR_LIT>" ) <EOL> name to className <EOL> } <EOL> val state = stateFull . removePrefix ( "<STR_LIT>" ) <EOL> return CoroutineDumpHeader ( name , className , state ) <EOL> }

/**
 * Parses following strings:
 *
 * - Coroutine "coroutine#10":DeferredCoroutine{Active}@66d87651, state: RUNNING
 * - Coroutine DeferredCoroutine{Active}@66d87651, state: RUNNING
 *
 * into:
 *
 * - `CoroutineDumpHeader(name = "coroutine", className = "DeferredCoroutine", state = "RUNNING")`
 * - `CoroutineDumpHeader(name = null, className = "DeferredCoroutine", state = "RUNNING")`
 */


{ <EOL> val javaVersion = when ( val specVersion = System . getProperty ( "<STR_LIT>" ) ) { <EOL> "<STR_LIT:1.8>" -> <NUM_LIT:8> <EOL> else -> specVersion . toInt ( ) <EOL> } <EOL> return javaVersion >= <NUM_LIT:11> <EOL> }

/**
 * AGP 7+ is compiled with Java 8, but requires Java 11+ to run:
 *
 * > EvalIssueException: Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
 */


private fun TypeInfo . isSubtypeOf ( other : TypeInfo , context : CheckerContext ) : Boolean

{ <EOL> val isDirectSubtype = notNullType . isSubtypeOf ( other . notNullType , context . session ) <EOL> val counterpart = other . notNullType . getCounterpartRelativelyToPlatform ( context . session ) <EOL> return isDirectSubtype || counterpart ? . let { notNullType . isSubtypeOf ( it , context . session ) } == true <EOL> }

/**
 * This function de-facto replicates a single-side check from [org.jetbrains.kotlin.types.CastDiagnosticsUtil.isRelated].
 */


internal fun shouldReportAsPerRules1 ( l : TypeInfo , r : TypeInfo , context : CheckerContext ) : Boolean

{ <EOL> val oneIsFinal = l . isFinal || r . isFinal <EOL> return when { <EOL> oneIsFinal -> areUnrelated ( l , r , context ) <EOL> else -> false <EOL> } <EOL> }

/**
 * See [KT-57779](https://youtrack.jetbrains.com/issue/KT-57779) for more information.
 */


fun convertFile ( file : LighterASTNode , sourceFile : KtSourceFile , linesMapping : KtSourceFileLinesMapping ) : FirFile

{ <EOL> if ( file . tokenType != KT_FILE ) { <EOL> throw Exception ( ) <EOL> } <EOL> val fileSymbol = FirFileSymbol ( ) <EOL> var fileAnnotations = mutableListOf < FirAnnotation > ( ) <EOL> val importList = mutableListOf < FirImport > ( ) <EOL> val firDeclarationList = mutableListOf < FirDeclaration > ( ) <EOL> val modifierList = mutableListOf < LighterASTNode > ( ) <EOL> context . packageFqName = FqName . ROOT <EOL> var packageDirective : FirPackageDirective ? = null <EOL> file . forEachChildren { child -> <EOL> when ( child . tokenType ) { <EOL> FILE_ANNOTATION_LIST -> { <EOL> withContainerSymbol ( fileSymbol ) { <EOL> fileAnnotations += convertAnnotationList ( child ) <EOL> } <EOL> } <EOL> PACKAGE_DIRECTIVE -> { <EOL> packageDirective = convertPackageDirective ( child ) . also { context . packageFqName = it . packageFqName } <EOL> } <EOL> IMPORT_LIST -> importList += convertImportDirectives ( child ) <EOL> CLASS -> firDeclarationList += convertClass ( child ) <EOL> FUN -> firDeclarationList += convertFunctionDeclaration ( child ) as FirDeclaration <EOL> KtNodeTypes . PROPERTY -> firDeclarationList += convertPropertyDeclaration ( child ) <EOL> TYPEALIAS -> firDeclarationList += convertTypeAlias ( child ) <EOL> OBJECT_DECLARATION -> firDeclarationList += convertClass ( child ) <EOL> DESTRUCTURING_DECLARATION -> firDeclarationList += buildErrorTopLevelDestructuringDeclaration ( child . toFirSourceElement ( ) ) <EOL> SCRIPT -> { <EOL> } <EOL> MODIFIER_LIST -> modifierList += child <EOL> } <EOL> } <EOL> modifierList . forEach { <EOL> firDeclarationList += buildErrorTopLevelDeclarationForDanglingModifierList ( it ) <EOL> } <EOL> return buildFile { <EOL> symbol = fileSymbol <EOL> source = file . toFirSourceElement ( ) <EOL> origin = FirDeclarationOrigin . Source <EOL> moduleData = baseModuleData <EOL> name = sourceFile . name <EOL> this . sourceFile = sourceFile <EOL> this . sourceFileLinesMapping = linesMapping <EOL> this . packageDirective = packageDirective ? : buildPackageDirective { packageFqName = context . packageFqName } <EOL> annotations += fileAnnotations <EOL> imports += importList <EOL> declarations += firDeclarationList <EOL> } <EOL> }

/**
 * [org.jetbrains.kotlin.parsing.KotlinParsing.parseFile]
 * [org.jetbrains.kotlin.parsing.KotlinParsing.parsePreamble]
 */


fun convertBlockExpression ( block : LighterASTNode ) : FirBlock

{ <EOL> return convertBlockExpressionWithoutBuilding ( block ) . build ( ) <EOL> }

/**
 * @see org.jetbrains.kotlin.parsing.KotlinParsing.parseBlockExpression
 */


private fun convertPackageDirective ( packageNode : LighterASTNode ) : FirPackageDirective

{ <EOL> var packageName : FqName = FqName . ROOT <EOL> packageNode . forEachChildren { <EOL> when ( it . tokenType ) { <EOL> DOT_QUALIFIED_EXPRESSION , REFERENCE_EXPRESSION -> packageName = FqName ( it . getAsStringWithoutBacktick ( ) ) <EOL> } <EOL> } <EOL> return buildPackageDirective { <EOL> packageFqName = packageName <EOL> source = packageNode . toFirSourceElement ( ) <EOL> } <EOL> }

/**
 * @see org.jetbrains.kotlin.parsing.KotlinParsing.parsePackageName
 */


private fun convertImportDirective ( importDirective : LighterASTNode ) : FirImport

{ <EOL> var importedFqName : FqName ? = null <EOL> var isAllUnder = false <EOL> var aliasName : String ? = null <EOL> var aliasSource : KtSourceElement ? = null <EOL> importDirective . forEachChildren { <EOL> when ( it . tokenType ) { <EOL> REFERENCE_EXPRESSION , DOT_QUALIFIED_EXPRESSION -> { <EOL> importedFqName = mutableListOf < String > ( ) <EOL> . apply { collectSegments ( it ) } <EOL> . joinToString ( "<STR_LIT:.>" ) <EOL> . let { FqName ( it ) } <EOL> } <EOL> MUL -> isAllUnder = true <EOL> IMPORT_ALIAS -> { <EOL> val importAlias = convertImportAlias ( it ) <EOL> if ( importAlias != null ) { <EOL> aliasName = importAlias . first <EOL> aliasSource = importAlias . second <EOL> } <EOL> } <EOL> } <EOL> } <EOL> return buildImport { <EOL> source = importDirective . toFirSourceElement ( ) <EOL> this . importedFqName = importedFqName <EOL> this . isAllUnder = isAllUnder <EOL> this . aliasName = aliasName ? . let { Name . identifier ( it ) } <EOL> this . aliasSource = aliasSource <EOL> } <EOL> }

/**
 * @see org.jetbrains.kotlin.parsing.KotlinParsing.parseImportDirective
 */


private fun convertImportDirectives ( importList : LighterASTNode ) : List < FirImport >

{ <EOL> return importList . forEachChildrenReturnList { node , container -> <EOL> when ( node . tokenType ) { <EOL> IMPORT_DIRECTIVE -> container += convertImportDirective ( node ) <EOL> } <EOL> } <EOL> }

/**
 * @see org.jetbrains.kotlin.parsing.KotlinParsing.parseImportDirectives
 */


private fun convertModifierList ( modifiers : LighterASTNode , isInClass : Boolean = false ) : Modifier

{ <EOL> val modifier = Modifier ( ) <EOL> modifiers . forEachChildren { <EOL> if ( it . tokenType is KtModifierKeywordToken ) { <EOL> modifier . addModifier ( it , isInClass ) <EOL> } <EOL> } <EOL> return modifier <EOL> }

/**
 * Convert only modifiers
 * @see org.jetbrains.kotlin.parsing.KotlinParsing.parseModifierList
 */


private fun convertAnnotationList ( annotations : LighterASTNode ) : List < FirAnnotationCall >

{ <EOL> return annotations . forEachChildrenReturnList < FirAnnotationCall > { node , list -> <EOL> when ( node . tokenType ) { <EOL> ANNOTATION -> list += convertAnnotation ( node ) <EOL> ANNOTATION_ENTRY -> list += convertAnnotationEntry ( node ) <EOL> } <EOL> } <EOL> }

/**
 * Convert only annotations
 * @see org.jetbrains.kotlin.parsing.KotlinParsing.parseModifierList
 */


private fun convertTypeModifierList ( modifiers : LighterASTNode ) : Modifier

{ <EOL> val typeModifier = Modifier ( ) <EOL> modifiers . forEachChildren { <EOL> when ( it . tokenType ) { <EOL> ANNOTATION -> typeModifier . annotations += convertAnnotation ( it ) <EOL> ANNOTATION_ENTRY -> typeModifier . annotations += convertAnnotationEntry ( it ) <EOL> is KtModifierKeywordToken -> typeModifier . addModifier ( it ) <EOL> } <EOL> } <EOL> return typeModifier <EOL> }

/**
 * @see org.jetbrains.kotlin.parsing.KotlinParsing.parseTypeModifierList
 */


private fun convertTypeArgumentModifierList ( modifiers : LighterASTNode ) : TypeProjectionModifier

{ <EOL> val typeArgumentModifier = TypeProjectionModifier ( ) <EOL> modifiers . forEachChildren { <EOL> when ( it . tokenType ) { <EOL> ANNOTATION -> typeArgumentModifier . annotations += convertAnnotation ( it ) <EOL> ANNOTATION_ENTRY -> typeArgumentModifier . annotations += convertAnnotationEntry ( it ) <EOL> is KtModifierKeywordToken -> typeArgumentModifier . addModifier ( it ) <EOL> } <EOL> } <EOL> return typeArgumentModifier <EOL> }

/**
 * @see org.jetbrains.kotlin.parsing.KotlinParsing.parseTypeArgumentModifierList
 */


private fun convertTypeParameterModifiers ( modifiers : LighterASTNode ) : TypeParameterModifier

{ <EOL> val modifier = TypeParameterModifier ( ) <EOL> modifiers . forEachChildren { <EOL> when ( it . tokenType ) { <EOL> ANNOTATION -> modifier . annotations += convertAnnotation ( it ) <EOL> ANNOTATION_ENTRY -> modifier . annotations += convertAnnotationEntry ( it ) <EOL> is KtModifierKeywordToken -> modifier . addModifier ( it ) <EOL> } <EOL> } <EOL> return modifier <EOL> }


fun convertAnnotation ( annotationNode : LighterASTNode ) : List < FirAnnotationCall >

{ <EOL> var annotationTarget : AnnotationUseSiteTarget ? = null <EOL> return annotationNode . forEachChildrenReturnList { node , container -> <EOL> when ( node . tokenType ) { <EOL> ANNOTATION_TARGET -> annotationTarget = convertAnnotationTarget ( node ) <EOL> ANNOTATION_ENTRY -> container += convertAnnotationEntry ( node , annotationTarget ) <EOL> } <EOL> } <EOL> }

/**
 * @see org.jetbrains.kotlin.parsing.KotlinParsing.parseAnnotationOrList
 */


private fun convertAnnotationTarget ( annotationUseSiteTarget : LighterASTNode ) : AnnotationUseSiteTarget

{ <EOL> lateinit var annotationTarget : AnnotationUseSiteTarget <EOL> annotationUseSiteTarget . forEachChildren { <EOL> when ( it . tokenType ) { <EOL> FIELD_KEYWORD -> annotationTarget = FIELD <EOL> FILE_KEYWORD -> annotationTarget = FILE <EOL> PROPERTY_KEYWORD -> annotationTarget = AnnotationUseSiteTarget . PROPERTY <EOL> GET_KEYWORD -> annotationTarget = PROPERTY_GETTER <EOL> SET_KEYWORD -> annotationTarget = PROPERTY_SETTER <EOL> RECEIVER_KEYWORD -> annotationTarget = RECEIVER <EOL> PARAM_KEYWORD -> annotationTarget = CONSTRUCTOR_PARAMETER <EOL> SETPARAM_KEYWORD -> annotationTarget = SETTER_PARAMETER <EOL> DELEGATE_KEYWORD -> annotationTarget = PROPERTY_DELEGATE_FIELD <EOL> } <EOL> } <EOL> return annotationTarget <EOL> }

/**
 * @see org.jetbrains.kotlin.parsing.KotlinParsing.parseAnnotationTarget
 */


fun convertAnnotationEntry ( unescapedAnnotation : LighterASTNode , defaultAnnotationUseSiteTarget : AnnotationUseSiteTarget ? = null , diagnostic : ConeDiagnostic ? = null , ) : FirAnnotationCall

{ <EOL> var annotationUseSiteTarget : AnnotationUseSiteTarget ? = null <EOL> lateinit var constructorCalleePair : Pair < FirTypeRef , List < FirExpression > > <EOL> unescapedAnnotation . forEachChildren { <EOL> when ( it . tokenType ) { <EOL> ANNOTATION_TARGET -> annotationUseSiteTarget = convertAnnotationTarget ( it ) <EOL> CONSTRUCTOR_CALLEE -> constructorCalleePair = convertConstructorInvocation ( unescapedAnnotation ) <EOL> } <EOL> } <EOL> val qualifier = ( constructorCalleePair . first as? FirUserTypeRef ) ? . qualifier ? . last ( ) <EOL> val name = qualifier ? . name ? : Name . special ( "<STR_LIT>" ) <EOL> val theCalleeReference = buildSimpleNamedReference { <EOL> source = unescapedAnnotation <EOL> . getChildNodeByType ( CONSTRUCTOR_CALLEE ) <EOL> ? . getChildNodeByType ( TYPE_REFERENCE ) <EOL> ? . getChildNodeByType ( USER_TYPE ) <EOL> ? . getChildNodeByType ( REFERENCE_EXPRESSION ) <EOL> ? . toFirSourceElement ( ) <EOL> this . name = name <EOL> } <EOL> return if ( diagnostic == null ) { <EOL> buildAnnotationCall { <EOL> source = unescapedAnnotation . toFirSourceElement ( ) <EOL> useSiteTarget = annotationUseSiteTarget ? : defaultAnnotationUseSiteTarget <EOL> annotationTypeRef = constructorCalleePair . first <EOL> calleeReference = theCalleeReference <EOL> extractArgumentsFrom ( constructorCalleePair . second ) <EOL> typeArguments += qualifier ? . typeArgumentList ? . typeArguments ? : listOf ( ) <EOL> containingDeclarationSymbol = context . containerSymbol <EOL> } <EOL> } else { <EOL> buildErrorAnnotationCall { <EOL> source = unescapedAnnotation . toFirSourceElement ( ) <EOL> useSiteTarget = annotationUseSiteTarget ? : defaultAnnotationUseSiteTarget <EOL> annotationTypeRef = constructorCalleePair . first <EOL> this . diagnostic = diagnostic <EOL> calleeReference = theCalleeReference <EOL> extractArgumentsFrom ( constructorCalleePair . second ) <EOL> typeArguments += qualifier ? . typeArgumentList ? . typeArguments ? : listOf ( ) <EOL> containingDeclarationSymbol = context . containerSymbol <EOL> } <EOL> } <EOL> }

/**
 * @see org.jetbrains.kotlin.parsing.KotlinParsing.parseAnnotation
 * can be treated as unescapedAnnotation
 */


private fun convertClass ( classNode : LighterASTNode ) : FirDeclaration

{ <EOL> var modifiers : Modifier ? = null <EOL> var classKind : ClassKind = ClassKind . CLASS <EOL> var identifier : String ? = null <EOL> val firTypeParameters = mutableListOf < FirTypeParameter > ( ) <EOL> var primaryConstructor : LighterASTNode ? = null <EOL> val typeConstraints = mutableListOf < TypeConstraint > ( ) <EOL> val classAnnotations = mutableListOf < FirAnnotationCall > ( ) <EOL> var classBody : LighterASTNode ? = null <EOL> var superTypeList : LighterASTNode ? = null <EOL> var typeParameterList : LighterASTNode ? = null <EOL> classNode . forEachChildren { <EOL> when ( it . tokenType ) { <EOL> MODIFIER_LIST -> modifiers = convertModifierList ( it , isInClass = true ) <EOL> IDENTIFIER -> identifier = it . asText <EOL> } <EOL> } <EOL> val calculatedModifiers = modifiers ? : Modifier ( ) <EOL> val className = identifier . nameAsSafeName ( if ( calculatedModifiers . isCompanion ( ) ) "<STR_LIT>" else "<STR_LIT>" ) <EOL> val isLocalWithinParent = classNode . getParent ( ) ? . elementType != CLASS_BODY && isClassLocal ( classNode ) { getParent ( ) } <EOL> val classIsExpect = calculatedModifiers . hasExpect ( ) || context . containerIsExpect <EOL> val classIsKotlinAny = identifier . nameAsSafeName ( ) == StandardNames . FqNames . any . shortName ( ) <EOL> && classNode . getParent ( ) ? . getChildNodeByType ( PACKAGE_DIRECTIVE ) ? . getChildNodeByType ( REFERENCE_EXPRESSION ) <EOL> ? . getReferencedNameAsName ( ) == StandardNames . BUILT_INS_PACKAGE_NAME <EOL> return withChildClassName ( className , isExpect = classIsExpect , isLocalWithinParent ) { <EOL> val classSymbol = FirRegularClassSymbol ( context . currentClassId ) <EOL> withContainerSymbol ( classSymbol ) { <EOL> classNode . forEachChildren { <EOL> when ( it . tokenType ) { <EOL> MODIFIER_LIST -> { <EOL> classAnnotations += convertAnnotationList ( it ) <EOL> } <EOL> CLASS_KEYWORD -> classKind = ClassKind . CLASS <EOL> INTERFACE_KEYWORD -> classKind = ClassKind . INTERFACE <EOL> OBJECT_KEYWORD -> classKind = ClassKind . OBJECT <EOL> TYPE_PARAMETER_LIST -> typeParameterList = it <EOL> PRIMARY_CONSTRUCTOR -> primaryConstructor = it <EOL> SUPER_TYPE_LIST -> superTypeList = it <EOL> TYPE_CONSTRAINT_LIST -> typeConstraints += convertTypeConstraints ( it ) <EOL> CLASS_BODY -> classBody = it <EOL> } <EOL> } <EOL> if ( classKind == ClassKind . CLASS ) { <EOL> classKind = when { <EOL> calculatedModifiers . isEnum ( ) -> ClassKind . ENUM_CLASS <EOL> calculatedModifiers . isAnnotation ( ) -> ClassKind . ANNOTATION_CLASS <EOL> else -> classKind <EOL> } <EOL> } <EOL> val isLocal = context . inLocalContext <EOL> val status = FirDeclarationStatusImpl ( if ( isLocal ) Visibilities . Local else calculatedModifiers . getVisibility ( publicByDefault = true ) , calculatedModifiers . getModality ( isClassOrObject = true ) ) . apply { <EOL> isExpect = classIsExpect <EOL> isActual = calculatedModifiers . hasActual ( ) <EOL> isInner = calculatedModifiers . isInner ( ) <EOL> isCompanion = calculatedModifiers . isCompanion ( ) && classKind == ClassKind . OBJECT <EOL> isData = calculatedModifiers . isDataClass ( ) <EOL> isInline = calculatedModifiers . isInlineClass ( ) <EOL> isFun = calculatedModifiers . isFunctionalInterface ( ) <EOL> isExternal = calculatedModifiers . hasExternal ( ) <EOL> } <EOL> typeParameterList ? . let { firTypeParameters += convertTypeParameters ( it , typeConstraints , classSymbol ) } <EOL> withCapturedTypeParameters ( status . isInner || isLocal , classNode . toFirSourceElement ( ) , firTypeParameters ) { <EOL> var delegatedFieldsMap : Map < Int , FirFieldSymbol > ? = null <EOL> buildRegularClass { <EOL> source = classNode . toFirSourceElement ( ) <EOL> moduleData = baseModuleData <EOL> origin = FirDeclarationOrigin . Source <EOL> name = className <EOL> this . status = status <EOL> this . classKind = classKind <EOL> scopeProvider = baseScopeProvider <EOL> symbol = classSymbol <EOL> annotations += classAnnotations <EOL> typeParameters += firTypeParameters <EOL> context . appendOuterTypeParameters ( ignoreLastLevel = true , typeParameters ) <EOL> val selfType = classNode . toDelegatedSelfType ( this ) <EOL> registerSelfType ( selfType ) <EOL> val delegationSpecifiers = superTypeList ? . let { convertDelegationSpecifiers ( it ) } <EOL> var delegatedSuperTypeRef : FirTypeRef ? = delegationSpecifiers ? . superTypeCalls ? . lastOrNull ( ) ? . delegatedSuperTypeRef <EOL> val delegatedConstructorSource : KtLightSourceElement ? = delegationSpecifiers ? . superTypeCalls ? . lastOrNull ( ) ? . source <EOL> val superTypeRefs = mutableListOf < FirTypeRef > ( ) <EOL> delegationSpecifiers ? . let { superTypeRefs += it . superTypesRef } <EOL> when { <EOL> calculatedModifiers . isEnum ( ) && ( classKind == ClassKind . ENUM_CLASS ) && delegatedConstructorSource == null -> { <EOL> delegatedSuperTypeRef = buildResolvedTypeRef { <EOL> type = ConeClassLikeTypeImpl ( implicitEnumType . type . lookupTag , arrayOf ( selfType . type ) , isNullable = false ) <EOL> } <EOL> superTypeRefs += delegatedSuperTypeRef <EOL> } <EOL> calculatedModifiers . isAnnotation ( ) && ( classKind == ClassKind . ANNOTATION_CLASS ) -> { <EOL> superTypeRefs += implicitAnnotationType <EOL> delegatedSuperTypeRef = implicitAnyType <EOL> } <EOL> } <EOL> if ( superTypeRefs . isEmpty ( ) && ! classIsKotlinAny ) { <EOL> superTypeRefs += implicitAnyType <EOL> delegatedSuperTypeRef = implicitAnyType <EOL> } <EOL> this . superTypeRefs += superTypeRefs <EOL> val secondaryConstructors = classBody . getChildNodesByType ( SECONDARY_CONSTRUCTOR ) <EOL> val classWrapper = ClassWrapper ( calculatedModifiers , classKind , this , hasSecondaryConstructor = secondaryConstructors . isNotEmpty ( ) , hasDefaultConstructor = if ( primaryConstructor != null ) ! primaryConstructor ! ! . hasValueParameters ( ) else secondaryConstructors . isEmpty ( ) || secondaryConstructors . any { ! it . hasValueParameters ( ) } , delegatedSelfTypeRef = selfType , delegatedSuperTypeRef = delegatedSuperTypeRef ? : FirImplicitTypeRefImplWithoutSource , delegatedSuperCalls = delegationSpecifiers ? . superTypeCalls ? : emptyList ( ) ) <EOL> val primaryConstructorWrapper = convertPrimaryConstructor ( classNode , primaryConstructor , selfType . source , classWrapper , delegatedConstructorSource , containingClassIsExpectClass = status . isExpect , isImplicitlyActual = status . isActual && ( status . isInline || classKind == ClassKind . ANNOTATION_CLASS ) , isKotlinAny = classIsKotlinAny , ) <EOL> val firPrimaryConstructor = primaryConstructorWrapper ? . firConstructor <EOL> firPrimaryConstructor ? . let { declarations += it } <EOL> delegationSpecifiers ? . delegateFieldsMap ? . values ? . mapTo ( declarations ) { it . fir } <EOL> delegatedFieldsMap = delegationSpecifiers ? . delegateFieldsMap ? . takeIf { it . isNotEmpty ( ) } <EOL> val properties = mutableListOf < FirProperty > ( ) <EOL> if ( primaryConstructor != null && firPrimaryConstructor != null ) { <EOL> properties += primaryConstructorWrapper . valueParameters <EOL> . filter { it . hasValOrVar ( ) } <EOL> . map { <EOL> it . toFirPropertyFromPrimaryConstructor ( baseModuleData , callableIdForName ( it . firValueParameter . name ) , classIsExpect , currentDispatchReceiverType ( ) , context ) <EOL> } <EOL> addDeclarations ( properties ) <EOL> } <EOL> classBody ? . let { <EOL> addDeclarations ( convertClassBody ( it , classWrapper ) ) <EOL> } <EOL> if ( calculatedModifiers . isDataClass ( ) && firPrimaryConstructor != null ) { <EOL> val zippedParameters = properties . map { it . source ! ! . lighterASTNode to it } <EOL> DataClassMembersGenerator ( classNode , this , zippedParameters , context . packageFqName , context . className , createClassTypeRefWithSourceKind = { firPrimaryConstructor . returnTypeRef . copyWithNewSourceKind ( it ) } , createParameterTypeRefWithSourceKind = { property , kind -> property . returnTypeRef . copyWithNewSourceKind ( kind ) } , addValueParameterAnnotations = { valueParam -> <EOL> valueParam . forEachChildren { <EOL> if ( it . tokenType == MODIFIER_LIST ) convertAnnotationList ( it ) . filterTo ( annotations ) { <EOL> it . useSiteTarget . appliesToPrimaryConstructorParameter ( ) <EOL> } <EOL> } <EOL> } , ) . generate ( ) <EOL> } <EOL> if ( calculatedModifiers . isEnum ( ) ) { <EOL> generateValuesFunction ( baseModuleData , context . packageFqName , context . className , classIsExpect ) <EOL> generateValueOfFunction ( baseModuleData , context . packageFqName , context . className , classIsExpect ) <EOL> generateEntriesGetter ( baseModuleData , context . packageFqName , context . className , classIsExpect ) <EOL> } <EOL> initCompanionObjectSymbolAttr ( ) <EOL> contextReceivers . addAll ( convertContextReceivers ( classNode ) ) <EOL> } . also { <EOL> it . delegateFieldsMap = delegatedFieldsMap <EOL> } <EOL> } . also { <EOL> fillDanglingConstraintsTo ( firTypeParameters , typeConstraints , it ) <EOL> } <EOL> } <EOL> } . also { <EOL> if ( classNode . getParent ( ) ? . elementType == KtStubElementTypes . CLASS_BODY ) { <EOL> it . initContainingClassForLocalAttr ( ) <EOL> } <EOL> } <EOL> }

/**
 * @see org.jetbrains.kotlin.parsing.KotlinParsing.parseClassOrObject
 */


fun convertObjectLiteral ( objectLiteral : LighterASTNode ) : FirElement

{ <EOL> return withChildClassName ( SpecialNames . ANONYMOUS , forceLocalContext = true , isExpect = false ) { <EOL> var delegatedFieldsMap : Map < Int , FirFieldSymbol > ? = null <EOL> buildAnonymousObjectExpression { <EOL> source = objectLiteral . toFirSourceElement ( ) <EOL> anonymousObject = buildAnonymousObject { <EOL> val objectDeclaration = objectLiteral . getChildNodesByType ( OBJECT_DECLARATION ) . first ( ) <EOL> source = objectDeclaration . toFirSourceElement ( ) <EOL> origin = FirDeclarationOrigin . Source <EOL> moduleData = baseModuleData <EOL> classKind = ClassKind . CLASS <EOL> scopeProvider = baseScopeProvider <EOL> symbol = FirAnonymousObjectSymbol ( context . packageFqName ) <EOL> status = FirDeclarationStatusImpl ( Visibilities . Local , Modality . FINAL ) <EOL> context . appendOuterTypeParameters ( ignoreLastLevel = false , typeParameters ) <EOL> val delegatedSelfType = objectDeclaration . toDelegatedSelfType ( this ) <EOL> registerSelfType ( delegatedSelfType ) <EOL> var modifiers : Modifier ? = null <EOL> val objectAnnotations = mutableListOf < FirAnnotationCall > ( ) <EOL> var primaryConstructor : LighterASTNode ? = null <EOL> val superTypeRefs = mutableListOf < FirTypeRef > ( ) <EOL> var delegatedSuperTypeRef : FirTypeRef ? = null <EOL> var classBody : LighterASTNode ? = null <EOL> var delegatedConstructorSource : KtLightSourceElement ? = null <EOL> var delegatedSuperCalls : List < DelegatedConstructorWrapper > ? = null <EOL> var delegateFields : List < FirField > ? = null <EOL> objectDeclaration . forEachChildren { <EOL> when ( it . tokenType ) { <EOL> MODIFIER_LIST -> { <EOL> modifiers = convertModifierList ( it ) <EOL> objectAnnotations += convertAnnotationList ( it ) <EOL> } <EOL> PRIMARY_CONSTRUCTOR -> primaryConstructor = it <EOL> SUPER_TYPE_LIST -> convertDelegationSpecifiers ( it ) . let { specifiers -> <EOL> delegatedSuperTypeRef = specifiers . superTypeCalls . lastOrNull ( ) ? . delegatedSuperTypeRef <EOL> superTypeRefs += specifiers . superTypesRef <EOL> delegatedConstructorSource = specifiers . superTypeCalls . lastOrNull ( ) ? . source <EOL> delegateFields = specifiers . delegateFieldsMap . values . map { it . fir } <EOL> delegatedFieldsMap = specifiers . delegateFieldsMap . takeIf { it . isNotEmpty ( ) } <EOL> delegatedSuperCalls = specifiers . superTypeCalls <EOL> } <EOL> CLASS_BODY -> classBody = it <EOL> } <EOL> } <EOL> superTypeRefs . ifEmpty { <EOL> superTypeRefs += implicitAnyType <EOL> delegatedSuperTypeRef = implicitAnyType <EOL> } <EOL> val delegatedSuperType = delegatedSuperTypeRef ? : FirImplicitTypeRefImplWithoutSource <EOL> annotations += objectAnnotations <EOL> this . superTypeRefs += superTypeRefs <EOL> val classWrapper = ClassWrapper ( modifiers ? : Modifier ( ) , ClassKind . OBJECT , this , hasSecondaryConstructor = classBody . getChildNodesByType ( SECONDARY_CONSTRUCTOR ) . isNotEmpty ( ) , hasDefaultConstructor = false , delegatedSelfTypeRef = delegatedSelfType , delegatedSuperTypeRef = delegatedSuperType , delegatedSuperCalls = delegatedSuperCalls ? : emptyList ( ) , ) <EOL> convertPrimaryConstructor ( objectDeclaration , primaryConstructor , delegatedSelfType . source , classWrapper , delegatedConstructorSource , containingClassIsExpectClass = false ) ? . let { this . declarations += it . firConstructor } <EOL> delegateFields ? . let { this . declarations += it } <EOL> classBody ? . let { <EOL> this . declarations += convertClassBody ( it , classWrapper ) <EOL> } <EOL> } . also { <EOL> it . delegateFieldsMap = delegatedFieldsMap <EOL> } <EOL> } <EOL> } <EOL> }

/**
 * @see org.jetbrains.kotlin.parsing.KotlinExpressionParsing.parseObjectLiteral
 * @see org.jetbrains.kotlin.fir.builder.RawFirBuilder.Visitor.visitObjectLiteralExpression
 */


private fun convertEnumEntry ( enumEntry : LighterASTNode , classWrapper : ClassWrapper ) : FirEnumEntry

{ <EOL> var modifiers : Modifier ? = null <EOL> val entryAnnotations = mutableListOf < FirAnnotationCall > ( ) <EOL> lateinit var identifier : String <EOL> val enumSuperTypeCallEntry = mutableListOf < FirExpression > ( ) <EOL> var classBodyNode : LighterASTNode ? = null <EOL> var superTypeCallEntry : LighterASTNode ? = null <EOL> enumEntry . getChildNodeByType ( IDENTIFIER ) ? . let { <EOL> identifier = it . asText <EOL> } <EOL> val enumEntryName = identifier . nameAsSafeName ( ) <EOL> val containingClassIsExpectClass = classWrapper . hasExpect ( ) || context . containerIsExpect <EOL> return buildEnumEntry { <EOL> symbol = FirEnumEntrySymbol ( CallableId ( context . currentClassId , enumEntryName ) ) <EOL> withContainerSymbol ( symbol ) { <EOL> enumEntry . forEachChildren { <EOL> when ( it . tokenType ) { <EOL> MODIFIER_LIST -> { <EOL> modifiers = convertModifierList ( it ) <EOL> entryAnnotations += convertAnnotationList ( it ) <EOL> } <EOL> INITIALIZER_LIST -> { <EOL> enumSuperTypeCallEntry += convertInitializerList ( it ) <EOL> it . getChildNodeByType ( SUPER_TYPE_CALL_ENTRY ) ? . let { superTypeCall -> <EOL> superTypeCallEntry = superTypeCall <EOL> } <EOL> } <EOL> CLASS_BODY -> classBodyNode = it <EOL> } <EOL> } <EOL> source = enumEntry . toFirSourceElement ( ) <EOL> moduleData = baseModuleData <EOL> origin = FirDeclarationOrigin . Source <EOL> returnTypeRef = classWrapper . delegatedSelfTypeRef <EOL> name = enumEntryName <EOL> status = FirDeclarationStatusImpl ( Visibilities . Public , Modality . FINAL ) . apply { <EOL> isStatic = true <EOL> isExpect = containingClassIsExpectClass <EOL> } <EOL> if ( classWrapper . hasDefaultConstructor && enumEntry . getChildNodeByType ( INITIALIZER_LIST ) == null && entryAnnotations . isEmpty ( ) && classBodyNode == null ) { <EOL> return@buildEnumEntry <EOL> } <EOL> annotations += entryAnnotations <EOL> initializer = withChildClassName ( enumEntryName , isExpect = false ) { <EOL> buildAnonymousObjectExpression { <EOL> val entrySource = enumEntry . toFirSourceElement ( KtFakeSourceElementKind . EnumInitializer ) <EOL> source = entrySource <EOL> anonymousObject = buildAnonymousObject { <EOL> source = entrySource <EOL> moduleData = baseModuleData <EOL> origin = FirDeclarationOrigin . Source <EOL> classKind = ClassKind . ENUM_ENTRY <EOL> scopeProvider = baseScopeProvider <EOL> symbol = FirAnonymousObjectSymbol ( context . packageFqName ) <EOL> status = FirDeclarationStatusImpl ( Visibilities . Local , Modality . FINAL ) <EOL> val enumClassWrapper = ClassWrapper ( modifiers ? : Modifier ( ) , ClassKind . ENUM_ENTRY , this , hasSecondaryConstructor = classBodyNode . getChildNodesByType ( SECONDARY_CONSTRUCTOR ) . isNotEmpty ( ) , hasDefaultConstructor = false , delegatedSelfTypeRef = buildResolvedTypeRef { <EOL> type = ConeClassLikeTypeImpl ( this @ buildAnonymousObject . symbol . toLookupTag ( ) , ConeTypeProjection . EMPTY_ARRAY , isNullable = false ) <EOL> } . also { registerSelfType ( it ) } , delegatedSuperTypeRef = classWrapper . delegatedSelfTypeRef , delegatedSuperCalls = listOf ( DelegatedConstructorWrapper ( classWrapper . delegatedSelfTypeRef , enumSuperTypeCallEntry , superTypeCallEntry ? . toFirSourceElement ( ) , ) ) ) <EOL> superTypeRefs += enumClassWrapper . delegatedSuperTypeRef <EOL> convertPrimaryConstructor ( enumEntry , null , enumEntry . toFirSourceElement ( ) , enumClassWrapper , superTypeCallEntry ? . toFirSourceElement ( ) , isEnumEntry = true , containingClassIsExpectClass = containingClassIsExpectClass ) ? . let { declarations += it . firConstructor } <EOL> classBodyNode ? . also { <EOL> withChildClassName ( SpecialNames . ANONYMOUS , forceLocalContext = true , isExpect = false ) { <EOL> declarations += convertClassBody ( it , enumClassWrapper ) <EOL> } <EOL> } <EOL> } <EOL> } <EOL> } <EOL> } <EOL> } . also { <EOL> it . containingClassForStaticMemberAttr = currentDispatchReceiverType ( ) ! ! . lookupTag <EOL> } <EOL> }

/**
 * @see org.jetbrains.kotlin.parsing.KotlinParsing.parseEnumEntry
 */


private fun convertInitializerList ( initializerList : LighterASTNode ) : List < FirExpression >

{ <EOL> val firValueArguments = mutableListOf < FirExpression > ( ) <EOL> initializerList . forEachChildren { <EOL> when ( it . tokenType ) { <EOL> SUPER_TYPE_CALL_ENTRY -> convertConstructorInvocation ( it ) . apply { <EOL> firValueArguments += second <EOL> } <EOL> } <EOL> } <EOL> return firValueArguments <EOL> }


private fun convertClassBody ( classBody : LighterASTNode , classWrapper : ClassWrapper ) : List < FirDeclaration >

{ <EOL> val modifierLists = mutableListOf < LighterASTNode > ( ) <EOL> var firDeclarations = classBody . forEachChildrenReturnList { node , container -> <EOL> @ Suppress ( "<STR_LIT>" ) <EOL> when ( node . tokenType ) { <EOL> ENUM_ENTRY -> container += convertEnumEntry ( node , classWrapper ) <EOL> CLASS -> container += convertClass ( node ) <EOL> FUN -> container += convertFunctionDeclaration ( node ) as FirDeclaration <EOL> KtNodeTypes . PROPERTY -> container += convertPropertyDeclaration ( node , classWrapper ) <EOL> TYPEALIAS -> container += convertTypeAlias ( node ) <EOL> OBJECT_DECLARATION -> container += convertClass ( node ) <EOL> CLASS_INITIALIZER -> container += convertAnonymousInitializer ( node , classWrapper ) <EOL> SECONDARY_CONSTRUCTOR -> container += convertSecondaryConstructor ( node , classWrapper ) <EOL> MODIFIER_LIST -> modifierLists += node <EOL> DESTRUCTURING_DECLARATION -> container += buildErrorTopLevelDestructuringDeclaration ( node . toFirSourceElement ( ) ) <EOL> } <EOL> } <EOL> for ( node in modifierLists ) { <EOL> firDeclarations += buildErrorTopLevelDeclarationForDanglingModifierList ( node ) <EOL> } <EOL> return firDeclarations <EOL> }

/**
 * @see org.jetbrains.kotlin.parsing.KotlinParsing.parseClassBody
 * @see org.jetbrains.kotlin.parsing.KotlinParsing.parseEnumClassBody
 */