fun List < ItemUse > . findFirstMatching ( path : String , isDirectory : Boolean , parentMatch : ItemUse ? ) : ItemUse ?

{ <EOL> val parentMatchLine = parentMatch ? . item ? . line <EOL> for ( use in this ) { <EOL> if ( parentMatchLine != null && use . item . line < parentMatchLine ) break <EOL> if ( use . rule . isMatch ( path , isDirectory ) ) { <EOL> use . used = true <EOL> return use <EOL> } <EOL> } <EOL> return parentMatch <EOL> }


fun findMatchLine ( path : String , isDirectory : Boolean , parentMatch : ItemUse ? ) : ItemUse ?

{ <EOL> return if ( isDirectory ) { <EOL> matchers . findFirstMatching ( path , isDirectory = true , parentMatch ) <EOL> } else { <EOL> fileMatchers . findFirstMatching ( path , isDirectory = false , parentMatch ) <EOL> } <EOL> }


fun visitFile ( file : File , parentMatch : ItemUse ? )

{ <EOL> val path = file . path . replace ( File . separatorChar , '<CHAR_LIT:/>' ) <EOL> if ( ignoreTracker . isIgnored ( path , isDirectory = false ) ) return <EOL> val matchedItem = findMatchLine ( path , isDirectory = false , parentMatch ) <EOL> if ( matchedItem != fallbackMatcher ) return <EOL> if ( unmatchedFilesTop . size < <NUM_LIT:10> ) { <EOL> unmatchedFilesTop . add ( file ) <EOL> } <EOL> }


fun visitDirectory ( directory : File , parentMatch : ItemUse ? , depth : Int )

{ <EOL> val path = directory . path . replace ( File . separatorChar , '<CHAR_LIT:/>' ) <EOL> if ( ignoreTracker . isIgnored ( path , isDirectory = true ) ) return <EOL> val directoryMatch = findMatchLine ( path , isDirectory = true , parentMatch ) <EOL> ignoreTracker . withDirectory ( directory ) { <EOL> for ( childName in ( directory . list ( ) ? : emptyArray ( ) ) ) { <EOL> val child = if ( directory == root ) { <EOL> File ( childName ) <EOL> } else { <EOL> File ( directory , childName ) <EOL> } <EOL> if ( child . isDirectory ) { <EOL> visitDirectory ( child , directoryMatch , depth + <NUM_LIT:1> ) <EOL> } else { <EOL> visitFile ( child , directoryMatch ) <EOL> } <EOL> } <EOL> } <EOL> }


{ <EOL> visitDirectory ( root , null , <NUM_LIT:0> ) <EOL> }


fun unusedMatchers ( ) : List < ItemUse >

{ <EOL> return matchers . filterNot { it . used } <EOL> }


fun isIgnored ( path : String , isDirectory : Boolean ) : Boolean

{ <EOL> return reversedIgnoreNodeStack . firstNotNullOfOrNull { ignoreNode -> ignoreNode . checkIgnored ( path , isDirectory ) } ? : false <EOL> }


inline fun withDirectory ( directory : File , action : ( ) -> Unit )

{ <EOL> val ignoreFile = directory . resolve ( "<STR_LIT>" ) . takeIf { it . exists ( ) } <EOL> if ( ignoreFile != null ) { <EOL> val ignoreNode = IgnoreNode ( ) . apply { <EOL> ignoreFile . inputStream ( ) . use { <EOL> parse ( ignoreFile . path , ignoreFile . inputStream ( ) ) <EOL> } <EOL> } <EOL> ignoreNodeStack . add ( ignoreNode ) <EOL> } <EOL> action ( ) <EOL> if ( ignoreFile != null ) { <EOL> ignoreNodeStack . removeAt ( ignoreNodeStack . lastIndex ) <EOL> } <EOL> }


{ <EOL> return "<STR_LIT>" <EOL> }


{ <EOL> return "<STR_LIT>" + owners . joinToString ( separator = "<STR_LIT:U+0020>" ) { it . quoteIfContainsSpaces ( ) } <EOL> }


private fun String . quoteIfContainsSpaces ( )

= if ( contains ( '<CHAR_LIT:U+0020>' ) ) "<STR_LIT>" else this


private fun parseCodeOwners ( file : File ) : CodeOwners

{ <EOL> fun parseDirective ( line : String , directive : String ) : String ? { <EOL> val value = line . substringAfter ( "<STR_LIT>" ) <EOL> if ( value != line ) return value <EOL> return null <EOL> } <EOL> val ownersPattern = "<STR_LIT>" . toRegex ( ) <EOL> fun parseOwnerNames ( ownerString : String ) : List < String > { <EOL> return ownersPattern . findAll ( ownerString ) . map { it . value . removeSurrounding ( "<STR_LIT>" ) } . toList ( ) <EOL> } <EOL> val permittedOwners = mutableListOf < CodeOwners . OwnerListEntry > ( ) <EOL> val patterns = mutableListOf < OwnershipPattern > ( ) <EOL> file . useLines { lines -> <EOL> for ( ( index , line ) in lines . withIndex ( ) ) { <EOL> val lineNumber = index + <NUM_LIT:1> <EOL> if ( line . startsWith ( "<STR_LIT:#>" ) ) { <EOL> val unknownDirective = parseDirective ( line , UNKNOWN_DIRECTIVE ) <EOL> if ( unknownDirective != null ) { <EOL> patterns += OwnershipPattern . UnknownPathPattern ( unknownDirective . trim ( ) , lineNumber ) <EOL> continue <EOL> } <EOL> val ownerListDirective = parseDirective ( line , OWNER_LIST_DIRECTIVE ) <EOL> if ( ownerListDirective != null ) { <EOL> parseOwnerNames ( ownerListDirective ) . mapTo ( permittedOwners ) { owner -> <EOL> CodeOwners . OwnerListEntry ( owner , lineNumber ) <EOL> } <EOL> } <EOL> } else if ( line . isNotBlank ( ) ) { <EOL> val ( pattern , owners ) = line . split ( '<CHAR_LIT:U+0020>' , limit = <NUM_LIT:2> ) <EOL> patterns += OwnershipPattern . Pattern ( pattern , parseOwnerNames ( owners ) , lineNumber ) <EOL> } <EOL> } <EOL> } <EOL> return CodeOwners ( permittedOwners , patterns ) <EOL> }


= expectThrowableMessage { <EOL> check ( <NUM_LIT:1> == <NUM_LIT:2> ) { "<STR_LIT>" } <EOL> }


abstract fun tryCalculateReturnTypeOrNull ( declaration : FirCallableDeclaration ) : FirResolvedTypeRef ?


fun tryCalculateReturnType ( declaration : FirCallableDeclaration ) : FirResolvedTypeRef

{ <EOL> return tryCalculateReturnTypeOrNull ( declaration ) <EOL> ? : errorWithAttachment ( "<STR_LIT>" ) { <EOL> withFirEntry ( "<STR_LIT>" , declaration ) <EOL> } <EOL> }


fun tryCalculateReturnType ( symbol : FirCallableSymbol < * > ) : FirResolvedTypeRef

{ <EOL> return tryCalculateReturnType ( symbol . fir ) <EOL> }


{ <EOL> val two = <NUM_LIT:2.0> <EOL> assertEquals ( <NUM_LIT:2> , two . toInt ( ) ) <EOL> return "<STR_LIT:OK>" <EOL> }


{ <EOL> addMouseListener ( object : MouseAdapter ( ) { <EOL> private var clickCount = <NUM_LIT:0> ; <EOL> override fun mouseClicked ( e : MouseEvent ) { <EOL> clickCount ++ ; <EOL> if ( clickCount > <NUM_LIT:3> ) GOD . sendMessage ( GodMEssages . TOO_MANY_CLICKS ) ; <EOL> } <EOL> } ) <EOL> enum class GodMessages { <EOL> TOO_MANY_CLICKS , <EOL> ONE_MORE_MESSAGE <EOL> } <EOL> val GOD = object { <EOL> fun sendMessage ( message : GodMEssage ) = throw RuntimeException ( message . name ) <EOL> } ; <EOL> }


= true


{ <EOL> return f_2 ( ) <EOL> }


private inline suspend fun f_2 ( ) : Unit

{ <EOL> if ( check ( ) ) return <EOL> return suspendCoroutineUninterceptedOrReturn { <EOL> TailCallOptimizationChecker . saveStackTrace ( it ) <EOL> COROUTINE_SUSPENDED <EOL> } <EOL> }


{ <EOL> c . startCoroutine ( EmptyContinuation ) <EOL> }


{ <EOL> builder { f_1 ( ) } <EOL> TailCallOptimizationChecker . checkNoStateMachineIn ( "<STR_LIT>" ) <EOL> return "<STR_LIT:OK>" <EOL> }


override fun < T , R > accept ( visitor : CirNodeVisitor < T , R > , data : T ) : R

= <EOL> visitor . visitClassConstructorNode ( this , data )


= CirNode . toString ( this )


fun computeJvmMethod ( function : IrFunction ) : Method

= <EOL> signatureCache . getOrPut ( function . symbol ) { context . defaultMethodSignatureMapper . mapAsmMethod ( function ) }


private fun canHaveSpecialBridge ( function : IrSimpleFunction ) : Boolean

{ <EOL> if ( function . name in specialBridgeMethods . specialMethodNames ) <EOL> return true <EOL> val functionName = function . name . asString ( ) <EOL> return specialBridgeMethods . specialMethodNames . any { <EOL> val specialMethodNameString = it . asString ( ) <EOL> val specialMethodNameLength = specialMethodNameString . length <EOL> functionName . startsWith ( specialMethodNameString ) && functionName . length > specialMethodNameLength && functionName [ specialMethodNameLength ] == '<CHAR_LIT:->' <EOL> } <EOL> }


fun computeSpecialBridge ( function : IrSimpleFunction ) : SpecialBridge ?

{ <EOL> val correspondingProperty = function . correspondingPropertySymbol <EOL> if ( correspondingProperty != null ) { <EOL> if ( correspondingProperty . owner . name !in specialBridgeMethods . specialPropertyNames ) return null <EOL> } else { <EOL> if ( ! canHaveSpecialBridge ( function ) ) { <EOL> return null <EOL> } <EOL> } <EOL> val specialMethodInfo = specialBridgeMethods . getSpecialMethodInfo ( function ) <EOL> if ( specialMethodInfo != null ) <EOL> return SpecialBridge ( overridden = function , signature = computeJvmMethod ( function ) , needsGenericSignature = specialMethodInfo . needsGenericSignature , methodInfo = specialMethodInfo , needsUnsubstitutedBridge = specialMethodInfo . needsUnsubstitutedBridge ) <EOL> val specialBuiltInInfo = specialBridgeMethods . getBuiltInWithDifferentJvmName ( function ) <EOL> if ( specialBuiltInInfo != null ) <EOL> return SpecialBridge ( overridden = function , signature = computeJvmMethod ( function ) , needsGenericSignature = specialBuiltInInfo . needsGenericSignature , isOverriding = specialBuiltInInfo . isOverriding ) <EOL> for ( overridden in function . overriddenSymbols ) { <EOL> val specialBridge = computeSpecialBridge ( overridden . owner ) ? : continue <EOL> if ( ! specialBridge . needsGenericSignature ) return specialBridge <EOL> val erasedParameterCount = specialBridge . methodInfo ? . argumentsToCheck ? : <NUM_LIT:0> <EOL> val substitutedParameterTypes = function . valueParameters . mapIndexed { index , param -> <EOL> if ( index < erasedParameterCount ) context . irBuiltIns . anyNType else param . type <EOL> } <EOL> val substitutedOverride = context . irFactory . buildFun { <EOL> updateFrom ( specialBridge . overridden ) <EOL> name = Name . identifier ( specialBridge . signature . name ) <EOL> returnType = function . returnType <EOL> } . apply { <EOL> valueParameters = function . valueParameters . zip ( substitutedParameterTypes ) . map { ( param , type ) -> <EOL> param . copyTo ( this , IrDeclarationOrigin . BRIDGE , type = type ) <EOL> } <EOL> overriddenSymbols = listOf ( specialBridge . overridden . symbol ) <EOL> parent = function . parent <EOL> } <EOL> val substitutedOverrideSignature = computeJvmMethod ( substitutedOverride ) <EOL> val unsubstitutedSpecialBridge = <EOL> when { <EOL> specialBridge . unsubstitutedSpecialBridge != null -> <EOL> specialBridge . unsubstitutedSpecialBridge <EOL> specialBridge . needsUnsubstitutedBridge && specialBridge . signature != substitutedOverrideSignature -> <EOL> specialBridge . copy ( isSynthetic = true ) <EOL> else -> <EOL> null <EOL> } <EOL> return specialBridge . copy ( signature = substitutedOverrideSignature , substitutedParameterTypes = substitutedParameterTypes , substitutedReturnType = function . returnType , unsubstitutedSpecialBridge = unsubstitutedSpecialBridge ) <EOL> } <EOL> return null <EOL> }


fun jpsReportInternalBuilderError ( context : CompileContext , error : Throwable )

{ <EOL> @ Suppress ( "<STR_LIT>" ) <EOL> val builderError = CompilerMessage . createInternalBuilderError ( "<STR_LIT>" , error ) <EOL> context . processMessage ( builderError ) <EOL> }


fun test ( a : A , block : A . ( ) -> Int )

{ <EOL> a . block ( ) <EOL> }


fun B . otherTest ( block : B . ( ) -> Int )

{ <EOL> block ( ) <EOL> }


fun anotherTest ( block : C . ( ) -> Int )

{ <EOL> block ( ) <EOL> }


fun getExtraScopes ( codeFragment : KtCodeFragment ) : List < FirLocalScope >

{ <EOL> val foreignValues = foreignValueProvider ? . getForeignValues ( codeFragment ) ? . takeUnless { it . isEmpty ( ) } ? : return emptyList ( ) <EOL> return listOf ( getForeignValuesScope ( codeFragment , foreignValues ) ) <EOL> }


private fun getForeignValuesScope ( ktCodeFragment : KtCodeFragment , foreignValues : Map < String , String > ) : FirLocalScope

{ <EOL> var result = FirLocalScope ( session ) <EOL> for ( ( variableNameString , typeDescriptor ) in foreignValues ) { <EOL> val variableName = Name . identifier ( variableNameString ) <EOL> val variable = buildProperty { <EOL> resolvePhase = FirResolvePhase . BODY_RESOLVE <EOL> moduleData = session . moduleData <EOL> origin = FirDeclarationOrigin . Source <EOL> status = FirResolvedDeclarationStatusImpl ( Visibilities . Local , Modality . FINAL , EffectiveVisibility . Local ) <EOL> returnTypeRef = typeCache . getValue ( typeDescriptor , ktCodeFragment ) <EOL> deprecationsProvider = EmptyDeprecationsProvider <EOL> name = variableName <EOL> isVar = false <EOL> symbol = FirPropertySymbol ( variableName ) <EOL> isLocal = true <EOL> } <EOL> variable . foreignValueMarker = true <EOL> result = result . storeVariable ( variable , session ) <EOL> } <EOL> return result <EOL> }


