external fun open ( path : URL , flags : Number , mode : Number ? = definedExternally ) : Promise < FileHandle >


external fun < TBuffer : Uint8Array > read ( handle : FileHandle , buffer : TBuffer , offset : Number ? = definedExternally , length : Number ? = definedExternally , position : Number ? = definedExternally ) : Promise < `T$45` < TBuffer > >


external fun < TBuffer : Uint8Array > write ( handle : FileHandle , buffer : TBuffer , offset : Number ? = definedExternally , length : Number ? = definedExternally , position : Number ? = definedExternally ) : Promise < `T$46` < TBuffer > >


external fun write ( handle : FileHandle , string : Any , position : Number ? = definedExternally , encoding : String ? = definedExternally ) : Promise < `T$44` >


external fun rename ( oldPath : String , newPath : String ) : Promise < Unit >


external fun rename ( oldPath : String , newPath : Buffer ) : Promise < Unit >


external fun rename ( oldPath : String , newPath : URL ) : Promise < Unit >


external fun rename ( oldPath : Buffer , newPath : String ) : Promise < Unit >


external fun rename ( oldPath : Buffer , newPath : Buffer ) : Promise < Unit >


external fun rename ( oldPath : Buffer , newPath : URL ) : Promise < Unit >


external fun rename ( oldPath : URL , newPath : String ) : Promise < Unit >


external fun rename ( oldPath : URL , newPath : Buffer ) : Promise < Unit >


external fun rename ( oldPath : URL , newPath : URL ) : Promise < Unit >


external fun truncate ( path : String , len : Number ? = definedExternally ) : Promise < Unit >


external fun truncate ( path : Buffer , len : Number ? = definedExternally ) : Promise < Unit >


external fun truncate ( path : URL , len : Number ? = definedExternally ) : Promise < Unit >


external fun ftruncate ( handle : FileHandle , len : Number ? = definedExternally ) : Promise < Unit >


external fun rmdir ( path : String , options : fs . RmDirAsyncOptions = definedExternally ) : Promise < Unit >


external fun rmdir ( path : Buffer , options : fs . RmDirAsyncOptions = definedExternally ) : Promise < Unit >


external fun rmdir ( path : URL , options : fs . RmDirAsyncOptions = definedExternally ) : Promise < Unit >


external fun fdatasync ( handle : FileHandle ) : Promise < Unit >


external fun fsync ( handle : FileHandle ) : Promise < Unit >


external fun mkdir ( path : String , options : Number ? = definedExternally ) : Promise < Unit >


external fun mkdir ( path : String , options : String ? = definedExternally ) : Promise < Unit >


external fun mkdir ( path : String , options : fs . MakeDirectoryOptions = definedExternally ) : Promise < Unit >


external fun mkdir ( path : String , options : Nothing ? = definedExternally ) : Promise < Unit >


external fun mkdir ( path : Buffer , options : Number ? = definedExternally ) : Promise < Unit >


external fun mkdir ( path : Buffer , options : String ? = definedExternally ) : Promise < Unit >


external fun mkdir ( path : Buffer , options : fs . MakeDirectoryOptions = definedExternally ) : Promise < Unit >


external fun mkdir ( path : Buffer , options : Nothing ? = definedExternally ) : Promise < Unit >


external fun mkdir ( path : URL , options : Number ? = definedExternally ) : Promise < Unit >


external fun mkdir ( path : URL , options : String ? = definedExternally ) : Promise < Unit >


external fun mkdir ( path : URL , options : fs . MakeDirectoryOptions = definedExternally ) : Promise < Unit >


external fun mkdir ( path : URL , options : Nothing ? = definedExternally ) : Promise < Unit >


external fun readdir ( path : String , options : dynamic = definedExternally ) : Promise < Array < String > >


external fun readdir ( path : Buffer , options : dynamic = definedExternally ) : Promise < Array < String > >


external fun readdir ( path : URL , options : dynamic = definedExternally ) : Promise < Array < String > >


external fun readdir ( path : String , options : `T$48` ) : Promise < Array < Buffer > >


external fun readdir ( path : String , options : String ) : Promise < Array < Buffer > >


external fun readdir ( path : Buffer , options : `T$48` ) : Promise < Array < Buffer > >


external fun readdir ( path : Buffer , options : String ) : Promise < Array < Buffer > >


external fun readdir ( path : URL , options : `T$48` ) : Promise < Array < Buffer > >


external fun readdir ( path : URL , options : String ) : Promise < Array < Buffer > >


external fun readdir ( path : String , options : `T$49` ? = definedExternally ) : Promise < dynamic >


external fun readdir ( path : String , options : String ? = definedExternally ) : Promise < dynamic >


external fun readdir ( path : String , options : Nothing ? = definedExternally ) : Promise < dynamic >


external fun readdir ( path : Buffer , options : `T$49` ? = definedExternally ) : Promise < dynamic >


external fun readdir ( path : Buffer , options : String ? = definedExternally ) : Promise < dynamic >


external fun readdir ( path : Buffer , options : Nothing ? = definedExternally ) : Promise < dynamic >


external fun readdir ( path : URL , options : `T$49` ? = definedExternally ) : Promise < dynamic >


external fun readdir ( path : URL , options : String ? = definedExternally ) : Promise < dynamic >


external fun readdir ( path : URL , options : Nothing ? = definedExternally ) : Promise < dynamic >


external fun readdir ( path : String , options : `T$50` ) : Promise < Array < fs . Dirent > >


external fun readdir ( path : Buffer , options : `T$50` ) : Promise < Array < fs . Dirent > >


external fun readdir ( path : URL , options : `T$50` ) : Promise < Array < fs . Dirent > >


external fun readlink ( path : String , options : dynamic = definedExternally ) : Promise < String >


external fun readlink ( path : Buffer , options : dynamic = definedExternally ) : Promise < String >


external fun readlink ( path : URL , options : dynamic = definedExternally ) : Promise < String >


external fun readlink ( path : String , options : `T$52` ) : Promise < Buffer >


external fun readlink ( path : String , options : String ) : Promise < Buffer >


external fun readlink ( path : Buffer , options : `T$52` ) : Promise < Buffer >


external fun readlink ( path : Buffer , options : String ) : Promise < Buffer >


external fun readlink ( path : URL , options : `T$52` ) : Promise < Buffer >


external fun readlink ( path : URL , options : String ) : Promise < Buffer >


external fun readlink ( path : String , options : `T$53` ? = definedExternally ) : Promise < dynamic >


external fun readlink ( path : String , options : String ? = definedExternally ) : Promise < dynamic >


external fun readlink ( path : String , options : Nothing ? = definedExternally ) : Promise < dynamic >


external fun readlink ( path : Buffer , options : `T$53` ? = definedExternally ) : Promise < dynamic >


external fun readlink ( path : Buffer , options : String ? = definedExternally ) : Promise < dynamic >


external fun readlink ( path : Buffer , options : Nothing ? = definedExternally ) : Promise < dynamic >


external fun readlink ( path : URL , options : `T$53` ? = definedExternally ) : Promise < dynamic >


external fun readlink ( path : URL , options : String ? = definedExternally ) : Promise < dynamic >


external fun readlink ( path : URL , options : Nothing ? = definedExternally ) : Promise < dynamic >


external fun symlink ( target : String , path : String , type : String ? = definedExternally ) : Promise < Unit >


external fun symlink ( target : String , path : Buffer , type : String ? = definedExternally ) : Promise < Unit >


external fun symlink ( target : String , path : URL , type : String ? = definedExternally ) : Promise < Unit >


external fun symlink ( target : Buffer , path : String , type : String ? = definedExternally ) : Promise < Unit >


external fun symlink ( target : Buffer , path : Buffer , type : String ? = definedExternally ) : Promise < Unit >


external fun symlink ( target : Buffer , path : URL , type : String ? = definedExternally ) : Promise < Unit >


external fun symlink ( target : URL , path : String , type : String ? = definedExternally ) : Promise < Unit >


external fun symlink ( target : URL , path : Buffer , type : String ? = definedExternally ) : Promise < Unit >


external fun symlink ( target : URL , path : URL , type : String ? = definedExternally ) : Promise < Unit >


external fun fstat ( handle : FileHandle ) : Promise < fs . Stats >


external fun lstat ( path : String ) : Promise < fs . Stats >


external fun lstat ( path : Buffer ) : Promise < fs . Stats >


external fun lstat ( path : URL ) : Promise < fs . Stats >


external fun stat ( path : String ) : Promise < fs . Stats >


external fun stat ( path : Buffer ) : Promise < fs . Stats >


external fun stat ( path : URL ) : Promise < fs . Stats >


external fun link ( existingPath : String , newPath : String ) : Promise < Unit >


external fun link ( existingPath : String , newPath : Buffer ) : Promise < Unit >


external fun link ( existingPath : String , newPath : URL ) : Promise < Unit >


external fun link ( existingPath : Buffer , newPath : String ) : Promise < Unit >


external fun link ( existingPath : Buffer , newPath : Buffer ) : Promise < Unit >


external fun link ( existingPath : Buffer , newPath : URL ) : Promise < Unit >


external fun link ( existingPath : URL , newPath : String ) : Promise < Unit >


external fun link ( existingPath : URL , newPath : Buffer ) : Promise < Unit >


external fun link ( existingPath : URL , newPath : URL ) : Promise < Unit >


external fun unlink ( path : String ) : Promise < Unit >


external fun unlink ( path : Buffer ) : Promise < Unit >


external fun unlink ( path : URL ) : Promise < Unit >


external fun fchmod ( handle : FileHandle , mode : String ) : Promise < Unit >


external fun fchmod ( handle : FileHandle , mode : Number ) : Promise < Unit >


external fun chmod ( path : String , mode : String ) : Promise < Unit >


external fun chmod ( path : String , mode : Number ) : Promise < Unit >


external fun chmod ( path : Buffer , mode : String ) : Promise < Unit >


external fun chmod ( path : Buffer , mode : Number ) : Promise < Unit >


external fun chmod ( path : URL , mode : String ) : Promise < Unit >


external fun chmod ( path : URL , mode : Number ) : Promise < Unit >


external fun lchmod ( path : String , mode : String ) : Promise < Unit >


external fun lchmod ( path : String , mode : Number ) : Promise < Unit >


external fun lchmod ( path : Buffer , mode : String ) : Promise < Unit >


external fun lchmod ( path : Buffer , mode : Number ) : Promise < Unit >


external fun lchmod ( path : URL , mode : String ) : Promise < Unit >


external fun lchmod ( path : URL , mode : Number ) : Promise < Unit >


external fun lchown ( path : String , uid : Number , gid : Number ) : Promise < Unit >


external fun lchown ( path : Buffer , uid : Number , gid : Number ) : Promise < Unit >


external fun lchown ( path : URL , uid : Number , gid : Number ) : Promise < Unit >


external fun fchown ( handle : FileHandle , uid : Number , gid : Number ) : Promise < Unit >


external fun chown ( path : String , uid : Number , gid : Number ) : Promise < Unit >


external fun chown ( path : Buffer , uid : Number , gid : Number ) : Promise < Unit >


external fun chown ( path : URL , uid : Number , gid : Number ) : Promise < Unit >


external fun utimes ( path : String , atime : String , mtime : dynamic ) : Promise < Unit >


external fun utimes ( path : String , atime : Number , mtime : dynamic ) : Promise < Unit >


external fun utimes ( path : String , atime : Date , mtime : dynamic ) : Promise < Unit >


external fun utimes ( path : Buffer , atime : String , mtime : dynamic ) : Promise < Unit >


external fun utimes ( path : Buffer , atime : Number , mtime : dynamic ) : Promise < Unit >


external fun utimes ( path : Buffer , atime : Date , mtime : dynamic ) : Promise < Unit >


external fun utimes ( path : URL , atime : String , mtime : dynamic ) : Promise < Unit >


external fun utimes ( path : URL , atime : Number , mtime : dynamic ) : Promise < Unit >


external fun utimes ( path : URL , atime : Date , mtime : dynamic ) : Promise < Unit >


external fun futimes ( handle : FileHandle , atime : String , mtime : String ) : Promise < Unit >


external fun futimes ( handle : FileHandle , atime : String , mtime : Number ) : Promise < Unit >


external fun futimes ( handle : FileHandle , atime : String , mtime : Date ) : Promise < Unit >


external fun futimes ( handle : FileHandle , atime : Number , mtime : String ) : Promise < Unit >


external fun futimes ( handle : FileHandle , atime : Number , mtime : Number ) : Promise < Unit >


external fun futimes ( handle : FileHandle , atime : Number , mtime : Date ) : Promise < Unit >


external fun futimes ( handle : FileHandle , atime : Date , mtime : String ) : Promise < Unit >


external fun futimes ( handle : FileHandle , atime : Date , mtime : Number ) : Promise < Unit >


external fun futimes ( handle : FileHandle , atime : Date , mtime : Date ) : Promise < Unit >


external fun realpath ( path : String , options : dynamic = definedExternally ) : Promise < String >


external fun realpath ( path : Buffer , options : dynamic = definedExternally ) : Promise < String >


external fun realpath ( path : URL , options : dynamic = definedExternally ) : Promise < String >


external fun realpath ( path : String , options : `T$52` ) : Promise < Buffer >


external fun realpath ( path : String , options : String ) : Promise < Buffer >


external fun realpath ( path : Buffer , options : `T$52` ) : Promise < Buffer >


external fun realpath ( path : Buffer , options : String ) : Promise < Buffer >


external fun realpath ( path : URL , options : `T$52` ) : Promise < Buffer >


external fun realpath ( path : URL , options : String ) : Promise < Buffer >


external fun realpath ( path : String , options : `T$53` ? = definedExternally ) : Promise < dynamic >


external fun realpath ( path : String , options : String ? = definedExternally ) : Promise < dynamic >


external fun realpath ( path : String , options : Nothing ? = definedExternally ) : Promise < dynamic >


external fun realpath ( path : Buffer , options : `T$53` ? = definedExternally ) : Promise < dynamic >


external fun realpath ( path : Buffer , options : String ? = definedExternally ) : Promise < dynamic >


external fun realpath ( path : Buffer , options : Nothing ? = definedExternally ) : Promise < dynamic >


external fun realpath ( path : URL , options : `T$53` ? = definedExternally ) : Promise < dynamic >


external fun realpath ( path : URL , options : String ? = definedExternally ) : Promise < dynamic >


