override fun getParent ( node : LighterASTNode ) : LighterASTNode ?

= <EOL> unwrap ( node ) . psi . parent ? . node ? . let { TreeBackedLighterAST . wrap ( it ) }


override fun getChildren ( node : LighterASTNode , nodesRef : Ref < Array < LighterASTNode > > ) : Int

{ <EOL> val psi = unwrap ( node ) . psi <EOL> val children = mutableListOf < PsiElement > ( ) <EOL> var child = psi . firstChild <EOL> while ( child != null ) { <EOL> children += child <EOL> child = child . nextSibling <EOL> } <EOL> if ( children . isEmpty ( ) ) { <EOL> nodesRef . set ( LighterASTNode . EMPTY_ARRAY ) <EOL> } else { <EOL> nodesRef . set ( children . map { TreeBackedLighterAST . wrap ( it . node ) } . toTypedArray ( ) ) <EOL> } <EOL> return children . size <EOL> }


override fun disposeChildren ( p0 : Array < out LighterASTNode > ? , p1 : Int )

{ <EOL> }


override fun getStartOffset ( node : LighterASTNode ) : Int

{ <EOL> return getStartOffset ( unwrap ( node ) . psi ) <EOL> }


private fun getStartOffset ( element : PsiElement ) : Int

{ <EOL> var child = element . firstChild <EOL> if ( child != null ) { <EOL> while ( child is PsiComment || child is PsiWhiteSpace ) { <EOL> child = child . nextSibling <EOL> } <EOL> if ( child != null ) { <EOL> return getStartOffset ( child ) <EOL> } <EOL> } <EOL> return element . textRange . startOffset <EOL> }


override fun getEndOffset ( node : LighterASTNode ) : Int

{ <EOL> return getEndOffset ( unwrap ( node ) . psi ) <EOL> }


private fun getEndOffset ( element : PsiElement ) : Int

{ <EOL> var child = element . lastChild <EOL> if ( child != null ) { <EOL> while ( child is PsiComment || child is PsiWhiteSpace ) { <EOL> child = child . prevSibling <EOL> } <EOL> if ( child != null ) { <EOL> return getEndOffset ( child ) <EOL> } <EOL> } <EOL> return element . textRange . endOffset <EOL> }


override fun equals ( other : Any ? ) : Boolean

{ <EOL> if ( this === other ) return true <EOL> if ( javaClass != other ? . javaClass ) return false <EOL> other as KtPsiSourceElement <EOL> if ( psi != other . psi ) return false <EOL> return true <EOL> }


{ <EOL> return psi . hashCode ( ) <EOL> }


{ <EOL> if ( this === other ) return true <EOL> if ( javaClass != other ? . javaClass ) return false <EOL> if ( ! super . equals ( other ) ) return false <EOL> other as KtFakeSourceElement <EOL> if ( kind != other . kind ) return false <EOL> return true <EOL> }


{ <EOL> var result = super . hashCode ( ) <EOL> result = <NUM_LIT:31> * result + kind . hashCode ( ) <EOL> return result <EOL> }


{ <EOL> if ( this === other ) return true <EOL> if ( other !is KtFakeSourceElementWithOffsets ) return false <EOL> if ( ! super . equals ( other ) ) return false <EOL> if ( kind != other . kind ) return false <EOL> if ( startOffset != other . startOffset ) return false <EOL> return endOffset == other . endOffset <EOL> }


{ <EOL> var result = super . hashCode ( ) <EOL> result = <NUM_LIT:31> * result + kind . hashCode ( ) <EOL> result = <NUM_LIT:31> * result + startOffset <EOL> result = <NUM_LIT:31> * result + endOffset <EOL> return result <EOL> }


fun KtSourceElement . fakeElement ( newKind : KtFakeSourceElementKind , startOffset : Int = - <NUM_LIT:1> , endOffset : Int = - <NUM_LIT:1> , ) : KtSourceElement

{ <EOL> if ( kind == newKind ) return this <EOL> return when ( this ) { <EOL> is KtLightSourceElement -> KtLightSourceElement ( lighterASTNode , if ( startOffset != - <NUM_LIT:1> ) startOffset else this . startOffset , if ( endOffset != - <NUM_LIT:1> ) endOffset else this . endOffset , treeStructure , newKind ) <EOL> is KtPsiSourceElement -> when { <EOL> startOffset != - <NUM_LIT:1> && endOffset != - <NUM_LIT:1> -> KtFakeSourceElementWithOffsets ( psi , newKind , startOffset , endOffset ) <EOL> else -> KtFakeSourceElement ( psi , newKind ) <EOL> } <EOL> } <EOL> }


fun KtSourceElement . realElement ( ) : KtSourceElement

= when ( this ) { <EOL> is KtRealPsiSourceElement -> this <EOL> is KtLightSourceElement -> KtLightSourceElement ( lighterASTNode , startOffset , endOffset , treeStructure , KtRealSourceElementKind ) <EOL> is KtPsiSourceElement -> KtRealPsiSourceElement ( psi ) <EOL> }


fun unwrapToKtPsiSourceElement ( ) : KtPsiSourceElement ?

{ <EOL> if ( treeStructure !is KtPsiSourceElement . WrappedTreeStructure ) return null <EOL> val node = treeStructure . unwrap ( lighterASTNode ) <EOL> return node . psi ? . toKtPsiSourceElement ( kind ) <EOL> }

/**
 * We can create a [KtLightSourceElement] from a [KtPsiSourceElement] by using [KtPsiSourceElement.lighterASTNode];
 * [unwrapToKtPsiSourceElement] allows to get original [KtPsiSourceElement] in such case.
 *
 * If it is `pure` [KtLightSourceElement], i.e, compiler created it in light tree mode, then return [unwrapToKtPsiSourceElement] `null`.
 * Otherwise, return some not-null result.
 */


override fun getElementTextInContextForDebug ( ) : String

{ <EOL> return treeStructure . toString ( lighterASTNode ) . toString ( ) <EOL> }


{ <EOL> if ( this === other ) return true <EOL> if ( javaClass != other ? . javaClass ) return false <EOL> other as KtLightSourceElement <EOL> if ( lighterASTNode != other . lighterASTNode ) return false <EOL> if ( startOffset != other . startOffset ) return false <EOL> if ( endOffset != other . endOffset ) return false <EOL> if ( treeStructure != other . treeStructure ) return false <EOL> if ( kind != other . kind ) return false <EOL> return true <EOL> }


{ <EOL> var result = lighterASTNode . hashCode ( ) <EOL> result = <NUM_LIT:31> * result + startOffset <EOL> result = <NUM_LIT:31> * result + endOffset <EOL> result = <NUM_LIT:31> * result + treeStructure . hashCode ( ) <EOL> result = <NUM_LIT:31> * result + kind . hashCode ( ) <EOL> return result <EOL> }


@ Suppress ( "<STR_LIT:NOTHING_TO_INLINE>" ) <EOL> inline fun PsiElement . toKtPsiSourceElement ( kind : KtSourceElementKind = KtRealSourceElementKind ) : KtPsiSourceElement

= when ( kind ) { <EOL> is KtRealSourceElementKind -> KtRealPsiSourceElement ( this ) <EOL> is KtFakeSourceElementKind -> KtFakeSourceElement ( this , kind ) <EOL> }


@ Suppress ( "<STR_LIT:NOTHING_TO_INLINE>" ) <EOL> inline fun LighterASTNode . toKtLightSourceElement ( tree : FlyweightCapableTreeStructure < LighterASTNode > , kind : KtSourceElementKind = KtRealSourceElementKind , startOffset : Int = this . startOffset , endOffset : Int = this . endOffset , ) : KtLightSourceElement

= KtLightSourceElement ( this , startOffset , endOffset , tree , kind )


fun sourceKindForIncOrDec ( operation : Name , isPrefix : Boolean )

= when ( operation ) { <EOL> OperatorNameConventions . INC -> if ( isPrefix ) { <EOL> KtFakeSourceElementKind . DesugaredPrefixInc <EOL> } else { <EOL> KtFakeSourceElementKind . DesugaredPostfixInc <EOL> } <EOL> OperatorNameConventions . DEC -> if ( isPrefix ) { <EOL> KtFakeSourceElementKind . DesugaredPrefixDec <EOL> } else { <EOL> KtFakeSourceElementKind . DesugaredPostfixDec <EOL> } <EOL> else -> error ( "<STR_LIT>" ) <EOL> }


@ KotlinxBenchmarkPluginInternalApi <EOL> fun Project . createJvmBenchmarkCompileTask ( target : JvmBenchmarkTarget , compileClasspath : FileCollection )

