fun reportRedundantDependsOnEdges ( project : Project )

{ <EOL> val allDependsOnEdges = dependsOnEdgesAppliedThroughTemplates . flatMap { ( from , to ) -> <EOL> to . internal . withDependsOnClosure . map { from to it } <EOL> } . toSet ( ) <EOL> val redundantEdges = rememberedEdges . intersect ( allDependsOnEdges ) <EOL> if ( redundantEdges . isEmpty ( ) ) return <EOL> val redundantEdgesToReport = redundantEdges . map { edge -> <EOL> KotlinToolingDiagnostics . RedundantDependsOnEdgesFound . RedundantEdge ( from = edge . first . name , to = edge . second . name , ) <EOL> } <EOL> project . reportDiagnosticOncePerProject ( KotlinToolingDiagnostics . RedundantDependsOnEdgesFound ( redundantEdgesToReport ) ) <EOL> }


{ <EOL> val c : Char ? = '<CHAR_LIT:a>' <EOL> if ( c ! ! - '<CHAR_LIT:a>' != <NUM_LIT:0> ) return "<STR_LIT>" <EOL> val b : Boolean ? = false <EOL> if ( b ! ! ) return "<STR_LIT>" <EOL> return "<STR_LIT:OK>" <EOL> }


= "<STR_LIT>"


fun create ( psiJavaModule : PsiJavaModule )

= JavaModuleInfo ( psiJavaModule . name , psiJavaModule . requires . mapNotNull { statement -> <EOL> statement . moduleName ? . let { moduleName -> <EOL> Requires ( moduleName , statement . hasModifierProperty ( PsiModifier . TRANSITIVE ) ) <EOL> } <EOL> } , psiJavaModule . exports . mapNotNull { statement -> <EOL> statement . packageName ? . let { packageName -> <EOL> Exports ( FqName ( packageName ) , statement . moduleNames ) <EOL> } <EOL> } , psiJavaModule . annotations . convert { <EOL> JavaAnnotationImpl ( JavaElementSourceFactory . getInstance ( psiJavaModule . project ) . createPsiSource ( it ) ) <EOL> } )


fun read ( file : VirtualFile , javaFileManager : KotlinCliJavaFileManager , searchScope : GlobalSearchScope ) : JavaModuleInfo ?

{ <EOL> val contents = try { <EOL> file . contentsToByteArray ( ) <EOL> } catch ( e : IOException ) { <EOL> return null <EOL> } <EOL> var moduleName : String ? = null <EOL> val requires = arrayListOf < Requires > ( ) <EOL> val exports = arrayListOf < Exports > ( ) <EOL> val annotations = arrayListOf < JavaAnnotation > ( ) <EOL> try { <EOL> ClassReader ( contents ) . accept ( object : ClassVisitor ( Opcodes . API_VERSION ) { <EOL> override fun visitModule ( name : String , access : Int , version : String ? ) : ModuleVisitor { <EOL> moduleName = name <EOL> return object : ModuleVisitor ( Opcodes . API_VERSION ) { <EOL> override fun visitRequire ( module : String , access : Int , version : String ? ) { <EOL> requires . add ( Requires ( module , ( access and ACC_TRANSITIVE ) != <NUM_LIT:0> ) ) <EOL> } <EOL> override fun visitExport ( packageFqName : String , access : Int , modules : Array < String > ? ) { <EOL> exports . add ( Exports ( FqName ( packageFqName . replace ( '<CHAR_LIT:/>' , '<CHAR_LIT:.>' ) ) , modules ? . toList ( ) . orEmpty ( ) ) ) <EOL> } <EOL> } <EOL> } <EOL> override fun visitAnnotation ( descriptor : String ? , visible : Boolean ) : AnnotationVisitor ? { <EOL> if ( descriptor == null ) return null <EOL> val ( annotation , visitor ) = BinaryJavaAnnotation . createAnnotationAndVisitor ( descriptor , ClassifierResolutionContext { javaFileManager . findClass ( JavaClassFinder . Request ( it ) , searchScope ) } , BinaryClassSignatureParser ( ) , isFreshlySupportedTypeUseAnnotation = true ) <EOL> annotations . add ( annotation ) <EOL> return visitor <EOL> } <EOL> } , ClassReader . SKIP_DEBUG or ClassReader . SKIP_CODE or ClassReader . SKIP_FRAMES ) <EOL> } catch ( e : Exception ) { <EOL> throw IllegalStateException ( "<STR_LIT>" + "<STR_LIT>" , e ) <EOL> } <EOL> return moduleName ? . let { JavaModuleInfo ( it , requires . compact ( ) , exports . compact ( ) , annotations ) } <EOL> }


{ <EOL> val callableId = ( symbol as? FirCallableSymbol < * > ) ? . callableId <EOL> return "<STR_LIT>" <EOL> }


final override fun toString ( ) : String

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


override fun compareTo ( other : DataFlowVariable ) : Int

= variableIndexForDebug . compareTo ( other . variableIndexForDebug )


fun combineWithReceiverStability ( receiverStability : PropertyStability ? ) : PropertyStability

{ <EOL> if ( receiverStability == null ) return this <EOL> if ( this == LOCAL_VAR ) { <EOL> require ( receiverStability == STABLE_VALUE || receiverStability == LOCAL_VAR ) { <EOL> "<STR_LIT>" <EOL> } <EOL> return this <EOL> } <EOL> return maxOf ( this , receiverStability ) <EOL> }


override fun equals ( other : Any ? ) : Boolean

{ <EOL> return this === other <EOL> }


{ <EOL> return _hashCode <EOL> }


{ <EOL> if ( this === other ) return true <EOL> if ( javaClass != other ? . javaClass ) return false <EOL> other as SyntheticVariable <EOL> return fir isEqualsTo other . fir <EOL> }


{ <EOL> return if ( fir is FirResolvedQualifier ) { <EOL> <NUM_LIT:31> * fir . packageFqName . hashCode ( ) + fir . classId . hashCode ( ) <EOL> } else { <EOL> fir . hashCode ( ) <EOL> } <EOL> }


private infix fun FirElement . isEqualsTo ( other : FirElement ) : Boolean

{ <EOL> if ( this !is FirResolvedQualifier || other !is FirResolvedQualifier ) return this == other <EOL> if ( packageFqName != other . packageFqName ) return false <EOL> if ( classId != other . classId ) return false <EOL> return true <EOL> }


open fun isGenerallyOk ( declaration : FirDeclaration , context : CheckerContext , reporter : DiagnosticReporter ) : Boolean

= true


open fun checkSuspendFunctionalParameterWithDefaultValue ( param : FirValueParameter , context : CheckerContext , reporter : DiagnosticReporter , )

{ <EOL> }


open fun checkFunctionalParametersWithInheritedDefaultValues ( function : FirSimpleFunction , context : CheckerContext , reporter : DiagnosticReporter , overriddenSymbols : List < FirCallableSymbol < FirCallableDeclaration > > , )

{ <EOL> }


private fun TimeMark . assertHasPassed ( hasPassed : Boolean )

{ <EOL> assertEquals ( ! hasPassed , this . hasNotPassedNow ( ) , "<STR_LIT>" ) <EOL> assertEquals ( hasPassed , this . hasPassedNow ( ) , "<STR_LIT>" ) <EOL> assertEquals ( ! hasPassed , this . elapsedNow ( ) < Duration . ZERO , "<STR_LIT>" ) <EOL> }


fun testAdjustment ( timeSource : TimeSource . WithComparableMarks )

{ <EOL> val mark = timeSource . markNow ( ) <EOL> for ( unit in units ) { <EOL> val markFuture1 = ( mark + <NUM_LIT:1> . toDuration ( unit ) ) . apply { assertHasPassed ( false ) } <EOL> val markFuture2 = ( mark - ( - <NUM_LIT:1> ) . toDuration ( unit ) ) . apply { assertHasPassed ( false ) } <EOL> assertDifferentMarks ( markFuture1 , mark , <NUM_LIT:1> ) <EOL> assertDifferentMarks ( markFuture2 , mark , <NUM_LIT:1> ) <EOL> val markPast1 = ( mark - <NUM_LIT:1> . toDuration ( unit ) ) . apply { assertHasPassed ( true ) } <EOL> val markPast2 = ( markFuture1 + ( - <NUM_LIT:2> ) . toDuration ( unit ) ) . apply { assertHasPassed ( true ) } <EOL> assertDifferentMarks ( markPast1 , mark , - <NUM_LIT:1> ) <EOL> assertDifferentMarks ( markPast2 , mark , - <NUM_LIT:1> ) <EOL> if ( unit > DurationUnit . NANOSECONDS ) { <EOL> val d = <NUM_LIT:1> . toDuration ( unit ) <EOL> val h = d / <NUM_LIT:2> <EOL> val markH1 = mark + h <EOL> val markH2 = mark + d - h <EOL> assertEqualMarks ( markH1 , markH2 ) <EOL> } <EOL> } <EOL> }


{ <EOL> testAdjustment ( TestTimeSource ( ) ) <EOL> for ( unit in units ) { <EOL> testAdjustment ( LongTimeSource ( unit ) ) <EOL> } <EOL> }


@ Test <EOL> fun adjustmentTestTimeSource ( )

{ <EOL> val timeSource = TestTimeSource ( ) <EOL> val mark = timeSource . markNow ( ) <EOL> val markFuture1 = mark + <NUM_LIT:1> . milliseconds <EOL> val markPast1 = mark - <NUM_LIT:1> . milliseconds <EOL> timeSource += <NUM_LIT> . nanoseconds <EOL> val markElapsed = timeSource . markNow ( ) <EOL> val elapsedDiff = markElapsed - mark <EOL> val elapsed = mark . elapsedNow ( ) <EOL> val elapsedFromFuture = elapsed - <NUM_LIT:1> . milliseconds <EOL> val elapsedFromPast = elapsed + <NUM_LIT:1> . milliseconds <EOL> assertEquals ( <NUM_LIT> . milliseconds , elapsed ) <EOL> assertEquals ( elapsedFromFuture , markFuture1 . elapsedNow ( ) ) <EOL> assertEquals ( elapsedDiff , elapsed ) <EOL> val markToElapsed = mark + elapsedDiff <EOL> assertEqualMarks ( markElapsed , markToElapsed ) <EOL> assertEquals ( elapsedFromPast , markPast1 . elapsedNow ( ) ) <EOL> markFuture1 . assertHasPassed ( false ) <EOL> markPast1 . assertHasPassed ( true ) <EOL> timeSource += <NUM_LIT:1> . milliseconds <EOL> markFuture1 . assertHasPassed ( true ) <EOL> markPast1 . assertHasPassed ( true ) <EOL> }


fun testAdjustmentBig ( timeSource : TimeSource . WithComparableMarks )

{ <EOL> val baseMark = timeSource . markNow ( ) <EOL> val longDuration = Long . MAX_VALUE . nanoseconds <EOL> val long2Duration = longDuration + <NUM_LIT> . milliseconds <EOL> val pastMark = baseMark - longDuration <EOL> val futureMark = pastMark + long2Duration <EOL> val sameMark = futureMark - ( long2Duration - longDuration ) <EOL> val elapsedMark = timeSource . markNow ( ) <EOL> run { <EOL> val iterations = <NUM_LIT:1> .. <NUM_LIT:100> <EOL> for ( i in iterations ) { <EOL> val elapsedDiff1 = ( sameMark . elapsedNow ( ) - baseMark . elapsedNow ( ) ) . absoluteValue <EOL> val elapsedDiff2 = ( baseMark . elapsedNow ( ) - sameMark . elapsedNow ( ) ) . absoluteValue <EOL> if ( maxOf ( elapsedDiff1 , elapsedDiff2 ) < <NUM_LIT:1> . milliseconds ) break <EOL> if ( i == iterations . last ) fail ( "<STR_LIT>" ) <EOL> } <EOL> } <EOL> val elapsedBaseDiff = elapsedMark - baseMark <EOL> val elapsedSameDiff = elapsedMark - sameMark <EOL> assertTrue ( ( elapsedBaseDiff - elapsedSameDiff ) . absoluteValue < <NUM_LIT:1> . milliseconds , "<STR_LIT>" ) <EOL> }


{ <EOL> testAdjustmentBig ( TestTimeSource ( ) ) <EOL> for ( unit in units ) { <EOL> testAdjustmentBig ( LongTimeSource ( unit ) ) <EOL> } <EOL> }


fun testAdjustmentInfinite ( timeSource : TimeSource . WithComparableMarks )

{ <EOL> val baseMark = timeSource . markNow ( ) <EOL> val infiniteFutureMark = baseMark + Duration . INFINITE <EOL> val infinitePastMark = baseMark - Duration . INFINITE <EOL> assertDifferentMarks ( infinitePastMark , baseMark , - <NUM_LIT:1> ) <EOL> assertDifferentMarks ( infiniteFutureMark , baseMark , <NUM_LIT:1> ) <EOL> assertDifferentMarks ( infinitePastMark , infiniteFutureMark , - <NUM_LIT:1> ) <EOL> assertEquals ( Duration . INFINITE , infiniteFutureMark - infinitePastMark ) <EOL> assertEquals ( Duration . INFINITE , infiniteFutureMark - baseMark ) <EOL> assertEquals ( - Duration . INFINITE , infinitePastMark - baseMark ) <EOL> assertEqualMarks ( infiniteFutureMark , infiniteFutureMark ) <EOL> assertEqualMarks ( infinitePastMark , infinitePastMark ) <EOL> assertEquals ( - Duration . INFINITE , infiniteFutureMark . elapsedNow ( ) ) <EOL> assertTrue ( infiniteFutureMark . hasNotPassedNow ( ) ) <EOL> assertEquals ( Duration . INFINITE , infinitePastMark . elapsedNow ( ) ) <EOL> assertTrue ( infinitePastMark . hasPassedNow ( ) ) <EOL> assertFailsWith < IllegalArgumentException > { infiniteFutureMark - Duration . INFINITE } <EOL> assertFailsWith < IllegalArgumentException > { infinitePastMark + Duration . INFINITE } <EOL> for ( infiniteMark in listOf ( infiniteFutureMark , infinitePastMark ) ) { <EOL> for ( offset in listOf ( Duration . ZERO , <NUM_LIT:1> . nanoseconds , <NUM_LIT:10> . microseconds , <NUM_LIT:1> . milliseconds , <NUM_LIT> . seconds ) ) { <EOL> assertEqualMarks ( infiniteMark , infiniteMark + offset ) <EOL> assertEqualMarks ( infiniteMark , infiniteMark - offset ) <EOL> } <EOL> } <EOL> }


{ <EOL> testAdjustmentInfinite ( TestTimeSource ( ) ) <EOL> for ( unit in units ) { <EOL> testAdjustmentInfinite ( LongTimeSource ( unit ) ) <EOL> } <EOL> }


fun testLongAdjustmentElapsedPrecision ( timeSource : TimeSource . WithComparableMarks , wait : ( Duration ) -> Unit )

{ <EOL> val baseMark = timeSource . markNow ( ) <EOL> val longDuration = Long . MAX_VALUE . nanoseconds <EOL> val waitDuration = <NUM_LIT:20> . milliseconds <EOL> val pastMark = baseMark - longDuration <EOL> wait ( waitDuration ) <EOL> val elapsedMark = timeSource . markNow ( ) <EOL> val elapsed = pastMark . elapsedNow ( ) <EOL> val elapsedDiff = elapsedMark - pastMark <EOL> assertTrue ( elapsed > longDuration ) <EOL> assertTrue ( elapsed >= longDuration + waitDuration , "<STR_LIT>" ) <EOL> assertTrue ( elapsedDiff >= longDuration + waitDuration ) <EOL> assertTrue ( elapsed >= elapsedDiff ) <EOL> }


{ <EOL> val timeSource = TestTimeSource ( ) <EOL> testLongAdjustmentElapsedPrecision ( timeSource , { waitDuration -> timeSource += waitDuration } ) <EOL> }


private fun assertEqualMarks ( mark1 : ComparableTimeMark , mark2 : ComparableTimeMark )