external fun realpath ( path : URL , options : Nothing ? = definedExternally ) : Promise < dynamic >


external fun mkdtemp ( prefix : String , options : `T$51` ? = definedExternally ) : Promise < String >


external fun mkdtemp ( prefix : String , options : String = definedExternally ) : Promise < String >


external fun mkdtemp ( prefix : String , options : Nothing ? = definedExternally ) : Promise < String >


external fun mkdtemp ( prefix : String , options : `T$52` ) : Promise < Buffer >


external fun mkdtemp ( prefix : String , options : String ) : Promise < Buffer >


external fun mkdtemp ( prefix : String , options : `T$53` ? = definedExternally ) : Promise < dynamic >


external fun mkdtemp ( prefix : String , options : String ? = definedExternally ) : Promise < dynamic >


external fun mkdtemp ( prefix : String , options : Nothing ? = definedExternally ) : Promise < dynamic >


external fun writeFile ( path : String , data : Any , options : `T$38` ? = definedExternally ) : Promise < Unit >


external fun writeFile ( path : String , data : Any , options : String ? = definedExternally ) : Promise < Unit >


external fun writeFile ( path : String , data : Any , options : Nothing ? = definedExternally ) : Promise < Unit >


external fun writeFile ( path : Buffer , data : Any , options : `T$38` ? = definedExternally ) : Promise < Unit >


external fun writeFile ( path : Buffer , data : Any , options : String ? = definedExternally ) : Promise < Unit >


external fun writeFile ( path : Buffer , data : Any , options : Nothing ? = definedExternally ) : Promise < Unit >


external fun writeFile ( path : URL , data : Any , options : `T$38` ? = definedExternally ) : Promise < Unit >


external fun writeFile ( path : URL , data : Any , options : String ? = definedExternally ) : Promise < Unit >


external fun writeFile ( path : URL , data : Any , options : Nothing ? = definedExternally ) : Promise < Unit >


external fun writeFile ( path : FileHandle , data : Any , options : `T$38` ? = definedExternally ) : Promise < Unit >


external fun writeFile ( path : FileHandle , data : Any , options : String ? = definedExternally ) : Promise < Unit >


external fun writeFile ( path : FileHandle , data : Any , options : Nothing ? = definedExternally ) : Promise < Unit >


external fun appendFile ( path : String , data : Any , options : `T$38` ? = definedExternally ) : Promise < Unit >


external fun appendFile ( path : String , data : Any , options : String ? = definedExternally ) : Promise < Unit >


external fun appendFile ( path : String , data : Any , options : Nothing ? = definedExternally ) : Promise < Unit >


external fun appendFile ( path : Buffer , data : Any , options : `T$38` ? = definedExternally ) : Promise < Unit >


external fun appendFile ( path : Buffer , data : Any , options : String ? = definedExternally ) : Promise < Unit >


external fun appendFile ( path : Buffer , data : Any , options : Nothing ? = definedExternally ) : Promise < Unit >


external fun appendFile ( path : URL , data : Any , options : `T$38` ? = definedExternally ) : Promise < Unit >


external fun appendFile ( path : URL , data : Any , options : String ? = definedExternally ) : Promise < Unit >


external fun appendFile ( path : URL , data : Any , options : Nothing ? = definedExternally ) : Promise < Unit >


external fun appendFile ( path : FileHandle , data : Any , options : `T$38` ? = definedExternally ) : Promise < Unit >


external fun appendFile ( path : FileHandle , data : Any , options : String ? = definedExternally ) : Promise < Unit >


external fun appendFile ( path : FileHandle , data : Any , options : Nothing ? = definedExternally ) : Promise < Unit >


external fun readFile ( path : String , options : `T$40` ? = definedExternally ) : Promise < Buffer >


external fun readFile ( path : String , options : Nothing ? = definedExternally ) : Promise < Buffer >


external fun readFile ( path : Buffer , options : `T$40` ? = definedExternally ) : Promise < Buffer >


external fun readFile ( path : Buffer , options : Nothing ? = definedExternally ) : Promise < Buffer >


external fun readFile ( path : URL , options : `T$40` ? = definedExternally ) : Promise < Buffer >


external fun readFile ( path : URL , options : Nothing ? = definedExternally ) : Promise < Buffer >


external fun readFile ( path : FileHandle , options : `T$40` ? = definedExternally ) : Promise < Buffer >


external fun readFile ( path : FileHandle , options : Nothing ? = definedExternally ) : Promise < Buffer >


external fun readFile ( path : String , options : dynamic ) : Promise < String >


external fun readFile ( path : Buffer , options : dynamic ) : Promise < String >


external fun readFile ( path : URL , options : dynamic ) : Promise < String >


external fun readFile ( path : FileHandle , options : dynamic ) : Promise < String >


external fun readFile ( path : String , options : `T$42` ? = definedExternally ) : Promise < dynamic >


external fun readFile ( path : String , options : String ? = definedExternally ) : Promise < dynamic >


external fun readFile ( path : String , options : Nothing ? = definedExternally ) : Promise < dynamic >


external fun readFile ( path : Buffer , options : `T$42` ? = definedExternally ) : Promise < dynamic >


external fun readFile ( path : Buffer , options : String ? = definedExternally ) : Promise < dynamic >


external fun readFile ( path : Buffer , options : Nothing ? = definedExternally ) : Promise < dynamic >


external fun readFile ( path : URL , options : `T$42` ? = definedExternally ) : Promise < dynamic >


external fun readFile ( path : URL , options : String ? = definedExternally ) : Promise < dynamic >


external fun readFile ( path : URL , options : Nothing ? = definedExternally ) : Promise < dynamic >


external fun readFile ( path : FileHandle , options : `T$42` ? = definedExternally ) : Promise < dynamic >


external fun readFile ( path : FileHandle , options : String ? = definedExternally ) : Promise < dynamic >


external fun readFile ( path : FileHandle , options : Nothing ? = definedExternally ) : Promise < dynamic >


external fun open ( path : String , flags : String ) : Promise < FileHandle >


external fun open ( path : String , flags : Number ) : Promise < FileHandle >


external fun open ( path : Buffer , flags : String ) : Promise < FileHandle >


external fun open ( path : Buffer , flags : Number ) : Promise < FileHandle >


external fun open ( path : URL , flags : String ) : Promise < FileHandle >


external fun open ( path : URL , flags : Number ) : Promise < FileHandle >


external fun mkdir ( path : String ) : Promise < Unit >


external fun mkdir ( path : Buffer ) : Promise < Unit >


external fun mkdir ( path : URL ) : Promise < Unit >


external fun readdir ( path : String ) : Promise < Array < String > >


external fun readdir ( path : Buffer ) : Promise < Array < String > >


external fun readdir ( path : URL ) : Promise < Array < String > >


external fun readlink ( path : String ) : Promise < String >


external fun readlink ( path : Buffer ) : Promise < String >


external fun readlink ( path : URL ) : Promise < String >


external fun realpath ( path : String ) : Promise < String >


external fun realpath ( path : Buffer ) : Promise < String >


external fun realpath ( path : URL ) : Promise < String >


external fun mkdtemp ( prefix : String ) : Promise < String >


external fun writeFile ( path : String , data : Any ) : Promise < Unit >


external fun writeFile ( path : Buffer , data : Any ) : Promise < Unit >


external fun writeFile ( path : URL , data : Any ) : Promise < Unit >


external fun writeFile ( path : FileHandle , data : Any ) : Promise < Unit >


external fun appendFile ( path : String , data : Any ) : Promise < Unit >


external fun appendFile ( path : Buffer , data : Any ) : Promise < Unit >


external fun appendFile ( path : URL , data : Any ) : Promise < Unit >


external fun appendFile ( path : FileHandle , data : Any ) : Promise < Unit >


external fun readFile ( path : String ) : Promise < Buffer >


external fun readFile ( path : Buffer ) : Promise < Buffer >


external fun readFile ( path : URL ) : Promise < Buffer >


external fun readFile ( path : FileHandle ) : Promise < Buffer >


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


override fun write ( rangeStart : List < Int > , rangeEnd : List < Int > , rangeCategory : List < Int > , writer : FileWriter )

{ <EOL> writer . appendLine ( isWhitespaceImpl ( rangeStart , rangeEnd ) ) <EOL> }


private fun isWhitespaceImpl ( rangeStart : List < Int > , rangeEnd : List < Int > ) : String

{ <EOL> val checks = rangeChecks ( rangeStart , rangeEnd , "<STR_LIT>" ) <EOL> return """<STR_LIT>""" . trimIndent ( ) <EOL> }


private fun rangeChecks ( rangeStart : List < Int > , rangeEnd : List < Int > , ch : String ) : String

{ <EOL> val tab = "<STR_LIT>" <EOL> var tabCount = <NUM_LIT:5> <EOL> val builder = StringBuilder ( ) <EOL> for ( i in rangeStart . indices ) { <EOL> if ( i != <NUM_LIT:0> ) { <EOL> builder . append ( tab . repeat ( tabCount ) ) . append ( "<STR_LIT>" ) <EOL> } <EOL> val start = rangeStart [ i ] <EOL> val end = rangeEnd [ i ] <EOL> if ( start > <NUM_LIT> && tabCount == <NUM_LIT:5> ) { <EOL> builder . appendLine ( "<STR_LIT>" ) <EOL> tabCount = <NUM_LIT:6> <EOL> builder . append ( tab . repeat ( tabCount ) ) <EOL> } <EOL> builder . appendLine ( ( start .. end ) . rangeCheck ( ch , tab . repeat ( tabCount ) ) ) <EOL> } <EOL> return builder . append ( tab . repeat ( <NUM_LIT:5> ) ) . append ( "<STR_LIT:)>" ) . toString ( ) <EOL> }


internal fun parseSourceSet ( moduleName : String , args : Array < String > ) : DokkaConfiguration . DokkaSourceSet

{ <EOL> if ( moduleName . contains ( '<CHAR_LIT:U+002C>' ) ) { <EOL> throw IllegalArgumentException ( "<STR_LIT>" ) <EOL> } <EOL> val parser = ArgParser ( "<STR_LIT>" , prefixStyle = ArgParser . OptionPrefixStyle . JVM ) <EOL> val sourceSetName by parser . option ( ArgType . String , description = "<STR_LIT>" ) . default ( "<STR_LIT:main>" ) <EOL> val displayName by parser . option ( ArgType . String , description = "<STR_LIT>" ) . default ( DokkaDefaults . sourceSetDisplayName ) <EOL> val classpath by parser . option ( ArgTypeFile , description = "<STR_LIT>" ) . delimiter ( "<STR_LIT:;>" ) <EOL> val sourceRoots by parser . option ( ArgTypeFile , description = "<STR_LIT>" , fullName = "<STR_LIT:src>" ) . delimiter ( "<STR_LIT:;>" ) <EOL> val dependentSourceSets by parser . option ( ArgType . String , description = "<STR_LIT>" + "<STR_LIT>" ) . delimiter ( "<STR_LIT:;>" ) <EOL> val samples by parser . option ( ArgTypeFile , description = "<STR_LIT>" + "<STR_LIT>" ) . delimiter ( "<STR_LIT:;>" ) <EOL> val includes by parser . option ( ArgTypeFile , description = "<STR_LIT>" + "<STR_LIT>" ) . delimiter ( "<STR_LIT:;>" ) <EOL> val includeNonPublic : Boolean by parser . option ( ArgType . Boolean , description = "<STR_LIT>" ) <EOL> . default ( DokkaDefaults . includeNonPublic ) <EOL> val documentedVisibilities by parser . option ( ArgTypeVisibility , description = "<STR_LIT>" ) . delimiter ( "<STR_LIT:;>" ) <EOL> val reportUndocumented by parser . option ( ArgType . Boolean , description = "<STR_LIT>" ) <EOL> . default ( DokkaDefaults . reportUndocumented ) <EOL> val noSkipEmptyPackages by parser . option ( ArgType . Boolean , description = "<STR_LIT>" ) . default ( ! DokkaDefaults . skipEmptyPackages ) <EOL> val skipEmptyPackages by lazy { ! noSkipEmptyPackages } <EOL> val skipDeprecated by parser . option ( ArgType . Boolean , description = "<STR_LIT>" ) <EOL> . default ( DokkaDefaults . skipDeprecated ) <EOL> val jdkVersion by parser . option ( ArgType . Int , description = "<STR_LIT>" ) . default ( DokkaDefaults . jdkVersion ) <EOL> val languageVersion by parser . option ( ArgType . String , description = "<STR_LIT>" ) <EOL> val apiVersion by parser . option ( ArgType . String , description = "<STR_LIT>" ) <EOL> val noStdlibLink by parser . option ( ArgType . Boolean , description = "<STR_LIT>" ) <EOL> . default ( DokkaDefaults . noStdlibLink ) <EOL> val noJdkLink by parser . option ( ArgType . Boolean , description = "<STR_LIT>" ) <EOL> . default ( DokkaDefaults . noJdkLink ) <EOL> val suppressedFiles by parser . option ( ArgTypeFile , description = "<STR_LIT>" ) . delimiter ( "<STR_LIT:;>" ) <EOL> val analysisPlatform : Platform by parser . option ( ArgTypePlatform , description = "<STR_LIT>" ) . default ( DokkaDefaults . analysisPlatform ) <EOL> val perPackageOptions by parser . option ( ArgType . String , description = "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" ) . delimiter ( "<STR_LIT:;>" ) <EOL> val externalDocumentationLinks by parser . option ( ArgType . String , description = "<STR_LIT>" + "<STR_LIT>" ) . delimiter ( "<STR_LIT>" ) <EOL> val sourceLinks by parser . option ( ArgTypeSourceLinkDefinition , description = "<STR_LIT>" + "<STR_LIT>" , fullName = "<STR_LIT>" ) . delimiter ( "<STR_LIT:;>" ) <EOL> parser . parse ( args ) <EOL> return object : DokkaConfiguration . DokkaSourceSet { <EOL> override val displayName = displayName <EOL> override val sourceSetID = DokkaSourceSetID ( moduleName , sourceSetName ) <EOL> override val classpath = classpath . toMutableList ( ) <EOL> override val sourceRoots = sourceRoots . toMutableSet ( ) <EOL> override val dependentSourceSets = dependentSourceSets <EOL> . map { dependentSourceSetName -> dependentSourceSetName . split ( '<CHAR_LIT:/>' ) . let { DokkaSourceSetID ( it [ <NUM_LIT:0> ] , it [ <NUM_LIT:1> ] ) } } <EOL> . toMutableSet ( ) <EOL> override val samples = samples . toMutableSet ( ) <EOL> override val includes = includes . toMutableSet ( ) <EOL> @ Deprecated ( "<STR_LIT>" ) <EOL> override val includeNonPublic = includeNonPublic <EOL> override val reportUndocumented = reportUndocumented <EOL> override val skipEmptyPackages = skipEmptyPackages <EOL> override val skipDeprecated = skipDeprecated <EOL> override val jdkVersion = jdkVersion <EOL> override val sourceLinks = sourceLinks . toMutableSet ( ) <EOL> override val analysisPlatform = analysisPlatform <EOL> override val perPackageOptions = parsePerPackageOptions ( perPackageOptions ) . toMutableList ( ) <EOL> override val externalDocumentationLinks = parseLinks ( externalDocumentationLinks ) . toMutableSet ( ) <EOL> override val languageVersion = languageVersion <EOL> override val apiVersion = apiVersion <EOL> override val noStdlibLink = noStdlibLink <EOL> override val noJdkLink = noJdkLink <EOL> override val suppressedFiles = suppressedFiles . toMutableSet ( ) <EOL> override val documentedVisibilities : Set < DokkaConfiguration . Visibility > = documentedVisibilities . toSet ( ) <EOL> . ifEmpty { DokkaDefaults . documentedVisibilities } <EOL> override fun equals ( other : Any ? ) : Boolean { <EOL> return sourceSetID == ( other as? DokkaConfiguration . DokkaSourceSet ) ? . sourceSetID <EOL> } <EOL> override fun hashCode ( ) : Int { <EOL> return sourceSetID . hashCode ( ) <EOL> } <EOL> } <EOL> }


