{ <EOL> return typeAsString <EOL> }


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


{ <EOL> class A <EOL> fun A . foo ( ) = "<STR_LIT:OK>" <EOL> return ( A :: foo ) . let { c -> c ( ( :: A ) . let { it ( ) } ) } <EOL> }


@ PublishedApi internal fun NonNullNativePtr . toNativePtr ( )

= this


internal fun NativePtr . toNonNull ( ) : NonNullNativePtr

= this


@ Deprecated ( "<STR_LIT>" ) <EOL> @ Suppress ( "<STR_LIT>" ) <EOL> inline fun < reified T : CVariable > typeOf ( )

= <EOL> @ Suppress ( "<STR_LIT:DEPRECATION>" ) <EOL> typeOfCache . getOrPut ( T :: class . java ) { T :: class . companionObjectInstance as CVariable . Type }


@ Suppress ( "<STR_LIT>" ) <EOL> inline fun < reified T : NativePointed > interpretNullablePointed ( ptr : NativePtr ) : T ?

{ <EOL> if ( ptr == nativeNullPtr ) { <EOL> return null <EOL> } else { <EOL> val result = nativeMemUtils . allocateInstance < T > ( ) <EOL> result . rawPtr = ptr <EOL> return result <EOL> } <EOL> }

/**
 * Returns interpretation of entity with given pointer, or `null` if it is null.
 *
 * @param T must not be abstract
 */


fun < T : CPointed > interpretCPointer ( rawValue : NativePtr )

= <EOL> if ( rawValue == nativeNullPtr ) { <EOL> null <EOL> } else { <EOL> CPointer < T > ( rawValue ) <EOL> }

/**
 * Creates a [CPointer] from the raw pointer of [NativePtr].
 *
 * @return a [CPointer] representation, or `null` if the [rawValue] represents native `nullptr`.
 */


internal fun CPointer < * > . cPointerToString ( )

= "<STR_LIT>" . format ( rawValue )


override fun createEnvironment ( ) : KotlinCoreEnvironment

{ <EOL> return createEnvironmentWithJdk ( ConfigurationKind . ALL , TestJdkKind . FULL_JDK ) <EOL> }


@ OptIn ( ObsoleteTestInfrastructure :: class ) <EOL> fun testBuiltInPackagesContent ( )

{ <EOL> val moduleDescriptor = BuiltinsTestUtils . compileBuiltinsModule ( environment ) <EOL> val session = FirTestSessionFactoryHelper . createSessionForTests ( environment . toAbstractProjectEnvironment ( ) , GlobalSearchScope . allScope ( project ) . toAbstractProjectFileSearchScope ( ) ) <EOL> for ( packageFqName in BuiltinsTestUtils . BUILTIN_PACKAGE_NAMES ) { <EOL> val path = "<STR_LIT>" + packageFqName . asString ( ) . replace ( '<CHAR_LIT:.>' , '<CHAR_LIT:->' ) + "<STR_LIT>" <EOL> checkPackageContent ( session , packageFqName , moduleDescriptor , path ) <EOL> } <EOL> }


inline fun inlineCall ( action : ( complete : ( ) -> Unit ) -> Unit )

{ <EOL> action { <EOL> bar += "<STR_LIT:K>" <EOL> } <EOL> }


{ <EOL> inlineCall { <EOL> bar += "<STR_LIT:O>" <EOL> it ( ) <EOL> } <EOL> }


{ <EOL> val foo = Foo ( ) <EOL> foo . start ( ) <EOL> }


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) fun TestBasicReverse ( )


fun TestIdenticalReturnTypes ( ) : TestIdenticalReturnTypes

= TestIdenticalReturnTypes ( )


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) fun TestIdenticalReturnTypesReverse ( ) : TestIdenticalReturnTypesReverse

= TestIdenticalReturnTypesReverse ( )


inline fun < reified T > TestFunctionWithReifiedTypeParameterVsConstructorA ( )


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) inline fun < reified T > TestFunctionWithReifiedTypeParameterVsConstructorAReverse ( )


inline fun < reified T > TestFunctionWithReifiedTypeParameterVsConstructorB ( arg : T )


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) inline fun < reified T > TestFunctionWithReifiedTypeParameterVsConstructorBReverse ( arg : T )


inline fun < reified T > TestFunctionWithReifiedTypeParameterVsConstructorC ( arg : Invariant < T > )


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) inline fun < reified T > TestFunctionWithReifiedTypeParameterVsConstructorCReverse ( arg : Invariant < T > )


inline fun TestInlineFunctionVsConstructor ( )


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) inline fun TestInlineFunctionVsConstructorReverse ( )


tailrec fun TestTailrecFunctionVsConstructor ( )


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) tailrec fun TestTailrecFunctionVsConstructorReverse ( )


fun TestFunctionVsPrimaryConstructor ( )


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) fun TestFunctionVsPrimaryConstructorReverse ( )


fun TestFunctionVsDelegatedPrimaryConstructorCall ( )


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) fun TestFunctionVsDelegatedPrimaryConstructorCallReverse ( )


fun TestFunctionVsDelegatedSuperConstructorCall ( )


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) fun TestFunctionVsDelegatedSuperConstructorCallReverse ( )


fun TestIdenticalValueParameters ( arg : UserKlass )


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) fun TestIdenticalValueParametersReverse ( arg : UserKlass )


fun TestDifferentlyNamedValueParameters ( argB : UserKlass )


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) fun TestDifferentlyNamedValueParametersReverse ( argB : UserKlass )


fun TestTypeAliasedValueParameterTypesA ( arg : SameUserKlass )


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) fun TestTypeAliasedValueParameterTypesAReverse ( arg : SameUserKlass )


fun TestTypeAliasedValueParameterTypesB ( arg : UserKlass )


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) fun TestTypeAliasedValueParameterTypesBReverse ( arg : UserKlass )


fun TestMultipleIdenticalValueParameters ( arg1 : UserKlassA , arg2 : UserKlassB )


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) fun TestMultipleIdenticalValueParametersReverse ( arg1 : UserKlassA , arg2 : UserKlassB )


fun TestMultipleDifferentlyNamedValueParametersA ( arg1 : UserKlassA , arg2B : UserKlassB )


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) fun TestMultipleDifferentlyNamedValueParametersAReverse ( arg1 : UserKlassA , arg2B : UserKlassB )


fun TestMultipleDifferentlyNamedValueParametersB ( arg1B : UserKlassA , arg2B : UserKlassB )


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) fun TestMultipleDifferentlyNamedValueParametersBReverse ( arg1B : UserKlassA , arg2B : UserKlassB )


fun TestMultipleTypeAliasedValueParameterTypesA ( arg1 : UserKlassA , arg2 : SameUserKlassB )


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) fun TestMultipleTypeAliasedValueParameterTypesAReverse ( arg1 : UserKlassA , arg2 : SameUserKlassB )


fun TestMultipleTypeAliasedValueParameterTypesB ( arg1 : SameUserKlassA , arg2 : SameUserKlassB )


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) fun TestMultipleTypeAliasedValueParameterTypesBReverse ( arg1 : SameUserKlassA , arg2 : SameUserKlassB )


fun < T > TestIdenticalTypeParametersA ( )


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) fun < T > TestIdenticalTypeParametersAReverse ( )


fun < T > TestIdenticalTypeParametersB ( arg : T )


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) fun < T > TestIdenticalTypeParametersBReverse ( arg : T )


fun < T > TestIdenticalTypeParametersC ( arg : Invariant < T > )


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) fun < T > TestIdenticalTypeParametersCReverse ( arg : Invariant < T > )


fun < T1 , T2 > TestMultipleIdenticalTypeParameters ( )


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) fun < T1 , T2 > TestMultipleIdenticalTypeParametersReverse ( )


fun < T : UserInterface > TestTypeParameterWithIdenticalUpperBoundsA ( )


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) fun < T : UserInterface > TestTypeParameterWithIdenticalUpperBoundsAReverse ( )


fun < T : UserInterface > TestTypeParameterWithIdenticalUpperBoundsB ( arg : T )


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) fun < T : UserInterface > TestTypeParameterWithIdenticalUpperBoundsBReverse ( arg : T )


fun < T : UserInterface > TestTypeParameterWithIdenticalUpperBoundsC ( arg : Invariant < T > )


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) fun < T : UserInterface > TestTypeParameterWithIdenticalUpperBoundsCReverse ( arg : Invariant < T > )


fun < T > TestTypeParameterWithMultipleIdenticalUpperBoundsAA ( ) where T : UserInterfaceA , T : UserInterfaceB


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) fun < T > TestTypeParameterWithMultipleIdenticalUpperBoundsAAReverse ( ) where T : UserInterfaceA , T : UserInterfaceB


fun < T > TestTypeParameterWithMultipleIdenticalUpperBoundsAB ( arg : T ) where T : UserInterfaceA , T : UserInterfaceB


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) fun < T > TestTypeParameterWithMultipleIdenticalUpperBoundsABReverse ( arg : T ) where T : UserInterfaceA , T : UserInterfaceB


fun < T > TestTypeParameterWithMultipleIdenticalUpperBoundsAC ( arg : Invariant < T > ) where T : UserInterfaceA , T : UserInterfaceB


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) fun < T > TestTypeParameterWithMultipleIdenticalUpperBoundsACReverse ( arg : Invariant < T > ) where T : UserInterfaceA , T : UserInterfaceB


fun < T : UserInterfaceA > TestTypeParameterWithMultipleIdenticalUpperBoundsBA ( ) where T : UserInterfaceB


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) fun < T : UserInterfaceA > TestTypeParameterWithMultipleIdenticalUpperBoundsBAReverse ( ) where T : UserInterfaceB


fun < T : UserInterfaceA > TestTypeParameterWithMultipleIdenticalUpperBoundsBB ( arg : T ) where T : UserInterfaceB


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) fun < T : UserInterfaceA > TestTypeParameterWithMultipleIdenticalUpperBoundsBBReverse ( arg : T ) where T : UserInterfaceB


fun < T : UserInterfaceA > TestTypeParameterWithMultipleIdenticalUpperBoundsBC ( arg : Invariant < T > ) where T : UserInterfaceB


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) fun < T : UserInterfaceA > TestTypeParameterWithMultipleIdenticalUpperBoundsBCReverse ( arg : Invariant < T > ) where T : UserInterfaceB


private fun TestIdenticalPrivateVisibility ( )


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) private fun TestIdenticalPrivateVisibilityReverse ( )


internal fun TestIdenticalInternalVisibility ( )


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) internal fun TestIdenticalInternalVisibilityReverse ( )


public fun TestDifferencesInPrivateAndPublicVisibilitiesA ( )


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) public fun TestDifferencesInPrivateAndPublicVisibilitiesAReverse ( )


private fun TestDifferencesInPrivateAndPublicVisibilitiesB ( )


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) private fun TestDifferencesInPrivateAndPublicVisibilitiesBReverse ( )


public fun TestDifferencesInInternalAndPublicVisibilitiesA ( )


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) public fun TestDifferencesInInternalAndPublicVisibilitiesAReverse ( )


internal fun TestDifferencesInInternalAndPublicVisibilitiesB ( )


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) internal fun TestDifferencesInInternalAndPublicVisibilitiesBReverse ( )


internal fun TestDifferencesInPrivateAndInternalVisibilitiesA ( )


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) internal fun TestDifferencesInPrivateAndInternalVisibilitiesAReverse ( )


private fun TestDifferencesInPrivateAndInternalVisibilitiesB ( )


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) private fun TestDifferencesInPrivateAndInternalVisibilitiesBReverse ( )


= value ! !


operator fun set ( index : Int , value : T )

{ this . value = value }


{ <EOL> val list = MyList < Int > ( ) <EOL> list [ <NUM_LIT> ] = <NUM_LIT:1> <EOL> list [ <NUM_LIT> ] = list [ <NUM_LIT> ] ++ <EOL> return "<STR_LIT:OK>" <EOL> }


@ JvmStatic <EOL> fun typedArraysEnabled ( config : JsConfig )

= config . configuration . get ( JSConfigurationKeys . TYPED_ARRAYS_ENABLED , true )


fun unsignedPrimitiveToSigned ( type : KotlinType ) : PrimitiveType ?

{ <EOL> if ( ! type . isInlineClassType ( ) || type . isMarkedNullable ) return null <EOL> return when { <EOL> KotlinBuiltIns . isUByte ( type ) -> BYTE <EOL> KotlinBuiltIns . isUShort ( type ) -> SHORT <EOL> KotlinBuiltIns . isUInt ( type ) -> INT <EOL> KotlinBuiltIns . isULong ( type ) -> LONG <EOL> else -> null <EOL> } <EOL> }


fun castOrCreatePrimitiveArray ( ctx : TranslationContext , type : KotlinType , arg : JsArrayLiteral ) : JsExpression

{ <EOL> if ( type . isMarkedNullable ) return arg <EOL> val unsignedPrimitiveType = unsignedPrimitiveToSigned ( type ) <EOL> if ( unsignedPrimitiveType != null ) { <EOL> val conversionFunction = "<STR_LIT>" <EOL> arg . expressions . replaceAll { JsInvocation ( JsNameRef ( conversionFunction , it ) ) } <EOL> } <EOL> val primitiveType = unsignedPrimitiveType ? : KotlinBuiltIns . getPrimitiveType ( type ) ? . takeUnless { type . isMarkedNullable } <EOL> if ( primitiveType == null || ! typedArraysEnabled ( ctx . config ) ) return arg <EOL> return if ( primitiveType in TYPED_ARRAY_MAP ) { <EOL> createTypedArray ( primitiveType , arg ) <EOL> } <EOL> else { <EOL> JsAstUtils . invokeKotlinFunction ( primitiveType . lowerCaseName + "<STR_LIT>" , * arg . expressions . toTypedArray ( ) ) <EOL> } <EOL> }


private fun createTypedArray ( type : PrimitiveType , arg : JsExpression ) : JsExpression

{ <EOL> assert ( type in TYPED_ARRAY_MAP ) <EOL> return JsNew ( JsNameRef ( TYPED_ARRAY_MAP [ type ] + "<STR_LIT>" ) , listOf ( arg ) ) <EOL> }


fun getTag ( descriptor : CallableDescriptor , config : JsConfig ) : String ?

{ <EOL> if ( descriptor !is ConstructorDescriptor ) return null <EOL> val constructedClass = descriptor . constructedClass <EOL> if ( ! KotlinBuiltIns . isArrayOrPrimitiveArray ( constructedClass ) ) return null <EOL> if ( descriptor . valueParameters . size != <NUM_LIT:2> ) return null <EOL> val ( sizeParam , functionParam ) = descriptor . valueParameters <EOL> if ( ! KotlinBuiltIns . isInt ( sizeParam . type ) || ! functionParam . type . isBuiltinFunctionalType ) return null <EOL> if ( functionParam . type . getValueParameterTypesFromFunctionType ( ) . size != <NUM_LIT:1> ) return null <EOL> val primitiveType = KotlinBuiltIns . getPrimitiveArrayElementType ( constructedClass . defaultType ) <EOL> return if ( typedArraysEnabled ( config ) && primitiveType != null ) { <EOL> if ( primitiveType in TYPED_ARRAY_MAP ) { <EOL> "<STR_LIT>" <EOL> } <EOL> else { <EOL> "<STR_LIT>" <EOL> } <EOL> } <EOL> else { <EOL> if ( primitiveType == CHAR ) { <EOL> "<STR_LIT>" <EOL> } <EOL> else { <EOL> "<STR_LIT>" <EOL> } <EOL> } <EOL> }