{ <EOL> assertEquals ( Duration . ZERO , mark1 - mark2 ) <EOL> assertEquals ( Duration . ZERO , mark2 - mark1 ) <EOL> assertEquals ( <NUM_LIT:0> , mark1 compareTo mark2 ) <EOL> assertEquals ( <NUM_LIT:0> , mark2 compareTo mark1 ) <EOL> assertEquals ( mark1 , mark2 ) <EOL> assertEquals ( mark1 . hashCode ( ) , mark2 . hashCode ( ) , "<STR_LIT>" ) <EOL> }


private fun assertDifferentMarks ( mark1 : ComparableTimeMark , mark2 : ComparableTimeMark , expectedCompare : Int )

{ <EOL> assertNotEquals ( Duration . ZERO , mark1 - mark2 ) <EOL> assertNotEquals ( Duration . ZERO , mark2 - mark1 ) <EOL> assertEquals ( expectedCompare , ( mark1 compareTo mark2 ) . sign ) <EOL> assertEquals ( - expectedCompare , ( mark2 compareTo mark1 ) . sign ) <EOL> assertNotEquals ( mark1 , mark2 ) <EOL> }


@ Test <EOL> fun timeMarkDifferenceAndComparison ( )

{ <EOL> val timeSource = TestTimeSource ( ) <EOL> val timeSource2 = TestTimeSource ( ) <EOL> val baseMark = timeSource . markNow ( ) <EOL> var markBefore = baseMark <EOL> markBefore -= <NUM_LIT:100> . microseconds <EOL> markBefore -= <NUM_LIT:100> . microseconds <EOL> val markAfter = baseMark + <NUM_LIT:100> . microseconds <EOL> assertEquals ( <NUM_LIT> . microseconds , markAfter - markBefore ) <EOL> assertTrue ( markBefore < markAfter ) <EOL> assertFalse ( markBefore > markAfter ) <EOL> assertEqualMarks ( baseMark , baseMark ) <EOL> timeSource += <NUM_LIT:100> . microseconds <EOL> val markElapsed = timeSource . markNow ( ) <EOL> assertEqualMarks ( markElapsed , markAfter ) <EOL> val differentSourceMark = TimeSource . Monotonic . markNow ( ) <EOL> assertFailsWith < IllegalArgumentException > { baseMark - differentSourceMark } <EOL> assertFailsWith < IllegalArgumentException > { baseMark < differentSourceMark } <EOL> val differentSourceMark2 = timeSource2 . markNow ( ) <EOL> assertFailsWith < IllegalArgumentException > { baseMark - differentSourceMark2 } <EOL> assertFailsWith < IllegalArgumentException > { baseMark < differentSourceMark2 } <EOL> }


= reading


@ Test <EOL> fun longTimeMarkInfinities ( )

{ <EOL> for ( unit in units ) { <EOL> val timeSource = LongTimeSource ( unit ) . apply { <EOL> markNow ( ) <EOL> reading = Long . MIN_VALUE + <NUM_LIT:1> <EOL> } <EOL> val mark1 = timeSource . markNow ( ) <EOL> timeSource . reading = <NUM_LIT:0> <EOL> val mark2 = timeSource . markNow ( ) - Duration . INFINITE <EOL> if ( unit >= DurationUnit . MILLISECONDS ) { <EOL> assertEquals ( Duration . INFINITE , mark1 . elapsedNow ( ) ) <EOL> } <EOL> assertEquals ( Duration . INFINITE , mark2 . elapsedNow ( ) ) <EOL> assertDifferentMarks ( mark1 , mark2 , <NUM_LIT:1> ) <EOL> val mark3 = mark1 + Duration . INFINITE <EOL> assertEquals ( - Duration . INFINITE , mark3 . elapsedNow ( ) , "<STR_LIT>" ) <EOL> val mark4 = timeSource . markNow ( ) + Duration . INFINITE <EOL> assertEquals ( - Duration . INFINITE , mark4 . elapsedNow ( ) ) <EOL> assertEqualMarks ( mark3 , mark4 ) <EOL> } <EOL> }


@ Test <EOL> fun doubleTimeMarkInfiniteEqualHashCode ( )

{ <EOL> val timeSource = DoubleTimeSource ( unit = DurationUnit . MILLISECONDS ) . apply { reading = - Double . MAX_VALUE } <EOL> val mark1 = timeSource . markNow ( ) <EOL> timeSource . reading = <NUM_LIT:0.0> <EOL> val mark2 = timeSource . markNow ( ) - Duration . INFINITE <EOL> assertEquals ( Duration . INFINITE , mark1 . elapsedNow ( ) ) <EOL> assertEquals ( Duration . INFINITE , mark2 . elapsedNow ( ) ) <EOL> assertEqualMarks ( mark1 , mark2 ) <EOL> }


@ Test <EOL> fun longTimeMarkRoundingEqualHashCode ( )

{ <EOL> run { <EOL> val step = Long . MAX_VALUE / <NUM_LIT:4> <EOL> val timeSource = LongTimeSource ( DurationUnit . NANOSECONDS ) <EOL> val mark0 = timeSource . markNow ( ) + step . nanoseconds + step . nanoseconds <EOL> timeSource . reading += step <EOL> val mark1 = timeSource . markNow ( ) + step . nanoseconds <EOL> timeSource . reading += step <EOL> val mark2 = timeSource . markNow ( ) <EOL> assertEqualMarks ( mark1 , mark2 ) <EOL> assertEqualMarks ( mark0 , mark2 ) <EOL> assertEqualMarks ( mark0 , mark1 ) <EOL> } <EOL> for ( unit in units ) { <EOL> val baseReading = Long . MAX_VALUE - <NUM_LIT> <EOL> val timeSource = LongTimeSource ( unit ) . apply { reading = baseReading } <EOL> val baseMark = timeSource . markNow ( ) <EOL> for ( delta in listOf ( ( <NUM_LIT:1> ..< <NUM_LIT> ) . random ( ) , ( <NUM_LIT> ..< <NUM_LIT> ) . random ( ) ) ) { <EOL> val deltaDuration = delta . toDuration ( unit ) <EOL> timeSource . reading = baseReading + delta <EOL> val mark1e = timeSource . markNow ( ) <EOL> assertEquals ( deltaDuration , mark1e - baseMark ) <EOL> val mark1d = baseMark + deltaDuration <EOL> assertEqualMarks ( mark1e , mark1d ) <EOL> val subUnit = units . getOrNull ( units . indexOf ( unit ) - <NUM_LIT:1> ) ? : continue <EOL> val deltaSubUnitDuration = delta . toDuration ( subUnit ) <EOL> val mark1s = baseMark + deltaSubUnitDuration <EOL> assertDifferentMarks ( mark1s , baseMark , <NUM_LIT:1> ) <EOL> assertEquals ( deltaSubUnitDuration , mark1s - baseMark ) <EOL> } <EOL> run { <EOL> val delta = <NUM_LIT> <EOL> val deltaDuration = delta . toDuration ( unit ) <EOL> timeSource . reading = baseReading + <NUM_LIT> <EOL> val mark2 = timeSource . markNow ( ) <EOL> assertEquals ( deltaDuration , mark2 - baseMark ) <EOL> val offset = Long . MAX_VALUE . nanoseconds <EOL> val mark2e = mark2 + offset <EOL> val mark2d = baseMark + offset + deltaDuration <EOL> assertEqualMarks ( mark2e , mark2d ) <EOL> } <EOL> } <EOL> }


@ Test <EOL> fun defaultTimeMarkAdjustment ( )

{ <EOL> val baseMark = TimeSource . Monotonic . markNow ( ) <EOL> var markBefore = baseMark <EOL> markBefore -= <NUM_LIT:100> . microseconds <EOL> markBefore -= <NUM_LIT:100> . microseconds <EOL> val markAfter = baseMark + <NUM_LIT:100> . microseconds <EOL> MeasureTimeTest . longRunningCalc ( ) <EOL> val elapsedMark = TimeSource . Monotonic . markNow ( ) <EOL> val elapsedDiff = elapsedMark - baseMark <EOL> assertTrue ( elapsedDiff > Duration . ZERO ) <EOL> val elapsedAfter = markAfter . elapsedNow ( ) <EOL> val elapsedBase = baseMark . elapsedNow ( ) <EOL> val elapsedBefore = markBefore . elapsedNow ( ) <EOL> assertTrue ( elapsedBefore >= elapsedBase + <NUM_LIT> . microseconds ) <EOL> assertTrue ( elapsedAfter <= elapsedBase - <NUM_LIT:100> . microseconds ) <EOL> assertTrue ( elapsedBase >= elapsedDiff ) <EOL> }


@ Test <EOL> fun defaultTimeMarkAdjustmentBig ( )

{ <EOL> if ( TestPlatform . current == TestPlatform . WasmWasi ) return <EOL> testAdjustmentBig ( TimeSource . Monotonic ) <EOL> val baseMark = TimeSource . Monotonic . markNow ( ) <EOL> val longDuration = Long . MAX_VALUE . nanoseconds <EOL> val long2Duration = longDuration + <NUM_LIT> . milliseconds <EOL> val pastMark = baseMark - longDuration <EOL> val futureMark = pastMark + long2Duration <EOL> val sameMark = futureMark - ( long2Duration - longDuration ) <EOL> run { <EOL> val iterations = <NUM_LIT:1> .. <NUM_LIT:100> <EOL> for ( i in iterations ) { <EOL> val elapsedDiff1 = ( sameMark . elapsedNow ( ) - baseMark . elapsedNow ( ) ) . absoluteValue <EOL> val elapsedDiff2 = ( baseMark . elapsedNow ( ) - sameMark . elapsedNow ( ) ) . absoluteValue <EOL> if ( maxOf ( elapsedDiff1 , elapsedDiff2 ) < <NUM_LIT:1> . milliseconds ) break <EOL> if ( i == iterations . last ) fail ( "<STR_LIT>" ) <EOL> } <EOL> } <EOL> val elapsedMark = TimeSource . Monotonic . markNow ( ) <EOL> val elapsedBaseDiff = elapsedMark - baseMark <EOL> val elapsedSameDiff = elapsedMark - sameMark <EOL> assertTrue ( ( elapsedBaseDiff - elapsedSameDiff ) . absoluteValue < <NUM_LIT:1> . milliseconds , "<STR_LIT>" ) <EOL> }


@ Test <EOL> fun defaultTimeMarkAdjustmentInfinite ( )

{ <EOL> if ( TestPlatform . current == TestPlatform . WasmWasi ) return <EOL> testAdjustmentInfinite ( TimeSource . Monotonic ) <EOL> val baseMark = TimeSource . Monotonic . markNow ( ) <EOL> val infiniteFutureMark = baseMark + Duration . INFINITE <EOL> val infinitePastMark = baseMark - Duration . INFINITE <EOL> assertEquals ( - Duration . INFINITE , infiniteFutureMark . elapsedNow ( ) ) <EOL> assertTrue ( infiniteFutureMark . hasNotPassedNow ( ) ) <EOL> assertEquals ( Duration . INFINITE , infinitePastMark . elapsedNow ( ) ) <EOL> assertTrue ( infinitePastMark . hasPassedNow ( ) ) <EOL> assertFailsWith < IllegalArgumentException > { infiniteFutureMark - Duration . INFINITE } <EOL> assertFailsWith < IllegalArgumentException > { infinitePastMark + Duration . INFINITE } <EOL> }


@ Test <EOL> fun defaultTimeMarkDifferenceAndComparison ( )

{ <EOL> val baseMark = TimeSource . Monotonic . markNow ( ) <EOL> var markBefore = baseMark <EOL> markBefore -= <NUM_LIT:100> . microseconds <EOL> markBefore -= <NUM_LIT:100> . microseconds <EOL> val markAfter = baseMark + <NUM_LIT:100> . microseconds <EOL> assertEquals ( <NUM_LIT> . microseconds , markAfter - markBefore ) <EOL> assertTrue ( markBefore < markAfter ) <EOL> assertFalse ( markBefore > markAfter ) <EOL> assertEquals ( <NUM_LIT:0> , baseMark compareTo baseMark ) <EOL> assertEquals ( baseMark as Any , baseMark as Any ) <EOL> assertEquals ( baseMark . hashCode ( ) , baseMark . hashCode ( ) ) <EOL> val differentSourceMark = TestTimeSource ( ) . markNow ( ) <EOL> assertFailsWith < IllegalArgumentException > { baseMark - differentSourceMark } <EOL> assertFailsWith < IllegalArgumentException > { baseMark < differentSourceMark } <EOL> }


public fun hasTag ( tag : JavadocTag ) : Boolean


public fun resolveTag ( tag : JavadocTag ) : List < DocumentationContent >


private fun DeclarationSymbolMarker . asSymbol ( ) : FirBasedSymbol < * >

= this as FirBasedSymbol < * >


private fun CallableSymbolMarker . asSymbol ( ) : FirCallableSymbol < * >

= this as FirCallableSymbol < * >


private fun FunctionSymbolMarker . asSymbol ( ) : FirFunctionSymbol < * >

= this as FirFunctionSymbol < * >


private fun PropertySymbolMarker . asSymbol ( ) : FirPropertySymbol

= this as FirPropertySymbol


private fun ValueParameterSymbolMarker . asSymbol ( ) : FirValueParameterSymbol

= this as FirValueParameterSymbol


private fun TypeParameterSymbolMarker . asSymbol ( ) : FirTypeParameterSymbol

= this as FirTypeParameterSymbol


private fun ClassLikeSymbolMarker . asSymbol ( ) : FirClassLikeSymbol < * >

= this as FirClassLikeSymbol < * >


private fun RegularClassSymbolMarker . asSymbol ( ) : FirRegularClassSymbol

= this as FirRegularClassSymbol


private fun TypeAliasSymbolMarker . asSymbol ( ) : FirTypeAliasSymbol

= this as FirTypeAliasSymbol


override fun TypeAliasSymbolMarker . expandToRegularClass ( ) : RegularClassSymbolMarker ?

{ <EOL> return asSymbol ( ) <EOL> . resolvedExpandedTypeRef <EOL> . coneType <EOL> . fullyExpandedType ( actualSession ) <EOL> . toSymbol ( actualSession ) as? FirRegularClassSymbol <EOL> }


override fun createExpectActualTypeParameterSubstitutor ( expectActualTypeParameters : List < Pair < TypeParameterSymbolMarker , TypeParameterSymbolMarker > > , parentSubstitutor : TypeSubstitutorMarker ? , ) : TypeSubstitutorMarker

{ <EOL> @ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> return createExpectActualTypeParameterSubstitutor ( expectActualTypeParameters as List < Pair < FirTypeParameterSymbol , FirTypeParameterSymbol > > , actualSession , parentSubstitutor as ConeSubstitutor ? <EOL> ) <EOL> }


override fun RegularClassSymbolMarker . collectAllMembers ( isActualDeclaration : Boolean ) : List < FirBasedSymbol < * > >

{ <EOL> val symbol = asSymbol ( ) <EOL> val session = when ( isActualDeclaration ) { <EOL> true -> actualSession <EOL> false -> symbol . moduleData . session <EOL> } <EOL> val scope = symbol . defaultType ( ) . scope ( useSiteSession = session , if ( isActualDeclaration ) actualScopeSession else expectScopeSession , CallableCopyTypeCalculator . DoNothing , requiredMembersPhase = FirResolvePhase . STATUS , ) ? : return emptyList ( ) <EOL> return mutableListOf < FirBasedSymbol < * > > ( ) . apply { <EOL> for ( name in scope . getCallableNames ( ) ) { <EOL> scope . getMembersTo ( this , name ) <EOL> } <EOL> for ( name in scope . getClassifierNames ( ) ) { <EOL> scope . processClassifiersByName ( name ) { <EOL> if ( it is FirRegularClassSymbol && it . classId . parentClassId == symbol . classId ) { <EOL> add ( it ) <EOL> } <EOL> } <EOL> } <EOL> getConstructorsTo ( this , scope ) <EOL> } <EOL> }


override fun RegularClassSymbolMarker . getMembersForExpectClass ( name : Name ) : List < FirCallableSymbol < * > >