= "<STR_LIT>"


= "<STR_LIT>" + <EOL> "<STR_LIT>"


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


fun Constraint . isExpectedTypePosition ( )

= <EOL> position . from is ExpectedTypeConstraintPosition < * > || position . from is DelegatedPropertyConstraintPosition < * >


fun NewConstraintError . transformToWarning ( )

= NewConstraintWarning ( lowerType , upperType , position )


@ Test <EOL> fun `test - sourceSetClassifier - default` ( )

= project . runLifecycleAwareTest { <EOL> val target = kotlin . createExternalKotlinTarget < FakeTarget > { defaults ( ) } <EOL> val mainCompilation = target . createCompilation < FakeCompilation > { defaults ( kotlin ) } <EOL> val fakeCompilation = target . createCompilation < FakeCompilation > { <EOL> defaults ( kotlin ) <EOL> compilationName = "<STR_LIT>" <EOL> defaultSourceSet = kotlin . sourceSets . create ( "<STR_LIT>" ) <EOL> } <EOL> assertEquals ( KotlinSourceSetTree . main , KotlinSourceSetTree . orNull ( mainCompilation ) ) <EOL> assertEquals ( KotlinSourceSetTree ( "<STR_LIT>" ) , KotlinSourceSetTree . orNull ( fakeCompilation ) ) <EOL> }


@ Test <EOL> fun `test - sourceSetClassifier - custom name` ( )

= project . runLifecycleAwareTest { <EOL> val target = kotlin . createExternalKotlinTarget < FakeTarget > { defaults ( ) } <EOL> val compilation = target . createCompilation < FakeCompilation > { <EOL> defaults ( kotlin ) <EOL> sourceSetTreeClassifierV2 = KotlinSourceSetTreeClassifier . Name ( "<STR_LIT>" ) <EOL> } <EOL> assertEquals ( KotlinSourceSetTree ( "<STR_LIT>" ) , KotlinSourceSetTree . orNull ( compilation ) ) <EOL> }


@ Test <EOL> fun `test - sourceSetClassifier - custom property` ( )

= project . runLifecycleAwareTest { <EOL> val kotlin = multiplatformExtension <EOL> val myProperty = project . objects . property < KotlinSourceSetTree > ( ) <EOL> val nullProperty = project . objects . property < KotlinSourceSetTree > ( ) <EOL> val target = kotlin . createExternalKotlinTarget < FakeTarget > { defaults ( ) } <EOL> val mainCompilation = target . createCompilation < FakeCompilation > { <EOL> defaults ( kotlin ) <EOL> sourceSetTreeClassifierV2 = KotlinSourceSetTreeClassifier . Property ( myProperty ) <EOL> } <EOL> val auxCompilation = target . createCompilation < FakeCompilation > ( ) { <EOL> compilationName = "<STR_LIT>" <EOL> compilationFactory = CompilationFactory ( :: FakeCompilation ) <EOL> defaultSourceSet = kotlin . sourceSets . create ( "<STR_LIT>" ) <EOL> sourceSetTreeClassifierV2 = KotlinSourceSetTreeClassifier . Property ( nullProperty ) <EOL> } <EOL> launchInStage ( KotlinPluginLifecycle . Stage . FinaliseDsl ) { <EOL> myProperty . set ( KotlinSourceSetTree . main ) <EOL> } <EOL> assertEquals ( KotlinSourceSetTree . main , KotlinSourceSetTree . orNull ( mainCompilation ) ) <EOL> assertNull ( KotlinSourceSetTree . orNull ( auxCompilation ) ) <EOL> }


@ Test <EOL> fun `test - compilation associator - default` ( )

{ <EOL> val target = kotlin . createExternalKotlinTarget < FakeTarget > { defaults ( ) } <EOL> val mainCompilation = target . createCompilation < FakeCompilation > { <EOL> assertEquals ( CompilationAssociator . default , compilationAssociator , "<STR_LIT>" ) <EOL> defaults ( kotlin , "<STR_LIT>" ) <EOL> compileTaskName = "<STR_LIT:main>" <EOL> } <EOL> val auxCompilation = target . createCompilation < FakeCompilation > { <EOL> defaults ( kotlin , "<STR_LIT>" ) <EOL> compilationName = "<STR_LIT>" <EOL> } <EOL> auxCompilation . associateWith ( mainCompilation ) <EOL> assertEquals ( setOf ( mainCompilation ) , auxCompilation . associatedCompilations . toSet ( ) ) <EOL> }


@ Test <EOL> fun `test - compilation associator - custom` ( )

{ <EOL> val target = kotlin . createExternalKotlinTarget < FakeTarget > { defaults ( ) } <EOL> val testTraceKey = extrasKeyOf < String > ( "<STR_LIT>" ) <EOL> val compilationAssociator = CompilationAssociator < FakeCompilation > { auxiliary , main -> <EOL> auxiliary . extras [ testTraceKey ] = "<STR_LIT>" <EOL> main . extras [ testTraceKey ] = "<STR_LIT:main>" <EOL> } <EOL> val mainCompilation = target . createCompilation < FakeCompilation > { <EOL> defaults ( kotlin , "<STR_LIT>" ) <EOL> this . compilationAssociator = compilationAssociator <EOL> this . compileTaskName = "<STR_LIT:main>" <EOL> } <EOL> val auxCompilation = target . createCompilation < FakeCompilation > { <EOL> defaults ( kotlin , "<STR_LIT>" ) <EOL> this . compilationName = "<STR_LIT>" <EOL> this . compilationAssociator = compilationAssociator <EOL> } <EOL> auxCompilation . associateWith ( mainCompilation ) <EOL> assertEquals ( "<STR_LIT>" , auxCompilation . extras [ testTraceKey ] ) <EOL> assertEquals ( "<STR_LIT:main>" , mainCompilation . extras [ testTraceKey ] ) <EOL> }


@ Test <EOL> fun `test - sourcesElements - default configuration` ( )

= project . runLifecycleAwareTest { <EOL> val target = kotlin . createExternalKotlinTarget < FakeTarget > { defaults ( ) } <EOL> target . createCompilation < FakeCompilation > { defaults ( kotlin ) } <EOL> assertNotEquals ( target . sourcesElementsConfiguration , target . sourcesElementsPublishedConfiguration ) <EOL> assertEquals ( target . sourcesElementsConfigurationName , target . sourcesElementsConfiguration . name ) <EOL> assertEquals ( target . sourcesElementsConfiguration . attributes . toMap ( ) , target . sourcesElementsPublishedConfiguration . attributes . toMap ( ) , "<STR_LIT>" ) <EOL> assertEquals ( KotlinPlatformType . jvm , target . sourcesElementsPublishedConfiguration . attributes . getAttribute ( KotlinPlatformType . attribute ) , "<STR_LIT>" ) <EOL> assertEquals ( Category . DOCUMENTATION , target . sourcesElementsPublishedConfiguration . attributes . getAttribute ( Category . CATEGORY_ATTRIBUTE ) ? . name , "<STR_LIT>" ) <EOL> assertEquals ( DocsType . SOURCES , target . sourcesElementsPublishedConfiguration . attributes . getAttribute ( DocsType . DOCS_TYPE_ATTRIBUTE ) ? . name , "<STR_LIT>" ) <EOL> }


@ Test <EOL> fun `test - sourcesElements - configure` ( )

= project . runLifecycleAwareTest { <EOL> val testAttribute = Attribute . of ( "<STR_LIT>" , String :: class . java ) <EOL> val target = kotlin . createExternalKotlinTarget < FakeTarget > { <EOL> defaults ( ) <EOL> sourcesElements . configure { target , configuration -> <EOL> assertEquals ( target . sourcesElementsConfiguration , configuration ) <EOL> configuration . attributes . attributeProvider ( testAttribute , provider { "<STR_LIT>" } ) <EOL> } <EOL> sourcesElementsPublished . configure { target , configuration -> <EOL> assertEquals ( target . sourcesElementsPublishedConfiguration , configuration ) <EOL> configuration . attributes . attributeProvider ( testAttribute , provider { "<STR_LIT>" } ) <EOL> } <EOL> } <EOL> target . createCompilation < FakeCompilation > { defaults ( kotlin ) } <EOL> assertEquals ( "<STR_LIT>" , target . sourcesElementsConfiguration . attributes . getAttribute ( testAttribute ) ) <EOL> assertEquals ( "<STR_LIT>" , target . sourcesElementsPublishedConfiguration . attributes . getAttribute ( testAttribute ) ) <EOL> }


@ Test <EOL> fun `test - sourcesElements - publication` ( )

= project . runLifecycleAwareTest { <EOL> val target = kotlin . createExternalKotlinTarget < FakeTarget > { defaults ( ) } <EOL> target . createCompilation < FakeCompilation > { defaults ( kotlin ) } <EOL> KotlinPluginLifecycle . Stage . AfterFinaliseCompilations . await ( ) <EOL> val component = target . delegate . kotlinComponents . singleOrNull ( ) ? : fail ( "<STR_LIT>" ) <EOL> component . internal . usages . find { it . dependencyConfigurationName == target . sourcesElementsPublishedConfiguration . name } <EOL> ? : fail ( "<STR_LIT>" ) <EOL> }


@ Test <EOL> fun `test - sourcesElements - publication - withSourcesJar set to false` ( )

= project . runLifecycleAwareTest { <EOL> val target = kotlin . createExternalKotlinTarget < FakeTarget > { defaults ( ) } <EOL> target . withSourcesJar ( false ) <EOL> target . createCompilation < FakeCompilation > { defaults ( kotlin ) } <EOL> val component = target . delegate . components . singleOrNull ( ) ? : fail ( "<STR_LIT>" ) <EOL> val sourcesUsage = component . usages . find { it . name . contains ( "<STR_LIT>" , true ) } <EOL> if ( sourcesUsage != null ) { <EOL> fail ( "<STR_LIT>" ) <EOL> } <EOL> }


@ Test <EOL> fun `test - gradle usage component contains the same usages as kotlin component` ( )

= project . runLifecycleAwareTest { <EOL> val target = kotlin . createExternalKotlinTarget < FakeTarget > { defaults ( ) } <EOL> target . createCompilation < FakeCompilation > { defaults ( kotlin ) } <EOL> val kotlinComponent = target . delegate . kotlinComponents . singleOrNull ( ) <EOL> ? : fail ( "<STR_LIT>" ) <EOL> val gradleComponent = target . delegate . components . singleOrNull ( ) <EOL> ? : fail ( "<STR_LIT>" ) <EOL> configurationResult . await ( ) <EOL> val kotlinUsagesNames = kotlinComponent . internal . usages . map { it . dependencyConfigurationName } <EOL> val gradleUsagesNames = ( gradleComponent as SoftwareComponentInternal ) . usages . map { it . name } <EOL> if ( kotlinUsagesNames . toSet ( ) != gradleUsagesNames . toSet ( ) ) <EOL> fail ( "<STR_LIT>" ) <EOL> }


@ Test <EOL> fun `test - gradle usage component contains the same usages as kotlin component after project evaluation` ( )

{ <EOL> val target = kotlin . createExternalKotlinTarget < FakeTarget > { defaults ( ) } <EOL> target . createCompilation < FakeCompilation > { defaults ( kotlin ) } <EOL> project . evaluate ( ) <EOL> val kotlinComponent = target . kotlinComponents . singleOrNull ( ) ? : fail ( "<STR_LIT>" ) <EOL> val gradleComponent = target . components . singleOrNull ( ) ? : fail ( "<STR_LIT>" ) <EOL> if ( kotlinComponent !is SoftwareComponentInternal ) error ( "<STR_LIT>" ) <EOL> val kotlinUsagesNames = kotlinComponent . usages . map { it . name } <EOL> val gradleUsagesNames = gradleComponent . usages . map { it . name } <EOL> if ( kotlinUsagesNames . toSet ( ) != gradleUsagesNames . toSet ( ) ) <EOL> fail ( "<STR_LIT>" ) <EOL> }


@ Test <EOL> fun `test - project structure metadata contains external target variants` ( )

