private inline fun < reified PSI : PsiElement > KtSymbol . kotlinAndJavaSourcePsiSafe ( ) : PSI ?

{ <EOL> val sourcePsi = when ( origin ) { <EOL> KtSymbolOrigin . SOURCE -> this . psi <EOL> KtSymbolOrigin . JAVA -> this . psi <EOL> KtSymbolOrigin . SOURCE_MEMBER_GENERATED -> null <EOL> KtSymbolOrigin . LIBRARY -> null <EOL> KtSymbolOrigin . SAM_CONSTRUCTOR -> null <EOL> KtSymbolOrigin . INTERSECTION_OVERRIDE -> null <EOL> KtSymbolOrigin . SUBSTITUTION_OVERRIDE -> null <EOL> KtSymbolOrigin . DELEGATED -> null <EOL> KtSymbolOrigin . JAVA_SYNTHETIC_PROPERTY -> null <EOL> KtSymbolOrigin . PROPERTY_BACKING_FIELD -> null <EOL> KtSymbolOrigin . PLUGIN -> null <EOL> KtSymbolOrigin . JS_DYNAMIC -> null <EOL> } <EOL> return sourcePsi as? PSI <EOL> }


private fun findPsiElement ( sourceSet : DokkaSourceSet , fqLink : String ) : PsiElement ?

{ <EOL> return samplesKotlinAnalysis . findPsiElement ( sourceSet , fqLink ) <EOL> ? : projectKotlinAnalysis . findPsiElement ( sourceSet , fqLink ) <EOL> }


private fun KotlinAnalysis . findPsiElement ( sourceSet : DokkaSourceSet , fqLink : String ) : PsiElement ?

{ <EOL> val ktSourceModule = this . getModuleOrNull ( sourceSet ) ? : return null <EOL> return analyze ( ktSourceModule ) { <EOL> resolveKDocTextLinkToSymbol ( fqLink ) <EOL> ? . kotlinAndJavaSourcePsiSafe ( ) <EOL> } <EOL> }


private fun processImports ( psiElement : PsiElement , sampleRewriter : SampleRewriter ? ) : List < String >

{ <EOL> val psiFile = psiElement . containingFile <EOL> val importsList = ( psiFile as? KtFile ) ? . importList ? : return emptyList ( ) <EOL> return importsList . imports <EOL> . map { it . text . removePrefix ( "<STR_LIT>" ) } <EOL> . filter { it . isNotBlank ( ) } <EOL> . applyIf ( sampleRewriter != null ) { <EOL> mapNotNull { sampleRewriter ? . rewriteImportDirective ( it ) } <EOL> } <EOL> }


private fun processBody ( sampleElement : KtDeclarationWithBody ) : String

{ <EOL> return getSampleBody ( sampleElement ) <EOL> . trim { it == '<CHAR_LIT:\n>' || it == '<CHAR_LIT:\r>' } <EOL> . trimEnd ( ) <EOL> . trimIndent ( ) <EOL> }


private fun getSampleBody ( psiElement : KtDeclarationWithBody ) : String

{ <EOL> val bodyExpression = psiElement . bodyExpression <EOL> val bodyExpressionText = bodyExpression ! ! . buildSampleText ( ) <EOL> return when ( bodyExpression ) { <EOL> is KtBlockExpression -> bodyExpressionText . removeSurrounding ( "<STR_LIT>" , "<STR_LIT:}>" ) <EOL> else -> bodyExpressionText <EOL> } <EOL> }


private fun PsiElement . buildSampleText ( ) : String

{ <EOL> if ( sampleRewriter == null ) return this . text <EOL> val textBuilder = StringBuilder ( ) <EOL> val errors = mutableListOf < SampleBuilder . ConvertError > ( ) <EOL> this . accept ( SampleBuilder ( sampleRewriter , textBuilder , errors ) ) <EOL> errors . forEach { <EOL> val st = it . e . stackTraceToString ( ) <EOL> dokkaLogger . warn ( "<STR_LIT>" ) <EOL> } <EOL> return textBuilder . toString ( ) <EOL> }


override fun visitCallExpression ( expression : KtCallExpression )

{ <EOL> val callRewriter = expression . calleeExpression ? . text ? . let { sampleRewriter . getFunctionCallRewriter ( it ) } <EOL> if ( callRewriter != null ) { <EOL> val rewrittenResult = callRewriter . rewrite ( arguments = expression . valueArguments . map { it . text ? : "<STR_LIT>" } , typeArguments = expression . typeArguments . map { it . text ? : "<STR_LIT>" } ) <EOL> textBuilder . append ( rewrittenResult ) <EOL> } else { <EOL> super . visitCallExpression ( expression ) <EOL> } <EOL> }


private fun reportProblemConvertingElement ( element : PsiElement , e : Exception )

{ <EOL> val text = element . text <EOL> val document = PsiDocumentManager . getInstance ( element . project ) . getDocument ( element . containingFile ) <EOL> val lineInfo = if ( document != null ) { <EOL> val lineNumber = document . getLineNumber ( element . startOffset ) <EOL> "<STR_LIT>" <EOL> } else { <EOL> "<STR_LIT>" <EOL> } <EOL> errors += ConvertError ( e , text , lineInfo ) <EOL> }


{ <EOL> if ( element is LeafPsiElement ) { <EOL> textBuilder . append ( element . text ) <EOL> return <EOL> } <EOL> element . acceptChildren ( object : PsiElementVisitor ( ) { <EOL> override fun visitElement ( element : PsiElement ) { <EOL> try { <EOL> element . accept ( this @ SampleBuilder ) <EOL> } catch ( e : Exception ) { <EOL> try { <EOL> reportProblemConvertingElement ( element , e ) <EOL> } finally { <EOL> textBuilder . append ( element . text ) <EOL> } <EOL> } <EOL> } <EOL> } ) <EOL> }


fun getReferenceVariants ( simpleNameExpression : KtSimpleNameExpression , kindFilter : DescriptorKindFilter , nameFilter : ( Name ) -> Boolean , javaProject : IJavaProject , ktFile : KtFile , file : IFile , identifierPart : String ? <EOL> ) : Collection < KotlinBasicCompletionProposal >

{ <EOL> val callTypeAndReceiver = CallTypeAndReceiver . detect ( simpleNameExpression ) <EOL> var variants : Collection < KotlinBasicCompletionProposal > = <EOL> getReferenceVariants ( simpleNameExpression , callTypeAndReceiver , kindFilter , nameFilter , javaProject , ktFile , file , identifierPart ) . filter { <EOL> ! resolutionFacade . frontendService < DeprecationResolver > ( ) . isHiddenInResolution ( it . descriptor ) && <EOL> visibilityFilter ( it . descriptor ) <EOL> } <EOL> val tempFilter = ShadowedDeclarationsFilter . create ( bindingContext , resolutionFacade , simpleNameExpression , callTypeAndReceiver ) <EOL> if ( tempFilter != null ) { <EOL> variants = variants . mapNotNull { <EOL> if ( tempFilter . filter ( listOf ( it . descriptor ) ) . isEmpty ( ) ) null else it <EOL> } <EOL> } <EOL> return variants . filter { kindFilter . accepts ( it . descriptor ) } <EOL> }


private fun getVariantsForImportOrPackageDirective ( receiverExpression : KtExpression ? , kindFilter : DescriptorKindFilter , nameFilter : ( Name ) -> Boolean ) : Collection < DeclarationDescriptor >

{ <EOL> if ( receiverExpression != null ) { <EOL> val qualifier = bindingContext [ BindingContext . QUALIFIER , receiverExpression ] ? : return emptyList ( ) <EOL> val staticDescriptors = qualifier . staticScope . collectStaticMembers ( resolutionFacade , kindFilter , nameFilter ) <EOL> val objectDescriptor = ( qualifier as? ClassQualifier ) ? . descriptor ? . takeIf { it . kind == ClassKind . OBJECT } <EOL> ? : return staticDescriptors <EOL> return staticDescriptors + objectDescriptor . defaultType . memberScope . getDescriptorsFiltered ( kindFilter , nameFilter ) <EOL> } else { <EOL> val rootPackage = resolutionFacade . moduleDescriptor . getPackage ( FqName . ROOT ) <EOL> return rootPackage . memberScope . getDescriptorsFiltered ( kindFilter , nameFilter ) <EOL> } <EOL> }


private fun getVariantsForUserType ( receiverExpression : KtExpression ? , contextElement : PsiElement , kindFilter : DescriptorKindFilter , nameFilter : ( Name ) -> Boolean ) : Collection < DeclarationDescriptor >

{ <EOL> if ( receiverExpression != null ) { <EOL> val qualifier = bindingContext [ BindingContext . QUALIFIER , receiverExpression ] ? : return emptyList ( ) <EOL> return qualifier . staticScope . collectStaticMembers ( resolutionFacade , kindFilter , nameFilter ) <EOL> } else { <EOL> val scope = contextElement . getResolutionScope ( bindingContext , resolutionFacade ) <EOL> return scope . collectDescriptorsFiltered ( kindFilter , nameFilter , changeNamesForAliased = true ) <EOL> } <EOL> }


private fun getVariantsForCallableReference ( callTypeAndReceiver : CallTypeAndReceiver . CALLABLE_REFERENCE , contextElement : PsiElement , useReceiverType : KotlinType ? , kindFilter : DescriptorKindFilter , nameFilter : ( Name ) -> Boolean ) : Collection < KotlinBasicCompletionProposal >

{ <EOL> val descriptors = LinkedHashSet < KotlinBasicCompletionProposal > ( ) <EOL> val resolutionScope = contextElement . getResolutionScope ( bindingContext , resolutionFacade ) <EOL> val receiver = callTypeAndReceiver . receiver <EOL> if ( receiver != null ) { <EOL> val isStatic = bindingContext [ BindingContext . DOUBLE_COLON_LHS , receiver ] is DoubleColonLHS . Type <EOL> val explicitReceiverTypes : Collection < KotlinType > = useReceiverType ? . let { <EOL> listOf ( useReceiverType ) <EOL> } ? : callTypeAndReceiver . receiverTypes ( bindingContext , contextElement , moduleDescriptor , resolutionFacade , stableSmartCastsOnly = false ) ! ! <EOL> val constructorFilter = { descriptor : ClassDescriptor -> if ( isStatic ) true else descriptor . isInner } <EOL> descriptors . addNonExtensionMembers ( explicitReceiverTypes , kindFilter , nameFilter , constructorFilter ) <EOL> descriptors . addScopeAndSyntheticExtensions ( resolutionScope , explicitReceiverTypes , CallType . CALLABLE_REFERENCE , kindFilter , nameFilter ) <EOL> if ( isStatic ) { <EOL> explicitReceiverTypes <EOL> . mapNotNull { ( it . constructor . declarationDescriptor as? ClassDescriptor ) ? . staticScope } <EOL> . flatMapTo ( descriptors ) { scope -> <EOL> scope . collectStaticMembers ( resolutionFacade , kindFilter , nameFilter ) <EOL> . map { KotlinBasicCompletionProposal . Descriptor ( it ) } <EOL> } <EOL> } <EOL> } else { <EOL> descriptors . addNonExtensionCallablesAndConstructors ( resolutionScope , kindFilter , nameFilter , constructorFilter = { ! it . isInner } , classesOnly = false ) <EOL> } <EOL> return descriptors <EOL> }


private fun getReferenceVariants ( simpleNameExpression : KtSimpleNameExpression , callTypeAndReceiver : CallTypeAndReceiver < * , * > , kindFilter : DescriptorKindFilter , nameFilter : ( Name ) -> Boolean , javaProject : IJavaProject , ktFile : KtFile , file : IFile , identifierPart : String ? <EOL> ) : Collection < KotlinBasicCompletionProposal >

{ <EOL> val callType = callTypeAndReceiver . callType <EOL> @ Suppress ( "<STR_LIT>" ) <EOL> val kindFilter = kindFilter . intersect ( callType . descriptorKindFilter ) <EOL> val receiverExpression : KtExpression ? <EOL> when ( callTypeAndReceiver ) { <EOL> is CallTypeAndReceiver . IMPORT_DIRECTIVE -> { <EOL> return getVariantsForImportOrPackageDirective ( callTypeAndReceiver . receiver , kindFilter , nameFilter ) <EOL> . map { KotlinBasicCompletionProposal . Descriptor ( it ) } <EOL> } <EOL> is CallTypeAndReceiver . PACKAGE_DIRECTIVE -> { <EOL> return getVariantsForImportOrPackageDirective ( callTypeAndReceiver . receiver , kindFilter , nameFilter ) <EOL> . map { KotlinBasicCompletionProposal . Descriptor ( it ) } <EOL> } <EOL> is CallTypeAndReceiver . TYPE -> { <EOL> return getVariantsForUserType ( callTypeAndReceiver . receiver , simpleNameExpression , kindFilter , nameFilter ) . map { KotlinBasicCompletionProposal . Descriptor ( it ) } <EOL> } <EOL> is CallTypeAndReceiver . ANNOTATION -> { <EOL> return getVariantsForUserType ( callTypeAndReceiver . receiver , simpleNameExpression , kindFilter , nameFilter ) . map { KotlinBasicCompletionProposal . Descriptor ( it ) } <EOL> } <EOL> is CallTypeAndReceiver . CALLABLE_REFERENCE -> { <EOL> return getVariantsForCallableReference ( callTypeAndReceiver , simpleNameExpression , null , kindFilter , nameFilter ) <EOL> } <EOL> is CallTypeAndReceiver . DEFAULT -> receiverExpression = null <EOL> is CallTypeAndReceiver . DOT -> receiverExpression = callTypeAndReceiver . receiver <EOL> is CallTypeAndReceiver . SUPER_MEMBERS -> receiverExpression = callTypeAndReceiver . receiver <EOL> is CallTypeAndReceiver . SAFE -> receiverExpression = callTypeAndReceiver . receiver <EOL> is CallTypeAndReceiver . INFIX -> receiverExpression = callTypeAndReceiver . receiver <EOL> is CallTypeAndReceiver . OPERATOR -> return emptyList ( ) <EOL> is CallTypeAndReceiver . UNKNOWN -> return emptyList ( ) <EOL> else -> throw RuntimeException ( ) <EOL> } <EOL> val resolutionScope = simpleNameExpression . getResolutionScope ( bindingContext , resolutionFacade ) <EOL> val dataFlowInfo = bindingContext . getDataFlowInfoBefore ( simpleNameExpression ) <EOL> val containingDeclaration = resolutionScope . ownerDescriptor <EOL> val smartCastManager = resolutionFacade . frontendService < SmartCastManager > ( ) <EOL> val languageVersionSettings = resolutionFacade . frontendService < LanguageVersionSettings > ( ) <EOL> val implicitReceiverTypes = resolutionScope . getImplicitReceiversWithInstance ( languageVersionSettings . supportsFeature ( LanguageFeature . DslMarkersSupport ) ) . flatMap { <EOL> smartCastManager . getSmartCastVariantsWithLessSpecificExcluded ( it . value , bindingContext , containingDeclaration , dataFlowInfo , languageVersionSettings , resolutionFacade . frontendService ( ) ) <EOL> } . toSet ( ) <EOL> val descriptors = LinkedHashSet < KotlinBasicCompletionProposal > ( ) <EOL> val filterWithoutExtensions = kindFilter exclude DescriptorKindExclude . Extensions <EOL> if ( receiverExpression != null ) { <EOL> val qualifier = bindingContext [ BindingContext . QUALIFIER , receiverExpression ] <EOL> if ( qualifier != null ) { <EOL> descriptors . addAll ( qualifier . staticScope . collectStaticMembers ( resolutionFacade , filterWithoutExtensions , nameFilter ) . map { KotlinBasicCompletionProposal . Descriptor ( it ) } ) <EOL> } <EOL> val explicitReceiverTypes = callTypeAndReceiver . receiverTypes ( bindingContext , simpleNameExpression , moduleDescriptor , resolutionFacade , stableSmartCastsOnly = false ) ! ! <EOL> descriptors . processAll ( implicitReceiverTypes , explicitReceiverTypes , resolutionScope , callType , kindFilter , nameFilter , javaProject , ktFile , file , identifierPart , false ) <EOL> } else { <EOL> descriptors . processAll ( implicitReceiverTypes , implicitReceiverTypes , resolutionScope , callType , kindFilter , nameFilter , javaProject , ktFile , file , identifierPart , true ) <EOL> descriptors . addAll ( resolutionScope . collectDescriptorsFiltered ( filterWithoutExtensions , nameFilter , changeNamesForAliased = true ) . map { KotlinBasicCompletionProposal . Descriptor ( it ) } ) <EOL> } <EOL> if ( callType == CallType . SUPER_MEMBERS ) { <EOL> return descriptors . filterIsInstance < KotlinBasicCompletionProposal . Descriptor > ( ) <EOL> . flatMapTo ( LinkedHashSet < KotlinBasicCompletionProposal > ( ) ) { descriptor -> <EOL> if ( descriptor . descriptor is CallableMemberDescriptor && descriptor . descriptor . kind == CallableMemberDescriptor . Kind . FAKE_OVERRIDE ) { <EOL> descriptor . descriptor . overriddenDescriptors . map { KotlinBasicCompletionProposal . Descriptor ( it ) } <EOL> } else { <EOL> listOf ( descriptor ) <EOL> } <EOL> } <EOL> } <EOL> return descriptors . distinctBy { ( it . descriptor as? ImportedFromObjectCallableDescriptor < * > ) ? . callableFromObject ? : it . descriptor } <EOL> }


