{ <EOL> val ann = :: s . returnType . annotations [ <NUM_LIT:0> ] as MyAnn <EOL> return if ( ann . cls == Array < String > :: class ) "<STR_LIT:OK>" else "<STR_LIT>" <EOL> }


{ <EOL> }


inline fun < T > Iterator < T > . next ( value : Any ? = definedExternally ) : IteratorResult < T >

= this . asDynamic ( ) . next ( value )


fun slice ( begin : Number ? = definedExternally , end : Number ? = definedExternally ) : SharedArrayBuffer


@ Deprecated ( "<STR_LIT>" , level = DeprecationLevel . WARNING , ) <EOL> fun createTarget ( name : String ) : T


{ <EOL> data class Movie ( val movieId : String , val title : String , val genres : String , val year : Int ) <EOL> val step1 = DataFrame <EOL> . read ( pathToCsv ) <EOL> . split ( Movie :: genres ) . by ( "<STR_LIT>" ) . inplace ( ) <EOL> . split ( Movie :: title ) . by { <EOL> listOf ( "<STR_LIT>" . toRegex ( ) . replace ( it , "<STR_LIT>" ) , "<STR_LIT>" . toRegex ( ) . findAll ( it ) . lastOrNull ( ) ? . value ? . toIntOrNull ( ) ? : - <NUM_LIT:1> ) <EOL> } . into ( Movie :: title , Movie :: year ) <EOL> . explode ( Movie :: genres ) <EOL> val step2 = step1 <EOL> . filter { it [ Movie :: year ] >= <NUM_LIT:0> && it [ Movie :: genres ] != "<STR_LIT>" } <EOL> . groupBy ( Movie :: year ) <EOL> . sortBy ( Movie :: year ) <EOL> . pivot ( Movie :: genres , inward = false ) <EOL> . aggregate { <EOL> count ( ) into "<STR_LIT>" <EOL> mean ( ) into "<STR_LIT>" <EOL> } . print ( <NUM_LIT:10> ) <EOL> }


fun String . parseCharacter ( ) : CharacterWithDiagnostic

{ <EOL> if ( length < <NUM_LIT:2> || this [ <NUM_LIT:0> ] != '<CHAR_LIT>' || this [ length - <NUM_LIT:1> ] != '<CHAR_LIT>' ) { <EOL> return CharacterWithDiagnostic ( DiagnosticKind . IncorrectCharacterLiteral ) <EOL> } <EOL> val text = substring ( <NUM_LIT:1> , length - <NUM_LIT:1> ) <EOL> if ( text . isEmpty ( ) ) { <EOL> return CharacterWithDiagnostic ( DiagnosticKind . EmptyCharacterLiteral ) <EOL> } <EOL> return if ( text [ <NUM_LIT:0> ] != '<CHAR_LIT:\\>' ) { <EOL> if ( text . length == <NUM_LIT:1> ) { <EOL> CharacterWithDiagnostic ( text [ <NUM_LIT:0> ] ) <EOL> } else { <EOL> CharacterWithDiagnostic ( DiagnosticKind . TooManyCharactersInCharacterLiteral ) <EOL> } <EOL> } else { <EOL> escapedStringToCharacter ( text ) <EOL> } <EOL> }


fun escapedStringToCharacter ( text : String ) : CharacterWithDiagnostic

{ <EOL> assert ( text . isNotEmpty ( ) && text [ <NUM_LIT:0> ] == '<CHAR_LIT:\\>' ) { <EOL> "<STR_LIT>" <EOL> } <EOL> val escape = text . substring ( <NUM_LIT:1> ) <EOL> when ( escape . length ) { <EOL> <NUM_LIT:0> -> { <EOL> return CharacterWithDiagnostic ( DiagnosticKind . IllegalEscape ) <EOL> } <EOL> <NUM_LIT:1> -> { <EOL> return translateEscape ( escape [ <NUM_LIT:0> ] ) <EOL> } <EOL> <NUM_LIT:5> -> { <EOL> if ( escape [ <NUM_LIT:0> ] == '<CHAR_LIT>' ) { <EOL> val intValue = escape . substring ( <NUM_LIT:1> ) . toIntOrNull ( <NUM_LIT:16> ) <EOL> if ( intValue != null ) { <EOL> return CharacterWithDiagnostic ( intValue . toChar ( ) ) <EOL> } <EOL> } <EOL> } <EOL> } <EOL> return CharacterWithDiagnostic ( DiagnosticKind . IllegalEscape ) <EOL> }


internal fun translateEscape ( c : Char ) : CharacterWithDiagnostic

= <EOL> when ( c ) { <EOL> '<CHAR_LIT>' -> CharacterWithDiagnostic ( '<CHAR_LIT>' ) <EOL> '<CHAR_LIT:b>' -> CharacterWithDiagnostic ( '<CHAR_LIT>' ) <EOL> '<CHAR_LIT>' -> CharacterWithDiagnostic ( '<CHAR_LIT:\n>' ) <EOL> '<CHAR_LIT>' -> CharacterWithDiagnostic ( '<CHAR_LIT:\r>' ) <EOL> '<CHAR_LIT>' -> CharacterWithDiagnostic ( '<CHAR_LIT>' ) <EOL> '<CHAR_LIT>' -> CharacterWithDiagnostic ( '<CHAR_LIT>' ) <EOL> '<CHAR_LIT:\\>' -> CharacterWithDiagnostic ( '<CHAR_LIT:\\>' ) <EOL> '<CHAR_LIT:$>' -> CharacterWithDiagnostic ( '<CHAR_LIT:$>' ) <EOL> else -> CharacterWithDiagnostic ( DiagnosticKind . IllegalEscape ) <EOL> }


fun getDiagnostic ( ) : DiagnosticKind ?

{ <EOL> return diagnostic <EOL> }


fun IElementType . toBinaryName ( ) : Name ?

{ <EOL> return OperatorConventions . BINARY_OPERATION_NAMES [ this ] <EOL> }


fun IElementType . toUnaryName ( ) : Name ?

{ <EOL> return OperatorConventions . UNARY_OPERATION_NAMES [ this ] <EOL> }


fun IElementType . toFirOperation ( ) : FirOperation

= <EOL> toFirOperationOrNull ( ) ? : error ( "<STR_LIT>" )


fun IElementType . toFirOperationOrNull ( ) : FirOperation ?

= <EOL> when ( this ) { <EOL> KtTokens . LT -> FirOperation . LT <EOL> KtTokens . GT -> FirOperation . GT <EOL> KtTokens . LTEQ -> FirOperation . LT_EQ <EOL> KtTokens . GTEQ -> FirOperation . GT_EQ <EOL> KtTokens . EQEQ -> FirOperation . EQ <EOL> KtTokens . EXCLEQ -> FirOperation . NOT_EQ <EOL> KtTokens . EQEQEQ -> FirOperation . IDENTITY <EOL> KtTokens . EXCLEQEQEQ -> FirOperation . NOT_IDENTITY <EOL> KtTokens . EQ -> FirOperation . ASSIGN <EOL> KtTokens . PLUSEQ -> FirOperation . PLUS_ASSIGN <EOL> KtTokens . MINUSEQ -> FirOperation . MINUS_ASSIGN <EOL> KtTokens . MULTEQ -> FirOperation . TIMES_ASSIGN <EOL> KtTokens . DIVEQ -> FirOperation . DIV_ASSIGN <EOL> KtTokens . PERCEQ -> FirOperation . REM_ASSIGN <EOL> KtTokens . AS_KEYWORD -> FirOperation . AS <EOL> KtTokens . AS_SAFE -> FirOperation . SAFE_AS <EOL> else -> null <EOL> }


fun FirExpression . generateNotNullOrOther ( other : FirExpression , baseSource : KtSourceElement ? , ) : FirElvisExpression

{ <EOL> return buildElvisExpression { <EOL> source = baseSource <EOL> lhs = this@generateNotNullOrOther <EOL> rhs = other <EOL> } <EOL> }


fun FirExpression . generateLazyLogicalOperation ( other : FirExpression , isAnd : Boolean , baseSource : KtSourceElement ? , ) : FirBinaryLogicExpression

{ <EOL> return buildBinaryLogicExpression { <EOL> source = baseSource <EOL> leftOperand = this@generateLazyLogicalOperation <EOL> rightOperand = other <EOL> kind = if ( isAnd ) LogicOperationKind . AND else LogicOperationKind . OR <EOL> } <EOL> }


fun FirExpression . generateContainsOperation ( argument : FirExpression , inverted : Boolean , baseSource : KtSourceElement ? , operationReferenceSource : KtSourceElement ? <EOL> ) : FirFunctionCall

{ <EOL> val containsCall = createConventionCall ( operationReferenceSource , baseSource , argument , OperatorNameConventions . CONTAINS ) <EOL> if ( ! inverted ) return containsCall <EOL> return buildFunctionCall { <EOL> source = baseSource ? . fakeElement ( KtFakeSourceElementKind . DesugaredInvertedContains ) <EOL> calleeReference = buildSimpleNamedReference { <EOL> source = operationReferenceSource ? . fakeElement ( KtFakeSourceElementKind . DesugaredInvertedContains ) <EOL> name = OperatorNameConventions . NOT <EOL> } <EOL> explicitReceiver = containsCall <EOL> origin = FirFunctionCallOrigin . Operator <EOL> } <EOL> }


fun FirExpression . generateComparisonExpression ( argument : FirExpression , operatorToken : IElementType , baseSource : KtSourceElement ? , operationReferenceSource : KtSourceElement ? , ) : FirComparisonExpression

{ <EOL> require ( operatorToken in OperatorConventions . COMPARISON_OPERATIONS ) { <EOL> "<STR_LIT>" <EOL> } <EOL> val compareToCall = createConventionCall ( operationReferenceSource , baseSource ? . fakeElement ( KtFakeSourceElementKind . GeneratedComparisonExpression ) , argument , OperatorNameConventions . COMPARE_TO ) <EOL> val firOperation = when ( operatorToken ) { <EOL> KtTokens . LT -> FirOperation . LT <EOL> KtTokens . GT -> FirOperation . GT <EOL> KtTokens . LTEQ -> FirOperation . LT_EQ <EOL> KtTokens . GTEQ -> FirOperation . GT_EQ <EOL> else -> error ( "<STR_LIT>" ) <EOL> } <EOL> return buildComparisonExpression { <EOL> this . source = baseSource <EOL> this . operation = firOperation <EOL> this . compareToCall = compareToCall <EOL> } <EOL> }


private fun FirExpression . createConventionCall ( operationReferenceSource : KtSourceElement ? , baseSource : KtSourceElement ? , argument : FirExpression , conventionName : Name ) : FirFunctionCall

{ <EOL> return buildFunctionCall { <EOL> source = baseSource <EOL> calleeReference = buildSimpleNamedReference { <EOL> source = operationReferenceSource <EOL> name = conventionName <EOL> } <EOL> explicitReceiver = this@createConventionCall <EOL> argumentList = buildUnaryArgumentList ( argument ) <EOL> origin = FirFunctionCallOrigin . Operator <EOL> } <EOL> }


fun generateAccessExpression ( qualifiedSource : KtSourceElement ? , calleeReferenceSource : KtSourceElement ? , name : Name , diagnostic : ConeDiagnostic ? = null ) : FirQualifiedAccessExpression

= <EOL> buildPropertyAccessExpression { <EOL> this . source = qualifiedSource <EOL> calleeReference = buildSimpleNamedReference { <EOL> this . source = if ( calleeReferenceSource == qualifiedSource ) <EOL> calleeReferenceSource ? . fakeElement ( KtFakeSourceElementKind . ReferenceInAtomicQualifiedAccess ) <EOL> else <EOL> calleeReferenceSource <EOL> this . name = name <EOL> } <EOL> if ( diagnostic != null ) { <EOL> this . nonFatalDiagnostics . add ( diagnostic ) <EOL> } <EOL> }


fun generateResolvedAccessExpression ( source : KtSourceElement ? , variable : FirVariable ) : FirQualifiedAccessExpression

= <EOL> buildPropertyAccessExpression { <EOL> this . source = source <EOL> calleeReference = buildResolvedNamedReference { <EOL> this . source = source <EOL> name = variable . name <EOL> resolvedSymbol = variable . symbol <EOL> } <EOL> }


fun FirVariable . toComponentCall ( entrySource : KtSourceElement ? , index : Int , ) : FirComponentCall

{ <EOL> return buildComponentCall { <EOL> val componentCallSource = entrySource ? . fakeElement ( KtFakeSourceElementKind . DesugaredComponentFunctionCall ) <EOL> source = componentCallSource <EOL> explicitReceiver = generateResolvedAccessExpression ( componentCallSource , this @ toComponentCall ) <EOL> componentIndex = index + <NUM_LIT:1> <EOL> } <EOL> }


fun < T > FirPropertyBuilder . generateAccessorsByDelegate ( delegateBuilder : FirWrappedDelegateExpressionBuilder ? , moduleData : FirModuleData , ownerRegularOrAnonymousObjectSymbol : FirClassSymbol < * > ? , context : Context < T > , isExtension : Boolean , lazyDelegateExpression : FirLazyExpression ? = null , lazyBodyForGeneratedAccessors : FirLazyBlock ? = null , bindFunction : ( target : FirFunctionTarget , function : FirFunction ) -> Unit = FirFunctionTarget :: bind , )