{ <EOL> val target = kotlin . createExternalKotlinTarget < FakeTarget > { defaults ( ) } <EOL> val mainCompilation = target . createCompilation < FakeCompilation > { defaults ( kotlin ) } <EOL> val testCompilation = target . createCompilation < FakeCompilation > { <EOL> defaults ( kotlin ) <EOL> compilationName = "<STR_LIT:test>" <EOL> defaultSourceSet = kotlin . sourceSets . create ( "<STR_LIT>" ) <EOL> } <EOL> kotlin . linuxX64 ( ) <EOL> kotlin . macosX64 ( ) <EOL> fun KotlinHierarchyBuilder . withFakeTarget ( ) = withCompilations { it == mainCompilation || it == testCompilation } <EOL> kotlin . applyHierarchyTemplate { <EOL> sourceSetTrees ( KotlinSourceSetTree . main , KotlinSourceSetTree . test ) <EOL> common { <EOL> group ( "<STR_LIT>" ) { <EOL> withLinux ( ) <EOL> withFakeTarget ( ) <EOL> } <EOL> withMacos ( ) <EOL> } <EOL> } <EOL> project . evaluate ( ) <EOL> val projectStructureMetadata = kotlin . kotlinProjectStructureMetadata <EOL> val fakeApiElementsSourceSets = projectStructureMetadata . sourceSetNamesByVariantName [ "<STR_LIT>" ] <EOL> ? : fail ( "<STR_LIT>" ) <EOL> assertEquals ( setOf ( "<STR_LIT:commonMain>" , "<STR_LIT>" ) , fakeApiElementsSourceSets ) <EOL> val fakeRuntimeElementsSourceSets = projectStructureMetadata . sourceSetNamesByVariantName [ "<STR_LIT>" ] <EOL> ? : fail ( "<STR_LIT>" ) <EOL> assertEquals ( setOf ( "<STR_LIT:commonMain>" , "<STR_LIT>" ) , fakeRuntimeElementsSourceSets ) <EOL> }


@ Test <EOL> fun `test - published component contain user defined attributes` ( )

{ <EOL> val userAttribute = Attribute . of ( "<STR_LIT>" , String :: class . java ) <EOL> val target = kotlin . createExternalKotlinTarget < FakeTarget > { defaults ( ) } <EOL> target . createCompilation < FakeCompilation > { defaults ( kotlin ) } <EOL> target . attributes . attributeProvider ( userAttribute , target . project . provider { "<STR_LIT:foo>" } ) <EOL> project . evaluate ( ) <EOL> val component = target . internal . components . singleOrNull ( ) ? : fail ( "<STR_LIT>" ) <EOL> if ( component . usages . isEmpty ( ) ) fail ( "<STR_LIT>" ) <EOL> component . usages . forEach { usage -> <EOL> if ( ! usage . attributes . contains ( userAttribute ) ) fail ( "<STR_LIT>" ) <EOL> assertEquals ( "<STR_LIT:foo>" , usage . attributes . getAttribute ( userAttribute ) ) <EOL> } <EOL> }


fun < T > bar ( x : T , y : ( T ) -> Boolean ) : Boolean

= y ( x ) && jsTypeOf ( x . asDynamic ( ) ) != "<STR_LIT>"


= js ( "<STR_LIT>" )


{ <EOL> val f = { x : Char -> <EOL> val a : Char = x <EOL> val b : Any = x <EOL> typeOf ( a ) == "<STR_LIT>" && typeOf ( b ) == "<STR_LIT:object>" <EOL> } <EOL> if ( ! f ( '<CHAR_LIT>' ) ) return "<STR_LIT:fail1>" <EOL> if ( ! bar ( '<CHAR_LIT>' , f ) ) return "<STR_LIT:fail2>" <EOL> return "<STR_LIT:OK>" <EOL> }


override fun lower ( irBody : IrBody , container : IrDeclaration )

{ <EOL> if ( ! context . es6mode ) return <EOL> val containerFunction = container as? IrFunction <EOL> val shouldRemoveBoxRelatedDeclarationsAndStatements = <EOL> containerFunction ? . isEs6ConstructorReplacement == true && ! containerFunction . parentAsClass . requiredToHaveBoxParameter ( ) <EOL> if ( containerFunction != null && shouldRemoveBoxRelatedDeclarationsAndStatements && irBody is IrBlockBody ) { <EOL> containerFunction . valueParameters = containerFunction . valueParameters . memoryOptimizedFilterNot { it . isBoxParameter } <EOL> } <EOL> irBody . transformChildrenVoid ( object : IrElementTransformerVoid ( ) { <EOL> override fun visitWhen ( expression : IrWhen ) : IrExpression { <EOL> return if ( shouldRemoveBoxRelatedDeclarationsAndStatements && expression . isBoxParameterDefaultResolution ) { <EOL> irEmpty ( context ) <EOL> } else { <EOL> super . visitWhen ( expression ) <EOL> } <EOL> } <EOL> override fun visitCall ( expression : IrCall ) : IrExpression { <EOL> val callee = expression . symbol . owner <EOL> return when { <EOL> shouldRemoveBoxRelatedDeclarationsAndStatements && ( callee . symbol == context . intrinsics . jsCreateThisSymbol || callee . symbol == context . intrinsics . jsCreateExternalThisSymbol ) -> { <EOL> expression . putValueArgument ( expression . valueArgumentsCount - <NUM_LIT:1> , context . getVoid ( ) ) <EOL> super . visitCall ( expression ) <EOL> } <EOL> callee . isEs6ConstructorReplacement && ( ! callee . parentAsClass . requiredToHaveBoxParameter ( ) || shouldRemoveBoxRelatedDeclarationsAndStatements ) -> { <EOL> val newArgumentsSize = expression . valueArgumentsCount - <NUM_LIT:1> <EOL> super . visitCall ( IrCallImpl ( expression . startOffset , expression . endOffset , expression . type , expression . symbol , expression . typeArgumentsCount , newArgumentsSize , expression . origin , superQualifierSymbol = expression . superQualifierSymbol ) . apply { <EOL> copyTypeArgumentsFrom ( expression ) <EOL> dispatchReceiver = expression . dispatchReceiver <EOL> extensionReceiver = expression . extensionReceiver <EOL> for ( i in <NUM_LIT:0> until newArgumentsSize ) { <EOL> putValueArgument ( i , expression . getValueArgument ( i ) ) <EOL> } <EOL> } ) <EOL> } <EOL> else -> super . visitCall ( expression ) <EOL> } <EOL> } <EOL> } ) <EOL> }


private fun IrClass . requiredToHaveBoxParameter ( ) : Boolean

{ <EOL> return needsOfBoxParameter == true <EOL> }


override fun transformFlat ( declaration : IrDeclaration ) : List < IrDeclaration > ?

{ <EOL> if ( ! context . es6mode || declaration !is IrClass ) return null <EOL> val hasSuperClass = declaration . superClass != null <EOL> if ( hasSuperClass && declaration . isInner ) { <EOL> declaration . addToClassListWhichNeedBoxParameter ( ) <EOL> } <EOL> if ( hasSuperClass && declaration . isLocal && declaration . containsCapturedValues ( ) ) { <EOL> declaration . addToClassListWhichNeedBoxParameter ( ) <EOL> } <EOL> return null <EOL> }


private fun IrClass . containsCapturedValues ( ) : Boolean

{ <EOL> if ( superClass == null ) return false <EOL> declarations <EOL> . filterIsInstanceAnd < IrFunction > { it . isEs6ConstructorReplacement } <EOL> . forEach { <EOL> var meetCapturing = false <EOL> val boxParameter = it . boxParameter <EOL> it . body ? . acceptChildrenVoid ( object : IrElementVisitorVoid { <EOL> override fun visitSetField ( expression : IrSetField ) { <EOL> val receiver = expression . receiver as? IrGetValue <EOL> if ( receiver != null && receiver . symbol == boxParameter ? . symbol ) { <EOL> meetCapturing = true <EOL> } <EOL> super . visitSetField ( expression ) <EOL> } <EOL> } ) <EOL> if ( meetCapturing ) return true <EOL> } <EOL> return false <EOL> }


private fun IrClass . addToClassListWhichNeedBoxParameter ( )

{ <EOL> if ( isExternal ) return <EOL> needsOfBoxParameter = true <EOL> superClass ? . addToClassListWhichNeedBoxParameter ( ) <EOL> }


override fun getSession ( moduleData : FirModuleData ) : FirSession ?

{ <EOL> return sessionCache [ moduleData ] <EOL> }


fun registerSession ( moduleData : FirModuleData , session : FirSession )

{ <EOL> sessionCache [ moduleData ] = session <EOL> }


@ Test <EOL> fun testTheSameValueIsComputedFromDifferentThreads ( )

{ <EOL> val valueWithPostCompute = ValueWithPostCompute ( key = <NUM_LIT:1> , calculate = { Thread . currentThread ( ) . name to Unit } , postCompute = { _ , _ , _ -> } ) <EOL> val results = ConcurrentLinkedQueue < String > ( ) <EOL> val threads = ( <NUM_LIT:0> .. <NUM_LIT:9> ) . map { threadIndex -> <EOL> thread ( name = "<STR_LIT>" , start = false ) { <EOL> results . offer ( valueWithPostCompute . getValue ( ) ) <EOL> } <EOL> } <EOL> threads . forEach { it . start ( ) } <EOL> threads . forEach { it . join ( ) } <EOL> val resultsList = results . toList ( ) <EOL> Assertions . assertEquals ( threads . size , results . size ) <EOL> Assertions . assertTrue ( resultsList . all { it == resultsList [ <NUM_LIT:0> ] } , "<STR_LIT>" ) <EOL> }

/**
 * Tests the following scenario:
 * - thread `t1` access the cache and executes `calculate()` and then `postCompute()` under a lock hold
 * - while the lock hold by `t1`, `t2` tries to also access the value and waits for the lock to be released by `t1`
 * - t1: during the post compute, some recoverable (e.g., PCE) exception happens inside the `postCompute()` and exception is not saved in the cache and rethrown
 * - t1 releases the lock with the `value` set to `ValueIsNotComputed`
 * - t2 acquires the lock and should try to recalculate the value in this case
 */


@ Test <EOL> fun testPCEIsRethrownAndNotSavedInCache ( )

{ <EOL> val valueWithPostCompute = ValueWithPostCompute ( key = <NUM_LIT:1> , calculate = { "<STR_LIT:value>" to Unit } , postCompute = { _ , _ , _ -> <EOL> throw ProcessCanceledException ( ) <EOL> } ) <EOL> val pceOnFirstAccess = kotlin . runCatching { valueWithPostCompute . getValue ( ) } . exceptionOrNull ( ) <EOL> Assertions . assertInstanceOf ( ProcessCanceledException :: class . java , pceOnFirstAccess ) <EOL> val pceOnSecondAccess = kotlin . runCatching { valueWithPostCompute . getValue ( ) } . exceptionOrNull ( ) <EOL> Assertions . assertInstanceOf ( ProcessCanceledException :: class . java , pceOnSecondAccess ) <EOL> Assertions . assertNotEquals ( pceOnFirstAccess , pceOnSecondAccess , "<STR_LIT>" ) <EOL> }


@ Test <EOL> fun testPCEFromPostCompute ( )

{ <EOL> for ( i in <NUM_LIT:1> .. <NUM_LIT:100> ) { <EOL> val t1CalledCalculate = CountDownLatch ( <NUM_LIT:1> ) <EOL> val t2AccessedTheCache = CountDownLatch ( <NUM_LIT:1> ) <EOL> val resultRef = AtomicReference < Any ? > ( null ) <EOL> val valueWithPostCompute = ValueWithPostCompute ( key = <NUM_LIT:1> , calculate = { <EOL> if ( Thread . currentThread ( ) . name == "<STR_LIT>" ) { <EOL> t1CalledCalculate . countDown ( ) <EOL> } <EOL> Thread . currentThread ( ) . name to Unit <EOL> } , postCompute = { _ , _ , _ -> <EOL> t2AccessedTheCache . await ( ) <EOL> if ( Thread . currentThread ( ) . name == "<STR_LIT>" ) { <EOL> throw ProcessCanceledException ( ) <EOL> } <EOL> } ) <EOL> val t1 = thread ( name = "<STR_LIT>" ) { <EOL> try { <EOL> valueWithPostCompute . getValue ( ) <EOL> } catch ( _ : ProcessCanceledException ) { <EOL> } <EOL> } <EOL> val t2 = thread ( name = "<STR_LIT>" ) { <EOL> t1CalledCalculate . await ( ) <EOL> t2AccessedTheCache . countDown ( ) <EOL> try { <EOL> resultRef . set ( valueWithPostCompute . getValue ( ) ) <EOL> } catch ( e : Throwable ) { <EOL> resultRef . set ( e ) <EOL> } <EOL> } <EOL> t2 . join ( ) <EOL> t1 . join ( ) <EOL> when ( val result = resultRef . get ( ) ) { <EOL> is Throwable -> throw result <EOL> else -> Assertions . assertEquals ( "<STR_LIT>" , result ) <EOL> } <EOL> } <EOL> }


@ Suppress ( "<STR_LIT:FunctionName>" ) <EOL> internal fun CborDecodingException ( expected : String , foundByte : Int )

= <EOL> CborDecodingException ( "<STR_LIT>" )


internal fun printByte ( b : Int ) : String

{ <EOL> val hexCode = "<STR_LIT>" <EOL> return buildString { <EOL> append ( hexCode [ b shr <NUM_LIT:4> and <NUM_LIT> ] ) <EOL> append ( hexCode [ b and <NUM_LIT> ] ) <EOL> } <EOL> }


override fun getInstance ( project : Project ) : ProjectIsolationStartParameterAccessor

{ <EOL> return ProjectIsolationStartParameterAccessorG75 ( project . gradle ) <EOL> }


fun resolveByVersionNumber ( versionNumber : Int ) : AbiSignatureVersion

= <EOL> Supported . entries . firstOrNull { it . versionNumber == versionNumber } ? : Unsupported ( versionNumber )


override operator fun get ( signatureVersion : AbiSignatureVersion ) : String ?

= when ( signatureVersion ) { <EOL> is AbiSignatureVersions . Supported -> when ( signatureVersion ) { <EOL> AbiSignatureVersions . Supported . V1 -> signatureV1 <EOL> AbiSignatureVersions . Supported . V2 -> signatureV2 <EOL> } <EOL> else -> error ( "<STR_LIT>" ) <EOL> }


override fun hasAnnotation ( annotationClassName : AbiQualifiedName )

= annotationClassName in annotations


= annotationClassName in annotations


fun < T > Array < out T > . intersect ( other : Iterable < T > )

{ <EOL> val set = toMutableSet ( ) <EOL> set . retainAll ( other ) <EOL> }


fun < X > Array < out X > . toMutableSet ( ) : MutableSet < X >

= TODO ( )


fun < Y > MutableCollection < in Y > . retainAll ( elements : Iterable < Y > )


open fun foo ( x : String , y : String ? = null ) : String

= x + ( y ? : "<STR_LIT:K>" )