private fun MutableSet < KotlinBasicCompletionProposal > . processAll ( implicitReceiverTypes : Collection < KotlinType > , receiverTypes : Collection < KotlinType > , resolutionScope : LexicalScope , callType : CallType < * > , kindFilter : DescriptorKindFilter , nameFilter : ( Name ) -> Boolean , javaProject : IJavaProject , ktFile : KtFile , file : IFile , identifierPart : String ? , allowNoReceiver : Boolean )

{ <EOL> runBlocking { <EOL> val tempJobs = mutableListOf < Job > ( ) <EOL> tempJobs += KotlinEclipseScope . launch { <EOL> addNonExtensionMembers ( receiverTypes , kindFilter , nameFilter , constructorFilter = { it . isInner } ) <EOL> } <EOL> tempJobs += KotlinEclipseScope . launch { <EOL> addMemberExtensions ( implicitReceiverTypes , receiverTypes , callType , kindFilter , nameFilter ) <EOL> } <EOL> tempJobs += KotlinEclipseScope . launch { <EOL> addNotImportedTopLevelCallables ( receiverTypes , kindFilter , nameFilter , javaProject , ktFile , file , identifierPart , allowNoReceiver ) <EOL> println ( "<STR_LIT>" ) <EOL> } <EOL> tempJobs += KotlinEclipseScope . launch { <EOL> addScopeAndSyntheticExtensions ( resolutionScope , receiverTypes , callType , kindFilter , nameFilter ) <EOL> } <EOL> tempJobs . joinAll ( ) <EOL> } <EOL> }


private suspend fun MutableSet < KotlinBasicCompletionProposal > . addNotImportedTopLevelCallables ( receiverTypes : Collection < KotlinType > , kindFilter : DescriptorKindFilter , nameFilter : ( Name ) -> Boolean , javaProject : IJavaProject , ktFile : KtFile , file : IFile , identifierPart : String ? , allowNoReceiver : Boolean )

{ <EOL> if ( ! identifierPart . isNullOrBlank ( ) ) { <EOL> val searchEngine = SearchEngine ( ) <EOL> val dependencyProjects = arrayListOf < IJavaProject > ( ) . apply { <EOL> addAll ( ProjectUtils . getDependencyProjects ( javaProject ) . map { JavaCore . create ( it ) } ) <EOL> add ( javaProject ) <EOL> } <EOL> val javaProjectSearchScope = <EOL> JavaSearchScopeFactory . getInstance ( ) . createJavaSearchScope ( dependencyProjects . toTypedArray ( ) , false ) <EOL> val tempClassNames = hashMapOf < String , String > ( ) <EOL> val collector = object : MethodNameMatchRequestor ( ) { <EOL> override fun acceptMethodNameMatch ( match : MethodNameMatch ) { <EOL> if ( Flags . isPublic ( match . modifiers ) ) { <EOL> tempClassNames [ match . method . declaringType . getTypeQualifiedName ( '<CHAR_LIT:.>' ) ] = <EOL> match . method . declaringType . packageFragment . elementName <EOL> } <EOL> } <EOL> } <EOL> searchEngine . searchAllMethodNames ( null , SearchPattern . R_EXACT_MATCH , null , SearchPattern . R_EXACT_MATCH , null , SearchPattern . R_EXACT_MATCH , identifierPart . toCharArray ( ) , SearchPattern . R_PREFIX_MATCH , javaProjectSearchScope , collector , IJavaSearchConstants . FORCE_IMMEDIATE_SEARCH , null ) <EOL> val tempCapitalIdentifier = <EOL> identifierPart . replaceFirstChar { if ( it . isLowerCase ( ) ) it . titlecase ( Locale . getDefault ( ) ) else it . toString ( ) } <EOL> searchEngine . searchAllMethodNames ( null , SearchPattern . R_EXACT_MATCH , null , SearchPattern . R_EXACT_MATCH , null , SearchPattern . R_EXACT_MATCH , "<STR_LIT>" . toCharArray ( ) , SearchPattern . R_PREFIX_MATCH , javaProjectSearchScope , collector , IJavaSearchConstants . FORCE_IMMEDIATE_SEARCH , null ) <EOL> val tempPackages = mutableListOf < PackageViewDescriptor > ( ) <EOL> val tempClasses = tempClassNames . mapNotNull { ( className , packageName ) -> <EOL> val tempClassId = ClassId ( FqName ( packageName ) , FqName ( className ) , false ) <EOL> moduleDescriptor . findClassAcrossModuleDependencies ( tempClassId ) ? : run { <EOL> tempPackages . add ( resolutionFacade . moduleDescriptor . getPackage ( FqName ( packageName ) ) ) <EOL> null <EOL> } <EOL> } <EOL> val importsSet = ktFile . importDirectives <EOL> . mapNotNull { it . importedFqName ? . asString ( ) } <EOL> . toSet ( ) <EOL> val originPackage = ktFile . packageFqName . asString ( ) <EOL> fun MemberScope . filterByKindAndName ( ) = getDescriptorsFiltered ( kindFilter . intersect ( CALLABLES ) , nameFilter ) . asSequence ( ) <EOL> . filterIsInstance < CallableDescriptor > ( ) <EOL> . filter { callDesc -> <EOL> val tempFuzzy = callDesc . fuzzyExtensionReceiverType ( ) <EOL> val anyReceiverMatch = tempFuzzy != null && receiverTypes . any { receiverType -> <EOL> tempFuzzy . checkIsSuperTypeOf ( receiverType ) != null <EOL> } <EOL> val isTopLevelOrObjectCallable = callDesc . isTopLevelInPackage ( ) || ( callDesc . containingDeclaration as? ClassDescriptor ) ? . let { containing -> <EOL> val tempContainingKotlinType = containing . classValueType <EOL> val tempIsObject = containing . kind == ClassKind . OBJECT <EOL> val tempContainingIsReceiver = tempContainingKotlinType != null && receiverTypes . any { receiver -> receiver . isSubtypeOf ( tempContainingKotlinType ) } <EOL> tempIsObject && ! tempContainingIsReceiver <EOL> } == true <EOL> val noReceiverMatches = allowNoReceiver && tempFuzzy == null && isTopLevelOrObjectCallable <EOL> noReceiverMatches || anyReceiverMatch <EOL> } <EOL> . filter { callDesc -> <EOL> callDesc . importableFqName ? . asString ( ) !in importsSet && <EOL> callDesc . importableFqName ? . parent ( ) ? . asString ( ) != originPackage <EOL> } . toList ( ) <EOL> val tempDeferreds = <EOL> tempPackages . map { desc -> KotlinEclipseScope . async { desc . memberScope . filterByKindAndName ( ) } } + <EOL> tempClasses . map { desc -> KotlinEclipseScope . async { desc . unsubstitutedMemberScope . filterByKindAndName ( ) } } <EOL> val tempDescriptors = tempDeferreds . awaitAll ( ) . flatten ( ) <EOL> tempDescriptors <EOL> . map { <EOL> KotlinBasicCompletionProposal . Proposal ( KotlinImportCallableCompletionProposal ( it , KotlinImageProvider . getImage ( it ) , file , identifierPart ) , it ) <EOL> } . toCollection ( this ) <EOL> } <EOL> }


private fun MutableSet < KotlinBasicCompletionProposal > . addMemberExtensions ( dispatchReceiverTypes : Collection < KotlinType > , extensionReceiverTypes : Collection < KotlinType > , callType : CallType < * > , kindFilter : DescriptorKindFilter , nameFilter : ( Name ) -> Boolean , )

{ <EOL> val memberFilter = kindFilter exclude DescriptorKindExclude . NonExtensions <EOL> for ( dispatchReceiverType in dispatchReceiverTypes ) { <EOL> for ( member in dispatchReceiverType . memberScope . getDescriptorsFiltered ( memberFilter , nameFilter ) ) { <EOL> addAll ( ( member as CallableDescriptor ) . substituteExtensionIfCallable ( extensionReceiverTypes , callType ) . map { KotlinBasicCompletionProposal . Descriptor ( it ) } ) <EOL> } <EOL> } <EOL> }


private fun MutableSet < KotlinBasicCompletionProposal > . addNonExtensionMembers ( receiverTypes : Collection < KotlinType > , kindFilter : DescriptorKindFilter , nameFilter : ( Name ) -> Boolean , constructorFilter : ( ClassDescriptor ) -> Boolean )

{ <EOL> for ( receiverType in receiverTypes ) { <EOL> addNonExtensionCallablesAndConstructors ( receiverType . memberScope . memberScopeAsImportingScope ( ) , kindFilter , nameFilter , constructorFilter , false ) <EOL> receiverType . constructor . supertypes . forEach { <EOL> addNonExtensionCallablesAndConstructors ( it . memberScope . memberScopeAsImportingScope ( ) , kindFilter , nameFilter , constructorFilter , true ) <EOL> } <EOL> } <EOL> }


private fun MutableSet < KotlinBasicCompletionProposal > . addNonExtensionCallablesAndConstructors ( scope : HierarchicalScope , kindFilter : DescriptorKindFilter , nameFilter : ( Name ) -> Boolean , constructorFilter : ( ClassDescriptor ) -> Boolean , classesOnly : Boolean )

{ <EOL> var filterToUse = DescriptorKindFilter ( kindFilter . kindMask and CALLABLES . kindMask ) . exclude ( DescriptorKindExclude . Extensions ) <EOL> if ( filterToUse . acceptsKinds ( FUNCTIONS_MASK ) ) { <EOL> filterToUse = filterToUse . withKinds ( DescriptorKindFilter . NON_SINGLETON_CLASSIFIERS_MASK ) <EOL> } <EOL> for ( descriptor in scope . collectDescriptorsFiltered ( filterToUse , nameFilter , changeNamesForAliased = true ) ) { <EOL> if ( descriptor is ClassDescriptor ) { <EOL> if ( descriptor . modality == Modality . ABSTRACT || descriptor . modality == Modality . SEALED ) continue <EOL> if ( ! constructorFilter ( descriptor ) ) continue <EOL> descriptor . constructors . map { KotlinBasicCompletionProposal . Descriptor ( it ) } <EOL> . filterTo ( this ) { kindFilter . accepts ( it . descriptor ) } <EOL> } else if ( ! classesOnly && kindFilter . accepts ( descriptor ) ) { <EOL> this . add ( KotlinBasicCompletionProposal . Descriptor ( descriptor ) ) <EOL> } <EOL> } <EOL> }


private fun MutableSet < KotlinBasicCompletionProposal > . addScopeAndSyntheticExtensions ( scope : LexicalScope , receiverTypes : Collection < KotlinType > , callType : CallType < * > , kindFilter : DescriptorKindFilter , nameFilter : ( Name ) -> Boolean )

{ <EOL> if ( kindFilter . excludes . contains ( DescriptorKindExclude . Extensions ) ) return <EOL> if ( receiverTypes . isEmpty ( ) ) return <EOL> fun process ( extensionOrSyntheticMember : CallableDescriptor ) { <EOL> if ( kindFilter . accepts ( extensionOrSyntheticMember ) && nameFilter ( extensionOrSyntheticMember . name ) ) { <EOL> if ( extensionOrSyntheticMember . isExtension ) { <EOL> addAll ( extensionOrSyntheticMember . substituteExtensionIfCallable ( receiverTypes , callType ) . map { KotlinBasicCompletionProposal . Descriptor ( it ) } ) <EOL> } else { <EOL> add ( KotlinBasicCompletionProposal . Descriptor ( extensionOrSyntheticMember ) ) <EOL> } <EOL> } <EOL> } <EOL> for ( descriptor in scope . collectDescriptorsFiltered ( kindFilter exclude DescriptorKindExclude . NonExtensions , nameFilter , changeNamesForAliased = true ) ) { <EOL> process ( descriptor as CallableDescriptor ) <EOL> } <EOL> val syntheticScopes = resolutionFacade . getFrontendService ( SyntheticScopes :: class . java ) <EOL> if ( kindFilter . acceptsKinds ( VARIABLES_MASK ) ) { <EOL> val lookupLocation = <EOL> ( scope . ownerDescriptor . toSourceElement . getPsi ( ) as? KtElement ) ? . let { KotlinLookupLocation ( it ) } <EOL> ? : NoLookupLocation . FROM_IDE <EOL> for ( extension in syntheticScopes . collectSyntheticExtensionProperties ( receiverTypes , lookupLocation ) ) { <EOL> process ( extension ) <EOL> } <EOL> } <EOL> if ( kindFilter . acceptsKinds ( FUNCTIONS_MASK ) ) { <EOL> for ( syntheticMember in syntheticScopes . collectSyntheticMemberFunctions ( receiverTypes ) ) { <EOL> process ( syntheticMember ) <EOL> } <EOL> } <EOL> }


private fun < TDescriptor : DeclarationDescriptor > filterOutJavaGettersAndSetters ( variants : Collection < TDescriptor > ) : Collection < TDescriptor >