private fun createConstructorIntrinsic ( type : PrimitiveType ? ) : FunctionIntrinsic

{ <EOL> return intrinsify { callInfo , arguments , context -> <EOL> assert ( arguments . size == <NUM_LIT:2> ) { "<STR_LIT>" } <EOL> val ( size , fn ) = arguments <EOL> val invocation = if ( typedArraysEnabled ( context . config ) && type != null ) { <EOL> if ( type in TYPED_ARRAY_MAP ) { <EOL> JsAstUtils . invokeKotlinFunction ( "<STR_LIT>" , createTypedArray ( type , size ) , fn ) <EOL> } <EOL> else { <EOL> JsAstUtils . invokeKotlinFunction ( "<STR_LIT>" , size , fn ) <EOL> } <EOL> } <EOL> else { <EOL> JsAstUtils . invokeKotlinFunction ( if ( type == CHAR ) "<STR_LIT>" else "<STR_LIT>" , size , fn ) <EOL> } <EOL> invocation . isInline = true <EOL> val descriptor = callInfo . resolvedCall . resultingDescriptor . original <EOL> val resolvedDescriptor = when ( descriptor ) { <EOL> is TypeAliasConstructorDescriptor -> descriptor . underlyingConstructorDescriptor <EOL> else -> descriptor <EOL> } <EOL> invocation . descriptor = resolvedDescriptor <EOL> context . addInlineCall ( resolvedDescriptor ) <EOL> invocation <EOL> } <EOL> }


private fun intrinsify ( f : ( callInfo : CallInfo , arguments : List < JsExpression > , context : TranslationContext ) -> JsExpression ) <EOL>

= object : FunctionIntrinsic ( ) { <EOL> override fun apply ( callInfo : CallInfo , arguments : List < JsExpression > , context : TranslationContext ) : JsExpression { <EOL> return f ( callInfo , arguments , context ) <EOL> } <EOL> }


@ OptIn ( KspExperimental :: class ) <EOL> internal fun renderExtensions ( declaration : KSClassDeclaration , interfaceName : String , visibility : MarkerVisibility , properties : List < Property > , ) : String

{ <EOL> val generator = ExtensionsCodeGenerator . create ( ) <EOL> val typeArguments = declaration . typeParameters . map { <EOL> it . name . asString ( ) <EOL> } <EOL> val typeParameters = declaration . typeParameters . map { <EOL> buildString { <EOL> append ( it . name . asString ( ) ) <EOL> val bounds = it . bounds . toList ( ) <EOL> if ( bounds . isNotEmpty ( ) ) { <EOL> append ( "<STR_LIT>" ) <EOL> append ( bounds . joinToString ( "<STR_LIT:U+002C>" ) { it . resolve ( ) . render ( ) } ) <EOL> } <EOL> } <EOL> } <EOL> return generator . generate ( object : AbstractMarker ( typeParameters , typeArguments ) { <EOL> override val name : String = interfaceName <EOL> override val fields : List < BaseField > = properties . map { <EOL> val type = it . propertyType . resolve ( ) <EOL> val qualifiedTypeReference = getQualifiedTypeReference ( type ) <EOL> val fieldType = when { <EOL> qualifiedTypeReference == "<STR_LIT>" && type . singleTypeArgumentIsDataSchema ( ) || <EOL> qualifiedTypeReference == DataFrameNames . DATA_FRAME -> <EOL> FieldType . FrameFieldType ( markerName = type . renderTypeArguments ( ) , nullable = type . isMarkedNullable , ) <EOL> type . declaration . isAnnotationPresent ( DataSchema :: class ) -> FieldType . GroupFieldType ( type . render ( ) ) <EOL> qualifiedTypeReference == DataFrameNames . DATA_ROW -> FieldType . GroupFieldType ( type . renderTypeArguments ( ) ) <EOL> else -> FieldType . ValueFieldType ( type . render ( ) ) <EOL> } <EOL> BaseFieldImpl ( fieldName = ValidFieldName . of ( it . fieldName ) , columnName = it . columnName , fieldType = fieldType ) <EOL> } <EOL> override val visibility : MarkerVisibility = visibility <EOL> } ) . declarations <EOL> }


private fun getQualifiedTypeReference ( type : KSType )

= when ( val declaration = type . declaration ) { <EOL> is KSTypeParameter -> declaration . name . getShortName ( ) <EOL> else -> declaration . getQualifiedNameOrThrow ( ) <EOL> }


@ OptIn ( KspExperimental :: class ) <EOL> private fun KSType . singleTypeArgumentIsDataSchema ( )

= <EOL> innerArguments . singleOrNull ( ) ? . type ? . resolve ( ) ? . declaration ? . isAnnotationPresent ( DataSchema :: class ) ? : false


private fun KSType . render ( ) : String

{ <EOL> val fqTypeReference = getQualifiedTypeReference ( this ) <EOL> return buildString { <EOL> append ( fqTypeReference ) <EOL> if ( innerArguments . isNotEmpty ( ) ) { <EOL> append ( "<STR_LIT:<>" ) <EOL> append ( renderTypeArguments ( ) ) <EOL> append ( "<STR_LIT:>>" ) <EOL> } <EOL> if ( isMarkedNullable ) { <EOL> append ( "<STR_LIT:?>" ) <EOL> } <EOL> } <EOL> }


private fun KSType . renderTypeArguments ( ) : String

= innerArguments . joinToString ( "<STR_LIT:U+002CU+0020>" ) { render ( it ) }


private fun render ( typeArgument : KSTypeArgument ) : String

{ <EOL> return when ( val variance = typeArgument . variance ) { <EOL> Variance . STAR -> variance . label <EOL> Variance . INVARIANT , Variance . COVARIANT , Variance . CONTRAVARIANT -> buildString { <EOL> append ( variance . label ) <EOL> if ( variance . label . isNotEmpty ( ) ) { <EOL> append ( "<STR_LIT:U+0020>" ) <EOL> } <EOL> append ( typeArgument . type ? . resolve ( ) ? . render ( ) ? : error ( "<STR_LIT>" ) ) <EOL> } <EOL> } <EOL> }


fun ConeClassifierLookupTag . toSymbol ( useSiteSession : FirSession ) : FirClassifierSymbol < * > ?

= <EOL> when ( this ) { <EOL> is ConeClassLikeLookupTag -> toSymbol ( useSiteSession ) <EOL> is ConeClassifierLookupTagWithFixedSymbol -> this . symbol <EOL> else -> error ( "<STR_LIT>" ) <EOL> }

/**
 * Main operation on the [ConeClassifierLookupTag]
 *
 * Lookups the tag into its target within the given [useSiteSession]
 *
 * The second step of type refinement, see `/docs/fir/k2_kmp.md`
 *
 * @see ConeClassifierLookupTag
 */


@ OptIn ( LookupTagInternals :: class ) <EOL> fun ConeClassLikeLookupTag . toSymbol ( useSiteSession : FirSession ) : FirClassLikeSymbol < * > ?

{ <EOL> if ( this is ConeClassLookupTagWithFixedSymbol ) { <EOL> return this . symbol <EOL> } <EOL> ( this as? ConeClassLikeLookupTagImpl ) ? . boundSymbol ? . takeIf { it . first === useSiteSession } ? . let { return it . second } <EOL> return useSiteSession . symbolProvider . getClassLikeSymbolByClassId ( classId ) . also { <EOL> ( this as? ConeClassLikeLookupTagImpl ) ? . bindSymbolToLookupTag ( useSiteSession , it ) <EOL> } <EOL> }


fun ConeClassLikeLookupTag . toClassSymbol ( session : FirSession ) : FirClassSymbol < * > ?

= <EOL> toSymbol ( session ) as? FirClassSymbol < * >


fun ConeClassLikeLookupTag . toFirRegularClassSymbol ( session : FirSession ) : FirRegularClassSymbol ?

= <EOL> toSymbol ( session ) as? FirRegularClassSymbol


fun FirClassLikeSymbol < * > . getClassAndItsOuterClassesWhenLocal ( session : FirSession ) : Set < FirClassLikeSymbol < * > >

= <EOL> generateSequence ( this . takeIf { it . isLocal } ) { <EOL> if ( it . isInner ) it . getContainingClassLookupTag ( ) ? . toFirRegularClassSymbol ( session ) else null <EOL> } . toSet ( )


@ OptIn ( LookupTagInternals :: class ) <EOL> fun ConeClassLikeLookupTagImpl . bindSymbolToLookupTag ( session : FirSession , symbol : FirClassLikeSymbol < * > ? )

{ <EOL> boundSymbol = WeakPair ( session , symbol ) <EOL> }


@ SymbolInternals <EOL> fun ConeClassLikeLookupTag . toFirRegularClass ( session : FirSession ) : FirRegularClass ?

= toFirRegularClassSymbol ( session ) ? . fir


fun FirSymbolProvider . getSymbolByLookupTag ( lookupTag : ConeClassifierLookupTag ) : FirClassifierSymbol < * > ?

{ <EOL> return lookupTag . toSymbol ( session ) <EOL> }


fun FirSymbolProvider . getSymbolByLookupTag ( lookupTag : ConeClassLikeLookupTag ) : FirClassLikeSymbol < * > ?


fun ConeKotlinType . withParameterNameAnnotation ( parameter : FirFunctionTypeParameter , session : FirSession ) : ConeKotlinType

{ <EOL> val name = parameter . name <EOL> if ( name == null || name == SpecialNames . NO_NAME_PROVIDED || name == SpecialNames . UNDERSCORE_FOR_UNUSED_VAR ) return this <EOL> if ( attributes . customAnnotations . getAnnotationsByClassId ( StandardNames . FqNames . parameterNameClassId , session ) . isNotEmpty ( ) ) return this <EOL> val fakeSource = parameter . source ? . fakeElement ( KtFakeSourceElementKind . ParameterNameAnnotationCall ) <EOL> val parameterNameAnnotationCall = buildAnnotation { <EOL> source = fakeSource <EOL> annotationTypeRef = <EOL> buildResolvedTypeRef { <EOL> source = fakeSource <EOL> type = ConeClassLikeTypeImpl ( StandardNames . FqNames . parameterNameClassId . toLookupTag ( ) , emptyArray ( ) , isNullable = false ) <EOL> } <EOL> argumentMapping = buildAnnotationArgumentMapping { <EOL> mapping [ StandardClassIds . Annotations . ParameterNames . parameterNameName ] = <EOL> buildLiteralExpression ( fakeSource , ConstantValueKind . String , name . asString ( ) , setType = true ) <EOL> } <EOL> } <EOL> val attributesWithParameterNameAnnotation = <EOL> ConeAttributes . create ( listOf ( CustomAnnotationTypeAttribute ( listOf ( parameterNameAnnotationCall ) ) ) ) <EOL> return withCombinedAttributesFrom ( attributesWithParameterNameAnnotation ) <EOL> }


fun ConeKotlinType . withCombinedAttributesFrom ( other : ConeKotlinType ) : ConeKotlinType

= <EOL> withCombinedAttributesFrom ( other . attributes )


private fun ConeKotlinType . withCombinedAttributesFrom ( other : ConeAttributes ) : ConeKotlinType

{ <EOL> if ( other . isEmpty ( ) ) return this <EOL> val combinedConeAttributes = attributes . add ( other ) <EOL> return withAttributes ( combinedConeAttributes ) <EOL> }


fun ConeKotlinType . findClassRepresentation ( dispatchReceiverParameterType : ConeKotlinType , session : FirSession ) : ConeClassLikeLookupTag ?

= <EOL> when ( this ) { <EOL> is ConeClassLikeType -> this . fullyExpandedType ( session ) . lookupTag <EOL> is ConeDynamicType -> upperBound . findClassRepresentation ( dispatchReceiverParameterType , session ) <EOL> is ConeFlexibleType -> lowerBound . findClassRepresentation ( dispatchReceiverParameterType , session ) <EOL> is ConeCapturedType -> constructor . supertypes . orEmpty ( ) <EOL> . findClassRepresentationThatIsSubtypeOf ( dispatchReceiverParameterType , session ) <EOL> is ConeDefinitelyNotNullType -> original . findClassRepresentation ( dispatchReceiverParameterType , session ) <EOL> is ConeIntegerLiteralType -> possibleTypes . findClassRepresentationThatIsSubtypeOf ( dispatchReceiverParameterType , session ) <EOL> is ConeIntersectionType -> intersectedTypes . findClassRepresentationThatIsSubtypeOf ( dispatchReceiverParameterType , session ) <EOL> is ConeTypeParameterType -> lookupTag . findClassRepresentationThatIsSubtypeOf ( dispatchReceiverParameterType , session ) <EOL> is ConeTypeVariableType -> ( this . typeConstructor . originalTypeParameter as? ConeTypeParameterLookupTag ) <EOL> ? . findClassRepresentationThatIsSubtypeOf ( dispatchReceiverParameterType , session ) <EOL> is ConeStubType -> ( this . constructor . variable . typeConstructor . originalTypeParameter as? ConeTypeParameterLookupTag ) <EOL> ? . findClassRepresentationThatIsSubtypeOf ( dispatchReceiverParameterType , session ) <EOL> is ConeLookupTagBasedType -> null <EOL> }


private fun ConeTypeParameterLookupTag . findClassRepresentationThatIsSubtypeOf ( supertype : ConeKotlinType , session : FirSession ) : ConeClassLikeLookupTag ?

= <EOL> typeParameterSymbol . resolvedBounds . map { it . coneType } . findClassRepresentationThatIsSubtypeOf ( supertype , session )


private fun Collection < ConeKotlinType > . findClassRepresentationThatIsSubtypeOf ( supertype : ConeKotlinType , session : FirSession ) : ConeClassLikeLookupTag ?

{ <EOL> val supertypeLowerBound = supertype . lowerBoundIfFlexible ( ) <EOL> val compatibleComponent = this . firstOrNull { <EOL> it . isSubtypeOf ( supertypeLowerBound , session ) <EOL> } ? : return null <EOL> return compatibleComponent . findClassRepresentation ( supertypeLowerBound , session ) <EOL> }


fun KtExpression . getKotlinTypeForComparison ( bindingContext : BindingContext ) : KotlinType ?

= <EOL> when { <EOL> this is KtProperty -> bindingContext [ BindingContext . VARIABLE , this ] ? . type <EOL> else -> bindingContext . getType ( this ) <EOL> }


fun KtExpression ? . getKotlinTypeWithPossibleSmartCastToFP ( bindingContext : BindingContext , descriptor : DeclarationDescriptor ? , languageVersionSettings : LanguageVersionSettings , dataFlowValueFactory : DataFlowValueFactory , defaultType : ( KotlinType , Set < KotlinType > ) -> KotlinType = { givenType , _ -> givenType } ) : KotlinType ?