{ <EOL> if ( delegateBuilder == null ) return <EOL> val delegateFieldSymbol = FirDelegateFieldSymbol ( symbol . callableId ) . also { <EOL> this . delegateFieldSymbol = it <EOL> } <EOL> val isMember = ownerRegularOrAnonymousObjectSymbol != null <EOL> val fakeSource = delegateBuilder . source ? . fakeElement ( KtFakeSourceElementKind . DelegatedPropertyAccessor ) <EOL> fun thisRef ( forDispatchReceiver : Boolean = false ) : FirExpression = <EOL> when { <EOL> isExtension && ! forDispatchReceiver -> buildThisReceiverExpression { <EOL> source = fakeSource <EOL> calleeReference = buildImplicitThisReference { <EOL> boundSymbol = this@generateAccessorsByDelegate . symbol <EOL> } <EOL> } <EOL> ownerRegularOrAnonymousObjectSymbol != null -> buildThisReceiverExpression { <EOL> source = fakeSource <EOL> calleeReference = buildImplicitThisReference { <EOL> boundSymbol = ownerRegularOrAnonymousObjectSymbol <EOL> } <EOL> coneTypeOrNull = context . dispatchReceiverTypesStack . last ( ) <EOL> } <EOL> else -> buildLiteralExpression ( null , ConstantValueKind . Null , null , setType = false ) <EOL> } <EOL> fun delegateAccess ( ) = buildPropertyAccessExpression { <EOL> source = fakeSource <EOL> calleeReference = buildDelegateFieldReference { <EOL> source = fakeSource <EOL> resolvedSymbol = delegateFieldSymbol <EOL> } <EOL> if ( ownerRegularOrAnonymousObjectSymbol != null ) { <EOL> dispatchReceiver = thisRef ( forDispatchReceiver = true ) <EOL> } <EOL> } <EOL> val isVar = this@generateAccessorsByDelegate . isVar <EOL> fun propertyRef ( ) = buildCallableReferenceAccess { <EOL> source = fakeSource <EOL> calleeReference = buildResolvedNamedReference { <EOL> source = fakeSource <EOL> name = this@generateAccessorsByDelegate . name <EOL> resolvedSymbol = this@generateAccessorsByDelegate . symbol <EOL> } <EOL> coneTypeOrNull = when { <EOL> ! isMember && ! isExtension -> if ( isVar ) { <EOL> StandardClassIds . KMutableProperty0 . constructClassLikeType ( arrayOf ( ConeStarProjection ) ) <EOL> } else { <EOL> StandardClassIds . KProperty0 . constructClassLikeType ( arrayOf ( ConeStarProjection ) ) <EOL> } <EOL> isMember && isExtension -> if ( isVar ) { <EOL> StandardClassIds . KMutableProperty2 . constructClassLikeType ( arrayOf ( ConeStarProjection , ConeStarProjection , ConeStarProjection ) ) <EOL> } else { <EOL> StandardClassIds . KProperty2 . constructClassLikeType ( arrayOf ( ConeStarProjection , ConeStarProjection , ConeStarProjection ) ) <EOL> } <EOL> else -> if ( isVar ) { <EOL> StandardClassIds . KMutableProperty1 . constructClassLikeType ( arrayOf ( ConeStarProjection , ConeStarProjection ) ) <EOL> } else { <EOL> StandardClassIds . KProperty1 . constructClassLikeType ( arrayOf ( ConeStarProjection , ConeStarProjection ) ) <EOL> } <EOL> } <EOL> this@generateAccessorsByDelegate . typeParameters . mapTo ( typeArguments ) { <EOL> buildTypeProjectionWithVariance { <EOL> source = fakeSource <EOL> variance = Variance . INVARIANT <EOL> typeRef = buildResolvedTypeRef { <EOL> type = ConeTypeParameterTypeImpl ( it . symbol . toLookupTag ( ) , false ) <EOL> } <EOL> } <EOL> } <EOL> } <EOL> delegate = lazyDelegateExpression ? : run { <EOL> delegateBuilder . provideDelegateCall = buildFunctionCall { <EOL> explicitReceiver = delegateBuilder . expression <EOL> calleeReference = buildSimpleNamedReference { <EOL> source = fakeSource <EOL> name = OperatorNameConventions . PROVIDE_DELEGATE <EOL> } <EOL> argumentList = buildBinaryArgumentList ( thisRef ( forDispatchReceiver = true ) , propertyRef ( ) ) <EOL> origin = FirFunctionCallOrigin . Operator <EOL> source = fakeSource <EOL> } <EOL> delegateBuilder . build ( ) <EOL> } <EOL> if ( getter == null || getter is FirDefaultPropertyAccessor ) { <EOL> val annotations = getter ? . annotations <EOL> val returnTarget = FirFunctionTarget ( null , isLambda = false ) <EOL> val getterStatus = getter ? . status <EOL> val getterElement = getter ? . source ? . takeIf { <EOL> it . kind == KtRealSourceElementKind <EOL> } ? . fakeElement ( KtFakeSourceElementKind . DelegatedPropertyAccessor ) ? : fakeSource <EOL> getter = buildPropertyAccessor { <EOL> this . source = getterElement <EOL> this . moduleData = moduleData <EOL> origin = FirDeclarationOrigin . Source <EOL> returnTypeRef = FirImplicitTypeRefImplWithoutSource <EOL> isGetter = true <EOL> status = FirDeclarationStatusImpl ( getterStatus ? . visibility ? : Visibilities . Unknown , Modality . FINAL ) . apply { <EOL> isInline = getterStatus ? . isInline ? : isInline <EOL> } <EOL> symbol = FirPropertyAccessorSymbol ( ) <EOL> body = lazyBodyForGeneratedAccessors ? : FirSingleExpressionBlock ( buildReturnExpression { <EOL> result = buildFunctionCall { <EOL> source = fakeSource <EOL> explicitReceiver = delegateAccess ( ) <EOL> calleeReference = buildSimpleNamedReference { <EOL> source = fakeSource <EOL> name = OperatorNameConventions . GET_VALUE <EOL> } <EOL> argumentList = buildBinaryArgumentList ( thisRef ( ) , propertyRef ( ) ) <EOL> origin = FirFunctionCallOrigin . Operator <EOL> } <EOL> target = returnTarget <EOL> source = fakeSource <EOL> } ) <EOL> if ( annotations != null ) { <EOL> this . annotations . addAll ( annotations ) <EOL> } <EOL> propertySymbol = this@generateAccessorsByDelegate . symbol <EOL> } . also { <EOL> bindFunction ( returnTarget , it ) <EOL> it . initContainingClassAttr ( context ) <EOL> } <EOL> } <EOL> if ( isVar && ( setter == null || setter is FirDefaultPropertyAccessor ) ) { <EOL> val annotations = setter ? . annotations <EOL> val returnTarget = FirFunctionTarget ( null , isLambda = false ) <EOL> val parameterAnnotations = setter ? . valueParameters ? . firstOrNull ( ) ? . annotations <EOL> val setterStatus = setter ? . status <EOL> val setterElement = setter ? . source ? . fakeElement ( KtFakeSourceElementKind . DelegatedPropertyAccessor ) ? : fakeSource <EOL> setter = buildPropertyAccessor { <EOL> this . source = setterElement <EOL> this . moduleData = moduleData <EOL> origin = FirDeclarationOrigin . Source <EOL> returnTypeRef = moduleData . session . builtinTypes . unitType <EOL> isGetter = false <EOL> status = FirDeclarationStatusImpl ( setterStatus ? . visibility ? : Visibilities . Unknown , Modality . FINAL ) . apply { <EOL> isInline = setterStatus ? . isInline ? : isInline <EOL> } <EOL> symbol = FirPropertyAccessorSymbol ( ) <EOL> val parameter = buildValueParameter { <EOL> source = fakeSource <EOL> containingFunctionSymbol = this@buildPropertyAccessor . symbol <EOL> this . moduleData = moduleData <EOL> origin = FirDeclarationOrigin . Source <EOL> returnTypeRef = FirImplicitTypeRefImplWithoutSource <EOL> name = SpecialNames . IMPLICIT_SET_PARAMETER <EOL> symbol = FirValueParameterSymbol ( this @ generateAccessorsByDelegate . name ) <EOL> isCrossinline = false <EOL> isNoinline = false <EOL> isVararg = false <EOL> if ( parameterAnnotations != null ) { <EOL> this . annotations . addAll ( parameterAnnotations ) <EOL> } <EOL> } <EOL> valueParameters += parameter <EOL> body = lazyBodyForGeneratedAccessors ? : FirSingleExpressionBlock ( buildReturnExpression { <EOL> result = buildFunctionCall { <EOL> source = fakeSource <EOL> explicitReceiver = delegateAccess ( ) <EOL> calleeReference = buildSimpleNamedReference { <EOL> source = fakeSource <EOL> name = OperatorNameConventions . SET_VALUE <EOL> } <EOL> argumentList = buildArgumentList { <EOL> arguments += thisRef ( ) <EOL> arguments += propertyRef ( ) <EOL> arguments += buildPropertyAccessExpression { <EOL> source = fakeSource <EOL> calleeReference = buildResolvedNamedReference { <EOL> source = fakeSource <EOL> name = SpecialNames . IMPLICIT_SET_PARAMETER <EOL> resolvedSymbol = parameter . symbol <EOL> } <EOL> } <EOL> } <EOL> origin = FirFunctionCallOrigin . Operator <EOL> } <EOL> target = returnTarget <EOL> source = fakeSource <EOL> } ) <EOL> if ( annotations != null ) { <EOL> this . annotations . addAll ( annotations ) <EOL> } <EOL> propertySymbol = this@generateAccessorsByDelegate . symbol <EOL> } . also { <EOL> bindFunction ( returnTarget , it ) <EOL> it . initContainingClassAttr ( context ) <EOL> } <EOL> } <EOL> }


fun processLegacyContractDescription ( block : FirBlock , diagnostic : ConeDiagnostic ? ) : FirContractDescription ?

{ <EOL> if ( block . isContractPresentFirCheck ( ) ) { <EOL> val contractCall = block . replaceFirstStatement < FirFunctionCall > { FirContractCallBlock ( it ) } <EOL> return contractCall . toLegacyRawContractDescription ( diagnostic ) <EOL> } <EOL> return null <EOL> }


fun FirFunctionCall . toLegacyRawContractDescription ( diagnostic : ConeDiagnostic ? = null ) : FirLegacyRawContractDescription

{ <EOL> return buildLegacyRawContractDescription { <EOL> this . source = this@toLegacyRawContractDescription . source <EOL> this . contractCall = this@toLegacyRawContractDescription <EOL> this . diagnostic = diagnostic <EOL> } <EOL> }


fun FirBlock . isContractPresentFirCheck ( ) : Boolean

{ <EOL> val firstStatement = statements . firstOrNull ( ) ? : return false <EOL> return firstStatement . isContractBlockFirCheck ( ) <EOL> }


@ OptIn ( ExperimentalContracts :: class ) <EOL> fun FirStatement . isContractBlockFirCheck ( ) : Boolean

{ <EOL> contract { returns ( true ) implies ( this @ isContractBlockFirCheck is FirFunctionCall ) } <EOL> val contractCall = this as? FirFunctionCall ? : return false <EOL> if ( contractCall . calleeReference . name . asString ( ) != "<STR_LIT>" ) return false <EOL> val receiver = contractCall . explicitReceiver as? FirQualifiedAccessExpression ? : return true <EOL> if ( ! contractCall . checkReceiver ( "<STR_LIT>" ) ) return false <EOL> if ( ! receiver . checkReceiver ( "<STR_LIT:kotlin>" ) ) return false <EOL> val receiverOfReceiver = receiver . explicitReceiver as? FirQualifiedAccessExpression ? : return false <EOL> if ( receiverOfReceiver . explicitReceiver != null ) return false <EOL> return true <EOL> }


private fun FirExpression . checkReceiver ( name : String ? ) : Boolean

{ <EOL> if ( this !is FirQualifiedAccessExpression ) return false <EOL> val receiver = explicitReceiver as? FirQualifiedAccessExpression ? : return false <EOL> val receiverName = ( receiver . calleeReference as? FirNamedReference ) ? . name ? . asString ( ) ? : return false <EOL> return receiverName == name <EOL> }


fun FirQualifiedAccessExpression . createSafeCall ( receiver : FirExpression , source : KtSourceElement ) : FirSafeCallExpression

{ <EOL> val checkedSafeCallSubject = buildCheckedSafeCallSubject { <EOL> @ OptIn ( FirContractViolation :: class ) <EOL> this . originalReceiverRef = FirExpressionRef < FirExpression > ( ) . apply { <EOL> bind ( receiver ) <EOL> } <EOL> this . source = receiver . source ? . fakeElement ( KtFakeSourceElementKind . CheckedSafeCallSubject ) <EOL> } <EOL> if ( this is FirImplicitInvokeCall ) { <EOL> val newArguments = buildArgumentList { <EOL> arguments . add ( checkedSafeCallSubject ) <EOL> arguments . addAll ( this @ createSafeCall . arguments ) <EOL> } <EOL> replaceArgumentList ( newArguments ) <EOL> } else { <EOL> replaceExplicitReceiver ( checkedSafeCallSubject ) <EOL> } <EOL> return buildSafeCallExpression { <EOL> this . receiver = receiver <EOL> @ OptIn ( FirContractViolation :: class ) <EOL> this . checkedSubjectRef = FirExpressionRef < FirCheckedSafeCallSubject > ( ) . apply { <EOL> bind ( checkedSafeCallSubject ) <EOL> } <EOL> this . selector = this@createSafeCall <EOL> this . source = source <EOL> } <EOL> }


fun FirExpression . pullUpSafeCallIfNecessary ( ) : FirExpression

{ <EOL> if ( this !is FirQualifiedAccessExpression ) return this <EOL> val safeCall = explicitReceiver as? FirSafeCallExpression ? : return this <EOL> val safeCallSelector = safeCall . selector as? FirExpression ? : return this <EOL> replaceExplicitReceiver ( safeCallSelector ) <EOL> safeCall . replaceSelector ( this ) <EOL> return safeCall <EOL> }


fun List < FirAnnotationCall > . filterUseSiteTarget ( target : AnnotationUseSiteTarget ) : List < FirAnnotationCall >

= <EOL> mapNotNull { <EOL> if ( it . useSiteTarget != target ) null <EOL> else buildAnnotationCallCopy ( it ) { <EOL> source = it . source ? . fakeElement ( KtFakeSourceElementKind . FromUseSiteTarget ) <EOL> } <EOL> }


fun FirTypeRef . convertToReceiverParameter ( ) : FirReceiverParameter

{ <EOL> val typeRef = this <EOL> @ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> return buildReceiverParameter { <EOL> source = typeRef . source ? . fakeElement ( KtFakeSourceElementKind . ReceiverFromType ) <EOL> annotations += ( typeRef . annotations as List < FirAnnotationCall > ) . filterUseSiteTarget ( AnnotationUseSiteTarget . RECEIVER ) <EOL> val filteredTypeRefAnnotations = typeRef . annotations . filterNot { it . useSiteTarget == AnnotationUseSiteTarget . RECEIVER } <EOL> if ( filteredTypeRefAnnotations . size != typeRef . annotations . size ) { <EOL> typeRef . replaceAnnotations ( filteredTypeRefAnnotations ) <EOL> } <EOL> this . typeRef = typeRef <EOL> } <EOL> }


fun KtSourceElement . asReceiverParameter ( ) : FirReceiverParameter

= buildReceiverParameter { <EOL> source = this@asReceiverParameter . fakeElement ( KtFakeSourceElementKind . ReceiverFromType ) <EOL> typeRef = FirImplicitTypeRefImplWithoutSource <EOL> }


fun < T > FirCallableDeclaration . initContainingClassAttr ( context : Context < T > )

{ <EOL> containingClassForStaticMemberAttr = currentDispatchReceiverType ( context ) ? . lookupTag ? : return <EOL> }


fun < T > currentDispatchReceiverType ( context : Context < T > ) : ConeClassLikeType ?

{ <EOL> return context . dispatchReceiverTypesStack . lastOrNull ( ) <EOL> }


fun buildBalancedOrExpressionTree ( conditions : List < FirExpression > , lower : Int = <NUM_LIT:0> , upper : Int = conditions . lastIndex ) : FirExpression

{ <EOL> val size = upper - lower + <NUM_LIT:1> <EOL> val middle = size / <NUM_LIT:2> + lower <EOL> if ( lower == upper ) { <EOL> return conditions [ middle ] <EOL> } <EOL> val leftNode = buildBalancedOrExpressionTree ( conditions , lower , middle - <NUM_LIT:1> ) <EOL> val rightNode = buildBalancedOrExpressionTree ( conditions , middle , upper ) <EOL> return leftNode . generateLazyLogicalOperation ( rightNode , isAnd = false , ( leftNode . source ? : rightNode . source ) ? . fakeElement ( KtFakeSourceElementKind . WhenCondition ) ) <EOL> }

/**
 * Creates balanced tree of OR expressions for given set of conditions
 * We do so, to avoid too deep OR-expression structures, that can cause running out of stack while processing
 * [conditions] should contain at least one element, otherwise it will cause StackOverflow
 */


fun AnnotationUseSiteTarget ? . appliesToPrimaryConstructorParameter ( )

= this == null || <EOL> this == AnnotationUseSiteTarget . CONSTRUCTOR_PARAMETER || <EOL> this == AnnotationUseSiteTarget . RECEIVER || <EOL> this == AnnotationUseSiteTarget . FILE


fun FirErrorTypeRef . wrapIntoArray ( ) : FirResolvedTypeRef