{ <EOL> val symbol = asSymbol ( ) <EOL> val scope = symbol . defaultType ( ) . scope ( useSiteSession = symbol . moduleData . session , expectScopeSession , CallableCopyTypeCalculator . DoNothing , requiredMembersPhase = FirResolvePhase . STATUS , ) ? : return emptyList ( ) <EOL> return mutableListOf < FirCallableSymbol < * > > ( ) . apply { <EOL> scope . getMembersTo ( this , name ) <EOL> } <EOL> }


override fun FirClassSymbol < * > . getConstructors ( scopeSession : ScopeSession , session : FirSession , ) : Collection < FirConstructorSymbol >

= mutableListOf < FirConstructorSymbol > ( ) . apply { <EOL> getConstructorsTo ( this , unsubstitutedScope ( session , scopeSession , withForcedTypeCalculator = false , memberRequiredPhase = FirResolvePhase . STATUS , ) ) <EOL> }


private fun getConstructorsTo ( destination : MutableList < in FirConstructorSymbol > , scope : FirTypeScope )

{ <EOL> scope . getDeclaredConstructors ( ) . mapTo ( destination ) { it } <EOL> }


private fun FirTypeScope . getMembersTo ( destination : MutableList < in FirCallableSymbol < * > > , name : Name )

{ <EOL> processFunctionsByName ( name ) { destination . add ( it ) } <EOL> processPropertiesByName ( name ) { destination . add ( it ) } <EOL> }


override fun RegularClassSymbolMarker . collectEnumEntryNames ( ) : List < Name >

{ <EOL> return asSymbol ( ) . fir . collectEnumEntries ( ) . map { it . name } <EOL> }


override fun RegularClassSymbolMarker . collectEnumEntries ( ) : List < DeclarationSymbolMarker >

{ <EOL> return asSymbol ( ) . fir . collectEnumEntries ( ) . map { it . symbol } <EOL> }


override fun FunctionSymbolMarker . allRecursivelyOverriddenDeclarationsIncludingSelf ( containingClass : RegularClassSymbolMarker ? ) : List < CallableSymbolMarker >

{ <EOL> return when ( val symbol = asSymbol ( ) ) { <EOL> is FirConstructorSymbol , is FirFunctionWithoutNameSymbol -> listOf ( symbol ) <EOL> is FirNamedFunctionSymbol -> { <EOL> if ( containingClass == null ) return listOf ( symbol ) <EOL> val session = symbol . moduleData . session <EOL> ( listOf ( symbol ) + symbol . overriddenFunctions ( containingClass . asSymbol ( ) , session , actualScopeSession ) . asSequence ( ) ) <EOL> . filter { ! it . isSubstitutionOrIntersectionOverride && it . origin != FirDeclarationOrigin . Delegated } <EOL> } <EOL> } <EOL> }


override fun CallableSymbolMarker . isAnnotationConstructor ( ) : Boolean

{ <EOL> val symbol = asSymbol ( ) <EOL> return symbol . isAnnotationConstructor ( symbol . moduleData . session ) <EOL> }


override fun areCompatibleExpectActualTypes ( expectType : KotlinTypeMarker ? , actualType : KotlinTypeMarker ? , parameterOfAnnotationComparisonMode : Boolean , dynamicTypesEqualToAnything : Boolean ) : Boolean

{ <EOL> if ( expectType == null ) return actualType == null <EOL> if ( actualType == null ) return false <EOL> if ( ! dynamicTypesEqualToAnything ) { <EOL> val isExpectedDynamic = expectType is ConeDynamicType <EOL> val isActualDynamic = actualType is ConeDynamicType <EOL> if ( isExpectedDynamic && ! isActualDynamic || ! isExpectedDynamic && isActualDynamic ) { <EOL> return false <EOL> } <EOL> } <EOL> val actualizedExpectType = ( expectType as ConeKotlinType ) . actualize ( ) <EOL> val actualizedActualType = ( actualType as ConeKotlinType ) . actualize ( ) <EOL> if ( parameterOfAnnotationComparisonMode && actualizedExpectType is ConeClassLikeType && actualizedExpectType . isArrayType && actualizedActualType is ConeClassLikeType && actualizedActualType . isArrayType ) { <EOL> return AbstractTypeChecker . equalTypes ( createTypeCheckerState ( ) , actualizedExpectType . convertToArrayWithOutProjections ( ) , actualizedActualType . convertToArrayWithOutProjections ( ) ) <EOL> } <EOL> return AbstractTypeChecker . equalTypes ( actualSession . typeContext , actualizedExpectType , actualizedActualType ) <EOL> }


private fun ConeClassLikeType . convertToArrayWithOutProjections ( ) : ConeClassLikeType

{ <EOL> val argumentsWithOutProjection = Array ( typeArguments . size ) { i -> <EOL> val typeArgument = typeArguments [ i ] <EOL> if ( typeArgument !is ConeKotlinType ) typeArgument <EOL> else ConeKotlinTypeProjectionOut ( typeArgument ) <EOL> } <EOL> return ConeClassLikeTypeImpl ( lookupTag , argumentsWithOutProjection , isNullable ) <EOL> }


override fun isSubtypeOf ( superType : KotlinTypeMarker , subType : KotlinTypeMarker ) : Boolean

{ <EOL> return AbstractTypeChecker . isSubtypeOf ( createTypeCheckerState ( ) , subType = subType , superType = superType ) <EOL> }


private fun ConeKotlinType . actualize ( ) : ConeKotlinType

{ <EOL> val classId = classId <EOL> if ( this is ConeClassLikeType && classId ? . isNestedClass == true ) { <EOL> val classSymbol = classId . toSymbol ( actualSession ) <EOL> if ( classSymbol is FirRegularClassSymbol && classSymbol . isExpect ) { <EOL> tryExpandExpectNestedClassActualizedViaTypealias ( this , classSymbol ) ? . let { <EOL> return it . actualizeTypeArguments ( ) <EOL> } <EOL> } <EOL> } <EOL> return fullyExpandedType ( actualSession ) . actualizeTypeArguments ( ) <EOL> }


private fun ConeKotlinType . actualizeTypeArguments ( ) : ConeKotlinType

{ <EOL> if ( this !is ConeClassLikeType ) { <EOL> return this <EOL> } <EOL> return withArguments { arg -> <EOL> if ( arg is ConeKotlinTypeProjection ) { <EOL> arg . replaceType ( arg . type . actualize ( ) ) as ConeTypeProjection <EOL> } else arg <EOL> } <EOL> }


private fun tryExpandExpectNestedClassActualizedViaTypealias ( expectNestedClassType : ConeClassLikeType , expectNestedClassSymbol : FirRegularClassSymbol , ) : ConeClassLikeType ?

{ <EOL> val expectNestedClassId = expectNestedClassSymbol . classId <EOL> val expectOutermostClassId = expectNestedClassId . outermostClassId <EOL> val actualTypealiasSymbol = expectOutermostClassId . toSymbol ( actualSession ) as? FirTypeAliasSymbol ? : return null <EOL> val actualOutermostClassId = actualTypealiasSymbol . fullyExpandedClass ( actualSession ) ? . classId ? : return null <EOL> val actualNestedClassId = ClassId . fromString ( expectNestedClassId . asString ( ) . replaceFirst ( expectOutermostClassId . asString ( ) , actualOutermostClassId . asString ( ) ) ) <EOL> return actualNestedClassId . constructClassLikeType ( expectNestedClassType . typeArguments , expectNestedClassType . isNullable , expectNestedClassType . attributes ) <EOL> }

/**
 * In case of `expect` nested classes actualized via typealias we can't simply find actual symbol by `expect` `ClassId`
 * (like we do for top-level classes), because `ClassId` is different.
 * For example, `expect` class `com/example/ExpectClass.Nested` may have actual with id `real/package/ActualTypeliasTarget.Nested`.
 * So, we first expand outermost class, and then construct `ClassId` for nested class.
 */


private fun createTypeCheckerState ( ) : TypeCheckerState

{ <EOL> return actualSession . typeContext . newTypeCheckerState ( errorTypesEqualToAnything = true , stubTypesEqualToAnything = false ) <EOL> }


override fun RegularClassSymbolMarker . isNotSamInterface ( ) : Boolean

{ <EOL> val type = asSymbol ( ) . defaultType ( ) <EOL> val isSam = FirSamResolver ( actualSession , actualScopeSession ) . isSamType ( type ) <EOL> return ! isSam <EOL> }


override fun CallableSymbolMarker . isFakeOverride ( containingExpectClass : RegularClassSymbolMarker ? ) : Boolean

{ <EOL> if ( containingExpectClass == null ) { <EOL> return false <EOL> } <EOL> val symbol = asSymbol ( ) <EOL> val classSymbol = containingExpectClass . asSymbol ( ) <EOL> if ( symbol !is FirConstructorSymbol && symbol . dispatchReceiverType ? . classId != classSymbol . classId ) { <EOL> return true <EOL> } <EOL> return symbol . isSubstitutionOrIntersectionOverride <EOL> }


override fun areAnnotationArgumentsEqual ( expectAnnotation : AnnotationCallInfo , actualAnnotation : AnnotationCallInfo , collectionArgumentsCompatibilityCheckStrategy : ExpectActualCollectionArgumentsCompatibilityCheckStrategy , ) : Boolean

{ <EOL> fun AnnotationCallInfo . getFirAnnotation ( ) : FirAnnotation { <EOL> return ( this as AnnotationCallInfoImpl ) . annotation <EOL> } <EOL> return areFirAnnotationsEqual ( expectAnnotation . getFirAnnotation ( ) , actualAnnotation . getFirAnnotation ( ) ) <EOL> }


private fun areFirAnnotationsEqual ( annotation1 : FirAnnotation , annotation2 : FirAnnotation ) : Boolean

{ <EOL> fun FirAnnotation . hasResolvedArguments ( ) : Boolean { <EOL> return resolved || ( this is FirAnnotationCall && arguments . isEmpty ( ) ) <EOL> } <EOL> check ( annotation1 . hasResolvedArguments ( ) && annotation2 . hasResolvedArguments ( ) ) { <EOL> "<STR_LIT>" <EOL> } <EOL> if ( ! areCompatibleExpectActualTypes ( annotation1 . resolvedType , annotation2 . resolvedType , parameterOfAnnotationComparisonMode = false ) ) { <EOL> return false <EOL> } <EOL> val args1 = annotation1 . argumentMapping . mapping <EOL> val args2 = annotation2 . argumentMapping . mapping <EOL> if ( args1 . size != args2 . size ) { <EOL> return false <EOL> } <EOL> return args1 . all { ( key , value1 ) -> <EOL> val value2 = args2 [ key ] <EOL> value2 != null && areAnnotationArgumentsEqual ( value1 , value2 ) <EOL> } <EOL> }


private fun areAnnotationArgumentsEqual ( expression1 : FirExpression , expression2 : FirExpression ) : Boolean

{ <EOL> return when { <EOL> expression1 is FirLiteralExpression < * > && expression2 is FirLiteralExpression < * > -> { <EOL> expression1 . value == expression2 . value <EOL> } <EOL> else -> true <EOL> } <EOL> }


private fun getAnnotationClass ( ) : FirRegularClassSymbol ?

= <EOL> getAnnotationConeType ( ) ? . toRegularClassSymbol ( actualSession )


private fun getAnnotationConeType ( ) : ConeClassLikeType ?

{ <EOL> val coneType = annotation . toAnnotationClassLikeType ( actualSession ) ? . actualize ( ) as? ConeClassLikeType <EOL> if ( coneType is ConeErrorType ) { <EOL> return null <EOL> } <EOL> return coneType <EOL> }


override fun onMatchedMembers ( expectSymbol : DeclarationSymbolMarker , actualSymbol : DeclarationSymbolMarker , containingExpectClassSymbol : RegularClassSymbolMarker ? , containingActualClassSymbol : RegularClassSymbolMarker ? <EOL> )

{ <EOL> if ( containingActualClassSymbol == null || containingExpectClassSymbol == null ) return <EOL> containingActualClassSymbol . asSymbol ( ) . addMemberExpectForActualMapping ( expectSymbol . asSymbol ( ) , actualSymbol . asSymbol ( ) , containingExpectClassSymbol . asSymbol ( ) , ExpectActualMatchingCompatibility . MatchedSuccessfully ) <EOL> }


override fun onMismatchedMembersFromClassScope ( expectSymbol : DeclarationSymbolMarker , actualSymbolsByIncompatibility : Map < ExpectActualMatchingCompatibility . Mismatch , List < DeclarationSymbolMarker > > , containingExpectClassSymbol : RegularClassSymbolMarker ? , containingActualClassSymbol : RegularClassSymbolMarker ? <EOL> )

{ <EOL> if ( containingExpectClassSymbol == null || containingActualClassSymbol == null ) return <EOL> for ( ( incompatibility , actualSymbols ) in actualSymbolsByIncompatibility . entries ) { <EOL> for ( actualSymbol in actualSymbols ) { <EOL> containingActualClassSymbol . asSymbol ( ) . addMemberExpectForActualMapping ( expectSymbol . asSymbol ( ) , actualSymbol . asSymbol ( ) , containingExpectClassSymbol . asSymbol ( ) , incompatibility , ) <EOL> } <EOL> } <EOL> }


private fun FirRegularClassSymbol . addMemberExpectForActualMapping ( expectMember : FirBasedSymbol < * > , actualMember : FirBasedSymbol < * > , expectClassSymbol : FirRegularClassSymbol , compatibility : ExpectActualMatchingCompatibility , )

{ <EOL> check ( allowedWritingMemberExpectForActualMapping ) { "<STR_LIT>" } <EOL> val fir = fir <EOL> val expectForActualMap = fir . memberExpectForActual ? : mutableMapOf ( ) <EOL> fir . memberExpectForActual = expectForActualMap <EOL> val expectToCompatibilityMap = expectForActualMap . asMutableMap ( ) <EOL> . computeIfAbsent ( actualMember to expectClassSymbol ) { mutableMapOf ( ) } <EOL> expectToCompatibilityMap . asMutableMap ( ) [ expectMember ] = compatibility <EOL> }


private fun < K , V > Map < K , V > . asMutableMap ( ) : MutableMap < K , V >

= this as MutableMap


override fun skipCheckingAnnotationsOfActualClassMember ( actualMember : DeclarationSymbolMarker ) : Boolean

{ <EOL> return ( actualMember . asSymbol ( ) . fir as? FirMemberDeclaration ) ? . isActual == true <EOL> }


override fun findPotentialExpectClassMembersForActual ( expectClass : RegularClassSymbolMarker , actualClass : RegularClassSymbolMarker , actualMember : DeclarationSymbolMarker , ) : Map < FirBasedSymbol < * > , ExpectActualMatchingCompatibility >

{ <EOL> val mapping = actualClass . asSymbol ( ) . fir . memberExpectForActual <EOL> return mapping ? . get ( actualMember to expectClass ) ? : emptyMap ( ) <EOL> }


override fun DeclarationSymbolMarker . getSourceElement ( ) : SourceElementMarker

= FirSourceElement ( asSymbol ( ) . source )


override fun TypeRefMarker . getClassId ( ) : ClassId ?

= ( this as FirResolvedTypeRef ) . type . fullyExpandedType ( actualSession ) . classId


override fun checkAnnotationsOnTypeRefAndArguments ( expectContainingSymbol : DeclarationSymbolMarker , actualContainingSymbol : DeclarationSymbolMarker , expectTypeRef : TypeRefMarker , actualTypeRef : TypeRefMarker , checker : ExpectActualMatchingContext . AnnotationsCheckerCallback , )

{ <EOL> check ( expectTypeRef is FirResolvedTypeRef && actualTypeRef is FirResolvedTypeRef ) <EOL> checkAnnotationsOnTypeRefAndArgumentsImpl ( expectContainingSymbol . asSymbol ( ) , actualContainingSymbol . asSymbol ( ) , expectTypeRef , actualTypeRef , checker ) <EOL> }


private fun checkAnnotationsOnTypeRefAndArgumentsImpl ( expectContainingSymbol : FirBasedSymbol < * > , actualContainingSymbol : FirBasedSymbol < * > , expectTypeRef : FirTypeRef ? , actualTypeRef : FirTypeRef ? , checker : ExpectActualMatchingContext . AnnotationsCheckerCallback , )

