Prompt:
.toSet()
        val compilationOut = transformer.generateModule(loweredIr.allModules, translationModes, isEsModules)
        return BinaryArtifacts.Js.JsIrArtifact(outputFile, compilationOut).dump(module)
    }

    private fun IrModuleFragment.resolveTestPaths() {
        files.forEach(jsIrPathReplacer::lower)
    }

Response:
private fun loadIrFromKlib(module: TestModule, configuration: CompilerConfiguration): IrModuleInfo {
        val filesToLoad = module.files.takeIf { !firstTimeCompilation }?.map { "/${it.relativePath}" }?.toSet()

        val messageLogger = configuration.irMessageLogger<|endoftext|>


Prompt:
) : KtAbstractFirDiagnostic<KtDeclaration>(firDiagnostic, token), KtFirDiagnostic.NativeSetterWrongReturnType

internal class JsNameIsNotOnAllAccessorsImpl(
    firDiagnostic: KtPsiDiagnostic,
    token: KtLifetimeToken,

Response:
) : KtAbstractFirDiagnostic<KtElement>(firDiagnostic, token), KtFirDiagnostic.JsNameIsNotOnAllAccessors

internal class JsNameProhibitedForNamedNativeImpl(
    firDiagnostic: KtPsiDiagnostic,
    token: KtLifetimeToken,<|endoftext|>


Prompt:
open external class A {
    open fun f(x: Int = definedExternally)
}

class B : A() {
    <!OVERRIDING_EXTERNAL_FUN_WITH_OPTIONAL_PARAMS!>override fun f(x: Int)<!> {}
}

class BB : A()

external class C : A {
    override fun f(x: Int)
}

Response:
external interface I {
    fun f(x: Int = definedExternally)
}

interface J {
    fun f(x: Int = 23)
}

interface II {
    fun f(x: Int)
}

interface IIJ : II, J

open external class D {
    open fun f(x: Int)
}

class E : D() {<|endoftext|>


Prompt:
tokens: List<IElementType>, atStreamEdge: Boolean, getter: WhitespacesAndCommentsBinder.TokenTextGetter
    ): Int {
        if (tokens.isEmpty()) return 0

        var result = 0
        tokens@ for (idx in tokens.indices) {
            val tokenType = tokens[idx]
            when (tokenType) {

Response:
KtTokens.WHITE_SPACE -> if (StringUtil.containsLineBreak(getter[idx])) break@tokens

                KtTokens.EOL_COMMENT, KtTokens.BLOCK_COMMENT -> result = idx + 1

                else -> break@tokens
            }
        }

        return result
    }
}<|endoftext|>


Prompt:
checkCopyOfRangeArguments(fromIndex, toIndex, size)
    return copyOfUninitializedElements(fromIndex, toIndex)
}

/**
 * Returns a new array which is a copy of the specified range of the original array.
 *
 * @param fromIndex the start of the range (inclusive) to copy.
 * @param toIndex the end of the range (exclusive) to copy.
 *

Response:
* @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.
 * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].
 */
public actual fun ByteArray.copyOfRange(fromIndex: Int, toIndex: Int): ByteArray {
    checkCopyOfRangeArguments(fromIndex, toIndex, size)<|endoftext|>


Prompt:
<!DEBUG_INFO_CALL("fqName: testsCase3.Super_2.Nested.values.invoke; typeCall: variable&invoke")!>values()<!>
        }
    }

    inner class Inner : Super_1() {
        private fun case() {

Response:
<!DEBUG_INFO_CALL("fqName: testsCase3.Super_1.values.invoke; typeCall: variable&invoke")!>values()<!>
        }
    }

}

// FILE: TestCase4.kt
// TESTCASE NUMBER: 4
package testsCase4

open class A {
    operator fun invoke(value: String) = print("invoke $value")<|endoftext|>


Prompt:
override fun getUnsubstitutedMemberScope() = super.getUnsubstitutedMemberScope() as LazyJavaClassMemberScope
    override fun getConstructors() = unsubstitutedMemberScope.constructors()

    override val annotations = c.resolveAnnotations(jClass)

    private val declaredParameters = c.storageManager.createLazyValue {

Response:
jClass.typeParameters.map { p ->
            c.typeParameterResolver.resolveTypeParameter(p)
                ?: throw AssertionError("Parameter $p surely belongs to class $jClass, so it must be resolved")
        }
    }

    override fun getDeclaredTypeParameters() = declaredParameters()

    override fun getDefaultFunctionTypeForSamInterface(): SimpleType? =<|endoftext|>


Prompt:
// Actually, only reified types get here, and it would be properly to put assertion here
                // However, it's better to generate wrong code than crash
                return regularAndUnstable()
            }

            fun mangledAndStable() = NameAndStability(getStableMangledName(baseName, encodeSignature(descriptor)), true)

Response:
fun mangledInternal() = NameAndStability(getInternalMangledName(baseName, encodeSignature(descriptor)), true)
            fun mangledPrivate() = NameAndStability(getPrivateMangledName(baseName, descriptor), false)

            val effectiveVisibility = descriptor.ownEffectiveVisibility

            val containingDeclaration = descriptor.containingDeclaration
            return when (containingDeclaration) {<|endoftext|>


Prompt:
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.JvmStandardClassIds.JVM_DEFAULT_CLASS_ID
import org.jetbrains.kotlin.name.Name

/**
 * A generator for delegated members from implementation by delegation.
 *

Response:
* It assumes a synthetic field with the super-interface type has been created for the delegate expression. It looks for delegatable
 * methods and properties in the super-interface, and creates corresponding members in the subclass.
 * TODO: generic super interface types and generic delegated members.
 */
class DelegatedMemberGenerator(private val c: Fir2IrComponents) : Fir2IrComponents by c {<|endoftext|>


Prompt: <!REPEATED_ANNOTATION!>@A2(<!ARGUMENT_TYPE_MISMATCH!>"Test"<!>)<!> T>

Response:
}
    }
}<|endoftext|>