{ <EOL> val typeRef = this <EOL> return buildResolvedTypeRef { <EOL> source = typeRef . source <EOL> type = StandardClassIds . Array . constructClassLikeType ( arrayOf ( ConeKotlinTypeProjectionOut ( typeRef . coneType ) ) ) <EOL> delegatedTypeRef = typeRef . copyWithNewSourceKind ( KtFakeSourceElementKind . ArrayTypeFromVarargParameter ) <EOL> } <EOL> }


{ <EOL> super . onCreate ( ) <EOL> initKoin ( ) <EOL> }


{ <EOL> val b = B ( <NUM_LIT> ) <EOL> assertEquals ( b . x , <NUM_LIT> ) <EOL> assertEquals ( b . y , <NUM_LIT> ) <EOL> return "<STR_LIT:OK>" <EOL> }


= _name ? : "<STR_LIT>"


override fun isConstructor ( ) : Boolean

= true


= false


override fun hasTypeParameters ( ) : Boolean

= false


override fun getTypeParameterList ( ) : PsiTypeParameterList ?

= null


override fun getTypeParameters ( ) : Array < PsiTypeParameter >

= PsiTypeParameter . EMPTY_ARRAY


private fun computeModifiers ( modifier : String ) : Map < String , Boolean > ?

{ <EOL> if ( modifier !in GranularModifiersBox . VISIBILITY_MODIFIERS ) return null <EOL> return GranularModifiersBox . computeVisibilityForMember ( ktModule , functionSymbolPointer ) <EOL> }


override fun getModifierList ( ) : PsiModifierList

= _modifierList


override fun getReturnType ( ) : PsiType ?

= null


{ <EOL> throw AssertionError ( "<STR_LIT>" ) <EOL> }


fun getJsModuleArtifactPath ( testServices : TestServices , moduleName : String , translationMode : TranslationMode = TranslationMode . FULL_DEV ) : String

{ <EOL> return getJsArtifactsOutputDir ( testServices , translationMode ) . absolutePath + File . separator + getJsModuleArtifactName ( testServices , moduleName ) <EOL> }


fun getRecompiledJsModuleArtifactPath ( testServices : TestServices , moduleName : String , translationMode : TranslationMode = TranslationMode . FULL_DEV ) : String

{ <EOL> return getJsArtifactsRecompiledOutputDir ( testServices , translationMode ) . absolutePath + File . separator + getJsModuleArtifactName ( testServices , moduleName ) <EOL> }


fun getJsModuleArtifactName ( testServices : TestServices , moduleName : String ) : String

{ <EOL> return getKlibArtifactSimpleName ( testServices , moduleName ) + "<STR_LIT>" <EOL> }


fun getJsArtifactsOutputDir ( testServices : TestServices , translationMode : TranslationMode = TranslationMode . FULL_DEV ) : File

{ <EOL> return testServices . temporaryDirectoryManager . getOrCreateTempDirectory ( outputDirByMode [ translationMode ] ! ! ) <EOL> }


fun getJsArtifactsRecompiledOutputDir ( testServices : TestServices , translationMode : TranslationMode = TranslationMode . FULL_DEV ) : File

{ <EOL> return testServices . temporaryDirectoryManager . getOrCreateTempDirectory ( outputDirByMode [ translationMode ] ! ! + "<STR_LIT>" ) <EOL> }


fun getMinificationJsArtifactsOutputDir ( testServices : TestServices ) : File

{ <EOL> return testServices . temporaryDirectoryManager . getOrCreateTempDirectory ( MINIFICATION_OUTPUT_DIR_NAME ) <EOL> }


private fun getPrefixPostfixFile ( module : TestModule , prefix : Boolean ) : File ?

{ <EOL> val suffix = if ( prefix ) "<STR_LIT>" else "<STR_LIT>" <EOL> val originalFile = module . files . first ( ) . originalFile <EOL> return originalFile . parentFile . resolve ( originalFile . name + suffix ) . takeIf { it . exists ( ) } <EOL> }


fun getPrefixFile ( module : TestModule ) : File ?

= getPrefixPostfixFile ( module , prefix = true )


fun getPostfixFile ( module : TestModule ) : File ?

= getPrefixPostfixFile ( module , prefix = false )


fun createJsConfig ( project : Project , configuration : CompilerConfiguration , compilerEnvironment : TargetEnvironment = CompilerEnvironment ) : JsConfig

{ <EOL> return JsConfig ( project , configuration , compilerEnvironment , METADATA_CACHE , ( JsConfig . JS_STDLIB + JsConfig . JS_KOTLIN_TEST ) . toSet ( ) ) <EOL> }


fun getMainModule ( testServices : TestServices ) : TestModule

{ <EOL> val modules = testServices . moduleStructure . modules <EOL> val inferMainModule = JsEnvironmentConfigurationDirectives . INFER_MAIN_MODULE in testServices . moduleStructure . allDirectives <EOL> return when { <EOL> inferMainModule -> modules . last ( ) <EOL> else -> modules . singleOrNull { it . name == ModuleStructureExtractor . DEFAULT_MODULE_NAME } ? : modules . last ( ) <EOL> } <EOL> }


fun isMainModule ( module : TestModule , testServices : TestServices ) : Boolean

{ <EOL> return module == getMainModule ( testServices ) <EOL> }


fun getMainModuleName ( testServices : TestServices ) : String

{ <EOL> return getMainModule ( testServices ) . name <EOL> }


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

{ <EOL> val result = mutableListOf < String > ( ) <EOL> val needsFullIrRuntime = JsEnvironmentConfigurationDirectives . KJS_WITH_FULL_RUNTIME in module . directives || <EOL> ConfigurationDirectives . WITH_STDLIB in module . directives <EOL> val pathProvider = testServices . standardLibrariesPathProvider <EOL> if ( needsFullIrRuntime ) { <EOL> result += pathProvider . fullJsStdlib ( ) . absolutePath <EOL> result += pathProvider . kotlinTestJsKLib ( ) . absolutePath <EOL> } else { <EOL> result += pathProvider . defaultJsStdlib ( ) . absolutePath <EOL> } <EOL> val runtimeClasspaths = testServices . runtimeClasspathProviders . flatMap { it . runtimeClassPaths ( module ) } <EOL> runtimeClasspaths . mapTo ( result ) { it . absolutePath } <EOL> return result <EOL> }


fun getMainCallParametersForModule ( module : TestModule ) : MainCallParameters

{ <EOL> return when { <EOL> JsEnvironmentConfigurationDirectives . CALL_MAIN in module . directives -> MainCallParameters . mainWithArguments ( listOf ( ) ) <EOL> JsEnvironmentConfigurationDirectives . MAIN_ARGS in module . directives -> { <EOL> MainCallParameters . mainWithArguments ( module . directives [ JsEnvironmentConfigurationDirectives . MAIN_ARGS ] . single ( ) ) <EOL> } <EOL> else -> MainCallParameters . noCall ( ) <EOL> } <EOL> }


fun TestModule . hasFilesToRecompile ( ) : Boolean

{ <EOL> return files . any { JsEnvironmentConfigurationDirectives . RECOMPILE in it . directives } <EOL> }


fun incrementalEnabled ( testServices : TestServices ) : Boolean

{ <EOL> return JsEnvironmentConfigurationDirectives . SKIP_IR_INCREMENTAL_CHECKS !in testServices . moduleStructure . allDirectives && <EOL> testServices . moduleStructure . modules . any { it . hasFilesToRecompile ( ) } <EOL> }


override fun provideAdditionalAnalysisFlags ( directives : RegisteredDirectives , languageVersion : LanguageVersion ) : Map < AnalysisFlag < * > , Any ? >

{ <EOL> return super . provideAdditionalAnalysisFlags ( directives , languageVersion ) . toMutableMap ( ) . also { <EOL> it [ allowFullyQualifiedNameInKClass ] = false <EOL> } <EOL> }


override fun DirectiveToConfigurationKeyExtractor . provideConfigurationKeys ( )

{ <EOL> register ( PROPERTY_LAZY_INITIALIZATION , JSConfigurationKeys . PROPERTY_LAZY_INITIALIZATION ) <EOL> register ( GENERATE_INLINE_ANONYMOUS_FUNCTIONS , JSConfigurationKeys . GENERATE_INLINE_ANONYMOUS_FUNCTIONS ) <EOL> }


override fun configureCompilerConfiguration ( configuration : CompilerConfiguration , module : TestModule )

{ <EOL> if ( module . targetPlatform !in JsPlatforms . allJsPlatforms ) return <EOL> val registeredDirectives = module . directives <EOL> val moduleKinds = registeredDirectives [ MODULE_KIND ] <EOL> val moduleKind = when ( moduleKinds . size ) { <EOL> <NUM_LIT:0> -> testServices . moduleStructure . allDirectives [ MODULE_KIND ] . singleOrNull ( ) <EOL> ? : if ( JsEnvironmentConfigurationDirectives . ES_MODULES in registeredDirectives ) ModuleKind . ES else ModuleKind . PLAIN <EOL> <NUM_LIT:1> -> moduleKinds . single ( ) <EOL> else -> error ( "<STR_LIT>" ) <EOL> } <EOL> configuration . put ( JSConfigurationKeys . MODULE_KIND , moduleKind ) <EOL> val noInline = registeredDirectives . contains ( NO_INLINE ) <EOL> configuration . put ( CommonConfigurationKeys . DISABLE_INLINE , noInline ) <EOL> val dependencies = module . regularDependencies . map { getJsModuleArtifactPath ( testServices , it . moduleName ) + "<STR_LIT>" } <EOL> val allDependencies = module . allTransitiveDependencies ( ) . map { getJsModuleArtifactPath ( testServices , it . moduleName ) + "<STR_LIT>" } <EOL> val friends = module . friendDependencies . map { getJsModuleArtifactPath ( testServices , it . moduleName ) + "<STR_LIT>" } <EOL> val libraries = when ( module . targetBackend ) { <EOL> null -> JsConfig . JS_STDLIB + JsConfig . JS_KOTLIN_TEST <EOL> TargetBackend . JS_IR , TargetBackend . JS_IR_ES6 -> dependencies + friends <EOL> TargetBackend . JS -> JsConfig . JS_STDLIB + JsConfig . JS_KOTLIN_TEST + dependencies + friends <EOL> else -> error ( "<STR_LIT>" ) <EOL> } <EOL> configuration . put ( JSConfigurationKeys . LIBRARIES , libraries ) <EOL> configuration . put ( JSConfigurationKeys . TRANSITIVE_LIBRARIES , allDependencies ) <EOL> configuration . put ( JSConfigurationKeys . FRIEND_PATHS , friends ) <EOL> configuration . put ( CommonConfigurationKeys . MODULE_NAME , module . name . removeSuffix ( OLD_MODULE_SUFFIX ) ) <EOL> configuration . put ( JSConfigurationKeys . TARGET , EcmaVersion . es5 ) <EOL> val multiModule = testServices . moduleStructure . modules . size > <NUM_LIT:1> <EOL> configuration . put ( JSConfigurationKeys . META_INFO , multiModule ) <EOL> val sourceDirs = module . files . map { it . originalFile . parent } . distinct ( ) <EOL> configuration . put ( JSConfigurationKeys . SOURCE_MAP_SOURCE_ROOTS , sourceDirs ) <EOL> configuration . put ( JSConfigurationKeys . SOURCE_MAP , true ) <EOL> val sourceMapSourceEmbedding = registeredDirectives [ SOURCE_MAP_EMBED_SOURCES ] . singleOrNull ( ) ? : SourceMapSourceEmbedding . NEVER <EOL> configuration . put ( JSConfigurationKeys . SOURCE_MAP_EMBED_SOURCES , sourceMapSourceEmbedding ) <EOL> configuration . put ( JSConfigurationKeys . TYPED_ARRAYS_ENABLED , TYPED_ARRAYS in registeredDirectives ) <EOL> configuration . put ( JSConfigurationKeys . GENERATE_POLYFILLS , true ) <EOL> configuration . put ( JSConfigurationKeys . GENERATE_REGION_COMMENTS , true ) <EOL> configuration . put ( JSConfigurationKeys . FILE_PATHS_PREFIX_MAP , mapOf ( File ( "<STR_LIT:.>" ) . absolutePath . removeSuffix ( "<STR_LIT:.>" ) to "<STR_LIT>" ) ) <EOL> }


{ <EOL> return null <EOL> }


{ <EOL> Z ( ) . f ( ) <EOL> return "<STR_LIT:OK>" <EOL> }


external fun native ( path : String , options : dynamic = definedExternally ) : String


external fun native ( path : Buffer , options : dynamic = definedExternally ) : String


external fun native ( path : URL , options : dynamic = definedExternally ) : String


external fun native ( path : String , options : `T$10` ) : Buffer


external fun native ( path : String , options : String ) : Buffer


external fun native ( path : Buffer , options : `T$10` ) : Buffer


external fun native ( path : Buffer , options : String ) : Buffer


external fun native ( path : URL , options : `T$10` ) : Buffer


external fun native ( path : URL , options : String ) : Buffer


external fun native ( path : String , options : `T$11` ? = definedExternally ) : dynamic


external fun native ( path : String , options : String ? = definedExternally ) : dynamic


external fun native ( path : String , options : Nothing ? = definedExternally ) : dynamic


external fun native ( path : Buffer , options : `T$11` ? = definedExternally ) : dynamic


external fun native ( path : Buffer , options : String ? = definedExternally ) : dynamic


external fun native ( path : Buffer , options : Nothing ? = definedExternally ) : dynamic


external fun native ( path : URL , options : `T$11` ? = definedExternally ) : dynamic


external fun native ( path : URL , options : String ? = definedExternally ) : dynamic


external fun native ( path : URL , options : Nothing ? = definedExternally ) : dynamic


external fun native ( path : String ) : String


external fun native ( path : Buffer ) : String


external fun native ( path : URL ) : String


fun < T > error ( message : String ) : T ?

{ <EOL> configuration . report ( CompilerMessageSeverity . STRONG_WARNING , "<STR_LIT>" ) <EOL> return null <EOL> }


fun parseSingleTagLevel ( tagLevel : String ) : Pair < LoggingTag , LoggingLevel > ?

{ <EOL> val parts = tagLevel . split ( "<STR_LIT>" ) <EOL> val tagStr = parts [ <NUM_LIT:0> ] <EOL> val tag = tagStr . let { <EOL> LoggingTag . parse ( it ) ? : error ( "<STR_LIT>" ) <EOL> } <EOL> val levelStr = parts . getOrNull ( <NUM_LIT:1> ) ? : error ( "<STR_LIT>" ) <EOL> val level = parts . getOrNull ( <NUM_LIT:1> ) ? . let { <EOL> LoggingLevel . parse ( it ) ? : error ( "<STR_LIT>" ) <EOL> } <EOL> if ( level == LoggingLevel . None ) return error ( "<STR_LIT>" ) <EOL> return tag ? . let { t -> level ? . let { l -> Pair ( t , l ) } } <EOL> }


fun librariesWithDependencies ( ) : List < KonanLibrary >

{ <EOL> return resolvedLibraries . filterRoots { ( ! it . isDefault && ! this . purgeUserLibs ) || it . isNeededForLink } . getFullList ( TopologicalLibraryOrder ) . map { it as KonanLibrary } <EOL> }


private fun StringBuilder . appendCommonCacheFlavor ( )

{ <EOL> append ( target . toString ( ) ) <EOL> if ( debug ) append ( "<STR_LIT>" ) <EOL> append ( "<STR_LIT>" ) <EOL> if ( propertyLazyInitialization != defaultPropertyLazyInitialization ) <EOL> append ( "<STR_LIT>" ) <EOL> }