{ <EOL> return run { <EOL> class MyClass : A ( ) { <EOL> override fun foo ( x : String , y : String ? ) = super . foo ( x , y ) <EOL> } <EOL> MyClass ( ) <EOL> } . foo ( "<STR_LIT:O>" ) <EOL> }


{ <EOL> var a : Any = A ( ) <EOL> if ( a is I ) return "<STR_LIT:fail1>" <EOL> a = B ( ) <EOL> if ( a !is I ) return "<STR_LIT:fail2>" <EOL> a = D ( ) <EOL> if ( a !is I ) return "<STR_LIT>" <EOL> a = C ( ) <EOL> if ( a is I ) return "<STR_LIT>" <EOL> return "<STR_LIT:OK>" <EOL> }


private fun checkKernelVersionRequirements ( name : String , library : LibraryDefinition , )

{ <EOL> library . minKernelVersion ? . let { minVersion -> <EOL> kernelVersion ? . let { currentVersion -> <EOL> if ( currentVersion < minVersion ) { <EOL> throw ReplException ( """<STR_LIT>""" . trimIndent ( ) , ) <EOL> } <EOL> } <EOL> } <EOL> }


override fun processNewLibraries ( arg : String ) : List < LibraryDefinitionProducer >

= <EOL> splitLibraryCalls ( arg ) . map { <EOL> val ( libRef , vars ) = libraryReferenceParser . parseReferenceWithArgs ( it ) <EOL> val library = <EOL> libraryResolver ? . resolve ( libRef , vars ) <EOL> ? : throw ReplException ( "<STR_LIT>" ) <EOL> _requests . add ( LibraryResolutionRequest ( libRef , vars , library ) ) <EOL> checkKernelVersionRequirements ( libRef . toString ( ) , library ) <EOL> TrivialLibraryDefinitionProducer ( library ) <EOL> }


public fun f ( p0 : Collection < CharSequence ? > ? )


public fun f ( p0 : Comparable < CharSequence ? > ? )


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


{ <EOL> foo ( ) <EOL> }


{ <EOL> f < caret > ( ) <EOL> }


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

{ <EOL> if ( module . files . any { it . isKtsFile } ) { <EOL> loadScriptingPlugin ( configuration ) <EOL> } <EOL> }


fun < T > assertEquals ( a : T , b : T )

{ if ( a != b ) throw AssertionError ( "<STR_LIT>" ) }


= MAX_VALUE


= MIN_VALUE


{ assertEquals ( o === Double . Companion , true ) }


{ <EOL> assertEquals ( <NUM_LIT> , Double . MAX_VALUE ) <EOL> assertEquals ( Double . MIN_VALUE , Double . MIN ( ) ) <EOL> assertEquals ( Double . MAX_VALUE , Double . Companion . MAX ( ) ) <EOL> test ( Double ) <EOL> test ( Double . Companion ) <EOL> return "<STR_LIT:OK>" <EOL> }


{ <EOL> val m = listOf ( "<STR_LIT:OK>" , "<STR_LIT:OK>" ) <EOL> . stream ( ) <EOL> . collect ( Collectors . groupingBy ( Function . identity ( ) , Collectors . counting ( ) ) ) <EOL> if ( m [ "<STR_LIT:OK>" ] != <NUM_LIT> ) return "<STR_LIT>" <EOL> return "<STR_LIT:OK>" <EOL> }


override fun getLibraries ( target : CommonizerTarget ) : Set < NativeLibrary >

{ <EOL> return targetedDependencies [ target ] ? . value . orEmpty ( ) + nonTargetedDependencyRepository . getLibraries ( target ) <EOL> }


{ <EOL> val v = PublicClassHeir ( ) <EOL> return v . foo ( ) + v . bar + v . baz ( ) <EOL> }


= runBlocking < Unit > { <EOL> val request = launch { <EOL> val job1 = GlobalScope . launch { <EOL> delay ( <NUM_LIT> ) <EOL> println ( "<STR_LIT>" ) <EOL> } <EOL> val job2 = launch { <EOL> delay ( <NUM_LIT> ) <EOL> println ( "<STR_LIT>" ) <EOL> } <EOL> job1 . join ( ) <EOL> job2 . join ( ) <EOL> } <EOL> delay ( <NUM_LIT> ) <EOL> request . cancelAndJoin ( ) <EOL> delay ( <NUM_LIT> ) <EOL> }


inline fun transition ( from : State , to : State , block : ( ) -> Unit ) : State

= <EOL> if ( this == from ) { <EOL> block ( ) <EOL> to <EOL> } else this


{ <EOL> state = State . STOPPED <EOL> }


{ <EOL> when ( state ) { <EOL> State . PAUSED -> { <EOL> state = State . PLAYING <EOL> audio . resume ( ) <EOL> } <EOL> State . PLAYING -> { <EOL> state = State . PAUSED <EOL> audio . pause ( ) <EOL> } <EOL> State . STOPPED -> throw Error ( "<STR_LIT>" ) <EOL> } <EOL> }


{ <EOL> clock_gettime ( CLOCK_MONOTONIC , now ) <EOL> return now . pointed . tv_sec + now . pointed . tv_nsec / <NUM_LIT> <EOL> }


fun playFile ( fileName : String , mode : PlayMode )

{ <EOL> println ( "<STR_LIT>" ) <EOL> val file = AVFile ( fileName ) <EOL> try { <EOL> file . dumpFormat ( ) <EOL> val info = decoder . initDecode ( file . context , mode . useVideo , mode . useAudio ) <EOL> val videoSize = requestedSize ? : info . video ? . size ? : Dimensions ( <NUM_LIT> , <NUM_LIT> ) <EOL> info . video ? . let { video . start ( videoSize ) } <EOL> val videoOutput = VideoOutput ( videoSize , video . pixelFormat ( ) ) <EOL> val audioOutput = AudioOutput ( <NUM_LIT> , <NUM_LIT:2> , SampleFormat . S16 ) <EOL> decoder . start ( videoOutput , audioOutput ) <EOL> info . audio ? . let { audio . start ( audioOutput ) } <EOL> lastFrameTime = getTime ( ) <EOL> state = State . PLAYING <EOL> decoder . requestDecodeChunk ( ) <EOL> while ( state != State . STOPPED ) { <EOL> info . video ? . let { playVideoFrame ( it ) } <EOL> input . check ( ) <EOL> checkPause ( ) <EOL> if ( state == State . PLAYING ) syncAV ( info ) <EOL> if ( decoder . done ( ) ) stop ( ) <EOL> } <EOL> } finally { <EOL> stop ( ) <EOL> audio . stop ( ) <EOL> video . stop ( ) <EOL> decoder . stop ( ) <EOL> file . dispose ( ) <EOL> } <EOL> }


private fun playVideoFrame ( videoInfo : VideoInfo )

{ <EOL> val frame = decoder . nextVideoFrame ( ) ? : return <EOL> val now = getTime ( ) <EOL> val frameDuration = <NUM_LIT:1.0> / videoInfo . fps <EOL> val passedTime = now - lastFrameTime <EOL> lastFrameTime += frameDuration <EOL> if ( passedTime < frameDuration ) { <EOL> usleep ( ( <NUM_LIT> * ( frameDuration - passedTime ) ) . toInt ( ) . toUInt ( ) ) <EOL> } else if ( passedTime > frameDuration * <NUM_LIT> ) { <EOL> lastFrameTime = now <EOL> } <EOL> video . nextFrame ( frame . buffer . pointed . data ! ! , frame . lineSize ) <EOL> frame . unref ( ) <EOL> }


{ <EOL> while ( state == State . PAUSED ) { <EOL> audio . pause ( ) <EOL> input . check ( ) <EOL> usleep ( <NUM_LIT:1u> * <NUM_LIT> ) <EOL> } <EOL> audio . resume ( ) <EOL> }


{ <EOL> if ( info . hasVideo ) { <EOL> if ( info . hasAudio ) { <EOL> if ( ! decoder . audioVideoSynced ( ) ) { <EOL> println ( "<STR_LIT>" ) <EOL> while ( ! decoder . audioVideoSynced ( ) && state == State . PLAYING ) { <EOL> usleep ( <NUM_LIT> ) <EOL> input . check ( ) <EOL> } <EOL> } <EOL> } <EOL> } else { <EOL> usleep ( <NUM_LIT> * <NUM_LIT> ) <EOL> } <EOL> }


{ <EOL> val argParser = ArgParser ( "<STR_LIT>" ) <EOL> val mode by argParser . option ( ArgType . Choice < PlayMode > ( ) , shortName = "<STR_LIT>" , description = "<STR_LIT>" ) <EOL> . default ( PlayMode . BOTH ) <EOL> val size by argParser . option ( ArgType . Int , shortName = "<STR_LIT:s>" , description = "<STR_LIT>" ) <EOL> . delimiter ( "<STR_LIT:U+002C>" ) <EOL> val fileName by argParser . argument ( ArgType . String , description = "<STR_LIT>" ) <EOL> argParser . parse ( args ) <EOL> av_register_all ( ) <EOL> val requestedSize = if ( size . size != <NUM_LIT:2> ) { <EOL> if ( size . isNotEmpty ( ) ) <EOL> println ( "<STR_LIT>" ) <EOL> null <EOL> } else <EOL> Dimensions ( size [ <NUM_LIT:0> ] , size [ <NUM_LIT:1> ] ) <EOL> val player = VideoPlayer ( requestedSize ) <EOL> try { <EOL> player . playFile ( fileName , mode ) <EOL> } finally { <EOL> player . dispose ( ) <EOL> } <EOL> }


fun f ( ) : Int


= f ( ) * p1 * p2


= <NUM_LIT:42>


{ <EOL> log += "<STR_LIT>" <EOL> return when ( x ) { <EOL> <NUM_LIT:1> -> "<STR_LIT:one>" <EOL> <NUM_LIT:2> -> "<STR_LIT:two>" <EOL> three ( x ) -> "<STR_LIT>" <EOL> <NUM_LIT:4> -> "<STR_LIT>" <EOL> <NUM_LIT:5> -> "<STR_LIT>" <EOL> else -> "<STR_LIT>" <EOL> } <EOL> }


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


{ <EOL> var result = ( <NUM_LIT:1> .. <NUM_LIT:7> ) . map ( :: foo ) . joinToString ( ) <EOL> if ( result != "<STR_LIT>" ) return "<STR_LIT>" <EOL> if ( log != "<STR_LIT>" ) return "<STR_LIT>" <EOL> return "<STR_LIT:OK>" <EOL> }


suspend fun foo ( p : P = P ( <NUM_LIT:1> ) )


{ <EOL> val data : Project = OwnedProject ( "<STR_LIT>" , "<STR_LIT:kotlin>" ) <EOL> println ( Json . encodeToString ( data ) ) <EOL> }


internal actual fun Continuation < * > . toDebugString ( ) : String

= when ( this ) { <EOL> is DispatchedContinuation -> toString ( ) <EOL> else -> runCatching { "<STR_LIT>" } . getOrElse { "<STR_LIT>" } <EOL> }


{ <EOL> if ( b ) return <NUM_LIT:42> <EOL> else return <NUM_LIT> <EOL> }


{ <EOL> val res = if_else ( false ) <EOL> if ( res != <NUM_LIT> ) return "<STR_LIT>" <EOL> return "<STR_LIT:OK>" <EOL> }


= "<STR_LIT:bar>"


{ <EOL> var module1 = bar ( ) <EOL> assertEquals ( "<STR_LIT:bar>" , module1 ) <EOL> return "<STR_LIT:OK>" <EOL> }


fun foo ( k : String ) : String


= iFoo . foo ( "<STR_LIT:K>" )


= <EOL> fooK { <EOL> fooK { <EOL> fooK { k -> "<STR_LIT:O>" + k } <EOL> } <EOL> }


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

{ <EOL> if ( c . isDebuggerContext ) return <EOL> val inaccessibleClasses = findInaccessibleJavaClasses ( expressionType , c ) <EOL> if ( inaccessibleClasses . isNotEmpty ( ) ) { <EOL> c . trace . report ( Errors . INACCESSIBLE_TYPE . on ( expression , expressionType , inaccessibleClasses ) ) <EOL> return <EOL> } <EOL> if ( expressionTypeWithSmartCast != expressionType ) { <EOL> val inaccessibleClassesWithSmartCast = findInaccessibleJavaClasses ( expressionTypeWithSmartCast , c ) <EOL> if ( inaccessibleClassesWithSmartCast . isNotEmpty ( ) ) { <EOL> c . trace . report ( Errors . INACCESSIBLE_TYPE . on ( expression , expressionType , inaccessibleClassesWithSmartCast ) ) <EOL> } <EOL> } <EOL> }


private fun findInaccessibleJavaClasses ( type : KotlinType , c : ResolutionContext < * > ) : Collection < ClassDescriptor >

{ <EOL> val scopeOwner = c . scope . ownerDescriptor <EOL> val inaccessibleJavaClasses = LinkedHashSet < ClassDescriptor > ( ) <EOL> findInaccessibleJavaClassesRec ( type , scopeOwner , inaccessibleJavaClasses , c . languageVersionSettings ) <EOL> return inaccessibleJavaClasses <EOL> }


private fun findInaccessibleJavaClassesRec ( type : KotlinType , scopeOwner : DeclarationDescriptor , inaccessibleClasses : MutableCollection < ClassDescriptor > , languageVersionSettings : LanguageVersionSettings )

{ <EOL> val declarationDescriptor = type . constructor . declarationDescriptor <EOL> if ( declarationDescriptor is JavaClassDescriptor ) { <EOL> if ( ! DescriptorVisibilityUtils . isVisibleIgnoringReceiver ( declarationDescriptor , scopeOwner , languageVersionSettings ) ) { <EOL> inaccessibleClasses . add ( declarationDescriptor ) <EOL> } <EOL> } <EOL> for ( typeProjection in type . arguments ) { <EOL> if ( typeProjection . isStarProjection ) continue <EOL> findInaccessibleJavaClassesRec ( typeProjection . type , scopeOwner , inaccessibleClasses , languageVersionSettings ) <EOL> } <EOL> }


internal fun ResolvedCall < * > . isImplicitInvoke ( ) : Boolean

{ <EOL> if ( resultingDescriptor . name != OperatorNameConventions . INVOKE ) return false <EOL> val callExpression = call . callElement as? KtCallExpression ? : return false <EOL> val calleeExpression = callExpression . calleeExpression as? KtSimpleNameExpression ? : return true <EOL> return calleeExpression . getReferencedName ( ) != OperatorNameConventions . INVOKE . asString ( ) <EOL> }