{ <EOL> val accessorMethodsToRemove = HashSet < FunctionDescriptor > ( ) <EOL> val filteredVariants = variants . filter { it !is SyntheticJavaPropertyDescriptor } <EOL> for ( variant in filteredVariants ) { <EOL> if ( variant is SyntheticJavaPropertyDescriptor ) { <EOL> accessorMethodsToRemove . add ( variant . getMethod . original ) <EOL> val setter = variant . setMethod <EOL> if ( setter != null && setter . returnType ? . isUnit ( ) == true ) { <EOL> accessorMethodsToRemove . add ( setter . original ) <EOL> } <EOL> } <EOL> } <EOL> return filteredVariants . filter { it !is FunctionDescriptor || it . original !in accessorMethodsToRemove } <EOL> }


private fun excludeNonInitializedVariable ( variants : Collection < DeclarationDescriptor > , contextElement : PsiElement ) : Collection < DeclarationDescriptor >

{ <EOL> for ( element in contextElement . parentsWithSelf ) { <EOL> val parent = element . parent <EOL> if ( parent is KtVariableDeclaration && element == parent . initializer ) { <EOL> return variants . filter { it . findPsi ( ) != parent } <EOL> } <EOL> if ( element is KtDeclaration ) break <EOL> } <EOL> return variants <EOL> }


private fun MemberScope . collectStaticMembers ( resolutionFacade : ResolutionFacade , kindFilter : DescriptorKindFilter , nameFilter : ( Name ) -> Boolean ) : Collection < DeclarationDescriptor >

{ <EOL> return getDescriptorsFiltered ( kindFilter , nameFilter ) + collectSyntheticStaticMembersAndConstructors ( resolutionFacade , kindFilter , nameFilter ) <EOL> }


@ OptIn ( FrontendInternals :: class ) <EOL> fun ResolutionScope . collectSyntheticStaticMembersAndConstructors ( resolutionFacade : ResolutionFacade , kindFilter : DescriptorKindFilter , nameFilter : ( Name ) -> Boolean ) : List < FunctionDescriptor >

{ <EOL> val syntheticScopes = resolutionFacade . getFrontendService ( SyntheticScopes :: class . java ) <EOL> val functionDescriptors = this . getContributedDescriptors ( DescriptorKindFilter . FUNCTIONS ) <EOL> val classifierDescriptors = this . getContributedDescriptors ( DescriptorKindFilter . CLASSIFIERS ) <EOL> return ( syntheticScopes . collectSyntheticStaticFunctions ( functionDescriptors ) + syntheticScopes . collectSyntheticConstructors ( classifierDescriptors ) ) <EOL> . filter { kindFilter . accepts ( it ) && nameFilter ( it . name ) } <EOL> }


@ OptIn ( FrontendInternals :: class ) <EOL> private inline fun < reified T : Any > ResolutionFacade . frontendService ( ) : T

= this . getFrontendService ( T :: class . java )


{ <EOL> foo ( :: prop ) <EOL> }


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


{ <EOL> var i : Int ? <EOL> i = <NUM_LIT:10> <EOL> val j = ++ i <EOL> return if ( j == <NUM_LIT:11> && <NUM_LIT:11> == i ) "<STR_LIT:OK>" else "<STR_LIT>" <EOL> }


public fun < T > xBegin ( column : ColumnReference < T > ) : PositionalMapping < T >

{ <EOL> return addPositionalMapping < T > ( X_BEGIN , column . name ( ) , null ) <EOL> }

/**
 * Maps the `xBegin` aesthetic to a data column by [ColumnReference].
 *
 * @param column the data column to be mapped.
 * @return a [PositionalMapping] object representing the mapping.
 */


public fun < T > xBegin ( column : KProperty < T > ) : PositionalMapping < T >

{ <EOL> return addPositionalMapping < T > ( X_BEGIN , column . name , null ) <EOL> }

/**
 * Maps the `xBegin` aesthetic to a data column by [KProperty].
 *
 * @param column the data column to be mapped.
 * @return a [PositionalMapping] object representing the mapping.
 */


public fun xBegin ( column : String ) : PositionalMapping < Any ? >

{ <EOL> return addPositionalMapping ( X_BEGIN , column , null ) <EOL> }

/**
 * Maps the `xBegin` aesthetic to a data column by [String].
 *
 * @param column the data column to be mapped.
 * @return a [PositionalMapping] object representing the mapping.
 */


public fun < T > xBegin ( values : Iterable < T > ) : PositionalMapping < T >

{ <EOL> return addPositionalMapping < T > ( X_BEGIN , values . toList ( ) , null , null ) <EOL> }

/**
 * Maps the `xBegin` aesthetic to iterable of values.
 *
 * @param values the iterable of values to be mapped.
 * @return a [PositionalMapping] object representing the mapping.
 */


public fun < T > xBegin ( values : DataColumn < T > ) : PositionalMapping < T >

{ <EOL> return addPositionalMapping < T > ( X_BEGIN , values , null ) <EOL> }

/**
 * Maps the `xBegin` aesthetic to a data column.
 *
 * @param values the data column to be mapped.
 * @return a [PositionalMapping] object representing the mapping.
 */


private fun parse ( input : String ) : JsonElement

= default . decodeFromString ( JsonElement . serializer ( ) , input )


@ Test <EOL> fun testParseWithoutExceptions ( )

{ <EOL> val input = """<STR_LIT>""" <EOL> parse ( input ) <EOL> }


{ <EOL> val v = JsonPrimitive ( "<STR_LIT:foo>" ) <EOL> assertEquals ( v , parse ( "<STR_LIT>" ) ) <EOL> }


{ <EOL> val input = """<STR_LIT>""" <EOL> val elem = parse ( input ) <EOL> assertTrue ( elem is JsonObject ) <EOL> assertEquals ( setOf ( "<STR_LIT:a>" , "<STR_LIT:b>" , "<STR_LIT:c>" , "<STR_LIT:d>" ) , elem . keys ) <EOL> assertEquals ( JsonPrimitive ( "<STR_LIT:foo>" ) , elem [ "<STR_LIT:a>" ] ) <EOL> assertEquals ( <NUM_LIT:10> , elem [ "<STR_LIT:b>" ] ? . jsonPrimitive ? . int ) <EOL> assertEquals ( true , elem [ "<STR_LIT:c>" ] ? . jsonPrimitive ? . boolean ) <EOL> assertSame ( elem . getValue ( "<STR_LIT:d>" ) as JsonNull , JsonNull ) <EOL> }


@ Test <EOL> fun testJsonObjectWithArrays ( )

{ <EOL> val input = """<STR_LIT>""" <EOL> val elem = parse ( input ) <EOL> assertTrue ( elem is JsonObject ) <EOL> assertEquals ( setOf ( "<STR_LIT:a>" , "<STR_LIT:b>" , "<STR_LIT:c>" ) , elem . keys ) <EOL> assertTrue ( elem . getValue ( "<STR_LIT:c>" ) is JsonArray ) <EOL> val array = elem . getValue ( "<STR_LIT:c>" ) . jsonArray <EOL> assertEquals ( "<STR_LIT:foo>" , array . getOrNull ( <NUM_LIT:0> ) ? . jsonPrimitive ? . content ) <EOL> assertEquals ( <NUM_LIT> , array . getOrNull ( <NUM_LIT:1> ) ? . jsonPrimitive ? . int ) <EOL> assertTrue ( array [ <NUM_LIT:2> ] is JsonObject ) <EOL> val third = array [ <NUM_LIT:2> ] . jsonObject <EOL> assertEquals ( "<STR_LIT:baz>" , third . getValue ( "<STR_LIT:bar>" ) . jsonPrimitive . content ) <EOL> }


{ <EOL> val input = """<STR_LIT>""" <EOL> val elem = parse ( input ) <EOL> val json = elem . toString ( ) <EOL> assertEquals ( input , json ) <EOL> }


{ <EOL> val input = """<STR_LIT>""" <EOL> val parsed = parse ( input ) <EOL> val parsed2 = parse ( input ) <EOL> val handCrafted = buildJsonObject { put ( "<STR_LIT:a>" , JsonPrimitive ( "<STR_LIT:foo>" ) ) ; put ( "<STR_LIT:b>" , JsonPrimitive ( <NUM_LIT:10> ) ) } <EOL> assertEquals ( parsed , parsed2 ) <EOL> assertEquals ( parsed , handCrafted ) <EOL> }


{ <EOL> val input = """<STR_LIT>""" <EOL> val parsed = parse ( input ) as JsonObject <EOL> val handCrafted = buildJsonObject { put ( "<STR_LIT:a>" , JsonPrimitive ( "<STR_LIT:10>" ) ) ; put ( "<STR_LIT:b>" , JsonPrimitive ( <NUM_LIT:10> ) ) } <EOL> assertEquals ( parsed , handCrafted ) <EOL> assertNotEquals ( parsed [ "<STR_LIT:a>" ] , parsed [ "<STR_LIT:b>" ] ) <EOL> assertNotEquals ( parsed [ "<STR_LIT:a>" ] , handCrafted [ "<STR_LIT:b>" ] ) <EOL> assertNotEquals ( handCrafted [ "<STR_LIT:a>" ] , parsed [ "<STR_LIT:b>" ] ) <EOL> assertNotEquals ( handCrafted [ "<STR_LIT:a>" ] , handCrafted [ "<STR_LIT:b>" ] ) <EOL> }


@ Test <EOL> fun testExceptionalState ( )

{ <EOL> val tree = <EOL> JsonObject ( mapOf ( "<STR_LIT:a>" to JsonPrimitive ( <NUM_LIT:42> ) , "<STR_LIT:b>" to JsonArray ( listOf ( JsonNull ) ) , "<STR_LIT:c>" to JsonPrimitive ( false ) ) ) <EOL> assertFailsWith < NoSuchElementException > { tree . getValue ( "<STR_LIT>" ) . jsonObject } <EOL> assertFailsWith < IllegalArgumentException > { tree . getValue ( "<STR_LIT:a>" ) . jsonArray } <EOL> assertEquals ( null , tree [ "<STR_LIT>" ] ? . jsonObject ) <EOL> assertEquals ( null , tree [ "<STR_LIT:a>" ] as? JsonArray ) <EOL> val n = tree . getValue ( "<STR_LIT:b>" ) . jsonArray [ <NUM_LIT:0> ] . jsonPrimitive <EOL> assertFailsWith < NumberFormatException > { n . int } <EOL> assertEquals ( null , n . intOrNull ) <EOL> assertFailsWith < IllegalStateException > { n . boolean } <EOL> assertEquals ( null , n . booleanOrNull ) <EOL> }


@ Test <EOL> fun testThatJsonArraysCompareWithLists ( )

{ <EOL> val jsonArray : List < JsonElement > = JsonArray ( listOf ( JsonPrimitive ( <NUM_LIT:3> ) , JsonPrimitive ( <NUM_LIT:4> ) ) ) <EOL> val arrayList : List < JsonElement > = ArrayList ( listOf ( JsonPrimitive ( <NUM_LIT:3> ) , JsonPrimitive ( <NUM_LIT:4> ) ) ) <EOL> val otherArrayList : List < JsonElement > = ArrayList ( listOf ( JsonPrimitive ( <NUM_LIT:3> ) , JsonPrimitive ( <NUM_LIT:5> ) ) ) <EOL> assertEquals ( jsonArray , arrayList ) <EOL> assertEquals ( arrayList , jsonArray ) <EOL> assertEquals ( jsonArray . hashCode ( ) , arrayList . hashCode ( ) ) <EOL> assertNotEquals ( jsonArray , otherArrayList ) <EOL> }


@ Test <EOL> fun testThatJsonObjectsCompareWithMaps ( )

{ <EOL> val jsonObject : Map < String , JsonElement > = JsonObject ( mapOf ( "<STR_LIT>" to JsonPrimitive ( <NUM_LIT:3> ) , "<STR_LIT>" to JsonPrimitive ( <NUM_LIT:4> ) ) ) <EOL> val hashMap : Map < String , JsonElement > = HashMap ( mapOf ( "<STR_LIT>" to JsonPrimitive ( <NUM_LIT:3> ) , "<STR_LIT>" to JsonPrimitive ( <NUM_LIT:4> ) ) ) <EOL> val otherJsonObject : Map < String , JsonElement > = JsonObject ( mapOf ( "<STR_LIT>" to JsonPrimitive ( <NUM_LIT:3> ) , "<STR_LIT>" to JsonPrimitive ( <NUM_LIT:5> ) ) ) <EOL> val otherHashMap : Map < String , JsonElement > = HashMap ( mapOf ( "<STR_LIT>" to JsonPrimitive ( <NUM_LIT:3> ) , "<STR_LIT>" to JsonPrimitive ( <NUM_LIT:5> ) ) ) <EOL> assertEquals ( jsonObject , hashMap ) <EOL> assertEquals ( hashMap , jsonObject ) <EOL> assertEquals ( jsonObject . hashCode ( ) , hashMap . hashCode ( ) ) <EOL> assertNotEquals ( jsonObject , otherHashMap ) <EOL> assertNotEquals ( jsonObject , otherJsonObject ) <EOL> }


= TODO ( )


override fun contains ( element : UInt ) : Boolean

= TODO ( )


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

= TODO ( )


@ Test <EOL> fun testBackpressureDropDirect ( )

= runTest { <EOL> expect ( <NUM_LIT:1> ) <EOL> Flux . fromArray ( arrayOf ( <NUM_LIT:1> ) ) <EOL> . onBackpressureDrop ( ) <EOL> . collect { <EOL> assertEquals ( <NUM_LIT:1> , it ) <EOL> expect ( <NUM_LIT:2> ) <EOL> } <EOL> finish ( <NUM_LIT:3> ) <EOL> }


@ Test <EOL> fun testBackpressureDropFlow ( )

= runTest { <EOL> expect ( <NUM_LIT:1> ) <EOL> Flux . fromArray ( arrayOf ( <NUM_LIT:1> ) ) <EOL> . onBackpressureDrop ( ) <EOL> . asFlow ( ) <EOL> . collect { <EOL> assertEquals ( <NUM_LIT:1> , it ) <EOL> expect ( <NUM_LIT:2> ) <EOL> } <EOL> finish ( <NUM_LIT:3> ) <EOL> }


@ Test <EOL> fun testCooperativeCancellation ( )

= runTest { <EOL> val flow = Flux . fromIterable ( ( <NUM_LIT:0L> .. Long . MAX_VALUE ) ) . asFlow ( ) <EOL> flow . onEach { if ( it > <NUM_LIT:10> ) currentCoroutineContext ( ) . cancel ( ) } . launchIn ( this + Dispatchers . Default ) . join ( ) <EOL> }


@ Test <EOL> fun testCooperativeCancellationForBuffered ( )

= runTest ( expected = { it is CancellationException } ) { <EOL> val flow = Flux . fromIterable ( ( <NUM_LIT:0L> .. Long . MAX_VALUE ) ) . asFlow ( ) <EOL> val channel = flow . onEach { if ( it > <NUM_LIT:10> ) currentCoroutineContext ( ) . cancel ( ) } . produceIn ( this + Dispatchers . Default ) <EOL> channel . consumeEach { } <EOL> }


@ Suppress ( "<STR_LIT>" ) <EOL> private fun source ( signature : String )

= <EOL> """<STR_LIT>""" . trimIndent ( )


@ Test <EOL> fun `fun with definitely non-nullable types as java` ( )