{ <EOL> fun FirAnnotationContainer . getAnnotations ( anchor : FirBasedSymbol < * > ) : List < AnnotationCallInfoImpl > { <EOL> return resolvedAnnotationsWithArguments ( anchor ) . map ( :: AnnotationCallInfoImpl ) <EOL> } <EOL> if ( expectTypeRef == null || actualTypeRef == null ) return <EOL> if ( expectTypeRef is FirErrorTypeRef || actualTypeRef is FirErrorTypeRef ) return <EOL> checker . check ( expectTypeRef . getAnnotations ( expectContainingSymbol ) , actualTypeRef . getAnnotations ( actualContainingSymbol ) , FirSourceElement ( actualTypeRef . source ) ) <EOL> val expectDelegatedTypeRef = ( expectTypeRef as? FirResolvedTypeRef ) ? . delegatedTypeRef ? : return <EOL> val actualDelegatedTypeRef = ( actualTypeRef as? FirResolvedTypeRef ? ) ? . delegatedTypeRef ? : return <EOL> when { <EOL> expectDelegatedTypeRef is FirUserTypeRef && actualDelegatedTypeRef is FirUserTypeRef -> { <EOL> val expectQualifier = expectDelegatedTypeRef . qualifier <EOL> val actualQualifier = actualDelegatedTypeRef . qualifier <EOL> for ( ( expectPart , actualPart ) in expectQualifier . zipIfSizesAreEqual ( actualQualifier ) . orEmpty ( ) ) { <EOL> val expectPartTypeArguments = expectPart . typeArgumentList . typeArguments <EOL> val actualPartTypeArguments = actualPart . typeArgumentList . typeArguments <EOL> val zippedArgs = expectPartTypeArguments . zipIfSizesAreEqual ( actualPartTypeArguments ) . orEmpty ( ) <EOL> for ( ( expectTypeArgument , actualTypeArgument ) in zippedArgs ) { <EOL> if ( expectTypeArgument !is FirTypeProjectionWithVariance || actualTypeArgument !is FirTypeProjectionWithVariance ) { <EOL> continue <EOL> } <EOL> checkAnnotationsOnTypeRefAndArgumentsImpl ( expectContainingSymbol , actualContainingSymbol , expectTypeArgument . typeRef , actualTypeArgument . typeRef , checker ) <EOL> } <EOL> } <EOL> } <EOL> expectDelegatedTypeRef is FirFunctionTypeRef && actualDelegatedTypeRef is FirFunctionTypeRef -> { <EOL> checkAnnotationsOnTypeRefAndArgumentsImpl ( expectContainingSymbol , actualContainingSymbol , expectDelegatedTypeRef . receiverTypeRef , actualDelegatedTypeRef . receiverTypeRef , checker , ) <EOL> checkAnnotationsOnTypeRefAndArgumentsImpl ( expectContainingSymbol , actualContainingSymbol , expectDelegatedTypeRef . returnTypeRef , actualDelegatedTypeRef . returnTypeRef , checker , ) <EOL> val expectParams = expectDelegatedTypeRef . parameters <EOL> val actualParams = actualDelegatedTypeRef . parameters <EOL> for ( ( expectParam , actualParam ) in expectParams . zipIfSizesAreEqual ( actualParams ) . orEmpty ( ) ) { <EOL> checkAnnotationsOnTypeRefAndArgumentsImpl ( expectContainingSymbol , actualContainingSymbol , expectParam . returnTypeRef , actualParam . returnTypeRef , checker ) <EOL> } <EOL> } <EOL> } <EOL> }


override fun create ( actualSession : FirSession , actualScopeSession : ScopeSession , allowedWritingMemberExpectForActualMapping : Boolean , ) : FirExpectActualMatchingContextImpl

= <EOL> FirExpectActualMatchingContextImpl ( actualSession , actualScopeSession , allowedWritingMemberExpectForActualMapping )


fun foo ( iterable : Iterable < Int > , iterator : Iterator < Int > , comparable : Comparable < Any > )

{ <EOL> checkSubtype < Iterable < Any > > ( iterable ) <EOL> checkSubtype < Iterator < Any > > ( iterator ) <EOL> checkSubtype < Comparable < String > > ( comparable ) <EOL> }


{ <EOL> checkSubtype < Iterable < Any > > ( c ) <EOL> checkSubtype < Iterator < Any > > ( c . iterator ( ) ) <EOL> }


{ <EOL> val p = :: pr <EOL> if ( p . get ( ) . value != "<STR_LIT:first>" ) return "<STR_LIT>" <EOL> if ( p . name != "<STR_LIT>" ) return "<STR_LIT>" <EOL> p . set ( Box ( "<STR_LIT:second>" ) ) <EOL> if ( p . get ( ) . value != "<STR_LIT:second>" ) return "<STR_LIT>" <EOL> return "<STR_LIT:OK>" <EOL> }


fun foo ( p : Int , p2 : Double ) : Short

= <NUM_LIT:1>

/**
 * Function foo description
 *
 * @param p first Integer to consume
 * @param p2 second Double to consume
 * @return Short, constant 1
 */


= ICInt ( <NUM_LIT:1> )


suspend fun < T > suspendGeneric ( x : T ) : T

= x


{ <EOL> useICInt ( suspendICInt ( ) ) <EOL> useICInt ( suspendGeneric ( ICInt ( <NUM_LIT:1> ) ) ) <EOL> useAny ( suspendAny ( ) ) <EOL> useAny ( suspendICInt ( ) ) <EOL> }


{ <EOL> val testProject = mixedJvmTestProject { <EOL> dokkaConfiguration { <EOL> moduleName = "<STR_LIT>" <EOL> jvmSourceSet { <EOL> } <EOL> } <EOL> kotlinSourceDirectory { <EOL> ktFile ( pathFromSrc = "<STR_LIT>" ) { <EOL> + "<STR_LIT>" <EOL> } <EOL> javaFile ( pathFromSrc = "<STR_LIT>" ) { <EOL> + """<STR_LIT>""" <EOL> } <EOL> } <EOL> javaSourceDirectory { <EOL> ktFile ( pathFromSrc = "<STR_LIT>" ) { <EOL> + "<STR_LIT>" <EOL> } <EOL> javaFile ( pathFromSrc = "<STR_LIT>" ) { <EOL> + """<STR_LIT>""" <EOL> } <EOL> } <EOL> } <EOL> val module = testProject . parse ( ) <EOL> assertEquals ( "<STR_LIT>" , module . name ) <EOL> assertEquals ( <NUM_LIT:1> , module . packages . size ) <EOL> val pckg = module . packages [ <NUM_LIT:0> ] <EOL> assertEquals ( "<STR_LIT:test>" , pckg . name ) <EOL> assertEquals ( <NUM_LIT:2> , pckg . classlikes . size ) <EOL> assertEquals ( <NUM_LIT:2> , pckg . functions . size ) <EOL> val firstClasslike = pckg . classlikes [ <NUM_LIT:0> ] <EOL> assertEquals ( "<STR_LIT>" , firstClasslike . name ) <EOL> val secondClasslike = pckg . classlikes [ <NUM_LIT:1> ] <EOL> assertEquals ( "<STR_LIT>" , secondClasslike . name ) <EOL> val functions = pckg . functions . sortedBy { it . name } <EOL> val firstFunction = functions [ <NUM_LIT:0> ] <EOL> assertEquals ( "<STR_LIT:bar>" , firstFunction . name ) <EOL> val secondFunction = functions [ <NUM_LIT:1> ] <EOL> assertEquals ( "<STR_LIT:foo>" , secondFunction . name ) <EOL> }

/**
 * Used as a sample for [mixedJvmTestProject]
 */


{ <EOL> for ( ( _ , _ ) in ( <NUM_LIT:4> .. <NUM_LIT:7> ) . withIndex ( ) ) { <EOL> } <EOL> return "<STR_LIT:OK>" <EOL> }


@ Test <EOL> fun `smoke single function` ( )

{ <EOL> withKlibScope ( source = """<STR_LIT>""" . trimIndent ( ) ) { <EOL> val symbol = getAllSymbols ( ) . single ( ) <EOL> assertTrue ( symbol is KtFunctionSymbol ) <EOL> assertEquals ( "<STR_LIT:foo>" , symbol . name . asString ( ) ) <EOL> } <EOL> }


{ <EOL> withKlibScope ( source = "<STR_LIT>" ) { <EOL> val symbols = getAllSymbols ( ) <EOL> val classifiersNames = getPossibleClassifierNames ( ) <EOL> val callableNames = getPossibleCallableNames ( ) <EOL> assertTrue ( symbols . toList ( ) . isEmpty ( ) ) <EOL> assertTrue ( classifiersNames . toList ( ) . isEmpty ( ) ) <EOL> assertTrue ( callableNames . toList ( ) . isEmpty ( ) ) <EOL> } <EOL> }


@ Test <EOL> fun `callable name filter` ( )

{ <EOL> withKlibScope ( source = simpleContentWithCollisions ) { <EOL> val symbol = getCallableSymbols { it . asString ( ) == "<STR_LIT:foo>" } . single ( ) <EOL> assertTrue ( symbol is KtFunctionSymbol ) <EOL> assertEquals ( "<STR_LIT:foo>" , symbol . name . asString ( ) ) <EOL> } <EOL> }


@ Test <EOL> fun `classifier name filter` ( )

{ <EOL> withKlibScope ( source = simpleContentWithCollisions ) { <EOL> val symbol = getClassifierSymbols { it . asString ( ) == "<STR_LIT:foo>" } . single ( ) <EOL> assertTrue ( symbol is KtNamedSymbol ) <EOL> assertEquals ( "<STR_LIT:foo>" , symbol . name . asString ( ) ) <EOL> } <EOL> }


@ Test <EOL> fun `possible classifier names` ( )

{ <EOL> withKlibScope ( source = simpleContentWithCollisions ) { <EOL> val classifierNames = getPossibleClassifierNames ( ) <EOL> assertContains ( classifierNames , Name . identifier ( "<STR_LIT:foo>" ) ) <EOL> assertContains ( classifierNames , Name . identifier ( "<STR_LIT:bar>" ) ) <EOL> } <EOL> }


@ Test <EOL> fun `possible callable names` ( )

{ <EOL> withKlibScope ( source = simpleContentWithCollisions ) { <EOL> val callableNames = getPossibleCallableNames ( ) <EOL> assertContains ( callableNames , Name . identifier ( "<STR_LIT:foo>" ) ) <EOL> assertContains ( callableNames , Name . identifier ( "<STR_LIT:bar>" ) ) <EOL> } <EOL> }


private fun < T > withKlibScope ( @ Language ( "<STR_LIT:kotlin>" ) source : String , block : KlibScope . ( ) -> T ) : T

{ <EOL> val srcFile = kotlin . io . path . createTempFile ( suffix = "<STR_LIT>" ) . also { it . writeText ( source ) } <EOL> return withKlibScope ( srcFile , block ) <EOL> }


@ OptIn ( KtAnalysisApiInternals :: class ) <EOL> private fun < T > withKlibScope ( sources : Path , block : KlibScope . ( ) -> T ) : T

{ <EOL> val klib = compileToNativeKLib ( sources ) <EOL> lateinit var module : KtLibraryModule <EOL> val session = buildStandaloneAnalysisAPISession { <EOL> registerProjectService ( KtLifetimeTokenProvider :: class . java , KtAlwaysAccessibleLifetimeTokenProvider ( ) ) <EOL> val nativePlatform = NativePlatforms . unspecifiedNativePlatform <EOL> buildKtModuleProvider { <EOL> platform = nativePlatform <EOL> module = addModule ( buildKtLibraryModule { <EOL> addBinaryRoot ( klib ) <EOL> platform = nativePlatform <EOL> libraryName = "<STR_LIT>" <EOL> } ) <EOL> } <EOL> } <EOL> return analyze ( session . getAllLibraryModules ( ) . single ( ) ) { <EOL> KlibScope ( module , this . analysisSession ) . block ( ) <EOL> } <EOL> }


@ org . junit . Test <EOL> fun parametersInInnerClassConstructor ( )

{ <EOL> val inner = Outer ( ) . Inner ( "<STR_LIT:123>" ) <EOL> Assert . assertEquals ( "<STR_LIT:123>" , inner . name ( ) ) <EOL> val valueParameters = inner :: class . constructors . single ( ) . valueParameters <EOL> Assert . assertEquals ( <NUM_LIT:1> , valueParameters . size ) <EOL> val annotations = valueParameters [ <NUM_LIT:0> ] . annotations <EOL> Assert . assertEquals ( <NUM_LIT:1> , annotations . size ) <EOL> Assert . assertEquals ( "<STR_LIT:Foo>" , annotations [ <NUM_LIT:0> ] . annotationClass . simpleName ) <EOL> }


fun < T > DataStreamWriter < T > . forEachBatch ( func : ( batch : Dataset < T > , batchId : Long ) -> Unit , ) : DataStreamWriter < T >

= foreachBatch ( VoidFunction2 ( func ) )

/**
 * :: Experimental ::
 *
 * (Scala-specific) Sets the output of the streaming query to be processed using the provided
 * function. This is supported only in the micro-batch execution modes (that is, when the
 * trigger is not continuous). In every micro-batch, the provided function will be called in
 * every micro-batch with (i) the output rows as a Dataset and (ii) the batch identifier.
 * The batchId can be used to deduplicate and transactionally write the output
 * (that is, the provided Dataset) to external systems. The output Dataset is guaranteed
 * to be exactly the same for the same batchId (assuming all operations are deterministic
 * in the query).
 *
 * @since 2.4.0
 */


override fun lower ( irModule : IrModuleFragment )

{ <EOL> if ( context . config . shouldValidateIr ) { <EOL> validate ( irModule ) <EOL> } <EOL> }


protected abstract fun validate ( irModule : IrModuleFragment )


override fun validate ( irModule : IrModuleFragment )

{ <EOL> validationCallback ( context , irModule , checkProperties = true ) <EOL> }


private fun checkAllFileLevelDeclarationsAreClasses ( module : IrModuleFragment )

{ <EOL> assert ( module . files . all { irFile -> <EOL> irFile . declarations . all { it is IrClass } <EOL> } ) <EOL> }


{ <EOL> validationCallback ( context , irModule , checkProperties = true ) <EOL> checkAllFileLevelDeclarationsAreClasses ( irModule ) <EOL> val validator = object : IrElementVisitorVoid { <EOL> override fun visitElement ( element : IrElement ) { <EOL> element . acceptChildrenVoid ( this ) <EOL> } <EOL> override fun visitProperty ( declaration : IrProperty ) { <EOL> error ( "<STR_LIT>" ) <EOL> } <EOL> override fun visitAnonymousInitializer ( declaration : IrAnonymousInitializer ) { <EOL> error ( "<STR_LIT>" ) <EOL> } <EOL> } <EOL> irModule . acceptVoid ( validator ) <EOL> }


fun runSuspend ( c : suspend ( ) -> Unit )

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


= s + "<STR_LIT:K>"


suspend fun invokeSuspend ( fn : suspend ( String ) -> String , arg : String )

= fn . invoke ( arg )


{ <EOL> var test = "<STR_LIT>" <EOL> runSuspend { <EOL> test = invokeSuspend ( :: foo , "<STR_LIT:O>" ) <EOL> } <EOL> return test <EOL> }


@ Test <EOL> fun testExampleBuiltin01 ( )

{ <EOL> captureOutput ( "<STR_LIT>" ) { example . exampleBuiltin01 . main ( ) } . verifyOutputLines ( "<STR_LIT>" ) <EOL> }


@ Test <EOL> fun testExampleBuiltin02 ( )

{ <EOL> captureOutput ( "<STR_LIT>" ) { example . exampleBuiltin02 . main ( ) } . verifyOutputLines ( "<STR_LIT>" ) <EOL> }


@ Test <EOL> fun testExampleBuiltin03 ( )

{ <EOL> captureOutput ( "<STR_LIT>" ) { example . exampleBuiltin03 . main ( ) } . verifyOutputLines ( "<STR_LIT>" ) <EOL> }