Prompt:
get() = asIr().isNoinline
    override val ValueParameterSymbolMarker.isCrossinline: Boolean
        get() = asIr().isCrossinline
    override val ValueParameterSymbolMarker.hasDefaultValue: Boolean
        get() = asIr().hasDefaultValue()

    override val ValueParameterSymbolMarker.hasDefaultValueNonRecursive: Boolean

Response:
get() = asIr().defaultValue != null

    override fun CallableSymbolMarker.isAnnotationConstructor(): Boolean {
        val irConstructor = safeAsIr<IrConstructor>() ?: return false
        return irConstructor.constructedClass.isAnnotationClass
    }

    override val TypeParameterSymbolMarker.bounds: List<IrType><|endoftext|>


Prompt:
firDiagnostic as KtPsiDiagnostic,
            token,
        )
    }
    add(FirErrors.NO_VALUE_FOR_PARAMETER) { firDiagnostic ->
        NoValueForParameterImpl(
            firSymbolBuilder.buildSymbol(firDiagnostic.a),
            firDiagnostic as KtPsiDiagnostic,
            token,

Response:
)
    }
    add(FirErrors.NAMED_PARAMETER_NOT_FOUND) { firDiagnostic ->
        NamedParameterNotFoundImpl(
            firDiagnostic.a,
            firDiagnostic as KtPsiDiagnostic,
            token,
        )
    }<|endoftext|>


Prompt:
open fun visitStubNode(node: StubNode) {
        visitNode(node)
    }

    open fun visitVariableDeclarationNode(node: VariableDeclarationNode) {
        visitNode(node)
    }

    open fun visitVariableAssignmentNode(node: VariableAssignmentNode) {
        visitNode(node)
    }

Response:
open fun visitEnterSafeCallNode(node: EnterSafeCallNode) {
        visitNode(node)
    }

    open fun visitExitSafeCallNode(node: ExitSafeCallNode) {
        visitNode(node)
    }

    // ---------------------------------------------------------------------------------------------------------------------

    final override fun visitNode(node: CFGNode<*>, data: Nothing?) {
        visitNode(node)
    }<|endoftext|>


Prompt:
var index = size
    val result = java.util.Arrays.copyOf(this, index + elements.size)
    for (element in elements) result[index++] = element
    return result
}

/**
 * Returns an array containing all elements of the original array and then all elements of the given [elements] collection.
 */

Response:
public actual operator fun ShortArray.plus(elements: Collection<Short>): ShortArray {
    var index = size
    val result = java.util.Arrays.copyOf(this, index + elements.size)
    for (element in elements) result[index++] = element
    return result
}

/**
 * Returns an array containing all elements of the original array and then all elements of the given [elements] collection.<|endoftext|>


Prompt:
this@with.<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>yield<!>("")

                <!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>yield2<!>("")

Response:
this@with.<!ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL!>yield2<!>("")
            }
        }
    }

    buildSequence<Int> a@{
        yield(1)
        yield2(1)
        buildSequence {
            yield("")
            yield2("")<|endoftext|>


Prompt:
test(SIMPLE0, PrivateClass().call_private_baz)
    test(NATIVE, PrivateClass().call_private_native_baz)

    testGroup = "Open Public Class"
    test(STABLE) { OpenPublicClass().public_baz(0) }
    test(NATIVE) { OpenPublicClass().public_baz("native") }

Response:
test(INTERNAL) { OpenPublicClass().internal_baz(0) }
    test(NATIVE) { OpenPublicClass().internal_baz("native") }
    testMangledPrivate(OpenPublicClass().call_private_baz)
    test(NATIVE, OpenPublicClass().call_private_native_baz)

    testGroup = "Open Internal Class"<|endoftext|>


Prompt:
listener: (Elements, Trees) -> TaskListener? = { _, _ -> null }
) {
    val compiler = ToolProvider.getSystemJavaCompiler()
    compiler.getStandardFileManager(null, null, null).use { fileManager ->
        val javaSrcs = fileManager.getJavaFileObjectsFromFiles(srcFiles)
        val compilationTask =
            compiler.getTask(

Response:
null,
                fileManager,
                null,
                listOf("-proc:only", "-s", generatedSources.absolutePath, "-d", generatedSources.absolutePath, "-cp", classpath.joinToString(separator = File.pathSeparator)),
                null,
                javaSrcs
            ) as JavacTaskImpl<|endoftext|>


Prompt:
interface RttiExpressionChecker {
    fun check(rttiInformation: RttiExpressionInformation, reportOn: PsiElement, trace: BindingTrace)
}

enum class RttiOperation {
    IS,
    NOT_IS,
    AS,
    SAFE_AS
}

class RttiExpressionInformation(
    val subject: KtElement,
    val sourceType: KotlinType?,

Response:
val targetType: KotlinType?,
    val operation: RttiOperation
)<|endoftext|>


Prompt:
statisticsData.getKotlinLanguageVersion()?.also {
        withIndent("Task info:") {
            println("Kotlin language version: $it")
        }
    }

    if (statisticsData.getIcLogLines().isNotEmpty()) {
        withIndent("Compilation log for task '${statisticsData.getTaskName()}':") {

Response:
statisticsData.getIcLogLines().forEach { println(it) }
        }
    }
}<|endoftext|>


Prompt:
constantValuesCache.getOrPut(IrConstValueCacheKey(value)) {
                evaluateConstantValueImpl(value)
            }

    private fun evaluateConstantValueImpl(value: IrConstantValue): ConstValue {
        val symbols = context.ir.symbols
        return when (value) {
            is IrConstantPrimitive -> {
                val constructedType = value.value.type

Response:
if (context.getTypeConversion(constructedType, value.type) != null) {
                    if (value.value.kind == IrConstKind.Null) {
                        Zero(value.type.toLLVMType(llvm))
                    } else {
                        require(value.type.toLLVMType(llvm) == codegen.kObjHeaderPtr) {<|endoftext|>


Prompt:
private val processOptions: ProcessForkOptions = DefaultProcessForkOptions(fileResolver)

    @get:Internal
    val executableProperty: Property<FileCollection> = project.objects.property(FileCollection::class.java)

    @get:PathSensitive(PathSensitivity.ABSOLUTE)
    @get:IgnoreEmptyDirectories
    @get:NormalizeLineEndings

Response:
@get:InputFiles // use FileCollection & @InputFiles rather than @InputFile to allow for task dependencies built-into this FileCollection
    @get:SkipWhenEmpty
    @Suppress("UNUSED") // Gradle input
    internal val executableFiles: FileCollection // Gradle < 5.0 seems to not work properly with @InputFiles Property<FileCollection>
        get() = executableProperty.get()

    private val executableFile<|endoftext|>


Prompt:
assertEquals(kotlinOnyFiles.size, expansionResult.size)
            assertEquals(kotlinOnyFiles, expansionResult.toSet())
        }
    }

    @Test
    fun dirPattern() {
        val fileNames = listOf("one.kt", "two.kt", "three.kt", "four.java", "five.py")

Response:
val dirNames = listOf(null, "foo", "bar", "baz")
        val pattern = "ba*/*.kt" // covers "bar" & "baz" dirs

        dirNames.forEach { dirName -> createDirWithFiles(dirName, fileNames) }

        val fullPattern = testDir.resolve(pattern)
        val expansionResult = expandGlob(fullPattern)<|endoftext|>