{ <EOL> val source = source ( "<STR_LIT>" ) <EOL> val writerPlugin = TestOutputWriterPlugin ( ) <EOL> testInline ( source , configuration , pluginOverrides = listOf ( writerPlugin ) ) { <EOL> renderingStage = { _ , _ -> <EOL> val signature = writerPlugin . writer . renderedContent ( "<STR_LIT>" ) . firstSignature ( ) <EOL> signature . match ( "<STR_LIT>" , Span ( "<STR_LIT:T>" ) , A ( "<STR_LIT>" ) , "<STR_LIT>" , A ( "<STR_LIT>" ) , "<STR_LIT>" , Span ( Span ( Span ( ) , "<STR_LIT>" ) , Span ( Span ( ) , "<STR_LIT>" ) ) , "<STR_LIT:)>" , ignoreSpanWithTokenStyle = true ) <EOL> } <EOL> } <EOL> }


@ Test <EOL> fun `should display annotations` ( )

{ <EOL> val writerPlugin = TestOutputWriterPlugin ( ) <EOL> testInline ( """<STR_LIT>""" . trimIndent ( ) , configuration , pluginOverrides = listOf ( writerPlugin ) ) { <EOL> renderingStage = { _ , _ -> <EOL> val signatures = writerPlugin . writer <EOL> . renderedContent ( "<STR_LIT>" ) <EOL> . signature ( ) <EOL> val classSignature = signatures [ <NUM_LIT:0> ] <EOL> classSignature . match ( Div ( Div ( "<STR_LIT:@>" , A ( "<STR_LIT>" ) , "<STR_LIT>" ) ) , "<STR_LIT>" , A ( "<STR_LIT>" ) , "<STR_LIT:<>" , Span ( "<STR_LIT:@>" , A ( "<STR_LIT>" ) , "<STR_LIT>" ) , "<STR_LIT>" , Span ( "<STR_LIT:@>" , A ( "<STR_LIT>" ) , "<STR_LIT>" ) , A ( "<STR_LIT>" ) , "<STR_LIT:>>" , ignoreSpanWithTokenStyle = true ) <EOL> val functionSignature = signatures [ <NUM_LIT:2> ] <EOL> functionSignature . match ( Div ( Div ( "<STR_LIT:@>" , A ( "<STR_LIT>" ) , "<STR_LIT>" ) ) , "<STR_LIT>" , A ( "<STR_LIT>" ) , A ( "<STR_LIT>" ) , "<STR_LIT:<>" , Span ( "<STR_LIT:@>" , A ( "<STR_LIT>" ) , "<STR_LIT>" ) , "<STR_LIT>" , Span ( "<STR_LIT:@>" , A ( "<STR_LIT>" ) , "<STR_LIT>" ) , A ( "<STR_LIT>" ) , "<STR_LIT>" , Span ( Span ( Span ( "<STR_LIT:@>" , A ( "<STR_LIT>" ) , "<STR_LIT>" ) , A ( "<STR_LIT:String>" ) , "<STR_LIT>" ) , Span ( A ( "<STR_LIT:String>" ) , "<STR_LIT>" ) ) , "<STR_LIT:)>" , ignoreSpanWithTokenStyle = true ) <EOL> } <EOL> } <EOL> }


override fun generateFunctions ( callableId : CallableId , context : MemberGenerationContext ? ) : List < FirNamedFunctionSymbol >

{ <EOL> val owner = context ? . owner ? : return emptyList ( ) <EOL> require ( owner is FirRegularClassSymbol ) <EOL> val function = when ( callableId . callableName ) { <EOL> DESCRIBE_CONTENTS_NAME -> { <EOL> val hasDescribeContentImplementation = owner . hasDescribeContentsImplementation ( ) || <EOL> lookupSuperTypes ( owner , lookupInterfaces = false , deep = true , session ) . any { <EOL> it . fullyExpandedType ( session ) . toRegularClassSymbol ( session ) ? . hasDescribeContentsImplementation ( ) ? : false <EOL> } <EOL> runIf ( ! hasDescribeContentImplementation ) { <EOL> createMemberFunctionForParcelize ( owner , callableId . callableName , session . builtinTypes . intType . type ) <EOL> } <EOL> } <EOL> WRITE_TO_PARCEL_NAME -> { <EOL> val declaredFunctions = owner . declarationSymbols . filterIsInstance < FirNamedFunctionSymbol > ( ) <EOL> runIf ( declaredFunctions . none { it . isWriteToParcel ( ) } ) { <EOL> createMemberFunctionForParcelize ( owner , callableId . callableName , session . builtinTypes . unitType . type ) { <EOL> valueParameter ( DEST_NAME , PARCEL_ID . createConeType ( session ) ) <EOL> valueParameter ( FLAGS_NAME , session . builtinTypes . intType . type ) <EOL> } <EOL> } <EOL> } <EOL> else -> null <EOL> } ? : return emptyList ( ) <EOL> return listOf ( function . symbol ) <EOL> }


private fun FirRegularClassSymbol . hasDescribeContentsImplementation ( ) : Boolean

{ <EOL> return declarationSymbols . filterIsInstance < FirNamedFunctionSymbol > ( ) . any { it . isDescribeContentsImplementation ( ) } <EOL> }


private fun FirNamedFunctionSymbol . isDescribeContentsImplementation ( ) : Boolean

{ <EOL> if ( name != DESCRIBE_CONTENTS_NAME ) return false <EOL> return valueParameterSymbols . isEmpty ( ) <EOL> }


private fun FirNamedFunctionSymbol . isWriteToParcel ( ) : Boolean

{ <EOL> if ( name != WRITE_TO_PARCEL_NAME ) return false <EOL> val parameterSymbols = valueParameterSymbols <EOL> if ( parameterSymbols . size != <NUM_LIT:2> ) return false <EOL> val ( destSymbol , flagsSymbol ) = parameterSymbols <EOL> if ( destSymbol . resolvedReturnTypeRef . coneType . classId != PARCEL_ID ) return false <EOL> if ( ! flagsSymbol . resolvedReturnTypeRef . type . isInt ) return false <EOL> return true <EOL> }


private inline fun createMemberFunctionForParcelize ( owner : FirRegularClassSymbol , name : Name , returnType : ConeKotlinType , crossinline init : SimpleFunctionBuildingContext . ( ) -> Unit = { } ) : FirSimpleFunction

{ <EOL> return createMemberFunction ( owner , key , name , returnType ) { <EOL> modality = if ( owner . modality == Modality . FINAL ) Modality . FINAL else Modality . OPEN <EOL> status { isOverride = true } <EOL> init ( ) <EOL> } <EOL> }


override fun getCallableNamesForClass ( classSymbol : FirClassSymbol < * > , context : MemberGenerationContext ) : Set < Name >

{ <EOL> return when { <EOL> classSymbol . rawStatus . modality == Modality . ABSTRACT || classSymbol . rawStatus . modality == Modality . SEALED -> emptySet ( ) <EOL> checkParcelizeClassSymbols ( classSymbol , session ) { it in matchedClasses } -> parcelizeMethodsNames <EOL> else -> emptySet ( ) <EOL> } <EOL> }


override fun FirDeclarationPredicateRegistrar . registerPredicates ( )

{ <EOL> register ( predicate ) <EOL> }


public fun getLabel ( dataSource : D ) : Float

/**
 * Returns a label for provided [dataSource].
 */


internal fun < D > LabelGenerator < D > . prepareY ( sources : Array < D > ) : FloatArray

{ <EOL> return FloatArray ( sources . size ) { getLabel ( sources [ it ] ) } <EOL> }


fun callDynType2 ( list : List < F2 > , param : AN )

{ <EOL> val fct = list . first ( ) <EOL> val ret = fct ( param , null ) <EOL> assertEquals ( param , ret ) <EOL> }


fun callStaticType2 ( fct : F2 , param : AN )

{ <EOL> val ret = fct ( param , null ) <EOL> assertEquals ( param , ret ) <EOL> }


fun callDynType32 ( list : List < F32 > , param : AN )

{ <EOL> val fct = list . first ( ) <EOL> val ret = fct ( param , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null ) <EOL> assertEquals ( param , ret ) <EOL> }


fun callStaticType32 ( fct : F32 , param : AN )

{ <EOL> val ret = fct ( param , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null ) <EOL> assertEquals ( param , ret ) <EOL> }


fun callDynType33 ( list : List < F33 > , param : AN )

{ <EOL> val fct = list . first ( ) <EOL> val ret = fct ( param , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null ) <EOL> assertEquals ( param , ret ) <EOL> }


fun callStaticType33 ( fct : F33 , param : AN )

{ <EOL> val ret = fct ( param , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null , null ) <EOL> assertEquals ( param , ret ) <EOL> }


= F2Holder ( { p1 , _ -> p1 } )


= { p1 , _ -> p1 }


private fun f2 ( p1 : AN , p2 : AN ) : AN

= p1


= F2Holder ( :: f2 )


= :: f2


= p1


= F32Holder ( :: f32 )


= :: f32


= F33Holder ( :: f33 )


= :: f33


= F33Holder ( getStaticTypeLambda33 ( ) )


= { <EOL> p , <EOL> _ , _ , _ , _ , _ , _ , _ , _ , <EOL> _ , _ , _ , _ , _ , _ , _ , _ , <EOL> _ , _ , _ , _ , _ , _ , _ , _ , <EOL> _ , _ , _ , _ , _ , _ , _ , _ <EOL> -> <EOL> p <EOL> }


{ <EOL> val v1 = d ? . foo ( ) <EOL> v1 . isDynamic ( ) <EOL> val v2 = d ! ! . foo ( <NUM_LIT:1> ) <EOL> v2 . isDynamic ( ) <EOL> }


private fun pathForCallable ( callableMemberDeclaration : FirCallableDeclaration ) : List < FirClassLikeDeclaration >

{ <EOL> val result = mutableListOf < FirClassLikeDeclaration > ( ) <EOL> var current = parentClassForFunction [ callableMemberDeclaration ] <EOL> while ( current != null ) { <EOL> result += current <EOL> current = parentForClass [ current ] <EOL> } <EOL> return result . asReversed ( ) <EOL> }


fun FirClassLikeDeclaration . collectLocalClassesNavigationInfo ( ) : LocalClassesNavigationInfo

= <EOL> NavigationInfoVisitor ( ) . run { <EOL> this@collectLocalClassesNavigationInfo . accept ( this @ run , null ) <EOL> LocalClassesNavigationInfo ( parentForClass , resultingMap ) <EOL> }


override fun visitElement ( element : FirElement , data : Any ? )


override fun visitRegularClass ( regularClass : FirRegularClass , data : Any ? )

{ <EOL> visitClass ( regularClass , null ) <EOL> }


override fun visitAnonymousObject ( anonymousObject : FirAnonymousObject , data : Any ? )

{ <EOL> visitClass ( anonymousObject , null ) <EOL> }


override fun visitTypeAlias ( typeAlias : FirTypeAlias , data : Any ? )

{ <EOL> parentForClass [ typeAlias ] = currentPath . lastOrNull ( ) <EOL> }


override fun visitClass ( klass : FirClass , data : Any ? )

{ <EOL> parentForClass [ klass ] = currentPath . lastOrNull ( ) <EOL> currentPath . add ( klass ) <EOL> klass . acceptChildren ( this , null ) <EOL> currentPath . removeAt ( currentPath . size - <NUM_LIT:1> ) <EOL> }


override fun visitSimpleFunction ( simpleFunction : FirSimpleFunction , data : Any ? )

{ <EOL> visitCallableDeclaration ( simpleFunction , null ) <EOL> }


override fun visitProperty ( property : FirProperty , data : Any ? )

{ <EOL> visitCallableDeclaration ( property , null ) <EOL> }


override fun visitField ( field : FirField , data : Any ? )

{ <EOL> visitCallableDeclaration ( field , null ) <EOL> }


override fun visitConstructor ( constructor : FirConstructor , data : Any ? )

{ <EOL> visitCallableDeclaration ( constructor , null ) <EOL> }


override fun visitCallableDeclaration ( callableDeclaration : FirCallableDeclaration , data : Any ? )

{ <EOL> if ( callableDeclaration . returnTypeRef !is FirImplicitTypeRef ) return <EOL> resultingMap [ callableDeclaration ] = currentPath . last ( ) <EOL> }


@ OptIn ( UnsafeApi :: class ) <EOL> fun create ( compilation : KotlinCompilation < * > ) : Scope

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


= name


= name . hashCode ( )


override fun equals ( other : Any ? ) : Boolean

{ <EOL> if ( other !is Scope ) return false <EOL> return this . name == other . name <EOL> }


= uniqueName


= foo ( <NUM_LIT:1> )


override fun resumeWith ( result : Result < Any ? > )

{ result . getOrThrow ( ) }


= suspendCoroutineUninterceptedOrReturn { x -> <EOL> sb . appendLine ( "<STR_LIT>" ) <EOL> x . resume ( <NUM_LIT:42> ) <EOL> COROUTINE_SUSPENDED <EOL> }


{ <EOL> sb . appendLine ( "<STR_LIT>" ) <EOL> return <NUM_LIT> <EOL> }


{ <EOL> sb . appendLine ( "<STR_LIT>" ) <EOL> return <NUM_LIT:1> <EOL> }


{ <EOL> sb . appendLine ( "<STR_LIT>" ) <EOL> return x + y <EOL> }


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


{ <EOL> var result = <NUM_LIT:0> <EOL> builder { <EOL> result = try { <EOL> s1 ( ) <EOL> } catch ( t : Throwable ) { <EOL> f2 ( ) <EOL> } <EOL> } <EOL> sb . appendLine ( result ) <EOL> assertEquals ( """<STR_LIT>""" . trimIndent ( ) , sb . toString ( ) ) <EOL> return "<STR_LIT:OK>" <EOL> }


override fun check ( declaration : KtDeclaration , descriptor : DeclarationDescriptor , context : DeclarationCheckerContext )

{ <EOL> if ( descriptor is ClassDescriptor && ! descriptor . isEffectivelyExternal ( ) ) { <EOL> val superClasses = listOfNotNull ( descriptor . getSuperClassNotAny ( ) ) + descriptor . getSuperInterfaces ( ) <EOL> for ( superClass in superClasses ) { <EOL> if ( superClass . isEffectivelyExternal ( ) ) { <EOL> context . trace . report ( ErrorsWasm . NON_EXTERNAL_TYPE_EXTENDS_EXTERNAL_TYPE . on ( declaration as KtClassOrObject , superClass . defaultType ) ) <EOL> } <EOL> } <EOL> } <EOL> }


fun get ( ) : T


fun < T > LinkedSnippet < T > ? . toList ( ) : List < T >

= toList { it }


fun < T , R > LinkedSnippet < T > ? . toList ( mapper : ( T ) -> R ) : List < R >

{ <EOL> val res = ArrayList < R > ( ) <EOL> var el = this <EOL> while ( el != null ) { <EOL> res . add ( mapper ( el . get ( ) ) ) <EOL> el = el . previous <EOL> } <EOL> res . reverse ( ) <EOL> return res <EOL> }


fun < T > LinkedSnippet < T > ? . get ( ) : T ?

= this ? . get ( )


= _val


fun < T > LinkedSnippetImpl < T > ? . add ( value : T )

= LinkedSnippetImpl ( value , this )


override fun get ( index : Int ) : String

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


{ <EOL> result = ok ! ! <EOL> }


{ <EOL> Test ( ) . test ( ) <EOL> return result <EOL> }


fun < S : T > takeFoo ( foo : Foo < in S > )


fun < K : Out < A < String > > > main ( )