@ Test <EOL> fun testExampleBuiltin04 ( )

{ <EOL> captureOutput ( "<STR_LIT>" ) { example . exampleBuiltin04 . main ( ) } . verifyOutputLines ( "<STR_LIT>" ) <EOL> }


@ Test <EOL> fun testExampleBuiltin05 ( )

{ <EOL> captureOutput ( "<STR_LIT>" ) { example . exampleBuiltin05 . main ( ) } . verifyOutputLines ( "<STR_LIT>" ) <EOL> }


@ Test <EOL> fun testExampleBuiltin06 ( )

{ <EOL> captureOutput ( "<STR_LIT>" ) { example . exampleBuiltin06 . main ( ) } . verifyOutputLines ( "<STR_LIT>" ) <EOL> }


@ Test <EOL> fun testExampleBuiltin07 ( )

{ <EOL> captureOutput ( "<STR_LIT>" ) { example . exampleBuiltin07 . main ( ) } . verifyOutputLines ( "<STR_LIT>" ) <EOL> }


@ Test <EOL> fun testExampleBuiltin08 ( )

{ <EOL> captureOutput ( "<STR_LIT>" ) { example . exampleBuiltin08 . main ( ) } . verifyOutputLines ( "<STR_LIT>" ) <EOL> }


@ Test <EOL> fun testExampleBuiltin09 ( )

{ <EOL> captureOutput ( "<STR_LIT>" ) { example . exampleBuiltin09 . main ( ) } . verifyOutputLines ( "<STR_LIT>" ) <EOL> }


@ Test <EOL> fun testExampleBuiltin10 ( )

{ <EOL> captureOutput ( "<STR_LIT>" ) { example . exampleBuiltin10 . main ( ) } . verifyOutputLines ( "<STR_LIT>" ) <EOL> }


@ Test <EOL> fun testExampleBuiltin11 ( )

{ <EOL> captureOutput ( "<STR_LIT>" ) { example . exampleBuiltin11 . main ( ) } . verifyOutputLines ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> }


@ Test <EOL> fun testExampleBuiltin12 ( )

{ <EOL> captureOutput ( "<STR_LIT>" ) { example . exampleBuiltin12 . main ( ) } . verifyOutputLines ( "<STR_LIT>" ) <EOL> }


@ Test <EOL> fun testExampleBuiltin13 ( )

{ <EOL> captureOutput ( "<STR_LIT>" ) { example . exampleBuiltin13 . main ( ) } . verifyOutputLines ( "<STR_LIT>" ) <EOL> }


= HostManager . hostIsMac


= HostManager . hostIsMingw


= HostManager . hostIsLinux


@ JvmStatic <EOL> fun isAppleTarget ( project : Project ) : Boolean

{ <EOL> val target = getTarget ( project ) <EOL> return target . family . isAppleFamily <EOL> }


@ JvmStatic <EOL> fun isAppleTarget ( target : KonanTarget ) : Boolean

{ <EOL> return target . family . isAppleFamily <EOL> }


@ JvmStatic <EOL> fun isWindowsTarget ( project : Project )

= getTarget ( project ) . family == Family . MINGW


@ JvmStatic <EOL> fun getTarget ( project : Project ) : KonanTarget

{ <EOL> val platformManager = project . platformManager <EOL> val targetName = project . project . testTarget . name <EOL> return platformManager . targetManager ( targetName ) . target <EOL> }


@ JvmStatic <EOL> fun needSmallBinary ( project : Project ) : Boolean

{ <EOL> return getTarget ( project ) . needSmallBinary ( ) <EOL> }


@ JvmStatic <EOL> fun isK2 ( project : Project ) : Boolean

{ <EOL> val idx = project . globalTestArgs . indexOf ( "<STR_LIT>" ) <EOL> if ( idx == - <NUM_LIT:1> ) return true <EOL> return project . globalTestArgs [ idx + <NUM_LIT:1> ] . toDouble ( ) >= <NUM_LIT:2.0> <EOL> }


@ JvmStatic <EOL> fun supportsLibBacktrace ( project : Project ) : Boolean

{ <EOL> return getTarget ( project ) . supportsLibBacktrace ( ) <EOL> }


@ JvmStatic <EOL> fun supportsCoreSymbolication ( project : Project ) : Boolean

{ <EOL> return getTarget ( project ) . supportsCoreSymbolication ( ) <EOL> }


@ JvmStatic <EOL> fun checkXcodeVersion ( project : Project )

{ <EOL> val properties = PropertiesProvider ( project ) <EOL> val requiredMajorVersion = properties . xcodeMajorVersion <EOL> if ( ! DependencyProcessor . isInternalSeverAvailable && properties . checkXcodeVersion && requiredMajorVersion != null ) { <EOL> val currentXcodeVersion = Xcode . findCurrent ( ) . version . toString ( ) <EOL> val currentMajorVersion = currentXcodeVersion . splitToSequence ( '<CHAR_LIT:.>' ) . first ( ) <EOL> if ( currentMajorVersion != requiredMajorVersion ) { <EOL> throw IllegalStateException ( "<STR_LIT>" + "<STR_LIT>" ) <EOL> } <EOL> } <EOL> }


= TargetSupportException ( )


{ <EOL> columnOf ( <NUM_LIT> , <NUM_LIT> ) . scale ( ) shouldBe <NUM_LIT:1> <EOL> columnOf ( <NUM_LIT> , <NUM_LIT> ) . scale ( ) shouldBe <NUM_LIT:4> <EOL> columnOf ( <NUM_LIT> , <NUM_LIT> ) . scale ( ) shouldBe defaultPrecision <EOL> columnOf ( <NUM_LIT:1> , <NUM_LIT:2> ) . scale ( ) shouldBe <NUM_LIT:0> <EOL> columnOf ( <NUM_LIT:1.0> , <NUM_LIT:2> ) . scale ( ) shouldBe <NUM_LIT:1> <EOL> columnOf ( <NUM_LIT> , - <NUM_LIT> ) . scale ( ) shouldBe <NUM_LIT:1> <EOL> columnOf ( <NUM_LIT> , - <NUM_LIT> ) . scale ( ) shouldBe <NUM_LIT:5> <EOL> columnOf ( <NUM_LIT> ) . scale ( ) shouldBe defaultPrecision <EOL> columnOf ( <NUM_LIT> ) . scale ( ) shouldBe - <NUM_LIT:23> <EOL> }


{ <EOL> val d = DecimalFormatSymbols . getInstance ( ) . decimalSeparator <EOL> val value = <NUM_LIT> <EOL> val expected = "<STR_LIT>" <EOL> val digits = <NUM_LIT:2> <EOL> val formatter = RendererDecimalFormat . fromPrecision ( digits ) <EOL> value . format ( formatter ) shouldBe expected <EOL> value . toFloat ( ) . format ( formatter ) shouldBe expected <EOL> value . toBigDecimal ( ) . format ( formatter ) shouldBe expected <EOL> }


{ <EOL> val col by columnOf ( <NUM_LIT:1.0> ) <EOL> col . filter { false } . scale ( ) shouldBe <NUM_LIT:0> <EOL> }


operator fun getValue ( t : Any ? , p : KProperty < * > ) : Int

= inner


operator fun Delegate . setValue ( t : Any ? , p : KProperty < * > , i : Int )

{ inner = i }


{ <EOL> val c = A ( ) <EOL> if ( c . prop != <NUM_LIT:1> ) return "<STR_LIT>" <EOL> c . prop = <NUM_LIT:2> <EOL> if ( c . prop != <NUM_LIT:2> ) return "<STR_LIT>" <EOL> return "<STR_LIT:OK>" <EOL> }


public fun foo ( p0 : Array < out Int > ? )


public fun dummy ( )


override fun foo ( p0 : Array < out Int > ? )


fun formatDouble ( d : Double ) : String

{ <EOL> if ( d . roundToInt ( ) . toDouble ( ) == d ) { <EOL> return "<STR_LIT>" <EOL> } else { <EOL> return "<STR_LIT>" <EOL> } <EOL> }


{ <EOL> val name = this :: class . qualifiedName <EOL> println ( name ) <EOL> }


@ DisplayName ( "<STR_LIT>" ) <EOL> @ GradleTest <EOL> fun shouldDownloadDependenciesBeforeCompilerExecution ( gradleVersion : GradleVersion )

{ <EOL> nativeProject ( "<STR_LIT>" , gradleVersion ) { <EOL> build ( "<STR_LIT:assemble>" ) { <EOL> assertOutputContains ( "<STR_LIT>" ) <EOL> assertOutputDoesNotContain ( "<STR_LIT>" ) <EOL> } <EOL> } <EOL> }


@ DisplayName ( "<STR_LIT>" ) <EOL> @ GradleTest <EOL> fun checkCompilerDownloadsDependenciesWhenToochainDisabled ( gradleVersion : GradleVersion )

{ <EOL> nativeProject ( "<STR_LIT>" , gradleVersion ) { <EOL> build ( "<STR_LIT:assemble>" , buildOptions = defaultBuildOptions . copy ( freeArgs = listOf ( "<STR_LIT>" ) , ) ) { <EOL> assertOutputContains ( "<STR_LIT>" ) <EOL> assertOutputDoesNotContain ( "<STR_LIT>" ) <EOL> } <EOL> } <EOL> }


@ DisplayName ( "<STR_LIT>" ) <EOL> @ GradleTest <EOL> fun testNativeDependencies ( gradleVersion : GradleVersion )

{ <EOL> testNativeDependencies ( "<STR_LIT>" , "<STR_LIT:assemble>" , gradleVersion ) <EOL> }


@ OptIn ( EnvironmentalVariablesOverride :: class ) <EOL> private fun testNativeDependencies ( projectName : String , task : String , gradleVersion : GradleVersion )

{ <EOL> val konanDirectory = workingDir . resolve ( "<STR_LIT>" ) <EOL> nativeProject ( projectName , gradleVersion , environmentVariables = EnvironmentalVariables ( Pair ( "<STR_LIT>" , "<STR_LIT:1>" ) ) , buildOptions = defaultBuildOptions . withBundledKotlinNative ( ) . copy ( konanDataDir = konanDirectory ) , ) { <EOL> build ( task ) { <EOL> val file = projectPath . resolve ( "<STR_LIT>" ) . toFile ( ) . also { it . createNewFile ( ) } <EOL> val dependencies = konanDirectory . resolve ( "<STR_LIT>" ) . toFile ( ) <EOL> assertTrue ( dependencies . exists ( ) ) <EOL> assertTrue ( dependencies . listFiles ( ) != null , "<STR_LIT>" ) <EOL> dependencies . listFiles ( ) ? . filter { it . name != "<STR_LIT>" } ? . forEach { <EOL> val processRunResult = <EOL> runProcess ( listOf ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , file . path , "<STR_LIT>" , it . absolutePath ) , workingDir . toFile ( ) ) <EOL> assertProcessRunResult ( processRunResult ) { <EOL> assertTrue ( isSuccessful ) <EOL> } <EOL> } <EOL> } <EOL> } <EOL> }


@ DisplayName ( "<STR_LIT>" ) <EOL> @ GradleTest <EOL> @ OsCondition ( supportedOn = [ OS . MAC ] , enabledOnCI = [ OS . MAC ] ) <EOL> fun testMacosNativeDependencies ( gradleVersion : GradleVersion )

{ <EOL> testNativeDependencies ( "<STR_LIT>" , "<STR_LIT>" , gradleVersion ) <EOL> }


open suspend fun fetch ( identifier : U ) : T ?

= null


{ <EOL> val genericString = <EOL> AbstractPersistence :: class . java . declaredMethods <EOL> . single { it . name . contains ( "<STR_LIT>" ) } <EOL> . toGenericString ( ) <EOL> if ( ! genericString . startsWith ( "<STR_LIT>" ) ) { <EOL> return genericString <EOL> } <EOL> return "<STR_LIT:OK>" <EOL> }


override fun applyGradients ( graph : KGraph , tf : Ops , weights : List < Variable < Float > > , gradients : Gradients ) : List < Operand < Float > >

{ <EOL> val targets : MutableList < Operand < Float > > = <EOL> ArrayList ( ) <EOL> l1RegularizationStrengthConst = tf . constant ( l1RegularizationStrength , getDType ( ) ) <EOL> l2RegularizationStrengthConst = tf . constant ( l2RegularizationStrength , getDType ( ) ) <EOL> learningRateConst = tf . constant ( learningRate , getDType ( ) ) <EOL> l2ShrinkageRegularizationStrengthConst = tf . constant ( l2ShrinkageRegularizationStrength , getDType ( ) ) <EOL> learningRatePowerConst = tf . constant ( learningRatePower , getDType ( ) ) <EOL> for ( i in weights . indices ) { <EOL> val variable = weights [ i ] <EOL> val varName = variable . ref ( ) . op ( ) . name ( ) <EOL> val accumSlot : Variable < Float > = getSlot ( varName , ACCUMULATOR ) <EOL> val linearSlot : Variable < Float > = getSlot ( varName , LINEAR_ACCUMULATOR ) <EOL> val options = ApplyFtrl . useLocking ( true ) <EOL> targets . add ( tf . train . applyFtrl ( variable , accumSlot , linearSlot , clipGradient . clipGradient ( tf , gradients . dy ( i ) ) , learningRateConst , l1RegularizationStrengthConst , l2RegularizationStrengthConst , l2ShrinkageRegularizationStrengthConst , learningRatePowerConst , options ) ) <EOL> } <EOL> return targets <EOL> }


private fun createFtrlSlot ( graph : KGraph , tf : Ops , v : Output < Float > )

{ <EOL> val accumInitializerName = defaultInitializerOpName ( createName ( v , ACCUMULATOR ) ) <EOL> val accumInitializer = tf . withName ( accumInitializerName ) <EOL> . fill ( tf . shape ( v ) , tf . constant ( initialAccumulatorValue ) ) <EOL> createSlot ( graph , tf , v . asOutput ( ) , ACCUMULATOR , accumInitializer ) <EOL> val linearAccumInitializerName = defaultInitializerOpName ( createName ( v , LINEAR_ACCUMULATOR ) ) <EOL> val linearAccumInitializer = tf . withName ( linearAccumInitializerName ) <EOL> . fill ( tf . shape ( v ) , tf . constant ( <NUM_LIT:0.0f> ) ) <EOL> createSlot ( graph , tf , v . asOutput ( ) , LINEAR_ACCUMULATOR , linearAccumInitializer ) <EOL> }


override fun createSlots ( graph : KGraph , tf : Ops , variables : List < Output < Float > > )

{ <EOL> for ( v in variables ) { <EOL> createFtrlSlot ( graph , tf , v . asOutput ( ) ) <EOL> } <EOL> }


fun testInt ( left : Int ? , right : Int ? , step : Int ? )

{ <EOL> right ? . let { <EOL> for ( i in <NUM_LIT:0> .. it ) { sb . append ( i ) } <EOL> } <EOL> sb . appendLine ( ) <EOL> left ? . let { <EOL> for ( i in it .. <NUM_LIT:5> ) { sb . append ( i ) } <EOL> } <EOL> sb . appendLine ( ) <EOL> step ? . let { <EOL> for ( i in <NUM_LIT:0> .. <NUM_LIT:5> step it ) { sb . append ( i ) } <EOL> } <EOL> sb . appendLine ( ) <EOL> right ? . let { <EOL> for ( i in <NUM_LIT:0> until it ) { sb . append ( i ) } <EOL> } <EOL> sb . appendLine ( ) <EOL> left ? . let { <EOL> for ( i in it until <NUM_LIT:5> ) { sb . append ( i ) } <EOL> } <EOL> sb . appendLine ( ) <EOL> step ? . let { <EOL> for ( i in <NUM_LIT:0> until <NUM_LIT:5> step it ) { sb . append ( i ) } <EOL> } <EOL> sb . appendLine ( ) <EOL> right ? . let { <EOL> for ( i in it downTo <NUM_LIT:0> ) { sb . append ( i ) } <EOL> } <EOL> sb . appendLine ( ) <EOL> left ? . let { <EOL> for ( i in <NUM_LIT:5> downTo it ) { sb . append ( i ) } <EOL> } <EOL> sb . appendLine ( ) <EOL> step ? . let { <EOL> for ( i in <NUM_LIT:5> downTo <NUM_LIT:0> step it ) { sb . append ( i ) } <EOL> } <EOL> sb . appendLine ( ) <EOL> }