private fun getPrimitiveType ( typeDescriptor : String , session : FirSession ) : FirTypeRef ?

{ <EOL> val asmType = Type . getType ( typeDescriptor ) <EOL> return when ( asmType . sort ) { <EOL> Type . VOID -> session . builtinTypes . unitType <EOL> Type . BOOLEAN -> session . builtinTypes . booleanType <EOL> Type . CHAR -> session . builtinTypes . charType <EOL> Type . BYTE -> session . builtinTypes . byteType <EOL> Type . SHORT -> session . builtinTypes . shortType <EOL> Type . INT -> session . builtinTypes . intType <EOL> Type . FLOAT -> session . builtinTypes . floatType <EOL> Type . LONG -> session . builtinTypes . longType <EOL> Type . DOUBLE -> session . builtinTypes . doubleType <EOL> else -> null <EOL> } <EOL> }


override fun resolve ( sourceSet : KotlinSourceSet ) : Set < IdeaKotlinDependency >

{ <EOL> if ( ! isJvmAndAndroid ( sourceSet ) ) return emptySet ( ) <EOL> if ( sourceSet !is DefaultKotlinSourceSet ) return emptySet ( ) <EOL> return sourceSet . resolveMetadata < MetadataDependencyResolution > ( ) <EOL> . filter { metadataDependencyResolution -> metadataDependencyResolution . projectDependency ( sourceSet . project ) != null } <EOL> . filter { metadataDependencyResolution -> metadataDependencyResolution . projectDependency ( sourceSet . project ) != sourceSet . project } <EOL> . flatMap { metadataDependencyResolution -> <EOL> when ( metadataDependencyResolution ) { <EOL> is MetadataDependencyResolution . ChooseVisibleSourceSets -> resolveMultiplatformSourceSets ( metadataDependencyResolution . projectDependency ( sourceSet . project ) ? : return@flatMap emptyList ( ) ) <EOL> is MetadataDependencyResolution . KeepOriginalDependency -> resolveJvmSourceSets ( sourceSet ) <EOL> else -> emptyList ( ) <EOL> } <EOL> } <EOL> . toSet ( ) <EOL> }


private fun resolveMultiplatformSourceSets ( dependencyProject : Project ) : Iterable < IdeaKotlinDependency >

{ <EOL> val kotlin = dependencyProject . multiplatformExtensionOrNull ? : return emptyList ( ) <EOL> return kotlin . sourceSets <EOL> . filter { sourceSet -> isJvmAndAndroidMain ( sourceSet ) } <EOL> . map { sourceSet -> IdeaKotlinSourceDependency ( type = Regular , coordinates = IdeaKotlinSourceCoordinates ( sourceSet ) ) } <EOL> }


private fun resolveJvmSourceSets ( sourceSet : KotlinSourceSet ) : Iterable < IdeaKotlinDependency >

{ <EOL> return IdeBinaryDependencyResolver ( binaryType = IdeaKotlinBinaryDependency . KOTLIN_COMPILE_BINARY_TYPE , artifactResolutionStrategy = IdeBinaryDependencyResolver . ArtifactResolutionStrategy . PlatformLikeSourceSet ( setupPlatformResolutionAttributes = { <EOL> sourceSet . internal . compilations . filter { it . platformType == KotlinPlatformType . jvm } <EOL> . map { compilation -> compilation . internal . configurations . compileDependencyConfiguration . attributes } <EOL> . map { attributes -> attributes . toMap ( ) . toList ( ) . toSet ( ) } <EOL> . reduceOrNull { acc , next -> acc intersect next } <EOL> . orEmpty ( ) <EOL> . forEach { ( key , value ) -> <EOL> @ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> setAttributeProvider ( sourceSet . project , key as Attribute < Any > ) { value as Any } <EOL> } <EOL> } , componentFilter = { id -> id is ProjectComponentIdentifier } ) ) . resolve ( sourceSet ) <EOL> }

/**
 * Pretend that this [sourceSet] is 'jvm' and resolve binaries.
 * #### Setting up attributes:
 * In order to set up the 'platform like' / 'jvm like' dependency resolution, this algorithm
 * will look at all 'jvm' based compilations, uses their 'compileDependencyConfiguration' as reference and
 * then uses the intersection of all available attributes
 *
 * #### componentFilter:
 * This resolver will just care about resolving project dependencies.
 * Therefore, a componentFilter is added to only resolve project dependencies.
 * We expect to resolve project artifact dependencies which can then be matched to the corresponding
 * SourceSets on IDE side.
 */


private fun isJvmAndAndroidMain ( sourceSet : KotlinSourceSet ) : Boolean

{ <EOL> if ( ! isJvmAndAndroid ( sourceSet ) ) return false <EOL> return sourceSet . internal . compilations . filter { it . platformType != KotlinPlatformType . common } . all { compilation -> <EOL> isJvmMain ( compilation ) || isAndroidMain ( compilation ) <EOL> } <EOL> }


private fun isJvmMain ( compilation : KotlinCompilation < * > ) : Boolean

{ <EOL> return compilation . platformType == KotlinPlatformType . jvm && compilation . isMain ( ) <EOL> }


private fun isAndroidMain ( compilation : KotlinCompilation < * > ) : Boolean

{ <EOL> return compilation is KotlinJvmAndroidCompilation && compilation . androidVariant . type == AndroidVariantType . Main <EOL> }


@ JvmStatic fun canBeUsedForConstVal ( type : KotlinType )

= type . canBeUsedForConstVal ( )


fun KotlinType . canBeUsedForConstVal ( )

= <EOL> ( KotlinBuiltIns . isPrimitiveType ( this ) || UnsignedTypes . isUnsignedType ( this ) ) && ! TypeUtils . isNullableType ( this ) || <EOL> KotlinBuiltIns . isString ( this )


@ Parameterized . Parameters ( name = "<STR_LIT>" ) <EOL> @ JvmStatic <EOL> fun params ( ) : Collection < Array < Any > >

= <EOL> TestBroadcastChannelKind . entries . map { arrayOf < Any > ( it ) }


{ <EOL> pool . close ( ) <EOL> }


= runBlocking { <EOL> println ( "<STR_LIT>" ) <EOL> val sender = <EOL> launch ( pool + CoroutineName ( "<STR_LIT>" ) ) { <EOL> var i = <NUM_LIT:0L> <EOL> while ( isActive ) { <EOL> i ++ <EOL> broadcast . send ( i ) <EOL> sentTotal . set ( i ) <EOL> } <EOL> } <EOL> val receivers = mutableListOf < Job > ( ) <EOL> fun printProgress ( ) { <EOL> println ( "<STR_LIT>" ) <EOL> } <EOL> repeat ( nReceivers ) { <EOL> delay ( <NUM_LIT:100> ) <EOL> val receiverIndex = receivers . size <EOL> val name = "<STR_LIT>" <EOL> println ( "<STR_LIT>" ) <EOL> receivers += launch ( pool + CoroutineName ( name ) ) { <EOL> val channel = broadcast . openSubscription ( ) <EOL> when ( receiverIndex % <NUM_LIT:5> ) { <EOL> <NUM_LIT:0> -> doReceive ( channel , receiverIndex ) <EOL> <NUM_LIT:1> -> doReceiveCatching ( channel , receiverIndex ) <EOL> <NUM_LIT:2> -> doIterator ( channel , receiverIndex ) <EOL> <NUM_LIT:3> -> doReceiveSelect ( channel , receiverIndex ) <EOL> <NUM_LIT:4> -> doReceiveCatchingSelect ( channel , receiverIndex ) <EOL> } <EOL> channel . cancel ( ) <EOL> } <EOL> printProgress ( ) <EOL> } <EOL> repeat ( nSeconds ) { _ -> <EOL> delay ( <NUM_LIT> ) <EOL> printProgress ( ) <EOL> } <EOL> sender . cancelAndJoin ( ) <EOL> println ( "<STR_LIT>" ) <EOL> val total = sentTotal . get ( ) <EOL> println ( "<STR_LIT>" ) <EOL> stopOnReceive . set ( total ) <EOL> try { <EOL> withTimeout ( <NUM_LIT> ) { <EOL> receivers . forEachIndexed { index , receiver -> <EOL> if ( lastReceived [ index ] . get ( ) >= total ) receiver . cancel ( ) <EOL> receiver . join ( ) <EOL> } <EOL> } <EOL> } catch ( e : Exception ) { <EOL> println ( "<STR_LIT>" ) <EOL> pool . dumpThreads ( "<STR_LIT>" ) <EOL> receivers . indices . forEach { index -> <EOL> println ( "<STR_LIT>" ) <EOL> } <EOL> throw e <EOL> } <EOL> println ( "<STR_LIT>" ) <EOL> }


private fun doReceived ( receiverIndex : Int , i : Long ) : Boolean

{ <EOL> val last = lastReceived [ receiverIndex ] . get ( ) <EOL> check ( i > last ) { "<STR_LIT>" } <EOL> if ( last != - <NUM_LIT:1L> && ! kind . isConflated ) <EOL> check ( i == last + <NUM_LIT:1> ) { "<STR_LIT>" } <EOL> receivedTotal . incrementAndGet ( ) <EOL> lastReceived [ receiverIndex ] . set ( i ) <EOL> return i >= stopOnReceive . get ( ) <EOL> }


private suspend fun doReceive ( channel : ReceiveChannel < Long > , receiverIndex : Int )

{ <EOL> while ( true ) { <EOL> try { <EOL> val stop = doReceived ( receiverIndex , channel . receive ( ) ) <EOL> if ( stop ) break <EOL> } catch ( ex : ClosedReceiveChannelException ) { <EOL> break <EOL> } <EOL> } <EOL> }


private suspend fun doReceiveCatching ( channel : ReceiveChannel < Long > , receiverIndex : Int )

{ <EOL> while ( true ) { <EOL> val stop = doReceived ( receiverIndex , channel . receiveCatching ( ) . getOrNull ( ) ? : break ) <EOL> if ( stop ) break <EOL> } <EOL> }


private suspend fun doIterator ( channel : ReceiveChannel < Long > , receiverIndex : Int )

{ <EOL> for ( event in channel ) { <EOL> val stop = doReceived ( receiverIndex , event ) <EOL> if ( stop ) break <EOL> } <EOL> }


private suspend fun doReceiveSelect ( channel : ReceiveChannel < Long > , receiverIndex : Int )

{ <EOL> while ( true ) { <EOL> try { <EOL> val event = select < Long > { channel . onReceive { it } } <EOL> val stop = doReceived ( receiverIndex , event ) <EOL> if ( stop ) break <EOL> } catch ( ex : ClosedReceiveChannelException ) { <EOL> break <EOL> } <EOL> } <EOL> }


private suspend fun doReceiveCatchingSelect ( channel : ReceiveChannel < Long > , receiverIndex : Int )

{ <EOL> while ( true ) { <EOL> val event = select < Long ? > { channel . onReceiveCatching { it . getOrNull ( ) } } ? : break <EOL> val stop = doReceived ( receiverIndex , event ) <EOL> if ( stop ) break <EOL> } <EOL> }


@ Suppress ( "<STR_LIT:UNUSED_PARAMETER>" ) <EOL> private fun println ( debugMessage : String )

{ <EOL> }


fun isNotYetComputed ( ) : Boolean


{ <EOL> val a1 = A ( null ) <EOL> val a2 = A ( "<STR_LIT>" ) <EOL> if ( a1 == a2 || a2 == a1 ) return "<STR_LIT:FailU+00201>" <EOL> val b1 = B ( null ) <EOL> val b2 = B ( "<STR_LIT>" ) <EOL> if ( b1 == b2 || b2 == b1 ) return "<STR_LIT:FailU+00202>" <EOL> return "<STR_LIT:OK>" <EOL> }


@ Test <EOL> fun basicInference ( @ TempDir tempDir : Path ? )

{ <EOL> assertTrue ( tempDir ! ! . toFile ( ) . isDirectory ) <EOL> val lenet5 = Sequential . of ( lenet5Layers ) <EOL> val ( train , test ) = mnist ( ) <EOL> lenet5 . use { <EOL> it . compile ( optimizer = SGD ( learningRate = <NUM_LIT> ) , loss = Losses . SOFT_MAX_CROSS_ENTROPY_WITH_LOGITS , metric = Accuracy ( ) ) <EOL> it . fit ( dataset = train , epochs = EPOCHS , batchSize = TRAINING_BATCH_SIZE ) <EOL> val accuracy = it . evaluate ( dataset = test , batchSize = TEST_BATCH_SIZE ) . metrics [ Metrics . ACCURACY ] <EOL> if ( accuracy != null ) { <EOL> assertTrue ( accuracy > <NUM_LIT> ) <EOL> } <EOL> it . save ( modelDirectory = tempDir . toFile ( ) , savingFormat = SavingFormat . TfGraphCustomVariables , writingMode = WritingMode . OVERRIDE ) <EOL> } <EOL> val inferenceModel = TensorFlowInferenceModel . load ( tempDir . toFile ( ) , loadOptimizerState = false ) <EOL> inferenceModel . use { <EOL> var accuracy = <NUM_LIT:0.0> <EOL> val amountOfTestSet = <NUM_LIT> <EOL> for ( imageId in <NUM_LIT:0> .. amountOfTestSet ) { <EOL> val prediction = it . predict ( train . getX ( imageId ) ) <EOL> val softPrediction = it . predict ( train . getX ( imageId ) , outputTensorName = OUTPUT_NAME ) { result -> <EOL> result . getFloatArray ( <NUM_LIT:0> ) <EOL> } <EOL> assertEquals ( <NUM_LIT:10> , softPrediction . size ) <EOL> if ( prediction == train . getY ( imageId ) . toInt ( ) ) <EOL> accuracy += ( <NUM_LIT:1.0> / amountOfTestSet ) <EOL> } <EOL> assertTrue ( accuracy > <NUM_LIT> ) <EOL> } <EOL> }


@ Test <EOL> fun basicInferenceAndCopy ( @ TempDir tempDir : Path ? )