{ <EOL> val foo = Foo < K > ( ) <EOL> Bar < Out < B < String > > > ( ) . takeFoo ( foo ) <EOL> }


override fun findAnnotation ( fqName : FqName )

= <EOL> element ? . declaredAnnotations ? . findAnnotation ( fqName )


fun Array < Annotation > . getAnnotations ( ) : List < ReflectJavaAnnotation >

{ <EOL> return map ( :: ReflectJavaAnnotation ) <EOL> }


fun Array < Annotation > . findAnnotation ( fqName : FqName ) : ReflectJavaAnnotation ?

{ <EOL> return firstOrNull { it . annotationClass . java . classId . asSingleFqName ( ) == fqName } ? . let ( :: ReflectJavaAnnotation ) <EOL> }


{ <EOL> val tf = transformer ( irFile ) <EOL> irFile . transformChildrenVoid ( tf ) <EOL> tf . implementations . values . forEach { <EOL> val parentClass = it . parent as IrDeclarationContainer <EOL> parentClass . declarations += it <EOL> } <EOL> }


override fun visitClassNew ( declaration : IrClass ) : IrStatement

{ <EOL> declaration . addConstructorBodyForCompatibility ( ) <EOL> return super . visitClassNew ( declaration ) <EOL> }


protected fun IrClass . addConstructorBodyForCompatibility ( )

{ <EOL> if ( ! isAnnotationClass ) return <EOL> val primaryConstructor = constructors . singleOrNull ( ) ? : return <EOL> if ( primaryConstructor . body != null ) return <EOL> modality = Modality . OPEN <EOL> primaryConstructor . body = context . createIrBuilder ( symbol ) <EOL> . irBlockBody ( SYNTHETIC_OFFSET , SYNTHETIC_OFFSET ) { <EOL> + irDelegatingConstructorCall ( context . irBuiltIns . anyClass . owner . constructors . single ( ) ) <EOL> + IrInstanceInitializerCallImpl ( startOffset , endOffset , this @ addConstructorBodyForCompatibility . symbol , context . irBuiltIns . unitType ) <EOL> } <EOL> }


abstract fun chooseConstructor ( implClass : IrClass , expression : IrConstructorCall ) : IrConstructor


override fun visitConstructorCall ( expression : IrConstructorCall ) : IrExpression

{ <EOL> val constructedClass = expression . type . classOrNull ? . owner ? : return super . visitConstructorCall ( expression ) <EOL> if ( ! constructedClass . isAnnotationClass ) return super . visitConstructorCall ( expression ) <EOL> require ( expression . symbol . owner . isPrimary ) { "<STR_LIT>" } <EOL> val implClass = implementations . getOrPut ( constructedClass ) { createAnnotationImplementation ( constructedClass ) } <EOL> val ctor = chooseConstructor ( implClass , expression ) <EOL> val newCall = IrConstructorCallImpl . fromSymbolOwner ( expression . startOffset , expression . endOffset , implClass . defaultType , ctor . symbol , ) <EOL> moveValueArgumentsUsingNames ( expression , newCall ) <EOL> newCall . transformChildrenVoid ( ) <EOL> return newCall <EOL> }


private fun moveValueArgumentsUsingNames ( source : IrConstructorCall , destination : IrConstructorCall )

{ <EOL> val argumentsByName = source . getArgumentsWithIr ( ) . associateBy ( { ( param , _ ) -> param . name } , { ( _ , value ) -> value } ) <EOL> destination . symbol . owner . valueParameters . forEachIndexed { index , parameter -> <EOL> val valueArg = argumentsByName [ parameter . name ] <EOL> if ( parameter . defaultValue == null && valueArg == null ) { <EOL> if ( parameter . type . isBoxedArray || parameter . type . isPrimitiveArray ( ) || parameter . type . isUnsignedArray ( ) ) { <EOL> val arrayType = parameter . type <EOL> val arrayConstructorCall = <EOL> if ( arrayType . isBoxedArray ) { <EOL> val arrayFunction = context . ir . symbols . arrayOfNulls <EOL> IrCallImpl . fromSymbolOwner ( source . startOffset , source . endOffset , arrayType , arrayFunction ) <EOL> } else { <EOL> val arrayConstructor = arrayType . classOrNull ! ! . constructors . single { <EOL> it . owner . valueParameters . size == <NUM_LIT:1> && it . owner . valueParameters . single ( ) . type == context . irBuiltIns . intType <EOL> } <EOL> IrConstructorCallImpl . fromSymbolOwner ( source . startOffset , source . endOffset , arrayType , arrayConstructor ) <EOL> } <EOL> arrayConstructorCall . putValueArgument ( <NUM_LIT:0> , IrConstImpl . int ( source . startOffset , source . endOffset , context . irBuiltIns . intType , <NUM_LIT:0> ) ) <EOL> destination . putValueArgument ( index , arrayConstructorCall ) <EOL> return <EOL> } else { <EOL> error ( "<STR_LIT>" + "<STR_LIT>" ) <EOL> } <EOL> } <EOL> destination . putValueArgument ( index , valueArg ) <EOL> } <EOL> }


private fun createAnnotationImplementation ( annotationClass : IrClass ) : IrClass

{ <EOL> val localDeclarationParent = currentClass ? . scope ? . getLocalDeclarationParent ( ) as? IrClass <EOL> val parentFqName = annotationClass . fqNameWhenAvailable ! ! . asString ( ) . replace ( '<CHAR_LIT:.>' , '<CHAR_LIT:_>' ) <EOL> val wrapperName = Name . identifier ( "<STR_LIT>" ) <EOL> val subclass = context . irFactory . buildClass { <EOL> startOffset = SYNTHETIC_OFFSET <EOL> endOffset = SYNTHETIC_OFFSET <EOL> name = wrapperName <EOL> origin = ANNOTATION_IMPLEMENTATION <EOL> visibility = DescriptorVisibilities . INTERNAL <EOL> } . apply { <EOL> parent = localDeclarationParent ? : irFile <EOL> ? : error ( "<STR_LIT>" ) <EOL> createImplicitParameterDeclarationWithWrappedDescriptor ( ) <EOL> superTypes = listOf ( annotationClass . defaultType ) <EOL> platformSetup ( ) <EOL> } <EOL> val ctor = subclass . addConstructor { <EOL> startOffset = SYNTHETIC_OFFSET <EOL> endOffset = SYNTHETIC_OFFSET <EOL> visibility = DescriptorVisibilities . PUBLIC <EOL> } <EOL> implementAnnotationPropertiesAndConstructor ( subclass , annotationClass , ctor ) <EOL> implementGeneratedFunctions ( annotationClass , subclass ) <EOL> implementPlatformSpecificParts ( annotationClass , subclass ) <EOL> return subclass <EOL> }


abstract fun implementAnnotationPropertiesAndConstructor ( implClass : IrClass , annotationClass : IrClass , generatedConstructor : IrConstructor )


fun IrClass . getAnnotationProperties ( ) : List < IrProperty >

{ <EOL> val props = declarations . filterIsInstance < IrProperty > ( ) <EOL> if ( props . isNotEmpty ( ) ) return props <EOL> return declarations <EOL> . filterIsInstanceAnd < IrSimpleFunction > { it . origin == IrDeclarationOrigin . DEFAULT_PROPERTY_ACCESSOR } <EOL> . mapNotNull { it . correspondingPropertySymbol ? . owner } <EOL> }


abstract fun getArrayContentEqualsSymbol ( type : IrType ) : IrFunctionSymbol


open fun IrExpression . transformArrayEqualsArgument ( type : IrType , irBuilder : IrBlockBodyBuilder ) : IrExpression

= this


fun generatedEquals ( irBuilder : IrBlockBodyBuilder , type : IrType , arg1 : IrExpression , arg2 : IrExpression ) : IrExpression

= <EOL> if ( type . isArray ( ) || type . isPrimitiveArray ( ) || type . isUnsignedArray ( ) ) { <EOL> val requiredSymbol = getArrayContentEqualsSymbol ( type ) <EOL> val lhs = arg1 . transformArrayEqualsArgument ( type , irBuilder ) <EOL> val rhs = arg2 . transformArrayEqualsArgument ( type , irBuilder ) <EOL> irBuilder . irCall ( requiredSymbol ) . apply { <EOL> if ( requiredSymbol . owner . extensionReceiverParameter != null ) { <EOL> extensionReceiver = lhs <EOL> putValueArgument ( <NUM_LIT:0> , rhs ) <EOL> } else { <EOL> putValueArgument ( <NUM_LIT:0> , lhs ) <EOL> putValueArgument ( <NUM_LIT:1> , rhs ) <EOL> } <EOL> } <EOL> } else <EOL> irBuilder . irEquals ( arg1 , arg2 )


open fun generateFunctionBodies ( annotationClass : IrClass , implClass : IrClass , eqFun : IrSimpleFunction , hcFun : IrSimpleFunction , toStringFun : IrSimpleFunction , generator : AnnotationImplementationMemberGenerator )

{ <EOL> val properties = annotationClass . getAnnotationProperties ( ) <EOL> generator . generateEqualsUsingGetters ( eqFun , annotationClass . defaultType , properties ) <EOL> generator . generateHashCodeMethod ( hcFun , properties ) <EOL> generator . generateToStringMethod ( toStringFun , properties ) <EOL> }


fun implementGeneratedFunctions ( annotationClass : IrClass , implClass : IrClass )

{ <EOL> val creator = MethodsFromAnyGeneratorForLowerings ( context , implClass , ANNOTATION_IMPLEMENTATION ) <EOL> val eqFun = creator . createEqualsMethodDeclaration ( ) <EOL> val hcFun = creator . createHashCodeMethodDeclaration ( ) <EOL> val toStringFun = creator . createToStringMethodDeclaration ( ) <EOL> if ( annotationClass != implClass ) { <EOL> implClass . addFakeOverrides ( context . typeSystem ) <EOL> } <EOL> val generator = AnnotationImplementationMemberGenerator ( context , implClass , nameForToString = "<STR_LIT:@>" + annotationClass . fqNameWhenAvailable ! ! . asString ( ) , forbidDirectFieldAccess = forbidDirectFieldAccessInMethods ) { type , a , b -> <EOL> generatedEquals ( this , type , a , b ) <EOL> } <EOL> generateFunctionBodies ( annotationClass , implClass , eqFun , hcFun , toStringFun , generator ) <EOL> }


open fun implementPlatformSpecificParts ( annotationClass : IrClass , implClass : IrClass )


override fun IrClass . classNameForToString ( ) : String

= nameForToString


override fun IrBuilderWithScope . shiftResultOfHashCode ( irResultVar : IrVariable ) : IrExpression

= irGet ( irResultVar )


override fun getHashCodeOf ( builder : IrBuilderWithScope , property : IrProperty , irValue : IrExpression ) : IrExpression

= with ( builder ) { <EOL> val propertyValueHashCode = getHashCodeOf ( property . type , irValue ) <EOL> val propertyNameHashCode = getHashCodeOf ( backendContext . irBuiltIns . stringType , irString ( property . name . toString ( ) ) ) <EOL> val multiplied = irCallOp ( context . irBuiltIns . intTimesSymbol , context . irBuiltIns . intType , propertyNameHashCode , irInt ( <NUM_LIT> ) ) <EOL> return irCallOp ( context . irBuiltIns . intXorSymbol , context . irBuiltIns . intType , multiplied , propertyValueHashCode ) <EOL> }


private fun IrBuilderWithScope . getHashCodeOf ( type : IrType , irValue : IrExpression ) : IrExpression

{ <EOL> return getHashCodeOf ( getHashCodeFunctionInfo ( type ) , irValue ) <EOL> }


fun generateEqualsUsingGetters ( equalsFun : IrSimpleFunction , typeForEquals : IrType , properties : List < IrProperty > )

= equalsFun . apply { <EOL> body = backendContext . createIrBuilder ( symbol , SYNTHETIC_OFFSET , SYNTHETIC_OFFSET ) . irBlockBody { <EOL> val irType = typeForEquals <EOL> fun irOther ( ) = irGet ( valueParameters [ <NUM_LIT:0> ] ) <EOL> fun irThis ( ) = irGet ( dispatchReceiverParameter ! ! ) <EOL> fun IrProperty . get ( receiver : IrExpression ) = irCall ( getter ! ! ) . apply { <EOL> dispatchReceiver = receiver <EOL> } <EOL> + irIfThenReturnFalse ( irNotIs ( irOther ( ) , irType ) ) <EOL> val otherWithCast = irTemporary ( irAs ( irOther ( ) , irType ) , "<STR_LIT>" ) <EOL> for ( property in properties ) { <EOL> val arg1 = property . get ( irThis ( ) ) <EOL> val arg2 = property . get ( irGet ( irType , otherWithCast . symbol ) ) <EOL> + irIfThenReturnFalse ( irNot ( selectEquals ( property . type , arg1 , arg2 ) ) ) <EOL> } <EOL> + irReturnTrue ( ) <EOL> } <EOL> }


= "<STR_LIT>"


fun foo ( param : String = "<STR_LIT>" )

= "<STR_LIT>"


fun bar ( param : String = "<STR_LIT>" )

= "<STR_LIT>"


= when { <EOL> foo ( "<STR_LIT>" ) != "<STR_LIT>" -> "<STR_LIT:failU+00201>" <EOL> X ( "<STR_LIT>" ) . bar ( "<STR_LIT>" ) != "<STR_LIT>" -> "<STR_LIT:failU+00202>" <EOL> else -> "<STR_LIT:OK>" <EOL> }


= lib ( )


fun tryParseEffect ( expression : KtExpression ) : EffectDeclaration ?


{ <EOL> withSpark ( props = mapOf ( "<STR_LIT>" to true ) ) { <EOL> dsOf ( mapOf ( <NUM_LIT:1> to t ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) , <NUM_LIT:2> to t ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) ) , mapOf ( <NUM_LIT:3> to t ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) , <NUM_LIT:4> to t ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) ) , ) <EOL> . flatMap { <EOL> it . toList ( ) <EOL> . map { ( first , tuple ) -> ( first + tuple ) . toList ( ) } <EOL> . iterator ( ) <EOL> } <EOL> . flatten ( ) <EOL> . map { tupleOf ( it ) } <EOL> . also { it . printSchema ( ) } <EOL> . distinct ( ) <EOL> . sort ( "<STR_LIT>" ) <EOL> . debugCodegen ( ) <EOL> . show ( ) <EOL> } <EOL> }


private fun KotlinType . isValueOrPrimitive ( ) : Boolean

= KotlinBuiltIns . isPrimitiveType ( this ) <EOL> || constructor . declarationDescriptor . let { it is ClassDescriptor && it . isValue } <EOL> || constructor . let { manyTypes -> manyTypes is IntegerLiteralTypeConstructor && manyTypes . possibleTypes . any { it . isValueOrPrimitive ( ) } }


override fun check ( resolvedCall : ResolvedCall < * > , reportOn : PsiElement , context : CallCheckerContext )

{ <EOL> if ( resolvedCall . resultingDescriptor ? . isTopLevelInPackage ( "<STR_LIT>" , "<STR_LIT:kotlin>" ) != true ) return <EOL> val argument = resolvedCall . valueArgumentsByIndex ? . get ( <NUM_LIT:0> ) ? . arguments ? . firstOrNull ( ) ? : return <EOL> val type = argument . getArgumentExpression ( ) ? . getType ( context . trace . bindingContext ) ? : return <EOL> if ( type . isValueOrPrimitive ( ) ) { <EOL> context . trace . report ( Errors . FORBIDDEN_SYNCHRONIZED_BY_VALUE_CLASSES_OR_PRIMITIVES . on ( reportOn , type ) ) <EOL> } <EOL> }