fun testLong ( left : Long ? , right : Long ? , step : Long ? )

{ <EOL> right ? . let { <EOL> for ( i in <NUM_LIT:0> .. it ) { sb . append ( i ) } <EOL> } <EOL> sb . appendLine ( ) <EOL> left ? . let { <EOL> for ( i in it .. <NUM_LIT:5> ) { sb . append ( i ) } <EOL> } <EOL> sb . appendLine ( ) <EOL> step ? . let { <EOL> for ( i in <NUM_LIT:0> .. <NUM_LIT> step it ) { sb . append ( i ) } <EOL> } <EOL> sb . appendLine ( ) <EOL> right ? . let { <EOL> for ( i in <NUM_LIT:0> until it ) { sb . append ( i ) } <EOL> } <EOL> sb . appendLine ( ) <EOL> left ? . let { <EOL> for ( i in it until <NUM_LIT:5> ) { sb . append ( i ) } <EOL> } <EOL> sb . appendLine ( ) <EOL> step ? . let { <EOL> for ( i in <NUM_LIT:0> until <NUM_LIT> step it ) { sb . append ( i ) } <EOL> } <EOL> sb . appendLine ( ) <EOL> right ? . let { <EOL> for ( i in it downTo <NUM_LIT:0> ) { sb . append ( i ) } <EOL> } <EOL> sb . appendLine ( ) <EOL> left ? . let { <EOL> for ( i in <NUM_LIT:5> downTo it ) { sb . append ( i ) } <EOL> } <EOL> sb . appendLine ( ) <EOL> step ? . let { <EOL> for ( i in <NUM_LIT:5> downTo <NUM_LIT:0L> step it ) { sb . append ( i ) } <EOL> } <EOL> sb . appendLine ( ) <EOL> }


fun testChar ( left : Char ? , right : Char ? , step : Int ? )

{ <EOL> right ? . let { <EOL> for ( i in '<CHAR_LIT:a>' .. it ) { sb . append ( i ) } <EOL> } <EOL> sb . appendLine ( ) <EOL> left ? . let { <EOL> for ( i in it .. '<CHAR_LIT:f>' ) { sb . append ( i ) } <EOL> } <EOL> sb . appendLine ( ) <EOL> step ? . let { <EOL> for ( i in '<CHAR_LIT:a>' .. '<CHAR_LIT:f>' step it ) { sb . append ( i ) } <EOL> } <EOL> sb . appendLine ( ) <EOL> right ? . let { <EOL> for ( i in '<CHAR_LIT:a>' until it ) { sb . append ( i ) } <EOL> } <EOL> sb . appendLine ( ) <EOL> left ? . let { <EOL> for ( i in it until '<CHAR_LIT:f>' ) { sb . append ( i ) } <EOL> } <EOL> sb . appendLine ( ) <EOL> step ? . let { <EOL> for ( i in '<CHAR_LIT:a>' until '<CHAR_LIT:f>' step it ) { sb . append ( i ) } <EOL> } <EOL> sb . appendLine ( ) <EOL> right ? . let { <EOL> for ( i in it downTo '<CHAR_LIT:a>' ) { sb . append ( i ) } <EOL> } <EOL> sb . appendLine ( ) <EOL> left ? . let { <EOL> for ( i in '<CHAR_LIT:f>' downTo it ) { sb . append ( i ) } <EOL> } <EOL> sb . appendLine ( ) <EOL> step ? . let { <EOL> for ( i in '<CHAR_LIT:f>' downTo '<CHAR_LIT:a>' step it ) { sb . append ( i ) } <EOL> } <EOL> sb . appendLine ( ) <EOL> }


{ <EOL> testInt ( <NUM_LIT:0> , <NUM_LIT:5> , <NUM_LIT:2> ) <EOL> testLong ( <NUM_LIT:0> , <NUM_LIT:5> , <NUM_LIT:2> ) <EOL> testChar ( '<CHAR_LIT:a>' , '<CHAR_LIT:f>' , <NUM_LIT:2> ) <EOL> assertEquals ( """<STR_LIT>""" . trimIndent ( ) , sb . toString ( ) ) <EOL> return "<STR_LIT:OK>" <EOL> }


{ <EOL> return testServices . moduleStructure . originalTestDataFiles . first ( ) . firTestDataFile <EOL> }


override fun hasFailure ( failedAssertions : List < WrappedException > ) : Boolean

{ <EOL> return failedAssertions . any { <EOL> when ( it ) { <EOL> is WrappedException . FromFacade -> it . facade is FirFrontendFacade <EOL> is WrappedException . FromHandler -> it . handler . artifactKind == FrontendKinds . FIR <EOL> else -> false <EOL> } <EOL> } <EOL> }


fun accept ( t : T )


= x


{ <EOL> val g = sel ( G < A > ( ) , G < B > ( ) ) <EOL> g . check { } <EOL> return "<STR_LIT:OK>" <EOL> }


public suspend fun < T > runInterruptible ( context : CoroutineContext = EmptyCoroutineContext , block : ( ) -> T ) : T

= withContext ( context ) { <EOL> runInterruptibleInExpectedContext ( coroutineContext , block ) <EOL> }

/**
 * Calls the specified [block] with a given coroutine context in
 * [an interruptible manner](https://docs.oracle.com/javase/tutorial/essential/concurrency/interrupt.html).
 * The blocking code block will be interrupted and this function will throw [CancellationException]
 * if the coroutine is cancelled.
 *
 * Example:
 *
 * ```
 * withTimeout(500L) { // Cancels coroutine on timeout
 * runInterruptible { // Throws CancellationException if interrupted
 * doSomethingBlocking() // Interrupted on coroutines cancellation
 * }
 * }
 * ```
 *
 * There is an optional [context] parameter to this function working just like [withContext].
 * It enables single-call conversion of interruptible Java methods into suspending functions.
 * With one call here we are moving the call to [Dispatchers.IO] and supporting interruption:
 *
 * ```
 * suspend fun <T> BlockingQueue<T>.awaitTake(): T =
 * runInterruptible(Dispatchers.IO) { queue.take() }
 * ```
 *
 * `runInterruptible` uses [withContext] as an underlying mechanism for switching context,
 * meaning that the supplied [block] is invoked in an [undispatched][CoroutineStart.UNDISPATCHED]
 * manner directly by the caller if [CoroutineDispatcher] from the current [coroutineContext][currentCoroutineContext]
 * is the same as the one supplied in [context].
 */


private fun < T > runInterruptibleInExpectedContext ( coroutineContext : CoroutineContext , block : ( ) -> T ) : T

{ <EOL> try { <EOL> val threadState = ThreadState ( coroutineContext . job ) <EOL> threadState . setup ( ) <EOL> try { <EOL> return block ( ) <EOL> } finally { <EOL> threadState . clearInterrupt ( ) <EOL> } <EOL> } catch ( e : InterruptedException ) { <EOL> throw CancellationException ( "<STR_LIT>" ) . initCause ( e ) <EOL> } <EOL> }


{ <EOL> cancelHandle = job . invokeOnCompletion ( onCancelling = true , invokeImmediately = true , handler = this ) <EOL> _state . loop { state -> <EOL> when ( state ) { <EOL> WORKING -> if ( _state . compareAndSet ( state , WORKING ) ) return <EOL> INTERRUPTING , INTERRUPTED -> return <EOL> else -> invalidState ( state ) <EOL> } <EOL> } <EOL> }


{ <EOL> _state . loop { state -> <EOL> when ( state ) { <EOL> WORKING -> if ( _state . compareAndSet ( state , FINISHED ) ) { <EOL> cancelHandle ? . dispose ( ) <EOL> return <EOL> } <EOL> INTERRUPTING -> { <EOL> } <EOL> INTERRUPTED -> { <EOL> Thread . interrupted ( ) <EOL> return <EOL> } <EOL> else -> invalidState ( state ) <EOL> } <EOL> } <EOL> }


override fun invoke ( cause : Throwable ? )

{ <EOL> _state . loop { state -> <EOL> when ( state ) { <EOL> WORKING -> { <EOL> if ( _state . compareAndSet ( state , INTERRUPTING ) ) { <EOL> targetThread . interrupt ( ) <EOL> _state . value = INTERRUPTED <EOL> return <EOL> } <EOL> } <EOL> FINISHED , INTERRUPTING , INTERRUPTED -> return <EOL> else -> invalidState ( state ) <EOL> } <EOL> } <EOL> }


private fun invalidState ( state : Int ) : Nothing

= error ( "<STR_LIT>" )


internal fun __ieee754_rem_pio2 ( x : Double , y : DoubleArray ) : Int

{ <EOL> var z : Double = <NUM_LIT:0.0> <EOL> var w : Double <EOL> var t : Double <EOL> var r : Double <EOL> var fn : Double <EOL> val tx : DoubleArray = DoubleArray ( <NUM_LIT:3> ) <EOL> var e0 : Int <EOL> var i : Int <EOL> var j : Int <EOL> var nx : Int <EOL> var n : Int <EOL> var ix : Int <EOL> var hx : Int <EOL> hx = __HI ( x ) <EOL> ix = hx and <NUM_LIT> <EOL> if ( ix <= <NUM_LIT> ) { <EOL> y [ <NUM_LIT:0> ] = x ; y [ <NUM_LIT:1> ] = <NUM_LIT:0.0> ; return <NUM_LIT:0> <EOL> } <EOL> if ( ix < <NUM_LIT> ) { <EOL> if ( hx > <NUM_LIT:0> ) { <EOL> z = x - pio2_1 <EOL> if ( ix != <NUM_LIT> ) { <EOL> y [ <NUM_LIT:0> ] = z - pio2_1t <EOL> y [ <NUM_LIT:1> ] = ( z - y [ <NUM_LIT:0> ] ) - pio2_1t <EOL> } else { <EOL> z -= pio2_2 <EOL> y [ <NUM_LIT:0> ] = z - pio2_2t <EOL> y [ <NUM_LIT:1> ] = ( z - y [ <NUM_LIT:0> ] ) - pio2_2t <EOL> } <EOL> return <NUM_LIT:1> <EOL> } else { <EOL> z = x + pio2_1 <EOL> if ( ix != <NUM_LIT> ) { <EOL> y [ <NUM_LIT:0> ] = z + pio2_1t <EOL> y [ <NUM_LIT:1> ] = ( z - y [ <NUM_LIT:0> ] ) + pio2_1t <EOL> } else { <EOL> z += pio2_2 <EOL> y [ <NUM_LIT:0> ] = z + pio2_2t <EOL> y [ <NUM_LIT:1> ] = ( z - y [ <NUM_LIT:0> ] ) + pio2_2t <EOL> } <EOL> return - <NUM_LIT:1> <EOL> } <EOL> } <EOL> if ( ix <= <NUM_LIT> ) { <EOL> t = fabs ( x ) <EOL> n = ( t * invpio2 + half ) . toInt ( ) <EOL> fn = n . toDouble ( ) <EOL> r = t - fn * pio2_1 <EOL> w = fn * pio2_1t <EOL> if ( n < <NUM_LIT> && ix != npio2_hw [ n - <NUM_LIT:1> ] ) { <EOL> y [ <NUM_LIT:0> ] = r - w <EOL> } else { <EOL> j = ix shr <NUM_LIT:20> <EOL> y [ <NUM_LIT:0> ] = r - w <EOL> i = j - ( ( ( __HI ( y [ <NUM_LIT:0> ] ) ) shr <NUM_LIT:20> ) and <NUM_LIT> ) <EOL> if ( i > <NUM_LIT:16> ) { <EOL> t = r <EOL> w = fn * pio2_2 <EOL> r = t - w <EOL> w = fn * pio2_2t - ( ( t - r ) - w ) <EOL> y [ <NUM_LIT:0> ] = r - w <EOL> i = j - ( ( ( __HI ( y [ <NUM_LIT:0> ] ) ) shr <NUM_LIT:20> ) and <NUM_LIT> ) <EOL> if ( i > <NUM_LIT> ) { <EOL> t = r <EOL> w = fn * pio2_3 <EOL> r = t - w <EOL> w = fn * pio2_3t - ( ( t - r ) - w ) <EOL> y [ <NUM_LIT:0> ] = r - w <EOL> } <EOL> } <EOL> } <EOL> y [ <NUM_LIT:1> ] = ( r - y [ <NUM_LIT:0> ] ) - w <EOL> if ( hx < <NUM_LIT:0> ) { <EOL> y [ <NUM_LIT:0> ] = - y [ <NUM_LIT:0> ] ; y [ <NUM_LIT:1> ] = - y [ <NUM_LIT:1> ] ; return - n <EOL> } else return n <EOL> } <EOL> if ( ix >= <NUM_LIT> ) { <EOL> y [ <NUM_LIT:1> ] = x - x <EOL> y [ <NUM_LIT:0> ] = y [ <NUM_LIT:1> ] ; return <NUM_LIT:0> <EOL> } <EOL> z = doubleSetWord ( d = z , lo = __LO ( x ) ) <EOL> e0 = ( ix shr <NUM_LIT:20> ) - <NUM_LIT> <EOL> z = doubleSetWord ( d = z , hi = ix - ( e0 shl <NUM_LIT:20> ) ) <EOL> i = <NUM_LIT:0> <EOL> while ( i < <NUM_LIT:2> ) { <EOL> tx [ i ] = ( z . toInt ( ) ) . toDouble ( ) <EOL> z = ( z - tx [ i ] ) * two24 <EOL> i ++ <EOL> } <EOL> tx [ <NUM_LIT:2> ] = z <EOL> nx = <NUM_LIT:3> <EOL> while ( tx [ nx - <NUM_LIT:1> ] == zero ) nx -- <EOL> n = __kernel_rem_pio2 ( tx , y , e0 , nx , <NUM_LIT:2> , two_over_pi ) <EOL> if ( hx < <NUM_LIT:0> ) { <EOL> y [ <NUM_LIT:0> ] = - y [ <NUM_LIT:0> ] ; y [ <NUM_LIT:1> ] = - y [ <NUM_LIT:1> ] ; return - n <EOL> } <EOL> return n <EOL> }


{ <EOL> while ( true ) { <EOL> } <EOL> }


{ <EOL> while ( true ) { <EOL> if ( bar ( ) ) continue <EOL> return true <EOL> } <EOL> }


= true


@ JsName ( "<STR_LIT>" ) <EOL> public fun test ( )


fun ExecutionStackFrame ? . traverseStack ( )

= generateSequence ( this ) { it . previous }


= MutableExecutionStackFrame ( this )


fun JvmBackendContext . createJvmIrBuilder ( symbol : IrSymbol , startOffset : Int = UNDEFINED_OFFSET , endOffset : Int = UNDEFINED_OFFSET , ) : JvmIrBuilder

= JvmIrBuilder ( this , symbol , startOffset , endOffset )


fun JvmBackendContext . createJvmIrBuilder ( symbol : IrSymbol , source : IrElement ) : JvmIrBuilder

= <EOL> JvmIrBuilder ( this , symbol , source . startOffset , source . endOffset )


fun JvmBackendContext . createJvmIrBuilder ( scopeWithIr : ScopeWithIr ) : JvmIrBuilder

= <EOL> JvmIrBuilder ( this , scopeWithIr . scope . scopeOwnerSymbol , UNDEFINED_OFFSET , UNDEFINED_OFFSET )


fun JvmBackendContext . createJvmIrBuilder ( scopeWithIr : ScopeWithIr , startOffset : Int , endOffset : Int ) : JvmIrBuilder

= <EOL> JvmIrBuilder ( this , scopeWithIr . scope . scopeOwnerSymbol , startOffset , endOffset )


fun JvmBackendContext . createJvmIrBuilder ( scopeWithIr : ScopeWithIr , source : IrElement ) : JvmIrBuilder

= <EOL> JvmIrBuilder ( this , scopeWithIr . scope . scopeOwnerSymbol , source . startOffset , source . endOffset )


= x == y