{ <EOL> assertTrue ( tempDir ! ! . toFile ( ) . isDirectory ) <EOL> val lenet5 = Sequential . of ( lenet5Layers ) <EOL> val ( train , test ) = mnist ( ) <EOL> lenet5 . use { <EOL> it . compile ( optimizer = SGD ( learningRate = <NUM_LIT> ) , loss = Losses . SOFT_MAX_CROSS_ENTROPY_WITH_LOGITS , metric = Accuracy ( ) ) <EOL> it . fit ( dataset = train , epochs = EPOCHS , batchSize = TRAINING_BATCH_SIZE ) <EOL> val accuracy = it . evaluate ( dataset = test , batchSize = TEST_BATCH_SIZE ) . metrics [ Metrics . ACCURACY ] <EOL> if ( accuracy != null ) { <EOL> assertTrue ( accuracy > <NUM_LIT> ) <EOL> } <EOL> it . save ( modelDirectory = tempDir . toFile ( ) , savingFormat = SavingFormat . TfGraphCustomVariables , writingMode = WritingMode . OVERRIDE ) <EOL> } <EOL> val inferenceModel = TensorFlowInferenceModel . load ( tempDir . toFile ( ) , loadOptimizerState = false ) <EOL> var copiedInferenceModel : TensorFlowInferenceModel <EOL> val firstAccuracy : Double <EOL> val secondAccuracy : Double <EOL> inferenceModel . use { <EOL> var accuracy = <NUM_LIT:0.0> <EOL> val amountOfTestSet = <NUM_LIT> <EOL> for ( imageId in <NUM_LIT:0> .. amountOfTestSet ) { <EOL> val prediction = it . predict ( train . getX ( imageId ) ) <EOL> val softPrediction = it . predict ( train . getX ( imageId ) , outputTensorName = OUTPUT_NAME ) { result -> <EOL> result . getFloatArray ( <NUM_LIT:0> ) <EOL> } <EOL> assertEquals ( <NUM_LIT:10> , softPrediction . size ) <EOL> if ( prediction == train . getY ( imageId ) . toInt ( ) ) <EOL> accuracy += ( <NUM_LIT:1.0> / amountOfTestSet ) <EOL> } <EOL> copiedInferenceModel = inferenceModel . copy ( "<STR_LIT>" ) <EOL> assertTrue ( accuracy > <NUM_LIT> ) <EOL> firstAccuracy = accuracy <EOL> } <EOL> copiedInferenceModel . use { <EOL> var accuracy = <NUM_LIT:0.0> <EOL> val amountOfTestSet = <NUM_LIT> <EOL> for ( imageId in <NUM_LIT:0> .. amountOfTestSet ) { <EOL> val prediction = it . predict ( train . getX ( imageId ) ) <EOL> if ( prediction == train . getY ( imageId ) . toInt ( ) ) <EOL> accuracy += ( <NUM_LIT:1.0> / amountOfTestSet ) <EOL> } <EOL> assertTrue ( accuracy > <NUM_LIT> ) <EOL> secondAccuracy = accuracy <EOL> } <EOL> assertEquals ( firstAccuracy , secondAccuracy , EPS ) <EOL> }


@ Test <EOL> fun emptyInferenceModel ( )

{ <EOL> val ( train , _ ) = mnist ( ) <EOL> val inferenceModel = TensorFlowInferenceModel ( ) <EOL> inferenceModel . use { <EOL> val exception = Assertions . assertThrows ( IllegalStateException :: class . java ) { <EOL> it . predict ( train . getX ( <NUM_LIT:0> ) ) <EOL> } <EOL> assertEquals ( "<STR_LIT>" , exception . message ) <EOL> } <EOL> }


@ Test <EOL> fun createInferenceModelOnJSONConfig ( @ TempDir tempDir : Path ? )

{ <EOL> assertTrue ( tempDir ! ! . toFile ( ) . isDirectory ) <EOL> val lenet5 = Sequential . of ( lenet5Layers ) <EOL> val ( train , test ) = mnist ( ) <EOL> lenet5 . use { <EOL> it . compile ( optimizer = SGD ( learningRate = <NUM_LIT> ) , loss = Losses . SOFT_MAX_CROSS_ENTROPY_WITH_LOGITS , metric = Accuracy ( ) ) <EOL> it . fit ( dataset = train , epochs = EPOCHS , batchSize = TRAINING_BATCH_SIZE ) <EOL> val accuracy = it . evaluate ( dataset = test , batchSize = TEST_BATCH_SIZE ) . metrics [ Metrics . ACCURACY ] <EOL> if ( accuracy != null ) { <EOL> assertTrue ( accuracy > <NUM_LIT> ) <EOL> } <EOL> it . save ( modelDirectory = tempDir . toFile ( ) , savingFormat = SavingFormat . JsonConfigCustomVariables ( ) , writingMode = WritingMode . OVERRIDE ) <EOL> } <EOL> val exception = <EOL> Assertions . assertThrows ( FileNotFoundException :: class . java ) { <EOL> TensorFlowInferenceModel . load ( tempDir . toFile ( ) ) <EOL> } <EOL> assertEquals ( "<STR_LIT>" , exception . message ) <EOL> }


@ Test <EOL> fun createInferenceModelOnCorruptedVariableData ( @ TempDir tempDir : Path ? )

{ <EOL> assertTrue ( tempDir ! ! . toFile ( ) . isDirectory ) <EOL> val lenet5 = Sequential . of ( lenet5Layers ) <EOL> val ( train , test ) = mnist ( ) <EOL> lenet5 . use { <EOL> it . compile ( optimizer = SGD ( learningRate = <NUM_LIT> ) , loss = Losses . SOFT_MAX_CROSS_ENTROPY_WITH_LOGITS , metric = Accuracy ( ) ) <EOL> it . fit ( dataset = train , epochs = EPOCHS , batchSize = TRAINING_BATCH_SIZE ) <EOL> val accuracy = it . evaluate ( dataset = test , batchSize = TEST_BATCH_SIZE ) . metrics [ Metrics . ACCURACY ] <EOL> if ( accuracy != null ) { <EOL> assertTrue ( accuracy > <NUM_LIT> ) <EOL> } <EOL> it . save ( modelDirectory = tempDir . toFile ( ) , savingFormat = SavingFormat . TfGraphCustomVariables , writingMode = WritingMode . OVERRIDE ) <EOL> } <EOL> File ( tempDir . toFile ( ) . absolutePath + "<STR_LIT>" ) . delete ( ) <EOL> val exception = <EOL> Assertions . assertThrows ( FileNotFoundException :: class . java ) { <EOL> TensorFlowInferenceModel . load ( tempDir . toFile ( ) ) <EOL> } <EOL> assertEquals ( "<STR_LIT>" , exception . message ) <EOL> }


{ <EOL> val x = object { } <EOL> }


= <NUM_LIT:42> + x


public fun < I , O > Operation < I , O > . onResult ( block : ( O ) -> Unit ) : Operation < I , O >

{ <EOL> return PreprocessingPipeline ( this , object : Operation < O , O > { <EOL> override fun apply ( input : O ) : O { <EOL> block ( input ) <EOL> return input <EOL> } <EOL> override fun getOutputShape ( inputShape : TensorShape ) : TensorShape = inputShape <EOL> } ) <EOL> }

/**
 * Convenience functions for executing custom logic after applying [Operation].
 * Could be useful for debugging purposes.
 */


public fun < I , M , O > Operation < I , M > . call ( operation : Operation < M , O > ) : Operation < I , O >

{ <EOL> return PreprocessingPipeline ( this , operation ) <EOL> }

/**
 * Applies provided [operation] to the preprocessing pipeline.
 */


{ <EOL> var i = <NUM_LIT:1> <EOL> { <EOL> val i = <NUM_LIT:2> <EOL> } <EOL> return i <EOL> }


suspend fun foo ( block : suspend Long . ( ) -> String ) : String

{ <EOL> return <NUM_LIT:1L> . block ( ) <EOL> }


{ <EOL> foo { <EOL> "<STR_LIT:OK>" <EOL> } <EOL> }


fun internalIdGenerated ( id : Int )


fun compilationFinished ( )


override fun create ( elements : Array < out String > ) : Set < String >

{ <EOL> return persistentHashSetOf ( * elements ) <EOL> }


{ <EOL> return persistentHashSetOf < String > ( ) . addAll ( elements . toList ( ) ) <EOL> }


{ <EOL> return elements . fold ( persistentHashSetOf ( ) ) { set , element -> set . add ( element ) } <EOL> }


{ <EOL> return persistentHashSetOf < String > ( ) . mutate { it . addAll ( elements ) } <EOL> }


{ <EOL> return persistentHashSetOf < String > ( ) . mutate { builder -> elements . forEach { builder . add ( it ) } } <EOL> }


override fun create ( elements : Array < out String > ) : MutableSet < String >

{ <EOL> return persistentHashSetOf ( * elements ) . builder ( ) <EOL> }


{ <EOL> return persistentHashSetOf < String > ( ) . builder ( ) . apply { addAll ( elements ) } <EOL> }


{ <EOL> return persistentHashSetOf < String > ( ) . builder ( ) . apply { elements . forEach { add ( it ) } } <EOL> }


{ <EOL> return persistentSetOf ( * elements ) <EOL> }


{ <EOL> return persistentSetOf < String > ( ) . addAll ( elements . toList ( ) ) <EOL> }


{ <EOL> return elements . fold ( persistentSetOf ( ) ) { set , element -> set . add ( element ) } <EOL> }


{ <EOL> return persistentSetOf < String > ( ) . mutate { it . addAll ( elements ) } <EOL> }


{ <EOL> return persistentSetOf < String > ( ) . mutate { builder -> elements . forEach { builder . add ( it ) } } <EOL> }


{ <EOL> return persistentSetOf ( * elements ) . builder ( ) <EOL> }


{ <EOL> return persistentSetOf < String > ( ) . builder ( ) . apply { addAll ( elements ) } <EOL> }


{ <EOL> return persistentSetOf < String > ( ) . builder ( ) . apply { elements . forEach { add ( it ) } } <EOL> }


override fun < E : FirElement > transformElement ( element : E , data : Any ? ) : E

{ <EOL> return element <EOL> }


override fun transformFile ( file : FirFile , data : Any ? ) : FirFile

{ <EOL> checkSessionConsistency ( file ) <EOL> withFileAnalysisExceptionWrapping ( file ) { <EOL> val prevValue = currentFile <EOL> currentFile = file <EOL> try { <EOL> file . transformChildren ( this , null ) <EOL> } finally { <EOL> currentFile = prevValue <EOL> } <EOL> } <EOL> return file <EOL> }


override fun transformImport ( import : FirImport , data : Any ? ) : FirImport

{ <EOL> val fqName = import . importedFqName ? . takeUnless { it . isRoot } ? : return import <EOL> if ( ! fqName . isAcceptable ) return import <EOL> if ( import . isAllUnder ) { <EOL> return transformImportForFqName ( fqName , import ) <EOL> } <EOL> currentFile ? . let { <EOL> session . lookupTracker ? . recordFqNameLookup ( fqName , import . source , it . source ) <EOL> } <EOL> return transformImportForFqName ( fqName . parent ( ) , import ) <EOL> }


private fun transformImportForFqName ( fqName : FqName , delegate : FirImport ) : FirImport

{ <EOL> val ( packageFqName , relativeClassFqName ) = findLongestExistingPackage ( symbolProvider , fqName ) <EOL> return buildResolvedImport { <EOL> this . delegate = delegate <EOL> this . packageFqName = packageFqName <EOL> this . relativeParentClassName = relativeClassFqName <EOL> } <EOL> }


{ <EOL> simpleInterop ( ) <EOL> getMyStructPointer ( ) ? . pointed ? . appleOnlyProperty <EOL> getMyStructPointer ( ) ? . pointed ? . iosOnlyProperty <EOL> NativeMain . structFromPosix <EOL> NativeMain . structPointerFromPosix <EOL> NativeMain . simple <EOL> P2NativeMain . structFromPosix <EOL> P2NativeMain . structPointerFromPosix <EOL> P2NativeMain . simple <EOL> AppleAndLinuxMain . MyStruct . posixProperty <EOL> P2AppleAndLinuxMain . MyStruct . posixProperty <EOL> AppleMain . MyStruct . appleOnlyProperty <EOL> P2AppleMain . MyStruct . appleOnlyProperty <EOL> IosMain . MyStruct . iosOnly <EOL> P2IosMain . MyStruct . iosOnly <EOL> }


internal fun Project . findAppliedAndroidPluginIdOrNull ( ) : String ?

{ <EOL> return androidPluginIds . firstOrNull { androidPluginId -> plugins . findPlugin ( androidPluginId ) != null } <EOL> }


fun f1 ( s : String ) : Int


fun f2 ( s : List < String > ? ) : MutableMap < Boolean ? , Foo >


fun < T : Set < Number > > f3 ( t : T ) : T ?


= null ! !


actual fun f2 ( s : dynamic ) : MutableMap < Boolean ? , Foo >

= null ! !


actual fun < T : Set < Number > > f3 ( t : T ) : dynamic

= null ! !


{ <EOL> assertEquals ( true , "<STR_LIT:true>" . toBoolean ( ) ) <EOL> assertEquals ( true , "<STR_LIT>" . toBoolean ( ) ) <EOL> assertEquals ( false , "<STR_LIT:false>" . toBoolean ( ) ) <EOL> assertEquals ( false , "<STR_LIT>" . toBoolean ( ) ) <EOL> assertEquals ( false , ( null as String ? ) . toBoolean ( ) ) <EOL> }