Prompt:
// like dropLast but creates a view to the original list instead of copying content of it
private fun <T> List<T>.subListWithoutLast(n: Int) = if (size > n) subList(0, size - n) else emptyList()

private sealed class BlockOrBody {
    abstract val element: IrElement

    data class Body(val body: IrBody) : BlockOrBody() {

Response:
override val element get() = body
    }

    data class Block(val block: IrBlock) : BlockOrBody() {
        override val element get() = block
    }
}

/**
 * Finds the most narrow block or body which contains all usages of each of the given variables
 */<|endoftext|>


Prompt:
fun test(b: B, c: C) {
    val k: Nothing = b.a
    b.foo(k)
    val k2: Nothing = b.bar()
    val k3: List<Nothing> = b.b

    val k4: Nothing? = b.c
    b.foo2(k4)
    val k5: Nothing? = b.bar2()

Response:
val k6: List<Nothing?> = b.d

    val k7: Nothing = c.a
    c.foo(k)
    val k8: Nothing = c.bar()
    val k9: List<Nothing> = c.b

    val k10: Nothing? = c.c
    c.foo2(k4)
    val k11: Nothing? = c.bar2()<|endoftext|>


Prompt:
assert(p1!!.call() is OnlyPrimary)

    val p2 = PrimaryWithSecondary::class.primaryConstructor
    assertNotNull(p2)
    assert(p2!!.call("beer").toString() == "beer")

    val p3 = OnlySecondary::class.primaryConstructor
    assertNull(p3)

    val p4 = TwoSecondaries::class.primaryConstructor

Response:
assertNull(p4)

    assertNotNull(En::class.primaryConstructor)

    assertNull(I::class.primaryConstructor)
    assertNull(O::class.primaryConstructor)
    assertNull(C.Companion::class.primaryConstructor)

    assertNull(object {}::class.primaryConstructor)

    return "OK"
}<|endoftext|>


Prompt:
fun visitConstructorCall(expression: IrConstructorCall) {
        visitFunctionAccess(expression)
    }

    override fun visitSingletonReference(expression: IrGetSingletonValue, data: Nothing?) {
        visitSingletonReference(expression)
    }

    fun visitSingletonReference(expression: IrGetSingletonValue) {
        visitDeclarationReference(expression)
    }

Response:
override fun visitGetObjectValue(expression: IrGetObjectValue, data: Nothing?) {
        visitGetObjectValue(expression)
    }

    fun visitGetObjectValue(expression: IrGetObjectValue) {
        visitSingletonReference(expression)
    }

    override fun visitGetEnumValue(expression: IrGetEnumValue, data: Nothing?) {<|endoftext|>


Prompt:
private val cache: FirCache<FirSession, DeprecationsPerUseSite, Nothing?> = firCachesFactory.createCache { session ->
        @Suppress("UNCHECKED_CAST")
        DeprecationsPerUseSite(
            all?.computeDeprecationInfoOrNull(session),

Response:
bySpecificSite?.mapValues { (_, info) -> info.computeDeprecationInfoOrNull(session) }?.filterValues { it != null }
                    as Map<AnnotationUseSiteTarget, DeprecationInfo>?
        )
    }

    override fun getDeprecationsInfo(session: FirSession): DeprecationsPerUseSite {
        return cache.getValue(session, null)
    }<|endoftext|>


Prompt:
messageCollector?.report(ERROR, errorMessageWithStackTrace)
                    }
                }
            }

            val extensionStorage = CompilerPluginRegistrar.ExtensionStorage()
            for (registrar in configuration.getList(CompilerPluginRegistrar.COMPILER_PLUGIN_REGISTRARS)) {
                with(registrar) { extensionStorage.registerExtensions(configuration) }

Response:
}
            extensionStorage.registerInProject(project) { createErrorMessage(it) }
        }

        private fun registerApplicationServicesForCLI(applicationEnvironment: KotlinCoreApplicationEnvironment) {
            // ability to get text from annotations xml files
            applicationEnvironment.registerFileType(PlainTextFileType.INSTANCE, "xml")
            applicationEnvironment.registerParserDefinition(JavaParserDefinition())
        }<|endoftext|>