fun test2d ( x : Double , y : Double ? )

= x == y


= y is Double && x == y


= x is Double && y is Double && x == y


= y is Float && x == y


= x is Float && y is Float && x == y


= x is Float && y is Double && x == y


= x is Double && y is Float && x == y


{ <EOL> with ( project . plugins ) { <EOL> apply ( "<STR_LIT>" ) <EOL> apply ( "<STR_LIT>" ) <EOL> apply ( "<STR_LIT>" ) <EOL> apply ( "<STR_LIT>" ) <EOL> apply ( "<STR_LIT>" ) <EOL> apply ( "<STR_LIT>" ) <EOL> } <EOL> setupVersionsPlugin ( ) <EOL> setupKtLintForAllProjects ( ) <EOL> println ( "<STR_LIT>" ) <EOL> println ( "<STR_LIT>" ) <EOL> project . subprojects { <EOL> extensions . add ( RootSettingsExtension . name , settings ) <EOL> } <EOL> project . allprojects { <EOL> version = settings . mavenVersion <EOL> addAllBuildRepositories ( ) <EOL> getOrCreateExtension ( BuildSettingsExtension ) . apply { <EOL> withJvmTarget ( settings . jvmTarget ) <EOL> withLanguageLevel ( settings . stableKotlinLanguageLevel ) <EOL> } <EOL> } <EOL> project . afterEvaluate { <EOL> configureTasks ( ) <EOL> } <EOL> }


{ <EOL> registerUpdateLibrariesTask ( ) <EOL> registerReadmeTasks ( ) <EOL> registerCompatibilityTableTask ( ) <EOL> registerKotlinVersionUpdateTask ( ) <EOL> registerLibrariesUpdateTasks ( ) <EOL> registerCleanTasks ( ) <EOL> configureJarTasks ( ) <EOL> val installTasksConfigurator = InstallTasksConfigurator ( project , settings ) <EOL> installTasksConfigurator . registerLocalInstallTasks ( ) <EOL> registerDistributionTasks ( ) <EOL> installTasksConfigurator . registerInstallTasks ( false , settings . distribKernelDir , settings . distribBuildDir ) <EOL> registerPythonPackageTasks ( ) <EOL> registerAggregateUploadTasks ( ) <EOL> }


{ <EOL> project . plugins . apply ( "<STR_LIT>" ) <EOL> project . tasks . withType < DependencyUpdatesTask > { <EOL> rejectVersionIf { <EOL> isNonStableVersion ( candidate . version ) && ! isNonStableVersion ( currentVersion ) <EOL> } <EOL> } <EOL> }


private fun setupKtLintForAllProjects ( )

{ <EOL> val ktlintVersion = project . defaultVersionCatalog . versions . ktlint <EOL> project . allprojects { <EOL> plugins . apply ( "<STR_LIT>" ) <EOL> extensions . configure < KtlintExtension > { <EOL> version . set ( ktlintVersion ) <EOL> enableExperimentalRules . set ( true ) <EOL> } <EOL> } <EOL> }


private fun registerUpdateLibrariesTask ( )

{ <EOL> project . tasks . register < UpdateLibrariesTask > ( UPDATE_LIBRARIES_TASK ) <EOL> project . tasks . withType < Test > { <EOL> dependsOn ( UPDATE_LIBRARIES_TASK ) <EOL> } <EOL> }


{ <EOL> listOf ( true , false ) . forEach { local -> <EOL> val dir = if ( local ) settings . localInstallDir else settings . distribBuildDir <EOL> project . tasks . register ( makeTaskName ( settings . cleanInstallDirTaskPrefix , local ) ) { <EOL> group = if ( local ) LOCAL_INSTALL_GROUP else DISTRIBUTION_GROUP <EOL> doLast { <EOL> if ( ! dir . deleteRecursively ( ) ) { <EOL> throw Exception ( "<STR_LIT>" ) <EOL> } <EOL> } <EOL> } <EOL> } <EOL> }


private fun registerDistributionTasks ( )

{ <EOL> DistributionTasksConfigurator ( project , settings ) . registerTasks ( ) <EOL> }


private fun registerPythonPackageTasks ( )

{ <EOL> PythonPackageTasksConfigurator ( project , settings ) . registerTasks ( ) <EOL> }


private fun registerAggregateUploadTasks ( )

{ <EOL> val infixToSpec = mapOf < String , ( UploadTaskSpecs < * > ) -> TaskSpec > ( "<STR_LIT>" to { it . dev } , "<STR_LIT>" to { it . stable } ) <EOL> infixToSpec . forEach { ( infix , taskSpecGetter ) -> <EOL> val tasksList = mutableListOf < String > ( ) <EOL> listOf ( settings . condaTaskSpecs , settings . pyPiTaskSpecs ) . forEach { taskSpec -> <EOL> tasksList . add ( taskSpecGetter ( taskSpec ) . taskName ) <EOL> } <EOL> if ( infix == "<STR_LIT>" ) { <EOL> tasksList . add ( "<STR_LIT>" ) <EOL> tasksList . add ( "<STR_LIT>" ) <EOL> tasksList . add ( "<STR_LIT>" ) <EOL> } <EOL> project . tasks . register ( "<STR_LIT>" ) { <EOL> group = DISTRIBUTION_GROUP <EOL> dependsOn ( tasksList ) <EOL> } <EOL> } <EOL> }


private fun registerKotlinVersionUpdateTask ( )

{ <EOL> KernelVersionUpdateTasksConfigurator ( project , settings ) . registerTasks ( ) <EOL> }


private fun registerLibrariesUpdateTasks ( )

{ <EOL> LibraryUpdateTasksConfigurator ( project , settings ) . registerTasks ( ) <EOL> }


{ <EOL> ReadmeGenerator ( project , settings ) . registerTasks { <EOL> dependsOn ( UPDATE_LIBRARIES_TASK ) <EOL> } <EOL> }


private fun registerCompatibilityTableTask ( )

{ <EOL> CompatibilityTableGenerator ( project , settings ) . registerTasks { } <EOL> }


{ <EOL> val jarTask = project . tasks . named ( JAR_TASK , Jar :: class . java ) { <EOL> manifest { <EOL> attributes [ "<STR_LIT>" ] = settings . mainClassFQN <EOL> attributes [ "<STR_LIT>" ] = project . version <EOL> } <EOL> } <EOL> project . tasks . named ( SHADOW_JAR_TASK , ShadowJar :: class . java ) { <EOL> archiveBaseName . set ( settings . packageName ) <EOL> archiveClassifier . set ( "<STR_LIT>" ) <EOL> mergeServiceFiles ( ) <EOL> transform ( ComponentsXmlResourceTransformer ( ) ) <EOL> manifest { <EOL> attributes ( jarTask . get ( ) . manifest . attributes ) <EOL> } <EOL> } <EOL> }


private fun DiscriminatorHolder ? . trySkip ( unknownKey : String ) : Boolean

{ <EOL> if ( this == null ) return false <EOL> if ( discriminatorToSkip == unknownKey ) { <EOL> discriminatorToSkip = null <EOL> return true <EOL> } <EOL> return false <EOL> }


override fun decodeJsonElement ( ) : JsonElement

= JsonTreeReader ( json . configuration , lexer ) . read ( )


override fun < T > decodeSerializableValue ( deserializer : DeserializationStrategy < T > ) : T

{ <EOL> try { <EOL> if ( deserializer !is AbstractPolymorphicSerializer < * > || json . configuration . useArrayPolymorphism ) { <EOL> return deserializer . deserialize ( this ) <EOL> } <EOL> val discriminator = deserializer . descriptor . classDiscriminator ( json ) <EOL> val type = lexer . peekLeadingMatchingValue ( discriminator , configuration . isLenient ) <EOL> ? : <EOL> return decodeSerializableValuePolymorphic < T > ( deserializer as DeserializationStrategy < T > ) <EOL> @ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> val actualSerializer = try { <EOL> deserializer . findPolymorphicSerializer ( this , type ) <EOL> } catch ( it : SerializationException ) { <EOL> val message = it . message ! ! . substringBefore ( '<CHAR_LIT:\n>' ) . removeSuffix ( "<STR_LIT:.>" ) <EOL> val hint = it . message ! ! . substringAfter ( '<CHAR_LIT:\n>' , missingDelimiterValue = "<STR_LIT>" ) <EOL> lexer . fail ( message , hint = hint ) <EOL> } as DeserializationStrategy < T > <EOL> discriminatorHolder = DiscriminatorHolder ( discriminator ) <EOL> return actualSerializer . deserialize ( this ) <EOL> } catch ( e : MissingFieldException ) { <EOL> if ( e . message ! ! . contains ( "<STR_LIT>" ) ) throw e <EOL> throw MissingFieldException ( e . missingFields , e . message + "<STR_LIT>" + lexer . path . getPath ( ) , e ) <EOL> } <EOL> }


override fun beginStructure ( descriptor : SerialDescriptor ) : CompositeDecoder

{ <EOL> val newMode = json . switchMode ( descriptor ) <EOL> lexer . path . pushDescriptor ( descriptor ) <EOL> lexer . consumeNextToken ( newMode . begin ) <EOL> checkLeadingComma ( ) <EOL> return when ( newMode ) { <EOL> WriteMode . LIST , WriteMode . MAP , WriteMode . POLY_OBJ -> StreamingJsonDecoder ( json , newMode , lexer , descriptor , discriminatorHolder ) <EOL> else -> if ( mode == newMode && json . configuration . explicitNulls ) { <EOL> this <EOL> } else { <EOL> StreamingJsonDecoder ( json , newMode , lexer , descriptor , discriminatorHolder ) <EOL> } <EOL> } <EOL> }


override fun endStructure ( descriptor : SerialDescriptor )

{ <EOL> if ( json . configuration . ignoreUnknownKeys && descriptor . elementsCount == <NUM_LIT:0> ) { <EOL> skipLeftoverElements ( descriptor ) <EOL> } <EOL> if ( lexer . tryConsumeComma ( ) && ! json . configuration . allowTrailingComma ) lexer . invalidTrailingComma ( "<STR_LIT>" ) <EOL> lexer . consumeNextToken ( mode . end ) <EOL> lexer . path . popDescriptor ( ) <EOL> }


private fun skipLeftoverElements ( descriptor : SerialDescriptor )

{ <EOL> while ( decodeElementIndex ( descriptor ) != DECODE_DONE ) { <EOL> } <EOL> }


override fun decodeNotNullMark ( ) : Boolean

{ <EOL> return ! ( elementMarker ? . isUnmarkedNull ? : false ) && ! lexer . tryConsumeNull ( ) <EOL> }


{ <EOL> return null <EOL> }


{ <EOL> if ( lexer . peekNextToken ( ) == TC_COMMA ) { <EOL> lexer . fail ( "<STR_LIT>" ) <EOL> } <EOL> }


override fun < T > decodeSerializableElement ( descriptor : SerialDescriptor , index : Int , deserializer : DeserializationStrategy < T > , previousValue : T ? <EOL> ) : T

{ <EOL> val isMapKey = mode == WriteMode . MAP && index and <NUM_LIT:1> == <NUM_LIT:0> <EOL> if ( isMapKey ) { <EOL> lexer . path . resetCurrentMapKey ( ) <EOL> } <EOL> val value = super . decodeSerializableElement ( descriptor , index , deserializer , previousValue ) <EOL> if ( isMapKey ) { <EOL> lexer . path . updateCurrentMapKey ( value ) <EOL> } <EOL> return value <EOL> }


override fun decodeElementIndex ( descriptor : SerialDescriptor ) : Int

{ <EOL> val index = when ( mode ) { <EOL> WriteMode . OBJ -> decodeObjectIndex ( descriptor ) <EOL> WriteMode . MAP -> decodeMapIndex ( ) <EOL> else -> decodeListIndex ( ) <EOL> } <EOL> if ( mode != WriteMode . MAP ) { <EOL> lexer . path . updateDescriptorIndex ( index ) <EOL> } <EOL> return index <EOL> }


{ <EOL> var hasComma = false <EOL> val decodingKey = currentIndex % <NUM_LIT:2> != <NUM_LIT:0> <EOL> if ( decodingKey ) { <EOL> if ( currentIndex != - <NUM_LIT:1> ) { <EOL> hasComma = lexer . tryConsumeComma ( ) <EOL> } <EOL> } else { <EOL> lexer . consumeNextToken ( COLON ) <EOL> } <EOL> return if ( lexer . canConsumeValue ( ) ) { <EOL> if ( decodingKey ) { <EOL> if ( currentIndex == - <NUM_LIT:1> ) lexer . require ( ! hasComma ) { "<STR_LIT>" } <EOL> else lexer . require ( hasComma ) { "<STR_LIT>" } <EOL> } <EOL> ++ currentIndex <EOL> } else { <EOL> if ( hasComma && ! json . configuration . allowTrailingComma ) lexer . invalidTrailingComma ( ) <EOL> CompositeDecoder . DECODE_DONE <EOL> } <EOL> }


private fun coerceInputValue ( descriptor : SerialDescriptor , index : Int ) : Boolean

= json . tryCoerceValue ( descriptor , index , { lexer . tryConsumeNull ( it ) } , { lexer . peekString ( configuration . isLenient ) } , { lexer . consumeString ( ) } )


private fun decodeObjectIndex ( descriptor : SerialDescriptor ) : Int

{ <EOL> var hasComma = lexer . tryConsumeComma ( ) <EOL> while ( lexer . canConsumeValue ( ) ) { <EOL> hasComma = false <EOL> val key = decodeStringKey ( ) <EOL> lexer . consumeNextToken ( COLON ) <EOL> val index = descriptor . getJsonNameIndex ( json , key ) <EOL> val isUnknown = if ( index != UNKNOWN_NAME ) { <EOL> if ( configuration . coerceInputValues && coerceInputValue ( descriptor , index ) ) { <EOL> hasComma = lexer . tryConsumeComma ( ) <EOL> false <EOL> } else { <EOL> elementMarker ? . mark ( index ) <EOL> return index <EOL> } <EOL> } else { <EOL> true <EOL> } <EOL> if ( isUnknown ) { <EOL> hasComma = handleUnknown ( key ) <EOL> } <EOL> } <EOL> if ( hasComma && ! json . configuration . allowTrailingComma ) lexer . invalidTrailingComma ( ) <EOL> return elementMarker ? . nextUnmarkedIndex ( ) ? : CompositeDecoder . DECODE_DONE <EOL> }


private fun handleUnknown ( key : String ) : Boolean

{ <EOL> if ( configuration . ignoreUnknownKeys || discriminatorHolder . trySkip ( key ) ) { <EOL> lexer . skipElement ( configuration . isLenient ) <EOL> } else { <EOL> lexer . failOnUnknownKey ( key ) <EOL> } <EOL> return lexer . tryConsumeComma ( ) <EOL> }


{ <EOL> val hasComma = lexer . tryConsumeComma ( ) <EOL> return if ( lexer . canConsumeValue ( ) ) { <EOL> if ( currentIndex != - <NUM_LIT:1> && ! hasComma ) lexer . fail ( "<STR_LIT>" ) <EOL> ++ currentIndex <EOL> } else { <EOL> if ( hasComma && ! json . configuration . allowTrailingComma ) lexer . invalidTrailingComma ( "<STR_LIT>" ) <EOL> CompositeDecoder . DECODE_DONE <EOL> } <EOL> }


override fun decodeBoolean ( ) : Boolean

{ <EOL> return lexer . consumeBooleanLenient ( ) <EOL> }


{ <EOL> val value = lexer . consumeNumericLiteral ( ) <EOL> if ( value != value . toByte ( ) . toLong ( ) ) lexer . fail ( "<STR_LIT>" ) <EOL> return value . toByte ( ) <EOL> }


{ <EOL> val value = lexer . consumeNumericLiteral ( ) <EOL> if ( value != value . toShort ( ) . toLong ( ) ) lexer . fail ( "<STR_LIT>" ) <EOL> return value . toShort ( ) <EOL> }


{ <EOL> val value = lexer . consumeNumericLiteral ( ) <EOL> if ( value != value . toInt ( ) . toLong ( ) ) lexer . fail ( "<STR_LIT>" ) <EOL> return value . toInt ( ) <EOL> }