{ <EOL> val givenType = this ? . getKotlinTypeForComparison ( bindingContext ) ? : return null <EOL> if ( KotlinBuiltIns . isDoubleOrNullableDouble ( givenType ) ) { <EOL> return givenType <EOL> } <EOL> if ( KotlinBuiltIns . isFloatOrNullableFloat ( givenType ) ) { <EOL> return givenType <EOL> } <EOL> if ( descriptor != null ) { <EOL> val dataFlow = dataFlowValueFactory . createDataFlowValue ( this , givenType , bindingContext , descriptor ) <EOL> val stableTypes = bindingContext . getDataFlowInfoBefore ( this ) . getStableTypes ( dataFlow , languageVersionSettings ) <EOL> return stableTypes . firstNotNullOfOrNull { <EOL> when { <EOL> KotlinBuiltIns . isDoubleOrNullableDouble ( it ) -> it <EOL> KotlinBuiltIns . isFloatOrNullableFloat ( it ) -> it <EOL> else -> null <EOL> } <EOL> } ? : defaultType ( givenType , stableTypes ) <EOL> } <EOL> return givenType <EOL> }


{ <EOL> try { <EOL> foo ( ) as Int ? <EOL> } <EOL> catch ( e : ClassCastException ) { <EOL> return "<STR_LIT:OK>" <EOL> } <EOL> catch ( e : Throwable ) { <EOL> return "<STR_LIT>" <EOL> } <EOL> return "<STR_LIT>" <EOL> }


= "<STR_LIT>"


= this


{ <EOL> assertEquals ( "<STR_LIT:foo>" , :: foo . name ) <EOL> assertEquals ( "<STR_LIT:bar>" , A :: bar . name ) <EOL> assertEquals ( "<STR_LIT:baz>" , Int :: baz . name ) <EOL> return "<STR_LIT:OK>" <EOL> }


override fun isOverridable ( superDescriptor : CallableDescriptor , subDescriptor : CallableDescriptor , subClassDescriptor : ClassDescriptor ? <EOL> ) : Result

{ <EOL> if ( subDescriptor !is JavaMethodDescriptor || subDescriptor . typeParameters . isNotEmpty ( ) ) return Result . UNKNOWN <EOL> val basicOverridability = OverridingUtil . getBasicOverridabilityProblem ( superDescriptor , subDescriptor ) ? . result <EOL> if ( basicOverridability != null ) return Result . UNKNOWN <EOL> val signatureTypes = subDescriptor . valueParameters . asSequence ( ) . map { it . type } + <EOL> subDescriptor . returnType ! ! + <EOL> listOfNotNull ( subDescriptor . extensionReceiverParameter ? . type ) <EOL> if ( signatureTypes . any { it . arguments . isNotEmpty ( ) && it . unwrap ( ) !is RawTypeImpl } ) return Result . UNKNOWN <EOL> var erasedSuper = superDescriptor . substitute ( RawSubstitution ( ) . buildSubstitutor ( ) ) ? : return Result . UNKNOWN <EOL> if ( erasedSuper is SimpleFunctionDescriptor && erasedSuper . typeParameters . isNotEmpty ( ) ) { <EOL> erasedSuper = erasedSuper . newCopyBuilder ( ) . setTypeParameters ( emptyList ( ) ) . build ( ) ! ! <EOL> } <EOL> val overridabilityResult = <EOL> OverridingUtil . DEFAULT . isOverridableByWithoutExternalConditions ( erasedSuper , subDescriptor , false ) . result <EOL> return when ( overridabilityResult ) { <EOL> OverridingUtil . OverrideCompatibilityInfo . Result . OVERRIDABLE -> Result . OVERRIDABLE <EOL> else -> Result . UNKNOWN <EOL> } <EOL> }


= ExternalOverridabilityCondition . Contract . SUCCESS_ONLY


= UserKlass ( ) as CT


fun < FT > build ( instructions : Buildee < FT > . ( ) -> Unit ) : Buildee < FT >

{ <EOL> return Buildee < FT > ( ) . apply ( instructions ) <EOL> }


{ <EOL> val arg : T & Any = UserKlass ( ) as ( T & Any ) <EOL> val buildee = build { <EOL> yield ( arg ) <EOL> } <EOL> checkExactType < Buildee < T & Any > > ( buildee ) <EOL> }


{ <EOL> fun consume ( arg : T & Any ) { } <EOL> val buildee = build { <EOL> consume ( materialize ( ) ) <EOL> } <EOL> checkExactType < Buildee < T & Any > > ( buildee ) <EOL> }


{ <EOL> with ( Context < UserKlass ? > ( ) ) { <EOL> testYield ( ) <EOL> testMaterialize ( ) <EOL> } <EOL> return "<STR_LIT:OK>" <EOL> }


{ <EOL> val t = java . lang . String . copyValueOf ( java . lang . String ( "<STR_LIT:s>" ) . toCharArray ( ) ) <EOL> val i = java . lang . Integer . MAX_VALUE <EOL> val j = java . lang . Integer . valueOf ( <NUM_LIT> ) <EOL> val s = java . lang . String . valueOf ( <NUM_LIT:1> ) <EOL> val l = java . util . Collections . emptyList < Int > ( ) <EOL> return "<STR_LIT:OK>" <EOL> }


{ <EOL> if ( x > <NUM_LIT:0> ) { <EOL> return <NUM_LIT:1> + withoutAnnotation ( x - <NUM_LIT:1> ) <EOL> } <EOL> return <NUM_LIT:0> <EOL> }


{ <EOL> val r = withoutAnnotation ( <NUM_LIT:10> ) <EOL> if ( r == <NUM_LIT:10> ) return "<STR_LIT:OK>" <EOL> return "<STR_LIT>" <EOL> }


internal fun insertImplicitCasts ( file : IrFile , context : GeneratorContext )

{ <EOL> InsertImplicitCasts ( context . irBuiltIns , context . typeTranslator , context . callToSubstitutedDescriptorMap , context . extensions , context . symbolTable , file , ) . run ( file ) <EOL> }


{ <EOL> element . transformChildrenVoid ( this ) <EOL> postprocessReturnExpressions ( element ) <EOL> }


private fun postprocessReturnExpressions ( element : IrElement )

{ <EOL> element . acceptChildrenVoid ( object : IrElementVisitorVoid { <EOL> override fun visitReturn ( expression : IrReturn ) { <EOL> super . visitReturn ( expression ) <EOL> val expectedReturnType = expectedFunctionExpressionReturnType [ expression . returnTargetSymbol . descriptor ] ? : return <EOL> expression . value = expression . value . cast ( expectedReturnType ) <EOL> } <EOL> override fun visitClass ( declaration : IrClass ) { <EOL> typeTranslator . buildWithScope ( declaration ) { <EOL> super . visitClass ( declaration ) <EOL> } <EOL> } <EOL> override fun visitFunction ( declaration : IrFunction ) { <EOL> typeTranslator . buildWithScope ( declaration ) { <EOL> super . visitFunction ( declaration ) <EOL> } <EOL> } <EOL> override fun visitElement ( element : IrElement ) { <EOL> element . acceptChildrenVoid ( this ) <EOL> } <EOL> override fun visitCall ( expression : IrCall ) { <EOL> expression . acceptChildrenVoid ( this ) <EOL> } <EOL> } ) <EOL> }


= typeTranslator . translateType ( this )


override fun visitCallableReference ( expression : IrCallableReference < * > ) : IrExpression

{ <EOL> val substitutedDescriptor = expression . substitutedDescriptor <EOL> return expression . transformPostfix { <EOL> transformReceiverArguments ( substitutedDescriptor ) <EOL> } <EOL> }


private fun IrMemberAccessExpression < * > . transformReceiverArguments ( substitutedDescriptor : CallableDescriptor )

{ <EOL> dispatchReceiver = dispatchReceiver ? . cast ( getEffectiveDispatchReceiverType ( substitutedDescriptor ) ) <EOL> val extensionReceiverType = substitutedDescriptor . extensionReceiverParameter ? . type <EOL> val originalExtensionReceiverType = substitutedDescriptor . original . extensionReceiverParameter ? . type <EOL> extensionReceiver = extensionReceiver ? . cast ( extensionReceiverType , originalExtensionReceiverType ) <EOL> }


private fun getEffectiveDispatchReceiverType ( descriptor : CallableDescriptor ) : KotlinType ?

= <EOL> when { <EOL> descriptor !is CallableMemberDescriptor -> <EOL> null <EOL> descriptor . kind == CallableMemberDescriptor . Kind . FAKE_OVERRIDE -> { <EOL> val containingDeclaration = descriptor . containingDeclaration <EOL> if ( containingDeclaration !is ClassDescriptor ) <EOL> throw AssertionError ( "<STR_LIT>" ) <EOL> else <EOL> containingDeclaration . defaultType . replaceArgumentsWithStarProjections ( ) <EOL> } <EOL> else -> <EOL> descriptor . dispatchReceiverParameter ? . type <EOL> }


override fun visitMemberAccess ( expression : IrMemberAccessExpression < * > ) : IrExpression

{ <EOL> val substitutedDescriptor = expression . substitutedDescriptor <EOL> return expression . transformPostfix { <EOL> transformReceiverArguments ( substitutedDescriptor ) <EOL> for ( index in substitutedDescriptor . valueParameters . indices ) { <EOL> val irIndex = index + substitutedDescriptor . contextReceiverParameters . size <EOL> val argument = getValueArgument ( irIndex ) ? : continue <EOL> val parameterType = substitutedDescriptor . valueParameters [ index ] . type <EOL> val originalParameterType = substitutedDescriptor . original . valueParameters [ index ] . type <EOL> val expectedType = <EOL> if ( argument . isSamConversion ( ) && KotlinBuiltIns . isNothing ( parameterType ) ) <EOL> substitutedDescriptor . original . valueParameters [ index ] . type . replaceArgumentsWithNothing ( ) <EOL> else <EOL> parameterType <EOL> putValueArgument ( irIndex , argument . cast ( expectedType , originalExpectedType = originalParameterType ) ) <EOL> } <EOL> } <EOL> }


private fun IrExpression . isSamConversion ( ) : Boolean

= <EOL> this is IrTypeOperatorCall && operator == IrTypeOperator . SAM_CONVERSION


override fun visitBlockBody ( body : IrBlockBody ) : IrBody

= <EOL> body . transformPostfix { <EOL> statements . forEachIndexed { i , irStatement -> <EOL> if ( irStatement is IrExpression ) { <EOL> body . statements [ i ] = irStatement . coerceToUnit ( ) <EOL> } <EOL> } <EOL> }


override fun visitContainerExpression ( expression : IrContainerExpression ) : IrExpression

= <EOL> expression . transformPostfix { <EOL> if ( statements . isEmpty ( ) ) return this <EOL> val lastIndex = statements . lastIndex <EOL> statements . forEachIndexed { i , irStatement -> <EOL> if ( irStatement is IrExpression ) { <EOL> statements [ i ] = <EOL> if ( i == lastIndex ) <EOL> irStatement . cast ( type ) <EOL> else <EOL> irStatement . coerceToUnit ( ) <EOL> } <EOL> } <EOL> }


override fun visitReturn ( expression : IrReturn ) : IrExpression

= <EOL> expression . transformPostfix { <EOL> value = if ( expression . returnTargetSymbol is IrConstructorSymbol ) { <EOL> value . coerceToUnit ( ) <EOL> } else { <EOL> value . cast ( expression . returnTargetSymbol . descriptor . returnType ) <EOL> } <EOL> }


override fun visitSetValue ( expression : IrSetValue ) : IrExpression

= <EOL> expression . transformPostfix { <EOL> value = value . cast ( expression . symbol . owner . type ) <EOL> }


override fun visitGetField ( expression : IrGetField ) : IrExpression

= <EOL> expression . transformPostfix { <EOL> receiver = receiver ? . cast ( getEffectiveDispatchReceiverType ( expression . substitutedDescriptor ) ) <EOL> }


override fun visitSetField ( expression : IrSetField ) : IrExpression

= <EOL> expression . transformPostfix { <EOL> val substituted = expression . substitutedDescriptor as PropertyDescriptor <EOL> receiver = receiver ? . cast ( getEffectiveDispatchReceiverType ( substituted ) ) <EOL> value = value . cast ( substituted . type ) <EOL> }


override fun visitVariable ( declaration : IrVariable ) : IrVariable

= <EOL> declaration . transformPostfix { <EOL> initializer = initializer ? . cast ( declaration . type ) <EOL> }


override fun visitField ( declaration : IrField ) : IrStatement

{ <EOL> return typeTranslator . withTypeErasure ( declaration . correspondingPropertySymbol ? . descriptor ? : declaration . descriptor ) { <EOL> declaration . transformPostfix { <EOL> initializer ? . coerceInnerExpression ( descriptor . type ) <EOL> } <EOL> } <EOL> }


override fun visitFunction ( declaration : IrFunction ) : IrStatement

= <EOL> typeTranslator . buildWithScope ( declaration ) { <EOL> declaration . transformPostfix { <EOL> valueParameters . forEach { <EOL> it . defaultValue ? . coerceInnerExpression ( it . descriptor . type ) <EOL> } <EOL> } <EOL> }


override fun visitClass ( declaration : IrClass ) : IrStatement

= <EOL> typeTranslator . buildWithScope ( declaration ) { <EOL> super . visitClass ( declaration ) <EOL> }


override fun visitWhen ( expression : IrWhen ) : IrExpression

= <EOL> expression . transformPostfix { <EOL> for ( irBranch in branches ) { <EOL> irBranch . condition = irBranch . condition . cast ( irBuiltIns . booleanType ) <EOL> irBranch . result = irBranch . result . cast ( type ) <EOL> } <EOL> }


override fun visitLoop ( loop : IrLoop ) : IrExpression

= <EOL> loop . transformPostfix { <EOL> condition = condition . cast ( irBuiltIns . booleanType ) <EOL> body = body ? . coerceToUnit ( ) <EOL> }


override fun visitThrow ( expression : IrThrow ) : IrExpression

= <EOL> expression . transformPostfix { <EOL> value = value . cast ( irBuiltIns . throwableType ) <EOL> }


override fun visitTry ( aTry : IrTry ) : IrExpression

= <EOL> aTry . transformPostfix { <EOL> tryResult = tryResult . cast ( type ) <EOL> for ( aCatch in catches ) { <EOL> aCatch . result = aCatch . result . cast ( type ) <EOL> } <EOL> finallyExpression = finallyExpression ? . coerceToUnit ( ) <EOL> }


override fun visitTypeOperator ( expression : IrTypeOperatorCall ) : IrExpression

= <EOL> when ( expression . operator ) { <EOL> IrTypeOperator . SAM_CONVERSION -> <EOL> expression . transformPostfix { <EOL> argument = argument . cast ( typeOperand . originalKotlinType ! ! . getSubstitutedFunctionTypeForSamType ( ) ) <EOL> } <EOL> IrTypeOperator . IMPLICIT_CAST -> { <EOL> expression . transformChildrenVoid ( ) <EOL> expression . argument . cast ( expression . typeOperand ) <EOL> } <EOL> else -> <EOL> super . visitTypeOperator ( expression ) <EOL> }