inline fun FirFunctionCall . copyAsImplicitInvokeCall ( setupCopy : FirImplicitInvokeCallBuilder . ( ) -> Unit ) : FirImplicitInvokeCall

{ <EOL> val original = this <EOL> return buildImplicitInvokeCall { <EOL> source = original . source <EOL> annotations . addAll ( original . annotations ) <EOL> typeArguments . addAll ( original . typeArguments ) <EOL> explicitReceiver = original . explicitReceiver <EOL> dispatchReceiver = original . dispatchReceiver <EOL> extensionReceiver = original . extensionReceiver <EOL> argumentList = original . argumentList <EOL> calleeReference = original . calleeReference <EOL> setupCopy ( ) <EOL> } <EOL> }


fun FirTypeRef . resolvedTypeFromPrototype ( type : ConeKotlinType , fallbackSource : KtSourceElement ? = null , ) : FirResolvedTypeRef

{ <EOL> return if ( type is ConeErrorType ) { <EOL> buildErrorTypeRef { <EOL> source = this@resolvedTypeFromPrototype . source ? : fallbackSource <EOL> this . type = type <EOL> diagnostic = type . diagnostic <EOL> annotations += this@resolvedTypeFromPrototype . annotations <EOL> } <EOL> } else { <EOL> buildResolvedTypeRef { <EOL> source = this@resolvedTypeFromPrototype . source ? : fallbackSource <EOL> this . type = type <EOL> delegatedTypeRef = when ( val original = this @ resolvedTypeFromPrototype ) { <EOL> is FirResolvedTypeRef -> original . delegatedTypeRef <EOL> is FirUserTypeRef -> original <EOL> else -> null <EOL> } <EOL> annotations += this@resolvedTypeFromPrototype . annotations <EOL> } <EOL> } <EOL> }


fun List < FirAnnotation > . computeTypeAttributes ( session : FirSession , predefined : List < ConeAttribute < * > > = emptyList ( ) , allowExtensionFunctionType : Boolean = true , shouldExpandTypeAliases : Boolean ) : ConeAttributes

{ <EOL> if ( this . isEmpty ( ) ) { <EOL> if ( predefined . isEmpty ( ) ) return ConeAttributes . Empty <EOL> return ConeAttributes . create ( predefined ) <EOL> } <EOL> val attributes = mutableListOf < ConeAttribute < * > > ( ) <EOL> attributes += predefined <EOL> val customAnnotations = mutableListOf < FirAnnotation > ( ) <EOL> for ( annotation in this ) { <EOL> val classId = when ( shouldExpandTypeAliases ) { <EOL> true -> annotation . tryExpandClassId ( session ) <EOL> false -> annotation . resolvedType . classId <EOL> } <EOL> when ( classId ) { <EOL> CompilerConeAttributes . Exact . ANNOTATION_CLASS_ID -> attributes += CompilerConeAttributes . Exact <EOL> CompilerConeAttributes . NoInfer . ANNOTATION_CLASS_ID -> attributes += CompilerConeAttributes . NoInfer <EOL> CompilerConeAttributes . ExtensionFunctionType . ANNOTATION_CLASS_ID -> when { <EOL> allowExtensionFunctionType -> attributes += CompilerConeAttributes . ExtensionFunctionType <EOL> } <EOL> CompilerConeAttributes . ContextFunctionTypeParams . ANNOTATION_CLASS_ID -> <EOL> attributes += <EOL> CompilerConeAttributes . ContextFunctionTypeParams ( annotation . extractContextReceiversCount ( ) ? : <NUM_LIT:0> ) <EOL> CompilerConeAttributes . UnsafeVariance . ANNOTATION_CLASS_ID -> attributes += CompilerConeAttributes . UnsafeVariance <EOL> else -> { <EOL> val attributeFromPlugin = session . extensionService . typeAttributeExtensions . firstNotNullOfOrNull { <EOL> it . extractAttributeFromAnnotation ( annotation ) <EOL> } <EOL> if ( attributeFromPlugin != null ) { <EOL> attributes += attributeFromPlugin <EOL> } else { <EOL> customAnnotations += annotation <EOL> } <EOL> } <EOL> } <EOL> } <EOL> if ( customAnnotations . isNotEmpty ( ) ) { <EOL> attributes += CustomAnnotationTypeAttribute ( customAnnotations ) <EOL> } <EOL> return ConeAttributes . create ( attributes ) <EOL> }

/**
 * [shouldExpandTypeAliases] should be set to `false` if this function is called during deserialization of some binary declaration
 * For details see KT-57876
 */


private fun FirAnnotation . tryExpandClassId ( session : FirSession ) : ClassId ?

{ <EOL> return when ( val directlyExpanded = unexpandedConeClassLikeType ? . directExpansionType ( session ) { it . expandedConeType } ) { <EOL> null -> unexpandedConeClassLikeType ? . classId <EOL> else -> directlyExpanded . fullyExpandedType ( session ) . classId <EOL> } <EOL> }


private fun FirAnnotation . extractContextReceiversCount ( )

= <EOL> ( argumentMapping . mapping [ StandardNames . CONTEXT_FUNCTION_TYPE_PARAMETER_COUNT_NAME ] as? FirLiteralExpression < * > ) ? . value as? Int


{ <EOL> val descriptor = resolvedCall . resultingDescriptor <EOL> if ( descriptor . name . asString ( ) != "<STR_LIT>" ) return <EOL> if ( descriptor . extensionReceiverParameter ? . annotations ? . hasAnnotation ( FqNames . accessibleLateinitPropertyLiteral ) != true ) return <EOL> val expression = ( resolvedCall . extensionReceiver as? ExpressionReceiver ) ? . expression ? . let ( KtPsiUtil :: safeDeparenthesize ) <EOL> fun < T > chooseDiagnostic ( ifWarning : T , ifError : T ) = <EOL> if ( isWarningInPre19 && ! context . languageVersionSettings . supportsFeature ( LanguageFeature . NativeJsProhibitLateinitIsInitializedIntrinsicWithoutPrivateAccess ) ) <EOL> ifWarning <EOL> else <EOL> ifError <EOL> if ( expression !is KtCallableReferenceExpression ) { <EOL> val diagnostic = chooseDiagnostic ( LATEINIT_INTRINSIC_CALL_ON_NON_LITERAL_WARNING , LATEINIT_INTRINSIC_CALL_ON_NON_LITERAL ) <EOL> context . trace . report ( diagnostic . on ( reportOn ) ) <EOL> } else { <EOL> val propertyReferenceResolvedCall = expression . callableReference . getResolvedCall ( context . trace . bindingContext ) ? : return <EOL> val referencedProperty = propertyReferenceResolvedCall . resultingDescriptor <EOL> if ( referencedProperty !is PropertyDescriptor ) { <EOL> error ( "<STR_LIT>" ) <EOL> } <EOL> if ( ! referencedProperty . isLateInit ) { <EOL> val diagnostic = chooseDiagnostic ( LATEINIT_INTRINSIC_CALL_ON_NON_LATEINIT_WARNING , LATEINIT_INTRINSIC_CALL_ON_NON_LATEINIT ) <EOL> context . trace . report ( diagnostic . on ( reportOn ) ) <EOL> } else if ( ! isBackingFieldAccessible ( referencedProperty , context ) ) { <EOL> val diagnostic = chooseDiagnostic ( LATEINIT_INTRINSIC_CALL_ON_NON_ACCESSIBLE_PROPERTY_WARNING , LATEINIT_INTRINSIC_CALL_ON_NON_ACCESSIBLE_PROPERTY ) <EOL> context . trace . report ( diagnostic . on ( reportOn , referencedProperty ) ) <EOL> } else if ( ( context . scope . ownerDescriptor as? FunctionDescriptor ) ? . isInline == true ) { <EOL> val diagnostic = chooseDiagnostic ( LATEINIT_INTRINSIC_CALL_IN_INLINE_FUNCTION_WARNING , LATEINIT_INTRINSIC_CALL_IN_INLINE_FUNCTION ) <EOL> context . trace . report ( diagnostic . on ( reportOn ) ) <EOL> } <EOL> } <EOL> }


private fun isBackingFieldAccessible ( descriptor : PropertyDescriptor , context : CallCheckerContext ) : Boolean

{ <EOL> val declaration = <EOL> OverridingUtil . filterOutOverridden ( OverridingUtil . getOverriddenDeclarations ( descriptor ) ) . singleOrNull ( ) ? : return false <EOL> val declarationSourceFile = DescriptorToSourceUtils . getContainingFile ( declaration ) ? : return false <EOL> val usageSourceFile = DescriptorToSourceUtils . getContainingFile ( context . scope . ownerDescriptor ) ? : return false <EOL> if ( declarationSourceFile != usageSourceFile ) return false <EOL> return declaration . containingDeclaration in <EOL> generateSequence ( context . scope . ownerDescriptor , DeclarationDescriptor :: getContainingDeclaration ) <EOL> }


actual fun libCommonMainExpectFun ( ) : Unit

{ <EOL> println ( "<STR_LIT>" ) <EOL> libCommonMainTopLevelFun ( ) <EOL> println ( CArrayPointer :: class ) <EOL> libCommonMainInternalFun ( ) <EOL> throw MyCustomException ( ) <EOL> }


{ <EOL> println ( "<STR_LIT>" ) <EOL> }


fun libLinuxMainFun ( ) : LibCommonMainIface

= LibCommonMainExpect ( )


fun getPredicate ( ) : ( Person ) -> Boolean

{ <EOL> val startsWithPrefix = { p : Person -> <EOL> p . firstName . startsWith ( prefix ) || p . lastName . startsWith ( prefix ) <EOL> } <EOL> if ( ! onlyWithPhoneNumber ) { <EOL> return startsWithPrefix <EOL> } <EOL> return { <EOL> startsWithPrefix ( it ) <EOL> && it . phoneNumber != null <EOL> } <EOL> }


{ <EOL> val contacts = listOf ( Person ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , Person ( "<STR_LIT>" , "<STR_LIT>" , null ) ) <EOL> val contactListFilters = ContactListFilters ( ) <EOL> with ( contactListFilters ) { <EOL> prefix = "<STR_LIT>" <EOL> onlyWithPhoneNumber = true <EOL> } <EOL> println ( contacts . filter ( contactListFilters . getPredicate ( ) ) ) <EOL> }


override fun createPointer ( ) : KtSymbolPointer < KtTypeAliasSymbol >

= withValidityAssertion { <EOL> KtPsiBasedSymbolPointer . createForSymbolFromSource < KtTypeAliasSymbol > ( this ) ? . let { return it } <EOL> when ( val symbolKind = symbolKind ) { <EOL> KtSymbolKind . LOCAL -> <EOL> throw CanNotCreateSymbolPointerForLocalLibraryDeclarationException ( classIdIfNonLocal ? . asString ( ) ? : name . asString ( ) ) <EOL> KtSymbolKind . CLASS_MEMBER , KtSymbolKind . TOP_LEVEL -> KtFirClassLikeSymbolPointer ( classIdIfNonLocal ! ! , KtTypeAliasSymbol :: class ) <EOL> else -> throw UnsupportedSymbolKind ( this :: class , symbolKind ) <EOL> } <EOL> }


override fun equals ( other : Any ? ) : Boolean

= symbolEquals ( other )


= symbolHashCode ( )


@ PublishedApi <EOL> internal fun fromContext ( variables : List < String > , title : String ? , anchor : Anchor ? , minWidth : Double ? , enable : Boolean , valueFormats : List < Pair < String , String > > , context : LayerTooltipsContext ) : LayerTooltips

{ <EOL> return LayerTooltips ( variables , context . lineBuffer , valueFormats + context . formatsBuffer . toList ( ) , title , anchor , minWidth , enable ) <EOL> }


@ ExperimentalKotlinGradlePluginApi <EOL> fun compilerOptions ( configure : CO . ( ) -> Unit )

{ <EOL> configure ( compilerOptions ) <EOL> }

/**
 * Configures the [compilerOptions] with the provided configuration.
 */


@ ExperimentalKotlinGradlePluginApi <EOL> fun compilerOptions ( configure : Action < CO > )

{ <EOL> configure . execute ( compilerOptions ) <EOL> }


{ <EOL> val FALSE : Boolean ? = false <EOL> if ( FALSE != null ) { <EOL> do { <EOL> return "<STR_LIT:OK>" <EOL> } while ( FALSE ) <EOL> } <EOL> return "<STR_LIT:FAIL>" <EOL> }


= In < UserSuperklass > ( ) as CT


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

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


{ <EOL> val arg : In < UserKlass > = In < UserSuperklass > ( ) <EOL> val buildee = build { <EOL> yield ( arg ) <EOL> } <EOL> checkExactType < Buildee < In < UserKlass > > > ( buildee ) <EOL> }


{ <EOL> fun consume ( arg : In < UserKlass > ) { } <EOL> val buildee = build { <EOL> consume ( materialize ( ) ) <EOL> } <EOL> checkExactType < Buildee < In < UserKlass > > > ( buildee ) <EOL> }


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


= null


fun f0 ( t : List < Array < Array < Thread . State > > > )


{ <EOL> foo < A2 . B2 . C2 > ( ) <EOL> }


= x as? A3 . B3 . C3


{ <EOL> val x = listOf < A4 . B4 . C4 > ( ) <EOL> return x . toString ( ) <EOL> }


{ <EOL> val x : A5 . B5 . C5 ? = null <EOL> return x . toString ( ) <EOL> }


fun f7 ( @ ClassHolder ( A7 . B7 . C7 :: class ) x : Int )


= A8 . B8 . C8 :: class . toString ( )


fun registerExtensionPoint ( project : Project )

{ <EOL> CoreApplicationEnvironment . registerExtensionPoint ( project . extensionArea , extensionPointName . name , extensionClass ) <EOL> }


fun registerExtension ( project : Project , extension : T )

{ <EOL> project . extensionArea . getExtensionPoint ( extensionPointName ) . registerExtension ( extension , project ) <EOL> }


fun getInstances ( project : Project ) : List < T >

{ <EOL> val projectArea = project . extensionArea <EOL> if ( ! projectArea . hasExtensionPoint ( extensionPointName . name ) ) return listOf ( ) <EOL> return projectArea . getExtensionPoint ( extensionPointName ) . extensions . toList ( ) <EOL> }


{ <EOL> fileSystem . copy { <EOL> it . from ( kotlinLibraryPath ) <EOL> it . from ( syntheticInterfacesPath ) <EOL> it . from ( syntheticLibraryPath ) <EOL> it . into ( builtProductsDirectory ) <EOL> } <EOL> fileSystem . copy { <EOL> it . from ( includeBridgeDirectory ) <EOL> it . into ( syntheticInterfacesDestinationPath ) <EOL> } <EOL> fileSystem . copy { <EOL> it . from ( includeKotlinRuntimeDirectory ) <EOL> it . into ( kotlinRuntimeDestinationPath ) <EOL> } <EOL> }


override fun hasIncrementalCaches ( ) : Boolean

= incrementalCompilationComponents != null


override fun hasLookupTracker ( ) : Boolean