{ <EOL> compareConversion ( { it . toByte ( ) } , { it . toByteOrNull ( ) } ) { <EOL> assertProduces ( "<STR_LIT>" , Byte . MAX_VALUE ) <EOL> assertProduces ( "<STR_LIT>" , <NUM_LIT> . toByte ( ) ) <EOL> assertProduces ( "<STR_LIT>" , Byte . MIN_VALUE ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> } <EOL> compareConversionWithRadix ( String :: toByte , String :: toByteOrNull ) { <EOL> assertProduces ( <NUM_LIT:16> , "<STR_LIT>" , <NUM_LIT> . toByte ( ) ) <EOL> assertProduces ( <NUM_LIT:16> , "<STR_LIT>" , <NUM_LIT> . toByte ( ) ) <EOL> assertProduces ( <NUM_LIT:16> , "<STR_LIT>" , ( - <NUM_LIT> ) . toByte ( ) ) <EOL> assertFailsOrNull ( <NUM_LIT:2> , "<STR_LIT>" ) <EOL> assertFailsOrNull ( <NUM_LIT:8> , "<STR_LIT>" ) <EOL> assertFailsOrNull ( <NUM_LIT:8> , "<STR_LIT>" ) <EOL> } <EOL> }


{ <EOL> compareConversion ( { it . toShort ( ) } , { it . toShortOrNull ( ) } ) { <EOL> assertProduces ( "<STR_LIT>" , <NUM_LIT> . toShort ( ) ) <EOL> assertProduces ( "<STR_LIT>" , Short . MAX_VALUE ) <EOL> assertProduces ( "<STR_LIT>" , Short . MIN_VALUE ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> } <EOL> compareConversionWithRadix ( String :: toShort , String :: toShortOrNull ) { <EOL> assertProduces ( <NUM_LIT:16> , "<STR_LIT>" , <NUM_LIT> . toShort ( ) ) <EOL> assertProduces ( <NUM_LIT:16> , "<STR_LIT>" , ( - <NUM_LIT> ) . toShort ( ) ) <EOL> assertFailsOrNull ( <NUM_LIT:5> , "<STR_LIT>" ) <EOL> assertFailsOrNull ( <NUM_LIT:2> , "<STR_LIT>" ) <EOL> assertFailsOrNull ( <NUM_LIT:2> , "<STR_LIT>" ) <EOL> } <EOL> }


{ <EOL> compareConversion ( { it . toInt ( ) } , { it . toIntOrNull ( ) } ) { <EOL> assertProduces ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertProduces ( "<STR_LIT>" , Int . MAX_VALUE ) <EOL> assertProduces ( "<STR_LIT>" , Int . MIN_VALUE ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> } <EOL> compareConversionWithRadix ( String :: toInt , String :: toIntOrNull ) { <EOL> assertProduces ( <NUM_LIT:10> , "<STR_LIT:0>" , <NUM_LIT:0> ) <EOL> assertProduces ( <NUM_LIT:10> , "<STR_LIT>" , <NUM_LIT> ) <EOL> assertProduces ( <NUM_LIT:10> , "<STR_LIT>" , <NUM_LIT:42> ) <EOL> assertProduces ( <NUM_LIT:10> , "<STR_LIT>" , <NUM_LIT:0> ) <EOL> assertProduces ( <NUM_LIT:10> , "<STR_LIT>" , <NUM_LIT> ) <EOL> assertProduces ( <NUM_LIT:10> , "<STR_LIT>" , - <NUM_LIT> ) <EOL> assertProduces ( <NUM_LIT:16> , "<STR_LIT>" , - <NUM_LIT> ) <EOL> assertProduces ( <NUM_LIT:16> , "<STR_LIT>" , - <NUM_LIT> ) <EOL> assertProduces ( <NUM_LIT:2> , "<STR_LIT>" , <NUM_LIT> ) <EOL> assertProduces ( <NUM_LIT> , "<STR_LIT>" , <NUM_LIT> ) <EOL> assertFailsOrNull ( <NUM_LIT:10> , "<STR_LIT>" ) <EOL> assertFailsOrNull ( <NUM_LIT:8> , "<STR_LIT>" ) <EOL> assertFailsOrNull ( <NUM_LIT:10> , "<STR_LIT>" ) <EOL> assertFailsOrNull ( <NUM_LIT:16> , "<STR_LIT>" ) <EOL> assertFailsOrNull ( <NUM_LIT:16> , "<STR_LIT>" ) <EOL> } <EOL> assertFailsWith < IllegalArgumentException > ( "<STR_LIT>" ) { "<STR_LIT:1>" . toInt ( radix = <NUM_LIT:1> ) } <EOL> assertFailsWith < IllegalArgumentException > ( "<STR_LIT>" ) { "<STR_LIT>" . toIntOrNull ( radix = <NUM_LIT> ) } <EOL> }


{ <EOL> compareConversion ( { it . toLong ( ) } , { it . toLongOrNull ( ) } ) { <EOL> assertProduces ( "<STR_LIT>" , <NUM_LIT> . toLong ( ) ) <EOL> assertProduces ( "<STR_LIT>" , Long . MAX_VALUE ) <EOL> assertProduces ( "<STR_LIT>" , Long . MIN_VALUE ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> } <EOL> compareConversionWithRadix ( String :: toLong , String :: toLongOrNull ) { <EOL> assertProduces ( <NUM_LIT:10> , "<STR_LIT:0>" , <NUM_LIT:0L> ) <EOL> assertProduces ( <NUM_LIT:10> , "<STR_LIT>" , <NUM_LIT> ) <EOL> assertProduces ( <NUM_LIT:10> , "<STR_LIT>" , <NUM_LIT> ) <EOL> assertProduces ( <NUM_LIT:10> , "<STR_LIT>" , <NUM_LIT:0L> ) <EOL> assertProduces ( <NUM_LIT:16> , "<STR_LIT>" , <NUM_LIT> ) <EOL> assertProduces ( <NUM_LIT:16> , "<STR_LIT>" , <NUM_LIT> ) <EOL> assertProduces ( <NUM_LIT:16> , "<STR_LIT>" , Long . MIN_VALUE ) <EOL> assertProduces ( <NUM_LIT:2> , "<STR_LIT>" , <NUM_LIT> ) <EOL> assertProduces ( <NUM_LIT> , "<STR_LIT>" , <NUM_LIT> ) <EOL> assertFailsOrNull ( <NUM_LIT:8> , "<STR_LIT>" ) <EOL> assertFailsOrNull ( <NUM_LIT:10> , "<STR_LIT>" ) <EOL> assertFailsOrNull ( <NUM_LIT:4> , "<STR_LIT>" ) <EOL> assertFailsOrNull ( <NUM_LIT:4> , "<STR_LIT>" ) <EOL> } <EOL> assertFailsWith < IllegalArgumentException > ( "<STR_LIT>" ) { "<STR_LIT>" . toLong ( radix = <NUM_LIT> ) } <EOL> assertFailsWith < IllegalArgumentException > ( "<STR_LIT>" ) { "<STR_LIT:1>" . toLongOrNull ( radix = <NUM_LIT:1> ) } <EOL> }


{ <EOL> compareConversion ( String :: toDouble , String :: toDoubleOrNull , :: doubleTotalOrderEquals ) { <EOL> assertProduces ( "<STR_LIT>" , - <NUM_LIT> ) <EOL> assertProduces ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertProduces ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertProduces ( "<STR_LIT>" , - <NUM_LIT> ) <EOL> assertProduces ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertProduces ( "<STR_LIT>" , - <NUM_LIT> ) <EOL> assertProduces ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertProduces ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertProduces ( "<STR_LIT>" , Double . NaN ) <EOL> assertProduces ( "<STR_LIT>" , Double . POSITIVE_INFINITY ) <EOL> assertProduces ( "<STR_LIT>" , Double . POSITIVE_INFINITY ) <EOL> assertProduces ( "<STR_LIT>" , - Double . NaN ) <EOL> assertProduces ( "<STR_LIT>" , Double . NEGATIVE_INFINITY ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> } <EOL> }


{ <EOL> compareConversion ( String :: toFloat , String :: toFloatOrNull , :: floatTotalOrderEquals ) { <EOL> assertProduces ( "<STR_LIT>" , - <NUM_LIT> ) <EOL> assertProduces ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertProduces ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertProduces ( "<STR_LIT>" , - <NUM_LIT> ) <EOL> assertProduces ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertProduces ( "<STR_LIT>" , - <NUM_LIT> ) <EOL> assertProduces ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertProduces ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertProduces ( "<STR_LIT>" , Float . NaN ) <EOL> assertProduces ( "<STR_LIT>" , Float . POSITIVE_INFINITY ) <EOL> assertProduces ( "<STR_LIT>" , Float . POSITIVE_INFINITY ) <EOL> assertProduces ( "<STR_LIT>" , - Float . NaN ) <EOL> assertProduces ( "<STR_LIT>" , Float . NEGATIVE_INFINITY ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> } <EOL> }


{ <EOL> compareConversion ( { it . toUByte ( ) } , { it . toUByteOrNull ( ) } ) { <EOL> assertProduces ( "<STR_LIT>" , UByte . MAX_VALUE ) <EOL> assertProduces ( "<STR_LIT>" , <NUM_LIT> . toUByte ( ) ) <EOL> assertProduces ( "<STR_LIT>" , <NUM_LIT> . toUByte ( ) ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> } <EOL> compareConversionWithRadix ( String :: toUByte , String :: toUByteOrNull ) { <EOL> assertProduces ( <NUM_LIT:16> , "<STR_LIT>" , <NUM_LIT> . toUByte ( ) ) <EOL> assertProduces ( <NUM_LIT:16> , "<STR_LIT>" , <NUM_LIT> . toUByte ( ) ) <EOL> assertProduces ( <NUM_LIT:16> , "<STR_LIT>" , <NUM_LIT> . toUByte ( ) ) <EOL> assertProduces ( <NUM_LIT:16> , "<STR_LIT>" , <NUM_LIT> . toUByte ( ) ) <EOL> assertFailsOrNull ( <NUM_LIT:2> , "<STR_LIT>" ) <EOL> assertFailsOrNull ( <NUM_LIT:8> , "<STR_LIT>" ) <EOL> assertFailsOrNull ( <NUM_LIT:8> , "<STR_LIT>" ) <EOL> } <EOL> }


{ <EOL> compareConversion ( { it . toUShort ( ) } , { it . toUShortOrNull ( ) } ) { <EOL> assertProduces ( "<STR_LIT>" , <NUM_LIT> . toUShort ( ) ) <EOL> assertProduces ( "<STR_LIT>" , UShort . MAX_VALUE ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> } <EOL> compareConversionWithRadix ( String :: toUShort , String :: toUShortOrNull ) { <EOL> assertProduces ( <NUM_LIT:16> , "<STR_LIT>" , <NUM_LIT> . toUShort ( ) ) <EOL> assertProduces ( <NUM_LIT:16> , "<STR_LIT>" , UShort . MAX_VALUE ) <EOL> assertFailsOrNull ( <NUM_LIT:16> , "<STR_LIT>" ) <EOL> assertFailsOrNull ( <NUM_LIT:5> , "<STR_LIT>" ) <EOL> assertFailsOrNull ( <NUM_LIT:2> , "<STR_LIT>" ) <EOL> assertFailsOrNull ( <NUM_LIT:2> , "<STR_LIT>" ) <EOL> } <EOL> }


{ <EOL> compareConversion ( { it . toUInt ( ) } , { it . toUIntOrNull ( ) } ) { <EOL> assertProduces ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertProduces ( "<STR_LIT>" , UInt . MAX_VALUE ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> } <EOL> compareConversionWithRadix ( String :: toUInt , String :: toUIntOrNull ) { <EOL> assertProduces ( <NUM_LIT:10> , "<STR_LIT:0>" , <NUM_LIT> ) <EOL> assertProduces ( <NUM_LIT:10> , "<STR_LIT>" , <NUM_LIT> ) <EOL> assertProduces ( <NUM_LIT:10> , "<STR_LIT>" , <NUM_LIT> ) <EOL> assertProduces ( <NUM_LIT:10> , "<STR_LIT>" , <NUM_LIT> ) <EOL> assertProduces ( <NUM_LIT:16> , "<STR_LIT>" , <NUM_LIT> ) <EOL> assertProduces ( <NUM_LIT:16> , "<STR_LIT>" , <NUM_LIT> - <NUM_LIT> ) <EOL> assertProduces ( <NUM_LIT:2> , "<STR_LIT>" , <NUM_LIT> ) <EOL> assertProduces ( <NUM_LIT> , "<STR_LIT>" , <NUM_LIT> ) <EOL> assertFailsOrNull ( <NUM_LIT:10> , "<STR_LIT>" ) <EOL> assertFailsOrNull ( <NUM_LIT:10> , "<STR_LIT>" ) <EOL> assertFailsOrNull ( <NUM_LIT:8> , "<STR_LIT>" ) <EOL> assertFailsOrNull ( <NUM_LIT:10> , "<STR_LIT>" ) <EOL> assertFailsOrNull ( <NUM_LIT:16> , "<STR_LIT>" ) <EOL> assertFailsOrNull ( <NUM_LIT:16> , "<STR_LIT>" ) <EOL> } <EOL> assertFailsWith < IllegalArgumentException > ( "<STR_LIT>" ) { "<STR_LIT:1>" . toUInt ( radix = <NUM_LIT:1> ) } <EOL> assertFailsWith < IllegalArgumentException > ( "<STR_LIT>" ) { "<STR_LIT>" . toUIntOrNull ( radix = <NUM_LIT> ) } <EOL> }


{ <EOL> compareConversion ( { it . toULong ( ) } , { it . toULongOrNull ( ) } ) { <EOL> assertProduces ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertProduces ( "<STR_LIT>" , ULong . MAX_VALUE ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> assertFailsOrNull ( "<STR_LIT>" ) <EOL> } <EOL> compareConversionWithRadix ( String :: toULong , String :: toULongOrNull ) { <EOL> assertProduces ( <NUM_LIT:10> , "<STR_LIT:0>" , <NUM_LIT> ) <EOL> assertProduces ( <NUM_LIT:10> , "<STR_LIT>" , <NUM_LIT> ) <EOL> assertProduces ( <NUM_LIT:10> , "<STR_LIT>" , <NUM_LIT> ) <EOL> assertProduces ( <NUM_LIT:16> , "<STR_LIT>" , <NUM_LIT> ) <EOL> assertProduces ( <NUM_LIT:16> , "<STR_LIT>" , <NUM_LIT> ) <EOL> assertProduces ( <NUM_LIT:16> , "<STR_LIT>" , Long . MIN_VALUE . toULong ( ) ) <EOL> assertProduces ( <NUM_LIT:16> , "<STR_LIT>" , ULong . MAX_VALUE ) <EOL> assertProduces ( <NUM_LIT:2> , "<STR_LIT>" , <NUM_LIT> ) <EOL> assertProduces ( <NUM_LIT> , "<STR_LIT>" , <NUM_LIT> ) <EOL> assertFailsOrNull ( <NUM_LIT:8> , "<STR_LIT>" ) <EOL> assertFailsOrNull ( <NUM_LIT:8> , "<STR_LIT>" ) <EOL> assertFailsOrNull ( <NUM_LIT:10> , "<STR_LIT>" ) <EOL> assertFailsOrNull ( <NUM_LIT:4> , "<STR_LIT>" ) <EOL> assertFailsOrNull ( <NUM_LIT:4> , "<STR_LIT>" ) <EOL> } <EOL> assertFailsWith < IllegalArgumentException > ( "<STR_LIT>" ) { "<STR_LIT>" . toULong ( radix = <NUM_LIT> ) } <EOL> assertFailsWith < IllegalArgumentException > ( "<STR_LIT>" ) { "<STR_LIT:1>" . toULongOrNull ( radix = <NUM_LIT:1> ) } <EOL> }


{ <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> . toByte ( ) . toString ( <NUM_LIT:16> ) ) <EOL> assertEquals ( "<STR_LIT>" , Byte . MIN_VALUE . toString ( radix = <NUM_LIT:16> ) ) <EOL> assertEquals ( "<STR_LIT>" , Byte . MAX_VALUE . toString ( radix = <NUM_LIT> ) ) <EOL> assertEquals ( "<STR_LIT>" , Byte . MIN_VALUE . toString ( radix = <NUM_LIT> ) ) <EOL> assertFailsWith < IllegalArgumentException > ( "<STR_LIT>" ) { <NUM_LIT> . toByte ( ) . toString ( radix = <NUM_LIT> ) } <EOL> assertFailsWith < IllegalArgumentException > ( "<STR_LIT>" ) { <NUM_LIT:1> . toByte ( ) . toString ( radix = <NUM_LIT:1> ) } <EOL> }


{ <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> . toShort ( ) . toString ( radix = <NUM_LIT:16> ) . uppercase ( ) ) <EOL> assertEquals ( "<STR_LIT>" , ( - <NUM_LIT> ) . toShort ( ) . toString ( radix = <NUM_LIT:16> ) ) <EOL> assertEquals ( "<STR_LIT>" , ( - <NUM_LIT> ) . toShort ( ) . toString ( radix = <NUM_LIT> ) ) <EOL> assertFailsWith < IllegalArgumentException > ( "<STR_LIT>" ) { <NUM_LIT> . toShort ( ) . toString ( radix = <NUM_LIT> ) } <EOL> assertFailsWith < IllegalArgumentException > ( "<STR_LIT>" ) { <NUM_LIT:1> . toShort ( ) . toString ( radix = <NUM_LIT:1> ) } <EOL> }


{ <EOL> assertEquals ( "<STR_LIT>" , ( - <NUM_LIT> ) . toString ( radix = <NUM_LIT:16> ) ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> . toString ( radix = <NUM_LIT:2> ) ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> . toString ( radix = <NUM_LIT> ) ) <EOL> assertFailsWith < IllegalArgumentException > ( "<STR_LIT>" ) { <NUM_LIT> . toString ( radix = <NUM_LIT> ) } <EOL> assertFailsWith < IllegalArgumentException > ( "<STR_LIT>" ) { <NUM_LIT:1> . toString ( radix = <NUM_LIT:1> ) } <EOL> }


{ <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> . toString ( radix = <NUM_LIT:16> ) ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> . toString ( radix = <NUM_LIT> ) ) <EOL> val values = listOf ( Int . MAX_VALUE . toLong ( ) , Int . MIN_VALUE . toLong ( ) , Int . MAX_VALUE + <NUM_LIT> , Long . MAX_VALUE , Long . MIN_VALUE ) <EOL> val expected = listOf ( <NUM_LIT:2> to listOf ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , <NUM_LIT:3> to listOf ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , <NUM_LIT:4> to listOf ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , <NUM_LIT:5> to listOf ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , <NUM_LIT:6> to listOf ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , <NUM_LIT:7> to listOf ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , <NUM_LIT:8> to listOf ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , <NUM_LIT:9> to listOf ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , <NUM_LIT:10> to listOf ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , <NUM_LIT:11> to listOf ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , <NUM_LIT:12> to listOf ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , <NUM_LIT> to listOf ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , <NUM_LIT> to listOf ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , <NUM_LIT> to listOf ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , <NUM_LIT:16> to listOf ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , <NUM_LIT> to listOf ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , <NUM_LIT> to listOf ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , <NUM_LIT> to listOf ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , <NUM_LIT:20> to listOf ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , <NUM_LIT> to listOf ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , <NUM_LIT> to listOf ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , <NUM_LIT:23> to listOf ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , <NUM_LIT> to listOf ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , <NUM_LIT> to listOf ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , <NUM_LIT> to listOf ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , <NUM_LIT> to listOf ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , <NUM_LIT> to listOf ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , <NUM_LIT> to listOf ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , <NUM_LIT> to listOf ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , <NUM_LIT:31> to listOf ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , <NUM_LIT> to listOf ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , <NUM_LIT> to listOf ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , <NUM_LIT> to listOf ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , <NUM_LIT> to listOf ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , <NUM_LIT> to listOf ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , ) <EOL> for ( ( base , expectedValues ) in expected ) { <EOL> for ( ( index , value ) in values . withIndex ( ) ) { <EOL> assertEquals ( expectedValues [ index ] , value . toString ( base ) , "<STR_LIT>" ) <EOL> } <EOL> } <EOL> assertFailsWith < IllegalArgumentException > ( "<STR_LIT>" ) { <NUM_LIT> . toString ( radix = <NUM_LIT> ) } <EOL> assertFailsWith < IllegalArgumentException > ( "<STR_LIT>" ) { <NUM_LIT:1L> . toString ( radix = <NUM_LIT:1> ) } <EOL> }


{ <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> . toUByte ( ) . toString ( <NUM_LIT:16> ) ) <EOL> assertEquals ( "<STR_LIT>" , Byte . MIN_VALUE . toUByte ( ) . toString ( radix = <NUM_LIT:16> ) ) <EOL> assertEquals ( "<STR_LIT>" , UByte . MAX_VALUE . toString ( radix = <NUM_LIT:16> ) ) <EOL> assertEquals ( "<STR_LIT>" , Byte . MIN_VALUE . toUByte ( ) . toString ( radix = <NUM_LIT> ) ) <EOL> assertEquals ( "<STR_LIT>" , UByte . MAX_VALUE . toString ( radix = <NUM_LIT> ) ) <EOL> assertFailsWith < IllegalArgumentException > ( "<STR_LIT>" ) { <NUM_LIT> . toUByte ( ) . toString ( radix = <NUM_LIT> ) } <EOL> assertFailsWith < IllegalArgumentException > ( "<STR_LIT>" ) { <NUM_LIT:1> . toUByte ( ) . toString ( radix = <NUM_LIT:1> ) } <EOL> }


{ <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> . toUShort ( ) . toString ( radix = <NUM_LIT:16> ) . uppercase ( ) ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> . toUShort ( ) . toString ( radix = <NUM_LIT:16> ) ) <EOL> assertEquals ( "<STR_LIT>" , UShort . MAX_VALUE . toString ( radix = <NUM_LIT:16> ) ) <EOL> assertEquals ( "<STR_LIT>" , UShort . MAX_VALUE . toString ( radix = <NUM_LIT> ) ) <EOL> assertFailsWith < IllegalArgumentException > ( "<STR_LIT>" ) { <NUM_LIT> . toUShort ( ) . toString ( radix = <NUM_LIT> ) } <EOL> assertFailsWith < IllegalArgumentException > ( "<STR_LIT>" ) { <NUM_LIT:1> . toUShort ( ) . toString ( radix = <NUM_LIT:1> ) } <EOL> }


{ <EOL> assertEquals ( "<STR_LIT>" , ( - <NUM_LIT> ) . toUInt ( ) . toString ( radix = <NUM_LIT:16> ) ) <EOL> assertEquals ( "<STR_LIT>" , UInt . MAX_VALUE . toString ( radix = <NUM_LIT:16> ) ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> . toString ( radix = <NUM_LIT:2> ) ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> . toString ( radix = <NUM_LIT> ) ) <EOL> assertEquals ( "<STR_LIT>" , UInt . MAX_VALUE . toString ( radix = <NUM_LIT> ) ) <EOL> assertFailsWith < IllegalArgumentException > ( "<STR_LIT>" ) { <NUM_LIT> . toString ( radix = <NUM_LIT> ) } <EOL> assertFailsWith < IllegalArgumentException > ( "<STR_LIT>" ) { <NUM_LIT:1u> . toString ( radix = <NUM_LIT:1> ) } <EOL> }


{ <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> . toString ( radix = <NUM_LIT:16> ) ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> . toString ( radix = <NUM_LIT:16> ) ) <EOL> assertEquals ( "<STR_LIT>" , Long . MIN_VALUE . toULong ( ) . toString ( radix = <NUM_LIT:16> ) ) <EOL> assertEquals ( "<STR_LIT>" , ULong . MAX_VALUE . toString ( radix = <NUM_LIT:16> ) ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> . toString ( radix = <NUM_LIT> ) ) <EOL> assertFailsWith < IllegalArgumentException > ( "<STR_LIT>" ) { <NUM_LIT> . toString ( radix = <NUM_LIT> ) } <EOL> assertFailsWith < IllegalArgumentException > ( "<STR_LIT>" ) { <NUM_LIT> . toString ( radix = <NUM_LIT:1> ) } <EOL> }


internal fun doubleTotalOrderEquals ( a : Double ? , b : Double ? ) : Boolean

= ( a as Any ? ) == b


internal fun floatTotalOrderEquals ( a : Float ? , b : Float ? ) : Boolean

= ( a as Any ? ) == b


internal fun < T : Any > compareConversion ( convertOrFail : ( String ) -> T , convertOrNull : ( String ) -> T ? , equality : ( T , T ? ) -> Boolean = { a , b -> a == b } , assertions : ConversionContext < T > . ( ) -> Unit )

{ <EOL> ConversionContext ( convertOrFail , convertOrNull , equality ) . assertions ( ) <EOL> }


internal fun < T : Any > compareConversionWithRadix ( convertOrFail : String . ( Int ) -> T , convertOrNull : String . ( Int ) -> T ? , assertions : ConversionWithRadixContext < T > . ( ) -> Unit )

{ <EOL> ConversionWithRadixContext ( convertOrFail , convertOrNull ) . assertions ( ) <EOL> }


private fun assertEquals ( expected : T , actual : T ? , input : String , operation : String )

{ <EOL> assertTrue ( equality ( expected , actual ) , "<STR_LIT>" ) <EOL> }


fun assertProduces ( input : String , output : T )

{ <EOL> assertEquals ( output , convertOrFail ( input ) , input , "<STR_LIT>" ) <EOL> assertEquals ( output , convertOrNull ( input ) , input , "<STR_LIT>" ) <EOL> }


fun assertFailsOrNull ( input : String )

{ <EOL> assertFailsWith < NumberFormatException > ( "<STR_LIT>" ) { convertOrFail ( input ) } <EOL> assertNull ( convertOrNull ( input ) , message = "<STR_LIT>" ) <EOL> }


fun assertProduces ( radix : Int , input : String , output : T )

{ <EOL> assertEquals ( output , convertOrFail ( input , radix ) ) <EOL> assertEquals ( output , convertOrNull ( input , radix ) ) <EOL> }


fun assertFailsOrNull ( radix : Int , input : String )

{ <EOL> assertFailsWith < NumberFormatException > ( "<STR_LIT>" , { convertOrFail ( input , radix ) } ) <EOL> assertNull ( convertOrNull ( input , radix ) , message = "<STR_LIT>" ) <EOL> }


{ <EOL> assertEquals ( ( <NUM_LIT> ) . toString ( ) , "<STR_LIT>" ) <EOL> assertEquals ( ( - <NUM_LIT> ) . toString ( ) , "<STR_LIT>" ) <EOL> testExceptOn ( TestPlatform . Js ) { <EOL> assertEquals ( ( <NUM_LIT:0.0> ) . toString ( ) , "<STR_LIT>" ) <EOL> assertEquals ( ( - <NUM_LIT:0.0> ) . toString ( ) , "<STR_LIT>" ) <EOL> } <EOL> assertEquals ( Double . NaN . toString ( ) , "<STR_LIT>" ) <EOL> assertEquals ( Double . POSITIVE_INFINITY . toString ( ) , "<STR_LIT>" ) <EOL> assertEquals ( Double . NEGATIVE_INFINITY . toString ( ) , "<STR_LIT>" ) <EOL> }


{ <EOL> assertEquals ( ( <NUM_LIT> ) . toString ( ) , "<STR_LIT>" ) <EOL> assertEquals ( ( - <NUM_LIT> ) . toString ( ) , "<STR_LIT>" ) <EOL> testExceptOn ( TestPlatform . Js ) { <EOL> assertEquals ( ( <NUM_LIT:0.0f> ) . toString ( ) , "<STR_LIT>" ) <EOL> assertEquals ( ( - <NUM_LIT:0.0f> ) . toString ( ) , "<STR_LIT>" ) <EOL> } <EOL> assertEquals ( Float . NaN . toString ( ) , "<STR_LIT>" ) <EOL> assertEquals ( Float . POSITIVE_INFINITY . toString ( ) , "<STR_LIT>" ) <EOL> assertEquals ( Float . NEGATIVE_INFINITY . toString ( ) , "<STR_LIT>" ) <EOL> }


private fun < T > systemProperty ( name : String , transform : String . ( ) -> T ) : T ? <EOL>

= System . getProperty ( name ) ? . transform ( )


private fun timeSystemProperty ( name : String ) : TimeValue ? <EOL>

= systemProperty ( name ) { toLong ( ) . let { TimeValue . milliseconds ( it ) } }


private fun intSystemProperty ( name : String ) : Int ? <EOL>

= systemProperty ( name ) { toInt ( ) }


private fun arraySystemProperty ( name : String ) : Array < String > ? <EOL>

= systemProperty ( name ) { split ( "<STR_LIT:U+002C>" ) . toTypedArray ( ) }


fun ChainedOptionsBuilder . defaultOptions ( ) : ChainedOptionsBuilder

= this <EOL> . jvmArgs ( * jvmArgs ) <EOL> . addProfiler ( "<STR_LIT>" ) <EOL> . param ( sizeParam , * ( arraySystemProperty ( sizeParam ) ? : sizeParamValues ) ) <EOL> . param ( hashCodeTypeParam , * ( arraySystemProperty ( hashCodeTypeParam ) ? : hashCodeTypeParamValues ) ) <EOL> . param ( immutablePercentageParam , * ( arraySystemProperty ( immutablePercentageParam ) ? : immutablePercentageParamValues ) ) <EOL> . forks ( intSystemProperty ( "<STR_LIT>" ) ? : forks ) <EOL> . warmupIterations ( intSystemProperty ( "<STR_LIT>" ) ? : warmupIterations ) <EOL> . measurementIterations ( intSystemProperty ( "<STR_LIT>" ) ? : measurementIterations ) <EOL> . warmupTime ( timeSystemProperty ( "<STR_LIT>" ) ? : warmupTime ) <EOL> . measurementTime ( timeSystemProperty ( "<STR_LIT>" ) ? : measurementTime ) <EOL> . mode ( Mode . AverageTime ) <EOL> . timeUnit ( TimeUnit . MICROSECONDS )


inline fun runBenchmarks ( outputFileName : String , configure : ChainedOptionsBuilder . ( ) -> ChainedOptionsBuilder )

{ <EOL> val options = OptionsBuilder ( ) <EOL> . defaultOptions ( ) <EOL> . configure ( ) <EOL> . build ( ) <EOL> val outputPath = "<STR_LIT>" <EOL> val regressionReferencePath = "<STR_LIT>" <EOL> Runner ( options ) . run ( ) . toBenchmarkResults ( ) <EOL> . also { printCsvResults ( it , "<STR_LIT>" ) } <EOL> . let { calculateRegression ( it , "<STR_LIT>" ) } <EOL> ? . also { printReport ( it , System . out , descendingScoreRegress = true ) } <EOL> ? . also { printCsvResults ( it , "<STR_LIT>" ) } <EOL> }


internal fun __ieee754_exp ( _x : Double ) : Double

{ <EOL> var x : Double = _x <EOL> var y : Double <EOL> var hi : Double = <NUM_LIT:0.0> <EOL> var lo : Double = <NUM_LIT:0.0> <EOL> var c : Double <EOL> var t : Double <EOL> var k : Int = <NUM_LIT:0> <EOL> var xsb : Int <EOL> var hx : UInt <EOL> hx = __HIu ( x ) <EOL> xsb = ( ( hx shr <NUM_LIT:31> ) and <NUM_LIT> ) . toInt ( ) <EOL> hx = hx and <NUM_LIT> <EOL> if ( hx >= <NUM_LIT> ) { <EOL> if ( hx >= <NUM_LIT> ) { <EOL> if ( ( ( hx and <NUM_LIT> ) or __LOu ( x ) ) != <NUM_LIT> ) <EOL> return x + x <EOL> else return if ( xsb == <NUM_LIT:0> ) x else <NUM_LIT:0.0> <EOL> } <EOL> if ( x > o_threshold ) return huge * huge <EOL> if ( x < u_threshold ) return twom1000 * twom1000 <EOL> } <EOL> if ( hx > <NUM_LIT> ) { <EOL> if ( hx < <NUM_LIT> ) { <EOL> hi = x - ln2HI [ xsb ] ; lo = ln2LO [ xsb ] ; k = <NUM_LIT:1> - xsb - xsb <EOL> } else { <EOL> k = ( invln2 * x + halF [ xsb ] ) . toInt ( ) <EOL> t = k . toDouble ( ) <EOL> hi = x - t * ln2HI [ <NUM_LIT:0> ] <EOL> lo = t * ln2LO [ <NUM_LIT:0> ] <EOL> } <EOL> x = hi - lo <EOL> } else if ( hx < <NUM_LIT> ) { <EOL> if ( huge + x > one ) return one + x <EOL> } else k = <NUM_LIT:0> <EOL> t = x * x <EOL> c = x - t * ( P1 + t * ( P2 + t * ( P3 + t * ( P4 + t * P5 ) ) ) ) <EOL> if ( k == <NUM_LIT:0> ) return one - ( ( x * c ) / ( c - <NUM_LIT:2.0> ) - x ) <EOL> else y = one - ( ( lo - ( x * c ) / ( <NUM_LIT:2.0> - c ) ) - hi ) <EOL> if ( k >= - <NUM_LIT> ) { <EOL> y = doubleSetWord ( d = y , hi = __HI ( y ) + ( k shl <NUM_LIT:20> ) ) <EOL> return y <EOL> } else { <EOL> y = doubleSetWord ( d = y , hi = __HI ( y ) + ( ( k + <NUM_LIT> ) shl <NUM_LIT:20> ) ) <EOL> return y * twom1000 <EOL> } <EOL> }


internal actual fun String . nativeIndexOf ( ch : Char , fromIndex : Int ) : Int

{ <EOL> for ( index in fromIndex . coerceAtLeast ( <NUM_LIT:0> ) .. this . lastIndex ) { <EOL> if ( ch == get ( index ) ) return index <EOL> } <EOL> return - <NUM_LIT:1> <EOL> }

/**
 * Returns the index within this string of the first occurrence of the specified character, starting from the specified offset.
 */


internal actual fun String . nativeLastIndexOf ( ch : Char , fromIndex : Int ) : Int

{ <EOL> for ( index in fromIndex . coerceAtMost ( this . lastIndex ) downTo <NUM_LIT:0> ) { <EOL> if ( ch == get ( index ) ) return index <EOL> } <EOL> return - <NUM_LIT:1> <EOL> }

/**
 * Returns the index within this string of the last occurrence of the specified character.
 */


internal actual fun String . nativeIndexOf ( str : String , fromIndex : Int ) : Int

{ <EOL> for ( index in fromIndex . coerceAtLeast ( <NUM_LIT:0> ) .. ( this . length - str . length ) ) { <EOL> if ( str . regionMatchesImpl ( <NUM_LIT:0> , this , index , str . length , false ) ) { <EOL> return index <EOL> } <EOL> } <EOL> return - <NUM_LIT:1> <EOL> }

/**
 * Returns the index within this string of the first occurrence of the specified substring, starting from the specified offset.
 */


internal actual fun String . nativeLastIndexOf ( str : String , fromIndex : Int ) : Int

{ <EOL> for ( index in fromIndex . coerceAtMost ( this . length - str . length ) downTo <NUM_LIT:0> ) { <EOL> if ( str . regionMatchesImpl ( <NUM_LIT:0> , this , index , str . length , false ) ) { <EOL> return index <EOL> } <EOL> } <EOL> return - <NUM_LIT:1> <EOL> }

/**
 * Returns the index within this string of the last occurrence of the specified character, starting from the specified offset.
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ Deprecated ( "<STR_LIT>" , ReplaceWith ( "<STR_LIT>" ) ) <EOL> @ DeprecatedSinceKotlin ( warningSince = "<STR_LIT:1.4>" , errorSince = "<STR_LIT:1.5>" ) <EOL> public actual fun String ( chars : CharArray ) : String

= <EOL> chars . concatToString ( )

/**
 * Converts the characters in the specified array to a string.
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ Deprecated ( "<STR_LIT>" , ReplaceWith ( "<STR_LIT>" ) ) <EOL> @ DeprecatedSinceKotlin ( warningSince = "<STR_LIT:1.4>" , errorSince = "<STR_LIT:1.5>" ) <EOL> public actual fun String ( chars : CharArray , offset : Int , length : Int ) : String

{ <EOL> if ( offset < <NUM_LIT:0> || length < <NUM_LIT:0> || offset + length > chars . size ) <EOL> throw IndexOutOfBoundsException ( ) <EOL> val copy = WasmCharArray ( length ) <EOL> copyWasmArray ( chars . storage , copy , offset , <NUM_LIT:0> , length ) <EOL> return copy . createString ( ) <EOL> }

/**
 * Converts the characters from a portion of the specified array to a string.
 *
 * @throws IndexOutOfBoundsException if either [offset] or [length] are less than zero
 * or `offset + length` is out of [chars] array bounds.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun CharArray . concatToString ( ) : String

{ <EOL> val thisStorage = this . storage <EOL> val thisLength = thisStorage . len ( ) <EOL> val copy = WasmCharArray ( thisLength ) <EOL> copyWasmArray ( this . storage , copy , <NUM_LIT:0> , <NUM_LIT:0> , thisLength ) <EOL> return copy . createString ( ) <EOL> }

/**
 * Concatenates characters in this [CharArray] into a String.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ Suppress ( "<STR_LIT:ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS>" ) <EOL> public actual fun CharArray . concatToString ( startIndex : Int = <NUM_LIT:0> , endIndex : Int = this . size ) : String

{ <EOL> AbstractList . checkBoundsIndexes ( startIndex , endIndex , this . size ) <EOL> val length = endIndex - startIndex <EOL> val copy = WasmCharArray ( length ) <EOL> copyWasmArray ( this . storage , copy , startIndex , <NUM_LIT:0> , length ) <EOL> return copy . createString ( ) <EOL> }

/**
 * Concatenates characters in this [CharArray] or its subrange into a String.
 *
 * @param startIndex the beginning (inclusive) of the subrange of characters, 0 by default.
 * @param endIndex the end (exclusive) of the subrange of characters, size of this array by default.
 *
 * @throws IndexOutOfBoundsException if [startIndex] is less than zero or [endIndex] is greater than the size of this array.
 * @throws IllegalArgumentException if [startIndex] is greater than [endIndex].
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun String . toCharArray ( ) : CharArray

{ <EOL> val thisChars = this . chars <EOL> val thisLength = thisChars . len ( ) <EOL> val newArray = CharArray ( thisLength ) <EOL> copyWasmArray ( thisChars , newArray . storage , <NUM_LIT:0> , <NUM_LIT:0> , thisLength ) <EOL> return newArray <EOL> }

/**
 * Returns a [CharArray] containing characters of this string.
 */


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

{ <EOL> AbstractList . checkBoundsIndexes ( startIndex , endIndex , length ) <EOL> val newLength = endIndex - startIndex <EOL> val newArray = CharArray ( newLength ) <EOL> copyWasmArray ( this . chars , newArray . storage , startIndex , <NUM_LIT:0> , newLength ) <EOL> return newArray <EOL> }

/**
 * Returns a [CharArray] containing characters of this string or its substring.
 *
 * @param startIndex the beginning (inclusive) of the substring, 0 by default.
 * @param endIndex the end (exclusive) of the substring, length of this string by default.
 *
 * @throws IndexOutOfBoundsException if [startIndex] is less than zero or [endIndex] is greater than the length of this string.
 * @throws IllegalArgumentException if [startIndex] is greater than [endIndex].
 */


@ SinceKotlin ( "<STR_LIT:2.0>" ) <EOL> @ Suppress ( "<STR_LIT:ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS>" ) <EOL> public actual fun String . toCharArray ( destination : CharArray , destinationOffset : Int = <NUM_LIT:0> , startIndex : Int = <NUM_LIT:0> , endIndex : Int = length ) : CharArray

{ <EOL> AbstractList . checkBoundsIndexes ( startIndex , endIndex , length ) <EOL> val rangeSize = endIndex - startIndex <EOL> AbstractList . checkBoundsIndexes ( destinationOffset , destinationOffset + rangeSize , destination . size ) <EOL> copyWasmArray ( this . chars , destination . storage , startIndex , destinationOffset , rangeSize ) <EOL> return destination <EOL> }

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


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun ByteArray . decodeToString ( ) : String

{ <EOL> return decodeUtf8 ( this , <NUM_LIT:0> , size , false ) <EOL> }

/**
 * Decodes a string from the bytes in UTF-8 encoding in this array.
 *
 * Malformed byte sequences are replaced by the replacement char `\uFFFD`.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ Suppress ( "<STR_LIT:ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS>" ) <EOL> public actual fun ByteArray . decodeToString ( startIndex : Int = <NUM_LIT:0> , endIndex : Int = this . size , throwOnInvalidSequence : Boolean = false ) : String

{ <EOL> AbstractList . checkBoundsIndexes ( startIndex , endIndex , this . size ) <EOL> return decodeUtf8 ( this , startIndex , endIndex , throwOnInvalidSequence ) <EOL> }

/**
 * Decodes a string from the bytes in UTF-8 encoding in this array or its subrange.
 *
 * @param startIndex the beginning (inclusive) of the subrange to decode, 0 by default.
 * @param endIndex the end (exclusive) of the subrange to decode, size of this array by default.
 * @param throwOnInvalidSequence specifies whether to throw an exception on malformed byte sequence or replace it by the replacement char `\uFFFD`.
 *
 * @throws IndexOutOfBoundsException if [startIndex] is less than zero or [endIndex] is greater than the size of this array.
 * @throws IllegalArgumentException if [startIndex] is greater than [endIndex].
 * @throws CharacterCodingException if the byte array contains malformed UTF-8 byte sequence and [throwOnInvalidSequence] is true.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun String . encodeToByteArray ( ) : ByteArray

{ <EOL> return encodeUtf8 ( this , <NUM_LIT:0> , length , false ) <EOL> }

/**
 * Encodes this string to an array of bytes in UTF-8 encoding.
 *
 * Any malformed char sequence is replaced by the replacement byte sequence.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> @ Suppress ( "<STR_LIT:ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS>" ) <EOL> public actual fun String . encodeToByteArray ( startIndex : Int = <NUM_LIT:0> , endIndex : Int = this . length , throwOnInvalidSequence : Boolean = false ) : ByteArray

{ <EOL> AbstractList . checkBoundsIndexes ( startIndex , endIndex , length ) <EOL> return encodeUtf8 ( this , startIndex , endIndex , throwOnInvalidSequence ) <EOL> }

/**
 * Encodes this string or its substring to an array of bytes in UTF-8 encoding.
 *
 * @param startIndex the beginning (inclusive) of the substring to encode, 0 by default.
 * @param endIndex the end (exclusive) of the substring to encode, length of this string by default.
 * @param throwOnInvalidSequence specifies whether to throw an exception on malformed char sequence or replace.
 *
 * @throws IndexOutOfBoundsException if [startIndex] is less than zero or [endIndex] is greater than the length of this string.
 * @throws IllegalArgumentException if [startIndex] is greater than [endIndex].
 * @throws CharacterCodingException if this string contains malformed char sequence and [throwOnInvalidSequence] is true.
 */


public actual fun String . substring ( startIndex : Int ) : String

= <EOL> subSequence ( startIndex , this . length ) as String

/**
 * Returns a substring of this string that starts at the specified [startIndex] and continues to the end of the string.
 */


public actual fun String . substring ( startIndex : Int , endIndex : Int ) : String

= <EOL> subSequence ( startIndex , endIndex ) as String

/**
 * Returns the substring of this string starting at the [startIndex] and ending right before the [endIndex].
 *
 * @param startIndex the start index (inclusive).
 * @param endIndex the end index (exclusive).
 */


@ Deprecated ( "<STR_LIT>" , ReplaceWith ( "<STR_LIT>" ) ) <EOL> @ DeprecatedSinceKotlin ( warningSince = "<STR_LIT:1.5>" ) <EOL> public actual fun String . toUpperCase ( ) : String

= uppercase ( )

/**
 * Returns a copy of this string converted to upper case using the rules of the default locale.
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> public actual fun String . uppercase ( ) : String

= uppercaseImpl ( )

/**
 * Returns a copy of this string converted to upper case using Unicode mapping rules of the invariant locale.
 *
 * This function supports one-to-many and many-to-one character mapping,
 * thus the length of the returned string can be different from the length of the original string.
 *
 * @sample samples.text.Strings.uppercase
 */


@ Deprecated ( "<STR_LIT>" , ReplaceWith ( "<STR_LIT>" ) ) <EOL> @ DeprecatedSinceKotlin ( warningSince = "<STR_LIT:1.5>" ) <EOL> public actual fun String . toLowerCase ( ) : String

= lowercase ( )

/**
 * Returns a copy of this string converted to lower case using the rules of the default locale.
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> public actual fun String . lowercase ( ) : String

= lowercaseImpl ( )

/**
 * Returns a copy of this string converted to lower case using Unicode mapping rules of the invariant locale.
 *
 * This function supports one-to-many and many-to-one character mapping,
 * thus the length of the returned string can be different from the length of the original string.
 *
 * @sample samples.text.Strings.lowercase
 */


@ Deprecated ( "<STR_LIT>" , ReplaceWith ( "<STR_LIT>" ) ) <EOL> @ DeprecatedSinceKotlin ( warningSince = "<STR_LIT:1.5>" ) <EOL> public actual fun String . capitalize ( ) : String

= replaceFirstChar ( Char :: uppercaseChar )

/**
 * Returns a copy of this string having its first letter titlecased using the rules of the default locale,
 * or the original string if it's empty or already starts with a title case letter.
 *
 * The title case of a character is usually the same as its upper case with several exceptions.
 * The particular list of characters with the special title case form depends on the underlying platform.
 *
 * @sample samples.text.Strings.capitalize
 */


@ Deprecated ( "<STR_LIT>" , ReplaceWith ( "<STR_LIT>" ) ) <EOL> @ DeprecatedSinceKotlin ( warningSince = "<STR_LIT:1.5>" ) <EOL> public actual fun String . decapitalize ( ) : String

= replaceFirstChar ( Char :: lowercaseChar )

/**
 * Returns a copy of this string having its first letter lowercased using the rules of the default locale,
 * or the original string if it's empty or already starts with a lower case letter.
 *
 * @sample samples.text.Strings.decapitalize
 */


public actual fun CharSequence . repeat ( n : Int ) : String

{ <EOL> require ( n >= <NUM_LIT:0> ) { "<STR_LIT>" } <EOL> if ( isEmpty ( ) ) return "<STR_LIT>" <EOL> return when ( n ) { <EOL> <NUM_LIT:0> -> "<STR_LIT>" <EOL> <NUM_LIT:1> -> this . toString ( ) <EOL> else -> { <EOL> val sequence = this <EOL> buildString ( n * length ) { <EOL> repeat ( n ) { <EOL> append ( sequence ) <EOL> } <EOL> } <EOL> } <EOL> } <EOL> }

/**
 * Returns a string containing this char sequence repeated [n] times.
 * @throws [IllegalArgumentException] when n < 0.
 * @sample samples.text.Strings.repeat
 */


@ Suppress ( "<STR_LIT:ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS>" ) <EOL> public actual fun String . replace ( oldChar : Char , newChar : Char , ignoreCase : Boolean = false ) : String

{ <EOL> return buildString ( length ) { <EOL> this@replace . forEach { c -> <EOL> append ( if ( c . equals ( oldChar , ignoreCase ) ) newChar else c ) <EOL> } <EOL> } <EOL> }

/**
 * Returns a new string with all occurrences of [oldChar] replaced with [newChar].
 */


@ Suppress ( "<STR_LIT:ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS>" ) <EOL> public actual fun String . replace ( oldValue : String , newValue : String , ignoreCase : Boolean = false ) : String

{ <EOL> run { <EOL> var occurrenceIndex : Int = indexOf ( oldValue , <NUM_LIT:0> , ignoreCase ) <EOL> if ( occurrenceIndex < <NUM_LIT:0> ) return this <EOL> val oldValueLength = oldValue . length <EOL> val searchStep = oldValueLength . coerceAtLeast ( <NUM_LIT:1> ) <EOL> val newLengthHint = length - oldValueLength + newValue . length <EOL> if ( newLengthHint < <NUM_LIT:0> ) throw OutOfMemoryError ( ) <EOL> val stringBuilder = StringBuilder ( newLengthHint ) <EOL> var i = <NUM_LIT:0> <EOL> do { <EOL> stringBuilder . append ( this , i , occurrenceIndex ) . append ( newValue ) <EOL> i = occurrenceIndex + oldValueLength <EOL> if ( occurrenceIndex >= length ) break <EOL> occurrenceIndex = indexOf ( oldValue , occurrenceIndex + searchStep , ignoreCase ) <EOL> } while ( occurrenceIndex > <NUM_LIT:0> ) <EOL> return stringBuilder . append ( this , i , length ) . toString ( ) <EOL> } <EOL> }

/**
 * Returns a new string obtained by replacing all occurrences of the [oldValue] substring in this string
 * with the specified [newValue] string.
 */


@ Suppress ( "<STR_LIT:ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS>" ) <EOL> public actual fun String . replaceFirst ( oldChar : Char , newChar : Char , ignoreCase : Boolean = false ) : String

{ <EOL> val index = indexOf ( oldChar , ignoreCase = ignoreCase ) <EOL> return if ( index < <NUM_LIT:0> ) this else this . replaceRange ( index , index + <NUM_LIT:1> , newChar . toString ( ) ) <EOL> }

/**
 * Returns a new string with the first occurrence of [oldChar] replaced with [newChar].
 */


@ Suppress ( "<STR_LIT:ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS>" ) <EOL> public actual fun String . replaceFirst ( oldValue : String , newValue : String , ignoreCase : Boolean = false ) : String

{ <EOL> val index = indexOf ( oldValue , ignoreCase = ignoreCase ) <EOL> return if ( index < <NUM_LIT:0> ) this else this . replaceRange ( index , index + oldValue . length , newValue ) <EOL> }

/**
 * Returns a new string obtained by replacing the first occurrence of the [oldValue] substring in this string
 * with the specified [newValue] string.
 */


@ Suppress ( "<STR_LIT:ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS>" ) <EOL> public actual fun String ? . equals ( other : String ? , ignoreCase : Boolean = false ) : Boolean

{ <EOL> if ( this == null ) return other == null <EOL> if ( other == null ) return false <EOL> if ( ! ignoreCase ) return this == other <EOL> if ( this . length != other . length ) return false <EOL> for ( index in <NUM_LIT:0> until this . length ) { <EOL> val thisChar = this [ index ] <EOL> val otherChar = other [ index ] <EOL> if ( ! thisChar . equals ( otherChar , ignoreCase ) ) { <EOL> return false <EOL> } <EOL> } <EOL> return true <EOL> }

/**
 * Returns `true` if this string is equal to [other], optionally ignoring character case.
 *
 * Two strings are considered to be equal if they have the same length and the same character at the same index.
 * If [ignoreCase] is true, the result of `Char.uppercaseChar().lowercaseChar()` on each character is compared.
 *
 * @param ignoreCase `true` to ignore character case when comparing strings. By default `false`.
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ Suppress ( "<STR_LIT:ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS>" ) <EOL> public actual fun String . compareTo ( other : String , ignoreCase : Boolean = false ) : Int

{ <EOL> if ( ignoreCase ) { <EOL> val n1 = this . length <EOL> val n2 = other . length <EOL> val min = minOf ( n1 , n2 ) <EOL> if ( min == <NUM_LIT:0> ) return n1 - n2 <EOL> for ( index in <NUM_LIT:0> until min ) { <EOL> var thisChar = this [ index ] <EOL> var otherChar = other [ index ] <EOL> if ( thisChar != otherChar ) { <EOL> thisChar = thisChar . uppercaseChar ( ) <EOL> otherChar = otherChar . uppercaseChar ( ) <EOL> if ( thisChar != otherChar ) { <EOL> thisChar = thisChar . lowercaseChar ( ) <EOL> otherChar = otherChar . lowercaseChar ( ) <EOL> if ( thisChar != otherChar ) { <EOL> return thisChar . compareTo ( otherChar ) <EOL> } <EOL> } <EOL> } <EOL> } <EOL> return n1 - n2 <EOL> } else { <EOL> return compareTo ( other ) <EOL> } <EOL> }

/**
 * Compares two strings lexicographically, optionally ignoring case differences.
 *
 * If [ignoreCase] is true, the result of `Char.uppercaseChar().lowercaseChar()` on each character is compared.
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> public actual infix fun CharSequence ? . contentEquals ( other : CharSequence ? ) : Boolean

= contentEqualsImpl ( other )

/**
 * Returns `true` if the contents of this char sequence are equal to the contents of the specified [other],
 * i.e. both char sequences contain the same number of the same characters in the same order.
 *
 * @sample samples.text.Strings.contentEquals
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> public actual fun CharSequence ? . contentEquals ( other : CharSequence ? , ignoreCase : Boolean ) : Boolean

{ <EOL> return if ( ignoreCase ) <EOL> this . contentEqualsIgnoreCaseImpl ( other ) <EOL> else <EOL> this . contentEqualsImpl ( other ) <EOL> }

/**
 * Returns `true` if the contents of this char sequence are equal to the contents of the specified [other], optionally ignoring case difference.
 *
 * @param ignoreCase `true` to ignore character case when comparing contents.
 *
 * @sample samples.text.Strings.contentEquals
 */


@ Suppress ( "<STR_LIT:ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS>" ) <EOL> public actual fun String . startsWith ( prefix : String , ignoreCase : Boolean = false ) : Boolean

= <EOL> regionMatches ( <NUM_LIT:0> , prefix , <NUM_LIT:0> , prefix . length , ignoreCase )

/**
 * Returns `true` if this string starts with the specified prefix.
 */


@ Suppress ( "<STR_LIT:ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS>" ) <EOL> public actual fun String . startsWith ( prefix : String , startIndex : Int , ignoreCase : Boolean = false ) : Boolean

= <EOL> regionMatches ( startIndex , prefix , <NUM_LIT:0> , prefix . length , ignoreCase )

/**
 * Returns `true` if a substring of this string starting at the specified offset [startIndex] starts with the specified prefix.
 */


@ Suppress ( "<STR_LIT:ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS>" ) <EOL> public actual fun String . endsWith ( suffix : String , ignoreCase : Boolean = false ) : Boolean

= <EOL> regionMatches ( length - suffix . length , suffix , <NUM_LIT:0> , suffix . length , ignoreCase )

/**
 * Returns `true` if this string ends with the specified suffix.
 */


public actual fun CharSequence . regionMatches ( thisOffset : Int , other : CharSequence , otherOffset : Int , length : Int , ignoreCase : Boolean ) : Boolean

= regionMatchesImpl ( thisOffset , other , otherOffset , length , ignoreCase )

/**
 * Returns `true` if the specified range in this char sequence is equal to the specified range in another char sequence.
 * @param thisOffset the start offset in this char sequence of the substring to compare.
 * @param other the string against a substring of which the comparison is performed.
 * @param otherOffset the start offset in the other char sequence of the substring to compare.
 * @param length the length of the substring to compare.
 */


@ SinceKotlin ( "<STR_LIT:1.9>" ) <EOL> @ Suppress ( "<STR_LIT:ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS>" ) <EOL> public actual fun String . regionMatches ( thisOffset : Int , other : String , otherOffset : Int , length : Int , ignoreCase : Boolean = false ) : Boolean

/**
 * Returns `true` if the specified range in this string is equal to the specified range in another string.
 * @param thisOffset the start offset in this string of the substring to compare.
 * @param other the string against a substring of which the comparison is performed.
 * @param otherOffset the start offset in the other string of the substring to compare.
 * @param length the length of the substring to compare.
 */


{ <EOL> ok = "<STR_LIT:OK>" <EOL> }


= ok


@ Synchronized <EOL> @ JvmOverloads <EOL> fun testJvmOverloads ( a : Int = <NUM_LIT:0> )


@ Synchronized <EOL> private fun testAccessor ( )


= { -> testAccessor ( ) }


@ Synchronized <EOL> @ JvmStatic <EOL> fun testJvmStatic ( )


@ Synchronized <EOL> fun testInlineClassFun ( )


fun f ( x : String = "<STR_LIT:1>" ) : String


fun g ( x : String = "<STR_LIT:2>" ) : String


fun h ( x : T = prop ) : T


= x


{ <EOL> val i : I < String > = B ( ) <EOL> var result = i . f ( ) + i . g ( ) + i . h ( ) <EOL> if ( result != "<STR_LIT:123>" ) return "<STR_LIT>" <EOL> val b = B ( ) <EOL> result = b . f ( ) + b . g ( ) + b . h ( ) <EOL> if ( result != "<STR_LIT:123>" ) return "<STR_LIT>" <EOL> val a : A < String > = B ( ) <EOL> result = a . f ( "<STR_LIT>" ) + a . g ( "<STR_LIT>" ) + a . h ( "<STR_LIT:e>" ) <EOL> if ( result != "<STR_LIT>" ) return "<STR_LIT>" <EOL> return "<STR_LIT:OK>" <EOL> }


{ <EOL> val rem = u % ub <EOL> if ( rem != uc ) throw AssertionError ( "<STR_LIT>" ) <EOL> return "<STR_LIT:OK>" <EOL> }


{ <EOL> val ( train , test ) = mnist ( ) <EOL> lenet5Classic . use { <EOL> val earlyStopping = EarlyStopping ( monitor = EpochTrainingEvent :: valLossValue , minDelta = <NUM_LIT:0.0> , patience = <NUM_LIT:2> , verbose = true , mode = EarlyStoppingMode . AUTO , baseline = <NUM_LIT> , restoreBestWeights = false ) <EOL> it . compile ( optimizer = Adam ( clipGradient = ClipGradientByValue ( <NUM_LIT> ) ) , loss = Losses . SOFT_MAX_CROSS_ENTROPY_WITH_LOGITS , metric = Metrics . ACCURACY ) <EOL> it . logSummary ( ) <EOL> it . fit ( dataset = train , epochs = EPOCHS , batchSize = TRAINING_BATCH_SIZE , earlyStopping ) <EOL> val accuracy = it . evaluate ( dataset = test , batchSize = TEST_BATCH_SIZE ) . metrics [ Metrics . ACCURACY ] <EOL> println ( "<STR_LIT>" ) <EOL> } <EOL> }

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


= lenetWithEarlyStoppingCallback ( )


internal inline fun < reified T > deserializeConfig ( configString : String , deserializer : DeserializationStrategy < T > , useNamingConvention : Boolean = false , modules : SerializersModule = Hocon . serializersModule ) : T

{ <EOL> val ucnc = useNamingConvention <EOL> return Hocon { <EOL> useConfigNamingConvention = ucnc <EOL> serializersModule = modules <EOL> } . decodeFromConfig ( deserializer , ConfigFactory . parseString ( configString ) ) <EOL> }


{ <EOL> val obj = deserializeConfig ( configString , ComplexConfig . serializer ( ) ) <EOL> with ( obj ) { <EOL> assertEquals ( <NUM_LIT:42> , i ) <EOL> assertEquals ( "<STR_LIT:foo>" , s ) <EOL> assertEquals ( listOf ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) , iList ) <EOL> assertEquals ( listOf ( Simple ( <NUM_LIT> ) ) , inner ) <EOL> assertEquals ( listOf ( listOf ( "<STR_LIT:a>" , "<STR_LIT:b>" ) , listOf ( "<STR_LIT:x>" , "<STR_LIT:z>" ) ) , ll ) <EOL> assertEquals ( mapOf ( "<STR_LIT>" to ConfigObjectInner ( "<STR_LIT:foo>" , f = <NUM_LIT> ) , "<STR_LIT:bar>" to ConfigObjectInner ( "<STR_LIT:baz>" ) ) , m ) <EOL> } <EOL> }


@ Test <EOL> fun `very complex config` ( )

{ <EOL> val obj = deserializeConfig ( complexConfigString , VeryComplexConfig . serializer ( ) ) <EOL> with ( obj ) { <EOL> assertEquals ( listOf ( mapOf ( "<STR_LIT:x>" to listOf ( Simple ( <NUM_LIT:42> ) , null ) ) , null ) , l ) <EOL> assertEquals ( mapOf ( "<STR_LIT:x>" to null , "<STR_LIT:y>" to NestedObj ( listOf ( Simple ( <NUM_LIT> ) ) ) ) , m ) <EOL> } <EOL> }


{ <EOL> val conf = ConfigFactory . parseString ( "<STR_LIT>" ) <EOL> assertEquals ( <NUM_LIT:42> , conf . getInt ( "<STR_LIT:a>" ) ) <EOL> val simple = Hocon . decodeFromConfig ( Simple . serializer ( ) , conf ) <EOL> assertEquals ( Simple ( <NUM_LIT:42> ) , simple ) <EOL> }


@ Test <EOL> fun `config with object` ( )

{ <EOL> val conf = ConfigFactory . parseString ( "<STR_LIT>" ) <EOL> assertEquals ( <NUM_LIT:42> , conf . getInt ( "<STR_LIT:a>" ) ) <EOL> assertEquals ( "<STR_LIT:foo>" , conf . getString ( "<STR_LIT>" ) ) <EOL> val obj = Hocon . decodeFromConfig ( ConfigObject . serializer ( ) , conf ) <EOL> assertEquals ( <NUM_LIT:42> , obj . a ) <EOL> assertEquals ( "<STR_LIT:foo>" , obj . b . e ) <EOL> assertEquals ( <NUM_LIT> , obj . b . f ) <EOL> }


{ <EOL> val obj = deserializeConfig ( "<STR_LIT>" , ConfWithList . serializer ( ) ) <EOL> assertEquals ( <NUM_LIT:42> , obj . a ) <EOL> assertEquals ( listOf ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) , obj . b ) <EOL> }


@ Test <EOL> fun `config with nested object` ( )

{ <EOL> val obj = deserializeConfig ( "<STR_LIT>" , NestedObj . serializer ( ) ) <EOL> assertEquals ( listOf ( <NUM_LIT:42> , <NUM_LIT> , <NUM_LIT> ) . map { Simple ( it ) } , obj . x ) <EOL> }


{ <EOL> val obj = deserializeConfig ( "<STR_LIT>" , ConfWithMap . serializer ( ) ) <EOL> assertEquals ( mapOf ( "<STR_LIT:a>" to <NUM_LIT:42> , "<STR_LIT:b>" to <NUM_LIT> , "<STR_LIT:c>" to <NUM_LIT> ) , obj . x ) <EOL> }


{ <EOL> contract { <EOL> callsInPlace ( lambda , InvocationKind . EXACTLY_ONCE ) <EOL> } <EOL> lambda ( ) <EOL> }


{ <EOL> val list : List < Int > <EOL> block { <EOL> list = listOf ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) <EOL> } <EOL> block { <EOL> if ( listOf ( <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> ) . first { list . contains ( it ) } != <NUM_LIT:2> ) throw AssertionError ( "<STR_LIT:Fail>" ) <EOL> } <EOL> return "<STR_LIT:OK>" <EOL> }


@ Test <EOL> fun `test jvm withJava creates corresponding java source sets eagerly` ( )

= buildProjectWithMPP ( ) . runLifecycleAwareTest { <EOL> assertNull ( javaSourceSets . findByName ( "<STR_LIT:main>" ) ) <EOL> multiplatformExtension . jvm ( ) <EOL> assertNull ( javaSourceSets . findByName ( "<STR_LIT:main>" ) , "<STR_LIT>" ) <EOL> multiplatformExtension . jvm ( ) . withJava ( ) <EOL> assertNotNull ( javaSourceSets . findByName ( "<STR_LIT:main>" ) , "<STR_LIT>" ) <EOL> assertNotNull ( javaSourceSets . findByName ( "<STR_LIT:test>" ) , "<STR_LIT>" ) <EOL> multiplatformExtension . jvm ( ) . compilations . create ( "<STR_LIT>" ) <EOL> assertNotNull ( javaSourceSets . findByName ( "<STR_LIT>" ) , "<STR_LIT>" ) <EOL> }


= ST ( )


{ <EOL> val x : ST = ++ topLevel <EOL> }


{ <EOL> other . foo = "<STR_LIT:OK>" <EOL> }


{ <EOL> val b = B ( ) <EOL> b . setOK ( b ) <EOL> return b . foo <EOL> }


override fun < R , D > acceptChildren ( visitor : FirVisitor < R , D > , data : D )

{ <EOL> annotations . forEach { it . accept ( visitor , data ) } <EOL> }


override fun < D > transformChildren ( transformer : FirTransformer < D > , data : D ) : FirLiteralExpressionImpl < T >

{ <EOL> transformAnnotations ( transformer , data ) <EOL> return this <EOL> }


override fun < D > transformAnnotations ( transformer : FirTransformer < D > , data : D ) : FirLiteralExpressionImpl < T >

{ <EOL> annotations . transformInplace ( transformer , data ) <EOL> return this <EOL> }


override fun replaceConeTypeOrNull ( newConeTypeOrNull : ConeKotlinType ? )

{ <EOL> coneTypeOrNull = newConeTypeOrNull <EOL> }


override fun replaceAnnotations ( newAnnotations : List < FirAnnotation > )

{ <EOL> annotations = newAnnotations . toMutableOrEmpty ( ) <EOL> }


override fun replaceKind ( newKind : ConstantValueKind < T > )

{ <EOL> kind = newKind <EOL> }


= <EOL> bar ( ) + a


fun bar ( ) : String


= <EOL> a + "<STR_LIT:K>"


suspend fun test ( a : String ) : String

= <EOL> super < IFoo > . foo ( suspendK ( a ) )


= "<STR_LIT:O>"


{ <EOL> c . startCoroutine ( EmptyContinuation ) <EOL> }


{ <EOL> var result = "<STR_LIT:FAIL>" <EOL> builder { <EOL> result = FooImpl ( ) . test ( "<STR_LIT>" ) <EOL> } <EOL> return result <EOL> }


fun sequenceFromFunctionWithInitialValue ( )

{ <EOL> val values = generateSequence ( <NUM_LIT:3> ) { n -> if ( n > <NUM_LIT:0> ) n - <NUM_LIT:1> else null } <EOL> assertEquals ( arrayListOf ( <NUM_LIT:3> , <NUM_LIT:2> , <NUM_LIT:1> , <NUM_LIT:0> ) , values . toList ( ) ) <EOL> }


{ <EOL> sequenceFromFunctionWithInitialValue ( ) <EOL> return "<STR_LIT:OK>" <EOL> }


fun getMemberOwnerKind ( descriptor : DeclarationDescriptor ) : OwnerKind

= when ( descriptor ) { <EOL> is PackageFragmentDescriptor -> PACKAGE <EOL> is ClassDescriptor -> IMPLEMENTATION <EOL> else -> throw AssertionError ( "<STR_LIT>" ) <EOL> }


override fun equals ( other : Any ? ) : Boolean

{ <EOL> if ( this === other ) return true <EOL> if ( other !is Experimentality ) return false <EOL> if ( annotationClassId != other . annotationClassId ) return false <EOL> if ( severity != other . severity ) return false <EOL> if ( message != other . message ) return false <EOL> return true <EOL> }


{ <EOL> var result = annotationClassId . hashCode ( ) <EOL> result = <NUM_LIT:31> * result + severity . hashCode ( ) <EOL> result = <NUM_LIT:31> * result + ( message ? . hashCode ( ) ? : <NUM_LIT:0> ) <EOL> return result <EOL> }


fun FirRegularClassSymbol . loadExperimentalityForMarkerAnnotation ( session : FirSession , annotatedOwnerClassName : String ? = null ) : Experimentality ?

{ <EOL> lazyResolveToPhase ( FirResolvePhase . BODY_RESOLVE ) <EOL> @ OptIn ( SymbolInternals :: class ) <EOL> return fir . loadExperimentalityForMarkerAnnotation ( session , annotatedOwnerClassName ) <EOL> }


fun FirBasedSymbol < * > . loadExperimentalitiesFromAnnotationTo ( session : FirSession , result : MutableCollection < Experimentality > )

{ <EOL> lazyResolveToPhase ( FirResolvePhase . STATUS ) <EOL> @ OptIn ( SymbolInternals :: class ) <EOL> fir . loadExperimentalitiesFromAnnotationTo ( session , result , fromSupertype = false ) <EOL> }


private fun FirDeclaration . loadExperimentalitiesFromAnnotationTo ( session : FirSession , result : MutableCollection < Experimentality > , fromSupertype : Boolean )

{ <EOL> for ( annotation in annotations ) { <EOL> val annotationType = annotation . annotationTypeRef . coneTypeSafe < ConeClassLikeType > ( ) ? : continue <EOL> val className = when ( this ) { <EOL> is FirRegularClass -> name . asString ( ) <EOL> is FirCallableDeclaration -> symbol . callableId . className ? . shortName ( ) ? . asString ( ) <EOL> else -> null <EOL> } <EOL> result . addIfNotNull ( annotationType . lookupTag . toFirRegularClassSymbol ( session ) ? . loadExperimentalityForMarkerAnnotation ( session , className ) ) <EOL> if ( fromSupertype ) { <EOL> if ( annotationType . lookupTag . classId == OptInNames . SUBCLASS_OPT_IN_REQUIRED_CLASS_ID ) { <EOL> val annotationClass = annotation . findArgumentByName ( OptInNames . OPT_IN_ANNOTATION_CLASS ) ? : continue <EOL> result . addIfNotNull ( annotationClass . extractClassFromArgument ( session ) ? . loadExperimentalityForMarkerAnnotation ( session ) ? . copy ( fromSupertype = true ) ) <EOL> } <EOL> } <EOL> } <EOL> }


fun loadExperimentalitiesFromTypeArguments ( context : CheckerContext , typeArguments : List < FirTypeProjection > ) : Set < Experimentality >

{ <EOL> if ( typeArguments . isEmpty ( ) ) return emptySet ( ) <EOL> return loadExperimentalitiesFromConeArguments ( context , typeArguments . map { it . toConeTypeProjection ( ) } ) <EOL> }


fun loadExperimentalitiesFromConeArguments ( context : CheckerContext , typeArguments : List < ConeTypeProjection > ) : Set < Experimentality >

{ <EOL> if ( typeArguments . isEmpty ( ) ) return emptySet ( ) <EOL> val result = SmartSet . create < Experimentality > ( ) <EOL> typeArguments . forEach { <EOL> if ( ! it . isStarProjection ) it . type ? . addExperimentalities ( context , result ) <EOL> } <EOL> return result <EOL> }


fun FirBasedSymbol < * > . loadExperimentalities ( context : CheckerContext , fromSetter : Boolean , dispatchReceiverType : ConeKotlinType ? <EOL> ) : Set < Experimentality >

= loadExperimentalities ( context , knownExperimentalities = null , visited = mutableSetOf ( ) , fromSetter , dispatchReceiverType , fromSupertype = false )


fun FirClassLikeSymbol < * > . loadExperimentalitiesFromSupertype ( context : CheckerContext ) : Set < Experimentality >

= loadExperimentalities ( context , knownExperimentalities = null , visited = mutableSetOf ( ) , fromSetter = false , dispatchReceiverType = null , fromSupertype = true )


fun FirClassLikeSymbol < * > . isExperimentalMarker ( session : FirSession )

= <EOL> this is FirRegularClassSymbol && getAnnotationByClassId ( OptInNames . REQUIRES_OPT_IN_CLASS_ID , session ) != null


@ OptIn ( SymbolInternals :: class ) <EOL> private fun FirBasedSymbol < * > . loadExperimentalities ( context : CheckerContext , knownExperimentalities : SmartSet < Experimentality > ? , visited : MutableSet < FirDeclaration > , fromSetter : Boolean , dispatchReceiverType : ConeKotlinType ? , fromSupertype : Boolean , ) : Set < Experimentality >

{ <EOL> lazyResolveToPhase ( FirResolvePhase . STATUS ) <EOL> val fir = this . fir <EOL> if ( ! visited . add ( fir ) ) return emptySet ( ) <EOL> val result = knownExperimentalities ? : SmartSet . create ( ) <EOL> val session = context . session <EOL> when ( fir ) { <EOL> is FirCallableDeclaration -> <EOL> fir . loadCallableSpecificExperimentalities ( this , context , visited , fromSetter , dispatchReceiverType , result ) <EOL> is FirClassLikeDeclaration -> <EOL> fir . loadClassLikeSpecificExperimentalities ( this , context , visited , result ) <EOL> is FirAnonymousInitializer , is FirDanglingModifierList , is FirFile , is FirTypeParameter , is FirScript , is FirCodeFragment -> { } <EOL> } <EOL> lazyResolveToPhase ( FirResolvePhase . ANNOTATION_ARGUMENTS ) <EOL> fir . loadExperimentalitiesFromAnnotationTo ( session , result , fromSupertype ) <EOL> if ( fir . getAnnotationByClassId ( OptInNames . WAS_EXPERIMENTAL_CLASS_ID , session ) != null ) { <EOL> val accessibility = fir . checkSinceKotlinVersionAccessibility ( context ) <EOL> if ( accessibility is FirSinceKotlinAccessibility . NotAccessibleButWasExperimental ) { <EOL> accessibility . markerClasses . forEach { <EOL> it . lazyResolveToPhase ( FirResolvePhase . STATUS ) <EOL> result . addIfNotNull ( it . fir . loadExperimentalityForMarkerAnnotation ( session ) ) <EOL> } <EOL> } <EOL> } <EOL> return result <EOL> }