override fun visitVararg ( expression : IrVararg ) : IrExpression

= <EOL> expression . transformPostfix { <EOL> elements . forEachIndexed { i , element -> <EOL> when ( element ) { <EOL> is IrSpreadElement -> <EOL> element . expression = element . expression . cast ( expression . type ) <EOL> is IrExpression -> <EOL> putElement ( i , element . cast ( varargElementType ) ) <EOL> } <EOL> } <EOL> }


private fun IrExpressionBody . coerceInnerExpression ( expectedType : KotlinType )

{ <EOL> expression = expression . cast ( expectedType ) <EOL> }


private fun IrExpression . cast ( irType : IrType ) : IrExpression

= <EOL> cast ( irType . originalKotlinType )


private fun KotlinType . getFunctionReturnTypeOrNull ( ) : KotlinType ?

= <EOL> if ( isFunctionType || isSuspendFunctionType ) <EOL> arguments . last ( ) . type <EOL> else <EOL> null


private fun IrExpression . cast ( possiblyNonDenotableExpectedType : KotlinType ? , originalExpectedType : KotlinType ? = possiblyNonDenotableExpectedType ) : IrExpression

{ <EOL> if ( possiblyNonDenotableExpectedType == null ) return this <EOL> if ( possiblyNonDenotableExpectedType . isError ) return this <EOL> val expectedType = typeTranslator . approximate ( possiblyNonDenotableExpectedType ) <EOL> if ( this is IrFunctionExpression && originalExpectedType != null ) { <EOL> recordExpectedLambdaReturnTypeIfAppropriate ( expectedType , originalExpectedType ) <EOL> } <EOL> val notNullableExpectedType = expectedType . makeNotNullable ( ) <EOL> val valueType = this . type . originalKotlinType ? : error ( "<STR_LIT>" ) <EOL> return when { <EOL> expectedType . isUnit ( ) -> <EOL> coerceToUnit ( ) <EOL> valueType . isDynamic ( ) && ! expectedType . isDynamic ( ) -> <EOL> if ( expectedType . isNullableAny ( ) ) <EOL> this <EOL> else <EOL> implicitCast ( expectedType , IrTypeOperator . IMPLICIT_DYNAMIC_CAST ) <EOL> valueType . isNullabilityFlexible ( ) && valueType . containsNull ( ) && ! expectedType . acceptsNullValues ( ) -> <EOL> implicitNonNull ( valueType , expectedType ) <EOL> valueType . hasEnhancedNullability ( ) && ! expectedType . acceptsNullValues ( ) -> <EOL> implicitNonNull ( valueType , expectedType ) <EOL> KotlinTypeChecker . DEFAULT . isSubtypeOf ( valueType . toNonIrBased ( ) , expectedType . toNonIrBased ( ) . makeNullable ( ) ) -> <EOL> this <EOL> KotlinBuiltIns . isInt ( valueType ) && notNullableExpectedType . isBuiltInIntegerType ( ) -> <EOL> coerceIntToAnotherIntegerType ( notNullableExpectedType ) <EOL> else -> { <EOL> val targetType = if ( ! valueType . containsNull ( ) ) notNullableExpectedType else expectedType <EOL> implicitCast ( targetType , IrTypeOperator . IMPLICIT_CAST ) <EOL> } <EOL> } <EOL> }


private fun IrFunctionExpression . recordExpectedLambdaReturnTypeIfAppropriate ( expectedType : KotlinType , originalExpectedType : KotlinType )

{ <EOL> val returnTypeFromExpected = expectedType . getFunctionReturnTypeOrNull ( ) ? : return <EOL> val returnTypeFromOriginalExpected = originalExpectedType . getFunctionReturnTypeOrNull ( ) <EOL> if ( returnTypeFromOriginalExpected ? . isTypeParameter ( ) != true ) { <EOL> expectedFunctionExpressionReturnType [ function . descriptor ] = returnTypeFromExpected . toIrType ( ) <EOL> } <EOL> }


private fun KotlinType . acceptsNullValues ( )

= <EOL> containsNull ( ) || hasEnhancedNullability ( )


private fun KotlinType . hasEnhancedNullability ( )

= <EOL> generatorExtensions . enhancedNullability . hasEnhancedNullability ( this )


private fun IrExpression . implicitNonNull ( valueType : KotlinType , expectedType : KotlinType ) : IrExpression

{ <EOL> val nonNullFlexibleType = valueType . upperIfFlexible ( ) . makeNotNullable ( ) <EOL> val nonNullValueType = generatorExtensions . enhancedNullability . stripEnhancedNullability ( nonNullFlexibleType ) <EOL> return implicitCast ( nonNullValueType , IrTypeOperator . IMPLICIT_NOTNULL ) . cast ( expectedType ) <EOL> }


private fun IrExpression . implicitCast ( targetType : KotlinType , typeOperator : IrTypeOperator ) : IrExpression

{ <EOL> val irType = targetType . toIrType ( ) <EOL> return IrTypeOperatorCallImpl ( startOffset , endOffset , irType , typeOperator , irType , this ) <EOL> }


private fun IrExpression . coerceIntToAnotherIntegerType ( targetType : KotlinType ) : IrExpression

{ <EOL> if ( ! type . originalKotlinType ! ! . isInt ( ) ) throw AssertionError ( "<STR_LIT>" ) <EOL> if ( targetType . isInt ( ) ) return this <EOL> if ( generatorExtensions . shouldPreventDeprecatedIntegerValueTypeLiteralConversion && this is IrCall && preventDeprecatedIntegerValueTypeLiteralConversion ( ) ) return this <EOL> return if ( this is IrConst < * > ) { <EOL> val value = this . value as Int <EOL> val irType = targetType . toIrType ( ) <EOL> when { <EOL> targetType . isByte ( ) -> IrConstImpl . byte ( startOffset , endOffset , irType , value . toByte ( ) ) <EOL> targetType . isShort ( ) -> IrConstImpl . short ( startOffset , endOffset , irType , value . toShort ( ) ) <EOL> targetType . isLong ( ) -> IrConstImpl . long ( startOffset , endOffset , irType , value . toLong ( ) ) <EOL> KotlinBuiltIns . isUByte ( targetType ) -> IrConstImpl . byte ( startOffset , endOffset , irType , value . toByte ( ) ) <EOL> KotlinBuiltIns . isUShort ( targetType ) -> IrConstImpl . short ( startOffset , endOffset , irType , value . toShort ( ) ) <EOL> KotlinBuiltIns . isUInt ( targetType ) -> IrConstImpl . int ( startOffset , endOffset , irType , value ) <EOL> KotlinBuiltIns . isULong ( targetType ) -> IrConstImpl . long ( startOffset , endOffset , irType , value . toLong ( ) ) <EOL> else -> throw AssertionError ( "<STR_LIT>" ) <EOL> } <EOL> } else { <EOL> when { <EOL> targetType . isByte ( ) -> invokeIntegerCoercionFunction ( targetType , "<STR_LIT>" ) <EOL> targetType . isShort ( ) -> invokeIntegerCoercionFunction ( targetType , "<STR_LIT>" ) <EOL> targetType . isLong ( ) -> invokeIntegerCoercionFunction ( targetType , "<STR_LIT>" ) <EOL> KotlinBuiltIns . isUByte ( targetType ) -> invokeUnsignedIntegerCoercionFunction ( targetType , "<STR_LIT>" ) <EOL> KotlinBuiltIns . isUShort ( targetType ) -> invokeUnsignedIntegerCoercionFunction ( targetType , "<STR_LIT>" ) <EOL> KotlinBuiltIns . isUInt ( targetType ) -> invokeUnsignedIntegerCoercionFunction ( targetType , "<STR_LIT>" ) <EOL> KotlinBuiltIns . isULong ( targetType ) -> invokeUnsignedIntegerCoercionFunction ( targetType , "<STR_LIT>" ) <EOL> else -> throw AssertionError ( "<STR_LIT>" ) <EOL> } <EOL> } <EOL> }


private fun IrCall . preventDeprecatedIntegerValueTypeLiteralConversion ( ) : Boolean

{ <EOL> val descriptor = symbol . descriptor <EOL> if ( descriptor . name !in operatorsWithDeprecatedIntegerValueTypeLiteralConversion ) return false <EOL> if ( origin in OPERATORS_DESUGARED_TO_CALLS ) return false <EOL> if ( descriptor . isInfix ) { <EOL> if ( ( file . fileEntry as? PsiIrFileEntry ) ? . findPsiElement ( this ) is KtBinaryExpression ) return false <EOL> } <EOL> return descriptor . dispatchReceiverParameter ? . type ? . let { KotlinBuiltIns . isPrimitiveType ( it ) } == true <EOL> }


private fun IrExpression . invokeIntegerCoercionFunction ( targetType : KotlinType , coercionFunName : String ) : IrExpression

{ <EOL> val coercionFunction = irBuiltIns . intClass . descriptor . unsubstitutedMemberScope . findSingleFunction ( Name . identifier ( coercionFunName ) ) <EOL> return IrCallImpl ( startOffset , endOffset , targetType . toIrType ( ) , symbolTable . descriptorExtension . referenceSimpleFunction ( coercionFunction ) , typeArgumentsCount = <NUM_LIT:0> , valueArgumentsCount = <NUM_LIT:0> ) . also { irCall -> <EOL> irCall . dispatchReceiver = this <EOL> } <EOL> }


private fun IrExpression . invokeUnsignedIntegerCoercionFunction ( targetType : KotlinType , coercionFunName : String ) : IrExpression

{ <EOL> val coercionFunction = targetType . constructor . declarationDescriptor ! ! . module <EOL> . getPackage ( StandardNames . BUILT_INS_PACKAGE_FQ_NAME ) <EOL> . memberScope . getContributedFunctions ( Name . identifier ( coercionFunName ) , NoLookupLocation . FROM_BACKEND ) <EOL> . find { <EOL> val extensionReceiver = it . extensionReceiverParameter <EOL> extensionReceiver != null && extensionReceiver . type . isInt ( ) <EOL> } <EOL> ? : throw AssertionError ( "<STR_LIT>" ) <EOL> return IrCallImpl ( startOffset , endOffset , targetType . toIrType ( ) , symbolTable . descriptorExtension . referenceSimpleFunction ( coercionFunction ) , typeArgumentsCount = <NUM_LIT:0> , valueArgumentsCount = <NUM_LIT:0> ) . also { irCall -> <EOL> irCall . extensionReceiver = this <EOL> } <EOL> }


private fun KotlinType . isBuiltInIntegerType ( ) : Boolean

= <EOL> KotlinBuiltIns . isByte ( this ) || <EOL> KotlinBuiltIns . isShort ( this ) || <EOL> KotlinBuiltIns . isInt ( this ) || <EOL> KotlinBuiltIns . isLong ( this ) || <EOL> KotlinBuiltIns . isUByte ( this ) || <EOL> KotlinBuiltIns . isUShort ( this ) || <EOL> KotlinBuiltIns . isUInt ( this ) || <EOL> KotlinBuiltIns . isULong ( this )


private fun IrExpression . coerceToUnit ( ) : IrExpression

{ <EOL> return if ( KotlinTypeChecker . DEFAULT . isSubtypeOf ( type . toKotlinType ( ) , irBuiltIns . unitType . toKotlinType ( ) ) ) <EOL> this <EOL> else <EOL> IrTypeOperatorCallImpl ( startOffset , endOffset , irBuiltIns . unitType , IrTypeOperator . IMPLICIT_COERCION_TO_UNIT , irBuiltIns . unitType , this ) <EOL> }


private fun KotlinType . toNonIrBased ( ) : KotlinType

{ <EOL> if ( this !is SimpleType ) return this <EOL> if ( this . isError ) return this <EOL> val newDescriptor = constructor . declarationDescriptor ? . let { <EOL> if ( it is IrBasedDeclarationDescriptor < * > && it . owner . symbol . hasDescriptor ) <EOL> it . owner . symbol . descriptor as ClassifierDescriptor <EOL> else <EOL> it <EOL> } ? : return this <EOL> val newArguments = arguments . mapIndexed { index , it -> <EOL> if ( it . isStarProjection ) <EOL> StarProjectionImpl ( ( newDescriptor as ClassDescriptor ) . typeConstructor . parameters [ index ] ) <EOL> else <EOL> TypeProjectionImpl ( it . projectionKind , it . type . toNonIrBased ( ) ) <EOL> } <EOL> return newDescriptor . defaultType . replace ( newArguments = newArguments ) . makeNullableAsSpecified ( isMarkedNullable ) <EOL> }


= <EOL> cross { <EOL> foo { "<STR_LIT:OK>" } <EOL> } . toString ( )


inline fun cross ( crossinline fn : ( ) -> String ) : Any

= <EOL> object { <EOL> override fun toString ( ) : String = fn ( ) <EOL> }


fun foo ( ) : String


= iFoo . foo ( )


= <EOL> C ( ) . test ( )


= args [ <NUM_LIT:0> ]


{ <EOL> val mh = MethodHandles . lookup ( ) . findStatic ( object { } :: class . java . enclosingClass , "<STR_LIT:foo>" , MethodType . methodType ( Any :: class . java , Array < Any > :: class . java ) ) <EOL> val args = arrayOf ( "<STR_LIT:aaa>" , <NUM_LIT:1> ) <EOL> val r1 = mh . invokeExact ( args ) <EOL> if ( r1 !is Array < * > || ! r1 . contentEquals ( args ) ) return "<STR_LIT>" <EOL> val r2 = mh . invokeExact ( * args ) <EOL> if ( r2 != "<STR_LIT:aaa>" ) return "<STR_LIT>" <EOL> val r3 = mh . invokeExact ( arrayOf ( args ) as Array < * > ) <EOL> if ( r3 !is Array < * > || r3 [ <NUM_LIT:0> ] !is Array < * > || ! ( r3 [ <NUM_LIT:0> ] as Array < * > ) . contentEquals ( args ) ) return "<STR_LIT>" <EOL> val r4 = mh . invokeExact ( arrayOf ( args ) ) <EOL> if ( r4 !is Array < * > || r4 [ <NUM_LIT:0> ] !is Array < * > || ! ( r4 [ <NUM_LIT:0> ] as Array < * > ) . contentEquals ( args ) ) return "<STR_LIT>" <EOL> val r5 = mh . invoke ( args ) <EOL> if ( r5 !is Array < * > || ! r5 . contentEquals ( args ) ) return "<STR_LIT>" <EOL> val r6 = mh . invoke ( * args ) <EOL> if ( r6 != "<STR_LIT:aaa>" ) return "<STR_LIT>" <EOL> val r7 = mh . invoke ( arrayOf ( args ) as Array < * > ) <EOL> if ( r7 !is Array < * > || r7 [ <NUM_LIT:0> ] !is Array < * > || ! ( r7 [ <NUM_LIT:0> ] as Array < * > ) . contentEquals ( args ) ) return "<STR_LIT>" <EOL> val r8 = mh . invoke ( arrayOf ( args ) ) <EOL> if ( r8 !is Array < * > || r8 [ <NUM_LIT:0> ] !is Array < * > || ! ( r8 [ <NUM_LIT:0> ] as Array < * > ) . contentEquals ( args ) ) return "<STR_LIT>" <EOL> mh . invokeExact ( args ) <EOL> mh . invoke ( args ) <EOL> return "<STR_LIT:OK>" <EOL> }