internal fun ResolvedCall < * > . isImplicitGet ( ) : Boolean

= <EOL> resultingDescriptor . name == OperatorNameConventions . GET && call . callElement is KtArrayAccessExpression


internal fun ResolvedCall < * > . isImplicitSet ( ) : Boolean

= <EOL> resultingDescriptor . name == OperatorNameConventions . SET && call . callElement is KtArrayAccessExpression


internal fun KtElement . getDynamicOperator ( ) : IrDynamicOperator

{ <EOL> return when ( this ) { <EOL> is KtUnaryExpression -> <EOL> when ( operationToken ) { <EOL> KtTokens . PLUS -> IrDynamicOperator . UNARY_PLUS <EOL> KtTokens . MINUS -> IrDynamicOperator . UNARY_MINUS <EOL> KtTokens . EXCL -> IrDynamicOperator . EXCL <EOL> else -> throw AssertionError ( "<STR_LIT>" ) <EOL> } <EOL> is KtBinaryExpression -> <EOL> when ( operationToken ) { <EOL> KtTokens . PLUS -> IrDynamicOperator . BINARY_PLUS <EOL> KtTokens . MINUS -> IrDynamicOperator . BINARY_MINUS <EOL> KtTokens . MUL -> IrDynamicOperator . MUL <EOL> KtTokens . DIV -> IrDynamicOperator . DIV <EOL> KtTokens . PERC -> IrDynamicOperator . MOD <EOL> KtTokens . LT -> IrDynamicOperator . LT <EOL> KtTokens . LTEQ -> IrDynamicOperator . LE <EOL> KtTokens . GT -> IrDynamicOperator . GT <EOL> KtTokens . GTEQ -> IrDynamicOperator . GE <EOL> KtTokens . ANDAND -> IrDynamicOperator . ANDAND <EOL> KtTokens . OROR -> IrDynamicOperator . OROR <EOL> KtTokens . EQEQ -> IrDynamicOperator . EQEQ <EOL> KtTokens . EQEQEQ -> IrDynamicOperator . EQEQEQ <EOL> KtTokens . EXCLEQ -> IrDynamicOperator . EXCLEQ <EOL> KtTokens . EXCLEQEQEQ -> IrDynamicOperator . EXCLEQEQ <EOL> else -> throw AssertionError ( "<STR_LIT>" ) <EOL> } <EOL> else -> throw AssertionError ( "<STR_LIT>" ) <EOL> } <EOL> }


= ComposeUIViewController { App ( ) }


= mutableListOf < String > ( ) . also { args -> <EOL> if ( include . isNotEmpty ( ) ) { <EOL> args . add ( "<STR_LIT>" ) <EOL> args . add ( include . joinToString ( "<STR_LIT:U+002C>" ) ) <EOL> } <EOL> if ( exclude . isNotEmpty ( ) ) { <EOL> args . add ( "<STR_LIT>" ) <EOL> args . add ( exclude . joinToString ( "<STR_LIT:U+002C>" ) ) <EOL> } <EOL> if ( ignoredTestSuites !== IgnoredTestSuitesReporting . reportAllInnerTestsAsIgnored ) { <EOL> args . add ( "<STR_LIT>" ) <EOL> args . add ( ignoredTestSuites . name ) <EOL> } <EOL> args . addAll ( moduleNames ) <EOL> }


= "<STR_LIT>"


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


= lib ( )


= x


override fun lowerStringLiteralDeclaration ( literal : StringLiteralExpressionDeclaration ) : StringLiteralExpressionDeclaration

{ <EOL> return literal . copy ( value = replacements . entries . fold ( literal . value ) { string , replacement -> <EOL> string . replace ( replacement . key , replacement . value ) <EOL> } ) <EOL> }


override fun lower ( source : SourceSetDeclaration ) : SourceSetDeclaration

{ <EOL> return source . copy ( sources = source . sources . map { sourceFileDeclaration -> <EOL> sourceFileDeclaration . copy ( root = EscapeLiteralsLowering ( ) . lowerSourceDeclaration ( sourceFileDeclaration . root ) ) <EOL> } ) <EOL> }


= <EOL> when ( val y = x ) { <EOL> in <NUM_LIT:0> .. <NUM_LIT:2> -> "<STR_LIT:OK>" <EOL> else -> "<STR_LIT>" <EOL> }


fun logged ( message : String , value : Int )

= <EOL> value . also { log . append ( message ) }


{ <EOL> var sum = <NUM_LIT:0> <EOL> for ( i in ( ( logged ( "<STR_LIT>" , <NUM_LIT:8> ) downTo logged ( "<STR_LIT>" , <NUM_LIT:1> ) ) . reversed ( ) step logged ( "<STR_LIT>" , <NUM_LIT:2> ) ) . reversed ( ) ) { <EOL> sum = sum * <NUM_LIT:10> + i <EOL> } <EOL> assertEquals ( <NUM_LIT> , sum ) <EOL> assertEquals ( "<STR_LIT>" , log . toString ( ) ) <EOL> return "<STR_LIT:OK>" <EOL> }


override fun apply ( project : Project )

{ <EOL> KernelBuildConfigurator ( project ) . configure ( ) <EOL> }


fun catchSomeExceptions ( e : Exception )

{ <EOL> try { <EOL> throw e <EOL> } <EOL> catch ( e : NullPointerException ) { } <EOL> catch ( e : IllegalArgumentException ) { } <EOL> fail ( "<STR_LIT>" ) <EOL> }


{ <EOL> try { <EOL> catchSomeExceptions ( RuntimeException ( ) ) <EOL> } catch ( e : RuntimeException ) { <EOL> return "<STR_LIT:OK>" <EOL> } <EOL> return "<STR_LIT>" <EOL> }


external fun foo ( )


{ <EOL> class Local { <EOL> external fun foo ( ) <EOL> } <EOL> object { <EOL> external fun foo ( ) <EOL> } <EOL> }


override fun printCustomTaskMetrics ( statisticsData : CompileStatisticsData < JpsBuildTime , JpsBuildPerformanceMetric > , printer : Printer )

{ <EOL> val changedFiles = statisticsData . getChanges ( ) . let { changes -> <EOL> changedFileListPerLimit ? . let { changes . subList ( <NUM_LIT:0> , min ( it , changes . size ) ) } ? : changes <EOL> } <EOL> printer . println ( "<STR_LIT>" ) <EOL> printer . println ( "<STR_LIT>" ) <EOL> }


= "<STR_LIT>" ! ! as String ? ?


fun coroutineCreation ( ) : StackTraceElement

= Exception ( ) . artificialFrame ( _CREATION :: class . java . simpleName )

/**
 * Returns an artificial stack trace element denoting the boundary between coroutine creation and its execution.
 *
 * Appearance of this function in stack traces does not mean that it was called. Instead, it is used as a marker
 * that separates the part of the stack trace with the code executed in a coroutine from the stack trace of the code
 * that launched the coroutine.
 *
 * In earlier versions of kotlinx-coroutines, this was displayed as "(Coroutine creation stacktrace)", which caused
 * problems for tooling that processes stack traces: https://github.com/Kotlin/kotlinx.coroutines/issues/2291
 *
 * Note that presence of this marker in a stack trace implies that coroutine creation stack traces were enabled.
 */


fun coroutineBoundary ( ) : StackTraceElement

= Exception ( ) . artificialFrame ( _BOUNDARY :: class . java . simpleName )

/**
 * Returns an artificial stack trace element denoting a coroutine boundary.
 *
 * Appearance of this function in stack traces does not mean that it was called. Instead, when one coroutine invokes
 * another, this is used as a marker in the stack trace to denote where the execution of one coroutine ends and that
 * of another begins.
 *
 * In earlier versions of kotlinx-coroutines, this was displayed as "(Coroutine boundary)", which caused
 * problems for tooling that processes stack traces: https://github.com/Kotlin/kotlinx.coroutines/issues/2291
 */


private fun Throwable . artificialFrame ( name : String ) : StackTraceElement

= <EOL> with ( stackTrace [ <NUM_LIT:0> ] ) { StackTraceElement ( ARTIFICIAL_FRAME_PACKAGE_NAME + "<STR_LIT:.>" + name , "<STR_LIT:_>" , fileName , lineNumber ) }

/**
 * Forms an artificial stack frame with the given class name.
 *
 * It consists of the following parts:
 * 1. The package name, it seems, is needed for the IDE to detect stack trace elements reliably. It is `_COROUTINE` since
 * this is a valid identifier.
 * 2. Class names represents what type of artificial frame this is.
 * 3. The method name is `_`. The methods not being present in class definitions does not seem to affect navigation.
 */


public fun breaks ( breaks : List < DomainType > ? = null , format : String ? = null )

{ <EOL> this . breaks = breaks <EOL> this . format = format <EOL> }

/**
 * Sets legend breaks with formatting.
 *
 * @param breaks list of breaks.
 * @param format format string.
 */


public fun breaksLabeled ( vararg breaksToLabels : Pair < DomainType , String > )

{ <EOL> breaks = breaksToLabels . map { it . first } <EOL> labels = breaksToLabels . map { it . second } <EOL> }

/**
 * Sets legend breaks with labels.
 *
 * @param breaksToLabels list of breaks with corresponding labels.
 */


public fun breaksLabeled ( breaks : List < DomainType > , labels : List < String > )

{ <EOL> this . breaks = breaks <EOL> this . labels = labels <EOL> }

/**
 * Sets legend breaks with labels.
 *
 * @param breaks list of breaks.
 * @param labels list of corresponding labels.
 */


= suspendCoroutineUninterceptedOrReturn { <EOL> x -> <EOL> x . resume ( this . toString ( ) + w ) <EOL> COROUTINE_SUSPENDED <EOL> }


suspend fun A . coroutinebug ( v : Long ? ) : String

{ <EOL> val r = v ? . ext ( ) <EOL> if ( r == null ) return "<STR_LIT:null>" <EOL> return r <EOL> }


suspend fun A . coroutinebug2 ( v : Long ? ) : String

{ <EOL> val r = v ? . ext ( ) ? : "<STR_LIT:null>" <EOL> return r <EOL> }


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


{ <EOL> var result = "<STR_LIT:failU+00202>" <EOL> builder { <EOL> val a = A ( "<STR_LIT>" ) <EOL> val x1 = a . coroutinebug ( null ) <EOL> if ( x1 != "<STR_LIT:null>" ) throw RuntimeException ( "<STR_LIT>" ) <EOL> val x2 = a . coroutinebug ( <NUM_LIT> ) <EOL> if ( x2 != "<STR_LIT>" ) throw RuntimeException ( "<STR_LIT>" ) <EOL> val x3 = a . coroutinebug2 ( null ) <EOL> if ( x3 != "<STR_LIT:null>" ) throw RuntimeException ( "<STR_LIT>" ) <EOL> val x4 = a . coroutinebug2 ( <NUM_LIT> ) <EOL> if ( x4 != "<STR_LIT>" ) throw RuntimeException ( "<STR_LIT>" ) <EOL> result = "<STR_LIT:OK>" <EOL> } <EOL> return result <EOL> }


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


@ Test <EOL> fun testComposableLambdaCall ( )


@ Test <EOL> fun testUnboundSymbolIssue ( )

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


@ Test <EOL> fun testComposableLambdaCallWithGenerics ( )


@ Test <EOL> fun testMethodInvocations ( )


@ Test <EOL> fun testReceiverLambdaInvocation ( )


@ Test <EOL> fun testReceiverLambda2 ( )


@ Test <EOL> fun testNoComposerImport ( )

{ <EOL> codegenNoImports ( """<STR_LIT>""" . trimIndent ( ) ) <EOL> }


{ <EOL> codegen ( """<STR_LIT>""" . trimIndent ( ) ) <EOL> }


@ Test <EOL> fun testInlinedComposable ( )


@ Test <EOL> fun testGenericParameterOrderIssue ( )


@ Test <EOL> fun testArgumentOrderIssue ( )


@ Test <EOL> fun testStuffThatIWantTo ( )


@ Test <EOL> fun testInlineClassesAsComposableParameters ( )


fun codegen ( text : String , dumpClasses : Boolean = false )

{ <EOL> codegenNoImports ( """<STR_LIT>""" , dumpClasses ) <EOL> }


fun codegenNoImports ( text : String , dumpClasses : Boolean = false )

{ <EOL> val className = "<STR_LIT>" <EOL> val fileName = "<STR_LIT>" <EOL> classLoader ( text , fileName , dumpClasses ) <EOL> }


override fun doSubstitute ( configuration : CopyConfiguration ) : FunctionDescriptor ?

{ <EOL> val substituted = super . doSubstitute ( configuration ) as FunctionInvokeDescriptor ? ? : return null <EOL> if ( substituted . valueParameters . none { it . type . extractParameterNameFromFunctionTypeArgument ( ) != null } ) return substituted <EOL> val parameterNames = substituted . valueParameters . map { it . type . extractParameterNameFromFunctionTypeArgument ( ) } <EOL> return substituted . replaceParameterNames ( parameterNames ) <EOL> }


override fun createSubstitutedCopy ( newOwner : DeclarationDescriptor , original : FunctionDescriptor ? , kind : CallableMemberDescriptor . Kind , newName : Name ? , annotations : Annotations , source : SourceElement ) : FunctionDescriptorImpl

{ <EOL> return FunctionInvokeDescriptor ( newOwner , original as FunctionInvokeDescriptor ? , kind , isSuspend ) <EOL> }


= false


private fun replaceParameterNames ( parameterNames : List < Name ? > ) : FunctionDescriptor

{ <EOL> val indexShift = valueParameters . size - parameterNames . size <EOL> assert ( indexShift == <NUM_LIT:0> || indexShift == <NUM_LIT:1> ) <EOL> if ( indexShift == <NUM_LIT:0> && parameterNames . zip ( valueParameters ) . all { ( name , parameter ) -> name == parameter . name } ) { <EOL> return this <EOL> } <EOL> val newValueParameters = valueParameters . map { <EOL> var newName = it . name <EOL> val parameterIndex = it . index <EOL> val nameIndex = parameterIndex - indexShift <EOL> if ( nameIndex >= <NUM_LIT:0> ) { <EOL> val parameterName = parameterNames [ nameIndex ] <EOL> if ( parameterName != null ) { <EOL> newName = parameterName <EOL> } <EOL> } <EOL> it . copy ( this , newName , parameterIndex ) <EOL> } <EOL> val copyConfiguration = newCopyBuilder ( TypeSubstitutor . EMPTY ) <EOL> . setHasSynthesizedParameterNames ( parameterNames . any { it == null } ) <EOL> . setValueParameters ( newValueParameters ) <EOL> . setOriginal ( original ) <EOL> return super . doSubstitute ( copyConfiguration ) ! ! <EOL> }