= lookupTracker != null


override fun hasCompilationCanceledStatus ( ) : Boolean

= compilationCanceledStatus != null


override fun hasExpectActualTracker ( ) : Boolean

= expectActualTracker != null


override fun hasInlineConstTracker ( ) : Boolean

= inlineConstTracker != null


override fun hasEnumWhenTracker ( ) : Boolean

= enumWhenTracker != null


override fun hasImportTracker ( ) : Boolean

= importTracker != null


override fun hasIncrementalResultsConsumer ( ) : Boolean

= incrementalResultsConsumer != null


override fun hasIncrementalDataProvider ( ) : Boolean

= incrementalDataProvider != null


override fun incrementalCache_getObsoletePackageParts ( target : TargetId ) : Collection < String >

= <EOL> incrementalCompilationComponents ! ! . getIncrementalCache ( target ) . getObsoletePackageParts ( )


override fun incrementalCache_getObsoleteMultifileClassFacades ( target : TargetId ) : Collection < String >

= <EOL> incrementalCompilationComponents ! ! . getIncrementalCache ( target ) . getObsoleteMultifileClasses ( )


override fun incrementalCache_getMultifileFacadeParts ( target : TargetId , internalName : String ) : Collection < String > ?

= <EOL> incrementalCompilationComponents ! ! . getIncrementalCache ( target ) . getStableMultifileFacadeParts ( internalName )


override fun incrementalCache_getPackagePartData ( target : TargetId , partInternalName : String ) : JvmPackagePartProto ?

= <EOL> incrementalCompilationComponents ! ! . getIncrementalCache ( target ) . getPackagePartData ( partInternalName )


override fun incrementalCache_getModuleMappingData ( target : TargetId ) : ByteArray ?

= <EOL> incrementalCompilationComponents ! ! . getIncrementalCache ( target ) . getModuleMappingData ( )


override fun incrementalCache_registerInline ( target : TargetId , fromPath : String , jvmSignature : String , toPath : String )

{ <EOL> }


override fun incrementalCache_getClassFilePath ( target : TargetId , internalClassName : String ) : String

= <EOL> incrementalCompilationComponents ! ! . getIncrementalCache ( target ) . getClassFilePath ( internalClassName )


override fun incrementalCache_close ( target : TargetId )

{ <EOL> incrementalCompilationComponents ! ! . getIncrementalCache ( target ) . close ( ) <EOL> }


override fun lookupTracker_requiresPosition ( )

= lookupTracker ! ! . requiresPosition


override fun lookupTracker_record ( lookups : Collection < LookupInfo > )

{ <EOL> val lookupTracker = lookupTracker ! ! <EOL> for ( it in lookups ) { <EOL> lookupTracker . record ( it . filePath , it . position , it . scopeFqName , it . scopeKind , it . name ) <EOL> } <EOL> }


override fun lookupTracker_isDoNothing ( ) : Boolean

= lookupTracker_isDoNothing


override fun compilationCanceledStatus_checkCanceled ( ) : Void ?

{ <EOL> try { <EOL> compilationCanceledStatus ! ! . checkCanceled ( ) <EOL> return null <EOL> } catch ( e : Exception ) { <EOL> if ( e . isProcessCanceledException ( ) ) <EOL> throw RmiFriendlyCompilationCanceledException ( ) <EOL> else throw e <EOL> } <EOL> }


override fun expectActualTracker_report ( expectedFilePath : String , actualFilePath : String )

{ <EOL> expectActualTracker ! ! . report ( File ( expectedFilePath ) , File ( actualFilePath ) ) <EOL> }


override fun inlineConstTracker_report ( filePath : String , owner : String , name : String , constType : String )

{ <EOL> inlineConstTracker ? . report ( filePath , owner , name , constType ) ? : throw NullPointerException ( "<STR_LIT>" ) <EOL> }


override fun enumWhenTracker_report ( whenUsageClassPath : String , enumClassFqName : String )

{ <EOL> enumWhenTracker ? . report ( whenUsageClassPath , enumClassFqName ) ? : throw NullPointerException ( "<STR_LIT>" ) <EOL> }


override fun importTracker_report ( filePath : String , importedFqName : String )

{ <EOL> importTracker ? . report ( filePath , importedFqName ) ? : throw NullPointerException ( "<STR_LIT>" ) <EOL> }


override fun incrementalResultsConsumer_processHeader ( headerMetadata : ByteArray )

{ <EOL> incrementalResultsConsumer ! ! . processHeader ( headerMetadata ) <EOL> }


override fun incrementalResultsConsumer_processPackagePart ( sourceFilePath : String , packagePartMetadata : ByteArray , binaryAst : ByteArray , inlineData : ByteArray )

{ <EOL> incrementalResultsConsumer ! ! . processPackagePart ( File ( sourceFilePath ) , packagePartMetadata , binaryAst , inlineData ) <EOL> }


override fun incrementalResultsConsumer_processInlineFunctions ( functions : Collection < JsInlineFunctionHash > )

{ <EOL> incrementalResultsConsumer ! ! . processInlineFunctions ( functions ) <EOL> }


override fun incrementalResultsConsumer_processPackageMetadata ( packageName : String , metadata : ByteArray )

{ <EOL> incrementalResultsConsumer ! ! . processPackageMetadata ( packageName , metadata ) <EOL> }


override fun incrementalDataProvider_getHeaderMetadata ( ) : ByteArray

= incrementalDataProvider ! ! . headerMetadata


override fun incrementalDataProvider_getMetadataVersion ( ) : IntArray

= incrementalDataProvider ! ! . metadataVersion


override fun incrementalDataProvider_getCompiledPackageParts ( )

= <EOL> incrementalDataProvider ! ! . compiledPackageParts . entries . map { <EOL> CompiledPackagePart ( it . key . path , it . value . metadata , it . value . binaryAst , it . value . inlineData ) <EOL> }


override fun incrementalDataProvider_getPackageMetadata ( ) : Collection < PackageMetadata >

= <EOL> incrementalDataProvider ! ! . packageMetadata . entries . map { ( fqName , metadata ) -> <EOL> PackageMetadata ( fqName , metadata ) <EOL> }


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


= foo1 ( )


{ <EOL> return arr . sum ( ) <EOL> }


{ <EOL> val x = foo ( arr = intArrayOf ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) ) <EOL> val y = bar ( arr = uintArrayOf ( <NUM_LIT:1u> , <NUM_LIT> , <NUM_LIT:3u> ) ) <EOL> val z = baz ( arr = ulongArrayOf ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) ) <EOL> val q = quas ( arr = ushortArrayOf ( <NUM_LIT:1u> , <NUM_LIT> , <NUM_LIT:3u> ) ) <EOL> val w = wex ( arr = ubyteArrayOf ( <NUM_LIT:1u> , <NUM_LIT> , <NUM_LIT:3u> ) ) <EOL> if ( x + y . toInt ( ) + z . toInt ( ) + q . toInt ( ) + w . toInt ( ) == <NUM_LIT> ) { <EOL> return "<STR_LIT:OK>" <EOL> } <EOL> return "<STR_LIT:Fail>" <EOL> }


= ( BImpl ( "<STR_LIT:OK>" ) as B ) . result


override fun createState ( lock : ReentrantReadWriteLock ) : IReplStageState < * >

= AggregatedReplStageState ( compiler . createState ( lock ) , evaluator . createState ( lock ) , lock )


override fun compileAndEval ( state : IReplStageState < * > , codeLine : ReplCodeLine , scriptArgs : ScriptArgsWithTypes ? , invokeWrapper : InvokeWrapper ? ) : ReplEvalResult

{ <EOL> if ( codeLine . code . trim ( ) . isEmpty ( ) ) { <EOL> return ReplEvalResult . UnitResult ( ) <EOL> } <EOL> return state . lock . write { <EOL> val aggregatedState = state . asState ( AggregatedReplStageState :: class . java ) <EOL> val compiled = compiler . compile ( state , codeLine ) <EOL> when ( compiled ) { <EOL> is ReplCompileResult . Error -> { <EOL> aggregatedState . apply { <EOL> lock . write { <EOL> assert ( state1 . history . size == state2 . history . size ) <EOL> adjustHistories ( ) <EOL> } <EOL> } <EOL> ReplEvalResult . Error . CompileTime ( compiled . message , compiled . location ) <EOL> } <EOL> is ReplCompileResult . Incomplete -> ReplEvalResult . Incomplete ( compiled . message ) <EOL> is ReplCompileResult . CompiledClasses -> { <EOL> val result = eval ( state , compiled , scriptArgs , invokeWrapper ) <EOL> when ( result ) { <EOL> is ReplEvalResult . Error , <EOL> is ReplEvalResult . HistoryMismatch , <EOL> is ReplEvalResult . Incomplete -> { <EOL> aggregatedState . apply { <EOL> lock . write { <EOL> if ( state1 . history . size > state2 . history . size ) { <EOL> adjustHistories ( ) <EOL> assert ( state1 . history . size == state2 . history . size ) <EOL> } <EOL> } <EOL> } <EOL> result <EOL> } <EOL> is ReplEvalResult . ValueResult , <EOL> is ReplEvalResult . UnitResult -> <EOL> result <EOL> } <EOL> } <EOL> } <EOL> } <EOL> }


override fun eval ( state : IReplStageState < * > , compileResult : ReplCompileResult . CompiledClasses , scriptArgs : ScriptArgsWithTypes ? , invokeWrapper : InvokeWrapper ? ) : ReplEvalResult

= <EOL> evaluator . eval ( state , compileResult , scriptArgs , invokeWrapper )


override fun compileToEvaluable ( state : IReplStageState < * > , codeLine : ReplCodeLine , defaultScriptArgs : ScriptArgsWithTypes ? ) : Pair < ReplCompileResult , Evaluable ? >

{ <EOL> val compiled = compiler . compile ( state , codeLine ) <EOL> return when ( compiled ) { <EOL> is ReplCompileResult . CompiledClasses -> Pair ( compiled , DelayedEvaluation ( state , compiled , evaluator , defaultScriptArgs ? : fallbackScriptArgs ) ) <EOL> else -> Pair ( compiled , null ) <EOL> } <EOL> }


override fun eval ( scriptArgs : ScriptArgsWithTypes ? , invokeWrapper : InvokeWrapper ? ) : ReplEvalResult

= <EOL> evaluator . eval ( state , compiledCode , scriptArgs ? : defaultScriptArgs , invokeWrapper )


private fun AggregatedReplStageState < * , * > . adjustHistories ( ) : Iterable < ILineId > ?

= <EOL> state2 . history . peek ( ) ? . let { <EOL> state1 . history . resetTo ( it . id ) <EOL> } <EOL> ? : state1 . history . reset ( )


override fun enterScope ( irTypeParametersContainer : IrTypeParametersContainer )


override fun remapType ( type : IrType ) : IrType

= <EOL> if ( type !is IrSimpleType ) <EOL> type <EOL> else <EOL> IrSimpleTypeImpl ( null , type . classifier . remap ( ) , type . nullability , type . arguments . memoryOptimizedMap { it . remap ( ) } , type . annotations , type . abbreviation ? . remap ( ) ) . apply { <EOL> annotations . forEach { it . remapTypes ( this @ IrTypeParameterRemapper ) } <EOL> }


private fun IrClassifierSymbol . remap ( )

= <EOL> ( owner as? IrTypeParameter ) ? . let { typeParameterMap [ it ] ? . symbol } <EOL> ? : this


= <EOL> when ( this ) { <EOL> is IrTypeProjection -> makeTypeProjection ( remapType ( type ) , variance ) <EOL> is IrStarProjection -> this <EOL> }


private fun IrTypeAbbreviation . remap ( )

= <EOL> IrTypeAbbreviationImpl ( typeAlias , hasQuestionMark , arguments . memoryOptimizedMap { it . remap ( ) } , annotations ) . apply { <EOL> annotations . forEach { it . remapTypes ( this @ IrTypeParameterRemapper ) } <EOL> }


open fun foo ( a : String , b : String = "<STR_LIT:b>" )

= b + a


{ <EOL> val f = ( B :: class . java ) . kotlin . getMemberByName ( "<STR_LIT:foo>" ) <EOL> assertEquals ( "<STR_LIT>" , f . callBy ( mapOf ( f . parameters . first ( ) to B ( ) , f . parameters . single { it . name == "<STR_LIT:a>" } to "<STR_LIT:a>" ) ) ) <EOL> return "<STR_LIT:OK>" <EOL> }


override fun getRangeInElement ( ) : TextRange

{ <EOL> val byKeywordNode = expression . byKeywordNode <EOL> val offset = byKeywordNode . psi ! ! . startOffsetInParent <EOL> return TextRange ( offset , offset + byKeywordNode . textLength ) <EOL> }


= x . convert < String > ( )


@ TestOnly <EOL> public abstract fun publishGlobalModuleStateModification ( )

/**
 * Publishes an event of global modification of the module state of all [KtModule]s.
 */


@ TestOnly <EOL> public abstract fun publishGlobalSourceModuleStateModification ( )

/**
 * Publishes an event of global modification of the module state of all source [KtModule]s.
 */


@ TestOnly <EOL> public abstract fun publishGlobalSourceOutOfBlockModification ( )

/**
 * Publishes an event of global out-of-block modification of all source [KtModule]s. The event does not invalidate module state like
 * [publishGlobalSourceModuleStateModification], so some module structure-specific caches might persist.
 */


public fun getInstance ( project : Project ) : KotlinGlobalModificationService

= <EOL> project . getService ( KotlinGlobalModificationService :: class . java )


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

{ <EOL> if ( ! context . languageVersionSettings . supportsFeature ( LanguageFeature . ContextReceivers ) ) return <EOL> if ( declaration . contextReceivers . isEmpty ( ) ) return <EOL> if ( declaration . hasBackingField ) { <EOL> reporter . reportOn ( declaration . initializer ? . source , FirErrors . CONTEXT_RECEIVERS_WITH_BACKING_FIELD , context ) <EOL> } <EOL> }


{ <EOL> val data = arrayOf ( doubleArrayOf ( - <NUM_LIT:2.0> , <NUM_LIT> ) , doubleArrayOf ( - <NUM_LIT> , - <NUM_LIT> ) , doubleArrayOf ( <NUM_LIT:0.0> , <NUM_LIT:0.0> ) , doubleArrayOf ( <NUM_LIT:1.0> , <NUM_LIT:1.0> ) , doubleArrayOf ( <NUM_LIT> , <NUM_LIT> ) , doubleArrayOf ( <NUM_LIT> , - <NUM_LIT:1.0> ) , doubleArrayOf ( <NUM_LIT:2.0> , - <NUM_LIT> ) , doubleArrayOf ( <NUM_LIT> , <NUM_LIT:0.0> ) , doubleArrayOf ( <NUM_LIT> , <NUM_LIT:1.0> ) , doubleArrayOf ( <NUM_LIT> , - <NUM_LIT> ) , doubleArrayOf ( <NUM_LIT> , - <NUM_LIT:1.0> ) ) <EOL> for ( ( a , r ) in data ) { <EOL> assertEquals ( r , a . IEEErem ( <NUM_LIT> ) , "<STR_LIT>" ) <EOL> } <EOL> assertTrue ( Double . NaN . IEEErem ( <NUM_LIT> ) . isNaN ( ) ) <EOL> assertTrue ( <NUM_LIT:2.0> . IEEErem ( Double . NaN ) . isNaN ( ) ) <EOL> assertTrue ( Double . POSITIVE_INFINITY . IEEErem ( <NUM_LIT:2.0> ) . isNaN ( ) ) <EOL> assertTrue ( <NUM_LIT:2.0> . IEEErem ( <NUM_LIT:0.0> ) . isNaN ( ) ) <EOL> assertEquals ( PI , PI . IEEErem ( Double . NEGATIVE_INFINITY ) ) <EOL> }