fun CompilerConfiguration . report ( priority : CompilerMessageSeverity , message : String ) <EOL>

= this . getNotNull ( CLIConfigurationKeys . MESSAGE_COLLECTOR_KEY ) . report ( priority , message )


private fun String . isRelease ( ) : Boolean

{ <EOL> val versionPattern = "<STR_LIT>" . toRegex ( ) <EOL> val ( _ , _ , _ , metaString , build ) = versionPattern . matchEntire ( this ) ? . destructured <EOL> ? : throw IllegalStateException ( "<STR_LIT>" ) <EOL> return metaString . isEmpty ( ) && build . isEmpty ( ) <EOL> }


= RawReturnType . getRawList ( listOf ( "<STR_LIT:str>" ) )


fun codeIntervals ( code : String , magicsIntervals : Sequence < CodeInterval > = magicsIntervals ( code ) , preserveLinesEnumeration : Boolean = false , )

= sequence { <EOL> val newlineLength = code . determineSep ( ) . length <EOL> var codeStart = <NUM_LIT:0> <EOL> for ( interval in magicsIntervals ) { <EOL> if ( codeStart != interval . from ) { <EOL> yield ( CodeInterval ( codeStart , interval . from ) ) <EOL> } <EOL> codeStart = interval . to <EOL> if ( preserveLinesEnumeration && codeStart > <NUM_LIT:0> && code [ codeStart - <NUM_LIT:1> ] == '<CHAR_LIT:\n>' ) { <EOL> codeStart -= newlineLength <EOL> } <EOL> } <EOL> if ( codeStart != code . length ) { <EOL> yield ( CodeInterval ( codeStart , code . length ) ) <EOL> } <EOL> }


fun magicsIntervals ( code : String ) : Sequence < CodeInterval >

{ <EOL> val newlineLength = code . determineSep ( ) . length <EOL> val maybeFirstMatch = if ( parseOutCellMarker ) CELL_MARKER_REGEX . find ( code , <NUM_LIT:0> ) else null <EOL> val seed = maybeFirstMatch ? : MAGICS_REGEX . find ( code , <NUM_LIT:0> ) <EOL> return generateSequence ( seed ) { <EOL> MAGICS_REGEX . find ( code , it . range . last + <NUM_LIT:1> ) <EOL> } . map { <EOL> val start = it . range . first <EOL> val endOfLine = it . range . last + <NUM_LIT:1> <EOL> val end = if ( endOfLine + newlineLength <= code . length ) endOfLine + newlineLength else endOfLine <EOL> CodeInterval ( start , end ) <EOL> } <EOL> }


fun getCleanCode ( code : String , magicIntervals : Sequence < CodeInterval > , ) : String

{ <EOL> val codes = codeIntervals ( code , magicIntervals , true ) <EOL> return codes . joinToString ( "<STR_LIT>" ) { code . substring ( it . from , it . to ) } <EOL> }


fun processSingleMagic ( code : String , handler : MagicsHandler , codeInterval : CodeInterval , parseOnly : Boolean = false , tryIgnoreErrors : Boolean = false , )

{ <EOL> if ( code [ codeInterval . from ] != MAGICS_SIGN ) return <EOL> val magicText = code . substring ( codeInterval . from + <NUM_LIT:1> , codeInterval . to ) . trim ( ) <EOL> handler . handle ( magicText , tryIgnoreErrors , parseOnly ) <EOL> }


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

{ <EOL> XCTestHelpers ( ) . use { <EOL> val simulator = it . createSimulator ( ) . apply { <EOL> boot ( ) <EOL> } <EOL> nativeProject ( "<STR_LIT>" , gradleVersion ) { <EOL> projectPath . enableSwiftExport ( ) <EOL> buildXcodeProject ( xcodeproj = projectPath . resolve ( "<STR_LIT>" ) , destination = "<STR_LIT>" , buildMode = XcodeBuildMode . TEST , extraArguments = mapOf ( "<STR_LIT>" to "<STR_LIT>" ) ) <EOL> } <EOL> } <EOL> }


private fun createTestCaseNoTestRun ( module : TestModule . Exclusive , compilerArgs : TestCompilerArgs )

= TestCase ( id = TestCaseId . Named ( module . name ) , kind = TestKind . STANDALONE_NO_TR , modules = setOf ( module ) , freeCompilerArgs = compilerArgs , nominalPackageName = PackageName . EMPTY , checks = TestRunChecks . Default ( testRunSettings . get < Timeouts > ( ) . executionTimeout ) , extras = TestCase . NoTestRunnerExtras ( "<STR_LIT>" ) ) . apply { <EOL> initialize ( null , null ) <EOL> }


internal fun compileToExecutable ( module : TestModule . Exclusive , dependencies : List < TestCompilationDependency < * > > , args : List < String > = emptyList ( ) )

= compileToExecutable ( createTestCaseNoTestRun ( module , TestCompilerArgs ( args ) ) , dependencies )


internal fun compileToExecutable ( testCase : TestCase , dependencies : List < TestCompilationDependency < * > > ) : TestCompilationResult < out TestCompilationArtifact . Executable >

{ <EOL> val compilation = ExecutableCompilation ( settings = testRunSettings , freeCompilerArgs = testCase . freeCompilerArgs , sourceModules = testCase . modules , extras = TestCase . NoTestRunnerExtras ( "<STR_LIT>" ) , dependencies = dependencies , expectedArtifact = getExecutableArtifact ( ) ) <EOL> return compilation . result <EOL> }


= <EOL> TestCompilationArtifact . Executable ( buildDir . resolve ( "<STR_LIT>" + testRunSettings . get < KotlinNativeTargets > ( ) . testTarget . family . exeSuffix ) )


@ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> internal fun < T : Any > getOrCreateKotlinClass ( jClass : Class < T > ) : KClassImpl < T >

= K_CLASS_CACHE . get ( jClass ) as KClassImpl < T >


internal fun < T : Any > getOrCreateKotlinPackage ( jClass : Class < T > ) : KDeclarationContainer

= K_PACKAGE_CACHE . get ( jClass )


{ <EOL> K_CLASS_CACHE . clear ( ) <EOL> K_PACKAGE_CACHE . clear ( ) <EOL> CACHE_FOR_BASE_CLASSIFIERS . clear ( ) <EOL> CACHE_FOR_NULLABLE_BASE_CLASSIFIERS . clear ( ) <EOL> CACHE_FOR_GENERIC_CLASSIFIERS . clear ( ) <EOL> }


internal fun < T : Any > getOrCreateKType ( jClass : Class < T > , arguments : List < KTypeProjection > , isMarkedNullable : Boolean ) : KType

{ <EOL> return if ( arguments . isEmpty ( ) ) { <EOL> if ( isMarkedNullable ) { <EOL> CACHE_FOR_NULLABLE_BASE_CLASSIFIERS . get ( jClass ) <EOL> } else { <EOL> CACHE_FOR_BASE_CLASSIFIERS . get ( jClass ) <EOL> } <EOL> } else { <EOL> getOrCreateKTypeWithTypeArguments ( jClass , arguments , isMarkedNullable ) <EOL> } <EOL> }


private fun < T : Any > getOrCreateKTypeWithTypeArguments ( jClass : Class < T > , arguments : List < KTypeProjection > , isMarkedNullable : Boolean ) : KType

{ <EOL> val cache = CACHE_FOR_GENERIC_CLASSIFIERS . get ( jClass ) <EOL> return cache . getOrPut ( arguments to isMarkedNullable ) { <EOL> getOrCreateKotlinClass ( jClass ) . createType ( arguments , isMarkedNullable , emptyList ( ) ) <EOL> } <EOL> }


override fun < E : CoroutineContext . Element > get ( key : CoroutineContext . Key < E > ) : E ?

= getPolymorphicElement ( key )


override fun minusKey ( key : CoroutineContext . Key < * > ) : CoroutineContext

= minusPolymorphicKey ( key )


@ Test <EOL> fun testDerivedWithoutKey ( )

{ <EOL> val derivedWithoutKey = DerivedWithoutKey ( ) <EOL> assertSame ( Base . Key , derivedWithoutKey . key ) <EOL> testDerivedWithoutKey ( EmptyCoroutineContext , derivedWithoutKey ) <EOL> testDerivedWithoutKey ( IrrelevantElement , derivedWithoutKey ) <EOL> }


@ Test <EOL> fun testDerivedWithoutKeyOverridesDerived ( )

{ <EOL> val context = DerivedWithKey ( ) + DerivedWithoutKey ( ) <EOL> assertEquals ( <NUM_LIT:1> , context . size ) <EOL> assertTrue ( context [ Base ] is DerivedWithoutKey ) <EOL> assertNull ( context [ DerivedWithKey ] ) <EOL> assertEquals ( EmptyCoroutineContext , context . minusKey ( Base ) ) <EOL> assertSame ( context , context . minusKey ( DerivedWithKey ) ) <EOL> }


private fun testDerivedWithoutKey ( context : CoroutineContext , element : CoroutineContext . Element )

{ <EOL> val ctx = context + element <EOL> assertEquals ( context . size + <NUM_LIT:1> , ctx . size ) <EOL> assertSame ( element , ctx [ Base ] ! ! ) <EOL> assertNull ( ctx [ DerivedWithKey ] ) <EOL> assertEquals ( context , ctx . minusKey ( Base ) ) <EOL> assertSame ( ctx , ctx . minusKey ( DerivedWithKey ) ) <EOL> }


{ <EOL> val derivedWithKey = DerivedWithKey ( ) <EOL> assertSame ( Base . Key , derivedWithKey . key ) <EOL> testDerivedWithKey ( EmptyCoroutineContext , derivedWithKey ) <EOL> testDerivedWithKey ( IrrelevantElement , derivedWithKey ) <EOL> }


private fun testDerivedWithKey ( context : CoroutineContext , element : CoroutineContext . Element )

{ <EOL> val ctx = context + element <EOL> assertEquals ( context . size + <NUM_LIT:1> , ctx . size ) <EOL> assertSame ( element , ctx [ Base ] ! ! ) <EOL> assertSame ( element , ctx [ DerivedWithKey ] ! ! ) <EOL> assertEquals ( context , ctx . minusKey ( Base ) ) <EOL> assertEquals ( context , ctx . minusKey ( DerivedWithKey ) ) <EOL> }


@ Test <EOL> fun testSubDerivedWithKey ( )

{ <EOL> val subDerivedWithKey = SubDerivedWithKey ( ) <EOL> assertSame ( Base . Key , subDerivedWithKey . key ) <EOL> testSubDerivedWithKey ( EmptyCoroutineContext , subDerivedWithKey ) <EOL> testSubDerivedWithKey ( IrrelevantElement , subDerivedWithKey ) <EOL> }


private fun testSubDerivedWithKey ( context : CoroutineContext , element : CoroutineContext . Element )

{ <EOL> val ctx = context + element <EOL> assertEquals ( context . size + <NUM_LIT:1> , ctx . size ) <EOL> assertSame ( element , ctx [ Base ] ! ! ) <EOL> assertSame ( element , ctx [ DerivedWithKey ] ! ! ) <EOL> assertSame ( element , ctx [ SubDerivedWithKey ] ! ! ) <EOL> assertNull ( ctx [ SubDerivedWithKeyAndDifferentBase ] ) <EOL> assertEquals ( context , ctx . minusKey ( Base ) ) <EOL> assertEquals ( context , ctx . minusKey ( DerivedWithKey ) ) <EOL> assertEquals ( context , ctx . minusKey ( SubDerivedWithKey ) ) <EOL> assertSame ( ctx , ctx . minusKey ( SubDerivedWithKeyAndDifferentBase ) ) <EOL> }


@ Test <EOL> fun testSubDerivedWithKeyAndDifferentBase ( )

{ <EOL> val subDerivedWithKeyAndDifferentBase = SubDerivedWithKeyAndDifferentBase ( ) <EOL> assertSame ( Base . Key , subDerivedWithKeyAndDifferentBase . key ) <EOL> testSubDerivedWithKeyAndDifferentBase ( EmptyCoroutineContext , subDerivedWithKeyAndDifferentBase ) <EOL> testSubDerivedWithKeyAndDifferentBase ( IrrelevantElement , subDerivedWithKeyAndDifferentBase ) <EOL> }


private fun testSubDerivedWithKeyAndDifferentBase ( context : CoroutineContext , element : CoroutineContext . Element )

{ <EOL> val ctx = context + element <EOL> assertEquals ( context . size + <NUM_LIT:1> , ctx . size ) <EOL> assertSame ( element , ctx [ Base ] ! ! ) <EOL> assertSame ( element , ctx [ DerivedWithKey ] ! ! ) <EOL> assertSame ( element , ctx [ SubDerivedWithKeyAndDifferentBase ] ! ! ) <EOL> assertNull ( ctx [ SubDerivedWithKey ] ) <EOL> assertEquals ( context , ctx . minusKey ( Base ) ) <EOL> assertEquals ( context , ctx . minusKey ( DerivedWithKey ) ) <EOL> assertEquals ( context , ctx . minusKey ( SubDerivedWithKeyAndDifferentBase ) ) <EOL> assertSame ( ctx , ctx . minusKey ( SubDerivedWithKey ) ) <EOL> }


@ Test <EOL> fun testDerivedWithKeyOverridesDerived ( )

{ <EOL> val context = DerivedWithoutKey ( ) + DerivedWithKey ( ) <EOL> assertEquals ( <NUM_LIT:1> , context . size ) <EOL> assertTrue { context [ Base ] is DerivedWithKey } <EOL> assertTrue { context [ DerivedWithKey ] is DerivedWithKey } <EOL> assertEquals ( EmptyCoroutineContext , context . minusKey ( Base ) ) <EOL> assertEquals ( EmptyCoroutineContext , context . minusKey ( DerivedWithKey ) ) <EOL> }


@ Test <EOL> fun testSubDerivedOverrides ( )

{ <EOL> val key = SubDerivedWithKeyAndDifferentBase <EOL> testSubDerivedOverrides < SubDerivedWithKeyAndDifferentBase > ( DerivedWithoutKey ( ) + SubDerivedWithKeyAndDifferentBase ( ) , key ) <EOL> testSubDerivedOverrides < SubDerivedWithKeyAndDifferentBase > ( DerivedWithKey ( ) + SubDerivedWithKeyAndDifferentBase ( ) , key ) <EOL> testSubDerivedOverrides < SubDerivedWithKeyAndDifferentBase > ( SubDerivedWithKeyAndDifferentBase ( ) + SubDerivedWithKeyAndDifferentBase ( ) , key ) <EOL> }


@ Test <EOL> fun testSubDerivedWithDifferentBaseOverrides ( )

{ <EOL> val key = SubDerivedWithKey <EOL> testSubDerivedOverrides < SubDerivedWithKey > ( DerivedWithoutKey ( ) + SubDerivedWithKey ( ) , key ) <EOL> testSubDerivedOverrides < SubDerivedWithKey > ( DerivedWithKey ( ) + SubDerivedWithKey ( ) , key ) <EOL> testSubDerivedOverrides < SubDerivedWithKey > ( SubDerivedWithKeyAndDifferentBase ( ) + SubDerivedWithKey ( ) , key ) <EOL> }


private inline fun < reified T : CoroutineContext . Element > testSubDerivedOverrides ( context : CoroutineContext , key : CoroutineContext . Key < T > )