fun create ( functionClass : FunctionClassDescriptor , isSuspend : Boolean ) : FunctionInvokeDescriptor

{ <EOL> val typeParameters = functionClass . declaredTypeParameters <EOL> val result = FunctionInvokeDescriptor ( functionClass , null , CallableMemberDescriptor . Kind . DECLARATION , isSuspend ) <EOL> result . initialize ( null , functionClass . thisAsReceiverParameter , listOf ( ) , listOf ( ) , typeParameters . takeWhile { it . variance == Variance . IN_VARIANCE } . withIndex ( ) . map { createValueParameter ( result , it . index , it . value ) } , typeParameters . last ( ) . defaultType , Modality . ABSTRACT , DescriptorVisibilities . PUBLIC ) <EOL> result . setHasSynthesizedParameterNames ( true ) <EOL> return result <EOL> }


private fun createValueParameter ( containingDeclaration : FunctionInvokeDescriptor , index : Int , typeParameter : TypeParameterDescriptor ) : ValueParameterDescriptor

{ <EOL> val name = when ( val typeParameterName = typeParameter . name . asString ( ) ) { <EOL> "<STR_LIT:T>" -> "<STR_LIT>" <EOL> "<STR_LIT>" -> "<STR_LIT>" <EOL> else -> { <EOL> typeParameterName . lowercase ( ) <EOL> } <EOL> } <EOL> return ValueParameterDescriptorImpl ( containingDeclaration , null , index , Annotations . EMPTY , Name . identifier ( name ) , typeParameter . defaultType , declaresDefaultValue = false , isCrossinline = false , isNoinline = false , varargElementType = null , SourceElement . NO_SOURCE ) <EOL> }


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


{ <EOL> val x = false <EOL> block b1 @ { <EOL> val y = false <EOL> block b2 @ { <EOL> val z = true <EOL> block b3 @ { <EOL> this@foo + this@b1 + this@b2 + this@b3 + x + y + z + count <EOL> } <EOL> } <EOL> } <EOL> }


fun block ( block : Long . ( ) -> Unit )

= <NUM_LIT> . block ( )


{ <EOL> var arguments = getArguments ( ) <EOL> val parameters = getParameters ( ) <EOL> if ( arguments . size > parameters . size ) { <EOL> assert ( arguments . size == parameters . size + <NUM_LIT:1> ) { "<STR_LIT>" } <EOL> arguments = arguments . subList ( <NUM_LIT:0> , parameters . size ) <EOL> } <EOL> removeDefaultInitializers ( arguments , parameters , body ) <EOL> aliasArgumentsIfNeeded ( namingContext , arguments , parameters , call . source ) <EOL> renameLocalNames ( namingContext , invokedFunction ) <EOL> processReturns ( ) <EOL> namingContext . applyRenameTo ( body ) <EOL> resultExpr = resultExpr ? . let { <EOL> namingContext . applyRenameTo ( it ) as JsNameRef <EOL> } <EOL> }


private fun uncoverClosure ( invokedFunction : JsFunction ) : JsFunction

{ <EOL> val innerFunction = invokedFunction . getInnerFunction ( ) <EOL> val innerCall = getInnerCall ( call . qualifier ) <EOL> return if ( innerCall != null && innerFunction != null ) { <EOL> innerFunction . apply { <EOL> replaceThis ( body ) <EOL> applyCapturedArgs ( innerCall , this , invokedFunction ) <EOL> } <EOL> } <EOL> else { <EOL> invokedFunction . apply { replaceThis ( body ) } <EOL> } <EOL> }


private fun getInnerCall ( qualifier : JsExpression ) : JsInvocation ?

{ <EOL> return when ( qualifier ) { <EOL> is JsInvocation -> qualifier <EOL> is JsNameRef -> { <EOL> val callee = if ( qualifier . ident == Namer . CALL_FUNCTION ) qualifier . qualifier else ( qualifier . name ? . staticRef as? JsExpression ) <EOL> callee ? . let { getInnerCall ( it ) } <EOL> } <EOL> else -> null <EOL> } <EOL> }


private fun applyCapturedArgs ( call : JsInvocation , inner : JsFunction , outer : JsFunction )

{ <EOL> val namingContext = inliningContext . newNamingContext ( ) <EOL> val arguments = call . arguments <EOL> val parameters = outer . parameters <EOL> aliasArgumentsIfNeeded ( namingContext , arguments , parameters , call . source ) <EOL> namingContext . applyRenameTo ( inner ) <EOL> }


private fun replaceThis ( block : JsBlock )

{ <EOL> if ( ! hasThisReference ( block ) ) return <EOL> var thisReplacement = getThisReplacement ( call ) <EOL> if ( thisReplacement == null || thisReplacement is JsThisRef ) return <EOL> val thisName = JsScope . declareTemporaryName ( getThisAlias ( ) ) <EOL> namingContext . newVar ( thisName , thisReplacement , source = call . source ) <EOL> thisReplacement = thisName . makeRef ( ) <EOL> replaceThisReference ( block , thisReplacement ) <EOL> }


{ <EOL> resultExpr = getResultReference ( ) <EOL> val breakName = JsScope . declareTemporaryName ( getBreakLabel ( ) ) <EOL> this . breakLabel = JsLabel ( breakName ) . apply { synthetic = true } <EOL> val visitor = ReturnReplacingVisitor ( resultExpr , breakName . makeRef ( ) , invokedFunction , call . isSuspend ) <EOL> visitor . accept ( body ) <EOL> }


private fun getResultReference ( ) : JsNameRef ?

{ <EOL> if ( ! isResultNeeded ( call ) ) return null <EOL> val resultName = JsScope . declareTemporaryName ( getResultLabel ( ) ) <EOL> this . resultName = resultName <EOL> namingContext . newVar ( resultName , source = call . source ) <EOL> return resultName . makeRef ( ) <EOL> }


private fun getArguments ( ) : List < JsExpression >

{ <EOL> val arguments = call . arguments <EOL> if ( isCallInvocation ( call ) ) { <EOL> return arguments . subList ( <NUM_LIT:1> , arguments . size ) <EOL> } <EOL> return arguments <EOL> }


private fun isResultNeeded ( call : JsInvocation ) : Boolean

{ <EOL> return currentStatement !is JsExpressionStatement || call != currentStatement . expression <EOL> }


private fun getParameters ( ) : List < JsParameter >

{ <EOL> return invokedFunction . parameters <EOL> }


{ <EOL> return getLabelPrefix ( ) + "<STR_LIT>" <EOL> }


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


{ <EOL> val ident = getSimpleIdent ( call ) <EOL> val labelPrefix = ident ? : "<STR_LIT>" <EOL> if ( labelPrefix . endsWith ( "<STR_LIT:$>" ) ) { <EOL> return labelPrefix <EOL> } <EOL> return labelPrefix + "<STR_LIT:$>" <EOL> }


@ JvmStatic fun getInlineableCallReplacement ( call : JsInvocation , function : JsFunction , inliningContext : InliningContext ) : InlineableResult

{ <EOL> val mutator = FunctionInlineMutator ( call , inliningContext , function ) <EOL> mutator . process ( ) <EOL> var inlineableBody : JsStatement = mutator . body <EOL> val breakLabel = mutator . breakLabel <EOL> if ( breakLabel != null ) { <EOL> breakLabel . statement = inlineableBody <EOL> inlineableBody = breakLabel <EOL> } <EOL> return InlineableResult ( inlineableBody , mutator . resultExpr ) <EOL> }


@ JvmStatic <EOL> private fun getThisReplacement ( call : JsInvocation ) : JsExpression ?

{ <EOL> if ( isCallInvocation ( call ) ) { <EOL> return call . arguments [ <NUM_LIT:0> ] <EOL> } <EOL> if ( hasCallerQualifier ( call ) ) { <EOL> return getCallerQualifier ( call ) <EOL> } <EOL> return null <EOL> }


private fun hasThisReference ( body : JsBlock ) : Boolean

{ <EOL> val thisRefs = collectInstances ( JsThisRef :: class . java , body ) <EOL> return ! thisRefs . isEmpty ( ) <EOL> }


fun getContributedDescriptors ( s : String = "<STR_LIT:OK>" ) : String


override fun getContributedDescriptors ( s : String ) : String

= s


= Impl ( ) . getContributedDescriptors ( )


protected open fun IrExpression . useAs ( type : IrType ) : IrExpression

= this


protected open fun IrExpression . useAsStatement ( ) : IrExpression

= this


protected open fun IrExpression . useInTypeOperator ( operator : IrTypeOperator , typeOperand : IrType ) : IrExpression

= <EOL> this


protected open fun IrExpression . useAsValue ( value : IrValueDeclaration ) : IrExpression

= this . useAs ( value . type )


protected open fun IrExpression . useAsArgument ( parameter : IrValueParameter ) : IrExpression

= <EOL> this . useAsValue ( parameter )


protected open fun IrExpression . useAsDispatchReceiver ( expression : IrFunctionAccessExpression ) : IrExpression

= <EOL> this . useAsArgument ( expression . symbol . owner . dispatchReceiverParameter ! ! )


protected open fun IrExpression . useAsExtensionReceiver ( expression : IrFunctionAccessExpression ) : IrExpression

= <EOL> this . useAsArgument ( expression . symbol . owner . extensionReceiverParameter ! ! )


protected open fun IrExpression . useAsValueArgument ( expression : IrFunctionAccessExpression , parameter : IrValueParameter ) : IrExpression

= <EOL> this . useAsArgument ( parameter )


private fun IrExpression . useForVariable ( variable : IrVariable ) : IrExpression

= <EOL> this . useAsValue ( variable )


private fun IrExpression . useForField ( field : IrField ) : IrExpression

= <EOL> this . useAs ( field . type )


protected open fun IrExpression . useAsReturnValue ( returnTarget : IrReturnTargetSymbol ) : IrExpression

= <EOL> when ( returnTarget ) { <EOL> is IrSimpleFunctionSymbol -> this . useAs ( returnTarget . owner . returnType ) <EOL> is IrConstructorSymbol -> this . useAs ( irBuiltIns . unitType ) <EOL> is IrReturnableBlockSymbol -> this . useAs ( returnTarget . owner . type ) <EOL> }


protected open fun IrExpression . useAsResult ( enclosing : IrExpression ) : IrExpression

= <EOL> this . useAs ( enclosing . type )


protected open fun useAsVarargElement ( element : IrExpression , expression : IrVararg ) : IrExpression

= element


override fun visitPropertyReference ( expression : IrPropertyReference ) : IrExpression

{ <EOL> TODO ( ) <EOL> }


override fun visitLocalDelegatedPropertyReference ( expression : IrLocalDelegatedPropertyReference ) : IrExpression

{ <EOL> TODO ( ) <EOL> }


override fun visitFunctionAccess ( expression : IrFunctionAccessExpression ) : IrExpression

{ <EOL> expression . transformChildrenVoid ( this ) <EOL> with ( expression ) { <EOL> dispatchReceiver = dispatchReceiver ? . useAsDispatchReceiver ( expression ) <EOL> extensionReceiver = extensionReceiver ? . useAsExtensionReceiver ( expression ) <EOL> for ( index in <NUM_LIT:0> until valueArgumentsCount ) { <EOL> val argument = getValueArgument ( index ) ? : continue <EOL> val parameter = symbol . owner . valueParameters [ index ] <EOL> putValueArgument ( index , argument . useAsValueArgument ( expression , parameter ) ) <EOL> } <EOL> } <EOL> return expression <EOL> }


override fun visitBlockBody ( body : IrBlockBody ) : IrBody

{ <EOL> body . transformChildrenVoid ( this ) <EOL> body . statements . forEachIndexed { i , irStatement -> <EOL> if ( irStatement is IrExpression ) { <EOL> body . statements [ i ] = irStatement . useAsStatement ( ) <EOL> } <EOL> } <EOL> return body <EOL> }


override fun visitContainerExpression ( expression : IrContainerExpression ) : IrExpression

{ <EOL> if ( ! replaceTypesInsideInlinedFunctionBlock && expression is IrInlinedFunctionBlock ) { <EOL> expression . transformChildrenVoid ( this ) <EOL> return expression <EOL> } <EOL> expression . transformChildrenVoid ( this ) <EOL> if ( expression . statements . isEmpty ( ) ) { <EOL> return expression <EOL> } <EOL> val container = expression . innerInlinedBlockOrThis <EOL> val lastIndex = container . statements . lastIndex <EOL> container . statements . forEachIndexed { i , irStatement -> <EOL> if ( irStatement is IrExpression ) { <EOL> container . statements [ i ] = when ( i ) { <EOL> lastIndex -> irStatement . useAsResult ( expression ) <EOL> else -> irStatement . useAsStatement ( ) <EOL> } <EOL> } <EOL> } <EOL> return expression <EOL> }


override fun visitReturn ( expression : IrReturn ) : IrExpression

{ <EOL> expression . transformChildrenVoid ( this ) <EOL> expression . value = expression . value . useAsReturnValue ( expression . returnTargetSymbol ) <EOL> return expression <EOL> }


override fun visitSetValue ( expression : IrSetValue ) : IrExpression

{ <EOL> expression . transformChildrenVoid ( this ) <EOL> expression . value = expression . value . useAsValue ( expression . symbol . owner ) <EOL> return expression <EOL> }


override fun visitSetField ( expression : IrSetField ) : IrExpression

{ <EOL> expression . transformChildrenVoid ( this ) <EOL> expression . value = expression . value . useForField ( expression . symbol . owner ) <EOL> return expression <EOL> }


override fun visitField ( declaration : IrField ) : IrStatement

{ <EOL> declaration . transformChildrenVoid ( this ) <EOL> declaration . initializer ? . let { <EOL> it . expression = it . expression . useForField ( declaration ) <EOL> } <EOL> return declaration <EOL> }


override fun visitVariable ( declaration : IrVariable ) : IrVariable