Prompt:
"kotlin.text.StringsKt.trimIndent", "kotlin.text.trimIndent" -> str.trimIndent()
            "kotlin.text.StringsKt.trimMargin", "kotlin.text.trimMargin" -> {

Response:
val marginPrefix = environment.callStack.loadState(irFunction.valueParameters.single().symbol).asString()
                str.trimMargin(marginPrefix)
            }
            "kotlin.text.StringsKt.trimMargin\$default", "kotlin.text.trimMargin\$default" -> str.trimMargin()<|endoftext|>


Prompt:
import org.jetbrains.kotlin.backend.konan.ir.actualCallee
import org.jetbrains.kotlin.backend.konan.ir.isVirtualCall
import org.jetbrains.kotlin.backend.konan.llvm.IntrinsicType

Response:
import org.jetbrains.kotlin.backend.konan.llvm.tryGetIntrinsicType
import org.jetbrains.kotlin.backend.konan.logMultiple
import org.jetbrains.kotlin.backend.konan.lower.*
import org.jetbrains.kotlin.ir.IrElement<|endoftext|>


Prompt:
for (i in (5.toShort() downTo 3.toShort()).reversed()) {
        list3.add(i)
        if (list3.size > 23) break
    }
    if (list3 != listOf<Int>(3, 4, 5)) {
        return "Wrong elements for (5.toShort() downTo 3.toShort()).reversed(): $list3"

Response:
}

    val list4 = ArrayList<Long>()
    for (i in (5L downTo 3L).reversed()) {
        list4.add(i)
        if (list4.size > 23) break
    }
    if (list4 != listOf<Long>(3, 4, 5)) {<|endoftext|>


Prompt: if (x !== null && <!SENSELESS_COMPARISON!><!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString /* = kotlin.String */ & TypealiasNullableString /* = kotlin.String? */")!>x<!> != null<!>) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString /* = kotlin.String */ &

Response: TypealiasNullableString /* = kotlin.String? */")!>x<!>.propNullableAny<|endoftext|>


Prompt:
// IGNORE_BACKEND: JVM
// WITH_STDLIB
// WORKS_WHEN_VALUE_CLASS
// LANGUAGE: +ValueClasses, +GenericInlineClassParameter

OPTIONAL_JVM_INLINE_ANNOTATION
value class A<T: String>(val value: T)

fun interface B {
    fun f(x: A<String>): A<String>
}

Response:
inline fun g(unit: Unit = Unit, b: B): A<String> {
    return b.f(A("Fail"))
}

fun box(): String {
    val b = { _ : A<*> -> A("O") }
    return g(b = b).value + g { A("K") }.value
}<|endoftext|>


Prompt:
assertFalse(m == mapOf("a" to "1", "b" to "2", "c" to "4"))
        assertFalse(m == mapOf("a" to "1", "b" to "2", "c" to "5"))
        assertFalse(m == mapOf("a" to "1", "b" to "2"))
        assertEquals(m.keys, expected.keys)

Response:
assertEquals(m.values.toList(), expected.values.toList())
        assertEquals(m.entries, expected.entries)
    }

    @Test fun hashCodeTest() {
        val expected = mapOf("a" to "1", "b" to "2", "c" to "3")
        val m = HashMap(expected)<|endoftext|>


Prompt:
protected var mutableProperty: String = "text"

    @set:[Ann]
    protected var mutablePropertyWithAnnotationList: String = "text"

    @set:Ann
    protected var delegatedProperty: String by CustomDelegate()

    @set:Ann
    var propertyWithCustomSetter: Int
        get() = 5
        set(v) {}

Response:
<!INAPPLICABLE_TARGET_ON_PROPERTY, WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET!>@set:Ann<!>
    fun annotationOnFunction(a: Int) = a + 5

    fun anotherFun() {
        <!INAPPLICABLE_TARGET_ON_PROPERTY!>@set:Ann<!><|endoftext|>


Prompt:
"UByteArray" -> UnsignedArrayType.UBYTEARRAY
            "UShortArray" -> UnsignedArrayType.USHORTARRAY
            "UIntArray" -> UnsignedArrayType.UINTARRAY
            "ULongArray" -> UnsignedArrayType.ULONGARRAY
            else -> null
        }

    fun isUnsignedArrayClass(descriptor: DeclarationDescriptor): Boolean {

Response:
val container = descriptor.containingDeclaration
        return container is PackageFragmentDescriptor &&
                container.fqName == StandardNames.BUILT_INS_PACKAGE_FQ_NAME &&
                descriptor.name in unsignedArrayTypeNames
    }
}<|endoftext|>


Prompt:
return@mapNotNull PackagePartsCacheData(proto.`package`, context)
        }
    }

    override fun computePackageSetWithNonClassDeclarations() = packageAndMetadataPartProvider.computePackageSetWithNonClassDeclarations()

    override fun knownTopLevelClassesInPackage(packageFqName: FqName) = metadataTopLevelClassesInPackageCache.getValue(packageFqName)

Response:
override fun extractClassMetadata(classId: ClassId, parentContext: FirDeserializationContext?): ClassMetadataFindResult? {
        val classData = classDataFinder.findClassData(classId) ?: return null
        return ClassMetadataFindResult.Metadata(
            classData.nameResolver,
            classData.classProto,
            annotationDeserializer = annotationDeserializer,<|endoftext|>


Prompt:
// !DIAGNOSTICS: -UNUSED_PARAMETER
// !OPT_IN: kotlin.RequiresOptIn
// NI_EXPECTED_FILE

@file:OptIn(ExperimentalTypeInference::class)

import kotlin.experimental.ExperimentalTypeInference

interface Base

interface Controller<T> : Base {
    suspend fun yield(t: T) {}
}

Response:
fun <S> generate(g: suspend Controller<S>.() -> Unit): S = TODO()

fun Base.baseExtension() {}
fun Controller<out Any?>.outNullableAnyExtension() {}
fun Controller<out Any>.outAnyExtension() {}
fun Controller<Any?>.invNullableAnyExtension() {}
fun <S> Controller<S>.genericExtension() {}<|endoftext|>


Prompt:
private fun mockType(packageName: String, className: String, vararg arguments: Pair<AbiType, AbiVariance>?): AbiType {
        return SimpleTypeImpl(
            classifierReference = ClassReferenceImpl(AbiQualifiedName(AbiCompoundName(packageName), AbiCompoundName(className))),
            arguments = arguments.map { argument ->
                if (argument == null)

Response:
StarProjectionImpl
                else
                    TypeProjectionImpl(argument.first, argument.second)
            },
            nullability = AbiTypeNullability.NOT_SPECIFIED
        )
    }
}<|endoftext|>


Prompt:
0x40346B9C, 0x4035FDBB, 0x40378FDB, 0x403921FB, 0x403AB41B, 0x403C463A,
    0x403DD85A, 0x403F6A7A, 0x40407E4C, 0x4041475C, 0x4042106C, 0x4042D97C,

Response:
0x4043A28C, 0x40446B9C, 0x404534AC, 0x4045FDBB, 0x4046C6CB, 0x40478FDB,
    0x404858EB, 0x404921FB,
)