{ <EOL> assertEquals ( <NUM_LIT:1> , context . size ) <EOL> assertTrue { context [ Base ] is DerivedWithKey } <EOL> assertTrue { context [ DerivedWithKey ] is DerivedWithKey } <EOL> assertTrue { context [ DerivedWithKey ] is T } <EOL> assertTrue { context [ key ] is T } <EOL> assertEquals ( EmptyCoroutineContext , context . minusKey ( Base ) ) <EOL> assertEquals ( EmptyCoroutineContext , context . minusKey ( DerivedWithKey ) ) <EOL> }


@ ObsoleteTestInfrastructure <EOL> fun createSessionForTests ( projectEnvironment : AbstractProjectEnvironment , javaSourceScope : AbstractProjectFileSearchScope , librariesScope : AbstractProjectFileSearchScope = ! javaSourceScope , moduleName : String = "<STR_LIT>" , friendsPaths : List < Path > = emptyList ( ) , languageVersionSettings : LanguageVersionSettings = LanguageVersionSettingsImpl . DEFAULT ) : FirSession

= FirSessionFactoryHelper . createSessionWithDependencies ( Name . identifier ( moduleName ) , JvmPlatforms . unspecifiedJvmPlatform , externalSessionProvider = null , projectEnvironment , languageVersionSettings , javaSourceScope , librariesScope , lookupTracker = null , enumWhenTracker = null , importTracker = null , incrementalCompilationContext = null , extensionRegistrars = emptyList ( ) , needRegisterJavaElementFinder = true , dependenciesConfigurator = { <EOL> friendDependencies ( friendsPaths ) <EOL> } )


@ ObsoleteTestInfrastructure <EOL> fun createSessionForTests ( project : Project , sourceScope : GlobalSearchScope , librariesScope : GlobalSearchScope , moduleName : String = "<STR_LIT>" , friendsPaths : List < Path > = emptyList ( ) , getPackagePartProvider : ( GlobalSearchScope ) -> PackagePartProvider , ) : FirSession

{ <EOL> return FirSessionFactoryHelper . createSessionWithDependencies ( Name . identifier ( moduleName ) , JvmPlatforms . unspecifiedJvmPlatform , externalSessionProvider = null , VfsBasedProjectEnvironment ( project , VirtualFileManager . getInstance ( ) . getFileSystem ( StandardFileSystems . FILE_PROTOCOL ) , getPackagePartProvider ) , languageVersionSettings = LanguageVersionSettingsImpl . DEFAULT , PsiBasedProjectFileSearchScope ( sourceScope ) , PsiBasedProjectFileSearchScope ( librariesScope ) , lookupTracker = null , enumWhenTracker = null , importTracker = null , incrementalCompilationContext = null , extensionRegistrars = emptyList ( ) , needRegisterJavaElementFinder = true , dependenciesConfigurator = { <EOL> friendDependencies ( friendsPaths ) <EOL> } ) <EOL> }


@ Deprecated ( "<STR_LIT>" ) <EOL> override operator fun Entities . unaryPlus ( ) : Unit

{ <EOL> @ Suppress ( "<STR_LIT:DEPRECATION>" ) entity ( this ) <EOL> }


@ Deprecated ( "<STR_LIT>" ) <EOL> override operator fun String . unaryPlus ( ) : Unit

{ <EOL> @ Suppress ( "<STR_LIT:DEPRECATION>" ) text ( this ) <EOL> }


@ Deprecated ( "<STR_LIT>" ) <EOL> override fun text ( s : String ) : Unit

{ <EOL> super < HTMLTag > . text ( s ) <EOL> }


@ Deprecated ( "<STR_LIT>" ) <EOL> override fun text ( n : Number ) : Unit

{ <EOL> super < HTMLTag > . text ( n ) <EOL> }


@ Deprecated ( "<STR_LIT>" ) <EOL> override fun entity ( e : Entities ) : Unit

{ <EOL> super < HTMLTag > . entity ( e ) <EOL> }


@ HtmlTagMarker <EOL> inline fun SELECT . option ( classes : String ? = null , crossinline block : OPTION . ( ) -> Unit = { } ) : Unit

= OPTION ( attributesMapOf ( "<STR_LIT:class>" , classes ) , consumer ) . visit ( block )


@ HtmlTagMarker <EOL> fun SELECT . option ( classes : String ? = null , content : String = "<STR_LIT>" ) : Unit

= OPTION ( attributesMapOf ( "<STR_LIT:class>" , classes ) , consumer ) . visit ( { + content } )


@ HtmlTagMarker <EOL> inline fun SELECT . optGroup ( label : String ? = null , classes : String ? = null , crossinline block : OPTGROUP . ( ) -> Unit = { } ) : Unit

= OPTGROUP ( attributesMapOf ( "<STR_LIT>" , label , "<STR_LIT:class>" , classes ) , consumer ) . visit ( block )


= path . depth ( )


public fun < C > getCol ( accessor : ColumnReference < C > ) : ColumnWithPath < C > ?

= <EOL> asColumnGroup ( ) . getColumnOrNull ( accessor ) ? . addPath ( path + accessor . path ( ) )

/**
 * Casts this column to a [ColumnGroup] and returns a column with the specified [accessor] or null if it
 * can't be found.
 */


public fun getCol ( name : String ) : ColumnWithPath < Any ? > ?

= <EOL> asColumnGroup ( ) . getColumnOrNull ( name ) ? . addParentPath ( path )

/**
 * Casts this column to a [ColumnGroup] and returns a column with the specified [name] or null if it
 * can't be found.
 */


public fun getCol ( index : Int ) : ColumnWithPath < Any ? > ?

= <EOL> asColumnGroup ( ) . getColumnOrNull ( index ) ? . addParentPath ( path )

/**
 * Casts this column to a [ColumnGroup] and returns a column with the specified [index] or null if it
 * can't be found.
 */


public fun < C > getCol ( accessor : KProperty < C > ) : ColumnWithPath < C > ?

= <EOL> asColumnGroup ( ) . getColumnOrNull ( accessor ) ? . addParentPath ( path )


public fun cols ( ) : List < ColumnWithPath < Any ? > >

= <EOL> if ( isColumnGroup ( ) ) { <EOL> data . asColumnGroup ( ) . columns ( ) . map { it . addParentPath ( path ) } <EOL> } else { <EOL> emptyList ( ) <EOL> }

/**
 * Returns all ("children") columns in this column if it's a group, else it returns an empty list.
 */


= path


override fun rename ( newName : String ) : ColumnWithPath < T >


@ Deprecated ( message = COLUMN_WITH_PATH_MESSAGE , replaceWith = ReplaceWith ( "<STR_LIT>" ) , level = DeprecationLevel . ERROR , ) <EOL> public fun < C > getChild ( accessor : ColumnReference < C > ) : ColumnWithPath < C > ?

= getCol ( accessor )


@ Deprecated ( message = COLUMN_WITH_PATH_MESSAGE , replaceWith = ReplaceWith ( "<STR_LIT>" ) , level = DeprecationLevel . ERROR , ) <EOL> public fun getChild ( name : String ) : ColumnWithPath < Any ? > ?

= getCol ( name )


@ Deprecated ( message = COLUMN_WITH_PATH_MESSAGE , replaceWith = ReplaceWith ( "<STR_LIT>" ) , level = DeprecationLevel . ERROR , ) <EOL> public fun getChild ( index : Int ) : ColumnWithPath < Any ? > ?

= getCol ( index )


@ Deprecated ( message = COLUMN_WITH_PATH_MESSAGE , replaceWith = ReplaceWith ( "<STR_LIT>" ) , level = DeprecationLevel . ERROR , ) <EOL> public fun < C > getChild ( accessor : KProperty < C > ) : ColumnWithPath < C > ?

= getCol ( accessor )


@ Deprecated ( message = COLUMN_WITH_PATH_MESSAGE , replaceWith = ReplaceWith ( "<STR_LIT>" ) , level = DeprecationLevel . ERROR , ) <EOL> public fun children ( ) : List < ColumnWithPath < Any ? > >

= cols ( )


public abstract fun evaluate ( expression : KtExpression , mode : KtConstantEvaluationMode , ) : KtConstantValue ?


public abstract fun evaluateAsAnnotationValue ( expression : KtExpression ) : KtAnnotationValue ?


public fun KtExpression . evaluate ( mode : KtConstantEvaluationMode ) : KtConstantValue ?

= <EOL> withValidityAssertion { analysisSession . compileTimeConstantProvider . evaluate ( this , mode ) }

/**
 * Tries to evaluate the provided expression using the specified mode.
 * Returns a [KtConstantValue] if the expression evaluates to a compile-time constant, otherwise returns null..
 */


public fun KtExpression . evaluateAsAnnotationValue ( ) : KtAnnotationValue ?

= <EOL> withValidityAssertion { analysisSession . compileTimeConstantProvider . evaluateAsAnnotationValue ( this ) }

/**
 * Returns a [KtConstantValue] if the expression evaluates to a value that can be used as an annotation parameter value,
 * e.g. an array of constants, otherwise returns null.
 */


override fun onCreate ( savedInstanceState : Bundle ? )

{ <EOL> super . onCreate ( savedInstanceState ) <EOL> arguments ? . let { <EOL> param1 = it . getString ( ARG_PARAM1 ) <EOL> param2 = it . getString ( ARG_PARAM2 ) <EOL> } <EOL> }


override fun onCreateView ( inflater : LayoutInflater , container : ViewGroup ? , savedInstanceState : Bundle ? <EOL> ) : View ?

{ <EOL> return inflater . inflate ( R . layout . fragment_destination_fragment1 , container , false ) <EOL> }


{ <EOL> listener ? . onFragmentInteraction ( uri ) <EOL> }


override fun onAttach ( context : Context )

{ <EOL> super . onAttach ( context ) <EOL> if ( context is OnFragmentInteractionListener ) { <EOL> listener = context <EOL> } else { <EOL> throw RuntimeException ( context . toString ( ) + "<STR_LIT>" ) <EOL> } <EOL> }


{ <EOL> super . onDetach ( ) <EOL> listener = null <EOL> }


fun onFragmentInteraction ( uri : Uri )


@ JvmStatic <EOL> fun newInstance ( param1 : String , param2 : String )

= <EOL> DestinationFragment1 ( ) . apply { <EOL> arguments = Bundle ( ) . apply { <EOL> putString ( ARG_PARAM1 , param1 ) <EOL> putString ( ARG_PARAM2 , param2 ) <EOL> } <EOL> }

/**
 * Use this factory method to create a new instance of
 * this fragment using the provided parameters.
 *
 * @param param1 Parameter 1.
 * @param param2 Parameter 2.
 * @return A new instance of fragment DestinationFragment1.
 */


internal fun KotlinLibrary . getAllTransitiveDependencies ( allLibraries : Map < String , KotlinLibrary > ) : List < KotlinLibrary >

{ <EOL> val allDependencies = mutableSetOf < KotlinLibrary > ( ) <EOL> fun traverseDependencies ( library : KotlinLibrary ) { <EOL> library . unresolvedDependencies . forEach { <EOL> val dependency = allLibraries [ it . path ] ! ! <EOL> if ( dependency !in allDependencies ) { <EOL> allDependencies += dependency <EOL> traverseDependencies ( dependency ) <EOL> } <EOL> } <EOL> } <EOL> traverseDependencies ( this ) <EOL> return allDependencies . toList ( ) <EOL> }


= konanConfig . isFinalBinary && konanConfig . ignoreCacheReason == null && ( autoCacheableFrom . isNotEmpty ( ) || icEnabled )


private fun findAllDependable ( libraries : List < KotlinLibrary > ) : Set < KotlinLibrary >

{ <EOL> val visited = mutableSetOf < KotlinLibrary > ( ) <EOL> fun dfs ( library : KotlinLibrary ) { <EOL> visited . add ( library ) <EOL> dependableLibraries [ library ] ? . forEach { <EOL> if ( it !in visited ) dfs ( it ) <EOL> } <EOL> } <EOL> libraries . forEach { if ( it !in visited ) dfs ( it ) } <EOL> return visited <EOL> }


= "<STR_LIT>"