override fun < T : Any > getSetting ( key : CommonizerSettings . Key < T > ) : T

{ <EOL> return key . defaultValue <EOL> }


{ <EOL> @ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> return settings [ key ] as? T ? : key . defaultValue <EOL> }


{ <EOL> hashes . add ( hash ) <EOL> }


= FingerprintHash ( hashes . fold ( Hash128Bits ( hashes . size . toULong ( ) ) ) { acc , x -> acc . combineWith ( x . hash ) } )


private fun LibraryHashComputer . digestLibrary ( library : KotlinLibrary )

= <EOL> update ( SerializedKlibFingerprint ( library . libraryFile . javaFile ( ) ) . klibFingerprint )


private fun getArtifactName ( target : KonanTarget , baseName : String , kind : CompilerOutputKind )

= <EOL> "<STR_LIT>"


protected abstract fun computeBitcodeDependencies ( ) : List < DependenciesTracker . UnresolvedDependency >


protected abstract fun computeBinariesPaths ( ) : List < String >


protected abstract fun computeSerializedInlineFunctionBodies ( ) : List < SerializedInlineFunctionReference >


protected abstract fun computeSerializedClassFields ( ) : List < SerializedClassFields >


protected abstract fun computeSerializedEagerInitializedFiles ( ) : List < SerializedEagerInitializedFile >


protected fun Kind . toCompilerOutputKind ( ) : CompilerOutputKind

= when ( this ) { <EOL> Kind . DYNAMIC -> CompilerOutputKind . DYNAMIC_CACHE <EOL> Kind . STATIC -> CompilerOutputKind . STATIC_CACHE <EOL> Kind . HEADER -> CompilerOutputKind . HEADER_CACHE <EOL> }


override fun computeBitcodeDependencies ( ) : List < DependenciesTracker . UnresolvedDependency >

{ <EOL> val directory = File ( path ) . absoluteFile . parentFile <EOL> val data = directory . child ( BITCODE_DEPENDENCIES_FILE_NAME ) . readStrings ( ) <EOL> return DependenciesSerializer . deserialize ( path , data ) <EOL> }


= listOf ( path )


override fun computeSerializedInlineFunctionBodies ( )

= mutableListOf < SerializedInlineFunctionReference > ( ) . also { <EOL> val directory = File ( path ) . absoluteFile . parentFile . parentFile <EOL> val data = directory . child ( PER_FILE_CACHE_IR_LEVEL_DIR_NAME ) . child ( INLINE_FUNCTION_BODIES_FILE_NAME ) . readBytes ( ) <EOL> InlineFunctionBodyReferenceSerializer . deserializeTo ( data , it ) <EOL> }


override fun computeSerializedClassFields ( )

= mutableListOf < SerializedClassFields > ( ) . also { <EOL> val directory = File ( path ) . absoluteFile . parentFile . parentFile <EOL> val data = directory . child ( PER_FILE_CACHE_IR_LEVEL_DIR_NAME ) . child ( CLASS_FIELDS_FILE_NAME ) . readBytes ( ) <EOL> ClassFieldsSerializer . deserializeTo ( data , it ) <EOL> }


override fun computeSerializedEagerInitializedFiles ( )

= mutableListOf < SerializedEagerInitializedFile > ( ) . also { <EOL> val directory = File ( path ) . absoluteFile . parentFile . parentFile <EOL> val data = directory . child ( PER_FILE_CACHE_IR_LEVEL_DIR_NAME ) . child ( EAGER_INITIALIZED_PROPERTIES_FILE_NAME ) . readBytes ( ) <EOL> EagerInitializedPropertySerializer . deserializeTo ( data , it ) <EOL> }


fun getFileDependencies ( file : String )

= <EOL> perFileBitcodeDependencies [ file ] ? : error ( "<STR_LIT>" )


= <EOL> File ( path ) . child ( file ) . child ( PER_FILE_CACHE_BINARY_LEVEL_DIR_NAME ) . child ( getArtifactName ( target , file , kind . toCompilerOutputKind ( ) ) ) . let { <EOL> require ( it . exists ) { "<STR_LIT>" } <EOL> it . absolutePath <EOL> }


= <EOL> File ( path ) . child ( file ) . child ( HASH_FILE_NAME ) . readBytes ( )


override fun computeBitcodeDependencies ( )

= perFileBitcodeDependencies . values . flatten ( )


= existingFileDirs . map { <EOL> it . child ( PER_FILE_CACHE_BINARY_LEVEL_DIR_NAME ) . child ( getArtifactName ( target , it . name , kind . toCompilerOutputKind ( ) ) ) . absolutePath <EOL> }


= mutableListOf < SerializedInlineFunctionReference > ( ) . also { <EOL> existingFileDirs . forEach { fileDir -> <EOL> val data = fileDir . child ( PER_FILE_CACHE_IR_LEVEL_DIR_NAME ) . child ( INLINE_FUNCTION_BODIES_FILE_NAME ) . readBytes ( ) <EOL> InlineFunctionBodyReferenceSerializer . deserializeTo ( data , it ) <EOL> } <EOL> }


= mutableListOf < SerializedClassFields > ( ) . also { <EOL> existingFileDirs . forEach { fileDir -> <EOL> val data = fileDir . child ( PER_FILE_CACHE_IR_LEVEL_DIR_NAME ) . child ( CLASS_FIELDS_FILE_NAME ) . readBytes ( ) <EOL> ClassFieldsSerializer . deserializeTo ( data , it ) <EOL> } <EOL> }


= mutableListOf < SerializedEagerInitializedFile > ( ) . also { <EOL> existingFileDirs . forEach { fileDir -> <EOL> val data = fileDir . child ( PER_FILE_CACHE_IR_LEVEL_DIR_NAME ) . child ( EAGER_INITIALIZED_PROPERTIES_FILE_NAME ) . readBytes ( ) <EOL> EagerInitializedPropertySerializer . deserializeTo ( data , it ) <EOL> } <EOL> }


private fun File . trySelectCacheFor ( library : KotlinLibrary ) : Cache ?

{ <EOL> val cacheDirContents = listFilesOrEmpty . map { it . absolutePath } . toSet ( ) <EOL> if ( cacheDirContents . isEmpty ( ) ) return null <EOL> val cacheBinaryPartDir = child ( PER_FILE_CACHE_BINARY_LEVEL_DIR_NAME ) <EOL> val cacheBinaryPartDirContents = cacheBinaryPartDir . listFilesOrEmpty . map { it . absolutePath } . toSet ( ) <EOL> val baseName = getCachedLibraryName ( library ) <EOL> val dynamicFile = cacheBinaryPartDir . child ( getArtifactName ( target , baseName , CompilerOutputKind . DYNAMIC_CACHE ) ) <EOL> val staticFile = cacheBinaryPartDir . child ( getArtifactName ( target , baseName , CompilerOutputKind . STATIC_CACHE ) ) <EOL> val headerFile = cacheBinaryPartDir . child ( getArtifactName ( target , baseName , CompilerOutputKind . HEADER_CACHE ) ) <EOL> if ( dynamicFile . absolutePath in cacheBinaryPartDirContents && staticFile . absolutePath in cacheBinaryPartDirContents ) <EOL> error ( "<STR_LIT>" + "<STR_LIT>" ) <EOL> return when { <EOL> dynamicFile . absolutePath in cacheBinaryPartDirContents -> Cache . Monolithic ( target , Kind . DYNAMIC , dynamicFile . absolutePath ) <EOL> staticFile . absolutePath in cacheBinaryPartDirContents -> Cache . Monolithic ( target , Kind . STATIC , staticFile . absolutePath ) <EOL> headerFile . absolutePath in cacheBinaryPartDirContents -> Cache . Monolithic ( target , Kind . HEADER , headerFile . absolutePath ) <EOL> else -> { <EOL> val libraryFileDirs = library . getFilesWithFqNames ( ) . map { <EOL> child ( CacheSupport . cacheFileId ( it . fqName , it . filePath ) ) <EOL> } <EOL> Cache . PerFile ( target , Kind . STATIC , absolutePath , libraryFileDirs , complete = cacheDirContents . containsAll ( libraryFileDirs . map { it . absolutePath } ) ) <EOL> } <EOL> } <EOL> }


private fun KotlinLibrary . trySelectCacheAt ( dirBuilder : ( String ) -> File ? )

= <EOL> sequenceOf ( getPerFileCachedLibraryName ( this ) , getCachedLibraryName ( this ) ) <EOL> . map ( dirBuilder ) <EOL> . mapNotNull { it ? . trySelectCacheFor ( this ) } <EOL> . firstOrNull ( )


fun isLibraryCached ( library : KotlinLibrary ) : Boolean

= <EOL> getLibraryCache ( library ) != null


fun getLibraryCache ( library : KotlinLibrary , allowIncomplete : Boolean = false ) : Cache ?

= <EOL> allCaches [ library ] ? . takeIf { allowIncomplete || ( it as? Cache . PerFile ) ? . complete != false }


fun getPerFileCachedLibraryName ( library : KotlinLibrary ) : String

= "<STR_LIT>"


fun getCachedLibraryName ( library : KotlinLibrary ) : String

= getCachedLibraryName ( library . uniqueName )


fun getCachedLibraryName ( libraryName : String ) : String

= "<STR_LIT>"


private fun computeLibraryHash ( library : KotlinLibrary , librariesHashes : MutableMap < String , FingerprintHash > )

= <EOL> librariesHashes . getOrPut ( library . uniqueName ) { <EOL> val hashComputer = LibraryHashComputer ( ) <EOL> hashComputer . digestLibrary ( library ) <EOL> hashComputer . digest ( ) <EOL> }


fun computeVersionedCacheDirectory ( baseCacheDirectory : File , library : KotlinLibrary , allLibraries : Map < String , KotlinLibrary > , librariesHashes : MutableMap < String , FingerprintHash > , ) : File

{ <EOL> val dependencies = library . getAllTransitiveDependencies ( allLibraries ) <EOL> val hashComputer = LibraryHashComputer ( ) <EOL> hashComputer . update ( computeLibraryHash ( library , librariesHashes ) ) <EOL> dependencies . sortedBy { it . uniqueName } . forEach { <EOL> hashComputer . update ( computeLibraryHash ( it , librariesHashes ) ) <EOL> } <EOL> val version = library . versions . libraryVersion ? : "<STR_LIT>" <EOL> val hashString = hashComputer . digest ( ) . toString ( ) <EOL> return baseCacheDirectory . child ( library . uniqueName ) . child ( version ) . child ( hashString ) <EOL> }


{ <EOL> for ( checker in configuration . enabledModuleMetadataCheckers ) { <EOL> checker . check ( metadata1 , metadata2 , report ) <EOL> } <EOL> checkPackageParts ( ) <EOL> }


{ <EOL> val packageParts1 = metadata1 . packageParts <EOL> val packageParts2 = metadata2 . packageParts <EOL> val commonIds = packageParts1 . keys . intersect ( packageParts2 . keys ) . sorted ( ) <EOL> for ( id in commonIds ) { <EOL> val packagePart1 = packageParts1 [ id ] ! ! <EOL> val packagePart2 = packageParts2 [ id ] ! ! <EOL> val packagePartsReport = report . packagePartsReport ( id ) <EOL> PackagePartsMetadataTask ( configuration , packagePart1 , packagePart2 , packagePartsReport ) . run ( ) <EOL> } <EOL> }


@ OptIn ( UnstableMetadataApi :: class ) <EOL> private fun ByteArray . toKmModule ( )

= KotlinModuleMetadata . read ( this ) . kmModule


override fun convert ( output : OrtSession . Result ) : MultiPoseDetectionResult

{ <EOL> val rawPoseLandMarks = output . get2DFloatArray ( outputName ) <EOL> val poses = rawPoseLandMarks . map { floats -> <EOL> val foundPoseLandmarks = mutableListOf < PoseLandmark > ( ) <EOL> for ( keyPointIdx in <NUM_LIT:0> .. <NUM_LIT:16> ) { <EOL> val poseLandmark = PoseLandmark ( x = floats [ <NUM_LIT:3> * keyPointIdx + <NUM_LIT:1> ] , y = floats [ <NUM_LIT:3> * keyPointIdx ] , probability = floats [ <NUM_LIT:3> * keyPointIdx + <NUM_LIT:2> ] , label = keyPointsLabels [ keyPointIdx ] ! ! <EOL> ) <EOL> foundPoseLandmarks . add ( poseLandmark ) <EOL> } <EOL> val detectedObject = DetectedObject ( xMin = floats [ <NUM_LIT> ] , xMax = floats [ <NUM_LIT> ] , yMin = floats [ <NUM_LIT> ] , yMax = floats [ <NUM_LIT> ] , probability = floats [ <NUM_LIT> ] ) <EOL> val foundPoseEdges = buildPoseEdges ( foundPoseLandmarks , edgeKeyPoints ) <EOL> val detectedPose = DetectedPose ( foundPoseLandmarks , foundPoseEdges ) <EOL> detectedObject to detectedPose <EOL> } <EOL> return MultiPoseDetectionResult ( poses ) <EOL> }


public fun detectPoses ( image : I , confidence : Float = <NUM_LIT> ) : MultiPoseDetectionResult

{ <EOL> val result = predict ( image ) <EOL> val filteredPoses = result . poses . filter { ( detectedObject , _ ) -> <EOL> detectedObject . probability > confidence <EOL> } <EOL> return MultiPoseDetectionResult ( filteredPoses ) <EOL> }

/**
 * Detects poses for the given [image] with the given [confidence].
 * @param [confidence] confidence value to use
 */


{ <EOL> return null ! ! <EOL> }


override fun test ( p : String ) : String

{ <EOL> return p <EOL> }


{ <EOL> checkMethodExists ( Test2 :: class . java , "<STR_LIT:test>" , Any :: class . java ) <EOL> checkMethodExists ( Test2 :: class . java , "<STR_LIT:test>" , String :: class . java ) <EOL> checkNoMethod ( TestClass :: class . java , "<STR_LIT:test>" , String :: class . java ) <EOL> checkNoMethod ( TestClass :: class . java , "<STR_LIT:test>" , Any :: class . java ) <EOL> val test2DefaultImpls = java . lang . Class . forName ( "<STR_LIT>" ) <EOL> checkMethodExists ( test2DefaultImpls , "<STR_LIT:test>" , Test2 :: class . java , String :: class . java ) <EOL> checkNoMethod ( test2DefaultImpls , "<STR_LIT:test>" , Test2 :: class . java , Any :: class . java ) <EOL> return "<STR_LIT:OK>" <EOL> }


fun checkNoMethod ( clazz : Class < * > , name : String , vararg parameterTypes : Class < * > )