{ <EOL> return lexer . consumeNumericLiteral ( ) <EOL> }


{ <EOL> val result = lexer . parseString ( "<STR_LIT>" ) { toFloat ( ) } <EOL> val specialFp = json . configuration . allowSpecialFloatingPointValues <EOL> if ( specialFp || result . isFinite ( ) ) return result <EOL> lexer . throwInvalidFloatingPointDecoded ( result ) <EOL> }


{ <EOL> val result = lexer . parseString ( "<STR_LIT>" ) { toDouble ( ) } <EOL> val specialFp = json . configuration . allowSpecialFloatingPointValues <EOL> if ( specialFp || result . isFinite ( ) ) return result <EOL> lexer . throwInvalidFloatingPointDecoded ( result ) <EOL> }


{ <EOL> val string = lexer . consumeStringLenient ( ) <EOL> if ( string . length != <NUM_LIT:1> ) lexer . fail ( "<STR_LIT>" ) <EOL> return string [ <NUM_LIT:0> ] <EOL> }


private fun decodeStringKey ( ) : String

{ <EOL> return if ( configuration . isLenient ) { <EOL> lexer . consumeStringLenientNotNull ( ) <EOL> } else { <EOL> lexer . consumeKeyString ( ) <EOL> } <EOL> }


{ <EOL> return if ( configuration . isLenient ) { <EOL> lexer . consumeStringLenientNotNull ( ) <EOL> } else { <EOL> lexer . consumeString ( ) <EOL> } <EOL> }


override fun decodeStringChunked ( consumeChunk : ( chunk : String ) -> Unit )

{ <EOL> lexer . consumeStringChunked ( configuration . isLenient , consumeChunk ) <EOL> }


override fun decodeInline ( descriptor : SerialDescriptor ) : Decoder

= <EOL> if ( descriptor . isUnsignedNumber ) JsonDecoderForUnsignedTypes ( lexer , json ) <EOL> else super . decodeInline ( descriptor )


override fun decodeEnum ( enumDescriptor : SerialDescriptor ) : Int

{ <EOL> return enumDescriptor . getJsonNameIndexOrThrow ( json , decodeString ( ) , "<STR_LIT>" + lexer . path . getPath ( ) ) <EOL> }


@ JsonFriendModuleApi <EOL> public fun < T > decodeStringToJsonTree ( json : Json , deserializer : DeserializationStrategy < T > , source : String ) : JsonElement

{ <EOL> val lexer = StringJsonLexer ( source ) <EOL> val input = StreamingJsonDecoder ( json , WriteMode . OBJ , lexer , deserializer . descriptor , null ) <EOL> val tree = input . decodeJsonElement ( ) <EOL> lexer . expectEof ( ) <EOL> return tree <EOL> }


= error ( "<STR_LIT>" )


= lexer . parseString ( "<STR_LIT>" ) { toUInt ( ) . toInt ( ) }


= lexer . parseString ( "<STR_LIT>" ) { toULong ( ) . toLong ( ) }


= lexer . parseString ( "<STR_LIT>" ) { toUByte ( ) . toByte ( ) }


= lexer . parseString ( "<STR_LIT>" ) { toUShort ( ) . toShort ( ) }


private inline fun < T > AbstractJsonLexer . parseString ( expectedType : String , block : String . ( ) -> T ) : T

{ <EOL> val input = consumeStringLenient ( ) <EOL> try { <EOL> return input . block ( ) <EOL> } catch ( e : IllegalArgumentException ) { <EOL> fail ( "<STR_LIT>" ) <EOL> } <EOL> }


fun bar ( x : Int ) : Int


= x + <NUM_LIT:1>


= x - <NUM_LIT:1>


public fun renderSymbol ( analysisSession : KtAnalysisSession , symbol : KtPropertyGetterSymbol , declarationRenderer : KtDeclarationRenderer , printer : PrettyPrinter , )


override fun renderSymbol ( analysisSession : KtAnalysisSession , symbol : KtPropertyGetterSymbol , declarationRenderer : KtDeclarationRenderer , printer : PrettyPrinter , )

{ <EOL> printer { <EOL> "<STR_LIT:U+0020>" . separated ( { <EOL> renderAnnotationsModifiersAndContextReceivers ( analysisSession , symbol , declarationRenderer , printer , KtTokens . GET_KEYWORD ) <EOL> declarationRenderer . valueParametersRenderer . renderValueParameters ( analysisSession , symbol , declarationRenderer , printer ) <EOL> } , { declarationRenderer . accessorBodyRenderer . renderBody ( analysisSession , symbol , printer ) } , ) <EOL> } <EOL> }


override fun contains ( element : T ) : Boolean

= this == element


override fun containsAll ( elements : Collection < T > ) : Boolean

= <EOL> if ( elements . isEmpty ( ) ) true <EOL> else elements . all { this == it }


= false


override fun iterator ( ) : Iterator < T >

= iterator { <EOL> @ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> yield ( this @ SelfRepresentingSingletonSet as T ) <EOL> }


{ <EOL> val system = object : BaseTestSystem ( ) { } <EOL> val diagnose = XcodeDiagnostic ( system ) . diagnose ( ) <EOL> val expected = Diagnosis . Builder ( "<STR_LIT>" ) . apply { <EOL> addSuccess ( "<STR_LIT>" , "<STR_LIT>" , ) <EOL> addInfo ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> addEnvironment ( EnvironmentPiece . Xcode ( Version ( "<STR_LIT>" ) ) ) <EOL> } . build ( ) <EOL> assertEquals ( expected , diagnose ) <EOL> }


{ <EOL> val system = object : BaseTestSystem ( ) { <EOL> override fun executeCmd ( cmd : String ) : ProcessResult = when ( cmd ) { <EOL> "<STR_LIT>" -> { <EOL> ProcessResult ( <NUM_LIT:0> , "<STR_LIT>" ) <EOL> } <EOL> else -> super . executeCmd ( cmd ) <EOL> } <EOL> } <EOL> val diagnose = XcodeDiagnostic ( system ) . diagnose ( ) <EOL> val expected = Diagnosis . Builder ( "<STR_LIT>" ) . apply { <EOL> addFailure ( "<STR_LIT>" , "<STR_LIT>" , ) <EOL> } . build ( ) <EOL> assertEquals ( expected , diagnose ) <EOL> }


@ Test <EOL> fun `check Xcode custom installation` ( )

{ <EOL> val system = object : BaseTestSystem ( ) { <EOL> override fun executeCmd ( cmd : String ) : ProcessResult = when ( cmd ) { <EOL> "<STR_LIT>" -> { <EOL> ProcessResult ( <NUM_LIT:0> , "<STR_LIT>" ) <EOL> } <EOL> "<STR_LIT>" -> { <EOL> ProcessResult ( <NUM_LIT:0> , "<STR_LIT>" ) <EOL> } <EOL> "<STR_LIT>" -> { <EOL> ProcessResult ( <NUM_LIT:0> , "<STR_LIT>" ) <EOL> } <EOL> else -> super . executeCmd ( cmd ) <EOL> } <EOL> override fun findAppsPathsInDirectory ( prefix : String , directory : String , recursively : Boolean ) : List < String > { <EOL> if ( prefix == "<STR_LIT>" && directory == "<STR_LIT>" ) { <EOL> return listOf ( "<STR_LIT>" ) <EOL> } <EOL> return super . findAppsPathsInDirectory ( prefix , directory , recursively ) <EOL> } <EOL> } <EOL> val diagnose = XcodeDiagnostic ( system ) . diagnose ( ) <EOL> val expected = Diagnosis . Builder ( "<STR_LIT>" ) . apply { <EOL> addSuccess ( "<STR_LIT>" , "<STR_LIT>" , ) <EOL> addEnvironment ( EnvironmentPiece . Xcode ( Version ( "<STR_LIT>" ) ) ) <EOL> addInfo ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> } . build ( ) <EOL> assertEquals ( expected , diagnose ) <EOL> }


@ Test <EOL> fun `check multiple Xcode installations` ( )

{ <EOL> val system = object : BaseTestSystem ( ) { <EOL> override fun executeCmd ( cmd : String ) : ProcessResult = when ( cmd ) { <EOL> "<STR_LIT>" -> { <EOL> ProcessResult ( <NUM_LIT:0> , "<STR_LIT>" ) <EOL> } <EOL> "<STR_LIT>" -> { <EOL> ProcessResult ( <NUM_LIT:0> , "<STR_LIT>" ) <EOL> } <EOL> "<STR_LIT>" -> { <EOL> ProcessResult ( <NUM_LIT:0> , "<STR_LIT>" ) <EOL> } <EOL> "<STR_LIT>" -> { <EOL> ProcessResult ( <NUM_LIT:0> , "<STR_LIT>" ) <EOL> } <EOL> else -> super . executeCmd ( cmd ) <EOL> } <EOL> } <EOL> val diagnose = XcodeDiagnostic ( system ) . diagnose ( ) <EOL> val expected = Diagnosis . Builder ( "<STR_LIT>" ) . apply { <EOL> addInfo ( "<STR_LIT>" ) <EOL> addSuccess ( "<STR_LIT>" , "<STR_LIT>" , ) <EOL> addEnvironment ( EnvironmentPiece . Xcode ( Version ( "<STR_LIT>" ) ) ) <EOL> addSuccess ( "<STR_LIT>" , "<STR_LIT>" , ) <EOL> addEnvironment ( EnvironmentPiece . Xcode ( Version ( "<STR_LIT>" ) ) ) <EOL> addSuccess ( "<STR_LIT>" , ) <EOL> addInfo ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> } . build ( ) <EOL> assertEquals ( expected , diagnose ) <EOL> }


@ Test <EOL> fun `check Xcode requires the license` ( )

{ <EOL> val system = object : BaseTestSystem ( ) { <EOL> override fun executeCmd ( cmd : String ) : ProcessResult = when ( cmd ) { <EOL> "<STR_LIT>" -> { <EOL> ProcessResult ( <NUM_LIT:0> , "<STR_LIT>" ) <EOL> } <EOL> else -> super . executeCmd ( cmd ) <EOL> } <EOL> } <EOL> val diagnose = XcodeDiagnostic ( system ) . diagnose ( ) <EOL> val expected = Diagnosis . Builder ( "<STR_LIT>" ) . apply { <EOL> addSuccess ( "<STR_LIT>" , "<STR_LIT>" , ) <EOL> addEnvironment ( EnvironmentPiece . Xcode ( Version ( "<STR_LIT>" ) ) ) <EOL> addFailure ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> addInfo ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> } . build ( ) <EOL> assertEquals ( expected , diagnose ) <EOL> }


@ Test <EOL> fun `check external Command line tools` ( )

{ <EOL> val cltPath = "<STR_LIT>" <EOL> val system = object : BaseTestSystem ( ) { <EOL> override fun executeCmd ( cmd : String ) : ProcessResult = when ( cmd ) { <EOL> "<STR_LIT>" -> { <EOL> ProcessResult ( <NUM_LIT:0> , cltPath ) <EOL> } <EOL> else -> super . executeCmd ( cmd ) <EOL> } <EOL> } <EOL> val diagnose = XcodeDiagnostic ( system ) . diagnose ( ) <EOL> val expected = Diagnosis . Builder ( "<STR_LIT>" ) . apply { <EOL> addSuccess ( "<STR_LIT>" , "<STR_LIT>" , ) <EOL> addEnvironment ( EnvironmentPiece . Xcode ( Version ( "<STR_LIT>" ) ) ) <EOL> addFailure ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) <EOL> addInfo ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> } . build ( ) <EOL> assertEquals ( expected , diagnose ) <EOL> }


@ Test <EOL> fun `check misconfigured Command line tools` ( )

{ <EOL> val system = object : BaseTestSystem ( ) { <EOL> override fun executeCmd ( cmd : String ) : ProcessResult = when ( cmd ) { <EOL> "<STR_LIT>" -> { <EOL> ProcessResult ( - <NUM_LIT:1> , null ) <EOL> } <EOL> else -> super . executeCmd ( cmd ) <EOL> } <EOL> } <EOL> val diagnose = XcodeDiagnostic ( system ) . diagnose ( ) <EOL> val expected = Diagnosis . Builder ( "<STR_LIT>" ) . apply { <EOL> addSuccess ( "<STR_LIT>" , "<STR_LIT>" , ) <EOL> addEnvironment ( EnvironmentPiece . Xcode ( Version ( "<STR_LIT>" ) ) ) <EOL> addFailure ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> addInfo ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> } . build ( ) <EOL> assertEquals ( expected , diagnose ) <EOL> }


@ Test <EOL> fun `check Xcode requires first launch` ( )


@ Test <EOL> fun `check Xcode custom JAVA_HOME` ( )

{ <EOL> val system = object : BaseTestSystem ( ) { <EOL> override fun executeCmd ( cmd : String ) : ProcessResult = when ( cmd ) { <EOL> "<STR_LIT>" -> { <EOL> ProcessResult ( <NUM_LIT:0> , "<STR_LIT>" ) <EOL> } <EOL> else -> super . executeCmd ( cmd ) <EOL> } <EOL> } <EOL> val diagnose = XcodeDiagnostic ( system ) . diagnose ( ) <EOL> val expected = Diagnosis . Builder ( "<STR_LIT>" ) . apply { <EOL> addSuccess ( "<STR_LIT>" , "<STR_LIT>" , ) <EOL> addInfo ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> addEnvironment ( EnvironmentPiece . Xcode ( Version ( "<STR_LIT>" ) ) ) <EOL> } . build ( ) <EOL> assertEquals ( expected , diagnose ) <EOL> }


@ Test <EOL> fun `check Xcode system JAVA_HOME info` ( )

{ <EOL> val system = object : BaseTestSystem ( ) { <EOL> override fun executeCmd ( cmd : String ) : ProcessResult = when ( cmd ) { <EOL> "<STR_LIT>" -> { <EOL> ProcessResult ( - <NUM_LIT:1> , null ) <EOL> } <EOL> else -> super . executeCmd ( cmd ) <EOL> } <EOL> } <EOL> val diagnose = XcodeDiagnostic ( system ) . diagnose ( ) <EOL> val expected = Diagnosis . Builder ( "<STR_LIT>" ) . apply { <EOL> addSuccess ( "<STR_LIT>" , "<STR_LIT>" , ) <EOL> addInfo ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> addEnvironment ( EnvironmentPiece . Xcode ( Version ( "<STR_LIT>" ) ) ) <EOL> } . build ( ) <EOL> assertEquals ( expected , diagnose ) <EOL> }


override fun < T > use ( block : SampleAnalysisEnvironment . ( ) -> T ) : T

{ <EOL> return runBlocking ( Dispatchers . Default ) { <EOL> SamplesKotlinAnalysis ( sourceSets = context . configuration . sourceSets , context = context ) . use { samplesKotlinAnalysis -> <EOL> val sampleAnalysisEnvironment = SymbolSampleAnalysisEnvironment ( samplesKotlinAnalysis = samplesKotlinAnalysis , projectKotlinAnalysis = projectKotlinAnalysis , sampleRewriter = sampleRewriter , dokkaLogger = context . logger ) <EOL> block ( sampleAnalysisEnvironment ) <EOL> } <EOL> } <EOL> }


override fun resolveSample ( sourceSet : DokkaSourceSet , fullyQualifiedLink : String ) : SampleSnippet ?

{ <EOL> val psiElement = findPsiElement ( sourceSet , fullyQualifiedLink ) <EOL> if ( psiElement == null ) { <EOL> dokkaLogger . warn ( "<STR_LIT>" + "<STR_LIT>" ) <EOL> return null <EOL> } else if ( psiElement . language != KotlinLanguage . INSTANCE ) { <EOL> dokkaLogger . warn ( "<STR_LIT>" ) <EOL> return null <EOL> } else if ( psiElement !is KtFunction ) { <EOL> dokkaLogger . warn ( "<STR_LIT>" ) <EOL> return null <EOL> } <EOL> val imports = processImports ( psiElement , sampleRewriter ) <EOL> val body = processBody ( psiElement ) <EOL> return SampleSnippet ( imports , body ) <EOL> }