/*
 * invpio2:  53 bits of 2/pi
 * pio2_1:   first  33 bit of pi/2<|endoftext|>


Prompt:
val DOCUMENT_POSITION_PRECEDING: Short
        val DOCUMENT_POSITION_FOLLOWING: Short
        val DOCUMENT_POSITION_CONTAINS: Short
        val DOCUMENT_POSITION_CONTAINED_BY: Short
        val DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: Short
    }
}

/**

Response:
* Exposes the JavaScript [CDATASection](https://developer.mozilla.org/en/docs/Web/API/CDATASection) to Kotlin
 */
public external open class CDATASection : Text {
    companion object {
        val ELEMENT_NODE: Short
        val ATTRIBUTE_NODE: Short
        val TEXT_NODE: Short<|endoftext|>


Prompt:
fun box(stepId: Int): String {
    val x = test()
    if (stepId == 4) {
        // this is known issue, that return type doesn not affect IdSignature
        // https://youtrack.jetbrains.com/issue/KT-51707
        if (x != 41) return "Fail; got $x"
    } else {

Response:
if (stepId != x) return "Fail; got $x"
    }
    return "OK"
}<|endoftext|>


Prompt:
assert(numInput != 0UL)
    assert(buffer.len() > 0)
    assert(offsetInput > 0 && offsetInput <= buffer.len())

    var num = numInput
    var offset = offsetInput
    do {
        val t = num / 10U
        val r = num % 10U
        num = t
        offset--

Response:
buffer.set(offset, digitToChar(r.toInt()))
    } while (num > 0U)
}

private fun Boolean.toInt() = if (this) 1 else 0
private fun Boolean.toLong() = if (this) 1L else 0L

private fun decimalCount32(value: UInt): Int {
    if (value < 100000u) {<|endoftext|>


Prompt:
typealias R = <!RECURSIVE_TYPEALIAS_EXPANSION!>R<!>

typealias L = <!RECURSIVE_TYPEALIAS_EXPANSION!>List<L><!>

typealias A = <!RECURSIVE_TYPEALIAS_EXPANSION!>B<!>

Response:
typealias B = <!RECURSIVE_TYPEALIAS_EXPANSION!>A<!>

typealias F1 = <!RECURSIVE_TYPEALIAS_EXPANSION!>(Int) -> F2<!>
typealias F2 = <!RECURSIVE_TYPEALIAS_EXPANSION!>(F1) -> Int<!>
typealias F3 = (F1) -> Int<|endoftext|>


Prompt:
val generateDeclaredClassFilter: GenerateClassFilter,
    val targetId: TargetId?,
    moduleName: String?,
    val outDirectory: File?,
    private val onIndependentPartCompilationEnd: GenerationStateEventCallback,
    val jvmBackendClassResolver: JvmBackendClassResolver,
    val isIrBackend: Boolean,
    val ignoreErrors: Boolean,

Response:
val diagnosticReporter: DiagnosticReporter,
    val isIncrementalCompilation: Boolean
) {
    class Builder(
        private val project: Project,
        private val builderFactory: ClassBuilderFactory,
        private val module: ModuleDescriptor,
        private val bindingContext: BindingContext,
        private val configuration: CompilerConfiguration
    ) {<|endoftext|>


Prompt:
description = """
            Command line arguments to pass to the executable.
            Note that this directive makes sense only in combination with // KIND: STANDALONE_NO_TR
        """.trimIndent()
    )

    val ASSERTIONS_MODE by enumDirective<AssertionsMode>(
        description = """
            Force assertions mode to given value, overriding calculated mode which is derived from cacheMode and optimizationMode.

Response:
""".trimIndent()
    ) {
        AssertionsMode.fromStringOrNull(it)
    }
}

// mimics class `JVMAssertionsMode`
enum class AssertionsMode(val description: String) {
    ALWAYS_ENABLE("always-enable"),
    ALWAYS_DISABLE("always-disable"),
    JVM("jvm"),<|endoftext|>


Prompt:
internal fun __ieee754_exp(_x: Double): Double    /* default IEEE double exp */ {
    var x: Double = _x
    var y: Double
    var hi: Double = 0.0
    var lo: Double = 0.0
    var c: Double
    var t: Double
    var k: Int = 0
    var xsb: Int
    var hx: UInt

Response:
hx = __HIu(x)    /* high word of x */
    xsb = ((hx shr 31) and 1U).toInt()        /* sign bit of x */
    hx = hx and 0x7fffffffU        /* high word of |x| */

    /* filter out non-finite argument */<|endoftext|>


Prompt:
<!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE, NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>internalVarTopLevel<!> = 1
        <!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>privateVarTopLevel<!>

Response:
<!NON_PUBLIC_CALL_FROM_PUBLIC_INLINE, NON_PUBLIC_CALL_FROM_PUBLIC_INLINE!>privateVarTopLevel<!> = 1

        publishedVar
        publishedVar = 1
    }

    @PublishedApi
    internal inline var publishedVar: Int
        get() {
            publicFun()<|endoftext|>


Prompt:
class JsKlibTestModuleCompiler : CliTestModuleCompiler() {
    override val compilerKind = CompilerExecutor.CompilerKind.JS

    override fun buildPlatformCompilerOptions(module: TestModule, testServices: TestServices): List<String> {
        return listOf(

Response:
K2JSCompilerArguments::libraries.cliArgument, testServices.standardLibrariesPathProvider.fullJsStdlib().absolutePath,
        )
    }
}

/**
 * [DispatchingTestModuleCompiler] chooses the appropriate compiler for a module based on its platform.
 * In case all tests in a suite should compile libraries for a single platform, one of the underlying [TestModuleCompiler]s<|endoftext|>


Prompt:
0x0UL,     0x0UL,     0x7ff8000000000000UL,     0x0UL,
            0x3ff0000000000000UL,     0x0UL,     0x7ff0000000000000UL,     0x3ff0000000000000UL,

Response:
0x3ff0000000000000UL,     0x3ff0000000000000UL,     0x3ff0000000000000UL,     0x3ff0000000000000UL,
            0x0UL,     0x7ff0000000000000UL,     0x3ff0000000000000UL,     0x3ff0000000000000UL,<|endoftext|>


Prompt:
val stringArgumentPropertiesMap = CompilerArgumentsContentProspector.getStringCompilerArgumentProperties(compilerArguments::class)
            .associateBy { it.name }
        stringArgumentsByName.forEach { (name, arg) ->
            val mutableProp = stringArgumentPropertiesMap[name].safeAs<KMutableProperty1<T, String?>>() ?: return@forEach

Response:
mutableProp.set(compilerArguments, arg)
        }
        val arrayArgumentsByName = readArrayArguments(element)
        val arrayArgumentPropertiesMap = CompilerArgumentsContentProspector.getArrayCompilerArgumentProperties(compilerArguments::class)
            .associateBy { it.name }
        arrayArgumentsByName.forEach { (name, arr) -><|endoftext|>


Prompt:
// ISSUE: KT-58002

// TARGET_BACKEND: JVM_IR

// FILE: NLS.java
import java.lang.annotation.*;

@Target(ElementType.TYPE_USE)
public @interface NLS {
    enum Capitalization { NotSpecified, Specified }
    Capitalization capitalization() default Capitalization.NotSpecified;
}

// FILE: BaseInspection.java

Response:
public class BaseInspection {
    @NLS(capitalization = NLS.Capitalization.Specified)
    public static String fetchProbableBugs() {
        return "OK";
    }
}

// FILE: main.kt

fun getGroupDisplayName() = BaseInspection.fetchProbableBugs()
fun box(): String = getGroupDisplayName()<|endoftext|>


Prompt:
// !OPT_IN: kotlin.contracts.ExperimentalContracts

/*
 * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE)
 *
 * SECTIONS: contracts, analysis, common
 * NUMBER: 1
 * DESCRIPTION: Analysis by contracts with mixed CallsInPlace and Returns effects.
 */

// FILE: contracts.kt

package contracts

Response:
import kotlin.contracts.*

// TESTCASE NUMBER: 1
inline fun case_1(value_1: Int?, block: () -> Unit): Boolean {
    contract {
        callsInPlace(block, InvocationKind.EXACTLY_ONCE)
        returns(true) implies (value_1 != null)
    }
    block()
    return value_1 != null
}<|endoftext|>


Prompt:
val l2: Byte = <!INITIALIZER_TYPE_MISMATCH, TYPE_MISMATCH!>-1.toLong()<!>

// val l3: false
val l3: Int = <!INITIALIZER_TYPE_MISMATCH, TYPE_MISMATCH!>-1.toLong()<!>

// val l4: false

Response:
val l4: Short = <!INITIALIZER_TYPE_MISMATCH, TYPE_MISMATCH!>-1.toLong()<!>

// val b1: false
val b1: Byte = <!INITIALIZER_TYPE_MISMATCH, TYPE_MISMATCH!>-1.toByte()<!>

// val b2: false<|endoftext|>


Prompt:
import org.jetbrains.kotlin.gradle.targets.js.npm.tasks.RootPackageJsonTask
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnPlugin
import org.jetbrains.kotlin.gradle.tasks.CleanDataTask
import org.jetbrains.kotlin.gradle.tasks.registerTask

Response:
import org.jetbrains.kotlin.gradle.utils.castIsolatedKotlinPluginClassLoaderAware
import org.jetbrains.kotlin.gradle.utils.getFile
import org.jetbrains.kotlin.gradle.utils.onlyIfCompat
import org.jetbrains.kotlin.gradle.utils.providerWithLazyConvention<|endoftext|>


Prompt:
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION
// SKIP_TXT

/*
 * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
 *
 * SPEC VERSION: 0.1-544
 * MAIN LINK: declarations, classifier-declaration, class-declaration, constructor-declaration -> paragraph 5 -> sentence 1

Response:
* PRIMARY LINKS: declarations, classifier-declaration, class-declaration, constructor-declaration -> paragraph 4 -> sentence 1
 * declarations, classifier-declaration, class-declaration -> paragraph 1 -> sentence 1
 * declarations, classifier-declaration, class-declaration, constructor-declaration -> paragraph 2 -> sentence 1<|endoftext|>


Prompt:
// IGNORE_BACKEND: JS, JS_IR, JS_IR_ES6, WASM
// FILE: lib.kt
val x: String = computeX()

fun computeX(): String = throw IllegalStateException("1")

val y: String = computeY()

fun computeY(): String = "2"

// FILE: main.kt
fun box() : String {
    try {
        x

Response:
return "FAIL 1"
    } catch(t: Error) {
        val cause = t.cause
        if (cause !is IllegalStateException) return "FAIL 2"
        if (cause.message != "1") return "FAIL 3"
    }
    try {
        y
        return "FAIL 4"
    } catch(t: Error) {<|endoftext|>


Prompt:
// DIAGNOSTICS: -UNUSED_PARAMETER
// !LANGUAGE: +RequiredPrimaryConstructorDelegationCallInEnums

enum class Enum1(val a: String) {
    A;
    <!PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED!>constructor()<!>
}

Response:
enum class Enum2(val a: String) {
    A, B;
    constructor(): this("")
}

enum class Enum3(val a: String = "") {<|endoftext|>


Prompt:
a8: A8,
        a9: A9,
        a10: A10,
        c1: MutableList<String>,
        c2: MutableList<Int>
) {
    a1.removeAt(1)
    a1.remove("")

    a2.removeAt(1)
    a2.remove("")

    a3.removeAt(1)

Response:
a3.remove("")

    a4.removeAt(1)
    a4.remove("")

    a5.removeAt(1)
    a5.remove("")

    a6.removeAt(1)
    a6.remove("")

    a7.removeAt(1)
    a7.remove("")

    a8.removeAt(1)<|endoftext|>


Prompt:
) as KtConstantReference<ConeKotlinType, ConeDiagnostic>
            )
        }

        override fun visitConditionalEffectDeclaration(
            conditionalEffect: KtConditionalEffectDeclaration<KotlinTypeBean, Nothing?>,
            data: Nothing?
        ): ConeContractDescriptionElement {
            return ConeConditionalEffectDeclaration(

Response:
conditionalEffect.effect.accept(this, data) as KtEffectDeclaration<ConeKotlinType, ConeDiagnostic>,
                conditionalEffect.condition.accept(this, data) as KtBooleanExpression<ConeKotlinType, ConeDiagnostic>
            )
        }

        override fun visitLogicalBinaryOperationContractExpression(<|endoftext|>


Prompt:
"Non-script class in a script should NOT have the metadata flag set",
            scriptClass.classLoader.loadClass("Metadata_flag\$RandomClass").isFlagSet()
        )
    }

    private fun compileScript(
        scriptPath: String,
        scriptDefinition: KotlinScriptDefinition,
        runIsolated: Boolean = true,
        suppressOutput: Boolean = false,

Response:
saveClassesDir: File? = null
    ): Class<*>? {
        val messageCollector =
            if (suppressOutput) MessageCollector.NONE
            else PrintingMessageCollector(System.err, MessageRenderer.PLAIN_FULL_PATHS, false)<|endoftext|>


Prompt:
internal fun storeTypeFromCallee(access: FirQualifiedAccessExpression, isLhsOfAssignment: Boolean) {
        val typeFromCallee = components.typeFromCallee(access)
        access.resultType = if (isLhsOfAssignment) {
            session.typeApproximator.approximateToSubType(

Response:
typeFromCallee.type, TypeApproximatorConfiguration.FinalApproximationAfterResolutionAndInference
            )
        } else {
            session.typeApproximator.approximateToSuperType(
                typeFromCallee.type, TypeApproximatorConfiguration.IntermediateApproximationToSupertypeAfterCompletionInK2
            )
        } ?: typeFromCallee.type<|endoftext|>


Prompt:
fun protectedAndInternal1() = doTestFailure(
            Protected.toMock(), Internal.toMock()
        )

        @Test(expected = IllegalCommonizerStateException::class)
        fun protectedAndInternal2() = doTestFailure(
            Protected.toMock(), Protected.toMock(), Internal.toMock()
        )

Response:
@Test(expected = IllegalCommonizerStateException::class)
        fun publicAndPrivate() = doTestFailure(
            Public.toMock(), Private.toMock()
        )

        @Test(expected = IllegalCommonizerStateException::class)
        fun privateOnly() = doTestFailure(
            Private.toMock()
        )
    }
}<|endoftext|>


Prompt:
public inline operator fun <K, V> kotlin.collections.MutableMap<K, V>.set(key: K, value: V): kotlin.Unit

@kotlin.internal.InlineOnly

Response:
public inline operator fun <V> kotlin.collections.MutableMap<in kotlin.String, in V>.setValue(thisRef: kotlin.Any?, property: kotlin.reflect.KProperty<*>, value: V): kotlin.Unit

@kotlin.SinceKotlin(version = "1.4")<|endoftext|>


Prompt:
private val parent: ClassLoader,
    private val allowedPackage: String,
) : ClassLoader(null) { // `null` parent means that the parent is the bootstrap classloader
    override fun loadClass(name: String, resolve: Boolean): Class<*> {
        return if (name.startsWith(allowedPackage)) {
            parent.loadClass(name)
        } else {

Response:
super.loadClass(name, resolve)
        }
    }
}<|endoftext|>


Prompt:
fun testR0xE9() {
    // with possible local optimizations
    if (1.toShort() in intArray.indices != range0.contains(1.toShort())) throw AssertionError()
    if (1.toShort() !in intArray.indices != !range0.contains(1.toShort())) throw AssertionError()

Response:
if (!(1.toShort() in intArray.indices) != !range0.contains(1.toShort())) throw AssertionError()
    if (!(1.toShort() !in intArray.indices) != range0.contains(1.toShort())) throw AssertionError()
    // no local optimizations<|endoftext|>


Prompt:
p.println("====== Id to file map")
        p.println(idToFile.dump())

        val lookupsStrings = lookupSymbols.groupBy { LookupSymbolKey(it.name, it.scope) }

        for (lookup in lookupMap.keys.sorted()) {
            val fileIds = lookupMap[lookup]!!

Response:
val key = if (lookup in lookupsStrings) {
                lookupsStrings[lookup]!!.map { "${it.scope}#${it.name}" }.sorted().joinToString(", ")
            } else {
                lookup.toString()
            }

            val value = fileIds.map { it.toString() }.sorted().joinToString(", ")<|endoftext|>


Prompt:
""".trimIndent(),
        setOf("com.foo.bar", "com.bar.foo")
    )

    @Test
    fun testCommentsAreIgnored() = testConfigParsing(
        """
            // Comment first line
            com.foo.bar
            // Comment last line
        """.trimIndent(),
        setOf("com.foo.bar")
    )

Response:
@Test
    fun whitespaceIgnored() = testConfigParsing(
        """

               com.foo.bar

        """.trimIndent(),
        setOf("com.foo.bar")
    )

    @Test
    fun testWildcardsAreParsed() = testConfigParsing(
        """
            // Comment first line
            com.*
            // Comment last line<|endoftext|>


Prompt:
interface OverloadsAnnotationClassConstructorWarning : KtFirDiagnostic<KtAnnotationEntry> {
        override val diagnosticClass get() = OverloadsAnnotationClassConstructorWarning::class
    }

    interface OverloadsPrivate : KtFirDiagnostic<KtAnnotationEntry> {
        override val diagnosticClass get() = OverloadsPrivate::class
    }

Response:
interface DeprecatedJavaAnnotation : KtFirDiagnostic<KtAnnotationEntry> {
        override val diagnosticClass get() = DeprecatedJavaAnnotation::class
        val kotlinName: FqName
    }

    interface JvmPackageNameCannotBeEmpty : KtFirDiagnostic<KtAnnotationEntry> {<|endoftext|>


Prompt:
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int & kotlin.Int?"), DEBUG_INFO_SMARTCAST!>g<!>.propAny
                                <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int & kotlin.Int?")!>g<!>.propNullableT

Response:
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int & kotlin.Int?")!>g<!>.propNullableAny
                                <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int & kotlin.Int?"), DEBUG_INFO_SMARTCAST!>g<!>.funT()<|endoftext|>


Prompt:
isTailrec = declaration.isTailrec,
            isSuspend = declaration.isSuspend,
            isOperator = declaration.isOperator,
            isInfix = declaration.isInfix,
            isExternal = declaration.isExternal,
        ).apply {
            parent = parentClass
            contextReceiverParametersCount = declaration.contextReceiverParametersCount
            annotations = declaration.copyAnnotations()

Response:
typeParameters = declaration.typeParameters.map { copyTypeParameter(it, this) }
            for ((i, thisTypeParameter) in typeParameters.withIndex()) {
                val otherTypeParameter = declaration.typeParameters[i]
                thisTypeParameter.superTypes = otherTypeParameter.superTypes.map(typeRemapper::remapType)
            }<|endoftext|>


Prompt:
actual fun <T, R> withTypeParamIncorrect<!ACTUAL_WITHOUT_EXPECT!>(p: Foo.<!UNRESOLVED_REFERENCE!>Inner<!><T>)<!> {}

actual fun star<!ACTUAL_WITHOUT_EXPECT!>(p: Foo.<!UNRESOLVED_REFERENCE!>Inner<!><*>)<!> {}

Response: actual fun starVsNonStar<!ACTUAL_WITHOUT_EXPECT!>(p: Foo.<!UNRESOLVED_REFERENCE!>Inner<!><Any>)<!> {}<|endoftext|>


Prompt:
val klibPlatform = "${File.separator}klib${File.separator}platform${File.separator}".replace("\\", "\\\\")

                assertTasksExecuted(":commonizeNativeDistribution")
                assertTasksExecuted(":checkLinuxX64MainPlatformDependencies")
                assertTasksExecuted(":checkLinuxArm64MainPlatformDependencies")

Response:
assertOutputContains(Regex(""".*linuxX64Main.*$klibPlatform.*[Pp]osix.*"""))
                assertOutputContains(Regex(""".*linuxArm64Main.*$klibPlatform.*[Pp]osix.*"""))
            }
        }
    }

    @DisplayName("KT-50592 - isolated jvm subproject - should not fail commonization")<|endoftext|>


Prompt:
// SKIP_KT_DUMP
// TARGET_BACKEND: JVM
// JDK_KIND: FULL_JDK_21
// WITH_STDLIB

// FILE: 1.kt
import java.util.*
abstract class A : SortedSet<Int>, Set<Int>

abstract class B(override val size: Int) :  SortedSet<Int>, Set<Int> {

Response:
override fun reversed(): SortedSet<Int> {
        return null!!
    }

    override fun first(): Int {
        return 1
    }
}

abstract class C : SortedSet<Int?>, MutableSet<Int?>

abstract class D : SortedSet<Int?>, MutableSet<Int?> {
    override fun reversed(): SortedSet<Int?>? {<|endoftext|>


Prompt:
* as it may be passed to [operation] function later because of sequence's lazy nature.
 *
 * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.
 *
 * The operation is _intermediate_ and _stateless_.
 *
 * @sample samples.collections.Collections.Aggregates.runningFold
 */
@SinceKotlin("1.4")

Response:
public fun <T, R> Sequence<T>.runningFold(initial: R, operation: (acc: R, T) -> R): Sequence<R> {
    return sequence {
        yield(initial)
        var accumulator = initial
        for (element in this@runningFold) {
            accumulator = operation(accumulator, element)
            yield(accumulator)
        }
    }
}<|endoftext|>


Prompt:
+irReturn(irCall(closureClassConstructor).also { it.putValueArgument(0, irGet(result.valueParameters[0])) })
        }

        additionalDeclarations += closureClass
        additionalDeclarations += result
        return result
    }

    private fun createJsClosureCaller(info: FunctionTypeInfo): IrSimpleFunction {
        val result = context.irFactory.buildFun {

Response:
name = Name.identifier("__callJsClosure_${info.signatureString}")
            returnType = info.adaptedResultType
            isExternal = true
        }
        result.parent = currentParent
        result.addValueParameter {
            name = Name.identifier("f")
            type = jsRelatedSymbols.jsAnyType
        }
        val arity = info.adaptedParameterTypes.size<|endoftext|>