{ <EOL> try { <EOL> clazz . getDeclaredMethod ( name , * parameterTypes ) <EOL> } <EOL> catch ( e : NoSuchMethodException ) { <EOL> return <EOL> } <EOL> throw AssertionError ( "<STR_LIT>" + clazz ) <EOL> }


fun checkMethodExists ( clazz : Class < * > , name : String , vararg parameterTypes : Class < * > )

{ <EOL> try { <EOL> clazz . getDeclaredMethod ( name , * parameterTypes ) <EOL> return <EOL> } <EOL> catch ( e : NoSuchMethodException ) { <EOL> throw AssertionError ( "<STR_LIT>" + clazz , e ) <EOL> } <EOL> }


fun < T > runLogged ( entry : String , action : ( ) -> T ) : T

{ <EOL> log += entry <EOL> return action ( ) <EOL> }


operator fun String . provideDelegate ( host : Any ? , p : Any ) : String

= <EOL> runLogged ( "<STR_LIT>" ) { this }


operator fun String . getValue ( receiver : Any ? , p : Any ) : String


{ <EOL> val testO by runLogged ( "<STR_LIT>" ) { "<STR_LIT:O>" } <EOL> val testK by runLogged ( "<STR_LIT>" ) { "<STR_LIT:K>" } <EOL> val testOK = runLogged ( "<STR_LIT>" ) { testO + testK } <EOL> assertEquals ( "<STR_LIT>" , log ) <EOL> return testOK <EOL> }


private fun loadMainDispatcher ( ) : MainCoroutineDispatcher

{ <EOL> return try { <EOL> val factories = if ( FAST_SERVICE_LOADER_ENABLED ) { <EOL> FastServiceLoader . loadMainDispatcherFactory ( ) <EOL> } else { <EOL> ServiceLoader . load ( MainDispatcherFactory :: class . java , MainDispatcherFactory :: class . java . classLoader ) . iterator ( ) . asSequence ( ) . toList ( ) <EOL> } <EOL> @ Suppress ( "<STR_LIT>" ) <EOL> factories . maxByOrNull { it . loadPriority } ? . tryCreateDispatcher ( factories ) <EOL> ? : createMissingDispatcher ( ) <EOL> } catch ( e : Throwable ) { <EOL> createMissingDispatcher ( e ) <EOL> } <EOL> }


@ InternalCoroutinesApi <EOL> public fun MainDispatcherFactory . tryCreateDispatcher ( factories : List < MainDispatcherFactory > ) : MainCoroutineDispatcher

= <EOL> try { <EOL> createDispatcher ( factories ) <EOL> } catch ( cause : Throwable ) { <EOL> createMissingDispatcher ( cause , hintOnError ( ) ) <EOL> }

/**
 * If anything goes wrong while trying to create main dispatcher (class not found,
 * initialization failed, etc), then replace the main dispatcher with a special
 * stub that throws an error message on any attempt to actually use it.
 *
 * @suppress internal API
 */


@ InternalCoroutinesApi <EOL> public fun MainCoroutineDispatcher . isMissing ( ) : Boolean

= <EOL> this . immediate is MissingMainCoroutineDispatcher


@ Suppress ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> private fun createMissingDispatcher ( cause : Throwable ? = null , errorHint : String ? = null )

= <EOL> if ( SUPPORT_MISSING ) MissingMainCoroutineDispatcher ( cause , errorHint ) else <EOL> cause ? . let { throw it } ? : throwMissingMainDispatcherException ( )


internal fun throwMissingMainDispatcherException ( ) : Nothing

{ <EOL> throw IllegalStateException ( "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" ) <EOL> }


override fun isDispatchNeeded ( context : CoroutineContext ) : Boolean

= <EOL> missing ( )


override fun limitedParallelism ( parallelism : Int ) : CoroutineDispatcher

= <EOL> missing ( )


override fun invokeOnTimeout ( timeMillis : Long , block : Runnable , context : CoroutineContext ) : DisposableHandle

= <EOL> missing ( )


override fun dispatch ( context : CoroutineContext , block : Runnable )

= <EOL> missing ( )


override fun scheduleResumeAfterDelay ( timeMillis : Long , continuation : CancellableContinuation < Unit > )

= <EOL> missing ( )


{ <EOL> if ( cause == null ) { <EOL> throwMissingMainDispatcherException ( ) <EOL> } else { <EOL> val message = "<STR_LIT>" + ( errorHint ? . let { "<STR_LIT>" } ? : "<STR_LIT>" ) <EOL> throw IllegalStateException ( message , cause ) <EOL> } <EOL> }


= "<STR_LIT>"


override fun createDispatcher ( allFactories : List < MainDispatcherFactory > ) : MainCoroutineDispatcher

{ <EOL> return MissingMainCoroutineDispatcher ( null ) <EOL> }


{ <EOL> when ( x ) { <EOL> x as Int -> checkSubtype < Int > ( x ) <EOL> y -> { } <EOL> else -> { } <EOL> } <EOL> checkSubtype < Int > ( x ) <EOL> }


{ <EOL> when ( x ) { <EOL> x as Int -> checkSubtype < Int > ( x ) <EOL> else -> { } <EOL> } <EOL> checkSubtype < Int > ( x ) <EOL> }


{ <EOL> when { <EOL> ( x as Int ) == <NUM_LIT:42> -> checkSubtype < Int > ( x ) <EOL> else -> { } <EOL> } <EOL> checkSubtype < Int > ( x ) <EOL> }


fun foo ( x : ( @ Foo ( ( @ Foo kotlin . Any ) -> ( Int ) ) . ( @ Foo kotlin . Any ) -> ( ) -> Unit ) )

= x


fun foo ( x : suspend @ Foo ( <NUM_LIT:10> ) @ Bar Comparable < T > . ( kotlin . Any ) -> Unit = { x : Int -> x } )


{ <EOL> val x : @ Foo suspend @ Bar ( Coomparable < kotlin . Any > ) -> Unit . ( Coomparable < kotlin . Any > ) -> Unit = { } <EOL> }


{ <EOL> val x = { x : suspend @ Foo @ Foo ( ) -> Unit . ( Coomparable < @ Foo @ Bar ( <NUM_LIT:10> ) @ Foo ( ) -> Unit > ) -> ( ) -> Unit -> x } <EOL> }


fun foo ( vararg x : @ Foo @ Bar ( <NUM_LIT:10> ) @ Foo Any . ( Any ) -> Unit )

= <NUM_LIT:10>


fun foo ( ) : @ Foo . Bar suspend Nothing . ( Nothing ) -> Unit


fun foo ( ) : ( ) -> @ Foo . Bar suspend Iterable < @ Foo . Bar Int . ( Bar ) -> Unit > . ( Bar ) -> Unit


{ <EOL> var x : ( @ Foo ( ( ) -> Unit ) -> @ Foo Int . ( ) -> Unit ) -> Unit = { } <EOL> }


{ <EOL> if ( x as @ Foo @ Bar ( <NUM_LIT:10> ) @ Foo ( ) -> Unit . ( ( ) -> Unit ) -> Unit is suspend @ Foo @ Bar ( <NUM_LIT:10> ) @ Foo ( ( ( ) -> Unit ) . ( ) -> Unit ) -> Unit ) { } <EOL> }


{ <EOL> var x = y as ( @ Foo suspend ( suspend ( ( ) -> Unit ) -> Int ) . ( ( ) -> Unit ) -> ( Float . ( ) -> Unit ) -> Unit ) -> Unit <EOL> }


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

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


@ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> override fun < E : FirElement , D > transform ( transformer : FirTransformer < D > , data : D ) : E

= <EOL> transformer . transformDelegatedConstructorCall ( this , data ) as E


abstract override fun replaceAnnotations ( newAnnotations : List < FirAnnotation > )


abstract override fun replaceArgumentList ( newArgumentList : FirArgumentList )


abstract override fun replaceContextReceiverArguments ( newContextReceiverArguments : List < FirExpression > )


abstract fun replaceConstructedTypeRef ( newConstructedTypeRef : FirTypeRef )


abstract fun replaceDispatchReceiver ( newDispatchReceiver : FirExpression ? )


abstract override fun replaceCalleeReference ( newCalleeReference : FirReference )


@ FirImplementationDetail <EOL> abstract fun replaceSource ( newSource : KtSourceElement ? )


abstract override fun < D > transformAnnotations ( transformer : FirTransformer < D > , data : D ) : FirDelegatedConstructorCall


abstract fun < D > transformDispatchReceiver ( transformer : FirTransformer < D > , data : D ) : FirDelegatedConstructorCall


abstract override fun < D > transformCalleeReference ( transformer : FirTransformer < D > , data : D ) : FirDelegatedConstructorCall


fun equals ( other : Any ) : Boolean <EOL>

= ( this as java . lang . Object ) . equals ( other as java . lang . Object )


fun get ( key : K ) : V


fun set ( key : K , value : V ) : V


fun remove ( key : K ) : V


fun containsKey ( key : K ) : Boolean


@ [ inline ] fun Any . hashable ( ) : HashableWrapper

= HashableWrapper ( this )


fun equals ( a : K , b : K ) : Boolean


fun hashCode ( a : K ) : Integer


override fun equals ( a : K , b : K ) : Boolean

= a . equals ( b )


override fun hashCode ( a : K ) : Integer

= a . hashCode


override fun equals ( a : K , b : K ) : Boolean <EOL>

= a . hashable ( ) . equals ( b )


override fun hashCode ( a : K ) : Integer <EOL>

= a . hashable ( ) . hashCode


private @ [ inline ] fun hashCode ( a : K )

= a . hashable ( ) . hashCode


private @ [ inline ] fun equals ( a : K , b : K )

= a . hashable ( ) == b


= _name


override fun hasTypeParameters ( ) : Boolean

= <EOL> hasTypeParameters ( ktModule , functionDeclaration , functionSymbolPointer ) <EOL> || containingClass . isDefaultImplsForInterfaceWithTypeParameters


override fun getTypeParameterList ( ) : PsiTypeParameterList ?

= _typeParameterList


override fun getTypeParameters ( ) : Array < PsiTypeParameter >

= _typeParameterList ? . typeParameters ? : PsiTypeParameter . EMPTY_ARRAY


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

= when ( modifier ) { <EOL> in GranularModifiersBox . MODALITY_MODIFIERS -> { <EOL> ifInlineOnly { return modifiersForInlineOnlyCase ( ) } <EOL> val modality = when { <EOL> isTopLevel -> PsiModifier . FINAL <EOL> containingClass is SymbolLightClassForInterfaceDefaultImpls -> null <EOL> else -> withFunctionSymbol { functionSymbol -> <EOL> functionSymbol . computeSimpleModality ( ) ? . takeUnless { it . isSuppressedFinalModifier ( containingClass , functionSymbol ) } <EOL> } <EOL> } <EOL> GranularModifiersBox . MODALITY_MODIFIERS_MAP . with ( modality ) <EOL> } <EOL> in GranularModifiersBox . VISIBILITY_MODIFIERS -> { <EOL> ifInlineOnly { return modifiersForInlineOnlyCase ( ) } <EOL> GranularModifiersBox . computeVisibilityForMember ( ktModule , functionSymbolPointer ) <EOL> } <EOL> PsiModifier . STATIC -> { <EOL> ifInlineOnly { return null } <EOL> val isStatic = if ( suppressStatic ) { <EOL> false <EOL> } else { <EOL> isTopLevel <EOL> || containingClass is SymbolLightClassForInterfaceDefaultImpls <EOL> || withFunctionSymbol { it . isStatic || it . hasJvmStaticAnnotation ( ) } <EOL> } <EOL> mapOf ( modifier to isStatic ) <EOL> } <EOL> PsiModifier . NATIVE -> { <EOL> ifInlineOnly { return null } <EOL> val isExternal = functionDeclaration ? . hasModifier ( KtTokens . EXTERNAL_KEYWORD ) ? : withFunctionSymbol { it . isExternal } <EOL> mapOf ( modifier to isExternal ) <EOL> } <EOL> PsiModifier . STRICTFP -> { <EOL> ifInlineOnly { return null } <EOL> val hasAnnotation = withFunctionSymbol { it . hasAnnotation ( STRICTFP_ANNOTATION_CLASS_ID ) } <EOL> mapOf ( modifier to hasAnnotation ) <EOL> } <EOL> PsiModifier . SYNCHRONIZED -> { <EOL> ifInlineOnly { return null } <EOL> val hasAnnotation = withFunctionSymbol { it . hasAnnotation ( SYNCHRONIZED_ANNOTATION_CLASS_ID ) } <EOL> mapOf ( modifier to hasAnnotation ) <EOL> } <EOL> else -> null <EOL> }


private inline fun ifInlineOnly ( action : ( ) -> Unit )

{ <EOL> if ( hasInlineOnlyAnnotation ) { <EOL> action ( ) <EOL> } <EOL> }


private fun modifiersForInlineOnlyCase ( ) : PersistentMap < String , Boolean >

= GranularModifiersBox . MODALITY_MODIFIERS_MAP . mutate { <EOL> it . putAll ( GranularModifiersBox . VISIBILITY_MODIFIERS_MAP ) <EOL> it [ PsiModifier . FINAL ] = true <EOL> it [ PsiModifier . PRIVATE ] = true <EOL> }


override fun getModifierList ( ) : PsiModifierList

= _modifierList


override fun isConstructor ( ) : Boolean

= false


= _isOverride


private fun KtAnalysisSession . forceBoxedReturnType ( functionSymbol : KtFunctionSymbol ) : Boolean

{ <EOL> val returnType = functionSymbol . returnType <EOL> if ( functionSymbol . isBuiltinFunctionInvoke && isInlineClassType ( returnType ) ) <EOL> return true <EOL> return returnType . isPrimitive && <EOL> functionSymbol . getAllOverriddenSymbols ( ) . any { overriddenSymbol -> <EOL> ! overriddenSymbol . returnType . isPrimitive <EOL> } <EOL> }


@ Suppress ( "<STR_LIT>" ) <EOL> private fun KtAnalysisSession . isInlineClassType ( type : KtType ) : Boolean

{ <EOL> return ( ( type as? KtNonErrorClassType ) ? . classSymbol as? KtNamedClassOrObjectSymbol ) ? . isInline == true <EOL> }


private fun KtAnalysisSession . isVoidType ( type : KtType ) : Boolean

{ <EOL> val expandedType = type . fullyExpandedType <EOL> return expandedType . isUnit && expandedType . nullability != KtTypeNullability . NULLABLE <EOL> }


override fun getReturnType ( ) : PsiType

= _returnedType


fun create ( target : DecoratedExternalKotlinTarget . Delegate ) : T


@ ExternalKotlinTargetApi <EOL> fun < T : DecoratedExternalKotlinTarget > ExternalKotlinTargetDescriptor ( configure : ExternalKotlinTargetDescriptorBuilder < T > . ( ) -> Unit , ) : ExternalKotlinTargetDescriptor < T >

{ <EOL> return ExternalKotlinTargetDescriptorBuilder < T > ( ) . also ( configure ) . build ( ) <EOL> }