{ <EOL> declaration . transformChildrenVoid ( this ) <EOL> declaration . initializer = declaration . initializer ? . useForVariable ( declaration ) <EOL> return declaration <EOL> }


override fun visitWhen ( expression : IrWhen ) : IrExpression

{ <EOL> expression . transformChildrenVoid ( this ) <EOL> for ( irBranch in expression . branches ) { <EOL> irBranch . condition = irBranch . condition . useAs ( irBuiltIns . booleanType ) <EOL> irBranch . result = irBranch . result . useAsResult ( expression ) <EOL> } <EOL> return expression <EOL> }


override fun visitLoop ( loop : IrLoop ) : IrExpression

{ <EOL> loop . transformChildrenVoid ( this ) <EOL> loop . condition = loop . condition . useAs ( irBuiltIns . booleanType ) <EOL> loop . body = loop . body ? . useAsStatement ( ) <EOL> return loop <EOL> }


override fun visitThrow ( expression : IrThrow ) : IrExpression

{ <EOL> expression . transformChildrenVoid ( this ) <EOL> expression . value = expression . value . useAs ( irBuiltIns . throwableType ) <EOL> return expression <EOL> }


override fun visitTry ( aTry : IrTry ) : IrExpression

{ <EOL> aTry . transformChildrenVoid ( this ) <EOL> aTry . tryResult = aTry . tryResult . useAsResult ( aTry ) <EOL> for ( aCatch in aTry . catches ) { <EOL> aCatch . result = aCatch . result . useAsResult ( aTry ) <EOL> } <EOL> aTry . finallyExpression = aTry . finallyExpression ? . useAsStatement ( ) <EOL> return aTry <EOL> }


override fun visitVararg ( expression : IrVararg ) : IrExpression

{ <EOL> expression . transformChildrenVoid ( this ) <EOL> expression . elements . forEachIndexed { i , element -> <EOL> when ( element ) { <EOL> is IrSpreadElement -> <EOL> element . expression = element . expression . useAs ( expression . type ) <EOL> is IrExpression -> { <EOL> expression . putElement ( i , useAsVarargElement ( element , expression ) ) <EOL> } <EOL> } <EOL> } <EOL> return expression <EOL> }


override fun visitTypeOperator ( expression : IrTypeOperatorCall ) : IrExpression

{ <EOL> expression . transformChildrenVoid ( this ) <EOL> expression . argument = expression . argument . useInTypeOperator ( expression . operator , expression . typeOperand ) <EOL> return expression <EOL> }


override fun visitFunction ( declaration : IrFunction ) : IrStatement

{ <EOL> declaration . transformChildrenVoid ( this ) <EOL> declaration . valueParameters . forEach { parameter -> <EOL> val defaultValue = parameter . defaultValue <EOL> if ( defaultValue is IrExpressionBody ) { <EOL> defaultValue . expression = defaultValue . expression . useAsArgument ( parameter ) <EOL> } <EOL> } <EOL> declaration . body ? . let { <EOL> if ( it is IrExpressionBody ) { <EOL> it . expression = it . expression . useAsReturnValue ( declaration . symbol ) <EOL> } <EOL> } <EOL> return declaration <EOL> }


override fun visitStringConcatenation ( expression : IrStringConcatenation ) : IrExpression

{ <EOL> expression . transformChildrenVoid ( ) <EOL> if ( expression is IrStringConcatenationImpl ) { <EOL> for ( ( i , arg ) in expression . arguments . withIndex ( ) ) { <EOL> expression . arguments [ i ] = arg . useAs ( irBuiltIns . anyNType ) <EOL> } <EOL> } <EOL> return expression <EOL> }


private fun IndexerResult . getObjCClass ( name : String )

= <EOL> index . objCClasses . first { it . name == name }


private fun IndexerResult . getObjCCategory ( name : String )

= <EOL> index . objCCategories . first { it . name == name }


@ BeforeTest <EOL> fun checkPlatform ( )

{ <EOL> Assume . assumeTrue ( HostManager . hostIsMac ) <EOL> }


{ <EOL> val index = buildNativeIndex ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> val myClass = index . getObjCClass ( "<STR_LIT>" ) <EOL> val myClassCategories = myClass . includedCategories . map { it . name } <EOL> assertContains ( myClassCategories , "<STR_LIT>" ) <EOL> assertContains ( myClassCategories , "<STR_LIT>" ) <EOL> }


@ Test <EOL> fun `only specific classes include categories` ( )

{ <EOL> val index = buildNativeIndex ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> val skipClass = index . getObjCClass ( "<STR_LIT>" ) <EOL> assertTrue ( skipClass . includedCategories . isEmpty ( ) ) <EOL> }


@ Test <EOL> fun `category from another header is not included` ( )

{ <EOL> val index = buildNativeIndex ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> val myClass = index . getObjCClass ( "<STR_LIT>" ) <EOL> val myClassCategories = myClass . includedCategories . map { it . name } <EOL> assertContains ( myClassCategories , "<STR_LIT>" ) <EOL> assertFalse ( "<STR_LIT>" in myClassCategories ) <EOL> }


@ Test <EOL> fun `external category is not included into index` ( )

{ <EOL> val dependencyIndex = buildNativeIndex ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> val index = buildNativeIndex ( "<STR_LIT>" , "<STR_LIT>" , mockImports ( dependencyIndex ) ) <EOL> val derivedClass = index . getObjCClass ( "<STR_LIT>" ) <EOL> val myClass = derivedClass . baseClass ! ! <EOL> assertEquals ( "<STR_LIT>" , myClass . name ) <EOL> assertFalse ( myClass in index . index . objCClasses ) <EOL> val myClassCategories = myClass . includedCategories <EOL> assertTrue ( myClassCategories . isNotEmpty ( ) ) <EOL> assertTrue ( myClassCategories . all { it !in index . index . objCCategories } ) <EOL> }


@ Test <EOL> fun `category is not included into dependency class` ( )

{ <EOL> val dependencyIndex = buildNativeIndex ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> val index = buildNativeIndex ( "<STR_LIT>" , "<STR_LIT>" , mockImports ( dependencyIndex ) ) <EOL> val category = index . getObjCCategory ( "<STR_LIT>" ) <EOL> assertFalse ( category in category . clazz . includedCategories ) <EOL> }


= sb . appendLine ( x )


{ <EOL> val argAsInt = try { <EOL> arg as Int <EOL> } catch ( e : ClassCastException ) { <EOL> <NUM_LIT:0> <EOL> } <EOL> printInt ( argAsInt ) <EOL> }


{ <EOL> foo ( <NUM_LIT:1> ) <EOL> foo ( "<STR_LIT:Hello>" ) <EOL> val nonConstInt = <NUM_LIT:1> <EOL> val nonConstString = "<STR_LIT:Hello>" <EOL> foo ( nonConstInt ) <EOL> foo ( nonConstString ) <EOL> assertEquals ( "<STR_LIT>" , sb . toString ( ) ) <EOL> return "<STR_LIT:OK>" <EOL> }


= null


{ <EOL> val v = foo ( Pair ( <NUM_LIT:1> ) ) <EOL> return if ( v == null ) "<STR_LIT:OK>" else "<STR_LIT:fail>" <EOL> }


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

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


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

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


{ <EOL> val mutableListOf = mutableListOf ( "<STR_LIT:OK>" , "<STR_LIT:B>" , "<STR_LIT:C>" ) <EOL> return test ( ( mutableListOf as java . util . Collection < String > ) . stream ( ) ) as String <EOL> }


= a . collect ( Collectors . toList ( ) ) . first ( )


@ GCUnsafeCall ( "<STR_LIT>" ) <EOL> public external operator fun get ( index : Int ) : Byte


@ GCUnsafeCall ( "<STR_LIT>" ) <EOL> private external fun getArrayLength ( ) : Int


public operator fun iterator ( ) : ByteIterator

{ <EOL> return ImmutableBlobIteratorImpl ( this ) <EOL> }

/** Creates an iterator over the elements of the array. */


{ <EOL> if ( ! hasNext ( ) ) throw NoSuchElementException ( "<STR_LIT>" ) <EOL> return blob [ index ++ ] <EOL> }


public override operator fun hasNext ( ) : Boolean

{ <EOL> return index < blob . size <EOL> }


@ Suppress ( "<STR_LIT:DEPRECATION>" ) <EOL> @ Deprecated ( "<STR_LIT>" ) <EOL> @ DeprecatedSinceKotlin ( warningSince = "<STR_LIT:1.9>" ) <EOL> @ GCUnsafeCall ( "<STR_LIT>" ) <EOL> public external fun ImmutableBlob . toByteArray ( startIndex : Int = <NUM_LIT:0> , endIndex : Int = size ) : ByteArray

/**
 * Copies the data from this blob into a new [ByteArray].
 *
 * @param startIndex the beginning (inclusive) of the subrange to copy, 0 by default.
 * @param endIndex the end (exclusive) of the subrange to copy, size of this blob by default.
 */


@ Suppress ( "<STR_LIT:DEPRECATION>" ) <EOL> @ Deprecated ( "<STR_LIT>" ) <EOL> @ DeprecatedSinceKotlin ( warningSince = "<STR_LIT:1.9>" ) <EOL> @ ExperimentalUnsignedTypes <EOL> @ GCUnsafeCall ( "<STR_LIT>" ) <EOL> public external fun ImmutableBlob . toUByteArray ( startIndex : Int = <NUM_LIT:0> , endIndex : Int = size ) : UByteArray

/**
 * Copies the data from this blob into a new [UByteArray].
 *
 * @param startIndex the beginning (inclusive) of the subrange to copy, 0 by default.
 * @param endIndex the end (exclusive) of the subrange to copy, size of this blob by default.
 */


@ Suppress ( "<STR_LIT:DEPRECATION>" ) <EOL> @ Deprecated ( "<STR_LIT>" ) <EOL> @ DeprecatedSinceKotlin ( warningSince = "<STR_LIT:1.9>" ) <EOL> public fun ImmutableBlob . asCPointer ( offset : Int = <NUM_LIT:0> ) : CPointer < ByteVar >

= <EOL> interpretCPointer < ByteVar > ( asCPointerImpl ( offset ) ) ! !

/**
 * Returns stable C pointer to data at certain [offset], useful as a way to pass resource
 * to C APIs.
 *
 * `ImmutableBlob` is deprecated since Kotlin 1.9. It is recommended to use `ByteArray` instead.
 * To get a stable C pointer to `ByteArray` data the array needs to be pinned first.
 * ```
 * byteArray.usePinned {
 * val cpointer = it.addressOf(offset)
 * // use the stable C pointer
 * }
 * ```
 * @see kotlinx.cinterop.CPointer
 */


@ Suppress ( "<STR_LIT:DEPRECATION>" ) <EOL> @ Deprecated ( "<STR_LIT>" ) <EOL> @ DeprecatedSinceKotlin ( warningSince = "<STR_LIT:1.9>" ) <EOL> public fun ImmutableBlob . asUCPointer ( offset : Int = <NUM_LIT:0> ) : CPointer < UByteVar >

= <EOL> interpretCPointer < UByteVar > ( asCPointerImpl ( offset ) ) ! !


@ Suppress ( "<STR_LIT:DEPRECATION>" ) <EOL> @ GCUnsafeCall ( "<STR_LIT>" ) <EOL> private external fun ImmutableBlob . asCPointerImpl ( offset : Int ) : kotlin . native . internal . NativePtr


@ Suppress ( "<STR_LIT:DEPRECATION>" ) <EOL> @ Deprecated ( "<STR_LIT>" , ReplaceWith ( "<STR_LIT>" ) ) <EOL> @ DeprecatedSinceKotlin ( warningSince = "<STR_LIT:1.9>" ) <EOL> @ TypedIntrinsic ( IntrinsicType . IMMUTABLE_BLOB ) <EOL> public external fun immutableBlobOf ( vararg elements : Short ) : ImmutableBlob

/**
 * Creates [ImmutableBlob] out of compile-time constant data.
 *
 * This method accepts values of [Short] type in range `0x00..0xff`, other values are prohibited.
 *
 * One element still represent one byte in the output data.
 * This is the only way to create ImmutableBlob for now.
 */


= <NUM_LIT:1>


= a . f ( )


{ <EOL> val result = useA ( A ( ) ) <EOL> if ( result != <NUM_LIT:1> ) return "<STR_LIT>" <EOL> return "<STR_LIT:OK>" <EOL> }


{ <EOL> verifyTokens ( "<STR_LIT:U+002C>" , Token . COMMA ) <EOL> }


{ <EOL> verifyTokens ( "<STR_LIT>" , Token . COMMA ) <EOL> }


{ <EOL> verifyTokens ( "<STR_LIT>" , Token . LBRACKET , Token . RBRACKET , Token . LBRACE , Token . RBRACE , Token . COLON , Token . COMMA ) <EOL> }


{ <EOL> verifyTokens ( "<STR_LIT:true>" , Token . TRUE ) <EOL> verifyTokens ( "<STR_LIT:false>" , Token . FALSE ) <EOL> }


{ <EOL> verifyTokens ( "<STR_LIT:null>" , Token . NullValue ) <EOL> }


{ <EOL> verifyTokens ( """<STR_LIT>""" , Token . StringValue ( "<STR_LIT>" ) ) <EOL> verifyTokens ( """<STR_LIT>""" , Token . StringValue ( "<STR_LIT>" ) ) <EOL> verifyTokens ( """<STR_LIT>""" , Token . StringValue ( "<STR_LIT:/>" ) ) <EOL> verifyTokens ( """<STR_LIT>""" , Token . StringValue ( "<STR_LIT:\n>" ) ) <EOL> verifyTokens ( """<STR_LIT>""" , Token . StringValue ( "<STR_LIT:A>" ) ) <EOL> }


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


{ <EOL> verifyTokens ( "<STR_LIT>" , Token . StringValue ( "<STR_LIT:abc>" ) ) <EOL> }


{ <EOL> verifyTokens ( "<STR_LIT:0>" , Token . LongValue ( <NUM_LIT:0> ) ) <EOL> }


{ <EOL> verifyTokens ( "<STR_LIT>" , Token . LongValue ( - <NUM_LIT:1> ) ) <EOL> }


{ <EOL> verifyTokens ( "<STR_LIT>" , Token . DoubleValue ( <NUM_LIT:0.0> ) ) <EOL> }


{ <EOL> verifyTokens ( "<STR_LIT>" , Token . DoubleValue ( - <NUM_LIT:1.0> ) ) <EOL> }