{ <EOL> val externalLibrariesToCache = mutableListOf < KotlinLibrary > ( ) <EOL> val icedLibraries = mutableListOf < KotlinLibrary > ( ) <EOL> val stdlib = konanConfig . distribution . stdlib <EOL> allLibraries . forEach { library -> <EOL> val isSubjectOfIC = ! library . isDefault && ! library . isExternal && ! library . libraryName . startsWith ( stdlib ) <EOL> val cache = konanConfig . cachedLibraries . getLibraryCache ( library , allowIncomplete = isSubjectOfIC ) <EOL> cache ? . let { <EOL> caches [ library ] = it <EOL> cacheRootDirectories [ library ] = it . rootDirectory <EOL> } <EOL> if ( isSubjectOfIC ) { <EOL> icedLibraries += library <EOL> } else { <EOL> if ( cache == null ) externalLibrariesToCache += library <EOL> } <EOL> library . unresolvedDependencies . forEach { <EOL> val dependency = uniqueNameToLibrary [ it . path ] ! ! <EOL> dependableLibraries . getOrPut ( dependency ) { mutableListOf ( ) } . add ( library ) <EOL> } <EOL> } <EOL> externalLibrariesToCache . forEach { buildLibraryCache ( it , true , emptyList ( ) ) } <EOL> if ( ! icEnabled ) return <EOL> val needFullRebuild = findAllDependable ( externalLibrariesToCache ) <EOL> val libraryFilesWithFqNames = mutableMapOf < KotlinLibrary , List < FileWithFqName > > ( ) <EOL> val changedFiles = mutableListOf < LibraryFile > ( ) <EOL> val removedFiles = mutableListOf < LibraryFile > ( ) <EOL> val addedFiles = mutableListOf < LibraryFile > ( ) <EOL> val reversedPerFileDependencies = mutableMapOf < LibraryFile , MutableList < LibraryFile > > ( ) <EOL> val reversedWholeLibraryDependencies = mutableMapOf < KotlinLibrary , MutableList < LibraryFile > > ( ) <EOL> for ( library in icedLibraries ) { <EOL> if ( library in needFullRebuild ) continue <EOL> val cache = caches [ library ] ? : continue <EOL> if ( cache !is CachedLibraries . Cache . PerFile ) { <EOL> require ( library . isInteropLibrary ( ) ) <EOL> continue <EOL> } <EOL> val libraryCacheRootDir = File ( cache . path ) <EOL> val cachedFiles = libraryCacheRootDir . listFiles . map { it . name } <EOL> val actualFilesWithFqNames = library . getFilesWithFqNames ( ) <EOL> libraryFilesWithFqNames [ library ] = actualFilesWithFqNames <EOL> val actualFiles = actualFilesWithFqNames . withIndex ( ) <EOL> . associate { CacheSupport . cacheFileId ( it . value . fqName , it . value . filePath ) to it . index } <EOL> . toMutableMap ( ) <EOL> for ( cachedFile in cachedFiles ) { <EOL> val libraryFile = LibraryFile ( library , cachedFile ) <EOL> val fileIndex = actualFiles [ cachedFile ] <EOL> if ( fileIndex == null ) { <EOL> removedFiles . add ( libraryFile ) <EOL> } else { <EOL> actualFiles . remove ( cachedFile ) <EOL> val actualContentHash = SerializedIrFileFingerprint ( library , fileIndex ) . fileFingerprint <EOL> val previousContentHash = FingerprintHash . fromByteArray ( cache . getFileHash ( cachedFile ) ) <EOL> if ( previousContentHash != actualContentHash ) <EOL> changedFiles . add ( libraryFile ) <EOL> val dependencies = cache . getFileDependencies ( cachedFile ) <EOL> for ( dependency in dependencies ) { <EOL> val dependentLibrary = uniqueNameToLibrary [ dependency . libName ] <EOL> ? : error ( "<STR_LIT>" ) <EOL> when ( val kind = dependency . kind ) { <EOL> is DependenciesTracker . DependencyKind . WholeModule -> <EOL> reversedWholeLibraryDependencies . getOrPut ( dependentLibrary ) { mutableListOf ( ) } . add ( libraryFile ) <EOL> is DependenciesTracker . DependencyKind . CertainFiles -> <EOL> kind . files . forEach { <EOL> reversedPerFileDependencies . getOrPut ( LibraryFile ( dependentLibrary , it ) ) { mutableListOf ( ) } . add ( libraryFile ) <EOL> } <EOL> } <EOL> } <EOL> } <EOL> } <EOL> for ( newFile in actualFiles . keys ) <EOL> addedFiles . add ( LibraryFile ( library , newFile ) ) <EOL> } <EOL> configuration . report ( CompilerMessageSeverity . LOGGING , "<STR_LIT>" ) <EOL> configuration . report ( CompilerMessageSeverity . LOGGING , "<STR_LIT>" ) <EOL> icedLibraries . filter { caches [ it ] != null } . forEach { configuration . report ( CompilerMessageSeverity . LOGGING , "<STR_LIT>" ) } <EOL> configuration . report ( CompilerMessageSeverity . LOGGING , "<STR_LIT>" ) <EOL> icedLibraries . filter { caches [ it ] == null } . forEach { configuration . report ( CompilerMessageSeverity . LOGGING , "<STR_LIT>" ) } <EOL> configuration . report ( CompilerMessageSeverity . LOGGING , "<STR_LIT>" ) <EOL> icedLibraries . filter { it in needFullRebuild } . forEach { configuration . report ( CompilerMessageSeverity . LOGGING , "<STR_LIT>" ) } <EOL> configuration . report ( CompilerMessageSeverity . LOGGING , "<STR_LIT>" ) <EOL> addedFiles . forEach { configuration . report ( CompilerMessageSeverity . LOGGING , "<STR_LIT>" ) } <EOL> configuration . report ( CompilerMessageSeverity . LOGGING , "<STR_LIT>" ) <EOL> removedFiles . forEach { configuration . report ( CompilerMessageSeverity . LOGGING , "<STR_LIT>" ) } <EOL> configuration . report ( CompilerMessageSeverity . LOGGING , "<STR_LIT>" ) <EOL> changedFiles . forEach { configuration . report ( CompilerMessageSeverity . LOGGING , "<STR_LIT>" ) } <EOL> val dirtyFiles = mutableSetOf < LibraryFile > ( ) <EOL> fun dfs ( libraryFile : LibraryFile ) { <EOL> dirtyFiles += libraryFile <EOL> reversedPerFileDependencies [ libraryFile ] ? . forEach { <EOL> if ( it !in dirtyFiles ) dfs ( it ) <EOL> } <EOL> } <EOL> removedFiles . forEach { <EOL> if ( it !in dirtyFiles ) dfs ( it ) <EOL> } <EOL> changedFiles . forEach { <EOL> if ( it !in dirtyFiles ) dfs ( it ) <EOL> } <EOL> dirtyFiles . addAll ( addedFiles ) <EOL> removedFiles . forEach { <EOL> dirtyFiles . remove ( it ) <EOL> File ( caches [ it . library ] ! ! . rootDirectory ) . child ( it . file ) . deleteRecursively ( ) <EOL> } <EOL> val groupedDirtyFiles = dirtyFiles . groupBy { it . library } <EOL> configuration . report ( CompilerMessageSeverity . LOGGING , "<STR_LIT>" ) <EOL> groupedDirtyFiles . values . flatten ( ) . forEach { <EOL> configuration . report ( CompilerMessageSeverity . LOGGING , "<STR_LIT>" ) <EOL> } <EOL> for ( library in icedLibraries ) { <EOL> val filesToCache = groupedDirtyFiles [ library ] ? . let { libraryFiles -> <EOL> val filesWithFqNames = libraryFilesWithFqNames [ library ] ! ! . associateBy { <EOL> CacheSupport . cacheFileId ( it . fqName , it . filePath ) <EOL> } <EOL> libraryFiles . map { filesWithFqNames [ it . file ] ! ! . filePath } <EOL> } . orEmpty ( ) <EOL> when { <EOL> library in needFullRebuild -> buildLibraryCache ( library , false , emptyList ( ) ) <EOL> caches [ library ] == null || filesToCache . isNotEmpty ( ) -> buildLibraryCache ( library , false , filesToCache ) <EOL> } <EOL> } <EOL> }


private fun buildLibraryCache ( library : KotlinLibrary , isExternal : Boolean , filesToCache : List < String > )

{ <EOL> val dependencies = library . getAllTransitiveDependencies ( uniqueNameToLibrary ) <EOL> val dependencyCaches = dependencies . map { <EOL> cacheRootDirectories [ it ] ? : run { <EOL> configuration . report ( CompilerMessageSeverity . LOGGING , "<STR_LIT>" ) <EOL> return <EOL> } <EOL> } <EOL> configuration . report ( CompilerMessageSeverity . LOGGING , "<STR_LIT>" ) <EOL> filesToCache . forEach { configuration . report ( CompilerMessageSeverity . LOGGING , "<STR_LIT>" ) } <EOL> val makePerFileCache = ! isExternal && ! library . isInteropLibrary ( ) <EOL> val libraryCacheDirectory = when { <EOL> library . isDefault -> konanConfig . systemCacheDirectory <EOL> isExternal -> CachedLibraries . computeVersionedCacheDirectory ( konanConfig . autoCacheDirectory , library , uniqueNameToLibrary , uniqueNameToHash ) <EOL> else -> konanConfig . incrementalCacheDirectory ! ! <EOL> } <EOL> val libraryCache = libraryCacheDirectory . child ( if ( makePerFileCache ) CachedLibraries . getPerFileCachedLibraryName ( library ) else CachedLibraries . getCachedLibraryName ( library ) ) <EOL> try { <EOL> libraryCacheDirectory . mkdirs ( ) <EOL> compilationSpawner . spawn ( konanConfig . additionalCacheFlags ) { <EOL> val libraryPath = library . libraryFile . absolutePath <EOL> val libraries = dependencies . filter { ! it . isDefault } . map { it . libraryFile . absolutePath } <EOL> val cachedLibraries = dependencies . zip ( dependencyCaches ) . associate { it . first . libraryFile . absolutePath to it . second } <EOL> configuration . report ( CompilerMessageSeverity . LOGGING , "<STR_LIT>" + libraries . joinToString ( "<STR_LIT>" ) ) <EOL> configuration . report ( CompilerMessageSeverity . LOGGING , "<STR_LIT>" + cachedLibraries . entries . joinToString ( "<STR_LIT>" ) { "<STR_LIT>" } ) <EOL> configuration . report ( CompilerMessageSeverity . LOGGING , "<STR_LIT>" + libraryCacheDirectory . absolutePath ) <EOL> setupCommonOptionsForCaches ( konanConfig ) <EOL> put ( KonanConfigKeys . PRODUCE , CompilerOutputKind . STATIC_CACHE ) <EOL> put ( KonanConfigKeys . LIBRARY_TO_ADD_TO_CACHE , libraryPath ) <EOL> put ( KonanConfigKeys . NODEFAULTLIBS , true ) <EOL> put ( KonanConfigKeys . NOENDORSEDLIBS , true ) <EOL> put ( KonanConfigKeys . NOSTDLIB , true ) <EOL> put ( KonanConfigKeys . LIBRARY_FILES , libraries ) <EOL> if ( generateTestRunner != TestRunnerKind . NONE && libraryPath in includedLibraries ) { <EOL> put ( KonanConfigKeys . GENERATE_TEST_RUNNER , generateTestRunner ) <EOL> put ( KonanConfigKeys . INCLUDED_LIBRARIES , listOf ( libraryPath ) ) <EOL> configuration . get ( KonanConfigKeys . TEST_DUMP_OUTPUT_PATH ) ? . let { put ( KonanConfigKeys . TEST_DUMP_OUTPUT_PATH , it ) } <EOL> } <EOL> put ( KonanConfigKeys . CACHED_LIBRARIES , cachedLibraries ) <EOL> put ( KonanConfigKeys . CACHE_DIRECTORIES , listOf ( libraryCacheDirectory . absolutePath ) ) <EOL> put ( KonanConfigKeys . MAKE_PER_FILE_CACHE , makePerFileCache ) <EOL> if ( filesToCache . isNotEmpty ( ) ) <EOL> put ( KonanConfigKeys . FILES_TO_CACHE , filesToCache ) <EOL> } <EOL> cacheRootDirectories [ library ] = libraryCache . absolutePath <EOL> } catch ( t : Throwable ) { <EOL> configuration . report ( CompilerMessageSeverity . LOGGING , "<STR_LIT>" ) <EOL> configuration . report ( CompilerMessageSeverity . WARNING , "<STR_LIT>" + "<STR_LIT>" ) <EOL> libraryCache . deleteRecursively ( ) <EOL> } <EOL> }


override fun resolve ( resolveAsInput : Boolean ) : Constraint

{ <EOL> val functionConstraint = callTarget . resolve ( ) <EOL> if ( functionConstraint is FunctionConstraint ) { <EOL> if ( functionConstraint . overloads . size == <NUM_LIT:1> ) { <EOL> val parameters = functionConstraint . overloads [ <NUM_LIT:0> ] . parameterConstraints <EOL> if ( parameters . size > argumentNum ) { <EOL> return parameters [ argumentNum ] . second . resolve ( resolveAsInput = true ) <EOL> } <EOL> } else { <EOL> return UnionTypeConstraint ( functionConstraint . overloads . mapNotNull { <EOL> if ( it . parameterConstraints . size > argumentNum ) { <EOL> it . parameterConstraints [ argumentNum ] . second . resolve ( resolveAsInput = true ) <EOL> } else null <EOL> } ) . resolve ( ) <EOL> } <EOL> } <EOL> return CompositeConstraint ( owner ) <EOL> }


public fun foo ( p : List < String > )


public fun dummy ( )


override fun foo ( p : List < String > )


{ <EOL> v += B ( <NUM_LIT> ) <EOL> }


@ JvmStatic operator fun B . plusAssign ( b : B )

{ <EOL> this . s += b . s <EOL> }


{ <EOL> val b1 = B ( <NUM_LIT:11> ) <EOL> with ( A ) { <EOL> b1 += B ( <NUM_LIT> ) <EOL> } <EOL> if ( b1 . s != <NUM_LIT> ) return "<STR_LIT:failU+00201>" <EOL> val b = B ( <NUM_LIT:11> ) <EOL> A . test1 ( b ) <EOL> if ( b . s != <NUM_LIT> ) return "<STR_LIT:failU+00202>" <EOL> return "<STR_LIT:OK>" <EOL> }


{ <EOL> var q = "<STR_LIT>" <EOL> foo ( if ( y ) { q = "<STR_LIT:OK>" ; zByte } else zShort , return q ) <EOL> }


override fun report ( whenExpressionFilePath : String , enumClassFqName : String )

{ <EOL> enumWhenTracker . report ( whenExpressionFilePath , enumClassFqName ) <EOL> }


{ <EOL> val array = Array ( <NUM_LIT:10> ) { <NUM_LIT:0> } <EOL> val array1 = Array ( <NUM_LIT:3> ) { <NUM_LIT:0> } <EOL> var j = <NUM_LIT:4> <EOL> assertFailsWith < IndexOutOfBoundsException > { <EOL> for ( i in array . indices ) { <EOL> array [ j ] = <NUM_LIT:6> <EOL> j ++ <EOL> } <EOL> } <EOL> assertFailsWith < IndexOutOfBoundsException > { <EOL> for ( i in array . indices ) { <EOL> array [ i + <NUM_LIT:1> ] = <NUM_LIT:6> <EOL> } <EOL> } <EOL> assertFailsWith < IndexOutOfBoundsException > { <EOL> for ( i in array . indices ) { <EOL> array1 [ i ] = <NUM_LIT:6> <EOL> } <EOL> } <EOL> return "<STR_LIT:OK>" <EOL> }


{ <EOL> buildList { <EOL> add ( "<STR_LIT>" ) <EOL> println ( this . plus ( <NUM_LIT:1> ) [ <NUM_LIT:0> ] ) <EOL> } <EOL> }