/**
 * Creates a new [ExternalKotlinTargetDescriptor] using the builder pattern.
 * There are some required properties that have to be set.
 * Check [ExternalKotlinTargetDescriptorBuilder] for further details.
 *
 * * The following properties have to be specified:
 * * - [ExternalKotlinTargetDescriptorBuilder.targetName]
 * * - [ExternalKotlinTargetDescriptorBuilder.platformType]
 * * - [ExternalKotlinTargetDescriptorBuilder.targetFactory]
 *
 * Not providing a required/necessary property will throw [IllegalStateException]
 */


fun configure ( action : ( T ) -> Unit )

{ <EOL> val configure = this . configure <EOL> if ( configure == null ) this . configure = action <EOL> else this . configure = { configure ( it ) ; action ( it ) } <EOL> }

/**
 * Generic configuration that will be invoked when building the target.
 * This configuration is called right after creating the instance and before
 * publishing the target to all subscribers of `kotlin.targets.all {}`
 */


fun configureIdeImport ( action : IdeMultiplatformImport . ( ) -> Unit )

{ <EOL> val configureIdeImport = this . configureIdeImport <EOL> if ( configureIdeImport == null ) this . configureIdeImport = action <EOL> else this . configureIdeImport = { configureIdeImport ( ) ; action ( ) } <EOL> }

/**
 * Main entrance of configuring the ide import:
 * The [IdeMultiplatformImport] instance passed to this function shall
 * not be captured and used outside of this block.
 *
 * The [IdeMultiplatformImport] instance shall not be retrieved any other way than using this function.
 */


internal fun build ( ) : ExternalKotlinTargetDescriptor < T >

= ExternalKotlinTargetDescriptorImpl ( targetName = targetName , platformType = platformType , targetFactory = targetFactory , apiElements = apiElements . build ( ) , runtimeElements = runtimeElements . build ( ) , sourcesElements = sourcesElements . build ( ) , apiElementsPublished = apiElementsPublished . build ( ) , runtimeElementsPublished = runtimeElementsPublished . build ( ) , sourcesElementsPublished = sourcesElementsPublished . build ( ) , configure = configure , configureIdeImport = configureIdeImport )


private fun foo_class ( c : Any , x : Int , i : Int ) : Int

{ <EOL> var x = x <EOL> if ( c is C0 ) x += i <EOL> if ( c is C1 ) x = x xor i <EOL> if ( c is C2 ) x += i <EOL> if ( c is C3 ) x = x xor i <EOL> if ( c is C4 ) x += i <EOL> if ( c is C5 ) x = x xor i <EOL> if ( c is C6 ) x += i <EOL> if ( c is C7 ) x = x xor i <EOL> if ( c is C8 ) x += i <EOL> if ( c is C9 ) x = x xor i <EOL> return x <EOL> }


private fun foo_iface ( c : Any , x : Int , i : Int ) : Int

{ <EOL> var x = x <EOL> if ( c is I0 ) x += i <EOL> if ( c is I1 ) x = x xor i <EOL> if ( c is I2 ) x += i <EOL> if ( c is I3 ) x = x xor i <EOL> if ( c is I4 ) x += i <EOL> if ( c is I5 ) x = x xor i <EOL> if ( c is I6 ) x += i <EOL> if ( c is I7 ) x = x xor i <EOL> if ( c is I8 ) x += i <EOL> if ( c is I9 ) x = x xor i <EOL> return x <EOL> }


{ <EOL> val c0 : Any = C0 ( ) <EOL> val c1 : Any = C1 ( ) <EOL> val c2 : Any = C2 ( ) <EOL> val c3 : Any = C3 ( ) <EOL> val c4 : Any = C4 ( ) <EOL> val c5 : Any = C5 ( ) <EOL> val c6 : Any = C6 ( ) <EOL> val c7 : Any = C7 ( ) <EOL> val c8 : Any = C8 ( ) <EOL> val c9 : Any = C9 ( ) <EOL> var x = <NUM_LIT:0> <EOL> for ( i in <NUM_LIT:0> until RUNS ) { <EOL> x += foo_class ( c0 , x , i ) <EOL> x += foo_class ( c1 , x , i ) <EOL> x += foo_class ( c2 , x , i ) <EOL> x += foo_class ( c3 , x , i ) <EOL> x += foo_class ( c4 , x , i ) <EOL> x += foo_class ( c5 , x , i ) <EOL> x += foo_class ( c6 , x , i ) <EOL> x += foo_class ( c7 , x , i ) <EOL> x += foo_class ( c8 , x , i ) <EOL> x += foo_class ( c9 , x , i ) <EOL> } <EOL> return x <EOL> }


{ <EOL> val c0 : Any = C0 ( ) <EOL> val c1 : Any = C1 ( ) <EOL> val c2 : Any = C2 ( ) <EOL> val c3 : Any = C3 ( ) <EOL> val c4 : Any = C4 ( ) <EOL> val c5 : Any = C5 ( ) <EOL> val c6 : Any = C6 ( ) <EOL> val c7 : Any = C7 ( ) <EOL> val c8 : Any = C8 ( ) <EOL> val c9 : Any = C9 ( ) <EOL> var x = <NUM_LIT:0> <EOL> for ( i in <NUM_LIT:0> until RUNS ) { <EOL> x += foo_iface ( c0 , x , i ) <EOL> x += foo_iface ( c1 , x , i ) <EOL> x += foo_iface ( c2 , x , i ) <EOL> x += foo_iface ( c3 , x , i ) <EOL> x += foo_iface ( c4 , x , i ) <EOL> x += foo_iface ( c5 , x , i ) <EOL> x += foo_iface ( c6 , x , i ) <EOL> x += foo_iface ( c7 , x , i ) <EOL> x += foo_iface ( c8 , x , i ) <EOL> x += foo_iface ( c9 , x , i ) <EOL> } <EOL> return x <EOL> }


= NOARG_COMPILER_PLUGIN_ID


override fun isApplicable ( project : MavenProject , execution : MojoExecution )

= true


override fun getPluginOptions ( project : MavenProject , execution : MojoExecution ) : List < PluginOption >

{ <EOL> logger . debug ( "<STR_LIT>" + javaClass . name ) <EOL> return emptyList ( ) <EOL> }


= true


{ <EOL> logger . debug ( "<STR_LIT>" + javaClass . name ) <EOL> return listOf ( PluginOption ( "<STR_LIT>" , NOARG_COMPILER_PLUGIN_ID , PRESET_ARG_NAME , "<STR_LIT>" ) ) <EOL> }


override fun analyze ( graph : ControlFlowGraph , reporter : DiagnosticReporter , context : CheckerContext )

{ <EOL> val logicSystem = object : LogicSystem ( context . session . typeContext ) { <EOL> override val variableStorage : VariableStorageImpl <EOL> get ( ) = throw IllegalStateException ( "<STR_LIT>" ) <EOL> } <EOL> analyze ( graph , reporter , context , logicSystem ) <EOL> }


private fun analyze ( graph : ControlFlowGraph , reporter : DiagnosticReporter , context : CheckerContext , logicSystem : LogicSystem )

{ <EOL> for ( subGraph in graph . subGraphs ) { <EOL> analyze ( subGraph , reporter , context ) <EOL> } <EOL> val function = graph . declaration as? FirFunction ? : return <EOL> if ( function !is FirContractDescriptionOwner ) return <EOL> val contractDescription = function . contractDescription ? : return <EOL> val effects = contractDescription . effects ? : return <EOL> val dataFlowInfo = function . controlFlowGraphReference ? . dataFlowInfo ? : return <EOL> val argumentIdentifiers = Array ( function . valueParameters . size + <NUM_LIT:1> ) { i -> <EOL> val parameterSymbol = if ( i > <NUM_LIT:0> ) { <EOL> function . valueParameters [ i - <NUM_LIT:1> ] . symbol <EOL> } else { <EOL> if ( function . symbol is FirPropertyAccessorSymbol ) { <EOL> context . containingProperty ? . symbol <EOL> } else { <EOL> null <EOL> } ? : function . symbol <EOL> } <EOL> Identifier ( parameterSymbol , null , null ) <EOL> } <EOL> for ( firEffect in effects ) { <EOL> val coneEffect = firEffect . effect as? ConeConditionalEffectDeclaration ? : continue <EOL> val returnValue = coneEffect . effect as? ConeReturnsEffectDeclaration ? : continue <EOL> val wrongCondition = graph . exitNode . previousCfgNodes . any { <EOL> isWrongConditionOnNode ( it , coneEffect , returnValue , function , logicSystem , dataFlowInfo , argumentIdentifiers , context ) <EOL> } <EOL> if ( wrongCondition ) { <EOL> reporter . reportOn ( firEffect . source , FirErrors . WRONG_IMPLIES_CONDITION , context ) <EOL> } <EOL> } <EOL> }


private fun isWrongConditionOnNode ( node : CFGNode < * > , effectDeclaration : ConeConditionalEffectDeclaration , effect : ConeReturnsEffectDeclaration , function : FirFunction , logicSystem : LogicSystem , dataFlowInfo : DataFlowInfo , argumentIdentifiers : Array < Identifier > , context : CheckerContext ) : Boolean

{ <EOL> val builtinTypes = context . session . builtinTypes <EOL> val typeContext = context . session . typeContext <EOL> val isReturn = node is JumpNode && node . fir is FirReturnExpression <EOL> @ Suppress ( "<STR_LIT>" ) <EOL> val resultExpression = if ( isReturn ) ( node . fir as FirReturnExpression ) . result else node . fir <EOL> val expressionType = ( resultExpression as? FirExpression ) ? . resolvedType <EOL> if ( expressionType == builtinTypes . nothingType . type ) return false <EOL> if ( isReturn && resultExpression is FirWhenExpression ) { <EOL> return node . collectBranchExits ( ) . any { <EOL> isWrongConditionOnNode ( it , effectDeclaration , effect , function , logicSystem , dataFlowInfo , argumentIdentifiers , context ) <EOL> } <EOL> } <EOL> var flow = node . flow <EOL> val operation = effect . value . toOperation ( ) <EOL> if ( operation != null ) { <EOL> if ( resultExpression is FirLiteralExpression < * > ) { <EOL> if ( ! operation . isTrueFor ( resultExpression . value ) ) return false <EOL> } else { <EOL> if ( expressionType != null && ! operation . canBeTrueFor ( context . session , expressionType ) ) return false <EOL> val variableStorage = dataFlowInfo . variableStorage as VariableStorageImpl <EOL> val resultVar = <EOL> variableStorage . getOrCreateIfReal ( resultExpression , unwrapAlias = { variable , _ -> flow . unwrapVariable ( variable ) } ) <EOL> if ( resultVar != null ) { <EOL> val impliedByReturnValue = logicSystem . approveOperationStatement ( flow , OperationStatement ( resultVar , operation ) ) <EOL> if ( impliedByReturnValue . isNotEmpty ( ) ) { <EOL> flow = flow . fork ( ) . also { logicSystem . addTypeStatements ( it , impliedByReturnValue ) } . freeze ( ) <EOL> } <EOL> } <EOL> } <EOL> } <EOL> val knownVariables = flow . knownVariables . associateBy { it . identifier } <EOL> val argumentVariables = Array ( argumentIdentifiers . size ) { i -> <EOL> val identifier = argumentIdentifiers [ i ] <EOL> knownVariables [ identifier ] ? : RealVariable ( identifier , i == <NUM_LIT:0> , null , i , PropertyStability . STABLE_VALUE ) <EOL> } <EOL> val conditionStatements = logicSystem . approveContractStatement ( effectDeclaration . condition , argumentVariables , substitutor = null ) { logicSystem . approveOperationStatement ( flow , it ) } ? : return true <EOL> return ! conditionStatements . values . all { requirement -> <EOL> val originalType = requirement . variable . identifier . symbol . correspondingParameterType ? : return@all true <EOL> val requiredType = requirement . smartCastedType ( typeContext , originalType ) <EOL> val actualType = flow . getTypeStatement ( requirement . variable ) . smartCastedType ( typeContext , originalType ) <EOL> actualType . isSubtypeOf ( typeContext , requiredType ) <EOL> } <EOL> }


private fun Operation . canBeTrueFor ( session : FirSession , type : ConeKotlinType ) : Boolean

= when ( this ) { <EOL> Operation . EqTrue , Operation . EqFalse -> <EOL> AbstractTypeChecker . isSubtypeOf ( session . typeContext , session . builtinTypes . booleanType . type , type ) <EOL> Operation . EqNull -> type . canBeNull ( session ) <EOL> Operation . NotEqNull -> ! type . isNullableNothing <EOL> }


private fun Operation . isTrueFor ( value : Any ? )

= when ( this ) { <EOL> Operation . EqTrue -> value == true <EOL> Operation . EqFalse -> value == false <EOL> Operation . EqNull -> value == null <EOL> Operation . NotEqNull -> value != null <EOL> }


private fun CFGNode < * > . collectBranchExits ( nodes : MutableList < CFGNode < * > > = mutableListOf ( ) ) : List < CFGNode < * > >

{ <EOL> if ( this is BlockExitNode ) { <EOL> nodes += previousCfgNodes <EOL> } else previousCfgNodes . forEach { it . collectBranchExits ( nodes ) } <EOL> return nodes <EOL> }


internal fun GradleBuild . runAndCheck ( steps : List < TestExecutionStep > )

{ <EOL> logInfo ( """<STR_LIT>""" . trimIndent ( ) ) <EOL> steps . forEachIndexed { i , step -> <EOL> val description = "<STR_LIT>" <EOL> when ( step ) { <EOL> is TestGradleStep -> { <EOL> val runResult = this . runWithParams ( step . args ) <EOL> createCheckerContext ( runResult ) . check ( description , step . errorExpected , step . checker ) <EOL> } <EOL> is TestFileEditStep -> { <EOL> val file = projectFile ( step . filePath , description ) <EOL> if ( ! file . exists ( ) ) { <EOL> throw Exception ( "<STR_LIT>" ) <EOL> } <EOL> val content = file . readText ( ) <EOL> val newContent = step . editor ( content ) <EOL> file . writeText ( newContent ) <EOL> } <EOL> is TestFileAddStep -> { <EOL> val file = projectFile ( step . filePath , description ) <EOL> file . writeText ( step . editor ( ) ) <EOL> } <EOL> is TestFileDeleteStep -> { <EOL> val file = projectFile ( step . filePath , description ) <EOL> file . delete ( ) <EOL> } <EOL> } <EOL> } <EOL> }


private fun GradleBuild . projectFile ( path : String , description : String ) : File

{ <EOL> if ( File ( path ) . isAbsolute ) { <EOL> throw Exception ( "<STR_LIT>" ) <EOL> } <EOL> return targetDir . resolve ( path ) <EOL> }


private fun File . buildScript ( ) : String

{ <EOL> var file = this . resolve ( "<STR_LIT>" ) <EOL> if ( file . exists ( ) && file . isFile ) return file . readText ( ) <EOL> file = this . resolve ( "<STR_LIT>" ) <EOL> if ( file . exists ( ) && file . isFile ) return file . readText ( ) <EOL> return "<STR_LIT>" <EOL> }


{ <EOL> if ( deleteOnExit ) { <EOL> dir . deleteRecursively ( ) <EOL> } <EOL> }