{ <EOL> val benchmarkBuildDir = benchmarkBuildDir ( target ) <EOL> val compileTask = task < JavaCompile > ( "<STR_LIT>" , depends = BenchmarksPlugin . ASSEMBLE_BENCHMARKS_TASKNAME ) { <EOL> group = BenchmarksPlugin . BENCHMARKS_TASK_GROUP <EOL> description = "<STR_LIT>" <EOL> dependsOn ( "<STR_LIT>" ) <EOL> classpath = compileClasspath <EOL> source = fileTree ( "<STR_LIT>" ) <EOL> destinationDirectory . set ( file ( "<STR_LIT>" ) ) <EOL> javaCompiler . set ( javaCompilerProvider ( ) ) <EOL> } <EOL> task < Jar > ( "<STR_LIT>" , depends = BenchmarksPlugin . ASSEMBLE_BENCHMARKS_TASKNAME ) { <EOL> group = BenchmarksPlugin . BENCHMARKS_TASK_GROUP <EOL> description = "<STR_LIT>" <EOL> isZip64 = true <EOL> dependsOn ( "<STR_LIT>" ) <EOL> archiveClassifier . set ( "<STR_LIT>" ) <EOL> manifest . attributes [ "<STR_LIT>" ] = "<STR_LIT>" <EOL> duplicatesStrategy = DuplicatesStrategy . WARN <EOL> from ( project . provider { <EOL> compileClasspath . map { <EOL> when { <EOL> it . isDirectory -> it <EOL> it . exists ( ) -> zipTree ( it ) . let { tree -> <EOL> if ( it . name . startsWith ( "<STR_LIT>" ) ) { <EOL> tree . filter { file -> <EOL> ! ( file . toString ( ) . contains ( "<STR_LIT>" ) && file . name in listOf ( "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> } <EOL> } else { <EOL> tree <EOL> } <EOL> } <EOL> else -> files ( ) <EOL> } <EOL> } <EOL> } ) <EOL> from ( compileTask ) <EOL> from ( file ( "<STR_LIT>" ) ) <EOL> destinationDirectory . set ( File ( "<STR_LIT>" ) ) <EOL> archiveBaseName . set ( "<STR_LIT>" ) <EOL> } <EOL> }


@ KotlinxBenchmarkPluginInternalApi <EOL> fun Project . createJmhGenerationRuntimeConfiguration ( name : String , jmhVersion : String ) : Configuration

{ <EOL> return configurations . create ( "<STR_LIT>" ) . apply { <EOL> isVisible = false <EOL> description = "<STR_LIT>" <EOL> val dependencies = this@createJmhGenerationRuntimeConfiguration . dependencies <EOL> ( defaultDependencies { <EOL> it . add ( dependencies . create ( "<STR_LIT>" ) ) <EOL> } ) <EOL> } <EOL> }


@ KotlinxBenchmarkPluginInternalApi <EOL> fun Project . createJvmBenchmarkGenerateSourceTask ( target : BenchmarkTarget , workerClasspath : FileCollection , compileClasspath : FileCollection , compilationTask : String , compilationOutput : FileCollection )

{ <EOL> val benchmarkBuildDir = benchmarkBuildDir ( target ) <EOL> task < JmhBytecodeGeneratorTask > ( "<STR_LIT>" ) { <EOL> group = BenchmarksPlugin . BENCHMARKS_TASK_GROUP <EOL> description = "<STR_LIT>" <EOL> dependsOn ( compilationTask ) <EOL> runtimeClasspath = workerClasspath <EOL> inputCompileClasspath = compileClasspath <EOL> inputClassesDirs = compilationOutput <EOL> outputResourcesDir = file ( "<STR_LIT>" ) <EOL> outputSourcesDir = file ( "<STR_LIT>" ) <EOL> executableProvider = javaLauncherProvider ( ) . map { <EOL> it . executablePath . asFile . absolutePath <EOL> } <EOL> } <EOL> }


@ KotlinxBenchmarkPluginInternalApi <EOL> fun Project . createJvmBenchmarkExecTask ( config : BenchmarkConfiguration , target : JvmBenchmarkTarget , runtimeClasspath : FileCollection )

{ <EOL> task < JavaExec > ( "<STR_LIT>" , depends = config . prefixName ( BenchmarksPlugin . RUN_BENCHMARKS_TASKNAME ) ) { <EOL> group = BenchmarksPlugin . BENCHMARKS_TASK_GROUP <EOL> description = "<STR_LIT>" <EOL> val benchmarkBuildDir = benchmarkBuildDir ( target ) <EOL> mainClass . set ( "<STR_LIT>" ) <EOL> if ( target . workingDir != null ) <EOL> workingDir = File ( target . workingDir ) <EOL> classpath ( file ( "<STR_LIT>" ) , file ( "<STR_LIT>" ) , runtimeClasspath ) <EOL> dependsOn ( "<STR_LIT>" ) <EOL> val reportFile = setupReporting ( target , config ) <EOL> args ( writeParameters ( target . name , reportFile , traceFormat ( ) , config ) ) <EOL> javaLauncher . set ( javaLauncherProvider ( ) ) <EOL> } <EOL> }


@ Deprecated ( "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) <EOL> fun DeclarationDescriptor . findPackage ( ) : PackageFragmentDescriptor

= findPackage ( )


private fun sourceByIndex ( descriptor : CallableMemberDescriptor , index : Int ) : SourceFile

{ <EOL> val fragment = descriptor . findPackage ( ) as KlibMetadataDeserializedPackageFragment <EOL> val fileName = fragment . proto . strings . stringList [ index ] <EOL> return DeserializedSourceFile ( fileName , descriptor . module . kotlinLibrary ) <EOL> }


fun CallableMemberDescriptor . findSourceFile ( ) : SourceFile

{ <EOL> val source = this . source . containingFile <EOL> if ( source != SourceFile . NO_SOURCE_FILE ) <EOL> return source <EOL> return when { <EOL> this is DeserializedSimpleFunctionDescriptor && proto . hasExtension ( KlibMetadataProtoBuf . functionFile ) -> <EOL> sourceByIndex ( this , proto . getExtension ( KlibMetadataProtoBuf . functionFile ) ) <EOL> this is DeserializedPropertyDescriptor && proto . hasExtension ( KlibMetadataProtoBuf . propertyFile ) -> <EOL> sourceByIndex ( this , proto . getExtension ( KlibMetadataProtoBuf . propertyFile ) ) <EOL> else -> TODO ( ) <EOL> } <EOL> }


fun DeclarationDescriptor . extractSerializedKdocString ( ) : String ?

= when ( this ) { <EOL> is DeserializedClassDescriptor -> classProto . getExtension ( KlibMetadataProtoBuf . classKdoc ) <EOL> is DeserializedSimpleFunctionDescriptor -> proto . getExtension ( KlibMetadataProtoBuf . functionKdoc ) <EOL> is DeserializedPropertyDescriptor -> proto . getExtension ( KlibMetadataProtoBuf . propertyKdoc ) <EOL> is DeserializedClassConstructorDescriptor -> proto . getExtension ( KlibMetadataProtoBuf . constructorKdoc ) <EOL> else -> null <EOL> }


inline fun foo ( x : String , block : ( String ) -> String )

= block ( x )


{ <EOL> fun bar ( y : String ) = y + "<STR_LIT>" <EOL> val res = foo ( "<STR_LIT:abc>" ) { bar ( it ) } <EOL> assertEquals ( "<STR_LIT>" , res ) <EOL> return "<STR_LIT:OK>" <EOL> }


{ <EOL> foo ( object { } ) ; <EOL> }


fun toIr ( context : CommonBackendContext , startOffset : Int , endOffset : Int , value : IrExpression ) : IrExpression


override fun toIr ( context : CommonBackendContext , startOffset : Int , endOffset : Int , value : IrExpression ) <EOL>

= <EOL> IrReturnImpl ( startOffset , endOffset , context . irBuiltIns . nothingType , target , value )


= IrCompositeImpl ( startOffset , endOffset , context . irBuiltIns . unitType , null , statements = listOf ( value , IrBreakImpl ( startOffset , endOffset , context . irBuiltIns . nothingType , loop ) ) )


= IrCompositeImpl ( startOffset , endOffset , context . irBuiltIns . unitType , null , statements = listOf ( value , IrContinueImpl ( startOffset , endOffset , context . irBuiltIns . nothingType , loop ) ) )


private inline fun < S : Scope , R > using ( scope : S , block : ( S ) -> R ) : R

{ <EOL> otherScopeStack . push ( scope ) <EOL> try { <EOL> return block ( scope ) <EOL> } finally { <EOL> otherScopeStack . pop ( ) <EOL> } <EOL> }


{ <EOL> irFile . transformChildrenVoid ( this ) <EOL> }


override fun visitFunctionNew ( declaration : IrFunction ) : IrStatement

{ <EOL> using ( ReturnableScope ( declaration . symbol ) ) { <EOL> return super . visitFunctionNew ( declaration ) <EOL> } <EOL> }


override fun visitContainerExpression ( expression : IrContainerExpression ) : IrExpression

{ <EOL> if ( expression !is IrReturnableBlockImpl ) <EOL> return super . visitContainerExpression ( expression ) <EOL> using ( ReturnableScope ( expression . symbol ) ) { <EOL> return super . visitContainerExpression ( expression ) <EOL> } <EOL> }


override fun visitLoop ( loop : IrLoop ) : IrExpression

{ <EOL> using ( LoopScope ( loop ) ) { <EOL> return super . visitLoop ( loop ) <EOL> } <EOL> }


override fun visitBreak ( jump : IrBreak ) : IrExpression

{ <EOL> val startOffset = jump . startOffset <EOL> val endOffset = jump . endOffset <EOL> val irBuilder = context . createIrBuilder ( currentScope ! ! . scope . scopeOwnerSymbol , startOffset , endOffset ) <EOL> return performHighLevelJump ( targetScopePredicate = { it is LoopScope && it . loop == jump . loop } , jump = Break ( jump . loop ) , startOffset = startOffset , endOffset = endOffset , value = irBuilder . irGetObject ( context . irBuiltIns . unitClass ) ) ? : jump <EOL> }


override fun visitContinue ( jump : IrContinue ) : IrExpression

{ <EOL> val startOffset = jump . startOffset <EOL> val endOffset = jump . endOffset <EOL> val irBuilder = context . createIrBuilder ( currentScope ! ! . scope . scopeOwnerSymbol , startOffset , endOffset ) <EOL> return performHighLevelJump ( targetScopePredicate = { it is LoopScope && it . loop == jump . loop } , jump = Continue ( jump . loop ) , startOffset = startOffset , endOffset = endOffset , value = irBuilder . irGetObject ( context . irBuiltIns . unitClass ) ) ? : jump <EOL> }


override fun visitReturn ( expression : IrReturn ) : IrExpression

{ <EOL> expression . transformChildrenVoid ( this ) <EOL> return performHighLevelJump ( targetScopePredicate = { it is ReturnableScope && it . symbol == expression . returnTargetSymbol } , jump = Return ( expression . returnTargetSymbol ) , startOffset = expression . startOffset , endOffset = expression . endOffset , value = expression . value ) ? : expression <EOL> }


private fun performHighLevelJump ( targetScopePredicate : ( Scope ) -> Boolean , jump : HighLevelJump , startOffset : Int , endOffset : Int , value : IrExpression ) : IrExpression ?

{ <EOL> val tryScopes = otherScopeStack . reversed ( ) <EOL> . takeWhile { ! targetScopePredicate ( it ) } <EOL> . filterIsInstance < TryScope > ( ) <EOL> . toList ( ) <EOL> if ( tryScopes . isEmpty ( ) ) <EOL> return null <EOL> return performHighLevelJump ( tryScopes , <NUM_LIT:0> , jump , startOffset , endOffset , value ) <EOL> }


private fun performHighLevelJump ( tryScopes : List < TryScope > , index : Int , jump : HighLevelJump , startOffset : Int , endOffset : Int , value : IrExpression ) : IrExpression

{ <EOL> if ( index == tryScopes . size ) <EOL> return jump . toIr ( context , startOffset , endOffset , value ) <EOL> val currentTryScope = tryScopes [ index ] <EOL> currentTryScope . jumps . getOrPut ( jump ) { <EOL> val type = ( jump as? Return ) ? . target ? . owner ? . returnType ( context ) ? : value . type <EOL> jump . toString ( ) <EOL> val symbol = IrReturnableBlockSymbolImpl ( ) <EOL> with ( currentTryScope ) { <EOL> irBuilder . run { <EOL> val inlinedFinally = irInlineFinally ( symbol , type , expression , finallyExpression ) <EOL> expression = performHighLevelJump ( tryScopes = tryScopes , index = index + <NUM_LIT:1> , jump = jump , startOffset = startOffset , endOffset = endOffset , value = inlinedFinally ) <EOL> } <EOL> } <EOL> symbol <EOL> } . let { <EOL> return IrReturnImpl ( startOffset = startOffset , endOffset = endOffset , type = context . irBuiltIns . nothingType , returnTargetSymbol = it , value = value ) <EOL> } <EOL> }


override fun visitTry ( aTry : IrTry ) : IrExpression

{ <EOL> val finallyExpression = aTry . finallyExpression <EOL> ? : return super . visitTry ( aTry ) <EOL> val startOffset = aTry . startOffset <EOL> val endOffset = aTry . endOffset <EOL> val irBuilder = context . createIrBuilder ( currentScope ! ! . scope . scopeOwnerSymbol , startOffset , endOffset ) <EOL> val transformer = this <EOL> irBuilder . run { <EOL> val transformedFinallyExpression = finallyExpression . transform ( transformer , null ) <EOL> val catchParameter = buildVariable ( scope . getLocalDeclarationParent ( ) , startOffset , endOffset , IrDeclarationOrigin . CATCH_PARAMETER , Name . identifier ( "<STR_LIT>" ) , throwableType ) <EOL> val syntheticTry = IrTryImpl ( startOffset = startOffset , endOffset = endOffset , type = context . irBuiltIns . nothingType ) . apply { <EOL> this . catches += irCatch ( catchParameter , irComposite { <EOL> + copy ( finallyExpression ) <EOL> + irThrow ( irGet ( catchParameter ) ) <EOL> } ) <EOL> this . finallyExpression = null <EOL> } <EOL> using ( TryScope ( syntheticTry , transformedFinallyExpression , this ) ) { <EOL> val fallThroughType = aTry . type <EOL> val fallThroughSymbol = IrReturnableBlockSymbolImpl ( ) <EOL> val transformedResult = aTry . tryResult . transform ( transformer , null ) <EOL> val returnedResult = irReturn ( fallThroughSymbol , transformedResult ) <EOL> if ( aTry . catches . isNotEmpty ( ) ) { <EOL> val transformedTry = IrTryImpl ( startOffset = startOffset , endOffset = endOffset , type = context . irBuiltIns . nothingType ) <EOL> transformedTry . tryResult = returnedResult <EOL> for ( aCatch in aTry . catches ) { <EOL> val transformedCatch = aCatch . transform ( transformer , null ) <EOL> transformedCatch . result = irReturn ( fallThroughSymbol , transformedCatch . result ) <EOL> transformedTry . catches . add ( transformedCatch ) <EOL> } <EOL> syntheticTry . tryResult = transformedTry <EOL> } else { <EOL> syntheticTry . tryResult = returnedResult <EOL> } <EOL> return irInlineFinally ( fallThroughSymbol , fallThroughType , it . expression , it . finallyExpression ) <EOL> } <EOL> } <EOL> }


private fun IrBuilderWithScope . irInlineFinally ( symbol : IrReturnableBlockSymbol , type : IrType , value : IrExpression , finallyExpression : IrExpression ) : IrExpression

{ <EOL> return when { <EOL> type . isUnit ( ) || type . isNothing ( ) -> irBlock ( value , null , type ) { <EOL> + irReturnableBlock ( symbol , type ) { <EOL> + value <EOL> } <EOL> + irComposite ( resultType = context . irBuiltIns . unitType , origin = FINALLY_EXPRESSION ) { <EOL> + copy ( finallyExpression ) <EOL> } <EOL> } <EOL> else -> irBlock ( value , null , type ) { <EOL> val tmp = createTmpVariable ( irReturnableBlock ( symbol , type ) { <EOL> + irReturn ( symbol , value ) <EOL> } ) <EOL> + irComposite ( resultType = context . irBuiltIns . unitType , origin = FINALLY_EXPRESSION ) { <EOL> + copy ( finallyExpression ) <EOL> } <EOL> + irGet ( tmp ) <EOL> } <EOL> } <EOL> }


private inline fun < reified T : IrElement > IrBuilderWithScope . copy ( element : T )

= <EOL> element . deepCopyWithSymbols ( parent )


fun IrBuilderWithScope . irReturn ( target : IrReturnTargetSymbol , value : IrExpression )


private inline fun IrBuilderWithScope . irReturnableBlock ( symbol : IrReturnableBlockSymbol , type : IrType , body : IrBlockBuilder . ( ) -> Unit )

= <EOL> IrReturnableBlockImpl ( startOffset , endOffset , type , symbol , null , IrBlockBuilder ( context , scope , startOffset , endOffset , null , type , true ) . block ( body ) . statements )


fun foo ( ) : String


= "<STR_LIT:OK>"


= C ( ) . foo ( )


private fun < T > doTest ( inputs : List < dynamic > , expected : T , serializer : KSerializer < T > )

{ <EOL> for ( input in inputs ) { <EOL> assertEquals ( expected , json . decodeFromDynamic ( serializer , input ) , "<STR_LIT>" ) <EOL> } <EOL> }


@ Test <EOL> fun testUseDefaultOnNonNullableBooleanDynamic ( )

= doTest ( listOf ( js ( """<STR_LIT>""" ) , js ( """<STR_LIT>""" ) , js ( """<STR_LIT>""" ) , ) , JsonCoerceInputValuesTest . WithBoolean ( ) , JsonCoerceInputValuesTest . WithBoolean . serializer ( ) )


@ Test <EOL> fun testUseDefaultOnUnknownEnum ( )

{ <EOL> doTest ( listOf ( js ( """<STR_LIT>""" ) , js ( """<STR_LIT>""" ) , js ( """<STR_LIT>""" ) , ) , JsonCoerceInputValuesTest . WithEnum ( ) , JsonCoerceInputValuesTest . WithEnum . serializer ( ) ) <EOL> assertFailsWith < SerializationException > { <EOL> json . decodeFromDynamic ( JsonCoerceInputValuesTest . WithEnum . serializer ( ) , js ( """<STR_LIT>""" ) ) <EOL> } <EOL> }


@ Test <EOL> fun testUseDefaultInMultipleCases ( )

{ <EOL> val testData = mapOf < dynamic , JsonCoerceInputValuesTest . MultipleValues > ( Pair ( js ( """<STR_LIT>""" ) , JsonCoerceInputValuesTest . MultipleValues ( StringData ( "<STR_LIT:foo>" ) , foo = "<STR_LIT:bar>" ) ) , Pair ( js ( """<STR_LIT>""" ) , JsonCoerceInputValuesTest . MultipleValues ( StringData ( "<STR_LIT:foo>" ) , IntData ( <NUM_LIT:42> ) , foo = "<STR_LIT:bar>" ) ) , Pair ( js ( """<STR_LIT>""" ) , JsonCoerceInputValuesTest . MultipleValues ( StringData ( "<STR_LIT:foo>" ) , IntData ( <NUM_LIT:42> ) , i = <NUM_LIT:0> , foo = "<STR_LIT:bar>" ) ) , Pair ( js ( """<STR_LIT>""" ) , JsonCoerceInputValuesTest . MultipleValues ( StringData ( "<STR_LIT:foo>" ) , IntData ( <NUM_LIT:42> ) , i = <NUM_LIT:0> , e = SampleEnum . OptionC , foo = "<STR_LIT:bar>" ) ) , ) <EOL> for ( ( input , expected ) in testData ) { <EOL> assertEquals ( expected , json . decodeFromDynamic ( JsonCoerceInputValuesTest . MultipleValues . serializer ( ) , input ) , "<STR_LIT>" ) <EOL> } <EOL> }


override fun lowerInterfaceDeclaration ( declaration : IDLInterfaceDeclaration , owner : IDLFileDeclaration ) : IDLInterfaceDeclaration

{ <EOL> val includedMixins = mixinContext . getIncludedMixins ( declaration ) <EOL> val overrideHelper = OverrideHelper ( missingMemberContext ) <EOL> val newAttributes = declaration . attributes . toMutableList ( ) <EOL> val newOperations = declaration . operations . toMutableList ( ) <EOL> includedMixins . flatMap { it . attributes } . forEach { newAttribute -> <EOL> if ( newAttributes . none { oldAttribute -> <EOL> overrideHelper . isConflicting ( newAttribute , oldAttribute ) || <EOL> overrideHelper . isConflicting ( oldAttribute , newAttribute ) || <EOL> overrideHelper . isSimilar ( newAttribute , oldAttribute ) <EOL> } ) { <EOL> newAttributes += newAttribute <EOL> } <EOL> } <EOL> includedMixins . flatMap { it . operations } . forEach { newOperation -> <EOL> if ( newOperations . none { oldOperation -> <EOL> overrideHelper . isConflicting ( newOperation , oldOperation ) || <EOL> overrideHelper . isConflicting ( oldOperation , newOperation ) || <EOL> overrideHelper . isSimilar ( newOperation , oldOperation ) <EOL> } ) { <EOL> newOperations += newOperation <EOL> } <EOL> } <EOL> return declaration . copy ( attributes = newAttributes , operations = newOperations ) <EOL> }


{ <EOL> if ( declaration . mixin ) { <EOL> mixins [ declaration . name ] = declaration <EOL> } <EOL> return declaration <EOL> }


override fun lowerIncludesStatementDeclaration ( declaration : IDLIncludesStatementDeclaration , owner : IDLFileDeclaration ) : IDLIncludesStatementDeclaration

{ <EOL> if ( includeStatements [ declaration . child . name ] == null ) { <EOL> includeStatements [ declaration . child . name ] = mutableListOf ( ) <EOL> } <EOL> includeStatements [ declaration . child . name ] ! ! . add ( declaration . parent . name ) <EOL> return declaration <EOL> }


fun getIncludedMixins ( declaration : IDLInterfaceDeclaration ) : List < IDLInterfaceDeclaration >

{ <EOL> return includeStatements [ declaration . name ] . orEmpty ( ) . mapNotNull { mixins [ it ] } <EOL> }


fun IDLSourceSetDeclaration . resolveMixins ( ) : IDLSourceSetDeclaration

{ <EOL> val mixinContext = MixinContext ( ) <EOL> val missingMemberContext = MissingMemberContext ( ) <EOL> return MixinResolver ( mixinContext , missingMemberContext ) . lowerSourceSetDeclaration ( mixinContext . lowerSourceSetDeclaration ( missingMemberContext . lowerSourceSetDeclaration ( this ) ) ) <EOL> }


fun build ( spec : DokkaGeneratorParametersSpec , delayTemplateSubstitution : Boolean , modules : List < DokkaModuleDescriptionKxs > , outputDirectory : File , cacheDirectory : File ? = null , ) : DokkaConfiguration

{ <EOL> val moduleName = spec . moduleName . get ( ) <EOL> val moduleVersion = spec . moduleVersion . orNull ? . takeIf { it != "<STR_LIT>" } <EOL> val offlineMode = spec . offlineMode . get ( ) <EOL> val sourceSets = DokkaSourceSetBuilder . buildAll ( spec . dokkaSourceSets ) <EOL> val failOnWarning = spec . failOnWarning . get ( ) <EOL> val suppressObviousFunctions = spec . suppressObviousFunctions . get ( ) <EOL> val suppressInheritedMembers = spec . suppressInheritedMembers . get ( ) <EOL> val finalizeCoroutines = spec . finalizeCoroutines . get ( ) <EOL> val pluginsConfiguration = spec . pluginsConfiguration . toSet ( ) <EOL> val pluginsClasspath = spec . pluginsClasspath . files . toList ( ) <EOL> val includes = spec . includes . files <EOL> return DokkaConfigurationImpl ( moduleName = moduleName , moduleVersion = moduleVersion , outputDir = outputDirectory , cacheRoot = cacheDirectory , offlineMode = offlineMode , sourceSets = sourceSets , pluginsClasspath = pluginsClasspath , pluginsConfiguration = pluginsConfiguration . map ( :: build ) , modules = modules . map ( DokkaModuleDescriptionKxs :: convert ) , failOnWarning = failOnWarning , delayTemplateSubstitution = delayTemplateSubstitution , suppressObviousFunctions = suppressObviousFunctions , includes = includes , suppressInheritedMembers = suppressInheritedMembers , finalizeCoroutines = finalizeCoroutines , ) <EOL> }


private fun build ( spec : DokkaPluginParametersBaseSpec ) : PluginConfigurationImpl

{ <EOL> return PluginConfigurationImpl ( fqPluginName = spec . pluginFqn , serializationFormat = DokkaConfiguration . SerializationFormat . JSON , values = spec . jsonEncode ( ) , ) <EOL> }


override fun render ( notebook : Notebook ) : MimeTypedResult

{ <EOL> return HTML ( toHTML ( ) ) <EOL> }


{ <EOL> return attributes . joinToString ( "<STR_LIT>" , """<STR_LIT>""" , """<STR_LIT>""" ) { <EOL> """<STR_LIT>""" <EOL> } <EOL> }


= Image ( attributes + attr )


fun withAttr ( name : String , value : String , )

= withAttr ( HTMLAttr ( name , value ) )


= withAttr ( "<STR_LIT>" , value )


= withAttr ( "<STR_LIT>" , value . toString ( ) )


private fun BufferedImage . toByteArray ( format : String ) : ByteArray

{ <EOL> val stream = ByteArrayOutputStream ( ) <EOL> ImageIO . write ( this , format , stream ) <EOL> return stream . toByteArray ( ) <EOL> }


fun referSrc ( url : String ) : HTMLAttr

{ <EOL> return HTMLAttr ( "<STR_LIT:src>" , url ) <EOL> }


fun embedSrc ( data : ByteArray , format : String , ) : HTMLAttr

{ <EOL> val encoder = Base64 . getEncoder ( ) <EOL> return HTMLAttr ( "<STR_LIT:src>" , buildString { <EOL> append ( """<STR_LIT>""" ) <EOL> append ( encoder . encodeToString ( data ) ) <EOL> } , ) <EOL> }


fun downloadData ( url : String ) : ByteArray

{ <EOL> PreCannedApacheHttpClients . defaultApacheHttpClient ( ) . use { closeableHttpClient -> <EOL> val client = ApacheClient ( client = closeableHttpClient ) <EOL> val request = Request ( Method . GET , url ) <EOL> val response = client ( request ) <EOL> return response . body . payload . array ( ) <EOL> } <EOL> }


fun loadData ( file : File ) : ByteArray

{ <EOL> return file . readBytes ( ) <EOL> }


{ <EOL> val format = uri . toString ( ) . substringAfterLast ( '<CHAR_LIT:.>' , "<STR_LIT>" ) <EOL> return convertFormat ( format ) <EOL> }


= format . lowercase ( ) . let { formatToMime [ it ] ? : it }


fun < T > hashSetOf ( vararg values : T ) : HashSet < T >

= throw Exception ( "<STR_LIT>" )


fun foo ( b : MyClass < B > , c : MyClass < C > )

{ <EOL> val set1 : Set < MyClass < out D > > = hashSetOf ( b , c ) <EOL> val set2 = hashSetOf ( b , c ) <EOL> }


override fun call ( builder : CallExpressionBuilder ) : IrExpression

{ <EOL> val irTmp = generator . scope . createTemporaryVariable ( extensionInvokeReceiver . load ( ) , "<STR_LIT>" ) <EOL> val safeReceiverValue = VariableLValue ( generator . context , irTmp ) <EOL> assert ( callBuilder . irValueArgumentsByIndex [ <NUM_LIT:0> ] == null ) { <EOL> "<STR_LIT>" <EOL> } <EOL> callBuilder . irValueArgumentsByIndex [ <NUM_LIT:0> ] = safeReceiverValue . load ( ) <EOL> val irResult = builder . withReceivers ( functionReceiver , null , emptyList ( ) ) <EOL> val resultType = irResult . type . makeNullable ( ) <EOL> return generator . irBlock ( startOffset , endOffset , IrStatementOrigin . SAFE_CALL , resultType ) { <EOL> + irTmp <EOL> + irIfNull ( resultType , safeReceiverValue . load ( ) , irNull ( ) , irResult ) <EOL> } <EOL> }


override fun compareTo ( other : ClassOrTypeAliasId )

= qualifiedName . compareTo ( other . qualifiedName )


override fun compareTo ( other : ConstructorId )

= COMPARATOR . compare ( this , other )


override fun compareTo ( other : FunctionId )

= COMPARATOR . compare ( this , other )


override fun compareTo ( other : PropertyId )

= COMPARATOR . compare ( this , other )


override fun compareTo ( other : ParameterId )

= COMPARATOR . compare ( this , other )


override fun compareTo ( other : TypeParameterId )

= index . compareTo ( other . index )


override fun compareTo ( other : TypeId )

= COMPARATOR . compare ( this , other )


final override fun compareTo ( other : TypeArgumentId )

= COMPARATOR . compare ( this , other )


private inline fun < T , R : Comparable < R > > Comparator < T > . thenByList ( crossinline selector : ( T ) -> List < R > , ) : Comparator < T >

= Comparator { left , right -> <EOL> compare ( left , right ) . let { if ( it != <NUM_LIT:0> ) return@Comparator it } <EOL> val leftList = selector ( left ) <EOL> val rightList = selector ( right ) <EOL> leftList . size . compareTo ( rightList . size ) . let { if ( it != <NUM_LIT:0> ) return@Comparator it } <EOL> for ( index in leftList . indices ) { <EOL> leftList [ index ] . compareTo ( rightList [ index ] ) . let { if ( it != <NUM_LIT:0> ) return@Comparator it } <EOL> } <EOL> <NUM_LIT:0> <EOL> }


fun toPath ( file : File ) : String


fun toFile ( path : String ) : File


fun getFileDescriptor ( ) : KeyDescriptor < File >

= FileDescriptor ( this )


override fun toPath ( file : File ) : String

= file . path


override fun toFile ( path : String ) : File

= File ( path )


override fun save ( output : DataOutput , file : File )

{ <EOL> StringExternalizer . save ( output , pathConverter . toPath ( file ) ) <EOL> }


override fun read ( input : DataInput ) : File

{ <EOL> return pathConverter . toFile ( StringExternalizer . read ( input ) ) <EOL> }


override fun getHashCode ( file : File ) : Int

{ <EOL> return pathConverter . toPath ( file ) . hashCode ( ) <EOL> }


override fun isEqual ( file1 : File , file2 : File ) : Boolean

{ <EOL> return file1 == file2 <EOL> }


fun test ( x : ABCD , y : ABCD , ok : String ) : String

= <EOL> when ( x ) { <EOL> ABCD . A , ABCD . B -> <EOL> when ( y ) { <EOL> ABCD . A , ABCD . B -> ok <EOL> ABCD . C , ABCD . D -> y . toString ( ) <EOL> } <EOL> ABCD . C , ABCD . D -> <EOL> x . toString ( ) <EOL> }


= <EOL> test ( ABCD . B , ABCD . A , "<STR_LIT:O>" ) + test ( ABCD . A , ABCD . B , "<STR_LIT:K>" )


@ Test <EOL> fun test_easy_complex_creation ( )

{ <EOL> assertEquals ( Complex . i ( <NUM_LIT> ) , <NUM_LIT> . i ) <EOL> assertEquals ( Complex . i ( <NUM_LIT> ) , <NUM_LIT> . i ) <EOL> assertEquals ( ComplexFloat ( <NUM_LIT:1> , <NUM_LIT:1> ) , <NUM_LIT:1> + <NUM_LIT> . i ) <EOL> assertEquals ( ComplexDouble ( <NUM_LIT:3> , <NUM_LIT:7> ) , <NUM_LIT:3> + <NUM_LIT> . i ) <EOL> }


{ <EOL> log += "<STR_LIT>" <EOL> }


= if ( x < <NUM_LIT:10> ) foo ( ) else <NUM_LIT>


{ <EOL> val a = test ( <NUM_LIT:20> ) <EOL> if ( a !is Int ) return "<STR_LIT>" <EOL> val b = test ( <NUM_LIT:5> ) <EOL> if ( b !is Unit ) return "<STR_LIT>" <EOL> if ( log != "<STR_LIT>" ) return "<STR_LIT>" <EOL> return "<STR_LIT:OK>" <EOL> }


{ <EOL> }


@ JvmName ( "<STR_LIT:main>" ) <EOL> fun foo ( args : Array < String > )

{ <EOL> }


fun supplier ( index : Int , x : DPoint )


= <NUM_LIT:1.0>


= <NUM_LIT:2.0>


= <NUM_LIT:3.0>


= <NUM_LIT>


fun reassignVariable ( x : DPoint , box : Box )

{ <EOL> supplier ( <NUM_LIT:100> ) <EOL> var p = DPoint ( `1` ( ) , `2` ( ) ) <EOL> supplier ( <NUM_LIT> , p ) <EOL> p = p <EOL> supplier ( <NUM_LIT> , p ) <EOL> p = DPoint ( `3` ( ) , `4` ( ) ) <EOL> supplier ( <NUM_LIT> , p ) <EOL> p = x <EOL> supplier ( <NUM_LIT> , p ) <EOL> p = box . value <EOL> supplier ( <NUM_LIT> , p ) <EOL> p = listOf ( p ) [ <NUM_LIT:0> ] <EOL> supplier ( <NUM_LIT> , p ) <EOL> }


fun reassignField ( x : DPoint , box : Box )

{ <EOL> supplier ( <NUM_LIT> ) <EOL> val p = DPoint ( `5` ( ) , `6` ( ) ) <EOL> supplier ( <NUM_LIT> , p ) <EOL> var b = Box ( p ) <EOL> supplier ( <NUM_LIT> ) <EOL> b . value = b . value <EOL> supplier ( <NUM_LIT> ) <EOL> b . value = DPoint ( `7` ( ) , `8` ( ) ) <EOL> supplier ( <NUM_LIT> ) <EOL> b . value = x <EOL> supplier ( <NUM_LIT> ) <EOL> b . value = box . value <EOL> supplier ( <NUM_LIT> ) <EOL> b . value = listOf ( p ) [ <NUM_LIT:0> ] <EOL> supplier ( <NUM_LIT> ) <EOL> }


override fun readWriteAccessWithFullExpressionByResolve ( assignment : KtBinaryExpression ) : Pair < ReferenceAccess , KtExpression > ?

{ <EOL> val function = assignment . operationReference . mainReference . resolve ( ) as? KtNamedFunction ? : return null <EOL> val name = function . name ? : return null <EOL> return if ( Name . identifier ( name ) in OperatorConventions . ASSIGNMENT_OPERATIONS . values ) <EOL> ReferenceAccess . READ to assignment <EOL> else <EOL> null <EOL> }


fun getCompletionProposals ( editor : KotlinEditor ) : Array < ICompletionProposal >

= <EOL> KotlinCompletionProcessor . createKotlinCompletionProcessors ( editor , null , needSorting = true ) . flatMap { <EOL> it . computeCompletionProposals ( editor . javaEditor . viewer , KotlinTestUtils . getCaret ( editor . javaEditor ) ) . toList ( ) <EOL> } . toTypedArray ( )


fun ICompletionProposal . stringToInsert ( ) : String

{ <EOL> return if ( this is KotlinCompletionProposal ) replacementString else additionalProposalInfo ? : displayString <EOL> }


= i + v


= this . i


{ <EOL> val method = Class . forName ( "<STR_LIT:A>" ) . declaredMethods . single { it . name == "<STR_LIT>" } <EOL> val parameters = method . getParameters ( ) <EOL> if ( parameters [ <NUM_LIT:0> ] . name != "<STR_LIT>" ) return "<STR_LIT>" <EOL> if ( parameters [ <NUM_LIT:1> ] . name != "<STR_LIT>" ) return "<STR_LIT>" <EOL> val extensionMethod = Class . forName ( "<STR_LIT>" ) . declaredMethods . single { it . name . startsWith ( "<STR_LIT:bar>" ) } <EOL> val extensionMethodParameters = extensionMethod . getParameters ( ) <EOL> if ( extensionMethodParameters [ <NUM_LIT:0> ] . name != "<STR_LIT>" ) <EOL> return "<STR_LIT>" <EOL> return "<STR_LIT:OK>" <EOL> }


@ JsModule ( "<STR_LIT>" ) <EOL> external fun ping ( a : String )


@ JsModule ( "<STR_LIT>" ) <EOL> external fun ping ( a : Number )


= start + if ( reversed ) - ( -- count ) else ( -- count )


{ <EOL> val r = Range ( ) <EOL> if ( r . next ( ) != <NUM_LIT:9> ) { <EOL> return "<STR_LIT:fail1>" <EOL> } <EOL> if ( r . next ( ) != <NUM_LIT:8> ) { <EOL> return "<STR_LIT:fail2>" <EOL> } <EOL> return "<STR_LIT:OK>" <EOL> }


fun ClassNotAvailableInSwift . doSomethingMeaningless ( another : ClassNotAvailableInSwift ) : ClassNotAvailableInSwift

{ <EOL> return ClassNotAvailableInSwift ( this . param + another . param ) <EOL> }


fun String . doSomethingMeaningless ( another : ClassNotAvailableInSwift ) : ClassNotAvailableInSwift

{ <EOL> return ClassNotAvailableInSwift ( this + another . param ) <EOL> }


fun useOfUnavailableClass ( param : ClassNotAvailableInSwift ) : ClassNotAvailableInSwift

{ <EOL> return ClassNotAvailableInSwift ( "<STR_LIT>" ) <EOL> }


fun useOfNullableUnavailableClass ( param : ClassNotAvailableInSwift ? ) : ClassNotAvailableInSwift ?

{ <EOL> return null <EOL> }


fun produceUnavailable ( ) : ClassNotAvailableInSwift


fun consumeUnavailable ( param : ClassNotAvailableInSwift ) : String

{ <EOL> return param . param <EOL> }


fun f ( ) : String


fun createUnavailableInterface ( ) : InterfaceNotAvailableInSwift

{ <EOL> return object : InterfaceNotAvailableInSwift { <EOL> override fun f ( ) : String = "<STR_LIT>" <EOL> } <EOL> }


fun useOfNullableUnavailableInterface ( param : InterfaceNotAvailableInSwift ? ) : String ?

{ <EOL> return param ? . f ( ) ? : "<STR_LIT:null>" <EOL> }


fun createUnavailableEnum ( ) : UnavailableEnum

{ <EOL> return UnavailableEnum . A <EOL> }


fun useOfUnavailableEnum ( param : UnavailableEnum ) : String

{ <EOL> return param . toString ( ) <EOL> }


fun useOfNullableUnavailableEnum ( param : UnavailableEnum ? ) : String

{ <EOL> return param ? . toString ( ) ? : "<STR_LIT:null>" <EOL> }


fun getUnavailableObject ( ) : UnavailableObject

{ <EOL> return UnavailableObject <EOL> }


fun useOfUnavailableObject ( param : UnavailableObject ) : String

{ <EOL> return param . field <EOL> }


fun useOfNullableUnavailableObject ( param : UnavailableObject ? ) : String ?

{ <EOL> return param ? . field ? : "<STR_LIT:null>" <EOL> }


{ <EOL> return SealedClass . A ( ) <EOL> }


fun useSealedClass ( param : SealedClass ) : String

{ <EOL> return when ( param ) { <EOL> is SealedClass . A -> "<STR_LIT:A>" <EOL> is SealedClass . B -> "<STR_LIT:B>" <EOL> SealedClass . C -> "<STR_LIT:C>" <EOL> } <EOL> }


fun < T : InterfaceNotAvailableInSwift > useUnavailable ( a : T ) : String

{ <EOL> return a . f ( ) <EOL> }


{ <EOL> val src = """<STR_LIT>""" . trimIndent ( ) <EOL> val df = DataFrame . readDelimStr ( src ) <EOL> df . nrow shouldBe <NUM_LIT:2> <EOL> df . ncol shouldBe <NUM_LIT:2> <EOL> df [ "<STR_LIT:first>" ] . type ( ) shouldBe typeOf < Int > ( ) <EOL> df [ "<STR_LIT:second>" ] . allNulls ( ) shouldBe true <EOL> df [ "<STR_LIT:second>" ] . type ( ) shouldBe typeOf < String ? > ( ) <EOL> }


{ <EOL> val df = dataFrameOf ( "<STR_LIT>" , "<STR_LIT>" ) ( <NUM_LIT:1> , null , <NUM_LIT:2> , null ) . convert ( "<STR_LIT>" ) . toStr ( ) <EOL> val str = StringWriter ( ) <EOL> df . writeCSV ( str ) <EOL> val res = DataFrame . readDelimStr ( str . buffer . toString ( ) ) <EOL> res shouldBe df <EOL> }


{ <EOL> val df = DataFrame . read ( simpleCsv ) <EOL> df . ncol shouldBe <NUM_LIT:11> <EOL> df . nrow shouldBe <NUM_LIT:5> <EOL> df . columnNames ( ) [ <NUM_LIT:5> ] shouldBe "<STR_LIT>" <EOL> df . columnNames ( ) [ <NUM_LIT:6> ] shouldBe "<STR_LIT>" <EOL> df [ "<STR_LIT>" ] . type ( ) shouldBe typeOf < String ? > ( ) <EOL> df [ "<STR_LIT>" ] . type ( ) shouldBe typeOf < Double ? > ( ) <EOL> df [ "<STR_LIT>" ] . type ( ) shouldBe typeOf < LocalDateTime > ( ) <EOL> println ( df ) <EOL> }


@ Test <EOL> fun readCsvWithFrenchLocaleAndAlternativeDelimiter ( )

{ <EOL> val df = DataFrame . readCSV ( url = csvWithFrenchLocale , delimiter = '<CHAR_LIT>' , parserOptions = ParserOptions ( locale = Locale . FRENCH ) , ) <EOL> df . ncol shouldBe <NUM_LIT:11> <EOL> df . nrow shouldBe <NUM_LIT:5> <EOL> df . columnNames ( ) [ <NUM_LIT:5> ] shouldBe "<STR_LIT>" <EOL> df . columnNames ( ) [ <NUM_LIT:6> ] shouldBe "<STR_LIT>" <EOL> df [ "<STR_LIT>" ] . type ( ) shouldBe typeOf < String ? > ( ) <EOL> df [ "<STR_LIT>" ] . type ( ) shouldBe typeOf < Double ? > ( ) <EOL> df [ "<STR_LIT>" ] . type ( ) shouldBe typeOf < Double > ( ) <EOL> df [ "<STR_LIT>" ] . type ( ) shouldBe typeOf < LocalDateTime > ( ) <EOL> println ( df ) <EOL> }


{ <EOL> val df = DataFrame . readCSV ( wineCsv , delimiter = '<CHAR_LIT>' ) <EOL> val schema = df . schema ( ) <EOL> fun assertColumnType ( columnName : String , kClass : KClass < * > ) { <EOL> val col = schema . columns [ columnName ] <EOL> col . shouldNotBeNull ( ) <EOL> col . type . classifier shouldBe kClass <EOL> } <EOL> assertColumnType ( "<STR_LIT>" , Double :: class ) <EOL> assertColumnType ( "<STR_LIT>" , Double :: class ) <EOL> assertColumnType ( "<STR_LIT>" , Int :: class ) <EOL> }


@ Test <EOL> fun `read standard CSV with floats when user has alternative locale` ( )

{ <EOL> val currentLocale = Locale . getDefault ( ) <EOL> try { <EOL> Locale . setDefault ( Locale . forLanguageTag ( "<STR_LIT>" ) ) <EOL> val df = DataFrame . readCSV ( wineCsv , delimiter = '<CHAR_LIT>' ) <EOL> val schema = df . schema ( ) <EOL> fun assertColumnType ( columnName : String , kClass : KClass < * > ) { <EOL> val col = schema . columns [ columnName ] <EOL> col . shouldNotBeNull ( ) <EOL> col . type . classifier shouldBe kClass <EOL> } <EOL> assertColumnType ( "<STR_LIT>" , Double :: class ) <EOL> assertColumnType ( "<STR_LIT>" , Double :: class ) <EOL> assertColumnType ( "<STR_LIT>" , Int :: class ) <EOL> } finally { <EOL> Locale . setDefault ( currentLocale ) <EOL> } <EOL> }


@ Test <EOL> fun `read with custom header` ( )

{ <EOL> val header = ( '<CHAR_LIT:A>' .. '<CHAR_LIT>' ) . map { it . toString ( ) } <EOL> val df = DataFrame . readCSV ( simpleCsv , header = header , skipLines = <NUM_LIT:1> ) <EOL> df . columnNames ( ) shouldBe header <EOL> df [ "<STR_LIT:B>" ] . type ( ) shouldBe typeOf < Int > ( ) <EOL> val headerShort = ( '<CHAR_LIT:A>' .. '<CHAR_LIT>' ) . map { it . toString ( ) } <EOL> val dfShort = DataFrame . readCSV ( simpleCsv , header = headerShort , skipLines = <NUM_LIT:1> ) <EOL> dfShort . ncol shouldBe <NUM_LIT:5> <EOL> dfShort . columnNames ( ) shouldBe headerShort <EOL> }


{ <EOL> val expected = <EOL> listOf ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT:name>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , ) <EOL> val dfHeader = DataFrame . readCSV ( simpleCsv , readLines = <NUM_LIT:0> ) <EOL> dfHeader . nrow shouldBe <NUM_LIT:0> <EOL> dfHeader . columnNames ( ) shouldBe expected <EOL> val dfThree = DataFrame . readCSV ( simpleCsv , readLines = <NUM_LIT:3> ) <EOL> dfThree . nrow shouldBe <NUM_LIT:3> <EOL> val dfFull = DataFrame . readCSV ( simpleCsv , readLines = <NUM_LIT:10> ) <EOL> dfFull . nrow shouldBe <NUM_LIT:5> <EOL> }


@ Test <EOL> fun `if string starts with a number, it should be parsed as a string anyway` ( )

{ <EOL> val df = DataFrame . readCSV ( durationCsv ) <EOL> df [ "<STR_LIT>" ] . type ( ) shouldBe typeOf < String > ( ) <EOL> df [ "<STR_LIT>" ] . type ( ) shouldBe typeOf < String > ( ) <EOL> }


@ Test <EOL> fun `if record has fewer columns than header then pad it with nulls` ( )

{ <EOL> val csvContent = """<STR_LIT>""" . trimIndent ( ) <EOL> val df = shouldNotThrowAny { <EOL> DataFrame . readDelimStr ( csvContent ) <EOL> } <EOL> df shouldBe dataFrameOf ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , null ) <EOL> }


@ Test <EOL> fun `write and read frame column` ( )

{ <EOL> val df = dataFrameOf ( "<STR_LIT:a>" , "<STR_LIT:b>" , "<STR_LIT:c>" ) ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:1> , <NUM_LIT:3> , <NUM_LIT:2> , <NUM_LIT:2> , <NUM_LIT:1> , <NUM_LIT:3> ) <EOL> val grouped = df . groupBy ( "<STR_LIT:a>" ) . into ( "<STR_LIT>" ) <EOL> val str = grouped . toCsv ( ) <EOL> val res = DataFrame . readDelimStr ( str ) <EOL> res shouldBe grouped <EOL> }


@ Test <EOL> fun `write and read column group` ( )

{ <EOL> val df = dataFrameOf ( "<STR_LIT:a>" , "<STR_LIT:b>" , "<STR_LIT:c>" ) ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:1> , <NUM_LIT:3> , <NUM_LIT:2> ) <EOL> val grouped = df . group ( "<STR_LIT:b>" , "<STR_LIT:c>" ) . into ( "<STR_LIT:d>" ) <EOL> val str = grouped . toCsv ( ) <EOL> val res = DataFrame . readDelimStr ( str ) <EOL> res shouldBe grouped <EOL> }


@ Test <EOL> fun `CSV String of saved dataframe starts with column name` ( )

{ <EOL> val df = dataFrameOf ( "<STR_LIT:a>" ) ( <NUM_LIT:1> ) <EOL> df . toCsv ( ) . first ( ) shouldBe '<CHAR_LIT:a>' <EOL> }


{ <EOL> val df = DataFrame . read ( testResource ( "<STR_LIT>" ) ) <EOL> df . columnsCount ( ) shouldBe <NUM_LIT:3> <EOL> df . rowsCount ( ) shouldBe <NUM_LIT:2> <EOL> }


@ Test <EOL> fun `write csv without header produce correct file` ( )

{ <EOL> val df = dataFrameOf ( "<STR_LIT:a>" , "<STR_LIT:b>" , "<STR_LIT:c>" ) ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:1> , <NUM_LIT:3> , <NUM_LIT:2> , ) <EOL> df . writeCSV ( "<STR_LIT>" , CSVFormat . DEFAULT . withSkipHeaderRecord ( ) , ) <EOL> val producedFile = File ( "<STR_LIT>" ) <EOL> producedFile . exists ( ) shouldBe true <EOL> producedFile . readText ( ) shouldBe "<STR_LIT>" <EOL> producedFile . delete ( ) <EOL> }


fun getImage ( descriptor : DeclarationDescriptor ) : Image ?

{ <EOL> return when ( descriptor ) { <EOL> is ClassDescriptor , is TypeParameterDescriptor , is TypeAliasDescriptor -> <EOL> getImageFromJavaUI ( ISharedImages . IMG_OBJS_CLASS ) <EOL> is FunctionDescriptor -> getImageFromJavaUI ( ISharedImages . IMG_OBJS_PUBLIC ) <EOL> is VariableDescriptor -> getImageFromJavaUI ( ISharedImages . IMG_FIELD_PUBLIC ) <EOL> is PackageViewDescriptor -> getImageFromJavaUI ( ISharedImages . IMG_OBJS_PACKAGE ) <EOL> else -> null <EOL> } <EOL> }


fun getImage ( element : KtElement ) : Image ?

{ <EOL> return when ( element ) { <EOL> is KtClassOrObject -> getImageFromJavaUI ( ISharedImages . IMG_OBJS_CLASS ) <EOL> is KtFunction -> getImageFromJavaUI ( ISharedImages . IMG_OBJS_PUBLIC ) <EOL> is KtVariableDeclaration -> getImageFromJavaUI ( ISharedImages . IMG_FIELD_PUBLIC ) <EOL> else -> null <EOL> } <EOL> }


private fun getImageFromJavaUI ( imageName : String ) : Image

= JavaUI . getSharedImages ( ) . getImage ( imageName )


{ <EOL> ByteArrayOutputStream ( ) . use { baos -> <EOL> ObjectOutputStream ( baos ) . use { oos -> oos . writeObject ( SerializableDataObject ) } <EOL> ByteArrayInputStream ( baos . toByteArray ( ) ) . use { bais -> <EOL> val deseialized = ObjectInputStream ( bais ) . readObject ( ) <EOL> assertEquals ( SerializableDataObject , deseialized ) <EOL> assertNotSame ( deseialized , SerializableDataObject ) <EOL> } <EOL> } <EOL> return "<STR_LIT:OK>" <EOL> }


{ <EOL> return FirImplicitThisReference ( boundSymbol , contextReceiverNumber , diagnostic , ) <EOL> }


@ OptIn ( ExperimentalContracts :: class ) <EOL> inline fun buildImplicitThisReference ( init : FirImplicitThisReferenceBuilder . ( ) -> Unit = { } ) : FirThisReference

{ <EOL> contract { <EOL> callsInPlace ( init , InvocationKind . EXACTLY_ONCE ) <EOL> } <EOL> return FirImplicitThisReferenceBuilder ( ) . apply ( init ) . build ( ) <EOL> }


@ Test <EOL> fun `excludeFilter smoke 0` ( )

{ <EOL> val files = TempFiles ( "<STR_LIT>" ) <EOL> val header1 = files . file ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> val header2 = files . file ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> val header3 = files . file ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> val defFile = files . file ( "<STR_LIT>" , """<STR_LIT>""" . trimIndent ( ) ) <EOL> val library = buildNativeLibraryFrom ( defFile , files . directory ) <EOL> val headers = library . getHeaderPaths ( ) . ownHeaders <EOL> assertContains ( headers , header1 . absolutePath ) <EOL> assertContains ( headers , header2 . absolutePath ) <EOL> assertFalse ( header3 . absolutePath in headers ) <EOL> }


@ Test <EOL> fun `excludeFilter smoke 1` ( )

{ <EOL> val files = TempFiles ( "<STR_LIT>" ) <EOL> val header1 = files . file ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> val header2 = files . file ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> val header3 = files . file ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> val defFile = files . file ( "<STR_LIT>" , """<STR_LIT>""" . trimIndent ( ) ) <EOL> val library = buildNativeLibraryFrom ( defFile , files . directory ) <EOL> val headers = library . getHeaderPaths ( ) . ownHeaders <EOL> assertContains ( headers , header1 . absolutePath ) <EOL> assertFalse ( header2 . absolutePath in headers ) <EOL> assertFalse ( header3 . absolutePath in headers ) <EOL> }


@ Test <EOL> fun `excludeFilter empty` ( )

{ <EOL> val files = TempFiles ( "<STR_LIT>" ) <EOL> val header1 = files . file ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> val defFile = files . file ( "<STR_LIT>" , """<STR_LIT>""" . trimIndent ( ) ) <EOL> val library = buildNativeLibraryFrom ( defFile , files . directory ) <EOL> val headers = library . getHeaderPaths ( ) . ownHeaders <EOL> assertContains ( headers , header1 . absolutePath ) <EOL> }


@ Test <EOL> fun `excludeFilter has higher priority than headerFilter` ( )

{ <EOL> val files = TempFiles ( "<STR_LIT>" ) <EOL> val header1 = files . file ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> val defFile = files . file ( "<STR_LIT>" , """<STR_LIT>""" . trimIndent ( ) ) <EOL> val library = buildNativeLibraryFrom ( defFile , files . directory ) <EOL> val headers = library . getHeaderPaths ( ) . ownHeaders <EOL> assertFalse ( header1 . absolutePath in headers ) <EOL> }


override fun getContainingFile ( ) : SourceFile

= SourceFile . NO_SOURCE_FILE


fun weight ( x0 : KtNDArray < Double > , x : KtNDArray < Double > , tau : Double = <NUM_LIT> ) : KtNDArray < Double >

{ <EOL> var w = exp ( ( - <NUM_LIT:1> ) * sum ( ( x - x0 ) `**` <NUM_LIT:2> , axis = <NUM_LIT:1> ) / ( ( <NUM_LIT:2> * tau ) * ( <NUM_LIT:2> * tau ) ) ) <EOL> w = diag ( w ) <EOL> return w <EOL> }


fun weightedLeastSquares ( x : KtNDArray < Double > , y : KtNDArray < Double > , weights : KtNDArray < Double > ) : KtNDArray < Double >

= <EOL> Linalg . inv ( transpose ( x ) . dot ( weights . dot ( x ) ) ) . dot ( transpose ( x ) . dot ( weights . dot ( y ) ) )


fun weightedRegression ( x : KtNDArray < Double > , y : KtNDArray < Double > , tau : Double = <NUM_LIT> ) : KtNDArray < Double >

{ <EOL> val yHat = zerosLike ( y ) <EOL> val sh = x . shape [ <NUM_LIT:0> ] <EOL> for ( i in <NUM_LIT:0> until sh ) { <EOL> val w = weight ( x [ i .. i + <NUM_LIT:1> ] . ravel ( ) , x , tau ) <EOL> val theta = weightedLeastSquares ( x , y , w ) <EOL> yHat [ i ] = x . dot ( theta ) [ i ] <EOL> } <EOL> return yHat <EOL> }


fun r2Score ( y : KtNDArray < Double > , yHat : KtNDArray < Double > )

= <EOL> <NUM_LIT:1.0> - sum ( ( y - yHat ) `**` <NUM_LIT:2> ) / `var` ( y ) / y . shape [ <NUM_LIT:0> ]


fun searchAccuracies ( taus : KtNDArray < Double > , x : KtNDArray < Double > , y : KtNDArray < Double > ) : KtNDArray < Double >

{ <EOL> val r = arrayListOf < Double > ( ) <EOL> for ( tau in taus . flatIter ( ) ) { <EOL> r . add ( r2Score ( y , weightedRegression ( x , y , tau = tau ) ) ) <EOL> } <EOL> return array ( r ) <EOL> }


{ <EOL> val data = linspace < Double > ( - <NUM_LIT:3> , <NUM_LIT:3> , <NUM_LIT> ) <EOL> val y = sin ( data `**` <NUM_LIT:3> / <NUM_LIT:3> ) <EOL> data += Random . normal ( scale = <NUM_LIT> , size = * intArrayOf ( <NUM_LIT> ) ) <EOL> val x = hstack ( ones < Double > ( <NUM_LIT> ) . reshape ( <NUM_LIT> , <NUM_LIT:1> ) , data . reshape ( <NUM_LIT> , <NUM_LIT:1> ) ) <EOL> val taus = linspace < Double > ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:10> ) <EOL> val accuracies = searchAccuracies ( taus , x , y ) <EOL> println ( accuracies ) <EOL> }


fun isSuppressed ( diagnostic : Diagnostic ) : Boolean


fun isSuppressed ( diagnostic : Diagnostic , bindingContext : BindingContext ? ) : Boolean

= isSuppressed ( diagnostic )


protected open fun isSuppressedByExtension ( suppressor : DiagnosticSuppressor , diagnostic : Diagnostic ) : Boolean

{ <EOL> return suppressor . isSuppressed ( diagnostic ) <EOL> }


abstract fun getSuppressionAnnotations ( annotated : PsiElement ) : List < AnnotationDescriptor >


override fun getSuppressingStrings ( annotated : PsiElement ) : Set < String >

{ <EOL> val builder = ImmutableSet . builder < String > ( ) <EOL> for ( annotationDescriptor in getSuppressionAnnotations ( annotated ) ) { <EOL> processAnnotation ( builder , annotationDescriptor ) <EOL> } <EOL> return builder . build ( ) <EOL> }


private fun processAnnotation ( builder : ImmutableSet . Builder < String > , annotationDescriptor : AnnotationDescriptor )

{ <EOL> if ( annotationDescriptor . fqName != StandardNames . FqNames . suppress ) return <EOL> for ( arrayValue in annotationDescriptor . allValueArguments . values ) { <EOL> if ( arrayValue is ArrayValue ) { <EOL> for ( value in arrayValue . value ) { <EOL> if ( value is StringValue ) { <EOL> builder . add ( value . value . lowercase ( ) ) <EOL> } <EOL> } <EOL> } <EOL> } <EOL> }


override fun isSuppressed ( request : SuppressRequest < PsiElement > ) : Boolean

{ <EOL> val element = request . element <EOL> if ( ! element . isValid ) return true <EOL> val file = element . containingFile <EOL> if ( file is KtFile ) { <EOL> if ( file . doNotAnalyze != null ) return true <EOL> } <EOL> if ( request is DiagnosticSuppressRequest ) { <EOL> for ( suppressor in diagnosticSuppressors ) { <EOL> if ( isSuppressedByExtension ( suppressor , request . diagnostic ) ) return true <EOL> } <EOL> } <EOL> return super . isSuppressed ( request ) <EOL> }


override fun getClosestAnnotatedAncestorElement ( element : PsiElement , rootElement : PsiElement , excludeSelf : Boolean ) : PsiElement ?

= <EOL> KtStubbedPsiUtil . getPsiOrStubParent ( element , KtAnnotated :: class . java , excludeSelf )


internal fun getDiagnosticSuppressKey ( diagnostic : Diagnostic ) : String

= <EOL> diagnostic . factory . name . lowercase ( )


override fun getSuppressionAnnotations ( annotated : PsiElement ) : List < AnnotationDescriptor >

{ <EOL> val descriptor = context . get ( BindingContext . DECLARATION_TO_DESCRIPTOR , annotated ) <EOL> return descriptor ? . annotations ? . toList ( ) <EOL> ? : ( annotated as? KtAnnotated ) ? . annotationEntries ? . mapNotNull { context . get ( BindingContext . ANNOTATION , it ) } <EOL> ? : emptyList ( ) <EOL> }


override fun isSuppressedByExtension ( suppressor : DiagnosticSuppressor , diagnostic : Diagnostic ) : Boolean

{ <EOL> return suppressor . isSuppressed ( diagnostic , context ) <EOL> }


public fun toArray ( ) : Array < Any ? >

{ <EOL> val a = arrayOfNulls < Any ? > ( <NUM_LIT:3> ) <EOL> a [ <NUM_LIT:0> ] = <NUM_LIT:0> <EOL> a [ <NUM_LIT:1> ] = <NUM_LIT:1> <EOL> a [ <NUM_LIT:2> ] = <NUM_LIT:2> <EOL> return a <EOL> }


public fun < E > toArray ( array : Array < E > ) : Array < E >

{ <EOL> val asIntArray = array as Array < Int > <EOL> asIntArray [ <NUM_LIT:0> ] = <NUM_LIT:0> <EOL> asIntArray [ <NUM_LIT:1> ] = <NUM_LIT:1> <EOL> asIntArray [ <NUM_LIT:2> ] = <NUM_LIT:2> <EOL> return array <EOL> }


{ <EOL> val collection = MyCollection ( Arrays . asList ( <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:9> ) ) as java . util . Collection < * > <EOL> val array1 = collection . toArray ( ) <EOL> val array2 = collection . toArray ( arrayOfNulls < Int > ( <NUM_LIT:3> ) as Array < Int > ) <EOL> if ( ! array1 . isArrayOf < Any > ( ) ) return ( array1 as Object ) . getClass ( ) . toString ( ) <EOL> if ( ! array2 . isArrayOf < Int > ( ) ) return ( array2 as Object ) . getClass ( ) . toString ( ) <EOL> val s1 = Arrays . toString ( array1 ) <EOL> val s2 = Arrays . toString ( array2 ) <EOL> if ( s1 != "<STR_LIT>" ) return "<STR_LIT>" <EOL> if ( s2 != "<STR_LIT>" ) return "<STR_LIT>" <EOL> return "<STR_LIT:OK>" <EOL> }


@ Throws ( Throwable :: class ) <EOL> operator fun invoke ( ) : Int


@ Test <EOL> fun `simple method invocation` ( )

{ <EOL> val instance = TestInterface { <NUM_LIT:0> } <EOL> val proxy = automagicTypedProxy < TestInterface > ( instance . javaClass . classLoader , instance ) <EOL> assertEquals ( <NUM_LIT:0> , proxy ( ) ) <EOL> }


@ Test <EOL> fun `exception throw in DokkaBootstrap is not wrapped inside UndeclaredThrowableException` ( )

{ <EOL> val instanceThrowingTestException = object : DokkaBootstrap { <EOL> override fun configure ( serializedConfigurationJSON : String , logger : BiConsumer < String , String > ) = Unit <EOL> override fun generate ( ) { <EOL> throw TestException ( "<STR_LIT>" , Exception ( "<STR_LIT>" ) ) <EOL> } <EOL> } <EOL> val proxy = automagicTypedProxy < DokkaBootstrap > ( instanceThrowingTestException . javaClass . classLoader , instanceThrowingTestException ) <EOL> val exception = assertFailsWith < TestException > { <EOL> proxy . generate ( ) <EOL> } <EOL> assertEquals ( "<STR_LIT>" , exception . message ) <EOL> assertEquals ( "<STR_LIT>" , exception . cause ? . message ) <EOL> }


{ <EOL> data = <NUM_LIT:3.0> <EOL> }


@ Benchmark <EOL> fun sqrtBenchmark ( ) : Double

{ <EOL> return Math . sqrt ( data ) <EOL> }


@ Benchmark <EOL> fun cosBenchmark ( ) : Double

{ <EOL> return Math . cos ( data ) <EOL> }


fun createLibrarySession ( mainModuleName : Name , sessionProvider : FirProjectSessionProvider , moduleDataProvider : ModuleDataProvider , module : TestModule , testServices : TestServices , configuration : CompilerConfiguration , extensionRegistrars : List < FirExtensionRegistrar > , registerExtraComponents : ( ( FirSession ) -> Unit ) , ) : FirSession

{ <EOL> val resolvedLibraries = resolveLibraries ( configuration , getAllJsDependenciesPaths ( module , testServices ) ) <EOL> return FirJsSessionFactory . createLibrarySession ( mainModuleName , resolvedLibraries . map { it . library } , sessionProvider , moduleDataProvider , extensionRegistrars , configuration , registerExtraComponents , ) <EOL> }


fun createModuleBasedSession ( mainModuleData : FirModuleData , sessionProvider : FirProjectSessionProvider , extensionRegistrars : List < FirExtensionRegistrar > , configuration : CompilerConfiguration , lookupTracker : LookupTracker ? , registerExtraComponents : ( ( FirSession ) -> Unit ) , sessionConfigurator : FirSessionConfigurator . ( ) -> Unit , ) : FirSession

= <EOL> FirJsSessionFactory . createModuleBasedSession ( mainModuleData , sessionProvider , extensionRegistrars , configuration , lookupTracker , icData = null , registerExtraComponents , sessionConfigurator )


fun getAllJsDependenciesPaths ( module : TestModule , testServices : TestServices ) : List < String >

{ <EOL> return JsEnvironmentConfigurator . getRuntimePathsForModule ( module , testServices ) + getTransitivesAndFriendsPaths ( module , testServices ) <EOL> }


{ <EOL> when ( <NUM_LIT:1> ) { <EOL> <NUM_LIT:2> -> <EOL> "<STR_LIT:2>" <EOL> <NUM_LIT:3> -> <EOL> "<STR_LIT:3>" <EOL> else -> <EOL> "<STR_LIT:1>" <EOL> } <EOL> }


@ OptIn ( KtAllowAnalysisOnEdt :: class , KtAllowAnalysisFromWriteAction :: class ) <EOL> override fun resolve ( ref : KtReference , incompleteCode : Boolean ) : Array < ResolveResult >

{ <EOL> check ( ref is KtFirReference ) { "<STR_LIT>" } <EOL> check ( ref is AbstractKtReference < * > ) { "<STR_LIT>" } <EOL> return allowAnalysisOnEdt { <EOL> allowAnalysisFromWriteAction { <EOL> val resolveToPsiElements = try { <EOL> analyze ( ref . expression ) { ref . getResolvedToPsi ( this ) } <EOL> } catch ( e : Exception ) { <EOL> if ( shouldIjPlatformExceptionBeRethrown ( e ) ) throw e <EOL> errorWithAttachment ( "<STR_LIT>" , cause = e ) { <EOL> withPsiEntry ( "<STR_LIT>" , ref . element ) <EOL> } <EOL> } <EOL> resolveToPsiElements . map { KotlinResolveResult ( it ) } . toTypedArray ( ) <EOL> } <EOL> } <EOL> }


fun build ( ) : FirDelegateFieldReference

{ <EOL> return FirDelegateFieldReferenceImpl ( source , resolvedSymbol , ) <EOL> }


@ OptIn ( ExperimentalContracts :: class ) <EOL> inline fun buildDelegateFieldReference ( init : FirDelegateFieldReferenceBuilder . ( ) -> Unit ) : FirDelegateFieldReference

{ <EOL> contract { <EOL> callsInPlace ( init , InvocationKind . EXACTLY_ONCE ) <EOL> } <EOL> return FirDelegateFieldReferenceBuilder ( ) . apply ( init ) . build ( ) <EOL> }


override fun checkType ( expression : KtExpression , expressionType : KotlinType , expressionTypeWithSmartCast : KotlinType , c : ResolutionContext < * > )

{ <EOL> checkTypeParameterBounds ( expression , expressionType , c ) <EOL> val dataFlowValue by lazy ( LazyThreadSafetyMode . NONE ) { <EOL> c . dataFlowValueFactory . createDataFlowValue ( expression , expressionType , c ) <EOL> } <EOL> findTypeParameterWithWrongBoundsNullability ( expressionType , c ) { dataFlowValue } ? . let { typeParameterDescriptor -> <EOL> c . trace . report ( ErrorsJvm . NULLABLE_TYPE_PARAMETER_AGAINST_NOT_NULL_TYPE_PARAMETER . on ( expression , typeParameterDescriptor ) ) <EOL> } <EOL> doCheckType ( expressionType , c . expectedType , { dataFlowValue } , c . dataFlowInfo ) { expectedType , actualType -> <EOL> c . trace . report ( ErrorsJvm . NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS . on ( expression , expectedType , actualType ) ) <EOL> } <EOL> when ( expression ) { <EOL> is KtWhenExpression -> <EOL> if ( expression . elseExpression == null ) { <EOL> val subjectExpression = expression . subjectExpression ? : return <EOL> val type = c . trace . getType ( subjectExpression ) ? : return <EOL> if ( type . isFlexible ( ) && TypeUtils . isNullableType ( type . asFlexibleType ( ) . upperBound ) ) { <EOL> val enumClassDescriptor = WhenChecker . getClassDescriptorOfTypeIfEnum ( type ) ? : return <EOL> val context = c . trace . bindingContext <EOL> if ( WhenChecker . getEnumMissingCases ( expression , context , enumClassDescriptor ) . isEmpty ( ) && ! WhenChecker . containsNullCase ( expression , context ) ) { <EOL> val subjectDataFlowValue = c . dataFlowValueFactory . createDataFlowValue ( subjectExpression , type , c ) <EOL> val dataFlowInfo = c . trace [ BindingContext . EXPRESSION_TYPE_INFO , subjectExpression ] ? . dataFlowInfo <EOL> if ( dataFlowInfo != null && ! dataFlowInfo . getStableNullability ( subjectDataFlowValue ) . canBeNull ( ) ) { <EOL> return <EOL> } <EOL> c . trace . report ( ErrorsJvm . WHEN_ENUM_CAN_BE_NULL_IN_JAVA . on ( expression . subjectExpression ! ! ) ) <EOL> } <EOL> } <EOL> } <EOL> is KtPostfixExpression -> <EOL> if ( expression . operationToken == KtTokens . EXCLEXCL ) { <EOL> val baseExpression = expression . baseExpression ? : return <EOL> val baseExpressionType = c . trace . getType ( baseExpression ) ? : return <EOL> doIfNotNull ( baseExpressionType , { c . dataFlowValueFactory . createDataFlowValue ( baseExpression , baseExpressionType , c ) } , c ) { <EOL> c . trace . report ( Errors . UNNECESSARY_NOT_NULL_ASSERTION . on ( expression . operationReference , baseExpressionType ) ) <EOL> } <EOL> } <EOL> is KtBinaryExpression -> <EOL> when ( expression . operationToken ) { <EOL> KtTokens . EQEQ , <EOL> KtTokens . EXCLEQ , <EOL> KtTokens . EQEQEQ , <EOL> KtTokens . EXCLEQEQEQ -> { <EOL> if ( expression . left != null && expression . right != null ) { <EOL> SenselessComparisonChecker . checkSenselessComparisonWithNull ( expression , expression . left ! ! , expression . right ! ! , c , { c . trace . getType ( it ) } , { value -> <EOL> doIfNotNull ( value . type , { value } , c ) { Nullability . NOT_NULL } ? : Nullability . UNKNOWN <EOL> } ) <EOL> } <EOL> } <EOL> } <EOL> } <EOL> }


private fun checkTypeParameterBounds ( expression : KtExpression , expressionType : KotlinType , c : ResolutionContext < * > )

{ <EOL> if ( expressionType is AbbreviatedType ) { <EOL> upperBoundChecker . checkBoundsOfExpandedTypeAlias ( expressionType . expandedType , expression , c . trace ) <EOL> } <EOL> if ( upperBoundChecker !is WarningAwareUpperBoundChecker ) return <EOL> val call = ( c as? BasicCallResolutionContext ) ? . call <EOL> ? : c . trace . bindingContext [ BindingContext . CALL , ( expression as? KtCallExpression ) ? . calleeExpression ] <EOL> ? : return <EOL> val resolvedCall = c . trace . bindingContext [ BindingContext . RESOLVED_CALL , call ] ? : return <EOL> val typeArguments = if ( resolvedCall is NewResolvedCallImpl < * > ) { <EOL> resolvedCall . resolvedCallAtom . typeArgumentMappingByOriginal <EOL> } else { <EOL> resolvedCall . typeArguments . entries <EOL> } <EOL> for ( ( typeParameter , typeArgument ) in typeArguments ) { <EOL> val typeReference = call . typeArguments . getOrNull ( typeParameter . index ) ? . typeReference ? : continue <EOL> if ( typeArgument == null ) continue <EOL> upperBoundChecker . checkBounds ( typeReference , typeArgument , typeParameter , TypeSubstitutor . create ( typeArgument ) , c . trace , withOnlyCheckForWarning = true ) <EOL> } <EOL> }


private fun findTypeParameterWithWrongBoundsNullability ( expressionType : KotlinType , c : ResolutionContext < * > , dataFlowValueForWholeExpression : ( ) -> DataFlowValue ) : TypeParameterDescriptor ?

{ <EOL> if ( c . languageVersionSettings . supportsFeature ( LanguageFeature . ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated ) ) return null <EOL> if ( TypeUtils . noExpectedType ( c . expectedType ) ) return null <EOL> var foundSubtypeTypeParameter : TypeParameterDescriptor ? = null <EOL> @ OptIn ( ClassicTypeCheckerStateInternals :: class ) <EOL> val typeState : TypeCheckerState = object : ClassicTypeCheckerState ( isErrorTypeEqualsToAnything = true ) { <EOL> private var expectsTypeArgument = false <EOL> override fun customIsSubtypeOf ( subType : KotlinTypeMarker , superType : KotlinTypeMarker ) : Boolean { <EOL> if ( isNullableTypeAgainstNotNullTypeParameter ( subType as KotlinType , superType as KotlinType ) ) { <EOL> if ( expectsTypeArgument || c . dataFlowInfo . getStableNullability ( dataFlowValueForWholeExpression ( ) ) != Nullability . NOT_NULL ) { <EOL> foundSubtypeTypeParameter = subType . constructor . declarationDescriptor as? TypeParameterDescriptor <EOL> return false <EOL> } <EOL> } <EOL> if ( ! expectsTypeArgument ) { <EOL> expectsTypeArgument = true <EOL> } <EOL> return true <EOL> } <EOL> } <EOL> AbstractTypeChecker . isSubtypeOf ( typeState , expressionType , c . expectedType ) <EOL> return foundSubtypeTypeParameter <EOL> }


override fun checkReceiver ( receiverParameter : ReceiverParameterDescriptor , receiverArgument : ReceiverValue , safeAccess : Boolean , c : CallResolutionContext < * > )

{ <EOL> val dataFlowValue by lazy ( LazyThreadSafetyMode . NONE ) { <EOL> c . dataFlowValueFactory . createDataFlowValue ( receiverArgument , c ) <EOL> } <EOL> if ( safeAccess ) { <EOL> val safeAccessElement = c . call . callOperationNode ? . psi ? : return <EOL> doIfNotNull ( receiverArgument . type , { dataFlowValue } , c ) { <EOL> c . trace . report ( Errors . UNNECESSARY_SAFE_CALL . on ( safeAccessElement , receiverArgument . type ) ) <EOL> } <EOL> return <EOL> } <EOL> doCheckType ( receiverArgument . type , receiverParameter . type , { dataFlowValue } , c . dataFlowInfo ) { expectedType , actualType -> <EOL> val receiverExpression = ( receiverArgument as? ExpressionReceiver ) ? . expression <EOL> if ( receiverExpression != null ) { <EOL> c . trace . report ( ErrorsJvm . RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS . on ( receiverExpression , actualType ) ) <EOL> } else { <EOL> val reportOn = c . call . calleeExpression ? : c . call . callElement <EOL> c . trace . report ( ErrorsJvm . NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS . on ( reportOn , expectedType , actualType ) ) <EOL> } <EOL> } <EOL> }


private fun doCheckType ( expressionType : KotlinType , expectedType : KotlinType , expressionTypeDataFlowValue : ( ) -> DataFlowValue , dataFlowInfo : DataFlowInfo , reportWarning : ( expectedType : KotlinType , actualType : KotlinType ) -> Unit )

{ <EOL> if ( TypeUtils . noExpectedType ( expectedType ) ) return <EOL> @ Suppress ( "<STR_LIT>" ) <EOL> val expressionType = exactedExpressionTypeByDataFlowNullability ( expressionType , expressionTypeDataFlowValue , dataFlowInfo ) <EOL> val isEnhancedExpectedTypeSubtypeOfExpressionType = typeCheckerForEnhancedTypes . isSubtypeOf ( expressionType , expectedType ) <EOL> if ( isEnhancedExpectedTypeSubtypeOfExpressionType ) return <EOL> val isExpectedTypeSubtypeOfExpressionType = typeCheckerForBaseTypes . isSubtypeOf ( expressionType , expectedType ) <EOL> if ( ! isEnhancedExpectedTypeSubtypeOfExpressionType && isExpectedTypeSubtypeOfExpressionType ) { <EOL> reportWarning ( expectedType . unwrapEnhancementDeeply ( ) , expressionType . unwrapEnhancementDeeply ( ) ) <EOL> } <EOL> }


private fun exactedExpressionTypeByDataFlowNullability ( expressionType : KotlinType , expressionTypeDataFlowValue : ( ) -> DataFlowValue , dataFlowInfo : DataFlowInfo , ) : KotlinType

{ <EOL> val isNotNullByDataFlowInfo = dataFlowInfo . getStableNullability ( expressionTypeDataFlowValue ( ) ) == Nullability . NOT_NULL <EOL> return if ( expressionType . isNullable ( ) && isNotNullByDataFlowInfo ) expressionType . makeNotNullable ( ) else expressionType <EOL> }


private fun < T : Any > doIfNotNull ( type : KotlinType , dataFlowValue : ( ) -> DataFlowValue , c : ResolutionContext < * > , body : ( ) -> T )

= if ( type . mustNotBeNull ( ) ? . isFromJava == true && c . dataFlowInfo . getStableNullability ( dataFlowValue ( ) ) . canBeNull ( ) ) { <EOL> body ( ) <EOL> } else { <EOL> null <EOL> }


override fun prepareType ( type : KotlinTypeMarker ) : UnwrappedType

= <EOL> super . prepareType ( type ) . let { it . getEnhancementDeeply ( ) ? : it } . unwrap ( )


fun isNullableTypeAgainstNotNullTypeParameter ( subType : KotlinType , superType : KotlinType ) : Boolean

{ <EOL> if ( superType !is NotNullTypeParameter || subType is NotNullTypeParameter ) return false <EOL> return ! AbstractNullabilityChecker . isSubtypeOfAny ( createClassicTypeCheckerState ( isErrorTypeEqualsToAnything = true ) , subType ) <EOL> }


private fun KotlinType . enhancementFromKotlin ( )

= EnhancedNullabilityInfo ( this , isFromJava = false )


private fun TypeWithEnhancement . enhancementFromJava ( )

= EnhancedNullabilityInfo ( enhancement , isFromJava = true )


fun KotlinType . mustNotBeNull ( ) : EnhancedNullabilityInfo ?

= when { <EOL> ! isError && ! isFlexible ( ) && ! TypeUtils . acceptsNullable ( this ) -> enhancementFromKotlin ( ) <EOL> isFlexible ( ) && ! TypeUtils . acceptsNullable ( asFlexibleType ( ) . upperBound ) -> enhancementFromKotlin ( ) <EOL> this is TypeWithEnhancement && enhancement . mustNotBeNull ( ) != null -> enhancementFromJava ( ) <EOL> else -> null <EOL> }


fun renderAnnotations ( analysisSession : KtAnalysisSession , annotations : KtAnnotationsList )

= buildString { <EOL> renderAnnotationsRecursive ( analysisSession , annotations , currentMetaAnnotations = null , indent = <NUM_LIT:0> ) <EOL> }


fun renderAnnotationsWithMeta ( analysisSession : KtAnalysisSession , annotations : KtAnnotationsList )

= buildString { <EOL> renderAnnotationsRecursive ( analysisSession , annotations , currentMetaAnnotations = setOf ( ) , indent = <NUM_LIT:0> ) <EOL> }


private fun StringBuilder . renderAnnotationsRecursive ( analysisSession : KtAnalysisSession , annotations : KtAnnotationsList , currentMetaAnnotations : Set < ClassId > ? , indent : Int )

{ <EOL> appendLine ( "<STR_LIT>" . indented ( indent ) ) <EOL> for ( annotation in annotations . annotations ) { <EOL> appendLine ( DebugSymbolRenderer ( ) . renderAnnotationApplication ( analysisSession , annotation ) . indented ( indent = indent + <NUM_LIT:2> ) ) <EOL> if ( currentMetaAnnotations != null ) { <EOL> val classId = annotation . classId ? : continue <EOL> if ( classId in currentMetaAnnotations ) { <EOL> appendLine ( "<STR_LIT>" . indented ( indent + <NUM_LIT:4> ) ) <EOL> continue <EOL> } <EOL> val metaAnnotations = with ( analysisSession ) { getClassOrObjectSymbolByClassId ( classId ) ? . annotationsList } <EOL> if ( metaAnnotations != null ) { <EOL> renderAnnotationsRecursive ( analysisSession , metaAnnotations , currentMetaAnnotations + classId , indent = indent + <NUM_LIT:4> ) <EOL> } else { <EOL> appendLine ( "<STR_LIT>" . indented ( indent + <NUM_LIT:4> ) ) <EOL> } <EOL> } <EOL> } <EOL> appendLine ( "<STR_LIT:]>" . indented ( indent ) ) <EOL> }


{ <EOL> val data = Json . decodeFromString < Project > ( """<STR_LIT>""" ) <EOL> println ( data ) <EOL> }


operator fun plus ( f : Foo ) : WithOperator


fun test ( withOperator : WithOperator , foo : Foo )

{ <EOL> var variable = withOperator <EOL> variable < caret > += foo <EOL> }


fun prepareAnalyzedSourceModule ( project : Project , files : List < KtFile > , configuration : CompilerConfiguration , dependencies : List < String > , friendDependencies : List < String > , analyzer : AbstractAnalyzerWithCompilerReport , errorPolicy : ErrorTolerancePolicy = configuration . get ( JSConfigurationKeys . ERROR_TOLERANCE_POLICY ) ? : ErrorTolerancePolicy . DEFAULT , analyzerFacade : AbstractTopDownAnalyzerFacadeForWeb = TopDownAnalyzerFacadeForJSIR , ) : ModulesStructure

{ <EOL> val mainModule = MainModule . SourceFiles ( files ) <EOL> val sourceModule = ModulesStructure ( project , mainModule , configuration , dependencies , friendDependencies ) <EOL> return sourceModule . apply { <EOL> runAnalysis ( errorPolicy , analyzer , analyzerFacade ) <EOL> } <EOL> }


override fun shouldNotGenerateDelegatedMember ( memberSymbolFromSuperInterface : FirCallableSymbol < * > ) : Boolean

{ <EOL> val original = memberSymbolFromSuperInterface . unwrapFakeOverrides ( ) <EOL> return original . isNonAbstractJavaMethod ( ) || original . hasJvmDefaultAnnotation ( ) || original . isBuiltInMemberMappedToJavaDefault ( ) || original . origin == FirDeclarationOrigin . Synthetic . FakeHiddenInPreparationForNewJdk <EOL> }


private fun FirCallableSymbol < * > . isNonAbstractJavaMethod ( ) : Boolean

{ <EOL> return origin == FirDeclarationOrigin . Enhancement && fir . modality != Modality . ABSTRACT <EOL> }


private fun FirCallableSymbol < * > . hasJvmDefaultAnnotation ( ) : Boolean

{ <EOL> return annotations . hasAnnotation ( JvmStandardClassIds . JVM_DEFAULT_CLASS_ID , session ) <EOL> }


private fun FirCallableSymbol < * > . isBuiltInMemberMappedToJavaDefault ( ) : Boolean

{ <EOL> return fir . modality != Modality . ABSTRACT && <EOL> annotations . hasAnnotation ( PLATFORM_DEPENDENT_ANNOTATION_CLASS_ID , session ) <EOL> }


= A . result


{ <EOL> @ OptIn ( kotlin . experimental . ExperimentalNativeApi :: class ) <EOL> if ( Platform . memoryModel != MemoryModel . EXPERIMENTAL ) { <EOL> return "<STR_LIT:OK>" <EOL> } <EOL> val w1 = Worker . start ( ) <EOL> val w2 = Worker . start ( ) <EOL> val f1 = w1 . execute ( TransferMode . SAFE , { -> } ) { <EOL> repeat ( <NUM_LIT> ) { <EOL> while ( x != <NUM_LIT:0> ) { } <EOL> y = it <EOL> x = <NUM_LIT:1> <EOL> } <EOL> "<STR_LIT:O>" <EOL> } <EOL> val f2 = w2 . execute ( TransferMode . SAFE , { -> } ) { <EOL> var result = "<STR_LIT:K>" <EOL> repeat ( <NUM_LIT> ) { <EOL> while ( x != <NUM_LIT:1> ) { } <EOL> if ( y != it ) result = "<STR_LIT:FAIL>" <EOL> x = <NUM_LIT:0> <EOL> } <EOL> result <EOL> } <EOL> return ( f1 . result + f2 . result ) . also { <EOL> w1 . requestTermination ( ) . result <EOL> w2 . requestTermination ( ) . result <EOL> } <EOL> }


{ <EOL> log += "<STR_LIT>" <EOL> return <NUM_LIT:1> <EOL> }


{ <EOL> log += "<STR_LIT>" <EOL> return <NUM_LIT:42> <EOL> }


= A ( x + other . x )


{ <EOL> val array = arrayOf ( <NUM_LIT:0> , <NUM_LIT:1> ) <EOL> array [ foo ( ) ] += bar ( ) <EOL> if ( array [ <NUM_LIT:0> ] != <NUM_LIT:0> ) return "<STR_LIT>" <EOL> if ( array [ <NUM_LIT:1> ] != <NUM_LIT> ) return "<STR_LIT>" <EOL> log += "<STR_LIT>" <EOL> val objArray = arrayOf ( A ( <NUM_LIT:0> ) , A ( <NUM_LIT:1> ) ) <EOL> objArray [ foo ( ) ] += A ( bar ( ) ) <EOL> if ( objArray [ <NUM_LIT:0> ] != A ( <NUM_LIT:0> ) ) return "<STR_LIT>" <EOL> if ( objArray [ <NUM_LIT:1> ] != A ( <NUM_LIT> ) ) return "<STR_LIT>" <EOL> if ( log != "<STR_LIT>" ) return "<STR_LIT>" <EOL> return "<STR_LIT:OK>" <EOL> }


fun getRoot ( ) : ReadonlyTreeNode < T > ?


operator fun get ( childName : String ) : ReadonlyTreeNode < T > ?


fun getInstance ( project : Project ) : Fe10AnalysisFacade

{ <EOL> return project . getService ( Fe10AnalysisFacade :: class . java ) <EOL> }


fun getAnalysisContext ( element : KtElement , token : KtLifetimeToken ) : Fe10AnalysisContext


fun getAnalysisContext ( ktModule : KtModule , token : KtLifetimeToken ) : Fe10AnalysisContext


fun analyze ( elements : List < KtElement > , mode : AnalysisMode = AnalysisMode . FULL ) : BindingContext


fun analyze ( element : KtElement , mode : AnalysisMode = AnalysisMode . FULL ) : BindingContext

{ <EOL> return analyze ( listOf ( element ) , mode ) <EOL> }


fun getOrigin ( file : VirtualFile ) : KtSymbolOrigin


operator fun Any ? . getValue ( thisRef : Any ? , property : KProperty < * > )

= "<STR_LIT:OK>"


{ <EOL> assertEquals ( <NUM_LIT> , :: s . apply { isAccessible = true } . getDelegate ( ) ) <EOL> return "<STR_LIT:OK>" <EOL> }


override fun build ( ) : FirStringConcatenationCall

{ <EOL> return FirStringConcatenationCallImpl ( source , annotations . toMutableOrEmpty ( ) , argumentList , ) <EOL> }


@ OptIn ( ExperimentalContracts :: class ) <EOL> inline fun buildStringConcatenationCall ( init : FirStringConcatenationCallBuilder . ( ) -> Unit ) : FirStringConcatenationCall

{ <EOL> contract { <EOL> callsInPlace ( init , InvocationKind . EXACTLY_ONCE ) <EOL> } <EOL> return FirStringConcatenationCallBuilder ( ) . apply ( init ) . build ( ) <EOL> }


expect fun < T > CoroutineScope . asyncWithDealy ( delay : Long , block : suspend ( ) -> T ) : Deferred < T >


fun CoroutineDispatcher . name ( ) : String

= TODO ( "<STR_LIT>" )


override fun check ( declaration : FirDeclaration , context : CheckerContext , reporter : DiagnosticReporter )

{ <EOL> for ( annotation in declaration . annotations ) { <EOL> val annotationClassSymbol = annotation . toAnnotationClassLikeSymbol ( context . session ) ? : continue <EOL> if ( annotationClassSymbol . getExplicitAnnotationRetention ( context . session ) != AnnotationRetention . RUNTIME ) continue <EOL> if ( declaration is FirMemberDeclaration && declaration . symbol . isEffectivelyExternal ( context ) ) { <EOL> reporter . reportOn ( annotation . source , FirJsErrors . RUNTIME_ANNOTATION_ON_EXTERNAL_DECLARATION , context ) <EOL> } else { <EOL> reporter . reportOn ( annotation . source , FirJsErrors . RUNTIME_ANNOTATION_NOT_SUPPORTED , context ) <EOL> } <EOL> } <EOL> }


private fun resolveAccessorCall ( suspendPropertyDescriptor : PropertyDescriptor , context : TranslationContext ) : ResolvedCall < PropertyDescriptor >

{ <EOL> return object : ResolvedCall < PropertyDescriptor > { <EOL> override fun getStatus ( ) = ResolutionStatus . SUCCESS <EOL> override fun getCandidateDescriptor ( ) = suspendPropertyDescriptor <EOL> override fun getResultingDescriptor ( ) = suspendPropertyDescriptor <EOL> } <EOL> }


abstract fun renderClassId ( classId : ClassId )


abstract fun renderCallableId ( callableId : CallableId )


{ <EOL> val config = KotlinTestUtils . newConfiguration ( ConfigurationKind . ALL , TestJdkKind . ANDROID_API ) <EOL> val env = createTestEnvironment ( config , getResPaths ( path ) ) <EOL> val project = env . project <EOL> val ext = PackageFragmentProviderExtension . getInstances ( project ) . first { it is AndroidPackageFragmentProviderExtension } <EOL> val analysisResult = JvmResolveUtil . analyzeAndCheckForErrors ( listOf ( ) , env ) <EOL> val fragmentProvider = <EOL> ext . getPackageFragmentProvider ( project , analysisResult . moduleDescriptor , LockBasedStorageManager . NO_LOCKS , DummyTraces . DUMMY_EXCEPTION_ON_ERROR_TRACE , null , LookupTracker . DO_NOTHING ) as AndroidSyntheticPackageFragmentProvider <EOL> val renderer = DescriptorRenderer . COMPACT_WITH_MODIFIERS <EOL> val expected = fragmentProvider . packages . values <EOL> . map { it ( ) } <EOL> . sortedBy { it . fqName . asString ( ) } <EOL> . joinToString ( separator = "<STR_LIT>" ) { packageFragment -> <EOL> val descriptors = packageFragment . getMemberScope ( ) . getContributedDescriptors ( ) <EOL> . sortedWith ( MemberComparator . INSTANCE ) <EOL> . joinToString ( "<STR_LIT:\n>" ) { "<STR_LIT>" + renderer . render ( it ) } <EOL> packageFragment . fqName . asString ( ) + ( if ( descriptors . isNotEmpty ( ) ) "<STR_LIT>" + descriptors else "<STR_LIT>" ) <EOL> } <EOL> KotlinTestUtils . assertEqualsToFile ( File ( path , "<STR_LIT>" ) , expected ) <EOL> }


internal fun sourcesJarTask ( compilation : KotlinCompilation < * > , componentName : String , artifactNameAppendix : String ) : TaskProvider < Jar >

= <EOL> sourcesJarTask ( project = compilation . target . project , sourceSets = compilation . target . project . future { <EOL> compilation . internal . awaitAllKotlinSourceSets ( ) . associate { it . name to it . kotlin } <EOL> } , componentName = componentName , artifactNameAppendix = artifactNameAppendix )


private fun sourcesJarTask ( project : Project , sourceSets : Future < Map < String , Iterable < File > > > , componentName : String , artifactNameAppendix : String , ) : TaskProvider < Jar >

= <EOL> sourcesJarTaskNamed ( taskName = lowerCamelCaseName ( componentName , "<STR_LIT>" ) , componentName = componentName , project = project , sourceSets = sourceSets , artifactNameAppendix = artifactNameAppendix )


internal fun sourcesJarTaskNamed ( taskName : String , componentName : String , project : Project , sourceSets : Future < Map < String , Iterable < File > > > , artifactNameAppendix : String , componentTypeName : String = "<STR_LIT>" , ) : TaskProvider < Jar >

{ <EOL> project . locateTask < Jar > ( taskName ) ? . let { <EOL> return it <EOL> } <EOL> val result = project . registerTask < Jar > ( taskName ) { sourcesJar -> <EOL> sourcesJar . archiveAppendix . set ( artifactNameAppendix ) <EOL> sourcesJar . archiveClassifier . set ( "<STR_LIT>" ) <EOL> sourcesJar . isPreserveFileTimestamps = false <EOL> sourcesJar . isReproducibleFileOrder = true <EOL> sourcesJar . group = BasePlugin . BUILD_GROUP <EOL> sourcesJar . description = "<STR_LIT>" <EOL> project . launch { <EOL> sourcesJar . includeSources ( sourceSets . await ( ) ) <EOL> } <EOL> } <EOL> return result <EOL> }


internal fun Jar . includeSources ( compilation : KotlinCompilation < * > )

{ <EOL> compilation . internal . allKotlinSourceSets . forAll { sourceSet -> <EOL> includeSources ( sourceSet . name , sourceSet . kotlin ) <EOL> } <EOL> }


internal fun Jar . includeSources ( sourceSets : Map < String , Iterable < File > > )

{ <EOL> sourceSets . forEach { ( name , sources ) -> includeSources ( name , sources ) } <EOL> }


internal fun Jar . includeSources ( name : String , sources : Iterable < File > )

{ <EOL> from ( sources ) { spec -> <EOL> spec . into ( name ) <EOL> spec . duplicatesStrategy = DuplicatesStrategy . WARN <EOL> } <EOL> }


internal inline fun run1 ( fn : ( ) -> Int ) : Int

{ <EOL> log += "<STR_LIT>" <EOL> return <NUM_LIT:1> + fn ( ) <EOL> }


internal inline fun run2 ( fn : ( ) -> Int ) : Int

{ <EOL> log += "<STR_LIT>" <EOL> return <NUM_LIT:2> + run1 ( fn ) <EOL> }


internal inline fun run3 ( fn : ( ) -> Int ) : Int

{ <EOL> log += "<STR_LIT>" <EOL> return <NUM_LIT:3> + run2 ( fn ) <EOL> }


= run3 { x }


{ <EOL> val result = <NUM_LIT:1> + run3 { x } <EOL> return result <EOL> }


{ <EOL> assertEquals ( <NUM_LIT:7> , test1 ( <NUM_LIT:1> ) ) <EOL> assertEquals ( "<STR_LIT>" , log ) <EOL> assertEquals ( <NUM_LIT:8> , test2 ( <NUM_LIT:1> ) ) <EOL> return "<STR_LIT:OK>" <EOL> }


override fun reportSignatureConflict ( signature : RawSignature , declarations : Collection < IrField > , diagnosticReporter : IrDiagnosticReporter )

{ <EOL> reportSignatureClashTo ( diagnosticReporter , JvmBackendErrors . CONFLICTING_JVM_DECLARATIONS , declarations , ConflictingJvmDeclarationsData ( classInternalName = classCodegen . type . internalName , classOrigin = null , signature = signature , signatureOrigins = null , signatureDescriptors = declarations . map ( IrDeclaration :: toIrBasedDescriptor ) , ) , reportOnIfSynthetic = { classCodegen . irClass } , ) <EOL> }


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

{ <EOL> usingNativeMemoryAllocator { <EOL> usingJvmCInteropCallbacks { <EOL> PhaseEngine . startTopLevel ( config ) { engine -> <EOL> if ( ! config . compileFromBitcode . isNullOrEmpty ( ) ) produceBinaryFromBitcode ( engine , config , config . compileFromBitcode ! ! ) <EOL> else when ( config . produce ) { <EOL> CompilerOutputKind . PROGRAM -> produceBinary ( engine , config , environment ) <EOL> CompilerOutputKind . DYNAMIC -> produceCLibrary ( engine , config , environment ) <EOL> CompilerOutputKind . STATIC -> produceCLibrary ( engine , config , environment ) <EOL> CompilerOutputKind . FRAMEWORK -> produceObjCFramework ( engine , config , environment ) <EOL> CompilerOutputKind . LIBRARY -> produceKlib ( engine , config , environment ) <EOL> CompilerOutputKind . BITCODE -> error ( "<STR_LIT>" ) <EOL> CompilerOutputKind . DYNAMIC_CACHE -> produceBinary ( engine , config , environment ) <EOL> CompilerOutputKind . STATIC_CACHE -> produceBinary ( engine , config , environment ) <EOL> CompilerOutputKind . HEADER_CACHE -> produceBinary ( engine , config , environment ) <EOL> CompilerOutputKind . TEST_BUNDLE -> produceBundle ( engine , config , environment ) <EOL> } <EOL> } <EOL> } <EOL> } <EOL> }


private fun produceObjCFramework ( engine : PhaseEngine < PhaseContext > , config : KonanConfig , environment : KotlinCoreEnvironment )

{ <EOL> val frontendOutput = engine . runFrontend ( config , environment ) ? : return <EOL> val objCExportedInterface = engine . runPhase ( ProduceObjCExportInterfacePhase , frontendOutput ) <EOL> engine . runPhase ( CreateObjCFrameworkPhase , CreateObjCFrameworkInput ( frontendOutput . moduleDescriptor , objCExportedInterface ) ) <EOL> if ( config . omitFrameworkBinary ) { <EOL> return <EOL> } <EOL> val ( psiToIrOutput , objCCodeSpec ) = engine . runPsiToIr ( frontendOutput , isProducingLibrary = false ) { <EOL> it . runPhase ( CreateObjCExportCodeSpecPhase , objCExportedInterface ) <EOL> } <EOL> require ( psiToIrOutput is PsiToIrOutput . ForBackend ) <EOL> val backendContext = createBackendContext ( config , frontendOutput , psiToIrOutput ) { <EOL> it . objCExportedInterface = objCExportedInterface <EOL> it . objCExportCodeSpec = objCCodeSpec <EOL> } <EOL> engine . runBackend ( backendContext , psiToIrOutput . irModule ) <EOL> }

/**
 * Create an Objective-C framework which is a directory consisting of
 * - Objective-C header
 * - Info.plist
 * - Binary (if -Xomit-framework-binary is not passed).
 */


private fun produceCLibrary ( engine : PhaseEngine < PhaseContext > , config : KonanConfig , environment : KotlinCoreEnvironment )

{ <EOL> val frontendOutput = engine . runFrontend ( config , environment ) ? : return <EOL> val ( psiToIrOutput , cAdapterElements ) = engine . runPsiToIr ( frontendOutput , isProducingLibrary = false ) { <EOL> if ( config . cInterfaceGenerationMode == CInterfaceGenerationMode . V1 ) { <EOL> it . runPhase ( BuildCExports , frontendOutput ) <EOL> } else { <EOL> null <EOL> } <EOL> } <EOL> require ( psiToIrOutput is PsiToIrOutput . ForBackend ) <EOL> val backendContext = createBackendContext ( config , frontendOutput , psiToIrOutput ) { <EOL> it . cAdapterExportedElements = cAdapterElements <EOL> } <EOL> engine . runBackend ( backendContext , psiToIrOutput . irModule ) <EOL> }


private fun produceKlib ( engine : PhaseEngine < PhaseContext > , config : KonanConfig , environment : KotlinCoreEnvironment )

{ <EOL> val serializerOutput = if ( environment . configuration . getBoolean ( CommonConfigurationKeys . USE_FIR ) ) <EOL> serializeKLibK2 ( engine , config , environment ) <EOL> else <EOL> serializeKlibK1 ( engine , config , environment ) <EOL> serializerOutput ? . let { engine . writeKlib ( it ) } <EOL> }


private fun serializeKLibK2 ( engine : PhaseEngine < PhaseContext > , config : KonanConfig , environment : KotlinCoreEnvironment ) : SerializerOutput ?

{ <EOL> val frontendOutput = engine . runFirFrontend ( environment ) <EOL> if ( frontendOutput is FirOutput . ShouldNotGenerateCode ) return null <EOL> require ( frontendOutput is FirOutput . Full ) <EOL> return if ( config . metadataKlib ) { <EOL> engine . runFirSerializer ( frontendOutput ) <EOL> } else { <EOL> val fir2IrOutput = engine . runFir2Ir ( frontendOutput ) <EOL> val headerKlibPath = config . headerKlibPath <EOL> if ( ! headerKlibPath . isNullOrEmpty ( ) ) { <EOL> val headerKlib = engine . runFir2IrSerializer ( FirSerializerInput ( fir2IrOutput , produceHeaderKlib = true ) ) <EOL> engine . writeKlib ( headerKlib , headerKlibPath , produceHeaderKlib = true ) <EOL> if ( File ( config . outputPath ) . canonicalPath == File ( headerKlibPath ) . canonicalPath ) return null <EOL> } <EOL> engine . runK2SpecialBackendChecks ( fir2IrOutput ) <EOL> engine . runFir2IrSerializer ( FirSerializerInput ( fir2IrOutput ) ) <EOL> } <EOL> }


private fun serializeKlibK1 ( engine : PhaseEngine < PhaseContext > , config : KonanConfig , environment : KotlinCoreEnvironment ) : SerializerOutput ?

{ <EOL> val frontendOutput = engine . runFrontend ( config , environment ) ? : return null <EOL> val psiToIrOutput = if ( config . metadataKlib ) { <EOL> null <EOL> } else { <EOL> engine . runPsiToIr ( frontendOutput , isProducingLibrary = true ) as PsiToIrOutput . ForKlib <EOL> } <EOL> val headerKlibPath = config . headerKlibPath <EOL> if ( ! headerKlibPath . isNullOrEmpty ( ) ) { <EOL> val headerKlib = engine . runSerializer ( frontendOutput . moduleDescriptor , psiToIrOutput , produceHeaderKlib = true ) <EOL> engine . writeKlib ( headerKlib , headerKlibPath , produceHeaderKlib = true ) <EOL> if ( File ( config . outputPath ) . canonicalPath == File ( headerKlibPath ) . canonicalPath ) return null <EOL> } <EOL> return engine . runSerializer ( frontendOutput . moduleDescriptor , psiToIrOutput ) <EOL> }


private fun produceBinary ( engine : PhaseEngine < PhaseContext > , config : KonanConfig , environment : KotlinCoreEnvironment )

{ <EOL> val frontendOutput = engine . runFrontend ( config , environment ) ? : return <EOL> val psiToIrOutput = engine . runPsiToIr ( frontendOutput , isProducingLibrary = false ) <EOL> require ( psiToIrOutput is PsiToIrOutput . ForBackend ) <EOL> val backendContext = createBackendContext ( config , frontendOutput , psiToIrOutput ) <EOL> engine . runBackend ( backendContext , psiToIrOutput . irModule ) <EOL> }

/**
 * Produce a single binary artifact.
 */


private fun produceBinaryFromBitcode ( engine : PhaseEngine < PhaseContext > , config : KonanConfig , bitcodeFilePath : String )

{ <EOL> val llvmContext = LLVMContextCreate ( ) ! ! <EOL> var llvmModule : CPointer < LLVMOpaqueModule > ? = null <EOL> try { <EOL> llvmModule = parseBitcodeFile ( llvmContext , bitcodeFilePath ) <EOL> val context = BitcodePostProcessingContextImpl ( config , llvmModule , llvmContext ) <EOL> val depsPath = config . readSerializedDependencies <EOL> val dependencies = if ( depsPath . isNullOrEmpty ( ) ) DependenciesTrackingResult ( emptyList ( ) , emptyList ( ) , emptyList ( ) ) . also { <EOL> config . configuration . report ( CompilerMessageSeverity . WARNING , "<STR_LIT>" ) <EOL> } else DependenciesTrackingResult . deserialize ( depsPath , File ( depsPath ) . readStrings ( ) , config ) <EOL> engine . runBitcodeBackend ( context , dependencies ) <EOL> } finally { <EOL> llvmModule ? . let { LLVMDisposeModule ( it ) } <EOL> LLVMContextDispose ( llvmContext ) <EOL> } <EOL> }


private fun produceBundle ( engine : PhaseEngine < PhaseContext > , config : KonanConfig , environment : KotlinCoreEnvironment )

{ <EOL> require ( config . target . family . isAppleFamily ) <EOL> require ( config . produce == CompilerOutputKind . TEST_BUNDLE ) <EOL> val frontendOutput = engine . runFrontend ( config , environment ) ? : return <EOL> engine . runPhase ( CreateTestBundlePhase , frontendOutput ) <EOL> val psiToIrOutput = engine . runPsiToIr ( frontendOutput , isProducingLibrary = false ) <EOL> require ( psiToIrOutput is PsiToIrOutput . ForBackend ) <EOL> val backendContext = createBackendContext ( config , frontendOutput , psiToIrOutput ) <EOL> engine . runBackend ( backendContext , psiToIrOutput . irModule ) <EOL> }

/**
 * Produce a bundle that is a directory with code and resources.
 * It consists of
 * - Info.plist
 * - Binary without an entry point.
 *
 * See https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFBundles/AboutBundles/AboutBundles.html
 */


private fun createBackendContext ( config : KonanConfig , frontendOutput : FrontendPhaseOutput . Full , psiToIrOutput : PsiToIrOutput . ForBackend , additionalDataSetter : ( Context ) -> Unit = { } )

= Context ( config , frontendOutput . moduleDescriptor . getIncludedLibraryDescriptors ( config ) . toSet ( ) + frontendOutput . moduleDescriptor , frontendOutput . moduleDescriptor . builtIns as KonanBuiltIns , psiToIrOutput . irModule . irBuiltins , psiToIrOutput . irModules , psiToIrOutput . irLinker , psiToIrOutput . symbols ) . also { <EOL> additionalDataSetter ( it ) <EOL> }


fun assertAlmostEquals ( expected : Double , actual : Double , tolerance : Double ? = null )

{ <EOL> val tolerance_ = tolerance ? . let { abs ( it ) } ? : <NUM_LIT> <EOL> if ( abs ( expected - actual ) > tolerance_ ) { <EOL> assertEquals ( expected , actual ) <EOL> } <EOL> }


fun assertAlmostEquals ( expected : Float , actual : Float , tolerance : Double ? = null )


{ <EOL> assertEquals ( <NUM_LIT:0.0> , sin ( <NUM_LIT:0.0> ) ) <EOL> assertAlmostEquals ( <NUM_LIT:0.0> , sin ( PI ) ) <EOL> assertEquals ( <NUM_LIT:0.0> , asin ( <NUM_LIT:0.0> ) ) <EOL> assertAlmostEquals ( PI / <NUM_LIT:2> , asin ( <NUM_LIT:1.0> ) ) <EOL> assertEquals ( <NUM_LIT:1.0> , cos ( <NUM_LIT:0.0> ) ) <EOL> assertAlmostEquals ( - <NUM_LIT:1.0> , cos ( PI ) ) <EOL> assertEquals ( <NUM_LIT:0.0> , acos ( <NUM_LIT:1.0> ) ) <EOL> assertAlmostEquals ( PI / <NUM_LIT:2> , acos ( <NUM_LIT:0.0> ) ) <EOL> assertEquals ( <NUM_LIT:0.0> , tan ( <NUM_LIT:0.0> ) ) <EOL> assertAlmostEquals ( <NUM_LIT:1.0> , tan ( PI / <NUM_LIT:4> ) ) <EOL> assertAlmostEquals ( <NUM_LIT:0.0> , atan ( <NUM_LIT:0.0> ) ) <EOL> assertAlmostEquals ( PI / <NUM_LIT:4> , atan ( <NUM_LIT:1.0> ) ) <EOL> assertAlmostEquals ( PI / <NUM_LIT:4> , atan2 ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> assertAlmostEquals ( - PI / <NUM_LIT:4> , atan2 ( Double . NEGATIVE_INFINITY , Double . POSITIVE_INFINITY ) ) <EOL> assertAlmostEquals ( <NUM_LIT:0.0> , atan2 ( <NUM_LIT:0.0> , <NUM_LIT:0.0> ) ) <EOL> assertAlmostEquals ( <NUM_LIT:0.0> , atan2 ( <NUM_LIT:0.0> , <NUM_LIT> ) ) <EOL> assertAlmostEquals ( PI / <NUM_LIT:2> , atan2 ( <NUM_LIT:2.0> , <NUM_LIT:0.0> ) ) <EOL> for ( angle in listOf ( Double . NaN , Double . POSITIVE_INFINITY , Double . NEGATIVE_INFINITY ) ) { <EOL> assertTrue ( sin ( angle ) . isNaN ( ) , "<STR_LIT>" ) <EOL> assertTrue ( cos ( angle ) . isNaN ( ) , "<STR_LIT>" ) <EOL> assertTrue ( tan ( angle ) . isNaN ( ) , "<STR_LIT>" ) <EOL> } <EOL> for ( value in listOf ( Double . NaN , <NUM_LIT> , - <NUM_LIT> ) ) { <EOL> assertTrue ( asin ( value ) . isNaN ( ) ) <EOL> assertTrue ( acos ( value ) . isNaN ( ) ) <EOL> } <EOL> assertTrue ( atan ( Double . NaN ) . isNaN ( ) ) <EOL> assertTrue ( atan2 ( Double . NaN , <NUM_LIT:0.0> ) . isNaN ( ) ) <EOL> assertTrue ( atan2 ( <NUM_LIT:0.0> , Double . NaN ) . isNaN ( ) ) <EOL> }


{ <EOL> assertEquals ( Double . POSITIVE_INFINITY , sinh ( Double . POSITIVE_INFINITY ) ) <EOL> assertEquals ( Double . NEGATIVE_INFINITY , sinh ( Double . NEGATIVE_INFINITY ) ) <EOL> assertTrue ( sinh ( Double . MIN_VALUE ) != <NUM_LIT:0.0> ) <EOL> assertTrue ( sinh ( <NUM_LIT> ) . isFinite ( ) ) <EOL> assertTrue ( sinh ( - <NUM_LIT> ) . isFinite ( ) ) <EOL> assertTrue ( sinh ( Double . NaN ) . isNaN ( ) ) <EOL> assertEquals ( Double . POSITIVE_INFINITY , cosh ( Double . POSITIVE_INFINITY ) ) <EOL> assertEquals ( Double . POSITIVE_INFINITY , cosh ( Double . NEGATIVE_INFINITY ) ) <EOL> assertTrue ( cosh ( <NUM_LIT> ) . isFinite ( ) ) <EOL> assertTrue ( cosh ( - <NUM_LIT> ) . isFinite ( ) ) <EOL> assertTrue ( cosh ( Double . NaN ) . isNaN ( ) ) <EOL> assertAlmostEquals ( <NUM_LIT:1.0> , tanh ( Double . POSITIVE_INFINITY ) ) <EOL> assertAlmostEquals ( - <NUM_LIT:1.0> , tanh ( Double . NEGATIVE_INFINITY ) ) <EOL> assertTrue ( tanh ( Double . MIN_VALUE ) != <NUM_LIT:0.0> ) <EOL> assertTrue ( tanh ( Double . NaN ) . isNaN ( ) ) <EOL> }


{ <EOL> for ( exact in listOf ( Double . POSITIVE_INFINITY , Double . NEGATIVE_INFINITY , <NUM_LIT:0.0> , Double . MIN_VALUE , - Double . MIN_VALUE , <NUM_LIT> ) ) { <EOL> assertEquals ( exact , asinh ( sinh ( exact ) ) ) <EOL> } <EOL> for ( approx in listOf ( Double . MIN_VALUE , <NUM_LIT> , <NUM_LIT:1.0> , <NUM_LIT> , <NUM_LIT> ) ) { <EOL> assertAlmostEquals ( approx , asinh ( sinh ( approx ) ) ) <EOL> assertAlmostEquals ( - approx , asinh ( sinh ( - approx ) ) ) <EOL> } <EOL> assertTrue ( asinh ( Double . NaN ) . isNaN ( ) ) <EOL> }


{ <EOL> for ( exact in listOf ( Double . POSITIVE_INFINITY , Double . NEGATIVE_INFINITY , <NUM_LIT:0.0> ) ) { <EOL> assertEquals ( abs ( exact ) , acosh ( cosh ( exact ) ) ) <EOL> } <EOL> for ( approx in listOf ( Double . MIN_VALUE , <NUM_LIT> , <NUM_LIT:1.0> , <NUM_LIT> , <NUM_LIT> ) ) { <EOL> assertAlmostEquals ( approx , acosh ( cosh ( approx ) ) ) <EOL> assertAlmostEquals ( approx , acosh ( cosh ( - approx ) ) ) <EOL> } <EOL> for ( invalid in listOf ( - <NUM_LIT:1.0> , <NUM_LIT:0.0> , <NUM_LIT> , Double . NaN ) ) { <EOL> assertTrue ( acosh ( invalid ) . isNaN ( ) ) <EOL> } <EOL> }


{ <EOL> for ( exact in listOf ( Double . POSITIVE_INFINITY , Double . NEGATIVE_INFINITY , <NUM_LIT:0.0> , Double . MIN_VALUE , - Double . MIN_VALUE ) ) { <EOL> assertEquals ( exact , atanh ( tanh ( exact ) ) ) <EOL> } <EOL> for ( approx in listOf ( <NUM_LIT> ) ) { <EOL> assertAlmostEquals ( approx , atanh ( tanh ( approx ) ) ) <EOL> } <EOL> for ( invalid in listOf ( - <NUM_LIT> , <NUM_LIT> , Double . NaN , Double . MAX_VALUE , - Double . MAX_VALUE , Double . NEGATIVE_INFINITY , Double . POSITIVE_INFINITY ) ) { <EOL> assertTrue ( atanh ( invalid ) . isNaN ( ) ) <EOL> } <EOL> }