@ Deprecated ( "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) <EOL> fun Any ? . toIrConst ( irType : IrType , startOffset : Int = SYNTHETIC_OFFSET , endOffset : Int = SYNTHETIC_OFFSET ) : IrConst < * >

= <EOL> toIrConst ( irType , startOffset , endOffset )


internal fun IrFunction . createCall ( origin : IrStatementOrigin ? = null ) : IrCall

{ <EOL> this as IrSimpleFunction <EOL> return IrCallImpl ( SYNTHETIC_OFFSET , SYNTHETIC_OFFSET , returnType , symbol , typeParameters . size , valueParameters . size , origin ) <EOL> }


internal fun IrConstructor . createConstructorCall ( irType : IrType = returnType ) : IrConstructorCall

{ <EOL> return IrConstructorCallImpl . fromSymbolOwner ( SYNTHETIC_OFFSET , SYNTHETIC_OFFSET , irType , symbol ) <EOL> }


internal fun IrValueDeclaration . createGetValue ( ) : IrGetValue

{ <EOL> return IrGetValueImpl ( SYNTHETIC_OFFSET , SYNTHETIC_OFFSET , this . type , this . symbol ) <EOL> }


internal fun IrValueDeclaration . createTempVariable ( ) : IrVariable

{ <EOL> return IrVariableImpl ( SYNTHETIC_OFFSET , SYNTHETIC_OFFSET , IrDeclarationOrigin . IR_TEMPORARY_VARIABLE , IrVariableSymbolImpl ( ) , this . name , this . type , isVar = false , isConst = false , isLateinit = false ) <EOL> }


internal fun IrClass . createGetObject ( ) : IrGetObjectValue

{ <EOL> return IrGetObjectValueImpl ( SYNTHETIC_OFFSET , SYNTHETIC_OFFSET , this . defaultType , this . symbol ) <EOL> }


internal fun IrFunction . createReturn ( value : IrExpression ) : IrReturn

{ <EOL> return IrReturnImpl ( SYNTHETIC_OFFSET , SYNTHETIC_OFFSET , this . returnType , this . symbol , value ) <EOL> }


internal fun createTempFunction ( name : Name , type : IrType , origin : IrDeclarationOrigin = TEMP_FUNCTION_FOR_INTERPRETER , visibility : DescriptorVisibility = DescriptorVisibilities . PUBLIC ) : IrSimpleFunction

{ <EOL> return IrFactoryImpl . createSimpleFunction ( startOffset = SYNTHETIC_OFFSET , endOffset = SYNTHETIC_OFFSET , origin = origin , name = name , visibility = visibility , isInline = false , isExpect = false , returnType = type , modality = Modality . FINAL , symbol = IrSimpleFunctionSymbolImpl ( ) , isTailrec = false , isSuspend = false , isOperator = true , isInfix = false , isExternal = false , ) <EOL> }


internal fun createTempClass ( name : Name , origin : IrDeclarationOrigin = TEMP_CLASS_FOR_INTERPRETER ) : IrClass

{ <EOL> return IrFactoryImpl . createClass ( startOffset = SYNTHETIC_OFFSET , endOffset = SYNTHETIC_OFFSET , origin = origin , name = name , visibility = DescriptorVisibilities . PRIVATE , symbol = IrClassSymbolImpl ( ) , kind = ClassKind . CLASS , modality = Modality . FINAL , ) <EOL> }


internal fun IrFunction . createGetField ( ) : IrExpression

{ <EOL> val backingField = this . property ! ! . backingField ! ! <EOL> val receiver = dispatchReceiverParameter ? : extensionReceiverParameter <EOL> return backingField . createGetField ( receiver ) <EOL> }


internal fun IrField . createGetField ( receiver : IrValueParameter ? = null ) : IrGetField

{ <EOL> return IrGetFieldImpl ( SYNTHETIC_OFFSET , SYNTHETIC_OFFSET , this . symbol , this . type , receiver ? . createGetValue ( ) ) <EOL> }


internal fun List < IrStatement > . wrapWithBlockBody ( ) : IrBlockBody

{ <EOL> return IrFactoryImpl . createBlockBody ( SYNTHETIC_OFFSET , SYNTHETIC_OFFSET , this ) <EOL> }


internal fun IrFunctionAccessExpression . shallowCopy ( copyTypeArguments : Boolean = true ) : IrFunctionAccessExpression

{ <EOL> return when ( this ) { <EOL> is IrCall -> symbol . owner . createCall ( ) <EOL> is IrConstructorCall -> symbol . owner . createConstructorCall ( ) <EOL> is IrDelegatingConstructorCall -> IrDelegatingConstructorCallImpl . fromSymbolOwner ( SYNTHETIC_OFFSET , SYNTHETIC_OFFSET , type , symbol ) <EOL> is IrEnumConstructorCall -> <EOL> IrEnumConstructorCallImpl ( SYNTHETIC_OFFSET , SYNTHETIC_OFFSET , type , symbol , typeArgumentsCount , valueArgumentsCount ) <EOL> else -> TODO ( "<STR_LIT>" ) <EOL> } . apply { <EOL> if ( copyTypeArguments ) { <EOL> ( <NUM_LIT:0> until this @ shallowCopy . typeArgumentsCount ) . forEach { this . putTypeArgument ( it , this @ shallowCopy . getTypeArgument ( it ) ) } <EOL> } <EOL> } <EOL> }


internal fun IrBuiltIns . copyArgs ( from : IrFunctionAccessExpression , into : IrFunctionAccessExpression )

{ <EOL> into . dispatchReceiver = from . dispatchReceiver <EOL> into . extensionReceiver = from . extensionReceiver <EOL> ( <NUM_LIT:0> until from . valueArgumentsCount ) <EOL> . map { from . getValueArgument ( it ) } <EOL> . forEachIndexed { i , arg -> <EOL> into . putValueArgument ( i , arg ? : IrConstImpl . constNull ( SYNTHETIC_OFFSET , SYNTHETIC_OFFSET , this . anyNType ) ) <EOL> } <EOL> }


internal fun IrBuiltIns . irEquals ( arg1 : IrExpression , arg2 : IrExpression ) : IrCall

{ <EOL> val equalsCall = this . eqeqSymbol . owner . createCall ( IrStatementOrigin . EQEQ ) <EOL> equalsCall . putValueArgument ( <NUM_LIT:0> , arg1 ) <EOL> equalsCall . putValueArgument ( <NUM_LIT:1> , arg2 ) <EOL> return equalsCall <EOL> }


internal fun IrBuiltIns . irIfNullThenElse ( nullableArg : IrExpression , ifTrue : IrExpression , ifFalse : IrExpression ) : IrWhen

{ <EOL> val nullCondition = this . irEquals ( nullableArg , IrConstImpl . constNull ( SYNTHETIC_OFFSET , SYNTHETIC_OFFSET , this . anyNType ) ) <EOL> val trueBranch = IrBranchImpl ( nullCondition , ifTrue ) <EOL> val elseBranch = IrElseBranchImpl ( IrConstImpl . constTrue ( SYNTHETIC_OFFSET , SYNTHETIC_OFFSET , this . booleanType ) , ifFalse ) <EOL> return IrIfThenElseImpl ( SYNTHETIC_OFFSET , SYNTHETIC_OFFSET , ifTrue . type ) . apply { branches += listOf ( trueBranch , elseBranch ) } <EOL> }


internal fun IrBuiltIns . emptyArrayConstructor ( arrayType : IrType ) : IrConstructorCall

{ <EOL> val arrayClass = arrayType . classOrNull ! ! . owner <EOL> val constructor = arrayClass . constructors . firstOrNull { it . valueParameters . size == <NUM_LIT:1> } ? : arrayClass . constructors . first ( ) <EOL> val constructorCall = constructor . createConstructorCall ( arrayType ) <EOL> constructorCall . putValueArgument ( <NUM_LIT:0> , <NUM_LIT:0> . toIrConst ( this . intType ) ) <EOL> if ( constructor . valueParameters . size == <NUM_LIT:2> ) { <EOL> val tempFunction = createTempFunction ( Name . identifier ( "<STR_LIT>" ) , this . anyType ) <EOL> tempFunction . parent = arrayClass <EOL> val initLambda = IrFunctionExpressionImpl ( SYNTHETIC_OFFSET , SYNTHETIC_OFFSET , constructor . valueParameters [ <NUM_LIT:1> ] . type , tempFunction , IrStatementOrigin . LAMBDA ) <EOL> constructorCall . putValueArgument ( <NUM_LIT:1> , initLambda ) <EOL> constructorCall . putTypeArgument ( <NUM_LIT:0> , ( arrayType as IrSimpleType ) . arguments . singleOrNull ( ) ? . typeOrNull ) <EOL> } <EOL> return constructorCall <EOL> }


internal fun IrConst < * > . toConstantValue ( ) : ConstantValue < * >

{ <EOL> if ( value == null ) return NullValue <EOL> val constType = this . type . makeNotNull ( ) . removeAnnotations ( ) <EOL> return when ( this . type . getPrimitiveType ( ) ) { <EOL> PrimitiveType . BOOLEAN -> BooleanValue ( this . value as Boolean ) <EOL> PrimitiveType . CHAR -> CharValue ( this . value as Char ) <EOL> PrimitiveType . BYTE -> ByteValue ( ( this . value as Number ) . toByte ( ) ) <EOL> PrimitiveType . SHORT -> ShortValue ( ( this . value as Number ) . toShort ( ) ) <EOL> PrimitiveType . INT -> IntValue ( ( this . value as Number ) . toInt ( ) ) <EOL> PrimitiveType . FLOAT -> FloatValue ( ( this . value as Number ) . toFloat ( ) ) <EOL> PrimitiveType . LONG -> LongValue ( ( this . value as Number ) . toLong ( ) ) <EOL> PrimitiveType . DOUBLE -> DoubleValue ( ( this . value as Number ) . toDouble ( ) ) <EOL> null -> when ( constType . getUnsignedType ( ) ) { <EOL> UnsignedType . UBYTE -> UByteValue ( ( this . value as Number ) . toByte ( ) ) <EOL> UnsignedType . USHORT -> UShortValue ( ( this . value as Number ) . toShort ( ) ) <EOL> UnsignedType . UINT -> UIntValue ( ( this . value as Number ) . toInt ( ) ) <EOL> UnsignedType . ULONG -> ULongValue ( ( this . value as Number ) . toLong ( ) ) <EOL> null -> when { <EOL> constType . isString ( ) -> StringValue ( this . value as String ) <EOL> else -> error ( "<STR_LIT>" ) <EOL> } <EOL> } <EOL> } <EOL> }


= <NUM_LIT:1>


@ JsName ( "<STR_LIT>" ) <EOL> fun foo ( ) : String


@ JsName ( "<STR_LIT>" ) <EOL> fun default ( ) : String

= "<STR_LIT>"


= "<STR_LIT>"


fun foo ( ) : Any


= <NUM_LIT:42>


{ <EOL> val impl = object : I { <EOL> } <EOL> val method = impl . javaClass . getMethod ( "<STR_LIT>" , String :: class . java ) <EOL> val parameter = method . parameters [ <NUM_LIT:0> ] <EOL> val size = parameter . annotations . size <EOL> if ( size == <NUM_LIT:1> ) return "<STR_LIT:OK>" <EOL> return "<STR_LIT>" <EOL> }


{ <EOL> }


{ <EOL> check ( ! isStartedImpl . getAndSet ( true ) ) { <EOL> "<STR_LIT>" <EOL> } <EOL> check ( ! project . state . executed ) { <EOL> "<STR_LIT>" <EOL> } <EOL> loopIfNecessary ( ) <EOL> project . whenEvaluated { <EOL> project . failures . let { failures -> <EOL> if ( failures . isNotEmpty ( ) ) { <EOL> finishWithFailures ( failures ) <EOL> return@whenEvaluated <EOL> } <EOL> } <EOL> assert ( enqueuedActions . getValue ( stage ) . isEmpty ( ) ) { "<STR_LIT>" } <EOL> stage = stage . nextOrThrow <EOL> executeCurrentStageAndScheduleNext ( ) <EOL> } <EOL> }


private fun executeCurrentStageAndScheduleNext ( )

{ <EOL> stage . previousOrNull ? . let { previousStage -> <EOL> assert ( enqueuedActions . getValue ( previousStage ) . isEmpty ( ) ) { <EOL> "<STR_LIT>" <EOL> } <EOL> } <EOL> val failures = project . failures <EOL> if ( failures . isNotEmpty ( ) ) { <EOL> finishWithFailures ( failures ) <EOL> return <EOL> } <EOL> try { <EOL> loopIfNecessary ( ) <EOL> } catch ( t : Throwable ) { <EOL> finishWithFailures ( listOf ( t ) ) <EOL> throw t <EOL> } <EOL> stage = stage . nextOrNull ? : run { <EOL> finishSuccessfully ( ) <EOL> return <EOL> } <EOL> project . afterEvaluate { <EOL> executeCurrentStageAndScheduleNext ( ) <EOL> } <EOL> }


{ <EOL> if ( loopRunning . getAndSet ( true ) ) return <EOL> try { <EOL> val queue = enqueuedActions . getValue ( stage ) <EOL> do { <EOL> project . state . rethrowFailure ( ) <EOL> val action = queue . removeFirstOrNull ( ) <EOL> action ? . invoke ( this ) <EOL> } while ( action != null ) <EOL> } finally { <EOL> loopRunning . set ( false ) <EOL> } <EOL> }


private fun finishWithFailures ( failures : List < Throwable > )

{ <EOL> assert ( failures . isNotEmpty ( ) ) <EOL> assert ( isStartedImpl . get ( ) ) <EOL> assert ( ! isFinishedWithFailures . getAndSet ( true ) ) <EOL> configurationResult . complete ( ProjectConfigurationResult . Failure ( failures ) ) <EOL> }


{ <EOL> assert ( isStartedImpl . get ( ) ) <EOL> assert ( ! isFinishedSuccessfully . getAndSet ( true ) ) <EOL> configurationResult . complete ( ProjectConfigurationResult . Success ) <EOL> }


fun enqueue ( stage : KotlinPluginLifecycle . Stage , action : KotlinPluginLifecycle . ( ) -> Unit )

{ <EOL> if ( stage < this . stage ) { <EOL> throw KotlinPluginLifecycle . IllegalLifecycleException ( "<STR_LIT>" ) <EOL> } <EOL> if ( isFinishedSuccessfully . get ( ) ) { <EOL> return action ( ) <EOL> } <EOL> if ( isFinishedWithFailures . get ( ) ) { <EOL> return if ( stage == this . stage ) action ( ) <EOL> else Unit <EOL> } <EOL> enqueuedActions . getValue ( stage ) . addLast ( action ) <EOL> if ( stage == KotlinPluginLifecycle . Stage . EvaluateBuildscript && isStartedImpl . get ( ) ) { <EOL> loopIfNecessary ( ) <EOL> } <EOL> }


override fun launch ( start : KotlinPluginLifecycle . CoroutineStart , block : suspend KotlinPluginLifecycle . ( ) -> Unit , )

{ <EOL> val lifecycle = this <EOL> val coroutine = block . createCoroutine ( this , object : Continuation < Unit > { <EOL> override val context : CoroutineContext = EmptyCoroutineContext + <EOL> KotlinPluginLifecycleCoroutineContextElement ( lifecycle ) <EOL> override fun resumeWith ( result : Result < Unit > ) = result . getOrThrow ( ) <EOL> } ) <EOL> when ( start ) { <EOL> Default -> enqueue ( stage ) { coroutine . resume ( Unit ) } <EOL> Undispatched -> coroutine . resume ( Unit ) <EOL> } <EOL> }


override suspend fun await ( stage : KotlinPluginLifecycle . Stage )

{ <EOL> if ( this . stage > stage ) return <EOL> suspendCoroutine < Unit > { continuation -> <EOL> enqueue ( stage ) { <EOL> continuation . resume ( Unit ) <EOL> } <EOL> } <EOL> }


= buildString { <EOL> append ( "<STR_LIT>" ) <EOL> if ( ! isStarted ) append ( "<STR_LIT>" ) <EOL> else append ( "<STR_LIT>" ) <EOL> if ( isFinishedSuccessfully . get ( ) ) append ( "<STR_LIT>" ) <EOL> if ( isFinishedWithFailures . get ( ) ) append ( "<STR_LIT>" ) <EOL> }


override fun selectDeserializer ( element : JsonElement )

= when { <EOL> "<STR_LIT>" in element . jsonObject -> OwnedProject . serializer ( ) <EOL> else -> BasicProject . serializer ( ) <EOL> }


{ <EOL> val data = listOf ( OwnedProject ( "<STR_LIT>" , "<STR_LIT:kotlin>" ) , BasicProject ( "<STR_LIT>" ) ) <EOL> val string = Json . encodeToString ( ListSerializer ( ProjectSerializer ) , data ) <EOL> println ( string ) <EOL> println ( Json . decodeFromString ( ListSerializer ( ProjectSerializer ) , string ) ) <EOL> }


{ <EOL> val array = Array ( <NUM_LIT:10> ) { <NUM_LIT:0> } <EOL> assertFailsWith < IndexOutOfBoundsException > { <EOL> array . forEachIndexed { index , _ -> <EOL> array [ index + <NUM_LIT:1> ] = <NUM_LIT:1> <EOL> } <EOL> } <EOL> return "<STR_LIT:OK>" <EOL> }


fun greetEachOther ( people : Collection < Person > )

{ <EOL> for ( person in people ) { <EOL> person . greet ( ) <EOL> } <EOL> }


operator fun plusAssign ( data : String )

{ <EOL> value += data <EOL> }


{ <EOL> x = X ( ) <EOL> }


{ <EOL> val a = B ( ) <EOL> a . init ( ) <EOL> a . x += "<STR_LIT:OK>" <EOL> return a . x . value <EOL> }


{ <EOL> foo ( ) <EOL> bar ( ) <EOL> }


{ <EOL> }


inline fun bar ( i : Int = <NUM_LIT:1> )

{ <EOL> }


override fun possibleGetterNamesByPropertyName ( name : Name ) : List < Name >

= possibleGetMethodNames ( name )


override fun setterNameByGetterName ( name : Name ) : Name

= setMethodName ( getMethodName = name )


override fun possiblePropertyNamesByAccessorName ( name : Name ) : List < Name >

= getPropertyNamesCandidatesByAccessorName ( name )


{ <EOL> assertEquals ( <NUM_LIT> , KT49455 ( ) . extensionFunction ( ) ) <EOL> }


private fun createPackage ( fqName : FqName ) : IrPackageFragment

= <EOL> createEmptyExternalPackageFragment ( context . state . module , fqName )


private fun createClass ( fqName : FqName , classKind : ClassKind = ClassKind . CLASS , classModality : Modality = Modality . FINAL , classIsValue : Boolean = false , block : ( IrClass ) -> Unit = { } ) : IrClassSymbol

= <EOL> irFactory . buildClass { <EOL> name = fqName . shortName ( ) <EOL> kind = classKind <EOL> modality = classModality <EOL> isValue = classIsValue <EOL> } . apply { <EOL> parent = when ( fqName . parent ( ) . asString ( ) ) { <EOL> "<STR_LIT:kotlin>" -> kotlinPackage <EOL> "<STR_LIT>" -> kotlinCoroutinesPackage <EOL> "<STR_LIT>" -> kotlinCoroutinesJvmInternalPackage <EOL> "<STR_LIT>" -> kotlinEnumsPackage <EOL> "<STR_LIT>" -> kotlinJvmInternalPackage <EOL> "<STR_LIT>" -> kotlinJvmFunctionsPackage <EOL> "<STR_LIT>" -> kotlinJvmPackage <EOL> "<STR_LIT>" -> kotlinReflectPackage <EOL> "<STR_LIT>" -> javaLangPackage <EOL> "<STR_LIT>" -> javaLangInvokePackage <EOL> "<STR_LIT>" -> javaUtilPackage <EOL> "<STR_LIT>" -> kotlinInternalPackage <EOL> else -> error ( "<STR_LIT>" ) <EOL> } <EOL> createImplicitParameterDeclarationWithWrappedDescriptor ( ) <EOL> block ( this ) <EOL> } . symbol


private fun addSuspendLambdaInterfaceFunctions ( klass : IrClass )

{ <EOL> klass . superTypes += suspendFunctionInterface . defaultType <EOL> klass . addConstructor ( ) . apply { <EOL> addValueParameter ( "<STR_LIT>" , irBuiltIns . intType ) <EOL> addValueParameter ( SUSPEND_FUNCTION_COMPLETION_PARAMETER_NAME , continuationClass . typeWith ( irBuiltIns . anyNType ) . makeNullable ( ) ) <EOL> } <EOL> klass . addFunction ( INVOKE_SUSPEND_METHOD_NAME , irBuiltIns . anyNType , Modality . ABSTRACT , DescriptorVisibilities . PROTECTED ) . apply { <EOL> addValueParameter ( SUSPEND_CALL_RESULT_NAME , resultOfAnyType ) <EOL> } <EOL> klass . addFunction ( SUSPEND_FUNCTION_CREATE_METHOD_NAME , continuationClass . typeWith ( irBuiltIns . unitType ) , Modality . OPEN ) . apply { <EOL> addValueParameter ( SUSPEND_FUNCTION_COMPLETION_PARAMETER_NAME , continuationClass . typeWith ( irBuiltIns . nothingType ) ) <EOL> } <EOL> klass . addFunction ( SUSPEND_FUNCTION_CREATE_METHOD_NAME , continuationClass . typeWith ( irBuiltIns . unitType ) , Modality . OPEN ) . apply { <EOL> addValueParameter ( "<STR_LIT:value>" , irBuiltIns . anyNType ) <EOL> addValueParameter ( SUSPEND_FUNCTION_COMPLETION_PARAMETER_NAME , continuationClass . typeWith ( irBuiltIns . nothingType ) ) <EOL> } <EOL> }


private fun generateCallableReferenceMethods ( klass : IrClass )

{ <EOL> klass . addFunction ( "<STR_LIT>" , irBuiltIns . stringType , Modality . OPEN ) <EOL> klass . addFunction ( "<STR_LIT>" , irBuiltIns . stringType , Modality . OPEN ) <EOL> klass . addFunction ( "<STR_LIT>" , kDeclarationContainer . defaultType , Modality . OPEN ) <EOL> }


private fun IrClass . generateCallableReferenceSuperclassConstructors ( withArity : Boolean )

{ <EOL> for ( hasBoundReceiver in listOf ( false , true ) ) { <EOL> addConstructor ( ) . apply { <EOL> if ( withArity ) { <EOL> addValueParameter ( "<STR_LIT>" , irBuiltIns . intType ) <EOL> } <EOL> if ( hasBoundReceiver ) { <EOL> addValueParameter ( "<STR_LIT>" , irBuiltIns . anyNType ) <EOL> } <EOL> addValueParameter ( "<STR_LIT>" , javaLangClass . starProjectedType ) <EOL> addValueParameter ( "<STR_LIT:name>" , irBuiltIns . stringType ) <EOL> addValueParameter ( "<STR_LIT>" , irBuiltIns . stringType ) <EOL> addValueParameter ( "<STR_LIT>" , irBuiltIns . intType ) <EOL> } <EOL> } <EOL> }


fun getFunction ( parameterCount : Int ) : IrClassSymbol

= irBuiltIns . functionN ( parameterCount ) . symbol


private fun createFunctionClass ( n : Int , isSuspend : Boolean ) : IrClassSymbol

= <EOL> createClass ( FqName ( "<STR_LIT>" ) , ClassKind . INTERFACE ) { klass -> <EOL> for ( i in <NUM_LIT:1> .. n ) { <EOL> klass . addTypeParameter ( "<STR_LIT>" , irBuiltIns . anyNType , Variance . IN_VARIANCE ) <EOL> } <EOL> val returnType = klass . addTypeParameter ( "<STR_LIT:R>" , irBuiltIns . anyNType , Variance . OUT_VARIANCE ) <EOL> klass . addFunction ( "<STR_LIT>" , returnType . defaultType , Modality . ABSTRACT , isSuspend = isSuspend ) . apply { <EOL> for ( i in <NUM_LIT:1> .. n ) { <EOL> addValueParameter ( "<STR_LIT>" , klass . typeParameters [ i - <NUM_LIT:1> ] . defaultType ) <EOL> } <EOL> } <EOL> }


fun getJvmFunctionClass ( parameterCount : Int ) : IrClassSymbol

= <EOL> jvmFunctionClasses ( parameterCount )


fun getJvmSuspendFunctionClass ( parameterCount : Int ) : IrClassSymbol

= <EOL> jvmSuspendFunctionClasses ( parameterCount )


fun getPropertyReferenceClass ( mutable : Boolean , parameterCount : Int , impl : Boolean ) : IrClassSymbol

{ <EOL> val key = PropertyReferenceKey ( mutable , parameterCount , impl ) <EOL> return propertyReferenceClassCache . getOrPut ( key ) { <EOL> val className = buildString { <EOL> if ( mutable ) append ( "<STR_LIT>" ) <EOL> append ( "<STR_LIT>" ) <EOL> append ( parameterCount ) <EOL> if ( impl ) append ( "<STR_LIT>" ) <EOL> } <EOL> createClass ( FqName ( "<STR_LIT>" ) , classModality = if ( impl ) Modality . FINAL else Modality . ABSTRACT ) { klass -> <EOL> if ( impl ) { <EOL> klass . addConstructor ( ) . apply { <EOL> addValueParameter ( "<STR_LIT>" , kDeclarationContainer . defaultType ) <EOL> addValueParameter ( "<STR_LIT:name>" , irBuiltIns . stringType ) <EOL> addValueParameter ( "<STR_LIT:string>" , irBuiltIns . stringType ) <EOL> } <EOL> if ( generateOptimizedCallableReferenceSuperClasses ) { <EOL> klass . generateCallableReferenceSuperclassConstructors ( withArity = false ) <EOL> } <EOL> klass . superTypes += getPropertyReferenceClass ( mutable , parameterCount , false ) . defaultType <EOL> } else { <EOL> klass . addConstructor ( ) <EOL> klass . addConstructor ( ) . apply { <EOL> addValueParameter ( "<STR_LIT>" , irBuiltIns . anyNType ) <EOL> } <EOL> } <EOL> val receiverFieldName = Name . identifier ( "<STR_LIT>" ) <EOL> klass . addProperty { <EOL> name = receiverFieldName <EOL> } . apply { <EOL> backingField = irFactory . buildField { <EOL> name = receiverFieldName <EOL> type = irBuiltIns . anyNType <EOL> visibility = DescriptorVisibilities . PROTECTED <EOL> } . also { field -> <EOL> field . parent = klass <EOL> } <EOL> } <EOL> generateCallableReferenceMethods ( klass ) <EOL> klass . addFunction ( "<STR_LIT:get>" , irBuiltIns . anyNType , Modality . ABSTRACT ) . apply { <EOL> for ( i in <NUM_LIT:0> until parameterCount ) { <EOL> addValueParameter ( "<STR_LIT>" , irBuiltIns . anyNType ) <EOL> } <EOL> } <EOL> klass . addFunction ( "<STR_LIT>" , irBuiltIns . anyNType , Modality . FINAL ) . apply { <EOL> for ( i in <NUM_LIT:0> until parameterCount ) { <EOL> addValueParameter ( "<STR_LIT>" , irBuiltIns . anyNType ) <EOL> } <EOL> } <EOL> if ( mutable ) { <EOL> klass . addFunction ( "<STR_LIT:set>" , irBuiltIns . unitType , Modality . ABSTRACT ) . apply { <EOL> for ( i in <NUM_LIT:0> until parameterCount ) { <EOL> addValueParameter ( "<STR_LIT>" , irBuiltIns . anyNType ) <EOL> } <EOL> addValueParameter ( "<STR_LIT:value>" , irBuiltIns . anyNType ) <EOL> } <EOL> } <EOL> } <EOL> } <EOL> }


private fun IrClass . addArraysCopyOfFunction ( arrayType : IrSimpleType )

{ <EOL> addFunction ( "<STR_LIT>" , arrayType , isStatic = true ) . apply { <EOL> addValueParameter ( "<STR_LIT>" , arrayType ) <EOL> addValueParameter ( "<STR_LIT>" , irBuiltIns . intType ) <EOL> arraysCopyOfFunctions [ arrayType . classifierOrFail ] = this <EOL> } <EOL> }


private fun IrClass . addArraysEqualsFunction ( arrayType : IrSimpleType )

{ <EOL> addFunction ( "<STR_LIT:equals>" , irBuiltIns . booleanType , isStatic = true ) . apply { <EOL> addValueParameter ( "<STR_LIT:a>" , arrayType ) <EOL> addValueParameter ( "<STR_LIT:b>" , arrayType ) <EOL> } <EOL> }


fun getArraysCopyOfFunction ( arrayType : IrSimpleType ) : IrSimpleFunctionSymbol

{ <EOL> val classifier = arrayType . classifier <EOL> val copyOf = arraysCopyOfFunctions [ classifier ] <EOL> if ( copyOf != null ) <EOL> return copyOf . symbol <EOL> else <EOL> throw AssertionError ( "<STR_LIT>" ) <EOL> }


private fun createIncrDecrFun ( intrinsicName : String ) : IrSimpleFunctionSymbol

= <EOL> irFactory . buildFun { <EOL> name = Name . special ( intrinsicName ) <EOL> origin = IrDeclarationOrigin . IR_BUILTINS_STUB <EOL> } . apply { <EOL> parent = kotlinJvmInternalPackage <EOL> addValueParameter ( "<STR_LIT:value>" , irBuiltIns . intType ) <EOL> addValueParameter ( "<STR_LIT>" , irBuiltIns . intType ) <EOL> returnType = irBuiltIns . intType <EOL> } . symbol


private fun createJavaPrimitiveClassWithUnsignedUtils ( fqName : FqName , type : IrType ) : IrClassSymbol

= createClass ( fqName ) { klass -> <EOL> klass . addFunction ( "<STR_LIT>" , irBuiltIns . intType , isStatic = true ) . apply { <EOL> addValueParameter ( "<STR_LIT:x>" , type ) <EOL> addValueParameter ( "<STR_LIT:y>" , type ) <EOL> } <EOL> klass . addFunction ( "<STR_LIT>" , type , isStatic = true ) . apply { <EOL> addValueParameter ( "<STR_LIT>" , type ) <EOL> addValueParameter ( "<STR_LIT>" , type ) <EOL> } <EOL> klass . addFunction ( "<STR_LIT>" , type , isStatic = true ) . apply { <EOL> addValueParameter ( "<STR_LIT>" , type ) <EOL> addValueParameter ( "<STR_LIT>" , type ) <EOL> } <EOL> klass . addFunction ( "<STR_LIT>" , irBuiltIns . stringType , isStatic = true ) . apply { <EOL> addValueParameter ( "<STR_LIT:i>" , type ) <EOL> } <EOL> }


fun typeToStringValueOfFunction ( type : IrType ) : IrSimpleFunctionSymbol

= <EOL> valueOfFunctions [ type ] ? : defaultValueOfFunction


private fun buildClass ( fqName : FqName , classKind : ClassKind = ClassKind . ANNOTATION_CLASS , ) : IrClass

= context . irFactory . buildClass { <EOL> check ( fqName . parent ( ) == javaLangAnnotation ) { fqName } <EOL> name = fqName . shortName ( ) <EOL> kind = classKind <EOL> } . apply { <EOL> val irClass = this <EOL> parent = javaLangAnnotationPackage <EOL> javaLangAnnotationPackage . addChild ( this ) <EOL> thisReceiver = buildValueParameter ( this ) { <EOL> name = Name . identifier ( "<STR_LIT>" ) <EOL> type = IrSimpleTypeImpl ( irClass . symbol , false , emptyList ( ) , emptyList ( ) ) <EOL> } <EOL> }


private fun buildAnnotationConstructor ( annotationClass : IrClass ) : IrConstructor

= <EOL> annotationClass . addConstructor { isPrimary = true }


private fun buildEnumEntry ( enumClass : IrClass , entryName : String ) : IrEnumEntry

{ <EOL> return context . irFactory . createEnumEntry ( UNDEFINED_OFFSET , UNDEFINED_OFFSET , IrDeclarationOrigin . IR_EXTERNAL_JAVA_DECLARATION_STUB , Name . identifier ( entryName ) , IrEnumEntrySymbolImpl ( ) , ) . apply { <EOL> parent = enumClass <EOL> enumClass . addChild ( this ) <EOL> } <EOL> }


fun IrClassSymbol . functionByName ( name : String ) : IrSimpleFunctionSymbol

= <EOL> functions . single { it . owner . name . asString ( ) == name }


fun IrClassSymbol . fieldByName ( name : String ) : IrFieldSymbol

= <EOL> fields . single { it . owner . name . asString ( ) == name }


override fun equals ( other : Any ? ) : Boolean

{ <EOL> if ( this === other ) return true <EOL> if ( other !is AbstractKtSourceElement ) return false <EOL> if ( startOffset != other . startOffset ) return false <EOL> if ( endOffset != other . endOffset ) return false <EOL> return true <EOL> }


{ <EOL> var result = startOffset <EOL> result = <NUM_LIT:31> * result + endOffset <EOL> return result <EOL> }


abstract fun getElementTextInContextForDebug ( ) : String


abstract override fun hashCode ( ) : Int

/** Implementation must compute the hashcode from the source element. */


abstract override fun equals ( other : Any ? ) : Boolean

/** Elements of the same source should be considered equal. */


override fun getElementTextInContextForDebug ( ) : String

{ <EOL> return getElementTextWithContext ( psi ) <EOL> }


= lighterAST . unwrap ( node )


override fun toString ( node : LighterASTNode ) : CharSequence

= unwrap ( node ) . text


override fun getRoot ( ) : LighterASTNode

= lighterAST . root