override fun visitElement ( element : IrElement )

{ <EOL> element . acceptChildrenVoid ( this ) <EOL> }


override fun visitElement ( element : IrElement , data : Nothing ? ) : Boolean

{ <EOL> error ( "<STR_LIT>" ) <EOL> }


override fun visitDeclaration ( declaration : IrDeclarationBase , data : Nothing ? ) : Boolean

{ <EOL> if ( ! needsChecking ( declaration ) ) return true <EOL> if ( declaration . parent is IrPackageFragment ) { <EOL> val vis = declaration as IrDeclarationWithVisibility <EOL> return DescriptorVisibilities . isPrivate ( vis . visibility ) <EOL> } <EOL> return declaration . parent . accept ( this , data ) <EOL> }


override fun visitAnonymousInitializer ( declaration : IrAnonymousInitializer , data : Nothing ? ) : Boolean

= true


override fun visitValueParameter ( declaration : IrValueParameter , data : Nothing ? ) : Boolean

= true


override fun visitVariable ( declaration : IrVariable , data : Nothing ? ) : Boolean

= true


override fun visitErrorDeclaration ( declaration : IrErrorDeclaration , data : Nothing ? ) : Boolean

= true


override fun visitLocalDelegatedProperty ( declaration : IrLocalDelegatedProperty , data : Nothing ? ) : Boolean

= true


override fun visitProperty ( declaration : IrProperty , data : Nothing ? ) : Boolean

= true


override fun visitClass ( declaration : IrClass , data : Nothing ? ) : Boolean

= <EOL> declaration . name == SpecialNames . NO_NAME_PROVIDED || super . visitClass ( declaration , data )


override fun visitField ( declaration : IrField , data : Nothing ? ) : Boolean

= <EOL> declaration . origin == IrDeclarationOrigin . DELEGATE || super . visitField ( declaration , data )


private fun IrDeclaration . shouldBeSkipped ( ) : Boolean

= accept ( skipper , null )


private fun KotlinMangler < IrDeclaration > . isExportCheck ( declaration : IrDeclaration )

= <EOL> ! declaration . shouldBeSkipped ( ) && declaration . isExported ( false )


private fun KotlinMangler < IrDeclaration > . signatureMangle ( declaration : IrDeclaration )

= <EOL> declaration . signatureString ( compatibleMode = false )


private fun < T : Any , R > Iterable < T > . checkAllEqual ( init : R , op : T . ( ) -> R , onError : ( T , R , T , R ) -> Unit ) : R

{ <EOL> var prev : T ? = null <EOL> var r = init <EOL> for ( it in this ) { <EOL> if ( prev == null ) { <EOL> r = it . op ( ) <EOL> prev = it <EOL> } else { <EOL> val tmp = it . op ( ) <EOL> if ( r != tmp ) { <EOL> onError ( prev , r , it , tmp ) <EOL> } <EOL> prev = it <EOL> r = tmp <EOL> } <EOL> } <EOL> return r <EOL> }


override fun visitDeclaration ( declaration : IrDeclarationBase )

{ <EOL> if ( declaration is IrErrorDeclaration ) return <EOL> val exported = manglers . checkAllEqual ( false , { isExportCheck ( declaration ) } ) { m1 , r1 , m2 , r2 -> <EOL> error ( "<STR_LIT>" ) <EOL> } <EOL> if ( ! exported ) return <EOL> manglers . checkAllEqual ( "<STR_LIT>" , { signatureMangle ( declaration ) } ) { m1 , r1 , m2 , r2 -> <EOL> error ( "<STR_LIT>" ) <EOL> } <EOL> declaration . acceptChildrenVoid ( this ) <EOL> }


override fun process ( resolver : Resolver ) : List < KSAnnotated >

{ <EOL> val extensionsGenerator = ExtensionsGenerator ( resolver , codeGenerator , logger ) <EOL> val ( validDataSchemas , invalidDataSchemas ) = extensionsGenerator . resolveDataSchemaDeclarations ( ) <EOL> validDataSchemas . forEach { <EOL> val file = it . origin . containingFile ? : return@forEach <EOL> extensionsGenerator . generateExtensions ( file , it . origin , it . properties ) <EOL> } <EOL> val dataSchemaGenerator = DataSchemaGenerator ( resolver , resolutionDir , logger , codeGenerator ) <EOL> val importStatements = dataSchemaGenerator . resolveImportStatements ( ) <EOL> importStatements . forEach { importStatement -> <EOL> dataSchemaGenerator . generateDataSchema ( importStatement ) <EOL> } <EOL> return invalidDataSchemas <EOL> }


override fun build ( ) : FirLazyExpression

{ <EOL> return FirLazyExpressionImpl ( source , ) <EOL> }


@ OptIn ( ExperimentalContracts :: class ) <EOL> inline fun buildLazyExpression ( init : FirLazyExpressionBuilder . ( ) -> Unit = { } ) : FirLazyExpression

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


operator fun < T > Array < T > ? . get ( i : Int ? )

= this ! ! . get ( i ! ! )


fun < T > array ( vararg t : T ) : Array < T >

= t as Array < T >


{ <EOL> val a : Array < String > ? = array < String > ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> val i : Int ? = <NUM_LIT:1> <EOL> return if ( a [ i ] == "<STR_LIT>" ) "<STR_LIT:OK>" else "<STR_LIT:fail>" <EOL> }


@ Test <EOL> fun `count difference back to previous zero` ( )

{ <EOL> val x = columnOf ( <NUM_LIT:7> , <NUM_LIT:2> , <NUM_LIT:0> , <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:2> , <NUM_LIT:5> , <NUM_LIT:0> , <NUM_LIT:3> , <NUM_LIT:4> ) . named ( "<STR_LIT:X>" ) <EOL> val df = x . toDataFrame ( ) <EOL> val y = columnOf ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:2> ) . named ( "<STR_LIT>" ) <EOL> df . mapToColumn ( "<STR_LIT>" ) { <EOL> if ( it [ x ] == <NUM_LIT:0> ) <NUM_LIT:0> else ( prev ( ) ? . newValue ( ) ? : <NUM_LIT:0> ) + <NUM_LIT:1> <EOL> } shouldBe y <EOL> df . mapToColumn ( "<STR_LIT>" ) { <EOL> if ( it [ "<STR_LIT:X>" ] == <NUM_LIT:0> ) <NUM_LIT:0> else ( prev ( ) ? . newValue ( ) ? : <NUM_LIT:0> ) + <NUM_LIT:1> <EOL> } shouldBe y <EOL> }


{ <EOL> val names = ( '<CHAR_LIT:a>' .. '<CHAR_LIT>' ) . map { it . toString ( ) } <EOL> val random = Random ( <NUM_LIT> ) <EOL> val list = List ( <NUM_LIT> ) { random . nextInt ( <NUM_LIT:1> , <NUM_LIT> ) } <EOL> val df = dataFrameOf ( names ) ( * list . toTypedArray ( ) ) <EOL> val index by column < Int > ( ) <EOL> val vals by column < Int > ( ) <EOL> val name by column < String > ( ) <EOL> val expected = dataFrameOf ( "<STR_LIT>" , "<STR_LIT:name>" ) ( <NUM_LIT:0> , "<STR_LIT:d>" , <NUM_LIT:2> , "<STR_LIT:c>" , <NUM_LIT:3> , "<STR_LIT:f>" ) <EOL> df . add ( "<STR_LIT>" ) { index ( ) } <EOL> . gather { dropLast ( ) } . into ( "<STR_LIT:name>" , "<STR_LIT>" ) <EOL> . sortByDesc { vals } . take ( <NUM_LIT:3> ) [ index , name ] shouldBe expected <EOL> df . add ( "<STR_LIT>" ) { index ( ) } <EOL> . gather { dropLast ( ) } . into ( "<STR_LIT:name>" , "<STR_LIT>" ) <EOL> . sortByDesc ( "<STR_LIT>" ) . take ( <NUM_LIT:3> ) [ "<STR_LIT>" , "<STR_LIT:name>" ] shouldBe expected <EOL> }


@ Test <EOL> fun `group mean and negative values` ( )

{ <EOL> val random = Random ( <NUM_LIT:31> ) <EOL> val lab = listOf ( "<STR_LIT:A>" , "<STR_LIT:B>" ) <EOL> val vals by columnOf ( * Array ( <NUM_LIT> ) { random . nextInt ( - <NUM_LIT> , <NUM_LIT> ) } ) <EOL> val grps by columnOf ( * Array ( <NUM_LIT> ) { lab [ random . nextInt ( <NUM_LIT:0> , <NUM_LIT:2> ) ] } ) <EOL> val df = dataFrameOf ( vals , grps ) <EOL> val expected = dataFrameOf ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ( - <NUM_LIT> , "<STR_LIT:B>" , <NUM_LIT> , - <NUM_LIT:7> , "<STR_LIT:B>" , <NUM_LIT> , <NUM_LIT:16> , "<STR_LIT:A>" , <NUM_LIT> , <NUM_LIT> , "<STR_LIT:B>" , <NUM_LIT> , <NUM_LIT:9> , "<STR_LIT:A>" , <NUM_LIT> , <NUM_LIT:16> , "<STR_LIT:B>" , <NUM_LIT> , - <NUM_LIT> , "<STR_LIT:B>" , <NUM_LIT> , - <NUM_LIT> , "<STR_LIT:A>" , <NUM_LIT> , - <NUM_LIT> , "<STR_LIT:A>" , <NUM_LIT> , - <NUM_LIT> , "<STR_LIT:A>" , <NUM_LIT> , <NUM_LIT> , "<STR_LIT:B>" , <NUM_LIT> , - <NUM_LIT:2> , "<STR_LIT:B>" , <NUM_LIT> , - <NUM_LIT:1> , "<STR_LIT:A>" , <NUM_LIT> , - <NUM_LIT> , "<STR_LIT:B>" , <NUM_LIT> , <NUM_LIT:23> , "<STR_LIT:A>" , <NUM_LIT> ) <EOL> val means = df . filter { vals >= <NUM_LIT:0> } <EOL> . groupBy { grps } . mean ( ) <EOL> . pivot { grps } . values { vals } <EOL> df . add ( "<STR_LIT>" ) { <EOL> if ( vals ( ) < <NUM_LIT:0> ) means [ grps ( ) ] as Double else vals ( ) . toDouble ( ) <EOL> } shouldBe expected <EOL> val meansStr = df . filter { "<STR_LIT>" < Int > ( ) >= <NUM_LIT:0> } <EOL> . groupBy ( "<STR_LIT>" ) . mean ( ) <EOL> . pivot ( "<STR_LIT>" ) . values ( "<STR_LIT>" ) <EOL> df . add ( "<STR_LIT>" ) { <EOL> if ( "<STR_LIT>" < Int > ( ) < <NUM_LIT:0> ) meansStr [ "<STR_LIT>" < String > ( ) ] as Double else "<STR_LIT>" < Int > ( ) . toDouble ( ) <EOL> } shouldBe expected <EOL> }


{ <EOL> val groups by columnOf ( "<STR_LIT:a>" , "<STR_LIT:a>" , "<STR_LIT:b>" , "<STR_LIT:b>" , "<STR_LIT:a>" , "<STR_LIT:b>" , "<STR_LIT:b>" , "<STR_LIT:b>" , "<STR_LIT:a>" , "<STR_LIT:b>" , "<STR_LIT:a>" , "<STR_LIT:b>" ) <EOL> val value by columnOf ( <NUM_LIT:1.0> , <NUM_LIT:2.0> , <NUM_LIT:3.0> , Double . NaN , <NUM_LIT:2.0> , <NUM_LIT:3.0> , Double . NaN , <NUM_LIT:1.0> , <NUM_LIT> , <NUM_LIT:3.0> , Double . NaN , <NUM_LIT> ) <EOL> val df = dataFrameOf ( groups , value ) <EOL> val expected = dataFrameOf ( "<STR_LIT>" , "<STR_LIT:value>" , "<STR_LIT>" ) ( "<STR_LIT:a>" , <NUM_LIT:1.0> , <NUM_LIT:1.0> , "<STR_LIT:a>" , <NUM_LIT:2.0> , <NUM_LIT:2.0> , "<STR_LIT:b>" , <NUM_LIT:3.0> , <NUM_LIT:3.0> , "<STR_LIT:b>" , Double . NaN , <NUM_LIT:3.0> , "<STR_LIT:a>" , <NUM_LIT:2.0> , <NUM_LIT:2.0> , "<STR_LIT:b>" , <NUM_LIT:3.0> , <NUM_LIT:3.0> , "<STR_LIT:b>" , Double . NaN , <NUM_LIT:3.0> , "<STR_LIT:b>" , <NUM_LIT:1.0> , <NUM_LIT:2.0> , "<STR_LIT:a>" , <NUM_LIT> , <NUM_LIT> , "<STR_LIT:b>" , <NUM_LIT:3.0> , <NUM_LIT:2.0> , "<STR_LIT:a>" , Double . NaN , <NUM_LIT> , "<STR_LIT:b>" , <NUM_LIT> , <NUM_LIT> , ) <EOL> df . add ( "<STR_LIT:id>" ) { index ( ) } <EOL> . groupBy { groups } . add ( "<STR_LIT>" ) { <EOL> round ( relative ( - <NUM_LIT:2> .. <NUM_LIT:0> ) [ value ] . filter { ! it . isNaN ( ) } . mean ( ) ) <EOL> } . concat ( ) <EOL> . sortBy ( "<STR_LIT:id>" ) <EOL> . remove ( "<STR_LIT:id>" ) shouldBe expected <EOL> }


public fun isOpenApiStr ( text : String ) : Boolean

= try { <EOL> val parsed = OpenAPIParser ( ) . readContents ( text , null , null ) <EOL> parsed . openAPI ? . components ? . schemas != null <EOL> } catch ( e : Throwable ) { <EOL> logger . debug ( e ) { "<STR_LIT>" } <EOL> false <EOL> }

/** Needs to have any type schemas to convert. */


public fun isOpenApi ( path : String ) : Boolean

= isOpenApi ( asURL ( path ) )


public fun isOpenApi ( url : URL ) : Boolean

{ <EOL> if ( url . path . endsWith ( "<STR_LIT>" ) || url . path . endsWith ( "<STR_LIT>" ) ) { <EOL> return true <EOL> } <EOL> if ( ! url . path . endsWith ( "<STR_LIT>" ) ) { <EOL> return false <EOL> } <EOL> return isOpenApiStr ( url . readText ( ) ) <EOL> }


public fun isOpenApi ( file : File ) : Boolean

{ <EOL> if ( file . extension . lowercase ( ) in listOf ( "<STR_LIT>" , "<STR_LIT>" ) ) { <EOL> return true <EOL> } <EOL> if ( file . extension . lowercase ( ) != "<STR_LIT>" ) { <EOL> return false <EOL> } <EOL> return isOpenApiStr ( file . readText ( ) ) <EOL> }