private fun createDirForTemporaryFiles ( path : String ) : File

{ <EOL> if ( File ( path ) . isFile ) { <EOL> throw IllegalArgumentException ( "<STR_LIT>" ) <EOL> } <EOL> return File ( path ) . apply { <EOL> if ( ! exists ) { mkdirs ( ) } <EOL> } <EOL> }


fun create ( prefix : String , suffix : String = "<STR_LIT>" ) : File

= <EOL> File ( dir , "<STR_LIT>" )

/**
 * Create file named {name}{suffix} inside temporary dir
 */


@ Test <EOL> fun vgg11OnCifar10ExportImportToTxtTest ( )

{ <EOL> vgg11OnCifar10ExportImport ( ) <EOL> }


{ <EOL> repeat ( <NUM_LIT:100> ) { <EOL> assertEquals ( <NUM_LIT:0> , subject . nextBits ( <NUM_LIT:0> ) ) <EOL> } <EOL> for ( bitCount in <NUM_LIT:1> .. <NUM_LIT> ) { <EOL> val upperBitCount = <NUM_LIT> - bitCount <EOL> var result1 = <NUM_LIT:0> <EOL> var result2 = - <NUM_LIT:1> <EOL> repeat ( <NUM_LIT> ) { <EOL> val bits = subject . nextBits ( bitCount ) <EOL> result1 = result1 or bits <EOL> result2 = result2 and bits <EOL> assertEquals ( <NUM_LIT:0> , bits . ushr ( bitCount - <NUM_LIT:1> ) . ushr ( <NUM_LIT:1> ) , "<STR_LIT>" ) <EOL> } <EOL> assertEquals ( <NUM_LIT:1> . shl ( bitCount - <NUM_LIT:1> ) . shl ( <NUM_LIT:1> ) - <NUM_LIT:1> , result1 , "<STR_LIT>" ) <EOL> assertEquals ( <NUM_LIT:0> , result2 , "<STR_LIT>" ) <EOL> } <EOL> }


{ <EOL> var result1 = <NUM_LIT:0> <EOL> var result2 = - <NUM_LIT:1> <EOL> repeat ( <NUM_LIT> ) { <EOL> val r = subject . nextInt ( ) <EOL> result1 = result1 or r <EOL> result2 = result2 and r <EOL> } <EOL> assertEquals ( - <NUM_LIT:1> , result1 , "<STR_LIT>" ) <EOL> assertEquals ( <NUM_LIT:0> , result2 , "<STR_LIT>" ) <EOL> }


{ <EOL> var result1 = <NUM_LIT> <EOL> var result2 = UInt . MAX_VALUE <EOL> repeat ( <NUM_LIT> ) { <EOL> val r = subject . nextUInt ( ) <EOL> result1 = result1 or r <EOL> result2 = result2 and r <EOL> } <EOL> assertEquals ( UInt . MAX_VALUE , result1 , "<STR_LIT>" ) <EOL> assertEquals ( <NUM_LIT> , result2 , "<STR_LIT>" ) <EOL> }


{ <EOL> assertFailsWith < IllegalArgumentException > { subject . nextInt ( <NUM_LIT:0> ) } <EOL> assertFailsWith < IllegalArgumentException > { subject . nextInt ( - <NUM_LIT:1> ) } <EOL> assertFailsWith < IllegalArgumentException > { subject . nextInt ( Int . MIN_VALUE ) } <EOL> repeat ( <NUM_LIT> ) { <EOL> assertEquals ( <NUM_LIT:0> , subject . nextInt ( <NUM_LIT:1> ) ) <EOL> } <EOL> for ( bound in listOf ( <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:7> , <NUM_LIT:16> , <NUM_LIT> , <NUM_LIT> , Int . MAX_VALUE ) ) { <EOL> repeat ( <NUM_LIT> ) { <EOL> val x = subject . nextInt ( bound ) <EOL> if ( x !in <NUM_LIT:0> until bound ) <EOL> fail ( "<STR_LIT>" ) <EOL> } <EOL> } <EOL> }


{ <EOL> assertFailsWith < IllegalArgumentException > { subject . nextUInt ( UInt . MIN_VALUE ) } <EOL> repeat ( <NUM_LIT> ) { <EOL> assertEquals ( <NUM_LIT> , subject . nextUInt ( <NUM_LIT:1u> ) ) <EOL> } <EOL> for ( bound in listOf ( <NUM_LIT> , <NUM_LIT:3u> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , UInt . MAX_VALUE ) ) { <EOL> repeat ( <NUM_LIT> ) { <EOL> val x = subject . nextUInt ( bound ) <EOL> if ( x !in <NUM_LIT> until bound ) <EOL> fail ( "<STR_LIT>" ) <EOL> } <EOL> } <EOL> }


{ <EOL> assertFailsWith < IllegalArgumentException > { subject . nextInt ( <NUM_LIT:0> , <NUM_LIT:0> ) } <EOL> assertFailsWith < IllegalArgumentException > { subject . nextInt ( - <NUM_LIT:1> , - <NUM_LIT:2> ) } <EOL> assertFailsWith < IllegalArgumentException > { subject . nextInt ( Int . MIN_VALUE , Int . MIN_VALUE ) } <EOL> for ( n in Int . MIN_VALUE until Int . MAX_VALUE step <NUM_LIT> ) { <EOL> assertEquals ( n , subject . nextInt ( n , n + <NUM_LIT:1> ) ) <EOL> } <EOL> ( Int . MAX_VALUE - <NUM_LIT:1> ) . let { n -> <EOL> assertEquals ( n , subject . nextInt ( n , n + <NUM_LIT:1> ) ) <EOL> } <EOL> for ( ( from , until ) in listOf ( ( <NUM_LIT:0> to <NUM_LIT:2> ) , ( - <NUM_LIT:1> to <NUM_LIT:5> ) , ( <NUM_LIT:0> to <NUM_LIT> ) , ( <NUM_LIT:0> to Int . MAX_VALUE ) , ( - <NUM_LIT:1> to Int . MAX_VALUE ) , ( Int . MIN_VALUE to Int . MAX_VALUE ) ) ) { <EOL> repeat ( <NUM_LIT> ) { <EOL> val x = subject . nextInt ( from , until ) <EOL> if ( x !in from until until ) <EOL> fail ( "<STR_LIT>" ) <EOL> } <EOL> } <EOL> }


{ <EOL> assertFailsWith < IllegalArgumentException > { subject . nextUInt ( <NUM_LIT> , <NUM_LIT> ) } <EOL> assertFailsWith < IllegalArgumentException > { subject . nextUInt ( ( - <NUM_LIT:1> ) . toUInt ( ) , ( - <NUM_LIT:2> ) . toUInt ( ) ) } <EOL> assertFailsWith < IllegalArgumentException > { subject . nextUInt ( UInt . MIN_VALUE , UInt . MIN_VALUE ) } <EOL> for ( n in UInt . MIN_VALUE until UInt . MAX_VALUE step <NUM_LIT> ) { <EOL> assertEquals ( n , subject . nextUInt ( n , n + <NUM_LIT:1u> ) ) <EOL> } <EOL> ( UInt . MAX_VALUE - <NUM_LIT:1u> ) . let { n -> <EOL> assertEquals ( n , subject . nextUInt ( n , n + <NUM_LIT:1u> ) ) <EOL> } <EOL> for ( ( from , until ) in listOf ( ( <NUM_LIT> to <NUM_LIT> ) , ( <NUM_LIT:1u> to <NUM_LIT> ) , ( <NUM_LIT> to <NUM_LIT> ) , ( <NUM_LIT> to UInt . MAX_VALUE ) , ( <NUM_LIT:1u> to ( Int . MAX_VALUE . toUInt ( ) + <NUM_LIT:1u> ) ) , ( UInt . MIN_VALUE to UInt . MAX_VALUE ) ) ) { <EOL> repeat ( <NUM_LIT> ) { <EOL> val x = subject . nextUInt ( from , until ) <EOL> if ( x !in from until until ) <EOL> fail ( "<STR_LIT>" ) <EOL> } <EOL> } <EOL> }


@ Suppress ( "<STR_LIT>" ) <EOL> @ Test <EOL> fun nextIntInIntRange ( )

{ <EOL> assertFailsWith < IllegalArgumentException > { subject . nextInt ( <NUM_LIT:0> until <NUM_LIT:0> ) } <EOL> assertFailsWith < IllegalArgumentException > { subject . nextInt ( - <NUM_LIT:1> .. Int . MIN_VALUE ) } <EOL> assertFailsWith < IllegalArgumentException > { subject . nextInt ( Int . MAX_VALUE until Int . MAX_VALUE ) } <EOL> repeat ( <NUM_LIT> ) { n -> <EOL> assertEquals ( n , subject . nextInt ( n .. n ) ) <EOL> } <EOL> for ( range in listOf ( ( <NUM_LIT:0> until <NUM_LIT:2> ) , ( - <NUM_LIT:1> until <NUM_LIT:5> ) , ( <NUM_LIT:0> until <NUM_LIT> ) , ( <NUM_LIT:0> until Int . MAX_VALUE ) , ( <NUM_LIT:0> .. Int . MAX_VALUE ) , ( Int . MIN_VALUE .. <NUM_LIT:0> ) , ( Int . MIN_VALUE .. Int . MAX_VALUE ) ) ) { <EOL> repeat ( <NUM_LIT> ) { <EOL> val x = subject . nextInt ( range ) <EOL> if ( x !in range ) <EOL> fail ( "<STR_LIT>" ) <EOL> } <EOL> } <EOL> }


@ Test <EOL> fun nextUIntInUIntRange ( )

{ <EOL> assertFailsWith < IllegalArgumentException > { subject . nextUInt ( <NUM_LIT:1u> .. <NUM_LIT> ) } <EOL> assertFailsWith < IllegalArgumentException > { subject . nextUInt ( UInt . MAX_VALUE .. UInt . MIN_VALUE ) } <EOL> assertFailsWith < IllegalArgumentException > { subject . nextUInt ( UInt . MAX_VALUE .. ( UInt . MAX_VALUE - <NUM_LIT:1u> ) ) } <EOL> repeat ( <NUM_LIT> ) { it -> <EOL> val n = it . toUInt ( ) <EOL> assertEquals ( n , subject . nextUInt ( n .. n ) ) <EOL> } <EOL> for ( range in listOf ( ( <NUM_LIT> .. <NUM_LIT:1u> ) , ( <NUM_LIT:1u> .. <NUM_LIT> ) , ( <NUM_LIT> .. <NUM_LIT> ) , ( <NUM_LIT> .. UInt . MAX_VALUE - <NUM_LIT:1u> ) , ( <NUM_LIT:1u> .. UInt . MAX_VALUE ) , ( <NUM_LIT> .. UInt . MAX_VALUE ) ) ) { <EOL> repeat ( <NUM_LIT> ) { <EOL> val x = subject . nextUInt ( range ) <EOL> if ( x !in range ) <EOL> fail ( "<STR_LIT>" ) <EOL> } <EOL> } <EOL> }


{ <EOL> var result1 = <NUM_LIT:0L> <EOL> var result2 = - <NUM_LIT:1L> <EOL> repeat ( <NUM_LIT> ) { <EOL> val r = subject . nextLong ( ) <EOL> result1 = result1 or r <EOL> result2 = result2 and r <EOL> } <EOL> assertEquals ( - <NUM_LIT:1> , result1 , "<STR_LIT>" ) <EOL> assertEquals ( <NUM_LIT:0> , result2 , "<STR_LIT>" ) <EOL> }


{ <EOL> var result1 = <NUM_LIT> <EOL> var result2 = ULong . MAX_VALUE <EOL> repeat ( <NUM_LIT> ) { <EOL> val r = subject . nextULong ( ) <EOL> result1 = result1 or r <EOL> result2 = result2 and r <EOL> } <EOL> assertEquals ( ULong . MAX_VALUE , result1 , "<STR_LIT>" ) <EOL> assertEquals ( <NUM_LIT> , result2 , "<STR_LIT>" ) <EOL> }


{ <EOL> assertFailsWith < IllegalArgumentException > { subject . nextLong ( <NUM_LIT:0> ) } <EOL> assertFailsWith < IllegalArgumentException > { subject . nextLong ( - <NUM_LIT:1> ) } <EOL> assertFailsWith < IllegalArgumentException > { subject . nextLong ( Long . MIN_VALUE ) } <EOL> repeat ( <NUM_LIT> ) { <EOL> assertEquals ( <NUM_LIT:0L> , subject . nextLong ( <NUM_LIT:1> ) ) <EOL> } <EOL> for ( bound in listOf ( <NUM_LIT:2> , <NUM_LIT:23> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , Long . MAX_VALUE ) ) { <EOL> repeat ( <NUM_LIT> ) { <EOL> val x = subject . nextLong ( bound ) <EOL> if ( x !in <NUM_LIT:0L> until bound ) <EOL> fail ( "<STR_LIT>" ) <EOL> } <EOL> } <EOL> }


{ <EOL> assertFailsWith < IllegalArgumentException > { subject . nextULong ( ULong . MIN_VALUE ) } <EOL> repeat ( <NUM_LIT> ) { <EOL> assertEquals ( <NUM_LIT> , subject . nextULong ( <NUM_LIT> ) ) <EOL> } <EOL> for ( bound in listOf ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , ULong . MAX_VALUE ) ) { <EOL> repeat ( <NUM_LIT> ) { <EOL> val x = subject . nextULong ( bound ) <EOL> if ( x !in <NUM_LIT> until bound ) { <EOL> fail ( "<STR_LIT>" ) <EOL> } <EOL> } <EOL> } <EOL> }


{ <EOL> assertFailsWith < IllegalArgumentException > { subject . nextLong ( <NUM_LIT:0> , <NUM_LIT:0> ) } <EOL> assertFailsWith < IllegalArgumentException > { subject . nextLong ( - <NUM_LIT:1> , - <NUM_LIT:2> ) } <EOL> assertFailsWith < IllegalArgumentException > { subject . nextLong ( Long . MIN_VALUE , Long . MIN_VALUE ) } <EOL> for ( i in - <NUM_LIT> .. <NUM_LIT> ) { <EOL> val n = <NUM_LIT> + i <EOL> assertEquals ( n , subject . nextLong ( n , n + <NUM_LIT:1> ) ) <EOL> } <EOL> for ( ( from , until ) in listOf ( ( <NUM_LIT:0L> to <NUM_LIT> ) , ( - <NUM_LIT:1L> to <NUM_LIT> ) , ( <NUM_LIT:0L> to <NUM_LIT> ) , ( - <NUM_LIT> to <NUM_LIT> ) , ( <NUM_LIT:0L> to Long . MAX_VALUE ) , ( - <NUM_LIT:1L> to Long . MAX_VALUE ) , ( Long . MIN_VALUE to Long . MAX_VALUE ) ) ) { <EOL> repeat ( <NUM_LIT> ) { <EOL> val x = subject . nextLong ( from , until ) <EOL> if ( x !in from until until ) <EOL> fail ( "<STR_LIT>" ) <EOL> } <EOL> } <EOL> }